diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/AUTHORS sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/AUTHORS --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/AUTHORS 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/AUTHORS 2017-07-23 16:22:03.000000000 +0000 @@ -54,7 +54,8 @@ Thomas Lockhart Gerald Richter ait-mob-dts Lukas Grohmann -Tamas Kurczveil -Pablo Alvarez Lopez +Tamas Kurczveil +Pablo Alvarez Lopez palcraft Joerg Schweizer +Mirco Sturari diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/configure sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/configure --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/configure 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/configure 2017-07-23 16:22:03.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sumo 0.28.0. +# Generated by GNU Autoconf 2.69 for sumo 0.30.0. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ # Identity of this package. PACKAGE_NAME='sumo' PACKAGE_TARNAME='sumo' -PACKAGE_VERSION='0.28.0' -PACKAGE_STRING='sumo 0.28.0' +PACKAGE_VERSION='0.30.0' +PACKAGE_STRING='sumo 0.30.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -661,8 +661,6 @@ WITH_VERSION_H_TRUE TRACI_FALSE TRACI_TRUE -CHECK_MEMORY_LEAKS_FALSE -CHECK_MEMORY_LEAKS_TRUE CXXCPP OTOOL64 OTOOL @@ -802,9 +800,6 @@ with_gnu_ld with_sysroot enable_libtool_lock -enable_memcheck -enable_internal_lanes -enable_double_precision enable_traci with_xerces with_xerces_libraries @@ -1377,7 +1372,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sumo 0.28.0 to adapt to many kinds of systems. +\`configure' configures sumo 0.30.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1448,7 +1443,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sumo 0.28.0:";; + short | recursive ) echo "Configuration of sumo 0.30.0:";; esac cat <<\_ACEOF @@ -1474,12 +1469,6 @@ --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) - --enable-memcheck enable compilation of memory leak checks - [default=no]. - --disable-internal-lanes - Disable junction internal lanes. - --disable-double-precision - Use "float" instead of "double" for calculations. --disable-traci disable Traffic Control Interface (TraCI) Server [default=no]. @@ -1600,7 +1589,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sumo configure 0.28.0 +sumo configure 0.30.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2249,7 +2238,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sumo $as_me 0.28.0, which was +It was created by sumo $as_me 0.30.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3228,7 +3217,7 @@ # Define the identity of the package. PACKAGE='sumo' - VERSION='0.28.0' + VERSION='0.30.0' cat >>confdefs.h <<_ACEOF @@ -15662,77 +15651,11 @@ -# Check whether --enable-memcheck was given. -if test "${enable_memcheck+set}" = set; then : - enableval=$enable_memcheck; -fi - -if test x$enable_memcheck = xyes; then - if test x$CXX = xclang++; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --enable-memcheck does not work with clang yet" >&5 -$as_echo "$as_me: WARNING: --enable-memcheck does not work with clang yet" >&2;} - enable_memcheck="no" - fi -fi - if test x$enable_memcheck = xyes; then - CHECK_MEMORY_LEAKS_TRUE= - CHECK_MEMORY_LEAKS_FALSE='#' -else - CHECK_MEMORY_LEAKS_TRUE='#' - CHECK_MEMORY_LEAKS_FALSE= -fi - -if test x$enable_memcheck = xyes; then - -$as_echo "#define CHECK_MEMORY_LEAKS 1" >>confdefs.h - - ac_enabled="$ac_enabled MemoryChecks" -else - ac_disabled="$ac_disabled MemoryChecks" -fi - -# Check whether --enable-internal-lanes was given. -if test "${enable_internal_lanes+set}" = set; then : - enableval=$enable_internal_lanes; -fi -if test x$enable_internal_lanes != xno; then +$as_echo "#define POSITION_EPS 0.1" >>confdefs.h -$as_echo "#define HAVE_INTERNAL_LANES 1" >>confdefs.h - ac_enabled="$ac_enabled InternalLanes" -else - ac_disabled="$ac_disabled InternalLanes" -fi - -# Check whether --enable-double-precision was given. -if test "${enable_double_precision+set}" = set; then : - enableval=$enable_double_precision; -fi - -if test x$enable_double_precision != xno; then - -$as_echo "#define SUMOReal double" >>confdefs.h - - ac_enabled="$ac_enabled DoublePrecision" -else - -$as_echo "#define SUMOReal float" >>confdefs.h - - ac_disabled="$ac_disabled DoublePrecision" -fi - - -$as_echo "#define POSITION_EPS (SUMOReal)0.1" >>confdefs.h - - -$as_echo "#define NUMERICAL_EPS (SUMOReal)0.001" >>confdefs.h - - -$as_echo "#define OUTPUT_ACCURACY 2" >>confdefs.h - - -$as_echo "#define GEO_OUTPUT_ACCURACY 6" >>confdefs.h +$as_echo "#define NUMERICAL_EPS 0.001" >>confdefs.h # Check whether --enable-traci was given. @@ -17605,7 +17528,7 @@ -ac_config_files="$ac_config_files src/Makefile src/activitygen/Makefile src/activitygen/activities/Makefile src/activitygen/city/Makefile src/foreign/Makefile src/foreign/eulerspiral/Makefile src/foreign/gl2ps/Makefile src/foreign/mersenne/Makefile src/foreign/nvwa/Makefile src/foreign/PHEMlight/Makefile src/foreign/PHEMlight/cpp/Makefile src/foreign/polyfonts/Makefile src/foreign/rtree/Makefile src/foreign/tcpip/Makefile src/gui/Makefile src/gui/dialogs/Makefile src/guinetload/Makefile src/guisim/Makefile src/microsim/Makefile src/microsim/actions/Makefile src/microsim/cfmodels/Makefile src/microsim/devices/Makefile src/microsim/lcmodels/Makefile src/microsim/logging/Makefile src/microsim/output/Makefile src/microsim/pedestrians/Makefile src/microsim/traffic_lights/Makefile src/microsim/trigger/Makefile src/marouter/Makefile src/netbuild/Makefile src/netedit/Makefile src/mesogui/Makefile src/mesosim/Makefile src/osgview/Makefile src/netgen/Makefile src/netimport/Makefile src/netimport/vissim/Makefile src/netimport/vissim/tempstructs/Makefile src/netimport/vissim/typeloader/Makefile src/netload/Makefile src/netwrite/Makefile src/od/Makefile src/polyconvert/Makefile src/router/Makefile src/dfrouter/Makefile src/duarouter/Makefile src/jtrrouter/Makefile src/tools/Makefile src/traci_testclient/Makefile src/traci-server/Makefile src/utils/Makefile src/utils/common/Makefile src/utils/distribution/Makefile src/utils/emissions/Makefile src/utils/foxtools/Makefile src/utils/geom/Makefile src/utils/gui/Makefile src/utils/gui/div/Makefile src/utils/gui/events/Makefile src/utils/gui/globjects/Makefile src/utils/gui/images/Makefile src/utils/gui/settings/Makefile src/utils/gui/tracker/Makefile src/utils/gui/windows/Makefile src/utils/importio/Makefile src/utils/iodevices/Makefile src/utils/options/Makefile src/utils/shapes/Makefile src/utils/traci/Makefile src/utils/vehicle/Makefile src/utils/xml/Makefile unittest/Makefile unittest/src/Makefile unittest/src/microsim/Makefile unittest/src/netbuild/Makefile unittest/src/utils/Makefile unittest/src/utils/common/Makefile unittest/src/utils/foxtools/Makefile unittest/src/utils/geom/Makefile unittest/src/utils/iodevices/Makefile bin/Makefile Makefile" +ac_config_files="$ac_config_files src/Makefile src/activitygen/Makefile src/activitygen/activities/Makefile src/activitygen/city/Makefile src/foreign/Makefile src/foreign/eulerspiral/Makefile src/foreign/gl2ps/Makefile src/foreign/mersenne/Makefile src/foreign/PHEMlight/Makefile src/foreign/PHEMlight/cpp/Makefile src/foreign/polyfonts/Makefile src/foreign/rtree/Makefile src/foreign/tcpip/Makefile src/gui/Makefile src/gui/dialogs/Makefile src/guinetload/Makefile src/guisim/Makefile src/microsim/Makefile src/microsim/actions/Makefile src/microsim/cfmodels/Makefile src/microsim/devices/Makefile src/microsim/lcmodels/Makefile src/microsim/logging/Makefile src/microsim/output/Makefile src/microsim/pedestrians/Makefile src/microsim/traffic_lights/Makefile src/microsim/trigger/Makefile src/marouter/Makefile src/netbuild/Makefile src/netedit/Makefile src/mesogui/Makefile src/mesosim/Makefile src/osgview/Makefile src/netgen/Makefile src/netimport/Makefile src/netimport/vissim/Makefile src/netimport/vissim/tempstructs/Makefile src/netimport/vissim/typeloader/Makefile src/netload/Makefile src/netwrite/Makefile src/od/Makefile src/polyconvert/Makefile src/router/Makefile src/dfrouter/Makefile src/duarouter/Makefile src/jtrrouter/Makefile src/tools/Makefile src/traci_testclient/Makefile src/traci-server/Makefile src/traci-server/lib/Makefile src/utils/Makefile src/utils/common/Makefile src/utils/distribution/Makefile src/utils/emissions/Makefile src/utils/foxtools/Makefile src/utils/geom/Makefile src/utils/gui/Makefile src/utils/gui/div/Makefile src/utils/gui/events/Makefile src/utils/gui/globjects/Makefile src/utils/gui/images/Makefile src/utils/gui/settings/Makefile src/utils/gui/tracker/Makefile src/utils/gui/windows/Makefile src/utils/importio/Makefile src/utils/iodevices/Makefile src/utils/options/Makefile src/utils/shapes/Makefile src/utils/traci/Makefile src/utils/vehicle/Makefile src/utils/xml/Makefile unittest/Makefile unittest/src/Makefile unittest/src/microsim/Makefile unittest/src/netbuild/Makefile unittest/src/utils/Makefile unittest/src/utils/common/Makefile unittest/src/utils/foxtools/Makefile unittest/src/utils/geom/Makefile unittest/src/utils/iodevices/Makefile bin/Makefile Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -17744,10 +17667,6 @@ as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${CHECK_MEMORY_LEAKS_TRUE}" && test -z "${CHECK_MEMORY_LEAKS_FALSE}"; then - as_fn_error $? "conditional \"CHECK_MEMORY_LEAKS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${TRACI_TRUE}" && test -z "${TRACI_FALSE}"; then as_fn_error $? "conditional \"TRACI\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -18161,7 +18080,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sumo $as_me 0.28.0, which was +This file was extended by sumo $as_me 0.30.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18227,7 +18146,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sumo config.status 0.28.0 +sumo config.status 0.30.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -18742,7 +18661,6 @@ "src/foreign/eulerspiral/Makefile") CONFIG_FILES="$CONFIG_FILES src/foreign/eulerspiral/Makefile" ;; "src/foreign/gl2ps/Makefile") CONFIG_FILES="$CONFIG_FILES src/foreign/gl2ps/Makefile" ;; "src/foreign/mersenne/Makefile") CONFIG_FILES="$CONFIG_FILES src/foreign/mersenne/Makefile" ;; - "src/foreign/nvwa/Makefile") CONFIG_FILES="$CONFIG_FILES src/foreign/nvwa/Makefile" ;; "src/foreign/PHEMlight/Makefile") CONFIG_FILES="$CONFIG_FILES src/foreign/PHEMlight/Makefile" ;; "src/foreign/PHEMlight/cpp/Makefile") CONFIG_FILES="$CONFIG_FILES src/foreign/PHEMlight/cpp/Makefile" ;; "src/foreign/polyfonts/Makefile") CONFIG_FILES="$CONFIG_FILES src/foreign/polyfonts/Makefile" ;; @@ -18784,6 +18702,7 @@ "src/tools/Makefile") CONFIG_FILES="$CONFIG_FILES src/tools/Makefile" ;; "src/traci_testclient/Makefile") CONFIG_FILES="$CONFIG_FILES src/traci_testclient/Makefile" ;; "src/traci-server/Makefile") CONFIG_FILES="$CONFIG_FILES src/traci-server/Makefile" ;; + "src/traci-server/lib/Makefile") CONFIG_FILES="$CONFIG_FILES src/traci-server/lib/Makefile" ;; "src/utils/Makefile") CONFIG_FILES="$CONFIG_FILES src/utils/Makefile" ;; "src/utils/common/Makefile") CONFIG_FILES="$CONFIG_FILES src/utils/common/Makefile" ;; "src/utils/distribution/Makefile") CONFIG_FILES="$CONFIG_FILES src/utils/distribution/Makefile" ;; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/configure.ac sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/configure.ac --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/configure.ac 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/configure.ac 2017-07-23 16:22:07.000000000 +0000 @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(sumo, 0.28.0) +AC_INIT(sumo, 0.30.0) AC_CONFIG_SRCDIR(src/sumo_main.cpp) AC_CANONICAL_SYSTEM @@ -64,43 +64,8 @@ AM_PROG_LIBTOOL -dnl Check for enable-features that shall go into config.h -AC_ARG_ENABLE([memcheck], [AS_HELP_STRING([--enable-memcheck],[enable compilation of memory leak checks [default=no].])]) -if test x$enable_memcheck = xyes; then - if test x$CXX = xclang++; then - AC_MSG_WARN([--enable-memcheck does not work with clang yet]) - enable_memcheck="no" - fi -fi -AM_CONDITIONAL(CHECK_MEMORY_LEAKS, test x$enable_memcheck = xyes) -if test x$enable_memcheck = xyes; then - AC_DEFINE(CHECK_MEMORY_LEAKS, 1, [Define to 1 in order to enable memory checks.]) - ac_enabled="$ac_enabled MemoryChecks" -else - ac_disabled="$ac_disabled MemoryChecks" -fi - -AC_ARG_ENABLE([internal-lanes], [AS_HELP_STRING([--disable-internal-lanes],[Disable junction internal lanes.])]) -if test x$enable_internal_lanes != xno; then - AC_DEFINE(HAVE_INTERNAL_LANES, 1, [Define to 1 if you want junction internal lanes]) - ac_enabled="$ac_enabled InternalLanes" -else - ac_disabled="$ac_disabled InternalLanes" -fi - -AC_ARG_ENABLE([double-precision], [AS_HELP_STRING([--disable-double-precision],[Use "float" instead of "double" for calculations.])]) -if test x$enable_double_precision != xno; then - AC_DEFINE([SUMOReal], [double], [defines the precision of floats]) - ac_enabled="$ac_enabled DoublePrecision" -else - AC_DEFINE([SUMOReal], [float], [defines the precision of floats]) - ac_disabled="$ac_disabled DoublePrecision" -fi - -AC_DEFINE([POSITION_EPS], [(SUMOReal)0.1], [defines the epsilon to use on position comparison]) -AC_DEFINE([NUMERICAL_EPS], [(SUMOReal)0.001], [defines the epsilon to use on general floating point comparison]) -AC_DEFINE([OUTPUT_ACCURACY], [2], [defines the number of digits after the comma in output]) -AC_DEFINE([GEO_OUTPUT_ACCURACY], [6], [defines the number of digits after the comma in geo-coordinates output]) +AC_DEFINE([POSITION_EPS], [0.1], [defines the epsilon to use on position comparison]) +AC_DEFINE([NUMERICAL_EPS], [0.001], [defines the epsilon to use on general floating point comparison]) AC_ARG_ENABLE([traci],[AS_HELP_STRING([--disable-traci],[disable Traffic Control Interface (TraCI) Server [default=no].])]) AM_CONDITIONAL(TRACI, test x$enable_traci != xno) @@ -471,7 +436,6 @@ src/foreign/Makefile src/foreign/eulerspiral/Makefile src/foreign/mersenne/Makefile -src/foreign/nvwa/Makefile src/foreign/PHEMlight/Makefile src/foreign/PHEMlight/cpp/Makefile src/foreign/polyfonts/Makefile @@ -513,6 +477,7 @@ src/tools/Makefile src/traci_testclient/Makefile src/traci-server/Makefile +src/traci-server/lib/Makefile src/utils/Makefile src/utils/common/Makefile src/utils/distribution/Makefile diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/activitygenConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/activitygenConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/activitygenConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/activitygenConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -26,6 +26,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/additional_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/additional_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/additional_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/additional_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,7 @@ + @@ -46,6 +47,8 @@ + + @@ -233,6 +236,12 @@ + + + + + + @@ -263,6 +272,7 @@ + @@ -283,6 +293,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/baseTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/baseTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/baseTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/baseTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,7 @@ - + + ]> @@ -30,12 +30,28 @@ + + + + + + + + + + + + + + + + @@ -73,8 +89,9 @@ - + + @@ -183,7 +200,7 @@ - + @@ -191,6 +208,7 @@ + @@ -253,4 +271,25 @@ + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/calibratorstats_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/calibratorstats_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/calibratorstats_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/calibratorstats_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/det_e1meso_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/det_e1meso_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/det_e1meso_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/det_e1meso_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/det_e2_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/det_e2_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/det_e2_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/det_e2_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/det_e3_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/det_e3_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/det_e3_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/det_e3_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -16,6 +16,7 @@ + @@ -24,6 +25,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/detectors_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/detectors_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/detectors_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/detectors_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/dfrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/dfrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/dfrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/dfrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/duarouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/duarouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/duarouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/duarouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + @@ -68,6 +70,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/edgediff_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/edgediff_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/edgediff_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/edgediff_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -73,19 +73,9 @@ - - - - - - - - - - - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/edges_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/edges_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/edges_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/edges_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -69,27 +69,10 @@ + - - - - - - - - - - - - - - - - - - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/instant_e1_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/instant_e1_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/instant_e1_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/instant_e1_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/jtrrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/jtrrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/jtrrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/jtrrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/marouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/marouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/marouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/marouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/netconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/netconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/netconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/netconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -46,6 +46,8 @@ + + @@ -53,9 +55,12 @@ + + + @@ -144,6 +149,7 @@ + @@ -169,10 +175,16 @@ + + + + + + @@ -187,6 +199,9 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/net_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/net_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/net_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/net_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,6 +40,7 @@ + @@ -91,6 +92,7 @@ + @@ -107,25 +109,26 @@ - - - - - - + - - + + + + + + + + - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/netgenerateConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/netgenerateConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/netgenerateConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/netgenerateConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -67,6 +67,8 @@ + + @@ -74,9 +76,11 @@ + + @@ -125,6 +129,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/nodes_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/nodes_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/nodes_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/nodes_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -39,7 +39,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/od2tripsConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/od2tripsConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/od2tripsConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/od2tripsConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,8 +28,11 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/polyconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/polyconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/polyconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/polyconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,7 +40,10 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/routeTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/routeTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/routeTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/routeTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -27,7 +27,7 @@ - + @@ -98,11 +98,28 @@ + + + + + + + + + + + + + + + + + @@ -360,6 +377,7 @@ + @@ -463,6 +481,7 @@ + @@ -477,6 +496,8 @@ + + @@ -525,6 +546,7 @@ + @@ -544,6 +566,7 @@ + @@ -556,6 +579,7 @@ + @@ -588,6 +612,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/state_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/state_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/state_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/state_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/stopinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/stopinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/stopinfo_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/stopinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/sumoConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/sumoConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/sumoConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/sumoConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -17,6 +17,7 @@ + @@ -33,12 +34,15 @@ + + + @@ -46,6 +50,7 @@ + @@ -67,6 +72,7 @@ + @@ -93,8 +99,10 @@ + + @@ -106,6 +114,7 @@ + @@ -191,6 +200,19 @@ + + + + + + + + + + + + + @@ -211,6 +233,7 @@ + @@ -232,6 +255,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/tllogic_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/tllogic_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/tllogic_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/tllogic_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -25,7 +25,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/tlsstates_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/tlsstates_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/tlsstates_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/tlsstates_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/tlsswitches_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/tlsswitches_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/tlsswitches_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/tlsswitches_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/tripinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/tripinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/tripinfo_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/tripinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -38,6 +38,7 @@ + @@ -64,6 +65,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/turns_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/turns_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/turns_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/turns_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -7,8 +7,8 @@ - - + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/vtypeprobe_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/vtypeprobe_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/data/xsd/vtypeprobe_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/data/xsd/vtypeprobe_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -12,9 +12,25 @@ + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/debian/bzr-builder.manifest sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/debian/bzr-builder.manifest --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/debian/bzr-builder.manifest 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/debian/bzr-builder.manifest 2017-07-23 16:22:07.000000000 +0000 @@ -1,3 +1,3 @@ -# bzr-builder format 0.3 deb-version {debupstream}+7+20 -lp:~sumo/+junk/sumo revid:gladky.anton@gmail.com-20161105204246-2exx34atzrunhivn -nest packaging lp:~sumo/+junk/sumo-debian debian revid:gladky.anton@gmail.com-20161106084427-01n8wkqkgj1emoa4 +# bzr-builder format 0.3 deb-version {debupstream}+8+21 +lp:~sumo/+junk/sumo revid:gladky.anton@gmail.com-20170723161939-p9p0cekka4dkua1n +nest packaging lp:~sumo/+junk/sumo-debian debian revid:gladky.anton@gmail.com-20170723161901-vnsmxr2s2vj1lx8r diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/debian/changelog sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/debian/changelog --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/debian/changelog 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/debian/changelog 2017-07-23 16:22:07.000000000 +0000 @@ -1,14 +1,14 @@ -sumo (0.28.0+dfsg1+7+20~ubuntu15.04.1) vivid; urgency=low +sumo (0.30.0+dfsg1+8+21~ubuntu15.04.1) vivid; urgency=low * Auto build. - -- Anton Gladky Sun, 06 Nov 2016 09:15:45 +0000 + -- Anton Gladky Sun, 23 Jul 2017 16:22:07 +0000 -sumo (0.28.0+dfsg1-1) unstable; urgency=medium +sumo (0.30.0+dfsg1-1) unstable; urgency=medium * New version - -- Anton Gladky Sat, 05 Nov 2016 22:29:12 +0100 + -- Anton Gladky Sun, 23 Jul 2017 18:18:21 +0200 sumo (0.25.0+dfsg1-2) unstable; urgency=medium diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/activitygenConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/activitygenConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/activitygenConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/activitygenConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -26,6 +26,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/additional_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/additional_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/additional_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/additional_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,7 @@ + @@ -46,6 +47,8 @@ + + @@ -233,6 +236,12 @@ + + + + + + @@ -263,6 +272,7 @@ + @@ -283,6 +293,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/baseTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/baseTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/baseTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/baseTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,7 @@ - + + ]> @@ -30,12 +30,28 @@ + + + + + + + + + + + + + + + + @@ -73,8 +89,9 @@ - + + @@ -183,7 +200,7 @@ - + @@ -191,6 +208,7 @@ + @@ -253,4 +271,25 @@ + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/calibratorstats_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/calibratorstats_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/calibratorstats_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/calibratorstats_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/det_e1meso_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/det_e1meso_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/det_e1meso_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/det_e1meso_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/det_e2_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/det_e2_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/det_e2_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/det_e2_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/det_e3_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/det_e3_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/det_e3_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/det_e3_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -16,6 +16,7 @@ + @@ -24,6 +25,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/detectors_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/detectors_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/detectors_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/detectors_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/dfrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/dfrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/dfrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/dfrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/duarouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/duarouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/duarouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/duarouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + @@ -68,6 +70,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/edgediff_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/edgediff_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/edgediff_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/edgediff_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -73,19 +73,9 @@ - - - - - - - - - - - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/edges_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/edges_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/edges_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/edges_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -69,27 +69,10 @@ + - - - - - - - - - - - - - - - - - - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/instant_e1_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/instant_e1_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/instant_e1_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/instant_e1_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/jtrrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/jtrrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/jtrrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/jtrrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/marouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/marouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/marouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/marouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/netconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/netconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/netconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/netconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -46,6 +46,8 @@ + + @@ -53,9 +55,12 @@ + + + @@ -144,6 +149,7 @@ + @@ -169,10 +175,16 @@ + + + + + + @@ -187,6 +199,9 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/net_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/net_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/net_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/net_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,6 +40,7 @@ + @@ -91,6 +92,7 @@ + @@ -107,25 +109,26 @@ - - - - - - + - - + + + + + + + + - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/netgenerateConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/netgenerateConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/netgenerateConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/netgenerateConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -67,6 +67,8 @@ + + @@ -74,9 +76,11 @@ + + @@ -125,6 +129,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/nodes_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/nodes_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/nodes_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/nodes_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -39,7 +39,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/od2tripsConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/od2tripsConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/od2tripsConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/od2tripsConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,8 +28,11 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/polyconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/polyconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/polyconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/polyconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,7 +40,10 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/routeTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/routeTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/routeTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/routeTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -27,7 +27,7 @@ - + @@ -98,11 +98,28 @@ + + + + + + + + + + + + + + + + + @@ -360,6 +377,7 @@ + @@ -463,6 +481,7 @@ + @@ -477,6 +496,8 @@ + + @@ -525,6 +546,7 @@ + @@ -544,6 +566,7 @@ + @@ -556,6 +579,7 @@ + @@ -588,6 +612,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/state_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/state_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/state_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/state_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/stopinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/stopinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/stopinfo_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/stopinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/sumoConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/sumoConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/sumoConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/sumoConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -17,6 +17,7 @@ + @@ -33,12 +34,15 @@ + + + @@ -46,6 +50,7 @@ + @@ -67,6 +72,7 @@ + @@ -93,8 +99,10 @@ + + @@ -106,6 +114,7 @@ + @@ -191,6 +200,19 @@ + + + + + + + + + + + + + @@ -211,6 +233,7 @@ + @@ -232,6 +255,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/tllogic_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/tllogic_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/tllogic_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/tllogic_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -25,7 +25,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/tlsstates_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/tlsstates_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/tlsstates_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/tlsstates_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/tlsswitches_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/tlsswitches_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/tlsswitches_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/tlsswitches_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/tripinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/tripinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/tripinfo_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/tripinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -38,6 +38,7 @@ + @@ -64,6 +65,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/turns_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/turns_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/turns_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/turns_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -7,8 +7,8 @@ - - + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/vtypeprobe_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/vtypeprobe_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/vtypeprobe_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_edge2edge_conns/data/xsd/vtypeprobe_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -12,9 +12,25 @@ + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/activitygenConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/activitygenConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/activitygenConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/activitygenConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -26,6 +26,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/additional_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/additional_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/additional_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/additional_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,7 @@ + @@ -46,6 +47,8 @@ + + @@ -233,6 +236,12 @@ + + + + + + @@ -263,6 +272,7 @@ + @@ -283,6 +293,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/baseTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/baseTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/baseTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/baseTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,7 @@ - + + ]> @@ -30,12 +30,28 @@ + + + + + + + + + + + + + + + + @@ -73,8 +89,9 @@ - + + @@ -183,7 +200,7 @@ - + @@ -191,6 +208,7 @@ + @@ -253,4 +271,25 @@ + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/calibratorstats_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/calibratorstats_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/calibratorstats_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/calibratorstats_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/det_e1meso_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/det_e1meso_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/det_e1meso_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/det_e1meso_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/det_e2_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/det_e2_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/det_e2_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/det_e2_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/det_e3_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/det_e3_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/det_e3_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/det_e3_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -16,6 +16,7 @@ + @@ -24,6 +25,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/detectors_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/detectors_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/detectors_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/detectors_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/dfrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/dfrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/dfrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/dfrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/duarouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/duarouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/duarouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/duarouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + @@ -68,6 +70,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/edgediff_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/edgediff_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/edgediff_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/edgediff_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -73,19 +73,9 @@ - - - - - - - - - - - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/edges_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/edges_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/edges_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/edges_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -69,27 +69,10 @@ + - - - - - - - - - - - - - - - - - - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/instant_e1_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/instant_e1_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/instant_e1_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/instant_e1_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/jtrrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/jtrrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/jtrrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/jtrrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/marouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/marouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/marouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/marouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/netconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/netconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/netconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/netconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -46,6 +46,8 @@ + + @@ -53,9 +55,12 @@ + + + @@ -144,6 +149,7 @@ + @@ -169,10 +175,16 @@ + + + + + + @@ -187,6 +199,9 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/net_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/net_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/net_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/net_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,6 +40,7 @@ + @@ -91,6 +92,7 @@ + @@ -107,25 +109,26 @@ - - - - - - + - - + + + + + + + + - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/netgenerateConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/netgenerateConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/netgenerateConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/netgenerateConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -67,6 +67,8 @@ + + @@ -74,9 +76,11 @@ + + @@ -125,6 +129,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/nodes_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/nodes_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/nodes_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/nodes_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -39,7 +39,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/od2tripsConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/od2tripsConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/od2tripsConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/od2tripsConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,8 +28,11 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/polyconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/polyconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/polyconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/polyconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,7 +40,10 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/routeTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/routeTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/routeTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/routeTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -27,7 +27,7 @@ - + @@ -98,11 +98,28 @@ + + + + + + + + + + + + + + + + + @@ -360,6 +377,7 @@ + @@ -463,6 +481,7 @@ + @@ -477,6 +496,8 @@ + + @@ -525,6 +546,7 @@ + @@ -544,6 +566,7 @@ + @@ -556,6 +579,7 @@ + @@ -588,6 +612,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/state_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/state_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/state_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/state_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/stopinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/stopinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/stopinfo_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/stopinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/sumoConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/sumoConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/sumoConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/sumoConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -17,6 +17,7 @@ + @@ -33,12 +34,15 @@ + + + @@ -46,6 +50,7 @@ + @@ -67,6 +72,7 @@ + @@ -93,8 +99,10 @@ + + @@ -106,6 +114,7 @@ + @@ -191,6 +200,19 @@ + + + + + + + + + + + + + @@ -211,6 +233,7 @@ + @@ -232,6 +255,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/tllogic_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/tllogic_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/tllogic_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/tllogic_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -25,7 +25,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/tlsstates_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/tlsstates_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/tlsstates_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/tlsstates_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/tlsswitches_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/tlsswitches_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/tlsswitches_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/tlsswitches_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/tripinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/tripinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/tripinfo_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/tripinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -38,6 +38,7 @@ + @@ -64,6 +65,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/turns_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/turns_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/turns_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/turns_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -7,8 +7,8 @@ - - + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/vtypeprobe_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/vtypeprobe_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/vtypeprobe_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_lane2lane_conns/data/xsd/vtypeprobe_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -12,9 +12,25 @@ + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/activitygenConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/activitygenConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/activitygenConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/activitygenConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -26,6 +26,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/additional_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/additional_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/additional_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/additional_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,7 @@ + @@ -46,6 +47,8 @@ + + @@ -233,6 +236,12 @@ + + + + + + @@ -263,6 +272,7 @@ + @@ -283,6 +293,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/baseTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/baseTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/baseTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/baseTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,7 @@ - + + ]> @@ -30,12 +30,28 @@ + + + + + + + + + + + + + + + + @@ -73,8 +89,9 @@ - + + @@ -183,7 +200,7 @@ - + @@ -191,6 +208,7 @@ + @@ -253,4 +271,25 @@ + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/calibratorstats_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/calibratorstats_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/calibratorstats_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/calibratorstats_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/det_e1meso_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/det_e1meso_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/det_e1meso_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/det_e1meso_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/det_e2_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/det_e2_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/det_e2_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/det_e2_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/det_e3_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/det_e3_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/det_e3_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/det_e3_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -16,6 +16,7 @@ + @@ -24,6 +25,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/detectors_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/detectors_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/detectors_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/detectors_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/dfrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/dfrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/dfrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/dfrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/duarouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/duarouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/duarouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/duarouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + @@ -68,6 +70,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/edgediff_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/edgediff_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/edgediff_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/edgediff_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -73,19 +73,9 @@ - - - - - - - - - - - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/edges_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/edges_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/edges_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/edges_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -69,27 +69,10 @@ + - - - - - - - - - - - - - - - - - - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/instant_e1_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/instant_e1_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/instant_e1_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/instant_e1_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/jtrrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/jtrrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/jtrrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/jtrrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/marouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/marouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/marouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/marouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/netconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/netconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/netconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/netconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -46,6 +46,8 @@ + + @@ -53,9 +55,12 @@ + + + @@ -144,6 +149,7 @@ + @@ -169,10 +175,16 @@ + + + + + + @@ -187,6 +199,9 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/net_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/net_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/net_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/net_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,6 +40,7 @@ + @@ -91,6 +92,7 @@ + @@ -107,25 +109,26 @@ - - - - - - + - - + + + + + + + + - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/netgenerateConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/netgenerateConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/netgenerateConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/netgenerateConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -67,6 +67,8 @@ + + @@ -74,9 +76,11 @@ + + @@ -125,6 +129,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/nodes_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/nodes_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/nodes_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/nodes_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -39,7 +39,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/od2tripsConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/od2tripsConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/od2tripsConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/od2tripsConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,8 +28,11 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/polyconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/polyconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/polyconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/polyconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,7 +40,10 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/routeTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/routeTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/routeTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/routeTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -27,7 +27,7 @@ - + @@ -98,11 +98,28 @@ + + + + + + + + + + + + + + + + + @@ -360,6 +377,7 @@ + @@ -463,6 +481,7 @@ + @@ -477,6 +496,8 @@ + + @@ -525,6 +546,7 @@ + @@ -544,6 +566,7 @@ + @@ -556,6 +579,7 @@ + @@ -588,6 +612,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/state_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/state_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/state_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/state_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/stopinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/stopinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/stopinfo_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/stopinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/sumoConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/sumoConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/sumoConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/sumoConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -17,6 +17,7 @@ + @@ -33,12 +34,15 @@ + + + @@ -46,6 +50,7 @@ + @@ -67,6 +72,7 @@ + @@ -93,8 +99,10 @@ + + @@ -106,6 +114,7 @@ + @@ -191,6 +200,19 @@ + + + + + + + + + + + + + @@ -211,6 +233,7 @@ + @@ -232,6 +255,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/tllogic_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/tllogic_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/tllogic_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/tllogic_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -25,7 +25,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/tlsstates_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/tlsstates_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/tlsstates_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/tlsstates_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/tlsswitches_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/tlsswitches_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/tlsswitches_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/tlsswitches_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/tripinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/tripinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/tripinfo_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/tripinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -38,6 +38,7 @@ + @@ -64,6 +65,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/turns_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/turns_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/turns_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/turns_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -7,8 +7,8 @@ - - + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/vtypeprobe_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/vtypeprobe_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/vtypeprobe_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_no_turnarounds/data/xsd/vtypeprobe_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -12,9 +12,25 @@ + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/activitygenConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/activitygenConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/activitygenConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/activitygenConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -26,6 +26,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/additional_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/additional_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/additional_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/additional_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,7 @@ + @@ -46,6 +47,8 @@ + + @@ -233,6 +236,12 @@ + + + + + + @@ -263,6 +272,7 @@ + @@ -283,6 +293,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/baseTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/baseTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/baseTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/baseTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,7 @@ - + + ]> @@ -30,12 +30,28 @@ + + + + + + + + + + + + + + + + @@ -73,8 +89,9 @@ - + + @@ -183,7 +200,7 @@ - + @@ -191,6 +208,7 @@ + @@ -253,4 +271,25 @@ + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/calibratorstats_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/calibratorstats_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/calibratorstats_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/calibratorstats_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/det_e1meso_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/det_e1meso_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/det_e1meso_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/det_e1meso_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/det_e2_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/det_e2_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/det_e2_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/det_e2_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/det_e3_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/det_e3_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/det_e3_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/det_e3_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -16,6 +16,7 @@ + @@ -24,6 +25,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/detectors_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/detectors_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/detectors_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/detectors_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/dfrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/dfrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/dfrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/dfrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/duarouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/duarouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/duarouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/duarouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + @@ -68,6 +70,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/edgediff_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/edgediff_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/edgediff_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/edgediff_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -73,19 +73,9 @@ - - - - - - - - - - - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/edges_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/edges_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/edges_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/edges_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -69,27 +69,10 @@ + - - - - - - - - - - - - - - - - - - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/instant_e1_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/instant_e1_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/instant_e1_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/instant_e1_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/jtrrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/jtrrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/jtrrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/jtrrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/marouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/marouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/marouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/marouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/netconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/netconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/netconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/netconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -46,6 +46,8 @@ + + @@ -53,9 +55,12 @@ + + + @@ -144,6 +149,7 @@ + @@ -169,10 +175,16 @@ + + + + + + @@ -187,6 +199,9 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/net_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/net_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/net_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/net_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,6 +40,7 @@ + @@ -91,6 +92,7 @@ + @@ -107,25 +109,26 @@ - - - - - - + - - + + + + + + + + - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/netgenerateConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/netgenerateConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/netgenerateConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/netgenerateConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -67,6 +67,8 @@ + + @@ -74,9 +76,11 @@ + + @@ -125,6 +129,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/nodes_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/nodes_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/nodes_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/nodes_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -39,7 +39,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/od2tripsConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/od2tripsConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/od2tripsConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/od2tripsConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,8 +28,11 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/polyconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/polyconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/polyconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/polyconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,7 +40,10 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/routeTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/routeTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/routeTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/routeTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -27,7 +27,7 @@ - + @@ -98,11 +98,28 @@ + + + + + + + + + + + + + + + + + @@ -360,6 +377,7 @@ + @@ -463,6 +481,7 @@ + @@ -477,6 +496,8 @@ + + @@ -525,6 +546,7 @@ + @@ -544,6 +566,7 @@ + @@ -556,6 +579,7 @@ + @@ -588,6 +612,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/state_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/state_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/state_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/state_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/stopinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/stopinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/stopinfo_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/stopinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/sumoConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/sumoConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/sumoConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/sumoConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -17,6 +17,7 @@ + @@ -33,12 +34,15 @@ + + + @@ -46,6 +50,7 @@ + @@ -67,6 +72,7 @@ + @@ -93,8 +99,10 @@ + + @@ -106,6 +114,7 @@ + @@ -191,6 +200,19 @@ + + + + + + + + + + + + + @@ -211,6 +233,7 @@ + @@ -232,6 +255,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/tllogic_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/tllogic_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/tllogic_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/tllogic_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -25,7 +25,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/tlsstates_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/tlsstates_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/tlsstates_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/tlsstates_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/tlsswitches_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/tlsswitches_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/tlsswitches_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/tlsswitches_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/tripinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/tripinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/tripinfo_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/tripinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -38,6 +38,7 @@ + @@ -64,6 +65,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/turns_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/turns_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/turns_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/turns_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -7,8 +7,8 @@ - - + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/vtypeprobe_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/vtypeprobe_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/vtypeprobe_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_prohibitions/data/xsd/vtypeprobe_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -12,9 +12,25 @@ + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/activitygenConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/activitygenConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/activitygenConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/activitygenConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -26,6 +26,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/additional_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/additional_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/additional_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/additional_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,7 @@ + @@ -46,6 +47,8 @@ + + @@ -233,6 +236,12 @@ + + + + + + @@ -263,6 +272,7 @@ + @@ -283,6 +293,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/baseTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/baseTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/baseTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/baseTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,7 @@ - + + ]> @@ -30,12 +30,28 @@ + + + + + + + + + + + + + + + + @@ -73,8 +89,9 @@ - + + @@ -183,7 +200,7 @@ - + @@ -191,6 +208,7 @@ + @@ -253,4 +271,25 @@ + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/calibratorstats_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/calibratorstats_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/calibratorstats_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/calibratorstats_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/det_e1meso_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/det_e1meso_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/det_e1meso_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/det_e1meso_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/det_e2_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/det_e2_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/det_e2_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/det_e2_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/det_e3_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/det_e3_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/det_e3_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/det_e3_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -16,6 +16,7 @@ + @@ -24,6 +25,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/detectors_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/detectors_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/detectors_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/detectors_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/dfrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/dfrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/dfrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/dfrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/duarouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/duarouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/duarouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/duarouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + @@ -68,6 +70,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/edgediff_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/edgediff_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/edgediff_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/edgediff_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -73,19 +73,9 @@ - - - - - - - - - - - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/edges_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/edges_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/edges_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/edges_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -69,27 +69,10 @@ + - - - - - - - - - - - - - - - - - - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/instant_e1_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/instant_e1_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/instant_e1_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/instant_e1_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/jtrrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/jtrrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/jtrrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/jtrrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/marouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/marouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/marouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/marouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/netconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/netconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/netconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/netconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -46,6 +46,8 @@ + + @@ -53,9 +55,12 @@ + + + @@ -144,6 +149,7 @@ + @@ -169,10 +175,16 @@ + + + + + + @@ -187,6 +199,9 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/net_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/net_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/net_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/net_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,6 +40,7 @@ + @@ -91,6 +92,7 @@ + @@ -107,25 +109,26 @@ - - - - - - + - - + + + + + + + + - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/netgenerateConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/netgenerateConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/netgenerateConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/netgenerateConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -67,6 +67,8 @@ + + @@ -74,9 +76,11 @@ + + @@ -125,6 +129,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/nodes_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/nodes_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/nodes_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/nodes_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -39,7 +39,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/od2tripsConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/od2tripsConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/od2tripsConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/od2tripsConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,8 +28,11 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/polyconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/polyconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/polyconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/polyconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,7 +40,10 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/routeTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/routeTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/routeTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/routeTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -27,7 +27,7 @@ - + @@ -98,11 +98,28 @@ + + + + + + + + + + + + + + + + + @@ -360,6 +377,7 @@ + @@ -463,6 +481,7 @@ + @@ -477,6 +496,8 @@ + + @@ -525,6 +546,7 @@ + @@ -544,6 +566,7 @@ + @@ -556,6 +579,7 @@ + @@ -588,6 +612,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/state_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/state_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/state_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/state_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/stopinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/stopinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/stopinfo_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/stopinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/sumoConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/sumoConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/sumoConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/sumoConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -17,6 +17,7 @@ + @@ -33,12 +34,15 @@ + + + @@ -46,6 +50,7 @@ + @@ -67,6 +72,7 @@ + @@ -93,8 +99,10 @@ + + @@ -106,6 +114,7 @@ + @@ -191,6 +200,19 @@ + + + + + + + + + + + + + @@ -211,6 +233,7 @@ + @@ -232,6 +255,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/tllogic_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/tllogic_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/tllogic_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/tllogic_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -25,7 +25,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/tlsstates_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/tlsstates_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/tlsstates_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/tlsstates_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/tlsswitches_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/tlsswitches_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/tlsswitches_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/tlsswitches_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/tripinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/tripinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/tripinfo_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/tripinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -38,6 +38,7 @@ + @@ -64,6 +65,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/turns_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/turns_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/turns_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/turns_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -7,8 +7,8 @@ - - + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/vtypeprobe_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/vtypeprobe_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/vtypeprobe_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/connections/cross3l_unconstrained/data/xsd/vtypeprobe_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -12,9 +12,25 @@ + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/activitygenConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/activitygenConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/activitygenConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/activitygenConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -26,6 +26,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/additional_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/additional_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/additional_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/additional_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,7 @@ + @@ -46,6 +47,8 @@ + + @@ -233,6 +236,12 @@ + + + + + + @@ -263,6 +272,7 @@ + @@ -283,6 +293,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/baseTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/baseTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/baseTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/baseTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,7 @@ - + + ]> @@ -30,12 +30,28 @@ + + + + + + + + + + + + + + + + @@ -73,8 +89,9 @@ - + + @@ -183,7 +200,7 @@ - + @@ -191,6 +208,7 @@ + @@ -253,4 +271,25 @@ + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/calibratorstats_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/calibratorstats_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/calibratorstats_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/calibratorstats_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/det_e1meso_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/det_e1meso_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/det_e1meso_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/det_e1meso_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/det_e2_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/det_e2_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/det_e2_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/det_e2_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/det_e3_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/det_e3_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/det_e3_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/det_e3_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -16,6 +16,7 @@ + @@ -24,6 +25,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/detectors_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/detectors_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/detectors_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/detectors_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/dfrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/dfrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/dfrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/dfrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/duarouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/duarouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/duarouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/duarouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + @@ -68,6 +70,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/edgediff_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/edgediff_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/edgediff_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/edgediff_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -73,19 +73,9 @@ - - - - - - - - - - - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/edges_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/edges_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/edges_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/edges_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -69,27 +69,10 @@ + - - - - - - - - - - - - - - - - - - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/instant_e1_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/instant_e1_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/instant_e1_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/instant_e1_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/jtrrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/jtrrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/jtrrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/jtrrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/marouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/marouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/marouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/marouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/netconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/netconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/netconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/netconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -46,6 +46,8 @@ + + @@ -53,9 +55,12 @@ + + + @@ -144,6 +149,7 @@ + @@ -169,10 +175,16 @@ + + + + + + @@ -187,6 +199,9 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/net_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/net_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/net_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/net_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,6 +40,7 @@ + @@ -91,6 +92,7 @@ + @@ -107,25 +109,26 @@ - - - - - - + - - + + + + + + + + - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/netgenerateConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/netgenerateConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/netgenerateConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/netgenerateConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -67,6 +67,8 @@ + + @@ -74,9 +76,11 @@ + + @@ -125,6 +129,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/nodes_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/nodes_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/nodes_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/nodes_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -39,7 +39,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/od2tripsConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/od2tripsConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/od2tripsConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/od2tripsConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,8 +28,11 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/polyconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/polyconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/polyconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/polyconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,7 +40,10 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/routeTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/routeTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/routeTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/routeTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -27,7 +27,7 @@ - + @@ -98,11 +98,28 @@ + + + + + + + + + + + + + + + + + @@ -360,6 +377,7 @@ + @@ -463,6 +481,7 @@ + @@ -477,6 +496,8 @@ + + @@ -525,6 +546,7 @@ + @@ -544,6 +566,7 @@ + @@ -556,6 +579,7 @@ + @@ -588,6 +612,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/state_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/state_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/state_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/state_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/stopinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/stopinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/stopinfo_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/stopinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/sumoConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/sumoConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/sumoConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/sumoConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -17,6 +17,7 @@ + @@ -33,12 +34,15 @@ + + + @@ -46,6 +50,7 @@ + @@ -67,6 +72,7 @@ + @@ -93,8 +99,10 @@ + + @@ -106,6 +114,7 @@ + @@ -191,6 +200,19 @@ + + + + + + + + + + + + + @@ -211,6 +233,7 @@ + @@ -232,6 +255,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/tllogic_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/tllogic_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/tllogic_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/tllogic_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -25,7 +25,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/tlsstates_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/tlsstates_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/tlsstates_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/tlsstates_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/tlsswitches_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/tlsswitches_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/tlsswitches_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/tlsswitches_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/tripinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/tripinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/tripinfo_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/tripinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -38,6 +38,7 @@ + @@ -64,6 +65,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/turns_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/turns_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/turns_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/turns_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -7,8 +7,8 @@ - - + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/vtypeprobe_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/vtypeprobe_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/vtypeprobe_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/data/xsd/vtypeprobe_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -12,9 +12,25 @@ + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/input_connections.con.xml sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/input_connections.con.xml --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/input_connections.con.xml 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/dlr-testtrack/input_connections.con.xml 2017-07-23 16:22:03.000000000 +0000 @@ -3,20 +3,12 @@ - - - - - - - - @@ -24,7 +16,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/activitygenConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/activitygenConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/activitygenConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/activitygenConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -26,6 +26,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/additional_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/additional_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/additional_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/additional_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,7 @@ + @@ -46,6 +47,8 @@ + + @@ -233,6 +236,12 @@ + + + + + + @@ -263,6 +272,7 @@ + @@ -283,6 +293,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/baseTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/baseTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/baseTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/baseTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,7 @@ - + + ]> @@ -30,12 +30,28 @@ + + + + + + + + + + + + + + + + @@ -73,8 +89,9 @@ - + + @@ -183,7 +200,7 @@ - + @@ -191,6 +208,7 @@ + @@ -253,4 +271,25 @@ + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/calibratorstats_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/calibratorstats_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/calibratorstats_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/calibratorstats_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/det_e1meso_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/det_e1meso_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/det_e1meso_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/det_e1meso_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/det_e2_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/det_e2_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/det_e2_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/det_e2_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/det_e3_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/det_e3_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/det_e3_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/det_e3_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -16,6 +16,7 @@ + @@ -24,6 +25,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/detectors_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/detectors_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/detectors_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/detectors_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/dfrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/dfrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/dfrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/dfrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/duarouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/duarouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/duarouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/duarouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + @@ -68,6 +70,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/edgediff_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/edgediff_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/edgediff_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/edgediff_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -73,19 +73,9 @@ - - - - - - - - - - - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/edges_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/edges_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/edges_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/edges_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -69,27 +69,10 @@ + - - - - - - - - - - - - - - - - - - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/instant_e1_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/instant_e1_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/instant_e1_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/instant_e1_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/jtrrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/jtrrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/jtrrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/jtrrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/marouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/marouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/marouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/marouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/netconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/netconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/netconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/netconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -46,6 +46,8 @@ + + @@ -53,9 +55,12 @@ + + + @@ -144,6 +149,7 @@ + @@ -169,10 +175,16 @@ + + + + + + @@ -187,6 +199,9 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/net_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/net_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/net_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/net_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,6 +40,7 @@ + @@ -91,6 +92,7 @@ + @@ -107,25 +109,26 @@ - - - - - - + - - + + + + + + + + - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/netgenerateConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/netgenerateConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/netgenerateConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/netgenerateConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -67,6 +67,8 @@ + + @@ -74,9 +76,11 @@ + + @@ -125,6 +129,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/nodes_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/nodes_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/nodes_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/nodes_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -39,7 +39,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/od2tripsConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/od2tripsConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/od2tripsConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/od2tripsConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,8 +28,11 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/polyconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/polyconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/polyconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/polyconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,7 +40,10 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/routeTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/routeTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/routeTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/routeTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -27,7 +27,7 @@ - + @@ -98,11 +98,28 @@ + + + + + + + + + + + + + + + + + @@ -360,6 +377,7 @@ + @@ -463,6 +481,7 @@ + @@ -477,6 +496,8 @@ + + @@ -525,6 +546,7 @@ + @@ -544,6 +566,7 @@ + @@ -556,6 +579,7 @@ + @@ -588,6 +612,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/state_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/state_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/state_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/state_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/stopinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/stopinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/stopinfo_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/stopinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/sumoConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/sumoConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/sumoConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/sumoConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -17,6 +17,7 @@ + @@ -33,12 +34,15 @@ + + + @@ -46,6 +50,7 @@ + @@ -67,6 +72,7 @@ + @@ -93,8 +99,10 @@ + + @@ -106,6 +114,7 @@ + @@ -191,6 +200,19 @@ + + + + + + + + + + + + + @@ -211,6 +233,7 @@ + @@ -232,6 +255,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/tllogic_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/tllogic_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/tllogic_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/tllogic_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -25,7 +25,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/tlsstates_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/tlsstates_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/tlsstates_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/tlsstates_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/tlsswitches_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/tlsswitches_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/tlsswitches_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/tlsswitches_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/tripinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/tripinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/tripinfo_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/tripinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -38,6 +38,7 @@ + @@ -64,6 +65,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/turns_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/turns_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/turns_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/turns_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -7,8 +7,8 @@ - - + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/vtypeprobe_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/vtypeprobe_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/vtypeprobe_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/hokkaido/data/xsd/vtypeprobe_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -12,9 +12,25 @@ + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/activitygenConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/activitygenConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/activitygenConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/activitygenConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -26,6 +26,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/additional_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/additional_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/additional_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/additional_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,7 @@ + @@ -46,6 +47,8 @@ + + @@ -233,6 +236,12 @@ + + + + + + @@ -263,6 +272,7 @@ + @@ -283,6 +293,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/baseTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/baseTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/baseTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/baseTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,7 @@ - + + ]> @@ -30,12 +30,28 @@ + + + + + + + + + + + + + + + + @@ -73,8 +89,9 @@ - + + @@ -183,7 +200,7 @@ - + @@ -191,6 +208,7 @@ + @@ -253,4 +271,25 @@ + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/calibratorstats_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/calibratorstats_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/calibratorstats_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/calibratorstats_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/det_e1meso_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/det_e1meso_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/det_e1meso_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/det_e1meso_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/det_e2_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/det_e2_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/det_e2_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/det_e2_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/det_e3_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/det_e3_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/det_e3_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/det_e3_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -16,6 +16,7 @@ + @@ -24,6 +25,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/detectors_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/detectors_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/detectors_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/detectors_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/dfrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/dfrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/dfrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/dfrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/duarouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/duarouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/duarouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/duarouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + @@ -68,6 +70,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/edgediff_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/edgediff_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/edgediff_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/edgediff_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -73,19 +73,9 @@ - - - - - - - - - - - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/edges_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/edges_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/edges_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/edges_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -69,27 +69,10 @@ + - - - - - - - - - - - - - - - - - - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/instant_e1_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/instant_e1_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/instant_e1_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/instant_e1_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/jtrrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/jtrrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/jtrrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/jtrrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/marouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/marouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/marouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/marouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/netconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/netconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/netconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/netconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -46,6 +46,8 @@ + + @@ -53,9 +55,12 @@ + + + @@ -144,6 +149,7 @@ + @@ -169,10 +175,16 @@ + + + + + + @@ -187,6 +199,9 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/net_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/net_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/net_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/net_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,6 +40,7 @@ + @@ -91,6 +92,7 @@ + @@ -107,25 +109,26 @@ - - - - - - + - - + + + + + + + + - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/netgenerateConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/netgenerateConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/netgenerateConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/netgenerateConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -67,6 +67,8 @@ + + @@ -74,9 +76,11 @@ + + @@ -125,6 +129,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/nodes_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/nodes_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/nodes_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/nodes_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -39,7 +39,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/od2tripsConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/od2tripsConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/od2tripsConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/od2tripsConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,8 +28,11 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/polyconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/polyconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/polyconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/polyconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,7 +40,10 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/routeTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/routeTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/routeTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/routeTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -27,7 +27,7 @@ - + @@ -98,11 +98,28 @@ + + + + + + + + + + + + + + + + + @@ -360,6 +377,7 @@ + @@ -463,6 +481,7 @@ + @@ -477,6 +496,8 @@ + + @@ -525,6 +546,7 @@ + @@ -544,6 +566,7 @@ + @@ -556,6 +579,7 @@ + @@ -588,6 +612,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/state_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/state_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/state_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/state_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/stopinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/stopinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/stopinfo_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/stopinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/sumoConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/sumoConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/sumoConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/sumoConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -17,6 +17,7 @@ + @@ -33,12 +34,15 @@ + + + @@ -46,6 +50,7 @@ + @@ -67,6 +72,7 @@ + @@ -93,8 +99,10 @@ + + @@ -106,6 +114,7 @@ + @@ -191,6 +200,19 @@ + + + + + + + + + + + + + @@ -211,6 +233,7 @@ + @@ -232,6 +255,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/tllogic_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/tllogic_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/tllogic_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/tllogic_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -25,7 +25,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/tlsstates_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/tlsstates_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/tlsstates_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/tlsstates_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/tlsswitches_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/tlsswitches_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/tlsswitches_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/tlsswitches_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/tripinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/tripinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/tripinfo_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/tripinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -38,6 +38,7 @@ + @@ -64,6 +65,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/turns_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/turns_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/turns_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/turns_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -7,8 +7,8 @@ - - + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/vtypeprobe_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/vtypeprobe_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/vtypeprobe_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/OSM/adlershof_dlr/data/xsd/vtypeprobe_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -12,9 +12,25 @@ + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/activitygenConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/activitygenConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/activitygenConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/activitygenConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -26,6 +26,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/additional_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/additional_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/additional_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/additional_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,7 @@ + @@ -46,6 +47,8 @@ + + @@ -233,6 +236,12 @@ + + + + + + @@ -263,6 +272,7 @@ + @@ -283,6 +293,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/baseTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/baseTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/baseTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/baseTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,7 @@ - + + ]> @@ -30,12 +30,28 @@ + + + + + + + + + + + + + + + + @@ -73,8 +89,9 @@ - + + @@ -183,7 +200,7 @@ - + @@ -191,6 +208,7 @@ + @@ -253,4 +271,25 @@ + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/calibratorstats_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/calibratorstats_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/calibratorstats_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/calibratorstats_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/det_e1meso_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/det_e1meso_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/det_e1meso_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/det_e1meso_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/det_e2_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/det_e2_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/det_e2_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/det_e2_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/det_e3_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/det_e3_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/det_e3_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/det_e3_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -16,6 +16,7 @@ + @@ -24,6 +25,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/detectors_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/detectors_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/detectors_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/detectors_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/dfrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/dfrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/dfrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/dfrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/duarouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/duarouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/duarouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/duarouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + @@ -68,6 +70,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/edgediff_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/edgediff_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/edgediff_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/edgediff_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -73,19 +73,9 @@ - - - - - - - - - - - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/edges_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/edges_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/edges_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/edges_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -69,27 +69,10 @@ + - - - - - - - - - - - - - - - - - - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/instant_e1_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/instant_e1_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/instant_e1_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/instant_e1_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/jtrrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/jtrrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/jtrrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/jtrrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/marouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/marouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/marouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/marouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/netconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/netconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/netconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/netconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -46,6 +46,8 @@ + + @@ -53,9 +55,12 @@ + + + @@ -144,6 +149,7 @@ + @@ -169,10 +175,16 @@ + + + + + + @@ -187,6 +199,9 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/net_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/net_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/net_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/net_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,6 +40,7 @@ + @@ -91,6 +92,7 @@ + @@ -107,25 +109,26 @@ - - - - - - + - - + + + + + + + + - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/netgenerateConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/netgenerateConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/netgenerateConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/netgenerateConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -67,6 +67,8 @@ + + @@ -74,9 +76,11 @@ + + @@ -125,6 +129,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/nodes_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/nodes_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/nodes_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/nodes_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -39,7 +39,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/od2tripsConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/od2tripsConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/od2tripsConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/od2tripsConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,8 +28,11 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/polyconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/polyconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/polyconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/polyconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,7 +40,10 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/routeTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/routeTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/routeTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/routeTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -27,7 +27,7 @@ - + @@ -98,11 +98,28 @@ + + + + + + + + + + + + + + + + + @@ -360,6 +377,7 @@ + @@ -463,6 +481,7 @@ + @@ -477,6 +496,8 @@ + + @@ -525,6 +546,7 @@ + @@ -544,6 +566,7 @@ + @@ -556,6 +579,7 @@ + @@ -588,6 +612,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/state_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/state_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/state_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/state_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/stopinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/stopinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/stopinfo_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/stopinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/sumoConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/sumoConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/sumoConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/sumoConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -17,6 +17,7 @@ + @@ -33,12 +34,15 @@ + + + @@ -46,6 +50,7 @@ + @@ -67,6 +72,7 @@ + @@ -93,8 +99,10 @@ + + @@ -106,6 +114,7 @@ + @@ -191,6 +200,19 @@ + + + + + + + + + + + + + @@ -211,6 +233,7 @@ + @@ -232,6 +255,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/tllogic_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/tllogic_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/tllogic_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/tllogic_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -25,7 +25,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/tlsstates_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/tlsstates_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/tlsstates_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/tlsstates_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/tlsswitches_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/tlsswitches_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/tlsswitches_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/tlsswitches_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/tripinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/tripinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/tripinfo_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/tripinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -38,6 +38,7 @@ + @@ -64,6 +65,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/turns_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/turns_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/turns_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/turns_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -7,8 +7,8 @@ - - + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/vtypeprobe_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/vtypeprobe_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/vtypeprobe_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_notypes_kmh/data/xsd/vtypeprobe_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -12,9 +12,25 @@ + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/activitygenConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/activitygenConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/activitygenConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/activitygenConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -26,6 +26,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/additional_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/additional_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/additional_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/additional_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,7 @@ + @@ -46,6 +47,8 @@ + + @@ -233,6 +236,12 @@ + + + + + + @@ -263,6 +272,7 @@ + @@ -283,6 +293,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/baseTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/baseTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/baseTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/baseTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,7 @@ - + + ]> @@ -30,12 +30,28 @@ + + + + + + + + + + + + + + + + @@ -73,8 +89,9 @@ - + + @@ -183,7 +200,7 @@ - + @@ -191,6 +208,7 @@ + @@ -253,4 +271,25 @@ + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/calibratorstats_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/calibratorstats_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/calibratorstats_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/calibratorstats_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/det_e1meso_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/det_e1meso_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/det_e1meso_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/det_e1meso_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/det_e2_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/det_e2_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/det_e2_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/det_e2_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/det_e3_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/det_e3_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/det_e3_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/det_e3_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -16,6 +16,7 @@ + @@ -24,6 +25,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/detectors_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/detectors_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/detectors_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/detectors_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/dfrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/dfrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/dfrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/dfrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/duarouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/duarouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/duarouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/duarouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + @@ -68,6 +70,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/edgediff_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/edgediff_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/edgediff_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/edgediff_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -73,19 +73,9 @@ - - - - - - - - - - - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/edges_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/edges_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/edges_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/edges_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -69,27 +69,10 @@ + - - - - - - - - - - - - - - - - - - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/instant_e1_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/instant_e1_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/instant_e1_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/instant_e1_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/jtrrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/jtrrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/jtrrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/jtrrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/marouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/marouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/marouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/marouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/netconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/netconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/netconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/netconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -46,6 +46,8 @@ + + @@ -53,9 +55,12 @@ + + + @@ -144,6 +149,7 @@ + @@ -169,10 +175,16 @@ + + + + + + @@ -187,6 +199,9 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/net_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/net_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/net_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/net_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,6 +40,7 @@ + @@ -91,6 +92,7 @@ + @@ -107,25 +109,26 @@ - - - - - - + - - + + + + + + + + - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/netgenerateConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/netgenerateConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/netgenerateConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/netgenerateConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -67,6 +67,8 @@ + + @@ -74,9 +76,11 @@ + + @@ -125,6 +129,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/nodes_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/nodes_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/nodes_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/nodes_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -39,7 +39,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/od2tripsConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/od2tripsConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/od2tripsConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/od2tripsConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,8 +28,11 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/polyconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/polyconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/polyconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/polyconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,7 +40,10 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/routeTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/routeTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/routeTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/routeTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -27,7 +27,7 @@ - + @@ -98,11 +98,28 @@ + + + + + + + + + + + + + + + + + @@ -360,6 +377,7 @@ + @@ -463,6 +481,7 @@ + @@ -477,6 +496,8 @@ + + @@ -525,6 +546,7 @@ + @@ -544,6 +566,7 @@ + @@ -556,6 +579,7 @@ + @@ -588,6 +612,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/state_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/state_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/state_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/state_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/stopinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/stopinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/stopinfo_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/stopinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/sumoConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/sumoConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/sumoConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/sumoConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -17,6 +17,7 @@ + @@ -33,12 +34,15 @@ + + + @@ -46,6 +50,7 @@ + @@ -67,6 +72,7 @@ + @@ -93,8 +99,10 @@ + + @@ -106,6 +114,7 @@ + @@ -191,6 +200,19 @@ + + + + + + + + + + + + + @@ -211,6 +233,7 @@ + @@ -232,6 +255,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/tllogic_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/tllogic_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/tllogic_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/tllogic_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -25,7 +25,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/tlsstates_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/tlsstates_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/tlsstates_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/tlsstates_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/tlsswitches_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/tlsswitches_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/tlsswitches_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/tlsswitches_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/tripinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/tripinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/tripinfo_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/tripinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -38,6 +38,7 @@ + @@ -64,6 +65,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/turns_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/turns_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/turns_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/turns_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -7,8 +7,8 @@ - - + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/vtypeprobe_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/vtypeprobe_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/vtypeprobe_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/speed_in_kmh/cross_usingtypes_kmh/data/xsd/vtypeprobe_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -12,9 +12,25 @@ + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/activitygenConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/activitygenConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/activitygenConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/activitygenConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -26,6 +26,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/additional_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/additional_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/additional_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/additional_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,7 @@ + @@ -46,6 +47,8 @@ + + @@ -233,6 +236,12 @@ + + + + + + @@ -263,6 +272,7 @@ + @@ -283,6 +293,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/baseTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/baseTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/baseTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/baseTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,7 @@ - + + ]> @@ -30,12 +30,28 @@ + + + + + + + + + + + + + + + + @@ -73,8 +89,9 @@ - + + @@ -183,7 +200,7 @@ - + @@ -191,6 +208,7 @@ + @@ -253,4 +271,25 @@ + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/calibratorstats_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/calibratorstats_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/calibratorstats_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/calibratorstats_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/det_e1meso_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/det_e1meso_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/det_e1meso_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/det_e1meso_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/det_e2_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/det_e2_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/det_e2_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/det_e2_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/det_e3_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/det_e3_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/det_e3_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/det_e3_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -16,6 +16,7 @@ + @@ -24,6 +25,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/detectors_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/detectors_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/detectors_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/detectors_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/dfrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/dfrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/dfrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/dfrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/duarouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/duarouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/duarouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/duarouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + @@ -68,6 +70,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/edgediff_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/edgediff_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/edgediff_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/edgediff_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -73,19 +73,9 @@ - - - - - - - - - - - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/edges_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/edges_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/edges_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/edges_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -69,27 +69,10 @@ + - - - - - - - - - - - - - - - - - - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/instant_e1_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/instant_e1_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/instant_e1_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/instant_e1_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/jtrrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/jtrrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/jtrrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/jtrrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/marouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/marouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/marouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/marouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/netconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/netconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/netconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/netconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -46,6 +46,8 @@ + + @@ -53,9 +55,12 @@ + + + @@ -144,6 +149,7 @@ + @@ -169,10 +175,16 @@ + + + + + + @@ -187,6 +199,9 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/net_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/net_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/net_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/net_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,6 +40,7 @@ + @@ -91,6 +92,7 @@ + @@ -107,25 +109,26 @@ - - - - - - + - - + + + + + + + + - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/netgenerateConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/netgenerateConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/netgenerateConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/netgenerateConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -67,6 +67,8 @@ + + @@ -74,9 +76,11 @@ + + @@ -125,6 +129,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/nodes_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/nodes_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/nodes_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/nodes_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -39,7 +39,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/od2tripsConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/od2tripsConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/od2tripsConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/od2tripsConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,8 +28,11 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/polyconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/polyconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/polyconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/polyconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,7 +40,10 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/routeTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/routeTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/routeTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/routeTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -27,7 +27,7 @@ - + @@ -98,11 +98,28 @@ + + + + + + + + + + + + + + + + + @@ -360,6 +377,7 @@ + @@ -463,6 +481,7 @@ + @@ -477,6 +496,8 @@ + + @@ -525,6 +546,7 @@ + @@ -544,6 +566,7 @@ + @@ -556,6 +579,7 @@ + @@ -588,6 +612,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/state_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/state_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/state_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/state_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/stopinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/stopinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/stopinfo_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/stopinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/sumoConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/sumoConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/sumoConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/sumoConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -17,6 +17,7 @@ + @@ -33,12 +34,15 @@ + + + @@ -46,6 +50,7 @@ + @@ -67,6 +72,7 @@ + @@ -93,8 +99,10 @@ + + @@ -106,6 +114,7 @@ + @@ -191,6 +200,19 @@ + + + + + + + + + + + + + @@ -211,6 +233,7 @@ + @@ -232,6 +255,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/tllogic_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/tllogic_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/tllogic_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/tllogic_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -25,7 +25,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/tlsstates_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/tlsstates_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/tlsstates_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/tlsstates_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/tlsswitches_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/tlsswitches_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/tlsswitches_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/tlsswitches_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/tripinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/tripinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/tripinfo_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/tripinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -38,6 +38,7 @@ + @@ -64,6 +65,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/turns_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/turns_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/turns_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/turns_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -7,8 +7,8 @@ - - + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/vtypeprobe_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/vtypeprobe_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/vtypeprobe_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_notypes/data/xsd/vtypeprobe_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -12,9 +12,25 @@ + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/activitygenConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/activitygenConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/activitygenConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/activitygenConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -26,6 +26,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/additional_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/additional_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/additional_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/additional_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,7 @@ + @@ -46,6 +47,8 @@ + + @@ -233,6 +236,12 @@ + + + + + + @@ -263,6 +272,7 @@ + @@ -283,6 +293,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/baseTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/baseTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/baseTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/baseTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,7 @@ - + + ]> @@ -30,12 +30,28 @@ + + + + + + + + + + + + + + + + @@ -73,8 +89,9 @@ - + + @@ -183,7 +200,7 @@ - + @@ -191,6 +208,7 @@ + @@ -253,4 +271,25 @@ + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/calibratorstats_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/calibratorstats_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/calibratorstats_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/calibratorstats_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/det_e1meso_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/det_e1meso_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/det_e1meso_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/det_e1meso_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/det_e2_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/det_e2_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/det_e2_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/det_e2_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/det_e3_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/det_e3_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/det_e3_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/det_e3_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -16,6 +16,7 @@ + @@ -24,6 +25,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/detectors_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/detectors_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/detectors_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/detectors_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/dfrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/dfrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/dfrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/dfrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,6 +28,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/duarouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/duarouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/duarouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/duarouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + @@ -68,6 +70,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/edgediff_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/edgediff_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/edgediff_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/edgediff_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -73,19 +73,9 @@ - - - - - - - - - - - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/edges_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/edges_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/edges_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/edges_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -69,27 +69,10 @@ + - - - - - - - - - - - - - - - - - - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/instant_e1_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/instant_e1_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/instant_e1_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/instant_e1_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/jtrrouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/jtrrouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/jtrrouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/jtrrouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -30,6 +30,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/marouterConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/marouterConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/marouterConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/marouterConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -35,6 +35,8 @@ + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/netconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/netconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/netconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/netconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -46,6 +46,8 @@ + + @@ -53,9 +55,12 @@ + + + @@ -144,6 +149,7 @@ + @@ -169,10 +175,16 @@ + + + + + + @@ -187,6 +199,9 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/net_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/net_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/net_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/net_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,6 +40,7 @@ + @@ -91,6 +92,7 @@ + @@ -107,25 +109,26 @@ - - - - - - + - - + + + + + + + + - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/netgenerateConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/netgenerateConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/netgenerateConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/netgenerateConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -67,6 +67,8 @@ + + @@ -74,9 +76,11 @@ + + @@ -125,6 +129,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/nodes_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/nodes_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/nodes_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/nodes_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -39,7 +39,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/od2tripsConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/od2tripsConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/od2tripsConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/od2tripsConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -28,8 +28,11 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/polyconvertConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/polyconvertConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/polyconvertConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/polyconvertConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -40,7 +40,10 @@ + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/routeTypes.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/routeTypes.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/routeTypes.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/routeTypes.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -27,7 +27,7 @@ - + @@ -98,11 +98,28 @@ + + + + + + + + + + + + + + + + + @@ -360,6 +377,7 @@ + @@ -463,6 +481,7 @@ + @@ -477,6 +496,8 @@ + + @@ -525,6 +546,7 @@ + @@ -544,6 +566,7 @@ + @@ -556,6 +579,7 @@ + @@ -588,6 +612,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/state_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/state_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/state_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/state_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/stopinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/stopinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/stopinfo_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/stopinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/sumoConfiguration.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/sumoConfiguration.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/sumoConfiguration.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/sumoConfiguration.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -17,6 +17,7 @@ + @@ -33,12 +34,15 @@ + + + @@ -46,6 +50,7 @@ + @@ -67,6 +72,7 @@ + @@ -93,8 +99,10 @@ + + @@ -106,6 +114,7 @@ + @@ -191,6 +200,19 @@ + + + + + + + + + + + + + @@ -211,6 +233,7 @@ + @@ -232,6 +255,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/tllogic_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/tllogic_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/tllogic_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/tllogic_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -25,7 +25,7 @@ - + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/tlsstates_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/tlsstates_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/tlsstates_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/tlsstates_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/tlsswitches_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/tlsswitches_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/tlsswitches_file.xsd 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/tlsswitches_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/tripinfo_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/tripinfo_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/tripinfo_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/tripinfo_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -38,6 +38,7 @@ + @@ -64,6 +65,7 @@ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/turns_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/turns_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/turns_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/turns_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -7,8 +7,8 @@ - - + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/vtypeprobe_file.xsd sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/vtypeprobe_file.xsd --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/vtypeprobe_file.xsd 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/examples/netconvert/types/cross_usingtypes/data/xsd/vtypeprobe_file.xsd 2017-07-23 16:22:03.000000000 +0000 @@ -12,9 +12,25 @@ + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/circles/data/circles.add.xml sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/circles/data/circles.add.xml --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/circles/data/circles.add.xml 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/circles/data/circles.add.xml 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/circles/data/circles.net.xml sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/circles/data/circles.net.xml --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/circles/data/circles.net.xml 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/circles/data/circles.net.xml 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/circles/data/circles.rou.xml sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/circles/data/circles.rou.xml --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/circles/data/circles.rou.xml 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/circles/data/circles.rou.xml 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/circles/data/circles.sumocfg sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/circles/data/circles.sumocfg --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/circles/data/circles.sumocfg 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/circles/data/circles.sumocfg 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/circles/runner.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/circles/runner.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/circles/runner.py 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/circles/runner.py 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,42 @@ +#!/usr/bin/env python +""" +@file runner.py +@author Daniel Krajzewicz +@author Michael Behrisch +@date 2007-10-25 +@version $Id: runner.py 22608 2017-01-17 06:28:54Z behrisch $ + +This script is a test runner for the "Driving in Circles" Tutorial. + +SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors + +This file is part of SUMO. +SUMO is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. +""" +from __future__ import absolute_import +from __future__ import print_function + + +import os +import subprocess +import sys +import shutil +try: + sys.path.append(os.path.join(os.path.dirname( + __file__), '..', '..', '..', '..', "tools")) # tutorial in tests + sys.path.append(os.path.join(os.environ.get("SUMO_HOME", os.path.join( + os.path.dirname(__file__), "..", "..", "..")), "tools")) # tutorial in docs + from sumolib import checkBinary +except ImportError: + sys.exit( + "please declare environment variable 'SUMO_HOME' as the root directory of your sumo installation (it should contain folders 'bin', 'tools' and 'docs')") +sumoBinary = checkBinary('sumo') +# run simulation +retcode = subprocess.call( + [sumoBinary, "-c", "data/circles.sumocfg", "--no-step-log"], stdout=sys.stdout, stderr=sys.stderr) +print(">> Simulation closed with status %s" % retcode) +sys.stdout.flush() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/city_mobil/agentManager.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/city_mobil/agentManager.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/city_mobil/agentManager.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/city_mobil/agentManager.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Michael Behrisch @author Daniel Krajzewicz @date 2008-10-09 -@version $Id: agentManager.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: agentManager.py 22608 2017-01-17 06:28:54Z behrisch $ Control the CityMobil parking lot with a multi agent system. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/city_mobil/constants.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/city_mobil/constants.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/city_mobil/constants.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/city_mobil/constants.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Michael Behrisch @author Daniel Krajzewicz @date 2008-07-21 -@version $Id: constants.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: constants.py 22608 2017-01-17 06:28:54Z behrisch $ Defining constants for the CityMobil parking lot. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/city_mobil/createNet.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/city_mobil/createNet.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/city_mobil/createNet.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/city_mobil/createNet.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,13 +5,13 @@ @author Michael Behrisch @author Daniel Krajzewicz @date 2008-07-04 -@version $Id: createNet.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: createNet.py 22608 2017-01-17 06:28:54Z behrisch $ Create the XML input files for the generation of the SUMO network of the CityMobil parking lot. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -36,7 +36,7 @@ print(""" - """ % (CYBER_LENGTH, CYBER_SPEED), file=routes) + """ % (CYBER_LENGTH, CYBER_SPEED), file=routes) # streets nodeID = "main-0" print('', file=nodes) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/city_mobil/runner.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/city_mobil/runner.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/city_mobil/runner.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/city_mobil/runner.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Michael Behrisch @author Daniel Krajzewicz @date 2011-10-28 -@version $Id: runner.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: runner.py 22608 2017-01-17 06:28:54Z behrisch $ This script is a test runner for the CityMobil scenario. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/city_mobil/simpleManager.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/city_mobil/simpleManager.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/city_mobil/simpleManager.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/city_mobil/simpleManager.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ @author Michael Behrisch @author Daniel Krajzewicz @date 2008-10-09 -@version $Id: simpleManager.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: simpleManager.py 22608 2017-01-17 06:28:54Z behrisch $ Control the CityMobil parking lot with a simple first come first serve approach. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/city_mobil/statistics.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/city_mobil/statistics.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/city_mobil/statistics.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/city_mobil/statistics.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Michael Behrisch @author Daniel Krajzewicz @date 2008-10-17 -@version $Id: statistics.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: statistics.py 22608 2017-01-17 06:28:54Z behrisch $ Collecting statistics for the CityMobil parking lot SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/city_mobil/vehicleControl.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/city_mobil/vehicleControl.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/city_mobil/vehicleControl.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/city_mobil/vehicleControl.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ @author Daniel Krajzewicz @author Lena Kalleske @date 2008-07-21 -@version $Id: vehicleControl.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: vehicleControl.py 22608 2017-01-17 06:28:54Z behrisch $ Control the CityMobil parking lot via TraCI. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/hello/runner.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/hello/runner.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/hello/runner.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/hello/runner.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2007-10-25 -@version $Id: runner.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: runner.py 22608 2017-01-17 06:28:54Z behrisch $ This script is a test runner for the "Hello SUMO" Tutorial. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/output_parsing/runner.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/output_parsing/runner.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/output_parsing/runner.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/output_parsing/runner.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file runner.py @author Michael Behrisch @date 2012-12-09 -@version $Id: runner.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: runner.py 22608 2017-01-17 06:28:54Z behrisch $ This script is a test runner for the output_parsing tutorial. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/quickstart/runner.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/quickstart/runner.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/quickstart/runner.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/quickstart/runner.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2011-09-25 -@version $Id: runner.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: runner.py 22608 2017-01-17 06:28:54Z behrisch $ This script is a test runner for the quickstart tutorial. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/san_pablo_dam/data/analyzeData.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/san_pablo_dam/data/analyzeData.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/san_pablo_dam/data/analyzeData.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/san_pablo_dam/data/analyzeData.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,11 +3,11 @@ @author Daniel Krajzewicz @author Laura Bieker @date 2011-09-30 -@version $Id: analyzeData.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: analyzeData.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/san_pablo_dam/runner.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/san_pablo_dam/runner.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/san_pablo_dam/runner.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/san_pablo_dam/runner.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2007-10-25 -@version $Id: runner.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: runner.py 22608 2017-01-17 06:28:54Z behrisch $ This script is a test runner for the San Pablo Dam scenario. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/san_pablo_dam/validate.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/san_pablo_dam/validate.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/san_pablo_dam/validate.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/san_pablo_dam/validate.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,11 +2,11 @@ @file validate.py @author Michael Behrisch @date 2012-01-21 -@version $Id: validate.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: validate.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/sumolympics/data/makeSumolympicWalkers.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/sumolympics/data/makeSumolympicWalkers.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/sumolympics/data/makeSumolympicWalkers.py 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/sumolympics/data/makeSumolympicWalkers.py 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,20 @@ +#!/usr/bin/python +outfile = "sumolympicWalks.rou.xml" +startEdge = "beg" +endEdge = "end" +# Startzeit +departTime = 0. +# Startposition +departPos = -30. +# Anzahl Fussgaenger +numberTrips = 200 +# Generiere XML Datei +xml_string = "\n" +for i in range(numberTrips): + xml_string += ' \n' % (departTime, i) + xml_string += ' \n' % ( + departPos, startEdge, endEdge) + xml_string += ' \n' +xml_string += "\n" +with open(outfile, "w") as f: + f.write(xml_string) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/sumolympics/data/sumolympics.net.xml sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/sumolympics/data/sumolympics.net.xml --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/sumolympics/data/sumolympics.net.xml 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/sumolympics/data/sumolympics.net.xml 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/sumolympics/data/sumolympics.rou.xml sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/sumolympics/data/sumolympics.rou.xml --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/sumolympics/data/sumolympics.rou.xml 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/sumolympics/data/sumolympics.rou.xml 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/sumolympics/data/sumolympics.sumocfg sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/sumolympics/data/sumolympics.sumocfg --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/sumolympics/data/sumolympics.sumocfg 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/sumolympics/data/sumolympics.sumocfg 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/sumolympics/data/sumolympicWalks.rou.xml sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/sumolympics/data/sumolympicWalks.rou.xml --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/sumolympics/data/sumolympicWalks.rou.xml 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/sumolympics/data/sumolympicWalks.rou.xml 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,602 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/sumolympics/runner.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/sumolympics/runner.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/sumolympics/runner.py 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/sumolympics/runner.py 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,42 @@ +#!/usr/bin/env python +""" +@file runner.py +@author Daniel Krajzewicz +@author Michael Behrisch +@date 2007-10-25 +@version $Id: runner.py 22608 2017-01-17 06:28:54Z behrisch $ + +This script is a test runner for the "SUMOlympics" Tutorial. + +SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors + +This file is part of SUMO. +SUMO is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. +""" +from __future__ import absolute_import +from __future__ import print_function + + +import os +import subprocess +import sys +import shutil +try: + sys.path.append(os.path.join(os.path.dirname( + __file__), '..', '..', '..', '..', "tools")) # tutorial in tests + sys.path.append(os.path.join(os.environ.get("SUMO_HOME", os.path.join( + os.path.dirname(__file__), "..", "..", "..")), "tools")) # tutorial in docs + from sumolib import checkBinary +except ImportError: + sys.exit( + "please declare environment variable 'SUMO_HOME' as the root directory of your sumo installation (it should contain folders 'bin', 'tools' and 'docs')") +sumoBinary = checkBinary('sumo') +# run simulation +retcode = subprocess.call( + [sumoBinary, "-c", "data/sumolympics.sumocfg", "--no-step-log"], stdout=sys.stdout, stderr=sys.stderr) +print(">> Simulation closed with status %s" % retcode) +sys.stdout.flush() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/traci_pedestrian_crossing/runner.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/traci_pedestrian_crossing/runner.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/traci_pedestrian_crossing/runner.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/traci_pedestrian_crossing/runner.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,13 +6,13 @@ @author Michael Behrisch @author Jakob Erdmann @date 2009-03-26 -@version $Id: runner.py 21753 2016-10-22 12:32:00Z behrisch $ +@version $Id: runner.py 22608 2017-01-17 06:28:54Z behrisch $ Tutorial for traffic light control via the TraCI interface. This scenario models a pedestrian crossing which switches on demand. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR/TS, Germany +Copyright (C) 2009-2017 DLR/TS, Germany This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/traci_tls/embedded.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/traci_tls/embedded.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/traci_tls/embedded.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/traci_tls/embedded.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Michael Behrisch @author Jakob Erdmann @date 2009-03-26 -@version $Id: embedded.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: embedded.py 22608 2017-01-17 06:28:54Z behrisch $ Tutorial for traffic light control via the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR/TS, Germany +Copyright (C) 2009-2017 DLR/TS, Germany This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/traci_tls/runner.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/traci_tls/runner.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/docs/tutorial/traci_tls/runner.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/docs/tutorial/traci_tls/runner.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Michael Behrisch @author Jakob Erdmann @date 2009-03-26 -@version $Id: runner.py 21851 2016-10-31 12:20:12Z behrisch $ +@version $Id: runner.py 22608 2017-01-17 06:28:54Z behrisch $ Tutorial for traffic light control via the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR/TS, Germany +Copyright (C) 2009-2017 DLR/TS, Germany This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -108,6 +108,9 @@ zip -r $(PACKAGE)-all-$(VERSION).zip $(distdir) $(am__remove_distdir) +pydist: + cd tools && python ./build/setup-sumolib.py sdist bdist_egg && python ./build/setup-traci.py sdist bdist_egg + examples: tools/extractTest.py -x -f tests/examples.txt diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -903,6 +903,9 @@ zip -r $(PACKAGE)-all-$(VERSION).zip $(distdir) $(am__remove_distdir) +pydist: + cd tools && python ./build/setup-sumolib.py sdist bdist_egg && python ./build/setup-traci.py sdist bdist_egg + examples: tools/extractTest.py -x -f tests/examples.txt diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/configure.ac sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/configure.ac --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/configure.ac 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/configure.ac 2017-07-23 16:22:07.000000000 +0000 @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(sumo, 0.28.0) +AC_INIT(sumo, 0.30.0) AC_CONFIG_SRCDIR(src/sumo_main.cpp) AC_CANONICAL_SYSTEM @@ -64,43 +64,8 @@ AM_PROG_LIBTOOL -dnl Check for enable-features that shall go into config.h -AC_ARG_ENABLE([memcheck], [AS_HELP_STRING([--enable-memcheck],[enable compilation of memory leak checks [default=no].])]) -if test x$enable_memcheck = xyes; then - if test x$CXX = xclang++; then - AC_MSG_WARN([--enable-memcheck does not work with clang yet]) - enable_memcheck="no" - fi -fi -AM_CONDITIONAL(CHECK_MEMORY_LEAKS, test x$enable_memcheck = xyes) -if test x$enable_memcheck = xyes; then - AC_DEFINE(CHECK_MEMORY_LEAKS, 1, [Define to 1 in order to enable memory checks.]) - ac_enabled="$ac_enabled MemoryChecks" -else - ac_disabled="$ac_disabled MemoryChecks" -fi - -AC_ARG_ENABLE([internal-lanes], [AS_HELP_STRING([--disable-internal-lanes],[Disable junction internal lanes.])]) -if test x$enable_internal_lanes != xno; then - AC_DEFINE(HAVE_INTERNAL_LANES, 1, [Define to 1 if you want junction internal lanes]) - ac_enabled="$ac_enabled InternalLanes" -else - ac_disabled="$ac_disabled InternalLanes" -fi - -AC_ARG_ENABLE([double-precision], [AS_HELP_STRING([--disable-double-precision],[Use "float" instead of "double" for calculations.])]) -if test x$enable_double_precision != xno; then - AC_DEFINE([SUMOReal], [double], [defines the precision of floats]) - ac_enabled="$ac_enabled DoublePrecision" -else - AC_DEFINE([SUMOReal], [float], [defines the precision of floats]) - ac_disabled="$ac_disabled DoublePrecision" -fi - -AC_DEFINE([POSITION_EPS], [(SUMOReal)0.1], [defines the epsilon to use on position comparison]) -AC_DEFINE([NUMERICAL_EPS], [(SUMOReal)0.001], [defines the epsilon to use on general floating point comparison]) -AC_DEFINE([OUTPUT_ACCURACY], [2], [defines the number of digits after the comma in output]) -AC_DEFINE([GEO_OUTPUT_ACCURACY], [6], [defines the number of digits after the comma in geo-coordinates output]) +AC_DEFINE([POSITION_EPS], [0.1], [defines the epsilon to use on position comparison]) +AC_DEFINE([NUMERICAL_EPS], [0.001], [defines the epsilon to use on general floating point comparison]) AC_ARG_ENABLE([traci],[AS_HELP_STRING([--disable-traci],[disable Traffic Control Interface (TraCI) Server [default=no].])]) AM_CONDITIONAL(TRACI, test x$enable_traci != xno) @@ -477,7 +442,6 @@ src/foreign/eulerspiral/Makefile src/foreign/gl2ps/Makefile src/foreign/mersenne/Makefile -src/foreign/nvwa/Makefile src/foreign/PHEMlight/Makefile src/foreign/PHEMlight/cpp/Makefile src/foreign/polyfonts/Makefile @@ -519,6 +483,7 @@ src/tools/Makefile src/traci_testclient/Makefile src/traci-server/Makefile +src/traci-server/lib/Makefile src/utils/Makefile src/utils/common/Makefile src/utils/distribution/Makefile diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/foreign/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/foreign/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/foreign/Makefile.am 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/foreign/Makefile.am 2017-07-23 16:22:07.000000000 +0000 @@ -1,9 +1,5 @@ -if CHECK_MEMORY_LEAKS -MEMDIRS = nvwa -endif - if WITH_GUI GUIDIRS = gl2ps polyfonts rtree endif -SUBDIRS = eulerspiral mersenne tcpip PHEMlight $(MEMDIRS) $(GUIDIRS) +SUBDIRS = eulerspiral mersenne tcpip PHEMlight $(GUIDIRS) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/foreign/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/foreign/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/foreign/Makefile.in 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/foreign/Makefile.in 2017-07-23 16:22:07.000000000 +0000 @@ -142,8 +142,8 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = eulerspiral mersenne tcpip PHEMlight nvwa gl2ps \ - polyfonts rtree +DIST_SUBDIRS = eulerspiral mersenne tcpip PHEMlight gl2ps polyfonts \ + rtree DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ @@ -313,9 +313,8 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -@CHECK_MEMORY_LEAKS_TRUE@MEMDIRS = nvwa @WITH_GUI_TRUE@GUIDIRS = gl2ps polyfonts rtree -SUBDIRS = eulerspiral mersenne tcpip PHEMlight $(MEMDIRS) $(GUIDIRS) +SUBDIRS = eulerspiral mersenne tcpip PHEMlight $(GUIDIRS) all: all-recursive .SUFFIXES: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/Makefile.am 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/Makefile.am 2017-07-23 16:22:07.000000000 +0000 @@ -5,12 +5,8 @@ GUI_DIRS = gui guinetload guisim netedit mesogui osgview endif -if CHECK_MEMORY_LEAKS -MEM_LIBS = ./foreign/nvwa/libnvwa.a -endif - if TRACI -TRACI_LIBS = ./traci-server/libtraciserver.a ./utils/traci/libtraci.a +TRACI_LIBS = ./traci-server/libtraciserver.a ./traci-server/lib/libtraci.a ./utils/traci/libtraciclient.a TRACI_DIRS = traci-server traci_testclient endif @@ -18,12 +14,13 @@ COMMON_LIBS = ./utils/options/liboptions.a \ ./utils/xml/libxml.a \ +./utils/distribution/libdistribution.a \ +./utils/geom/libgeom.a \ ./utils/common/libcommon.a \ ./utils/importio/libimportio.a \ ./utils/iodevices/libiodevices.a \ ./foreign/PHEMlight/cpp/libphemlight.a \ ./foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ $(XERCES_LIBS) @@ -31,10 +28,7 @@ od2trips_LDADD = ./od/libod.a \ ./utils/options/liboptions.a \ -./utils/distribution/libdistribution.a \ ./utils/vehicle/libvehicle.a \ -./utils/common/libcommon.a \ -./utils/geom/libgeom.a \ $(COMMON_LIBS) $(XERCES_LDFLAGS) @@ -52,7 +46,6 @@ ./microsim/traffic_lights/libmicrosimtls.a \ ./microsim/pedestrians/libmicrosimpeds.a \ ./mesosim/libmesosim.a \ -./utils/geom/libgeom.a \ ./utils/vehicle/libvehicle.a \ ./utils/shapes/libshapes.a \ ./utils/emissions/libemissions.a \ @@ -70,8 +63,6 @@ ./netimport/vissim/tempstructs/libvissimtmpstr.a \ ./netbuild/libnetbuild.a \ ./netwrite/libnetwrite.a \ -./utils/distribution/libdistribution.a \ -./utils/geom/libgeom.a \ ./foreign/eulerspiral/libeulerspiral.a \ $(COMMON_LIBS) \ $(XERCES_LDFLAGS) $(GDAL_LDFLAGS) $(PROJ_LDFLAGS) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/Makefile.in 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/Makefile.in 2017-07-23 16:22:07.000000000 +0000 @@ -99,16 +99,16 @@ netconvert_OBJECTS = $(am_netconvert_OBJECTS) am__DEPENDENCIES_1 = am__DEPENDENCIES_2 = ./utils/options/liboptions.a ./utils/xml/libxml.a \ + ./utils/distribution/libdistribution.a ./utils/geom/libgeom.a \ ./utils/common/libcommon.a ./utils/importio/libimportio.a \ ./utils/iodevices/libiodevices.a \ ./foreign/PHEMlight/cpp/libphemlight.a \ - ./foreign/tcpip/libtcpip.a $(MEM_LIBS) $(am__DEPENDENCIES_1) + ./foreign/tcpip/libtcpip.a $(am__DEPENDENCIES_1) netconvert_DEPENDENCIES = ./netimport/libnetimport.a \ ./netimport/vissim/libvissimimport.a \ ./netimport/vissim/typeloader/libvissimtypeload.a \ ./netimport/vissim/tempstructs/libvissimtmpstr.a \ ./netbuild/libnetbuild.a ./netwrite/libnetwrite.a \ - ./utils/distribution/libdistribution.a ./utils/geom/libgeom.a \ ./foreign/eulerspiral/libeulerspiral.a $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) @@ -119,9 +119,7 @@ am_od2trips_OBJECTS = od2trips_main.$(OBJEXT) od2trips_OBJECTS = $(am_od2trips_OBJECTS) od2trips_DEPENDENCIES = ./od/libod.a ./utils/options/liboptions.a \ - ./utils/distribution/libdistribution.a \ - ./utils/vehicle/libvehicle.a ./utils/common/libcommon.a \ - ./utils/geom/libgeom.a $(am__DEPENDENCIES_2) \ + ./utils/vehicle/libvehicle.a $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) am_sumo_OBJECTS = sumo_main.$(OBJEXT) sumo_OBJECTS = $(am_sumo_OBJECTS) @@ -135,10 +133,9 @@ ./microsim/actions/libmsactions.a \ ./microsim/traffic_lights/libmicrosimtls.a \ ./microsim/pedestrians/libmicrosimpeds.a \ - ./mesosim/libmesosim.a ./utils/geom/libgeom.a \ - ./utils/vehicle/libvehicle.a ./utils/shapes/libshapes.a \ - ./utils/emissions/libemissions.a $(TRACI_LIBS) \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ + ./mesosim/libmesosim.a ./utils/vehicle/libvehicle.a \ + ./utils/shapes/libshapes.a ./utils/emissions/libemissions.a \ + $(TRACI_LIBS) $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am__sumo_gui_SOURCES_DIST = guisim_main.cpp @@ -154,10 +151,9 @@ ./microsim/actions/libmsactions.a \ ./microsim/traffic_lights/libmicrosimtls.a \ ./microsim/pedestrians/libmicrosimpeds.a \ - ./mesosim/libmesosim.a ./utils/geom/libgeom.a \ - ./utils/vehicle/libvehicle.a ./utils/shapes/libshapes.a \ - ./utils/emissions/libemissions.a $(TRACI_LIBS) \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ + ./mesosim/libmesosim.a ./utils/vehicle/libvehicle.a \ + ./utils/shapes/libshapes.a ./utils/emissions/libemissions.a \ + $(TRACI_LIBS) $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) @WITH_GUI_TRUE@sumo_gui_DEPENDENCIES = ./gui/libgui.a \ @@ -433,26 +429,23 @@ top_srcdir = @top_srcdir@ @WITH_GUI_TRUE@GUI_APPS = sumo-gui @WITH_GUI_TRUE@GUI_DIRS = gui guinetload guisim netedit mesogui osgview -@CHECK_MEMORY_LEAKS_TRUE@MEM_LIBS = ./foreign/nvwa/libnvwa.a -@TRACI_TRUE@TRACI_LIBS = ./traci-server/libtraciserver.a ./utils/traci/libtraci.a +@TRACI_TRUE@TRACI_LIBS = ./traci-server/libtraciserver.a ./traci-server/lib/libtraci.a ./utils/traci/libtraciclient.a @TRACI_TRUE@TRACI_DIRS = traci-server traci_testclient COMMON_LIBS = ./utils/options/liboptions.a \ ./utils/xml/libxml.a \ +./utils/distribution/libdistribution.a \ +./utils/geom/libgeom.a \ ./utils/common/libcommon.a \ ./utils/importio/libimportio.a \ ./utils/iodevices/libiodevices.a \ ./foreign/PHEMlight/cpp/libphemlight.a \ ./foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ $(XERCES_LIBS) od2trips_SOURCES = od2trips_main.cpp od2trips_LDADD = ./od/libod.a \ ./utils/options/liboptions.a \ -./utils/distribution/libdistribution.a \ ./utils/vehicle/libvehicle.a \ -./utils/common/libcommon.a \ -./utils/geom/libgeom.a \ $(COMMON_LIBS) $(XERCES_LDFLAGS) sumo_SOURCES = sumo_main.cpp @@ -468,7 +461,6 @@ ./microsim/traffic_lights/libmicrosimtls.a \ ./microsim/pedestrians/libmicrosimpeds.a \ ./mesosim/libmesosim.a \ -./utils/geom/libgeom.a \ ./utils/vehicle/libvehicle.a \ ./utils/shapes/libshapes.a \ ./utils/emissions/libemissions.a \ @@ -484,8 +476,6 @@ ./netimport/vissim/tempstructs/libvissimtmpstr.a \ ./netbuild/libnetbuild.a \ ./netwrite/libnetwrite.a \ -./utils/distribution/libdistribution.a \ -./utils/geom/libgeom.a \ ./foreign/eulerspiral/libeulerspiral.a \ $(COMMON_LIBS) \ $(XERCES_LDFLAGS) $(GDAL_LDFLAGS) $(PROJ_LDFLAGS) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/netedit/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/netedit/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/netedit/Makefile.am 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/netedit/Makefile.am 2017-07-23 16:22:07.000000000 +0000 @@ -6,10 +6,6 @@ GUI_APPS = netedit endif -if CHECK_MEMORY_LEAKS -MEM_LIBS = ../foreign/nvwa/libnvwa.a -endif - if TRACI TRACI_LIBS = ../traci-server/libtraciserver.a endif @@ -35,16 +31,21 @@ GNEViewParent.h GNEViewParent.cpp \ GNEDialog_About.h GNEDialog_About.cpp \ GNEDialog_Wizard.h GNEDialog_Wizard.cpp \ +GNEDialog_AllowDisallow.h GNEDialog_AllowDisallow.cpp \ GNEAdditionalDialog.h GNEAdditionalDialog.cpp \ GNEChange.h GNEChange.cpp \ GNEChange_Junction.h GNEChange_Junction.cpp \ GNEChange_Edge.h GNEChange_Edge.cpp \ +GNEChange_Crossing.h GNEChange_Crossing.cpp \ GNEChange_Lane.h GNEChange_Lane.cpp \ GNEChange_Connection.h GNEChange_Connection.cpp \ GNEChange_Attribute.h GNEChange_Attribute.cpp \ GNEChange_TLS.h GNEChange_TLS.cpp \ GNEChange_Selection.h GNEChange_Selection.cpp \ GNEChange_Additional.h GNEChange_Additional.cpp \ +GNEChange_RerouterInterval.h GNEChange_RerouterInterval.cpp \ +GNEChange_CalibratorItem.h GNEChange_CalibratorItem.cpp \ +GNEChange_POI.h GNEChange_POI.cpp \ GNEUndoList.h GNEUndoList.cpp \ GNEAttributeCarrier.h GNEAttributeCarrier.cpp \ GNEFrame.h GNEFrame.cpp \ @@ -53,9 +54,10 @@ GNEConnectorFrame.h GNEConnectorFrame.cpp \ GNETLSEditorFrame.h GNETLSEditorFrame.cpp \ GNEAdditionalFrame.h GNEAdditionalFrame.cpp \ +GNECrossingFrame.h GNECrossingFrame.cpp \ +GNEDeleteFrame.h GNEDeleteFrame.cpp \ GNEAdditionalHandler.h GNEAdditionalHandler.cpp \ GNEAdditional.h GNEAdditional.cpp \ -GNEAdditionalSet.h GNEAdditionalSet.cpp \ GNEChargingStation.h GNEChargingStation.cpp \ GNEStoppingPlace.h GNEStoppingPlace.cpp \ GNEBusStop.h GNEBusStop.cpp \ @@ -68,15 +70,26 @@ GNEDetectorExit.h GNEDetectorExit.cpp \ GNERerouter.h GNERerouter.cpp \ GNERerouterDialog.h GNERerouterDialog.cpp \ +GNERerouterIntervalDialog.h GNERerouterIntervalDialog.cpp \ GNERouteProbe.h GNERouteProbe.cpp \ GNEVaporizer.h GNEVaporizer.cpp \ GNECalibrator.h GNECalibrator.cpp \ +GNECalibratorFlow.h GNECalibratorFlow.cpp \ +GNECalibratorVehicleType.h GNECalibratorVehicleType.cpp \ +GNECalibratorRoute.h GNECalibratorRoute.cpp \ GNECalibratorDialog.h GNECalibratorDialog.cpp \ -GNEVariableSpeedSignal.h GNEVariableSpeedSignal.cpp \ -GNEVariableSpeedSignalDialog.h GNEVariableSpeedSignalDialog.cpp \ -GNEReferenceCounter.h \ -GNEEvent_NetworkLoaded.h - +GNECalibratorFlowDialog.h GNECalibratorFlowDialog.cpp \ +GNECalibratorRouteDialog.h GNECalibratorRouteDialog.cpp \ +GNECalibratorVehicleTypeDialog.h GNECalibratorVehicleTypeDialog.cpp \ +GNEVariableSpeedSign.h GNEVariableSpeedSign.cpp \ +GNEVariableSpeedSignStep.h GNEVariableSpeedSignStep.cpp \ +GNEVariableSpeedSignDialog.h GNEVariableSpeedSignDialog.cpp \ +GNEClosingLaneReroute.h GNEClosingLaneReroute.cpp \ +GNEClosingReroute.h GNEClosingReroute.cpp \ +GNEDestProbReroute.h GNEDestProbReroute.cpp \ +GNERouteProbReroute.h GNERouteProbReroute.cpp \ +GNERerouterInterval.h GNERerouterInterval.cpp \ +GNEReferenceCounter.h GNEEvent_NetworkLoaded.h netedit_LDADD = ../netimport/libnetimport.a \ ../netimport/vissim/libvissimimport.a \ @@ -106,7 +119,6 @@ ../utils/importio/libimportio.a \ ../utils/iodevices/libiodevices.a \ ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ $(XERCES_LIBS) $(FFMPEG_LIBS) \ $(FOX_LDFLAGS) $(XERCES_LDFLAGS) $(PROJ_LDFLAGS) $(GDAL_LDFLAGS) $(X_LDFLAGS) endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/netedit/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/netedit/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/netedit/Makefile.in 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/netedit/Makefile.in 2017-07-23 16:22:07.000000000 +0000 @@ -103,36 +103,54 @@ GNEPOI.h GNEPOI.cpp GNEPoly.h GNEPoly.cpp GNEProhibition.h \ GNEProhibition.cpp GNEViewNet.h GNEViewNet.cpp GNEViewParent.h \ GNEViewParent.cpp GNEDialog_About.h GNEDialog_About.cpp \ - GNEDialog_Wizard.h GNEDialog_Wizard.cpp GNEAdditionalDialog.h \ - GNEAdditionalDialog.cpp GNEChange.h GNEChange.cpp \ - GNEChange_Junction.h GNEChange_Junction.cpp GNEChange_Edge.h \ - GNEChange_Edge.cpp GNEChange_Lane.h GNEChange_Lane.cpp \ + GNEDialog_Wizard.h GNEDialog_Wizard.cpp \ + GNEDialog_AllowDisallow.h GNEDialog_AllowDisallow.cpp \ + GNEAdditionalDialog.h GNEAdditionalDialog.cpp GNEChange.h \ + GNEChange.cpp GNEChange_Junction.h GNEChange_Junction.cpp \ + GNEChange_Edge.h GNEChange_Edge.cpp GNEChange_Crossing.h \ + GNEChange_Crossing.cpp GNEChange_Lane.h GNEChange_Lane.cpp \ GNEChange_Connection.h GNEChange_Connection.cpp \ GNEChange_Attribute.h GNEChange_Attribute.cpp GNEChange_TLS.h \ GNEChange_TLS.cpp GNEChange_Selection.h \ GNEChange_Selection.cpp GNEChange_Additional.h \ - GNEChange_Additional.cpp GNEUndoList.h GNEUndoList.cpp \ - GNEAttributeCarrier.h GNEAttributeCarrier.cpp GNEFrame.h \ - GNEFrame.cpp GNEInspectorFrame.h GNEInspectorFrame.cpp \ - GNESelectorFrame.h GNESelectorFrame.cpp GNEConnectorFrame.h \ - GNEConnectorFrame.cpp GNETLSEditorFrame.h \ - GNETLSEditorFrame.cpp GNEAdditionalFrame.h \ - GNEAdditionalFrame.cpp GNEAdditionalHandler.h \ + GNEChange_Additional.cpp GNEChange_RerouterInterval.h \ + GNEChange_RerouterInterval.cpp GNEChange_CalibratorItem.h \ + GNEChange_CalibratorItem.cpp GNEChange_POI.h GNEChange_POI.cpp \ + GNEUndoList.h GNEUndoList.cpp GNEAttributeCarrier.h \ + GNEAttributeCarrier.cpp GNEFrame.h GNEFrame.cpp \ + GNEInspectorFrame.h GNEInspectorFrame.cpp GNESelectorFrame.h \ + GNESelectorFrame.cpp GNEConnectorFrame.h GNEConnectorFrame.cpp \ + GNETLSEditorFrame.h GNETLSEditorFrame.cpp GNEAdditionalFrame.h \ + GNEAdditionalFrame.cpp GNECrossingFrame.h GNECrossingFrame.cpp \ + GNEDeleteFrame.h GNEDeleteFrame.cpp GNEAdditionalHandler.h \ GNEAdditionalHandler.cpp GNEAdditional.h GNEAdditional.cpp \ - GNEAdditionalSet.h GNEAdditionalSet.cpp GNEChargingStation.h \ - GNEChargingStation.cpp GNEStoppingPlace.h GNEStoppingPlace.cpp \ - GNEBusStop.h GNEBusStop.cpp GNEContainerStop.h \ - GNEContainerStop.cpp GNEDetector.h GNEDetector.cpp \ - GNEDetectorE1.h GNEDetectorE1.cpp GNEDetectorE2.h \ - GNEDetectorE2.cpp GNEDetectorE3.h GNEDetectorE3.cpp \ - GNEDetectorEntry.h GNEDetectorEntry.cpp GNEDetectorExit.h \ - GNEDetectorExit.cpp GNERerouter.h GNERerouter.cpp \ - GNERerouterDialog.h GNERerouterDialog.cpp GNERouteProbe.h \ - GNERouteProbe.cpp GNEVaporizer.h GNEVaporizer.cpp \ - GNECalibrator.h GNECalibrator.cpp GNECalibratorDialog.h \ - GNECalibratorDialog.cpp GNEVariableSpeedSignal.h \ - GNEVariableSpeedSignal.cpp GNEVariableSpeedSignalDialog.h \ - GNEVariableSpeedSignalDialog.cpp GNEReferenceCounter.h \ + GNEChargingStation.h GNEChargingStation.cpp GNEStoppingPlace.h \ + GNEStoppingPlace.cpp GNEBusStop.h GNEBusStop.cpp \ + GNEContainerStop.h GNEContainerStop.cpp GNEDetector.h \ + GNEDetector.cpp GNEDetectorE1.h GNEDetectorE1.cpp \ + GNEDetectorE2.h GNEDetectorE2.cpp GNEDetectorE3.h \ + GNEDetectorE3.cpp GNEDetectorEntry.h GNEDetectorEntry.cpp \ + GNEDetectorExit.h GNEDetectorExit.cpp GNERerouter.h \ + GNERerouter.cpp GNERerouterDialog.h GNERerouterDialog.cpp \ + GNERerouterIntervalDialog.h GNERerouterIntervalDialog.cpp \ + GNERouteProbe.h GNERouteProbe.cpp GNEVaporizer.h \ + GNEVaporizer.cpp GNECalibrator.h GNECalibrator.cpp \ + GNECalibratorFlow.h GNECalibratorFlow.cpp \ + GNECalibratorVehicleType.h GNECalibratorVehicleType.cpp \ + GNECalibratorRoute.h GNECalibratorRoute.cpp \ + GNECalibratorDialog.h GNECalibratorDialog.cpp \ + GNECalibratorFlowDialog.h GNECalibratorFlowDialog.cpp \ + GNECalibratorRouteDialog.h GNECalibratorRouteDialog.cpp \ + GNECalibratorVehicleTypeDialog.h \ + GNECalibratorVehicleTypeDialog.cpp GNEVariableSpeedSign.h \ + GNEVariableSpeedSign.cpp GNEVariableSpeedSignStep.h \ + GNEVariableSpeedSignStep.cpp GNEVariableSpeedSignDialog.h \ + GNEVariableSpeedSignDialog.cpp GNEClosingLaneReroute.h \ + GNEClosingLaneReroute.cpp GNEClosingReroute.h \ + GNEClosingReroute.cpp GNEDestProbReroute.h \ + GNEDestProbReroute.cpp GNERouteProbReroute.h \ + GNERouteProbReroute.cpp GNERerouterInterval.h \ + GNERerouterInterval.cpp GNEReferenceCounter.h \ GNEEvent_NetworkLoaded.h @WITH_GUI_TRUE@am_netedit_OBJECTS = netedit_main.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEApplicationWindow.$(OBJEXT) \ @@ -145,26 +163,31 @@ @WITH_GUI_TRUE@ GNEViewNet.$(OBJEXT) GNEViewParent.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEDialog_About.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEDialog_Wizard.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEDialog_AllowDisallow.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEAdditionalDialog.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChange.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChange_Junction.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChange_Edge.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEChange_Crossing.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChange_Lane.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChange_Connection.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChange_Attribute.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChange_TLS.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChange_Selection.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChange_Additional.$(OBJEXT) \ -@WITH_GUI_TRUE@ GNEUndoList.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEChange_RerouterInterval.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEChange_CalibratorItem.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEChange_POI.$(OBJEXT) GNEUndoList.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEAttributeCarrier.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEFrame.$(OBJEXT) GNEInspectorFrame.$(OBJEXT) \ @WITH_GUI_TRUE@ GNESelectorFrame.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEConnectorFrame.$(OBJEXT) \ @WITH_GUI_TRUE@ GNETLSEditorFrame.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEAdditionalFrame.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNECrossingFrame.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEDeleteFrame.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEAdditionalHandler.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEAdditional.$(OBJEXT) \ -@WITH_GUI_TRUE@ GNEAdditionalSet.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChargingStation.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEStoppingPlace.$(OBJEXT) GNEBusStop.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEContainerStop.$(OBJEXT) \ @@ -173,11 +196,24 @@ @WITH_GUI_TRUE@ GNEDetectorEntry.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEDetectorExit.$(OBJEXT) GNERerouter.$(OBJEXT) \ @WITH_GUI_TRUE@ GNERerouterDialog.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNERerouterIntervalDialog.$(OBJEXT) \ @WITH_GUI_TRUE@ GNERouteProbe.$(OBJEXT) GNEVaporizer.$(OBJEXT) \ @WITH_GUI_TRUE@ GNECalibrator.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNECalibratorFlow.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNECalibratorVehicleType.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNECalibratorRoute.$(OBJEXT) \ @WITH_GUI_TRUE@ GNECalibratorDialog.$(OBJEXT) \ -@WITH_GUI_TRUE@ GNEVariableSpeedSignal.$(OBJEXT) \ -@WITH_GUI_TRUE@ GNEVariableSpeedSignalDialog.$(OBJEXT) +@WITH_GUI_TRUE@ GNECalibratorFlowDialog.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNECalibratorRouteDialog.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNECalibratorVehicleTypeDialog.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEVariableSpeedSign.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEVariableSpeedSignStep.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEVariableSpeedSignDialog.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEClosingLaneReroute.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEClosingReroute.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEDestProbReroute.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNERouteProbReroute.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNERerouterInterval.$(OBJEXT) netedit_OBJECTS = $(am_netedit_OBJECTS) am__DEPENDENCIES_1 = @WITH_GUI_TRUE@netedit_DEPENDENCIES = ../netimport/libnetimport.a \ @@ -207,7 +243,7 @@ @WITH_GUI_TRUE@ ../utils/xml/libxml.a \ @WITH_GUI_TRUE@ ../utils/importio/libimportio.a \ @WITH_GUI_TRUE@ ../utils/iodevices/libiodevices.a \ -@WITH_GUI_TRUE@ ../foreign/tcpip/libtcpip.a $(MEM_LIBS) \ +@WITH_GUI_TRUE@ ../foreign/tcpip/libtcpip.a \ @WITH_GUI_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ @WITH_GUI_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ @WITH_GUI_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) @@ -439,7 +475,6 @@ top_srcdir = @top_srcdir@ EXTRA_DIST = netedit64.ico netedit.rc @WITH_GUI_TRUE@GUI_APPS = netedit -@CHECK_MEMORY_LEAKS_TRUE@MEM_LIBS = ../foreign/nvwa/libnvwa.a @TRACI_TRUE@TRACI_LIBS = ../traci-server/libtraciserver.a @WITH_GUI_TRUE@netedit_SOURCES = netedit_main.cpp \ @WITH_GUI_TRUE@GNEApplicationWindow.h GNEApplicationWindow.cpp \ @@ -459,16 +494,21 @@ @WITH_GUI_TRUE@GNEViewParent.h GNEViewParent.cpp \ @WITH_GUI_TRUE@GNEDialog_About.h GNEDialog_About.cpp \ @WITH_GUI_TRUE@GNEDialog_Wizard.h GNEDialog_Wizard.cpp \ +@WITH_GUI_TRUE@GNEDialog_AllowDisallow.h GNEDialog_AllowDisallow.cpp \ @WITH_GUI_TRUE@GNEAdditionalDialog.h GNEAdditionalDialog.cpp \ @WITH_GUI_TRUE@GNEChange.h GNEChange.cpp \ @WITH_GUI_TRUE@GNEChange_Junction.h GNEChange_Junction.cpp \ @WITH_GUI_TRUE@GNEChange_Edge.h GNEChange_Edge.cpp \ +@WITH_GUI_TRUE@GNEChange_Crossing.h GNEChange_Crossing.cpp \ @WITH_GUI_TRUE@GNEChange_Lane.h GNEChange_Lane.cpp \ @WITH_GUI_TRUE@GNEChange_Connection.h GNEChange_Connection.cpp \ @WITH_GUI_TRUE@GNEChange_Attribute.h GNEChange_Attribute.cpp \ @WITH_GUI_TRUE@GNEChange_TLS.h GNEChange_TLS.cpp \ @WITH_GUI_TRUE@GNEChange_Selection.h GNEChange_Selection.cpp \ @WITH_GUI_TRUE@GNEChange_Additional.h GNEChange_Additional.cpp \ +@WITH_GUI_TRUE@GNEChange_RerouterInterval.h GNEChange_RerouterInterval.cpp \ +@WITH_GUI_TRUE@GNEChange_CalibratorItem.h GNEChange_CalibratorItem.cpp \ +@WITH_GUI_TRUE@GNEChange_POI.h GNEChange_POI.cpp \ @WITH_GUI_TRUE@GNEUndoList.h GNEUndoList.cpp \ @WITH_GUI_TRUE@GNEAttributeCarrier.h GNEAttributeCarrier.cpp \ @WITH_GUI_TRUE@GNEFrame.h GNEFrame.cpp \ @@ -477,9 +517,10 @@ @WITH_GUI_TRUE@GNEConnectorFrame.h GNEConnectorFrame.cpp \ @WITH_GUI_TRUE@GNETLSEditorFrame.h GNETLSEditorFrame.cpp \ @WITH_GUI_TRUE@GNEAdditionalFrame.h GNEAdditionalFrame.cpp \ +@WITH_GUI_TRUE@GNECrossingFrame.h GNECrossingFrame.cpp \ +@WITH_GUI_TRUE@GNEDeleteFrame.h GNEDeleteFrame.cpp \ @WITH_GUI_TRUE@GNEAdditionalHandler.h GNEAdditionalHandler.cpp \ @WITH_GUI_TRUE@GNEAdditional.h GNEAdditional.cpp \ -@WITH_GUI_TRUE@GNEAdditionalSet.h GNEAdditionalSet.cpp \ @WITH_GUI_TRUE@GNEChargingStation.h GNEChargingStation.cpp \ @WITH_GUI_TRUE@GNEStoppingPlace.h GNEStoppingPlace.cpp \ @WITH_GUI_TRUE@GNEBusStop.h GNEBusStop.cpp \ @@ -492,14 +533,26 @@ @WITH_GUI_TRUE@GNEDetectorExit.h GNEDetectorExit.cpp \ @WITH_GUI_TRUE@GNERerouter.h GNERerouter.cpp \ @WITH_GUI_TRUE@GNERerouterDialog.h GNERerouterDialog.cpp \ +@WITH_GUI_TRUE@GNERerouterIntervalDialog.h GNERerouterIntervalDialog.cpp \ @WITH_GUI_TRUE@GNERouteProbe.h GNERouteProbe.cpp \ @WITH_GUI_TRUE@GNEVaporizer.h GNEVaporizer.cpp \ @WITH_GUI_TRUE@GNECalibrator.h GNECalibrator.cpp \ +@WITH_GUI_TRUE@GNECalibratorFlow.h GNECalibratorFlow.cpp \ +@WITH_GUI_TRUE@GNECalibratorVehicleType.h GNECalibratorVehicleType.cpp \ +@WITH_GUI_TRUE@GNECalibratorRoute.h GNECalibratorRoute.cpp \ @WITH_GUI_TRUE@GNECalibratorDialog.h GNECalibratorDialog.cpp \ -@WITH_GUI_TRUE@GNEVariableSpeedSignal.h GNEVariableSpeedSignal.cpp \ -@WITH_GUI_TRUE@GNEVariableSpeedSignalDialog.h GNEVariableSpeedSignalDialog.cpp \ -@WITH_GUI_TRUE@GNEReferenceCounter.h \ -@WITH_GUI_TRUE@GNEEvent_NetworkLoaded.h +@WITH_GUI_TRUE@GNECalibratorFlowDialog.h GNECalibratorFlowDialog.cpp \ +@WITH_GUI_TRUE@GNECalibratorRouteDialog.h GNECalibratorRouteDialog.cpp \ +@WITH_GUI_TRUE@GNECalibratorVehicleTypeDialog.h GNECalibratorVehicleTypeDialog.cpp \ +@WITH_GUI_TRUE@GNEVariableSpeedSign.h GNEVariableSpeedSign.cpp \ +@WITH_GUI_TRUE@GNEVariableSpeedSignStep.h GNEVariableSpeedSignStep.cpp \ +@WITH_GUI_TRUE@GNEVariableSpeedSignDialog.h GNEVariableSpeedSignDialog.cpp \ +@WITH_GUI_TRUE@GNEClosingLaneReroute.h GNEClosingLaneReroute.cpp \ +@WITH_GUI_TRUE@GNEClosingReroute.h GNEClosingReroute.cpp \ +@WITH_GUI_TRUE@GNEDestProbReroute.h GNEDestProbReroute.cpp \ +@WITH_GUI_TRUE@GNERouteProbReroute.h GNERouteProbReroute.cpp \ +@WITH_GUI_TRUE@GNERerouterInterval.h GNERerouterInterval.cpp \ +@WITH_GUI_TRUE@GNEReferenceCounter.h GNEEvent_NetworkLoaded.h @WITH_GUI_TRUE@netedit_LDADD = ../netimport/libnetimport.a \ @WITH_GUI_TRUE@../netimport/vissim/libvissimimport.a \ @@ -529,7 +582,6 @@ @WITH_GUI_TRUE@../utils/importio/libimportio.a \ @WITH_GUI_TRUE@../utils/iodevices/libiodevices.a \ @WITH_GUI_TRUE@../foreign/tcpip/libtcpip.a \ -@WITH_GUI_TRUE@$(MEM_LIBS) \ @WITH_GUI_TRUE@$(XERCES_LIBS) $(FFMPEG_LIBS) \ @WITH_GUI_TRUE@$(FOX_LDFLAGS) $(XERCES_LDFLAGS) $(PROJ_LDFLAGS) $(GDAL_LDFLAGS) $(X_LDFLAGS) @@ -631,26 +683,40 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEAdditionalDialog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEAdditionalFrame.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEAdditionalHandler.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEAdditionalSet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEApplicationWindow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEAttributeCarrier.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEBusStop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECalibrator.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECalibratorDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECalibratorFlow.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECalibratorFlowDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECalibratorRoute.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECalibratorRouteDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECalibratorVehicleType.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECalibratorVehicleTypeDialog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_Additional.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_Attribute.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_CalibratorItem.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_Connection.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_Crossing.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_Edge.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_Junction.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_Lane.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_POI.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_RerouterInterval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_Selection.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_TLS.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChargingStation.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEClosingLaneReroute.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEClosingReroute.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEConnection.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEConnectorFrame.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEContainerStop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECrossing.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECrossingFrame.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDeleteFrame.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDestProbReroute.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDetector.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDetectorE1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDetectorE2.Po@am__quote@ @@ -658,6 +724,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDetectorEntry.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDetectorExit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDialog_About.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDialog_AllowDisallow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDialog_Wizard.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEEdge.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEFrame.Po@am__quote@ @@ -673,14 +740,18 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEProhibition.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNERerouter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNERerouterDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNERerouterInterval.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNERerouterIntervalDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNERouteProbReroute.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNERouteProbe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNESelectorFrame.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEStoppingPlace.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNETLSEditorFrame.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEUndoList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEVaporizer.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEVariableSpeedSignal.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEVariableSpeedSignalDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEVariableSpeedSign.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEVariableSpeedSignDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEVariableSpeedSignStep.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEViewNet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEViewParent.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netedit_main.Po@am__quote@ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/utils/gui/windows/GUISUMOAbstractView.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/utils/gui/windows/GUISUMOAbstractView.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/utils/gui/windows/GUISUMOAbstractView.cpp 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/10_remove_embedded_gl2ps.patch/src/utils/gui/windows/GUISUMOAbstractView.cpp 2017-07-23 16:22:07.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Laura Bieker /// @author Andreas Gaubatz /// @date Sept 2002 -/// @version $Id: GUISUMOAbstractView.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUISUMOAbstractView.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The base class for a view /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -61,6 +61,7 @@ #include #include #include +#include #include "GUISUMOAbstractView.h" #include "GUIMainWindow.h" @@ -69,12 +70,15 @@ #include "GUIDialog_EditViewport.h" #ifdef HAVE_GDAL +#if __GNUC__ > 3 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" +#endif #include +#if __GNUC__ > 3 +#pragma GCC diagnostic pop +#endif #endif - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS // =========================================================================== @@ -109,8 +113,7 @@ * GUISUMOAbstractView - methods * ----------------------------------------------------------------------- */ GUISUMOAbstractView::GUISUMOAbstractView(FXComposite* p, GUIMainWindow& app, GUIGlChildWindow* parent, const SUMORTree& grid, FXGLVisual* glVis, FXGLCanvas* share) : - FXGLCanvas(p, glVis, share, p, MID_GLCANVAS, - LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0), + FXGLCanvas(p, glVis, share, p, MID_GLCANVAS, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0), myApp(&app), myParent(parent), myGrid(&((SUMORTree&)grid)), @@ -178,11 +181,24 @@ Position +GUISUMOAbstractView::snapToActiveGrid(const Position& pos) const { + Position result = pos; + if (myVisualizationSettings->showGrid) { + const double xRest = std::fmod(pos.x(), myVisualizationSettings->gridXSize) + (pos.x() < 0 ? myVisualizationSettings->gridXSize : 0); + const double yRest = std::fmod(pos.y(), myVisualizationSettings->gridYSize) + (pos.y() < 0 ? myVisualizationSettings->gridYSize : 0); + result.setx(pos.x() - xRest + (xRest < myVisualizationSettings->gridXSize * 0.5 ? 0 : myVisualizationSettings->gridXSize)); + result.sety(pos.y() - yRest + (yRest < myVisualizationSettings->gridYSize * 0.5 ? 0 : myVisualizationSettings->gridYSize)); + } + return result; +} + + +Position GUISUMOAbstractView::screenPos2NetPos(int x, int y) const { Boundary bound = myChanger->getViewport(); - SUMOReal xNet = bound.xmin() + bound.getWidth() * x / getWidth(); + double xNet = bound.xmin() + bound.getWidth() * x / getWidth(); // cursor origin is in the top-left corner - SUMOReal yNet = bound.ymin() + bound.getHeight() * (getHeight() - y) / getHeight(); + double yNet = bound.ymin() + bound.getHeight() * (getHeight() - y) / getHeight(); return Position(xNet, yNet); } @@ -206,7 +222,7 @@ myApp->getCartesianLabel().setText(text.c_str()); GeoConvHelper::getFinal().cartesian2geo(pos); if (GeoConvHelper::getFinal().usingGeoProjection()) { - text = "lat:" + toString(pos.y(), GEO_OUTPUT_ACCURACY) + ", lon:" + toString(pos.x(), GEO_OUTPUT_ACCURACY); + text = "lat:" + toString(pos.y(), gPrecisionGeo) + ", lon:" + toString(pos.x(), gPrecisionGeo); } else { text = "x:" + toString(pos.x()) + ", y:" + toString(pos.y()); } @@ -292,14 +308,14 @@ GUIGlID GUISUMOAbstractView::getObjectAtPosition(Position pos) { - const SUMOReal SENSITIVITY = 0.1; // meters + const double SENSITIVITY = 0.1; // meters Boundary selection; selection.add(pos); selection.grow(SENSITIVITY); const std::vector ids = getObjectsInBoundary(selection); // Interpret results int idMax = 0; - SUMOReal maxLayer = -std::numeric_limits::max(); + double maxLayer = -std::numeric_limits::max(); for (std::vector::const_iterator it = ids.begin(); it != ids.end(); it++) { GUIGlID id = *it; GUIGlObject* o = GUIGlObjectStorage::gIDStorage.getObjectBlocking(id); @@ -312,7 +328,7 @@ //std::cout << "point selection hit " << o->getMicrosimID() << "\n"; GUIGlObjectType type = o->getType(); if (type != 0) { - SUMOReal layer = (SUMOReal)type; + double layer = (double)type; // determine an "abstract" layer for shapes // this "layer" resembles the layer of the shape // taking into account the stac of other objects @@ -336,7 +352,7 @@ std::vector -GUISUMOAbstractView::getObjectsAtPosition(Position pos, SUMOReal radius) { +GUISUMOAbstractView::getObjectsAtPosition(Position pos, double radius) { Boundary selection; selection.add(pos); selection.grow(radius); @@ -418,33 +434,43 @@ void GUISUMOAbstractView::paintGLGrid() { - glEnable(GL_DEPTH_TEST); - glLineWidth(1); - - SUMOReal xmin = myGrid->xmin(); - SUMOReal ymin = myGrid->ymin(); - SUMOReal ypos = ymin; - SUMOReal xpos = xmin; - SUMOReal xend = myGrid->xmax(); - SUMOReal yend = myGrid->ymax(); - - glTranslated(0, 0, .55); - glColor3d(0.5, 0.5, 0.5); - // draw horizontal lines - glBegin(GL_LINES); - for (; ypos < yend;) { - glVertex2d(xmin, ypos); - glVertex2d(xend, ypos); - ypos += myVisualizationSettings->gridYSize; - } - // draw vertical lines - for (; xpos < xend;) { - glVertex2d(xpos, ymin); - glVertex2d(xpos, yend); - xpos += myVisualizationSettings->gridXSize; + // obtain minimum grid + double minimumSizeGrid = (myVisualizationSettings->gridXSize < myVisualizationSettings->gridYSize) ? myVisualizationSettings->gridXSize : myVisualizationSettings->gridYSize; + // Check if the distance is enought to draw grid + if (myVisualizationSettings->scale * myVisualizationSettings->addSize.getExaggeration(*myVisualizationSettings) >= (25 / minimumSizeGrid)) { + glEnable(GL_DEPTH_TEST); + glLineWidth(1); + // get multiplication values (2 is the marging) + int multXmin = (int)(myChanger->getViewport().xmin() / myVisualizationSettings->gridXSize) - 2; + int multYmin = (int)(myChanger->getViewport().ymin() / myVisualizationSettings->gridYSize) - 2; + int multXmax = (int)(myChanger->getViewport().xmax() / myVisualizationSettings->gridXSize) + 2; + int multYmax = (int)(myChanger->getViewport().ymax() / myVisualizationSettings->gridYSize) + 2; + // obtain references + double xmin = myVisualizationSettings->gridXSize * multXmin; + double ymin = myVisualizationSettings->gridYSize * multYmin; + double xmax = myVisualizationSettings->gridXSize * multXmax; + double ymax = myVisualizationSettings->gridYSize * multYmax; + double xpos = xmin; + double ypos = ymin; + // move drawing matrix + glTranslated(0, 0, .55); + glColor3d(0.5, 0.5, 0.5); + // draw horizontal lines + glBegin(GL_LINES); + while (ypos <= ymax) { + glVertex2d(xmin, ypos); + glVertex2d(xmax, ypos); + ypos += myVisualizationSettings->gridYSize; + } + // draw vertical lines + while (xpos <= xmax) { + glVertex2d(xpos, ymin); + glVertex2d(xpos, ymax); + xpos += myVisualizationSettings->gridXSize; + } + glEnd(); + glTranslated(0, 0, -.55); } - glEnd(); - glTranslated(0, 0, -.55); } @@ -454,14 +480,14 @@ int length = 1; const std::string text("10000000000"); int noDigits = 1; - int pixelSize = (int) m2p((SUMOReal) length); + int pixelSize = (int) m2p((double) length); while (pixelSize <= 20) { length *= 10; noDigits++; if (noDigits > (int)text.length()) { return; } - pixelSize = (int) m2p((SUMOReal) length); + pixelSize = (int) m2p((double) length); } glLineWidth(1.0); @@ -478,7 +504,7 @@ glDisable(GL_BLEND); glEnable(GL_DEPTH_TEST); - SUMOReal len = (SUMOReal) pixelSize / (SUMOReal)(getWidth() - 1) * (SUMOReal) 2.0; + double len = (double) pixelSize / (double)(getWidth() - 1) * (double) 2.0; glColor3d(0, 0, 0); double o = double(15) / double(getHeight()); double o2 = o + o; @@ -495,15 +521,15 @@ glVertex2d(-.98 + len, -1. + o2); glEnd(); - SUMOReal w = SUMOReal(35) / SUMOReal(getWidth()); - SUMOReal h = SUMOReal(35) / SUMOReal(getHeight()); - pfSetPosition(SUMOReal(-0.99), SUMOReal(1. - o2 - oo)); + double w = double(35) / double(getWidth()); + double h = double(35) / double(getHeight()); + pfSetPosition(double(-0.99), double(1. - o2 - oo)); pfSetScaleXY(w, h); glRotated(180, 1, 0, 0); pfDrawString("0m"); glRotated(-180, 1, 0, 0); - pfSetPosition(SUMOReal(-.99 + len), SUMOReal(1. - o2 - oo)); + pfSetPosition(double(-.99 + len), double(1. - o2 - oo)); glRotated(180, 1, 0, 0); pfDrawString((text.substr(0, noDigits) + "m").c_str()); glRotated(-180, 1, 0, 0); @@ -516,14 +542,14 @@ } -SUMOReal -GUISUMOAbstractView::m2p(SUMOReal meter) const { +double +GUISUMOAbstractView::m2p(double meter) const { return meter * getWidth() / myChanger->getViewport().getWidth(); } -SUMOReal -GUISUMOAbstractView::p2m(SUMOReal pixel) const { +double +GUISUMOAbstractView::p2m(double pixel) const { return pixel * myChanger->getViewport().getWidth() / getWidth(); } @@ -535,7 +561,7 @@ void -GUISUMOAbstractView::centerTo(GUIGlID id, bool applyZoom, SUMOReal zoomDist) { +GUISUMOAbstractView::centerTo(GUIGlID id, bool applyZoom, double zoomDist) { GUIGlObject* o = GUIGlObjectStorage::gIDStorage.getObjectBlocking(id); if (o != 0 && dynamic_cast(o) != 0) { if (applyZoom && zoomDist < 0) { @@ -975,8 +1001,7 @@ GUIDialog_EditViewport* GUISUMOAbstractView::getViewportEditor() { if (myViewportChooser == 0) { - myViewportChooser = - new GUIDialog_EditViewport(this, "Edit Viewport...", 0, 0); + myViewportChooser = new GUIDialog_EditViewport(this, "Edit Viewport", 0, 0); myViewportChooser->create(); } myViewportChooser->setValues(myChanger->getZoom(), myChanger->getXPos(), myChanger->getYPos()); @@ -1038,13 +1063,13 @@ } -SUMOReal +double GUISUMOAbstractView::getGridWidth() const { return myGrid->getWidth(); } -SUMOReal +double GUISUMOAbstractView::getGridHeight() const { return myGrid->getHeight(); } @@ -1189,8 +1214,8 @@ } glRotated(d.rot, 0, 0, 1); glColor3d(1, 1, 1); - SUMOReal halfWidth = d.width / 2.; - SUMOReal halfHeight = d.height / 2.; + double halfWidth = d.width / 2.; + double halfHeight = d.height / 2.; if (d.screenRelative) { halfWidth = p2m(halfWidth); halfHeight = p2m(halfHeight); @@ -1218,9 +1243,6 @@ bool GUISUMOAbstractView::removeAdditionalGLVisualisation(const GUIGlObject* const which) { - if (getTrackedID() == which->getGlID()) { - stopTrack(); - } if (myAdditionallyDrawn.find(which) == myAdditionallyDrawn.end()) { return false; } @@ -1256,21 +1278,21 @@ glOrtho(0, getWidth(), 0, getHeight(), -GLO_MAX - 1, GLO_MAX + 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - SUMOReal scaleX = (SUMOReal)getWidth() / bound.getWidth(); - SUMOReal scaleY = (SUMOReal)getHeight() / bound.getHeight(); + double scaleX = (double)getWidth() / bound.getWidth(); + double scaleY = (double)getHeight() / bound.getHeight(); glScaled(scaleX, scaleY, 1); glTranslated(-bound.xmin(), -bound.ymin(), 0); } -SUMOReal +double GUISUMOAbstractView::getDelay() const { return myApp->getDelay(); } void -GUISUMOAbstractView::setDelay(SUMOReal delay) { +GUISUMOAbstractView::setDelay(double delay) { myApp->setDelay(delay); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/contributed/sumopy/agilepy/lib_wx/ogleditor.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/contributed/sumopy/agilepy/lib_wx/ogleditor.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/contributed/sumopy/agilepy/lib_wx/ogleditor.py 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/contributed/sumopy/agilepy/lib_wx/ogleditor.py 2017-07-23 16:22:07.000000000 +0000 @@ -0,0 +1,4715 @@ +#!/usr/bin/env python; +"""OpenGL editor""" +if __name__ == '__main__': + __version__ = "0.1a" + __licence__ = """licensed under the GPL.""" + __copyright__ = "(c) 2012-2017 University of Bologna - DICAM" + __author__ = "Joerg Schweizer" + + __usage__ = """USAGE: + from command line: + python ogleditor.py + python ogleditor.py + + use for debugging + python ogleditor.py --debug > debug.txt 2>&1 + """ + print __copyright__ + +############################################################################### +# IMPORTS + +#import wxversion +# wxversion.select("2.8") + +import wx +from collections import OrderedDict +from wx import glcanvas +from wx.lib.buttons import GenBitmapTextButton, GenBitmapButton +try: + from OpenGL.GL import * + from OpenGL.GLU import * # project , unproject , tess + from OpenGL.GLUT import * + from OpenGL.raw.GL.ARB.vertex_array_object import glGenVertexArrays, \ + glBindVertexArray + + from OpenGL.arrays import vbo + import numpy as np + +except ImportError: + raise ImportError, "Required dependencies numpy or OpenGL not present" + +import sys +import os +import types +if __name__ == '__main__': + try: + FILEDIR = os.path.dirname(os.path.abspath(__file__)) + except: + FILEDIR = os.path.dirname(os.path.abspath(sys.argv[0])) + sys.path.append(os.path.join(FILEDIR, "..", "..")) + #IMAGEDIR = os.path.join(APPDIR,"lib_base","images") + +IMAGEDIR = os.path.join(os.path.dirname(__file__), "images") + +import agilepy.lib_base.classman as cm +import agilepy.lib_base.arrayman as am + +from agilepy.lib_base.geometry import * + +# wx gui stuff +from wxmisc import * +from toolbox import * + + +FLATHEAD = 0 +BEVELHEAD = 1 +TRIANGLEHEAD = 2 +ARROWHEAD = 3 +LEFTTRIANGLEHEAD = 4 +RIGHTTRIANGLEHEAD = 5 + +LINEHEADS = { # 'flat':0,# not a style + 'bevel': BEVELHEAD, + 'triangle': TRIANGLEHEAD, + 'arrow': ARROWHEAD, + 'lefttriangle': LEFTTRIANGLEHEAD, + 'righttriangle': RIGHTTRIANGLEHEAD, +} + +# to be deleted +#import test_glcanvas as testogl +# class TestVbo(Vbo): +# def draw(self, resolution): +## +## +## +# print 'draw',self.get_ident(),self +# glEnableClientState(GL_VERTEX_ARRAY) +# glEnableClientState(GL_COLOR_ARRAY) +## +# self._colorvbo.bind() +## glColorPointer(4, GL_FLOAT, 0, None) +## +# self._vertexvbo.bind() +# self._indexvbo.bind() +## glVertexPointer(3, GL_FLOAT, 0, None) +## +# print ' self._n_vpo *(self._n_vpo-1)*self._n_drawobjs',self._n_vpo *(self._n_vpo-1)*self._n_drawobjs +# print ' len(self._vertexvbo)',len(self._vertexvbo) +# print ' len(self._colorvbo)',len(self._colorvbo) +# n_vpo = len(self._vertexvbo)/self._n_vpe/self._n_drawobjs+1 +# glDrawElements(self._glelement, self._n_vpo *(self._n_vpo-1)*self._n_drawobjs, GL_UNSIGNED_INT, None) +## glDrawElements(self._glelement, len(self._vertexvbo), GL_UNSIGNED_INT, None) +## +# glDisableClientState(GL_VERTEX_ARRAY) +# glDisableClientState(GL_COLOR_ARRAY) +## +# self._vertexvbo.unbind() +# self._indexvbo.unbind() +# self._colorvbo.unbind() + + +class Vbo: + + def __init__(self, ident, glelement, n_vpe, objtype=''): + self._ident = ident + self._glelement = glelement + self._n_vpe = n_vpe + self._objtype = objtype + self.reset() + + def reset(self): + self._vertexvbo = None + self._indexvbo = None + self._colorvbo = None + self._inds = None + + def get_objtype(self): + return self._objtype + + def is_fill(self): + return self._objtype == 'fill' + + def get_ident(self): + return self._ident + + def get_vpe(self): + return self._n_vpe + + def update_vertices(self, vertices, n=None, inds=None): + """ + + n = number of draw objects + """ + self._inds = inds + # print 'update_vertices',self.get_ident(),n + self._n_drawobjs = n + # + #vertices = np.zeros((self._n_elem_fill, self._n_vpe_fill * 3),dtype=np.float32) + # len(vertices) = n_elem = (n_vpo-1)*n + #n_elem = len(vertices)/n_drawobjs+self._noncyclic + + # n_vpo = vertex per draw object + # n_elem = (n_vpo-1)*n_drawobjs + # n_vpo = vertex per draw object + #self._n_vpo = n_elem/n_drawobjs+1 + #n_vert = len(self._vertexvbo_fill)/self._n_vpe_fill/len(self)+1 + #n_elem_fill = (n_vert-1)*n + # len(_vertexvbo_fill) = self._n_vpe * self._n_elem_fill = self._n_vpe * (n_vert-1)*n + # print ' len(vertices),n_vpo,n_elem',len(vertices),self._n_vpo,n_elem + + #glDrawElements(GL_TRIANGLES, self._n_vert*self._n_elem_fill, GL_UNSIGNED_INT, None) + # self._n_vert*self._n_elem_fill = n_vert * (n_vert-1)*n + # repeat for each of the n objects: self._n_vpe_fill*(n_vert-1) + # print ' vertices=\n',vertices + # print ' vertices.reshape((-1,3))=\n',vertices.reshape((-1,3)) + self._vertexvbo = vbo.VBO(vertices.reshape((-1, 3))) + self._indexvbo = vbo.VBO(np.arange( + len(self._vertexvbo), dtype=np.int32), target=GL_ELEMENT_ARRAY_BUFFER) + #self._indexvbo = vbo.VBO(np.arange(len(vertices.reshape((-1,3)) ), dtype=np.int32), target=GL_ELEMENT_ARRAY_BUFFER) + + def destroy(self): + del self._vertexvbo + del self._indexvbo + del self._colorvbo + self.reset() + + def update_colors(self, colors): + + if self._vertexvbo == None: + return + # print 'update_colors',self._n_drawobjs,len(colors) + if len(colors) == 0: + return + if self._n_drawobjs == None: + n_repreat = len(self._vertexvbo) / \ + len(self._inds) # self._n_drawobjs + self._colorvbo = vbo.VBO( + np.repeat(colors[self._inds], n_repreat, 0)) + else: + n_repreat = len(self._vertexvbo) / self._n_drawobjs + self._colorvbo = vbo.VBO(np.repeat(colors, n_repreat, 0)) + + def draw(self, resolution): + + # glEnableClientState(GL_VERTEX_ARRAY) + # glEnableClientState(GL_COLOR_ARRAY) + if self._vertexvbo == None: + return + # print 'Vbo.draw',self.get_ident(),self._n_drawobjs,len(self._vertexvbo) + # if self._n_drawobjs in (0,None): return + if self._n_drawobjs == 0: + return + self._colorvbo.bind() + glColorPointer(4, GL_FLOAT, 0, None) + + self._vertexvbo.bind() + self._indexvbo.bind() + glVertexPointer(3, GL_FLOAT, 0, None) + + # print ' self._n_vpo *(self._n_vpo-1)*self._n_drawobjs',self._n_vpo *(self._n_vpo-1)*self._n_drawobjs + # print ' len(self._vertexvbo)',len(self._vertexvbo) + # print ' len(self._indexvbo)',len(self._indexvbo) + # print ' len(self._colorvbo)',len(self._colorvbo) + #n_vpo = len(self._vertexvbo)/self._n_vpe/self._n_drawobjs+1 + #glDrawElements(self._glelement, self._n_vpo *(self._n_vpo-1)*self._n_drawobjs, GL_UNSIGNED_INT, None) + glDrawElements(self._glelement, len( + self._vertexvbo), GL_UNSIGNED_INT, None) + + # glDisableClientState(GL_VERTEX_ARRAY) + # glDisableClientState(GL_COLOR_ARRAY) + + self._vertexvbo.unbind() + self._indexvbo.unbind() + self._colorvbo.unbind() + + +class SelectToolMixin(BaseTool): + + """ + Mixin for Selection tools for OGL canvas. + """ + + def _init_select(self, is_show_selected=False, detectwidth=0.1, detectpix=5): + """ + Define selection specific attributes. + """ + self.detectpix = detectpix + self.detectwidth = detectwidth # in meter + self.is_show_selected = is_show_selected + + if is_show_selected: + groupnames = ['options'] + else: + groupnames = ['_private_'] + self.add_col(am.TabIdsArrayConf('drawobjects', + groupnames=groupnames, + name='Object', + info='Selected Draw objects with id', + )) + + def activate_select(self, canvas=None): + """ + This call by metacanvas signals that the tool has been + activated and can now interact with metacanvas. + """ + BaseTool.activate(self, canvas) + self._idcounter = 0 + + def deactivate_select(self): + """ + This call by metacanvas signals that the tool has been + deactivated and can now interact with metacanvas. + """ + drawing = self._canvas.get_drawing() + + if len(self) > 0: + # ungighlight selected objects + is_draw = False + # drawing.get_drawobjs(): + for drawobj, _id in self.drawobjects.value: + is_draw |= drawobj.unhighlight([_id], is_update=True) + if is_draw: + self._canvas.draw() + + # remove selected objects + self.del_rows(self.get_ids()) + + BaseTool.deactivate(self) + + def iterate_selection(self): + self.unhighlight_current() + self._idcounter += 1 + if self._idcounter == len(self): + self._idcounter = 0 + self.highlight_current() + + def on_left_down_select(self, event): + # print 'on_left_down_select' + is_draw = False + + if len(self) > 0: + if event.ShiftDown(): + + self.iterate_selection() + self.on_change_selection(event) + is_draw = True + else: + # print ' on_execute_selection 1' + is_draw |= self.on_execute_selection(event) + is_draw |= self.unselect_all() + if self.is_show_selected: + self.parent.refresh_optionspanel(self) + + else: + is_draw |= self.pick_all(event) + self.highlight_current() + + if not event.ShiftDown(): + if self.is_preselected(): + self.coord_last = self._canvas.unproject( + event.GetPosition()) + # print ' on_execute_selection 2' + is_draw |= self.on_execute_selection(event) + + else: + self.coord_last = self._canvas.unproject(event.GetPosition()) + + if self.is_show_selected: + self.parent.refresh_optionspanel(self) + + return is_draw + + def is_preselected(self): + """ + Check if there are preselected drawobjects in the list. + """ + return len(self) > 0 + + def on_execute_selection(self, event): + """ + Definively execute operation on currently selected drawobjects. + """ + self.set_objbrowser() + return False + + def on_change_selection(self, event): + """ + Called after selection has been changed with SHIFT-click + Do operation on currently selected drawobjects. + """ + self.set_objbrowser() + return False + + def set_objbrowser(self): + pass + + def aboard_select(self, event): + # print 'aboard',self.ident + is_draw = self.unselect_all() + return is_draw + + def get_current_selection(self): + if len(self) > 0: + (drawobj, _id) = self.drawobjects[self.get_ids()[self._idcounter]] + return drawobj, _id + else: + return None, -1 + + def is_tool_allowed_on_selection(self): + drawobj, _id = self.get_current_selection() + if drawobj != None: + return drawobj.is_tool_allowed(self, _id) + else: + False + + def pick_all(self, event): + """ + Pick all objets with id, that are near the pointer + coordinates. + """ + + p = self._canvas.unproject_event(event) + + if self.detectpix > 0: + # detect pixel sensitivity is given + # calculate detectwidth based on current resolution + self.detectwidth = self._canvas.get_resolution() * self.detectpix + + # print + # 'pick_all',self.detectwidth,self.detectpix,self._canvas.get_resolution() + + self._idcounter = 0 + is_draw = False + drawing = self._canvas.get_drawing() + # print ' ',drawing.get_drawobjs() + for drawobj in drawing.get_drawobjs(): + if drawobj.is_visible(): + ids_pick = drawobj.pick(p, detectwidth=self.detectwidth) + # print ' pick',drawobj.get_ident(),ids_pick + if len(ids_pick) > 0: + for id_pick in ids_pick: + is_draw |= self.add_selection(drawobj, id_pick, event) + + return is_draw + + def unhighlight_current(self): + # print 'unhighlight_current',len(self),self._idcounter + if len(self) > 0: + (drawobj, _id) = self.drawobjects[self.get_ids()[self._idcounter]] + drawobj.unhighlight([_id]) + + def highlight_current(self): + # print 'highlight_current',len(self),self._idcounter + if len(self) > 0: + (drawobj, _id) = self.drawobjects[self.get_ids()[self._idcounter]] + drawobj.highlight([_id]) + + def unselect_all(self): + # print 'unselect_all',len(self) + self._idcounter = 0 + if len(self) > 0: + is_draw = True + for drawobj, _id in self.drawobjects.value: + if _id in drawobj: + drawobj.unhighlight([_id]) + + self.del_rows(self.get_ids()) + else: + is_draw = False + + if is_draw: + self.parent.refresh_optionspanel(self) + # print ' len should be 0:',len(self),is_draw + return is_draw + + def add_selection(self, drawobj, id_pick, event): + is_draw = False + drawobjid = self.drawobjects.convert_type((drawobj, id_pick)) + ids_match = self.select_ids(self.drawobjects.value == drawobjid) + if len(ids_match) == 0: + self.add_rows(1, drawobjects=[(drawobj, id_pick)]) + is_draw = True + return is_draw + + +class AddLineTool(BaseTool): + + """ + Mixin for Selection tools for OGL canvas. + """ + + def __init__(self, parent, mainframe=None): + self.init_common('add_line', parent, 'Add line tool', + info='Click on canvas to add a line. Double click to finish, right click to aboard.', + is_textbutton=False, + ) + self.init_options() + + def init_options(self): + self.add(cm.AttrConf('width', 0.2, + groupnames=['options'], + perm='rw', + name='Width', + is_save=True, + info='Line width', + )) + + self.add(cm.AttrConf('color', np.array([1.0, 0.0, 0.0, 0.8], dtype=np.float32), + groupnames=['options'], + perm='rw', + metatype='color', + name='Fill color', + is_save=True, + info='Line color with format [r,g,b,a]', + )) + + # self.add(cm.AttrConf( 'color_fill', np.array([1.0,0.0,0.0,0.8], dtype=np.float32), + # groupnames = ['options'], + # perm='rw', + # metatype = 'color', + # name = 'Fill color', + # is_save = True, + # info = 'Object fill color with format [r,g,b,a]', + # )) + + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'line_24px.png'), wx.BITMAP_TYPE_PNG) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'line_24px.png'), wx.BITMAP_TYPE_PNG) + + def set_cursor(self): + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + if self._canvas != None: + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) + + def activate(self, canvas=None): + """ + This call by metacanvas??TooldsPallet signals that the tool has been + activated and can now interact with metacanvas. + """ + # print 'activate',self.ident + self._is_active = True + self._canvas = canvas + # self._canvas.del_handles() + canvas.activate_tool(self) + self.set_cursor() + self.is_animated = False + + def deactivate(self): + """ + This call by metacanvas??? ToolePallet signals that the tool has been + deactivated and can now interact with metacanvas. + """ + + is_draw = self.aboard() + self._canvas.deactivate_tool() + self._canvas = None + self._is_active = False + return is_draw + + def on_left_down(self, event): + if not self.is_animated: + return self.begin_animation(event) + + def on_left_dclick(self, event): + if self.is_animated: + return self.end_animation(event) + + def on_motion(self, event): + if self.is_animated: + return self.animate(event) + else: + return False + + def begin_animation(self, event): + # print 'AddLineTool' + #self.drawobj_anim, _id, self.ind_vert = self.get_current_vertexselection() + self.drawobj_anim = self._canvas.get_drawing().get_drawobj_by_ident( + 'fancylines') + self.coord_last = self._canvas.unproject(event.GetPosition()) + vert = np.concatenate( + (self.coord_last, self.coord_last), 1).reshape((2, 3)) + # print ' vert ',vert#,self.width.get_value(),self.color.get_value(), + _id = self.drawobj_anim.add_drawobj(vert, + self.width.get_value(), # width + self.color.get_value(), + beginstyle=TRIANGLEHEAD, + endstyle=TRIANGLEHEAD, + ) + self.ind_vert = 1 + self.drawobj_anim.begin_animation(_id) + + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_CROSS)) + self.is_animated = True + + self.parent.refresh_optionspanel(self) + return True # True for redrawing + + def end_animation(self, event): + self.drawobj_anim.end_animation(is_del_last_vert=False) + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) + + del self.drawobj_anim + #del self.id_anim + self.is_animated = False + self.parent.refresh_optionspanel(self) + return True # True for redrawing + + def animate(self, event): + # print 'animate' + is_draw = False + coords = self._canvas.unproject(event.GetPosition()) + vertex_delta = coords - self.coord_last + if np.any(np.abs(vertex_delta) > 0): + is_draw = self.drawobj_anim.stretch_animation( + coords, vertex_delta, self.ind_vert) + if is_draw: + self.coord_last = coords + return is_draw + + def aboard(self, event=None): + # print 'aboard',self.ident + + is_draw = False + if self.is_animated: + #id_admin = self.drawobj_anim.get_id_admin() + self.drawobj_anim.del_animation(is_del_main=True) + del self.drawobj_anim + self.is_animated = False + is_draw = True + self.parent.refresh_optionspanel(self) + return is_draw # True for redrawing + + # def set_objbrowser(self): + # pass + + def get_optionspanel(self, parent, size=(200, -1)): + """ + Return tool option widgets on given parent + """ + if self.is_animated: + # show option of currently selected drawobj + self._optionspanel = ObjPanel(parent, obj=self.drawobj_anim, + id=self.drawobj_anim.get_id_anim(), + attrconfigs=None, + #tables = None, + # table = None, id=None, ids=None, + groupnames=['options'], + func_change_obj=None, + show_groupnames=False, show_title=True, is_modal=False, + mainframe=self.parent.get_mainframe(), + pos=wx.DefaultPosition, size=size, style=wx.MAXIMIZE_BOX | wx.RESIZE_BORDER, + func_apply=self.on_apply_option, + # 'instrumental' + immediate_apply=False, panelstyle='default', + standartbuttons=['apply', 'restore']) + else: + + self._optionspanel = ObjPanel(parent, obj=self, + id=None, + attrconfigs=None, + #tables = None, + # table = None, id=None, ids=None, + groupnames=['options'], + func_change_obj=None, + show_groupnames=False, show_title=True, is_modal=False, + mainframe=self.parent.get_mainframe(), + pos=wx.DefaultPosition, size=size, style=wx.MAXIMIZE_BOX | wx.RESIZE_BORDER, + func_apply=self.on_apply_option, + # 'instrumental' + immediate_apply=False, panelstyle='default', + standartbuttons=['apply', 'restore']) + + return self._optionspanel + + def on_apply_option(self, drawobj, id, ids): + # print '\n\n\non_apply_option drawobj, id, ids',drawobj, id, ids + if self.is_animated: + if drawobj == self.drawobj_anim: + drawobj._update_colorvbo() + drawobj._update_vertexvbo() + + self._canvas.draw() + + +class AddCircleTool(AddLineTool): + + """ + Mixin for Selection tools for OGL canvas. + """ + + def __init__(self, parent, mainframe=None): + self.init_common('add_circle', parent, 'Add circle tool', + info='Click on canvas to add a circle. Double click to finish, right click to aboard.', + is_textbutton=False, + ) + self.init_options() + + def init_options(self): + + self.add(cm.AttrConf('color', np.array([1.0, 0.0, 0.0, 0.8], dtype=np.float32), + groupnames=['options'], + perm='rw', + metatype='color', + name='Color', + is_save=True, + info='Line color with format [r,g,b,a]', + )) + + self.add(cm.AttrConf('color_fill', np.array([1.0, 0.0, 0.0, 0.8], dtype=np.float32), + groupnames=['options'], + perm='rw', + metatype='color', + name='Fill color', + is_save=True, + info='Circle fill color with format [r,g,b,a]', + )) + + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'circle_empty_24px.png'), wx.BITMAP_TYPE_PNG) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'circle_empty_24px.png'), wx.BITMAP_TYPE_PNG) + + def begin_animation(self, event): + # print 'AddLineTool' + #self.drawobj_anim, _id, self.ind_vert = self.get_current_vertexselection() + self.drawobj_anim = self._canvas.get_drawing().get_drawobj_by_ident( + 'circles') + self.coord_last = self._canvas.unproject(event.GetPosition()) + #vert = np.concatenate((self.coord_last,self.coord_last),1).reshape((2,3)) + # print ' vert ',vert#,self.width.get_value(),self.color.get_value(), + + _id = self.drawobj_anim.add_drawobj(1.0 * self.coord_last, + 0.0, + self.color.get_value(), + self.color_fill.get_value(), + ) + + self.drawobj_anim.begin_animation(_id) + + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_CROSS)) + self.is_animated = True + + self.parent.refresh_optionspanel(self) + return True # True for redrawing + + def end_animation(self, event): + self.drawobj_anim.end_animation(is_del_last_vert=False) + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) + + del self.drawobj_anim + #del self.id_anim + self.is_animated = False + self.parent.refresh_optionspanel(self) + return True # True for redrawing + + def animate(self, event): + # print 'animate' + is_draw = False + coords = self._canvas.unproject(event.GetPosition()) + vertex_delta = coords - self.coord_last + if np.any(np.abs(vertex_delta) > 0): + is_draw = self.drawobj_anim.stretch_animation( + coords, vertex_delta, 1) + if is_draw: + self.coord_last = coords + return is_draw + + +class AddPolylineTool(AddLineTool): + + """ + Mixin for Selection tools for OGL canvas. + """ + + def __init__(self, parent, mainframe=None): + self.init_common('add_polyline', parent, 'Add polyline tool', + info='Click on canvas to add a poly line. Add a vertex with a single click, double click to finish, right click to aboard.', + is_textbutton=False, + ) + self.init_options() + + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'polyline_24px.png'), wx.BITMAP_TYPE_PNG) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'polyline_24px.png'), wx.BITMAP_TYPE_PNG) + + def on_left_down(self, event): + if not self.is_animated: + return self.begin_animation(event) + else: + # add vertex + return self.append_vert_to_anim(event) + + def begin_animation(self, event): + # print 'AddLineTool.begin_animation' + #self.drawobj_anim, _id, self.ind_vert = self.get_current_vertexselection() + self.drawobj_anim = self._canvas.get_drawing().get_drawobj_by_ident( + 'polylines') + self.coord_last = self._canvas.unproject(event.GetPosition()) + #vertices = [list(self.coord_last),list(self.coord_last) ] + # attention, we need copies here!! + vertices = [1.0 * self.coord_last, 1.0 * self.coord_last] + # print ' vertices + # ',vertices#,self.width.get_value(),self.color.get_value(), + + _id = self.drawobj_anim.add_drawobj(vertices, + self.width.get_value(), # width + self.color.get_value(), + beginstyle=TRIANGLEHEAD, + endstyle=TRIANGLEHEAD, + ) + self.ind_vert = 1 + self.drawobj_anim.begin_animation(_id) + + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_CROSS)) + self.is_animated = True + + self.parent.refresh_optionspanel(self) + return True # True for redrawing + + def end_animation(self, event): + self.drawobj_anim.end_animation(is_del_last_vert=True) + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) + + del self.drawobj_anim + #del self.id_anim + self.is_animated = False + self.parent.refresh_optionspanel(self) + return True # True for redrawing + + def append_vert_to_anim(self, event): + self.coord_last = self._canvas.unproject(event.GetPosition()) + + self.ind_vert = self.drawobj_anim.append_vert_to_animation( + self.coord_last) + + return True + + +class AddPolygonTool(AddPolylineTool): + + """ + Mixin for Selection tools for OGL canvas. + """ + + def __init__(self, parent, mainframe=None): + self.init_common('add_polygon', parent, 'Add polygon tool', + info='Click on canvas to add a polygon. Add a vertex with a single click, double click to finish, right click to aboard.', + is_textbutton=False, + ) + self.init_options() + + def init_options(self): + self.add(cm.AttrConf('color', np.array([1.0, 0.0, 0.0, 0.8], dtype=np.float32), + groupnames=['options'], + perm='rw', + metatype='color', + name='Fill color', + is_save=True, + info='Line color with format [r,g,b,a]', + )) + + # self.add(cm.AttrConf( 'color_fill', np.array([1.0,0.0,0.0,0.8], dtype=np.float32), + # groupnames = ['options'], + # perm='rw', + # metatype = 'color', + # name = 'Fill color', + # is_save = True, + # info = 'Object fill color with format [r,g,b,a]', + # )) + + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'polygon2_24px.png'), wx.BITMAP_TYPE_PNG) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'polygon2_24px.png'), wx.BITMAP_TYPE_PNG) + + def begin_animation(self, event): + # print 'AddLineTool.begin_animation' + #self.drawobj_anim, _id, self.ind_vert = self.get_current_vertexselection() + self.drawobj_anim = self._canvas.get_drawing().get_drawobj_by_ident( + 'polygons') + self.coord_last = self._canvas.unproject(event.GetPosition()) + #vertices = [list(self.coord_last),list(self.coord_last) ] + # attention, we need copies here!! + vertices = [1.0 * self.coord_last, 1.0 * self.coord_last, ] + # print ' vertices + # ',vertices#,self.width.get_value(),self.color.get_value(), + + _id = self.drawobj_anim.add_drawobj(vertices, + color=self.color.get_value(), + ) + self.ind_vert = 1 + self.drawobj_anim.begin_animation(_id) + + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_CROSS)) + self.is_animated = True + + self.parent.refresh_optionspanel(self) + return True # True for redrawing + + +class SelectTool(SelectToolMixin): + + """ + Selection tool for OGL canvas. + """ + + def __init__(self, parent, detectwidth=0.1, detectpix=5, mainframe=None): + """ + To be overridden by specific tool. + """ + self.init_common('select', parent, 'Selection tool', + info='Select objects in cancvas', + is_textbutton=False, + ) + self._init_select(is_show_selected=True, + detectwidth=detectwidth, detectpix=detectpix) + + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' Select_32px + + # wx.ART_INFORMATION + self._bitmap = wx.ArtProvider.GetBitmap( + wx.ART_INFORMATION, wx.ART_TOOLBAR) + self._bitmap_sel = wx.ArtProvider.GetBitmap( + wx.ART_INFORMATION, wx.ART_TOOLBAR) + + #self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'Cursor-Click-icon_24px.png'),wx.BITMAP_TYPE_PNG) + # self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'Cursor-Click-icon_24px.png'),wx.BITMAP_TYPE_PNG) + + #self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'selectIcon.bmp'),wx.BITMAP_TYPE_BMP) + # self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'selectIconSel.bmp'),wx.BITMAP_TYPE_BMP) + + def set_cursor(self): + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + if self._canvas != None: + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_QUESTION_ARROW)) + + def deactivate(self): + """ + This call by metacanvas signals that the tool has been + deactivated and can now interact with metacanvas. + """ + self.deactivate_select() + self._is_active = False + + def activate(self, canvas=None): + """ + This call by metacanvas signals that the tool has been + activated and can now interact with metacanvas. + """ + self.activate_select(canvas) # calls also set_cursor + self._is_active = True + + def on_left_down(self, event): + return self.on_left_down_select(event) + + def aboard(self, event): + # print 'aboard',self.ident + return self.aboard_select(event) + + +class ConfigureTool(SelectToolMixin): + + """ + Selection tool for OGL canvas. + """ + + def __init__(self, parent, detectwidth=0.1, detectpix=5, mainframe=None): + """ + To be overridden by specific tool. + """ + self.init_common('configure', parent, 'Configure tool', + info='Drawing options.', + is_textbutton=False, + ) + + self._init_select(is_show_selected=False, + detectwidth=detectwidth, detectpix=detectpix) + + # self.drawing = + #attrsman.add( cm.ObjConf( Nodes(self) ) ) + + # self.add_col(am.TabIdsArrayConf( 'drawobjects', + # groupnames = ['options'], + # name = 'Object', + # info = 'Selected Draw objects with id', + # )) + + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'gtk_configure_24px.png'), wx.BITMAP_TYPE_PNG) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'gtk_configure_24px.png'), wx.BITMAP_TYPE_PNG) + + def set_cursor(self): + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + if self._canvas != None: + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_QUESTION_ARROW)) + + def deactivate(self): + """ + This call by metacanvas signals that the tool has been + deactivated and can now interact with metacanvas. + """ + self.deactivate_select() + self._is_active = False + + def activate(self, canvas=None): + """ + This call by metacanvas signals that the tool has been + activated and can now interact with metacanvas. + """ + self.activate_select(canvas) # calls also set_cursor + self._is_active = True + + def on_left_down(self, event): + return self.on_left_down_select(event) + + def aboard(self, event): + # print 'aboard',self.ident + return self.aboard_select(event) + + def set_objbrowser(self): + self.parent.refresh_optionspanel(self) + + def get_optionspanel(self, parent): + """ + Return tool option widgets on given parent + """ + drawobj, _id = self.get_current_selection() + if drawobj == None: + # no current selection-> show options of whole drawing + size = (200, -1) + self._optionspanel = NaviPanel(parent, obj=self._canvas.get_drawing(), + attrconfigs=None, + #tables = None, + # table = None, id=None, ids=None, + groupnames=['options'], + mainframe=self.parent.get_mainframe(), + #pos=wx.DefaultPosition, size=size, style = wx.MAXIMIZE_BOX|wx.RESIZE_BORDER, + func_apply=self.on_apply_option, + # 'instrumental' + immediate_apply=False, panelstyle='default', + standartbuttons=['apply', 'restore']) + else: + # show option of currently selected drawobj + size = (200, -1) + self._optionspanel = ObjPanel(parent, obj=drawobj, + id=_id, + attrconfigs=None, + #tables = None, + # table = None, id=None, ids=None, + groupnames=['options'], + func_change_obj=None, + show_groupnames=False, show_title=True, is_modal=False, + mainframe=self.parent.get_mainframe(), + pos=wx.DefaultPosition, size=size, style=wx.MAXIMIZE_BOX | wx.RESIZE_BORDER, + func_apply=self.on_apply_option, + # 'instrumental' + immediate_apply=False, panelstyle='default', + standartbuttons=['apply', 'restore']) + + return self._optionspanel + + def on_apply_option(self, drawobj, id, ids): + # print '\n\n\non_apply_option drawobj, id, ids',drawobj, id, ids + drawing = self._canvas.get_drawing() + drawobjs = drawing.get_drawobjs(is_anim=True) + + if drawobj in drawobjs: + drawobj._update_colorvbo() + drawobj._update_vertexvbo() + + self._canvas.draw() + + +class HandleTool(SelectTool): + + """ + General tool to help select handles. + """ + + def __init__(self, parent, detectwidth=0.1, detectpix=5, mainframe=None): + """ + To be overridden by specific tool. + """ + self.init_common('select_handles', parent, 'Handle selection', + info='Select handles on cancvas', + is_textbutton=False, + ) + + self._init_select(detectwidth=detectwidth, detectpix=detectpix) + + def _init_select(self, is_show_selected=True, detectwidth=0.1, detectpix=5): + + SelectTool._init_select(self, is_show_selected, + detectwidth=detectwidth, detectpix=detectpix) + self.add_col(am.ArrayConf('inds_vertex', -1, + # ['_private_'], #'options', + groupnames=['options'], + name='Vertex index', + info='Vertex index.', + )) + + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' Select_32px + + # wx.ART_INFORMATION + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'Cursor-Click-icon_24px.png'), wx.BITMAP_TYPE_PNG) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'Cursor-Click-icon_24px.png'), wx.BITMAP_TYPE_PNG) + + #self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'selectIcon.bmp'),wx.BITMAP_TYPE_BMP) + # self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'selectIconSel.bmp'),wx.BITMAP_TYPE_BMP) + + def set_cursor(self): + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + if self._canvas != None: + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_RIGHT_ARROW)) + + def get_current_vertexselection(self): + if len(self) > 0: + id_selected = self.get_ids()[self._idcounter] + (drawobj, _id) = self.drawobjects[id_selected] + ind_vertex = self.inds_vertex[id_selected] + return drawobj, _id, ind_vertex + else: + return None, -1, -1 + + def pick_all(self, event): + """ + Pick all objets with id and vertex index, that are near the pointer + coordinates. + """ + # print 'pick_all' + p = self._canvas.unproject_event(event) + + if self.detectpix > 0: + # detect pixel sensitivity is given + # calculate detectwidth based on current resolution + self.detectwidth = self._canvas.get_resolution() * self.detectpix + + self._idcounter = 0 + is_draw = False + drawing = self._canvas.get_drawing() + # print ' ',drawing.get_drawobjs() + for drawobj in drawing.get_drawobjs(): + # print ' ',drawobj,drawobj.get_ident() + # experiment + if drawobj.is_visible(): + handles = drawobj.pick_handle(p, detectwidth=self.detectwidth) + if len(handles) > 0: + # print ' handles',drawobj.get_ident(),handles + for id_handle, ind_vertex in handles: + is_draw |= self.add_selection( + drawobj, id_handle, ind_vertex, event) + #is_draw |= self.select(drawobj,id_pick, event) + # break + return is_draw + + def add_selection(self, drawobj, id_handle, ind_vertex, event): + is_draw = False + drawobjid = self.drawobjects.convert_type((drawobj, id_handle)) + ids_match = self.select_ids(self.drawobjects.value == drawobjid) + if len(ids_match) == 0: + self.add_rows(1, drawobjects=[ + (drawobj, id_handle)], inds_vertex=[ind_vertex]) + is_draw = True + return is_draw + + +class DeleteTool(SelectTool): + + """ + Delete tool for OGL canvas. + """ + + def __init__(self, parent, detectwidth=0.1, detectpix=5, mainframe=None): + """ + To be overridden by specific tool. + """ + self.init_common('delete', parent, 'Delete tool', + info='Select and delete objects in canvas.', + is_textbutton=False, + ) + self._init_select(is_show_selected=True, + detectwidth=detectwidth, detectpix=detectpix) + + def set_button_info(self, bsize=(32, 32)): + self._bitmap = wx.ArtProvider.GetBitmap(wx.ART_DELETE, wx.ART_TOOLBAR) + self._bitmap_sel = wx.ArtProvider.GetBitmap( + wx.ART_DELETE, wx.ART_TOOLBAR) + + def set_cursor(self): + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + if self._canvas != None: + # self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_RIGHT_ARROW)) + pass + + def on_execute_selection(self, event): + """ + Definively execute operation on currently selected drawobjects. + """ + if self.is_tool_allowed_on_selection(): + drawobj, _id = self.get_current_selection() + + if drawobj != None: + drawobj.del_drawobj(_id) + self.unselect_all() + is_draw = True + else: + is_draw = False + return is_draw + else: + return False + + def on_change_selection(self, event): + """ + Called after selection has been changed with SHIFT-click + Do operation on currently selected drawobjects. + """ + return False + + +class MoveTool(SelectTool): + + """ + Move tool for OGL canvas. + """ + + def __init__(self, parent, detectwidth=0.1, detectpix=5, mainframe=None): + """ + To be overridden by specific tool. + """ + self.drawobj_anim, self.id_anim = (None, -1) + + self.init_common('move', parent, 'Move tool', + info='Select and drag objects in cancvas.', + is_textbutton=False, + ) + self._init_select(is_show_selected=True, + detectwidth=detectwidth, detectpix=detectpix) + + def set_button_info(self, bsize=(32, 32)): + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'arrow_cursor_drag_24px.png'), wx.BITMAP_TYPE_PNG) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'arrow_cursor_drag_24px.png'), wx.BITMAP_TYPE_PNG) + + def activate(self, canvas=None): + """ + This call by metacanvas signals that the tool has been + activated and can now interact with metacanvas. + """ + self.activate_select(canvas) + self.is_animated = False + self._is_active = True + + def set_cursor(self): + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + if self._canvas != None: + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) + + def deactivate(self): + """ + This call by metacanvas signals that the tool has been + deactivated and can now interact with metacanvas. + """ + # self.deactivate_select() + #self.is_animated = False + is_draw = self.aboard() + self._canvas.deactivate_tool() + self._canvas = None + self._is_active = False + return is_draw + + def on_left_down(self, event): + if self.is_animated: + return self.end_animation(event) + else: + return self.on_left_down_select(event) + + def on_motion(self, event): + if self.is_animated: + return self.animate(event) + else: + return False + + def on_execute_selection(self, event): + """ + Definively execute operation on currently selected drawobjects. + """ + if self.is_tool_allowed_on_selection(): + if not self.is_animated: + return self.begin_animation(event) + else: + return self.end_animation(event) + + else: + return False + + def on_change_selection(self, event): + """ + Called after selection has been changed with SHIFT-click + Do operation on currently selected drawobjects. + """ + return False + + def begin_animation(self, event): + self.drawobj_anim, _id = self.get_current_selection() + #self.drawobj_anim, self.id_anim = drawobj.get_anim(_id) + self.drawobj_anim.begin_animation(_id) + + # done in select method + #self.coord_last = self._canvas.unproject(event.GetPosition()) + + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_CROSS)) + self.is_animated = True + return True # True for redrawing + + def end_animation(self, event): + #drawobj, _id = self.get_current_selection() + #drawobj.set_anim(_id, (self.drawobj_anim, self.id_anim)) + self.drawobj_anim.end_animation() + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) + + del self.drawobj_anim + #del self.id_anim + self.is_animated = False + + self.unselect_all() + return True # True for redrawing + + def animate(self, event): + is_draw = False + coords = self._canvas.unproject(event.GetPosition()) + vertex_delta = coords - self.coord_last + if np.any(np.abs(vertex_delta) > 0): + is_draw = self.drawobj_anim.move_animation(coords, vertex_delta) + if is_draw: + self.coord_last = coords + return is_draw + + def aboard(self, event=None): + # print 'aboard',self.ident + + is_draw = False + if self.is_animated: + self.drawobj_anim.del_animation() + del self.drawobj_anim + self.is_animated = False + is_draw = True + + is_draw |= self.aboard_select(event) + return is_draw # True for redrawing + + +class StretchTool(HandleTool): + + """ + Stretch tool for OGL canvas. + """ + + def __init__(self, parent, detectwidth=0.1, detectpix=5, mainframe=None): + """ + To be overridden by specific tool. + """ + self.drawobj_anim, self.id_anim = (None, -1) + + self.init_common('stretch', parent, 'Stretch tool', + info='Select vertex and stretch objetc in cancvas.', + is_textbutton=False, + ) + + self._init_select(is_show_selected=True, + detectwidth=detectwidth, detectpix=detectpix) + + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' Select_32px + + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'move_vertex_24px.png'), wx.BITMAP_TYPE_PNG) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'move_vertex_24px.png'), wx.BITMAP_TYPE_PNG) + + # self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'Cursor-Click-icon_24px.png'),wx.BITMAP_TYPE_PNG) + # self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'Cursor-Click-icon_24px.png'),wx.BITMAP_TYPE_PNG) + + def set_cursor(self): + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + if self._canvas != None: + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) + + def activate(self, canvas=None): + """ + This call by metacanvas signals that the tool has been + activated and can now interact with metacanvas. + """ + self.activate_select(canvas) + self.is_animated = False + self._is_active = True + + def deactivate(self): + """ + This call by metacanvas signals that the tool has been + deactivated and can now interact with metacanvas. + """ + is_draw = self.aboard() + self._canvas.deactivate_tool() + self._canvas = None + self._is_active = False + return is_draw + # self.deactivate_select() + #self.is_animated = False + + def on_left_down(self, event): + if self.is_animated: + return self.end_animation(event) + else: + # this call will set self.last_coord + # and call self.on_execute_selection + # in case a suitable object has been selected + return self.on_left_down_select(event) + + def on_motion(self, event): + if self.is_animated: + return self.animate(event) + else: + return False + + def on_execute_selection(self, event): + """ + Definively execute operation on currently selected drawobjects. + """ + if self.is_tool_allowed_on_selection(): + if not self.is_animated: + return self.begin_animation(event) + else: + return self.end_animation(event) + else: + return False + + def on_change_selection(self, event): + """ + Called after selection has been changed with SHIFT-click + Do operation on currently selected drawobjects. + """ + return False + + def begin_animation(self, event): + # print 'Stretchtool.begin_animation' + self.drawobj_anim, _id, self.ind_vert = self.get_current_vertexselection() + + # print ' self.drawobj_anim, _id, self.ind_vert=',self.drawobj_anim, _id, self.ind_vert + #self.drawobj_anim, self.id_anim = drawobj.get_anim(_id) + self.drawobj_anim.begin_animation(_id) + self.coord_last = self._canvas.unproject(event.GetPosition()) + + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_CROSS)) + self.is_animated = True + return True # True for redrawing + + def end_animation(self, event): + #drawobj, _id = self.get_current_selection() + #drawobj.set_anim(_id, (self.drawobj_anim, self.id_anim)) + self.drawobj_anim.end_animation() + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) + + del self.drawobj_anim + #del self.id_anim + self.is_animated = False + + self.unselect_all() + return True # True for redrawing + + def animate(self, event): + # print 'animate' + is_draw = False + coords = self._canvas.unproject(event.GetPosition()) + vertex_delta = coords - self.coord_last + if np.any(np.abs(vertex_delta) > 0): + is_draw = self.drawobj_anim.stretch_animation( + coords, vertex_delta, self.ind_vert) + if is_draw: + self.coord_last = coords + return is_draw + + def aboard(self, event=None): + # print 'aboard',self.ident + + is_draw = False + if self.is_animated: + self.drawobj_anim.del_animation() + del self.drawobj_anim + self.is_animated = False + is_draw = True + + is_draw |= self.aboard_select(event) + return is_draw # True for redrawing + + +class DrawobjMixin(am.ArrayObjman): + + def init_common(self, ident, parent=None, name=None, + linewidth=1, + is_parentobj=False, + is_outline=True, # show outline + is_fill=False, + is_fillable=True, + n_vert=2, # number of vertex per draw object + c_highl=0.3, **kwargs): + + self._init_objman(ident, parent=parent, name=name, **kwargs) + + self._vbos = OrderedDict() + + self._n_vert = n_vert + + # ident of drawobject used for animations + self._ident_drawobj_anim = 'anim_lines' + + self.add(am.AttrConf('color_anim', np.array([0.9, 0.9, 0.9, 0.5], dtype=np.float32), + groupnames=['_private_'], + perm='rw', + metatype='color', + name='Anim. color', + is_save=True, + info='Color of animated object(s) in [r,g,b,a]', + )) + + # TODO: these 2 could be eliminated and replaced by function + # self._n_elem = 0# will be adjusted in update_vertexvbo + #self._n_elem_fill = 0# + + self.add(cm.AttrConf('_is_visible', True, + groupnames=['options'], + perm='wr', + is_save=True, + is_plugin=False, + name='Visible?', + info='If True, object are visible, otherwise it is not drwan.', + )) + + if is_fillable > 0: + # objects can potentially be filled + self.add(cm.AttrConf('_is_fill', is_fill, + groupnames=['_private'], + perm='wr', + is_save=True, + is_plugin=False, + name='Fill', + info='If True, object are filled.', + )) + self.add(cm.AttrConf('_is_outline', is_outline, + groupnames=['_private'], + perm='rw', + is_save=True, + is_plugin=False, + name='Outline', + info='If True, outline of object is shown.', + )) + + self.add_col(am.ArrayConf('colors_fill', np.zeros(4, dtype=np.float32), + dtype=np.float32, + groupnames=['options'], + perm='rw', + metatype='color', + name='Fill color', + is_save=True, + info='Object fill color with format [r,g,b,a]', + )) + + self.add_col(am.ArrayConf('colors_fill_highl', np.zeros(4, dtype=np.float32), + dtype=np.float32, + groupnames=['_private'], + perm='rw', + metatype='color', + name='Fill color highl', + is_save=False, + info='Object fill color when highlighting with format [r,g,b,a]', + )) + + else: + # no filling foreseen + self.add(cm.AttrConf('_is_fill', False, + groupnames=['_private'], + perm='r', + is_save=True, + is_plugin=False, + name='Filled', + info='If True, object is filled.', + )) + + self.add(cm.AttrConf('_is_outline', True, + groupnames=['_private'], + perm='r', + is_save=True, + is_plugin=False, + name='Outline', + info='If True, outline of object is shown.', + )) + if is_outline: + self.add_col(am.ArrayConf('colors', np.zeros(4, dtype=np.float32), + dtype=np.float32, + groupnames=['options'], + perm='rw', + metatype='color', + name='Color', + is_save=True, + info='Object Vertex color with format [r,g,b,a]', + )) + + self.add_col(am.ArrayConf('colors_highl', np.zeros(4, dtype=np.float32), + dtype=np.float32, + groupnames=['_private'], + perm='rw', + metatype='color', + name='Color highl', + is_save=False, + info='Added object color when highlighting with format [r,g,b,a]', + )) + + self.add(cm.AttrConf('linewidth', linewidth, + groupnames=['options'], + perm='wr', + is_save=True, + is_plugin=False, + name='Line width', + info='Line width in pixel', + )) + + # print + # 'init_common',self.format_ident(),self._is_fill.value,self._is_outline.value + + self.add(cm.AttrConf('c_highl', c_highl, + groupnames=['_private'], + perm='wr', + is_save=True, + is_plugin=False, + name='Highl. const.', + info='Highlight constant takes values beteewn 0 and 1 and is the amount of brightness added for highlighting', + )) + + self.add_col(am.ArrayConf('are_highlighted', False, + dtype=np.bool, + groupnames=['options'], + perm='rw', + name='highlighted', + is_save=False, + info='If true, object is highlighted', + )) + # self.add_col(am.ArrayConf( 'have_handles', False, + # dtype=np.bool, + # groupnames = ['options'], + # perm='rw', + # name = 'has handles', + # is_save = False, + # info = 'If true, object has handles', + # )) + + if is_parentobj: + self.add_col(am.IdsArrayConf('ids_parent', parent, + is_save=True, + name=parent.format_ident() + '[ID]', + info='ID of ' + + parent.get_name() + ' object.', + )) + + def get_vertices_array(self): + return self.vertices.value + + def get_vertices(self, ids): + return self.vertices[ids] + + def set_vertices(self, ids, vertices, is_update=True): + self.vertices[ids] = vertices + if is_update: + self._update_vertexvbo() + + def is_tool_allowed(self, tool, id_drawobj=-1): + """ + Returns True if this tool can be applied to this drawobj. + Optionally a particular drawobj can be specified with id_drawobj. + """ + # basic tools: + #tool.ident in 'configure','select_handles','delete','move','stretch' + return True + + def is_outline(self): + return self.is_outline.get_value() + + def is_fill(self): + return self._is_fill.get_value() + + def is_visible(self): + return self._is_visible.value + + def set_visible(self, is_visible): + self._is_visible.set_value(is_visible) + # print 'set_visible',self._is_visible.value + + def del_drawobj(self, _id, is_update=True): + self.del_row(_id) + if is_update: + self._update_vertexvbo() + self._update_colorvbo() + + def begin_animation(self, id_target): + # print 'begin_animation',id_target + # print ' self.vertices.value',self.vertices.value + # print ' ids',self.get_ids() + self._id_target = id_target + self._drawobj_anim = self.parent.get_drawobj_by_ident( + self._ident_drawobj_anim) + self.id_anim = self._drawobj_anim.add_drawobj(np.array(self.vertices[id_target]), + self.color_anim.value, + ) + # print 'begin_animation',self.ident,_id,self._drawobj_anim + return True + + def end_animation(self, is_del_last_vert=False): + # print 'end_animation',self.ident,self._id_target + # print ' verices =',self._drawobj_anim.vertices[self.id_anim] + self.set_vertices(self._id_target, self._drawobj_anim.get_vertices( + self.id_anim)) # .copy() + self.del_animation() + # self._drawobj_anim.del_drawobj(self.id_anim) + self._update_vertexvbo() + self._update_colorvbo() + return True + + def del_animation(self, is_del_main=False): + # print 'end_animation',self.ident,_id,self._drawobj_anim + self._drawobj_anim.del_drawobj(self.id_anim) + self._drawobj_anim = None + + if is_del_main: + self.del_drawobj(self._id_target) + + self.id_anim = -1 + return True + + def move_animation(self, vertex, vertex_delta): + + # if self.ident == 'polylines': + # print 'move_animation',self.ident,self._id_target, vertex_delta + # print ' before self._drawobj_anim.vertices[self.id_anim]',self._drawobj_anim.vertices[self.id_anim] + # ans = self._drawobj_anim.move(self.id_anim, vertex, vertex_delta) + # print ' after self._drawobj_anim.vertices[self.id_anim]',self._drawobj_anim.vertices[self.id_anim] + # return ans + # else: + return self._drawobj_anim.move(self.id_anim, vertex, vertex_delta) + + def get_id_anim(self): + return self._id_target + + def stretch_animation(self, vertex, vertex_delta, ind_vertex): + # print 'stretch',self.ident,_id + # print ' ',vertex,vertex_delta,ind_vertex + # if self.ident == 'polylines': + # print 'stretch_animation',self.ident,self._id_target, ind_vertex, vertex_delta + # print ' before self._drawobj_anim.vertices[self.id_anim]',self._drawobj_anim.vertices[self.id_anim] + # ans = self._drawobj_anim.stretch(self.id_anim,vertex, vertex_delta, ind_vertex) + # print ' after self._drawobj_anim.vertices[self.id_anim]',self._drawobj_anim.vertices[self.id_anim] + # return ans + # else: + return self._drawobj_anim.stretch(self.id_anim, vertex, vertex_delta, ind_vertex) + + def get_anim(self, _id): + drawobj_anim = self.parent.get_drawobj_by_ident('anim_lines') + + id_anim = drawobj_anim.add_drawobj(np.array(self.vertices[_id]), + [0.9, 0.9, 0.9, 0.5] + ) + # print 'get_anim',self.ident,_id,self.vertices[_id] + return drawobj_anim, id_anim + + def set_anim(self, _id, drawobjelem_anim): + # print 'set_anim',self.ident,_id,drawobjelem_anim + (drawobj_anim, id_anim) = drawobjelem_anim + # print ' self.vertices[_id]=',self.vertices[_id] + # print ' + # drawobj_anim.vertices[id_anim]=',drawobj_anim.vertices[id_anim] + self.vertices[_id] = drawobj_anim.vertices[id_anim] # .copy() + drawobj_anim.del_drawobj(id_anim) + self._update_vertexvbo() + return True + + def move(self, _id, vertex, vertex_delta): + # print 'move',self.ident,_id, vertex_delta + self.vertices[_id] += vertex_delta + # print ' vertices[id_anim]=',self.vertices[_id] + self._update_vertexvbo() + return True + + def stretch(self, _id, vertex, vertex_delta, ind_vertex): + # print 'stretch',self.ident,_id,ind_vertex + # print ' vertex_delta',vertex_delta + # print ' before vertices[_id]=',self.vertices[_id] + self.vertices[_id][ind_vertex] += vertex_delta + # print ' after vertices[_id]=',self.vertices[_id] + self._update_vertexvbo() + return True + + def add_vbo(self, vbo): + self._vbos[vbo.get_ident()] = vbo + + def get_vbo(self, ident): + return self._vbos[ident] + + def get_vbos(self): + return self._vbos.values() + + def del_vbo(self, key): + del self._vbos[key] + + def get_n_vert(self): + return self._n_vert + + def _get_colors_highl(self, colors): + return np.clip(colors + self.c_highl.value * np.ones(colors.shape, float), 0, 1) - colors + + def set_colors(self, ids, colors, colors_highl=None, is_update=True): + self.colors[ids] = colors + if colors_highl == None: + self.colors_highl[ids] = self._get_colors_highl(colors) + else: + self.colors_highl[ids] = colors_highl + if is_update: + self._update_colorvbo() + + def _update_colorvbo(self): + n = len(self) + if n == 0: + for _vbo in self.get_vbos(): + _vbo.destroy() + #n_vert = self.get_n_vert() + # print '_update_colorvbo fancyline' + + if self._is_outline.value: + colors = self.colors.value + \ + self.are_highlighted.value.reshape( + n, 1) * self.colors_highl.value + for _vbo in self.get_vbos(): + if not _vbo.is_fill(): + _vbo.update_colors(colors) + + if self._is_fill.value: + colors = self.colors_fill.value + \ + self.are_highlighted.value.reshape( + n, 1) * self.colors_fill_highl.value + for _vbo in self.get_vbos(): + if _vbo.is_fill(): + _vbo.update_colors(colors) + + def draw(self, resolution=1.0): + # print 'draw n=',id(self),self.ident,len(self),self._is_visible.value + if len(self) == 0: + return + if self._is_visible.value: + glLineWidth(self.linewidth.value) + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) + glEnable(GL_BLEND) + + # main drawing + glEnableClientState(GL_VERTEX_ARRAY) + glEnableClientState(GL_COLOR_ARRAY) + + # print 'draw',self.format_ident(), self._is_fill.value, + # self._is_outline.value + + for _vbo in self.get_vbos(): + _vbo.draw(resolution) + + # draw handles + glDisableClientState(GL_VERTEX_ARRAY) + glDisableClientState(GL_COLOR_ARRAY) + + def highlight(self, ids, is_update=True): + # print 'highlight=',self._inds[ids] + if len(ids) > 0: + self.are_highlighted.value[self._inds[ids]] = True + is_draw = True + else: + is_draw = False + + if is_update: + self._update_colorvbo() + + return is_draw + + def unhighlight(self, ids=None, is_update=True): + + if ids == None: + if np.any(self.are_highlighted.value): + # np.flatnonzero(self.are_highlighted.value) + inds_highl = self._inds + self.are_highlighted.value[:] = False + is_draw = True + else: + is_draw = False + else: + inds_highl = self._inds[ids] + if np.any(self.are_highlighted.value[inds_highl]): + self.are_highlighted.value[inds_highl] = False + is_draw = True + else: + is_draw = False + + # print 'unhighlight' , inds_highl + # print ' self.are_highlighted.value',self.are_highlighted.value + + if is_update: + self._update_colorvbo() + return is_draw + + def pick_handle(self, coord): + """ + Retuns list [ id, ind_vert] when handle is near coord, + otherwise [] + + """ + return [] + + +class Lines(DrawobjMixin): + + def __init__(self, ident, parent, name='Lines', + is_parentobj=False, + n_vert=2, # 2 verts for line draw obj + c_highl=0.3, + linewidth=3, + **kwargs): + + self.init_common(ident, parent=parent, name=name, + linewidth=linewidth, + is_parentobj=is_parentobj, + n_vert=n_vert, + c_highl=c_highl, + is_fillable=False, + **kwargs) + + # ident of drawobject used for animations + # must be defined AFTER init_common + self._ident_drawobj_anim = 'anim_lines' + + # 2 verts for OGL line element + self.add_vbo(Vbo('line', GL_LINES, 2, objtype='outline')) + + self.add_col(am.ArrayConf('vertices', np.zeros((n_vert, 3), dtype=np.float32), + dtype=np.float32, + groupnames=['_private'], + perm='rw', + name='Vertex', + unit='m', + is_save=True, + info='Vertex coordinate vectors of points. Example with 2 vertex: [[[x11,y11,z11],[x12,y12,z12]],[[x21,y21,z21],[x22,y22,z122]],...]', + )) + + def get_boundingbox(self): + if len(self) == 0: + return None + vv = self.get_vertices_array() # self.get_vertices.value + # TODOD: can be done faster + return np.array([[np.min(vv[:, :, 0]), np.min(vv[:, :, 1]), np.min(vv[:, :, 2])], + [np.max(vv[:, :, 0]), np.max( + vv[:, :, 1]), np.max(vv[:, :, 2])] + ], float) + + def add_drawobj(self, vertices, color, color_highl=None, is_update=True): + if color_highl == None: + colors_highl = self._get_colors_highl(np.array([color])) + + _id = self.add_row(vertices=vertices, + colors=color, + colors_highl=colors_highl[0], + ) + if is_update: + self._update_vertexvbo() + self._update_colorvbo() + return _id + + def add_drawobjs(self, vertices, colors, colors_highl=None, is_update=True): + if colors_highl == None: + colors_highl = self._get_colors_highl(colors) + + ids = self.add_rows(len(vertices), + vertices=vertices, + colors=colors, + colors_highl=colors_highl, + ) + if is_update: + self._update_vertexvbo() + self._update_colorvbo() + return ids + + def _update_vertexvbo(self): + self.get_vbo('line').update_vertices( + self.get_vertices_array().reshape((-1, 6)), len(self)) + + def _make_handlevbo(self, x, y, resolution): + # print '_get_handlevbo' + # print ' x =\n',x + # print ' y =\n',y + dx = resolution * 5.0 + dy = resolution * 5.0 + z = np.zeros(x.shape, dtype=np.float32) + n = len(z) + hvertices = np.concatenate((x - dx, y - dy, z, x + dx, y - dy, z, + x + dx, y + dy, z, x - dx, y + dy, z, ), 1).reshape(-1, 4, 3) + # print ' hvertices =\n',hvertices + self._vertexvbo_handles = vbo.VBO(hvertices.reshape((-1, 3))) + self._indexvbo_handles = vbo.VBO( + np.arange(4 * n, dtype=np.int32), target=GL_ELEMENT_ARRAY_BUFFER) + + colors = np.repeat( + np.array([[0.9, 0.8, 0.7, 0.5]], dtype=np.float32), n, 0) + self._colorvbo_handles = vbo.VBO( + colors[np.array(np.arange(0, n, 1.0 / 4), int)]) + + def pick(self, p, detectwidth=0.1): + """ + Returns a binary vector which is True values for lines that have been selected + by point p. + + In particular, an element of this vector is True if the minimum distance + between the respective line to point p is less than detectwidth + """ + # print 'pick',self.get_ident(),len(self) + if len(self) == 0: + return np.array([], np.int) + + vertices = self.get_vertices_array() + # print ' vertices',vertices + x1 = vertices[:, 0, 0] + y1 = vertices[:, 0, 1] + + x2 = vertices[:, 1, 0] + y2 = vertices[:, 1, 1] + + return self._ids[get_dist_point_to_segs(p, x1, y1, x2, y2, is_ending=True) < detectwidth**2] + + def pick_handle(self, coord, detectwidth=0.1): + """ + Retuns list [ id, ind_vert] when handle is near coord, + otherwise [] + + """ + # print 'pick_handle',self.get_ident(),len(self) + dw = detectwidth**2 + + if len(self) == 0: + return np.zeros((0, 2), np.int) + + if self.ident not in ['lines', 'fancylines']: + return np.zeros((0, 2), np.int) + + vertices = self.get_vertices_array() + handles = [] + # print ' vertices',vertices + # print ' vertices.shape',vertices.shape + dx = vertices[:, 0, 0] - coord[0] + dy = vertices[:, 0, 1] - coord[1] + + ids = self._ids[dx * dx + dy * dy < dw] + handle1 = np.ones((len(ids), 2), np.int) + handle1[:, 0] = ids + handle1[:, 1] = 0 + # print ' ',d,handle1 + + dx = vertices[:, 1, 0] - coord[0] + dy = vertices[:, 1, 1] - coord[1] + ids = self._ids[dx * dx + dy * dy < dw] + handle2 = np.ones((len(ids), 2), np.int) + handle2[:, 0] = ids + handle2[:, 1] = 1 + # print ' ',d,handle2 + handles = np.concatenate((handle1, handle2), 0) + + return handles + + def draw_old_handles(self, resolution=1.0): + # print 'draw n=',len(self) + glLineWidth(self.linewidth.value) + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) + glEnable(GL_BLEND) + + # main drawing + glEnableClientState(GL_VERTEX_ARRAY) + glEnableClientState(GL_COLOR_ARRAY) + + self._colorvbo.bind() + glColorPointer(4, GL_FLOAT, 0, None) + + self._vertexvbo.bind() + self._indexvbo.bind() + glVertexPointer(3, GL_FLOAT, 0, None) + + glDrawElements(GL_LINES, self._n_vert * + len(self), GL_UNSIGNED_INT, None) + + glDisableClientState(GL_VERTEX_ARRAY) + glDisableClientState(GL_COLOR_ARRAY) + self._vertexvbo.unbind() + self._indexvbo.unbind() + self._colorvbo.unbind() + + # draw handles + if 1: + vertices = self.vertices.value + x1 = vertices[:, 0, 0] + y1 = vertices[:, 0, 1] + + x2 = vertices[:, 1, 0] + y2 = vertices[:, 1, 1] + self._make_handlevbo( + x2.reshape(-1, 1), y2.reshape(-1, 1), resolution) + + glLineWidth(2) + glEnableClientState(GL_VERTEX_ARRAY) + glEnableClientState(GL_COLOR_ARRAY) + + self._colorvbo_handles.bind() + glColorPointer(4, GL_FLOAT, 0, None) + + self._vertexvbo_handles.bind() + self._indexvbo_handles.bind() + glVertexPointer(3, GL_FLOAT, 0, None) + + # GL_LINE_STRIP, GL_QUADS, GL_LINES, GL_LINE_LOOP, GL_POINTS + glDrawElements(GL_QUADS, 4 * len(self), GL_UNSIGNED_INT, None) + + glDisableClientState(GL_VERTEX_ARRAY) + glDisableClientState(GL_COLOR_ARRAY) + self._vertexvbo_handles.unbind() + self._indexvbo_handles.unbind() + self._colorvbo_handles.unbind() + + +class Fancylines(Lines): + + def __init__(self, ident, parent, name='Fancy lines', + is_parentobj=False, + is_fill=True, + is_outline=False, # currently only fill implemented + arrowstretch=2.5, + arrowlength=0.5, + is_lefthalf=True, + is_righthalf=True, + c_highl=0.3, + linewidth=3, + **kwargs): + + self.init_common(ident, parent=parent, name=name, + linewidth=linewidth, # for outline only + is_parentobj=is_parentobj, + is_fill=is_fill, + is_outline=is_outline, + n_vert=3, # vertex points for ending + c_highl=c_highl, + **kwargs) + + # ident of drawobject used for animations + # must be defined AFTER init_common + self._ident_drawobj_anim = 'anim_fancylines' + + # if is_outline: + # self.add_vbo(Vbo('outline',GL_LINES,2, noncyclic = 0)) + + if is_fill: + self.add_vbo(Vbo('line_fill', GL_QUADS, 4, objtype='fill')) + for style in LINEHEADS.keys(): + self.add_vbo(Vbo(('begin', 'fill', style), + GL_TRIANGLES, 3, objtype='fill')) + self.add_vbo(Vbo(('end', 'fill', style), + GL_TRIANGLES, 3, objtype='fill')) + + self.add(cm.AttrConf('arrowstretch', arrowstretch, + groupnames=['options'], + perm='wr', + is_save=True, + is_plugin=False, + name='Arrow stretch', + info='Arrow stretch factor.', + )) + + # self.add(cm.AttrConf( 'arrowlength', arrowlength, + # groupnames = ['options'], + # perm='wr', + # is_save = True, + # is_plugin = False, + # name = 'Arrow length', + # info = 'Arrow length.', + # )) + + self.add(cm.AttrConf('is_lefthalf', is_lefthalf, + groupnames=['options'], + perm='wr', + is_save=True, + is_plugin=False, + name='Show left', + info='Show left half of line.', + )) + + self.add(cm.AttrConf('is_righthalf', is_righthalf, + groupnames=['options'], + perm='wr', + is_save=True, + is_plugin=False, + name='Show right', + info='Show right half of line.', + )) + + self.add_col(am.ArrayConf('beginstyles', 0, + groupnames=['options'], + perm='rw', + choices=LINEHEADS, + is_save=True, + is_plugin=False, + name='Begin style', + info='Style of the line extremity at the beginning.', + )) + + self.add_col(am.ArrayConf('endstyles', 0, + groupnames=['options'], + perm='rw', + choices=LINEHEADS, + is_save=True, + is_plugin=False, + name='End style', + info='Style of the line extremity at the ending.', + )) + + self.add_col(am.ArrayConf('vertices', np.zeros((2, 3), dtype=np.float32), + dtype=np.float32, + groupnames=['_private'], + perm='rw', + name='Vertex', + unit='m', + is_save=True, + info='Vertex coordinate vectors of points. Example with 2 vertex: [[[x11,y11,z11],[x12,y12,z12]],[[x21,y21,z21],[x22,y22,z122]],...]', + )) + + self.add_col(am.ArrayConf('widths', 0.5, + dtype=np.float32, + groupnames=['option'], + perm='rw', + name='Width', + unit='m', + is_save=True, + info='Line width', + )) + + def add_drawobj(self, vertices, width, color, color_highl=None, + beginstyle=None, + endstyle=None, + is_update=True): + # print 'Fancylines.add_drawobj' + if color_highl == None: + color_highl = self._get_colors_highl(np.array([color]))[0] + + # print ' ids',self.get_ids() + _id = self.add_row(vertices=vertices, + widths=width, + colors=color, + colors_highl=color_highl, + colors_fill=color, + colors_fill_highl=color_highl, + beginstyles=beginstyle, + endstyles=endstyle, + + ) + if is_update: + self._update_vertexvbo() + self._update_colorvbo() + return _id + + def add_drawobjs(self, vertices, widths, colors, colors_highl=None, + beginstyles=None, endstyles=None, + is_update=True): + + if colors_highl == None: + colors_highl = self._get_colors_highl(colors) + + n = len(vertices) + if beginstyles == None: + beginstyles = np.zeros(n) + if endstyles == None: + endstyles = np.zeros(n) + ids = self.add_rows(len(vertices), + vertices=vertices, + widths=widths, + colors=colors, + colors_highl=colors_highl, + colors_fill=colors, + colors_fill_highl=colors_highl, + beginstyles=beginstyles, + endstyles=endstyles, + ) + if is_update: + self._update_vertexvbo() + self._update_colorvbo() + return ids + + def begin_animation(self, id_target): + + self._id_target = id_target + self._drawobj_anim = self.parent.get_drawobj_by_ident( + self._ident_drawobj_anim) + self.id_anim = self._drawobj_anim.add_drawobj(np.array(self.get_vertices(id_target)), + 1.0 * + self.get_widths( + id_target), + self.color_anim.value, + beginstyle=self.beginstyles[ + id_target], + endstyle=self.endstyles[ + id_target], + ) + # print 'begin_animation',self.ident,_id,self._drawobj_anim + return True + + def get_widths_array(self): + return self.widths.value + + def get_widths(self, ids): + return self.widths[ids] + + def set_widths(self, ids, values): + self.widths[ids] = values + + def _update_vertexvbo(self): + # print '_update_vertexvbo',self.format_ident() + + vertices = self.get_vertices_array() + x1 = vertices[:, 0, 0] + y1 = vertices[:, 0, 1] + z1 = vertices[:, 0, 2] + + x2 = vertices[:, 1, 0] + y2 = vertices[:, 1, 1] + z2 = vertices[:, 1, 2] + dx = x2 - x1 + dy = y2 - y1 + alpha_xy = np.arctan2(dy, dx) + length_xy = np.sqrt(dx * dx + dy * dy) + halfwidth = 0.5 * self.get_widths_array() + x1_new = x1.copy() + y1_new = y1.copy() + x2_new = x2.copy() + y2_new = y2.copy() + # print ' origvert' + # print ' x1_new=',x1_new,x1_new.dtype + # print ' x2_new=',x2_new,x2_new.dtype + if self._is_fill.value: + for style, id_style in LINEHEADS.iteritems(): + + # begin + inds_style = np.flatnonzero(self.beginstyles.value == id_style) + + if len(inds_style) > 0: + + # print ' style',style,len(inds_style) + # print ' x1_new=',x1_new,x1_new.dtype + # print ' x2_new=',x2_new,x2_new.dtype + self._update_vertexvbo_begin_fill( + style, inds_style, x1_new, y1_new, z1, x2, y2, z2, length_xy, alpha_xy, halfwidth) + + # end + inds_style = np.flatnonzero(self.endstyles.value == id_style) + if len(inds_style) > 0: + self._update_vertexvbo_end_fill( + style, inds_style, x1, y1, z1, x2_new, y2_new, z2, length_xy, alpha_xy, halfwidth) + + self._update_vertexvbo_line_fill( + x1_new, y1_new, z1, x2_new, y2_new, z2, length_xy, alpha_xy, halfwidth, len(self)) + + def _update_vertexvbo_line_fill(self, x1, y1, z1, x2, y2, z2, length_xy, alpha_xy, halfwidth, n): + # print '_update_vertexvbo_line_fill' + # this allows different color indexing for polyline + # TODO n + # if inds_colors == None: + #n = len(self) + # else: + # n = None + + #n_vert = self.get_n_vert() + #dphi = np.pi/(n_vert-1) + + #beta = alpha_xy+np.pi/2 + # print ' alpha_xy\n',alpha_xy/np.pi*180 + # print ' halfwidth\n',halfwidth + # print ' x1\n',x1 + # print ' length_xy=',length_xy + # print ' length_xy-self.widths.value=',(length_xy-self.widths.value) + + # self.is_righthalf.value + xr1 = x1 + self.is_lefthalf.value * \ + halfwidth * np.cos(alpha_xy + np.pi / 2) + yr1 = y1 + self.is_lefthalf.value * \ + halfwidth * np.sin(alpha_xy + np.pi / 2) + + xr2 = x2 + self.is_lefthalf.value * \ + halfwidth * np.cos(alpha_xy + np.pi / 2) + yr2 = y2 + self.is_lefthalf.value * \ + halfwidth * np.sin(alpha_xy + np.pi / 2) + + xr3 = x2 + self.is_righthalf.value * \ + halfwidth * np.cos(alpha_xy - np.pi / 2) + yr3 = y2 + self.is_righthalf.value * \ + halfwidth * np.sin(alpha_xy - np.pi / 2) + + xr4 = x1 + self.is_righthalf.value * \ + halfwidth * np.cos(alpha_xy - np.pi / 2) + yr4 = y1 + self.is_righthalf.value * \ + halfwidth * np.sin(alpha_xy - np.pi / 2) + + # print '_update_vertexvbo ',n,n_vert,self._is_fill.value + # print ' x\n',x + # print ' y\n',y + # print ' z\n',z + n_vpe = 4 + vertices = np.zeros((len(xr1), n_vpe * 3), dtype=np.float32) + + vertices[:, 0] = xr1 + vertices[:, 1] = yr1 + vertices[:, 2] = z1 + + vertices[:, 3] = xr2 + vertices[:, 4] = yr2 + vertices[:, 5] = z2 + + vertices[:, 6] = xr3 + vertices[:, 7] = yr3 + vertices[:, 8] = z2 + + vertices[:, 9] = xr4 + vertices[:, 10] = yr4 + vertices[:, 11] = z1 + + # print ' vertices=\n',vertices + self.get_vbo('line_fill').update_vertices(vertices, n) + + #self._vertexvbo_fill = vbo.VBO(vertices.reshape((-1,3))) + #self._indexvbo_fill = vbo.VBO(np.arange(self._n_vert*self._n_elem_fill, dtype=np.int32), target=GL_ELEMENT_ARRAY_BUFFER) + + def _update_vertexvbo_begin_fill(self, style, inds_style, x1_new, y1_new, z1, x2, y2, z2, length_xy, alpha_xy, halfwidth): + ident_vbo = ('begin', 'fill', style) + headvbo = self.get_vbo(ident_vbo) + # print '_update_vertexvbo_begin_fill' + + n = len(inds_style) + alphastretch = 1.0 + n_vert = 6 + if style == 'bevel': + n_vert = 6 + arrowstretch = 1.0 + + if style == 'triangle': + n_vert = 3 + arrowstretch = self.arrowstretch.value + + if style == 'arrow': + n_vert = 3 + alphastretch = 1.2 + arrowstretch = self.arrowstretch.value + radius = arrowstretch * halfwidth[inds_style] + if style != 'bevel': + x1_new[inds_style] = x2[inds_style] - \ + (length_xy[inds_style] - radius) * np.cos(alpha_xy[inds_style]) + y1_new[inds_style] = y2[inds_style] - \ + (length_xy[inds_style] - radius) * np.sin(alpha_xy[inds_style]) + + # print ' x1_new=',x1_new,x1_new.dtype,halfwidth[inds_style] + # print ' y1_new=',y1_new,y1_new.dtype + + if self.is_righthalf.value: + alpha_end = np.pi / 2 + else: + n_vert = int(0.5 * n_vert + 0.5) + alpha_end = 0.0 + + if self.is_lefthalf.value: + alpha_start = -np.pi / 2 + else: + n_vert = int(0.5 * n_vert + 0.5) + alpha_start = 0.0 + + dphi = (alpha_end - alpha_start) / (n_vert - 1) + alphas = alpha_xy[inds_style] + (alphastretch * np.arange( + alpha_start, alpha_end + dphi, dphi) + np.pi).reshape(-1, 1) + + # print ' alpha_xy\n',alpha_xy/np.pi*180 + # print ' alphas=alpha0+phi\n',alphas/np.pi*180 + + x = np.cos(alphas) * radius + x1_new[inds_style] + y = np.sin(alphas) * radius + y1_new[inds_style] + + z = np.ones((n_vert, 1)) * z1[inds_style] + + # print '_update_vertexvbo ',n,n_vert,self._is_fill.value + # print ' x\n',x + # print ' y\n',y + # print ' z\n',z + + # print '_update_vertexvbo_fill',n,len(x),n_vert,self._n_vpe_fill + xf = x.transpose().flatten() # +0.5 + yf = y.transpose().flatten() # +0.5 + zf = z.transpose().flatten() + xcf = (np.ones((n_vert, 1)) * x1_new[inds_style]).transpose().flatten() + ycf = (np.ones((n_vert, 1)) * y1_new[inds_style]).transpose().flatten() + # print ' xcf\n',xcf + # print ' ycf\n',ycf + + # create and compose main vertices array + n_elem_fill = (n_vert - 1) * n + + n_vpe = headvbo.get_vpe() + # print ' n_elem_fill ',self._n_elem_fill + # print ' n_vpe',n_vpe + vertices = np.zeros((n_elem_fill, n_vpe * 3), dtype=np.float32) + # print ' vertices.reshape((-1,3)).shape',vertices.reshape((-1,3)).shape + #zf = z.transpose().flatten() + + ind = np.arange(0, n * n_vert).reshape(n, n_vert)[:, :-1].flatten() + + vertices[:, 0] = xf[ind] + vertices[:, 1] = yf[ind] + vertices[:, 2] = zf[ind] + + vertices[:, 3] = xcf[ind] + vertices[:, 4] = ycf[ind] + vertices[:, 5] = zf[ind] + + ind2 = np.arange(0, n * n_vert).reshape(n, n_vert)[:, 1:].flatten() + vertices[:, 6] = xf[ind2] + vertices[:, 7] = yf[ind2] + vertices[:, 8] = zf[ind2] + # print ' vertices=\n',vertices + headvbo.update_vertices(vertices, inds=inds_style) + + #self._vertexvbo_fill = vbo.VBO(vertices.reshape((-1,3))) + #self._indexvbo_fill = vbo.VBO(np.arange(self._n_vert*self._n_elem_fill, dtype=np.int32), target=GL_ELEMENT_ARRAY_BUFFER) + + def _update_vertexvbo_end_fill(self, style, inds_style, x1, y1, z1, x2_new, y2_new, z2, length_xy, alpha_xy, halfwidth): + ident_vbo = ('end', 'fill', style) + headvbo = self.get_vbo(ident_vbo) + # print '_update_vertexvbo_end_fill',style + + n = len(inds_style) + alphastretch = 1.0 + n_vert = 6 + arrowstretch = 1.0 + if style == 'bevel': + n_vert = 6 + + if style == 'triangle': + n_vert = 3 + arrowstretch = self.arrowstretch.value + + if style == 'arrow': + n_vert = 3 + alphastretch = 1.2 + arrowstretch = self.arrowstretch.value + radius = arrowstretch * halfwidth[inds_style] + + if style != 'bevel': + x2_new[inds_style] = x1[inds_style] + \ + (length_xy[inds_style] - radius) * np.cos(alpha_xy[inds_style]) + y2_new[inds_style] = y1[inds_style] + \ + (length_xy[inds_style] - radius) * np.sin(alpha_xy[inds_style]) + + if self.is_lefthalf.value: + alpha_end = np.pi / 2 + else: + n_vert = int(0.5 * n_vert + 0.5) + alpha_end = 0.0 + + if self.is_righthalf.value: + alpha_start = -np.pi / 2 + else: + n_vert = int(0.5 * n_vert + 0.5) + alpha_start = 0.0 + + dphi = (alpha_end - alpha_start) / (n_vert - 1) + alphas = alpha_xy[inds_style] + alphastretch * \ + np.arange(alpha_start, alpha_end + dphi, dphi).reshape(-1, 1) + + dphi = np.pi / (n_vert - 1) + + # print ' alpha_xy\n',alpha_xy/np.pi*180 + # print ' alphas=alpha0+phi\n',alphas/np.pi*180 + # print ' n_vert',n_vert,dphi/np.pi*180 + + # print ' length_xy=',length_xy + # print ' length_xy-self.widths.value=',(length_xy-self.widths.value) + # print ' x2=',x2,x2.dtype + + # print ' y2_new=',y2_new,y2_new.dtype + x = np.cos(alphas) * radius + x2_new[inds_style] + y = np.sin(alphas) * radius + y2_new[inds_style] + + z = np.ones((n_vert, 1)) * z2[inds_style] + + # print '_update_vertexvbo ',n,n_vert,self._is_fill.value + # print ' x\n',x + # print ' y\n',y + # print ' z\n',z + + # print '_update_vertexvbo_fill',n,len(x),n_vert,self._n_vpe_fill + xf = x.transpose().flatten() # +0.5 + yf = y.transpose().flatten() # +0.5 + zf = z.transpose().flatten() + xcf = (np.ones((n_vert, 1)) * x2_new[inds_style]).transpose().flatten() + ycf = (np.ones((n_vert, 1)) * y2_new[inds_style]).transpose().flatten() + # print ' xcf\n',xcf + # print ' ycf\n',ycf + + # create and compose main vertices array + n_elem_fill = (n_vert - 1) * n + + n_vpe = headvbo.get_vpe() + # print ' n_elem_fill ',self._n_elem_fill + # print ' n_vpe',n_vpe + vertices = np.zeros((n_elem_fill, n_vpe * 3), dtype=np.float32) + # print ' vertices.reshape((-1,3)).shape',vertices.reshape((-1,3)).shape + #zf = z.transpose().flatten() + + ind = np.arange(0, n * n_vert).reshape(n, n_vert)[:, :-1].flatten() + + vertices[:, 0] = xf[ind] + vertices[:, 1] = yf[ind] + vertices[:, 2] = zf[ind] + + vertices[:, 3] = xcf[ind] + vertices[:, 4] = ycf[ind] + vertices[:, 5] = zf[ind] + + ind2 = np.arange(0, n * n_vert).reshape(n, n_vert)[:, 1:].flatten() + vertices[:, 6] = xf[ind2] + vertices[:, 7] = yf[ind2] + vertices[:, 8] = zf[ind2] + # print ' vertices=\n',vertices + headvbo.update_vertices(vertices, inds=inds_style) + + #self._vertexvbo_fill = vbo.VBO(vertices.reshape((-1,3))) + #self._indexvbo_fill = vbo.VBO(np.arange(self._n_vert*self._n_elem_fill, dtype=np.int32), target=GL_ELEMENT_ARRAY_BUFFER) + + def pick(self, p, detectwidth=0.1): + """ + Returns a binary vector which is True values for lines that have been selected + by point p. + + """ + # print 'pick' + if len(self) == 0: + return np.array([], np.int) + + vertices = self.get_vertices_array() + x1 = vertices[:, 0, 0] + y1 = vertices[:, 0, 1] + + x2 = vertices[:, 1, 0] + y2 = vertices[:, 1, 1] + + # print ' x1', x1 + # print ' x2', x2 + dw = 0.5 * (self.get_widths_array() + detectwidth) + return self._ids[get_dist_point_to_segs(p, x1, y1, x2, y2, is_ending=True) < dw * dw] + + +class Polylines(Fancylines): + + def __init__(self, ident, parent, name='Polylines', joinstyle=FLATHEAD, **kwargs): + Fancylines.__init__(self, ident, parent, name=name, **kwargs) + + # ident of drawobject used for animations + # must be defined AFTER init_common + self._ident_drawobj_anim = 'anim_polylines' + + # FLATHEAD = 0 + # BEVELHEAD = 1 + self.add(cm.AttrConf('joinstyle', joinstyle, + groupnames=['options'], + perm='rw', + is_save=True, + is_plugin=False, + name='Joinstyle', + info='Joinstyle of line segments.', + )) + + self.delete('vertices') + self.add_col(am.ListArrayConf('vertices', + # None, + # dtype=np.object, + groupnames=['_private'], + perm='rw', + name='Vertex', + unit='m', + is_save=True, + info='Vertex coordinate vectors of points. Example with 2 vertex: [[[x11,y11,z11],[x12,y12,z12]],[[x21,y21,z21],[x22,y22,z122]],...]', + )) + + def begin_animation(self, id_target): + + self._id_target = id_target + self._drawobj_anim = self.parent.get_drawobj_by_ident( + self._ident_drawobj_anim) + + self.id_anim = self._drawobj_anim.add_drawobj(self.get_vertices(id_target), + 1.0 * + self.get_widths( + id_target), + self.color_anim.value, + beginstyle=self.beginstyles[ + id_target], + endstyle=self.endstyles[ + id_target], + ) + # print 'begin_animation',self.ident,id_target,self._drawobj_anim + # print ' vert=',self.vertices[id_target] + return True + + def append_vert_to_animation(self, vert): + # print 'append_vert_to_animation',vert, type(vert) + # for _id in self.get_ids(): + # print ' main.vertices',_id,self.vertices[_id], type(self.vertices[_id]) + # for _id in self._drawobj_anim.get_ids(): + # print ' anim.vertices',_id,self._drawobj_anim.vertices[_id], + # type(self._drawobj_anim.vertices[_id]) + + self._drawobj_anim.get_vertices(self.id_anim).append(vert) + # print ' vertices',self._drawobj_anim.vertices[self.id_anim],type(self._drawobj_anim.vertices[self.id_anim]) + #vertices = self._drawobj_anim.vertices[self.id_anim] + # vertices.append(vert) + # self._drawobj_anim.vertices[self.id_anim]= + # vertices#list(np.array(vertices,np.float32)) + + # print ' vertices',vertices,type(vertices) + # print ' + # self._drawobj_anim.vertices[self.id_anim]',self._drawobj_anim.vertices[self.id_anim],type(self._drawobj_anim.vertices[self.id_anim]) + self._drawobj_anim._update_vertexvbo() + self._drawobj_anim._update_colorvbo() + # vertex ind of next + return len(self._drawobj_anim.get_vertices(self.id_anim)) - 1 + + def end_animation(self, is_del_last_vert=False): + # print 'end_animation',self.ident,self._id_target + # print ' verices =',self._drawobj_anim.vertices[self.id_anim] + if is_del_last_vert: + # cut of last one because duplicated after adding + self.set_vertices( + self._id_target, self._drawobj_anim.get_vertices(self.id_anim)[:-1]) + else: + self.set_vertices( + self._id_target, self._drawobj_anim.get_vertices(self.id_anim)) + + self.del_animation() + # self._drawobj_anim.del_drawobj(self.id_anim) + self._update_vertexvbo() + self._update_colorvbo() + return True + + def _make_lines(self): + n_lines_tot = 0 + for polyline in self.get_vertices_array(): + n_lines_tot += len(polyline) - 1 + + linevertices = np.zeros((n_lines_tot, 2, 3), np.float32) + vertexinds = np.zeros((n_lines_tot, 2), np.int32) + + polyinds = np.zeros(n_lines_tot, np.int32) + linebeginstyles = np.zeros(n_lines_tot, np.int32) + lineendstyles = np.zeros(n_lines_tot, np.int32) + + beginstyles = self.beginstyles.value + endstyles = self.endstyles.value + joinstyle = self.joinstyle.value + ind = 0 + ind_line = 0 + for polyline in self.get_vertices_array(): + # print ' =======',len(polyline) + n_seg = len(polyline) + # print ' polyline\n',polyline + + if n_seg > 1: + polyvinds = range(n_seg) + # print ' polyvinds\n',polyvinds + vi = np.zeros((2 * n_seg - 2), np.int32) + vi[0] = polyvinds[0] + vi[-1] = polyvinds[-1] + + # Important type conversion!! + v = np.zeros((2 * n_seg - 2, 3), np.float32) + v[0] = polyline[0] + v[-1] = polyline[-1] + if len(v) > 2: + v[1:-1] = np.repeat(polyline[1:-1], 2, 0) + vi[1:-1] = np.repeat(polyvinds[1:-1], 2) + + n_lines = len(v) / 2 + # print ' v\n',v + inds_polyline = range(ind_line, ind_line + n_lines) + + polyinds[inds_polyline] = ind + + linebeginstyles[inds_polyline] = joinstyle + linebeginstyles[inds_polyline[0]] = beginstyles[ind] + + lineendstyles[inds_polyline] = joinstyle + lineendstyles[inds_polyline[-1]] = endstyles[ind] + + linevertices[inds_polyline] = v.reshape((-1, 2, 3)) + vertexinds[inds_polyline] = vi.reshape((-1, 2)) + + ind_line += n_lines + else: + # empty polygon treatment + pass + + # print ' linevertex\n',linevertices + ind += 1 + + self._linevertices = linevertices + self._polyinds = polyinds + self._vertexinds = vertexinds + self._linebeginstyles = linebeginstyles + self._lineendstyles = lineendstyles + + def _update_vertexvbo(self): + # print '_update_vertexvbo',self.ident + self._make_lines() + vertices = self._linevertices + x1 = vertices[:, 0, 0] + y1 = vertices[:, 0, 1] + z1 = vertices[:, 0, 2] + + x2 = vertices[:, 1, 0] + y2 = vertices[:, 1, 1] + z2 = vertices[:, 1, 2] + dx = x2 - x1 + dy = y2 - y1 + alpha_xy = np.arctan2(dy, dx) + length_xy = np.sqrt(dx * dx + dy * dy) + halfwidth = 0.5 * self.get_widths_array()[self._polyinds] + # if self.ident =='lanedraws': + # print '_update_vertexvbo',self.ident + # print ' halfwidth',halfwidth + # print ' x1',x1 + # print ' y1',y1 + + x1_new = x1.copy() + y1_new = y1.copy() + x2_new = x2.copy() + y2_new = y2.copy() + # print ' origvert' + # print ' x1_new=',x1_new,x1_new.dtype + # print ' x2_new=',x2_new,x2_new.dtype + if self._is_fill.value: + for style, id_style in LINEHEADS.iteritems(): + + # begin + inds_style = np.flatnonzero(self._linebeginstyles == id_style) + + if len(inds_style) > 0: + + # print ' style',style,len(inds_style) + # print ' x1_new=',x1_new,x1_new.dtype + # print ' x2_new=',x2_new,x2_new.dtype + self._update_vertexvbo_begin_fill( + style, inds_style, x1_new, y1_new, z1, x2, y2, z2, length_xy, alpha_xy, halfwidth) + + # end + inds_style = np.flatnonzero(self._lineendstyles == id_style) + if len(inds_style) > 0: + self._update_vertexvbo_end_fill( + style, inds_style, x1, y1, z1, x2_new, y2_new, z2, length_xy, alpha_xy, halfwidth) + + self._update_vertexvbo_line_fill( + x1_new, y1_new, z1, x2_new, y2_new, z2, length_xy, alpha_xy, halfwidth, len(vertices)) + + def _update_colorvbo(self): + n = len(self._polyinds) + #n_vert = self.get_n_vert() + # print '_update_colorvbo fancyline' + #self._linecolors = np.array(linecolors, np.float32) + #self._linecolors_highl = np.array(linecolors_highl, np.float32) + if self._is_outline.value: + colors = self.colors.value[self._polyinds] + self.are_highlighted.value[ + self._polyinds].reshape(n, 1) * self.colors_highl.value[self._polyinds] + for _vbo in self.get_vbos(): + if not _vbo.is_fill(): + _vbo.update_colors(colors) + + if self._is_fill.value: + colors = self.colors_fill.value[self._polyinds] + self.are_highlighted.value[ + self._polyinds].reshape(n, 1) * self.colors_fill_highl.value[self._polyinds] + for _vbo in self.get_vbos(): + if _vbo.is_fill(): + _vbo.update_colors(colors) + + def pick(self, p, detectwidth=0.1): + """ + Returns a binary vector which is True values for lines that have been selected + by point p. + + In particular, an element of this vector is True if the minimum distance + between the respective line to point p is less than detectwidth + """ + # print 'pick' + if len(self) == 0: + return np.array([], np.int) + + vertices = self._linevertices + x1 = vertices[:, 0, 0] + y1 = vertices[:, 0, 1] + + x2 = vertices[:, 1, 0] + y2 = vertices[:, 1, 1] + + # print ' x1', x1 + # print ' x2', x2 + halfwidths = 0.5 * (self.get_widths_array() + [self._polyinds] + detectwidth) + return self._ids[self._polyinds[get_dist_point_to_segs(p, x1, y1, x2, y2, is_ending=True) < halfwidths * halfwidths]] + + def pick_handle(self, coord, detectwidth=0.1): + """ + Retuns list [ id, ind_vert] when handle is near coord, + otherwise [] + + """ + # print 'pick_handle',self.get_ident(),len(self) + dw = detectwidth**2 + + if len(self) == 0: + return np.zeros((0, 2), np.int) + + # if self.ident not in [ 'lines','fancylines','polylines']: + # return np.zeros((0,2),np.int) + + vertices = self._linevertices # self.get_vertices_array() + handles = [] + # print ' vertices',vertices + # print ' vertices.shape',vertices.shape + dx = vertices[:, 0, 0] - coord[0] + dy = vertices[:, 0, 1] - coord[1] + inds = np.flatnonzero(dx * dx + dy * dy < dw) + + ids = self._ids[self._polyinds[inds]] + handle1 = np.ones((len(ids), 2), np.int) + handle1[:, 0] = ids + handle1[:, 1] = self._vertexinds[inds, 0] + # print ' ',d,handle1 + + dx = vertices[:, 1, 0] - coord[0] + dy = vertices[:, 1, 1] - coord[1] + inds = np.flatnonzero(dx * dx + dy * dy < dw) + ids = self._ids[self._polyinds[inds]] + handle2 = np.ones((len(ids), 2), np.int) + handle2[:, 0] = ids + handle2[:, 1] = self._vertexinds[inds, 1] + # print ' ',d,handle2 + handles = np.concatenate((handle1, handle2), 0) + + return handles + + def get_boundingbox(self): + if len(self) == 0: + return None + vv = self._linevertices + # TODOD: can be done faster + return np.array([[np.min(vv[:, :, 0]), np.min(vv[:, :, 1]), np.min(vv[:, :, 2])], + [np.max(vv[:, :, 0]), np.max( + vv[:, :, 1]), np.max(vv[:, :, 2])] + ], float) + + +class Circles(DrawobjMixin): + + def __init__(self, ident, parent, name='Circles', + is_parentobj=False, + is_fill=True, # Fill objects, + is_outline=True, # show outlines + c_highl=0.3, + n_vert=7, # default number of vertex per circle + linewidth=2, + **kwargs): + + self.init_common(ident, parent=parent, name=name, + linewidth=linewidth, + is_parentobj=is_parentobj, + n_vert=n_vert, + is_fill=is_fill, + is_outline=is_outline, + c_highl=c_highl, + **kwargs) + # ident of drawobject used for animations + # must be defined AFTER init_common + self._ident_drawobj_anim = 'anim_circles' + + if is_outline: + self.add_vbo(Vbo('outline', GL_LINES, 2, objtype='outline')) + if is_fill: + self.add_vbo(Vbo('fill', GL_TRIANGLES, 3, objtype='fill')) + + self.add_col(am.ArrayConf('centers', np.zeros(3, dtype=np.float32), + dtype=np.float32, + groupnames=['_private'], + perm='rw', + name='Center', + unit='m', + is_save=True, + info='Center coordinate. Example: [x,y,z]', + )) + + self.add_col(am.ArrayConf('radii', 1.0, + dtype=np.float32, + groupnames=['_private'], + perm='rw', + name='Radius', + is_save=True, + info='Circle radius', + )) + + def is_tool_allowed(self, tool, id_drawobj=-1): + """ + Returns True if this tool can be applied to this drawobj. + Optionally a particular drawobj can be specified with id_drawobj. + """ + # basic tools: + # return tool.ident not in + # ['configure','select_handles','delete','move','stretch'] + return True + + def get_centers_array(self): + return self.centers.value + + def get_radii_array(self): + return self.radii.value + + def get_boundingbox(self): + if len(self) == 0: + return None + vv = self.get_centers_array() + rad = self.get_radii_array() + # TODOD: can be done faster + return np.array([[np.min(vv[:, 0] - rad), np.min(vv[:, 1] - rad), np.min(vv[:, 2])], + [np.max(vv[:, 0] + rad), + np.max(vv[:, 1] + rad), np.max(vv[:, 2])] + ], float) + + def add_drawobj(self, center, radius, + color, color_fill=None, + color_highl=None, color_fill_highl=None, + is_update=True): + + if color_fill == None: + color_fill = color + + if color_highl == None: + color_highl = self._get_colors_highl(np.array([color]))[0] + + if color_fill_highl == None: + color_fill_highl = self._get_colors_highl( + np.array([color_fill]))[0] + + _id = self.add_row(centers=center, + radii=radius, + colors=color, + colors_highl=color_highl, + colors_fill=color_fill, + colors_fill_highl=color_fill_highl, + ) + if is_update: + self._update_vertexvbo() + self._update_colorvbo() + return _id + + def add_drawobjs(self, centers, radii, + colors, colors_fill=None, + colors_highl=None, colors_fill_highl=None, + is_update=True): + # print + # 'Circles.add_drawobjs',self._is_fill.value,self._is_outline.value + if colors_fill == None: + colors_fill = colors + + if colors_highl == None: + colors_highl = self._get_colors_highl(colors) + + if colors_fill_highl == None: + colors_fill_highl = self._get_colors_highl(colors_fill) + + # print ' colors',colors[:2] + # print ' colors_highl',colors_highl[:2] + + ids = self.add_rows(len(centers), + centers=centers, + radii=radii, + colors=colors, + colors_highl=colors_highl, + colors_fill=colors_fill, + colors_fill_highl=colors_fill_highl, + ) + if is_update: + self._update_vertexvbo() + self._update_colorvbo() + return ids + + def begin_animation(self, id_target): + + self._id_target = id_target + self._drawobj_anim = self.parent.get_drawobj_by_ident( + self._ident_drawobj_anim) + self.id_anim = self._drawobj_anim.add_drawobj(np.array(self.centers[id_target]), + 1.0 * + self.radii[id_target], + self.color_anim.value, + ) + # print 'begin_animation',self.ident,_id,self._drawobj_anim + return True + + def set_anim(self, _id, drawobjelem_anim): + # print 'set_anim',self.ident,_id,drawobj_anim + (drawobj_anim, id_anim) = drawobjelem_anim + # print ' self.vertices[_id]=',self.vertices[_id] + # print ' + # drawobjset_anim.vertices[id_anim]=',drawobjset_anim.vertices[id_anim] + self.centers[_id] = np.array(drawobj_anim.centers[id_anim]) + self.radii[_id] = 1.0 * drawobj_anim.radii[id_anim] + drawobj_anim.del_drawobj(id_anim) + self._update_vertexvbo() + return True + + def end_animation(self, is_del_last_vert=False): + # print 'end_animation',self.ident,_id,self._drawobj_anim + self.centers[self._id_target] = np.array( + self._drawobj_anim.centers[self.id_anim]) + self.radii[self._id_target] = 1.0 * \ + self._drawobj_anim.radii[self.id_anim] + + self._drawobj_anim.del_drawobj(self.id_anim) + self._update_vertexvbo() + return True + + def move(self, _id, vertex, vertex_delta): + # print 'move',self.ident,_id, vertex_delta + self.centers[_id] += vertex_delta + # print ' vertices[id_anim]=',self.vertices[_id] + self._update_vertexvbo() + return True + + def stretch(self, _id, vertex, vertex_delta, ind_vertex): + # print 'move',self.ident,_id, v + #self.vertices[_id, ind_vertex] += vertex_delta + + self.radii[_id] = np.sqrt(np.sum((vertex - self.centers[_id])**2)) + # print ' vertices[id_anim]=',self.vertices[_id] + self._update_vertexvbo() + return True + + def _update_vertexvbo(self): + + n = len(self) + n_vert = self.get_n_vert() + + # print '_update_vertexvbo ',n,n_vert,self._is_fill.value + + # compute x,y,z of vertices of n objects + dphi = 2 * np.pi / (n_vert - 1) + phi = np.arange(0, 2 * np.pi + dphi, dphi).reshape(-1, 1) + + centers = self.get_centers_array() + radii = self.get_radii_array() + x = np.cos(phi) * radii + centers[:, 0] + + y = np.sin(phi) * radii + centers[:, 1] + + z = np.ones((n_vert, 1)) * centers[:, 2] + # print ' x.shape=', x.shape + if self._is_outline.value: + self._update_vertexvbo_lines(x, y, z) + + if self._is_fill.value: + self._update_vertexvbo_fill(x, y, z) + + def _update_vertexvbo_fill(self, x, y, z): + n = len(self) + n_vert = self.get_n_vert() + # print '_update_vertexvbo_fill',n,len(x),n_vert#,self._n_vpe_fill + xf = x.transpose().flatten() # +0.5 + yf = y.transpose().flatten() # +0.5 + zf = z.transpose().flatten() + + centers = self.get_centers_array() + #radii = self.get_radii_array() + + xcf = (np.ones((n_vert, 1)) * centers[:, 0]).transpose().flatten() + ycf = (np.ones((n_vert, 1)) * centers[:, 1]).transpose().flatten() + + # create and compose main vertices array + n_elem_fill = (n_vert - 1) * n + + #glDrawElements(GL_TRIANGLES, self._n_vert*self._n_elem_fill, GL_UNSIGNED_INT, None) + # self._n_vert*self._n_elem_fill = n_vert * (n_vert-1)*n + # repeat for each of the n objects: self._n_vpe_fill*(n_vert-1) + # self._n_vpe * self._n_elem_fill = self._n_vpe * (n_vert-1)*n + + n_vpe_fill = self.get_vbo('fill').get_vpe() + # print ' n_elem_fill',n_elem_fill,n_vpe_fill + vertices = np.zeros((n_elem_fill, n_vpe_fill * 3), dtype=np.float32) + # print ' + # vertices.reshape((-1,3)).shape',vertices.reshape((-1,3)).shape + zf = z.transpose().flatten() + + ind = np.arange(0, n * n_vert).reshape(n, n_vert)[:, :-1].flatten() + + vertices[:, 0] = xf[ind] + vertices[:, 1] = yf[ind] + vertices[:, 2] = zf[ind] + + vertices[:, 3] = xcf[ind] + vertices[:, 4] = ycf[ind] + vertices[:, 5] = zf[ind] + + ind2 = np.arange(0, n * n_vert).reshape(n, n_vert)[:, 1:].flatten() + vertices[:, 6] = xf[ind2] + vertices[:, 7] = yf[ind2] + vertices[:, 8] = zf[ind2] + + self.get_vbo('fill').update_vertices(vertices, n) + #self._vertexvbo_fill = vbo.VBO(vertices.reshape((-1,3))) + #self._indexvbo_fill = vbo.VBO(np.arange(self._n_vert*self._n_elem_fill, dtype=np.int32), target=GL_ELEMENT_ARRAY_BUFFER) + + def _update_vertexvbo_lines(self, x, y, z): + # print '_update_vertexvbo_lines',len(x) + n = len(self) + n_vert = self.get_n_vert() + + # create and compose main vertices array + n_elem = (n_vert - 1) * n + + n_vpe = 2 # vertices per OGL element + + vertices = np.zeros((n_elem, n_vpe * 3), dtype=np.float32) + + # print ' + # vertices.reshape((-1,3)).shape',vertices.reshape((-1,3)).shape + + xf = x.transpose().flatten() + yf = y.transpose().flatten() + zf = z.transpose().flatten() + + ind = np.arange(0, n * n_vert).reshape(n, n_vert)[:, :-1].flatten() + + vertices[:, 0] = xf[ind] + vertices[:, 1] = yf[ind] + vertices[:, 2] = zf[ind] + + ind2 = np.arange(0, n * n_vert).reshape(n, n_vert)[:, 1:].flatten() + vertices[:, 3] = xf[ind2] + vertices[:, 4] = yf[ind2] + vertices[:, 5] = zf[ind2] + + self.get_vbo('outline').update_vertices(vertices, n) + + def pick(self, p, detectwidth=0.1): + """ + Returns a binary vector which is True values for circles that have been selected + by point p. + + In particular, an element is selected if point p is within the circle + """ + if len(self) == 0: + return np.array([], np.int) + + #centers = self.centers.value + centers = self.get_centers_array() + radii = self.get_radii_array() + 0.5 * detectwidth + dx = centers[:, 0] - p[0] + dy = centers[:, 1] - p[1] + return self._ids[dx * dx + dy * dy < (radii * radii)] + + def pick_handle(self, coord, detectwidth=0.1): + """ + Retuns list [ id, ind_vert] when handle is near coord, + otherwise [] + + """ + if len(self) == 0: + return np.zeros((0, 2), np.int) + # print 'pick_handle',self.get_ident(),len(self) + dw = detectwidth**2 + + centers = self.get_centers_array() + radii = self.get_radii_array() + dx = centers[:, 0] - coord[0] + dy = centers[:, 1] - coord[1] + r = dx * dx + dy * dy + ids = self._ids[(r > radii * radii - dw) & (r < radii * radii + dw)] + #handles = np.concatenate(( ids.reshape((len(ids),1)), np.zeros((len(ids),1),np.int)),1) + + # print ' ids',ids + # print ' handles',handles + return np.concatenate((ids.reshape((len(ids), 1)), np.zeros((len(ids), 1), np.int)), 1) + + +class Polygons(DrawobjMixin): + + def __init__(self, ident, parent, name='Polygons', **kwargs): + self.init_common(ident, parent=parent, name=name, + is_fill=False, + is_outline=True, + **kwargs) + # ident of drawobject used for animations + # must be defined AFTER init_common + self._ident_drawobj_anim = 'anim_polygons' + + if self._is_outline: + self.add_vbo(Vbo('outline', GL_LINES, 2, objtype='outline')) + if self._is_fill: + self.add_vbo(Vbo('fill', GL_TRIANGLES, 3, objtype='fill')) + + self.delete('vertices') + self.add_col(am.ListArrayConf('vertices', + # None, + # dtype=np.object, + groupnames=['_private'], + perm='rw', + name='Vertex', + unit='m', + is_save=True, + info='3D coordinate list of Polygon Points.', + )) + + def add_drawobj(self, vertex, + color, color_fill=None, + color_highl=None, color_fill_highl=None, + is_update=True): + + if color_fill == None: + color_fill = color + + if color_highl == None: + color_highl = self._get_colors_highl(np.array([color]))[0] + + if color_fill_highl == None: + color_fill_highl = self._get_colors_highl( + np.array([color_fill]))[0] + + _id = self.add_row(vertices=vertex, + colors=color, + colors_highl=color_highl, + colors_fill=color_fill, + colors_fill_highl=color_fill_highl, + ) + if is_update: + self._update_vertexvbo() + self._update_colorvbo() + return _id + + def add_drawobjs(self, vertices, + colors, colors_fill=None, + colors_highl=None, colors_fill_highl=None, + is_update=True): + + if colors_fill == None: + colors_fill = colors + + if colors_highl == None: + colors_highl = self._get_colors_highl(colors) + + if colors_fill_highl == None: + colors_fill_highl = self._get_colors_highl(colors_fill) + + ids = self.add_rows(len(vertices), + vertices=vertices, + colors=colors, + colors_highl=colors_highl, + colors_fill=colors_fill, + colors_fill_highl=colors_fill_highl, + ) + if is_update: + self._update_vertexvbo() + self._update_colorvbo() + return ids + + def begin_animation(self, id_target): + + self._id_target = id_target + self._drawobj_anim = self.parent.get_drawobj_by_ident( + self._ident_drawobj_anim) + self.id_anim = self._drawobj_anim.add_drawobj(self.get_vertices(id_target), + self.color_anim.value, + ) + # print 'begin_animation',self.ident,_id,self._drawobj_anim + return True + + def append_vert_to_animation(self, vert): + # print 'append_vert_to_animation',vert, type(vert) + # for _id in self.get_ids(): + # print ' main.vertices',_id,self.vertices[_id], type(self.vertices[_id]) + # for _id in self._drawobj_anim.get_ids(): + # print ' anim.vertices',_id,self._drawobj_anim.vertices[_id], + # type(self._drawobj_anim.vertices[_id]) + + self._drawobj_anim.get_vertices(self.id_anim).append(vert) + # print ' vertices',self._drawobj_anim.vertices[self.id_anim],type(self._drawobj_anim.vertices[self.id_anim]) + #vertices = self._drawobj_anim.vertices[self.id_anim] + # vertices.append(vert) + # self._drawobj_anim.vertices[self.id_anim]= + # vertices#list(np.array(vertices,np.float32)) + + # print ' vertices',vertices,type(vertices) + # print ' + # self._drawobj_anim.vertices[self.id_anim]',self._drawobj_anim.vertices[self.id_anim],type(self._drawobj_anim.vertices[self.id_anim]) + self._drawobj_anim._update_vertexvbo() + self._drawobj_anim._update_colorvbo() + # vertex ind of next + return len(self._drawobj_anim.get_vertices(self.id_anim)) - 1 + + # def get_vertices_array(self): + # return self.vertices.value + + def _make_lines(self): + n_lines_tot = 0 + for polyline in self.get_vertices_array(): + n_lines_tot += len(polyline) + + linevertices = np.zeros((n_lines_tot, 2, 3), np.float32) + vertexinds = np.zeros((n_lines_tot, 2), np.int32) + + polyinds = np.zeros(n_lines_tot, np.int32) + linebeginstyles = np.zeros(n_lines_tot, np.int32) + lineendstyles = np.zeros(n_lines_tot, np.int32) + + ind = 0 + ind_line = 0 + + for polyline in self.get_vertices_array(): # self.vertices.value: + # print ' =======' + + # print ' polyline\n',polyline + polyvinds = range(len(polyline)) + # print ' polyvinds\n',polyvinds + vi = np.zeros((2 * len(polyline)), np.int32) + vi[0] = polyvinds[0] + vi[-2] = polyvinds[-2] + vi[-1] = polyvinds[-1] + # print ' vi\n',vi + + # Important type conversion!! + v = np.zeros((2 * len(polyline), 3), np.float32) + v[0] = polyline[0] + v[-2] = polyline[-1] + v[-1] = polyline[0] + # print ' v\n',v + if len(v) > 3: + v[1:-1] = np.repeat(polyline[1:], 2, 0) + vi[1:-1] = np.repeat(polyvinds[1:], 2) + n_lines = len(v) / 2 + # print ' v\n',v + inds_polyline = range(ind_line, ind_line + n_lines) + + polyinds[inds_polyline] = ind + linevertices[inds_polyline] = v.reshape((-1, 2, 3)) + vertexinds[inds_polyline] = vi.reshape((-1, 2)) + ind_line += n_lines + ind += 1 + + self._linevertices = linevertices + self._vertexinds = vertexinds + self._polyinds = polyinds + + def _update_vertexvbo(self): + # print '_update_vertexvbo',self.format_ident() + self._make_lines() + + if self._is_outline.value: + # print ' + # linevertices.reshape((-1,6))',self._linevertices.reshape((-1,6)),len(self._linevertices) + self.get_vbo('outline').update_vertices( + self._linevertices.reshape((-1, 6)), len(self._linevertices)) + #self._update_vertexvbo_line_fill(x1_new,y1_new,z1,x2_new,y2_new,z2,length_xy, alpha_xy,halfwidth,len(vertices)) + + # if self._is_fill.value: + # self._update_vertexvbo_line_fill(x1_new,y1_new,z1,x2_new,y2_new,z2,length_xy, alpha_xy,halfwidth,len(vertices)) + + def _update_colorvbo(self): + n = len(self._polyinds) + #n_vert = self.get_n_vert() + # print 'Polygons._update_colorvbo',self.ident,n + # print ' colors',self.colors.value + # print ' are_highlighted',self.are_highlighted.value + #self._linecolors = np.array(linecolors, np.float32) + #self._linecolors_highl = np.array(linecolors_highl, np.float32) + if (self._is_outline.value) & (n > 0): + colors = self.colors.value[self._polyinds] + self.are_highlighted.value[ + self._polyinds].reshape(n, 1) * self.colors_highl.value[self._polyinds] + self.get_vbo('outline').update_colors(colors) + + # if self._is_fill.value: + # colors = self.colors_fill.value[self._polyinds] + self.are_highlighted.value[self._polyinds].reshape(n,1)*self.colors_fill_highl.value[self._polyinds] + # self.get_vbo('fill').update_colors(colors) + + def pick(self, p, detectwidth=0.1): + """ + Returns a binary vector which is True values for lines that have been selected + by point p. + + In particular, an element of this vector is True if the minimum distance + between the respective line to point p is less than detectwidth + """ + if len(self) == 0: + return np.array([], np.int) + + vertices = self._linevertices + x1 = vertices[:, 0, 0] + y1 = vertices[:, 0, 1] + + x2 = vertices[:, 1, 0] + y2 = vertices[:, 1, 1] + + return self._ids[self._polyinds[get_dist_point_to_segs(p, x1, y1, x2, y2, is_ending=True) < detectwidth * detectwidth]] + + def pick_handle(self, coord, detectwidth=0.1): + """ + Retuns list [ id, ind_vert] when handle is near coord, + otherwise [] + + """ + # print 'pick_handle',self.get_ident(),len(self),detectwidth + dw = detectwidth ** 2 # np.sqrt(detectwidth) + + if len(self) == 0: + return np.zeros((0, 2), np.int) + + # if self.ident not in [ 'lines','fancylines','polylines']: + # return np.zeros((0,2),np.int) + + vertices = self._linevertices # self.get_vertices_array() + handles = [] + # print ' vertices',vertices + # print ' vertices.shape',vertices.shape + dx = vertices[:, 0, 0] - coord[0] + dy = vertices[:, 0, 1] - coord[1] + inds = np.flatnonzero(dx * dx + dy * dy < dw) + + ids = self._ids[self._polyinds[inds]] + handle1 = np.ones((len(ids), 2), np.int) + handle1[:, 0] = ids + handle1[:, 1] = self._vertexinds[inds, 0] + # print ' ',d,handle1 + + dx = vertices[:, 1, 0] - coord[0] + dy = vertices[:, 1, 1] - coord[1] + inds = np.flatnonzero(dx * dx + dy * dy < dw) + ids = self._ids[self._polyinds[inds]] + handle2 = np.ones((len(ids), 2), np.int) + handle2[:, 0] = ids + handle2[:, 1] = self._vertexinds[inds, 1] + # print ' ',d,handle2 + handles = np.concatenate((handle1, handle2), 0) + + # print ' found',len(np.flatnonzero(handles)) + return handles + + def get_boundingbox(self): + if len(self) == 0: + return None + vv = self._linevertices + # TODOD: can be done faster + return np.array([[np.min(vv[:, :, 0]), np.min(vv[:, :, 1]), np.min(vv[:, :, 2])], + [np.max(vv[:, :, 0]), np.max( + vv[:, :, 1]), np.max(vv[:, :, 2])] + ], float) + + +class OGLdrawing(am.ArrayObjman): + + """ + Class holding an ordered list of all OGL draw objects. + This class manages also the order in which the draw objects are rendered. + + The basic idea is that an instance of this class can be passed to + different OGL rendering canvas. + """ + + def __init__(self, ident='drawing', parent=None, name='OGL drawing', info='List of OGL draw objects'): + """ + Holds all drawing objects and provides basic access. + """ + self._init_objman(ident, parent=parent, name=name, info=info) + self.add_col(cm.ObjsConf('drawobjects', + groupnames=['options'], + name='Draw object', + info='Object, containing data and rendering methods.', + )) + + self.add_col(cm.ColConf('idents', '', + perm='r', + is_index=True, + name='ID', + info='Layer string ID.', + )) + + self.add_col(am.ArrayConf('layers', -1.0, + groupnames=['options'], + perm='rw', + #is_index = True, + name='Layer', + info='Layer defines the order in which drawobjects are drawn.', + )) + + def get_drawobjs(self, is_anim=False): + # print 'get_drawobjs' + ids = [] + # efficient only if there are few number of different layers + for layer in sorted(set(self.layers.value)): + inds = np.flatnonzero(self.layers.value == layer) + ids += list(self.get_ids(inds)) + + # print ' ', ids + if not is_anim: + ids_noanim = [] + for _id in ids: + # print ' + # check',_id,self.drawobjects[_id].get_ident(),self.drawobjects[_id].get_name(),self.drawobjects[_id].get_ident().count('anim') + if self.drawobjects[_id].get_ident().count('anim') == 0: + ids_noanim.append(_id) + # print ' ids_noanim',ids_noanim + return self.drawobjects[ids_noanim] + else: + return self.drawobjects[ids] # .value.values() + # return self.drawobjects.value.values() + + def has_drawobj_with_ident(self, ident): + return self.idents.has_index(ident) + + def get_drawobj_by_ident(self, ident): + if self.has_drawobj_with_ident(ident): + _id = self.idents.get_id_from_index(ident) + return self.drawobjects[_id] + else: + None + + def add_drawobj(self, drawobj, layer=0): + id_drawobj = self.add_rows(1, drawobjects=[drawobj], + idents=[drawobj.get_ident()], + layers=[layer], + ) + return id_drawobj + + def del_drawobj_by_ident(self, ident): + if self.idents.has_index(ident): + _id = self.idents.get_id_from_index(ident) + self.del_row(_id) + return True + else: + return False + + +class OGLnavcanvas(wx.Panel): + + """ + Canvas with some navigation tools. + """ + + def __init__(self, parent, + mainframe=None, + size=wx.DefaultSize, + ): + + wx.Panel.__init__(self, parent, wx.ID_ANY, size=size) + sizer = wx.BoxSizer(wx.VERTICAL) + + # initialize GL canvas + self._canvas = OGLcanvas(self, mainframe,) + + # navigation bar + self._navbar = self.make_navbar() + + # compose navcanvas window + sizer.Add(self._canvas, 1, wx.GROW) + sizer.Add(self._navbar, 0, wx.ALL | wx.ALIGN_LEFT | + wx.GROW, 4) # from NaviPanelTest + # finish panel setup + self.SetSizer(sizer) + sizer.Fit(self) + + def get_canvas(self): + return self._canvas + + def make_navbar(self): + """ + Initialize toolbar which consist of navigation buttons + """ + bottonsize = (16, 16) + bottonborder = 10 + toolbarborder = 1 + + # toolbar + + ## + navbar = wx.BoxSizer(wx.HORIZONTAL) + + bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'gtk_fit_zoom_24px.png'), wx.BITMAP_TYPE_PNG) + b = wx.BitmapButton(self, -1, bitmap, bottonsize) + b.SetToolTipString("Zoom to fit") + self.Bind(wx.EVT_BUTTON, self.on_zoom_tofit, b) + # ,border=toolbarborder ,flag=wx.ALL, # 0, wx.ALL, 5 + navbar.Add(b, flag=wx.ALL, border=toolbarborder) + + bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'gtk_in_zoom_24px.png'), wx.BITMAP_TYPE_PNG) + b = wx.BitmapButton(self, -1, bitmap, bottonsize, + (bitmap.GetWidth() + bottonborder, bitmap.GetHeight() + bottonborder)) + b.SetToolTipString("Zoom in") + self.Bind(wx.EVT_BUTTON, self.on_zoom_in, b) + navbar.Add(b, flag=wx.ALL, border=toolbarborder) + + bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'gtk_out_zoom_24px.png'), wx.BITMAP_TYPE_PNG) + b = wx.BitmapButton(self, -1, bitmap, bottonsize, + (bitmap.GetWidth() + bottonborder, bitmap.GetHeight() + bottonborder)) + b.SetToolTipString("Zoom out") + self.Bind(wx.EVT_BUTTON, self.on_zoom_out, b) + navbar.Add(b, flag=wx.ALL, border=toolbarborder) + + bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'icon_select_components.png'), wx.BITMAP_TYPE_PNG) + b = wx.BitmapButton(self, -1, bitmap, bottonsize, + (bitmap.GetWidth() + bottonborder, bitmap.GetHeight() + bottonborder)) + b.SetToolTipString("Select drawing components") + #b = wx.Button(self, label="Show/Hide") + self.Bind(wx.EVT_BUTTON, self.popup_showhide, b) + navbar.Add(b) + # navbar.AddStretchSpacer() + # navbar.AddSpacer(3) + + self.coordsdisplay = wx.StaticText(self, -1, 'x,y', style=wx.TE_RIGHT) + navbar.Add(self.coordsdisplay, wx.ALL | wx.EXPAND, 5, + border=toolbarborder) # ,flag=wx.RIGHT no effect?? + # self.path = wx.TextCtrl(self, -1,'Try me', style=wx.TE_RIGHT)#size=(-1, -1))#,size=(300, -1)) + #self.path.Bind(wx.EVT_CHAR, self.on_test) + #navbar.Add(self.path,1, wx.EXPAND, border=toolbarborder) + + #b.Bind(wx.EVT_BUTTON, self.popup_showhide) + + #b=wx.Button(self, wx.wx.ID_ZOOM_IN) + #b.SetToolTipString("Zoom in") + #self.Bind(wx.EVT_BUTTON, self.on_test, b) + #navbar.Add(b, flag=wx.ALL, border=toolbarborder) + + #bitmap = wx.ArtProvider_GetBitmap(wx.ART_GO_FORWARD,wx.ART_TOOLBAR) + # b = wx.BitmapButton(self, -1, bitmap, bottonsize, + # (bitmap.GetWidth()+bottonborder, bitmap.GetHeight()+bottonborder)) + #b.SetToolTipString("Go forward in browser history.") + #self.Bind(wx.EVT_BUTTON, self.on_test, b) + #navbar.Add(b,0, wx.EXPAND, border=toolbarborder) + # bottons.append(b) + + # self.add_tool( + # 'home',self.on_go_home, + # wx.ArtProvider.GetBitmap(wx.ART_GO_HOME, wx.ART_TOOLBAR, tsize), + # 'show panel of root instance') + + # self.toolbar.AddSeparator() + + # panel.SetAutoLayout(True) + # panel.SetSizer(buttons) + + navbar.Fit(self) + return navbar + + def display_coords(self, coords): + # self.coordsdisplay.SetLabel(str(coords[0])+','+str(coords[1])) + self.coordsdisplay.SetLabel('%8.3f,%8.3f' % (coords[0], coords[1])) + + def get_navbar(self): + return self._navbar + + def on_zoom_tofit(self, event=None): + self._canvas.zoom_tofit() + if event: + event.Skip() + + def on_zoom_out(self, event=None): + self._canvas.zoom_out() + if event: + event.Skip() + + def on_zoom_in(self, event=None): + self._canvas.zoom_in() + if event: + event.Skip() + + def popup_showhide(self, event): + #btn = event.GetEventObject() + drawing = self._canvas.get_drawing() + + # Create the popup menu + self._menu_showhide = AgilePopupMenu(self) + if drawing: + for drawobj in drawing.get_drawobjs(): + # print ' path=',drawobj.get_name(),drawobj.is_visible() + self._menu_showhide.append_item( + drawobj.get_name(), + self.showhide_drawobjs, + info='Show/hide ' + drawobj.get_name(), + check=drawobj.is_visible(), + ) + + self.PopupMenu(self._menu_showhide) + self._menu_showhide.Destroy() + event.Skip() + + def showhide_drawobjs(self, event): + # print 'showhide_drawobjs' + drawing = self._canvas.get_drawing() + if drawing: + for drawobj in drawing.get_drawobjs(): + menuitem = self._menu_showhide.get_menuitem(drawobj.get_name()) + # print ' + # set_visible=',drawobj.get_name(),menuitem.IsChecked() + drawobj.set_visible(menuitem.IsChecked()) + + self._canvas.draw() + event.Skip() + + def on_test(self, event=None): + print 'this is a test' + + +class OGLcanvas(glcanvas.GLCanvas): + + def __init__(self, parent, mainframe=None): + if mainframe == None: + self._mainframe = parent + else: + self._mainframe = mainframe + + self.eyex = 0.0 + self.eyey = 0.0 + self.eyez = -30000.0 # -9.0 + + self.centerx = 0.0 + self.centery = 0.0 + self.centerz = 0.0 + + self.upx = -1.0 + self.upy = 0.0 + self.upz = 0.0 + + self.g_Width = 600 + self.g_Height = 600 + + self.g_nearPlane = 10.0 # 10. + self.g_farPlane = 10.0**8 # 10.0**8 #10000. + + self.action = "" + self.pos_start = (0.0, 0.0) + self.trans_start = (0.0, 0.0) + + self.resetView(is_draw=False) + + self._tool = None + + # Forcing a specific style on the window. + # Should this include styles passed? + style = wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE + + attribList = (glcanvas.WX_GL_RGBA, # RGBA + glcanvas.WX_GL_DOUBLEBUFFER, # Double Buffered + glcanvas.WX_GL_DEPTH_SIZE, 24) # 24 bit + + glcanvas.GLCanvas.__init__(self, parent, -1, attribList=attribList) + + self.GLinitialized = False + + # Set the event handlers. + self.Bind(wx.EVT_ERASE_BACKGROUND, self.processEraseBackgroundEvent) + self.Bind(wx.EVT_SIZE, self.OnSize) + self.Bind(wx.EVT_PAINT, self.processPaintEvent) + + self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) + self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDclick) + self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp) + self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown) + self.Bind(wx.EVT_RIGHT_UP, self.OnRightUp) + self.Bind(wx.EVT_MOTION, self.OnMotion) + self.Bind(wx.EVT_MOUSEWHEEL, self.OnWheel) + + #self.Bind(wx.EVT_CHAR, self.on_key_down) + # wx.EVT_KEY_DOWN(self, self.on_key_down) # NO, does not get focus + # EVT_LEFT_DCLICK + # EVT_MIDDLE_DCLICK + # EVT_RIGHT_DCLICK + # EVT_LEAVE_WINDOW + # EVT_ENTER_WINDOW + # EVT_MOUSE_EVENTS + + # self.SetFocus() + + self._drawing = None + # if drawing!= None: + # self.set_drawing(drawing) + + # this is needed to initialize GL projections for unproject + wx.CallAfter(self.OnSize) + + def set_drawing(self, drawing): + if self._drawing != drawing: + + # if self._tool != None: + # self._tool.force_deactivation() + + del self._drawing + self._drawing = drawing + self.draw() + + def activate_tool(self, tool): + # called from tool + self._tool = tool + + def deactivate_tool(self): + # called from tool + + # print 'deactivate_tool',self._tool.format_ident() + # make sure cursor gets back to normal + self.SetCursor(wx.NullCursor) + + # self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW)) + self._tool = None + self.draw() + + def get_tool(self): + return self._tool + + def get_drawing(self): + return self._drawing + + def resetView(self, is_draw=True): + self.zoom = 65. + + self.xRotate = 180. + self.yRotate = 180. + self.zRotate = -90.0 + self.trans = (0.0, 0.0) + + if is_draw: + self.draw() + + def on_key_down(self, event): + is_draw = False + # print 'on_key_down',event.KeyCode(),type(event.KeyCode()) + if event.KeyCode() == 'x': + self.xRotate += 5.0 + is_draw |= True + + if is_draw: + self.draw() + event.Skip() + + def OnWheel(self, event, is_draw=False): + #EventType = FloatCanvas.EVT_FC_MOUSEWHEEL + # + Rot = event.GetWheelRotation() + # print 'OnWheel!!',Rot,event.ControlDown(),event.ShiftDown() + # event.ControlDown(): # zoom + if (not event.ShiftDown()) & event.ControlDown(): + if Rot < 0: + self.zoom_in(is_draw=False) + else: + self.zoom_out(is_draw=False) + is_draw |= True + + # event.ControlDown(): # zoom + if (event.ShiftDown()) & event.ControlDown(): + if Rot < 0: + self.xRotate -= 5.0 + else: + self.xRotate += 5.0 + is_draw |= True + + elif self._tool != None: + is_draw |= self._tool.on_wheel(event) + self.draw() + event.Skip() + + if is_draw: + self.draw() + event.Skip() + + def get_resolution(self): + """ + Resolution in GL unit per scren pixel + """ + if (self.g_Width == 0) & (self.g_Height == 0): + # there is no window space + return 1.0 + + v_top = self.unproject((0.5 * self.g_Width, 0)) + v_bot = self.unproject((0.5 * self.g_Width, self.g_Height)) + + v_left = self.unproject((0, 0.5 * self.g_Height)) + v_right = self.unproject((self.g_Width, 0.5 * self.g_Height)) + + dy = np.abs(v_bot[1] - v_top[1]) + dx = np.abs(v_right[1] - v_left[1]) + + if dx > dy: + return dx / self.g_Width + else: + return dy / self.g_Height + + def zoom_tofit(self, event=None, is_draw=True): + # print 'zoom_tofit',is_draw + #p = self._canvas.unproject_event(event) + #vetrex = np.array([p[0], p[1], 0.0, 1.0],float) + #p_screen = self._canvas.project(vetrex) + # print 'SelectTool.on_left_down (px,py)=',p + # print ' (x,y)=',event.GetPosition(),p_screen + self.resetView() + + vv_min, vv_max = self.get_boundingbox() + dv = vv_max - vv_min + + # print 'vv_min',vv_min + # print 'vv_max',vv_max + + p_min = self.project(vv_min) + p_max = self.project(vv_max) + + # print 'p_min',p_min + # print 'p_max',p_max + + dp = np.abs(np.array(p_max - p_min, float)) + + # print ' dp',dp,dp==np.nan,np.nan + if np.isnan(np.sum(dp)): + return + + window = np.array([self.g_Width, self.g_Height], float) + zoomfactor = 0.8 * np.min(window / dp[:2]) + + # print ' zoomfactor,zoom',zoomfactor,self.zoom + + self.zoom /= zoomfactor + # print ' zoomfactor',zoomfactor,self.zoom + + self.draw() + #vv_min, vv_max = self.get_boundingbox() + + # lowerleft corner + vv_target = self.unproject((0.0, self.g_Height)) + + # print ' vv_min',vv_min + # print ' vv_target',vv_target + # print ' trans',self.trans + dv = 0.9 * vv_target - vv_min + + # print ' dv',dv + newtrans = np.array(self.trans) + dv[:2] + self.trans = tuple(newtrans) + # print ' trans',self.trans + self.draw() + + def get_boundingbox(self): + drawing = self.get_drawing() + vv_min = np.inf * np.ones((1, 3), float) + vv_max = -np.inf * np.ones((1, 3), float) + if drawing: + for drawobj in drawing.get_drawobjs(): + bb = drawobj.get_boundingbox() + if bb != None: + v_min, v_max = bb + # print ' v_min',v_min + # print ' v_max',v_max + vv_min = np.concatenate((vv_min, v_min.reshape(1, 3)), 0) + vv_max = np.concatenate((vv_max, v_max.reshape(1, 3)), 0) + # print ' vv_min',vv_min + # print ' vv_max',vv_max + vv_min = np.min(vv_min, 0) + vv_max = np.max(vv_max, 0) + return vv_min, vv_max + + def zoom_in(self, event=None, is_draw=True): + self.zoom *= 0.9 + if is_draw: + self.draw() + + def zoom_out(self, event=None, is_draw=True): + self.zoom *= 1.1 + if is_draw: + self.draw() + + def OnLeftDown(self, event, is_draw=False): + if (event.ControlDown() & event.ShiftDown()) & (self.action == ''): + self.action = 'drag' + self.BeginGrap(event) + event.Skip() + + elif self._tool != None: + is_draw = self._tool.on_left_down(event) + + if is_draw: + self.draw() + event.Skip() + + def OnLeftDclick(self, event, is_draw=False): + if self._tool != None: + is_draw = self._tool.on_left_dclick(event) + + if is_draw: + self.draw() + event.Skip() + + def OnLeftUp(self, event, is_draw=False): + + if self.action == 'drag': + self.EndGrap(event) + self.action == '' + event.Skip() + + elif self._tool != None: + is_draw = self._tool.on_left_up(event) + + if is_draw: + self.draw() + event.Skip() + + def OnRightDown(self, event, is_draw=False): + if self._tool != None: + is_draw = self._tool.on_right_down(event) + + if is_draw: + self.draw() + event.Skip() + + def OnRightUp(self, event, is_draw=False): + + if self._tool != None: + is_draw = self._tool.on_right_up(event) + + if is_draw: + self.draw() + event.Skip() + + def OnMotion(self, event, is_draw=False): + # print 'OnMotion',event.GetPosition() + self.GetParent().display_coords(self.unproject_event(event)) + + if (event.ControlDown() & event.ShiftDown() & (self.action == 'drag')): + self.MoveGrap(event) + is_draw |= True + event.Skip() + + elif (self.action == 'drag'): + self.EndGrap(event) + is_draw |= True + self.action == '' + event.Skip() + + elif self._tool != None: + is_draw |= self._tool.on_motion(event) + + if is_draw: + self.draw() + + def BeginGrap(self, event): + # http://www.wxpython.org/docs/api/wx.Cursor-class.html + self._cursor_last = self.GetCursor() + self.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) + self.pos_start = event.GetPosition() + self.trans_start = self.trans + # print 'BeginGrap',self.trans + + def MoveGrap(self, event): + + x, y = self.unproject(event.GetPosition())[0:2] + x0, y0 = self.unproject(self.pos_start)[0:2] + + self.trans = (self.trans_start[0] + (x - x0), + self.trans_start[1] + (y - y0)) + # print 'MoveGrap',self.trans, x,y + + def EndGrap(self, event): + # print 'EndGrap' + self.SetCursor(self._cursor_last) + self.action = '' + + # + # wxPython Window Handlers + + def processEraseBackgroundEvent(self, event): + """Process the erase background event.""" + pass # Do nothing, to avoid flashing on MSWin + + def OnSize(self, event=None, win=None): + """Process the resize event.""" + if self.GetContext(): + # Make sure the frame is shown before calling SetCurrent. + self.Show() + self.SetCurrent() + + size = self.GetClientSize() + self.OnReshape(size.width, size.height) + self.Refresh(False) + if event: + event.Skip() + + def processPaintEvent(self, event): + """Process the drawing event.""" + self.SetCurrent() + + # This is a 'perfect' time to initialize OpenGL ... only if we need to + if not self.GLinitialized: + self.OnInitGL() + self.GLinitialized = True + + self.draw() + event.Skip() + + # + # GLFrame OpenGL Event Handlers + + def OnInitGL(self): + """Initialize OpenGL for use in the window.""" + glClearColor(0, 0, 0, 1) + + def set_color_background(self, color): + glClearColor(color[0], color[1], color[2], color[3]) + self.draw() + + def OnReshape(self, width, height): + """Reshape the OpenGL viewport based on the dimensions of the window.""" + #global g_Width, g_Height + self.g_Width = width + self.g_Height = height + glViewport(0, 0, self.g_Width, self.g_Height) + + def draw(self, *args, **kwargs): + """Draw the window.""" + # print 'OGLCanvas.draw id(self._drawing)',id(self._drawing) + # Clear frame buffer and depth buffer + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) + # Set up viewing transformation, looking down -Z axis + glLoadIdentity() + gluLookAt(self.eyex, self.eyey, self.eyez, self.centerx, self.centery, + self.centerz, self.upx, self.upy, self.upz) # -.1,0,0 + + # Set perspective (also zoom) + glMatrixMode(GL_PROJECTION) + glLoadIdentity() + # the window corner OpenGL coordinates are (-+1, -+1) + glOrtho(-1, 1, 1, -1, -1, 1) + + aspect = float(self.g_Width) / float(self.g_Height) + + gluPerspective(self.zoom, aspect, self.g_nearPlane, self.g_farPlane) + glMatrixMode(GL_MODELVIEW) + self.polarView() + + # resolution in GL unit per scren pixel + resolution = self.get_resolution() + # print ' get_resolution',resolution + + # draw actual scene + if self._drawing: + # self._drawing.print_attrs() + for drawobj in self._drawing.get_drawobjs(is_anim=True): + #checkobj = self._drawing.get_drawobj_by_ident(drawobj.ident) + # if checkobj!= None: + # print '\n draw.drawobj',drawobj.ident, checkobj.ident + # else: + # print '\n draw.drawobj',drawobj.ident, + # checkobj,self._drawing.has_drawobj_with_ident(drawobj.ident) + drawobj.draw(resolution) + + self.SwapBuffers() + + def polarView(self): + glTranslatef(self.trans[1], 0.0, 0.0) + glTranslatef(0.0, -self.trans[0], 0.0) + + glRotatef(-self.zRotate, 0.0, 0.0, 1.0) + glRotatef(-self.xRotate, 1.0, 0.0, 0.0) + glRotatef(-self.yRotate, 0.0, 1.0, 0.0) + + def get_intersection(self, v_near, v_far): + # 150918 + # idea from http://www.bfilipek.com/2012/06/select-mouse-opengl.html + # https://en.wikipedia.org/wiki/Line%E2%80%93plane_intersection + d = -v_near + v_far + + t = -v_near[2] / d[2] + v_inter = v_near + t * d + + return v_inter + + def unproject_event(self, event): + return self.unproject(event.GetPosition())[0:2] + + def unproject(self, pos_display): + """Get the world coordinates for viewCoordinate for the event + """ + + x = pos_display[0] + y = self.g_Height - pos_display[1] + + modelviewmatrix = glGetDoublev(GL_MODELVIEW_MATRIX) + projectionmatrix = glGetDoublev(GL_PROJECTION_MATRIX) + viewport = glGetInteger(GL_VIEWPORT) + + z = 0.0 + worldCoordinate_near = np.array(gluUnProject( + x, y, z, + modelviewmatrix, + projectionmatrix, + viewport,), dtype=np.float32) + + z = 1.0 + worldCoordinate_far = np.array(gluUnProject( + x, y, z, + modelviewmatrix, + projectionmatrix, + viewport,), dtype=np.float32) + + v_inter = self.get_intersection( + worldCoordinate_near, worldCoordinate_far) + return v_inter + + def project(self, vertex): + """ + http://stackoverflow.com/questions/3792481/how-to-get-screen-coordinates-from-a-3d-point-opengl + """ + modelviewmatrix = glGetDoublev(GL_MODELVIEW_MATRIX) + projectionmatrix = glGetDoublev(GL_PROJECTION_MATRIX) + viewport = glGetInteger(GL_VIEWPORT) + + coords = np.array(gluProject(vertex[0], vertex[1], vertex[2], + modelviewmatrix, projectionmatrix, + viewport)) + + coords[1] = self.g_Height - coords[1] + # print 'project',coords + + return coords + + +class OGLcanvasTools(ToolsPanel): + + """ + Shows a toolpallet with different tools and an options panel. + Here tools are added which + """ + + def __init__(self, parent): + ToolsPanel.__init__(self, parent, n_buttoncolumns=3, + size=wx.DefaultSize) + + # add ainitial tool + self.add_initial_tool(SelectTool(self)) + + # self.add_tool(HandleTool(self)) + self.add_tool(StretchTool(self)) + self.add_tool(MoveTool(self)) + + self.add_tool(AddLineTool(self)) + self.add_tool(AddCircleTool(self)) + self.add_tool(AddPolylineTool(self)) + self.add_tool(AddPolygonTool(self)) + + self.add_tool(DeleteTool(self)) + + self.add_tool(ConfigureTool(self)) + # more tools can be added later... + + +class OGleditor(wx.Panel): + + def __init__(self, parent, + mainframe=None, + size=wx.DefaultSize, + is_menu=False, # create menu items + Debug=0, + ): + + self._drawing = None + + # if drawing!= None:.... + self.prefix_anim = 'anim_' + self.layer_anim = 1000.0 + + wx.Panel.__init__(self, parent, wx.ID_ANY, size=size) + sizer = wx.BoxSizer(wx.HORIZONTAL) + + self._mainframe = mainframe + + # initialize GL canvas + navcanvas = OGLnavcanvas(self, mainframe) + #self._canvas = OGLcanvas(self) + self._canvas = navcanvas.get_canvas() + + # compose tool pallet here + self._toolspanel = OGLcanvasTools(self) + + # compose editor window + + # works but toolpanel changes size!!! + # sizer.Add(self._toolspanel,0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4)# from NaviPanelTest + # sizer.Add(navcanvas,1,wx.GROW) + + sizer.Add(self._toolspanel, 0, wx.EXPAND) + sizer.Add(navcanvas, 1, wx.EXPAND) + + # navbar + #sizer.Add(self._canvas,1,wx.GROW)# + # sizer.Add(self._navbar,0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4)# from + # NaviPanelTest + + # finish panel setup + self.SetSizer(sizer) + # sizer.Fit(self) + # self.Layout() + + # no use: + #wx.EVT_SIZE(self, self.on_size) + + def get_canvas(self): + # DEPRICATED: canvas should not be needed outside netwdit + # this is used mainly by the tools to know on which canvas to operate on + # if multiple canvas, use the one with focus + return self._canvas + + def draw(self): + + self._canvas.draw() + # in the future there can be the same drawing on multiple canvases + + def get_toolbox(self): + return self._toolspanel + + def set_drawing(self, drawing): + # self._toolspanel.reset_initial_tool() + # here ad some additional drawing objects for animation + # self.add_drawobjs_anim(drawing) + self._drawing = drawing + self._canvas.set_drawing(drawing) + self._toolspanel.reset_initial_tool() + + # wx.CallAfter(self._canvas.zoom_tofit) + + def get_drawing(self): + return self._drawing # self._canvas.get_drawing() + + def add_drawobjs_anim(self, drawing=None): + + if drawing == None: + drawing = self._drawing + drawobjs_anim = [Lines(self.prefix_anim + 'lines', drawing, + linewidth=1), + + Fancylines(self.prefix_anim + 'fancylines', drawing, + is_lefthalf=True, + is_righthalf=True, + linewidth=1, + ), + + Lines(self.prefix_anim + 'lines', drawing, + linewidth=1), + + Polylines(self.prefix_anim + 'polylines', drawing, + joinstyle=FLATHEAD, + is_lefthalf=True, + is_righthalf=True, + linewidth=1, + ), + + Polygons(self.prefix_anim + 'polygons', drawing, + linewidth=1), + + Circles(self.prefix_anim + 'circles', drawing, + is_fill=False, # Fill objects, + is_outline=True, # show outlines + linewidth=1, + ), + ] + + for drawobj in drawobjs_anim: + drawing.add_drawobj(drawobj, layer=self.layer_anim) + + def get_mainframe(self): + # this is used mainly by the tools to know on which mainframe to + # operate on + return self._mainframe + + def on_size(self, event=None): + # print 'on_size',self._toolspanel.GetSize() + # self._toolspanel.SetSize((300,-1)) + # self.tc.SetSize(self.GetSize()) + # self.tc.SetSize(self.GetSize()) + # self._viewtabs.SetSize(self.GetSize()) + # pass + #wx.LayoutAlgorithm().LayoutWindow(self, self.p1) + #wx.LayoutAlgorithm().LayoutWindow(self, self.p1) + + # important: + #wx.LayoutAlgorithm().LayoutWindow(self, self._toolspanel) + + if event: + event.Skip() + +if __name__ == '__main__': + ########################################################################## + # MAIN FRAME + + from mainframe import AgileToolbarFrameMixin + + class OGLeditorMainframe(AgileToolbarFrameMixin, wx.Frame): + + """ + Simple wx frame with some special features. + """ + + def __init__(self, title, pos=wx.DefaultPosition, + size=(1000, 500), style=wx.DEFAULT_FRAME_STYLE, + name='frame'): + + # Forcing a specific style on the window. + # Should this include styles passed? + style = wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE + wx.Frame.__init__(self, None, wx.NewId(), title, + pos, size=size, style=style, name=name) + self.gleditor = OGleditor(self) + + self.Show() # must be here , before putting stuff on canvas + + ################################################################# + # create the menu bar + + self.menubar = AgileMenubar(self) + self.make_menu() + # self.menubar.append_menu('tools') + self.SetMenuBar(self.menubar) + self.on_test() + + def make_menu(self, event=None): + self.menubar.append_menu('file') + # self.menubar.append_item('file/test',self.on_test,\ + # shortkey='Ctrl+t',info='Draw test objects') + + def on_test(self, event=None): + print '\non_test' + vertices = np.array([ + [[0.0, 0.0, 0.0], [0.2, 0.0, 0.0]], # 0 green + [[0.0, 0.0, 0.0], [0.0, 0.9, 0.0]], # 1 red + ]) + + colors = np.array([ + [0.0, 0.9, 0.0, 0.9], # 0 + [0.9, 0.0, 0.0, 0.9], # 1 + ]) + + colors2 = np.array([ + [0.5, 0.9, 0.5, 0.5], # 0 + [0.9, 0.5, 0.9, 0.5], # 1 + ]) + colors2o = np.array([ + [0.8, 0.9, 0.8, 0.9], # 0 + [0.9, 0.8, 0.9, 0.9], # 1 + ]) + + drawing = OGLdrawing() +#------------------------------------------------------------------------- + + if 1: + lines = Lines('lines', drawing) + lines.add_drawobjs(vertices, colors) + drawing.add_drawobj(lines) +#------------------------------------------------------------------------- + if 1: + fancylines = Fancylines('fancylines', drawing, + arrowstretch=1.0, + is_lefthalf=True, + is_righthalf=True + ) + + colors_fancy = np.array([ + [0.0, 0.9, 0.0, 0.9], # 0 + #[0.9,0.0,0.0,0.9], # 1 + ]) + vertices_fancy = np.array([ + [[0.0, -1.0, 0.0], [2, -1.0, 0.0]], # 0 green + #[[0.0,-1.0,0.0],[0.0,-5.0,0.0]],# 1 red + ]) + + widths = [0.5, + # 0.3, + ] + # print ' vertices_fancy\n',vertices_fancy + # FLATHEAD = 0 + #BEVELHEAD = 1 + #TRIANGLEHEAD = 2 + #ARROWHEAD = 3 + fancylines.add_drawobjs(vertices_fancy, + widths, # width + colors_fancy, + beginstyles=[TRIANGLEHEAD, ], + endstyles=[TRIANGLEHEAD, ], + ) + drawing.add_drawobj(fancylines, layer=10) +#------------------------------------------------------------------------- + if 1: + polylines = Polylines('polylines', drawing, + joinstyle=FLATHEAD, + arrowstretch=1.0, + is_lefthalf=True, + is_righthalf=True + ) + colors_poly = np.array([ + [0.0, 0.8, 0.5, 0.9], # 0 + [0.8, 0.0, 0.5, 0.9], # 1 + ]) + + vertices_poly = np.array([ + [[0.0, 2.0, 0.0], [5.0, 2.0, 0.0], [ + 5.0, 7.0, 0.0], [10.0, 7.0, 0.0]], # 0 green + [[0.0, -2.0, 0.0], [-2.0, -2.0, 0.0]], # 1 red + ], np.object) + + widths = [0.5, + 0.3, + ] + # print ' vertices_poly\n',vertices_poly + polylines.add_drawobjs(vertices_poly, + widths, # width + colors_poly, + beginstyles=[ + TRIANGLEHEAD, TRIANGLEHEAD], + endstyles=[TRIANGLEHEAD, TRIANGLEHEAD]) + drawing.add_drawobj(polylines, layer=-2) + +#------------------------------------------------------------------------- + if 1: + polygons = Polygons('polygons', drawing, linewidth=5) + colors_poly = np.array([ + [0.0, 0.9, 0.9, 0.9], # 0 + [0.8, 0.2, 0.2, 0.9], # 1 + ]) + + vertices_poly = [ + [[0.0, 2.0, 0.0], [5.0, 2.0, 0.0], + [5.0, 7.0, 0.0], ], # 0 green + [[0.0, -2.0, 0.0], [-2.0, -2.0, 0.0], + [-2.0, 0.0, 0.0]], # 1 red + ] + + print ' vertices_polygon\n', vertices_poly + polygons.add_drawobjs(vertices_poly, + colors_poly) + polygons.add_drawobj([[5.0, -2.0, 0.0], [3.0, -2.0, 0.0], [3.0, 0.0, 0.0]], + [0.8, 0.2, 0.8, 0.9]) + drawing.add_drawobj(polygons) + + +#------------------------------------------------------------------------- + + if 1: + circles = Circles('circles', drawing, + is_fill=False, # Fill objects, + is_outline=True, # show outlines + ) + circles.add_drawobjs([[0.0, 0.0, 0.0], [1.0, 0.5, 0.0]], [ + 0.5, 0.25], colors2o, colors2) + drawing.add_drawobj(circles) + + # drawing.add_drawobj(testogl.triangles) + # drawing.add_drawobj(testogl.rectangles) +#------------------------------------------------------------------------- + + #canvas = self.gleditor.get_canvas() + # canvas.set_drawing(drawing) + + #lines.add_drawobj([[0.0,0.0,0.0],[-0.2,-0.8,0.0]], [0.0,0.9,0.9,0.9]) + #circles.add_drawobj([1.5,0.0,0.0],0.6,colors2o[0], colors2[0]) + + # canvas.zoom_tofit() + # wx.CallAfter(canvas.zoom_tofit) + self.gleditor.add_drawobjs_anim(drawing) + self.gleditor.set_drawing(drawing) + if event: + event.Skip() + + def get_objbrowser(self): + return self._objbrowser + + class OGLeditorApp(wx.App): + + def OnInit(self): + # wx.InitAllImageHandlers() + self.mainframe = OGLeditorMainframe("OGLeditor") + #sumopyicon = wx.Icon(os.path.join(IMAGEDIR,'icon_sumopy.png'),wx.BITMAP_TYPE_PNG, 16,16) + # wx.Frame.SetIcon(self.mainframe,sumopyicon) + # self.mainframe.SetIcon(sumopyicon) + + # if True: #len(sys.argv)>=2: + # from lib.net import readNet + # filepath = '/home/joerg/projects/sumopy/bologna/bologna4.net.xml'#sys.argv[1] + # _net = readNet(filepath) + # else: + # _net = None + + self.SetTopWindow(self.mainframe) + return True + + ########################################################################### + # MAINLOOP + + if len(sys.argv) == 3: + ident = sys.argv[1] + dirpath = sys.argv[2] + else: + ident = None + dirpath = None + app = OGLeditorApp(0) + + if 0: # len(noplugins)>0: + _msg = """The following plugins could not be plugged in:\n\n """ + noplugins[:-2] +\ + """\n\nIf you like to use these plugins, please check messages on console for Import errors and install the required packages. + """ + dlg = wx.MessageDialog( + None, _msg, "Warning from Plugins", wx.OK | wx.ICON_WARNING) + dlg.ShowModal() + dlg.Destroy() + + app.MainLoop() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/analysis/Taxi.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/analysis/Taxi.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/analysis/Taxi.py 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/analysis/Taxi.py 2017-07-23 16:22:07.000000000 +0000 @@ -5,12 +5,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-17 -@version $Id: Taxi.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: Taxi.py 22608 2017-01-17 06:28:54Z behrisch $ Represents a single Taxi. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/BinarySearch.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/BinarySearch.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/BinarySearch.py 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/BinarySearch.py 2017-07-23 16:22:07.000000000 +0000 @@ -5,12 +5,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-01 -@version $Id: BinarySearch.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: BinarySearch.py 22608 2017-01-17 06:28:54Z behrisch $ binary search helper functions. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/CalcTime.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/CalcTime.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/CalcTime.py 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/CalcTime.py 2017-07-23 16:22:07.000000000 +0000 @@ -5,11 +5,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-17 -@version $Id: CalcTime.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: CalcTime.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/Path.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/Path.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/Path.py 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/Path.py 2017-07-23 16:22:07.000000000 +0000 @@ -5,12 +5,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-17 -@version $Id: Path.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: Path.py 22608 2017-01-17 06:28:54Z behrisch $ Contains paths which are needed frequently SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/ProgressBar.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/ProgressBar.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/ProgressBar.py 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/ProgressBar.py 2017-07-23 16:22:07.000000000 +0000 @@ -5,12 +5,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-06-19 -@version $Id: ProgressBar.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: ProgressBar.py 22608 2017-01-17 06:28:54Z behrisch $ A simple progress bar for the console SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/Reader.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/Reader.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/Reader.py 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/20_fix_scripts_headers.patch/tools/projects/TaxiFCD_Krieg/src/util/Reader.py 2017-07-23 16:22:07.000000000 +0000 @@ -5,12 +5,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-18 -@version $Id: Reader.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: Reader.py 22608 2017-01-17 06:28:54Z behrisch $ Contains reader modules which are needed frequently SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/30_add_missing_link.patch/src/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/30_add_missing_link.patch/src/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/30_add_missing_link.patch/src/Makefile.am 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/30_add_missing_link.patch/src/Makefile.am 2017-07-23 16:22:07.000000000 +0000 @@ -5,12 +5,8 @@ GUI_DIRS = gui guinetload guisim netedit mesogui osgview endif -if CHECK_MEMORY_LEAKS -MEM_LIBS = ./foreign/nvwa/libnvwa.a -endif - if TRACI -TRACI_LIBS = ./traci-server/libtraciserver.a ./utils/traci/libtraci.a +TRACI_LIBS = ./traci-server/libtraciserver.a ./traci-server/lib/libtraci.a ./utils/traci/libtraciclient.a TRACI_DIRS = traci-server traci_testclient endif @@ -18,12 +14,13 @@ COMMON_LIBS = ./utils/options/liboptions.a \ ./utils/xml/libxml.a \ +./utils/distribution/libdistribution.a \ +./utils/geom/libgeom.a \ ./utils/common/libcommon.a \ ./utils/importio/libimportio.a \ ./utils/iodevices/libiodevices.a \ ./foreign/PHEMlight/cpp/libphemlight.a \ ./foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ $(XERCES_LIBS) @@ -31,10 +28,7 @@ od2trips_LDADD = ./od/libod.a \ ./utils/options/liboptions.a \ -./utils/distribution/libdistribution.a \ ./utils/vehicle/libvehicle.a \ -./utils/common/libcommon.a \ -./utils/geom/libgeom.a \ $(COMMON_LIBS) $(XERCES_LDFLAGS) @@ -52,7 +46,6 @@ ./microsim/traffic_lights/libmicrosimtls.a \ ./microsim/pedestrians/libmicrosimpeds.a \ ./mesosim/libmesosim.a \ -./utils/geom/libgeom.a \ ./utils/vehicle/libvehicle.a \ ./utils/shapes/libshapes.a \ ./utils/emissions/libemissions.a \ @@ -70,8 +63,6 @@ ./netimport/vissim/tempstructs/libvissimtmpstr.a \ ./netbuild/libnetbuild.a \ ./netwrite/libnetwrite.a \ -./utils/distribution/libdistribution.a \ -./utils/geom/libgeom.a \ ./foreign/eulerspiral/libeulerspiral.a \ $(COMMON_LIBS) \ $(XERCES_LDFLAGS) $(GDAL_LDFLAGS) $(PROJ_LDFLAGS) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/30_add_missing_link.patch/src/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/30_add_missing_link.patch/src/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/30_add_missing_link.patch/src/Makefile.in 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/30_add_missing_link.patch/src/Makefile.in 2017-07-23 16:22:07.000000000 +0000 @@ -99,16 +99,16 @@ netconvert_OBJECTS = $(am_netconvert_OBJECTS) am__DEPENDENCIES_1 = am__DEPENDENCIES_2 = ./utils/options/liboptions.a ./utils/xml/libxml.a \ + ./utils/distribution/libdistribution.a ./utils/geom/libgeom.a \ ./utils/common/libcommon.a ./utils/importio/libimportio.a \ ./utils/iodevices/libiodevices.a \ ./foreign/PHEMlight/cpp/libphemlight.a \ - ./foreign/tcpip/libtcpip.a $(MEM_LIBS) $(am__DEPENDENCIES_1) + ./foreign/tcpip/libtcpip.a $(am__DEPENDENCIES_1) netconvert_DEPENDENCIES = ./netimport/libnetimport.a \ ./netimport/vissim/libvissimimport.a \ ./netimport/vissim/typeloader/libvissimtypeload.a \ ./netimport/vissim/tempstructs/libvissimtmpstr.a \ ./netbuild/libnetbuild.a ./netwrite/libnetwrite.a \ - ./utils/distribution/libdistribution.a ./utils/geom/libgeom.a \ ./foreign/eulerspiral/libeulerspiral.a $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) @@ -119,9 +119,7 @@ am_od2trips_OBJECTS = od2trips_main.$(OBJEXT) od2trips_OBJECTS = $(am_od2trips_OBJECTS) od2trips_DEPENDENCIES = ./od/libod.a ./utils/options/liboptions.a \ - ./utils/distribution/libdistribution.a \ - ./utils/vehicle/libvehicle.a ./utils/common/libcommon.a \ - ./utils/geom/libgeom.a $(am__DEPENDENCIES_2) \ + ./utils/vehicle/libvehicle.a $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) am_sumo_OBJECTS = sumo_main.$(OBJEXT) sumo_OBJECTS = $(am_sumo_OBJECTS) @@ -135,10 +133,9 @@ ./microsim/actions/libmsactions.a \ ./microsim/traffic_lights/libmicrosimtls.a \ ./microsim/pedestrians/libmicrosimpeds.a \ - ./mesosim/libmesosim.a ./utils/geom/libgeom.a \ - ./utils/vehicle/libvehicle.a ./utils/shapes/libshapes.a \ - ./utils/emissions/libemissions.a $(TRACI_LIBS) \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ + ./mesosim/libmesosim.a ./utils/vehicle/libvehicle.a \ + ./utils/shapes/libshapes.a ./utils/emissions/libemissions.a \ + $(TRACI_LIBS) $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am__sumo_gui_SOURCES_DIST = guisim_main.cpp @@ -154,10 +151,9 @@ ./microsim/actions/libmsactions.a \ ./microsim/traffic_lights/libmicrosimtls.a \ ./microsim/pedestrians/libmicrosimpeds.a \ - ./mesosim/libmesosim.a ./utils/geom/libgeom.a \ - ./utils/vehicle/libvehicle.a ./utils/shapes/libshapes.a \ - ./utils/emissions/libemissions.a $(TRACI_LIBS) \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ + ./mesosim/libmesosim.a ./utils/vehicle/libvehicle.a \ + ./utils/shapes/libshapes.a ./utils/emissions/libemissions.a \ + $(TRACI_LIBS) $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) @WITH_GUI_TRUE@sumo_gui_DEPENDENCIES = ./gui/libgui.a \ @@ -432,26 +428,23 @@ top_srcdir = @top_srcdir@ @WITH_GUI_TRUE@GUI_APPS = sumo-gui @WITH_GUI_TRUE@GUI_DIRS = gui guinetload guisim netedit mesogui osgview -@CHECK_MEMORY_LEAKS_TRUE@MEM_LIBS = ./foreign/nvwa/libnvwa.a -@TRACI_TRUE@TRACI_LIBS = ./traci-server/libtraciserver.a ./utils/traci/libtraci.a +@TRACI_TRUE@TRACI_LIBS = ./traci-server/libtraciserver.a ./traci-server/lib/libtraci.a ./utils/traci/libtraciclient.a @TRACI_TRUE@TRACI_DIRS = traci-server traci_testclient COMMON_LIBS = ./utils/options/liboptions.a \ ./utils/xml/libxml.a \ +./utils/distribution/libdistribution.a \ +./utils/geom/libgeom.a \ ./utils/common/libcommon.a \ ./utils/importio/libimportio.a \ ./utils/iodevices/libiodevices.a \ ./foreign/PHEMlight/cpp/libphemlight.a \ ./foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ $(XERCES_LIBS) od2trips_SOURCES = od2trips_main.cpp od2trips_LDADD = ./od/libod.a \ ./utils/options/liboptions.a \ -./utils/distribution/libdistribution.a \ ./utils/vehicle/libvehicle.a \ -./utils/common/libcommon.a \ -./utils/geom/libgeom.a \ $(COMMON_LIBS) $(XERCES_LDFLAGS) sumo_SOURCES = sumo_main.cpp @@ -467,7 +460,6 @@ ./microsim/traffic_lights/libmicrosimtls.a \ ./microsim/pedestrians/libmicrosimpeds.a \ ./mesosim/libmesosim.a \ -./utils/geom/libgeom.a \ ./utils/vehicle/libvehicle.a \ ./utils/shapes/libshapes.a \ ./utils/emissions/libemissions.a \ @@ -483,8 +475,6 @@ ./netimport/vissim/tempstructs/libvissimtmpstr.a \ ./netbuild/libnetbuild.a \ ./netwrite/libnetwrite.a \ -./utils/distribution/libdistribution.a \ -./utils/geom/libgeom.a \ ./foreign/eulerspiral/libeulerspiral.a \ $(COMMON_LIBS) \ $(XERCES_LDFLAGS) $(GDAL_LDFLAGS) $(PROJ_LDFLAGS) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/40_drop_some_buildflags.patch/configure.ac sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/40_drop_some_buildflags.patch/configure.ac --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/40_drop_some_buildflags.patch/configure.ac 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/40_drop_some_buildflags.patch/configure.ac 2017-07-23 16:22:07.000000000 +0000 @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(sumo, 0.28.0) +AC_INIT(sumo, 0.30.0) AC_CONFIG_SRCDIR(src/sumo_main.cpp) AC_CANONICAL_SYSTEM @@ -64,43 +64,8 @@ AM_PROG_LIBTOOL -dnl Check for enable-features that shall go into config.h -AC_ARG_ENABLE([memcheck], [AS_HELP_STRING([--enable-memcheck],[enable compilation of memory leak checks [default=no].])]) -if test x$enable_memcheck = xyes; then - if test x$CXX = xclang++; then - AC_MSG_WARN([--enable-memcheck does not work with clang yet]) - enable_memcheck="no" - fi -fi -AM_CONDITIONAL(CHECK_MEMORY_LEAKS, test x$enable_memcheck = xyes) -if test x$enable_memcheck = xyes; then - AC_DEFINE(CHECK_MEMORY_LEAKS, 1, [Define to 1 in order to enable memory checks.]) - ac_enabled="$ac_enabled MemoryChecks" -else - ac_disabled="$ac_disabled MemoryChecks" -fi - -AC_ARG_ENABLE([internal-lanes], [AS_HELP_STRING([--disable-internal-lanes],[Disable junction internal lanes.])]) -if test x$enable_internal_lanes != xno; then - AC_DEFINE(HAVE_INTERNAL_LANES, 1, [Define to 1 if you want junction internal lanes]) - ac_enabled="$ac_enabled InternalLanes" -else - ac_disabled="$ac_disabled InternalLanes" -fi - -AC_ARG_ENABLE([double-precision], [AS_HELP_STRING([--disable-double-precision],[Use "float" instead of "double" for calculations.])]) -if test x$enable_double_precision != xno; then - AC_DEFINE([SUMOReal], [double], [defines the precision of floats]) - ac_enabled="$ac_enabled DoublePrecision" -else - AC_DEFINE([SUMOReal], [float], [defines the precision of floats]) - ac_disabled="$ac_disabled DoublePrecision" -fi - -AC_DEFINE([POSITION_EPS], [(SUMOReal)0.1], [defines the epsilon to use on position comparison]) -AC_DEFINE([NUMERICAL_EPS], [(SUMOReal)0.001], [defines the epsilon to use on general floating point comparison]) -AC_DEFINE([OUTPUT_ACCURACY], [2], [defines the number of digits after the comma in output]) -AC_DEFINE([GEO_OUTPUT_ACCURACY], [6], [defines the number of digits after the comma in geo-coordinates output]) +AC_DEFINE([POSITION_EPS], [0.1], [defines the epsilon to use on position comparison]) +AC_DEFINE([NUMERICAL_EPS], [0.001], [defines the epsilon to use on general floating point comparison]) AC_ARG_ENABLE([traci],[AS_HELP_STRING([--disable-traci],[disable Traffic Control Interface (TraCI) Server [default=no].])]) AM_CONDITIONAL(TRACI, test x$enable_traci != xno) @@ -476,7 +441,6 @@ src/foreign/Makefile src/foreign/eulerspiral/Makefile src/foreign/mersenne/Makefile -src/foreign/nvwa/Makefile src/foreign/PHEMlight/Makefile src/foreign/PHEMlight/cpp/Makefile src/foreign/polyfonts/Makefile @@ -518,6 +482,7 @@ src/tools/Makefile src/traci_testclient/Makefile src/traci-server/Makefile +src/traci-server/lib/Makefile src/utils/Makefile src/utils/common/Makefile src/utils/distribution/Makefile diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/60_fix_format_not_a_string.patch/src/netedit/GNEViewNet.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/60_fix_format_not_a_string.patch/src/netedit/GNEViewNet.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/60_fix_format_not_a_string.patch/src/netedit/GNEViewNet.cpp 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/60_fix_format_not_a_string.patch/src/netedit/GNEViewNet.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,1797 +0,0 @@ -/****************************************************************************/ -/// @file GNEViewNet.cpp -/// @author Jakob Erdmann -/// @date Feb 2011 -/// @version $Id: GNEViewNet.cpp 21851 2016-10-31 12:20:12Z behrisch $ -/// -// A view on the network being edited (adapted from GUIViewTraffic) -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ - - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "GNEViewNet.h" -#include "GNEEdge.h" -#include "GNELane.h" -#include "GNEJunction.h" -#include "GNEPOI.h" -#include "GNEApplicationWindow.h" -#include "GNEViewParent.h" -#include "GNENet.h" -#include "GNEUndoList.h" -#include "GNEInspectorFrame.h" -#include "GNESelectorFrame.h" -#include "GNEConnectorFrame.h" -#include "GNETLSEditorFrame.h" -#include "GNEAdditionalFrame.h" -#include "GNEAdditionalHandler.h" -#include "GNEPoly.h" -#include "GNECrossing.h" -#include "GNEAdditional.h" -#include "GNEAdditionalSet.h" -#include "GNEAdditionalDialog.h" -#include "GNERerouter.h" -#include "GNEConnection.h" - - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - -// =========================================================================== -// FOX callback mapping -// =========================================================================== -FXDEFMAP(GNEViewNet) GNEViewNetMap[] = { - FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_CHANGE, GNEViewNet::onCmdChangeMode), - FXMAPFUNC(SEL_COMMAND, MID_GNE_SPLIT_EDGE, GNEViewNet::onCmdSplitEdge), - FXMAPFUNC(SEL_COMMAND, MID_GNE_SPLIT_EDGE_BIDI, GNEViewNet::onCmdSplitEdgeBidi), - FXMAPFUNC(SEL_COMMAND, MID_GNE_REVERSE_EDGE, GNEViewNet::onCmdReverseEdge), - FXMAPFUNC(SEL_COMMAND, MID_GNE_ADD_REVERSE_EDGE, GNEViewNet::onCmdAddReversedEdge), - FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_EDGE_ENDPOINT, GNEViewNet::onCmdSetEdgeEndpoint), - FXMAPFUNC(SEL_COMMAND, MID_GNE_RESET_EDGE_ENDPOINT, GNEViewNet::onCmdResetEdgeEndpoint), - FXMAPFUNC(SEL_COMMAND, MID_GNE_STRAIGHTEN, GNEViewNet::onCmdStraightenEdges), - FXMAPFUNC(SEL_COMMAND, MID_GNE_SIMPLIFY_SHAPE, GNEViewNet::onCmdSimplifyShape), - FXMAPFUNC(SEL_COMMAND, MID_GNE_DELETE_GEOMETRY, GNEViewNet::onCmdDeleteGeometry), - FXMAPFUNC(SEL_COMMAND, MID_GNE_DUPLICATE_LANE, GNEViewNet::onCmdDuplicateLane), - FXMAPFUNC(SEL_COMMAND, MID_GNE_TRANSFORM_LANE_SIDEWALK, GNEViewNet::onCmdRestrictLaneSidewalk), - FXMAPFUNC(SEL_COMMAND, MID_GNE_TRANSFORM_LANE_BIKE, GNEViewNet::onCmdRestrictLaneBikelane), - FXMAPFUNC(SEL_COMMAND, MID_GNE_TRANSFORM_LANE_BUS, GNEViewNet::onCmdRestrictLaneBuslane), - FXMAPFUNC(SEL_COMMAND, MID_GNE_REVERT_TRANSFORMATION, GNEViewNet::onCmdRevertRestriction), - FXMAPFUNC(SEL_COMMAND, MID_GNE_ADD_LANE_SIDEWALK, GNEViewNet::onCmdAddRestrictedLaneSidewalk), - FXMAPFUNC(SEL_COMMAND, MID_GNE_ADD_LANE_BIKE, GNEViewNet::onCmdAddRestrictedLaneBikelane), - FXMAPFUNC(SEL_COMMAND, MID_GNE_ADD_LANE_BUS, GNEViewNet::onCmdAddRestrictedLaneBuslane), - FXMAPFUNC(SEL_COMMAND, MID_GNE_REMOVE_LANE_SIDEWALK, GNEViewNet::onCmdRemoveRestrictedLaneSidewalk), - FXMAPFUNC(SEL_COMMAND, MID_GNE_REMOVE_LANE_BIKE, GNEViewNet::onCmdRemoveRestrictedLaneBikelane), - FXMAPFUNC(SEL_COMMAND, MID_GNE_REMOVE_LANE_BUS, GNEViewNet::onCmdRemoveRestrictedLaneBuslane), - FXMAPFUNC(SEL_COMMAND, MID_GNE_NODE_SHAPE, GNEViewNet::onCmdNodeShape), - FXMAPFUNC(SEL_COMMAND, MID_GNE_NODE_REPLACE, GNEViewNet::onCmdNodeReplace), - FXMAPFUNC(SEL_COMMAND, MID_GNE_SHOW_CONNECTIONS, GNEViewNet::onCmdToogleShowConnection), - FXMAPFUNC(SEL_COMMAND, MID_GNE_SHOW_BUBBLES, GNEViewNet::onCmdToogleShowBubbles) -}; - -// Object implementation -FXIMPLEMENT(GNEViewNet, GUISUMOAbstractView, GNEViewNetMap, ARRAYNUMBER(GNEViewNetMap)) - -// =========================================================================== -// member method definitions -// =========================================================================== -GNEViewNet::GNEViewNet(FXComposite* tmpParent, FXComposite* actualParent, GUIMainWindow& app, - GNEViewParent* viewParent, GNENet* net, GNEUndoList* undoList, - FXGLVisual* glVis, FXGLCanvas* share, FXToolBar* toolBar) : - GUISUMOAbstractView(tmpParent, app, viewParent, net->getVisualisationSpeedUp(), glVis, share), - myViewParent(viewParent), - myNet(net), - myEditMode(GNE_MODE_MOVE), - myPreviousEditMode(GNE_MODE_MOVE), - myShowConnectionActivated(false), - myCreateEdgeSource(0), - myJunctionToMove(0), - myEdgeToMove(0), - myPolyToMove(0), - myAdditionalToMove(0), - myMoveSelection(false), - myAmInRectSelect(false), - myToolbar(toolBar), - myEditModesCombo(0), - myEditModeNames(), - myUndoList(undoList), - myCurrentPoly(0) { - // view must be the final member of actualParent - reparent(actualParent); - - buildEditModeControls(); - myUndoList->mark(); - myNet->setViewNet(this); - - ((GUIDanielPerspectiveChanger*)myChanger)->setDragDelay(100000000); // 100 milliseconds - - // init color schemes - GUIColorer laneColorer; - GUIColorScheme scheme = GUIColorScheme("uniform", RGBColor::BLACK, "road", true); - scheme.addColor(RGBColor::GREY, 1, "Sidewalk"); - scheme.addColor(RGBColor(192, 66, 44), 2, "bike lane"); - scheme.addColor(RGBColor(200, 255, 200), 3, "green verge"); - scheme.addColor(RGBColor(150, 200, 200), 4, "waterway"); - scheme.addColor(RGBColor(92, 92, 92), 5, "no passenger"); // paths, service roads etc - laneColorer.addScheme(scheme); - scheme = GUIColorScheme("by selection (lane-/streetwise)", RGBColor(128, 128, 128, 255), "unselected", true); - scheme.addColor(RGBColor(0, 80, 180, 255), 1, "selected"); - laneColorer.addScheme(scheme); - scheme = GUIColorScheme("by permission code", RGBColor(240, 240, 240), "nobody"); - scheme.addColor(RGBColor(10, 10, 10), (SUMOReal)SVC_PASSENGER, "passenger"); - scheme.addColor(RGBColor(128, 128, 128), (SUMOReal)SVC_PEDESTRIAN, "pedestrian"); - scheme.addColor(RGBColor(80, 80, 80), (SUMOReal)(SVC_PEDESTRIAN | SVC_DELIVERY), "pedestrian_delivery"); - scheme.addColor(RGBColor(192, 66, 44), (SUMOReal)SVC_BICYCLE, "bicycle"); - scheme.addColor(RGBColor(40, 100, 40), (SUMOReal)SVC_BUS, "bus"); - scheme.addColor(RGBColor(166, 147, 26), (SUMOReal)SVC_TAXI, "taxi"); - scheme.addColor(RGBColor::BLACK, (SUMOReal)(SVCAll & ~SVC_NON_ROAD), "normal_road"); - scheme.addColor(RGBColor::BLACK, (SUMOReal)(SVCAll & ~(SVC_PEDESTRIAN | SVC_NON_ROAD)), "disallow_pedestrian"); - scheme.addColor(RGBColor(255, 206, 0), (SUMOReal)(SVCAll & ~(SVC_PEDESTRIAN | SVC_BICYCLE | SVC_MOPED | SVC_NON_ROAD)), "motorway"); - scheme.addColor(RGBColor(150, 200, 200), (SUMOReal)SVC_SHIP, "waterway"); - scheme.addColor(RGBColor::GREEN, (SUMOReal)SVCAll, "all"); - laneColorer.addScheme(scheme); - - scheme = GUIColorScheme("by allowed speed (lanewise)", RGBColor::RED); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)(30 / 3.6)); - scheme.addColor(RGBColor::GREEN, (SUMOReal)(55 / 3.6)); - scheme.addColor(RGBColor::CYAN, (SUMOReal)(80 / 3.6)); - scheme.addColor(RGBColor::BLUE, (SUMOReal)(120 / 3.6)); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)(150 / 3.6)); - laneColorer.addScheme(scheme); - - scheme = GUIColorScheme("by lane number (streetwise)", RGBColor::RED); - scheme.addColor(RGBColor::BLUE, (SUMOReal)5); - laneColorer.addScheme(scheme); - - scheme = GUIColorScheme("by given length/geometrical length", RGBColor::BLACK); - scheme.addColor(RGBColor::RED, (SUMOReal)0.25); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)0.5); - scheme.addColor(RGBColor(179, 179, 179, 255), (SUMOReal)1.0); - scheme.addColor(RGBColor::GREEN, (SUMOReal)2.0); - scheme.addColor(RGBColor::BLUE, (SUMOReal)4.0); - laneColorer.addScheme(scheme); - laneColorer.addScheme(GUIColorScheme("by angle", RGBColor::YELLOW, "", true)); - - scheme = GUIColorScheme("by priority", RGBColor::YELLOW); - scheme.addColor(RGBColor::RED, (SUMOReal) - 20); - scheme.addColor(RGBColor::GREEN, (SUMOReal)20); - scheme.setAllowsNegativeValues(true); - laneColorer.addScheme(scheme); - scheme = GUIColorScheme("by height at start", RGBColor::RED); - scheme.addColor(RGBColor::BLUE, (SUMOReal) - 10); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)50); - scheme.addColor(RGBColor::GREEN, (SUMOReal)100); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)200); - scheme.setAllowsNegativeValues(true); - laneColorer.addScheme(scheme); - scheme = GUIColorScheme("by height at segment start", RGBColor::RED); - scheme.addColor(RGBColor::BLUE, (SUMOReal) - 10); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)50); - scheme.addColor(RGBColor::GREEN, (SUMOReal)100); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)200); - scheme.setAllowsNegativeValues(true); - laneColorer.addScheme(scheme); - scheme = GUIColorScheme("by inclination", RGBColor::GREY); - scheme.addColor(RGBColor::YELLOW, (SUMOReal) .1); - scheme.addColor(RGBColor::RED, (SUMOReal) .3); - scheme.addColor(RGBColor::GREEN, (SUMOReal) - .1); - scheme.addColor(RGBColor::BLUE, (SUMOReal) - .3); - scheme.setAllowsNegativeValues(true); - laneColorer.addScheme(scheme); - scheme = GUIColorScheme("by segment inclination", RGBColor::GREY); - scheme.addColor(RGBColor::YELLOW, (SUMOReal) .1); - scheme.addColor(RGBColor::RED, (SUMOReal) .3); - scheme.addColor(RGBColor::GREEN, (SUMOReal) - .1); - scheme.addColor(RGBColor::BLUE, (SUMOReal) - .3); - scheme.setAllowsNegativeValues(true); - laneColorer.addScheme(scheme); - - myVisualizationSettings->laneColorer = laneColorer; - - GUIColorer junctionColorer; - scheme = GUIColorScheme("uniform", RGBColor(102, 0, 0), "", true); - scheme.addColor(RGBColor(204, 0, 0), 1, "shape not computed"); - scheme.addColor(RGBColor(153, 0, 0), 2, "geometry points"); - junctionColorer.addScheme(scheme); - scheme = GUIColorScheme("by selection", RGBColor(128, 128, 128, 255), "unselected", true); - scheme.addColor(RGBColor(0, 80, 180, 255), 1, "selected"); - junctionColorer.addScheme(scheme); - scheme = GUIColorScheme("by type", RGBColor::GREEN, "traffic_light", true); - scheme.addColor(RGBColor(0, 128, 0), 1, "traffic_light_unregulated"); - scheme.addColor(RGBColor::YELLOW, 2, "priority"); - scheme.addColor(RGBColor::RED, 3, "priority_stop"); - scheme.addColor(RGBColor::BLUE, 4, "right_before_left"); - scheme.addColor(RGBColor::CYAN, 5, "allway_stop"); - scheme.addColor(RGBColor::GREY, 6, "district"); - scheme.addColor(RGBColor::MAGENTA, 7, "unregulated"); - scheme.addColor(RGBColor::BLACK, 8, "dead_end"); - scheme.addColor(RGBColor::ORANGE, 9, "rail_signal"); - scheme.addColor(RGBColor(192, 128, 64), 10, "zipper"); - scheme.addColor(RGBColor(192, 255, 192), 11, "traffic_light_right_on_red"); - scheme.addColor(RGBColor(128, 0, 128), 12, "rail_crossing"); // dark purple - junctionColorer.addScheme(scheme); - myVisualizationSettings->junctionColorer = junctionColorer; -} - - -GNEViewNet::~GNEViewNet() { } - - -void -GNEViewNet::doInit() {} - - -void -GNEViewNet::buildViewToolBars(GUIGlChildWindow& cw) { - /* - // build coloring tools - { - const std::vector &names = gSchemeStorage.getNames(); - for (std::vector::const_iterator i=names.begin(); i!=names.end(); ++i) { - v.getColoringSchemesCombo().appendItem((*i).c_str()); - if ((*i) == myVisualizationSettings->name) { - v.getColoringSchemesCombo().setCurrentItem(v.getColoringSchemesCombo().getNumItems()-1); - } - } - v.getColoringSchemesCombo().setNumVisible(5); - } - */ - - // locator button for junctions - new FXButton(cw.getLocatorPopup(), - "\tLocate Junction\tLocate a junction within the network.", - GUIIconSubSys::getIcon(ICON_LOCATEJUNCTION), &cw, MID_LOCATEJUNCTION, - ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED); - // locator button for edges - new FXButton(cw.getLocatorPopup(), - "\tLocate Street\tLocate a street within the network.", - GUIIconSubSys::getIcon(ICON_LOCATEEDGE), &cw, MID_LOCATEEDGE, - ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED); - // locator button for tls - new FXButton(cw.getLocatorPopup(), - "\tLocate TLS\tLocate a traffic light within the network.", - GUIIconSubSys::getIcon(ICON_LOCATETLS), &cw, MID_LOCATETLS, - ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED); -} - - -bool -GNEViewNet::setColorScheme(const std::string& name) { - if (!gSchemeStorage.contains(name)) { - return false; - } - if (myVisualizationChanger != 0) { - if (myVisualizationChanger->getCurrentScheme() != name) { - myVisualizationChanger->setCurrentScheme(name); - } - } - myVisualizationSettings = &gSchemeStorage.get(name.c_str()); - update(); - return true; -} - - -void -GNEViewNet::setStatusBarText(const std::string& text) { - myApp->setStatusBarText(text); -} - - -bool -GNEViewNet::selectEdges() { - return mySelectEdges->getCheck() != 0; -} - - -bool -GNEViewNet::showConnections() { - if (myEditMode == GNE_MODE_CONNECT) { - return true; - } else if (myShowConnections->shown() == false) { - return false; - } else { - return (myShowConnections->getCheck() == 1); - } -} - - -bool -GNEViewNet::autoSelectNodes() { - return myExtendToEdgeNodes->getCheck() != 0; -} - - -void -GNEViewNet::setSelectionScaling(SUMOReal selectionScale) { - myVisualizationSettings->selectionScale = selectionScale; -} - - -bool -GNEViewNet::changeAllPhases() const { - return myChangeAllPhases->getCheck() != FALSE; -} - - -bool -GNEViewNet::showJunctionAsBubbles() const { - return (myEditMode == GNE_MODE_MOVE) && (myShowJunctionAsBubble->getCheck()); -} - - -int -GNEViewNet::doPaintGL(int mode, const Boundary& bound) { - // init view settings - glRenderMode(mode); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glDisable(GL_TEXTURE_2D); - glDisable(GL_ALPHA_TEST); - glDisable(GL_BLEND); - glEnable(GL_DEPTH_TEST); - - // visualize rectangular selection - if (myAmInRectSelect) { - glPushMatrix(); - glTranslated(0, 0, GLO_MAX - 1); - GLHelper::setColor(GNENet::selectionColor); - glLineWidth(2); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - glBegin(GL_QUADS); - glVertex2d(mySelCorner1.x(), mySelCorner1.y()); - glVertex2d(mySelCorner1.x(), mySelCorner2.y()); - glVertex2d(mySelCorner2.x(), mySelCorner2.y()); - glVertex2d(mySelCorner2.x(), mySelCorner1.y()); - glEnd(); - glPopMatrix(); - } - - // compute lane width - SUMOReal lw = m2p(SUMO_const_laneWidth); - // draw decals (if not in grabbing mode) - if (!myUseToolTips) { - drawDecals(); - if (myVisualizationSettings->showGrid) { - paintGLGrid(); - } - } - glLineWidth(1); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - const float minB[2] = { (float)bound.xmin(), (float)bound.ymin() }; - const float maxB[2] = { (float)bound.xmax(), (float)bound.ymax() }; - myVisualizationSettings->scale = lw; - glEnable(GL_POLYGON_OFFSET_FILL); - glEnable(GL_POLYGON_OFFSET_LINE); - myVisualizationSettings->editMode = myEditMode; - int hits2 = myGrid->Search(minB, maxB, *myVisualizationSettings); - - glTranslated(0, 0, GLO_ADDITIONAL); - for (std::map::iterator i = myAdditionallyDrawn.begin(); i != myAdditionallyDrawn.end(); ++i) { - (i->first)->drawGLAdditional(this, *myVisualizationSettings); - } - glPopMatrix(); - return hits2; -} - - -long -GNEViewNet::onLeftBtnPress(FXObject* obj, FXSelector sel, void* data) { - FXEvent* e = (FXEvent*) data; - setFocus(); - // interpret object under curser - if (makeCurrent()) { - int id = getObjectUnderCursor(); - GUIGlObject* pointed = GUIGlObjectStorage::gIDStorage.getObjectBlocking(id); - GUIGlObjectStorage::gIDStorage.unblockObject(id); - GNEJunction* pointed_junction = 0; - GNELane* pointed_lane = 0; - GNEEdge* pointed_edge = 0; - GNEPOI* pointed_poi = 0; - GNEPoly* pointed_poly = 0; - GNECrossing* pointed_crossing = 0; - GNEAdditional* pointed_additional = 0; - GNEConnection* pointed_connection = 0; - if (pointed) { - switch (pointed->getType()) { - case GLO_JUNCTION: - pointed_junction = (GNEJunction*)pointed; - break; - case GLO_EDGE: - pointed_edge = (GNEEdge*)pointed; - break; - case GLO_LANE: - pointed_lane = (GNELane*)pointed; - pointed_edge = &(pointed_lane->getParentEdge()); - break; - case GLO_POI: - pointed_poi = (GNEPOI*)pointed; - break; - case GLO_POLYGON: - pointed_poly = (GNEPoly*)pointed; - break; - case GLO_CROSSING: - pointed_crossing = (GNECrossing*)pointed; - break; - case GLO_ADDITIONAL: - pointed_additional = (GNEAdditional*)pointed; - break; - case GLO_CONNECTION: - pointed_connection = (GNEConnection*)pointed; - break; - default: - pointed = 0; - break; - } - } - - // decide what to do based on mode - switch (myEditMode) { - case GNE_MODE_CREATE_EDGE: - if ((e->state & CONTROLMASK) == 0) { - // allow moving when control is held down - if (!myUndoList->hasCommandGroup()) { - myUndoList->p_begin("create new edge"); - } - if (!pointed_junction) { - pointed_junction = myNet->createJunction(getPositionInformation(), myUndoList); - } - if (myCreateEdgeSource == 0) { - myCreateEdgeSource = pointed_junction; - myCreateEdgeSource->markAsCreateEdgeSource(); - update(); - } else { - if (myCreateEdgeSource != pointed_junction) { - // may fail to prevent double edges - GNEEdge* newEdge = myNet->createEdge( - myCreateEdgeSource, pointed_junction, myViewParent->getInspectorFrame()->getEdgeTemplate(), myUndoList); - if (newEdge) { - if (myAutoCreateOppositeEdge->getCheck()) { - myNet->createEdge( - pointed_junction, myCreateEdgeSource, myViewParent->getInspectorFrame()->getEdgeTemplate(), myUndoList, "-" + newEdge->getNBEdge()->getID()); - } - myCreateEdgeSource->unMarkAsCreateEdgeSource(); - if (myUndoList->hasCommandGroup()) { - myUndoList->p_end(); - } else { - std::cout << "edge created without an open CommandGroup )-:\n"; - } - if (myChainCreateEdge->getCheck()) { - myCreateEdgeSource = pointed_junction; - myCreateEdgeSource->markAsCreateEdgeSource(); - myUndoList->p_begin("create new edge"); - } else { - myCreateEdgeSource = 0; - } - } else { - setStatusBarText("An edge with the same geometry already exists!"); - } - } else { - setStatusBarText("Start- and endpoint for an edge must be distinct!"); - } - update(); - } - } - GUISUMOAbstractView::onLeftBtnPress(obj, sel, data); - break; - - case GNE_MODE_MOVE: - if (pointed_poly) { - myPolyToMove = pointed_poly; - myMoveSrc = getPositionInformation(); - } else if (pointed_junction) { - if (gSelected.isSelected(GLO_JUNCTION, pointed_junction->getGlID())) { - myMoveSelection = true; - } else { - myJunctionToMove = pointed_junction; - } - myMoveSrc = getPositionInformation(); - } else if (pointed_edge) { - if (gSelected.isSelected(GLO_EDGE, pointed_edge->getGlID())) { - myMoveSelection = true; - } else { - myEdgeToMove = pointed_edge; - } - myMoveSrc = getPositionInformation(); - } else if (pointed_additional) { - if (gSelected.isSelected(GLO_ADDITIONAL, pointed_additional->getGlID())) { - myMoveSelection = true; - } else { - // Only move additional if can be moved - if (pointed_additional->isAdditionalBlocked() == false) { - myAdditionalToMove = pointed_additional; - if (myAdditionalToMove->getLane()) { - if (GNEAttributeCarrier::hasAttribute(myAdditionalToMove->getTag(), SUMO_ATTR_STARTPOS)) { - // Obtain start position - SUMOReal startPos = GNEAttributeCarrier::parse(myAdditionalToMove->getAttribute(SUMO_ATTR_STARTPOS)); - if (GNEAttributeCarrier::hasAttribute(myAdditionalToMove->getTag(), SUMO_ATTR_ENDPOS)) { - // Obtain end position - SUMOReal endPos = GNEAttributeCarrier::parse(myAdditionalToMove->getAttribute(SUMO_ATTR_ENDPOS)); - // Save both values in myOldAdditionalPosition - myOldAdditionalPosition.set(startPos, endPos); - } else if (GNEAttributeCarrier::hasAttribute(myAdditionalToMove->getTag(), SUMO_ATTR_LENGTH)) { - // Obtain length attribute - SUMOReal length = GNEAttributeCarrier::parse(myAdditionalToMove->getAttribute(SUMO_ATTR_LENGTH)); - // Save both values in myOldAdditionalPosition - myOldAdditionalPosition.set(startPos, length); - } else { - // Save only startpos in myOldAdditionalPosition - myOldAdditionalPosition.set(startPos, 0); - } - } - // Set myAdditionalMovingReference - myAdditionalMovingReference.set(pointed_additional->getLane()->getShape().nearest_offset_to_point2D(getPositionInformation(), false), 0, 0); - } else { - // Set myOldAdditionalPosition and myAdditionalMovingReference - myOldAdditionalPosition = getPositionInformation(); - myAdditionalMovingReference = pointed_additional->getPositionInView() - getPositionInformation(); - } - } - } - } else { - GUISUMOAbstractView::onLeftBtnPress(obj, sel, data); - } - update(); - break; - - case GNE_MODE_DELETE: - if (pointed_junction) { - /* - if (gSelected.isSelected(GLO_JUNCTION, pointed_junction->getGlID())) { - deleteSelectedJunctions(); - } - */ - myNet->deleteJunction(pointed_junction, myUndoList); - } else if (pointed_lane && !mySelectEdges->getCheck()) { - myNet->deleteLane(pointed_lane, myUndoList); - } else if (pointed_edge) { - /* - if (gSelected.isSelected(GLO_EDGE, pointed_edge->getGlID())) { - deleteSelectedEdges(); - } - */ - myNet->deleteGeometryOrEdge(pointed_edge, getPositionInformation(), myUndoList); - } else if (pointed_poi) { - // XXX this is a dirty dirty hack! implemente GNEChange_POI - myNet->getShapeContainer().removePOI(pointed_poi->getMicrosimID()); - update(); - } else if (pointed_additional) { - myViewParent->getAdditionalFrame()->removeAdditional(pointed_additional); - update(); - } else if (pointed_connection) { - myNet->deleteConnection(pointed_connection, myUndoList); - update(); - } else { - GUISUMOAbstractView::onLeftBtnPress(obj, sel, data); - } - break; - - case GNE_MODE_INSPECT: { - GNEAttributeCarrier* pointedAC = 0; - GUIGlObject* pointedO = 0; - if (pointed_junction) { - pointedAC = pointed_junction; - pointedO = pointed_junction; - } else if (pointed_lane) { // implies pointed_edge - if (selectEdges()) { - pointedAC = pointed_edge; - pointedO = pointed_edge; - } else { - pointedAC = pointed_lane; - pointedO = pointed_lane; - } - } else if (pointed_edge) { - pointedAC = pointed_edge; - pointedO = pointed_edge; - } else if (pointed_crossing) { - pointedAC = pointed_crossing; - pointedO = pointed_crossing; - } else if (pointed_additional) { - pointedAC = pointed_additional; - pointedO = pointed_additional; - } else if (pointed_connection) { - pointedAC = pointed_connection; - pointedO = pointed_connection; - } - - std::vector selected; - if (pointedO && gSelected.isSelected(pointedO->getType(), pointedO->getGlID())) { - std::set selectedIDs = gSelected.getSelected(pointedO->getType()); - selected = myNet->retrieveAttributeCarriers(selectedIDs, pointedO->getType()); - } else if (pointedAC != 0) { - selected.push_back(pointedAC); - } - myViewParent->getInspectorFrame()->inspect(selected); - GUISUMOAbstractView::onLeftBtnPress(obj, sel, data); - update(); - break; - } - - case GNE_MODE_SELECT: - if (pointed_lane && selectEdges()) { - gSelected.toggleSelection(pointed_edge->getGlID()); - } else if (pointed) { - gSelected.toggleSelection(pointed->getGlID()); - } - - myAmInRectSelect = (((FXEvent*)data)->state & SHIFTMASK) != 0; - if (myAmInRectSelect) { - mySelCorner1 = getPositionInformation(); - mySelCorner2 = getPositionInformation(); - } else { - GUISUMOAbstractView::onLeftBtnPress(obj, sel, data); - } - update(); - break; - - case GNE_MODE_CONNECT: - if (pointed_lane) { - const bool mayPass = (((FXEvent*)data)->state & SHIFTMASK) != 0; - const bool allowConflict = (((FXEvent*)data)->state & CONTROLMASK) != 0; - myViewParent->getConnectorFrame()->handleLaneClick(pointed_lane, mayPass, allowConflict, true); - update(); - } - GUISUMOAbstractView::onLeftBtnPress(obj, sel, data); - break; - - case GNE_MODE_TLS: - if (pointed_junction) { - myViewParent->getTLSEditorFrame()->editJunction(pointed_junction); - update(); - } - GUISUMOAbstractView::onLeftBtnPress(obj, sel, data); - break; - - case GNE_MODE_ADDITIONAL: - if (pointed_additional == NULL) { - GNENetElement* netElement = dynamic_cast(pointed); - if (myViewParent->getAdditionalFrame()->addAdditional(netElement, this)) { - update(); - } - } - GUISUMOAbstractView::onLeftBtnPress(obj, sel, data); - break; - - default: - GUISUMOAbstractView::onLeftBtnPress(obj, sel, data); - } - makeNonCurrent(); - } - return 1; -} - - -long -GNEViewNet::onLeftBtnRelease(FXObject* obj, FXSelector sel, void* data) { - GUISUMOAbstractView::onLeftBtnRelease(obj, sel, data); - if (myPolyToMove) { - myPolyToMove = 0; - } else if (myJunctionToMove) { - // position is already up to date but we must register with myUndoList - if (!mergeJunctions(myJunctionToMove)) { - myJunctionToMove->registerMove(myUndoList); - } - myJunctionToMove = 0; - } else if (myEdgeToMove) { - // shape is already up to date but we must register with myUndoList - const std::string& newShape = myEdgeToMove->getAttribute(SUMO_ATTR_SHAPE); - myEdgeToMove->setAttribute(SUMO_ATTR_SHAPE, newShape, myUndoList); - myEdgeToMove = 0; - } else if (myAdditionalToMove) { - if (myAdditionalToMove->getLane()) { - myAdditionalToMove->commmitAdditionalGeometryMoved(myOldAdditionalPosition, myUndoList); - myAdditionalToMove = 0; - } else { - myAdditionalToMove->commmitAdditionalGeometryMoved(myOldAdditionalPosition + myAdditionalMovingReference, myUndoList); - myAdditionalToMove = 0; - } - } else if (myMoveSelection) { - // positions and shapes are already up to date but we must register with myUndoList - myNet->finishMoveSelection(myUndoList); - myMoveSelection = false; - } else if (myAmInRectSelect) { - myAmInRectSelect = false; - // shift held down on mouse-down and mouse-up - if (((FXEvent*)data)->state & SHIFTMASK) { - if (makeCurrent()) { - Boundary b; - b.add(mySelCorner1); - b.add(mySelCorner2); - myViewParent->getSelectorFrame()->handleIDs(getObjectsInBoundary(b), selectEdges()); - makeNonCurrent(); - } - } - update(); - } - return 1; -} - - -long -GNEViewNet::onDoubleClicked(FXObject*, FXSelector, void*) { - // If current edit mode is INSPECT or ADDITIONAL - if (myEditMode == GNE_MODE_INSPECT || myEditMode == GNE_MODE_ADDITIONAL) { - setFocus(); - // interpret object under curser - if (makeCurrent()) { - int id = getObjectUnderCursor(); - GUIGlObject* pointed = GUIGlObjectStorage::gIDStorage.getObjectBlocking(id); - GUIGlObjectStorage::gIDStorage.unblockObject(id); - // If there are a pointed element an is an additional - if (pointed && pointed->getType() == GLO_ADDITIONAL) { - // Obtain pointer additional an open an AdditionalDialog if item own it - GNEAdditional* pointed_additional = (GNEAdditional*)pointed; - pointed_additional->openAdditionalDialog(); - } - makeNonCurrent(); - } - } - return 1; -} - - -long -GNEViewNet::onMouseMove(FXObject* obj, FXSelector sel, void* data) { - GUISUMOAbstractView::onMouseMove(obj, sel, data); - if (myPolyToMove) { - myMoveSrc = myPolyToMove->moveGeometry(myMoveSrc, getPositionInformation()); - } else if (myJunctionToMove) { - myJunctionToMove->move(getPositionInformation()); - } else if (myEdgeToMove) { - myMoveSrc = myEdgeToMove->moveGeometry(myMoveSrc, getPositionInformation()); - } else if (myAdditionalToMove) { - // If additional is placed over lane, move it across it - if (myAdditionalToMove->getLane()) { - SUMOReal posOfMouseOverLane = myAdditionalToMove->getLane()->getShape().nearest_offset_to_point2D(getPositionInformation(), false); - myAdditionalToMove->moveAdditionalGeometry(posOfMouseOverLane - myAdditionalMovingReference.x(), 0); - myAdditionalMovingReference.set(posOfMouseOverLane, 0, 0); - } else { - // Calculate offset movement - Position offsetPosition = getPositionInformation() - myOldAdditionalPosition; - myAdditionalToMove->moveAdditionalGeometry(myOldAdditionalPosition + offsetPosition + myAdditionalMovingReference); - } - update(); - } else if (myMoveSelection) { - Position moveTarget = getPositionInformation(); - myNet->moveSelection(myMoveSrc, moveTarget); - myMoveSrc = moveTarget; - } else if (myAmInRectSelect) { - mySelCorner2 = getPositionInformation(); - update(); - } - return 1; -} - - -void -GNEViewNet::abortOperation(bool clearSelection) { - setFocus(); // steal focus from any text fields - if (myCreateEdgeSource) { - myCreateEdgeSource->unMarkAsCreateEdgeSource(); - myCreateEdgeSource = 0; - } else if (myEditMode == GNE_MODE_SELECT) { - myAmInRectSelect = false; - if (clearSelection) { - gSelected.clear(); - } - } else if (myEditMode == GNE_MODE_CONNECT) { - myViewParent->getConnectorFrame()->onCmdCancel(0, 0, 0); - } else if (myEditMode == GNE_MODE_TLS) { - myViewParent->getTLSEditorFrame()->onCmdCancel(0, 0, 0); - } else if (myEditMode == GNE_MODE_MOVE) { - removeCurrentPoly(); - } - myUndoList->p_abort(); -} - - -void -GNEViewNet::hotkeyDel() { - if (myEditMode == GNE_MODE_CONNECT || myEditMode == GNE_MODE_TLS) { - setStatusBarText("Cannot delete in this mode"); - } else { - myUndoList->p_begin("delete selection"); - deleteSelectedJunctions(); - deleteSelectedEdges(); - myUndoList->p_end(); - } -} - - -void -GNEViewNet::hotkeyEnter() { - if (myEditMode == GNE_MODE_CONNECT) { - myViewParent->getConnectorFrame()->onCmdOK(0, 0, 0); - } else if (myEditMode == GNE_MODE_TLS) { - myViewParent->getTLSEditorFrame()->onCmdOK(0, 0, 0); - } else if (myEditMode == GNE_MODE_MOVE && myCurrentPoly != 0) { - if (myCurrentPoly->getEditedJunction() != 0) { - myCurrentPoly->getEditedJunction()->setAttribute(SUMO_ATTR_SHAPE, toString(myCurrentPoly->getShape()), myUndoList); - removeCurrentPoly(); - update(); - } - } -} - - -long -GNEViewNet::onCmdChangeMode(FXObject*, FXSelector, void* data) { - setEditMode(myEditModeNames.get((char*) data)); - return 1; -} - - -void -GNEViewNet::setEditModeFromHotkey(FXushort selid) { - switch (selid) { - case MID_GNE_MODE_CREATE_EDGE: - setEditMode(GNE_MODE_CREATE_EDGE); - break; - case MID_GNE_MODE_MOVE: - setEditMode(GNE_MODE_MOVE); - break; - case MID_GNE_MODE_DELETE: - setEditMode(GNE_MODE_DELETE); - break; - case MID_GNE_MODE_INSPECT: - setEditMode(GNE_MODE_INSPECT); - break; - case MID_GNE_MODE_SELECT: - setEditMode(GNE_MODE_SELECT); - break; - case MID_GNE_MODE_CONNECT: - setEditMode(GNE_MODE_CONNECT); - break; - case MID_GNE_MODE_TLS: - setEditMode(GNE_MODE_TLS); - break; - case MID_GNE_MODE_ADDITIONAL: - setEditMode(GNE_MODE_ADDITIONAL); - break; - default: - FXMessageBox::error(this, MBOX_OK, "invalid edit mode", "%s", "..."); - break; - } - myEditModesCombo->setCurrentItem(myEditModesCombo->findItem(myEditModeNames.getString(myEditMode).c_str())); -} - - -void -GNEViewNet::markPopupPosition() { - myPopupSpot = getPositionInformation(); -} - - -GNEViewParent* -GNEViewNet::getViewParent() const { - return myViewParent; -} - - -GNENet* -GNEViewNet::getNet() const { - return myNet; -} - - -GNEUndoList* -GNEViewNet::getUndoList() const { - return myUndoList; -} - - -EditMode -GNEViewNet::getCurrentEditMode() const { - return myEditMode; -} - - -bool -GNEViewNet::showLockIcon() const { - return (myEditMode == GNE_MODE_MOVE || myEditMode == GNE_MODE_INSPECT || myEditMode == GNE_MODE_ADDITIONAL); -} - - -GNEJunction* -GNEViewNet::getJunctionAtCursorPosition(Position& /* pos */) { - GNEJunction* junction = 0; - if (makeCurrent()) { - int id = getObjectAtPosition(myPopupSpot); - GUIGlObject* pointed = GUIGlObjectStorage::gIDStorage.getObjectBlocking(id); - GUIGlObjectStorage::gIDStorage.unblockObject(id); - if (pointed) { - switch (pointed->getType()) { - case GLO_JUNCTION: - junction = (GNEJunction*)pointed; - break; - default: - break; - } - } - } - return junction; -} - - - - -GNEEdge* -GNEViewNet::getEdgeAtCursorPosition(Position& /* pos */) { - GNEEdge* edge = 0; - if (makeCurrent()) { - int id = getObjectAtPosition(myPopupSpot); - GUIGlObject* pointed = GUIGlObjectStorage::gIDStorage.getObjectBlocking(id); - GUIGlObjectStorage::gIDStorage.unblockObject(id); - if (pointed) { - switch (pointed->getType()) { - case GLO_EDGE: - edge = (GNEEdge*)pointed; - break; - case GLO_LANE: - edge = &(((GNELane*)pointed)->getParentEdge()); - break; - default: - break; - } - } - } - return edge; -} - - -GNELane* -GNEViewNet::getLaneAtCurserPosition(Position& /* pos */) { - GNELane* lane = 0; - if (makeCurrent()) { - int id = getObjectAtPosition(myPopupSpot); - GUIGlObject* pointed = GUIGlObjectStorage::gIDStorage.getObjectBlocking(id); - GUIGlObjectStorage::gIDStorage.unblockObject(id); - if (pointed) { - if (pointed->getType() == GLO_LANE) { - lane = (GNELane*)pointed; - } - } - } - return lane; -} - - -std::set -GNEViewNet::getEdgesAtCursorPosition(Position& /* pos */) { - std::set result; - if (makeCurrent()) { - const std::vector ids = getObjectsAtPosition(myPopupSpot, 1.0); - for (std::vector::const_iterator it = ids.begin(); it != ids.end(); ++it) { - GUIGlObject* pointed = GUIGlObjectStorage::gIDStorage.getObjectBlocking(*it); - GUIGlObjectStorage::gIDStorage.unblockObject(*it); - if (pointed) { - switch (pointed->getType()) { - case GLO_EDGE: - result.insert((GNEEdge*)pointed); - break; - case GLO_LANE: - result.insert(&(((GNELane*)pointed)->getParentEdge())); - break; - default: - break; - } - } - } - } - return result; -} - - -long -GNEViewNet::onCmdSplitEdge(FXObject*, FXSelector, void*) { - GNEEdge* edge = getEdgeAtCursorPosition(myPopupSpot); - if (edge != 0) { - myNet->splitEdge(edge, edge->getSplitPos(myPopupSpot), myUndoList); - } - return 1; -} - - -long -GNEViewNet::onCmdSplitEdgeBidi(FXObject*, FXSelector, void*) { - std::set edges = getEdgesAtCursorPosition(myPopupSpot); - if (edges.size() != 0) { - myNet->splitEdgesBidi(edges, (*edges.begin())->getSplitPos(myPopupSpot), myUndoList); - } - return 1; -} - - -long -GNEViewNet::onCmdReverseEdge(FXObject*, FXSelector, void*) { - GNEEdge* edge = getEdgeAtCursorPosition(myPopupSpot); - if (edge != 0) { - myNet->reverseEdge(edge, myUndoList); - } - return 1; -} - - -long -GNEViewNet::onCmdAddReversedEdge(FXObject*, FXSelector, void*) { - GNEEdge* edge = getEdgeAtCursorPosition(myPopupSpot); - if (edge != 0) { - myNet->addReversedEdge(edge, myUndoList); - } - return 1; -} - - -long -GNEViewNet::onCmdSetEdgeEndpoint(FXObject*, FXSelector, void*) { - GNEEdge* edge = getEdgeAtCursorPosition(myPopupSpot); - if (edge != 0) { - edge->setEndpoint(myPopupSpot, myUndoList); - } - return 1; -} - - -long -GNEViewNet::onCmdResetEdgeEndpoint(FXObject*, FXSelector, void*) { - GNEEdge* edge = getEdgeAtCursorPosition(myPopupSpot); - if (edge != 0) { - edge->resetEndpoint(myPopupSpot, myUndoList); - } - return 1; -} - - -long -GNEViewNet::onCmdStraightenEdges(FXObject*, FXSelector, void*) { - GNEEdge* edge = getEdgeAtCursorPosition(myPopupSpot); - if (edge != 0) { - if (gSelected.isSelected(GLO_EDGE, edge->getGlID())) { - myUndoList->p_begin("straighten selected edges"); - std::vector edges = myNet->retrieveEdges(true); - for (std::vector::iterator it = edges.begin(); it != edges.end(); it++) { - (*it)->setAttribute(SUMO_ATTR_SHAPE, "", myUndoList); - } - myUndoList->p_end(); - } else { - myUndoList->p_begin("straighten edge"); - edge->setAttribute(SUMO_ATTR_SHAPE, "", myUndoList); - myUndoList->p_end(); - } - } - return 1; -} - - -long -GNEViewNet::onCmdSimplifyShape(FXObject*, FXSelector, void*) { - if (myCurrentPoly != 0) { - myCurrentPoly->simplifyShape(); - update(); - } - return 1; -} - - -long -GNEViewNet::onCmdDeleteGeometry(FXObject*, FXSelector, void*) { - if (myCurrentPoly != 0) { - myCurrentPoly->deleteGeometryNear(myPopupSpot); - update(); - } - return 1; -} - - -long -GNEViewNet::onCmdDuplicateLane(FXObject*, FXSelector, void*) { - GNELane* lane = getLaneAtCurserPosition(myPopupSpot); - if (lane != 0) { - if (gSelected.isSelected(GLO_LANE, lane->getGlID())) { - myUndoList->p_begin("duplicate selected lanes"); - std::vector lanes = myNet->retrieveLanes(true); - for (std::vector::iterator it = lanes.begin(); it != lanes.end(); it++) { - myNet->duplicateLane(*it, myUndoList); - } - myUndoList->p_end(); - } else { - myUndoList->p_begin("duplicate lane"); - myNet->duplicateLane(lane, myUndoList); - myUndoList->p_end(); - } - } - return 1; -} - - -long -GNEViewNet::onCmdRestrictLaneSidewalk(FXObject*, FXSelector, void*) { - return restrictLane(SVC_PEDESTRIAN); -} - - -long -GNEViewNet::onCmdRestrictLaneBikelane(FXObject*, FXSelector, void*) { - return restrictLane(SVC_BICYCLE); -} - - -long -GNEViewNet::onCmdRestrictLaneBuslane(FXObject*, FXSelector, void*) { - return restrictLane(SVC_BUS); -} - - -long -GNEViewNet::onCmdAddRestrictedLaneSidewalk(FXObject*, FXSelector, void*) { - return addRestrictedLane(SVC_PEDESTRIAN); -} - - -long -GNEViewNet::onCmdAddRestrictedLaneBikelane(FXObject*, FXSelector, void*) { - return addRestrictedLane(SVC_BICYCLE); -} - - -long -GNEViewNet::onCmdAddRestrictedLaneBuslane(FXObject*, FXSelector, void*) { - return addRestrictedLane(SVC_BUS); -} - - -long -GNEViewNet::onCmdRemoveRestrictedLaneSidewalk(FXObject*, FXSelector, void*) { - return removeRestrictedLane(SVC_PEDESTRIAN); -} - - -long -GNEViewNet::onCmdRemoveRestrictedLaneBikelane(FXObject*, FXSelector, void*) { - return removeRestrictedLane(SVC_BICYCLE); -} - - -long -GNEViewNet::onCmdRemoveRestrictedLaneBuslane(FXObject*, FXSelector, void*) { - return removeRestrictedLane(SVC_BUS); -} - - -bool -GNEViewNet::restrictLane(SUMOVehicleClass vclass) { - GNELane* lane = getLaneAtCurserPosition(myPopupSpot); - if (lane != 0) { - // Get selected lanes - std::vector lanes = myNet->retrieveLanes(true); ; - // Declare map of edges and lanes - std::map mapOfEdgesAndLanes; - // Iterate over selected lanes - for (std::vector::iterator i = lanes.begin(); i != lanes.end(); i++) { - mapOfEdgesAndLanes[myNet->retrieveEdge((*i)->getParentEdge().getID())] = (*i); - } - // Throw warning dialog if there hare multiple lanes selected in the same edge - if (mapOfEdgesAndLanes.size() != lanes.size()) { - FXMessageBox::information(getApp(), MBOX_OK, - ("Multiple lane in the same edge selected"), - ("There are selected lanes that belong to the same edge.\n Only one lane pro edge will be restricted for " + toString(vclass) + ".").c_str()); - } - // If we handeln a set of lanes - if (mapOfEdgesAndLanes.size() > 0) { - // declare counter for number of Sidewalks - int counter = 0; - // iterate over selected lanes - for (std::map::iterator i = mapOfEdgesAndLanes.begin(); i != mapOfEdgesAndLanes.end(); i++) { - if (i->first->hasRestrictedLane(vclass)) { - counter++; - } - } - // if all edges parent own a Sidewalk, stop function - if (counter == (int)mapOfEdgesAndLanes.size()) { - FXMessageBox::information(getApp(), MBOX_OK, - ("Set vclass for " + toString(vclass) + " to selected lanes").c_str(), - ("All lanes own already another lane in the same edge with a restriction for " + toString(vclass)).c_str()); - return 0; - } else { - // Ask confirmation to user - FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO, - ("Set vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s", - (toString(mapOfEdgesAndLanes.size() - counter) + " lanes will be restricted for " + toString(vclass) + ". continue?").c_str()); - if (answer != 1) { //1:yes, 2:no, 4:esc - return 0; - } - } - // begin undo operation - myUndoList->p_begin("restrict lanes to " + toString(vclass)); - // iterate over selected lanes - for (std::map::iterator i = mapOfEdgesAndLanes.begin(); i != mapOfEdgesAndLanes.end(); i++) { - // Transform lane to Sidewalk - myNet->restrictLane(vclass, i->second, myUndoList); - } - // end undo operation - myUndoList->p_end(); - } else { - // If only have a single lane, start undo/redo operation - myUndoList->p_begin("restrict lane to " + toString(vclass)); - // Transform lane to Sidewalk - myNet->restrictLane(vclass, lane, myUndoList); - // end undo operation - myUndoList->p_end(); - } - } - return 1; -} - - -bool -GNEViewNet::addRestrictedLane(SUMOVehicleClass vclass) { - GNELane* lane = getLaneAtCurserPosition(myPopupSpot); - if (lane != 0) { - // Get selected edges - std::vector edges = myNet->retrieveEdges(true); - // get selected lanes - std::vector lanes = myNet->retrieveLanes(true); - // Declare set of edges - std::set setOfEdges; - // Fill set of edges with vector of edges - for (std::vector::iterator i = edges.begin(); i != edges.end(); i++) { - setOfEdges.insert(*i); - } - // iterate over selected lanes - for (std::vector::iterator it = lanes.begin(); it != lanes.end(); it++) { - // Insert pointer to edge into set of edges (To avoid duplicates) - setOfEdges.insert(myNet->retrieveEdge((*it)->getParentEdge().getID())); - } - // If we handeln a set of edges - if (setOfEdges.size() > 0) { - // declare counter for number of restrictions - int counter = 0; - // iterate over set of edges - for (std::set::iterator it = setOfEdges.begin(); it != setOfEdges.end(); it++) { - // update counter if edge has already a restricted lane of type "vclass" - if ((*it)->hasRestrictedLane(vclass) == true) { - counter++; - } - } - // if all lanes own a Sidewalk, stop function - if (counter == (int)setOfEdges.size()) { - FXMessageBox::information(getApp(), MBOX_OK, - ("Add vclass for" + toString(vclass) + " to selected lanes").c_str(), - ("All lanes own already another lane in the same edge with a restriction for " + toString(vclass)).c_str()); - return 0; - } else { - // Ask confirmation to user - FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO, - ("Add vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s", - (toString(setOfEdges.size() - counter) + " restrictions for " + toString(vclass) + " will be added. continue?").c_str()); - if (answer != 1) { //1:yes, 2:no, 4:esc - return 0; - } - } - // begin undo operation - myUndoList->p_begin("Add restrictions for " + toString(vclass)); - // iterate over set of edges - for (std::set::iterator it = setOfEdges.begin(); it != setOfEdges.end(); it++) { - // add Sidewalk - myNet->addSRestrictedLane(vclass, *(*it), myUndoList); - } - // end undo operation - myUndoList->p_end(); - } else { - // If only have a single lane, start undo/redo operation - myUndoList->p_begin("Add vclass for " + toString(vclass)); - // Add Sidewalk - myNet->addSRestrictedLane(vclass, lane->getParentEdge(), myUndoList); - // end undo/redo operation - myUndoList->p_end(); - } - } - return 1; -} - - -bool -GNEViewNet::removeRestrictedLane(SUMOVehicleClass vclass) { - GNELane* lane = getLaneAtCurserPosition(myPopupSpot); - if (lane != 0) { - // Get selected edges - std::vector edges = myNet->retrieveEdges(true); - // get selected lanes - std::vector lanes = myNet->retrieveLanes(true); - // Declare set of edges - std::set setOfEdges; - // Fill set of edges with vector of edges - for (std::vector::iterator i = edges.begin(); i != edges.end(); i++) { - setOfEdges.insert(*i); - } - // iterate over selected lanes - for (std::vector::iterator it = lanes.begin(); it != lanes.end(); it++) { - // Insert pointer to edge into set of edges (To avoid duplicates) - setOfEdges.insert(myNet->retrieveEdge((*it)->getParentEdge().getID())); - } - // If we handeln a set of edges - if (setOfEdges.size() > 0) { - // declare counter for number of restrictions - int counter = 0; - // iterate over set of edges - for (std::set::iterator it = setOfEdges.begin(); it != setOfEdges.end(); it++) { - // update counter if edge has already a restricted lane of type "vclass" - if ((*it)->hasRestrictedLane(vclass) == true) { - counter++; - } - } - // if all lanes don't own a Sidewalk, stop function - if (counter == 0) { - FXMessageBox::information(getApp(), MBOX_OK, - ("Remove vclass for " + toString(vclass) + " to selected lanes").c_str(), - ("Selected lanes and edges haven't a restriction for " + toString(vclass)).c_str()); - return 0; - } else { - // Ask confirmation to user - FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO, - ("Remove vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s", - (toString(counter) + " restrictions for " + toString(vclass) + " will be removed. continue?").c_str()); - if (answer != 1) { //1:yes, 2:no, 4:esc - return 0; - } - } - // begin undo operation - myUndoList->p_begin("Remove restrictions for " + toString(vclass)); - // iterate over set of edges - for (std::set::iterator it = setOfEdges.begin(); it != setOfEdges.end(); it++) { - // add Sidewalk - myNet->removeRestrictedLane(vclass, *(*it), myUndoList); - } - // end undo operation - myUndoList->p_end(); - } else { - // If only have a single lane, start undo/redo operation - myUndoList->p_begin("Remove vclass for " + toString(vclass)); - // Remove Sidewalk - myNet->removeRestrictedLane(vclass, lane->getParentEdge(), myUndoList); - // end undo/redo operation - myUndoList->p_end(); - } - } - return 1; -} - - -long -GNEViewNet::onCmdRevertRestriction(FXObject*, FXSelector, void*) { - GNELane* lane = getLaneAtCurserPosition(myPopupSpot); - if (lane != 0) { - // Declare vector of lanes - std::vector lanes; - // Check if we have a set of selected edges or lanes - if (gSelected.isSelected(GLO_EDGE, lane->getParentEdge().getGlID())) { - // Get selected edgeds - std::vector edges = myNet->retrieveEdges(true); - // fill vector of lanes with the lanes of selected edges - for (std::vector::iterator i = edges.begin(); i != edges.end(); i++) { - for (std::vector::const_iterator j = (*i)->getLanes().begin(); j != (*i)->getLanes().end(); j++) { - lanes.push_back(*j); - } - } - } else if (gSelected.isSelected(GLO_LANE, lane->getGlID())) { - // get selected lanes - lanes = myNet->retrieveLanes(true); - } - // If we handeln a set of lanes - if (lanes.size() > 0) { - // declare counter for number of Sidewalks - int counter = 0; - // iterate over selected lanes - for (std::vector::iterator it = lanes.begin(); it != lanes.end(); it++) { - if (((*it)->isRestricted(SVC_PEDESTRIAN)) || ((*it)->isRestricted(SVC_BICYCLE)) || ((*it)->isRestricted(SVC_BUS))) { - counter++; - } - } - // if none of selected lanes has a transformation, stop - if (counter == 0) { - FXMessageBox::information(getApp(), MBOX_OK, - "Revert restriction", "None of selected lanes has a previous restriction"); - return 0; - } else { - // Ask confirmation to user - FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO, - "Revert restriction", "%s", - (toString(counter) + " restrictions of lanes lanes will be reverted. continue?").c_str()); - if (answer != 1) { //1:yes, 2:no, 4:esc - return 0; - } - } - // begin undo operation - myUndoList->p_begin("revert restrictions"); - // iterate over selected lanes - for (std::vector::iterator it = lanes.begin(); it != lanes.end(); it++) { - // revert transformation - myNet->revertLaneRestriction(*it, myUndoList); - } - // end undo operation - myUndoList->p_end(); - } else { - // If only have a single lane, start undo/redo operation - myUndoList->p_begin("revert restriction"); - // revert transformation - myNet->revertLaneRestriction(lane, myUndoList); - // end undo operation - myUndoList->p_end(); - } - } - return 1; -} - - -long -GNEViewNet::onCmdNodeShape(FXObject*, FXSelector, void*) { - GNEJunction* junction = getJunctionAtCursorPosition(myPopupSpot); - if (junction != 0) { - if (myCurrentPoly == 0) { - if (junction->getNBNode()->getShape().size() > 1) { - setEditModeFromHotkey(MID_GNE_MODE_MOVE); - //std::cout << junction->getNBNode()->getShape() << "\n"; - junction->getNBNode()->computeNodeShape(-1); - if (myCurrentPoly != 0) { - myNet->getVisualisationSpeedUp().removeAdditionalGLObject(myCurrentPoly); - delete myCurrentPoly; - myCurrentPoly = 0; - } - PositionVector shape = junction->getNBNode()->getShape(); - shape.closePolygon(); - myCurrentPoly = new GNEPoly(myNet, junction, "node_shape:" + junction->getMicrosimID(), "node shape", - shape, false, RGBColor::GREEN, GLO_POLYGON); - myCurrentPoly->setLineWidth(0.3); - myNet->getVisualisationSpeedUp().addAdditionalGLObject(myCurrentPoly); - - update(); - } - } else { - junction->setAttribute(SUMO_ATTR_SHAPE, toString(myCurrentPoly->getShape()), myUndoList); - removeCurrentPoly(); - update(); - } - } - return 1; -} - - -void -GNEViewNet::removeCurrentPoly() { - if (myCurrentPoly != 0) { - myNet->getVisualisationSpeedUp().removeAdditionalGLObject(myCurrentPoly); - delete myCurrentPoly; - myCurrentPoly = 0; - } -} - - -long -GNEViewNet::onCmdNodeReplace(FXObject*, FXSelector, void*) { - GNEJunction* junction = getJunctionAtCursorPosition(myPopupSpot); - if (junction != 0) { - myNet->replaceJunctionByGeometry(junction, myUndoList); - update(); - } - return 1; -} - - -long -GNEViewNet::onCmdToogleShowConnection(FXObject*, FXSelector, void*) { - if (!myShowConnectionActivated) { - getNet()->initGNEConnections(); - myShowConnectionActivated = true; - } - // Update viewnNet to show/hide conections - update(); - // Hide/show connections requiere recompute - getNet()->requireRecompute(); - return 1; -} - - -long -GNEViewNet::onCmdToogleShowBubbles(FXObject*, FXSelector, void*) { - // Update Junction Shapes - getNet()->updateJunctionShapes(); - return 1; -} - - -// =========================================================================== -// private -// =========================================================================== - -void -GNEViewNet::setEditMode(EditMode mode) { - setStatusBarText(""); - abortOperation(false); - if (mode == myEditMode) { - setStatusBarText("Mode already selected"); - } else { - myPreviousEditMode = myEditMode; - myEditMode = mode; - // First check if previous mode was MOVE - if (myPreviousEditMode == GNE_MODE_MOVE) { - // Update junctions again to calculate connections and disable bubbles - myNet->updateJunctionShapes(); - myShowJunctionAsBubble->setCheck(false); - } - switch (mode) { - case GNE_MODE_CONNECT: - case GNE_MODE_TLS: - // modes which depend on computed data - myNet->computeEverything((GNEApplicationWindow*)myApp); - break; - default: - break; - } - } - updateModeSpecificControls(); -} - - -void -GNEViewNet::buildEditModeControls() { - // initialize mappings - myEditModeNames.insert("(e) Create Edge", GNE_MODE_CREATE_EDGE); - myEditModeNames.insert("(m) Move", GNE_MODE_MOVE); - myEditModeNames.insert("(d) Delete", GNE_MODE_DELETE); - myEditModeNames.insert("(i) Inspect", GNE_MODE_INSPECT); - myEditModeNames.insert("(s) Select", GNE_MODE_SELECT); - myEditModeNames.insert("(c) Connect", GNE_MODE_CONNECT); - myEditModeNames.insert("(t) Traffic Lights", GNE_MODE_TLS); - myEditModeNames.insert("(a) Additionals", GNE_MODE_ADDITIONAL); - - // initialize combo for modes - myEditModesCombo = - new FXComboBox(myToolbar, 12, this, MID_GNE_MODE_CHANGE, - FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC | LAYOUT_CENTER_Y); - - std::vector names = myEditModeNames.getStrings(); - for (std::vector::const_iterator it = names.begin(); it != names.end(); it++) { - myEditModesCombo->appendItem(it->c_str()); - } - myEditModesCombo->setNumVisible((int)myEditModeNames.size()); - - // initialize mode specific controls - myChainCreateEdge = new FXMenuCheck(myToolbar, "chain\t\tCreate consecutive edges with a single click (hit ESC to cancel chain).", this, 0); - myAutoCreateOppositeEdge = new FXMenuCheck(myToolbar, - "two-way\t\tAutomatically create an edge in the opposite direction", this, 0); - mySelectEdges = new FXMenuCheck(myToolbar, "select edges\t\tToggle whether clicking should select edges or lanes", this, 0); - mySelectEdges->setCheck(); - - myShowConnections = new FXMenuCheck(myToolbar, "show connections\t\tToggle show connections over junctions", this, MID_GNE_SHOW_CONNECTIONS); - myShowConnections->setCheck(false); - - myExtendToEdgeNodes = new FXMenuCheck(myToolbar, "auto-select nodes\t\tToggle whether selecting multiple edges should automatically select their nodes", this, 0); - - myWarnAboutMerge = new FXMenuCheck(myToolbar, "ask for merge\t\tAsk for confirmation before merging junctions.", this, 0); - myWarnAboutMerge->setCheck(true); - - myShowJunctionAsBubble = new FXMenuCheck(myToolbar, "Show junction as bubbles\t\tShow juntion's shape as a bubble.", this, MID_GNE_SHOW_BUBBLES); - myShowJunctionAsBubble->setCheck(false); - - myChangeAllPhases = new FXMenuCheck(myToolbar, "apply change to all phases\t\tToggle whether clicking should apply state changes to all phases of the current traffic light plan", this, 0); - myChangeAllPhases->setCheck(false); -} - - -void -GNEViewNet::updateModeSpecificControls() { - // MAGIC modifier to avoid flicker. at least it is consistent for move AND - // zoom. Probably has to do with spacing - const int addChange = 4; - - // hide all controls - myChainCreateEdge->hide(); - myAutoCreateOppositeEdge->hide(); - mySelectEdges->hide(); - myShowConnections->hide(); - myExtendToEdgeNodes->hide(); - myChangeAllPhases->hide(); - myWarnAboutMerge->hide(); - myShowJunctionAsBubble->hide(); - int widthChange = 0; - // Close all Frames - if (myViewParent->getInspectorFrame()->shown()) { - widthChange += myViewParent->getInspectorFrame()->getWidth() + addChange; - myViewParent->getInspectorFrame()->hide(); - } - if (myViewParent->getSelectorFrame()->shown()) { - widthChange += myViewParent->getSelectorFrame()->getWidth() + addChange; - myViewParent->getSelectorFrame()->hide(); - } - if (myViewParent->getConnectorFrame()->shown()) { - widthChange += myViewParent->getConnectorFrame()->getWidth() + addChange; - myViewParent->getConnectorFrame()->hide(); - } - if (myViewParent->getTLSEditorFrame()->shown()) { - widthChange += myViewParent->getTLSEditorFrame()->getWidth() + addChange; - myViewParent->getTLSEditorFrame()->hide(); - } - if (myViewParent->getAdditionalFrame()->shown()) { - widthChange += myViewParent->getAdditionalFrame()->getWidth() + addChange; - myViewParent->getAdditionalFrame()->hide(); - } - // enable selected controls - switch (myEditMode) { - case GNE_MODE_CREATE_EDGE: - myChainCreateEdge->show(); - myAutoCreateOppositeEdge->show(); - break; - case GNE_MODE_DELETE: - mySelectEdges->show(); - myShowConnections->show(); - break; - case GNE_MODE_INSPECT: - widthChange -= myViewParent->getInspectorFrame()->getWidth() + addChange; - myViewParent->getInspectorFrame()->show(); - mySelectEdges->show(); - myShowConnections->show(); - break; - case GNE_MODE_SELECT: - widthChange -= myViewParent->getSelectorFrame()->getWidth() + addChange; - myViewParent->getSelectorFrame()->show(); - mySelectEdges->show(); - myShowConnections->show(); - myExtendToEdgeNodes->show(); - break; - case GNE_MODE_MOVE: - myWarnAboutMerge->show(); - myShowJunctionAsBubble->show(); - break; - case GNE_MODE_CONNECT: - widthChange -= myViewParent->getConnectorFrame()->getWidth() + addChange; - myViewParent->getConnectorFrame()->show(); - break; - case GNE_MODE_TLS: - widthChange -= myViewParent->getTLSEditorFrame()->getWidth() + addChange; - myViewParent->getTLSEditorFrame()->show(); - myChangeAllPhases->show(); - break; - case GNE_MODE_ADDITIONAL: - widthChange -= myViewParent->getAdditionalFrame()->getWidth() + addChange; - myViewParent->getAdditionalFrame()->show(); - break; - default: - break; - } - myChanger->changeCanvassLeft(widthChange); - myToolbar->recalc(); - recalc(); - onPaint(0, 0, 0); // force repaint because different modes draw different things - update(); -} - - -void -GNEViewNet::deleteSelectedJunctions() { - myUndoList->p_begin("delete selected junctions"); - std::vector junctions = myNet->retrieveJunctions(true); - for (std::vector::iterator it = junctions.begin(); it != junctions.end(); it++) { - myNet->deleteJunction(*it, myUndoList); - } - myUndoList->p_end(); -} - - -void -GNEViewNet::deleteSelectedEdges() { - if (mySelectEdges->getCheck()) { - myUndoList->p_begin("delete selected edges"); - std::vector edges = myNet->retrieveEdges(true); - for (std::vector::iterator it = edges.begin(); it != edges.end(); it++) { - myNet->deleteEdge(*it, myUndoList); - } - } else { - myUndoList->p_begin("delete selected lanes"); - std::vector lanes = myNet->retrieveLanes(true); - for (std::vector::iterator it = lanes.begin(); it != lanes.end(); it++) { - myNet->deleteLane(*it, myUndoList); - } - } - myUndoList->p_end(); -} - - -bool -GNEViewNet::mergeJunctions(GNEJunction* moved) { - const Position& newPos = moved->getNBNode()->getPosition(); - GNEJunction* mergeTarget = 0; - // try to find another junction to merge with - if (makeCurrent()) { - Boundary selection; - selection.add(newPos); - selection.grow(0.1); - const std::vector ids = getObjectsInBoundary(selection); - GUIGlObject* object = 0; - for (std::vector::const_iterator it = ids.begin(); it != ids.end(); it++) { - GUIGlID id = *it; - if (id == 0) { - continue; - } - object = GUIGlObjectStorage::gIDStorage.getObjectBlocking(id); - if (!object) { - throw ProcessError("Unkown object in selection (id=" + toString(id) + ")."); - } - if (object->getType() == GLO_JUNCTION && id != moved->getGlID()) { - mergeTarget = dynamic_cast(object); - } - GUIGlObjectStorage::gIDStorage.unblockObject(id); - } - } - if (mergeTarget) { - // optionally ask for confirmation - if (myWarnAboutMerge->getCheck()) { - FXuint answer = FXMessageBox::question(this, MBOX_YES_NO, - "Confirm Junction Merger", "%s", - ("Do you wish to merge junctions '" + moved->getMicrosimID() + - "' and '" + mergeTarget->getMicrosimID() + "'?\n" + - "('" + moved->getMicrosimID() + - "' will be eliminated and its roads added to '" + - mergeTarget->getMicrosimID() + "')").c_str()); - if (answer != 1) { //1:yes, 2:no, 4:esc - return false; - } - } - myNet->mergeJunctions(moved, mergeTarget, myUndoList); - return true; - } else { - return false; - } -} - - -void -GNEViewNet::updateControls() { - switch (myEditMode) { - case GNE_MODE_INSPECT: - myViewParent->getInspectorFrame()->update(); - break; - default: - break; - } -} -/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/applied-patches sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/applied-patches --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/applied-patches 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/applied-patches 2017-07-23 16:22:07.000000000 +0000 @@ -3,4 +3,3 @@ 30_add_missing_link.patch 40_drop_some_buildflags.patch 50_use_system_openlayers.patch -60_fix_format_not_a_string.patch diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/.quilt_patches sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/.quilt_patches --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/.quilt_patches 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/.quilt_patches 2017-07-23 16:22:07.000000000 +0000 @@ -1 +1 @@ -/home/buildd/build-RECIPEBRANCHBUILD-1254277/chroot-autobuild/home/buildd/work/tree/sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/debian/patches +/home/buildd/build-RECIPEBRANCHBUILD-1418516/chroot-autobuild/home/buildd/work/tree/sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/debian/patches diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/.quilt_series sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/.quilt_series --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/.pc/.quilt_series 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/.pc/.quilt_series 2017-07-23 16:22:07.000000000 +0000 @@ -1 +1 @@ -/home/buildd/build-RECIPEBRANCHBUILD-1254277/chroot-autobuild/home/buildd/work/tree/sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/debian/patches/series +/home/buildd/build-RECIPEBRANCHBUILD-1418516/chroot-autobuild/home/buildd/work/tree/sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/debian/patches/series diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/README sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/README --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/README 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/README 2017-07-23 16:22:03.000000000 +0000 @@ -37,8 +37,8 @@ ============= To stay informed, we have a mailing list for SUMO. To subscribe, send mail to -sumo-users-request@lists.sourceforge.net with the word subscribe in the message body. -Messages to the list can be sent to sumo-users@lists.sourceforge.net. +sumo-user-request@lists.sourceforge.net with the word subscribe in the message body. +Messages to the list can be sent to sumo-user@lists.sourceforge.net. SUMO announcements will be made through the sumo-announce@lists.sourceforge.net list; you can subscribe to this list by sending a message "subscribe" to the list server at sumo-announce-request@lists.sourceforge.net. @@ -91,4 +91,4 @@ SUMO is licensed under GPL, see the file COPYING for details. For the licenses of the different libraries and supplementary code, see - http://sumo.dlr.de/wiki/License \ No newline at end of file + http://sumo.dlr.de/wiki/License diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGActivities.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGActivities.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGActivities.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGActivities.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,13 +5,13 @@ /// @author Walter Bamberger /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGActivities.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGActivities.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // Main class that manages activities taken in account and generates the // inhabitants' trip list. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGActivities.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGActivities.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGActivities.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGActivities.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,13 @@ /// @author Daniel Krajzewicz /// @author Walter Bamberger /// @date July 2010 -/// @version $Id: AGActivities.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGActivities.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Main class that manages activities taken in account and generates the // inhabitants' trip list. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGActivity.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGActivity.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGActivity.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGActivity.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,13 @@ /// @author Daniel Krajzewicz /// @author Walter Bamberger /// @date July 2010 -/// @version $Id: AGActivity.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGActivity.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // Parent object for all activities. Derived classes generate trips for each // household. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -69,8 +69,8 @@ transp += BUS; } } else if (myHousehold->getCarNbr() == 0) { - SUMOReal d1 = destination.distanceTo(myHousehold->getPosition()); - SUMOReal d2 = destination.minDistanceTo(myStatData->busStations) + myHousehold->getPosition().minDistanceTo(myStatData->busStations); + double d1 = destination.distanceTo(myHousehold->getPosition()); + double d2 = destination.minDistanceTo(myStatData->busStations) + myHousehold->getPosition().minDistanceTo(myStatData->busStations); if (d1 > d2) { transp = BUS; @@ -107,7 +107,7 @@ int AGActivity::timeToDrive(AGPosition from, AGPosition to) { - SUMOReal dist = from.distanceTo(to); + double dist = from.distanceTo(to); return (int)(timePerKm * dist / 1000.0); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGActivity.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGActivity.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGActivity.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGActivity.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,13 +5,13 @@ /// @author Walter Bamberger /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGActivity.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGActivity.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Parent object for all activities. Derived classes generate trips for each // household. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -115,11 +115,11 @@ std::list myPartialActivityTrips; int activityPriority; bool genDone; - SUMOReal timePerKm; + double timePerKm; /** * rate of taking the car instead of the bus because of personal preference */ - SUMOReal carPreference; + double carPreference; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGFreeTime.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGFreeTime.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGFreeTime.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGFreeTime.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,13 +5,13 @@ /// @author Walter Bamberger /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGFreeTime.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGFreeTime.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // Generates trips related to after-work activities // like visiting the family or party. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -76,8 +76,8 @@ if (num_poss == 0) { return 0; } - SUMOReal alea = RandHelper::rand(); //(float)(rand() % 1000) / 1000.0; - int decision = (int)floor(alea * (SUMOReal)num_poss); + double alea = RandHelper::rand(); //(float)(rand() % 1000) / 1000.0; + int decision = (int)floor(alea * (double)num_poss); if (possibleType & DAY) { if (decision == 0) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGFreeTime.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGFreeTime.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGFreeTime.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGFreeTime.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,13 +5,13 @@ /// @author Walter Bamberger /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGFreeTime.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGFreeTime.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Generates trips related to after-work activities // like visiting the family or party. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -98,7 +98,7 @@ /** * frequency of going out or see family is assumed to be once a week (in mean) */ - SUMOReal freqOut; + double freqOut; /** * number of days for the simulation * households are likely to go out some days but not others diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGTrip.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGTrip.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGTrip.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGTrip.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGTrip.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGTrip.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // Class containing all information of a given trip (car, bus) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -117,8 +117,8 @@ } int -AGTrip::getTimeTrip(SUMOReal secPerKm) const { - SUMOReal dist = 0; +AGTrip::getTimeTrip(double secPerKm) const { + double dist = 0; std::list positions; positions.push_back(myFrom); std::list::const_iterator it; @@ -136,12 +136,12 @@ } int -AGTrip::getArrTime(SUMOReal secPerKm) const { +AGTrip::getArrTime(double secPerKm) const { return myDepTime + getTimeTrip(secPerKm); } int -AGTrip::getRideBackArrTime(SUMOReal secPerKm) const { +AGTrip::getRideBackArrTime(double secPerKm) const { return getArrTime(secPerKm) + (int)(secPerKm * myTo.distanceTo(myFrom) / 1000.0); } @@ -151,7 +151,7 @@ } int -AGTrip::estimateDepTime(int arrTime, SUMOReal secPerKm) const { +AGTrip::estimateDepTime(int arrTime, double secPerKm) const { return arrTime - getTimeTrip(secPerKm); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGTrip.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGTrip.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGTrip.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGTrip.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGTrip.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGTrip.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Class containing all information of a given trip (car, bus) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -107,23 +107,23 @@ * going through the different points and coming back to the initial position * given the time to make one kilometer */ - int getRideBackArrTime(SUMOReal secPerKm) const; + int getRideBackArrTime(double secPerKm) const; /** * returns the estimated arrival time * given the time to make one kilometer */ - int getArrTime(SUMOReal secPerKm) const; + int getArrTime(double secPerKm) const; /** * gives the time in seconds for the trip * given a speed in seconds per kilometer (in city, not car speed * but time needed to make a distance in the city) */ - int getTimeTrip(SUMOReal secPerKm) const; + int getTimeTrip(double secPerKm) const; /** * estimate the departure time needed for a given arrival time * and a speed in seconds per kilometer */ - int estimateDepTime(int arrTime, SUMOReal secPerKm) const; + int estimateDepTime(int arrTime, double secPerKm) const; /** * returns whether this is a daily trip or a one day trip */ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGWorkAndSchool.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGWorkAndSchool.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGWorkAndSchool.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGWorkAndSchool.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Walter Bamberger /// @date July 2010 -/// @version $Id: AGWorkAndSchool.cpp 21329 2016-08-24 12:47:50Z behrisch $ +/// @version $Id: AGWorkAndSchool.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // Generates trips to work and to school /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGWorkAndSchool.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGWorkAndSchool.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activities/AGWorkAndSchool.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activities/AGWorkAndSchool.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Walter Bamberger /// @date July 2010 -/// @version $Id: AGWorkAndSchool.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGWorkAndSchool.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Generates trips to work and to school /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activitygen_main.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activitygen_main.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/activitygen_main.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/activitygen_main.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 20 Jul 2010 -/// @version $Id: activitygen_main.cpp 21474 2016-09-14 09:05:31Z behrisch $ +/// @version $Id: activitygen_main.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Main object of the ActivityGen application /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -59,10 +59,6 @@ #include "AGActivityGen.h" #include "city/AGTime.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/AGActivityGen.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/AGActivityGen.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/AGActivityGen.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/AGActivityGen.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Walter Bamberger /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGActivityGen.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGActivityGen.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Main class that handles City, Activities and Trips /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -45,10 +45,6 @@ #include "AGActivityTripWriter.h" #include "city/AGTime.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/AGActivityGen.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/AGActivityGen.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/AGActivityGen.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/AGActivityGen.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Walter Bamberger /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGActivityGen.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGActivityGen.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Main class that handles City, Activities and Trips /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/AGActivityGenHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/AGActivityGenHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/AGActivityGenHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/AGActivityGenHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Walter Bamberger /// @date July 2010 -/// @version $Id: AGActivityGenHandler.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: AGActivityGenHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The handler for parsing the statistics file. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -51,10 +51,6 @@ #include "city/AGPosition.h" #include "city/AGBusLine.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -142,9 +138,9 @@ myCity.statData.households = attrs.getInt(AGEN_ATTR_HOUSEHOLDS); myCity.statData.limitAgeChildren = attrs.getOpt(AGEN_ATTR_CHILDREN, 0, ok, 18); myCity.statData.limitAgeRetirement = attrs.getOpt(AGEN_ATTR_RETIREMENT, 0, ok, 63); - myCity.statData.carRate = attrs.getOpt(AGEN_ATTR_CARS, 0, ok, 0.58); - myCity.statData.unemployement = attrs.getOpt(AGEN_ATTR_UNEMPLOYEMENT, 0, ok, 0.06); - myCity.statData.maxFootDistance = attrs.getOpt(AGEN_ATTR_MAX_FOOT_DIST, 0, ok, 300.0); + myCity.statData.carRate = attrs.getOpt(AGEN_ATTR_CARS, 0, ok, 0.58); + myCity.statData.unemployement = attrs.getOpt(AGEN_ATTR_UNEMPLOYEMENT, 0, ok, 0.06); + myCity.statData.maxFootDistance = attrs.getOpt(AGEN_ATTR_MAX_FOOT_DIST, 0, ok, 300.0); myCity.statData.incomingTraffic = attrs.getOpt(AGEN_ATTR_IN_TRAFFIC, 0, ok, 0); myCity.statData.outgoingTraffic = attrs.getOpt(AGEN_ATTR_OUT_TRAFFIC, 0, ok, 0); } catch (const std::exception& e) { @@ -159,11 +155,11 @@ AGActivityGenHandler::parseParameters(const SUMOSAXAttributes& attrs) { try { bool ok; - myCity.statData.carPreference = attrs.getOpt(AGEN_ATTR_CARPREF, 0, ok, 0.0); - myCity.statData.speedTimePerKm = attrs.getOpt(AGEN_ATTR_CITYSPEED, 0, ok, 360.0); - myCity.statData.freeTimeActivityRate = attrs.getOpt(AGEN_ATTR_FREETIMERATE, 0, ok, 0.15); - myCity.statData.uniformRandomTrafficRate = attrs.getOpt(AGEN_ATTR_UNI_RAND_TRAFFIC, 0, ok, 0.0); - myCity.statData.departureVariation = attrs.getOpt(AGEN_ATTR_DEP_VARIATION, 0, ok, 0.0); + myCity.statData.carPreference = attrs.getOpt(AGEN_ATTR_CARPREF, 0, ok, 0.0); + myCity.statData.speedTimePerKm = attrs.getOpt(AGEN_ATTR_CITYSPEED, 0, ok, 360.0); + myCity.statData.freeTimeActivityRate = attrs.getOpt(AGEN_ATTR_FREETIMERATE, 0, ok, 0.15); + myCity.statData.uniformRandomTrafficRate = attrs.getOpt(AGEN_ATTR_UNI_RAND_TRAFFIC, 0, ok, 0.0); + myCity.statData.departureVariation = attrs.getOpt(AGEN_ATTR_DEP_VARIATION, 0, ok, 0.0); } catch (const std::exception& e) { WRITE_ERROR("Error while parsing the element " + SUMOXMLDefinitions::Tags.getString(AGEN_TAG_PARAM) + ": " + @@ -175,8 +171,8 @@ void AGActivityGenHandler::parseStreets(const SUMOSAXAttributes& attrs) { try { - SUMOReal pop = 0; - SUMOReal work = 0; + double pop = 0; + double work = 0; if (attrs.hasAttribute(AGEN_ATTR_POPULATION)) { pop = attrs.getFloat(AGEN_ATTR_POPULATION); @@ -205,7 +201,7 @@ AGActivityGenHandler::parseCityGates(const SUMOSAXAttributes& attrs) { try { std::string edge = attrs.getString(SUMO_ATTR_EDGE); - SUMOReal positionOnEdge = attrs.getFloat(SUMO_ATTR_POSITION); + double positionOnEdge = attrs.getFloat(SUMO_ATTR_POSITION); AGPosition posi(myCity.getStreet(edge), positionOnEdge); myCity.statData.incoming[(int)myCity.cityGates.size()] = attrs.getFloat(AGEN_ATTR_INCOMING); myCity.statData.outgoing[(int)myCity.cityGates.size()] = attrs.getFloat(AGEN_ATTR_OUTGOING); @@ -263,7 +259,7 @@ AGActivityGenHandler::parseSchool(const SUMOSAXAttributes& attrs) { try { std::string edge = attrs.getString(SUMO_ATTR_EDGE); - SUMOReal positionOnEdge = attrs.getFloat(SUMO_ATTR_POSITION); + double positionOnEdge = attrs.getFloat(SUMO_ATTR_POSITION); AGPosition posi(myCity.getStreet(edge), positionOnEdge); int beginAge = attrs.getInt(AGEN_ATTR_BEGINAGE); int endAge = attrs.getInt(AGEN_ATTR_ENDAGE); @@ -285,7 +281,7 @@ AGActivityGenHandler::parseBusStation(const SUMOSAXAttributes& attrs) { try { std::string edge = attrs.getString(SUMO_ATTR_EDGE); - SUMOReal positionOnEdge = attrs.getFloat(SUMO_ATTR_POSITION); + double positionOnEdge = attrs.getFloat(SUMO_ATTR_POSITION); int id = attrs.getInt(SUMO_ATTR_ID); AGPosition posi(myCity.getStreet(edge), positionOnEdge); myCity.statData.busStations.insert(std::pair(id, posi)); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/AGActivityGenHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/AGActivityGenHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/AGActivityGenHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/AGActivityGenHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Walter Bamberger /// @date July 2010 -/// @version $Id: AGActivityGenHandler.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGActivityGenHandler.h 22608 2017-01-17 06:28:54Z behrisch $ /// // The handler for parsing the statistics file. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/AGActivityTripWriter.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/AGActivityTripWriter.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/AGActivityTripWriter.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/AGActivityTripWriter.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Walter Bamberger /// @date July 2010 -/// @version $Id: AGActivityTripWriter.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGActivityTripWriter.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // Class for writing Trip objects in a SUMO-route file. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/AGActivityTripWriter.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/AGActivityTripWriter.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/AGActivityTripWriter.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/AGActivityTripWriter.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Walter Bamberger /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGActivityTripWriter.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGActivityTripWriter.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Class for writing Trip objects in a SUMO-route file. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/AGFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/AGFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/AGFrame.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/AGFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mo, 13 Sept 2010 -/// @version $Id: AGFrame.cpp 21474 2016-09-14 09:05:31Z behrisch $ +/// @version $Id: AGFrame.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // Configuration of the options of ActivityGen /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/AGFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/AGFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/AGFrame.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/AGFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Walter Bamberger /// @author Daniel Krajzewicz /// @date Mon, 13 Sept 2010 -/// @version $Id: AGFrame.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGFrame.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Configuration of the options of ActivityGen /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGAdult.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGAdult.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGAdult.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGAdult.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGAdult.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: AGAdult.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // Person in working age: can be linked to a work position. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -68,7 +68,7 @@ void -AGAdult::tryToWork(SUMOReal rate, std::vector* wps) { +AGAdult::tryToWork(double rate, std::vector* wps) { if (decide(rate)) { // Select the new work position before giving up the current one. // This avoids that the current one is the same as the new one. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGAdult.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGAdult.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGAdult.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGAdult.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGAdult.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGAdult.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Person in working age: can be linked to a work position. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -85,7 +85,7 @@ * @param[in]: employmentRate (1 - unemploymentRate) * @param[in]: wps the list of work positions (open or not) in the city */ - void tryToWork(SUMOReal employmentRate, std::vector* wps); + void tryToWork(double employmentRate, std::vector* wps); /** @brief Called when the adult has lost her job. * diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGBus.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGBus.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGBus.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGBus.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Walter Bamberger /// @date July 2010 -/// @version $Id: AGBus.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGBus.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // A bus driving in the city /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGBus.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGBus.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGBus.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGBus.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Walter Bamberger /// @date July 2010 -/// @version $Id: AGBus.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGBus.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A bus driving in the city /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGBusLine.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGBusLine.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGBusLine.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGBusLine.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Walter Bamberger /// @date July 2010 -/// @version $Id: AGBusLine.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGBusLine.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // Bus line of the city: contains all the buses of this line /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGBusLine.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGBusLine.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGBusLine.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGBusLine.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Walter Bamberger /// @date July 2010 -/// @version $Id: AGBusLine.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGBusLine.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Bus line of the city: contains all the buses of this line /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGCar.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGCar.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGCar.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGCar.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Walter Bamberger /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGCar.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGCar.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // Cars owned by people of the city: included in households. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGCar.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGCar.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGCar.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGCar.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Walter Bamberger /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGCar.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGCar.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Cars owned by people of the city: included in households. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGChild.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGChild.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGChild.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGChild.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Walter Bamberger /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGChild.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGChild.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // Person in age to go to school: linked to a school object /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -63,7 +63,7 @@ bool AGChild::allocateASchool(std::list* schools, AGPosition housePos) { - SUMOReal minDist = std::numeric_limits::infinity(); + double minDist = std::numeric_limits::infinity(); AGSchool* sch = NULL; if (schools->size() == 0) { return false; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGChild.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGChild.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGChild.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGChild.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Walter Bamberger /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGChild.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGChild.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Person in age to go to school: linked to a school object /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGCity.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGCity.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGCity.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGCity.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,13 +6,13 @@ /// @author Walter Bamberger /// @author Jakob Erdmann /// @date July 2010 -/// @version $Id: AGCity.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: AGCity.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // City class that contains all other objects of the city: in particular // streets, households, bus lines, work positions and school /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include "AGStreet.h" @@ -60,23 +61,23 @@ streetsCompleted = true; } - SUMOReal pop = 0, work = 0; + double pop = 0, work = 0; std::vector::iterator it; for (it = streets.begin(); it != streets.end(); ++it) { pop += (*it)->getPopulation(); work += (*it)->getWorkplaceNumber(); } - statData.factorInhabitants = (SUMOReal)statData.inhabitants / pop; + statData.factorInhabitants = (double)statData.inhabitants / pop; //can be improved with other input data - SUMOReal neededWorkPositionsInCity = (1.0 - statData.unemployement) - * ((SUMOReal)statData.getPeopleYoungerThan(statData.limitAgeRetirement) - - (SUMOReal)statData.getPeopleYoungerThan(statData.limitAgeChildren)) - + (SUMOReal)statData.incomingTraffic; + double neededWorkPositionsInCity = (1.0 - statData.unemployement) + * ((double)statData.getPeopleYoungerThan(statData.limitAgeRetirement) + - (double)statData.getPeopleYoungerThan(statData.limitAgeChildren)) + + (double)statData.incomingTraffic; // we generate 5% more work positions that really needed: to avoid any expensive research of random work positions - neededWorkPositionsInCity *= SUMOReal(1.05); + neededWorkPositionsInCity *= double(1.05); statData.workPositions = (int)neededWorkPositionsInCity; - statData.factorWorkPositions = neededWorkPositionsInCity / (SUMOReal) work; + statData.factorWorkPositions = neededWorkPositionsInCity / (double) work; for (it = streets.begin(); it != streets.end(); ++it) { (*it)->setPopulation((*it)->getPopulation() * statData.factorInhabitants); @@ -131,7 +132,7 @@ void AGCity::generateOutgoingWP() { // work positions outside the city - SUMOReal nbrWorkers = static_cast(statData.getPeopleYoungerThan(statData.limitAgeRetirement) - statData.getPeopleYoungerThan(statData.limitAgeChildren)); + double nbrWorkers = static_cast(statData.getPeopleYoungerThan(statData.limitAgeRetirement) - statData.getPeopleYoungerThan(statData.limitAgeChildren)); if (nbrWorkers <= 0) { return; } @@ -139,7 +140,7 @@ /** * N_out = N_in * (ProportionOut / (1 - ProportionOut)) = N_out = N_in * (Noutworkers / (Nworkers - Noutworkers)) */ - int nbrOutWorkPositions = static_cast(workPositions.size() * (static_cast(statData.outgoingTraffic)) / (nbrWorkers - static_cast(statData.outgoingTraffic))); + int nbrOutWorkPositions = static_cast(workPositions.size() * (static_cast(statData.outgoingTraffic)) / (nbrWorkers - static_cast(statData.outgoingTraffic))); if (cityGates.empty()) { return; @@ -168,13 +169,13 @@ void AGCity::generatePopulation() { std::vector::iterator it; - SUMOReal people = 0; + double people = 0; nbrCars = 0; int idHouseholds = 0; std::vector numAdults(statData.households); std::vector numChilds(statData.households); int totalChildrenLeft = statData.inhabitants - statData.getPeopleOlderThan(statData.limitAgeChildren); - const SUMOReal retiredProb = statData.getPeopleOlderThan(statData.limitAgeRetirement) / statData.getPeopleOlderThan(statData.limitAgeChildren); + const double retiredProb = statData.getPeopleOlderThan(statData.limitAgeRetirement) / statData.getPeopleOlderThan(statData.limitAgeChildren); for (int i = 0; i < statData.households; i++) { numAdults[i] = 1; numChilds[i] = 0; @@ -290,6 +291,7 @@ void AGCity::workAllocation() { + const bool debug = OptionsCont::getOptions().getBool("debug"); statData.AdultNbr = 0; //end tests /** @@ -298,6 +300,10 @@ std::list::iterator it; bool shortage; + if (debug) { + std::cout << "\n"; + } + for (it = households.begin(); it != households.end(); ++it) { if (it->retiredHouseholders()) { continue; @@ -307,6 +313,9 @@ std::cout << "===> ERROR: Not enough work positions in the city for all working people..." << std::endl; } statData.AdultNbr += it->getAdultNbr(); //TESTING + if (debug) { + std::cout << " processed " << statData.AdultNbr << " adults\r"; + } } /** @@ -361,7 +370,7 @@ } // new rate: the rate on the people that have'nt any car yet: // nR = (R * Drivers - AlreadyCars) / (Drivers - AlreadyCars) - SUMOReal newRate = statData.carRate * statData.getPeopleOlderThan(statData.limitAgeChildren) - statData.hhFarFromPT; + double newRate = statData.carRate * statData.getPeopleOlderThan(statData.limitAgeChildren) - statData.hhFarFromPT; if (statData.getPeopleOlderThan(statData.limitAgeChildren) == statData.hhFarFromPT) { newRate = 0.; } else { @@ -386,7 +395,7 @@ //std::cout << "number of people far from public transport: " << statData.hhFarFromPT << std::endl; //std::cout << "original rate: " << setprecision(4) << statData.carRate << std::endl; //std::cout << "new rate: " << setprecision(4) << newRate << std::endl; - //std::cout << "real rate: " << setprecision(4) << (SUMOReal)nbrCars / (SUMOReal)statData.getPeopleOlderThan(statData.limitAgeChildren) << std::endl; + //std::cout << "real rate: " << setprecision(4) << (double)nbrCars / (double)statData.getPeopleOlderThan(statData.limitAgeChildren) << std::endl; //END TEST RESULTS } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGCity.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGCity.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGCity.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGCity.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,13 +5,13 @@ /// @author Walter Bamberger /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGCity.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGCity.h 22608 2017-01-17 06:28:54Z behrisch $ /// // City class that contains all other objects of the city: in particular // streets, households, bus lines, work positions and schools /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGDataAndStatistics.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGDataAndStatistics.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGDataAndStatistics.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGDataAndStatistics.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,13 +5,13 @@ /// @author Michael Behrisch /// @author Walter Bamberger /// @date July 2010 -/// @version $Id: AGDataAndStatistics.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGDataAndStatistics.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // Contains various data, statistical values and functions from input used // by various objects /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -68,7 +68,7 @@ if (m > limitEndAge) { m = limitEndAge; } - const SUMOReal alea = RandHelper::rand(getPropYoungerThan(n), getPropYoungerThan(m)); + const double alea = RandHelper::rand(getPropYoungerThan(n), getPropYoungerThan(m)); for (int a = n; a < m; ++a) { if (alea < getPropYoungerThan(a + 1)) { return a; @@ -78,9 +78,9 @@ } int -AGDataAndStatistics::getPoissonsNumberOfChildren(SUMOReal mean) { - SUMOReal alea = RandHelper::rand(); - SUMOReal cumul = 0; +AGDataAndStatistics::getPoissonsNumberOfChildren(double mean) { + double alea = RandHelper::rand(); + double cumul = 0; for (int nbr = 0; nbr < LIMIT_CHILDREN_NUMBER; ++nbr) { cumul += poisson(mean, nbr); if (cumul > alea) { @@ -90,9 +90,9 @@ return LIMIT_CHILDREN_NUMBER; } -SUMOReal -AGDataAndStatistics::poisson(SUMOReal mean, int occ) { - return exp(-mean) * pow(mean, occ) / (SUMOReal)factorial(occ); +double +AGDataAndStatistics::poisson(double mean, int occ) { + return exp(-mean) * pow(mean, occ) / (double)factorial(occ); } int @@ -112,26 +112,26 @@ normalizeMapProb(&outgoing); limitEndAge = population.rbegin()->first; - oldAgeHhProb = (SUMOReal)getPeopleOlderThan(limitAgeRetirement) / (SUMOReal)getPeopleOlderThan(limitAgeChildren); - secondPersProb = (SUMOReal)(getPeopleOlderThan(limitAgeChildren) - households) / (SUMOReal)households; - meanNbrChildren = (SUMOReal)getPeopleYoungerThan(limitAgeChildren) / ((1 - oldAgeHhProb) * (SUMOReal)households); + oldAgeHhProb = (double)getPeopleOlderThan(limitAgeRetirement) / (double)getPeopleOlderThan(limitAgeChildren); + secondPersProb = (double)(getPeopleOlderThan(limitAgeChildren) - households) / (double)households; + meanNbrChildren = (double)getPeopleYoungerThan(limitAgeChildren) / ((1 - oldAgeHhProb) * (double)households); //cout << " --> oldAgeHhProb = " << setprecision(3) << oldAgeHhProb << " - retAge? " << getPeopleOlderThan(limitAgeRetirement) << " adAge? " << getPeopleOlderThan(limitAgeChildren) << endl; //cout << " --> secondPersProb = " << setprecision(3) << secondPersProb << " - adAge? " << getPeopleOlderThan(limitAgeChildren) << " hh?" << households << endl; //cout << " --> meanNbrChildren = " << setprecision(3) << meanNbrChildren << " - chAge? " << getPeopleYoungerThan(limitAgeChildren) << endl; } -SUMOReal +double AGDataAndStatistics::getPropYoungerThan(int age) { - std::map::iterator it; - SUMOReal sum = 0; + std::map::iterator it; + double sum = 0; int previousAge = 0; - SUMOReal prop = 0; + double prop = 0; for (it = population.begin(); it != population.end(); ++it) { if (it->first < age) { sum += it->second; } else if (it->first >= age && previousAge < age) { - prop = ((SUMOReal)(age - previousAge) / (SUMOReal)(it->first - previousAge)); + prop = ((double)(age - previousAge) / (double)(it->first - previousAge)); sum += prop * it->second; break; } @@ -142,7 +142,7 @@ int AGDataAndStatistics::getPeopleYoungerThan(int age) { - return (int)((SUMOReal)inhabitants * getPropYoungerThan(age) + .5); + return (int)((double)inhabitants * getPropYoungerThan(age) + .5); } int @@ -151,9 +151,9 @@ } void -AGDataAndStatistics::normalizeMapProb(std::map* myMap) { - SUMOReal sum = 0; - std::map::iterator it; +AGDataAndStatistics::normalizeMapProb(std::map* myMap) { + double sum = 0; + std::map::iterator it; for (it = myMap->begin(); it != myMap->end(); ++it) { sum += it->second; } @@ -165,18 +165,18 @@ } } -SUMOReal -AGDataAndStatistics::getInverseExpRandomValue(SUMOReal mean, SUMOReal maxVar) { +double +AGDataAndStatistics::getInverseExpRandomValue(double mean, double maxVar) { if (maxVar <= 0) { return mean; } - SUMOReal p = RandHelper::rand(static_cast(0.0001), static_cast(1)); + double p = RandHelper::rand(static_cast(0.0001), static_cast(1)); //we have to scale the distribution because maxVar is different from INF - SUMOReal scale = exp((-1) * maxVar); + double scale = exp((-1) * maxVar); //new p: scaled p = p * (1 - scale) + scale; // p = [scale; 1) ==> (1-p) = (0; 1-scale] - SUMOReal variation = (-1) * log(p); + double variation = (-1) * log(p); //decide the side of the mean value if (RandHelper::rand(1000) < 500) { return mean + variation; @@ -188,9 +188,9 @@ int AGDataAndStatistics::getRandomCityGateByIncoming() { - SUMOReal alea = RandHelper::rand(); - SUMOReal total = 0; - std::map::iterator it; + double alea = RandHelper::rand(); + double total = 0; + std::map::iterator it; for (it = incoming.begin(); it != incoming.end(); ++it) { total += it->second; if (alea < total) { @@ -203,9 +203,9 @@ int AGDataAndStatistics::getRandomCityGateByOutgoing() { - SUMOReal alea = RandHelper::rand(); - SUMOReal total = 0; - std::map::iterator it; + double alea = RandHelper::rand(); + double total = 0; + std::map::iterator it; for (it = outgoing.begin(); it != outgoing.end(); ++it) { total += it->second; if (alea < total) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGDataAndStatistics.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGDataAndStatistics.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGDataAndStatistics.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGDataAndStatistics.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,13 +5,13 @@ /// @author Jakob Erdmann /// @author Walter Bamberger /// @date July 2010 -/// @version $Id: AGDataAndStatistics.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGDataAndStatistics.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Contains various data, statistical values and functions from input used // by various objects /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -50,8 +50,8 @@ /** * parameters */ - SUMOReal speedTimePerKm; //number of seconds for one km - SUMOReal carPreference; //prob. to choose the car (compared to the bus) + double speedTimePerKm; //number of seconds for one km + double carPreference; //prob. to choose the car (compared to the bus) /** * from General element from XML file. @@ -61,45 +61,45 @@ int limitAgeChildren; int limitAgeRetirement; int limitEndAge; - SUMOReal carRate; - SUMOReal unemployement; - SUMOReal maxFootDistance; + double carRate; + double unemployement; + double maxFootDistance; int incomingTraffic; int outgoingTraffic; - SUMOReal freeTimeActivityRate; - SUMOReal uniformRandomTrafficRate; - SUMOReal departureVariation; + double freeTimeActivityRate; + double uniformRandomTrafficRate; + double departureVariation; - std::map beginWorkHours; // (number only used in term of PROPORTION: it should be normalized) - std::map endWorkHours; // (number only used in term of PROPORTION: it should be normalized) + std::map beginWorkHours; // (number only used in term of PROPORTION: it should be normalized) + std::map endWorkHours; // (number only used in term of PROPORTION: it should be normalized) std::map busStations; // //std::map schoolCapacity; - std::map population; // (number only used in term of PROPORTION: it should be normalized) - //std::map childrenAccompagniment; // + std::map population; // (number only used in term of PROPORTION: it should be normalized) + //std::map childrenAccompagniment; // /** * number of incoming or outgoing people through the given city gates * PROPORTION: it should be normalized */ - std::map incoming; - std::map outgoing; + std::map incoming; + std::map outgoing; /** * computed values used during processing */ int workPositions; - SUMOReal factorInhabitants; - SUMOReal factorWorkPositions; + double factorInhabitants; + double factorWorkPositions; /** * data used for household generation * has to be computed before. */ //probability of picking an old-people household (compared to working and have children adults) - SUMOReal oldAgeHhProb; + double oldAgeHhProb; //probability of having a second adult (old in case of old householders) in the household. - SUMOReal secondPersProb; + double secondPersProb; //this s the mean number of children pro household (not old). This value is used in the Poisson-lay for determining the number of children in each family - SUMOReal meanNbrChildren; + double meanNbrChildren; /** * numbers not needed but interesting for statistics and TESTING @@ -133,7 +133,7 @@ * * TODO Consider reimplementation */ - int getPoissonsNumberOfChildren(SUMOReal mean); + int getPoissonsNumberOfChildren(double mean); /** * these functions return the number of people having more (or less) than the given age * (inclusive for getPeopleOlderThan; exclusive for getPeopleYoungerThan) @@ -142,7 +142,7 @@ */ int getPeopleOlderThan(int age); int getPeopleYoungerThan(int age); - SUMOReal getPropYoungerThan(int age); + double getPropYoungerThan(int age); /** * function consolidating statistics: * normalizes the maps with probabilities @@ -157,7 +157,7 @@ * -the probability distribution function is a "scaled exponential" distribution * from mean-maxVar to mean and from mean to mean+maxVar */ - SUMOReal getInverseExpRandomValue(SUMOReal mean, SUMOReal maxVar); + double getInverseExpRandomValue(double mean, double maxVar); /** * function returning a random city gate corresponding to * the distribution of the incoming/outgoing traffic @@ -176,14 +176,14 @@ * * TODO Create a Poisson distribution class for this. Or is it in Boost? */ - SUMOReal poisson(SUMOReal mean, int occ); + double poisson(double mean, int occ); /** * recursive mathematical function returning the factorial of n: n! */ int factorial(int n); //function normalizing the map's probabilities: Sum(floats) = 1 - void normalizeMapProb(std::map* myMap); + void normalizeMapProb(std::map* myMap); }; #endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGHousehold.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGHousehold.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGHousehold.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGHousehold.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,13 +5,13 @@ /// @author Michael Behrisch /// @author Walter Bamberger /// @date July 2010 -/// @version $Id: AGHousehold.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: AGHousehold.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // A household contains the people and cars of the city: roughly represents // families with their address, cars, adults and possibly children /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -69,7 +69,7 @@ } void -AGHousehold::generateCars(SUMOReal rate) { +AGHousehold::generateCars(double rate) { int peopleInNeed = static_cast(myAdults.size()) - static_cast(myCars.size()); while (peopleInNeed > 0) { if (RandHelper::rand() < rate) { @@ -117,7 +117,7 @@ bool AGHousehold::isCloseFromPubTransport(std::list* pubTransport) { - SUMOReal distToPT = myLocation.minDistanceTo(*pubTransport); + double distToPT = myLocation.minDistanceTo(*pubTransport); if (distToPT > myCity->statData.maxFootDistance) { return false; } @@ -126,7 +126,7 @@ bool AGHousehold::isCloseFromPubTransport(std::map* pubTransport) { - SUMOReal distToPT = myLocation.minDistanceTo(*pubTransport); + double distToPT = myLocation.minDistanceTo(*pubTransport); if (distToPT > myCity->statData.maxFootDistance) { return false; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGHousehold.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGHousehold.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGHousehold.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGHousehold.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,13 +5,13 @@ /// @author Walter Bamberger /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGHousehold.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: AGHousehold.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A household contains the people and cars of the city: roughly represents // families with their address, cars, adults and possibly children /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -101,7 +101,7 @@ /** * function allocating cars to this household in relation to the given rate for each adult */ - void generateCars(SUMOReal rate); + void generateCars(double rate); int getCarNbr(); /** * generates one (more) car in this household diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGPerson.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGPerson.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGPerson.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGPerson.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGPerson.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGPerson.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // Parent object of every person, contains age and any natural characteristic /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -60,7 +60,7 @@ bool -AGPerson::decide(SUMOReal proba) const { +AGPerson::decide(double proba) const { return (RandHelper::rand(1000) < static_cast(1000.0f * proba)); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGPerson.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGPerson.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGPerson.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGPerson.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Walter Bamberger /// @author Daniel Krajzewicz /// @date July 2010 -/// @version $Id: AGPerson.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGPerson.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Parent object of every person, contains age and any natural characteristic /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -62,7 +62,7 @@ * @param[in] degreeOfBelief how strong the person beliefs the proposition * @return whether the person agrees with the proposition */ - virtual bool decide(SUMOReal probability) const; + virtual bool decide(double probability) const; /** @brief Puts out a summary of the class properties. */ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGPosition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGPosition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGPosition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGPosition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGPosition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGPosition.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // References a street of the city and defines a position in this street /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -44,7 +44,7 @@ // =========================================================================== // method definitions // =========================================================================== -AGPosition::AGPosition(const AGStreet& str, SUMOReal pos) : +AGPosition::AGPosition(const AGStreet& str, double pos) : street(&str), position(pos), pos2d(compute2dPosition()) { } @@ -66,16 +66,16 @@ } -SUMOReal +double AGPosition::distanceTo(const AGPosition& otherPos) const { return pos2d.distanceTo(otherPos.pos2d); } -SUMOReal +double AGPosition::minDistanceTo(const std::list& positions) const { - SUMOReal minDist = std::numeric_limits::infinity(); - SUMOReal tempDist; + double minDist = std::numeric_limits::infinity(); + double tempDist; std::list::const_iterator itt; for (itt = positions.begin(); itt != positions.end(); ++itt) { @@ -88,10 +88,10 @@ } -SUMOReal +double AGPosition::minDistanceTo(const std::map& positions) const { - SUMOReal minDist = std::numeric_limits::infinity(); - SUMOReal tempDist; + double minDist = std::numeric_limits::infinity(); + double tempDist; std::map::const_iterator itt; for (itt = positions.begin(); itt != positions.end(); ++itt) { @@ -110,13 +110,13 @@ } -SUMOReal +double AGPosition::getPosition() const { return position; } -SUMOReal +double AGPosition::randomPositionInStreet(const AGStreet& s) { return RandHelper::rand(0.0, s.getLength()); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGPosition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGPosition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGPosition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGPosition.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGPosition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGPosition.h 23150 2017-02-27 12:08:30Z behrisch $ /// // References a street of the city and defines a position in this street /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -71,7 +71,7 @@ * param[in] str the street on which the AGPosition is located * param[in] pos the distance from the from node of the street */ - AGPosition(const AGStreet& str, SUMOReal pos); + AGPosition(const AGStreet& str, double pos); /** @brief Constructs an AGPosition at a random point on a street. * * This constructor determines the distance from the from node with @@ -94,7 +94,7 @@ * * @return the relative position */ - SUMOReal getPosition() const; + double getPosition() const; /** @brief Tests whether two positions are at the same place. * @@ -111,7 +111,7 @@ * @param[in] the other position the distance in computed to * @return the distance */ - SUMOReal distanceTo(const AGPosition& otherPos) const; + double distanceTo(const AGPosition& otherPos) const; /** @brief Computes the distance to the closest position in a list. * @@ -121,7 +121,7 @@ * @param[in] positions the list of positions the distances are computed to * @return the minimal distance */ - SUMOReal minDistanceTo(const std::list& positions) const; + double minDistanceTo(const std::list& positions) const; /** @brief Computes the distance to the closest position in a map. * @@ -131,7 +131,7 @@ * @param[in] positions the map of positions the distances are computed to * @return the minimal distance */ - SUMOReal minDistanceTo(const std::map& positions) const; + double minDistanceTo(const std::map& positions) const; /** @brief Prints out a summary of the properties of this class * on standard output. @@ -140,14 +140,14 @@ private: const AGStreet* street; - SUMOReal position; + double position; Position pos2d; /** @brief Determines a random relative position on a street. * * @return the random relative position */ - static SUMOReal randomPositionInStreet(const AGStreet& street); + static double randomPositionInStreet(const AGStreet& street); /** Creates a Position object to the street and position attribute of * this class. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGSchool.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGSchool.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGSchool.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGSchool.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Walter Bamberger /// @date July 2010 -/// @version $Id: AGSchool.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGSchool.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // Correspond to given ages and referenced by children. Has a precise location. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGSchool.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGSchool.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGSchool.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGSchool.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Walter Bamberger /// @date July 2010 -/// @version $Id: AGSchool.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGSchool.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Correspond to given ages and referenced by children. Has a precise location. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGStreet.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGStreet.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGStreet.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGStreet.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGStreet.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: AGStreet.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // Represents a SUMO edge and contains people and work densities /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -52,26 +52,26 @@ } -SUMOReal +double AGStreet::getPopulation() const { return myPopulation; } void -AGStreet::setPopulation(const SUMOReal population) { +AGStreet::setPopulation(const double population) { myPopulation = population; } -SUMOReal +double AGStreet::getWorkplaceNumber() const { return myNumWorkplaces; } void -AGStreet::setWorkplaceNumber(const SUMOReal workPositions) { +AGStreet::setWorkplaceNumber(const double workPositions) { myNumWorkplaces = workPositions; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGStreet.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGStreet.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGStreet.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGStreet.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGStreet.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: AGStreet.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Represents a SUMO edge and contains people and work densities /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -80,25 +80,25 @@ * * @return the number of inhabitants */ - SUMOReal getPopulation() const; + double getPopulation() const; /** @brief Modifies the number of persons living in this street. * * @param[in] pop the new number of inhabitants */ - void setPopulation(const SUMOReal pop); + void setPopulation(const double pop); /** @brief Provides the number of work places in this street. * * @return the number of work places */ - SUMOReal getWorkplaceNumber() const; + double getWorkplaceNumber() const; /** @brief Modifies the number of work places in this street. * * @param[in] work the new number of work places */ - void setWorkplaceNumber(const SUMOReal work); + void setWorkplaceNumber(const double work); /** @brief Prints a summary of the properties of this street to standard * output. @@ -113,8 +113,8 @@ bool allows(const SUMOVehicleClass vclass) const; private: - SUMOReal myPopulation; - SUMOReal myNumWorkplaces; + double myPopulation; + double myNumWorkplaces; }; #endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGTime.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGTime.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGTime.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGTime.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Walter Bamberger /// @date July 2010 -/// @version $Id: AGTime.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGTime.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // Time manager: able to manipulate the time using Sumo's format (seconds) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -50,7 +50,7 @@ } int -AGTime::getSecondsOf(SUMOReal minutes) { +AGTime::getSecondsOf(double minutes) { return static_cast(60.0 * minutes); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGTime.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGTime.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGTime.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGTime.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Walter Bamberger /// @date July 2010 -/// @version $Id: AGTime.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGTime.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Time manager: able to manipulate the time using Sumo's format (seconds) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -123,7 +123,7 @@ * * @return number of seconds */ - int getSecondsOf(SUMOReal minutes); + int getSecondsOf(double minutes); private: /** diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGWorkPosition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGWorkPosition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGWorkPosition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGWorkPosition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGWorkPosition.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: AGWorkPosition.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // Location and schedules of a work position: linked with one adult /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -55,7 +55,7 @@ } -AGWorkPosition::AGWorkPosition(AGDataAndStatistics* ds, const AGStreet& inStreet, SUMOReal pos) : +AGWorkPosition::AGWorkPosition(AGDataAndStatistics* ds, const AGStreet& inStreet, double pos) : myStatData(ds), myLocation(inStreet, pos), myAdult(0), @@ -79,10 +79,10 @@ int AGWorkPosition::generateOpeningTime(const AGDataAndStatistics& ds) { - SUMOReal choice = RandHelper::rand(); - SUMOReal cumul = 0; + double choice = RandHelper::rand(); + double cumul = 0; - for (std::map::const_iterator it = ds.beginWorkHours.begin(); + for (std::map::const_iterator it = ds.beginWorkHours.begin(); it != ds.beginWorkHours.end(); ++it) { cumul += it->second; if (cumul >= choice) { @@ -96,9 +96,9 @@ int AGWorkPosition::generateClosingTime(const AGDataAndStatistics& ds) { - SUMOReal choice = RandHelper::rand(); - SUMOReal cumul = 0; - for (std::map::const_iterator it = ds.endWorkHours.begin(); + double choice = RandHelper::rand(); + double cumul = 0; + for (std::map::const_iterator it = ds.endWorkHours.begin(); it != ds.endWorkHours.end(); ++it) { cumul += it->second; if (cumul >= choice) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGWorkPosition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGWorkPosition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/city/AGWorkPosition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/city/AGWorkPosition.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Walter Bamberger /// @author Michael Behrisch /// @date July 2010 -/// @version $Id: AGWorkPosition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AGWorkPosition.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Location and schedules of a work position: linked with one adult /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors // activitygen module // Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/) /****************************************************************************/ @@ -56,7 +56,7 @@ class AGWorkPosition { public: AGWorkPosition(AGDataAndStatistics* ds, const AGStreet& inStreet); - AGWorkPosition(AGDataAndStatistics* ds, const AGStreet& inStreet, SUMOReal pos); + AGWorkPosition(AGDataAndStatistics* ds, const AGStreet& inStreet, double pos); ~AGWorkPosition(); void take(AGAdult* ad); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,9 @@ XERCES_LIBS = -l$(LIB_XERCES) -if CHECK_MEMORY_LEAKS -MEM_LIBS = ../foreign/nvwa/libnvwa.a -endif - COMMON_LIBS = ../utils/options/liboptions.a \ ../utils/xml/libxml.a \ +../utils/distribution/libdistribution.a \ ../utils/vehicle/libvehicle.a \ ../utils/common/libcommon.a \ ../utils/importio/libimportio.a \ @@ -16,7 +13,6 @@ ../utils/emissions/libemissions.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ $(XERCES_LIBS) bin_PROGRAMS = activitygen diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/activitygen/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/activitygen/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -99,12 +99,13 @@ activitygen_OBJECTS = $(am_activitygen_OBJECTS) am__DEPENDENCIES_1 = am__DEPENDENCIES_2 = ../utils/options/liboptions.a \ - ../utils/xml/libxml.a ../utils/vehicle/libvehicle.a \ - ../utils/common/libcommon.a ../utils/importio/libimportio.a \ + ../utils/xml/libxml.a ../utils/distribution/libdistribution.a \ + ../utils/vehicle/libvehicle.a ../utils/common/libcommon.a \ + ../utils/importio/libimportio.a \ ../utils/iodevices/libiodevices.a ../utils/geom/libgeom.a \ ../utils/emissions/libemissions.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ - ../foreign/tcpip/libtcpip.a $(MEM_LIBS) $(am__DEPENDENCIES_1) + ../foreign/tcpip/libtcpip.a $(am__DEPENDENCIES_1) activitygen_DEPENDENCIES = ./activities/libagactivities.a \ ./city/libagcity.a ../duarouter/RODUAEdgeBuilder.o \ ../duarouter/RODUAFrame.o ../router/librouter.a \ @@ -381,9 +382,9 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = activities city -@CHECK_MEMORY_LEAKS_TRUE@MEM_LIBS = ../foreign/nvwa/libnvwa.a COMMON_LIBS = ../utils/options/liboptions.a \ ../utils/xml/libxml.a \ +../utils/distribution/libdistribution.a \ ../utils/vehicle/libvehicle.a \ ../utils/common/libcommon.a \ ../utils/importio/libimportio.a \ @@ -392,7 +393,6 @@ ../utils/emissions/libemissions.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ $(XERCES_LIBS) activitygen_SOURCES = activitygen_main.cpp \ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/config.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/config.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/config.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/config.h 2017-07-23 16:22:03.000000000 +0000 @@ -1,9 +1,6 @@ /* src/config.h. Generated from config.h.in by configure. */ /* src/config.h.in. Generated from configure.ac by autoheader. */ -/* Define to 1 in order to enable memory checks. */ -/* #undef CHECK_MEMORY_LEAKS */ - /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ @@ -12,9 +9,6 @@ /* Define to 1 if using `alloca.c'. */ /* #undef C_ALLOCA */ -/* defines the number of digits after the comma in geo-coordinates output */ -#define GEO_OUTPUT_ACCURACY 6 - /* Define to 1 if you have `alloca', as a function or macro. */ #define HAVE_ALLOCA 1 @@ -29,7 +23,7 @@ #define HAVE_DLFCN_H 1 /* Reporting string for enabled options */ -#define HAVE_ENABLED "x86_64-suse-linux-gnu InternalLanes DoublePrecision TRACI PROJ GDAL GUI UnitTests ffmpeg" +#define HAVE_ENABLED "x86_64-suse-linux-gnu TRACI PROJ GDAL GUI UnitTests ffmpeg" /* defined if ffmpeg is available */ #define HAVE_FFMPEG 1 @@ -52,9 +46,6 @@ /* Define to 1 if you have the `gettimeofday' function. */ #define HAVE_GETTIMEOFDAY 1 -/* Define to 1 if you want junction internal lanes */ -#define HAVE_INTERNAL_LANES 1 - /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 @@ -158,10 +149,7 @@ /* #undef NO_TRACI */ /* defines the epsilon to use on general floating point comparison */ -#define NUMERICAL_EPS (SUMOReal)0.001 - -/* defines the number of digits after the comma in output */ -#define OUTPUT_ACCURACY 2 +#define NUMERICAL_EPS 0.001 /* Name of package */ #define PACKAGE "sumo" @@ -173,7 +161,7 @@ #define PACKAGE_NAME "sumo" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "sumo 0.28.0" +#define PACKAGE_STRING "sumo 0.30.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "sumo" @@ -182,10 +170,10 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "0.28.0" +#define PACKAGE_VERSION "0.30.0" /* defines the epsilon to use on position comparison */ -#define POSITION_EPS (SUMOReal)0.1 +#define POSITION_EPS 0.1 /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void @@ -210,9 +198,6 @@ /* Define to 1 if you have the ANSI C header files. */ /* #undef STDC_HEADERS */ -/* defines the precision of floats */ -#define SUMOReal double - /* Define to 1 if you can safely include both and . */ #define TIME_WITH_SYS_TIME 1 @@ -220,7 +205,7 @@ /* #undef TM_IN_SYS_TIME */ /* Version number of package */ -#define VERSION "0.28.0" +#define VERSION "0.30.0" /* Defined if auto-generated version.h is unavailable. */ /* #undef VERSION_STRING */ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/config.h.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/config.h.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/config.h.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/config.h.in 2017-07-23 16:22:03.000000000 +0000 @@ -1,8 +1,5 @@ /* src/config.h.in. Generated from configure.ac by autoheader. */ -/* Define to 1 in order to enable memory checks. */ -#undef CHECK_MEMORY_LEAKS - /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ @@ -11,9 +8,6 @@ /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA -/* defines the number of digits after the comma in geo-coordinates output */ -#undef GEO_OUTPUT_ACCURACY - /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA @@ -51,9 +45,6 @@ /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY -/* Define to 1 if you want junction internal lanes */ -#undef HAVE_INTERNAL_LANES - /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H @@ -159,9 +150,6 @@ /* defines the epsilon to use on general floating point comparison */ #undef NUMERICAL_EPS -/* defines the number of digits after the comma in output */ -#undef OUTPUT_ACCURACY - /* Name of package */ #undef PACKAGE @@ -209,9 +197,6 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS -/* defines the precision of floats */ -#undef SUMOReal - /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/dfrouter_main.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/dfrouter_main.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/dfrouter_main.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/dfrouter_main.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Thu, 16.03.2006 -/// @version $Id: dfrouter_main.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: dfrouter_main.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Main for the DFROUTER /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -67,10 +67,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // functions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,3 @@ -if CHECK_MEMORY_LEAKS -MEM_LIBS = ../foreign/nvwa/libnvwa.a -endif - bin_PROGRAMS = dfrouter dfrouter_SOURCES = dfrouter_main.cpp RODFDetFlowLoader.cpp RODFDetFlowLoader.h \ @@ -17,6 +13,7 @@ dfrouter_LDADD = ../router/librouter.a \ ../utils/options/liboptions.a \ ../utils/xml/libxml.a \ +../utils/distribution/libdistribution.a \ ../utils/vehicle/libvehicle.a \ ../utils/common/libcommon.a \ ../utils/importio/libimportio.a \ @@ -25,5 +22,4 @@ ../utils/emissions/libemissions.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ -l$(LIB_XERCES) $(FOX_LDFLAGS) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -103,12 +103,13 @@ am__DEPENDENCIES_1 = dfrouter_DEPENDENCIES = ../router/librouter.a \ ../utils/options/liboptions.a ../utils/xml/libxml.a \ + ../utils/distribution/libdistribution.a \ ../utils/vehicle/libvehicle.a ../utils/common/libcommon.a \ ../utils/importio/libimportio.a \ ../utils/iodevices/libiodevices.a ../utils/geom/libgeom.a \ ../utils/emissions/libemissions.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ - ../foreign/tcpip/libtcpip.a $(MEM_LIBS) $(am__DEPENDENCIES_1) + ../foreign/tcpip/libtcpip.a $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -338,7 +339,6 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -@CHECK_MEMORY_LEAKS_TRUE@MEM_LIBS = ../foreign/nvwa/libnvwa.a dfrouter_SOURCES = dfrouter_main.cpp RODFDetFlowLoader.cpp RODFDetFlowLoader.h \ RODFDetector.cpp RODFDetector.h RODFDetectorFlow.cpp RODFDetectorFlow.h \ RODFDetectorHandler.cpp RODFDetectorHandler.h \ @@ -351,6 +351,7 @@ dfrouter_LDADD = ../router/librouter.a \ ../utils/options/liboptions.a \ ../utils/xml/libxml.a \ +../utils/distribution/libdistribution.a \ ../utils/vehicle/libvehicle.a \ ../utils/common/libcommon.a \ ../utils/importio/libimportio.a \ @@ -359,7 +360,6 @@ ../utils/emissions/libemissions.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ -l$(LIB_XERCES) $(FOX_LDFLAGS) all: all-am diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFDetector.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFDetector.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFDetector.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFDetector.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -8,12 +8,12 @@ /// @author Laura Bieker /// @author Melanie Knocke /// @date Thu, 16.03.2006 -/// @version $Id: RODFDetector.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: RODFDetector.cpp 24095 2017-04-27 13:45:19Z namdre $ /// // Class representing a detector within the DFROUTER /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2006-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2006-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,7 +46,7 @@ #include "RODFRouteCont.h" #include "RODFDetectorFlow.h" #include -#include +#include #include #include #include @@ -55,16 +55,12 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== RODFDetector::RODFDetector(const std::string& id, const std::string& laneID, - SUMOReal pos, const RODFDetectorType type) + double pos, const RODFDetectorType type) : Named(id), myLaneID(laneID), myPosition(pos), myType(type), myRoutes(0) {} @@ -88,10 +84,10 @@ } -SUMOReal +double RODFDetector::computeDistanceFactor(const RODFRouteDesc& rd) const { - SUMOReal distance = rd.edges2Pass[0]->getFromJunction()->getPosition().distanceTo(rd.edges2Pass.back()->getToJunction()->getPosition()); - SUMOReal length = 0; + double distance = rd.edges2Pass[0]->getFromJunction()->getPosition().distanceTo(rd.edges2Pass.back()->getToJunction()->getPosition()); + double length = 0; for (ROEdgeVector::const_iterator i = rd.edges2Pass.begin(); i != rd.edges2Pass.end(); ++i) { length += (*i)->getLength(); } @@ -129,7 +125,7 @@ } } } - std::map inFlows; + std::map inFlows; if (OptionsCont::getOptions().getBool("respect-concurrent-inflows")) { for (std::vector::const_iterator i = nextDetEdges.begin(); i != nextDetEdges.end(); ++i) { std::set seen(preSplitEdges); @@ -156,11 +152,11 @@ // compute the probabilities to use a certain direction int index = 0; for (SUMOTime time = startTime; time < endTime; time += stepOffset, ++index) { - mySplitProbabilities.push_back(std::map()); - SUMOReal overallProb = 0; + mySplitProbabilities.push_back(std::map()); + double overallProb = 0; // retrieve the probabilities for (std::vector::const_iterator i = nextDetEdges.begin(); i != nextDetEdges.end(); ++i) { - SUMOReal flow = detectors.getAggFlowFor(*i, time, 60, flows) - inFlows[*i]; + double flow = detectors.getAggFlowFor(*i, time, 60, flows) - inFlows[*i]; overallProb += flow; mySplitProbabilities[index][*i] = flow; } @@ -189,26 +185,26 @@ // iterate through time (in output interval steps) for (SUMOTime time = startTime; time < endTime; time += stepOffset) { into[time] = new RandomDistributor(); - std::map flowMap; + std::map flowMap; // iterate through the routes int index = 0; for (std::vector::iterator ri = descs.begin(); ri != descs.end(); ++ri, index++) { - SUMOReal prob = 1.; + double prob = 1.; for (ROEdgeVector::iterator j = (*ri).edges2Pass.begin(); j != (*ri).edges2Pass.end() && prob > 0;) { if (!net.hasDetector(*j)) { ++j; continue; } const RODFDetector& det = detectors.getAnyDetectorForEdge(static_cast(*j)); - const std::vector >& probs = det.getSplitProbabilities(); + const std::vector >& probs = det.getSplitProbabilities(); if (probs.size() == 0) { prob = 0; ++j; continue; } - const std::map& tprobs = probs[(time - startTime) / stepOffset]; + const std::map& tprobs = probs[(int)((time - startTime) / stepOffset)]; RODFEdge* splitEdge = 0; - for (std::map::const_iterator k = tprobs.begin(); k != tprobs.end(); ++k) { + for (std::map::const_iterator k = tprobs.begin(); k != tprobs.end(); ++k) { if (find(j, (*ri).edges2Pass.end(), (*k).first) != (*ri).edges2Pass.end()) { prob *= (*k).second; splitEdge = (*k).first; @@ -221,7 +217,7 @@ ++j; } } - into[time]->add(prob, index); + into[time]->add(index, prob); (*ri).overallProb = prob; } } @@ -288,13 +284,13 @@ SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset, bool includeUnusedRoutes, - SUMOReal scale, + double scale, bool insertionsOnly, - SUMOReal defaultSpeed) const { + double defaultSpeed) const { OutputDevice& out = OutputDevice::getDevice(file); OptionsCont& oc = OptionsCont::getOptions(); if (getType() != SOURCE_DETECTOR) { - out.writeXMLHeader("calibrator"); + out.writeXMLHeader("additional", "additional_file.xsd"); } // routes if (myRoutes != 0 && myRoutes->get().size() != 0) { @@ -311,7 +307,7 @@ out.openTag(SUMO_TAG_ROUTE).writeAttr(SUMO_ATTR_REFID, (*i).routename).writeAttr(SUMO_ATTR_PROB, (*i).overallProb).closeTag(); } if (isEmptyDist) { - out.openTag(SUMO_TAG_ROUTE).writeAttr(SUMO_ATTR_REFID, (*i).routename).writeAttr(SUMO_ATTR_PROB, SUMOReal(1)).closeTag(); + out.openTag(SUMO_TAG_ROUTE).writeAttr(SUMO_ATTR_REFID, (*i).routename).writeAttr(SUMO_ATTR_PROB, double(1)).closeTag(); } } out.closeTag(); // routeDistribution @@ -335,11 +331,11 @@ int carNo = (int)((srcFD.qPKW + srcFD.qLKW) * scale); for (int car = 0; car < carNo; ++car) { // get the vehicle parameter - SUMOReal v = -1; + double v = -1; std::string vtype; int destIndex = destDist != 0 && destDist->getOverallProb() > 0 ? (int) destDist->get() : -1; if (srcFD.isLKW >= 1) { - srcFD.isLKW = srcFD.isLKW - (SUMOReal) 1.; + srcFD.isLKW = srcFD.isLKW - (double) 1.; v = srcFD.vLKW; vtype = "LKW"; } else { @@ -350,10 +346,10 @@ if (v <= 0 || v > 250) { v = defaultSpeed; } else { - v = (SUMOReal)(v / 3.6); + v = (double)(v / 3.6); } // compute the departure time - SUMOTime ctime = (SUMOTime)(time + ((SUMOReal) stepOffset * (SUMOReal) car / (SUMOReal) carNo)); + SUMOTime ctime = (SUMOTime)(time + ((double) stepOffset * (double) car / (double) carNo)); // write out.openTag(SUMO_TAG_VEHICLE); @@ -374,12 +370,12 @@ if (oc.isSet("departpos")) { std::string posDesc = oc.getString("departpos"); if (posDesc.substr(0, 8) == "detector") { - SUMOReal position = myPosition; + double position = myPosition; if (posDesc.length() > 8) { if (posDesc[8] == '+') { - position += TplConvert::_2SUMOReal(posDesc.substr(9).c_str()); + position += TplConvert::_2double(posDesc.substr(9).c_str()); } else if (posDesc[8] == '-') { - position -= TplConvert::_2SUMOReal(posDesc.substr(9).c_str()); + position -= TplConvert::_2double(posDesc.substr(9).c_str()); } else { throw NumberFormatException(); } @@ -436,19 +432,19 @@ RODFDetector::writeSingleSpeedTrigger(const std::string& file, const RODFDetectorFlows& flows, SUMOTime startTime, SUMOTime endTime, - SUMOTime stepOffset, SUMOReal defaultSpeed) { + SUMOTime stepOffset, double defaultSpeed) { OutputDevice& out = OutputDevice::getDevice(file); - out.writeXMLHeader("vss"); + out.writeXMLHeader("additional", "additional_file.xsd"); const std::vector& mflows = flows.getFlowDefs(myID); int index = 0; for (SUMOTime t = startTime; t < endTime; t += stepOffset, index++) { assert(index < (int)mflows.size()); const FlowDef& srcFD = mflows[index]; - SUMOReal speed = MAX2(srcFD.vLKW, srcFD.vPKW); + double speed = MAX2(srcFD.vLKW, srcFD.vPKW); if (speed <= 0 || speed > 250) { speed = defaultSpeed; } else { - speed = (SUMOReal)(speed / 3.6); + speed = (double)(speed / 3.6); } out.openTag(SUMO_TAG_STEP).writeAttr(SUMO_ATTR_TIME, time2string(t)).writeAttr(SUMO_ATTR_SPEED, speed).closeTag(); } @@ -521,7 +517,7 @@ void RODFDetectorCon::save(const std::string& file) const { OutputDevice& out = OutputDevice::getDevice(file); - out.writeXMLHeader("detectors"); + out.writeXMLHeader("detectors", "detectors_file.xsd"); for (std::vector::const_iterator i = myDetectors.begin(); i != myDetectors.end(); ++i) { out.openTag(SUMO_TAG_DETECTOR_DEFINITION).writeAttr(SUMO_ATTR_ID, StringUtils::escapeXML((*i)->getID())).writeAttr(SUMO_ATTR_LANE, (*i)->getLaneID()).writeAttr(SUMO_ATTR_POSITION, (*i)->getPos()); switch ((*i)->getType()) { @@ -549,7 +545,7 @@ void RODFDetectorCon::saveAsPOIs(const std::string& file) const { OutputDevice& out = OutputDevice::getDevice(file); - out.writeXMLHeader("pois"); + out.writeXMLHeader("additional", "additional_file.xsd"); for (std::vector::const_iterator i = myDetectors.begin(); i != myDetectors.end(); ++i) { out.openTag(SUMO_TAG_POI).writeAttr(SUMO_ATTR_ID, StringUtils::escapeXML((*i)->getID())); switch ((*i)->getType()) { @@ -577,7 +573,7 @@ void RODFDetectorCon::saveRoutes(const std::string& file) const { OutputDevice& out = OutputDevice::getDevice(file); - out.writeXMLHeader("routes"); + out.writeXMLHeader("routes", "routes_file.xsd"); std::vector saved; // write for source detectors bool lastWasSaved = true; @@ -621,7 +617,7 @@ SUMOTime stepOffset, const RODFNet& net, bool writeCalibrators, bool includeUnusedRoutes, - SUMOReal scale, + double scale, bool insertionsOnly) { // compute turn probabilities at detector for (std::vector::const_iterator i = myDetectors.begin(); i != myDetectors.end(); ++i) { @@ -629,15 +625,15 @@ } // OutputDevice& out = OutputDevice::getDevice(file); - out.writeXMLHeader("additional", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/additional_file.xsd\""); + out.writeXMLHeader("additional", "additional_file.xsd"); // write vType(s) const bool separateVTypeOutput = OptionsCont::getOptions().getString("vtype-output") != ""; OutputDevice& vTypeOut = separateVTypeOutput ? OutputDevice::getDevice(OptionsCont::getOptions().getString("vtype-output")) : out; if (separateVTypeOutput) { - vTypeOut.writeXMLHeader("additional", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/additional_file.xsd\""); + vTypeOut.writeXMLHeader("additional", "additional_file.xsd"); } const bool forceDev = !OptionsCont::getOptions().isDefault("speeddev"); - const SUMOReal speedDev = OptionsCont::getOptions().getFloat("speeddev"); + const double speedDev = OptionsCont::getOptions().getFloat("speeddev"); if (OptionsCont::getOptions().getBool("vtype")) { // write separate types SUMOVTypeParameter pkwType = SUMOVTypeParameter("PKW", SVC_PASSENGER); @@ -672,7 +668,7 @@ continue; } // try to write the definition - SUMOReal defaultSpeed = net.getEdge(det->getEdgeID())->getSpeed(); + double defaultSpeed = net.getEdge(det->getEdgeID())->getSpeedLimit(); // ... compute routes' distribution over time std::map* > dists; if (!insertionsOnly && flows.knows(det->getID())) { @@ -698,18 +694,18 @@ } void -RODFDetectorCon::setSpeedFactorAndDev(SUMOVTypeParameter& type, SUMOReal maxFactor, SUMOReal avgFactor, SUMOReal dev, bool forceDev) { +RODFDetectorCon::setSpeedFactorAndDev(SUMOVTypeParameter& type, double maxFactor, double avgFactor, double dev, bool forceDev) { if (avgFactor > 1) { // systematically low speeds can easily be caused by traffic // conditions. Whereas elevated speeds probably reflect speeding - type.speedFactor = avgFactor; + type.speedFactor.getParameter()[0] = avgFactor; type.setParameter |= VTYPEPARS_SPEEDFACTOR_SET; } - if (forceDev || (maxFactor > 1 && maxFactor > type.speedFactor + NUMERICAL_EPS)) { + if (forceDev || (maxFactor > 1 && maxFactor > type.speedFactor.getParameter()[0] + NUMERICAL_EPS)) { // setting a non-zero speed deviation causes the simulation to recompute // individual speedFactors to match departSpeed (MSEdge::insertVehicle()) - type.speedDev = dev; - type.setParameter |= VTYPEPARS_SPEEDDEVIATION_SET; + type.speedFactor.getParameter()[1] = dev; + type.setParameter |= VTYPEPARS_SPEEDFACTOR_SET; } } @@ -718,10 +714,10 @@ RODFDetectorCon::writeEmitterPOIs(const std::string& file, const RODFDetectorFlows& flows) { OutputDevice& out = OutputDevice::getDevice(file); - out.writeXMLHeader("additional", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/additional_file.xsd\""); + out.writeXMLHeader("additional", "additional_file.xsd"); for (std::vector::const_iterator i = myDetectors.begin(); i != myDetectors.end(); ++i) { RODFDetector* det = *i; - SUMOReal flow = flows.getFlowSumSecure(det->getID()); + double flow = flows.getFlowSumSecure(det->getID()); const unsigned char col = static_cast(128 * flow / flows.getMaxDetectorFlow() + 128); out.openTag(SUMO_TAG_POI).writeAttr(SUMO_ATTR_ID, StringUtils::escapeXML((*i)->getID()) + ":" + toString(flow)); switch ((*i)->getType()) { @@ -754,12 +750,12 @@ if (edge == 0) { return 0; } -// SUMOReal stepOffset = 60; // !!! -// SUMOReal startTime = 0; // !!! +// double stepOffset = 60; // !!! +// double startTime = 0; // !!! // cout << edge->getID() << endl; assert(myDetectorEdgeMap.find(edge->getID()) != myDetectorEdgeMap.end()); const std::vector& flows = static_cast(edge)->getFlows(); - SUMOReal agg = 0; + double agg = 0; for (std::vector::const_iterator i = flows.begin(); i != flows.end(); ++i) { const FlowDef& srcFD = *i; if (srcFD.qLKW >= 0) { @@ -772,7 +768,7 @@ return (int) agg; /* !!! make this time variable if (flows.size()!=0) { - SUMOReal agg = 0; + double agg = 0; int beginIndex = (int)((time/stepOffset) - startTime); // !!! falsch!!! for (SUMOTime t=0; t::const_iterator i = myDetectors.begin(); i != myDetectors.end(); ++i) { RODFDetector* det = *i; // write the declaration into the file if (det->getType() == SINK_DETECTOR && flows.knows(det->getID())) { std::string filename = FileHelpers::getFilePath(file) + "vss_" + det->getID() + ".def.xml"; out.openTag(SUMO_TAG_VSS).writeAttr(SUMO_ATTR_ID, StringUtils::escapeXML(det->getID())).writeAttr(SUMO_ATTR_LANES, det->getLaneID()).writeAttr(SUMO_ATTR_FILE, filename).closeTag(); - SUMOReal defaultSpeed = net != 0 ? net->getEdge(det->getEdgeID())->getSpeed() : (SUMOReal) 200.; + double defaultSpeed = net != 0 ? net->getEdge(det->getEdgeID())->getSpeedLimit() : (double) 200.; det->writeSingleSpeedTrigger(filename, flows, startTime, endTime, stepOffset, defaultSpeed); } } @@ -815,13 +811,13 @@ void RODFDetectorCon::writeEndRerouterDetectors(const std::string& file) { OutputDevice& out = OutputDevice::getDevice(file); - out.writeXMLHeader("additional", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/additional_file.xsd\""); + out.writeXMLHeader("additional", "additional_file.xsd"); for (std::vector::const_iterator i = myDetectors.begin(); i != myDetectors.end(); ++i) { RODFDetector* det = *i; // write the declaration into the file if (det->getType() == SINK_DETECTOR) { out.openTag(SUMO_TAG_REROUTER).writeAttr(SUMO_ATTR_ID, "endrerouter_" + StringUtils::escapeXML(det->getID())).writeAttr(SUMO_ATTR_EDGES, det->getLaneID()); - out.writeAttr(SUMO_ATTR_POSITION, SUMOReal(0)).writeAttr(SUMO_ATTR_FILE, "endrerouter_" + det->getID() + ".def.xml").closeTag(); + out.writeAttr(SUMO_ATTR_POSITION, 0.).writeAttr(SUMO_ATTR_FILE, "endrerouter_" + det->getID() + ".def.xml").closeTag(); } } out.close(); @@ -833,12 +829,12 @@ bool includeSources, bool singleFile, bool friendly) { OutputDevice& out = OutputDevice::getDevice(file); - out.writeXMLHeader("additional"); + out.writeXMLHeader("additional", "additional_file.xsd"); for (std::vector::const_iterator i = myDetectors.begin(); i != myDetectors.end(); ++i) { RODFDetector* det = *i; // write the declaration into the file if (det->getType() != SOURCE_DETECTOR || includeSources) { - SUMOReal pos = det->getPos(); + double pos = det->getPos(); if (det->getType() == SOURCE_DETECTOR) { pos += 1; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFDetectorFlow.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFDetectorFlow.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFDetectorFlow.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFDetectorFlow.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Melanie Knocke /// @date Thu, 16.03.2006 -/// @version $Id: RODFDetectorFlow.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: RODFDetectorFlow.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Storage for flows within the DFROUTER /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2006-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2006-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include #include "RODFDetectorFlow.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -127,9 +123,9 @@ } -SUMOReal +double RODFDetectorFlows::getFlowSumSecure(const std::string& id) const { - SUMOReal ret = 0; + double ret = 0; if (knows(id)) { const std::vector& flows = getFlowDefs(id); for (std::vector::const_iterator i = flows.begin(); i != flows.end(); ++i) { @@ -141,13 +137,13 @@ } -SUMOReal +double RODFDetectorFlows::getMaxDetectorFlow() const { if (myMaxDetectorFlow < 0) { - SUMOReal max = 0; + double max = 0; std::map >::const_iterator j; for (j = myFastAccessFlows.begin(); j != myFastAccessFlows.end(); ++j) { - SUMOReal curr = 0; + double curr = 0; const std::vector& flows = (*j).second; for (std::vector::const_iterator i = flows.begin(); i != flows.end(); ++i) { curr += (*i).qPKW; @@ -185,8 +181,8 @@ for (std::map >::const_iterator i = myFastAccessFlows.begin(); i != myFastAccessFlows.end(); ++i) { std::cout << (*i).first << ":"; const std::vector& flows = (*i).second; - SUMOReal qPKW = 0; - SUMOReal qLKW = 0; + double qPKW = 0; + double qLKW = 0; for (std::vector::const_iterator j = flows.begin(); j != flows.end(); ++j) { qPKW += (*j).qPKW; qLKW += (*j).qLKW; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFDetectorFlow.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFDetectorFlow.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFDetectorFlow.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFDetectorFlow.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Eric Nicolay /// @author Michael Behrisch /// @date Thu, 16.03.2006 -/// @version $Id: RODFDetectorFlow.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RODFDetectorFlow.h 23150 2017-02-27 12:08:30Z behrisch $ /// // missing_desc /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,19 +47,19 @@ */ struct FlowDef { // Number of passenger vehicles that passed within the described time - SUMOReal qPKW; + double qPKW; // Number of heavy duty vehicles that passed within the described time - SUMOReal qLKW; + double qLKW; // Mean velocity of passenger vehicles within the described time - SUMOReal vPKW; + double vPKW; // Mean velocity of heavy duty vehicles within the described time - SUMOReal vLKW; + double vLKW; // begin time (in s) // int time; // probability for having a heavy duty vehicle(qKFZ!=0 ? (qLKW / qKFZ) : 0;) - SUMOReal fLKW; + double fLKW; // initialise with 0 - mutable SUMOReal isLKW; + mutable double isLKW; // bool firstSet; }; @@ -84,8 +84,8 @@ const std::vector& getFlowDefs(const std::string& id) const; bool knows(const std::string& det_id) const; - SUMOReal getFlowSumSecure(const std::string& id) const; - SUMOReal getMaxDetectorFlow() const; + double getFlowSumSecure(const std::string& id) const; + double getMaxDetectorFlow() const; void printAbsolute() const; void mesoJoin(const std::string& nid, const std::vector& oldids); @@ -93,7 +93,7 @@ protected: std::map > myFastAccessFlows; SUMOTime myBeginTime, myEndTime, myStepOffset; - mutable SUMOReal myMaxDetectorFlow; + mutable double myMaxDetectorFlow; private: /// @brief Invalidated copy constructor diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFDetector.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFDetector.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFDetector.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFDetector.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Eric Nicolay /// @author Michael Behrisch /// @date Thu, 16.03.2006 -/// @version $Id: RODFDetector.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: RODFDetector.h 23341 2017-03-13 10:11:12Z behrisch $ /// // Class representing a detector within the DFROUTER /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include "RODFRouteCont.h" @@ -99,7 +99,7 @@ * @see RODFDetectorType */ RODFDetector(const std::string& id, const std::string& laneID, - SUMOReal pos, const RODFDetectorType type); + double pos, const RODFDetectorType type); /** @brief Constructor @@ -139,7 +139,7 @@ /** @brief Returns the position at which the detector lies * @return The position of the detector at the lane */ - SUMOReal getPos() const { + double getPos() const { return myPosition; }; @@ -172,14 +172,14 @@ const std::map* >& dists, const RODFDetectorFlows& flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset, - bool includeUnusedRoutes, SUMOReal scale, - bool insertionsOnly, SUMOReal defaultSpeed) const; + bool includeUnusedRoutes, double scale, + bool insertionsOnly, double defaultSpeed) const; bool writeRoutes(std::vector& saved, OutputDevice& out); void writeSingleSpeedTrigger(const std::string& file, const RODFDetectorFlows& flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset, - SUMOReal defaultSpeed); + double defaultSpeed); void writeEndRerouterDetectors(const std::string& file); /// @} @@ -192,22 +192,22 @@ const RODFDetectorFlows& flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset); - const std::vector >& getSplitProbabilities() const { + const std::vector >& getSplitProbabilities() const { return mySplitProbabilities; } protected: int getFlowFor(const ROEdge* edge, SUMOTime time) const; - SUMOReal computeDistanceFactor(const RODFRouteDesc& rd) const; + double computeDistanceFactor(const RODFRouteDesc& rd) const; protected: std::string myLaneID; - SUMOReal myPosition; + double myPosition; RODFDetectorType myType; RODFRouteCont* myRoutes; std::set myPriorDetectors, myFollowingDetectors; - std::vector > mySplitProbabilities; + std::vector > mySplitProbabilities; std::map myRoute2Edge; @@ -248,7 +248,7 @@ SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset, const RODFNet& net, bool writeCalibrators, bool includeUnusedRoutes, - SUMOReal scale, + double scale, bool insertionsOnly); void writeEmitterPOIs(const std::string& file, @@ -269,7 +269,7 @@ void mesoJoin(const std::string& nid, const std::vector& oldids); - void setSpeedFactorAndDev(SUMOVTypeParameter& type, SUMOReal maxFactor, SUMOReal avgFactor, SUMOReal dev, bool forceDev); + void setSpeedFactorAndDev(SUMOVTypeParameter& type, double maxFactor, double avgFactor, double dev, bool forceDev); protected: /** @brief Clears the given distributions map, deleting the timed distributions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFDetectorHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFDetectorHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFDetectorHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFDetectorHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,7 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Thu, 16.03.2006 -/// @version $Id: RODFDetectorHandler.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: RODFDetectorHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A handler for loading detector descriptions /****************************************************************************/ @@ -43,10 +43,6 @@ #include "RODFDetectorHandler.h" #include "RODFNet.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -63,7 +59,7 @@ void RODFDetectorHandler::myStartElement(int element, const SUMOSAXAttributes& attrs) { - if (element == SUMO_TAG_DETECTOR_DEFINITION) { + if (element == SUMO_TAG_DETECTOR_DEFINITION || element == SUMO_TAG_E1DETECTOR || element == SUMO_TAG_INDUCTION_LOOP) { try { bool ok = true; // get the id, report an error if not given or empty... @@ -80,7 +76,7 @@ if (edge == 0 || laneIndex >= edge->getLaneNo()) { throw ProcessError("Unknown lane '" + lane + "' for detector '" + id + "' in '" + getFileName() + "'."); } - SUMOReal pos = attrs.get(SUMO_ATTR_POSITION, id.c_str(), ok); + double pos = attrs.get(SUMO_ATTR_POSITION, id.c_str(), ok); std::string mml_type = attrs.getOpt(SUMO_ATTR_TYPE, id.c_str(), ok, ""); if (!ok) { throw ProcessError(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFDetectorHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFDetectorHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFDetectorHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFDetectorHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Thu, 16.03.2006 -/// @version $Id: RODFDetectorHandler.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RODFDetectorHandler.h 22608 2017-01-17 06:28:54Z behrisch $ /// // missing_desc /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFDetFlowLoader.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFDetFlowLoader.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFDetFlowLoader.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFDetFlowLoader.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Thu, 16.03.2006 -/// @version $Id: RODFDetFlowLoader.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RODFDetFlowLoader.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A loader for detector flows /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,10 +41,6 @@ #include #include "RODFDetFlowLoader.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -79,7 +75,7 @@ if (!myDetectorContainer.knows(detName)) { continue; } - const SUMOReal parsedTime = TplConvert::_2SUMOReal((myLineHandler.get("time").c_str())) * myTimeScale - myTimeOffset; + const double parsedTime = TplConvert::_2double((myLineHandler.get("time").c_str())) * myTimeScale - myTimeOffset; // parsing as float to handle values which would cause int overflow if (parsedTime < myStartTime || parsedTime >= myEndTime) { if (!myHaveWarnedAboutOverridingBoundaries) { @@ -91,18 +87,18 @@ const SUMOTime time = (SUMOTime)(parsedTime + .5); FlowDef fd; fd.isLKW = 0; - fd.qPKW = TplConvert::_2SUMOReal(myLineHandler.get("qpkw").c_str()); + fd.qPKW = TplConvert::_2double(myLineHandler.get("qpkw").c_str()); fd.vPKW = 0; if (myLineHandler.know("vPKW")) { - fd.vPKW = TplConvert::_2SUMOReal(myLineHandler.get("vpkw").c_str()); + fd.vPKW = TplConvert::_2double(myLineHandler.get("vpkw").c_str()); } fd.qLKW = 0; if (myLineHandler.know("qLKW")) { - fd.qLKW = TplConvert::_2SUMOReal(myLineHandler.get("qlkw").c_str()); + fd.qLKW = TplConvert::_2double(myLineHandler.get("qlkw").c_str()); } fd.vLKW = 0; if (myLineHandler.know("vLKW")) { - fd.vLKW = TplConvert::_2SUMOReal(myLineHandler.get("vlkw").c_str()); + fd.vLKW = TplConvert::_2double(myLineHandler.get("vlkw").c_str()); } if (fd.qLKW < 0) { fd.qLKW = 0; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFDetFlowLoader.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFDetFlowLoader.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFDetFlowLoader.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFDetFlowLoader.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Eric Nicolay /// @author Michael Behrisch /// @date Thu, 16.03.2006 -/// @version $Id: RODFDetFlowLoader.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RODFDetFlowLoader.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A loader for detector flows /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFEdgeBuilder.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFEdgeBuilder.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFEdgeBuilder.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFEdgeBuilder.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Yun-Pang Floetteroed /// @date Thu, 16.03.2006 -/// @version $Id: RODFEdgeBuilder.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RODFEdgeBuilder.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Interface for building instances of dfrouter-edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2006-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2006-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,10 +33,6 @@ #include "RODFEdgeBuilder.h" #include "RODFEdge.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFEdgeBuilder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFEdgeBuilder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFEdgeBuilder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFEdgeBuilder.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Yun-Pang Floetteroed /// @date Thu, 16.03.2006 -/// @version $Id: RODFEdgeBuilder.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RODFEdgeBuilder.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Interface for building instances of dfrouter-edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2006-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2006-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFEdge.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFEdge.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFEdge.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFEdge.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Yun-Pang Floetteroed /// @date Thu, 16.03.2006 -/// @version $Id: RODFEdge.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: RODFEdge.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // An edge within the DFROUTER /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2006-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2006-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include #include "RODFEdge.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFEdge.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFEdge.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFEdge.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFEdge.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Yun-Pang Floetteroed /// @date Thu, 16.03.2006 -/// @version $Id: RODFEdge.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: RODFEdge.h 22608 2017-01-17 06:28:54Z behrisch $ /// // An edge within the DFROUTER /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2006-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2006-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFFrame.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Melanie Knocke /// @date Thu, 16.03.2006 -/// @version $Id: RODFFrame.cpp 21252 2016-07-28 06:37:09Z namdre $ +/// @version $Id: RODFFrame.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Sets and checks options for df-routing /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2006-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2006-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,10 +46,6 @@ #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFFrame.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Eric Nicolay /// @author Michael Behrisch /// @date Thu, 16.03.2006 -/// @version $Id: RODFFrame.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RODFFrame.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Sets and checks options for df-routing /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFNet.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFNet.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFNet.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFNet.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Thu, 16.03.2006 -/// @version $Id: RODFNet.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: RODFNet.cpp 24095 2017-04-27 13:45:19Z namdre $ /// // A DFROUTER-network /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,10 +46,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -201,7 +197,7 @@ std::map dets2Follow; dets2Follow[edge] = ROEdgeVector(); base.passedNo = 0; - SUMOReal minDist = OptionsCont::getOptions().getFloat("min-route-length"); + double minDist = OptionsCont::getOptions().getFloat("min-route-length"); toSolve.push(base); while (!toSolve.empty()) { RODFRouteDesc current = toSolve.top(); @@ -228,7 +224,7 @@ if (!hasApproached(last)) { // ok, no further connections to follow current.factor = 1.; - SUMOReal cdist = current.edges2Pass[0]->getFromJunction()->getPosition().distanceTo(current.edges2Pass.back()->getToJunction()->getPosition()); + double cdist = current.edges2Pass[0]->getFromJunction()->getPosition().distanceTo(current.edges2Pass.back()->getToJunction()->getPosition()); if (minDist < cdist) { into.addRouteDesc(current); } @@ -252,7 +248,7 @@ ///!!! //toDiscard.push_back(current); } current.factor = 1.; - SUMOReal cdist = current.edges2Pass[0]->getFromJunction()->getPosition().distanceTo(current.edges2Pass.back()->getToJunction()->getPosition()); + double cdist = current.edges2Pass[0]->getFromJunction()->getPosition().distanceTo(current.edges2Pass.back()->getToJunction()->getPosition()); if (minDist < cdist) { into.addRouteDesc(current); } @@ -270,7 +266,7 @@ // check for highway off-ramps if (myAmInHighwayMode) { // if it's beside the highway... - if (last->getSpeed() < 19.4 && last != getDetectorEdge(det)) { + if (last->getSpeedLimit() < 19.4 && last != getDetectorEdge(det)) { // ... and has more than one following edge if (myApproachedEdges.find(last)->second.size() > 1) { // -> let's add this edge and the following, but not any further @@ -288,7 +284,7 @@ WRITE_WARNING("Could not close route for '" + det.getID() + "'"); unfoundEnds.push_back(current); current.factor = 1.; - SUMOReal cdist = current.edges2Pass[0]->getFromJunction()->getPosition().distanceTo(current.edges2Pass.back()->getToJunction()->getPosition()); + double cdist = current.edges2Pass[0]->getFromJunction()->getPosition().distanceTo(current.edges2Pass.back()->getToJunction()->getPosition()); if (minDist < cdist) { into.addRouteDesc(current); } @@ -304,7 +300,7 @@ continue; } RODFRouteDesc t(current); - t.duration_2 += (appr[i]->getLength() / appr[i]->getSpeed()); //!!! + t.duration_2 += (appr[i]->getLength() / appr[i]->getSpeedLimit()); //!!! t.distance += appr[i]->getLength(); t.edges2Pass.push_back(appr[i]); if (!addNextNoFurther) { @@ -312,8 +308,8 @@ toSolve.push(t); } else { if (!hadOne) { - t.factor = (SUMOReal) 1. / (SUMOReal) appr.size(); - SUMOReal cdist = current.edges2Pass[0]->getFromJunction()->getPosition().distanceTo(current.edges2Pass.back()->getToJunction()->getPosition()); + t.factor = (double) 1. / (double) appr.size(); + double cdist = current.edges2Pass[0]->getFromJunction()->getPosition().distanceTo(current.edges2Pass.back()->getToJunction()->getPosition()); if (minDist < cdist) { into.addRouteDesc(t); } @@ -366,7 +362,7 @@ doneEdges[e] = routes; RODFRouteDesc rd; rd.edges2Pass.push_back(e); - rd.duration_2 = (e->getLength() / e->getSpeed()); //!!!; + rd.duration_2 = (e->getLength() / e->getSpeedLimit()); //!!!; rd.endDetectorEdge = 0; rd.lastDetectorEdge = 0; rd.distance = e->getLength(); @@ -388,14 +384,14 @@ const std::vector& r = routes->get(); for (std::vector::const_iterator j = r.begin(); j != r.end(); ++j) { const RODFRouteDesc& mrd = *j; - SUMOReal duration = mrd.duration_2; - SUMOReal distance = mrd.distance; + double duration = mrd.duration_2; + double distance = mrd.distance; // go through each route's edges ROEdgeVector::const_iterator routeend = mrd.edges2Pass.end(); for (ROEdgeVector::const_iterator k = mrd.edges2Pass.begin(); k != routeend; ++k) { // check whether any detectors lies on the current edge if (myDetectorsOnEdges.find(*k) == myDetectorsOnEdges.end()) { - duration -= (*k)->getLength() / (*k)->getSpeed(); + duration -= (*k)->getLength() / (*k)->getSpeedLimit(); distance -= (*k)->getLength(); continue; } @@ -418,7 +414,7 @@ ((RODFDetector&) m).addRoute(nrd); } } - duration -= (*k)->getLength() / (*k)->getSpeed(); + duration -= (*k)->getLength() / (*k)->getSpeedLimit(); distance -= (*k)->getLength(); } } @@ -540,8 +536,8 @@ } } } - inFlow.vLKW /= (SUMOReal) previous.size(); - inFlow.vPKW /= (SUMOReal) previous.size(); + inFlow.vLKW /= (double) previous.size(); + inFlow.vPKW /= (double) previous.size(); // collect outgoing FlowDef outFlow; outFlow.qLKW = 0; @@ -561,14 +557,14 @@ } } } - outFlow.vLKW /= (SUMOReal) latter.size(); - outFlow.vPKW /= (SUMOReal) latter.size(); + outFlow.vLKW /= (double) latter.size(); + outFlow.vPKW /= (double) latter.size(); // FlowDef mFlow; mFlow.qLKW = inFlow.qLKW - outFlow.qLKW; mFlow.qPKW = inFlow.qPKW - outFlow.qPKW; - mFlow.vLKW = (inFlow.vLKW + outFlow.vLKW) / (SUMOReal) 2.; - mFlow.vPKW = (inFlow.vPKW + outFlow.vPKW) / (SUMOReal) 2.; + mFlow.vLKW = (inFlow.vLKW + outFlow.vLKW) / (double) 2.; + mFlow.vPKW = (inFlow.vPKW + outFlow.vPKW) / (double) 2.; mflows.push_back(mFlow); } static_cast(getDetectorEdge(*detector))->setFlows(mflows); @@ -676,7 +672,7 @@ } -SUMOReal +double RODFNet::getAbsPos(const RODFDetector& det) const { if (det.getPos() >= 0) { return det.getPos(); @@ -743,7 +739,7 @@ if (edge != getDetectorEdge(det)) { // ok, we are at one of the edges in front if (myAmInHighwayMode) { - if (edge->getSpeed() >= 19.4) { + if (edge->getSpeedLimit() >= 19.4) { if (hasDetector(edge)) { // we are still on the highway and there is another detector return false; @@ -769,7 +765,7 @@ } if (myAmInHighwayMode) { - if (edge->getSpeed() < 19.4 && edge != getDetectorEdge(det)) { + if (edge->getSpeedLimit() < 19.4 && edge != getDetectorEdge(det)) { // we have left the highway already // -> the detector will be a highway source if (!hasDetector(edge)) { @@ -842,7 +838,7 @@ if (edge != getDetectorEdge(det)) { // ok, we are at one of the edges coming behind if (myAmInHighwayMode) { - if (edge->getSpeed() >= 19.4) { + if (edge->getSpeedLimit() >= 19.4) { if (hasDetector(edge)) { // we are still on the highway and there is another detector return false; @@ -852,7 +848,7 @@ } if (myAmInHighwayMode) { - if (edge->getSpeed() < 19.4 && edge != getDetectorEdge(det)) { + if (edge->getSpeedLimit() < 19.4 && edge != getDetectorEdge(det)) { if (hasDetector(edge)) { return true; } @@ -908,7 +904,7 @@ } } } else { - if (myAmInHighwayMode && edge->getSpeed() < 19.) { + if (myAmInHighwayMode && edge->getSpeedLimit() < 19.) { return false; } } @@ -939,17 +935,17 @@ SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset) { std::map, idComp>::iterator i; - SUMOReal speedFactorSumPKW = 0; - SUMOReal speedFactorSumLKW = 0; - SUMOReal speedFactorCountPKW = 0; - SUMOReal speedFactorCountLKW = 0; + double speedFactorSumPKW = 0; + double speedFactorSumLKW = 0; + double speedFactorCountPKW = 0; + double speedFactorCountLKW = 0; for (i = myDetectorsOnEdges.begin(); i != myDetectorsOnEdges.end(); ++i) { ROEdge* into = (*i).first; - const SUMOReal maxSpeedPKW = into->getVClassMaxSpeed(SVC_PASSENGER); - const SUMOReal maxSpeedLKW = into->getVClassMaxSpeed(SVC_TRUCK); + const double maxSpeedPKW = into->getVClassMaxSpeed(SVC_PASSENGER); + const double maxSpeedLKW = into->getVClassMaxSpeed(SVC_TRUCK); const std::vector& dets = (*i).second; - std::map > cliques; + std::map > cliques; std::vector* maxClique = 0; for (std::vector::const_iterator j = dets.begin(); j != dets.end(); ++j) { if (!flows.knows(*j)) { @@ -957,7 +953,7 @@ } const RODFDetector& det = detectors.getDetector(*j); bool found = false; - for (std::map >::iterator k = cliques.begin(); !found && k != cliques.end(); ++k) { + for (std::map >::iterator k = cliques.begin(); !found && k != cliques.end(); ++k) { if (fabs((*k).first - det.getPos()) < 1) { (*k).second.push_back(*j); if ((*k).second.size() > maxClique->size()) { @@ -994,24 +990,24 @@ FlowDef& fd = mflows[index]; fd.qPKW += srcFD.qPKW; fd.qLKW += srcFD.qLKW; - fd.vLKW += srcFD.vLKW / (SUMOReal) maxClique->size(); - fd.vPKW += srcFD.vPKW / (SUMOReal) maxClique->size(); - fd.fLKW += srcFD.fLKW / (SUMOReal) maxClique->size(); - fd.isLKW += srcFD.isLKW / (SUMOReal) maxClique->size(); - const SUMOReal speedFactorPKW = srcFD.vPKW / 3.6 / maxSpeedPKW; - const SUMOReal speedFactorLKW = srcFD.vLKW / 3.6 / maxSpeedLKW; + fd.vLKW += srcFD.vLKW / (double) maxClique->size(); + fd.vPKW += srcFD.vPKW / (double) maxClique->size(); + fd.fLKW += srcFD.fLKW / (double) maxClique->size(); + fd.isLKW += srcFD.isLKW / (double) maxClique->size(); + const double speedFactorPKW = srcFD.vPKW / 3.6 / maxSpeedPKW; + const double speedFactorLKW = srcFD.vLKW / 3.6 / maxSpeedLKW; myMaxSpeedFactorPKW = MAX2(myMaxSpeedFactorPKW, speedFactorPKW); myMaxSpeedFactorLKW = MAX2(myMaxSpeedFactorLKW, speedFactorLKW); speedFactorCountPKW += srcFD.qPKW; speedFactorCountLKW += srcFD.qLKW; speedFactorSumPKW += srcFD.qPKW * speedFactorPKW; speedFactorSumLKW += srcFD.qLKW * speedFactorLKW; - if (!didWarn && srcFD.vPKW > 0 && srcFD.vPKW < 255 && srcFD.vPKW / 3.6 > into->getSpeed()) { - WRITE_MESSAGE("Detected PKW speed (" + toString(srcFD.vPKW / 3.6, 3) + ") higher than allowed speed (" + toString(into->getSpeed(), 3) + ") at '" + (*l) + "' on edge '" + into->getID() + "'."); + if (!didWarn && srcFD.vPKW > 0 && srcFD.vPKW < 255 && srcFD.vPKW / 3.6 > into->getSpeedLimit()) { + WRITE_MESSAGE("Detected PKW speed (" + toString(srcFD.vPKW / 3.6, 3) + ") higher than allowed speed (" + toString(into->getSpeedLimit(), 3) + ") at '" + (*l) + "' on edge '" + into->getID() + "'."); didWarn = true; } - if (!didWarn && srcFD.vLKW > 0 && srcFD.vLKW < 255 && srcFD.vLKW / 3.6 > into->getSpeed()) { - WRITE_MESSAGE("Detected LKW speed (" + toString(srcFD.vLKW / 3.6, 3) + ") higher than allowed speed (" + toString(into->getSpeed(), 3) + ") at '" + (*l) + "' on edge '" + into->getID() + "'."); + if (!didWarn && srcFD.vLKW > 0 && srcFD.vLKW < 255 && srcFD.vLKW / 3.6 > into->getSpeedLimit()) { + WRITE_MESSAGE("Detected LKW speed (" + toString(srcFD.vLKW / 3.6, 3) + ") higher than allowed speed (" + toString(into->getSpeedLimit(), 3) + ") at '" + (*l) + "' on edge '" + into->getID() + "'."); didWarn = true; } } @@ -1084,12 +1080,12 @@ std::map, idComp>::iterator i; for (i = myDetectorsOnEdges.begin(); i != myDetectorsOnEdges.end(); ++i) { const std::vector& dets = (*i).second; - std::map > cliques; + std::map > cliques; // compute detector cliques for (std::vector::const_iterator j = dets.begin(); j != dets.end(); ++j) { const RODFDetector& det = detectors.getDetector(*j); bool found = false; - for (std::map >::iterator k = cliques.begin(); !found && k != cliques.end(); ++k) { + for (std::map >::iterator k = cliques.begin(); !found && k != cliques.end(); ++k) { if (fabs((*k).first - det.getPos()) < 10.) { (*k).second.push_back(*j); found = true; @@ -1101,7 +1097,7 @@ } } // join detector cliques - for (std::map >::iterator m = cliques.begin(); m != cliques.end(); ++m) { + for (std::map >::iterator m = cliques.begin(); m != cliques.end(); ++m) { std::vector clique = (*m).second; // do not join if only one if (clique.size() == 1) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFNet.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFNet.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFNet.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFNet.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Eric Nicolay /// @author Michael Behrisch /// @date Thu, 16.03.2006 -/// @version $Id: RODFNet.h 21252 2016-07-28 06:37:09Z namdre $ +/// @version $Id: RODFNet.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A DFROUTER-network /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -67,7 +67,7 @@ bool sourcesStrict) const; void buildRoutes(RODFDetectorCon& det, bool keepUnfoundEnds, bool includeInBetween, bool keepShortestOnly, int maxFollowingLength) const; - SUMOReal getAbsPos(const RODFDetector& det) const; + double getAbsPos(const RODFDetector& det) const; void buildEdgeFlowMap(const RODFDetectorFlows& flows, const RODFDetectorCon& detectors, @@ -91,19 +91,19 @@ bool hasDetector(ROEdge* edge) const; const std::vector& getDetectorList(ROEdge* edge) const; - SUMOReal getMaxSpeedFactorPKW() const { + double getMaxSpeedFactorPKW() const { return myMaxSpeedFactorPKW; } - SUMOReal getMaxSpeedFactorLKW() const { + double getMaxSpeedFactorLKW() const { return myMaxSpeedFactorLKW; } - SUMOReal getAvgSpeedFactorPKW() const { + double getAvgSpeedFactorPKW() const { return myAvgSpeedFactorPKW; } - SUMOReal getAvgSpeedFactorLKW() const { + double getAvgSpeedFactorLKW() const { return myAvgSpeedFactorLKW; } @@ -192,10 +192,10 @@ bool myKeepTurnarounds; /// @brief maximum speed factor in measurements - SUMOReal myMaxSpeedFactorPKW; - SUMOReal myMaxSpeedFactorLKW; - SUMOReal myAvgSpeedFactorPKW; - SUMOReal myAvgSpeedFactorLKW; + double myMaxSpeedFactorPKW; + double myMaxSpeedFactorLKW; + double myAvgSpeedFactorPKW; + double myAvgSpeedFactorLKW; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFRouteCont.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFRouteCont.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFRouteCont.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFRouteCont.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date Thu, 16.03.2006 -/// @version $Id: RODFRouteCont.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RODFRouteCont.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A container for routes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFRouteCont.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFRouteCont.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFRouteCont.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFRouteCont.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Thu, 16.03.2006 -/// @version $Id: RODFRouteCont.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RODFRouteCont.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A container for routes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFRouteDesc.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFRouteDesc.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/dfrouter/RODFRouteDesc.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/dfrouter/RODFRouteDesc.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Thu, 16.03.2006 -/// @version $Id: RODFRouteDesc.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RODFRouteDesc.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A route within the DFROUTER /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -56,16 +56,16 @@ ROEdgeVector edges2Pass; /// @brief The name of the route std::string routename; - SUMOReal duration_2; - SUMOReal distance; + double duration_2; + double distance; int passedNo; const ROEdge* endDetectorEdge; const ROEdge* lastDetectorEdge; - SUMOReal distance2Last; + double distance2Last; SUMOTime duration2Last; - SUMOReal overallProb; - SUMOReal factor; + double overallProb; + double factor; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/duarouter/duarouter_main.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/duarouter/duarouter_main.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/duarouter/duarouter_main.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/duarouter/duarouter_main.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Thu, 06 Jun 2002 -/// @version $Id: duarouter_main.cpp 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: duarouter_main.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Main for DUAROUTER /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -63,10 +63,6 @@ #include "RODUAFrame.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // functions @@ -116,6 +112,8 @@ SUMOAbstractRouter* router; const std::string measure = oc.getString("weight-attribute"); const std::string routingAlgorithm = oc.getString("routing-algorithm"); + const SUMOTime begin = string2time(oc.getString("begin")); + const SUMOTime end = string2time(oc.getString("end")); if (measure == "traveltime") { if (routingAlgorithm == "dijkstra") { if (net.hasPermissions()) { @@ -145,13 +143,12 @@ ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic, SVC_IGNORING, weightPeriod, false); } } else if (routingAlgorithm == "CHWrapper") { - const SUMOTime begin = string2time(oc.getString("begin")); const SUMOTime weightPeriod = (oc.isSet("weight-files") ? string2time(oc.getString("weight-period")) : std::numeric_limits::max()); - router = new CHRouterWrapper >( - ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic, begin, weightPeriod); + ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic, + begin, end, weightPeriod, oc.getInt("routing-threads")); } else { throw ProcessError("Unknown routing Algorithm '" + routingAlgorithm + "'!"); } @@ -189,8 +186,7 @@ // process route definitions try { net.openOutput(oc, altFilename); - loader.processRoutes(string2time(oc.getString("begin")), string2time(oc.getString("end")), - string2time(oc.getString("route-steps")), net, provider); + loader.processRoutes(begin, end, string2time(oc.getString("route-steps")), net, provider); // end the processing net.cleanup(); } catch (ProcessError&) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/duarouter/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/duarouter/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/duarouter/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/duarouter/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,3 @@ -if CHECK_MEMORY_LEAKS -MEM_LIBS = ../foreign/nvwa/libnvwa.a -endif - bin_PROGRAMS = duarouter duarouter_SOURCES = duarouter_main.cpp \ @@ -13,6 +9,7 @@ duarouter_LDADD = ../router/librouter.a \ ../utils/options/liboptions.a \ ../utils/xml/libxml.a \ +../utils/distribution/libdistribution.a \ ../utils/vehicle/libvehicle.a \ ../utils/common/libcommon.a \ ../utils/importio/libimportio.a \ @@ -21,5 +18,4 @@ ../utils/emissions/libemissions.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ -l$(LIB_XERCES) $(FOX_LDFLAGS) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/duarouter/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/duarouter/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/duarouter/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/duarouter/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -99,12 +99,13 @@ am__DEPENDENCIES_1 = duarouter_DEPENDENCIES = ../router/librouter.a \ ../utils/options/liboptions.a ../utils/xml/libxml.a \ + ../utils/distribution/libdistribution.a \ ../utils/vehicle/libvehicle.a ../utils/common/libcommon.a \ ../utils/importio/libimportio.a \ ../utils/iodevices/libiodevices.a ../utils/geom/libgeom.a \ ../utils/emissions/libemissions.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ - ../foreign/tcpip/libtcpip.a $(MEM_LIBS) $(am__DEPENDENCIES_1) + ../foreign/tcpip/libtcpip.a $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -334,7 +335,6 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -@CHECK_MEMORY_LEAKS_TRUE@MEM_LIBS = ../foreign/nvwa/libnvwa.a duarouter_SOURCES = duarouter_main.cpp \ RODUAEdgeBuilder.cpp RODUAEdgeBuilder.h \ RODUAFrame.cpp RODUAFrame.h @@ -343,6 +343,7 @@ duarouter_LDADD = ../router/librouter.a \ ../utils/options/liboptions.a \ ../utils/xml/libxml.a \ +../utils/distribution/libdistribution.a \ ../utils/vehicle/libvehicle.a \ ../utils/common/libcommon.a \ ../utils/importio/libimportio.a \ @@ -351,7 +352,6 @@ ../utils/emissions/libemissions.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ -l$(LIB_XERCES) $(FOX_LDFLAGS) all: all-am diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/duarouter/RODUAEdgeBuilder.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/duarouter/RODUAEdgeBuilder.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/duarouter/RODUAEdgeBuilder.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/duarouter/RODUAEdgeBuilder.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Yun-Pang Floetteroed /// @date Tue, 20 Jan 2004 -/// @version $Id: RODUAEdgeBuilder.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RODUAEdgeBuilder.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Interface for building instances of duarouter-edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,10 +34,6 @@ #include "RODUAEdgeBuilder.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/duarouter/RODUAEdgeBuilder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/duarouter/RODUAEdgeBuilder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/duarouter/RODUAEdgeBuilder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/duarouter/RODUAEdgeBuilder.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Yun-Pang Floetteroed /// @date Tue, 20 Jan 2004 -/// @version $Id: RODUAEdgeBuilder.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RODUAEdgeBuilder.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Interface for building instances of duarouter-edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/duarouter/RODUAFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/duarouter/RODUAFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/duarouter/RODUAFrame.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/duarouter/RODUAFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: RODUAFrame.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RODUAFrame.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Sets and checks options for dua-routing /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,10 +44,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -101,11 +97,11 @@ RODUAFrame::addDUAOptions() { OptionsCont& oc = OptionsCont::getOptions(); // register Gawron's DUE-settings - oc.doRegister("gawron.beta", new Option_Float(SUMOReal(0.3))); + oc.doRegister("gawron.beta", new Option_Float(double(0.3))); oc.addSynonyme("gawron.beta", "gBeta", true); oc.addDescription("gawron.beta", "Processing", "Use FLOAT as Gawron's beta"); - oc.doRegister("gawron.a", new Option_Float(SUMOReal(0.05))); + oc.doRegister("gawron.a", new Option_Float(double(0.05))); oc.addSynonyme("gawron.a", "gA", true); oc.addDescription("gawron.a", "Processing", "Use FLOAT as Gawron's a"); @@ -124,18 +120,21 @@ oc.doRegister("route-choice-method", new Option_String("gawron")); oc.addDescription("route-choice-method", "Processing", "Choose a route choice method: gawron, logit, or lohse"); - oc.doRegister("logit.beta", new Option_Float(SUMOReal(-1))); + oc.doRegister("logit.beta", new Option_Float(double(-1))); oc.addSynonyme("logit.beta", "lBeta", true); oc.addDescription("logit.beta", "Processing", "Use FLOAT as logit's beta"); - oc.doRegister("logit.gamma", new Option_Float(SUMOReal(1))); + oc.doRegister("logit.gamma", new Option_Float(double(1))); oc.addSynonyme("logit.gamma", "lGamma", true); oc.addDescription("logit.gamma", "Processing", "Use FLOAT as logit's gamma"); - oc.doRegister("logit.theta", new Option_Float(SUMOReal(-1))); + oc.doRegister("logit.theta", new Option_Float(double(-1))); oc.addSynonyme("logit.theta", "lTheta", true); oc.addDescription("logit.theta", "Processing", "Use FLOAT as logit's theta (negative values mean auto-estimation)"); + oc.doRegister("persontrip.walkfactor", new Option_Float(double(0.9))); + oc.addDescription("persontrip.walkfactor", "Processing", "Use FLOAT as a factor on pedestrian maximum speed during intermodal routing"); + } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/duarouter/RODUAFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/duarouter/RODUAFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/duarouter/RODUAFrame.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/duarouter/RODUAFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: RODUAFrame.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RODUAFrame.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Sets and checks options for dua-routing /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/Makefile.am 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/Makefile.am 2017-07-23 16:22:07.000000000 +0000 @@ -1,9 +1,5 @@ -if CHECK_MEMORY_LEAKS -MEMDIRS = nvwa -endif - if WITH_GUI GUIDIRS = polyfonts rtree endif -SUBDIRS = eulerspiral mersenne tcpip PHEMlight $(MEMDIRS) $(GUIDIRS) +SUBDIRS = eulerspiral mersenne tcpip PHEMlight $(GUIDIRS) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/Makefile.in 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/Makefile.in 2017-07-23 16:22:07.000000000 +0000 @@ -142,8 +142,8 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -DIST_SUBDIRS = eulerspiral mersenne tcpip PHEMlight nvwa \ - polyfonts rtree +DIST_SUBDIRS = eulerspiral mersenne tcpip PHEMlight polyfonts \ + rtree DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ @@ -313,9 +313,8 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -@CHECK_MEMORY_LEAKS_TRUE@MEMDIRS = nvwa @WITH_GUI_TRUE@GUIDIRS = polyfonts rtree -SUBDIRS = eulerspiral mersenne tcpip PHEMlight $(MEMDIRS) $(GUIDIRS) +SUBDIRS = eulerspiral mersenne tcpip PHEMlight $(GUIDIRS) all: all-recursive .SUFFIXES: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/nvwa/debug_new.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/nvwa/debug_new.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/nvwa/debug_new.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/nvwa/debug_new.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,1004 +0,0 @@ -// -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- -// vim:tabstop=4:shiftwidth=4:expandtab: -#ifdef _MSC_VER -#include -#else -#include -#endif -#ifdef CHECK_MEMORY_LEAKS - -/* - * Copyright (C) 2004-2013 Wu Yongwei - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute - * it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must - * not claim that you wrote the original software. If you use this - * software in a product, an acknowledgement in the product - * documentation would be appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must - * not be misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source - * distribution. - * - * This file is part of Stones of Nvwa: - * http://sourceforge.net/projects/nvwa - * - */ - -/** - * @file debug_new.cpp - * - * Implementation of debug versions of new and delete to check leakage. - * - * @date 2013-12-31 - */ - -#include // std::bad_alloc/nothrow_t -#include // assert -#include // fprintf/stderr -#include // abort -#include // strcpy/strncpy/sprintf -#if defined(__unix__) || defined(__unix) || \ - (defined(__APPLE__) && defined(__MACH__)) -#include // alloca -#endif -#ifdef _WIN32 -#include // alloca -#endif -#include "_nvwa.h" // NVWA_NAMESPACE_* -#include "c++11.h" // _NOEXCEPT -#include "fast_mutex.h" // nvwa::fast_mutex -#include "static_assert.h" // STATIC_ASSERT - -#if !_FAST_MUTEX_CHECK_INITIALIZATION && !defined(_NOTHREADS) -#error "_FAST_MUTEX_CHECK_INITIALIZATION not set: check_leaks may not work" -#endif - -/** - * @def _DEBUG_NEW_ALIGNMENT - * - * The alignment requirement of allocated memory blocks. It must be a - * power of two. - */ -#ifndef _DEBUG_NEW_ALIGNMENT -#define _DEBUG_NEW_ALIGNMENT 16 -#endif - -/** - * @def _DEBUG_NEW_CALLER_ADDRESS - * - * The expression to return the caller address. nvwa#print_position will - * later on use this address to print the position information of memory - * operation points. - */ -#ifndef _DEBUG_NEW_CALLER_ADDRESS -#ifdef __GNUC__ -#define _DEBUG_NEW_CALLER_ADDRESS __builtin_return_address(0) -#else -#define _DEBUG_NEW_CALLER_ADDRESS NULL -#endif -#endif - -/** - * @def _DEBUG_NEW_ERROR_ACTION - * - * The action to take when an error occurs. The default behaviour is to - * call \e abort, unless \c _DEBUG_NEW_ERROR_CRASH is defined, in which - * case a segmentation fault will be triggered instead (which can be - * useful on platforms like Windows that do not generate a core dump - * when \e abort is called). - */ -#ifndef _DEBUG_NEW_ERROR_ACTION -#ifndef _DEBUG_NEW_ERROR_CRASH -#define _DEBUG_NEW_ERROR_ACTION abort() -#else -#define _DEBUG_NEW_ERROR_ACTION do { *((char*)0) = 0; abort(); } while (0) -#endif -#endif - -/** - * @def _DEBUG_NEW_FILENAME_LEN - * - * The length of file name stored if greater than zero. If it is zero, - * only a const char pointer will be stored. Currently the default - * value is non-zero (thus to copy the file name) on non-Windows - * platforms, because I once found that the exit leakage check could not - * access the address of the file name on Linux (in my case, a core dump - * occurred when check_leaks tried to access the file name in a shared - * library after a \c SIGINT). This value makes the size of - * new_ptr_list_t \c 64 on non-Windows 32-bit platforms. - */ -#ifndef _DEBUG_NEW_FILENAME_LEN -#ifdef _WIN32 -#define _DEBUG_NEW_FILENAME_LEN 0 -#else -#define _DEBUG_NEW_FILENAME_LEN 44 -#endif -#endif - -/** - * @def _DEBUG_NEW_PROGNAME - * - * The program (executable) name to be set at compile time. It is - * better to assign the full program path to nvwa#new_progname in \e main - * (at run time) than to use this (compile-time) macro, but this macro - * serves well as a quick hack. Note also that double quotation marks - * need to be used around the program name, i.e., one should specify a - * command-line option like -D_DEBUG_NEW_PROGNAME=\\"a.out\" - * in \e bash, or -D_DEBUG_NEW_PROGNAME=\\"a.exe\" in the - * Windows command prompt. - */ -#ifndef _DEBUG_NEW_PROGNAME -#define _DEBUG_NEW_PROGNAME NULL -#endif - -/** - * @def _DEBUG_NEW_STD_OPER_NEW - * - * Macro to indicate whether the standard-conformant behaviour of - * operator new is wanted. It is on by default now, but - * the user may set it to \c 0 to revert to the old behaviour. - */ -#ifndef _DEBUG_NEW_STD_OPER_NEW -#define _DEBUG_NEW_STD_OPER_NEW 1 -#endif - -/** - * @def _DEBUG_NEW_TAILCHECK - * - * Macro to indicate whether a writing-past-end check will be performed. - * Define it to a positive integer as the number of padding bytes at the - * end of a memory block for checking. - */ -#ifndef _DEBUG_NEW_TAILCHECK -#define _DEBUG_NEW_TAILCHECK 0 -#endif - -/** - * @def _DEBUG_NEW_TAILCHECK_CHAR - * - * Value of the padding bytes at the end of a memory block. - */ -#ifndef _DEBUG_NEW_TAILCHECK_CHAR -#define _DEBUG_NEW_TAILCHECK_CHAR 0xCC -#endif - -/** - * @def _DEBUG_NEW_USE_ADDR2LINE - * - * Whether to use \e addr2line to convert a caller address to file/line - * information. Defining it to a non-zero value will enable the - * conversion (automatically done if GCC is detected). Defining it to - * zero will disable the conversion. - */ -#ifndef _DEBUG_NEW_USE_ADDR2LINE -#ifdef __GNUC__ -#define _DEBUG_NEW_USE_ADDR2LINE 1 -#else -#define _DEBUG_NEW_USE_ADDR2LINE 0 -#endif -#endif - -#ifdef _MSC_VER -#pragma warning(disable: 4074) // #pragma init_seg(compiler) used -#pragma warning(disable: 4290) // C++ exception specification ignored -#if _MSC_VER >= 1400 // Visual Studio 2005 or later -#pragma warning(disable: 4996) // Use the `unsafe' strncpy -#endif -#pragma init_seg(compiler) -#endif - -#undef _DEBUG_NEW_EMULATE_MALLOC -#undef _DEBUG_NEW_REDEFINE_NEW -/** - * Macro to indicate whether redefinition of \c new is wanted. Here it - * is defined to \c 0 to disable the redefinition of \c new. - */ -#define _DEBUG_NEW_REDEFINE_NEW 0 -#include "debug_new.h" - -/** - * Gets the aligned value of memory block size. - */ -#define ALIGN(s) \ - (((s) + _DEBUG_NEW_ALIGNMENT - 1) & ~(_DEBUG_NEW_ALIGNMENT - 1)) - -NVWA_NAMESPACE_BEGIN - -/** - * The platform memory alignment. The current value works well in - * platforms I have tested: Windows XP, Windows 7 x64, and Mac OS X - * Leopard. It may be smaller than the real alignment, but must be - * bigger than \c sizeof(size_t) for it work. nvwa#debug_new_recorder - * uses it to detect misaligned pointer returned by `new - * NonPODType[size]'. - */ -const size_t PLATFORM_MEM_ALIGNMENT = sizeof(size_t) * 2; - -/** - * Structure to store the position information where \c new occurs. - */ -struct new_ptr_list_t -{ - new_ptr_list_t* next; ///< Pointer to the next memory block - new_ptr_list_t* prev; ///< Pointer to the previous memory block - size_t size; ///< Size of the memory block - union - { -#if _DEBUG_NEW_FILENAME_LEN == 0 - const char* file; ///< Pointer to the file name of the caller -#else - char file[_DEBUG_NEW_FILENAME_LEN]; ///< File name of the caller -#endif - void* addr; ///< Address of the caller to \e new - }; - unsigned line :31; ///< Line number of the caller; or \c 0 - unsigned is_array:1; ///< Non-zero iff new[] is used - unsigned magic; ///< Magic number for error detection -}; - -/** - * Definition of the constant magic number used for error detection. - */ -static const unsigned DEBUG_NEW_MAGIC = 0x4442474E; - -/** - * The extra memory allocated by operator new. - */ -static const int ALIGNED_LIST_ITEM_SIZE = ALIGN(sizeof(new_ptr_list_t)); - -/** - * List of all new'd pointers. - */ -static new_ptr_list_t new_ptr_list = { - &new_ptr_list, - &new_ptr_list, - 0, - { -#if _DEBUG_NEW_FILENAME_LEN == 0 - NULL -#else - "" -#endif - }, - 0, - 0, - DEBUG_NEW_MAGIC -}; - -/** - * The mutex guard to protect simultaneous access to the pointer list. - */ -static fast_mutex new_ptr_lock; - -/** - * The mutex guard to protect simultaneous output to #new_output_fp. - */ -static fast_mutex new_output_lock; - -/** - * Total memory allocated in bytes. - */ -static size_t total_mem_alloc = 0; - -/** - * Flag to control whether #check_leaks will be automatically called on - * program exit. - */ -bool new_autocheck_flag = true; - -/** - * Flag to control whether verbose messages are output. - */ -bool new_verbose_flag = false; - -/** - * Pointer to the output stream. The default output is \e stderr, and - * one may change it to a user stream if needed (say, #new_verbose_flag - * is \c true and there are a lot of (de)allocations). - */ -FILE* new_output_fp = stderr; - -/** - * Pointer to the program name. Its initial value is the macro - * #_DEBUG_NEW_PROGNAME. You should try to assign the program path to - * it early in your application. Assigning argv[0] to it - * in \e main is one way. If you use \e bash or \e ksh (or similar), - * the following statement is probably what you want: - * `new_progname = getenv("_");'. - */ -const char* new_progname = _DEBUG_NEW_PROGNAME; - -#if _DEBUG_NEW_USE_ADDR2LINE -/** - * Tries printing the position information from an instruction address. - * This is the version that uses \e addr2line. - * - * @param addr the instruction address to convert and print - * @return \c true if the address is converted successfully (and - * the result is printed); \c false if no useful - * information is got (and nothing is printed) - */ -static bool print_position_from_addr(const void* addr) -{ - static const void* last_addr = NULL; - static char last_info[256] = ""; - if (addr == last_addr) - { - if (last_info[0] == '\0') - return false; - fprintf(new_output_fp, "%s", last_info); - return true; - } - if (new_progname) - { -#if defined(__APPLE__) && defined(__MACH__) - const char addr2line_cmd[] = "atos -o "; -#else - const char addr2line_cmd[] = "addr2line -e "; -#endif -#if defined(__CYGWIN__) || defined(_WIN32) - const int exeext_len = 4; -#else - const int exeext_len = 0; -#endif -#if !defined(__CYGWIN__) && \ - (defined(__unix__) || defined(__unix) || \ - (defined(__APPLE__) && defined(__MACH__))) - const char ignore_err[] = " 2>/dev/null"; -#elif defined(__CYGWIN__) || \ - (defined(_WIN32) && defined(WINVER) && WINVER >= 0x0500) - const char ignore_err[] = " 2>nul"; -#else - const char ignore_err[] = ""; -#endif - char* cmd = (char*)alloca(strlen(new_progname) - + exeext_len - + sizeof addr2line_cmd - 1 - + sizeof ignore_err - 1 - + sizeof(void*) * 2 - + 4 /* SP + "0x" + null */); - strcpy(cmd, addr2line_cmd); - strcpy(cmd + sizeof addr2line_cmd - 1, new_progname); - size_t len = strlen(cmd); -#if defined(__CYGWIN__) || defined(_WIN32) - if (len <= 4 - || (strcmp(cmd + len - 4, ".exe") != 0 && - strcmp(cmd + len - 4, ".EXE") != 0)) - { - strcpy(cmd + len, ".exe"); - len += 4; - } -#endif - sprintf(cmd + len, " %p%s", addr, ignore_err); - FILE* fp = popen(cmd, "r"); - if (fp) - { - char buffer[sizeof last_info] = ""; - len = 0; - if (fgets(buffer, sizeof buffer, fp)) - { - len = strlen(buffer); - if (buffer[len - 1] == '\n') - buffer[--len] = '\0'; - } - int res = pclose(fp); - // Display the file/line information only if the command - // is executed successfully and the output points to a - // valid position, but the result will be cached if only - // the command is executed successfully. - if (res == 0 && len > 0) - { - last_addr = addr; - if (buffer[len - 1] == '0' && buffer[len - 2] == ':') - last_info[0] = '\0'; - else - { - fprintf(new_output_fp, "%s", buffer); - strcpy(last_info, buffer); - return true; - } - } - } - } - return false; -} -#else -/** - * Tries printing the position information from an instruction address. - * This is the stub version that does nothing at all. - * - * @return \c false always - */ -static bool print_position_from_addr(const void*) -{ - return false; -} -#endif // _DEBUG_NEW_USE_ADDR2LINE - -/** - * Prints the position information of a memory operation point. When \c - * _DEBUG_NEW_USE_ADDR2LINE is defined to a non-zero value, this - * function will try to convert a given caller address to file/line - * information with \e addr2line. - * - * @param ptr source file name if \e line is non-zero; caller address - * otherwise - * @param line source line number if non-zero; indication that \e ptr - * is the caller address otherwise - */ -static void print_position(const void* ptr, int line) -{ - if (line != 0) // Is file/line information present? - { - fprintf(new_output_fp, "%s:%d", (const char*)ptr, line); - } - else if (ptr != NULL) // Is caller address present? - { - if (!print_position_from_addr(ptr)) // Fail to get source position? - fprintf(new_output_fp, "%p", ptr); - } - else // No information is present - { - fprintf(new_output_fp, ""); - } -} - -#if _DEBUG_NEW_TAILCHECK -/** - * Checks whether the padding bytes at the end of a memory block is - * tampered with. - * - * @param ptr pointer to a new_ptr_list_t struct - * @return \c true if the padding bytes are untouched; \c false - * otherwise - */ -static bool check_tail(new_ptr_list_t* ptr) -{ - const unsigned char* const tail_ptr = (unsigned char*)ptr + - ALIGNED_LIST_ITEM_SIZE + ptr->size; - for (int i = 0; i < _DEBUG_NEW_TAILCHECK; ++i) - if (tail_ptr[i] != _DEBUG_NEW_TAILCHECK_CHAR) - return false; - return true; -} -#endif - -/** - * Allocates memory and initializes control data. - * - * @param size size of the required memory block - * @param file null-terminated string of the file name - * @param line line number - * @param is_array boolean value whether this is an array operation - * @return pointer to the user-requested memory area; \c NULL - * if memory allocation is not successful - */ -static void* alloc_mem(size_t size, const char* file, int line, bool is_array) -{ - assert(line >= 0); -#if _DEBUG_NEW_TYPE == 1 - STATIC_ASSERT(_DEBUG_NEW_ALIGNMENT >= PLATFORM_MEM_ALIGNMENT, - Alignment_too_small); -#endif - STATIC_ASSERT((_DEBUG_NEW_ALIGNMENT & (_DEBUG_NEW_ALIGNMENT - 1)) == 0, - Alignment_must_be_power_of_two); - STATIC_ASSERT(_DEBUG_NEW_TAILCHECK >= 0, Invalid_tail_check_length); - size_t s = size + ALIGNED_LIST_ITEM_SIZE + _DEBUG_NEW_TAILCHECK; - new_ptr_list_t* ptr = (new_ptr_list_t*)malloc(s); - if (ptr == NULL) - { -#if _DEBUG_NEW_STD_OPER_NEW - return NULL; -#else - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, - "Out of memory when allocating %lu bytes\n", - (unsigned long)size); - fflush(new_output_fp); - _DEBUG_NEW_ERROR_ACTION; -#endif - } - void* usr_ptr = (char*)ptr + ALIGNED_LIST_ITEM_SIZE; -#if _DEBUG_NEW_FILENAME_LEN == 0 - ptr->file = file; -#else - if (line) - strncpy(ptr->file, file, _DEBUG_NEW_FILENAME_LEN - 1) - [_DEBUG_NEW_FILENAME_LEN - 1] = '\0'; - else - ptr->addr = (void*)file; -#endif - ptr->line = line; - ptr->is_array = is_array; - ptr->size = size; - ptr->magic = DEBUG_NEW_MAGIC; - { - fast_mutex_autolock lock(new_ptr_lock); - ptr->prev = new_ptr_list.prev; - ptr->next = &new_ptr_list; - new_ptr_list.prev->next = ptr; - new_ptr_list.prev = ptr; - } -#if _DEBUG_NEW_TAILCHECK - memset((char*)usr_ptr + size, _DEBUG_NEW_TAILCHECK_CHAR, - _DEBUG_NEW_TAILCHECK); -#endif - if (new_verbose_flag) - { - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, - "new%s: allocated %p (size %lu, ", - is_array ? "[]" : "", - usr_ptr, (unsigned long)size); - if (line != 0) - print_position(ptr->file, ptr->line); - else - print_position(ptr->addr, ptr->line); - fprintf(new_output_fp, ")\n"); - } - total_mem_alloc += size; - return usr_ptr; -} - -/** - * Frees memory and adjusts pointers. - * - * @param usr_ptr pointer to the previously allocated memory - * @param addr pointer to the caller - * @param is_array flag indicating whether it is invoked by a - * delete[] call - */ -static void free_pointer(void* usr_ptr, void* addr, bool is_array) -{ - if (usr_ptr == NULL) - return; - new_ptr_list_t* ptr = - (new_ptr_list_t*)((char*)usr_ptr - ALIGNED_LIST_ITEM_SIZE); - if (ptr->magic != DEBUG_NEW_MAGIC) - { - { - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, "delete%s: invalid pointer %p (", - is_array ? "[]" : "", usr_ptr); - print_position(addr, 0); - fprintf(new_output_fp, ")\n"); - } - check_mem_corruption(); - fflush(new_output_fp); - _DEBUG_NEW_ERROR_ACTION; - } - if (is_array != ptr->is_array) - { - const char* msg; - if (is_array) - msg = "delete[] after new"; - else - msg = "delete after new[]"; - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, - "%s: pointer %p (size %lu)\n\tat ", - msg, - (char*)ptr + ALIGNED_LIST_ITEM_SIZE, - (unsigned long)ptr->size); - print_position(addr, 0); - fprintf(new_output_fp, "\n\toriginally allocated at "); - if (ptr->line != 0) - print_position(ptr->file, ptr->line); - else - print_position(ptr->addr, ptr->line); - fprintf(new_output_fp, "\n"); - fflush(new_output_fp); - _DEBUG_NEW_ERROR_ACTION; - } -#if _DEBUG_NEW_TAILCHECK - if (!check_tail(ptr)) - { - check_mem_corruption(); - fflush(new_output_fp); - _DEBUG_NEW_ERROR_ACTION; - } -#endif - { - fast_mutex_autolock lock(new_ptr_lock); - total_mem_alloc -= ptr->size; - ptr->magic = 0; - ptr->prev->next = ptr->next; - ptr->next->prev = ptr->prev; - } - if (new_verbose_flag) - { - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, - "delete%s: freed %p (size %lu, %lu bytes still allocated)\n", - is_array ? "[]" : "", - (char*)ptr + ALIGNED_LIST_ITEM_SIZE, - (unsigned long)ptr->size, (unsigned long)total_mem_alloc); - } - free(ptr); - return; -} - -/** - * Checks for memory leaks. - * - * @return zero if no leakage is found; the number of leaks otherwise - */ -int check_leaks() -{ - int leak_cnt = 0; - fast_mutex_autolock lock_ptr(new_ptr_lock); - fast_mutex_autolock lock_output(new_output_lock); - new_ptr_list_t* ptr = new_ptr_list.next; - while (ptr != &new_ptr_list) - { - const char* const usr_ptr = (char*)ptr + ALIGNED_LIST_ITEM_SIZE; - if (ptr->magic != DEBUG_NEW_MAGIC) - { - fprintf(new_output_fp, - "warning: heap data corrupt near %p\n", - usr_ptr); - } -#if _DEBUG_NEW_TAILCHECK - if (!check_tail(ptr)) - { - fprintf(new_output_fp, - "warning: overwritten past end of object at %p\n", - usr_ptr); - } -#endif - fprintf(new_output_fp, - "Leaked object at %p (size %lu, ", - usr_ptr, - (unsigned long)ptr->size); - if (ptr->line != 0) - print_position(ptr->file, ptr->line); - else - print_position(ptr->addr, ptr->line); - fprintf(new_output_fp, ")\n"); - ptr = ptr->next; - ++leak_cnt; - } - if (new_verbose_flag || leak_cnt) - fprintf(new_output_fp, "*** %d leaks found\n", leak_cnt); - return leak_cnt; -} - -/** - * Checks for heap corruption. - * - * @return zero if no problem is found; the number of found memory - * corruptions otherwise - */ -int check_mem_corruption() -{ - int corrupt_cnt = 0; - fast_mutex_autolock lock_ptr(new_ptr_lock); - fast_mutex_autolock lock_output(new_output_lock); - fprintf(new_output_fp, "*** Checking for memory corruption: START\n"); - for (new_ptr_list_t* ptr = new_ptr_list.next; - ptr != &new_ptr_list; - ptr = ptr->next) - { - const char* const usr_ptr = (char*)ptr + ALIGNED_LIST_ITEM_SIZE; - if (ptr->magic == DEBUG_NEW_MAGIC -#if _DEBUG_NEW_TAILCHECK - && check_tail(ptr) -#endif - ) - continue; -#if _DEBUG_NEW_TAILCHECK - if (ptr->magic != DEBUG_NEW_MAGIC) - { -#endif - fprintf(new_output_fp, - "Heap data corrupt near %p (size %lu, ", - usr_ptr, - (unsigned long)ptr->size); -#if _DEBUG_NEW_TAILCHECK - } - else - { - fprintf(new_output_fp, - "Overwritten past end of object at %p (size %lu, ", - usr_ptr, - (unsigned long)ptr->size); - } -#endif - if (ptr->line != 0) - print_position(ptr->file, ptr->line); - else - print_position(ptr->addr, ptr->line); - fprintf(new_output_fp, ")\n"); - ++corrupt_cnt; - } - fprintf(new_output_fp, "*** Checking for memory corruption: %d FOUND\n", - corrupt_cnt); - return corrupt_cnt; -} - -/** - * Processes the allocated memory and inserts file/line informatin. - * It will only be done when it can ensure the memory is allocated by - * one of our operator new variants. - * - * @param usr_ptr pointer returned by a new-expression - */ -void debug_new_recorder::_M_process(void* usr_ptr) -{ - if (usr_ptr == NULL) - return; - - // In an expression `new NonPODType[size]', the pointer returned is - // not the pointer returned by operator new[], but offset by size_t - // to leave room for the size. It needs to be compensated here. - size_t offset = (char*)usr_ptr - (char*)NULL; - if (offset % PLATFORM_MEM_ALIGNMENT != 0) { - offset -= sizeof(size_t); - if (offset % PLATFORM_MEM_ALIGNMENT != 0) { - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, - "warning: memory unaligned; skipping processing (%s:%d)\n", - _M_file, _M_line); - return; - } - usr_ptr = (char*)usr_ptr - sizeof(size_t); - } - - new_ptr_list_t* ptr = - (new_ptr_list_t*)((char*)usr_ptr - ALIGNED_LIST_ITEM_SIZE); - if (ptr->magic != DEBUG_NEW_MAGIC || ptr->line != 0) - { - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, - "warning: debug_new used with placement new (%s:%d)\n", - _M_file, _M_line); - return; - } - if (new_verbose_flag) { - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, - "info: pointer %p allocated from %s:%d\n", - usr_ptr, _M_file, _M_line); - } -#if _DEBUG_NEW_FILENAME_LEN == 0 - ptr->file = _M_file; -#else - strncpy(ptr->file, _M_file, _DEBUG_NEW_FILENAME_LEN - 1) - [_DEBUG_NEW_FILENAME_LEN - 1] = '\0'; -#endif - ptr->line = _M_line; -} - -/** - * Count of source files that use debug_new. - */ -int debug_new_counter::_S_count = 0; - -/** - * Constructor to increment the count. - */ -debug_new_counter::debug_new_counter() -{ - ++_S_count; -} - -/** - * Destructor to decrement the count. When the count is zero, - * #check_leaks will be called. - */ -debug_new_counter::~debug_new_counter() -{ - if (--_S_count == 0 && new_autocheck_flag) - if (check_leaks()) - { - new_verbose_flag = true; -#if defined(__GNUC__) && __GNUC__ == 3 - if (!getenv("GLIBCPP_FORCE_NEW") && !getenv("GLIBCXX_FORCE_NEW")) - fprintf(new_output_fp, -"*** WARNING: GCC 3 is detected, please make sure the environment\n" -" variable GLIBCPP_FORCE_NEW (GCC 3.2 and 3.3) or GLIBCXX_FORCE_NEW\n" -" (GCC 3.4) is defined. Check the README file for details.\n"); -#endif - } -} - -NVWA_NAMESPACE_END - -#if NVWA_USE_NAMESPACE -using namespace nvwa; -#endif // NVWA_USE_NAMESPACE - -/** - * Allocates memory with file/line information. - * - * @param size size of the required memory block - * @param file null-terminated string of the file name - * @param line line number - * @return pointer to the memory allocated; or \c NULL if memory is - * insufficient (#_DEBUG_NEW_STD_OPER_NEW is 0) - * @throw bad_alloc memory is insufficient (#_DEBUG_NEW_STD_OPER_NEW is 1) - */ -void* operator new(size_t size, const char* file, int line) -{ - void* ptr = alloc_mem(size, file, line, false); -#if _DEBUG_NEW_STD_OPER_NEW - if (ptr) - return ptr; - else - throw std::bad_alloc(); -#else - return ptr; -#endif -} - -/** - * Allocates array memory with file/line information. - * - * @param size size of the required memory block - * @param file null-terminated string of the file name - * @param line line number - * @return pointer to the memory allocated; or \c NULL if memory is - * insufficient (#_DEBUG_NEW_STD_OPER_NEW is 0) - * @throw bad_alloc memory is insufficient (#_DEBUG_NEW_STD_OPER_NEW is 1) - */ -void* operator new[](size_t size, const char* file, int line) -{ - void* ptr = alloc_mem(size, file, line, true); -#if _DEBUG_NEW_STD_OPER_NEW - if (ptr) - return ptr; - else - throw std::bad_alloc(); -#else - return ptr; -#endif -} - -/** - * Allocates memory without file/line information. - * - * @param size size of the required memory block - * @return pointer to the memory allocated; or \c NULL if memory is - * insufficient (#_DEBUG_NEW_STD_OPER_NEW is 0) - * @throw bad_alloc memory is insufficient (#_DEBUG_NEW_STD_OPER_NEW is 1) - */ -void* operator new(size_t size) _GLIBCXX_THROW (std::bad_alloc) // modified to let it compile with c++11, MB 2015-04-17 -{ - return operator new(size, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); -} - -/** - * Allocates array memory without file/line information. - * - * @param size size of the required memory block - * @return pointer to the memory allocated; or \c NULL if memory is - * insufficient (#_DEBUG_NEW_STD_OPER_NEW is 0) - * @throw bad_alloc memory is insufficient (#_DEBUG_NEW_STD_OPER_NEW is 1) - */ -void* operator new[](size_t size) _GLIBCXX_THROW (std::bad_alloc) // modified to let it compile with c++11, MB 2015-04-17 -{ - return operator new[](size, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); -} - -/** - * Allocates memory with no-throw guarantee. - * - * @param size size of the required memory block - * @return pointer to the memory allocated; or \c NULL if memory is - * insufficient - */ -void* operator new(size_t size, const std::nothrow_t&) _NOEXCEPT -{ - return alloc_mem(size, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0, false); -} - -/** - * Allocates array memory with no-throw guarantee. - * - * @param size size of the required memory block - * @return pointer to the memory allocated; or \c NULL if memory is - * insufficient - */ -void* operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT -{ - return alloc_mem(size, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0, true); -} - -/** - * Deallocates memory. - * - * @param ptr pointer to the previously allocated memory - */ -void operator delete(void* ptr) _NOEXCEPT -{ - free_pointer(ptr, _DEBUG_NEW_CALLER_ADDRESS, false); -} - -/** - * Deallocates array memory. - * - * @param ptr pointer to the previously allocated memory - */ -void operator delete[](void* ptr) _NOEXCEPT -{ - free_pointer(ptr, _DEBUG_NEW_CALLER_ADDRESS, true); -} - -/** - * Placement deallocation function. For details, please check Section - * 5.3.4 of the C++ 1998 or 2011 Standard. - * - * @param ptr pointer to the previously allocated memory - * @param file null-terminated string of the file name - * @param line line number - * - * @see http://www.csci.csusb.edu/dick/c++std/cd2/expr.html#expr.new - * @see http://wyw.dcweb.cn/leakage.htm - */ -void operator delete(void* ptr, const char* file, int line) _NOEXCEPT -{ - if (new_verbose_flag) - { - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, - "info: exception thrown on initializing object at %p (", - ptr); - print_position(file, line); - fprintf(new_output_fp, ")\n"); - } - operator delete(ptr); -} - -/** - * Placement deallocation function. For details, please check Section - * 5.3.4 of the C++ 1998 or 2011 Standard. - * - * @param ptr pointer to the previously allocated memory - * @param file null-terminated string of the file name - * @param line line number - */ -void operator delete[](void* ptr, const char* file, int line) _NOEXCEPT -{ - if (new_verbose_flag) - { - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, - "info: exception thrown on initializing objects at %p (", - ptr); - print_position(file, line); - fprintf(new_output_fp, ")\n"); - } - operator delete[](ptr); -} - -/** - * Placement deallocation function. For details, please check Section - * 5.3.4 of the C++ 1998 or 2011 Standard. - * - * @param ptr pointer to the previously allocated memory - */ -void operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT -{ - operator delete(ptr, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); -} - -/** - * Placement deallocation function. For details, please check Section - * 5.3.4 of the C++ 1998 or 2011 Standard. - * - * @param ptr pointer to the previously allocated memory - */ -void operator delete[](void* ptr, const std::nothrow_t&) _NOEXCEPT -{ - operator delete[](ptr, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); -} - -#endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/nvwa/debug_new.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/nvwa/debug_new.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/nvwa/debug_new.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/nvwa/debug_new.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,181 +0,0 @@ -// -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- -// vim:tabstop=4:shiftwidth=4:expandtab: - -/* - * Copyright (C) 2004-2013 Wu Yongwei - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute - * it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must - * not claim that you wrote the original software. If you use this - * software in a product, an acknowledgement in the product - * documentation would be appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must - * not be misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source - * distribution. - * - * This file is part of Stones of Nvwa: - * http://sourceforge.net/projects/nvwa - * - */ - -/** - * @file debug_new.h - * - * Header file for checking leaks caused by unmatched new/delete. - * - * @date 2013-10-06 - */ - -#ifndef NVWA_DEBUG_NEW_H -#define NVWA_DEBUG_NEW_H - -#include // size_t/std::bad_alloc -#include // FILE -#include "_nvwa.h" // NVWA_NAMESPACE_* -#include "c++11.h" // _NOEXCEPT - -/* Special allocation/deallocation functions in the global scope */ -void* operator new(size_t size, const char* file, int line); -void* operator new[](size_t size, const char* file, int line); -void operator delete(void* ptr, const char* file, int line) _NOEXCEPT; -void operator delete[](void* ptr, const char* file, int line) _NOEXCEPT; - -NVWA_NAMESPACE_BEGIN - -/** - * @def _DEBUG_NEW_REDEFINE_NEW - * - * Macro to indicate whether redefinition of \c new is wanted. If one - * wants to define one's own operator new, or to call - * operator new directly, it should be defined to \c 0 to - * alter the default behaviour. Unless, of course, one is willing to - * take the trouble to write something like: - * @code - * # ifdef new - * # define _NEW_REDEFINED - * # undef new - * # endif - * - * // Code that uses new is here - * - * # ifdef _NEW_REDEFINED - * # ifdef DEBUG_NEW - * # define new DEBUG_NEW - * # endif - * # undef _NEW_REDEFINED - * # endif - * @endcode - */ -#ifndef _DEBUG_NEW_REDEFINE_NEW -#define _DEBUG_NEW_REDEFINE_NEW 1 -#endif - -/** - * @def _DEBUG_NEW_TYPE - * - * Macro to indicate which variant of #DEBUG_NEW is wanted. The - * default value \c 1 allows the use of placement new (like - * %new(std::nothrow)), but the verbose output (when - * nvwa#new_verbose_flag is \c true) looks worse than some older - * versions (no file/line information for allocations). Define it - * to \c 2 to revert to the old behaviour that records file and line - * information directly on the call to operator new. - */ -#ifndef _DEBUG_NEW_TYPE -#define _DEBUG_NEW_TYPE 1 -#endif - -/* Prototypes */ -int check_leaks(); -int check_mem_corruption(); - -/* Control variables */ -extern bool new_autocheck_flag; // default to true: call check_leaks() on exit -extern bool new_verbose_flag; // default to false: no verbose information -extern FILE* new_output_fp; // default to stderr: output to console -extern const char* new_progname;// default to NULL; should be assigned argv[0] - -/** - * @def DEBUG_NEW - * - * Macro to catch file/line information on allocation. If - * #_DEBUG_NEW_REDEFINE_NEW is \c 0, one can use this macro directly; - * otherwise \c new will be defined to it, and one must use \c new - * instead. - */ -# if _DEBUG_NEW_TYPE == 1 -# define DEBUG_NEW NVWA::debug_new_recorder(__FILE__, __LINE__) ->* new -# else -# define DEBUG_NEW new(__FILE__, __LINE__) -# endif - -# if _DEBUG_NEW_REDEFINE_NEW -# define new DEBUG_NEW -# endif -# ifdef _DEBUG_NEW_EMULATE_MALLOC -# include -# ifdef new -# define malloc(s) ((void*)(new char[s])) -# else -# define malloc(s) ((void*)(DEBUG_NEW char[s])) -# endif -# define free(p) delete[] (char*)(p) -# endif - -/** - * Recorder class to remember the call context. - * - * The idea comes from Greg Herlihy's post in comp.lang.c++.moderated. - */ -class debug_new_recorder -{ - const char* _M_file; - const int _M_line; - void _M_process(void* ptr); -public: - /** - * Constructor to remember the call context. The information will - * be used in debug_new_recorder::operator->*. - */ - debug_new_recorder(const char* file, int line) - : _M_file(file), _M_line(line) {} - /** - * Operator to write the context information to memory. - * operator->* is chosen because it has the right - * precedence, it is rarely used, and it looks good: so people can - * tell the special usage more quickly. - */ - template _Tp* operator->*(_Tp* ptr) - { _M_process(ptr); return ptr; } -private: - debug_new_recorder(const debug_new_recorder&); - debug_new_recorder& operator=(const debug_new_recorder&); -}; - -/** - * Counter class for on-exit leakage check. - * - * This technique is learnt from The C++ Programming Language by - * Bjarne Stroustup. - */ -class debug_new_counter -{ - static int _S_count; -public: - debug_new_counter(); - ~debug_new_counter(); -}; -/** Counting object for each file including debug_new.h. */ -static debug_new_counter __debug_new_count; - -NVWA_NAMESPACE_END - -#endif // NVWA_DEBUG_NEW_H diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/nvwa/fast_mutex.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/nvwa/fast_mutex.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/nvwa/fast_mutex.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/nvwa/fast_mutex.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,412 +0,0 @@ -// -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- -// vim:tabstop=4:shiftwidth=4:expandtab: - -/* - * Copyright (C) 2004-2013 Wu Yongwei - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute - * it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must - * not claim that you wrote the original software. If you use this - * software in a product, an acknowledgement in the product - * documentation would be appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must - * not be misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source - * distribution. - * - * This file is part of Stones of Nvwa: - * http://sourceforge.net/projects/nvwa - * - */ - -/** - * @file fast_mutex.h - * - * A fast mutex implementation for POSIX and Win32. - * - * @date 2013-08-02 - */ - -#ifndef NVWA_FAST_MUTEX_H -#define NVWA_FAST_MUTEX_H - -#include "_nvwa.h" // NVWA_NAMESPACE_* -#include "c++11.h" // HAVE_CXX11_MUTEX - -# if !defined(_NOTHREADS) -# if !defined(NVWA_USE_CXX11_MUTEX) && HAVE_CXX11_MUTEX != 0 && \ - !defined(_WIN32THREADS) && defined(_WIN32) && defined(_MT) && \ - (!defined(_MSC_VER) || defined(_DLL)) -// Prefer using std::mutex on Windows to avoid the namespace -// pollution caused by . However, MSVC has a re-entry -// issue with its std::mutex implementation, and std::mutex should -// not be used unless /MD or /MDd is used. For more information, -// check out: -// -// https://connect.microsoft.com/VisualStudio/feedback/details/776596/std-mutex-not-a-constexpr-with-mtd-compiler-flag -// http://stackoverflow.com/questions/14319344/stdmutex-lock-hangs-when-overriding-the-new-operator -// -# define NVWA_USE_CXX11_MUTEX 1 -# endif - -# if !defined(_WIN32THREADS) && \ - (defined(_WIN32) && defined(_MT)) -// Automatically use _WIN32THREADS when specifying -MT/-MD in MSVC, -// or -mthreads in MinGW GCC. -# define _WIN32THREADS -# elif !defined(_PTHREADS) && \ - defined(_REENTRANT) -// Automatically use _PTHREADS when specifying -pthread in GCC or Clang. -# define _PTHREADS -# endif -# endif - -# ifndef NVWA_USE_CXX11_MUTEX -# define NVWA_USE_CXX11_MUTEX 0 -# endif - -# if !defined(_PTHREADS) && !defined(_WIN32THREADS) && \ - !defined(_NOTHREADS) && NVWA_USE_CXX11_MUTEX == 0 -# define _NOTHREADS -# endif - -# if defined(_NOTHREADS) -# if defined(_PTHREADS) || defined(_WIN32THREADS) || \ - NVWA_USE_CXX11_MUTEX != 0 -# undef _NOTHREADS -# error "Cannot define multi-threaded mode with -D_NOTHREADS" -# endif -# endif - -# if defined(__MINGW32__) && defined(_WIN32THREADS) && !defined(_MT) -# error "Be sure to specify -mthreads with -D_WIN32THREADS" -# endif - -# ifndef _FAST_MUTEX_CHECK_INITIALIZATION -/** - * Macro to control whether to check for initialization status for each - * lock/unlock operation. Defining it to a non-zero value will enable - * the check, so that the construction/destruction of a static object - * using a static fast_mutex not yet constructed or already destroyed - * will work (with lock/unlock operations ignored). Defining it to zero - * will disable to check. - */ -# define _FAST_MUTEX_CHECK_INITIALIZATION 1 -# endif - -# if defined(_PTHREADS) && defined(_WIN32THREADS) -// Some C++ libraries have _PTHREADS defined even on Win32 platforms. -// Thus this hack. -# undef _PTHREADS -# endif - -# ifdef _DEBUG -# include -# include -/** Macro for fast_mutex assertions. Real version (for debug mode). */ -# define _FAST_MUTEX_ASSERT(_Expr, _Msg) \ - if (!(_Expr)) { \ - fprintf(stderr, "fast_mutex::%s\n", _Msg); \ - abort(); \ - } -# else -/** Macro for fast_mutex assertions. Fake version (for release mode). */ -# define _FAST_MUTEX_ASSERT(_Expr, _Msg) \ - ((void)0) -# endif - -# if NVWA_USE_CXX11_MUTEX != 0 -# include -NVWA_NAMESPACE_BEGIN -/** - * Macro alias to `volatile' semantics. Here it is truly volatile since - * it is in a multi-threaded (C++11) environment. - */ -# define __VOLATILE volatile - /** - * Class for non-reentrant fast mutexes. This is the implementation - * using the C++11 mutex. - */ - class fast_mutex - { - std::mutex _M_mtx_impl; -# if _FAST_MUTEX_CHECK_INITIALIZATION - bool _M_initialized; -# endif -# ifdef _DEBUG - bool _M_locked; -# endif - public: - fast_mutex() -# ifdef _DEBUG - : _M_locked(false) -# endif - { -# if _FAST_MUTEX_CHECK_INITIALIZATION - _M_initialized = true; -# endif - } - ~fast_mutex() - { - _FAST_MUTEX_ASSERT(!_M_locked, "~fast_mutex(): still locked"); -# if _FAST_MUTEX_CHECK_INITIALIZATION - _M_initialized = false; -# endif - } - void lock() - { -# if _FAST_MUTEX_CHECK_INITIALIZATION - if (!_M_initialized) - return; -# endif - _M_mtx_impl.lock(); -# ifdef _DEBUG - _FAST_MUTEX_ASSERT(!_M_locked, "lock(): already locked"); - _M_locked = true; -# endif - } - void unlock() - { -# if _FAST_MUTEX_CHECK_INITIALIZATION - if (!_M_initialized) - return; -# endif -# ifdef _DEBUG - _FAST_MUTEX_ASSERT(_M_locked, "unlock(): not locked"); - _M_locked = false; -# endif - _M_mtx_impl.unlock(); - } - private: - fast_mutex(const fast_mutex&); - fast_mutex& operator=(const fast_mutex&); - }; -NVWA_NAMESPACE_END -# endif // NVWA_USE_CXX11_MUTEX != 0 - -# if defined(_PTHREADS) && NVWA_USE_CXX11_MUTEX == 0 -# include -NVWA_NAMESPACE_BEGIN -/** - * Macro alias to `volatile' semantics. Here it is truly volatile since - * it is in a multi-threaded (POSIX threads) environment. - */ -# define __VOLATILE volatile - /** - * Class for non-reentrant fast mutexes. This is the implementation - * for POSIX threads. - */ - class fast_mutex - { - pthread_mutex_t _M_mtx_impl; -# if _FAST_MUTEX_CHECK_INITIALIZATION - bool _M_initialized; -# endif -# ifdef _DEBUG - bool _M_locked; -# endif - public: - fast_mutex() -# ifdef _DEBUG - : _M_locked(false) -# endif - { - ::pthread_mutex_init(&_M_mtx_impl, NULL); -# if _FAST_MUTEX_CHECK_INITIALIZATION - _M_initialized = true; -# endif - } - ~fast_mutex() - { - _FAST_MUTEX_ASSERT(!_M_locked, "~fast_mutex(): still locked"); -# if _FAST_MUTEX_CHECK_INITIALIZATION - _M_initialized = false; -# endif - ::pthread_mutex_destroy(&_M_mtx_impl); - } - void lock() - { -# if _FAST_MUTEX_CHECK_INITIALIZATION - if (!_M_initialized) - return; -# endif - ::pthread_mutex_lock(&_M_mtx_impl); -# ifdef _DEBUG - // The following assertion should _always_ be true for a - // real `fast' pthread_mutex. However, this assertion can - // help sometimes, when people forget to use `-lpthread' and - // glibc provides an empty implementation. Having this - // assertion is also more consistent. - _FAST_MUTEX_ASSERT(!_M_locked, "lock(): already locked"); - _M_locked = true; -# endif - } - void unlock() - { -# if _FAST_MUTEX_CHECK_INITIALIZATION - if (!_M_initialized) - return; -# endif -# ifdef _DEBUG - _FAST_MUTEX_ASSERT(_M_locked, "unlock(): not locked"); - _M_locked = false; -# endif - ::pthread_mutex_unlock(&_M_mtx_impl); - } - private: - fast_mutex(const fast_mutex&); - fast_mutex& operator=(const fast_mutex&); - }; -NVWA_NAMESPACE_END -# endif // _PTHREADS - -# if defined(_WIN32THREADS) && NVWA_USE_CXX11_MUTEX == 0 -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif /* WIN32_LEAN_AND_MEAN */ -# include -NVWA_NAMESPACE_BEGIN -/** - * Macro alias to `volatile' semantics. Here it is truly volatile since - * it is in a multi-threaded (Win32 threads) environment. - */ -# define __VOLATILE volatile - /** - * Class for non-reentrant fast mutexes. This is the implementation - * for Win32 threads. - */ - class fast_mutex - { - CRITICAL_SECTION _M_mtx_impl; -# if _FAST_MUTEX_CHECK_INITIALIZATION - bool _M_initialized; -# endif -# ifdef _DEBUG - bool _M_locked; -# endif - public: - fast_mutex() -# ifdef _DEBUG - : _M_locked(false) -# endif - { - ::InitializeCriticalSection(&_M_mtx_impl); -# if _FAST_MUTEX_CHECK_INITIALIZATION - _M_initialized = true; -# endif - } - ~fast_mutex() - { - _FAST_MUTEX_ASSERT(!_M_locked, "~fast_mutex(): still locked"); -# if _FAST_MUTEX_CHECK_INITIALIZATION - _M_initialized = false; -# endif - ::DeleteCriticalSection(&_M_mtx_impl); - } - void lock() - { -# if _FAST_MUTEX_CHECK_INITIALIZATION - if (!_M_initialized) - return; -# endif - ::EnterCriticalSection(&_M_mtx_impl); -# ifdef _DEBUG - _FAST_MUTEX_ASSERT(!_M_locked, "lock(): already locked"); - _M_locked = true; -# endif - } - void unlock() - { -# if _FAST_MUTEX_CHECK_INITIALIZATION - if (!_M_initialized) - return; -# endif -# ifdef _DEBUG - _FAST_MUTEX_ASSERT(_M_locked, "unlock(): not locked"); - _M_locked = false; -# endif - ::LeaveCriticalSection(&_M_mtx_impl); - } - private: - fast_mutex(const fast_mutex&); - fast_mutex& operator=(const fast_mutex&); - }; -NVWA_NAMESPACE_END -# endif // _WIN32THREADS - -# ifdef _NOTHREADS -NVWA_NAMESPACE_BEGIN -/** - * Macro alias to `volatile' semantics. Here it is not truly volatile - * since it is in a single-threaded environment. - */ -# define __VOLATILE - /** - * Class for non-reentrant fast mutexes. This is the null - * implementation for single-threaded environments. - */ - class fast_mutex - { -# ifdef _DEBUG - bool _M_locked; -# endif - public: - fast_mutex() -# ifdef _DEBUG - : _M_locked(false) -# endif - { - } - ~fast_mutex() - { - _FAST_MUTEX_ASSERT(!_M_locked, "~fast_mutex(): still locked"); - } - void lock() - { -# ifdef _DEBUG - _FAST_MUTEX_ASSERT(!_M_locked, "lock(): already locked"); - _M_locked = true; -# endif - } - void unlock() - { -# ifdef _DEBUG - _FAST_MUTEX_ASSERT(_M_locked, "unlock(): not locked"); - _M_locked = false; -# endif - } - private: - fast_mutex(const fast_mutex&); - fast_mutex& operator=(const fast_mutex&); - }; -NVWA_NAMESPACE_END -# endif // _NOTHREADS - -NVWA_NAMESPACE_BEGIN -/** An acquistion-on-initialization lock class based on fast_mutex. */ -class fast_mutex_autolock -{ - fast_mutex& _M_mtx; -public: - explicit fast_mutex_autolock(fast_mutex& mtx) : _M_mtx(mtx) - { - _M_mtx.lock(); - } - ~fast_mutex_autolock() - { - _M_mtx.unlock(); - } -private: - fast_mutex_autolock(const fast_mutex_autolock&); - fast_mutex_autolock& operator=(const fast_mutex_autolock&); -}; -NVWA_NAMESPACE_END - -#endif // NVWA_FAST_MUTEX_H diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/nvwa/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/nvwa/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/nvwa/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/nvwa/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -noinst_LIBRARIES = libnvwa.a - -libnvwa_a_SOURCES = debug_new.cpp debug_new.h fast_mutex.h static_assert.h diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/nvwa/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/nvwa/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/nvwa/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/nvwa/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,615 +0,0 @@ -# Makefile.in generated by automake 1.13.4 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = src/foreign/nvwa -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/src/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LIBRARIES = $(noinst_LIBRARIES) -ARFLAGS = cru -AM_V_AR = $(am__v_AR_@AM_V@) -am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) -am__v_AR_0 = @echo " AR " $@; -am__v_AR_1 = -libnvwa_a_AR = $(AR) $(ARFLAGS) -libnvwa_a_LIBADD = -am_libnvwa_a_OBJECTS = debug_new.$(OBJEXT) -libnvwa_a_OBJECTS = $(am_libnvwa_a_OBJECTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) -AM_V_CXX = $(am__v_CXX_@AM_V@) -am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) -am__v_CXX_0 = @echo " CXX " $@; -am__v_CXX_1 = -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) -am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) -am__v_CXXLD_0 = @echo " CXXLD " $@; -am__v_CXXLD_1 = -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(libnvwa_a_SOURCES) -DIST_SOURCES = $(libnvwa_a_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -AMTAR = @AMTAR@ -AM_CPPFLAGS = @AM_CPPFLAGS@ -AM_CXXFLAGS = @AM_CXXFLAGS@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FFMPEG_LIBS = @FFMPEG_LIBS@ -FGREP = @FGREP@ -FOX_CONFIG = @FOX_CONFIG@ -FOX_LDFLAGS = @FOX_LDFLAGS@ -GDAL_CONFIG = @GDAL_CONFIG@ -GDAL_LDFLAGS = @GDAL_LDFLAGS@ -GREP = @GREP@ -GTEST_CONFIG = @GTEST_CONFIG@ -GTEST_LDFLAGS = @GTEST_LDFLAGS@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIB_XERCES = @LIB_XERCES@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OSG_LIBS = @OSG_LIBS@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PROJ_LDFLAGS = @PROJ_LDFLAGS@ -PYTHON_LIBS = @PYTHON_LIBS@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XERCES_CFLAGS = @XERCES_CFLAGS@ -XERCES_LDFLAGS = @XERCES_LDFLAGS@ -XERCES_LIBS = @XERCES_LIBS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -noinst_LIBRARIES = libnvwa.a -libnvwa_a_SOURCES = debug_new.cpp debug_new.h fast_mutex.h static_assert.h -all: all-am - -.SUFFIXES: -.SUFFIXES: .cpp .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/foreign/nvwa/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/foreign/nvwa/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) - -libnvwa.a: $(libnvwa_a_OBJECTS) $(libnvwa_a_DEPENDENCIES) $(EXTRA_libnvwa_a_DEPENDENCIES) - $(AM_V_at)-rm -f libnvwa.a - $(AM_V_AR)$(libnvwa_a_AR) libnvwa.a $(libnvwa_a_OBJECTS) $(libnvwa_a_LIBADD) - $(AM_V_at)$(RANLIB) libnvwa.a - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug_new.Po@am__quote@ - -.cpp.o: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< - -.cpp.obj: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cpp.lo: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLIBRARIES cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/nvwa/static_assert.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/nvwa/static_assert.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/nvwa/static_assert.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/nvwa/static_assert.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -// -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- -// vim:tabstop=4:shiftwidth=4:expandtab: - -/* - * Copyright (C) 2004-2013 Wu Yongwei - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute - * it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must - * not claim that you wrote the original software. If you use this - * software in a product, an acknowledgement in the product - * documentation would be appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must - * not be misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source - * distribution. - * - * This file is part of Stones of Nvwa: - * http://sourceforge.net/projects/nvwa - * - */ - -/** - * @file static_assert.h - * - * Template class to check validity duing compile time (adapted from Loki). - * - * @date 2013-09-07 - */ - -#ifndef STATIC_ASSERT - -#include "c++11.h" - -#if HAVE_CXX11_STATIC_ASSERT - -#define STATIC_ASSERT(_Expr, _Msg) static_assert(_Expr, #_Msg) - -#else - -namespace nvwa { - -template struct compile_time_error; -template <> struct compile_time_error {}; - -#define STATIC_ASSERT(_Expr, _Msg) \ - { \ - nvwa::compile_time_error<((_Expr) != 0)> ERROR_##_Msg; \ - (void)ERROR_##_Msg; \ - } - -} - -#endif // HAVE_CXX11_STATIC_ASSERT - -#endif // STATIC_ASSERT diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/polyfonts/pfPSansBold16.c sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/polyfonts/pfPSansBold16.c --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/polyfonts/pfPSansBold16.c 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/polyfonts/pfPSansBold16.c 2017-07-23 16:22:03.000000000 +0000 @@ -39,7 +39,7 @@ /* ========================================================================= * compiler pragmas * ======================================================================= */ -#pragma warning(disable: 4305) // disable reporting SUMOReal 2 SUMOReal shortings +#pragma warning(disable: 4305) // disable reporting double 2 double shortings diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/polyfonts/polyfonts.c sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/polyfonts/polyfonts.c --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/polyfonts/polyfonts.c 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/polyfonts/polyfonts.c 2017-07-23 16:22:03.000000000 +0000 @@ -99,18 +99,18 @@ /*-----------------------------------------------*/ -static SUMOReal pfScaleX = 20.0; -static SUMOReal pfScaleY = 20.0; +static double pfScaleX = 20.0; +static double pfScaleY = 20.0; -static SUMOReal pfTextX = 0.0; -static SUMOReal pfTextY = 0.0; +static double pfTextX = 0.0; +static double pfTextY = 0.0; -static SUMOReal pfTextSkew = 0.0; +static double pfTextSkew = 0.0; static int pfTextWeight = 1; typedef struct { - SUMOReal x, y; + double x, y; } vertex; vertex weightOffset[] = { @@ -128,21 +128,21 @@ #define numWeights (sizeof(weightOffset) / sizeof(vertex)) -static SUMOReal pfTextSin = 0.0; -static SUMOReal pfTextCos = 1.0; +static double pfTextSin = 0.0; +static double pfTextCos = 1.0; static int pfCenter = 0; -#define unfix(value) ((SUMOReal)(value)) / ((SUMOReal)pfFixScale) +#define unfix(value) ((double)(value)) / ((double)pfFixScale) /*-----------------------------------------------*/ static pfglyph *pfGetGlyph(wchar_t c); -static SUMOReal getCharAdvance(wchar_t c); +static double getCharAdvance(wchar_t c); /*-----------------------------------------------*/ -static SUMOReal pfSkew(SUMOReal x, SUMOReal y) +static double pfSkew(double x, double y) { return x + (pfTextSkew * y); } @@ -307,7 +307,7 @@ FILE *f = NULL; char buf[1024]; - SUMOReal version = 0; + double version = 0; int glyphcount = 0; char *fontname = NULL; pffont *fontinfo = NULL; @@ -462,14 +462,14 @@ /*-----------------------------------------------*/ -void pfSetScale(SUMOReal s) +void pfSetScale(double s) { pfScaleX = pfScaleY = s; } /*-----------------------------------------------*/ -void pfSetScaleXY(SUMOReal sx, SUMOReal sy) +void pfSetScaleXY(double sx, double sy) { pfScaleX = sx; pfScaleY = sy; @@ -477,7 +477,7 @@ /*-----------------------------------------------*/ -void pfSetPosition(SUMOReal x, SUMOReal y) +void pfSetPosition(double x, double y) { pfTextX = x; pfTextY = y; @@ -485,7 +485,7 @@ /*-----------------------------------------------*/ -void pfGetPosition(SUMOReal *x, SUMOReal *y) +void pfGetPosition(double *x, double *y) { *x = pfTextX; *y = pfTextY; @@ -493,7 +493,7 @@ /*-----------------------------------------------*/ -void pfSetSkew(SUMOReal s) +void pfSetSkew(double s) { pfTextSkew = min(1.0, max(-1.0, s)); } @@ -507,7 +507,7 @@ /*-----------------------------------------------*/ -void pfSetAngleR(SUMOReal a) +void pfSetAngleR(double a) { pfTextSin = sin(a); pfTextCos = cos(a); @@ -515,7 +515,7 @@ /*-----------------------------------------------*/ -void pfSetAngleD(SUMOReal a) +void pfSetAngleD(double a) { pfSetAngleR(a * DtoR); } @@ -529,7 +529,7 @@ /*-----------------------------------------------*/ -static int getCharBBox(wchar_t c, SUMOReal *minx, SUMOReal *miny, SUMOReal *maxx, SUMOReal *maxy) +static int getCharBBox(wchar_t c, double *minx, double *miny, double *maxx, double *maxy) { if (NULL != pfCurrentFont) { @@ -555,9 +555,9 @@ /*-----------------------------------------------*/ -static int getStringBox(char *c, SUMOReal *minx, SUMOReal *miny, SUMOReal *maxx, SUMOReal *maxy) +static int getStringBox(char *c, double *minx, double *miny, double *maxx, double *maxy) { - SUMOReal x1, y1, x2, y2; + double x1, y1, x2, y2; if (NULL == c) { @@ -595,9 +595,9 @@ /*-----------------------------------------------*/ -static int getStringBoxW(wchar_t *c, SUMOReal *minx, SUMOReal *miny, SUMOReal *maxx, SUMOReal *maxy) +static int getStringBoxW(wchar_t *c, double *minx, double *miny, double *maxx, double *maxy) { - SUMOReal x1, y1, x2, y2; + double x1, y1, x2, y2; if (NULL == c) { @@ -635,9 +635,9 @@ /*-----------------------------------------------*/ -int pfSetScaleBox(char *c, SUMOReal w, SUMOReal h) +int pfSetScaleBox(char *c, double w, double h) { - SUMOReal x1, y1, x2, y2; + double x1, y1, x2, y2; if (NULL == c) { @@ -655,9 +655,9 @@ /*-----------------------------------------------*/ -int pfSetScaleBoxW(wchar_t *c, SUMOReal w, SUMOReal h) +int pfSetScaleBoxW(wchar_t *c, double w, double h) { - SUMOReal x1, y1, x2, y2; + double x1, y1, x2, y2; if (NULL == c) { @@ -696,7 +696,7 @@ /*-----------------------------------------------*/ -int pfGetFontBBox(SUMOReal *minx, SUMOReal *miny, SUMOReal *maxx, SUMOReal *maxy) +int pfGetFontBBox(double *minx, double *miny, double *maxx, double *maxy) { if (NULL != pfCurrentFont) { @@ -730,9 +730,9 @@ /*-----------------------------------------------*/ -SUMOReal pfGetFontHeight() +double pfGetFontHeight() { - SUMOReal minx, miny, maxx, maxy; + double minx, miny, maxx, maxy; if (-1 != pfGetFontBBox(&minx, &miny, &maxx, &maxy)) { @@ -744,9 +744,9 @@ /*-----------------------------------------------*/ -SUMOReal pfGetFontWidth() +double pfGetFontWidth() { - SUMOReal minx, miny, maxx, maxy; + double minx, miny, maxx, maxy; if (-1 != pfGetFontBBox(&minx, &miny, &maxx, &maxy)) { @@ -758,9 +758,9 @@ /*-----------------------------------------------*/ -SUMOReal pfGetFontAscent() +double pfGetFontAscent() { - SUMOReal minx, miny, maxx, maxy; + double minx, miny, maxx, maxy; if (-1 != pfGetFontBBox(&minx, &miny, &maxx, &maxy)) { @@ -772,9 +772,9 @@ /*-----------------------------------------------*/ -SUMOReal pfGetFontDescent() +double pfGetFontDescent() { - SUMOReal minx, miny, maxx, maxy; + double minx, miny, maxx, maxy; if (-1 != pfGetFontBBox(&minx, &miny, &maxx, &maxy)) { @@ -852,7 +852,7 @@ /*-----------------------------------------------*/ -static SUMOReal getCharAdvance(wchar_t c) +static double getCharAdvance(wchar_t c) { pfglyph *g = pfGetGlyph(c); @@ -866,7 +866,7 @@ /*-----------------------------------------------*/ -SUMOReal pfGetCharAdvance(wchar_t c) +double pfGetCharAdvance(wchar_t c) { pfglyph *g = pfGetGlyph(c); @@ -880,7 +880,7 @@ /*-----------------------------------------------*/ -int pfGetCharBBox(wchar_t c, SUMOReal *minx, SUMOReal *miny, SUMOReal *maxx, SUMOReal *maxy) +int pfGetCharBBox(wchar_t c, double *minx, double *miny, double *maxx, double *maxy) { if (0 == getCharBBox(c, minx, miny, maxx, maxy)) { @@ -915,9 +915,9 @@ /*-----------------------------------------------*/ -SUMOReal pfGetCharHeight(wchar_t c) +double pfGetCharHeight(wchar_t c) { - SUMOReal minx, miny, maxx, maxy; + double minx, miny, maxx, maxy; if (-1 != pfGetCharBBox(c, &minx, &miny, &maxx, &maxy)) { @@ -929,9 +929,9 @@ /*-----------------------------------------------*/ -SUMOReal pfGetCharWidth(wchar_t c) +double pfGetCharWidth(wchar_t c) { - SUMOReal minx, miny, maxx, maxy; + double minx, miny, maxx, maxy; if (-1 != pfGetCharBBox(c, &minx, &miny, &maxx, &maxy)) { @@ -943,9 +943,9 @@ /*-----------------------------------------------*/ -SUMOReal pfGetCharAscent(wchar_t c) +double pfGetCharAscent(wchar_t c) { - SUMOReal minx, miny, maxx, maxy; + double minx, miny, maxx, maxy; if (-1 != pfGetCharBBox(c, &minx, &miny, &maxx, &maxy)) { @@ -957,9 +957,9 @@ /*-----------------------------------------------*/ -SUMOReal pfGetCharDescent(wchar_t c) +double pfGetCharDescent(wchar_t c) { - SUMOReal minx, miny, maxx, maxy; + double minx, miny, maxx, maxy; if (-1 != pfGetCharBBox(c, &minx, &miny, &maxx, &maxy)) { @@ -981,9 +981,9 @@ int segs = 0; int prim = 0; int points = 0; - SUMOReal gx, gy; - SUMOReal ox, oy; - SUMOReal tmp = -100.0; + double gx, gy; + double ox, oy; + double tmp = -100.0; if (NULL == g) { @@ -1109,10 +1109,10 @@ /*-----------------------------------------------*/ -SUMOReal +double pfdkGetStringWidth(const char *c) { - SUMOReal w = 0; + double w = 0; while (0 != *c) { w += pfGetCharAdvance(/*s,*/ *c); c++; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/polyfonts/polyfonts.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/polyfonts/polyfonts.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/polyfonts/polyfonts.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/polyfonts/polyfonts.h 2017-07-23 16:22:03.000000000 +0000 @@ -52,37 +52,37 @@ void pfUnloadFont(pffont *f); char *pfGetFontName(); pffont *pfGetCurrentFont(); - int pfGetFontBBox(SUMOReal *minx, SUMOReal *miny, SUMOReal *maxx, SUMOReal *maxy); - SUMOReal pfGetFontHeight(); - SUMOReal pfGetFontWidth(); - SUMOReal pfGetFontAscent(); - SUMOReal pfGetFontDescent(); + int pfGetFontBBox(double *minx, double *miny, double *maxx, double *maxy); + double pfGetFontHeight(); + double pfGetFontWidth(); + double pfGetFontAscent(); + double pfGetFontDescent(); int pfGetFontNumGlyphs(); wchar_t pfGetChar(int glyph); - void pfSetScale(SUMOReal s); - void pfSetScaleXY(SUMOReal sx, SUMOReal sy); - int pfSetScaleBox(char *c, SUMOReal w, SUMOReal h); - int pfSetScaleBoxW(wchar_t *c, SUMOReal w, SUMOReal h); + void pfSetScale(double s); + void pfSetScaleXY(double sx, double sy); + int pfSetScaleBox(char *c, double w, double h); + int pfSetScaleBoxW(wchar_t *c, double w, double h); - void pfSetPosition(SUMOReal x, SUMOReal y); - void pfGetPosition(SUMOReal *x, SUMOReal *y); + void pfSetPosition(double x, double y); + void pfGetPosition(double *x, double *y); - void pfSetSkew(SUMOReal s); + void pfSetSkew(double s); void pfSetWeight(int w); - void pfSetAngleR(SUMOReal a); - void pfSetAngleD(SUMOReal a); + void pfSetAngleR(double a); + void pfSetAngleD(double a); void pfSetCenter(int onOff); - int pfGetCharBBox(wchar_t c, SUMOReal *minx, SUMOReal *miny, SUMOReal *maxx, SUMOReal *maxy); - SUMOReal pfGetCharAdvance(wchar_t c); - SUMOReal pfGetCharHeight(wchar_t c); - SUMOReal pfGetCharWidth(wchar_t c); - SUMOReal pfGetCharAscent(wchar_t c); - SUMOReal pfGetCharDescent(wchar_t c); + int pfGetCharBBox(wchar_t c, double *minx, double *miny, double *maxx, double *maxy); + double pfGetCharAdvance(wchar_t c); + double pfGetCharHeight(wchar_t c); + double pfGetCharWidth(wchar_t c); + double pfGetCharAscent(wchar_t c); + double pfGetCharDescent(wchar_t c); - SUMOReal pfdkGetStringWidth(const char *c); + double pfdkGetStringWidth(const char *c); int pfDrawChar(/*SDL_Surface *s,*/ wchar_t c); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/polyfonts/polyfonttypes.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/polyfonts/polyfonttypes.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/polyfonts/polyfonttypes.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/polyfonts/polyfonttypes.h 2017-07-23 16:22:03.000000000 +0000 @@ -49,11 +49,11 @@ typedef struct { - SUMOReal minx; - SUMOReal miny; - SUMOReal maxx; - SUMOReal maxy; - SUMOReal advance; + double minx; + double miny; + double maxx; + double maxy; + double advance; pfuint16 glyph; pfuint16 numsegments; pfint16 *segments; @@ -64,10 +64,10 @@ { char *name; int loaded; - SUMOReal minx; - SUMOReal miny; - SUMOReal maxx; - SUMOReal maxy; + double minx; + double miny; + double maxx; + double maxy; int numglyphs; pfglyph *glyphs; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/rtree/LayeredRTree.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/rtree/LayeredRTree.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/rtree/LayeredRTree.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/rtree/LayeredRTree.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,7 +2,7 @@ /// @file LayeredRTree.h /// @author Jakob Erdmann /// @date 16.10.2012 -/// @version $Id: LayeredRTree.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: LayeredRTree.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A wrapper around RT-trees for for efficient storing of SUMO's GL-objects and // accessing them ordered by their layer @@ -13,7 +13,7 @@ // 1 for alpha blending to work /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/rtree/SUMORTree.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/rtree/SUMORTree.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/foreign/rtree/SUMORTree.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/foreign/rtree/SUMORTree.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file SUMORTree.h /// @author Daniel Krajzewicz /// @date 27.10.2008 -/// @version $Id: SUMORTree.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SUMORTree.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A RT-tree for efficient storing of SUMO's GL-objects /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/dialogs/GUIDialog_AboutSUMO.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/dialogs/GUIDialog_AboutSUMO.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/dialogs/GUIDialog_AboutSUMO.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/dialogs/GUIDialog_AboutSUMO.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 08.03.2004 -/// @version $Id: GUIDialog_AboutSUMO.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIDialog_AboutSUMO.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The application's "About" - dialog /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,107 +37,56 @@ #include #include #include - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - +#include // =========================================================================== -// bitmap definitions +// method definitions // =========================================================================== -static const char* dlr_icon[] = { - "40 42 3 1", - "# c #000000", - "a c #333333", - ". c #ffffff", - "........................................", - "........................................", - "...........................#............", - "..........................##............", - ".........................###............", - "........................####............", - ".......................#####............", - "......................###.##............", - ".....................###..##............", - "....................###...##............", - "...................###....##............", - "..................###.....##............", - ".........##############################.", - "........##############################..", - ".......###.....###.......###......###...", - "......###.....###.......###......###....", - ".....###.....###.......###......###.....", - "....###.....###.......###......###......", - "...###.....###.......###......###.......", - "..##############################........", - ".##############################.........", - "...........##.....###...................", - "...........##....###....................", - "...........##...###.....................", - "...........##..###......................", - "...........##.###.......................", - "...........#####........................", - "...........####.........................", - "...........###..........................", - "...........##...........................", - "...........#...#####....##.....#####....", - "...............######...##.....######...", - "...............##..###..##.....##..##...", - "...............##...##..##.....##..##...", - "...............##...##..##.....#####....", - "...............##...##..##.....#####....", - "...............##..###..##.....##.###...", - "...............######...#####..##..##...", - "...............#####....#####..##..###..", - "........................................", - "........................................", - "........................................" -}; +GUIDialog_AboutSUMO::GUIDialog_AboutSUMO(FXWindow* parent) : + FXDialogBox(parent, "About SUMO", GUIDesignDialogBox) { + // set dialog icon + setIcon(GUIIconSubSys::getIcon(ICON_SUMO)); + // create frame for main info + FXHorizontalFrame* mainInfoFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame); + + // DLR Icon + new FXLabel(mainInfoFrame, "", GUIIconSubSys::getIcon(ICON_DLR), GUIDesignLabelIcon64x64noSpacing); -// =========================================================================== -// method definitions -// =========================================================================== -GUIDialog_AboutSUMO::GUIDialog_AboutSUMO(FXWindow* parent, const char* name, int x, int y) - : FXDialogBox(parent, name, DECOR_CLOSE | DECOR_TITLE, x, y, 0, 0) { - FXVerticalFrame* f1 = new FXVerticalFrame(this, LAYOUT_TOP | FRAME_NONE | LAYOUT_FILL_X, 0, 0, 0, 0, 0, 0, 1, 1); - // build icons - FXHorizontalFrame* f2 = new FXHorizontalFrame(f1, LAYOUT_TOP | LAYOUT_CENTER_X | FRAME_NONE, 0, 0, 0, 0, 0, 0, 1, 1); - myDLRIcon = new FXXPMIcon(getApp(), dlr_icon); - new FXButton(f2, "\tDLR\t.", myDLRIcon, 0, 0, LAYOUT_CENTER_Y | TEXT_OVER_ICON, 5, 0, 40 + 5, 0, 0, 0, 0, 0); // "SUMO " - FXVerticalFrame* f4 = new FXVerticalFrame(f2, FRAME_NONE, 0, 0, 0, 0, 20, 0, 0, 0); + FXVerticalFrame* descriptionFrame = new FXVerticalFrame(mainInfoFrame, GUIDesignLabelAboutInfo); myHeadlineFont = new FXFont(getApp(), "Arial", 18, FXFont::Bold); - FXLabel* l = new FXLabel(f4, "SUMO " VERSION_STRING, 0, LAYOUT_CENTER_Y | LAYOUT_CENTER_X | JUSTIFY_CENTER_X | LABEL_NORMAL, 0, 0, 0, 0, 0, 0, 0, 0); - l->setFont(myHeadlineFont); - new FXLabel(f4, "Simulation of Urban MObility", 0, LAYOUT_CENTER_Y | LAYOUT_CENTER_X | JUSTIFY_CENTER_X | LABEL_NORMAL, 0, 0, 0, 0, 0, 0, 0, 0); - new FXLabel(f4, HAVE_ENABLED, 0, LAYOUT_CENTER_Y | LAYOUT_CENTER_X | JUSTIFY_CENTER_X | LABEL_NORMAL, 0, 0, 0, 0, 0, 0, 0, 0); - // - // additional infos - FXVerticalFrame* f3 = new FXVerticalFrame(f1, FRAME_NONE, 0, 0, 0, 0, 0, 0, 0, 0); + FXLabel* neteditLabel = new FXLabel(descriptionFrame, "SUMO " VERSION_STRING, 0, GUIDesignLabelAboutInfo); + neteditLabel->setFont(myHeadlineFont); + new FXLabel(descriptionFrame, "Simulation of Urban MObility", 0, GUIDesignLabelAboutInfo); + new FXLabel(descriptionFrame, HAVE_ENABLED, 0, GUIDesignLabelAboutInfo); + + // Netedit icon + new FXLabel(mainInfoFrame, "", GUIIconSubSys::getIcon(ICON_SUMO), GUIDesignLabelIcon64x64noSpacing); + // copyright notice - new FXLabel(f3, "A microscopic, multi-modal, open source", 0, LABEL_NORMAL, 0, 0, 0, 0, 0, 0, 0, 0); - new FXLabel(f3, "road traffic simulation.", 0, LABEL_NORMAL, 0, 0, 0, 0, 0, 0, 0, 0); - new FXLabel(f3, "Copyright (C) 2001-2016 DLR / Institute of Transportation Systems", 0, LAYOUT_CENTER_X | JUSTIFY_CENTER_X | LABEL_NORMAL, 0, 0, 0, 0, 0, 0, 0, 0); + new FXLabel(this, "A microscopic, multi-modal, open source road traffic simulation.", 0, GUIDesignLabelAboutInfo); + new FXLabel(this, "Copyright (C) 2001-2017 DLR / Institute of Transportation Systems", 0, GUIDesignLabelAboutInfo); - FXLinkLabel* link = new FXLinkLabel(f3, "http://sumo.dlr.de", 0, LAYOUT_CENTER_X | JUSTIFY_CENTER_X | LABEL_NORMAL, 0, 0, 0, 0, 5, 5, 5, 5); + // link to homepage + FXLinkLabel* link = new FXLinkLabel(this, "http://sumo.dlr.de", 0, GUIDesignLabelCenter); link->setTipText("http://sumo.dlr.de"); - // ok-button - new FXButton(f1, "OK\t\t", 0, this, ID_ACCEPT, LAYOUT_FIX_WIDTH | LAYOUT_CENTER_X | JUSTIFY_CENTER_X | FRAME_THICK | FRAME_RAISED, 0, 0, 50, 30); - setIcon(GUIIconSubSys::getIcon(ICON_APP)); + + // centered ok-button + FXHorizontalFrame* buttonFrame = new FXHorizontalFrame(this, GUIDesignHorizontalFrame); + new FXHorizontalFrame(buttonFrame, GUIDesignAuxiliarHorizontalFrame); + new FXButton(buttonFrame, "OK\t\t", GUIIconSubSys::getIcon(ICON_ACCEPT), this, ID_ACCEPT, GUIDesignButtonOK); + new FXHorizontalFrame(buttonFrame, GUIDesignAuxiliarHorizontalFrame); } void GUIDialog_AboutSUMO::create() { FXDialogBox::create(); - myDLRIcon->create(); } GUIDialog_AboutSUMO::~GUIDialog_AboutSUMO() { - delete myDLRIcon; delete myHeadlineFont; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/dialogs/GUIDialog_AboutSUMO.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/dialogs/GUIDialog_AboutSUMO.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/dialogs/GUIDialog_AboutSUMO.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/dialogs/GUIDialog_AboutSUMO.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Fri, 29.04.2005 -/// @version $Id: GUIDialog_AboutSUMO.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIDialog_AboutSUMO.h 22743 2017-01-29 11:07:55Z palcraft $ /// // The application's "About" - dialog /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,31 +44,19 @@ class GUIDialog_AboutSUMO : public FXDialogBox { public: /** @brief Constructor - * * @param[in] parent The parent window - * @param[in] name The title to show - * @param[in] x x-position of the window to use - * @param[in] y y-position of the window to use */ - GUIDialog_AboutSUMO(FXWindow* parent, const char* name, int x, int y); - + GUIDialog_AboutSUMO(FXWindow* parent); /// @brief Destructor ~GUIDialog_AboutSUMO(); - - /** @brief Creates the widget (and the icons) - */ + /// @brief Creates the widget void create(); - private: - /// @brief Icons for the widget - FXIcon* myDLRIcon; - /// @brief Font for the widget FXFont* myHeadlineFont; - }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/dialogs/GUIDialog_AppSettings.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/dialogs/GUIDialog_AppSettings.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/dialogs/GUIDialog_AppSettings.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/dialogs/GUIDialog_AppSettings.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 08.03.2004 -/// @version $Id: GUIDialog_AppSettings.cpp 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: GUIDialog_AppSettings.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The application-settings dialog /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,10 +36,6 @@ #include #include "GUIDialog_AppSettings.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/dialogs/GUIDialog_AppSettings.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/dialogs/GUIDialog_AppSettings.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/dialogs/GUIDialog_AppSettings.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/dialogs/GUIDialog_AppSettings.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 08.03.2004 -/// @version $Id: GUIDialog_AppSettings.h 20988 2016-06-16 13:32:24Z behrisch $ +/// @version $Id: GUIDialog_AppSettings.h 22608 2017-01-17 06:28:54Z behrisch $ /// // The application-settings dialog /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/dialogs/GUIDialog_Breakpoints.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/dialogs/GUIDialog_Breakpoints.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/dialogs/GUIDialog_Breakpoints.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/dialogs/GUIDialog_Breakpoints.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Thu, 17 Jun 2004 -/// @version $Id: GUIDialog_Breakpoints.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUIDialog_Breakpoints.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Editor for simulation breakpoints /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,14 +48,11 @@ #include #include #include +#include #include #include #include "GUIDialog_Breakpoints.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping @@ -75,13 +72,13 @@ // =========================================================================== // method definitions // =========================================================================== -GUIDialog_Breakpoints::GUIDialog_Breakpoints(GUIMainWindow* parent, std::vector& breakpoints, FXMutex& breakpointLock) - : FXMainWindow(parent->getApp(), "Breakpoints Editor", NULL, NULL, DECOR_ALL, 20, 20, 170, 300), - myParent(parent), myBreakpoints(&breakpoints), myBreakpointLock(&breakpointLock) { - FXHorizontalFrame* hbox = new FXHorizontalFrame(this, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0); +GUIDialog_Breakpoints::GUIDialog_Breakpoints(GUIMainWindow* parent, std::vector& breakpoints, FXMutex& breakpointLock) : + FXMainWindow(parent->getApp(), "Breakpoints Editor", NULL, NULL, DECOR_ALL, 20, 20, 170, 300), + myParent(parent), myBreakpoints(&breakpoints), myBreakpointLock(&breakpointLock) { + FXHorizontalFrame* hbox = new FXHorizontalFrame(this, GUIDesignAuxiliarFrame); // build the table - myTable = new FXTable(hbox, this, MID_TABLE, LAYOUT_FILL_X | LAYOUT_FILL_Y); + myTable = new FXTable(hbox, this, MID_TABLE, GUIDesignTable); myTable->setVisibleRows(20); myTable->setVisibleColumns(1); myTable->setTableSize(20, 1); @@ -95,15 +92,15 @@ // create buttons ('&' in the label creates a hot key) // "Load" - new FXButton(layout, "&Load\t\t", 0, this, MID_CHOOSEN_LOAD, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 3, 3); + new FXButton(layout, "&Load\t\t", 0, this, MID_CHOOSEN_LOAD, GUIDesignButtonBreakpoint); // "Save" - new FXButton(layout, "&Save\t\t", 0, this, MID_CHOOSEN_SAVE, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 3, 3); - new FXHorizontalSeparator(layout, SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXButton(layout, "&Save\t\t", 0, this, MID_CHOOSEN_SAVE, GUIDesignButtonBreakpoint); + new FXHorizontalSeparator(layout, GUIDesignHorizontalSeparator); // "Clear List" - new FXButton(layout, "Clea&r\t\t", 0, this, MID_CHOOSEN_CLEAR, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 3, 3); - new FXHorizontalSeparator(layout, SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXButton(layout, "Clea&r\t\t", 0, this, MID_CHOOSEN_CLEAR, GUIDesignButtonBreakpoint); + new FXHorizontalSeparator(layout, GUIDesignHorizontalSeparator); // "Close" - new FXButton(layout, "&Close\t\t", 0, this, MID_CANCEL, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 3, 3); + new FXButton(layout, "&Close\t\t", 0, this, MID_CANCEL, GUIDesignButtonBreakpoint); // setIcon(GUIIconSubSys::getIcon(ICON_APP_BREAKPOINTS)); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/dialogs/GUIDialog_Breakpoints.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/dialogs/GUIDialog_Breakpoints.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/dialogs/GUIDialog_Breakpoints.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/dialogs/GUIDialog_Breakpoints.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Thu, 17 Jun 2004 -/// @version $Id: GUIDialog_Breakpoints.h 21068 2016-06-30 09:05:52Z behrisch $ +/// @version $Id: GUIDialog_Breakpoints.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Editor for simulation breakpoints /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIApplicationWindow.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIApplicationWindow.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIApplicationWindow.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIApplicationWindow.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Andreas Gaubatz /// @date Sept 2002 -/// @version $Id: GUIApplicationWindow.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUIApplicationWindow.cpp 23974 2017-04-19 12:09:14Z laemmel $ /// // The main window of the SUMO-gui. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -59,8 +60,6 @@ #include #include -#include -#include #include #include #include @@ -81,6 +80,7 @@ #include #include #include +#include #include #include #include @@ -91,9 +91,6 @@ #include "dialogs/GUIDialog_AppSettings.h" #include "dialogs/GUIDialog_Breakpoints.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif //#define HAVE_DANGEROUS_SOUNDS @@ -119,6 +116,8 @@ FXMAPFUNC(SEL_COMMAND, MID_GAMING, GUIApplicationWindow::onCmdGaming), FXMAPFUNC(SEL_COMMAND, MID_FULLSCREEN, GUIApplicationWindow::onCmdFullScreen), FXMAPFUNC(SEL_COMMAND, MID_LISTINTERNAL, GUIApplicationWindow::onCmdListInternal), + FXMAPFUNC(SEL_COMMAND, MID_LISTPARKING, GUIApplicationWindow::onCmdListParking), + FXMAPFUNC(SEL_COMMAND, MID_LISTTELEPORTING, GUIApplicationWindow::onCmdListTeleporting), FXMAPFUNC(SEL_COMMAND, MID_ABOUT, GUIApplicationWindow::onCmdAbout), FXMAPFUNC(SEL_COMMAND, MID_NEW_MICROVIEW, GUIApplicationWindow::onCmdNewView), #ifdef HAVE_OSG @@ -192,23 +191,23 @@ // =========================================================================== // member method definitions // =========================================================================== -GUIApplicationWindow::GUIApplicationWindow(FXApp* a, - const std::string& configPattern) - : GUIMainWindow(a), - myLoadThread(0), myRunThread(0), - myAmLoading(false), - myAlternateSimDelay(0), - myRecentNets(a, "nets"), myConfigPattern(configPattern), - hadDependentBuild(false), - myShowTimeAsHMS(false), - myAmFullScreen(false), - myHaveNotifiedAboutSimEnd(false), - // game specific - myJamSoundTime(60), - myPreviousCollisionNumber(0), - myWaitingTime(0), - myTimeLoss(0) { - GUIIconSubSys::init(a); +GUIApplicationWindow::GUIApplicationWindow(FXApp* a, const std::string& configPattern) : + GUIMainWindow(a), + myLoadThread(0), myRunThread(0), + myAmLoading(false), + myAlternateSimDelay(0), + myRecentNets(a, "nets"), + myConfigPattern(configPattern), + hadDependentBuild(false), + myShowTimeAsHMS(false), + myAmFullScreen(false), + myHaveNotifiedAboutSimEnd(false), + // game specific + myJamSoundTime(60), + myPreviousCollisionNumber(0), + myWaitingTime(0), + myTimeLoss(0) { + GUIIconSubSys::initIcons(a); } @@ -224,28 +223,20 @@ setSelector(MID_WINDOW); // build menu bar - myMenuBarDrag = new FXToolBarShell(this, FRAME_NORMAL); - myMenuBar = new FXMenuBar(myTopDock, myMenuBarDrag, - LAYOUT_SIDE_TOP | LAYOUT_FILL_X | FRAME_RAISED); - new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP, - TOOLBARGRIP_DOUBLE); + myMenuBarDrag = new FXToolBarShell(this, GUIDesignToolBarShell3); + myMenuBar = new FXMenuBar(myTopDock, myMenuBarDrag, GUIDesignBar); + new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip); buildToolBars(); // build the thread - io - myLoadThreadEvent.setTarget(this), - myLoadThreadEvent.setSelector(ID_LOADTHREAD_EVENT); - myRunThreadEvent.setTarget(this), - myRunThreadEvent.setSelector(ID_RUNTHREAD_EVENT); + myLoadThreadEvent.setTarget(this), myLoadThreadEvent.setSelector(ID_LOADTHREAD_EVENT); + myRunThreadEvent.setTarget(this), myRunThreadEvent.setSelector(ID_RUNTHREAD_EVENT); // build the status bar - myStatusbar = new FXStatusBar(this, LAYOUT_SIDE_BOTTOM | LAYOUT_FILL_X | FRAME_RAISED); + myStatusbar = new FXStatusBar(this, GUIDesignStatusBar); { - myGeoFrame = - new FXHorizontalFrame(myStatusbar, LAYOUT_FIX_WIDTH | LAYOUT_FILL_Y | LAYOUT_RIGHT | FRAME_SUNKEN, - 0, 0, 20, 0, 0, 0, 0, 0, 0, 0); + myGeoFrame = new FXHorizontalFrame(myStatusbar, GUIDesignHorizontalFrameStatusBar); myGeoCoordinate = new FXLabel(myGeoFrame, "N/A\t\tOriginal coordinate (before coordinate transformation in NETCONVERT)", 0, LAYOUT_CENTER_Y); - myCartesianFrame = - new FXHorizontalFrame(myStatusbar, LAYOUT_FIX_WIDTH | LAYOUT_FILL_Y | LAYOUT_RIGHT | FRAME_SUNKEN, - 0, 0, 20, 0, 0, 0, 0, 0, 0, 0); + myCartesianFrame = new FXHorizontalFrame(myStatusbar, GUIDesignHorizontalFrameStatusBar); myCartesianCoordinate = new FXLabel(myCartesianFrame, "N/A\t\tNetwork coordinate", 0, LAYOUT_CENTER_Y); myStatButtons.push_back(new FXButton(myStatusbar, "-", GUIIconSubSys::getIcon(ICON_GREENVEHICLE), this, MID_SHOWVEHSTATS)); myStatButtons.push_back(new FXButton(myStatusbar, "-", GUIIconSubSys::getIcon(ICON_GREENPERSON), this, MID_SHOWPERSONSTATS)); @@ -255,19 +246,13 @@ } // make the window a mdi-window - myMainSplitter = new FXSplitter(this, - SPLITTER_REVERSED | SPLITTER_VERTICAL | LAYOUT_FILL_X | LAYOUT_FILL_Y | SPLITTER_TRACKING | FRAME_RAISED | FRAME_THICK); - myMDIClient = new FXMDIClient(myMainSplitter, - LAYOUT_FILL_X | LAYOUT_FILL_Y | FRAME_SUNKEN | FRAME_THICK); + myMainSplitter = new FXSplitter(this, GUIDesignSplitter | SPLITTER_VERTICAL | SPLITTER_REVERSED); + myMDIClient = new FXMDIClient(myMainSplitter, GUIDesignSplitterMDI); myMDIMenu = new FXMDIMenu(this, myMDIClient); - new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient, - FXMDIClient::ID_MDI_MENUWINDOW, LAYOUT_LEFT); - new FXMDIDeleteButton(myMenuBar, myMDIClient, - FXMDIClient::ID_MDI_MENUCLOSE, FRAME_RAISED | LAYOUT_RIGHT); - new FXMDIRestoreButton(myMenuBar, myMDIClient, - FXMDIClient::ID_MDI_MENURESTORE, FRAME_RAISED | LAYOUT_RIGHT); - new FXMDIMinimizeButton(myMenuBar, myMDIClient, - FXMDIClient::ID_MDI_MENUMINIMIZE, FRAME_RAISED | LAYOUT_RIGHT); + new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient, FXMDIClient::ID_MDI_MENUWINDOW, GUIDesignMDIButtonLeft); + new FXMDIDeleteButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUCLOSE, GUIDesignMDIButtonRight); + new FXMDIRestoreButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENURESTORE, GUIDesignMDIButtonRight); + new FXMDIMinimizeButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUMINIMIZE, GUIDesignMDIButtonRight); // build the message window myMessageWindow = new GUIMessageWindow(myMainSplitter); @@ -277,8 +262,7 @@ myToolBar7->hide(); // build additional threads myLoadThread = new GUILoadThread(getApp(), this, myEvents, myLoadThreadEvent); - myRunThread = new GUIRunThread(getApp(), this, *mySimDelayTarget, myEvents, - myRunThreadEvent); + myRunThread = new GUIRunThread(getApp(), this, *mySimDelayTarget, myEvents, myRunThreadEvent); // set the status bar myStatusbar->getStatusLine()->setText("Ready."); // set the caption @@ -292,27 +276,7 @@ void GUIApplicationWindow::create() { - int windowWidth = getApp()->reg().readIntEntry("SETTINGS", "width", 600); - int windowHeight = getApp()->reg().readIntEntry("SETTINGS", "height", 400); - const OptionsCont& oc = OptionsCont::getOptions(); - if (oc.isSet("window-size")) { - std::vector windowSize = oc.getStringVector("window-size"); - if (windowSize.size() != 2 - || !TplCheck::_str2int(windowSize[0]) - || !TplCheck::_str2int(windowSize[1])) { - WRITE_ERROR("option window-size requires INT,INT"); - } else { - windowWidth = TplConvert::_str2int(windowSize[0]); - windowHeight = TplConvert::_str2int(windowSize[1]); - } - } - - if (oc.isSet("window-size") || getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 0) { - setX(getApp()->reg().readIntEntry("SETTINGS", "x", 150)); - setY(getApp()->reg().readIntEntry("SETTINGS", "y", 150)); - setWidth(windowWidth); - setHeight(windowHeight); - } + setWindowSizeAndPos(); gCurrentFolder = getApp()->reg().readStringEntry("SETTINGS", "basedir", ""); FXMainWindow::create(); myMenuBarDrag->create(); @@ -336,7 +300,7 @@ myCartesianFrame->setWidth(width); myGeoFrame->setWidth(width); - show(PLACEMENT_SCREEN); + show(PLACEMENT_DEFAULT); if (!OptionsCont::getOptions().isSet("window-size")) { if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 1) { maximize(); @@ -515,18 +479,25 @@ new FXMenuCheck(myLocatorMenu, "Show Internal Structures\t\tShow internal junctions and streets in locator dialog.", this, MID_LISTINTERNAL); + FXMenuCheck* listParking = new FXMenuCheck(myLocatorMenu, + "Show Parking Vehicles\t\tShow parking vehicles in locator dialog.", + this, MID_LISTPARKING); + listParking->setCheck(myListParking); + new FXMenuCheck(myLocatorMenu, + "Show vehicles outside the road network\t\tShow vehicles that are teleporting or driving remote-controlled outside the road network in locator dialog.", + this, MID_LISTTELEPORTING); // build control menu myControlMenu = new FXMenuPane(this); new FXMenuTitle(myMenuBar, "Simulation", NULL, myControlMenu); new FXMenuCommand(myControlMenu, "Run\tCtrl+A\tStart running the simulation.", - NULL, this, MID_START); + GUIIconSubSys::getIcon(ICON_START), this, MID_START); new FXMenuCommand(myControlMenu, "Stop\tCtrl+S\tStop running the simulation.", - NULL, this, MID_STOP); + GUIIconSubSys::getIcon(ICON_STOP), this, MID_STOP); new FXMenuCommand(myControlMenu, "Step\tCtrl+D\tPerform one simulation step.", - NULL, this, MID_STEP); + GUIIconSubSys::getIcon(ICON_STEP), this, MID_STEP); // build windows menu myWindowsMenu = new FXMenuPane(this); @@ -583,67 +554,46 @@ // build tool bars { // file and simulation tool bar - myToolBarDrag1 = new FXToolBarShell(this, FRAME_NORMAL); - myToolBar1 = new FXToolBar(myTopDock, myToolBarDrag1, - LAYOUT_DOCK_NEXT | LAYOUT_SIDE_TOP | FRAME_RAISED); - new FXToolBarGrip(myToolBar1, myToolBar1, FXToolBar::ID_TOOLBARGRIP, - TOOLBARGRIP_DOUBLE); + myToolBarDrag1 = new FXToolBarShell(this, GUIDesignToolBarShell3); + myToolBar1 = new FXToolBar(myTopDock, myToolBarDrag1, GUIDesignToolBarShell1); + new FXToolBarGrip(myToolBar1, myToolBar1, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip); // build file tools - new FXButton(myToolBar1, "\t\tOpen a simulation (Configuration file).", - GUIIconSubSys::getIcon(ICON_OPEN_CONFIG), this, MID_OPEN_CONFIG, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); - new FXButton(myToolBar1, "\t\tOpen a network.", - GUIIconSubSys::getIcon(ICON_OPEN_NET), this, MID_OPEN_NETWORK, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); - new FXButton(myToolBar1, "\t\tReloads the simulation / the network.", - GUIIconSubSys::getIcon(ICON_RELOAD), this, MID_RELOAD, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); + new FXButton(myToolBar1, "\t\tOpen a simulation (Configuration file).", GUIIconSubSys::getIcon(ICON_OPEN_CONFIG), this, MID_OPEN_CONFIG, GUIDesignButtonToolbar); + new FXButton(myToolBar1, "\t\tOpen a network.", GUIIconSubSys::getIcon(ICON_OPEN_NET), this, MID_OPEN_NETWORK, GUIDesignButtonToolbar); + new FXButton(myToolBar1, "\t\tReloads the simulation / the network.", GUIIconSubSys::getIcon(ICON_RELOAD), this, MID_RELOAD, GUIDesignButtonToolbar); } { + // simulation toolbar + myToolBarDrag2 = new FXToolBarShell(this, GUIDesignToolBarShell3); + myToolBar2 = new FXToolBar(myTopDock, myToolBarDrag2, GUIDesignToolBarShell2); + new FXToolBarGrip(myToolBar2, myToolBar2, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip); // build simulation tools - myToolBarDrag2 = new FXToolBarShell(this, FRAME_NORMAL); - myToolBar2 = new FXToolBar(myTopDock, myToolBarDrag2, - LAYOUT_DOCK_SAME | LAYOUT_SIDE_TOP | FRAME_RAISED); - new FXToolBarGrip(myToolBar2, myToolBar2, FXToolBar::ID_TOOLBARGRIP, - TOOLBARGRIP_DOUBLE); - new FXButton(myToolBar2, "\t\tStart the loaded simulation.", - GUIIconSubSys::getIcon(ICON_START), this, MID_START, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); - new FXButton(myToolBar2, "\t\tStop the running simulation.", - GUIIconSubSys::getIcon(ICON_STOP), this, MID_STOP, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); - new FXButton(myToolBar2, "\t\tPerform a single simulation step.", - GUIIconSubSys::getIcon(ICON_STEP), this, MID_STEP, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); + new FXButton(myToolBar2, "\t\tStart the loaded simulation.", GUIIconSubSys::getIcon(ICON_START), this, MID_START, GUIDesignButtonToolbar); + new FXButton(myToolBar2, "\t\tStop the running simulation.", GUIIconSubSys::getIcon(ICON_STOP), this, MID_STOP, GUIDesignButtonToolbar); + new FXButton(myToolBar2, "\t\tPerform a single simulation step.", GUIIconSubSys::getIcon(ICON_STEP), this, MID_STEP, GUIDesignButtonToolbar); } { // Simulation Step Display - myToolBarDrag3 = new FXToolBarShell(this, FRAME_NORMAL); - myToolBar3 = new FXToolBar(myTopDock, myToolBarDrag3, - LAYOUT_DOCK_SAME | LAYOUT_SIDE_TOP | FRAME_RAISED); - new FXToolBarGrip(myToolBar3, myToolBar3, FXToolBar::ID_TOOLBARGRIP, - TOOLBARGRIP_DOUBLE); - new FXButton(myToolBar3, "Time:\t\tToggle between seconds and hour:minute:seconds display", 0, this, MID_TIME_TOOGLE, - BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); - myLCDLabel = new FXEX::FXLCDLabel(myToolBar3, 13, 0, 0, JUSTIFY_RIGHT); + myToolBarDrag3 = new FXToolBarShell(this, GUIDesignToolBarShell3); + myToolBar3 = new FXToolBar(myTopDock, myToolBarDrag3, GUIDesignToolBarShell2); + new FXToolBarGrip(myToolBar3, myToolBar3, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip); + new FXButton(myToolBar3, "Time:\t\tToggle between seconds and hour:minute:seconds display", 0, this, MID_TIME_TOOGLE, GUIDesignButtonToolbarText); + + myLCDLabel = new FXEX::FXLCDLabel(myToolBar3, 16, 0, 0, JUSTIFY_RIGHT); myLCDLabel->setHorizontal(2); myLCDLabel->setVertical(6); myLCDLabel->setThickness(2); myLCDLabel->setGroove(2); - myLCDLabel->setText("-------------"); + myLCDLabel->setText("----------------"); } { // Simulation Delay - myToolBarDrag4 = new FXToolBarShell(this, FRAME_NORMAL); - myToolBar4 = new FXToolBar(myTopDock, myToolBarDrag4, - LAYOUT_DOCK_SAME | LAYOUT_SIDE_TOP | FRAME_RAISED | LAYOUT_FILL_Y); - new FXToolBarGrip(myToolBar4, myToolBar4, FXToolBar::ID_TOOLBARGRIP, - TOOLBARGRIP_DOUBLE); - new FXButton(myToolBar4, "Delay (ms):\t\tToggle between alternative delay values", 0, this, MID_DELAY_TOOGLE, - BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); - mySimDelayTarget = - new FXRealSpinDial(myToolBar4, 7, 0, MID_SIMDELAY, - LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | LAYOUT_FILL_Y); + myToolBarDrag4 = new FXToolBarShell(this, GUIDesignToolBarShell3); + myToolBar4 = new FXToolBar(myTopDock, myToolBarDrag4, GUIDesignToolBarShell2); + new FXToolBarGrip(myToolBar4, myToolBar4, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip); + new FXButton(myToolBar4, "Delay (ms):\t\tToggle between alternative delay values", 0, this, MID_DELAY_TOOGLE, GUIDesignButtonToolbarText); + + mySimDelayTarget = new FXRealSpinDial(myToolBar4, 7, 0, MID_SIMDELAY, GUIDesignSpinDial); mySimDelayTarget->setNumberFormat(0); mySimDelayTarget->setIncrements(1, 10, 10); mySimDelayTarget->setRange(0, 1000); @@ -651,27 +601,23 @@ } { // Views - myToolBarDrag5 = new FXToolBarShell(this, FRAME_NORMAL); - myToolBar5 = new FXToolBar(myTopDock, myToolBarDrag5, - LAYOUT_DOCK_SAME | LAYOUT_SIDE_TOP | FRAME_RAISED); - new FXToolBarGrip(myToolBar5, myToolBar5, FXToolBar::ID_TOOLBARGRIP, - TOOLBARGRIP_DOUBLE); + myToolBarDrag5 = new FXToolBarShell(this, GUIDesignToolBarShell3); + myToolBar5 = new FXToolBar(myTopDock, myToolBarDrag5, GUIDesignToolBarShell2); + new FXToolBarGrip(myToolBar5, myToolBar5, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip); // build view tools new FXButton(myToolBar5, "\t\tOpen a new microscopic view.", - GUIIconSubSys::getIcon(ICON_MICROVIEW), this, MID_NEW_MICROVIEW, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); + GUIIconSubSys::getIcon(ICON_MICROVIEW), this, MID_NEW_MICROVIEW, GUIDesignButtonToolbar); #ifdef HAVE_OSG new FXButton(myToolBar5, "\t\tOpen a new 3D view.", - GUIIconSubSys::getIcon(ICON_MICROVIEW), this, MID_NEW_OSGVIEW, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); + GUIIconSubSys::getIcon(ICON_MICROVIEW), this, MID_NEW_OSGVIEW, GUIDesignButtonToolbar); #endif } { /// game specific stuff // total waitingTime - myToolBarDrag6 = new FXToolBarShell(this, FRAME_NORMAL); - myToolBar6 = new FXToolBar(myTopDock, myToolBarDrag6, LAYOUT_DOCK_SAME | LAYOUT_SIDE_TOP | FRAME_RAISED); - new FXToolBarGrip(myToolBar6, myToolBar6, FXToolBar::ID_TOOLBARGRIP, TOOLBARGRIP_DOUBLE); + myToolBarDrag6 = new FXToolBarShell(this, GUIDesignToolBarShell3); + myToolBar6 = new FXToolBar(myTopDock, myToolBarDrag6, GUIDesignToolBarShell2); + new FXToolBarGrip(myToolBar6, myToolBar6, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip); new FXLabel(myToolBar6, "Waiting Time:\t\tTime spent waiting accumulated for all vehicles", 0, LAYOUT_TOP | LAYOUT_LEFT); myWaitingTimeLabel = new FXEX::FXLCDLabel(myToolBar6, 13, 0, 0, JUSTIFY_RIGHT); myWaitingTimeLabel->setHorizontal(2); @@ -681,9 +627,9 @@ myWaitingTimeLabel->setText("-------------"); // idealistic time loss - myToolBarDrag7 = new FXToolBarShell(this, FRAME_NORMAL); - myToolBar7 = new FXToolBar(myTopDock, myToolBarDrag7, LAYOUT_DOCK_SAME | LAYOUT_SIDE_TOP | FRAME_RAISED); - new FXToolBarGrip(myToolBar7, myToolBar7, FXToolBar::ID_TOOLBARGRIP, TOOLBARGRIP_DOUBLE); + myToolBarDrag7 = new FXToolBarShell(this, GUIDesignToolBarShell3); + myToolBar7 = new FXToolBar(myTopDock, myToolBarDrag7, GUIDesignToolBarShell2); + new FXToolBarGrip(myToolBar7, myToolBar7, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip); new FXLabel(myToolBar7, "Time Loss:\t\tTime lost due to being unable to drive with maximum speed for all vehicles", 0, LAYOUT_TOP | LAYOUT_LEFT); myTimeLossLabel = new FXEX::FXLCDLabel(myToolBar7, 13, 0, 0, JUSTIFY_RIGHT); myTimeLossLabel->setHorizontal(2); @@ -1163,6 +1109,19 @@ long +GUIApplicationWindow::onCmdListParking(FXObject*, FXSelector, void*) { + myListParking = !myListParking; + return 1; +} + +long +GUIApplicationWindow::onCmdListTeleporting(FXObject*, FXSelector, void*) { + myListTeleporting = !myListTeleporting; + return 1; +} + + +long GUIApplicationWindow::onCmdNewView(FXObject*, FXSelector, void*) { openNewView(GUISUMOViewParent::VIEW_2D_OPENGL); return 1; @@ -1180,8 +1139,7 @@ long GUIApplicationWindow::onCmdAbout(FXObject*, FXSelector, void*) { - GUIDialog_AboutSUMO* about = - new GUIDialog_AboutSUMO(this, "About SUMO", 0, 0); + GUIDialog_AboutSUMO* about = new GUIDialog_AboutSUMO(this); about->create(); about->show(PLACEMENT_OWNER); return 1; @@ -1261,6 +1219,9 @@ getApp()->exit(1); } } else { + if (OptionsCont::getOptions().getBool("game")) { + onCmdGaming(0, 0, 0); + } // initialise simulation thread if (!myRunThread->init(ec->myNet, ec->myBegin, ec->myEnd)) { if (GUIGlobals::gQuitOnEnd) { @@ -1319,7 +1280,7 @@ setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING, ec->myFile.c_str())); } // set simulation step begin information - myLCDLabel->setText("-------------"); + myLCDLabel->setText("----------------"); for (std::vector::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) { (*it)->setText("-"); } @@ -1387,7 +1348,9 @@ GUIApplicationWindow::handleEvent_SimulationEnded(GUIEvent* e) { GUIEvent_SimulationEnded* ec = static_cast(e); onCmdStop(0, 0, 0); - if (GUIGlobals::gQuitOnEnd) { + if (ec->getReason() == MSNet::SIMSTATE_LOADING) { + onCmdReload(0, 0, 0); + } else if (GUIGlobals::gQuitOnEnd) { closeAllWindows(); getApp()->exit(ec->getReason() == MSNet::SIMSTATE_ERROR_IN_SIM); } else if (GUIGlobals::gDemoAutoReload) { @@ -1458,7 +1421,7 @@ const MSVehicle* veh = dynamic_cast(it->second); assert(veh != 0); if (veh->isOnRoad()) { - const SUMOReal vmax = MIN2(veh->getVehicleType().getMaxSpeed(), veh->getEdge()->getSpeedLimit()); + const double vmax = MIN2(veh->getVehicleType().getMaxSpeed(), veh->getEdge()->getSpeedLimit()); if (veh->getSpeed() < SUMO_const_haltingSpeed) { myWaitingTime += DELTA_T; } @@ -1530,7 +1493,7 @@ void GUIApplicationWindow::closeAllWindows() { myTrackerLock.lock(); - myLCDLabel->setText("-------------"); + myLCDLabel->setText("----------------"); for (std::vector::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) { (*it)->setText("-"); if (it != myStatButtons.begin()) { @@ -1592,6 +1555,7 @@ void GUIApplicationWindow::setStatusBarText(const std::string& text) { myStatusbar->getStatusLine()->setText(text.c_str()); + myStatusbar->getStatusLine()->setNormalText(text.c_str()); } @@ -1610,30 +1574,33 @@ GUIApplicationWindow::updateTimeLCD(SUMOTime time) { time -= DELTA_T; // synchronize displayed time with netstate output if (time < 0) { - myLCDLabel->setText("-------------"); + myLCDLabel->setText("----------------"); return; } if (myAmGaming) { // show time counting backwards time = myRunThread->getSimEndTime() - time; } - SUMOReal fracSeconds = STEPS2TIME(time); - const bool hideFraction = myAmGaming || fmod(TS, 1.) == 0.; - const int BuffSize = 100; - char buffer[BuffSize]; + std::ostringstream str; + str << std::setfill('0'); + const bool hideFraction = myAmGaming || DELTA_T % 1000 == 0; if (myShowTimeAsHMS) { - const int hours = (int)fracSeconds / 3600; - const int minutes = ((int)fracSeconds % 3600) / 60; - fracSeconds = fracSeconds - 3600 * hours - 60 * minutes; - const std::string format = (hideFraction ? - "%02d-%02d-%02.0f" : "%02d-%02d-%06.3f"); - snprintf(buffer, BuffSize, format.c_str(), hours, minutes, fracSeconds); - } else { - const std::string format = (hideFraction ? - "%13.0f" : "%13.3f"); - snprintf(buffer, BuffSize, format.c_str(), fracSeconds); + SUMOTime day = time / 86400000; + if (day > 0) { + str << day << '-'; + time %= 86400000; + } + str << std::setw(2); + str << time / 3600000 << '-'; + time %= 3600000; + str << std::setw(2) << time / 60000 << '-'; + time %= 60000; + } + str << std::setw(2) << time / 1000; + if (!hideFraction) { + str << '.' << std::setw(3) << time % 1000; } - myLCDLabel->setText(buffer); + myLCDLabel->setText(str.str().c_str()); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIApplicationWindow.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIApplicationWindow.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIApplicationWindow.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIApplicationWindow.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Christian Roessel /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIApplicationWindow.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: GUIApplicationWindow.h 23341 2017-03-13 10:11:12Z behrisch $ /// // The main window of the SUMO-gui. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include "GUISUMOViewParent.h" @@ -178,6 +178,12 @@ /// @brief Toggle listing of internal structures long onCmdListInternal(FXObject*, FXSelector, void*); + /// @brief Toggle listing of parking vehicles + long onCmdListParking(FXObject*, FXSelector, void*); + + /// @brief Toggle listing of teleporting vehicles + long onCmdListTeleporting(FXObject*, FXSelector, void*); + /// @brief Shows the about dialog long onCmdAbout(FXObject*, FXSelector, void*); @@ -255,13 +261,13 @@ /** @brief Returns the simulation delay * @return delay in milliseconds */ - virtual SUMOReal getDelay() const { + virtual double getDelay() const { return mySimDelayTarget->getValue(); } /** @brief Sets the delay of the parent application */ - virtual void setDelay(SUMOReal delay) { + virtual void setDelay(double delay) { mySimDelayTarget->setValue(delay); } @@ -395,7 +401,7 @@ RandomDistributor myJamSounds; RandomDistributor myCollisionSounds; /// @brief waiting time after which vehicles trigger jam sounds - SUMOReal myJamSoundTime; + double myJamSoundTime; /// @brief A random number generator used to choose a gaming sound static MTRand myGamingRNG; int myPreviousCollisionNumber; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIEvent_Screenshot.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIEvent_Screenshot.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIEvent_Screenshot.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIEvent_Screenshot.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUIEvent_Screenshot.h /// @author Michael Behrisch /// @date 2015-08-25 -/// @version $Id: GUIEvent_Screenshot.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: GUIEvent_Screenshot.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Event send when a screenshot should be made /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIEvent_SimulationEnded.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIEvent_SimulationEnded.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIEvent_SimulationEnded.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIEvent_SimulationEnded.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Thu, 19 Jun 2003 -/// @version $Id: GUIEvent_SimulationEnded.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIEvent_SimulationEnded.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Event sent when the the simulation is over /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIEvent_SimulationLoaded.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIEvent_SimulationLoaded.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIEvent_SimulationLoaded.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIEvent_SimulationLoaded.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: GUIEvent_SimulationLoaded.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: GUIEvent_SimulationLoaded.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Event send when the simulation has been loaded by GUILadThread /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIGlobals.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIGlobals.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIGlobals.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIGlobals.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004 -/// @version $Id: GUIGlobals.cpp 20988 2016-06-16 13:32:24Z behrisch $ +/// @version $Id: GUIGlobals.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // } /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,10 +31,6 @@ #include "GUIGlobals.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member variables definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIGlobals.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIGlobals.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIGlobals.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIGlobals.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date 2004 -/// @version $Id: GUIGlobals.h 20988 2016-06-16 13:32:24Z behrisch $ +/// @version $Id: GUIGlobals.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Some global variables (yep) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUILoadThread.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUILoadThread.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUILoadThread.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUILoadThread.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUILoadThread.cpp 21790 2016-10-25 12:37:24Z behrisch $ +/// @version $Id: GUILoadThread.cpp 23974 2017-04-19 12:09:14Z laemmel $ /// // Class describing the thread that performs the loading of a simulation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -70,10 +71,6 @@ #include "TraCIServerAPI_GUI.h" #endif -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions @@ -163,11 +160,10 @@ // initialise global settings RandHelper::initRandGlobal(); RandHelper::initRandGlobal(MSRouteHandler::getParsingRNG()); + RandHelper::initRandGlobal(MSDevice::getEquipmentRNG()); MSFrame::setMSGlobals(oc); GUITexturesHelper::allowTextures(!oc.getBool("disable-textures")); - if (oc.getBool("game")) { - myParent->onCmdGaming(0, 0, 0); - } + MSVehicleControl* vehControl = 0; GUIVisualizationSettings::UseMesoSim = MSGlobals::gUseMesoSim; if (MSGlobals::gUseMesoSim) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUILoadThread.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUILoadThread.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUILoadThread.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUILoadThread.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: GUILoadThread.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUILoadThread.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Class describing the thread that performs the loading of a simulation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIManipulator.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIManipulator.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIManipulator.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIManipulator.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUIManipulator.cpp /// @author Daniel Krajzewicz /// @date Jun 2004 -/// @version $Id: GUIManipulator.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIManipulator.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Abstract GUI manipulation class /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,10 +33,7 @@ #include #include "GUIManipulator.h" #include - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS +#include // =========================================================================== @@ -48,15 +45,12 @@ // =========================================================================== // method definitions // =========================================================================== -GUIManipulator::GUIManipulator(GUIMainWindow& app, - const std::string& name, - int xpos, int ypos) - : FXDialogBox(&app, name.c_str(), DECOR_CLOSE | DECOR_TITLE, xpos, ypos, 0, 0) {} +GUIManipulator::GUIManipulator(GUIMainWindow& app, const std::string& name, int xpos, int ypos) : + FXDialogBox(&app, name.c_str(), GUIDesignDialogBox, xpos, ypos, 0, 0) {} GUIManipulator::~GUIManipulator() {} - /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIManipulator.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIManipulator.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIManipulator.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIManipulator.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Sascha Krieg /// @date Jun 2004 -/// @version $Id: GUIManipulator.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIManipulator.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Abstract GUI manipulation class /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIRunThread.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIRunThread.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIRunThread.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIRunThread.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIRunThread.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIRunThread.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The thread that runs the simulation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,6 +44,7 @@ #include "GUIGlobals.h" #include #include +#include #include #include #include @@ -52,12 +53,9 @@ #ifndef NO_TRACI #include +#include #endif -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions @@ -66,7 +64,7 @@ FXRealSpinDial& simDelay, MFXEventQue& eq, FXEX::FXThreadEvent& ev) : FXSingleEventThread(app, parent), - myNet(0), myHalting(true), myQuit(false), mySimulationInProgress(false), myOk(true), + myNet(0), myHalting(true), myQuit(false), mySimulationInProgress(false), myOk(true), myHaveSignaledEnd(false), mySimDelay(simDelay), myEventQue(eq), myEventThrow(ev) { myErrorRetriever = new MsgRetrievingFunction(this, &GUIRunThread::retrieveMessage, MsgHandler::MT_ERROR); myMessageRetriever = new MsgRetrievingFunction(this, &GUIRunThread::retrieveMessage, MsgHandler::MT_MESSAGE); @@ -190,20 +188,27 @@ e = 0; MSNet::SimulationState state = myNet->simulationState(mySimEndTime); #ifndef NO_TRACI - if (state != MSNet::SIMSTATE_RUNNING) { + if (state == MSNet::SIMSTATE_LOADING) { + OptionsIO::setArgs(TraCI::getLoadArgs()); + TraCI::getLoadArgs().clear(); + } else if (state != MSNet::SIMSTATE_RUNNING) { if (OptionsCont::getOptions().getInt("remote-port") != 0 && !TraCIServer::wasClosed()) { state = MSNet::SIMSTATE_RUNNING; } } #endif switch (state) { + case MSNet::SIMSTATE_LOADING: case MSNet::SIMSTATE_END_STEP_REACHED: case MSNet::SIMSTATE_NO_FURTHER_VEHICLES: case MSNet::SIMSTATE_CONNECTION_CLOSED: - case MSNet::SIMSTATE_TOO_MANY_VEHICLES: - WRITE_MESSAGE("Simulation ended at time: " + time2string(myNet->getCurrentTimeStep())); - WRITE_MESSAGE("Reason: " + MSNet::getStateMessage(state)); - e = new GUIEvent_SimulationEnded(state, myNet->getCurrentTimeStep() - DELTA_T); + case MSNet::SIMSTATE_TOO_MANY_TELEPORTS: + if (!myHaveSignaledEnd || state != MSNet::SIMSTATE_END_STEP_REACHED) { + WRITE_MESSAGE("Simulation ended at time: " + time2string(myNet->getCurrentTimeStep())); + WRITE_MESSAGE("Reason: " + MSNet::getStateMessage(state)); + e = new GUIEvent_SimulationEnded(state, myNet->getCurrentTimeStep() - DELTA_T); + myHaveSignaledEnd = true; + } break; default: break; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIRunThread.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIRunThread.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIRunThread.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIRunThread.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIRunThread.h 21068 2016-06-30 09:05:52Z behrisch $ +/// @version $Id: GUIRunThread.h 24108 2017-04-27 18:43:30Z behrisch $ /// // The thread that runs the simulation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -147,6 +147,9 @@ /** information whether the thread is running in single step mode */ bool mySingle; + /// @brief whether the simulation already ended + bool myHaveSignaledEnd; + /** @brief The instances of message retriever encapsulations Needed to be deleted from the handler later on */ OutputDevice* myErrorRetriever, *myMessageRetriever, *myWarningRetriever; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUISUMOViewParent.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUISUMOViewParent.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUISUMOViewParent.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUISUMOViewParent.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Laura Bieker /// @author Andreas Gaubatz /// @date Sept 2002 -/// @version $Id: GUISUMOViewParent.cpp 20772 2016-05-20 10:07:31Z behrisch $ +/// @version $Id: GUISUMOViewParent.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A single child window which contains a view of the simulation area /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -70,10 +70,6 @@ #include #endif -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping @@ -208,7 +204,8 @@ if (MSGlobals::gUseMesoSim) { static_cast(static_cast(MSNet::getInstance())->getGUIMEVehicleControl())->insertVehicleIDs(ids); } else { - static_cast(MSNet::getInstance()->getVehicleControl()).insertVehicleIDs(ids); + static_cast(MSNet::getInstance()->getVehicleControl()).insertVehicleIDs( + ids, myParent->listParking(), myParent->listTeleporting()); } icon = ICON_LOCATEVEHICLE; title = "Vehicle Chooser"; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUISUMOViewParent.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUISUMOViewParent.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUISUMOViewParent.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUISUMOViewParent.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Andreas Gaubatz /// @date Sept 2002 -/// @version $Id: GUISUMOViewParent.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUISUMOViewParent.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A single child window which contains a view of the simulation area /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUITLLogicPhasesTrackerWindow.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUITLLogicPhasesTrackerWindow.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUITLLogicPhasesTrackerWindow.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUITLLogicPhasesTrackerWindow.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Oct/Nov 2003 -/// @version $Id: GUITLLogicPhasesTrackerWindow.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUITLLogicPhasesTrackerWindow.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A window displaying the phase diagram of a tl-logic /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,13 +42,11 @@ #include #include #include +#include +#include #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions @@ -159,9 +157,9 @@ 20, 20, 300, 200), myApplication(&app), myTLLogic(&logic), myAmInTrackingMode(true) { // build the toolbar - myToolBarDrag = new FXToolBarShell(this, FRAME_NORMAL); + myToolBarDrag = new FXToolBarShell(this, GUIDesignToolBarShell3); myToolBar = new FXToolBar(this, myToolBarDrag, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | FRAME_RAISED); - new FXToolBarGrip(myToolBar, myToolBar, FXToolBar::ID_TOOLBARGRIP, TOOLBARGRIP_DOUBLE); + new FXToolBarGrip(myToolBar, myToolBar, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip); // interval manipulation myBeginOffset = new FXRealSpinDial(myToolBar, 10, this, MID_SIMSTEP, LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK); myBeginOffset->setFormatString("%.0f"); @@ -297,23 +295,23 @@ // draw the horizontal lines dividing the signal groups glColor3d(1, 1, 1); // compute some values needed more than once - const SUMOReal height = (SUMOReal) caller.getHeight(); - const SUMOReal width = (SUMOReal) caller.getWidth(); - pfSetScaleXY((SUMOReal)(.08 * 300. / width), (SUMOReal)(.08 * 300. / height)); - const SUMOReal h4 = ((SUMOReal) 4 / height); - const SUMOReal h9 = ((SUMOReal) 9 / height); - const SUMOReal h10 = ((SUMOReal) 10 / height); - const SUMOReal h11 = ((SUMOReal) 11 / height); - const SUMOReal h16 = ((SUMOReal) 16 / height); - const SUMOReal h20 = ((SUMOReal) 20 / height); + const double height = (double) caller.getHeight(); + const double width = (double) caller.getWidth(); + pfSetScaleXY((double)(.08 * 300. / width), (double)(.08 * 300. / height)); + const double h4 = ((double) 4 / height); + const double h9 = ((double) 9 / height); + const double h10 = ((double) 10 / height); + const double h11 = ((double) 11 / height); + const double h16 = ((double) 16 / height); + const double h20 = ((double) 20 / height); // draw the link names and the lines dividing them - SUMOReal h = (SUMOReal)(1.0 - h10); - SUMOReal h2 = 12; + double h = (double)(1.0 - h10); + double h2 = 12; for (int i = 0; i < (int)myTLLogic->getLinks().size() + 1; ++i) { // draw the bar glBegin(GL_LINES); glVertex2d(0, h); - glVertex2d((SUMOReal)(30. / width), h); + glVertex2d((double)(30. / width), h); glEnd(); // draw the name if (i < (int)myTLLogic->getLinks().size()) { @@ -333,11 +331,11 @@ glEnd(); // draw the names closure (vertical line) - h += (SUMOReal) 20 / height; + h += (double) 20 / height; glColor3d(1, 1, 1); glBegin(GL_LINES); - glVertex2d((SUMOReal) 30 / width, 1.0); - glVertex2d((SUMOReal) 30 / width, h); + glVertex2d((double) 30 / width, 1.0); + glVertex2d((double) 30 / width, h); glEnd(); @@ -345,9 +343,9 @@ // disable value addition while drawing myLock.lock(); // determine the initial offset - SUMOReal x = ((SUMOReal) 31. / width); - SUMOReal ta = (SUMOReal) leftOffset / width; - ta *= (SUMOReal)(((width - 31.0) / ((SUMOReal)(myLastTime - myBeginTime)))); + double x = ((double) 31. / width); + double ta = (double) leftOffset / width; + ta *= (double)(((width - 31.0) / ((double)(myLastTime - myBeginTime)))); x += ta; // and the initial phase information @@ -361,17 +359,17 @@ // the first phase may be drawn incompletely SUMOTime duration = *pd - fpo; // compute the heigh and the width of the phase - h = (SUMOReal)(1.0 - h10); - SUMOReal a = (SUMOReal) duration / width; - a *= (SUMOReal)(((width - 31.0) / ((SUMOReal)(myLastTime - myBeginTime)))); - const SUMOReal x2 = x + a; + h = (double)(1.0 - h10); + double a = (double) duration / width; + a *= (double)(((width - 31.0) / ((double)(myLastTime - myBeginTime)))); + const double x2 = x + a; // go through the links for (int j = 0; j < (int) myTLLogic->getLinks().size(); ++j) { // determine the current link's color LinkState state = pi->getSignalState(j); // draw the bar (red is drawn as a line) - GLHelper::setColor(getLinkColor(state)); + GLHelper::setColor(GUIVisualizationSettings::getLinkColor(state)); switch (state) { case LINKSTATE_TL_RED: case LINKSTATE_TL_REDYELLOW: @@ -410,23 +408,23 @@ if (myPhases.size() != 0) { SUMOTime tickDist = TIME2STEPS(10); // patch distances - hack - SUMOReal t = myBeginOffset != 0 ? (SUMOReal) myBeginOffset->getValue() : STEPS2TIME(myLastTime - myBeginTime); + double t = myBeginOffset != 0 ? (double) myBeginOffset->getValue() : STEPS2TIME(myLastTime - myBeginTime); while (t > (width - 31.) / 4.) { tickDist += TIME2STEPS(10); - t -= (SUMOReal)((width - 31.) / 4.); + t -= (double)((width - 31.) / 4.); } // draw time information - //h = (SUMOReal)(myTLLogic->getLinks().size() * 20 + 12); - SUMOReal glh = (SUMOReal)(1.0 - myTLLogic->getLinks().size() * h20 - h10); + //h = (double)(myTLLogic->getLinks().size() * 20 + 12); + double glh = (double)(1.0 - myTLLogic->getLinks().size() * h20 - h10); // current begin time - pfSetScaleXY((SUMOReal)(.05 * 300. / width), (SUMOReal)(.05 * 300. / height)); + pfSetScaleXY((double)(.05 * 300. / width), (double)(.05 * 300. / height)); // time ticks SUMOTime currTime = myFirstTime2Show; int pos = 31;// + /*!!!currTime*/ - myFirstTime2Show; - SUMOReal glpos = (SUMOReal) pos / width; + double glpos = (double) pos / width; while (pos < width + 50) { const std::string timeStr = time2string(currTime); - const SUMOReal w = pfdkGetStringWidth(timeStr.c_str()); + const double w = pfdkGetStringWidth(timeStr.c_str()); glRotated(180, 1, 0, 0); pfSetPosition(0, 0); glTranslated(glpos - w / 2., -glh + h20 - h4, 0); @@ -439,7 +437,7 @@ glVertex2d(glpos, glh - h4); glEnd(); - const SUMOReal a = STEPS2TIME(tickDist) * (width - 31.0) / STEPS2TIME(myLastTime - myBeginTime); + const double a = STEPS2TIME(tickDist) * (width - 31.0) / STEPS2TIME(myLastTime - myBeginTime); pos += (int) a; glpos += a / width; currTime += tickDist; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUITLLogicPhasesTrackerWindow.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUITLLogicPhasesTrackerWindow.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUITLLogicPhasesTrackerWindow.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUITLLogicPhasesTrackerWindow.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Oct/Nov 2003 -/// @version $Id: GUITLLogicPhasesTrackerWindow.h 21790 2016-10-25 12:37:24Z behrisch $ +/// @version $Id: GUITLLogicPhasesTrackerWindow.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A window displaying the phase diagram of a tl-logic /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,7 +37,14 @@ #include #include #include +// fx3d includes windows.h so we need to guard against macro pollution +#ifdef WIN32 +#define NOMINMAX +#endif #include +#ifdef WIN32 +#undef NOMINMAX +#endif #include #include #include diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIViewTraffic.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIViewTraffic.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIViewTraffic.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIViewTraffic.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Andreas Gaubatz /// @date Sept 2002 -/// @version $Id: GUIViewTraffic.cpp 21790 2016-10-25 12:37:24Z behrisch $ +/// @version $Id: GUIViewTraffic.cpp 23876 2017-04-07 12:07:16Z namdre $ /// // A view on the simulation; this view is a microscopic one /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -70,10 +70,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - /* ------------------------------------------------------------------------- * GUIViewTraffic - FOX callback mapping * ----------------------------------------------------------------------- */ @@ -119,7 +115,7 @@ v.getColoringSchemesCombo().setCurrentItem(v.getColoringSchemesCombo().getNumItems() - 1); } } - v.getColoringSchemesCombo().setNumVisible(5); + v.getColoringSchemesCombo().setNumVisible(MAX2(5, (int)names.size() + 1)); } // for junctions new FXButton(v.getLocatorPopup(), @@ -260,7 +256,7 @@ MSTLLogicControl& tlsControl = MSNet::getInstance()->getTLSControl(); const std::vector& logics = tlsControl.getAllLogics(); MSTrafficLightLogic* minTll = 0; - SUMOReal minDist = std::numeric_limits::infinity(); + double minDist = std::numeric_limits::infinity(); for (std::vector::const_iterator i = logics.begin(); i != logics.end(); ++i) { // get the logic MSTrafficLightLogic* tll = (*i); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIViewTraffic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIViewTraffic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/GUIViewTraffic.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/GUIViewTraffic.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Andreas Gaubatz /// @date Sept 2002 -/// @version $Id: GUIViewTraffic.h 21203 2016-07-20 07:16:38Z behrisch $ +/// @version $Id: GUIViewTraffic.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A view on the simulation; this view is a microscopic one /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/TraCIServerAPI_GUI.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/TraCIServerAPI_GUI.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/TraCIServerAPI_GUI.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/TraCIServerAPI_GUI.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_GUI.cpp 21186 2016-07-18 12:04:16Z namdre $ +/// @version $Id: TraCIServerAPI_GUI.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // APIs for getting/setting GUI values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,11 +45,6 @@ #include "GUIEvent_Screenshot.h" #include "TraCIServerAPI_GUI.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - - // =========================================================================== // method definitions // =========================================================================== @@ -145,12 +140,14 @@ } break; case VAR_VIEW_OFFSET: { - Position off, p; - if (!server.readTypeCheckingPosition2D(inputStorage, off)) { + TraCIPosition tp; + if (!server.readTypeCheckingPosition2D(inputStorage, tp)) { return server.writeErrorStatusCmd(CMD_SET_GUI_VARIABLE, "The view port must be given as a position.", outputStorage); } - off.set(off.x(), off.y(), v->getChanger().getZPos()); - p.set(off.x(), off.y(), 0); + + Position off, p; + off.set(tp.x, tp.y, v->getChanger().getZPos()); + p.set(tp.x, tp.y, 0); v->setViewportFromTo(off, p); } break; @@ -192,9 +189,8 @@ if (veh == 0) { return server.writeErrorStatusCmd(CMD_SET_GUI_VARIABLE, "Could not find vehicle '" + id + "'.", outputStorage); } - if (!static_cast(veh)->hasActiveAddVisualisation(v, GUIBaseVehicle::VO_TRACKED)) { + if (v->getTrackedID() != static_cast(veh)->getGlID()) { v->startTrack(static_cast(veh)->getGlID()); - static_cast(veh)->addActiveAddVisualisation(v, GUIBaseVehicle::VO_TRACKED); } } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/TraCIServerAPI_GUI.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/TraCIServerAPI_GUI.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/gui/TraCIServerAPI_GUI.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/gui/TraCIServerAPI_GUI.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_GUI.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: TraCIServerAPI_GUI.h 23416 2017-03-15 12:21:21Z namdre $ /// // APIs for getting/setting GUI values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,7 +34,7 @@ #ifndef NO_TRACI #include -#include +#include #include #include diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guinetload/GUIDetectorBuilder.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guinetload/GUIDetectorBuilder.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guinetload/GUIDetectorBuilder.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guinetload/GUIDetectorBuilder.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Tue, 22 Jul 2003 -/// @version $Id: GUIDetectorBuilder.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUIDetectorBuilder.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Builds detectors for guisim /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,8 +32,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -46,10 +45,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -63,7 +58,7 @@ MSDetectorFileOutput* GUIDetectorBuilder::createInductLoop(const std::string& id, - MSLane* lane, SUMOReal pos, const std::string& vTypes, bool show) { + MSLane* lane, double pos, const std::string& vTypes, bool show) { if (show) { if (MSGlobals::gUseMesoSim) { return new GUIMEInductLoop(id, MSGlobals::gMesoNet->getSegmentForEdge(lane->getEdge(), pos), pos, vTypes); @@ -77,36 +72,32 @@ MSDetectorFileOutput* GUIDetectorBuilder::createInstantInductLoop(const std::string& id, - MSLane* lane, SUMOReal pos, const std::string& od, const std::string& vTypes) { + MSLane* lane, double pos, const std::string& od, const std::string& vTypes) { return new GUIInstantInductLoop(id, OutputDevice::getDevice(od), lane, pos, vTypes); } MSE2Collector* -GUIDetectorBuilder::createSingleLaneE2Detector(const std::string& id, - DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length, - SUMOTime haltingTimeThreshold, - SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, const std::string& vTypes) { - return new GUI_E2_ZS_Collector(id, usage, lane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes); +GUIDetectorBuilder::createE2Detector(const std::string& id, + DetectorUsage usage, MSLane* lane, double pos, double endPos, double length, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, + const std::string& vTypes, bool showDetector) { + return new GUIE2Collector(id, usage, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector); } - -MSDetectorFileOutput* -GUIDetectorBuilder::createMultiLaneE2Detector(const std::string& id, - DetectorUsage usage, MSLane* lane, SUMOReal pos, - SUMOTime haltingTimeThreshold, - SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, const std::string& vTypes) { - return new GUI_E2_ZS_CollectorOverLanes(id, usage, lane, pos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes); +MSE2Collector* +GUIDetectorBuilder::createE2Detector(const std::string& id, + DetectorUsage usage, std::vector lanes, double pos, double endPos, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, + const std::string& vTypes, bool showDetector) { + return new GUIE2Collector(id, usage, lanes, pos, endPos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector); } - MSDetectorFileOutput* GUIDetectorBuilder::createE3Detector(const std::string& id, const CrossSectionVector& entries, const CrossSectionVector& exits, - SUMOReal haltingSpeedThreshold, + double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string& vTypes) { return new GUIE3Collector(id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold, vTypes); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guinetload/GUIDetectorBuilder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guinetload/GUIDetectorBuilder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guinetload/GUIDetectorBuilder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guinetload/GUIDetectorBuilder.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Tue, 22 Jul 2003 -/// @version $Id: GUIDetectorBuilder.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUIDetectorBuilder.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Builds detectors for guisim /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -78,11 +78,11 @@ * @param[in] id The id the detector shall have * @param[in] lane The lane the detector is placed at * @param[in] pos The position on the lane the detector is placed at - * @param[in] splitByType Whether additional information split by vehicle classes shall be generated + * @param[in] vTypes which vehicle types are considered * @param[in] show Whether to show the detector in the gui if available */ virtual MSDetectorFileOutput* createInductLoop(const std::string& id, - MSLane* lane, SUMOReal pos, const std::string& vTypes, bool show = true); + MSLane* lane, double pos, const std::string& vTypes, bool show = true); /** @brief Creates an instance of an e1 detector using the given values @@ -95,46 +95,23 @@ * @param[in] od The output device the loop shall use */ virtual MSDetectorFileOutput* createInstantInductLoop(const std::string& id, - MSLane* lane, SUMOReal pos, const std::string& od, const std::string& vTypes); + MSLane* lane, double pos, const std::string& od, const std::string& vTypes); - - /** @brief Creates an instance of an e2-detector (areal detector) using the given values + /** @brief Creates a GUIE2Collector instance, overrides MSE2Collector::createE2Detector() * - * Simply calls the GUI_E2_ZS_Collector constructor + * Simply calls the GUIE2Collector constructor * - * @param[in] id The id the detector shall have - * @param[in] lane The lane the detector is placed at - * @param[in] pos The position on the lane the detector is placed at - * @param[in] length The length the detector has - * @param[in] haltingTimeThreshold Detector parameter: the time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed - * @param[in] haltingSpeedThreshold Detector parameter: the speed a vehicle's speed must be below to be assigned as jammed - * @param[in] jamDistThreshold Detector parameter: the distance between two vehicles in order to not count them to one jam + * @see GUIE2Collector Constructor documentation */ - virtual MSE2Collector* createSingleLaneE2Detector(const std::string& id, - DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length, - SUMOTime haltingTimeThreshold, - SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, const std::string& vTypes); + virtual MSE2Collector* createE2Detector(const std::string& id, + DetectorUsage usage, MSLane* lane, double pos, double endPos, double length, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, + const std::string& vTypes, bool showDetector); - - /** @brief Creates an instance of an e2ol-detector using the given values - * - * Simply calls the GUI_E2_ZS_CollectorOverLanes constructor. After this call, - * the detector must be initialised. - * - * @param[in] id The id the detector shall have - * @param[in] lane The lane the detector is placed at - * @param[in] pos The position on the lane the detector is placed at - * @param[in] length The length the detector has - * @param[in] haltingTimeThreshold Detector parameter: the time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed - * @param[in] haltingSpeedThreshold Detector parameter: the speed a vehicle's speed must be below to be assigned as jammed - * @param[in] jamDistThreshold Detector parameter: the distance between two vehicles in order to not count them to one jam - */ - virtual MSDetectorFileOutput* createMultiLaneE2Detector( - const std::string& id, DetectorUsage usage, MSLane* lane, SUMOReal pos, - SUMOTime haltingTimeThreshold, - SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, const std::string& vTypes); + virtual MSE2Collector* createE2Detector(const std::string& id, + DetectorUsage usage, std::vector lanes, double pos, double endPos, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, + const std::string& vTypes, bool showDetector); /** @brief Creates an instance of an e3 detector using the given values @@ -150,7 +127,7 @@ virtual MSDetectorFileOutput* createE3Detector(const std::string& id, const CrossSectionVector& entries, const CrossSectionVector& exits, - SUMOReal haltingSpeedThreshold, + double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string& vTypes); /// @} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guinetload/GUIEdgeControlBuilder.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guinetload/GUIEdgeControlBuilder.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guinetload/GUIEdgeControlBuilder.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guinetload/GUIEdgeControlBuilder.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIEdgeControlBuilder.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIEdgeControlBuilder.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Derivation of NLEdgeControlBuilder which build gui-edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,10 +42,6 @@ #include "GUIEdgeControlBuilder.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -59,12 +55,12 @@ MSLane* GUIEdgeControlBuilder::addLane(const std::string& id, - SUMOReal maxSpeed, SUMOReal length, + double maxSpeed, double length, const PositionVector& shape, - SUMOReal width, + double width, SVCPermissions permissions, - int index) { - MSLane* lane = new GUILane(id, maxSpeed, length, myActiveEdge, myCurrentNumericalLaneID++, shape, width, permissions, index); + int index, bool isRampAccel) { + MSLane* lane = new GUILane(id, maxSpeed, length, myActiveEdge, myCurrentNumericalLaneID++, shape, width, permissions, index, isRampAccel); myLaneStorage->push_back(lane); return lane; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guinetload/GUIEdgeControlBuilder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guinetload/GUIEdgeControlBuilder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guinetload/GUIEdgeControlBuilder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guinetload/GUIEdgeControlBuilder.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIEdgeControlBuilder.h 20550 2016-04-26 10:57:45Z namdre $ +/// @version $Id: GUIEdgeControlBuilder.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Derivation of NLEdgeControlBuilder which builds gui-edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -82,10 +82,10 @@ * @see MSLane */ virtual MSLane* addLane(const std::string& id, - SUMOReal maxSpeed, SUMOReal length, - const PositionVector& shape, SUMOReal width, + double maxSpeed, double length, + const PositionVector& shape, double width, SVCPermissions permissions, - int index); + int index, bool isRampAccel); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guinetload/GUITriggerBuilder.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guinetload/GUITriggerBuilder.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guinetload/GUITriggerBuilder.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guinetload/GUITriggerBuilder.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 26.04.2004 -/// @version $Id: GUITriggerBuilder.cpp 20975 2016-06-15 13:02:40Z palcraft $ +/// @version $Id: GUITriggerBuilder.cpp 23648 2017-03-24 10:35:01Z laemmel $ /// // Builds trigger objects for guisim /****************************************************************************/ @@ -37,15 +37,12 @@ #include #include #include +#include #include #include #include "GUITriggerBuilder.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -69,7 +66,7 @@ MSTriggeredRerouter* GUITriggerBuilder::buildRerouter(MSNet& net, const std::string& id, MSEdgeVector& edges, - SUMOReal prob, const std::string& file, bool off) { + double prob, const std::string& file, bool off) { GUITriggeredRerouter* rr = new GUITriggeredRerouter(id, edges, prob, file, off, dynamic_cast(net).getVisualisationSpeedUp()); return rr; @@ -77,17 +74,18 @@ void -GUITriggerBuilder::buildStoppingPlace(MSNet& net, const std::string& id, const std::vector& lines, - MSLane* lane, SUMOReal frompos, SUMOReal topos, const SumoXMLTag element) { +GUITriggerBuilder::buildStoppingPlace(MSNet& net, std::string id, std::vector lines, MSLane* lane, + double frompos, double topos, const SumoXMLTag element, std::string name) { bool success = false; GUIGlObject* o = 0; if (element == SUMO_TAG_CONTAINER_STOP) { + //TODO: shall we also allow names for container stops? might make sense [GL March '17] GUIContainerStop* stop = new GUIContainerStop(id, lines, *lane, frompos, topos); success = net.addContainerStop(stop); o = stop; myCurrentStop = stop; } else { - GUIBusStop* stop = new GUIBusStop(id, lines, *lane, frompos, topos); + GUIBusStop* stop = new GUIBusStop(id, lines, *lane, frompos, topos, name); success = net.addBusStop(stop); o = stop; myCurrentStop = stop; @@ -101,8 +99,27 @@ void -GUITriggerBuilder::buildChargingStation(MSNet& net, const std::string& id, MSLane* lane, SUMOReal frompos, SUMOReal topos, - SUMOReal chargingPower, SUMOReal efficiency, bool chargeInTransit, int chargeDelay) { +GUITriggerBuilder::beginParkingArea(MSNet& net, const std::string& id, + const std::vector& lines, + MSLane* lane, + double frompos, double topos, + unsigned int capacity, + double width, double length, double angle) { + assert(myParkingArea == 0); + + GUIParkingArea* stop = new GUIParkingArea(id, lines, *lane, frompos, topos, capacity, width, length, angle); + if (!net.addParkingArea(stop)) { + delete stop; + throw InvalidArgument("Could not build parking area '" + id + "'; probably declared twice."); + } else { + myParkingArea = stop; + } + static_cast(net).getVisualisationSpeedUp().addAdditionalGLObject(stop); +} + +void +GUITriggerBuilder::buildChargingStation(MSNet& net, const std::string& id, MSLane* lane, double frompos, double topos, + double chargingPower, double efficiency, bool chargeInTransit, int chargeDelay) { GUIChargingStation* chargingStation = new GUIChargingStation(id, *lane, frompos, topos, chargingPower, efficiency, chargeInTransit, chargeDelay); if (!net.addChargingStation(chargingStation)) { @@ -115,7 +132,7 @@ MSCalibrator* GUITriggerBuilder::buildCalibrator(MSNet& net, const std::string& id, - MSEdge* edge, SUMOReal pos, + MSEdge* edge, double pos, const std::string& file, const std::string& outfile, const SUMOTime freq, diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guinetload/GUITriggerBuilder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guinetload/GUITriggerBuilder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guinetload/GUITriggerBuilder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guinetload/GUITriggerBuilder.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,7 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Mon, 26.04.2004 -/// @version $Id: GUITriggerBuilder.h 20687 2016-05-10 11:27:00Z behrisch $ +/// @version $Id: GUITriggerBuilder.h 23648 2017-03-24 10:35:01Z laemmel $ /// // Builds trigger objects for guisim /****************************************************************************/ @@ -99,7 +99,7 @@ */ virtual MSTriggeredRerouter* buildRerouter(MSNet& net, const std::string& id, MSEdgeVector& edges, - SUMOReal prob, const std::string& file, bool off); + double prob, const std::string& file, bool off); /** @brief Builds a bus stop @@ -115,9 +115,31 @@ * @param[in] element which kind of stop is to be built * @exception InvalidArgument If the stop can not be added to the net (is duplicate) */ - virtual void buildStoppingPlace(MSNet& net, const std::string& id, - const std::vector& lines, MSLane* lane, - SUMOReal frompos, SUMOReal topos, const SumoXMLTag element); + virtual void buildStoppingPlace(MSNet& net, std::string id, std::vector lines, MSLane* lane, + double frompos, double topos, const SumoXMLTag element, std::string string); + + + /** @brief Builds a parking area + * + * Simply calls the GUIParkingArea constructor. + * + * @param[in] net The net the parking area belongs to + * @param[in] id The id of the parking area + * @param[in] lines Names of the lines that halt on this parking area + * @param[in] lane The lane the parking area is placed on + * @param[in] frompos Begin position of the parking area on the lane + * @param[in] topos End position of the parking area on the lane + * @param[in] capacity Capacity of the parking area + * @param[in] width Width of the default lot rectangle + * @param[in] length Length of the default lot rectangle + * @param[in] angle Angle of the default lot rectangle + * @exception InvalidArgument If the parking area can not be added to the net (is duplicate) + */ + virtual void beginParkingArea(MSNet& net, const std::string& id, + const std::vector& lines, MSLane* lane, + double frompos, double topos, + unsigned int capacity, + double width, double length, double angle); /** @brief Builds a charging station @@ -136,7 +158,7 @@ * @exception InvalidArgument If the charging station can not be added to the net (is duplicate) */ virtual void buildChargingStation(MSNet& net, const std::string& id, MSLane* lane, - SUMOReal frompos, SUMOReal topos, SUMOReal chargingPower, SUMOReal efficiency, + double frompos, double topos, double chargingPower, double efficiency, bool chargeInTransit, int chargeDelay); /** @brief builds a microscopic calibrator @@ -151,7 +173,7 @@ * @todo Is the position correct/needed */ virtual MSCalibrator* buildCalibrator(MSNet& net, - const std::string& id, MSEdge* edge, SUMOReal pos, + const std::string& id, MSEdge* edge, double pos, const std::string& file, const std::string& outfile, const SUMOTime freq, const MSRouteProbe* probe); /// @} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIBaseVehicle.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIBaseVehicle.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIBaseVehicle.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIBaseVehicle.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIBaseVehicle.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUIBaseVehicle.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A MSVehicle extended by some values for usage within the gui /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -63,10 +63,6 @@ #include "GUIEdge.h" #include "GUILane.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping @@ -139,6 +135,13 @@ double vehiclePoly_Emergency[] = { .1, .1, -.1, .1, -.1, -.1, .1, -.1, -10000 }; double vehiclePoly_Emergency2[] = { .04, .3, -.04, .3, -.04, -.3, .04, -.3, -10000 }; +double vehiclePoly_EmergencyLadder[] = { -.5, .3, .5, .3, .5, .2, -.5, .2, -10000 }; +double vehiclePoly_EmergencyLadder2[] = { -.5, -.3, .5, -.3, .5, -.2, -.5, -.2, -10000 }; +double vehiclePoly_EmergencyLadder3[] = { -.45, .3, -.4, .3, -.4, -.3, -.45, -.3, -10000 }; +double vehiclePoly_EmergencyLadder4[] = { .45, .3, .4, .3, .4, -.3, .45, -.3, -10000 }; +double vehiclePoly_EmergencyLadder5[] = { .05, .3, .0, .3, .0, -.3, .05, -.3, -10000 }; +double vehiclePoly_EmergencyLadder6[] = { -.25, .3, -.2, .3, -.2, -.3, -.25, -.3, -10000 }; +double vehiclePoly_EmergencyLadder7[] = { .25, .3, .2, .3, .2, -.3, .25, -.3, -10000 }; // =========================================================================== // method definitions // =========================================================================== @@ -209,9 +212,8 @@ long GUIBaseVehicle::GUIBaseVehiclePopupMenu::onCmdStartTrack(FXObject*, FXSelector, void*) { assert(myObject->getType() == GLO_VEHICLE); - if (!static_cast(myObject)->hasActiveAddVisualisation(myParent, VO_TRACKED)) { + if (myParent->getTrackedID() != static_cast(myObject)->getGlID()) { myParent->startTrack(static_cast(myObject)->getGlID()); - static_cast(myObject)->addActiveAddVisualisation(myParent, VO_TRACKED); } return 1; } @@ -219,7 +221,6 @@ long GUIBaseVehicle::GUIBaseVehiclePopupMenu::onCmdStopTrack(FXObject*, FXSelector, void*) { assert(myObject->getType() == GLO_VEHICLE); - static_cast(myObject)->removeActiveAddVisualisation(myParent, VO_TRACKED); myParent->stopTrack(); return 1; } @@ -256,8 +257,7 @@ GUIBaseVehicle::GUIBaseVehicle(MSBaseVehicle& vehicle) : GUIGlObject(GLO_VEHICLE, vehicle.getID()), - myVehicle(vehicle), - myVType(vehicle.getVehicleType()) { + myVehicle(vehicle) { // as it is possible to show all vehicle routes, we have to store them... (bug [ 2519761 ]) myRoutes = MSDevice_Vehroutes::buildVehicleDevices(myVehicle, myVehicle.myDevices, 5); myVehicle.myMoveReminders.push_back(std::make_pair(myRoutes, 0.)); @@ -268,10 +268,13 @@ GUIBaseVehicle::~GUIBaseVehicle() { myLock.lock(); for (std::map::iterator i = myAdditionalVisualizations.begin(); i != myAdditionalVisualizations.end(); ++i) { + if (i->first->getTrackedID() == getGlID()) { + i->first->stopTrack(); + } while (i->first->removeAdditionalGLVisualisation(this)); } myLock.unlock(); - GLObjectValuePassConnector::removeObject(*this); + GLObjectValuePassConnector::removeObject(*this); delete myRoutes; } @@ -334,7 +337,7 @@ void GUIBaseVehicle::drawAction_drawVehicleAsBoxPlus() const { glPushMatrix(); - glScaled(myVType.getWidth(), myVType.getLength(), 1.); + glScaled(getVType().getWidth(), getVType().getLength(), 1.); glBegin(GL_TRIANGLE_STRIP); glVertex2d(0., 0.); glVertex2d(-.5, .15); @@ -348,13 +351,13 @@ void GUIBaseVehicle::drawAction_drawVehicleAsTrianglePlus() const { - const SUMOReal length = myVType.getLength(); + const double length = getVType().getLength(); if (length >= 8.) { drawAction_drawVehicleAsBoxPlus(); return; } glPushMatrix(); - glScaled(myVType.getWidth(), length, 1.); + glScaled(getVType().getWidth(), length, 1.); glBegin(GL_TRIANGLES); glVertex2d(0., 0.); glVertex2d(-.5, 1.); @@ -365,7 +368,7 @@ void -GUIBaseVehicle::drawPoly(double* poses, SUMOReal offset) { +GUIBaseVehicle::drawPoly(double* poses, double offset) { glPushMatrix(); glTranslated(0, 0, offset * .1); glPolygonOffset(0, (GLfloat) - offset); @@ -386,12 +389,12 @@ RGBColor lighter = current.changedBrightness(51); RGBColor darker = current.changedBrightness(-51); - const SUMOReal length = myVType.getLength(); - const SUMOReal width = myVType.getWidth(); + const double length = getVType().getLength(); + const double width = getVType().getWidth(); glPushMatrix(); glRotated(90, 0, 0, 1); glScaled(length, width, 1.); - SUMOVehicleShape shape = myVType.getGuiShape(); + SUMOVehicleShape shape = getVType().getGuiShape(); // draw main body switch (shape) { @@ -482,7 +485,7 @@ case SVS_BUS: case SVS_BUS_COACH: case SVS_BUS_TROLLEY: { - SUMOReal ml = length; + double ml = length; glScaled(1. / (length), 1, 1.); glTranslated(0, 0, .04); glBegin(GL_TRIANGLE_FAN); @@ -617,6 +620,43 @@ drawPoly(vehiclePoly_Emergency, 5); drawPoly(vehiclePoly_Emergency2, 5); break; + case SVS_FIREBRIGADE: // similar to delivery in red orange + glColor3d(1, 0, 0); + drawPoly(vehiclePoly_PassengerVanBody, 4); + glColor3d(1, .5, 0); + drawPoly(vehiclePoly_PassengerVanBodyFront, 4.5); + glColor3d(0, 0, 0); + drawPoly(vehiclePoly_PassengerVanFrontGlass, 4.5); + drawPoly(vehiclePoly_DeliveryMediumRightGlass, 4.5); + drawPoly(vehiclePoly_DeliveryMediumLeftGlass, 4.5); + // draw ladder + glTranslated(0.7, 0, 0); + glColor3d(1, .5, 0); + drawPoly(vehiclePoly_EmergencySign, 4.5); + glColor3d(.5, .5, .5); + drawPoly(vehiclePoly_EmergencyLadder, 5); + drawPoly(vehiclePoly_EmergencyLadder2, 5); + drawPoly(vehiclePoly_EmergencyLadder3, 5); + drawPoly(vehiclePoly_EmergencyLadder4, 5); + drawPoly(vehiclePoly_EmergencyLadder5, 5); + drawPoly(vehiclePoly_EmergencyLadder6, 5); + drawPoly(vehiclePoly_EmergencyLadder7, 5); + break; + case SVS_POLICE: // similar to passenger grey with blue + glColor3d(.5, .5, .5); + drawPoly(vehiclePoly_PassengerCarBody, 4); + glColor3d(0, 0, 1); + drawPoly(vehiclePoly_PassengerCarBodyFront, 4.5); + glColor3d(0, 0, 0); + drawPoly(vehiclePoly_PassengerFrontGlass, 4.5); + // first aid sign + glTranslated(0.7, 0, 0); + glColor3d(0, 0, 1); + drawPoly(vehiclePoly_EmergencySign, 4.5); + glColor3d(.5, .5, .5); + drawPoly(vehiclePoly_Emergency, 5); + drawPoly(vehiclePoly_Emergency2, 5); + break; default: // same as passenger drawPoly(vehiclePoly_PassengerCarBody, 4); glColor3d(1, 1, 1); @@ -692,7 +732,7 @@ break; case SVS_TRUCK_1TRAILER: { GLHelper::setColor(current); - SUMOReal l = length - 2.3; + double l = length - 2.3; l = l / 2.; GLHelper::drawBoxLine(Position(2.3, 0), 90., l, .5); GLHelper::drawBoxLine(Position(2.3 + l + .5, 0), 90., l - .5, .5); @@ -721,6 +761,8 @@ case SVS_ANT: case SVS_SHIP: case SVS_EMERGENCY: + case SVS_FIREBRIGADE: + case SVS_POLICE: break; default: // same as passenger/sedan drawPoly(vehiclePoly_PassengerSedanRightGlass, 4.5); @@ -802,16 +844,16 @@ bool -GUIBaseVehicle::drawAction_drawVehicleAsImage(const GUIVisualizationSettings& s, SUMOReal length) const { - const std::string& file = myVType.getImgFile(); +GUIBaseVehicle::drawAction_drawVehicleAsImage(const GUIVisualizationSettings& s, double length) const { + const std::string& file = getVType().getImgFile(); if (file != "") { int textureID = GUITexturesHelper::getTextureID(file); if (textureID > 0) { - const SUMOReal exaggeration = s.vehicleSize.getExaggeration(s); + const double exaggeration = s.vehicleSize.getExaggeration(s); if (length < 0) { - length = myVType.getLength() * exaggeration; + length = getVType().getLength() * exaggeration; } - const SUMOReal halfWidth = myVType.getWidth() / 2.0 * exaggeration; + const double halfWidth = getVType().getWidth() / 2.0 * exaggeration; GUITexturesHelper::drawTexturedBox(textureID, -halfWidth, 0, halfWidth, length); return true; } @@ -821,14 +863,14 @@ void -GUIBaseVehicle::drawOnPos(const GUIVisualizationSettings& s, const Position& pos, const SUMOReal angle) const { +GUIBaseVehicle::drawOnPos(const GUIVisualizationSettings& s, const Position& pos, const double angle) const { glPushName(getGlID()); glPushMatrix(); Position p1 = pos; - const SUMOReal degAngle = RAD2DEG(angle + PI / 2.); + const double degAngle = RAD2DEG(angle + PI / 2.); // one seat in the center of the vehicle by default if (myVehicle.getLane() != 0) { - mySeatPositions[0] = myVehicle.getLane()->geometryPositionAtOffset(myVehicle.getPositionOnLane() - myVType.getLength() / 2); + mySeatPositions[0] = myVehicle.getLane()->geometryPositionAtOffset(myVehicle.getPositionOnLane() - getVType().getLength() / 2); } else { mySeatPositions[0] = p1; } @@ -837,7 +879,7 @@ // set lane color setColor(s); // scale - const SUMOReal upscale = s.vehicleSize.getExaggeration(s); + const double upscale = s.vehicleSize.getExaggeration(s); glScaled(upscale, upscale, 1); /* MSLCM_DK2004 &m2 = static_cast(veh->getLaneChangeModel()); @@ -850,7 +892,7 @@ } */ // draw the vehicle - myCarriageLength = myVType.getLength(); + myCarriageLength = getVType().getLength(); switch (s.vehicleQuality) { case 0: drawAction_drawVehicleAsTrianglePlus(); @@ -861,7 +903,7 @@ case 2: drawAction_drawVehicleAsPoly(s); // draw flashing blue light for emergency vehicles - if (myVType.getGuiShape() == SVS_EMERGENCY) { + if (getVType().getGuiShape() == SVS_EMERGENCY) { glTranslated(0, 0, .1); drawAction_drawVehicleBlueLight(); } @@ -870,7 +912,7 @@ default: // draw as image but take special care for drawing trains // fallback to simple shapes - if (!drawAction_drawCarriageClass(s, myVType.getGuiShape(), true)) { + if (!drawAction_drawCarriageClass(s, getVType().getGuiShape(), true)) { if (!drawAction_drawVehicleAsImage(s)) { drawAction_drawVehicleAsPoly(s); }; @@ -878,7 +920,7 @@ break; } if (s.drawMinGap) { - const SUMOReal minGap = -myVType.getMinGap(); + const double minGap = -getVType().getMinGap(); glColor3d(0., 1., 0.); glBegin(GL_LINES); glVertex2d(0., 0); @@ -895,7 +937,7 @@ // draw the blinker and brakelights if wished if (s.showBlinker) { glTranslated(0, 0, .1); - switch (myVType.getGuiShape()) { + switch (getVType().getGuiShape()) { case SVS_PEDESTRIAN: case SVS_BICYCLE: case SVS_ANT: @@ -944,10 +986,10 @@ /* if (true) { const MSLane &l = veh->getLane(); - SUMOReal r1 = veh->allowedContinuationsLength(&l, 0); - SUMOReal r2 = l.getLeftLane()!=0 ? veh->allowedContinuationsLength(l.getLeftLane(), 0) : 0; - SUMOReal r3 = l.getRightLane()!=0 ? veh->allowedContinuationsLength(l.getRightLane(), 0) : 0; - SUMOReal mmax = MAX3(r1, r2, r3); + double r1 = veh->allowedContinuationsLength(&l, 0); + double r2 = l.getLeftLane()!=0 ? veh->allowedContinuationsLength(l.getLeftLane(), 0) : 0; + double r3 = l.getRightLane()!=0 ? veh->allowedContinuationsLength(l.getRightLane(), 0) : 0; + double mmax = MAX3(r1, r2, r3); glBegin(GL_LINES); glVertex2f(0, 0); glVertex2f(0, r1/mmax/2.); @@ -962,11 +1004,11 @@ glEnd(); } */ - glTranslated(0, MIN2(myVType.getLength() / 2, SUMOReal(5)), -getType()); // drawing name at GLO_MAX fails unless translating z + glTranslated(0, MIN2(getVType().getLength() / 2, double(5)), -getType()); // drawing name at GLO_MAX fails unless translating z glRotated(-degAngle, 0, 0, 1); glScaled(1 / upscale, 1 / upscale, 1); drawName(Position(0, 0), s.scale, - myVType.getGuiShape() == SVS_PEDESTRIAN ? s.personName : s.vehicleName); + getVType().getGuiShape() == SVS_PEDESTRIAN ? s.personName : s.vehicleName); if (s.vehicleName.show && myVehicle.getParameter().line != "") { glTranslated(0, 0.6 * s.vehicleName.size / s.scale, 0); GLHelper::drawText("line:" + myVehicle.getParameter().line, Position(0, 0), @@ -1002,7 +1044,7 @@ if (myVehicle.getNumberReroutes() > 0) { const int noReroutePlus1 = myVehicle.getNumberReroutes() + 1; for (int i = noReroutePlus1 - 1; i >= 0; i--) { - SUMOReal darken = SUMOReal(0.4) / SUMOReal(noReroutePlus1) * SUMOReal(i); + double darken = double(0.4) / double(noReroutePlus1) * double(i); drawRoute(s, i, darken); } } else { @@ -1018,7 +1060,7 @@ void -GUIBaseVehicle::drawLinkItem(const Position& pos, SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal exagerate) { +GUIBaseVehicle::drawLinkItem(const Position& pos, SUMOTime arrivalTime, SUMOTime leaveTime, double exagerate) { glTranslated(pos.x(), pos.y(), -.1); GLHelper::drawFilledCircle(1); std::string times = toString(STEPS2TIME(arrivalTime)) + "/" + toString(STEPS2TIME(leaveTime)); @@ -1079,8 +1121,8 @@ Position p = veh->getRoute().getEdges()[0]->getLanes()[0]->getShape()[0]; const Boundary& b = ((GUINet*) MSNet::getInstance())->getBoundary(); Position center = b.getCenter(); - SUMOReal hue = 180. + atan2(center.x() - p.x(), center.y() - p.y()) * 180. / PI; - SUMOReal sat = p.distanceTo(center) / center.distanceTo(Position(b.xmin(), b.ymin())); + double hue = 180. + atan2(center.x() - p.x(), center.y() - p.y()) * 180. / PI; + double sat = p.distanceTo(center) / center.distanceTo(Position(b.xmin(), b.ymin())); GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.)); return true; } @@ -1088,8 +1130,8 @@ Position p = veh->getRoute().getEdges().back()->getLanes()[0]->getShape()[-1]; const Boundary& b = ((GUINet*) MSNet::getInstance())->getBoundary(); Position center = b.getCenter(); - SUMOReal hue = 180. + atan2(center.x() - p.x(), center.y() - p.y()) * 180. / PI; - SUMOReal sat = p.distanceTo(center) / center.distanceTo(Position(b.xmin(), b.ymin())); + double hue = 180. + atan2(center.x() - p.x(), center.y() - p.y()) * 180. / PI; + double sat = p.distanceTo(center) / center.distanceTo(Position(b.xmin(), b.ymin())); GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.)); return true; } @@ -1097,16 +1139,16 @@ Position pb = veh->getRoute().getEdges()[0]->getLanes()[0]->getShape()[0]; Position pe = veh->getRoute().getEdges().back()->getLanes()[0]->getShape()[-1]; const Boundary& b = ((GUINet*) MSNet::getInstance())->getBoundary(); - SUMOReal hue = 180. + atan2(pb.x() - pe.x(), pb.y() - pe.y()) * 180. / PI; + double hue = 180. + atan2(pb.x() - pe.x(), pb.y() - pe.y()) * 180. / PI; Position minp(b.xmin(), b.ymin()); Position maxp(b.xmax(), b.ymax()); - SUMOReal sat = pb.distanceTo(pe) / minp.distanceTo(maxp); + double sat = pb.distanceTo(pe) / minp.distanceTo(maxp); GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.)); return true; } - case 27: { // color randomly (by pointer) - const SUMOReal hue = (long)veh % 360; // [0-360] - const SUMOReal sat = (((long)veh / 360) % 67) / 100.0 + 0.33; // [0.33-1] + case 28: { // color randomly (by pointer) + const double hue = (long)veh % 360; // [0-360] + const double sat = (((long)veh / 360) % 67) / 100.0 + 0.33; // [0.33-1] GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.)); return true; } @@ -1140,7 +1182,7 @@ void -GUIBaseVehicle::drawRoute(const GUIVisualizationSettings& s, int routeNo, SUMOReal darken) const { +GUIBaseVehicle::drawRoute(const GUIVisualizationSettings& s, int routeNo, double darken) const { setColor(s); GLdouble colors[4]; glGetDoublev(GL_CURRENT_COLOR, colors); @@ -1161,7 +1203,7 @@ colors[3] = 0; } glColor3dv(colors); - const SUMOReal exaggeration = s.vehicleSize.getExaggeration(s); + const double exaggeration = s.vehicleSize.getExaggeration(s); if (routeNo == 0) { drawRouteHelper(myVehicle.getRoute(), exaggeration); return; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIBaseVehicle.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIBaseVehicle.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIBaseVehicle.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIBaseVehicle.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIBaseVehicle.h 21505 2016-09-19 14:37:59Z namdre $ +/// @version $Id: GUIBaseVehicle.h 23275 2017-03-08 15:30:30Z behrisch $ /// // A MSVehicle extended by some values for usage within the gui /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -82,20 +82,20 @@ * @return The current position (in cartesian coordinates) * @see myLane */ - virtual Position getPosition(const SUMOReal offset = 0) const = 0; + virtual Position getPosition(const double offset = 0) const = 0; /** @brief Returns the vehicle's direction in radians * @return The vehicle's current angle */ - virtual SUMOReal getAngle() const = 0; + virtual double getAngle() const = 0; /// @brief return the current angle in navigational degrees - SUMOReal getNaviDegree() const { + double getNaviDegree() const { return GeomHelper::naviDegree(getAngle()); } /// @brief gets the color value according to the current scheme index - virtual SUMOReal getColorValue(int activeScheme) const = 0; + virtual double getColorValue(int activeScheme) const = 0; /// @brief draws the given guiShape if it has distinc carriages/modules and eturns true if so virtual bool drawAction_drawCarriageClass(const GUIVisualizationSettings& s, SUMOVehicleShape guiShape, bool asImage) const = 0; @@ -104,12 +104,12 @@ * @see MSVehicle::myLastLaneChangeOffset * @return The time since the last lane change in seconds */ - virtual SUMOReal getLastLaneChangeOffset() const = 0; + virtual double getLastLaneChangeOffset() const = 0; /** @brief Draws the route * @param[in] r The route to draw */ - virtual void drawRouteHelper(const MSRoute& r, SUMOReal exaggeration) const = 0; + virtual void drawRouteHelper(const MSRoute& r, double exaggeration) const = 0; /// @brief retrieve information about the current stop state virtual std::string getStopInfo() const = 0; @@ -134,8 +134,8 @@ */ virtual GUIParameterTableWindow* getTypeParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) = 0; - virtual void drawAction_drawVehicleBlinker(SUMOReal /*length*/) const {} - virtual void drawAction_drawVehicleBrakeLight(SUMOReal length, bool onlyOne = false) const { + virtual void drawAction_drawVehicleBlinker(double /*length*/) const {} + virtual void drawAction_drawVehicleBrakeLight(double length, bool onlyOne = false) const { UNUSED_PARAMETER(length); UNUSED_PARAMETER(onlyOne); } @@ -175,7 +175,7 @@ * @param[in] pos The position to draw the vehicle on * @param[in] angle The drawing angle of the vehicle */ - void drawOnPos(const GUIVisualizationSettings& s, const Position& pos, const SUMOReal angle) const; + void drawOnPos(const GUIVisualizationSettings& s, const Position& pos, const double angle) const; /** @brief Draws the object @@ -292,12 +292,10 @@ VO_SHOW_ROUTE = 2, /// @brief show all vehicle's routes VO_SHOW_ALL_ROUTES = 4, - /// @brief track vehicle - VO_TRACKED = 8, /// @brief LFLinkItems - VO_SHOW_LFLINKITEMS = 16, + VO_SHOW_LFLINKITEMS = 8, /// @brief draw vehicle outside the road network - VO_DRAW_OUTSIDE_NETWORK = 32 + VO_DRAW_OUTSIDE_NETWORK = 16 }; /// @brief Enabled visualisations, per view @@ -309,7 +307,7 @@ * @param[in] routeNo The route to show (0: the current, >0: prior) * @param[in] darken The amount to darken the route by */ - void drawRoute(const GUIVisualizationSettings& s, int routeNo, SUMOReal darken) const; + void drawRoute(const GUIVisualizationSettings& s, int routeNo, double darken) const; /// @} @@ -323,7 +321,7 @@ /// @name drawing helper methods /// @{ - static void drawPoly(double* poses, SUMOReal offset); + static void drawPoly(double* poses, double offset); void drawAction_drawVehicleAsBoxPlus() const; void drawAction_drawVehicleAsTrianglePlus() const; @@ -333,20 +331,26 @@ * @param[in] length The custom length of the vehicle * (defaults to the * length specified in the vehicle type if -1 is passed) */ - bool drawAction_drawVehicleAsImage(const GUIVisualizationSettings& s, SUMOReal length = -1) const; + bool drawAction_drawVehicleAsImage(const GUIVisualizationSettings& s, double length = -1) const; /// @} /// @brief returns the seat position for the person with the given index const Position& getSeatPosition(int personIndex) const; - static void drawLinkItem(const Position& pos, SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal exagerate); + static void drawLinkItem(const Position& pos, SUMOTime arrivalTime, SUMOTime leaveTime, double exagerate); + + /// @brief A shortcut to myVehicle.myType + inline const MSVehicleType& getVType() const { + return myVehicle.getVehicleType(); + } + protected: /// The mutex used to avoid concurrent updates of the vehicle buffer mutable MFXMutex myLock; /// Variable to set with the length of the last drawn carriage or the vehicle length - mutable SUMOReal myCarriageLength; + mutable double myCarriageLength; /// @brief positions of seats in the vehicle (updated at every drawing step) mutable PositionVector mySeatPositions; @@ -355,9 +359,6 @@ /// @brief The vehicle to which all calls should be delegated MSBaseVehicle& myVehicle; - /// @brief A shortcut to myVehicle.myType - const MSVehicleType& myVType; - MSDevice_Vehroutes* myRoutes; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIBusStop.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIBusStop.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIBusStop.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIBusStop.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Wed, 07.12.2005 -/// @version $Id: GUIBusStop.cpp 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: GUIBusStop.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A lane area vehicles can halt at (gui-version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,19 +55,16 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS // =========================================================================== // method definitions // =========================================================================== GUIBusStop::GUIBusStop(const std::string& id, const std::vector& lines, MSLane& lane, - SUMOReal frompos, SUMOReal topos) : - MSStoppingPlace(id, lines, lane, frompos, topos), + double frompos, double topos, const std::string name) : + MSStoppingPlace(id, lines, lane, frompos, topos, name), GUIGlObject_AbstractAdd("busStop", GLO_TRIGGER, id) { - const SUMOReal offsetSign = MSNet::getInstance()->lefthand() ? -1 : 1; + const double offsetSign = MSNet::getInstance()->lefthand() ? -1 : 1; myFGShape = lane.getShape(); myFGShape.move2side(1.65 * offsetSign); myFGShape = myFGShape.getSubpart(frompos, topos); @@ -78,14 +75,14 @@ const Position& f = myFGShape[i]; const Position& s = myFGShape[i + 1]; myFGShapeLengths.push_back(f.distanceTo(s)); - myFGShapeRotations.push_back((SUMOReal) atan2((s.x() - f.x()), (f.y() - s.y())) * (SUMOReal) 180.0 / (SUMOReal) PI); + myFGShapeRotations.push_back((double) atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double) PI); } PositionVector tmp = myFGShape; tmp.move2side(1.5 * offsetSign); myFGSignPos = tmp.getLineCenter(); myFGSignRot = 0; if (tmp.length() != 0) { - myFGSignRot = myFGShape.rotationDegreeAtOffset(SUMOReal((myFGShape.length() / 2.))); + myFGSignRot = myFGShape.rotationDegreeAtOffset(double((myFGShape.length() / 2.))); myFGSignRot -= 90; } } @@ -95,7 +92,7 @@ void -GUIBusStop::addAccess(MSLane* lane, const SUMOReal pos) { +GUIBusStop::addAccess(MSLane* lane, const double pos) { MSStoppingPlace::addAccess(lane, pos); myAccessCoords.push_back(lane->getShape().positionAtOffset(pos)); } @@ -136,15 +133,16 @@ glPushMatrix(); RGBColor green(76, 170, 50, 255); RGBColor yellow(255, 235, 0, 255); + RGBColor black(0, 0, 0); // draw the area glTranslated(0, 0, getType()); GLHelper::setColor(green); - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); GLHelper::drawBoxLines(myFGShape, myFGShapeRotations, myFGShapeLengths, exaggeration); // draw details unless zoomed out to far if (s.scale * exaggeration >= 10) { // draw the lines - const SUMOReal rotSign = MSNet::getInstance()->lefthand() ? -1 : 1; + const double rotSign = MSNet::getInstance()->lefthand() ? -1 : 1; for (int i = 0; i != (int)myLines.size(); ++i) { glPushMatrix(); glTranslated(myFGSignPos.x(), myFGSignPos.y(), 0); @@ -167,13 +165,19 @@ noPoints = MIN2((int)(9.0 + (s.scale * exaggeration) / 10.0), 36); } glScaled(exaggeration, exaggeration, 1); - GLHelper::drawFilledCircle((SUMOReal) 1.1, noPoints); + GLHelper::drawFilledCircle((double) 1.1, noPoints); glTranslated(0, 0, .1); GLHelper::setColor(yellow); - GLHelper::drawFilledCircle((SUMOReal) 0.9, noPoints); + GLHelper::drawFilledCircle((double) 0.9, noPoints); if (s.scale * exaggeration >= 4.5) { GLHelper::drawText("H", Position(), .1, 1.6, green, myFGSignRot); } + //TODO: add pt stop show name options to gui settings [GL Mar '17] + if (s.streetName.show && s.scale * exaggeration >= 4.5) { + glTranslated(0, -3.1, 0); + GLHelper::drawText(getMyName(), Position(), .1, 3, black, myFGSignRot); + } + } glPopMatrix(); glPopName(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIBusStop.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIBusStop.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIBusStop.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIBusStop.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Wed, 07.12.2005 -/// @version $Id: GUIBusStop.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIBusStop.h 23648 2017-03-24 10:35:01Z laemmel $ /// // A lane area vehicles can halt at (gui-version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -80,7 +80,7 @@ */ GUIBusStop(const std::string& id, const std::vector& lines, MSLane& lane, - SUMOReal frompos, SUMOReal topos); + double frompos, double topos, const std::string name); /// @brief Destructor @@ -88,7 +88,7 @@ /// @brief adds an access point to this stop - void addAccess(MSLane* lane, const SUMOReal pos); + void addAccess(MSLane* lane, const double pos); /// @name inherited from GUIGlObject //@{ @@ -135,10 +135,10 @@ private: /// @brief The rotations of the shape parts - std::vector myFGShapeRotations; + std::vector myFGShapeRotations; /// @brief The lengths of the shape parts - std::vector myFGShapeLengths; + std::vector myFGShapeLengths; /// @brief The shape PositionVector myFGShape; @@ -147,7 +147,7 @@ Position myFGSignPos; /// @brief The rotation of the sign - SUMOReal myFGSignRot; + double myFGSignRot; /// @brief The coordinates of access points PositionVector myAccessCoords; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUICalibrator.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUICalibrator.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUICalibrator.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUICalibrator.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 26.04.2004 -/// @version $Id: GUICalibrator.cpp 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: GUICalibrator.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Changes flow and speed on a set of lanes (gui version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -53,10 +53,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping @@ -186,7 +182,7 @@ long GUICalibrator::GUIManip_Calibrator::onCmdUserDef(FXObject*, FXSelector, void*) { - //mySpeed = (SUMOReal)(myUserDefinedSpeed->getValue() / 3.6); + //mySpeed = (double)(myUserDefinedSpeed->getValue() / 3.6); //static_cast(myObject)->setOverridingValue(mySpeed); //myParent->updateChildren(); return 1; @@ -205,7 +201,7 @@ long GUICalibrator::GUIManip_Calibrator::onCmdPreDef(FXObject*, FXSelector, void*) { - //mySpeed = (SUMOReal)(SUMOReal)((myPredefinedValues->getCurrentItem() * 20 + 20) / 3.6); + //mySpeed = (double)(double)((myPredefinedValues->getCurrentItem() * 20 + 20) / 3.6); //static_cast(myObject)->setOverridingValue(mySpeed); //myParent->updateChildren(); return 1; @@ -227,16 +223,16 @@ //static_cast(myObject)->setOverriding(true); //switch (myChosenValue) { // case 0: - // mySpeed = (SUMOReal) static_cast(myObject)->getDefaultSpeed(); + // mySpeed = (double) static_cast(myObject)->getDefaultSpeed(); // break; // case 1: - // mySpeed = (SUMOReal) static_cast(myObject)->getLoadedSpeed(); + // mySpeed = (double) static_cast(myObject)->getLoadedSpeed(); // break; // case 2: - // mySpeed = (SUMOReal)((myPredefinedValues->getCurrentItem() * 20 + 20) / 3.6); + // mySpeed = (double)((myPredefinedValues->getCurrentItem() * 20 + 20) / 3.6); // break; // case 3: - // mySpeed = (SUMOReal)(myUserDefinedSpeed->getValue() / 3.6); + // mySpeed = (double)(myUserDefinedSpeed->getValue() / 3.6); // break; // default: // // hmmm, should not happen @@ -279,7 +275,7 @@ * GUICalibrator - methods * ----------------------------------------------------------------------- */ GUICalibrator::GUICalibrator(const std::string& id, - MSEdge* edge, SUMOReal pos, + MSEdge* edge, double pos, const std::string& aXMLFilename, const std::string& outputFilename, const SUMOTime freq, @@ -361,10 +357,10 @@ flow = toString((int)myCurrentStateInterval->q) + "v/h"; } } - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); for (int i = 0; i < (int)myFGPositions.size(); ++i) { const Position& pos = myFGPositions[i]; - SUMOReal rot = myFGRotations[i]; + double rot = myFGRotations[i]; glPushMatrix(); glTranslated(pos.x(), pos.y(), getType()); glRotated(rot, 0, 0, 1); @@ -389,7 +385,7 @@ glColor3d(0, 0, 0); pfSetPosition(0, 0); pfSetScale(3.f); - SUMOReal w = pfdkGetStringWidth("C"); + double w = pfdkGetStringWidth("C"); glRotated(180, 0, 1, 0); glTranslated(-w / 2., 2, 0); pfDrawString("C"); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUICalibrator.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUICalibrator.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUICalibrator.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUICalibrator.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 26.04.2004 -/// @version $Id: GUICalibrator.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUICalibrator.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Changes flow and speed on a set of lanes (gui version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -59,7 +59,7 @@ * @param[in] file Name of the file to read the speeds to set from */ GUICalibrator(const std::string& id, - MSEdge* edge, SUMOReal pos, + MSEdge* edge, double pos, const std::string& aXMLFilename, const std::string& outputFilename, const SUMOTime freq, @@ -167,7 +167,7 @@ FXDataTarget myChosenTarget; - SUMOReal mySpeed; + double mySpeed; FXDataTarget mySpeedTarget; @@ -187,7 +187,7 @@ typedef std::vector PosCont; /// Definition of a rotation container - typedef std::vector RotCont; + typedef std::vector RotCont; private: /// The positions in full-geometry mode diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIChargingStation.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIChargingStation.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIChargingStation.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIChargingStation.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Tamas Kurczveil /// @author Pablo Alvarez Lopez /// @date 20-12-13 -/// @version $Id: GUIChargingStation.cpp 21160 2016-07-14 08:03:04Z behrisch $ +/// @version $Id: GUIChargingStation.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A lane area vehicles can halt at (gui-version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -56,15 +56,11 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== -GUIChargingStation::GUIChargingStation(const std::string& id, MSLane& lane, SUMOReal frompos, SUMOReal topos, SUMOReal chargingPower, SUMOReal efficiency, bool chargeInTransit, int chargeDelay) : +GUIChargingStation::GUIChargingStation(const std::string& id, MSLane& lane, double frompos, double topos, double chargingPower, double efficiency, bool chargeInTransit, int chargeDelay) : MSChargingStation(id, lane, frompos, topos, chargingPower, efficiency, chargeInTransit, chargeDelay), GUIGlObject_AbstractAdd("chargingStation", GLO_TRIGGER, id) { myFGShape = lane.getShape(); @@ -76,14 +72,14 @@ const Position& f = myFGShape[i]; const Position& s = myFGShape[i + 1]; myFGShapeLengths.push_back(f.distanceTo(s)); - myFGShapeRotations.push_back((SUMOReal) atan2((s.x() - f.x()), (f.y() - s.y())) * (SUMOReal) 180.0 / (SUMOReal) PI); + myFGShapeRotations.push_back((double) atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double) PI); } PositionVector tmp = myFGShape; tmp.move2side(1.5); myFGSignPos = tmp.getLineCenter(); myFGSignRot = 0; if (tmp.length() != 0) { - myFGSignRot = myFGShape.rotationDegreeAtOffset(SUMOReal((myFGShape.length() / 2.))); + myFGSignRot = myFGShape.rotationDegreeAtOffset(double((myFGShape.length() / 2.))); myFGSignRot -= 90; } } @@ -150,7 +146,7 @@ } else { GLHelper::setColor(blue); } - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); GLHelper::drawBoxLines(myFGShape, myFGShapeRotations, myFGShapeLengths, exaggeration); // draw details unless zoomed out to far @@ -194,11 +190,11 @@ } glScaled(exaggeration, exaggeration, 1); - GLHelper::drawFilledCircle((SUMOReal) 1.1, noPoints); + GLHelper::drawFilledCircle((double) 1.1, noPoints); glTranslated(0, 0, .1); GLHelper::setColor(yellow); - GLHelper::drawFilledCircle((SUMOReal) 0.9, noPoints); + GLHelper::drawFilledCircle((double) 0.9, noPoints); if (s.scale * exaggeration >= 4.5) { GLHelper::drawText("C", Position(), .1, 1.6, blue, myFGSignRot); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIChargingStation.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIChargingStation.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIChargingStation.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIChargingStation.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Tamas Kurczveil /// @author Pablo Alvarez Lopez /// @date 20-12-13 -/// @version $Id: GUIChargingStation.h 21014 2016-06-21 09:02:22Z behrisch $ +/// @version $Id: GUIChargingStation.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A lane area vehicles can halt at (gui-version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -83,8 +83,8 @@ * @param[in] chargeInTransit enable or disable charge in transit * @param[in] chargeDelay delay in the charge */ - GUIChargingStation(const std::string& id, MSLane& lane, SUMOReal frompos, SUMOReal topos, - SUMOReal chargingPower, SUMOReal efficiency, bool chargeInTransit, int chargeDelay); + GUIChargingStation(const std::string& id, MSLane& lane, double frompos, double topos, + double chargingPower, double efficiency, bool chargeInTransit, int chargeDelay); /// @brief Destructor ~GUIChargingStation(); @@ -128,10 +128,10 @@ private: /// @brief The rotations of the shape parts - std::vector myFGShapeRotations; + std::vector myFGShapeRotations; /// @brief The lengths of the shape parts - std::vector myFGShapeLengths; + std::vector myFGShapeLengths; /// @brief The shape PositionVector myFGShape; @@ -140,7 +140,7 @@ Position myFGSignPos; /// @brief The rotation of the sign - SUMOReal myFGSignRot; + double myFGSignRot; }; #endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIContainer.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIContainer.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIContainer.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIContainer.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Melanie Weber /// @author Andreas Kendziorra /// @date Wed, 01.08.2014 -/// @version $Id: GUIContainer.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: GUIContainer.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A MSContainer extended by some values for usage within the gui /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -59,10 +59,6 @@ #include "GUIEdge.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - //#define GUIContainer_DEBUG_DRAW_WALKING_AREA_SHAPE // =========================================================================== @@ -144,10 +140,10 @@ ret->mkItem("start edge [id]", false, getFromEdge()->getID()); ret->mkItem("dest edge [id]", false, getDestination().getID()); ret->mkItem("edge [id]", false, getEdge()->getID()); - ret->mkItem("position [m]", true, new FunctionBinding(this, &GUIContainer::getEdgePos)); - ret->mkItem("speed [m/s]", true, new FunctionBinding(this, &GUIContainer::getSpeed)); - ret->mkItem("angle [degree]", true, new FunctionBinding(this, &GUIContainer::getAngle)); - ret->mkItem("waiting time [s]", true, new FunctionBinding(this, &GUIContainer::getWaitingSeconds)); + ret->mkItem("position [m]", true, new FunctionBinding(this, &GUIContainer::getEdgePos)); + ret->mkItem("speed [m/s]", true, new FunctionBinding(this, &GUIContainer::getSpeed)); + ret->mkItem("angle [degree]", true, new FunctionBinding(this, &GUIContainer::getAngle)); + ret->mkItem("waiting time [s]", true, new FunctionBinding(this, &GUIContainer::getWaitingSeconds)); // close building ret->closeBuilding(); return ret; @@ -178,7 +174,7 @@ // set container color setColor(s); // scale - const SUMOReal upscale = s.containerSize.getExaggeration(s); + const double upscale = s.containerSize.getExaggeration(s); glScaled(upscale, upscale, 1); switch (s.containerQuality) { case 0: @@ -214,7 +210,7 @@ if (getNumberReroutes() > 0) { const int noReroutePlus1 = getNumberReroutes() + 1; for (int i = noReroutePlus1 - 1; i >= 0; i--) { - SUMOReal darken = SUMOReal(0.4) / SUMOReal(noReroutePlus1) * SUMOReal(i); + double darken = double(0.4) / double(noReroutePlus1) * double(i); drawRoute(s, i, darken); } } else { @@ -227,14 +223,10 @@ continue; } MSLink* link = (*i).myLink; - #ifdef HAVE_INTERNAL_LANES MSLane *via = link->getViaLane(); if (via == 0) { via = link->getLane(); } - #else - MSLane *via = link->getLane(); - #endif if (via != 0) { Position p = via->getShape()[0]; if((*i).mySetRequest) { @@ -294,7 +286,7 @@ return false; } case 8: { - SUMOReal hue = GeomHelper::naviDegree(getAngle()); + double hue = GeomHelper::naviDegree(getAngle()); GLHelper::setColor(RGBColor::fromHSV(hue, 1., 1.)); return true; } @@ -304,7 +296,7 @@ } -SUMOReal +double GUIContainer::getColorValue(int activeScheme) const { switch (activeScheme) { case 4: @@ -313,7 +305,7 @@ if (isWaiting4Vehicle()) { return 3; } else { - return (SUMOReal)getCurrentStageType(); + return (double)getCurrentStageType(); } case 6: return getWaitingSeconds(); @@ -324,7 +316,7 @@ } -SUMOReal +double GUIContainer::getEdgePos() const { AbstractMutex::ScopedLocker locker(myLock); return MSContainer::getEdgePos(); @@ -343,21 +335,21 @@ } -SUMOReal +double GUIContainer::getAngle() const { AbstractMutex::ScopedLocker locker(myLock); return MSContainer::getAngle(); } -SUMOReal +double GUIContainer::getWaitingSeconds() const { AbstractMutex::ScopedLocker locker(myLock); return MSContainer::getWaitingSeconds(); } -SUMOReal +double GUIContainer::getSpeed() const { AbstractMutex::ScopedLocker locker(myLock); return MSContainer::getSpeed(); @@ -396,9 +388,9 @@ //} int textureID = GUITexturesHelper::getTextureID(file); if (textureID > 0) { - const SUMOReal exaggeration = s.personSize.getExaggeration(s); - const SUMOReal halfLength = getVehicleType().getLength() / 2.0 * exaggeration; - const SUMOReal halfWidth = getVehicleType().getWidth() / 2.0 * exaggeration; + const double exaggeration = s.personSize.getExaggeration(s); + const double halfLength = getVehicleType().getLength() / 2.0 * exaggeration; + const double halfWidth = getVehicleType().getWidth() / 2.0 * exaggeration; GUITexturesHelper::drawTexturedBox(textureID, -halfWidth, -halfLength, halfWidth, halfLength); } } else { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIContainer.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIContainer.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIContainer.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIContainer.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Melanie Weber /// @author Andreas Kendziorra /// @date Wed, 01.08.2014 -/// @version $Id: GUIContainer.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: GUIContainer.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A MSVehicle extended by some values for usage within the gui /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -123,20 +123,20 @@ //@{ /// @brief return the offset from the start of the current edge - SUMOReal getEdgePos() const; + double getEdgePos() const; /// @brief return the Network coordinate of the container // @note overrides the base method and returns myPositionInVehicle while in driving stage Position getPosition() const; /// @brief return the current angle of the container - SUMOReal getAngle() const; + double getAngle() const; /// @brief the time this container spent waiting in seconds - SUMOReal getWaitingSeconds() const; + double getWaitingSeconds() const; /// @brief the current speed of the container - SUMOReal getSpeed() const; + double getSpeed() const; //@} @@ -194,7 +194,7 @@ void setColor(const GUIVisualizationSettings& s) const; /// @brief gets the color value according to the current scheme index - SUMOReal getColorValue(int activeScheme) const; + double getColorValue(int activeScheme) const; /// @brief sets the color according to the current scheme index and some vehicle function bool setFunctionalColor(int activeScheme) const; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIContainerStop.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIContainerStop.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIContainerStop.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIContainerStop.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Melanie Weber /// @author Andreas Kendziorra /// @date Wed, 01.08.2014 -/// @version $Id: GUIContainerStop.cpp 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: GUIContainerStop.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A lane area vehicles can halt at (gui-version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -54,20 +54,16 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== GUIContainerStop::GUIContainerStop(const std::string& id, const std::vector& lines, MSLane& lane, - SUMOReal frompos, SUMOReal topos) + double frompos, double topos) : MSStoppingPlace(id, lines, lane, frompos, topos), GUIGlObject_AbstractAdd("containerStop", GLO_TRIGGER, id) { myFGShape = lane.getShape(); - myFGShape.move2side((SUMOReal) 1.65); + myFGShape.move2side((double) 1.65); myFGShape = myFGShape.getSubpart(frompos, topos); myFGShapeRotations.reserve(myFGShape.size() - 1); myFGShapeLengths.reserve(myFGShape.size() - 1); @@ -76,14 +72,14 @@ const Position& f = myFGShape[i]; const Position& s = myFGShape[i + 1]; myFGShapeLengths.push_back(f.distanceTo(s)); - myFGShapeRotations.push_back((SUMOReal) atan2((s.x() - f.x()), (f.y() - s.y())) * (SUMOReal) 180.0 / (SUMOReal) PI); + myFGShapeRotations.push_back((double) atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double) PI); } PositionVector tmp = myFGShape; tmp.move2side(1.5); myFGSignPos = tmp.getLineCenter(); myFGSignRot = 0; if (tmp.length() != 0) { - myFGSignRot = myFGShape.rotationDegreeAtOffset(SUMOReal((myFGShape.length() / 2.))); + myFGSignRot = myFGShape.rotationDegreeAtOffset(double((myFGShape.length() / 2.))); myFGSignRot -= 90; } } @@ -133,7 +129,7 @@ GLHelper::setColor(blue); GLHelper::drawBoxLines(myFGShape, myFGShapeRotations, myFGShapeLengths, 1.0); // draw details unless zoomed out to far - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); if (s.scale * exaggeration >= 10) { // draw the lines for (i = 0; i != (int)myLines.size(); ++i) { @@ -156,10 +152,10 @@ noPoints = MIN2((int)(9.0 + (s.scale * exaggeration) / 10.0), 36); } glScaled(exaggeration, exaggeration, 1); - GLHelper::drawFilledCircle((SUMOReal) 1.1, noPoints); + GLHelper::drawFilledCircle((double) 1.1, noPoints); glTranslated(0, 0, .1); GLHelper::setColor(grey); - GLHelper::drawFilledCircle((SUMOReal) 0.9, noPoints); + GLHelper::drawFilledCircle((double) 0.9, noPoints); if (s.scale * exaggeration >= 4.5) { GLHelper::drawText("C", Position(), .1, 1.6 * exaggeration, blue, myFGSignRot); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIContainerStop.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIContainerStop.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIContainerStop.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIContainerStop.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Melanie Weber /// @author Andreas Kendziorra /// @date Wed, 01.08.2014 -/// @version $Id: GUIContainerStop.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIContainerStop.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A lane area vehicles can halt at (gui-version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -79,7 +79,7 @@ */ GUIContainerStop(const std::string& id, const std::vector& lines, MSLane& lane, - SUMOReal frompos, SUMOReal topos); + double frompos, double topos); /// @brief Destructor @@ -132,10 +132,10 @@ private: /// @brief The rotations of the shape parts - std::vector myFGShapeRotations; + std::vector myFGShapeRotations; /// @brief The lengths of the shape parts - std::vector myFGShapeLengths; + std::vector myFGShapeLengths; /// @brief The shape PositionVector myFGShape; @@ -144,7 +144,7 @@ Position myFGSignPos; /// @brief The rotation of the sign - SUMOReal myFGSignRot; + double myFGSignRot; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIDetectorWrapper.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIDetectorWrapper.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIDetectorWrapper.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIDetectorWrapper.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: GUIDetectorWrapper.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIDetectorWrapper.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The base class for detector wrapper /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,10 +38,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIDetectorWrapper.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIDetectorWrapper.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIDetectorWrapper.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIDetectorWrapper.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIDetectorWrapper.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIDetectorWrapper.h 22608 2017-01-17 06:28:54Z behrisch $ /// // The base class for detector wrapper /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIE2Collector.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIE2Collector.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIE2Collector.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIE2Collector.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,198 @@ +/****************************************************************************/ +/// @file GUIE2Collector.cpp +/// @author Daniel Krajzewicz +/// @author Jakob Erdmann +/// @author Michael Behrisch +/// @author Laura Bieker +/// @date Okt 2003 +/// @version $Id: GUIE2Collector.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +// The gui-version of the MSE2Collector +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include "GUIE2Collector.h" +#include +#include +#include +#include +#include "GUIEdge.h" +#include + + +// =========================================================================== +// method definitions +// =========================================================================== +/* ------------------------------------------------------------------------- + * GUIE2Collector-methods + * ----------------------------------------------------------------------- */ +GUIE2Collector::GUIE2Collector(const std::string& id, DetectorUsage usage, + MSLane* lane, double startPos, double endPos, double detLength, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, + double jamDistThreshold, const std::string& vTypes, bool showDetector) + : MSE2Collector(id, usage, lane, startPos, endPos, detLength, haltingTimeThreshold, + haltingSpeedThreshold, jamDistThreshold, vTypes), + myShowDetectorInGUI(showDetector) {} + +GUIE2Collector::GUIE2Collector(const std::string& id, DetectorUsage usage, + std::vector lanes, double startPos, double endPos, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, + double jamDistThreshold, const std::string& vTypes, bool showDetector) + : MSE2Collector(id, usage, lanes, startPos, endPos, haltingTimeThreshold, + haltingSpeedThreshold, jamDistThreshold, vTypes), + myShowDetectorInGUI(showDetector) {} + +GUIE2Collector::~GUIE2Collector() {} + + +GUIDetectorWrapper* +GUIE2Collector::buildDetectorGUIRepresentation() { + return new MyWrapper(*this); +} + + + +/* ------------------------------------------------------------------------- + * GUIE2Collector::MyWrapper-methods + * ----------------------------------------------------------------------- */ +GUIE2Collector::MyWrapper::MyWrapper(GUIE2Collector& detector) + : GUIDetectorWrapper("E2 detector", detector.getID()), + myDetector(detector) { + + // collect detector shape into one vector (v) + PositionVector v; + const std::vector lanes = detector.getLanes(); + for (std::vector::const_iterator li = lanes.begin(); li != lanes.end(); ++li) { + const PositionVector& shape = (*li)->getShape(); + v.insert(v.end(), shape.begin(), shape.end()); + } + + // build geometry + myFullGeometry = v.getSubpart(detector.getStartPos(), detector.getStartPos() + detector.getLength()); + // + myShapeRotations.reserve(myFullGeometry.size() - 1); + myShapeLengths.reserve(myFullGeometry.size() - 1); + int e = (int) myFullGeometry.size() - 1; + for (int i = 0; i < e; ++i) { + const Position& f = myFullGeometry[i]; + const Position& s = myFullGeometry[i + 1]; + myShapeLengths.push_back(f.distanceTo(s)); + myShapeRotations.push_back((double) atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double) PI); + } + // + myBoundary = myFullGeometry.getBoxBoundary(); +} + + +GUIE2Collector::MyWrapper::~MyWrapper() {} + + +Boundary +GUIE2Collector::MyWrapper::getCenteringBoundary() const { + Boundary b(myBoundary); + b.grow(20); + return b; +} + + +GUIParameterTableWindow* +GUIE2Collector::MyWrapper::getParameterWindow(GUIMainWindow& app, + GUISUMOAbstractView&) { + GUIParameterTableWindow* ret = + new GUIParameterTableWindow(app, *this, 13); + // add items + // parameter + ret->mkItem("length [m]", false, myDetector.getLength()); + ret->mkItem("position [m]", false, myDetector.getStartPos()); + ret->mkItem("lane", false, myDetector.getLane()->getID()); + // values + ret->mkItem("vehicles [#]", true, + new FunctionBinding(&myDetector, &MSE2Collector::getCurrentVehicleNumber)); + ret->mkItem("occupancy [%]", true, + new FunctionBinding(&myDetector, &MSE2Collector::getCurrentOccupancy)); + ret->mkItem("mean speed [m/s]", true, + new FunctionBinding(&myDetector, &MSE2Collector::getCurrentMeanSpeed)); + ret->mkItem("mean vehicle length [m]", true, + new FunctionBinding(&myDetector, &MSE2Collector::getCurrentMeanLength)); + ret->mkItem("jam number [#]", true, + new FunctionBinding(&myDetector, &MSE2Collector::getCurrentJamNumber)); + ret->mkItem("max jam length [veh]", true, + new FunctionBinding(&myDetector, &MSE2Collector::getCurrentMaxJamLengthInVehicles)); + ret->mkItem("max jam length [m]", true, + new FunctionBinding(&myDetector, &MSE2Collector::getCurrentMaxJamLengthInMeters)); + ret->mkItem("jam length sum [veh]", true, + new FunctionBinding(&myDetector, &MSE2Collector::getCurrentJamLengthInVehicles)); + ret->mkItem("jam length sum [m]", true, + new FunctionBinding(&myDetector, &MSE2Collector::getCurrentJamLengthInMeters)); + ret->mkItem("started halts [#]", true, + new FunctionBinding(&myDetector, &MSE2Collector::getCurrentStartedHalts)); + // close building + ret->closeBuilding(); + return ret; +} + + +void +GUIE2Collector::MyWrapper::drawGL(const GUIVisualizationSettings& s) const { + if (!myDetector.myShowDetectorInGUI) { + return; + } + glPushName(getGlID()); + glPushMatrix(); + glTranslated(0, 0, getType()); + double dwidth = 1; + const double exaggeration = s.addSize.getExaggeration(s); + if (exaggeration > 0) { + if (myDetector.getUsageType() == DU_TL_CONTROL) { + dwidth = (double) 0.3; + glColor3d(0, (double) .6, (double) .8); + } else { + glColor3d(0, (double) .8, (double) .8); + } + double width = (double) 2.0 * s.scale; + if (width * exaggeration > 1.0) { + GLHelper::drawBoxLines(myFullGeometry, myShapeRotations, myShapeLengths, dwidth * exaggeration); + } else { + int e = (int) myFullGeometry.size() - 1; + for (int i = 0; i < e; ++i) { + GLHelper::drawLine(myFullGeometry[i], myShapeRotations[i], myShapeLengths[i]); + } + } + } + glPopMatrix(); + drawName(getCenteringBoundary().getCenter(), s.scale, s.addName); + glPopName(); +} + + +GUIE2Collector& +GUIE2Collector::MyWrapper::getDetector() { + return myDetector; +} + + + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIE2Collector.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIE2Collector.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIE2Collector.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIE2Collector.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,192 @@ +/****************************************************************************/ +/// @file GUIE2Collector.h +/// @author Daniel Krajzewicz +/// @author Jakob Erdmann +/// @author Michael Behrisch +/// @date Okt 2003 +/// @version $Id: GUIE2Collector.h 24108 2017-04-27 18:43:30Z behrisch $ +/// +// The gui-version of the MS_E2_ZS_Collector +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GUIE2Collector_h +#define GUIE2Collector_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include "GUIDetectorWrapper.h" + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class GUIE2Collector + * @brief The gui-version of the MSE2Collector + * + * Allows the building of a wrapper (also declared herein) which draws the + * detector on the gl-canvas. Beside this, the method "amVisible" is + * overridden to signalise that this detector is not used for simulation- + * -internal reasons, but is placed over the simulation by the user. + */ +class GUIE2Collector : public MSE2Collector { +public: + /** @brief Constructor with given end position and detector length + * + * @param[in] id The detector's unique id. + * @param[in] usage Information how the detector is used + * @param[in] lane The lane the detector ends + * @param[in] startPos The start position on the lane the detector is placed at + * @param[in] endPos The end position on the lane the detector is placed at + * @param[in] length The length the detector has (heuristic lane selection is done if the continuation is not unique) + * @param[in] haltingTimeThreshold The time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed + * @param[in] haltingSpeedThreshold The speed a vehicle's speed must be below to be assigned as jammed + * @param[in] jamDistThreshold The distance between two vehicles in order to not count them to one jam + * @param[in] vTypes Vehicle types, that the detector takes into account + * @param[in] friendlyPositioning Whether positions should be corrected to "snap" on lane beginnings or ends if closer than POS_EPSILON + * @param[in] showDetector Whether the detector should be visible in the GUI + * + * @note Exactly one of the arguments startPos, endPos and length should be invalid (i.e. equal to std::numeric_limits::max()). + * If length is invalid, it is required that 0 <= startPos < endPos <= lane->length + * If endPos is invalid, the detector may span over several lanes downstream of the lane + * If pos is invalid, the detector may span over several lanes upstream of the lane + */ + GUIE2Collector(const std::string& id, DetectorUsage usage, + MSLane* lane, double startPos, double endPos, double detLength, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, + const std::string& vTypes, bool showDetector); + + + /** @brief Constructor with a sequence of lanes and given start and end position on the first and last lanes + * + * @param[in] id The detector's unique id. + * @param[in] usage Information how the detector is used + * @param[in] lanes A sequence of lanes the detector covers (must form a continuous piece) + * @param[in] startPos The position of the detector start on the first lane the detector is placed at + * @param[in] endPos The position of the detector end on the last lane the detector is placed at + * @param[in] haltingTimeThreshold The time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed + * @param[in] haltingSpeedThreshold The speed a vehicle's speed must be below to be assigned as jammed + * @param[in] jamDistThreshold The distance between two vehicles in order to not count them to one jam + * @param[in] vTypes Vehicle types, that the detector takes into account + * @param[in] friendlyPositioning Whether positions should be corrected to "snap" on lane beginnings or ends if closer than POS_EPSILON + * @param[in] showDetector Whether the detector should be visible in the GUI + */ + GUIE2Collector(const std::string& id, DetectorUsage usage, + std::vector lanes, double startPos, double endPos, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, + const std::string& vTypes, bool showDetector); + + + /// @brief Destructor + ~GUIE2Collector(); + + + /** @brief Returns the wrapper for this detector + * @return The wrapper representing the detector + * @see MyWrapper + */ + virtual GUIDetectorWrapper* buildDetectorGUIRepresentation(); + +private: + /// @brief Whether the detector shall be drawn in the gui + bool myShowDetectorInGUI; + +public: + /** + * @class GUIE2Collector::MyWrapper + * A GUIE2Collector-visualiser + */ + class MyWrapper : public GUIDetectorWrapper { + public: + /// @brief Constructor + MyWrapper(GUIE2Collector& detector); + + /// @brief Destrutor + ~MyWrapper(); + + + /// @name inherited from GUIGlObject + //@{ + + /** @brief Returns an own parameter window + * + * @param[in] app The application needed to build the parameter window + * @param[in] parent The parent window needed to build the parameter window + * @return The built parameter window + * @see GUIGlObject::getParameterWindow + */ + GUIParameterTableWindow* getParameterWindow( + GUIMainWindow& app, GUISUMOAbstractView& parent); + + + /** @brief Returns the boundary to which the view shall be centered in order to show the object + * + * @return The boundary the object is within + * @see GUIGlObject::getCenteringBoundary + */ + Boundary getCenteringBoundary() const; + + + /** @brief Draws the object + * @param[in] s The settings for the current view (may influence drawing) + * @see GUIGlObject::drawGL + */ + void drawGL(const GUIVisualizationSettings& s) const; + //@} + + + /// @brief Returns the detector itself + GUIE2Collector& getDetector(); + + + private: + /// @brief The wrapped detector + GUIE2Collector& myDetector; + + /// @brief The detector's boundary + Boundary myBoundary; + + /// @brief A sequence of positions in full-geometry mode + PositionVector myFullGeometry; + + /// @brief A sequence of lengths in full-geometry mode + std::vector myShapeLengths; + + /// @brief A sequence of rotations in full-geometry mode + std::vector myShapeRotations; + + private: + /// @brief Invalidated copy constructor. + MyWrapper(const MyWrapper&); + + /// @brief Invalidated assignment operator. + MyWrapper& operator=(const MyWrapper&); + + }; + +}; + + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUI_E2_ZS_Collector.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUI_E2_ZS_Collector.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUI_E2_ZS_Collector.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUI_E2_ZS_Collector.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,191 +0,0 @@ -/****************************************************************************/ -/// @file GUI_E2_ZS_Collector.cpp -/// @author Daniel Krajzewicz -/// @author Jakob Erdmann -/// @author Michael Behrisch -/// @author Laura Bieker -/// @date Okt 2003 -/// @version $Id: GUI_E2_ZS_Collector.cpp 21851 2016-10-31 12:20:12Z behrisch $ -/// -// The gui-version of the MS_E2_ZS_Collector -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ - - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include -#include -#include "GUI_E2_ZS_Collector.h" -#include -#include -#include -#include -#include "GUIEdge.h" -#include - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - - -// =========================================================================== -// method definitions -// =========================================================================== -/* ------------------------------------------------------------------------- - * GUI_E2_ZS_Collector-methods - * ----------------------------------------------------------------------- */ -GUI_E2_ZS_Collector::GUI_E2_ZS_Collector(const std::string& id, DetectorUsage usage, - MSLane* const lane, SUMOReal startPos, SUMOReal detLength, - SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, const std::string& vTypes) - : MSE2Collector(id, usage, lane, startPos, detLength, haltingTimeThreshold, - haltingSpeedThreshold, jamDistThreshold, vTypes) {} - - -GUI_E2_ZS_Collector::GUI_E2_ZS_Collector(const std::string& id, DetectorUsage usage, - MSLane* const lane, SUMOReal startPos, SUMOReal detLength, - SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, const std::set& vTypes) - : MSE2Collector(id, usage, lane, startPos, detLength, haltingTimeThreshold, - haltingSpeedThreshold, jamDistThreshold, vTypes) {} - - -GUI_E2_ZS_Collector::~GUI_E2_ZS_Collector() {} - - -GUIDetectorWrapper* -GUI_E2_ZS_Collector::buildDetectorGUIRepresentation() { - return new MyWrapper(*this); -} - - - -/* ------------------------------------------------------------------------- - * GUI_E2_ZS_Collector::MyWrapper-methods - * ----------------------------------------------------------------------- */ -GUI_E2_ZS_Collector::MyWrapper::MyWrapper(GUI_E2_ZS_Collector& detector) - : GUIDetectorWrapper("E2 detector", detector.getID()), - myDetector(detector) { - const PositionVector& v = detector.getLane()->getShape(); - // build geometry - myFullGeometry = v.getSubpart(detector.getStartPos(), detector.getEndPos()); - // - myShapeRotations.reserve(myFullGeometry.size() - 1); - myShapeLengths.reserve(myFullGeometry.size() - 1); - int e = (int) myFullGeometry.size() - 1; - for (int i = 0; i < e; ++i) { - const Position& f = myFullGeometry[i]; - const Position& s = myFullGeometry[i + 1]; - myShapeLengths.push_back(f.distanceTo(s)); - myShapeRotations.push_back((SUMOReal) atan2((s.x() - f.x()), (f.y() - s.y())) * (SUMOReal) 180.0 / (SUMOReal) PI); - } - // - myBoundary = myFullGeometry.getBoxBoundary(); -} - - -GUI_E2_ZS_Collector::MyWrapper::~MyWrapper() {} - - -Boundary -GUI_E2_ZS_Collector::MyWrapper::getCenteringBoundary() const { - Boundary b(myBoundary); - b.grow(20); - return b; -} - - -GUIParameterTableWindow* -GUI_E2_ZS_Collector::MyWrapper::getParameterWindow(GUIMainWindow& app, - GUISUMOAbstractView&) { - GUIParameterTableWindow* ret = - new GUIParameterTableWindow(app, *this, 13); - // add items - // parameter - ret->mkItem("length [m]", false, myDetector.getEndPos() - myDetector.getStartPos()); - ret->mkItem("position [m]", false, myDetector.getStartPos()); - ret->mkItem("lane", false, myDetector.getLane()->getID()); - // values - ret->mkItem("vehicles [#]", true, - new FunctionBinding(&myDetector, &MSE2Collector::getCurrentVehicleNumber)); - ret->mkItem("occupancy [%]", true, - new FunctionBinding(&myDetector, &MSE2Collector::getCurrentOccupancy)); - ret->mkItem("mean speed [m/s]", true, - new FunctionBinding(&myDetector, &MSE2Collector::getCurrentMeanSpeed)); - ret->mkItem("mean vehicle length [m]", true, - new FunctionBinding(&myDetector, &MSE2Collector::getCurrentMeanLength)); - ret->mkItem("jam number [#]", true, - new FunctionBinding(&myDetector, &MSE2Collector::getCurrentJamNumber)); - ret->mkItem("max jam length [veh]", true, - new FunctionBinding(&myDetector, &MSE2Collector::getCurrentMaxJamLengthInVehicles)); - ret->mkItem("max jam length [m]", true, - new FunctionBinding(&myDetector, &MSE2Collector::getCurrentMaxJamLengthInMeters)); - ret->mkItem("jam length sum [veh]", true, - new FunctionBinding(&myDetector, &MSE2Collector::getCurrentJamLengthInVehicles)); - ret->mkItem("jam length sum [m]", true, - new FunctionBinding(&myDetector, &MSE2Collector::getCurrentJamLengthInMeters)); - ret->mkItem("started halts [#]", true, - new FunctionBinding(&myDetector, &MSE2Collector::getCurrentStartedHalts)); - // close building - ret->closeBuilding(); - return ret; -} - - -void -GUI_E2_ZS_Collector::MyWrapper::drawGL(const GUIVisualizationSettings& s) const { - glPushName(getGlID()); - glPushMatrix(); - glTranslated(0, 0, getType()); - SUMOReal dwidth = 1; - const SUMOReal exaggeration = s.addSize.getExaggeration(s); - if (exaggeration > 0) { - if (myDetector.getUsageType() == DU_TL_CONTROL) { - dwidth = (SUMOReal) 0.3; - glColor3d(0, (SUMOReal) .6, (SUMOReal) .8); - } else { - glColor3d(0, (SUMOReal) .8, (SUMOReal) .8); - } - SUMOReal width = (SUMOReal) 2.0 * s.scale; - if (width * exaggeration > 1.0) { - GLHelper::drawBoxLines(myFullGeometry, myShapeRotations, myShapeLengths, dwidth * exaggeration); - } else { - int e = (int) myFullGeometry.size() - 1; - for (int i = 0; i < e; ++i) { - GLHelper::drawLine(myFullGeometry[i], myShapeRotations[i], myShapeLengths[i]); - } - } - } - glPopMatrix(); - drawName(getCenteringBoundary().getCenter(), s.scale, s.addName); - glPopName(); -} - - -GUI_E2_ZS_Collector& -GUI_E2_ZS_Collector::MyWrapper::getDetector() { - return myDetector; -} - - - -/****************************************************************************/ - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUI_E2_ZS_Collector.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUI_E2_ZS_Collector.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUI_E2_ZS_Collector.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUI_E2_ZS_Collector.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,185 +0,0 @@ -/****************************************************************************/ -/// @file GUI_E2_ZS_Collector.h -/// @author Daniel Krajzewicz -/// @author Jakob Erdmann -/// @author Michael Behrisch -/// @date Okt 2003 -/// @version $Id: GUI_E2_ZS_Collector.h 21851 2016-10-31 12:20:12Z behrisch $ -/// -// The gui-version of the MS_E2_ZS_Collector -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ -#ifndef GUI_E2_ZS_Collector_h -#define GUI_E2_ZS_Collector_h - - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include -#include "GUIDetectorWrapper.h" - - -// =========================================================================== -// class declarations -// =========================================================================== -class GUI_E2_ZS_CollectorOverLanes; - - -// =========================================================================== -// class definitions -// =========================================================================== -/** - * @class GUI_E2_ZS_Collector - * @brief The gui-version of the MS_E2_ZS_Collector - * - * Allows the building of a wrapper (also declared herein) which draws the - * detector on the gl-canvas. Beside this, the method "amVisible" is - * overridden to signalise that this detector is not used for simulation- - * -internal reasons, but is placed over the simulation by the user. - */ -class GUI_E2_ZS_Collector : public MSE2Collector { -public: - /** @brief Constructor - * - * @param[in] id The detector's unique id. - * @param[in] usage Information how the detector is used - * @param[in] lane The lane to place the detector at - * @param[in] startPos Begin position of the detector - * @param[in] detLength Length of the detector - * @param[in] haltingTimeThreshold The time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed - * @param[in] haltingSpeedThreshold The speed a vehicle's speed must be below to be assigned as jammed - * @param[in] jamDistThreshold The distance between two vehicles in order to not count them to one jam - * @todo The lane should not be given as a pointer - */ - GUI_E2_ZS_Collector(const std::string& id, DetectorUsage usage, - MSLane* const lane, SUMOReal startPos, SUMOReal detLength, - SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, const std::string& vTypes); - - - /** @brief Constructor - * - * @param[in] id The detector's unique id. - * @param[in] usage Information how the detector is used - * @param[in] lane The lane to place the detector at - * @param[in] startPos Begin position of the detector - * @param[in] detLength Length of the detector - * @param[in] haltingTimeThreshold The time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed - * @param[in] haltingSpeedThreshold The speed a vehicle's speed must be below to be assigned as jammed - * @param[in] jamDistThreshold The distance between two vehicles in order to not count them to one jam - * @todo The lane should not be given as a pointer - */ - GUI_E2_ZS_Collector(const std::string& id, DetectorUsage usage, - MSLane* const lane, SUMOReal startPos, SUMOReal detLength, - SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, const std::set& vTypes); - - - /// @brief Destructor - ~GUI_E2_ZS_Collector(); - - - /** @brief Returns the wrapper for this detector - * @return The wrapper representing the detector - * @see MyWrapper - */ - virtual GUIDetectorWrapper* buildDetectorGUIRepresentation(); - - -public: - /** - * @class GUI_E2_ZS_Collector::MyWrapper - * A GUI_E2_ZS_Collector-visualiser - */ - class MyWrapper : public GUIDetectorWrapper { - public: - /// @brief Constructor - MyWrapper(GUI_E2_ZS_Collector& detector); - - /// @brief Destrutor - ~MyWrapper(); - - - /// @name inherited from GUIGlObject - //@{ - - /** @brief Returns an own parameter window - * - * @param[in] app The application needed to build the parameter window - * @param[in] parent The parent window needed to build the parameter window - * @return The built parameter window - * @see GUIGlObject::getParameterWindow - */ - GUIParameterTableWindow* getParameterWindow( - GUIMainWindow& app, GUISUMOAbstractView& parent); - - - /** @brief Returns the boundary to which the view shall be centered in order to show the object - * - * @return The boundary the object is within - * @see GUIGlObject::getCenteringBoundary - */ - Boundary getCenteringBoundary() const; - - - /** @brief Draws the object - * @param[in] s The settings for the current view (may influence drawing) - * @see GUIGlObject::drawGL - */ - void drawGL(const GUIVisualizationSettings& s) const; - //@} - - - /// @brief Returns the detector itself - GUI_E2_ZS_Collector& getDetector(); - - - private: - /// @brief The wrapped detector - GUI_E2_ZS_Collector& myDetector; - - /// @brief The detector's boundary - Boundary myBoundary; - - /// @brief A sequence of positions in full-geometry mode - PositionVector myFullGeometry; - - /// @brief A sequence of lengths in full-geometry mode - std::vector myShapeLengths; - - /// @brief A sequence of rotations in full-geometry mode - std::vector myShapeRotations; - - private: - /// @brief Invalidated copy constructor. - MyWrapper(const MyWrapper&); - - /// @brief Invalidated assignment operator. - MyWrapper& operator=(const MyWrapper&); - - }; - -}; - - -#endif - -/****************************************************************************/ - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUI_E2_ZS_CollectorOverLanes.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUI_E2_ZS_CollectorOverLanes.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUI_E2_ZS_CollectorOverLanes.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUI_E2_ZS_CollectorOverLanes.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,181 +0,0 @@ -/****************************************************************************/ -/// @file GUI_E2_ZS_CollectorOverLanes.cpp -/// @author Daniel Krajzewicz -/// @author Jakob Erdmann -/// @author Michael Behrisch -/// @date Okt 2003 -/// @version $Id: GUI_E2_ZS_CollectorOverLanes.cpp 21851 2016-10-31 12:20:12Z behrisch $ -/// -// The gui-version of a MS_E2_ZS_CollectorOverLanes. -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ - - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include "GUI_E2_ZS_Collector.h" -#include "GUI_E2_ZS_CollectorOverLanes.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - - -// =========================================================================== -// method definitions -// =========================================================================== -/* ------------------------------------------------------------------------- - * GUI_E2_ZS_CollectorOverLanes-methods - * ----------------------------------------------------------------------- */ -GUI_E2_ZS_CollectorOverLanes::GUI_E2_ZS_CollectorOverLanes(std::string id, - DetectorUsage usage, MSLane* lane, SUMOReal startPos, - SUMOTime haltingTimeThreshold, - SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, const std::string& vTypes) - : MS_E2_ZS_CollectorOverLanes(id, usage, lane, startPos, - haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes) {} - - - -GUI_E2_ZS_CollectorOverLanes::~GUI_E2_ZS_CollectorOverLanes() {} - - -GUIDetectorWrapper* -GUI_E2_ZS_CollectorOverLanes::buildDetectorGUIRepresentation() { - return new MyWrapper(*this, myAlreadyBuild); -} - - -MSE2Collector* -GUI_E2_ZS_CollectorOverLanes::buildCollector(int c, int r, MSLane* l, - SUMOReal start, SUMOReal end, - const std::set& vTypes) { - std::string id = makeID(myID, c, r); - if (start + end < l->getLength()) { - start = l->getLength() - end - (SUMOReal) 0.1; - } - return new GUI_E2_ZS_Collector(id, myUsage, - l, start, end, haltingTimeThresholdM, - haltingSpeedThresholdM, jamDistThresholdM, vTypes); -} - - -/* ------------------------------------------------------------------------- - * GUI_E2_ZS_CollectorOverLanes::MyWrapper-methods - * ----------------------------------------------------------------------- */ -GUI_E2_ZS_CollectorOverLanes::MyWrapper::MyWrapper( - GUI_E2_ZS_CollectorOverLanes& detector, - const LaneDetMap& detectors) - : GUIDetectorWrapper("E2OverLanes detector", detector.getID()), - myDetector(detector) { - for (LaneDetMap::const_iterator i = detectors.begin(); i != detectors.end(); ++i) { - GUI_E2_ZS_Collector* c = static_cast((*i).second); - GUIDetectorWrapper* dw = c->buildDetectorGUIRepresentation(); - mySubWrappers.push_back(dw); - myBoundary.add(dw->getCenteringBoundary()); - } -} - - -GUI_E2_ZS_CollectorOverLanes::MyWrapper::~MyWrapper() { - for (std::vector::iterator i = mySubWrappers.begin(); i != mySubWrappers.end(); ++i) { - delete(*i); - } -} - - -Boundary -GUI_E2_ZS_CollectorOverLanes::MyWrapper::getCenteringBoundary() const { - Boundary b(myBoundary); - return b; -} - - -GUIParameterTableWindow* -GUI_E2_ZS_CollectorOverLanes::MyWrapper::getParameterWindow(GUIMainWindow& app, - GUISUMOAbstractView&) { - GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this, 12); - // add items - /* - myMkExistingItem(*ret, "density [?]", E2::DENSITY); - myMkExistingItem(*ret, "jam lengths [veh]", E2::MAX_JAM_LENGTH_IN_VEHICLES); - myMkExistingItem(*ret, "jam length [m]", E2::MAX_JAM_LENGTH_IN_METERS); - myMkExistingItem(*ret, "jam len sum [veh]", E2::JAM_LENGTH_SUM_IN_VEHICLES); - myMkExistingItem(*ret, "jam len sum [m]", E2::JAM_LENGTH_SUM_IN_METERS); - myMkExistingItem(*ret, "queue length [veh]", E2::QUEUE_LENGTH_AHEAD_OF_TRAFFIC_LIGHTS_IN_VEHICLES); - myMkExistingItem(*ret, "queue length [m]", E2::QUEUE_LENGTH_AHEAD_OF_TRAFFIC_LIGHTS_IN_METERS); - myMkExistingItem(*ret, "vehicles [veh]", E2::N_VEHICLES); - myMkExistingItem(*ret, "occupancy degree [?]", E2::OCCUPANCY_DEGREE); - myMkExistingItem(*ret, "space mean speed [?]", E2::SPACE_MEAN_SPEED); - myMkExistingItem(*ret, "halting duration [?]", E2::CURRENT_HALTING_DURATION_SUM_PER_VEHICLE); - */ - // - ret->mkItem("length [m]", false, myDetector.getLength()); - /* - ret->mkItem("position [m]", false, - myDetector.getStartPos());*/ -// ret->mkItem("", false, myDetector.getStartLaneID()); - // close building - ret->closeBuilding(); - return ret; -} - - -/* -void -GUI_E2_ZS_CollectorOverLanes::MyWrapper::myMkExistingItem(GUIParameterTableWindow &ret, - const std::string &name, - E2::DetType type) -{ -if (!myDetector.hasDetector(type)) { - return; -} -MyValueRetriever *binding = - new MyValueRetriever(myDetector, type, 1); -ret.mkItem(name.c_str(), true, binding); -} -*/ - - -void -GUI_E2_ZS_CollectorOverLanes::MyWrapper::drawGL(const GUIVisualizationSettings& s) const { - for (std::vector::const_iterator i = mySubWrappers.begin(); i != mySubWrappers.end(); ++i) { - (*i)->drawGL(s); - } -} - - -GUI_E2_ZS_CollectorOverLanes& -GUI_E2_ZS_CollectorOverLanes::MyWrapper::getLoop() { - return myDetector; -} - - - -/****************************************************************************/ - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUI_E2_ZS_CollectorOverLanes.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUI_E2_ZS_CollectorOverLanes.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUI_E2_ZS_CollectorOverLanes.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUI_E2_ZS_CollectorOverLanes.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,198 +0,0 @@ -/****************************************************************************/ -/// @file GUI_E2_ZS_CollectorOverLanes.h -/// @author Daniel Krajzewicz -/// @author Jakob Erdmann -/// @author Michael Behrisch -/// @date Okt 2003 -/// @version $Id: GUI_E2_ZS_CollectorOverLanes.h 21851 2016-10-31 12:20:12Z behrisch $ -/// -// The gui-version of a MS_E2_ZS_CollectorOverLanes. -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ -#ifndef GUI_E2_ZS_CollectorOverLanes_h -#define GUI_E2_ZS_CollectorOverLanes_h - - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include -#include "GUIDetectorWrapper.h" - - -// =========================================================================== -// class declarations -// =========================================================================== -class GUI_E2_ZS_Collector; - - -// =========================================================================== -// class definitions -// =========================================================================== -/** - * @class GUI_E2_ZS_CollectorOverLanes - * @brief The gui-version of a MS_E2_ZS_CollectorOverLanes. - * - * Allows the building of a wrapper (also declared herein) which draws the - * detector on the gl-canvas. Beside this, the method "amVisible" is - * overridden to signalise that this detector is not used for simulation- - * -internal reasons, but is placed over the simulation by the user. - */ -class GUI_E2_ZS_CollectorOverLanes : public MS_E2_ZS_CollectorOverLanes { -public: - typedef std::vector CollectorVector; - - /// Constructor - GUI_E2_ZS_CollectorOverLanes(std::string id, DetectorUsage usage, - MSLane* lane, SUMOReal startPos, - SUMOTime haltingTimeThreshold, - SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, const std::string& vTypes); - - /// Destructor - ~GUI_E2_ZS_CollectorOverLanes(); - - // invalid in fact, as collectors do not need a lane - virtual GUIDetectorWrapper* buildDetectorGUIRepresentation(); - - -protected: - MSE2Collector* buildCollector(int c, int r, - MSLane* l, SUMOReal start, SUMOReal end, - const std::set& vTypes); - - -public: - /** - * @class GUI_E2_ZS_CollectorOverLanes::MyWrapper - * A GUI_E2_ZS_CollectorOverLanes-visualiser - */ - class MyWrapper : public GUIDetectorWrapper { - public: - /// Constructor - MyWrapper(GUI_E2_ZS_CollectorOverLanes& detector, - const LaneDetMap& detectors); - - /// Destrutor - ~MyWrapper(); - - - /// @name inherited from GUIGlObject - //@{ - - /** @brief Returns an own parameter window - * - * @param[in] app The application needed to build the parameter window - * @param[in] parent The parent window needed to build the parameter window - * @return The built parameter window - * @see GUIGlObject::getParameterWindow - */ - GUIParameterTableWindow* getParameterWindow( - GUIMainWindow& app, GUISUMOAbstractView& parent); - - - /** @brief Returns the boundary to which the view shall be centered in order to show the object - * - * @return The boundary the object is within - * @see GUIGlObject::getCenteringBoundary - */ - Boundary getCenteringBoundary() const; - - - /** @brief Draws the object - * @param[in] s The settings for the current view (may influence drawing) - * @see GUIGlObject::drawGL - */ - void drawGL(const GUIVisualizationSettings& s) const; - //@} - - - /// Returns the detector itself - GUI_E2_ZS_CollectorOverLanes& getLoop(); - - protected: - /// Builds a view within the parameter table if the according type is available - /* - void myMkExistingItem(GUIParameterTableWindow &ret, - const std::string &name, E2::DetType type); - */ - - private: - /// The wrapped detector - GUI_E2_ZS_CollectorOverLanes& myDetector; - - /// The detector's boundary - Boundary myBoundary; - - std::vector mySubWrappers; - - /** - * @class GUI_E2_ZS_CollectorOverLanes::MyWrapper::ValueRetriever - * This class realises the retrieval of a certain value - * with a certain interval specification from the detector - */ - /* - class MyValueRetriever : public ValueSource - { - public: - /// Constructor - MyValueRetriever(GUI_E2_ZS_CollectorOverLanes &det, - E2::DetType type, MSUnit::Seconds nSec) - : myDetector(det), myType(type), myNSec(nSec) { } - - /// Destructor - ~MyValueRetriever() { } - - /// Returns the current value - SUMOReal getValue() const { - return myDetector.getAggregate(myType, myNSec); - } - - /// Returns a copy of this instance - ValueSource *copy() const { - return new MyValueRetriever(myDetector, myType, myNSec); - } - - private: - /// The detctor to get the value from - GUI_E2_ZS_CollectorOverLanes &myDetector; - - /// The type of the value to retrieve - E2::DetType myType; - - /// The aggregation interval - MSUnit::Seconds myNSec; - }; - */ - private: - /// @brief Invalidated copy constructor. - MyWrapper(const MyWrapper&); - - /// @brief Invalidated assignment operator. - MyWrapper& operator=(const MyWrapper&); - - }; - -}; - - -#endif - -/****************************************************************************/ - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIE3Collector.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIE3Collector.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIE3Collector.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIE3Collector.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Jan 2004 -/// @version $Id: GUIE3Collector.cpp 21496 2016-09-19 10:39:08Z behrisch $ +/// @version $Id: GUIE3Collector.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The gui-version of a MSE3Collector /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,10 +38,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -90,7 +86,7 @@ ret->mkItem("vehicles within [#]", true, new FunctionBinding(&myDetector, &MSE3Collector::getVehiclesWithin)); ret->mkItem("mean speed [m/s]", true, - new FunctionBinding(&myDetector, &MSE3Collector::getCurrentMeanSpeed)); + new FunctionBinding(&myDetector, &MSE3Collector::getCurrentMeanSpeed)); ret->mkItem("haltings [#]", true, new FunctionBinding(&myDetector, &MSE3Collector::getCurrentHaltingNumber)); // close building @@ -107,7 +103,7 @@ typedef std::vector CrossingDefinitions; CrossingDefinitions::const_iterator i; glColor3d(0, .8, 0); - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); for (i = myEntryDefinitions.begin(); i != myEntryDefinitions.end(); ++i) { drawSingleCrossing((*i).myFGPosition, (*i).myFGRotation, exaggeration); } @@ -123,7 +119,7 @@ void GUIE3Collector::MyWrapper::drawSingleCrossing(const Position& pos, - SUMOReal rot, SUMOReal upscale) const { + double rot, double upscale) const { glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPushMatrix(); glScaled(upscale, upscale, 1); @@ -142,10 +138,10 @@ // arrows glTranslated(1.5, 0, 0); GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05); - GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25); glTranslated(-3, 0, 0); GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05); - GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25); glPopMatrix(); } @@ -169,7 +165,7 @@ * ----------------------------------------------------------------------- */ GUIE3Collector::GUIE3Collector(const std::string& id, const CrossSectionVector& entries, const CrossSectionVector& exits, - SUMOReal haltingSpeedThreshold, + double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string& vTypes) : MSE3Collector(id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold, vTypes) {} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIE3Collector.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIE3Collector.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIE3Collector.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIE3Collector.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Jan 2004 -/// @version $Id: GUIE3Collector.h 21496 2016-09-19 10:39:08Z behrisch $ +/// @version $Id: GUIE3Collector.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The gui-version of a MSE3Collector /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,7 +55,7 @@ /// @brief Constructor GUIE3Collector(const std::string& id, const CrossSectionVector& entries, const CrossSectionVector& exits, - SUMOReal haltingSpeedThreshold, + double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string& vTypes); /// @brief Destructor @@ -137,7 +137,7 @@ /// @brief The position Position myFGPosition; /// @brief The rotation - SUMOReal myFGRotation; + double myFGRotation; }; protected: @@ -145,8 +145,8 @@ SingleCrossingDefinition buildDefinition(const MSCrossSection& section); /// @brief Draws a single entry/exit point - void drawSingleCrossing(const Position& pos, SUMOReal rot, - SUMOReal upscale) const; + void drawSingleCrossing(const Position& pos, double rot, + double upscale) const; private: /// @brief The wrapped detector diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIEdge.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIEdge.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIEdge.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIEdge.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Sept 2002 -/// @version $Id: GUIEdge.cpp 21232 2016-07-25 13:06:55Z namdre $ +/// @version $Id: GUIEdge.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A road/street connecting two junctions (gui-version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -67,10 +67,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // included modules @@ -112,9 +108,9 @@ } -SUMOReal +double GUIEdge::getTotalLength(bool includeInternal, bool eachLane) { - SUMOReal result = 0; + double result = 0; for (MSEdge::DictType::const_iterator i = MSEdge::myDict.begin(); i != MSEdge::myDict.end(); ++i) { const MSEdge* edge = i->second; if (edge->getPurpose() != EDGEFUNCTION_INTERNAL || includeInternal) { @@ -177,7 +173,7 @@ if (MSGlobals::gUseMesoSim) { buildShowParamsPopupEntry(ret); } - const SUMOReal pos = getLanes()[0]->getShape().nearest_offset_to_point2D(parent.getPositionInformation()); + const double pos = getLanes()[0]->getShape().nearest_offset_to_point2D(parent.getPositionInformation()); new FXMenuCommand(ret, ("pos: " + toString(pos)).c_str(), 0, 0, 0); buildPositionCopyEntry(ret, false); return ret; @@ -188,27 +184,29 @@ GUIEdge::getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) { GUIParameterTableWindow* ret = 0; - ret = new GUIParameterTableWindow(app, *this, 16); + ret = new GUIParameterTableWindow(app, *this, 18); // add edge items ret->mkItem("length [m]", false, (*myLanes)[0]->getLength()); ret->mkItem("allowed speed [m/s]", false, getAllowedSpeed()); - ret->mkItem("brutto occupancy [%]", true, new FunctionBinding(this, &GUIEdge::getBruttoOccupancy, 100.)); - ret->mkItem("mean vehicle speed [m/s]", true, new FunctionBinding(this, &GUIEdge::getMeanSpeed)); - ret->mkItem("flow [veh/h/lane]", true, new FunctionBinding(this, &GUIEdge::getFlow)); - ret->mkItem("routing speed [m/s]", true, new FunctionBinding(this, &MSEdge::getRoutingSpeed)); - ret->mkItem("#vehicles", true, new CastingFunctionBinding(this, &GUIEdge::getVehicleNo)); + ret->mkItem("brutto occupancy [%]", true, new FunctionBinding(this, &GUIEdge::getBruttoOccupancy, 100.)); + ret->mkItem("mean vehicle speed [m/s]", true, new FunctionBinding(this, &GUIEdge::getMeanSpeed)); + ret->mkItem("flow [veh/h/lane]", true, new FunctionBinding(this, &GUIEdge::getFlow)); + ret->mkItem("routing speed [m/s]", true, new FunctionBinding(this, &MSEdge::getRoutingSpeed)); + ret->mkItem("#vehicles", true, new CastingFunctionBinding(this, &GUIEdge::getVehicleNo)); ret->mkItem("vehicle ids", false, getVehicleIDs()); // add segment items MESegment* segment = getSegmentAtPosition(parent.getPositionInformation()); ret->mkItem("segment index", false, segment->getIndex()); + ret->mkItem("segment queues", false, segment->numQueues()); ret->mkItem("segment length [m]", false, segment->getLength()); ret->mkItem("segment allowed speed [m/s]", false, segment->getEdge().getSpeedLimit()); ret->mkItem("segment jam threshold [%]", false, segment->getRelativeJamThreshold() * 100); - ret->mkItem("segment brutto occupancy [%]", true, new FunctionBinding(segment, &MESegment::getRelativeOccupancy, 100)); - ret->mkItem("segment mean vehicle speed [m/s]", true, new FunctionBinding(segment, &MESegment::getMeanSpeed)); - ret->mkItem("segment flow [veh/h/lane]", true, new FunctionBinding(segment, &MESegment::getFlow)); - ret->mkItem("segment #vehicles", true, new CastingFunctionBinding(segment, &MESegment::getCarNumber)); - ret->mkItem("segment leader leave time", true, new FunctionBinding(segment, &MESegment::getEventTimeSeconds)); + ret->mkItem("segment brutto occupancy [%]", true, new FunctionBinding(segment, &MESegment::getRelativeOccupancy, 100)); + ret->mkItem("segment mean vehicle speed [m/s]", true, new FunctionBinding(segment, &MESegment::getMeanSpeed)); + ret->mkItem("segment flow [veh/h/lane]", true, new FunctionBinding(segment, &MESegment::getFlow)); + ret->mkItem("segment #vehicles", true, new CastingFunctionBinding(segment, &MESegment::getCarNumber)); + ret->mkItem("segment leader leave time", true, new FunctionBinding(segment, &MESegment::getEventTimeSeconds)); + ret->mkItem("segment headway [s]", true, new FunctionBinding(segment, &MESegment::getLastHeadwaySeconds)); // close building ret->closeBuilding(); @@ -257,10 +255,10 @@ GUILane* lane1 = dynamic_cast((*myLanes)[0]); GUILane* lane2 = dynamic_cast((*myLanes).back()); if (lane1 != 0 && lane2 != 0) { - Position p = lane1->getShape().positionAtOffset(lane1->getShape().length() / (SUMOReal) 2.); - p.add(lane2->getShape().positionAtOffset(lane2->getShape().length() / (SUMOReal) 2.)); + Position p = lane1->getShape().positionAtOffset(lane1->getShape().length() / (double) 2.); + p.add(lane2->getShape().positionAtOffset(lane2->getShape().length() / (double) 2.)); p.mul(.5); - SUMOReal angle = lane1->getShape().rotationDegreeAtOffset(lane1->getShape().length() / (SUMOReal) 2.); + double angle = lane1->getShape().rotationDegreeAtOffset(lane1->getShape().length() / (double) 2.); angle += 90; if (angle > 90 && angle < 270) { angle -= 180; @@ -311,20 +309,20 @@ for (std::vector::const_iterator msl = myLanes->begin(); msl != myLanes->end(); ++msl, ++laneIndex) { GUILane* l = static_cast(*msl); // go through the vehicles - SUMOReal segmentOffset = 0; // offset at start of current segment + double segmentOffset = 0; // offset at start of current segment for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) { - const SUMOReal length = segment->getLength(); + const double length = segment->getLength(); if (laneIndex < segment->numQueues()) { // make a copy so we don't have to worry about synchronization queue = segment->getQueue(laneIndex); const int queueSize = (int)queue.size(); - SUMOReal vehiclePosition = segmentOffset + length; + double vehiclePosition = segmentOffset + length; // draw vehicles beginning with the leader at the end of the segment - SUMOReal xOff = 0; + double xOff = 0; for (int i = 0; i < queueSize; ++i) { GUIMEVehicle* veh = static_cast(queue[queueSize - i - 1]); - const SUMOReal vehLength = veh->getVehicleType().getLengthWithGap(); + const double vehLength = veh->getVehicleType().getLengthWithGap(); while (vehiclePosition < segmentOffset) { // if there is only a single queue for a // multi-lane edge shift vehicles and start @@ -333,7 +331,7 @@ xOff += 2; } const Position p = l->geometryPositionAtOffset(vehiclePosition); - const SUMOReal angle = l->getShape().rotationAtOffset(l->interpolateLanePosToGeometryPos(vehiclePosition)); + const double angle = l->getShape().rotationAtOffset(l->interpolateLanePosToGeometryPos(vehiclePosition)); veh->drawOnPos(s, p, angle); vehiclePosition -= vehLength; } @@ -373,33 +371,33 @@ } -SUMOReal +double GUIEdge::getFlow() const { - SUMOReal flow = 0; + double flow = 0; for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) { - flow += (SUMOReal) segment->getCarNumber() * segment->getMeanSpeed(); + flow += (double) segment->getCarNumber() * segment->getMeanSpeed(); } return 3600 * flow / (*myLanes)[0]->getLength(); } -SUMOReal +double GUIEdge::getBruttoOccupancy() const { - SUMOReal occ = 0; + double occ = 0; for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) { occ += segment->getBruttoOccupancy(); } - return occ / (*myLanes)[0]->getLength() / (SUMOReal)(myLanes->size()); + return occ / (*myLanes)[0]->getLength() / (double)(myLanes->size()); } -SUMOReal +double GUIEdge::getAllowedSpeed() const { return (*myLanes)[0]->getSpeedLimit(); } -SUMOReal +double GUIEdge::getRelativeSpeed() const { return getMeanSpeed() / getAllowedSpeed(); } @@ -407,9 +405,10 @@ void GUIEdge::setColor(const GUIVisualizationSettings& s) const { + myMesoColor = RGBColor(0, 0, 0); // default background color when using multiColor const GUIColorer& c = s.edgeColorer; if (!setFunctionalColor(c.getActive()) && !setMultiColor(c)) { - GLHelper::setColor(c.getScheme().getColor(getColorValue(c.getActive()))); + myMesoColor = c.getScheme().getColor(getColorValue(c.getActive())); } } @@ -419,8 +418,8 @@ switch (activeScheme) { case 9: { const PositionVector& shape = getLanes()[0]->getShape(); - SUMOReal hue = GeomHelper::naviDegree(shape.beginEndAngle()); // [0-360] - GLHelper::setColor(RGBColor::fromHSV(hue, 1., 1.)); + double hue = GeomHelper::naviDegree(shape.beginEndAngle()); // [0-360] + myMesoColor = RGBColor::fromHSV(hue, 1., 1.); return true; } default: @@ -477,7 +476,7 @@ } -SUMOReal +double GUIEdge::getColorValue(int activeScheme) const { switch (activeScheme) { case 1: @@ -503,7 +502,7 @@ } -SUMOReal +double GUIEdge::getScaleValue(int activeScheme) const { switch (activeScheme) { case 1: @@ -528,7 +527,7 @@ MESegment* GUIEdge::getSegmentAtPosition(const Position& pos) { const PositionVector& shape = getLanes()[0]->getShape(); - const SUMOReal lanePos = shape.nearest_offset_to_point2D(pos); + const double lanePos = shape.nearest_offset_to_point2D(pos); return MSGlobals::gMesoNet->getSegmentForEdge(*this, lanePos); } @@ -558,7 +557,7 @@ MSTriggeredRerouter::RerouteInterval ri; ri.begin = MSNet::getInstance()->getCurrentTimeStep(); ri.end = SUMOTime_MAX; - ri.edgeProbs.add(1, &MSTriggeredRerouter::mySpecialDest_keepDestination); + ri.edgeProbs.add(&MSTriggeredRerouter::mySpecialDest_keepDestination, 1.); rr->myIntervals.push_back(ri); // trigger rerouting for vehicles already on this edge diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIEdge.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIEdge.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIEdge.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIEdge.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIEdge.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: GUIEdge.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A road/street connecting two junctions (gui-version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -82,7 +82,7 @@ * @param[in] includeInternal Whether to include lengths of internal edges * @param[in] eachLane Whether to count each lane separately */ - static SUMOReal getTotalLength(bool includeInternal, bool eachLane); + static double getTotalLength(bool includeInternal, bool eachLane); /// Returns the street's geometry Boundary getBoundary() const; @@ -95,8 +95,8 @@ /** returns the position on the line given by the coordinates where "prev" is the length of the line and "wanted" the distance from the begin !!! should be within another class */ - static std::pair getLaneOffsets(SUMOReal x1, SUMOReal y1, - SUMOReal x2, SUMOReal y2, SUMOReal prev, SUMOReal wanted); + static std::pair getLaneOffsets(double x1, double y1, + double x2, double y2, double prev, double wanted); static void fill(std::vector& netsWrappers); @@ -166,12 +166,12 @@ int getVehicleNo() const; std::string getVehicleIDs() const; - SUMOReal getBruttoOccupancy() const; - SUMOReal getAllowedSpeed() const; + double getBruttoOccupancy() const; + double getAllowedSpeed() const; /// @brief return flow based on meanSpead @note: may produced incorrect results when jammed - SUMOReal getFlow() const; + double getFlow() const; /// @brief return meanSpead divided by allowedSpeed - SUMOReal getRelativeSpeed() const; + double getRelativeSpeed() const; /// @brief sets the color according to the currente settings void setColor(const GUIVisualizationSettings& s) const; @@ -183,10 +183,10 @@ bool setMultiColor(const GUIColorer& c) const; /// @brief gets the color value according to the current scheme index - SUMOReal getColorValue(int activeScheme) const; + double getColorValue(int activeScheme) const; /// @brief gets the scaling value according to the current scheme index - SUMOReal getScaleValue(int activeScheme) const; + double getScaleValue(int activeScheme) const; /// @brief returns the segment closest to the given position MESegment* getSegmentAtPosition(const Position& pos); @@ -214,9 +214,15 @@ return mySegmentColors; } + RGBColor getMesoColor() const { + return myMesoColor; + } + /// The color of the segments (cached) mutable std::vector mySegmentColors; + + private: /// @brief invalidated copy constructor GUIEdge(const GUIEdge& s); @@ -229,6 +235,8 @@ /// The mutex used to avoid concurrent updates of myPersons/ myContainers mutable MFXMutex myLock; + mutable RGBColor myMesoColor; + }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIEventControl.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIEventControl.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIEventControl.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIEventControl.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 04 Feb 2008 -/// @version $Id: GUIEventControl.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIEventControl.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // Stores time-dependant events and executes them at the proper time (guisim) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,10 +33,6 @@ #include #include "GUIEventControl.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member definitions @@ -48,12 +44,10 @@ } -SUMOTime -GUIEventControl::addEvent(Command* operation, - SUMOTime execTimeStep, - AdaptType type) { +void +GUIEventControl::addEvent(Command* operation, SUMOTime execTimeStep) { AbstractMutex::ScopedLocker locker(myLock); - return MSEventControl::addEvent(operation, execTimeStep, type); + MSEventControl::addEvent(operation, execTimeStep); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIEventControl.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIEventControl.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIEventControl.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIEventControl.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 04 Feb 2008 -/// @version $Id: GUIEventControl.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIEventControl.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Stores time-dependant events and executes them at the proper time (guisim) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -66,12 +66,10 @@ * after the call. * * @param[in] operation The event to add - * @param[in] execTimeStep The time the event shall be executed at - * @param[in] type The adaptation type + * @param[in] execTimeStep The time the event shall be executed at (-1 means at sim start) * @see MSEventControl::addEvent */ - SUMOTime addEvent(Command* operation, SUMOTime execTimeStep, - AdaptType type); + void addEvent(Command* operation, SUMOTime execTimeStep = -1); /** @brief Executes time-dependant commands diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIInductLoop.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIInductLoop.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIInductLoop.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIInductLoop.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Aug 2003 -/// @version $Id: GUIInductLoop.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUIInductLoop.cpp 23800 2017-04-04 09:37:29Z behrisch $ /// // The gui-version of the MSInductLoop, together with the according /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,10 +41,6 @@ #include "GUIEdge.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -53,7 +49,7 @@ * GUIInductLoop-methods * ----------------------------------------------------------------------- */ GUIInductLoop::GUIInductLoop(const std::string& id, MSLane* const lane, - SUMOReal position, const std::string& vTypes) + double position, const std::string& vTypes) : MSInductLoop(id, lane, position, vTypes) {} @@ -74,19 +70,19 @@ void -GUIInductLoop::enterDetectorByMove(SUMOVehicle& veh, SUMOReal entryTimestep) { +GUIInductLoop::enterDetectorByMove(SUMOVehicle& veh, double entryTimestep) { AbstractMutex::ScopedLocker locker(myLock); MSInductLoop::enterDetectorByMove(veh, entryTimestep); } void -GUIInductLoop::leaveDetectorByMove(SUMOVehicle& veh, SUMOReal leaveTimestep) { +GUIInductLoop::leaveDetectorByMove(SUMOVehicle& veh, double leaveTimestep) { AbstractMutex::ScopedLocker locker(myLock); MSInductLoop::leaveDetectorByMove(veh, leaveTimestep); } void -GUIInductLoop::leaveDetectorByLaneChange(SUMOVehicle& veh, SUMOReal lastPos) { +GUIInductLoop::leaveDetectorByLaneChange(SUMOVehicle& veh, double lastPos) { AbstractMutex::ScopedLocker locker(myLock); MSInductLoop::leaveDetectorByLaneChange(veh, lastPos); } @@ -102,12 +98,12 @@ /* ------------------------------------------------------------------------- * GUIInductLoop::MyWrapper-methods * ----------------------------------------------------------------------- */ -GUIInductLoop::MyWrapper::MyWrapper(GUIInductLoop& detector, SUMOReal pos) +GUIInductLoop::MyWrapper::MyWrapper(GUIInductLoop& detector, double pos) : GUIDetectorWrapper("induct loop", detector.getID()), myDetector(detector), myPosition(pos) { myFGPosition = detector.getLane()->geometryPositionAtOffset(pos); - myBoundary.add(myFGPosition.x() + (SUMOReal) 5.5, myFGPosition.y() + (SUMOReal) 5.5); - myBoundary.add(myFGPosition.x() - (SUMOReal) 5.5, myFGPosition.y() - (SUMOReal) 5.5); + myBoundary.add(myFGPosition.x() + (double) 5.5, myFGPosition.y() + (double) 5.5); + myBoundary.add(myFGPosition.x() - (double) 5.5, myFGPosition.y() - (double) 5.5); myFGRotation = -detector.getLane()->getShape().rotationDegreeAtOffset(pos); } @@ -136,13 +132,13 @@ ret->mkItem("passed vehicles [#]", true, new FunctionBinding(&myDetector, &GUIInductLoop::getCurrentPassedNumber)); ret->mkItem("speed [m/s]", true, - new FunctionBinding(&myDetector, &GUIInductLoop::getCurrentSpeed)); + new FunctionBinding(&myDetector, &GUIInductLoop::getCurrentSpeed)); ret->mkItem("occupancy [%]", true, - new FunctionBinding(&myDetector, &GUIInductLoop::getCurrentOccupancy)); + new FunctionBinding(&myDetector, &GUIInductLoop::getCurrentOccupancy)); ret->mkItem("vehicle length [m]", true, - new FunctionBinding(&myDetector, &GUIInductLoop::getCurrentLength)); + new FunctionBinding(&myDetector, &GUIInductLoop::getCurrentLength)); ret->mkItem("empty time [s]", true, - new FunctionBinding(&(getLoop()), &GUIInductLoop::getTimestepsSinceLastDetection)); + new FunctionBinding(&(getLoop()), &GUIInductLoop::getTimeSinceLastDetection)); // close building ret->closeBuilding(); return ret; @@ -152,9 +148,9 @@ void GUIInductLoop::MyWrapper::drawGL(const GUIVisualizationSettings& s) const { glPushName(getGlID()); - SUMOReal width = (SUMOReal) 2.0 * s.scale; + double width = (double) 2.0 * s.scale; glLineWidth(1.0); - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); // shape glColor3d(1, 1, 0); glPushMatrix(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIInductLoop.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIInductLoop.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIInductLoop.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIInductLoop.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Aug 2003 -/// @version $Id: GUIInductLoop.h 21496 2016-09-19 10:39:08Z behrisch $ +/// @version $Id: GUIInductLoop.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The gui-version of the MSInductLoop, together with the according /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -59,9 +59,9 @@ * @param[in] id Unique id * @param[in] lane Lane where detector woks on * @param[in] position Position of the detector within the lane - * @param[in] splitByType Whether additional information split by vehicle classes shall be generated + * @param[in] vTypes which vehicle types are considered */ - GUIInductLoop(const std::string& id, MSLane* const lane, SUMOReal position, const std::string& vTypes); + GUIInductLoop(const std::string& id, MSLane* const lane, double position, const std::string& vTypes); /// @brief Destructor @@ -107,7 +107,7 @@ * @param entryTimestep Timestep (not necessary integer) of entrance. * @see MSInductLoop::enterDetectorByMove() */ - void enterDetectorByMove(SUMOVehicle& veh, SUMOReal entryTimestep); + void enterDetectorByMove(SUMOVehicle& veh, double entryTimestep); /** @brief Processes a vehicle that leaves the detector @@ -118,7 +118,7 @@ * @param leaveTimestep Timestep (not necessary integer) of leaving. * @see MSInductLoop::leaveDetectorByMove() */ - void leaveDetectorByMove(SUMOVehicle& veh, SUMOReal leaveTimestep); + void leaveDetectorByMove(SUMOVehicle& veh, double leaveTimestep); /** @brief Removes a vehicle from the detector's map myVehiclesOnDet. @@ -128,7 +128,7 @@ * @param veh The leaving vehicle. * @param lastPos The last position of the leaving vehicle. */ - void leaveDetectorByLaneChange(SUMOVehicle& veh, SUMOReal lastPos); + void leaveDetectorByLaneChange(SUMOVehicle& veh, double lastPos); /// @} @@ -142,7 +142,7 @@ class MyWrapper : public GUIDetectorWrapper { public: /// @brief Constructor - MyWrapper(GUIInductLoop& detector, SUMOReal pos); + MyWrapper(GUIInductLoop& detector, double pos); /// @brief Destructor ~MyWrapper(); @@ -193,10 +193,10 @@ Position myFGPosition; /// @brief The rotation in full-geometry mode - SUMOReal myFGRotation; + double myFGRotation; /// @brief The position on the lane - SUMOReal myPosition; + double myPosition; private: /// @brief Invalidated copy constructor. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIInstantInductLoop.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIInstantInductLoop.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIInstantInductLoop.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIInstantInductLoop.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Aug 2003 -/// @version $Id: GUIInstantInductLoop.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUIInstantInductLoop.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The gui-version of the MSInstantInductLoop /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2003-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2003-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,10 +41,6 @@ #include "GUIEdge.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -53,7 +49,7 @@ * GUIInstantInductLoop-methods * ----------------------------------------------------------------------- */ GUIInstantInductLoop::GUIInstantInductLoop(const std::string& id, OutputDevice& od, - MSLane* const lane, SUMOReal positionInMeters, + MSLane* const lane, double positionInMeters, const std::string& vTypes) : MSInstantInductLoop(id, od, lane, positionInMeters, vTypes) {} @@ -70,12 +66,12 @@ /* ------------------------------------------------------------------------- * GUIInstantInductLoop::MyWrapper-methods * ----------------------------------------------------------------------- */ -GUIInstantInductLoop::MyWrapper::MyWrapper(GUIInstantInductLoop& detector, SUMOReal pos) +GUIInstantInductLoop::MyWrapper::MyWrapper(GUIInstantInductLoop& detector, double pos) : GUIDetectorWrapper("instant induct loop", detector.getID()), myDetector(detector), myPosition(pos) { myFGPosition = detector.getLane()->geometryPositionAtOffset(pos); - myBoundary.add(myFGPosition.x() + (SUMOReal) 5.5, myFGPosition.y() + (SUMOReal) 5.5); - myBoundary.add(myFGPosition.x() - (SUMOReal) 5.5, myFGPosition.y() - (SUMOReal) 5.5); + myBoundary.add(myFGPosition.x() + (double) 5.5, myFGPosition.y() + (double) 5.5); + myBoundary.add(myFGPosition.x() - (double) 5.5, myFGPosition.y() - (double) 5.5); myFGRotation = -detector.getLane()->getShape().rotationDegreeAtOffset(pos); } @@ -110,9 +106,9 @@ void GUIInstantInductLoop::MyWrapper::drawGL(const GUIVisualizationSettings& s) const { glPushName(getGlID()); - SUMOReal width = (SUMOReal) 2.0 * s.scale; + double width = (double) 2.0 * s.scale; glLineWidth(1.0); - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); // shape glColor3d(1, 0, 1); glPushMatrix(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIInstantInductLoop.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIInstantInductLoop.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIInstantInductLoop.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIInstantInductLoop.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUIInstantInductLoop.h /// @author Daniel Krajzewicz /// @date Aug 2003 -/// @version $Id: GUIInstantInductLoop.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUIInstantInductLoop.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The gui-version of the MSInstantInductLoop /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -53,7 +53,7 @@ * @param[in] position Position of the detector within the lane. */ GUIInstantInductLoop(const std::string& id, OutputDevice& od, - MSLane* const lane, SUMOReal positionInMeters, const std::string& vTypes); + MSLane* const lane, double positionInMeters, const std::string& vTypes); /// @brief Destructor @@ -75,7 +75,7 @@ class MyWrapper : public GUIDetectorWrapper { public: /// @brief Constructor - MyWrapper(GUIInstantInductLoop& detector, SUMOReal pos); + MyWrapper(GUIInstantInductLoop& detector, double pos); /// @brief Destructor ~MyWrapper(); @@ -126,10 +126,10 @@ Position myFGPosition; /// @brief The rotation in full-geometry mode - SUMOReal myFGRotation; + double myFGRotation; /// @brief The position on the lane - SUMOReal myPosition; + double myPosition; private: /// @brief Invalidated copy constructor. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIJunctionWrapper.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIJunctionWrapper.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIJunctionWrapper.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIJunctionWrapper.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Laura Bieker /// @author Andreas Gaubatz /// @date Mon, 1 Jul 2003 -/// @version $Id: GUIJunctionWrapper.cpp 21574 2016-09-29 07:45:02Z namdre $ +/// @version $Id: GUIJunctionWrapper.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // } /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,10 +55,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - //#define GUIJunctionWrapper_DEBUG_DRAW_NODE_SHAPE_VERTICES // =========================================================================== @@ -74,11 +70,7 @@ myBoundary = myJunction.getShape().getBoxBoundary(); } myMaxSize = MAX2(myBoundary.getWidth(), myBoundary.getHeight()); -#ifdef HAVE_INTERNAL_LANES myIsInner = dynamic_cast(&myJunction) != 0; -#else - myIsInner = false; -#endif myAmWaterway = myJunction.getIncoming().size() + myJunction.getOutgoing().size() > 0; for (ConstMSEdgeVector::const_iterator it = myJunction.getIncoming().begin(); it != myJunction.getIncoming().end(); ++it) { if (!(*it)->isInternal() && !isWaterway((*it)->getPermissions())) { @@ -135,13 +127,13 @@ if (!myIsInner && s.drawJunctionShape) { glPushMatrix(); glPushName(getGlID()); - const SUMOReal colorValue = getColorValue(s); + const double colorValue = getColorValue(s); GLHelper::setColor(s.junctionColorer.getScheme().getColor(colorValue)); // recognize full transparency and simply don't draw GLfloat color[4]; glGetFloatv(GL_CURRENT_COLOR, color); - const SUMOReal exaggeration = s.junctionSize.getExaggeration(s); + const double exaggeration = s.junctionSize.getExaggeration(s); if (color[3] != 0 && s.scale * exaggeration > s.junctionSize.minSize) { PositionVector shape = myJunction.getShape(); shape.closePolygon(); @@ -169,7 +161,7 @@ } -SUMOReal +double GUIJunctionWrapper::getColorValue(const GUIVisualizationSettings& s) const { switch (s.junctionColorer.getActive()) { case 0: @@ -224,7 +216,7 @@ #ifdef HAVE_OSG void GUIJunctionWrapper::updateColor(const GUIVisualizationSettings& s) { - const SUMOReal colorValue = getColorValue(s); + const double colorValue = getColorValue(s); const RGBColor& col = s.junctionColorer.getScheme().getColor(colorValue); osg::Vec4ubArray* colors = dynamic_cast(myGeom->getColorArray()); (*colors)[0].set(col.red(), col.green(), col.blue(), col.alpha()); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIJunctionWrapper.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIJunctionWrapper.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIJunctionWrapper.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIJunctionWrapper.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 1 Jul 2003 -/// @version $Id: GUIJunctionWrapper.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIJunctionWrapper.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Holds geometrical values for a junction /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -148,14 +148,14 @@ #endif private: - SUMOReal getColorValue(const GUIVisualizationSettings& s) const; + double getColorValue(const GUIVisualizationSettings& s) const; private: /// @brief A reference to the represented junction MSJunction& myJunction; /// @brief The maximum size (in either x-, or y-dimension) for determining whether to draw or not - SUMOReal myMaxSize; + double myMaxSize; /// @brief The represented junction's boundary Boundary myBoundary; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUILane.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUILane.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUILane.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUILane.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUILane.cpp 21539 2016-09-26 10:59:27Z namdre $ +/// @version $Id: GUILane.cpp 23564 2017-03-21 07:38:52Z namdre $ /// // Representation of a lane in the micro simulation (gui-version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -65,21 +65,17 @@ #include #endif -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - //#define GUILane_DEBUG_DRAW_WALKING_AREA_VERTICES //#define GUILane_DEBUG_DRAW_VERTICES // =========================================================================== // method definitions // =========================================================================== -GUILane::GUILane(const std::string& id, SUMOReal maxSpeed, SUMOReal length, +GUILane::GUILane(const std::string& id, double maxSpeed, double length, MSEdge* const edge, int numericalID, - const PositionVector& shape, SUMOReal width, - SVCPermissions permissions, int index) : - MSLane(id, maxSpeed, length, edge, numericalID, shape, width, permissions, index), + const PositionVector& shape, double width, + SVCPermissions permissions, int index, bool isRampAccel) : + MSLane(id, maxSpeed, length, edge, numericalID, shape, width, permissions, index, isRampAccel), GUIGlObject(GLO_LANE, id), myAmClosed(false) { if (MSGlobals::gUseMesoSim) { @@ -98,8 +94,8 @@ myShapeRotations.push_back(RAD2DEG(atan2(s.x() - f.x(), f.y() - s.y()))); } // - myHalfLaneWidth = (SUMOReal)(myWidth / 2.); - myQuarterLaneWidth = (SUMOReal)(myWidth / 4.); + myHalfLaneWidth = (double)(myWidth / 2.); + myQuarterLaneWidth = (double)(myWidth / 4.); } @@ -113,7 +109,7 @@ // ------ Vehicle insertion ------ void -GUILane::incorporateVehicle(MSVehicle* veh, SUMOReal pos, SUMOReal speed, SUMOReal posLat, +GUILane::incorporateVehicle(MSVehicle* veh, double pos, double speed, double posLat, const MSLane::VehCont::iterator& at, MSMoveReminder::Notification notification) { AbstractMutex::ScopedLocker locker(myLock); @@ -177,7 +173,7 @@ } -SUMOReal +double GUILane::setPartialOccupation(MSVehicle* v) { AbstractMutex::ScopedLocker locker(myLock); return MSLane::setPartialOccupation(v); @@ -204,17 +200,17 @@ MSLink* link = MSLinkContHelper::getConnectingLink(*getLogicalPredecessorLane(), *this); PositionVector shape = getShape(); shape.extrapolate(0.5); // draw on top of the walking area - drawTextAtEnd(toString(link->getIndex()), shape, 0, s.drawLinkJunctionIndex); - drawTextAtEnd(toString(link->getIndex()), shape.reverse(), 0, s.drawLinkJunctionIndex); + GLHelper::drawTextAtEnd(toString(link->getIndex()), shape, 0, s.drawLinkJunctionIndex.size, s.drawLinkJunctionIndex.color); + GLHelper::drawTextAtEnd(toString(link->getIndex()), shape.reverse(), 0, s.drawLinkJunctionIndex.size, s.drawLinkJunctionIndex.color); return; } // draw all links - SUMOReal w = myWidth / (SUMOReal) noLinks; - SUMOReal x1 = myHalfLaneWidth; + double w = myWidth / (double) noLinks; + double x1 = myHalfLaneWidth; const bool lefthand = MSNet::getInstance()->lefthand(); for (int i = noLinks; --i >= 0;) { - SUMOReal x2 = x1 - (SUMOReal)(w / 2.); - drawTextAtEnd(toString(myLinks[lefthand ? noLinks - 1 - i : i]->getIndex()), getShape(), x2, s.drawLinkJunctionIndex); + double x2 = x1 - (double)(w / 2.); + GLHelper::drawTextAtEnd(toString(myLinks[lefthand ? noLinks - 1 - i : i]->getIndex()), getShape(), x2, s.drawLinkJunctionIndex.size, s.drawLinkJunctionIndex.color); x1 -= w; } } @@ -233,41 +229,28 @@ if (linkNo >= 0) { PositionVector shape = getShape(); shape.extrapolate(0.5); // draw on top of the walking area - drawTextAtEnd(toString(linkNo), shape, 0, s.drawLinkTLIndex); - drawTextAtEnd(toString(linkNo), shape.reverse(), 0, s.drawLinkTLIndex); + GLHelper::drawTextAtEnd(toString(linkNo), shape, 0, s.drawLinkTLIndex.size, s.drawLinkTLIndex.color); + GLHelper::drawTextAtEnd(toString(linkNo), shape.reverse(), 0, s.drawLinkTLIndex.size, s.drawLinkTLIndex.color); } return; } // draw all links - SUMOReal w = myWidth / (SUMOReal) noLinks; - SUMOReal x1 = myHalfLaneWidth; + double w = myWidth / (double) noLinks; + double x1 = myHalfLaneWidth; const bool lefthand = MSNet::getInstance()->lefthand(); for (int i = noLinks; --i >= 0;) { - SUMOReal x2 = x1 - (SUMOReal)(w / 2.); + double x2 = x1 - (double)(w / 2.); int linkNo = net.getLinkTLIndex(myLinks[lefthand ? noLinks - 1 - i : i]); if (linkNo < 0) { continue; } - drawTextAtEnd(toString(linkNo), getShape(), x2, s.drawLinkTLIndex); + GLHelper::drawTextAtEnd(toString(linkNo), getShape(), x2, s.drawLinkTLIndex.size, s.drawLinkTLIndex.color); x1 -= w; } } void -GUILane::drawTextAtEnd(const std::string& text, const PositionVector& shape, SUMOReal x, const GUIVisualizationTextSettings& settings) const { - glPushMatrix(); - const Position& end = shape.back(); - const Position& f = shape[-2]; - const SUMOReal rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y()))); - glTranslated(end.x(), end.y(), 0); - glRotated(rot, 0, 0, 1); - GLHelper::drawText(text, Position(x, 0.26), 0, .6 * settings.size / 50, settings.color, 180); - glPopMatrix(); -} - - -void GUILane::drawLinkRules(const GUIVisualizationSettings& s, const GUINet& net) const { int noLinks = (int)myLinks.size(); if (noLinks == 0) { @@ -284,11 +267,11 @@ return; } // draw all links - SUMOReal w = myWidth / (SUMOReal) noLinks; - SUMOReal x1 = 0; + double w = myWidth / (double) noLinks; + double x1 = 0; const bool lefthand = MSNet::getInstance()->lefthand(); for (int i = 0; i < noLinks; ++i) { - SUMOReal x2 = x1 + w; + double x2 = x1 + w; drawLinkRule(s, net, myLinks[lefthand ? noLinks - 1 - i : i], getShape(), x1, x2); x1 = x2; } @@ -296,12 +279,12 @@ void -GUILane::drawLinkRule(const GUIVisualizationSettings& s, const GUINet& net, MSLink* link, const PositionVector& shape, SUMOReal x1, SUMOReal x2) const { +GUILane::drawLinkRule(const GUIVisualizationSettings& s, const GUINet& net, MSLink* link, const PositionVector& shape, double x1, double x2) const { const Position& end = shape.back(); const Position& f = shape[-2]; - const SUMOReal rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y()))); + const double rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y()))); if (link == 0) { - GLHelper::setColor(getLinkColor(LINKSTATE_DEADEND)); + GLHelper::setColor(GUIVisualizationSettings::getLinkColor(LINKSTATE_DEADEND)); glPushMatrix(); glTranslated(end.x(), end.y(), 0); glRotated(rot, 0, 0, 1); @@ -335,7 +318,7 @@ glPushName(getGlID()); break; } - GLHelper::setColor(getLinkColor(link->getState())); + GLHelper::setColor(GUIVisualizationSettings::getLinkColor(link->getState())); if (!(drawAsRailway(s) || drawAsWaterway(s)) || link->getState() != LINKSTATE_MAJOR) { // the white bar should be the default for most railway // links and looks ugly so we do not draw it @@ -359,7 +342,7 @@ // draw all links const Position& end = getShape().back(); const Position& f = getShape()[-2]; - const SUMOReal rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y()))); + const double rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y()))); glPushMatrix(); glColor3d(1, 1, 1); glTranslated(end.x(), end.y(), 0); @@ -376,39 +359,39 @@ switch (dir) { case LINKDIR_STRAIGHT: GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05); - GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25); break; case LINKDIR_TURN: GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05); GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05); GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05); - GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (double) 1, (double) .25); break; case LINKDIR_TURN_LEFTHAND: GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05); GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05); GLHelper::drawBoxLine(Position(-0.5, 2.5), -180, 1, .05); - GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (double) 1, (double) .25); break; case LINKDIR_LEFT: GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05); GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05); - GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (double) 1, (double) .25); break; case LINKDIR_RIGHT: GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05); GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05); - GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (double) 1, (double) .25); break; case LINKDIR_PARTLEFT: GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05); GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05); - GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (double) 1, (double) .25); break; case LINKDIR_PARTRIGHT: GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05); GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05); - GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (double) 1, (double) .25); break; default: break; @@ -425,14 +408,14 @@ if (connected == 0) { continue; } - GLHelper::setColor(getLinkColor((*i)->getState())); + GLHelper::setColor(GUIVisualizationSettings::getLinkColor((*i)->getState())); glBegin(GL_LINES); const Position& p1 = getShape()[-1]; const Position& p2 = connected->getShape()[0]; - glVertex2f(p1.x(), p1.y()); - glVertex2f(p2.x(), p2.y()); + glVertex2d(p1.x(), p1.y()); + glVertex2d(p2.x(), p2.y()); glEnd(); - GLHelper::drawTriangleAtEnd(p1, p2, (SUMOReal) .4, (SUMOReal) .2); + GLHelper::drawTriangleAtEnd(p1, p2, (double) .4, (double) .2); } } @@ -445,14 +428,14 @@ const bool isWalkingArea = myEdge->getPurpose() == MSEdge::EDGEFUNCTION_WALKINGAREA; const bool isInternal = isCrossing || isWalkingArea || myEdge->getPurpose() == MSEdge::EDGEFUNCTION_INTERNAL; bool mustDrawMarkings = false; - SUMOReal exaggeration = s.laneWidthExaggeration; + double exaggeration = s.laneWidthExaggeration; if (MSGlobals::gUseMesoSim) { GUIEdge* myGUIEdge = dynamic_cast(myEdge); exaggeration *= s.edgeScaler.getScheme().getColor(myGUIEdge->getScaleValue(s.edgeScaler.getActive())); } else { exaggeration *= s.laneScaler.getScheme().getColor(getScaleValue(s.laneScaler.getActive())); } - const bool drawDetails = s.scale * exaggeration > 5; + const bool drawDetails = s.scale * exaggeration > 5 && !s.drawForSelecting; if (isCrossing || isWalkingArea) { // draw internal lanes on top of junctions glTranslated(0, 0, GLO_JUNCTION + 0.1); @@ -463,9 +446,8 @@ glTranslated(0, 0, getType()); } // set lane color - if (!MSGlobals::gUseMesoSim) { - setColor(s); - } else { + setColor(s); + if (MSGlobals::gUseMesoSim) { myShapeColors.clear(); const std::vector& segmentColors = static_cast(myEdge)->getSegmentColors(); if (segmentColors.size() > 0) { @@ -493,7 +475,7 @@ GUINet* net = (GUINet*) MSNet::getInstance(); if (drawAsRailway(s)) { // draw as railway - const SUMOReal halfRailWidth = 0.725 * exaggeration; + const double halfRailWidth = 0.725 * exaggeration; if (myShapeColors.size() > 0) { GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, myShapeColors, halfRailWidth); } else { @@ -502,9 +484,7 @@ glColor3d(1, 1, 1); glTranslated(0, 0, .1); GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, halfRailWidth - 0.2); - if (!MSGlobals::gUseMesoSim) { - setColor(s); - } + setColor(s); drawCrossties(0.3 * exaggeration, 1 * exaggeration, 1 * exaggeration); } else if (isCrossing) { if (s.drawCrossingsAndWalkingareas) { @@ -533,10 +513,10 @@ #endif } } else { - const SUMOReal halfWidth = isInternal ? myQuarterLaneWidth : myHalfLaneWidth; + const double halfWidth = isInternal ? myQuarterLaneWidth : myHalfLaneWidth; mustDrawMarkings = !isInternal && myPermissions != 0 && myPermissions != SVC_PEDESTRIAN && exaggeration == 1.0 && !isWaterway(myPermissions); - const int cornerDetail = drawDetails && !isInternal ? s.scale * exaggeration : 0; - const SUMOReal offset = halfWidth * MAX2((SUMOReal)0, (exaggeration - 1)); + const int cornerDetail = drawDetails && !isInternal ? (int)(s.scale * exaggeration) : 0; + const double offset = halfWidth * MAX2(0., (exaggeration - 1)); if (myShapeColors.size() > 0) { GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, myShapeColors, halfWidth * exaggeration, cornerDetail, offset); } else { @@ -548,38 +528,41 @@ #endif glPopMatrix(); // draw ROWs (not for inner lanes) - if ((!isInternal || isCrossing) && drawDetails) { + if ((!isInternal || isCrossing) && (drawDetails || s.drawForSelecting)) { glPushMatrix(); glTranslated(0, 0, GLO_JUNCTION); // must draw on top of junction shape glTranslated(0, 0, .5); - if (MSGlobals::gLateralResolution > 0 && s.showSublanes) { - // draw sublane-borders - GLHelper::setColor(GLHelper::getColor().changedBrightness(51)); - for (SUMOReal offset = -myHalfLaneWidth; offset < myHalfLaneWidth; offset += MSGlobals::gLateralResolution) { - GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, 0.01, 0, offset); + if (drawDetails) { + if (MSGlobals::gLateralResolution > 0 && s.showSublanes) { + // draw sublane-borders + GLHelper::setColor(GLHelper::getColor().changedBrightness(51)); + for (double offset = -myHalfLaneWidth; offset < myHalfLaneWidth; offset += MSGlobals::gLateralResolution) { + GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, 0.01, 0, offset); + } + } + if (s.showLinkDecals && !drawAsRailway(s) && !drawAsWaterway(s) && myPermissions != SVC_PEDESTRIAN) { + drawArrows(); + } + if (s.showLane2Lane) { + // this should be independent to the geometry: + // draw from end of first to the begin of second + drawLane2LaneConnections(); + } + if (s.showLaneDirection) { + drawDirectionIndicators(); + } + glTranslated(0, 0, .1); + if (s.drawLinkJunctionIndex.show) { + drawLinkNo(s); + } + if (s.drawLinkTLIndex.show) { + drawTLSLinkNo(s, *net); } } + // make sure link rules are drawn so tls can be selected via right-click if (s.showLinkRules) { drawLinkRules(s, *net); } - if (s.showLinkDecals && !drawAsRailway(s) && !drawAsWaterway(s) && myPermissions != SVC_PEDESTRIAN) { - drawArrows(); - } - if (s.showLane2Lane) { - // this should be independent to the geometry: - // draw from end of first to the begin of second - drawLane2LaneConnections(); - } - if (s.showLaneDirection) { - drawDirectionIndicators(); - } - glTranslated(0, 0, .1); - if (s.drawLinkJunctionIndex.show) { - drawLinkNo(s); - } - if (s.drawLinkTLIndex.show) { - drawTLSLinkNo(s, *net); - } glPopMatrix(); } } @@ -614,22 +597,20 @@ void -GUILane::drawMarkings(const GUIVisualizationSettings& s, SUMOReal scale) const { +GUILane::drawMarkings(const GUIVisualizationSettings& s, double scale) const { glPushMatrix(); glTranslated(0, 0, GLO_EDGE); - if (!MSGlobals::gUseMesoSim) { - setColor(s); - } + setColor(s); // optionally draw inverse markings if (myIndex > 0 && (myEdge->getLanes()[myIndex - 1]->getPermissions() & myPermissions) != 0) { - SUMOReal mw = (myHalfLaneWidth + SUMO_const_laneOffset + .01) * scale * (MSNet::getInstance()->lefthand() ? -1 : 1); + double mw = (myHalfLaneWidth + SUMO_const_laneOffset + .01) * scale * (MSNet::getInstance()->lefthand() ? -1 : 1); int e = (int) getShape().size() - 1; for (int i = 0; i < e; ++i) { glPushMatrix(); glTranslated(getShape()[i].x(), getShape()[i].y(), 0.1); glRotated(myShapeRotations[i], 0, 0, 1); - for (SUMOReal t = 0; t < myShapeLengths[i]; t += 6) { - const SUMOReal length = MIN2((SUMOReal)3, myShapeLengths[i] - t); + for (double t = 0; t < myShapeLengths[i]; t += 6) { + const double length = MIN2((double)3, myShapeLengths[i] - t); glBegin(GL_QUADS); glVertex2d(-mw, -t); glVertex2d(-mw, -t - length); @@ -656,12 +637,12 @@ // draw bike lane markings onto the intersection glColor3d(1, 1, 1); int e = (int) getShape().size() - 1; - SUMOReal mw = (myHalfLaneWidth + SUMO_const_laneOffset); + double mw = (myHalfLaneWidth + SUMO_const_laneOffset); for (int i = 0; i < e; ++i) { glPushMatrix(); glTranslated(getShape()[i].x(), getShape()[i].y(), GLO_JUNCTION + 0.1); glRotated(myShapeRotations[i], 0, 0, 1); - for (SUMOReal t = 0; t < myShapeLengths[i]; t += 0.5) { + for (double t = 0; t < myShapeLengths[i]; t += 0.5) { // left and right marking for (int side = -1; side <= 1; side += 2) { glBegin(GL_QUADS); @@ -677,7 +658,7 @@ } void -GUILane::drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const { +GUILane::drawCrossties(double length, double spacing, double halfWidth) const { glPushMatrix(); // draw on top of of the white area between the rails glTranslated(0, 0, 0.1); @@ -686,7 +667,7 @@ glPushMatrix(); glTranslated(getShape()[i].x(), getShape()[i].y(), 0.0); glRotated(myShapeRotations[i], 0, 0, 1); - for (SUMOReal t = 0; t < myShapeLengths[i]; t += spacing) { + for (double t = 0; t < myShapeLengths[i]; t += spacing) { glBegin(GL_QUADS); glVertex2d(-halfWidth, -t); glVertex2d(-halfWidth, -t - length); @@ -710,8 +691,8 @@ glPushMatrix(); glTranslated(getShape()[i].x(), getShape()[i].y(), 0.1); glRotated(myShapeRotations[i], 0, 0, 1); - for (SUMOReal t = 0; t < myShapeLengths[i]; t += myWidth) { - const SUMOReal length = MIN2((SUMOReal)myHalfLaneWidth, myShapeLengths[i] - t); + for (double t = 0; t < myShapeLengths[i]; t += myWidth) { + const double length = MIN2((double)myHalfLaneWidth, myShapeLengths[i] - t); glBegin(GL_TRIANGLES); glVertex2d(0, -t - length); glVertex2d(-myQuarterLaneWidth, -t); @@ -738,8 +719,8 @@ buildSelectionPopupEntry(ret); // buildShowParamsPopupEntry(ret, false); - const SUMOReal pos = interpolateGeometryPosToLanePos(myShape.nearest_offset_to_point2D(parent.getPositionInformation())); - const SUMOReal height = myShape.positionAtOffset2D(myShape.nearest_offset_to_point2D(parent.getPositionInformation())).z(); + const double pos = interpolateGeometryPosToLanePos(myShape.nearest_offset_to_point2D(parent.getPositionInformation())); + const double height = myShape.positionAtOffset2D(myShape.nearest_offset_to_point2D(parent.getPositionInformation())).z(); new FXMenuCommand(ret, ("pos: " + toString(pos) + " height: " + toString(height)).c_str(), 0, 0, 0); new FXMenuSeparator(ret); buildPositionCopyEntry(ret, false); @@ -770,11 +751,11 @@ ret->mkItem("length [m]", false, myLength); ret->mkItem("width [m]", false, myWidth); ret->mkItem("street name", false, myEdge->getStreetName()); - ret->mkItem("stored traveltime [s]", true, new FunctionBinding(this, &GUILane::getStoredEdgeTravelTime)); - ret->mkItem("loaded weight", true, new FunctionBinding(this, &GUILane::getLoadedEdgeWeight)); - ret->mkItem("routing speed [m/s]", true, new FunctionBinding(myEdge, &MSEdge::getRoutingSpeed)); - ret->mkItem("brutto occupancy [%]", true, new FunctionBinding(this, &GUILane::getBruttoOccupancy, 100.)); - ret->mkItem("netto occupancy [%]", true, new FunctionBinding(this, &GUILane::getNettoOccupancy, 100.)); + ret->mkItem("stored traveltime [s]", true, new FunctionBinding(this, &GUILane::getStoredEdgeTravelTime)); + ret->mkItem("loaded weight", true, new FunctionBinding(this, &GUILane::getLoadedEdgeWeight)); + ret->mkItem("routing speed [m/s]", true, new FunctionBinding(myEdge, &MSEdge::getRoutingSpeed)); + ret->mkItem("brutto occupancy [%]", true, new FunctionBinding(this, &GUILane::getBruttoOccupancy, 100.)); + ret->mkItem("netto occupancy [%]", true, new FunctionBinding(this, &GUILane::getNettoOccupancy, 100.)); ret->mkItem("edge type", false, myEdge->getEdgeType()); ret->mkItem("priority", false, myEdge->getPriority()); ret->mkItem("allowed vehicle class", false, getVehicleClassNames(myPermissions)); @@ -809,50 +790,50 @@ } -const std::vector& +const std::vector& GUILane::getShapeRotations() const { return myShapeRotations; } -const std::vector& +const std::vector& GUILane::getShapeLengths() const { return myShapeLengths; } -SUMOReal +double GUILane::firstWaitingTime() const { return myVehicles.size() == 0 ? 0 : myVehicles.back()->getWaitingSeconds(); } -SUMOReal +double GUILane::getEdgeLaneNumber() const { - return (SUMOReal) myEdge->getLanes().size(); + return (double) myEdge->getLanes().size(); } -SUMOReal +double GUILane::getStoredEdgeTravelTime() const { MSEdgeWeightsStorage& ews = MSNet::getInstance()->getWeightsStorage(); if (!ews.knowsTravelTime(myEdge)) { return -1; } else { - SUMOReal value(0); + double value(0); ews.retrieveExistingTravelTime(myEdge, STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()), value); return value; } } -SUMOReal +double GUILane::getLoadedEdgeWeight() const { MSEdgeWeightsStorage& ews = MSNet::getInstance()->getWeightsStorage(); if (!ews.knowsEffort(myEdge)) { return -1; } else { - SUMOReal value(-1); + double value(-1); ews.retrieveExistingEffort(myEdge, STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()), value); return value; } @@ -861,9 +842,13 @@ void GUILane::setColor(const GUIVisualizationSettings& s) const { - const GUIColorer& c = s.laneColorer; - if (!setFunctionalColor(c.getActive()) && !setMultiColor(c)) { - GLHelper::setColor(c.getScheme().getColor(getColorValue(c.getActive()))); + if (MSGlobals::gUseMesoSim) { + GLHelper::setColor(static_cast(myEdge)->getMesoColor()); + } else { + const GUIColorer& c = s.laneColorer; + if (!setFunctionalColor(c.getActive()) && !setMultiColor(c)) { + GLHelper::setColor(c.getScheme().getColor(getColorValue(c.getActive()))); + } } } @@ -872,7 +857,7 @@ GUILane::setFunctionalColor(int activeScheme) const { switch (activeScheme) { case 18: { - SUMOReal hue = GeomHelper::naviDegree(myShape.beginEndAngle()); // [0-360] + double hue = GeomHelper::naviDegree(myShape.beginEndAngle()); // [0-360] GLHelper::setColor(RGBColor::fromHSV(hue, 1., 1.)); return true; } @@ -894,7 +879,7 @@ return true; case 24: // color by inclination at segment start for (int ii = 1; ii < (int)myShape.size(); ++ii) { - const SUMOReal inc = (myShape[ii].z() - myShape[ii - 1].z()) / MAX2(POSITION_EPS, myShape[ii].distanceTo2D(myShape[ii - 1])); + const double inc = (myShape[ii].z() - myShape[ii - 1].z()) / MAX2(POSITION_EPS, myShape[ii].distanceTo2D(myShape[ii - 1])); myShapeColors.push_back(c.getScheme().getColor(inc)); } return true; @@ -904,7 +889,7 @@ } -SUMOReal +double GUILane::getColorValue(int activeScheme) const { switch (activeScheme) { case 0: @@ -931,7 +916,7 @@ return gSelected.isSelected(getType(), getGlID()) || gSelected.isSelected(GLO_EDGE, dynamic_cast(myEdge)->getGlID()); case 2: - return (SUMOReal)myPermissions; + return (double)myPermissions; case 3: return getSpeedLimit(); case 4: @@ -964,7 +949,7 @@ if (!ews.knowsTravelTime(myEdge)) { return -1; } else { - SUMOReal value(0); + double value(0); ews.retrieveExistingTravelTime(myEdge, 0, value); return 100 * myLength / value / getSpeedLimit(); } @@ -1007,7 +992,7 @@ } -SUMOReal +double GUILane::getScaleValue(int activeScheme) const { switch (activeScheme) { case 0: @@ -1047,7 +1032,7 @@ if (!ews.knowsTravelTime(myEdge)) { return -1; } else { - SUMOReal value(0); + double value(0); ews.retrieveExistingTravelTime(myEdge, 0, value); return 100 * myLength / value / getSpeedLimit(); } @@ -1121,9 +1106,9 @@ GUILane::splitAtSegments(const PositionVector& shape) { assert(MSGlobals::gUseMesoSim); int no = MELoop::numSegmentsFor(myLength, OptionsCont::getOptions().getFloat("meso-edgelength")); - const SUMOReal slength = myLength / no; + const double slength = myLength / no; PositionVector result = shape; - SUMOReal offset = 0; + double offset = 0; for (int i = 0; i < no; ++i) { offset += slength; Position pos = shape.positionAtOffset(offset); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUILane.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUILane.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUILane.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUILane.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUILane.h 21514 2016-09-22 13:00:49Z namdre $ +/// @version $Id: GUILane.h 23564 2017-03-21 07:38:52Z namdre $ /// // Representation of a lane in the micro simulation (gui-version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -82,10 +82,10 @@ * @see SUMOVehicleClass * @see MSLane */ - GUILane(const std::string& id, SUMOReal maxSpeed, - SUMOReal length, MSEdge* const edge, int numericalID, - const PositionVector& shape, SUMOReal width, - SVCPermissions permissions, int index); + GUILane(const std::string& id, double maxSpeed, + double length, MSEdge* const edge, int numericalID, + const PositionVector& shape, double width, + SVCPermissions permissions, int index, bool isRampAccel); /// @brief Destructor @@ -159,7 +159,7 @@ * @param[in] v The vehicle which laps into this lane * @return This lane's length */ - SUMOReal setPartialOccupation(MSVehicle* v); + double setPartialOccupation(MSVehicle* v); /** @brief Removes the information about a vehicle lapping into this lane * @param[in] v The vehicle which laps into this lane @@ -210,32 +210,32 @@ const PositionVector& getShape() const; - const std::vector& getShapeRotations() const; - const std::vector& getShapeLengths() const; + const std::vector& getShapeRotations() const; + const std::vector& getShapeLengths() const; - SUMOReal firstWaitingTime() const; + double firstWaitingTime() const; /// @brief draw lane borders and white markings - void drawMarkings(const GUIVisualizationSettings& s, SUMOReal scale) const; + void drawMarkings(const GUIVisualizationSettings& s, double scale) const; /// @brief bike lane markings on top of an intersection void drawBikeMarkings() const; /// @brief draw crossties for railroads or pedestrian crossings - void drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const; + void drawCrossties(double length, double spacing, double halfWidth) const; /// @brief direction indicators for lanes void drawDirectionIndicators() const; - SUMOReal getEdgeLaneNumber() const; + double getEdgeLaneNumber() const; /** @brief Returns the stored traveltime for the edge of this lane */ - SUMOReal getStoredEdgeTravelTime() const; + double getStoredEdgeTravelTime() const; /** @brief Returns the loaded weight (effort) for the edge of this lane */ - SUMOReal getLoadedEdgeWeight() const; + double getLoadedEdgeWeight() const; #ifdef HAVE_OSG void setGeometry(osg::Geometry* geom) { @@ -269,7 +269,7 @@ * @param[in] notification The cause of insertion (i.e. departure, teleport, parking) defaults to departure * @see MSLane::incorporateVehicle */ - virtual void incorporateVehicle(MSVehicle* veh, SUMOReal pos, SUMOReal speed, SUMOReal posLat, + virtual void incorporateVehicle(MSVehicle* veh, double pos, double speed, double posLat, const MSLane::VehCont::iterator& at, MSMoveReminder::Notification notification = MSMoveReminder::NOTIFICATION_DEPARTED); @@ -277,9 +277,8 @@ /// @brief helper methods void drawLinkNo(const GUIVisualizationSettings& s) const; void drawTLSLinkNo(const GUIVisualizationSettings& s, const GUINet& net) const; - void drawTextAtEnd(const std::string& text, const PositionVector& shape, SUMOReal x, const GUIVisualizationTextSettings& settings) const; void drawLinkRules(const GUIVisualizationSettings& s, const GUINet& net) const; - void drawLinkRule(const GUIVisualizationSettings& s, const GUINet& net, MSLink* link, const PositionVector& shape, SUMOReal x1, SUMOReal x2) const; + void drawLinkRule(const GUIVisualizationSettings& s, const GUINet& net, MSLink* link, const PositionVector& shape, double x1, double x2) const; void drawArrows() const; void drawLane2LaneConnections() const; @@ -289,10 +288,10 @@ private: /// @brief gets the color value according to the current scheme index - SUMOReal getColorValue(int activeScheme) const; + double getColorValue(int activeScheme) const; /// @brief gets the scaling value according to the current scheme index - SUMOReal getScaleValue(int activeScheme) const; + double getScaleValue(int activeScheme) const; /// @brief sets the color according to the current scheme index and some lane function bool setFunctionalColor(int activeScheme) const; @@ -310,10 +309,10 @@ bool drawAsWaterway(const GUIVisualizationSettings& s) const; /// The rotations of the shape parts - std::vector myShapeRotations; + std::vector myShapeRotations; /// The lengths of the shape parts - std::vector myShapeLengths; + std::vector myShapeLengths; /// The color of the shape parts (cached) mutable std::vector myShapeColors; @@ -322,10 +321,10 @@ std::vector myShapeSegments; /// @brief Half of lane width, for speed-up - SUMOReal myHalfLaneWidth; + double myHalfLaneWidth; /// @brief Quarter of lane width, for speed-up - SUMOReal myQuarterLaneWidth; + double myQuarterLaneWidth; #ifdef HAVE_OSG osg::Geometry* myGeom; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUILaneSpeedTrigger.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUILaneSpeedTrigger.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUILaneSpeedTrigger.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUILaneSpeedTrigger.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 26.04.2004 -/// @version $Id: GUILaneSpeedTrigger.cpp 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: GUILaneSpeedTrigger.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Changes the speed allowed on a set of lanes (gui version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -53,10 +53,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping @@ -182,7 +178,7 @@ long GUILaneSpeedTrigger::GUIManip_LaneSpeedTrigger::onCmdUserDef(FXObject*, FXSelector, void*) { - mySpeed = (SUMOReal)(myUserDefinedSpeed->getValue() / 3.6); + mySpeed = (double)(myUserDefinedSpeed->getValue() / 3.6); static_cast(myObject)->setOverridingValue(mySpeed); myParent->updateChildren(); return 1; @@ -201,7 +197,7 @@ long GUILaneSpeedTrigger::GUIManip_LaneSpeedTrigger::onCmdPreDef(FXObject*, FXSelector, void*) { - mySpeed = (SUMOReal)(SUMOReal)((myPredefinedValues->getCurrentItem() * 20 + 20) / 3.6); + mySpeed = (double)(double)((myPredefinedValues->getCurrentItem() * 20 + 20) / 3.6); static_cast(myObject)->setOverridingValue(mySpeed); myParent->updateChildren(); return 1; @@ -223,16 +219,16 @@ static_cast(myObject)->setOverriding(true); switch (myChosenValue) { case 0: - mySpeed = (SUMOReal) static_cast(myObject)->getDefaultSpeed(); + mySpeed = (double) static_cast(myObject)->getDefaultSpeed(); break; case 1: - mySpeed = (SUMOReal) static_cast(myObject)->getLoadedSpeed(); + mySpeed = (double) static_cast(myObject)->getLoadedSpeed(); break; case 2: - mySpeed = (SUMOReal)((myPredefinedValues->getCurrentItem() * 20 + 20) / 3.6); + mySpeed = (double)((myPredefinedValues->getCurrentItem() * 20 + 20) / 3.6); break; case 3: - mySpeed = (SUMOReal)(myUserDefinedSpeed->getValue() / 3.6); + mySpeed = (double)(myUserDefinedSpeed->getValue() / 3.6); break; default: // hmmm, should not happen @@ -317,7 +313,7 @@ new GUIParameterTableWindow(app, *this, 1); // add items ret->mkItem("speed [m/s]", true, - new FunctionBinding(this, &GUILaneSpeedTrigger::getCurrentSpeed)); + new FunctionBinding(this, &GUILaneSpeedTrigger::getCurrentSpeed)); // close building ret->closeBuilding(); return ret; @@ -329,10 +325,10 @@ glPushName(getGlID()); glPushMatrix(); glTranslated(0, 0, getType()); - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); for (int i = 0; i < (int)myFGPositions.size(); ++i) { const Position& pos = myFGPositions[i]; - SUMOReal rot = myFGRotations[i]; + double rot = myFGRotations[i]; glPushMatrix(); glScaled(exaggeration, exaggeration, 1); glTranslated(pos.x(), pos.y(), 0); @@ -347,24 +343,24 @@ } } glColor3d(1, 0, 0); - GLHelper::drawFilledCircle((SUMOReal) 1.3, noPoints); + GLHelper::drawFilledCircle((double) 1.3, noPoints); if (s.scale >= 5) { glTranslated(0, 0, .1); glColor3d(0, 0, 0); - GLHelper::drawFilledCircle((SUMOReal) 1.1, noPoints); + GLHelper::drawFilledCircle((double) 1.1, noPoints); // draw the speed string // not if scale to low // compute - SUMOReal value = (SUMOReal) getCurrentSpeed(); + double value = (double) getCurrentSpeed(); if (myShowAsKMH) { value *= 3.6f; if (((int) value + 1) % 10 == 0) { - value = (SUMOReal)(((int) value + 1) / 10 * 10); + value = (double)(((int) value + 1) / 10 * 10); } } if (value != myLastValue) { myLastValue = value; - myLastValueString = toString(myLastValue); + myLastValueString = toString(myLastValue); std::string::size_type idx = myLastValueString.find('.'); if (idx != std::string::npos) { if (idx > myLastValueString.length()) { @@ -379,7 +375,7 @@ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); pfSetPosition(0, 0); pfSetScale(1.2f); - SUMOReal w = pfdkGetStringWidth(myLastValueString.c_str()); + double w = pfdkGetStringWidth(myLastValueString.c_str()); glRotated(180, 0, 1, 0); glTranslated(-w / 2., 0.3, 0); pfDrawString(myLastValueString.c_str()); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUILaneSpeedTrigger.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUILaneSpeedTrigger.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUILaneSpeedTrigger.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUILaneSpeedTrigger.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 26.04.2004 -/// @version $Id: GUILaneSpeedTrigger.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUILaneSpeedTrigger.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Changes the speed allowed on a set of lanes (gui version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -166,7 +166,7 @@ FXDataTarget myChosenTarget; - SUMOReal mySpeed; + double mySpeed; FXDataTarget mySpeedTarget; @@ -186,7 +186,7 @@ typedef std::vector PosCont; /// Definition of a rotation container - typedef std::vector RotCont; + typedef std::vector RotCont; private: /// The positions in full-geometry mode @@ -202,7 +202,7 @@ bool myShowAsKMH; /// Storage for last value to avoid string recomputation - mutable SUMOReal myLastValue; + mutable double myLastValue; /// Storage for speed string to avoid recomputation mutable std::string myLastValueString; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUINet.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUINet.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUINet.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUINet.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Sept 2002 -/// @version $Id: GUINet.cpp 21790 2016-10-25 12:37:24Z behrisch $ +/// @version $Id: GUINet.cpp 23987 2017-04-20 09:22:50Z namdre $ /// // A MSNet extended by some values for usage within the gui /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -64,16 +64,12 @@ #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // definition of static variables used for visualisation of objects' values // =========================================================================== -template std::vector< GLObjectValuePassConnector* > GLObjectValuePassConnector::myContainer; -template MFXMutex GLObjectValuePassConnector::myLock; +template std::vector< GLObjectValuePassConnector* > GLObjectValuePassConnector::myContainer; +template MFXMutex GLObjectValuePassConnector::myLock; template std::vector< GLObjectValuePassConnector >* > GLObjectValuePassConnector >::myContainer; template MFXMutex GLObjectValuePassConnector >::myLock; @@ -221,7 +217,7 @@ void GUINet::guiSimulationStep() { - GLObjectValuePassConnector::updateAll(); + GLObjectValuePassConnector::updateAll(); GLObjectValuePassConnector >::updateAll(); } @@ -336,39 +332,39 @@ */ -SUMOReal +double GUINet::getRTFactor() const { if (myLastSimDuration == 0) { return -1; } - return (SUMOReal) 1000. / (SUMOReal) myLastSimDuration; + return (double) 1000. / (double) myLastSimDuration; } -SUMOReal +double GUINet::getUPS() const { if (myLastSimDuration == 0) { return -1; } - return (SUMOReal) myLastVehicleMovementCount / (SUMOReal) myLastSimDuration * (SUMOReal) 1000.; + return (double) myLastVehicleMovementCount / (double) myLastSimDuration * (double) 1000.; } -SUMOReal +double GUINet::getMeanRTFactor(int duration) const { if (myOverallSimDuration == 0) { return -1; } - return ((SUMOReal)(duration) * (SUMOReal) 1000. / (SUMOReal)myOverallSimDuration); + return ((double)(duration) * (double) 1000. / (double)myOverallSimDuration); } -SUMOReal +double GUINet::getMeanUPS() const { if (myOverallSimDuration == 0) { return -1; } - return ((SUMOReal)myVehiclesMoved / (SUMOReal)myOverallSimDuration * (SUMOReal) 1000.); + return ((double)myVehiclesMoved / (double)myOverallSimDuration * (double) 1000.); } @@ -416,7 +412,7 @@ GUINet::getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView&) { GUIParameterTableWindow* ret = - new GUIParameterTableWindow(app, *this, 28); + new GUIParameterTableWindow(app, *this, 29); // add items ret->mkItem("loaded vehicles [#]", true, new FunctionBinding(&getVehicleControl(), &MSVehicleControl::getLoadedVehicleNo)); @@ -448,24 +444,25 @@ ret->mkItem("simulation duration [ms]", true, new FunctionBinding(this, &GUINet::getSimDuration)); /* ret->mkItem("visualisation duration [ms]", true, - new CastingFunctionBinding( + new CastingFunctionBinding( &(getNet()), &GUINet::getVisDuration)); */ ret->mkItem("idle duration [ms]", true, new FunctionBinding(this, &GUINet::getIdleDuration)); - ret->mkItem("duration factor []", true, new FunctionBinding(this, &GUINet::getRTFactor)); + ret->mkItem("duration factor []", true, new FunctionBinding(this, &GUINet::getRTFactor)); /* ret->mkItem("mean duration factor []", true, - new FuncBinding_IntParam( + new FuncBinding_IntParam( &(getNet()), &GUINet::getMeanRTFactor), 1); */ - ret->mkItem("ups [#]", true, new FunctionBinding(this, &GUINet::getUPS)); - ret->mkItem("mean ups [#]", true, new FunctionBinding(this, &GUINet::getMeanUPS)); + ret->mkItem("ups [#]", true, new FunctionBinding(this, &GUINet::getUPS)); + ret->mkItem("mean ups [#]", true, new FunctionBinding(this, &GUINet::getMeanUPS)); if (OptionsCont::getOptions().getBool("duration-log.statistics")) { - ret->mkItem("avg. trip length [m]", true, new FunctionBinding(this, &GUINet::getAvgRouteLength)); - ret->mkItem("avg. trip duration [s]", true, new FunctionBinding(this, &GUINet::getAvgDuration)); - ret->mkItem("avg. trip waiting time [s]", true, new FunctionBinding(this, &GUINet::getAvgWaitingTime)); - ret->mkItem("avg. trip time loss [s]", true, new FunctionBinding(this, &GUINet::getAvgTimeLoss)); - ret->mkItem("avg. trip depart delay [s]", true, new FunctionBinding(this, &GUINet::getAvgDepartDelay)); + ret->mkItem("avg. trip length [m]", true, new FunctionBinding(this, &GUINet::getAvgRouteLength)); + ret->mkItem("avg. trip duration [s]", true, new FunctionBinding(this, &GUINet::getAvgDuration)); + ret->mkItem("avg. trip waiting time [s]", true, new FunctionBinding(this, &GUINet::getAvgWaitingTime)); + ret->mkItem("avg. trip time loss [s]", true, new FunctionBinding(this, &GUINet::getAvgTimeLoss)); + ret->mkItem("avg. trip depart delay [s]", true, new FunctionBinding(this, &GUINet::getAvgDepartDelay)); + ret->mkItem("avg. trip speed [m/s]", true, new FunctionBinding(this, &GUINet::getAvgTripSpeed)); } } ret->mkItem("nodes [#]", false, (int)myJunctions->size()); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUINet.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUINet.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUINet.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUINet.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUINet.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: GUINet.h 23987 2017-04-20 09:22:50Z namdre $ /// // A MSNet extended by some values for usage within the gui /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -180,16 +180,16 @@ /// Returns the simulation speed as a factor to real time - SUMOReal getRTFactor() const; + double getRTFactor() const; /// Returns the update per seconds rate - SUMOReal getUPS() const; + double getUPS() const; /// Returns the simulation speed as a factor to real time - SUMOReal getMeanRTFactor(int duration) const; + double getMeanRTFactor(int duration) const; /// Returns the update per seconds rate - SUMOReal getMeanUPS() const; + double getMeanUPS() const; // Returns the duration of the last step's visualisation part (in ms) //int getVisDuration() const; @@ -207,21 +207,24 @@ void setIdleDuration(int val); //} - SUMOReal getAvgRouteLength() const { + double getAvgRouteLength() const { return MSDevice_Tripinfo::getAvgRouteLength(); } - SUMOReal getAvgDuration() const { + double getAvgDuration() const { return MSDevice_Tripinfo::getAvgDuration(); } - SUMOReal getAvgWaitingTime() const { + double getAvgWaitingTime() const { return MSDevice_Tripinfo::getAvgWaitingTime(); } - SUMOReal getAvgTimeLoss() const { + double getAvgTimeLoss() const { return MSDevice_Tripinfo::getAvgTimeLoss(); } - SUMOReal getAvgDepartDelay() const { + double getAvgDepartDelay() const { return MSDevice_Tripinfo::getAvgDepartDelay(); } + double getAvgTripSpeed() const { + return MSDevice_Tripinfo::getAvgDuration() != 0 ? MSDevice_Tripinfo::getAvgRouteLength() / MSDevice_Tripinfo::getAvgDuration() : 0; + } /** @brief Returns the person control * diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIParkingArea.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIParkingArea.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIParkingArea.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIParkingArea.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,211 @@ +/****************************************************************************/ +/// @file GUIParkingArea.h +/// @author Mirco Sturari +/// @author Jakob Erdmann +/// @date Tue, 19.01.2016 +/// @version $Id: GUIParkingArea.cpp 23529 2017-03-18 10:22:36Z behrisch $ +/// +// A area where vehicles can park next to the road (gui version) +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "GUINet.h" +#include "GUIEdge.h" +#include "GUIContainer.h" +#include "GUIParkingArea.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +// =========================================================================== +// method definitions +// =========================================================================== +GUIParkingArea::GUIParkingArea(const std::string& id, const std::vector& lines, MSLane& lane, + double frompos, double topos, unsigned int capacity, + double width, double length, double angle) + : MSParkingArea(id, lines, lane, frompos, topos, capacity, width, length, angle), + GUIGlObject_AbstractAdd("parkingArea", GLO_TRIGGER, id) { + + myShapeRotations.reserve(myShape.size() - 1); + myShapeLengths.reserve(myShape.size() - 1); + int e = (int) myShape.size() - 1; + for (int i = 0; i < e; ++i) { + const Position& f = myShape[i]; + const Position& s = myShape[i + 1]; + myShapeLengths.push_back(f.distanceTo(s)); + myShapeRotations.push_back((double) atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double) PI); + } + PositionVector tmp = myShape; + tmp.move2side(lane.getWidth() + myWidth); + mySignPos = tmp.getLineCenter(); + mySignRot = 0; + if (tmp.length() != 0) { + mySignRot = myShape.rotationDegreeAtOffset(double((myShape.length() / 2.))); + mySignRot -= 90; + } +} + +GUIParkingArea::~GUIParkingArea() {} + + +GUIGLObjectPopupMenu* +GUIParkingArea::getPopUpMenu(GUIMainWindow& app, + GUISUMOAbstractView& parent) { + GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this); + buildPopupHeader(ret, app); + buildCenterPopupEntry(ret); + buildNameCopyPopupEntry(ret); + buildSelectionPopupEntry(ret); + buildShowParamsPopupEntry(ret); + buildPositionCopyEntry(ret, false); + return ret; +} + + +GUIParameterTableWindow* +GUIParkingArea::getParameterWindow(GUIMainWindow& app, + GUISUMOAbstractView&) { + GUIParameterTableWindow* ret = + new GUIParameterTableWindow(app, *this, 4); + // add items + ret->mkItem("begin position [m]", false, myBegPos); + ret->mkItem("end position [m]", false, myEndPos); + ret->mkItem("occupancy [#]", true, getOccupancy()); + ret->mkItem("capacity [#]", false, getCapacity()); + // close building + ret->closeBuilding(); + return ret; +} + + +void +GUIParkingArea::drawGL(const GUIVisualizationSettings& s) const { + glPushName(getGlID()); + glPushMatrix(); + RGBColor grey(177, 184, 186, 171); + RGBColor blue(83, 89, 172, 255); + RGBColor red(255, 0, 0, 255); + RGBColor green(0, 255, 0, 255); + // draw the area + glTranslated(0, 0, getType()); + GLHelper::setColor(blue); + GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, myWidth / 2.); + // draw details unless zoomed out to far + const double exaggeration = s.addSize.getExaggeration(s); + if (s.scale * exaggeration >= 10) { + // draw the lots + glTranslated(0, 0, .1); + std::map::const_iterator i; + for (i = mySpaceOccupancies.begin(); i != mySpaceOccupancies.end(); i++) { + glPushMatrix(); + glTranslated((*i).second.myPosition.x(), (*i).second.myPosition.y(), (*i).second.myPosition.z()); + glRotated((*i).second.myRotation, 0, 0, 1); + Position pos = (*i).second.myPosition; + PositionVector geom; + double w = (*i).second.myWidth / 2.; + double h = (*i).second.myLength; + geom.push_back(Position(- w, + 0, 0.)); + geom.push_back(Position(+ w, + 0, 0.)); + geom.push_back(Position(+ w, + h, 0.)); + geom.push_back(Position(- w, + h, 0.)); + geom.push_back(Position(- w, + 0, 0.)); + /* + geom.push_back(Position(pos.x(), pos.y(), pos.z())); + geom.push_back(Position(pos.x() + (*l).second.myWidth, pos.y(), pos.z())); + geom.push_back(Position(pos.x() + (*l).second.myWidth, pos.y() - (*l).second.myLength, pos.z())); + geom.push_back(Position(pos.x(), pos.y() - (*l).second.myLength, pos.z())); + geom.push_back(Position(pos.x(), pos.y(), pos.z())); + */ + GLHelper::setColor((*i).second.vehicle == 0 ? green : red); + GLHelper::drawBoxLines(geom, 0.1); + glPopMatrix(); + } + GLHelper::setColor(blue); + // draw the lines + for (size_t i = 0; i != myLines.size(); ++i) { + glPushMatrix(); + glTranslated(mySignPos.x(), mySignPos.y(), 0); + glRotated(180, 1, 0, 0); + glRotated(mySignRot, 0, 0, 1); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + pfSetPosition(0, 0); + pfSetScale(1.f); + glScaled(exaggeration, exaggeration, 1); + glTranslated(1.2, -(double)i, 0); + pfDrawString(myLines[i].c_str()); + glPopMatrix(); + } + // draw the sign + glTranslated(mySignPos.x(), mySignPos.y(), 0); + int noPoints = 9; + if (s.scale * exaggeration > 25) { + noPoints = MIN2((int)(9.0 + (s.scale * exaggeration) / 10.0), 36); + } + glScaled(exaggeration, exaggeration, 1); + GLHelper::drawFilledCircle((double) 1.1, noPoints); + glTranslated(0, 0, .1); + GLHelper::setColor(grey); + GLHelper::drawFilledCircle((double) 0.9, noPoints); + if (s.scale * exaggeration >= 4.5) { + GLHelper::drawText("P", Position(), .1, 1.6 * exaggeration, blue, mySignRot); + } + } + glPopMatrix(); + glPopName(); + drawName(getCenteringBoundary().getCenter(), s.scale, s.addName); + for (std::vector::const_iterator i = myWaitingTransportables.begin(); i != myWaitingTransportables.end(); ++i) { + glTranslated(0, 1, 0); // make multiple containers viewable + static_cast(*i)->drawGL(s); + } +} + + +Boundary +GUIParkingArea::getCenteringBoundary() const { + Boundary b = myShape.getBoxBoundary(); + b.grow(20); + return b; +} + + + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIParkingArea.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIParkingArea.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIParkingArea.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIParkingArea.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,156 @@ +/****************************************************************************/ +/// @file GUIParkingArea.h +/// @author Mirco Sturari +/// @date Tue, 19.01.2016 +/// @version $Id: GUIParkingArea.h 23150 2017-02-27 12:08:30Z behrisch $ +/// +// A area where vehicles can park next to the road (gui version) +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GUIParkingArea_h +#define GUIParkingArea_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +// =========================================================================== +// class declarations +// =========================================================================== +class MSNet; +class MSLane; +class GUIManipulator; + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class GUIParkingArea + * @brief A lane area vehicles can halt at (gui-version) + * + * This gui-version of a parking-area extends MSStoppingPlace by methods for displaying + * and interaction. + * + * @see MSStoppingPlace + * @see GUIGlObject_AbstractAdd + * @see GUIGlObject + */ +class GUIParkingArea : public MSParkingArea, public GUIGlObject_AbstractAdd { +public: + + /** @brief Constructor + * @param[in] idStorage The gl-id storage for giving this object an gl-id + * @param[in] id The id of the parking area + * @param[in] lines Names of the parking lines that halt on this parking area + * @param[in] lane The lane the parking area is placed on + * @param[in] begPos Begin position of the parking area on the lane + * @param[in] endPos End position of the parking area on the lane + * @param[in] capacity Capacity of the parking area (if > 0 lots are generated, otherwise expected addLotEntry()) + * @param[in] width Default width of the lot rectangle (if = 0 is computed from line.getWidth()) + * @param[in] length Default length of the lot rectangle (if = 0 is computed from endPos-begPos) + * @param[in] angle Default angle of the lot rectangle relative to lane direction (if = 0 is computed ... TODO) + */ + GUIParkingArea(const std::string& id, + const std::vector& lines, MSLane& lane, + double frompos, double topos, unsigned int capacity, + double width, double length, double angle); + + + /// @brief Destructor + ~GUIParkingArea(); + + + + /// @name inherited from GUIGlObject + //@{ + + /** @brief Returns an own popup-menu + * + * @param[in] app The application needed to build the popup-menu + * @param[in] parent The parent window needed to build the popup-menu + * @return The built popup-menu + * @see GUIGlObject::getPopUpMenu + */ + GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, + GUISUMOAbstractView& parent); + + + /** @brief Returns an own parameter window + * + * Container stops have no parameter windows (yet). + * + * @param[in] app The application needed to build the parameter window + * @param[in] parent The parent window needed to build the parameter window + * @return The built parameter window (always 0 in this case) + * @see GUIGlObject::getParameterWindow + */ + GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, + GUISUMOAbstractView& parent); + + + /** @brief Returns the boundary to which the view shall be centered in order to show the object + * + * @return The boundary the object is within + * @see GUIGlObject::getCenteringBoundary + */ + Boundary getCenteringBoundary() const; + + + /** @brief Draws the object + * @param[in] s The settings for the current view (may influence drawing) + * @see GUIGlObject::drawGL + */ + void drawGL(const GUIVisualizationSettings& s) const; + //@} + + +private: + /// @brief The rotations of the shape parts + std::vector myShapeRotations; + + /// @brief The lengths of the shape parts + std::vector myShapeLengths; + + /// @brief The position of the sign + Position mySignPos; + + /// @brief The rotation of the sign + double mySignRot; + +}; + + +#endif + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIPerson.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIPerson.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIPerson.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIPerson.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIPerson.cpp 21313 2016-08-22 10:26:46Z namdre $ +/// @version $Id: GUIPerson.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A MSPerson extended by some values for usage within the gui /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -59,10 +59,6 @@ #include "GUIEdge.h" #include "GUIPerson.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - //#define GUIPerson_DEBUG_DRAW_WALKINGAREA_PATHS 1 // =========================================================================== @@ -136,9 +132,8 @@ long GUIPerson::GUIPersonPopupMenu::onCmdStartTrack(FXObject*, FXSelector, void*) { assert(myObject->getType() == GLO_PERSON); - if (!static_cast(myObject)->hasActiveAddVisualisation(myParent, VO_TRACKED)) { + if (myParent->getTrackedID() != static_cast(myObject)->getGlID()) { myParent->startTrack(static_cast(myObject)->getGlID()); - static_cast(myObject)->addActiveAddVisualisation(myParent, VO_TRACKED); } return 1; } @@ -146,7 +141,6 @@ long GUIPerson::GUIPersonPopupMenu::onCmdStopTrack(FXObject*, FXSelector, void*) { assert(myObject->getType() == GLO_PERSON); - static_cast(myObject)->removeActiveAddVisualisation(myParent, VO_TRACKED); myParent->stopTrack(); return 1; } @@ -165,6 +159,14 @@ GUIPerson::~GUIPerson() { + myLock.lock(); + for (std::map::iterator i = myAdditionalVisualizations.begin(); i != myAdditionalVisualizations.end(); ++i) { + if (i->first->getTrackedID() == getGlID()) { + i->first->stopTrack(); + } + while (i->first->removeAdditionalGLVisualisation(this)); + } + myLock.unlock(); } @@ -195,6 +197,7 @@ new FXMenuSeparator(ret); // buildShowParamsPopupEntry(ret); + buildShowTypeParamsPopupEntry(ret); buildPositionCopyEntry(ret, false); return ret; } @@ -206,21 +209,33 @@ GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this, 16); // add items - //ret->mkItem("type [NAME]", false, myType->getID()); ret->mkItem("stage", false, getCurrentStageDescription()); ret->mkItem("start edge [id]", false, getFromEdge()->getID()); ret->mkItem("dest edge [id]", false, getDestination().getID()); ret->mkItem("edge [id]", false, getEdge()->getID()); - ret->mkItem("position [m]", true, new FunctionBinding(this, &GUIPerson::getEdgePos)); - ret->mkItem("speed [m/s]", true, new FunctionBinding(this, &GUIPerson::getSpeed)); - ret->mkItem("angle [degree]", true, new FunctionBinding(this, &GUIPerson::getNaviDegree)); - ret->mkItem("waiting time [s]", true, new FunctionBinding(this, &GUIPerson::getWaitingSeconds)); + ret->mkItem("position [m]", true, new FunctionBinding(this, &GUIPerson::getEdgePos)); + ret->mkItem("speed [m/s]", true, new FunctionBinding(this, &GUIPerson::getSpeed)); + ret->mkItem("angle [degree]", true, new FunctionBinding(this, &GUIPerson::getNaviDegree)); + ret->mkItem("waiting time [s]", true, new FunctionBinding(this, &GUIPerson::getWaitingSeconds)); ret->mkItem("parameters [key:val]", false, toString(getParameter().getMap())); - ret->mkItem("", false, ""); + // close building + ret->closeBuilding(); + return ret; +} + + +GUIParameterTableWindow* +GUIPerson::getTypeParameterWindow(GUIMainWindow& app, + GUISUMOAbstractView&) { + GUIParameterTableWindow* ret = + new GUIParameterTableWindow(app, *this, 9); + // add items ret->mkItem("Type Information:", false, ""); ret->mkItem("type [id]", false, myVType->getID()); ret->mkItem("length", false, myVType->getLength()); + ret->mkItem("width", false, myVType->getWidth()); + ret->mkItem("height", false, myVType->getHeight()); ret->mkItem("minGap", false, myVType->getMinGap()); ret->mkItem("maximum speed [m/s]", false, myVType->getMaxSpeed()); @@ -231,6 +246,7 @@ } + Boundary GUIPerson::getCenteringBoundary() const { Boundary b; @@ -254,7 +270,7 @@ // set person color setColor(s); // scale - const SUMOReal upscale = s.personSize.getExaggeration(s, 80); + const double upscale = s.personSize.getExaggeration(s, 80); glScaled(upscale, upscale, 1); switch (s.personQuality) { case 0: @@ -311,7 +327,7 @@ GLHelper::setColor(darker); MSPersonStage_Walking* stage = dynamic_cast(getCurrentStage()); assert(stage != 0); - const SUMOReal exaggeration = s.personSize.getExaggeration(s); + const double exaggeration = s.personSize.getExaggeration(s); const ConstMSEdgeVector& edges = stage->getRoute(); for (ConstMSEdgeVector::const_iterator it = edges.begin(); it != edges.end(); ++it) { GUILane* lane = static_cast((*it)->getLanes()[0]); @@ -364,13 +380,13 @@ return false; } case 8: { // color by angle - SUMOReal hue = GeomHelper::naviDegree(getAngle()); + double hue = GeomHelper::naviDegree(getAngle()); GLHelper::setColor(RGBColor::fromHSV(hue, 1., 1.)); return true; } case 9: { // color randomly (by pointer) - const SUMOReal hue = (long)this % 360; // [0-360] - const SUMOReal sat = (((long)this / 360) % 67) / 100.0 + 0.33; // [0.33-1] + const double hue = (long)this % 360; // [0-360] + const double sat = (((long)this / 360) % 67) / 100.0 + 0.33; // [0.33-1] GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.)); return true; } @@ -380,7 +396,7 @@ } -SUMOReal +double GUIPerson::getColorValue(int activeScheme) const { switch (activeScheme) { case 4: @@ -389,7 +405,7 @@ if (isWaiting4Vehicle()) { return 3; } else { - return (SUMOReal)getCurrentStageType(); + return (double)getCurrentStageType(); } case 6: return getWaitingSeconds(); @@ -400,7 +416,7 @@ } -SUMOReal +double GUIPerson::getEdgePos() const { AbstractMutex::ScopedLocker locker(myLock); return MSPerson::getEdgePos(); @@ -414,21 +430,21 @@ } -SUMOReal +double GUIPerson::getNaviDegree() const { AbstractMutex::ScopedLocker locker(myLock); return GeomHelper::naviDegree(MSPerson::getAngle()); } -SUMOReal +double GUIPerson::getWaitingSeconds() const { AbstractMutex::ScopedLocker locker(myLock); return MSPerson::getWaitingSeconds(); } -SUMOReal +double GUIPerson::getSpeed() const { AbstractMutex::ScopedLocker locker(myLock); return MSPerson::getSpeed(); @@ -492,9 +508,9 @@ } int textureID = GUITexturesHelper::getTextureID(file); if (textureID > 0) { - const SUMOReal exaggeration = s.personSize.getExaggeration(s); - const SUMOReal halfLength = getVehicleType().getLength() / 2.0 * exaggeration; - const SUMOReal halfWidth = getVehicleType().getWidth() / 2.0 * exaggeration; + const double exaggeration = s.personSize.getExaggeration(s); + const double halfLength = getVehicleType().getLength() / 2.0 * exaggeration; + const double halfWidth = getVehicleType().getWidth() / 2.0 * exaggeration; GUITexturesHelper::drawTexturedBox(textureID, -halfWidth, -halfLength, halfWidth, halfLength); } } else { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIPerson.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIPerson.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIPerson.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIPerson.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIPerson.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: GUIPerson.h 23656 2017-03-24 13:56:32Z namdre $ /// // A MSVehicle extended by some values for usage within the gui /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -91,6 +91,13 @@ */ GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent); + /** @brief Returns an own type parameter window + * + * @param[in] app The application needed to build the parameter window + * @param[in] parent The parent window needed to build the parameter window + * @return The built parameter window + */ + GUIParameterTableWindow* getTypeParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent); /** @brief Returns the boundary to which the view shall be centered in order to show the object * @@ -124,20 +131,20 @@ //@{ /// @brief return the offset from the start of the current edge - SUMOReal getEdgePos() const; + double getEdgePos() const; /// @brief return the Network coordinate of the person // @note overrides the base method and returns myPositionInVehicle while in driving stage Position getPosition() const; /// @brief return the current angle of the person - SUMOReal getNaviDegree() const; + double getNaviDegree() const; /// @brief the time this person spent waiting in seconds - SUMOReal getWaitingSeconds() const; + double getWaitingSeconds() const; /// @brief the current speed of the person - SUMOReal getSpeed() const; + double getSpeed() const; //@} @@ -244,7 +251,7 @@ void setColor(const GUIVisualizationSettings& s) const; /// @brief gets the color value according to the current scheme index - SUMOReal getColorValue(int activeScheme) const; + double getColorValue(int activeScheme) const; /// @brief sets the color according to the current scheme index and some vehicle function bool setFunctionalColor(int activeScheme) const; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUITrafficLightLogicWrapper.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUITrafficLightLogicWrapper.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUITrafficLightLogicWrapper.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUITrafficLightLogicWrapper.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Oct/Nov 2003 -/// @version $Id: GUITrafficLightLogicWrapper.cpp 21217 2016-07-22 10:57:44Z behrisch $ +/// @version $Id: GUITrafficLightLogicWrapper.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A wrapper for tl-logics to allow their visualisation and interaction /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -51,10 +51,6 @@ #include "GUINet.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUITrafficLightLogicWrapper.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUITrafficLightLogicWrapper.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUITrafficLightLogicWrapper.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUITrafficLightLogicWrapper.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Oct/Nov 2003 -/// @version $Id: GUITrafficLightLogicWrapper.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUITrafficLightLogicWrapper.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A wrapper for tl-logics to allow their visualisation and interaction /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUITransportableControl.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUITransportableControl.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUITransportableControl.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUITransportableControl.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Wed, 13.06.2012 -/// @version $Id: GUITransportableControl.cpp 20772 2016-05-20 10:07:31Z behrisch $ +/// @version $Id: GUITransportableControl.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // GUI-version of the person control for building gui persons /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include "GUIPerson.h" #include "GUITransportableControl.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUITransportableControl.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUITransportableControl.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUITransportableControl.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUITransportableControl.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Wed, 13.06.2012 -/// @version $Id: GUITransportableControl.h 20772 2016-05-20 10:07:31Z behrisch $ +/// @version $Id: GUITransportableControl.h 22608 2017-01-17 06:28:54Z behrisch $ /// // GUI-version of the transportable control for building gui persons and containers /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUITriggeredRerouter.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUITriggeredRerouter.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUITriggeredRerouter.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUITriggeredRerouter.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 25.07.2005 -/// @version $Id: GUITriggeredRerouter.cpp 21217 2016-07-22 10:57:44Z behrisch $ +/// @version $Id: GUITriggeredRerouter.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Reroutes vehicles passing an edge (gui version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -53,10 +53,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping @@ -160,7 +156,7 @@ long GUITriggeredRerouter::GUIManip_TriggeredRerouter::onCmdUserDef(FXObject*, FXSelector, void*) { - myUsageProbability = (SUMOReal)(myUsageProbabilityDial->getValue()); + myUsageProbability = (double)(myUsageProbabilityDial->getValue()); static_cast(myObject)->setUserUsageProbability(myUsageProbability); static_cast(myObject)->setUserMode(true); myParent->updateChildren(); @@ -228,7 +224,7 @@ GUITriggeredRerouter::GUITriggeredRerouter( const std::string& id, const MSEdgeVector& edges, - SUMOReal prob, const std::string& aXMLFilename, bool off, + double prob, const std::string& aXMLFilename, bool off, SUMORTree& rtree) : MSTriggeredRerouter(id, edges, prob, aXMLFilename, off), GUIGlObject_AbstractAdd("rerouter", GLO_TRIGGER, id) { @@ -324,7 +320,7 @@ myFGRotations.reserve(lanes.size()); for (std::vector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) { const PositionVector& v = (*i)->getShape(); - const SUMOReal pos = closed ? 3 : v.length() - (SUMOReal) 6.; + const double pos = closed ? 3 : v.length() - (double) 6.; myFGPositions.push_back((*i)->geometryPositionAtOffset(pos)); myFGRotations.push_back(-v.rotationDegreeAtOffset(pos)); myBoundary.add(myFGPositions.back()); @@ -351,10 +347,10 @@ void GUITriggeredRerouter::GUITriggeredRerouterEdge::drawGL(const GUIVisualizationSettings& s) const { - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); if (s.scale * exaggeration >= 3) { glPushName(getGlID()); - const SUMOReal prob = myParent->getProbability(); + const double prob = myParent->getProbability(); if (myAmClosedEdge) { // draw closing symbol onto all lanes const RerouteInterval* const ri = @@ -365,7 +361,7 @@ const int noLanes = (int)myFGPositions.size(); for (int j = 0; j < noLanes; ++j) { Position pos = myFGPositions[j]; - SUMOReal rot = myFGRotations[j]; + double rot = myFGRotations[j]; glPushMatrix(); glTranslated(pos.x(), pos.y(), 0); glRotated(rot, 0, 0, 1); @@ -380,10 +376,10 @@ glTranslated(0, 0, getType()); //glScaled(exaggeration, exaggeration, 1); glColor3d(0.7, 0, 0); - GLHelper::drawFilledCircle((SUMOReal) 1.3, noPoints); + GLHelper::drawFilledCircle((double) 1.3, noPoints); glTranslated(0, 0, .1); glColor3d(1, 0, 0); - GLHelper::drawFilledCircle((SUMOReal) 1.3, noPoints, 0, prob * 360); + GLHelper::drawFilledCircle((double) 1.3, noPoints, 0, prob * 360); glTranslated(0, 0, .1); glColor3d(1, 1, 1); glRotated(-90, 0, 0, 1); @@ -404,7 +400,7 @@ // draw rerouter symbol onto all lanes for (int i = 0; i < (int)myFGPositions.size(); ++i) { const Position& pos = myFGPositions[i]; - SUMOReal rot = myFGRotations[i]; + double rot = myFGRotations[i]; glPushMatrix(); glTranslated(pos.x(), pos.y(), 0); glRotated(rot, 0, 0, 1); @@ -427,7 +423,7 @@ glColor3d(0, 0, 0); pfSetPosition(0, 0); pfSetScale(3.f); - SUMOReal w = pfdkGetStringWidth("U"); + double w = pfdkGetStringWidth("U"); glRotated(180, 0, 1, 0); glTranslated(-w / 2., 2, 0); pfDrawString("U"); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUITriggeredRerouter.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUITriggeredRerouter.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUITriggeredRerouter.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUITriggeredRerouter.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 25.07.2005 -/// @version $Id: GUITriggeredRerouter.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUITriggeredRerouter.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Reroutes vehicles passing an edge (gui-version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -68,7 +68,7 @@ * @param[in] off Whether the rerouter is off (not working) initially */ GUITriggeredRerouter(const std::string& id, - const MSEdgeVector& edges, SUMOReal prob, + const MSEdgeVector& edges, double prob, const std::string& aXMLFilename, bool off, SUMORTree& rtree); @@ -183,7 +183,7 @@ typedef std::vector PosCont; /// Definition of a rotation container - typedef std::vector RotCont; + typedef std::vector RotCont; private: /// The parent rerouter to which this edge instance belongs @@ -255,7 +255,7 @@ FXDataTarget myChosenTarget; - SUMOReal myUsageProbability; + double myUsageProbability; FXRealSpinDial* myUsageProbabilityDial; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIVehicleControl.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIVehicleControl.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIVehicleControl.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIVehicleControl.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Wed, 10. Dec 2003 -/// @version $Id: GUIVehicleControl.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIVehicleControl.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The class responsible for building and deletion of vehicles (gui-version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include "GUINet.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions @@ -87,12 +83,12 @@ void -GUIVehicleControl::insertVehicleIDs(std::vector& into) { +GUIVehicleControl::insertVehicleIDs(std::vector& into, bool listParking, bool listTeleporting) { AbstractMutex::ScopedLocker locker(myLock); into.reserve(myVehicleDict.size()); for (VehicleDictType::iterator i = myVehicleDict.begin(); i != myVehicleDict.end(); ++i) { SUMOVehicle* veh = (*i).second; - if (veh->isOnRoad()) { + if (veh->isOnRoad() || (listParking && veh->isParking()) || listTeleporting) { into.push_back(static_cast((*i).second)->getGlID()); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIVehicleControl.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIVehicleControl.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIVehicleControl.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIVehicleControl.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Wed, 10. Dec 2003 -/// @version $Id: GUIVehicleControl.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIVehicleControl.h 22608 2017-01-17 06:28:54Z behrisch $ /// // The class responsible for building and deletion of vehicles (gui-version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2003-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2003-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -110,9 +110,11 @@ /** @brief Returns the list of all known vehicles by gl-id * @param[fill] into The list to fill with vehicle ids + * @param[listParking] Whether parking vehicles shall be listed as well + * @param[listTeleporting] Whether teleporting vehicles shall be listed as well * @todo Well, what about concurrent modifications? */ - void insertVehicleIDs(std::vector& into); + void insertVehicleIDs(std::vector& into, bool listParking, bool listTeleporting); /// @brief lock access to vehicle removal/additions for thread synchronization diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIVehicle.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIVehicle.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIVehicle.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIVehicle.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIVehicle.cpp 21790 2016-10-25 12:37:24Z behrisch $ +/// @version $Id: GUIVehicle.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A MSVehicle extended by some values for usage within the gui /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -66,11 +66,8 @@ #include "GUIEdge.h" #include "GUILane.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - //#define DRAW_BOUNDING_BOX +//#define DEBUG_FOES // =========================================================================== // FOX callback mapping @@ -83,15 +80,16 @@ * GUIVehicle - methods * ----------------------------------------------------------------------- */ #ifdef _MSC_VER +#pragma warning(push) #pragma warning(disable: 4355) #endif GUIVehicle::GUIVehicle(SUMOVehicleParameter* pars, const MSRoute* route, - const MSVehicleType* type, const SUMOReal speedFactor) : + const MSVehicleType* type, const double speedFactor) : MSVehicle(pars, route, type, speedFactor), GUIBaseVehicle((MSBaseVehicle&) * this) { } #ifdef _MSC_VER -#pragma warning(default: 4355) +#pragma warning(pop) #endif @@ -103,36 +101,40 @@ GUIVehicle::getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView&) { GUIParameterTableWindow* ret = - new GUIParameterTableWindow(app, *this, 35); + new GUIParameterTableWindow(app, *this, 37); // add items - ret->mkItem("lane [id]", false, myLane->getID()); + ret->mkItem("lane [id]", false, Named::getIDSecure(myLane, "n/a")); if (MSGlobals::gLaneChangeDuration > 0 || MSGlobals::gLateralResolution > 0) { const MSLane* shadowLane = getLaneChangeModel().getShadowLane(); ret->mkItem("shadow lane [id]", false, shadowLane == 0 ? "" : shadowLane->getID()); } ret->mkItem("position [m]", true, - new FunctionBinding(this, &MSVehicle::getPositionOnLane)); + new FunctionBinding(this, &MSVehicle::getPositionOnLane)); ret->mkItem("lateral offset [m]", true, - new FunctionBinding(this, &GUIVehicle::getLateralPositionOnLane)); + new FunctionBinding(this, &GUIVehicle::getLateralPositionOnLane)); ret->mkItem("speed [m/s]", true, - new FunctionBinding(this, &MSVehicle::getSpeed)); + new FunctionBinding(this, &MSVehicle::getSpeed)); + ret->mkItem("acceleration [m/s^2]", true, + new FunctionBinding(this, &MSVehicle::getAcceleration)); ret->mkItem("angle [degree]", true, - new FunctionBinding(this, &GUIBaseVehicle::getNaviDegree)); + new FunctionBinding(this, &GUIBaseVehicle::getNaviDegree)); ret->mkItem("slope [degree]", true, - new FunctionBinding(this, &MSVehicle::getSlope)); + new FunctionBinding(this, &MSVehicle::getSlope)); if (getChosenSpeedFactor() != 1) { ret->mkItem("speed factor", false, getChosenSpeedFactor()); } - ret->mkItem("time gap [s]", true, - new FunctionBinding(this, &MSVehicle::getTimeGap)); + ret->mkItem("time gap on lane [s]", true, + new FunctionBinding(this, &MSVehicle::getTimeGapOnLane)); ret->mkItem("waiting time [s]", true, - new FunctionBinding(this, &MSVehicle::getWaitingSeconds)); - ret->mkItem(("waiting time (accumlated, " + time2string(MSGlobals::gWaitingTimeMemory) + "s) [s]").c_str(), true, - new FunctionBinding(this, &MSVehicle::getAccumulatedWaitingSeconds)); + new FunctionBinding(this, &MSVehicle::getWaitingSeconds)); + ret->mkItem(("waiting time (accumulated, " + time2string(MSGlobals::gWaitingTimeMemory) + "s) [s]").c_str(), true, + new FunctionBinding(this, &MSVehicle::getAccumulatedWaitingSeconds)); + ret->mkItem("time loss [s]", true, + new FunctionBinding(this, &MSVehicle::getTimeLossSeconds)); ret->mkItem("impatience", true, - new FunctionBinding(this, &MSVehicle::getImpatience)); + new FunctionBinding(this, &MSVehicle::getImpatience)); ret->mkItem("last lane change [s]", true, - new FunctionBinding(this, &GUIVehicle::getLastLaneChangeOffset)); + new FunctionBinding(this, &GUIVehicle::getLastLaneChangeOffset)); ret->mkItem("desired depart [s]", false, time2string(getParameter().depart)); ret->mkItem("depart delay [s]", false, time2string(getDepartDelay())); if (getParameter().repetitionNumber < INT_MAX) { @@ -147,21 +149,21 @@ ret->mkItem("stop info", false, getStopInfo()); ret->mkItem("line", false, myParameter->line); ret->mkItem("CO2 [mg/s]", true, - new FunctionBinding(this, &MSVehicle::getCO2Emissions)); + new FunctionBinding(this, &MSVehicle::getCO2Emissions)); ret->mkItem("CO [mg/s]", true, - new FunctionBinding(this, &MSVehicle::getCOEmissions)); + new FunctionBinding(this, &MSVehicle::getCOEmissions)); ret->mkItem("HC [mg/s]", true, - new FunctionBinding(this, &MSVehicle::getHCEmissions)); + new FunctionBinding(this, &MSVehicle::getHCEmissions)); ret->mkItem("NOx [mg/s]", true, - new FunctionBinding(this, &MSVehicle::getNOxEmissions)); + new FunctionBinding(this, &MSVehicle::getNOxEmissions)); ret->mkItem("PMx [mg/s]", true, - new FunctionBinding(this, &MSVehicle::getPMxEmissions)); + new FunctionBinding(this, &MSVehicle::getPMxEmissions)); ret->mkItem("fuel [ml/s]", true, - new FunctionBinding(this, &MSVehicle::getFuelConsumption)); + new FunctionBinding(this, &MSVehicle::getFuelConsumption)); ret->mkItem("electricity [Wh/s]", true, - new FunctionBinding(this, &MSVehicle::getElectricityConsumption)); + new FunctionBinding(this, &MSVehicle::getElectricityConsumption)); ret->mkItem("noise (Harmonoise) [dB]", true, - new FunctionBinding(this, &MSVehicle::getHarmonoise_NoiseEmissions)); + new FunctionBinding(this, &MSVehicle::getHarmonoise_NoiseEmissions)); std::ostringstream str; for (std::vector::const_iterator i = myDevices.begin(); i != myDevices.end(); ++i) { if (i != myDevices.begin()) { @@ -186,22 +188,31 @@ GUIVehicle::getTypeParameterWindow(GUIMainWindow& app, GUISUMOAbstractView&) { GUIParameterTableWindow* ret = - new GUIParameterTableWindow(app, *this, 14); + new GUIParameterTableWindow(app, *this, 23); // add items ret->mkItem("Type Information:", false, ""); ret->mkItem("type [id]", false, myType->getID()); ret->mkItem("length", false, myType->getLength()); ret->mkItem("width", false, myType->getWidth()); + ret->mkItem("height", false, myType->getHeight()); ret->mkItem("minGap", false, myType->getMinGap()); ret->mkItem("vehicle class", false, SumoVehicleClassStrings.getString(myType->getVehicleClass())); ret->mkItem("emission class", false, PollutantsInterface::getName(myType->getEmissionClass())); + ret->mkItem("car follow model", false, SUMOXMLDefinitions::CarFollowModels.getString((SumoXMLTag)getCarFollowModel().getModelID())); ret->mkItem("maximum speed [m/s]", false, getMaxSpeed()); ret->mkItem("maximum acceleration [m/s^2]", false, getCarFollowModel().getMaxAccel()); ret->mkItem("maximum deceleration [m/s^2]", false, getCarFollowModel().getMaxDecel()); ret->mkItem("imperfection (sigma)", false, getCarFollowModel().getImperfection()); ret->mkItem("reaction time (tau)", false, getCarFollowModel().getHeadwayTime()); ret->mkItem("person capacity", false, myType->getPersonCapacity()); + ret->mkItem("boarding time", false, STEPS2TIME(myType->getBoardingDuration())); ret->mkItem("container capacity", false, myType->getContainerCapacity()); + ret->mkItem("loading time", false, STEPS2TIME(myType->getLoadingDuration())); + if (MSGlobals::gLateralResolution > 0) { + ret->mkItem("minGapLat", false, myType->getMinGapLat()); + ret->mkItem("maxSpeedLat", false, myType->getMaxSpeedLat()); + ret->mkItem("latAlignment", false, toString(myType->getPreferredLateralAlignment())); + } ret->mkItem("type parameters [key:val]", false, toString(myType->getParameter().getMap())); // close building @@ -308,7 +319,7 @@ #define BLINKER_POS_BACK .5 inline void -drawAction_drawBlinker(double dir, SUMOReal length) { +drawAction_drawBlinker(double dir, double length) { glColor3d(1.f, .8f, 0); glPushMatrix(); glTranslated(dir, BLINKER_POS_FRONT, -0.1); @@ -322,7 +333,7 @@ void -GUIVehicle::drawAction_drawVehicleBlinker(SUMOReal length) const { +GUIVehicle::drawAction_drawVehicleBlinker(double length) const { if (!signalSet(MSVehicle::VEH_SIGNAL_BLINKER_RIGHT | MSVehicle::VEH_SIGNAL_BLINKER_LEFT | MSVehicle::VEH_SIGNAL_BLINKER_EMERGENCY)) { return; } @@ -341,7 +352,7 @@ inline void -GUIVehicle::drawAction_drawVehicleBrakeLight(SUMOReal length, bool onlyOne) const { +GUIVehicle::drawAction_drawVehicleBrakeLight(double length, bool onlyOne) const { if (!signalSet(MSVehicle::VEH_SIGNAL_BRAKELIGHT)) { return; } @@ -373,7 +384,7 @@ } -SUMOReal +double GUIVehicle::getColorValue(int activeScheme) const { switch (activeScheme) { case 8: @@ -412,11 +423,13 @@ case 23: return getAcceleration(); case 24: - return getTimeGap(); + return getTimeGapOnLane(); case 25: return STEPS2TIME(getDepartDelay()); case 26: return getElectricityConsumption(); + case 27: + return getTimeLossSeconds(); } return 0; } @@ -429,25 +442,25 @@ myLock.unlock(); for (std::vector >::iterator j = bestLanes.begin(); j != bestLanes.end(); ++j) { std::vector& lanes = *j; - SUMOReal gmax = -1; - SUMOReal rmax = -1; + double gmax = -1; + double rmax = -1; for (std::vector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) { gmax = MAX2((*i).length, gmax); rmax = MAX2((*i).occupation, rmax); } for (std::vector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) { const PositionVector& shape = (*i).lane->getShape(); - SUMOReal g = (*i).length / gmax; - SUMOReal r = (*i).occupation / rmax; + double g = (*i).length / gmax; + double r = (*i).occupation / rmax; glColor3d(r, g, 0); - SUMOReal width = 0.5 / (1 + abs((*i).bestLaneOffset)); + double width = 0.5 / (1 + abs((*i).bestLaneOffset)); GLHelper::drawBoxLines(shape, width); PositionVector s1 = shape; - s1.move2side((SUMOReal) .1); + s1.move2side((double) .1); glColor3d(r, 0, 0); GLHelper::drawLine(s1); - s1.move2side((SUMOReal) - .2); + s1.move2side((double) - .2); glColor3d(0, g, 0); GLHelper::drawLine(s1); @@ -458,7 +471,7 @@ void -GUIVehicle::drawRouteHelper(const MSRoute& r, SUMOReal exaggeration) const { +GUIVehicle::drawRouteHelper(const MSRoute& r, double exaggeration) const { MSRouteIterator i = r.begin(); const std::vector& bestLaneConts = getBestLanesContinuation(); // draw continuation lanes when drawing the current route where available @@ -469,7 +482,12 @@ lane = static_cast(bestLaneConts[bestLaneIndex]); ++bestLaneIndex; } else { - lane = static_cast((*i)->getLanes()[0]); + const std::vector* allowed = (*i)->allowedLanes(getVClass()); + if (allowed != 0 && allowed->size() != 0) { + lane = static_cast((*allowed)[0]); + } else { + lane = static_cast((*i)->getLanes()[0]); + } } GLHelper::drawBoxLines(lane->getShape(), lane->getShapeRotations(), lane->getShapeLengths(), exaggeration); } @@ -488,27 +506,27 @@ void -GUIVehicle::drawAction_drawRailCarriages(const GUIVisualizationSettings& s, SUMOReal defaultLength, SUMOReal carriageGap, int firstPassengerCarriage, bool asImage) const { +GUIVehicle::drawAction_drawRailCarriages(const GUIVisualizationSettings& s, double defaultLength, double carriageGap, int firstPassengerCarriage, bool asImage) const { RGBColor current = GLHelper::getColor(); RGBColor darker = current.changedBrightness(-51); - const SUMOReal exaggeration = s.vehicleSize.getExaggeration(s); + const double exaggeration = s.vehicleSize.getExaggeration(s); defaultLength *= exaggeration; if (exaggeration == 0) { return; } carriageGap *= exaggeration; - const SUMOReal length = getVehicleType().getLength() * exaggeration; - const SUMOReal halfWidth = getVehicleType().getWidth() / 2.0 * exaggeration; + const double length = getVehicleType().getLength() * exaggeration; + const double halfWidth = getVehicleType().getWidth() / 2.0 * exaggeration; glPopMatrix(); // undo scaling and 90 degree rotation glPopMatrix(); // undo initial translation and rotation GLHelper::setColor(darker); - const SUMOReal xCornerCut = 0.3 * exaggeration; - const SUMOReal yCornerCut = 0.4 * exaggeration; + const double xCornerCut = 0.3 * exaggeration; + const double yCornerCut = 0.4 * exaggeration; // round to closest integer const int numCarriages = (int)(length / (defaultLength + carriageGap) + 0.5); assert(numCarriages > 0); - const SUMOReal carriageLengthWithGap = length / numCarriages; - const SUMOReal carriageLength = carriageLengthWithGap - carriageGap; + const double carriageLengthWithGap = length / numCarriages; + const double carriageLength = carriageLengthWithGap - carriageGap; // lane on which the carriage front is situated MSLane* lane = myLane; int furtherIndex = 0; @@ -516,15 +534,15 @@ MSLane* backLane = myLane; int backFurtherIndex = furtherIndex; // offsets of front and back - SUMOReal carriageOffset = myState.pos(); - SUMOReal carriageBackOffset = myState.pos() - carriageLength; + double carriageOffset = myState.pos(); + double carriageBackOffset = myState.pos() - carriageLength; // handle seats int requiredSeats = getNumPassengers(); if (requiredSeats > 0) { mySeatPositions.clear(); } Position front, back; - SUMOReal angle = 0.; + double angle = 0.; // draw individual carriages for (int i = 0; i < numCarriages; ++i) { while (carriageOffset < 0) { @@ -553,8 +571,8 @@ // no place for drawing available continue; } - const SUMOReal drawnCarriageLength = front.distanceTo2D(back); - angle = atan2((front.x() - back.x()), (back.y() - front.y())) * (SUMOReal) 180.0 / (SUMOReal) PI; + const double drawnCarriageLength = front.distanceTo2D(back); + angle = atan2((front.x() - back.x()), (back.y() - front.y())) * (double) 180.0 / (double) PI; if (i >= firstPassengerCarriage) { computeSeats(front, back, requiredSeats); } @@ -600,13 +618,13 @@ if (requiredSeats <= 0) { return; // save some work } - const SUMOReal length = front.distanceTo2D(back); + const double length = front.distanceTo2D(back); if (length < 4) { // small vehicle, sit at the center mySeatPositions.push_back(PositionVector::positionAtOffset2D(front, back, length / 2)); requiredSeats--; } else { - for (SUMOReal p = 2; p <= length - 1; p += 1) { + for (double p = 2; p <= length - 1; p += 1) { mySeatPositions.push_back(PositionVector::positionAtOffset2D(front, back, p)); requiredSeats--; } @@ -614,7 +632,7 @@ } -SUMOReal +double GUIVehicle::getLastLaneChangeOffset() const { return STEPS2TIME(getLaneChangeModel().getLastLaneChangeOffset()); } @@ -643,7 +661,7 @@ void GUIVehicle::selectBlockingFoes() const { - SUMOReal dist = myLane->getLength() - getPositionOnLane(); + double dist = myLane->getLength() - getPositionOnLane(); for (DriveItemVector::const_iterator i = myLFLinkLanes.begin(); i != myLFLinkLanes.end(); ++i) { const DriveProcessItem& dpi = *i; if (dpi.myLink == 0) { @@ -651,30 +669,54 @@ } std::vector blockingFoes; std::vector blockingPersons; - dpi.myLink->opened(dpi.myArrivalTime, dpi.myArrivalSpeed, dpi.getLeaveSpeed(), getVehicleType().getLength(), - getImpatience(), getCarFollowModel().getMaxDecel(), getWaitingTime(), getLateralPositionOnLane(), &blockingFoes); +#ifdef DEBUG_FOES + const bool isOpen = +#endif + dpi.myLink->opened(dpi.myArrivalTime, dpi.myArrivalSpeed, dpi.getLeaveSpeed(), getVehicleType().getLength(), + getImpatience(), getCarFollowModel().getMaxDecel(), getWaitingTime(), getLateralPositionOnLane(), &blockingFoes); +#ifdef DEBUG_FOES + if (!isOpen) { + std::cout << SIMTIME << " veh=" << getID() << " foes at link=" << dpi.myLink->getViaLaneOrLane()->getID() << ":\n"; + for (std::vector::const_iterator it = blockingFoes.begin(); it != blockingFoes.end(); ++it) { + std::cout << " " << (*it)->getID() << "\n"; + } + } +#endif if (getLaneChangeModel().getShadowLane() != 0) { MSLink* parallelLink = dpi.myLink->getParallelLink(getLaneChangeModel().getShadowDirection()); if (parallelLink != 0) { - const SUMOReal shadowLatPos = getLateralPositionOnLane() - getLaneChangeModel().getShadowDirection() * 0.5 * ( - myLane->getWidth() + getLaneChangeModel().getShadowLane()->getWidth()); - parallelLink->opened(dpi.myArrivalTime, dpi.myArrivalSpeed, dpi.getLeaveSpeed(), - getVehicleType().getLength(), getImpatience(), - getCarFollowModel().getMaxDecel(), - getWaitingTime(), shadowLatPos, &blockingFoes); + const double shadowLatPos = getLateralPositionOnLane() - getLaneChangeModel().getShadowDirection() * 0.5 * ( + myLane->getWidth() + getLaneChangeModel().getShadowLane()->getWidth()); +#ifdef DEBUG_FOES + const bool isShadowOpen = +#endif + parallelLink->opened(dpi.myArrivalTime, dpi.myArrivalSpeed, dpi.getLeaveSpeed(), + getVehicleType().getLength(), getImpatience(), + getCarFollowModel().getMaxDecel(), + getWaitingTime(), shadowLatPos, &blockingFoes); +#ifdef DEBUG_FOES + if (!isShadowOpen) { + std::cout << SIMTIME << " veh=" << getID() << " foes at shadow link=" << parallelLink->getViaLaneOrLane()->getID() << ":\n"; + for (std::vector::const_iterator it = blockingFoes.begin(); it != blockingFoes.end(); ++it) { + std::cout << " " << (*it)->getID() << "\n"; + } + } +#endif } } for (std::vector::const_iterator it = blockingFoes.begin(); it != blockingFoes.end(); ++it) { gSelected.select(static_cast(*it)->getGlID()); } -#ifdef HAVE_INTERNAL_LANES - const MSLink::LinkLeaders linkLeaders = (dpi.myLink)->getLeaderInfo(dist, getVehicleType().getMinGap(), &blockingPersons); + const MSLink::LinkLeaders linkLeaders = (dpi.myLink)->getLeaderInfo(this, dist, &blockingPersons); for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) { // the vehicle to enter the junction first has priority const GUIVehicle* leader = dynamic_cast(it->vehAndGap.first); if (leader != 0) { if (dpi.myLink->isLeader(this, leader)) { gSelected.select(leader->getGlID()); +#ifdef DEBUG_FOES + std::cout << SIMTIME << " veh=" << getID() << " linkLeader at link=" << dpi.myLink->getViaLaneOrLane()->getID() << " foe=" << leader->getID() << "\n"; +#endif } } else { for (std::vector::iterator it_p = blockingPersons.begin(); it_p != blockingPersons.end(); ++it_p) { @@ -686,7 +728,6 @@ } } } -#endif dist += dpi.myLink->getViaLaneOrLane()->getLength(); } } @@ -709,5 +750,10 @@ } } +bool +GUIVehicle::isSelected() const { + return gSelected.isSelected(GLO_VEHICLE, getGlID()); +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIVehicle.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIVehicle.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/GUIVehicle.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/GUIVehicle.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIVehicle.h 21505 2016-09-19 14:37:59Z namdre $ +/// @version $Id: GUIVehicle.h 24108 2017-04-27 18:43:30Z behrisch $ /// // A MSVehicle extended by some values for usage within the gui /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -68,7 +68,7 @@ * @exception ProcessError If a value is wrong */ GUIVehicle(SUMOVehicleParameter* pars, const MSRoute* route, - const MSVehicleType* type, const SUMOReal speedFactor); + const MSVehicleType* type, const double speedFactor); /// @brief destructor @@ -78,7 +78,7 @@ * * @note implementation of abstract method does not work otherwise */ - Position getPosition(const SUMOReal offset = 0) const { + Position getPosition(const double offset = 0) const { return MSVehicle::getPosition(offset); } @@ -86,17 +86,17 @@ * * @note implementation of abstract method does not work otherwise */ - SUMOReal getAngle() const { + double getAngle() const { return MSVehicle::getAngle(); } /** @brief Draws the route * @param[in] r The route to draw */ - void drawRouteHelper(const MSRoute& r, SUMOReal exaggeration) const; + void drawRouteHelper(const MSRoute& r, double exaggeration) const; - void drawAction_drawVehicleBlinker(SUMOReal length) const; - void drawAction_drawVehicleBrakeLight(SUMOReal length, bool onlyOne = 1) const; + void drawAction_drawVehicleBlinker(double length) const; + void drawAction_drawVehicleBrakeLight(double length, bool onlyOne = 1) const; void drawAction_drawPersonsAndContainers(const GUIVisualizationSettings& s) const; void drawAction_drawLinkItems(const GUIVisualizationSettings& s) const; void drawAction_drawVehicleBlueLight() const; @@ -105,7 +105,7 @@ * @see MSVehicle::myLastLaneChangeOffset * @return The time since the last lane change in seconds */ - SUMOReal getLastLaneChangeOffset() const; + double getLastLaneChangeOffset() const; /** @brief Draws the vehicle's best lanes @@ -117,7 +117,7 @@ void selectBlockingFoes() const; /// @brief gets the color value according to the current scheme index - SUMOReal getColorValue(int activeScheme) const; + double getColorValue(int activeScheme) const; /** @brief Returns an own parameter window * @@ -136,6 +136,9 @@ */ GUIParameterTableWindow* getTypeParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent); + /// @brief whether this vehicle is selected in the GUI + bool isSelected() const; + protected: /// @brief register vehicle for drawing while outside the network void drawOutsideNetwork(bool add); @@ -145,7 +148,7 @@ /* @brief draw train with individual carriages. The number of carriages is * determined from defaultLength of carriages and vehicle length * passengerSeats are computed beginning at firstPassengerCarriage */ - void drawAction_drawRailCarriages(const GUIVisualizationSettings& s, SUMOReal defaultLength, SUMOReal carriageGap, + void drawAction_drawRailCarriages(const GUIVisualizationSettings& s, double defaultLength, double carriageGap, int firstPassengerCarriage, bool asImage) const; /// @} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -3,7 +3,9 @@ libguisim_a_SOURCES = GUIBusStop.cpp GUIBusStop.h \ GUIContainer.cpp GUIContainer.h \ GUIContainerStop.cpp GUIContainerStop.h \ +GUIParkingArea.cpp GUIParkingArea.h \ GUIDetectorWrapper.cpp GUIDetectorWrapper.h \ +GUIE2Collector.cpp GUIE2Collector.h \ GUIE3Collector.cpp GUIE3Collector.h GUIEdge.cpp GUIEdge.h \ GUIEventControl.cpp GUIEventControl.h \ GUIInductLoop.cpp GUIInductLoop.h \ @@ -19,8 +21,6 @@ GUIChargingStation.cpp GUIChargingStation.h \ GUIBaseVehicle.cpp GUIBaseVehicle.h \ GUIVehicle.cpp GUIVehicle.h GUIVehicleControl.cpp GUIVehicleControl.h \ -GUI_E2_ZS_Collector.cpp GUI_E2_ZS_Collector.h \ -GUI_E2_ZS_CollectorOverLanes.cpp GUI_E2_ZS_CollectorOverLanes.h \ GUITransportableControl.cpp GUITransportableControl.h EXTRA_DIST = guisim64.ico diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -99,7 +99,8 @@ libguisim_a_AR = $(AR) $(ARFLAGS) libguisim_a_LIBADD = am_libguisim_a_OBJECTS = GUIBusStop.$(OBJEXT) GUIContainer.$(OBJEXT) \ - GUIContainerStop.$(OBJEXT) GUIDetectorWrapper.$(OBJEXT) \ + GUIContainerStop.$(OBJEXT) GUIParkingArea.$(OBJEXT) \ + GUIDetectorWrapper.$(OBJEXT) GUIE2Collector.$(OBJEXT) \ GUIE3Collector.$(OBJEXT) GUIEdge.$(OBJEXT) \ GUIEventControl.$(OBJEXT) GUIInductLoop.$(OBJEXT) \ GUIInstantInductLoop.$(OBJEXT) GUIJunctionWrapper.$(OBJEXT) \ @@ -109,8 +110,6 @@ GUITriggeredRerouter.$(OBJEXT) GUICalibrator.$(OBJEXT) \ GUIChargingStation.$(OBJEXT) GUIBaseVehicle.$(OBJEXT) \ GUIVehicle.$(OBJEXT) GUIVehicleControl.$(OBJEXT) \ - GUI_E2_ZS_Collector.$(OBJEXT) \ - GUI_E2_ZS_CollectorOverLanes.$(OBJEXT) \ GUITransportableControl.$(OBJEXT) libguisim_a_OBJECTS = $(am_libguisim_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) @@ -343,7 +342,9 @@ libguisim_a_SOURCES = GUIBusStop.cpp GUIBusStop.h \ GUIContainer.cpp GUIContainer.h \ GUIContainerStop.cpp GUIContainerStop.h \ +GUIParkingArea.cpp GUIParkingArea.h \ GUIDetectorWrapper.cpp GUIDetectorWrapper.h \ +GUIE2Collector.cpp GUIE2Collector.h \ GUIE3Collector.cpp GUIE3Collector.h GUIEdge.cpp GUIEdge.h \ GUIEventControl.cpp GUIEventControl.h \ GUIInductLoop.cpp GUIInductLoop.h \ @@ -359,8 +360,6 @@ GUIChargingStation.cpp GUIChargingStation.h \ GUIBaseVehicle.cpp GUIBaseVehicle.h \ GUIVehicle.cpp GUIVehicle.h GUIVehicleControl.cpp GUIVehicleControl.h \ -GUI_E2_ZS_Collector.cpp GUI_E2_ZS_Collector.h \ -GUI_E2_ZS_CollectorOverLanes.cpp GUI_E2_ZS_CollectorOverLanes.h \ GUITransportableControl.cpp GUITransportableControl.h EXTRA_DIST = guisim64.ico @@ -420,6 +419,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUIContainer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUIContainerStop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUIDetectorWrapper.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUIE2Collector.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUIE3Collector.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUIEdge.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUIEventControl.Po@am__quote@ @@ -429,14 +429,13 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUILane.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUILaneSpeedTrigger.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUINet.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUIParkingArea.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUIPerson.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUITrafficLightLogicWrapper.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUITransportableControl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUITriggeredRerouter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUIVehicle.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUIVehicleControl.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUI_E2_ZS_Collector.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GUI_E2_ZS_CollectorOverLanes.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim_main.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim_main.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/guisim_main.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/guisim_main.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Felix Brack /// @date Tue, 20 Nov 2001 -/// @version $Id: guisim_main.cpp 21172 2016-07-15 08:34:36Z behrisch $ +/// @version $Id: guisim_main.cpp 23637 2017-03-23 20:40:16Z behrisch $ /// // Main for GUISIM /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -52,8 +52,8 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include +#ifndef NO_TRACI +#include #endif @@ -69,7 +69,7 @@ OptionsCont& oc = OptionsCont::getOptions(); // give some application descriptions oc.setApplicationDescription("GUI version of the simulation SUMO."); - oc.setApplicationName("sumo-gui.exe", "SUMO gui Version " VERSION_STRING); + oc.setApplicationName("sumo-gui", "SUMO gui Version " VERSION_STRING); int ret = 0; try { // initialise subsystems @@ -122,6 +122,9 @@ ret = 1; #endif } +#ifndef NO_TRACI + TraCIServer::close(); +#endif SystemFrame::close(); return ret; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/jtrrouter_main.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/jtrrouter_main.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/jtrrouter_main.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/jtrrouter_main.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 20 Jan 2004 -/// @version $Id: jtrrouter_main.cpp 20811 2016-05-30 11:05:58Z behrisch $ +/// @version $Id: jtrrouter_main.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Main for JTRROUTER /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -63,10 +63,6 @@ #include "ROJTRTurnDefLoader.h" #include "ROJTRFrame.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // functions @@ -81,7 +77,7 @@ */ void initNet(RONet& net, ROLoader& loader, - const std::vector& turnDefs) { + const std::vector& turnDefs) { // load the net ROJTREdgeBuilder builder; loader.loadNet(net, builder); @@ -92,16 +88,16 @@ } } -std::vector +std::vector getTurningDefaults(OptionsCont& oc) { - std::vector ret; + std::vector ret; std::vector defs = oc.getStringVector("turn-defaults"); if (defs.size() < 2) { throw ProcessError("The defaults for turnings must be a tuple of at least two numbers divided by ','."); } for (std::vector::const_iterator i = defs.begin(); i != defs.end(); ++i) { try { - SUMOReal val = TplConvert::_2SUMOReal((*i).c_str()); + double val = TplConvert::_2double((*i).c_str()); ret.push_back(val); } catch (NumberFormatException&) { throw ProcessError("A turn default is not numeric."); @@ -151,7 +147,7 @@ net.openOutput(oc); // build the router ROJTRRouter* router = new ROJTRRouter(oc.getBool("ignore-errors"), oc.getBool("accept-all-destinations"), - (int)(((SUMOReal) net.getEdgeNo()) * OptionsCont::getOptions().getFloat("max-edges-factor")), + (int)(((double) net.getEdgeNo()) * OptionsCont::getOptions().getFloat("max-edges-factor")), oc.getBool("ignore-vclasses"), oc.getBool("allow-loops")); RORouteDef::setUsingJTRR(); RORouterProvider provider(router, new PedestrianRouterDijkstra(), @@ -189,7 +185,7 @@ throw ProcessError(); } RandHelper::initRandGlobal(); - std::vector defs = getTurningDefaults(oc); + std::vector defs = getTurningDefaults(oc); // load data ROLoader loader(oc, true, !oc.getBool("no-step-log")); net = new RONet(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,3 @@ -if CHECK_MEMORY_LEAKS -MEM_LIBS = ../foreign/nvwa/libnvwa.a -endif - bin_PROGRAMS = jtrrouter jtrrouter_SOURCES = jtrrouter_main.cpp \ @@ -16,6 +12,7 @@ jtrrouter_LDADD = ../router/librouter.a \ ../utils/options/liboptions.a \ ../utils/xml/libxml.a \ +../utils/distribution/libdistribution.a \ ../utils/vehicle/libvehicle.a \ ../utils/common/libcommon.a \ ../utils/importio/libimportio.a \ @@ -24,5 +21,4 @@ ../utils/emissions/libemissions.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ -l$(LIB_XERCES) $(FOX_LDFLAGS) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -100,12 +100,13 @@ am__DEPENDENCIES_1 = jtrrouter_DEPENDENCIES = ../router/librouter.a \ ../utils/options/liboptions.a ../utils/xml/libxml.a \ + ../utils/distribution/libdistribution.a \ ../utils/vehicle/libvehicle.a ../utils/common/libcommon.a \ ../utils/importio/libimportio.a \ ../utils/iodevices/libiodevices.a ../utils/geom/libgeom.a \ ../utils/emissions/libemissions.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ - ../foreign/tcpip/libtcpip.a $(MEM_LIBS) $(am__DEPENDENCIES_1) + ../foreign/tcpip/libtcpip.a $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -335,7 +336,6 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -@CHECK_MEMORY_LEAKS_TRUE@MEM_LIBS = ../foreign/nvwa/libnvwa.a jtrrouter_SOURCES = jtrrouter_main.cpp \ ROJTREdge.cpp ROJTREdge.h \ ROJTREdgeBuilder.cpp ROJTREdgeBuilder.h \ @@ -346,6 +346,7 @@ jtrrouter_LDADD = ../router/librouter.a \ ../utils/options/liboptions.a \ ../utils/xml/libxml.a \ +../utils/distribution/libdistribution.a \ ../utils/vehicle/libvehicle.a \ ../utils/common/libcommon.a \ ../utils/importio/libimportio.a \ @@ -354,7 +355,6 @@ ../utils/emissions/libemissions.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ -l$(LIB_XERCES) $(FOX_LDFLAGS) all: all-am diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTREdgeBuilder.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTREdgeBuilder.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTREdgeBuilder.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTREdgeBuilder.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Yun-Pang Floetteroed /// @date Tue, 20 Jan 2004 -/// @version $Id: ROJTREdgeBuilder.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ROJTREdgeBuilder.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The builder for jtrrouter-edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,10 +33,6 @@ #include "ROJTREdgeBuilder.h" #include "ROJTREdge.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTREdgeBuilder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTREdgeBuilder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTREdgeBuilder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTREdgeBuilder.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Yun-Pang Floetteroed /// @date Tue, 20 Jan 2004 -/// @version $Id: ROJTREdgeBuilder.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ROJTREdgeBuilder.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Interface for building instances of jtrrouter-edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTREdge.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTREdge.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTREdge.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTREdge.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Yun-Pang Floetteroed /// @date Tue, 20 Jan 2004 -/// @version $Id: ROJTREdge.cpp 21217 2016-07-22 10:57:44Z behrisch $ +/// @version $Id: ROJTREdge.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // An edge the jtr-router may route through /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,11 +36,7 @@ #include #include #include "ROJTREdge.h" -#include - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS +#include // =========================================================================== @@ -62,14 +58,14 @@ ROEdge::addSuccessor(s); ROJTREdge* js = static_cast(s); if (myFollowingDefs.find(js) == myFollowingDefs.end()) { - myFollowingDefs[js] = new ValueTimeLine(); + myFollowingDefs[js] = new ValueTimeLine(); } } void -ROJTREdge::addFollowerProbability(ROJTREdge* follower, SUMOReal begTime, - SUMOReal endTime, SUMOReal probability) { +ROJTREdge::addFollowerProbability(ROJTREdge* follower, double begTime, + double endTime, double probability) { FollowerUsageCont::iterator i = myFollowingDefs.find(follower); if (i == myFollowingDefs.end()) { WRITE_ERROR("The edges '" + getID() + "' and '" + follower->getID() + "' are not connected."); @@ -80,7 +76,7 @@ ROJTREdge* -ROJTREdge::chooseNext(const ROVehicle* const veh, SUMOReal time, const std::set& avoid) const { +ROJTREdge::chooseNext(const ROVehicle* const veh, double time, const std::set& avoid) const { // if no usable follower exist, return 0 // their probabilities are not yet regarded if (myFollowingEdges.size() == 0 || (veh != 0 && allFollowersProhibit(veh))) { @@ -92,7 +88,7 @@ for (FollowerUsageCont::const_iterator i = myFollowingDefs.begin(); i != myFollowingDefs.end(); ++i) { if (avoid.count(i->first) == 0) { if ((veh == 0 || !(*i).first->prohibits(veh)) && (*i).second->describesTime(time)) { - dist.add((*i).second->getValue(time), (*i).first); + dist.add((*i).first, (*i).second->getValue(time)); } } } @@ -101,7 +97,7 @@ for (int i = 0; i < (int)myParsedTurnings.size(); ++i) { if (avoid.count(myFollowingEdges[i]) == 0) { if (veh == 0 || !myFollowingEdges[i]->prohibits(veh)) { - dist.add(myParsedTurnings[i], static_cast(myFollowingEdges[i])); + dist.add(static_cast(myFollowingEdges[i]), myParsedTurnings[i]); } } } @@ -116,22 +112,22 @@ void -ROJTREdge::setTurnDefaults(const std::vector& defs) { +ROJTREdge::setTurnDefaults(const std::vector& defs) { // I hope, we'll find a less ridiculous solution for this - std::vector tmp(defs.size()*myFollowingEdges.size(), 0); + std::vector tmp(defs.size()*myFollowingEdges.size(), 0); // store in less common multiple for (int i = 0; i < (int)defs.size(); ++i) { for (int j = 0; j < (int)myFollowingEdges.size(); ++j) { - tmp[i * myFollowingEdges.size() + j] = (SUMOReal)(defs[i] / 100.0 / (myFollowingEdges.size())); + tmp[i * myFollowingEdges.size() + j] = (double)(defs[i] / 100.0 / (myFollowingEdges.size())); } } // parse from less common multiple for (int i = 0; i < (int)myFollowingEdges.size(); ++i) { - SUMOReal value = 0; + double value = 0; for (int j = 0; j < (int)defs.size(); ++j) { value += tmp[i * defs.size() + j]; } - myParsedTurnings.push_back((SUMOReal) value); + myParsedTurnings.push_back((double) value); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTREdge.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTREdge.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTREdge.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTREdge.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Yun-Pang Floetteroed /// @date Tue, 20 Jan 2004 -/// @version $Id: ROJTREdge.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: ROJTREdge.h 23150 2017-02-27 12:08:30Z behrisch $ /// // An edge the jtr-router may route through /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -92,7 +92,7 @@ * @param[in] probability The probability to use the given follower */ void addFollowerProbability(ROJTREdge* follower, - SUMOReal begTime, SUMOReal endTime, SUMOReal probability); + double begTime, double endTime, double probability); /** @brief Returns the next edge to use @@ -101,24 +101,24 @@ * @param[in] avoid The set of edges to avoid * @return The chosen edge */ - ROJTREdge* chooseNext(const ROVehicle* const veh, SUMOReal time, const std::set& avoid) const; + ROJTREdge* chooseNext(const ROVehicle* const veh, double time, const std::set& avoid) const; /** @brief Sets the turning definition defaults * @param[in] def The turning percentage defaults */ - void setTurnDefaults(const std::vector& defs); + void setTurnDefaults(const std::vector& defs); private: /// @brief Definition of a map that stores the probabilities of using a certain follower over time - typedef std::map*, Named::ComparatorIdLess> FollowerUsageCont; + typedef std::map*, Named::ComparatorIdLess> FollowerUsageCont; /// @brief Storage for the probabilities of using a certain follower over time FollowerUsageCont myFollowingDefs; /// @brief The defaults for turnings - std::vector myParsedTurnings; + std::vector myParsedTurnings; private: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTRFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTRFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTRFrame.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTRFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: ROJTRFrame.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ROJTRFrame.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Sets and checks options for jtr-routing /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,10 +44,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTRFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTRFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTRFrame.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTRFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: ROJTRFrame.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ROJTRFrame.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Sets and checks options for jtr-routing /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTRRouter.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTRRouter.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTRRouter.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTRRouter.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 20 Jan 2004 -/// @version $Id: ROJTRRouter.cpp 21813 2016-10-26 20:30:04Z behrisch $ +/// @version $Id: ROJTRRouter.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Computes routes using junction turning percentages /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "ROJTREdge.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -60,7 +56,7 @@ const ROVehicle* const vehicle, SUMOTime time, ConstROEdgeVector& into) { const ROJTREdge* current = static_cast(from); - SUMOReal timeS = STEPS2TIME(time); + double timeS = STEPS2TIME(time); std::set avoidEdges; // route until a sinks has been found while (current != 0 && current != to && @@ -92,10 +88,10 @@ } -SUMOReal +double ROJTRRouter::recomputeCosts(const ConstROEdgeVector& edges, const ROVehicle* const v, SUMOTime msTime) const { - const SUMOReal time = STEPS2TIME(msTime); - SUMOReal costs = 0; + const double time = STEPS2TIME(msTime); + double costs = 0; for (ConstROEdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) { costs += (*i)->getTravelTime(v, time); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTRRouter.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTRRouter.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTRRouter.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTRRouter.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Tue, 20 Jan 2004 -/// @version $Id: ROJTRRouter.h 21813 2016-10-26 20:30:04Z behrisch $ +/// @version $Id: ROJTRRouter.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Computes routes using junction turning percentages /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -93,7 +93,7 @@ * @param[in] msTime The departure time of the vehicle * @return The route costs */ - SUMOReal recomputeCosts(const ConstROEdgeVector& edges, const ROVehicle* const v, SUMOTime msTime) const; + double recomputeCosts(const ConstROEdgeVector& edges, const ROVehicle* const v, SUMOTime msTime) const; /// @} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTRTurnDefLoader.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTRTurnDefLoader.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTRTurnDefLoader.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTRTurnDefLoader.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 20 Jan 2004 -/// @version $Id: ROJTRTurnDefLoader.cpp 21813 2016-10-26 20:30:04Z behrisch $ +/// @version $Id: ROJTRTurnDefLoader.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Loader for the of turning percentages and source/sink definitions /****************************************************************************/ @@ -43,10 +43,6 @@ #include "ROJTREdge.h" #include "ROJTRTurnDefLoader.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -65,8 +61,8 @@ bool ok = true; switch (element) { case SUMO_TAG_INTERVAL: - myIntervalBegin = attrs.get(SUMO_ATTR_BEGIN, 0, ok); - myIntervalEnd = attrs.get(SUMO_ATTR_END, 0, ok); + myIntervalBegin = attrs.get(SUMO_ATTR_BEGIN, 0, ok); + myIntervalEnd = attrs.get(SUMO_ATTR_END, 0, ok); break; case SUMO_TAG_FROMEDGE: beginFromEdge(attrs); @@ -143,7 +139,7 @@ WRITE_ERROR("The edge '" + id + "' is not known within the network (within a 'to-edge' tag)."); return; } - const SUMOReal probability = attrs.get(SUMO_ATTR_PROB, id.c_str(), ok); + const double probability = attrs.get(SUMO_ATTR_PROB, id.c_str(), ok); if (ok) { if (probability < 0) { WRITE_ERROR("'probability' must be positive (in definition of to-edge '" + id + "')."); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTRTurnDefLoader.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTRTurnDefLoader.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/jtrrouter/ROJTRTurnDefLoader.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/jtrrouter/ROJTRTurnDefLoader.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 20 Jan 2004 -/// @version $Id: ROJTRTurnDefLoader.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ROJTRTurnDefLoader.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Loader for the of turning percentages and source/sink definitions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -122,7 +122,7 @@ RONet& myNet; /// @brief The begin and the end of the current interval - SUMOReal myIntervalBegin, myIntervalEnd; + double myIntervalBegin, myIntervalEnd; /// @brief The current incoming edge the turning probabilities are set into ROJTREdge* myEdge; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/Makefile.am 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/Makefile.am 2017-07-23 16:22:07.000000000 +0000 @@ -5,12 +5,8 @@ GUI_DIRS = gui guinetload guisim netedit mesogui osgview endif -if CHECK_MEMORY_LEAKS -MEM_LIBS = ./foreign/nvwa/libnvwa.a -endif - if TRACI -TRACI_LIBS = ./traci-server/libtraciserver.a ./utils/traci/libtraci.a +TRACI_LIBS = ./traci-server/libtraciserver.a ./traci-server/lib/libtraci.a ./utils/traci/libtraciclient.a TRACI_DIRS = traci-server traci_testclient endif @@ -18,12 +14,13 @@ COMMON_LIBS = ./utils/options/liboptions.a \ ./utils/xml/libxml.a \ +./utils/distribution/libdistribution.a \ +./utils/geom/libgeom.a \ ./utils/common/libcommon.a \ ./utils/importio/libimportio.a \ ./utils/iodevices/libiodevices.a \ ./foreign/PHEMlight/cpp/libphemlight.a \ ./foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ $(XERCES_LIBS) @@ -31,10 +28,7 @@ od2trips_LDADD = ./od/libod.a \ ./utils/options/liboptions.a \ -./utils/distribution/libdistribution.a \ ./utils/vehicle/libvehicle.a \ -./utils/common/libcommon.a \ -./utils/geom/libgeom.a \ $(COMMON_LIBS) $(XERCES_LDFLAGS) @@ -52,7 +46,6 @@ ./microsim/traffic_lights/libmicrosimtls.a \ ./microsim/pedestrians/libmicrosimpeds.a \ ./mesosim/libmesosim.a \ -./utils/geom/libgeom.a \ ./utils/vehicle/libvehicle.a \ ./utils/shapes/libshapes.a \ ./utils/emissions/libemissions.a \ @@ -70,8 +63,6 @@ ./netimport/vissim/tempstructs/libvissimtmpstr.a \ ./netbuild/libnetbuild.a \ ./netwrite/libnetwrite.a \ -./utils/distribution/libdistribution.a \ -./utils/geom/libgeom.a \ ./foreign/eulerspiral/libeulerspiral.a \ $(COMMON_LIBS) \ $(XERCES_LDFLAGS) $(GDAL_LDFLAGS) $(PROJ_LDFLAGS) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/Makefile.in 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/Makefile.in 2017-07-23 16:22:07.000000000 +0000 @@ -99,16 +99,16 @@ netconvert_OBJECTS = $(am_netconvert_OBJECTS) am__DEPENDENCIES_1 = am__DEPENDENCIES_2 = ./utils/options/liboptions.a ./utils/xml/libxml.a \ + ./utils/distribution/libdistribution.a ./utils/geom/libgeom.a \ ./utils/common/libcommon.a ./utils/importio/libimportio.a \ ./utils/iodevices/libiodevices.a \ ./foreign/PHEMlight/cpp/libphemlight.a \ - ./foreign/tcpip/libtcpip.a $(MEM_LIBS) $(am__DEPENDENCIES_1) + ./foreign/tcpip/libtcpip.a $(am__DEPENDENCIES_1) netconvert_DEPENDENCIES = ./netimport/libnetimport.a \ ./netimport/vissim/libvissimimport.a \ ./netimport/vissim/typeloader/libvissimtypeload.a \ ./netimport/vissim/tempstructs/libvissimtmpstr.a \ ./netbuild/libnetbuild.a ./netwrite/libnetwrite.a \ - ./utils/distribution/libdistribution.a ./utils/geom/libgeom.a \ ./foreign/eulerspiral/libeulerspiral.a $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) @@ -119,9 +119,7 @@ am_od2trips_OBJECTS = od2trips_main.$(OBJEXT) od2trips_OBJECTS = $(am_od2trips_OBJECTS) od2trips_DEPENDENCIES = ./od/libod.a ./utils/options/liboptions.a \ - ./utils/distribution/libdistribution.a \ - ./utils/vehicle/libvehicle.a ./utils/common/libcommon.a \ - ./utils/geom/libgeom.a $(am__DEPENDENCIES_2) \ + ./utils/vehicle/libvehicle.a $(am__DEPENDENCIES_2) \ $(am__DEPENDENCIES_1) am_sumo_OBJECTS = sumo_main.$(OBJEXT) sumo_OBJECTS = $(am_sumo_OBJECTS) @@ -135,10 +133,9 @@ ./microsim/actions/libmsactions.a \ ./microsim/traffic_lights/libmicrosimtls.a \ ./microsim/pedestrians/libmicrosimpeds.a \ - ./mesosim/libmesosim.a ./utils/geom/libgeom.a \ - ./utils/vehicle/libvehicle.a ./utils/shapes/libshapes.a \ - ./utils/emissions/libemissions.a $(TRACI_LIBS) \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ + ./mesosim/libmesosim.a ./utils/vehicle/libvehicle.a \ + ./utils/shapes/libshapes.a ./utils/emissions/libemissions.a \ + $(TRACI_LIBS) $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am__sumo_gui_SOURCES_DIST = guisim_main.cpp @@ -154,10 +151,9 @@ ./microsim/actions/libmsactions.a \ ./microsim/traffic_lights/libmicrosimtls.a \ ./microsim/pedestrians/libmicrosimpeds.a \ - ./mesosim/libmesosim.a ./utils/geom/libgeom.a \ - ./utils/vehicle/libvehicle.a ./utils/shapes/libshapes.a \ - ./utils/emissions/libemissions.a $(TRACI_LIBS) \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ + ./mesosim/libmesosim.a ./utils/vehicle/libvehicle.a \ + ./utils/shapes/libshapes.a ./utils/emissions/libemissions.a \ + $(TRACI_LIBS) $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) @WITH_GUI_TRUE@sumo_gui_DEPENDENCIES = ./gui/libgui.a \ @@ -432,26 +428,23 @@ top_srcdir = @top_srcdir@ @WITH_GUI_TRUE@GUI_APPS = sumo-gui @WITH_GUI_TRUE@GUI_DIRS = gui guinetload guisim netedit mesogui osgview -@CHECK_MEMORY_LEAKS_TRUE@MEM_LIBS = ./foreign/nvwa/libnvwa.a -@TRACI_TRUE@TRACI_LIBS = ./traci-server/libtraciserver.a ./utils/traci/libtraci.a +@TRACI_TRUE@TRACI_LIBS = ./traci-server/libtraciserver.a ./traci-server/lib/libtraci.a ./utils/traci/libtraciclient.a @TRACI_TRUE@TRACI_DIRS = traci-server traci_testclient COMMON_LIBS = ./utils/options/liboptions.a \ ./utils/xml/libxml.a \ +./utils/distribution/libdistribution.a \ +./utils/geom/libgeom.a \ ./utils/common/libcommon.a \ ./utils/importio/libimportio.a \ ./utils/iodevices/libiodevices.a \ ./foreign/PHEMlight/cpp/libphemlight.a \ ./foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ $(XERCES_LIBS) od2trips_SOURCES = od2trips_main.cpp od2trips_LDADD = ./od/libod.a \ ./utils/options/liboptions.a \ -./utils/distribution/libdistribution.a \ ./utils/vehicle/libvehicle.a \ -./utils/common/libcommon.a \ -./utils/geom/libgeom.a \ $(COMMON_LIBS) $(XERCES_LDFLAGS) sumo_SOURCES = sumo_main.cpp @@ -467,7 +460,6 @@ ./microsim/traffic_lights/libmicrosimtls.a \ ./microsim/pedestrians/libmicrosimpeds.a \ ./mesosim/libmesosim.a \ -./utils/geom/libgeom.a \ ./utils/vehicle/libvehicle.a \ ./utils/shapes/libshapes.a \ ./utils/emissions/libemissions.a \ @@ -483,8 +475,6 @@ ./netimport/vissim/tempstructs/libvissimtmpstr.a \ ./netbuild/libnetbuild.a \ ./netwrite/libnetwrite.a \ -./utils/distribution/libdistribution.a \ -./utils/geom/libgeom.a \ ./foreign/eulerspiral/libeulerspiral.a \ $(COMMON_LIBS) \ $(XERCES_LDFLAGS) $(GDAL_LDFLAGS) $(PROJ_LDFLAGS) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,3 @@ -if CHECK_MEMORY_LEAKS -MEM_LIBS = ../foreign/nvwa/libnvwa.a -endif - bin_PROGRAMS = marouter marouter_SOURCES = marouter_main.cpp \ @@ -26,5 +22,4 @@ ../utils/emissions/libemissions.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ -l$(LIB_XERCES) $(FOX_LDFLAGS) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -107,7 +107,7 @@ ../utils/iodevices/libiodevices.a ../utils/geom/libgeom.a \ ../utils/emissions/libemissions.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ - ../foreign/tcpip/libtcpip.a $(MEM_LIBS) $(am__DEPENDENCIES_1) + ../foreign/tcpip/libtcpip.a $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -337,7 +337,6 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -@CHECK_MEMORY_LEAKS_TRUE@MEM_LIBS = ../foreign/nvwa/libnvwa.a marouter_SOURCES = marouter_main.cpp \ ROMAAssignments.cpp ROMAAssignments.h \ ROMAEdge.cpp ROMAEdge.h \ @@ -359,7 +358,6 @@ ../utils/emissions/libemissions.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ -l$(LIB_XERCES) $(FOX_LDFLAGS) all: all-am diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/marouter_main.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/marouter_main.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/marouter_main.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/marouter_main.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date Thu, 06 Jun 2002 -/// @version $Id: marouter_main.cpp 20838 2016-06-01 11:21:46Z behrisch $ +/// @version $Id: marouter_main.cpp 24095 2017-04-27 13:45:19Z namdre $ /// // Main for MAROUTER /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -78,10 +78,6 @@ #include "ROMARouteHandler.h" #include "ROMAEdge.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // functions @@ -104,7 +100,7 @@ /* const SUMOTime begin = string2time(oc.getString("begin")); const SUMOTime end = string2time(oc.getString("end")); for (std::map::const_iterator i = net.getEdgeMap().begin(); i != net.getEdgeMap().end(); ++i) { - (*i).second->addTravelTime(STEPS2TIME(begin), STEPS2TIME(end), (*i).second->getLength() / (*i).second->getSpeed()); + (*i).second->addTravelTime(STEPS2TIME(begin), STEPS2TIME(end), (*i).second->getLength() / (*i).second->getSpeedLimit()); }*/ // load the weights when wished/available if (oc.isSet("weight-files")) { @@ -115,9 +111,9 @@ } } -SUMOReal -getTravelTime(const ROEdge* const edge, const ROVehicle* const /* veh */, SUMOReal /* time */) { - return edge->getLength() / edge->getSpeed(); +double +getTravelTime(const ROEdge* const edge, const ROVehicle* const /* veh */, double /* time */) { + return edge->getLength() / edge->getSpeedLimit(); } @@ -155,8 +151,8 @@ ROMAEdge* edge = static_cast(i->second); if (edge->getFunc() == ROEdge::ET_NORMAL) { dev.openTag(SUMO_TAG_EDGE).writeAttr(SUMO_ATTR_ID, edge->getID()); - const SUMOReal traveltime = edge->getTravelTime(veh, STEPS2TIME(begin)); - const SUMOReal flow = edge->getFlow(STEPS2TIME(begin)); + const double traveltime = edge->getTravelTime(veh, STEPS2TIME(begin)); + const double flow = edge->getFlow(STEPS2TIME(begin)); dev.writeAttr("traveltime", traveltime); dev.writeAttr("speed", edge->getLength() / traveltime); dev.writeAttr("entered", flow); @@ -231,9 +227,9 @@ const SUMOTime weightPeriod = (oc.isSet("weight-files") ? string2time(oc.getString("weight-period")) : std::numeric_limits::max()); - router = new CHRouterWrapper >( - ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic, begin, weightPeriod); + ROEdge::getAllEdges(), oc.getBool("ignore-errors"), &ROEdge::getTravelTimeStatic, + begin, end, weightPeriod, oc.getInt("routing-threads")); } else { throw ProcessError("Unknown routing Algorithm '" + routingAlgorithm + "'!"); } @@ -317,7 +313,7 @@ const ODCell* const c = *i; if (lastEnd >= 0 && lastEnd <= c->begin) { for (std::map::const_iterator desc = sortedOut.begin(); desc != sortedOut.end(); ++desc) { - (*dev) << desc->second; + dev->writePreformattedTag(desc->second); } sortedOut.clear(); } @@ -367,7 +363,7 @@ } } for (std::map::const_iterator desc = sortedOut.begin(); desc != sortedOut.end(); ++desc) { - (*dev) << desc->second; + dev->writePreformattedTag(desc->second); } haveOutput = true; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMAAssignments.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMAAssignments.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMAAssignments.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMAAssignments.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date Feb 2013 -/// @version $Id: ROMAAssignments.cpp 20836 2016-06-01 09:00:35Z behrisch $ +/// @version $Id: ROMAAssignments.cpp 24095 2017-04-27 13:45:19Z namdre $ /// // Assignment methods /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,15 +43,11 @@ #include "ROMAEdge.h" #include "ROMAAssignments.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member variables // =========================================================================== -std::map ROMAAssignments::myPenalties; +std::map ROMAAssignments::myPenalties; // =========================================================================== @@ -59,7 +55,7 @@ // =========================================================================== ROMAAssignments::ROMAAssignments(const SUMOTime begin, const SUMOTime end, const bool additiveTraffic, - const SUMOReal adaptionFactor, RONet& net, ODMatrix& matrix, + const double adaptionFactor, RONet& net, ODMatrix& matrix, SUMOAbstractRouter& router) : myBegin(begin), myEnd(end), myAdditiveTraffic(additiveTraffic), myAdaptionFactor(adaptionFactor), myNet(net), myMatrix(matrix), myRouter(router) { myDefaultVehicle = new ROVehicle(SUMOVehicleParameter(), 0, net.getVehicleTypeSecure(DEFAULT_VTYPE_ID), &net); @@ -71,7 +67,7 @@ } // based on the definitions in PTV-Validate and in the VISUM-Cologne network -SUMOReal +double ROMAAssignments::getCapacity(const ROEdge* edge) { if (edge->getFunc() == ROEdge::ET_DISTRICT) { return 0; @@ -83,39 +79,39 @@ return 0; } else if (roadClass == 0 || roadClass == 1) { return edge->getLaneNo() * 2000.; //CR13 in table.py - } else if (roadClass == 2 && edge->getSpeed() <= 11.) { + } else if (roadClass == 2 && edge->getSpeedLimit() <= 11.) { return edge->getLaneNo() * 1333.33; //CR5 in table.py - } else if (roadClass == 2 && edge->getSpeed() > 11. && edge->getSpeed() <= 16.) { + } else if (roadClass == 2 && edge->getSpeedLimit() > 11. && edge->getSpeedLimit() <= 16.) { return edge->getLaneNo() * 1500.; //CR3 in table.py - } else if (roadClass == 2 && edge->getSpeed() > 16.) { + } else if (roadClass == 2 && edge->getSpeedLimit() > 16.) { return edge->getLaneNo() * 2000.; //CR13 in table.py - } else if (roadClass == 3 && edge->getSpeed() <= 11.) { + } else if (roadClass == 3 && edge->getSpeedLimit() <= 11.) { return edge->getLaneNo() * 800.; //CR5 in table.py - } else if (roadClass == 3 && edge->getSpeed() > 11. && edge->getSpeed() <= 13.) { + } else if (roadClass == 3 && edge->getSpeedLimit() > 11. && edge->getSpeedLimit() <= 13.) { return edge->getLaneNo() * 875.; //CR5 in table.py - } else if (roadClass == 3 && edge->getSpeed() > 13. && edge->getSpeed() <= 16.) { + } else if (roadClass == 3 && edge->getSpeedLimit() > 13. && edge->getSpeedLimit() <= 16.) { return edge->getLaneNo() * 1500.; //CR4 in table.py - } else if (roadClass == 3 && edge->getSpeed() > 16.) { + } else if (roadClass == 3 && edge->getSpeedLimit() > 16.) { return edge->getLaneNo() * 1800.; //CR13 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() <= 5.) { + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() <= 5.) { return edge->getLaneNo() * 200.; //CR7 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 5. && edge->getSpeed() <= 7.) { + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() > 5. && edge->getSpeedLimit() <= 7.) { return edge->getLaneNo() * 412.5; //CR7 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 7. && edge->getSpeed() <= 9.) { + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() > 7. && edge->getSpeedLimit() <= 9.) { return edge->getLaneNo() * 600.; //CR6 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 9. && edge->getSpeed() <= 11.) { + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() > 9. && edge->getSpeedLimit() <= 11.) { return edge->getLaneNo() * 800.; //CR5 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 11. && edge->getSpeed() <= 13.) { + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() > 11. && edge->getSpeedLimit() <= 13.) { return edge->getLaneNo() * 1125.; //CR5 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 13. && edge->getSpeed() <= 16.) { + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() > 13. && edge->getSpeedLimit() <= 16.) { return edge->getLaneNo() * 1583.; //CR4 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 16. && edge->getSpeed() <= 18.) { + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() > 16. && edge->getSpeedLimit() <= 18.) { return edge->getLaneNo() * 1100.; //CR3 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 18. && edge->getSpeed() <= 22.) { + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() > 18. && edge->getSpeedLimit() <= 22.) { return edge->getLaneNo() * 1200.; //CR3 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 22. && edge->getSpeed() <= 26.) { + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() > 22. && edge->getSpeedLimit() <= 26.) { return edge->getLaneNo() * 1300.; //CR3 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 26.) { + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() > 26.) { return edge->getLaneNo() * 1400.; //CR3 in table.py } return edge->getLaneNo() * 800.; //CR5 in table.py @@ -123,60 +119,60 @@ // based on the definitions in PTV-Validate and in the VISUM-Cologne network -SUMOReal -ROMAAssignments::capacityConstraintFunction(const ROEdge* edge, const SUMOReal flow) const { +double +ROMAAssignments::capacityConstraintFunction(const ROEdge* edge, const double flow) const { if (edge->getFunc() == ROEdge::ET_DISTRICT) { return 0; } const int roadClass = -edge->getPriority(); - const SUMOReal capacity = getCapacity(edge); + const double capacity = getCapacity(edge); // TODO: differ road class 1 from the unknown road class 1!!! if (edge->getLaneNo() == 0) { // TAZ have no cost return 0; } else if (roadClass == 0 || roadClass == 1) { - return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 1.3)) * 2.); //CR13 in table.py - } else if (roadClass == 2 && edge->getSpeed() <= 11.) { - return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 0.9)) * 3.); //CR5 in table.py - } else if (roadClass == 2 && edge->getSpeed() > 11. && edge->getSpeed() <= 16.) { - return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 1.)) * 2.); //CR3 in table.py - } else if (roadClass == 2 && edge->getSpeed() > 16.) { - return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 1.3)) * 2.); //CR13 in table.py - } else if (roadClass == 3 && edge->getSpeed() <= 11.) { - return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 0.9)) * 3.); //CR5 in table.py - } else if (roadClass == 3 && edge->getSpeed() > 11. && edge->getSpeed() <= 13.) { - return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 0.9)) * 3.); //CR5 in table.py - } else if (roadClass == 3 && edge->getSpeed() > 13. && edge->getSpeed() <= 16.) { - return edge->getLength() / edge->getSpeed() * (1. + 1.7 * (flow / (capacity * 1.)) * 2.); //CR4 in table.py - } else if (roadClass == 3 && edge->getSpeed() > 16.) { - return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 1.3)) * 2.); //CR13 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() <= 5.) { - return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 0.5)) * 3.); //CR7 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 5. && edge->getSpeed() <= 7.) { - return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 0.5)) * 3.); //CR7 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 7. && edge->getSpeed() <= 9.) { - return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 0.8)) * 3.); //CR6 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 9. && edge->getSpeed() <= 11.) { - return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 0.9)) * 3.); //CR5 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 11. && edge->getSpeed() <= 13.) { - return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 0.9)) * 3.); //CR5 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 13. && edge->getSpeed() <= 16.) { - return edge->getLength() / edge->getSpeed() * (1. + 1.7 * (flow / (capacity * 1.)) * 2.); //CR4 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 16. && edge->getSpeed() <= 18.) { - return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 1.)) * 2.); //CR3 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 18. && edge->getSpeed() <= 22.) { - return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 1.)) * 2.); //CR3 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 22. && edge->getSpeed() <= 26.) { - return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 1.)) * 2.); //CR3 in table.py - } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeed() > 26.) { - return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 1.)) * 2.); //CR3 in table.py + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.*(flow / (capacity * 1.3)) * 2.); //CR13 in table.py + } else if (roadClass == 2 && edge->getSpeedLimit() <= 11.) { + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.*(flow / (capacity * 0.9)) * 3.); //CR5 in table.py + } else if (roadClass == 2 && edge->getSpeedLimit() > 11. && edge->getSpeedLimit() <= 16.) { + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.*(flow / (capacity * 1.)) * 2.); //CR3 in table.py + } else if (roadClass == 2 && edge->getSpeedLimit() > 16.) { + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.*(flow / (capacity * 1.3)) * 2.); //CR13 in table.py + } else if (roadClass == 3 && edge->getSpeedLimit() <= 11.) { + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.*(flow / (capacity * 0.9)) * 3.); //CR5 in table.py + } else if (roadClass == 3 && edge->getSpeedLimit() > 11. && edge->getSpeedLimit() <= 13.) { + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.*(flow / (capacity * 0.9)) * 3.); //CR5 in table.py + } else if (roadClass == 3 && edge->getSpeedLimit() > 13. && edge->getSpeedLimit() <= 16.) { + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.7 * (flow / (capacity * 1.)) * 2.); //CR4 in table.py + } else if (roadClass == 3 && edge->getSpeedLimit() > 16.) { + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.*(flow / (capacity * 1.3)) * 2.); //CR13 in table.py + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() <= 5.) { + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.*(flow / (capacity * 0.5)) * 3.); //CR7 in table.py + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() > 5. && edge->getSpeedLimit() <= 7.) { + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.*(flow / (capacity * 0.5)) * 3.); //CR7 in table.py + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() > 7. && edge->getSpeedLimit() <= 9.) { + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.*(flow / (capacity * 0.8)) * 3.); //CR6 in table.py + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() > 9. && edge->getSpeedLimit() <= 11.) { + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.*(flow / (capacity * 0.9)) * 3.); //CR5 in table.py + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() > 11. && edge->getSpeedLimit() <= 13.) { + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.*(flow / (capacity * 0.9)) * 3.); //CR5 in table.py + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() > 13. && edge->getSpeedLimit() <= 16.) { + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.7 * (flow / (capacity * 1.)) * 2.); //CR4 in table.py + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() > 16. && edge->getSpeedLimit() <= 18.) { + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.*(flow / (capacity * 1.)) * 2.); //CR3 in table.py + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() > 18. && edge->getSpeedLimit() <= 22.) { + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.*(flow / (capacity * 1.)) * 2.); //CR3 in table.py + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() > 22. && edge->getSpeedLimit() <= 26.) { + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.*(flow / (capacity * 1.)) * 2.); //CR3 in table.py + } else if ((roadClass >= 4 || roadClass == -1) && edge->getSpeedLimit() > 26.) { + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.*(flow / (capacity * 1.)) * 2.); //CR3 in table.py } - return edge->getLength() / edge->getSpeed() * (1. + 1.*(flow / (capacity * 0.9)) * 3.); //CR5 in table.py + return edge->getLength() / edge->getSpeedLimit() * (1. + 1.*(flow / (capacity * 0.9)) * 3.); //CR5 in table.py } bool -ROMAAssignments::addRoute(ConstROEdgeVector& edges, std::vector& paths, std::string routeId, SUMOReal prob) { +ROMAAssignments::addRoute(ConstROEdgeVector& edges, std::vector& paths, std::string routeId, double prob) { std::vector::iterator p; for (p = paths.begin(); p != paths.end(); p++) { if (edges == (*p)->getEdgeVector()) { @@ -194,7 +190,7 @@ void -ROMAAssignments::getKPaths(const int kPaths, const SUMOReal penalty) { +ROMAAssignments::getKPaths(const int kPaths, const double penalty) { for (std::vector::const_iterator i = myMatrix.getCells().begin(); i != myMatrix.getCells().end(); ++i) { ODCell* c = *i; myPenalties.clear(); @@ -213,7 +209,7 @@ void ROMAAssignments::resetFlows() { - const SUMOReal begin = STEPS2TIME(MIN2(myBegin, myMatrix.getCells().front()->begin)); + const double begin = STEPS2TIME(MIN2(myBegin, myMatrix.getCells().front()->begin)); for (std::map::const_iterator i = myNet.getEdgeMap().begin(); i != myNet.getEdgeMap().end(); ++i) { ROMAEdge* edge = static_cast(i->second); edge->setFlow(begin, STEPS2TIME(myEnd), 0.); @@ -244,7 +240,7 @@ if (verbose) { WRITE_MESSAGE(" starting interval " + time2string(intervalStart)); } - std::map loadedTravelTimes; + std::map loadedTravelTimes; for (std::map::const_iterator i = myNet.getEdgeMap().begin(); i != myNet.getEdgeMap().end(); ++i) { ROMAEdge* edge = static_cast(i->second); if (edge->hasLoadedTravelTime(STEPS2TIME(intervalStart))) { @@ -259,7 +255,7 @@ int workerIndex = 0; for (std::vector::const_iterator i = myMatrix.getCells().begin() + (*offset); i != cellsEnd; i++) { ODCell* const c = *i; - const SUMOReal linkFlow = c->vehicleNumber / numIter; + const double linkFlow = c->vehicleNumber / numIter; const SUMOTime begin = myAdditiveTraffic ? myBegin : c->begin; #ifdef HAVE_FOX if (myNet.getThreadPool().size() > 0) { @@ -294,16 +290,16 @@ #endif for (std::vector::const_iterator i = myMatrix.getCells().begin() + (*offset); i != cellsEnd; i++) { ODCell* const c = *i; - const SUMOReal linkFlow = c->vehicleNumber / numIter; + const double linkFlow = c->vehicleNumber / numIter; const SUMOTime begin = myAdditiveTraffic ? myBegin : c->begin; const SUMOTime end = myAdditiveTraffic ? myEnd : c->end; - const SUMOReal intervalLengthInHours = STEPS2TIME(end - begin) / 3600.; + const double intervalLengthInHours = STEPS2TIME(end - begin) / 3600.; const ConstROEdgeVector& edges = c->pathsVector.back()->getEdgeVector(); for (ConstROEdgeVector::const_iterator e = edges.begin(); e != edges.end(); e++) { ROMAEdge* edge = static_cast(myNet.getEdge((*e)->getID())); - const SUMOReal newFlow = edge->getFlow(STEPS2TIME(begin)) + linkFlow; + const double newFlow = edge->getFlow(STEPS2TIME(begin)) + linkFlow; edge->setFlow(STEPS2TIME(begin), STEPS2TIME(end), newFlow); - SUMOReal travelTime = capacityConstraintFunction(edge, newFlow / intervalLengthInHours); + double travelTime = capacityConstraintFunction(edge, newFlow / intervalLengthInHours); if (lastBegin >= 0 && myAdaptionFactor > 0.) { if (loadedTravelTimes.count(edge) != 0) { travelTime = loadedTravelTimes[edge] * myAdaptionFactor + (1. - myAdaptionFactor) * travelTime; @@ -321,9 +317,9 @@ void -ROMAAssignments::sue(const int maxOuterIteration, const int maxInnerIteration, const int kPaths, const SUMOReal penalty, const SUMOReal tolerance, const std::string /* routeChoiceMethod */) { +ROMAAssignments::sue(const int maxOuterIteration, const int maxInnerIteration, const int kPaths, const double penalty, const double tolerance, const std::string /* routeChoiceMethod */) { getKPaths(kPaths, penalty); - std::map intervals; + std::map intervals; if (myAdditiveTraffic) { intervals[STEPS2TIME(myBegin)] = STEPS2TIME(myEnd); } else { @@ -348,7 +344,7 @@ // calculate route flows for (std::vector::const_iterator j = c->pathsVector.begin(); j != c->pathsVector.end(); ++j) { RORoute* r = *j; - const SUMOReal pathFlow = r->getProbability() * c->vehicleNumber; + const double pathFlow = r->getProbability() * c->vehicleNumber; // assign edge flow deltas for (ConstROEdgeVector::const_iterator e = r->getEdgeVector().begin(); e != r->getEdgeVector().end(); e++) { ROMAEdge* edge = static_cast(myNet.getEdge((*e)->getID())); @@ -358,12 +354,12 @@ } // calculate new edge flows and check for stability int unstableEdges = 0; - for (std::map::const_iterator i = intervals.begin(); i != intervals.end(); ++i) { - const SUMOReal intervalLengthInHours = STEPS2TIME(i->second - i->first) / 3600.; + for (std::map::const_iterator i = intervals.begin(); i != intervals.end(); ++i) { + const double intervalLengthInHours = STEPS2TIME(i->second - i->first) / 3600.; for (std::map::const_iterator e = myNet.getEdgeMap().begin(); e != myNet.getEdgeMap().end(); ++e) { ROMAEdge* edge = static_cast(e->second); - const SUMOReal oldFlow = edge->getFlow(i->first); - SUMOReal newFlow = oldFlow; + const double oldFlow = edge->getFlow(i->first); + double newFlow = oldFlow; if (inner == 0 && outer == 0) { newFlow += edge->getHelpFlow(i->first); } else { @@ -383,7 +379,7 @@ newFlow = 0.; } edge->setFlow(i->first, i->second, newFlow); - const SUMOReal travelTime = capacityConstraintFunction(edge, newFlow / intervalLengthInHours); + const double travelTime = capacityConstraintFunction(edge, newFlow / intervalLengthInHours); edge->addTravelTime(travelTime, i->first, i->second); edge->setHelpFlow(i->first, i->second, 0.); } @@ -426,22 +422,22 @@ } -SUMOReal -ROMAAssignments::getPenalizedEffort(const ROEdge* const e, const ROVehicle* const v, SUMOReal t) { - const std::map::const_iterator i = myPenalties.find(e); +double +ROMAAssignments::getPenalizedEffort(const ROEdge* const e, const ROVehicle* const v, double t) { + const std::map::const_iterator i = myPenalties.find(e); return i == myPenalties.end() ? e->getEffort(v, t) : e->getEffort(v, t) + i->second; } -SUMOReal -ROMAAssignments::getPenalizedTT(const ROEdge* const e, const ROVehicle* const v, SUMOReal t) { - const std::map::const_iterator i = myPenalties.find(e); +double +ROMAAssignments::getPenalizedTT(const ROEdge* const e, const ROVehicle* const v, double t) { + const std::map::const_iterator i = myPenalties.find(e); return i == myPenalties.end() ? e->getTravelTime(v, t) : e->getTravelTime(v, t) + i->second; } -SUMOReal -ROMAAssignments::getTravelTime(const ROEdge* const e, const ROVehicle* const v, SUMOReal t) { +double +ROMAAssignments::getTravelTime(const ROEdge* const e, const ROVehicle* const v, double t) { return e->getTravelTime(v, t); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMAAssignments.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMAAssignments.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMAAssignments.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMAAssignments.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date Feb 2013 -/// @version $Id: ROMAAssignments.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ROMAAssignments.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Assignment methods /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -59,7 +59,7 @@ public: /// Constructor ROMAAssignments(const SUMOTime begin, const SUMOTime end, const bool additiveTraffic, - const SUMOReal adaptionFactor, RONet& net, ODMatrix& matrix, SUMOAbstractRouter& router); + const double adaptionFactor, RONet& net, ODMatrix& matrix, SUMOAbstractRouter& router); /// Destructor ~ROMAAssignments(); @@ -69,10 +69,10 @@ } // @brief calculate edge capacity for the given edge - static SUMOReal getCapacity(const ROEdge* edge); + static double getCapacity(const ROEdge* edge); // @brief calculate edge travel time for the given edge and number of vehicles per hour - SUMOReal capacityConstraintFunction(const ROEdge* edge, const SUMOReal flow) const; + double capacityConstraintFunction(const ROEdge* edge, const double flow) const; // @brief clear effort storage void resetFlows(); @@ -84,7 +84,7 @@ void ue(); // @brief SUE method - void sue(const int maxOuterIteration, const int maxInnerIteration, const int kPaths, const SUMOReal penalty, const SUMOReal tolerance, const std::string routeChoiceMethod); + void sue(const int maxOuterIteration, const int maxInnerIteration, const int kPaths, const double penalty, const double tolerance, const std::string routeChoiceMethod); /** @brief Returns the effort to pass an edge including penalties * @@ -97,7 +97,7 @@ * @return The effort (time to pass in this case) for an edge * @see DijkstraRouterTT_ByProxi */ - static SUMOReal getPenalizedEffort(const ROEdge* const e, const ROVehicle* const v, SUMOReal t); + static double getPenalizedEffort(const ROEdge* const e, const ROVehicle* const v, double t); /** @brief Returns the traveltime on an edge including penalties * @@ -110,7 +110,7 @@ * @return The effort (time to pass in this case) for an edge * @see DijkstraRouterTT_ByProxi */ - static SUMOReal getPenalizedTT(const ROEdge* const e, const ROVehicle* const v, SUMOReal t); + static double getPenalizedTT(const ROEdge* const e, const ROVehicle* const v, double t); /** @brief Returns the traveltime on an edge without penalties * @@ -123,38 +123,38 @@ * @return The effort (time to pass in this case) for an edge * @see DijkstraRouterTT_ByProxi */ - static SUMOReal getTravelTime(const ROEdge* const e, const ROVehicle* const v, SUMOReal t); + static double getTravelTime(const ROEdge* const e, const ROVehicle* const v, double t); private: /// @brief add a route and check for duplicates - bool addRoute(ConstROEdgeVector& edges, std::vector& paths, std::string routeId, SUMOReal prob); + bool addRoute(ConstROEdgeVector& edges, std::vector& paths, std::string routeId, double prob); /// @brief get the k shortest paths - void getKPaths(const int kPaths, const SUMOReal penalty); + void getKPaths(const int kPaths, const double penalty); private: const SUMOTime myBegin; const SUMOTime myEnd; const bool myAdditiveTraffic; - const SUMOReal myAdaptionFactor; + const double myAdaptionFactor; RONet& myNet; ODMatrix& myMatrix; SUMOAbstractRouter& myRouter; - static std::map myPenalties; + static std::map myPenalties; ROVehicle* myDefaultVehicle; #ifdef HAVE_FOX private: class RoutingTask : public FXWorkerThread::Task { public: - RoutingTask(ROMAAssignments& assign, ODCell* c, const SUMOTime begin, const SUMOReal linkFlow) + RoutingTask(ROMAAssignments& assign, ODCell* c, const SUMOTime begin, const double linkFlow) : myAssign(assign), myCell(c), myBegin(begin), myLinkFlow(linkFlow) {} void run(FXWorkerThread* context); private: ROMAAssignments& myAssign; ODCell* const myCell; const SUMOTime myBegin; - const SUMOReal myLinkFlow; + const double myLinkFlow; private: /// @brief Invalidated assignment operator. RoutingTask& operator=(const RoutingTask&); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMAEdgeBuilder.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMAEdgeBuilder.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMAEdgeBuilder.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMAEdgeBuilder.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date Tue, 20 Jan 2004 -/// @version $Id: ROMAEdgeBuilder.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ROMAEdgeBuilder.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Interface for building instances of duarouter-edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,10 +33,6 @@ #include "ROMAEdgeBuilder.h" #include "ROMAEdge.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMAEdgeBuilder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMAEdgeBuilder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMAEdgeBuilder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMAEdgeBuilder.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date Tue, 20 Jan 2004 -/// @version $Id: ROMAEdgeBuilder.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ROMAEdgeBuilder.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Interface for building instances of duarouter-edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMAEdge.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMAEdge.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMAEdge.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMAEdge.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: ROMAEdge.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: ROMAEdge.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A basic edge for routing applications /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,10 +34,6 @@ #include "ROMAEdge.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMAEdge.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMAEdge.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMAEdge.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMAEdge.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: ROMAEdge.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: ROMAEdge.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A basic edge for routing applications /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -86,26 +86,26 @@ */ virtual void addSuccessor(ROEdge* s, std::string dir = ""); - void setFlow(const SUMOReal begin, const SUMOReal end, const SUMOReal flow) { + void setFlow(const double begin, const double end, const double flow) { myFlow.add(begin, end, flow); } - SUMOReal getFlow(const SUMOReal time) const { + double getFlow(const double time) const { return myFlow.getValue(time); } - void setHelpFlow(const SUMOReal begin, const SUMOReal end, const SUMOReal flow) { + void setHelpFlow(const double begin, const double end, const double flow) { myHelpFlow.add(begin, end, flow); } - SUMOReal getHelpFlow(const SUMOReal time) const { + double getHelpFlow(const double time) const { return myHelpFlow.getValue(time); } private: std::set myLeftTurns; - ValueTimeLine myFlow; - ValueTimeLine myHelpFlow; + ValueTimeLine myFlow; + ValueTimeLine myHelpFlow; private: /// @brief Invalidated copy constructor diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMAFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMAFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMAFrame.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMAFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: ROMAFrame.cpp 20811 2016-05-30 11:05:58Z behrisch $ +/// @version $Id: ROMAFrame.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Sets and checks options for ma-routing /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,10 +45,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -231,23 +227,23 @@ oc.doRegister("assignment-method", new Option_String("incremental")); oc.addDescription("assignment-method", "Processing", "Choose a assignment method: incremental, UE or SUE"); - oc.doRegister("tolerance", new Option_Float(SUMOReal(0.001))); + oc.doRegister("tolerance", new Option_Float(double(0.001))); oc.addDescription("tolerance", "Processing", "Use FLOAT as tolerance when checking for SUE stability"); - oc.doRegister("left-turn-penalty", new Option_Float(SUMOReal(0))); + oc.doRegister("left-turn-penalty", new Option_Float(0.)); oc.addDescription("left-turn-penalty", "Processing", "Use left-turn penalty FLOAT to calculate link travel time when searching routes"); oc.doRegister("paths", new Option_Integer(1)); oc.addDescription("paths", "Processing", "Use INTEGER as the number of paths needed to be searched for each OD pair at each iteration"); - oc.doRegister("paths.penalty", new Option_Float(SUMOReal(1))); + oc.doRegister("paths.penalty", new Option_Float(double(1))); oc.addDescription("paths.penalty", "Processing", "Penalize existing routes with FLOAT to find secondary routes"); - oc.doRegister("upperbound", new Option_Float(SUMOReal(0.5))); + oc.doRegister("upperbound", new Option_Float(double(0.5))); oc.addSynonyme("upperbound", "upper", true); oc.addDescription("upperbound", "Processing", "Use FLOAT as the upper bound to determine auxiliary link cost"); - oc.doRegister("lowerbound", new Option_Float(SUMOReal(0.15))); + oc.doRegister("lowerbound", new Option_Float(double(0.15))); oc.addSynonyme("lowerbound", "lower", true); oc.addDescription("lowerbound", "Processing", "Use FLOAT as the lower bound to determine auxiliary link cost"); @@ -261,11 +257,11 @@ oc.doRegister("route-choice-method", new Option_String("logit")); oc.addDescription("route-choice-method", "Processing", "Choose a route choice method: gawron, logit, or lohse"); - oc.doRegister("gawron.beta", new Option_Float(SUMOReal(0.3))); + oc.doRegister("gawron.beta", new Option_Float(double(0.3))); oc.addSynonyme("gawron.beta", "gBeta", true); oc.addDescription("gawron.beta", "Processing", "Use FLOAT as Gawron's beta"); - oc.doRegister("gawron.a", new Option_Float(SUMOReal(0.05))); + oc.doRegister("gawron.a", new Option_Float(double(0.05))); oc.addSynonyme("gawron.a", "gA", true); oc.addDescription("gawron.a", "Processing", "Use FLOAT as Gawron's a"); @@ -278,15 +274,15 @@ oc.doRegister("skip-new-routes", new Option_Bool(false)); oc.addDescription("skip-new-routes", "Processing", "Only reuse routes from input, do not calculate new ones"); - oc.doRegister("logit.beta", new Option_Float(SUMOReal(0.15))); // check: remove the default? + oc.doRegister("logit.beta", new Option_Float(double(0.15))); // check: remove the default? oc.addSynonyme("logit.beta", "lBeta", true); oc.addDescription("logit.beta", "Processing", "Use FLOAT as (c-)logit's beta for the commonality factor"); - oc.doRegister("logit.gamma", new Option_Float(SUMOReal(1))); + oc.doRegister("logit.gamma", new Option_Float(double(1))); oc.addSynonyme("logit.gamma", "lGamma", true); oc.addDescription("logit.gamma", "Processing", "Use FLOAT as (c-)logit's gamma for the commonality factor"); - oc.doRegister("logit.theta", new Option_Float(SUMOReal(0.01))); + oc.doRegister("logit.theta", new Option_Float(double(0.01))); oc.addSynonyme("logit.theta", "lTheta", true); oc.addDescription("logit.theta", "Processing", "Use FLOAT as (c-)logit's theta"); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMAFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMAFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMAFrame.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMAFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: ROMAFrame.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ROMAFrame.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Sets and checks options for ma-routing /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMARouteHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMARouteHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMARouteHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMARouteHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,7 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Mon, 9 Jul 2001 -/// @version $Id: ROMARouteHandler.cpp 20653 2016-05-05 13:03:28Z behrisch $ +/// @version $Id: ROMARouteHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Parser and container for routes during their loading /****************************************************************************/ @@ -36,10 +36,6 @@ #include #include "ROMARouteHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMARouteHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMARouteHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/marouter/ROMARouteHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/marouter/ROMARouteHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 9 Jul 2001 -/// @version $Id: ROMARouteHandler.h 20653 2016-05-05 13:03:28Z behrisch $ +/// @version $Id: ROMARouteHandler.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Parser and container for routes during their loading /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesogui/GUIMEInductLoop.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesogui/GUIMEInductLoop.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesogui/GUIMEInductLoop.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesogui/GUIMEInductLoop.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUIMEInductLoop.cpp /// @author Daniel Krajzewicz /// @date Thu, 21.07.2005 -/// @version $Id: GUIMEInductLoop.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUIMEInductLoop.cpp 23800 2017-04-04 09:37:29Z behrisch $ /// // The gui-version of the MEInductLoop /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,10 +41,6 @@ #include #include "GUIMEInductLoop.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -53,7 +49,7 @@ * GUIMEInductLoop-methods * ----------------------------------------------------------------------- */ GUIMEInductLoop::GUIMEInductLoop(const std::string& id, MESegment* s, - SUMOReal position, const std::string& vTypes) + double position, const std::string& vTypes) : MEInductLoop(id, s, position, vTypes) {} @@ -69,13 +65,13 @@ /* ------------------------------------------------------------------------- * GUIMEInductLoop::MyWrapper-methods * ----------------------------------------------------------------------- */ -GUIMEInductLoop::MyWrapper::MyWrapper(GUIMEInductLoop& detector, SUMOReal pos) +GUIMEInductLoop::MyWrapper::MyWrapper(GUIMEInductLoop& detector, double pos) : GUIDetectorWrapper("induct loop", detector.getID()), myDetector(detector), myPosition(pos) { const MSLane* lane = detector.mySegment->getEdge().getLanes()[0]; myFGPosition = lane->geometryPositionAtOffset(pos); - myBoundary.add(myFGPosition.x() + (SUMOReal) 5.5, myFGPosition.y() + (SUMOReal) 5.5); - myBoundary.add(myFGPosition.x() - (SUMOReal) 5.5, myFGPosition.y() - (SUMOReal) 5.5); + myBoundary.add(myFGPosition.x() + (double) 5.5, myFGPosition.y() + (double) 5.5); + myBoundary.add(myFGPosition.x() - (double) 5.5, myFGPosition.y() - (double) 5.5); myFGRotation = -lane->getShape().rotationDegreeAtOffset(pos); } @@ -100,20 +96,20 @@ // add items /* ret->mkItem("flow [veh/h]", true, - new FuncBinding_IntParam( + new FuncBinding_IntParam( &(getLoop()), &GUIMEInductLoop::getFlow, 1)); ret->mkItem("mean speed [m/s]", true, - new FuncBinding_IntParam( + new FuncBinding_IntParam( &(getLoop()), &GUIMEInductLoop::getMeanSpeed, 1)); ret->mkItem("occupancy [%]", true, - new FuncBinding_IntParam( + new FuncBinding_IntParam( &(getLoop()), &GUIMEInductLoop::getOccupancy, 1)); ret->mkItem("mean vehicle length [m]", true, - new FuncBinding_IntParam( + new FuncBinding_IntParam( &(getLoop()), &GUIMEInductLoop::getMeanVehicleLength, 1)); ret->mkItem("empty time [s]", true, - new FunctionBinding( - &(getLoop()), &GUIMEInductLoop::getTimestepsSinceLastDetection)); + new FunctionBinding( + &(getLoop()), &GUIMEInductLoop::getTimeSinceLastDetection)); */ // ret->mkItem("position [m]", false, myPosition); @@ -128,9 +124,9 @@ GUIMEInductLoop::MyWrapper::drawGL(const GUIVisualizationSettings& s) const { glPushName(getGlID()); glPolygonOffset(0, -2); - SUMOReal width = (SUMOReal) 2.0 * s.scale; + double width = (double) 2.0 * s.scale; glLineWidth(1.0); - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); // shape glColor3d(1, 1, 0); glPushMatrix(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesogui/GUIMEInductLoop.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesogui/GUIMEInductLoop.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesogui/GUIMEInductLoop.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesogui/GUIMEInductLoop.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUIMEInductLoop.h /// @author Daniel Krajzewicz /// @date Thu, 21.07.2005 -/// @version $Id: GUIMEInductLoop.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUIMEInductLoop.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The gui-version of the MEInductLoop /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,7 +55,7 @@ public: /// Construtor GUIMEInductLoop(const std::string& id, MESegment* s, - SUMOReal position, const std::string& vTypes); + double position, const std::string& vTypes); /// Destructor ~GUIMEInductLoop(); @@ -75,7 +75,7 @@ public: /// Constructor MyWrapper(GUIMEInductLoop& detector, - SUMOReal pos); + double pos); /// Destructor ~MyWrapper(); @@ -126,10 +126,10 @@ Position myFGPosition; /// The rotation in full-geometry mode - SUMOReal myFGRotation; + double myFGRotation; /// The position on the lane - SUMOReal myPosition; + double myPosition; private: /// @brief Invalidated copy constructor. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesogui/GUIMEVehicleControl.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesogui/GUIMEVehicleControl.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesogui/GUIMEVehicleControl.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesogui/GUIMEVehicleControl.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUIMEVehicleControl.h /// @author Jakob Erdmann /// @date Okt 2012 -/// @version $Id: GUIMEVehicleControl.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: GUIMEVehicleControl.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The class responsible for building and deletion of meso vehicles (gui-version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "GUIMEVehicleControl.h" #include "GUIMEVehicle.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesogui/GUIMEVehicleControl.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesogui/GUIMEVehicleControl.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesogui/GUIMEVehicleControl.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesogui/GUIMEVehicleControl.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUIMEVehicleControl.h /// @author Jakob Erdmann /// @date Okt 2012 -/// @version $Id: GUIMEVehicleControl.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIMEVehicleControl.h 22608 2017-01-17 06:28:54Z behrisch $ /// // The class responsible for building and deletion of meso vehicles (gui-version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesogui/GUIMEVehicle.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesogui/GUIMEVehicle.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesogui/GUIMEVehicle.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesogui/GUIMEVehicle.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIMEVehicle.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: GUIMEVehicle.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A MSVehicle extended by some values for usage within the gui /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,24 +40,21 @@ #include #include "GUIMEVehicle.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== #ifdef _MSC_VER +#pragma warning(push) #pragma warning(disable: 4355) #endif GUIMEVehicle::GUIMEVehicle(SUMOVehicleParameter* pars, const MSRoute* route, - const MSVehicleType* type, const SUMOReal speedFactor) : + const MSVehicleType* type, const double speedFactor) : MEVehicle(pars, route, type, speedFactor), GUIBaseVehicle((MSBaseVehicle&) * this) { } #ifdef _MSC_VER -#pragma warning(default: 4355) +#pragma warning(pop) #endif @@ -72,22 +69,22 @@ // add items ret->mkItem("edge [id]", false, getEdge()->getID()); ret->mkItem("segment [#]", false, getSegment()->getIndex()); - ret->mkItem("position [m]", true, new FunctionBinding(this, &MEVehicle::getPositionOnLane)); - ret->mkItem("speed [m/s]", true, new FunctionBinding(this, &MEVehicle::getSpeed)); - ret->mkItem("angle [degree]", true, new FunctionBinding(this, &GUIBaseVehicle::getNaviDegree)); + ret->mkItem("position [m]", true, new FunctionBinding(this, &MEVehicle::getPositionOnLane)); + ret->mkItem("speed [m/s]", true, new FunctionBinding(this, &MEVehicle::getSpeed)); + ret->mkItem("angle [degree]", true, new FunctionBinding(this, &GUIBaseVehicle::getNaviDegree)); ret->mkItem("waiting time [s]", true, - new FunctionBinding(this, &MEVehicle::getWaitingSeconds)); + new FunctionBinding(this, &MEVehicle::getWaitingSeconds)); if (getChosenSpeedFactor() != 1) { ret->mkItem("speed factor", false, getChosenSpeedFactor()); } //ret->mkItem("time gap [s]", true, - // new FunctionBinding(this, &MSVehicle::getTimeGap)); + // new FunctionBinding(this, &MSVehicle::getTimeGap)); //ret->mkItem("waiting time [s]", true, - // new FunctionBinding(this, &MSVehicle::getWaitingSeconds)); + // new FunctionBinding(this, &MSVehicle::getWaitingSeconds)); //ret->mkItem("impatience", true, - // new FunctionBinding(this, &MSVehicle::getImpatience)); + // new FunctionBinding(this, &MSVehicle::getImpatience)); //ret->mkItem("last lane change [s]", true, - // new FunctionBinding(this, &GUIMEVehicle::getLastLaneChangeOffset)); + // new FunctionBinding(this, &GUIMEVehicle::getLastLaneChangeOffset)); ret->mkItem("desired depart [s]", false, time2string(getParameter().depart)); ret->mkItem("depart delay [s]", false, time2string(getDepartDelay())); if (getParameter().repetitionNumber < INT_MAX) { @@ -102,19 +99,19 @@ //ret->mkItem("stop info", false, getStopInfo()); ret->mkItem("line", false, myParameter->line); //ret->mkItem("CO2 [mg/s]", true, - // new FunctionBinding(this, &GUIMEVehicle::getCO2Emissions)); + // new FunctionBinding(this, &GUIMEVehicle::getCO2Emissions)); //ret->mkItem("CO [mg/s]", true, - // new FunctionBinding(this, &GUIMEVehicle::getCOEmissions)); + // new FunctionBinding(this, &GUIMEVehicle::getCOEmissions)); //ret->mkItem("HC [mg/s]", true, - // new FunctionBinding(this, &GUIMEVehicle::getHCEmissions)); + // new FunctionBinding(this, &GUIMEVehicle::getHCEmissions)); //ret->mkItem("NOx [mg/s]", true, - // new FunctionBinding(this, &GUIMEVehicle::getNOxEmissions)); + // new FunctionBinding(this, &GUIMEVehicle::getNOxEmissions)); //ret->mkItem("PMx [mg/s]", true, - // new FunctionBinding(this, &GUIMEVehicle::getPMxEmissions)); + // new FunctionBinding(this, &GUIMEVehicle::getPMxEmissions)); //ret->mkItem("fuel [ml/s]", true, - // new FunctionBinding(this, &GUIMEVehicle::getFuelConsumption)); + // new FunctionBinding(this, &GUIMEVehicle::getFuelConsumption)); //ret->mkItem("noise (Harmonoise) [dB]", true, - // new FunctionBinding(this, &GUIMEVehicle::getHarmonoise_NoiseEmissions)); + // new FunctionBinding(this, &GUIMEVehicle::getHarmonoise_NoiseEmissions)); std::ostringstream str; for (std::vector::const_iterator i = myDevices.begin(); i != myDevices.end(); ++i) { if (i != myDevices.begin()) { @@ -130,10 +127,10 @@ ret->mkItem("parameters [key:val]", false, toString(getParameter().getMap())); // meso specific values - ret->mkItem("event time [s]", true, new FunctionBinding(this, &MEVehicle::getEventTimeSeconds)); - ret->mkItem("entry time [s]", true, new FunctionBinding(this, &MEVehicle::getLastEntryTimeSeconds)); - ret->mkItem("block time [s]", true, new FunctionBinding(this, &MEVehicle::getBlockTimeSeconds)); - ret->mkItem("tls penalty [s]", true, new FunctionBinding(this, &MEVehicle::getCurrentTLSPenaltySeconds)); + ret->mkItem("event time [s]", true, new FunctionBinding(this, &MEVehicle::getEventTimeSeconds)); + ret->mkItem("entry time [s]", true, new FunctionBinding(this, &MEVehicle::getLastEntryTimeSeconds)); + ret->mkItem("block time [s]", true, new FunctionBinding(this, &MEVehicle::getBlockTimeSeconds)); + ret->mkItem("link penalty [s]", true, new FunctionBinding(this, &MEVehicle::getCurrentLinkPenaltySeconds)); // close building ret->closeBuilding(); return ret; @@ -174,7 +171,7 @@ } -SUMOReal +double GUIMEVehicle::getColorValue(int activeScheme) const { switch (activeScheme) { case 8: @@ -211,7 +208,7 @@ case 23: return 0; // invalid getAcceleration(); case 24: - return 0; // invalid getTimeGap(); + return 0; // invalid getTimeGapOnLane(); case 25: return STEPS2TIME(getDepartDelay()); } @@ -221,7 +218,7 @@ void -GUIMEVehicle::drawRouteHelper(const MSRoute& r, SUMOReal exaggeration) const { +GUIMEVehicle::drawRouteHelper(const MSRoute& r, double exaggeration) const { MSRouteIterator i = r.begin(); for (; i != r.end(); ++i) { const GUILane* lane = static_cast((*i)->getLanes()[0]); @@ -231,7 +228,7 @@ } -SUMOReal +double GUIMEVehicle::getLastLaneChangeOffset() const { // @todo possibly we could compute something reasonable here return 0; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesogui/GUIMEVehicle.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesogui/GUIMEVehicle.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesogui/GUIMEVehicle.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesogui/GUIMEVehicle.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIMEVehicle.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: GUIMEVehicle.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A MSVehicle extended by some values for usage within the gui /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -68,7 +68,7 @@ * @exception ProcessError If a value is wrong */ GUIMEVehicle(SUMOVehicleParameter* pars, const MSRoute* route, - const MSVehicleType* type, const SUMOReal speedFactor); + const MSVehicleType* type, const double speedFactor); /// @brief destructor @@ -79,7 +79,7 @@ * * @note implementation of abstract method does not work otherwise */ - Position getPosition(const SUMOReal offset = 0) const { + Position getPosition(const double offset = 0) const { return MEVehicle::getPosition(offset); } @@ -87,12 +87,12 @@ * * @note implementation of abstract method does not work otherwise */ - SUMOReal getAngle() const { + double getAngle() const { return MEVehicle::getAngle(); } /// @brief gets the color value according to the current scheme index - SUMOReal getColorValue(int activeScheme) const; + double getColorValue(int activeScheme) const; /// @brief draws the given guiShape if it has distinc carriages/modules and eturns true if so bool drawAction_drawCarriageClass(const GUIVisualizationSettings& s, SUMOVehicleShape guiShape, bool asImage) const; @@ -101,12 +101,12 @@ * @see MSVehicle::myLastLaneChangeOffset * @return The time since the last lane change in seconds */ - SUMOReal getLastLaneChangeOffset() const; + double getLastLaneChangeOffset() const; /** @brief Draws the route * @param[in] r The route to draw */ - void drawRouteHelper(const MSRoute& r, SUMOReal exaggeration) const; + void drawRouteHelper(const MSRoute& r, double exaggeration) const; /// @brief retrieve information about the current stop state std::string getStopInfo() const; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MEInductLoop.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MEInductLoop.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MEInductLoop.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MEInductLoop.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MEInductLoop.cpp /// @author Daniel Krajzewicz /// @date Tue, May 2005 -/// @version $Id: MEInductLoop.cpp 21496 2016-09-19 10:39:08Z behrisch $ +/// @version $Id: MEInductLoop.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // An induction loop for mesoscopic simulation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,17 +42,13 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== MEInductLoop::MEInductLoop(const std::string& id, MESegment* s, - SUMOReal positionInMeters, + double positionInMeters, const std::string& vTypes) : MSDetectorFileOutput(id, vTypes), mySegment(s), myPosition(positionInMeters), @@ -71,7 +67,7 @@ mySegment->prepareDetectorForWriting(myMeanData); dev.openTag(SUMO_TAG_INTERVAL).writeAttr(SUMO_ATTR_BEGIN, time2string(startTime)).writeAttr(SUMO_ATTR_END, time2string(stopTime)); dev.writeAttr(SUMO_ATTR_ID, StringUtils::escapeXML(myID)).writeAttr("sampledSeconds", myMeanData.getSamples()); - myMeanData.write(dev, stopTime - startTime, (SUMOReal)mySegment->getEdge().getLanes().size(), -1.0); + myMeanData.write(dev, stopTime - startTime, (double)mySegment->getEdge().getLanes().size(), -1.0); myMeanData.reset(); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MEInductLoop.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MEInductLoop.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MEInductLoop.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MEInductLoop.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MEInductLoop.h /// @author Daniel Krajzewicz /// @date Tue, May 2005 -/// @version $Id: MEInductLoop.h 21496 2016-09-19 10:39:08Z behrisch $ +/// @version $Id: MEInductLoop.h 23800 2017-04-04 09:37:29Z behrisch $ /// // An induction loop for mesoscopic simulation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -56,7 +56,7 @@ public: MEInductLoop(const std::string& id, MESegment* s, - SUMOReal positionInMeters, + double positionInMeters, const std::string& vTypes); @@ -74,19 +74,19 @@ * @see MSDetectorFileOutput::writeXMLDetectorProlog */ void writeXMLDetectorProlog(OutputDevice& dev) const { - dev.writeXMLHeader("detector"); + dev.writeXMLHeader("detector", "det_e1meso_file.xsd"); } /** * Get the XML-formatted output of all the get*-methods except - * getTimestepsSinceLastDetection. + * getTimeSinceLastDetection. * * @param lastNTimesteps take data out of the interval * (now-lastNTimesteps, now]. * * @return XML-formatted output of all the get*-methods except - * getTimestepsSinceLastDetection. + * getTimeSinceLastDetection. * * @see MSDetector2File */ @@ -99,7 +99,7 @@ MESegment* const mySegment; /// @brief position from the start of the edge / lane - const SUMOReal myPosition; + const double myPosition; /// @brief data collector for the loop MSMeanData_Net::MSLaneMeanDataValues myMeanData; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MELoop.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MELoop.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MELoop.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MELoop.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MELoop.cpp /// @author Daniel Krajzewicz /// @date Tue, May 2005 -/// @version $Id: MELoop.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MELoop.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The main mesocopic simulation loop /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,10 +47,6 @@ #include "MESegment.h" #include "MEVehicle.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -251,7 +247,7 @@ int -MELoop::numSegmentsFor(const SUMOReal length, const SUMOReal sLength) { +MELoop::numSegmentsFor(const double length, const double sLength) { int no = (int)floor(length / sLength + 0.5); if (no == 0) { // assure there is at least one segment return 1; @@ -263,10 +259,9 @@ void MELoop::buildSegmentsFor(const MSEdge& e, const OptionsCont& oc) { - const SUMOReal length = e.getLength(); + const double length = e.getLength(); int no = numSegmentsFor(length, oc.getFloat("meso-edgelength")); - const SUMOReal slength = length / (SUMOReal)no; - const SUMOReal lengthGeometryFactor = e.getLanes()[0]->getLengthGeometryFactor(); + const double slength = length / (double)no; MESegment* newSegment = 0; MESegment* nextSegment = 0; bool multiQueue = oc.getBool("meso-multi-queue"); @@ -278,8 +273,7 @@ e.getLanes()[0]->getSpeedLimit(), s, string2time(oc.getString("meso-tauff")), string2time(oc.getString("meso-taufj")), string2time(oc.getString("meso-taujf")), string2time(oc.getString("meso-taujj")), - oc.getFloat("meso-jam-threshold"), multiQueue, junctionControl, - lengthGeometryFactor); + oc.getFloat("meso-jam-threshold"), multiQueue, junctionControl); multiQueue = false; junctionControl = false; nextSegment = newSegment; @@ -292,10 +286,10 @@ MESegment* -MELoop::getSegmentForEdge(const MSEdge& e, SUMOReal pos) { +MELoop::getSegmentForEdge(const MSEdge& e, double pos) { MESegment* s = myEdges2FirstSegments[e.getNumericalID()]; if (pos > 0) { - SUMOReal cpos = 0; + double cpos = 0; while (s->getNextSegment() != 0 && cpos + s->getLength() < pos) { cpos += s->getLength(); s = s->getNextSegment(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MELoop.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MELoop.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MELoop.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MELoop.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MELoop.h /// @author Daniel Krajzewicz /// @date Tue, May 2005 -/// @version $Id: MELoop.h 20496 2016-04-19 12:08:29Z namdre $ +/// @version $Id: MELoop.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The main mesocopic simulation loop /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -82,7 +82,7 @@ void removeLeaderCar(MEVehicle* v); /** @brief Compute number of segments per edge (best value stay close to the configured segment length) */ - static int numSegmentsFor(const SUMOReal length, const SUMOReal slength); + static int numSegmentsFor(const double length, const double slength); /** @brief Build the segments for a given edge * @@ -96,7 +96,7 @@ * @param[in] pos the position to get the segment for * @return The relevant segment */ - MESegment* getSegmentForEdge(const MSEdge& e, SUMOReal pos = 0); + MESegment* getSegmentForEdge(const MSEdge& e, double pos = 0); /** @brief change to the next segment * this handles combinations of the following cases: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MESegment.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MESegment.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MESegment.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MESegment.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MESegment.cpp /// @author Daniel Krajzewicz /// @date Tue, May 2005 -/// @version $Id: MESegment.cpp 21806 2016-10-26 12:37:36Z behrisch $ +/// @version $Id: MESegment.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A single mesoscopic segment (cell) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -50,32 +50,27 @@ #include "MELoop.h" #include "MESegment.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - -#define DEFAULT_VEH_LENGHT_WITH_GAP 7.5f +#define DEFAULT_VEH_LENGHT_WITH_GAP (SUMOVTypeParameter::getDefault().length + SUMOVTypeParameter::getDefault().minGap) // avoid division by zero when driving very slowly -#define MESO_MIN_SPEED ((SUMOReal)0.05) +#define MESO_MIN_SPEED (0.05) // =========================================================================== // static member defintion // =========================================================================== MSEdge MESegment::myDummyParent("MESegmentDummyParent", -1, MSEdge::EDGEFUNCTION_UNKNOWN, "", "", -1); MESegment MESegment::myVaporizationTarget("vaporizationTarget"); -const SUMOReal MESegment::DO_NOT_PATCH_JAM_THRESHOLD(std::numeric_limits::max()); +const double MESegment::DO_NOT_PATCH_JAM_THRESHOLD(std::numeric_limits::max()); // =========================================================================== // method definitions // =========================================================================== MESegment::MESegment(const std::string& id, const MSEdge& parent, MESegment* next, - SUMOReal length, SUMOReal speed, + double length, double speed, int idx, SUMOTime tauff, SUMOTime taufj, SUMOTime taujf, SUMOTime taujj, - SUMOReal jamThresh, bool multiQueue, bool junctionControl, - SUMOReal lengthGeometryFactor) : + double jamThresh, bool multiQueue, bool junctionControl) : Named(id), myEdge(parent), myNextSegment(next), myLength(length), myIndex(idx), myTau_ff((SUMOTime)(tauff / parent.getLanes().size())), @@ -87,33 +82,39 @@ myCapacity(length * parent.getLanes().size()), myOccupancy(0.f), myJunctionControl(junctionControl), - myTLSPenalty(MSGlobals::gMesoTLSPenalty > 0 && myNextSegment == 0 && ( + myTLSPenalty(MSGlobals::gMesoTLSPenalty > 0 && + // only apply to the last segment of a tls-controlled edge + myNextSegment == 0 && ( parent.getToJunction()->getType() == NODETYPE_TRAFFIC_LIGHT || parent.getToJunction()->getType() == NODETYPE_TRAFFIC_LIGHT_NOJUNCTION || parent.getToJunction()->getType() == NODETYPE_TRAFFIC_LIGHT_RIGHT_ON_RED)), + myMinorPenalty(MSGlobals::gMesoMinorPenalty > 0 && + // only apply to the last segment of an uncontrolled edge that has at least 1 minor link + myNextSegment == 0 && + parent.getToJunction()->getType() != NODETYPE_TRAFFIC_LIGHT && + parent.getToJunction()->getType() != NODETYPE_TRAFFIC_LIGHT_NOJUNCTION && + parent.getToJunction()->getType() != NODETYPE_TRAFFIC_LIGHT_RIGHT_ON_RED && + parent.hasMinorLink()), myEntryBlockTime(SUMOTime_MIN), - myLengthGeometryFactor(lengthGeometryFactor), + myLastHeadway(TIME2STEPS(-1)), myMeanSpeed(speed), myLastMeanSpeedUpdate(SUMOTime_MIN) { myCarQues.push_back(std::vector()); myBlockTimes.push_back(-1); - const std::vector& lanes = parent.getLanes(); - if (multiQueue && lanes.size() > 1) { - int numFollower = parent.getNumSuccessors(); - if (numFollower > 1) { - while (myCarQues.size() < lanes.size()) { - myCarQues.push_back(std::vector()); - myBlockTimes.push_back(-1); - } - for (int i = 0; i < numFollower; ++i) { - const MSEdge* const edge = parent.getSuccessors()[i]; - const std::vector* const allowed = parent.allowedLanes(*edge); - assert(allowed != 0); - assert(allowed->size() > 0); - for (std::vector::const_iterator j = allowed->begin(); j != allowed->end(); ++j) { - std::vector::const_iterator it = find(lanes.begin(), lanes.end(), *j); - myFollowerMap[edge].push_back((int)distance(lanes.begin(), it)); - } + if (useMultiQueue(multiQueue, parent)) { + const std::vector& lanes = parent.getLanes(); + while (myCarQues.size() < lanes.size()) { + myCarQues.push_back(std::vector()); + myBlockTimes.push_back(-1); + } + for (int i = 0; i < (int)parent.getNumSuccessors(); ++i) { + const MSEdge* const edge = parent.getSuccessors()[i]; + const std::vector* const allowed = parent.allowedLanes(*edge); + assert(allowed != 0); + assert(allowed->size() > 0); + for (std::vector::const_iterator j = allowed->begin(); j != allowed->end(); ++j) { + std::vector::const_iterator it = find(lanes.begin(), lanes.end(), *j); + myFollowerMap[edge].push_back((int)distance(lanes.begin(), it)); } } } @@ -128,18 +129,28 @@ myTau_ff(0), myTau_fj(0), myTau_jf(0), myTau_jj(0), myTau_length(1), myHeadwayCapacity(0), myCapacity(0), myJunctionControl(false), myTLSPenalty(false), - myLengthGeometryFactor(0) { + myMinorPenalty(false) { } +bool +MESegment::useMultiQueue(bool multiQueue, const MSEdge& parent) { + return multiQueue && parent.getLanes().size() > 1 && parent.getNumSuccessors() > 1; +} + void -MESegment::recomputeJamThreshold(SUMOReal jamThresh) { +MESegment::recomputeJamThreshold(double jamThresh) { if (jamThresh == DO_NOT_PATCH_JAM_THRESHOLD) { return; } if (jamThresh < 0) { // compute based on speed - myJamThreshold = jamThresholdForSpeed(myEdge.getSpeedLimit(), jamThresh); + double speed = myEdge.getSpeedLimit(); + if (myTLSPenalty || myMinorPenalty) { + double travelTime = myLength / MAX2(speed, NUMERICAL_EPS) + getMaxPenaltySeconds(); + speed = myLength / travelTime; + } + myJamThreshold = jamThresholdForSpeed(speed, jamThresh); } else { // compute based on specified percentage myJamThreshold = jamThresh * myCapacity; @@ -148,18 +159,20 @@ // update coefficients for the jam-jam headway function // this function models the effect that "empty space" needs to move // backwards through the downstream segment before the upstream segment may - // send annother vehicle + // send annother vehicle. + // this allows jams to clear and move upstream. // the headway function f(x) depends on the number of vehicles in the // downstream segment x // f is a linear function that passes through the following fixed points: - // f(n_jam_threshold) = myTau_jf (for continuity) - // f(myHeadwayCapacity) = myTau_jj & myHeadwayCapacity + // f(n_jam_threshold) = tau_jf_withLength (for continuity) + // f(myHeadwayCapacity) = myTau_jj * myHeadwayCapacity + const SUMOTime tau_jf_withLength = tauWithVehLength(myTau_jf, DEFAULT_VEH_LENGHT_WITH_GAP); if (myJamThreshold < myCapacity) { // jamming is possible - const SUMOReal n_jam_threshold = myHeadwayCapacity * myJamThreshold / myCapacity; // number of vehicles above which the segment is jammed + const double n_jam_threshold = myHeadwayCapacity * myJamThreshold / myCapacity; // number of vehicles above which the segment is jammed // solving f(x) = a * x + b - myA = (STEPS2TIME(myTau_jj) * myHeadwayCapacity - STEPS2TIME(myTau_jf)) / (myHeadwayCapacity - n_jam_threshold); + myA = (STEPS2TIME(myTau_jj) * myHeadwayCapacity - STEPS2TIME(tau_jf_withLength)) / (myHeadwayCapacity - n_jam_threshold); myB = myHeadwayCapacity * (STEPS2TIME(myTau_jj) - myA); // note that the original Eissfeldt model (p. 69) used different fixed points @@ -170,13 +183,13 @@ } else { // dummy values. Should not be used myA = 0; - myB = STEPS2TIME(myTau_jf); + myB = STEPS2TIME(tau_jf_withLength); } } -SUMOReal -MESegment::jamThresholdForSpeed(SUMOReal speed, SUMOReal jamThresh) const { +double +MESegment::jamThresholdForSpeed(double speed, double jamThresh) const { // vehicles driving freely at maximum speed should not jam // we compute how many vehicles could possible enter the segment until the first vehicle leaves // and multiply by the space these vehicles would occupy @@ -184,8 +197,7 @@ if (speed == 0) { return std::numeric_limits::max(); // never jam. Irrelevant at speed 0 anyway } - const SUMOReal defaultLengthWithGap = SUMOVTypeParameter::getDefault().length + SUMOVTypeParameter::getDefault().minGap; - return std::ceil((myLength / (-jamThresh * speed * STEPS2TIME(myTau_ff + defaultLengthWithGap / myTau_length)))) * defaultLengthWithGap; + return std::ceil(myLength / (-jamThresh * speed * STEPS2TIME(tauWithVehLength(myTau_ff, DEFAULT_VEH_LENGHT_WITH_GAP)))) * DEFAULT_VEH_LENGHT_WITH_GAP; } @@ -239,7 +251,7 @@ for (std::vector::const_reverse_iterator i = k->rbegin(); i != k->rend(); ++i) { const SUMOTime exitTime = MAX2(earliestExitTime, (*i)->getEventTime()); (*i)->updateDetectorForWriting(&data, currentTime, exitTime); - earliestExitTime = exitTime + myTau_ff; + earliestExitTime = exitTime + tauWithVehLength(myTau_ff, (*i)->getVehicleType().getLengthWithGap()); } } } @@ -251,7 +263,7 @@ // we have always space for at least one vehicle return true; } - const SUMOReal newOccupancy = myOccupancy + veh->getVehicleType().getLengthWithGap(); + const double newOccupancy = myOccupancy + veh->getVehicleType().getLengthWithGap(); if (newOccupancy > myCapacity) { // we must ensure that occupancy remains below capacity return false; @@ -259,9 +271,13 @@ // regular insertions and initial insertions must respect different constraints: // - regular insertions must respect entryBlockTime // - initial insertions should not cause additional jamming + // - inserted vehicle should be able to continue at the current speed if (init) { - // inserted vehicle should be able to continue at the current speed - return newOccupancy <= jamThresholdForSpeed(getMeanSpeed(false), -1); + if (free() && !hasBlockedLeader()) { + return newOccupancy <= myJamThreshold; + } else { + return newOccupancy <= jamThresholdForSpeed(getMeanSpeed(false), -1); + } } // maintain propper spacing between inflow from different lanes return entryTime >= myEntryBlockTime; @@ -293,26 +309,26 @@ } -SUMOReal +double MESegment::getMeanSpeed(bool useCached) const { const SUMOTime currentTime = MSNet::getInstance()->getCurrentTimeStep(); if (currentTime != myLastMeanSpeedUpdate || !useCached) { myLastMeanSpeedUpdate = currentTime; const SUMOTime tau = free() ? myTau_ff : myTau_jf; - SUMOReal v = 0; + double v = 0; int count = 0; for (Queues::const_iterator k = myCarQues.begin(); k != myCarQues.end(); ++k) { SUMOTime earliestExitTime = currentTime; count += (int)k->size(); for (std::vector::const_reverse_iterator veh = k->rbegin(); veh != k->rend(); ++veh) { v += (*veh)->getConservativeSpeed(earliestExitTime); // earliestExitTime is updated! - earliestExitTime += tau; + earliestExitTime += tauWithVehLength(tau, (*veh)->getVehicleType().getLengthWithGap()); } } if (count == 0) { myMeanSpeed = myEdge.getSpeedLimit(); } else { - myMeanSpeed = v / (SUMOReal) count; + myMeanSpeed = v / (double) count; } } return myMeanSpeed; @@ -331,7 +347,7 @@ MEVehicle* MESegment::removeCar(MEVehicle* v, SUMOTime leaveTime, MESegment* next) { - myOccupancy = MAX2((SUMOReal)0, myOccupancy - v->getVehicleType().getLengthWithGap()); + myOccupancy = MAX2(0., myOccupancy - v->getVehicleType().getLengthWithGap()); std::vector& cars = myCarQues[v->getQueIndex()]; assert(std::find(cars.begin(), cars.end(), v) != cars.end()); // One could be tempted to do v->setSegment(next); here but position on lane will be invalid if next == 0 @@ -352,18 +368,11 @@ SUMOTime -MESegment::getTimeHeadway(bool predecessorIsFree, SUMOReal leaderLength) { - if (predecessorIsFree) { - return (free() ? myTau_ff : myTau_fj) + (SUMOTime)(leaderLength / myTau_length); - } else { - if (free()) { - return myTau_jf; - } else { - // the gap has to move from the start of the segment to its end - // this allows jams to clear and move upstream - return TIME2STEPS(myA * getCarNumber() + myB); - } - } +MESegment::getTimeHeadway(const MESegment* pred, const MEVehicle* veh) { + const SUMOTime tau = (pred->free() + ? (free() ? myTau_ff : myTau_fj) + : (free() ? myTau_jf : TIME2STEPS(myA * getCarNumber() + myB))); + return (SUMOTime)(tauWithVehLength(tau, veh->getVehicleType().getLengthWithGap()) / pred->getTLSCapacity(veh)); } @@ -383,8 +392,8 @@ MSLink* -MESegment::getLink(const MEVehicle* veh, bool tlsPenalty) const { - if (myJunctionControl || tlsPenalty) { +MESegment::getLink(const MEVehicle* veh, bool penalty) const { + if (myJunctionControl || penalty) { const MSEdge* const nextEdge = veh->succEdge(1); if (nextEdge == 0) { return 0; @@ -452,7 +461,8 @@ MEVehicle* lc = removeCar(veh, time, next); // new leaderCar myBlockTimes[veh->getQueIndex()] = time; if (!isInvalid(next)) { - myBlockTimes[veh->getQueIndex()] += next->getTimeHeadway(free(), veh->getVehicleType().getLengthWithGap()); + myLastHeadway = next->getTimeHeadway(this, veh); + myBlockTimes[veh->getQueIndex()] += myLastHeadway; } if (lc != 0) { lc->setEventTime(MAX2(lc->getEventTime(), myBlockTimes[veh->getQueIndex()])); @@ -475,7 +485,7 @@ void MESegment::receive(MEVehicle* veh, SUMOTime time, bool isDepart, bool afterTeleport) { - const SUMOReal speed = isDepart ? -1 : MAX2(veh->getSpeed(), MESO_MIN_SPEED); // on the previous segment + const double speed = isDepart ? -1 : MAX2(veh->getSpeed(), MESO_MIN_SPEED); // on the previous segment veh->setSegment(this); // for arrival checking veh->setLastEntryTime(time); veh->setBlockTime(SUMOTime_MAX); @@ -493,8 +503,8 @@ return; } // route continues - const SUMOReal maxSpeedOnEdge = veh->getEdge()->getVehicleMaxSpeed(veh); - const SUMOReal uspeed = MAX2(maxSpeedOnEdge, MESO_MIN_SPEED); + const double maxSpeedOnEdge = veh->getEdge()->getVehicleMaxSpeed(veh); + const double uspeed = MAX2(maxSpeedOnEdge, MESO_MIN_SPEED); int nextQueIndex = 0; if (myCarQues.size() > 1) { const MSEdge* succ = veh->succEdge(1); @@ -511,7 +521,7 @@ } std::vector& cars = myCarQues[nextQueIndex]; MEVehicle* newLeader = 0; // first vehicle in the current queue - SUMOTime tleave = MAX2(time + TIME2STEPS(myLength / uspeed) + veh->getStoptime(this) + getTLSPenalty(veh), myBlockTimes[nextQueIndex]); + SUMOTime tleave = MAX2(time + TIME2STEPS(myLength / uspeed) + veh->getStoptime(this) + getLinkPenalty(veh), myBlockTimes[nextQueIndex]); myEdge.lock(); if (cars.empty()) { cars.push_back(veh); @@ -525,7 +535,7 @@ } cars.insert(cars.begin() + 1, veh); } else { - tleave = MAX2(leaderOut + myTau_ff, tleave); + tleave = MAX2(leaderOut + tauWithVehLength(myTau_ff, cars[0]->getVehicleType().getLengthWithGap()), tleave); cars.insert(cars.begin(), veh); } } @@ -533,7 +543,7 @@ if (!isDepart) { // regular departs could take place anywhere on the edge so they should not block regular flow // the -1 facilitates interleaving of multiple streams - myEntryBlockTime = time + myTau_ff - 1; + myEntryBlockTime = time + tauWithVehLength(myTau_ff, veh->getVehicleType().getLengthWithGap()) - 1; } veh->setEventTime(tleave); veh->setSegment(this, nextQueIndex); @@ -572,7 +582,7 @@ void -MESegment::setSpeedForQueue(SUMOReal newSpeed, SUMOTime currentTime, SUMOTime blockTime, const std::vector& vehs) { +MESegment::setSpeedForQueue(double newSpeed, SUMOTime currentTime, SUMOTime blockTime, const std::vector& vehs) { MEVehicle* v = vehs.back(); v->updateDetectors(currentTime, false); SUMOTime newEvent = MAX2(newArrival(v, newSpeed, currentTime), blockTime); @@ -591,16 +601,16 @@ SUMOTime -MESegment::newArrival(const MEVehicle* const v, SUMOReal newSpeed, SUMOTime currentTime) { +MESegment::newArrival(const MEVehicle* const v, double newSpeed, SUMOTime currentTime) { // since speed is only an upper bound pos may be to optimistic - const SUMOReal pos = MIN2(myLength, STEPS2TIME(currentTime - v->getLastEntryTime()) * v->getSpeed()); + const double pos = MIN2(myLength, STEPS2TIME(currentTime - v->getLastEntryTime()) * v->getSpeed()); // traveltime may not be 0 return currentTime + MAX2(TIME2STEPS((myLength - pos) / newSpeed), SUMOTime(1)); } void -MESegment::setSpeed(SUMOReal newSpeed, SUMOTime currentTime, SUMOReal jamThresh) { +MESegment::setSpeed(double newSpeed, SUMOTime currentTime, double jamThresh) { recomputeJamThreshold(jamThresh); //myTau_length = MAX2(MESO_MIN_SPEED, newSpeed) * myEdge.getLanes().size() / TIME2STEPS(1); for (int i = 0; i < (int)myCarQues.size(); ++i) { @@ -668,21 +678,71 @@ } -SUMOReal +bool +MESegment::hasBlockedLeader() const { + for (Queues::const_iterator k = myCarQues.begin(); k != myCarQues.end(); ++k) { + if (k->size() > 0 && (*k).back()->getWaitingTime() > 0) { + return true; + } + } + return false; +} + + +double MESegment::getFlow() const { return 3600 * getCarNumber() * getMeanSpeed() / myLength; } SUMOTime -MESegment::getTLSPenalty(const MEVehicle* veh) const { - const MSLink* link = getLink(veh, myTLSPenalty); - if (link != 0 && link->isTLSControlled()) { - // only apply to the last segment of a tls-controlled edge - return link->getMesoTLSPenalty(); +MESegment::getLinkPenalty(const MEVehicle* veh) const { + const MSLink* link = getLink(veh, myTLSPenalty || myMinorPenalty); + if (link != 0) { + SUMOTime result = 0; + if (link->isTLSControlled()) { + result += link->getMesoTLSPenalty(); + } + // minor tls links may get an additional penalty + if (!link->havePriority() && + // do not apply penalty if limited control is active + (!MSGlobals::gMesoLimitedJunctionControl || limitedControlOverride(link))) { + result += MSGlobals::gMesoMinorPenalty; + } + return result; } else { return 0; } } + +double +MESegment::getTLSCapacity(const MEVehicle* veh) const { + if (myTLSPenalty) { + const MSLink* link = getLink(veh, true); + if (link != 0) { + assert(link->isTLSControlled()); + assert(link->getGreenFraction() > 0); + return link->getGreenFraction(); + } + } + return 1; +} + + +double +MESegment::getMaxPenaltySeconds() const { + double maxPenalty = 0; + for (std::vector::const_iterator i = myEdge.getLanes().begin(); i != myEdge.getLanes().end(); ++i) { + MSLane* l = *i; + const MSLinkCont& lc = l->getLinkCont(); + for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) { + MSLink* link = *j; + maxPenalty = MAX2(maxPenalty, STEPS2TIME( + link->getMesoTLSPenalty() + (link->havePriority() ? 0 : MSGlobals::gMesoMinorPenalty))); + } + } + return maxPenalty; +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MESegment.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MESegment.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MESegment.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MESegment.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,7 +2,7 @@ /// @file MESegment.h /// @author Daniel Krajzewicz /// @date Tue, May 2005 -/// @version $Id: MESegment.h 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: MESegment.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A single mesoscopic segment (cell) /****************************************************************************/ @@ -75,13 +75,12 @@ */ MESegment(const std::string& id, const MSEdge& parent, MESegment* next, - SUMOReal length, SUMOReal speed, + double length, double speed, int idx, SUMOTime tauff, SUMOTime taufj, SUMOTime taujf, SUMOTime taujj, - SUMOReal jamThresh, - bool multiQueue, bool junctionControl, - SUMOReal lengthGeometryFactor); + double jamThresh, + bool multiQueue, bool junctionControl); typedef std::vector Queue; @@ -163,7 +162,7 @@ * * @return the length of the segment */ - inline SUMOReal getLength() const { + inline double getLength() const { return myLength; } @@ -171,7 +170,7 @@ * * @return the occupany of the segment in meters */ - inline SUMOReal getBruttoOccupancy() const { + inline double getBruttoOccupancy() const { return myOccupancy; } @@ -179,7 +178,7 @@ /** @brief Returns the relative occupany of the segment (percentage of road used)) * @return the occupany of the segment in percent */ - inline SUMOReal getRelativeOccupancy() const { + inline double getRelativeOccupancy() const { return myOccupancy / myCapacity; } @@ -187,7 +186,7 @@ * at which the segment is considered jammed * @return the jam treshold of the segment in percent */ - inline SUMOReal getRelativeJamThreshold() const { + inline double getRelativeJamThreshold() const { return myJamThreshold / myCapacity; } @@ -201,10 +200,10 @@ * initializsation of vehicles onto the segment. * @return the average speed on the segment */ - SUMOReal getMeanSpeed(bool useCache) const; + double getMeanSpeed(bool useCache) const; /// @brief wrapper to satisfy the FunctionBinding signature - inline SUMOReal getMeanSpeed() const { + inline double getMeanSpeed() const { return getMeanSpeed(true); } @@ -278,7 +277,7 @@ * all vehicles in it. Also set/recompute myJamThreshold * @param[in] jamThresh follows the semantic of option meso-jam-threshold */ - void setSpeed(SUMOReal newSpeed, SUMOTime currentTime, SUMOReal jamThresh = DO_NOT_PATCH_JAM_THRESHOLD); + void setSpeed(double newSpeed, SUMOTime currentTime, double jamThresh = DO_NOT_PATCH_JAM_THRESHOLD); /** @brief Returns the (planned) time at which the next vehicle leaves this segment * @return The time the vehicle thinks it leaves @@ -286,10 +285,15 @@ SUMOTime getEventTime() const; /// @brief Like getEventTime but returns seconds (for visualization) - inline SUMOReal getEventTimeSeconds() const { + inline double getEventTimeSeconds() const { return STEPS2TIME(getEventTime()); } + /// @brief get the last headway time in seconds + inline double getLastHeadwaySeconds() const { + return STEPS2TIME(myLastHeadway); + } + /// @name State saving/loading /// @{ @@ -331,7 +335,7 @@ /** @brief returns flow based on headway * @note: returns magic number 10000 when headway cannot be computed */ - SUMOReal getFlow() const; + double getFlow() const; /// @brief whether the given segment is 0 or encodes vaporization @@ -345,11 +349,11 @@ /** @brief return whether this segment is considered free as opposed to jammed */ inline bool free() const { - return (myOccupancy <= myJamThreshold) || myTLSPenalty; + return myOccupancy <= myJamThreshold; } /// @brief return the remaining physical space on this segment - inline int remainingVehicleCapacity(const SUMOReal vehLength) const { + inline int remainingVehicleCapacity(const double vehLength) const { if (myOccupancy == 0. && myCapacity < vehLength) { // even small segments can hold at least one vehicle return 1; @@ -372,21 +376,22 @@ return myTau_ff; } - static const SUMOReal DO_NOT_PATCH_JAM_THRESHOLD; + static const double DO_NOT_PATCH_JAM_THRESHOLD; /// @brief add this lanes MoveReminders to the given vehicle void addReminders(MEVehicle* veh) const; - /// @brief return precomputed geometrical length / myLength - inline SUMOReal getLengthGeometryFactor() const { - return myLengthGeometryFactor; - } - - /** @brief Returns the penalty time for passing a tls-controlled link (if using gMesoTLSPenalty > 0) + /** @brief Returns the penalty time for passing a link (if using gMesoTLSPenalty > 0 or gMesoMinorPenalty > 0) * @param[in] veh The vehicle in question * @return The time penalty */ - SUMOTime getTLSPenalty(const MEVehicle* veh) const; + SUMOTime getLinkPenalty(const MEVehicle* veh) const; + + /** @brief Returns the average green time as fraction of cycle time + * @param[in] veh The vehicle in question for determining the link + * @return The green fraction or 1 if the vehicle does not continue after this edge + */ + double getTLSCapacity(const MEVehicle* veh) const; private: /** @brief Updates data of all detectors for a leaving vehicle @@ -399,28 +404,41 @@ bool overtake(); - SUMOTime getTimeHeadway(bool predecessorIsFree, SUMOReal leaderLength); + SUMOTime getTimeHeadway(const MESegment* pred, const MEVehicle* veh); - void setSpeedForQueue(SUMOReal newSpeed, SUMOTime currentTime, + void setSpeedForQueue(double newSpeed, SUMOTime currentTime, SUMOTime blockTime, const std::vector& vehs); /** @brief compute the new arrival time when switching speed */ - SUMOTime newArrival(const MEVehicle* const v, SUMOReal newSpeed, SUMOTime currentTime); + SUMOTime newArrival(const MEVehicle* const v, double newSpeed, SUMOTime currentTime); + /// @brief whether a leader in any queue is blocked + bool hasBlockedLeader() const; /** @brief compute a value for myJamThreshold * if jamThresh is negative, compute a value which allows free flow at mySpeed * interpret jamThresh as the relative occupation at which jam starts */ - void recomputeJamThreshold(SUMOReal jamThresh); + void recomputeJamThreshold(double jamThresh); /// @brief compute jam threshold for the given speed and jam-threshold option - SUMOReal jamThresholdForSpeed(SUMOReal speed, SUMOReal jamThresh) const; + double jamThresholdForSpeed(double speed, double jamThresh) const; /// @brief whether the given link may be passed because the option meso-junction-control.limited is set bool limitedControlOverride(const MSLink* link) const; + /// @brief return the maximum tls penalty for all links from this edge + double getMaxPenaltySeconds() const; + + /// @brief whether the segment requires use of multiple queues + static bool useMultiQueue(bool multiQueue, const MSEdge& parent); + + /// @brief convert net time gap (leader back to follower front) to gross time gap (leader front to follower front) + inline SUMOTime tauWithVehLength(SUMOTime tau, double lengthWithGap) const { + return tau + (SUMOTime)(lengthWithGap / myTau_length); + } + private: /// @brief The microsim edge this segment belongs to const MSEdge& myEdge; @@ -429,28 +447,28 @@ MESegment* myNextSegment; /// @brief The segment's length - const SUMOReal myLength; + const double myLength; /// @brief Running number of the segment in the edge const int myIndex; /// @brief The time headway parameters, see the Eissfeldt thesis const SUMOTime myTau_ff, myTau_fj, myTau_jf, myTau_jj; - /// @brief Headway paramter for computing gross time headyway from net time heawdway, length and edge speed - SUMOReal myTau_length; + /// @brief Headway parameter for computing gross time headyway from net time headway, length and edge speed + double myTau_length; /// @brief slope and axis offset for the jam-jam headway function - SUMOReal myA, myB; + double myA, myB; /// @brief The capacity of the segment in number of cars, used only in time headway calculation /// This parameter has only an effect if tau_jf != tau_jj, which is not(!) the case per default - const SUMOReal myHeadwayCapacity; + const double myHeadwayCapacity; /// @brief The number of lanes * the length - const SUMOReal myCapacity; + const double myCapacity; /// @brief The occupied space (in m) on the segment - SUMOReal myOccupancy; + double myOccupancy; /// @brief Whether junction control is enabled const bool myJunctionControl; @@ -458,8 +476,11 @@ /// @brief Whether tls penalty is enabled const bool myTLSPenalty; + /// @brief Whether minor penalty is enabled + const bool myMinorPenalty; + /// @brief The space (in m) which needs to be occupied before the segment is considered jammed - SUMOReal myJamThreshold; + double myJamThreshold; /// @brief The data collection for all kinds of detectors std::vector myDetectorData; @@ -478,8 +499,8 @@ * value for all queues */ SUMOTime myEntryBlockTime; - // precomputed factor between geometrical length and given length - const SUMOReal myLengthGeometryFactor; + /// @brief the last headway + SUMOTime myLastHeadway; /* @brief segment for signifying vaporization. This segment has invalid * data and should only be used as a unique pointer */ @@ -487,7 +508,7 @@ static MESegment myVaporizationTarget; /// @brief the mean speed on this segment. Updated at event time or on demand - mutable SUMOReal myMeanSpeed; + mutable double myMeanSpeed; /// @brief the time at which myMeanSpeed was last updated mutable SUMOTime myLastMeanSpeedUpdate; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/METriggeredCalibrator.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/METriggeredCalibrator.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/METriggeredCalibrator.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/METriggeredCalibrator.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file METriggeredCalibrator.cpp /// @author Daniel Krajzewicz /// @date Tue, May 2005 -/// @version $Id: METriggeredCalibrator.cpp 20775 2016-05-20 14:31:04Z namdre $ +/// @version $Id: METriggeredCalibrator.cpp 24113 2017-04-28 07:07:07Z behrisch $ /// // Calibrates the flow on a segment to a specified one /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,26 +44,22 @@ #include #include #include -#include +#include #include #include "MELoop.h" #include "MESegment.h" #include "MEVehicle.h" #include "METriggeredCalibrator.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== METriggeredCalibrator::METriggeredCalibrator(const std::string& id, - const MSEdge* const edge, const SUMOReal pos, + const MSEdge* const edge, const double pos, const std::string& aXMLFilename, const std::string& outputFilename, - const SUMOTime freq, const SUMOReal length, + const SUMOTime freq, const double length, const MSRouteProbe* probe) : MSCalibrator(id, edge, pos, aXMLFilename, outputFilename, freq, length, probe, false), mySegment(MSGlobals::gMesoNet->getSegmentForEdge(*edge, pos)) { @@ -73,10 +69,6 @@ METriggeredCalibrator::~METriggeredCalibrator() { - if (myCurrentStateInterval != myIntervals.end()) { - writeXMLOutput(); - myCurrentStateInterval = myIntervals.end(); - } mySegment->removeDetector(&myEdgeMeanData); } @@ -108,7 +100,7 @@ // if not, reset adaptation values mySegment->getEdge().setMaxSpeed(myDefaultSpeed); MESegment* first = MSGlobals::gMesoNet->getSegmentForEdge(mySegment->getEdge()); - const SUMOReal jamThresh = OptionsCont::getOptions().getFloat("meso-jam-threshold"); + const double jamThresh = OptionsCont::getOptions().getFloat("meso-jam-threshold"); while (first != 0) { first->setSpeed(myDefaultSpeed, currentTime, jamThresh); first = first->getNextSegment(); @@ -155,12 +147,12 @@ // flow calibration starts here ... // compute the number of vehicles that should have passed the calibrator within the time // rom begin of the interval - const SUMOReal totalHourFraction = STEPS2TIME(myCurrentStateInterval->end - myCurrentStateInterval->begin) / (SUMOReal) 3600.; + const double totalHourFraction = STEPS2TIME(myCurrentStateInterval->end - myCurrentStateInterval->begin) / (double) 3600.; const int totalWishedNum = (int)std::floor(myCurrentStateInterval->q * totalHourFraction + 0.5); // round to closest int int adaptedNum = passed() + myClearedInJam; if (!hadInvalidJam) { // only add vehicles if we do not have an invalid upstream jam to prevent spill-back - const SUMOReal hourFraction = STEPS2TIME(currentTime - myCurrentStateInterval->begin + DELTA_T) / (SUMOReal) 3600.; + const double hourFraction = STEPS2TIME(currentTime - myCurrentStateInterval->begin + DELTA_T) / (double) 3600.; const int wishedNum = (int)std::floor(myCurrentStateInterval->q * hourFraction + 0.5); // round to closest int // only the difference between inflow and aspiredFlow should be added, thus // we should not count vehicles vaporized from a jam here diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/METriggeredCalibrator.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/METriggeredCalibrator.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/METriggeredCalibrator.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/METriggeredCalibrator.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file METriggeredCalibrator.h /// @author Daniel Krajzewicz /// @date Tue, May 2005 -/// @version $Id: METriggeredCalibrator.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: METriggeredCalibrator.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Calibrates the flow on a segment to a specified one /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,10 +47,10 @@ public: /** constructor */ METriggeredCalibrator(const std::string& id, - const MSEdge* const edge, const SUMOReal pos, + const MSEdge* const edge, const double pos, const std::string& aXMLFilename, const std::string& outputFilename, - const SUMOTime freq, const SUMOReal length, + const SUMOTime freq, const double length, const MSRouteProbe* probe); /** destructor */ @@ -84,7 +84,7 @@ /// @brief returns the maximum number of vehicles that could enter from upstream until the calibrator is activated again inline int maximumInflow() const { - return (int)std::ceil((SUMOReal)myFrequency / (SUMOReal)mySegment->getMinimumHeadwayTime()); + return (int)std::ceil((double)myFrequency / (double)mySegment->getMinimumHeadwayTime()); } private: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MEVehicleControl.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MEVehicleControl.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MEVehicleControl.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MEVehicleControl.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MEVehicleControl.cpp /// @author Daniel Krajzewicz /// @date Wed, 10. Dec 2003 -/// @version $Id: MEVehicleControl.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MEVehicleControl.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The class responsible for building and deletion of vehicles (meso-version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,10 +40,6 @@ #include "MEVehicle.h" #include "MEVehicleControl.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MEVehicleControl.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MEVehicleControl.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MEVehicleControl.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MEVehicleControl.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MEVehicleControl.h /// @author Daniel Krajzewicz /// @date Wed, 10. Dec 2003 -/// @version $Id: MEVehicleControl.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: MEVehicleControl.h 22608 2017-01-17 06:28:54Z behrisch $ /// // The class responsible for building and deletion of vehicles (meso-version) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MEVehicle.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MEVehicle.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MEVehicle.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MEVehicle.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MEVehicle.cpp /// @author Daniel Krajzewicz /// @date Tue, May 2005 -/// @version $Id: MEVehicle.cpp 21675 2016-10-12 13:26:23Z namdre $ +/// @version $Id: MEVehicle.cpp 23601 2017-03-22 09:43:22Z namdre $ /// // A vehicle from the mesoscopic point of view /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,16 +46,12 @@ #include "MEVehicle.h" #include "MESegment.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== MEVehicle::MEVehicle(SUMOVehicleParameter* pars, const MSRoute* route, - const MSVehicleType* type, const SUMOReal speedFactor) : + const MSVehicleType* type, const double speedFactor) : MSBaseVehicle(pars, route, type, speedFactor), mySegment(0), myQueIndex(0), @@ -74,28 +70,28 @@ } -SUMOReal +double MEVehicle::getBackPositionOnLane(const MSLane* /* lane */) const { return getPositionOnLane() - getVehicleType().getLength(); } -SUMOReal +double MEVehicle::getPositionOnLane() const { // the following interpolation causes problems with arrivals and calibrators -// const SUMOReal fracOnSegment = MIN2(SUMOReal(1), STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep() - myLastEntryTime) / STEPS2TIME(myEventTime - myLastEntryTime)); - return (SUMOReal(mySegment->getIndex()) /* + fracOnSegment */) * mySegment->getLength(); +// const double fracOnSegment = MIN2(double(1), STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep() - myLastEntryTime) / STEPS2TIME(myEventTime - myLastEntryTime)); + return (double(mySegment->getIndex()) /* + fracOnSegment */) * mySegment->getLength(); } -SUMOReal +double MEVehicle::getAngle() const { const MSLane* const lane = getEdge()->getLanes()[0]; return lane->getShape().rotationAtOffset(lane->interpolateLanePosToGeometryPos(getPositionOnLane())); } -SUMOReal +double MEVehicle::getSlope() const { const MSLane* const lane = getEdge()->getLanes()[0]; return lane->getShape().slopeDegreeAtOffset(lane->interpolateLanePosToGeometryPos(getPositionOnLane())); @@ -103,13 +99,13 @@ Position -MEVehicle::getPosition(const SUMOReal offset) const { +MEVehicle::getPosition(const double offset) const { const MSLane* const lane = getEdge()->getLanes()[0]; return lane->geometryPositionAtOffset(getPositionOnLane() + offset); } -SUMOReal +double MEVehicle::getSpeed() const { if (getWaitingTime() > 0) { return 0; @@ -119,22 +115,22 @@ } -SUMOReal +double MEVehicle::getAverageSpeed() const { return mySegment->getLength() / STEPS2TIME(myEventTime - myLastEntryTime); } -SUMOReal +double MEVehicle::estimateLeaveSpeed(const MSLink* link) const { /// @see MSVehicle.cpp::estimateLeaveSpeed - const SUMOReal v = getSpeed(); + const double v = getSpeed(); return MIN2(link->getViaLaneOrLane()->getVehicleMaxSpeed(this), - (SUMOReal)sqrt(2 * link->getLength() * getVehicleType().getCarFollowModel().getMaxAccel() + v * v)); + (double)sqrt(2 * link->getLength() * getVehicleType().getCarFollowModel().getMaxAccel() + v * v)); } -SUMOReal +double MEVehicle::getConservativeSpeed(SUMOTime& earliestArrival) const { earliestArrival = MAX2(myEventTime, earliestArrival - DELTA_T); // event times have subsecond resolution return mySegment->getLength() / STEPS2TIME(earliestArrival - myLastEntryTime); @@ -177,7 +173,8 @@ bool -MEVehicle::replaceRoute(const MSRoute* newRoute, bool onInit, int offset) { +MEVehicle::replaceRoute(const MSRoute* newRoute, bool onInit, int offset, bool addStops) { + UNUSED_PARAMETER(addStops); // @todo recheck! const ConstMSEdgeVector& edges = newRoute->getEdges(); // assert the vehicle may continue (must not be "teleported" or whatever to another position) if (!onInit && !newRoute->contains(*myCurrEdge)) { @@ -218,7 +215,7 @@ bool -MEVehicle::addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& /*errorMsg*/, SUMOTime /* untilOffset */) { +MEVehicle::addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& /*errorMsg*/, SUMOTime /* untilOffset */, bool /*collision*/) { const MSEdge* const edge = MSEdge::dictionary(stopPar.lane.substr(0, stopPar.lane.rfind('_'))); assert(edge != 0); MESegment* stopSeg = MSGlobals::gMesoNet->getSegmentForEdge(*edge, stopPar.endPos); @@ -264,12 +261,12 @@ } -SUMOReal -MEVehicle::getCurrentTLSPenaltySeconds() const { +double +MEVehicle::getCurrentLinkPenaltySeconds() const { if (mySegment == 0) { return 0; } else { - return STEPS2TIME(mySegment->getTLSPenalty(this)); + return STEPS2TIME(mySegment->getLinkPenalty(this)); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MEVehicle.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MEVehicle.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/mesosim/MEVehicle.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/mesosim/MEVehicle.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MEVehicle.h /// @author Daniel Krajzewicz /// @date Tue, May 2005 -/// @version $Id: MEVehicle.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MEVehicle.h 24108 2017-04-27 18:43:30Z behrisch $ /// // A vehicle from the mesoscopic point of view /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -59,31 +59,31 @@ * @exception ProcessError If a value is wrong */ MEVehicle(SUMOVehicleParameter* pars, const MSRoute* route, - const MSVehicleType* type, const SUMOReal speedFactor); + const MSVehicleType* type, const double speedFactor); /** @brief Get the vehicle's position along the lane * @return The position of the vehicle (in m from the lane's begin) */ - SUMOReal getPositionOnLane() const; + double getPositionOnLane() const; /** @brief Get the vehicle's position relative to the given lane * @return The back position of the vehicle (in m from the given lane's begin) */ - SUMOReal getBackPositionOnLane(const MSLane* lane) const; + double getBackPositionOnLane(const MSLane* lane) const; /** @brief Returns the vehicle's direction in degrees * @return The vehicle's current angle */ - SUMOReal getAngle() const; + double getAngle() const; /** @brief Returns the slope of the road at vehicle's position * @return The slope */ - SUMOReal getSlope() const; + double getSlope() const; /** @brief Returns the lane the vehicle is on * @return The vehicle's current lane @@ -99,23 +99,23 @@ * @return The current position (in cartesian coordinates) * @see myLane */ - Position getPosition(const SUMOReal offset = 0) const; + Position getPosition(const double offset = 0) const; /** @brief Returns the vehicle's estimated speed assuming no delays * @return The vehicle's estimated speed * @note This is only an upper bound. The speed will be lower if the preceeding vehicle is delayed */ - SUMOReal getSpeed() const; + double getSpeed() const; /** @brief Returns the vehicle's estimated average speed on the segment assuming no further delays * @return The vehicle's estimated average speed * @note This is only an upper bound. The speed will be lower if the preceeding vehicle is delayed */ - SUMOReal getAverageSpeed() const; + double getAverageSpeed() const; /// @brief Returns the vehicle's estimated speed after driving accross the link - SUMOReal estimateLeaveSpeed(const MSLink* link) const; + double estimateLeaveSpeed(const MSLink* link) const; /** @brief Returns the vehicle's estimated speed taking into account delays @@ -123,7 +123,7 @@ * @param[in, out] earliestArrival A lower bound on leaveTime, modified to contain new lower bound on leave Time * @note This is only an upper bound. The speed may be even lower if there are further delays downstream */ - SUMOReal getConservativeSpeed(SUMOTime& earliestArrival) const; + double getConservativeSpeed(SUMOTime& earliestArrival) const; /** @brief Update when the vehicle enters a new edge in the move step. @@ -152,7 +152,7 @@ * @param[in] stop The stop to add * @return Whether the stop could be added */ - bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0); + bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0, bool collision = false); /** @brief Returns whether the vehicle is at a stop @@ -177,6 +177,18 @@ */ const ConstMSEdgeVector getStopEdges() const; + /** @brief replace the current parking area stop with a new stop with merge duration + */ + bool replaceParkingArea(MSParkingArea* /* parkingArea = 0 */, std::string& /*errorMsg*/) { + throw ProcessError("parkingZoneReroute not implemented for meso"); + } + + /** @brief get the current parking area stop + */ + MSParkingArea* getNextParkingArea() { + throw ProcessError("parkingZoneReroute not implemented for meso"); + } + /** @brief Sets the (planned) time at which the vehicle leaves his current cell * @param[in] t The leaving time */ @@ -268,32 +280,32 @@ * Intentional stopping does not count towards this time. * @return The time the vehicle is standing */ - SUMOReal getWaitingSeconds() const { + double getWaitingSeconds() const { return STEPS2TIME(getWaitingTime()); } /// @brief Returns the earliest leave time for the current segment - SUMOReal getEventTimeSeconds() const { + double getEventTimeSeconds() const { return STEPS2TIME(getEventTime()); } /// @brief Returns the entry time for the current segment - SUMOReal getLastEntryTimeSeconds() const { + double getLastEntryTimeSeconds() const { return STEPS2TIME(getLastEntryTime()); } /// @brief Returns the time at which the vehicle was blocked on the current segment - SUMOReal getBlockTimeSeconds() const { + double getBlockTimeSeconds() const { return STEPS2TIME(getBlockTime()); } - /// @brief Returns the delay that is accrued due to option --meso-tls-penalty - SUMOReal getCurrentTLSPenaltySeconds() const; + /// @brief Returns the delay that is accrued due to option --meso-tls-penalty or --meso-minor-penalty + double getCurrentLinkPenaltySeconds() const; /// Replaces the current route by the given one - bool replaceRoute(const MSRoute* route, bool onInit = false, int offset = 0); + bool replaceRoute(const MSRoute* route, bool onInit = false, int offset = 0, bool addStops = true); /** @brief Returns whether the vehicle is allowed to pass the next junction * @return true iff the vehicle may drive over the next junction diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLCoupledDet.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLCoupledDet.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLCoupledDet.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLCoupledDet.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 15 Feb 2004 -/// @version $Id: Command_SaveTLCoupledDet.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: Command_SaveTLCoupledDet.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Writes e2 state on each tls switch /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,10 +38,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLCoupledDet.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLCoupledDet.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLCoupledDet.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLCoupledDet.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 15 Feb 2004 -/// @version $Id: Command_SaveTLCoupledDet.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: Command_SaveTLCoupledDet.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Writes e2 state on each tls switch /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLCoupledLaneDet.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLCoupledLaneDet.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLCoupledLaneDet.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLCoupledLaneDet.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 15 Feb 2004 -/// @version $Id: Command_SaveTLCoupledLaneDet.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: Command_SaveTLCoupledLaneDet.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Writes e2 state of a link for the time the link has yellow/red /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,10 +40,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLCoupledLaneDet.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLCoupledLaneDet.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLCoupledLaneDet.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLCoupledLaneDet.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 15 Feb 2004 -/// @version $Id: Command_SaveTLCoupledLaneDet.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: Command_SaveTLCoupledLaneDet.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Writes e2 state of a link for the time the link has yellow/red /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSState.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSState.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSState.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSState.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 15 Feb 2004 -/// @version $Id: Command_SaveTLSState.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: Command_SaveTLSState.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // Writes the state of the tls to a file (in each second) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -46,8 +42,8 @@ Command_SaveTLSState::Command_SaveTLSState(const MSTLLogicControl::TLSLogicVariants& logics, OutputDevice& od) : myOutputDevice(od), myLogics(logics) { - MSNet::getInstance()->getEndOfTimestepEvents()->addEvent(this, 0, MSEventControl::ADAPT_AFTER_EXECUTION); - myOutputDevice.writeXMLHeader("tls-states"); + MSNet::getInstance()->getEndOfTimestepEvents()->addEvent(this); + myOutputDevice.writeXMLHeader("tlsStates", "tlsstates_file.xsd"); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSState.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSState.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSState.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSState.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 15 Feb 2004 -/// @version $Id: Command_SaveTLSState.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: Command_SaveTLSState.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Writes the state of the tls to a file (in each second) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSSwitches.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSSwitches.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSSwitches.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSSwitches.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 06 Jul 2006 -/// @version $Id: Command_SaveTLSSwitches.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: Command_SaveTLSSwitches.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // Writes information about the green durations of a tls /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,10 +38,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -49,8 +45,8 @@ Command_SaveTLSSwitches::Command_SaveTLSSwitches(const MSTLLogicControl::TLSLogicVariants& logics, OutputDevice& od) : myOutputDevice(od), myLogics(logics) { - MSNet::getInstance()->getEndOfTimestepEvents()->addEvent(this, 0, MSEventControl::ADAPT_AFTER_EXECUTION); - myOutputDevice.writeXMLHeader("tls-switches"); + MSNet::getInstance()->getEndOfTimestepEvents()->addEvent(this); + myOutputDevice.writeXMLHeader("tlsSwitches", "tlsswitches_file.xsd"); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSSwitches.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSSwitches.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSSwitches.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSSwitches.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 06 Jul 2006 -/// @version $Id: Command_SaveTLSSwitches.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: Command_SaveTLSSwitches.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Writes information about the green durations of a tls /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSSwitchStates.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSSwitchStates.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSSwitchStates.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSSwitchStates.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 08.05.2007 -/// @version $Id: Command_SaveTLSSwitchStates.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: Command_SaveTLSSwitchStates.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // Writes the switch times of a tls into a file when the tls switches /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -46,8 +42,8 @@ Command_SaveTLSSwitchStates::Command_SaveTLSSwitchStates(const MSTLLogicControl::TLSLogicVariants& logics, OutputDevice& od) : myOutputDevice(od), myLogics(logics) { - MSNet::getInstance()->getEndOfTimestepEvents()->addEvent(this, 0, MSEventControl::ADAPT_AFTER_EXECUTION); - myOutputDevice.writeXMLHeader("tls-switch-states"); + MSNet::getInstance()->getEndOfTimestepEvents()->addEvent(this); + myOutputDevice.writeXMLHeader("tlsStates", "tlsstates_file.xsd"); } @@ -59,7 +55,7 @@ Command_SaveTLSSwitchStates::execute(SUMOTime currentTime) { const std::string& state = myLogics.getActive()->getCurrentPhaseDef().getState(); if (state != myPreviousState || myLogics.getActive()->getProgramID() != myPreviousProgramID) { - myOutputDevice << " getID() << "\" programID=\"" << myLogics.getActive()->getProgramID() << "\" phase=\"" << myLogics.getActive()->getCurrentPhaseIndex() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSSwitchStates.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSSwitchStates.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSSwitchStates.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/actions/Command_SaveTLSSwitchStates.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 08.05.2007 -/// @version $Id: Command_SaveTLSSwitchStates.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: Command_SaveTLSSwitchStates.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Writes the switch times of a tls into a file when the tls switches /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -8,6 +8,8 @@ MSCFModel_Krauss.cpp MSCFModel_Krauss.h \ MSCFModel_KraussOrig1.cpp MSCFModel_KraussOrig1.h \ MSCFModel_KraussPS.cpp MSCFModel_KraussPS.h \ +MSCFModel_KraussX.cpp MSCFModel_KraussX.h \ MSCFModel_PWag2009.cpp MSCFModel_PWag2009.h \ MSCFModel_SmartSK.cpp MSCFModel_SmartSK.h \ -MSCFModel_Wiedemann.cpp MSCFModel_Wiedemann.h +MSCFModel_Wiedemann.cpp MSCFModel_Wiedemann.h \ +MSCFModel_Rail.cpp MSCFModel_Rail.h diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -102,8 +102,9 @@ MSCFModel_Daniel1.$(OBJEXT) MSCFModel_IDM.$(OBJEXT) \ MSCFModel_Kerner.$(OBJEXT) MSCFModel_Krauss.$(OBJEXT) \ MSCFModel_KraussOrig1.$(OBJEXT) MSCFModel_KraussPS.$(OBJEXT) \ - MSCFModel_PWag2009.$(OBJEXT) MSCFModel_SmartSK.$(OBJEXT) \ - MSCFModel_Wiedemann.$(OBJEXT) + MSCFModel_KraussX.$(OBJEXT) MSCFModel_PWag2009.$(OBJEXT) \ + MSCFModel_SmartSK.$(OBJEXT) MSCFModel_Wiedemann.$(OBJEXT) \ + MSCFModel_Rail.$(OBJEXT) libmicrosimcfmodels_a_OBJECTS = $(am_libmicrosimcfmodels_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) @@ -340,9 +341,11 @@ MSCFModel_Krauss.cpp MSCFModel_Krauss.h \ MSCFModel_KraussOrig1.cpp MSCFModel_KraussOrig1.h \ MSCFModel_KraussPS.cpp MSCFModel_KraussPS.h \ +MSCFModel_KraussX.cpp MSCFModel_KraussX.h \ MSCFModel_PWag2009.cpp MSCFModel_PWag2009.h \ MSCFModel_SmartSK.cpp MSCFModel_SmartSK.h \ -MSCFModel_Wiedemann.cpp MSCFModel_Wiedemann.h +MSCFModel_Wiedemann.cpp MSCFModel_Wiedemann.h \ +MSCFModel_Rail.cpp MSCFModel_Rail.h all: all-am @@ -400,7 +403,9 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSCFModel_Krauss.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSCFModel_KraussOrig1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSCFModel_KraussPS.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSCFModel_KraussX.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSCFModel_PWag2009.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSCFModel_Rail.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSCFModel_SmartSK.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSCFModel_Wiedemann.Po@am__quote@ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ /// @author Laura Bieker /// @author Leonhard Lücken /// @date Mon, 27 Jul 2009 -/// @version $Id: MSCFModel.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSCFModel.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The car-following model abstraction /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,9 +45,14 @@ // =========================================================================== // method definitions // =========================================================================== -MSCFModel::MSCFModel(const MSVehicleType* vtype, const SUMOReal accel, - const SUMOReal decel, const SUMOReal headwayTime) - : myType(vtype), myAccel(accel), myDecel(decel), myHeadwayTime(headwayTime) { +MSCFModel::MSCFModel(const MSVehicleType* vtype, double accel, + double decel, double emergencyDecel, double apparentDecel, double headwayTime) : + myType(vtype), + myAccel(accel), + myDecel(decel), + myEmergencyDecel(emergencyDecel), + myApparentDecel(apparentDecel), + myHeadwayTime(headwayTime) { } @@ -57,12 +62,12 @@ MSCFModel::VehicleVariables::~VehicleVariables() {} -SUMOReal -MSCFModel::brakeGap(const SUMOReal speed, const SUMOReal decel, const SUMOReal headwayTime) { +double +MSCFModel::brakeGap(const double speed, const double decel, const double headwayTime) { if (MSGlobals::gSemiImplicitEulerUpdate) { /* one possibility to speed this up is to calculate speedReduction * steps * (steps+1) / 2 for small values of steps (up to 10 maybe) and store them in an array */ - const SUMOReal speedReduction = ACCEL2SPEED(decel); + const double speedReduction = ACCEL2SPEED(decel); const int steps = int(speed / speedReduction); return SPEED2DIST(steps * speed - speedReduction * steps * (steps + 1) / 2) + speed * headwayTime; } else { @@ -76,13 +81,11 @@ } -SUMOReal -MSCFModel::freeSpeed(const SUMOReal currentSpeed, const SUMOReal decel, const SUMOReal dist, const SUMOReal targetSpeed, const bool onInsertion) { +double +MSCFModel::freeSpeed(const double currentSpeed, const double decel, const double dist, const double targetSpeed, const bool onInsertion) { // XXX: (Leo) This seems to be exclusively called with decel = myDecel (max deceleration) and is not overridden // by any specific CFModel. That may cause undesirable hard braking (at junctions where the vehicle - // changes to a road with a lower speed limit). It relies on the same logic as the maximalSafeSpeed calculations. - // XXX: Don't duplicate the code from there, if possible!!! Can maximumSafeStopSpeed() call freeSpeed? (Leo) - // -> not is the reaction time / desired headway is to be regarded... + // changes to a road with a lower speed limit). if (MSGlobals::gSemiImplicitEulerUpdate) { // adapt speed to succeeding lane, no reaction time is involved @@ -90,16 +93,16 @@ // (drive with v in the final step) // g = (y^2 + y) * 0.5 * b + y * v // y = ((((sqrt((b + 2.0*v)*(b + 2.0*v) + 8.0*b*g)) - b)*0.5 - v)/b) - const SUMOReal v = SPEED2DIST(targetSpeed); + const double v = SPEED2DIST(targetSpeed); if (dist < v) { return targetSpeed; } - const SUMOReal b = ACCEL2DIST(decel); - const SUMOReal y = MAX2(0.0, ((sqrt((b + 2.0 * v) * (b + 2.0 * v) + 8.0 * b * dist) - b) * 0.5 - v) / b); - const SUMOReal yFull = floor(y); - const SUMOReal exactGap = (yFull * yFull + yFull) * 0.5 * b + yFull * v + (y > yFull ? v : 0.0); - const SUMOReal fullSpeedGain = (yFull + (onInsertion ? 1. : 0.)) * ACCEL2SPEED(decel); - return DIST2SPEED(MAX2((SUMOReal)0.0, dist - exactGap) / (yFull + 1)) + fullSpeedGain + targetSpeed; + const double b = ACCEL2DIST(decel); + const double y = MAX2(0.0, ((sqrt((b + 2.0 * v) * (b + 2.0 * v) + 8.0 * b * dist) - b) * 0.5 - v) / b); + const double yFull = floor(y); + const double exactGap = (yFull * yFull + yFull) * 0.5 * b + yFull * v + (y > yFull ? v : 0.0); + const double fullSpeedGain = (yFull + (onInsertion ? 1. : 0.)) * ACCEL2SPEED(decel); + return DIST2SPEED(MAX2(0.0, dist - exactGap) / (yFull + 1)) + fullSpeedGain + targetSpeed; } else { // ballistic update (Leo) // calculate maximum next speed vN that is adjustable to vT=targetSpeed after a distance d=dist @@ -117,11 +120,11 @@ assert(currentSpeed >= 0); assert(targetSpeed >= 0); - const SUMOReal dt = onInsertion ? 0 : TS; // handles case that vehicle is inserted just now (at the end of move) - const SUMOReal v0 = currentSpeed; - const SUMOReal vT = targetSpeed; - const SUMOReal b = decel; - const SUMOReal d = dist - NUMERICAL_EPS; // prevent returning a value > targetSpeed due to rounding errors + const double dt = onInsertion ? 0 : TS; // handles case that vehicle is inserted just now (at the end of move) + const double v0 = currentSpeed; + const double vT = targetSpeed; + const double b = decel; + const double d = dist - NUMERICAL_EPS; // prevent returning a value > targetSpeed due to rounding errors // Solvability for positive vN (if d is small relative to v0): // 1) If 0.5*(v0+vT)*dt > d, we set vN=vT. @@ -134,22 +137,22 @@ return vT; // (#) } - const SUMOReal q = ((dt * v0 - 2 * d) * b - vT * vT); // (q < 0 is fulfilled because of (#)) - const SUMOReal p = 0.5 * b * dt; + const double q = ((dt * v0 - 2 * d) * b - vT * vT); // (q < 0 is fulfilled because of (#)) + const double p = 0.5 * b * dt; return -p + sqrt(p * p - q); } } -SUMOReal -MSCFModel::moveHelper(MSVehicle* const veh, SUMOReal vPos) const { - const SUMOReal oldV = veh->getSpeed(); // save old v for optional acceleration computation - const SUMOReal vSafe = MIN2(vPos, veh->processNextStop(vPos)); // process stops +double +MSCFModel::moveHelper(MSVehicle* const veh, double vPos) const { + const double oldV = veh->getSpeed(); // save old v for optional acceleration computation + const double vSafe = MIN2(vPos, veh->processNextStop(vPos)); // process stops // we need the acceleration for emission computation; // in this case, we neglect dawdling, nonetheless, using // vSafe does not incorporate speed reduction due to interaction // on lane changing - SUMOReal vMin, vNext; - const SUMOReal vMax = MIN3(veh->getMaxSpeedOnLane(), maxNextSpeed(oldV, veh), vSafe); + double vMin, vNext; + const double vMax = MIN3(veh->getMaxSpeedOnLane(), maxNextSpeed(oldV, veh), vSafe); if (MSGlobals::gSemiImplicitEulerUpdate) { // we cannot rely on never braking harder than maxDecel because TraCI or strange cf models may decide to do so vMin = MIN2(getSpeedAfterMaxDecel(oldV), vMax); @@ -171,46 +174,48 @@ } -SUMOReal -MSCFModel::interactionGap(const MSVehicle* const veh, SUMOReal vL) const { +double +MSCFModel::interactionGap(const MSVehicle* const veh, double vL) const { // Resolve the vsafe equation to gap. Assume predecessor has // speed != 0 and that vsafe will be the current speed plus acceleration, // i.e that with this gap there will be no interaction. - const SUMOReal vNext = MIN2(maxNextSpeed(veh->getSpeed(), veh), veh->getLane()->getVehicleMaxSpeed(veh)); - const SUMOReal gap = (vNext - vL) * - ((veh->getSpeed() + vL) / (2.*myDecel) + myHeadwayTime) + - vL * myHeadwayTime; + const double vNext = MIN2(maxNextSpeed(veh->getSpeed(), veh), veh->getLane()->getVehicleMaxSpeed(veh)); + const double gap = (vNext - vL) * + ((veh->getSpeed() + vL) / (2.*myDecel) + myHeadwayTime) + + vL * myHeadwayTime; // Don't allow timeHeadWay < deltaT situations. return MAX2(gap, SPEED2DIST(vNext)); } -SUMOReal -MSCFModel::maxNextSpeed(SUMOReal speed, const MSVehicle* const /*veh*/) const { - return MIN2(speed + (SUMOReal) ACCEL2SPEED(getMaxAccel()), myType->getMaxSpeed()); +double +MSCFModel::maxNextSpeed(double speed, const MSVehicle* const /*veh*/) const { + return MIN2(speed + (double) ACCEL2SPEED(getMaxAccel()), myType->getMaxSpeed()); } -SUMOReal -MSCFModel::minNextSpeed(SUMOReal speed, const MSVehicle* const /*veh*/) const { +double +MSCFModel::minNextSpeed(double speed, const MSVehicle* const /*veh*/) const { if (MSGlobals::gSemiImplicitEulerUpdate) { - return MAX2(speed - ACCEL2SPEED(getMaxDecel()), (SUMOReal)0.); +// return MAX2(speed - ACCEL2SPEED(getMaxDecel()), 0.); + return MAX2(speed - ACCEL2SPEED(myEmergencyDecel), 0.); } else { // NOTE: ballistic update allows for negative speeds to indicate a stop within the next timestep - return speed - ACCEL2SPEED(getMaxDecel()); +// return speed - ACCEL2SPEED(getMaxDecel()); + return speed - ACCEL2SPEED(myEmergencyDecel); } } -SUMOReal -MSCFModel::freeSpeed(const MSVehicle* const /* veh */, SUMOReal speed, SUMOReal seen, SUMOReal maxSpeed, const bool onInsertion) const { - SUMOReal vSafe = freeSpeed(speed, myDecel, seen, maxSpeed, onInsertion); +double +MSCFModel::freeSpeed(const MSVehicle* const /* veh */, double speed, double seen, double maxSpeed, const bool onInsertion) const { + double vSafe = freeSpeed(speed, myDecel, seen, maxSpeed, onInsertion); return vSafe; } -SUMOReal -MSCFModel::insertionFollowSpeed(const MSVehicle* const /* v */, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const { +double +MSCFModel::insertionFollowSpeed(const MSVehicle* const /* v */, double speed, double gap2pred, double predSpeed, double predMaxDecel) const { if (MSGlobals::gSemiImplicitEulerUpdate) { return maximumSafeFollowSpeed(gap2pred, speed, predSpeed, predMaxDecel); } else { @@ -220,8 +225,8 @@ } -SUMOReal -MSCFModel::insertionStopSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap) const { +double +MSCFModel::insertionStopSpeed(const MSVehicle* const veh, double speed, double gap) const { if (MSGlobals::gSemiImplicitEulerUpdate) { return stopSpeed(veh, speed, gap); } else { @@ -231,28 +236,28 @@ SUMOTime -MSCFModel::getMinimalArrivalTime(SUMOReal dist, SUMOReal currentSpeed, SUMOReal arrivalSpeed) const { - const SUMOReal accel = (arrivalSpeed >= currentSpeed) ? getMaxAccel() : -getMaxDecel(); - const SUMOReal accelTime = (arrivalSpeed - currentSpeed) / accel; - const SUMOReal accelWay = accelTime * (arrivalSpeed + currentSpeed) * 0.5; - const SUMOReal nonAccelWay = MAX2(SUMOReal(0), dist - accelWay); +MSCFModel::getMinimalArrivalTime(double dist, double currentSpeed, double arrivalSpeed) const { + const double accel = (arrivalSpeed >= currentSpeed) ? getMaxAccel() : -getMaxDecel(); + const double accelTime = (arrivalSpeed - currentSpeed) / accel; + const double accelWay = accelTime * (arrivalSpeed + currentSpeed) * 0.5; + const double nonAccelWay = MAX2(0., dist - accelWay); // will either drive as fast as possible and decelerate as late as possible // or accelerate as fast as possible and then hold that speed - const SUMOReal nonAccelSpeed = MAX3(currentSpeed, arrivalSpeed, SUMO_const_haltingSpeed); + const double nonAccelSpeed = MAX3(currentSpeed, arrivalSpeed, SUMO_const_haltingSpeed); return TIME2STEPS(accelTime + nonAccelWay / nonAccelSpeed); } -SUMOReal -MSCFModel::getMinimalArrivalSpeed(SUMOReal dist, SUMOReal currentSpeed) const { +double +MSCFModel::getMinimalArrivalSpeed(double dist, double currentSpeed) const { // ballistic update return estimateSpeedAfterDistance(dist - currentSpeed * getHeadwayTime(), currentSpeed, -getMaxDecel()); } -SUMOReal -MSCFModel::getMinimalArrivalSpeedEuler(SUMOReal dist, SUMOReal currentSpeed) const { - SUMOReal arrivalSpeedBraking; +double +MSCFModel::getMinimalArrivalSpeedEuler(double dist, double currentSpeed) const { + double arrivalSpeedBraking; // Because we use a continuous formula for computing the possible slow-down // we need to handle the mismatch with the discrete dynamics if (dist < currentSpeed) { @@ -269,46 +274,46 @@ -SUMOReal -MSCFModel::gapExtrapolation(const SUMOReal duration, const SUMOReal currentGap, SUMOReal v1, SUMOReal v2, SUMOReal a1, SUMOReal a2, const SUMOReal maxV1, const SUMOReal maxV2) { +double +MSCFModel::gapExtrapolation(const double duration, const double currentGap, double v1, double v2, double a1, double a2, const double maxV1, const double maxV2) { - SUMOReal newGap = currentGap; + double newGap = currentGap; if (MSGlobals::gSemiImplicitEulerUpdate) { for (unsigned int steps = 1; steps * TS <= duration; ++steps) { - v1 = MIN2(MAX2(v1 + a1, (SUMOReal)0.), maxV1); - v2 = MIN2(MAX2(v2 + a2, (SUMOReal)0.), maxV2); + v1 = MIN2(MAX2(v1 + a1, 0.), maxV1); + v2 = MIN2(MAX2(v2 + a2, 0.), maxV2); newGap += TS * (v1 - v2); } } else { // determine times t1, t2 for which vehicles can break until stop (within duration) // and t3, t4 for which they reach their maximal speed on their current lanes. - SUMOReal t1 = 0, t2 = 0, t3 = 0, t4 = 0; + double t1 = 0, t2 = 0, t3 = 0, t4 = 0; // t1: ego veh stops if (a1 < 0 && v1 > 0) { - const SUMOReal leaderStopTime = - v1 / a1; + const double leaderStopTime = - v1 / a1; t1 = MIN2(leaderStopTime, duration); } else if (a1 >= 0) { t1 = duration; } // t2: veh2 stops if (a2 < 0 && v2 > 0) { - const SUMOReal followerStopTime = -v2 / a2; + const double followerStopTime = -v2 / a2; t2 = MIN2(followerStopTime, duration); } else if (a2 >= 0) { t2 = duration; } // t3: ego veh reaches vMax if (a1 > 0 && v1 < maxV1) { - const SUMOReal leaderMaxSpeedTime = (maxV1 - v1) / a1; + const double leaderMaxSpeedTime = (maxV1 - v1) / a1; t3 = MIN2(leaderMaxSpeedTime, duration); } else if (a1 <= 0) { t3 = duration; } // t4: veh2 reaches vMax if (a2 > 0 && v2 < maxV2) { - const SUMOReal followerMaxSpeedTime = (maxV2 - v2) / a2; + const double followerMaxSpeedTime = (maxV2 - v2) / a2; t4 = MIN2(followerMaxSpeedTime, duration); } else if (a2 <= 0) { t4 = duration; @@ -316,19 +321,19 @@ // NOTE: this assumes that the accelerations a1 and a2 are constant over the next // followerBreakTime seconds (if no vehicle stops before or reaches vMax) - std::list l; + std::list l; l.push_back(t1); l.push_back(t2); l.push_back(t3); l.push_back(t4); l.sort(); - std::list::const_iterator i; - SUMOReal tLast = 0.; + std::list::const_iterator i; + double tLast = 0.; for (i = l.begin(); i != l.end(); ++i) { if (*i != tLast) { - SUMOReal dt = MIN2(*i, duration) - tLast; // time between *i and tLast - SUMOReal dv = v1 - v2; // current velocity difference - SUMOReal da = a1 - a2; // current acceleration difference + double dt = MIN2(*i, duration) - tLast; // time between *i and tLast + double dv = v1 - v2; // current velocity difference + double da = a1 - a2; // current acceleration difference newGap += dv * dt + da * dt * dt / 2.; // update gap v1 += dt * a1; v2 += dt * a2; @@ -352,8 +357,8 @@ if (duration != tLast) { // (both vehicles have zero acceleration) assert(a1 == 0. && a2 == 0.); - SUMOReal dt = duration - tLast; // remaining time until duration - SUMOReal dv = v1 - v2; // current velocity difference + double dt = duration - tLast; // remaining time until duration + double dv = v1 - v2; // current velocity difference newGap += dv * dt; // update gap } } @@ -363,8 +368,8 @@ -SUMOReal -MSCFModel::passingTime(const SUMOReal lastPos, const SUMOReal passedPos, const SUMOReal currentPos, const SUMOReal lastSpeed, const SUMOReal currentSpeed) { +double +MSCFModel::passingTime(const double lastPos, const double passedPos, const double currentPos, const double lastSpeed, const double currentSpeed) { assert(passedPos <= currentPos && passedPos >= lastPos && currentPos > lastPos); assert(currentSpeed >= 0); @@ -378,26 +383,26 @@ std::cout << ss.str() << "\n"; WRITE_ERROR(ss.str()); } - const SUMOReal lastCoveredDist = currentPos - lastPos; - const SUMOReal extrapolated = passedPos > currentPos ? TS * (passedPos - lastPos) / lastCoveredDist : TS * (currentPos - passedPos) / lastCoveredDist; + const double lastCoveredDist = currentPos - lastPos; + const double extrapolated = passedPos > currentPos ? TS * (passedPos - lastPos) / lastCoveredDist : TS * (currentPos - passedPos) / lastCoveredDist; return extrapolated; } else if (currentSpeed < 0) { WRITE_ERROR("passingTime(): given argument 'currentSpeed' is negative. This case is not handled yet."); return -1; } - const SUMOReal distanceOldToPassed = passedPos - lastPos; // assert: >=0 + const double distanceOldToPassed = passedPos - lastPos; // assert: >=0 if (MSGlobals::gSemiImplicitEulerUpdate) { // euler update (constantly moving with currentSpeed during [0,TS]) - const SUMOReal t = distanceOldToPassed / currentSpeed; - return t; + const double t = distanceOldToPassed / currentSpeed; + return MIN2(TS, MAX2(0., t)); //rounding errors could give results out of the admissible result range } else { // ballistic update (constant acceleration a during [0,TS], except in case of a stop) // determine acceleration - SUMOReal a; + double a; if (currentSpeed > 0) { // the acceleration was constant within the last time step a = SPEED2ACCEL(currentSpeed - lastSpeed); @@ -416,18 +421,18 @@ // we solve distanceOldToPassed = lastSpeed*t + a*t^2/2 if (fabs(a) < NUMERICAL_EPS) { // treat as constant speed within [0, TS] - const SUMOReal t = 2 * distanceOldToPassed / (lastSpeed + currentSpeed); - return t; + const double t = 2 * distanceOldToPassed / (lastSpeed + currentSpeed); + return MIN2(TS, MAX2(0., t)); //rounding errors could give results out of the admissible result range } else if (a > 0) { // positive acceleration => only one positive solution - const SUMOReal va = lastSpeed / a; - const SUMOReal t = -va + sqrt(va * va + 2 * distanceOldToPassed / a); + const double va = lastSpeed / a; + const double t = -va + sqrt(va * va + 2 * distanceOldToPassed / a); assert(t < 1 && t >= 0); return t; } else { // negative acceleration => two positive solutions (pick the smaller one.) - const SUMOReal va = lastSpeed / a; - const SUMOReal t = -va - sqrt(va * va + 2 * distanceOldToPassed / a); + const double va = lastSpeed / a; + const double t = -va - sqrt(va * va + 2 * distanceOldToPassed / a); assert(t < 1 && t >= 0); return t; } @@ -435,8 +440,8 @@ } -SUMOReal -MSCFModel::speedAfterTime(const SUMOReal t, const SUMOReal v0, const SUMOReal dist) { +double +MSCFModel::speedAfterTime(const double t, const double v0, const double dist) { assert(dist >= 0); assert(t >= 0 && t <= TS); if (MSGlobals::gSemiImplicitEulerUpdate) { @@ -449,12 +454,12 @@ if (dist < TS * v0 / 2) { // stop must have occured within [0,TS], use dist = -v0^2/(2a) (stopping dist), // i.e., a = -v0^2/(2*dist) - const SUMOReal accel = - v0 * v0 / (2 * dist); + const double accel = - v0 * v0 / (2 * dist); // The speed at time t is then return v0 + accel * t; } else { // no stop occured within [0,TS], thus (from dist = v0*TS + accel*TS^2/2) - const SUMOReal accel = 2 * (dist / TS - v0) / TS; + const double accel = 2 * (dist / TS - v0) / TS; // The speed at time t is then return v0 + accel * t; } @@ -464,17 +469,17 @@ -SUMOReal -MSCFModel::estimateSpeedAfterDistance(const SUMOReal dist, const SUMOReal v, const SUMOReal accel) const { +double +MSCFModel::estimateSpeedAfterDistance(const double dist, const double v, const double accel) const { // dist=v*t + 0.5*accel*t^2, solve for t and use v1 = v + accel*t - return MAX2((SUMOReal)0., MIN2(myType->getMaxSpeed(), - (SUMOReal)sqrt(2 * dist * accel + v * v))); + return MAX2(0., MIN2(myType->getMaxSpeed(), + (double)sqrt(2 * dist * accel + v * v))); } -SUMOReal -MSCFModel::maximumSafeStopSpeed(SUMOReal g /*gap*/, SUMOReal v /*currentSpeed*/, bool onInsertion, SUMOReal headway) const { +double +MSCFModel::maximumSafeStopSpeed(double g /*gap*/, double v /*currentSpeed*/, bool onInsertion, double headway) const { if (MSGlobals::gSemiImplicitEulerUpdate) { return maximumSafeStopSpeedEuler(g); } else { @@ -483,8 +488,8 @@ } -SUMOReal -MSCFModel::maximumSafeStopSpeedEuler(SUMOReal gap) const { +double +MSCFModel::maximumSafeStopSpeedEuler(double gap) const { gap -= NUMERICAL_EPS; // lots of code relies on some slack XXX: it shouldn't... if (gap <= 0) { return 0; @@ -492,32 +497,32 @@ // workaround for #2310 return MIN2(ACCEL2SPEED(myDecel), DIST2SPEED(gap)); } - const SUMOReal g = gap; - const SUMOReal b = ACCEL2SPEED(myDecel); - const SUMOReal t = myHeadwayTime; - const SUMOReal s = TS; + const double g = gap; + const double b = ACCEL2SPEED(myDecel); + const double t = myHeadwayTime; + const double s = TS; // h = the distance that would be covered if it were possible to stop // exactly after gap and decelerate with b every simulation step // h = 0.5 * n * (n-1) * b * s + n * b * t (solve for n) //n = ((1.0/2.0) - ((t + (pow(((s*s) + (4.0*((s*((2.0*h/b) - t)) + (t*t)))), (1.0/2.0))*sign/2.0))/s)); - const SUMOReal n = floor(.5 - ((t + (sqrt(((s * s) + (4.0 * ((s * (2.0 * g / b - t)) + (t * t))))) * -0.5)) / s)); - const SUMOReal h = 0.5 * n * (n - 1) * b * s + n * b * t; + const double n = floor(.5 - ((t + (sqrt(((s * s) + (4.0 * ((s * (2.0 * g / b - t)) + (t * t))))) * -0.5)) / s)); + const double h = 0.5 * n * (n - 1) * b * s + n * b * t; assert(h <= g + NUMERICAL_EPS); // compute the additional speed that must be used during deceleration to fix // the discrepancy between g and h - const SUMOReal r = (g - h) / (n * s + t); - const SUMOReal x = n * b + r; + const double r = (g - h) / (n * s + t); + const double x = n * b + r; assert(x >= 0); return x; } -SUMOReal -MSCFModel::maximumSafeStopSpeedBallistic(SUMOReal g /*gap*/, SUMOReal v /*currentSpeed*/, bool onInsertion, SUMOReal headway) const { +double +MSCFModel::maximumSafeStopSpeedBallistic(double g /*gap*/, double v /*currentSpeed*/, bool onInsertion, double headway) const { // decrease gap slightly (to avoid passing end of lane by values of magnitude ~1e-12, when exact stop is required) - g = MAX2((SUMOReal)0., g - NUMERICAL_EPS); + g = MAX2(0., g - NUMERICAL_EPS); headway = headway >= 0 ? headway : myHeadwayTime; // (Leo) Note that in contrast to the Euler update, for the ballistic update @@ -533,8 +538,8 @@ // G2 = v0^2/(2b), // where b is an assumed constant deceleration (= myDecel) // We solve g = G1 + G2 for v0: - const SUMOReal btau = myDecel * headway; - const SUMOReal v0 = -btau + sqrt(btau * btau + 2 * myDecel * g); + const double btau = myDecel * headway; + const double v0 = -btau + sqrt(btau * btau + 2 * myDecel * g); return v0; } @@ -543,8 +548,8 @@ // such that starting to break after accelerating with a for the time tau // still allows us to stop in time. - const SUMOReal tau = headway; - const SUMOReal v0 = MAX2((SUMOReal)0., v); + const double tau = headway; + const double v0 = MAX2(0., v); // We first consider the case that a stop has to take place within time tau if (v0 * tau >= 2 * g) { if (g == 0.) { @@ -558,7 +563,7 @@ } // In general we solve g = v0^2/(-2a), where the the rhs is the distance // covered until stop when breaking with a<0 - const SUMOReal a = -v0 * v0 / (2 * g); + const double a = -v0 * v0 / (2 * g); return v0 + a * TS; } @@ -573,16 +578,16 @@ // <=> 0 = v1^2 + b*tau*v1 + b*tau*v0 - 2bg // => v1 = -b*tau/2 + sqrt( (b*tau)^2/4 + b(2g - tau*v0) ) - const SUMOReal btau2 = myDecel * tau / 2; - const SUMOReal v1 = -btau2 + sqrt(btau2 * btau2 + myDecel * (2 * g - tau * v0)); - const SUMOReal a = (v1 - v0) / tau; + const double btau2 = myDecel * tau / 2; + const double v1 = -btau2 + sqrt(btau2 * btau2 + myDecel * (2 * g - tau * v0)); + const double a = (v1 - v0) / tau; return v0 + a * TS; } /** Returns the SK-vsafe. */ -SUMOReal -MSCFModel::maximumSafeFollowSpeed(SUMOReal gap, SUMOReal egoSpeed, SUMOReal predSpeed, SUMOReal predMaxDecel, bool onInsertion) const { +double +MSCFModel::maximumSafeFollowSpeed(double gap, double egoSpeed, double predSpeed, double predMaxDecel, bool onInsertion) const { // the speed is safe if allows the ego vehicle to come to a stop behind the leader even if // the leaders starts braking hard until stopped // unfortunately it is not sufficient to compare stopping distances if the follower can brake harder than the leader @@ -604,10 +609,10 @@ // if leader is stopped, calculate stopSpeed without time-headway to prevent creeping stop // NOTE: this can lead to the strange phenomenon (for the Krauss-model at least) that if the leader comes to a stop, // the follower accelerates for a short period of time. Refs #2310 (Leo) -// const SUMOReal headway = predSpeed > 0. ? myHeadwayTime : 0.; +// const double headway = predSpeed > 0. ? myHeadwayTime : 0.; - const SUMOReal headway = myHeadwayTime; - const SUMOReal x = maximumSafeStopSpeed(gap + brakeGap(predSpeed, MAX2(myDecel, predMaxDecel), 0), egoSpeed, onInsertion, headway); + const double headway = myHeadwayTime; + const double x = maximumSafeStopSpeed(gap + brakeGap(predSpeed, MAX2(myDecel, predMaxDecel), 0), egoSpeed, onInsertion, headway); assert(x >= 0 || !MSGlobals::gSemiImplicitEulerUpdate); assert(!ISNAN(x)); return x; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Daniel1.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Daniel1.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Daniel1.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Daniel1.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 05 Jun 2012 -/// @version $Id: MSCFModel_Daniel1.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: MSCFModel_Daniel1.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The original Krauss (1998) car-following model and parameter /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,10 +40,10 @@ // =========================================================================== // method definitions // =========================================================================== -MSCFModel_Daniel1::MSCFModel_Daniel1(const MSVehicleType* vtype, SUMOReal accel, SUMOReal decel, - SUMOReal dawdle, SUMOReal headwayTime, - SUMOReal tmp1, SUMOReal tmp2, SUMOReal tmp3, SUMOReal tmp4, SUMOReal tmp5) - : MSCFModel(vtype, accel, decel, headwayTime), myDawdle(dawdle), myTauDecel(decel * headwayTime), +MSCFModel_Daniel1::MSCFModel_Daniel1(const MSVehicleType* vtype, double accel, double decel, double emergencyDecel, + double dawdle, double headwayTime, + double tmp1, double tmp2, double tmp3, double tmp4, double tmp5) + : MSCFModel(vtype, accel, decel, emergencyDecel, decel, headwayTime), myDawdle(dawdle), myTauDecel(decel * headwayTime), myTmp1(tmp1), myTmp2(tmp2), myTmp3(tmp3), myTmp4(tmp4), myTmp5(tmp5) { } @@ -51,16 +51,16 @@ MSCFModel_Daniel1::~MSCFModel_Daniel1() {} -SUMOReal -MSCFModel_Daniel1::moveHelper(MSVehicle* const veh, SUMOReal vPos) const { - const SUMOReal oldV = veh->getSpeed(); // save old v for optional acceleration computation - const SUMOReal vSafe = MIN2(vPos, veh->processNextStop(vPos)); // process stops +double +MSCFModel_Daniel1::moveHelper(MSVehicle* const veh, double vPos) const { + const double oldV = veh->getSpeed(); // save old v for optional acceleration computation + const double vSafe = MIN2(vPos, veh->processNextStop(vPos)); // process stops // we need the acceleration for emission computation; // in this case, we neglect dawdling, nonetheless, using // vSafe does not incorporate speed reduction due to interaction // on lane changing - const SUMOReal vMin = getSpeedAfterMaxDecel(oldV); - const SUMOReal vMax = MIN3(veh->getLane()->getVehicleMaxSpeed(veh), maxNextSpeed(oldV, veh), vSafe); + const double vMin = getSpeedAfterMaxDecel(oldV); + const double vMax = MIN3(veh->getLane()->getVehicleMaxSpeed(veh), maxNextSpeed(oldV, veh), vSafe); #ifdef _DEBUG if (vMin > vMax) { WRITE_WARNING("Maximum speed of vehicle '" + veh->getID() + "' is lower than the minimum speed (min: " + toString(vMin) + ", max: " + toString(vMax) + ")."); @@ -70,35 +70,35 @@ } -SUMOReal -MSCFModel_Daniel1::followSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap, SUMOReal predSpeed, SUMOReal /*predMaxDecel*/) const { +double +MSCFModel_Daniel1::followSpeed(const MSVehicle* const veh, double speed, double gap, double predSpeed, double /*predMaxDecel*/) const { return MIN2(_vsafe(gap, predSpeed), maxNextSpeed(speed, veh)); } -SUMOReal -MSCFModel_Daniel1::stopSpeed(const MSVehicle* const veh, const SUMOReal speed, SUMOReal gap) const { +double +MSCFModel_Daniel1::stopSpeed(const MSVehicle* const veh, const double speed, double gap) const { return MIN2(_vsafe(gap, 0), maxNextSpeed(speed, veh)); } -SUMOReal -MSCFModel_Daniel1::dawdle(SUMOReal speed) const { - return MAX2(SUMOReal(0), speed - ACCEL2SPEED(myDawdle * myAccel * RandHelper::rand())); +double +MSCFModel_Daniel1::dawdle(double speed) const { + return MAX2(0., speed - ACCEL2SPEED(myDawdle * myAccel * RandHelper::rand())); } /** Returns the SK-vsafe. */ -SUMOReal MSCFModel_Daniel1::_vsafe(SUMOReal gap, SUMOReal predSpeed) const { +double MSCFModel_Daniel1::_vsafe(double gap, double predSpeed) const { if (predSpeed == 0 && gap < 0.01) { return 0; } - SUMOReal vsafe = (SUMOReal)(-1. * myTauDecel - + sqrt( - myTauDecel * myTauDecel - + (predSpeed * predSpeed) - + (2. * myDecel * gap) - )); + double vsafe = (double)(-1. * myTauDecel + + sqrt( + myTauDecel * myTauDecel + + (predSpeed * predSpeed) + + (2. * myDecel * gap) + )); assert(vsafe >= 0); return vsafe; } @@ -106,6 +106,6 @@ MSCFModel* MSCFModel_Daniel1::duplicate(const MSVehicleType* vtype) const { - return new MSCFModel_Daniel1(vtype, myAccel, myDecel, myDawdle, myHeadwayTime, + return new MSCFModel_Daniel1(vtype, myAccel, myDecel, myEmergencyDecel, myDawdle, myHeadwayTime, myTmp1, myTmp2, myTmp3, myTmp4, myTmp5); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Daniel1.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Daniel1.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Daniel1.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Daniel1.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Tue, 05 Jun 2012 -/// @version $Id: MSCFModel_Daniel1.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSCFModel_Daniel1.h 23699 2017-03-29 07:16:27Z namdre $ /// // The original Krauss (1998) car-following model and parameter /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,11 +46,12 @@ /** @brief Constructor * @param[in] accel The maximum acceleration * @param[in] decel The maximum deceleration + * @param[in] emergencyDecel The maximum emergency deceleration * @param[in] dawdle The driver imperfection * @param[in] tau The driver's reaction time */ - MSCFModel_Daniel1(const MSVehicleType* vtype, SUMOReal accel, SUMOReal decel, SUMOReal dawdle, SUMOReal headwayTime, - SUMOReal tmp1, SUMOReal tmp2, SUMOReal tmp3, SUMOReal tmp4, SUMOReal tmp5); + MSCFModel_Daniel1(const MSVehicleType* vtype, double accel, double decel, double emergencyDecel, double dawdle, double headwayTime, + double tmp1, double tmp2, double tmp3, double tmp4, double tmp5); /// @brief Destructor @@ -65,7 +66,7 @@ * @param[in] vPos The possible velocity * @return The velocity after applying interactions with stops and lane change model influences */ - SUMOReal moveHelper(MSVehicle* const veh, SUMOReal vPos) const; + double moveHelper(MSVehicle* const veh, double vPos) const; /** @brief Computes the vehicle's safe speed (no dawdling) @@ -76,7 +77,7 @@ * @return EGO's safe speed * @see MSCFModel::ffeV */ - virtual SUMOReal followSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const; + virtual double followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const; /** @brief Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling) @@ -86,7 +87,7 @@ * @see MSCFModel::ffeS * @todo generic Interface, models can call for the values they need */ - virtual SUMOReal stopSpeed(const MSVehicle* const veh, const SUMOReal speed, SUMOReal gap2pred) const; + virtual double stopSpeed(const MSVehicle* const veh, const double speed, double gap2pred) const; /** @brief Returns the model's name @@ -101,7 +102,7 @@ /** @brief Get the driver's imperfection * @return The imperfection of drivers of this class */ - SUMOReal getImperfection() const { + double getImperfection() const { return myDawdle; } /// @} @@ -113,7 +114,7 @@ /** @brief Sets a new value for maximum deceleration [m/s^2] * @param[in] accel The new deceleration in m/s^2 */ - void setMaxDecel(SUMOReal decel) { + void setMaxDecel(double decel) { myDecel = decel; myTauDecel = myDecel * myHeadwayTime; } @@ -122,7 +123,7 @@ /** @brief Sets a new value for driver imperfection * @param[in] accel The new driver imperfection */ - void setImperfection(SUMOReal imperfection) { + void setImperfection(double imperfection) { myDawdle = imperfection; } @@ -130,7 +131,7 @@ /** @brief Sets a new value for driver reaction time [s] * @param[in] headwayTime The new driver reaction time (in s) */ - void setHeadwayTime(SUMOReal headwayTime) { + void setHeadwayTime(double headwayTime) { myHeadwayTime = headwayTime; myTauDecel = myDecel * headwayTime; } @@ -149,24 +150,24 @@ * @param[in] predSpeed The LEADER's speed * @return the safe velocity */ - virtual SUMOReal _vsafe(SUMOReal gap, SUMOReal predSpeed) const; + virtual double _vsafe(double gap, double predSpeed) const; /** @brief Applies driver imperfection (dawdling / sigma) * @param[in] speed The speed with no dawdling * @return The speed after dawdling */ - virtual SUMOReal dawdle(SUMOReal speed) const; + virtual double dawdle(double speed) const; protected: /// @brief The vehicle's dawdle-parameter. 0 for no dawdling, 1 for max. - SUMOReal myDawdle; + double myDawdle; /// @brief The precomputed value for myDecel*myTau - SUMOReal myTauDecel; + double myTauDecel; /// @brief temporary (testing) parameter - SUMOReal myTmp1, myTmp2, myTmp3, myTmp4, myTmp5; + double myTmp1, myTmp2, myTmp3, myTmp4, myTmp5; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 27 Jul 2009 -/// @version $Id: MSCFModel.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSCFModel.h 24108 2017-04-27 18:43:30Z behrisch $ /// // The car-following model abstraction /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -69,7 +69,7 @@ /** @brief Constructor * @param[in] rvtype a reference to the corresponding vtype */ - MSCFModel(const MSVehicleType* vtype, SUMOReal accel, SUMOReal decel, SUMOReal headwayTime); + MSCFModel(const MSVehicleType* vtype, double accel, double decel, double emergencyDecel, double apparentDecel, double headwayTime); /// @brief Destructor @@ -84,7 +84,7 @@ * @param[in] vPos The possible velocity * @return The velocity after applying interactions with stops and lane change model influences */ - virtual SUMOReal moveHelper(MSVehicle* const veh, SUMOReal vPos) const; + virtual double moveHelper(MSVehicle* const veh, double vPos) const; /** @brief Computes the vehicle's safe speed without a leader @@ -99,8 +99,8 @@ * @param[in] onInsertion whether speed at insertion is asked for * @return EGO's safe speed */ - virtual SUMOReal freeSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal seen, - SUMOReal maxSpeed, const bool onInsertion = false) const; + virtual double freeSpeed(const MSVehicle* const veh, double speed, double seen, + double maxSpeed, const bool onInsertion = false) const; /** @brief Computes the vehicle's follow speed (no dawdling) @@ -112,7 +112,7 @@ * @param[in] predSpeed The speed of LEADER * @return EGO's safe speed */ - virtual SUMOReal followSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const = 0; + virtual double followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const = 0; /** @brief Computes the vehicle's safe speed (no dawdling) @@ -127,7 +127,7 @@ * @param[in] predSpeed The speed of LEADER * @return EGO's safe speed */ - virtual SUMOReal insertionFollowSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const; + virtual double insertionFollowSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const; /** @brief Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling) @@ -139,7 +139,7 @@ * @return EGO's safe speed for approaching a non-moving obstacle * @todo generic Interface, models can call for the values they need */ - virtual SUMOReal stopSpeed(const MSVehicle* const veh, const SUMOReal speed, SUMOReal gap) const = 0; + virtual double stopSpeed(const MSVehicle* const veh, const double speed, double gap) const = 0; /** @brief Computes the vehicle's safe speed for approaching an obstacle at insertion without constraints @@ -151,7 +151,7 @@ * @see stopSpeed() and insertionFollowSpeed() * */ - virtual SUMOReal insertionStopSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap) const; + virtual double insertionStopSpeed(const MSVehicle* const veh, double speed, double gap) const; /** @brief Returns the maximum gap at which an interaction between both vehicles occurs @@ -162,7 +162,7 @@ * @return The interaction gap * @todo evaluate signature */ - virtual SUMOReal interactionGap(const MSVehicle* const veh, SUMOReal vL) const; + virtual double interactionGap(const MSVehicle* const veh, double vL) const; /** @brief Returns the model's ID; the XML-Tag number is used @@ -190,7 +190,7 @@ /** @brief Get the vehicle type's maximum acceleration [m/s^2] * @return The maximum acceleration (in m/s^2) of vehicles of this class */ - inline SUMOReal getMaxAccel() const { + inline double getMaxAccel() const { return myAccel; } @@ -198,7 +198,7 @@ /** @brief Get the vehicle type's maximum deceleration [m/s^2] * @return The maximum deceleration (in m/s^2) of vehicles of this class */ - inline SUMOReal getMaxDecel() const { + inline double getMaxDecel() const { return myDecel; } @@ -209,7 +209,7 @@ /** @brief Get the driver's imperfection * @return The imperfection of drivers of this class */ - virtual SUMOReal getImperfection() const { + virtual double getImperfection() const { return -1; } @@ -217,7 +217,7 @@ /** @brief Get the driver's reaction time [s] * @return The reaction time of this class' drivers in s */ - virtual SUMOReal getHeadwayTime() const { + virtual double getHeadwayTime() const { return myHeadwayTime; } /// @} @@ -240,7 +240,7 @@ * @param[in] speed The vehicle itself, for obtaining other values * @return The maximum possible speed for the next step */ - virtual SUMOReal maxNextSpeed(SUMOReal speed, const MSVehicle* const veh) const; + virtual double maxNextSpeed(double speed, const MSVehicle* const veh) const; /** @brief Returns the minimum speed given the current speed @@ -252,7 +252,7 @@ * @param[in] speed The vehicle itself, for obtaining other values, if needed as e.g. road conditions. * @return The minimum possible speed for the next step */ - SUMOReal minNextSpeed(SUMOReal speed, const MSVehicle* const veh = 0) const; + virtual double minNextSpeed(double speed, const MSVehicle* const veh = 0) const; /** @brief Returns the distance the vehicle needs to halt including driver's reaction time, @@ -260,20 +260,20 @@ * @param[in] speed The vehicle's current speed * @return The distance needed to halt */ - inline SUMOReal brakeGap(const SUMOReal speed) const { + inline double brakeGap(const double speed) const { return brakeGap(speed, myDecel, myHeadwayTime); } - static SUMOReal brakeGap(const SUMOReal speed, const SUMOReal decel, const SUMOReal headwayTime); + static double brakeGap(const double speed, const double decel, const double headwayTime); - static SUMOReal freeSpeed(const SUMOReal currentSpeed, const SUMOReal decel, const SUMOReal dist, const SUMOReal maxSpeed, const bool onInsertion); + static double freeSpeed(const double currentSpeed, const double decel, const double dist, const double maxSpeed, const bool onInsertion); /** @brief Returns the minimum gap to reserve if the leader is braking at maximum (>=0) * @param[in] speed EGO's speed * @param[in] leaderSpeed LEADER's speed * @param[in] leaderMaxDecel LEADER's max. deceleration rate */ - inline SUMOReal getSecureGap(const SUMOReal speed, const SUMOReal leaderSpeed, const SUMOReal leaderMaxDecel) const { + inline double getSecureGap(const double speed, const double leaderSpeed, const double leaderMaxDecel) const { // The solution approach leaderBrakeGap >= followerBrakeGap is not // secure when the follower can brake harder than the leader because the paths may still cross. // As a workaround we lower the value of followerDecel which errs on the side of caution @@ -286,21 +286,21 @@ // assert(maximumSafeSpeed <= speed + NUMERICAL_EPS && maximumSafeSpeed >= speed - NUMERICAL_EPS); // XXX: this should fix #2548 (postponed after merge of branch {ticket860}): - // const SUMOReal maxDecel = MAX2(myDecel, leaderMaxDecel); - // SUMOReal secureGap = MAX2((SUMOReal) 0, brakeGap(speed, myDecel, myHeadwayTime) - brakeGap(leaderSpeed, maxDecel, 0)); + // const double maxDecel = MAX2(myDecel, leaderMaxDecel); + // double secureGap = MAX2((double) 0, brakeGap(speed, myDecel, myHeadwayTime) - brakeGap(leaderSpeed, maxDecel, 0)); - const SUMOReal followDecel = MIN2(myDecel, leaderMaxDecel); + const double followDecel = MIN2(myDecel, leaderMaxDecel); // XXX: returning 0 can be wrong if the leader is slower than the follower! Why not return negative values? (Leo) - SUMOReal secureGap = MAX2((SUMOReal) 0, brakeGap(speed, followDecel, myHeadwayTime) - brakeGap(leaderSpeed, leaderMaxDecel, 0)); + double secureGap = MAX2((double) 0, brakeGap(speed, followDecel, myHeadwayTime) - brakeGap(leaderSpeed, leaderMaxDecel, 0)); return secureGap; } - /** @brief Returns the velocity after maximum deceleration + virtual /** @brief Returns the velocity after maximum deceleration * @param[in] v The velocity * @return The velocity after maximum deceleration */ - inline SUMOReal getSpeedAfterMaxDecel(SUMOReal v) const { - return MAX2((SUMOReal) 0, v - (SUMOReal) ACCEL2SPEED(myDecel)); + inline double getSpeedAfterMaxDecel(double v) const { + return MAX2((double) 0, v - (double) ACCEL2SPEED(myDecel)); } /// @} @@ -309,20 +309,20 @@ * @param[in] currentSpeed Actual speed of vehicle * @param[in] arrivalSpeed Desired speed at arrival */ - SUMOTime getMinimalArrivalTime(SUMOReal dist, SUMOReal currentSpeed, SUMOReal arrivalSpeed) const; + SUMOTime getMinimalArrivalTime(double dist, double currentSpeed, double arrivalSpeed) const; /** @brief Computes the minimal possible arrival speed after covering a given distance * @param[in] dist Distance to be covered * @param[in] currentSpeed Actual speed of vehicle */ - SUMOReal getMinimalArrivalSpeed(SUMOReal dist, SUMOReal currentSpeed) const; + double getMinimalArrivalSpeed(double dist, double currentSpeed) const; /** @brief Computes the minimal possible arrival speed after covering a given distance for Euler update * @param[in] dist Distance to be covered * @param[in] currentSpeed Actual speed of vehicle */ - SUMOReal getMinimalArrivalSpeedEuler(SUMOReal dist, SUMOReal currentSpeed) const; + double getMinimalArrivalSpeedEuler(double dist, double currentSpeed) const; /** @brief return the resulting gap if, starting with gap currentGap, two vehicles @@ -338,7 +338,7 @@ * @param[in] duration time span for the process * @return estimated gap after 'duration' seconds */ - static SUMOReal gapExtrapolation(const SUMOReal duration, const SUMOReal currentGap, SUMOReal v1, SUMOReal v2, SUMOReal a1 = 0, SUMOReal a2 = 0, const SUMOReal maxV1 = std::numeric_limits::max(), const SUMOReal maxV2 = std::numeric_limits::max()); + static double gapExtrapolation(const double duration, const double currentGap, double v1, double v2, double a1 = 0, double a2 = 0, const double maxV1 = std::numeric_limits::max(), const double maxV2 = std::numeric_limits::max()); /** * @brief Calculates the time at which the position passedPosition has been passed @@ -352,7 +352,7 @@ * @param[in] currentSpeed the speed at moment t=TS * @return time t in [0,TS] at which passedPos in [lastPos, currentPos] was passed. */ - static SUMOReal passingTime(const SUMOReal lastPos, const SUMOReal passedPos, const SUMOReal currentPos, const SUMOReal lastSpeed, const SUMOReal currentSpeed); + static double passingTime(const double lastPos, const double passedPos, const double currentPos, const double lastSpeed, const double currentSpeed); @@ -367,7 +367,7 @@ * @param[in] distance covered * @return speed at time t */ - static SUMOReal speedAfterTime(const SUMOReal t, const SUMOReal oldSpeed, const SUMOReal dist); + static double speedAfterTime(const double t, const double oldSpeed, const double dist); @@ -380,7 +380,7 @@ * XXX affected by ticket #860 (the formula is invalid for the Euler position update rule) * XXX (Leo) Migrated estimateSpeedAfterDistance() to MSCFModel from MSVehicle as Jakob suggested (removed inline property, because myType is fw-declared) */ - SUMOReal estimateSpeedAfterDistance(const SUMOReal dist, const SUMOReal v, const SUMOReal accel) const; + double estimateSpeedAfterDistance(const double dist, const double v, const double accel) const; /// @name Setter methods /// @{ @@ -388,7 +388,7 @@ /** @brief Sets a new value for maximum acceleration [m/s^2] * @param[in] accel The new acceleration in m/s^2 */ - virtual void setMaxAccel(SUMOReal accel) { + virtual void setMaxAccel(double accel) { myAccel = accel; } @@ -396,7 +396,7 @@ /** @brief Sets a new value for maximum deceleration [m/s^2] * @param[in] accel The new deceleration in m/s^2 */ - virtual void setMaxDecel(SUMOReal decel) { + virtual void setMaxDecel(double decel) { myDecel = decel; } @@ -404,7 +404,7 @@ /** @brief Sets a new value for driver imperfection * @param[in] accel The new driver imperfection */ - virtual void setImperfection(SUMOReal imperfection) { + virtual void setImperfection(double imperfection) { UNUSED_PARAMETER(imperfection); } @@ -412,7 +412,7 @@ /** @brief Sets a new value for driver reaction time [s] * @param[in] headwayTime The new driver reaction time (in s) */ - virtual void setHeadwayTime(SUMOReal headwayTime) { + virtual void setHeadwayTime(double headwayTime) { myHeadwayTime = headwayTime; } /// @} @@ -425,7 +425,7 @@ * @param[in] onInsertion Indicator whether the call is triggered during vehicle insertion * @return the safe velocity */ - SUMOReal maximumSafeFollowSpeed(SUMOReal gap, SUMOReal egoSpeed, SUMOReal predSpeed, SUMOReal predMaxDecel, bool onInsertion = false) const; + double maximumSafeFollowSpeed(double gap, double egoSpeed, double predSpeed, double predMaxDecel, bool onInsertion = false) const; /** @brief Returns the maximum next velocity for stopping within gap @@ -434,14 +434,14 @@ * @param[in] onInsertion Indicator whether the call is triggered during vehicle insertion * @param[in] headway The desired time headway to be included in the calculations (default argument -1 induces the use of myHeadway) */ - SUMOReal maximumSafeStopSpeed(SUMOReal gap, SUMOReal currentSpeed, bool onInsertion = false, SUMOReal headway = -1) const; + double maximumSafeStopSpeed(double gap, double currentSpeed, bool onInsertion = false, double headway = -1) const; /** @brief Returns the maximum next velocity for stopping within gap * when using the semi-implicit Euler update * @param[in] gap The (netto) distance to the LEADER */ - SUMOReal maximumSafeStopSpeedEuler(SUMOReal gap) const; + double maximumSafeStopSpeedEuler(double gap) const; /** @brief Returns the maximum next velocity for stopping within gap @@ -455,7 +455,7 @@ * @return the safe velocity (to be attained at the end of the following time step) that assures the possibility of stopping within gap. * If a negative value is returned, the required stop has to take place before the end of the time step. */ - SUMOReal maximumSafeStopSpeedBallistic(SUMOReal gap, SUMOReal currentSpeed, bool onInsertion = false, SUMOReal headway = -1) const; + double maximumSafeStopSpeedBallistic(double gap, double currentSpeed, bool onInsertion = false, double headway = -1) const; protected: @@ -463,13 +463,17 @@ const MSVehicleType* myType; /// @brief The vehicle's maximum acceleration [m/s^2] - SUMOReal myAccel; + double myAccel; /// @brief The vehicle's maximum deceleration [m/s^2] - SUMOReal myDecel; + double myDecel; + /// @brief The vehicle's maximum emergency deceleration [m/s^2] + double myEmergencyDecel; + /// @brief The vehicle's deceleration as expected by surrounding traffic [m/s^2] + double myApparentDecel; /// @brief The driver's desired time headway (aka reaction time tau) [s] - SUMOReal myHeadwayTime; + double myHeadwayTime; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_IDM.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_IDM.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_IDM.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_IDM.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Thu, 03 Sep 2009 -/// @version $Id: MSCFModel_IDM.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: MSCFModel_IDM.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The Intelligent Driver Model (IDM) car-following model /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,34 +41,34 @@ // method definitions // =========================================================================== MSCFModel_IDM::MSCFModel_IDM(const MSVehicleType* vtype, - SUMOReal accel, SUMOReal decel, - SUMOReal headwayTime, SUMOReal delta, - SUMOReal internalStepping) - : MSCFModel(vtype, accel, decel, headwayTime), myDelta(delta), - myAdaptationFactor(1.), myAdaptationTime(0.), - myIterations(MAX2(1, int(TS / internalStepping + .5))), - myTwoSqrtAccelDecel(SUMOReal(2 * sqrt(accel * decel))) { + double accel, double decel, double emergencyDecel, + double headwayTime, double delta, + double internalStepping) : + MSCFModel(vtype, accel, decel, emergencyDecel, decel, headwayTime), myDelta(delta), + myAdaptationFactor(1.), myAdaptationTime(0.), + myIterations(MAX2(1, int(TS / internalStepping + .5))), + myTwoSqrtAccelDecel(double(2 * sqrt(accel * decel))) { } MSCFModel_IDM::MSCFModel_IDM(const MSVehicleType* vtype, - SUMOReal accel, SUMOReal decel, - SUMOReal headwayTime, - SUMOReal adaptationFactor, SUMOReal adaptationTime, - SUMOReal internalStepping) - : MSCFModel(vtype, accel, decel, headwayTime), myDelta(4.), - myAdaptationFactor(adaptationFactor), myAdaptationTime(adaptationTime), - myIterations(MAX2(1, int(TS / internalStepping + .5))), - myTwoSqrtAccelDecel(SUMOReal(2 * sqrt(accel * decel))) { + double accel, double decel, double emergencyDecel, + double headwayTime, + double adaptationFactor, double adaptationTime, + double internalStepping) : + MSCFModel(vtype, accel, decel, emergencyDecel, decel, headwayTime), myDelta(4.), + myAdaptationFactor(adaptationFactor), myAdaptationTime(adaptationTime), + myIterations(MAX2(1, int(TS / internalStepping + .5))), + myTwoSqrtAccelDecel(double(2 * sqrt(accel * decel))) { } MSCFModel_IDM::~MSCFModel_IDM() {} -SUMOReal -MSCFModel_IDM::moveHelper(MSVehicle* const veh, SUMOReal vPos) const { - const SUMOReal vNext = MSCFModel::moveHelper(veh, vPos); +double +MSCFModel_IDM::moveHelper(MSVehicle* const veh, double vPos) const { + const double vNext = MSCFModel::moveHelper(veh, vPos); if (myAdaptationFactor != 1.) { VehicleVariables* vars = (VehicleVariables*)veh->getCarFollowVariables(); vars->levelOfService += (vNext / veh->getLane()->getVehicleMaxSpeed(veh) - vars->levelOfService) / myAdaptationTime * TS; @@ -77,14 +77,14 @@ } -SUMOReal -MSCFModel_IDM::followSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal /*predMaxDecel*/) const { +double +MSCFModel_IDM::followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double /*predMaxDecel*/) const { return _v(veh, gap2pred, speed, predSpeed, veh->getLane()->getVehicleMaxSpeed(veh)); } -SUMOReal -MSCFModel_IDM::stopSpeed(const MSVehicle* const veh, const SUMOReal speed, SUMOReal gap2pred) const { +double +MSCFModel_IDM::stopSpeed(const MSVehicle* const veh, const double speed, double gap2pred) const { if (gap2pred < 0.01) { return 0; } @@ -93,50 +93,50 @@ /// @todo update interactionGap logic to IDM -SUMOReal -MSCFModel_IDM::interactionGap(const MSVehicle* const veh, SUMOReal vL) const { +double +MSCFModel_IDM::interactionGap(const MSVehicle* const veh, double vL) const { // Resolve the IDM equation to gap. Assume predecessor has // speed != 0 and that vsafe will be the current speed plus acceleration, // i.e that with this gap there will be no interaction. - const SUMOReal acc = myAccel * (1. - pow(veh->getSpeed() / veh->getLane()->getVehicleMaxSpeed(veh), myDelta)); - const SUMOReal vNext = veh->getSpeed() + acc; - const SUMOReal gap = (vNext - vL) * (veh->getSpeed() + vL) / (2 * myDecel) + vL; + const double acc = myAccel * (1. - pow(veh->getSpeed() / veh->getLane()->getVehicleMaxSpeed(veh), myDelta)); + const double vNext = veh->getSpeed() + acc; + const double gap = (vNext - vL) * (veh->getSpeed() + vL) / (2 * myDecel) + vL; // Don't allow timeHeadWay < deltaT situations. return MAX2(gap, SPEED2DIST(vNext)); } -SUMOReal -MSCFModel_IDM::_v(const MSVehicle* const veh, const SUMOReal gap2pred, const SUMOReal egoSpeed, - const SUMOReal predSpeed, const SUMOReal desSpeed, const bool respectMinGap) const { +double +MSCFModel_IDM::_v(const MSVehicle* const veh, const double gap2pred, const double egoSpeed, + const double predSpeed, const double desSpeed, const bool respectMinGap) const { // this is more or less based on http://www.vwi.tu-dresden.de/~treiber/MicroApplet/IDM.html // and http://arxiv.org/abs/cond-mat/0304337 // we assume however constant speed for the leader - SUMOReal headwayTime = myHeadwayTime; + double headwayTime = myHeadwayTime; if (myAdaptationFactor != 1.) { const VehicleVariables* vars = (VehicleVariables*)veh->getCarFollowVariables(); headwayTime *= myAdaptationFactor + vars->levelOfService * (1. - myAdaptationFactor); } - SUMOReal newSpeed = egoSpeed; - SUMOReal gap = gap2pred; + double newSpeed = egoSpeed; + double gap = gap2pred; for (int i = 0; i < myIterations; i++) { - const SUMOReal delta_v = newSpeed - predSpeed; - SUMOReal s = MAX2(SUMOReal(0), newSpeed * headwayTime + newSpeed * delta_v / myTwoSqrtAccelDecel); + const double delta_v = newSpeed - predSpeed; + double s = MAX2(0., newSpeed * headwayTime + newSpeed * delta_v / myTwoSqrtAccelDecel); if (respectMinGap) { s += myType->getMinGap(); } - const SUMOReal acc = myAccel * (1. - pow(newSpeed / desSpeed, myDelta) - (s * s) / (gap * gap)); + const double acc = myAccel * (1. - pow(newSpeed / desSpeed, myDelta) - (s * s) / (gap * gap)); newSpeed += ACCEL2SPEED(acc) / myIterations; //TODO use more realistic position update which takes accelerated motion into account - gap -= MAX2(SUMOReal(0), SPEED2DIST(newSpeed - predSpeed) / myIterations); + gap -= MAX2(0., SPEED2DIST(newSpeed - predSpeed) / myIterations); } // return MAX2(getSpeedAfterMaxDecel(egoSpeed), newSpeed); - return MAX2(SUMOReal(0), newSpeed); + return MAX2(0., newSpeed); } MSCFModel* MSCFModel_IDM::duplicate(const MSVehicleType* vtype) const { - return new MSCFModel_IDM(vtype, myAccel, myDecel, myHeadwayTime, myDelta, TS / myIterations); + return new MSCFModel_IDM(vtype, myAccel, myDecel, myEmergencyDecel, myHeadwayTime, myDelta, TS / myIterations); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_IDM.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_IDM.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_IDM.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_IDM.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Thu, 03 Sep 2009 -/// @version $Id: MSCFModel_IDM.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSCFModel_IDM.h 24108 2017-04-27 18:43:30Z behrisch $ /// // The Intelligent Driver Model (IDM) car-following model /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -50,12 +50,13 @@ /** @brief Constructor * @param[in] accel The maximum acceleration * @param[in] decel The maximum deceleration + * @param[in] emergencyDecel The maximum emergency deceleration * @param[in] headwayTime the headway gap * @param[in] delta a model constant * @param[in] internalStepping internal time step size */ - MSCFModel_IDM(const MSVehicleType* vtype, SUMOReal accel, SUMOReal decel, - SUMOReal headwayTime, SUMOReal delta, SUMOReal internalStepping); + MSCFModel_IDM(const MSVehicleType* vtype, double accel, double decel, double emergencyDecel, + double headwayTime, double delta, double internalStepping); /** @brief Constructor @@ -66,9 +67,9 @@ * @param[in] adaptationTime a model constant * @param[in] internalStepping internal time step size */ - MSCFModel_IDM(const MSVehicleType* vtype, SUMOReal accel, SUMOReal decel, - SUMOReal headwayTime, SUMOReal adaptationFactor, SUMOReal adaptationTime, - SUMOReal internalStepping); + MSCFModel_IDM(const MSVehicleType* vtype, double accel, double decel, double emergencyDecel, + double headwayTime, double adaptationFactor, double adaptationTime, + double internalStepping); /// @brief Destructor @@ -83,7 +84,7 @@ * @param[in] vPos The possible velocity * @return The velocity after applying interactions with stops and lane change model influences */ - SUMOReal moveHelper(MSVehicle* const veh, SUMOReal vPos) const; + double moveHelper(MSVehicle* const veh, double vPos) const; /** @brief Computes the vehicle's safe speed (no dawdling) @@ -94,7 +95,7 @@ * @return EGO's safe speed * @see MSCFModel::ffeV */ - SUMOReal followSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const; + double followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const; /** @brief Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling) @@ -104,7 +105,7 @@ * @see MSCFModel::ffeS * @todo generic Interface, models can call for the values they need */ - SUMOReal stopSpeed(const MSVehicle* const veh, const SUMOReal speed, SUMOReal gap2pred) const; + double stopSpeed(const MSVehicle* const veh, const double speed, double gap2pred) const; /** @brief Returns the maximum gap at which an interaction between both vehicles occurs @@ -116,7 +117,7 @@ * @todo evaluate signature * @see MSCFModel::interactionGap */ - SUMOReal interactionGap(const MSVehicle* const , SUMOReal vL) const; + double interactionGap(const MSVehicle* const , double vL) const; /** @brief Returns the model's name @@ -150,30 +151,30 @@ public: VehicleVariables() : levelOfService(1.) {} /// @brief state variable for remembering speed deviation history (lambda) - SUMOReal levelOfService; + double levelOfService; }; private: - SUMOReal _v(const MSVehicle* const veh, const SUMOReal gap2pred, const SUMOReal mySpeed, - const SUMOReal predSpeed, const SUMOReal desSpeed, const bool respectMinGap = true) const; + double _v(const MSVehicle* const veh, const double gap2pred, const double mySpeed, + const double predSpeed, const double desSpeed, const bool respectMinGap = true) const; private: /// @brief The IDM delta exponent - const SUMOReal myDelta; + const double myDelta; /// @brief The IDMM adaptation factor beta - const SUMOReal myAdaptationFactor; + const double myAdaptationFactor; /// @brief The IDMM adaptation time tau - const SUMOReal myAdaptationTime; + const double myAdaptationTime; /// @brief The number of iterations in speed calculations const int myIterations; /// @brief A computational shortcut - const SUMOReal myTwoSqrtAccelDecel; + const double myTwoSqrtAccelDecel; private: /// @brief Invalidated assignment operator diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Kerner.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Kerner.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Kerner.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Kerner.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date 03.04.2010 -/// @version $Id: MSCFModel_Kerner.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: MSCFModel_Kerner.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // car-following model by B. Kerner /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,33 +39,33 @@ // =========================================================================== // method definitions // =========================================================================== -MSCFModel_Kerner::MSCFModel_Kerner(const MSVehicleType* vtype, SUMOReal accel, - SUMOReal decel, SUMOReal headwayTime, SUMOReal k, SUMOReal phi) - : MSCFModel(vtype, accel, decel, headwayTime), myK(k), myPhi(phi), - myTauDecel(decel * headwayTime) { +MSCFModel_Kerner::MSCFModel_Kerner(const MSVehicleType* vtype, double accel, + double decel, double emergencyDecel, double headwayTime, double k, double phi) : + MSCFModel(vtype, accel, decel, emergencyDecel, decel, headwayTime), myK(k), myPhi(phi), + myTauDecel(decel * headwayTime) { } MSCFModel_Kerner::~MSCFModel_Kerner() {} -SUMOReal -MSCFModel_Kerner::moveHelper(MSVehicle* const veh, SUMOReal vPos) const { - const SUMOReal vNext = MSCFModel::moveHelper(veh, vPos); +double +MSCFModel_Kerner::moveHelper(MSVehicle* const veh, double vPos) const { + const double vNext = MSCFModel::moveHelper(veh, vPos); VehicleVariables* vars = (VehicleVariables*)veh->getCarFollowVariables(); vars->rand = RandHelper::rand(); return vNext; } -SUMOReal -MSCFModel_Kerner::followSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap, SUMOReal predSpeed, SUMOReal /*predMaxDecel*/) const { +double +MSCFModel_Kerner::followSpeed(const MSVehicle* const veh, double speed, double gap, double predSpeed, double /*predMaxDecel*/) const { return MIN2(_v(veh, speed, maxNextSpeed(speed, veh), gap, predSpeed), maxNextSpeed(speed, veh)); } -SUMOReal -MSCFModel_Kerner::stopSpeed(const MSVehicle* const veh, const SUMOReal speed, SUMOReal gap) const { +double +MSCFModel_Kerner::stopSpeed(const MSVehicle* const veh, const double speed, double gap) const { return MIN2(_v(veh, speed, maxNextSpeed(speed, veh), gap, 0), maxNextSpeed(speed, veh)); } @@ -78,23 +78,23 @@ } -SUMOReal -MSCFModel_Kerner::_v(const MSVehicle* const veh, SUMOReal speed, SUMOReal vfree, SUMOReal gap, SUMOReal predSpeed) const { +double +MSCFModel_Kerner::_v(const MSVehicle* const veh, double speed, double vfree, double gap, double predSpeed) const { if (predSpeed == 0 && gap < 0.01) { return 0; } // !!! in the following, the prior step is not considered!!! - SUMOReal G = MAX2((SUMOReal) 0, (SUMOReal)(SPEED2DIST(myK * speed) + myPhi / myAccel * speed * (speed - predSpeed))); - SUMOReal vcond = gap > G ? speed + ACCEL2SPEED(myAccel) : speed + MAX2(ACCEL2SPEED(-myDecel), MIN2(ACCEL2SPEED(myAccel), predSpeed - speed)); - SUMOReal vsafe = (SUMOReal)(-1. * myTauDecel + sqrt(myTauDecel * myTauDecel + (predSpeed * predSpeed) + (2. * myDecel * gap))); + double G = MAX2((double) 0, (double)(SPEED2DIST(myK * speed) + myPhi / myAccel * speed * (speed - predSpeed))); + double vcond = gap > G ? speed + ACCEL2SPEED(myAccel) : speed + MAX2(ACCEL2SPEED(-myDecel), MIN2(ACCEL2SPEED(myAccel), predSpeed - speed)); + double vsafe = (double)(-1. * myTauDecel + sqrt(myTauDecel * myTauDecel + (predSpeed * predSpeed) + (2. * myDecel * gap))); VehicleVariables* vars = (VehicleVariables*)veh->getCarFollowVariables(); - SUMOReal va = MAX2((SUMOReal) 0, MIN3(vfree, vsafe, vcond)) + vars->rand; - SUMOReal v = MAX2((SUMOReal) 0, MIN4(vfree, va, speed + ACCEL2SPEED(myAccel), vsafe)); + double va = MAX2((double) 0, MIN3(vfree, vsafe, vcond)) + vars->rand; + double v = MAX2((double) 0, MIN4(vfree, va, speed + ACCEL2SPEED(myAccel), vsafe)); return v; } MSCFModel* MSCFModel_Kerner::duplicate(const MSVehicleType* vtype) const { - return new MSCFModel_Kerner(vtype, myAccel, myDecel, myHeadwayTime, myK, myPhi); + return new MSCFModel_Kerner(vtype, myAccel, myDecel, myEmergencyDecel, myHeadwayTime, myK, myPhi); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Kerner.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Kerner.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Kerner.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Kerner.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 03.04.2010 -/// @version $Id: MSCFModel_Kerner.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSCFModel_Kerner.h 23699 2017-03-29 07:16:27Z namdre $ /// // car-following model by B. Kerner /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,10 +46,11 @@ /** @brief Constructor * @param[in] accel The maximum acceleration * @param[in] decel The maximum deceleration + * @param[in] emergencyDecel The maximum emergency deceleration * @param[in] dawdle The driver imperfection * @param[in] tau The driver's reaction time */ - MSCFModel_Kerner(const MSVehicleType* vtype, SUMOReal accel, SUMOReal decel, SUMOReal headwayTime, SUMOReal k, SUMOReal phi); + MSCFModel_Kerner(const MSVehicleType* vtype, double accel, double decel, double emergencyDecel, double headwayTime, double k, double phi); /// @brief Destructor @@ -64,7 +65,7 @@ * @param[in] vPos The possible velocity * @return The velocity after applying interactions with stops and lane change model influences */ - SUMOReal moveHelper(MSVehicle* const veh, SUMOReal vPos) const; + double moveHelper(MSVehicle* const veh, double vPos) const; /** @brief Computes the vehicle's safe speed (no dawdling) * @param[in] veh The vehicle (EGO) @@ -74,7 +75,7 @@ * @return EGO's safe speed * @see MSCFModel::ffeV */ - SUMOReal followSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const; + double followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const; /** @brief Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling) @@ -84,7 +85,7 @@ * @see MSCFModel::ffeS * @todo generic Interface, models can call for the values they need */ - SUMOReal stopSpeed(const MSVehicle* const veh, const SUMOReal speed, SUMOReal gap2pred) const; + double stopSpeed(const MSVehicle* const veh, const double speed, double gap2pred) const; /** @brief Returns the model's name @@ -111,7 +112,7 @@ private: class VehicleVariables : public MSCFModel::VehicleVariables { public: - SUMOReal rand; + double rand; }; /** @brief Returns the "safe" velocity @@ -119,7 +120,7 @@ * @param[in] predSpeed The LEADER's speed * @return the safe velocity */ - SUMOReal _v(const MSVehicle* const veh, SUMOReal speed, SUMOReal vfree, SUMOReal gap, SUMOReal predSpeed) const; + double _v(const MSVehicle* const veh, double speed, double vfree, double gap, double predSpeed) const; @@ -127,13 +128,13 @@ /// @name model parameter /// @{ /// @brief Kerner's k - SUMOReal myK; + double myK; /// @brief Kerner's phi - SUMOReal myPhi; + double myPhi; /// @brief The precomputed value for myDecel*myTau - SUMOReal myTauDecel; + double myTauDecel; /// @} }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Krauss.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Krauss.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Krauss.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Krauss.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Mon, 04 Aug 2009 -/// @version $Id: MSCFModel_Krauss.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSCFModel_Krauss.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Krauss car-following model, with acceleration decrease and faster start /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,17 +43,18 @@ // =========================================================================== // method definitions // =========================================================================== -MSCFModel_Krauss::MSCFModel_Krauss(const MSVehicleType* vtype, SUMOReal accel, SUMOReal decel, - SUMOReal dawdle, SUMOReal headwayTime) - : MSCFModel_KraussOrig1(vtype, accel, decel, dawdle, headwayTime) { +MSCFModel_Krauss::MSCFModel_Krauss(const MSVehicleType* vtype, double accel, double decel, + double emergencyDecel, double apparentDecel, + double dawdle, double headwayTime) : + MSCFModel_KraussOrig1(vtype, accel, decel, emergencyDecel, apparentDecel, dawdle, headwayTime) { } MSCFModel_Krauss::~MSCFModel_Krauss() {} -SUMOReal -MSCFModel_Krauss::stopSpeed(const MSVehicle* const veh, const SUMOReal speed, SUMOReal gap) const { +double +MSCFModel_Krauss::stopSpeed(const MSVehicle* const veh, const double speed, double gap) const { // NOTE: This allows return of smaller values than minNextSpeed(). // Only relevant for the ballistic update: We give the argument headway=TS, to assure that // the stopping position is approached with a uniform deceleration also for tau!=TS. @@ -61,11 +62,11 @@ } -SUMOReal -MSCFModel_Krauss::followSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap, SUMOReal predSpeed, SUMOReal predMaxDecel) const { - const SUMOReal vsafe = maximumSafeFollowSpeed(gap, speed, predSpeed, predMaxDecel); - const SUMOReal vmin = minNextSpeed(speed); - const SUMOReal vmax = maxNextSpeed(speed, veh); +double +MSCFModel_Krauss::followSpeed(const MSVehicle* const veh, double speed, double gap, double predSpeed, double predMaxDecel) const { + const double vsafe = maximumSafeFollowSpeed(gap, speed, predSpeed, predMaxDecel); + const double vmin = minNextSpeed(speed); + const double vmax = maxNextSpeed(speed, veh); if (MSGlobals::gSemiImplicitEulerUpdate) { return MIN2(vsafe, vmax); } else { @@ -76,8 +77,8 @@ } -SUMOReal -MSCFModel_Krauss::dawdle(SUMOReal speed) const { +double +MSCFModel_Krauss::dawdle(double speed) const { if (!MSGlobals::gSemiImplicitEulerUpdate) { // in case of the ballistic update, negative speeds indicate // a desired stop before the completion of the next timestep. @@ -87,7 +88,7 @@ } } // generate random number out of [0,1) - const SUMOReal random = RandHelper::rand(); + const double random = RandHelper::rand(); // Dawdle. if (speed < myAccel) { // we should not prevent vehicles from driving just due to dawdling @@ -97,13 +98,13 @@ } else { speed -= ACCEL2SPEED(myDawdle * myAccel * random); } - return MAX2(SUMOReal(0), speed); + return MAX2(0., speed); } MSCFModel* MSCFModel_Krauss::duplicate(const MSVehicleType* vtype) const { - return new MSCFModel_Krauss(vtype, myAccel, myDecel, myDawdle, myHeadwayTime); + return new MSCFModel_Krauss(vtype, myAccel, myDecel, myEmergencyDecel, myApparentDecel, myDawdle, myHeadwayTime); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Krauss.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Krauss.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Krauss.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Krauss.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 28 Jul 2009 -/// @version $Id: MSCFModel_Krauss.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSCFModel_Krauss.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Krauss car-following model, with acceleration decrease and faster start /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,10 +48,13 @@ /** @brief Constructor * @param[in] accel The maximum acceleration * @param[in] decel The maximum deceleration + * @param[in] emergencyDecel The maximum emergency deceleration + * @param[in] apparentDecel The deceleration as expected by others * @param[in] dawdle The driver imperfection * @param[in] headwayTime The driver's reaction time */ - MSCFModel_Krauss(const MSVehicleType* vtype, SUMOReal accel, SUMOReal decel, SUMOReal dawdle, SUMOReal headwayTime); + MSCFModel_Krauss(const MSVehicleType* vtype, double accel, double decel, + double emergencyDecel, double apparentDecel, double dawdle, double headwayTime); /// @brief Destructor @@ -68,7 +71,7 @@ * @return EGO's safe speed for approaching a non-moving obstacle * @todo generic Interface, models can call for the values they need */ - SUMOReal stopSpeed(const MSVehicle* const veh, const SUMOReal speed, SUMOReal gap2pred) const; + double stopSpeed(const MSVehicle* const veh, const double speed, double gap2pred) const; /** @brief Computes the vehicle's safe speed (no dawdling) @@ -79,7 +82,7 @@ * @param[in] predSpeed The speed of LEADER * @return EGO's safe speed */ - SUMOReal followSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const; + double followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const; /** @brief Returns the model's name @@ -99,13 +102,13 @@ MSCFModel* duplicate(const MSVehicleType* vtype) const; -private: +protected: /** @brief Applies driver imperfection (dawdling / sigma) * @param[in] speed The speed with no dawdling * @return The speed after dawdling */ - SUMOReal dawdle(SUMOReal speed) const; + double dawdle(double speed) const; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussOrig1.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussOrig1.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussOrig1.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussOrig1.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Mon, 04 Aug 2009 -/// @version $Id: MSCFModel_KraussOrig1.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSCFModel_KraussOrig1.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The original Krauss (1998) car-following model and parameter /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,35 +45,37 @@ // =========================================================================== // method definitions // =========================================================================== -MSCFModel_KraussOrig1::MSCFModel_KraussOrig1(const MSVehicleType* vtype, SUMOReal accel, SUMOReal decel, - SUMOReal dawdle, SUMOReal headwayTime) - : MSCFModel(vtype, accel, decel, headwayTime), myDawdle(dawdle), myTauDecel(decel * headwayTime) {} +MSCFModel_KraussOrig1::MSCFModel_KraussOrig1(const MSVehicleType* vtype, double accel, double decel, + double emergencyDecel, double apparentDecel, + double dawdle, double headwayTime) : + MSCFModel(vtype, accel, decel, emergencyDecel, apparentDecel, headwayTime), myDawdle(dawdle), + myTauDecel(decel * headwayTime) {} MSCFModel_KraussOrig1::~MSCFModel_KraussOrig1() {} -SUMOReal -MSCFModel_KraussOrig1::moveHelper(MSVehicle* const veh, SUMOReal vPos) const { - const SUMOReal oldV = veh->getSpeed(); // save old v for optional acceleration computation - const SUMOReal vSafe = MIN2(vPos, veh->processNextStop(vPos)); // process stops +double +MSCFModel_KraussOrig1::moveHelper(MSVehicle* const veh, double vPos) const { + const double oldV = veh->getSpeed(); // save old v for optional acceleration computation + const double vSafe = MIN2(vPos, veh->processNextStop(vPos)); // process stops // we need the acceleration for emission computation; // in this case, we neglect dawdling, nonetheless, using // vSafe does not incorporate speed reduction due to interaction // on lane changing - const SUMOReal vMin = minNextSpeed(oldV, veh); + const double vMin = minNextSpeed(oldV, veh); // do not exceed max decel even if it is unsafe - SUMOReal vMax = MAX2(vMin, - MIN3(veh->getLane()->getVehicleMaxSpeed(veh), maxNextSpeed(oldV, veh), vSafe)); + double vMax = MAX2(vMin, + MIN3(veh->getLane()->getVehicleMaxSpeed(veh), maxNextSpeed(oldV, veh), vSafe)); #ifdef _DEBUG //if (vMin > vMax) { // WRITE_WARNING("Maximum speed of vehicle '" + veh->getID() + "' is lower than the minimum speed (min: " + toString(vMin) + ", max: " + toString(vMax) + ")."); //} #endif - const SUMOReal vDawdle = MAX2(vMin, dawdle(vMax)); + const double vDawdle = MAX2(vMin, dawdle(vMax)); - SUMOReal vNext = veh->getLaneChangeModel().patchSpeed(vMin, vDawdle, vMax, *this); + double vNext = veh->getLaneChangeModel().patchSpeed(vMin, vDawdle, vMax, *this); #ifdef DEBUG_EXECUTE_MOVE if DEBUG_COND { @@ -96,8 +98,8 @@ } -SUMOReal -MSCFModel_KraussOrig1::followSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap, SUMOReal predSpeed, SUMOReal predMaxDecel) const { +double +MSCFModel_KraussOrig1::followSpeed(const MSVehicle* const veh, double speed, double gap, double predSpeed, double predMaxDecel) const { if (MSGlobals::gSemiImplicitEulerUpdate) { return MIN2(vsafe(gap, predSpeed, predMaxDecel), maxNextSpeed(speed, veh)); // XXX: and why not cap with minNextSpeed!? (Leo) } else { @@ -106,8 +108,8 @@ } -SUMOReal -MSCFModel_KraussOrig1::insertionFollowSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const { +double +MSCFModel_KraussOrig1::insertionFollowSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const { if (MSGlobals::gSemiImplicitEulerUpdate) { return followSpeed(veh, speed, gap2pred, predSpeed, predMaxDecel); } else { @@ -117,8 +119,8 @@ } -SUMOReal -MSCFModel_KraussOrig1::stopSpeed(const MSVehicle* const veh, const SUMOReal speed, SUMOReal gap) const { +double +MSCFModel_KraussOrig1::stopSpeed(const MSVehicle* const veh, const double speed, double gap) const { if (MSGlobals::gSemiImplicitEulerUpdate) { return MIN2(vsafe(gap, 0., 0.), maxNextSpeed(speed, veh)); } else { @@ -129,8 +131,8 @@ } -SUMOReal -MSCFModel_KraussOrig1::dawdle(SUMOReal speed) const { +double +MSCFModel_KraussOrig1::dawdle(double speed) const { if (!MSGlobals::gSemiImplicitEulerUpdate) { // in case of the ballistic update, negative speeds indicate // a desired stop before the completion of the next timestep. @@ -139,24 +141,24 @@ return speed; } } - return MAX2(SUMOReal(0), speed - ACCEL2SPEED(myDawdle * myAccel * RandHelper::rand())); + return MAX2(0., speed - ACCEL2SPEED(myDawdle * myAccel * RandHelper::rand())); } /** Returns the SK-vsafe. */ -SUMOReal MSCFModel_KraussOrig1::vsafe(SUMOReal gap, SUMOReal predSpeed, SUMOReal /* predMaxDecel */) const { +double MSCFModel_KraussOrig1::vsafe(double gap, double predSpeed, double /* predMaxDecel */) const { if (predSpeed == 0 && gap < 0.01) { return 0; } else if (predSpeed == 0 && gap <= ACCEL2SPEED(myDecel)) { // workaround for #2310 return MIN2(ACCEL2SPEED(myDecel), DIST2SPEED(gap)); } - SUMOReal vsafe = (SUMOReal)(-1. * myTauDecel - + sqrt( - myTauDecel * myTauDecel - + (predSpeed * predSpeed) - + (2. * myDecel * gap) - )); + double vsafe = (double)(-1. * myTauDecel + + sqrt( + myTauDecel * myTauDecel + + (predSpeed * predSpeed) + + (2. * myDecel * gap) + )); assert(vsafe >= 0); return vsafe; } @@ -164,7 +166,7 @@ MSCFModel* MSCFModel_KraussOrig1::duplicate(const MSVehicleType* vtype) const { - return new MSCFModel_KraussOrig1(vtype, myAccel, myDecel, myDawdle, myHeadwayTime); + return new MSCFModel_KraussOrig1(vtype, myAccel, myDecel, myEmergencyDecel, myApparentDecel, myDawdle, myHeadwayTime); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussOrig1.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussOrig1.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussOrig1.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussOrig1.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 28 Jul 2009 -/// @version $Id: MSCFModel_KraussOrig1.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSCFModel_KraussOrig1.h 24108 2017-04-27 18:43:30Z behrisch $ /// // The original Krauss (1998) car-following model and parameter /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,10 +48,13 @@ /** @brief Constructor * @param[in] accel The maximum acceleration * @param[in] decel The maximum deceleration + * @param[in] emergencyDecel The maximum emergency deceleration + * @param[in] apparentDecel The deceleration as expected by others (always equal to decel for the original model) * @param[in] dawdle The driver imperfection * @param[in] tau The driver's reaction time */ - MSCFModel_KraussOrig1(const MSVehicleType* vtype, SUMOReal accel, SUMOReal decel, SUMOReal dawdle, SUMOReal headwayTime); + MSCFModel_KraussOrig1(const MSVehicleType* vtype, double accel, double decel, + double emergencyDecel, double apparentDecel, double dawdle, double headwayTime); /// @brief Destructor @@ -66,7 +69,7 @@ * @param[in] vPos The possible velocity * @return The velocity after applying interactions with stops and lane change model influences */ - SUMOReal moveHelper(MSVehicle* const veh, SUMOReal vPos) const; + double moveHelper(MSVehicle* const veh, double vPos) const; /** @brief Computes the vehicle's safe speed (no dawdling) @@ -77,7 +80,7 @@ * @return EGO's safe speed * @see MSCFModel::ffeV */ - SUMOReal followSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const; + double followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const; /** @brief Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling) @@ -87,7 +90,7 @@ * @see MSCFModel::ffeS * @todo generic Interface, models can call for the values they need */ - virtual SUMOReal stopSpeed(const MSVehicle* const veh, const SUMOReal speed, SUMOReal gap2pred) const; + virtual double stopSpeed(const MSVehicle* const veh, const double speed, double gap2pred) const; /** @brief Computes the vehicle's safe speed (no dawdling) @@ -102,7 +105,7 @@ * @param[in] predSpeed The speed of LEADER * @return EGO's safe speed */ - SUMOReal insertionFollowSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const; + double insertionFollowSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const; /** @brief Returns the model's name @@ -117,7 +120,7 @@ /** @brief Get the driver's imperfection * @return The imperfection of drivers of this class */ - SUMOReal getImperfection() const { + double getImperfection() const { return myDawdle; } /// @} @@ -129,7 +132,7 @@ /** @brief Sets a new value for maximum deceleration [m/s^2] * @param[in] accel The new deceleration in m/s^2 */ - void setMaxDecel(SUMOReal decel) { + void setMaxDecel(double decel) { myDecel = decel; myTauDecel = myDecel * myHeadwayTime; } @@ -138,7 +141,7 @@ /** @brief Sets a new value for driver imperfection * @param[in] accel The new driver imperfection */ - void setImperfection(SUMOReal imperfection) { + void setImperfection(double imperfection) { myDawdle = imperfection; } @@ -146,7 +149,7 @@ /** @brief Sets a new value for driver reaction time [s] * @param[in] headwayTime The new driver reaction time (in s) */ - void setHeadwayTime(SUMOReal headwayTime) { + void setHeadwayTime(double headwayTime) { myHeadwayTime = headwayTime; myTauDecel = myDecel * headwayTime; } @@ -159,28 +162,28 @@ */ virtual MSCFModel* duplicate(const MSVehicleType* vtype) const; -private: +protected: /** @brief Returns the "safe" velocity * @param[in] gap2pred The (netto) distance to the LEADER * @param[in] predSpeed The LEADER's speed * @param[in] predMaxDecel The LEADER's maximum deceleration * @return the safe velocity */ - virtual SUMOReal vsafe(SUMOReal gap, SUMOReal predSpeed, SUMOReal predMaxDecel) const; + virtual double vsafe(double gap, double predSpeed, double predMaxDecel) const; /** @brief Applies driver imperfection (dawdling / sigma) * @param[in] speed The speed with no dawdling * @return The speed after dawdling */ - virtual SUMOReal dawdle(SUMOReal speed) const; + virtual double dawdle(double speed) const; protected: /// @brief The vehicle's dawdle-parameter. 0 for no dawdling, 1 for max. - SUMOReal myDawdle; + double myDawdle; /// @brief The precomputed value for myDecel*myTau - SUMOReal myTauDecel; + double myTauDecel; }; #endif /* MSCFModel_KraussOrig1_H */ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussPS.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussPS.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussPS.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussPS.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Mon, 04 Aug 2009 -/// @version $Id: MSCFModel_KraussPS.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSCFModel_KraussPS.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Krauss car-following model, changing accel and speed by slope /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,28 +41,28 @@ // =========================================================================== // method definitions // =========================================================================== -MSCFModel_KraussPS::MSCFModel_KraussPS(const MSVehicleType* vtype, SUMOReal accel, SUMOReal decel, - SUMOReal dawdle, SUMOReal headwayTime) - : MSCFModel_Krauss(vtype, accel, decel, dawdle, headwayTime) { +MSCFModel_KraussPS::MSCFModel_KraussPS(const MSVehicleType* vtype, double accel, double decel, double emergencyDecel, + double dawdle, double headwayTime) : + MSCFModel_Krauss(vtype, accel, decel, emergencyDecel, decel, dawdle, headwayTime) { } MSCFModel_KraussPS::~MSCFModel_KraussPS() {} -SUMOReal -MSCFModel_KraussPS::maxNextSpeed(SUMOReal speed, const MSVehicle* const veh) const { - const SUMOReal gravity = 9.80665; - const SUMOReal aMax = MAX2(0., getMaxAccel() - gravity * sin(DEG2RAD(veh->getSlope()))); +double +MSCFModel_KraussPS::maxNextSpeed(double speed, const MSVehicle* const veh) const { + const double gravity = 9.80665; + const double aMax = MAX2(0., getMaxAccel() - gravity * sin(DEG2RAD(veh->getSlope()))); // assuming drag force is proportional to the square of speed - const SUMOReal vMax = sqrt(aMax / getMaxAccel()) * myType->getMaxSpeed(); - return MIN2(speed + (SUMOReal) ACCEL2SPEED(aMax), vMax); + const double vMax = sqrt(aMax / getMaxAccel()) * myType->getMaxSpeed(); + return MIN2(speed + (double) ACCEL2SPEED(aMax), vMax); } MSCFModel* MSCFModel_KraussPS::duplicate(const MSVehicleType* vtype) const { - return new MSCFModel_KraussPS(vtype, myAccel, myDecel, myDawdle, myHeadwayTime); + return new MSCFModel_KraussPS(vtype, myAccel, myDecel, myEmergencyDecel, myDawdle, myHeadwayTime); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussPS.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussPS.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussPS.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussPS.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 28 Jul 2009 -/// @version $Id: MSCFModel_KraussPS.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSCFModel_KraussPS.h 23699 2017-03-29 07:16:27Z namdre $ /// // Krauss car-following model, changing accel and speed by slope /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -49,10 +49,11 @@ /** @brief Constructor * @param[in] accel The maximum acceleration * @param[in] decel The maximum deceleration + * @param[in] emergencyDecel The maximum emergency deceleration * @param[in] dawdle The driver imperfection * @param[in] headwayTime The driver's reaction time */ - MSCFModel_KraussPS(const MSVehicleType* vtype, SUMOReal accel, SUMOReal decel, SUMOReal dawdle, SUMOReal headwayTime); + MSCFModel_KraussPS(const MSVehicleType* vtype, double accel, double decel, double emergencyDecel, double dawdle, double headwayTime); /// @brief Destructor @@ -74,7 +75,7 @@ * @param[in] speed The vehicle itself, for obtaining other values * @return The maximum possible speed for the next step */ - SUMOReal maxNextSpeed(SUMOReal speed, const MSVehicle* const veh) const; + double maxNextSpeed(double speed, const MSVehicle* const veh) const; /** @brief Returns the model's name diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussX.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussX.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussX.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussX.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,132 @@ +/****************************************************************************/ +/// @file MSCFModel_KraussX.cpp +/// @author Tobias Mayer +/// @author Daniel Krajzewicz +/// @author Jakob Erdmann +/// @author Michael Behrisch +/// @author Laura Bieker +/// @date Mon, 04 Aug 2009 +/// @version $Id: MSCFModel_KraussX.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +// Krauss car-following model, changing accel and speed by slope +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include "MSCFModel_KraussX.h" + + +#define OVERBRAKING_THRESHOLD -3 + +// =========================================================================== +// method definitions +// =========================================================================== +MSCFModel_KraussX::MSCFModel_KraussX(const MSVehicleType* vtype, double accel, double decel, + double emergencyDecel, double apparentDecel, + double dawdle, double headwayTime, + double tmp1, double tmp2): + MSCFModel_Krauss(vtype, accel, decel, emergencyDecel, apparentDecel, dawdle, headwayTime), + myTmp1(tmp1), + myTmp2(tmp2) { +} + + +MSCFModel_KraussX::~MSCFModel_KraussX() {} + + +MSCFModel* +MSCFModel_KraussX::duplicate(const MSVehicleType* vtype) const { + return new MSCFModel_KraussX(vtype, myAccel, myDecel, myEmergencyDecel, myApparentDecel, myDawdle, myHeadwayTime, myTmp1, myTmp2); +} + + +double +MSCFModel_KraussX::moveHelper(MSVehicle* const veh, double vPos) const { + const double oldV = veh->getSpeed(); // save old v for optional acceleration computation + const double vSafe = MIN2(vPos, veh->processNextStop(vPos)); // process stops + // we need the acceleration for emission computation; + // in this case, we neglect dawdling, nonetheless, using + // vSafe does not incorporate speed reduction due to interaction + // on lane changing + double vMin, vNext; + const double vMax = MIN3(veh->getMaxSpeedOnLane(), maxNextSpeed(oldV, veh), vSafe); + if (MSGlobals::gSemiImplicitEulerUpdate) { + // we do not rely on never braking harder than maxDecel because TraCI or strange cf models may decide to do so + vMin = MIN2(getSpeedAfterMaxDecel(oldV), vMax); + const double vDawdle = dawdleX(oldV, vMin, vMax); + vNext = veh->getLaneChangeModel().patchSpeed(vMin, vDawdle, vMax, *this); + //std::cout << SIMTIME << " veh=" << veh->getID() + // << " vOld=" << oldV << " vPos=" << vPos << " vSafe=" << vSafe + // << " vMax=" << vMax << " vMin=" << vMin << " vDawdle=" << vDawdle << " vNext=" << vNext + // << "\n"; + } else { + // for ballistic update, negative vnext must be allowed to + // indicate a stop within the coming timestep (i.e., to attain negative values) + vMin = MIN2(minNextSpeed(oldV, veh), vMax); + const double vDawdle = dawdleX(oldV, vMin, vMax); + vNext = veh->getLaneChangeModel().patchSpeed(vMin, vDawdle, vMax, *this); + // (Leo) moveHelper() is responsible for assuring that the next + // velocity is chosen in accordance with maximal decelerations. + // At this point vNext may also be negative indicating a stop within next step. + // Moreover, because maximumSafeStopSpeed() does not consider deceleration bounds + // vNext can be a large negative value at this point. We cap vNext here. + vNext = MAX2(vNext, vMin); + } + return vNext; +} + + +double +MSCFModel_KraussX::dawdleX(double vOld, double vMin, double vMax) const { + double speed = vMax; + if (!MSGlobals::gSemiImplicitEulerUpdate) { + // in case of the ballistic update, negative speeds indicate + // a desired stop before the completion of the next timestep. + // We do not allow dawdling to overwrite this indication + if (speed < 0) { + return speed; + } + } + // extra slow to start + if (vOld < myAccel) { + speed -= ACCEL2SPEED(myTmp1 * myAccel); + } + const double random = RandHelper::rand(); + speed -= ACCEL2SPEED(myDawdle * myAccel * random); + speed = MAX2(vMin, speed); + // overbraking + if (vOld > vMax) { + speed -= ACCEL2SPEED(myTmp2 * myAccel * random); + //std::cout << " vMin=" << vMin << " vMax=" << vMax << "speed=" << speed << " d1=" << ACCEL2SPEED(myDawdle * myAccel * random) << " d2=" << ACCEL2SPEED(myTmp2 * myAccel * random) << " unexpectedDecel=" << (speed < vMin) << "\n"; + if (MSGlobals::gSemiImplicitEulerUpdate) { + speed = MAX2(0.0, speed); + } + } + return speed; +} + + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussX.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussX.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussX.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_KraussX.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,111 @@ +/****************************************************************************/ +/// @file MSCFModel_KraussX.h +/// @author Jakob Erdmann +/// @date 27 Feb 2017 +/// @version $Id: MSCFModel_KraussX.h 24108 2017-04-27 18:43:30Z behrisch $ +/// +// Experimental extensions to the Krauss car-following model +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef MSCFModel_KraussX_h +#define MSCFModel_KraussX_h + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include "MSCFModel_Krauss.h" +#include + + +// =========================================================================== +// class definitions +// =========================================================================== +/** @class MSCFModel_KraussX + * @brief Krauss car-following model, changing accel and speed by slope + * @see MSCFModel + * @see MSCFModel_Krauss + */ +class MSCFModel_KraussX : public MSCFModel_Krauss { +public: + /** @brief Constructor + * @param[in] accel The maximum acceleration + * @param[in] decel The maximum deceleration + * @param[in] dawdle The driver imperfection + * @param[in] emergencyDecel The maximum emergency deceleration + * @param[in] apparentDecel The deceleration as expected by others + * @param[in] headwayTime The driver's reaction time + */ + MSCFModel_KraussX(const MSVehicleType* vtype, double accel, double decel, + double emergencyDecel, double apparentDecel, + double dawdle, double headwayTime, + double tmp1, double tmp2); + + + /// @brief Destructor + ~MSCFModel_KraussX(); + + + /// @name Implementations of the MSCFModel interface + /// @{ + /** @brief Applies interaction with stops and lane changing model influences + * @param[in] veh The ego vehicle + * @param[in] vPos The possible velocity + * @return The velocity after applying interactions with stops and lane change model influences + * + * @note: this is the exact duplicate of MSCFModel_KraussOrig1::moveHelper (also used by Krauss) except that dawdle is called with a second paramter + */ + double moveHelper(MSVehicle* const veh, double vPos) const; + + + /** @brief Returns the model's name + * @return The model's name + * @see MSCFModel::getModelName + */ + int getModelID() const { + return SUMO_TAG_CF_KRAUSSX; + } + /// @} + + + /** @brief Duplicates the car-following model + * @param[in] vtype The vehicle type this model belongs to (1:1) + * @return A duplicate of this car-following model + */ + MSCFModel* duplicate(const MSVehicleType* vtype) const; + +private: + + + /** @brief Applies driver imperfection (dawdling / sigma) + * @param[in] vOld The previous speed + * @param[in] vMin The minimum speed (due to braking constraints) + * @param[in] vMax The maximum speed that may be driven (all constraints) + * @return The speed after dawdling + * + */ + double dawdleX(double vOld, double vMin, double vMax) const; + + /// @brief extension parameter nr1 + double myTmp1; + double myTmp2; + +}; + +#endif /* MSCFModel_KraussX_H */ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_PWag2009.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_PWag2009.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_PWag2009.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_PWag2009.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date 03.04.2010 -/// @version $Id: MSCFModel_PWag2009.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: MSCFModel_PWag2009.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Scalable model based on Krauss by Peter Wagner /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,22 +40,25 @@ // =========================================================================== // method definitions // =========================================================================== -MSCFModel_PWag2009::MSCFModel_PWag2009(const MSVehicleType* vtype, SUMOReal accel, SUMOReal decel, - SUMOReal dawdle, SUMOReal headwayTime, SUMOReal tauLast, SUMOReal apProb) - : MSCFModel(vtype, accel, decel, headwayTime), myDawdle(dawdle), - myTauDecel(decel * headwayTime), myDecelDivTau(decel / headwayTime), myTauLastDecel(decel * tauLast), - myActionPointProbability(apProb) { +MSCFModel_PWag2009::MSCFModel_PWag2009(const MSVehicleType* vtype, double accel, double decel, + double emergencyDecel, + double dawdle, double headwayTime, double tauLast, double apProb) : + MSCFModel(vtype, accel, decel, emergencyDecel, decel, headwayTime), myDawdle(dawdle), + myTauDecel(decel * headwayTime), + myDecelDivTau(decel / headwayTime), + myTauLastDecel(decel * tauLast), + myActionPointProbability(apProb) { } MSCFModel_PWag2009::~MSCFModel_PWag2009() {} -SUMOReal -MSCFModel_PWag2009::moveHelper(MSVehicle* const veh, SUMOReal vPos) const { - const SUMOReal vNext = MSCFModel::moveHelper(veh, vPos); +double +MSCFModel_PWag2009::moveHelper(MSVehicle* const veh, double vPos) const { + const double vNext = MSCFModel::moveHelper(veh, vPos); VehicleVariables* vars = (VehicleVariables*)veh->getCarFollowVariables(); - SUMOReal apref = SPEED2ACCEL(vNext - veh->getSpeed()); + double apref = SPEED2ACCEL(vNext - veh->getSpeed()); vars->aOld = apref; return vNext; } @@ -65,78 +68,78 @@ // more careful and set it to something around 0.3 or 0.4, which are among the shortest headways I have // seen so far in data ... -SUMOReal -MSCFModel_PWag2009::followSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap, SUMOReal predSpeed, SUMOReal /*predMaxDecel*/) const { +double +MSCFModel_PWag2009::followSpeed(const MSVehicle* const veh, double speed, double gap, double predSpeed, double /*predMaxDecel*/) const { if (predSpeed == 0 && gap < 0.01) { return 0; } - const SUMOReal vsafe = -myTauLastDecel + sqrt(myTauLastDecel * myTauLastDecel + predSpeed * predSpeed + 2.0 * myDecel * gap); - const SUMOReal asafe = SPEED2ACCEL(vsafe - speed); + const double vsafe = -myTauLastDecel + sqrt(myTauLastDecel * myTauLastDecel + predSpeed * predSpeed + 2.0 * myDecel * gap); + const double asafe = SPEED2ACCEL(vsafe - speed); VehicleVariables* vars = (VehicleVariables*)veh->getCarFollowVariables(); - SUMOReal apref = vars->aOld; + double apref = vars->aOld; if (apref <= asafe && RandHelper::rand() <= myActionPointProbability * TS) { apref = myDecelDivTau * (gap + (predSpeed - speed) * myHeadwayTime - speed * myHeadwayTime) / (speed + myTauDecel); apref = MIN2(apref, myAccel); apref = MAX2(apref, -myDecel); - apref += myDawdle * RandHelper::rand((SUMOReal) - 1., (SUMOReal)1.); + apref += myDawdle * RandHelper::rand((double) - 1., (double)1.); } if (apref > asafe) { apref = asafe; } - return MAX2((SUMOReal)0, speed + ACCEL2SPEED(apref)); + return MAX2(0., speed + ACCEL2SPEED(apref)); } // uses the safe speed and preferred acceleration with the same NORMAL tau to compute stopSpeed -SUMOReal -MSCFModel_PWag2009::stopSpeed(const MSVehicle* const /* veh */, const SUMOReal speed, SUMOReal gap) const { +double +MSCFModel_PWag2009::stopSpeed(const MSVehicle* const /* veh */, const double speed, double gap) const { if (gap < 0.01) { - return 0; + return 0.; } - const SUMOReal vsafe = -myTauDecel + sqrt(myTauDecel * myTauDecel + 2.0 * myDecel * gap); - const SUMOReal asafe = SPEED2ACCEL(vsafe - speed); + const double vsafe = -myTauDecel + sqrt(myTauDecel * myTauDecel + 2.0 * myDecel * gap); + const double asafe = SPEED2ACCEL(vsafe - speed); // VehicleVariables* vars = (VehicleVariables*)veh->getCarFollowVariables(); - SUMOReal apref = myDecelDivTau * (gap - 2 * speed * myHeadwayTime) / (speed + myTauDecel); + double apref = myDecelDivTau * (gap - 2 * speed * myHeadwayTime) / (speed + myTauDecel); if (apref <= asafe) { apref = MIN2(apref, myAccel); apref = MAX2(apref, -myDecel); } else { apref = asafe; } - return MAX2((SUMOReal)0, vsafe + ACCEL2SPEED(apref)); + return MAX2(0., vsafe + ACCEL2SPEED(apref)); } // this method should not do anything, since followSpeed() has taken care of dawdling already... -SUMOReal -MSCFModel_PWag2009::dawdle(SUMOReal speed) const { +double +MSCFModel_PWag2009::dawdle(double speed) const { return speed; -// return MAX2(SUMOReal(0), speed - ACCEL2SPEED(myDawdle * myAccel * RandHelper::rand())); +// return MAX2(0., speed - ACCEL2SPEED(myDawdle * myAccel * RandHelper::rand())); } // eventually, this method isn't needed anymore -//SUMOReal -//MSCFModel_PWag2009::_v(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap, SUMOReal predSpeed) const { +//double +//MSCFModel_PWag2009::_v(const MSVehicle* const veh, double speed, double gap, double predSpeed) const { // if (predSpeed == 0 && gap < 0.01) { // return 0; // } -// const SUMOReal vsafe = -myTauLastDecel + sqrt(myTauLastDecel * myTauLastDecel + predSpeed * predSpeed + 2.0 * myDecel * gap); -// const SUMOReal asafe = SPEED2ACCEL(vsafe - speed); +// const double vsafe = -myTauLastDecel + sqrt(myTauLastDecel * myTauLastDecel + predSpeed * predSpeed + 2.0 * myDecel * gap); +// const double asafe = SPEED2ACCEL(vsafe - speed); // VehicleVariables* vars = (VehicleVariables*)veh->getCarFollowVariables(); -// SUMOReal apref = vars->aOld; +// double apref = vars->aOld; // if (apref <= asafe && RandHelper::rand() <= myActionPointProbability * TS) { // apref = myDecelDivTau * (gap + (predSpeed - speed) * myHeadwayTime - speed * myHeadwayTime) / (speed + myTauDecel); // if (apref>myAccel) // apref = myAccel; // if (apref<-myDecel) // apref = -myDecel; -// apref += myDawdle * RandHelper::rand((SUMOReal) - 1., (SUMOReal)1.); +// apref += myDawdle * RandHelper::rand((double) - 1., (double)1.); // } // if (apref > asafe) // apref = asafe; -// return MAX2((SUMOReal)0, vsafe+ACCEL2SPEED(apref)); +// return MAX2(0, vsafe+ACCEL2SPEED(apref)); //} // MSCFModel* MSCFModel_PWag2009::duplicate(const MSVehicleType* vtype) const { - return new MSCFModel_PWag2009(vtype, myAccel, myDecel, myDawdle, myHeadwayTime, myTauLastDecel / myDecel, myActionPointProbability); + return new MSCFModel_PWag2009(vtype, myAccel, myDecel, myEmergencyDecel, myDawdle, myHeadwayTime, myTauLastDecel / myDecel, myActionPointProbability); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_PWag2009.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_PWag2009.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_PWag2009.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_PWag2009.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 03.04.2010 -/// @version $Id: MSCFModel_PWag2009.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSCFModel_PWag2009.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Scalable model based on Krauss by Peter Wagner /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,11 +47,13 @@ /** @brief Constructor * @param[in] accel The maximum acceleration * @param[in] decel The maximum deceleration + * @param[in] emergencyDecel The maximum emergency deceleration * @param[in] dawdle The driver imperfection * @param[in] tau The driver's reaction time */ - MSCFModel_PWag2009(const MSVehicleType* vtype, SUMOReal accel, SUMOReal decel, SUMOReal dawdle, - SUMOReal headwayTime, SUMOReal tauLast, SUMOReal apProb); + MSCFModel_PWag2009(const MSVehicleType* vtype, double accel, double decel, + double emergencyDecel, double dawdle, + double headwayTime, double tauLast, double apProb); /// @brief Destructor @@ -66,7 +68,7 @@ * @param[in] vPos The possible velocity * @return The velocity after applying interactions with stops and lane change model influences */ - SUMOReal moveHelper(MSVehicle* const veh, SUMOReal vPos) const; + double moveHelper(MSVehicle* const veh, double vPos) const; /** @brief Computes the vehicle's safe speed (no dawdling) @@ -77,7 +79,7 @@ * @return EGO's safe speed * @see MSCFModel::ffeV */ - SUMOReal followSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const; + double followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const; /** @brief Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling) @@ -87,7 +89,7 @@ * @see MSCFModel::ffeS * @todo generic Interface, models can call for the values they need */ - SUMOReal stopSpeed(const MSVehicle* const veh, const SUMOReal speed, SUMOReal gap2pred) const; + double stopSpeed(const MSVehicle* const veh, const double speed, double gap2pred) const; /** @brief Returns the model's name @@ -102,7 +104,7 @@ /** @brief Get the driver's imperfection * @return The imperfection of drivers of this class */ - SUMOReal getImperfection() const { + double getImperfection() const { return myDawdle; } /// @} @@ -126,7 +128,7 @@ private: class VehicleVariables : public MSCFModel::VehicleVariables { public: - SUMOReal aOld; + double aOld; }; /** @brief Returns the next velocity @@ -134,32 +136,32 @@ * @param[in] predSpeed The LEADER's speed * @return the safe velocity */ - SUMOReal _v(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap, SUMOReal predSpeed) const; + double _v(const MSVehicle* const veh, double speed, double gap, double predSpeed) const; /** @brief Applies driver imperfection (dawdling / sigma) * @param[in] speed The speed with no dawdling * @return The speed after dawdling */ - SUMOReal dawdle(SUMOReal speed) const; + double dawdle(double speed) const; private: /// @name model parameter /// @{ /// @brief The vehicle's dawdle-parameter. 0 for no dawdling, 1 for max. - SUMOReal myDawdle; + double myDawdle; /// @brief The precomputed value for myDecel*myTau - SUMOReal myTauDecel; + double myTauDecel; /// @brief The precomputed value for myDecel/myTau - SUMOReal myDecelDivTau; + double myDecelDivTau; /// @brief The precomputed value for (minimum headway time)*myDecel - SUMOReal myTauLastDecel; + double myTauLastDecel; /// @brief The probability for any action - SUMOReal myActionPointProbability; + double myActionPointProbability; /// @} }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Rail.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Rail.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Rail.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Rail.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,249 @@ +/****************************************************************************/ +/// @file MSCFModel_Rail.cpp +/// @author Gregor L\"ammel +/// @date Tue, 08 Feb 2017 +/// @version $Id: MSCFModel_Rail.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include "MSCFModel_Rail.h" + +#define G 9.80665 + +MSCFModel_Rail::MSCFModel_Rail(const MSVehicleType* vtype, std::string trainType) : + MSCFModel(vtype, -1, -1, -1, -1, -1) { + + if (trainType.compare("RB425") == 0) { + myTrainParams = initRB425Params(); + } else if (trainType.compare("RB628") == 0) { + myTrainParams = initRB628Params(); + } else if (trainType.compare("NGT400") == 0) { + myTrainParams = initNGT400Params(); + } else if (trainType.compare("NGT400_16") == 0) { + myTrainParams = initNGT400_16Params(); + } else if (trainType.compare("ICE1") == 0) { + myTrainParams = initICE1Params(); + } else if (trainType.compare("REDosto7") == 0) { + myTrainParams = initREDosto7Params(); + } else if (trainType.compare("Freight") == 0) { + myTrainParams = initFreightParams(); + } else if (trainType.compare("ICE3") == 0) { + myTrainParams = initICE3Params(); + } else { + WRITE_ERROR("Unknown train type: " + trainType + ". Exiting!"); + throw ProcessError(); + } + setMaxDecel(myTrainParams.decl); + +} + +MSCFModel_Rail::~MSCFModel_Rail() { +} + +double MSCFModel_Rail::followSpeed(const MSVehicle* const veh, double speed, double /* gap2pred*/, + double /* predSpeed */, double /* predMaxDecel*/) const { + return maxNextSpeed(speed, veh); +} + +int +MSCFModel_Rail::getModelID() const { + return SUMO_TAG_CF_RAIL; +} + +MSCFModel* +MSCFModel_Rail::duplicate(const MSVehicleType* /* vtype */) const { + /// XXX Fixme + throw ProcessError("not yet implemented"); +} + +double MSCFModel_Rail::maxNextSpeed(double speed, const MSVehicle* const veh) const { + + if (speed >= myTrainParams.vmax) { + return myTrainParams.vmax; + } + + double targetSpeed = myTrainParams.vmax; + + double res = getInterpolatedValueFromLookUpMap(speed, &(myTrainParams.resistance)); // kN + + double slope = veh->getSlope(); + double gr = myTrainParams.weight * G * sin(DEG2RAD(slope)); //kN + + double totalRes = res + gr; //kN + + double trac = getInterpolatedValueFromLookUpMap(speed, &(myTrainParams.traction)); // kN + + double a; + if (speed < targetSpeed) { + a = (trac - totalRes) / myTrainParams.rotWeight; //kN/t == N/kg + } else { + a = 0.; + if (totalRes > trac) { + a = (trac - totalRes) / myTrainParams.rotWeight; //kN/t == N/kg + } + } + + double maxNextSpeed = speed + a * DELTA_T / 1000.; + +// std::cout << veh->getID() << " speed: " << (speed*3.6) << std::endl; + + return maxNextSpeed; +} + +double MSCFModel_Rail::minNextSpeed(double speed, const MSVehicle* const veh) const { + + double slope = veh->getSlope(); + double gr = myTrainParams.weight * G * sin(DEG2RAD(slope)); //kN + double res = getInterpolatedValueFromLookUpMap(speed, &(myTrainParams.resistance)); // kN + double totalRes = res + gr; //kN + + double a = (myTrainParams.decl + totalRes) / myTrainParams.rotWeight; + + return speed - a * DELTA_T / 1000.; + +} + +double MSCFModel_Rail::getInterpolatedValueFromLookUpMap(double speed, const LookUpMap* lookUpMap) const { + std::map::const_iterator low, prev; + low = lookUpMap->lower_bound(speed); + + if (low == lookUpMap->end()) { //speed > max speed + return (lookUpMap->rbegin())->second; + } + + if (low == lookUpMap->begin()) { + return low->second; + } + + prev = low; + --prev; + + double range = low->first - prev->first; + double dist = speed - prev->first; + assert(range > 0); + assert(dist > 0); + + double weight = dist / range; + + double res = (1 - weight) * prev->second + weight * low->second; + + return res; + +} + + + +//void +//MSCFModel_Rail::initVehicleVariables(const MSVehicle *const veh, MSCFModel_Rail::VehicleVariables *pVariables) const { +// +// pVariables->setInitialized(); +// +//} + +double MSCFModel_Rail::getSpeedAfterMaxDecel(double /* speed */) const { + +// //TODO: slope not known here +// double gr = 0; //trainParams.weight * 9.81 * edge.grade +// +// double a = 0;//trainParams.decl - gr/trainParams.rotWeight; +// +// return speed + a * DELTA_T / 1000.; + WRITE_ERROR("function call not allowd for rail model. Exiting!"); + throw ProcessError(); +} + +MSCFModel::VehicleVariables* MSCFModel_Rail::createVehicleVariables() const { + VehicleVariables* ret = new VehicleVariables(); + return ret; +} + +//mostly c 'n p from MSCFModel +double MSCFModel_Rail::moveHelper(MSVehicle* const veh, double vPos) const { + const double oldV = veh->getSpeed(); // save old v for optional acceleration computation + const double vSafe = MIN2(vPos, veh->processNextStop(vPos)); // process stops + // we need the acceleration for emission computation; + // in this case, we neglect dawdling, nonetheless, using + // vSafe does not incorporate speed reduction due to interaction + // on lane changing + double vMin, vNext; + const double vMax = MIN3(veh->getMaxSpeedOnLane(), maxNextSpeed(oldV, veh), vSafe); + if (MSGlobals::gSemiImplicitEulerUpdate) { + // we cannot rely on never braking harder than maxDecel because TraCI or strange cf models may decide to do so + vMin = MIN2(minNextSpeed(oldV, veh), vMax); + vNext = veh->getLaneChangeModel().patchSpeed(vMin, vMax, vMax, *this); + } else { + // for ballistic update, negative vnext must be allowed to + // indicate a stop within the coming timestep (i.e., to attain negative values) + vMin = MIN2(minNextSpeed(oldV, veh), vMax); + vNext = veh->getLaneChangeModel().patchSpeed(vMin, vMax, vMax, *this); + // (Leo) moveHelper() is responsible for assuring that the next + // velocity is chosen in accordance with maximal decelerations. + // At this point vNext may also be negative indicating a stop within next step. + // Moreover, because maximumSafeStopSpeed() does not consider deceleration bounds + // vNext can be a large negative value at this point. We cap vNext here. + vNext = MAX2(vNext, vMin); + } + + return vNext; +} + +double MSCFModel_Rail::freeSpeed(const MSVehicle* const /* veh */, double /* speed */, double dist, double targetSpeed, + const bool onInsertion) const { + +// MSCFModel_Rail::VehicleVariables *vars = (MSCFModel_Rail::VehicleVariables *) veh->getCarFollowVariables(); +// if (vars->isNotYetInitialized()) { +// initVehicleVariables(veh, vars); +// } + + //TODO: signals, coasting, ... + + if (MSGlobals::gSemiImplicitEulerUpdate) { + // adapt speed to succeeding lane, no reaction time is involved + // when breaking for y steps the following distance g is covered + // (drive with v in the final step) + // g = (y^2 + y) * 0.5 * b + y * v + // y = ((((sqrt((b + 2.0*v)*(b + 2.0*v) + 8.0*b*g)) - b)*0.5 - v)/b) + const double v = SPEED2DIST(targetSpeed); + if (dist < v) { + return targetSpeed; + } + const double b = ACCEL2DIST(myDecel); + const double y = MAX2(0.0, ((sqrt((b + 2.0 * v) * (b + 2.0 * v) + 8.0 * b * dist) - b) * 0.5 - v) / b); + const double yFull = floor(y); + const double exactGap = (yFull * yFull + yFull) * 0.5 * b + yFull * v + (y > yFull ? v : 0.0); + const double fullSpeedGain = (yFull + (onInsertion ? 1. : 0.)) * ACCEL2SPEED(myTrainParams.decl); + return DIST2SPEED(MAX2(0.0, dist - exactGap) / (yFull + 1)) + fullSpeedGain + targetSpeed; + } else { + WRITE_ERROR("Anything else then semi implicit euler update is not yet implemented. Exiting!"); + throw ProcessError(); + } +} + +double MSCFModel_Rail::stopSpeed(const MSVehicle* const veh, const double speed, double gap) const { + return MIN2(maximumSafeStopSpeed(gap, speed, false, TS), maxNextSpeed(speed, veh)); +} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Rail.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Rail.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Rail.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Rail.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,736 @@ +/****************************************************************************/ +/// @file MSCFModel_Rail.h +/// @author Gregor L\"ammel +/// @date Tue, 08 Feb 2017 +/// @version $Id: MSCFModel_Rail.h 24108 2017-04-27 18:43:30Z behrisch $ +/// +// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef SUMO_MSCFMODEL_RAIL_H +#define SUMO_MSCFMODEL_RAIL_H + + +#include "MSCFModel.h" + + + +class MSCFModel_Rail : public MSCFModel { + +public: + + double followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, + double predMaxDecel) const; + + virtual int getModelID() const; + + virtual MSCFModel* duplicate(const MSVehicleType* vtype) const; + + /** @brief Constructor + * @param[in] trainType The train type + */ + MSCFModel_Rail(const MSVehicleType* vtype, std::string trainType); + + + virtual ~MSCFModel_Rail(); + + virtual double maxNextSpeed(double speed, const MSVehicle* const veh) const; + + virtual double minNextSpeed(double speed, const MSVehicle* const veh) const; + + double getSpeedAfterMaxDecel(double v) const; + + MSCFModel::VehicleVariables* createVehicleVariables() const; + + double moveHelper(MSVehicle* const veh, double vPos) const; + + double freeSpeed(const MSVehicle* const veh, double speed, double seen, double maxSpeed, + const bool onInsertion) const; + +private: + + + typedef std::map LookUpMap; + + struct TrainParams { + double weight; + double mf; + double length; + double decl; + double vmax; + double recovery; + double rotWeight; + LookUpMap traction; + LookUpMap resistance; + }; + + double getInterpolatedValueFromLookUpMap(double speed, const LookUpMap* lookUpMap) const; + + +public: + double stopSpeed(const MSVehicle* const veh, const double speed, double gap) const; + +// class VehicleVariables : public MSCFModel::VehicleVariables { +// +// public: +// +// const std::string getTrainType() const { return myTrainType; }; +// +// void setTrainType(std::string trainType) { myTrainType = trainType; } +// +// bool isNotYetInitialized() { +// return notYetInitialized; +// } +// +// void setInitialized() { +// notYetInitialized = false; +// } +// +// private: +// std::string myTrainType; +// bool notYetInitialized = true; +// +// +// }; + +private: + + + TrainParams myTrainParams; + + LookUpMap initNGT400Traction() const { // early version of NGT 400 + LookUpMap map; + map[0] = 716.0; + map[10] = 700.0; + map[20] = 684.0; + map[30] = 669.0; + map[40] = 653.0; + map[50] = 637.0; + map[60] = 622.0; + map[70] = 606.0; + map[80] = 590.0; + map[90] = 574.0; + map[100] = 559.0; + map[110] = 543.0; + map[120] = 527.0; + map[130] = 507.0; + map[140] = 471.0; + map[150] = 439.0; + map[160] = 412.0; + map[170] = 388.0; + map[180] = 366.0; + map[190] = 347.0; + map[200] = 329.0; + map[210] = 314.0; + map[220] = 299.0; + map[230] = 286.0; + map[240] = 275.0; + map[250] = 264.0; + map[260] = 253.0; + map[270] = 244.0; + map[280] = 235.0; + map[290] = 227.0; + map[300] = 220.0; + map[310] = 213.0; + map[320] = 206.0; + map[330] = 200.0; + map[340] = 194.0; + map[350] = 188.0; + map[360] = 183.0; + map[370] = 178.0; + map[380] = 173.0; + map[390] = 169.0; + map[400] = 165.0; + map[410] = 160.6; + map[420] = 156.8; + map[430] = 153.2; + map[440] = 149.7; + map[450] = 146.4; + map[460] = 143.2; + map[470] = 140.1; + map[480] = 137.2; + return map; + } + + LookUpMap initNGT400Resistance() const { // early version of NGT 400 + LookUpMap map; + map[0] = 1.9; + map[10] = 2.1; + map[20] = 2.4; + map[30] = 2.9; + map[40] = 3.5; + map[50] = 4.2; + map[60] = 5.0; + map[70] = 6.0; + map[80] = 7.0; + map[90] = 8.2; + map[100] = 9.6; + map[110] = 11.0; + map[120] = 12.6; + map[130] = 14.3; + map[140] = 16.1; + map[150] = 18.0; + map[160] = 20.1; + map[170] = 22.3; + map[180] = 24.6; + map[190] = 27.0; + map[200] = 29.5; + map[210] = 32.2; + map[220] = 35.0; + map[230] = 37.9; + map[240] = 40.9; + map[250] = 44.1; + map[260] = 47.4; + map[270] = 50.8; + map[280] = 54.3; + map[290] = 58.0; + map[300] = 61.7; + map[310] = 65.6; + map[320] = 69.7; + map[330] = 73.8; + map[340] = 78.1; + map[350] = 82.4; + map[360] = 86.9; + map[370] = 91.6; + map[380] = 96.3; + map[390] = 101.2; + map[400] = 106.2; + map[410] = 111.3; + map[420] = 116.6; + map[430] = 121.9; + map[440] = 127.4; + map[450] = 133.0; + map[460] = 138.7; + map[470] = 144.6; + map[480] = 150.6; + return map; + } + + TrainParams initNGT400Params() const { + TrainParams params; + params.weight = 384; + params.mf = 1.04; + params.length = 200; + params.decl = 0.9; + params.vmax = 500 / 3.6; + params.recovery = 0.6; + params.rotWeight = params.weight * params.mf; + params.traction = initNGT400Traction(); + params.resistance = initNGT400Resistance(); + return params; + } + + LookUpMap initNGT400_16Traction() const { + LookUpMap map; + map[0] = 274.5; + map[10] = 274.5; + map[20] = 274.5; + map[30] = 274.5; + map[40] = 274.5; + map[50] = 274.5; + map[60] = 274.5; + map[70] = 274.5; + map[80] = 274.5; + map[90] = 274.5; + map[100] = 274.5; + map[110] = 274.5; + map[120] = 274.5; + map[130] = 274.5; + map[140] = 274.5; + map[150] = 274.5; + map[160] = 274.5; + map[170] = 274.5; + map[180] = 274.5; + map[190] = 274.5; + map[200] = 274.5; + map[210] = 273; + map[220] = 262.3; + map[230] = 250; + map[240] = 239; + map[250] = 229; + map[260] = 222; + map[270] = 213; + map[280] = 205; + map[290] = 198; + map[300] = 191; + map[310] = 186; + map[320] = 180; + map[330] = 174; + map[340] = 169; + map[350] = 165; + map[360] = 160; + map[370] = 155.5; + map[380] = 151; + map[390] = 148; + map[400] = 144; + map[410] = 140; + map[420] = 136; + map[430] = 134; + map[440] = 131; + map[450] = 128; + map[460] = 125; + map[470] = 123; + return map; + } + + LookUpMap initNGT400_16Resistance() const { + LookUpMap map; + map[0] = 5.71; + map[10] = 6.01; + map[20] = 6.4; + map[30] = 7.0; + map[40] = 7.51; + map[50] = 8.34; + map[60] = 9.2; + map[70] = 10.4; + map[80] = 11.3; + map[90] = 12.58; + map[100] = 14.05; + map[110] = 15.5; + map[120] = 16.9; + map[130] = 18.75; + map[140] = 20.77; + map[150] = 22.9; + map[160] = 25.0; + map[170] = 26.9; + map[180] = 29.38; + map[190] = 32.0; + map[200] = 34.5; + map[210] = 37.0; + map[220] = 39.91; + map[230] = 43.11; + map[240] = 46.4; + map[250] = 49.3; + map[260] = 52.4; + map[270] = 56.09; + map[280] = 59.8; + map[290] = 63.7; + map[300] = 66.8; + map[310] = 71.0; + map[320] = 75.39; + map[330] = 79.9; + map[340] = 84.1; + map[350] = 87.9; + map[360] = 92.7; + map[370] = 97.6; + map[380] = 102.0; + map[390] = 107.0; + map[400] = 112.0; + map[410] = 117.5; + map[420] = 123.0; + map[430] = 128.3; + map[440] = 133.3; + map[450] = 139.2; + map[460] = 145.5; + map[470] = 150.0; + return map; + } + + TrainParams initNGT400_16Params() const { + TrainParams params; + params.weight = 384; + params.mf = 1.04; + params.length = 200; + params.decl = 0.9; + params.vmax = 430 / 3.6; + params.recovery = 0.6; + params.rotWeight = params.weight * params.mf; + params.traction = initNGT400_16Traction(); + params.resistance = initNGT400_16Resistance(); + return params; + } + + LookUpMap initICE1Traction() const { + LookUpMap map; + map[0] = 400; + map[10] = 394; + map[20] = 388; + map[30] = 382; + map[40] = 377; + map[50] = 372; + map[60] = 369; + map[70] = 366; + map[80] = 363; + map[90] = 361; + map[100] = 349; + map[110] = 317; + map[120] = 290; + map[130] = 268; + map[140] = 249; + map[150] = 232; + map[160] = 217; + map[170] = 205; + map[180] = 193; + map[190] = 183; + map[200] = 174; + map[210] = 165; + map[220] = 158; + map[230] = 151; + map[240] = 145; + map[250] = 139; + return map; + } + + LookUpMap initICE1Resistance() const { + LookUpMap map; + map[0] = 10.7; + map[10] = 12.3; + map[20] = 14.2; + map[30] = 16.4; + map[40] = 18.7; + map[50] = 21.3; + map[60] = 24.2; + map[70] = 27.3; + map[80] = 30.6; + map[90] = 34.1; + map[100] = 37.9; + map[110] = 41.9; + map[120] = 46.2; + map[130] = 50.6; + map[140] = 55.4; + map[150] = 60.4; + map[160] = 65.6; + map[170] = 71.1; + map[180] = 76.7; + map[190] = 82.6; + map[200] = 88.8; + map[210] = 95.2; + map[220] = 101.8; + map[230] = 108.7; + map[240] = 115.8; + map[250] = 123.1; + return map; + } + + TrainParams initICE1Params() const { + TrainParams params; + params.weight = 876; + params.mf = 1.1; + params.length = 358; + params.decl = 0.5; + params.vmax = 250 / 3.6; + params.recovery = 0.1; + params.rotWeight = params.weight * params.mf; + params.traction = initICE1Traction(); + params.resistance = initICE1Resistance(); + return params; + } + + TrainParams initICE3Params() const { + TrainParams params; + params.weight = 420; + params.mf = 1.04; + params.length = 200; + params.decl = 0.5; + params.vmax = 300 / 3.6; + params.recovery = 0.6; + params.rotWeight = params.weight * params.mf; + params.traction = initICE3Traction(); + params.resistance = initICE3Resistance(); + return params; + } + + LookUpMap initICE3Traction() const { + LookUpMap map; + map[0] = 300; + map[10] = 298; + map[20] = 297; + map[30] = 295; + map[40] = 293; + map[50] = 292; + map[60] = 290; + map[70] = 288; + map[80] = 286.5; + map[90] = 285; + map[100] = 283; + map[110] = 262; + map[120] = 240; + map[130] = 221; + map[140] = 206; + map[150] = 192; + map[160] = 180; + map[170] = 169; + map[180] = 160; + map[190] = 152; + map[200] = 144; + map[210] = 137; + map[220] = 131; + map[230] = 125; + map[240] = 120; + map[250] = 115; + map[260] = 111; + map[270] = 107; + map[280] = 103; + map[290] = 99; + map[300] = 96; + return map; + } + + LookUpMap initICE3Resistance() const { + LookUpMap map; + map[0] = 7.4; + map[10] = 7.6; + map[20] = 8.0; + map[30] = 8.4; + map[40] = 9.1; + map[50] = 9.8; + map[60] = 10.7; + map[70] = 11.7; + map[80] = 12.8; + map[90] = 14.1; + map[100] = 15.5; + map[110] = 17.1; + map[120] = 18.8; + map[130] = 20.6; + map[140] = 22.6; + map[150] = 24.6; + map[160] = 26.9; + map[170] = 29.2; + map[180] = 31.7; + map[190] = 34.3; + map[200] = 37.1; + map[210] = 40.0; + map[220] = 43.1; + map[230] = 46.2; + map[240] = 49.6; + map[250] = 53.0; + map[260] = 56.6; + map[270] = 60.3; + map[280] = 64.1; + map[290] = 68.1; + map[300] = 71.8; + return map; + } + + TrainParams initREDosto7Params() const { + TrainParams params; + params.weight = 425.5; + params.mf = 1.1; + params.length = 207; + params.decl = 0.5; + params.vmax = 160 / 3.6; + params.recovery = 0.1; + params.rotWeight = params.weight * params.mf; + params.traction = initREDosto7Traction(); + params.resistance = initREDosto7Resistance(); + return params; + } + + LookUpMap initREDosto7Traction() const { + LookUpMap map; + map[0] = 300; + map[10] = 300; + map[20] = 300; + map[30] = 300; + map[40] = 300; + map[50] = 300; + map[60] = 300; + map[70] = 289; + map[80] = 253; + map[90] = 224; + map[100] = 202; + map[110] = 183; + map[120] = 168; + map[130] = 155; + map[140] = 144; + map[150] = 134; + map[160] = 125; + return map; + } + + LookUpMap initREDosto7Resistance() const { + LookUpMap map; + map[0] = 8.5; + map[10] = 8.9; + map[20] = 9.5; + map[30] = 10.4; + map[40] = 11.4; + map[50] = 12.7; + map[60] = 14.1; + map[70] = 15.8; + map[80] = 17.7; + map[90] = 19.8; + map[100] = 22.6; + map[110] = 24.6; + map[120] = 27.3; + map[130] = 30.2; + map[140] = 33.3; + map[150] = 36.6; + map[160] = 40.2; + return map; + } + + TrainParams initRB628Params() const { + TrainParams params; + params.weight = 72.2; + params.mf = 1.04; + params.length = 46; + params.decl = 0.5; + params.vmax = 120 / 3.6; + params.recovery = 0; + params.rotWeight = params.weight * params.mf; + params.traction = initRB628Traction(); + params.resistance = initRB628Resistance(); + return params; + } + + LookUpMap initRB628Traction() const { + LookUpMap map; + map[0] = 60; + map[10] = 53.8; + map[20] = 47.6; + map[30] = 36.9; + map[40] = 28.7; + map[50] = 23.5; + map[60] = 20.0; + map[70] = 17.5; + map[80] = 15.2; + map[90] = 13.9; + map[100] = 12.8; + map[110] = 11.7; + map[120] = 10.8; + return map; + } + + LookUpMap initRB628Resistance() const { + LookUpMap map; + map[0] = 1.29; + map[10] = 1.46; + map[20] = 1.73; + map[30] = 2.08; + map[40] = 2.52; + map[50] = 3.05; + map[60] = 3.66; + map[70] = 4.36; + map[80] = 5.16; + map[90] = 6.03; + map[100] = 7.00; + map[110] = 8.06; + map[120] = 9.2; + return map; + } + + TrainParams initFreightParams() const { + TrainParams params; + params.weight = 1440; + params.mf = 1.06; + params.length = 512; + params.decl = 0.3; + params.vmax = 120 / 3.6; + params.recovery = 0.05; + params.rotWeight = params.weight * params.mf; + params.traction = initFreightTraction(); + params.resistance = initFreightResistance(); + return params; + } + + LookUpMap initFreightTraction() const { + LookUpMap map; + map[0] = 300; + map[10] = 296; + map[20] = 293; + map[30] = 289; + map[40] = 286; + map[50] = 282; + map[60] = 279; + map[70] = 275; + map[80] = 272; + map[90] = 255; + map[100] = 230; + map[110] = 209; + map[120] = 190;//guessed value + return map; + } + + LookUpMap initFreightResistance() const { + LookUpMap map; + map[0] = 1.9; + map[10] = 4.3; + map[20] = 8.5; + map[30] = 14.3; + map[40] = 21.7; + map[50] = 30.8; + map[60] = 41.5; + map[70] = 53.8; + map[80] = 67.8; + map[90] = 83.5; + map[100] = 110.7; + map[110] = 119.6; + map[120] = 140.2; + return map; + } + + LookUpMap initRB425Traction() const { + LookUpMap map; + map[0] = 150; + map[10] = 150; + map[20] = 150; + map[30] = 150; + map[40] = 150; + map[50] = 150; + map[60] = 140; + map[70] = 120; + map[80] = 105; + map[90] = 93; + map[100] = 84; + map[110] = 75; + map[120] = 70; + map[130] = 56; + map[140] = 52; + map[150] = 46; + map[160] = 40; + return map; + } + + LookUpMap initRB425Resistance() const { + LookUpMap map; + map[0] = 2.6; + map[10] = 2.9; + map[20] = 3.3; + map[30] = 3.7; + map[40] = 4.3; + map[50] = 4.9; + map[60] = 5.7; + map[70] = 6.6; + map[80] = 7.5; + map[90] = 8.6; + map[100] = 9.7; + map[110] = 11.0; + map[120] = 12.3; + map[130] = 13.8; + map[140] = 15.3; + map[150] = 16.9; + map[160] = 18.7; + return map; + } + + TrainParams initRB425Params() const { + TrainParams params; + params.weight = 138; + params.mf = 1.04; + params.length = 67.5; + params.decl = 1.0; + params.vmax = 160 / 3.6; + params.recovery = 0.6; + params.rotWeight = params.weight * params.mf; + params.traction = initRB425Traction(); + params.resistance = initRB425Resistance(); + return params; + } + +// void initVehicleVariables(const MSVehicle *const pVehicle, MSCFModel_Rail::VehicleVariables *pVariables)const; + +}; + + +#endif //SUMO_MSCFMODEL_RAIL_H diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_SmartSK.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_SmartSK.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_SmartSK.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_SmartSK.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Peter Wagner /// @date Tue, 05 Jun 2012 -/// @version $Id: MSCFModel_SmartSK.cpp 21058 2016-06-29 09:25:01Z behrisch $ +/// @version $Id: MSCFModel_SmartSK.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A smarter SK /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,19 +43,19 @@ // =========================================================================== // method definitions // =========================================================================== -MSCFModel_SmartSK::MSCFModel_SmartSK(const MSVehicleType* vtype, SUMOReal accel, SUMOReal decel, - SUMOReal dawdle, SUMOReal headwayTime, - SUMOReal tmp1, SUMOReal tmp2, SUMOReal tmp3, SUMOReal tmp4, SUMOReal tmp5) +MSCFModel_SmartSK::MSCFModel_SmartSK(const MSVehicleType* vtype, double accel, double decel, double emergencyDecel, + double dawdle, double headwayTime, + double tmp1, double tmp2, double tmp3, double tmp4, double tmp5) // check whether setting these variables here with default values is ''good'' SUMO design -// SUMOReal tmp1=0.0, SUMOReal tmp2=5.0, SUMOReal tmp3=0.0, SUMOReal tmp4, SUMOReal tmp5) - : MSCFModel(vtype, accel, decel, headwayTime), myDawdle(dawdle), myTauDecel(decel * headwayTime), +// double tmp1=0.0, double tmp2=5.0, double tmp3=0.0, double tmp4, double tmp5) + : MSCFModel(vtype, accel, decel, emergencyDecel, decel, headwayTime), myDawdle(dawdle), myTauDecel(decel * headwayTime), myTmp1(tmp1), myTmp2(tmp2), myTmp3(tmp3), myTmp4(tmp4), myTmp5(tmp5) { // the variable tmp1 is the acceleration delay time, e.g. two seconds (or something like this). // for use in the upate process, a rule like if (v 5.0) { myS2Sspeed = 5.0; } -// SUMOReal maxDeltaGap = -0.5*ACCEL2DIST(myDecel + myAccel); +// double maxDeltaGap = -0.5*ACCEL2DIST(myDecel + myAccel); maxDeltaGap = -0.5 * (myDecel + myAccel) * TS * TS; #ifdef SmartSK_DEBUG std::cout << "# maxDeltaGap = " << maxDeltaGap << std::endl; @@ -76,16 +76,16 @@ MSCFModel_SmartSK::~MSCFModel_SmartSK() {} -SUMOReal -MSCFModel_SmartSK::moveHelper(MSVehicle* const veh, SUMOReal vPos) const { - const SUMOReal oldV = veh->getSpeed(); // save old v for optional acceleration computation - const SUMOReal vSafe = MIN2(vPos, veh->processNextStop(vPos)); // process stops +double +MSCFModel_SmartSK::moveHelper(MSVehicle* const veh, double vPos) const { + const double oldV = veh->getSpeed(); // save old v for optional acceleration computation + const double vSafe = MIN2(vPos, veh->processNextStop(vPos)); // process stops // we need the acceleration for emission computation; // in this case, we neglect dawdling, nonetheless, using // vSafe does not incorporate speed reduction due to interaction // on lane changing - const SUMOReal vMin = getSpeedAfterMaxDecel(oldV); - const SUMOReal vMax = MIN3(veh->getLane()->getVehicleMaxSpeed(veh), maxNextSpeed(oldV, veh), vSafe); + const double vMin = getSpeedAfterMaxDecel(oldV); + const double vMax = MIN3(veh->getLane()->getVehicleMaxSpeed(veh), maxNextSpeed(oldV, veh), vSafe); #ifdef SmartSK_DEBUG if (vMin > vMax) { WRITE_WARNING("Maximum speed of vehicle '" + veh->getID() + "' is lower than the minimum speed (min: " + toString(vMin) + ", max: " + toString(vMax) + ")."); @@ -96,7 +96,7 @@ #ifdef SmartSK_DEBUG if (vars->ggOld.size() > 1) { std::cout << "# more than one entry in ggOld list. Speed is " << vPos << ", corresponding dist is " << vars->ggOld[(int) vPos] << "\n"; - for (std::map::iterator I = vars->ggOld.begin(); I != vars->ggOld.end(); I++) { + for (std::map::iterator I = vars->ggOld.begin(); I != vars->ggOld.end(); I++) { std::cout << "# " << (*I).first << ' ' << (*I).second << std::endl; } } @@ -107,38 +107,38 @@ return veh->getLaneChangeModel().patchSpeed(vMin, MAX2(vMin, dawdle(vMax)), vMax, *this); } -SUMOReal -MSCFModel_SmartSK::followSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap, SUMOReal predSpeed, SUMOReal /*predMaxDecel*/) const { +double +MSCFModel_SmartSK::followSpeed(const MSVehicle* const veh, double speed, double gap, double predSpeed, double /*predMaxDecel*/) const { SSKVehicleVariables* vars = (SSKVehicleVariables*)veh->getCarFollowVariables(); // if (((gap - vars->gOld) < maxDeltaGap) && (speed>=5.0) && gap>=5.0) { if ((gap - vars->gOld) < maxDeltaGap) { - SUMOReal tTauTest = gap / speed; + double tTauTest = gap / speed; // allow headway only to decrease only, never to increase. Increase is handled automatically by the headway dynamics in moveHelper()!!! if ((tTauTest < vars->myHeadway) && (tTauTest > TS)) { vars->myHeadway = tTauTest; } } - SUMOReal vsafe = _vsafe(veh, gap, predSpeed); + double vsafe = _vsafe(veh, gap, predSpeed); if ((speed <= 0.0) && (vsafe < myS2Sspeed)) { vsafe = 0; } - SUMOReal vNew = MAX2(getSpeedAfterMaxDecel(speed), MIN2(vsafe, maxNextSpeed(speed, veh))); + double vNew = MAX2(getSpeedAfterMaxDecel(speed), MIN2(vsafe, maxNextSpeed(speed, veh))); // there must be a better place to do the following assignment!!! vars->gOld = gap; vars->ggOld[(int)vNew] = gap; return vNew; } -SUMOReal -MSCFModel_SmartSK::stopSpeed(const MSVehicle* const veh, const SUMOReal speed, SUMOReal gap) const { +double +MSCFModel_SmartSK::stopSpeed(const MSVehicle* const veh, const double speed, double gap) const { SSKVehicleVariables* vars = (SSKVehicleVariables*)veh->getCarFollowVariables(); // if (((gap - vars->gOld) < maxDeltaGap) && (speed>=5.0) && gap>=5.0) { if ((gap - vars->gOld) < maxDeltaGap) { - SUMOReal tTauTest = gap / speed; + double tTauTest = gap / speed; // allow headway only to decrease only, never to increase. Increase is handled automatically by the headway dynamics in moveHelper()!!! if ((tTauTest < vars->myHeadway) && (tTauTest > TS)) { vars->myHeadway = tTauTest; @@ -149,27 +149,27 @@ } -SUMOReal -MSCFModel_SmartSK::dawdle(SUMOReal speed) const { - return MAX2(SUMOReal(0), speed - ACCEL2SPEED(myDawdle * myAccel * RandHelper::rand())); +double +MSCFModel_SmartSK::dawdle(double speed) const { + return MAX2(0., speed - ACCEL2SPEED(myDawdle * myAccel * RandHelper::rand())); } /** Returns the SK-vsafe. */ -SUMOReal MSCFModel_SmartSK::_vsafe(const MSVehicle* const veh, SUMOReal gap, SUMOReal predSpeed) const { +double MSCFModel_SmartSK::_vsafe(const MSVehicle* const veh, double gap, double predSpeed) const { if (predSpeed == 0 && gap < 0.01) { return 0; } SSKVehicleVariables* vars = (SSKVehicleVariables*)veh->getCarFollowVariables(); // this is the most obvious change to the normal SK: the model uses the variable vars->myHeadway instead of the constant // myHeadwayTime as the "reaction time" tau - SUMOReal bTau = myDecel * (vars->myHeadway); - SUMOReal vsafe = (SUMOReal)(-1. * bTau - + sqrt( - bTau * bTau - + (predSpeed * predSpeed) - + (2. * myDecel * gap) - )); + double bTau = myDecel * (vars->myHeadway); + double vsafe = (double)(-1. * bTau + + sqrt( + bTau * bTau + + (predSpeed * predSpeed) + + (2. * myDecel * gap) + )); assert(vsafe >= 0); return vsafe; } @@ -177,6 +177,6 @@ MSCFModel* MSCFModel_SmartSK::duplicate(const MSVehicleType* vtype) const { - return new MSCFModel_SmartSK(vtype, myAccel, myDecel, myDawdle, myHeadwayTime, + return new MSCFModel_SmartSK(vtype, myAccel, myDecel, myEmergencyDecel, myDawdle, myHeadwayTime, myTmp1, myTmp2, myTmp3, myTmp4, myTmp5); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_SmartSK.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_SmartSK.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_SmartSK.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_SmartSK.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Peter Wagner /// @date Tue, 05 Jun 2012 -/// @version $Id: MSCFModel_SmartSK.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSCFModel_SmartSK.h 23699 2017-03-29 07:16:27Z namdre $ /// // A smarter SK /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,11 +47,12 @@ /** @brief Constructor * @param[in] accel The maximum acceleration * @param[in] decel The maximum deceleration + * @param[in] emergencyDecel The maximum emergency deceleration * @param[in] dawdle The driver imperfection * @param[in] tau The driver's reaction time */ - MSCFModel_SmartSK(const MSVehicleType* vtype, SUMOReal accel, SUMOReal decel, SUMOReal dawdle, SUMOReal headwayTime, - SUMOReal tmp1, SUMOReal tmp2, SUMOReal tmp3, SUMOReal tmp4, SUMOReal tmp5); + MSCFModel_SmartSK(const MSVehicleType* vtype, double accel, double decel, double emergencyDecel, double dawdle, double headwayTime, + double tmp1, double tmp2, double tmp3, double tmp4, double tmp5); /// @brief Destructor @@ -66,7 +67,7 @@ * @param[in] vPos The possible velocity * @return The velocity after applying interactions with stops and lane change model influences */ - SUMOReal moveHelper(MSVehicle* const veh, SUMOReal vPos) const; + double moveHelper(MSVehicle* const veh, double vPos) const; /** @brief Computes the vehicle's safe speed (no dawdling) @@ -77,7 +78,7 @@ * @return EGO's safe speed * @see MSCFModel::ffeV */ - virtual SUMOReal followSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const; + virtual double followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const; /** @brief Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling) @@ -87,7 +88,7 @@ * @see MSCFModel::ffeS * @todo generic Interface, models can call for the values they need */ - virtual SUMOReal stopSpeed(const MSVehicle* const veh, const SUMOReal speed, SUMOReal gap2pred) const; + virtual double stopSpeed(const MSVehicle* const veh, const double speed, double gap2pred) const; /** @brief Returns the model's name @@ -102,7 +103,7 @@ /** @brief Get the driver's imperfection * @return The imperfection of drivers of this class */ - SUMOReal getImperfection() const { + double getImperfection() const { return myDawdle; } /// @} @@ -114,7 +115,7 @@ /** @brief Sets a new value for maximum deceleration [m/s^2] * @param[in] accel The new deceleration in m/s^2 */ - void setMaxDecel(SUMOReal decel) { + void setMaxDecel(double decel) { myDecel = decel; myTauDecel = myDecel * myHeadwayTime; } @@ -123,7 +124,7 @@ /** @brief Sets a new value for driver imperfection * @param[in] accel The new driver imperfection */ - void setImperfection(SUMOReal imperfection) { + void setImperfection(double imperfection) { myDawdle = imperfection; } @@ -131,7 +132,7 @@ /** @brief Sets a new value for driver reaction time [s] * @param[in] headwayTime The new driver reaction time (in s) */ - void setHeadwayTime(SUMOReal headwayTime) { + void setHeadwayTime(double headwayTime) { myHeadwayTime = headwayTime; myTauDecel = myDecel * headwayTime; } @@ -150,20 +151,20 @@ * @param[in] predSpeed The LEADER's speed * @return the safe velocity */ - virtual SUMOReal _vsafe(const MSVehicle* const veh, SUMOReal gap, SUMOReal predSpeed) const; + virtual double _vsafe(const MSVehicle* const veh, double gap, double predSpeed) const; /** @brief Applies driver imperfection (dawdling / sigma) * @param[in] speed The speed with no dawdling * @return The speed after dawdling */ - virtual SUMOReal dawdle(SUMOReal speed) const; + virtual double dawdle(double speed) const; virtual void updateMyHeadway(const MSVehicle* const veh) const { // this is the point were the preferred headway changes slowly: SSKVehicleVariables* vars = (SSKVehicleVariables*)veh->getCarFollowVariables(); - SUMOReal tTau = vars->myHeadway; - tTau = tTau + (myHeadwayTime - tTau) * myTmp2 + myTmp3 * tTau * RandHelper::rand(SUMOReal(-1.0), SUMOReal(1.0)); + double tTau = vars->myHeadway; + tTau = tTau + (myHeadwayTime - tTau) * myTmp2 + myTmp3 * tTau * RandHelper::rand(double(-1.0), double(1.0)); if (tTau < TS) { // this ensures the SK safety condition tTau = TS; } @@ -182,24 +183,24 @@ private: class SSKVehicleVariables : public MSCFModel::VehicleVariables { public: - SUMOReal gOld, myHeadway; - std::map ggOld; + double gOld, myHeadway; + std::map ggOld; }; protected: /// @brief The vehicle's dawdle-parameter. 0 for no dawdling, 1 for max. - SUMOReal myDawdle; + double myDawdle; /// @brief The precomputed value for myDecel*myTau - SUMOReal myTauDecel; + double myTauDecel; /// @brief temporary (testing) parameter - SUMOReal myTmp1, myTmp2, myTmp3, myTmp4, myTmp5; + double myTmp1, myTmp2, myTmp3, myTmp4, myTmp5; /** @brief new variables needed in this model; myS2Sspeed is the speed below which the vehicle does not move when stopped * @brief maxDeltaGap is the theoretical maximum change in gap that can happen in one time step */ - SUMOReal myS2Sspeed, maxDeltaGap; + double myS2Sspeed, maxDeltaGap; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Wiedemann.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Wiedemann.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Wiedemann.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Wiedemann.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date June 2011 -/// @version $Id: MSCFModel_Wiedemann.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSCFModel_Wiedemann.cpp 23699 2017-03-29 07:16:27Z namdre $ /// // The psycho-physical model of Wiedemann // references: @@ -13,7 +13,7 @@ // Olstam, Tapani - Comparison of Car-following models /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,16 +46,16 @@ // =========================================================================== // magic constant proposed by Wiedemann (based on real world measurements) -const SUMOReal MSCFModel_Wiedemann::D_MAX = 150; +const double MSCFModel_Wiedemann::D_MAX = 150; // =========================================================================== // method definitions // =========================================================================== MSCFModel_Wiedemann::MSCFModel_Wiedemann(const MSVehicleType* vtype, - SUMOReal accel, SUMOReal decel, - SUMOReal security, SUMOReal estimation) : - MSCFModel(vtype, accel, decel, 1.0), + double accel, double decel, double emergencyDecel, + double security, double estimation) : + MSCFModel(vtype, accel, decel, emergencyDecel, decel, 1.0), mySecurity(security), myEstimation(estimation), myAX(vtype->getLength() + 1. + 2. * security), @@ -67,23 +67,23 @@ MSCFModel_Wiedemann::~MSCFModel_Wiedemann() {} -SUMOReal -MSCFModel_Wiedemann::moveHelper(MSVehicle* const veh, SUMOReal vPos) const { - const SUMOReal vNext = MSCFModel::moveHelper(veh, vPos); +double +MSCFModel_Wiedemann::moveHelper(MSVehicle* const veh, double vPos) const { + const double vNext = MSCFModel::moveHelper(veh, vPos); VehicleVariables* vars = (VehicleVariables*)veh->getCarFollowVariables(); vars->accelSign = vNext > veh->getSpeed() ? 1. : -1.; return vNext; } -SUMOReal -MSCFModel_Wiedemann::followSpeed(const MSVehicle* const veh, SUMOReal /* speed */, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal /*predMaxDecel*/) const { +double +MSCFModel_Wiedemann::followSpeed(const MSVehicle* const veh, double /* speed */, double gap2pred, double predSpeed, double /*predMaxDecel*/) const { return _v(veh, predSpeed, gap2pred); } -SUMOReal -MSCFModel_Wiedemann::stopSpeed(const MSVehicle* const veh, const SUMOReal speed, SUMOReal gap) const { +double +MSCFModel_Wiedemann::stopSpeed(const MSVehicle* const veh, const double speed, double gap) const { /* Wiedemann does not handle approaching junctions or stops very well: * regime approaching() fails when dv = 0 (i.e. a vehicle inserted with speed 0 does not accelerate to reach a stop) * for dv ~ 0 the standard decision tree will switch to following() which @@ -94,8 +94,8 @@ } -SUMOReal -MSCFModel_Wiedemann::interactionGap(const MSVehicle* const , SUMOReal vL) const { +double +MSCFModel_Wiedemann::interactionGap(const MSVehicle* const , double vL) const { UNUSED_PARAMETER(vL); return D_MAX; } @@ -103,26 +103,26 @@ MSCFModel* MSCFModel_Wiedemann::duplicate(const MSVehicleType* vtype) const { - return new MSCFModel_Wiedemann(vtype, myAccel, myDecel, mySecurity, myEstimation); + return new MSCFModel_Wiedemann(vtype, myAccel, myDecel, myEmergencyDecel, mySecurity, myEstimation); } -SUMOReal -MSCFModel_Wiedemann::_v(const MSVehicle* veh, SUMOReal predSpeed, SUMOReal gap) const { +double +MSCFModel_Wiedemann::_v(const MSVehicle* veh, double predSpeed, double gap) const { const VehicleVariables* vars = (VehicleVariables*)veh->getCarFollowVariables(); - const SUMOReal dx = gap + myType->getLength(); // wiedemann uses brutto gap - const SUMOReal v = veh->getSpeed(); - const SUMOReal vpref = veh->getMaxSpeed(); - const SUMOReal dv = v - predSpeed; - const SUMOReal bx = myAX + (1 + 7 * mySecurity) * sqrt(v); // Harding propose a factor of *.8 here - const SUMOReal ex = 2 - myEstimation; // + RandHelper::randNorm(0.5, 0.15) - const SUMOReal sdx = myAX + ex * (bx - myAX); /// the distance at which we drift out of following - const SUMOReal sdv_root = (dx - myAX) / myCX; - const SUMOReal sdv = sdv_root * sdv_root; - const SUMOReal cldv = sdv * ex * ex; - const SUMOReal opdv = cldv * (-1 - 2 * RandHelper::randNorm(0.5, 0.15)); + const double dx = gap + myType->getLength(); // wiedemann uses brutto gap + const double v = veh->getSpeed(); + const double vpref = veh->getMaxSpeed(); + const double dv = v - predSpeed; + const double bx = myAX + (1 + 7 * mySecurity) * sqrt(v); // Harding propose a factor of *.8 here + const double ex = 2 - myEstimation; // + RandHelper::randNorm(0.5, 0.15) + const double sdx = myAX + ex * (bx - myAX); /// the distance at which we drift out of following + const double sdv_root = (dx - myAX) / myCX; + const double sdv = sdv_root * sdv_root; + const double cldv = sdv * ex * ex; + const double opdv = cldv * (-1 - 2 * RandHelper::randNorm(0.5, 0.15)); // select the regime, get new acceleration, compute new speed based - SUMOReal accel; + double accel; if (dx <= bx) { accel = emergency(dv, dx); } else if (dx < sdx) { @@ -142,16 +142,16 @@ } // since we have hard constrainst on accel we may as well use them here accel = MAX2(MIN2(accel, myAccel), -myDecel); - const SUMOReal vNew = MAX2(SUMOReal(0), v + ACCEL2SPEED(accel)); // don't allow negative speeds + const double vNew = MAX2(0., v + ACCEL2SPEED(accel)); // don't allow negative speeds return vNew; } -SUMOReal -MSCFModel_Wiedemann::fullspeed(SUMOReal v, SUMOReal vpref, SUMOReal dx, SUMOReal bx) const { - SUMOReal bmax = 0.2 + 0.8 * myAccel * (7 - sqrt(v)); +double +MSCFModel_Wiedemann::fullspeed(double v, double vpref, double dx, double bx) const { + double bmax = 0.2 + 0.8 * myAccel * (7 - sqrt(v)); // if veh just drifted out of a 'following' process the acceleration is reduced - SUMOReal accel = dx <= 2 * bx ? MIN2(myMinAccel, bmax * (dx - bx) / bx) : bmax; + double accel = dx <= 2 * bx ? MIN2(myMinAccel, bmax * (dx - bx) / bx) : bmax; if (v > vpref) { accel = - accel; } @@ -159,27 +159,27 @@ } -SUMOReal -MSCFModel_Wiedemann::following(SUMOReal sign) const { +double +MSCFModel_Wiedemann::following(double sign) const { return myMinAccel * sign; } -SUMOReal -MSCFModel_Wiedemann::approaching(SUMOReal dv, SUMOReal dx, SUMOReal bx) const { +double +MSCFModel_Wiedemann::approaching(double dv, double dx, double bx) const { // there is singularity in the formula. we do the sanity check outside assert(bx < dx); return 0.5 * dv * dv / (bx - dx); // + predAccel at t-reaction_time if this is value is above a treshold } -SUMOReal -MSCFModel_Wiedemann::emergency(SUMOReal /* dv */, SUMOReal /* dx */) const { +double +MSCFModel_Wiedemann::emergency(double /* dv */, double /* dx */) const { /* emergency according to A.Stebens // wiedemann assumes that dx will always be larger than myAX (sumo may // violate this assumption when crashing (-: if (dx > myAX) { - SUMOReal accel = 0.5 * dv * dv / (myAX - dx); // + predAccel at t-reaction_time if this is value is above a treshold + double accel = 0.5 * dv * dv / (myAX - dx); // + predAccel at t-reaction_time if this is value is above a treshold // one would assume that in an emergency accel must be negative. However the // wiedemann formula allows for accel = 0 whenever dv = 0 assert(accel <= 0); @@ -196,14 +196,14 @@ // XXX: This could be replaced by maximumSafeStopSpeed(), refs. #2575 -SUMOReal -MSCFModel_Wiedemann::krauss_vsafe(SUMOReal gap, SUMOReal predSpeed) const { +double +MSCFModel_Wiedemann::krauss_vsafe(double gap, double predSpeed) const { if (predSpeed == 0 && gap < 0.01) { return 0; } - const SUMOReal tauDecel = myDecel * myHeadwayTime; - const SUMOReal speedReduction = ACCEL2SPEED(myDecel); + const double tauDecel = myDecel * myHeadwayTime; + const double speedReduction = ACCEL2SPEED(myDecel); const int predSteps = int(predSpeed / speedReduction); - const SUMOReal leaderContrib = 2. * myDecel * (gap + SPEED2DIST(predSteps * predSpeed - speedReduction * predSteps * (predSteps + 1) / 2)); - return (SUMOReal)(-tauDecel + sqrt(tauDecel * tauDecel + leaderContrib)); + const double leaderContrib = 2. * myDecel * (gap + SPEED2DIST(predSteps * predSpeed - speedReduction * predSteps * (predSteps + 1) / 2)); + return (double)(-tauDecel + sqrt(tauDecel * tauDecel + leaderContrib)); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Wiedemann.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Wiedemann.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Wiedemann.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/cfmodels/MSCFModel_Wiedemann.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date June 2011 -/// @version $Id: MSCFModel_Wiedemann.h 21649 2016-10-10 13:24:35Z luecken $ +/// @version $Id: MSCFModel_Wiedemann.h 23699 2017-03-29 07:16:27Z namdre $ /// // The psycho-physical model of Wiedemann /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -54,13 +54,14 @@ * @param[in] estimation The estimation capability parameter in [0,1] (dimensionless) * @param[in] accel The maximum acceleration * @param[in] decel The maximum deceleration + * @param[in] emergencyDecel The maximum emergency deceleration * * @note other parameters of the wiedemann model: * - speed: included in MSVehicleType */ MSCFModel_Wiedemann(const MSVehicleType* vtype, - SUMOReal accel, SUMOReal decel, - SUMOReal security, SUMOReal estimation); + double accel, double decel, double emergencyDecel, + double security, double estimation); /// @brief Destructor @@ -75,7 +76,7 @@ * @param[in] vPos The possible velocity * @return The velocity after applying interactions with stops and lane change model influences */ - SUMOReal moveHelper(MSVehicle* const veh, SUMOReal vPos) const; + double moveHelper(MSVehicle* const veh, double vPos) const; /** @brief Computes the vehicle's safe speed (no dawdling) @@ -86,7 +87,7 @@ * @return EGO's safe speed * @see MSCFModel::ffeV */ - SUMOReal followSpeed(const MSVehicle* const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const; + double followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const; /** @brief Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling) @@ -96,7 +97,7 @@ * @see MSCFModel::ffeS * @todo generic Interface, models can call for the values they need */ - SUMOReal stopSpeed(const MSVehicle* const veh, const SUMOReal speed, SUMOReal gap) const; + double stopSpeed(const MSVehicle* const veh, const double speed, double gap) const; /** @brief Returns the maximum gap at which an interaction between both vehicles occurs @@ -108,7 +109,7 @@ * @todo evaluate signature * @see MSCFModel::interactionGap */ - SUMOReal interactionGap(const MSVehicle* const , SUMOReal vL) const; + double interactionGap(const MSVehicle* const , double vL) const; /** @brief Returns the model's name @@ -138,7 +139,7 @@ public: VehicleVariables() : accelSign(1) {} /// @brief state variable for remembering the drift direction - SUMOReal accelSign; + double accelSign; }; @@ -146,14 +147,14 @@ /* @brief the main enty point for the speed computation * @param[in] gap The netto gap (front bumper of ego to back bumper of leader) */ - SUMOReal _v(const MSVehicle* veh, SUMOReal predSpeed, SUMOReal gap) const; + double _v(const MSVehicle* veh, double predSpeed, double gap) const; /// @name acceleration based on the 'driving regime' /// @{ - SUMOReal fullspeed(SUMOReal v, SUMOReal vpref, SUMOReal dx, SUMOReal bx) const; // also 'WUNSCH' - SUMOReal following(SUMOReal sign) const; // also 'FOLGEN' - SUMOReal approaching(SUMOReal dv, SUMOReal dx, SUMOReal bx) const; // also 'BREMSBX' - SUMOReal emergency(SUMOReal dv, SUMOReal dx) const; // also 'BREMSAX' + double fullspeed(double v, double vpref, double dx, double bx) const; // also 'WUNSCH' + double following(double sign) const; // also 'FOLGEN' + double approaching(double dv, double dx, double bx) const; // also 'BREMSBX' + double emergency(double dv, double dx) const; // also 'BREMSAX' /// @} private: @@ -161,27 +162,27 @@ /// @{ /// @brief The driver's security parameter // also 'ZF1' - const SUMOReal mySecurity; + const double mySecurity; /// @brief The driver's estimation parameter // also 'ZF2' - const SUMOReal myEstimation; + const double myEstimation; /// @brief front-bumper to front-bumper distance - const SUMOReal myAX; + const double myAX; /// @brief perception threshold modifier - const SUMOReal myCX; + const double myCX; /// @brief The vehicle's minimum acceleration [m/s^2] - const SUMOReal myMinAccel; + const double myMinAccel; /// @brief free-flow distance in m - static const SUMOReal D_MAX; + static const double D_MAX; /// @} /// @brief vsafe from krauss since Wiedemann is deficient at approaching // standing obstacles (see MSCFModel_Krauss::_vsafe) - SUMOReal krauss_vsafe(SUMOReal gap, SUMOReal predSpeed) const; + double krauss_vsafe(double gap, double predSpeed) const; private: /// @brief Invalidated assignment operator diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -1,6 +1,7 @@ noinst_LIBRARIES = libmicrosimdevs.a libmicrosimdevs_a_SOURCES = MSDevice.cpp MSDevice.h \ +MSDevice_SSM.cpp MSDevice_SSM.h \ MSDevice_BTreceiver.cpp MSDevice_BTreceiver.h \ MSDevice_BTsender.cpp MSDevice_BTsender.h \ MSDevice_Emissions.cpp MSDevice_Emissions.h \ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -99,11 +99,11 @@ libmicrosimdevs_a_AR = $(AR) $(ARFLAGS) libmicrosimdevs_a_LIBADD = am_libmicrosimdevs_a_OBJECTS = MSDevice.$(OBJEXT) \ - MSDevice_BTreceiver.$(OBJEXT) MSDevice_BTsender.$(OBJEXT) \ - MSDevice_Emissions.$(OBJEXT) MSDevice_Transportable.$(OBJEXT) \ - MSDevice_Routing.$(OBJEXT) MSDevice_Tripinfo.$(OBJEXT) \ - MSDevice_Battery.$(OBJEXT) MSDevice_Example.$(OBJEXT) \ - MSDevice_Vehroutes.$(OBJEXT) + MSDevice_SSM.$(OBJEXT) MSDevice_BTreceiver.$(OBJEXT) \ + MSDevice_BTsender.$(OBJEXT) MSDevice_Emissions.$(OBJEXT) \ + MSDevice_Transportable.$(OBJEXT) MSDevice_Routing.$(OBJEXT) \ + MSDevice_Tripinfo.$(OBJEXT) MSDevice_Battery.$(OBJEXT) \ + MSDevice_Example.$(OBJEXT) MSDevice_Vehroutes.$(OBJEXT) libmicrosimdevs_a_OBJECTS = $(am_libmicrosimdevs_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) @@ -333,6 +333,7 @@ top_srcdir = @top_srcdir@ noinst_LIBRARIES = libmicrosimdevs.a libmicrosimdevs_a_SOURCES = MSDevice.cpp MSDevice.h \ +MSDevice_SSM.cpp MSDevice_SSM.h \ MSDevice_BTreceiver.cpp MSDevice_BTreceiver.h \ MSDevice_BTsender.cpp MSDevice_BTsender.h \ MSDevice_Emissions.cpp MSDevice_Emissions.h \ @@ -399,6 +400,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSDevice_Emissions.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSDevice_Example.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSDevice_Routing.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSDevice_SSM.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSDevice_Transportable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSDevice_Tripinfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSDevice_Vehroutes.Po@am__quote@ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Battery.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Battery.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Battery.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Battery.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Tamas Kurczveil /// @author Pablo Alvarez Lopez /// @date 20.12.2013 -/// @version $Id: MSDevice_Battery.cpp 21705 2016-10-17 07:46:19Z luecken $ +/// @version $Id: MSDevice_Battery.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The Battery parameters for the vehicle /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -40,9 +41,8 @@ #include "MSDevice_Tripinfo.h" #include "MSDevice_Battery.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS +#define DEFAULT_MAX_CAPACITY 35000 +#define DEFAULT_CHARGE_RATIO 0.5 // =========================================================================== @@ -59,105 +59,84 @@ void MSDevice_Battery::buildVehicleDevices(SUMOVehicle& v, std::vector& into) { - if (!equippedByDefaultAssignmentOptions(OptionsCont::getOptions(), "battery", v)) { - return; - } - - // myMaximumBatteryCapacity - SUMOReal maximumBatteryCapacity = TplConvert::_2SUMOReal(v.getVehicleType().getParameter().getParameter("maximumBatteryCapacity", "0").c_str()); + // Check if vehicle should get a battery + if (equippedByDefaultAssignmentOptions(OptionsCont::getOptions(), "battery", v)) { + const HelpersEnergy& e = PollutantsInterface::getEnergyHelper(); + const SUMOVTypeParameter& typeParams = v.getVehicleType().getParameter(); + std::map param; + // obtain maximumBatteryCapacity + const double maximumBatteryCapacity = typeParams.getDouble(toString(SUMO_ATTR_MAXIMUMBATTERYCAPACITY), DEFAULT_MAX_CAPACITY); + + // obtain actualBatteryCapacity + double actualBatteryCapacity = 0; + if (v.getParameter().getParameter(toString(SUMO_ATTR_ACTUALBATTERYCAPACITY), "-") == "-") { + actualBatteryCapacity = maximumBatteryCapacity * DEFAULT_CHARGE_RATIO; + } else { + actualBatteryCapacity = TplConvert::_2double(v.getParameter().getParameter(toString(SUMO_ATTR_ACTUALBATTERYCAPACITY), "0").c_str()); + } + + const double powerMax = typeParams.getDouble(toString(SUMO_ATTR_MAXIMUMPOWER), 100.); + const double stoppingTreshold = typeParams.getDouble(toString(SUMO_ATTR_STOPPINGTRESHOLD), 0.1); + + param[SUMO_ATTR_VEHICLEMASS] = typeParams.getDouble(toString(SUMO_ATTR_VEHICLEMASS), e.getDefaultParam(SUMO_ATTR_VEHICLEMASS)); + param[SUMO_ATTR_FRONTSURFACEAREA] = typeParams.getDouble(toString(SUMO_ATTR_FRONTSURFACEAREA), e.getDefaultParam(SUMO_ATTR_FRONTSURFACEAREA)); + param[SUMO_ATTR_AIRDRAGCOEFFICIENT] = typeParams.getDouble(toString(SUMO_ATTR_AIRDRAGCOEFFICIENT), e.getDefaultParam(SUMO_ATTR_AIRDRAGCOEFFICIENT)); + param[SUMO_ATTR_INTERNALMOMENTOFINERTIA] = typeParams.getDouble(toString(SUMO_ATTR_INTERNALMOMENTOFINERTIA), e.getDefaultParam(SUMO_ATTR_INTERNALMOMENTOFINERTIA)); + param[SUMO_ATTR_RADIALDRAGCOEFFICIENT] = typeParams.getDouble(toString(SUMO_ATTR_RADIALDRAGCOEFFICIENT), e.getDefaultParam(SUMO_ATTR_RADIALDRAGCOEFFICIENT)); + param[SUMO_ATTR_ROLLDRAGCOEFFICIENT] = typeParams.getDouble(toString(SUMO_ATTR_ROLLDRAGCOEFFICIENT), e.getDefaultParam(SUMO_ATTR_ROLLDRAGCOEFFICIENT)); + param[SUMO_ATTR_CONSTANTPOWERINTAKE] = typeParams.getDouble(toString(SUMO_ATTR_CONSTANTPOWERINTAKE), e.getDefaultParam(SUMO_ATTR_CONSTANTPOWERINTAKE)); + param[SUMO_ATTR_PROPULSIONEFFICIENCY] = typeParams.getDouble(toString(SUMO_ATTR_PROPULSIONEFFICIENCY), e.getDefaultParam(SUMO_ATTR_PROPULSIONEFFICIENCY)); + param[SUMO_ATTR_RECUPERATIONEFFICIENCY] = typeParams.getDouble(toString(SUMO_ATTR_RECUPERATIONEFFICIENCY), e.getDefaultParam(SUMO_ATTR_RECUPERATIONEFFICIENCY)); + + // battery constructor + MSDevice_Battery* device = new MSDevice_Battery(v, "battery_" + v.getID(), + actualBatteryCapacity, maximumBatteryCapacity, powerMax, stoppingTreshold, param); - // myActualBatteryCapacity - SUMOReal actualBatteryCapacity = 0; - if (v.getParameter().getParameter("actualBatteryCapacity", "-") == "-") { - actualBatteryCapacity = maximumBatteryCapacity / 2.0; - } else { - actualBatteryCapacity = TplConvert::_2SUMOReal(v.getParameter().getParameter("actualBatteryCapacity", "0").c_str()); + // Add device to vehicle + into.push_back(device); } - - // powerMax - SUMOReal powerMax = TplConvert::_2SUMOReal(v.getVehicleType().getParameter().getParameter("maximumPower", "100").c_str()); - - // mass - SUMOReal mass = TplConvert::_2SUMOReal(v.getVehicleType().getParameter().getParameter("vehicleMass", "1000").c_str()); - - // frontSurfaceArea - SUMOReal frontSurfaceArea = TplConvert::_2SUMOReal(v.getVehicleType().getParameter().getParameter("frontSurfaceArea", "2").c_str()); - - // airDragCoefficient - SUMOReal airDragCoefficient = TplConvert::_2SUMOReal(v.getVehicleType().getParameter().getParameter("airDragCoefficient", "0.4").c_str()); - - // internalMomentOfInertia - SUMOReal internalMomentOfInertia = TplConvert::_2SUMOReal(v.getVehicleType().getParameter().getParameter("internalMomentOfInertia", "10").c_str()); - - // radialDragCoefficient - SUMOReal radialDragCoefficient = TplConvert::_2SUMOReal(v.getVehicleType().getParameter().getParameter("radialDragCoefficient", "1").c_str()); - - // rollDragCoefficient - SUMOReal rollDragCoefficient = TplConvert::_2SUMOReal(v.getVehicleType().getParameter().getParameter("rollDragCoefficient", "0.5").c_str()); - - // constantPowerIntake - SUMOReal constantPowerIntake = TplConvert::_2SUMOReal(v.getVehicleType().getParameter().getParameter("constantPowerIntake", "10").c_str()); - - // propulsionEfficiency - SUMOReal propulsionEfficiency = TplConvert::_2SUMOReal(v.getVehicleType().getParameter().getParameter("propulsionEfficiency", "0.5").c_str()); - - // recuperationEfficiency - SUMOReal recuperationEfficiency = TplConvert::_2SUMOReal(v.getVehicleType().getParameter().getParameter("recuperationEfficiency", "0").c_str()); - - // constructor - MSDevice_Battery* device = new MSDevice_Battery(v, "battery_" + v.getID(), - actualBatteryCapacity, maximumBatteryCapacity, powerMax, mass, frontSurfaceArea, airDragCoefficient, - internalMomentOfInertia, radialDragCoefficient, rollDragCoefficient, - constantPowerIntake, propulsionEfficiency, recuperationEfficiency, 0, 0); - - // Add device to vehicle - into.push_back(device); } -bool MSDevice_Battery::notifyMove(SUMOVehicle& veh, SUMOReal /* oldPos */, SUMOReal /* newPos */, SUMOReal /* newSpeed */) { +bool MSDevice_Battery::notifyMove(SUMOVehicle& veh, double /* oldPos */, double /* newPos */, double /* newSpeed */) { // Start vehicleStoppedTimer if the vehicle is stopped. In other case reset timer - if (veh.getSpeed() < SUMO_const_haltingSpeed) + if (veh.getSpeed() < myStoppingTreshold) { // Increase vehicle stopped timer - { increaseVehicleStoppedTimer(); - } else + } else { // Reset vehicle Stopped - { resetVehicleStoppedTimer(); } // Update Energy from the battery if (getMaximumBatteryCapacity() != 0) { - myConsum = getPropEnergy(veh); + myParam[SUMO_ATTR_ANGLE] = myLastAngle == std::numeric_limits::infinity() ? 0. : GeomHelper::angleDiff(myLastAngle, veh.getAngle()); + myConsum = PollutantsInterface::getEnergyHelper().compute(0, PollutantsInterface::ELEC, veh.getSpeed(), veh.getAcceleration(), veh.getSlope(), &myParam); - // Energy lost/gained from vehicle movement (via vehicle energy model) [kWh] + // Energy lost/gained from vehicle movement (via vehicle energy model) [Wh] setActualBatteryCapacity(getActualBatteryCapacity() - myConsum); - // saturate between 0 and myMaximumBatteryCapacity [kWh] + // saturate between 0 and myMaximumBatteryCapacity [Wh] if (getActualBatteryCapacity() < 0) { setActualBatteryCapacity(0); - - // Show warning if battery is depleted - if (getMaximumBatteryCapacity() > 0) + if (getMaximumBatteryCapacity() > 0) { WRITE_WARNING("Battery of vehicle '" + veh.getID() + "' is depleted.") - - } else if (getActualBatteryCapacity() > getMaximumBatteryCapacity()) { + } + } else if (getActualBatteryCapacity() > getMaximumBatteryCapacity()) { setActualBatteryCapacity(getMaximumBatteryCapacity()); } - - setLastAngle(veh.getAngle()); + myLastAngle = veh.getAngle(); } // Check if vehicle has under their position one charge Station - std::string ChargingStationID = MSNet::getInstance()->getChargingStationID(veh.getLane(), veh.getPositionOnLane()); + const std::string chargingStationID = MSNet::getInstance()->getChargingStationID(veh.getLane(), veh.getPositionOnLane()); // If vehicle is over a charging station - if (ChargingStationID != "") { + if (chargingStationID != "") { // if the vehicle is almost stopped, or charge in transit is enabled, then charge vehicle - if ((veh.getSpeed() < SUMO_const_haltingSpeed) || (MSNet::getInstance()->getChargingStation(ChargingStationID)->getChargeInTransit() == 1)) { + if ((veh.getSpeed() < myStoppingTreshold) || (MSNet::getInstance()->getChargingStation(chargingStationID)->getChargeInTransit() == 1)) { // Set Flags Stopped/intransit to - if (veh.getSpeed() < SUMO_const_haltingSpeed) { + if (veh.getSpeed() < myStoppingTreshold) { // vehicle ist almost stopped, then is charging stopped myChargingStopped = true; @@ -172,13 +151,12 @@ } // get pointer to charging station - myActChargingStation = MSNet::getInstance()->getChargingStation(ChargingStationID); + myActChargingStation = MSNet::getInstance()->getChargingStation(chargingStationID); // Only update charging start time if vehicle allow charge in transit, or in other case // if the vehicle not allow charge in transit but it's stopped. - if (myActChargingStation->getChargeInTransit() == true || veh.getSpeed() < SUMO_const_haltingSpeed) + if ((myActChargingStation->getChargeInTransit() == true) || (veh.getSpeed() < myStoppingTreshold)) { // Update Charging start time - { increaseChargingStartTime(); } @@ -190,7 +168,7 @@ // Calulate energy charged myEnergyCharged = myActChargingStation->getChargingPower() * myActChargingStation->getEfficency(); - // Convert from [kWs] to [kWh] (3600s / 1h): + // Convert from [Ws] to [Wh] (3600s / 1h): myEnergyCharged /= 3600; // Update Battery charge @@ -200,6 +178,8 @@ setActualBatteryCapacity(getActualBatteryCapacity() + myEnergyCharged); } } + // add charge value for output to myActChargingStation + myActChargingStation->addChargeValueForOutput(myEnergyCharged, this); } } // In other case, vehicle will be not charged @@ -228,42 +208,18 @@ } -bool MSDevice_Battery::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason) { - // Set last Energy ONLY when the vehicle is introduced in the simulation - if (reason == MSMoveReminder::NOTIFICATION_DEPARTED) { - setLastEnergy(getMass() * veh.getSpeed() * veh.getSpeed() / 2 + getMass() * 9.81 * veh.getLane()->getShape().front().z() + getInternalMomentOfInertia() * 0.5 * veh.getSpeed() * veh.getSpeed()); - setLastAngle(veh.getLane()->getShape().beginEndAngle()); - } - - // This function return always true - return true; -} - - -void MSDevice_Battery::generateOutput() const { - //Function implemented in MSBatteryExport -} - - // --------------------------------------------------------------------------- // MSDevice_Battery-methods // --------------------------------------------------------------------------- -MSDevice_Battery::MSDevice_Battery(SUMOVehicle& holder, const std::string& id, const SUMOReal actualBatteryCapacity, const SUMOReal maximumBatteryCapacity, const SUMOReal powerMax, const SUMOReal mass, const SUMOReal frontSurfaceArea, const SUMOReal airDragCoefficient, const SUMOReal internalMomentOfInertia, const SUMOReal radialDragCoefficient, const SUMOReal rollDragCoefficient, const SUMOReal constantPowerIntake, const SUMOReal propulsionEfficiency, const SUMOReal recuperationEfficiency, const SUMOReal lastAngle, const SUMOReal lastEnergy) : +MSDevice_Battery::MSDevice_Battery(SUMOVehicle& holder, const std::string& id, const double actualBatteryCapacity, const double maximumBatteryCapacity, + const double powerMax, const double stoppingTreshold, const std::map& param) : MSDevice(holder, id), myActualBatteryCapacity(0), // [actualBatteryCapacity <= maximumBatteryCapacity] myMaximumBatteryCapacity(0), // [maximumBatteryCapacity >= 0] myPowerMax(0), // [maximumPower >= 0] - myMass(0), // [vehicleMass >= 0] - myFrontSurfaceArea(0), // [frontSurfaceArea >= 0] - myAirDragCoefficient(0), // [airDragCoefficient >=0] - myInternalMomentOfInertia(0), // [internalMomentOfInertia >= 0] - myRadialDragCoefficient(0), // [radialDragCoefficient >=0] - myRollDragCoefficient(0), // [rollDragCoefficient >= 0] - myConstantPowerIntake(0), // [constantPowerIntake >= 0] - myPropulsionEfficiency(0), // [1 >= propulsionEfficiency >= 0] - myRecuperationEfficiency(0), // [1 >= recuperationEfficiency >= 0] - myLastAngle(lastAngle), // Limit not needed - myLastEnergy(lastEnergy), // Limit not needed + myStoppingTreshold(0), // [stoppingTreshold >= 0] + myParam(param), + myLastAngle(std::numeric_limits::infinity()), myChargingStopped(false), // Initially vehicle don't charge stopped myChargingInTransit(false), // Initially vehicle don't charge in transit myConsum(0), // Initially the vehicle is stopped and therefore the consum is zero. @@ -271,87 +227,58 @@ myEnergyCharged(0), // Initially the energy charged is zero myVehicleStopped(0) { // Initially the vehicle is stopped and the corresponding variable is 0 - if (maximumBatteryCapacity < 0) - WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter maximum battery capacity (" + TplConvert::_2str(maximumBatteryCapacity) + ").") - else { - myMaximumBatteryCapacity = maximumBatteryCapacity; - } + if (maximumBatteryCapacity < 0) { + WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter " + toString(SUMO_ATTR_MAXIMUMBATTERYCAPACITY) + " (" + toString(maximumBatteryCapacity) + ").") + } else { + myMaximumBatteryCapacity = maximumBatteryCapacity; + } if (actualBatteryCapacity > maximumBatteryCapacity) { - WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' has a actual battery capacity (" + TplConvert::_2str(actualBatteryCapacity) + ") greater than it's max battery capacity(" + TplConvert::_2str(maximumBatteryCapacity) + "). A max battery capacity value will be asigned"); + WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' has a " + toString(SUMO_ATTR_ACTUALBATTERYCAPACITY) + " (" + toString(actualBatteryCapacity) + ") greater than it's " + toString(SUMO_ATTR_MAXIMUMBATTERYCAPACITY) + " (" + toString(maximumBatteryCapacity) + "). A max battery capacity value will be asigned"); myActualBatteryCapacity = myMaximumBatteryCapacity; } else { myActualBatteryCapacity = actualBatteryCapacity; } - if (powerMax < 0) - WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter maximum power (" + TplConvert::_2str(powerMax) + ").") - else { - myPowerMax = powerMax; - } - - if (mass < 0) - WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter mass (" + TplConvert::_2str(mass) + ").") - else { - myMass = mass; - } - - if (frontSurfaceArea < 0) - WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter front surface Area (" + TplConvert::_2str(frontSurfaceArea) + ").") - else { - myFrontSurfaceArea = frontSurfaceArea; - } - - if (airDragCoefficient < 0) - WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter drag coefficient (" + TplConvert::_2str(airDragCoefficient) + ").") - else { - myAirDragCoefficient = airDragCoefficient; - } - - if (internalMomentOfInertia < 0) - WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter internal moment of insertia (" + TplConvert::_2str(internalMomentOfInertia) + ").") - else { - myInternalMomentOfInertia = internalMomentOfInertia; - } - - if (radialDragCoefficient < 0) - WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter radial friction coefficient (" + TplConvert::_2str(radialDragCoefficient) + ").") - else { - myRadialDragCoefficient = radialDragCoefficient; - } + if (powerMax < 0) { + WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter " + toString(SUMO_ATTR_MAXIMUMPOWER) + " (" + toString(powerMax) + ").") + } else { + myPowerMax = powerMax; + } - if (rollDragCoefficient < 0) - WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter roll friction coefficient (" + TplConvert::_2str(rollDragCoefficient) + ").") - else { - myRollDragCoefficient = rollDragCoefficient; - } + if (stoppingTreshold < 0) { + WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter " + toString(SUMO_ATTR_STOPPINGTRESHOLD) + " (" + toString(stoppingTreshold) + ").") + } else { + myStoppingTreshold = stoppingTreshold; + } - if (constantPowerIntake < 0) - WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter constant power intake (" + TplConvert::_2str(constantPowerIntake) + ").") - else { - myConstantPowerIntake = constantPowerIntake; - } + checkParam(SUMO_ATTR_VEHICLEMASS); + checkParam(SUMO_ATTR_FRONTSURFACEAREA); + checkParam(SUMO_ATTR_AIRDRAGCOEFFICIENT); + checkParam(SUMO_ATTR_INTERNALMOMENTOFINERTIA); + checkParam(SUMO_ATTR_RADIALDRAGCOEFFICIENT); + checkParam(SUMO_ATTR_ROLLDRAGCOEFFICIENT); + checkParam(SUMO_ATTR_CONSTANTPOWERINTAKE); + checkParam(SUMO_ATTR_PROPULSIONEFFICIENCY); + checkParam(SUMO_ATTR_RECUPERATIONEFFICIENCY); +} - if (propulsionEfficiency < 0 || propulsionEfficiency > 1) - WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter propulsion efficiency (" + TplConvert::_2str(propulsionEfficiency) + ").") - else { - myPropulsionEfficiency = propulsionEfficiency; - } - if (recuperationEfficiency < 0 || recuperationEfficiency > 1) - WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter Recuparation efficiency (" + TplConvert::_2str(recuperationEfficiency) + ").") - else { - myRecuperationEfficiency = recuperationEfficiency; - } +MSDevice_Battery::~MSDevice_Battery() { } -MSDevice_Battery::~MSDevice_Battery() { +void +MSDevice_Battery::checkParam(const SumoXMLAttr paramKey, const double lower, const double upper) { + if (myParam.find(paramKey) == myParam.end() || myParam.find(paramKey)->second < lower || myParam.find(paramKey)->second > upper) { + WRITE_WARNING("Battery builder: Vehicle '" + getID() + "' doesn't have a valid value for parameter " + toString(paramKey) + " (" + toString(myParam[paramKey]) + ")."); + myParam[paramKey] = PollutantsInterface::getEnergyHelper().getDefaultParam(paramKey); + } } void -MSDevice_Battery::setActualBatteryCapacity(const SUMOReal actualBatteryCapacity) { +MSDevice_Battery::setActualBatteryCapacity(const double actualBatteryCapacity) { if (actualBatteryCapacity < 0) { myActualBatteryCapacity = 0; } else if (actualBatteryCapacity > myMaximumBatteryCapacity) { @@ -363,124 +290,32 @@ void -MSDevice_Battery::setMaximumBatteryCapacity(const SUMOReal maximumBatteryCapacity) { - if (myMaximumBatteryCapacity < 0) - WRITE_WARNING("Function setMaximumBatteryCapacity: Trying to insert into a battery device of vehicle '" + getID() + "' a invalid maximum battery capacity (" + TplConvert::_2str(maximumBatteryCapacity) + ").") - else { - myMaximumBatteryCapacity = maximumBatteryCapacity; - } -} - - -void -MSDevice_Battery::setMass(const SUMOReal mass) { - if (myMass < 0) - WRITE_WARNING("Function setMass: Trying to insert into a battery device of vehicle '" + getID() + "' a invalid mass value (" + TplConvert::_2str(mass) + ").") - else { - myMass = mass; - } -} - - -void -MSDevice_Battery::setPowerMax(const SUMOReal powerMax) { - if (myPowerMax < 0) - WRITE_WARNING("Function setPowerMax: Trying to insert into a battery device of vehicle '" + getID() + "' a invalid power max value (" + TplConvert::_2str(powerMax) + ").") - else { - myPowerMax = powerMax; - } -} - - -void -MSDevice_Battery::setFrontSurfaceArea(const SUMOReal frontSurfaceArea) { - if (myFrontSurfaceArea < 0) - WRITE_WARNING("Function setFrontSurfaceArea: Trying to insert into a battery device of vehicle '" + getID() + "' a invalid front surface Area value (" + TplConvert::_2str(frontSurfaceArea) + ").") - else { - myFrontSurfaceArea = frontSurfaceArea; - } -} - - -void -MSDevice_Battery::setAirDragCoefficient(const SUMOReal airDragCoefficient) { - if (myAirDragCoefficient < 0) - WRITE_WARNING("Function setAirDragCoefficient: Trying to insert into a battery device of vehicle '" + getID() + "' a invalid drag coefficient value (" + TplConvert::_2str(airDragCoefficient) + ").") - else { - myAirDragCoefficient = airDragCoefficient; - } -} - - -void -MSDevice_Battery::setInternalMomentOfInertia(const SUMOReal internalMomentOfInertia) { - if (myInternalMomentOfInertia < 0) - WRITE_WARNING("Function setInternalMomentOfInertia: Trying to insert into a battery device of vehicle '" + getID() + "' a invalid internal moment of insertia value (" + TplConvert::_2str(internalMomentOfInertia) + ").") - else { - myInternalMomentOfInertia = internalMomentOfInertia; - } -} - - -void -MSDevice_Battery::setRadialDragCoefficient(const SUMOReal radialDragCoefficient) { - if (myRadialDragCoefficient < 0) - WRITE_WARNING("Function setRadialDragCoefficient: Trying to insert into a battery device of vehicle '" + getID() + "' a invalid radial friction coefficient value (" + TplConvert::_2str(radialDragCoefficient) + ").") - else { - myRadialDragCoefficient = radialDragCoefficient; - } -} - - -void -MSDevice_Battery::setRollDragCoefficient(const SUMOReal rollDragCoefficient) { - if (myRollDragCoefficient < 0) - WRITE_WARNING("Function setRollDragCoefficient: Trying to insert into a battery device of vehicle '" + getID() + "' a invalid roll friction coefficient value (" + TplConvert::_2str(rollDragCoefficient) + ").") - else { - myRollDragCoefficient = rollDragCoefficient; - } -} - - -void -MSDevice_Battery::setConstantPowerIntake(const SUMOReal constantPowerIntake) { - if (myConstantPowerIntake < 0) - WRITE_WARNING("Function setConstantPowerIntake: Trying to insert into a battery device of vehicle '" + getID() + "' a invalid constant power intake value (" + TplConvert::_2str(constantPowerIntake) + ").") - else { - myConstantPowerIntake = constantPowerIntake; - } -} - - -void -MSDevice_Battery::setPropulsionEfficiency(const SUMOReal propulsionEfficiency) { - if (myPropulsionEfficiency < 0 || myPropulsionEfficiency > 1) - WRITE_WARNING("Function setPropulsionEfficiency: Trying to insert into a battery device of vehicle '" + getID() + "' a invalid propulsion efficiency value (" + TplConvert::_2str(propulsionEfficiency) + ").") - else { - myPropulsionEfficiency = propulsionEfficiency; - } -} - - -void -MSDevice_Battery::setRecuperationEfficiency(const SUMOReal recuperationEfficiency) { - if (myRecuperationEfficiency < 0 || myRecuperationEfficiency > 1) - WRITE_WARNING("Function setRecuperationEfficiency: Trying to insert into a battery device of vehicle '" + getID() + "' a invalid recuparation efficiency value (" + TplConvert::_2str(recuperationEfficiency) + ").") - else { - myRecuperationEfficiency = recuperationEfficiency; - } +MSDevice_Battery::setMaximumBatteryCapacity(const double maximumBatteryCapacity) { + if (myMaximumBatteryCapacity < 0) { + WRITE_WARNING("Trying to set into the battery device of vehicle '" + getID() + "' an invalid " + toString(SUMO_ATTR_MAXIMUMBATTERYCAPACITY) + " (" + toString(maximumBatteryCapacity) + ").") + } else { + myMaximumBatteryCapacity = maximumBatteryCapacity; + } } void -MSDevice_Battery::setLastAngle(const SUMOReal lastAngle) { - myLastAngle = lastAngle; +MSDevice_Battery::setPowerMax(const double powerMax) { + if (myPowerMax < 0) { + WRITE_WARNING("Trying to set into the battery device of vehicle '" + getID() + "' an invalid " + toString(SUMO_ATTR_MAXIMUMPOWER) + " (" + toString(powerMax) + ").") + } else { + myPowerMax = powerMax; + } } void -MSDevice_Battery::setLastEnergy(const SUMOReal lastEnergy) { - myLastEnergy = lastEnergy ; +MSDevice_Battery::setStoppingTreshold(const double stoppingTreshold) { + if (stoppingTreshold < 0) { + WRITE_WARNING("Trying to set into the battery device of vehicle '" + getID() + "' an invalid " + toString(SUMO_ATTR_STOPPINGTRESHOLD) + " (" + toString(stoppingTreshold) + ").") + } else { + myStoppingTreshold = stoppingTreshold; + } } @@ -508,91 +343,25 @@ } -SUMOReal +double MSDevice_Battery::getActualBatteryCapacity() const { return myActualBatteryCapacity; } -SUMOReal +double MSDevice_Battery::getMaximumBatteryCapacity() const { return myMaximumBatteryCapacity; } -SUMOReal +double MSDevice_Battery::getMaximumPower() const { return myPowerMax; } -SUMOReal -MSDevice_Battery::getMass() const { - return myMass; -} - - -SUMOReal -MSDevice_Battery::getFrontSurfaceArea() const { - return myFrontSurfaceArea; -} - - -SUMOReal -MSDevice_Battery::getAirDragCoefficient() const { - return myAirDragCoefficient; -} - - -SUMOReal -MSDevice_Battery::getInternalMomentOfInertia() const { - return myInternalMomentOfInertia; -} - - -SUMOReal -MSDevice_Battery::getRadialDragCoefficient() const { - return myRadialDragCoefficient; -} - - -SUMOReal -MSDevice_Battery::getRollDragCoefficient() const { - return myRollDragCoefficient; -} - - -SUMOReal -MSDevice_Battery::getConstantPowerIntake() const { - return myConstantPowerIntake; -} - - -SUMOReal -MSDevice_Battery::getPropulsionEfficiency() const { - return myPropulsionEfficiency; -} - - -SUMOReal -MSDevice_Battery::getRecuperationEfficiency() const { - return myRecuperationEfficiency; -} - - -SUMOReal -MSDevice_Battery::getLastAngle() const { - return myLastAngle; -} - - -SUMOReal -MSDevice_Battery::getLastEnergy() const { - return myLastEnergy; -} - - -SUMOReal +double MSDevice_Battery::getConsum() const { return myConsum; } @@ -610,7 +379,7 @@ } -SUMOReal +double MSDevice_Battery::getChargingStartTime() const { return myChargingStartTime; } @@ -625,98 +394,56 @@ } } - -SUMOReal +double MSDevice_Battery::getEnergyCharged() const { return myEnergyCharged; } -int MSDevice_Battery::getVehicleStopped() const { +int +MSDevice_Battery::getVehicleStopped() const { return myVehicleStopped; } -SUMOReal MSDevice_Battery::getPropEnergy(SUMOVehicle& veh) { - assert(veh.getSpeed() >= 0.); - - //XXX: All formulas below work with the logic of the euler update (refs #860). - // Approximation order could be improved. Refs. #2592. - - // calculate current height - SUMOReal height_cur = veh.getPositionOnLane() / veh.getLane()->getLength() * (veh.getLane()->getShape().back().z() - veh.getLane()->getShape().front().z()); - - // kinetic energy of vehicle with current velocity - SUMOReal currentEnergy = 0.5 * getMass() * veh.getSpeed() * veh.getSpeed(); - - // add current potential energy of vehicle at current position - currentEnergy += getMass() * 9.81 * height_cur; - - // Calculate the radius of the vehicle's current path if is distinct (r = ds / dphi) - SUMOReal radius = 0; - - // add current rotational energy of internal rotating elements - currentEnergy += getInternalMomentOfInertia() * veh.getSpeed() * veh.getSpeed(); - - // kinetic + potential + rotational energy gain [Ws] (MODIFICATED LAST ANGLE) - SUMOReal EnergyLoss = (currentEnergy - getLastEnergy()); - - // save current total energy for next time step - setLastEnergy(currentEnergy); - - - // Energy loss through Air resistance [Ws] - // Calculate energy losses: - // EnergyLoss,Air = 1/2 * rho_air [kg/m^3] * myFrontSurfaceArea [m^2] * myAirDragCoefficient [-] * v_Veh^2 [m/s] * s [m] - // ... with rho_air [kg/m^3] = 1,2041 kg/m^3 (at T = 20C) - // ... with s [m] = v_Veh [m/s] * TS [s] - EnergyLoss += 0.5 * 1.2041 * getFrontSurfaceArea() * getAirDragCoefficient() * veh.getSpeed() * veh.getSpeed() * SPEED2DIST(veh.getSpeed()); - - - // Energy loss through Roll resistance [Ws] - // ... (fabs(veh.getSpeed())>=0.01) = 0, if vehicle isn't moving - // EnergyLoss,Tire = c_R [-] * F_N [N] * s [m] - // ... with c_R = ~0.012 (car tire on asphalt) - // ... with F_N [N] = myMass [kg] * g [m/s^2] - EnergyLoss += getRollDragCoefficient() * 9.81 * getMass() * SPEED2DIST(veh.getSpeed()); - +double +MSDevice_Battery::getStoppingTreshold() const { + return myStoppingTreshold; +} - // Energy loss through friction by radial force [Ws] - // If angle of vehicle was changed - if (getLastAngle() != veh.getAngle()) { - // Compute new radio - radius = SPEED2DIST(veh.getSpeed()) / fabs(GeomHelper::angleDiff(getLastAngle(), veh.getAngle())); - // Check if radius is in the interval [0.0001 - 10000] (To avoid overflow and division by zero) - if (radius < 0.0001) { - radius = 0.0001; - } else if (radius > 10000) { - radius = 10000; - } - } - // EnergyLoss,internalFrictionRadialForce = c [m] * F_rad [N]; - if (getLastAngle() != veh.getAngle()) { - // Energy loss through friction by radial force [Ws] - EnergyLoss += getRadialDragCoefficient() * getMass() * veh.getSpeed() * veh.getSpeed() / radius; - } +std::string +MSDevice_Battery::getParameter(const std::string& key) const { + if (key == toString(SUMO_ATTR_ACTUALBATTERYCAPACITY)) { + return toString(getActualBatteryCapacity()); + } else if (key == toString(SUMO_ATTR_ENERGYCONSUMED)) { + return toString(getConsum()); + } else if (key == toString(SUMO_ATTR_ENERGYCHARGED)) { + return toString(getEnergyCharged()); + } else if (key == toString(SUMO_ATTR_MAXIMUMBATTERYCAPACITY)) { + return toString(getMaximumBatteryCapacity()); + } else if (key == toString(SUMO_ATTR_CHARGINGSTATIONID)) { + return getChargingStationID(); + } + throw InvalidArgument("Parameter '" + key + "' is not supported for device of type '" + deviceName() + "'"); +} - // EnergyLoss,constantConsumers - // Energy loss through constant loads (e.g. A/C) [Ws] - EnergyLoss += getConstantPowerIntake(); - //E_Bat = E_kin_pot + EnergyLoss; - if (EnergyLoss > 0) { - // Assumption: Efficiency of myPropulsionEfficiency when accelerating - EnergyLoss = EnergyLoss / getPropulsionEfficiency(); +void +MSDevice_Battery::setParameter(const std::string& key, const std::string& value) { + double doubleValue; + try { + doubleValue = TplConvert::_2double(value.c_str()); + } catch (NumberFormatException) { + throw InvalidArgument("Setting parameter '" + key + "' requires a number for device of type '" + deviceName() + "'"); + } + if (key == toString(SUMO_ATTR_ACTUALBATTERYCAPACITY)) { + setActualBatteryCapacity(doubleValue); + } else if (key == toString(SUMO_ATTR_MAXIMUMBATTERYCAPACITY)) { + setMaximumBatteryCapacity(doubleValue); } else { - // Assumption: Efficiency of myRecuperationEfficiency when recuperating - EnergyLoss = EnergyLoss * getRecuperationEfficiency(); + throw InvalidArgument("Setting parameter '" + key + "' is not supported for device of type '" + deviceName() + "'"); } - - // convert from [Ws] to [kWh] (3600s / 1h): - EnergyLoss = EnergyLoss / 3600 ; // EnergyLoss[Ws] * 1[h]/3600[s] * 1[k]/1000 - - // Return calculated energy - return EnergyLoss; } +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Battery.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Battery.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Battery.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Battery.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Tamas Kurczveil /// @author Pablo Alvarez Lopez /// @date 20-12-13 -/// @version $Id: MSDevice_Battery.h 20687 2016-05-10 11:27:00Z behrisch $ +/// @version $Id: MSDevice_Battery.h 24108 2017-04-27 18:43:30Z behrisch $ /// // The Battery parameters for the vehicle /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -85,26 +85,19 @@ * * @return True (always). */ - bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed); - - /** @brief Saves departure info on insertion - * - * @param[in] veh The entering vehicle. - * @param[in] reason how the vehicle enters the lane - * @return Always true - * @see MSMoveReminder::notifyEnter - * @see MSMoveReminder::Notification - */ - bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason); + bool notifyMove(SUMOVehicle& veh, double oldPos, double newPos, double newSpeed); /// @} - /** @brief Called on writing tripinfo output - * - * @param[in] os The stream to write the information into - * @exception IOError not yet implemented - * @see MSDevice::generateOutput - */ - void generateOutput() const; + /// @brief return the name for this type of device + const std::string deviceName() const { + return "battery"; + } + + /// @brief try to retrieve the given parameter from this device. Throw exception for unsupported key + std::string getParameter(const std::string& key) const; + + /// @brief try to set the given parameter for this device. Throw exception for unsupported key + void setParameter(const std::string& key, const std::string& value); private: /** @brief Constructor @@ -114,50 +107,20 @@ * @param[in] period The period with which a new route shall be searched * @param[in] preInsertionPeriod The route search period before insertion */ - MSDevice_Battery(SUMOVehicle& holder, const std::string& id, const SUMOReal actualBatteryCapacity, const SUMOReal maximumBatteryCapacity, const SUMOReal powerMax, const SUMOReal mass, const SUMOReal frontSurfaceArea, const SUMOReal airDragCoefficient, const SUMOReal internalMomentOfInertia, const SUMOReal radialDragCoefficient, const SUMOReal rollDragCoefficient, const SUMOReal constantPowerIntake, const SUMOReal propulsionEfficiency, const SUMOReal recuperationEfficiency, const SUMOReal lastAngle, const SUMOReal lastEnergy); + MSDevice_Battery(SUMOVehicle& holder, const std::string& id, const double actualBatteryCapacity, const double maximumBatteryCapacity, + const double powerMax, const double stoppingTreshold, const std::map& param); + + void checkParam(const SumoXMLAttr paramKey, const double lower = 0., const double upper = std::numeric_limits::infinity()); public: /// @brief Get the actual vehicle's Battery Capacity in kWh - SUMOReal getActualBatteryCapacity() const; + double getActualBatteryCapacity() const; /// @brief Get the total vehicle's Battery Capacity in kWh - SUMOReal getMaximumBatteryCapacity() const; + double getMaximumBatteryCapacity() const; /// @brief Get the maximum power when accelerating - SUMOReal getMaximumPower() const; - - /// @brief Get vehicle's mass - SUMOReal getMass() const; - - /// @brief Get vehicle's front surface Area - SUMOReal getFrontSurfaceArea() const; - - /// @brief Get vehicle's drag coefficient - SUMOReal getAirDragCoefficient() const; - - /// @brief Get vehicles's internal moment of inertia - SUMOReal getInternalMomentOfInertia() const; - - /// @brief Get vehicles's radial friction coefficient - SUMOReal getRadialDragCoefficient() const; - - /// @brief Get vehicles's roll friction coefficient - SUMOReal getRollDragCoefficient() const; - - /// @brief Get vehicles's constant power intake - SUMOReal getConstantPowerIntake() const; - - /// @brief Get vehicles's Propulsion efficiency - SUMOReal getPropulsionEfficiency() const; - - /// @brief Get vehicles's Recuparation efficiency - SUMOReal getRecuperationEfficiency() const; - - /// @brief Get vehicles's last angle - SUMOReal getLastAngle() const; - - /// @brief Get vehicles's last Energy - SUMOReal getLastEnergy() const; + double getMaximumPower() const; /// @brief Get true if Vehicle is charging, false if not. bool isChargingStopped() const; @@ -166,64 +129,34 @@ bool isChargingInTransit() const; /// @brief Get charging start time. - SUMOReal getChargingStartTime() const; + double getChargingStartTime() const; /// @brief Get consum - SUMOReal getConsum() const; + double getConsum() const; /// @brief Get current Charging Station ID std::string getChargingStationID() const; /// @brief Get charged energy - SUMOReal getEnergyCharged() const; + double getEnergyCharged() const; /// @brief Get number of timestep that vehicle is stopped int getVehicleStopped() const; - /// @brief get propulsion energy - SUMOReal getPropEnergy(SUMOVehicle& veh); + /// @brief Get stopping treshold + double getStoppingTreshold() const; /// @brief Set actual vehicle's Battery Capacity in kWh - void setActualBatteryCapacity(const SUMOReal actualBatteryCapacity); + void setActualBatteryCapacity(const double actualBatteryCapacity); /// @brief Set total vehicle's Battery Capacity in kWh - void setMaximumBatteryCapacity(const SUMOReal maximumBatteryCapacity); + void setMaximumBatteryCapacity(const double maximumBatteryCapacity); /// @brief Set maximum power when accelerating - void setPowerMax(const SUMOReal new_Pmax); - - /// @brief Set vehicle's myMass - void setMass(const SUMOReal mass); - - /// @brief Set vehicle's front surface Area - void setFrontSurfaceArea(const SUMOReal frontSurfaceArea); - - /// @brief Set vehicle's drag coefficient - void setAirDragCoefficient(const SUMOReal new_C_Veh); - - /// @brief Set vehicle's internal moment of inertia - void setInternalMomentOfInertia(const SUMOReal internalMomentOfInertia); - - /// @brief Set vehicle's radial friction coefficient - void setRadialDragCoefficient(const SUMOReal radialDragCoefficient); - - /// @brief Set vehicle's roll friction coefficient - void setRollDragCoefficient(const SUMOReal rollDragCoefficient); - - /// @brief Set vehicle's constant power intake - void setConstantPowerIntake(const SUMOReal constantPowerIntake); + void setPowerMax(const double new_Pmax); - /// @brief Set vehicle's Propulsion efficiency - void setPropulsionEfficiency(const SUMOReal propulsionEfficiency); - - /// @brief Set vehicle's Recuparation efficiency - void setRecuperationEfficiency(const SUMOReal recuperationEfficiency); - - /// @brief Set vehicle's last Angle - void setLastAngle(const SUMOReal lastAngle); - - /// @brief Set vehicle's last Energy - void setLastEnergy(const SUMOReal lastEnergy); + /// @brief Set vehicle's stopping treshold + void setStoppingTreshold(const double stoppingTreshold); /// @brief Reset charging start time void resetChargingStartTime(); @@ -238,84 +171,41 @@ void increaseVehicleStoppedTimer(); protected: - /// @brief Parameter, The actual vehicles's Battery Capacity in kWh - /// @condition [myActualBatteryCapacity <= myMaximumBatteryCapacity] - SUMOReal myActualBatteryCapacity; - - /// @brief Parameter, The total vehicles's Battery Capacity in kWh - /// @condition [myMaximumBatteryCapacity >= 0] - SUMOReal myMaximumBatteryCapacity; - - /// @brief Parameter, The Maximum Power when accelerating - /// @condition [myPowerMax >= 0] - SUMOReal myPowerMax; - - /// @brief Parameter, Vehicle's myMass - /// @condition [myMass >= 0] - SUMOReal myMass; - - /// @brief Parameter, Vehicle's front surface Area - /// @condition [myFrontSurfaceArea >= 0] - SUMOReal myFrontSurfaceArea; - - /// @brief Parameter, Vehicle's drag coefficient - /// @condition [myAirDragCoefficient >=0] - SUMOReal myAirDragCoefficient; - - /// @brief Parameter, Vehicle's internal moment of inertia - /// @condition [myInternalMomentOfInertia >= 0] - SUMOReal myInternalMomentOfInertia; - - /// @brief Parameter, Vehicle's radial friction coefficient - /// @condition [myRadialDragCoefficient >=0] - SUMOReal myRadialDragCoefficient; - - /// @brief Parameter, Vehicle's roll friction coefficient - /// @condition [myRollDragCoefficient >= 0] - SUMOReal myRollDragCoefficient; - - /// @brief Parameter, Vehicle's constant power intake - /// @condition [myConstantPowerIntake >= 0] - SUMOReal myConstantPowerIntake; - - /// @brief Parameter, Vehicle's propulsion efficiency - /// @condition [1 >= myPropulsionEfficiency >= 0] - SUMOReal myPropulsionEfficiency; - - /// @brief Parameter, Vehicle's recuparation efficiency - /// @condition [1 >= myRecuperationEfficiency >= 0] - SUMOReal myRecuperationEfficiency; + /// @brief Parameter, The actual vehicles's Battery Capacity in kWh, [myActualBatteryCapacity <= myMaximumBatteryCapacity] + double myActualBatteryCapacity; - /// @brief Parameter, Vehicle's last angle - /// @condition none - SUMOReal myLastAngle; + /// @brief Parameter, The total vehicles's Battery Capacity in kWh, [myMaximumBatteryCapacity >= 0] + double myMaximumBatteryCapacity; - /// @brief Parameter, Vehicle's last energy - /// @condition none - SUMOReal myLastEnergy; + /// @brief Parameter, The Maximum Power when accelerating, [myPowerMax >= 0] + double myPowerMax; + + /// @brief Parameter, stopping vehicle treshold [myStoppingTreshold >= 0] + double myStoppingTreshold; + + /// @brief Parameter collection + std::map myParam; + + /// @brief Parameter, Vehicle's last angle + double myLastAngle; - /// @brief Parameter, Flag: Vehicles it's charging stopped - /// @condition by default is false. + /// @brief Parameter, Flag: Vehicles it's charging stopped (by default is false) bool myChargingStopped; - /// @brief Parameter, Flag: Vehicles it's charging in transit - /// @condition by default is false. + /// @brief Parameter, Flag: Vehicles it's charging in transit (by default is false) bool myChargingInTransit; /// @brief Parameter, Moment, wich the vehicle has beging to charging - /// @condition none - SUMOReal myChargingStartTime; + double myChargingStartTime; - /// @brief Parameter, Vehicle consum during a time step - /// @condition by default is 0. - SUMOReal myConsum; + /// @brief Parameter, Vehicle consum during a time step (by default is 0.) + double myConsum; - /// @brief Parameter, Pointer to current charging station in which vehicle is placed - /// @condition by default is NULL. + /// @brief Parameter, Pointer to current charging station in which vehicle is placed (by default is NULL) MSChargingStation* myActChargingStation; /// @brief Parameter, Energy charged in each timestep - SUMOReal myEnergyCharged; + double myEnergyCharged; /// @brief Parameter, How many timestep the vehicle is stopped int myVehicleStopped; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_BTreceiver.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_BTreceiver.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_BTreceiver.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_BTreceiver.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 14.08.2013 -/// @version $Id: MSDevice_BTreceiver.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSDevice_BTreceiver.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // A BT sender /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,17 +43,13 @@ #include "MSDevice_BTreceiver.h" #include "MSDevice_BTsender.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members // =========================================================================== bool MSDevice_BTreceiver::myWasInitialised = false; -SUMOReal MSDevice_BTreceiver::myRange = -1.; -SUMOReal MSDevice_BTreceiver::myOffTime = -1.; +double MSDevice_BTreceiver::myRange = -1.; +double MSDevice_BTreceiver::myOffTime = -1.; MTRand MSDevice_BTreceiver::sRecognitionRNG; std::map MSDevice_BTreceiver::sVehicles; @@ -102,7 +98,7 @@ // MSDevice_BTreceiver::BTreceiverUpdate-methods // --------------------------------------------------------------------------- MSDevice_BTreceiver::BTreceiverUpdate::BTreceiverUpdate() { - MSNet::getInstance()->getEndOfTimestepEvents()->addEvent(this, 0, MSEventControl::ADAPT_AFTER_EXECUTION); + MSNet::getInstance()->getEndOfTimestepEvents()->addEvent(this); } @@ -205,7 +201,7 @@ const Position receiverDelta = receiverData.position - oldReceiverPosition; const Position translatedSender = senderData.position - receiverDelta; // find crossing points - std::vector intersections; + std::vector intersections; GeomHelper::findLineCircleIntersections(oldReceiverPosition, receiver.range, oldSenderPosition, translatedSender, intersections); switch (intersections.size()) { case 0: @@ -262,7 +258,7 @@ void -MSDevice_BTreceiver::BTreceiverUpdate::enterRange(SUMOReal atOffset, const MSDevice_BTsender::VehicleState& receiverState, +MSDevice_BTreceiver::BTreceiverUpdate::enterRange(double atOffset, const MSDevice_BTsender::VehicleState& receiverState, const std::string& senderID, const MSDevice_BTsender::VehicleState& senderState, std::map& currentlySeen) { MeetingPoint mp(SIMTIME + atOffset, receiverState, senderState); @@ -275,7 +271,7 @@ void MSDevice_BTreceiver::BTreceiverUpdate::leaveRange(VehicleInformation& receiverInfo, const MSDevice_BTsender::VehicleState& receiverState, MSDevice_BTsender::VehicleInformation& senderInfo, const MSDevice_BTsender::VehicleState& senderState, - SUMOReal tOffset) { + double tOffset) { std::map::iterator i = receiverInfo.currentlySeen.find(senderInfo.getID()); // check whether the other was recognized addRecognitionPoint(SIMTIME + tOffset, receiverState, senderState, i->second); @@ -292,11 +288,11 @@ } -SUMOReal +double MSDevice_BTreceiver::inquiryDelaySlots(const int backoffLimit) { const int phaseOffset = sRecognitionRNG.randInt(2047); const bool interlaced = sRecognitionRNG.rand() < 0.7; - const SUMOReal delaySlots = sRecognitionRNG.rand() * 15; + const double delaySlots = sRecognitionRNG.rand() * 15; const int backoff = sRecognitionRNG.randInt(backoffLimit); if (interlaced) { return sRecognitionRNG.rand() * 31 + backoff; @@ -322,7 +318,7 @@ void -MSDevice_BTreceiver::BTreceiverUpdate::addRecognitionPoint(const SUMOReal tEnd, const MSDevice_BTsender::VehicleState& receiverState, +MSDevice_BTreceiver::BTreceiverUpdate::addRecognitionPoint(const double tEnd, const MSDevice_BTsender::VehicleState& receiverState, const MSDevice_BTsender::VehicleState& senderState, SeenDevice* senderDevice) const { if (senderDevice->nextView == -1.) { @@ -393,7 +389,7 @@ bool -MSDevice_BTreceiver::notifyEnter(SUMOVehicle& veh, Notification reason) { +MSDevice_BTreceiver::notifyEnter(SUMOVehicle& veh, Notification reason, const MSLane* /* enteredLane */) { if (reason == MSMoveReminder::NOTIFICATION_DEPARTED && sVehicles.find(veh.getID()) == sVehicles.end()) { sVehicles[veh.getID()] = new VehicleInformation(veh.getID(), myRange); sVehicles[veh.getID()]->route.push_back(veh.getEdge()); @@ -411,7 +407,7 @@ bool -MSDevice_BTreceiver::notifyMove(SUMOVehicle& veh, SUMOReal /* oldPos */, SUMOReal newPos, SUMOReal newSpeed) { +MSDevice_BTreceiver::notifyMove(SUMOVehicle& veh, double /* oldPos */, double newPos, double newSpeed) { if (sVehicles.find(veh.getID()) == sVehicles.end()) { WRITE_WARNING("btreceiver: Can not update position of vehicle '" + veh.getID() + "' which is not on the road."); return true; @@ -423,7 +419,7 @@ bool -MSDevice_BTreceiver::notifyLeave(SUMOVehicle& veh, SUMOReal /* lastPos */, Notification reason) { +MSDevice_BTreceiver::notifyLeave(SUMOVehicle& veh, double /* lastPos */, Notification reason, const MSLane* /* enteredLane */) { if (reason < MSMoveReminder::NOTIFICATION_TELEPORT) { return true; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_BTreceiver.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_BTreceiver.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_BTreceiver.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_BTreceiver.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 14.08.2013 -/// @version $Id: MSDevice_BTreceiver.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: MSDevice_BTreceiver.h 23665 2017-03-27 09:04:40Z namdre $ /// // A BT receiver /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -77,7 +77,7 @@ /** @brief Returns the configured range * @return the device range */ - static SUMOReal getRange() { + static double getRange() { return myRange; } @@ -100,7 +100,7 @@ * @see MSMoveReminder::notifyEnter * @see MSMoveReminder::Notification */ - bool notifyEnter(SUMOVehicle& veh, Notification reason); + bool notifyEnter(SUMOVehicle& veh, Notification reason, const MSLane* enteredLane = 0); /** @brief Checks whether the reminder still has to be notified about the vehicle moves @@ -116,7 +116,7 @@ * * @return True if vehicle hasn't passed the reminder completely. */ - bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed); + bool notifyMove(SUMOVehicle& veh, double oldPos, double newPos, double newSpeed); /** @brief Moves (the known) vehicle from running to arrived vehicles' list @@ -129,9 +129,13 @@ * @see MSMoveReminder * @see MSMoveReminder::notifyLeave */ - bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, Notification reason); - //@} + bool notifyLeave(SUMOVehicle& veh, double lastPos, Notification reason, const MSLane* enteredLane = 0); + ///@} + /// @brief return the name for this type of device + const std::string deviceName() const { + return "btreceiver"; + } /** @class MeetingPoint @@ -144,7 +148,7 @@ * @param[in] _observerState The position, speed, lane etc. the observer had at the time * @param[in] _seenState The position, speed, lane etc. the seen vehicle had at the time */ - MeetingPoint(SUMOReal _t, const MSDevice_BTsender::VehicleState& _observerState, + MeetingPoint(double _t, const MSDevice_BTsender::VehicleState& _observerState, const MSDevice_BTsender::VehicleState& _seenState) : t(_t), observerState(_observerState), seenState(_seenState) {} @@ -153,7 +157,7 @@ public: /// @brief The time of the meeting - const SUMOReal t; + const double t; /// @brief The state the observer had at the time const MSDevice_BTsender::VehicleState observerState; /// @brief The state the seen vehicle had at the time @@ -194,9 +198,9 @@ /// @brief Description of the meeting's end MeetingPoint* meetingEnd; /// @brief Last recognition point - SUMOReal lastView; + double lastView; /// @brief Next possible recognition point - SUMOReal nextView; + double nextView; /// @brief List of recognition points std::vector recognitionPoints; /// @brief string of travelled receiver edges @@ -235,10 +239,10 @@ static bool myWasInitialised; /// @brief The range of the device - static SUMOReal myRange; + static double myRange; /// @brief The offtime of the device - static SUMOReal myOffTime; + static double myOffTime; /** @class VehicleInformation @@ -250,7 +254,7 @@ * @param[in] id The id of the vehicle * @param[in] range Recognition range of the vehicle */ - VehicleInformation(const std::string& id, const SUMOReal _range) : MSDevice_BTsender::VehicleInformation(id), range(_range) {} + VehicleInformation(const std::string& id, const double _range) : MSDevice_BTsender::VehicleInformation(id), range(_range) {} /// @brief Destructor ~VehicleInformation() { @@ -268,7 +272,7 @@ } /// @brief Recognition range of the vehicle - const SUMOReal range; + const double range; /// @brief The map of devices seen by the vehicle at removal time std::map currentlySeen; @@ -319,7 +323,7 @@ * @param[in] senderState The position, speed, lane etc. the seen vehicle had at the time * @param[in] currentlySeen The container storing episodes */ - void enterRange(SUMOReal atOffset, const MSDevice_BTsender::VehicleState& receiverState, + void enterRange(double atOffset, const MSDevice_BTsender::VehicleState& receiverState, const std::string& senderID, const MSDevice_BTsender::VehicleState& senderState, std::map& currentlySeen); @@ -333,7 +337,7 @@ */ void leaveRange(VehicleInformation& receiverInfo, const MSDevice_BTsender::VehicleState& receiverState, MSDevice_BTsender::VehicleInformation& senderInfo, const MSDevice_BTsender::VehicleState& senderState, - SUMOReal tOffset); + double tOffset); @@ -344,7 +348,7 @@ * @param[in] senderState The position, speed, lane etc. the seen vehicle had at the time * @param[in] senderDevice The device of the entering sender */ - void addRecognitionPoint(const SUMOReal tEnd, const MSDevice_BTsender::VehicleState& receiverState, + void addRecognitionPoint(const double tEnd, const MSDevice_BTsender::VehicleState& receiverState, const MSDevice_BTsender::VehicleState& senderState, SeenDevice* senderDevice) const; @@ -363,7 +367,7 @@ }; - static SUMOReal inquiryDelaySlots(const int backoffLimit); + static double inquiryDelaySlots(const int backoffLimit); /// @brief A random number generator used to determine whether the opposite was recognized static MTRand sRecognitionRNG; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_BTsender.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_BTsender.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_BTsender.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_BTsender.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 14.08.2013 -/// @version $Id: MSDevice_BTsender.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: MSDevice_BTsender.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A BT sender /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,10 +40,6 @@ #include "MSDevice_BTsender.h" #include "MSDevice_BTreceiver.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members @@ -93,7 +89,7 @@ bool -MSDevice_BTsender::notifyEnter(SUMOVehicle& veh, Notification reason) { +MSDevice_BTsender::notifyEnter(SUMOVehicle& veh, Notification reason, const MSLane* /* enteredLane */) { if (reason == MSMoveReminder::NOTIFICATION_DEPARTED && sVehicles.find(veh.getID()) == sVehicles.end()) { sVehicles[veh.getID()] = new VehicleInformation(veh.getID()); sVehicles[veh.getID()]->route.push_back(veh.getEdge()); @@ -111,7 +107,7 @@ bool -MSDevice_BTsender::notifyMove(SUMOVehicle& veh, SUMOReal /* oldPos */, SUMOReal newPos, SUMOReal newSpeed) { +MSDevice_BTsender::notifyMove(SUMOVehicle& veh, double /* oldPos */, double newPos, double newSpeed) { if (sVehicles.find(veh.getID()) == sVehicles.end()) { WRITE_WARNING("btsender: Can not update position of vehicle '" + veh.getID() + "' which is not on the road."); return true; @@ -123,7 +119,7 @@ bool -MSDevice_BTsender::notifyLeave(SUMOVehicle& veh, SUMOReal /* lastPos */, Notification reason) { +MSDevice_BTsender::notifyLeave(SUMOVehicle& veh, double /* lastPos */, Notification reason, const MSLane* /* enteredLane */) { if (reason < MSMoveReminder::NOTIFICATION_TELEPORT) { return true; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_BTsender.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_BTsender.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_BTsender.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_BTsender.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 14.08.2013 -/// @version $Id: MSDevice_BTsender.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSDevice_BTsender.h 23665 2017-03-27 09:04:40Z namdre $ /// // A BT sender /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -101,7 +101,7 @@ * @see MSMoveReminder::notifyEnter * @see MSMoveReminder::Notification */ - bool notifyEnter(SUMOVehicle& veh, Notification reason); + bool notifyEnter(SUMOVehicle& veh, Notification reason, const MSLane* enteredLane = 0); /** @brief Checks whether the reminder still has to be notified about the vehicle moves @@ -117,7 +117,7 @@ * * @return True if vehicle hasn't passed the reminder completely. */ - bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed); + bool notifyMove(SUMOVehicle& veh, double oldPos, double newPos, double newSpeed); /** @brief Moves (the known) vehicle from running to arrived vehicles' list @@ -130,9 +130,13 @@ * @see MSMoveReminder * @see MSMoveReminder::notifyLeave */ - bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, Notification reason); + bool notifyLeave(SUMOVehicle& veh, double lastPos, Notification reason, const MSLane* enteredLane = 0); /// @} + /// @brief return the name for this type of device + const std::string deviceName() const { + return "btsender"; + } /** @class VehicleState @@ -146,21 +150,21 @@ * @param[in] _laneID The id of the lane the vehicle is located at * @param[in] _lanePos The position of the vehicle along the lane */ - VehicleState(const SUMOReal _speed, const Position& _position, const std::string& _laneID, - const SUMOReal _lanePos, const int _routePos) + VehicleState(const double _speed, const Position& _position, const std::string& _laneID, + const double _lanePos, const int _routePos) : speed(_speed), position(_position), laneID(_laneID), lanePos(_lanePos), routePos(_routePos) {} /// @brief Destructor ~VehicleState() {} /// @brief The speed of the vehicle - SUMOReal speed; + double speed; /// @brief The position of the vehicle Position position; /// @brief The lane the vehicle was at std::string laneID; /// @brief The position at the lane of the vehicle - SUMOReal lanePos; + double lanePos; /// @brief The position in the route of the vehicle int routePos; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 14.08.2013 -/// @version $Id: MSDevice.cpp 20890 2016-06-06 12:29:01Z namdre $ +/// @version $Id: MSDevice.cpp 23657 2017-03-24 14:17:02Z namdre $ /// // Abstract in-vehicle device /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,17 +40,14 @@ #include "MSDevice_BTsender.h" #include "MSDevice_Example.h" #include "MSDevice_Battery.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS +#include "MSDevice_SSM.h" // =========================================================================== // static member variables // =========================================================================== std::map > MSDevice::myExplicitIDs; - +MTRand MSDevice::myEquipmentRNG; // =========================================================================== // method definitions @@ -66,6 +63,7 @@ MSDevice_BTsender::insertOptions(oc); MSDevice_Example::insertOptions(oc); MSDevice_Battery::insertOptions(oc); + MSDevice_SSM::insertOptions(oc); } @@ -87,6 +85,7 @@ MSDevice_BTsender::buildVehicleDevices(v, into); MSDevice_Example::buildVehicleDevices(v, into); MSDevice_Battery::buildVehicleDevices(v, into); + MSDevice_SSM::buildVehicleDevices(v, into); } @@ -112,7 +111,7 @@ haveByNumber = MSNet::getInstance()->getVehicleControl().getQuota(oc.getFloat("device." + deviceName + ".probability")) == 1; } else { if (oc.exists("device." + deviceName + ".probability") && oc.getFloat("device." + deviceName + ".probability") != 0) { - haveByNumber = RandHelper::rand() <= oc.getFloat("device." + deviceName + ".probability"); + haveByNumber = myEquipmentRNG.rand() <= oc.getFloat("device." + deviceName + ".probability"); } } // assignment by name @@ -140,5 +139,15 @@ } -/****************************************************************************/ +void +MSDevice::saveState(OutputDevice& /* out */) const { + WRITE_WARNING("Device '" + getID() + "' cannot save state"); +} + +void +MSDevice::loadState(const SUMOSAXAttributes& /* attrs */) { +} + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Emissions.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Emissions.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Emissions.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Emissions.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date Fri, 30.01.2009 -/// @version $Id: MSDevice_Emissions.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSDevice_Emissions.cpp 23673 2017-03-27 13:02:44Z behrisch $ /// // A device which collects vehicular emissions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -77,10 +73,10 @@ bool -MSDevice_Emissions::notifyMove(SUMOVehicle& veh, SUMOReal /*oldPos*/, SUMOReal /*newPos*/, SUMOReal newSpeed) { +MSDevice_Emissions::notifyMove(SUMOVehicle& veh, double /*oldPos*/, double /*newPos*/, double newSpeed) { const SUMOEmissionClass c = veh.getVehicleType().getEmissionClass(); - const SUMOReal a = veh.getAcceleration(); - const SUMOReal slope = veh.getSlope(); + const double a = veh.getAcceleration(); + const double slope = veh.getSlope(); myEmissions.addScaled(PollutantsInterface::computeAll(c, newSpeed, a, slope), TS); return true; } @@ -97,6 +93,7 @@ "\" PMx_abs=\"" << OutputDevice::realString(myEmissions.PMx, 6) << "\" NOx_abs=\"" << OutputDevice::realString(myEmissions.NOx, 6) << "\" fuel_abs=\"" << OutputDevice::realString(myEmissions.fuel, 6) << + "\" electricity_abs=\"" << OutputDevice::realString(myEmissions.electricity, 6) << "\"").closeTag(); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Emissions.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Emissions.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Emissions.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Emissions.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Fri, 30.01.2009 -/// @version $Id: MSDevice_Emissions.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSDevice_Emissions.h 23665 2017-03-27 09:04:40Z namdre $ /// // A device which collects vehicular emissions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -102,9 +102,13 @@ * @see MSMoveReminder::notifyMove * @see PollutantsInterface */ - bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed); + bool notifyMove(SUMOVehicle& veh, double oldPos, double newPos, double newSpeed); /// @} + /// @brief return the name for this type of device + const std::string deviceName() const { + return "emissions"; + } /** @brief Called on writing tripinfo output * diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Example.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Example.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Example.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Example.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 11.06.2013 -/// @version $Id: MSDevice_Example.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSDevice_Example.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A device which stands as an implementation example and which outputs movereminder calls /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,10 +40,6 @@ #include "MSDevice_Tripinfo.h" #include "MSDevice_Example.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -67,10 +63,10 @@ if (equippedByDefaultAssignmentOptions(oc, "example", v)) { // build the device // get custom vehicle parameter - SUMOReal customParameter2 = -1; + double customParameter2 = -1; if (v.getParameter().knowsParameter("example")) { try { - customParameter2 = TplConvert::_2SUMOReal(v.getParameter().getParameter("example", "-1").c_str()); + customParameter2 = TplConvert::_2double(v.getParameter().getParameter("example", "-1").c_str()); } catch (...) { WRITE_WARNING("Invalid value '" + v.getParameter().getParameter("example", "-1") + "'for vehicle parameter 'example'"); } @@ -79,10 +75,10 @@ std::cout << "vehicle '" << v.getID() << "' does not supply vehicle parameter 'example'. Using default of " << customParameter2 << "\n"; } // get custom vType parameter - SUMOReal customParameter3 = -1; + double customParameter3 = -1; if (v.getVehicleType().getParameter().knowsParameter("example")) { try { - customParameter3 = TplConvert::_2SUMOReal(v.getVehicleType().getParameter().getParameter("example", "-1").c_str()); + customParameter3 = TplConvert::_2double(v.getVehicleType().getParameter().getParameter("example", "-1").c_str()); } catch (...) { WRITE_WARNING("Invalid value '" + v.getVehicleType().getParameter().getParameter("example", "-1") + "'for vType parameter 'example'"); } @@ -103,7 +99,7 @@ // MSDevice_Example-methods // --------------------------------------------------------------------------- MSDevice_Example::MSDevice_Example(SUMOVehicle& holder, const std::string& id, - SUMOReal customValue1, SUMOReal customValue2, SUMOReal customValue3) : + double customValue1, double customValue2, double customValue3) : MSDevice(holder, id), myCustomValue1(customValue1), myCustomValue2(customValue2), @@ -117,8 +113,8 @@ bool -MSDevice_Example::notifyMove(SUMOVehicle& veh, SUMOReal /* oldPos */, - SUMOReal /* newPos */, SUMOReal newSpeed) { +MSDevice_Example::notifyMove(SUMOVehicle& veh, double /* oldPos */, + double /* newPos */, double newSpeed) { std::cout << "device '" << getID() << "' notifyMove: newSpeed=" << newSpeed << "\n"; // check whether another device is present on the vehicle: MSDevice_Tripinfo* otherDevice = static_cast(veh.getDevice(typeid(MSDevice_Tripinfo))); @@ -130,15 +126,14 @@ bool -MSDevice_Example::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason) { +MSDevice_Example::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { std::cout << "device '" << getID() << "' notifyEnter: reason=" << reason << " currentEdge=" << veh.getEdge()->getID() << "\n"; return true; // keep the device } bool -MSDevice_Example::notifyLeave(SUMOVehicle& veh, SUMOReal /*lastPos*/, - MSMoveReminder::Notification reason) { +MSDevice_Example::notifyLeave(SUMOVehicle& veh, double /*lastPos*/, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { std::cout << "device '" << getID() << "' notifyLeave: reason=" << reason << " currentEdge=" << veh.getEdge()->getID() << "\n"; return true; // keep the device } @@ -155,6 +150,33 @@ } } +std::string +MSDevice_Example::getParameter(const std::string& key) const { + if (key == "customValue1") { + return toString(myCustomValue1); + } else if (key == "customValue2") { + return toString(myCustomValue2); + } else if (key == "meaningOfLife") { + return "42"; + } + throw InvalidArgument("Parameter '" + key + "' is not supported for device of type '" + deviceName() + "'"); +} + + +void +MSDevice_Example::setParameter(const std::string& key, const std::string& value) { + double doubleValue; + try { + doubleValue = TplConvert::_2double(value.c_str()); + } catch (NumberFormatException) { + throw InvalidArgument("Setting parameter '" + key + "' requires a number for device of type '" + deviceName() + "'"); + } + if (key == "customValue1") { + myCustomValue1 = doubleValue; + } else { + throw InvalidArgument("Setting parameter '" + key + "' is not supported for device of type '" + deviceName() + "'"); + } +} /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Example.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Example.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Example.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Example.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,7 +3,7 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date 11.06.2013 -/// @version $Id: MSDevice_Example.h 17235 2014-11-03 10:53:02Z behrisch $ +/// @version $Id: MSDevice_Example.h 24108 2017-04-27 18:43:30Z behrisch $ /// // A device which stands as an implementation example and which outputs movereminder calls /****************************************************************************/ @@ -92,8 +92,8 @@ * * @return True (always). */ - bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, - SUMOReal newPos, SUMOReal newSpeed); + bool notifyMove(SUMOVehicle& veh, double oldPos, + double newPos, double newSpeed); /** @brief Saves departure info on insertion @@ -104,7 +104,7 @@ * @see MSMoveReminder::notifyEnter * @see MSMoveReminder::Notification */ - bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason); + bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /** @brief Saves arrival info @@ -115,11 +115,21 @@ * @param[in] isLaneChange whether the vehicle changed from the lane * @return True if it did not leave the net. */ - bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, - MSMoveReminder::Notification reason); + bool notifyLeave(SUMOVehicle& veh, double lastPos, + MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /// @} + /// @brief return the name for this type of device + const std::string deviceName() const { + return "example"; + } + + /// @brief try to retrieve the given parameter from this device. Throw exception for unsupported key + std::string getParameter(const std::string& key) const; + + /// @brief try to set the given parameter for this device. Throw exception for unsupported key + void setParameter(const std::string& key, const std::string& value); /** @brief Called on writing tripinfo output * @@ -137,8 +147,8 @@ * @param[in] holder The vehicle that holds this device * @param[in] id The ID of the device */ - MSDevice_Example(SUMOVehicle& holder, const std::string& id, SUMOReal customValue1, - SUMOReal customValue2, SUMOReal customValue3); + MSDevice_Example(SUMOVehicle& holder, const std::string& id, double customValue1, + double customValue2, double customValue3); @@ -146,13 +156,13 @@ // private state members of the Example device /// @brief a value which is initialised based on a commandline/configuration option - SUMOReal myCustomValue1; + double myCustomValue1; /// @brief a value which is initialised based on a vehicle parameter - SUMOReal myCustomValue2; + double myCustomValue2; /// @brief a value which is initialised based on a vType parameter - SUMOReal myCustomValue3; + double myCustomValue3; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Tue, 04 Dec 2007 -/// @version $Id: MSDevice.h 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: MSDevice.h 23770 2017-04-02 12:48:48Z behrisch $ /// // Abstract in-vehicle device /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,6 +47,8 @@ class OutputDevice; class SUMOVehicle; class OptionsCont; +class SUMOSAXAttributes; +class MTRand; // =========================================================================== @@ -86,6 +88,12 @@ */ static void buildVehicleDevices(SUMOVehicle& v, std::vector& into); + static MTRand* getEquipmentRNG() { + return &myEquipmentRNG; + } + + /// @brief return the name for this type of device + virtual const std::string deviceName() const = 0; public: @@ -121,13 +129,36 @@ * The device should use the openTag / closeTag methods of the OutputDevice * for correct indentation. * - * @param[in] os The stream to write the information into * @exception IOError not yet implemented */ virtual void generateOutput() const { } + /** @brief Saves the state of the device + * + * The default implementation writes a warning and does nothing. + * @param[in] out The OutputDevice to write the information into + */ + virtual void saveState(OutputDevice& out) const; + + + /** @brief Loads the state of the device from the given description + * + * The default implementation does nothing. + * @param[in] attrs XML attributes describing the current state + */ + virtual void loadState(const SUMOSAXAttributes& attrs); + + /// @brief try to retrieve the given parameter from this device. Throw exception for unsupported key + virtual std::string getParameter(const std::string& key) const { + throw InvalidArgument("Parameter '" + key + "' is not supported for device of type '" + deviceName() + "'"); + } + /// @brief try to set the given parameter for this device. Throw exception for unsupported key + virtual void setParameter(const std::string& key, const std::string& value) { + UNUSED_PARAMETER(value); + throw InvalidArgument("Setting parameter '" + key + "' is not supported for device of type '" + deviceName() + "'"); + } protected: /// @name Helper methods for device assignment @@ -151,18 +182,17 @@ static bool equippedByDefaultAssignmentOptions(const OptionsCont& oc, const std::string& deviceName, SUMOVehicle& v); /// @} - - protected: /// @brief The vehicle that stores the device SUMOVehicle& myHolder; - - private: /// @brief vehicles which explicitly carry a device, sorted by device, first static std::map > myExplicitIDs; + /// @brief A random number generator used to choose from vtype/route distributions and computing the speed factors + static MTRand myEquipmentRNG; + private: /// @brief Invalidated copy constructor. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Routing.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Routing.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Routing.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Routing.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Christoph Sommer /// @author Jakob Erdmann /// @date Tue, 04 Dec 2007 -/// @version $Id: MSDevice_Routing.cpp 21488 2016-09-16 11:20:06Z namdre $ +/// @version $Id: MSDevice_Routing.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // A device that performs vehicle rerouting based on current edge speeds /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,18 +45,14 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member variables // =========================================================================== -std::vector MSDevice_Routing::myEdgeSpeeds; -std::vector > MSDevice_Routing::myPastEdgeSpeeds; +std::vector MSDevice_Routing::myEdgeSpeeds; +std::vector > MSDevice_Routing::myPastEdgeSpeeds; Command* MSDevice_Routing::myEdgeWeightSettingCommand = 0; -SUMOReal MSDevice_Routing::myAdaptationWeight; +double MSDevice_Routing::myAdaptationWeight; int MSDevice_Routing::myAdaptationSteps; int MSDevice_Routing::myAdaptationStepsIndex = 0; SUMOTime MSDevice_Routing::myAdaptationInterval = -1; @@ -65,7 +61,7 @@ std::map, const MSRoute*> MSDevice_Routing::myCachedRoutes; SUMOAbstractRouter* MSDevice_Routing::myRouter = 0; AStarRouter >* MSDevice_Routing::myRouterWithProhibited = 0; -SUMOReal MSDevice_Routing::myRandomizeWeightsFactor = 0; +double MSDevice_Routing::myRandomizeWeightsFactor = 0; #ifdef HAVE_FOX FXWorkerThread::Pool MSDevice_Routing::myThreadPool; #endif @@ -128,11 +124,31 @@ bool MSDevice_Routing::checkOptions(OptionsCont& oc) { + bool ok = true; if (oc.getInt("device.rerouting.adaptation-steps") > 0 && !oc.isDefault("device.rerouting.adaptation-weight")) { WRITE_ERROR("Only one of the options 'device.rerouting.adaptation-steps' or 'device.rerouting.adaptation-weight' may be given."); - return false; + ok = false; + } + if (oc.getFloat("weights.random-factor") < 1) { + WRITE_ERROR("weights.random-factor cannot be less than 1"); + ok = false; + } + if (string2time(oc.getString("device.rerouting.adaptation-interval")) < 0) { + WRITE_ERROR("Negative value for device.rerouting.adaptation-interval!"); + ok = false; + } + if (oc.getFloat("device.rerouting.adaptation-weight") < 0. || + oc.getFloat("device.rerouting.adaptation-weight") > 1.) { + WRITE_ERROR("The value for device.rerouting.adaptation-weight must be between 0 and 1!"); + ok = false; + } +#ifndef HAVE_FOX + if (oc.getInt("device.rerouting.threads") > 1) { + WRITE_ERROR("Parallel routing is only possible when compiled with Fox."); + ok = false; } - return true; +#endif + return ok; } @@ -155,12 +171,12 @@ myAdaptationSteps = oc.getInt("device.rerouting.adaptation-steps"); const MSEdgeVector& edges = MSNet::getInstance()->getEdgeControl().getEdges(); const bool useLoaded = oc.getBool("device.rerouting.init-with-loaded-weights"); - const SUMOReal currentSecond = SIMTIME; + const double currentSecond = SIMTIME; for (MSEdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) { while ((*i)->getNumericalID() >= (int)myEdgeSpeeds.size()) { myEdgeSpeeds.push_back(0); if (myAdaptationSteps > 0) { - myPastEdgeSpeeds.push_back(std::vector()); + myPastEdgeSpeeds.push_back(std::vector()); } } if (useLoaded) { @@ -169,34 +185,19 @@ myEdgeSpeeds[(*i)->getNumericalID()] = (*i)->getMeanSpeed(); } if (myAdaptationSteps > 0) { - myPastEdgeSpeeds[(*i)->getNumericalID()] = std::vector(myAdaptationSteps, myEdgeSpeeds[(*i)->getNumericalID()]); + myPastEdgeSpeeds[(*i)->getNumericalID()] = std::vector(myAdaptationSteps, myEdgeSpeeds[(*i)->getNumericalID()]); } } myLastAdaptation = MSNet::getInstance()->getCurrentTimeStep(); myRandomizeWeightsFactor = oc.getFloat("weights.random-factor"); - if (myRandomizeWeightsFactor < 1) { - WRITE_ERROR("weights.random-factor cannot be less than 1"); - } -#ifndef HAVE_FOX - if (oc.getInt("device.rerouting.threads") > 1) { - WRITE_ERROR("Parallel routing is only possible when compiled with Fox."); - } -#endif } // make the weights be updated if (myAdaptationInterval == -1) { myAdaptationInterval = string2time(oc.getString("device.rerouting.adaptation-interval")); - if (myAdaptationInterval < 0) { - WRITE_ERROR("Negative value for device.rerouting.adaptation-interval!"); - } myAdaptationWeight = oc.getFloat("device.rerouting.adaptation-weight"); - if (myAdaptationWeight < 0. || myAdaptationWeight > 1.) { - WRITE_ERROR("The value for device.rerouting.adaptation-weight must be between 0 and 1!"); - } if (myAdaptationWeight < 1. && myAdaptationInterval > 0) { myEdgeWeightSettingCommand = new StaticCommand(&MSDevice_Routing::adaptEdgeEfforts); - MSNet::getInstance()->getEndOfTimestepEvents()->addEvent( - myEdgeWeightSettingCommand, 0, MSEventControl::ADAPT_AFTER_EXECUTION); + MSNet::getInstance()->getEndOfTimestepEvents()->addEvent(myEdgeWeightSettingCommand); } else if (period > 0) { WRITE_WARNING("Rerouting is useless if the edge weights do not get updated!"); } @@ -218,10 +219,8 @@ // we do always a pre insertion reroute for trips to fill the best lanes of the vehicle with somehow meaningful values (especially for deaprtLane="best") myRerouteCommand = new WrappingCommand(this, &MSDevice_Routing::preInsertionReroute); // if we don't update the edge weights, we might as well reroute now and hopefully use our threads better - const SUMOTime execTime = myEdgeWeightSettingCommand == 0 ? 0 : holder.getParameter().depart; - MSNet::getInstance()->getInsertionEvents()->addEvent( - myRerouteCommand, execTime, - MSEventControl::ADAPT_AFTER_EXECUTION); + const SUMOTime execTime = myEdgeWeightSettingCommand == 0 ? -1 : holder.getParameter().depart; + MSNet::getInstance()->getInsertionEvents()->addEvent(myRerouteCommand, execTime); } } @@ -235,7 +234,7 @@ bool -MSDevice_Routing::notifyEnter(SUMOVehicle& /*veh*/, MSMoveReminder::Notification reason) { +MSDevice_Routing::notifyEnter(SUMOVehicle& /*veh*/, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { if (reason == MSMoveReminder::NOTIFICATION_DEPARTED) { // clean up pre depart rerouting if (myPreInsertionPeriod > 0) { @@ -246,8 +245,7 @@ if (myPeriod > 0) { myRerouteCommand = new WrappingCommand(this, &MSDevice_Routing::wrappedRerouteCommandExecute); MSNet::getInstance()->getBeginOfTimestepEvents()->addEvent( - myRerouteCommand, myPeriod + MSNet::getInstance()->getCurrentTimeStep(), - MSEventControl::ADAPT_AFTER_EXECUTION); + myRerouteCommand, myPeriod + MSNet::getInstance()->getCurrentTimeStep()); } } return false; @@ -267,9 +265,6 @@ if (myCachedRoutes[key]->size() > 2) { myHolder.replaceRoute(myCachedRoutes[key], true); return myPreInsertionPeriod; - } else { - WRITE_WARNING("No route for vehicle '" + myHolder.getID() + "' found."); - return myPreInsertionPeriod; } } } @@ -285,13 +280,13 @@ } -SUMOReal -MSDevice_Routing::getEffort(const MSEdge* const e, const SUMOVehicle* const v, SUMOReal) { +double +MSDevice_Routing::getEffort(const MSEdge* const e, const SUMOVehicle* const v, double) { const int id = e->getNumericalID(); if (id < (int)myEdgeSpeeds.size()) { - SUMOReal effort = MAX2(e->getLength() / myEdgeSpeeds[id], e->getMinimumTravelTime(v)); + double effort = MAX2(e->getLength() / MAX2(myEdgeSpeeds[id], NUMERICAL_EPS), e->getMinimumTravelTime(v)); if (myRandomizeWeightsFactor != 1) { - effort *= RandHelper::rand((SUMOReal)1, myRandomizeWeightsFactor); + effort *= RandHelper::rand((double)1, myRandomizeWeightsFactor); } return effort; } @@ -299,7 +294,7 @@ } -SUMOReal +double MSDevice_Routing::getAssumedSpeed(const MSEdge* edge) { return edge->getLength() / getEffort(edge, 0, 0); } @@ -320,17 +315,17 @@ // moving average for (MSEdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) { const int id = (*i)->getNumericalID(); - const SUMOReal currSpeed = (*i)->getMeanSpeed(); + const double currSpeed = (*i)->getMeanSpeed(); myEdgeSpeeds[id] += (currSpeed - myPastEdgeSpeeds[id][myAdaptationStepsIndex]) / myAdaptationSteps; myPastEdgeSpeeds[id][myAdaptationStepsIndex] = currSpeed; } myAdaptationStepsIndex = (myAdaptationStepsIndex + 1) % myAdaptationSteps; } else { // exponential moving average - const SUMOReal newWeightFactor = (SUMOReal)(1. - myAdaptationWeight); + const double newWeightFactor = (double)(1. - myAdaptationWeight); for (MSEdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) { const int id = (*i)->getNumericalID(); - const SUMOReal currSpeed = (*i)->getMeanSpeed(); + const double currSpeed = (*i)->getMeanSpeed(); if (currSpeed != myEdgeSpeeds[id]) { myEdgeSpeeds[id] = myEdgeSpeeds[id] * myAdaptationWeight + currSpeed * newWeightFactor; } @@ -406,10 +401,10 @@ MSEdge::getAllEdges(), true, &MSDevice_Routing::getEffort, myHolder.getVClass(), weightPeriod, false); } } else if (routingAlgorithm == "CHWrapper") { - const SUMOTime begin = string2time(oc.getString("begin")); const SUMOTime weightPeriod = myAdaptationInterval > 0 ? myAdaptationInterval : std::numeric_limits::max(); myRouter = new CHRouterWrapper >( - MSEdge::getAllEdges(), true, &MSDevice_Routing::getEffort, begin, weightPeriod); + MSEdge::getAllEdges(), true, &MSDevice_Routing::getEffort, + string2time(oc.getString("begin")), string2time(oc.getString("end")), weightPeriod, oc.getInt("device.rerouting.threads")); } else { throw ProcessError("Unknown routing algorithm '" + routingAlgorithm + "'!"); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Routing.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Routing.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Routing.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Routing.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Tue, 04 Dec 2007 -/// @version $Id: MSDevice_Routing.h 20890 2016-06-06 12:29:01Z namdre $ +/// @version $Id: MSDevice_Routing.h 24108 2017-04-27 18:43:30Z behrisch $ /// // A device that performs vehicle rerouting based on current edge speeds /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -160,9 +160,14 @@ * @see MSEventHandler * @see WrappingCommand */ - bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason); + bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /// @} + /// @brief return the name for this type of device + const std::string deviceName() const { + return "rerouting"; + } + /// @brief initiate the rerouting, create router / thread pool on first use void reroute(const SUMOTime currentTime, const bool onInit = false); @@ -181,7 +186,7 @@ } /// @brief return current travel speed assumption - static SUMOReal getAssumedSpeed(const MSEdge* edge); + static double getAssumedSpeed(const MSEdge* edge); private: @@ -279,7 +284,7 @@ * @return The effort (time to pass in this case) for an edge * @see DijkstraRouterTT_ByProxi */ - static SUMOReal getEffort(const MSEdge* const e, const SUMOVehicle* const v, SUMOReal t); + static double getEffort(const MSEdge* const e, const SUMOVehicle* const v, double t); @@ -321,10 +326,10 @@ static Command* myEdgeWeightSettingCommand; /// @brief The container of edge speeds - static std::vector myEdgeSpeeds; + static std::vector myEdgeSpeeds; /// @brief Information which weight prior edge efforts have - static SUMOReal myAdaptationWeight; + static double myAdaptationWeight; /// @brief At which time interval the edge weights get updated static SUMOTime myAdaptationInterval; @@ -339,7 +344,7 @@ static int myAdaptationStepsIndex; /// @brief The container of edge speeds - static std::vector > myPastEdgeSpeeds; + static std::vector > myPastEdgeSpeeds; /// @brief whether taz shall be used at initial rerouting static bool myWithTaz; @@ -354,7 +359,7 @@ static AStarRouter >* myRouterWithProhibited; /// @brief Whether to disturb edge weights dynamically - static SUMOReal myRandomizeWeightsFactor; + static double myRandomizeWeightsFactor; #ifdef HAVE_FOX static FXWorkerThread::Pool myThreadPool; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_SSM.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_SSM.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_SSM.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_SSM.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,1217 @@ +/****************************************************************************/ +/// @file MSDevice_SSM.cpp +/// @author Daniel Krajzewicz +/// @author Michael Behrisch +/// @author Jakob Erdmann +/// @date 11.06.2013 +/// @version $Id: MSDevice_SSM.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +// A device which stands as an implementation example and which outputs movereminder calls +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "MSDevice_SSM.h" + + +// Debug constants +#define DEBUG_SSM + +// =========================================================================== +// Constants +// =========================================================================== +// value indicating an invalid double parameter +#define INVALID -std::numeric_limits::max() +// default value for the maximal episode length for logged encounters +#define DEFAULT_FREQUENCY 30.0 +// default value for the detection range of potential opponents +#define DEFAULT_RANGE 50.0 + +// list of implemented SSMs (NOTE: To add more SSMs identifiers are added to AVAILABLE_SSMS +// and a default threshold must be defined. A corresponding +// case should be added to the switch in buildVehicleDevices) +#define AVAILABLE_SSMS "TTC DRAC PET" +#define DEFAULT_THRESHOLD_TTC 3. // in [s.], events get logged if below threshold +#define DEFAULT_THRESHOLD_DRAC 4. // in [m/s^2], events get logged if above threshold +#define DEFAULT_THRESHOLD_PET 2. // in seconds, events get logged if below threshold + +// =========================================================================== +// method definitions +// =========================================================================== +// --------------------------------------------------------------------------- +// static initialisation methods +// --------------------------------------------------------------------------- + +std::set* MSDevice_SSM::instances = new std::set(); + +const std::set& +MSDevice_SSM::getInstances() { + return *instances; +} + +void +MSDevice_SSM::cleanup() { + // Close current encounters and flush conflicts to file for all existing devices + if (instances != 0) { + for (std::set::iterator ii = instances->begin(); ii != instances->end(); ++ii) { + static_cast(*ii)->resetEncounters(); + static_cast(*ii)->flushConflicts(true); + } + instances->clear(); + } +} + +void +MSDevice_SSM::insertOptions(OptionsCont& oc) { + oc.addOptionSubTopic("SSM Device"); + insertDefaultAssignmentOptions("ssm", "SSM Device", oc); + + // custom options + oc.doRegister("device.ssm.measures", new Option_String("")); + oc.addDescription("device.ssm.measures", "SSM Device", "Specifies which measures will be logged (as a space seperated sequence of IDs in ('TTC', 'DRAC', 'PET'))."); + oc.doRegister("device.ssm.thresholds", new Option_String("")); + oc.addDescription("device.ssm.thresholds", "SSM Device", "Specifies thresholds corresponding to the specified measures (see documentation and watch the order!). Only events exceeding the thresholds will be logged."); + oc.doRegister("device.ssm.trajectories", new Option_Bool(false)); + oc.addDescription("device.ssm.trajectories", "SSM Device", "Specifies whether trajectories will be logged (if false, only the extremal values and times are reported)."); + oc.doRegister("device.ssm.frequency", new Option_Float(DEFAULT_FREQUENCY)); + oc.addDescription("device.ssm.frequency", "SSM Device", "Specifies the maximal length of stored conflict trajectories in seconds (the frequency of logging, default is " + toString(DEFAULT_FREQUENCY) + "s.)."); + oc.doRegister("device.ssm.range", new Option_Float(DEFAULT_RANGE)); + oc.addDescription("device.ssm.range", "SSM Device", "Specifies the detection range in meters (default is " + toString(DEFAULT_RANGE) + "m.). For vehicles below this distance from the equipped vehicle, SSM values are traced."); +} + +void +MSDevice_SSM::buildVehicleDevices(SUMOVehicle& v, std::vector& into) { + if (equippedByDefaultAssignmentOptions(OptionsCont::getOptions(), "ssm", v)) { + if (MSGlobals::gUseMesoSim) { + WRITE_WARNING("SSM Device for vehicle '" + v.getID() + "' will not be built. (SSMs not supported in MESO)"); + return; + } + // ID for the device + std::string deviceID = "ssm_" + v.getID(); + + // Load parameters: + + // Measures and thresholds + std::vector thresholds; + std::vector measures; + bool success = getMeasuresAndThresholds(v, deviceID, thresholds, measures); + if (!success) { + return; + } + + // Trajectories + bool trajectories = requestsTrajectories(v); + + // logging frequency + double frequency = getLoggingFrequency(v); + + // detection range + double range = getDetectionRange(v); + + // File + std::string file = getOutputFilename(v, deviceID); + + // Build the device (XXX: who deletes it?) + MSDevice_SSM* device = new MSDevice_SSM(v, deviceID, file, measures, thresholds, trajectories, frequency, range); + into.push_back(device); + } +} + + +MSDevice_SSM::Encounter::Encounter(const MSVehicle* _ego, const MSVehicle* const _foe, double _begin) : + ego(_ego), + foe(_foe), + begin(_begin), + end(INVALID), + type(ENCOUNTER_TYPE_NOCONFLICT) { +#ifdef DEBUG_SSM + std::cout << "\n" << SIMTIME << " Constructing encounter of '" + << ego->getID() << "' and '" << foe->getID() << "'" << std::endl; +#endif +} + +MSDevice_SSM::Encounter::~Encounter() { +#ifdef DEBUG_SSM + std::cout << "\n" << SIMTIME << " Destroying encounter of '" + << ego->getID() << "' and '" << foe->getID() << "' (begin was " << begin << ")" << std::endl; +#endif +} + + +void +MSDevice_SSM::Encounter::add(double time, Position egoX, Position egoV, Position foeX, Position foeV) { + this->timespan.push_back(time); + this->egoTrajectory.x.push_back(egoX); + this->egoTrajectory.v.push_back(egoV); + this->foeTrajectory.x.push_back(foeX); + this->foeTrajectory.v.push_back(foeV); +} + +void +MSDevice_SSM::updateAndWriteOutput() { + if (myHolder.isOnRoad()) { + update(); + flushConflicts(); + } else { + resetEncounters(); + flushConflicts(true); + } +} + +void +MSDevice_SSM::update() { +#ifdef DEBUG_SSM + std::cout << "\n" << SIMTIME << " Device '" << getID() << "' update()\n" + << "Size of myActiveEncounters: " << myActiveEncounters.size() + << "\nSize of myPastConflicts: " << myPastConflicts.size() + << std::endl; +#endif + // Scan surroundings for other vehicles + FoeInfoMap foes; + findSurroundingVehicles(*myHolderMS, myRange, foes); + + // Update encounters and conflicts -> removes all foes (and deletes corresponding FoeInfos) for which already a corresponding encounter exists + processEncounters(foes); + + // Make new encounters for all foes, which were not removed by processEncounters (and deletes corresponding FoeInfos) + createEncounters(foes); + foes.clear(); + + // Write out past conflicts + flushConflicts(); + +} + +void +MSDevice_SSM::createEncounters(FoeInfoMap& foes) { +#ifdef DEBUG_SSM + std::cout << "\n" << SIMTIME << " Device '" << getID() << "' createEncounters()" << std::endl; + std::cout << "New foes:\n"; + for (FoeInfoMap::const_iterator vi = foes.begin(); vi != foes.end(); ++vi) { + std::cout << vi->first->getID() << "\n"; + } + std::cout << std::endl; +#endif + + for (FoeInfoMap::const_iterator foe = foes.begin(); foe != foes.end(); ++foe) { + std::pair conflictLanes; + Encounter* e = new Encounter(myHolderMS, foe->first, SIMTIME); + updateEncounter(e, foe->second); // deletes foe->second + myActiveEncounters.push_back(e); + } +} + +void +MSDevice_SSM::resetEncounters() { + // Call processEncounters() with empty vehicle set + FoeInfoMap foes; + // processEncounters with empty argument closes all encounters + processEncounters(foes); +} + +void +MSDevice_SSM::processEncounters(FoeInfoMap& foes) { +#ifdef DEBUG_SSM + std::cout << "\n" << SIMTIME << " Device '" << getID() << "' processEncounters()" << std::endl; + std::cout << "Currently present foes:\n"; + for (FoeInfoMap::const_iterator vi = foes.begin(); vi != foes.end(); ++vi) { + std::cout << vi->first->getID() << "\n"; + } + std::cout << std::endl; +#endif + + // Run through active encounters. If corresponding foe is still present in foes update and + // remove foe from foes. If the foe has disappeared close the encounter (check if it qualifies + // as a conflict and in case transfer it to myPastConflicts). + // Afterwards run through remaining elements in foes and create new encounters for them. + + EncounterVector::iterator ei = myActiveEncounters.begin(); + while (ei != myActiveEncounters.end()) { + Encounter* e = *ei; + if (foes.find(e->foe) != foes.end()) { + FoeInfo* foeInfo = foes[e->foe]; + // Update encounter + updateEncounter(e, foeInfo); // deletes foeInfo + // Erase foes which were already encountered + foes.erase(e->foe); + ++ei; + } else { + // Close encounter + closeEncounter(e); + if (qualifiesAsConflict(e)) { + myPastConflicts.push(e); + } else { + delete e; + } + ei = myActiveEncounters.erase(ei); + } + } + +} + + +bool +MSDevice_SSM::qualifiesAsConflict(Encounter* e) { + // TODO: Check if conflict measure thresholds are exceeded +#ifdef DEBUG_SSM + std::cout << SIMTIME << " qualifiesAsConflict() for encounter of vehicles '" + << e->ego->getID() << "' and '" << e->foe->getID() + << "'" << std::endl; +#endif + return true; +} + + +void +MSDevice_SSM::closeEncounter(Encounter* e) { + // TODO: is there anything specific to do here? +#ifdef DEBUG_SSM + std::cout << SIMTIME << " closeEncounter() of vehicles '" + << e->ego->getID() << "' and '" << e->foe->getID() + << "'" << std::endl; +#endif + return; +} + +void +MSDevice_SSM::updateEncounter(Encounter* e, FoeInfo* foeInfo) { +#ifdef DEBUG_SSM + std::cout << SIMTIME << " updateEncounter() of vehicles '" + << e->ego->getID() << "' and '" << e->foe->getID() + << "'" << std::endl; +#endif + + // init encounter type with most general identifier + EncounterType type; + UNUSED_PARAMETER(type); // is currently written but never read + + // Add current states to trajectories + e->add(SIMTIME, e->ego->getPosition(), e->ego->getVelocityVector(), e->foe->getPosition(), e->foe->getVelocityVector()); + + // Ego's current Lane + const MSLane* egoLane = e->ego->getLane(); + // Foe's current Lane + const MSLane* foeLane = e->foe->getLane(); + + // Ego's conflict lane is memorized in foeInfo + const MSLane* egoConflictLane = foeInfo->egoConflictLane; + double egoDistToConflictLane = foeInfo->egoDistToConflictLane; + // Find conflicting lane and the distance to its entry link for the foe + double foeDistToConflictLane; + const MSLane* foeConflictLane = findFoeConflictLane(e->foe, foeInfo->egoConflictLane, foeDistToConflictLane); + +#ifdef DEBUG_SSM + std::cout << "egoConflictLane: '" << (egoConflictLane == 0 ? "NULL" : egoConflictLane->getID()) << "'\n" + << "foeConflictLane: '" << (foeConflictLane == 0 ? "NULL" : foeConflictLane->getID()) << "'" + << "\nEgo's distance to conflict lane: " << egoDistToConflictLane + << "\nFoe's distance to conflict lane: " << foeDistToConflictLane + << std::endl; +#endif + + // Treat different cases for foeConflictLane and egoConflictLane (internal or non-internal / equal to egoLane or to foeLane), + // and thereby determine encounterType and the ego/foeEncounterDistance. + // The encounter distance has a different meaning for different types of encounters: + // 1) For rear-end conflicts (lead/follow situations) the follower's encounter distance is the distance to the actual back position of the leader. The leaders's distance is undefined. + // 2) For merging encounters the encounter distance is the distance until the begin of the common target edge/lane. + // 3) For crossing encounters the encounter distance is the distance until crossing point of the conflicting lanes. + double egoEncounterDist = INVALID; + double foeEncounterDist = INVALID; + + if (foeConflictLane == 0) { + // foe vehicle is not on course towards the ego's route (see findFoeConflictLane) + type = ENCOUNTER_TYPE_NOCONFLICT; +#ifdef DEBUG_SSM + std::cout << "-> Encounter type: No conflict." << std::endl; +#endif + } else if (!egoConflictLane->isInternal()) { + // The conflict lane is non-internal, therefore we either have no potential conflict or a lead/follow situation (i.e., no crossing or merging) + if (egoConflictLane == egoLane) { + // The conflict point is on the ego's current lane. + if (foeLane == egoLane) { + // Foe is on the same non-internal lane + type = ENCOUNTER_TYPE_FOLLOWING; // TODO: specify: check for leader / follower +#ifdef DEBUG_SSM + std::cout << "-> Encounter type: Lead/follow-situation on non-internal lane '" << egoLane->getID() << "'" << std::endl; +#endif + } else if (&(foeLane->getEdge()) == &(egoLane->getEdge())) { + // Foe is on the same non-internal edge but not on the same lane. Treat this as no conflict for now + // XXX: this disregards conflicts for vehicles on adjacent lanes + type = ENCOUNTER_TYPE_NOCONFLICT; +#ifdef DEBUG_SSM + std::cout << "-> Encounter type: No conflict (adjacent lanes)." << std::endl; +#endif + } else { + // Foe must be on a route leading into the ego's lane + type = ENCOUNTER_TYPE_FOLLOWING_LEADER; + foeEncounterDist = foeDistToConflictLane + e->ego->getBackPositionOnLane(); +#ifdef DEBUG_SSM + std::cout << "-> Encounter type: Ego '" << e->ego->getID() << "' on lane '" << egoLane->getID() << "' leads foe '" + << e->foe->getID() << "' on lane '" << foeLane->getID() << "'" + << " (gap = " << foeEncounterDist << ")" + << std::endl; +#endif + assert(foeConflictLane == egoLane); + } + } else { + // The egoConflictLane is a non-internal lane which is not the ego's current lane. Thus it must lie ahead of the ego vehicle and equal the foe's current lane. + // see finSurroundingVehicles() (otherwise the foe would have had to enter the ego's route along a junction and the corresponding + // conflict lane would be internal) + type = ENCOUNTER_TYPE_FOLLOWING_FOLLOWER; + egoEncounterDist = egoDistToConflictLane + e->foe->getBackPositionOnLane(); +#ifdef DEBUG_SSM + std::cout << "-> Encounter type: Ego '" << e->ego->getID() << "' on lane '" << egoLane->getID() << "' follows foe '" + << e->foe->getID() << "' on lane '" << foeLane->getID() << "'" + << " (gap = " << egoEncounterDist << ")" + << std::endl; +#endif + assert(foeLane == egoConflictLane); + assert(foeDistToConflictLane <= 0); + } + } else { + // egoConflictLane is internal, i.e., lies on a junction. Besides the lead/follow situation (which may stretch over different lanes of a connection), + // merging or crossing of the conflict lanes is possible. + MSLink* egoEntryLink = egoConflictLane->getEntryLink(); + MSLink* foeEntryLink = foeConflictLane->getEntryLink(); + if (&(egoEntryLink->getViaLane()->getEdge()) == &(foeEntryLink->getViaLane()->getEdge())) { + if (egoEntryLink != foeEntryLink) { + // XXX: this disregards conflicts for vehicles on adjacent lanes + type = ENCOUNTER_TYPE_NOCONFLICT; +#ifdef DEBUG_SSM + std::cout << "-> Encounter type: No conflict (adjacent lanes)." << std::endl; +#endif + } else { + // Lead / follow situation on connection + if (egoLane == egoConflictLane && foeLane != foeConflictLane) { + // ego on junction, foe not yet + type = ENCOUNTER_TYPE_FOLLOWING_LEADER; + foeEncounterDist = foeDistToConflictLane + e->ego->getBackPositionOnLane(); +#ifdef DEBUG_SSM + std::cout << "-> Encounter type: Ego '" << e->ego->getID() << "' on lane '" << egoLane->getID() << "' leads foe '" + << e->foe->getID() << "' on lane '" << foeLane->getID() << "'" + << " (gap = " << foeEncounterDist << ")" + << std::endl; +#endif + } else if (egoLane != egoConflictLane && foeLane == foeConflictLane) { + // foe on junction, ego not yet + type = ENCOUNTER_TYPE_FOLLOWING_FOLLOWER; + egoEncounterDist = egoDistToConflictLane + e->foe->getBackPositionOnLane(); +#ifdef DEBUG_SSM + std::cout << "-> Encounter type: Ego '" << e->ego->getID() << "' on lane '" << egoLane->getID() << "' follows foe '" + << e->foe->getID() << "' on lane '" << foeLane->getID() << "'" + << " (gap = " << egoEncounterDist << ")" + << std::endl; +#endif + } else { + // Both must be already on the junction in a lead / follow situation on a connection + // (since they approach via the same link, findSurroundingVehicles() would have determined a + // different conflictLane if both are not on the junction) + assert(egoLane == egoConflictLane); + assert(foeLane == foeConflictLane); + type = ENCOUNTER_TYPE_FOLLOWING; // TODO: specify: check for leader / follower +#ifdef DEBUG_SSM + std::cout << "-> Encounter type: Lead/follow-situation on connection from '" << egoEntryLink->getLaneBefore()->getID() + << "' to '" << egoEntryLink->getLane()->getID() << "'" << std::endl; +#endif + } + } + } else { + // Entry links to junctions lead to different internal edges. + // There are three possibilities, either the edges cross, merge or have no conflict + const std::vector& egoFoeLinks = egoEntryLink->getFoeLinks(); + const std::vector& foeFoeLinks = foeEntryLink->getFoeLinks(); + // Determine whether ego and foe links are foes + bool crossOrMerge = (find(egoFoeLinks.begin(), egoFoeLinks.end(), foeEntryLink) != egoFoeLinks.end() + || find(foeFoeLinks.begin(), foeFoeLinks.end(), egoEntryLink) != foeFoeLinks.end()); + if (!crossOrMerge) { + if (&(foeEntryLink->getLane()->getEdge()) == &(egoEntryLink->getLane()->getEdge())) { + // XXX: the situation of merging into adjacent lanes is disregarded for now + type = ENCOUNTER_TYPE_NOCONFLICT; +#ifdef DEBUG_SSM + std::cout << "-> Encounter type: No conflict (adjacent lanes)." << std::endl; +#endif + } else { + type = ENCOUNTER_TYPE_NOCONFLICT; +#ifdef DEBUG_SSM + std::cout << "-> Encounter type: No conflict." << std::endl; +#endif + } + } else if (foeEntryLink->getLane() == egoEntryLink->getLane()) { + type = ENCOUNTER_TYPE_MERGING; // TODO: determine projected lead/follow, conflict entries, etc. + egoEncounterDist = egoDistToConflictLane + egoEntryLink->getInternalLengthsAfter(); + foeEncounterDist = foeDistToConflictLane + foeEntryLink->getInternalLengthsAfter(); +#ifdef DEBUG_SSM + std::cout << "-> Encounter type: Merging situation of ego '" << e->ego->getID() << "' on lane '" << egoLane->getID() << "' and foe '" + << e->foe->getID() << "' on lane '" << foeLane->getID() << "'" + << "\nDistances to merge-point: ego: " << egoEncounterDist << ", foe: " << foeEncounterDist + << std::endl; +#endif + } else { + type = ENCOUNTER_TYPE_CROSSING; // TODO: determine projected lead/follow, conflict entries, etc. + // XXX: GO ON HERE, implement MSLink::getLengthBeforeCrossing() + egoEncounterDist = egoDistToConflictLane + egoEntryLink->getLengthBeforeCrossing(foeEntryLink); + foeEncounterDist = foeDistToConflictLane + foeEntryLink->getLengthBeforeCrossing(egoEntryLink); +#ifdef DEBUG_SSM + std::cout << "-> Encounter type: Crossing situation of ego '" << e->ego->getID() << "' on lane '" << egoLane->getID() << "' and foe '" + << e->foe->getID() << "' on lane '" << foeLane->getID() << "'" + << "\nDistances to crossing-point: ego: " << egoEncounterDist << ", foe: " << foeEncounterDist + << std::endl; +#endif + } + } + } + // free foeInfo + delete foeInfo; + + // Compute SSMs + computeSSMs(e); + +} + +const MSLane* +MSDevice_SSM::findFoeConflictLane(const MSVehicle* foe, const MSLane* egoConflictLane, double& distToConflictLane) { + +#ifdef DEBUG_SSM + std::cout << SIMTIME << " findFoeConflictLane() for foe '" + << foe->getID() << "' on lane '" << foe->getLane()->getID() << "'" + << std::endl; +#endif + MSLane* foeLane = foe->getLane(); + std::vector::const_iterator laneIter = foe->getBestLanesContinuation().begin(); + std::vector::const_iterator foeBestLanesEnd = foe->getBestLanesContinuation().end(); + assert(foeLane->isInternal() || *laneIter == foeLane); + distToConflictLane = -foe->getPositionOnLane(); + + // Potential conflict lies on junction if egoConflictLane is internal + const MSJunction* conflictJunction = egoConflictLane->isInternal() ? egoConflictLane->getEdge().getToJunction() : 0; +#ifdef DEBUG_SSM + if (conflictJunction != 0) { + std::cout << "Potential conflict on junction '" << conflictJunction->getID() + << std::endl; + } +#endif + if (foeLane->isInternal() && foeLane->getEdge().getToJunction() == conflictJunction) { + // foe is already on the conflict junction + return foeLane; + } + + // Foe is not on the conflict junction + + // Leading internal lanes in bestlanes are resembled as NULL-pointers skip them + while (laneIter != foeBestLanesEnd && *laneIter == 0) { + assert(foeLane->isInternal()); + distToConflictLane += foeLane->getLength(); + foeLane = foeLane->getLinkCont()[0]->getViaLane(); + ++laneIter; + } + + // Look for the junction downstream along foeBestLanes + while (laneIter != foeBestLanesEnd && distToConflictLane <= myRange) { + // Eventual internal lanes were skipped + foeLane = *laneIter; + assert(!foeLane->isInternal()); + if (&foeLane->getEdge() == &egoConflictLane->getEdge()) { +#ifdef DEBUG_SSM + std::cout << "Found conflict lane for foe: '" << foeLane->getID() << "'" << std::endl; +#endif + // found the potential conflict edge along foeBestLanes + return foeLane; + } + // No conflict on foeLane + distToConflictLane += foeLane->getLength(); + + // set laneIter to next non internal lane along foeBestLanes + ++laneIter; + if (laneIter == foeBestLanesEnd) { + return 0; + } + MSLane* nextNonInternalLane = *laneIter; + MSLink* link = foeLane->getLinkTo(nextNonInternalLane); + // Set foeLane to first internal lane on the next junction + foeLane = link->getViaLane(); + assert(foeLane->isInternal()); + if (foeLane->getEdge().getToJunction() == conflictJunction) { +#ifdef DEBUG_SSM + std::cout << "Found conflict lane for foe: '" << foeLane->getID() << "'" << std::endl; +#endif + // found egoConflictLane, resp. the conflict junction, along foeBestLanes + return foeLane; + } + // No conflict on junction + distToConflictLane += link->getInternalLengthsAfter(); + foeLane = nextNonInternalLane; + } + // Didn't find conflicting lane on foeBestLanes within range. + return 0; +} + + +void +MSDevice_SSM::computeSSMs(Encounter* e) { + // TODO +#ifdef DEBUG_SSM + std::cout << SIMTIME << " computeSSMs() for vehicles '" + << e->ego->getID() << "' and '" << e->foe->getID() + << "'" << std::endl; +#endif + + // Determine situation type. Can be: + // 1) following + // 2) crossing / merging (only one vehicle before conflict point) + // 3) crossing / merging (both before conflict point) + // 4) non-interacting + // 5) collision + // For each of 1),3),4), we have two subtypes, one where the ego is leader and one, where it is follower. + // In general a situation develops as (3)->(2)->(1/4/5) or as some part starting later. + + + +} + +void +MSDevice_SSM::flushConflicts(bool flushAll) { +#ifdef DEBUG_SSM + std::cout << "\n" << SIMTIME << " Device '" << getID() << "' flushConflicts()" << std::endl; +#endif + double t = SIMTIME; + while (!myPastConflicts.empty()) { + if (flushAll || myPastConflicts.top()->begin <= t - myFrequency) { + writeOutConflict(myPastConflicts.top()); + delete myPastConflicts.top(); + myPastConflicts.pop(); + } else { + break; + } + } +} + + +void +MSDevice_SSM::writeOutConflict(Encounter* e) { +#ifdef DEBUG_SSM + std::cout << SIMTIME << "writeOutConflict() of vehicles '" + << e->ego->getID() << "' and '" << e->foe->getID() + << "'" << std::endl; +#endif + myOutputFile->openTag("conflict"); + myOutputFile->writeAttr("begin", e->begin).writeAttr("end", e->end); + myOutputFile->writeAttr("ego", e->ego->getID()).writeAttr("foe", e->foe->getID()); + + myOutputFile->openTag("timespan").writeAttr("values", e->timespan).closeTag(); + + myOutputFile->openTag("egoTrajectory"); + myOutputFile->writeAttr("x", toString(e->egoTrajectory.x)); + myOutputFile->writeAttr("v", toString(e->egoTrajectory.v)); + myOutputFile->closeTag(); + + myOutputFile->openTag("foeTrajectory"); + myOutputFile->writeAttr("x", toString(e->foeTrajectory.x)); + myOutputFile->writeAttr("v", toString(e->foeTrajectory.v)); + myOutputFile->closeTag(); + + // TODO: output SSMs when implemented + + myOutputFile->closeTag(); +} + + + + + +// --------------------------------------------------------------------------- +// MSDevice_SSM-methods +// --------------------------------------------------------------------------- +MSDevice_SSM::MSDevice_SSM(SUMOVehicle& holder, const std::string& id, std::string outputFilename, std::vector measures, std::vector thresholds, + bool trajectories, double frequency, double range) : + MSDevice(holder, id), + myMeasures(measures), + myThresholds(thresholds), + mySaveTrajectories(trajectories), + myFrequency(frequency), + myRange(range) { + // Take care! Holder is currently being constructed. Cast occurs before completion. + myHolderMS = static_cast(&holder); + + myComputeTTC = find(myMeasures.begin(), myMeasures.end(), "TTC") != myMeasures.end(); + myComputeDRAC = find(myMeasures.begin(), myMeasures.end(), "DRAC") != myMeasures.end(); + myComputePET = find(myMeasures.begin(), myMeasures.end(), "PET") != myMeasures.end(); + + maxTrajectorySize = (int)std::ceil(myFrequency / TS) + 1; + myActiveEncounters = EncounterVector(); + myPastConflicts = EncounterQueue(); + + // XXX: Who deletes the OutputDevice? + myOutputFile = &OutputDevice::getDevice(outputFilename); +// myOutputFile.writeXMLHeader("ssm_log", "ssm_log.xsd"); + myOutputFile->openTag("ssm_log"); + + // register at static instance container + instances->insert(this); + +#ifdef DEBUG_SSM + std::cout << "Initialized ssm device '" << id << "' with " + << "myMeasures=" << joinToString(myMeasures, " ") + << ", myThresholds=" << joinToString(myThresholds, " ") + << ", mySaveTrajectories=" << mySaveTrajectories << ", myFrequency=" << myFrequency + << ", myRange=" << myRange << ", output file=" << outputFilename << "\n"; +#endif +} + + +/// @brief Destructor. +MSDevice_SSM::~MSDevice_SSM() { + // XXX: Who deletes this device? + // unregister from static instance container + instances->erase((MSDevice*) this); + resetEncounters(); + flushConflicts(true); +} + + +bool +MSDevice_SSM::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { +#ifdef DEBUG_SSM + std::cout << "device '" << getID() << "' notifyEnter: reason=" << reason << " currentEdge=" << veh.getLane()->getEdge().getID() << "\n"; +#endif + return true; // keep the device +} + +bool +MSDevice_SSM::notifyLeave(SUMOVehicle& veh, double /*lastPos*/, + MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { +#ifdef DEBUG_SSM + std::cout << "device '" << getID() << "' notifyLeave: reason=" << reason << " currentEdge=" << veh.getLane()->getEdge().getID() << "\n"; +#endif + return true; // keep the device +} + +bool +MSDevice_SSM::notifyMove(SUMOVehicle& /* veh */, double /* oldPos */, + double /* newPos */, double newSpeed) { +#ifdef DEBUG_SSM + std::cout << "device '" << getID() << "' notifyMove: newSpeed=" << newSpeed << "\n"; +#endif + return true; // keep the device +} + + +void +MSDevice_SSM::findSurroundingVehicles(const MSVehicle& veh, double range, FoeInfoMap& foeCollector) { +#ifdef DEBUG_SSM + std::cout << SIMTIME << " Looking for surrounding vehicles for ego vehicle '" << veh.getID() + << "' on edge '" << veh.getLane()->getEdge().getID() + << "'." + << "\nVehicle's best lanes = " << toString(veh.getBestLanesContinuation()) + << std::endl; +#endif + + if (!veh.isOnRoad()) { + return; + } + + // The requesting vehicle's current route + // XXX: Restriction to route scanning may have to be generalized to scanning of possible continuations when + // considering situations involving sudden route changes. See also the definition of the EncounterTypes. + + // If veh is on an internal edge, the edgeIter points towards the last edge before the junction + ConstMSEdgeVector::const_iterator edgeIter = veh.getCurrentRouteEdge(); + assert(*edgeIter != 0); + + // Best continuation lanes for the ego vehicle + const std::vector egoBestLanes = veh.getBestLanesContinuation(); + std::vector::const_iterator laneIter = egoBestLanes.begin(); + + // current lane in loop below + const MSLane* lane = veh.getLane(); + assert(lane->isInternal() || lane == *laneIter); + assert(lane != 0); + // next non-internal lane on the route + const MSLane* nextNonInternalLane = 0; + + const MSEdge* edge; // current edge in loop below + + // Init pos with vehicle's current position. Below pos is set to zero to denote + // the beginning position of the currently considered edge + double pos = veh.getPositionOnLane(); + // remainingRange is the range minus the distance that is already scanned downstream along the vehicles route + double remainingDownstreamRange = range; + // distToConflictLane is the distance of the ego vehicle to the start of the currently considered potential conflict lane (can be negative for its current lane) + double distToConflictLane = -pos; + + // if the current edge is internal, collect all vehicles from the junction and below range upstream (except on the vehicles own edge), + // this is analogous to the code treating junctions in the loop below. Note that the distance on the junction itself is not included into + // range, so vehicles farther away than range can be collected, too. + if (lane->isInternal()) { + edge = &(lane->getEdge()); + +#ifdef DEBUG_SSM + std::cout << SIMTIME << " Vehicle '" << veh.getID() << "' is on internal edge " << edge->getID() << "'.\n" + << "Previous edge of its route: '" << (*edgeIter)->getID() << "'" << std::endl; +#endif + + assert(edge->getToJunction() == edge->getFromJunction()); + + const MSJunction* junction = edge->getToJunction(); + // Collect vehicles on the junction (TODO: Consider the case that this is an internal junction / the vehicles lane is the second part of a two-piece internal lane!!!) + getVehiclesOnJunction(junction, distToConflictLane, lane, foeCollector); + + // Collect vehicles on incoming edges. + // Note that this includes the previous edge on the ego vehicle's route. + // (The distance on the current internal edge is ignored) + const ConstMSEdgeVector& incoming = junction->getIncoming(); + for (ConstMSEdgeVector::const_iterator ei = incoming.begin(); ei != incoming.end(); ++ei) { + if ((*ei)->isInternal()) { + continue; + } + getUpstreamVehicles(*ei, (*ei)->getLength(), range, distToConflictLane, lane, foeCollector); + } + + // Take into account internal distance covered on the current lane + remainingDownstreamRange -= lane->getLength() - pos; + + // Take into account non-internal lengths until next non-internal lane + MSLink* link = lane->getLinkCont()[0]; + remainingDownstreamRange -= link->getInternalLengthsAfter(); + distToConflictLane += lane->getLength() + link->getInternalLengthsAfter(); + + // The next non-internal lane + pos = 0.; + lane = *(++laneIter); + edge = &lane->getEdge(); + } else { + // Collect all vehicles in range behind ego vehicle + edge = &(lane->getEdge()); + getUpstreamVehicles(edge, pos, range, distToConflictLane, lane, foeCollector); + } + + assert(lane != 0); + assert(!lane->isInternal()); + + // Advance downstream the ego vehicle's route for distance 'range'. + // Collect all vehicles on the traversed edges and on incoming edges at junctions. + while (remainingDownstreamRange > 0.) { +#ifdef DEBUG_SSM + std::cout << SIMTIME << " Scanning downstream for vehicle '" << veh.getID() << "'.\n" + << "Considering edge '" << edge->getID() << "' Remaining downstream range = " << remainingDownstreamRange + << "\n" + << std::endl; +#endif + assert(!edge->isInternal()); + assert(!lane->isInternal()); + assert(pos == 0 || lane == veh.getLane()); + if (pos + remainingDownstreamRange < lane->getLength()) { + // scan range ends on this lane + getUpstreamVehicles(edge, pos + remainingDownstreamRange, remainingDownstreamRange, distToConflictLane, lane, foeCollector); + // scanned required downstream range + break; + } else { + // Also need to scan area that reaches beyond the lane + // Collecting vehicles on non-internal edge ahead + getUpstreamVehicles(edge, edge->getLength(), edge->getLength() - pos, distToConflictLane, lane, foeCollector); + // account for scanned distance on lane + remainingDownstreamRange -= lane->getLength() - pos; + distToConflictLane += lane->getLength(); + pos = 0.; + + // proceed to next non-internal lane + ++laneIter; + assert(laneIter == egoBestLanes.end() || *laneIter != 0); + + // If the vehicle's best lanes go on, collect vehicles on the upcoming junction + if (laneIter != egoBestLanes.end()) { + // Upcoming junction + const MSJunction* junction = lane->getEdge().getToJunction(); + + // Find connection for ego on the junction + nextNonInternalLane = *laneIter; + MSLink* link = lane->getLinkTo(nextNonInternalLane); + assert(link != 0); + // First lane of the connection + lane = link->getViaLane(); + assert(lane != 0); // Collect vehicles on the junction + + getVehiclesOnJunction(junction, distToConflictLane, lane, foeCollector); + + // Collect vehicles on incoming edges (except the last edge, where we already collected). Use full range. + const ConstMSEdgeVector& incoming = junction->getIncoming(); + for (ConstMSEdgeVector::const_iterator ei = incoming.begin(); ei != incoming.end(); ++ei) { + if (*ei == edge || (*ei)->isInternal()) { + continue; + } + getUpstreamVehicles(*ei, (*ei)->getLength(), range, distToConflictLane, lane, foeCollector); + } + + // account for scanned distance on junction + double linkLength = link->getInternalLengthsAfter(); + remainingDownstreamRange -= linkLength; + distToConflictLane += linkLength; + + // update ego's lane to next non internal edge + lane = nextNonInternalLane; + edge = &(lane->getEdge()); + } + } + } + // remove ego vehicle + foeCollector.erase(&veh); +} + +void +MSDevice_SSM::getUpstreamVehicles(const MSEdge* edge, double pos, double range, double egoDistToConflictLane, const MSLane* const egoConflictLane, FoeInfoMap& foeCollector) { +#ifdef DEBUG_SSM + std::cout << SIMTIME << " getUpstreamVehicles() for edge '" << edge->getID() << "'" + << " pos = " << pos << " range = " << range + << "\nFound vehicles:" + << std::endl; +#endif + if (range <= 0) { + return; + } + + const std::vector& lanes = edge->getLanes(); + // Collect vehicles on the given edge with position in [pos-range,pos] + for (std::vector::const_iterator li = lanes.begin(); li != lanes.end(); ++li) { + MSLane* lane = *li; + const MSLane::VehCont& vehicles = lane->getVehiclesSecure(); + for (MSLane::VehCont::const_iterator vi = vehicles.begin(); vi != vehicles.end(); ++vi) { + MSVehicle* veh = *vi; + if (veh->getPositionOnLane() >= pos - range) { +#ifdef DEBUG_SSM + std::cout << veh->getID() << "\n"; +#endif + FoeInfo* c = new FoeInfo(); // c is deleted in updateEncounter() + c->egoDistToConflictLane = egoDistToConflictLane; + c->egoConflictLane = egoConflictLane; + foeCollector[veh] = c; + } + } + } + +#ifdef DEBUG_SSM + std::cout << std::endl; +#endif + + // TODO: Gather vehicles from opposite direction. This should happen in any case, where opposite direction overtaking is possible. + // If it isn't it might still be nicer to trace oncoming vehicles for the resulting trajectories in the encounters + // if (edge->hasOpposite...) + + if (range <= pos) { + return; + } + + // Here we have: range > pos, i.e. we proceed collecting vehicles on preceding edges + range -= pos; + + // Collect vehicles from incoming edges of the junction representing the origin of 'edge' + const MSJunction* junction = edge->getFromJunction(); + if (!edge->isInternal()) { + // collect vehicles on preceding junction (for internal edges this is already done in caller, + // i.e. findSurroundingVehicles() or the recursive call from getUpstreamVehicles()) + getVehiclesOnJunction(junction, egoDistToConflictLane, egoConflictLane, foeCollector); + } + // Collect vehicles from incoming edges from the junction representing the origin of 'edge' + const ConstMSEdgeVector& incoming = junction->getIncoming(); + for (ConstMSEdgeVector::const_iterator ei = incoming.begin(); ei != incoming.end(); ++ei) { + if ((*ei)->isInternal()) { + continue; + } + const MSEdge* inEdge = *ei; + assert(inEdge != 0); + double distOnJunction = edge->isInternal() ? 0. : inEdge->getInternalFollowingLengthTo(edge); + if (distOnJunction >= range) { + continue; + } + // account for vehicles on the predecessor edge + getUpstreamVehicles(inEdge, inEdge->getLength(), range - distOnJunction, egoDistToConflictLane, egoConflictLane, foeCollector); + } +} + +void +MSDevice_SSM::getVehiclesOnJunction(const MSJunction* junction, double egoDistToConflictLane, const MSLane* const egoConflictLane, FoeInfoMap& foeCollector) { +#ifdef DEBUG_SSM + std::cout << SIMTIME << " getVehiclesOnJunction() for junction '" << junction->getID() << "'" + << "\nFound vehicles:" + << std::endl; +#endif + // Collect vehicles on internal lanes + const std::vector& lanes = junction->getInternalLanes(); + for (std::vector::const_iterator li = lanes.begin(); li != lanes.end(); ++li) { + MSLane* lane = *li; + const MSLane::VehCont& vehicles = lane->getVehiclesSecure(); + + // Add FoeInfos (XXX: for some situations, a vehicle may be collected twice. Then the later finding overwrites the earlier in foeCollector. + // This could lead to neglecting a conflict when determining foeConflictLane later.) + for (MSLane::VehCont::const_iterator vi = vehicles.begin(); vi != vehicles.end(); ++vi) { + FoeInfo* c = new FoeInfo(); + c->egoConflictLane = egoConflictLane; + c->egoDistToConflictLane = egoDistToConflictLane; + foeCollector[*vi] = c; +#ifdef DEBUG_SSM + for (MSLane::VehCont::const_iterator vi = vehicles.begin(); vi != vehicles.end(); ++vi) { + std::cout << (*vi)->getID() << "\n"; + } +#endif + } + + // If there is an internal continuation lane, also collect vehicles on that lane + if (lane->getLinkCont().size() > 1 && lane->getLinkCont()[0]->getViaLane() != 0) { + // There's a second internal lane of the connection + lane = lane->getLinkCont()[0]->getViaLane(); + // This code must be modified, if more than two-piece internal lanes are allowed. Thus, assert: + assert(lane->getLinkCont().size() == 0 || lane->getLinkCont()[0]->getViaLane() == 0); + + // collect vehicles + const MSLane::VehCont& vehicles2 = lane->getVehiclesSecure(); + // Add FoeInfos. This duplicates the loop for the first internal lane + for (MSLane::VehCont::const_iterator vi = vehicles2.begin(); vi != vehicles2.end(); ++vi) { + FoeInfo* c = new FoeInfo(); + c->egoConflictLane = egoConflictLane; + c->egoDistToConflictLane = egoDistToConflictLane; + foeCollector[*vi] = c; +#ifdef DEBUG_SSM + for (MSLane::VehCont::const_iterator vi = vehicles.begin(); vi != vehicles.end(); ++vi) { + std::cout << (*vi)->getID() << "\n"; + } +#endif + } + } + } + +#ifdef DEBUG_SSM + std::cout << std::endl; +#endif +} + + + +void +MSDevice_SSM::generateOutput() const { + // This is called once at vehicle removal. + // Also: flush myOutputFile? Or is this done automatically? + myOutputFile->closeTag(); +} + +// --------------------------------------------------------------------------- +// Static parameter load helpers +// --------------------------------------------------------------------------- +std::string +MSDevice_SSM::getOutputFilename(const SUMOVehicle& v, std::string deviceID) { + std::string file = deviceID + ".xml"; + if (v.getParameter().knowsParameter("device.ssm.file")) { + try { + file = v.getParameter().getParameter("device.ssm.file", file); + } catch (...) { + WRITE_WARNING("Invalid value '" + v.getParameter().getParameter("device.ssm.file", file) + "'for vehicle parameter 'ssm.measures'"); + } + } else if (v.getVehicleType().getParameter().knowsParameter("device.ssm.file")) { + try { + file = v.getVehicleType().getParameter().getParameter("device.ssm.file", file); + } catch (...) { + WRITE_WARNING("Invalid value '" + v.getVehicleType().getParameter().getParameter("device.ssm.file", file) + "'for vType parameter 'ssm.measures'"); + } + } else { + std::cout << "vehicle '" << v.getID() << "' does not supply vehicle parameter 'device.ssm.file'. Using default of '" << file << "'\n"; + } + return file; +} + + +double +MSDevice_SSM::getDetectionRange(const SUMOVehicle& v) { + OptionsCont& oc = OptionsCont::getOptions(); + double range = INVALID; + if (v.getParameter().knowsParameter("device.ssm.range")) { + try { + range = TplConvert::_2double(v.getParameter().getParameter("device.ssm.range", "").c_str()); + } catch (...) { + WRITE_WARNING("Invalid value '" + v.getParameter().getParameter("device.ssm.range", "") + "'for vehicle parameter 'ssm.range'"); + } + } else if (v.getVehicleType().getParameter().knowsParameter("device.ssm.range")) { + try { + range = TplConvert::_2double(v.getVehicleType().getParameter().getParameter("device.ssm.range", "").c_str()); + } catch (...) { + WRITE_WARNING("Invalid value '" + v.getVehicleType().getParameter().getParameter("device.ssm.range", "") + "'for vType parameter 'ssm.range'"); + } + } else { + range = oc.getFloat("device.ssm.range"); +#ifdef DEBUG_SSM + std::cout << "vehicle '" << v.getID() << "' does not supply vehicle parameter 'device.ssm.range'. Using default of '" << range << "'\n"; +#endif + } + return range; +} + +double +MSDevice_SSM::getLoggingFrequency(const SUMOVehicle& v) { + OptionsCont& oc = OptionsCont::getOptions(); + double frequency = INVALID; + if (v.getParameter().knowsParameter("device.ssm.frequency")) { + try { + frequency = TplConvert::_2double(v.getParameter().getParameter("device.ssm.frequency", "").c_str()); + } catch (...) { + WRITE_WARNING("Invalid value '" + v.getParameter().getParameter("device.ssm.frequency", "") + "'for vehicle parameter 'ssm.frequency'"); + } + } else if (v.getVehicleType().getParameter().knowsParameter("device.ssm.frequency")) { + try { + frequency = TplConvert::_2double(v.getVehicleType().getParameter().getParameter("device.ssm.frequency", "").c_str()); + } catch (...) { + WRITE_WARNING("Invalid value '" + v.getVehicleType().getParameter().getParameter("device.ssm.frequency", "") + "'for vType parameter 'ssm.frequency'"); + } + } else { + frequency = oc.getFloat("device.ssm.frequency"); +#ifdef DEBUG_SSM + std::cout << "vehicle '" << v.getID() << "' does not supply vehicle parameter 'device.ssm.frequency'. Using default of '" << frequency << "'\n"; +#endif + } + return frequency; +} + +bool +MSDevice_SSM::requestsTrajectories(const SUMOVehicle& v) { + OptionsCont& oc = OptionsCont::getOptions(); + bool trajectories = false; + if (v.getParameter().knowsParameter("device.ssm.trajectories")) { + try { + trajectories = TplConvert::_2bool(v.getParameter().getParameter("device.ssm.trajectories", "no").c_str()); + } catch (...) { + WRITE_WARNING("Invalid value '" + v.getParameter().getParameter("device.ssm.trajectories", "no") + "'for vehicle parameter 'ssm.trajectories'"); + } + } else if (v.getVehicleType().getParameter().knowsParameter("device.ssm.trajectories")) { + try { + trajectories = TplConvert::_2bool(v.getVehicleType().getParameter().getParameter("device.ssm.trajectories", "no").c_str()); + } catch (...) { + WRITE_WARNING("Invalid value '" + v.getVehicleType().getParameter().getParameter("device.ssm.trajectories", "no") + "'for vType parameter 'ssm.trajectories'"); + } + } else { + trajectories = oc.getBool("device.ssm.trajectories"); +#ifdef DEBUG_SSM + std::cout << "vehicle '" << v.getID() << "' does not supply vehicle parameter 'device.ssm.trajectories'. Using default of '" << trajectories << "'\n"; +#endif + } + return trajectories; +} + + +bool +MSDevice_SSM::getMeasuresAndThresholds(const SUMOVehicle& v, std::string deviceID, std::vector& thresholds, std::vector& measures) { + OptionsCont& oc = OptionsCont::getOptions(); + + // Measures + std::string measures_str = ""; + if (v.getParameter().knowsParameter("device.ssm.measures")) { + try { + measures_str = v.getParameter().getParameter("device.ssm.measures", ""); + } catch (...) { + WRITE_WARNING("Invalid value '" + v.getParameter().getParameter("device.ssm.measures", "") + "'for vehicle parameter 'ssm.measures'"); + } + } else if (v.getVehicleType().getParameter().knowsParameter("device.ssm.measures")) { + try { + measures_str = v.getVehicleType().getParameter().getParameter("device.ssm.measures", ""); + } catch (...) { + WRITE_WARNING("Invalid value '" + v.getVehicleType().getParameter().getParameter("device.ssm.measures", "") + "'for vType parameter 'ssm.measures'"); + } + } else { + measures_str = oc.getString("device.ssm.measures"); + std::cout << "vehicle '" << v.getID() << "' does not supply vehicle parameter 'device.ssm.measures'. Using default of '" << measures_str << "'\n"; + } + + // Check retrieved measures + if (measures_str == "") { + WRITE_WARNING("No measures specified for ssm device of vehicle '" + v.getID() + "'. Registering all available SSMs."); + measures_str = AVAILABLE_SSMS; + } + StringTokenizer st = StringTokenizer(AVAILABLE_SSMS); + std::vector available = st.getVector(); + st = StringTokenizer(measures_str); + measures = st.getVector(); + for (std::vector::const_iterator i = measures.begin(); i != measures.end(); ++i) { + if (std::find(available.begin(), available.end(), *i) == available.end()) { + // Given identifier is unknown + WRITE_ERROR("SSM identifier '" + *i + "' is not supported. Aborting construction of SSM device '" + deviceID + "'."); + return false; + } + } + + // Thresholds + std::string thresholds_str = ""; + if (v.getParameter().knowsParameter("device.ssm.thresholds")) { + try { + thresholds_str = v.getParameter().getParameter("device.ssm.thresholds", ""); + } catch (...) { + WRITE_WARNING("Invalid value '" + v.getParameter().getParameter("device.ssm.thresholds", "") + "'for vehicle parameter 'ssm.thresholds'"); + } + } else if (v.getVehicleType().getParameter().knowsParameter("device.ssm.thresholds")) { + try { + thresholds_str = v.getVehicleType().getParameter().getParameter("device.ssm.thresholds", ""); + } catch (...) { + WRITE_WARNING("Invalid value '" + v.getVehicleType().getParameter().getParameter("device.ssm.thresholds", "") + "'for vType parameter 'ssm.thresholds'"); + } + } else { + thresholds_str = oc.getString("device.ssm.thresholds"); +#ifdef DEBUG_SSM + std::cout << "vehicle '" << v.getID() << "' does not supply vehicle parameter 'device.ssm.thresholds'. Using default of '" << thresholds_str << "'\n"; +#endif + } + + // Parse vector of doubles from threshold_str + if (thresholds_str != "") { + st = StringTokenizer(thresholds_str); + while (st.hasNext()) { + thresholds.push_back(TplConvert::_2double(st.next().c_str())); + } + if (thresholds.size() != measures.size()) { + WRITE_ERROR("Given list of thresholds ('" + thresholds_str + "') has not the same length as the assumed list of measures ('" + measures_str + "')."); + return false; + } + } else { + // assume default thresholds if none are given + for (std::vector::const_iterator i = measures.begin(); i != measures.end(); ++i) { + if (*i == "TTC") { + thresholds.push_back(DEFAULT_THRESHOLD_TTC); + } else if (*i == "DRAC") { + thresholds.push_back(DEFAULT_THRESHOLD_DRAC); + } else if (*i == "PET") { + thresholds.push_back(DEFAULT_THRESHOLD_PET); + } else { + WRITE_ERROR("Unknown SSM identifier '" + (*i) + "'. Aborting construction of ssm device."); // should never occur + return false; + } + } + } + return true; +} + + + + + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_SSM.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_SSM.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_SSM.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_SSM.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,428 @@ +/****************************************************************************/ +/// @file MSDevice_SSM.cpp +/// @author Daniel Krajzewicz +/// @author Jakob Erdmann +/// @date 11.06.2013 +/// @version $Id: MSDevice_SSM.h 24108 2017-04-27 18:43:30Z behrisch $ +/// +// A device which stands as an implementation example and which outputs movereminder calls +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 200132014 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef MSDevice_SSM_h +#define MSDevice_SSM_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include "MSDevice.h" +#include +#include +#include + + +// =========================================================================== +// class declarations +// =========================================================================== +class SUMOVehicle; + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class MSDevice_SSM + * @brief A device which collects info on the vehicle trip (mainly on departure and arrival) + * + * Each device collects departure time, lane and speed and the same for arrival. + * + * @see MSDevice + */ + +class MSCrossSection; + +class MSDevice_SSM : public MSDevice { + +private: + /// All currently existing SSM devices + static std::set* instances; + + /// @brief Different types of encounters corresponding to relative positions of the vehicles. + /// The name describes the type from the ego perspective + enum EncounterType { + // Other vehicle is closer than range, but not on a conflicting lane + ENCOUNTER_TYPE_NOCONFLICT, //!< ENCOUNTER_TYPE_NOCONFLICT + // Ego and foe vehicles' edges form a part of a consecutive sequence of edges + // This type may be specified further by ENCOUNTER_TYPE_FOLLOWING_LEADER or ENCOUNTER_TYPE_FOLLOWING_FOLLOWER + ENCOUNTER_TYPE_FOLLOWING, //!< ENCOUNTER_TYPE_FOLLOWING + // Ego vehicle is on an edge that has a sequence of successors connected to the other vehicle's edge + ENCOUNTER_TYPE_FOLLOWING_FOLLOWER, //!< ENCOUNTER_TYPE_FOLLOWING_FOLLOWER + // Other vehicle is on an edge that has a sequence of successors connected to the ego vehicle's current edge + ENCOUNTER_TYPE_FOLLOWING_LEADER, //!< ENCOUNTER_TYPE_FOLLOWING_LEADER + // Ego and foe share an upcoming edge of their routes while the merging point for the routes is still ahead + // This type may be specified further by ENCOUNTER_TYPE_MERGING_LEADER or ENCOUNTER_TYPE_MERGING_FOLLOWER + ENCOUNTER_TYPE_MERGING, //!< ENCOUNTER_TYPE_MERGING + // Other vehicle is on an edge that has a sequence of successors connected to an edge on the ego vehicle's route + // and the estimated arrival vehicle at the merge point is earlier for the ego than for the foe + ENCOUNTER_TYPE_MERGING_LEADER, //!< ENCOUNTER_TYPE_MERGING_LEADER + // Other vehicle is on an edge that has a sequence of successors connected to an edge on the ego vehicle's route + // and the estimated arrival vehicle at the merge point is earlier for the foe than for the ego + ENCOUNTER_TYPE_MERGING_FOLLOWER,//!< ENCOUNTER_TYPE_MERGING_FOLLOWER + // Ego's and foe's routes have crossing edges + // This type may be specified further by ENCOUNTER_TYPE_CROSSING_LEADER or ENCOUNTER_TYPE_CROSSING_FOLLOWER + ENCOUNTER_TYPE_CROSSING, //!< ENCOUNTER_TYPE_CROSSING + // Other vehicle is on an edge that has a sequence of successors leading to an internal edge that crosses the ego vehicle's edge at a junction + // and the estimated arrival vehicle at the merge point is earlier for the ego than for the foe + ENCOUNTER_TYPE_CROSSING_LEADER, //!< ENCOUNTER_TYPE_CROSSING_LEADER + // Other vehicle is on an edge that has a sequence of successors leading to an internal edge that crosses the ego vehicle's edge at a junction + // and the estimated arrival vehicle at the merge point is earlier for the foe than for the ego + ENCOUNTER_TYPE_CROSSING_FOLLOWER//!< ENCOUNTER_TYPE_CROSSING_FOLLOWER + }; + + + +private: + /// @brief An encounter is an episode involving two vehicles, + /// which are closer to each other than some specified distance. + class Encounter { + private: + /// @brief A trajectory encloses a series of positions x and speeds v for one vehicle + /// (the times are stored only once in the enclosing encounter) + struct Trajectory { + // positions + PositionVector x; + // momentary speeds + PositionVector v; + }; + + public: + /// @brief Constructor + Encounter(const MSVehicle* _ego, const MSVehicle* const _foe, double _begin); + /// @brief Destructor + ~Encounter(); + /// @brief add a new data point + void add(double time, Position egoX, Position egoV, Position foeX, Position foeV); + /// @brief Compares encounters regarding to their start time + struct compare { + typedef bool value_type; + bool operator()(Encounter* e1, Encounter* e2) { + return e1->begin <= e2->begin; + }; + }; + + + + public: + const MSVehicle* ego; + const MSVehicle* const foe; + double begin, end; + EncounterType type; + +// /// @brief tuple time x point of entry to the potential conflict +// std::pair egoConflictEntry; +// std::pair foeConflictEntry; +// std::pair egoConflictExit; +// std::pair foeConflictExit; + + /// @brief time points corresponding to the trajectories + std::vector timespan; + /// @brief Trajectory of the ego vehicle + Trajectory egoTrajectory; + /// @brief Trajectory of the foe vehicle + Trajectory foeTrajectory; + + /// @brief All values for TTC + std::vector TTCspan; + /// @brief All values for DRAC + std::vector DRACspan; + + /// @name Extremal values for the SSMs (as -pairs) + /// @{ + std::pair maxDRAC; + std::pair minTTC; + std::pair PET; + /// @} + + private: + /// @brief Invalidated Constructor. + Encounter(const Encounter&); + /// @brief Invalidated assignment operator. + Encounter& operator=(const Encounter&); + /// + }; + + /// A new FoeInfo is created during findSurroundingVehicles() to memorize, where the potential conflict + /// corresponding to the encounter might occur. Each FoeInfo ends up in a call to updateEncounter() and + /// is deleted there. + struct FoeInfo { + const MSLane* egoConflictLane; + double egoDistToConflictLane; + }; + // TODO: consider introducing a class foeCollector, which holds the foe info content + // plus a vehicle container to be used in findSurrounding vehicles. + // findSurroundingVehicles() would then deliver a vector of such foeCollectors + // (one for each possible egoConflictLane) instead of a map vehicle->foeInfo + + + typedef std::priority_queue, Encounter::compare> EncounterQueue; + typedef std::vector EncounterVector; + typedef std::map FoeInfoMap; +public: + + /** @brief Inserts MSDevice_SSM-options + * @param[filled] oc The options container to add the options to + */ + static void insertOptions(OptionsCont& oc); + + + /** @brief Build devices for the given vehicle, if needed + * + * The options are read and evaluated whether a example-device shall be built + * for the given vehicle. + * + * The built device is stored in the given vector. + * + * @param[in] v The vehicle for which a device may be built + * @param[filled] into The vector to store the built device in + */ + static void buildVehicleDevices(SUMOVehicle& v, std::vector& into); + + + /** @brief returns all currently existing SSM devices + */ + static const std::set& getInstances(); + + /** @brief This is called once per time step in MSNet::writeOutput() and + * collects the surrounding vehicles, updates information on encounters + * and flushes the encounters qualified as conflicts (@see thresholds) + * to the output file. + */ + void updateAndWriteOutput(); + +private: + void update(); + void writeOutConflict(Encounter* e); + +public: + /** @brief Clean up remaining devices instances + */ + static void cleanup(); + + +public: + /// @brief Destructor. + ~MSDevice_SSM(); + + + /** @brief Returns all vehicles, which are within the given range of the given vehicle. + * @note all vehicles behind and in front are collected, + * including vehicles on confluent edges. If the range is 20 m. and + * a junction lies 10 m. ahead, an upstream scan of 20 m. is performed + * for all incoming edges. + * + * @param veh The ego vehicle, that forms the origin for the scan + * @param range The range to be scanned. + * @param[in/out] foeCollector container for all collected vehicles + * @return All vehicles within range from veh + */ + static void findSurroundingVehicles(const MSVehicle& veh, double range, FoeInfoMap& foeCollector); + + /** @brief Collects all vehicles within range 'range' upstream of the position 'pos' on the edge 'edge' into foeCollector + */ + static void getUpstreamVehicles(const MSEdge* edge, double pos, double range, double egoDistToConflictLane, const MSLane* const egoConflictLane, FoeInfoMap& foeCollector); + + /** @brief Collects all vehicles on the junction into foeCollector + */ + static void getVehiclesOnJunction(const MSJunction*, double egoDistToConflictLane, const MSLane* const egoConflictLane, FoeInfoMap& foeCollector); + + + /// @name Methods called on vehicle movement / state change, overwriting MSDevice + /// @{ + + /** @brief Checks for waiting steps when the vehicle moves + * + * @param[in] veh Vehicle that notifies. + * @param[in] oldPos Position before move. + * @param[in] newPos Position after move with newSpeed. + * @param[in] newSpeed Moving speed. + * + * @return Always true to keep the device as it cannot be thrown away + */ + bool notifyMove(SUMOVehicle& veh, double oldPos, + double newPos, double newSpeed); + + + /** @brief Called whenever the holder enteres a lane + * + * @param[in] veh The entering vehicle. + * @param[in] reason Reason for leaving the lane + * @param[in] enteredLane The lane entered. + * @return Always true to keep the device as it cannot be thrown away + * @see MSMoveReminder::notifyEnter + * @see MSMoveReminder::Notification + */ + bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); + + + /** @brief Called whenever the holder leaves a lane + * + * @param[in] veh The leaving vehicle. + * @param[in] lastPos Position on the lane when leaving. + * @param[in] reason Reason for leaving the lane + * @param[in] enteredLane The lane entered. + * @return True if it did not leave the net. + */ + bool notifyLeave(SUMOVehicle& veh, double lastPos, + MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); + /// @} + + + /// @brief return the name for this type of device + const std::string deviceName() const { + return "ssm"; + } + + /** @brief Finalizes output. Called on vehicle removal + * + * @param[in] os The stream to write the information into + * @exception IOError not yet implemented + * @see MSDevice::generateOutput + */ + void generateOutput() const; + + + +private: + /** @brief Constructor + * + * @param[in] holder The vehicle that holds this device + * @param[in] id The ID of the device + * @param measures Vector of Surrogate Safety Measure IDs + * @param thresholds Vector of corresponding thresholds + * @param trajectories Flag indicating whether complete trajectories should be saved for an encounter (if false only extremal values are logged) + * @param frequency Maximal length of a single encounter. + * @param range Detection range. For vehicles closer than this distance from the ego vehicle, SSMs are traced + */ + MSDevice_SSM(SUMOVehicle& holder, const std::string& id, std::string outputFilename, std::vector measures, std::vector thresholds, + bool trajectories, double frequency, double range); + + + /** @brief Finds encounters for which the foe vehicle has disappeared from range and + * if an ended encounter is qualified as a conflict, it is transferred to myPastConflicts + * All vehicles for which an encounter instance already exists (vehicle is already tracked) + * are removed from 'foes' during processing. + */ + void processEncounters(FoeInfoMap& foes); + + /** @brief Makes new encounters for all given vehicles (these should be the ones entering the device's range in the current timestep) + */ + void createEncounters(FoeInfoMap& foes); + + + /** @brief Closes all current Encounters and moves conflicts to myPastConflicts, @see processEncounters + */ + void resetEncounters(); + + /** @brief Writes out all past conflicts that have begun earlier than time t-myFrequency (i.e. no active encounter can have an earlier begin) + * @param[in] all Whether all conflicts should be flushed or only those for which no active encounters with earlier begin can exist + */ + void flushConflicts(bool all = false); + + /** @brief Updates the encounter (adds a new trajectory point) and deletes the foeInfo. + */ + void updateEncounter(Encounter* e, FoeInfo* foeInfo); + + /** @brief Computes the conflict lane for the foe + * + * @param foe Foe vehicle + * @param egoConflictLane Lane, on which the ego would enter the possible conflict + * @param routeToConflict, Series of edges, that were traced back from egoConflictLane during findSurrounding Vehicles, when collecting the foe vehicle + * @param[out] distToConflictLane, distance to conflictlane entry link (may be negative if foe is already on the conflict lane) + * @return Lane, on which the foe would enter the possible conflict, if foe is not on conflict course, Null-pointer is returned. + */ + const MSLane* findFoeConflictLane(const MSVehicle* foe, const MSLane* egoConflictLane, double& distToConflictLane); + + /** @brief Finalizes the encounter and calculates SSM values. + */ + void closeEncounter(Encounter* e); + + /** @brief Tests if the SSM values exceed the threshold for qualification as conflict. + */ + bool qualifiesAsConflict(Encounter* e); + + /** Compute current values of the logged SSMs (myMeasures) for the given encounter 'e' + * and update 'e' accordingly (add point to SSM time-series, update maximal/minimal value) + * This is called just after adding the current vehicle positions and velocity vectors to the encounter. + */ + void computeSSMs(Encounter* e); + + + /// @name parameter load helpers (introduced for readability of buildVehicleDevices()) + /// @{ + static std::string getOutputFilename(const SUMOVehicle& v, std::string deviceID); + static double getDetectionRange(const SUMOVehicle& v); + static double getLoggingFrequency(const SUMOVehicle& v); + static bool requestsTrajectories(const SUMOVehicle& v); + static bool getMeasuresAndThresholds(const SUMOVehicle& v, std::string deviceID, + std::vector& thresholds, std::vector& measures); + ///@} + +private: + /// @name Device parameters + /// @{ + std::vector myMeasures; + std::vector myThresholds; + bool mySaveTrajectories; + /// @brief Maximal timespan duration for a single encounter + /// @todo rename to maxEncounterLength + double myFrequency; + double myRange; + /// @brief Corresponding maximal trajectory size in points, derived from myFrequency + int maxTrajectorySize; + /// Flags for switching on / off comutation of different SSMs, derived from myMeasures + bool myComputeTTC, myComputeDRAC, myComputePET; + MSVehicle* myHolderMS; + /// @} + + + /// @name Internal storage for encounters/conflicts + /// @{ + /// @brief Currently observed encounters/conflicts + EncounterVector myActiveEncounters; + /// @brief Past encounters that where qualified as conflicts and are not yet flushed to the output file + EncounterQueue myPastConflicts; + /// @} + + /// Output device + OutputDevice* myOutputFile; + +private: + /// @brief Invalidated copy constructor. + MSDevice_SSM(const MSDevice_SSM&); + + /// @brief Invalidated assignment operator. + MSDevice_SSM& operator=(const MSDevice_SSM&); + + +}; + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Transportable.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Transportable.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Transportable.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Transportable.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ /// @author Melanie Weber /// @author Andreas Kendziorra /// @date Fri, 30.01.2009 -/// @version $Id: MSDevice_Transportable.cpp 20768 2016-05-20 08:38:44Z behrisch $ +/// @version $Id: MSDevice_Transportable.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A device which is used to keep track of persons and containers riding with a vehicle /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,6 +32,7 @@ #include #endif +#include #include #include #include @@ -39,10 +40,6 @@ #include #include "MSDevice_Transportable.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -71,7 +68,7 @@ bool -MSDevice_Transportable::notifyMove(SUMOVehicle& veh, SUMOReal /*oldPos*/, SUMOReal /*newPos*/, SUMOReal /*newSpeed*/) { +MSDevice_Transportable::notifyMove(SUMOVehicle& veh, double /*oldPos*/, double /*newPos*/, double /*newSpeed*/) { if (myStopped) { if (!veh.isStopped()) { for (std::vector::iterator i = myTransportables.begin(); i != myTransportables.end(); ++i) { @@ -91,6 +88,13 @@ MSNet::getInstance()->getPersonControl().erase(transportable); } } + if (MSStopOut::active()) { + if (myAmContainer) { + MSStopOut::getInstance()->unloadedContainers(&veh, 1); + } else { + MSStopOut::getInstance()->unloadedPersons(&veh, 1); + } + } i = myTransportables.erase(i); } else { ++i; @@ -104,7 +108,7 @@ bool -MSDevice_Transportable::notifyEnter(SUMOVehicle& /*veh*/, MSMoveReminder::Notification reason) { +MSDevice_Transportable::notifyEnter(SUMOVehicle& /*veh*/, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { if (reason == MSMoveReminder::NOTIFICATION_DEPARTED) { for (std::vector::iterator i = myTransportables.begin(); i != myTransportables.end(); ++i) { (*i)->setDeparted(MSNet::getInstance()->getCurrentTimeStep()); @@ -115,8 +119,8 @@ bool -MSDevice_Transportable::notifyLeave(SUMOVehicle& veh, SUMOReal /*lastPos*/, - MSMoveReminder::Notification reason) { +MSDevice_Transportable::notifyLeave(SUMOVehicle& veh, double /*lastPos*/, + MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { if (reason >= MSMoveReminder::NOTIFICATION_ARRIVED) { for (std::vector::iterator i = myTransportables.begin(); i != myTransportables.end(); ++i) { MSTransportable* transportable = *i; @@ -141,6 +145,39 @@ void MSDevice_Transportable::addTransportable(MSTransportable* transportable) { myTransportables.push_back(transportable); + if (MSStopOut::active()) { + if (myAmContainer) { + MSStopOut::getInstance()->loadedContainers(&myHolder, 1); + } else { + MSStopOut::getInstance()->loadedPersons(&myHolder, 1); + } + } +} + + +void +MSDevice_Transportable::removeTransportable(MSTransportable* transportable) { + myTransportables.erase(std::find(myTransportables.begin(), myTransportables.end(), transportable)); + if (MSStopOut::active() && myHolder.isStopped()) { + if (myAmContainer) { + MSStopOut::getInstance()->loadedContainers(&myHolder, 1); + } else { + MSStopOut::getInstance()->loadedPersons(&myHolder, 1); + } + } +} + + +std::string +MSDevice_Transportable::getParameter(const std::string& key) const { + if (key == "IDList") { + std::vector ids; + for (std::vector::const_iterator i = myTransportables.begin(); i != myTransportables.end(); ++i) { + ids.push_back((*i)->getID()); + } + return toString(ids); + } + throw InvalidArgument("Parameter '" + key + "' is not supported for device of type '" + deviceName() + "'"); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Transportable.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Transportable.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Transportable.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Transportable.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Melanie Weber /// @author Andreas Kendziorra /// @date Fri, 30.01.2009 -/// @version $Id: MSDevice_Transportable.h 21184 2016-07-18 07:12:20Z behrisch $ +/// @version $Id: MSDevice_Transportable.h 24108 2017-04-27 18:43:30Z behrisch $ /// // A device which is used to keep track of persons and containers riding with a vehicle /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -78,7 +78,7 @@ * @see MSMoveReminder * @see MSMoveReminder::notifyMove */ - bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed); + bool notifyMove(SUMOVehicle& veh, double oldPos, double newPos, double newSpeed); /** @brief Adds passengers on vehicle insertion @@ -89,7 +89,7 @@ * @see MSMoveReminder::notifyEnter * @see MSMoveReminder::Notification */ - bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason); + bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /** @brief Passengers leaving on arrival @@ -101,11 +101,18 @@ * * @return True if it did not leave the net. */ - bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, - MSMoveReminder::Notification reason); + bool notifyLeave(SUMOVehicle& veh, double lastPos, + MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /// @} + /// @brief return the name for this type of device + const std::string deviceName() const { + return myAmContainer ? "container" : "person"; + } + + /// @brief try to retrieve the given parameter from this device. Throw exception for unsupported key + std::string getParameter(const std::string& key) const; /** @brief Add a passenger * @@ -114,6 +121,13 @@ void addTransportable(MSTransportable* transportable); + /** @brief Remove a passenger (TraCI) + * + * @param[in] transportable The passenger / container to remove. + */ + void removeTransportable(MSTransportable* transportable); + + /** @brief Return the number of passengers / containers * @return The number of stored transportables */ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Tripinfo.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Tripinfo.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Tripinfo.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Tripinfo.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Fri, 30.01.2009 -/// @version $Id: MSDevice_Tripinfo.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSDevice_Tripinfo.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A device which collects info on the vehicle trip /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,12 +37,9 @@ #include #include #include +#include #include "MSDevice_Tripinfo.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - #define NOT_ARRIVED TIME2STEPS(-1) @@ -51,8 +48,8 @@ // =========================================================================== MSDevice_Tripinfo::DeviceSet MSDevice_Tripinfo::myPendingOutput; -SUMOReal MSDevice_Tripinfo::myVehicleCount(0); -SUMOReal MSDevice_Tripinfo::myTotalRouteLength(0); +double MSDevice_Tripinfo::myVehicleCount(0); +double MSDevice_Tripinfo::myTotalRouteLength(0); SUMOTime MSDevice_Tripinfo::myTotalDuration(0); SUMOTime MSDevice_Tripinfo::myTotalWaitingTime(0); SUMOTime MSDevice_Tripinfo::myTotalTimeLoss(0); @@ -88,7 +85,7 @@ myArrivalPos(-1), myArrivalPosLat(0), myArrivalSpeed(-1), - myTimeLoss(0) { + myMesoTimeLoss(0) { } @@ -99,46 +96,36 @@ bool -MSDevice_Tripinfo::notifyMove(SUMOVehicle& veh, SUMOReal /*oldPos*/, - SUMOReal /*newPos*/, SUMOReal newSpeed) { +MSDevice_Tripinfo::notifyMove(SUMOVehicle& veh, double /*oldPos*/, + double /*newPos*/, double newSpeed) { if (veh.isStopped()) { return true; } if (newSpeed <= SUMO_const_haltingSpeed) { myWaitingTime += DELTA_T; } - // @note we are including the speed factor here, thus myTimeLoss can never be - // negative. The value is that of a driver who compares his travel time when - // the road is clear (which includes speed factor) with the actual travel time. - // @todo It might be useful to recognize a departing vehicle and not - // count the time spent accelerating towards time loss since it is unavoidable - // (current interfaces do not give access to maximum acceleration) - const SUMOReal vmax = veh.getEdge()->getVehicleMaxSpeed(&veh); - if (vmax > 0) { - myTimeLoss += TIME2STEPS(TS * (vmax - newSpeed) / vmax); - } return true; } void MSDevice_Tripinfo::notifyMoveInternal(const SUMOVehicle& veh, - const SUMOReal /* frontOnLane */, - const SUMOReal timeOnLane, - const SUMOReal /* meanSpeedFrontOnLane */, - const SUMOReal meanSpeedVehicleOnLane, - const SUMOReal /* travelledDistanceFrontOnLane */, - const SUMOReal /* travelledDistanceVehicleOnLane */) { + const double /* frontOnLane */, + const double timeOnLane, + const double /* meanSpeedFrontOnLane */, + const double meanSpeedVehicleOnLane, + const double /* travelledDistanceFrontOnLane */, + const double /* travelledDistanceVehicleOnLane */) { // called by meso - const SUMOReal vmax = veh.getEdge()->getVehicleMaxSpeed(&veh); + const double vmax = veh.getEdge()->getVehicleMaxSpeed(&veh); if (vmax > 0) { - myTimeLoss += TIME2STEPS(timeOnLane * (vmax - meanSpeedVehicleOnLane) / vmax); + myMesoTimeLoss += TIME2STEPS(timeOnLane * (vmax - meanSpeedVehicleOnLane) / vmax); } myWaitingTime += veh.getWaitingTime(); } bool -MSDevice_Tripinfo::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason) { +MSDevice_Tripinfo::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { if (reason == MSMoveReminder::NOTIFICATION_DEPARTED) { if (!MSGlobals::gUseMesoSim) { myDepartLane = static_cast(veh).getLane()->getID(); @@ -151,8 +138,8 @@ bool -MSDevice_Tripinfo::notifyLeave(SUMOVehicle& veh, SUMOReal /*lastPos*/, - MSMoveReminder::Notification reason) { +MSDevice_Tripinfo::notifyLeave(SUMOVehicle& veh, double /*lastPos*/, + MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { if (reason >= MSMoveReminder::NOTIFICATION_ARRIVED) { myArrivalTime = MSNet::getInstance()->getCurrentTimeStep(); if (!MSGlobals::gUseMesoSim) { @@ -173,10 +160,10 @@ } void -MSDevice_Tripinfo::computeLengthAndDuration(SUMOReal& routeLength, SUMOTime& duration) const { +MSDevice_Tripinfo::computeLengthAndDuration(double& routeLength, SUMOTime& duration) const { SUMOTime finalTime; - SUMOReal finalPos; - SUMOReal finalPosOnInternal = 0; + double finalPos; + double finalPosOnInternal = 0; if (myArrivalTime == NOT_ARRIVED) { finalTime = MSNet::getInstance()->getCurrentTimeStep(); finalPos = myHolder.getPositionOnLane(); @@ -201,12 +188,13 @@ void MSDevice_Tripinfo::generateOutput() const { - updateStatistics(); + const SUMOTime timeLoss = MSGlobals::gUseMesoSim ? myMesoTimeLoss : static_cast(myHolder).getTimeLoss(); + updateStatistics(timeLoss); if (!OptionsCont::getOptions().isSet("tripinfo-output")) { return; } myPendingOutput.erase(this); - SUMOReal routeLength; + double routeLength; SUMOTime duration; computeLengthAndDuration(routeLength, duration); @@ -231,7 +219,7 @@ os.writeAttr("duration", time2string(duration)); os.writeAttr("routeLength", routeLength); os.writeAttr("waitSteps", myWaitingTime / DELTA_T); - os.writeAttr("timeLoss", time2string(myTimeLoss)); + os.writeAttr("timeLoss", time2string(timeLoss)); os.writeAttr("rerouteNo", myHolder.getNumberReroutes()); const std::vector& devices = myHolder.getDevices(); std::ostringstream str; @@ -243,6 +231,7 @@ } os.writeAttr("devices", str.str()); os.writeAttr("vType", myHolder.getVehicleType().getID()); + os.writeAttr("speedFactor", myHolder.getChosenSpeedFactor()); os.writeAttr("vaporized", (myHolder.getEdge() == *(myHolder.getRoute().end() - 1) ? "" : "0")); // cannot close tag because emission device output might follow } @@ -267,8 +256,8 @@ void -MSDevice_Tripinfo::updateStatistics() const { - SUMOReal routeLength; +MSDevice_Tripinfo::updateStatistics(SUMOTime timeLoss) const { + double routeLength; SUMOTime duration; computeLengthAndDuration(routeLength, duration); @@ -276,7 +265,7 @@ myTotalRouteLength += routeLength; myTotalDuration += duration; myTotalWaitingTime += myWaitingTime; - myTotalTimeLoss += myTimeLoss; + myTotalTimeLoss += timeLoss; myTotalDepartDelay += myHolder.getDepartDelay(); } @@ -285,7 +274,7 @@ MSDevice_Tripinfo::printStatistics() { std::ostringstream msg; msg.setf(msg.fixed); - msg.precision(OUTPUT_ACCURACY); + msg.precision(gPrecision); msg << "Statistics (avg):\n" << " RouteLength: " << getAvgRouteLength() << "\n" << " Duration: " << getAvgDuration() << "\n" @@ -296,7 +285,7 @@ } -SUMOReal +double MSDevice_Tripinfo::getAvgRouteLength() { if (myVehicleCount > 0) { return myTotalRouteLength / myVehicleCount; @@ -305,7 +294,7 @@ } } -SUMOReal +double MSDevice_Tripinfo::getAvgDuration() { if (myVehicleCount > 0) { return STEPS2TIME(myTotalDuration / myVehicleCount); @@ -314,7 +303,7 @@ } } -SUMOReal +double MSDevice_Tripinfo::getAvgWaitingTime() { if (myVehicleCount > 0) { return STEPS2TIME(myTotalWaitingTime / myVehicleCount); @@ -323,7 +312,8 @@ } } -SUMOReal + +double MSDevice_Tripinfo::getAvgTimeLoss() { if (myVehicleCount > 0) { return STEPS2TIME(myTotalTimeLoss / myVehicleCount); @@ -332,7 +322,8 @@ } } -SUMOReal + +double MSDevice_Tripinfo::getAvgDepartDelay() { if (myVehicleCount > 0) { return STEPS2TIME(myTotalDepartDelay / myVehicleCount); @@ -342,5 +333,26 @@ } -/****************************************************************************/ +void +MSDevice_Tripinfo::saveState(OutputDevice& out) const { + out.openTag(SUMO_TAG_DEVICE); + out.writeAttr(SUMO_ATTR_ID, getID()); + std::vector internals; + internals.push_back(myDepartLane); + internals.push_back(toString(myDepartPosLat)); + internals.push_back(toString(myDepartSpeed)); + out.writeAttr(SUMO_ATTR_STATE, toString(internals)); + out.closeTag(); +} + +void +MSDevice_Tripinfo::loadState(const SUMOSAXAttributes& attrs) { + std::istringstream bis(attrs.getString(SUMO_ATTR_STATE)); + bis >> myDepartLane; + bis >> myDepartPosLat; + bis >> myDepartSpeed; +} + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Tripinfo.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Tripinfo.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Tripinfo.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Tripinfo.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Fri, 30.01.2009 -/// @version $Id: MSDevice_Tripinfo.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSDevice_Tripinfo.h 23665 2017-03-27 09:04:40Z namdre $ /// // A device which collects info on the vehicle trip /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -66,7 +66,7 @@ static void buildVehicleDevices(SUMOVehicle& v, std::vector& into); /// @brief update tripinfo statistics - void updateStatistics() const; + void updateStatistics(SUMOTime timeLoss) const; /// @brief generate output for vehicles which are still in the network static void generateOutputForUnfinished(); @@ -75,11 +75,11 @@ static std::string printStatistics(); /// @brief accessors for GUINet-Parameters - static SUMOReal getAvgRouteLength(); - static SUMOReal getAvgDuration(); - static SUMOReal getAvgWaitingTime(); - static SUMOReal getAvgTimeLoss(); - static SUMOReal getAvgDepartDelay(); + static double getAvgRouteLength(); + static double getAvgDuration(); + static double getAvgWaitingTime(); + static double getAvgTimeLoss(); + static double getAvgDepartDelay(); public: /// @brief Destructor. @@ -98,7 +98,7 @@ * @param[in] newSpeed Moving speed. * @return True (always). */ - bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed); + bool notifyMove(SUMOVehicle& veh, double oldPos, double newPos, double newSpeed); /** @brief Saves departure info on insertion @@ -109,7 +109,7 @@ * @see MSMoveReminder::notifyEnter * @see MSMoveReminder::Notification */ - bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason); + bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /** @brief Saves arrival info @@ -120,10 +120,14 @@ * @param[in] isLaneChange whether the vehicle changed from the lane * @return True if it did not leave the net. */ - bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason); + bool notifyLeave(SUMOVehicle& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /// @} + /// @brief return the name for this type of device + const std::string deviceName() const { + return "tripinfo"; + } /** @brief Called on writing tripinfo output * @@ -133,6 +137,17 @@ */ void generateOutput() const; + /** @brief Saves the state of the device + * + * @param[in] out The OutputDevice to write the information into + */ + void saveState(OutputDevice& out) const; + + /** @brief Loads the state of the device from the given description + * + * @param[in] attrs XML attributes describing the current state + */ + void loadState(const SUMOSAXAttributes& attrs); private: @@ -150,29 +165,29 @@ /* @brief compute trip length and duration (depending on whether the vehicle arrived or not */ - void computeLengthAndDuration(SUMOReal& routeLength, SUMOTime& duration) const; + void computeLengthAndDuration(double& routeLength, SUMOTime& duration) const; protected: /** @brief Internal notification about the vehicle moves, see MSMoveReminder::notifyMoveInternal() * */ void notifyMoveInternal(const SUMOVehicle& veh, - const SUMOReal frontOnLane, - const SUMOReal timeOnLane, - const SUMOReal meanSpeedFrontOnLane, - const SUMOReal meanSpeedVehicleOnLane, - const SUMOReal travelledDistanceFrontOnLane, - const SUMOReal travelledDistanceVehicleOnLane); + const double frontOnLane, + const double timeOnLane, + const double meanSpeedFrontOnLane, + const double meanSpeedVehicleOnLane, + const double travelledDistanceFrontOnLane, + const double travelledDistanceVehicleOnLane); private: /// @brief The lane the vehicle departed at std::string myDepartLane; /// @brief The speed on departure - SUMOReal myDepartSpeed; + double myDepartSpeed; /// @brief The lateral depart position - SUMOReal myDepartPosLat; + double myDepartPosLat; /// @brief The overall waiting time SUMOTime myWaitingTime; @@ -184,16 +199,16 @@ std::string myArrivalLane; /// @brief The position on the lane the vehicle arrived at - SUMOReal myArrivalPos; + double myArrivalPos; /// @brief The lateral position on the lane the vehicle arrived at - SUMOReal myArrivalPosLat; + double myArrivalPosLat; /// @brief The speed when arriving - SUMOReal myArrivalSpeed; + double myArrivalSpeed; /// @brief The time loss when compared to the desired and allowed speed - SUMOTime myTimeLoss; + SUMOTime myMesoTimeLoss; /// @brief devices which may still need to produce output typedef std::set > DeviceSet; @@ -201,8 +216,8 @@ static DeviceSet myPendingOutput; /// @brief global tripinfo statistics - static SUMOReal myVehicleCount; - static SUMOReal myTotalRouteLength; + static double myVehicleCount; + static double myTotalRouteLength; static SUMOTime myTotalDuration; static SUMOTime myTotalWaitingTime; static SUMOTime myTotalTimeLoss; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Vehroutes.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Vehroutes.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Vehroutes.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Vehroutes.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Fri, 30.01.2009 -/// @version $Id: MSDevice_Vehroutes.cpp 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: MSDevice_Vehroutes.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A device which collects info on the vehicle trip /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,16 +35,14 @@ #include #include #include +#include #include #include #include #include +#include #include "MSDevice_Vehroutes.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member variables @@ -112,8 +110,15 @@ // --------------------------------------------------------------------------- // MSDevice_Vehroutes-methods // --------------------------------------------------------------------------- -MSDevice_Vehroutes::MSDevice_Vehroutes(SUMOVehicle& holder, const std::string& id, int maxRoutes) - : MSDevice(holder, id), myCurrentRoute(&holder.getRoute()), myMaxRoutes(maxRoutes), myLastSavedAt(0) { +MSDevice_Vehroutes::MSDevice_Vehroutes(SUMOVehicle& holder, const std::string& id, int maxRoutes) : + MSDevice(holder, id), + myCurrentRoute(&holder.getRoute()), + myMaxRoutes(maxRoutes), + myLastSavedAt(0), + myDepartLane(-1), + myDepartPos(-1), + myDepartSpeed(-1), + myDepartPosLat(0) { myCurrentRoute->addReference(); } @@ -128,19 +133,25 @@ bool -MSDevice_Vehroutes::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason) { +MSDevice_Vehroutes::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { if (reason == MSMoveReminder::NOTIFICATION_DEPARTED) { if (mySorted && myStateListener.myDevices[&veh] == this) { const SUMOTime departure = myIntendedDepart ? myHolder.getParameter().depart : MSNet::getInstance()->getCurrentTimeStep(); myDepartureCounts[departure]++; } + if (!MSGlobals::gUseMesoSim) { + myDepartLane = static_cast(veh).getLane()->getIndex(); + myDepartPosLat = static_cast(veh).getLateralPositionOnLane(); + } + myDepartSpeed = veh.getSpeed(); + myDepartPos = veh.getPositionOnLane(); } return mySaveExits; } bool -MSDevice_Vehroutes::notifyLeave(SUMOVehicle& veh, SUMOReal /*lastPos*/, MSMoveReminder::Notification reason) { +MSDevice_Vehroutes::notifyLeave(SUMOVehicle& veh, double /*lastPos*/, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { if (mySaveExits && reason != NOTIFICATION_LANE_CHANGE) { if (reason != NOTIFICATION_TELEPORT && myLastSavedAt == veh.getEdge()) { // need to check this for internal lanes myExits.back() = MSNet::getInstance()->getCurrentTimeStep(); @@ -223,29 +234,45 @@ void MSDevice_Vehroutes::generateOutput() const { + writeOutput(true); +} + + +void +MSDevice_Vehroutes::writeOutput(const bool hasArrived) const { OutputDevice& routeOut = OutputDevice::getDeviceByOption("vehroute-output"); OutputDevice_String od(routeOut.isBinary(), 1); - const SUMOTime departure = myIntendedDepart ? myHolder.getParameter().depart : myHolder.getDeparture(); - od.openTag(SUMO_TAG_VEHICLE).writeAttr(SUMO_ATTR_ID, myHolder.getID()); - if (myHolder.getVehicleType().getID() != DEFAULT_VTYPE_ID) { - od.writeAttr(SUMO_ATTR_TYPE, myHolder.getVehicleType().getID()); - } - od.writeAttr(SUMO_ATTR_DEPART, time2string(departure)); - if (myHolder.hasArrived()) { + SUMOVehicleParameter tmp = myHolder.getParameter(); + tmp.depart = myIntendedDepart ? myHolder.getParameter().depart : myHolder.getDeparture(); + if (!MSGlobals::gUseMesoSim) { + if (tmp.wasSet(VEHPARS_DEPARTLANE_SET)) { + tmp.departLaneProcedure = DEPART_LANE_GIVEN; + tmp.departLane = myDepartLane; + } + if (tmp.wasSet(VEHPARS_DEPARTPOSLAT_SET)) { + tmp.departPosLatProcedure = DEPART_POSLAT_GIVEN; + tmp.departPosLat = myDepartPosLat; + } + } + if (tmp.wasSet(VEHPARS_DEPARTPOS_SET)) { + tmp.departPosProcedure = DEPART_POS_GIVEN; + tmp.departPos = myDepartPos; + } + if (tmp.wasSet(VEHPARS_DEPARTSPEED_SET)) { + tmp.departSpeedProcedure = DEPART_SPEED_GIVEN; + tmp.departSpeed = myDepartSpeed; + } + const std::string typeID = myHolder.getVehicleType().getID() != DEFAULT_VTYPE_ID ? myHolder.getVehicleType().getID() : ""; + tmp.write(od, OptionsCont::getOptions(), SUMO_TAG_VEHICLE, typeID); + if (hasArrived) { od.writeAttr("arrival", time2string(MSNet::getInstance()->getCurrentTimeStep())); if (myRouteLength) { const bool includeInternalLengths = MSGlobals::gUsingInternalLanes && MSNet::getInstance()->hasInternalLinks(); - const SUMOReal routeLength = myHolder.getRoute().getDistanceBetween(myHolder.getDepartPos(), myHolder.getArrivalPos(), - myHolder.getRoute().begin(), myHolder.getCurrentRouteEdge(), includeInternalLengths); + const double routeLength = myHolder.getRoute().getDistanceBetween(myHolder.getDepartPos(), myHolder.getArrivalPos(), + myHolder.getRoute().begin(), myHolder.getCurrentRouteEdge(), includeInternalLengths); od.writeAttr("routeLength", routeLength); } } - if (myHolder.getParameter().wasSet(VEHPARS_FROM_TAZ_SET)) { - od.writeAttr(SUMO_ATTR_FROM_TAZ, myHolder.getParameter().fromTaz); - } - if (myHolder.getParameter().wasSet(VEHPARS_TO_TAZ_SET)) { - od.writeAttr(SUMO_ATTR_TO_TAZ, myHolder.getParameter().toTaz); - } if (myDUAStyle) { const RandomDistributor* const routeDist = MSRoute::distDictionary("!" + myHolder.getID()); if (routeDist != 0) { @@ -255,7 +282,7 @@ ++index; } od.openTag(SUMO_TAG_ROUTE_DISTRIBUTION).writeAttr(SUMO_ATTR_LAST, index); - const std::vector& probs = routeDist->getProbs(); + const std::vector& probs = routeDist->getProbs(); for (int i = 0; i < (int)routes.size(); ++i) { od.setPrecision(); od.openTag(SUMO_TAG_ROUTE).writeAttr(SUMO_ATTR_COST, routes[i]->getCosts()); @@ -282,17 +309,18 @@ od.closeTag(); } } - for (std::map::const_iterator j = myHolder.getParameter().getMap().begin(); j != myHolder.getParameter().getMap().end(); ++j) { - od.openTag(SUMO_TAG_PARAM); - od.writeAttr(SUMO_ATTR_KEY, (*j).first); - od.writeAttr(SUMO_ATTR_VALUE, (*j).second); - od.closeTag(); + for (std::vector::const_iterator i = myHolder.getParameter().stops.begin(); i != myHolder.getParameter().stops.end(); ++i) { + i->write(od); } + for (std::vector::const_iterator i = myHolder.getRoute().getStops().begin(); i != myHolder.getRoute().getStops().end(); ++i) { + i->write(od); + } + myHolder.getParameter().writeParams(od); od.closeTag(); od.lf(); if (mySorted) { - myRouteInfos[departure][myHolder.getID()] = od.getString(); - myDepartureCounts[departure]--; + myRouteInfos[tmp.depart][myHolder.getID()] = od.getString(); + myDepartureCounts[tmp.depart]--; std::map::iterator it = myDepartureCounts.begin(); while (it != myDepartureCounts.end() && it->second == 0) { std::map& infos = myRouteInfos[it->first]; @@ -344,11 +372,55 @@ for (std::map >::const_iterator it = myStateListener.myDevices.begin(); it != myStateListener.myDevices.end(); ++it) { if (it->first->hasDeparted()) { - it->second->generateOutput(); + it->second->writeOutput(false); } } } -/****************************************************************************/ +void +MSDevice_Vehroutes::saveState(OutputDevice& out) const { + out.openTag(SUMO_TAG_DEVICE); + out.writeAttr(SUMO_ATTR_ID, getID()); + std::vector internals; + if (!MSGlobals::gUseMesoSim) { + internals.push_back(toString(myDepartLane)); + internals.push_back(toString(myDepartPosLat)); + } + internals.push_back(toString(myDepartSpeed)); + internals.push_back(toString(myDepartPos)); + internals.push_back(toString(myReplacedRoutes.size())); + for (int i = 0; i < (int)myReplacedRoutes.size(); ++i) { + internals.push_back(myReplacedRoutes[i].edge->getID()); + internals.push_back(toString(myReplacedRoutes[i].time)); + internals.push_back(myReplacedRoutes[i].route->getID()); + } + out.writeAttr(SUMO_ATTR_STATE, toString(internals)); + out.closeTag(); +} + + +void +MSDevice_Vehroutes::loadState(const SUMOSAXAttributes& attrs) { + std::istringstream bis(attrs.getString(SUMO_ATTR_STATE)); + if (!MSGlobals::gUseMesoSim) { + bis >> myDepartLane; + bis >> myDepartPosLat; + } + bis >> myDepartSpeed; + bis >> myDepartPos; + int size; + bis >> size; + for (int i = 0; i < size; ++i) { + std::string edgeID; + SUMOTime time; + std::string routeID; + bis >> edgeID; + bis >> time; + bis >> routeID; + myReplacedRoutes.push_back(RouteReplaceInfo(MSEdge::dictionary(edgeID), time, MSRoute::dictionary(routeID))); + } +} + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Vehroutes.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Vehroutes.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/devices/MSDevice_Vehroutes.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/devices/MSDevice_Vehroutes.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Fri, 30.01.2009 -/// @version $Id: MSDevice_Vehroutes.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSDevice_Vehroutes.h 23989 2017-04-20 13:02:53Z namdre $ /// // A device which collects info on the vehicle trip /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -79,7 +79,6 @@ static void generateOutputForUnfinished(); - public: /// @brief Destructor. ~MSDevice_Vehroutes(); @@ -97,7 +96,7 @@ * @see MSMoveReminder::notifyEnter * @see MSMoveReminder::Notification */ - bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason); + bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /** @brief Saves exit times if needed @@ -111,15 +110,18 @@ * * @return True, if exit times are to be collected. */ - bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, Notification reason); + bool notifyLeave(SUMOVehicle& veh, double lastPos, Notification reason, const MSLane* enteredLane = 0); /// @} + /// @brief return the name for this type of device + const std::string deviceName() const { + return "vehroute"; + } + - /** @brief Called on writing tripinfo output + /** @brief Called on writing vehroutes output * - * @param[in] os The stream to write the information into * @exception IOError not yet implemented - * @see MSDevice::tripInfoOutput */ void generateOutput() const; @@ -132,6 +134,18 @@ const MSRoute* getRoute(int index) const; + /** @brief Saves the state of the device + * + * @param[in] out The OutputDevice to write the information into + */ + void saveState(OutputDevice& out) const; + + /** @brief Loads the state of the device from the given description + * + * @param[in] attrs XML attributes describing the current state + */ + void loadState(const SUMOSAXAttributes& attrs); + private: /** @brief Constructor @@ -150,6 +164,14 @@ void writeXMLRoute(OutputDevice& os, int index = -1) const; + /** @brief Called on writing vehroutes output + * + * @param[in] hasArrived whether the vehicle has valid arrival information + * @exception IOError not yet implemented + */ + void writeOutput(const bool hasArrived) const; + + /** @brief Called on route change */ void addRoute(); @@ -254,6 +276,17 @@ /// @brief The last edge the exit time was saved for const MSEdge* myLastSavedAt; + /// @brief The lane the vehicle departed at + int myDepartLane; + + /// @brief The lane the vehicle departed at + double myDepartPos; + + /// @brief The speed on departure + double myDepartSpeed; + + /// @brief The lateral depart position + double myDepartPosLat; private: /// @brief Invalidated copy constructor. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/lcmodels/MSAbstractLaneChangeModel.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/lcmodels/MSAbstractLaneChangeModel.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/lcmodels/MSAbstractLaneChangeModel.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/lcmodels/MSAbstractLaneChangeModel.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,7 +6,7 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Fri, 29.04.2005 -/// @version $Id: MSAbstractLaneChangeModel.cpp 21373 2016-08-31 08:20:28Z luecken $ +/// @version $Id: MSAbstractLaneChangeModel.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Interface for lane-change models /****************************************************************************/ @@ -46,6 +46,7 @@ * ----------------------------------------------------------------------- */ bool MSAbstractLaneChangeModel::myAllowOvertakingRight(false); bool MSAbstractLaneChangeModel::myLCOutput(false); +const double MSAbstractLaneChangeModel::NO_LATERAL_NEIGHBOR(std::numeric_limits::max()); /* ------------------------------------------------------------------------- * MSAbstractLaneChangeModel-methods @@ -100,6 +101,14 @@ MSAbstractLaneChangeModel::~MSAbstractLaneChangeModel() { } +void +MSAbstractLaneChangeModel::setOwnState(const int state) { + myOwnState = state; + // reset lateral influence after step is completed + if (myVehicle.hasInfluencer()) { + myVehicle.getInfluencer().setSublaneChange(0); + } +} bool MSAbstractLaneChangeModel::congested(const MSVehicle* const neighLeader) { @@ -122,7 +131,7 @@ bool -MSAbstractLaneChangeModel::predInteraction(const std::pair& leader) { +MSAbstractLaneChangeModel::predInteraction(const std::pair& leader) { if (leader.first == 0) { return false; } @@ -142,7 +151,7 @@ if (MSGlobals::gLaneChangeDuration > DELTA_T) { myLaneChangeCompletion = 0; myLaneChangeDirection = direction; - myLateralspeed = (target->getCenterOnEdge() - source->getCenterOnEdge()) * (SUMOReal)DELTA_T / (SUMOReal)MSGlobals::gLaneChangeDuration; + myLateralspeed = (target->getCenterOnEdge() - source->getCenterOnEdge()) * (double)DELTA_T / (double)MSGlobals::gLaneChangeDuration; myVehicle.switchOffSignal(MSVehicle::VEH_SIGNAL_BLINKER_RIGHT | MSVehicle::VEH_SIGNAL_BLINKER_LEFT); myVehicle.switchOnSignal(direction == 1 ? MSVehicle::VEH_SIGNAL_BLINKER_LEFT : MSVehicle::VEH_SIGNAL_BLINKER_RIGHT); return true; @@ -156,7 +165,7 @@ void MSAbstractLaneChangeModel::primaryLaneChanged(MSLane* source, MSLane* target, int direction) { initLastLaneChangeOffset(direction); - myVehicle.leaveLane(MSMoveReminder::NOTIFICATION_LANE_CHANGE); + myVehicle.leaveLane(MSMoveReminder::NOTIFICATION_LANE_CHANGE, target); source->leftByLaneChange(&myVehicle); myVehicle.enterLaneAtLaneChange(target); target->enteredByLaneChange(&myVehicle); @@ -170,6 +179,10 @@ of.writeAttr(SUMO_ATTR_DIR, direction); of.writeAttr(SUMO_ATTR_SPEED, myVehicle.getSpeed()); of.writeAttr("reason", toString((LaneChangeAction)(myOwnState & ~(LCA_RIGHT | LCA_LEFT)))); + if (MSGlobals::gLateralResolution > 0) { + const double latGap = direction < 0 ? myLastLateralGapRight : myLastLateralGapLeft; + of.writeAttr("latGap", latGap == NO_LATERAL_NEIGHBOR ? "None" : toString(latGap)); + } of.closeTag(); } changed(); @@ -179,7 +192,7 @@ bool MSAbstractLaneChangeModel::updateCompletion() { const bool pastBefore = pastMidpoint(); - myLaneChangeCompletion += (SUMOReal)DELTA_T / (SUMOReal)MSGlobals::gLaneChangeDuration; + myLaneChangeCompletion += (double)DELTA_T / (double)MSGlobals::gLaneChangeDuration; return !pastBefore && pastMidpoint(); } @@ -192,6 +205,9 @@ myNoPartiallyOccupatedByShadow.clear(); myVehicle.switchOffSignal(MSVehicle::VEH_SIGNAL_BLINKER_RIGHT | MSVehicle::VEH_SIGNAL_BLINKER_LEFT); myVehicle.fixPosition(); + if (myAmOpposite) { + changedToOpposite(); + } } @@ -199,7 +215,7 @@ MSAbstractLaneChangeModel::getShadowLane(const MSLane* lane) const { if (std::find(myNoPartiallyOccupatedByShadow.begin(), myNoPartiallyOccupatedByShadow.end(), lane) == myNoPartiallyOccupatedByShadow.end()) { // initialize shadow lane - const SUMOReal overlap = myVehicle.getLateralOverlap(); + const double overlap = myVehicle.getLateralOverlap(); if (myVehicle.getID() == "disabled") { std::cout << SIMTIME << " veh=" << myVehicle.getID() << " posLat=" << myVehicle.getLateralPositionOnLane() << " overlap=" << overlap << "\n"; } @@ -256,7 +272,7 @@ void MSAbstractLaneChangeModel::updateShadowLane() { if (myShadowLane != 0) { - if (gDebugFlag4) { + if (debugVehicle()) { std::cout << SIMTIME << " updateShadowLane\n"; } myShadowLane->resetPartialOccupation(&myVehicle); @@ -266,12 +282,13 @@ if (myShadowLane != 0) { myShadowLane->setPartialOccupation(&myVehicle); const std::vector& further = myVehicle.getFurtherLanes(); - const std::vector& furtherPosLat = myVehicle.getFurtherLanesPosLat(); + const std::vector& furtherPosLat = myVehicle.getFurtherLanesPosLat(); assert(further.size() == furtherPosLat.size()); - for (int i = (int)further.size() - 1; i >= 0; --i) { + passed.push_back(myShadowLane); + for (int i = 0; i < (int)further.size(); ++i) { if (furtherPosLat[i] == myVehicle.getLateralPositionOnLane()) { MSLane* shadowFurther = getShadowLane(further[i]); - if (shadowFurther != 0) { + if (shadowFurther != 0 && MSLinkContHelper::getConnectingLink(*shadowFurther, *passed.back()) != 0) { passed.push_back(shadowFurther); } } else { @@ -279,7 +296,7 @@ break; } } - passed.push_back(myShadowLane); + std::reverse(passed.begin(), passed.end()); } else { if (isChangingLanes() && myVehicle.getLateralOverlap() > NUMERICAL_EPS) { WRITE_WARNING("Vehicle '" + myVehicle.getID() + "' could not finish continuous lane change (lane disappeared) time=" + @@ -287,12 +304,12 @@ endLaneChangeManeuver(); } } - if (gDebugFlag4) std::cout << SIMTIME << " updateShadowLane veh=" << myVehicle.getID() - << " newShadowLane=" << Named::getIDSecure(myShadowLane) - << "\n before:" << " myShadowFurtherLanes=" << toString(myShadowFurtherLanes) << " passed=" << toString(passed) - << "\n"; + if (debugVehicle()) std::cout << SIMTIME << " updateShadowLane veh=" << myVehicle.getID() + << " newShadowLane=" << Named::getIDSecure(myShadowLane) + << "\n before:" << " myShadowFurtherLanes=" << toString(myShadowFurtherLanes) << " further=" << toString(myVehicle.getFurtherLanes()) << " passed=" << toString(passed) + << "\n"; myVehicle.updateFurtherLanes(myShadowFurtherLanes, myShadowFurtherLanesPosLat, passed); - if (gDebugFlag4) std::cout + if (debugVehicle()) std::cout << "\n after:" << " myShadowFurtherLanes=" << toString(myShadowFurtherLanes) << "\n"; } @@ -314,9 +331,9 @@ } -SUMOReal +double MSAbstractLaneChangeModel::getAngleOffset() const { - const SUMOReal angleOffset = 60 / STEPS2TIME(MSGlobals::gLaneChangeDuration) * (pastMidpoint() ? 1 - myLaneChangeCompletion : myLaneChangeCompletion); + const double angleOffset = 60 / STEPS2TIME(MSGlobals::gLaneChangeDuration) * (pastMidpoint() ? 1 - myLaneChangeCompletion : myLaneChangeCompletion); return myLaneChangeDirection * angleOffset; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/lcmodels/MSAbstractLaneChangeModel.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/lcmodels/MSAbstractLaneChangeModel.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/lcmodels/MSAbstractLaneChangeModel.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/lcmodels/MSAbstractLaneChangeModel.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Fri, 29.04.2005 -/// @version $Id: MSAbstractLaneChangeModel.h 21076 2016-07-01 09:22:07Z namdre $ +/// @version $Id: MSAbstractLaneChangeModel.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Interface for lane-change models /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -117,14 +117,18 @@ // @brief LaneChangeAction flags int state; // @brief lateralDistance - SUMOReal latDist; + double latDist; // @brief direction that was checked int dir; - StateAndDist(int _state, SUMOReal _latDist, int _dir) : + StateAndDist(int _state, double _latDist, int _dir) : state(_state), latDist(_latDist), dir(_dir) {} + + bool sameDirection(const StateAndDist& other) const { + return latDist * other.latDist > 0; + } }; /// @brief init global model parameters @@ -149,11 +153,21 @@ return myOwnState; } - virtual void setOwnState(int state) { - myOwnState = state; + virtual void setOwnState(const int state); + + const std::pair& getSavedState(const int dir) const { + return mySavedStates.find(dir)->second; } - virtual void prepareStep() { } + void saveState(const int dir, const int stateWithoutTraCI, const int state) { + mySavedStates[dir] = std::make_pair(stateWithoutTraCI, state); + } + + virtual void prepareStep() { + saveState(-1, LCA_UNKNOWN, LCA_UNKNOWN); + saveState(0, LCA_UNKNOWN, LCA_UNKNOWN); + saveState(1, LCA_UNKNOWN, LCA_UNKNOWN); + } /** @brief Called to examine whether the vehicle wants to change * using the given laneOffset. @@ -162,9 +176,9 @@ virtual int wantsChange( int laneOffset, MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked, - const std::pair& leader, - const std::pair& neighLead, - const std::pair& neighFollow, + const std::pair& leader, + const std::pair& neighLead, + const std::pair& neighFollow, const MSLane& neighLane, const std::vector& preb, MSVehicle** lastBlocked, @@ -194,7 +208,7 @@ const std::vector& preb, MSVehicle** lastBlocked, MSVehicle** firstBlocked, - SUMOReal& latDist, int& blocked) { + double& latDist, int& blocked) { UNUSED_PARAMETER(laneOffset); UNUSED_PARAMETER(&leaders); UNUSED_PARAMETER(&followers); @@ -239,8 +253,8 @@ * @param cfModel The model used * @return the new speed of the vehicle as proposed by the lane changer */ - virtual SUMOReal patchSpeed(const SUMOReal min, const SUMOReal wanted, const SUMOReal max, - const MSCFModel& cfModel) = 0; + virtual double patchSpeed(const double min, const double wanted, const double max, + const MSCFModel& cfModel) = 0; /* @brief called once when the primary lane of the vehicle changes (updates * the custom variables of each child implementation */ @@ -282,7 +296,7 @@ return myShadowFurtherLanes; } - const std::vector& getShadowFurtherLanesPosLat() const { + const std::vector& getShadowFurtherLanesPosLat() const { return myShadowFurtherLanesPosLat; } @@ -313,10 +327,10 @@ int getShadowDirection() const; /// @brief return the angle offset during a continuous change maneuver - SUMOReal getAngleOffset() const; + double getAngleOffset() const; /// @brief return the lateral speed of the current lane change maneuver - inline SUMOReal getLateralSpeed() const { + inline double getLateralSpeed() const { return myLateralspeed; } @@ -350,7 +364,7 @@ void cleanupShadowLane(); /// @brief reserve space at the end of the lane to avoid dead locks - virtual void saveBlockerLength(SUMOReal length) { + virtual void saveBlockerLength(double length) { UNUSED_PARAMETER(length); }; @@ -373,10 +387,21 @@ return myAmOpposite; } + /// @brief try to retrieve the given parameter from this laneChangeModel. Throw exception for unsupported key + virtual std::string getParameter(const std::string& key) const { + throw InvalidArgument("Parameter '" + key + "' is not supported for laneChangeModel of type '" + toString(myModel) + "'"); + } + + /// @brief try to set the given parameter for this laneChangeModel. Throw exception for unsupported key + virtual void setParameter(const std::string& key, const std::string& value) { + UNUSED_PARAMETER(value); + throw InvalidArgument("Setting parameter '" + key + "' is not supported for laneChangeModel of type '" + toString(myModel) + "'"); + } + protected: virtual bool congested(const MSVehicle* const neighLeader); - virtual bool predInteraction(const std::pair& leader); + virtual bool predInteraction(const std::pair& leader); /// @brief whether the influencer cancels the given request bool cancelRequest(int state); @@ -388,15 +413,16 @@ /// @brief The current state of the vehicle int myOwnState; + std::map > mySavedStates; /// @brief progress of the lane change maneuver 0:started, 1:complete - SUMOReal myLaneChangeCompletion; + double myLaneChangeCompletion; /// @brief direction of the lane change maneuver -1 means right, 1 means left int myLaneChangeDirection; /// @brief The lateral offset during a continuous LaneChangeManeuver - SUMOReal myLateralspeed; + double myLateralspeed; /// @brief whether the vehicle has already moved this step bool myAlreadyChanged; @@ -407,7 +433,7 @@ /* @brief Lanes that are parially (laterally) occupied by the back of the * vehicle (analogue to MSVehicle::myFurtherLanes) */ std::vector myShadowFurtherLanes; - std::vector myShadowFurtherLanesPosLat; + std::vector myShadowFurtherLanesPosLat; /// @brief The vehicle's car following model const MSCFModel& myCarFollowModel; @@ -422,6 +448,11 @@ * (when changing to a lane that has no predecessor) */ std::vector myNoPartiallyOccupatedByShadow; + /// @brief the minimum lateral gaps to other vehicles that were found when last changing to the left and right + double myLastLateralGapLeft; + double myLastLateralGapRight; + + /* @brief to be called by derived classes in their changed() method. * If dir=0 is given, the current value remains unchanged */ void initLastLaneChangeOffset(int dir); @@ -432,6 +463,8 @@ /// @brief whether to record lane-changing static bool myLCOutput; + static const double NO_LATERAL_NEIGHBOR; + private: /* @brief information how long ago the vehicle has performed a lane-change, * sign indicates direction of the last change diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_DK2008.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_DK2008.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_DK2008.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_DK2008.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Tue, 29.05.2005 -/// @version $Id: MSLCM_DK2008.cpp 20550 2016-04-26 10:57:45Z namdre $ +/// @version $Id: MSLCM_DK2008.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A lane change model developed by D. Krajzewicz between 2004 and 2010 /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,6 @@ #include #include "MSLCM_DK2008.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - //#define DEBUG_VEHICLE_GUI_SELECTION 1 // =========================================================================== @@ -76,9 +72,9 @@ MSLCM_DK2008::wantsChange( int laneOffset, MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked, - const std::pair& leader, - const std::pair& neighLead, - const std::pair& neighFollow, + const std::pair& leader, + const std::pair& neighLead, + const std::pair& neighFollow, const MSLane& neighLane, const std::vector& preb, MSVehicle** lastBlocked, @@ -94,9 +90,9 @@ int MSLCM_DK2008::wantsChangeToRight(MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked, - const std::pair& leader, - const std::pair& neighLead, - const std::pair& neighFollow, + const std::pair& leader, + const std::pair& neighLead, + const std::pair& neighFollow, const MSLane& neighLane, const std::vector& preb, MSVehicle** lastBlocked, @@ -109,10 +105,10 @@ #endif MSVehicle::LaneQ curr, best; int bestLaneOffset = 0; - SUMOReal currentDist = 0; - SUMOReal neighDist = 0; - SUMOReal neighExtDist = 0; - SUMOReal currExtDist = 0; + double currentDist = 0; + double neighDist = 0; + double neighExtDist = 0; + double currExtDist = 0; int currIdx = 0; MSLane* prebLane = myVehicle.getLane(); if (prebLane->getEdge().getPurpose() == MSEdge::EDGEFUNCTION_INTERNAL) { @@ -154,7 +150,7 @@ // process information about the last blocked vehicle // if this vehicle is blocking someone in front, we maybe decelerate to let him in if ((*lastBlocked) != 0) { - SUMOReal gap = (*lastBlocked)->getPositionOnLane() - (*lastBlocked)->getVehicleType().getLength() - myVehicle.getPositionOnLane() - myVehicle.getVehicleType().getMinGap(); + double gap = (*lastBlocked)->getPositionOnLane() - (*lastBlocked)->getVehicleType().getLength() - myVehicle.getPositionOnLane() - myVehicle.getVehicleType().getMinGap(); if (gap > 0.1) { if (myVehicle.getSpeed() < ACCEL2SPEED(myVehicle.getCarFollowModel().getMaxDecel())) { if ((*lastBlocked)->getSpeed() < SUMO_const_haltingSpeed) { @@ -162,7 +158,7 @@ } else { ret |= LCA_AMBACKBLOCKER; } - myVSafes.push_back(myCarFollowModel.followSpeed(&myVehicle, myVehicle.getSpeed(), (SUMOReal)(gap - 0.1), (*lastBlocked)->getSpeed(), (*lastBlocked)->getCarFollowModel().getMaxDecel())); + myVSafes.push_back(myCarFollowModel.followSpeed(&myVehicle, myVehicle.getSpeed(), (double)(gap - 0.1), (*lastBlocked)->getSpeed(), (*lastBlocked)->getCarFollowModel().getMaxDecel())); (*lastBlocked) = 0; } return ret; @@ -178,19 +174,19 @@ // definitely try to get to the desired lane // // this rule forces our vehicle to change the lane if a lane changing is necessary soon - SUMOReal rv = myVehicle.getSpeed() > LOOK_FORWARD_SPEED_DIVIDER - ? myVehicle.getSpeed() * (SUMOReal) LOOK_FORWARD_FAR - : myVehicle.getSpeed() * (SUMOReal) LOOK_FORWARD_NEAR; - rv += myVehicle.getVehicleType().getLengthWithGap() * (SUMOReal) 2.; + double rv = myVehicle.getSpeed() > LOOK_FORWARD_SPEED_DIVIDER + ? myVehicle.getSpeed() * (double) LOOK_FORWARD_FAR + : myVehicle.getSpeed() * (double) LOOK_FORWARD_NEAR; + rv += myVehicle.getVehicleType().getLengthWithGap() * (double) 2.; - SUMOReal tdist = currentDist - myVehicle.getPositionOnLane() - best.occupation * (SUMOReal) JAM_FACTOR2; + double tdist = currentDist - myVehicle.getPositionOnLane() - best.occupation * (double) JAM_FACTOR2; // assert(best.length > curr.length); // XXX if (curr.length != best.length) && ... - if (fabs(best.length - curr.length) > MIN2((SUMOReal) .1, best.lane->getLength()) && bestLaneOffset < 0 && currentDistDisallows(tdist/*currentDist*/, bestLaneOffset, rv)) { + if (fabs(best.length - curr.length) > MIN2((double) .1, best.lane->getLength()) && bestLaneOffset < 0 && currentDistDisallows(tdist/*currentDist*/, bestLaneOffset, rv)) { informBlocker(msgPass, blocked, LCA_MRIGHT, neighLead, neighFollow); if (neighLead.second > 0 && neighLead.second > leader.second) { - myVSafes.push_back(myCarFollowModel.followSpeed(&myVehicle, myVehicle.getSpeed(), neighLead.second, neighLead.first->getSpeed(), neighLead.first->getCarFollowModel().getMaxDecel()) - (SUMOReal) 0.5); + myVSafes.push_back(myCarFollowModel.followSpeed(&myVehicle, myVehicle.getSpeed(), neighLead.second, neighLead.first->getSpeed(), neighLead.first->getCarFollowModel().getMaxDecel()) - (double) 0.5); } // letting vehicles merge in at the end of the lane in case of counter-lane change, step#1, right @@ -213,8 +209,8 @@ // this rule prevents the vehicle from moving in opposite direction of the best lane // unless the way till the end where the vehicle has to be on the best lane // is long enough - SUMOReal maxJam = MAX2(preb[currIdx - 1].occupation, preb[currIdx].occupation); - SUMOReal neighLeftPlace = MAX2((SUMOReal) 0, neighDist - myVehicle.getPositionOnLane() - maxJam); + double maxJam = MAX2(preb[currIdx - 1].occupation, preb[currIdx].occupation); + double neighLeftPlace = MAX2((double) 0, neighDist - myVehicle.getPositionOnLane() - maxJam); if (bestLaneOffset >= 0 && (currentDistDisallows(neighLeftPlace, bestLaneOffset + 2, rv))) { // ...we will not change the lane if not return ret | LCA_STAY | LCA_STRATEGIC; @@ -260,8 +256,8 @@ if ((congested(neighLead.first) && neighLead.second < 20) || predInteraction(leader)) { //!!! return ret; } - SUMOReal thisLaneVSafe = myVehicle.getLane()->getVehicleMaxSpeed(&myVehicle); - SUMOReal neighLaneVSafe = neighLane.getVehicleMaxSpeed(&myVehicle); + double thisLaneVSafe = myVehicle.getLane()->getVehicleMaxSpeed(&myVehicle); + double neighLaneVSafe = neighLane.getVehicleMaxSpeed(&myVehicle); if (neighLead.first == 0) { neighLaneVSafe = MIN2(neighLaneVSafe, myCarFollowModel.followSpeed(&myVehicle, myVehicle.getSpeed(), neighDist, 0, 0)); } else { @@ -288,13 +284,13 @@ } // let's recheck the "Rechtsfahrgebot" - SUMOReal vmax = MIN2(myVehicle.getLane()->getVehicleMaxSpeed(&myVehicle), myVehicle.getVehicleType().getMaxSpeed()); - vmax -= (SUMOReal)(5. / 2.6); + double vmax = MIN2(myVehicle.getLane()->getVehicleMaxSpeed(&myVehicle), myVehicle.getVehicleType().getMaxSpeed()); + vmax -= (double)(5. / 2.6); if (neighLaneVSafe >= vmax) { myChangeProbability -= TS * ((neighLaneVSafe - vmax) / (vmax)); } - if (myChangeProbability < -2 && neighDist / MAX2((SUMOReal) .1, myVehicle.getSpeed()) > 20.) { //./MAX2((SUMOReal) .1, myVehicle.getSpeed())) { // -.1 + if (myChangeProbability < -2 && neighDist / MAX2((double) .1, myVehicle.getSpeed()) > 20.) { //./MAX2((double) .1, myVehicle.getSpeed())) { // -.1 return ret | LCA_RIGHT | LCA_SPEEDGAIN; } // -------- @@ -306,9 +302,9 @@ int MSLCM_DK2008::wantsChangeToLeft(MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked, - const std::pair& leader, - const std::pair& neighLead, - const std::pair& neighFollow, + const std::pair& leader, + const std::pair& neighLead, + const std::pair& neighFollow, const MSLane& neighLane, const std::vector& preb, MSVehicle** lastBlocked, @@ -321,10 +317,10 @@ #endif MSVehicle::LaneQ curr, best; int bestLaneOffset = 0; - SUMOReal currentDist = 0; - SUMOReal neighDist = 0; - SUMOReal neighExtDist = 0; - SUMOReal currExtDist = 0; + double currentDist = 0; + double neighDist = 0; + double neighExtDist = 0; + double currExtDist = 0; int currIdx = 0; MSLane* prebLane = myVehicle.getLane(); if (prebLane->getEdge().getPurpose() == MSEdge::EDGEFUNCTION_INTERNAL) { @@ -366,7 +362,7 @@ // process information about the last blocked vehicle // if this vehicle is blocking someone in front, we maybe decelerate to let him in if ((*lastBlocked) != 0) { - SUMOReal gap = (*lastBlocked)->getPositionOnLane() - (*lastBlocked)->getVehicleType().getLength() - myVehicle.getPositionOnLane() - myVehicle.getVehicleType().getMinGap(); + double gap = (*lastBlocked)->getPositionOnLane() - (*lastBlocked)->getVehicleType().getLength() - myVehicle.getPositionOnLane() - myVehicle.getVehicleType().getMinGap(); if (gap > 0.1) { if (myVehicle.getSpeed() < ACCEL2SPEED(myVehicle.getCarFollowModel().getMaxDecel())) { if ((*lastBlocked)->getSpeed() < SUMO_const_haltingSpeed) { @@ -374,7 +370,7 @@ } else { ret |= LCA_AMBACKBLOCKER; } - myVSafes.push_back(myCarFollowModel.followSpeed(&myVehicle, myVehicle.getSpeed(), (SUMOReal)(gap - 0.1), (*lastBlocked)->getSpeed(), (*lastBlocked)->getCarFollowModel().getMaxDecel())); + myVSafes.push_back(myCarFollowModel.followSpeed(&myVehicle, myVehicle.getSpeed(), (double)(gap - 0.1), (*lastBlocked)->getSpeed(), (*lastBlocked)->getCarFollowModel().getMaxDecel())); (*lastBlocked) = 0; } return ret; @@ -390,19 +386,19 @@ // definitely try to get to the desired lane // // this rule forces our vehicle to change the lane if a lane changing is necessary soon - SUMOReal lv = myVehicle.getSpeed() > LOOK_FORWARD_SPEED_DIVIDER - ? myVehicle.getSpeed() * (SUMOReal) LOOK_FORWARD_FAR - : myVehicle.getSpeed() * (SUMOReal) LOOK_FORWARD_NEAR; - lv += myVehicle.getVehicleType().getLengthWithGap() * (SUMOReal) 2.; + double lv = myVehicle.getSpeed() > LOOK_FORWARD_SPEED_DIVIDER + ? myVehicle.getSpeed() * (double) LOOK_FORWARD_FAR + : myVehicle.getSpeed() * (double) LOOK_FORWARD_NEAR; + lv += myVehicle.getVehicleType().getLengthWithGap() * (double) 2.; - SUMOReal tdist = currentDist - myVehicle.getPositionOnLane() - best.occupation * (SUMOReal) JAM_FACTOR2; - if (fabs(best.length - curr.length) > MIN2((SUMOReal) .1, best.lane->getLength()) && bestLaneOffset > 0 + double tdist = currentDist - myVehicle.getPositionOnLane() - best.occupation * (double) JAM_FACTOR2; + if (fabs(best.length - curr.length) > MIN2((double) .1, best.lane->getLength()) && bestLaneOffset > 0 && currentDistDisallows(tdist/*currentDist*/, bestLaneOffset, lv)) { informBlocker(msgPass, blocked, LCA_MLEFT, neighLead, neighFollow); if (neighLead.second > 0 && neighLead.second > leader.second) { - myVSafes.push_back(myCarFollowModel.followSpeed(&myVehicle, myVehicle.getSpeed(), neighLead.second, neighLead.first->getSpeed(), neighLead.first->getCarFollowModel().getMaxDecel()) - (SUMOReal) 0.5); + myVSafes.push_back(myCarFollowModel.followSpeed(&myVehicle, myVehicle.getSpeed(), neighLead.second, neighLead.first->getSpeed(), neighLead.first->getCarFollowModel().getMaxDecel()) - (double) 0.5); } // letting vehicles merge in at the end of the lane in case of counter-lane change, step#1, left @@ -425,8 +421,8 @@ // this rule prevents the vehicle from moving in opposite direction of the best lane // unless the way till the end where the vehicle has to be on the best lane // is long enough - SUMOReal maxJam = MAX2(preb[currIdx + 1].occupation, preb[currIdx].occupation); - SUMOReal neighLeftPlace = MAX2((SUMOReal) 0, neighDist - myVehicle.getPositionOnLane() - maxJam); + double maxJam = MAX2(preb[currIdx + 1].occupation, preb[currIdx].occupation); + double neighLeftPlace = MAX2((double) 0, neighDist - myVehicle.getPositionOnLane() - maxJam); if (bestLaneOffset <= 0 && (currentDistDisallows(neighLeftPlace, bestLaneOffset - 2, lv))) { // ...we will not change the lane if not return ret | LCA_STAY | LCA_STRATEGIC; @@ -479,8 +475,8 @@ if ((congested(neighLead.first) && neighLead.second < 20) || predInteraction(leader)) { //!!! return ret; } - SUMOReal neighLaneVSafe = neighLane.getVehicleMaxSpeed(&myVehicle); - SUMOReal thisLaneVSafe = myVehicle.getLane()->getVehicleMaxSpeed(&myVehicle); + double neighLaneVSafe = neighLane.getVehicleMaxSpeed(&myVehicle); + double thisLaneVSafe = myVehicle.getLane()->getVehicleMaxSpeed(&myVehicle); if (neighLead.first == 0) { neighLaneVSafe = MIN2(neighLaneVSafe, myCarFollowModel.followSpeed(&myVehicle, myVehicle.getSpeed(), neighDist, 0, 0)); // !!! warum nicht die Folgesgeschw.? } else { @@ -504,7 +500,7 @@ // right lane is better myChangeProbability += TS * ((neighLaneVSafe - thisLaneVSafe) / (myVehicle.getLane()->getVehicleMaxSpeed(&myVehicle))); // !!! Fahrzeuggeschw.! } - if (myChangeProbability > .2 && neighDist / MAX2((SUMOReal) .1, myVehicle.getSpeed()) > 20.) { // .1 + if (myChangeProbability > .2 && neighDist / MAX2((double) .1, myVehicle.getSpeed()) > 20.) { // .1 return ret | LCA_LEFT | LCA_SPEEDGAIN | LCA_URGENT; } // -------- @@ -513,8 +509,8 @@ } -SUMOReal -MSLCM_DK2008::patchSpeed(const SUMOReal min, const SUMOReal wanted, const SUMOReal max, const MSCFModel& cfModel) { +double +MSLCM_DK2008::patchSpeed(const double min, const double wanted, const double max, const MSCFModel& cfModel) { #ifdef DEBUG_VEHICLE_GUI_SELECTION if (gDebugSelectedVehicle == myVehicle.getID()) { int bla = 0; @@ -523,13 +519,13 @@ int state = myOwnState; // letting vehicles merge in at the end of the lane in case of counter-lane change, step#2 - SUMOReal MAGIC_offset = 1.; + double MAGIC_offset = 1.; // if we want to change and have a blocking leader and there is enough room for him in front of us if (myLeadingBlockerLength != 0) { - SUMOReal space = myLeftSpace - myLeadingBlockerLength - MAGIC_offset - myVehicle.getVehicleType().getMinGap(); + double space = myLeftSpace - myLeadingBlockerLength - MAGIC_offset - myVehicle.getVehicleType().getMinGap(); if (space > 0) { // compute speed for decelerating towards a place which allows the blocking leader to merge in in front - SUMOReal safe = cfModel.stopSpeed(&myVehicle, myVehicle.getSpeed(), space); + double safe = cfModel.stopSpeed(&myVehicle, myVehicle.getSpeed(), space); // if we are approaching this place if (safe < wanted) { // return this speed as the speed to use @@ -545,10 +541,10 @@ return wanted; } - SUMOReal nVSafe = wanted; + double nVSafe = wanted; bool gotOne = false; - for (std::vector::const_iterator i = myVSafes.begin(); i != myVSafes.end(); ++i) { - SUMOReal v = (*i); + for (std::vector::const_iterator i = myVSafes.begin(); i != myVSafes.end(); ++i) { + double v = (*i); if (v >= min && v <= max) { nVSafe = MIN2(v, nVSafe); gotOne = true; @@ -565,12 +561,12 @@ if ((state & LCA_BLOCKED) != 0) { if ((state & LCA_BLOCKED_BY_LEADER) != 0) { // if interacting with leader and not too slow - return (min + wanted) / (SUMOReal) 2.0; + return (min + wanted) / (double) 2.0; } if ((state & LCA_BLOCKED_BY_FOLLOWER) != 0) { - return (max + wanted) / (SUMOReal) 2.0; + return (max + wanted) / (double) 2.0; } - return (min + wanted) / (SUMOReal) 2.0; + return (min + wanted) / (double) 2.0; } } @@ -581,7 +577,7 @@ if (fabs(max - myVehicle.getCarFollowModel().maxNextSpeed(myVehicle.getSpeed(), &myVehicle)) < 0.001 && min == 0) { // !!! was standing return 0; } - return (min + wanted) / (SUMOReal) 2.0; + return (min + wanted) / (double) 2.0; } if ((state & LCA_AMBACKBLOCKER) != 0) { if (max <= myVehicle.getCarFollowModel().maxNextSpeed(myVehicle.getSpeed(), &myVehicle) && min == 0) { // !!! was standing @@ -594,13 +590,13 @@ // accelerate if being a blocking leader or blocking follower not able to brake // (and does not have to change lanes) if ((state & LCA_AMBLOCKINGLEADER) != 0) { - return (max + wanted) / (SUMOReal) 2.0; + return (max + wanted) / (double) 2.0; } if ((state & LCA_AMBLOCKINGFOLLOWER_DONTBRAKE) != 0) { if (max <= myVehicle.getCarFollowModel().maxNextSpeed(myVehicle.getSpeed(), &myVehicle) && min == 0) { // !!! was standing return wanted; } - return (min + wanted) / (SUMOReal) 2.0; + return (min + wanted) / (double) 2.0; } return wanted; } @@ -631,20 +627,20 @@ MSLCM_DK2008::informBlocker(MSAbstractLaneChangeModel::MSLCMessager& msgPass, int& blocked, int dir, - const std::pair& neighLead, - const std::pair& neighFollow) { + const std::pair& neighLead, + const std::pair& neighFollow) { if ((blocked & LCA_BLOCKED_BY_FOLLOWER) != 0) { assert(neighFollow.first != 0); MSVehicle* nv = neighFollow.first; - SUMOReal decelGap = + double decelGap = neighFollow.second - + SPEED2DIST(myVehicle.getSpeed()) * (SUMOReal) 2.0 - - MAX2(nv->getSpeed() - (SUMOReal) ACCEL2DIST(nv->getCarFollowModel().getMaxDecel()) * (SUMOReal) 2.0, (SUMOReal) 0); + + SPEED2DIST(myVehicle.getSpeed()) * (double) 2.0 + - MAX2(nv->getSpeed() - (double) ACCEL2DIST(nv->getCarFollowModel().getMaxDecel()) * (double) 2.0, (double) 0); if (neighFollow.second > 0 && decelGap > 0 && decelGap >= nv->getCarFollowModel().getSecureGap(nv->getSpeed(), myVehicle.getSpeed(), myVehicle.getCarFollowModel().getMaxDecel())) { - SUMOReal vsafe = myCarFollowModel.followSpeed(&myVehicle, myVehicle.getSpeed(), neighFollow.second, neighFollow.first->getSpeed(), neighFollow.first->getCarFollowModel().getMaxDecel()); + double vsafe = myCarFollowModel.followSpeed(&myVehicle, myVehicle.getSpeed(), neighFollow.second, neighFollow.first->getSpeed(), neighFollow.first->getCarFollowModel().getMaxDecel()); msgPass.informNeighFollower(new Info(vsafe, dir | LCA_AMBLOCKINGFOLLOWER), &myVehicle); } else { - SUMOReal vsafe = neighFollow.second <= 0 ? 0 : myCarFollowModel.followSpeed(&myVehicle, myVehicle.getSpeed(), neighFollow.second, neighFollow.first->getSpeed(), neighFollow.first->getCarFollowModel().getMaxDecel()); + double vsafe = neighFollow.second <= 0 ? 0 : myCarFollowModel.followSpeed(&myVehicle, myVehicle.getSpeed(), neighFollow.second, neighFollow.first->getSpeed(), neighFollow.first->getCarFollowModel().getMaxDecel()); msgPass.informNeighFollower(new Info(vsafe, dir | LCA_AMBLOCKINGFOLLOWER_DONTBRAKE), &myVehicle); } } @@ -658,6 +654,7 @@ void MSLCM_DK2008::prepareStep() { + MSAbstractLaneChangeModel::prepareStep(); myOwnState = 0; myLeadingBlockerLength = 0; myLeftSpace = 0; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_DK2008.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_DK2008.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_DK2008.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_DK2008.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Fri, 29.04.2005 -/// @version $Id: MSLCM_DK2008.h 20550 2016-04-26 10:57:45Z namdre $ +/// @version $Id: MSLCM_DK2008.h 24108 2017-04-27 18:43:30Z behrisch $ /// // A lane change model developed by D. Krajzewicz between 2004 and 2010 /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -73,9 +73,9 @@ int wantsChange( int laneOffset, MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked, - const std::pair& leader, - const std::pair& neighLead, - const std::pair& neighFollow, + const std::pair& leader, + const std::pair& neighLead, + const std::pair& neighFollow, const MSLane& neighLane, const std::vector& preb, MSVehicle** lastBlocked, @@ -91,8 +91,8 @@ * @param cfModel The model used * @return the new speed of the vehicle as proposed by the lane changer */ - virtual SUMOReal patchSpeed(const SUMOReal min, const SUMOReal wanted, const SUMOReal max, - const MSCFModel& cfModel); + virtual double patchSpeed(const double min, const double wanted, const double max, + const MSCFModel& cfModel); virtual void changed(); @@ -105,9 +105,9 @@ and whether another lane may be more preferable */ virtual int wantsChangeToRight( MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked, - const std::pair& leader, - const std::pair& neighLead, - const std::pair& neighFollow, + const std::pair& leader, + const std::pair& neighLead, + const std::pair& neighFollow, const MSLane& neighLane, const std::vector& preb, MSVehicle** lastBlocked, @@ -118,9 +118,9 @@ and whether another lane may be more preferable */ virtual int wantsChangeToLeft( MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked, - const std::pair& leader, - const std::pair& neighLead, - const std::pair& neighFollow, + const std::pair& leader, + const std::pair& neighLead, + const std::pair& neighFollow, const MSLane& neighLane, const std::vector& preb, MSVehicle** lastBlocked, @@ -128,8 +128,8 @@ void informBlocker(MSAbstractLaneChangeModel::MSLCMessager& msgPass, int& blocked, int dir, - const std::pair& neighLead, - const std::pair& neighFollow); + const std::pair& neighLead, + const std::pair& neighFollow); inline bool amBlockingLeader() { return (myOwnState & LCA_AMBLOCKINGLEADER) != 0; @@ -143,24 +143,24 @@ inline bool amBlockingFollowerPlusNB() { return (myOwnState & (LCA_AMBLOCKINGFOLLOWER | LCA_AMBLOCKINGFOLLOWER_DONTBRAKE)) != 0; } - inline bool currentDistDisallows(SUMOReal dist, int laneOffset, SUMOReal lookForwardDist) { + inline bool currentDistDisallows(double dist, int laneOffset, double lookForwardDist) { return dist / (abs(laneOffset)) < lookForwardDist; } - inline bool currentDistAllows(SUMOReal dist, int laneOffset, SUMOReal lookForwardDist) { + inline bool currentDistAllows(double dist, int laneOffset, double lookForwardDist) { return dist / abs(laneOffset) > lookForwardDist; } - typedef std::pair Info; + typedef std::pair Info; protected: - SUMOReal myChangeProbability; + double myChangeProbability; - SUMOReal myLeadingBlockerLength; - SUMOReal myLeftSpace; + double myLeadingBlockerLength; + double myLeftSpace; - std::vector myVSafes; + std::vector myVSafes; bool myDontBrake; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_LC2013.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_LC2013.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_LC2013.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_LC2013.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -8,13 +8,13 @@ /// @author Laura Bieker /// @author Leonhard Luecken /// @date Fri, 08.10.2013 -/// @version $Id: MSLCM_LC2013.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSLCM_LC2013.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A lane change model developed by J. Erdmann // based on the model of D. Krajzewicz developed between 2004 and 2011 (MSLCM_DK2004) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,52 +37,49 @@ #include #include +#include #include #include #include #include "MSLCM_LC2013.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // variable definitions // =========================================================================== // 80km/h will be the threshold for dividing between long/short foresight -#define LOOK_FORWARD_SPEED_DIVIDER (SUMOReal)14. +#define LOOK_FORWARD_SPEED_DIVIDER (double)14. -#define LOOK_FORWARD_RIGHT (SUMOReal)10. -#define LOOK_FORWARD_LEFT (SUMOReal)20. +#define LOOK_FORWARD_RIGHT (double)10. +#define LOOK_FORWARD_LEFT (double)20. -#define JAM_FACTOR (SUMOReal)1. +#define JAM_FACTOR (double)1. -#define LCA_RIGHT_IMPATIENCE (SUMOReal)-1. -#define CUT_IN_LEFT_SPEED_THRESHOLD (SUMOReal)27. +#define LCA_RIGHT_IMPATIENCE (double)-1. +#define CUT_IN_LEFT_SPEED_THRESHOLD (double)27. -#define LOOK_AHEAD_MIN_SPEED (SUMOReal)0.0 -#define LOOK_AHEAD_SPEED_MEMORY (SUMOReal)0.9 +#define LOOK_AHEAD_MIN_SPEED 0.0 +#define LOOK_AHEAD_SPEED_MEMORY 0.9 #define LOOK_AHEAD_SPEED_DECREMENT 6. -#define HELP_DECEL_FACTOR (SUMOReal)1.0 +#define HELP_DECEL_FACTOR (double)1.0 -#define HELP_OVERTAKE (SUMOReal)(10.0 / 3.6) -#define MIN_FALLBEHIND (SUMOReal)(7.0 / 3.6) +#define HELP_OVERTAKE (double)(10.0 / 3.6) +#define MIN_FALLBEHIND (double)(7.0 / 3.6) -#define RELGAIN_NORMALIZATION_MIN_SPEED (SUMOReal)10.0 -#define URGENCY (SUMOReal)2.0 +#define RELGAIN_NORMALIZATION_MIN_SPEED (double)10.0 +#define URGENCY (double)2.0 -#define KEEP_RIGHT_TIME (SUMOReal)5.0 // the number of seconds after which a vehicle should move to the right lane -#define KEEP_RIGHT_ACCEPTANCE (SUMOReal)7.0 // calibration factor for determining the desire to keep right -#define ROUNDABOUT_DIST_BONUS (SUMOReal)100.0 // valence (distance) for to faked per roundabout edge in front (inducing inner lane usage in roundabouts by decreasing sense of lc-urgency) +#define KEEP_RIGHT_TIME (double)5.0 // the number of seconds after which a vehicle should move to the right lane +#define KEEP_RIGHT_ACCEPTANCE (double)7.0 // calibration factor for determining the desire to keep right +#define ROUNDABOUT_DIST_BONUS (double)100.0 // valence (distance) for to faked per roundabout edge in front (inducing inner lane usage in roundabouts by decreasing sense of lc-urgency) -#define ROUNDABOUT_DIST_FACTOR (SUMOReal)10.0 // Must be >=1.0, serves an alternative way of decreasing sense lc-urgency by multiplying the distance along the next roundabout -#define ROUNDABOUT_DIST_TRESH (SUMOReal)10.0 // roundabout distances below ROUNDABOUT_DIST_TRESH are not multiplied by ROUNDABOUT_DIST_FACTOR +#define ROUNDABOUT_DIST_FACTOR (double)10.0 // Must be >=1.0, serves an alternative way of decreasing sense lc-urgency by multiplying the distance along the next roundabout +#define ROUNDABOUT_DIST_TRESH (double)10.0 // roundabout distances below ROUNDABOUT_DIST_TRESH are not multiplied by ROUNDABOUT_DIST_FACTOR -#define KEEP_RIGHT_HEADWAY (SUMOReal)2.0 -#define MAX_ONRAMP_LENGTH (SUMOReal)200. -#define TURN_LANE_DIST (SUMOReal)200.0 // the distance at which a lane leading elsewhere is considered to be a turn-lane that must be avoided +#define KEEP_RIGHT_HEADWAY (double)2.0 +#define MAX_ONRAMP_LENGTH (double)200. +#define TURN_LANE_DIST (double)200.0 // the distance at which a lane leading elsewhere is considered to be a turn-lane that must be avoided // =========================================================================== // debug defines @@ -95,7 +92,8 @@ //#define DEBUG_SLOW_DOWN //#define DEBUG_SAVE_BLOCKER_LENGTH -#define DEBUG_COND (myVehicle.getID() == "disabled") +//#define DEBUG_COND (myVehicle.getID() == "disabled") +#define DEBUG_COND (myVehicle.isSelected()) // =========================================================================== // member method definitions @@ -111,6 +109,7 @@ myCooperativeParam(v.getVehicleType().getParameter().getLCParam(SUMO_ATTR_LCA_COOPERATIVE_PARAM, 1)), mySpeedGainParam(v.getVehicleType().getParameter().getLCParam(SUMO_ATTR_LCA_SPEEDGAIN_PARAM, 1)), myKeepRightParam(v.getVehicleType().getParameter().getLCParam(SUMO_ATTR_LCA_KEEPRIGHT_PARAM, 1)), + myExperimentalParam1(v.getVehicleType().getParameter().getLCParam(SUMO_ATTR_LCA_EXPERIMENTAL1, 0)), myChangeProbThresholdRight(2.0 * myKeepRightParam / MAX2(NUMERICAL_EPS, mySpeedGainParam)), myChangeProbThresholdLeft(0.2 / MAX2(NUMERICAL_EPS, mySpeedGainParam)) { #ifdef DEBUG_CONSTRUCTOR @@ -142,9 +141,9 @@ int laneOffset, MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked, - const std::pair& leader, - const std::pair& neighLead, - const std::pair& neighFollow, + const std::pair& leader, + const std::pair& neighLead, + const std::pair& neighFollow, const MSLane& neighLane, const std::vector& preb, MSVehicle** lastBlocked, @@ -168,21 +167,7 @@ #ifdef DEBUG_WANTS_CHANGE if (DEBUG_COND) { - if (result & LCA_WANTS_LANECHANGE) { - std::cout << STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()) - << " veh=" << myVehicle.getID() - << " wantsChangeTo=" << (laneOffset == -1 ? "right" : "left") - << ((result & LCA_URGENT) ? " (urgent)" : "") - << ((result & LCA_CHANGE_TO_HELP) ? " (toHelp)" : "") - << ((result & LCA_STRATEGIC) ? " (strat)" : "") - << ((result & LCA_COOPERATIVE) ? " (coop)" : "") - << ((result & LCA_SPEEDGAIN) ? " (speed)" : "") - << ((result & LCA_KEEPRIGHT) ? " (keepright)" : "") - << ((result & LCA_TRACI) ? " (traci)" : "") - << ((blocked & LCA_BLOCKED) ? " (blocked)" : "") - << ((blocked & LCA_OVERLAPPING) ? " (overlap)" : "") - << "\n\n\n"; - } + std::cout << SIMTIME << " veh=" << myVehicle.getID() << " result=" << toString((LaneChangeAction)result) << " blocked=" << toString((LaneChangeAction)blocked) << "\n\n\n"; } #endif @@ -190,8 +175,8 @@ } -SUMOReal -MSLCM_LC2013::patchSpeed(const SUMOReal min, const SUMOReal wanted, const SUMOReal max, const MSCFModel& cfModel) { +double +MSLCM_LC2013::patchSpeed(const double min, const double wanted, const double max, const MSCFModel& cfModel) { #ifdef DEBUG_PATCH_SPEED if (DEBUG_COND) { @@ -205,7 +190,7 @@ } #endif - const SUMOReal newSpeed = _patchSpeed(min, wanted, max, cfModel); + const double newSpeed = _patchSpeed(min, wanted, max, cfModel); #ifdef DEBUG_PATCH_SPEED if (DEBUG_COND) { @@ -219,8 +204,8 @@ } -SUMOReal -MSLCM_LC2013::_patchSpeed(const SUMOReal min, const SUMOReal wanted, const SUMOReal max, const MSCFModel& cfModel) { +double +MSLCM_LC2013::_patchSpeed(const double min, const double wanted, const double max, const MSCFModel& cfModel) { int state = myOwnState; #ifdef DEBUG_PATCH_SPEED if (DEBUG_COND) { @@ -233,10 +218,10 @@ #endif // letting vehicles merge in at the end of the lane in case of counter-lane change, step#2 - SUMOReal MAGIC_offset = 1.; + double MAGIC_offset = 1.; // if we want to change and have a blocking leader and there is enough room for him in front of us if (myLeadingBlockerLength != 0) { - SUMOReal space = myLeftSpace - myLeadingBlockerLength - MAGIC_offset - myVehicle.getVehicleType().getMinGap(); + double space = myLeftSpace - myLeadingBlockerLength - MAGIC_offset - myVehicle.getVehicleType().getMinGap(); #ifdef DEBUG_PATCH_SPEED if (DEBUG_COND) { std::cout << SIMTIME << " veh=" << myVehicle.getID() << " myLeadingBlockerLength=" << myLeadingBlockerLength << " space=" << space << "\n"; @@ -244,7 +229,7 @@ #endif if (space > 0) { // XXX space > -MAGIC_offset // compute speed for decelerating towards a place which allows the blocking leader to merge in in front - SUMOReal safe = cfModel.stopSpeed(&myVehicle, myVehicle.getSpeed(), space); + double safe = cfModel.stopSpeed(&myVehicle, myVehicle.getSpeed(), space); // if we are approaching this place if (safe < wanted) { // return this speed as the speed to use @@ -258,10 +243,10 @@ } } - SUMOReal nVSafe = wanted; + double nVSafe = wanted; bool gotOne = false; - for (std::vector::const_iterator i = myVSafes.begin(); i != myVSafes.end(); ++i) { - SUMOReal v = (*i); + for (std::vector::const_iterator i = myVSafes.begin(); i != myVSafes.end(); ++i) { + double v = (*i); if (v >= min && v <= max && (MSGlobals::gSemiImplicitEulerUpdate // ballistic update: (negative speeds may appear, e.g. min<0, v<0), BUT: @@ -313,7 +298,7 @@ std::cout << time << " veh=" << myVehicle.getID() << " LCA_WANTS_LANECHANGE (strat, no vSafe)\n"; } #endif - return (max + wanted) / (SUMOReal) 2.0; + return (max + wanted) / (double) 2.0; } else if ((state & LCA_COOPERATIVE) != 0) { // only minor adjustments in speed should be done if ((state & LCA_BLOCKED_BY_LEADER) != 0) { @@ -323,7 +308,7 @@ } #endif if (wanted >= 0.) { - return (MAX2((SUMOReal)0., min) + wanted) / (SUMOReal) 2.0; + return (MAX2(0., min) + wanted) / (double) 2.0; } else { return wanted; } @@ -334,13 +319,13 @@ std::cout << time << " veh=" << myVehicle.getID() << " LCA_BLOCKED_BY_FOLLOWER (coop)\n"; } #endif - return (max + wanted) / (SUMOReal) 2.0; + return (max + wanted) / (double) 2.0; } //} else { // VARIANT_16 // // only accelerations should be performed // if ((state & LCA_BLOCKED_BY_FOLLOWER) != 0) { // if (gDebugFlag2) std::cout << time << " veh=" << myVehicle.getID() << " LCA_BLOCKED_BY_FOLLOWER\n"; - // return (max + wanted) / (SUMOReal) 2.0; + // return (max + wanted) / (double) 2.0; // } } } @@ -356,7 +341,7 @@ if (gDebugFlag2) std::cout << time << " veh=" << myVehicle.getID() << " LCA_AMBLOCKINGFOLLOWER\n"; //return min; // VARIANT_3 (brakeStrong) - return (min + wanted) / (SUMOReal) 2.0; + return (min + wanted) / (double) 2.0; } if ((state & LCA_AMBACKBLOCKER) != 0) { if (max <= myVehicle.getCarFollowModel().maxNextSpeed(myVehicle.getSpeed(), &myVehicle) && min == 0) { // !!! was standing @@ -380,7 +365,7 @@ std::cout << time << " veh=" << myVehicle.getID() << " LCA_AMBLOCKINGLEADER\n"; } #endif - return (max + wanted) / (SUMOReal) 2.0; + return (max + wanted) / (double) 2.0; } if ((state & LCA_AMBLOCKINGFOLLOWER_DONTBRAKE) != 0) { @@ -394,7 +379,7 @@ if (max <= myVehicle.getCarFollowModel().maxNextSpeed(myVehicle.getSpeed(), &myVehicle) && min == 0) { // !!! was standing return wanted; } - return (min + wanted) / (SUMOReal) 2.0; + return (min + wanted) / (double) 2.0; */ } if (!myVehicle.getLane()->getEdge().hasLaneChanger()) { @@ -426,29 +411,29 @@ return (void*) true; } -SUMOReal -MSLCM_LC2013::overtakeDistance(const MSVehicle* follower, const MSVehicle* leader, const SUMOReal gap, SUMOReal followerSpeed, SUMOReal leaderSpeed) { +double +MSLCM_LC2013::overtakeDistance(const MSVehicle* follower, const MSVehicle* leader, const double gap, double followerSpeed, double leaderSpeed) { followerSpeed = followerSpeed == INVALID_SPEED ? follower->getSpeed() : followerSpeed; leaderSpeed = leaderSpeed == INVALID_SPEED ? leader->getSpeed() : leaderSpeed; - SUMOReal overtakeDist = (gap // drive to back of leader - + leader->getVehicleType().getLengthWithGap() // drive to front of leader - + follower->getVehicleType().getLength() // follower back reaches leader front - + leader->getCarFollowModel().getSecureGap( // save gap to leader - leaderSpeed, followerSpeed, follower->getCarFollowModel().getMaxDecel())); - return MAX2(overtakeDist, (SUMOReal)0.); + double overtakeDist = (gap // drive to back of leader + + leader->getVehicleType().getLengthWithGap() // drive to front of leader + + follower->getVehicleType().getLength() // follower back reaches leader front + + leader->getCarFollowModel().getSecureGap( // save gap to leader + leaderSpeed, followerSpeed, follower->getCarFollowModel().getMaxDecel())); + return MAX2(overtakeDist, 0.); } -SUMOReal +double MSLCM_LC2013::informLeader(MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked, int dir, - const std::pair& neighLead, - SUMOReal remainingSeconds) { - SUMOReal plannedSpeed = MIN2(myVehicle.getSpeed(), - myVehicle.getCarFollowModel().stopSpeed(&myVehicle, myVehicle.getSpeed(), myLeftSpace - myLeadingBlockerLength)); - for (std::vector::const_iterator i = myVSafes.begin(); i != myVSafes.end(); ++i) { - SUMOReal v = (*i); + const std::pair& neighLead, + double remainingSeconds) { + double plannedSpeed = MIN2(myVehicle.getSpeed(), + myVehicle.getCarFollowModel().stopSpeed(&myVehicle, myVehicle.getSpeed(), myLeftSpace - myLeadingBlockerLength)); + for (std::vector::const_iterator i = myVSafes.begin(); i != myVSafes.end(); ++i) { + double v = (*i); if (v >= myVehicle.getSpeed() - ACCEL2SPEED(myVehicle.getCarFollowModel().getMaxDecel())) { plannedSpeed = MIN2(plannedSpeed, v); } @@ -470,9 +455,9 @@ } #endif // decide whether we want to overtake the leader or follow it - SUMOReal overtakeTime; - const SUMOReal overtakeDist = overtakeDistance(&myVehicle, nv, neighLead.second); - const SUMOReal dv = plannedSpeed - nv->getSpeed(); + double overtakeTime; + const double overtakeDist = overtakeDistance(&myVehicle, nv, neighLead.second); + const double dv = plannedSpeed - nv->getSpeed(); if (dv > 0) { overtakeTime = overtakeDist / dv; @@ -495,7 +480,7 @@ } #endif - if (dv < 0 + if ((dv < 0 // overtaking on the right on an uncongested highway is forbidden (noOvertakeLCLeft) || (dir == LCA_MLEFT && !myVehicle.congested() && !myAllowOvertakingRight) // not enough space to overtake? @@ -503,18 +488,20 @@ // using brakeGap() without headway seems adequate in a situation where the obstacle (the lane end) is not moving [XXX implemented in branch ticket860, can be used in general if desired, refs. #2575] (Leo). || (!MSGlobals::gSemiImplicitEulerUpdate && myLeftSpace - myLeadingBlockerLength - myVehicle.getCarFollowModel().brakeGap(myVehicle.getSpeed(), myCarFollowModel.getMaxDecel(), 0.) < overtakeDist) // not enough time to overtake? (skipped for a stopped leader [currently only for ballistic update XXX: check if appropriate for euler, too, refs. #2575] to ensure that it can be overtaken if only enough space is exists) (Leo) - || (remainingSeconds < overtakeTime && (MSGlobals::gSemiImplicitEulerUpdate || !nv->isStopped()))) { + || (remainingSeconds < overtakeTime && (MSGlobals::gSemiImplicitEulerUpdate || !nv->isStopped()))) + // opposite driving and must overtake + && !(isOpposite() && neighLead.second < 0 && neighLead.first->isStopped())) { // cannot overtake - msgPass.informNeighLeader(new Info(std::numeric_limits::max(), dir | LCA_AMBLOCKINGLEADER), &myVehicle); + msgPass.informNeighLeader(new Info(std::numeric_limits::max(), dir | LCA_AMBLOCKINGLEADER), &myVehicle); // slow down smoothly to follow leader - const SUMOReal targetSpeed = myCarFollowModel.followSpeed( - &myVehicle, myVehicle.getSpeed(), neighLead.second, nv->getSpeed(), nv->getCarFollowModel().getMaxDecel()); + const double targetSpeed = myCarFollowModel.followSpeed( + &myVehicle, myVehicle.getSpeed(), neighLead.second, nv->getSpeed(), nv->getCarFollowModel().getMaxDecel()); if (targetSpeed < myVehicle.getSpeed()) { // slow down smoothly to follow leader - const SUMOReal decel = remainingSeconds == 0. ? myVehicle.getCarFollowModel().getMaxDecel() : - MIN2(myVehicle.getCarFollowModel().getMaxDecel(), - MAX2(MIN_FALLBEHIND, (myVehicle.getSpeed() - targetSpeed) / remainingSeconds)); - const SUMOReal nextSpeed = MIN2(plannedSpeed, myVehicle.getSpeed() - ACCEL2SPEED(decel)); + const double decel = remainingSeconds == 0. ? myVehicle.getCarFollowModel().getMaxDecel() : + MIN2(myVehicle.getCarFollowModel().getMaxDecel(), + MAX2(MIN_FALLBEHIND, (myVehicle.getSpeed() - targetSpeed) / remainingSeconds)); + const double nextSpeed = MIN2(plannedSpeed, myVehicle.getSpeed() - ACCEL2SPEED(decel)); #ifdef DEBUG_INFORMER if (DEBUG_COND) { std::cout << STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()) @@ -577,10 +564,10 @@ } else if (neighLead.first != 0) { // (remainUnblocked) // we are not blocked now. make sure we stay far enough from the leader MSVehicle* nv = neighLead.first; - const SUMOReal nextNVSpeed = nv->getSpeed() - HELP_OVERTAKE; // conservative - const SUMOReal dv = SPEED2DIST(myVehicle.getSpeed() - nextNVSpeed); - const SUMOReal targetSpeed = myCarFollowModel.followSpeed( - &myVehicle, myVehicle.getSpeed(), neighLead.second - dv, nextNVSpeed, nv->getCarFollowModel().getMaxDecel()); + const double nextNVSpeed = nv->getSpeed() - HELP_OVERTAKE; // conservative + const double dv = SPEED2DIST(myVehicle.getSpeed() - nextNVSpeed); + const double targetSpeed = myCarFollowModel.followSpeed( + &myVehicle, myVehicle.getSpeed(), neighLead.second - dv, nextNVSpeed, nv->getCarFollowModel().getMaxDecel()); myVSafes.push_back(targetSpeed); #ifdef DEBUG_INFORMER if (DEBUG_COND) { @@ -604,12 +591,12 @@ MSLCM_LC2013::informFollower(MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked, int dir, - const std::pair& neighFollow, - SUMOReal remainingSeconds, - SUMOReal plannedSpeed) { + const std::pair& neighFollow, + double remainingSeconds, + double plannedSpeed) { MSVehicle* nv = neighFollow.first; - const SUMOReal plannedAccel = SPEED2ACCEL(MAX2(MIN2(myCarFollowModel.getMaxAccel(), plannedSpeed - myVehicle.getSpeed()), -myCarFollowModel.getMaxDecel())); + const double plannedAccel = SPEED2ACCEL(MAX2(MIN2(myCarFollowModel.getMaxAccel(), plannedSpeed - myVehicle.getSpeed()), -myCarFollowModel.getMaxDecel())); #ifdef DEBUG_INFORMER if (DEBUG_COND) { @@ -628,9 +615,9 @@ #endif // are we fast enough to cut in without any help? - if (MAX2(plannedSpeed, (SUMOReal)0.) - nv->getSpeed() >= HELP_OVERTAKE) { - const SUMOReal neededGap = nv->getCarFollowModel().getSecureGap(nv->getSpeed(), plannedSpeed, myVehicle.getCarFollowModel().getMaxDecel()); - if ((neededGap - neighFollow.second) / remainingSeconds < (MAX2(plannedSpeed, (SUMOReal)0.) - nv->getSpeed())) { + if (MAX2(plannedSpeed, 0.) - nv->getSpeed() >= HELP_OVERTAKE) { + const double neededGap = nv->getCarFollowModel().getSecureGap(nv->getSpeed(), plannedSpeed, myVehicle.getCarFollowModel().getMaxDecel()); + if ((neededGap - neighFollow.second) / remainingSeconds < (MAX2(plannedSpeed, 0.) - nv->getSpeed())) { #ifdef DEBUG_INFORMER if (DEBUG_COND) { std::cout << " wants to cut in before nv=" << nv->getID() << " without any help." << "\nneededGap = " << neededGap << "\n"; @@ -638,7 +625,7 @@ #endif // follower might even accelerate but not to much // XXX: I don't understand this. The needed gap was determined for nv->getSpeed(), not for (plannedSpeed - HELP_OVERTAKE)?! (Leo), refs. #2578 - msgPass.informNeighFollower(new Info(MAX2(plannedSpeed, (SUMOReal)0.) - HELP_OVERTAKE, dir | LCA_AMBLOCKINGFOLLOWER), &myVehicle); + msgPass.informNeighFollower(new Info(MAX2(plannedSpeed, 0.) - HELP_OVERTAKE, dir | LCA_AMBLOCKINGFOLLOWER), &myVehicle); return; } } @@ -650,19 +637,19 @@ // maximum deceleration to help us (will probably be spread over // multiple seconds) // ----------- - const SUMOReal helpDecel = nv->getCarFollowModel().getMaxDecel() * HELP_DECEL_FACTOR; + const double helpDecel = nv->getCarFollowModel().getMaxDecel() * HELP_DECEL_FACTOR; // follower's new speed in next step - SUMOReal neighNewSpeed; + double neighNewSpeed; // follower's new speed after 1s. - SUMOReal neighNewSpeed1s; + double neighNewSpeed1s; // velocity difference, gap after follower-deceleration - SUMOReal dv, decelGap; + double dv, decelGap; if (MSGlobals::gSemiImplicitEulerUpdate) { // euler - neighNewSpeed = MAX2((SUMOReal)0, nv->getSpeed() - ACCEL2SPEED(helpDecel)); - neighNewSpeed1s = MAX2((SUMOReal)0, nv->getSpeed() - helpDecel); // TODO: consider introduction of a configurable anticipationTime here (see far below in the !blocked part). Refs. #2578 + neighNewSpeed = MAX2(0., nv->getSpeed() - ACCEL2SPEED(helpDecel)); + neighNewSpeed1s = MAX2(0., nv->getSpeed() - helpDecel); // TODO: consider introduction of a configurable anticipationTime here (see far below in the !blocked part). Refs. #2578 // change in the gap between ego and blocker over 1 second (not STEP!) // XXX: though here it is calculated as if it were one step!? (Leo) Refs. #2578 dv = plannedSpeed - neighNewSpeed1s; // XXX: what is this quantity (if TS!=1)? @@ -686,14 +673,17 @@ nv->getSpeed(), plannedAccel, -helpDecel, myVehicle.getMaxSpeedOnLane(), nv->getMaxSpeedOnLane()); } - const SUMOReal secureGap = nv->getCarFollowModel().getSecureGap(MAX2(neighNewSpeed1s, (SUMOReal)0.), - MAX2(plannedSpeed, (SUMOReal)0.), myVehicle.getCarFollowModel().getMaxDecel()); + const double secureGap = nv->getCarFollowModel().getSecureGap(MAX2(neighNewSpeed1s, 0.), + MAX2(plannedSpeed, 0.), myVehicle.getCarFollowModel().getMaxDecel()); + + const double onRampThreshold = myVehicle.getLane()->getSpeedLimit() * 0.8 * myExperimentalParam1 * (1 - myVehicle.getImpatience()); #ifdef DEBUG_INFORMER if (DEBUG_COND) { std::cout << STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()) << " speed=" << myVehicle.getSpeed() << " plannedSpeed=" << plannedSpeed + << " threshold=" << onRampThreshold << " neighNewSpeed=" << neighNewSpeed << " neighNewSpeed1s=" << neighNewSpeed1s << " dv=" << dv @@ -703,6 +693,12 @@ << "\n"; } #endif + // prevent vehicles on an on ramp stopping the main flow + if (dir == LCA_MLEFT + && myVehicle.getLane()->isAccelLane() + && neighNewSpeed1s < onRampThreshold) { + return; + } if (decelGap > 0 && decelGap >= secureGap) { // XXX: This does not assure that the leader can cut in in the next step if TS < 1 (see above) @@ -712,7 +708,7 @@ // how hard does it actually need to be? // to be safe in the next step the following equation has to hold for the follower's vsafe: // vsafe <= followSpeed(gap=currentGap - SPEED2DIST(vsafe), ...) - SUMOReal vsafe, vsafe1; + double vsafe, vsafe1; if (MSGlobals::gSemiImplicitEulerUpdate) { // euler @@ -728,10 +724,10 @@ // XXX: This block should actually do as well for euler update (TODO: test!), refs #2575 // we compute an upper bound on vsafe // next step's gap without help deceleration (nv's speed assumed constant) - SUMOReal nextGap = myCarFollowModel.gapExtrapolation(TS, - neighFollow.second, myVehicle.getSpeed(), - nv->getSpeed(), plannedAccel, 0, - myVehicle.getMaxSpeedOnLane(), nv->getMaxSpeedOnLane()); + double nextGap = myCarFollowModel.gapExtrapolation(TS, + neighFollow.second, myVehicle.getSpeed(), + nv->getSpeed(), plannedAccel, 0, + myVehicle.getMaxSpeedOnLane(), nv->getMaxSpeedOnLane()); #ifdef DEBUG_INFORMER if (DEBUG_COND) { std::cout << "nextGap=" << nextGap << " (without help decel) \n"; @@ -742,12 +738,12 @@ vsafe1 = MIN2(nv->getSpeed(), MAX2(neighNewSpeed, nv->getCarFollowModel().followSpeed(nv, nv->getSpeed(), nextGap, - MAX2((SUMOReal)0., plannedSpeed), + MAX2(0., plannedSpeed), myCarFollowModel.getMaxDecel()))); // next step's gap with possibly less than maximal help deceleration (in case vsafe1 > neighNewSpeed) - SUMOReal decel2 = SPEED2ACCEL(nv->getSpeed() - vsafe1); + double decel2 = SPEED2ACCEL(nv->getSpeed() - vsafe1); nextGap = myCarFollowModel.gapExtrapolation(TS, neighFollow.second, myVehicle.getSpeed(), nv->getSpeed(), plannedAccel, -decel2, @@ -761,7 +757,7 @@ MAX2(neighNewSpeed, nv->getCarFollowModel().followSpeed(nv, nv->getSpeed(), nextGap, - MAX2((SUMOReal)0., plannedSpeed), + MAX2(0., plannedSpeed), myCarFollowModel.getMaxDecel()))); assert(vsafe >= vsafe1); @@ -777,7 +773,7 @@ // For subsecond simulation, this might not lead to secure gaps for a long time, // we seek to establish a secure gap as soon as possible - SUMOReal nextSecureGap = nv->getCarFollowModel().getSecureGap(vsafe, plannedSpeed, myCarFollowModel.getMaxDecel()); + double nextSecureGap = nv->getCarFollowModel().getSecureGap(vsafe, plannedSpeed, myCarFollowModel.getMaxDecel()); if (nextGap < nextSecureGap) { // establish a secureGap as soon as possible @@ -812,7 +808,7 @@ ) { // XXX: Alternative formulation (encapsulating differences of euler and ballistic) TODO: test, refs. #2575 - // SUMOReal eventualGap = myCarFollowModel.gapExtrapolation(remainingSeconds - 1., decelGap, plannedSpeed, neighNewSpeed1s); + // double eventualGap = myCarFollowModel.gapExtrapolation(remainingSeconds - 1., decelGap, plannedSpeed, neighNewSpeed1s); // } else if (eventualGap > secureGap + POSITION_EPS) { @@ -832,7 +828,7 @@ #endif } else if (dir == LCA_MRIGHT && !myAllowOvertakingRight && !nv->congested()) { // XXX: check if this requires a special treatment for the ballistic update, refs. #2575 - const SUMOReal vhelp = MAX2(neighNewSpeed, HELP_OVERTAKE); + const double vhelp = MAX2(neighNewSpeed, HELP_OVERTAKE); msgPass.informNeighFollower(new Info(vhelp, dir | LCA_AMBLOCKINGFOLLOWER), &myVehicle); #ifdef DEBUG_INFORMER if (DEBUG_COND) { @@ -840,7 +836,7 @@ } #endif } else { - SUMOReal vhelp = MAX2(nv->getSpeed(), myVehicle.getSpeed() + HELP_OVERTAKE); + double vhelp = MAX2(nv->getSpeed(), myVehicle.getSpeed() + HELP_OVERTAKE); //if (dir == LCA_MRIGHT && myVehicle.getWaitingSeconds() > LCA_RIGHT_IMPATIENCE && // nv->getSpeed() > myVehicle.getSpeed()) { if (nv->getSpeed() > myVehicle.getSpeed() && @@ -887,10 +883,10 @@ // Assumptions: // (A1) leader continues with currentSpeed. (XXX: That might be wrong: Think of accelerating on an on-ramp or of a congested region ahead!) // (A2) follower breaks with helpDecel. - const SUMOReal gapAfterRemainingSecs = myCarFollowModel.gapExtrapolation( + const double gapAfterRemainingSecs = myCarFollowModel.gapExtrapolation( remainingSeconds, neighFollow.second, myVehicle.getSpeed(), nv->getSpeed(), 0, -helpDecel, myVehicle.getMaxSpeedOnLane(), nv->getMaxSpeedOnLane()); - const SUMOReal secureGapAfterRemainingSecs = nv->getCarFollowModel().getSecureGap( - MAX2(nv->getSpeed() - remainingSeconds * helpDecel, (SUMOReal)0.), myVehicle.getSpeed(), myVehicle.getCarFollowModel().getMaxDecel()); + const double secureGapAfterRemainingSecs = nv->getCarFollowModel().getSecureGap( + MAX2(nv->getSpeed() - remainingSeconds * helpDecel, 0.), myVehicle.getSpeed(), myVehicle.getCarFollowModel().getMaxDecel()); if (gapAfterRemainingSecs >= secureGapAfterRemainingSecs) { // XXX: here it would be wise to check whether there is enough space for eventual braking if the maneuver doesn't succeed #ifdef DEBUG_INFORMER if (DEBUG_COND) { @@ -919,9 +915,9 @@ msgPass.informNeighFollower(new Info(vhelp, dir | LCA_AMBLOCKINGFOLLOWER), &myVehicle); // This follower is supposed to overtake us. Slow down smoothly to allow this. - const SUMOReal overtakeDist = overtakeDistance(nv, &myVehicle, neighFollow.second, vhelp, plannedSpeed); + const double overtakeDist = overtakeDistance(nv, &myVehicle, neighFollow.second, vhelp, plannedSpeed); // speed difference to create a sufficiently large gap - const SUMOReal needDV = overtakeDist / remainingSeconds; + const double needDV = overtakeDist / remainingSeconds; // make sure the deceleration is not to strong (XXX: should be assured in moveHelper -> TODO: remove the MAX2 if agreed) -> prob with possibly non-existing maximal deceleration for som CF Models(?) Refs. #2578 myVSafes.push_back(MAX2(vhelp - needDV, myVehicle.getSpeed() - ACCEL2SPEED(myVehicle.getCarFollowModel().getMaxDecel()))); @@ -939,13 +935,10 @@ } #endif } - } else if (neighFollow.first != 0) { - // XXX: Shouldn't the condition be extended by '&& (blocked & LCA_BLOCKED_BY_LEADER) != 0'? Refs. #2578 - // Otherwise we don't need to inform the follower but simply cut in - + } else if (neighFollow.first != 0 && (blocked & LCA_BLOCKED_BY_LEADER)) { // we are not blocked by the follower now, make sure it remains that way // XXX: Does the below code for the euler case really assure that? Refs. #2578 - SUMOReal vsafe, vsafe1; + double vsafe, vsafe1; if (MSGlobals::gSemiImplicitEulerUpdate) { // euler MSVehicle* nv = neighFollow.first; @@ -959,23 +952,23 @@ // ballistic // XXX This should actually do for euler and ballistic cases (TODO: test!) Refs. #2575 - SUMOReal anticipationTime = 1.; - SUMOReal anticipatedSpeed = MIN2(myVehicle.getSpeed() + plannedAccel * anticipationTime, myVehicle.getMaxSpeedOnLane()); - SUMOReal anticipatedGap = myCarFollowModel.gapExtrapolation(anticipationTime, neighFollow.second, myVehicle.getSpeed(), nv->getSpeed(), - plannedAccel, 0, myVehicle.getMaxSpeedOnLane(), nv->getMaxSpeedOnLane()); - SUMOReal secureGap = nv->getCarFollowModel().getSecureGap(nv->getSpeed(), anticipatedSpeed, myCarFollowModel.getMaxDecel()); + double anticipationTime = 1.; + double anticipatedSpeed = MIN2(myVehicle.getSpeed() + plannedAccel * anticipationTime, myVehicle.getMaxSpeedOnLane()); + double anticipatedGap = myCarFollowModel.gapExtrapolation(anticipationTime, neighFollow.second, myVehicle.getSpeed(), nv->getSpeed(), + plannedAccel, 0, myVehicle.getMaxSpeedOnLane(), nv->getMaxSpeedOnLane()); + double secureGap = nv->getCarFollowModel().getSecureGap(nv->getSpeed(), anticipatedSpeed, myCarFollowModel.getMaxDecel()); // propose follower speed corresponding to first estimation of gap - SUMOReal vsafe = nv->getCarFollowModel().followSpeed( - nv, nv->getSpeed(), anticipatedGap, plannedSpeed, myCarFollowModel.getMaxDecel()); - SUMOReal helpAccel = SPEED2ACCEL(vsafe - nv->getSpeed()) / anticipationTime; + double vsafe = nv->getCarFollowModel().followSpeed( + nv, nv->getSpeed(), anticipatedGap, plannedSpeed, myCarFollowModel.getMaxDecel()); + double helpAccel = SPEED2ACCEL(vsafe - nv->getSpeed()) / anticipationTime; if (anticipatedGap > secureGap) { // follower may accelerate, implying vhelp >= vsafe >= nv->getSpeed() // calculate gap for the assumed acceleration anticipatedGap = myCarFollowModel.gapExtrapolation(anticipationTime, neighFollow.second, myVehicle.getSpeed(), nv->getSpeed(), plannedAccel, helpAccel, myVehicle.getMaxSpeedOnLane(), nv->getMaxSpeedOnLane()); - SUMOReal anticipatedHelpSpeed = MIN2(nv->getSpeed() + anticipationTime * helpAccel, nv->getMaxSpeedOnLane()); + double anticipatedHelpSpeed = MIN2(nv->getSpeed() + anticipationTime * helpAccel, nv->getMaxSpeedOnLane()); secureGap = nv->getCarFollowModel().getSecureGap(anticipatedHelpSpeed, anticipatedSpeed, myCarFollowModel.getMaxDecel()); if (anticipatedGap < secureGap) { // don't accelerate @@ -999,6 +992,7 @@ void MSLCM_LC2013::prepareStep() { + MSAbstractLaneChangeModel::prepareStep(); // keep information about strategic change direction myOwnState = (myOwnState & LCA_STRATEGIC) ? (myOwnState & LCA_WANTS_LANECHANGE) : 0; myLeadingBlockerLength = 0; @@ -1033,9 +1027,9 @@ int laneOffset, MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked, - const std::pair& leader, - const std::pair& neighLead, - const std::pair& neighFollow, + const std::pair& leader, + const std::pair& neighLead, + const std::pair& neighFollow, const MSLane& neighLane, const std::vector& preb, // XXX: What does "preb" stand for? Please comment. (Leo) Refs. #2578, #2604 MSVehicle** lastBlocked, @@ -1049,8 +1043,8 @@ // currentDist is the distance that the vehicle can go on its route without having to // change lanes from the current lane. neighDist as currentDist for the considered target lane (i.e., neigh) // If this is true I suggest to put this into the docu of wantsChange() - SUMOReal currentDist = 0; - SUMOReal neighDist = 0; + double currentDist = 0; + double neighDist = 0; int currIdx = 0; MSLane* prebLane = myVehicle.getLane(); if (prebLane->getEdge().getPurpose() == MSEdge::EDGEFUNCTION_INTERNAL) { @@ -1096,7 +1090,7 @@ neighDist = neigh.length; currentDist = curr.length; } - const SUMOReal posOnLane = isOpposite() ? myVehicle.getLane()->getLength() - myVehicle.getPositionOnLane() : myVehicle.getPositionOnLane(); + const double posOnLane = isOpposite() ? myVehicle.getLane()->getOppositePos(myVehicle.getPositionOnLane()) : myVehicle.getPositionOnLane(); const int lca = (right ? LCA_RIGHT : LCA_LEFT); const int myLca = (right ? LCA_MRIGHT : LCA_MLEFT); const int lcaCounter = (right ? LCA_LEFT : LCA_RIGHT); @@ -1145,13 +1139,13 @@ myLookAheadSpeed = myVehicle.getSpeed(); } else { // memory decay factor for this time step - const SUMOReal memoryFactor = 1. - (1. - LOOK_AHEAD_SPEED_MEMORY) * TS; + const double memoryFactor = 1. - (1. - LOOK_AHEAD_SPEED_MEMORY) * TS; assert(memoryFactor > 0.); myLookAheadSpeed = MAX2(LOOK_AHEAD_MIN_SPEED, (memoryFactor * myLookAheadSpeed + (1 - memoryFactor) * myVehicle.getSpeed())); } - SUMOReal laDist = myLookAheadSpeed * (right ? LOOK_FORWARD_RIGHT : LOOK_FORWARD_LEFT) * myStrategicParam; - laDist += myVehicle.getVehicleType().getLengthWithGap() * (SUMOReal) 2.; + double laDist = myLookAheadSpeed * (right ? LOOK_FORWARD_RIGHT : LOOK_FORWARD_LEFT) * myStrategicParam; + laDist += myVehicle.getVehicleType().getLengthWithGap() * (double) 2.; if (bestLaneOffset == 0 && leader.first != 0 && leader.first->isStopped()) { @@ -1167,7 +1161,7 @@ } // free space that is available for changing - //const SUMOReal neighSpeed = (neighLead.first != 0 ? neighLead.first->getSpeed() : + //const double neighSpeed = (neighLead.first != 0 ? neighLead.first->getSpeed() : // neighFollow.first != 0 ? neighFollow.first->getSpeed() : // best.lane->getSpeedLimit()); // @note: while this lets vehicles change earlier into the correct direction @@ -1178,11 +1172,13 @@ // Next we assign to roundabout edges a larger distance than to normal edges // in order to decrease sense of lc urgency and induce higher usage of inner roundabout lanes. // 1) get information about the next upcoming roundabout - SUMOReal roundaboutDistanceAhead; - SUMOReal roundaboutDistanceAheadNeigh; - int roundaboutEdgesAhead; - int roundaboutEdgesAheadNeigh; - getRoundaboutAheadInfo(this, curr, neigh, roundaboutDistanceAhead, roundaboutDistanceAheadNeigh, roundaboutEdgesAhead, roundaboutEdgesAheadNeigh); + double roundaboutDistanceAhead = 0; + double roundaboutDistanceAheadNeigh = 0; + int roundaboutEdgesAhead = 0; + int roundaboutEdgesAheadNeigh = 0; + if (!isOpposite()) { + getRoundaboutAheadInfo(this, curr, neigh, roundaboutDistanceAhead, roundaboutDistanceAheadNeigh, roundaboutEdgesAhead, roundaboutEdgesAheadNeigh); + } // 2) add a distance bonus for roundabout edges currentDist += roundaboutDistBonus(roundaboutDistanceAhead, roundaboutEdgesAhead); neighDist += roundaboutDistBonus(roundaboutDistanceAheadNeigh, roundaboutEdgesAheadNeigh); @@ -1196,10 +1192,10 @@ } #endif - const SUMOReal usableDist = (currentDist - posOnLane - best.occupation * JAM_FACTOR); + const double usableDist = (currentDist - posOnLane - best.occupation * JAM_FACTOR); //- (best.lane->getVehicleNumber() * neighSpeed)); // VARIANT 9 jfSpeed - const SUMOReal maxJam = MAX2(preb[currIdx + prebOffset].occupation, preb[currIdx].occupation); - const SUMOReal neighLeftPlace = MAX2((SUMOReal) 0, neighDist - posOnLane - maxJam); + const double maxJam = MAX2(preb[currIdx + prebOffset].occupation, preb[currIdx].occupation); + const double neighLeftPlace = MAX2((double) 0, neighDist - posOnLane - maxJam); #ifdef DEBUG_WANTS_CHANGE if (DEBUG_COND) { @@ -1229,8 +1225,8 @@ // rather move left ourselves (unless congested) MSVehicle* nv = neighLead.first; if (nv->getSpeed() < myVehicle.getSpeed()) { - const SUMOReal vSafe = myCarFollowModel.followSpeed( - &myVehicle, myVehicle.getSpeed(), neighLead.second, nv->getSpeed(), nv->getCarFollowModel().getMaxDecel()); + const double vSafe = myCarFollowModel.followSpeed( + &myVehicle, myVehicle.getSpeed(), neighLead.second, nv->getSpeed(), nv->getCarFollowModel().getMaxDecel()); myVSafes.push_back(vSafe); if (vSafe < myVehicle.getSpeed()) { mySpeedGainProbability += TS * myChangeProbThresholdLeft / 3; @@ -1314,12 +1310,12 @@ myLeftSpace = currentDist - posOnLane; if (changeToBest && abs(bestLaneOffset) > 1) { // there might be a vehicle which needs to counter-lane-change one lane further and we cannot see it yet + myLeadingBlockerLength = MAX2((double)(right ? 20.0 : 40.0), myLeadingBlockerLength); #ifdef DEBUG_WANTS_CHANGE if (DEBUG_COND) { - std::cout << " reserving space for unseen blockers\n"; + std::cout << " reserving space for unseen blockers myLeadingBlockerLength=" << myLeadingBlockerLength << "\n"; } #endif - myLeadingBlockerLength = MAX2((SUMOReal)(right ? 20.0 : 40.0), myLeadingBlockerLength); } // letting vehicles merge in at the end of the lane in case of counter-lane change, step#1 @@ -1329,11 +1325,11 @@ saveBlockerLength(*firstBlocked, lcaCounter); } - const SUMOReal remainingSeconds = ((ret & LCA_TRACI) == 0 ? - // MAX2((SUMOReal)STEPS2TIME(TS), (myLeftSpace-myLeadingBlockerLength) / MAX2(myLookAheadSpeed, NUMERICAL_EPS) / abs(bestLaneOffset) / URGENCY) : - MAX2((SUMOReal)STEPS2TIME(TS), myLeftSpace / MAX2(myLookAheadSpeed, NUMERICAL_EPS) / abs(bestLaneOffset) / URGENCY) : - myVehicle.getInfluencer().changeRequestRemainingSeconds(currentTime)); - const SUMOReal plannedSpeed = informLeader(msgPass, blocked, myLca, neighLead, remainingSeconds); + const double remainingSeconds = ((ret & LCA_TRACI) == 0 ? + // MAX2((double)STEPS2TIME(TS), (myLeftSpace-myLeadingBlockerLength) / MAX2(myLookAheadSpeed, NUMERICAL_EPS) / abs(bestLaneOffset) / URGENCY) : + MAX2((double)STEPS2TIME(TS), myLeftSpace / MAX2(myLookAheadSpeed, NUMERICAL_EPS) / abs(bestLaneOffset) / URGENCY) : + myVehicle.getInfluencer().changeRequestRemainingSeconds(currentTime)); + const double plannedSpeed = informLeader(msgPass, blocked, myLca, neighLead, remainingSeconds); // NOTE: for the ballistic update case negative speeds may indicate a stop request, // while informLeader returns -1 in that case. Refs. #2577 if (plannedSpeed >= 0 || (!MSGlobals::gSemiImplicitEulerUpdate && plannedSpeed != -1)) { @@ -1355,9 +1351,9 @@ return ret; } // a high inconvenience prevents cooperative changes. - const SUMOReal inconvenience = MIN2((SUMOReal)1.0, (laneOffset < 0 - ? mySpeedGainProbability / myChangeProbThresholdRight - : -mySpeedGainProbability / myChangeProbThresholdLeft)); + const double inconvenience = MIN2((double)1.0, (laneOffset < 0 + ? mySpeedGainProbability / myChangeProbThresholdRight + : -mySpeedGainProbability / myChangeProbThresholdLeft)); const bool speedGainInconvenient = inconvenience > myCooperativeParam; const bool neighOccupancyInconvenient = neigh.lane->getBruttoOccupancy() > curr.lane->getBruttoOccupancy(); @@ -1456,8 +1452,8 @@ // return ret; //} - SUMOReal thisLaneVSafe = myVehicle.getLane()->getVehicleMaxSpeed(&myVehicle); - SUMOReal neighLaneVSafe = neighLane.getVehicleMaxSpeed(&myVehicle); + double thisLaneVSafe = myVehicle.getLane()->getVehicleMaxSpeed(&myVehicle); + double neighLaneVSafe = neighLane.getVehicleMaxSpeed(&myVehicle); /* First attempt to fix #2126 * should rather be considering anticipated speeds further in the future, maybe combined with maximal speed as tried here @@ -1477,8 +1473,8 @@ } */ - const SUMOReal correctedSpeed = (myVehicle.getSpeed() + myVehicle.getCarFollowModel().getMaxAccel() - - ACCEL2SPEED(myVehicle.getCarFollowModel().getMaxAccel())); + const double correctedSpeed = (myVehicle.getSpeed() + myVehicle.getCarFollowModel().getMaxAccel() + - ACCEL2SPEED(myVehicle.getCarFollowModel().getMaxAccel())); if (neighLead.first == 0) { neighLaneVSafe = MIN2(neighLaneVSafe, myCarFollowModel.followSpeed(&myVehicle, correctedSpeed, neighDist, 0, 0)); } else { @@ -1494,14 +1490,14 @@ &myVehicle, correctedSpeed, leader.second, leader.first->getSpeed(), leader.first->getCarFollowModel().getMaxDecel())); } - const SUMOReal vMax = MIN2(myVehicle.getVehicleType().getMaxSpeed(), myVehicle.getLane()->getVehicleMaxSpeed(&myVehicle)); + const double vMax = MIN2(myVehicle.getVehicleType().getMaxSpeed(), myVehicle.getLane()->getVehicleMaxSpeed(&myVehicle)); thisLaneVSafe = MIN2(thisLaneVSafe, vMax); neighLaneVSafe = MIN2(neighLaneVSafe, vMax); - const SUMOReal relativeGain = (neighLaneVSafe - thisLaneVSafe) / MAX2(neighLaneVSafe, - RELGAIN_NORMALIZATION_MIN_SPEED); + const double relativeGain = (neighLaneVSafe - thisLaneVSafe) / MAX2(neighLaneVSafe, + RELGAIN_NORMALIZATION_MIN_SPEED); // // maybe this (acceleration-difference) would be a good quantity to take into account for lc-considerations..., refs. #2126 -// const SUMOReal accelDifference = ACCEL2SPEED(neighLaneVSafe - thisLaneVSafe); +// const double accelDifference = ACCEL2SPEED(neighLaneVSafe - thisLaneVSafe); #ifdef DEBUG_WANTS_CHANGE @@ -1542,19 +1538,19 @@ // honor the obligation to keep right (Rechtsfahrgebot) // XXX consider fast approaching followers on the current lane. Refs #2578 - //const SUMOReal vMax = myLookAheadSpeed; - const SUMOReal acceptanceTime = KEEP_RIGHT_ACCEPTANCE * vMax * MAX2((SUMOReal)1, myVehicle.getSpeed()) / myVehicle.getLane()->getSpeedLimit(); - SUMOReal fullSpeedGap = MAX2((SUMOReal)0, neighDist - myVehicle.getCarFollowModel().brakeGap(vMax)); - SUMOReal fullSpeedDrivingSeconds = MIN2(acceptanceTime, fullSpeedGap / vMax); + //const double vMax = myLookAheadSpeed; + const double acceptanceTime = KEEP_RIGHT_ACCEPTANCE * vMax * MAX2((double)1, myVehicle.getSpeed()) / myVehicle.getLane()->getSpeedLimit(); + double fullSpeedGap = MAX2(0., neighDist - myVehicle.getCarFollowModel().brakeGap(vMax)); + double fullSpeedDrivingSeconds = MIN2(acceptanceTime, fullSpeedGap / vMax); if (neighLead.first != 0 && neighLead.first->getSpeed() < vMax) { - fullSpeedGap = MAX2((SUMOReal)0, MIN2(fullSpeedGap, - neighLead.second - myVehicle.getCarFollowModel().getSecureGap( - vMax, neighLead.first->getSpeed(), neighLead.first->getCarFollowModel().getMaxDecel()))); + fullSpeedGap = MAX2(0., MIN2(fullSpeedGap, + neighLead.second - myVehicle.getCarFollowModel().getSecureGap( + vMax, neighLead.first->getSpeed(), neighLead.first->getCarFollowModel().getMaxDecel()))); fullSpeedDrivingSeconds = MIN2(fullSpeedDrivingSeconds, fullSpeedGap / (vMax - neighLead.first->getSpeed())); } - const SUMOReal deltaProb = (myChangeProbThresholdRight - * STEPS2TIME(DELTA_T) - * (fullSpeedDrivingSeconds / acceptanceTime) / KEEP_RIGHT_TIME); + const double deltaProb = (myChangeProbThresholdRight + * STEPS2TIME(DELTA_T) + * (fullSpeedDrivingSeconds / acceptanceTime) / KEEP_RIGHT_TIME); myKeepRightProbability -= TS * deltaProb; #ifdef DEBUG_WANTS_CHANGE @@ -1598,7 +1594,7 @@ #endif if (mySpeedGainProbability < -myChangeProbThresholdRight - && neighDist / MAX2((SUMOReal) .1, myVehicle.getSpeed()) > 20.) { //./MAX2((SUMOReal) .1, myVehicle.getSpeed())) { // -.1 + && neighDist / MAX2((double) .1, myVehicle.getSpeed()) > 20.) { //./MAX2((double) .1, myVehicle.getSpeed())) { // -.1 req = ret | lca | LCA_SPEEDGAIN; if (!cancelRequest(req)) { return ret | req; @@ -1618,7 +1614,7 @@ // VARIANT_19 (stayRight) //if (neighFollow.first != 0) { // MSVehicle* nv = neighFollow.first; - // const SUMOReal secGap = nv->getCarFollowModel().getSecureGap(nv->getSpeed(), myVehicle.getSpeed(), myVehicle.getCarFollowModel().getMaxDecel()); + // const double secGap = nv->getCarFollowModel().getSecureGap(nv->getSpeed(), myVehicle.getSpeed(), myVehicle.getCarFollowModel().getMaxDecel()); // if (neighFollow.second < secGap * KEEP_RIGHT_HEADWAY) { // // do not change left if it would inconvenience faster followers // return ret | LCA_STAY | LCA_SPEEDGAIN; @@ -1639,7 +1635,7 @@ } #endif - if (mySpeedGainProbability > myChangeProbThresholdLeft && neighDist / MAX2((SUMOReal) .1, myVehicle.getSpeed()) > 20.) { // .1 + if (mySpeedGainProbability > myChangeProbThresholdLeft && neighDist / MAX2((double) .1, myVehicle.getSpeed()) > 20.) { // .1 req = ret | lca | LCA_SPEEDGAIN; if (!cancelRequest(req)) { return ret | req; @@ -1673,21 +1669,20 @@ void MSLCM_LC2013::getRoundaboutAheadInfo(const MSLCM_LC2013* lcm, const MSVehicle::LaneQ& curr, const MSVehicle::LaneQ& neigh, - SUMOReal& roundaboutDistanceAhead, SUMOReal& roundaboutDistanceAheadNeigh, int& roundaboutEdgesAhead, int& roundaboutEdgesAheadNeigh) { + double& roundaboutDistanceAhead, double& roundaboutDistanceAheadNeigh, int& roundaboutEdgesAhead, int& roundaboutEdgesAheadNeigh) { const MSVehicle& veh = lcm->myVehicle; // In what follows, we check whether a roundabout is ahead (or the vehicle is on a roundabout) // We calculate the lengths of the continuations described by curr and neigh, // which are part of the roundabout. Currently only takes effect for ballistic update, refs #1807, #2576 (Leo) - SUMOReal pos = lcm->isOpposite() ? veh.getLane()->getLength() - veh.getPositionOnLane() : veh.getPositionOnLane(); + double pos = lcm->isOpposite() ? veh.getLane()->getLength() - veh.getPositionOnLane() : veh.getPositionOnLane(); roundaboutDistanceAhead = distanceAlongNextRoundabout(pos, veh.getLane(), curr.bestContinuations); // For the distance on the neigh.lane, we need to do a little hack since we may not // have access to the right initial lane (neigh.lane is only the first non-null lane of neigh.bestContinuations). roundaboutDistanceAheadNeigh = 0; - SUMOReal neighPosition = pos; -#ifdef HAVE_INTERNAL_LANES + double neighPosition = pos; if (veh.getLane()->getEdge().getPurpose() == MSEdge::EDGEFUNCTION_INTERNAL) { // take care of the distance on internal lanes neighPosition = 0.; @@ -1708,12 +1703,11 @@ roundaboutDistanceAheadNeigh += link->getInternalLengthsAfter(); } } -#endif // add roundabout distance from neigh.lane on roundaboutDistanceAheadNeigh += distanceAlongNextRoundabout(neighPosition, neigh.lane, neigh.bestContinuations); #ifdef DEBUG_WANTS_CHANGE - if (DEBUG_COND) { + if (lcm->debugVehicle()) { std::cout << "roundaboutDistanceAhead = " << roundaboutDistanceAhead << " roundaboutDistanceAheadNeigh = " << roundaboutDistanceAheadNeigh << "\n"; @@ -1745,8 +1739,8 @@ } -SUMOReal -MSLCM_LC2013::roundaboutDistBonus(SUMOReal roundaboutDistAhead, int roundaboutEdgesAhead) const { +double +MSLCM_LC2013::roundaboutDistBonus(double roundaboutDistAhead, int roundaboutEdgesAhead) const { // NOTE: Currently there are two variants, one taking into account only the number // of upcoming non-internal roundabout edges and adding ROUNDABOUT_DIST_BONUS per upcoming edge except the first. // Another variant uses the actual distance and multiplies it by a factor ROUNDABOUT_DIST_FACTOR. @@ -1774,15 +1768,15 @@ } -SUMOReal -MSLCM_LC2013::distanceAlongNextRoundabout(SUMOReal position, const MSLane* initialLane, const std::vector& continuationLanes) { +double +MSLCM_LC2013::distanceAlongNextRoundabout(double position, const MSLane* initialLane, const std::vector& continuationLanes) { for (std::vector::const_iterator i = continuationLanes.begin(); i != continuationLanes.end(); i++) { assert((*i) == 0 || (*i)->getEdge().getPurpose() != MSEdge::EDGEFUNCTION_INTERNAL); } // We start with the current edge. bool encounteredRoundabout = false; - SUMOReal roundaboutDistanceAhead = 0.; + double roundaboutDistanceAhead = 0.; // set an iterator to the first non-zero entry of continuationLanes std::vector::const_iterator j = continuationLanes.begin(); @@ -1845,7 +1839,7 @@ // find corresponding link for the current lane const MSLink* link = MSLinkContHelper::getConnectingLink(*lane, **(it + 1)); assert(link != 0); - SUMOReal linkLength = link->getInternalLengthsAfter(); + double linkLength = link->getInternalLengthsAfter(); roundaboutDistanceAhead += linkLength; } } else if (encounteredRoundabout) { @@ -1862,7 +1856,7 @@ MSLCM_LC2013::slowDownForBlocked(MSVehicle** blocked, int state) { // if this vehicle is blocking someone in front, we maybe decelerate to let him in if ((*blocked) != 0) { - SUMOReal gap = (*blocked)->getPositionOnLane() - (*blocked)->getVehicleType().getLength() - myVehicle.getPositionOnLane() - myVehicle.getVehicleType().getMinGap(); + double gap = (*blocked)->getPositionOnLane() - (*blocked)->getVehicleType().getLength() - myVehicle.getPositionOnLane() - myVehicle.getVehicleType().getMinGap(); #ifdef DEBUG_SLOW_DOWN if (DEBUG_COND) { std::cout << STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()) @@ -1886,7 +1880,7 @@ } myVSafes.push_back(myCarFollowModel.followSpeed( &myVehicle, myVehicle.getSpeed(), - (SUMOReal)(gap - POSITION_EPS), (*blocked)->getSpeed(), + (double)(gap - POSITION_EPS), (*blocked)->getSpeed(), (*blocked)->getCarFollowModel().getMaxDecel())); //(*blocked) = 0; // VARIANT_14 (furtherBlock) @@ -1905,7 +1899,7 @@ state |= LCA_AMBACKBLOCKER; myVSafes.push_back(myCarFollowModel.followSpeed( &myVehicle, myVehicle.getSpeed(), - (SUMOReal)(gap - POSITION_EPS), (*blocked)->getSpeed(), + (double)(gap - POSITION_EPS), (*blocked)->getSpeed(), (*blocked)->getCarFollowModel().getMaxDecel())); }*/ } @@ -1927,8 +1921,8 @@ #endif if (blocker != 0 && (blocker->getLaneChangeModel().getOwnState() & lcaCounter) != 0) { // is there enough space in front of us for the blocker? - const SUMOReal potential = myLeftSpace - myVehicle.getCarFollowModel().brakeGap( - myVehicle.getSpeed(), myVehicle.getCarFollowModel().getMaxDecel(), 0); + const double potential = myLeftSpace - myVehicle.getCarFollowModel().brakeGap( + myVehicle.getSpeed(), myVehicle.getCarFollowModel().getMaxDecel(), 0); if (blocker->getVehicleType().getLengthWithGap() <= potential) { // save at least his length in myLeadingBlockerLength myLeadingBlockerLength = MAX2(blocker->getVehicleType().getLengthWithGap(), myLeadingBlockerLength); @@ -1958,5 +1952,43 @@ } } } + + +std::string +MSLCM_LC2013::getParameter(const std::string& key) const { + if (key == toString(SUMO_ATTR_LCA_STRATEGIC_PARAM)) { + return toString(myStrategicParam); + } else if (key == toString(SUMO_ATTR_LCA_COOPERATIVE_PARAM)) { + return toString(myCooperativeParam); + } else if (key == toString(SUMO_ATTR_LCA_SPEEDGAIN_PARAM)) { + return toString(mySpeedGainParam); + } else if (key == toString(LCA_KEEPRIGHT)) { + return toString(myKeepRightParam); + } + throw InvalidArgument("Parameter '" + key + "' is not supported for laneChangeModel of type '" + toString(myModel) + "'"); +} + + +void +MSLCM_LC2013::setParameter(const std::string& key, const std::string& value) { + double doubleValue; + try { + doubleValue = TplConvert::_2double(value.c_str()); + } catch (NumberFormatException) { + throw InvalidArgument("Setting parameter '" + key + "' requires a number for laneChangeModel of type '" + toString(myModel) + "'"); + } + if (key == toString(SUMO_ATTR_LCA_STRATEGIC_PARAM)) { + myStrategicParam = doubleValue; + } else if (key == toString(SUMO_ATTR_LCA_COOPERATIVE_PARAM)) { + myCooperativeParam = doubleValue; + } else if (key == toString(SUMO_ATTR_LCA_SPEEDGAIN_PARAM)) { + mySpeedGainParam = doubleValue; + } else if (key == toString(LCA_KEEPRIGHT)) { + myKeepRightParam = doubleValue; + } else { + throw InvalidArgument("Setting parameter '" + key + "' is not supported for laneChangeModel of type '" + toString(myModel) + "'"); + } +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_LC2013.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_LC2013.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_LC2013.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_LC2013.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Fri, 08.10.2013 -/// @version $Id: MSLCM_LC2013.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSLCM_LC2013.h 24108 2017-04-27 18:43:30Z behrisch $ /// // A lane change model developed by D. Krajzewicz, J. Erdmann et al. between 2004 and 2013 /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -84,9 +84,9 @@ int wantsChange( int laneOffset, MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked, - const std::pair& leader, - const std::pair& neighLead, - const std::pair& neighFollow, + const std::pair& leader, + const std::pair& neighLead, + const std::pair& neighFollow, const MSLane& neighLane, const std::vector& preb, MSVehicle** lastBlocked, @@ -102,16 +102,21 @@ * @param cfModel The model used * @return the new speed of the vehicle as proposed by the lane changer */ - SUMOReal patchSpeed(const SUMOReal min, const SUMOReal wanted, const SUMOReal max, - const MSCFModel& cfModel); + double patchSpeed(const double min, const double wanted, const double max, + const MSCFModel& cfModel); /** helper function which contains the actual logic */ - SUMOReal _patchSpeed(const SUMOReal min, const SUMOReal wanted, const SUMOReal max, - const MSCFModel& cfModel); + double _patchSpeed(const double min, const double wanted, const double max, + const MSCFModel& cfModel); void changed(); void prepareStep(); + /// @brief try to retrieve the given parameter from this device. Throw exception for unsupported key + std::string getParameter(const std::string& key) const; + + /// @brief try to set the given parameter for this laneChangeModel. Throw exception for unsupported key + void setParameter(const std::string& key, const std::string& value); protected: @@ -119,9 +124,9 @@ int _wantsChange( int laneOffset, MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked, - const std::pair& leader, - const std::pair& neighLead, - const std::pair& neighFollow, + const std::pair& leader, + const std::pair& neighLead, + const std::pair& neighFollow, const MSLane& neighLane, const std::vector& preb, MSVehicle** lastBlocked, @@ -131,17 +136,17 @@ * and inform it accordingly * If we decide to follow, myVSafes will be extended * returns the planned speed if following or -1 if overtaking */ - SUMOReal informLeader(MSAbstractLaneChangeModel::MSLCMessager& msgPass, - int blocked, int dir, - const std::pair& neighLead, - SUMOReal remainingSeconds); + double informLeader(MSAbstractLaneChangeModel::MSLCMessager& msgPass, + int blocked, int dir, + const std::pair& neighLead, + double remainingSeconds); /// @brief decide whether we will try cut in before the follower or allow to be overtaken void informFollower(MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked, int dir, - const std::pair& neighFollow, - SUMOReal remainingSeconds, - SUMOReal plannedSpeed); + const std::pair& neighFollow, + double remainingSeconds, + double plannedSpeed); /* @brief compute the distance to cover until a safe gap to the vehicle v in front is reached @@ -153,7 +158,7 @@ * @param[in] followerSpeed an assumed speed for the follower (default uses the current speed) * @return the distance that the relative positions would have to change. */ - static SUMOReal overtakeDistance(const MSVehicle* follower, const MSVehicle* leader, const SUMOReal gap, SUMOReal followerSpeed = INVALID_SPEED, SUMOReal leaderSpeed = INVALID_SPEED); + static double overtakeDistance(const MSVehicle* follower, const MSVehicle* leader, const double gap, double followerSpeed = INVALID_SPEED, double leaderSpeed = INVALID_SPEED); /// @brief compute useful slowdowns for blocked vehicles int slowDownForBlocked(MSVehicle** blocked, int state); @@ -171,7 +176,7 @@ /// @param[out] roundaboutEdgesAheadNeigh Number of lanes in the next oncoming roundabout in neigh static void getRoundaboutAheadInfo(const MSLCM_LC2013* lcm, const MSVehicle::LaneQ& curr, const MSVehicle::LaneQ& neigh, - SUMOReal& roundaboutDistanceAhead, SUMOReal& roundaboutDistanceAheadNeigh, int& roundaboutEdgesAhead, int& roundaboutEdgesAheadNeigh); + double& roundaboutDistanceAhead, double& roundaboutDistanceAheadNeigh, int& roundaboutEdgesAhead, int& roundaboutEdgesAheadNeigh); /// @brief Computes the artificial bonus distance for roundabout lanes /// this additional distance reduces the sense of urgency within @@ -179,22 +184,22 @@ /// lane in multi-lane roundabouts. /// @param[in] roundaboutDistAhead Distance on roundabout /// @param[in] roundaboutEdgesAhead number of edges on roundabout - SUMOReal - roundaboutDistBonus(SUMOReal roundaboutDistAhead, int roundaboutEdgesAhead) const; + double + roundaboutDistBonus(double roundaboutDistAhead, int roundaboutEdgesAhead) const; /// @brief compute the distance on the next upcoming roundabout along a given sequence of lanes. /// @param[in] position position of the vehicle on the initial lane /// @param[in] initialLane starting lane for the computation (may be internal) /// @param[in] continuationLanes sequence of lanes along which the roundabout distance is to be computed (only containing non-internal lanes) /// @return distance along next upcoming roundabout on the given sequence of lanes continuationLanes - static SUMOReal - distanceAlongNextRoundabout(SUMOReal position, const MSLane* initialLane, const std::vector& continuationLanes); + static double + distanceAlongNextRoundabout(double position, const MSLane* initialLane, const std::vector& continuationLanes); /// @brief save space for vehicles which need to counter-lane-change void saveBlockerLength(MSVehicle* blocker, int lcaCounter); /// @brief reserve space at the end of the lane to avoid dead locks - inline void saveBlockerLength(SUMOReal length) { + inline void saveBlockerLength(double length) { myLeadingBlockerLength = MAX2(length, myLeadingBlockerLength); }; @@ -210,49 +215,51 @@ inline bool amBlockingFollowerPlusNB() { return (myOwnState & (LCA_AMBLOCKINGFOLLOWER | LCA_AMBLOCKINGFOLLOWER_DONTBRAKE)) != 0; } - inline bool currentDistDisallows(SUMOReal dist, int laneOffset, SUMOReal lookForwardDist) { + inline bool currentDistDisallows(double dist, int laneOffset, double lookForwardDist) { return dist / (abs(laneOffset)) < lookForwardDist; } - inline bool currentDistAllows(SUMOReal dist, int laneOffset, SUMOReal lookForwardDist) { + inline bool currentDistAllows(double dist, int laneOffset, double lookForwardDist) { return dist / abs(laneOffset) > lookForwardDist; } /// @brief information regarding save velocity (unused) and state flags of the ego vehicle - typedef std::pair Info; + typedef std::pair Info; protected: /// @brief a value for tracking the probability that a change to the offset with the same sign is beneficial - SUMOReal mySpeedGainProbability; + double mySpeedGainProbability; /* @brief a value for tracking the probability of following the/"Rechtsfahrgebot" * A larger negative value indicates higher probability for moving to the * right (as in mySpeedGainProbability) */ - SUMOReal myKeepRightProbability; + double myKeepRightProbability; - SUMOReal myLeadingBlockerLength; - SUMOReal myLeftSpace; + double myLeadingBlockerLength; + double myLeftSpace; /*@brief the speed to use when computing the look-ahead distance for * determining urgency of strategic lane changes */ - SUMOReal myLookAheadSpeed; + double myLookAheadSpeed; - std::vector myVSafes; + std::vector myVSafes; bool myDontBrake; // XXX: myDontBrake is initialized as false and seems not to be changed anywhere... What's its purpose??? - /// @name user configurable model parameters + /// @name user configurable model parameters (can be changed via TraCI) //@{ - const SUMOReal myStrategicParam; - const SUMOReal myCooperativeParam; // in [0,1] - const SUMOReal mySpeedGainParam; - const SUMOReal myKeepRightParam; + double myStrategicParam; + double myCooperativeParam; // in [0,1] + double mySpeedGainParam; + double myKeepRightParam; + + const double myExperimentalParam1; // for feature testing //@} /// @name derived parameters //@{ // @brief willingness to encroach on other vehicles laterally (pushing them around) - const SUMOReal myChangeProbThresholdRight; - const SUMOReal myChangeProbThresholdLeft; + const double myChangeProbThresholdRight; + const double myChangeProbThresholdLeft; //@} }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_SL2015.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_SL2015.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_SL2015.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_SL2015.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSLCM_SL2015.h /// @author Jakob Erdmann /// @date Tue, 06.10.2015 -/// @version $Id: MSLCM_SL2015.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSLCM_SL2015.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A lane change model for heterogeneous traffic (based on sub-lanes) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -30,68 +30,68 @@ #include #include +#include #include #include #include #include #include "MSLCM_SL2015.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - //#define DEBUG_VEHICLE_GUI_SELECTION 1 // =========================================================================== // variable definitions // =========================================================================== // 80km/h will be the threshold for dividing between long/short foresight -#define LOOK_FORWARD_SPEED_DIVIDER (SUMOReal)14. +#define LOOK_FORWARD_SPEED_DIVIDER (double)14. // VARIANT_1 (lf*2) //#define LOOK_FORWARD_FAR 30. //#define LOOK_FORWARD_NEAR 10. -#define LOOK_FORWARD_RIGHT (SUMOReal)10. -#define LOOK_FORWARD_LEFT (SUMOReal)20. +#define LOOK_FORWARD_RIGHT (double)10. +#define LOOK_FORWARD_LEFT (double)20. -#define JAM_FACTOR (SUMOReal)1. +#define JAM_FACTOR (double)1. //#define JAM_FACTOR 2. // VARIANT_8 (makes vehicles more focused but also more "selfish") -#define LCA_RIGHT_IMPATIENCE (SUMOReal)-1. -#define CUT_IN_LEFT_SPEED_THRESHOLD (SUMOReal)27. -#define MAX_ONRAMP_LENGTH (SUMOReal)200. +#define LCA_RIGHT_IMPATIENCE (double)-1. +#define CUT_IN_LEFT_SPEED_THRESHOLD (double)27. +#define MAX_ONRAMP_LENGTH (double)200. -#define LOOK_AHEAD_MIN_SPEED (SUMOReal)0.0 -#define LOOK_AHEAD_SPEED_MEMORY (SUMOReal)0.9 +#define LOOK_AHEAD_MIN_SPEED 0.0 +#define LOOK_AHEAD_SPEED_MEMORY 0.9 #define LOOK_AHEAD_SPEED_DECREMENT 6. -#define HELP_DECEL_FACTOR (SUMOReal)1.0 +#define HELP_DECEL_FACTOR (double)1.0 -#define HELP_OVERTAKE (SUMOReal)(10.0 / 3.6) -#define MIN_FALLBEHIND (SUMOReal)(7.0 / 3.6) +#define HELP_OVERTAKE (double)(10.0 / 3.6) +#define MIN_FALLBEHIND (double)(7.0 / 3.6) -#define KEEP_RIGHT_HEADWAY (SUMOReal)2.0 +#define KEEP_RIGHT_HEADWAY (double)2.0 -#define URGENCY (SUMOReal)2.0 +#define URGENCY (double)2.0 -#define ROUNDABOUT_DIST_BONUS (SUMOReal)100.0 +#define ROUNDABOUT_DIST_BONUS (double)100.0 -#define KEEP_RIGHT_TIME (SUMOReal)5.0 // the number of seconds after which a vehicle should move to the right lane -#define KEEP_RIGHT_ACCEPTANCE (SUMOReal)7.0 // calibration factor for determining the desire to keep right +#define KEEP_RIGHT_TIME (double)5.0 // the number of seconds after which a vehicle should move to the right lane +#define KEEP_RIGHT_ACCEPTANCE (double)7.0 // calibration factor for determining the desire to keep right -#define RELGAIN_NORMALIZATION_MIN_SPEED (SUMOReal)10.0 +#define RELGAIN_NORMALIZATION_MIN_SPEED (double)10.0 -#define TURN_LANE_DIST (SUMOReal)200.0 // the distance at which a lane leading elsewhere is considered to be a turn-lane that must be avoided -#define GAIN_PERCEPTION_THRESHOLD (SUMOReal)0.05 // the minimum relative speed gain which affects the behavior +#define TURN_LANE_DIST (double)200.0 // the distance at which a lane leading elsewhere is considered to be a turn-lane that must be avoided +#define GAIN_PERCEPTION_THRESHOLD 0.05 // the minimum relative speed gain which affects the behavior #define SPEED_GAIN_MIN_SECONDS 20.0 #define ARRIVALPOS_LAT_THRESHOLD 100.0 +// the speed at which the desired lateral gap grows now further +#define LATGAP_SPEED_THRESHOLD (50 / 3.6) + //#define DEBUG_COND (myVehicle.getID() == "moped.18" || myVehicle.getID() == "moped.16") -//#define DEBUG_COND (myVehicle.getID() == "A") -#define DEBUG_COND (myVehicle.getID() == "disabled") +//#define DEBUG_COND (myVehicle.getID() == "E1") +#define DEBUG_COND (myVehicle.isSelected()) //#define DEBUG_COND (myVehicle.getID() == "pkw150478" || myVehicle.getID() == "pkw150494" || myVehicle.getID() == "pkw150289") //#define DEBUG_COND (myVehicle.getID() == "A" || myVehicle.getID() == "B") // fail change to left //#define DEBUG_COND (myVehicle.getID() == "disabled") // test stops_overtaking @@ -123,9 +123,6 @@ myChangeProbThresholdRight(2.0 * myKeepRightParam / MAX2(NUMERICAL_EPS, mySpeedGainParam)), myChangeProbThresholdLeft(0.2 / MAX2(NUMERICAL_EPS, mySpeedGainParam)), mySpeedLossProbThreshold(-0.01 + (1 - mySublaneParam)) { - if (MSGlobals::gLateralResolution <= 0) { - throw ProcessError("laneChangeModel 'MSLCM_SL2015' is only meant to be used when simulating with '--lateral-resoluion' > 0"); - } } MSLCM_SL2015::~MSLCM_SL2015() { @@ -152,7 +149,7 @@ const std::vector& preb, MSVehicle** lastBlocked, MSVehicle** firstBlocked, - SUMOReal& latDist, int& blocked) { + double& latDist, int& blocked) { gDebugFlag2 = DEBUG_COND; const std::string changeType = laneOffset == -1 ? "right" : (laneOffset == 1 ? "left" : "current"); @@ -160,7 +157,7 @@ if (gDebugFlag2) { std::cout << "\n" << STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()) - //<< std::setprecision(10) + << std::setprecision(gPrecision) << " veh=" << myVehicle.getID() << " lane=" << myVehicle.getLane()->getID() << " pos=" << myVehicle.getPositionOnLane() @@ -176,13 +173,6 @@ neighLane, preb, lastBlocked, firstBlocked, latDist, blocked); - if ((result & LCA_STAY) != 0) { - // checkBlocking was not called yet - assert(latDist == 0); - myOrigLatDist = 0; - myCanChangeFully = true; - } - result = keepLatGap(result, leaders, followers, blockers, neighLeaders, neighFollowers, neighBlockers, neighLane, laneOffset, latDist, blocked); @@ -210,12 +200,28 @@ return result; } +void +MSLCM_SL2015::setOwnState(const int state) { + MSAbstractLaneChangeModel::setOwnState(state); + myPreviousState = state; + if (DEBUG_COND) { + std::cout << SIMTIME << " veh=" << myVehicle.getID() << " setOwnState=" << toString((LaneChangeAction)state) << "\n"; + } + if ((state & LCA_STAY) != 0) { + myOrigLatDist = 0; + myCanChangeFully = true; + if (DEBUG_COND) { + std::cout << " myCanChangeFully=true\n"; + } + } -SUMOReal -MSLCM_SL2015::patchSpeed(const SUMOReal min, const SUMOReal wanted, const SUMOReal max, const MSCFModel& cfModel) { +} + +double +MSLCM_SL2015::patchSpeed(const double min, const double wanted, const double max, const MSCFModel& cfModel) { gDebugFlag2 = DEBUG_COND; - const SUMOReal newSpeed = _patchSpeed(min, wanted, max, cfModel); + const double newSpeed = _patchSpeed(min, wanted, max, cfModel); if (gDebugFlag2) { const std::string patched = (wanted != newSpeed ? " patched=" + toString(newSpeed) : ""); std::cout << STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()) @@ -232,24 +238,24 @@ } -SUMOReal -MSLCM_SL2015::_patchSpeed(const SUMOReal min, const SUMOReal wanted, const SUMOReal max, const MSCFModel& cfModel) { +double +MSLCM_SL2015::_patchSpeed(const double min, const double wanted, const double max, const MSCFModel& cfModel) { - const SUMOReal time = STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()); + const double time = STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()); int state = myOwnState; // letting vehicles merge in at the end of the lane in case of counter-lane change, step#2 - SUMOReal MAGIC_offset = 1.; + double MAGIC_offset = 1.; // if we want to change and have a blocking leader and there is enough room for him in front of us if (myLeadingBlockerLength != 0) { - SUMOReal space = myLeftSpace - myLeadingBlockerLength - MAGIC_offset - myVehicle.getVehicleType().getMinGap(); + double space = myLeftSpace - myLeadingBlockerLength - MAGIC_offset - myVehicle.getVehicleType().getMinGap(); if (gDebugFlag2) { std::cout << time << " veh=" << myVehicle.getID() << " myLeadingBlockerLength=" << myLeadingBlockerLength << " space=" << space << "\n"; } if (space > 0) { // XXX space > -MAGIC_offset // compute speed for decelerating towards a place which allows the blocking leader to merge in in front - SUMOReal safe = cfModel.stopSpeed(&myVehicle, myVehicle.getSpeed(), space); + double safe = cfModel.stopSpeed(&myVehicle, myVehicle.getSpeed(), space); // if we are approaching this place if (safe < wanted) { if (gDebugFlag2) { @@ -260,10 +266,10 @@ } } - SUMOReal nVSafe = wanted; + double nVSafe = wanted; bool gotOne = false; - for (std::vector::const_iterator i = myVSafes.begin(); i != myVSafes.end(); ++i) { - SUMOReal v = (*i); + for (std::vector::const_iterator i = myVSafes.begin(); i != myVSafes.end(); ++i) { + double v = (*i); if (v >= min && v <= max) { nVSafe = MIN2(v, nVSafe); gotOne = true; @@ -298,26 +304,26 @@ if (gDebugFlag2) { std::cout << time << " veh=" << myVehicle.getID() << " LCA_WANTS_LANECHANGE (strat, no vSafe)\n"; } - return (max + wanted) / (SUMOReal) 2.0; + return (max + wanted) / (double) 2.0; } else if ((state & LCA_COOPERATIVE) != 0) { // only minor adjustments in speed should be done if ((state & LCA_BLOCKED_BY_LEADER) != 0) { if (gDebugFlag2) { std::cout << time << " veh=" << myVehicle.getID() << " LCA_BLOCKED_BY_LEADER (coop)\n"; } - return (min + wanted) / (SUMOReal) 2.0; + return (min + wanted) / (double) 2.0; } if ((state & LCA_BLOCKED_BY_FOLLOWER) != 0) { if (gDebugFlag2) { std::cout << time << " veh=" << myVehicle.getID() << " LCA_BLOCKED_BY_FOLLOWER (coop)\n"; } - return (max + wanted) / (SUMOReal) 2.0; + return (max + wanted) / (double) 2.0; } //} else { // VARIANT_16 // // only accelerations should be performed // if ((state & LCA_BLOCKED_BY_FOLLOWER) != 0) { // if (gDebugFlag2) std::cout << time << " veh=" << myVehicle.getID() << " LCA_BLOCKED_BY_FOLLOWER\n"; - // return (max + wanted) / (SUMOReal) 2.0; + // return (max + wanted) / (double) 2.0; // } } } @@ -333,7 +339,7 @@ if (gDebugFlag2) std::cout << time << " veh=" << myVehicle.getID() << " LCA_AMBLOCKINGFOLLOWER\n"; //return min; // VARIANT_3 (brakeStrong) - return (min + wanted) / (SUMOReal) 2.0; + return (min + wanted) / (double) 2.0; } if ((state & LCA_AMBACKBLOCKER) != 0) { if (max <= myVehicle.getCarFollowModel().maxNextSpeed(myVehicle.getSpeed(), &myVehicle) && min == 0) { // !!! was standing @@ -355,7 +361,7 @@ if (gDebugFlag2) { std::cout << time << " veh=" << myVehicle.getID() << " LCA_AMBLOCKINGLEADER\n"; } - return (max + wanted) / (SUMOReal) 2.0; + return (max + wanted) / (double) 2.0; } if ((state & LCA_AMBLOCKINGFOLLOWER_DONTBRAKE) != 0) { @@ -367,7 +373,7 @@ if (max <= myVehicle.getCarFollowModel().maxNextSpeed(myVehicle.getSpeed(), &myVehicle) && min == 0) { // !!! was standing return wanted; } - return (min + wanted) / (SUMOReal) 2.0; + return (min + wanted) / (double) 2.0; */ } return wanted; @@ -396,21 +402,21 @@ void -MSLCM_SL2015::msg(const CLeaderDist& cld, SUMOReal speed, int state) { +MSLCM_SL2015::msg(const CLeaderDist& cld, double speed, int state) { assert(cld.first != 0); ((MSVehicle*)cld.first)->getLaneChangeModel().inform(new Info(speed, state), &myVehicle); } -SUMOReal +double MSLCM_SL2015::informLeader(int blocked, int dir, const CLeaderDist& neighLead, - SUMOReal remainingSeconds) { - SUMOReal plannedSpeed = MIN2(myVehicle.getSpeed(), - myVehicle.getCarFollowModel().stopSpeed(&myVehicle, myVehicle.getSpeed(), myLeftSpace - myLeadingBlockerLength)); - for (std::vector::const_iterator i = myVSafes.begin(); i != myVSafes.end(); ++i) { - SUMOReal v = (*i); + double remainingSeconds) { + double plannedSpeed = MIN2(myVehicle.getSpeed(), + myVehicle.getCarFollowModel().stopSpeed(&myVehicle, myVehicle.getSpeed(), myLeftSpace - myLeadingBlockerLength)); + for (std::vector::const_iterator i = myVSafes.begin(); i != myVSafes.end(); ++i) { + double v = (*i); if (v >= myVehicle.getSpeed() - ACCEL2SPEED(myVehicle.getCarFollowModel().getMaxDecel())) { plannedSpeed = MIN2(plannedSpeed, v); } @@ -425,14 +431,14 @@ if (gDebugFlag2) std::cout << " blocked by leader nv=" << nv->getID() << " nvSpeed=" << nv->getSpeed() << " needGap=" << myVehicle.getCarFollowModel().getSecureGap(myVehicle.getSpeed(), nv->getSpeed(), nv->getCarFollowModel().getMaxDecel()) << "\n"; // decide whether we want to overtake the leader or follow it - const SUMOReal dv = plannedSpeed - nv->getSpeed(); - const SUMOReal overtakeDist = (neighLead.second // drive to back of follower - + nv->getVehicleType().getLengthWithGap() // drive to front of follower - + myVehicle.getVehicleType().getLength() // ego back reaches follower front - + nv->getCarFollowModel().getSecureGap( // save gap to follower - nv->getSpeed(), myVehicle.getSpeed(), myVehicle.getCarFollowModel().getMaxDecel())); + const double dv = plannedSpeed - nv->getSpeed(); + const double overtakeDist = (neighLead.second // drive to back of follower + + nv->getVehicleType().getLengthWithGap() // drive to front of follower + + myVehicle.getVehicleType().getLength() // ego back reaches follower front + + nv->getCarFollowModel().getSecureGap( // save gap to follower + nv->getSpeed(), myVehicle.getSpeed(), myVehicle.getCarFollowModel().getMaxDecel())); - if (dv < 0 + if (dv < NUMERICAL_EPS // overtaking on the right on an uncongested highway is forbidden (noOvertakeLCLeft) || (dir == LCA_MLEFT && !myVehicle.congested() && !myAllowOvertakingRight) // not enough space to overtake? (we will start to brake when approaching a dead end) @@ -442,14 +448,14 @@ // cannot overtake msg(neighLead, -1, dir | LCA_AMBLOCKINGLEADER); // slow down smoothly to follow leader - const SUMOReal targetSpeed = myCarFollowModel.followSpeed( - &myVehicle, myVehicle.getSpeed(), neighLead.second, nv->getSpeed(), nv->getCarFollowModel().getMaxDecel()); + const double targetSpeed = myCarFollowModel.followSpeed( + &myVehicle, myVehicle.getSpeed(), neighLead.second, nv->getSpeed(), nv->getCarFollowModel().getMaxDecel()); if (targetSpeed < myVehicle.getSpeed()) { // slow down smoothly to follow leader - const SUMOReal decel = ACCEL2SPEED(MIN2(myVehicle.getCarFollowModel().getMaxDecel(), - MAX2(MIN_FALLBEHIND, (myVehicle.getSpeed() - targetSpeed) / remainingSeconds))); - //const SUMOReal nextSpeed = MAX2((SUMOReal)0, MIN2(plannedSpeed, myVehicle.getSpeed() - decel)); - const SUMOReal nextSpeed = MIN2(plannedSpeed, myVehicle.getSpeed() - decel); + const double decel = ACCEL2SPEED(MIN2(myVehicle.getCarFollowModel().getMaxDecel(), + MAX2(MIN_FALLBEHIND, (myVehicle.getSpeed() - targetSpeed) / remainingSeconds))); + //const double nextSpeed = MAX2(0., MIN2(plannedSpeed, myVehicle.getSpeed() - decel)); + const double nextSpeed = MIN2(plannedSpeed, myVehicle.getSpeed() - decel); if (gDebugFlag2) { std::cout << STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()) << " cannot overtake leader nv=" << nv->getID() @@ -483,6 +489,8 @@ << " currentGap=" << neighLead.second << " secureGap=" << nv->getCarFollowModel().getSecureGap(nv->getSpeed(), myVehicle.getSpeed(), myVehicle.getCarFollowModel().getMaxDecel()) << " overtakeDist=" << overtakeDist + << " leftSpace=" << myLeftSpace + << " blockerLength=" << myLeadingBlockerLength << "\n"; } // overtaking, leader should not accelerate @@ -492,10 +500,10 @@ } else if (neighLead.first != 0) { // (remainUnblocked) // we are not blocked now. make sure we stay far enough from the leader const MSVehicle* nv = neighLead.first; - const SUMOReal nextNVSpeed = nv->getSpeed() - HELP_OVERTAKE; // conservative - const SUMOReal dv = SPEED2DIST(myVehicle.getSpeed() - nextNVSpeed); - const SUMOReal targetSpeed = myCarFollowModel.followSpeed( - &myVehicle, myVehicle.getSpeed(), neighLead.second - dv, nextNVSpeed, nv->getCarFollowModel().getMaxDecel()); + const double nextNVSpeed = nv->getSpeed() - HELP_OVERTAKE; // conservative + const double dv = SPEED2DIST(myVehicle.getSpeed() - nextNVSpeed); + const double targetSpeed = myCarFollowModel.followSpeed( + &myVehicle, myVehicle.getSpeed(), neighLead.second - dv, nextNVSpeed, nv->getCarFollowModel().getMaxDecel()); myVSafes.push_back(targetSpeed); if (gDebugFlag2) { std::cout << " not blocked by leader nv=" << nv->getID() @@ -518,8 +526,8 @@ MSLCM_SL2015::informFollower(int blocked, int dir, const CLeaderDist& neighFollow, - SUMOReal remainingSeconds, - SUMOReal plannedSpeed) { + double remainingSeconds, + double plannedSpeed) { if ((blocked & LCA_BLOCKED_BY_FOLLOWER) != 0) { assert(neighFollow.first != 0); const MSVehicle* nv = neighFollow.first; @@ -528,7 +536,7 @@ // are we fast enough to cut in without any help? if (plannedSpeed - nv->getSpeed() >= HELP_OVERTAKE) { - const SUMOReal neededGap = nv->getCarFollowModel().getSecureGap(nv->getSpeed(), plannedSpeed, myVehicle.getCarFollowModel().getMaxDecel()); + const double neededGap = nv->getCarFollowModel().getSecureGap(nv->getSpeed(), plannedSpeed, myVehicle.getCarFollowModel().getMaxDecel()); if ((neededGap - neighFollow.second) / remainingSeconds < (plannedSpeed - nv->getSpeed())) { if (gDebugFlag2) { std::cout << " wants to cut in before nv=" << nv->getID() << " without any help neededGap=" << neededGap << "\n"; @@ -545,15 +553,15 @@ // maximum deceleration to help us (will probably be spread over // multiple seconds) // ----------- - const SUMOReal helpDecel = nv->getCarFollowModel().getMaxDecel() * HELP_DECEL_FACTOR ; + const double helpDecel = nv->getCarFollowModel().getMaxDecel() * HELP_DECEL_FACTOR ; // change in the gap between ego and blocker over 1 second (not STEP!) - const SUMOReal neighNewSpeed = MAX2((SUMOReal)0, nv->getSpeed() - ACCEL2SPEED(helpDecel)); - const SUMOReal neighNewSpeed1s = MAX2((SUMOReal)0, nv->getSpeed() - helpDecel); - const SUMOReal dv = plannedSpeed - neighNewSpeed1s; + const double neighNewSpeed = MAX2(0., nv->getSpeed() - ACCEL2SPEED(helpDecel)); + const double neighNewSpeed1s = MAX2(0., nv->getSpeed() - helpDecel); + const double dv = plannedSpeed - neighNewSpeed1s; // new gap between follower and self in case the follower does brake for 1s - const SUMOReal decelGap = neighFollow.second + dv; - const SUMOReal secureGap = nv->getCarFollowModel().getSecureGap(neighNewSpeed1s, plannedSpeed, myVehicle.getCarFollowModel().getMaxDecel()); + const double decelGap = neighFollow.second + dv; + const double secureGap = nv->getCarFollowModel().getSecureGap(neighNewSpeed1s, plannedSpeed, myVehicle.getCarFollowModel().getMaxDecel()); if (gDebugFlag2) { std::cout << STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()) << " egoV=" << myVehicle.getSpeed() @@ -571,10 +579,10 @@ // to be safe in the next step the following equation has to hold: // vsafe <= followSpeed(gap=currentGap - SPEED2DIST(vsafe), ...) // we compute an upper bound on vsafe by doing the computation twice - const SUMOReal vsafe1 = MAX2(neighNewSpeed, nv->getCarFollowModel().followSpeed( - nv, nv->getSpeed(), neighFollow.second + SPEED2DIST(plannedSpeed), plannedSpeed, myVehicle.getCarFollowModel().getMaxDecel())); - const SUMOReal vsafe = MAX2(neighNewSpeed, nv->getCarFollowModel().followSpeed( - nv, nv->getSpeed(), neighFollow.second + SPEED2DIST(plannedSpeed - vsafe1), plannedSpeed, myVehicle.getCarFollowModel().getMaxDecel())); + const double vsafe1 = MAX2(neighNewSpeed, nv->getCarFollowModel().followSpeed( + nv, nv->getSpeed(), neighFollow.second + SPEED2DIST(plannedSpeed), plannedSpeed, myVehicle.getCarFollowModel().getMaxDecel())); + const double vsafe = MAX2(neighNewSpeed, nv->getCarFollowModel().followSpeed( + nv, nv->getSpeed(), neighFollow.second + SPEED2DIST(plannedSpeed - vsafe1), plannedSpeed, myVehicle.getCarFollowModel().getMaxDecel())); // the following assertion cannot be guaranteed because the CFModel handles small gaps differently, see MSCFModel::maximumSafeStopSpeed // assert(vsafe <= vsafe1); msg(neighFollow, vsafe, dir | LCA_AMBLOCKINGFOLLOWER); @@ -592,13 +600,13 @@ std::cout << " wants to cut in before nv=" << nv->getID() << " (eventually)\n"; } } else if (dir == LCA_MRIGHT && !myAllowOvertakingRight && !nv->congested()) { - const SUMOReal vhelp = MAX2(neighNewSpeed, HELP_OVERTAKE); + const double vhelp = MAX2(neighNewSpeed, HELP_OVERTAKE); msg(neighFollow, vhelp, dir | LCA_AMBLOCKINGFOLLOWER); if (gDebugFlag2) { std::cout << " wants to cut in before nv=" << nv->getID() << " (nv cannot overtake right)\n"; } } else { - SUMOReal vhelp = MAX2(nv->getSpeed(), myVehicle.getSpeed() + HELP_OVERTAKE); + double vhelp = MAX2(nv->getSpeed(), myVehicle.getSpeed() + HELP_OVERTAKE); if (nv->getSpeed() > myVehicle.getSpeed() && ((dir == LCA_MRIGHT && myVehicle.getWaitingSeconds() > LCA_RIGHT_IMPATIENCE) || (dir == LCA_MLEFT && plannedSpeed > CUT_IN_LEFT_SPEED_THRESHOLD) // VARIANT_22 (slowDownLeft) @@ -621,13 +629,13 @@ } msg(neighFollow, vhelp, dir | LCA_AMBLOCKINGFOLLOWER); // this follower is supposed to overtake us. slow down smoothly to allow this - const SUMOReal overtakeDist = (neighFollow.second // follower reaches ego back - + myVehicle.getVehicleType().getLengthWithGap() // follower reaches ego front - + nv->getVehicleType().getLength() // follower back at ego front - + myVehicle.getCarFollowModel().getSecureGap( // follower has safe dist to ego - plannedSpeed, vhelp, nv->getCarFollowModel().getMaxDecel())); + const double overtakeDist = (neighFollow.second // follower reaches ego back + + myVehicle.getVehicleType().getLengthWithGap() // follower reaches ego front + + nv->getVehicleType().getLength() // follower back at ego front + + myVehicle.getCarFollowModel().getSecureGap( // follower has safe dist to ego + plannedSpeed, vhelp, nv->getCarFollowModel().getMaxDecel())); // speed difference to create a sufficiently large gap - const SUMOReal needDV = overtakeDist / remainingSeconds; + const double needDV = overtakeDist / remainingSeconds; // make sure the deceleration is not to strong myVSafes.push_back(MAX2(vhelp - needDV, myVehicle.getSpeed() - ACCEL2SPEED(myVehicle.getCarFollowModel().getMaxDecel()))); @@ -646,10 +654,10 @@ } else if (neighFollow.first != 0) { // we are not blocked no, make sure it remains that way const MSVehicle* nv = neighFollow.first; - const SUMOReal vsafe1 = nv->getCarFollowModel().followSpeed( - nv, nv->getSpeed(), neighFollow.second + SPEED2DIST(plannedSpeed), plannedSpeed, myVehicle.getCarFollowModel().getMaxDecel()); - const SUMOReal vsafe = nv->getCarFollowModel().followSpeed( - nv, nv->getSpeed(), neighFollow.second + SPEED2DIST(plannedSpeed - vsafe1), plannedSpeed, myVehicle.getCarFollowModel().getMaxDecel()); + const double vsafe1 = nv->getCarFollowModel().followSpeed( + nv, nv->getSpeed(), neighFollow.second + SPEED2DIST(plannedSpeed), plannedSpeed, myVehicle.getCarFollowModel().getMaxDecel()); + const double vsafe = nv->getCarFollowModel().followSpeed( + nv, nv->getSpeed(), neighFollow.second + SPEED2DIST(plannedSpeed - vsafe1), plannedSpeed, myVehicle.getCarFollowModel().getMaxDecel()); msg(neighFollow, vsafe, dir | LCA_AMBLOCKINGFOLLOWER); if (gDebugFlag2) { std::cout << " wants to cut in before non-blocking follower nv=" << nv->getID() << "\n"; @@ -657,11 +665,11 @@ } } -SUMOReal +double MSLCM_SL2015::informLeaders(int blocked, int dir, const std::vector& blockers, - SUMOReal remainingSeconds) { - SUMOReal plannedSpeed = myVehicle.getSpeed(); + double remainingSeconds) { + double plannedSpeed = myVehicle.getSpeed(); for (std::vector::const_iterator it = blockers.begin(); it != blockers.end(); ++it) { plannedSpeed = MIN2(plannedSpeed, informLeader(blocked, dir, *it, remainingSeconds)); } @@ -672,8 +680,8 @@ void MSLCM_SL2015::informFollowers(int blocked, int dir, const std::vector& blockers, - SUMOReal remainingSeconds, - SUMOReal plannedSpeed) { + double remainingSeconds, + double plannedSpeed) { for (std::vector::const_iterator it = blockers.begin(); it != blockers.end(); ++it) { informFollower(blocked, dir, *it, remainingSeconds, plannedSpeed); } @@ -682,8 +690,11 @@ void MSLCM_SL2015::prepareStep() { + MSAbstractLaneChangeModel::prepareStep(); // keep information about strategic change direction myOwnState = (myOwnState & LCA_STRATEGIC) ? (myOwnState & LCA_WANTS_LANECHANGE) : 0; + myLastLateralGapRight = NO_LATERAL_NEIGHBOR; + myLastLateralGapLeft = NO_LATERAL_NEIGHBOR; if (myCanChangeFully) { myOrigLatDist = 0; } @@ -697,7 +708,7 @@ myKeepRightProbability = ceil(myKeepRightProbability * 100000.0) * 0.00001; // updated myExpectedSublaneSpeeds // XXX only do this when (sub)lane changing is possible - std::vector newExpectedSpeeds; + std::vector newExpectedSpeeds; //std::cout << SIMTIME << " veh=" << myVehicle.getID() << " myExpectedSublaneSpeeds=" << toString(myExpectedSublaneSpeeds) << "\n"; if (myExpectedSublaneSpeeds.size() != myVehicle.getLane()->getEdge().getSubLaneSides().size()) { // initialize @@ -804,14 +815,14 @@ const std::vector& preb, MSVehicle** lastBlocked, MSVehicle** firstBlocked, - SUMOReal& latDist, int& blocked) { + double& latDist, int& blocked) { const SUMOTime currentTime = MSNet::getInstance()->getCurrentTimeStep(); // compute bestLaneOffset MSVehicle::LaneQ curr, neigh; int bestLaneOffset = 0; - SUMOReal currentDist = 0; - SUMOReal neighDist = 0; + double currentDist = 0; + double neighDist = 0; int currIdx = 0; MSLane* prebLane = myVehicle.getLane(); if (prebLane->getEdge().getPurpose() == MSEdge::EDGEFUNCTION_INTERNAL) { @@ -854,12 +865,12 @@ // compute the distance when changing to the neighboring lane // (ensure we do not lap into the line behind neighLane since there might be unseen blockers) - const SUMOReal halfCurrentLaneWidth = 0.5 * myVehicle.getLane()->getWidth(); - const SUMOReal halfVehWidth = 0.5 * myVehicle.getVehicleType().getWidth(); - const SUMOReal latPos = myVehicle.getLateralPositionOnLane(); - SUMOReal leftLimit = halfCurrentLaneWidth - halfVehWidth - latPos; - SUMOReal rightLimit = -halfCurrentLaneWidth + halfVehWidth - latPos; - SUMOReal latLaneDist = 0; // minimum distance to move the vehicle fully onto the new lane + const double halfCurrentLaneWidth = 0.5 * myVehicle.getLane()->getWidth(); + const double halfVehWidth = 0.5 * myVehicle.getVehicleType().getWidth(); + const double latPos = myVehicle.getLateralPositionOnLane(); + double leftLimit = halfCurrentLaneWidth - halfVehWidth - latPos; + double rightLimit = -halfCurrentLaneWidth + halfVehWidth - latPos; + double latLaneDist = 0; // minimum distance to move the vehicle fully onto the new lane if (laneOffset == -1) { latLaneDist = rightLimit - myVehicle.getVehicleType().getWidth(); rightLimit -= neighLane.getWidth(); @@ -931,11 +942,11 @@ } //myLookAheadSpeed = myVehicle.getLane()->getVehicleMaxSpeed(&myVehicle); - //SUMOReal laDist = laSpeed > LOOK_FORWARD_SPEED_DIVIDER + //double laDist = laSpeed > LOOK_FORWARD_SPEED_DIVIDER // ? laSpeed * LOOK_FORWARD_FAR // : laSpeed * LOOK_FORWARD_NEAR; - SUMOReal laDist = myLookAheadSpeed * (right ? LOOK_FORWARD_RIGHT : LOOK_FORWARD_LEFT) * myStrategicParam; - laDist += myVehicle.getVehicleType().getLengthWithGap() * (SUMOReal) 2.; + double laDist = myLookAheadSpeed * (right ? LOOK_FORWARD_RIGHT : LOOK_FORWARD_LEFT) * myStrategicParam; + laDist += myVehicle.getVehicleType().getLengthWithGap() * (double) 2.; // react to a stopped leader on the current lane if (bestLaneOffset == 0 && leaders.hasStoppedVehicle()) { @@ -946,7 +957,7 @@ } // free space that is available for changing - //const SUMOReal neighSpeed = (neighLead.first != 0 ? neighLead.first->getSpeed() : + //const double neighSpeed = (neighLead.first != 0 ? neighLead.first->getSpeed() : // neighFollow.first != 0 ? neighFollow.first->getSpeed() : // best.lane->getSpeedLimit()); // @note: while this lets vehicles change earlier into the correct direction @@ -994,10 +1005,12 @@ currentDist, neighDist, laDist, - roundaboutEdgesAhead); + roundaboutEdgesAhead, + latLaneDist, + latDist); } - if ((ret & LCA_STAY) != 0) { + if ((ret & LCA_STAY) != 0 && latDist == 0) { return ret; } if ((ret & LCA_URGENT) != 0) { @@ -1006,10 +1019,10 @@ myLeftSpace = currentDist - myVehicle.getPositionOnLane(); if (changeToBest && abs(bestLaneOffset) > 1) { // there might be a vehicle which needs to counter-lane-change one lane further and we cannot see it yet + myLeadingBlockerLength = MAX2((double)(right ? 20.0 : 40.0), myLeadingBlockerLength); if (gDebugFlag2) { - std::cout << " reserving space for unseen blockers\n"; + std::cout << " reserving space for unseen blockers myLeadingBlockerLength=" << myLeadingBlockerLength << "\n"; } - myLeadingBlockerLength = MAX2((SUMOReal)(right ? 20.0 : 40.0), myLeadingBlockerLength); } // letting vehicles merge in at the end of the lane in case of counter-lane change, step#1 @@ -1019,7 +1032,6 @@ if (*firstBlocked != neighLeadLongest) { saveBlockerLength(*firstBlocked, lcaCounter); } - latDist = latLaneDist; std::vector collectLeadBlockers; std::vector collectFollowBlockers; @@ -1027,10 +1039,11 @@ leaders, followers, blockers, neighLeaders, neighFollowers, neighBlockers, &collectLeadBlockers, &collectFollowBlockers); - const SUMOReal remainingSeconds = ((ret & LCA_TRACI) == 0 ? - MAX2((SUMOReal)STEPS2TIME(TS), myLeftSpace / MAX2(myLookAheadSpeed, NUMERICAL_EPS) / abs(bestLaneOffset) / URGENCY) : - myVehicle.getInfluencer().changeRequestRemainingSeconds(currentTime)); - const SUMOReal plannedSpeed = informLeaders(blocked, myLca, collectLeadBlockers, remainingSeconds); + const double absLaneOffset = fabs(bestLaneOffset != 0 ? bestLaneOffset : latDist / SUMO_const_laneWidth); + const double remainingSeconds = ((ret & LCA_TRACI) == 0 ? + MAX2(STEPS2TIME(TS), myLeftSpace / MAX2(myLookAheadSpeed, NUMERICAL_EPS) / absLaneOffset / URGENCY) : + myVehicle.getInfluencer().changeRequestRemainingSeconds(currentTime)); + const double plannedSpeed = informLeaders(blocked, myLca, collectLeadBlockers, remainingSeconds); // coordinate with direct obstructions if (plannedSpeed >= 0) { // maybe we need to deal with a blocking follower @@ -1077,9 +1090,9 @@ // << " currentDist=" << currentDist // << "\n"; //} - const SUMOReal inconvenience = (latLaneDist < 0 - ? -mySpeedGainProbabilityRight / myChangeProbThresholdRight - : -mySpeedGainProbabilityLeft / myChangeProbThresholdLeft); + const double inconvenience = (latLaneDist < 0 + ? -mySpeedGainProbabilityRight / myChangeProbThresholdRight + : -mySpeedGainProbabilityLeft / myChangeProbThresholdLeft); if (laneOffset != 0 && amBlockingFollowerPlusNB() && (inconvenience < myCooperativeParam) @@ -1123,13 +1136,13 @@ // iterate over all possible combinations of sublanes this vehicle might cover and check the potential speed const MSEdge& edge = myVehicle.getLane()->getEdge(); - const std::vector& sublaneSides = edge.getSubLaneSides(); + const std::vector& sublaneSides = edge.getSubLaneSides(); assert(sublaneSides.size() == myExpectedSublaneSpeeds.size()); - const SUMOReal vehWidth = myVehicle.getVehicleType().getWidth(); - const SUMOReal rightVehSide = myVehicle.getRightSideOnEdge(); - const SUMOReal leftVehSide = rightVehSide + vehWidth; + const double vehWidth = myVehicle.getVehicleType().getWidth(); + const double rightVehSide = myVehicle.getRightSideOnEdge(); + const double leftVehSide = rightVehSide + vehWidth; // figure out next speed when staying where we are - SUMOReal defaultNextSpeed = std::numeric_limits::max(); + double defaultNextSpeed = std::numeric_limits::max(); /// determine the leftmost and rightmost sublanes currently occupied int leftmostOnEdge = (int)sublaneSides.size() - 1; while (leftmostOnEdge > 0 && sublaneSides[leftmostOnEdge] > leftVehSide) { @@ -1153,15 +1166,15 @@ if (gDebugFlag2) { std::cout << " sublaneSides[rightmostOnEdge]=" << sublaneSides[rightmostOnEdge] << " rightVehSide=" << rightVehSide << "\n"; } - SUMOReal maxGain = -std::numeric_limits::max(); - SUMOReal maxGainRight = -std::numeric_limits::max(); - SUMOReal maxGainLeft = -std::numeric_limits::max(); - SUMOReal latDistNice = std::numeric_limits::max(); + double maxGain = -std::numeric_limits::max(); + double maxGainRight = -std::numeric_limits::max(); + double maxGainLeft = -std::numeric_limits::max(); + double latDistNice = std::numeric_limits::max(); const int iMin = MIN2(myVehicle.getLane()->getRightmostSublane(), neighLane.getRightmostSublane()); - const SUMOReal leftMax = MAX2( - myVehicle.getLane()->getRightSideOnEdge() + myVehicle.getLane()->getWidth(), - neighLane.getRightSideOnEdge() + neighLane.getWidth()); + const double leftMax = MAX2( + myVehicle.getLane()->getRightSideOnEdge() + myVehicle.getLane()->getWidth(), + neighLane.getRightSideOnEdge() + neighLane.getWidth()); assert(leftMax <= edge.getWidth()); int sublaneCompact = MAX2(iMin, rightmostOnEdge - 1); // try to compactify to the right by default @@ -1176,7 +1189,7 @@ if (sublaneSides[i] + vehWidth < leftMax) { // i is the rightmost sublane and the left side of vehicles still fits on the edge, // compute min speed of all sublanes covered by the vehicle in this case - SUMOReal vMin = myExpectedSublaneSpeeds[i]; + double vMin = myExpectedSublaneSpeeds[i]; //std::cout << " i=" << i << "\n"; int j = i; while (vMin > 0 && j < (int)sublaneSides.size() && sublaneSides[j] < sublaneSides[i] + vehWidth) { @@ -1184,7 +1197,7 @@ //std::cout << " j=" << j << " vMin=" << vMin << " sublaneSides[j]=" << sublaneSides[j] << " leftVehSide=" << leftVehSide << " rightVehSide=" << rightVehSide << "\n"; ++j; } - const SUMOReal relativeGain = (vMin - defaultNextSpeed) / MAX2(vMin, RELGAIN_NORMALIZATION_MIN_SPEED); + const double relativeGain = (vMin - defaultNextSpeed) / MAX2(vMin, RELGAIN_NORMALIZATION_MIN_SPEED); // @note this is biased for changing to the left since we compare the sublanes in ascending order if (relativeGain > GAIN_PERCEPTION_THRESHOLD && relativeGain > maxGain) { maxGain = relativeGain; @@ -1199,12 +1212,12 @@ if (gDebugFlag2) { std::cout << " i=" << i << " rightmostOnEdge=" << rightmostOnEdge << " vMin=" << vMin << " relGain=" << relativeGain << " sublaneCompact=" << sublaneCompact << "\n"; } - if (i < rightmostOnEdge) { + if (latDist < 0) { maxGainRight = MAX2(maxGainRight, relativeGain); - } else if (i > rightmostOnEdge) { + } else if (latDist > 0) { maxGainLeft = MAX2(maxGainLeft, relativeGain); } - const SUMOReal subAlignDist = sublaneSides[i] - rightVehSide; + const double subAlignDist = sublaneSides[i] - rightVehSide; if (fabs(subAlignDist) < fabs(latDistNice)) { latDistNice = subAlignDist; if (gDebugFlag2) std::cout @@ -1217,10 +1230,10 @@ } } // updated change probabilities - if (maxGainRight != -std::numeric_limits::max()) { + if (maxGainRight != -std::numeric_limits::max()) { mySpeedGainProbabilityRight += TS * maxGainRight; } - if (maxGainLeft != -std::numeric_limits::max()) { + if (maxGainLeft != -std::numeric_limits::max()) { mySpeedGainProbabilityLeft += TS * maxGainLeft; } // decay @@ -1248,21 +1261,21 @@ if (right && maxGain >= 0 && latDist <= 0) { // honor the obligation to keep right (Rechtsfahrgebot) // XXX consider fast approaching followers on the current lane - //const SUMOReal vMax = myLookAheadSpeed; - const SUMOReal vMax = myVehicle.getLane()->getVehicleMaxSpeed(&myVehicle); - const SUMOReal acceptanceTime = KEEP_RIGHT_ACCEPTANCE * vMax * MAX2((SUMOReal)1, myVehicle.getSpeed()) / myVehicle.getLane()->getSpeedLimit(); - SUMOReal fullSpeedGap = MAX2((SUMOReal)0, neighDist - myVehicle.getCarFollowModel().brakeGap(vMax)); - SUMOReal fullSpeedDrivingSeconds = MIN2(acceptanceTime, fullSpeedGap / vMax); + //const double vMax = myLookAheadSpeed; + const double vMax = myVehicle.getLane()->getVehicleMaxSpeed(&myVehicle); + const double acceptanceTime = KEEP_RIGHT_ACCEPTANCE * vMax * MAX2(1., myVehicle.getSpeed()) / myVehicle.getLane()->getSpeedLimit(); + double fullSpeedGap = MAX2(0., neighDist - myVehicle.getCarFollowModel().brakeGap(vMax)); + double fullSpeedDrivingSeconds = MIN2(acceptanceTime, fullSpeedGap / vMax); CLeaderDist neighLead = getSlowest(neighLeaders); if (neighLead.first != 0 && neighLead.first->getSpeed() < vMax) { - fullSpeedGap = MAX2((SUMOReal)0, MIN2(fullSpeedGap, - neighLead.second - myVehicle.getCarFollowModel().getSecureGap( - vMax, neighLead.first->getSpeed(), neighLead.first->getCarFollowModel().getMaxDecel()))); + fullSpeedGap = MAX2(0., MIN2(fullSpeedGap, + neighLead.second - myVehicle.getCarFollowModel().getSecureGap( + vMax, neighLead.first->getSpeed(), neighLead.first->getCarFollowModel().getMaxDecel()))); fullSpeedDrivingSeconds = MIN2(fullSpeedDrivingSeconds, fullSpeedGap / (vMax - neighLead.first->getSpeed())); } - const SUMOReal deltaProb = (myChangeProbThresholdRight - * STEPS2TIME(DELTA_T) - * (fullSpeedDrivingSeconds / acceptanceTime) / KEEP_RIGHT_TIME); + const double deltaProb = (myChangeProbThresholdRight + * STEPS2TIME(DELTA_T) + * (fullSpeedDrivingSeconds / acceptanceTime) / KEEP_RIGHT_TIME); myKeepRightProbability += TS * deltaProb; if (gDebugFlag2) { @@ -1303,7 +1316,7 @@ } if (latDist < 0 && mySpeedGainProbabilityRight >= MAX2(myChangeProbThresholdRight, mySpeedGainProbabilityLeft) - && neighDist / MAX2((SUMOReal) .1, myVehicle.getSpeed()) > 20.) { + && neighDist / MAX2(.1, myVehicle.getSpeed()) > 20.) { ret |= LCA_SPEEDGAIN; if (!cancelRequest(ret)) { blocked = checkBlocking(neighLane, latDist, laneOffset, @@ -1327,7 +1340,7 @@ if (latDist > 0 && mySpeedGainProbabilityLeft > myChangeProbThresholdLeft && // if we leave our lane, we should be able to stay in the new // lane for some time - (stayInLane || neighDist / MAX2((SUMOReal) .1, myVehicle.getSpeed()) > SPEED_GAIN_MIN_SECONDS)) { + (stayInLane || neighDist / MAX2(.1, myVehicle.getSpeed()) > SPEED_GAIN_MIN_SECONDS)) { ret |= LCA_SPEEDGAIN; if (!cancelRequest(ret)) { blocked = checkBlocking(neighLane, latDist, laneOffset, @@ -1338,10 +1351,11 @@ } } - // factor in preferred lateral alignment (unless we are in the middle of an unfinished non-alignment maneuver) - if (fabs(latDist) <= NUMERICAL_EPS && (myCanChangeFully || (myPreviousState | LCA_SUBLANE) != 0)) { - const SUMOReal halfLaneWidth = myVehicle.getLane()->getWidth() * 0.5; - const SUMOReal halfVehWidth = myVehicle.getVehicleType().getWidth() * 0.5; + // only factor in preferred lateral alignment if there is no speedGain motivation + if (fabs(latDist) <= NUMERICAL_EPS) { + double latDistSublane = 0.; + const double halfLaneWidth = myVehicle.getLane()->getWidth() * 0.5; + const double halfVehWidth = myVehicle.getVehicleType().getWidth() * 0.5; if (myVehicle.getParameter().arrivalPosLatProcedure != ARRIVAL_POSLAT_DEFAULT && myVehicle.getRoute().getLastEdge() == &myVehicle.getLane()->getEdge() && bestLaneOffset == 0 @@ -1350,16 +1364,16 @@ // its arrival position. Change to the desired lateral position switch (myVehicle.getParameter().arrivalPosLatProcedure) { case ARRIVAL_POSLAT_GIVEN: - latDist = myVehicle.getParameter().arrivalPosLat - myVehicle.getLateralPositionOnLane(); + latDistSublane = myVehicle.getParameter().arrivalPosLat - myVehicle.getLateralPositionOnLane(); break; case ARRIVAL_POSLAT_RIGHT: - latDist = -halfLaneWidth + halfVehWidth - myVehicle.getLateralPositionOnLane(); + latDistSublane = -halfLaneWidth + halfVehWidth - myVehicle.getLateralPositionOnLane(); break; case ARRIVAL_POSLAT_CENTER: - latDist = -myVehicle.getLateralPositionOnLane(); + latDistSublane = -myVehicle.getLateralPositionOnLane(); break; case ARRIVAL_POSLAT_LEFT: - latDist = halfLaneWidth - halfVehWidth - myVehicle.getLateralPositionOnLane(); + latDistSublane = halfLaneWidth - halfVehWidth - myVehicle.getLateralPositionOnLane(); break; default: assert(false); @@ -1371,21 +1385,22 @@ } else { switch (myVehicle.getVehicleType().getPreferredLateralAlignment()) { case LATALIGN_RIGHT: - latDist = -halfLaneWidth + halfVehWidth - myVehicle.getLateralPositionOnLane(); + latDistSublane = -halfLaneWidth + halfVehWidth - myVehicle.getLateralPositionOnLane(); break; case LATALIGN_LEFT: - latDist = halfLaneWidth - halfVehWidth - myVehicle.getLateralPositionOnLane(); + latDistSublane = halfLaneWidth - halfVehWidth - myVehicle.getLateralPositionOnLane(); break; case LATALIGN_CENTER: - latDist = -myVehicle.getLateralPositionOnLane(); + latDistSublane = -myVehicle.getLateralPositionOnLane(); break; case LATALIGN_NICE: - latDist = latDistNice; + latDistSublane = latDistNice; break; case LATALIGN_COMPACT: - latDist = sublaneSides[sublaneCompact] - rightVehSide; + latDistSublane = sublaneSides[sublaneCompact] - rightVehSide; break; case LATALIGN_ARBITRARY: + latDistSublane = 0; break; } } @@ -1394,14 +1409,22 @@ << " mySpeedGainR=" << mySpeedGainProbabilityRight << " mySpeedGainL=" << mySpeedGainProbabilityLeft << " latDist=" << latDist + << " latDistSublane=" << latDistSublane << " myCanChangeFully=" << myCanChangeFully << " prevState=" << toString((LaneChangeAction)myPreviousState) << "\n"; - if ((latDist < 0 && mySpeedGainProbabilityRight < mySpeedLossProbThreshold) - || (latDist > 0 && mySpeedGainProbabilityLeft < mySpeedLossProbThreshold)) { + + if ((latDistSublane < 0 && mySpeedGainProbabilityRight < mySpeedLossProbThreshold) + || (latDistSublane > 0 && mySpeedGainProbabilityLeft < mySpeedLossProbThreshold)) { // do not risk losing speed - latDist = 0; + latDistSublane = 0; + } + // Ignore preferred lateral alignment if we are in the middle of an unfinished non-alignment maneuver into the opposite direction + if (!myCanChangeFully && (myPreviousState & LCA_SUBLANE) == 0 + && ((myOrigLatDist < 0 && latDistSublane > 0) || (myOrigLatDist > 0 && latDistSublane < 0))) { + latDistSublane = 0; } + latDist = latDistSublane; // XXX first compute preferred adaptation and then override with speed // (this way adaptation is still done if changing for speedgain is // blocked) @@ -1428,8 +1451,8 @@ /* if (changeToBest && bestLaneOffset == curr.bestLaneOffset && laneOffset != 0 && (right - ? mySpeedGainProbabilityRight > MAX2((SUMOReal)0, mySpeedGainProbabilityLeft) - : mySpeedGainProbabilityLeft > MAX2((SUMOReal)0, mySpeedGainProbabilityRight))) { + ? mySpeedGainProbabilityRight > MAX2(0., mySpeedGainProbabilityLeft) + : mySpeedGainProbabilityLeft > MAX2(0., mySpeedGainProbabilityRight))) { // change towards the correct lane, speedwise it does not hurt ret |= LCA_STRATEGIC; if (!cancelRequest(ret)) { @@ -1457,7 +1480,7 @@ MSLCM_SL2015::slowDownForBlocked(MSVehicle** blocked, int state) { // if this vehicle is blocking someone in front, we maybe decelerate to let him in if ((*blocked) != 0) { - SUMOReal gap = (*blocked)->getPositionOnLane() - (*blocked)->getVehicleType().getLength() - myVehicle.getPositionOnLane() - myVehicle.getVehicleType().getMinGap(); + double gap = (*blocked)->getPositionOnLane() - (*blocked)->getVehicleType().getLength() - myVehicle.getPositionOnLane() - myVehicle.getVehicleType().getMinGap(); if (gDebugFlag2) { std::cout << STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()) << " veh=" << myVehicle.getID() @@ -1479,7 +1502,7 @@ } myVSafes.push_back(myCarFollowModel.followSpeed( &myVehicle, myVehicle.getSpeed(), - (SUMOReal)(gap - POSITION_EPS), (*blocked)->getSpeed(), + (double)(gap - POSITION_EPS), (*blocked)->getSpeed(), (*blocked)->getCarFollowModel().getMaxDecel())); //(*blocked) = 0; // VARIANT_14 (furtherBlock) } @@ -1500,8 +1523,8 @@ } if (blocker != 0 && (blocker->getLaneChangeModel().getOwnState() & lcaCounter) != 0) { // is there enough space in front of us for the blocker? - const SUMOReal potential = myLeftSpace - myVehicle.getCarFollowModel().brakeGap( - myVehicle.getSpeed(), myVehicle.getCarFollowModel().getMaxDecel(), 0); + const double potential = myLeftSpace - myVehicle.getCarFollowModel().brakeGap( + myVehicle.getSpeed(), myVehicle.getCarFollowModel().getMaxDecel(), 0); if (blocker->getVehicleType().getLengthWithGap() <= potential) { // save at least his length in myLeadingBlockerLength myLeadingBlockerLength = MAX2(blocker->getVehicleType().getLengthWithGap(), myLeadingBlockerLength); @@ -1534,7 +1557,7 @@ const std::vector& lanes = myVehicle.getLane()->getEdge().getLanes(); const std::vector& preb = myVehicle.getBestLanes(); const MSLane* lane = lanes[laneIndex]; - const SUMOReal vMax = lane->getVehicleMaxSpeed(&myVehicle); + const double vMax = lane->getVehicleMaxSpeed(&myVehicle); assert(preb.size() == lanes.size()); for (int sublane = 0; sublane < (int)ahead.numSublanes(); ++sublane) { @@ -1543,16 +1566,16 @@ // lane allowed, find potential leaders and compute safe speeds // XXX anticipate future braking if leader has a lower speed than myVehicle const MSVehicle* leader = ahead[sublane]; - SUMOReal vSafe; + double vSafe; if (leader == 0) { vSafe = MIN2(vMax, myCarFollowModel.followSpeed(&myVehicle, vMax, preb[laneIndex].length, 0, 0)); } else { - const SUMOReal gap = leader->getBackPositionOnLane(lane) - myVehicle.getPositionOnLane() - myVehicle.getVehicleType().getMinGap(); + const double gap = leader->getBackPositionOnLane(lane) - myVehicle.getPositionOnLane() - myVehicle.getVehicleType().getMinGap(); vSafe = MIN2(vMax, myCarFollowModel.followSpeed( &myVehicle, vMax, gap, leader->getSpeed(), leader->getCarFollowModel().getMaxDecel())); } // XXX calibrate weightFactor? - const SUMOReal memoryFactor = 0.5; + const double memoryFactor = 0.5; myExpectedSublaneSpeeds[edgeSublane] = memoryFactor * myExpectedSublaneSpeeds[edgeSublane] + (1 - memoryFactor) * vSafe; } else { // lane forbidden @@ -1566,10 +1589,10 @@ CLeaderDist MSLCM_SL2015::getLongest(const MSLeaderDistanceInfo& ldi) { int iMax = 0; - SUMOReal maxLength = -1; + double maxLength = -1; for (int i = 0; i < ldi.numSublanes(); ++i) { if (ldi[i].first != 0) { - const SUMOReal length = ldi[i].first->getVehicleType().getLength(); + const double length = ldi[i].first->getVehicleType().getLength(); if (length > maxLength) { maxLength = length; iMax = i; @@ -1583,10 +1606,10 @@ CLeaderDist MSLCM_SL2015::getSlowest(const MSLeaderDistanceInfo& ldi) { int iMax = 0; - SUMOReal minSpeed = std::numeric_limits::max(); + double minSpeed = std::numeric_limits::max(); for (int i = 0; i < ldi.numSublanes(); ++i) { if (ldi[i].first != 0) { - const SUMOReal speed = ldi[i].first->getSpeed(); + const double speed = ldi[i].first->getSpeed(); if (speed < minSpeed) { minSpeed = speed; iMax = i; @@ -1598,7 +1621,7 @@ int -MSLCM_SL2015::checkBlocking(const MSLane& neighLane, SUMOReal& latDist, int laneOffset, +MSLCM_SL2015::checkBlocking(const MSLane& neighLane, double& latDist, int laneOffset, const MSLeaderDistanceInfo& leaders, const MSLeaderDistanceInfo& followers, const MSLeaderDistanceInfo& /*blockers */, @@ -1612,14 +1635,14 @@ if (!keepLatGapManeuver) { myOrigLatDist = latDist; } - const SUMOReal maxDist = SPEED2DIST(myVehicle.getVehicleType().getMaxSpeedLat()); + const double maxDist = SPEED2DIST(myVehicle.getVehicleType().getMaxSpeedLat()); latDist = MAX2(MIN2(latDist, maxDist), -maxDist); - // reduce latDist to avoid blockage with overlapping vehicles - const SUMOReal halfWidth = myVehicle.getVehicleType().getWidth() * 0.5; - const SUMOReal center = myVehicle.getCenterOnEdge(); - SUMOReal surplusGapRight = MIN2(maxDist, center - halfWidth); - SUMOReal surplusGapLeft = MIN2(maxDist, myVehicle.getLane()->getEdge().getWidth() - center - halfWidth); + // reduce latDist to avoid blockage with overlapping vehicles (no minGapLat constraints) + const double halfWidth = myVehicle.getVehicleType().getWidth() * 0.5; + const double center = myVehicle.getCenterOnEdge(); + double surplusGapRight = MIN2(maxDist, center - halfWidth); + double surplusGapLeft = MIN2(maxDist, myVehicle.getLane()->getEdge().getWidth() - center - halfWidth); updateGaps(leaders, myVehicle.getLane()->getRightSideOnEdge(), center, 0, surplusGapRight, surplusGapLeft); updateGaps(followers, myVehicle.getLane()->getRightSideOnEdge(), center, 0, surplusGapRight, surplusGapLeft); if (laneOffset != 0) { @@ -1630,13 +1653,13 @@ std::cout << " checkBlocking latDist=" << latDist << " surplusGapRight=" << surplusGapRight << " surplusGapLeft=" << surplusGapLeft << "\n"; } if (latDist < 0) { - if (surplusGapRight <= 0) { + if (surplusGapRight <= NUMERICAL_EPS) { return LCA_BLOCKED_RIGHT | LCA_OVERLAPPING; } else { latDist = MAX2(latDist, -surplusGapRight); } } else { - if (surplusGapLeft <= 0) { + if (surplusGapLeft <= NUMERICAL_EPS) { return LCA_BLOCKED_LEFT | LCA_OVERLAPPING; } else { latDist = MIN2(latDist, surplusGapLeft); @@ -1699,45 +1722,56 @@ int MSLCM_SL2015::checkBlockingVehicles( const MSVehicle* ego, const MSLeaderDistanceInfo& vehicles, - SUMOReal latDist, SUMOReal foeOffset, bool leaders, LaneChangeAction blockType, + double latDist, double foeOffset, bool leaders, LaneChangeAction blockType, std::vector* collectBlockers) const { // determine borders where safety/no-overlap conditions must hold - const SUMOReal vehWidth = ego->getVehicleType().getWidth(); - const SUMOReal rightVehSide = ego->getRightSideOnEdge(); - const SUMOReal leftVehSide = rightVehSide + vehWidth; - const SUMOReal rightVehSideDest = rightVehSide + latDist; - const SUMOReal leftVehSideDest = leftVehSide + latDist; - const SUMOReal rightNoOverlap = MIN2(rightVehSideDest, rightVehSide); - const SUMOReal leftNoOverlap = MAX2(leftVehSideDest, leftVehSide); - + const double vehWidth = ego->getVehicleType().getWidth(); + const double rightVehSide = ego->getRightSideOnEdge(); + const double leftVehSide = rightVehSide + vehWidth; + const double rightVehSideDest = rightVehSide + latDist; + const double leftVehSideDest = leftVehSide + latDist; + const double rightNoOverlap = MIN2(rightVehSideDest, rightVehSide); + const double leftNoOverlap = MAX2(leftVehSideDest, leftVehSide); + if (gDebugFlag2) { + std::cout << " checkBlocking" + << " latDist=" << latDist + << " foeOffset=" << foeOffset + << " vehRight=" << rightVehSide + << " vehLeft=" << leftVehSide + << " rightNoOverlap=" << rightNoOverlap + << " leftNoOverlap=" << leftNoOverlap + << " destRight=" << rightVehSideDest + << " destLeft=" << leftVehSideDest + << " leaders=" << leaders + << "\n"; + } int result = 0; for (int i = 0; i < vehicles.numSublanes(); ++i) { CLeaderDist vehDist = vehicles[i]; if (vehDist.first != 0) { + const MSVehicle* leader = vehDist.first; + const MSVehicle* follower = ego; + if (!leaders) { + std::swap(leader, follower); + } // only check the current stripe occuped by foe (transform into edge-coordinates) - const SUMOReal foeRight = i * MSGlobals::gLateralResolution + foeOffset; - const SUMOReal foeLeft = foeRight + MSGlobals::gLateralResolution; - if (gDebugFlag2 && false) { - const MSVehicle* leader = vehDist.first; - const MSVehicle* follower = ego; - if (!leaders) { - std::swap(leader, follower); - } - std::cout << " checkBlocking" - << " leaders=" << leaders - << " foe=" << vehDist.first->getID() + double foeRight, foeLeft; + vehicles.getSublaneBorders(i, foeOffset, foeRight, foeLeft); + if (gDebugFlag2) { + std::cout << " foe=" << vehDist.first->getID() << " gap=" << vehDist.second << " secGap=" << follower->getCarFollowModel().getSecureGap(follower->getSpeed(), leader->getSpeed(), leader->getCarFollowModel().getMaxDecel()) << " foeRight=" << foeRight << " foeLeft=" << foeLeft - << " rightNoOverlap=" << rightNoOverlap - << " leftNoOverlap=" << leftNoOverlap - << " rightVehSideDest=" << rightVehSideDest - << " leftVehSideDest=" << leftVehSideDest + << " overlapBefore=" << overlap(rightVehSide, leftVehSide, foeRight, foeLeft) << " overlap=" << overlap(rightNoOverlap, leftNoOverlap, foeRight, foeLeft) << " overlapDest=" << overlap(rightVehSideDest, leftVehSideDest, foeRight, foeLeft) << "\n"; } + if (overlap(rightVehSide, leftVehSide, foeRight, foeLeft) && (vehDist.second >= 0 || (leader->getSpeed() < SUMO_const_haltingSpeed && follower->getSpeed() < SUMO_const_haltingSpeed))) { + // ignore vehicles that area already in a car-following relationship + continue; + } if (overlap(rightNoOverlap, leftNoOverlap, foeRight, foeLeft)) { if (vehDist.second < 0) { if (gDebugFlag2) { @@ -1750,21 +1784,16 @@ collectBlockers->push_back(vehDist); } } else if (overlap(rightVehSideDest, leftVehSideDest, foeRight, foeLeft)) { - const MSVehicle* leader = vehDist.first; - const MSVehicle* follower = ego; - if (!leaders) { - std::swap(leader, follower); - } - const SUMOReal decelFactor = 1 + ego->getImpatience() * myAssertive; + const double decelFactor = 1 + ego->getImpatience() * myAssertive; // see MSCFModel::getSecureGap // for decelFactor == 1 this is equivalent to // follower->getCarFollowModel().getSecureGap(follower->getSpeed(), leader->getSpeed(), leader->getCarFollowModel().getMaxDecel()) - const SUMOReal followDecel = MIN2(follower->getCarFollowModel().getMaxDecel(), leader->getCarFollowModel().getMaxDecel()) * decelFactor; - const SUMOReal secureGap = MAX2((SUMOReal) 0, MSCFModel::brakeGap(follower->getSpeed(), followDecel, follower->getCarFollowModel().getHeadwayTime()) - - MSCFModel::brakeGap(leader->getSpeed(), leader->getCarFollowModel().getMaxDecel(), 0)); + const double followDecel = MIN2(follower->getCarFollowModel().getMaxDecel(), leader->getCarFollowModel().getMaxDecel()) * decelFactor; + const double secureGap = MAX2(0., MSCFModel::brakeGap(follower->getSpeed(), followDecel, follower->getCarFollowModel().getHeadwayTime()) + - MSCFModel::brakeGap(leader->getSpeed(), leader->getCarFollowModel().getMaxDecel(), 0)); if (vehDist.second < secureGap) { if (gDebugFlag2) { - std::cout << " blocked decelFactor=" << decelFactor << "\n"; + std::cout << " blocked by " << vehDist.first->getID() << " gap=" << vehDist.second << " secGap=" << secureGap << " decelFactor=" << decelFactor << "\n"; } result |= blockType; if (collectBlockers == 0) { @@ -1783,7 +1812,7 @@ bool -MSLCM_SL2015::overlap(SUMOReal right, SUMOReal left, SUMOReal right2, SUMOReal left2) { +MSLCM_SL2015::overlap(double right, double left, double right2, double left2) { assert(right <= left); assert(right2 <= left2); return left2 >= right + NUMERICAL_EPS && left >= right2 + NUMERICAL_EPS; @@ -1802,6 +1831,7 @@ const bool want1 = ((sd1.state & LCA_WANTS_LANECHANGE) != 0) || ((sd1.state & LCA_SUBLANE) != 0 && (sd1.state & LCA_STAY) != 0); const bool want2 = ((sd2.state & LCA_WANTS_LANECHANGE) != 0) || ((sd2.state & LCA_SUBLANE) != 0 && (sd2.state & LCA_STAY) != 0); const bool can1 = ((sd1.state & LCA_BLOCKED) == 0); + const bool can2 = ((sd2.state & LCA_BLOCKED) == 0); if (DEBUG_COND) std::cout << SIMTIME << " veh=" << myVehicle.getID() << " state1=" << toString((LaneChangeAction)sd1.state) @@ -1818,10 +1848,12 @@ // decide whether right or left has higher priority (lower value in enum LaneChangeAction) if ((sd1.state & LCA_CHANGE_REASONS) < (sd2.state & LCA_CHANGE_REASONS)) { //if (DEBUG_COND) std::cout << " " << (sd1.state & LCA_CHANGE_REASONS) << " < " << (sd2.state & LCA_CHANGE_REASONS) << "\n"; - return sd1; + return (!can1 && can2 && sd1.sameDirection(sd2)) ? sd2 : sd1; + //return sd1; } else if ((sd1.state & LCA_CHANGE_REASONS) > (sd2.state & LCA_CHANGE_REASONS)) { //if (DEBUG_COND) std::cout << " " << (sd1.state & LCA_CHANGE_REASONS) << " > " << (sd2.state & LCA_CHANGE_REASONS) << "\n"; - return sd2; + return (!can2 && can1 && sd1.sameDirection(sd2)) ? sd1 : sd2; + //return sd2; } else { // same priority. if ((sd1.state & LCA_SUBLANE) != 0) { @@ -1850,7 +1882,7 @@ LaneChangeAction -MSLCM_SL2015::getLCA(int state, SUMOReal latDist) { +MSLCM_SL2015::getLCA(int state, double latDist) { return ((latDist == 0 || (state & LCA_CHANGE_REASONS) == 0) ? LCA_NONE : (latDist < 0 ? LCA_RIGHT : LCA_LEFT)); } @@ -1866,10 +1898,12 @@ int bestLaneOffset, bool changeToBest, int lcaCounter, - SUMOReal currentDist, - SUMOReal neighDist, - SUMOReal laDist, - int roundaboutEdgesAhead + double currentDist, + double neighDist, + double laDist, + int roundaboutEdgesAhead, + double latLaneDist, + double& latDist ) { const bool right = (laneOffset == -1); const bool left = (laneOffset == 1); @@ -1877,10 +1911,10 @@ const MSVehicle::LaneQ& neigh = preb[currIdx + laneOffset]; const MSVehicle::LaneQ& best = preb[currIdx + bestLaneOffset]; - const SUMOReal usableDist = (currentDist - myVehicle.getPositionOnLane() - best.occupation * JAM_FACTOR); + const double usableDist = (currentDist - myVehicle.getPositionOnLane() - best.occupation * JAM_FACTOR); //- (best.lane->getVehicleNumber() * neighSpeed)); // VARIANT 9 jfSpeed - const SUMOReal maxJam = MAX2(preb[currIdx + laneOffset].occupation, preb[currIdx].occupation); - const SUMOReal neighLeftPlace = MAX2((SUMOReal) 0, neighDist - myVehicle.getPositionOnLane() - maxJam); + const double maxJam = MAX2(preb[currIdx + laneOffset].occupation, preb[currIdx].occupation); + const double neighLeftPlace = MAX2(0., neighDist - myVehicle.getPositionOnLane() - maxJam); if (gDebugFlag2) { std::cout << SIMTIME @@ -1899,6 +1933,7 @@ if (laneOffset != 0 && changeToBest && bestLaneOffset == curr.bestLaneOffset && currentDistDisallows(usableDist, bestLaneOffset, laDist)) { /// @brief we urgently need to change lanes to follow our route + latDist = latLaneDist; ret |= LCA_STRATEGIC | LCA_URGENT; } else { // VARIANT_20 (noOvertakeRight) @@ -1909,8 +1944,8 @@ CLeaderDist cld = getSlowest(neighLeaders); const MSVehicle* nv = cld.first; if (nv->getSpeed() < myVehicle.getSpeed()) { - const SUMOReal vSafe = myCarFollowModel.followSpeed( - &myVehicle, myVehicle.getSpeed(), cld.second, nv->getSpeed(), nv->getCarFollowModel().getMaxDecel()); + const double vSafe = myCarFollowModel.followSpeed( + &myVehicle, myVehicle.getSpeed(), cld.second, nv->getSpeed(), nv->getCarFollowModel().getMaxDecel()); myVSafes.push_back(vSafe); if (vSafe < myVehicle.getSpeed()) { mySpeedGainProbabilityRight += TS * myChangeProbThresholdLeft / 3; @@ -1973,6 +2008,32 @@ ret |= LCA_STAY | LCA_STRATEGIC; } } + if ((ret & LCA_URGENT) == 0 && getShadowLane() != 0 && + // ignore overlap if it goes in the correct direction + bestLaneOffset * myVehicle.getLateralPositionOnLane() <= 0) { + // no decision or decision to stay + // make sure to stay within lane bounds in case the shadow lane ends + const double requiredDist = 2 * myVehicle.getLateralOverlap() / SUMO_const_laneWidth * laDist; + double currentShadowDist = -myVehicle.getPositionOnLane(); + for (std::vector::const_iterator it = curr.bestContinuations.begin(); it != curr.bestContinuations.end(); ++it) { + if (*it == 0) { + continue; + } + MSLane* shadow = getShadowLane(*it); + if (shadow == 0 || currentShadowDist >= requiredDist) { + break; + } + currentShadowDist += shadow->getLength(); + } + if (gDebugFlag2) { + std::cout << " veh=" << myVehicle.getID() << " currentShadowDist=" << currentShadowDist << " requiredDist=" << requiredDist << " overlap=" << myVehicle.getLateralOverlap() << "\n"; + } + if (currentShadowDist < requiredDist && currentShadowDist < usableDist) { + latDist = myVehicle.getLateralPositionOnLane() < 0 ? myVehicle.getLateralOverlap() : - myVehicle.getLateralOverlap(); + ret |= LCA_STRATEGIC | LCA_URGENT | LCA_STAY ; + } + } + // check for overriding TraCI requests if (gDebugFlag2) { std::cout << SIMTIME << " veh=" << myVehicle.getID() << " ret=" << ret; @@ -1999,7 +2060,7 @@ const MSLeaderDistanceInfo& neighBlockers, const MSLane& neighLane, int laneOffset, - SUMOReal& latDist, + double& latDist, int& blocked) { /* @notes @@ -2034,72 +2095,127 @@ * */ /// XXX to be made configurable - const SUMOReal gapFactor = (state & LCA_STRATEGIC) != 0 ? 0.0 : 1.0; + double gapFactor = (state & LCA_STRATEGIC) != 0 ? MAX2(0.0, (1.0 - myPushy)) : 1.0; const bool stayInLane = laneOffset == 0 || ((state & LCA_STRATEGIC) != 0 && (state & LCA_STAY) != 0); - const SUMOReal oldLatDist = latDist; - - /// XXX todo - // - compute lateral gap after executing the current maneuver (may be LCA_NONE) - // - decide if override is needed - // - compute alternative maneuver to improve lateralGap - // - update blocking (checkBlocking) + const double oldLatDist = latDist; // compute gaps after maneuver - const SUMOReal halfWidth = myVehicle.getVehicleType().getWidth() * 0.5; + const double halfWidth = myVehicle.getVehicleType().getWidth() * 0.5; // if the current maneuver is blocked we will stay where we are - const SUMOReal newCenter = myVehicle.getCenterOnEdge() + (blocked == 0 ? latDist : 0); - // surplus gaps after the context-dependend value of currentMinGap has ben subtracted - // if this value goes negative, we should override the current maneuver to better maintain distance - SUMOReal surplusGapRight = newCenter - halfWidth; - SUMOReal surplusGapLeft = myVehicle.getLane()->getEdge().getWidth() - newCenter - halfWidth; + const double oldCenter = myVehicle.getCenterOnEdge(); + // surplus gaps. these are used to collect various constraints + // if they do not permit the desired manoeuvre, should override it to better maintain distance + // stay within the current edge + double surplusGapRight = oldCenter - halfWidth; + double surplusGapLeft = myVehicle.getLane()->getEdge().getWidth() - oldCenter - halfWidth; + if (gDebugFlag2) { + std::cout << " keepLatGap laneOffset=" << laneOffset + << " latDist=" << latDist + << " state=" << toString((LaneChangeAction)state) + << " blocked=" << toString((LaneChangeAction)blocked) + << " gapFactor=" << gapFactor + << " stayInLane=" << stayInLane << "\n" + << " stayInEdge: surplusGapRight=" << surplusGapRight << " surplusGapLeft=" << surplusGapLeft << "\n"; + } + // staying within the edge overrides all minGap considerations + if (surplusGapLeft < 0 || surplusGapRight < 0) { + gapFactor = 0; + } + + // maintain gaps to vehicles on the current lane + // ignore vehicles that are too far behind + const double netOverlap = -myVehicle.getVehicleType().getLength() * 0.5; + updateGaps(leaders, myVehicle.getLane()->getRightSideOnEdge(), oldCenter, gapFactor, surplusGapRight, surplusGapLeft, true); + updateGaps(followers, myVehicle.getLane()->getRightSideOnEdge(), oldCenter, gapFactor, surplusGapRight, surplusGapLeft, true, netOverlap); - updateGaps(leaders, myVehicle.getLane()->getRightSideOnEdge(), newCenter, gapFactor, surplusGapRight, surplusGapLeft); - updateGaps(followers, myVehicle.getLane()->getRightSideOnEdge(), newCenter, gapFactor, surplusGapRight, surplusGapLeft); if (laneOffset != 0) { - updateGaps(neighLeaders, neighLane.getRightSideOnEdge(), newCenter, gapFactor, surplusGapRight, surplusGapLeft); - updateGaps(neighFollowers, neighLane.getRightSideOnEdge(), newCenter, gapFactor, surplusGapRight, surplusGapLeft); + // maintain gaps to vehicles on the target lane + updateGaps(neighLeaders, neighLane.getRightSideOnEdge(), oldCenter, gapFactor, surplusGapRight, surplusGapLeft, true); + updateGaps(neighFollowers, neighLane.getRightSideOnEdge(), oldCenter, gapFactor, surplusGapRight, surplusGapLeft, true, netOverlap); + } + if (gDebugFlag2) { + std::cout << " minGapLat: surplusGapRight=" << surplusGapRight << " surplusGapLeft=" << surplusGapLeft << "\n" + << " lastGaps: right=" << myLastLateralGapRight << " left=" << myLastLateralGapLeft << "\n"; } - if (stayInLane) { - // stay fully within the current lane - const SUMOReal halfLaneWidth = myVehicle.getLane()->getWidth() * 0.5; - surplusGapRight = MIN2(surplusGapRight, halfLaneWidth + myVehicle.getLateralPositionOnLane() - halfWidth); - surplusGapLeft = MIN2(surplusGapLeft, halfLaneWidth - myVehicle.getLateralPositionOnLane() - halfWidth); + // we also need to track the physical gap, in addition to the psychological gap + double physicalGapLeft = myLastLateralGapLeft == NO_LATERAL_NEIGHBOR ? surplusGapLeft : myLastLateralGapLeft; + double physicalGapRight = myLastLateralGapRight == NO_LATERAL_NEIGHBOR ? surplusGapRight : myLastLateralGapRight; + + const double halfLaneWidth = myVehicle.getLane()->getWidth() * 0.5; + if (stayInLane || laneOffset == 1) { + // do not move past the right boundary of the current lane (traffic wasn't checked there) + // but assume it's ok to be where we are in case we are already beyond + surplusGapRight = MIN2(surplusGapRight, MAX2(0.0, halfLaneWidth + myVehicle.getLateralPositionOnLane() - halfWidth)); + physicalGapRight = MIN2(physicalGapRight, MAX2(0.0, halfLaneWidth + myVehicle.getLateralPositionOnLane() - halfWidth)); + } + if (stayInLane || laneOffset == -1) { + // do not move past the left boundary of the current lane (traffic wasn't checked there) + // but assume it's ok to be where we are in case we are already beyond + surplusGapLeft = MIN2(surplusGapLeft, MAX2(0.0, halfLaneWidth - myVehicle.getLateralPositionOnLane() - halfWidth)); + physicalGapLeft = MIN2(physicalGapLeft, MAX2(0.0, halfLaneWidth - myVehicle.getLateralPositionOnLane() - halfWidth)); } if (gDebugFlag2) { - std::cout << " keepLatGap laneOffset=" << laneOffset - << " latDist=" << latDist - << " gapFactor=" << gapFactor - << " stayInLane=" << stayInLane - << " surplusGapRight=" << surplusGapRight - << " surplusGapLeft=" << surplusGapLeft - << " state=" << toString((LaneChangeAction)state) - << " blockedBefore=" << toString((LaneChangeAction)blocked); + std::cout << " stayInLane: surplusGapRight=" << surplusGapRight << " surplusGapLeft=" << surplusGapLeft << "\n"; } - const SUMOReal maxDist = SPEED2DIST(myVehicle.getVehicleType().getMaxSpeedLat()); - if (surplusGapRight < -NUMERICAL_EPS) { - if (surplusGapLeft > 0) { - // move left to increase gap - latDist = MIN3(latDist - surplusGapRight, latDist + surplusGapLeft, maxDist); + + if (surplusGapRight + surplusGapLeft < 0) { + // insufficient lateral space to fulfill all requirements. apportion space proportionally + const double equalDeficit = 0.5 * (surplusGapLeft + surplusGapRight); + if (surplusGapRight < surplusGapLeft) { + // shift further to the left but no further than there is physical space + const double delta = MIN2(equalDeficit - surplusGapRight, physicalGapLeft); + latDist = delta; + if (gDebugFlag2) { + std::cout << " insufficient latSpace, move left: delta=" << delta << "\n"; + } } else { - blocked |= LCA_OVERLAPPING | LCA_BLOCKED_RIGHT; + // shift further to the right but no further than there is physical space + const double delta = MIN2(equalDeficit - surplusGapLeft, physicalGapRight); + latDist = -delta; + if (gDebugFlag2) { + std::cout << " insufficient latSpace, move right: delta=" << delta << "\n"; + } } - } else if (surplusGapLeft < -NUMERICAL_EPS) { - if (surplusGapRight > 0) { - // move right to increase gap - latDist = MAX3(latDist + surplusGapLeft, latDist - surplusGapRight, -maxDist); - } else { - blocked |= LCA_OVERLAPPING | LCA_BLOCKED_LEFT; + } else { + // sufficient space. move as far as the gaps permit + latDist = MAX2(MIN2(latDist, surplusGapLeft), -surplusGapRight); + } + // take into account overriding traci sublane-request + if (myVehicle.hasInfluencer() && myVehicle.getInfluencer().getLatDist() != 0) { + // @note: the influence is reset in MSAbstractLaneChangeModel::setOwnState at the end of the lane-changing code for this vehicle + latDist = myVehicle.getInfluencer().getLatDist(); + } + // if we cannot move in the desired direction, consider the maneuver blocked anyway + if ((state & (LCA_STRATEGIC | LCA_COOPERATIVE | LCA_SPEEDGAIN)) != 0) { + if ((latDist < -NUMERICAL_EPS) && (oldLatDist > NUMERICAL_EPS)) { + if (gDebugFlag2) { + std::cout << " wanted changeToLeft oldLatDist=" << oldLatDist << ", blocked latGap changeToRight\n"; + } + latDist = oldLatDist; // restore old request for usage in decideDirection() + blocked = LCA_OVERLAPPING | LCA_BLOCKED_LEFT; + } else if ((latDist > NUMERICAL_EPS) && (oldLatDist < -NUMERICAL_EPS)) { + if (gDebugFlag2) { + std::cout << " wanted changeToRight oldLatDist=" << oldLatDist << ", blocked latGap changeToLeft\n"; + } + latDist = oldLatDist; // restore old request for usage in decideDirection() + blocked = LCA_OVERLAPPING | LCA_BLOCKED_RIGHT; } } - if (latDist != oldLatDist) { + // update blocked status + if (fabs(latDist - oldLatDist) > NUMERICAL_EPS) { + if (gDebugFlag2) { + std::cout << " latDistUpdated=" << (oldLatDist - latDist) << "\n"; + } blocked = checkBlocking(neighLane, latDist, laneOffset, leaders, followers, blockers, neighLeaders, neighFollowers, neighBlockers, 0, 0, true); } if (latDist != 0) { state = (state & ~LCA_STAY); } if (gDebugFlag2) { - std::cout << " keepLatGap (checked)" - << " latDist2=" << latDist + std::cout << " latDist2=" << latDist + << " state2=" << toString((LaneChangeAction)state) + << " lastGapLeft=" << myLastLateralGapLeft + << " lastGapRight=" << myLastLateralGapRight << " blockedAfter=" << toString((LaneChangeAction)blocked) << "\n"; } @@ -2108,38 +2224,178 @@ void -MSLCM_SL2015::updateGaps(const MSLeaderDistanceInfo& others, SUMOReal foeOffset, SUMOReal newCenter, SUMOReal gapFactor, SUMOReal& surplusGapRight, SUMOReal& surplusGapLeft) const { +MSLCM_SL2015::updateGaps(const MSLeaderDistanceInfo& others, double foeOffset, double oldCenter, double gapFactor, double& surplusGapRight, double& surplusGapLeft, bool saveMinGap, double netOverlap) { if (others.hasVehicles()) { - const SUMOReal halfWidth = myVehicle.getVehicleType().getWidth() * 0.5 + NUMERICAL_EPS; - const SUMOReal baseMinGap = myVehicle.getVehicleType().getMinGapLat(); + const double halfWidth = myVehicle.getVehicleType().getWidth() * 0.5 + NUMERICAL_EPS; + const double baseMinGap = myVehicle.getVehicleType().getMinGapLat(); for (int i = 0; i < others.numSublanes(); ++i) { - if (others[i].first != 0 && others[i].second <= 0) { + if (others[i].first != 0 && others[i].second <= 0 + && (netOverlap == 0 || others[i].second + others[i].first->getVehicleType().getMinGap() < netOverlap)) { /// foe vehicle occupies full sublanes const MSVehicle* foe = others[i].first; - const SUMOReal foeRight = i * MSGlobals::gLateralResolution + foeOffset; - const SUMOReal foeLeft = foeRight + MSGlobals::gLateralResolution; - const SUMOReal foeCenter = foeRight + 0.5 * MSGlobals::gLateralResolution; - const SUMOReal gap = MIN2(fabs(foeRight - newCenter), fabs(foeLeft - newCenter)) - halfWidth; - const SUMOReal currentMinGap = baseMinGap * MIN2(1.0, MAX2(myVehicle.getSpeed(), (SUMOReal)fabs(myVehicle.getSpeed() - foe->getSpeed())) / (100 / 3.6)) * gapFactor; - if (gDebugFlag2 && false) std::cout << " updateGaps" - << " foe=" << foe->getID() - << " foeRight=" << foeRight - << " foeLeft=" << foeLeft - << " gap=" << others[i].second - << " latgap=" << gap - << " currentMinGap=" << currentMinGap - << " surplusGapRight=" << surplusGapRight - << " surplusGapLeft=" << surplusGapLeft - << "\n"; - if (foeCenter < newCenter) { + const double res = MSGlobals::gLateralResolution > 0 ? MSGlobals::gLateralResolution : others[i].first->getLane()->getWidth(); + double foeRight, foeLeft; + others.getSublaneBorders(i, foeOffset, foeRight, foeLeft); + const double foeCenter = foeRight + 0.5 * res; + const double gap = MIN2(fabs(foeRight - oldCenter), fabs(foeLeft - oldCenter)) - halfWidth; + const double currentMinGap = baseMinGap * MIN2(1.0, MAX2(myVehicle.getSpeed(), (double)fabs(myVehicle.getSpeed() - foe->getSpeed())) / LATGAP_SPEED_THRESHOLD) * gapFactor; + if (gDebugFlag2) std::cout << " updateGaps" + << " i=" << i + << " foe=" << foe->getID() + << " foeRight=" << foeRight + << " foeLeft=" << foeLeft + << " oldCenter=" << oldCenter + << " gap=" << others[i].second + << " latgap=" << gap + << " currentMinGap=" << currentMinGap + << " surplusGapRight=" << surplusGapRight + << " surplusGapLeft=" << surplusGapLeft + << "\n"; + if (gap < -POSITION_EPS && (others[i].second >= 0 || (myVehicle.getSpeed() < SUMO_const_haltingSpeed && foe->getSpeed() < SUMO_const_haltingSpeed))) { + //std::cout << SIMTIME << " veh=" << myVehicle.getID() << " ignoring lateral gap to " << foe->getID() << "\n"; + // ignore vehicles that area already in a car-following relationship + continue; + } + if (foeCenter < oldCenter) { surplusGapRight = MIN2(surplusGapRight, gap - currentMinGap); } else { surplusGapLeft = MIN2(surplusGapLeft, gap - currentMinGap); } + if (saveMinGap) { + if (foeCenter < oldCenter) { + if (gDebugFlag2 && gap < myLastLateralGapRight) { + std::cout << " new minimum rightGap=" << gap << "\n"; + } + myLastLateralGapRight = MIN2(myLastLateralGapRight, gap); + } else { + if (gDebugFlag2 && gap < myLastLateralGapLeft) { + std::cout << " new minimum leftGap=" << gap << "\n"; + } + myLastLateralGapLeft = MIN2(myLastLateralGapLeft, gap); + } + } } } } } +std::string +MSLCM_SL2015::getParameter(const std::string& key) const { + if (key == toString(SUMO_ATTR_LCA_STRATEGIC_PARAM)) { + return toString(myStrategicParam); + } else if (key == toString(SUMO_ATTR_LCA_COOPERATIVE_PARAM)) { + return toString(myCooperativeParam); + } else if (key == toString(SUMO_ATTR_LCA_SPEEDGAIN_PARAM)) { + return toString(mySpeedGainParam); + } else if (key == toString(SUMO_ATTR_LCA_KEEPRIGHT_PARAM)) { + return toString(myKeepRightParam); + } else if (key == toString(SUMO_ATTR_LCA_SUBLANE_PARAM)) { + return toString(mySublaneParam); + } else if (key == toString(SUMO_ATTR_LCA_PUSHY)) { + return toString(myPushy); + } else if (key == toString(SUMO_ATTR_LCA_ASSERTIVE)) { + return toString(myAssertive); + } + throw InvalidArgument("Parameter '" + key + "' is not supported for laneChangeModel of type '" + toString(myModel) + "'"); +} + +void +MSLCM_SL2015::setParameter(const std::string& key, const std::string& value) { + double doubleValue; + try { + doubleValue = TplConvert::_2double(value.c_str()); + } catch (NumberFormatException) { + throw InvalidArgument("Setting parameter '" + key + "' requires a number for laneChangeModel of type '" + toString(myModel) + "'"); + } + if (key == toString(SUMO_ATTR_LCA_STRATEGIC_PARAM)) { + myStrategicParam = doubleValue; + } else if (key == toString(SUMO_ATTR_LCA_COOPERATIVE_PARAM)) { + myCooperativeParam = doubleValue; + } else if (key == toString(SUMO_ATTR_LCA_SPEEDGAIN_PARAM)) { + mySpeedGainParam = doubleValue; + } else if (key == toString(LCA_KEEPRIGHT)) { + myKeepRightParam = doubleValue; + } else if (key == toString(SUMO_ATTR_LCA_SUBLANE_PARAM)) { + mySublaneParam = doubleValue; + } else if (key == toString(SUMO_ATTR_LCA_PUSHY)) { + myPushy = doubleValue; + } else if (key == toString(SUMO_ATTR_LCA_ASSERTIVE)) { + myAssertive = doubleValue; + } else { + throw InvalidArgument("Setting parameter '" + key + "' is not supported for laneChangeModel of type '" + toString(myModel) + "'"); + } +} + + +int +MSLCM_SL2015::wantsChange( + int laneOffset, + MSAbstractLaneChangeModel::MSLCMessager& /* msgPass */, + int blocked, + const std::pair& leader, + const std::pair& neighLead, + const std::pair& neighFollow, + const MSLane& neighLane, + const std::vector& preb, + MSVehicle** lastBlocked, + MSVehicle** firstBlocked) { + +#ifdef DEBUG_WANTS_CHANGE + if (DEBUG_COND) { + std::cout << "\nWANTS_CHANGE\n" << STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()) + //<< std::setprecision(10) + << " veh=" << myVehicle.getID() + << " lane=" << myVehicle.getLane()->getID() + << " pos=" << myVehicle.getPositionOnLane() + << " posLat=" << myVehicle.getLateralPositionOnLane() + << " speed=" << myVehicle.getSpeed() + << " considerChangeTo=" << (laneOffset == -1 ? "right" : "left") + << "\n"; + } +#endif + + double latDist = 0; + const MSLane* dummy = myVehicle.getLane(); + MSLeaderDistanceInfo leaders(leader, dummy); + MSLeaderDistanceInfo followers(std::make_pair((MSVehicle*)0, -1), dummy); + MSLeaderDistanceInfo blockers(std::make_pair((MSVehicle*)0, -1), dummy); + MSLeaderDistanceInfo neighLeaders(neighLead, dummy); + MSLeaderDistanceInfo neighFollowers(neighFollow, dummy); + MSLeaderDistanceInfo neighBlockers(std::make_pair((MSVehicle*)0, -1), dummy); + + int result = _wantsChangeSublane(laneOffset, + leaders, followers, blockers, + neighLeaders, neighFollowers, neighBlockers, + neighLane, preb, + lastBlocked, firstBlocked, latDist, blocked); + + myOrigLatDist = 0; + myCanChangeFully = true; + // ignore sublane motivation + result &= ~LCA_SUBLANE; + result |= getLCA(result, latDist); + +#ifdef DEBUG_WANTS_CHANGE + if (DEBUG_COND) { + if (result & LCA_WANTS_LANECHANGE) { + std::cout << STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()) + << " veh=" << myVehicle.getID() + << " wantsChangeTo=" << (laneOffset == -1 ? "right" : "left") + << ((result & LCA_URGENT) ? " (urgent)" : "") + << ((result & LCA_CHANGE_TO_HELP) ? " (toHelp)" : "") + << ((result & LCA_STRATEGIC) ? " (strat)" : "") + << ((result & LCA_COOPERATIVE) ? " (coop)" : "") + << ((result & LCA_SPEEDGAIN) ? " (speed)" : "") + << ((result & LCA_KEEPRIGHT) ? " (keepright)" : "") + << ((result & LCA_TRACI) ? " (traci)" : "") + << ((blocked & LCA_BLOCKED) ? " (blocked)" : "") + << ((blocked & LCA_OVERLAPPING) ? " (overlap)" : "") + << "\n\n\n"; + } + } +#endif + + return result; +} /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_SL2015.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_SL2015.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_SL2015.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/lcmodels/MSLCM_SL2015.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSLCM_SL2015.h /// @author Jakob Erdmann /// @date Tue, 06.10.2015 -/// @version $Id: MSLCM_SL2015.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSLCM_SL2015.h 24108 2017-04-27 18:43:30Z behrisch $ /// // A lane change model for heterogeneous traffic (based on sub-lanes) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -66,7 +66,7 @@ virtual ~MSLCM_SL2015(); /** @brief Called to examine whether the vehicle wants to change - * using the given laneOffset. + * with the given laneOffset (using the sublane model) * This method gets the information about the surrounding vehicles * and whether another lane may be more preferable */ int wantsChangeSublane(int laneOffset, @@ -80,7 +80,22 @@ const std::vector& preb, MSVehicle** lastBlocked, MSVehicle** firstBlocked, - SUMOReal& latDist, int& blocked); + double& latDist, int& blocked); + + /** @brief Called to examine whether the vehicle wants to change + * using the given laneOffset (this is a wrapper around wantsChangeSublane). + * This method gets the information about the surrounding vehicles + * and whether another lane may be more preferable */ + int wantsChange( + int laneOffset, + MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked, + const std::pair& leader, + const std::pair& neighLead, + const std::pair& neighFollow, + const MSLane& neighLane, + const std::vector& preb, + MSVehicle** lastBlocked, + MSVehicle** firstBlocked); void* inform(void* info, MSVehicle* sender); @@ -92,11 +107,11 @@ * @param cfModel The model used * @return the new speed of the vehicle as proposed by the lane changer */ - SUMOReal patchSpeed(const SUMOReal min, const SUMOReal wanted, const SUMOReal max, - const MSCFModel& cfModel); + double patchSpeed(const double min, const double wanted, const double max, + const MSCFModel& cfModel); /** helper function which contains the actual logic */ - SUMOReal _patchSpeed(const SUMOReal min, const SUMOReal wanted, const SUMOReal max, - const MSCFModel& cfModel); + double _patchSpeed(const double min, const double wanted, const double max, + const MSCFModel& cfModel); void changed(); @@ -105,10 +120,13 @@ /// @brief whether the current vehicles shall be debugged bool debugVehicle() const; - void setOwnState(int state) { - myOwnState = state; - myPreviousState = state; - } + void setOwnState(const int state); + + /// @brief try to retrieve the given parameter from this device. Throw exception for unsupported key + std::string getParameter(const std::string& key) const; + + /// @brief try to set the given parameter for this laneChangeModel. Throw exception for unsupported key + void setParameter(const std::string& key, const std::string& value); protected: @@ -125,36 +143,36 @@ const std::vector& preb, MSVehicle** lastBlocked, MSVehicle** firstBlocked, - SUMOReal& latDist, int& blocked); + double& latDist, int& blocked); /* @brief decide whether we will overtake or follow blocking leaders * and inform them accordingly (see informLeader) * If we decide to follow, myVSafes will be extended * returns the planned speed if following or -1 if overtaking */ - SUMOReal informLeaders(int blocked, int dir, - const std::vector& blockers, - SUMOReal remainingSeconds); + double informLeaders(int blocked, int dir, + const std::vector& blockers, + double remainingSeconds); /// @brief call informFollower for multiple followers void informFollowers(int blocked, int dir, const std::vector& blockers, - SUMOReal remainingSeconds, - SUMOReal plannedSpeed); + double remainingSeconds, + double plannedSpeed); /* @brief decide whether we will overtake or follow a blocking leader * and inform it accordingly * If we decide to follow, myVSafes will be extended * returns the planned speed if following or -1 if overtaking */ - SUMOReal informLeader(int blocked, int dir, - const CLeaderDist& neighLead, - SUMOReal remainingSeconds); + double informLeader(int blocked, int dir, + const CLeaderDist& neighLead, + double remainingSeconds); /// @brief decide whether we will try cut in before the follower or allow to be overtaken void informFollower(int blocked, int dir, const CLeaderDist& neighFollow, - SUMOReal remainingSeconds, - SUMOReal plannedSpeed); + double remainingSeconds, + double plannedSpeed); /// @brief compute useful slowdowns for blocked vehicles @@ -164,7 +182,7 @@ void saveBlockerLength(const MSVehicle* blocker, int lcaCounter); /// @brief reserve space at the end of the lane to avoid dead locks - inline void saveBlockerLength(SUMOReal length) { + inline void saveBlockerLength(double length) { myLeadingBlockerLength = MAX2(length, myLeadingBlockerLength); }; @@ -180,15 +198,15 @@ inline bool amBlockingFollowerPlusNB() { return (myOwnState & (LCA_AMBLOCKINGFOLLOWER | LCA_AMBLOCKINGFOLLOWER_DONTBRAKE)) != 0; } - inline bool currentDistDisallows(SUMOReal dist, int laneOffset, SUMOReal lookForwardDist) { + inline bool currentDistDisallows(double dist, int laneOffset, double lookForwardDist) { return dist / (abs(laneOffset)) < lookForwardDist; } - inline bool currentDistAllows(SUMOReal dist, int laneOffset, SUMOReal lookForwardDist) { + inline bool currentDistAllows(double dist, int laneOffset, double lookForwardDist) { return dist / abs(laneOffset) > lookForwardDist; } /// @brief information regarding save velocity (unused) and state flags of the ego vehicle - typedef std::pair Info; + typedef std::pair Info; /// @brief update expected speeds for each sublane of the current edge @@ -200,7 +218,7 @@ protected: /// @brief send a speed recommendation to the given vehicle - void msg(const CLeaderDist& cld, SUMOReal speed, int state); + void msg(const CLeaderDist& cld, double speed, int state); /// @brief compute shift so that prevSublane + shift = newSublane int computeSublaneShift(const MSEdge* prevEdge, const MSEdge* curEdge); @@ -212,7 +230,7 @@ static CLeaderDist getSlowest(const MSLeaderDistanceInfo& ldi); /// @brief restrict latDist to permissible speed and determine blocking state depending on that distance - int checkBlocking(const MSLane& neighLane, SUMOReal& latDist, int laneOffset, + int checkBlocking(const MSLane& neighLane, double& latDist, int laneOffset, const MSLeaderDistanceInfo& leaders, const MSLeaderDistanceInfo& followers, const MSLeaderDistanceInfo& blockers, @@ -225,14 +243,14 @@ /// @brief check whether any of the vehicles overlaps with ego int checkBlockingVehicles(const MSVehicle* ego, const MSLeaderDistanceInfo& vehicles, - SUMOReal latDist, SUMOReal foeOffset, bool leaders, LaneChangeAction blockType, + double latDist, double foeOffset, bool leaders, LaneChangeAction blockType, std::vector* collectBlockers = 0) const; /// @brief return whether the given intervals overlap - static bool overlap(SUMOReal right, SUMOReal left, SUMOReal right2, SUMOReal left2); + static bool overlap(double right, double left, double right2, double left2); /// @brief compute lane change action from desired lateral distance - static LaneChangeAction getLCA(int state, SUMOReal latDist); + static LaneChangeAction getLCA(int state, double latDist); /// @brief compute strategic lane change actions int checkStrategicChange(int ret, @@ -244,10 +262,12 @@ int bestLaneOffset, bool changeToBest, int lcaCounter, - SUMOReal currentDist, - SUMOReal neighDist, - SUMOReal laDist, - int roundaboutEdgesAhead + double currentDist, + double neighDist, + double laDist, + int roundaboutEdgesAhead, + double latLaneDist, + double& latDist ); /// @brief check whether lateral gap requirements are met override the current maneuver if necessary @@ -260,37 +280,37 @@ const MSLeaderDistanceInfo& neighBlockers, const MSLane& neighLane, int laneOffset, - SUMOReal& latDist, + double& latDist, int& blocked); - /// @brief check remaining lateral gaps for the given foe vehicles - void updateGaps(const MSLeaderDistanceInfo& others, SUMOReal foeOffset, SUMOReal newCenter, SUMOReal gapFactor, - SUMOReal& surplusGapRight, SUMOReal& surplusGapLeft) const; + /// @brief check remaining lateral gaps for the given foe vehicles and optionally update minimum lateral gaps + void updateGaps(const MSLeaderDistanceInfo& others, double foeOffset, double oldCenter, double gapFactor, + double& surplusGapRight, double& surplusGapLeft, bool saveMinGap = false, double netOverlap = 0); protected: /// @brief a value for tracking the probability that a change to the right is beneficial - SUMOReal mySpeedGainProbabilityRight; + double mySpeedGainProbabilityRight; /// @brief a value for tracking the probability that a change to the left is beneficial - SUMOReal mySpeedGainProbabilityLeft; + double mySpeedGainProbabilityLeft; /* @brief a value for tracking the probability of following the/"Rechtsfahrgebot" * A larger negative value indicates higher probability for moving to the * right (as in mySpeedGainProbability) */ - SUMOReal myKeepRightProbability; + double myKeepRightProbability; - SUMOReal myLeadingBlockerLength; - SUMOReal myLeftSpace; + double myLeadingBlockerLength; + double myLeftSpace; /*@brief the speed to use when computing the look-ahead distance for * determining urgency of strategic lane changes */ - SUMOReal myLookAheadSpeed; + double myLookAheadSpeed; /// @brief speed adaptation requests by ego and surrounding vehicles - std::vector myVSafes; + std::vector myVSafes; /// @brief expected travel speeds on all sublanes on the current edge(!) - std::vector myExpectedSublaneSpeeds; + std::vector myExpectedSublaneSpeeds; /// @brief expected travel speeds on all sublanes on the current edge(!) const MSEdge* myLastEdge; @@ -305,26 +325,26 @@ int myPreviousState; /// @brief the complete lateral distance the vehicle wants to travel to finish its maneuver - SUMOReal myOrigLatDist; + double myOrigLatDist; - /// @name user configurable model parameters + /// @name user configurable model parameters (can be changed via TraCI) //@{ - const SUMOReal myStrategicParam; - const SUMOReal myCooperativeParam; - const SUMOReal mySpeedGainParam; - const SUMOReal myKeepRightParam; - const SUMOReal mySublaneParam; + double myStrategicParam; + double myCooperativeParam; + double mySpeedGainParam; + double myKeepRightParam; + double mySublaneParam; // @brief willingness to encroach on other vehicles laterally (pushing them around) - const SUMOReal myPushy; - const SUMOReal myAssertive; + double myPushy; + double myAssertive; //@} /// @name derived parameters //@{ // @brief willingness to encroach on other vehicles laterally (pushing them around) - const SUMOReal myChangeProbThresholdRight; - const SUMOReal myChangeProbThresholdLeft; - const SUMOReal mySpeedLossProbThreshold; + const double myChangeProbThresholdRight; + const double myChangeProbThresholdLeft; + const double mySpeedLossProbThreshold; //@} }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/logging/CastingFunctionBinding.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/logging/CastingFunctionBinding.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/logging/CastingFunctionBinding.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/logging/CastingFunctionBinding.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Christian Roessel /// @author Sascha Krieg /// @date Fri, 29.04.2005 -/// @version $Id: CastingFunctionBinding.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: CastingFunctionBinding.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Function type template /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -63,8 +63,8 @@ return new CastingFunctionBinding(mySource, myOperation, myScale); } - ValueSource* makeSUMORealReturningCopy() const { - return new CastingFunctionBinding(mySource, myOperation, myScale); + ValueSource* makedoubleReturningCopy() const { + return new CastingFunctionBinding(mySource, myOperation, myScale); } private: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/logging/FuncBinding_IntParam.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/logging/FuncBinding_IntParam.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/logging/FuncBinding_IntParam.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/logging/FuncBinding_IntParam.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Fri, 29.04.2005 -/// @version $Id: FuncBinding_IntParam.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: FuncBinding_IntParam.h 23150 2017-02-27 12:08:30Z behrisch $ /// // �Function type template /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -58,7 +58,7 @@ /// Destructor. ~FuncBinding_IntParam() {} - SUMOReal getValue() const { + double getValue() const { return (mySource->*myOperation)(myParam); } @@ -67,8 +67,8 @@ mySource, myOperation, myParam); } - ValueSource* makeSUMORealReturningCopy() const { - return new FuncBinding_IntParam(mySource, myOperation, myParam); + ValueSource* makedoubleReturningCopy() const { + return new FuncBinding_IntParam(mySource, myOperation, myParam); } protected: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/logging/FuncBinding_StringParam.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/logging/FuncBinding_StringParam.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/logging/FuncBinding_StringParam.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/logging/FuncBinding_StringParam.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Sascha Krieg /// @date Fri, 29.04.2005 -/// @version $Id: FuncBinding_StringParam.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: FuncBinding_StringParam.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Function type template /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -65,7 +65,7 @@ mySource, myOperation, myParam); } - ValueSource* makeSUMORealReturningCopy() const { + ValueSource* makedoubleReturningCopy() const { throw 1; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/logging/FunctionBinding.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/logging/FunctionBinding.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/logging/FunctionBinding.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/logging/FunctionBinding.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,7 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Fri, 29.04.2005 -/// @version $Id: FunctionBinding.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: FunctionBinding.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Function type template /****************************************************************************/ @@ -66,8 +66,8 @@ return new FunctionBinding(mySource, myOperation, myScale); } - ValueSource* makeSUMORealReturningCopy() const { - return new CastingFunctionBinding(mySource, myOperation, myScale); + ValueSource* makedoubleReturningCopy() const { + return new CastingFunctionBinding(mySource, myOperation, myScale); } private: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -21,6 +21,7 @@ MSRightOfWayJunction.cpp MSRightOfWayJunction.h \ MSRoute.cpp MSRoute.h MSRouteHandler.cpp MSRouteHandler.h \ MSStoppingPlace.cpp MSStoppingPlace.h \ +MSParkingArea.cpp MSParkingArea.h \ MSVehicle.cpp MSVehicle.h \ MSLeaderInfo.cpp MSLeaderInfo.h \ MSVehicleContainer.cpp MSVehicleContainer.h \ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -112,11 +112,11 @@ MSNet.$(OBJEXT) MSNoLogicJunction.$(OBJEXT) \ MSRightOfWayJunction.$(OBJEXT) MSRoute.$(OBJEXT) \ MSRouteHandler.$(OBJEXT) MSStoppingPlace.$(OBJEXT) \ - MSVehicle.$(OBJEXT) MSLeaderInfo.$(OBJEXT) \ - MSVehicleContainer.$(OBJEXT) MSVehicleControl.$(OBJEXT) \ - MSVehicleTransfer.$(OBJEXT) MSVehicleType.$(OBJEXT) \ - MSStateHandler.$(OBJEXT) MSTransportable.$(OBJEXT) \ - MSTransportableControl.$(OBJEXT) + MSParkingArea.$(OBJEXT) MSVehicle.$(OBJEXT) \ + MSLeaderInfo.$(OBJEXT) MSVehicleContainer.$(OBJEXT) \ + MSVehicleControl.$(OBJEXT) MSVehicleTransfer.$(OBJEXT) \ + MSVehicleType.$(OBJEXT) MSStateHandler.$(OBJEXT) \ + MSTransportable.$(OBJEXT) MSTransportableControl.$(OBJEXT) libmicrosim_a_OBJECTS = $(am_libmicrosim_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) @@ -408,6 +408,7 @@ MSRightOfWayJunction.cpp MSRightOfWayJunction.h \ MSRoute.cpp MSRoute.h MSRouteHandler.cpp MSRouteHandler.h \ MSStoppingPlace.cpp MSStoppingPlace.h \ +MSParkingArea.cpp MSParkingArea.h \ MSVehicle.cpp MSVehicle.h \ MSLeaderInfo.cpp MSLeaderInfo.h \ MSVehicleContainer.cpp MSVehicleContainer.h \ @@ -494,6 +495,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSMoveReminder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSNet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSNoLogicJunction.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSParkingArea.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSRightOfWayJunction.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSRoute.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSRouteHandler.Po@am__quote@ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSBaseVehicle.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSBaseVehicle.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSBaseVehicle.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSBaseVehicle.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Mon, 8 Nov 2010 -/// @version $Id: MSBaseVehicle.cpp 21790 2016-10-25 12:37:24Z behrisch $ +/// @version $Id: MSBaseVehicle.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A base class for vehicle implementations /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,10 +44,8 @@ #include "MSBaseVehicle.h" #include "MSNet.h" #include "devices/MSDevice.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS +#include "devices/MSDevice_Routing.h" +#include "MSInsertionControl.h" // =========================================================================== // static members @@ -61,13 +59,14 @@ // method definitions // =========================================================================== -SUMOReal +double MSBaseVehicle::getPreviousSpeed() const { throw ProcessError("getPreviousSpeed() is not available for non-MSVehicles."); } + MSBaseVehicle::MSBaseVehicle(SUMOVehicleParameter* pars, const MSRoute* route, - const MSVehicleType* type, const SUMOReal speedFactor) : + const MSVehicleType* type, const double speedFactor) : myParameter(pars), myRoute(route), myType(type), @@ -95,9 +94,16 @@ myRoute->addReference(); if (!pars->wasSet(VEHPARS_FORCE_REROUTE)) { calculateArrivalParams(); + if (MSGlobals::gCheckRoutes) { + std::string msg; + if (!hasValidRoute(msg)) { + throw ProcessError("Vehicle '" + pars->id + "' has no valid route. " + msg); + } + } } } + MSBaseVehicle::~MSBaseVehicle() { myRoute->release(); if (myParameter->repetitionNumber == 0) { @@ -122,7 +128,7 @@ } -SUMOReal +double MSBaseVehicle::getMaxSpeed() const { return myType->getMaxSpeed(); } @@ -181,22 +187,31 @@ } } router.compute(source, sink, this, t, edges); - if (!edges.empty() && edges.front()->getPurpose() == MSEdge::EDGEFUNCTION_DISTRICT) { + if (!edges.empty() && edges.front()->isTaz()) { edges.erase(edges.begin()); } - if (!edges.empty() && edges.back()->getPurpose() == MSEdge::EDGEFUNCTION_DISTRICT) { + if (!edges.empty() && edges.back()->isTaz()) { edges.pop_back(); } replaceRouteEdges(edges, onInit); // this must be called even if the route could not be replaced if (onInit) { + if (edges.empty()) { + if (MSGlobals::gCheckRoutes) { + throw ProcessError("Vehicle '" + getID() + "' has no valid route."); + } else if (source->isTaz()) { + WRITE_WARNING("Removing vehicle '" + getID() + "' which has no valid route."); + MSNet::getInstance()->getInsertionControl().descheduleDeparture(this); + return; + } + } calculateArrivalParams(); } } bool -MSBaseVehicle::replaceRouteEdges(ConstMSEdgeVector& edges, bool onInit, bool check) { +MSBaseVehicle::replaceRouteEdges(ConstMSEdgeVector& edges, bool onInit, bool check, bool addStops) { if (edges.empty()) { WRITE_WARNING("No route for vehicle '" + getID() + "' found."); return false; @@ -239,8 +254,7 @@ return false; } } - - if (!replaceRoute(newRoute, onInit, (int)edges.size() - oldSize)) { + if (!replaceRoute(newRoute, onInit, (int)edges.size() - oldSize, addStops)) { newRoute->addReference(); newRoute->release(); return false; @@ -249,13 +263,13 @@ } -SUMOReal +double MSBaseVehicle::getAcceleration() const { return 0; } -SUMOReal +double MSBaseVehicle::getSlope() const { return 0; } @@ -344,9 +358,9 @@ void -MSBaseVehicle::activateReminders(const MSMoveReminder::Notification reason) { +MSBaseVehicle::activateReminders(const MSMoveReminder::Notification reason, const MSLane* enteredLane) { for (MoveReminderCont::iterator rem = myMoveReminders.begin(); rem != myMoveReminders.end();) { - if (rem->first->notifyEnter(*this, reason)) { + if (rem->first->notifyEnter(*this, reason, enteredLane)) { #ifdef _DEBUG if (myTraceMoveReminders) { traceMoveReminder("notifyEnter", rem->first, rem->second, true); @@ -371,7 +385,7 @@ return; } const std::vector& lanes = myRoute->getLastEdge()->getLanes(); - const SUMOReal lastLaneLength = lanes[0]->getLength(); + const double lastLaneLength = lanes[0]->getLength(); switch (myParameter->arrivalPosProcedure) { case ARRIVAL_POS_GIVEN: if (fabs(myParameter->arrivalPos) > lastLaneLength) { @@ -380,11 +394,11 @@ // Maybe we should warn the user about invalid inputs! myArrivalPos = MIN2(myParameter->arrivalPos, lastLaneLength); if (myArrivalPos < 0) { - myArrivalPos = MAX2(myArrivalPos + lastLaneLength, static_cast(0)); + myArrivalPos = MAX2(myArrivalPos + lastLaneLength, 0.); } break; case ARRIVAL_POS_RANDOM: - myArrivalPos = RandHelper::rand(static_cast(0), lastLaneLength); + myArrivalPos = RandHelper::rand(0., lastLaneLength); break; default: myArrivalPos = lastLaneLength; @@ -407,12 +421,10 @@ } -SUMOReal +double MSBaseVehicle::getImpatience() const { - return MAX2((SUMOReal)0, MIN2((SUMOReal)1, getVehicleType().getImpatience() + - (MSGlobals::gTimeToGridlock > 0 ? (SUMOReal)getWaitingTime() / MSGlobals::gTimeToGridlock : 0))); -// Alternavite to avoid time to teleport effect on the simulation. No effect if time to teleport is -1 -// return MAX2((SUMOReal)0, MIN2((SUMOReal)1, getVehicleType().getImpatience())); + return MAX2(0., MIN2(1., getVehicleType().getImpatience() + + (MSGlobals::gTimeToImpatience > 0 ? (double)getWaitingTime() / MSGlobals::gTimeToImpatience : 0))); } @@ -429,10 +441,11 @@ void MSBaseVehicle::saveState(OutputDevice& out) { - out.openTag(SUMO_TAG_VEHICLE).writeAttr(SUMO_ATTR_ID, myParameter->id); - out.writeAttr(SUMO_ATTR_DEPART, time2string(myParameter->depart)); + // this saves lots of departParameters which are only needed for vehicles that did not yet depart + // the parameters may hold the name of a vTypeDistribution but we are interested in the actual type + myParameter->write(out, OptionsCont::getOptions(), SUMO_TAG_VEHICLE, getVehicleType().getID()); + // params and stops must be written in child classes since they may wish to add additional attributes first out.writeAttr(SUMO_ATTR_ROUTE, myRoute->getID()); - out.writeAttr(SUMO_ATTR_TYPE, myType->getID()); // here starts the vehicle internal part (see loading) // @note: remember to close the vehicle tag when calling this in a subclass! } @@ -460,6 +473,59 @@ } } + +bool +MSBaseVehicle::hasDevice(const std::string& deviceName) const { + for (std::vector::const_iterator dev = myDevices.begin(); dev != myDevices.end(); ++dev) { + if ((*dev)->deviceName() == deviceName) { + return true; + } + } + return false; +} + + +void +MSBaseVehicle::createDevice(const std::string& deviceName) { + if (!hasDevice(deviceName)) { + if (deviceName == "rerouting") { + ((SUMOVehicleParameter*)myParameter)->addParameter("has." + deviceName + ".device", "true"); + MSDevice_Routing::buildVehicleDevices(*this, myDevices); + if (hasDeparted()) { + // vehicle already departed: disable pre-insertion rerouting and enable regular routing behavior + MSDevice_Routing* routingDevice = static_cast(getDevice(typeid(MSDevice_Routing))); + assert(routingDevice != 0); + routingDevice->notifyEnter(*this, MSMoveReminder::NOTIFICATION_DEPARTED); + } + } else { + throw InvalidArgument("Creating device of type '" + deviceName + "' is not supported"); + } + } +} + + +std::string +MSBaseVehicle::getDeviceParameter(const std::string& deviceName, const std::string& key) const { + for (std::vector::const_iterator dev = myDevices.begin(); dev != myDevices.end(); ++dev) { + if ((*dev)->deviceName() == deviceName) { + return (*dev)->getParameter(key); + } + } + throw InvalidArgument("No device off type '" + deviceName + "' exists"); +} + + +void +MSBaseVehicle::setDeviceParameter(const std::string& deviceName, const std::string& key, const std::string& value) { + for (std::vector::iterator dev = myDevices.begin(); dev != myDevices.end(); ++dev) { + if ((*dev)->deviceName() == deviceName) { + (*dev)->setParameter(key, value); + return; + } + } + throw InvalidArgument("No device off type '" + deviceName + "' exists"); +} + #ifdef _DEBUG void MSBaseVehicle::initMoveReminderOutput(const OptionsCont& oc) { @@ -471,7 +537,7 @@ void -MSBaseVehicle::traceMoveReminder(const std::string& type, MSMoveReminder* rem, SUMOReal pos, bool keep) const { +MSBaseVehicle::traceMoveReminder(const std::string& type, MSMoveReminder* rem, double pos, bool keep) const { OutputDevice& od = OutputDevice::getDeviceByOption("movereminder-output"); od.openTag("movereminder"); od.writeAttr(SUMO_ATTR_TIME, STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep())); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSBaseVehicle.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSBaseVehicle.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSBaseVehicle.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSBaseVehicle.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Mon, 8 Nov 2010 -/// @version $Id: MSBaseVehicle.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSBaseVehicle.h 23698 2017-03-28 21:55:50Z namdre $ /// // A base class for vehicle implementations /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -62,7 +62,7 @@ /** @brief Returns the vehicle's previous speed * @return The vehicle's speed */ - SUMOReal getPreviousSpeed() const; + double getPreviousSpeed() const; friend class GUIBaseVehicle; @@ -74,7 +74,7 @@ * @exception ProcessError If a value is wrong */ MSBaseVehicle(SUMOVehicleParameter* pars, const MSRoute* route, - const MSVehicleType* type, const SUMOReal speedFactor); + const MSVehicleType* type, const double speedFactor); /// @brief Destructor @@ -90,6 +90,17 @@ */ const SUMOVehicleParameter& getParameter() const; + /// @brief check whether the vehicle is equiped with a device of the given type + bool hasDevice(const std::string& deviceName) const; + + /// @brief create device of the given type + void createDevice(const std::string& deviceName); + + /// @brief try to retrieve the given parameter from any of the vehicles devices, raise InvalidArgument if no device parameter by that name exists + std::string getDeviceParameter(const std::string& deviceName, const std::string& key) const; + + /// @brief try to set the given parameter from any of the vehicles devices, raise InvalidArgument if no device parameter by that name exists + void setDeviceParameter(const std::string& deviceName, const std::string& key, const std::string& value); /** @brief Returns the current route * @return The route the vehicle uses @@ -117,7 +128,7 @@ /** @brief Returns the maximum speed * @return The vehicle's maximum speed */ - SUMOReal getMaxSpeed() const; + double getMaxSpeed() const; /** @brief Returns the nSuccs'th successor of edge the vehicle is currently at @@ -162,7 +173,7 @@ * @return The lateral position of the vehicle (in m relative to the * centerline of the lane) */ - virtual SUMOReal getLateralPositionOnLane() const { + virtual double getLateralPositionOnLane() const { return 0; } @@ -205,9 +216,10 @@ * @param[in] edges The new list of edges to pass * @param[in] onInit Whether the vehicle starts with this route * @param[in] check Whether the route should be checked for validity + * @param[in] addStops Parameter for replaceRoute * @return Whether the new route was accepted */ - bool replaceRouteEdges(ConstMSEdgeVector& edges, bool onInit = false, bool check = false); + bool replaceRouteEdges(ConstMSEdgeVector& edges, bool onInit = false, bool check = false, bool addStops = true); /** @brief Returns the vehicle's acceleration @@ -215,14 +227,14 @@ * This default implementation returns always 0. * @return The acceleration */ - virtual SUMOReal getAcceleration() const; + virtual double getAcceleration() const; /** @brief Returns the slope of the road at vehicle's position * * This default implementation returns always 0. * @return The slope */ - virtual SUMOReal getSlope() const; + virtual double getSlope() const; /** @brief Called when the vehicle is inserted into the network * @@ -247,7 +259,7 @@ /** @brief Returns this vehicle's real departure position * @return This vehicle's real departure position */ - inline SUMOReal getDepartPos() const { + inline double getDepartPos() const { return myDepartPos; } @@ -255,13 +267,13 @@ * (may change on reroute) * @return This vehicle's real arrivalPos */ - virtual SUMOReal getArrivalPos() const { + virtual double getArrivalPos() const { return myArrivalPos; } /** @brief Sets this vehicle's desired arrivalPos for its current route */ - virtual void setArrivalPos(SUMOReal arrivalPos) { + virtual void setArrivalPos(double arrivalPos) { myArrivalPos = arrivalPos; } @@ -282,7 +294,7 @@ } /// @brief Returns this vehicles impatience - SUMOReal getImpatience() const; + double getImpatience() const; /** @brief Returns this vehicle's devices @@ -336,23 +348,24 @@ * "MSMoveReminder::notifyEnter" is called. * * @param[in] reason The reason for changing the reminders' states + * @param[in] enteredLane The lane, which is entered (if applicable) * @see MSMoveReminder * @see MSMoveReminder::notifyEnter * @see MSMoveReminder::Notification */ - virtual void activateReminders(const MSMoveReminder::Notification reason); + virtual void activateReminders(const MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /** @brief Returns the precomputed factor by which the driver wants to be faster than the speed limit * @return Speed limit factor */ - inline SUMOReal getChosenSpeedFactor() const { + inline double getChosenSpeedFactor() const { return myChosenSpeedFactor; } /** @brief Returns the precomputed factor by which the driver wants to be faster than the speed limit * @return Speed limit factor */ - inline void setChosenSpeedFactor(const SUMOReal factor) { + inline void setChosenSpeedFactor(const double factor) { myChosenSpeedFactor = factor; } @@ -400,18 +413,18 @@ MSRouteIterator myCurrEdge; /// @brief A precomputed factor by which the driver wants to be faster than the speed limit - SUMOReal myChosenSpeedFactor; + double myChosenSpeedFactor; /// @name Move reminder structures /// @{ /// @brief Definition of a move reminder container - // The SUMOReal value holds the relative position offset, i.e., + // The double value holds the relative position offset, i.e., // offset + vehicle-position - moveReminder-position = distance, // i.e. the offset is counted up when the vehicle continues to a // succeeding lane. - typedef std::vector< std::pair > MoveReminderCont; + typedef std::vector< std::pair > MoveReminderCont; /// @brief Currently relevant move reminders MoveReminderCont myMoveReminders; @@ -424,10 +437,10 @@ SUMOTime myDeparture; /// @brief The real depart position - SUMOReal myDepartPos; + double myDepartPos; /// @brief The position on the destination lane where the vehicle stops - SUMOReal myArrivalPos; + double myArrivalPos; /// @brief The destination lane where the vehicle stops int myArrivalLane; @@ -451,7 +464,7 @@ protected: /// @brief optionally generate movereminder-output for this vehicle - void traceMoveReminder(const std::string& type, MSMoveReminder* rem, SUMOReal pos, bool keep) const; + void traceMoveReminder(const std::string& type, MSMoveReminder* rem, double pos, bool keep) const; /// @brief whether this vehicle shall trace its moveReminders const bool myTraceMoveReminders; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSBitSetLogic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSBitSetLogic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSBitSetLogic.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSBitSetLogic.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Wed, 12 Dez 2001 -/// @version $Id: MSBitSetLogic.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSBitSetLogic.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Container for holding a right-of-way matrix /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSCModel_NonInteracting.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSCModel_NonInteracting.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSCModel_NonInteracting.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSCModel_NonInteracting.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Melanie Weber /// @author Andreas Kendziorra /// @date Tue, 29 July 2014 -/// @version $Id: MSCModel_NonInteracting.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSCModel_NonInteracting.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // The container following model for tranship (prototype) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -49,7 +49,7 @@ const int CState::FORWARD(1); const int CState::BACKWARD(-1); const int CState::UNDEFINED_DIRECTION(0); -const SUMOReal CState::LATERAL_OFFSET(0); +const double CState::LATERAL_OFFSET(0); // =========================================================================== // MSCModel_NonInteracting method definitions @@ -77,8 +77,7 @@ MSCModel_NonInteracting::add(MSTransportable* container, MSContainer::MSContainerStage_Tranship* stage, SUMOTime now) { CState* state = new CState(); const SUMOTime firstEdgeDuration = state->computeTranshipTime(0, *stage, now); - myNet->getBeginOfTimestepEvents()->addEvent(new MoveToNextEdge(container, *stage), - now + firstEdgeDuration, MSEventControl::ADAPT_AFTER_EXECUTION); + myNet->getBeginOfTimestepEvents()->addEvent(new MoveToNextEdge(container, *stage), now + firstEdgeDuration); return state; } @@ -107,7 +106,7 @@ } -SUMOReal +double CState::getEdgePos(const MSContainer::MSContainerStage_Tranship&, SUMOTime now) const { return myCurrentBeginPos + (myCurrentEndPos - myCurrentBeginPos) / myCurrentDuration * (now - myLastEntryTime); } @@ -115,15 +114,15 @@ Position CState::getPosition(const MSContainer::MSContainerStage_Tranship& stage, SUMOTime now) const { - const SUMOReal dist = myCurrentBeginPosition.distanceTo2D(myCurrentEndPosition); //distance between begin and end position of this tranship stage - SUMOReal pos = MIN2(STEPS2TIME(now - myLastEntryTime) * stage.getMaxSpeed(), dist); //the containerd shall not go beyond its end position + const double dist = myCurrentBeginPosition.distanceTo2D(myCurrentEndPosition); //distance between begin and end position of this tranship stage + double pos = MIN2(STEPS2TIME(now - myLastEntryTime) * stage.getMaxSpeed(), dist); //the containerd shall not go beyond its end position return PositionVector::positionAtOffset2D(myCurrentBeginPosition, myCurrentEndPosition, pos, 0); } -SUMOReal +double CState::getAngle(const MSContainer::MSContainerStage_Tranship& stage, SUMOTime now) const { - SUMOReal angle = stage.getEdgeAngle(stage.getEdge(), getEdgePos(stage, now)) + (myCurrentEndPos < myCurrentBeginPos ? 1.5 * M_PI : 0.5 * M_PI); + double angle = stage.getEdgeAngle(stage.getEdge(), getEdgePos(stage, now)) + (myCurrentEndPos < myCurrentBeginPos ? 1.5 * M_PI : 0.5 * M_PI); if (angle > M_PI) { angle -= 2 * M_PI; } @@ -131,7 +130,7 @@ } -SUMOReal +double CState::getSpeed(const MSContainer::MSContainerStage_Tranship& stage) const { return stage.getMaxSpeed(); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSCModel_NonInteracting.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSCModel_NonInteracting.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSCModel_NonInteracting.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSCModel_NonInteracting.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Melanie Weber /// @author Andreas Kendziorra /// @date Tue, 29 July 2014 -/// @version $Id: MSCModel_NonInteracting.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSCModel_NonInteracting.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The container following model for tranship (prototype) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -19,7 +19,7 @@ // /****************************************************************************/ #ifndef MSCModel_NonInteracting_h -#define MSCModel_NonInteracting_h +#define MSCModel_NonInteracting_h // =========================================================================== // included modules @@ -108,16 +108,16 @@ static const int UNDEFINED_DIRECTION; /// @brief the offset for computing container positions when being transhiped - static const SUMOReal LATERAL_OFFSET; + static const double LATERAL_OFFSET; /// @brief return the offset from the start of the current edge measured in its natural direction - SUMOReal getEdgePos(const MSContainer::MSContainerStage_Tranship& stage, SUMOTime now) const; + double getEdgePos(const MSContainer::MSContainerStage_Tranship& stage, SUMOTime now) const; /// @brief return the network coordinate of the container Position getPosition(const MSContainer::MSContainerStage_Tranship& stage, SUMOTime now) const; /// @brief return the direction in which the container heading to - SUMOReal getAngle(const MSContainer::MSContainerStage_Tranship& stage, SUMOTime now) const; + double getAngle(const MSContainer::MSContainerStage_Tranship& stage, SUMOTime now) const; /// @brief return the current speed of the container - SUMOReal getSpeed(const MSContainer::MSContainerStage_Tranship& stage) const; + double getSpeed(const MSContainer::MSContainerStage_Tranship& stage) const; /// @brief compute tranship time on edge and update state members SUMOTime computeTranshipTime(const MSEdge* prev, const MSContainer::MSContainerStage_Tranship& stage, SUMOTime currentTime); @@ -125,13 +125,13 @@ private: SUMOTime myLastEntryTime; SUMOTime myCurrentDuration; - SUMOReal myCurrentBeginPos; - SUMOReal myCurrentEndPos; + double myCurrentBeginPos; + double myCurrentEndPos; Position myCurrentBeginPosition; //the position the container is moving from during its tranship stage Position myCurrentEndPosition; //the position the container is moving to during its tranship stage }; -#endif /* MSCModel_NonInteracting_h */ +#endif /* MSCModel_NonInteracting_h */ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSContainer.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSContainer.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSContainer.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSContainer.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Melanie Weber /// @author Andreas Kendziorra /// @date Thu, 12 Jun 2014 -/// @version $Id: MSContainer.cpp 20773 2016-05-20 13:43:03Z behrisch $ +/// @version $Id: MSContainer.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The class for modelling container-movements /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,10 +45,6 @@ #include "MSVehicle.h" #include "MSCModel_NonInteracting.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== @@ -56,7 +52,7 @@ * MSContainer::MSContainerStage_Driving - methods * ----------------------------------------------------------------------- */ MSContainer::MSContainerStage_Driving::MSContainerStage_Driving(const MSEdge& destination, - MSStoppingPlace* toStop, const SUMOReal arrivalPos, const std::vector& lines) + MSStoppingPlace* toStop, const double arrivalPos, const std::vector& lines) : MSTransportable::Stage_Driving(destination, toStop, arrivalPos, lines) {} @@ -113,8 +109,8 @@ * ----------------------------------------------------------------------- */ MSContainer::MSContainerStage_Tranship::MSContainerStage_Tranship(const std::vector& route, MSStoppingPlace* toStop, - SUMOReal speed, - SUMOReal departPos, SUMOReal arrivalPos) : + double speed, + double departPos, double arrivalPos) : MSTransportable::Stage(*route.back(), toStop, SUMOVehicleParameter::interpretEdgePos( arrivalPos, route.back()->getLength(), SUMO_ATTR_ARRIVALPOS, "container getting transhipped to " + route.back()->getID()), MOVING_WITHOUT_VEHICLE), myRoute(route), mySpeed(speed), myContainerState(0), myCurrentInternalEdge(0) { @@ -153,7 +149,7 @@ return myRoute.back(); } -SUMOReal +double MSContainer::MSContainerStage_Tranship::getEdgePos(SUMOTime now) const { return myContainerState->getEdgePos(*this, now); } @@ -163,7 +159,7 @@ return myContainerState->getPosition(*this, now); } -SUMOReal +double MSContainer::MSContainerStage_Tranship::getAngle(SUMOTime now) const { return myContainerState->getAngle(*this, now); } @@ -173,12 +169,18 @@ return 0; } -SUMOReal +double MSContainer::MSContainerStage_Tranship::getSpeed() const { return myContainerState->getSpeed(*this); } +ConstMSEdgeVector +MSContainer::MSContainerStage_Tranship::getEdges() const { + return myRoute; +} + + void MSContainer::MSContainerStage_Tranship::tripInfoOutput(OutputDevice& os) const { os.openTag("tranship").writeAttr("arrival", time2string(myArrived)).closeTag(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSContainer.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSContainer.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSContainer.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSContainer.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Melanie Weber /// @author Andreas Kendziorra /// @date Thu, 12 Jun 2014 -/// @version $Id: MSContainer.h 20768 2016-05-20 08:38:44Z behrisch $ +/// @version $Id: MSContainer.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The class for modelling container-movements /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -78,7 +78,7 @@ public: /// constructor MSContainerStage_Driving(const MSEdge& destination, MSStoppingPlace* toStop, - const SUMOReal arrivalPos, const std::vector& lines); + const double arrivalPos, const std::vector& lines); /// destructor ~MSContainerStage_Driving(); @@ -114,7 +114,7 @@ public: /// constructor - MSContainerStage_Tranship(const std::vector& route, MSStoppingPlace* toStop, SUMOReal speed, SUMOReal departPos, SUMOReal arrivalPos); + MSContainerStage_Tranship(const std::vector& route, MSStoppingPlace* toStop, double speed, double departPos, double arrivalPos); /// destructor ~MSContainerStage_Tranship(); @@ -132,19 +132,22 @@ const MSEdge* getToEdge() const; /// Returns the offset from the start of the current edge measured in its natural direction - SUMOReal getEdgePos(SUMOTime now) const; + double getEdgePos(SUMOTime now) const; /// Returns the position of the container Position getPosition(SUMOTime now) const; /// Returns the angle of the container - SUMOReal getAngle(SUMOTime now) const; + double getAngle(SUMOTime now) const; /// Returns the time the container spent waiting SUMOTime getWaitingTime(SUMOTime now) const; /// Returns the speed of the container - SUMOReal getSpeed() const; + double getSpeed() const; + + /// @brief the edges of the current stage + ConstMSEdgeVector getEdges() const; /// Returns the current stage description as a string std::string getStageDescription() const { @@ -180,15 +183,15 @@ /// @brief accessors to be used by MSCModel_NonInteracting - inline SUMOReal getMaxSpeed() const { + inline double getMaxSpeed() const { return mySpeed; } - inline SUMOReal getDepartPos() const { + inline double getDepartPos() const { return myDepartPos; } - inline SUMOReal getArrivalPos() const { + inline double getArrivalPos() const { return myArrivalPos; } @@ -208,10 +211,10 @@ std::vector::iterator myRouteStep; /// @brief the depart position - SUMOReal myDepartPos; + double myDepartPos; /// @brief the speed of the container - SUMOReal mySpeed; + double mySpeed; /// @brief state that is to be manipulated by MSCModel CState* myContainerState; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSEdgeControl.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSEdgeControl.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSEdgeControl.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSEdgeControl.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 09 Apr 2001 -/// @version $Id: MSEdgeControl.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSEdgeControl.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Stores edges and lanes, performs moving of vehicle /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions @@ -204,6 +200,16 @@ myChangedStateLanes.insert(l); } +void +MSEdgeControl::setAdditionalRestrictions() { + for (MSEdgeVector::const_iterator i = myEdges.begin(); i != myEdges.end(); ++i) { + const std::vector& lanes = (*i)->getLanes(); + for (std::vector::const_iterator j = lanes.begin(); j != lanes.end(); ++j) { + (*j)->initRestrictions(); + } + } +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSEdgeControl.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSEdgeControl.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSEdgeControl.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSEdgeControl.h 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Mon, 09 Apr 2001 -/// @version $Id: MSEdgeControl.h 21018 2016-06-21 11:53:01Z behrisch $ +/// @version $Id: MSEdgeControl.h 22998 2017-02-17 08:46:10Z namdre $ /// // Stores edges and lanes, performs moving of vehicle /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -175,6 +175,9 @@ */ void gotActive(MSLane* l); + /// @brief apply additional restrictions + void setAdditionalRestrictions(); + public: /** diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSEdge.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSEdge.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSEdge.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSEdge.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -8,12 +8,12 @@ /// @author Michael Behrisch /// @author Sascha Krieg /// @date Tue, 06 Mar 2001 -/// @version $Id: MSEdge.cpp 21734 2016-10-18 10:59:35Z namdre $ +/// @version $Id: MSEdge.cpp 24112 2017-04-28 06:30:17Z namdre $ /// // A road/street connecting two junctions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -57,10 +57,7 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - +#define BEST_LANE_LOOKAHEAD 3000.0 // =========================================================================== // static member definitions @@ -110,25 +107,20 @@ MSEdge::initialize(const std::vector* lanes) { assert(lanes != 0); myLanes = lanes; - if (!lanes->empty()) { - recalcCache(); - } if (myFunction == EDGEFUNCTION_DISTRICT) { myCombinedPermissions = SVCAll; } for (std::vector::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) { myWidth += (*i)->getWidth(); } - if (MSGlobals::gLateralResolution > 0 || MSGlobals::gLaneChangeDuration > 0) { - SUMOReal widthBefore = 0; - for (std::vector::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) { - (*i)->setRightSideOnEdge(widthBefore, (int)mySublaneSides.size()); - MSLeaderInfo ahead(*i); - for (int j = 0; j < ahead.numSublanes(); ++j) { - mySublaneSides.push_back(widthBefore + j * MSGlobals::gLateralResolution); - } - widthBefore += (*i)->getWidth(); + double widthBefore = 0; + for (std::vector::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) { + (*i)->setRightSideOnEdge(widthBefore, (int)mySublaneSides.size()); + MSLeaderInfo ahead(*i); + for (int j = 0; j < ahead.numSublanes(); ++j) { + mySublaneSides.push_back(widthBefore + j * MSGlobals::gLateralResolution); } + widthBefore += (*i)->getWidth(); } } @@ -140,7 +132,7 @@ myLength = myLanes->front()->getLength(); myEmptyTraveltime = myLength / MAX2(getSpeedLimit(), NUMERICAL_EPS); - if (MSGlobals::gMesoTLSPenalty > 0) { + if (MSGlobals::gMesoTLSPenalty > 0 || MSGlobals::gMesoMinorPenalty > 0) { // add tls penalties to the minimum travel time SUMOTime minPenalty = -1; for (std::vector::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) { @@ -148,10 +140,11 @@ const MSLinkCont& lc = l->getLinkCont(); for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) { MSLink* link = *j; + SUMOTime linkPenalty = link->getMesoTLSPenalty() + (link->havePriority() ? 0 : MSGlobals::gMesoMinorPenalty); if (minPenalty == -1) { - minPenalty = link->getMesoTLSPenalty(); + minPenalty = linkPenalty; } else { - minPenalty = MIN2(minPenalty, link->getMesoTLSPenalty()); + minPenalty = MIN2(minPenalty, linkPenalty); } } } @@ -186,7 +179,6 @@ } myAllowed[&to]->push_back(*i); } -#ifdef HAVE_INTERNAL_LANES toL = (*j)->getViaLane(); if (toL != 0) { MSEdge& to = toL->getEdge(); @@ -194,11 +186,11 @@ to.myPredecessors.push_back(this); } } -#endif } } std::sort(mySuccessors.begin(), mySuccessors.end(), by_id_sorter()); rebuildAllowedLanes(); + recalcCache(); // segment building depends on the finished list of successors (for multi-queue) if (MSGlobals::gUseMesoSim && !myLanes->empty()) { MSGlobals::gMesoNet->buildSegmentsFor(*this, OptionsCont::getOptions()); @@ -394,24 +386,79 @@ MSLane* -MSEdge::getFreeLane(const std::vector* allowed, const SUMOVehicleClass vclass) const { +MSEdge::getFreeLane(const std::vector* allowed, const SUMOVehicleClass vclass, double departPos) const { if (allowed == 0) { allowed = allowedLanes(vclass); } MSLane* res = 0; if (allowed != 0) { - SUMOReal leastOccupancy = std::numeric_limits::max();; + double largestGap = 0; + MSLane* resByGap = 0; + double leastOccupancy = std::numeric_limits::max();; for (std::vector::const_iterator i = allowed->begin(); i != allowed->end(); ++i) { - const SUMOReal occupancy = (*i)->getBruttoOccupancy(); + const double occupancy = (*i)->getBruttoOccupancy(); if (occupancy < leastOccupancy) { res = (*i); leastOccupancy = occupancy; } + const MSVehicle* last = (*i)->getLastFullVehicle(); + const double lastGap = (last != 0 ? last->getPositionOnLane() : myLength) - departPos; + if (lastGap > largestGap) { + largestGap = lastGap; + resByGap = (*i); + } + } + if (resByGap != 0) { + //if (res != resByGap) std::cout << SIMTIME << " edge=" << getID() << " departPos=" << departPos << " res=" << Named::getIDSecure(res) << " resByGap=" << Named::getIDSecure(resByGap) << " largestGap=" << largestGap << "\n"; + res = resByGap; } } return res; } +double +MSEdge::getDepartPosBound(const MSVehicle& veh, bool upper) const { + const SUMOVehicleParameter& pars = veh.getParameter(); + double pos = getLength(); + // determine the position + switch (pars.departPosProcedure) { + case DEPART_POS_GIVEN: + pos = pars.departPos; + if (pos < 0.) { + pos += myLength; + } + break; + case DEPART_POS_RANDOM: + // could be any position on the edge + break; + case DEPART_POS_RANDOM_FREE: + // could be any position on the edge due to multiple random attempts + break; + case DEPART_POS_FREE: + // many candidate positions, upper bound could be computed exactly + // with much effort + break; + case DEPART_POS_LAST: + if (upper) { + for (std::vector::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) { + MSVehicle* last = (*i)->getLastFullVehicle(); + if (last != 0) { + pos = MIN2(pos, last->getPositionOnLane()); + } + } + } else { + pos = 0; + } + case DEPART_POS_BASE: + case DEPART_POS_DEFAULT: + break; + default: + pos = MIN2(pos, veh.getVehicleType().getLength()); + break; + } + return pos; +} + MSLane* MSEdge::getDepartLane(MSVehicle& veh) const { @@ -424,29 +471,37 @@ case DEPART_LANE_RANDOM: return RandHelper::getRandomFrom(*allowedLanes(veh.getVehicleType().getVehicleClass())); case DEPART_LANE_FREE: - return getFreeLane(0, veh.getVehicleType().getVehicleClass()); + return getFreeLane(0, veh.getVehicleType().getVehicleClass(), getDepartPosBound(veh, false)); case DEPART_LANE_ALLOWED_FREE: if (veh.getRoute().size() == 1) { - return getFreeLane(0, veh.getVehicleType().getVehicleClass()); + return getFreeLane(0, veh.getVehicleType().getVehicleClass(), getDepartPosBound(veh, false)); } else { - return getFreeLane(allowedLanes(**(veh.getRoute().begin() + 1)), veh.getVehicleType().getVehicleClass()); + return getFreeLane(allowedLanes(**(veh.getRoute().begin() + 1)), veh.getVehicleType().getVehicleClass(), getDepartPosBound(veh, false)); } case DEPART_LANE_BEST_FREE: { veh.updateBestLanes(false, myLanes->front()); const std::vector& bl = veh.getBestLanes(); - SUMOReal bestLength = -1; + double bestLength = -1; for (std::vector::const_iterator i = bl.begin(); i != bl.end(); ++i) { if ((*i).length > bestLength) { bestLength = (*i).length; } } + // beyond a certain length, all lanes are suitable + // however, we still need to check departPos to avoid unsuitable insertion + // (this is only possible in some cases) + double departPos = 0; + if (bestLength > BEST_LANE_LOOKAHEAD) { + departPos = getDepartPosBound(veh); + bestLength = MIN2(bestLength - departPos, BEST_LANE_LOOKAHEAD); + } std::vector* bestLanes = new std::vector(); for (std::vector::const_iterator i = bl.begin(); i != bl.end(); ++i) { - if ((*i).length == bestLength) { + if (((*i).length - departPos) >= bestLength) { bestLanes->push_back((*i).lane); } } - MSLane* ret = getFreeLane(bestLanes, veh.getVehicleType().getVehicleClass()); + MSLane* ret = getFreeLane(bestLanes, veh.getVehicleType().getVehicleClass(), getDepartPosBound(veh, false)); delete bestLanes; return ret; } @@ -469,20 +524,18 @@ bool -MSEdge::insertVehicle(SUMOVehicle& v, SUMOTime time, const bool checkOnly) const { +MSEdge::insertVehicle(SUMOVehicle& v, SUMOTime time, const bool checkOnly, const bool forceCheck) const { // when vaporizing, no vehicles are inserted, but checking needs to be successful to trigger removal - if (isVaporizing()) { + if (isVaporizing() || isTaz()) { return checkOnly; } - if (isTaz() && checkOnly) { - return true; - } const SUMOVehicleParameter& pars = v.getParameter(); const MSVehicleType& type = v.getVehicleType(); if (pars.departSpeedProcedure == DEPART_SPEED_GIVEN && pars.departSpeed > getVehicleMaxSpeed(&v)) { - if (type.getSpeedDeviation() > 0) { - v.setChosenSpeedFactor(type.computeChosenSpeedDeviation(0, pars.departSpeed / (type.getSpeedFactor() * getSpeedLimit()))); - if (v.getChosenSpeedFactor() > type.getSpeedFactor() * (2 * type.getSpeedDeviation() + 1)) { + const std::vector& speedFactorParams = type.getSpeedFactor().getParameter(); + if (speedFactorParams[1] > 0.) { + v.setChosenSpeedFactor(type.computeChosenSpeedDeviation(0, pars.departSpeed / getSpeedLimit())); + if (v.getChosenSpeedFactor() > speedFactorParams[0] + 2 * speedFactorParams[1]) { // only warn for significant deviation WRITE_WARNING("Choosing new speed factor " + toString(v.getChosenSpeedFactor()) + " for vehicle '" + pars.id + "' to match departure speed."); } @@ -491,20 +544,8 @@ "' is too high for the departure edge '" + getID() + "'."); } } - if (!checkOnly) { - std::string msg; - if (!v.hasValidRoute(msg)) { - if (MSGlobals::gCheckRoutes) { - throw ProcessError("Vehicle '" + v.getID() + "' has no valid route. " + msg); - } else if (v.getEdge()->getPurpose() == MSEdge::EDGEFUNCTION_DISTRICT) { - WRITE_WARNING("Removing vehicle '" + pars.id + "' which has no valid route."); - MSNet::getInstance()->getInsertionControl().descheduleDeparture(&v); - return false; - } - } - } if (MSGlobals::gUseMesoSim) { - SUMOReal pos = 0.0; + double pos = 0.0; switch (pars.departPosProcedure) { case DEPART_POS_GIVEN: if (pars.departPos >= 0.) { @@ -556,13 +597,13 @@ WRITE_WARNING("could not insert vehicle '" + v.getID() + "' on any lane of edge '" + getID() + "', time=" + time2string(MSNet::getInstance()->getCurrentTimeStep())); return false; } - const SUMOReal occupancy = insertionLane->getBruttoOccupancy(); - return occupancy == (SUMOReal)0 || occupancy * myLength + v.getVehicleType().getLengthWithGap() <= myLength; + const double occupancy = insertionLane->getBruttoOccupancy(); + return occupancy == 0 || occupancy * myLength + v.getVehicleType().getLengthWithGap() <= myLength; } default: for (std::vector::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) { - const SUMOReal occupancy = (*i)->getBruttoOccupancy(); - if (occupancy == (SUMOReal)0 || occupancy * myLength + v.getVehicleType().getLengthWithGap() <= myLength) { + const double occupancy = (*i)->getBruttoOccupancy(); + if (occupancy == 0 || occupancy * myLength + v.getVehicleType().getLengthWithGap() <= myLength) { return true; } } @@ -570,7 +611,28 @@ return false; } MSLane* insertionLane = getDepartLane(static_cast(v)); - return insertionLane != 0 && insertionLane->insertVehicle(static_cast(v)); + if (insertionLane == 0) { + return false; + } + + if (!forceCheck) { + if (myLastFailedInsertionTime == time) { + if (myFailedInsertionMemory.count(insertionLane->getIndex())) { + // A vehicle was already rejected for the proposed insertionLane in this timestep + return false; + } + } else { + // last rejection occured in a previous timestep, clear cache + myFailedInsertionMemory.clear(); + } + } + + bool success = insertionLane->insertVehicle(static_cast(v)); + + if (!success) { + myFailedInsertionMemory.insert(insertionLane->getIndex()); + } + return success; } @@ -579,30 +641,11 @@ if (myLaneChanger == 0) { return; } - if (myFunction == EDGEFUNCTION_INTERNAL) { - // allow changing only if all links leading to this internal lane have priority - // or they are controlled by a traffic light - for (std::vector::const_iterator it = myLanes->begin(); it != myLanes->end(); ++it) { - MSLane* pred = (*it)->getLogicalPredecessorLane(); - MSLink* link = MSLinkContHelper::getConnectingLink(*pred, **it); - assert(link != 0); - LinkState state = link->getState(); - if (state == LINKSTATE_MINOR - || state == LINKSTATE_EQUAL - || state == LINKSTATE_STOP - || state == LINKSTATE_ALLWAY_STOP - || state == LINKSTATE_ZIPPER - || state == LINKSTATE_DEADEND) { - return; - } - } - } myLaneChanger->laneChange(t); } -#ifdef HAVE_INTERNAL_LANES const MSEdge* MSEdge::getInternalFollowingEdge(const MSEdge* followerAfterInternal) const { //@todo to be optimized @@ -622,16 +665,28 @@ } return 0; } -#endif +double +MSEdge::getInternalFollowingLengthTo(const MSEdge* followerAfterInternal) const { + assert(followerAfterInternal != 0); + assert(!followerAfterInternal->isInternal()); + double dist = 0.; + const MSEdge* edge = getInternalFollowingEdge(followerAfterInternal); + // Take into account non-internal lengths until next non-internal edge + while (edge != 0 && edge->isInternal()) { + dist += edge->getLength(); + edge = edge->getInternalFollowingEdge(followerAfterInternal); + } + return dist; +} -SUMOReal +double MSEdge::getMeanSpeed() const { - SUMOReal v = 0; - SUMOReal no = 0; + double v = 0; + double no = 0; if (MSGlobals::gUseMesoSim) { for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) { - const SUMOReal vehNo = (SUMOReal) segment->getCarNumber(); + const double vehNo = (double) segment->getCarNumber(); v += vehNo * segment->getMeanSpeed(); no += vehNo; } @@ -640,7 +695,7 @@ } } else { for (std::vector::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) { - const SUMOReal vehNo = (SUMOReal)(*i)->getVehicleNumber(); + const double vehNo = (double)(*i)->getVehicleNumber(); v += vehNo * (*i)->getMeanSpeed(); no += vehNo; } @@ -652,8 +707,8 @@ } -SUMOReal -MSEdge::getCurrentTravelTime(SUMOReal minSpeed) const { +double +MSEdge::getCurrentTravelTime(double minSpeed) const { assert(minSpeed > 0); if (!myAmDelayed) { return myEmptyTraveltime; @@ -662,7 +717,7 @@ } -SUMOReal +double MSEdge::getRoutingSpeed() const { return MSDevice_Routing::getAssumedSpeed(this); } @@ -755,7 +810,7 @@ } -SUMOReal +double MSEdge::getDistanceTo(const MSEdge* other) const { if (getLanes().size() > 0 && other->getLanes().size() > 0) { return getToJunction()->getPosition().distanceTo2D(other->getFromJunction()->getPosition()); @@ -765,22 +820,27 @@ } -SUMOReal +double MSEdge::getSpeedLimit() const { // @note lanes might have different maximum speeds in theory - return getLanes()[0]->getSpeedLimit(); + return myLanes->empty() ? 1 : getLanes()[0]->getSpeedLimit(); } -SUMOReal +double +MSEdge::getLengthGeometryFactor() const { + return myLanes->empty() ? 1 : getLanes()[0]->getLengthGeometryFactor(); +} + +double MSEdge::getVehicleMaxSpeed(const SUMOVehicle* const veh) const { // @note lanes might have different maximum speeds in theory - return getLanes()[0]->getVehicleMaxSpeed(veh); + return myLanes->empty() ? 1 : getLanes()[0]->getVehicleMaxSpeed(veh); } void -MSEdge::setMaxSpeed(SUMOReal val) const { +MSEdge::setMaxSpeed(double val) const { if (myLanes != 0) { for (std::vector::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) { (*i)->setMaxSpeed(val); @@ -791,15 +851,25 @@ std::vector -MSEdge::getSortedPersons(SUMOTime timestep) const { +MSEdge::getSortedPersons(SUMOTime timestep, bool includeRiding) const { std::vector result(myPersons.begin(), myPersons.end()); + if (includeRiding) { + for (std::vector::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) { + const MSLane::VehCont& vehs = (*i)->getVehiclesSecure(); + for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) { + const std::vector& persons = (*j)->getPersons(); + result.insert(result.end(), persons.begin(), persons.end()); + } + (*i)->releaseVehicles(); + } + } sort(result.begin(), result.end(), transportable_by_position_sorter(timestep)); return result; } std::vector -MSEdge::getSortedContainers(SUMOTime timestep) const { +MSEdge::getSortedContainers(SUMOTime timestep, bool /* includeRiding */) const { std::vector result(myContainers.begin(), myContainers.end()); sort(result.begin(), result.end(), transportable_by_position_sorter(timestep)); return result; @@ -808,8 +878,8 @@ int MSEdge::transportable_by_position_sorter::operator()(const MSTransportable* const c1, const MSTransportable* const c2) const { - const SUMOReal pos1 = c1->getCurrentStage()->getEdgePos(myTime); - const SUMOReal pos2 = c2->getCurrentStage()->getEdgePos(myTime); + const double pos1 = c1->getCurrentStage()->getEdgePos(myTime); + const double pos2 = c2->getCurrentStage()->getEdgePos(myTime); if (pos1 != pos2) { return pos1 < pos2; } @@ -855,8 +925,25 @@ bool MSEdge::canChangeToOpposite() { - return !myLanes->empty() && myLanes->back()->getOpposite() != 0; + return (!myLanes->empty() && myLanes->back()->getOpposite() != 0 && + // do not change on curved internal lanes + (!isInternal() || myLanes->back()->getIncomingLanes()[0].viaLink->getDirection() == LINKDIR_STRAIGHT)); } + +bool +MSEdge::hasMinorLink() const { + for (std::vector::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) { + const MSLinkCont& lc = (*i)->getLinkCont(); + for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) { + if (!(*j)->havePriority()) { + return true; + } + } + } + return false; +} + + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSEdge.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSEdge.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSEdge.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSEdge.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Mon, 12 Mar 2001 -/// @version $Id: MSEdge.h 21667 2016-10-12 09:17:25Z namdre $ +/// @version $Id: MSEdge.h 24108 2017-04-27 18:43:30Z behrisch $ /// // A road/street connecting two junctions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -206,14 +206,14 @@ * * @return This edge's persons sorted by pos */ - std::vector getSortedPersons(SUMOTime timestep) const; + std::vector getSortedPersons(SUMOTime timestep, bool includeRiding = false) const; /** @brief Returns this edge's containers sorted by pos * * @return This edge's containers sorted by pos */ - std::vector getSortedContainers(SUMOTime timestep) const; + std::vector getSortedContainers(SUMOTime timestep, bool includeRiding = false) const; /** @brief Get the allowed lanes to reach the destination-edge. * @@ -326,20 +326,6 @@ } - /** @brief Returns the list of edges from which this edge may be reached - * @return Edges from which this edge may be reached - */ - const MSEdgeVector& getIncomingEdges() const { - return myPredecessors; - } - - /** @brief Returns the list of edges that may be reached from this edge - * @return Edges that may be reached from this edge - */ - const std::vector& getOutgoingEdges() const { - return mySuccessors; - } - /** @brief Returns the number of edges that may be reached from this edge * @return The number of following edges */ @@ -371,9 +357,8 @@ } - /** @brief Returns the edge at the given position from the list of reachable edges - * @param[in] pos The position of the list within the list of approached - * @return The following edge, stored at position pos + /** @brief + * @return */ const MSEdgeVector& getPredecessors() const { return myPredecessors; @@ -441,11 +426,11 @@ * @param[in] minSpeed The minimumSpeed to assume if traffic on this edge is stopped * @return The current effort (travel time) to pass the edge */ - SUMOReal getCurrentTravelTime(const SUMOReal minSpeed = NUMERICAL_EPS) const; + double getCurrentTravelTime(const double minSpeed = NUMERICAL_EPS) const; /// @brief returns the minimum travel time for the given vehicle - inline SUMOReal getMinimumTravelTime(const SUMOVehicle* const veh) const { + inline double getMinimumTravelTime(const SUMOVehicle* const veh) const { if (myFunction == EDGEFUNCTION_DISTRICT) { return 0; } else if (veh != 0) { @@ -463,13 +448,13 @@ * @param[in] time The time for which the travel time shall be returned [s] * @return The traveltime needed by the given vehicle to pass the edge at the given time */ - static inline SUMOReal getTravelTimeStatic(const MSEdge* const edge, const SUMOVehicle* const veh, SUMOReal time) { + static inline double getTravelTimeStatic(const MSEdge* const edge, const SUMOVehicle* const veh, double time) { return MSNet::getInstance()->getTravelTime(edge, veh, time); } /** @brief Returns the averaged speed used by the routing device */ - SUMOReal getRoutingSpeed() const; + double getRoutingSpeed() const; /// @name Methods releated to vehicle insertion @@ -487,17 +472,24 @@ * * @param[in] v The vehicle to insert * @param[in] time The current simulation time - * @param[in] checkOnly whether we perform only the check without actually inserting + * @param[in] checkOnly Whether we perform only the check without actually inserting + * @param[in] forceCheck Whether the full insertion check should be run for each pending vehicle + * or whether insertion on lanes for which an insertion has already a failed should be ignored + * in the current time step. * @return Whether the vehicle could be inserted * @see MSLane::insertVehicle */ - bool insertVehicle(SUMOVehicle& v, SUMOTime time, const bool checkOnly = false) const; + bool insertVehicle(SUMOVehicle& v, SUMOTime time, const bool checkOnly = false, const bool forceCheck = false) const; /** @brief Finds the emptiest lane allowing the vehicle class * - * The emptiest lane is the one with the fewest vehicles on. - * If there is more than one, the first according to its + * The emptiest lane is the one which vehicle insertion is most likely to succeed. + * + * If there are no vehicles before departPos, then the lane with the largest + * gap between departPos and the last vehicle is + * Otheriwise the lane with lowes occupancy is selected + * If there is more than one, the first according to its * index in the lane container is chosen. * * If allowed==0, the lanes allowed for the given vehicle class @@ -505,10 +497,11 @@ * * @param[in] allowed The lanes to choose from * @param[in] vclass The vehicle class to look for + * @param[in] departPos An upper bound on vehicle depart position * @return the least occupied lane * @see allowedLanes */ - MSLane* getFreeLane(const std::vector* allowed, const SUMOVehicleClass vclass) const; + MSLane* getFreeLane(const std::vector* allowed, const SUMOVehicleClass vclass, double departPos) const; /** @brief Finds a depart lane for the given vehicle parameters @@ -545,10 +538,12 @@ virtual void changeLanes(SUMOTime t); -#ifdef HAVE_INTERNAL_LANES /// @todo extension: inner junctions are not filled const MSEdge* getInternalFollowingEdge(const MSEdge* followerAfterInternal) const; -#endif + + + /// @brief returns the length of all internal edges on the junction until reaching the non-internal edge followerAfterInternal. + double getInternalFollowingLengthTo(const MSEdge* followerAfterInternal) const; /// @brief Returns whether the vehicle (class) is not allowed on the edge inline bool prohibits(const SUMOVehicle* const vehicle) const { @@ -566,12 +561,12 @@ /** @brief Returns the edges's width (sum over all lanes) * @return This edges's width */ - SUMOReal getWidth() const { + double getWidth() const { return myWidth; } /// @brief Returns the right side offsets of this edge's sublanes - const std::vector getSubLaneSides() const { + const std::vector getSubLaneSides() const { return mySublaneSides; } @@ -582,13 +577,13 @@ * @param[in] other The edge to which the distance shall be returned * @return The distance to the other edge */ - SUMOReal getDistanceTo(const MSEdge* other) const; + double getDistanceTo(const MSEdge* other) const; /** @brief return the length of the edge * @return The edge's length */ - inline SUMOReal getLength() const { + inline double getLength() const { return myLength; } @@ -597,19 +592,22 @@ * @caution The speed limit of the first lane is retured; should probably be the fastest edge * @return The maximum speed allowed on this edge */ - SUMOReal getSpeedLimit() const; + double getSpeedLimit() const; + + /// @brief return shape.length() / myLength + double getLengthGeometryFactor() const; /** @brief Sets a new maximum speed for all lanes (used by TraCI and MSCalibrator) * @param[in] val the new speed in m/s */ - void setMaxSpeed(SUMOReal val) const; + void setMaxSpeed(double val) const; /** @brief Returns the maximum speed the vehicle may use on this edge * * @caution Only the first lane is considered * @return The maximum velocity on this edge for the given vehicle */ - SUMOReal getVehicleMaxSpeed(const SUMOVehicle* const veh) const; + double getVehicleMaxSpeed(const SUMOVehicle* const veh) const; virtual void addPerson(MSTransportable* p) const { myPersons.insert(p); @@ -655,7 +653,10 @@ bool canChangeToOpposite(); /// @brief get the mean speed - SUMOReal getMeanSpeed() const; + double getMeanSpeed() const; + + /// @brief whether any lane has a minor link + bool hasMinorLink() const; /// @brief grant exclusive access to the mesoscopic state virtual void lock() const {} @@ -758,6 +759,9 @@ const std::vector* getAllowedLanesWithDefault(const AllowedLanesCont& c, const MSEdge* dest) const; + /// @brief return upper bound for the depart position on this edge + double getDepartPosBound(const MSVehicle& veh, bool upper = true) const; + protected: /// @brief This edge's numerical id const int myNumericalID; @@ -777,6 +781,11 @@ /// @brief The time of last insertion failure mutable SUMOTime myLastFailedInsertionTime; + /// @brief A cache for the rejected insertion attempts. Used to assure that no + /// further insertion attempts are made on a lane where an attempt has + /// already failed in the current time step if MSInsertionControl::myEagerInsertionCheck is off. + mutable std::set myFailedInsertionMemory; + /// @brief The crossed edges id for a crossing edge. On not crossing edges it is empty std::vector myCrossingEdges; @@ -822,13 +831,13 @@ const int myPriority; /// Edge width [m] - SUMOReal myWidth; + double myWidth; /// @brief the length of the edge (cached value for speedup) - SUMOReal myLength; + double myLength; /// @brief the traveltime on the empty edge (cached value for speedup) - SUMOReal myEmptyTraveltime; + double myEmptyTraveltime; /// @brief whether this edge had a vehicle with less than max speed on it mutable bool myAmDelayed; @@ -837,7 +846,7 @@ bool myAmRoundabout; /// @brief the right side for each sublane on this edge - std::vector mySublaneSides; + std::vector mySublaneSides; /// @name Static edge container /// @{ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSEdgeWeightsStorage.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSEdgeWeightsStorage.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSEdgeWeightsStorage.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSEdgeWeightsStorage.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date 02.11.2009 -/// @version $Id: MSEdgeWeightsStorage.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSEdgeWeightsStorage.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A storage for edge travel times and efforts /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,10 +31,6 @@ #include "MSEdgeWeightsStorage.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -48,12 +44,12 @@ bool -MSEdgeWeightsStorage::retrieveExistingTravelTime(const MSEdge* const e, const SUMOReal t, SUMOReal& value) const { - std::map >::const_iterator i = myTravelTimes.find(e); +MSEdgeWeightsStorage::retrieveExistingTravelTime(const MSEdge* const e, const double t, double& value) const { + std::map >::const_iterator i = myTravelTimes.find(e); if (i == myTravelTimes.end()) { return false; } - const ValueTimeLine& tl = (*i).second; + const ValueTimeLine& tl = (*i).second; if (!tl.describesTime(t)) { return false; } @@ -63,12 +59,12 @@ bool -MSEdgeWeightsStorage::retrieveExistingEffort(const MSEdge* const e, const SUMOReal t, SUMOReal& value) const { - std::map >::const_iterator i = myEfforts.find(e); +MSEdgeWeightsStorage::retrieveExistingEffort(const MSEdge* const e, const double t, double& value) const { + std::map >::const_iterator i = myEfforts.find(e); if (i == myEfforts.end()) { return false; } - const ValueTimeLine& tl = (*i).second; + const ValueTimeLine& tl = (*i).second; if (!tl.describesTime(t)) { return false; } @@ -79,11 +75,11 @@ void MSEdgeWeightsStorage::addTravelTime(const MSEdge* const e, - SUMOReal begin, SUMOReal end, - SUMOReal value) { - std::map >::iterator i = myTravelTimes.find(e); + double begin, double end, + double value) { + std::map >::iterator i = myTravelTimes.find(e); if (i == myTravelTimes.end()) { - myTravelTimes[e] = ValueTimeLine(); + myTravelTimes[e] = ValueTimeLine(); i = myTravelTimes.find(e); } (*i).second.add(begin, end, value); @@ -92,11 +88,11 @@ void MSEdgeWeightsStorage::addEffort(const MSEdge* const e, - SUMOReal begin, SUMOReal end, - SUMOReal value) { - std::map >::iterator i = myEfforts.find(e); + double begin, double end, + double value) { + std::map >::iterator i = myEfforts.find(e); if (i == myEfforts.end()) { - myEfforts[e] = ValueTimeLine(); + myEfforts[e] = ValueTimeLine(); i = myEfforts.find(e); } (*i).second.add(begin, end, value); @@ -105,7 +101,7 @@ void MSEdgeWeightsStorage::removeTravelTime(const MSEdge* const e) { - std::map >::iterator i = myTravelTimes.find(e); + std::map >::iterator i = myTravelTimes.find(e); if (i != myTravelTimes.end()) { myTravelTimes.erase(i); } @@ -114,7 +110,7 @@ void MSEdgeWeightsStorage::removeEffort(const MSEdge* const e) { - std::map >::iterator i = myEfforts.find(e); + std::map >::iterator i = myEfforts.find(e); if (i != myEfforts.end()) { myEfforts.erase(i); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSEdgeWeightsStorage.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSEdgeWeightsStorage.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSEdgeWeightsStorage.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSEdgeWeightsStorage.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 02.11.2009 -/// @version $Id: MSEdgeWeightsStorage.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSEdgeWeightsStorage.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A storage for edge travel times and efforts /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,7 +31,6 @@ #include #endif -#include #include @@ -65,7 +64,7 @@ * @param[in] value The value if the requested edge/time is described * @return Whether the requested edge/time is described */ - bool retrieveExistingTravelTime(const MSEdge* const e, const SUMOReal t, SUMOReal& value) const; + bool retrieveExistingTravelTime(const MSEdge* const e, const double t, double& value) const; /** @brief Returns an effort for an edge and time if stored @@ -74,7 +73,7 @@ * @param[in] value The value if the requested edge/time is described * @return Whether the requested edge/time is described */ - bool retrieveExistingEffort(const MSEdge* const e, const SUMOReal t, SUMOReal& value) const; + bool retrieveExistingEffort(const MSEdge* const e, const double t, double& value) const; /** @brief Adds a travel time information for an edge and a time span @@ -83,7 +82,7 @@ * @param[in] end The end of the described time span * @param[in] value The travel time value for this edge and time span */ - void addTravelTime(const MSEdge* const e, SUMOReal begin, SUMOReal end, SUMOReal value); + void addTravelTime(const MSEdge* const e, double begin, double end, double value); /** @brief Adds an effort information for an edge and a time span @@ -92,7 +91,7 @@ * @param[in] end The end of the described time span * @param[in] value Theeffort value for this edge and time span */ - void addEffort(const MSEdge* const e, SUMOReal begin, SUMOReal end, SUMOReal value); + void addEffort(const MSEdge* const e, double begin, double end, double value); /** @brief Removes the travel time information for an edge @@ -123,10 +122,10 @@ private: /// @brief A map of edge->time->travel time - std::map > myTravelTimes; + std::map > myTravelTimes; /// @brief A map of edge->time->effort - std::map > myEfforts; + std::map > myEfforts; private: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSEventControl.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSEventControl.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSEventControl.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSEventControl.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Matthias Heppner /// @date Mon, 12 Mar 2001 -/// @version $Id: MSEventControl.cpp 21649 2016-10-10 13:24:35Z luecken $ +/// @version $Id: MSEventControl.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // Stores time-dependant events and executes them at the proper time /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,10 +38,6 @@ #include #include "MSNet.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member definitions @@ -52,7 +48,7 @@ MSEventControl::~MSEventControl() { // delete the events - while (! myEvents.empty()) { + while (!myEvents.empty()) { Event e = myEvents.top(); delete e.first; myEvents.pop(); @@ -60,17 +56,9 @@ } -SUMOTime -MSEventControl::addEvent(Command* operation, - SUMOTime execTimeStep, - AdaptType type) { - SUMOTime currTimeStep = getCurrentTimeStep(); - if (type == ADAPT_AFTER_EXECUTION && execTimeStep <= currTimeStep) { - execTimeStep = currTimeStep; - } - Event newEvent = Event(operation, execTimeStep); - myEvents.push(newEvent); - return execTimeStep; +void +MSEventControl::addEvent(Command* operation, SUMOTime execTimeStep) { + myEvents.push(Event(operation, execTimeStep)); } @@ -79,6 +67,9 @@ // Execute all events that are scheduled for execTime. while (!myEvents.empty()) { Event currEvent = myEvents.top(); + if (currEvent.second < 0) { + currEvent.second = execTime; + } if (currEvent.second < execTime + DELTA_T) { Command* command = currEvent.first; myEvents.pop(); @@ -102,14 +93,7 @@ myEvents.push(currEvent); } } else { - if (currEvent.second < execTime) { - // !!! more verbose information - WRITE_WARNING("Could not execute scheduled event."); - delete currEvent.first; - myEvents.pop(); - } else { - break; - } + break; } } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSEventControl.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSEventControl.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSEventControl.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSEventControl.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Matthias Heppner /// @date Mon, 12 Mar 2001 -/// @version $Id: MSEventControl.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSEventControl.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Stores time-dependant events and executes them at the proper time /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -60,18 +60,6 @@ typedef std::pair< Command*, SUMOTime > Event; - /** - * @enum AdaptType - * @brief Defines what to do if the insertion time lies before the current simulation time - */ - enum AdaptType { - /// @brief Patch the time in a way that it is at least as high as the simulation begin time - ADAPT_AFTER_EXECUTION = 1, - /// @brief Do nothing - NO_CHANGE = 2 - }; - - public: /// @brief Default constructor. MSEventControl(); @@ -83,20 +71,11 @@ /** @brief Adds an Event. * - * If the given execution time step lies before the current and ADAPT_AFTER_EXECUTION - * is passed for adaptation type, the execution time step will be set to the - * current time step. - * - * Returns the time the event will be executed, really. - * * @param[in] operation The event to add - * @param[in] execTimeStep The time the event shall be executed at - * @param[in] type The adaptation type + * @param[in] execTimeStep The time the event shall be executed at (-1 means at sim start) * @see Command - * @see AdaptType */ - virtual SUMOTime addEvent(Command* operation, SUMOTime execTimeStep, - AdaptType type); + virtual void addEvent(Command* operation, SUMOTime execTimeStep = -1); /** @brief Executes time-dependant commands @@ -153,7 +132,7 @@ /// @brief Container for time-dependant events, e.g. traffic-light-change. typedef std::priority_queue< Event, std::vector< Event >, EventSortCrit > EventCont; - /// The Current TimeStep + /// The current TimeStep SUMOTime currentTimeStep; /// @brief Event-container, holds executable events. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSFrame.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -8,12 +8,12 @@ /// @author Mario Krumnow /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: MSFrame.cpp 21734 2016-10-18 10:59:35Z namdre $ +/// @version $Id: MSFrame.cpp 23898 2017-04-10 11:10:21Z behrisch $ /// // Sets and checks options for microsim; inits global outputs and settings /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -53,14 +53,11 @@ #include #include #include +#include #include #include "MSFrame.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -108,6 +105,8 @@ oc.addDescription("load-state", "Input", "Loads a network state from FILE"); oc.doRegister("load-state.offset", new Option_String("0", "TIME"));//!!! check, describe oc.addDescription("load-state.offset", "Input", "Shifts all times loaded from a saved state by the given offset"); + oc.doRegister("load-state.remove-vehicles", new Option_String("")); + oc.addDescription("load-state.remove-vehicles", "Input", "Removes vehicles with the given IDs from the loaded state"); // register output options oc.doRegister("netstate-dump", new Option_FileName()); @@ -120,7 +119,7 @@ oc.addSynonyme("netstate-dump.empty-edges", "netstate-output.empty-edges"); oc.addSynonyme("netstate-dump.empty-edges", "dump-empty-edges", true); oc.addDescription("netstate-dump.empty-edges", "Output", "Write also empty edges completely when dumping"); - oc.doRegister("netstate-dump.precision", new Option_Integer(OUTPUT_ACCURACY)); + oc.doRegister("netstate-dump.precision", new Option_Integer(2)); oc.addSynonyme("netstate-dump.precision", "netstate.precision"); oc.addSynonyme("netstate-dump.precision", "netstate-output.precision"); oc.addSynonyme("netstate-dump.precision", "dump-precision", true); @@ -129,14 +128,17 @@ oc.doRegister("emission-output", new Option_FileName()); oc.addDescription("emission-output", "Output", "Save the emission values of each vehicle"); - oc.doRegister("emission-output.precision", new Option_Integer(OUTPUT_ACCURACY)); + oc.doRegister("emission-output.precision", new Option_Integer(2)); oc.addDescription("emission-output.precision", "Output", "Write emission values with the given precision (default 2)"); oc.doRegister("battery-output", new Option_FileName()); oc.addDescription("battery-output", "Output", "Save the battery values of each vehicle"); - oc.doRegister("battery-output.precision", new Option_Integer(OUTPUT_ACCURACY)); + oc.doRegister("battery-output.precision", new Option_Integer(2)); oc.addDescription("battery-output.precision", "Output", "Write battery values with the given precision (default 2)"); + oc.doRegister("chargingstations-output", new Option_FileName()); + oc.addDescription("chargingstations-output", "Output", "Write data of charging stations"); + oc.doRegister("fcd-output", new Option_FileName()); oc.addDescription("fcd-output", "Output", "Save the Floating Car Data"); oc.doRegister("fcd-output.geo", new Option_Bool(false)); @@ -204,6 +206,9 @@ oc.doRegister("lanechange-output", new Option_FileName()); oc.addDescription("lanechange-output", "Output", "Record lane changes and their motivations for all vehicles into FILE"); + oc.doRegister("stop-output", new Option_FileName()); + oc.addDescription("stop-output", "Output", "Record stops and loading/unloading of passenger and containers for all vehicles into FILE"); + #ifdef _DEBUG oc.doRegister("movereminder-output", new Option_FileName()); oc.addDescription("movereminder-output", "Output", "Save movereminder states of selected vehicles into FILE"); @@ -242,13 +247,11 @@ oc.doRegister("route-steps", 's', new Option_String("200", "TIME")); oc.addDescription("route-steps", "Processing", "Load routes for the next number of seconds ahead"); -#ifdef HAVE_INTERNAL_LANES oc.doRegister("no-internal-links", new Option_Bool(false)); oc.addDescription("no-internal-links", "Processing", "Disable (junction) internal links"); oc.doRegister("ignore-junction-blocker", new Option_String("-1", "TIME")); oc.addDescription("ignore-junction-blocker", "Processing", "Ignore vehicles which block the junction after they have been standing for SECONDS (-1 means never ignore)"); -#endif oc.doRegister("ignore-route-errors", new Option_Bool(false)); oc.addDescription("ignore-route-errors", "Processing", "Do not check whether routes are connected"); @@ -259,12 +262,18 @@ oc.doRegister("collision.action", new Option_String("teleport")); oc.addDescription("collision.action", "Processing", "How to deal with collisions: [none,warn,teleport,remove]"); + oc.doRegister("collision.stoptime", new Option_String("0", "TIME")); + oc.addDescription("collision.stoptime", "Processing", "Let vehicle stop for TIME before performing collision.action (except for action 'none')"); + oc.doRegister("collision.check-junctions", new Option_Bool(false)); oc.addDescription("collision.check-junctions", "Processing", "Enables collisions checks on junctions"); oc.doRegister("max-num-vehicles", new Option_Integer(-1)); oc.addDescription("max-num-vehicles", "Processing", "Delay vehicle insertion to stay within the given maximum number"); + oc.doRegister("max-num-teleports", new Option_Integer(-1)); + oc.addDescription("max-num-teleports", "Processing", "Abort the simulation if the given maximum number of teleports is exceeded"); + oc.doRegister("scale", new Option_Float(1.)); oc.addDescription("scale", "Processing", "Scale demand by the given factor (by discarding or duplicating vehicles)"); @@ -298,6 +307,10 @@ oc.doRegister("tls.all-off", new Option_Bool(false)); oc.addDescription("tls.all-off", "Processing", "Switches off all traffic lights."); + oc.doRegister("time-to-impatience", new Option_String("300", "TIME")); + oc.addDescription("time-to-impatience", "Processing", "Specify how long a vehicle may wait until impatience grows from 0 to 1, defaults to 300, non-positive values disable impatience growth"); + + // pedestrian model oc.doRegister("pedestrian.model", new Option_String("striping")); oc.addDescription("pedestrian.model", "Processing", "Select among pedestrian models ['nonInteracting', 'striping']"); @@ -359,7 +372,7 @@ oc.addDescription("meso-tauff", "Mesoscopic", "Factor for calculating the net free-free headway time"); oc.doRegister("meso-taufj", new Option_String("1.13", "TIME")); oc.addDescription("meso-taufj", "Mesoscopic", "Factor for calculating the net free-jam headway time"); - oc.doRegister("meso-taujf", new Option_String("2", "TIME")); + oc.doRegister("meso-taujf", new Option_String("1.73", "TIME")); oc.addDescription("meso-taujf", "Mesoscopic", "Factor for calculating the jam-free headway time"); oc.doRegister("meso-taujj", new Option_String("1.4", "TIME")); oc.addDescription("meso-taujj", "Mesoscopic", "Factor for calculating the jam-jam headway time"); @@ -376,6 +389,9 @@ oc.doRegister("meso-tls-penalty", new Option_Float(0)); oc.addDescription("meso-tls-penalty", "Mesoscopic", "Apply scaled time penalties when driving across tls controlled junctions based on green split instead of checking actual phases"); + oc.doRegister("meso-minor-penalty", new Option_String("0", "TIME")); + oc.addDescription("meso-minor-penalty", "Mesoscopic", + "Apply fixed time penalty when driving across a minor link. When using --meso-junction-control.limited, the penalty is not applied whenever limited control is active."); oc.doRegister("meso-overtaking", new Option_Bool(false)); oc.addDescription("meso-overtaking", "Mesoscopic", "Enable mesoscopic overtaking"); oc.doRegister("meso-recheck", new Option_String("0", "TIME")); @@ -408,6 +424,9 @@ oc.doRegister("window-size", new Option_String()); oc.addDescription("window-size", "GUI Only", "Create initial window with the given x,y size"); + oc.doRegister("window-pos", new Option_String()); + oc.addDescription("window-pos", "GUI Only", "Create initial window at the given x,y position"); + #ifdef HAVE_OSG oc.doRegister("osg-view", new Option_Bool(false)); oc.addDescription("osg-view", "GUI Only", "Start with an OpenSceneGraph view instead of the regular 2D view"); @@ -427,6 +446,7 @@ OutputDevice::createDeviceByOption("fcd-output", "fcd-export", "fcd_file.xsd"); OutputDevice::createDeviceByOption("emission-output", "emission-export", "emission_file.xsd"); OutputDevice::createDeviceByOption("battery-output", "battery-export"); + OutputDevice::createDeviceByOption("chargingstations-output", "chargingstations-export"); OutputDevice::createDeviceByOption("full-output", "full-export", "full_file.xsd"); OutputDevice::createDeviceByOption("queue-output", "queue-export", "queue_file.xsd"); OutputDevice::createDeviceByOption("amitran-output", "trajectories", "amitran/trajectories.xsd\" timeStepSize=\"" + toString(STEPS2MS(DELTA_T))); @@ -435,12 +455,14 @@ OutputDevice::createDeviceByOption("link-output", "link-output"); OutputDevice::createDeviceByOption("bt-output", "bt-output"); OutputDevice::createDeviceByOption("lanechange-output", "lanechanges"); + OutputDevice::createDeviceByOption("stop-output", "stops", "stopinfo_file.xsd"); #ifdef _DEBUG OutputDevice::createDeviceByOption("movereminder-output", "movereminder-output"); #endif MSDevice_Vehroutes::init(); + MSStopOut::init(); } @@ -509,7 +531,22 @@ if (oc.getBool("duration-log.statistics") && oc.isDefault("verbose")) { oc.set("verbose", "true"); } + if (oc.isDefault("precision") && string2time(oc.getString("step-length")) < 10) { + oc.set("precision", "3"); + } + if (oc.getInt("precision") > 2) { + if (oc.isDefault("netstate-dump.precision")) { + oc.set("netstate-dump.precision", toString(oc.getInt("precision"))); + } + if (oc.isDefault("emission-output.precision")) { + oc.set("emission-output.precision", toString(oc.getInt("precision"))); + } + if (oc.isDefault("battery-output.precision")) { + oc.set("battery-output.precision", toString(oc.getInt("precision"))); + } + } ok &= MSDevice::checkOptions(oc); + ok &= SystemFrame::checkOptions(); return ok; } @@ -519,17 +556,13 @@ // pre-initialise the network // set whether empty edges shall be printed on dump MSGlobals::gOmitEmptyEdgesOnDump = !oc.getBool("netstate-dump.empty-edges"); -#ifdef HAVE_INTERNAL_LANES // set whether internal lanes shall be used MSGlobals::gUsingInternalLanes = !oc.getBool("no-internal-links"); MSGlobals::gIgnoreJunctionBlocker = string2time(oc.getString("ignore-junction-blocker")) < 0 ? std::numeric_limits::max() : string2time(oc.getString("ignore-junction-blocker")); -#else - MSGlobals::gUsingInternalLanes = false; - MSGlobals::gIgnoreJunctionBlocker = 0; -#endif // set the grid lock time MSGlobals::gTimeToGridlock = string2time(oc.getString("time-to-teleport")) < 0 ? 0 : string2time(oc.getString("time-to-teleport")); + MSGlobals::gTimeToImpatience = string2time(oc.getString("time-to-impatience")); MSGlobals::gTimeToGridlockHighways = string2time(oc.getString("time-to-teleport.highways")) < 0 ? 0 : string2time(oc.getString("time-to-teleport.highways")); MSGlobals::gCheck4Accidents = !oc.getBool("ignore-accidents"); MSGlobals::gCheckRoutes = !oc.getBool("ignore-route-errors"); @@ -540,6 +573,7 @@ MSGlobals::gMesoLimitedJunctionControl = oc.getBool("meso-junction-control.limited"); MSGlobals::gMesoOvertaking = oc.getBool("meso-overtaking"); MSGlobals::gMesoTLSPenalty = oc.getFloat("meso-tls-penalty"); + MSGlobals::gMesoMinorPenalty = string2time(oc.getString("meso-minor-penalty")); MSGlobals::gSemiImplicitEulerUpdate = !oc.getBool("step-method.ballistic"); if (MSGlobals::gUseMesoSim) { MSGlobals::gUsingInternalLanes = false; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSFrame.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: MSFrame.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSFrame.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Sets and checks options for microsim; inits global outputs and settings /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSGlobals.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSGlobals.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSGlobals.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSGlobals.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date late summer 2003 -/// @version $Id: MSGlobals.cpp 21650 2016-10-10 13:26:10Z luecken $ +/// @version $Id: MSGlobals.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Some static variables for faster access /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2003-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2003-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,10 +32,6 @@ #include "MSGlobals.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member variable definitions @@ -47,6 +43,7 @@ SUMOTime MSGlobals::gTimeToGridlock; SUMOTime MSGlobals::gTimeToGridlockHighways; +SUMOTime MSGlobals::gTimeToImpatience; bool MSGlobals::gCheck4Accidents; @@ -54,13 +51,14 @@ SUMOTime MSGlobals::gLaneChangeDuration; -SUMOReal MSGlobals::gLateralResolution; +double MSGlobals::gLateralResolution; bool MSGlobals::gStateLoaded; bool MSGlobals::gUseMesoSim; bool MSGlobals::gMesoLimitedJunctionControl; bool MSGlobals::gMesoOvertaking; -SUMOReal MSGlobals::gMesoTLSPenalty; +double MSGlobals::gMesoTLSPenalty; +SUMOTime MSGlobals::gMesoMinorPenalty; MELoop* MSGlobals::gMesoNet; bool MSGlobals::gSemiImplicitEulerUpdate; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSGlobals.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSGlobals.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSGlobals.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSGlobals.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date late summer 2003 -/// @version $Id: MSGlobals.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSGlobals.h 23379 2017-03-14 13:02:11Z namdre $ /// // Some static variables for faster access /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2003-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2003-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -69,6 +69,9 @@ /** The time to detect grid locks on highways */ static SUMOTime gTimeToGridlockHighways; + /** Information how long a vehicle must wait for impatience to grow from 0 to 1 */ + static SUMOTime gTimeToImpatience; + /// Information whether the simulation regards internal lanes static bool gUsingInternalLanes; @@ -86,7 +89,7 @@ static SUMOTime gLaneChangeDuration; /** Lateral resolution within a lane */ - static SUMOReal gLateralResolution; + static double gLateralResolution; /// Information whether a state has been loaded static bool gStateLoaded; @@ -101,7 +104,10 @@ static bool gMesoOvertaking; /** scaling factor for macroscopic time penalty when passing tls controlled intersection */ - static SUMOReal gMesoTLSPenalty; + static double gMesoTLSPenalty; + + /** penalty time for passing a minor link */ + static SUMOTime gMesoMinorPenalty; /// mesoscopic simulation infrastructure static MELoop* gMesoNet; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSInsertionControl.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSInsertionControl.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSInsertionControl.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSInsertionControl.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Mon, 12 Mar 2001 -/// @version $Id: MSInsertionControl.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSInsertionControl.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Inserts vehicles into the network when their departure time is reached /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,21 +44,17 @@ #include "MSEdge.h" #include "MSRouteHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions // =========================================================================== MSInsertionControl::MSInsertionControl(MSVehicleControl& vc, SUMOTime maxDepartDelay, - bool checkEdgesOnce, + bool eagerInsertionCheck, int maxVehicleNumber) : myVehicleControl(vc), myMaxDepartDelay(maxDepartDelay), - myCheckEdgesOnce(checkEdgesOnce), + myEagerInsertionCheck(eagerInsertionCheck), myMaxVehicleNumber(maxVehicleNumber), myPendingEmitsUpdateTime(SUMOTime_MIN) { } @@ -129,8 +125,7 @@ return 1; } if ((myMaxVehicleNumber < 0 || (int)MSNet::getInstance()->getVehicleControl().getRunningVehicleNo() < myMaxVehicleNumber) - && (!myCheckEdgesOnce || edge.getLastFailedInsertionTime() != time) - && edge.insertVehicle(*veh, time)) { + && edge.insertVehicle(*veh, time, false, myEagerInsertionCheck)) { // Successful insertion return 1; } @@ -165,7 +160,7 @@ for (veh = myPendingEmits.begin(); veh != myPendingEmits.end(); veh++) { SUMOVehicle* const v = *veh; const MSEdge* const edge = v->getEdge(); - if ((!myCheckEdgesOnce || edge->getLastFailedInsertionTime() != time) && edge->insertVehicle(*v, time, true)) { + if (edge->insertVehicle(*v, time, true, myEagerInsertionCheck)) { myEmitCandidates.insert(v); } else { MSDevice_Routing* dev = static_cast(v->getDevice(typeid(MSDevice_Routing))); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSInsertionControl.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSInsertionControl.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSInsertionControl.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSInsertionControl.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Mon, 12 Mar 2001 -/// @version $Id: MSInsertionControl.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSInsertionControl.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Inserts vehicles into the network when their departure time is reached /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -215,7 +215,7 @@ SUMOTime myMaxDepartDelay; /// @brief Whether an edge on which a vehicle could not depart should be ignored in the same step - bool myCheckEdgesOnce; + bool myEagerInsertionCheck; /// @brief Storage for maximum vehicle number int myMaxVehicleNumber; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSInternalJunction.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSInternalJunction.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSInternalJunction.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSInternalJunction.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Wed, 12 Dez 2001 -/// @version $Id: MSInternalJunction.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSInternalJunction.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // junction. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,15 +40,10 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== -#ifdef HAVE_INTERNAL_LANES MSInternalJunction::MSInternalJunction(const std::string& id, SumoXMLNodeType type, const Position& position, @@ -123,8 +118,5 @@ } -#endif - - /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSInternalJunction.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSInternalJunction.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSInternalJunction.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSInternalJunction.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 12 Dez 2001 -/// @version $Id: MSInternalJunction.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSInternalJunction.h 23143 2017-02-27 08:20:06Z namdre $ /// // junction. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -56,7 +56,6 @@ * The rules for the right-of-way themselves are stored within the associated * "MSJunctionLogic" - structure. */ -#ifdef HAVE_INTERNAL_LANES class MSInternalJunction : public MSLogicJunction { public: /** @brief Constructor @@ -101,7 +100,6 @@ #endif -#endif /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSJunctionControl.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSJunctionControl.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSJunctionControl.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSJunctionControl.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Tue, 06 Mar 2001 -/// @version $Id: MSJunctionControl.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSJunctionControl.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Container for junctions; performs operations on all stored junctions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,10 +34,6 @@ #include "MSInternalJunction.h" #include "MSJunctionControl.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions @@ -53,7 +49,6 @@ void MSJunctionControl::postloadInitContainer() { const std::vector& junctions = buildAndGetStaticVector(); -#ifdef HAVE_INTERNAL_LANES // initialize normal junctions before internal junctions // (to allow calling getIndex() during initialization of internal junction links) for (std::vector::const_iterator i = junctions.begin(); i != junctions.end(); ++i) { @@ -66,11 +61,6 @@ (*i)->postloadInit(); } } -#else - for (std::vector::const_iterator i = junctions.begin(); i != junctions.end(); ++i) { - (*i)->postloadInit(); - } -#endif } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSJunctionControl.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSJunctionControl.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSJunctionControl.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSJunctionControl.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Mon, 12 Mar 2001 -/// @version $Id: MSJunctionControl.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSJunctionControl.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Container for junctions; performs operations on all stored junctions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSJunction.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSJunction.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSJunction.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSJunction.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 12 Dez 2001 -/// @version $Id: MSJunction.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: MSJunction.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The base class for an intersection /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,10 +34,6 @@ #include "MSEdge.h" #include "MSJunction.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // class declarations diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSJunction.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSJunction.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSJunction.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSJunction.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Wed, 12 Dez 2001 -/// @version $Id: MSJunction.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSJunction.h 24108 2017-04-27 18:43:30Z behrisch $ /// // The base class for an intersection /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -110,6 +110,12 @@ return myOutgoing; } + /** @brief Returns all internal lanes on the junction + */ + virtual const std::vector& getInternalLanes() const { + return myEmptyLanes; + } + void addIncoming(MSEdge* edge) { myIncoming.push_back(edge); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSJunctionLogic.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSJunctionLogic.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSJunctionLogic.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSJunctionLogic.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 12 Dez 2001 -/// @version $Id: MSJunctionLogic.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSJunctionLogic.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // kinds of logic-implementations. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,10 +31,6 @@ #include "MSJunctionLogic.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSJunctionLogic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSJunctionLogic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSJunctionLogic.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSJunctionLogic.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Sascha Krieg /// @date Wed, 12 Dez 2001 -/// @version $Id: MSJunctionLogic.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSJunctionLogic.h 22608 2017-01-17 06:28:54Z behrisch $ /// // kinds of logic-implementations. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLaneChanger.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLaneChanger.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLaneChanger.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLaneChanger.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ /// @author Friedemann Wesner /// @author Jakob Erdmann /// @date Fri, 01 Feb 2002 -/// @version $Id: MSLaneChanger.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSLaneChanger.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Performs lane changing of vehicles /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,10 +45,11 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - +#define OPPOSITE_OVERTAKING_SAFE_TIMEGAP 0.0 +// XXX maxLookAhead should be higher if all leaders are stopped and lower when they are jammed/queued +#define OPPOSITE_OVERTAKING_MAX_LOOKAHEAD 150.0 // just a guess +// this is used for finding oncoming vehicles while driving in the opposite direction +#define OPPOSITE_OVERTAKING_ONCOMING_LOOKAHEAD 200.0 // just a guess // =========================================================================== // debug defines @@ -174,9 +175,8 @@ MSLaneChanger::ChangerIt MSLaneChanger::findCandidate() { - // Find the vehicle in myChanger with the smallest position. If there + // Find the vehicle in myChanger with the largest position. If there // is no vehicle in myChanger (shouldn't happen) , return myChanger.end(). - // XXX: To my impression this returns the vehicle with the *largest* position?! (Leo) ChangerIt max = myChanger.end(); for (ChangerIt ce = myChanger.begin(); ce != myChanger.end(); ++ce) { if (veh(ce) == 0) { @@ -242,8 +242,8 @@ registerUnchanged(vehicle); return false; } - std::pair leader = getRealLeader(myCandi); - if (myChanger.size() == 1) { + std::pair leader = getRealLeader(myCandi); + if (myChanger.size() == 1 || vehicle->getLaneChangeModel().isOpposite()) { if (changeOpposite(leader)) { return true; } @@ -262,17 +262,16 @@ } const std::vector& preb = vehicle->getBestLanes(); // check whether the vehicle wants and is able to change to right lane - int state1 = 0; + int stateRight = 0; if (mayChange(-1)) { - state1 = checkChangeWithinEdge(-1, leader, preb); - bool changingAllowed1 = (state1 & LCA_BLOCKED) == 0; + stateRight = checkChangeWithinEdge(-1, leader, preb); // change if the vehicle wants to and is allowed to change - if ((state1 & LCA_RIGHT) != 0 && changingAllowed1) { - vehicle->getLaneChangeModel().setOwnState(state1); + if ((stateRight & LCA_RIGHT) != 0 && (stateRight & LCA_BLOCKED) == 0) { + vehicle->getLaneChangeModel().setOwnState(stateRight); startChange(vehicle, myCandi, -1); return true; } - if ((state1 & LCA_RIGHT) != 0 && (state1 & LCA_URGENT) != 0) { + if ((stateRight & LCA_RIGHT) != 0 && (stateRight & LCA_URGENT) != 0) { (myCandi - 1)->lastBlocked = vehicle; if ((myCandi - 1)->firstBlocked == 0) { (myCandi - 1)->firstBlocked = vehicle; @@ -280,20 +279,17 @@ } } - - // check whether the vehicle wants and is able to change to left lane - int state2 = 0; + int stateLeft = 0; if (mayChange(1)) { - state2 = checkChangeWithinEdge(1, leader, preb); - bool changingAllowed2 = (state2 & LCA_BLOCKED) == 0; + stateLeft = checkChangeWithinEdge(1, leader, preb); // change if the vehicle wants to and is allowed to change - if ((state2 & LCA_LEFT) != 0 && changingAllowed2) { - vehicle->getLaneChangeModel().setOwnState(state2); + if ((stateLeft & LCA_LEFT) != 0 && (stateLeft & LCA_BLOCKED) == 0) { + vehicle->getLaneChangeModel().setOwnState(stateLeft); startChange(vehicle, myCandi, 1); return true; } - if ((state2 & LCA_LEFT) != 0 && (state2 & LCA_URGENT) != 0) { + if ((stateLeft & LCA_LEFT) != 0 && (stateLeft & LCA_URGENT) != 0) { (myCandi + 1)->lastBlocked = vehicle; if ((myCandi + 1)->firstBlocked == 0) { (myCandi + 1)->firstBlocked = vehicle; @@ -301,18 +297,21 @@ } } - if ((state1 & (LCA_URGENT)) != 0 && (state2 & (LCA_URGENT)) != 0) { + if ((stateRight & LCA_URGENT) != 0 && (stateLeft & LCA_URGENT) != 0) { // ... wants to go to the left AND to the right // just let them go to the right lane... - state2 = 0; + stateLeft = 0; } - vehicle->getLaneChangeModel().setOwnState(state2 | state1); + vehicle->getLaneChangeModel().setOwnState(stateRight | stateLeft); - if (!changeOpposite(leader)) { + // only emergency vehicles should change to the opposite side on a + // multi-lane road + if (vehicle->getVehicleType().getVehicleClass() == SVC_EMERGENCY + && changeOpposite(leader)) { + return true; + } else { registerUnchanged(vehicle); return false; - } else { - return true; } } @@ -393,7 +392,7 @@ } -std::pair +std::pair MSLaneChanger::getRealLeader(const ChangerIt& target) const { assert(veh(myCandi) != 0); @@ -421,7 +420,7 @@ // << " (416)\n"; // check whether the hopped vehicle became the leader if (target->hoppedVeh != 0) { - SUMOReal hoppedPos = target->hoppedVeh->getPositionOnLane(); + double hoppedPos = target->hoppedVeh->getPositionOnLane(); #ifdef DEBUG_SURROUNDING_VEHICLES if (DEBUG_COND) { std::cout << "Considering hopped vehicle '" << target->hoppedVeh->getID() << "' at position " << hoppedPos << std::endl; @@ -444,31 +443,31 @@ assert(targetLane->myPartialVehicles.size() > 0); std::vector::const_iterator i = targetLane->myPartialVehicles.begin(); MSVehicle* leader = *i; - SUMOReal leaderPos = leader->getBackPositionOnLane(targetLane); + double leaderPos = leader->getBackPositionOnLane(targetLane); while (++i != targetLane->myPartialVehicles.end()) { if ((*i)->getBackPositionOnLane(targetLane) < leader->getBackPositionOnLane(targetLane)) { leader = *i; leaderPos = leader->getBackPositionOnLane(targetLane); } } - return std::pair(leader, leaderPos - veh(myCandi)->getPositionOnLane() - veh(myCandi)->getVehicleType().getMinGap()); + return std::pair(leader, leaderPos - veh(myCandi)->getPositionOnLane() - veh(myCandi)->getVehicleType().getMinGap()); } - SUMOReal seen = myCandi->lane->getLength() - veh(myCandi)->getPositionOnLane(); - SUMOReal speed = veh(myCandi)->getSpeed(); - SUMOReal dist = veh(myCandi)->getCarFollowModel().brakeGap(speed) + veh(myCandi)->getVehicleType().getMinGap(); + double seen = myCandi->lane->getLength() - veh(myCandi)->getPositionOnLane(); + double speed = veh(myCandi)->getSpeed(); + double dist = veh(myCandi)->getCarFollowModel().brakeGap(speed) + veh(myCandi)->getVehicleType().getMinGap(); if (seen > dist) { - return std::pair(static_cast(0), -1); + return std::pair(static_cast(0), -1); } const std::vector& bestLaneConts = veh(myCandi)->getBestLanesContinuation(targetLane); return target->lane->getLeaderOnConsecutive(dist, seen, speed, *veh(myCandi), bestLaneConts); } else { MSVehicle* candi = veh(myCandi); - return std::pair(neighLead, neighLead->getBackPositionOnLane(target->lane) - candi->getPositionOnLane() - candi->getVehicleType().getMinGap()); + return std::pair(neighLead, neighLead->getBackPositionOnLane(target->lane) - candi->getPositionOnLane() - candi->getVehicleType().getMinGap()); } } -std::pair +std::pair MSLaneChanger::getRealFollower(const ChangerIt& target) const { assert(veh(myCandi) != 0); @@ -479,7 +478,7 @@ } #endif MSVehicle* candi = veh(myCandi); - const SUMOReal candiPos = candi->getPositionOnLane(); + const double candiPos = candi->getPositionOnLane(); MSVehicle* neighFollow = veh(target); #ifdef DEBUG_SURROUNDING_VEHICLES @@ -517,9 +516,7 @@ neighFollow = getCloserFollower(candiPos, neighFollow, target->lane->getPartialBehind(candi)); if (neighFollow == 0) { - std::pair consecutiveFollower = target->lane->getFollowerOnConsecutive( - candi->getPositionOnLane() - candi->getVehicleType().getLength(), - candi->getSpeed(), candi->getCarFollowModel().getMaxDecel()); + CLeaderDist consecutiveFollower = target->lane->getFollowersOnConsecutive(candi, candi->getBackPositionOnLane(), true)[0]; #ifdef DEBUG_SURROUNDING_VEHICLES if (DEBUG_COND) { if (consecutiveFollower.first == 0) { @@ -529,7 +526,7 @@ } } #endif - return consecutiveFollower; + return std::make_pair(const_cast(consecutiveFollower.first), consecutiveFollower.second); } else { #ifdef DEBUG_SURROUNDING_VEHICLES if (DEBUG_COND) { @@ -537,14 +534,14 @@ } #endif MSVehicle* candi = veh(myCandi); - return std::pair(neighFollow, + return std::pair(neighFollow, candi->getPositionOnLane() - candi->getVehicleType().getLength() - neighFollow->getPositionOnLane() - neighFollow->getVehicleType().getMinGap()); } } MSVehicle* -MSLaneChanger::getCloserFollower(const SUMOReal maxPos, MSVehicle* follow1, MSVehicle* follow2) { +MSLaneChanger::getCloserFollower(const double maxPos, MSVehicle* follow1, MSVehicle* follow2) { if (follow1 == 0 || follow1->getPositionOnLane() > maxPos) { return follow2; } else if (follow2 == 0 || follow2->getPositionOnLane() > maxPos) { @@ -561,11 +558,11 @@ int MSLaneChanger::checkChangeWithinEdge( int laneOffset, - const std::pair& leader, + const std::pair& leader, const std::vector& preb) const { - std::pair neighLead = getRealLeader(myCandi + laneOffset); - std::pair neighFollow = getRealFollower(myCandi + laneOffset); + std::pair neighLead = getRealLeader(myCandi + laneOffset); + std::pair neighFollow = getRealFollower(myCandi + laneOffset); if (neighLead.first != 0 && neighLead.first == neighFollow.first) { // vehicles should not be leader and follower at the same time to avoid // contradictory behavior @@ -579,9 +576,9 @@ MSLaneChanger::checkChange( int laneOffset, const MSLane* targetLane, - const std::pair& leader, - const std::pair& neighLead, - const std::pair& neighFollow, + const std::pair& leader, + const std::pair& neighLead, + const std::pair& neighFollow, const std::vector& preb) const { MSVehicle* vehicle = veh(myCandi); @@ -679,11 +676,11 @@ if (blocked == 0 && (state & LCA_WANTS_LANECHANGE) != 0 && neighLead.first != 0) { // do are more carefull (but expensive) check to ensure that a // safety-critical leader is not being overloocked - const SUMOReal seen = myCandi->lane->getLength() - vehicle->getPositionOnLane(); - const SUMOReal speed = vehicle->getSpeed(); - const SUMOReal dist = vehicle->getCarFollowModel().brakeGap(speed) + vehicle->getVehicleType().getMinGap(); + const double seen = myCandi->lane->getLength() - vehicle->getPositionOnLane(); + const double speed = vehicle->getSpeed(); + const double dist = vehicle->getCarFollowModel().brakeGap(speed) + vehicle->getVehicleType().getMinGap(); if (seen < dist) { - std::pair neighLead2 = targetLane->getCriticalLeader(dist, seen, speed, *vehicle); + std::pair neighLead2 = targetLane->getCriticalLeader(dist, seen, speed, *vehicle); if (neighLead2.first != 0 && neighLead2.first != neighLead.first && (neighLead2.second < vehicle->getCarFollowModel().getSecureGap( vehicle->getSpeed(), neighLead2.first->getSpeed(), neighLead2.first->getCarFollowModel().getMaxDecel()))) { @@ -701,12 +698,12 @@ if ((state & LCA_BLOCKED) == 0 && (state & LCA_WANTS_LANECHANGE) != 0 && MSGlobals::gLaneChangeDuration > DELTA_T) { // ensure that a continuous lane change manoeuvre can be completed // before the next turning movement - SUMOReal seen = myCandi->lane->getLength() - vehicle->getPositionOnLane(); - const SUMOReal decel = vehicle->getCarFollowModel().getMaxDecel() * STEPS2TIME(MSGlobals::gLaneChangeDuration); - const SUMOReal avgSpeed = 0.5 * ( - MAX2((SUMOReal)0, vehicle->getSpeed() - ACCEL2SPEED(vehicle->getCarFollowModel().getMaxDecel())) + - MAX2((SUMOReal)0, vehicle->getSpeed() - decel)); - const SUMOReal space2change = avgSpeed * STEPS2TIME(MSGlobals::gLaneChangeDuration); + double seen = myCandi->lane->getLength() - vehicle->getPositionOnLane(); + const double decel = vehicle->getCarFollowModel().getMaxDecel() * STEPS2TIME(MSGlobals::gLaneChangeDuration); + const double avgSpeed = 0.5 * ( + MAX2(0., vehicle->getSpeed() - ACCEL2SPEED(vehicle->getCarFollowModel().getMaxDecel())) + + MAX2(0., vehicle->getSpeed() - decel)); + const double space2change = avgSpeed * STEPS2TIME(MSGlobals::gLaneChangeDuration); // for finding turns it doesn't matter whether we look along the current lane or the target lane const std::vector& bestLaneConts = vehicle->getBestLanesContinuation(); int view = 1; @@ -721,13 +718,9 @@ state |= LCA_INSUFFICIENT_SPACE; break; } -#ifdef HAVE_INTERNAL_LANES if ((*link)->getViaLane() == 0) { view++; } -#else - view++; -#endif nextLane = (*link)->getViaLaneOrLane(); seen += nextLane->getLength(); // get the next link used @@ -745,11 +738,11 @@ if ((state & LCA_BLOCKED) == 0) { // check for dangerous leaders in case the target lane changes laterally between // now and the lane-changing midpoint - const SUMOReal speed = vehicle->getSpeed(); + const double speed = vehicle->getSpeed(); seen = myCandi->lane->getLength() - vehicle->getPositionOnLane(); nextLane = vehicle->getLane(); view = 1; - const SUMOReal dist = vehicle->getCarFollowModel().brakeGap(speed) + vehicle->getVehicleType().getMinGap(); + const double dist = vehicle->getCarFollowModel().brakeGap(speed) + vehicle->getVehicleType().getMinGap(); MSLinkCont::const_iterator link = MSLane::succLinkSec(*vehicle, view, *nextLane, bestLaneConts); while (!nextLane->isLinkEnd(link) && seen <= space2change && seen <= dist) { nextLane = (*link)->getViaLaneOrLane(); @@ -758,7 +751,7 @@ state |= LCA_INSUFFICIENT_SPACE; break; } else { - std::pair neighLead2 = targetLane->getLeader(vehicle, -seen, std::vector()); + std::pair neighLead2 = targetLane->getLeader(vehicle, -seen, std::vector()); if (neighLead2.first != 0 && neighLead2.first != neighLead.first && (neighLead2.second < vehicle->getCarFollowModel().getSecureGap( vehicle->getSpeed(), neighLead2.first->getSpeed(), neighLead2.first->getCarFollowModel().getMaxDecel()))) { @@ -766,23 +759,17 @@ break; } } -#ifdef HAVE_INTERNAL_LANES if ((*link)->getViaLane() == 0) { view++; } -#else - view++; -#endif seen += nextLane->getLength(); // get the next link used link = MSLane::succLinkSec(*vehicle, view, *nextLane, bestLaneConts); } } } -#ifndef NO_TRACI -#ifdef DEBUG_CHECK_CHANGE const int oldstate = state; -#endif +#ifndef NO_TRACI // let TraCI influence the wish to change lanes and the security to take state = vehicle->influenceChangeDecision(state); #endif @@ -797,12 +784,13 @@ << "\n"; } #endif + vehicle->getLaneChangeModel().saveState(laneOffset, oldstate, state); return state; } bool -MSLaneChanger::changeOpposite(std::pair leader) { +MSLaneChanger::changeOpposite(std::pair leader) { if (!myChangeToOpposite) { return false; } @@ -821,38 +809,39 @@ // XXX also check whether the leader is so far away as to be irrelevant return false; } - if (!source->getEdge().canChangeToOpposite()) { - return false; - } MSLane* opposite = source->getOpposite(); if (opposite == 0) { return false; } // changing into the opposite direction is always to the left (XXX except for left-hand networkds) - int direction = vehicle->getLaneChangeModel().isOpposite() ? -1 : 1; - std::pair neighLead((MSVehicle*)0, -1); + int direction = isOpposite ? -1 : 1; + std::pair neighLead((MSVehicle*)0, -1); // preliminary sanity checks for overtaking space + double timeToOvertake; + double spaceToOvertake; if (!isOpposite) { assert(leader.first != 0); // find a leader vehicle with sufficient space ahead for merging back - const SUMOReal overtakingSpeed = source->getVehicleMaxSpeed(vehicle); // just a guess - const SUMOReal mergeBrakeGap = vehicle->getCarFollowModel().brakeGap(overtakingSpeed); - const SUMOReal maxLookAhead = 150; // just a guess - std::pair columnLeader = leader; - SUMOReal egoGap = leader.second; + const double overtakingSpeed = source->getVehicleMaxSpeed(vehicle); // just a guess + const double mergeBrakeGap = vehicle->getCarFollowModel().brakeGap(overtakingSpeed); + std::pair columnLeader = leader; + double egoGap = leader.second; bool foundSpaceAhead = false; - SUMOReal seen = leader.second + leader.first->getVehicleType().getLengthWithGap(); + double seen = leader.second + leader.first->getVehicleType().getLengthWithGap(); std::vector conts = vehicle->getBestLanesContinuation(); while (!foundSpaceAhead) { - const SUMOReal requiredSpaceAfterLeader = (columnLeader.first->getCarFollowModel().getSecureGap( - columnLeader.first->getSpeed(), overtakingSpeed, vehicle->getCarFollowModel().getMaxDecel()) - + vehicle->getVehicleType().getLengthWithGap()); + const double requiredSpaceAfterLeader = (columnLeader.first->getCarFollowModel().getSecureGap( + columnLeader.first->getSpeed(), overtakingSpeed, vehicle->getCarFollowModel().getMaxDecel()) + + vehicle->getVehicleType().getLengthWithGap()); - std::pair leadLead = columnLeader.first->getLane()->getLeader( - columnLeader.first, columnLeader.first->getPositionOnLane(), conts, requiredSpaceAfterLeader + mergeBrakeGap, true); + // all leader vehicles on the current laneChanger edge are already moved into MSLane::myTmpVehicles + const bool checkTmpVehicles = (&columnLeader.first->getLane()->getEdge() == &source->getEdge()); + std::pair leadLead = columnLeader.first->getLane()->getLeader( + columnLeader.first, columnLeader.first->getPositionOnLane(), conts, requiredSpaceAfterLeader + mergeBrakeGap, + checkTmpVehicles); #ifdef DEBUG_CHANGE_OPPOSITE if (DEBUG_COND) { @@ -862,21 +851,21 @@ if (leadLead.first == 0) { foundSpaceAhead = true; } else { - const SUMOReal requiredSpace = (requiredSpaceAfterLeader - + vehicle->getCarFollowModel().getSecureGap(overtakingSpeed, leadLead.first->getSpeed(), leadLead.first->getCarFollowModel().getMaxDecel())); + const double requiredSpace = (requiredSpaceAfterLeader + + vehicle->getCarFollowModel().getSecureGap(overtakingSpeed, leadLead.first->getSpeed(), leadLead.first->getCarFollowModel().getMaxDecel())); if (leadLead.second > requiredSpace) { foundSpaceAhead = true; } else { #ifdef DEBUG_CHANGE_OPPOSITE if (DEBUG_COND) { - std::cout << " not enough space after columnLeader=" << leadLead.first->getID() << " gap=" << leadLead.second << " required=" << requiredSpace << "\n"; + std::cout << " not enough space after columnLeader=" << columnLeader.first->getID() << " required=" << requiredSpace << "\n"; } #endif - seen += leadLead.second + leadLead.first->getVehicleType().getLengthWithGap(); - if (seen > maxLookAhead) { + seen += MAX2(0., leadLead.second) + leadLead.first->getVehicleType().getLengthWithGap(); + if (seen > OPPOSITE_OVERTAKING_MAX_LOOKAHEAD) { #ifdef DEBUG_CHANGE_OPPOSITE if (DEBUG_COND) { - std::cout << " cannot changeOpposite due to insufficient free space after columnLeader (seen=" << seen << " columnLeader=" << leadLead.first->getID() << ")\n"; + std::cout << " cannot changeOpposite due to insufficient free space after columnLeader (seen=" << seen << " columnLeader=" << columnLeader.first->getID() << ")\n"; } #endif return false; @@ -897,8 +886,6 @@ std::cout << " compute time/space to overtake for columnLeader=" << columnLeader.first->getID() << " gap=" << columnLeader.second << "\n"; } #endif - SUMOReal timeToOvertake; - SUMOReal spaceToOvertake; computeOvertakingTime(vehicle, columnLeader.first, egoGap, timeToOvertake, spaceToOvertake); // check for upcoming stops if (vehicle->nextStopDist() < spaceToOvertake) { @@ -909,7 +896,7 @@ #endif return false; } - neighLead = opposite->getOppositeLeader(vehicle, timeToOvertake * opposite->getSpeedLimit() * 2 + spaceToOvertake); + neighLead = opposite->getOppositeLeader(vehicle, timeToOvertake * opposite->getSpeedLimit() * 2 + spaceToOvertake, true); #ifdef DEBUG_CHANGE_OPPOSITE if (DEBUG_COND) { @@ -917,7 +904,6 @@ << " veh=" << vehicle->getID() << " changeOpposite opposite=" << opposite->getID() << " lead=" << Named::getIDSecure(leader.first) - << " oncoming=" << Named::getIDSecure(neighLead.first) << " timeToOvertake=" << timeToOvertake << " spaceToOvertake=" << spaceToOvertake << "\n"; @@ -925,15 +911,13 @@ #endif // check for dangerous oncoming leader - if (!vehicle->getLaneChangeModel().isOpposite() && neighLead.first != 0) { + if (neighLead.first != 0) { const MSVehicle* oncoming = neighLead.first; - /// XXX what about overtaking multiple vehicles? #ifdef DEBUG_CHANGE_OPPOSITE if (DEBUG_COND) { std::cout << SIMTIME - << " timeToOvertake=" << timeToOvertake - << " spaceToOvertake=" << spaceToOvertake + << " oncoming=" << oncoming->getID() << " oncomingGap=" << neighLead.second << " leaderGap=" << leader.second << "\n"; @@ -949,65 +933,105 @@ return false; } } - // check for sufficient space on the opposite side - seen = source->getLength() - vehicle->getPositionOnLane(); - if (!vehicle->getLaneChangeModel().isOpposite() && seen < spaceToOvertake) { - const std::vector& bestLaneConts = vehicle->getBestLanesContinuation(); - assert(bestLaneConts.size() >= 1); - std::vector::const_iterator it = bestLaneConts.begin() + 1; - while (seen < spaceToOvertake && it != bestLaneConts.end()) { - if ((*it)->getOpposite() == 0) { + } else { + timeToOvertake = -1; + // look forward as far as possible + spaceToOvertake = std::numeric_limits::max(); + leader = source->getOppositeLeader(vehicle, OPPOSITE_OVERTAKING_ONCOMING_LOOKAHEAD, true); + // -1 will use getMaximumBrakeDist() as look-ahead distance + neighLead = opposite->getOppositeLeader(vehicle, -1, false); + } + + // compute remaining space on the opposite side + // 1. the part that remains on the current lane + double usableDist = isOpposite ? vehicle->getPositionOnLane() : source->getLength() - vehicle->getPositionOnLane(); + if (usableDist < spaceToOvertake) { + // look forward along the next lanes + const std::vector& bestLaneConts = vehicle->getBestLanesContinuation(); + assert(bestLaneConts.size() >= 1); + std::vector::const_iterator it = bestLaneConts.begin() + 1; + while (usableDist < spaceToOvertake && it != bestLaneConts.end()) { +#ifdef DEBUG_CHANGE_OPPOSITE + if (DEBUG_COND) { + std::cout << " usableDist=" << usableDist << " opposite=" << Named::getIDSecure((*it)->getOpposite()) << "\n"; + } +#endif + if ((*it)->getOpposite() == 0) { + // opposite lane ends + break; + } + // do not overtake past a minor link or turn + if (*(it - 1) != 0) { + MSLink* link = MSLinkContHelper::getConnectingLink(**(it - 1), **it); + if (link == 0 || !link->havePriority() || link->getState() == LINKSTATE_ZIPPER || link->getDirection() != LINKDIR_STRAIGHT) { break; } - // do not overtake past a minor link - if (*(it - 1) != 0) { - MSLink* link = MSLinkContHelper::getConnectingLink(**(it - 1), **it); - if (link == 0 || !link->havePriority() || link->getState() == LINKSTATE_ZIPPER) { - break; - } - } - seen += (*it)->getLength(); } - if (seen < spaceToOvertake) { + usableDist += (*it)->getLength(); + ++it; + } + } + if (!isOpposite && usableDist < spaceToOvertake) { #ifdef DEBUG_CHANGE_OPPOSITE - if (DEBUG_COND) { - std::cout << " cannot changeOpposite due to insufficient space (seen=" << seen << " spaceToOvertake=" << spaceToOvertake << ")\n"; - } + if (DEBUG_COND) { + std::cout << " cannot changeOpposite due to insufficient space (seen=" << usableDist << " spaceToOvertake=" << spaceToOvertake << ")\n"; + } #endif - return false; - } + return false; + } #ifdef DEBUG_CHANGE_OPPOSITE - if (DEBUG_COND) { - std::cout << " seen=" << seen << " spaceToOvertake=" << spaceToOvertake << " timeToOvertake=" << timeToOvertake << "\n"; - } -#endif - } - } else { - /// XXX compute sensible distance - leader = source->getOppositeLeader(vehicle, 200); - neighLead = opposite->getOppositeLeader(vehicle, -1); + if (DEBUG_COND) { + std::cout << " usableDist=" << usableDist << " spaceToOvertake=" << spaceToOvertake << " timeToOvertake=" << timeToOvertake << "\n"; } +#endif // compute wish to change std::vector preb = vehicle->getBestLanes(); - if (isOpposite && leader.first != 0) { + if (isOpposite) { + // compute the remaining distance that can be drive on the opposite side + // this value will put into LaneQ.length of the leftmost lane + // @note: length counts from the start of the current lane + // @note: see MSLCM_LC2013::_wantsChange @1092 (isOpposite() MSVehicle::LaneQ& laneQ = preb[preb.size() - 1]; - /// XXX compute sensible usable dist - laneQ.length -= MIN2(laneQ.length, opposite->getOppositePos(vehicle->getPositionOnLane()) + leader.second / 2); - leader.first = 0; // ignore leader + // position on the target lane + const double forwardPos = source->getOppositePos(vehicle->getPositionOnLane()); + + // consider usableDist (due to minor links or end of opposite lanes) + laneQ.length = MIN2(laneQ.length, usableDist + forwardPos); + // consider upcoming stops + laneQ.length = MIN2(laneQ.length, vehicle->nextStopDist() + forwardPos); + // consider oncoming leaders + if (leader.first != 0) { + laneQ.length = MIN2(laneQ.length, leader.second / 2 + forwardPos); +#ifdef DEBUG_CHANGE_OPPOSITE + if (DEBUG_COND) { + std::cout << SIMTIME << " found oncoming leader=" << leader.first->getID() << " gap=" << leader.second << "\n"; + } +#endif + leader.first = 0; // ignore leader after this + } +#ifdef DEBUG_CHANGE_OPPOSITE + if (DEBUG_COND) { + std::cout << SIMTIME << " veh=" << vehicle->getID() << " remaining dist=" << laneQ.length - forwardPos << " forwardPos=" << forwardPos << " laneQ.length=" << laneQ.length << "\n"; + } +#endif } - std::pair neighFollow = opposite->getOppositeFollower(vehicle); + std::pair neighFollow = opposite->getOppositeFollower(vehicle); int state = checkChange(direction, opposite, leader, neighLead, neighFollow, preb); bool changingAllowed = (state & LCA_BLOCKED) == 0; // change if the vehicle wants to and is allowed to change - if ((state & LCA_WANTS_LANECHANGE) != 0 && changingAllowed) { + if ((state & LCA_WANTS_LANECHANGE) != 0 && changingAllowed + // do not change to the opposite direction for cooperative reasons + && (isOpposite || (state & LCA_COOPERATIVE) == 0)) { vehicle->getLaneChangeModel().startLaneChangeManeuver(source, opposite, direction); /// XXX use a dedicated transformation function vehicle->myState.myPos = source->getOppositePos(vehicle->myState.myPos); - vehicle->myState.myBackPos = source->getOppositePos(vehicle->myState.myBackPos); - /// XXX compute a bette lateral position + /// XXX compute a better lateral position opposite->forceVehicleInsertion(vehicle, vehicle->getPositionOnLane(), MSMoveReminder::NOTIFICATION_LANE_CHANGE, 0); + if (!isOpposite) { + vehicle->myState.myBackPos = source->getOppositePos(vehicle->myState.myBackPos); + } #ifdef DEBUG_CHANGE_OPPOSITE if (DEBUG_COND) { std::cout << SIMTIME << " changing to opposite veh=" << vehicle->getID() << " dir=" << direction << " opposite=" << Named::getIDSecure(opposite) << " state=" << state << "\n"; @@ -1017,7 +1041,8 @@ } #ifdef DEBUG_CHANGE_OPPOSITE if (DEBUG_COND) { - std::cout << SIMTIME << " not changing to opposite veh=" << vehicle->getID() << " dir=" << direction << " opposite=" << Named::getIDSecure(opposite) << " state=" << state << "\n"; + std::cout << SIMTIME << " not changing to opposite veh=" << vehicle->getID() << " dir=" << direction + << " opposite=" << Named::getIDSecure(opposite) << " state=" << toString((LaneChangeAction)state) << "\n"; } #endif return false; @@ -1025,25 +1050,41 @@ void -MSLaneChanger::computeOvertakingTime(const MSVehicle* vehicle, const MSVehicle* leader, SUMOReal gap, SUMOReal& timeToOvertake, SUMOReal& spaceToOvertake) { - // Assumption: leader maintains the current speed +MSLaneChanger::computeOvertakingTime(const MSVehicle* vehicle, const MSVehicle* leader, double gap, double& timeToOvertake, double& spaceToOvertake) { + // Assumptions: + // - leader maintains the current speed + // - vehicle merges with maxSpeed ahead of leader // XXX affected by ticket #860 (the formula is invalid for the current position update rule) // first compute these values for the case where vehicle is accelerating // without upper bound on speed - const SUMOReal v = vehicle->getSpeed(); - const SUMOReal u = leader->getSpeed(); - const SUMOReal a = vehicle->getCarFollowModel().getMaxAccel(); - const SUMOReal g = gap + vehicle->getVehicleType().getMinGap() + leader->getVehicleType().getLengthWithGap(); - const SUMOReal sign = -1; // XXX recheck + const double vMax = vehicle->getLane()->getVehicleMaxSpeed(vehicle); + const double v = vehicle->getSpeed(); + const double u = leader->getSpeed(); + const double a = vehicle->getCarFollowModel().getMaxAccel(); + const double d = vehicle->getCarFollowModel().getMaxDecel(); + const double g = ( + // drive up to the rear of leader + gap + vehicle->getVehicleType().getMinGap() + // drive head-to-head with the leader + + leader->getVehicleType().getLengthWithGap() + // drive past the leader + + vehicle->getVehicleType().getLength() + // allow for safe gap between leader and vehicle + + leader->getCarFollowModel().getSecureGap(v, vMax, d)); + const double sign = -1; // XXX recheck // v*t + t*t*a*0.5 = g + u*t // solve t // t = ((u - v - (((((2.0*(u - v))**2.0) + (8.0*a*g))**(1.0/2.0))*sign/2.0))/a) - SUMOReal t = (u - v - sqrt(4 * (u - v) * (u - v) + 8 * a * g) * sign * 0.5) / a; + double t = (u - v - sqrt(4 * (u - v) * (u - v) + 8 * a * g) * sign * 0.5) / a; + + // allow for a safety time gap + t += OPPOSITE_OVERTAKING_SAFE_TIMEGAP; + // round to multiples of step length (TS) + t = ceil(t / TS) * TS; /// XXX ignore speed limit when overtaking through the opposite lane? - const SUMOReal vMax = vehicle->getLane()->getVehicleMaxSpeed(vehicle); - const SUMOReal timeToMaxSpeed = (vMax - v) / a; + const double timeToMaxSpeed = (vMax - v) / a; if (t <= timeToMaxSpeed) { timeToOvertake = t; @@ -1051,11 +1092,17 @@ //if (gDebugFlag1) std::cout << " t below " << timeToMaxSpeed << " vMax=" << vMax << "\n"; } else { // space until max speed is reached - const SUMOReal s = v * timeToMaxSpeed + timeToMaxSpeed * timeToMaxSpeed * a * 0.5; - const SUMOReal m = timeToMaxSpeed; + const double s = v * timeToMaxSpeed + timeToMaxSpeed * timeToMaxSpeed * a * 0.5; + const double m = timeToMaxSpeed; // s + (t-m) * vMax = g + u*t // solve t t = (g - s + m * vMax) / (vMax - u); + + // allow for a safety time gap + t += OPPOSITE_OVERTAKING_SAFE_TIMEGAP; + // round to multiples of step length (TS) + t = ceil(t / TS) * TS; + timeToOvertake = t; spaceToOvertake = s + (t - m) * vMax; //if (gDebugFlag1) std::cout << " s=" << s << " m=" << m << " vMax=" << vMax << "\n"; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLaneChanger.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLaneChanger.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLaneChanger.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLaneChanger.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Fri, 01 Feb 2002 -/// @version $Id: MSLaneChanger.h 21734 2016-10-18 10:59:35Z namdre $ +/// @version $Id: MSLaneChanger.h 23512 2017-03-17 12:33:17Z luecken $ /// // Performs lane changing of vehicles /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -83,7 +83,7 @@ /// the first vehicle on this edge that wants to change to this lane MSVehicle* firstBlocked; - SUMOReal dens; + double dens; /// @name Members which are used only by MSLaneChangerSublane /// @{ @@ -141,7 +141,7 @@ /** try changing to the opposite direction edge. */ - virtual bool changeOpposite(std::pair leader); + virtual bool changeOpposite(std::pair leader); /** Update changer for vehicles that did not change */ void registerUnchanged(MSVehicle* vehicle); @@ -150,7 +150,7 @@ virtual void updateChanger(bool vehHasChanged); /** During lane-change a temporary vehicle container is filled within - the lanes (bad pratice to modify foreign members, I know). Swap + the lanes (bad practice to modify foreign members, I know). Swap this container with the real one. */ void updateLanes(SUMOTime t); @@ -162,7 +162,7 @@ * and possible */ int checkChangeWithinEdge( int laneOffset, - const std::pair& leader, + const std::pair& leader, const std::vector& preb) const; /* @brief check whether lane changing in the given direction is desirable @@ -170,9 +170,9 @@ int checkChange( int laneOffset, const MSLane* targetLane, - const std::pair& leader, - const std::pair& neighLead, - const std::pair& neighFollow, + const std::pair& leader, + const std::pair& neighLead, + const std::pair& neighFollow, const std::vector& preb) const; /// @brief start the lane change maneuver (and finish it instantly if gLaneChangeDuration == 0) @@ -181,15 +181,15 @@ /// @brief continue a lane change maneuver and return whether the midpoint was passed in this step (used if gLaneChangeDuration > 0) bool continueChange(MSVehicle* vehicle, ChangerIt& from); - std::pair getRealFollower(const ChangerIt& target) const; + std::pair getRealFollower(const ChangerIt& target) const; - std::pair getRealLeader(const ChangerIt& target) const; + std::pair getRealLeader(const ChangerIt& target) const; /// @brief whether changing to the lane in the given direction should be considered bool mayChange(int direction) const; /// @brief return the closer follower of ego - static MSVehicle* getCloserFollower(const SUMOReal maxPos, MSVehicle* follow1, MSVehicle* follow2); + static MSVehicle* getCloserFollower(const double maxPos, MSVehicle* follow1, MSVehicle* follow2); /** @brief Compute the time and space required for overtaking the given leader * @param[in] vehicle The vehicle that wants to overtake @@ -198,7 +198,7 @@ * @param[out] timeToOvertake The time for overtaking * @param[out] spaceToOvertake The space for overtaking */ - static void computeOvertakingTime(const MSVehicle* vehicle, const MSVehicle* leader, SUMOReal gap, SUMOReal& timeToOvertake, SUMOReal& spaceToOvertake); + static void computeOvertakingTime(const MSVehicle* vehicle, const MSVehicle* leader, double gap, double& timeToOvertake, double& spaceToOvertake); protected: /// Container for ChangeElemements, one for every lane in the edge. @@ -211,7 +211,7 @@ /* @brief Whether vehicles may start to change lanes on this edge * (finishing a change in progress is always permitted) */ - bool myAllowsChanging; + const bool myAllowsChanging; /// @brief whether this edge allows changing to the opposite direction edge const bool myChangeToOpposite; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLaneChangerSublane.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLaneChangerSublane.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLaneChangerSublane.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLaneChangerSublane.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSLaneChangerSublane.cpp /// @author Jakob Erdmann /// @date Oct 2015 -/// @version $Id: MSLaneChangerSublane.cpp 21734 2016-10-18 10:59:35Z namdre $ +/// @version $Id: MSLaneChangerSublane.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Performs sub-lane changing of vehicles /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,7 @@ #include #include #include - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS +#include // =========================================================================== @@ -65,7 +62,7 @@ myCandi->ahead.addLeader(lead, false, 0); MSLane* shadowLane = lead->getLaneChangeModel().getShadowLane(); if (shadowLane != 0) { - const SUMOReal latOffset = lead->getLane()->getRightSideOnEdge() - shadowLane->getRightSideOnEdge(); + const double latOffset = lead->getLane()->getRightSideOnEdge() - shadowLane->getRightSideOnEdge(); //std::cout << SIMTIME << " updateChanger shadowLane=" << shadowLane->getID() << " lead=" << Named::getIDSecure(lead) << "\n"; (myChanger.begin() + shadowLane->getIndex())->ahead.addLeader(lead, false, latOffset); } @@ -152,8 +149,7 @@ bool -MSLaneChangerSublane::startChangeSublane(MSVehicle* vehicle, ChangerIt& from, SUMOReal latDist) { - //gDebugFlag4 = vehicle->getID() == "Togliatti_80_26"; +MSLaneChangerSublane::startChangeSublane(MSVehicle* vehicle, ChangerIt& from, double latDist) { // 1) update vehicles lateral position according to latDist and target lane vehicle->myState.myPosLat += latDist; vehicle->myCachedPosition = Position::INVALID; @@ -188,19 +184,31 @@ MSLane* shadowLane = vehicle->getLaneChangeModel().getShadowLane(); if (shadowLane != 0 && shadowLane != oldShadowLane) { assert(to != from); - const SUMOReal latOffset = vehicle->getLane()->getRightSideOnEdge() - shadowLane->getRightSideOnEdge(); + const double latOffset = vehicle->getLane()->getRightSideOnEdge() - shadowLane->getRightSideOnEdge(); (myChanger.begin() + shadowLane->getIndex())->ahead.addLeader(vehicle, false, latOffset); } - if (gDebugFlag4) std::cout << SIMTIME << " startChangeSublane shadowLane" - << " old=" << Named::getIDSecure(oldShadowLane) - << " new=" << Named::getIDSecure(vehicle->getLaneChangeModel().getShadowLane()) << "\n"; + // compute new angle of the vehicle from the x- and y-distances travelled within last time step // (should happen last because primaryLaneChanged() also triggers angle computation) // this part of the angle comes from the orientation of our current lane - SUMOReal laneAngle = vehicle->getLane()->getShape().rotationAtOffset(vehicle->getLane()->interpolateLanePosToGeometryPos(vehicle->getPositionOnLane())) ; + double laneAngle = vehicle->getLane()->getShape().rotationAtOffset(vehicle->getLane()->interpolateLanePosToGeometryPos(vehicle->getPositionOnLane())) ; // this part of the angle comes from the vehicle's lateral movement - SUMOReal changeAngle = atan2(latDist, SPEED2DIST(vehicle->getSpeed())); + double changeAngle = 0; + // avoid flicker + if (fabs(latDist) > NUMERICAL_EPS) { + // avoid extreme angles by using vehicle length as a proxy for turning radius + changeAngle = atan2(latDist, SPEED2DIST(MAX2(vehicle->getVehicleType().getLength(), vehicle->getSpeed()))); + } + if (vehicle->getLaneChangeModel().debugVehicle()) std::cout << SIMTIME << " startChangeSublane shadowLane" + << " latDist=" << latDist + << " old=" << Named::getIDSecure(oldShadowLane) + << " new=" << Named::getIDSecure(vehicle->getLaneChangeModel().getShadowLane()) + << " laneA=" << RAD2DEG(laneAngle) + << " changeA=" << RAD2DEG(changeAngle) + << " oldA=" << RAD2DEG(vehicle->getAngle()) + << " newA=" << RAD2DEG(laneAngle + changeAngle) + << "\n"; vehicle->setAngle(laneAngle + changeAngle); return changedToNewLane; @@ -221,7 +229,7 @@ const MSVehicle* veh = target->ahead[i]; if (veh != 0) { assert(veh != 0); - const SUMOReal gap = veh->getBackPositionOnLane() - ego->getPositionOnLane() - ego->getVehicleType().getMinGap(); + const double gap = veh->getBackPositionOnLane() - ego->getPositionOnLane() - ego->getVehicleType().getMinGap(); if (gDebugFlag1) { std::cout << " ahead lead=" << veh->getID() << " leadBack=" << veh->getBackPositionOnLane() << " gap=" << gap << "\n"; } @@ -234,7 +242,7 @@ for (int i = 0; i < aheadSamePos.numSublanes(); ++i) { const MSVehicle* veh = aheadSamePos[i]; if (veh != 0 && veh != ego) { - const SUMOReal gap = veh->getBackPositionOnLane(target->lane) - ego->getPositionOnLane() - ego->getVehicleType().getMinGap(); + const double gap = veh->getBackPositionOnLane(target->lane) - ego->getPositionOnLane() - ego->getVehicleType().getMinGap(); if (gDebugFlag1) { std::cout << " further lead=" << veh->getID() << " leadBack=" << veh->getBackPositionOnLane(target->lane) << " gap=" << gap << "\n"; } @@ -245,9 +253,9 @@ if (result.numFreeSublanes() > 0) { MSLane* targetLane = target->lane; - SUMOReal seen = ego->getLane()->getLength() - ego->getPositionOnLane(); - SUMOReal speed = ego->getSpeed(); - SUMOReal dist = ego->getCarFollowModel().brakeGap(speed) + ego->getVehicleType().getMinGap(); + double seen = ego->getLane()->getLength() - ego->getPositionOnLane(); + double speed = ego->getSpeed(); + double dist = ego->getCarFollowModel().brakeGap(speed) + ego->getVehicleType().getMinGap(); if (seen > dist) { return result; } @@ -262,7 +270,7 @@ MSLaneChangerSublane::checkChangeSublane( int laneOffset, const std::vector& preb, - SUMOReal& latDist) const { + double& latDist) const { ChangerIt target = myCandi + laneOffset; MSVehicle* vehicle = veh(myCandi); @@ -272,10 +280,10 @@ //gDebugFlag1 = vehicle->getLaneChangeModel().debugVehicle(); MSLeaderDistanceInfo neighLeaders = getLeaders(target, vehicle); - MSLeaderDistanceInfo neighFollowers = target->lane->getFollowersOnConsecutive(vehicle, true); + MSLeaderDistanceInfo neighFollowers = target->lane->getFollowersOnConsecutive(vehicle, vehicle->getBackPositionOnLane(), true); MSLeaderDistanceInfo neighBlockers(&neighLane, vehicle, vehicle->getLane()->getRightSideOnEdge() - neighLane.getRightSideOnEdge()); MSLeaderDistanceInfo leaders = getLeaders(myCandi, vehicle); - MSLeaderDistanceInfo followers = myCandi->lane->getFollowersOnConsecutive(vehicle, true); + MSLeaderDistanceInfo followers = myCandi->lane->getFollowersOnConsecutive(vehicle, vehicle->getBackPositionOnLane(), true); MSLeaderDistanceInfo blockers(vehicle->getLane(), vehicle, 0); if (gDebugFlag1) std::cout << SIMTIME @@ -302,14 +310,15 @@ // ensure that a continuous lane change manoeuvre can be completed // before the next turning movement + const int oldstate = state; #ifndef NO_TRACI // let TraCI influence the wish to change lanes and the security to take - //const int oldstate = state; state = vehicle->influenceChangeDecision(state); //if (vehicle->getID() == "150_2_36000000") { // std::cout << STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()) << " veh=" << vehicle->getID() << " oldstate=" << oldstate << " newstate=" << state << "\n"; //} #endif + vehicle->getLaneChangeModel().saveState(laneOffset, oldstate, state); gDebugFlag1 = false; return state; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLaneChangerSublane.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLaneChangerSublane.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLaneChangerSublane.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLaneChangerSublane.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSLaneChangerSublane.cpp /// @author Jakob Erdmann /// @date Oct 2015 -/// @version $Id: MSLaneChangerSublane.h 21734 2016-10-18 10:59:35Z namdre $ +/// @version $Id: MSLaneChangerSublane.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Performs sub-lane changing of vehicles /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -72,10 +72,10 @@ int checkChangeSublane( int laneOffset, const std::vector& preb, - SUMOReal& latDist) const; + double& latDist) const; /// @brief change by the specified amount and return whether a new lane was entered - bool startChangeSublane(MSVehicle* vehicle, ChangerIt& from, SUMOReal latDist); + bool startChangeSublane(MSVehicle* vehicle, ChangerIt& from, double latDist); /// @brief get leaders for ego on the given lane MSLeaderDistanceInfo getLeaders(const ChangerIt& target, const MSVehicle* ego) const; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLane.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLane.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLane.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLane.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -9,12 +9,12 @@ /// @author Christoph Sommer /// @author Mario Krumnow /// @date Mon, 05 Mar 2001 -/// @version $Id: MSLane.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSLane.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Representation of a lane in the micro simulation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -70,14 +70,14 @@ #include "MSLeaderInfo.h" #include "MSVehicle.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - //#define DEBUG_INSERTION //#define DEBUG_PLAN_MOVE //#define DEBUG_CONTEXT //#define DEBUG_OPPOSITE +//#define DEBUG_VEHICLE_CONTAINER +//#define DEBUG_COLLISIONS +//#define DEBUG_LANE_SORTER + #define DEBUG_COND (getID() == "disabled") #define DEBUG_COND2(obj) ((obj != 0 && (obj)->getID() == "disabled")) @@ -87,6 +87,7 @@ MSLane::DictType MSLane::myDict; MSLane::CollisionAction MSLane::myCollisionAction(MSLane::COLLISION_ACTION_TELEPORT); bool MSLane::myCheckJunctionCollisions(false); +SUMOTime MSLane::myCollisionStopTime(0); // =========================================================================== // internal class method definitions @@ -157,15 +158,17 @@ // =========================================================================== // member method definitions // =========================================================================== -MSLane::MSLane(const std::string& id, SUMOReal maxSpeed, SUMOReal length, MSEdge* const edge, - int numericalID, const PositionVector& shape, SUMOReal width, - SVCPermissions permissions, int index) : +MSLane::MSLane(const std::string& id, double maxSpeed, double length, MSEdge* const edge, + int numericalID, const PositionVector& shape, double width, + SVCPermissions permissions, int index, bool isRampAccel) : Named(id), myNumericalID(numericalID), myShape(shape), myIndex(index), myVehicles(), myLength(length), myWidth(width), myEdge(edge), myMaxSpeed(maxSpeed), myPermissions(permissions), myOriginalPermissions(permissions), myLogicalPredecessorLane(0), + myCanonicalPredecessorLane(0), + myCanonicalSuccessorLane(0), myBruttoVehicleLengthSum(0), myNettoVehicleLengthSum(0), myLeaderInfo(this, 0, 0), myFollowerInfo(this, 0, 0), @@ -173,9 +176,11 @@ myLeaderInfoTime(SUMOTime_MIN), myFollowerInfoTime(SUMOTime_MIN), myLengthGeometryFactor(MAX2(POSITION_EPS, myShape.length()) / myLength), // factor should not be 0 + myIsRampAccel(isRampAccel), myRightSideOnEdge(0), // initialized in MSEdge::initialize - myRightmostSublane(0) { // initialized in MSEdge::initialize - myRestrictions = MSNet::getInstance()->getRestrictions(edge->getEdgeType()); + myRightmostSublane(0) { + // initialized in MSEdge::initialize + initRestrictions();// may be reloaded again from initialized in MSEdge::closeBuilding } @@ -187,6 +192,12 @@ void +MSLane::initRestrictions() { + myRestrictions = MSNet::getInstance()->getRestrictions(myEdge->getEdgeType()); +} + + +void MSLane::addLink(MSLink* link) { myLinks.push_back(link); } @@ -208,7 +219,7 @@ } -SUMOReal +double MSLane::setPartialOccupation(MSVehicle* v) { #ifdef DEBUG_CONTEXT if (DEBUG_COND2(v)) { @@ -242,7 +253,7 @@ // ------ Vehicle emission ------ void -MSLane::incorporateVehicle(MSVehicle* veh, SUMOReal pos, SUMOReal speed, SUMOReal posLat, const MSLane::VehCont::iterator& at, MSMoveReminder::Notification notification) { +MSLane::incorporateVehicle(MSVehicle* veh, double pos, double speed, double posLat, const MSLane::VehCont::iterator& at, MSMoveReminder::Notification notification) { assert(pos <= myLength); bool wasInactive = myVehicles.size() == 0; veh->enterLaneAtInsertion(this, pos, speed, posLat, notification); @@ -262,36 +273,54 @@ bool -MSLane::lastInsertion(MSVehicle& veh, SUMOReal mspeed) { +MSLane::lastInsertion(MSVehicle& veh, double mspeed, bool patchSpeed) { // XXX interpret departPosLat value - const SUMOReal posLat = 0; - const bool adaptSpeed = false; - if (myVehicles.size() == 0) { - return isInsertionSuccess(&veh, mspeed, basePos(veh), posLat, adaptSpeed, MSMoveReminder::NOTIFICATION_DEPARTED); + const double posLat = 0; + double pos = getLength() - POSITION_EPS; + MSVehicle* leader = getLastAnyVehicle(); + // back position of leader relative to this lane + double leaderBack; + if (leader == 0) { + /// look for a leaders on consecutive lanes + veh.setTentativeLaneAndPosition(this, pos, posLat); + veh.updateBestLanes(false, this); + std::pair leaderInfo = getLeader(&veh, pos, veh.getBestLanesContinuation(), veh.getCarFollowModel().brakeGap(mspeed)); + leader = leaderInfo.first; + leaderBack = pos + leaderInfo.second + veh.getVehicleType().getMinGap(); + } else { + leaderBack = leader->getBackPositionOnLane(this); + //std::cout << " leaderPos=" << leader->getPositionOnLane(this) << " leaderBack=" << leader->getBackPositionOnLane(this) << " leaderLane=" << leader->getLane()->getID() << "\n"; } - // try to insert behind the last vehicle - const MSVehicle* leader = myVehicles.front(); - const SUMOReal leaderBack = leader->getPositionOnLane() - leader->getVehicleType().getLength(); - const SUMOReal frontGapNeeded = veh.getCarFollowModel().getSecureGap(mspeed, leader->getSpeed(), leader->getCarFollowModel().getMaxDecel()) + veh.getVehicleType().getMinGap() + POSITION_EPS; - if (leaderBack >= frontGapNeeded) { - return isInsertionSuccess(&veh, mspeed, leaderBack - frontGapNeeded, posLat, adaptSpeed, MSMoveReminder::NOTIFICATION_DEPARTED); + if (leader == 0) { + // insert at the end of this lane + return isInsertionSuccess(&veh, mspeed, pos, posLat, patchSpeed, MSMoveReminder::NOTIFICATION_DEPARTED); + } else { + // try to insert behind the leader + const double frontGapNeeded = veh.getCarFollowModel().getSecureGap(mspeed, leader->getSpeed(), leader->getCarFollowModel().getMaxDecel()) + veh.getVehicleType().getMinGap() + POSITION_EPS; + if (leaderBack >= frontGapNeeded) { + pos = MIN2(pos, leaderBack - frontGapNeeded); + bool result = isInsertionSuccess(&veh, mspeed, pos, posLat, patchSpeed, MSMoveReminder::NOTIFICATION_DEPARTED); + //if (!result) std::cout << " insertLast failed for " << veh.getID() << " pos=" << pos << " leaderBack=" << leaderBack << " frontGapNeeded=" << frontGapNeeded << "\n"; + return result; + } + //std::cout << " insertLast failed for " << veh.getID() << " pos=" << pos << " leaderBack=" << leaderBack << " frontGapNeeded=" << frontGapNeeded << "\n"; } return false; } bool -MSLane::freeInsertion(MSVehicle& veh, SUMOReal mspeed, +MSLane::freeInsertion(MSVehicle& veh, double mspeed, MSMoveReminder::Notification notification) { bool adaptableSpeed = true; // try to insert teleporting vehicles fully on this lane - const SUMOReal minPos = (notification == MSMoveReminder::NOTIFICATION_TELEPORT ? - MIN2(myLength, veh.getVehicleType().getLength()) : 0); - + const double minPos = (notification == MSMoveReminder::NOTIFICATION_TELEPORT ? + MIN2(myLength, veh.getVehicleType().getLength()) : 0); + veh.setTentativeLaneAndPosition(this, minPos, 0); if (myVehicles.size() == 0) { // ensure sufficient gap to followers on predecessor lanes - const SUMOReal backOffset = minPos - veh.getVehicleType().getLength(); - const SUMOReal missingRearGap = getMissingRearGap(backOffset, mspeed, veh.getCarFollowModel().getMaxDecel()); + const double backOffset = minPos - veh.getVehicleType().getLength(); + const double missingRearGap = getMissingRearGap(&veh, backOffset, mspeed); if (missingRearGap > 0) { if (minPos + missingRearGap <= myLength) { // @note. The rear gap is tailored to mspeed. If it changes due @@ -311,11 +340,11 @@ } else { // check whether the vehicle can be put behind the last one if there is such MSVehicle* leader = getFirstFullVehicle(); // @todo reproduction of bogus old behavior. see #1961 - const SUMOReal leaderPos = leader->getBackPositionOnLane(this); - const SUMOReal speed = adaptableSpeed ? leader->getSpeed() : mspeed; - const SUMOReal frontGapNeeded = veh.getCarFollowModel().getSecureGap(speed, leader->getSpeed(), leader->getCarFollowModel().getMaxDecel()) + veh.getVehicleType().getMinGap(); + const double leaderPos = leader->getBackPositionOnLane(this); + const double speed = adaptableSpeed ? leader->getSpeed() : mspeed; + const double frontGapNeeded = veh.getCarFollowModel().getSecureGap(speed, leader->getSpeed(), leader->getCarFollowModel().getMaxDecel()) + veh.getVehicleType().getMinGap(); if (leaderPos >= frontGapNeeded) { - const SUMOReal tspeed = MIN2(veh.getCarFollowModel().insertionFollowSpeed(&veh, mspeed, frontGapNeeded, leader->getSpeed(), leader->getCarFollowModel().getMaxDecel()), mspeed); + const double tspeed = MIN2(veh.getCarFollowModel().insertionFollowSpeed(&veh, mspeed, frontGapNeeded, leader->getSpeed(), leader->getCarFollowModel().getMaxDecel()), mspeed); // check whether we can insert our vehicle behind the last vehicle on the lane if (isInsertionSuccess(&veh, tspeed, minPos, 0, adaptableSpeed, notification)) { //std::cout << SIMTIME << " freeInsertion lane=" << getID() << " veh=" << veh.getID() << " pos=" << minPos<< " speed=" << speed << " tspeed=" << tspeed << " frontGapNeeded=" << frontGapNeeded << " lead=" << leader->getID() << " lPos=" << leaderPos << "\n vehsOnLane=" << toString(myVehicles) << " @(358)\n"; @@ -335,22 +364,22 @@ const MSVehicle* follower = *predIt; // patch speed if allowed - SUMOReal speed = mspeed; + double speed = mspeed; if (adaptableSpeed && leader != 0) { speed = MIN2(leader->getSpeed(), mspeed); } // compute the space needed to not collide with leader - SUMOReal frontMax = getLength(); + double frontMax = getLength(); if (leader != 0) { - SUMOReal leaderRearPos = leader->getBackPositionOnLane(this); - SUMOReal frontGapNeeded = veh.getCarFollowModel().getSecureGap(speed, leader->getSpeed(), leader->getCarFollowModel().getMaxDecel()) + veh.getVehicleType().getMinGap(); + double leaderRearPos = leader->getBackPositionOnLane(this); + double frontGapNeeded = veh.getCarFollowModel().getSecureGap(speed, leader->getSpeed(), leader->getCarFollowModel().getMaxDecel()) + veh.getVehicleType().getMinGap(); frontMax = leaderRearPos - frontGapNeeded; } // compute the space needed to not let the follower collide - const SUMOReal followPos = follower->getPositionOnLane() + follower->getVehicleType().getMinGap(); - const SUMOReal backGapNeeded = follower->getCarFollowModel().getSecureGap(follower->getSpeed(), veh.getSpeed(), veh.getCarFollowModel().getMaxDecel()); - const SUMOReal backMin = followPos + backGapNeeded + veh.getVehicleType().getLength(); + const double followPos = follower->getPositionOnLane() + follower->getVehicleType().getMinGap(); + const double backGapNeeded = follower->getCarFollowModel().getSecureGap(follower->getSpeed(), veh.getSpeed(), veh.getCarFollowModel().getMaxDecel()); + const double backMin = followPos + backGapNeeded + veh.getVehicleType().getLength(); // check whether there is enough room (given some extra space for rounding errors) if (frontMax > minPos && backMin + POSITION_EPS < frontMax) { @@ -368,9 +397,9 @@ } -SUMOReal +double MSLane::getDepartSpeed(const MSVehicle& veh, bool& patchSpeed) { - SUMOReal speed = 0; + double speed = 0; const SUMOVehicleParameter& pars = veh.getParameter(); switch (pars.departSpeedProcedure) { case DEPART_SPEED_GIVEN: @@ -397,11 +426,11 @@ bool MSLane::insertVehicle(MSVehicle& veh) { - SUMOReal pos = 0; - SUMOReal posLat = 0; + double pos = 0; + double posLat = 0; bool patchSpeed = true; // whether the speed shall be adapted to infrastructure/traffic in front const SUMOVehicleParameter& pars = veh.getParameter(); - SUMOReal speed = getDepartSpeed(veh, patchSpeed); + double speed = getDepartSpeed(veh, patchSpeed); // determine the position switch (pars.departPosProcedure) { @@ -433,7 +462,7 @@ case DEPART_POS_FREE: return freeInsertion(veh, speed); case DEPART_POS_LAST: - return lastInsertion(veh, speed); + return lastInsertion(veh, speed, patchSpeed); case DEPART_POS_BASE: case DEPART_POS_DEFAULT: default: @@ -479,13 +508,13 @@ } -SUMOReal +double MSLane::basePos(const MSVehicle& veh) const { return MIN2(veh.getVehicleType().getLength() + POSITION_EPS, myLength); } bool -MSLane::checkFailure(MSVehicle* aVehicle, SUMOReal& speed, SUMOReal& dist, const SUMOReal nspeed, const bool patchSpeed, const std::string errorMsg) const { +MSLane::checkFailure(MSVehicle* aVehicle, double& speed, double& dist, const double nspeed, const bool patchSpeed, const std::string errorMsg) const { if (nspeed < speed) { if (patchSpeed) { speed = MIN2(nspeed, speed); @@ -504,7 +533,7 @@ bool MSLane::isInsertionSuccess(MSVehicle* aVehicle, - SUMOReal speed, SUMOReal pos, SUMOReal posLat, bool patchSpeed, + double speed, double pos, double posLat, bool patchSpeed, MSMoveReminder::Notification notification) { if (pos < 0 || pos > myLength) { // we may not start there @@ -524,8 +553,8 @@ const MSCFModel& cfModel = aVehicle->getCarFollowModel(); const std::vector& bestLaneConts = aVehicle->getBestLanesContinuation(this); std::vector::const_iterator ri = bestLaneConts.begin(); - SUMOReal seen = getLength() - pos; // == distance from insertion position until the end of the currentLane - SUMOReal dist = cfModel.brakeGap(speed) + aVehicle->getVehicleType().getMinGap(); + double seen = getLength() - pos; // == distance from insertion position until the end of the currentLane + double dist = cfModel.brakeGap(speed) + aVehicle->getVehicleType().getMinGap(); // before looping through the continuation lanes, check if a stop is scheduled on this lane // (the code is duplicated in the loop) @@ -534,7 +563,7 @@ if (nextStop.lane == this) { std::stringstream msg; msg << "scheduled stop on lane '" << myID << "' too close"; - const SUMOReal distToStop = nextStop.endPos - pos; // XXX: Please approve whether endPos is appropriate, here. (Leo) + const double distToStop = nextStop.endPos - pos; if (checkFailure(aVehicle, speed, dist, cfModel.stopSpeed(aVehicle, speed, distToStop), patchSpeed, msg.str())) { // we may not drive with the given velocity - we cannot stop at the stop @@ -611,7 +640,7 @@ if (nextStop.lane == nextLane) { std::stringstream msg; msg << "scheduled stop on lane '" << nextStop.lane->getID() << "' too close"; - const SUMOReal distToStop = seen + nextStop.endPos; // XXX: Please approve whether endPos is appropriate, here. (Leo) + const double distToStop = seen + nextStop.endPos; if (checkFailure(aVehicle, speed, dist, cfModel.stopSpeed(aVehicle, speed, distToStop), patchSpeed, msg.str())) { // we may not drive with the given velocity - we cannot stop at the stop @@ -622,7 +651,7 @@ // check leader on next lane // XXX check all leaders in the sublane case - SUMOReal gap = 0; + double gap = 0; MSVehicle* leader = nextLane->getLastAnyVehicle(); if (leader != 0) { #ifdef DEBUG_INSERTION @@ -635,7 +664,7 @@ if (gap < 0) { return false; } - const SUMOReal nspeed = cfModel.insertionFollowSpeed(aVehicle, speed, gap, leader->getSpeed(), leader->getCarFollowModel().getMaxDecel()); + const double nspeed = cfModel.insertionFollowSpeed(aVehicle, speed, gap, leader->getSpeed(), leader->getCarFollowModel().getMaxDecel()); if (checkFailure(aVehicle, speed, dist, nspeed, patchSpeed, "")) { // we may not drive with the given velocity - we crash into the leader #ifdef DEBUG_INSERTION @@ -656,7 +685,7 @@ } } // check next lane's maximum velocity - const SUMOReal nspeed = cfModel.freeSpeed(aVehicle, speed, seen, nextLane->getVehicleMaxSpeed(aVehicle), true); + const double nspeed = cfModel.freeSpeed(aVehicle, speed, seen, nextLane->getVehicleMaxSpeed(aVehicle), true); if (nspeed < speed) { if (patchSpeed) { speed = nspeed; @@ -681,11 +710,7 @@ arrivalTime += TIME2STEPS(nextLane->getLength() / MAX2(speed, NUMERICAL_EPS)); seen += nextLane->getLength(); currentLane = nextLane; -#ifdef HAVE_INTERNAL_LANES if ((*link)->getViaLane() == 0) { -#else - if (true) { -#endif nRouteSuccs++; ++ce; ++ri; @@ -696,7 +721,7 @@ // get the pointer to the vehicle next in front of the given position MSLeaderInfo leaders = getLastVehicleInformation(aVehicle, 0, pos); //if (aVehicle->getID() == "disabled") std::cout << " leaders=" << leaders.toString() << "\n"; - const SUMOReal nspeed = safeInsertionSpeed(aVehicle, leaders, speed); + const double nspeed = safeInsertionSpeed(aVehicle, leaders, speed); if (nspeed < 0 || checkFailure(aVehicle, speed, dist, nspeed, patchSpeed, "")) { // XXX: checking for nspeed<0... Might appear naturally with ballistic update (see #860, Leo) // TODO: check if ballistic update needs adjustments here, refs. #2577 @@ -724,11 +749,11 @@ << std::endl; #endif - MSLeaderDistanceInfo followers = getFollowersOnConsecutive(aVehicle, false); + MSLeaderDistanceInfo followers = getFollowersOnConsecutive(aVehicle, aVehicle->getBackPositionOnLane(), false); for (int i = 0; i < followers.numSublanes(); ++i) { const MSVehicle* follower = followers[i].first; if (follower != 0) { - const SUMOReal backGapNeeded = follower->getCarFollowModel().getSecureGap(follower->getSpeed(), speed, cfModel.getMaxDecel()); + const double backGapNeeded = follower->getCarFollowModel().getSecureGap(follower->getSpeed(), speed, cfModel.getMaxDecel()); if (followers[i].second < backGapNeeded) { // too close to the follower on this lane #ifdef DEBUG_INSERTION @@ -751,8 +776,8 @@ } if (followers.numFreeSublanes() > 0) { // check approaching vehicles to prevent rear-end collisions - const SUMOReal backOffset = pos - aVehicle->getVehicleType().getLength(); - const SUMOReal missingRearGap = getMissingRearGap(backOffset, speed, aVehicle->getCarFollowModel().getMaxDecel()); + const double backOffset = pos - aVehicle->getVehicleType().getLength(); + const double missingRearGap = getMissingRearGap(aVehicle, backOffset, speed); if (missingRearGap > 0) { // too close to a follower #ifdef DEBUG_INSERTION @@ -803,21 +828,21 @@ void -MSLane::forceVehicleInsertion(MSVehicle* veh, SUMOReal pos, MSMoveReminder::Notification notification, SUMOReal posLat) { +MSLane::forceVehicleInsertion(MSVehicle* veh, double pos, MSMoveReminder::Notification notification, double posLat) { veh->updateBestLanes(true, this); bool dummy; - const SUMOReal speed = veh->hasDeparted() ? veh->getSpeed() : getDepartSpeed(*veh, dummy); + const double speed = veh->hasDeparted() ? veh->getSpeed() : getDepartSpeed(*veh, dummy); incorporateVehicle(veh, pos, speed, posLat, find_if(myVehicles.begin(), myVehicles.end(), bind2nd(VehPosition(), pos)), notification); } -SUMOReal -MSLane::safeInsertionSpeed(const MSVehicle* veh, const MSLeaderInfo& leaders, SUMOReal speed) { - SUMOReal nspeed = speed; +double +MSLane::safeInsertionSpeed(const MSVehicle* veh, const MSLeaderInfo& leaders, double speed) { + double nspeed = speed; for (int i = 0; i < leaders.numSublanes(); ++i) { const MSVehicle* leader = leaders[i]; if (leader != 0) { - const SUMOReal gap = leader->getBackPositionOnLane(this) - veh->getPositionOnLane() - veh->getVehicleType().getMinGap(); + const double gap = leader->getBackPositionOnLane(this) - veh->getPositionOnLane() - veh->getVehicleType().getMinGap(); if (gap < 0) { return -1; } @@ -831,7 +856,7 @@ // ------ Handling vehicles lapping into lanes ------ const MSLeaderInfo& -MSLane::getLastVehicleInformation(const MSVehicle* ego, SUMOReal latOffset, SUMOReal minPos, bool allowCached) const { +MSLane::getLastVehicleInformation(const MSVehicle* ego, double latOffset, double minPos, bool allowCached) const { if (myLeaderInfoTime < MSNet::getInstance()->getCurrentTimeStep() || ego != 0 || minPos > 0 || !allowCached) { myLeaderInfoTmp = MSLeaderInfo(this, ego, latOffset); AnyVehicleIterator last = anyVehiclesBegin(); @@ -847,7 +872,7 @@ } #endif if (veh != ego && veh->getPositionOnLane(this) >= minPos) { - const SUMOReal latOffset = veh->getLatOffset(this); + const double latOffset = veh->getLatOffset(this); freeSublanes = myLeaderInfoTmp.addLeader(veh, true, latOffset); #ifdef DEBUG_PLAN_MOVE if (DEBUG_COND2(ego)) { @@ -882,7 +907,7 @@ const MSLeaderInfo& -MSLane::getFirstVehicleInformation(const MSVehicle* ego, SUMOReal latOffset, bool onlyFrontOnLane, SUMOReal maxPos, bool allowCached) const { +MSLane::getFirstVehicleInformation(const MSVehicle* ego, double latOffset, bool onlyFrontOnLane, double maxPos, bool allowCached) const { if (myFollowerInfoTime < MSNet::getInstance()->getCurrentTimeStep() || ego != 0 || maxPos < myLength || !allowCached || onlyFrontOnLane) { // XXX separate cache for onlyFrontOnLane = true myLeaderInfoTmp = MSLeaderInfo(this, ego, latOffset); @@ -897,8 +922,8 @@ #endif if (veh != ego && veh->getPositionOnLane(this) <= maxPos && (!onlyFrontOnLane || veh->isFrontOnLane(this))) { - //const SUMOReal latOffset = veh->getLane()->getRightSideOnEdge() - getRightSideOnEdge(); - const SUMOReal latOffset = veh->getLatOffset(this); + //const double latOffset = veh->getLane()->getRightSideOnEdge() - getRightSideOnEdge(); + const double latOffset = veh->getLatOffset(this); #ifdef DEBUG_PLAN_MOVE if (DEBUG_COND2(ego)) { std::cout << " veh=" << veh->getID() << " latOffset=" << latOffset << "\n"; @@ -908,7 +933,7 @@ } veh = *(++first); } - if (ego == 0 && maxPos == std::numeric_limits::max()) { + if (ego == 0 && maxPos == std::numeric_limits::max()) { // update cached value myFollowerInfoTime = MSNet::getInstance()->getCurrentTimeStep(); myFollowerInfo = myLeaderInfoTmp; @@ -936,7 +961,7 @@ void MSLane::planMovements(SUMOTime t) { assert(myVehicles.size() != 0); - SUMOReal cumulatedVehLength = 0.; + double cumulatedVehLength = 0.; MSLeaderInfo ahead(this); // iterate over myVehicles and myPartialVehicles merge-sort style VehCont::reverse_iterator veh = myVehicles.rbegin(); @@ -954,7 +979,7 @@ for (; veh != myVehicles.rend(); ++veh) { while (vehPart != myPartialVehicles.rend() && ((*vehPart)->getPositionOnLane(this) > (*veh)->getPositionOnLane())) { - const SUMOReal latOffset = (*vehPart)->getLatOffset(this); + const double latOffset = (*vehPart)->getLatOffset(this); #ifdef DEBUG_PLAN_MOVE if (DEBUG_COND) { std::cout << " partial ahead: " << (*vehPart)->getID() << " latOffset=" << latOffset << "\n"; @@ -977,15 +1002,19 @@ void MSLane::detectCollisions(SUMOTime timestep, const std::string& stage) { - //std::vector all; - //for (AnyVehicleIterator last = anyVehiclesBegin(); last != anyVehiclesEnd(); ++last) { - // all.push_back(*last); - //} - //std::cout << SIMTIME << " detectCollisions stage=" << stage << " lane=" << getID() << ":\n" - // << " vehs=" << toString(myVehicles) << "\n" - // << " part=" << toString(myPartialVehicles) << "\n" - // << " all=" << toString(all) << "\n" - // << "\n"; +#ifdef DEBUG_COLLISIONS + if (DEBUG_COND) { + std::vector all; + for (AnyVehicleIterator last = anyVehiclesBegin(); last != anyVehiclesEnd(); ++last) { + all.push_back(*last); + } + std::cout << SIMTIME << " detectCollisions stage=" << stage << " lane=" << getID() << ":\n" + << " vehs=" << toString(myVehicles) << "\n" + << " part=" << toString(myPartialVehicles) << "\n" + << " all=" << toString(all) << "\n" + << "\n"; + } +#endif if (myVehicles.size() == 0 || myCollisionAction == COLLISION_ACTION_NONE) { return; @@ -1012,28 +1041,29 @@ // (lanechanger-style) // XXX quick hack: check each in myVehicles against all others - for (VehCont::iterator veh = myVehicles.begin(); veh != myVehicles.end(); ++veh) { - MSVehicle* follow = *veh; + for (AnyVehicleIterator veh = anyVehiclesBegin(); veh != anyVehiclesEnd(); ++veh) { + MSVehicle* follow = (MSVehicle*)*veh; for (AnyVehicleIterator veh2 = anyVehiclesBegin(); veh2 != anyVehiclesEnd(); ++veh2) { MSVehicle* lead = (MSVehicle*)*veh2; if (lead == follow) { continue; } - if (lead->getPositionOnLane(this) < follow->getPositionOnLane()) { + if (lead->getPositionOnLane(this) < follow->getPositionOnLane(this)) { continue; } if (detectCollisionBetween(timestep, stage, follow, lead, toRemove, toTeleport)) { + // XXX what about collisions with multiple leaders at once? break; } } - if (follow->getLaneChangeModel().getShadowLane() != 0) { + if (follow->getLaneChangeModel().getShadowLane() != 0 && follow->getLane() == this) { // check whether follow collides on the shadow lane const MSLane* shadowLane = follow->getLaneChangeModel().getShadowLane(); MSLeaderInfo ahead = shadowLane->getLastVehicleInformation(follow, getRightSideOnEdge() - shadowLane->getRightSideOnEdge(), follow->getPositionOnLane()); for (int i = 0; i < ahead.numSublanes(); ++i) { - const MSVehicle* lead = ahead[i]; + MSVehicle* lead = const_cast(ahead[i]); if (lead != 0 && lead != follow && shadowLane->detectCollisionBetween(timestep, stage, follow, lead, toRemove, toTeleport)) { break; } @@ -1047,7 +1077,7 @@ //std::cout << SIMTIME << " checkJunctionCollisions " << getID() << "\n"; const std::vector& foeLanes = myLinks.front()->getFoeLanes(); for (VehCont::iterator veh = myVehicles.begin(); veh != myVehicles.end(); ++veh) { - const MSVehicle* collider = *veh; + MSVehicle* collider = *veh; //std::cout << " collider " << collider->getID() << "\n"; PositionVector colliderBoundary = collider->getBoundingBox(); for (std::vector::const_iterator it = foeLanes.begin(); it != foeLanes.end(); ++it) { @@ -1083,32 +1113,43 @@ bool -MSLane::detectCollisionBetween(SUMOTime timestep, const std::string& stage, const MSVehicle* collider, const MSVehicle* victim, +MSLane::detectCollisionBetween(SUMOTime timestep, const std::string& stage, MSVehicle* collider, MSVehicle* victim, std::set& toRemove, std::set& toTeleport) const { - assert(collider->isFrontOnLane(this)); #ifndef NO_TRACI - if (myCollisionAction == COLLISION_ACTION_TELEPORT && ((victim->hasInfluencer() && victim->getInfluencer()->isVTDAffected(timestep)) || - (collider->hasInfluencer() && collider->getInfluencer()->isVTDAffected(timestep)))) { + if (myCollisionAction == COLLISION_ACTION_TELEPORT && ((victim->hasInfluencer() && victim->getInfluencer().isVTDAffected(timestep)) || + (collider->hasInfluencer() && collider->getInfluencer().isVTDAffected(timestep)))) { return false; } #endif - const SUMOReal gap = victim->getBackPositionOnLane(this) - collider->getPositionOnLane() - collider->getVehicleType().getMinGap(); + const bool colliderOpposite = collider->getLaneChangeModel().isOpposite(); + const bool bothOpposite = victim->getLaneChangeModel().isOpposite() && colliderOpposite; + if (bothOpposite) { + std::swap(victim, collider); + } + const double colliderPos = colliderOpposite ? collider->getBackPositionOnLane(this) : collider->getPositionOnLane(this); + double gap = victim->getBackPositionOnLane(this) - colliderPos - collider->getVehicleType().getMinGap(); + if (bothOpposite) { + gap = -gap - 2 * collider->getVehicleType().getMinGap(); + } +#ifdef DEBUG_COLLISIONS + if (DEBUG_COND) std::cout << SIMTIME + << " thisLane=" << getID() + << " collider=" << collider->getID() + << " victim=" << victim->getID() + << " colliderLane=" << collider->getLane()->getID() + << " victimLane=" << victim->getLane()->getID() + << " colliderPos=" << colliderPos + << " victimBackPos=" << victim->getBackPositionOnLane(this) + << " colliderLat=" << collider->getCenterOnEdge(this) + << " victimLat=" << victim->getCenterOnEdge(this) + << " gap=" << gap + << "\n"; +#endif if (gap < -NUMERICAL_EPS) { - //std::cout << SIMTIME - // << " thisLane=" << getID() - // << " collider=" << collider->getID() - // << " victim=" << victim->getID() - // << " colliderLane=" << collider->getLane()->getID() - // << " victimLane=" << victim->getLane()->getID() - // << " colliderPos=" << collider->getPositionOnLane() - // << " victimBackPos=" << victim->getBackPositionOnLane(this) - // << " colliderLat=" << collider->getCenterOnEdge() - // << " victimLat=" << victim->getCenterOnEdge(this) - // << "\n"; - SUMOReal latGap = 0; + double latGap = 0; if (MSGlobals::gLateralResolution > 0 || MSGlobals::gLaneChangeDuration > 0) { - latGap = (fabs(victim->getCenterOnEdge(this) - collider->getCenterOnEdge()) + latGap = (fabs(victim->getCenterOnEdge(this) - collider->getCenterOnEdge(this)) - 0.5 * fabs(victim->getVehicleType().getWidth() + collider->getVehicleType().getWidth())); if (latGap + NUMERICAL_EPS > 0) { return false; @@ -1129,49 +1170,83 @@ void -MSLane::handleCollisionBetween(SUMOTime timestep, const std::string& stage, const MSVehicle* collider, const MSVehicle* victim, - SUMOReal gap, SUMOReal latGap, std::set& toRemove, +MSLane::handleCollisionBetween(SUMOTime timestep, const std::string& stage, MSVehicle* collider, MSVehicle* victim, + double gap, double latGap, std::set& toRemove, std::set& toTeleport) const { - std::string prefix; - switch (myCollisionAction) { - case COLLISION_ACTION_WARN: - prefix = "Vehicle '" + collider->getID() + "'; collision with vehicle '" + victim->getID() ; - break; - case COLLISION_ACTION_TELEPORT: - prefix = "Teleporting vehicle '" + collider->getID() + "'; collision with vehicle '" + victim->getID() ; - toRemove.insert(collider); - toTeleport.insert(collider); - break; - case COLLISION_ACTION_REMOVE: { - prefix = "Removing collision participants: vehicle '" + collider->getID() + "', vehicle '" + victim->getID(); - bool removeCollider = true; - bool removeVictim = true; -#ifndef NO_TRACI - removeVictim = !(victim->hasInfluencer() && victim->getInfluencer()->isVTDAffected(timestep)); - removeCollider = !(collider->hasInfluencer() && collider->getInfluencer()->isVTDAffected(timestep)); - if (removeVictim) { - toRemove.insert(victim); - } - if (removeCollider) { + std::string prefix = "Vehicle '" + collider->getID() + "'; collision with vehicle '" + victim->getID() ; + if (myCollisionStopTime > 0) { + if (collider->collisionStopTime() >= 0 && victim->collisionStopTime() >= 0) { + return; + } + std::string dummyError; + SUMOVehicleParameter::Stop stop; + stop.duration = myCollisionStopTime; + stop.busstop = ""; + stop.containerstop = ""; + stop.chargingStation = ""; + stop.parkingarea = ""; + stop.until = 0; + stop.triggered = false; + stop.containerTriggered = false; + stop.parking = false; + stop.index = 0; + const double victimStopPos = MIN2(victim->getLane()->getLength(), + victim->getPositionOnLane() + victim->getCarFollowModel().brakeGap(victim->getSpeed())); + if (victim->collisionStopTime() < 0) { + stop.lane = victim->getLane()->getID(); + // @todo: push victim forward? + stop.startPos = victimStopPos; + stop.endPos = stop.startPos; + stop.duration = myCollisionStopTime; + victim->addStop(stop, dummyError, 0, true); + } + if (collider->collisionStopTime() < 0) { + stop.lane = collider->getLane()->getID(); + stop.startPos = MIN2(collider->getPositionOnLane() + collider->getCarFollowModel().brakeGap(collider->getSpeed()), + MAX2(0.0, victimStopPos - 0.75 * victim->getVehicleType().getLength())); + stop.endPos = stop.startPos; + collider->addStop(stop, dummyError, 0, true); + } + } else { + switch (myCollisionAction) { + case COLLISION_ACTION_WARN: + break; + case COLLISION_ACTION_TELEPORT: + prefix = "Teleporting vehicle '" + collider->getID() + "'; collision with vehicle '" + victim->getID() ; toRemove.insert(collider); - } - if (!removeVictim) { - if (!removeCollider) { - prefix = "Keeping remote-controlled collision participants: vehicle '" + collider->getID() + "', vehicle '" + victim->getID(); - } else { - prefix = "Removing collision participant: vehicle '" + collider->getID() + "', keeping remote-controlled vehicle '" + victim->getID(); + toTeleport.insert(collider); + break; + case COLLISION_ACTION_REMOVE: { + prefix = "Removing collision participants: vehicle '" + collider->getID() + "', vehicle '" + victim->getID(); + bool removeCollider = true; + bool removeVictim = true; +#ifndef NO_TRACI + removeVictim = !(victim->hasInfluencer() && victim->getInfluencer().isVTDAffected(timestep)); + removeCollider = !(collider->hasInfluencer() && collider->getInfluencer().isVTDAffected(timestep)); + if (removeVictim) { + toRemove.insert(victim); + } + if (removeCollider) { + toRemove.insert(collider); + } + if (!removeVictim) { + if (!removeCollider) { + prefix = "Keeping remote-controlled collision participants: vehicle '" + collider->getID() + "', vehicle '" + victim->getID(); + } else { + prefix = "Removing collision participant: vehicle '" + collider->getID() + "', keeping remote-controlled vehicle '" + victim->getID(); + } + } else if (!removeCollider) { + prefix = "Keeping remote-controlled collision participant: vehicle '" + collider->getID() + "', removing vehicle '" + victim->getID(); } - } else if (!removeCollider) { - prefix = "Keeping remote-controlled collision participant: vehicle '" + collider->getID() + "', removing vehicle '" + victim->getID(); - } #else - toRemove.insert(victim); - toRemove.insert(collider); + toRemove.insert(victim); + toRemove.insert(collider); #endif - break; + break; + } + default: + break; } - default: - break; } WRITE_WARNING(prefix + "', lane='" + getID() @@ -1189,16 +1264,11 @@ for (VehCont::reverse_iterator i = myVehicles.rbegin(); i != myVehicles.rend();) { MSVehicle* veh = *i; // length is needed later when the vehicle may not exist anymore - const SUMOReal length = veh->getVehicleType().getLengthWithGap(); - const SUMOReal nettoLength = veh->getVehicleType().getLength(); + const double length = veh->getVehicleType().getLengthWithGap(); + const double nettoLength = veh->getVehicleType().getLength(); const bool moved = veh->executeMove(); MSLane* const target = veh->getLane(); -#ifndef NO_TRACI - const bool vtdControlled = veh->hasInfluencer() && veh->getInfluencer().isVTDControlled(); - if (veh->hasArrived() && !vtdControlled) { -#else if (veh->hasArrived()) { -#endif // vehicle has reached its arrival position veh->onRemovalFromNet(MSMoveReminder::NOTIFICATION_ARRIVED); MSNet::getInstance()->getVehicleControl().scheduleVehicleRemoval(veh); @@ -1223,6 +1293,21 @@ time2string(MSNet::getInstance()->getCurrentTimeStep()) + "."); MSNet::getInstance()->getVehicleControl().registerCollision(); MSVehicleTransfer::getInstance()->add(t, veh); + } else if (veh->collisionStopTime() == 0) { + veh->resumeFromStopping(); + if (getCollisionAction() == COLLISION_ACTION_REMOVE) { + WRITE_WARNING("Removing vehicle '" + veh->getID() + "' after earlier collision, lane='" + veh->getLane()->getID() + ", time=" + + time2string(MSNet::getInstance()->getCurrentTimeStep()) + "."); + veh->onRemovalFromNet(MSMoveReminder::NOTIFICATION_VAPORIZED); + MSNet::getInstance()->getVehicleControl().scheduleVehicleRemoval(veh); + } else if (getCollisionAction() == COLLISION_ACTION_TELEPORT) { + WRITE_WARNING("Teleporting vehicle '" + veh->getID() + "' after earlier collision, lane='" + veh->getLane()->getID() + ", time=" + + time2string(MSNet::getInstance()->getCurrentTimeStep()) + "."); + MSVehicleTransfer::getInstance()->add(MSNet::getInstance()->getCurrentTimeStep(), veh); + } else { + ++i; + continue; + } } else { ++i; continue; @@ -1272,7 +1357,7 @@ const MSEdge* -MSLane::getInternalFollower() const { +MSLane::getNextNormal() const { const MSEdge* e = myEdge; while (e->getPurpose() == MSEdge::EDGEFUNCTION_INTERNAL) { e = e->getSuccessors()[0]; @@ -1360,7 +1445,6 @@ bool MSLane::integrateNewVehicle(SUMOTime) { - //std::cout << SIMTIME << " integrateNewVehicle lane=" << getID() << "\n"; bool wasInactive = myVehicles.size() == 0; sort(myVehBuffer.begin(), myVehBuffer.end(), vehicle_position_sorter(this)); for (std::vector::const_iterator i = myVehBuffer.begin(); i != myVehBuffer.end(); ++i) { @@ -1374,11 +1458,14 @@ } myVehBuffer.clear(); //std::cout << SIMTIME << " integrateNewVehicle lane=" << getID() << " myVehicles1=" << toString(myVehicles); - if (MSGlobals::gLateralResolution > 0) { + if (MSGlobals::gLateralResolution > 0 || myNeighs.size() > 0) { sort(myVehicles.begin(), myVehicles.end(), vehicle_natural_position_sorter(this)); } sortPartialVehicles(); - //std::cout << " myVehicles2=" << toString(myVehicles) << "\n"; +#ifdef DEBUG_VEHICLE_CONTAINER + if (DEBUG_COND) std::cout << SIMTIME << " integrateNewVehicle lane=" << getID() + << " vhicles=" << toString(myVehicles) << " partials=" << toString(myPartialVehicles) << "\n"; +#endif return wasInactive && myVehicles.size() != 0; } @@ -1506,23 +1593,60 @@ return succLinkSource.myLinks.end(); } - - const MSLinkCont& MSLane::getLinkCont() const { return myLinks; } +/// returns the link to the given lane or 0, if it is not connected +MSLink* +MSLane::getLinkTo(const MSLane* target) const { + MSLinkCont::const_iterator l = myLinks.begin(); + if (target->isInternal()) { + while (l != myLinks.end()) { + if ((*l)->getViaLane()->getID() == target->getID()) { + return *l; + } + ++l; + } + } else { + while (l != myLinks.end()) { + if ((*l)->getLane()->getID() == target->getID()) { + return *l; + } + ++l; + } + } + return 0; +} + +MSLink* +MSLane::getEntryLink() const { + if (!isInternal()) { + return 0; + } + const MSLane* internal = this; + const MSLane* lane = this->getCanonicalPredecessorLane(); + assert(lane != 0); + while (lane->isInternal()) { + internal = lane; + lane = lane->getCanonicalPredecessorLane(); + assert(lane != 0); + } + return lane->getLinkTo(internal); +} + + void -MSLane::setMaxSpeed(SUMOReal val) { +MSLane::setMaxSpeed(double val) { myMaxSpeed = val; myEdge->recalcCache(); } void -MSLane::setLength(SUMOReal val) { +MSLane::setLength(double val) { myLength = val; myEdge->recalcCache(); } @@ -1606,133 +1730,39 @@ class by_second_sorter { public: - inline int operator()(const std::pair& p1, const std::pair& p2) const { + inline int operator()(const std::pair& p1, const std::pair& p2) const { return p1.second < p2.second; } }; -SUMOReal MSLane::getMissingRearGap( - SUMOReal backOffset, SUMOReal leaderSpeed, SUMOReal leaderMaxDecel) const { +double MSLane::getMissingRearGap(const MSVehicle* leader, double backOffset, double leaderSpeed) const { // this follows the same logic as getFollowerOnConsecutive. we do a tree // search and check for the vehicle with the largest missing rear gap within // relevant range - SUMOReal result = 0; - std::pair followerInfo = getFollowerOnConsecutive(backOffset, leaderSpeed, leaderMaxDecel); - MSVehicle* v = followerInfo.first; + double result = 0; + const double leaderDecel = leader->getCarFollowModel().getMaxDecel(); + CLeaderDist followerInfo = getFollowersOnConsecutive(leader, backOffset, false)[0]; + const MSVehicle* v = followerInfo.first; if (v != 0) { - result = v->getCarFollowModel().getSecureGap(v->getSpeed(), leaderSpeed, leaderMaxDecel) - followerInfo.second; + result = v->getCarFollowModel().getSecureGap(v->getSpeed(), leaderSpeed, leaderDecel) - followerInfo.second; } return result; } -SUMOReal +double MSLane::getMaximumBrakeDist() const { const MSVehicleControl& vc = MSNet::getInstance()->getVehicleControl(); - const SUMOReal maxSpeed = getSpeedLimit() * vc.getMaxSpeedFactor(); + const double maxSpeed = getSpeedLimit() * vc.getMaxSpeedFactor(); // NOTE: For the euler update this is an upper bound on the actual braking distance (see ticket #860) return maxSpeed * maxSpeed * 0.5 / vc.getMinDeceleration(); } -std::pair -MSLane::getFollowerOnConsecutive( - SUMOReal backOffset, SUMOReal leaderSpeed, SUMOReal leaderMaxDecel, SUMOReal dist) const { - // do a tree search among all follower lanes and check for the most - // important vehicle (the one requiring the largest reargap) - // to get a safe bound on the necessary search depth, we need to consider the maximum speed and minimum - // deceleration of potential follower vehicles - if (dist == -1) { - dist = getMaximumBrakeDist() - backOffset; - } -#ifdef DEBUG_CONTEXT - if (DEBUG_COND) std::cout << SIMTIME << " getFollowerOnConsecutive" - << " backOffset=" << backOffset - << " leaderSpeed=" << leaderSpeed - << " dist=" << dist - << "\n"; -#endif - std::pair result(static_cast(0), -1); - SUMOReal missingRearGapMax = -std::numeric_limits::max(); - std::set visited; - std::vector newFound; - std::vector toExamine = myIncomingLanes; - while (toExamine.size() != 0) { - for (std::vector::iterator i = toExamine.begin(); i != toExamine.end(); ++i) { - MSLane* next = (*i).lane; -#ifdef DEBUG_CONTEXT - if (DEBUG_COND) { - std::cout << SIMTIME << " nextLane=" << next->getID() << "\n"; - } -#endif - // XXX: why take a MAX here? Even if some upcoming lane allows to go faster, the follower should be able - // to brake in time if we only consider 'next->getMaximumBrakeDist() - backOffset'. - dist = MAX2(dist, next->getMaximumBrakeDist() - backOffset); - // Checking the first vehicle on the considered lane. - // XXX: Could there be a problem if someone fast is just overtaking a a slow first vehicle, e.g.? (Leo) Refs.#2578 - MSVehicle* v = next->getFirstAnyVehicle(); - SUMOReal agap = 0; - if (v != 0) { - // the front of v is already on divergent trajectory from the ego vehicle - // for which this method is called (in the context of MSLaneChanger). - // Therefore, technically v is not a follower but only an obstruction and - // the gap is not between the front of v and the back of ego - // but rather between the flank of v and the back of ego. - if (!v->isFrontOnLane(next)) { - agap = (*i).length - next->getLength() + backOffset - /// XXX dubious term. here for backwards compatibility - - v->getVehicleType().getMinGap(); - if (agap > 0) { - // Only if ego overlaps we treat v as if it were a real follower - // Otherwise we ignore it and look for another follower - v = next->getFirstFullVehicle(); - if (v != 0) { - agap = (*i).length - v->getPositionOnLane() + backOffset - v->getVehicleType().getMinGap(); - } - } - } else { - agap = (*i).length - v->getPositionOnLane() + backOffset - v->getVehicleType().getMinGap(); - } -#ifdef DEBUG_CONTEXT - if (DEBUG_COND) std::cout << SIMTIME << " " - << " v=" << Named::getIDSecure(v) - << " agap=" << agap - << " dist=" << dist - << "\n"; -#endif - } - if (v != 0) { - const SUMOReal missingRearGap = v->getCarFollowModel().getSecureGap(v->getSpeed(), leaderSpeed, leaderMaxDecel) - agap; - if (missingRearGap > missingRearGapMax) { - missingRearGapMax = missingRearGap; - result.first = v; - result.second = agap; - } - } else { - if ((*i).length < dist) { - const std::vector& followers = next->getIncomingLanes(); - for (std::vector::const_iterator j = followers.begin(); j != followers.end(); ++j) { - if (visited.find((*j).lane) == visited.end()) { - visited.insert((*j).lane); - MSLane::IncomingLaneInfo ili; - ili.lane = (*j).lane; - ili.length = (*j).length + (*i).length; - ili.viaLink = (*j).viaLink; - newFound.push_back(ili); - } - } - } - } - } - toExamine.clear(); - swap(newFound, toExamine); - } - return result; -} -std::pair -MSLane::getLeader(const MSVehicle* veh, const SUMOReal vehPos, const std::vector& bestLaneConts, SUMOReal dist, bool checkTmpVehicles) const { +std::pair +MSLane::getLeader(const MSVehicle* veh, const double vehPos, const std::vector& bestLaneConts, double dist, bool checkTmpVehicles) const { // get the leading vehicle for (shadow) veh // XXX this only works as long as all lanes of an edge have equal length #ifdef DEBUG_CONTEXT @@ -1744,33 +1774,40 @@ for (VehCont::const_iterator last = myTmpVehicles.begin(); last != myTmpVehicles.end(); ++last) { // XXX refactor leaderInfo to use a const vehicle all the way through the call hierarchy MSVehicle* pred = (MSVehicle*)*last; + if (pred == veh) { + continue; + } #ifdef DEBUG_CONTEXT if (DEBUG_COND2(veh)) { std::cout << " getLeader lane=" << getID() << " ego=" << veh->getID() << " egoPos=" << vehPos << " pred=" << pred->getID() << " predPos=" << pred->getPositionOnLane() << "\n"; } #endif if (pred->getPositionOnLane() > vehPos + NUMERICAL_EPS) { - return std::pair(pred, pred->getBackPositionOnLane(this) - veh->getVehicleType().getMinGap() - vehPos); + return std::pair(pred, pred->getBackPositionOnLane(this) - veh->getVehicleType().getMinGap() - vehPos); } } } else { for (AnyVehicleIterator last = anyVehiclesBegin(); last != anyVehiclesEnd(); ++last) { // XXX refactor leaderInfo to use a const vehicle all the way through the call hierarchy MSVehicle* pred = (MSVehicle*)*last; + if (pred == veh) { + continue; + } #ifdef DEBUG_CONTEXT if (DEBUG_COND2(veh)) { - std::cout << " getLeader lane=" << getID() << " ego=" << veh->getID() << " egoPos=" << vehPos << " pred=" << pred->getID() << " predPos=" << pred->getPositionOnLane() << "\n"; + std::cout << " getLeader lane=" << getID() << " ego=" << veh->getID() << " egoPos=" << vehPos + << " pred=" << pred->getID() << " predPos=" << pred->getPositionOnLane(this) << " predBack=" << pred->getBackPositionOnLane(this) << "\n"; } #endif - if (pred->getPositionOnLane() > vehPos + NUMERICAL_EPS) { - return std::pair(pred, pred->getBackPositionOnLane(this) - veh->getVehicleType().getMinGap() - vehPos); + if (pred->getPositionOnLane(this) > vehPos + NUMERICAL_EPS) { + return std::pair(pred, pred->getBackPositionOnLane(this) - veh->getVehicleType().getMinGap() - vehPos); } } } // XXX from here on the code mirrors MSLaneChanger::getRealLeader if (bestLaneConts.size() > 0) { - SUMOReal seen = getLength() - vehPos; - SUMOReal speed = veh->getSpeed(); + double seen = getLength() - vehPos; + double speed = veh->getSpeed(); if (dist < 0) { dist = veh->getCarFollowModel().brakeGap(speed) + veh->getVehicleType().getMinGap(); } @@ -1780,7 +1817,7 @@ } #endif if (seen > dist) { - return std::pair(static_cast(0), -1); + return std::pair(static_cast(0), -1); } return getLeaderOnConsecutive(dist, seen, speed, *veh, bestLaneConts); } else { @@ -1789,8 +1826,8 @@ } -std::pair -MSLane::getLeaderOnConsecutive(SUMOReal dist, SUMOReal seen, SUMOReal speed, const MSVehicle& veh, +std::pair +MSLane::getLeaderOnConsecutive(double dist, double seen, double speed, const MSVehicle& veh, const std::vector& bestLaneConts) const { #ifdef DEBUG_CONTEXT if (DEBUG_COND2(&veh)) { @@ -1810,7 +1847,7 @@ std::cout << " partials=" << toString(myPartialVehicles) << "\n"; } #endif - return std::pair(pred, seen - (getLength() - pred->getBackPositionOnLane(this)) - veh.getVehicleType().getMinGap()); + return std::pair(pred, seen - (getLength() - pred->getBackPositionOnLane(this)) - veh.getVehicleType().getMinGap()); } const MSLane* nextLane = this; SUMOTime arrivalTime = MSNet::getInstance()->getCurrentTimeStep() + TIME2STEPS(seen / MAX2(speed, NUMERICAL_EPS)); @@ -1828,9 +1865,8 @@ nextLane->releaseVehicles(); break; } -#ifdef HAVE_INTERNAL_LANES // check for link leaders - const MSLink::LinkLeaders linkLeaders = (*link)->getLeaderInfo(seen, veh.getVehicleType().getMinGap()); + const MSLink::LinkLeaders linkLeaders = (*link)->getLeaderInfo(&veh, seen); nextLane->releaseVehicles(); if (linkLeaders.size() > 0) { // XXX if there is more than one link leader we should return the most important @@ -1843,7 +1879,6 @@ return linkLeaders[0].vehAndGap; } bool nextInternal = (*link)->getViaLane() != 0; -#endif nextLane = (*link)->getViaLaneOrLane(); if (nextLane == 0) { break; @@ -1856,7 +1891,7 @@ std::cout << " found leader " << leader->getID() << " on nextLane=" << nextLane->getID() << "\n"; } #endif - const SUMOReal dist = seen + leader->getBackPositionOnLane(nextLane) - veh.getVehicleType().getMinGap(); + const double dist = seen + leader->getBackPositionOnLane(nextLane) - veh.getVehicleType().getMinGap(); nextLane->releaseVehicles(); return std::make_pair(leader, dist); } @@ -1869,23 +1904,19 @@ // delaying the update of arrivalTime and making it conditional to avoid possible integer overflows arrivalTime += TIME2STEPS(nextLane->getLength() / MAX2(speed, NUMERICAL_EPS)); } -#ifdef HAVE_INTERNAL_LANES if (!nextInternal) { view++; } -#else - view++; -#endif } while (seen <= dist); return std::make_pair(static_cast(0), -1); } -std::pair -MSLane::getCriticalLeader(SUMOReal dist, SUMOReal seen, SUMOReal speed, const MSVehicle& veh) const { +std::pair +MSLane::getCriticalLeader(double dist, double seen, double speed, const MSVehicle& veh) const { const std::vector& bestLaneConts = veh.getBestLanesContinuation(this); - std::pair result = std::make_pair(static_cast(0), -1); - SUMOReal safeSpeed = std::numeric_limits::max(); + std::pair result = std::make_pair(static_cast(0), -1); + double safeSpeed = std::numeric_limits::max(); int view = 1; // loop over following lanes // @note: we don't check the partial occupator for this lane since it was @@ -1899,16 +1930,15 @@ veh.getImpatience(), veh.getCarFollowModel().getMaxDecel(), 0, veh.getLateralPositionOnLane()) || (*link)->haveRed()) { return result; } -#ifdef HAVE_INTERNAL_LANES // check for link leaders - const MSLink::LinkLeaders linkLeaders = (*link)->getLeaderInfo(seen, veh.getVehicleType().getMinGap()); + const MSLink::LinkLeaders linkLeaders = (*link)->getLeaderInfo(&veh, seen); for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) { const MSVehicle* leader = (*it).vehAndGap.first; if (leader != 0 && leader != result.first) { // XXX ignoring pedestrians here! // XXX ignoring the fact that the link leader may alread by following us // XXX ignoring the fact that we may drive up to the crossing point - const SUMOReal tmpSpeed = veh.getSafeFollowSpeed((*it).vehAndGap, seen, nextLane, (*it).distToCrossing); + const double tmpSpeed = veh.getSafeFollowSpeed((*it).vehAndGap, seen, nextLane, (*it).distToCrossing); if (tmpSpeed < safeSpeed) { safeSpeed = tmpSpeed; result = (*it).vehAndGap; @@ -1916,15 +1946,14 @@ } } bool nextInternal = (*link)->getViaLane() != 0; -#endif nextLane = (*link)->getViaLaneOrLane(); if (nextLane == 0) { break; } MSVehicle* leader = nextLane->getLastAnyVehicle(); if (leader != 0 && leader != result.first) { - const SUMOReal gap = seen + leader->getBackPositionOnLane(nextLane) - veh.getVehicleType().getMinGap(); - const SUMOReal tmpSpeed = veh.getCarFollowModel().insertionFollowSpeed(leader, speed, gap, leader->getSpeed(), leader->getCarFollowModel().getMaxDecel()); + const double gap = seen + leader->getBackPositionOnLane(nextLane) - veh.getVehicleType().getMinGap(); + const double tmpSpeed = veh.getCarFollowModel().insertionFollowSpeed(leader, speed, gap, leader->getSpeed(), leader->getCarFollowModel().getMaxDecel()); if (tmpSpeed < safeSpeed) { safeSpeed = tmpSpeed; result = std::make_pair(leader, gap); @@ -1938,13 +1967,9 @@ // delaying the update of arrivalTime and making it conditional to avoid possible integer overflows arrivalTime += TIME2STEPS(nextLane->getLength() / MAX2(speed, NUMERICAL_EPS)); } -#ifdef HAVE_INTERNAL_LANES if (!nextInternal) { view++; } -#else - view++; -#endif } while (seen <= dist); return result; } @@ -1956,7 +1981,7 @@ return myLogicalPredecessorLane; } if (myLogicalPredecessorLane == 0) { - MSEdgeVector pred = myEdge->getIncomingEdges(); + MSEdgeVector pred = myEdge->getPredecessors(); // get only those edges which connect to this lane for (MSEdgeVector::iterator i = pred.begin(); i != pred.end();) { std::vector::const_iterator j = find_if(myIncomingLanes.begin(), myIncomingLanes.end(), edge_finder(*i)); @@ -1971,7 +1996,7 @@ std::sort(pred.begin(), pred.end(), by_connections_to_sorter(&getEdge())); MSEdge* best = *pred.begin(); std::vector::const_iterator j = find_if(myIncomingLanes.begin(), myIncomingLanes.end(), edge_finder(best)); - myLogicalPredecessorLane = (*j).lane; + myLogicalPredecessorLane = j->lane; } } return myLogicalPredecessorLane; @@ -1989,6 +2014,46 @@ return 0; } +MSLane* +MSLane::getCanonicalPredecessorLane() const { + if (myCanonicalPredecessorLane != 0) { + return myCanonicalPredecessorLane; + } + if (myIncomingLanes.size() == 0) { + return 0; + } + // myCanonicalPredecessorLane has not yet been determined and there exist incoming lanes + std::vector candidateLanes = myIncomingLanes; + // get the lane with the priorized (or if this does not apply the "straightest") connection + std::sort(candidateLanes.begin(), candidateLanes.end(), incoming_lane_priority_sorter(this)); + IncomingLaneInfo best = *(candidateLanes.begin()); +#ifdef DEBUG_LANE_SORTER + std::cout << "\nBest predecessor lane for lane '" << myID << "': '" << best.lane->getID() << "'" << std::endl; +#endif + myCanonicalPredecessorLane = best.lane; + return myCanonicalPredecessorLane; +} + +MSLane* +MSLane::getCanonicalSuccessorLane() const { + if (myCanonicalSuccessorLane != 0) { + return myCanonicalSuccessorLane; + } + if (myLinks.size() == 0) { + return 0; + } + // myCanonicalSuccessorLane has not yet been determined and there exist outgoing links + std::vector candidateLinks = myLinks; + // get the lane with the priorized (or if this does not apply the "straightest") connection + std::sort(candidateLinks.begin(), candidateLinks.end(), outgoing_lane_priority_sorter(this)); + MSLane* best = (*candidateLinks.begin())->getViaLaneOrLane(); +#ifdef DEBUG_LANE_SORTER + std::cout << "\nBest successor lane for lane '" << myID << "': '" << best->getID() << "'" << std::endl; +#endif + myCanonicalSuccessorLane = best; + return myCanonicalSuccessorLane; +} + LinkState MSLane::getIncomingLinkState() const { @@ -2037,9 +2102,9 @@ } // ------------ Current state retrieval -SUMOReal +double MSLane::getBruttoOccupancy() const { - SUMOReal fractions = myPartialVehicles.size() > 0 ? myLength - myPartialVehicles.front()->getBackPositionOnLane(this) : 0; + double fractions = myPartialVehicles.size() > 0 ? myLength - myPartialVehicles.front()->getBackPositionOnLane(this) : 0; getVehiclesSecure(); if (myVehicles.size() != 0) { MSVehicle* lastVeh = myVehicles.front(); @@ -2052,9 +2117,9 @@ } -SUMOReal +double MSLane::getNettoOccupancy() const { - SUMOReal fractions = myPartialVehicles.size() > 0 ? myLength - myPartialVehicles.front()->getBackPositionOnLane(this) : 0; + double fractions = myPartialVehicles.size() > 0 ? myLength - myPartialVehicles.front()->getBackPositionOnLane(this) : 0; getVehiclesSecure(); if (myVehicles.size() != 0) { MSVehicle* lastVeh = myVehicles.front(); @@ -2067,12 +2132,12 @@ } -SUMOReal +double MSLane::getWaitingSeconds() const { if (myVehicles.size() == 0) { return 0; } - SUMOReal wtime = 0; + double wtime = 0; for (VehCont::const_iterator i = myVehicles.begin(); i != myVehicles.end(); ++i) { wtime += (*i)->getWaitingSeconds(); } @@ -2080,25 +2145,25 @@ } -SUMOReal +double MSLane::getMeanSpeed() const { if (myVehicles.size() == 0) { return myMaxSpeed; } - SUMOReal v = 0; + double v = 0; const MSLane::VehCont& vehs = getVehiclesSecure(); for (VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) { v += (*i)->getSpeed(); } - SUMOReal ret = v / (SUMOReal) myVehicles.size(); + double ret = v / (double) myVehicles.size(); releaseVehicles(); return ret; } -SUMOReal +double MSLane::getCO2Emissions() const { - SUMOReal ret = 0; + double ret = 0; const MSLane::VehCont& vehs = getVehiclesSecure(); for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) { ret += (*i)->getCO2Emissions(); @@ -2108,9 +2173,9 @@ } -SUMOReal +double MSLane::getCOEmissions() const { - SUMOReal ret = 0; + double ret = 0; const MSLane::VehCont& vehs = getVehiclesSecure(); for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) { ret += (*i)->getCOEmissions(); @@ -2120,9 +2185,9 @@ } -SUMOReal +double MSLane::getPMxEmissions() const { - SUMOReal ret = 0; + double ret = 0; const MSLane::VehCont& vehs = getVehiclesSecure(); for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) { ret += (*i)->getPMxEmissions(); @@ -2132,9 +2197,9 @@ } -SUMOReal +double MSLane::getNOxEmissions() const { - SUMOReal ret = 0; + double ret = 0; const MSLane::VehCont& vehs = getVehiclesSecure(); for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) { ret += (*i)->getNOxEmissions(); @@ -2144,9 +2209,9 @@ } -SUMOReal +double MSLane::getHCEmissions() const { - SUMOReal ret = 0; + double ret = 0; const MSLane::VehCont& vehs = getVehiclesSecure(); for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) { ret += (*i)->getHCEmissions(); @@ -2156,9 +2221,9 @@ } -SUMOReal +double MSLane::getFuelConsumption() const { - SUMOReal ret = 0; + double ret = 0; const MSLane::VehCont& vehs = getVehiclesSecure(); for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) { ret += (*i)->getFuelConsumption(); @@ -2168,9 +2233,9 @@ } -SUMOReal +double MSLane::getElectricityConsumption() const { - SUMOReal ret = 0; + double ret = 0; const MSLane::VehCont& vehs = getVehiclesSecure(); for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) { ret += (*i)->getElectricityConsumption(); @@ -2180,17 +2245,17 @@ } -SUMOReal +double MSLane::getHarmonoise_NoiseEmissions() const { - SUMOReal ret = 0; + double ret = 0; const MSLane::VehCont& vehs = getVehiclesSecure(); if (vehs.size() == 0) { releaseVehicles(); return 0; } for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) { - SUMOReal sv = (*i)->getHarmonoise_NoiseEmissions(); - ret += (SUMOReal) pow(10., (sv / 10.)); + double sv = (*i)->getHarmonoise_NoiseEmissions(); + ret += (double) pow(10., (sv / 10.)); } releaseVehicles(); return HelpersHarmonoise::sum(ret); @@ -2198,7 +2263,7 @@ bool -MSLane::VehPosition::operator()(const MSVehicle* cmp, SUMOReal pos) const { +MSLane::VehPosition::operator()(const MSVehicle* cmp, double pos) const { return cmp->getPositionOnLane() >= pos; } @@ -2210,8 +2275,8 @@ int MSLane::vehicle_natural_position_sorter::operator()(MSVehicle* v1, MSVehicle* v2) const { - const SUMOReal pos1 = v1->getBackPositionOnLane(myLane); - const SUMOReal pos2 = v2->getBackPositionOnLane(myLane); + const double pos1 = v1->getBackPositionOnLane(myLane); + const double pos2 = v2->getBackPositionOnLane(myLane); if (pos1 != pos2) { return pos1 < pos2; } else { @@ -2227,20 +2292,157 @@ int MSLane::by_connections_to_sorter::operator()(const MSEdge* const e1, const MSEdge* const e2) const { +// std::cout << "\nby_connections_to_sorter()"; + const std::vector* ae1 = e1->allowedLanes(*myEdge); const std::vector* ae2 = e2->allowedLanes(*myEdge); - SUMOReal s1 = 0; + double s1 = 0; if (ae1 != 0 && ae1->size() != 0) { - s1 = (SUMOReal) ae1->size() + fabs(GeomHelper::angleDiff((*ae1)[0]->getShape().angleAt2D(0), myLaneDir)) / M_PI / 2.; +// std::cout << "\nsize 1 = " << ae1->size() +// << " anglediff 1 = " << fabs(GeomHelper::angleDiff((*ae1)[0]->getShape().angleAt2D(0), myLaneDir)) / M_PI / 2. +// << "\nallowed lanes: "; +// for (std::vector::const_iterator j = ae1->begin(); j != ae1->end(); ++j){ +// std::cout << "\n" << (*j)->getID(); +// } + s1 = (double) ae1->size() + fabs(GeomHelper::angleDiff((*ae1)[0]->getShape().angleAt2D(0), myLaneDir)) / M_PI / 2.; } - SUMOReal s2 = 0; + double s2 = 0; if (ae2 != 0 && ae2->size() != 0) { - s2 = (SUMOReal) ae2->size() + fabs(GeomHelper::angleDiff((*ae2)[0]->getShape().angleAt2D(0), myLaneDir)) / M_PI / 2.; +// std::cout << "\nsize 2 = " << ae2->size() +// << " anglediff 2 = " << fabs(GeomHelper::angleDiff((*ae2)[0]->getShape().angleAt2D(0), myLaneDir)) / M_PI / 2. +// << "\nallowed lanes: "; +// for (std::vector::const_iterator j = ae2->begin(); j != ae2->end(); ++j){ +// std::cout << "\n" << (*j)->getID(); +// } + s2 = (double) ae2->size() + fabs(GeomHelper::angleDiff((*ae2)[0]->getShape().angleAt2D(0), myLaneDir)) / M_PI / 2.; } + +// std::cout << "\ne1 = " << e1->getID() << " e2 = " << e2->getID() +// << "\ns1 = " << s1 << " s2 = " << s2 +// << std::endl; + return s1 < s2; } +MSLane::incoming_lane_priority_sorter::incoming_lane_priority_sorter(const MSLane* const targetLane) : + myLane(targetLane), + myLaneDir(targetLane->getShape().angleAt2D(0)) {} + +int +MSLane::incoming_lane_priority_sorter::operator()(const IncomingLaneInfo& laneInfo1, const IncomingLaneInfo& laneInfo2) const { + const MSLane* noninternal1 = laneInfo1.lane; + while (noninternal1->isInternal()) { + assert(noninternal1->getIncomingLanes().size() == 1); + noninternal1 = noninternal1->getIncomingLanes()[0].lane; + } + MSLane* noninternal2 = laneInfo2.lane; + while (noninternal2->isInternal()) { + assert(noninternal2->getIncomingLanes().size() == 1); + noninternal2 = noninternal2->getIncomingLanes()[0].lane; + } + + MSLink* link1 = noninternal1->getLinkTo(myLane); + MSLink* link2 = noninternal2->getLinkTo(myLane); + +#ifdef DEBUG_LANE_SORTER + std::cout << "\nincoming_lane_priority sorter()\n" + << "noninternal predecessor for lane '" << laneInfo1.lane->getID() + << "': '" << noninternal1->getID() << "'\n" + << "noninternal predecessor for lane '" << laneInfo2.lane->getID() + << "': '" << noninternal2->getID() << "'\n"; +#endif + + assert(laneInfo1.lane->isInternal() || link1 == laneInfo1.viaLink); + assert(link1 != 0); + assert(link2 != 0); + + // check priority between links + bool priorized1 = true; + bool priorized2 = true; + + std::vector::const_iterator j; +#ifdef DEBUG_LANE_SORTER + std::cout << "FoeLinks of '" << noninternal1->getID() << "'" << std::endl; +#endif + for (j = link1->getFoeLinks().begin(); j != link1->getFoeLinks().end(); ++j) { +#ifdef DEBUG_LANE_SORTER + std::cout << (*j)->getLaneBefore()->getID() << std::endl; +#endif + if (*j == link2) { + priorized1 = false; + break; + } + } + +#ifdef DEBUG_LANE_SORTER + std::cout << "FoeLinks of '" << noninternal2->getID() << "'" << std::endl; +#endif + for (j = link2->getFoeLinks().begin(); j != link2->getFoeLinks().end(); ++j) { +#ifdef DEBUG_LANE_SORTER + std::cout << (*j)->getLaneBefore()->getID() << std::endl; +#endif + // either link1 is priorized, or it should not appear in link2's foes + if (*j == link2) { + priorized2 = false; + break; + } + } + // if one link is subordinate, the other must be priorized + assert(priorized1 || priorized2); + if (priorized1 != priorized2) { + return priorized1; + } + + // both are priorized, compare angle difference + double d1 = fabs(GeomHelper::angleDiff(noninternal1->getShape().angleAt2D(0), myLaneDir)); + double d2 = fabs(GeomHelper::angleDiff(noninternal2->getShape().angleAt2D(0), myLaneDir)); + + return d2 > d1; +} + + + +MSLane::outgoing_lane_priority_sorter::outgoing_lane_priority_sorter(const MSLane* const sourceLane) : + myLane(sourceLane), + myLaneDir(sourceLane->getShape().angleAt2D(0)) {} + +int +MSLane::outgoing_lane_priority_sorter::operator()(const MSLink* link1, const MSLink* link2) const { + const MSLane* target1 = link1->getLane(); + const MSLane* target2 = link2->getLane(); + if (target2 == 0) { + return true; + } + if (target1 == 0) { + return false; + } + +#ifdef DEBUG_LANE_SORTER + std::cout << "\noutgoing_lane_priority sorter()\n" + << "noninternal successors for lane '" << myLane->getID() + << "': '" << target1->getID() << "' and " + << "'" << target2->getID() << "'\n"; +#endif + + // priority of targets + int priority1 = target1->getEdge().getPriority(); + int priority2 = target2->getEdge().getPriority(); + + if (priority1 != priority2) { + return priority1 > priority2; + } + + // if priority of targets coincides, use angle difference + + // both are priorized, compare angle difference + double d1 = fabs(GeomHelper::angleDiff(target1->getShape().angleAt2D(0), myLaneDir)); + double d2 = fabs(GeomHelper::angleDiff(target2->getShape().angleAt2D(0), myLaneDir)); + + return d2 > d1; +} + + void MSLane::saveState(OutputDevice& out) { out.openTag(SUMO_TAG_LANE); @@ -2256,25 +2458,28 @@ MSLane::loadState(std::vector& vehIds, MSVehicleControl& vc) { for (std::vector::const_iterator it = vehIds.begin(); it != vehIds.end(); ++it) { MSVehicle* v = dynamic_cast(vc.getVehicle(*it)); - assert(v != 0); - v->updateBestLanes(false, this); - incorporateVehicle(v, v->getPositionOnLane(), v->getSpeed(), v->getLateralPositionOnLane(), myVehicles.end(), - MSMoveReminder::NOTIFICATION_JUNCTION); + if (v != 0) { + v->updateBestLanes(false, this); + incorporateVehicle(v, v->getPositionOnLane(), v->getSpeed(), v->getLateralPositionOnLane(), myVehicles.end(), + MSMoveReminder::NOTIFICATION_JUNCTION); + v->processNextStop(v->getSpeed()); + } } } MSLeaderDistanceInfo -MSLane::getFollowersOnConsecutive(const MSVehicle* ego, bool allSublanes) const { +MSLane::getFollowersOnConsecutive(const MSVehicle* ego, double backOffset, + bool allSublanes, double searchDist, bool ignoreMinorLinks) const { // get the follower vehicle on the lane to change to + const double egoPos = backOffset + ego->getVehicleType().getLength(); #ifdef DEBUG_CONTEXT if (DEBUG_COND2(ego)) { - std::cout << SIMTIME << " getFollowers lane=" << getID() << " ego=" << ego->getID() << " pos=" << ego->getPositionOnLane() << "\n"; + std::cout << SIMTIME << " getFollowers lane=" << getID() << " ego=" << ego->getID() << " pos=" << egoPos << "\n"; } #endif assert(ego != 0); - assert(&ego->getLane()->getEdge() == &getEdge()); - const SUMOReal egoLatDist = ego->getLane()->getRightSideOnEdge() - getRightSideOnEdge(); + const double egoLatDist = ego->getLane()->getRightSideOnEdge() - getRightSideOnEdge(); MSCriticalFollowerDistanceInfo result(this, allSublanes ? 0 : ego, allSublanes ? 0 : egoLatDist); /// XXX iterate in reverse and abort when there are no more freeSublanes for (AnyVehicleIterator last = anyVehiclesBegin(); last != anyVehiclesEnd(); ++last) { @@ -2284,10 +2489,10 @@ std::cout << " veh=" << veh->getID() << " lane=" << veh->getLane()->getID() << " pos=" << veh->getPositionOnLane(this) << "\n"; } #endif - if (veh != ego && veh->getPositionOnLane(this) <= ego->getPositionOnLane()) { - //const SUMOReal latOffset = veh->getLane()->getRightSideOnEdge() - getRightSideOnEdge(); - const SUMOReal latOffset = veh->getLatOffset(this); - const SUMOReal dist = ego->getBackPositionOnLane() - veh->getPositionOnLane(this) - veh->getVehicleType().getMinGap(); + if (veh != ego && veh->getPositionOnLane(this) <= egoPos) { + //const double latOffset = veh->getLane()->getRightSideOnEdge() - getRightSideOnEdge(); + const double latOffset = veh->getLatOffset(this); + const double dist = backOffset - veh->getPositionOnLane(this) - veh->getVehicleType().getMinGap(); result.addFollower(veh, ego, dist, latOffset); #ifdef DEBUG_CONTEXT if (DEBUG_COND2(ego)) { @@ -2302,12 +2507,13 @@ } #endif if (result.numFreeSublanes() > 0) { - const SUMOReal backOffset = ego->getBackPositionOnLane(ego->getLane()); // do a tree search among all follower lanes and check for the most // important vehicle (the one requiring the largest reargap) // to get a safe bound on the necessary search depth, we need to consider the maximum speed and minimum // deceleration of potential follower vehicles - SUMOReal dist = getMaximumBrakeDist() - backOffset; + if (searchDist == -1) { + searchDist = getMaximumBrakeDist() - backOffset; + } std::set visited; std::vector newFound; @@ -2315,8 +2521,8 @@ while (toExamine.size() != 0) { for (std::vector::iterator it = toExamine.begin(); it != toExamine.end(); ++it) { MSLane* next = (*it).lane; - dist = MAX2(dist, next->getMaximumBrakeDist() - backOffset); - MSLeaderInfo first = next->getFirstVehicleInformation(0, 0, false); + searchDist = MAX2(searchDist, next->getMaximumBrakeDist() - backOffset); + MSLeaderInfo first = next->getFirstVehicleInformation(0, 0, false, std::numeric_limits::max(), false); MSLeaderInfo firstFront = next->getFirstVehicleInformation(0, 0, true); #ifdef DEBUG_CONTEXT if (DEBUG_COND2(ego)) { @@ -2325,7 +2531,7 @@ #endif for (int i = 0; i < first.numSublanes(); ++i) { const MSVehicle* v = first[i]; - SUMOReal agap = 0; + double agap = 0; if (v != 0 && v != ego) { if (!v->isFrontOnLane(next)) { // the front of v is already on divergent trajectory from the ego vehicle @@ -2348,6 +2554,10 @@ } } else { agap = (*it).length - v->getPositionOnLane() + backOffset - v->getVehicleType().getMinGap(); + if (!(*it).viaLink->havePriority() && !ego->onFurtherEdge(&(*it).lane->getEdge())) { + // if v comes from a minor side road it should not block lane changing + agap = MAX2(agap, 0.0); + } } result.addFollower(v, ego, agap, 0, i); #ifdef DEBUG_CONTEXT @@ -2357,10 +2567,10 @@ #endif } } - if ((*it).length < dist) { + if ((*it).length < searchDist) { const std::vector& followers = next->getIncomingLanes(); for (std::vector::const_iterator j = followers.begin(); j != followers.end(); ++j) { - if (visited.find((*j).lane) == visited.end()) { + if (visited.find((*j).lane) == visited.end() && ((*j).viaLink->havePriority() || !ignoreMinorLinks)) { visited.insert((*j).lane); MSLane::IncomingLaneInfo ili; ili.lane = (*j).lane; @@ -2382,7 +2592,7 @@ void -MSLane::getLeadersOnConsecutive(SUMOReal dist, SUMOReal seen, SUMOReal speed, const MSVehicle* ego, +MSLane::getLeadersOnConsecutive(double dist, double seen, double speed, const MSVehicle* ego, const std::vector& bestLaneConts, MSLeaderDistanceInfo& result) const { if (seen > dist) { return; @@ -2408,9 +2618,8 @@ ego->getImpatience(), ego->getCarFollowModel().getMaxDecel(), 0, ego->getLateralPositionOnLane()) || (*link)->haveRed()) { break; } -#ifdef HAVE_INTERNAL_LANES // check for link leaders - const MSLink::LinkLeaders linkLeaders = (*link)->getLeaderInfo(seen, ego->getVehicleType().getMinGap()); + const MSLink::LinkLeaders linkLeaders = (*link)->getLeaderInfo(ego, seen); if (linkLeaders.size() > 0) { const MSLink::LinkLeader ll = linkLeaders[0]; if (ll.vehAndGap.first != 0) { @@ -2423,7 +2632,6 @@ } // XXX else, deal with pedestrians } bool nextInternal = (*link)->getViaLane() != 0; -#endif nextLane = (*link)->getViaLaneOrLane(); if (nextLane == 0) { break; @@ -2460,13 +2668,9 @@ // delaying the update of arrivalTime and making it conditional to avoid possible integer overflows arrivalTime += TIME2STEPS(nextLane->getLength() / MAX2(speed, NUMERICAL_EPS)); } -#ifdef HAVE_INTERNAL_LANES if (!nextInternal) { view++; } -#else - view++; -#endif } } @@ -2505,59 +2709,61 @@ } -SUMOReal -MSLane::getOppositePos(SUMOReal pos) const { +double +MSLane::getOppositePos(double pos) const { MSLane* opposite = getOpposite(); if (opposite == 0) { assert(false); throw ProcessError("Lane '" + getID() + "' cannot compute oppositePos as there is no opposite lane."); } // XXX transformations for curved geometries - return opposite->getLength() - pos; + return MAX2(0., opposite->getLength() - pos); } -std::pair -MSLane::getFollower(const MSVehicle* ego, SUMOReal egoPos, SUMOReal dist) const { +std::pair +MSLane::getFollower(const MSVehicle* ego, double egoPos, double dist, bool ignoreMinorLinks) const { for (AnyVehicleIterator first = anyVehiclesUpstreamBegin(); first != anyVehiclesUpstreamEnd(); ++first) { // XXX refactor leaderInfo to use a const vehicle all the way through the call hierarchy MSVehicle* pred = (MSVehicle*)*first; #ifdef DEBUG_CONTEXT if (DEBUG_COND2(ego)) { - std::cout << " getFollower lane=" << getID() << " egoPos=" << egoPos << " pred=" << pred->getID() << " predPos=" << pred->getPositionOnLane() << "\n"; + std::cout << " getFollower lane=" << getID() << " egoPos=" << egoPos << " pred=" << pred->getID() << " predPos=" << pred->getPositionOnLane(this) << "\n"; } #endif - if (pred->getPositionOnLane() < egoPos) { - return std::pair(pred, egoPos - pred->getPositionOnLane(this) - ego->getVehicleType().getLength() - pred->getVehicleType().getMinGap()); + if (pred->getPositionOnLane(this) < egoPos && pred != ego) { + return std::pair(pred, egoPos - pred->getPositionOnLane(this) - ego->getVehicleType().getLength() - pred->getVehicleType().getMinGap()); } } - return getFollowerOnConsecutive( - egoPos - ego->getVehicleType().getLength(), - ego->getSpeed(), ego->getCarFollowModel().getMaxDecel(), dist); + const double backOffset = egoPos - ego->getVehicleType().getLength(); + CLeaderDist result = getFollowersOnConsecutive(ego, backOffset, true, dist, ignoreMinorLinks)[0]; + return std::make_pair(const_cast(result.first), result.second); } -std::pair -MSLane::getOppositeLeader(const MSVehicle* ego, SUMOReal dist) const { +std::pair +MSLane::getOppositeLeader(const MSVehicle* ego, double dist, bool oppositeDir) const { #ifdef DEBUG_OPPOSITE if (DEBUG_COND2(ego)) std::cout << SIMTIME << " getOppositeLeader lane=" << getID() << " ego=" << ego->getID() << " pos=" << ego->getPositionOnLane() << " posOnOpposite=" << getOppositePos(ego->getPositionOnLane()) << " dist=" << dist + << " oppositeDir=" << oppositeDir << "\n"; #endif - if (ego->getLaneChangeModel().isOpposite()) { + if (!oppositeDir) { return getLeader(ego, getOppositePos(ego->getPositionOnLane()), ego->getBestLanesContinuation(this)); } else { - const SUMOReal egoLength = ego->getVehicleType().getLength(); - std::pair result = getFollower(ego, getOppositePos(ego->getPositionOnLane() - egoLength), dist); + const double egoLength = ego->getVehicleType().getLength(); + const double egoPos = ego->getLaneChangeModel().isOpposite() ? ego->getPositionOnLane() : getOppositePos(ego->getPositionOnLane()); + std::pair result = getFollower(ego, egoPos + egoLength, dist, true); result.second -= ego->getVehicleType().getMinGap(); return result; } } -std::pair +std::pair MSLane::getOppositeFollower(const MSVehicle* ego) const { #ifdef DEBUG_OPPOSITE if (DEBUG_COND2(ego)) std::cout << SIMTIME << " getOppositeFollower lane=" << getID() @@ -2567,10 +2773,10 @@ << "\n"; #endif if (ego->getLaneChangeModel().isOpposite()) { - std::pair result = getFollower(ego, getOppositePos(ego->getPositionOnLane()), -1); + std::pair result = getFollower(ego, getOppositePos(ego->getPositionOnLane()), -1, true); return result; } else { - std::pair result = getLeader(ego, getOppositePos(ego->getPositionOnLane() - ego->getVehicleType().getLength()), std::vector()); + std::pair result = getLeader(ego, getOppositePos(ego->getPositionOnLane() - ego->getVehicleType().getLength()), std::vector()); if (result.second > 0) { // follower can be safely ignored since it is going the other way return std::make_pair(static_cast(0), -1); @@ -2596,6 +2802,7 @@ throw ProcessError("Invalid collision.action '" + action + "'."); } myCheckJunctionCollisions = oc.getBool("collision.check-junctions"); + myCollisionStopTime = string2time(oc.getString("collision.stoptime")); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLane.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLane.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLane.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLane.h 2017-07-23 16:22:03.000000000 +0000 @@ -8,12 +8,12 @@ /// @author Michael Behrisch /// @author Mario Krumnow /// @date Mon, 12 Mar 2001 -/// @version $Id: MSLane.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSLane.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Representation of a lane in the micro simulation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -92,9 +92,9 @@ /** Function-object in order to find the vehicle, that has just passed the detector. */ - struct VehPosition : public std::binary_function < const MSVehicle*, SUMOReal, bool > { + struct VehPosition : public std::binary_function < const MSVehicle*, double, bool > { /// compares vehicle position to the detector position - bool operator()(const MSVehicle* cmp, SUMOReal pos) const; + bool operator()(const MSVehicle* cmp, double pos) const; }; class AnyVehicleIterator { @@ -177,11 +177,12 @@ * @param[in] width The width of the lane * @param[in] permissions Encoding of the Vehicle classes that may drive on this lane * @param[in] index The index of this lane within its parent edge + * @param[in] isRampAccel Whether this lane is an acceleratin lane * @see SUMOVehicleClass */ - MSLane(const std::string& id, SUMOReal maxSpeed, SUMOReal length, MSEdge* const edge, - int numericalID, const PositionVector& shape, SUMOReal width, - SVCPermissions permissions, int index); + MSLane(const std::string& id, double maxSpeed, double length, MSEdge* const edge, + int numericalID, const PositionVector& shape, double width, + SVCPermissions permissions, int index, bool isRampAccel); /// @brief Destructor @@ -271,17 +272,17 @@ * @return Whether the vehicle could be inserted * @see MSVehicle::enterLaneAtInsertion */ - bool isInsertionSuccess(MSVehicle* vehicle, SUMOReal speed, SUMOReal pos, SUMOReal posLat, + bool isInsertionSuccess(MSVehicle* vehicle, double speed, double pos, double posLat, bool recheckNextLanes, MSMoveReminder::Notification notification); // XXX: Documentation? - bool checkFailure(MSVehicle* aVehicle, SUMOReal& speed, SUMOReal& dist, const SUMOReal nspeed, const bool patchSpeed, const std::string errorMsg) const; + bool checkFailure(MSVehicle* aVehicle, double& speed, double& dist, const double nspeed, const bool patchSpeed, const std::string errorMsg) const; - /** @todo documentation - * + /** @brief inserts vehicle as close as possible to the last vehicle on this + * lane (or at the end of the lane if there is no leader) */ - bool lastInsertion(MSVehicle& veh, SUMOReal mspeed); + bool lastInsertion(MSVehicle& veh, double mspeed, bool patchSpeed); /** @brief Tries to insert the given vehicle on any place * @@ -290,7 +291,7 @@ * @param[in] notification The cause of insertion (i.e. departure, teleport, parking) defaults to departure * @return Whether the vehicle could be inserted */ - bool freeInsertion(MSVehicle& veh, SUMOReal speed, + bool freeInsertion(MSVehicle& veh, double speed, MSMoveReminder::Notification notification = MSMoveReminder::NOTIFICATION_DEPARTED); @@ -303,7 +304,7 @@ * @param[in] notification The cause of insertion (i.e. departure, teleport, parking) defaults to departure * @param[in] posLat The lateral position at which the vehicle shall be inserted */ - void forceVehicleInsertion(MSVehicle* veh, SUMOReal pos, MSMoveReminder::Notification notification, SUMOReal posLat = 0); + void forceVehicleInsertion(MSVehicle* veh, double pos, MSMoveReminder::Notification notification, double posLat = 0); /// @} @@ -317,7 +318,7 @@ * @param[in] v The vehicle which laps into this lane * @return This lane's length */ - virtual SUMOReal setPartialOccupation(MSVehicle* v); + virtual double setPartialOccupation(MSVehicle* v); /** @brief Removes the information about a vehicle lapping into this lane * @param[in] v The vehicle which laps into this lane @@ -334,15 +335,13 @@ * @param[in] allowCached Whether the cached value may be used * @return Information about the last vehicles */ - const MSLeaderInfo& getLastVehicleInformation(const MSVehicle* ego, SUMOReal latOffset, SUMOReal minPos = 0, bool allowCached = true) const; + const MSLeaderInfo& getLastVehicleInformation(const MSVehicle* ego, double latOffset, double minPos = 0, bool allowCached = true) const; /// @brief analogue to getLastVehicleInformation but in the upstream direction - const MSLeaderInfo& getFirstVehicleInformation(const MSVehicle* ego, SUMOReal latOffset, bool onlyFrontOnLane, SUMOReal maxPos = std::numeric_limits::max(), bool allowCached = true) const; + const MSLeaderInfo& getFirstVehicleInformation(const MSVehicle* ego, double latOffset, bool onlyFrontOnLane, double maxPos = std::numeric_limits::max(), bool allowCached = true) const; /// @} - - /// @name Access to vehicles /// @{ @@ -429,25 +428,30 @@ } /// @brief return shape.length() / myLength - inline SUMOReal getLengthGeometryFactor() const { + inline double getLengthGeometryFactor() const { return myLengthGeometryFactor; } + /// @brief return whether this lane is an acceleration lane + inline bool isAccelLane() const { + return myIsRampAccel; + } + /* @brief fit the given lane position to a visibly suitable geometry position * (lane length might differ from geometry length) */ - inline SUMOReal interpolateLanePosToGeometryPos(SUMOReal lanePos) const { + inline double interpolateLanePosToGeometryPos(double lanePos) const { return lanePos * myLengthGeometryFactor; } /* @brief fit the given lane position to a visibly suitable geometry position * and return the coordinates */ - inline const Position geometryPositionAtOffset(SUMOReal offset, SUMOReal lateralOffset = 0) const { + inline const Position geometryPositionAtOffset(double offset, double lateralOffset = 0) const { return myShape.positionAtOffset(interpolateLanePosToGeometryPos(offset), lateralOffset); } /* @brief fit the given geomtry position to a valid lane position * (lane length might differ from geometry length) */ - inline SUMOReal interpolateGeometryPosToLanePos(SUMOReal geometryPos) const { + inline double interpolateGeometryPosToLanePos(double geometryPos) const { return geometryPos / myLengthGeometryFactor; } @@ -455,9 +459,9 @@ * @param[in] The vehicle to return the adapted speed limit for * @return This lane's resulting max. speed */ - inline SUMOReal getVehicleMaxSpeed(const SUMOVehicle* const veh) const { + inline double getVehicleMaxSpeed(const SUMOVehicle* const veh) const { if (myRestrictions != 0) { - std::map::const_iterator r = myRestrictions->find(veh->getVClass()); + std::map::const_iterator r = myRestrictions->find(veh->getVClass()); if (r != myRestrictions->end()) { return MIN2(veh->getMaxSpeed(), r->second * veh->getChosenSpeedFactor()); } @@ -469,7 +473,7 @@ /** @brief Returns the lane's maximum allowed speed * @return This lane's maximum allowed speed */ - inline SUMOReal getSpeedLimit() const { + inline double getSpeedLimit() const { return myMaxSpeed; } @@ -477,7 +481,7 @@ /** @brief Returns the lane's length * @return This lane's length */ - inline SUMOReal getLength() const { + inline double getLength() const { return myLength; } @@ -493,7 +497,7 @@ /** @brief Returns the lane's width * @return This lane's width */ - SUMOReal getWidth() const { + double getWidth() const { return myWidth; } @@ -549,6 +553,13 @@ /// returns the container with all links !!! const MSLinkCont& getLinkCont() const; + /// returns the link to the given lane or 0, if it is not connected + MSLink* getLinkTo(const MSLane*) const; + + /// Returns the entry link if this is an internal lane, else 0 + MSLink* getEntryLink() const; + + /// Returns true if there is not a single vehicle on the lane. bool empty() const { assert(myVehBuffer.size() == 0); @@ -558,12 +569,12 @@ /** @brief Sets a new maximum speed for the lane (used by TraCI and MSCalibrator) * @param[in] val the new speed in m/s */ - void setMaxSpeed(SUMOReal val); + void setMaxSpeed(double val); /** @brief Sets a new length for the lane (used by TraCI only) * @param[in] val the new length in m */ - void setLength(SUMOReal val); + void setLength(double val); /** @brief Returns the lane's edge * @return This lane's edge @@ -576,7 +587,7 @@ /** @brief Returns the lane's follower if it is an internal lane, the edge of the lane otherwise * @return This lane's follower */ - const MSEdge* getInternalFollower() const; + const MSEdge* getNextNormal() const; /// @brief Static (sic!) container methods @@ -701,7 +712,7 @@ struct IncomingLaneInfo { MSLane* lane; - SUMOReal length; + double length; MSLink* viaLink; }; @@ -716,15 +727,12 @@ - /// @brief return the follower with the largest missing rear gap among all predecessor lanes (within dist) - std::pair getFollowerOnConsecutive( - SUMOReal backOffset, SUMOReal leaderSpeed, SUMOReal leaderMaxDecel, SUMOReal dist = -1) const; - /// @brief return the sublane followers with the largest missing rear gap among all predecessor lanes (within dist) - MSLeaderDistanceInfo getFollowersOnConsecutive(const MSVehicle* ego, bool allSublanes) const; + MSLeaderDistanceInfo getFollowersOnConsecutive(const MSVehicle* ego, double backOffset, + bool allSublanes, double searchDist = -1, bool ignoreMinorLinks = false) const; /// @brief return by how much further the leader must be inserted to avoid rear end collisions - SUMOReal getMissingRearGap(SUMOReal backOffset, SUMOReal leaderSpeed, SUMOReal leaderMaxDecel) const; + double getMissingRearGap(const MSVehicle* leader, double backOffset, double leaderSpeed) const; /** @brief Returns the immediate leader of veh and the distance to veh * starting on this lane @@ -738,7 +746,7 @@ * @param[in] checkTmpVehicles Whether myTmpVehicles should be used instead of myVehicles * @return */ - std::pair getLeader(const MSVehicle* veh, const SUMOReal vehPos, const std::vector& bestLaneConts, SUMOReal dist = -1, bool checkTmpVehicles = false) const; + std::pair getLeader(const MSVehicle* veh, const double vehPos, const std::vector& bestLaneConts, double dist = -1, bool checkTmpVehicles = false) const; /** @brief Returns the immediate leader and the distance to him * @@ -762,11 +770,11 @@ * @param[in] bestLaneConts The lanes the vehicle will use in future * @return */ - std::pair getLeaderOnConsecutive(SUMOReal dist, SUMOReal seen, - SUMOReal speed, const MSVehicle& veh, const std::vector& bestLaneConts) const; + std::pair getLeaderOnConsecutive(double dist, double seen, + double speed, const MSVehicle& veh, const std::vector& bestLaneConts) const; /// @brief Returns the immediate leaders and the distance to them (as getLeaderOnConsecutive but for the sublane case) - void getLeadersOnConsecutive(SUMOReal dist, SUMOReal seen, SUMOReal speed, const MSVehicle* ego, + void getLeadersOnConsecutive(double dist, double seen, double speed, const MSVehicle* ego, const std::vector& bestLaneConts, MSLeaderDistanceInfo& result) const; /** @brief Returns the most dangerous leader and the distance to him @@ -786,7 +794,7 @@ * @param[in] veh The (ego) vehicle for which the information shall be computed * @return */ - std::pair getCriticalLeader(SUMOReal dist, SUMOReal seen, SUMOReal speed, const MSVehicle& veh) const; + std::pair getCriticalLeader(double dist, double seen, double speed, const MSVehicle& veh) const; /* @brief return the partial vehicle closest behind ego or 0 * if no such vehicle exists */ @@ -801,6 +809,22 @@ */ MSLane* getLogicalPredecessorLane(const MSEdge& fromEdge) const; + + /** Return the main predecessor lane for the current. + * If there are several incoming lanes, the first attempt is to return the priorized. + * If this does not yield an unambiguous lane, the one with the least angle difference + * to the current is selected. + */ + MSLane* getCanonicalPredecessorLane() const; + + + /** Return the main successor lane for the current. + * If there are several outgoing lanes, the first attempt is to return the priorized. + * If this does not yield an unambiguous lane, the one with the least angle difference + * to the current is selected. + */ + MSLane* getCanonicalSuccessorLane() const; + /// @brief get the state of the link from the logical predecessor to this lane LinkState getIncomingLinkState() const; @@ -813,30 +837,30 @@ /** @brief Returns the mean speed on this lane * @return The average speed of vehicles during the last step; default speed if no vehicle was on this lane */ - SUMOReal getMeanSpeed() const; + double getMeanSpeed() const; /** @brief Returns the overall waiting time on this lane * @return The sum of the waiting time of all vehicles during the last step; */ - SUMOReal getWaitingSeconds() const; + double getWaitingSeconds() const; /** @brief Returns the brutto (including minGaps) occupancy of this lane during the last step * @return The occupancy during the last step */ - SUMOReal getBruttoOccupancy() const; + double getBruttoOccupancy() const; /** @brief Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps) * @return The occupancy during the last step */ - SUMOReal getNettoOccupancy() const; + double getNettoOccupancy() const; /** @brief Returns the sum of lengths of vehicles, including their minGaps, which were on the lane during the last step * @return The sum of vehicle lengths of vehicles in the last step */ - inline SUMOReal getBruttoVehLenSum() const { + inline double getBruttoVehLenSum() const { return myBruttoVehicleLengthSum; } @@ -844,57 +868,60 @@ /** @brief Returns the sum of last step CO2 emissions * @return CO2 emissions of vehicles on this lane during the last step */ - SUMOReal getCO2Emissions() const; + double getCO2Emissions() const; /** @brief Returns the sum of last step CO emissions * @return CO emissions of vehicles on this lane during the last step */ - SUMOReal getCOEmissions() const; + double getCOEmissions() const; /** @brief Returns the sum of last step PMx emissions * @return PMx emissions of vehicles on this lane during the last step */ - SUMOReal getPMxEmissions() const; + double getPMxEmissions() const; /** @brief Returns the sum of last step NOx emissions * @return NOx emissions of vehicles on this lane during the last step */ - SUMOReal getNOxEmissions() const; + double getNOxEmissions() const; /** @brief Returns the sum of last step HC emissions * @return HC emissions of vehicles on this lane during the last step */ - SUMOReal getHCEmissions() const; + double getHCEmissions() const; /** @brief Returns the sum of last step fuel consumption * @return fuel consumption of vehicles on this lane during the last step */ - SUMOReal getFuelConsumption() const; + double getFuelConsumption() const; /** @brief Returns the sum of last step electricity consumption * @return electricity consumption of vehicles on this lane during the last step */ - SUMOReal getElectricityConsumption() const; + double getElectricityConsumption() const; /** @brief Returns the sum of last step noise emissions * @return noise emissions of vehicles on this lane during the last step */ - SUMOReal getHarmonoise_NoiseEmissions() const; + double getHarmonoise_NoiseEmissions() const; /// @} - void setRightSideOnEdge(SUMOReal value, int rightmostSublane) { + void setRightSideOnEdge(double value, int rightmostSublane) { myRightSideOnEdge = value; myRightmostSublane = rightmostSublane; } - SUMOReal getRightSideOnEdge() const { + /// @brief initialized vClass-specific speed limits + void initRestrictions(); + + double getRightSideOnEdge() const { return myRightSideOnEdge; } @@ -902,7 +929,7 @@ return myRightmostSublane; } - SUMOReal getCenterOnEdge() const { + double getCenterOnEdge() const { return myRightSideOnEdge + 0.5 * myWidth; } @@ -913,20 +940,31 @@ MSLane* getOpposite() const; /// @brief return the corresponding position on the opposite lane - SUMOReal getOppositePos(SUMOReal pos) const; + double getOppositePos(double pos) const; - std::pair getOppositeLeader(const MSVehicle* ego, SUMOReal dist) const; + /* @brief find leader for a vehicle depending the relative driving direction + * @param[in] ego The ego vehicle + * @param[in] dist The look-ahead distance when looking at consecutive lanes + * @param[in] oppositeDir Whether the lane has the opposite driving direction of ego + * @return the leader vehicle and it's gap to ego + */ + std::pair getOppositeLeader(const MSVehicle* ego, double dist, bool oppositeDir) const; - std::pair getOppositeFollower(const MSVehicle* ego) const; + /* @brief find follower for a vehicle that is located on the opposite of this lane + * @param[in] ego The ego vehicle + * @return the follower vehicle and it's gap to ego + */ + std::pair getOppositeFollower(const MSVehicle* ego) const; /** @brief Find follower vehicle for the given ego vehicle (which may be on the opposite direction lane) * @param[in] ego The ego vehicle * @param[in] egoPos The ego position mapped to the current lane * @param[in] dist The look-back distance when looking at consecutive lanes + * @param[in] ignoreMinorLinks Whether backward search should stop at minor links * @return the follower vehicle and it's gap to ego */ - std::pair getFollower(const MSVehicle* ego, SUMOReal egoPos, SUMOReal dist) const; + std::pair getFollower(const MSVehicle* ego, double egoPos, double dist, bool ignoreMinorLinks) const; /// @name State saving/loading /// @{ @@ -974,6 +1012,10 @@ return myCollisionAction == COLLISION_ACTION_TELEPORT; } + static CollisionAction getCollisionAction() { + return myCollisionAction; + } + static const long CHANGE_PERMISSIONS_PERMANENT = 0; static const long CHANGE_PERMISSIONS_GUI = 1; @@ -992,38 +1034,38 @@ * @param[in] at * @param[in] notification The cause of insertion (i.e. departure, teleport, parking) defaults to departure */ - virtual void incorporateVehicle(MSVehicle* veh, SUMOReal pos, SUMOReal speed, SUMOReal posLat, + virtual void incorporateVehicle(MSVehicle* veh, double pos, double speed, double posLat, const MSLane::VehCont::iterator& at, MSMoveReminder::Notification notification = MSMoveReminder::NOTIFICATION_DEPARTED); /// @brief detect whether there is a collision between the two vehicles - bool detectCollisionBetween(SUMOTime timestep, const std::string& stage, const MSVehicle* collider, const MSVehicle* victim, + bool detectCollisionBetween(SUMOTime timestep, const std::string& stage, MSVehicle* collider, MSVehicle* victim, std::set& toRemove, std::set& toTeleport) const; /// @brief take action upon collision - void handleCollisionBetween(SUMOTime timestep, const std::string& stage, const MSVehicle* collider, const MSVehicle* victim, - SUMOReal gap, SUMOReal latGap, + void handleCollisionBetween(SUMOTime timestep, const std::string& stage, MSVehicle* collider, MSVehicle* victim, + double gap, double latGap, std::set& toRemove, std::set& toTeleport) const; /// @brief compute maximum braking distance on this lane - SUMOReal getMaximumBrakeDist() const; + double getMaximumBrakeDist() const; /* @brief determine depart speed and whether it may be patched * @param[in] veh The departing vehicle * @param[out] whether the speed may be patched to account for safety * @return the depart speed */ - SUMOReal getDepartSpeed(const MSVehicle& veh, bool& patchSpeed); + double getDepartSpeed(const MSVehicle& veh, bool& patchSpeed); /** @brief return the maximum safe speed for insertion behind leaders * (a negative value indicates that safe insertion is impossible) */ - SUMOReal safeInsertionSpeed(const MSVehicle* veh, const MSLeaderInfo& leaders, SUMOReal speed); + double safeInsertionSpeed(const MSVehicle* veh, const MSLeaderInfo& leaders, double speed); /// @brief departure position where the vehicle fits fully onto the lane (if possible) - SUMOReal basePos(const MSVehicle& veh) const; + double basePos(const MSVehicle& veh) const; /// Unique numerical ID (set on reading by netload) int myNumericalID; @@ -1069,16 +1111,16 @@ /// Lane length [m] - SUMOReal myLength; + double myLength; /// Lane width [m] - const SUMOReal myWidth; + const double myWidth; /// The lane's edge, for routing only. MSEdge* const myEdge; /// Lane-wide speedlimit [m/s] - SUMOReal myMaxSpeed; + double myMaxSpeed; /// The vClass permissions for this lane SVCPermissions myPermissions; @@ -1087,22 +1129,31 @@ SVCPermissions myOriginalPermissions; /// The vClass speed restrictions for this lane - const std::map* myRestrictions; + const std::map* myRestrictions; + /// All direct predecessor lanes std::vector myIncomingLanes; + + /// mutable MSLane* myLogicalPredecessorLane; + /// Similar to LogicalPredecessorLane, @see getCanonicalPredecessorLane() + mutable MSLane* myCanonicalPredecessorLane; + + /// Main successor lane, @see getCanonicalSuccessorLane() + mutable MSLane* myCanonicalSuccessorLane; /// @brief The current length of all vehicles on this lane, including their minGaps - SUMOReal myBruttoVehicleLengthSum; + double myBruttoVehicleLengthSum; /// @brief The current length of all vehicles on this lane, excluding their minGaps - SUMOReal myNettoVehicleLengthSum; + double myNettoVehicleLengthSum; /** The lane's Links to it's succeeding lanes and the default right-of-way rule, i.e. blocked or not blocked. */ MSLinkCont myLinks; + /// All direct internal and direct (disregarding internal predecessors) non-internal predecessor lanes of this lane std::map > myApproachingLanes; /// @brief leaders on all sublanes as seen by approaching vehicles (cached) @@ -1118,10 +1169,13 @@ mutable SUMOTime myFollowerInfoTime; /// @brief precomputed myShape.length / myLength - const SUMOReal myLengthGeometryFactor; + const double myLengthGeometryFactor; + + /// @brief whether this lane is an acceleration lane + const bool myIsRampAccel; /// @brief the combined width of all lanes with lower index on myEdge - SUMOReal myRightSideOnEdge; + double myRightSideOnEdge; /// @brief the index of the rightmost sublane of this lane on myEdge int myRightmostSublane; @@ -1144,6 +1198,7 @@ /// @brief the action to take on collisions static CollisionAction myCollisionAction; static bool myCheckJunctionCollisions; + static SUMOTime myCollisionStopTime; /** * @class vehicle_position_sorter @@ -1191,7 +1246,7 @@ }; - /** @class by_id_sorter + /** @class by_connections_to_sorter * @brief Sorts edges by their angle relative to the given edge (straight comes first) * */ @@ -1207,7 +1262,48 @@ by_connections_to_sorter& operator=(const by_connections_to_sorter&); // just to avoid a compiler warning private: const MSEdge* const myEdge; - SUMOReal myLaneDir; + double myLaneDir; + }; + + + + /** @class incoming_lane_priority_sorter + * @brief Sorts lanes (IncomingLaneInfos) by their priority or, if this doesn't apply, + * wrt. the angle difference magnitude relative to the target lane's angle (straight comes first) + */ + class incoming_lane_priority_sorter { + public: + /// @brief constructor + explicit incoming_lane_priority_sorter(const MSLane* targetLane); + + /// @brief comparing operator + int operator()(const IncomingLaneInfo& lane1, const IncomingLaneInfo& lane2) const; + + private: + incoming_lane_priority_sorter& operator=(const incoming_lane_priority_sorter&); // just to avoid a compiler warning + private: + const MSLane* const myLane; + double myLaneDir; + }; + + + /** @class outgoing_lane_priority_sorter + * @brief Sorts lanes (their origin link) by the priority of their noninternal target edges or, if this doesn't yield an unambiguous result, + * wrt. the angle difference magnitude relative to the target lane's angle (straight comes first) + */ + class outgoing_lane_priority_sorter { + public: + /// @brief constructor + explicit outgoing_lane_priority_sorter(const MSLane* sourceLane); + + /// @brief comparing operator + int operator()(const MSLink* link1, const MSLink* link2) const; + + private: + outgoing_lane_priority_sorter& operator=(const outgoing_lane_priority_sorter&); // just to avoid a compiler warning + private: + const MSLane* const myLane; + double myLaneDir; }; /** diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLeaderInfo.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLeaderInfo.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLeaderInfo.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLeaderInfo.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,13 +2,13 @@ /// @file MSLeaderInfo.cpp /// @author Jakob Erdmann /// @date Oct 2015 -/// @version $Id: MSLeaderInfo.cpp 21690 2016-10-14 11:33:55Z namdre $ +/// @version $Id: MSLeaderInfo.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Information about vehicles ahead (may be multiple vehicles if // lateral-resolution is active) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include #include "MSLeaderInfo.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member variables @@ -50,7 +46,7 @@ // =========================================================================== // MSLeaderInfo member method definitions // =========================================================================== -MSLeaderInfo::MSLeaderInfo(const MSLane* lane, const MSVehicle* ego, SUMOReal latOffset) : +MSLeaderInfo::MSLeaderInfo(const MSLane* lane, const MSVehicle* ego, double latOffset) : myWidth(lane->getWidth()), myVehicles(MAX2(1, int(ceil(myWidth / MSGlobals::gLateralResolution))), (MSVehicle*)0), myFreeSublanes((int)myVehicles.size()), @@ -70,7 +66,7 @@ int -MSLeaderInfo::addLeader(const MSVehicle* veh, bool beyond, SUMOReal latOffset) { +MSLeaderInfo::addLeader(const MSVehicle* veh, bool beyond, double latOffset) { if (veh == 0) { return myFreeSublanes; } @@ -112,7 +108,7 @@ void -MSLeaderInfo::getSubLanes(const MSVehicle* veh, SUMOReal latOffset, int& rightmost, int& leftmost) const { +MSLeaderInfo::getSubLanes(const MSVehicle* veh, double latOffset, int& rightmost, int& leftmost) const { if (myVehicles.size() == 1) { // speedup for the simple case rightmost = 0; @@ -120,10 +116,10 @@ return; } // map center-line based coordinates into [0, myWidth] coordinates - const SUMOReal vehCenter = veh->getLateralPositionOnLane() + 0.5 * myWidth + latOffset; - const SUMOReal vehHalfWidth = 0.5 * veh->getVehicleType().getWidth(); - const SUMOReal rightVehSide = MAX2((SUMOReal)0, vehCenter - vehHalfWidth); - const SUMOReal leftVehSide = MIN2(myWidth, vehCenter + vehHalfWidth); + const double vehCenter = veh->getLateralPositionOnLane() + 0.5 * myWidth + latOffset; + const double vehHalfWidth = 0.5 * veh->getVehicleType().getWidth(); + const double rightVehSide = MAX2(0., vehCenter - vehHalfWidth); + const double leftVehSide = MIN2(myWidth, vehCenter + vehHalfWidth); rightmost = (int)floor((rightVehSide + NUMERICAL_EPS) / MSGlobals::gLateralResolution); leftmost = MIN2((int)myVehicles.size() - 1, (int)floor(leftVehSide / MSGlobals::gLateralResolution)); //if (veh->getID() == "car2") std::cout << SIMTIME << " veh=" << veh->getID() @@ -138,6 +134,15 @@ } +void +MSLeaderInfo::getSublaneBorders(int sublane, double latOffset, double& rightSide, double& leftSide) const { + assert(sublane >= 0); + assert(sublane < (int)myVehicles.size()); + rightSide = sublane * MSGlobals::gLateralResolution + latOffset; + leftSide = MIN2((sublane + 1) * MSGlobals::gLateralResolution, myWidth) + latOffset; +} + + const MSVehicle* MSLeaderInfo::operator[](int sublane) const { assert(sublane >= 0); @@ -180,17 +185,24 @@ // =========================================================================== -MSLeaderDistanceInfo::MSLeaderDistanceInfo(const MSLane* lane, const MSVehicle* ego, SUMOReal latOffset) : +MSLeaderDistanceInfo::MSLeaderDistanceInfo(const MSLane* lane, const MSVehicle* ego, double latOffset) : MSLeaderInfo(lane, ego, latOffset), - myDistances(myVehicles.size(), std::numeric_limits::max()) { + myDistances(myVehicles.size(), std::numeric_limits::max()) { } +MSLeaderDistanceInfo::MSLeaderDistanceInfo(const CLeaderDist& cLeaderDist, const MSLane* dummy) : + MSLeaderInfo(dummy, 0, 0), + myDistances(1, cLeaderDist.second) { + assert(myVehicles.size() == 1); + myVehicles[0] = cLeaderDist.first; +} + MSLeaderDistanceInfo::~MSLeaderDistanceInfo() { } int -MSLeaderDistanceInfo::addLeader(const MSVehicle* veh, SUMOReal gap, SUMOReal latOffset, int sublane) { +MSLeaderDistanceInfo::addLeader(const MSVehicle* veh, double gap, double latOffset, int sublane) { //if (SIMTIME == 31 && gDebugFlag1 && veh != 0 && veh->getID() == "cars.8") { // std::cout << " BREAKPOINT\n"; //} @@ -233,7 +245,7 @@ void MSLeaderDistanceInfo::clear() { MSLeaderInfo::clear(); - myDistances.assign(myVehicles.size(), std::numeric_limits::max()); + myDistances.assign(myVehicles.size(), std::numeric_limits::max()); } @@ -271,9 +283,9 @@ // =========================================================================== -MSCriticalFollowerDistanceInfo::MSCriticalFollowerDistanceInfo(const MSLane* lane, const MSVehicle* ego, SUMOReal latOffset) : +MSCriticalFollowerDistanceInfo::MSCriticalFollowerDistanceInfo(const MSLane* lane, const MSVehicle* ego, double latOffset) : MSLeaderDistanceInfo(lane, ego, latOffset), - myMissingGaps(myVehicles.size(), -std::numeric_limits::max()) { + myMissingGaps(myVehicles.size(), -std::numeric_limits::max()) { } @@ -281,12 +293,12 @@ int -MSCriticalFollowerDistanceInfo::addFollower(const MSVehicle* veh, const MSVehicle* ego, SUMOReal gap, SUMOReal latOffset, int sublane) { +MSCriticalFollowerDistanceInfo::addFollower(const MSVehicle* veh, const MSVehicle* ego, double gap, double latOffset, int sublane) { if (veh == 0) { return myFreeSublanes; } - const SUMOReal requiredGap = veh->getCarFollowModel().getSecureGap(veh->getSpeed(), ego->getSpeed(), ego->getCarFollowModel().getMaxDecel()); - const SUMOReal missingGap = requiredGap - gap; + const double requiredGap = veh->getCarFollowModel().getSecureGap(veh->getSpeed(), ego->getSpeed(), ego->getCarFollowModel().getMaxDecel()); + const double missingGap = requiredGap - gap; //if (gDebugFlag1) { // std::cout << " addFollower veh=" << veh->getID() // << " ego=" << ego->getID() @@ -341,7 +353,7 @@ void MSCriticalFollowerDistanceInfo::clear() { MSLeaderDistanceInfo::clear(); - myMissingGaps.assign(myVehicles.size(), -std::numeric_limits::max()); + myMissingGaps.assign(myVehicles.size(), -std::numeric_limits::max()); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLeaderInfo.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLeaderInfo.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLeaderInfo.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLeaderInfo.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,13 +2,13 @@ /// @file MSLeaderInfo.h /// @author Jakob Erdmann /// @date Oct 2015 -/// @version $Id: MSLeaderInfo.h 20687 2016-05-10 11:27:00Z behrisch $ +/// @version $Id: MSLeaderInfo.h 23781 2017-04-03 10:14:13Z namdre $ /// // Information about vehicles ahead (may be multiple vehicles if // lateral-resolution is active) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,8 +45,8 @@ // =========================================================================== // types definitions // =========================================================================== -typedef std::pair CLeaderDist; -typedef std::pair LeaderDist; +typedef std::pair CLeaderDist; +typedef std::pair LeaderDist; // =========================================================================== // class definitions @@ -57,7 +57,7 @@ class MSLeaderInfo { public: /// Constructor - MSLeaderInfo(const MSLane* lane, const MSVehicle* ego = 0, SUMOReal latOffset = 0); + MSLeaderInfo(const MSLane* lane, const MSVehicle* ego = 0, double latOffset = 0); /// Destructor virtual ~MSLeaderInfo(); @@ -68,17 +68,26 @@ * @param[in] latOffset The lateral offset that must be added to the position of veh * @return The number of free sublanes */ - virtual int addLeader(const MSVehicle* veh, bool beyond, SUMOReal latOffset = 0); + virtual int addLeader(const MSVehicle* veh, bool beyond, double latOffset = 0); /// @brief discard all information virtual void clear(); - /* @brief adds this vehicle as a leader in the appropriate sublanes + /* @brief returns sublanes occupied by veh * @param[in] veh The vehicle to check + * @param[in] latOffset The offset value to add to the vehicle position * @param[out] rightmost The rightmost sublane occupied by veh * @param[out] leftmost The rightmost sublane occupied by veh */ - void getSubLanes(const MSVehicle* veh, SUMOReal latOffset, int& rightmost, int& leftmost) const; + void getSubLanes(const MSVehicle* veh, double latOffset, int& rightmost, int& leftmost) const; + + /* @brief returns the sublane boundaries of the ith sublane + * @param[in] sublane The sublane to check + * @param[in] latOffset The offset value to add to the result + * @param[out] rightSide The right border of the given sublane + * @param[out] leftSide The left border of the given sublane + */ + void getSublaneBorders(int sublane, double latOffset, double& rightSide, double& leftSide) const; /// @brief return the vehicle for the given sublane const MSVehicle* operator[](int sublane) const; @@ -105,7 +114,7 @@ /// @brief the width of the lane to which this instance applies // @note: not const to simplify assignment - SUMOReal myWidth; + double myWidth; std::vector myVehicles; @@ -127,7 +136,10 @@ class MSLeaderDistanceInfo : public MSLeaderInfo { public: /// Constructor - MSLeaderDistanceInfo(const MSLane* lane, const MSVehicle* ego, SUMOReal latOffset); + MSLeaderDistanceInfo(const MSLane* lane, const MSVehicle* ego, double latOffset); + + /// @brief Construct for the non-sublane-case + MSLeaderDistanceInfo(const CLeaderDist& cLeaderDist, const MSLane* dummy); /// Destructor virtual ~MSLeaderDistanceInfo(); @@ -140,9 +152,9 @@ * @param[in] sublane The single sublane to which this leader shall be checked (-1 means: check for all) * @return The number of free sublanes */ - virtual int addLeader(const MSVehicle* veh, SUMOReal gap, SUMOReal latOffset = 0, int sublane = -1); + virtual int addLeader(const MSVehicle* veh, double gap, double latOffset = 0, int sublane = -1); - virtual int addLeader(const MSVehicle* veh, bool beyond, SUMOReal latOffset = 0) { + virtual int addLeader(const MSVehicle* veh, bool beyond, double latOffset = 0) { UNUSED_PARAMETER(veh); UNUSED_PARAMETER(beyond); UNUSED_PARAMETER(latOffset); @@ -160,7 +172,7 @@ protected: - std::vector myDistances; + std::vector myDistances; }; @@ -171,7 +183,7 @@ class MSCriticalFollowerDistanceInfo : public MSLeaderDistanceInfo { public: /// Constructor - MSCriticalFollowerDistanceInfo(const MSLane* lane, const MSVehicle* ego, SUMOReal latOffset); + MSCriticalFollowerDistanceInfo(const MSLane* lane, const MSVehicle* ego, double latOffset); /// Destructor virtual ~MSCriticalFollowerDistanceInfo(); @@ -184,9 +196,9 @@ * @param[in] sublane The single sublane to which this leader shall be checked (-1 means: check for all) * @return The number of free sublanes */ - int addFollower(const MSVehicle* veh, const MSVehicle* ego, SUMOReal gap, SUMOReal latOffset = 0, int sublane = -1); + int addFollower(const MSVehicle* veh, const MSVehicle* ego, double gap, double latOffset = 0, int sublane = -1); - virtual int addLeader(const MSVehicle* veh, SUMOReal gap, SUMOReal latOffset = 0, int sublane = -1) { + virtual int addLeader(const MSVehicle* veh, double gap, double latOffset = 0, int sublane = -1) { UNUSED_PARAMETER(veh); UNUSED_PARAMETER(gap); UNUSED_PARAMETER(latOffset); @@ -194,7 +206,7 @@ throw ProcessError("Method not supported"); } - virtual int addLeader(const MSVehicle* veh, bool beyond, SUMOReal latOffset = 0) { + virtual int addLeader(const MSVehicle* veh, bool beyond, double latOffset = 0) { UNUSED_PARAMETER(veh); UNUSED_PARAMETER(beyond); UNUSED_PARAMETER(latOffset); @@ -210,7 +222,7 @@ protected: // @brief the differences between requriedGap and actual gap for each of the followers - std::vector myMissingGaps; + std::vector myMissingGaps; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLinkCont.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLinkCont.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLinkCont.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLinkCont.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date 15 Feb 2004 -/// @version $Id: MSLinkCont.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSLinkCont.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Helpers for link vector /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,15 +32,10 @@ #include "MSLinkCont.h" #include "MSLane.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== -#ifdef HAVE_INTERNAL_LANES const MSEdge* MSLinkContHelper::getInternalFollowingEdge(const MSLane* fromLane, const MSEdge* followerAfterInternal) { @@ -77,7 +72,6 @@ } return 0; } -#endif MSLink* diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLinkCont.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLinkCont.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLinkCont.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLinkCont.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: MSLinkCont.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSLinkCont.h 23143 2017-02-27 08:20:06Z namdre $ /// // A vector of links /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -58,7 +58,6 @@ */ class MSLinkContHelper { public: -#ifdef HAVE_INTERNAL_LANES /** @brief Returns the internal lane that must be passed in order to get to the desired edge Returns 0 if no such edge exists */ static const MSEdge* getInternalFollowingEdge(const MSLane* fromLane, @@ -66,7 +65,6 @@ static const MSLane* getInternalFollowingLane(const MSLane* fromLane, const MSLane* followerAfterInternal); -#endif /** @brief Returns the link connecting both lanes Both lanes have to be non-internal; 0 may be returned if no connection diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLink.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLink.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLink.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLink.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Sept 2002 -/// @version $Id: MSLink.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSLink.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A connnection between lanes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,12 +42,9 @@ #include "MSEdge.h" #include "MSGlobals.h" #include "MSVehicle.h" +#include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - //#define MSLink_DEBUG_CROSSING_POINTS // =========================================================================== @@ -57,36 +54,17 @@ // additional caution is needed when approaching a zipper link const SUMOTime MSLink::myLookaheadTimeZipper = TIME2STEPS(4); -const SUMOReal MSLink::ZIPPER_ADAPT_DIST(100); +const double MSLink::ZIPPER_ADAPT_DIST(100); // time to link in seconds below which adaptation should take place #define ZIPPER_ADAPT_TIME 10 +#define INVALID_DOUBLE std::numeric_limits::max() + // =========================================================================== // member method definitions // =========================================================================== -#ifndef HAVE_INTERNAL_LANES -MSLink::MSLink(MSLane* predLane, MSLane* succLane, LinkDirection dir, LinkState state, SUMOReal length, SUMOReal foeVisibilityDistance, bool keepClear, MSTrafficLightLogic* logic, int tlIndex) : - myLane(succLane), - myLaneBefore(predLane), - myIndex(-1), - myTLIndex(tlIndex), - myLogic(logic), - myState(state), - myLastStateChange(SUMOTime_MIN), - myDirection(dir), - myLength(length), - myFoeVisibilityDistance(foeVisibilityDistance), - myHasFoes(false), - myAmCont(false), - myKeepClear(keepClear), - myMesoTLSPenalty(0), - myParallelRight(0), - myParallelLeft(0), - myJunction(0) { -} -#else -MSLink::MSLink(MSLane* predLane, MSLane* succLane, MSLane* via, LinkDirection dir, LinkState state, SUMOReal length, SUMOReal foeVisibilityDistance, bool keepClear, MSTrafficLightLogic* logic, int tlIndex) : +MSLink::MSLink(MSLane* predLane, MSLane* succLane, MSLane* via, LinkDirection dir, LinkState state, double length, double foeVisibilityDistance, bool keepClear, MSTrafficLightLogic* logic, int tlIndex) : myLane(succLane), myLaneBefore(predLane), myIndex(-1), @@ -103,11 +81,11 @@ myInternalLane(via), myInternalLaneBefore(0), myMesoTLSPenalty(0), + myGreenFraction(1), myParallelRight(0), myParallelLeft(0), myJunction(0) { } -#endif MSLink::~MSLink() {} @@ -118,6 +96,11 @@ const std::vector& foeLinks, const std::vector& foeLanes, MSLane* internalLaneBefore) { +//#ifdef MSLink_DEBUG_CROSSING_POINTS +// std::cout << " setRequestInformation() for junction " << getViaLaneOrLane()->getEdge().getFromJunction()->getID() +// << "\nInternalLanes = " << toString(getViaLaneOrLane()->getEdge().getFromJunction()->getInternalLanes()) +// << std::endl; +//#endif myIndex = index; myHasFoes = hasFoes; myAmCont = isCont; @@ -127,7 +110,6 @@ myFoeLanes.push_back(*it_lane); } myJunction = const_cast(myLane->getEdge().getFromJunction()); // junctionGraph is initialized after the whole network is loaded -#ifdef HAVE_INTERNAL_LANES myInternalLaneBefore = internalLaneBefore; MSLane* lane = 0; if (internalLaneBefore != 0) { @@ -139,7 +121,7 @@ // lane = myLane; } #ifdef MSLink_DEBUG_CROSSING_POINTS - std::cout << " link " << myIndex << " to " << getViaLaneOrLane()->getID() << " internalLane=" << (lane == 0 ? "NULL" : lane->getID()) << " has foes: " << toString(foeLanes) << "\n"; + std::cout << " link " << myIndex << " to " << getViaLaneOrLane()->getID() << " internalLaneBefore=" << (lane == 0 ? "NULL" : lane->getID()) << " has foes: " << toString(foeLanes) << "\n"; #endif if (lane != 0) { const bool beforeInternalJunction = lane->getLinkCont()[0]->getViaLaneOrLane()->getEdge().isInternal(); @@ -161,9 +143,9 @@ << "\n"; #endif } else { - std::vector intersections1 = lane->getShape().intersectsAtLengths2D((*it_lane)->getShape()); + std::vector intersections1 = lane->getShape().intersectsAtLengths2D((*it_lane)->getShape()); #ifdef MSLink_DEBUG_CROSSING_POINTS - //std::cout << " intersections1=" << toString(intersections1) << "\n"; +// std::cout << " intersections1=" << toString(intersections1) << "\n"; #endif bool haveIntersection = true; if (intersections1.size() == 0) { @@ -172,7 +154,7 @@ } else if (intersections1.size() > 1) { std::sort(intersections1.begin(), intersections1.end()); } - std::vector intersections2 = (*it_lane)->getShape().intersectsAtLengths2D(lane->getShape()); + std::vector intersections2 = (*it_lane)->getShape().intersectsAtLengths2D(lane->getShape()); #ifdef MSLink_DEBUG_CROSSING_POINTS //std::cout << " intersections2=" << toString(intersections2) << "\n"; #endif @@ -185,7 +167,7 @@ // lane width affects the crossing point intersections1.back() -= (*it_lane)->getWidth() / 2; intersections2.back() -= lane->getWidth() / 2; - // also length/geometry factor + // also length/geometry factor. (XXX: Why subtract width/2 *before* converting geometric position to lane pos?) intersections1.back() = lane->interpolateGeometryPosToLanePos(intersections1.back()); intersections2.back() = (*it_lane)->interpolateGeometryPosToLanePos(intersections2.back()); @@ -220,7 +202,7 @@ for (MSLinkCont::const_iterator it = predLinks.begin(); it != predLinks.end(); ++it) { const MSLane* sibling = (*it)->getViaLane(); if (sibling != lane && sibling != 0) { - std::vector intersections1 = lane->getShape().intersectsAtLengths2D(sibling->getShape()); + std::vector intersections1 = lane->getShape().intersectsAtLengths2D(sibling->getShape()); #ifdef MSLink_DEBUG_CROSSING_POINTS //std::cout << " intersections1=" << toString(intersections1) << "\n"; #endif @@ -243,9 +225,6 @@ } } } -#else - UNUSED_PARAMETER(internalLaneBefore); -#endif if (MSGlobals::gLateralResolution > 0) { // check for links with the same origin lane and the same destination edge const MSEdge* myTarget = &myLane->getEdge(); @@ -260,12 +239,12 @@ } -std::pair +std::pair getLastIntersections(const MSLane* lane, const MSLane* foe); void -MSLink::setApproaching(const SUMOVehicle* approaching, const SUMOTime arrivalTime, const SUMOReal arrivalSpeed, const SUMOReal leaveSpeed, - const bool setRequest, const SUMOTime arrivalTimeBraking, const SUMOReal arrivalSpeedBraking, const SUMOTime waitingTime, SUMOReal dist) { +MSLink::setApproaching(const SUMOVehicle* approaching, const SUMOTime arrivalTime, const double arrivalSpeed, const double leaveSpeed, + const bool setRequest, const SUMOTime arrivalTimeBraking, const double arrivalSpeedBraking, const SUMOTime waitingTime, double dist) { const SUMOTime leaveTime = getLeaveTime(arrivalTime, arrivalSpeed, leaveSpeed, approaching->getVehicleType().getLength()); myApproachingVehicles.insert(std::make_pair(approaching, ApproachingVehicleInformation(arrivalTime, leaveTime, arrivalSpeed, leaveSpeed, setRequest, @@ -309,15 +288,15 @@ SUMOTime -MSLink::getLeaveTime(const SUMOTime arrivalTime, const SUMOReal arrivalSpeed, - const SUMOReal leaveSpeed, const SUMOReal vehicleLength) const { - return arrivalTime + TIME2STEPS((getLength() + vehicleLength) / MAX2((SUMOReal)0.5 * (arrivalSpeed + leaveSpeed), NUMERICAL_EPS)); +MSLink::getLeaveTime(const SUMOTime arrivalTime, const double arrivalSpeed, + const double leaveSpeed, const double vehicleLength) const { + return arrivalTime + TIME2STEPS((getLength() + vehicleLength) / MAX2(0.5 * (arrivalSpeed + leaveSpeed), NUMERICAL_EPS)); } bool -MSLink::opened(SUMOTime arrivalTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, SUMOReal vehicleLength, - SUMOReal impatience, SUMOReal decel, SUMOTime waitingTime, SUMOReal posLat, +MSLink::opened(SUMOTime arrivalTime, double arrivalSpeed, double leaveSpeed, double vehicleLength, + double impatience, double decel, SUMOTime waitingTime, double posLat, std::vector* collectFoes) const { if (haveRed()) { return false; @@ -384,8 +363,8 @@ bool -MSLink::blockedAtTime(SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, - bool sameTargetLane, SUMOReal impatience, SUMOReal decel, SUMOTime waitingTime, +MSLink::blockedAtTime(SUMOTime arrivalTime, SUMOTime leaveTime, double arrivalSpeed, double leaveSpeed, + bool sameTargetLane, double impatience, double decel, SUMOTime waitingTime, std::vector* collectFoes) const { for (std::map::const_iterator i = myApproachingVehicles.begin(); i != myApproachingVehicles.end(); ++i) { if (blockedByFoe(i->first, i->second, arrivalTime, leaveTime, arrivalSpeed, leaveSpeed, sameTargetLane, @@ -402,8 +381,8 @@ bool -MSLink::blockedByFoe(const SUMOVehicle* veh, const ApproachingVehicleInformation& avi, SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, - bool sameTargetLane, SUMOReal impatience, SUMOReal decel, SUMOTime waitingTime) const { +MSLink::blockedByFoe(const SUMOVehicle* veh, const ApproachingVehicleInformation& avi, SUMOTime arrivalTime, SUMOTime leaveTime, double arrivalSpeed, double leaveSpeed, + bool sameTargetLane, double impatience, double decel, SUMOTime waitingTime) const { if (!avi.willPass) { return false; } @@ -443,7 +422,7 @@ bool MSLink::maybeOccupied(MSLane* lane) { MSVehicle* veh = lane->getLastAnyVehicle(); - SUMOReal distLeft = 0; + double distLeft = 0; if (veh == 0) { return false; } else { @@ -457,7 +436,7 @@ bool -MSLink::hasApproachingFoe(SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal speed, SUMOReal decel) const { +MSLink::hasApproachingFoe(SUMOTime arrivalTime, SUMOTime leaveTime, double speed, double decel) const { for (std::vector::const_iterator i = myFoeLinks.begin(); i != myFoeLinks.end(); ++i) { if ((*i)->blockedAtTime(arrivalTime, leaveTime, speed, speed, myLane == (*i)->getLane(), 0, decel, 0)) { return true; @@ -492,37 +471,8 @@ return myLane; } -MSLane* -MSLink::getApproachingLane() const { - MSLane* approachedLane; //the lane approached by this link; this lane may be an internal lane -#ifdef HAVE_INTERNAL_LANES - if (myInternalLane != 0) { // if there is an internal lane - approachedLane = myInternalLane; //consider the internal lane as the approached lane - } else { //if ther is no internal lane - approachedLane = myLane; - } -#else - approachedLane = myLane; -#endif - const std::vector possibleLanes = approachedLane->getIncomingLanes(); - std::vector::const_iterator i; - for (i = possibleLanes.begin(); i != possibleLanes.end(); i++) { - MSLane* lane = (*i).lane; - MSLinkCont outgoingLinks = lane->getLinkCont(); //the links outgoing from lane - for (MSLinkCont::const_iterator j = outgoingLinks.begin(); j != outgoingLinks.end(); j++) { - if ((*j) == this) { - return lane; - } - } - } - WRITE_WARNING("No approaching lane found for the link with the index " + toString(this->getIndex()) + "."); - return 0; -} - - bool MSLink::lastWasContMajor() const { -#ifdef HAVE_INTERNAL_LANES if (myInternalLane == 0 || myAmCont) { return false; } else { @@ -537,9 +487,6 @@ return predLink->havePriority(); } } -#else - return false; -#endif } @@ -548,11 +495,7 @@ if (myApproachingVehicles.size() > 0) { od.openTag("link"); od.writeAttr(SUMO_ATTR_FROM, fromLaneID); -#ifdef HAVE_INTERNAL_LANES const std::string via = getViaLane() == 0 ? "" : getViaLane()->getID(); -#else - const std::string via = ""; -#endif od.writeAttr(SUMO_ATTR_VIA, via); od.writeAttr(SUMO_ATTR_TO, getLane() == 0 ? "" : getLane()->getID()); std::vector > toSort; // stabilize output @@ -579,22 +522,80 @@ } -SUMOReal +double MSLink::getInternalLengthsAfter() const { - SUMOReal len = 0.; -#ifdef HAVE_INTERNAL_LANES + double len = 0.; MSLane* lane = myInternalLane; - while (lane != 0 && lane->getEdge().getPurpose() == MSEdge::EDGEFUNCTION_INTERNAL) { + while (lane != 0 && lane->isInternal()) { len += lane->getLength(); lane = lane->getLinkCont()[0]->getViaLane(); } -#endif return len; } -#ifdef HAVE_INTERNAL_LANES +double +MSLink::getLengthBeforeCrossing(const MSLink* foeEntryLink) const { + // to be called for entry links + assert(foeEntryLink->getInternalLaneBefore() == 0); + + // TODO: Understand myLengthsBehindCrossing and extract relevant information -> take a look at getLeaderInfo()! + // -> myLengthsBehindCrossing does not treat lanes behind internal junctions, these should be extracted from the internal lane of that junction?! + + // first internal lane for foe after entering the junction + const MSLane* foeEntryLane = foeEntryLink->getViaLane(); + assert(foeEntryLane != 0); + + // first internal lane for ego after entering the junction + const MSLane* egoEntryLane = getViaLane(); + assert(egoEntryLane != 0); + + int foe_ix = 0; + double res = INVALID_DOUBLE; + for (std::vector::const_iterator i = myFoeLanes.begin(); i != myFoeLanes.end(); ++i) { + if (*i == foeEntryLane) { + // Found foe lane index + // note: myLengthsBehindcrossing is the length behind the foe lane's border, not its center + // (therefore the term -foeEntryLane->getWidth()/2.) + // XXX: recheck definition of myLengthsBehindCrossing in setRequestInformation(), especially order of position scaling and subtracting the lane width/2 + res = egoEntryLane->getLength() - myLengthsBehindCrossing[foe_ix].first - foeEntryLane->getWidth() / 2.; + break; + } + ++foe_ix; + } + + +#ifdef MSLink_DEBUG_CROSSING_POINTS + std::cout << "getLengthBeforeCrossing() for link " << toString(getLaneBefore()) << "->" << toString(getViaLane()) + << " and foeLink " << toString(foeEntryLink->getLaneBefore()) << "->" << toString(foeEntryLink->getViaLane()) + << "\nLength on toString(getLaneBefore()) before crossing = " << res + << std::endl; +#endif + + if (foe_ix == (int)myFoeLanes.size() && egoEntryLane->getLinkCont().size() > 0) { + // Did not find crossing for first egoLane. Check internal cont lanes + assert(egoEntryLane->getLinkCont().size() == 1); + MSLink* contLink = egoEntryLane->getLinkCont()[0]; + MSLane* contLane = contLink->getViaLane(); + if (contLane != 0) { + // Yes, there is another internal lane after the entry lane + // Assert, there are no more internal lanes than two along the conection (in case the code should be modified) + assert(contLane->getLinkCont().size() == 0 + || (contLane->getLinkCont().size() == 1 && contLane->getLinkCont()[0]->getViaLane() == 0)); +#ifdef MSLink_DEBUG_CROSSING_POINTS + std::cout << "No crossing with entryLane.\nChecking crossing of contLane '" << contLane->getID() + << "' with '" << toString(foeEntryLink->getLaneBefore()) << "'" + << std::endl; +#endif + // TODO: really check for crossing as above + } + } + + return res; +} + + MSLane* MSLink::getViaLane() const { return myInternalLane; @@ -619,8 +620,12 @@ } MSLink::LinkLeaders -MSLink::getLeaderInfo(SUMOReal dist, SUMOReal minGap, std::vector* collectBlockers) const { +MSLink::getLeaderInfo(const MSVehicle* ego, double dist, std::vector* collectBlockers) const { LinkLeaders result; + if (ego->getLaneChangeModel().isOpposite()) { + // ignore link leaders + return result; + } //gDebugFlag1 = true; // this link needs to start at an internal lane (either an exit link or between two internal lanes) if (fromInternalLane()) { @@ -629,18 +634,18 @@ for (int i = 0; i < (int)myFoeLanes.size(); ++i) { const MSLane* foeLane = myFoeLanes[i]; // distance from the querying vehicle to the crossing point with foeLane - const SUMOReal distToCrossing = dist - myLengthsBehindCrossing[i].first; + const double distToCrossing = dist - myLengthsBehindCrossing[i].first; const bool sameTarget = (myLane == foeLane->getLinkCont()[0]->getLane()); const bool sameSource = (myInternalLaneBefore != 0 && myInternalLaneBefore->getLogicalPredecessorLane() == foeLane->getLogicalPredecessorLane()); - const SUMOReal crossingWidth = (sameTarget || sameSource) ? 0 : foeLane->getWidth(); - const SUMOReal foeCrossingWidth = (sameTarget || sameSource) ? 0 : myInternalLaneBefore->getWidth(); + const double crossingWidth = (sameTarget || sameSource) ? 0 : foeLane->getWidth(); + const double foeCrossingWidth = (sameTarget || sameSource) ? 0 : myInternalLaneBefore->getWidth(); if (gDebugFlag1) { std::cout << " distToCrossing=" << distToCrossing << " foeLane=" << foeLane->getID() << "\n"; } if (distToCrossing + crossingWidth < 0) { continue; // vehicle is behind the crossing point, continue with next foe lane } - const SUMOReal foeDistToCrossing = foeLane->getLength() - myLengthsBehindCrossing[i].second; + const double foeDistToCrossing = foeLane->getLength() - myLengthsBehindCrossing[i].second; // it is not sufficient to return the last vehicle on the foeLane because ego might be its leader // therefore we return all vehicles on the lane // @@ -652,18 +657,26 @@ MSLane::AnyVehicleIterator end = foeLane->anyVehiclesEnd(); for (MSLane::AnyVehicleIterator it_veh = foeLane->anyVehiclesBegin(); it_veh != end; ++it_veh) { MSVehicle* leader = (MSVehicle*)*it_veh; - if (!cannotIgnore && !foeLane->getLinkCont()[0]->getApproaching(leader).willPass && leader->isFrontOnLane(foeLane)) { + const bool isOpposite = leader->getLaneChangeModel().isOpposite(); + if (gDebugFlag1) { + std::cout << " candiate leader=" << leader->getID() + << " cannotIgnore=" << cannotIgnore + << " willPass=" << foeLane->getLinkCont()[0]->getApproaching(leader).willPass + << " isFrontOnLane=" << leader->isFrontOnLane(foeLane) + << " isOpposite=" << isOpposite << "\n"; + } + if (!cannotIgnore && !foeLane->getLinkCont()[0]->getApproaching(leader).willPass && leader->isFrontOnLane(foeLane) && !isOpposite) { continue; } if (cannotIgnore || leader->getWaitingTime() < MSGlobals::gIgnoreJunctionBlocker) { // compute distance between vehicles on the the superimposition of both lanes // where the crossing point is the common point - SUMOReal gap; - if (contLane && !sameSource) { - gap = -1; // always break for vehicles which are on a continuation lane + double gap; + if ((contLane && !sameSource) || isOpposite) { + gap = -1; // always break for vehicles which are on a continuation lane or for opposite-direction vehicles } else { - const SUMOReal leaderBack = leader->getBackPositionOnLane(foeLane); - const SUMOReal leaderBackDist = foeDistToCrossing - leaderBack; + const double leaderBack = leader->getBackPositionOnLane(foeLane); + const double leaderBackDist = foeDistToCrossing - leaderBack; if (gDebugFlag1) { std::cout << " distToCrossing=" << distToCrossing << " leader back=" << leaderBack << " backDist=" << leaderBackDist << "\n"; } @@ -672,7 +685,7 @@ // or there is no crossing point continue; // next vehicle } - gap = distToCrossing - leaderBackDist - (sameTarget ? minGap : 0); + gap = distToCrossing - leaderBackDist - (sameTarget ? ego->getVehicleType().getMinGap() : 0); } if (gDebugFlag1) { std::cout << " leader=" << leader->getID() << " contLane=" << contLane << " cannotIgnore=" << cannotIgnore << "\n"; @@ -685,7 +698,7 @@ } // check for crossing pedestrians (keep driving if already on top of the crossing - const SUMOReal distToPeds = distToCrossing - MSPModel::SAFETY_GAP; + const double distToPeds = distToCrossing - MSPModel::SAFETY_GAP; if (distToPeds >= -MSPModel::SAFETY_GAP && MSPModel::getModel()->blockedAtDist(foeLane, foeDistToCrossing, collectBlockers)) { result.push_back(LinkLeader((MSVehicle*)0, -1, distToPeds)); } @@ -693,30 +706,24 @@ } return result; } -#endif MSLane* MSLink::getViaLaneOrLane() const { -#ifdef HAVE_INTERNAL_LANES if (myInternalLane != 0) { return myInternalLane; } -#endif return myLane; } const MSLane* MSLink::getLaneBefore() const { -#ifdef HAVE_INTERNAL_LANES - // XXX this branch is superfluous if (myInternalLaneBefore != 0) { if (myLaneBefore != myInternalLaneBefore) { throw ProcessError("lane before mismatch!"); } } -#endif return myLaneBefore; } @@ -754,7 +761,7 @@ bool -MSLink::isLeader(const MSVehicle* ego, const MSVehicle* foe) { +MSLink::isLeader(const MSVehicle* ego, const MSVehicle* foe) const { if (myJunction != 0) { return myJunction->isLeader(ego, foe); } else { @@ -765,16 +772,12 @@ const MSLane* MSLink::getInternalLaneBefore() const { -#ifdef HAVE_INTERNAL_LANES return myInternalLaneBefore; -#else - return 0; -#endif } -SUMOReal -MSLink::getZipperSpeed(const MSVehicle* ego, const SUMOReal dist, SUMOReal vSafe, +double +MSLink::getZipperSpeed(const MSVehicle* ego, const double dist, double vSafe, SUMOTime arrivalTime, std::vector* collectFoes) const { //gDebugFlag1 = ego->getID() == "left.7"; @@ -787,7 +790,7 @@ + myJunction->getID() + "')"); } const SUMOTime now = MSNet::getInstance()->getCurrentTimeStep(); - const SUMOReal secondsToArrival = STEPS2TIME(arrivalTime - now); + const double secondsToArrival = STEPS2TIME(arrivalTime - now); if (secondsToArrival > ZIPPER_ADAPT_TIME && dist > ZIPPER_ADAPT_DIST) { //if (gDebugFlag1) std::cout << SIMTIME << " getZipperSpeed ego=" << ego->getID() // << " dist=" << dist @@ -801,7 +804,7 @@ // << " numFoes=" << collectFoes->size() // << "\n"; MSLink* foeLink = myFoeLinks[0]; - const SUMOReal vSafeOrig = vSafe; + const double vSafeOrig = vSafe; for (std::vector::const_iterator i = collectFoes->begin(); i != collectFoes->end(); ++i) { const MSVehicle* foe = dynamic_cast(*i); assert(foe != 0); @@ -823,11 +826,11 @@ // << "\n"; continue; } - const SUMOReal gap = dist - foe->getVehicleType().getLength() - ego->getVehicleType().getMinGap() - avi.dist; - const SUMOReal follow = ego->getCarFollowModel().followSpeed( - ego, ego->getSpeed(), gap, foe->getSpeed(), foe->getCarFollowModel().getMaxDecel()); + const double gap = dist - foe->getVehicleType().getLength() - ego->getVehicleType().getMinGap() - avi.dist; + const double follow = ego->getCarFollowModel().followSpeed( + ego, ego->getSpeed(), gap, foe->getSpeed(), foe->getCarFollowModel().getMaxDecel()); // speed adaption to follow the foe can be spread over secondsToArrival - const SUMOReal followInTime = vSafeOrig + (follow - vSafeOrig) / MAX2((SUMOReal)1, secondsToArrival / TS); + const double followInTime = vSafeOrig + (follow - vSafeOrig) / MAX2((double)1, secondsToArrival / TS); vSafe = MIN2(vSafe, followInTime); //if (gDebugFlag1) std::cout << " adapting to foe=" << foe->getID() // << " foeDist=" << avi.dist @@ -847,7 +850,7 @@ bool -MSLink::couldBrakeForLeader(SUMOReal followDist, SUMOReal leaderDist, const MSVehicle* follow, const MSVehicle* leader) { +MSLink::couldBrakeForLeader(double followDist, double leaderDist, const MSVehicle* follow, const MSVehicle* leader) { return (// leader is ahead of follower followDist > leaderDist && // and follower could brake for 1 s to stay behind leader diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLink.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLink.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLink.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLink.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: MSLink.h 21706 2016-10-17 08:19:38Z luecken $ +/// @version $Id: MSLink.h 24108 2017-04-27 18:43:30Z behrisch $ /// // A connnection between lanes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -78,15 +78,15 @@ public: // distance to link in m below which adaptation for zipper-merging should take place - static const SUMOReal ZIPPER_ADAPT_DIST; + static const double ZIPPER_ADAPT_DIST; struct LinkLeader { - LinkLeader(MSVehicle* _veh, SUMOReal _gap, SUMOReal _distToCrossing) : + LinkLeader(MSVehicle* _veh, double _gap, double _distToCrossing) : vehAndGap(std::make_pair(_veh, _gap)), distToCrossing(_distToCrossing) {} - std::pair vehAndGap; - SUMOReal distToCrossing; + std::pair vehAndGap; + double distToCrossing; }; typedef std::vector LinkLeaders; @@ -101,12 +101,12 @@ * calls to opened() causing order dependencies **/ ApproachingVehicleInformation(const SUMOTime _arrivalTime, const SUMOTime _leavingTime, - const SUMOReal _arrivalSpeed, const SUMOReal _leaveSpeed, + const double _arrivalSpeed, const double _leaveSpeed, const bool _willPass, const SUMOTime _arrivalTimeBraking, - const SUMOReal _arrivalSpeedBraking, + const double _arrivalSpeedBraking, const SUMOTime _waitingTime, - const SUMOReal _dist + const double _dist ) : arrivalTime(_arrivalTime), leavingTime(_leavingTime), arrivalSpeed(_arrivalSpeed), leaveSpeed(_leaveSpeed), @@ -122,19 +122,19 @@ /// @brief The estimated time at which the vehicle leaves the link const SUMOTime leavingTime; /// @brief The estimated speed with which the vehicle arrives at the link (for headway computation) - const SUMOReal arrivalSpeed; + const double arrivalSpeed; /// @brief The estimated speed with which the vehicle leaves the link (for headway computation) - const SUMOReal leaveSpeed; + const double leaveSpeed; /// @brief Whether the vehicle wants to pass the link (@todo: check semantics) const bool willPass; /// @brief The time the vehicle's front arrives at the link if it starts braking const SUMOTime arrivalTimeBraking; /// @brief The estimated speed with which the vehicle arrives at the link if it starts braking(for headway computation) - const SUMOReal arrivalSpeedBraking; + const double arrivalSpeedBraking; /// @brief The waiting duration at the current link const SUMOTime waitingTime; /// @brief The distance up to the current link - const SUMOReal dist; + const double dist; private: /// invalidated assignment operator @@ -143,17 +143,6 @@ }; -#ifndef HAVE_INTERNAL_LANES - /** @brief Constructor for simulation not using internal lanes - * - * @param[in] succLane The lane approached by this link - * @param[in] dir The direction of this link - * @param[in] state The state of this link - * @param[in] length The length of this link - * @param[in] keepClear Whether the junction after this link must be kept clear - */ - MSLink(MSLane* predLane, MSLane* succLane, LinkDirection dir, LinkState state, SUMOReal length, SUMOReal foeVisibilityDistance, bool keepClear, MSTrafficLightLogic* logic, int tlLinkIdx); -#else /** @brief Constructor for simulation which uses internal lanes * * @param[in] succLane The lane approached by this link @@ -162,8 +151,7 @@ * @param[in] state The state of this link * @param[in] length The length of this link */ - MSLink(MSLane* predLane, MSLane* succLane, MSLane* via, LinkDirection dir, LinkState state, SUMOReal length, SUMOReal foeVisibilityDistance, bool keepClear, MSTrafficLightLogic* logic, int tlLinkIdx); -#endif + MSLink(MSLane* predLane, MSLane* succLane, MSLane* via, LinkDirection dir, LinkState state, double length, double foeVisibilityDistance, bool keepClear, MSTrafficLightLogic* logic, int tlLinkIdx); /// @brief Destructor @@ -187,9 +175,9 @@ * The information is stored in myApproachingVehicles. */ void setApproaching(const SUMOVehicle* approaching, const SUMOTime arrivalTime, - const SUMOReal arrivalSpeed, const SUMOReal leaveSpeed, const bool setRequest, - const SUMOTime arrivalTimeBraking, const SUMOReal arrivalSpeedBraking, - const SUMOTime waitingTime, SUMOReal dist); + const double arrivalSpeed, const double leaveSpeed, const bool setRequest, + const SUMOTime arrivalTimeBraking, const double arrivalSpeedBraking, + const SUMOTime waitingTime, double dist); /// @brief removes the vehicle from myApproachingVehicles void removeApproaching(const SUMOVehicle* veh); @@ -213,9 +201,9 @@ * @param[in] collectFoes If a vector is passed, all blocking foes are collected and inserted into this vector * @return Whether this link may be passed. */ - bool opened(SUMOTime arrivalTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, SUMOReal vehicleLength, - SUMOReal impatience, SUMOReal decel, SUMOTime waitingTime, - SUMOReal posLat = 0, + bool opened(SUMOTime arrivalTime, double arrivalSpeed, double leaveSpeed, double vehicleLength, + double impatience, double decel, SUMOTime waitingTime, + double posLat = 0, std::vector* collectFoes = 0) const; /** @brief Returns the information whether this link is blocked @@ -232,8 +220,8 @@ * @return Whether this link is blocked * @note Since this needs to be called without a SUMOVehicle (TraCI), we cannot simply pass the checking vehicle itself **/ - bool blockedAtTime(SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, - bool sameTargetLane, SUMOReal impatience, SUMOReal decel, SUMOTime waitingTime, + bool blockedAtTime(SUMOTime arrivalTime, SUMOTime leaveTime, double arrivalSpeed, double leaveSpeed, + bool sameTargetLane, double impatience, double decel, SUMOTime waitingTime, std::vector* collectFoes = 0) const; @@ -254,7 +242,7 @@ * @param[in] decel The maximum deceleration of the checking vehicle * @return Whether a foe of this link is approaching */ - bool hasApproachingFoe(SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal speed, SUMOReal decel) const; + bool hasApproachingFoe(SUMOTime arrivalTime, SUMOTime leaveTime, double speed, double decel) const; MSJunction* getJunction() const { return myJunction; @@ -298,13 +286,6 @@ MSLane* getLane() const; - /** @brief Returns the lane leading to this link - * - * @return The lane leading to this link - */ - MSLane* getApproachingLane() const; - - /** @brief Returns the respond index (for visualization) * * @return The respond index for this link @@ -345,7 +326,7 @@ * * @return The length of this link */ - SUMOReal getLength() const { + double getLength() const { return myLength; } @@ -356,7 +337,7 @@ * * @return The foe-visibility-distance */ - SUMOReal getFoeVisibilityDistance() const { + double getFoeVisibilityDistance() const { return myFoeVisibilityDistance; } @@ -386,9 +367,13 @@ /** @brief Returns the cumulative length of all internal lanes after this link * @return sum of the lengths of all internal lanes following this link */ - SUMOReal getInternalLengthsAfter() const; + double getInternalLengthsAfter() const; + + /** @brief Returns the complete internal lengths from the link until the crossing point with the given foe link's lane + * The crossing point is the intersection of the lane's central reference lines. + */ + double getLengthBeforeCrossing(const MSLink* foeEntryLink) const; -#ifdef HAVE_INTERNAL_LANES /** @brief Returns the following inner lane * * @return The inner lane to use to cross the junction @@ -397,18 +382,17 @@ /** @brief Returns all potential link leaders (vehicles on foeLanes) * Valid during the planMove() phase + * @param[in] ego The ego vehicle that is looking for leaders * @param[in] dist The distance of the vehicle who is asking about the leader to this link - * @param[in] minGap The minGap of the vehicle who is asking about the leader to this link * @param[out] blocking Return blocking pedestrians if a vector is given * @return The all vehicles on foeLanes and their (virtual) distances to the asking vehicle */ - LinkLeaders getLeaderInfo(SUMOReal dist, SUMOReal minGap, std::vector* collectBlockers = 0) const; -#endif + LinkLeaders getLeaderInfo(const MSVehicle* ego, double dist, std::vector* collectBlockers = 0) const; /// @brief return the speed at which ego vehicle must approach the zipper link - SUMOReal getZipperSpeed(const MSVehicle* ego, const SUMOReal dist, SUMOReal vSafe, - SUMOTime arrivalTime, - std::vector* collectFoes) const; + double getZipperSpeed(const MSVehicle* ego, const double dist, double vSafe, + SUMOTime arrivalTime, + std::vector* collectFoes) const; /// @brief return the via lane if it exists and the lane otherwise MSLane* getViaLaneOrLane() const; @@ -420,7 +404,7 @@ const MSLane* getInternalLaneBefore() const; /// @brief return the expected time at which the given vehicle will clear the link - SUMOTime getLeaveTime(const SUMOTime arrivalTime, const SUMOReal arrivalSpeed, const SUMOReal leaveSpeed, const SUMOReal vehicleLength) const; + SUMOTime getLeaveTime(const SUMOTime arrivalTime, const double arrivalSpeed, const double leaveSpeed, const double vehicleLength) const; /// @brief write information about all approaching vehicles to the given output device void writeApproaching(OutputDevice& od, const std::string fromLaneID) const; @@ -432,7 +416,7 @@ MSLink* getParallelLink(int direction) const; //// @brief @return whether the foe vehicle is a leader for ego - bool isLeader(const MSVehicle* ego, const MSVehicle* foe); + bool isLeader(const MSVehicle* ego, const MSVehicle* foe) const; /// @brief return whether the fromLane of this link is an internal lane bool fromInternalLane() const; @@ -448,21 +432,35 @@ return myMesoTLSPenalty; } + /** @brief Returns the average proportion of green time to cycle time */ + double getGreenFraction() const { + return myGreenFraction; + } + /** @brief Sets the time penalty for passing a tls-controlled link (meso) */ void setMesoTLSPenalty(const SUMOTime penalty) { myMesoTLSPenalty = penalty; } + /** @brief Sets the green fraction for passing a tls-controlled link (meso) */ + void setGreenFraction(const double fraction) { + myGreenFraction = fraction; + } + const std::vector& getFoeLanes() { return myFoeLanes; } + const std::vector& getFoeLinks() { + return myFoeLinks; + } + /// @brief initialize parallel links (to be called after all links are loaded) void initParallelLinks(); private: /// @brief return whether the given vehicles may NOT merge safely - static inline bool unsafeMergeSpeeds(SUMOReal leaderSpeed, SUMOReal followerSpeed, SUMOReal leaderDecel, SUMOReal followerDecel) { + static inline bool unsafeMergeSpeeds(double leaderSpeed, double followerSpeed, double leaderDecel, double followerDecel) { // XXX mismatch between continuous an discrete deceleration return (leaderSpeed * leaderSpeed / leaderDecel) <= (followerSpeed * followerSpeed / followerDecel); } @@ -471,12 +469,12 @@ static bool maybeOccupied(MSLane* lane); /// @brief whether fllower could stay behind leader (possibly by braking) - static bool couldBrakeForLeader(SUMOReal followDist, SUMOReal leaderDist, const MSVehicle* follow, const MSVehicle* leader); + static bool couldBrakeForLeader(double followDist, double leaderDist, const MSVehicle* follow, const MSVehicle* leader); MSLink* computeParallelLink(int direction); - bool blockedByFoe(const SUMOVehicle* veh, const ApproachingVehicleInformation& avi, SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, - bool sameTargetLane, SUMOReal impatience, SUMOReal decel, SUMOTime waitingTime) const; + bool blockedByFoe(const SUMOVehicle* veh, const ApproachingVehicleInformation& avi, SUMOTime arrivalTime, SUMOTime leaveTime, double arrivalSpeed, double leaveSpeed, + bool sameTargetLane, double impatience, double decel, SUMOTime waitingTime) const; private: /// @brief The lane behind the junction approached by this link @@ -507,7 +505,12 @@ LinkDirection myDirection; /// @brief The length of the link - SUMOReal myLength; + double myLength; + + /// @brief distance from which an approaching vehicle is able to + /// see all relevant foes and may accelerate if the link is minor + /// and no foe is approaching. Defaults to 4.5m. + double myFoeVisibilityDistance; /// @brief Whether any foe links exist bool myHasFoes; @@ -517,30 +520,28 @@ bool myKeepClear; - /// @brief distance from which an approaching vehicle is able to - /// see all relevant foes and may accelerate if the link is minor - /// and no foe is approaching. Defaults to 4.5m. - SUMOReal myFoeVisibilityDistance; - - /// @brief penalty time for mesoscopic simulation - SUMOTime myMesoTLSPenalty; - -#ifdef HAVE_INTERNAL_LANES /// @brief The following junction-internal lane if used MSLane* const myInternalLane; - /// @brief The preceding junction-internal lane if used - // XXX obsolete as this is identical with myLaneBefore + /* @brief The preceding junction-internal lane, only used at + * - exit links (from internal lane to normal lane) + * - internal junction links (from internal lane to internal lane) + */ const MSLane* myInternalLaneBefore; + /// @brief penalty time at tls for mesoscopic simulation + SUMOTime myMesoTLSPenalty; + /// @brief green fraction at tls for mesoscopic simulation + double myGreenFraction; + /* @brief lengths after the crossing point with foeLane * (lengthOnThis, lengthOnFoe) * (index corresponds to myFoeLanes) * empty vector for entry links * */ - std::vector > myLengthsBehindCrossing; -#endif + std::vector > myLengthsBehindCrossing; + // TODO: documentation std::vector myFoeLinks; std::vector myFoeLanes; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLogicJunction.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLogicJunction.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLogicJunction.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLogicJunction.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Wed, 12 Dez 2001 -/// @version $Id: MSLogicJunction.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSLogicJunction.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // with one ore more logics. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,10 +34,6 @@ #include "MSLogicJunction.h" #include "MSLane.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions @@ -50,16 +46,12 @@ const Position& position, const PositionVector& shape, std::vector incoming -#ifdef HAVE_INTERNAL_LANES , std::vector internal -#endif ): MSJunction(id, type, position, shape), - myIncomingLanes(incoming) -#ifdef HAVE_INTERNAL_LANES - , myInternalLanes(internal) -#endif -{} + myIncomingLanes(incoming), + myInternalLanes(internal) { +} MSLogicJunction::~MSLogicJunction() {} @@ -84,7 +76,6 @@ requestPos++; } } - #ifdef HAVE_INTERNAL_LANES // set information for the internal lanes requestPos = 0; for(i=myInternalLanes.begin(); i!=myInternalLanes.end(); ++i) { @@ -92,7 +83,6 @@ static_cast(*i)->setParentJunctionInformation( &myInnerState, requestPos++); } - #endif */ } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLogicJunction.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLogicJunction.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSLogicJunction.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSLogicJunction.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Wed, 12 Dez 2001 -/// @version $Id: MSLogicJunction.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSLogicJunction.h 24108 2017-04-27 18:43:30Z behrisch $ /// // with one ore more logics. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -68,6 +68,12 @@ /// initialises the junction after the whole net has been loaded virtual void postloadInit(); + /** @brief Returns all internal lanes on the junction + */ + virtual const std::vector& getInternalLanes() const { + return myInternalLanes; + } + protected: /** @brief Constructor * @param[in] id The id of the junction @@ -81,20 +87,16 @@ SumoXMLNodeType type, const Position& position, const PositionVector& shape, - std::vector incoming -#ifdef HAVE_INTERNAL_LANES - , std::vector internal -#endif + std::vector incoming, + std::vector internal ); protected: /// list of incoming lanes std::vector myIncomingLanes; -#ifdef HAVE_INTERNAL_LANES - /// list of incoming lanes + /// list of internal lanes std::vector myInternalLanes; -#endif private: /// @brief Invalidated copy constructor. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSMoveReminder.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSMoveReminder.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSMoveReminder.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSMoveReminder.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 2008-10-27 -/// @version $Id: MSMoveReminder.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSMoveReminder.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // Something on a lane to be noticed about vehicle movement /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,7 +48,7 @@ void -MSMoveReminder::updateDetector(SUMOVehicle& veh, SUMOReal entryPos, SUMOReal leavePos, +MSMoveReminder::updateDetector(SUMOVehicle& veh, double entryPos, double leavePos, SUMOTime entryTime, SUMOTime currentTime, SUMOTime leaveTime, bool cleanUp) { // each vehicle is tracked linearly across its segment. For each vehicle, @@ -57,7 +57,7 @@ if (entryTime > currentTime) { return; // calibrator may insert vehicles a tiny bit into the future; ignore those } - std::map >::iterator j = myLastVehicleUpdateValues.find(&veh); + std::map >::iterator j = myLastVehicleUpdateValues.find(&veh); if (j != myLastVehicleUpdateValues.end()) { // the vehicle already has reported its values before; use these // however, if this was called from prepareDetectorForWriting the time @@ -70,9 +70,9 @@ } assert(entryTime <= currentTime); if ((entryTime < leaveTime) && (entryPos < leavePos)) { - const SUMOReal timeOnLane = STEPS2TIME(currentTime - entryTime); - const SUMOReal speed = (leavePos - entryPos) / STEPS2TIME(leaveTime - entryTime); - myLastVehicleUpdateValues[&veh] = std::pair(currentTime, entryPos + speed * timeOnLane); + const double timeOnLane = STEPS2TIME(currentTime - entryTime); + const double speed = (leavePos - entryPos) / STEPS2TIME(leaveTime - entryTime); + myLastVehicleUpdateValues[&veh] = std::pair(currentTime, entryPos + speed * timeOnLane); assert(timeOnLane >= 0); assert(speed >= 0); notifyMoveInternal(veh, timeOnLane, timeOnLane, speed, speed, speed * timeOnLane, speed * timeOnLane); @@ -81,7 +81,7 @@ // assert(entryTime == leaveTime); // assert(entryPos == leavePos); // However, in the presence of calibrators, vehicles may jump a bit - myLastVehicleUpdateValues[&veh] = std::pair(leaveTime, leavePos); + myLastVehicleUpdateValues[&veh] = std::pair(leaveTime, leavePos); } if (cleanUp) { // clean up after the vehicle has left the area of this reminder diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSMoveReminder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSMoveReminder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSMoveReminder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSMoveReminder.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 2003-05-21 -/// @version $Id: MSMoveReminder.h 21652 2016-10-10 13:30:25Z luecken $ +/// @version $Id: MSMoveReminder.h 23195 2017-03-02 12:53:47Z luecken $ /// // Something on a lane to be noticed about vehicle movement /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2003-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2003-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,6 +34,7 @@ #include #endif +#include #include #include #include @@ -84,7 +85,7 @@ /** @brief Returns the lane the reminder works on. * - * @return The lane the reminder works on. + * @return The lane the reminder is anchored on. */ const MSLane* getLane() const { return myLane; @@ -99,8 +100,10 @@ NOTIFICATION_JUNCTION, /// @brief The vehicle changes the segment (meso only) NOTIFICATION_SEGMENT, - /// @brief The vehicle changes lanes (micro only) XXX: What if a vehicle changes lanes and passes a junction simultaneously? + /// @brief The vehicle changes lanes (micro only) NOTIFICATION_LANE_CHANGE, + /* All notifications below must result in the vehicle not being on the net + * (onLeaveLane sets amOnNet=false if reason>=NOTIFICATION_TELEPORT) */ /// @brief The vehicle is being teleported NOTIFICATION_TELEPORT, /// @brief The vehicle starts or ends parking @@ -110,7 +113,9 @@ /// @brief The vehicle got vaporized NOTIFICATION_VAPORIZED, /// @brief The vehicle was teleported out of the net - NOTIFICATION_TELEPORT_ARRIVED + NOTIFICATION_TELEPORT_ARRIVED, + /// @brief The vehicle needs another parking area + NOTIFICATION_PARKING_REROUTE }; @@ -127,9 +132,10 @@ * @return True if vehicle enters the reminder. * @see Notification */ - virtual bool notifyEnter(SUMOVehicle& veh, Notification reason) { + virtual bool notifyEnter(SUMOVehicle& veh, Notification reason, const MSLane* enteredLane) { UNUSED_PARAMETER(reason); UNUSED_PARAMETER(&veh); + UNUSED_PARAMETER(&enteredLane); return true; } @@ -148,9 +154,9 @@ * @return True if vehicle hasn't passed the reminder completely. */ virtual bool notifyMove(SUMOVehicle& veh, - SUMOReal oldPos, - SUMOReal newPos, - SUMOReal newSpeed) { + double oldPos, + double newPos, + double newSpeed) { UNUSED_PARAMETER(oldPos); UNUSED_PARAMETER(newPos); UNUSED_PARAMETER(newSpeed); @@ -172,17 +178,17 @@ * * @return True if the reminder wants to receive further info. */ - virtual bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, - Notification reason) { - UNUSED_PARAMETER(reason); - UNUSED_PARAMETER(lastPos); + virtual bool notifyLeave(SUMOVehicle& veh, double lastPos, Notification reason, const MSLane* enteredLane = 0) { UNUSED_PARAMETER(&veh); + UNUSED_PARAMETER(lastPos); + UNUSED_PARAMETER(reason); + UNUSED_PARAMETER(enteredLane); return true; } // TODO: Documentation - void updateDetector(SUMOVehicle& veh, SUMOReal entryPos, SUMOReal leavePos, + void updateDetector(SUMOVehicle& veh, double entryPos, double leavePos, SUMOTime entryTime, SUMOTime currentTime, SUMOTime leaveTime, bool cleanUp); @@ -203,12 +209,12 @@ * @param[in] travelledDistanceVehicleOnLane distance travelled while front was on the lane. */ virtual void notifyMoveInternal(const SUMOVehicle& veh, - const SUMOReal frontOnLane, - const SUMOReal timeOnLane, - const SUMOReal meanSpeedFrontOnLane, - const SUMOReal meanSpeedVehicleOnLane, - const SUMOReal travelledDistanceFrontOnLane, - const SUMOReal travelledDistanceVehicleOnLane) { + const double frontOnLane, + const double timeOnLane, + const double meanSpeedFrontOnLane, + const double meanSpeedVehicleOnLane, + const double travelledDistanceFrontOnLane, + const double travelledDistanceVehicleOnLane) { UNUSED_PARAMETER(travelledDistanceFrontOnLane); UNUSED_PARAMETER(travelledDistanceVehicleOnLane); UNUSED_PARAMETER(meanSpeedVehicleOnLane); @@ -237,7 +243,7 @@ std::string myDescription; private: - std::map > myLastVehicleUpdateValues; + std::map > myLastVehicleUpdateValues; private: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSNet.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSNet.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSNet.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSNet.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -10,12 +10,12 @@ /// @author Mario Krumnow /// @author Christoph Sommer /// @date Tue, 06 Mar 2001 -/// @version $Id: MSNet.cpp 21198 2016-07-19 11:34:56Z namdre $ +/// @version $Id: MSNet.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The simulated network and simulation perfomer /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,71 +44,71 @@ #include #include #include -#include -#include "MSNet.h" -#include "MSTransportableControl.h" -#include "MSEdgeControl.h" -#include "MSJunctionControl.h" -#include "MSInsertionControl.h" -#include "MSEventControl.h" -#include "MSEdge.h" -#include "MSJunction.h" -#include "MSJunctionLogic.h" -#include "MSLane.h" -#include "MSVehicleTransfer.h" -#include "MSRoute.h" -#include + #include "trigger/MSTrigger.h" #include "trigger/MSCalibrator.h" #include "traffic_lights/MSTLLogicControl.h" #include "MSVehicleControl.h" #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include #include #include #include #include #include -#include "traffic_lights/MSTrafficLightLogic.h" -#include -#include - -#include -#include "output/MSFCDExport.h" -#include "output/MSEmissionExport.h" - -#include "output/MSBatteryExport.h" - -#include "output/MSFullExport.h" -#include "output/MSQueueExport.h" -#include "output/MSVTKExport.h" -#include "output/MSXMLRawOut.h" -#include "output/MSAmitranTrajectories.h" -#include -#include -#include -#include -#include -#include "MSGlobals.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include #include +#include + +#include "MSTransportableControl.h" +#include "MSEdgeControl.h" +#include "MSJunctionControl.h" +#include "MSInsertionControl.h" +#include "MSEventControl.h" +#include "MSEdge.h" +#include "MSJunction.h" +#include "MSJunctionLogic.h" +#include "MSLane.h" +#include "MSVehicleTransfer.h" +#include "MSRoute.h" +#include "MSGlobals.h" #include "MSContainer.h" #include "MSEdgeWeightsStorage.h" #include "MSStateHandler.h" - -#include +#include "MSFrame.h" +#include "MSNet.h" #ifndef NO_TRACI #include +#include #endif -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions @@ -121,11 +121,11 @@ const std::string MSNet::STAGE_INSERTIONS("insertion"); // =========================================================================== -// member method definitions +// static member method definitions // =========================================================================== -SUMOReal -MSNet::getEffort(const MSEdge* const e, const SUMOVehicle* const v, SUMOReal t) { - SUMOReal value; +double +MSNet::getEffort(const MSEdge* const e, const SUMOVehicle* const v, double t) { + double value; const MSVehicle* const veh = dynamic_cast(v); if (veh != 0 && veh->getWeightsStorage().retrieveExistingEffort(e, t, value)) { return value; @@ -137,9 +137,9 @@ } -SUMOReal -MSNet::getTravelTime(const MSEdge* const e, const SUMOVehicle* const v, SUMOReal t) { - SUMOReal value; +double +MSNet::getTravelTime(const MSEdge* const e, const SUMOVehicle* const v, double t) { + double value; const MSVehicle* const veh = dynamic_cast(v); if (veh != 0 && veh->getWeightsStorage().retrieveExistingTravelTime(e, t, value)) { return value; @@ -151,7 +151,6 @@ } - // --------------------------------------------------------------------------- // MSNet - methods // --------------------------------------------------------------------------- @@ -181,9 +180,10 @@ } OptionsCont& oc = OptionsCont::getOptions(); myStep = string2time(oc.getString("begin")); + myMaxTeleports = oc.getInt("max-num-teleports"); myLogExecutionTime = !oc.getBool("no-duration-log"); myLogStepNumber = !oc.getBool("no-step-log"); - myInserter = new MSInsertionControl(*vc, string2time(oc.getString("max-depart-delay")), !oc.getBool("eager-insert"), oc.getInt("max-num-vehicles")); + myInserter = new MSInsertionControl(*vc, string2time(oc.getString("max-depart-delay")), oc.getBool("eager-insert"), oc.getInt("max-num-vehicles")); myVehicleControl = vc; myDetectorControl = new MSDetectorControl(); myEdges = 0; @@ -207,8 +207,6 @@ } - - void MSNet::closeBuilding(const OptionsCont& oc, MSEdgeControl* edges, MSJunctionControl* junctions, SUMORouteLoaderControl* routeLoaders, @@ -218,7 +216,7 @@ bool hasInternalLinks, bool hasNeighs, bool lefthand, - SUMOReal version) { + double version) { myEdges = edges; myJunctions = junctions; myRouteLoaders = routeLoaders; @@ -287,14 +285,14 @@ void -MSNet::addRestriction(const std::string& id, const SUMOVehicleClass svc, const SUMOReal speed) { +MSNet::addRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed) { myRestrictions[id][svc] = speed; } -const std::map* +const std::map* MSNet::getRestrictions(const std::string& id) const { - std::map >::const_iterator i = myRestrictions.find(id); + std::map >::const_iterator i = myRestrictions.find(id); if (i == myRestrictions.end()) { return 0; } @@ -302,12 +300,12 @@ } -int +MSNet::SimulationState MSNet::simulate(SUMOTime start, SUMOTime stop) { // report the begin when wished WRITE_MESSAGE("Simulation started with time: " + time2string(start)); // the simulation loop - MSNet::SimulationState state = SIMSTATE_RUNNING; + SimulationState state = SIMSTATE_RUNNING; myStep = start; // preload the routes especially for TraCI loadRoutes(); @@ -318,7 +316,7 @@ closeSimulation(start); WRITE_MESSAGE("Simulation ended at time: " + time2string(getCurrentTimeStep())); WRITE_MESSAGE("Reason: Script ended"); - return 0; + return state; } #endif #endif @@ -332,7 +330,10 @@ } state = simulationState(stop); #ifndef NO_TRACI - if (state != SIMSTATE_RUNNING) { + if (state == SIMSTATE_LOADING) { + OptionsIO::setArgs(TraCI::getLoadArgs()); + TraCI::getLoadArgs().clear(); + } else if (state != SIMSTATE_RUNNING) { if (OptionsCont::getOptions().getInt("remote-port") != 0 && !TraCIServer::wasClosed()) { state = SIMSTATE_RUNNING; } @@ -344,7 +345,7 @@ WRITE_MESSAGE("Reason: " + getStateMessage(state)); // exit simulation loop closeSimulation(start); - return 0; + return state; } void @@ -361,10 +362,10 @@ // print performance notice msg << "Performance: " << "\n" << " Duration: " << duration << "ms" << "\n"; if (duration != 0) { - msg << " Real time factor: " << (STEPS2TIME(myStep - start) * 1000. / (SUMOReal)duration) << "\n"; + msg << " Real time factor: " << (STEPS2TIME(myStep - start) * 1000. / (double)duration) << "\n"; msg.setf(std::ios::fixed , std::ios::floatfield); // use decimal format msg.setf(std::ios::showpoint); // print decimal point - msg << " UPS: " << ((SUMOReal)myVehiclesMoved / ((SUMOReal)duration / 1000)) << "\n"; + msg << " UPS: " << ((double)myVehiclesMoved / ((double)duration / 1000)) << "\n"; } // print vehicle statistics const std::string discardNotice = ((myVehicleControl->getLoadedVehicleNo() != myVehicleControl->getDepartedVehicleNo()) ? @@ -414,24 +415,30 @@ if (OptionsCont::getOptions().getBool("tripinfo-output.write-unfinished")) { MSDevice_Tripinfo::generateOutputForUnfinished(); } -#ifndef NO_TRACI - TraCIServer::close(); -#endif + if (OptionsCont::getOptions().isSet("chargingstations-output")) { + writeChargingStationOutput(); + } } void MSNet::simulationStep() { #ifndef NO_TRACI + if (myLogExecutionTime) { + myTraCIStepDuration = SysUtils::getCurrentMillis(); + } TraCIServer::processCommandsUntilSimStep(myStep); TraCIServer* t = TraCIServer::getInstance(); + if (myLogExecutionTime) { + myTraCIStepDuration = SysUtils::getCurrentMillis() - myTraCIStepDuration; + } if (t != 0 && t->getTargetTime() != 0 && t->getTargetTime() < myStep) { return; } #endif // execute beginOfTimestepEvents if (myLogExecutionTime) { - mySimStepBegin = SysUtils::getCurrentMillis(); + mySimStepDuration = SysUtils::getCurrentMillis(); } // simulation state output std::vector::iterator timeIt = find(myStateDumpTimes.begin(), myStateDumpTimes.end(), myStep); @@ -503,15 +510,20 @@ #ifndef NO_TRACI if (TraCIServer::getInstance() != 0) { + if (myLogExecutionTime) { + myTraCIStepDuration -= SysUtils::getCurrentMillis(); + } TraCIServer::getInstance()->postProcessVTD(); + if (myLogExecutionTime) { + myTraCIStepDuration += SysUtils::getCurrentMillis(); + } } #endif // update and write (if needed) detector values writeOutput(); if (myLogExecutionTime) { - mySimStepEnd = SysUtils::getCurrentMillis(); - mySimStepDuration = mySimStepEnd - mySimStepBegin; + mySimStepDuration = SysUtils::getCurrentMillis() - mySimStepDuration; myVehiclesMoved += myVehicleControl->getRunningVehicleNo(); } myStep += DELTA_T; @@ -524,9 +536,12 @@ if (TraCIServer::wasClosed()) { return SIMSTATE_CONNECTION_CLOSED; } - if (stopTime < 0 && OptionsCont::getOptions().getInt("remote-port") == 0) { + if (!TraCI::getLoadArgs().empty()) { + return SIMSTATE_LOADING; + } + if ((stopTime < 0 || myStep > stopTime) && OptionsCont::getOptions().getInt("remote-port") == 0) { #else - if (stopTime < 0) { + if (stopTime < 0 || myStep > stopTime) { #endif if (myInsertionEvents->isEmpty() && (myVehicleControl->getActiveVehicleCount() == 0) @@ -546,6 +561,9 @@ if (stopTime >= 0 && myStep >= stopTime) { return SIMSTATE_END_STEP_REACHED; } + if (myMaxTeleports >= 0 && myVehicleControl->getTeleportCount() > myMaxTeleports) { + return SIMSTATE_TOO_MANY_TELEPORTS; + } return SIMSTATE_RUNNING; } @@ -563,8 +581,8 @@ return "TraCI requested termination."; case MSNet::SIMSTATE_ERROR_IN_SIM: return "An error occured (see log)."; - case MSNet::SIMSTATE_TOO_MANY_VEHICLES: - return "Too many vehicles."; + case MSNet::SIMSTATE_TOO_MANY_TELEPORTS: + return "Too many teleports."; default: return "Unknown reason."; } @@ -584,6 +602,13 @@ MSPModel::cleanup(); MSCModel_NonInteracting::cleanup(); MSDevice_BTsender::cleanup(); + MSDevice_SSM::cleanup(); +#ifndef NO_TRACI + TraCIServer* t = TraCIServer::getInstance(); + if (t != 0) { + t->cleanup(); + } +#endif } @@ -653,9 +678,9 @@ if (OptionsCont::getOptions().isSet("summary-output")) { OutputDevice& od = OutputDevice::getDeviceByOption("summary-output"); int departedVehiclesNumber = myVehicleControl->getDepartedVehicleNo(); - const SUMOReal meanWaitingTime = departedVehiclesNumber != 0 ? myVehicleControl->getTotalDepartureDelay() / (SUMOReal) departedVehiclesNumber : -1.; + const double meanWaitingTime = departedVehiclesNumber != 0 ? myVehicleControl->getTotalDepartureDelay() / (double) departedVehiclesNumber : -1.; int endedVehicleNumber = myVehicleControl->getEndedVehicleNo(); - const SUMOReal meanTravelTime = endedVehicleNumber != 0 ? myVehicleControl->getTotalTravelTime() / (SUMOReal) endedVehicleNumber : -1.; + const double meanTravelTime = endedVehicleNumber != 0 ? myVehicleControl->getTotalTravelTime() / (double) endedVehicleNumber : -1.; od.openTag("step").writeAttr("time", time2string(myStep)).writeAttr("loaded", myVehicleControl->getLoadedVehicleNo()) .writeAttr("inserted", myVehicleControl->getDepartedVehicleNo()).writeAttr("running", myVehicleControl->getRunningVehicleNo()) .writeAttr("waiting", myInserter->getWaitingVehicleNo()).writeAttr("ended", myVehicleControl->getEndedVehicleNo()) @@ -686,6 +711,12 @@ } od.closeTag(); } + + // write SSM output + for (std::set::iterator di = MSDevice_SSM::getInstances().begin(); di != MSDevice_SSM::getInstances().end(); ++di) { + MSDevice_SSM* dev = static_cast(*di); + dev->updateAndWriteOutput(); + } } @@ -733,17 +764,24 @@ std::ostringstream oss; oss.setf(std::ios::fixed , std::ios::floatfield); // use decimal format oss.setf(std::ios::showpoint); // print decimal point - oss << std::setprecision(OUTPUT_ACCURACY); + oss << std::setprecision(gPrecision); if (mySimStepDuration != 0) { + const double durationSec = (double)mySimStepDuration / 1000.; oss << " (" << mySimStepDuration << "ms ~= " - << (1000. / (SUMOReal) mySimStepDuration) << "*RT, ~" - << ((SUMOReal) myVehicleControl->getRunningVehicleNo() / (SUMOReal) mySimStepDuration * 1000.); + << (TS / durationSec) << "*RT, ~" + << ((double) myVehicleControl->getRunningVehicleNo() / durationSec); } else { oss << " (0ms ?*RT. ?"; } - oss << "UPS, vehicles" - << " TOT " << myVehicleControl->getDepartedVehicleNo() + oss << "UPS, "; +#ifndef NO_TRACI + if (TraCIServer::getInstance() != 0) { + oss << "TraCI: " << myTraCIStepDuration << "ms, "; + } +#endif + oss << "vehicles TOT " << myVehicleControl->getDepartedVehicleNo() << " ACT " << myVehicleControl->getRunningVehicleNo() + << " BUF " << myInserter->getWaitingVehicleNo() << ") "; std::string prev = "Step #" + time2string(myStep - DELTA_T); std::cout << oss.str().substr(0, 78 - prev.length()); @@ -792,7 +830,7 @@ std::string -MSNet::getBusStopID(const MSLane* lane, const SUMOReal pos) const { +MSNet::getBusStopID(const MSLane* lane, const double pos) const { const std::map& vals = myBusStopDict.getMyMap(); for (std::map::const_iterator it = vals.begin(); it != vals.end(); ++it) { MSStoppingPlace* stop = it->second; @@ -815,7 +853,7 @@ } std::string -MSNet::getContainerStopID(const MSLane* lane, const SUMOReal pos) const { +MSNet::getContainerStopID(const MSLane* lane, const double pos) const { const std::map& vals = myContainerStopDict.getMyMap(); for (std::map::const_iterator it = vals.begin(); it != vals.end(); ++it) { MSStoppingPlace* stop = it->second; @@ -826,6 +864,28 @@ return ""; } +// ------ Insertion and retrieval of container stops ------ +bool +MSNet::addParkingArea(MSParkingArea* parkingArea) { + return myParkingAreaDict.add(parkingArea->getID(), parkingArea); +} + +MSParkingArea* +MSNet::getParkingArea(const std::string& id) const { + return myParkingAreaDict.get(id); +} + +std::string +MSNet::getParkingAreaID(const MSLane* lane, const double pos) const { + const std::map& vals = myParkingAreaDict.getMyMap(); + for (std::map::const_iterator it = vals.begin(); it != vals.end(); ++it) { + MSParkingArea* stop = it->second; + if (&stop->getLane() == lane && fabs(stop->getEndLanePosition() - pos) < POSITION_EPS) { + return stop->getID(); + } + } + return ""; +} bool MSNet::addChargingStation(MSChargingStation* chargingStation) { @@ -840,7 +900,7 @@ std::string -MSNet::getChargingStationID(const MSLane* lane, const SUMOReal pos) const { +MSNet::getChargingStationID(const MSLane* lane, const double pos) const { const std::map& vals = myChargingStationDict.getMyMap(); for (std::map::const_iterator it = vals.begin(); it != vals.end(); ++it) { MSChargingStation* chargingStation = it->second; @@ -852,6 +912,15 @@ } +void +MSNet::writeChargingStationOutput() const { + OutputDevice& output = OutputDevice::getDeviceByOption("chargingstations-output"); + for (std::map::const_iterator it = myChargingStationDict.getMyMap().begin(); it != myChargingStationDict.getMyMap().end(); it++) { + it->second->writeChargingStationOutput(output); + } +} + + SUMOAbstractRouter& MSNet::getRouterTT(const MSEdgeVector& prohibited) const { if (!myRouterTTInitialized) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSNet.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSNet.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSNet.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSNet.h 2017-07-23 16:22:03.000000000 +0000 @@ -8,12 +8,12 @@ /// @author Clemens Honomichl /// @author Michael Behrisch /// @date Mon, 12 Mar 2001 -/// @version $Id: MSNet.h 21198 2016-07-19 11:34:56Z namdre $ +/// @version $Id: MSNet.h 23898 2017-04-10 11:10:21Z behrisch $ /// // The simulated network and simulation perfomer /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -96,6 +97,8 @@ * @brief Possible states of a simulation - running or stopped with different reasons */ enum SimulationState { + /// @brief The simulation is loading + SIMSTATE_LOADING, /// @brief The simulation is running SIMSTATE_RUNNING, /// @brief The final simulation step has been performed @@ -106,8 +109,8 @@ SIMSTATE_CONNECTION_CLOSED, /// @brief An error occured during the simulation step SIMSTATE_ERROR_IN_SIM, - /// @brief The simulation contains too many vehicles (@deprecated) - SIMSTATE_TOO_MANY_VEHICLES + /// @brief The simulation had too many teleports + SIMSTATE_TOO_MANY_TELEPORTS }; //typedef PedestrianRouterDijkstra MSPedestrianRouterDijkstra; @@ -165,7 +168,7 @@ SUMORouteLoaderControl* routeLoaders, MSTLLogicControl* tlc, std::vector stateDumpTimes, std::vector stateDumpFiles, bool hasInternalLinks, bool hasNeighs, bool lefthand, - SUMOReal version); + double version); /** @brief Returns whether the network has specific vehicle class permissions @@ -187,7 +190,7 @@ * @param[in] svc The vehicle class the restriction refers to * @param[in] speed The restricted speed */ - void addRestriction(const std::string& id, const SUMOVehicleClass svc, const SUMOReal speed); + void addRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed); /** @brief Returns the restrictions for an edge type @@ -195,7 +198,7 @@ * @param[in] id The id of the type * @return The mapping of vehicle classes to maximum speeds */ - const std::map* getRestrictions(const std::string& id) const; + const std::map* getRestrictions(const std::string& id) const; /** @brief Clears all dictionaries @@ -211,7 +214,7 @@ * @todo Recheck return value * @todo What exceptions may occure? */ - int simulate(SUMOTime start, SUMOTime stop); + SimulationState simulate(SUMOTime start, SUMOTime stop); /** @brief Performs a single simulation step @@ -468,7 +471,7 @@ * @param[in] pos the position of the bus stop to return. * @return The bus stop id on the location, or "" if no such stop exists */ - std::string getBusStopID(const MSLane* lane, const SUMOReal pos) const; + std::string getBusStopID(const MSLane* lane, const double pos) const; /// @} @@ -499,9 +502,42 @@ * @param[in] pos the position of the container stop to return. * @return The container stop id on the location, or "" if no such stop exists */ - std::string getContainerStopID(const MSLane* lane, const SUMOReal pos) const; + std::string getContainerStopID(const MSLane* lane, const double pos) const; /// @} + /// @name Insertion and retrieval of parking areas + /// @{ + + /** @brief Adds a parking area + * + * If another parking area with the same id exists, false is returned. + * Otherwise, the parking area is added to the internal parking area + * container "myParkingAreaDict". + * + * This control gets responsible for deletion of the added parking area. + * + * @param[in] parkingArea The parking area to add + * @return Whether the parking area could be added + */ + bool addParkingArea(MSParkingArea* parkingArea); + + /** @brief Returns the named parking area + * @param[in] id The id of the parking area to return. + * @return The named parking area, or 0 if no such stop exists + */ + MSParkingArea* getParkingArea(const std::string& id) const; + + /** @brief Returns the parking area close to the given position + * @param[in] lane the lane of the parking area to return. + * @param[in] pos the position of the parking area to return. + * @return The parking area id on the location, or "" if no such stop exists + */ + std::string getParkingAreaID(const MSLane* lane, const double pos) const; + /// @} + + /// @name Insertion and retrieval of charging stations + /// @{ + /** @brief Adds a chargingg station * * If another charging station with the same id exists, false is returned. @@ -526,7 +562,10 @@ * @param[in] pos the position of the bus stop to return. * @return The charging station id on the location, or "" if no such stop exists */ - std::string getChargingStationID(const MSLane* lane, const SUMOReal pos) const; + std::string getChargingStationID(const MSLane* lane, const double pos) const; + + /// @brief write charging station output + void writeChargingStationOutput() const; /// @} @@ -607,7 +646,7 @@ * @return The travel time for an edge * @see DijkstraRouterTT_ByProxi */ - static SUMOReal getTravelTime(const MSEdge* const e, const SUMOVehicle* const v, SUMOReal t); + static double getTravelTime(const MSEdge* const e, const SUMOVehicle* const v, double t); /** @brief Returns the effort to pass an edge @@ -617,7 +656,7 @@ * @return The effort (abstract) for an edge * @see DijkstraRouterTT_ByProxi */ - static SUMOReal getEffort(const MSEdge* const e, const SUMOVehicle* const v, SUMOReal t); + static double getEffort(const MSEdge* const e, const SUMOVehicle* const v, double t); /* @brief get the router, initialize on first use @@ -656,7 +695,7 @@ } /// @brief return the network version - SUMOReal version() const { + double version() const { return myVersion; } @@ -674,6 +713,9 @@ /// @brief Current time step. SUMOTime myStep; + /// @brief Maximum number of teleports. + int myMaxTeleports; + /// @name Substructures @@ -718,8 +760,8 @@ /// @brief Information whether the number of the simulation step shall be logged bool myLogStepNumber; - /// @brief The last simulation step begin, end and duration - long mySimStepBegin, mySimStepEnd, mySimStepDuration; + /// @brief The last simulation step duration + long myTraCIStepDuration, mySimStepDuration; /// @brief The overall simulation duration long mySimBeginMillis; @@ -750,7 +792,7 @@ bool myHavePermissions; /// @brief The vehicle class specific speed restrictions - std::map > myRestrictions; + std::map > myRestrictions; /// @brief Whether the network contains internal links/lanes/edges bool myHasInternalLinks; @@ -765,7 +807,7 @@ bool myLefthand; /// @brief the network version - SUMOReal myVersion; + double myVersion; /// @brief Dictionary of bus stops NamedObjectCont myBusStopDict; @@ -773,6 +815,9 @@ /// @brief Dictionary of container stops NamedObjectCont myContainerStopDict; + /// @brief Dictionary of parking areas + NamedObjectCont myParkingAreaDict; + /// @brief Dictionary of charging Stations NamedObjectCont myChargingStationDict; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSNoLogicJunction.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSNoLogicJunction.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSNoLogicJunction.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSNoLogicJunction.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Thu, 06 Jun 2002 -/// @version $Id: MSNoLogicJunction.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSNoLogicJunction.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,10 +36,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions @@ -52,17 +48,11 @@ SumoXMLNodeType type, const Position& position, const PositionVector& shape, - std::vector incoming -#ifdef HAVE_INTERNAL_LANES - , std::vector internal -#endif - ): + std::vector incoming, std::vector internal): MSJunction(id, type, position, shape), - myIncomingLanes(incoming) -#ifdef HAVE_INTERNAL_LANES - , myInternalLanes(internal) -#endif -{} + myIncomingLanes(incoming), + myInternalLanes(internal) { +} MSNoLogicJunction::~MSNoLogicJunction() {} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSNoLogicJunction.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSNoLogicJunction.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSNoLogicJunction.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSNoLogicJunction.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Wed, 12 Dez 2001 -/// @version $Id: MSNoLogicJunction.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSNoLogicJunction.h 24108 2017-04-27 18:43:30Z behrisch $ /// // logic, e.g. for exits. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -67,23 +67,24 @@ */ MSNoLogicJunction(const std::string& id, SumoXMLNodeType type, const Position& position, const PositionVector& shape, - std::vector incoming -#ifdef HAVE_INTERNAL_LANES - , std::vector internal -#endif - ); + std::vector incoming, + std::vector internal); /** Initialises the junction after the net was completely loaded */ void postloadInit(); + /** @brief Returns all internal lanes on the junction + */ + virtual const std::vector& getInternalLanes() const { + return myInternalLanes; + } + private: /** Lanes incoming to the junction */ std::vector myIncomingLanes; -#ifdef HAVE_INTERNAL_LANES /** The junctions internal lanes */ std::vector myInternalLanes; -#endif private: /// @brief Invalidated copy constructor. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSParkingArea.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSParkingArea.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSParkingArea.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSParkingArea.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,220 @@ +/****************************************************************************/ +/// @file MSParkingArea.h +/// @author Mirco Sturari +/// @author Jakob Erdmann +/// @date Tue, 19.01.2016 +/// @version $Id: MSParkingArea.cpp 23529 2017-03-18 10:22:36Z behrisch $ +/// +// A area where vehicles can park next to the road +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2015-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include "MSLane.h" +#include "MSTransportable.h" +#include "MSParkingArea.h" + + +// =========================================================================== +// method definitions +// =========================================================================== +MSParkingArea::MSParkingArea(const std::string& id, + const std::vector& lines, + MSLane& lane, + double begPos, double endPos, + unsigned int capacity, + double width, double length, double angle) : + MSStoppingPlace(id, lines, lane, begPos, endPos), + myCapacity(capacity), + myWidth(width), + myLength(length), + myAngle(angle) { + // initialize unspecified defaults + if (myWidth == 0) { + myWidth = SUMO_const_laneWidth; + } + if (myLength == 0) { + myLength = getSpaceDim(); + } + + myShape = lane.getShape(); + myShape.move2side(lane.getWidth() / 2. + myWidth / 2.); + myShape = myShape.getSubpart(begPos, endPos); + // Initialize space occupancies if there is a road-side capacity + // The overall number of lots is fixed and each lot accepts one vehicle regardless of size + if (myCapacity > 0) { + for (int i = 1; i <= myCapacity; ++i) { + mySpaceOccupancies[i] = LotSpaceDefinition(); + mySpaceOccupancies[i].index = i; + mySpaceOccupancies[i].vehicle = 0; + mySpaceOccupancies[i].myWidth = myWidth; + mySpaceOccupancies[i].myLength = myLength; + mySpaceOccupancies[i].myEndPos = myBegPos + getSpaceDim() * i; + + const Position& f = myShape.positionAtOffset(getSpaceDim() * (i - 1)); + const Position& s = myShape.positionAtOffset(getSpaceDim() * (i)); + double lot_angle = ((double) atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double) PI) + myAngle; + mySpaceOccupancies[i].myRotation = lot_angle; + if (myAngle == 0) { + // parking parallel to the road + mySpaceOccupancies[i].myPosition = s; + } else { + // angled parking + mySpaceOccupancies[i].myPosition = (f + s) * 0.5; + } + + } + } + computeLastFreePos(); +} + +MSParkingArea::~MSParkingArea() {} + +double +MSParkingArea::getLastFreePos(const SUMOVehicle& /* forVehicle */) const { + return myLastFreePos; +} + +Position +MSParkingArea::getVehiclePosition(const SUMOVehicle& forVehicle) { + std::map::iterator i; + for (i = mySpaceOccupancies.begin(); i != mySpaceOccupancies.end(); i++) { + if ((*i).second.vehicle == &forVehicle) { + return (*i).second.myPosition; + } + } + return Position::INVALID; +} + +double +MSParkingArea::getVehicleAngle(const SUMOVehicle& forVehicle) { + std::map::iterator i; + for (i = mySpaceOccupancies.begin(); i != mySpaceOccupancies.end(); i++) { + if ((*i).second.vehicle == &forVehicle) { + return (((*i).second.myRotation - 90.) * (double) PI / (double) 180.0); + } + } + return 0.; +} + + +double +MSParkingArea::getSpaceDim() const { + return (myEndPos - myBegPos) / myCapacity; +} + + +void +MSParkingArea::addLotEntry(double x, double y, double z, + double width, double length, double angle) { + + const int i = (int)mySpaceOccupancies.size() + 1; + + mySpaceOccupancies[i] = LotSpaceDefinition(); + mySpaceOccupancies[i].index = i; + mySpaceOccupancies[i].vehicle = 0; + mySpaceOccupancies[i].myPosition = Position(x, y, z); + mySpaceOccupancies[i].myWidth = width; + mySpaceOccupancies[i].myLength = length; + mySpaceOccupancies[i].myRotation = angle; + mySpaceOccupancies[i].myEndPos = myEndPos; + myCapacity = (int)mySpaceOccupancies.size(); + computeLastFreePos(); +} + + +void +MSParkingArea::enter(SUMOVehicle* what, double beg, double end) { + if (myLastFreeLot >= 1 && myLastFreeLot <= (int)mySpaceOccupancies.size()) { + mySpaceOccupancies[myLastFreeLot].vehicle = what; + myEndPositions[what] = std::pair(beg, end); + computeLastFreePos(); + } +} + + +void +MSParkingArea::leaveFrom(SUMOVehicle* what) { + assert(myEndPositions.find(what) != myEndPositions.end()); + std::map::iterator i; + for (i = mySpaceOccupancies.begin(); i != mySpaceOccupancies.end(); i++) { + if ((*i).second.vehicle == what) { + (*i).second.vehicle = 0; + break; + } + } + myEndPositions.erase(myEndPositions.find(what)); + computeLastFreePos(); +} + + +void +MSParkingArea::computeLastFreePos() { + myLastFreeLot = 0; + myLastFreePos = myBegPos; + std::map::iterator i; + for (i = mySpaceOccupancies.begin(); i != mySpaceOccupancies.end(); i++) { + if ((*i).second.vehicle == 0) { + myLastFreeLot = (*i).first; + myLastFreePos = (*i).second.myEndPos; + break; + } + } +} + + +double +MSParkingArea::getWidth() const { + return myWidth; +} + + +double +MSParkingArea::getLength() const { + return myLength; +} + + +double +MSParkingArea::getAngle() const { + return myAngle; +} + + +int +MSParkingArea::getCapacity() const { + return myCapacity; +} + + +int +MSParkingArea::getOccupancy() const { + return (int)myEndPositions.size(); +} + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSParkingArea.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSParkingArea.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSParkingArea.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSParkingArea.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,259 @@ +/****************************************************************************/ +/// @file MSParkingArea.h +/// @author Mirco Sturari +/// @date Tue, 19.01.2016 +/// @version $Id: MSParkingArea.h 23150 2017-02-27 12:08:30Z behrisch $ +/// +// A area where vehicles can park next to the road +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2015-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef MSParkingArea_h +#define MSParkingArea_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include "MSStoppingPlace.h" + + +// =========================================================================== +// class declarations +// =========================================================================== +class MSLane; +class SUMOVehicle; +class MSTransportable; +class Position; + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class MSParkingArea + * @brief A lane area vehicles can halt at + * + * The stop tracks the last free space a vehicle may halt at by being + * informed about a vehicle's entering and depart. It keeps the information + * about entered vehicles' begin and end position within an internal + * container ("myEndPositions") and is so able to compute the last free space. + * + * Please note that using the last free space disallows vehicles to enter a + * free space in between other vehicles. + */ +class MSParkingArea : public MSStoppingPlace { +public: + + /** @brief Constructor + * + * @param[in] id The id of the stop + * @param[in] net The net the stop belongs to + * @param[in] lines Names of the lines that halt on this stop + * @param[in] lane The lane the stop is placed on + * @param[in] begPos Begin position of the stop on the lane + * @param[in] endPos End position of the stop on the lane + * @param[in] capacity Capacity of the stop + * @param[in] width Width of the default lot rectangle + * @param[in] length Length of the default lot rectangle + * @param[in] angle Angle of the default lot rectangle + */ + MSParkingArea(const std::string& id, + const std::vector& lines, MSLane& lane, + double begPos, double endPos, unsigned int capacity, + double width, double length, double angle); + + /// @brief Destructor + virtual ~MSParkingArea(); + + + /** @brief Returns the area capacity + * + * @return The capacity + */ + int getCapacity() const; + + + /** @brief Returns the area occupancy + * + * @return The occupancy computed as number of vehicles in myEndPositions + */ + int getOccupancy() const; + + + /** @brief Called if a vehicle enters this stop + * + * Stores the position of the entering vehicle in myEndPositions. + * + * Recomputes the free space using "computeLastFreePos" then. + * + * @param[in] what The vehicle that enters the bus stop + * @param[in] beg The begin halting position of the vehicle + * @param[in] what The end halting position of the vehicle + * @see computeLastFreePos + */ + void enter(SUMOVehicle* what, double beg, double end); + + + /** @brief Called if a vehicle leaves this stop + * + * Removes the position of the vehicle from myEndPositions. + * + * Recomputes the free space using "computeLastFreePos" then. + * + * @param[in] what The vehicle that leaves the bus stop + * @see computeLastFreePos + */ + void leaveFrom(SUMOVehicle* what); + + + /** @brief Returns the last free position on this stop + * + * @return The last free position of this bus stop + */ + double getLastFreePos(const SUMOVehicle& forVehicle) const; + + + /** @brief Returns the position of parked vehicle + * + * @return The position of parked vehicle + */ + Position getVehiclePosition(const SUMOVehicle& forVehicle); + + + /** @brief Returns the angle of parked vehicle + * + * @return The angle of parked vehicle + */ + double getVehicleAngle(const SUMOVehicle& forVehicle); + + + /** @brief Returns the space dimension + * + * @return The space dimension + */ + double getSpaceDim() const; + + + /** @brief Add a lot entry to parking area + * + * @param[in] x X position of the lot center + * @param[in] y Y position of the lot center + * @param[in] z Z position of the lot center + * @param[in] width Width of the lot rectangle + * @param[in] length Length of the lot rectangle + * @param[in] angle Angle of the lot rectangle + * @return Whether the lot entry could be added + */ + void addLotEntry(double x, double y, double z, + double width, double length, double angle); + + + /** @brief Returns the lot rectangle width + * + * @return The width + */ + double getWidth() const; + + + /** @brief Returns the lot rectangle length + * + * @return The length + */ + double getLength() const; + + + /** @brief Returns the lot rectangle angle + * + * @return The angle + */ + double getAngle() const; + +protected: + + /** @struct LotSpaceDefinition + * @brief Representation of a single lot space + */ + struct LotSpaceDefinition { + /// @brief the running index + unsigned int index; + /// @brief The last parked vehicle or 0 + SUMOVehicle* vehicle; + /// @brief The position of the vehicle when parking in this space + Position myPosition; + /// @brief The rotation + double myRotation; + /// @brief The width + double myWidth; + /// @brief The length + double myLength; + /// @brief The position along the lane that the vehicle needs to reach for entering this lot + double myEndPos; + }; + + + /** @brief Computes the last free position on this stop + * + * The last free position is the one, the last vehicle ends at. + * It is stored in myLastFreePos. If no vehicle halts, the last free + * position gets the value of myEndPos. + */ + void computeLastFreePos(); + + /// @brief Last free lot number (0 no free lot) + int myLastFreeLot; + + /// @brief Stop area capacity + int myCapacity; + + /// @brief The default width of each parking space + double myWidth; + + /// @brief The default length of each parking space + double myLength; + + /// @brief The default angle of each parking space + double myAngle; + + + /// @brief A map from objects (vehicles) to the areas they acquire after entering the stop + std::map mySpaceOccupancies; + + /// @brief The roadside shape of this parkingArea + PositionVector myShape; + +private: + + /// @brief Invalidated copy constructor. + MSParkingArea(const MSParkingArea&); + + /// @brief Invalidated assignment operator. + MSParkingArea& operator=(const MSParkingArea&); + +}; + + +#endif + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSRightOfWayJunction.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSRightOfWayJunction.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSRightOfWayJunction.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSRightOfWayJunction.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Wed, 12 Dez 2001 -/// @version $Id: MSRightOfWayJunction.cpp 21210 2016-07-21 10:02:38Z behrisch $ +/// @version $Id: MSRightOfWayJunction.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // junction. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,10 +41,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -54,17 +50,9 @@ const Position& position, const PositionVector& shape, std::vector incoming, -#ifdef HAVE_INTERNAL_LANES std::vector internal, -#endif - MSJunctionLogic* logic) - : MSLogicJunction(id, type, position, shape, incoming -#ifdef HAVE_INTERNAL_LANES - , internal), -#else - ), -#endif - myLogic(logic) {} + MSJunctionLogic* logic) : MSLogicJunction(id, type, position, shape, incoming, internal), + myLogic(logic) {} MSRightOfWayJunction::~MSRightOfWayJunction() { @@ -113,7 +101,6 @@ if (linkResponse.test(c)) { MSLink* foe = sortedLinks[c].second; myLinkFoeLinks[*j].push_back(foe); -#ifdef HAVE_INTERNAL_LANES if (MSGlobals::gUsingInternalLanes && foe->getViaLane() != 0) { assert(foe->getViaLane()->getLinkCont().size() == 1); MSLink* foeExitLink = foe->getViaLane()->getLinkCont()[0]; @@ -122,7 +109,6 @@ myLinkFoeLinks[*j].push_back(foeExitLink); } } -#endif } } std::vector foes; @@ -130,7 +116,6 @@ if (linkFoes.test(c)) { MSLink* foe = sortedLinks[c].second; foes.push_back(foe); -#ifdef HAVE_INTERNAL_LANES MSLane* l = foe->getViaLane(); if (l == 0) { continue; @@ -142,12 +127,10 @@ foes.push_back(*q); } } -#endif } } myLinkFoeInternalLanes[*j] = std::vector(); -#ifdef HAVE_INTERNAL_LANES if (MSGlobals::gUsingInternalLanes && myInternalLanes.size() > 0) { int li = 0; for (int c = 0; c < (int)sortedLinks.size(); ++c) { @@ -166,9 +149,7 @@ ++li; } } -#endif (*j)->setRequestInformation((int)requestPos, hasFoes, cont, myLinkFoeLinks[*j], myLinkFoeInternalLanes[*j]); -#ifdef HAVE_INTERNAL_LANES // the exit link for a link before an internal junction is handled in MSInternalJunction // so we need to skip if cont=true if (MSGlobals::gUsingInternalLanes && (*j)->getViaLane() != 0 && !cont) { @@ -177,7 +158,6 @@ exitLink->setRequestInformation((int)requestPos, false, false, std::vector(), myLinkFoeInternalLanes[*j], (*j)->getViaLane()); } -#endif for (std::vector::const_iterator k = foes.begin(); k != foes.end(); ++k) { (*j)->addBlockedLink(*k); (*k)->addBlockedLink(*j); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSRightOfWayJunction.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSRightOfWayJunction.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSRightOfWayJunction.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSRightOfWayJunction.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 12 Dez 2001 -/// @version $Id: MSRightOfWayJunction.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSRightOfWayJunction.h 23509 2017-03-17 12:27:35Z luecken $ /// // A junction with right-of-way - rules /****************************************************************************/ @@ -69,9 +69,7 @@ MSRightOfWayJunction(const std::string& id, SumoXMLNodeType type, const Position& position, const PositionVector& shape, std::vector incoming, -#ifdef HAVE_INTERNAL_LANES std::vector internal, -#endif MSJunctionLogic* logic); /// Destructor. @@ -96,6 +94,7 @@ /** the type of the junction (its logic) */ MSJunctionLogic* myLogic; + // TODO: Documentation std::map > myLinkFoeLinks; std::map > myLinkFoeInternalLanes; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSRoute.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSRoute.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSRoute.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSRoute.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: MSRoute.cpp 21201 2016-07-19 11:57:22Z behrisch $ +/// @version $Id: MSRoute.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A vehicle route /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,10 +42,6 @@ #include "MSLane.h" #include "MSRoute.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member variables @@ -281,13 +277,13 @@ } -SUMOReal -MSRoute::getDistanceBetween(SUMOReal fromPos, SUMOReal toPos, +double +MSRoute::getDistanceBetween(double fromPos, double toPos, const MSEdge* fromEdge, const MSEdge* toEdge, bool includeInternal) const { ConstMSEdgeVector::const_iterator it = std::find(myEdges.begin(), myEdges.end(), fromEdge); if (it == myEdges.end() || std::find(it, myEdges.end(), toEdge) == myEdges.end()) { // start or destination not contained in route - return std::numeric_limits::max(); + return std::numeric_limits::max(); } ConstMSEdgeVector::const_iterator it2 = std::find(it + 1, myEdges.end(), toEdge); @@ -296,18 +292,18 @@ return toPos - fromPos; } else if (it2 == myEdges.end()) { // we don't visit the edge again - return std::numeric_limits::max(); + return std::numeric_limits::max(); } } return getDistanceBetween(fromPos, toPos, it, it2, includeInternal); } -SUMOReal -MSRoute::getDistanceBetween(SUMOReal fromPos, SUMOReal toPos, +double +MSRoute::getDistanceBetween(double fromPos, double toPos, const MSRouteIterator& fromEdge, const MSRouteIterator& toEdge, bool includeInternal) const { bool isFirstIteration = true; - SUMOReal distance = -fromPos; + double distance = -fromPos; MSRouteIterator it = fromEdge; if (fromEdge == toEdge) { // destination position is on start edge @@ -315,11 +311,11 @@ return toPos - fromPos; } else { // we cannot go backwards. Something is wrong here - return std::numeric_limits::max(); + return std::numeric_limits::max(); } } else if (fromEdge > toEdge) { // we don't visit the edge again - return std::numeric_limits::max(); + return std::numeric_limits::max(); } for (; it != end(); ++it) { if (it == toEdge && !isFirstIteration) { @@ -327,7 +323,6 @@ break; } else { distance += (*it)->getLength(); -#ifdef HAVE_INTERNAL_LANES if (includeInternal) { // add length of internal lanes to the result const MSEdge* internal = (*it)->getInternalFollowingEdge(*(it + 1)); @@ -335,9 +330,6 @@ distance += internal->getLength(); } } -#else - UNUSED_PARAMETER(includeInternal); -#endif } isFirstIteration = false; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSRoute.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSRoute.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSRoute.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSRoute.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: MSRoute.h 21201 2016-07-19 11:57:22Z behrisch $ +/// @version $Id: MSRoute.h 23341 2017-03-13 10:11:12Z behrisch $ /// // A vehicle route /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include @@ -141,7 +141,7 @@ * @param[in] includeInternal Whether the lengths of internal edges shall be counted * @return distance between the position fromPos on fromEdge and toPos on toEdge */ - SUMOReal getDistanceBetween(SUMOReal fromPos, SUMOReal toPos, const MSEdge* fromEdge, const MSEdge* toEdge, bool includeInternal = true) const; + double getDistanceBetween(double fromPos, double toPos, const MSEdge* fromEdge, const MSEdge* toEdge, bool includeInternal = true) const; /** @brief Compute the distance between 2 given edges on this route, including the length of internal lanes. * This has the same semantics as above but uses iterators instead of edge @@ -154,7 +154,7 @@ * @param[in] includeInternal Whether the lengths of internal edges shall be counted * @return distance between the position fromPos on fromEdge and toPos on toEdge */ - SUMOReal getDistanceBetween(SUMOReal fromPos, SUMOReal toPos, const MSRouteIterator& fromEdge, const MSRouteIterator& toEdge, bool includeInternal = true) const; + double getDistanceBetween(double fromPos, double toPos, const MSRouteIterator& fromEdge, const MSRouteIterator& toEdge, bool includeInternal = true) const; /// Returns the color const RGBColor& getColor() const; @@ -163,7 +163,7 @@ * * @return The route's costs (normally the time needed to pass it) */ - SUMOReal getCosts() const { + double getCosts() const { return myCosts; } @@ -171,7 +171,7 @@ * * @param[in] costs The new route costs */ - void setCosts(SUMOReal costs) { + void setCosts(double costs) { myCosts = costs; } @@ -243,7 +243,7 @@ const RGBColor* const myColor; /// @brief The assigned or calculated costs - SUMOReal myCosts; + double myCosts; /// @brief List of the stops on the parsed route std::vector myStops; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSRouteHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSRouteHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSRouteHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSRouteHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Mon, 9 Jul 2001 -/// @version $Id: MSRouteHandler.cpp 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: MSRouteHandler.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Parser and container for routes during their loading /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -57,10 +57,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members @@ -78,7 +74,8 @@ myActiveContainerPlan(0), myAddVehiclesDirectly(addVehiclesDirectly), myCurrentVTypeDistribution(0), - myCurrentRouteDistribution(0) { + myCurrentRouteDistribution(0), + myAmLoadingState(false) { myActiveRoute.reserve(100); } @@ -217,18 +214,18 @@ if (attrs.hasAttribute(SUMO_ATTR_DURATION) && duration <= 0) { throw ProcessError("Non-positive walking duration for '" + myVehicleParameter->id + "'."); } - SUMOReal speed = DEFAULT_PEDESTRIAN_SPEED; + double speed = DEFAULT_PEDESTRIAN_SPEED; const MSVehicleType* vtype = MSNet::getInstance()->getVehicleControl().getVType(myVehicleParameter->vtypeid, &myParsingRNG); // need to check for explicitly set speed since we might have // DEFAULT_VEHTYPE - if (vtype != 0 && vtype->wasSet(VTYPEPARS_MAXSPEED_SET)) { - speed = vtype->getMaxSpeed(); + if (vtype != 0) { + speed = vtype->getMaxSpeed() * vtype->computeChosenSpeedDeviation(&myParsingRNG); } - speed = attrs.getOpt(SUMO_ATTR_SPEED, 0, ok, speed); + speed = attrs.getOpt(SUMO_ATTR_SPEED, 0, ok, speed); if (speed <= 0) { throw ProcessError("Non-positive walking speed for '" + myVehicleParameter->id + "'."); } - SUMOReal departPos = 0; - SUMOReal arrivalPos = 0; + double departPos = 0; + double arrivalPos = 0; MSStoppingPlace* bs = 0; if (attrs.hasAttribute(SUMO_ATTR_EDGES)) { MSEdge::parseEdgesList(attrs.get(SUMO_ATTR_EDGES, myVehicleParameter->id.c_str(), ok), myActiveRoute, myActiveRouteID); @@ -271,7 +268,8 @@ myActivePlan->push_back(new MSTransportable::Stage_Waiting( *myActiveRoute.front(), -1, myVehicleParameter->depart, departPos, "start", true)); } - myActivePlan->push_back(new MSPerson::MSPersonStage_Walking(myActiveRoute, bs, duration, speed, departPos, arrivalPos)); + const double departPosLat = attrs.getOpt(SUMO_ATTR_DEPARTPOS_LAT, 0, ok, 0); + myActivePlan->push_back(new MSPerson::MSPersonStage_Walking(myActiveRoute, bs, duration, speed, departPos, arrivalPos, departPosLat)); myActiveRoute.clear(); } catch (ProcessError&) { deleteActivePlans(); @@ -324,15 +322,15 @@ case SUMO_TAG_TRANSHIP: { myActiveRoute.clear(); bool ok = true; - SUMOReal departPos = attrs.getOpt(SUMO_ATTR_DEPARTPOS, myVehicleParameter->id.c_str(), ok, 0); - SUMOReal arrivalPos = attrs.getOpt(SUMO_ATTR_ARRIVALPOS, myVehicleParameter->id.c_str(), ok, -NUMERICAL_EPS); - SUMOReal speed = DEFAULT_CONTAINER_TRANSHIP_SPEED; + double departPos = attrs.getOpt(SUMO_ATTR_DEPARTPOS, myVehicleParameter->id.c_str(), ok, 0); + double arrivalPos = attrs.getOpt(SUMO_ATTR_ARRIVALPOS, myVehicleParameter->id.c_str(), ok, -NUMERICAL_EPS); + double speed = DEFAULT_CONTAINER_TRANSHIP_SPEED; const MSVehicleType* vtype = MSNet::getInstance()->getVehicleControl().getVType(myVehicleParameter->vtypeid); // need to check for explicitly set speed since we might have // DEFAULT_VEHTYPE if (vtype != 0 && vtype->wasSet(VTYPEPARS_MAXSPEED_SET)) { speed = vtype->getMaxSpeed(); } - speed = attrs.getOpt(SUMO_ATTR_SPEED, 0, ok, speed); + speed = attrs.getOpt(SUMO_ATTR_SPEED, 0, ok, speed); if (speed <= 0) { throw ProcessError("Non-positive tranship speed for container '" + myVehicleParameter->id + "'."); } @@ -423,7 +421,7 @@ if (type == 0) { throw ProcessError("Unknown vtype '" + vtypeID + "' in distribution '" + myCurrentVTypeDistributionID + "'."); } - myCurrentVTypeDistribution->add(type->getDefaultProbability(), type); + myCurrentVTypeDistribution->add(type, type->getDefaultProbability()); } } } @@ -485,9 +483,9 @@ if (myActiveRouteRefID != "" && MSRoute::dictionary(myActiveRouteRefID, &myParsingRNG) == 0) { WRITE_ERROR("Invalid reference to route '" + myActiveRouteRefID + "' in route " + rid + "."); } - myActiveRouteProbability = attrs.getOpt(SUMO_ATTR_PROB, myActiveRouteID.c_str(), ok, DEFAULT_VEH_PROB); + myActiveRouteProbability = attrs.getOpt(SUMO_ATTR_PROB, myActiveRouteID.c_str(), ok, DEFAULT_VEH_PROB); myActiveRouteColor = attrs.hasAttribute(SUMO_ATTR_COLOR) ? new RGBColor(attrs.get(SUMO_ATTR_COLOR, myActiveRouteID.c_str(), ok)) : 0; - myCurrentCosts = attrs.getOpt(SUMO_ATTR_COST, myActiveRouteID.c_str(), ok, -1); + myCurrentCosts = attrs.getOpt(SUMO_ATTR_COST, myActiveRouteID.c_str(), ok, -1); if (ok && myCurrentCosts != -1 && myCurrentCosts < 0) { WRITE_ERROR("Invalid cost for route '" + myActiveRouteID + "'."); } @@ -510,7 +508,7 @@ } } else { if (myCurrentVTypeDistribution != 0) { - myCurrentVTypeDistribution->add(vehType->getDefaultProbability(), vehType); + myCurrentVTypeDistribution->add(vehType, vehType->getDefaultProbability()); } } } @@ -547,7 +545,7 @@ if (myActiveRouteRefID != "" && myCurrentRouteDistribution != 0) { const MSRoute* route = MSRoute::dictionary(myActiveRouteRefID, &myParsingRNG); if (route != 0) { - if (myCurrentRouteDistribution->add(myActiveRouteProbability, route)) { + if (myCurrentRouteDistribution->add(route, myActiveRouteProbability)) { route->addReference(); } } @@ -584,7 +582,7 @@ } } else { if (myCurrentRouteDistribution != 0) { - if (myCurrentRouteDistribution->add(myActiveRouteProbability, route)) { + if (myCurrentRouteDistribution->add(route, myActiveRouteProbability)) { route->addReference(); } } @@ -614,12 +612,12 @@ } } myCurrentRouteDistribution = new RandomDistributor(); - std::vector probs; + std::vector probs; if (attrs.hasAttribute(SUMO_ATTR_PROBS)) { bool ok = true; StringTokenizer st(attrs.get(SUMO_ATTR_PROBS, myCurrentRouteDistributionID.c_str(), ok)); while (st.hasNext()) { - probs.push_back(TplConvert::_2SUMORealSec(st.next().c_str(), 1.0)); + probs.push_back(TplConvert::_2doubleSec(st.next().c_str(), 1.0)); } } if (attrs.hasAttribute(SUMO_ATTR_ROUTES)) { @@ -632,8 +630,8 @@ if (route == 0) { throw ProcessError("Unknown route '" + routeID + "' in distribution '" + myCurrentRouteDistributionID + "'."); } - const SUMOReal prob = ((int)probs.size() > probIndex ? probs[probIndex] : 1.0); - if (myCurrentRouteDistribution->add(prob, route, false)) { + const double prob = ((int)probs.size() > probIndex ? probs[probIndex] : 1.0); + if (myCurrentRouteDistribution->add(route, prob, false)) { route->addReference(); } probIndex++; @@ -675,7 +673,7 @@ MSVehicleControl& vehControl = MSNet::getInstance()->getVehicleControl(); if (myVehicleParameter->departProcedure == DEPART_GIVEN) { // let's check whether this vehicle had to depart before the simulation starts - if (!(myAddVehiclesDirectly || checkLastDepart()) || myVehicleParameter->depart < string2time(OptionsCont::getOptions().getString("begin"))) { + if (!(myAddVehiclesDirectly || checkLastDepart()) || (myVehicleParameter->depart < string2time(OptionsCont::getOptions().getString("begin")) && !myAmLoadingState)) { if (route != 0) { route->addReference(); route->release(); @@ -693,6 +691,9 @@ if (vtype == 0) { throw ProcessError("The vehicle type '" + myVehicleParameter->vtypeid + "' for vehicle '" + myVehicleParameter->id + "' is not known."); } + if (vtype->getVehicleClass() == SVC_PEDESTRIAN) { + WRITE_WARNING("Vehicle type '" + vtype->getID() + "' with vClass=pedestrian should only be used for persons and not for vehicle '" + myVehicleParameter->id + "'."); + } } else { // there should be one (at least the default one) vtype = vehControl.getVType(DEFAULT_VTYPE_ID, &myParsingRNG); @@ -856,7 +857,10 @@ void MSRouteHandler::closeFlow() { + myInsertStopEdgesAt = -1; if (myVehicleParameter->repetitionNumber == 0) { + delete myVehicleParameter; + myVehicleParameter = 0; return; } // let's check whether vehicles had to depart before the simulation starts @@ -866,6 +870,8 @@ while (myVehicleParameter->repetitionsDone * myVehicleParameter->repetitionOffset < offsetToBegin) { myVehicleParameter->repetitionsDone++; if (myVehicleParameter->repetitionsDone == myVehicleParameter->repetitionNumber) { + delete myVehicleParameter; + myVehicleParameter = 0; return; } } @@ -892,7 +898,6 @@ } } myVehicleParameter = 0; - myInsertStopEdgesAt = -1; } @@ -919,7 +924,7 @@ // ok, we have a bus stop MSStoppingPlace* bs = MSNet::getInstance()->getBusStop(stop.busstop); if (bs == 0) { - WRITE_ERROR("The bus stop '" + stop.busstop + "' is not known" + errorSuffix); + WRITE_ERROR("The busStop '" + stop.busstop + "' is not known" + errorSuffix); return; } const MSLane& l = bs->getLane(); @@ -932,7 +937,7 @@ // ok, we have obviously a container stop MSStoppingPlace* cs = MSNet::getInstance()->getContainerStop(stop.containerstop); if (cs == 0) { - WRITE_ERROR("The container stop '" + stop.containerstop + "' is not known" + errorSuffix); + WRITE_ERROR("The containerStop '" + stop.containerstop + "' is not known" + errorSuffix); return; } const MSLane& l = cs->getLane(); @@ -940,6 +945,19 @@ stop.endPos = cs->getEndLanePosition(); stop.startPos = cs->getBeginLanePosition(); edge = &l.getEdge(); + } //try to parse the assigned parking area + else if (stop.parkingarea != "") { + // ok, we have obviously a parking area + MSStoppingPlace* pa = MSNet::getInstance()->getParkingArea(stop.parkingarea); + if (pa == 0) { + WRITE_ERROR("The parkingArea '" + stop.parkingarea + "' is not known" + errorSuffix); + return; + } + const MSLane& l = pa->getLane(); + stop.lane = l.getID(); + stop.endPos = pa->getEndLanePosition(); + stop.startPos = pa->getBeginLanePosition(); + edge = &l.getEdge(); } else if (stop.chargingStation != "") { // ok, we have a charging station MSChargingStation* cs = MSNet::getInstance()->getChargingStation(stop.chargingStation); @@ -949,7 +967,7 @@ stop.endPos = cs->getEndLanePosition(); stop.startPos = cs->getBeginLanePosition(); } else { - WRITE_ERROR("The charging station '" + stop.chargingStation + "' is not known" + errorSuffix); + WRITE_ERROR("The chargingStation '" + stop.chargingStation + "' is not known" + errorSuffix); return; } } else { @@ -976,7 +994,7 @@ stop.startPos = stop.endPos - POSITION_EPS; } } else { - WRITE_ERROR("A stop must be placed on a bus stop, a charging station, a container stop or a lane" + errorSuffix); + WRITE_ERROR("A stop must be placed on a busStop, a chargingStation, a containerStop a parkingArea or a lane" + errorSuffix); return; } } @@ -999,12 +1017,12 @@ myActiveContainerPlan->push_back(new MSTransportable::Stage_Waiting( MSLane::dictionary(stop.lane)->getEdge(), -1, myVehicleParameter->depart, myVehicleParameter->departPos, "start", true)); } - stop.endPos = attrs.getOpt(SUMO_ATTR_ENDPOS, 0, ok, MSLane::dictionary(stop.lane)->getLength()); + stop.endPos = attrs.getOpt(SUMO_ATTR_ENDPOS, 0, ok, MSLane::dictionary(stop.lane)->getLength()); if (attrs.hasAttribute(SUMO_ATTR_POSITION)) { WRITE_WARNING("Deprecated attribute 'pos' in description of stop" + errorSuffix); - stop.endPos = attrs.getOpt(SUMO_ATTR_POSITION, 0, ok, stop.endPos); + stop.endPos = attrs.getOpt(SUMO_ATTR_POSITION, 0, ok, stop.endPos); } - stop.startPos = attrs.getOpt(SUMO_ATTR_STARTPOS, 0, ok, MAX2((SUMOReal)0., stop.endPos - 2 * POSITION_EPS)); + stop.startPos = attrs.getOpt(SUMO_ATTR_STARTPOS, 0, ok, MAX2(0., stop.endPos - 2 * POSITION_EPS)); const bool friendlyPos = attrs.getOpt(SUMO_ATTR_FRIENDLY_POS, 0, ok, false); if (!ok || !checkStopPos(stop.startPos, stop.endPos, MSLane::dictionary(stop.lane)->getLength(), POSITION_EPS, friendlyPos)) { WRITE_ERROR("Invalid start or end position for stop on lane '" + stop.lane + "'" + errorSuffix); @@ -1013,7 +1031,7 @@ } if (myActivePlan != 0) { std::string actType = attrs.getOpt(SUMO_ATTR_ACTTYPE, 0, ok, "waiting"); - SUMOReal pos = (stop.startPos + stop.endPos) / 2.; + double pos = (stop.startPos + stop.endPos) / 2.; if (!myActivePlan->empty()) { pos = myActivePlan->back()->getArrivalPos(); } @@ -1038,7 +1056,7 @@ void MSRouteHandler::parseWalkPositions(const SUMOSAXAttributes& attrs, const std::string& personID, const MSEdge* fromEdge, const MSEdge*& toEdge, - SUMOReal& departPos, SUMOReal& arrivalPos, MSStoppingPlace*& bs, bool& ok) { + double& departPos, double& arrivalPos, MSStoppingPlace*& bs, bool& ok) { const std::string description = "person '" + personID + "' walking from " + fromEdge->getID(); departPos = parseWalkPos(SUMO_ATTR_DEPARTPOS, description, fromEdge, @@ -1059,8 +1077,8 @@ } arrivalPos = (bs->getBeginLanePosition() + bs->getEndLanePosition()) / 2.; if (attrs.hasAttribute(SUMO_ATTR_ARRIVALPOS)) { - const SUMOReal arrPos = parseWalkPos(SUMO_ATTR_ARRIVALPOS, description, toEdge, - attrs.get(SUMO_ATTR_ARRIVALPOS, description.c_str(), ok)); + const double arrPos = parseWalkPos(SUMO_ATTR_ARRIVALPOS, description, toEdge, + attrs.get(SUMO_ATTR_ARRIVALPOS, description.c_str(), ok)); if (arrPos >= bs->getBeginLanePosition() && arrPos < bs->getEndLanePosition()) { arrivalPos = arrPos; } else { @@ -1081,9 +1099,9 @@ } -SUMOReal +double MSRouteHandler::parseWalkPos(SumoXMLAttr attr, const std::string& id, const MSEdge* edge, const std::string& val) { - SUMOReal result; + double result; std::string error; ArrivalPosDefinition proc; // only supports 'random' and 'max' diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSRouteHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSRouteHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSRouteHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSRouteHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 9 Jul 2001 -/// @version $Id: MSRouteHandler.h 20462 2016-04-15 12:20:52Z luecken $ +/// @version $Id: MSRouteHandler.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Parser and container for routes during their loading /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -129,7 +129,7 @@ void closeRouteDistribution(); /// Ends the processing of a vehicle - void closeVehicle(); + virtual void closeVehicle(); /// Ends the processing of a person void closePerson(); @@ -146,8 +146,8 @@ ///@ brief parse depart- and arrival positions of a walk void parseWalkPositions(const SUMOSAXAttributes& attrs, const std::string& personID, const MSEdge* fromEdge, const MSEdge*& toEdge, - SUMOReal& departPos, SUMOReal& arrivalPos, MSStoppingPlace*& bs, bool& ok); - SUMOReal parseWalkPos(SumoXMLAttr attr, const std::string& id, const MSEdge* edge, const std::string& val); + double& departPos, double& arrivalPos, MSStoppingPlace*& bs, bool& ok); + double parseWalkPos(SumoXMLAttr attr, const std::string& id, const MSEdge* edge, const std::string& val); protected: /// @brief The current route @@ -174,6 +174,9 @@ /// @brief The id of the currently parsed route distribution std::string myCurrentRouteDistributionID; + /// @brief whether a state file is being loaded + bool myAmLoadingState; + /// @brief A random number generator used to choose from vtype/route distributions and computing the speed factors static MTRand myParsingRNG; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSStateHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSStateHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSStateHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSStateHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Thu, 13 Dec 2012 -/// @version $Id: MSStateHandler.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSStateHandler.cpp 23652 2017-03-24 11:42:34Z namdre $ /// // Parser and output filter for routes and vehicles state saving and loading /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 200122014 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -44,6 +45,7 @@ #include #include #include +#include #include #include #include "MSStateHandler.h" @@ -51,24 +53,24 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== MSStateHandler::MSStateHandler(const std::string& file, const SUMOTime offset) : - SUMOSAXHandler(file), myOffset(offset), + MSRouteHandler(file, true), + myOffset(offset), mySegment(0), myEdgeAndLane(0, -1), - myCurrentVType(0) { + myAttrs(0), + myLastParameterised(0) { + myAmLoadingState = true; + const std::vector vehIDs = OptionsCont::getOptions().getStringVector("load-state.remove-vehicles"); + myVehiclesToRemove.insert(vehIDs.begin(), vehIDs.end()); } MSStateHandler::~MSStateHandler() { - delete myCurrentVType; } @@ -76,9 +78,11 @@ MSStateHandler::saveState(const std::string& file, SUMOTime step) { OutputDevice& out = OutputDevice::getDevice(file); out.writeHeader(SUMO_TAG_SNAPSHOT); + out.writeAttr("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance").writeAttr("xsi:noNamespaceSchemaLocation", "http://sumo.dlr.de/xsd/state_file.xsd"); out.writeAttr(SUMO_ATTR_VERSION, VERSION_STRING).writeAttr(SUMO_ATTR_TIME, time2string(step)); MSRoute::dict_saveState(out); MSNet::getInstance()->getVehicleControl().saveState(out); + MSVehicleTransfer::getInstance()->saveState(out); if (MSGlobals::gUseMesoSim) { for (int i = 0; i < MSEdge::dictSize(); i++) { for (MESegment* s = MSGlobals::gMesoNet->getSegmentForEdge(*MSEdge::getAllEdges()[i]); s != 0; s = s->getNextSegment()) { @@ -99,6 +103,7 @@ void MSStateHandler::myStartElement(int element, const SUMOSAXAttributes& attrs) { + MSRouteHandler::myStartElement(element, attrs); MSVehicleControl& vc = MSNet::getInstance()->getVehicleControl(); switch (element) { case SUMO_TAG_SNAPSHOT: { @@ -117,86 +122,21 @@ attrs.getFloat(SUMO_ATTR_TIME)); break; } - case SUMO_TAG_ROUTE: { - const std::string id = attrs.getString(SUMO_ATTR_ID); - if (MSRoute::dictionary(id) == 0) { - ConstMSEdgeVector edges; - MSEdge::parseEdgesList(attrs.getString(SUMO_ATTR_EDGES), edges, id); - MSRoute* r = new MSRoute(id, edges, attrs.getBool(SUMO_ATTR_STATE), - 0, std::vector()); - MSRoute::dictionary(id, r); - } + case SUMO_TAG_VTYPE: { + myLastParameterised = myCurrentVType; break; } - case SUMO_TAG_ROUTE_DISTRIBUTION: { - const std::string id = attrs.getString(SUMO_ATTR_ID); - if (MSRoute::dictionary(id) == 0) { - RandomDistributor* dist = new RandomDistributor(); - std::vector routeIDs; - std::istringstream iss(attrs.getString(SUMO_ATTR_PROBS)); - SUMOSAXAttributes::parseStringVector(attrs.getString(SUMO_ATTR_ROUTES), routeIDs); - for (std::vector::const_iterator it = routeIDs.begin(); it != routeIDs.end(); ++it) { - SUMOReal prob; - iss >> prob; - const MSRoute* r = MSRoute::dictionary(*it); - assert(r != 0); - dist->add(prob, r, false); - r->addReference(); - } - MSRoute::dictionary(id, dist, attrs.getBool(SUMO_ATTR_STATE)); - } + case SUMO_TAG_VEHICLE: { + myLastParameterised = myVehicleParameter; + myAttrs = attrs.clone(); break; } - case SUMO_TAG_VTYPE: { - myCurrentVType = SUMOVehicleParserHelper::beginVTypeParsing(attrs, getFileName()); + case SUMO_TAG_DEVICE: { + myDeviceAttrs.push_back(attrs.clone()); break; } - case SUMO_TAG_VTYPE_DISTRIBUTION: { - const std::string id = attrs.getString(SUMO_ATTR_ID); - if (vc.getVType(id) == 0) { - RandomDistributor* dist = new RandomDistributor(); - std::vector typeIDs; - std::istringstream iss(attrs.getString(SUMO_ATTR_PROBS)); - SUMOSAXAttributes::parseStringVector(attrs.getString(SUMO_ATTR_VTYPES), typeIDs); - for (std::vector::const_iterator it = typeIDs.begin(); it != typeIDs.end(); ++it) { - SUMOReal prob; - iss >> prob; - MSVehicleType* t = vc.getVType(*it); - assert(t != 0); - dist->add(prob, t, false); - } - vc.addVTypeDistribution(id, dist); - } - break; - } - case SUMO_TAG_VEHICLE: { - SUMOVehicleParameter* p = new SUMOVehicleParameter(); - p->id = attrs.getString(SUMO_ATTR_ID); - p->depart = string2time(attrs.getString(SUMO_ATTR_DEPART)) - myOffset; - p->routeid = attrs.getString(SUMO_ATTR_ROUTE); - p->vtypeid = attrs.getString(SUMO_ATTR_TYPE); - const MSRoute* route = MSRoute::dictionary(p->routeid); - const MSVehicleType* type = vc.getVType(p->vtypeid); - assert(route != 0); - assert(type != 0); - assert(vc.getVehicle(p->id) == 0); - - SUMOVehicle* v = vc.buildVehicle(p, route, type, true); - vc.discountStateLoaded(); // already included (see SUMO_TAG_DELAY) - v->loadState(attrs, myOffset); - if (!vc.addVehicle(p->id, v)) { - throw ProcessError("Error: Could not build vehicle " + p->id + "!"); - } - if (!v->hasDeparted()) { - // !!! the save did not keep the order in which the vehicles are checked for insertion - MSNet::getInstance()->getInsertionControl().add(v); - } else { - // vehicle already departed: disable pre-insertion rerouting and enable regular routing behavior - MSDevice_Routing* routingDevice = static_cast(v->getDevice(typeid(MSDevice_Routing))); - if (routingDevice != 0) { - routingDevice->notifyEnter(*v, MSMoveReminder::NOTIFICATION_DEPARTED); - } - } + case SUMO_TAG_VEHICLETRANSFER: { + MSVehicleTransfer::getInstance()->loadState(attrs, myOffset, vc); break; } case SUMO_TAG_SEGMENT: { @@ -229,28 +169,72 @@ } break; } - default: - // parse embedded vtype information - if (myCurrentVType != 0) { - SUMOVehicleParserHelper::parseVTypeEmbedded(*myCurrentVType, element, attrs); + case SUMO_TAG_PARAM: { + bool ok; + const std::string key = attrs.get(SUMO_ATTR_KEY, 0, ok); + // circumventing empty string test + const std::string val = attrs.hasAttribute(SUMO_ATTR_VALUE) ? attrs.getString(SUMO_ATTR_VALUE) : ""; + assert(myLastParameterised != 0); + if (myLastParameterised != 0) { + myLastParameterised->addParameter(key, val); } break; + } + default: + break; } } void MSStateHandler::myEndElement(int element) { - switch (element) { - case SUMO_TAG_VTYPE: - MSNet::getInstance()->getVehicleControl().addVType(MSVehicleType::build(*myCurrentVType)); - delete myCurrentVType; - myCurrentVType = 0; - break; - default: - break; + MSRouteHandler::myEndElement(element); + if (element != SUMO_TAG_PARAM && myVehicleParameter == 0 && myCurrentVType == 0) { + myLastParameterised = 0; } } +void +MSStateHandler::closeVehicle() { + assert(myVehicleParameter != 0); + myVehicleParameter->depart -= myOffset; + // the vehicle was already counted in MSVehicleControl::setState + MSVehicleControl& vc = MSNet::getInstance()->getVehicleControl(); + // make a copy because myVehicleParameter is reset in closeVehicle() + const std::string vehID = myVehicleParameter->id; + if (myVehiclesToRemove.count(vehID) == 0) { + MSRouteHandler::closeVehicle(); + // reset depart + vc.discountStateLoaded(); + SUMOVehicle* v = vc.getVehicle(vehID); + v->loadState(*myAttrs, myOffset); + if (v->hasDeparted()) { + // vehicle already departed: disable pre-insertion rerouting and enable regular routing behavior + MSDevice_Routing* routingDevice = static_cast(v->getDevice(typeid(MSDevice_Routing))); + if (routingDevice != 0) { + routingDevice->notifyEnter(*v, MSMoveReminder::NOTIFICATION_DEPARTED); + } + MSNet::getInstance()->getInsertionControl().alreadyDeparted(v); + } + while (!myDeviceAttrs.empty()) { + const std::string attrID = myDeviceAttrs.back()->getString(SUMO_ATTR_ID); + for (std::vector::const_iterator dev = v->getDevices().begin(); dev != v->getDevices().end(); ++dev) { + if ((*dev)->getID() == attrID) { + (*dev)->loadState(*myDeviceAttrs.back()); + } + } + delete myDeviceAttrs.back(); + myDeviceAttrs.pop_back(); + } + } else { + vc.discountStateLoaded(true); + delete myVehicleParameter; + myVehicleParameter = 0; + } + delete myAttrs; +} + + + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSStateHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSStateHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSStateHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSStateHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Thu, 13 Dec 2012 -/// @version $Id: MSStateHandler.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSStateHandler.h 23497 2017-03-17 09:29:56Z behrisch $ /// // Parser and output filter for routes and vehicles state saving and loading /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,7 +33,7 @@ #endif #include -#include +#include "MSRouteHandler.h" // =========================================================================== @@ -49,7 +49,7 @@ * @class MSStateHandler * @brief Parser and output filter for routes and vehicles state saving and loading */ -class MSStateHandler : public SUMOSAXHandler { +class MSStateHandler : public MSRouteHandler { public: /// standard constructor MSStateHandler(const std::string& file, const SUMOTime offset); @@ -91,6 +91,8 @@ void myEndElement(int element); //@} + /// Ends the processing of a vehicle + void closeVehicle(); private: const SUMOTime myOffset; @@ -99,8 +101,18 @@ std::pair myEdgeAndLane; int myQueIndex; - /// @brief The currently parsed vehicle type - SUMOVTypeParameter* myCurrentVType; + /// @brief cached attrs (used when loading vehicles) + SUMOSAXAttributes* myAttrs; + + /// @brief cached device attrs (used when loading vehicles) + std::vector myDeviceAttrs; + + /// @brief the last object that potentially carries parameters + Parameterised* myLastParameterised; + + /// @brief vehicles that shall be removed when loading state + std::set myVehiclesToRemove; + private: /// @brief Invalidated copy constructor diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSStoppingPlace.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSStoppingPlace.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSStoppingPlace.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSStoppingPlace.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 13.12.2005 -/// @version $Id: MSStoppingPlace.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSStoppingPlace.cpp 23648 2017-03-24 10:35:01Z laemmel $ /// // A lane area vehicles can halt at /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,10 +38,6 @@ #include "MSTransportable.h" #include "MSStoppingPlace.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -49,9 +45,9 @@ MSStoppingPlace::MSStoppingPlace(const std::string& id, const std::vector& lines, MSLane& lane, - SUMOReal begPos, SUMOReal endPos) + double begPos, double endPos, const std::string name) : Named(id), myLines(lines), myLane(lane), - myBegPos(begPos), myEndPos(endPos), myLastFreePos(endPos), myWaitingPos(endPos) { + myBegPos(begPos), myEndPos(endPos), myLastFreePos(endPos), myWaitingPos(endPos), myName(name) { computeLastFreePos(); } @@ -65,26 +61,26 @@ } -SUMOReal +double MSStoppingPlace::getBeginLanePosition() const { return myBegPos; } -SUMOReal +double MSStoppingPlace::getEndLanePosition() const { return myEndPos; } void -MSStoppingPlace::enter(SUMOVehicle* what, SUMOReal beg, SUMOReal end) { - myEndPositions[what] = std::pair(beg, end); +MSStoppingPlace::enter(SUMOVehicle* what, double beg, double end) { + myEndPositions[what] = std::pair(beg, end); computeLastFreePos(); } -SUMOReal +double MSStoppingPlace::getLastFreePos(const SUMOVehicle& forVehicle) const { if (myLastFreePos != myEndPos) { return myLastFreePos - forVehicle.getVehicleType().getMinGap(); @@ -99,9 +95,9 @@ } -SUMOReal +double MSStoppingPlace::getStoppingPosition(const SUMOVehicle* veh) const { - std::map >::const_iterator i = myEndPositions.find(veh); + std::map >::const_iterator i = myEndPositions.find(veh); if (i != myEndPositions.end()) { return i->second.second; } else { @@ -142,7 +138,7 @@ void MSStoppingPlace::computeLastFreePos() { myLastFreePos = myEndPos; - std::map >::iterator i; + std::map >::iterator i; for (i = myEndPositions.begin(); i != myEndPositions.end(); i++) { if (myLastFreePos > (*i).second.second) { myLastFreePos = (*i).second.second; @@ -156,7 +152,7 @@ if (edge == &myLane.getEdge()) { return true; } - for (std::multimap::const_iterator i = myAccessPos.begin(); i != myAccessPos.end(); ++i) { + for (std::multimap::const_iterator i = myAccessPos.begin(); i != myAccessPos.end(); ++i) { if (edge == &i->first->getEdge()) { return true; } @@ -164,5 +160,11 @@ return false; } + +const std::string& +MSStoppingPlace::getMyName() const { + return myName; +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSStoppingPlace.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSStoppingPlace.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSStoppingPlace.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSStoppingPlace.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 13.12.2005 -/// @version $Id: MSStoppingPlace.h 21648 2016-10-10 13:20:00Z luecken $ +/// @version $Id: MSStoppingPlace.h 23648 2017-03-24 10:35:01Z laemmel $ /// // A lane area vehicles can halt at /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -75,7 +75,7 @@ */ MSStoppingPlace(const std::string& id, const std::vector& lines, MSLane& lane, - SUMOReal begPos, SUMOReal endPos); + double begPos, double endPos, const std::string name = ""); /// @brief Destructor @@ -93,14 +93,14 @@ * * @return The position the stop begins at */ - SUMOReal getBeginLanePosition() const; + double getBeginLanePosition() const; /** @brief Returns the end position of this stop * * @return The position the stop ends at */ - SUMOReal getEndLanePosition() const; + double getEndLanePosition() const; /** @brief Called if a vehicle enters this stop @@ -114,7 +114,7 @@ * @param[in] what The end halting position of the vehicle * @see computeLastFreePos */ - void enter(SUMOVehicle* what, SUMOReal beg, SUMOReal end); + void enter(SUMOVehicle* what, double beg, double end); /** @brief Called if a vehicle leaves this stop @@ -133,7 +133,7 @@ * * @return The last free position of this bus stop */ - SUMOReal getLastFreePos(const SUMOVehicle& forVehicle) const; + double getLastFreePos(const SUMOVehicle& forVehicle) const; /** @brief Returns the next free waiting place for pedestrians / containers @@ -147,7 +147,7 @@ * position of the vehicle. For all others the last free stopping position * */ - SUMOReal getStoppingPosition(const SUMOVehicle* veh) const; + double getStoppingPosition(const SUMOVehicle* veh) const; /** @brief Returns the number of transportables waiting on this stop */ @@ -162,7 +162,7 @@ void removeTransportable(MSTransportable* p); /// @brief adds an access point to this stop - virtual void addAccess(MSLane* lane, const SUMOReal pos) { + virtual void addAccess(MSLane* lane, const double pos) { myAccessPos.insert(std::make_pair(lane, pos)); } @@ -184,28 +184,34 @@ std::vector myLines; /// @brief A map from objects (vehicles) to the areas they acquire after entering the stop - std::map > myEndPositions; + std::map > myEndPositions; /// @brief The lane this bus stop is located at const MSLane& myLane; /// @brief The begin position this bus stop is located at - const SUMOReal myBegPos; + const double myBegPos; /// @brief The end position this bus stop is located at - const SUMOReal myEndPos; + const double myEndPos; /// @brief The last free position at this stop (variable) - SUMOReal myLastFreePos; + double myLastFreePos; /// @brief The next free position for persons / containers - SUMOReal myWaitingPos; + double myWaitingPos; + + /// @brief The name of the stopping place + const std::string myName; +public: + const std::string& getMyName() const; +protected: /// @brief Persons waiting at this stop std::vector myWaitingTransportables; /// @brief lanes and positions connected to this stop - std::multimap myAccessPos; + std::multimap myAccessPos; private: /// @brief Invalidated copy constructor. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSTransportableControl.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSTransportableControl.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSTransportableControl.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSTransportableControl.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Mon, 9 Jul 2001 -/// @version $Id: MSTransportableControl.cpp 21217 2016-07-22 10:57:44Z behrisch $ +/// @version $Id: MSTransportableControl.cpp 23959 2017-04-18 09:35:14Z namdre $ /// // Stores all persons in the net and handles their waiting for cars. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,10 +42,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -112,7 +108,11 @@ void MSTransportableControl::setWaitEnd(const SUMOTime time, MSTransportable* transportable) { const SUMOTime step = time % DELTA_T == 0 ? time : (time / DELTA_T + 1) * DELTA_T; - myWaitingUntil[step].push_back(transportable); + // avoid double registration + const TransportableVector& transportables = myWaiting4Departure[step]; + if (std::find(transportables.begin(), transportables.end(), transportable) == transportables.end()) { + myWaitingUntil[step].push_back(transportable); + } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSTransportableControl.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSTransportableControl.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSTransportableControl.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSTransportableControl.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Mon, 9 Jul 2001 -/// @version $Id: MSTransportableControl.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSTransportableControl.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Stores all persons or containers in the net and handles their waiting for cars. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSTransportable.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSTransportable.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSTransportable.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSTransportable.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Andreas Kendziorra /// @author Michael Behrisch /// @date Thu, 12 Jun 2014 -/// @version $Id: MSTransportable.cpp 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: MSTransportable.cpp 23840 2017-04-06 08:45:47Z namdre $ /// // The common superclass for modelling transportable objects like persons and containers /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,14 +39,10 @@ #include "MSTransportableControl.h" #include "MSTransportable.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - /* ------------------------------------------------------------------------- * static member definitions * ----------------------------------------------------------------------- */ -const SUMOReal MSTransportable::ROADSIDE_OFFSET(3); +const double MSTransportable::ROADSIDE_OFFSET(3); // =========================================================================== // method definitions @@ -54,7 +50,7 @@ /* ------------------------------------------------------------------------- * MSTransportable::Stage - methods * ----------------------------------------------------------------------- */ -MSTransportable::Stage::Stage(const MSEdge& destination, MSStoppingPlace* toStop, const SUMOReal arrivalPos, StageType type) +MSTransportable::Stage::Stage(const MSEdge& destination, MSStoppingPlace* toStop, const double arrivalPos, StageType type) : myDestination(destination), myDestinationStop(toStop), myArrivalPos(arrivalPos), myDeparted(-1), myArrived(-1), myType(type) {} MSTransportable::Stage::~Stage() {} @@ -83,17 +79,17 @@ } Position -MSTransportable::Stage::getEdgePosition(const MSEdge* e, SUMOReal at, SUMOReal offset) const { +MSTransportable::Stage::getEdgePosition(const MSEdge* e, double at, double offset) const { return getLanePosition(e->getLanes()[0], at, offset); } Position -MSTransportable::Stage::getLanePosition(const MSLane* lane, SUMOReal at, SUMOReal offset) const { +MSTransportable::Stage::getLanePosition(const MSLane* lane, double at, double offset) const { return lane->getShape().positionAtOffset(lane->interpolateLanePosToGeometryPos(at), offset); } -SUMOReal -MSTransportable::Stage::getEdgeAngle(const MSEdge* e, SUMOReal at) const { +double +MSTransportable::Stage::getEdgeAngle(const MSEdge* e, double at) const { return e->getLanes()[0]->getShape().rotationAtOffset(at); } @@ -102,7 +98,7 @@ * MSTransportable::Stage_Waiting - methods * ----------------------------------------------------------------------- */ MSTransportable::Stage_Waiting::Stage_Waiting(const MSEdge& destination, - SUMOTime duration, SUMOTime until, SUMOReal pos, const std::string& actType, + SUMOTime duration, SUMOTime until, double pos, const std::string& actType, const bool initial) : MSTransportable::Stage(destination, 0, SUMOVehicleParameter::interpretEdgePos( pos, destination.getLength(), SUMO_ATTR_DEPARTPOS, "stopping at " + destination.getID()), @@ -128,7 +124,7 @@ } -SUMOReal +double MSTransportable::Stage_Waiting::getEdgePos(SUMOTime /* now */) const { return myArrivalPos; } @@ -146,7 +142,7 @@ } -SUMOReal +double MSTransportable::Stage_Waiting::getAngle(SUMOTime /* now */) const { return getEdgeAngle(&myDestination, myArrivalPos) + M_PI / 2; } @@ -209,18 +205,26 @@ } -SUMOReal +double MSTransportable::Stage_Waiting::getSpeed() const { return 0; } +ConstMSEdgeVector +MSTransportable::Stage_Waiting::getEdges() const { + ConstMSEdgeVector result; + result.push_back(&getDestination()); + return result; +} + + /* ------------------------------------------------------------------------- * MSTransportable::Stage_Driving - methods * ----------------------------------------------------------------------- */ MSTransportable::Stage_Driving::Stage_Driving(const MSEdge& destination, - MSStoppingPlace* toStop, const SUMOReal arrivalPos, const std::vector& lines) + MSStoppingPlace* toStop, const double arrivalPos, const std::vector& lines) : MSTransportable::Stage(destination, toStop, arrivalPos, DRIVING), myLines(lines.begin(), lines.end()), myVehicle(0), myStopWaitPos(Position::INVALID) {} @@ -231,7 +235,7 @@ const MSEdge* MSTransportable::Stage_Driving::getEdge() const { if (myVehicle != 0) { - return myVehicle->getEdge(); + return &myVehicle->getLane()->getEdge(); } return myWaitingEdge; } @@ -243,7 +247,7 @@ } -SUMOReal +double MSTransportable::Stage_Driving::getEdgePos(SUMOTime /* now */) const { if (isWaiting4Vehicle()) { return myWaitingPos; @@ -265,7 +269,7 @@ } -SUMOReal +double MSTransportable::Stage_Driving::getAngle(SUMOTime /* now */) const { if (!isWaiting4Vehicle()) { MSVehicle* veh = dynamic_cast(myVehicle); @@ -297,12 +301,30 @@ } -SUMOReal +double MSTransportable::Stage_Driving::getSpeed() const { return isWaiting4Vehicle() ? 0 : myVehicle->getSpeed(); } +ConstMSEdgeVector +MSTransportable::Stage_Driving::getEdges() const { + ConstMSEdgeVector result; + result.push_back(getFromEdge()); + result.push_back(&getDestination()); + return result; +} + +void +MSTransportable::Stage_Driving::abort(MSTransportable* t) { + if (myVehicle != 0) { + // jumping out of a moving vehicle! + dynamic_cast(myVehicle)->removeTransportable(t); + } +} + + + void MSTransportable::Stage_Driving::beginEventOutput(const MSTransportable& p, SUMOTime t, OutputDevice& os) const { os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "arrival").writeAttr("agent", p.getID()).writeAttr("link", getEdge()->getID()).closeTag(); @@ -350,7 +372,7 @@ (*myStep)->setDeparted(now); } -SUMOReal +double MSTransportable::getEdgePos() const { return (*myStep)->getEdgePos(MSNet::getInstance()->getCurrentTimeStep()); } @@ -360,20 +382,73 @@ return (*myStep)->getPosition(MSNet::getInstance()->getCurrentTimeStep()); } -SUMOReal +double MSTransportable::getAngle() const { return (*myStep)->getAngle(MSNet::getInstance()->getCurrentTimeStep()); } -SUMOReal +double MSTransportable::getWaitingSeconds() const { return STEPS2TIME((*myStep)->getWaitingTime(MSNet::getInstance()->getCurrentTimeStep())); } -SUMOReal +double MSTransportable::getSpeed() const { return (*myStep)->getSpeed(); } +int +MSTransportable::getNumRemainingStages() const { + return (int)(myPlan->end() - myStep); +} + +int +MSTransportable::getNumStages() const { + return (int)myPlan->size(); +} + +void +MSTransportable::appendStage(Stage* stage) { + // myStep is invalidated upon modifying myPlan + const int stepIndex = (int)(myStep - myPlan->begin()); + myPlan->push_back(stage); + myStep = myPlan->begin() + stepIndex; +} + + +void +MSTransportable::removeStage(int next) { + assert(myStep + next < myPlan->end()); + assert(next >= 0); + if (next > 0) { + // myStep is invalidated upon modifying myPlan + int stepIndex = (int)(myStep - myPlan->begin()); + delete *(myStep + next); + myPlan->erase(myStep + next); + myStep = myPlan->begin() + stepIndex; + } else { + if (myStep + 1 == myPlan->end()) { + // stay in the simulation until the start of simStep to allow appending new stages (at the correct position) + appendStage(new Stage_Waiting(*getEdge(), 0, 0, getEdgePos(), "last stage removed", false)); + } + (*myStep)->abort(this); + proceed(MSNet::getInstance(), MSNet::getInstance()->getCurrentTimeStep()); + } +} + + +void +MSTransportable::setSpeed(double speed) { + for (MSTransportablePlan::const_iterator i = myPlan->begin(); i != myPlan->end(); ++i) { + (*i)->setSpeed(speed); + } +} + + +void +MSTransportable::replaceVehicleType(MSVehicleType* type) { + myVType = type; +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSTransportable.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSTransportable.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSTransportable.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSTransportable.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSTransportable.h /// @author Michael Behrisch /// @date Tue, 21 Apr 2015 -/// @version $Id: MSTransportable.h 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: MSTransportable.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The common superclass for modelling transportable objects like persons and containers /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -30,6 +30,7 @@ #endif #include +#include #include #include @@ -46,6 +47,7 @@ class SUMOVehicleParameter; class SUMOVehicle; +typedef std::vector ConstMSEdgeVector; // =========================================================================== // class definitions @@ -58,10 +60,10 @@ class MSTransportable { public: enum StageType { - DRIVING = 0, + WAITING_FOR_DEPART = 0, WAITING = 1, MOVING_WITHOUT_VEHICLE = 2, // walking for persons, tranship for containers - WAITING_FOR_DEPART = 3 + DRIVING = 3 }; /** @@ -71,7 +73,7 @@ class Stage { public: /// constructor - Stage(const MSEdge& destination, MSStoppingPlace* toStop, const SUMOReal arrivalPos, StageType type); + Stage(const MSEdge& destination, MSStoppingPlace* toStop, const double arrivalPos, StageType type); /// destructor virtual ~Stage(); @@ -84,20 +86,20 @@ return myDestinationStop; } - SUMOReal getArrivalPos() const { + double getArrivalPos() const { return myArrivalPos; } /// Returns the current edge virtual const MSEdge* getEdge() const = 0; virtual const MSEdge* getFromEdge() const = 0; - virtual SUMOReal getEdgePos(SUMOTime now) const = 0; + virtual double getEdgePos(SUMOTime now) const = 0; /// returns the position of the transportable virtual Position getPosition(SUMOTime now) const = 0; /// returns the angle of the transportable - virtual SUMOReal getAngle(SUMOTime now) const = 0; + virtual double getAngle(SUMOTime now) const = 0; /// StageType getStageType() const { @@ -107,9 +109,15 @@ /// @brief return string representation of the current stage virtual std::string getStageDescription() const = 0; - /// proceeds to the next step + /// proceeds to this stage virtual void proceed(MSNet* net, MSTransportable* transportable, SUMOTime now, Stage* previous) = 0; + /// abort this stage (TraCI) + virtual void abort(MSTransportable*) {}; + + /// sets the walking speed (ignored in other stages) + virtual void setSpeed(double) {}; + /// logs end of the step void setDeparted(SUMOTime now); @@ -133,16 +141,19 @@ virtual SUMOTime getWaitingTime(SUMOTime now) const = 0; /// @brief the speed of the transportable - virtual SUMOReal getSpeed() const = 0; + virtual double getSpeed() const = 0; + + /// @brief the edges of the current stage + virtual ConstMSEdgeVector getEdges() const = 0; /// @brief get position on edge e at length at with orthogonal offset - Position getEdgePosition(const MSEdge* e, SUMOReal at, SUMOReal offset) const; + Position getEdgePosition(const MSEdge* e, double at, double offset) const; /// @brief get position on lane at length at with orthogonal offset - Position getLanePosition(const MSLane* lane, SUMOReal at, SUMOReal offset) const; + Position getLanePosition(const MSLane* lane, double at, double offset) const; /// @brief get angle of the edge at a certain position - SUMOReal getEdgeAngle(const MSEdge* e, SUMOReal at) const; + double getEdgeAngle(const MSEdge* e, double at) const; /** @brief Called on writing tripinfo output * @param[in] os The stream to write the information into @@ -176,7 +187,7 @@ MSStoppingPlace* const myDestinationStop; /// the position at which we want to arrive - SUMOReal myArrivalPos; + double myArrivalPos; /// the time at which this stage started SUMOTime myDeparted; @@ -203,7 +214,7 @@ public: /// constructor Stage_Waiting(const MSEdge& destination, SUMOTime duration, SUMOTime until, - SUMOReal pos, const std::string& actType, const bool initial); + double pos, const std::string& actType, const bool initial); /// destructor virtual ~Stage_Waiting(); @@ -211,17 +222,19 @@ /// Returns the current edge const MSEdge* getEdge() const; const MSEdge* getFromEdge() const; - SUMOReal getEdgePos(SUMOTime now) const; + double getEdgePos(SUMOTime now) const; SUMOTime getUntil() const; /// Position getPosition(SUMOTime now) const; - SUMOReal getAngle(SUMOTime now) const; + double getAngle(SUMOTime now) const; SUMOTime getWaitingTime(SUMOTime now) const; - SUMOReal getSpeed() const; + double getSpeed() const; + + ConstMSEdgeVector getEdges() const; std::string getStageDescription() const { return "waiting (" + myActType + ")"; @@ -286,20 +299,23 @@ public: /// constructor Stage_Driving(const MSEdge& destination, MSStoppingPlace* toStop, - const SUMOReal arrivalPos, const std::vector& lines); + const double arrivalPos, const std::vector& lines); /// destructor virtual ~Stage_Driving(); + /// abort this stage (TraCI) + void abort(MSTransportable*); + /// Returns the current edge const MSEdge* getEdge() const; const MSEdge* getFromEdge() const; - SUMOReal getEdgePos(SUMOTime now) const; + double getEdgePos(SUMOTime now) const; /// Position getPosition(SUMOTime now) const; - SUMOReal getAngle(SUMOTime now) const; + double getAngle(SUMOTime now) const; /// Whether the person waits for a vehicle of the line specified. bool isWaitingFor(const std::string& line) const; @@ -315,7 +331,9 @@ /// @brief time spent waiting for a ride SUMOTime getWaitingTime(SUMOTime now) const; - SUMOReal getSpeed() const; + double getSpeed() const; + + ConstMSEdgeVector getEdges() const; void setVehicle(SUMOVehicle* v) { myVehicle = v; @@ -340,7 +358,7 @@ /// @brief The taken vehicle SUMOVehicle* myVehicle; - SUMOReal myWaitingPos; + double myWaitingPos; /// @brief The time since which this person is waiting for a ride SUMOTime myWaitingSince; const MSEdge* myWaitingEdge; @@ -406,25 +424,32 @@ } /// @brief Return the position on the edge - virtual SUMOReal getEdgePos() const; + virtual double getEdgePos() const; /// @brief Return the Network coordinate of the transportable virtual Position getPosition() const; /// @brief return the current angle of the transportable - virtual SUMOReal getAngle() const; + virtual double getAngle() const; /// @brief the time this transportable spent waiting in seconds - virtual SUMOReal getWaitingSeconds() const; + virtual double getWaitingSeconds() const; /// @brief the current speed of the transportable - virtual SUMOReal getSpeed() const; + virtual double getSpeed() const; /// @brief the current stage type of the transportable StageType getCurrentStageType() const { return (*myStep)->getStageType(); } + /// @brief the stage type for the nth next stage + StageType getStageType(int next) const { + assert(myStep + next < myPlan->end()); + assert(myStep + next >= myPlan->begin()); + return (*(myStep + next))->getStageType(); + } + /// Returns the current stage description as a string std::string getCurrentStageDescription() const { return (*myStep)->getStageDescription(); @@ -435,6 +460,19 @@ return *myStep; } + /// @brief Return the edges of the nth next stage + ConstMSEdgeVector getEdges(int next) const { + assert(myStep + next < myPlan->end()); + assert(myStep + next >= myPlan->begin()); + return (*(myStep + next))->getEdges(); + } + + /// @brief Return the number of remaining stages (including the current) + int getNumRemainingStages() const; + + /// @brief Return the total number stages in this persons plan + int getNumStages() const; + /** @brief Called on writing tripinfo output * * @param[in] os The stream to write the information into @@ -449,24 +487,46 @@ */ virtual void routeOutput(OutputDevice& os) const = 0; - /// Whether the transportable waits for a vehicle of the line specified. + /// @brief Whether the transportable waits for a vehicle of the line specified. bool isWaitingFor(const std::string& line) const { return (*myStep)->isWaitingFor(line); } - /// Whether the transportable waits for a vehicle + /// @brief Whether the transportable waits for a vehicle bool isWaiting4Vehicle() const { return (*myStep)->isWaiting4Vehicle(); } - /// The vehicle associated with this transportable + /// @brief The vehicle associated with this transportable SUMOVehicle* getVehicle() const { return (*myStep)->getVehicle(); } + /// @brief Appends the given stage to the current plan + void appendStage(Stage* stage); + + /// @brief removes the nth next stage + void removeStage(int next); + + /// sets the walking speed (ignored in other stages) + void setSpeed(double speed); + + /// @brief returns the final arrival pos + double getArrivalPos() const { + return myPlan->back()->getArrivalPos(); + } + + /// @brief returns the final arrival edge + const MSEdge* getArrivalEdge() const { + return myPlan->back()->getEdges().back(); + } + + /// @brief replace myVType + void replaceVehicleType(MSVehicleType* type); + protected: /// @brief the offset for computing positions when standing at an edge - static const SUMOReal ROADSIDE_OFFSET; + static const double ROADSIDE_OFFSET; /// the plan of the transportable const SUMOVehicleParameter* myParameter; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicleContainer.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicleContainer.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicleContainer.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicleContainer.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 12 Mar 2001 -/// @version $Id: MSVehicleContainer.cpp 21320 2016-08-23 11:11:18Z behrisch $ +/// @version $Id: MSVehicleContainer.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // vehicles sorted by their departures /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,10 +36,6 @@ #include "MSVehicle.h" #include "MSVehicleContainer.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicleContainer.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicleContainer.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicleContainer.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicleContainer.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 12 Mar 2001 -/// @version $Id: MSVehicleContainer.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSVehicleContainer.h 22608 2017-01-17 06:28:54Z behrisch $ /// // vehicles sorted by their departures /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicleControl.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicleControl.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicleControl.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicleControl.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Wed, 10. Dec 2003 -/// @version $Id: MSVehicleControl.cpp 21472 2016-09-14 08:50:06Z behrisch $ +/// @version $Id: MSVehicleControl.cpp 23840 2017-04-06 08:45:47Z namdre $ /// // The class responsible for building and deletion of vehicles /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,10 +44,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions @@ -94,7 +90,7 @@ myVTypeDistDict.clear(); // delete vehicle types for (VTypeDictType::iterator i = myVTypeDict.begin(); i != myVTypeDict.end(); ++i) { - delete(*i).second; + //delete(*i).second; } myVTypeDict.clear(); } @@ -153,7 +149,7 @@ void -MSVehicleControl::setState(int runningVehNo, int loadedVehNo, int endedVehNo, SUMOReal totalDepartureDelay, SUMOReal totalTravelTime) { +MSVehicleControl::setState(int runningVehNo, int loadedVehNo, int endedVehNo, double totalDepartureDelay, double totalTravelTime) { myRunningVehNo = runningVehNo; myLoadedVehNo = loadedVehNo; myEndedVehNo = endedVehNo; @@ -257,6 +253,15 @@ } +void +MSVehicleControl::removeVType(const MSVehicleType* vehType) { + assert(vehType != 0); + assert(myVTypeDict.find(vehType->getID()) != myVTypeDict.end()); + myVTypeDict.erase(vehType->getID()); + delete vehType; +} + + bool MSVehicleControl::addVTypeDistribution(const std::string& id, RandomDistributor* vehTypeDistribution) { if (checkVType(id)) { @@ -325,13 +330,13 @@ SUMOVehicle* -MSVehicleControl::getWaitingVehicle(const MSEdge* const edge, const std::set& lines, const SUMOReal position, const std::string ridingID) { +MSVehicleControl::getWaitingVehicle(const MSEdge* const edge, const std::set& lines, const double position, const std::string ridingID) { if (myWaiting.find(edge) != myWaiting.end()) { // for every vehicle waiting vehicle at this edge std::vector waitingTooFarAway; for (std::vector::const_iterator it = myWaiting[edge].begin(); it != myWaiting[edge].end(); ++it) { const std::string& line = (*it)->getParameter().line == "" ? (*it)->getParameter().id : (*it)->getParameter().line; - SUMOReal vehiclePosition = (*it)->getPositionOnLane(); + double vehiclePosition = (*it)->getPositionOnLane(); // if the line of the vehicle is contained in the set of given lines and the vehicle is stopped and is positioned // in the interval [position - t, position + t] for a tolerance t=10 if (lines.count(line)) { @@ -366,7 +371,7 @@ int -MSVehicleControl::getQuota(SUMOReal frac) const { +MSVehicleControl::getQuota(double frac) const { frac = frac < 0 ? myScale : frac; if (frac < 0 || frac == 1.) { return 1; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicleControl.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicleControl.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicleControl.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicleControl.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Wed, 10. Dec 2003 -/// @version $Id: MSVehicleControl.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSVehicleControl.h 23840 2017-04-06 08:45:47Z namdre $ /// // The class responsible for building and deletion of vehicles /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include @@ -233,7 +233,7 @@ * (--scale) * @return the number of vehicles to create (something between 0 and ceil(frac)) */ - int getQuota(SUMOReal frac = -1) const; + int getQuota(double frac = -1) const; /** @brief Returns the number of build vehicles that have not been removed or @@ -277,7 +277,7 @@ /** @brief Returns the total departure delay * @return Sum of steps vehicles had to wait until being inserted */ - SUMOReal getTotalDepartureDelay() const { + double getTotalDepartureDelay() const { return myTotalDepartureDelay; } @@ -285,7 +285,7 @@ /** @brief Returns the total travel time * @return Sum of travel times of arrived vehicles */ - SUMOReal getTotalTravelTime() const { + double getTotalTravelTime() const { return myTotalTravelTime; } /// @} @@ -309,6 +309,12 @@ */ bool addVType(MSVehicleType* vehType); + /* + * @param[in] vehType The vehicle type to remove + * @return Whether the vehicle type could be removed + */ + void removeVType(const MSVehicleType* vehType); + /** @brief Adds a vehicle type distribution * @@ -361,7 +367,7 @@ * @param[in] position The vehicle shall be positioned in the interval [position - t, position + t], where t is some tolerance * @param[in] ridingID The id of the person or container that wants to ride */ - SUMOVehicle* getWaitingVehicle(const MSEdge* const edge, const std::set& lines, const SUMOReal position, const std::string ridingID); + SUMOVehicle* getWaitingVehicle(const MSEdge* const edge, const std::set& lines, const double position, const std::string ridingID); /** @brief increases the count of vehicles waiting for a person to allow recogniztion of person related deadlocks */ @@ -417,7 +423,7 @@ /** @brief Sets the current state variables as loaded from the stream */ - void setState(int runningVehNo, int loadedVehNo, int endedVehNo, SUMOReal totalDepartureDelay, SUMOReal totalTravelTime); + void setState(int runningVehNo, int loadedVehNo, int endedVehNo, double totalDepartureDelay, double totalTravelTime); /** @brief Saves the current state into the given stream */ @@ -425,8 +431,14 @@ /// @} /// @brief avoid counting a vehicle twice if it was loaded from state and route input - void discountStateLoaded() { - myLoadedVehNo--; + void discountStateLoaded(bool removed = false) { + if (removed) { + myRunningVehNo--; + myDiscarded++; + myEndedVehNo++; + } else { + myLoadedVehNo--; + } } @@ -438,12 +450,12 @@ SUMOTime computeRandomDepartOffset() const; /// @brief return the maximum speed factor for all vehicles that ever entered the network - SUMOReal getMaxSpeedFactor() const { + double getMaxSpeedFactor() const { return myMaxSpeedFactor; } /// @brief return the minimum deceleration capability for all vehicles that ever entered the network - SUMOReal getMinDeceleration() const { + double getMinDeceleration() const { return myMinDeceleration; } @@ -494,10 +506,10 @@ /// @{ /// @brief The aggregated time vehicles had to wait for departure (in seconds) - SUMOReal myTotalDepartureDelay; + double myTotalDepartureDelay; /// @brief The aggregated time vehicles needed to aacomplish their route (in seconds) - SUMOReal myTotalTravelTime; + double myTotalTravelTime; /// @} @@ -540,16 +552,16 @@ int myWaitingForContainer; /// @brief The scaling factor (especially for inc-dua) - SUMOReal myScale; + double myScale; /// @brief The maximum random offset to be added to vehicles departure times (non-negative) SUMOTime myMaxRandomDepartOffset; /// @brief The maximum speed factor for all vehicles in the network - SUMOReal myMaxSpeedFactor; + double myMaxSpeedFactor; /// @brief The minimum deceleration capability for all vehicles in the network - SUMOReal myMinDeceleration; + double myMinDeceleration; private: /// @brief invalidated copy constructor diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicle.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicle.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicle.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicle.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -13,12 +13,12 @@ /// @author Christoph Sommer /// @author Leonhard Lücken /// @date Mon, 05 Mar 2001 -/// @version $Id: MSVehicle.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSVehicle.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Representation of a vehicle in the micro simulation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -59,10 +59,12 @@ #include #include #include +#include #include "MSVehicleControl.h" #include "MSVehicleTransfer.h" #include "MSGlobals.h" #include "MSStoppingPlace.h" +#include "MSParkingArea.h" #include "devices/MSDevice_Transportable.h" #include "MSEdgeWeightsStorage.h" #include @@ -78,10 +80,6 @@ #include "MSLinkCont.h" #include "MSLeaderInfo.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // enable here and in utils/gui/globjects/GUIGLObjectPopupMenu.cpp //#define DEBUG_VEHICLE_GUI_SELECTION 1 @@ -145,7 +143,7 @@ } -MSVehicle::State::State(SUMOReal pos, SUMOReal speed, SUMOReal posLat, SUMOReal backPos) : +MSVehicle::State::State(double pos, double speed, double posLat, double backPos) : myPos(pos), mySpeed(speed), myPosLat(posLat), myBackPos(backPos), myPreviousSpeed(speed), myLastCoveredDist(SPEED2DIST(speed)) {} @@ -233,6 +231,7 @@ * ----------------------------------------------------------------------- */ #ifndef NO_TRACI MSVehicle::Influencer::Influencer() : + myLatDist(0), mySpeedAdaptationStarted(true), myConsiderSafeVelocity(true), myConsiderMaxAcceleration(true), @@ -245,7 +244,8 @@ mySpeedGainLC(LC_NOCONFLICT), myRightDriveLC(LC_NOCONFLICT), mySublaneLC(LC_NOCONFLICT), - myTraciLaneChangePriority(LCP_URGENT) { + myTraciLaneChangePriority(LCP_URGENT), + myTraCISignals(-1) { } @@ -253,7 +253,7 @@ void -MSVehicle::Influencer::setSpeedTimeLine(const std::vector >& speedTimeLine) { +MSVehicle::Influencer::setSpeedTimeLine(const std::vector >& speedTimeLine) { mySpeedAdaptationStarted = true; mySpeedTimeLine = speedTimeLine; } @@ -264,6 +264,10 @@ myLaneTimeLine = laneTimeLine; } +void +MSVehicle::Influencer::setSublaneChange(double latDist) { + myLatDist = latDist; +} int MSVehicle::Influencer::getSpeedMode() const { @@ -275,8 +279,8 @@ } -SUMOReal -MSVehicle::Influencer::influenceSpeed(SUMOTime currentTime, SUMOReal speed, SUMOReal vSafe, SUMOReal vMin, SUMOReal vMax) { +double +MSVehicle::Influencer::influenceSpeed(SUMOTime currentTime, double speed, double vSafe, double vMin, double vMax) { // keep original speed myOriginalSpeed = speed; // remove leading commands which are no longer valid @@ -293,7 +297,7 @@ mySpeedAdaptationStarted = true; } currentTime += DELTA_T; - const SUMOReal td = STEPS2TIME(currentTime - mySpeedTimeLine[0].first) / STEPS2TIME(mySpeedTimeLine[1].first + DELTA_T - mySpeedTimeLine[0].first); + const double td = STEPS2TIME(currentTime - mySpeedTimeLine[0].first) / STEPS2TIME(mySpeedTimeLine[1].first + DELTA_T - mySpeedTimeLine[0].first); speed = mySpeedTimeLine[0].second - (mySpeedTimeLine[0].second - mySpeedTimeLine[1].second) * td; if (myConsiderSafeVelocity) { speed = MIN2(speed, vSafe); @@ -308,6 +312,12 @@ } +double +MSVehicle::Influencer::getOriginalSpeed() const { + return mySpeedTimeLine.empty() ? -1 : myOriginalSpeed; +} + + int MSVehicle::Influencer::influenceChangeDecision(const SUMOTime currentTime, const MSEdge& currentEdge, const int currentLaneIndex, int state) { // remove leading commands which are no longer valid @@ -392,7 +402,7 @@ } -SUMOReal +double MSVehicle::Influencer::changeRequestRemainingSeconds(const SUMOTime currentTime) const { assert(myLaneTimeLine.size() >= 2); assert(currentTime >= myLaneTimeLine[0].first); @@ -401,32 +411,12 @@ void -MSVehicle::Influencer::setConsiderSafeVelocity(bool value) { - myConsiderSafeVelocity = value; -} - - -void -MSVehicle::Influencer::setConsiderMaxAcceleration(bool value) { - myConsiderMaxAcceleration = value; -} - - -void -MSVehicle::Influencer::setConsiderMaxDeceleration(bool value) { - myConsiderMaxDeceleration = value; -} - - -void -MSVehicle::Influencer::setRespectJunctionPriority(bool value) { - myRespectJunctionPriority = value; -} - - -void -MSVehicle::Influencer::setEmergencyBrakeRedLight(bool value) { - myEmergencyBrakeRedLight = value; +MSVehicle::Influencer::setSpeedMode(int speedMode) { + myConsiderSafeVelocity = ((speedMode & 1) != 0); + myConsiderMaxAcceleration = ((speedMode & 2) != 0); + myConsiderMaxDeceleration = ((speedMode & 4) != 0); + myRespectJunctionPriority = ((speedMode & 8) != 0); + myEmergencyBrakeRedLight = ((speedMode & 16) != 0); } @@ -442,7 +432,7 @@ void -MSVehicle::Influencer::setVTDControlled(Position xyPos, MSLane* l, SUMOReal pos, SUMOReal posLat, SUMOReal angle, int edgeOffset, const ConstMSEdgeVector& route, SUMOTime t) { +MSVehicle::Influencer::setVTDControlled(Position xyPos, MSLane* l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector& route, SUMOTime t) { myVTDXYPos = xyPos; myVTDLane = l; myVTDPos = pos; @@ -485,18 +475,23 @@ if (!wasOnRoad) { v->drawOutsideNetwork(false); } + //std::cout << "on road network p=" << myVTDXYPos << " a=" << myVTDAngle << " l=" << Named::getIDSecure(myVTDLane) << " pos=" << myVTDPos << " posLat=" << myVTDPosLat << "\n"; } else { + if (v->getDeparture() == NOT_YET_DEPARTED) { + v->onDepart(); + } v->setVTDState(myVTDXYPos); v->drawOutsideNetwork(true); + //std::cout << "outside network p=" << myVTDXYPos << " a=" << myVTDAngle << " l=" << Named::getIDSecure(myVTDLane) << "\n"; } // inverse of GeomHelper::naviDegree v->setAngle(M_PI / 2. - DEG2RAD(myVTDAngle)); } -SUMOReal -MSVehicle::Influencer::implicitSpeedVTD(const MSVehicle* veh, SUMOReal oldSpeed) { - SUMOReal dist = 0; +double +MSVehicle::Influencer::implicitSpeedVTD(const MSVehicle* veh, double oldSpeed) { + double dist = 0; if (myVTDLane == 0) { dist = veh->getPosition().distanceTo2D(myVTDXYPos); } else { @@ -509,9 +504,9 @@ } } -SUMOReal +double MSVehicle::Influencer::implicitDeltaPosVTD(const MSVehicle* veh) { - SUMOReal dist = 0; + double dist = 0; if (myVTDLane == 0) { dist = veh->getPosition().distanceTo2D(myVTDXYPos); } else { @@ -531,10 +526,11 @@ * MSVehicle-methods * ----------------------------------------------------------------------- */ MSVehicle::MSVehicle(SUMOVehicleParameter* pars, const MSRoute* route, - const MSVehicleType* type, const SUMOReal speedFactor) : + const MSVehicleType* type, const double speedFactor) : MSBaseVehicle(pars, route, type, speedFactor), myWaitingTime(0), myWaitingTimeCollector(), + myTimeLoss(0), myState(0, 0, 0, 0), // myLane(0), myLastBestLanesEdge(0), @@ -548,7 +544,8 @@ myAmRegisteredAsWaitingForContainer(false), myHaveToWaitOnNextLink(false), myAngle(0), - myStopDist(std::numeric_limits::max()), + myStopDist(std::numeric_limits::max()), + myCollisionImmunity(-1), myCachedPosition(Position::INVALID), myEdgeWeights(0) #ifndef NO_TRACI @@ -616,7 +613,7 @@ bool -MSVehicle::replaceRoute(const MSRoute* newRoute, bool onInit, int offset) { +MSVehicle::replaceRoute(const MSRoute* newRoute, bool onInit, int offset, bool addStops) { const ConstMSEdgeVector& edges = newRoute->getEdges(); // assert the vehicle may continue (must not be "teleported" or whatever to another position) if (!onInit && !newRoute->contains(*myCurrEdge)) { @@ -658,11 +655,13 @@ } } // add new stops - for (std::vector::const_iterator i = newRoute->getStops().begin(); i != newRoute->getStops().end(); ++i) { - std::string error; - addStop(*i, error); - if (error != "") { - WRITE_WARNING(error); + if (addStops) { + for (std::vector::const_iterator i = newRoute->getStops().begin(); i != newRoute->getStops().end(); ++i) { + std::string error; + addStop(*i, error); + if (error != "") { + WRITE_WARNING(error); + } } } return true; @@ -713,7 +712,7 @@ // ------------ Interaction with move reminders void -MSVehicle::workOnMoveReminders(SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed) { +MSVehicle::workOnMoveReminders(double oldPos, double newPos, double newSpeed) { // This erasure-idiom works for all stl-sequence-containers // See Meyers: Effective STL, Item 9 for (MoveReminderCont::iterator rem = myMoveReminders.begin(); rem != myMoveReminders.end();) { @@ -721,7 +720,7 @@ // although a higher order quadrature-formula might be more adequate. // For the euler case (where the speed is considered constant for each time step) it is conceivable that // the current calculations may lead to systematic errors for large time steps (compared to reality). Refs. #2579 - if (!rem->first->notifyMove(*this, oldPos + rem->second, newPos + rem->second, MAX2((SUMOReal)0., newSpeed))) { + if (!rem->first->notifyMove(*this, oldPos + rem->second, newPos + rem->second, MAX2(0., newSpeed))) { #ifdef _DEBUG if (myTraceMoveReminders) { traceMoveReminder("notifyMove", rem->first, rem->second, false); @@ -745,10 +744,12 @@ MSVehicle::adaptLaneEntering2MoveReminder(const MSLane& enteredLane) { // save the old work reminders, patching the position information // add the information about the new offset to the old lane reminders - const SUMOReal oldLaneLength = myLane->getLength(); + const double oldLaneLength = myLane->getLength(); for (MoveReminderCont::iterator rem = myMoveReminders.begin(); rem != myMoveReminders.end(); ++rem) { rem->second += oldLaneLength; #ifdef _DEBUG +// if (rem->first==0) std::cout << "Null reminder (?!)" << std::endl; +// std::cout << "Adapted MoveReminder on lane " << ((rem->first->getLane()==0) ? "NULL" : rem->first->getLane()->getID()) <<" position to " << rem->second << std::endl; if (myTraceMoveReminders) { traceMoveReminder("adaptedPos", rem->first, rem->second, true); } @@ -761,30 +762,36 @@ // ------------ Other getter methods -SUMOReal +double MSVehicle::getSlope() const { if (myLane == 0) { return 0; } - const SUMOReal lp = getPositionOnLane(); - const SUMOReal gp = myLane->interpolateLanePosToGeometryPos(lp); + const double lp = getPositionOnLane(); + const double gp = myLane->interpolateLanePosToGeometryPos(lp); return myLane->getShape().slopeDegreeAtOffset(gp); } Position -MSVehicle::getPosition(const SUMOReal offset) const { +MSVehicle::getPosition(const double offset) const { if (myLane == 0) { - if (isRemoteControlled()) { + // when called in the context of GUI-Drawing, the simulation step is already incremented + if (myInfluencer != 0 && myInfluencer->isVTDAffected(MSNet::getInstance()->getCurrentTimeStep())) { return myCachedPosition; } else { return Position::INVALID; } } if (isParking()) { - PositionVector shp = myLane->getEdge().getLanes()[0]->getShape(); - shp.move2side(SUMO_const_laneWidth); - return shp.positionAtOffset(myLane->interpolateLanePosToGeometryPos(getPositionOnLane() + offset)); + if (myStops.begin()->parkingarea != 0) { + return myStops.begin()->parkingarea->getVehiclePosition(*this); + } else { + // position beside the road + PositionVector shp = myLane->getEdge().getLanes()[0]->getShape(); + shp.move2side(SUMO_const_laneWidth); + return shp.positionAtOffset(myLane->interpolateLanePosToGeometryPos(getPositionOnLane() + offset)); + } } const bool changingLanes = getLaneChangeModel().isChangingLanes(); if (offset == 0. && !changingLanes) { @@ -805,26 +812,28 @@ myState.myPos > myLane->getLength() - getCarFollowModel().brakeGap(myState.mySpeed, getCarFollowModel().getMaxDecel(), 0.)) { return *(myCurrEdge + 1); } -#ifdef HAVE_INTERNAL_LANES if (myLane != 0) { - return myLane->getInternalFollower(); + return myLane->getNextNormal(); } -#endif return *myCurrEdge; } void -MSVehicle::setAngle(SUMOReal angle) { +MSVehicle::setAngle(double angle) { myAngle = angle; } -SUMOReal +double MSVehicle::computeAngle() const { Position p1; - const SUMOReal posLat = -myState.myPosLat; // @todo get rid of the '-' + const double posLat = -myState.myPosLat; // @todo get rid of the '-' if (isParking()) { - return myLane->getShape().rotationAtOffset(myLane->interpolateLanePosToGeometryPos(getPositionOnLane())); + if (myStops.begin()->parkingarea != 0) { + return myStops.begin()->parkingarea->getVehicleAngle(*this); + } else { + return myLane->getShape().rotationAtOffset(myLane->interpolateLanePosToGeometryPos(getPositionOnLane())); + } } if (getLaneChangeModel().isChangingLanes()) { // cannot use getPosition() because it already includes the offset to the side and thus messes up the angle @@ -832,9 +841,18 @@ } else { p1 = getPosition(); } - const Position p2 = getBackPosition(); - SUMOReal result = (p1 != p2 ? p2.angleTo2D(p1) : - myLane->getShape().rotationAtOffset(myLane->interpolateLanePosToGeometryPos(getPositionOnLane()))); + + Position p2 = getBackPosition(); + if (p2 == Position::INVALID) { + // Handle special case of vehicle's back reaching out of the network + if (myFurtherLanes.size() > 0) { + p2 = myFurtherLanes.back()->geometryPositionAtOffset(0, -myFurtherLanesPosLat.back()); + } else { + p2 = myLane->geometryPositionAtOffset(0, posLat); + } + } + double result = (p1 != p2 ? p2.angleTo2D(p1) : + myLane->getShape().rotationAtOffset(myLane->interpolateLanePosToGeometryPos(getPositionOnLane()))); if (getLaneChangeModel().isChangingLanes()) { result += DEG2RAD(getLaneChangeModel().getAngleOffset()); } @@ -849,7 +867,7 @@ const Position MSVehicle::getBackPosition() const { - const SUMOReal posLat = -myState.myPosLat; // @todo get rid of the '-' + const double posLat = -myState.myPosLat; // @todo get rid of the '-' if (myState.myPos >= myType->getLength()) { // vehicle is fully on the new lane return myLane->geometryPositionAtOffset(myState.myPos - myType->getLength(), posLat); @@ -872,7 +890,7 @@ // ------------ bool -MSVehicle::addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset) { +MSVehicle::addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset, bool collision) { Stop stop; stop.lane = MSLane::dictionary(stopPar.lane); if (!stop.lane->allowsVehicleClass(myType->getVehicleClass())) { @@ -881,6 +899,8 @@ } stop.busstop = MSNet::getInstance()->getBusStop(stopPar.busstop); stop.containerstop = MSNet::getInstance()->getContainerStop(stopPar.containerstop); + stop.parkingarea = MSNet::getInstance()->getParkingArea(stopPar.parkingarea); + stop.chargingStation = MSNet::getInstance()->getChargingStation(stopPar.chargingStation); stop.startPos = stopPar.startPos; stop.endPos = stopPar.endPos; stop.duration = stopPar.duration; @@ -895,6 +915,7 @@ stop.triggered = stopPar.triggered; stop.containerTriggered = stopPar.containerTriggered; stop.parking = stopPar.parking; + stop.collision = collision; stop.reached = false; if (stop.startPos < 0 || stop.endPos > stop.lane->getLength()) { if (stop.busstop != 0) { @@ -911,9 +932,12 @@ if (stop.containerstop != 0 && myType->getLength() / 2. > stop.endPos - stop.startPos) { errorMsg = "Container stop '" + stop.containerstop->getID() + "' on lane '" + stopPar.lane + "' is too short for vehicle '" + myParameter->id + "'."; } + if (stop.parkingarea != 0 && myType->getLength() / 2. > stop.endPos - stop.startPos) { + errorMsg = "Parking area '" + stop.parkingarea->getID() + "' on lane '" + stopPar.lane + "' is too short for vehicle '" + myParameter->id + "'."; + } stop.edge = find(myCurrEdge, myRoute->end(), &stop.lane->getEdge()); MSRouteIterator prevStopEdge = myCurrEdge; - SUMOReal prevStopPos = myState.myPos; + double prevStopPos = myState.myPos; // where to insert the stop std::list::iterator iter = myStops.begin(); if (stopPar.index == STOP_INDEX_END || stopPar.index >= static_cast(myStops.size())) { @@ -946,7 +970,7 @@ } } if (stop.edge == myRoute->end() || prevStopEdge > stop.edge || - (prevStopEdge == stop.edge && prevStopPos > stop.endPos)) { + (prevStopEdge == stop.edge && prevStopPos > stop.endPos && !collision)) { if (stop.busstop != 0) { errorMsg = "Bus stop '" + stop.busstop->getID() + "'"; } else { @@ -957,12 +981,16 @@ } // David.C: //if (!stop.parking && (myCurrEdge == stop.edge && myState.myPos > stop.endPos - getCarFollowModel().brakeGap(myState.mySpeed))) { - if (myCurrEdge == stop.edge && myState.myPos > stop.endPos - getCarFollowModel().brakeGap(myState.mySpeed)) { + if (collision) { + assert(myCurrEdge == stop.edge); + myState.myPos = stop.endPos; + myState.mySpeed = 0; + } else if (myCurrEdge == stop.edge && myState.myPos > stop.endPos - getCarFollowModel().brakeGap(myState.mySpeed)) { errorMsg = "Stop for vehicle '" + myParameter->id + "' on lane '" + stopPar.lane + "' is too close to break."; return false; } if (!hasDeparted() && myCurrEdge == stop.edge) { - SUMOReal pos = -1; + double pos = -1; if (myParameter->departPosProcedure == DEPART_POS_GIVEN) { pos = myParameter->departPos; if (pos < 0.) { @@ -970,7 +998,7 @@ } } if (myParameter->departPosProcedure == DEPART_POS_BASE || myParameter->departPosProcedure == DEPART_POS_DEFAULT) { - pos = MIN2(static_cast(getVehicleType().getLength() + POSITION_EPS), (*myCurrEdge)->getLength()); + pos = MIN2(static_cast(getVehicleType().getLength() + POSITION_EPS), (*myCurrEdge)->getLength()); } if (pos > stop.endPos) { if (stop.busstop != 0) { @@ -1000,11 +1028,101 @@ bool +MSVehicle::replaceParkingArea(MSParkingArea* parkingArea, std::string& errorMsg) { + // Check if there is a parking area to be replaced + assert(parkingArea != 0); + if (myStops.empty()) { + errorMsg = "Vehicle '" + myParameter->id + "' has no stops."; + return false; + } + SUMOVehicleParameter::Stop stopPar; + Stop stop = myStops.front(); + if (stop.reached) { + errorMsg = "current stop already reached"; + return false; + } + if (stop.parkingarea == 0) { + errorMsg = "current stop is not a parkingArea"; + return false; + } + if (stop.parkingarea == parkingArea) { + errorMsg = "current stop is the same as the new parking area"; + return false; + } + stopPar.lane = parkingArea->getLane().getID(); + + // merge duplicated stops equals to parking area + int removeStops = 0; + SUMOTime duration = 0; + + for (std::list::const_iterator iter = myStops.begin(); iter != myStops.end(); ++iter) { + if (duration == 0) { + duration = iter->duration; + ++removeStops; + } else { + if (iter->parkingarea != 0 && iter->parkingarea == parkingArea) { + duration += iter->duration; + ++removeStops; + } else { + break; + } + } + } + + stopPar.index = 0; + stopPar.busstop = ""; + stopPar.chargingStation = ""; + stopPar.containerstop = ""; + stopPar.parkingarea = parkingArea->getID(); + stopPar.startPos = parkingArea->getBeginLanePosition(); + stopPar.endPos = parkingArea->getEndLanePosition(); + stopPar.duration = duration; + stopPar.until = stop.until; + stopPar.awaitedPersons = stop.awaitedPersons; + stopPar.awaitedContainers = stop.awaitedContainers; + stopPar.triggered = stop.triggered; + stopPar.containerTriggered = stop.containerTriggered; + stopPar.parking = stop.parking; + + // remove stops equals to parking area + while (removeStops > 0) { + myStops.pop_front(); + --removeStops; + } + const bool result = addStop(stopPar, errorMsg); + if (myLane != 0) { + updateBestLanes(true); + } + return result; +} + + +MSParkingArea* +MSVehicle::getNextParkingArea() { + MSParkingArea* nextParkingArea = 0; + if (!myStops.empty()) { + SUMOVehicleParameter::Stop stopPar; + Stop stop = myStops.front(); + if (!stop.reached && stop.parkingarea != 0) { + nextParkingArea = stop.parkingarea; + } + } + return nextParkingArea; +} + + +bool MSVehicle::isStopped() const { return !myStops.empty() && myStops.begin()->reached /*&& myState.mySpeed < SUMO_const_haltingSpeed @todo #1864#*/; } +SUMOTime +MSVehicle::collisionStopTime() const { + return (myStops.empty() || !myStops.front().collision) ? myCollisionImmunity : MAX2((SUMOTime)0, myStops.front().duration); +} + + bool MSVehicle::isParking() const { return isStopped() && myStops.begin()->parking; @@ -1018,13 +1136,13 @@ bool -MSVehicle::isStoppedInRange(SUMOReal pos) const { +MSVehicle::isStoppedInRange(double pos) const { return isStopped() && myStops.begin()->startPos <= pos && myStops.begin()->endPos >= pos; } -SUMOReal -MSVehicle::processNextStop(SUMOReal currentVelocity) { +double +MSVehicle::processNextStop(double currentVelocity) { if (myStops.empty()) { // no stops; pass return currentVelocity; @@ -1090,7 +1208,7 @@ #endif } } - if (stop.duration <= 0 && !stop.triggered && !stop.containerTriggered) { + if (stop.duration <= 0 && !stop.triggered && !stop.containerTriggered && !stop.collision) { #ifdef DEBUG_STOPS if (DEBUG_COND) { std::cout << SIMTIME << " vehicle '" << getID() << "' resumes from stopping." << std::endl; @@ -1134,13 +1252,7 @@ return 0; } else { // ballistic: - SUMOReal haltingPos = stop.endPos; - if (stop.busstop != 0) { - haltingPos = stop.busstop->getStoppingPosition(this); - } else if (stop.containerstop != 0) { - haltingPos = stop.containerstop->getStoppingPosition(this); - } - return getCarFollowModel().stopSpeed(this, getSpeed(), haltingPos - myState.pos()); + return getCarFollowModel().stopSpeed(this, getSpeed(), stop.getEndPos(*this) - myState.pos()); } } } else { @@ -1154,7 +1266,7 @@ // is the next stop on the current lane? if (stop.edge == myCurrEdge) { // get the stopping position - SUMOReal endPos = stop.endPos; + double endPos = stop.endPos; bool useStoppingPlace = false; bool fitsOnStoppingPlace = true; if (stop.busstop != 0) { @@ -1175,10 +1287,31 @@ fitsOnStoppingPlace = false; } } - const SUMOReal reachedThreshold = (useStoppingPlace ? endPos - STOPPING_PLACE_OFFSET : stop.startPos) - NUMERICAL_EPS; + // if the stop is a parking area we check if there is a free position on the area + if (stop.parkingarea != 0) { + endPos = stop.parkingarea->getLastFreePos(*this); + if (stop.parkingarea->getOccupancy() == stop.parkingarea->getCapacity()) { + fitsOnStoppingPlace = false; + // trigger potential parkingZoneReroute + for (std::vector< MSMoveReminder* >::const_iterator rem = myLane->getMoveReminders().begin(); rem != myLane->getMoveReminders().end(); ++rem) { + addReminder(*rem); + } + MSParkingArea* oldParkingArea = stop.parkingarea; + activateReminders(MSMoveReminder::NOTIFICATION_PARKING_REROUTE, myLane); + if (myStops.empty() || myStops.front().parkingarea != oldParkingArea) { + // rerouted, keep driving + return currentVelocity; + } + } + } + + const double reachedThreshold = (useStoppingPlace ? endPos - STOPPING_PLACE_OFFSET : stop.startPos) - NUMERICAL_EPS; if (myState.pos() >= reachedThreshold && fitsOnStoppingPlace && currentVelocity <= SUMO_const_haltingSpeed && myLane == stop.lane) { // ok, we may stop (have reached the stop) stop.reached = true; + if (MSStopOut::active()) { + MSStopOut::getInstance()->stopStarted(this, getPersonNumber(), getContainerNumber()); + } MSNet::getInstance()->getVehicleControl().addWaiting(&myLane->getEdge(), this); MSNet::getInstance()->informVehicleStateListener(this, MSNet::VEHICLE_STATE_STARTING_STOP); // compute stopping time @@ -1197,6 +1330,10 @@ // let the container stop know the vehicle stop.containerstop->enter(this, myState.pos() + getVehicleType().getMinGap(), myState.pos() - myType->getLength()); } + if (stop.parkingarea != 0) { + // let the parking area know the vehicle + stop.parkingarea->enter(this, myState.pos() + getVehicleType().getMinGap(), myState.pos() - myType->getLength()); + } } // decelerate if (MSGlobals::gSemiImplicitEulerUpdate) { @@ -1223,7 +1360,7 @@ void -MSVehicle::planMove(const SUMOTime t, const MSLeaderInfo& ahead, const SUMOReal lengthsInFront) { +MSVehicle::planMove(const SUMOTime t, const MSLeaderInfo& ahead, const double lengthsInFront) { #ifdef DEBUG_PLAN_MOVE if (DEBUG_COND) { @@ -1274,7 +1411,7 @@ void -MSVehicle::planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector& lfLinks, SUMOReal& myStopDist) const { +MSVehicle::planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector& lfLinks, double& myStopDist) const { #ifdef DEBUG_VEHICLE_GUI_SELECTION if (gDebugSelectedVehicle == getID()) { int bla = 0; @@ -1284,24 +1421,24 @@ // remove information about approaching links, will be reset later in this step removeApproachingInformation(lfLinks); lfLinks.clear(); - myStopDist = std::numeric_limits::max(); + myStopDist = std::numeric_limits::max(); // const MSCFModel& cfModel = getCarFollowModel(); - const SUMOReal vehicleLength = getVehicleType().getLength(); - const SUMOReal maxV = cfModel.maxNextSpeed(myState.mySpeed, this); + const double vehicleLength = getVehicleType().getLength(); + const double maxV = cfModel.maxNextSpeed(myState.mySpeed, this); const bool opposite = getLaneChangeModel().isOpposite(); - SUMOReal laneMaxV = myLane->getVehicleMaxSpeed(this); + double laneMaxV = myLane->getVehicleMaxSpeed(this); // v is the initial maximum velocity of this vehicle in this step - SUMOReal v = MIN2(maxV, laneMaxV); + double v = MIN2(maxV, laneMaxV); #ifndef NO_TRACI if (myInfluencer != 0) { - const SUMOReal vMin = MAX2(SUMOReal(0), cfModel.getSpeedAfterMaxDecel(myState.mySpeed)); + const double vMin = MAX2(0., cfModel.getSpeedAfterMaxDecel(myState.mySpeed)); v = myInfluencer->influenceSpeed(MSNet::getInstance()->getCurrentTimeStep(), v, v, vMin, maxV); } #endif // all links within dist are taken into account (potentially) // the distance already "seen"; in the following always up to the end of the current "lane" - const SUMOReal dist = SPEED2DIST(maxV) + cfModel.brakeGap(maxV); + const double dist = SPEED2DIST(maxV) + cfModel.brakeGap(maxV); const std::vector& bestLaneConts = getBestLanesContinuation(); #ifdef DEBUG_PLAN_MOVE @@ -1310,23 +1447,38 @@ } #endif assert(bestLaneConts.size() > 0); -#ifdef HAVE_INTERNAL_LANES bool hadNonInternal = false; -#else - bool hadNonInternal = true; -#endif - SUMOReal seen = opposite ? myState.myPos : myLane->getLength() - myState.myPos; // the distance already "seen"; in the following always up to the end of the current "lane" - SUMOReal seenNonInternal = 0; - SUMOReal vLinkPass = MIN2(cfModel.estimateSpeedAfterDistance(seen, v, cfModel.getMaxAccel()), laneMaxV); // upper bound + double seen = opposite ? myState.myPos : myLane->getLength() - myState.myPos; // the distance already "seen"; in the following always up to the end of the current "lane" + double seenNonInternal = 0; + double vLinkPass = MIN2(cfModel.estimateSpeedAfterDistance(seen, v, cfModel.getMaxAccel()), laneMaxV); // upper bound int view = 0; DriveProcessItem* lastLink = 0; bool slowedDownForMinor = false; // whether the vehicle already had to slow down on approach to a minor link // iterator over subsequent lanes and fill lfLinks until stopping distance or stopped const MSLane* lane = opposite ? myLane->getOpposite() : myLane; + assert(lane != 0); const MSLane* leaderLane = myLane; +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4127) // do not warn about constant conditional expression +#endif while (true) { +#ifdef _MSC_VER +#pragma warning(pop) +#endif // check leader on lane // leader is given for the first edge only + if (opposite && + (leaderLane->getVehicleNumber() > 1 + || (leaderLane != myLane && leaderLane->getVehicleNumber() > 0))) { + // find opposite-driving leader that must be respected on the currently looked at lane + // XXX make sure to look no further than leaderLane + CLeaderDist leader = leaderLane->getOppositeLeader(this, getPositionOnLane(), true); + ahead.clear(); + if (leader.first != 0 && leader.first->getLane() == leaderLane && leader.first->getLaneChangeModel().isOpposite()) { + ahead.addLeader(leader.first, true); + } + } adaptToLeaders(ahead, 0, seen, lastLink, leaderLane, v, vLinkPass); #ifdef DEBUG_PLAN_MOVE if (DEBUG_COND) { @@ -1339,7 +1491,7 @@ // also slow down for leaders on the shadowLane relative to the current lane const MSLane* shadowLane = getLaneChangeModel().getShadowLane(lane); if (shadowLane != 0) { - const SUMOReal latOffset = getLane()->getRightSideOnEdge() - getLaneChangeModel().getShadowLane()->getRightSideOnEdge(); + const double latOffset = getLane()->getRightSideOnEdge() - getLaneChangeModel().getShadowLane()->getRightSideOnEdge(); adaptToLeaders(shadowLane->getLastVehicleInformation(this, latOffset, lane->getLength() - seen), latOffset, seen, lastLink, shadowLane, v, vLinkPass); @@ -1350,9 +1502,9 @@ if (!myStops.empty() && &myStops.begin()->lane->getEdge() == &lane->getEdge() && !myStops.begin()->reached) { // we are approaching a stop on the edge; must not drive further const Stop& stop = *myStops.begin(); - const SUMOReal endPos = (stop.busstop == 0 ? stop.endPos : stop.busstop->getLastFreePos(*this)) + NUMERICAL_EPS; + const double endPos = stop.getEndPos(*this) + NUMERICAL_EPS; myStopDist = seen + endPos - lane->getLength(); - const SUMOReal stopSpeed = cfModel.stopSpeed(this, getSpeed(), myStopDist); + const double stopSpeed = cfModel.stopSpeed(this, getSpeed(), myStopDist); if (lastLink != 0) { lastLink->adaptLeaveSpeed(cfModel.stopSpeed(this, vLinkPass, endPos)); } @@ -1374,11 +1526,11 @@ MSLinkCont::const_iterator link = MSLane::succLinkSec(*this, view + 1, *lane, bestLaneConts); // check whether the vehicle is on its final edge if (myCurrEdge + view + 1 == myRoute->end()) { - const SUMOReal arrivalSpeed = (myParameter->arrivalSpeedProcedure == ARRIVAL_SPEED_GIVEN ? - myParameter->arrivalSpeed : laneMaxV); + const double arrivalSpeed = (myParameter->arrivalSpeedProcedure == ARRIVAL_SPEED_GIVEN ? + myParameter->arrivalSpeed : laneMaxV); // subtract the arrival speed from the remaining distance so we get one additional driving step with arrival speed - const SUMOReal distToArrival = seen + myArrivalPos - lane->getLength() - SPEED2DIST(arrivalSpeed); - const SUMOReal va = cfModel.freeSpeed(this, getSpeed(), distToArrival, arrivalSpeed); + const double distToArrival = seen + myArrivalPos - lane->getLength() - SPEED2DIST(arrivalSpeed); + const double va = MAX2(NUMERICAL_EPS, cfModel.freeSpeed(this, getSpeed(), distToArrival, arrivalSpeed)); v = MIN2(v, va); if (lastLink != 0) { lastLink->adaptLeaveSpeed(va); @@ -1386,10 +1538,18 @@ lfLinks.push_back(DriveProcessItem(v, seen)); break; } - // check whether the lane or the shadowLane is a dead end + // check whether the lane or the shadowLane is a dead end (allow some leeway on intersections) if (lane->isLinkEnd(link) || - (getLaneChangeModel().getShadowLane() != 0 && getLaneChangeModel().getShadowLane(lane) == 0)) { - SUMOReal va = MIN2(cfModel.stopSpeed(this, getSpeed(), seen), laneMaxV); + ((*link)->getViaLane() == 0 + && getLateralOverlap() > NUMERICAL_EPS + // do not get stuck on narrow edges + && getVehicleType().getWidth() <= lane->getEdge().getWidth() && + // this is the exit link of a junction. The normal edge should support the shadow + ((getLaneChangeModel().getShadowLane((*link)->getLane()) == 0) + // the internal lane after an internal junction has no parallel lane. make sure there is no shadow before continuing + || (lane->getEdge().isInternal() && lane->getIncomingLanes()[0].lane->getEdge().isInternal())) + )) { + double va = MIN2(cfModel.stopSpeed(this, getSpeed(), seen), laneMaxV); if (lastLink != 0) { lastLink->adaptLeaveSpeed(va); } @@ -1411,8 +1571,8 @@ // vehicle 'decides' to accelerate and cannot enter the junction in // the next step, new foes may appear and cause a collision (see #1096) // - major links: stopping point is irrelevant - const SUMOReal laneStopOffset = yellowOrRed || (*link)->havePriority() ? DIST_TO_STOPLINE_EXPECT_PRIORITY : POSITION_EPS; - const SUMOReal stopDist = MAX2(SUMOReal(0), seen - laneStopOffset); + const double laneStopOffset = yellowOrRed || (*link)->havePriority() ? DIST_TO_STOPLINE_EXPECT_PRIORITY : POSITION_EPS; + const double stopDist = MAX2(0., seen - laneStopOffset); // check whether we need to slow down in order to finish a continuous lane change if (getLaneChangeModel().isChangingLanes()) { if ( // slow down to finish lane change before a turn lane @@ -1421,10 +1581,10 @@ (getLaneChangeModel().getShadowLane() != 0 && (*link)->getViaLaneOrLane()->getParallelLane(getLaneChangeModel().getShadowDirection()) == 0)) { // XXX maybe this is too harsh. Vehicles could cut some corners here - const SUMOReal timeRemaining = STEPS2TIME(getLaneChangeModel().remainingTime()); + const double timeRemaining = STEPS2TIME(getLaneChangeModel().remainingTime()); assert(timeRemaining != 0); // we seem to suppose that isChangingLanes() implies this (Leo) // XXX: Euler-logic (#860), but I couldn't identify problems from this yet (Leo). Refs. #2575 - const SUMOReal va = MAX2((SUMOReal)0, (seen - POSITION_EPS) / timeRemaining); + const double va = MAX2(0., (seen - POSITION_EPS) / timeRemaining); #ifdef DEBUG_PLAN_MOVE if (DEBUG_COND) std::cout << SIMTIME << " veh=" << getID() << " slowing down to finish continuous change before" << " link=" << (*link)->getViaLaneOrLane()->getID() @@ -1444,66 +1604,67 @@ // - even if red, if we cannot break we should issue a request bool setRequest = (v > 0 && !abortRequestAfterMinor) || (leavingCurrentIntersection); - SUMOReal vLinkWait = MIN2(v, cfModel.stopSpeed(this, getSpeed(), stopDist)); - const SUMOReal brakeDist = cfModel.brakeGap(myState.mySpeed, cfModel.getMaxDecel(), 0.); - if (yellowOrRed && seen >= brakeDist) { + double vLinkWait = MIN2(v, cfModel.stopSpeed(this, getSpeed(), stopDist)); + const double brakeDist = cfModel.brakeGap(myState.mySpeed, cfModel.getMaxDecel(), 0.); +#ifdef DEBUG_PLAN_MOVE + gDebugFlag1 = DEBUG_COND; + if (DEBUG_COND) std::cout + << " stopDist=" << stopDist + << " vLinkWait=" << vLinkWait + << " brakeDist=" << brakeDist + << "\n"; +#endif + if (yellowOrRed && seen >= brakeDist && (myInfluencer == 0 || myInfluencer->getEmergencyBrakeRedLight())) { // the vehicle is able to brake in front of a yellow/red traffic light lfLinks.push_back(DriveProcessItem(*link, vLinkWait, vLinkWait, false, t + TIME2STEPS(seen / MAX2(vLinkWait, NUMERICAL_EPS)), vLinkWait, 0, 0, seen)); //lfLinks.push_back(DriveProcessItem(0, vLinkWait, vLinkWait, false, 0, 0, stopDist)); break; } -#ifdef HAVE_INTERNAL_LANES if (MSGlobals::gUsingInternalLanes) { // we want to pass the link but need to check for foes on internal lanes - const MSLink::LinkLeaders linkLeaders = (*link)->getLeaderInfo(seen, getVehicleType().getMinGap()); - for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) { - // the vehicle to enter the junction first has priority - const MSVehicle* leader = (*it).vehAndGap.first; - if (leader == 0) { - // leader is a pedestrian. Passing 'this' as a dummy. - //std::cout << SIMTIME << " veh=" << getID() << " is blocked on link to " << (*link)->getViaLaneOrLane()->getID() << " by pedestrian. dist=" << it->distToCrossing << "\n"; - adaptToLeader(std::make_pair(this, -1), seen, lastLink, lane, v, vLinkPass, it->distToCrossing); - } else if ((*link)->isLeader(this, leader)) { - adaptToLeader(it->vehAndGap, seen, lastLink, lane, v, vLinkPass, it->distToCrossing); - if (lastLink != 0) { - // we are not yet on the junction with this linkLeader. - // at least we can drive up to the previous link and stop there - v = MAX2(v, lastLink->myVLinkWait); - } - // if blocked by a leader from the same lane we must yield our request - if (v < SUMO_const_haltingSpeed && leader->getLane()->getLogicalPredecessorLane() == myLane->getLogicalPredecessorLane()) { - setRequest = false; - } + checkLinkLeader(*link, lane, seen, lastLink, v, vLinkPass, vLinkWait, setRequest); + if (getLaneChangeModel().getShadowLane() != 0) { + MSLink* parallelLink = (*link)->getParallelLink(getLaneChangeModel().getShadowDirection()); + if (parallelLink != 0) { + checkLinkLeader(parallelLink, lane, seen, lastLink, v, vLinkPass, vLinkWait, setRequest); } } - // if this is the link between two internal lanes we may have to slow down for pedestrians - vLinkWait = MIN2(vLinkWait, v); } -#endif if (lastLink != 0) { lastLink->adaptLeaveSpeed(laneMaxV); } - SUMOReal arrivalSpeed = vLinkPass; + double arrivalSpeed = vLinkPass; // vehicles should decelerate when approaching a minor link // - unless they are close enough to have clear visibility of all relevant foe lanes and may start to accelerate again // - and unless they are so close that stopping is impossible (i.e. when a green light turns to yellow when close to the junction) // whether the vehicle/driver is close enough to the link to see all possible foes #2123 - SUMOReal visibilityDistance = (*link)->getFoeVisibilityDistance(); - SUMOReal determinedFoePresence = seen < visibilityDistance; + double visibilityDistance = (*link)->getFoeVisibilityDistance(); + double determinedFoePresence = seen < visibilityDistance; // // VARIANT: account for time needed to recognize whether relevant vehicles are on the foe lanes. (Leo) -// SUMOReal foeRecognitionTime = 0.0; -// SUMOReal determinedFoePresence = seen < visibilityDistance - myState.mySpeed*foeRecognitionTime; +// double foeRecognitionTime = 0.0; +// double determinedFoePresence = seen < visibilityDistance - myState.mySpeed*foeRecognitionTime; + +#ifdef DEBUG_PLAN_MOVE + if (DEBUG_COND) { + std::cout << " approaching link=" << (*link)->getViaLaneOrLane()->getID() << " prio=" << (*link)->havePriority() << " seen=" << seen << " visibilityDistance=" << visibilityDistance << " brakeDist=" << brakeDist << "\n"; + } +#endif if (!(*link)->havePriority() && !determinedFoePresence && brakeDist < seen) { // vehicle decelerates just enough to be able to stop if necessary and then accelerates - SUMOReal maxSpeedAtVisibilityDist = cfModel.maximumSafeStopSpeed(visibilityDistance, myState.mySpeed, false, 0.); + double maxSpeedAtVisibilityDist = cfModel.maximumSafeStopSpeed(visibilityDistance, myState.mySpeed, false, 0.); // XXX: estimateSpeedAfterDistance does not use euler-logic (thus returns a lower value than possible here...) - SUMOReal maxArrivalSpeed = cfModel.estimateSpeedAfterDistance(visibilityDistance, maxSpeedAtVisibilityDist, cfModel.getMaxAccel()); + double maxArrivalSpeed = cfModel.estimateSpeedAfterDistance(visibilityDistance, maxSpeedAtVisibilityDist, cfModel.getMaxAccel()); arrivalSpeed = MIN2(vLinkPass, maxArrivalSpeed); slowedDownForMinor = true; +#ifdef DEBUG_PLAN_MOVE + if (DEBUG_COND) { + std::cout << " slowedDownForMinor maxArrivalSpeed=" << maxArrivalSpeed << " arrivalSpeed=" << arrivalSpeed << "\n"; + } +#endif } SUMOTime arrivalTime; @@ -1518,7 +1679,7 @@ // compute arrival speed and arrival time if vehicle starts braking now // if stopping is possible, arrivalTime can be arbitrarily large. A small value keeps fractional times (impatience) meaningful - SUMOReal arrivalSpeedBraking = 0; + double arrivalSpeedBraking = 0; SUMOTime arrivalTimeBraking = arrivalTime + TIME2STEPS(30); if (seen < cfModel.brakeGap(v)) { // XXX: should this use the current speed (at least for the ballistic case)? (Leo) Refs. #2575 // vehicle cannot come to a complete stop in time @@ -1536,14 +1697,10 @@ arrivalTimeBraking, arrivalSpeedBraking, seen, estimateLeaveSpeed(*link, arrivalSpeed))); -#ifdef HAVE_INTERNAL_LANES if ((*link)->getViaLane() == 0) { hadNonInternal = true; ++view; } -#else - ++view; -#endif // we need to look ahead far enough to see available space for checkRewindLinkLanes if ((!setRequest || v <= 0 || seen > dist) && hadNonInternal && seenNonInternal > vehicleLength * CRLL_LOOK_AHEAD) { break; @@ -1554,12 +1711,14 @@ // the link was passed // compute the velocity to use when the link is not blocked by other vehicles // the vehicle shall be not faster when reaching the next lane than allowed - const SUMOReal va = MAX2(laneMaxV, cfModel.freeSpeed(this, getSpeed(), seen, laneMaxV)); + const double va = MAX2(laneMaxV, cfModel.freeSpeed(this, getSpeed(), seen, laneMaxV)); v = MIN2(va, v); seenNonInternal += lane->getEdge().getPurpose() == MSEdge::EDGEFUNCTION_INTERNAL ? 0 : lane->getLength(); // do not restrict results to the current vehicle to allow caching for the current time step - leaderLane = lane; // (opposite && lane->getOpposite() != 0) ? lane->getOpposite() : lane; - // ignore leaders while overtaking through the opposite direction lane + leaderLane = opposite ? lane->getOpposite() : lane; + if (leaderLane == 0) { + break; + } ahead = opposite ? MSLeaderInfo(leaderLane) : leaderLane->getLastVehicleInformation(0, 0); seen += lane->getLength(); vLinkPass = MIN2(cfModel.estimateSpeedAfterDistance(lane->getLength(), v, cfModel.getMaxAccel()), laneMaxV); // upper bound @@ -1576,9 +1735,9 @@ void -MSVehicle::adaptToLeaders(const MSLeaderInfo& ahead, SUMOReal latOffset, - const SUMOReal seen, DriveProcessItem* const lastLink, - const MSLane* const lane, SUMOReal& v, SUMOReal& vLinkPass) const { +MSVehicle::adaptToLeaders(const MSLeaderInfo& ahead, double latOffset, + const double seen, DriveProcessItem* const lastLink, + const MSLane* const lane, double& v, double& vLinkPass) const { int rightmost; int leftmost; ahead.getSubLanes(this, latOffset, rightmost, leftmost); @@ -1595,10 +1754,10 @@ const MSVehicle* pred = ahead[sublane]; if (pred != 0) { // @todo avoid multiple adaptations to the same leader - const SUMOReal predBack = pred->getBackPositionOnLane(lane); - const SUMOReal gap = (lastLink == 0 - ? predBack - myState.myPos - getVehicleType().getMinGap() - : predBack + seen - lane->getLength() - getVehicleType().getMinGap()); + const double predBack = pred->getBackPositionOnLane(lane); + const double gap = (lastLink == 0 + ? predBack - myState.myPos - getVehicleType().getMinGap() + : predBack + seen - lane->getLength() - getVehicleType().getMinGap()); #ifdef DEBUG_PLAN_MOVE if (DEBUG_COND) { std::cout << " pred=" << pred->getID() << " predLane=" << pred->getLane()->getID() << " predPos=" << pred->getPositionOnLane() << " gap=" << gap << " predBack=" << predBack << " seen=" << seen << " lane=" << lane->getID() << " myLane=" << myLane->getID() << "\n"; @@ -1611,12 +1770,12 @@ void -MSVehicle::adaptToLeader(const std::pair leaderInfo, - const SUMOReal seen, DriveProcessItem* const lastLink, - const MSLane* const lane, SUMOReal& v, SUMOReal& vLinkPass, - SUMOReal distToCrossing) const { +MSVehicle::adaptToLeader(const std::pair leaderInfo, + const double seen, DriveProcessItem* const lastLink, + const MSLane* const lane, double& v, double& vLinkPass, + double distToCrossing) const { if (leaderInfo.first != 0) { - const SUMOReal vsafeLeader = getSafeFollowSpeed(leaderInfo, seen, lane, distToCrossing); + const double vsafeLeader = getSafeFollowSpeed(leaderInfo, seen, lane, distToCrossing); if (lastLink != 0) { lastLink->adaptLeaveSpeed(vsafeLeader); } @@ -1646,12 +1805,41 @@ } -SUMOReal -MSVehicle::getSafeFollowSpeed(const std::pair leaderInfo, - const SUMOReal seen, const MSLane* const lane, SUMOReal distToCrossing) const { +void +MSVehicle::checkLinkLeader(const MSLink* link, const MSLane* lane, double seen, + DriveProcessItem* const lastLink, double& v, double& vLinkPass, double& vLinkWait, bool& setRequest) const { + const MSLink::LinkLeaders linkLeaders = link->getLeaderInfo(this, seen); + for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) { + // the vehicle to enter the junction first has priority + const MSVehicle* leader = (*it).vehAndGap.first; + if (leader == 0) { + // leader is a pedestrian. Passing 'this' as a dummy. + //std::cout << SIMTIME << " veh=" << getID() << " is blocked on link to " << (*link)->getViaLaneOrLane()->getID() << " by pedestrian. dist=" << it->distToCrossing << "\n"; + adaptToLeader(std::make_pair(this, -1), seen, lastLink, lane, v, vLinkPass, it->distToCrossing); + } else if (link->isLeader(this, leader)) { + adaptToLeader(it->vehAndGap, seen, lastLink, lane, v, vLinkPass, it->distToCrossing); + if (lastLink != 0) { + // we are not yet on the junction with this linkLeader. + // at least we can drive up to the previous link and stop there + v = MAX2(v, lastLink->myVLinkWait); + } + // if blocked by a leader from the same lane we must yield our request + if (v < SUMO_const_haltingSpeed && leader->getLane()->getLogicalPredecessorLane() == myLane->getLogicalPredecessorLane()) { + setRequest = false; + } + } + } + // if this is the link between two internal lanes we may have to slow down for pedestrians + vLinkWait = MIN2(vLinkWait, v); +} + + +double +MSVehicle::getSafeFollowSpeed(const std::pair leaderInfo, + const double seen, const MSLane* const lane, double distToCrossing) const { assert(leaderInfo.first != 0); const MSCFModel& cfModel = getCarFollowModel(); - SUMOReal vsafeLeader = 0; + double vsafeLeader = 0; if (leaderInfo.second >= 0) { vsafeLeader = cfModel.followSpeed(this, getSpeed(), leaderInfo.second, leaderInfo.first->getSpeed(), leaderInfo.first->getCarFollowModel().getMaxDecel()); } else { @@ -1666,12 +1854,12 @@ return vsafeLeader; } -SUMOReal -MSVehicle::getDeltaPos(SUMOReal accel) { - SUMOReal vNext = myState.mySpeed + ACCEL2SPEED(accel); +double +MSVehicle::getDeltaPos(double accel) { + double vNext = myState.mySpeed + ACCEL2SPEED(accel); if (MSGlobals::gSemiImplicitEulerUpdate) { // apply implicit Euler positional update - return SPEED2DIST(MAX2(vNext, (SUMOReal)0.)); + return SPEED2DIST(MAX2(vNext, 0.)); } else { // apply ballistic update if (vNext >= 0) { @@ -1705,12 +1893,12 @@ #endif // get safe velocities from DriveProcessItems - SUMOReal vSafe = 0; // maximum safe velocity (XXX: why init this as 0 !? Confusing... (Leo)) Refs. #2575 - SUMOReal vSafeZipper = std::numeric_limits::max(); // speed limit due to zipper merging - SUMOReal vSafeMin = 0; // minimum safe velocity + double vSafe = 0; // maximum safe velocity (XXX: why init this as 0 !? (Leo)) Refs. #2575 + double vSafeZipper = std::numeric_limits::max(); // speed limit due to zipper merging + double vSafeMin = 0; // minimum safe velocity // the distance to a link which should either be crossed this step or in // front of which we need to stop - SUMOReal vSafeMinDist = 0; + double vSafeMinDist = 0; myHaveToWaitOnNextLink = false; assert(myLFLinkLanes.size() != 0 || isRemoteControlled()); @@ -1736,7 +1924,7 @@ const LinkState ls = link->getState(); // vehicles should brake when running onto a yellow light if the distance allows to halt in front const bool yellow = ls == LINKSTATE_TL_YELLOW_MAJOR || ls == LINKSTATE_TL_YELLOW_MINOR; - const SUMOReal brakeGap = getCarFollowModel().brakeGap(myState.mySpeed, getCarFollowModel().getMaxDecel(), 0.); + const double brakeGap = getCarFollowModel().brakeGap(myState.mySpeed, getCarFollowModel().getMaxDecel(), 0.); if (yellow && ((*i).myDistance > brakeGap || (MSGlobals::gSemiImplicitEulerUpdate && myState.mySpeed < ACCEL2SPEED(getCarFollowModel().getMaxDecel())))) { vSafe = (*i).myVLinkWait; myHaveToWaitOnNextLink = true; @@ -1759,8 +1947,8 @@ if (opened && getLaneChangeModel().getShadowLane() != 0) { MSLink* parallelLink = (*i).myLink->getParallelLink(getLaneChangeModel().getShadowDirection()); if (parallelLink != 0) { - const SUMOReal shadowLatPos = getLateralPositionOnLane() - getLaneChangeModel().getShadowDirection() * 0.5 * ( - myLane->getWidth() + getLaneChangeModel().getShadowLane()->getWidth()); + const double shadowLatPos = getLateralPositionOnLane() - getLaneChangeModel().getShadowDirection() * 0.5 * ( + myLane->getWidth() + getLaneChangeModel().getShadowLane()->getWidth()); opened &= parallelLink->opened((*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(), getVehicleType().getLength(), getImpatience(), getCarFollowModel().getMaxDecel(), @@ -1779,8 +1967,8 @@ } // vehicles should decelerate when approaching a minor link if (opened && !influencerPrio && !link->havePriority() && !link->lastWasContMajor() && !link->isCont()) { - SUMOReal visibilityDistance = link->getFoeVisibilityDistance(); - SUMOReal determinedFoePresence = i->myDistance <= visibilityDistance; + double visibilityDistance = link->getFoeVisibilityDistance(); + double determinedFoePresence = i->myDistance <= visibilityDistance; if (!determinedFoePresence) { vSafe = (*i).myVLinkWait; myHaveToWaitOnNextLink = true; @@ -1797,9 +1985,9 @@ // could appear on a major foe link and cause a collision. Refs. #1845, #2123 vSafeMinDist = myLane->getLength() - getPositionOnLane(); // distance that must be covered if (MSGlobals::gSemiImplicitEulerUpdate) { - vSafeMin = MIN2((SUMOReal) DIST2SPEED(vSafeMinDist + POSITION_EPS), (*i).myVLinkPass); + vSafeMin = MIN2((double) DIST2SPEED(vSafeMinDist + POSITION_EPS), (*i).myVLinkPass); } else { - vSafeMin = MIN2((SUMOReal) DIST2SPEED(2 * vSafeMinDist + NUMERICAL_EPS) - getSpeed(), (*i).myVLinkPass); + vSafeMin = MIN2((double) DIST2SPEED(2 * vSafeMinDist + NUMERICAL_EPS) - getSpeed(), (*i).myVLinkPass); } } } @@ -1843,7 +2031,7 @@ // std::cout << "vSafeMin = " << toString(vSafeMin, 24) << "" << std::endl; // std::cout << "vSafeMinDist = " << toString(vSafeMinDist, 24) << "" << std::endl; // -// SUMOReal gap = getLeader().second; +// double gap = getLeader().second; // std::cout << "gap = " << toString(gap, 24) << std::endl; // std::cout << "vSafeStoppedLeader = " << toString(getCarFollowModel().stopSpeed(this, getSpeed(), gap), 24) // << "\n" << std::endl; @@ -1884,11 +2072,11 @@ // To avoid casual blinking brake lights at high speeds due to dawdling of the // leading vehicle, we don't show brake lights when the deceleration could be caused // by frictional forces and air resistance (i.e. proportional to v^2, coefficient could be adapted further) - SUMOReal pseudoFriction = (0.05 + 0.005 * getSpeed()) * getSpeed(); + double pseudoFriction = (0.05 + 0.005 * getSpeed()) * getSpeed(); bool brakelightsOn = vSafe < getSpeed() - ACCEL2SPEED(pseudoFriction); // apply speed reduction due to dawdling / lane changing but ensure minimum safe speed - SUMOReal vNext; + double vNext; if (MSGlobals::gSemiImplicitEulerUpdate) { vNext = MAX2(getCarFollowModel().moveHelper(this, vSafe), vSafeMin); } else { @@ -1924,7 +2112,7 @@ //} if (MSGlobals::gSemiImplicitEulerUpdate) { - vNext = MAX2(vNext, (SUMOReal) 0.); + vNext = MAX2(vNext, 0.); } else { // (Leo) Ballistic: negative vNext can be used to indicate a stop within next step. // moveHelper() should take care of any bounds on the possible deceleration and @@ -1936,8 +2124,8 @@ if (myInfluencer->isVTDControlled()) { vNext = myInfluencer->implicitSpeedVTD(this, myState.mySpeed); } - const SUMOReal vMax = getVehicleType().getCarFollowModel().maxNextSpeed(myState.mySpeed, this); - const SUMOReal vMin = MAX2(SUMOReal(0), getVehicleType().getCarFollowModel().getSpeedAfterMaxDecel(myState.mySpeed)); + const double vMax = getVehicleType().getCarFollowModel().maxNextSpeed(myState.mySpeed, this); + const double vMin = MAX2(0., getVehicleType().getCarFollowModel().getSpeedAfterMaxDecel(myState.mySpeed)); vNext = myInfluencer->influenceSpeed(MSNet::getInstance()->getCurrentTimeStep(), vNext, vSafe, vMin, vMax); } #endif @@ -1975,7 +2163,6 @@ MSLane* approachedLane = myLane; // move the vehicle forward for (i = myLFLinkLanes.begin(); i != myLFLinkLanes.end() && approachedLane != 0 && myState.myPos > approachedLane->getLength(); ++i) { - leaveLane(MSMoveReminder::NOTIFICATION_JUNCTION); MSLink* link = (*i).myLink; // check whether the vehicle was allowed to enter lane // otherwise it is decelerated and we do not need to test for it's @@ -1993,24 +2180,26 @@ #ifndef NO_TRACI } #endif + } else if (myState.myPos < myLane->getLength() + NUMERICAL_EPS) { + approachedLane = myLane; + myState.myPos = myLane->getLength(); } else { emergencyReason = " because there is no connection to the next edge"; approachedLane = 0; break; } if (approachedLane != myLane && approachedLane != 0) { + leaveLane(MSMoveReminder::NOTIFICATION_JUNCTION, approachedLane); myState.myPos -= myLane->getLength(); assert(myState.myPos > 0); enterLaneAtMove(approachedLane); myLane = approachedLane; -#ifdef HAVE_INTERNAL_LANES if (MSGlobals::gUsingInternalLanes) { // erase leaders when past the junction if (link->getViaLane() == 0) { link->passedJunction(this); } } -#endif if (hasArrived()) { break; } @@ -2032,6 +2221,14 @@ } } } + // update time loss (depends on the updated edge) + if (!isStopped()) { + const double vmax = myLane->getVehicleMaxSpeed(this); + if (vmax > 0) { + myTimeLoss += TIME2STEPS(TS * (vmax - vNext) / vmax); + } + } + myCollisionImmunity = MAX2((SUMOTime) - 1, myCollisionImmunity - DELTA_T); if (!hasArrived() && !myLane->getEdge().isVaporizing()) { if (myState.myPos > myLane->getLength()) { @@ -2049,9 +2246,12 @@ passedLanes.clear(); // ignore back occupation } myState.myBackPos = updateFurtherLanes(myFurtherLanes, myFurtherLanesPosLat, passedLanes); - updateBestLanes(); // bestLanes need to be updated before lane changing starts - if (getLaneChangeModel().getShadowLane() != 0 && (moved || oldBackLane != getBackLane())) { + updateBestLanes(); + // shadow lane must be updated if the front or back lane changed + // either if we already have a shadowLane or if there is lateral overlap + if ((getLaneChangeModel().getShadowLane() != 0 || getLateralOverlap() > POSITION_EPS) + && (moved || oldBackLane != getBackLane())) { getLaneChangeModel().updateShadowLane(); } setBlinkerInformation(); // needs updated bestLanes @@ -2087,9 +2287,9 @@ void -MSVehicle::updateState(SUMOReal vNext) { +MSVehicle::updateState(double vNext) { // update position and speed - SUMOReal deltaPos; // positional change + double deltaPos; // positional change if (MSGlobals::gSemiImplicitEulerUpdate) { deltaPos = SPEED2DIST(vNext); } else { @@ -2104,7 +2304,7 @@ // TODO: recheck, approve, refs. #2579 // NOTE: for the ballistic update this is in general // not equal to vNext - myState.mySpeed - myAcceleration = SPEED2ACCEL(MAX2(vNext, (SUMOReal)0.) - myState.mySpeed); + myAcceleration = SPEED2ACCEL(MAX2(vNext, 0.) - myState.mySpeed); //#ifdef DEBUG_EXEC_MOVE // if (DEBUG_COND) { @@ -2113,7 +2313,7 @@ //#endif myState.myPreviousSpeed = myState.mySpeed; - myState.mySpeed = MAX2(vNext, (SUMOReal)0.); + myState.mySpeed = MAX2(vNext, 0.); #ifndef NO_TRACI if (myInfluencer != 0 && myInfluencer->isVTDControlled()) { @@ -2143,8 +2343,8 @@ } -SUMOReal -MSVehicle::updateFurtherLanes(std::vector& furtherLanes, std::vector& furtherLanesPosLat, +double +MSVehicle::updateFurtherLanes(std::vector& furtherLanes, std::vector& furtherLanesPosLat, const std::vector& passedLanes) { // XXX only reset / set the values that were changed @@ -2159,15 +2359,20 @@ (*i)->resetPartialOccupation(this); } const MSLane* firstOldFurther = furtherLanes.size() > 0 ? furtherLanes.front() : 0; + bool newFurther = true; // update furtherLanes - SUMOReal result = myState.myPos - getVehicleType().getLength(); + double result = myState.myPos - getVehicleType().getLength(); furtherLanes.clear(); if (passedLanes.size() > 0) { - SUMOReal leftLength = getVehicleType().getLength() - myState.myPos; + double leftLength = getVehicleType().getLength() - myState.myPos; std::vector::const_reverse_iterator i = passedLanes.rbegin() + 1; while (leftLength > 0 && i != passedLanes.rend()) { furtherLanes.push_back(*i); - if (*i != firstOldFurther) { + // add new lateral values until hitting the first known further lane + if (*i == firstOldFurther) { + newFurther = false; + } + if (newFurther) { furtherLanesPosLat.insert(furtherLanesPosLat.begin(), myState.myPosLat); } #ifdef DEBUG_FURTHER @@ -2194,7 +2399,7 @@ } -SUMOReal +double MSVehicle::getBackPositionOnLane(const MSLane* lane) const { #ifdef DEBUG_FURTHER //if (DEBUG_COND) std::cout << SIMTIME @@ -2221,7 +2426,7 @@ return myState.myBackPos; } else { //if (DEBUG_COND) std::cout << SIMTIME << " veh=" << getID() << " myFurtherLanes=" << toString(myFurtherLanes) << "\n"; - SUMOReal leftLength = myType->getLength() - myState.myPos; + double leftLength = myType->getLength() - myState.myPos; std::vector::const_iterator i = myFurtherLanes.begin(); while (leftLength > 0 && i != myFurtherLanes.end()) { leftLength -= (*i)->getLength(); @@ -2243,12 +2448,14 @@ ++i; } assert(false); - throw ProcessError("Request backPos of vehicle '" + getID() + "' for invalid lane '" + Named::getIDSecure(lane) + "'"); + WRITE_WARNING("Request backPos of vehicle '" + getID() + "' for invalid lane '" + Named::getIDSecure(lane) + + "' time=" + time2string(MSNet::getInstance()->getCurrentTimeStep()) + ".") + return myState.myBackPos; } } -SUMOReal +double MSVehicle::getPositionOnLane(const MSLane* lane) const { return getBackPositionOnLane(lane) + myType->getLength(); } @@ -2260,16 +2467,17 @@ } -SUMOReal +double MSVehicle::getSpaceTillLastStanding(const MSLane* l, bool& foundStopped) const { - SUMOReal lengths = 0; + double lengths = 0; const MSLane::VehCont& vehs = l->getVehiclesSecure(); for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) { if ((*i)->getSpeed() < SUMO_const_haltingSpeed && !(*i)->getLane()->getEdge().isRoundabout() + && (*i) != this // @todo recheck && (*i)->isFrontOnLane(l)) { foundStopped = true; - const SUMOReal ret = (*i)->getPositionOnLane() - (*i)->getVehicleType().getLengthWithGap() - lengths; + const double ret = (*i)->getPositionOnLane() - (*i)->getVehicleType().getLengthWithGap() - lengths; l->releaseVehicles(); return ret; } @@ -2281,16 +2489,15 @@ void -MSVehicle::checkRewindLinkLanes(const SUMOReal lengthsInFront, DriveItemVector& lfLinks) const { +MSVehicle::checkRewindLinkLanes(const double lengthsInFront, DriveItemVector& lfLinks) const { #ifdef DEBUG_VEHICLE_GUI_SELECTION if (gDebugSelectedVehicle == getID()) { int bla = 0; } #endif -#ifdef HAVE_INTERNAL_LANES if (MSGlobals::gUsingInternalLanes && !myLane->getEdge().isRoundabout() && !getLaneChangeModel().isOpposite()) { bool hadVehicle = false; - SUMOReal seenSpace = -lengthsInFront; + double seenSpace = -lengthsInFront; bool foundStopped = false; // compute available space until a stopped vehicle is found @@ -2309,6 +2516,9 @@ if (item.myLink->hasFoes() && item.myLink->keepClear()/* && item.myLink->willHaveBlockedFoe()*/) { seenSpace = seenSpace - approachedLane->getBruttoVehLenSum(); hadVehicle |= approachedLane->getVehicleNumber() != 0; + if (approachedLane == myLane) { + seenSpace += getVehicleType().getLengthWithGap(); + } } else { seenSpace = seenSpace + getSpaceTillLastStanding(approachedLane, foundStopped);// - approachedLane->getBruttoVehLenSum() + approachedLane->getLength(); hadVehicle |= approachedLane->getVehicleNumber() != 0; @@ -2331,7 +2541,7 @@ } approachedLane = item.myLink->getLane(); const MSVehicle* last = approachedLane->getLastAnyVehicle(); - if (last == 0) { + if (last == 0 || last == this) { seenSpace += approachedLane->getLength(); item.availableSpace = seenSpace; } else if (!last->isFrontOnLane(approachedLane)) { @@ -2359,10 +2569,10 @@ } else { if (last->signalSet(VEH_SIGNAL_BRAKELIGHT)) { - const SUMOReal lastBrakeGap = last->getCarFollowModel().brakeGap(last->getSpeed()); - const SUMOReal lastGap = last->getBackPositionOnLane(approachedLane) + lastBrakeGap - last->getSpeed() * last->getCarFollowModel().getHeadwayTime() - // gap of last up to the next intersection - - last->getVehicleType().getMinGap(); + const double lastBrakeGap = last->getCarFollowModel().brakeGap(last->getSpeed()); + const double lastGap = last->getBackPositionOnLane(approachedLane) + lastBrakeGap - last->getSpeed() * last->getCarFollowModel().getHeadwayTime() + // gap of last up to the next intersection + - last->getVehicleType().getMinGap(); item.availableSpace = MAX2(seenSpace, seenSpace + lastGap); seenSpace += getSpaceTillLastStanding(approachedLane, foundStopped);// - approachedLane->getBruttoVehLenSum() + approachedLane->getLength(); } else { @@ -2428,18 +2638,18 @@ continue; } /* - SUMOReal impatienceCorrection = MAX2(SUMOReal(0), SUMOReal(SUMOReal(myWaitingTime))); + double impatienceCorrection = MAX2(0., double(double(myWaitingTime))); if (seenSpacewillHaveBlockedFoe()*/) { - SUMOReal impatienceCorrection = 0; + double impatienceCorrection = 0; /* if(item.myLink->getState()==LINKSTATE_MINOR) { - impatienceCorrection = MAX2(SUMOReal(0), STEPS2TIME(myWaitingTime)); + impatienceCorrection = MAX2(0., STEPS2TIME(myWaitingTime)); } */ if (leftSpace < -impatienceCorrection / 10. && item.myLink->hasFoes() && item.myLink->keepClear()) { @@ -2451,7 +2661,7 @@ // abort requests if (removalBegin != -1 && !(removalBegin == 0 && myLane->getEdge().getPurpose() == MSEdge::EDGEFUNCTION_INTERNAL)) { while (removalBegin < (int)(lfLinks.size())) { - const SUMOReal brakeGap = getCarFollowModel().brakeGap(myState.mySpeed, getCarFollowModel().getMaxDecel(), 0.); + const double brakeGap = getCarFollowModel().brakeGap(myState.mySpeed, getCarFollowModel().getMaxDecel(), 0.); lfLinks[removalBegin].myVLinkPass = lfLinks[removalBegin].myVLinkWait; if (lfLinks[removalBegin].myDistance >= brakeGap || (lfLinks[removalBegin].myDistance > 0 && myState.mySpeed < ACCEL2SPEED(getCarFollowModel().getMaxDecel()))) { lfLinks[removalBegin].mySetRequest = false; @@ -2460,9 +2670,6 @@ } } } -#else - UNUSED_PARAMETER(lengthsInFront); -#endif for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) { if ((*i).myLink != 0) { if ((*i).myLink->getState() == LINKSTATE_ALLWAY_STOP) { @@ -2489,7 +2696,7 @@ void -MSVehicle::activateReminders(const MSMoveReminder::Notification reason) { +MSVehicle::activateReminders(const MSMoveReminder::Notification reason, const MSLane* enteredLane) { for (MoveReminderCont::iterator rem = myMoveReminders.begin(); rem != myMoveReminders.end();) { // skip the reminder if it is a lane reminder but not for my lane if (rem->first->getLane() != 0 && rem->second > 0.) { @@ -2500,7 +2707,7 @@ #endif ++rem; } else { - if (rem->first->notifyEnter(*this, reason)) { + if (rem->first->notifyEnter(*this, reason, enteredLane)) { #ifdef _DEBUG if (myTraceMoveReminders) { traceMoveReminder("notifyEnter", rem->first, rem->second, true); @@ -2512,6 +2719,7 @@ if (myTraceMoveReminders) { traceMoveReminder("notifyEnter", rem->first, rem->second, false); } +// std::cout << SIMTIME << " Vehicle '" << getID() << "' erases MoveReminder (with offset " << rem->second << ")" << std::endl; #endif rem = myMoveReminders.erase(rem); } @@ -2531,7 +2739,7 @@ return true; } */ - // move mover reminder one lane further + // Adjust MoveReminder offset to the next lane adaptLaneEntering2MoveReminder(*enteredLane); // set the entered lane as the current lane myLane = enteredLane; @@ -2542,16 +2750,13 @@ ++myCurrEdge; } if (!onTeleporting) { - activateReminders(MSMoveReminder::NOTIFICATION_JUNCTION); + activateReminders(MSMoveReminder::NOTIFICATION_JUNCTION, enteredLane); } else { // normal move() isn't called so reset position here. must be done // before calling reminders - // XXX: This seems strange to me since in activateReminders, which (e.g. for induction loops) - // may call notifyEnter making use of the stored position to decide whether or not to add the vehicle... - // Please recheck (Leo), refs. #2579 myState.myPos = 0; myCachedPosition = Position::INVALID; - activateReminders(MSMoveReminder::NOTIFICATION_TELEPORT); + activateReminders(MSMoveReminder::NOTIFICATION_TELEPORT, enteredLane); } return hasArrived(); } @@ -2569,9 +2774,9 @@ for (std::vector< MSMoveReminder* >::const_iterator rem = enteredLane->getMoveReminders().begin(); rem != enteredLane->getMoveReminders().end(); ++rem) { addReminder(*rem); } - activateReminders(MSMoveReminder::NOTIFICATION_LANE_CHANGE); + activateReminders(MSMoveReminder::NOTIFICATION_LANE_CHANGE, enteredLane); MSLane* lane = myLane; - SUMOReal leftLength = getVehicleType().getLength() - myState.myPos; + double leftLength = getVehicleType().getLength() - myState.myPos; for (int i = 0; i < (int)myFurtherLanes.size(); i++) { if (lane != 0) { lane = lane->getLogicalPredecessorLane(myFurtherLanes[i]->getEdge()); @@ -2608,7 +2813,7 @@ void -MSVehicle::enterLaneAtInsertion(MSLane* enteredLane, SUMOReal pos, SUMOReal speed, SUMOReal posLat, MSMoveReminder::Notification notification) { +MSVehicle::enterLaneAtInsertion(MSLane* enteredLane, double pos, double speed, double posLat, MSMoveReminder::Notification notification) { myState = State(pos, speed, posLat, pos - getVehicleType().getLength()); if (myDeparture == NOT_YET_DEPARTED) { onDepart(); @@ -2624,21 +2829,35 @@ for (std::vector< MSMoveReminder* >::const_iterator rem = enteredLane->getMoveReminders().begin(); rem != enteredLane->getMoveReminders().end(); ++rem) { addReminder(*rem); } - activateReminders(notification); + activateReminders(notification, enteredLane); } // build the list of lanes the vehicle is lapping into - SUMOReal leftLength = myType->getLength() - pos; - MSLane* clane = enteredLane; - while (leftLength > 0) { - clane = clane->getLogicalPredecessorLane(); - if (clane == 0 || clane == myLane) { - break; + if (!myLaneChangeModel->isOpposite()) { + double leftLength = myType->getLength() - pos; + MSLane* clane = enteredLane; + while (leftLength > 0) { + clane = clane->getLogicalPredecessorLane(); + if (clane == 0 || clane == myLane) { + break; + } + myFurtherLanes.push_back(clane); + myFurtherLanesPosLat.push_back(myState.myPosLat); + leftLength -= (clane)->setPartialOccupation(this); } - myFurtherLanes.push_back(clane); - myFurtherLanesPosLat.push_back(myState.myPosLat); - leftLength -= (clane)->setPartialOccupation(this); + myState.myBackPos = -leftLength; + } else { + // clear partial occupation + for (std::vector::iterator i = myFurtherLanes.begin(); i != myFurtherLanes.end(); ++i) { +#ifdef DEBUG_FURTHER + if (DEBUG_COND) { + std::cout << SIMTIME << " enterLaneAtInsertion \n"; + } +#endif + (*i)->resetPartialOccupation(this); + } + myFurtherLanes.clear(); + myFurtherLanesPosLat.clear(); } - myState.myBackPos = -leftLength; if (MSGlobals::gLateralResolution > 0 || MSGlobals::gLaneChangeDuration > 0) { getLaneChangeModel().updateShadowLane(); } @@ -2650,9 +2869,9 @@ void -MSVehicle::leaveLane(const MSMoveReminder::Notification reason) { +MSVehicle::leaveLane(const MSMoveReminder::Notification reason, const MSLane* approachedLane) { for (MoveReminderCont::iterator rem = myMoveReminders.begin(); rem != myMoveReminders.end();) { - if (rem->first->notifyLeave(*this, myState.myPos + rem->second, reason)) { + if (rem->first->notifyLeave(*this, myState.myPos + rem->second, reason, approachedLane)) { #ifdef _DEBUG if (myTraceMoveReminders) { traceMoveReminder("notifyLeave", rem->first, rem->second, true); @@ -2734,7 +2953,16 @@ } assert(startLane != 0); if (getLaneChangeModel().isOpposite()) { - return; + // depending on the calling context, startLane might be the forward lane + // or the reverse-direction lane. In the latter case we need to + // transform it to the forward lane. + bool startLaneIsOpposite = (startLane->isInternal() + ? & (startLane->getLinkCont()[0]->getLane()->getEdge()) != *(myCurrEdge + 1) + : &startLane->getEdge() != *myCurrEdge); + if (startLaneIsOpposite) { + startLane = startLane->getOpposite(); + assert(startLane != 0); + } } if (myBestLanes.size() > 0 && !forceRebuild && myLastBestLanesEdge == &startLane->getEdge()) { updateOccupancyAndCurrentBestLane(startLane); @@ -2750,7 +2978,7 @@ } // adapt best lanes to fit the current internal edge: // keep the entries that are reachable from this edge - const MSEdge* nextEdge = startLane->getInternalFollower(); + const MSEdge* nextEdge = startLane->getNextNormal(); assert(nextEdge->getPurpose() != MSEdge::EDGEFUNCTION_INTERNAL); for (std::vector >::iterator it = myBestLanes.begin(); it != myBestLanes.end();) { std::vector& lanes = *it; @@ -2805,7 +3033,7 @@ // get information about the next stop const MSEdge* nextStopEdge = 0; const MSLane* nextStopLane = 0; - SUMOReal nextStopPos = 0; + double nextStopPos = 0; if (!myStops.empty()) { const Stop& nextStop = myStops.front(); nextStopLane = nextStop.lane; @@ -2820,12 +3048,12 @@ if (nextStopEdge != 0) { // make sure that the "wrong" lanes get a penalty. (penalty needs to be // large enough to overcome a magic threshold in MSLCM_DK2004.cpp:383) - nextStopPos = MAX2(POSITION_EPS, MIN2((SUMOReal)nextStopPos, (SUMOReal)(nextStopEdge->getLength() - 2 * POSITION_EPS))); + nextStopPos = MAX2(POSITION_EPS, MIN2((double)nextStopPos, (double)(nextStopEdge->getLength() - 2 * POSITION_EPS))); } // go forward along the next lanes; int seen = 0; - SUMOReal seenLength = 0; + double seenLength = 0; bool progress = true; for (MSRouteIterator ce = myCurrEdge; progress;) { std::vector currentLanes; @@ -2877,7 +3105,7 @@ // we are examining the last lane explicitly if (myBestLanes.size() != 0) { - SUMOReal bestLength = -1; + double bestLength = -1; int bestThisIndex = 0; int index = 0; std::vector& last = myBestLanes.back(); @@ -2910,8 +3138,8 @@ std::vector& clanes = (*i); MSEdge& cE = clanes[0].lane->getEdge(); int index = 0; - SUMOReal bestConnectedLength = -1; - SUMOReal bestLength = -1; + double bestConnectedLength = -1; + double bestLength = -1; for (std::vector::iterator j = nextLanes.begin(); j != nextLanes.end(); ++j, ++index) { if ((*j).lane->isApproachedFrom(&cE) && bestConnectedLength < (*j).length) { bestConnectedLength = (*j).length; @@ -3032,7 +3260,7 @@ std::vector& currLanes = *myBestLanes.begin(); std::vector::iterator i; for (i = currLanes.begin(); i != currLanes.end(); ++i) { - SUMOReal nextOccupation = 0; + double nextOccupation = 0; for (std::vector::const_iterator j = (*i).bestContinuations.begin() + 1; j != (*i).bestContinuations.end(); ++j) { nextOccupation += (*j)->getBruttoVehLenSum(); } @@ -3084,7 +3312,7 @@ void -MSVehicle::adaptBestLanesOccupation(int laneIndex, SUMOReal density) { +MSVehicle::adaptBestLanesOccupation(int laneIndex, double density) { std::vector& preb = myBestLanes.front(); assert(laneIndex < (int)preb.size()); preb[laneIndex].occupation = density + preb[laneIndex].nextOccupation; @@ -3099,9 +3327,9 @@ } -SUMOReal -MSVehicle::getDistanceToPosition(SUMOReal destPos, const MSEdge* destEdge) const { - SUMOReal distance = std::numeric_limits::max(); +double +MSVehicle::getDistanceToPosition(double destPos, const MSEdge* destEdge) const { + double distance = std::numeric_limits::max(); if (isOnRoad() && destEdge != NULL) { if (&myLane->getEdge() == *myCurrEdge) { // vehicle is on a normal edge @@ -3116,8 +3344,8 @@ } -std::pair -MSVehicle::getLeader(SUMOReal dist) const { +std::pair +MSVehicle::getLeader(double dist) const { if (myLane == 0) { return std::make_pair(static_cast(0), -1); } @@ -3126,28 +3354,29 @@ } const MSVehicle* lead = 0; const MSLane::VehCont& vehs = myLane->getVehiclesSecure(); - assert(vehs.size() > 0); + // vehicle might be outside the road network MSLane::VehCont::const_iterator it = std::find(vehs.begin(), vehs.end(), this); if (it != vehs.end() && it + 1 != vehs.end()) { lead = *(it + 1); } if (lead != 0) { - std::pair result( + std::pair result( lead, lead->getBackPositionOnLane(myLane) - getPositionOnLane() - getVehicleType().getMinGap()); myLane->releaseVehicles(); return result; } - const SUMOReal seen = myLane->getLength() - getPositionOnLane(); + const double seen = myLane->getLength() - getPositionOnLane(); const std::vector& bestLaneConts = getBestLanesContinuation(myLane); - std::pair result = myLane->getLeaderOnConsecutive(dist, seen, getSpeed(), *this, bestLaneConts); + std::pair result = myLane->getLeaderOnConsecutive(dist, seen, getSpeed(), *this, bestLaneConts); myLane->releaseVehicles(); return result; } -SUMOReal -MSVehicle::getTimeGap() const { - std::pair leaderInfo = getLeader(); +double +MSVehicle::getTimeGapOnLane() const { + // calling getLeader with 0 would induce a dist calculation but we only want to look for the leaders on the current lane + std::pair leaderInfo = getLeader(-1); if (leaderInfo.first == 0 || getSpeed() == 0) { return -1; } @@ -3155,49 +3384,49 @@ } -SUMOReal +double MSVehicle::getCO2Emissions() const { return PollutantsInterface::compute(myType->getEmissionClass(), PollutantsInterface::CO2, myState.speed(), myAcceleration, getSlope()); } -SUMOReal +double MSVehicle::getCOEmissions() const { return PollutantsInterface::compute(myType->getEmissionClass(), PollutantsInterface::CO, myState.speed(), myAcceleration, getSlope()); } -SUMOReal +double MSVehicle::getHCEmissions() const { return PollutantsInterface::compute(myType->getEmissionClass(), PollutantsInterface::HC, myState.speed(), myAcceleration, getSlope()); } -SUMOReal +double MSVehicle::getNOxEmissions() const { return PollutantsInterface::compute(myType->getEmissionClass(), PollutantsInterface::NO_X, myState.speed(), myAcceleration, getSlope()); } -SUMOReal +double MSVehicle::getPMxEmissions() const { return PollutantsInterface::compute(myType->getEmissionClass(), PollutantsInterface::PM_X, myState.speed(), myAcceleration, getSlope()); } -SUMOReal +double MSVehicle::getFuelConsumption() const { return PollutantsInterface::compute(myType->getEmissionClass(), PollutantsInterface::FUEL, myState.speed(), myAcceleration, getSlope()); } -SUMOReal +double MSVehicle::getElectricityConsumption() const { return PollutantsInterface::compute(myType->getEmissionClass(), PollutantsInterface::ELEC, myState.speed(), myAcceleration, getSlope()); } -SUMOReal +double MSVehicle::getHarmonoise_NoiseEmissions() const { return HelpersHarmonoise::computeNoise(myType->getEmissionClass(), myState.speed(), myAcceleration); } @@ -3245,6 +3474,16 @@ } +void +MSVehicle::removeTransportable(MSTransportable* t) { + const bool isPerson = dynamic_cast(t) != 0; + MSDevice_Transportable* device = isPerson ? myPersonDevice : myContainerDevice; + if (device != 0) { + device->removeTransportable(t); + } +} + + const std::vector& MSVehicle::getPersons() const { if (myPersonDevice == 0) { @@ -3295,7 +3534,7 @@ } else { const MSLane* lane = getLane(); MSLinkCont::const_iterator link = MSLane::succLinkSec(*this, 1, *lane, getBestLanesContinuation()); - if (link != lane->getLinkCont().end() && lane->getLength() - getPositionOnLane() < lane->getVehicleMaxSpeed(this) * (SUMOReal) 7.) { + if (link != lane->getLinkCont().end() && lane->getLength() - getPositionOnLane() < lane->getVehicleMaxSpeed(this) * (double) 7.) { switch ((*link)->getDirection()) { case LINKDIR_TURN: case LINKDIR_LEFT: @@ -3311,7 +3550,10 @@ } } } - + if (myInfluencer != 0 && myInfluencer->getSignals() >= 0) { + mySignals = myInfluencer->getSignals(); + myInfluencer->setSignals(-1); // overwrite computed signals only once + } } void @@ -3328,9 +3570,6 @@ void MSVehicle::replaceVehicleType(MSVehicleType* type) { - if (myType->amVehicleSpecific()) { - delete myType; - } myType = type; } @@ -3342,7 +3581,7 @@ void -MSVehicle::setTentativeLaneAndPosition(MSLane* lane, SUMOReal pos, SUMOReal posLat) { +MSVehicle::setTentativeLaneAndPosition(MSLane* lane, double pos, double posLat) { assert(lane != 0); myLane = lane; myState.myPos = pos; @@ -3351,19 +3590,19 @@ } -SUMOReal +double MSVehicle::getRightSideOnLane() const { return myState.myPosLat + 0.5 * myLane->getWidth() - 0.5 * getVehicleType().getWidth(); } -SUMOReal +double MSVehicle::getRightSideOnEdge(const MSLane* lane) const { return getCenterOnEdge(lane) - 0.5 * getVehicleType().getWidth(); } -SUMOReal +double MSVehicle::getCenterOnEdge(const MSLane* lane) const { if (lane == 0 || &lane->getEdge() == &myLane->getEdge()) { return myLane->getRightSideOnEdge() + myState.myPosLat + 0.5 * myLane->getWidth(); @@ -3395,7 +3634,7 @@ } -SUMOReal +double MSVehicle::getLatOffset(const MSLane* lane) const { assert(lane != 0); if (&lane->getEdge() == &myLane->getEdge()) { @@ -3438,7 +3677,7 @@ } -SUMOReal +double MSVehicle::getLateralOverlap() const { return (fabs(getLateralPositionOnLane()) + 0.5 * getVehicleType().getWidth() - 0.5 * myLane->getWidth()); @@ -3462,8 +3701,8 @@ // the following links are unsafe: // - zipper links if they are close enough and have approaching vehicles in the relevant time range // - unprioritized links if the vehicle is currently approaching a prioritzed link and unable to stop in time - SUMOReal seen = myLane->getLength() - getPositionOnLane(); - const SUMOReal dist = getCarFollowModel().brakeGap(getSpeed(), getCarFollowModel().getMaxDecel(), 0); + double seen = myLane->getLength() - getPositionOnLane(); + const double dist = getCarFollowModel().brakeGap(getSpeed(), getCarFollowModel().getMaxDecel(), 0); if (seen < dist) { const std::vector& bestLaneConts = getBestLanesContinuation(lane); int view = 1; @@ -3477,7 +3716,7 @@ bool found = false; while (di != myLFLinkLanes.end() && !found) { if ((*di).myLink != 0) { - const MSLane* diPredLane = (*di).myLink->getApproachingLane(); + const MSLane* diPredLane = (*di).myLink->getLaneBefore(); if (diPredLane != 0) { if (&diPredLane->getEdge() == &lane->getEdge()) { found = true; @@ -3559,9 +3798,20 @@ } +bool +MSVehicle::onFurtherEdge(const MSEdge* edge) const { + for (std::vector::const_iterator i = myFurtherLanes.begin(); i != myFurtherLanes.end(); ++i) { + if (&(*i)->getEdge() == edge) { + return true; + } + } + return false; +} + + #ifndef NO_TRACI bool -MSVehicle::addTraciStop(MSLane* const lane, const SUMOReal startPos, const SUMOReal endPos, const SUMOTime duration, const SUMOTime until, +MSVehicle::addTraciStop(MSLane* const lane, const double startPos, const double endPos, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, std::string& errorMsg) { //if the stop exists update the duration for (std::list::iterator iter = myStops.begin(); iter != myStops.end(); iter++) { @@ -3586,6 +3836,9 @@ newStop.parking = parking; newStop.index = STOP_INDEX_FIT; const bool result = addStop(newStop, errorMsg); + if (result) { + myParameter->stops.push_back(newStop); + } if (myLane != 0) { updateBestLanes(true); } @@ -3594,11 +3847,27 @@ bool -MSVehicle::addTraciBusOrContainerStop(const std::string& stopId, const SUMOTime duration, const SUMOTime until, const bool parking, - const bool triggered, const bool containerTriggered, const bool isContainerStop, std::string& errorMsg) { +MSVehicle::addTraciStopAtStoppingPlace(const std::string& stopId, const SUMOTime duration, const SUMOTime until, const bool parking, + const bool triggered, const bool containerTriggered, const SumoXMLTag stoppingPlaceType, std::string& errorMsg) { //if the stop exists update the duration for (std::list::iterator iter = myStops.begin(); iter != myStops.end(); iter++) { - const Named* const stop = isContainerStop ? (Named*)iter->containerstop : iter->busstop; + Named* stop = 0; + switch (stoppingPlaceType) { + case SUMO_TAG_BUS_STOP: + stop = iter->busstop; + break; + case SUMO_TAG_CONTAINER_STOP: + stop = iter->containerstop; + break; + case SUMO_TAG_CHARGING_STATION: + stop = iter->chargingStation; + break; + case SUMO_TAG_PARKING_AREA: + stop = iter->parkingarea; + break; + default: + throw ProcessError("Invalid Stopping place type '" + toString(stoppingPlaceType) + "'"); + } if (stop != 0 && stop->getID() == stopId) { if (duration == 0 && !iter->reached) { myStops.erase(iter); @@ -3611,20 +3880,41 @@ SUMOVehicleParameter::Stop newStop; MSStoppingPlace* bs = 0; - if (isContainerStop) { - newStop.containerstop = stopId; - bs = MSNet::getInstance()->getContainerStop(stopId); - if (bs == 0) { - errorMsg = "The container stop '" + stopId + "' is not known for vehicle '" + getID() + "'"; - return false; - } - } else { - newStop.busstop = stopId; - bs = MSNet::getInstance()->getBusStop(stopId); - if (bs == 0) { - errorMsg = "The bus stop '" + stopId + "' is not known for vehicle '" + getID() + "'"; - return false; - } + switch (stoppingPlaceType) { + case SUMO_TAG_BUS_STOP: + newStop.busstop = stopId; + bs = MSNet::getInstance()->getBusStop(stopId); + if (bs == 0) { + errorMsg = "The bus stop '" + stopId + "' is not known for vehicle '" + getID() + "'"; + return false; + } + break; + case SUMO_TAG_CONTAINER_STOP: + newStop.containerstop = stopId; + bs = MSNet::getInstance()->getContainerStop(stopId); + if (bs == 0) { + errorMsg = "The container stop '" + stopId + "' is not known for vehicle '" + getID() + "'"; + return false; + } + break; + case SUMO_TAG_CHARGING_STATION: + newStop.chargingStation = stopId; + bs = MSNet::getInstance()->getChargingStation(stopId); + if (bs == 0) { + errorMsg = "The charging station '" + stopId + "' is not known for vehicle '" + getID() + "'"; + return false; + } + break; + case SUMO_TAG_PARKING_AREA: + newStop.parkingarea = stopId; + bs = MSNet::getInstance()->getParkingArea(stopId); + if (bs == 0) { + errorMsg = "The parking area '" + stopId + "' is not known for vehicle '" + getID() + "'"; + return false; + } + break; + default: + throw ProcessError("Invalid Stopping place type '" + toString(stoppingPlaceType) + "'"); } newStop.duration = duration; newStop.until = until; @@ -3636,6 +3926,9 @@ newStop.endPos = bs->getEndLanePosition(); newStop.startPos = bs->getBeginLanePosition(); const bool result = addStop(newStop, errorMsg); + if (result) { + myParameter->stops.push_back(newStop); + } if (myLane != 0) { updateBestLanes(true); } @@ -3664,8 +3957,18 @@ // inform container stop about leaving it myStops.front().containerstop->leaveFrom(this); } + if (myStops.front().parkingarea != 0) { + // inform parking area about leaving it + myStops.front().parkingarea->leaveFrom(this); + } // the current stop is no longer valid MSNet::getInstance()->getVehicleControl().removeWaiting(&myLane->getEdge(), this); + if (MSStopOut::active()) { + MSStopOut::getInstance()->stopEnded(this, myStops.front()); + } + if (myStops.front().collision && MSLane::getCollisionAction() == MSLane::COLLISION_ACTION_WARN) { + myCollisionImmunity = TIME2STEPS(5); // leave the conflict area + } myStops.pop_front(); // do not count the stopping time towards gridlock time. // Other outputs use an independent counter and are not affected. @@ -3701,9 +4004,9 @@ } -SUMOReal +double MSVehicle::getSpeedWithoutTraciInfluence() const { - if (myInfluencer != 0) { + if (myInfluencer != 0 && myInfluencer->getOriginalSpeed() != -1) { return myInfluencer->getOriginalSpeed(); } return myState.mySpeed; @@ -3736,18 +4039,88 @@ } +bool +MSVehicle::wasRemoteControlled(SUMOTime lookBack) const { + return myInfluencer != 0 && myInfluencer->getLastAccessTimeStep() + lookBack >= MSNet::getInstance()->getCurrentTimeStep(); +} + + +void +MSVehicle::Stop::write(OutputDevice& dev) const { + // lots of duplication with SUMOVehicleParameter::Stop::write() + dev.openTag(SUMO_TAG_STOP); + if (busstop != 0) { + dev.writeAttr(SUMO_ATTR_BUS_STOP, busstop->getID()); + } + if (containerstop != 0) { + dev.writeAttr(SUMO_ATTR_CONTAINER_STOP, containerstop->getID()); + } + if (busstop == 0 && containerstop == 0) { + dev.writeAttr(SUMO_ATTR_LANE, lane->getID()); + dev.writeAttr(SUMO_ATTR_STARTPOS, startPos); + dev.writeAttr(SUMO_ATTR_ENDPOS, endPos); + } + if (duration >= 0) { + dev.writeAttr(SUMO_ATTR_DURATION, STEPS2TIME(duration)); + } + if (until >= 0) { + dev.writeAttr(SUMO_ATTR_UNTIL, STEPS2TIME(until)); + } + if (triggered) { + dev.writeAttr(SUMO_ATTR_TRIGGERED, triggered); + } + if (containerTriggered) { + dev.writeAttr(SUMO_ATTR_CONTAINER_TRIGGERED, containerTriggered); + } + if (parking) { + dev.writeAttr(SUMO_ATTR_PARKING, parking); + } + if (awaitedPersons.size() > 0) { + dev.writeAttr(SUMO_ATTR_EXPECTED, joinToString(awaitedPersons, " ")); + } + if (awaitedContainers.size() > 0) { + dev.writeAttr(SUMO_ATTR_EXPECTED_CONTAINERS, joinToString(awaitedContainers, " ")); + } + dev.closeTag(); +} + + +double +MSVehicle::Stop::getEndPos(const SUMOVehicle& veh) const { + if (busstop != 0) { + return busstop->getLastFreePos(veh); + } else if (containerstop != 0) { + return containerstop->getLastFreePos(veh); + } else if (parkingarea != 0) { + return parkingarea->getLastFreePos(veh); + } else if (chargingStation != 0) { + return chargingStation->getLastFreePos(veh); + } + return endPos; +} + void MSVehicle::saveState(OutputDevice& out) { MSBaseVehicle::saveState(out); // here starts the vehicle internal part (see loading) - std::vector internals; - internals.push_back(myDeparture); - internals.push_back((SUMOTime)distance(myRoute->begin(), myCurrEdge)); - out.writeAttr(SUMO_ATTR_STATE, toString(internals)); + std::vector internals; + internals.push_back(toString(myDeparture)); + internals.push_back(toString(distance(myRoute->begin(), myCurrEdge))); + internals.push_back(toString(myDepartPos)); + internals.push_back(toString(myWaitingTime)); + out.writeAttr(SUMO_ATTR_STATE, internals); out.writeAttr(SUMO_ATTR_POSITION, myState.myPos); out.writeAttr(SUMO_ATTR_SPEED, myState.mySpeed); out.writeAttr(SUMO_ATTR_POSITION_LAT, myState.myPosLat); + // save stops and parameters + for (std::list::iterator it = myStops.begin(); it != myStops.end(); ++it) { + (*it).write(out); + } + myParameter->writeParams(out); + for (std::vector::const_iterator dev = myDevices.begin(); dev != myDevices.end(); ++dev) { + (*dev)->saveState(out); + } out.closeTag(); } @@ -3761,9 +4134,11 @@ std::istringstream bis(attrs.getString(SUMO_ATTR_STATE)); bis >> myDeparture; bis >> routeOffset; + bis >> myDepartPos; + bis >> myWaitingTime; if (hasDeparted()) { - myDeparture -= offset; myCurrEdge += routeOffset; + myDeparture -= offset; } myState.myPos = attrs.getFloat(SUMO_ATTR_POSITION); myState.mySpeed = attrs.getFloat(SUMO_ATTR_SPEED); @@ -3771,4 +4146,5 @@ // no need to reset myCachedPosition here since state loading happens directly after creation } + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicle.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicle.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicle.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicle.h 2017-07-23 16:22:03.000000000 +0000 @@ -10,12 +10,12 @@ /// @author Michael Behrisch /// @author Axel Wegener /// @date Mon, 12 Mar 2001 -/// @version $Id: MSVehicle.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSVehicle.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Representation of a vehicle in the micro simulation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -62,6 +62,7 @@ class MSAbstractLaneChangeModel; class MSStoppingPlace; class MSChargingStation; +class MSParkingArea; class MSPerson; class MSDevice; class MSEdgeWeightsStorage; @@ -97,7 +98,7 @@ public: /// Constructor. - State(SUMOReal pos, SUMOReal speed, SUMOReal posLat, SUMOReal backPos); + State(double pos, double speed, double posLat, double backPos); /// Copy constructor. State(const State& state); @@ -109,54 +110,54 @@ bool operator!=(const State& state); /// Position of this state. - SUMOReal pos() const { + double pos() const { return myPos; } /// Speed of this state - SUMOReal speed() const { + double speed() const { return mySpeed; }; /// Lateral Position of this state (m relative to the centerline of the lane). - SUMOReal posLat() const { + double posLat() const { return myPosLat; } /// back Position of this state - SUMOReal backPos() const { + double backPos() const { return myBackPos; } /// previous Speed of this state - SUMOReal lastCoveredDist() const { + double lastCoveredDist() const { return myLastCoveredDist; } private: /// the stored position - SUMOReal myPos; + double myPos; /// the stored speed (should be >=0 at any time) - SUMOReal mySpeed; + double mySpeed; /// the stored lateral position - SUMOReal myPosLat; + double myPosLat; /// @brief the stored back position // if the vehicle occupies multiple lanes, this is the position relative // to the lane occupied by its back - SUMOReal myBackPos; + double myBackPos; /// the speed at the begin of the previous time step - SUMOReal myPreviousSpeed; + double myPreviousSpeed; /// the distance covered in the last timestep /// NOTE: In case of ballistic positional update, this is not necessarily given by /// myPos - SPEED2DIST(mySpeed + myPreviousSpeed)/2, /// because a stop may have occured within the last step. - SUMOReal myLastCoveredDist; + double myLastCoveredDist; }; @@ -237,7 +238,7 @@ * @exception ProcessError If a value is wrong */ MSVehicle(SUMOVehicleParameter* pars, const MSRoute* route, - const MSVehicleType* type, const SUMOReal speedFactor); + const MSVehicleType* type, const double speedFactor); /// @brief Destructor. virtual ~MSVehicle(); @@ -274,7 +275,7 @@ * @param[in] route The new route to pass * @return Whether the new route was accepted */ - bool replaceRoute(const MSRoute* route, bool onInit = false, int offset = 0); + bool replaceRoute(const MSRoute* route, bool onInit = false, int offset = 0, bool addStops = true); /** @brief Returns whether the vehicle wil pass the given edge @@ -317,7 +318,7 @@ * @param[in] newSpeed The vehicle's speed within this move * @see MSMoveReminder */ - void workOnMoveReminders(SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed); + void workOnMoveReminders(double oldPos, double newPos, double newSpeed); //@} @@ -328,7 +329,7 @@ * This method goes through the best continuation lanes of the current lane and * computes the safe velocities for passing/stopping at the next link as a DriveProcessItem * - * Afterwards it checks if any DriveProcessItem should be discared to avoid + * Afterwards it checks if any DriveProcessItem should be discarded to avoid * blocking a junction (checkRewindLinkLanes). * * Finally the ApproachingVehicleInformation is registered for all links that @@ -338,7 +339,7 @@ * @param[in] ahead The leaders (may be 0) * @param[in] lengthsInFront Sum of vehicle lengths in front of the vehicle */ - void planMove(const SUMOTime t, const MSLeaderInfo& ahead, const SUMOReal lengthsInFront); + void planMove(const SUMOTime t, const MSLeaderInfo& ahead, const double lengthsInFront); /** @brief Executes planned vehicle movements with regards to right-of-way @@ -362,7 +363,7 @@ * @param[in] accel the assumed acceleration * @return distance covered in next integration step */ - SUMOReal getDeltaPos(SUMOReal accel); + double getDeltaPos(double accel); /// @name state setter/getter @@ -371,31 +372,31 @@ /** @brief Get the vehicle's position along the lane * @return The position of the vehicle (in m from the lane's begin) */ - SUMOReal getPositionOnLane() const { + double getPositionOnLane() const { return myState.myPos; } /** @brief Get the distance the vehicle covered in the previous timestep * @return The distance covered in the last timestep (in m) */ - SUMOReal getLastStepDist() const { + double getLastStepDist() const { return myState.lastCoveredDist(); } /** @brief Get the vehicle's front position relative to the given lane * @return The front position of the vehicle (in m from the given lane's begin) */ - SUMOReal getPositionOnLane(const MSLane* lane) const; + double getPositionOnLane(const MSLane* lane) const; /** @brief Get the vehicle's position relative to the given lane * @return The back position of the vehicle (in m from the given lane's begin) */ - SUMOReal getBackPositionOnLane(const MSLane* lane) const; + double getBackPositionOnLane(const MSLane* lane) const; /** @brief Get the vehicle's position relative to its current lane * @return The back position of the vehicle (in m from the current lane's begin) */ - SUMOReal getBackPositionOnLane() const { + double getBackPositionOnLane() const { return getBackPositionOnLane(myLane); } @@ -403,7 +404,7 @@ * @return The lateral position of the vehicle (in m relative to the * centerline of the lane) */ - SUMOReal getLateralPositionOnLane() const { + double getLateralPositionOnLane() const { return myState.myPosLat; } @@ -411,34 +412,34 @@ * @return The lateral position of the vehicle (in m distance between right * side of vehicle and ride side of the lane it is on */ - SUMOReal getRightSideOnLane() const; + double getRightSideOnLane() const; /// @brief return the amount by which the vehicle extends laterally outside it's primary lane - SUMOReal getLateralOverlap() const; + double getLateralOverlap() const; /** @brief Get the vehicle's lateral position on the edge of the given lane * (or its current edge if lane == 0) * @return The lateral position of the vehicle (in m distance between right * side of vehicle and ride side of edge */ - SUMOReal getRightSideOnEdge(const MSLane* lane = 0) const; + double getRightSideOnEdge(const MSLane* lane = 0) const; /** @brief Get the vehicle's lateral position on the edge of the given lane * (or its current edge if lane == 0) * @return The lateral position of the vehicle (in m distance between center * of vehicle and ride side of edge */ - SUMOReal getCenterOnEdge(const MSLane* lane = 0) const; + double getCenterOnEdge(const MSLane* lane = 0) const; /** @brief Get the offset that that must be added to interpret * myState.myPosLat for the given lane */ - SUMOReal getLatOffset(const MSLane* lane) const; + double getLatOffset(const MSLane* lane) const; /** @brief Returns the vehicle's current speed * @return The vehicle's speed */ - SUMOReal getSpeed() const { + double getSpeed() const { return myState.mySpeed; } @@ -446,7 +447,7 @@ /** @brief Returns the vehicle's speed before the previous time step * @return The vehicle's speed before the previous time step */ - SUMOReal getPreviousSpeed() const { + double getPreviousSpeed() const { return myState.myPreviousSpeed; } @@ -455,7 +456,7 @@ * (this is computed as the last step's mean acceleration in case that a stop occurs within the middle of the time-step) * @return The acceleration */ - SUMOReal getAcceleration() const { + double getAcceleration() const { return myAcceleration; } //@} @@ -468,7 +469,7 @@ /** @brief Returns the slope of the road at vehicle's position * @return The slope */ - SUMOReal getSlope() const; + double getSlope() const; /** @brief Return current position (x/y, cartesian) @@ -478,7 +479,7 @@ * @return The current position (in cartesian coordinates) * @see myLane */ - Position getPosition(const SUMOReal offset = 0) const; + Position getPosition(const double offset = 0) const; /** @brief Returns the lane the vehicle is on @@ -493,7 +494,7 @@ * i.e., not necessarily the allowed speed limit) * @return The vehicle's max speed */ - SUMOReal + double getMaxSpeedOnLane() const { if (myLane != 0) { return myLane->getVehicleMaxSpeed(this); @@ -536,6 +537,19 @@ return myWaitingTime; } + /** @brief Returns the SUMOTime lost (speed was lesser maximum speed) + * + * @note Intentional stopping does not count towards this time. + // @note speedFactor is included so time loss can never be negative. + // The value is that of a driver who compares his travel time when + // the road is clear (which includes speed factor) with the actual travel time. + // @note includes time lost due to low departSpeed and decelerating/accelerating for planned stops + * @return The time the vehicle lost due to various effects + */ + SUMOTime getTimeLoss() const { + return myTimeLoss; + } + /** @brief Returns the SUMOTime waited (speed was lesser than 0.1m/s) within the last t millisecs * @@ -553,7 +567,7 @@ * Intentional stopping does not count towards this time. * @return The time the vehicle is standing */ - SUMOReal getWaitingSeconds() const { + double getWaitingSeconds() const { return STEPS2TIME(myWaitingTime); } @@ -563,24 +577,38 @@ * @return The time the vehicle was standing within the last t millisecs */ - SUMOReal getAccumulatedWaitingSeconds() const { + double getAccumulatedWaitingSeconds() const { return STEPS2TIME(getAccumulatedWaitingTime()); } + /** @brief Returns the time loss in seconds + */ + double getTimeLossSeconds() const { + return STEPS2TIME(myTimeLoss); + } + /** @brief Returns the vehicle's direction in radians * @return The vehicle's current angle */ - SUMOReal getAngle() const { + double getAngle() const { return myAngle; } + + + /** @brief Returns the vehicle's direction in radians + * @return The vehicle's current angle + */ + Position getVelocityVector() const { + return Position(std::cos(myAngle) * myState.speed(), std::sin(myAngle) * myState.speed()); + } //@} /// @brief compute the current vehicle angle - SUMOReal computeAngle() const; + double computeAngle() const; /// @brief Set a custom vehicle angle in rad - void setAngle(SUMOReal angle); + void setAngle(double angle); /** Returns true if the two vehicles overlap. */ static bool overlap(const MSVehicle* veh1, const MSVehicle* veh2) { @@ -594,7 +622,7 @@ /** Returns true if vehicle's speed is below 60km/h. This is only relevant on highways. Overtaking on the right is allowed then. */ bool congested() const { - return myState.mySpeed < SUMOReal(60) / SUMOReal(3.6); + return myState.mySpeed < double(60) / double(3.6); } @@ -604,11 +632,12 @@ * "MSMoveReminder::notifyEnter" is called. * * @param[in] reason The reason for changing the reminders' states + * @param[in] enteredLane The lane, which is entered (if applicable) * @see MSMoveReminder * @see MSMoveReminder::notifyEnter * @see MSMoveReminder::Notification */ - void activateReminders(const MSMoveReminder::Notification reason); + void activateReminders(const MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /** @brief Update when the vehicle enters a new lane in the move step. * @@ -628,14 +657,14 @@ * @param[in] posLat The lateral position the vehicle was inserted into the lane * @param[in] notification The cause of insertion (i.e. departure, teleport, parking) */ - void enterLaneAtInsertion(MSLane* enteredLane, SUMOReal pos, SUMOReal speed, SUMOReal posLat, + void enterLaneAtInsertion(MSLane* enteredLane, double pos, double speed, double posLat, MSMoveReminder::Notification notification); /** @brief set tentative lane and position during insertion to ensure that * all cfmodels work (some of them require veh->getLane() to return a valid lane) * Once the vehicle is sucessfully inserted the lane is set again (see enterLaneAtInsertion) */ - void setTentativeLaneAndPosition(MSLane* lane, SUMOReal pos, SUMOReal posLat = 0); + void setTentativeLaneAndPosition(MSLane* lane, double pos, double posLat = 0); /** @brief Update when the vehicle enters a new lane in the laneChange step. * @@ -645,7 +674,7 @@ /** @brief Update of members if vehicle leaves a new lane in the lane change step or at arrival. */ - void leaveLane(const MSMoveReminder::Notification reason); + void leaveLane(const MSMoveReminder::Notification reason, const MSLane* approachedLane = 0); MSAbstractLaneChangeModel& getLaneChangeModel(); @@ -655,39 +684,46 @@ return myFurtherLanes; } - const std::vector& getFurtherLanesPosLat() const { + const std::vector& getFurtherLanesPosLat() const { return myFurtherLanesPosLat; } + + /// @brief whether this vehicle has its back (and no its front) on the given edge + bool onFurtherEdge(const MSEdge* edge) const; + /// @name strategical/tactical lane choosing methods /// @{ - // TODO: improve documentation, refs. #2604 + // /** @struct LaneQ - * @brief A structure representing the best lanes for continuing the route + * @brief A structure representing the best lanes for continuing the current route starting at 'lane' */ struct LaneQ { /// @brief The described lane MSLane* lane; /// @brief The overall length which may be driven when using this lane without a lane change - SUMOReal length; + double length; /// @brief The length which may be driven on this lane - SUMOReal currentLength; + double currentLength; /// @brief The overall vehicle sum on consecutive lanes which can be passed without a lane change - SUMOReal occupation; + double occupation; /// @brief As occupation, but without the first lane - SUMOReal nextOccupation; + double nextOccupation; /// @brief The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive int bestLaneOffset; /// @brief Whether this lane allows to continue the drive bool allowsContinuation; - /// @brief Consecutive lane that can be followed without a lane change (contribute to length and occupation) - std::vector bestContinuations; // XXX: Why "best"?, refs. #2604 + /* @brief Longest sequence of (normal-edge) lanes that can be followed without a lane change + * The 'length' attribute is the sum of these lane lengths + * (There may be alternative sequences that have equal length) + * It is the 'best' in the strategic sense of reducing required lane-changes + */ + std::vector bestContinuations; }; - // TODO: improve documentation ("best"?), refs. #2604 /** @brief Returns the description of best lanes to use in order to continue the route - * @return The best lanes structure holding matching the current vehicle position and state ahead + * @return The LaneQ for all lanes of the current edge */ const std::vector& getBestLanes() const; @@ -711,25 +747,27 @@ void updateBestLanes(bool forceRebuild = false, const MSLane* startLane = 0); - // TODO: improve documentation, refs. #2604 - /** @brief Returns the subpart of best lanes that describes the vehicle's current lane and their successors - * @return The best lane information for the vehicle's current lane + /** @brief Returns the best sequence of lanes to continue the route starting at myLane + * @return The bestContinuations of the LaneQ for myLane (see LaneQ) */ const std::vector& getBestLanesContinuation() const; - // TODO: improve documentation, refs. #2604 - /** @brief Returns the subpart of best lanes that describes the given lane and their successors - * @return The best lane information for the given lane + /** @brief Returns the best sequence of lanes to continue the route starting at the given lane + * @return The bestContinuations of the LaneQ for the given lane (see LaneQ) */ const std::vector& getBestLanesContinuation(const MSLane* const l) const; - // TODO: improve documentation (which is the "best"?), refs. #2604 - /// @brief returns the current offset from the best lane + /* @brief returns the current signed offset from the lane that is most + * suited for continuing the current route (in the strategic sense of reducing lane-changes) + * - 0 if the vehicle is one it's best lane + * - negative if the vehicle should change to the right + * - positive if the vehicle should change to the left + */ int getBestLaneOffset() const; /// @brief update occupation from MSLaneChanger - void adaptBestLanesOccupation(int laneIndex, SUMOReal density); + void adaptBestLanesOccupation(int laneIndex, double density); /// @} @@ -768,6 +806,10 @@ return myCFVariables; } + /// @brief whether this vehicle is selected in the GUI + virtual bool isSelected() const { + return false; + } /// @name vehicle stops definitions and i/o //@{ @@ -784,12 +826,14 @@ MSStoppingPlace* busstop; /// @brief (Optional) container stop if one is assigned to the stop MSStoppingPlace* containerstop; + /// @brief (Optional) parkingArea if one is assigned to the stop + MSParkingArea* parkingarea; /// @brief (Optional) charging station if one is assigned to the stop MSChargingStation* chargingStation; /// @brief The stopping position start - SUMOReal startPos; + double startPos; /// @brief The stopping position end - SUMOReal endPos; + double endPos; /// @brief The stopping duration SUMOTime duration; /// @brief The time at which the vehicle may continue its journey @@ -810,7 +854,13 @@ SUMOTime timeToBoardNextPerson; /// @brief The time at which the vehicle is able to load another container SUMOTime timeToLoadNextContainer; + /// @brief Whether this stop was triggered by a collision + bool collision; + void write(OutputDevice& dev) const; + + /// @brief return halting position for upcoming stop; + double getEndPos(const SUMOVehicle& veh) const; }; @@ -820,8 +870,16 @@ * @param[in] stop The stop to add * @return Whether the stop could be added */ - bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0); + bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0, bool collision = false); + + /** @brief replace the current parking area stop with a new stop with merge duration + */ + bool replaceParkingArea(MSParkingArea* parkingArea, std::string& errorMsg); + + /** @brief get the current parking area stop + */ + MSParkingArea* getNextParkingArea(); /** @brief Returns whether the vehicle has to stop somewhere * @return Whether the vehicle has to stop somewhere @@ -835,6 +893,11 @@ */ bool isStopped() const; + /** @brief Returns the remaining time a vehicle needs to stop due to a + * collision. A negative value indicates that the vehicle is not stopping due to a collision (or at all) + */ + SUMOTime collisionStopTime() const; + /** @brief Returns whether the vehicle is parking * @return whether the vehicle is parking */ @@ -845,8 +908,13 @@ */ bool isRemoteControlled() const; - /// @brief return the distance to the next stop or SUMORealMax if there is none. - SUMOReal nextStopDist() const { + /** @brief Returns the information whether the vehicle is fully controlled via TraCI + * within the lookBack time + */ + bool wasRemoteControlled(SUMOTime lookBack = DELTA_T) const; + + /// @brief return the distance to the next stop or doubleMax if there is none. + double nextStopDist() const { return myStopDist; } @@ -857,7 +925,7 @@ /** @brief return whether the given position is within range of the current stop */ - bool isStoppedInRange(SUMOReal pos) const; + bool isStoppedInRange(double pos) const; /// @} bool knowsEdgeTest(MSEdge& edge) const; @@ -872,7 +940,7 @@ * or a near infinite real value if the destination position is not contained * within the vehicles route or the vehicle is not active */ - SUMOReal getDistanceToPosition(SUMOReal destPos, const MSEdge* destEdge) const; + double getDistanceToPosition(double destPos, const MSEdge* destEdge) const; /** @brief Processes stops, returns the velocity needed to reach the stop @@ -882,7 +950,7 @@ * @see MSStoppingPlace * @see MSStoppingPlace */ - SUMOReal processNextStop(SUMOReal currentVelocity); + double processNextStop(double currentVelocity); /** @brief Returns the leader of the vehicle looking for a fixed distance. * @@ -891,15 +959,15 @@ * @param dist up to which distance to look for a leader * @return The leading vehicle together with the gap; (0, -1) if no leader was found. */ - std::pair getLeader(SUMOReal dist = 0) const; + std::pair getLeader(double dist = 0) const; - /** @brief Returns the time gap in seconds to the leader of the vehicle looking for a fixed distance. + /** @brief Returns the time gap in seconds to the leader of the vehicle on the same lane. * * If the distance is too big -1 is returned. * The gap returned takes the minGap into account. * @return The time gap in seconds; -1 if no leader was found or speed is 0. */ - SUMOReal getTimeGap() const; + double getTimeGapOnLane() const; /// @name Emission retrieval @@ -908,49 +976,49 @@ /** @brief Returns CO2 emission of the current state * @return The current CO2 emission */ - SUMOReal getCO2Emissions() const; + double getCO2Emissions() const; /** @brief Returns CO emission of the current state * @return The current CO emission */ - SUMOReal getCOEmissions() const; + double getCOEmissions() const; /** @brief Returns HC emission of the current state * @return The current HC emission */ - SUMOReal getHCEmissions() const; + double getHCEmissions() const; /** @brief Returns NOx emission of the current state * @return The current NOx emission */ - SUMOReal getNOxEmissions() const; + double getNOxEmissions() const; /** @brief Returns PMx emission of the current state * @return The current PMx emission */ - SUMOReal getPMxEmissions() const; + double getPMxEmissions() const; /** @brief Returns fuel consumption of the current state * @return The current fuel consumption */ - SUMOReal getFuelConsumption() const; + double getFuelConsumption() const; /** @brief Returns electricity consumption of the current state * @return The current electricity consumption */ - SUMOReal getElectricityConsumption() const; + double getElectricityConsumption() const; /** @brief Returns noise emissions of the current state * @return The noise produced */ - SUMOReal getHarmonoise_NoiseEmissions() const; + double getHarmonoise_NoiseEmissions() const; //@} @@ -971,6 +1039,9 @@ */ void addContainer(MSTransportable* container); + /// @brief removes a person or container + void removeTransportable(MSTransportable* t); + /// @brief retrieve riding persons const std::vector& getPersons() const; @@ -1093,7 +1164,7 @@ * @return The vehicle's velocity as it would without an influence * @see Influencer::getOriginalSpeed */ - SUMOReal getSpeedWithoutTraciInfluence() const; + double getSpeedWithoutTraciInfluence() const; /** * schedule a new stop for the vehicle; each time a stop is reached, the vehicle @@ -1107,7 +1178,7 @@ * @param triggered a flag indicating whether the traci stop is triggered or not * @param containerTriggered a flag indicating whether the traci stop is triggered by a container or not */ - bool addTraciStop(MSLane* const lane, const SUMOReal startPos, const SUMOReal endPos, const SUMOTime duration, const SUMOTime until, + bool addTraciStop(MSLane* const lane, const double startPos, const double endPos, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, std::string& errorMsg); /** @@ -1119,10 +1190,10 @@ * @param parking a flag indicating whether the traci stop is used for parking or not * @param triggered a flag indicating whether the traci stop is triggered or not * @param containerTriggered a flag indicating whether the traci stop is triggered by a container or not - * @param isContainerStop a flag indicating whether the stop is a container stop + * @param stoppingPlaceType a flag indicating the type of stopping place */ - bool addTraciBusOrContainerStop(const std::string& stopId, const SUMOTime duration, const SUMOTime until, const bool parking, - const bool triggered, const bool containerTriggered, const bool isContainerStop, std::string& errorMsg); + bool addTraciStopAtStoppingPlace(const std::string& stopId, const SUMOTime duration, const SUMOTime until, const bool parking, + const bool triggered, const bool containerTriggered, const SumoXMLTag stoppingPlaceType, std::string& errorMsg); /** * returns the next imminent stop in the stop queue @@ -1138,9 +1209,9 @@ /// @brief update a vector of further lanes and return the new backPos - SUMOReal updateFurtherLanes(std::vector& furtherLanes, - std::vector& furtherLanesPosLat, - const std::vector& passedLanes); + double updateFurtherLanes(std::vector& furtherLanes, + std::vector& furtherLanesPosLat, + const std::vector& passedLanes); /// @brief get bounding rectangle PositionVector getBoundingBox() const; @@ -1173,7 +1244,7 @@ /** @brief Sets a new velocity timeline * @param[in] speedTimeLine The time line of speeds to use */ - void setSpeedTimeLine(const std::vector >& speedTimeLine); + void setSpeedTimeLine(const std::vector >& speedTimeLine); /** @brief Sets a new lane timeline @@ -1181,6 +1252,11 @@ */ void setLaneTimeLine(const std::vector >& laneTimeLine); + /** @brief Sets a new sublane-change request + * @param[in] latDist The lateral distance for changing + */ + void setSublaneChange(double latDist); + /// @brief return the current speed mode int getSpeedMode() const; @@ -1195,7 +1271,7 @@ * @param[in] vMax The maximum simulation time * @return The speed to use */ - SUMOReal influenceSpeed(SUMOTime currentTime, SUMOReal speed, SUMOReal vSafe, SUMOReal vMin, SUMOReal vMax); + double influenceSpeed(SUMOTime currentTime, double speed, double vSafe, double vMin, double vMax); /** @brief Applies stored LaneChangeMode information and laneTimeLine * @param[in] currentTime The current simulation time @@ -1212,31 +1288,7 @@ * @param[in] currentTime The current simulation time * @return The remaining seconds to change lanes */ - SUMOReal changeRequestRemainingSeconds(const SUMOTime currentTime) const; - - /** @brief Sets whether the safe velocity shall be regarded - * @param[in] value Whether the safe velocity shall be regarded - */ - void setConsiderSafeVelocity(bool value); - - - /** @brief Sets whether the maximum acceleration shall be regarded - * @param[in] value Whether the maximum acceleration shall be regarded - */ - void setConsiderMaxAcceleration(bool value); - - - /** @brief Sets whether the maximum deceleration shall be regarded - * @param[in] value Whether the maximum deceleration shall be regarded - */ - void setConsiderMaxDeceleration(bool value); - - - /** @brief Sets whether junction priority rules shall be respected - * @param[in] value Whether junction priority rules be respected - */ - void setRespectJunctionPriority(bool value); - + double changeRequestRemainingSeconds(const SUMOTime currentTime) const; /** @brief Returns whether junction priority rules shall be respected * @return Whether junction priority rules be respected @@ -1246,12 +1298,6 @@ } - /** @brief Sets whether red lights shall be a reason to brake - * @param[in] value Whether red lights shall be a reason to brake - */ - void setEmergencyBrakeRedLight(bool value); - - /** @brief Returns whether red lights shall be a reason to brake * @return Whether red lights shall be a reason to brake */ @@ -1259,6 +1305,10 @@ return myEmergencyBrakeRedLight; } + /** @brief Sets speed-constraining behaviors + * @param[in] value a bitset controlling the different modes + */ + void setSpeedMode(int speedMode); /** @brief Sets lane changing behavior * @param[in] value a bitset controlling the different modes @@ -1267,13 +1317,11 @@ /** @brief Returns the originally longitudinal speed to use - * @return The speed given before influence + * @return The speed given before influence or -1 if no influence is active */ - inline SUMOReal getOriginalSpeed() const { - return myOriginalSpeed; - } + double getOriginalSpeed() const; - void setVTDControlled(Position xyPos, MSLane* l, SUMOReal pos, SUMOReal posLat, SUMOReal angle, int edgeOffset, const ConstMSEdgeVector& route, SUMOTime t); + void setVTDControlled(Position xyPos, MSLane* l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector& route, SUMOTime t); SUMOTime getLastAccessTimeStep() const { return myLastVTDAccess; @@ -1282,24 +1330,39 @@ void postProcessVTD(MSVehicle* v); /// @brief return the speed that is implicit in the new VTD position - SUMOReal implicitSpeedVTD(const MSVehicle* veh, SUMOReal oldSpeed); + double implicitSpeedVTD(const MSVehicle* veh, double oldSpeed); /// @brief return the change in longitudinal position that is implicit in the new VTD position - SUMOReal implicitDeltaPosVTD(const MSVehicle* veh); + double implicitDeltaPosVTD(const MSVehicle* veh); bool isVTDControlled() const; bool isVTDAffected(SUMOTime t) const; + void setSignals(int signals) { + myTraCISignals = signals; + } + + int getSignals() const { + return myTraCISignals; + } + + double getLatDist() const { + return myLatDist; + } + private: /// @brief The velocity time line to apply - std::vector > mySpeedTimeLine; + std::vector > mySpeedTimeLine; /// @brief The lane usage time line to apply std::vector > myLaneTimeLine; /// @brief The velocity before influence - SUMOReal myOriginalSpeed; + double myOriginalSpeed; + + /// @brief The requested lateral change + double myLatDist; /// @brief Whether influencing the speed has already started bool mySpeedAdaptationStarted; @@ -1321,9 +1384,9 @@ Position myVTDXYPos; MSLane* myVTDLane; - SUMOReal myVTDPos; - SUMOReal myVTDPosLat; - SUMOReal myVTDAngle; + double myVTDPos; + double myVTDPosLat; + double myVTDAngle; int myVTDEdgeOffset; ConstMSEdgeVector myVTDRoute; SUMOTime myLastVTDAccess; @@ -1344,6 +1407,9 @@ ///* @brief flags for determining the priority of traci lane change requests TraciLaneChangePriority myTraciLaneChangePriority; + // @brief the signals set via TraCI + int myTraCISignals; + }; @@ -1367,8 +1433,8 @@ void setVTDState(Position xyPos); /// @brief compute safe speed for following the given leader - SUMOReal getSafeFollowSpeed(const std::pair leaderInfo, - const SUMOReal seen, const MSLane* const lane, SUMOReal distToCrossing) const; + double getSafeFollowSpeed(const std::pair leaderInfo, + const double seen, const MSLane* const lane, double distToCrossing) const; /// @brief get a numerical value for the priority of the upcoming link static int nextLinkPriority(const std::vector& conts); @@ -1388,7 +1454,7 @@ protected: - SUMOReal getSpaceTillLastStanding(const MSLane* l, bool& foundStopped) const; + double getSpaceTillLastStanding(const MSLane* l, bool& foundStopped) const; /// @name Interaction with move reminders ///@{ @@ -1433,6 +1499,9 @@ SUMOTime myWaitingTime; WaitingTimeCollector myWaitingTimeCollector; + /// @brief the time loss due to writing with less than maximum speed + SUMOTime myTimeLoss; + /// @brief This Vehicles driving state (pos and speed) State myState; @@ -1444,8 +1513,18 @@ const MSEdge* myLastBestLanesEdge; const MSLane* myLastBestLanesInternalLane; - std::vector > myBestLanes; // XXX: Documentation?, refs. #2604 + /* @brief Complex data structure for keeping and updating LaneQ: + * Each element of the outer vector corresponds to an upcoming edge on the vehicles route + * The first element corresponds to the current edge and is returned in getBestLanes() + * The other elements are only used as a temporary structure in updateBestLanes(); + */ + std::vector > myBestLanes; + + /* @brief iterator to speed up retrival of the current lane's LaneQ in getBestLaneOffset() and getBestLanesContinuation() + * This is updated in updateOccupancyAndCurrentBestLane() + */ std::vector::iterator myCurrentLaneInBestLanes; + static std::vector myEmptyLaneVector; static std::vector myEmptyTransportableVector; @@ -1459,11 +1538,11 @@ MSDevice_Transportable* myContainerDevice; /// @brief The current acceleration after dawdling in m/s - SUMOReal myAcceleration; + double myAcceleration; /// @brief The information into which lanes the vehicle laps into std::vector myFurtherLanes; - std::vector myFurtherLanesPosLat; + std::vector myFurtherLanesPosLat; /// @brief State of things of the vehicle that can be on or off int mySignals; @@ -1480,33 +1559,36 @@ bool myHaveToWaitOnNextLink; /// @brief the angle in radians (@todo consider moving this into myState) - SUMOReal myAngle; + double myAngle; /// @brief distance to the next stop or -1 if there is none - SUMOReal myStopDist; + double myStopDist; + + /// @brief amount of time for which the vehicle is immune from collisions + SUMOTime myCollisionImmunity; mutable Position myCachedPosition; protected: struct DriveProcessItem { MSLink* myLink; - SUMOReal myVLinkPass; - SUMOReal myVLinkWait; + double myVLinkPass; + double myVLinkWait; bool mySetRequest; SUMOTime myArrivalTime; - SUMOReal myArrivalSpeed; + double myArrivalSpeed; SUMOTime myArrivalTimeBraking; - SUMOReal myArrivalSpeedBraking; - SUMOReal myDistance; - SUMOReal accelV; + double myArrivalSpeedBraking; + double myDistance; + double accelV; bool hadVehicle; - SUMOReal availableSpace; + double availableSpace; - DriveProcessItem(MSLink* link, SUMOReal vPass, SUMOReal vWait, bool setRequest, - SUMOTime arrivalTime, SUMOReal arrivalSpeed, - SUMOTime arrivalTimeBraking, SUMOReal arrivalSpeedBraking, - SUMOReal distance, - SUMOReal leaveSpeed = -1.) : + DriveProcessItem(MSLink* link, double vPass, double vWait, bool setRequest, + SUMOTime arrivalTime, double arrivalSpeed, + SUMOTime arrivalTimeBraking, double arrivalSpeedBraking, + double distance, + double leaveSpeed = -1.) : myLink(link), myVLinkPass(vPass), myVLinkWait(vWait), mySetRequest(setRequest), myArrivalTime(arrivalTime), myArrivalSpeed(arrivalSpeed), myArrivalTimeBraking(arrivalTimeBraking), myArrivalSpeedBraking(arrivalSpeedBraking), @@ -1518,7 +1600,7 @@ /// @brief constructor if the link shall not be passed - DriveProcessItem(SUMOReal vWait, SUMOReal distance) : + DriveProcessItem(double vWait, double distance) : myLink(0), myVLinkPass(vWait), myVLinkWait(vWait), mySetRequest(false), myArrivalTime(0), myArrivalSpeed(0), myArrivalTimeBraking(0), myArrivalSpeedBraking(0), @@ -1528,14 +1610,14 @@ }; - inline void adaptLeaveSpeed(const SUMOReal v) { + inline void adaptLeaveSpeed(const double v) { if (accelV < 0) { accelV = v; } else { accelV = MIN2(accelV, v); } } - inline SUMOReal getLeaveSpeed() const { + inline double getLeaveSpeed() const { return accelV < 0 ? myVLinkPass : accelV; } }; @@ -1545,17 +1627,17 @@ DriveItemVector myLFLinkLanes; /// @todo: documentation - void planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector& lfLinks, SUMOReal& myStopDist) const; + void planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector& lfLinks, double& myStopDist) const; /// @todo: documentation - void checkRewindLinkLanes(const SUMOReal lengthsInFront, DriveItemVector& lfLinks) const; + void checkRewindLinkLanes(const double lengthsInFront, DriveItemVector& lfLinks) const; /// @brief unregister approach from all upcoming links void removeApproachingInformation(DriveItemVector& lfLinks) const; /// @brief estimate leaving speed when accelerating across a link - inline SUMOReal estimateLeaveSpeed(const MSLink* const link, const SUMOReal vLinkPass) const { + inline double estimateLeaveSpeed(const MSLink* const link, const double vLinkPass) const { // estimate leave speed for passing time computation // l=linkLength, a=accel, t=continuousTime, v=vLeave // l=v*t + 0.5*a*t^2, solve for t and multiply with a, then add v @@ -1575,10 +1657,10 @@ * @param[in,out] the safe velocity for arriving at the next link * @param[in] distToCrossing The distance to the crossing point with the current leader where relevant or -1 */ - void adaptToLeader(const std::pair leaderInfo, - const SUMOReal seen, DriveProcessItem* const lastLink, - const MSLane* const lane, SUMOReal& v, SUMOReal& vLinkPass, - SUMOReal distToCrossing = -1) const; + void adaptToLeader(const std::pair leaderInfo, + const double seen, DriveProcessItem* const lastLink, + const MSLane* const lane, double& v, double& vLinkPass, + double distToCrossing = -1) const; /* @brief adapt safe velocity in accordance to multiple vehicles ahead: * @param[in] ahead The leader information according to the current lateral-resolution @@ -1590,9 +1672,13 @@ * @param[in,out] the safe velocity for arriving at the next link */ void adaptToLeaders(const MSLeaderInfo& ahead, - SUMOReal latOffset, - const SUMOReal seen, DriveProcessItem* const lastLink, - const MSLane* const lane, SUMOReal& v, SUMOReal& vLinkPass) const; + double latOffset, + const double seen, DriveProcessItem* const lastLink, + const MSLane* const lane, double& v, double& vLinkPass) const; + + /// @brief checks for link leaders on the given link + void checkLinkLeader(const MSLink* link, const MSLane* lane, double seen, + DriveProcessItem* const lastLink, double& v, double& vLinkPass, double& vLinkWait, bool& setRequest) const; // @brief return the lane on which the back of this vehicle resides @@ -1608,7 +1694,7 @@ * acceleration a within the next time step is then a = (vNext - vCurrent)/TS ) * @param[in] vNext speed in the next time step */ - void updateState(SUMOReal vNext); + void updateState(double vNext); private: /* @brief The vehicle's knowledge about edge efforts/travel times; @see MSEdgeWeightsStorage diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicleTransfer.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicleTransfer.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicleTransfer.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicleTransfer.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sep 2003 -/// @version $Id: MSVehicleTransfer.cpp 21653 2016-10-10 13:32:16Z luecken $ +/// @version $Id: MSVehicleTransfer.cpp 23861 2017-04-07 08:32:40Z namdre $ /// // A mover of vehicles that got stucked due to grid locks /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,24 +32,22 @@ #include #include +#include #include "MSNet.h" #include "MSLane.h" #include "MSEdge.h" #include "MSVehicle.h" #include #include "MSVehicleControl.h" +#include "MSInsertionControl.h" #include "MSVehicleTransfer.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions // =========================================================================== MSVehicleTransfer* MSVehicleTransfer::myInstance = 0; -const SUMOReal MSVehicleTransfer::TeleportMinSpeed = 1; +const double MSVehicleTransfer::TeleportMinSpeed = 1; const std::set MSVehicleTransfer::myEmptyVehicleSet; // =========================================================================== @@ -118,12 +116,13 @@ // then pick the one which is least occupied // @todo maybe parking vehicles should always continue on the rightmost lane? const MSLane* oldLane = desc.myVeh->getLane(); - MSLane* l = (nextEdge != 0 ? e->getFreeLane(e->allowedLanes(*nextEdge, vclass), vclass) : - e->getFreeLane(0, vclass)); + const double departPos = desc.myParking ? desc.myVeh->getPositionOnLane() : 0; + MSLane* l = (nextEdge != 0 ? e->getFreeLane(e->allowedLanes(*nextEdge, vclass), vclass, departPos) : + e->getFreeLane(0, vclass, departPos)); if (desc.myParking) { // handle parking vehicles - if (l->isInsertionSuccess(desc.myVeh, 0, desc.myVeh->getPositionOnLane(), desc.myVeh->getLateralPositionOnLane(), false, MSMoveReminder::NOTIFICATION_PARKING)) { + if (l->isInsertionSuccess(desc.myVeh, 0, departPos, desc.myVeh->getLateralPositionOnLane(), false, MSMoveReminder::NOTIFICATION_PARKING)) { MSNet::getInstance()->informVehicleStateListener(desc.myVeh, MSNet::VEHICLE_STATE_ENDING_PARKING); myParkingVehicles[oldLane].erase(desc.myVeh); i = myVehicles.erase(i); @@ -194,5 +193,46 @@ } +void +MSVehicleTransfer::saveState(OutputDevice& out) const { + std::map parkingLanes; + for (ParkingVehicles::const_iterator it = myParkingVehicles.begin(); it != myParkingVehicles.end(); ++it) { + const std::set& vehs = it->second; + for (std::set::const_iterator it2 = vehs.begin(); it2 != vehs.end(); ++it2) { + parkingLanes[*it2] = it->first; + } + } + for (VehicleInfVector::const_iterator it = myVehicles.begin(); it != myVehicles.end(); ++it) { + out.openTag(SUMO_TAG_VEHICLETRANSFER); + out.writeAttr(SUMO_ATTR_ID, it->myVeh->getID()); + out.writeAttr(SUMO_ATTR_DEPART, it->myProceedTime); + if (it->myParking) { + out.writeAttr(SUMO_ATTR_PARKING, parkingLanes[it->myVeh]->getID()); + } + out.closeTag(); + } +} + + +void +MSVehicleTransfer::loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset, MSVehicleControl& vc) { + MSVehicle* veh = dynamic_cast(vc.getVehicle(attrs.getString(SUMO_ATTR_ID))); + if (veh == 0) { + // deleted + return; + } + SUMOTime proceedTime = (SUMOTime)attrs.getLong(SUMO_ATTR_DEPART); + MSLane* parkingLane = attrs.hasAttribute(SUMO_ATTR_PARKING) ? MSLane::dictionary(attrs.getString(SUMO_ATTR_PARKING)) : 0; + myVehicles.push_back(VehicleInformation(veh, proceedTime - offset, parkingLane != 0)); + if (parkingLane != 0) { + myParkingVehicles[parkingLane].insert(veh); + veh->setTentativeLaneAndPosition(parkingLane, veh->getPositionOnLane()); + veh->processNextStop(veh->getSpeed()); + } + MSNet::getInstance()->getInsertionControl().alreadyDeparted(veh); +} + + + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicleTransfer.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicleTransfer.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicleTransfer.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicleTransfer.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,13 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sep 2003 -/// @version $Id: MSVehicleTransfer.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSVehicleTransfer.h 23645 2017-03-24 09:23:31Z behrisch $ /// // A mover of vehicles that got stucked due to grid locks // This class also serves as container for parking vehicles /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2003-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2003-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,9 +42,11 @@ // =========================================================================== // class declarations // =========================================================================== -class MSVehicle; class MSEdge; class MSLane; +class MSVehicle; +class MSVehicleControl; +class SUMOSAXAttributes; // =========================================================================== @@ -53,7 +55,7 @@ /** * @class MSVehicleTransfer * This object (each simulation owns exactly one) is responsible for the - * transfer of vehicles that got stocked within the network due to grid locks. + * transfer of vehicles that got stuck within the network due to grid locks. * It also manages vehicles that are removed from the network because of stops * with the parking attribute. * @@ -112,13 +114,19 @@ /// @brief return parking vehicles on the given lane const std::set& getParkingVehicles(const MSLane* lane) const; + /** @brief Saves the current state into the given stream */ + void saveState(OutputDevice& out) const; + + /** @brief Loads one transfer vehicle state from the given descriptionn */ + void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset, MSVehicleControl& vc); + /** @brief Returns the instance of this object * @return The singleton instance */ static MSVehicleTransfer* getInstance(); /// @brief The minimum speed while teleporting - static const SUMOReal TeleportMinSpeed; + static const double TeleportMinSpeed; private: /// @brief Constructor diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicleType.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicleType.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicleType.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicleType.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Thimor Bohn /// @author Michael Behrisch /// @date Tue, 06 Mar 2001 -/// @version $Id: MSVehicleType.cpp 21657 2016-10-10 14:50:05Z namdre $ +/// @version $Id: MSVehicleType.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The car-following model and parameter /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,22 +37,20 @@ #include #include #include +#include #include "MSNet.h" #include "cfmodels/MSCFModel_IDM.h" #include "cfmodels/MSCFModel_Kerner.h" #include "cfmodels/MSCFModel_Krauss.h" #include "cfmodels/MSCFModel_KraussOrig1.h" #include "cfmodels/MSCFModel_KraussPS.h" +#include "cfmodels/MSCFModel_KraussX.h" #include "cfmodels/MSCFModel_SmartSK.h" #include "cfmodels/MSCFModel_Daniel1.h" #include "cfmodels/MSCFModel_PWag2009.h" #include "cfmodels/MSCFModel_Wiedemann.h" #include "MSVehicleType.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members @@ -75,21 +73,15 @@ } -SUMOReal -MSVehicleType::computeChosenSpeedDeviation(MTRand* rng, const SUMOReal minDevFactor) const { - if (myParameter.speedDev == 0) { - return myParameter.speedFactor; - } - // for speedDev = 0.1, most 95% of the vehicles will drive between 80% and 120% of speedLimit * speedFactor - const SUMOReal devA = MIN2(SUMOReal(2.), RandHelper::randNorm(0, 1., rng)); - // avoid voluntary speeds below 20% of the requested speedFactor - return MAX2(minDevFactor, SUMOReal(devA * myParameter.speedDev + 1.)) * myParameter.speedFactor; +double +MSVehicleType::computeChosenSpeedDeviation(MTRand* rng, const double minDev) const { + return MAX2(minDev, myParameter.speedFactor.sample(rng)); } // ------------ Setter methods void -MSVehicleType::setLength(const SUMOReal& length) { +MSVehicleType::setLength(const double& length) { if (myOriginalType != 0 && length < 0) { myParameter.length = myOriginalType->getLength(); } else { @@ -99,7 +91,7 @@ void -MSVehicleType::setHeight(const SUMOReal& height) { +MSVehicleType::setHeight(const double& height) { if (myOriginalType != 0 && height < 0) { myParameter.height = myOriginalType->getHeight(); } else { @@ -109,7 +101,7 @@ void -MSVehicleType::setMinGap(const SUMOReal& minGap) { +MSVehicleType::setMinGap(const double& minGap) { if (myOriginalType != 0 && minGap < 0) { myParameter.minGap = myOriginalType->getMinGap(); } else { @@ -119,7 +111,17 @@ void -MSVehicleType::setMaxSpeed(const SUMOReal& maxSpeed) { +MSVehicleType::setMinGapLat(const double& minGapLat) { + if (myOriginalType != 0 && minGapLat < 0) { + myParameter.minGapLat = myOriginalType->getMinGapLat(); + } else { + myParameter.minGapLat = minGapLat; + } +} + + +void +MSVehicleType::setMaxSpeed(const double& maxSpeed) { if (myOriginalType != 0 && maxSpeed < 0) { myParameter.maxSpeed = myOriginalType->getMaxSpeed(); } else { @@ -129,13 +131,28 @@ void +MSVehicleType::setMaxSpeedLat(const double& maxSpeedLat) { + if (myOriginalType != 0 && maxSpeedLat < 0) { + myParameter.maxSpeedLat = myOriginalType->getMaxSpeedLat(); + } else { + myParameter.maxSpeedLat = maxSpeedLat; + } +} + + +void MSVehicleType::setVClass(SUMOVehicleClass vclass) { myParameter.vehicleClass = vclass; } +void +MSVehicleType::setPreferredLateralAlignment(LateralAlignment latAlignment) { + myParameter.latAlignment = latAlignment; +} + void -MSVehicleType::setDefaultProbability(const SUMOReal& prob) { +MSVehicleType::setDefaultProbability(const double& prob) { if (myOriginalType != 0 && prob < 0) { myParameter.defaultProbability = myOriginalType->getDefaultProbability(); } else { @@ -145,21 +162,21 @@ void -MSVehicleType::setSpeedFactor(const SUMOReal& factor) { +MSVehicleType::setSpeedFactor(const double& factor) { if (myOriginalType != 0 && factor < 0) { - myParameter.speedFactor = myOriginalType->getSpeedFactor(); + myParameter.speedFactor.getParameter()[0] = myOriginalType->myParameter.speedFactor.getParameter()[0]; } else { - myParameter.speedFactor = factor; + myParameter.speedFactor.getParameter()[0] = factor; } } void -MSVehicleType::setSpeedDeviation(const SUMOReal& dev) { +MSVehicleType::setSpeedDeviation(const double& dev) { if (myOriginalType != 0 && dev < 0) { - myParameter.speedDev = myOriginalType->getSpeedDeviation(); + myParameter.speedFactor.getParameter()[1] = myOriginalType->myParameter.speedFactor.getParameter()[1]; } else { - myParameter.speedDev = dev; + myParameter.speedFactor.getParameter()[1] = dev; } } @@ -177,7 +194,7 @@ void -MSVehicleType::setWidth(const SUMOReal& width) { +MSVehicleType::setWidth(const double& width) { if (myOriginalType != 0 && width < 0) { myParameter.width = myOriginalType->getWidth(); } else { @@ -187,7 +204,7 @@ void -MSVehicleType::setImpatience(const SUMOReal impatience) { +MSVehicleType::setImpatience(const double impatience) { if (myOriginalType != 0 && impatience < 0) { myParameter.impatience = myOriginalType->getImpatience(); } else { @@ -207,35 +224,46 @@ MSVehicleType* MSVehicleType::build(SUMOVTypeParameter& from) { MSVehicleType* vtype = new MSVehicleType(from); - const SUMOReal accel = from.getCFParam(SUMO_ATTR_ACCEL, SUMOVTypeParameter::getDefaultAccel(from.vehicleClass)); - const SUMOReal decel = from.getCFParam(SUMO_ATTR_DECEL, SUMOVTypeParameter::getDefaultDecel(from.vehicleClass)); - const SUMOReal sigma = from.getCFParam(SUMO_ATTR_SIGMA, SUMOVTypeParameter::getDefaultImperfection(from.vehicleClass)); - const SUMOReal tau = from.getCFParam(SUMO_ATTR_TAU, 1.); + const double accel = from.getCFParam(SUMO_ATTR_ACCEL, SUMOVTypeParameter::getDefaultAccel(from.vehicleClass)); + const double decel = from.getCFParam(SUMO_ATTR_DECEL, SUMOVTypeParameter::getDefaultDecel(from.vehicleClass)); +// const double emergencyDecel = from.getCFParam(SUMO_ATTR_EMERGENCYDECEL, SUMOVTypeParameter::getDefaultEmergencyDecel(from.vehicleClass)); + const double emergencyDecel = from.getCFParam(SUMO_ATTR_EMERGENCYDECEL, decel); + // by default decel and apparentDecel are identical + const double apparentDecel = from.getCFParam(SUMO_ATTR_APPARENTDECEL, decel); + + const double sigma = from.getCFParam(SUMO_ATTR_SIGMA, SUMOVTypeParameter::getDefaultImperfection(from.vehicleClass)); + const double tau = from.getCFParam(SUMO_ATTR_TAU, 1.); switch (from.cfModel) { case SUMO_TAG_CF_IDM: - vtype->myCarFollowModel = new MSCFModel_IDM(vtype, accel, decel, tau, + vtype->myCarFollowModel = new MSCFModel_IDM(vtype, accel, decel, emergencyDecel, tau, from.getCFParam(SUMO_ATTR_CF_IDM_DELTA, 4.), from.getCFParam(SUMO_ATTR_CF_IDM_STEPPING, .25)); break; case SUMO_TAG_CF_IDMM: - vtype->myCarFollowModel = new MSCFModel_IDM(vtype, accel, decel, tau, + vtype->myCarFollowModel = new MSCFModel_IDM(vtype, accel, decel, emergencyDecel, tau, from.getCFParam(SUMO_ATTR_CF_IDMM_ADAPT_FACTOR, 1.8), from.getCFParam(SUMO_ATTR_CF_IDMM_ADAPT_TIME, 600.), from.getCFParam(SUMO_ATTR_CF_IDM_STEPPING, .25)); break; case SUMO_TAG_CF_BKERNER: - vtype->myCarFollowModel = new MSCFModel_Kerner(vtype, accel, decel, tau, + vtype->myCarFollowModel = new MSCFModel_Kerner(vtype, accel, decel, emergencyDecel, tau, from.getCFParam(SUMO_ATTR_K, .5), from.getCFParam(SUMO_ATTR_CF_KERNER_PHI, 5.)); break; case SUMO_TAG_CF_KRAUSS_ORIG1: - vtype->myCarFollowModel = new MSCFModel_KraussOrig1(vtype, accel, decel, sigma, tau); + vtype->myCarFollowModel = new MSCFModel_KraussOrig1(vtype, accel, decel, emergencyDecel, decel, sigma, tau); break; case SUMO_TAG_CF_KRAUSS_PLUS_SLOPE: - vtype->myCarFollowModel = new MSCFModel_KraussPS(vtype, accel, decel, sigma, tau); + vtype->myCarFollowModel = new MSCFModel_KraussPS(vtype, accel, decel, emergencyDecel, sigma, tau); + break; + case SUMO_TAG_CF_KRAUSSX: + vtype->myCarFollowModel = new MSCFModel_KraussX(vtype, accel, decel, emergencyDecel, apparentDecel, sigma, tau, + from.getCFParam(SUMO_ATTR_TMP1, 0.), + from.getCFParam(SUMO_ATTR_TMP2, 0.) + ); break; case SUMO_TAG_CF_SMART_SK: - vtype->myCarFollowModel = new MSCFModel_SmartSK(vtype, accel, decel, sigma, tau, + vtype->myCarFollowModel = new MSCFModel_SmartSK(vtype, accel, decel, emergencyDecel, sigma, tau, from.getCFParam(SUMO_ATTR_TMP1, 1.), from.getCFParam(SUMO_ATTR_TMP2, 1.), from.getCFParam(SUMO_ATTR_TMP3, 1.), @@ -243,7 +271,7 @@ from.getCFParam(SUMO_ATTR_TMP5, 1.)); break; case SUMO_TAG_CF_DANIEL1: - vtype->myCarFollowModel = new MSCFModel_Daniel1(vtype, accel, decel, sigma, tau, + vtype->myCarFollowModel = new MSCFModel_Daniel1(vtype, accel, decel, emergencyDecel, sigma, tau, from.getCFParam(SUMO_ATTR_TMP1, 1.), from.getCFParam(SUMO_ATTR_TMP2, 1.), from.getCFParam(SUMO_ATTR_TMP3, 1.), @@ -251,18 +279,21 @@ from.getCFParam(SUMO_ATTR_TMP5, 1.)); break; case SUMO_TAG_CF_PWAGNER2009: - vtype->myCarFollowModel = new MSCFModel_PWag2009(vtype, accel, decel, sigma, tau, + vtype->myCarFollowModel = new MSCFModel_PWag2009(vtype, accel, decel, emergencyDecel, sigma, tau, from.getCFParam(SUMO_ATTR_CF_PWAGNER2009_TAULAST, 0.3), from.getCFParam(SUMO_ATTR_CF_PWAGNER2009_APPROB, 0.5)); break; case SUMO_TAG_CF_WIEDEMANN: - vtype->myCarFollowModel = new MSCFModel_Wiedemann(vtype, accel, decel, + vtype->myCarFollowModel = new MSCFModel_Wiedemann(vtype, accel, decel, emergencyDecel, from.getCFParam(SUMO_ATTR_CF_WIEDEMANN_SECURITY, 0.5), from.getCFParam(SUMO_ATTR_CF_WIEDEMANN_ESTIMATION, 0.5)); break; + case SUMO_TAG_CF_RAIL: + vtype->myCarFollowModel = new MSCFModel_Rail(vtype, from.getCFParamString(SUMO_ATTR_TRAIN_TYPE, "NGT400")); + break; case SUMO_TAG_CF_KRAUSS: default: - vtype->myCarFollowModel = new MSCFModel_Krauss(vtype, accel, decel, sigma, tau); + vtype->myCarFollowModel = new MSCFModel_Krauss(vtype, accel, decel, emergencyDecel, apparentDecel, sigma, tau); break; } return vtype; @@ -270,11 +301,19 @@ MSVehicleType* -MSVehicleType::build(const std::string& id, const MSVehicleType* from) { +MSVehicleType::buildSingularType(const std::string& id, const MSVehicleType* from) { MSVehicleType* vtype = new MSVehicleType(from->myParameter); vtype->myParameter.id = id; vtype->myCarFollowModel = from->myCarFollowModel->duplicate(vtype); - vtype->myOriginalType = from->myOriginalType != 0 ? from->myOriginalType : from; + if (from->myOriginalType != 0) { + vtype->myOriginalType = from->myOriginalType; + MSNet::getInstance()->getVehicleControl().removeVType(from); + } else { + vtype->myOriginalType = from; + } + if (!MSNet::getInstance()->getVehicleControl().addVType(vtype)) { + throw ProcessError("could not add singular type " + vtype->getID()); + } return vtype; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicleType.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicleType.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/MSVehicleType.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/MSVehicleType.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 12 Mar 2001 -/// @version $Id: MSVehicleType.h 21657 2016-10-10 14:50:05Z namdre $ +/// @version $Id: MSVehicleType.h 24108 2017-04-27 18:43:30Z behrisch $ /// // The car-following model and parameter /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -115,7 +115,7 @@ /** @brief Get vehicle's length [m] * @return The length vehicles of this type have in m */ - SUMOReal getLength() const { + double getLength() const { return myParameter.length; } @@ -123,7 +123,7 @@ /** @brief Get vehicle's length including the minimum gap [m] * @return The length vehicles of this type have (including the minimum gap in m */ - SUMOReal getLengthWithGap() const { + double getLengthWithGap() const { return myParameter.length + myParameter.minGap; } @@ -131,14 +131,14 @@ /** @brief Get the free space in front of vehicles of this class * @return The place before the vehicle */ - SUMOReal getMinGap() const { + double getMinGap() const { return myParameter.minGap; } /** @brief Get the minimum lateral gap that vehicles of this type maintain * @return The place before the vehicle */ - SUMOReal getMinGapLat() const { + double getMinGapLat() const { return myParameter.minGapLat; } @@ -167,7 +167,7 @@ /** @brief Get vehicle's maximum speed [m/s]. * @return The maximum speed (in m/s) of vehicles of this class */ - SUMOReal getMaxSpeed() const { + double getMaxSpeed() const { return myParameter.maxSpeed; } @@ -175,13 +175,13 @@ /** @brief Computes and returns the speed deviation * @return A new, random speed deviation */ - SUMOReal computeChosenSpeedDeviation(MTRand* rng, const SUMOReal minDevFactor = 0.2) const; + double computeChosenSpeedDeviation(MTRand* rng, const double minDev = -1.) const; /** @brief Get the default probability of this vehicle type * @return The probability to use this type */ - SUMOReal getDefaultProbability() const { + double getDefaultProbability() const { return myParameter.defaultProbability; } @@ -215,23 +215,15 @@ /** @brief Returns this type's speed factor * @return The speed factor of this type */ - SUMOReal getSpeedFactor() const { + const Distribution_Parameterized& getSpeedFactor() const { return myParameter.speedFactor; } - /** @brief Returns this type's speed deviation - * @return The speed deviation of this type - */ - SUMOReal getSpeedDeviation() const { - return myParameter.speedDev; - } - - /** @brief Returns this type's impatience * @return The impatience of this type */ - SUMOReal getImpatience() const { + double getImpatience() const { return myParameter.impatience; } /// @} @@ -244,14 +236,14 @@ /** @brief Get the width which vehicles of this class shall have when being drawn * @return The width of this type's vehicles */ - SUMOReal getWidth() const { + double getWidth() const { return myParameter.width; } /** @brief Get the height which vehicles of this class shall have when being drawn * @return The height of this type's vehicles */ - SUMOReal getHeight() const { + double getHeight() const { return myParameter.height; } @@ -311,7 +303,7 @@ /** @brief Get vehicle's maximum lateral speed [m/s]. * @return The maximum lateral speed (in m/s) of vehicles of this class */ - SUMOReal getMaxSpeedLat() const { + double getMaxSpeedLat() const { return myParameter.maxSpeedLat; } @@ -334,7 +326,7 @@ * * @param[in] length The new length of this type */ - void setLength(const SUMOReal& length); + void setLength(const double& length); /** @brief Set a new value for this type's height @@ -344,7 +336,7 @@ * * @param[in] height The new height of this type */ - void setHeight(const SUMOReal& height); + void setHeight(const double& height); /** @brief Set a new value for this type's minimum gap @@ -354,9 +346,18 @@ * * @param[in] minGap The new minimum gap of this type */ - void setMinGap(const SUMOReal& minGap); + void setMinGap(const double& minGap); + /** @brief Set a new value for this type's minimum lataral gap + * + * If the given value<0 then the one from the original type will + * be used. + * + * @param[in] minGapLat The new minimum lateral gap of this type + */ + void setMinGapLat(const double& minGapLat); + /** @brief Set a new value for this type's maximum speed * * If the given value<0 then the one from the original type will @@ -364,8 +365,16 @@ * * @param[in] maxSpeed The new maximum speed of this type */ - void setMaxSpeed(const SUMOReal& maxSpeed); + void setMaxSpeed(const double& maxSpeed); + /** @brief Set a new value for this type's maximum lateral speed + * + * If the given value<0 then the one from the original type will + * be used. + * + * @param[in] maxSpeedLat The new maximum lateral speed of this type + */ + void setMaxSpeedLat(const double& maxSpeedLat); /** @brief Set a new value for this type's vehicle class * @param[in] vclass The new vehicle class of this type @@ -380,7 +389,7 @@ * * @param[in] prob The new default probability of this type */ - void setDefaultProbability(const SUMOReal& prob); + void setDefaultProbability(const double& prob); /** @brief Set a new value for this type's speed factor @@ -390,7 +399,7 @@ * * @param[in] factor The new speed factor of this type */ - void setSpeedFactor(const SUMOReal& factor); + void setSpeedFactor(const double& factor); /** @brief Set a new value for this type's speed deviation @@ -400,7 +409,7 @@ * * @param[in] dev The new speed deviation of this type */ - void setSpeedDeviation(const SUMOReal& dev); + void setSpeedDeviation(const double& dev); /** @brief Set a new value for this type's emission class @@ -422,7 +431,7 @@ * * @param[in] width The new width of this type */ - void setWidth(const SUMOReal& width); + void setWidth(const double& width); /** @brief Set a new value for this type's shape @@ -434,7 +443,11 @@ /** @brief Set a new value for this type's impatience * @param[in] impatience The new impatience of this type */ - void setImpatience(const SUMOReal impatience); + void setImpatience(const double impatience); + + /** @brief Set vehicle's preferred lateral alignment + */ + void setPreferredLateralAlignment(LateralAlignment latAlignment); /// @} @@ -455,7 +468,7 @@ * @param[in] from The vehicle type * @return The built vehicle type */ - static MSVehicleType* build(const std::string& id, const MSVehicleType* from); + static MSVehicleType* buildSingularType(const std::string& id, const MSVehicleType* from); /// @} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,6 @@ MSDetectorControl.cpp MSDetectorControl.h \ MSDetectorFileOutput.h \ MSE2Collector.cpp MSE2Collector.h \ -MS_E2_ZS_CollectorOverLanes.cpp MS_E2_ZS_CollectorOverLanes.h \ MSE3Collector.cpp MSE3Collector.h \ MSInductLoop.cpp MSInductLoop.h \ MSInstantInductLoop.cpp MSInstantInductLoop.h \ @@ -20,6 +19,7 @@ MSFCDExport.cpp MSFCDExport.h \ MSAmitranTrajectories.cpp MSAmitranTrajectories.h \ MSBatteryExport.cpp MSBatteryExport.h \ +MSStopOut.cpp MSStopOut.h \ MSEmissionExport.cpp MSEmissionExport.h \ MSVTKExport.cpp MSVTKExport.h \ MSFullExport.cpp MSFullExport.h \ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -99,14 +99,14 @@ libmicrosimoutput_a_AR = $(AR) $(ARFLAGS) libmicrosimoutput_a_LIBADD = am_libmicrosimoutput_a_OBJECTS = MSDetectorControl.$(OBJEXT) \ - MSE2Collector.$(OBJEXT) MS_E2_ZS_CollectorOverLanes.$(OBJEXT) \ - MSE3Collector.$(OBJEXT) MSInductLoop.$(OBJEXT) \ - MSInstantInductLoop.$(OBJEXT) MSMeanData.$(OBJEXT) \ - MSMeanData_Emissions.$(OBJEXT) MSMeanData_Harmonoise.$(OBJEXT) \ - MSMeanData_Net.$(OBJEXT) MSMeanData_Amitran.$(OBJEXT) \ - MSRouteProbe.$(OBJEXT) MSVTypeProbe.$(OBJEXT) \ - MSXMLRawOut.$(OBJEXT) MSFCDExport.$(OBJEXT) \ - MSAmitranTrajectories.$(OBJEXT) MSBatteryExport.$(OBJEXT) \ + MSE2Collector.$(OBJEXT) MSE3Collector.$(OBJEXT) \ + MSInductLoop.$(OBJEXT) MSInstantInductLoop.$(OBJEXT) \ + MSMeanData.$(OBJEXT) MSMeanData_Emissions.$(OBJEXT) \ + MSMeanData_Harmonoise.$(OBJEXT) MSMeanData_Net.$(OBJEXT) \ + MSMeanData_Amitran.$(OBJEXT) MSRouteProbe.$(OBJEXT) \ + MSVTypeProbe.$(OBJEXT) MSXMLRawOut.$(OBJEXT) \ + MSFCDExport.$(OBJEXT) MSAmitranTrajectories.$(OBJEXT) \ + MSBatteryExport.$(OBJEXT) MSStopOut.$(OBJEXT) \ MSEmissionExport.$(OBJEXT) MSVTKExport.$(OBJEXT) \ MSFullExport.$(OBJEXT) MSQueueExport.$(OBJEXT) libmicrosimoutput_a_OBJECTS = $(am_libmicrosimoutput_a_OBJECTS) @@ -342,7 +342,6 @@ MSDetectorControl.cpp MSDetectorControl.h \ MSDetectorFileOutput.h \ MSE2Collector.cpp MSE2Collector.h \ -MS_E2_ZS_CollectorOverLanes.cpp MS_E2_ZS_CollectorOverLanes.h \ MSE3Collector.cpp MSE3Collector.h \ MSInductLoop.cpp MSInductLoop.h \ MSInstantInductLoop.cpp MSInstantInductLoop.h \ @@ -357,6 +356,7 @@ MSFCDExport.cpp MSFCDExport.h \ MSAmitranTrajectories.cpp MSAmitranTrajectories.h \ MSBatteryExport.cpp MSBatteryExport.h \ +MSStopOut.cpp MSStopOut.h \ MSEmissionExport.cpp MSEmissionExport.h \ MSVTKExport.cpp MSVTKExport.h \ MSFullExport.cpp MSFullExport.h \ @@ -428,10 +428,10 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSMeanData_Net.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSQueueExport.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSRouteProbe.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSStopOut.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSVTKExport.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSVTypeProbe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSXMLRawOut.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MS_E2_ZS_CollectorOverLanes.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSAmitranTrajectories.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSAmitranTrajectories.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSAmitranTrajectories.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSAmitranTrajectories.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSAmitranTrajectories.cpp /// @author Michael Behrisch /// @date 13.03.2014 -/// @version $Id: MSAmitranTrajectories.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSAmitranTrajectories.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Realises dumping the complete network state /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,10 +38,6 @@ #include #include "MSAmitranTrajectories.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions // =========================================================================== @@ -72,7 +68,7 @@ of.writeAttr(SUMO_ATTR_VEHICLECLASS, PollutantsInterface::getAmitranVehicleClass(c)); of.writeAttr("fuel", PollutantsInterface::getFuel(c)); of.writeAttr(SUMO_ATTR_EMISSIONCLASS, "Euro" + toString(PollutantsInterface::getEuroClass(c))); - const SUMOReal weight = PollutantsInterface::getWeight(c); + const double weight = PollutantsInterface::getWeight(c); if (weight > 0.) { of.writeAttr(SUMO_ATTR_WEIGHT, int(weight / 10. + 0.5)); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSAmitranTrajectories.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSAmitranTrajectories.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSAmitranTrajectories.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSAmitranTrajectories.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSAmitranTrajectories.h /// @author Michael Behrisch /// @date 13.03.2014 -/// @version $Id: MSAmitranTrajectories.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSAmitranTrajectories.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Realises dumping the complete network state /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSBatteryExport.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSBatteryExport.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSBatteryExport.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSBatteryExport.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Tamas Kurczveil /// @author Pablo Alvarez Lopez /// @date 20-12-13 -/// @version $Id: MSBatteryExport.cpp 20576 2016-04-28 08:31:00Z palcraft $ +/// @version $Id: MSBatteryExport.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Realises dumping Battery Data /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,10 +45,6 @@ #include #endif -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -74,66 +70,48 @@ Position pos = veh->getLane()->getShape().positionAtOffset(veh->getPositionOnLane()); if (static_cast(veh->getDevice(typeid(MSDevice_Battery))) != 0) { - MSDevice_Battery* batteryToExport = dynamic_cast(veh->getDevice(typeid(MSDevice_Battery))); - if (batteryToExport->getMaximumBatteryCapacity() > 0) { // Open Row - of.openTag("vehicle"); - + of.openTag(SUMO_TAG_VEHICLE); // Write ID - of.writeAttr("id", veh->getID()); - + of.writeAttr(SUMO_ATTR_ID, veh->getID()); // Write consum - of.writeAttr("energyConsumed", batteryToExport->getConsum()); - - // Write ActBatKap - of.writeAttr("actualBatteryCapacity", batteryToExport->getActualBatteryCapacity()); - - // Write MaxBatKap - of.writeAttr("maximumBatteryCapacity", batteryToExport->getMaximumBatteryCapacity()); - + of.writeAttr(SUMO_ATTR_ENERGYCONSUMED, batteryToExport->getConsum()); + // Write Actual battery capacity + of.writeAttr(SUMO_ATTR_ACTUALBATTERYCAPACITY, batteryToExport->getActualBatteryCapacity()); + // Write Maximum battery capacity + of.writeAttr(SUMO_ATTR_MAXIMUMBATTERYCAPACITY, batteryToExport->getMaximumBatteryCapacity()); // Write Charging Station ID - of.writeAttr("chargingStationId", batteryToExport->getChargingStationID()); - + of.writeAttr(SUMO_ATTR_CHARGINGSTATIONID, batteryToExport->getChargingStationID()); // Write Charge charged in the Battery - of.writeAttr("energyCharged", batteryToExport->getEnergyCharged()); - + of.writeAttr(SUMO_ATTR_ENERGYCHARGED, batteryToExport->getEnergyCharged()); // Write ChargeInTransit if (batteryToExport->isChargingInTransit()) { - of.writeAttr("energyChargedInTransit", batteryToExport->getEnergyCharged()); + of.writeAttr(SUMO_ATTR_ENERGYCHARGEDINTRANSIT, batteryToExport->getEnergyCharged()); } else { - of.writeAttr("energyChargedInTransit", 0.00); + of.writeAttr(SUMO_ATTR_ENERGYCHARGEDINTRANSIT, 0.00); } - // Write ChargingStopped if (batteryToExport->isChargingStopped()) { - of.writeAttr("energyChargedStopped", batteryToExport->getEnergyCharged()); + of.writeAttr(SUMO_ATTR_ENERGYCHARGEDSTOPPED, batteryToExport->getEnergyCharged()); } else { - of.writeAttr("energyChargedStopped", 0.00); + of.writeAttr(SUMO_ATTR_ENERGYCHARGEDSTOPPED, 0.00); } - // Write Speed - of.writeAttr("speed", veh->getSpeed()); - + of.writeAttr(SUMO_ATTR_SPEED, veh->getSpeed()); // Write Acceleration - of.writeAttr("acceleration", veh->getAcceleration()); - + of.writeAttr(SUMO_ATTR_ACCELERATION, veh->getAcceleration()); // Write pos x of.writeAttr(SUMO_ATTR_X, veh->getPosition().x()); - // Write pos y of.writeAttr(SUMO_ATTR_Y, veh->getPosition().y()); - // Write Lane ID - of.writeAttr("lane", veh->getLane()->getID()); - + of.writeAttr(SUMO_ATTR_LANE, veh->getLane()->getID()); // Write vehicle position in the lane - of.writeAttr("posOnLane", veh->getPositionOnLane()); - + of.writeAttr(SUMO_ATTR_POSONLANE, veh->getPositionOnLane()); // Write Time stopped (In all cases) - of.writeAttr("timeStopped", batteryToExport->getVehicleStopped()); - + of.writeAttr(SUMO_ATTR_TIMESTOPPED, batteryToExport->getVehicleStopped()); // Close Row of.closeTag(); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSBatteryExport.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSBatteryExport.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSBatteryExport.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSBatteryExport.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Tamas Kurczveil /// @author Pablo Alvarez Lopez /// @date 20-12-13 -/// @version $Id: MSBatteryExport.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSBatteryExport.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Realises dumping Battery Data /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSCrossSection.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSCrossSection.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSCrossSection.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSCrossSection.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Sascha Krieg /// @date Tue Nov 25 15:23:28 2003 -/// @version $Id: MSCrossSection.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSCrossSection.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A simple description of a position on a lane (crossing of a lane) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,7 +55,7 @@ * @param[in] lane The lane to cross * @param[in] pos The position at the lane */ - MSCrossSection(MSLane* lane, SUMOReal pos) : myLane(lane) , myPosition(pos) {} + MSCrossSection(MSLane* lane, double pos) : myLane(lane) , myPosition(pos) {} public: @@ -63,7 +63,7 @@ MSLane* myLane; /// @brief The position at the lane - SUMOReal myPosition; + double myPosition; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSDetectorControl.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSDetectorControl.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSDetectorControl.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSDetectorControl.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date 2005-09-15 -/// @version $Id: MSDetectorControl.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSDetectorControl.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Detectors container; responsible for string and output generation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,10 +40,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSDetectorControl.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSDetectorControl.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSDetectorControl.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSDetectorControl.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date 2005-09-15 -/// @version $Id: MSDetectorControl.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSDetectorControl.h 23129 2017-02-25 22:27:29Z luecken $ /// // Detectors container; responsible for string and output generation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSDetectorFileOutput.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSDetectorFileOutput.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSDetectorFileOutput.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSDetectorFileOutput.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date 2004-11-23 -/// @version $Id: MSDetectorFileOutput.h 21496 2016-09-19 10:39:08Z behrisch $ +/// @version $Id: MSDetectorFileOutput.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Base of value-generating classes (detectors) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSE2Collector.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSE2Collector.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSE2Collector.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSE2Collector.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,18 +2,18 @@ /// @file MSE2Collector.cpp /// @author Christian Roessel /// @author Daniel Krajzewicz -/// @author Laura Bieker /// @author Sascha Krieg /// @author Michael Behrisch /// @author Robbin Blokpoel /// @author Jakob Erdmann +/// @author Leonhard Luecken /// @date Mon Feb 03 2014 10:13 CET -/// @version $Id: MSE2Collector.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSE2Collector.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// -// An areal (along a single lane) detector +// An areal detector covering a sequence of consecutive lanes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -25,6 +25,16 @@ /****************************************************************************/ +/* TODO: + * tests: + * - subsecond variant, ballistic variant + * - allow omitting jam processing + * + * Meso-compatibility? (esp. enteredLane-argument for MSBaseVehicle::notifyEnter() is not treated) + * Compatibility without internal lanes? + * Include leftVehicles into output? +*/ + // =========================================================================== // included modules // =========================================================================== @@ -42,286 +52,992 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - - -// =========================================================================== -// method definitions -// =========================================================================== -MSE2Collector::MSE2Collector(const std::string& id, DetectorUsage usage, - MSLane* const lane, SUMOReal startPos, SUMOReal detLength, - SUMOTime haltingTimeThreshold, - SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, +//#define DEBUG_E2_CONSTRUCTOR +//#define DEBUG_E2_NOTIFY_ENTER_AND_LEAVE +//#define DEBUG_E2_NOTIFY_MOVE +//#define DEBUG_E2_MAKE_VEHINFO +//#define DEBUG_E2_DETECTOR_UPDATE +//#define DEBUG_E2_TIME_ON_DETECTOR +//#define DEBUG_E2_JAMS +//#define DEBUG_E2_XML_OUT + +MSE2Collector::MSE2Collector(const std::string& id, + DetectorUsage usage, MSLane* lane, double startPos, double endPos, double length, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, const std::string& vTypes) : - MSMoveReminder(id, lane), + MSMoveReminder(id, lane, false), MSDetectorFileOutput(id, vTypes), + myUsage(usage), myJamHaltingSpeedThreshold(haltingSpeedThreshold), myJamHaltingTimeThreshold(haltingTimeThreshold), - myJamDistanceThreshold(jamDistThreshold), - myStartPos(startPos), myEndPos(startPos + detLength), - myUsage(usage), - myCurrentOccupancy(0), myCurrentMeanSpeed(-1), myCurrentJamNo(0), - myCurrentMaxJamLengthInMeters(0), myCurrentMaxJamLengthInVehicles(0), - myCurrentJamLengthInMeters(0), myCurrentJamLengthInVehicles(0), myCurrentStartedHalts(0), - myCurrentHaltingsNumber(0), myPassedVeh(0) { - assert(myLane != 0); - assert(myStartPos >= 0 && myStartPos < myLane->getLength()); - assert(myEndPos - myStartPos > 0 && myEndPos <= myLane->getLength()); + myJamDistanceThreshold(jamDistThreshold) { reset(); + +#ifdef DEBUG_E2_CONSTRUCTOR + std::cout << "\n" << "Creating MSE2Collector " << id + << " with lane = " << lane->getID() + << " startPos = " << startPos + << " endPos = " << endPos + << " length = " << length + << " haltingTimeThreshold = " << haltingTimeThreshold + << " haltingSpeedThreshold = " << haltingSpeedThreshold + << " jamDistThreshold = " << jamDistThreshold + << std::endl; +#endif + + assert(lane != 0); + + // check that exactly one of length, startPos, endPos is invalid + bool lengthInvalid = length == std::numeric_limits::max() || length <= 0; + bool endPosInvalid = endPos == std::numeric_limits::max(); + bool posInvalid = startPos == std::numeric_limits::max(); + + // check and normalize positions (assure positive values for pos and endPos, snap to lane-ends) + if (lengthInvalid) { + // assume that the detector is only located on a single lane + if (posInvalid) { + WRITE_WARNING("No valid detector length and start position given. Assuming startPos = 0 and length = end position"); + startPos = 0; + } + if (endPosInvalid) { + WRITE_WARNING("No valid detector length and end position given. Assuming endPos = lane length and length = endPos-startPos"); + endPos = lane->getLength(); + } + endPos = endPos < 0 ? lane->getLength() + endPos : endPos; + startPos = startPos < 0 ? lane->getLength() + startPos : startPos; + bool valid = endPos <= lane->getLength() && 0 <= startPos && startPos < endPos; + if (!valid) { + throw InvalidArgument("Error in specification for E2Detector '" + id + "'. Positional argument is malformed. 0 <= pos < endPos <= lane.getLength() is required."); + } + // snap detector ends to lane ends + endPos = snap(endPos, lane->getLength(), POSITION_EPS); + startPos = snap(startPos, 0., POSITION_EPS); + length = endPos - startPos; + } else if (posInvalid) { + // endPosInvalid == false + endPos = endPos < 0 ? lane->getLength() + endPos : endPos; + endPos = snap(endPos, lane->getLength(), POSITION_EPS); + } else { + // posInvalid == false + startPos = startPos < 0 ? lane->getLength() + startPos : startPos; + startPos = snap(startPos, 0., POSITION_EPS); + } + + myStartPos = startPos; + myEndPos = endPos; + + std::vector lanes; + if (posInvalid) { + lanes = selectLanes(lane, length, "bw"); + } else if (endPosInvalid) { + lanes = selectLanes(lane, length, "fw"); + } else { + // assuming detector is only located at a single lane + lanes.push_back(lane); + } + + initAuxiliaries(lanes); + checkPositioning(endPosInvalid, length); + addDetectorToLanes(lanes); } -MSE2Collector::MSE2Collector(const std::string& id, DetectorUsage usage, - MSLane* const lane, SUMOReal startPos, SUMOReal detLength, - SUMOTime haltingTimeThreshold, - SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, - const std::set& vTypes) : - MSMoveReminder(id, lane), +MSE2Collector::MSE2Collector(const std::string& id, + DetectorUsage usage, std::vector lanes, double startPos, double endPos, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, + const std::string& vTypes) : + MSMoveReminder(id, lanes[lanes.size() - 1], false), // assure that lanes.size() > 0 at caller side!!! MSDetectorFileOutput(id, vTypes), + myUsage(usage), + myFirstLane(lanes[0]), + myLastLane(lanes[lanes.size() - 1]), + myStartPos(startPos), + myEndPos(endPos), myJamHaltingSpeedThreshold(haltingSpeedThreshold), myJamHaltingTimeThreshold(haltingTimeThreshold), - myJamDistanceThreshold(jamDistThreshold), - myStartPos(startPos), myEndPos(startPos + detLength), - myUsage(usage), - myCurrentOccupancy(0), myCurrentMeanSpeed(-1), myCurrentJamNo(0), - myCurrentMaxJamLengthInMeters(0), myCurrentMaxJamLengthInVehicles(0), - myCurrentJamLengthInMeters(0), myCurrentJamLengthInVehicles(0), myCurrentStartedHalts(0), - myCurrentHaltingsNumber(0), myPassedVeh(0) { - assert(myLane != 0); - assert(myStartPos >= 0 && myStartPos < myLane->getLength()); - assert(myEndPos - myStartPos > 0 && myEndPos <= myLane->getLength()); + myJamDistanceThreshold(jamDistThreshold) { reset(); + + for (std::vector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) { + assert((*i) != 0); + } + +#ifdef DEBUG_E2_CONSTRUCTOR + std::cout << "\n" << "Creating MSE2Collector " << id + << " with endLane = " << myLastLane->getID() + << " endPos = " << endPos + << " startLane = " << myFirstLane->getID() + << " startPos = " << startPos + << " haltingTimeThreshold = " << haltingTimeThreshold + << " haltingSpeedThreshold = " << haltingSpeedThreshold + << " jamDistThreshold = " << jamDistThreshold + << std::endl; +#endif + + myStartPos = myStartPos < 0 ? lanes[0]->getLength() + myStartPos : myStartPos; + myEndPos = myEndPos < 0 ? lanes[lanes.size() - 1]->getLength() + myEndPos : myEndPos; + + if (myStartPos < POSITION_EPS) { + myStartPos = 0; + } + if (myEndPos > lanes[lanes.size() - 1]->getLength() - POSITION_EPS) { + myEndPos = lanes[lanes.size() - 1]->getLength(); + } + + + initAuxiliaries(lanes); + checkPositioning(); + addDetectorToLanes(lanes); +} + + +void +MSE2Collector::checkPositioning(bool posGiven, double desiredLength) { + // check if detector was truncated + if (desiredLength > 0 && myDetectorLength < desiredLength - NUMERICAL_EPS) { + std::stringstream ss; + ss << "Cannot build detector of length " << desiredLength + << " because no further continuation lane was found for lane '" << (posGiven ? myLastLane->getID() : myFirstLane->getID()) + << "'! Truncated detector at length " << myDetectorLength << "."; + WRITE_WARNING(ss.str()); + } + + if (myDetectorLength < POSITION_EPS && (myStartPos > 0. || myEndPos < myLastLane->getLength())) { + // assure minimal detector length + double prolong = POSITION_EPS - myDetectorLength; + double startPos = MAX2(0., myStartPos - prolong); // new startPos + prolong -= myStartPos - startPos; + myStartPos = startPos; + if (prolong > 0.) { + myEndPos = MIN2(myEndPos + prolong, myLastLane->getLength()); + } + WRITE_WARNING("Adjusted detector positioning to meet requirement length >= " + toString(POSITION_EPS) + + ". New position is [" + toString(myStartPos) + "," + toString(myEndPos) + "]"); + } + + // do some regularization snapping... + myStartPos = snap(myStartPos, 0., POSITION_EPS); + myStartPos = snap(myStartPos, myFirstLane->getLength() - POSITION_EPS, POSITION_EPS); + myStartPos = snap(myStartPos, 0., POSITION_EPS); + myEndPos = snap(myEndPos, myFirstLane->getLength(), POSITION_EPS); + myEndPos = snap(myEndPos, POSITION_EPS, POSITION_EPS); + myEndPos = snap(myEndPos, myFirstLane->getLength(), POSITION_EPS); + recalculateDetectorLength(); + +#ifdef DEBUG_E2_CONSTRUCTOR + std::stringstream ss; +// ss << std::setprecision(32) << myEndPos << " : " << POSITION_EPS; +// std::cout << ss.str() << std::endl; + std::cout << "myStartPos = " << myStartPos << std::endl; + std::cout << "myEndPos = " << myEndPos << std::endl; + std::cout << "myLastLane->getLength() = " << myLastLane->getLength() << std::endl; +#endif + + + assert((myStartPos >= POSITION_EPS || myStartPos == 0) && myStartPos < myFirstLane->getLength()); + assert(myEndPos >= POSITION_EPS || myEndPos == myLastLane->getLength()); + assert(myEndPos <= myLastLane->getLength() - POSITION_EPS || myEndPos == myLastLane->getLength()); + assert(myFirstLane != myLastLane || myEndPos - myStartPos > 0); +} + + +double +MSE2Collector::snap(double value, double snapPoint, double snapDist) { + if (fabs(value - snapPoint) < snapDist) { + return snapPoint; + } else { + return value; + } +} + + +void +MSE2Collector::recalculateDetectorLength() { + std::vector::const_iterator i; + std::vector lanes; + // get real lanes + for (i = myLanes.begin(); i != myLanes.end(); ++i) { + MSLane* lane = MSLane::dictionary(*i); + lanes.push_back(lane); + } + + // sum up their lengths + std::vector::const_iterator j; + MSLane* previous = 0; + myDetectorLength = 0; + for (j = lanes.begin(); j != lanes.end(); ++j) { + // lane length + myDetectorLength += (*j)->getLength(); + if (previous != 0 && !MSGlobals::gUsingInternalLanes) { + // eventually link length + myDetectorLength += previous->getLinkTo(*j)->getLength(); + } + previous = *j; + } + // substract uncovered area on first and last lane + myDetectorLength -= myStartPos; + myDetectorLength -= myLastLane->getLength() - myEndPos; + +#ifdef DEBUG_E2_CONSTRUCTOR + std::cout << "Total detector length after recalculation = " << myDetectorLength << std::endl; +#endif } MSE2Collector::~MSE2Collector() { - myKnownVehicles.clear(); + // clear move notifications + for (std::vector::iterator j = myMoveNotifications.begin(); j != myMoveNotifications.end(); ++j) { + delete *j; + } + myMoveNotifications.clear(); + + // clear vehicle infos + for (VehicleInfoMap::iterator j = myVehicleInfos.begin(); j != myVehicleInfos.end(); ++j) { + delete j->second; + } + myVehicleInfos.clear(); } -bool -MSE2Collector::notifyMove(SUMOVehicle& veh, SUMOReal oldPos, - SUMOReal newPos, SUMOReal newSpeed) { - if (newPos <= myStartPos) { - // detector not yet reached - return true; +std::vector +MSE2Collector::selectLanes(MSLane* lane, double length, std::string dir) { + // direction of detector extension + assert(dir == "fw" || dir == "bw"); + bool fw = dir == "fw"; + double linkLength = 0; // linkLength (used if no internal lanes are present) + bool substractedLinkLength = false; // whether linkLength was substracted during the last iteration. + +#ifdef DEBUG_E2_CONSTRUCTOR + std::cout << "\n" << "selectLanes()" << (fw ? "(forward)" : "(backward)") << std::endl; +#endif + std::vector lanes; + // Selected lanes are stacked into vector 'lanes'. If dir == "bw" lanes will be reversed after this is done. + // The length is reduced while adding lanes to the detector + // First we adjust the starting value for length (in the first iteration, the whole length of the first considered lane is substracted, + // while it might only be partially covered by the detector) + if (fw) { + assert(myStartPos != std::numeric_limits::max()); + length += myStartPos; + } else { + assert(myEndPos != std::numeric_limits::max()); + length += lane->getLength() - myEndPos; } + length = MAX2(POSITION_EPS, length); // this assures to add at least one lane to lanes + while (length >= POSITION_EPS && lane != 0) { + // Break loop for length <= NUMERICAL_EPS to avoid placement of very small + // detector piece on the end or beginning of one lane due to numerical rounding errors. + lanes.push_back(lane); +#ifdef DEBUG_E2_CONSTRUCTOR + std::cout << "Added lane " << lane->getID() + << " (length: " << lane->getLength() << ")" << std::endl; +#endif + length -= lane->getLength(); - const SUMOReal oldSpeed = veh.getPreviousSpeed(); - SUMOReal enterSpeed = MSGlobals::gSemiImplicitEulerUpdate ? newSpeed : oldSpeed; // NOTE: For the euler update, the vehicle is assumed to travel at constant speed for the whole time step - SUMOReal leaveSpeed = newSpeed; - - SUMOReal lengthOnDet = MIN2(veh.getVehicleType().getLength(), newPos - myStartPos); - if (newPos > myEndPos) { - lengthOnDet = MAX2(SUMOReal(0), lengthOnDet - (newPos - myEndPos)); - } - - SUMOReal timeOnDet = TS; - - // Treat the case that the vehicle entered the lane in the last step - if (newPos > myStartPos && oldPos <= myStartPos) { - // Vehicle was not on this lane in the last time step - const SUMOReal timeBeforeEnter = MSCFModel::passingTime(oldPos, myStartPos, newPos, oldSpeed, newSpeed); - timeOnDet -= timeBeforeEnter; - enterSpeed = MSCFModel::speedAfterTime(timeBeforeEnter, oldSpeed, newPos - oldPos); - myPassedVeh++; - } - - // Treat the case that the vehicle's back left the lane in the last step - const SUMOReal oldBackPos = oldPos - veh.getVehicleType().getLength(); - const SUMOReal newBackPos = newPos - veh.getVehicleType().getLength(); - if (newBackPos > myEndPos) { - assert(oldBackPos <= myEndPos); - const SUMOReal timeBeforeLeave = MSCFModel::passingTime(oldBackPos, myEndPos, newBackPos, oldSpeed, newSpeed); - const SUMOReal timeAfterLeave = TS - timeBeforeLeave; - timeOnDet -= timeAfterLeave; - leaveSpeed = MSCFModel::speedAfterTime(timeBeforeLeave, oldSpeed, newPos - oldPos); - // XXX: Do we really need this? Why would this "reduce rounding errors"? (Leo) Refs. #2579 - if (fabs(timeOnDet) < NUMERICAL_EPS) { // reduce rounding errors - timeOnDet = 0.; + // proceed to upstream predecessor + if (fw) { + lane = lane->getCanonicalSuccessorLane(); } else { - const SUMOReal averageSpeedOnDetector = (enterSpeed + leaveSpeed) / 2.; - myKnownVehicles.push_back(VehicleInfo(veh.getID(), veh.getVehicleType().getID(), averageSpeedOnDetector, - timeOnDet, lengthOnDet, newPos, - veh.getVehicleType().getLengthWithGap(), veh.getAcceleration(), false)); + lane = lane->getCanonicalPredecessorLane(); } - return false; + + + substractedLinkLength = false; + if (lane != 0 && !MSGlobals::gUsingInternalLanes && length > POSITION_EPS) { + // In case wher no internal lanes are used, + // take into account the link length for the detector range + linkLength = 0; + if (fw) { + linkLength = lanes.back()->getLinkTo(lane)->getLength(); + } else { + linkLength = lane->getLinkTo(lanes.back())->getLength(); + } + length -= linkLength; + substractedLinkLength = true; + } + + +#ifdef DEBUG_E2_CONSTRUCTOR + if (lane != 0) { + std::cout << (fw ? "Successor lane: " : "Predecessor lane: ") << "'" << lane->getID() << "'"; + } + std::cout << std::endl; +#endif } - const SUMOReal averageSpeedOnDetector = (enterSpeed + leaveSpeed) / 2.; - myKnownVehicles.push_back(VehicleInfo(veh.getID(), veh.getVehicleType().getID(), averageSpeedOnDetector, - timeOnDet, lengthOnDet, newPos, - veh.getVehicleType().getLengthWithGap(), veh.getAcceleration(), true)); - DBG( - std::ostringstream str; - str << time2string(MSNet::getInstance()->getCurrentTimeStep()) - << " MSE2Collector::notifyMove::" - << " lane " << myLane->getID() - << " passedVeh " << myPassedVeh; - WRITE_MESSAGE(str.str()); - ) - return true; + + if (substractedLinkLength) { + // if the link's length was substracted during the last step, + // the start/endPos would lie on a non-existing internal lane, + // therefore revert and truncate detector part on the non-existing internal lane. + length += linkLength; + } + + + // 1) At this point a negative means that not the whole last stored lane lanes[lanes.size()-1] + // should be added to the detector, but the detector should spare out a part with length = - + // If this part is too small (of length < POSITION_EPS) we take the whole lane + // 2) The whole lane is also taken for the case that is positive. This corresponds to on + // of three situations: i) < POSITION_EPS (break condition -> don't take too small pieces on the next lane) + // ii&iii) >= POS_EPSILON may arise either if no continuation lane was found (lane==0), or + // in case of not using internal lanes if the detector end/start falls on a link. + // In all cases we take the whole last lane. + if (fw) { + if (length > -POSITION_EPS) { + myEndPos = lanes[lanes.size() - 1]->getLength(); + } else if (length < 0) { + myEndPos = lanes[lanes.size() - 1]->getLength() + length; + } + } else { + if (length > -POSITION_EPS) { + myStartPos = 0; + } else if (length < 0) { + myStartPos = -length; + } + } + + // reverse lanes if lane selection was backwards + if (!fw) { + std::reverse(lanes.begin(), lanes.end()); + } + + return lanes; +} + +void +MSE2Collector::addDetectorToLanes(std::vector& lanes) { +#ifdef DEBUG_E2_CONSTRUCTOR + std::cout << "\n" << "Adding detector " << myID << " to lanes:" << std::endl; +#endif + for (std::vector::iterator l = lanes.begin(); l != lanes.end(); ++l) { + (*l)->addMoveReminder(this); +#ifdef DEBUG_E2_CONSTRUCTOR + std::cout << (*l)->getID() << std::endl; +#endif + } +} + +void +MSE2Collector::initAuxiliaries(std::vector& lanes) { + // Checks integrity of myLanes, adds internal-lane information, inits myLength, myFirstLane, myLastLane, myOffsets, myEndPos/myStartPos + myFirstLane = lanes[0]; + myLastLane = lanes[lanes.size() - 1]; + +#ifdef DEBUG_E2_CONSTRUCTOR + std::cout << "\n" << "Initializing auxiliaries:" + << "\nFirst lane: " << myFirstLane->getID() << " (startPos = " << myStartPos << ")" + << "\nLast lane: " << myLastLane->getID() << " (endPos = " << myEndPos << ")" + << std::endl; +#endif + + // Init myOffsets and myDetectorLength. + // The loop below runs through the given lanes assuming the possibility that only non-internal lanes are given + // or at least not all relevant internal lanes are considered. During this a new, complete list of lane ids is + // built into myLanes. + myLanes.clear(); + + // myDetectorLength will be increased in the loop below, always giving + // the offset of the currently considered lane to the detector start + myDetectorLength = -myStartPos; + myOffsets.clear(); + + // loop over detector lanes and accumulate offsets with respect to the first lane's begin + // (these will be corrected afterwards by substracting the start position.) + std::vector::iterator il = lanes.begin(); + + // start on an internal lane? + // (This may happen if specifying the detector by its upstream + // length starting from a given end position) + const MSLane* internal = (*il)->isInternal() ? *il : 0; + +#ifdef DEBUG_E2_CONSTRUCTOR + std::cout << "\n" << "Initializing offsets:" << std::endl; +#endif + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4127) // do not warn about constant conditional expression +#endif + while (true) { +#ifdef _MSC_VER +#pragma warning(pop) +#endif + // Consider the next internal lanes + while (internal != 0) { + myLanes.push_back(internal->getID()); + myOffsets.push_back(myDetectorLength); + +#ifdef DEBUG_E2_CONSTRUCTOR + std::cout << "Offset for lane " << internal->getID() << " = " << myDetectorLength + << std::endl; +#endif + + myDetectorLength += internal->getLength(); + if (internal->getID() == myLastLane->getID()) { + break; + } + + // There should be a unique continuation for each internal lane + assert(internal->getLinkCont().size() == 1); + + internal = internal->getLinkCont()[0]->getViaLaneOrLane(); + if (!internal->isInternal()) { + // passed the junction + internal = 0; + break; + } + } + + // Consider the next non-internal lane + // This is the first lane in the first iteration, if it is non-internal + // However, it can equal myLanes.end() if the myLastLane is internal. In that case we break. + + // Move il to next non-internal + while (il != lanes.end() && (*il)->isInternal()) { + il++; + } + if (il == lanes.end()) { + break; + } + + // There is still a non-internal lane to consider + MSLane* lane = *il; + myLanes.push_back(lane->getID()); + +#ifdef DEBUG_E2_CONSTRUCTOR + std::cout << "Offset for lane " << lane->getID() << " = " << myDetectorLength + << std::endl; +#endif + + // Offset to detector start for this lane + myOffsets.push_back(myDetectorLength); + + // Add the lanes length to the detector offset + myDetectorLength += lane->getLength(); + + // Get the next lane if this lane isn't the last one + if (++il == lanes.end()) { + break; + } + + if ((*il)->isInternal()) { + // next lane in myLanes is internal + internal = *il; + continue; + } + + // find the connection to next + const MSLink* link = lane->getLinkTo(*il); + assert(link != 0); + + if (!MSGlobals::gUsingInternalLanes) { + myDetectorLength += link->getLength(); + } else { + internal = link->getViaLane(); + } + } + + // Substract distance not covered on the last considered lane + bool fw = myEndPos == std::numeric_limits::max(); + if (fw) { + myDetectorLength -= myStartPos; + } else { + myDetectorLength -= myLastLane->getLength() - myEndPos; + } + +#ifdef DEBUG_E2_CONSTRUCTOR + std::cout << "Total detector length after initAuxiliaries() = " << myDetectorLength << std::endl; +#endif + + // make lanes a complete list including internal lanes + lanes = getLanes(); +} + + +std::vector +MSE2Collector::getLanes() { + std::vector res; + for (std::vector::const_iterator i = myLanes.begin(); i != myLanes.end(); ++i) { + res.push_back(MSLane::dictionary(*i)); + } + return res; } bool -MSE2Collector::notifyLeave(SUMOVehicle& /* veh */, SUMOReal /* lastPos */, MSMoveReminder::Notification reason) { - if (reason != MSMoveReminder::NOTIFICATION_JUNCTION) { +MSE2Collector::notifyMove(SUMOVehicle& veh, double oldPos, + double newPos, double newSpeed) { + VehicleInfoMap::iterator vi = myVehicleInfos.find(veh.getID()); + assert(vi != myVehicleInfos.end()); // all vehicles calling notifyMove() should have called notifyEnter() before + + const std::string& vehID = veh.getID(); + VehicleInfo& vehInfo = *(vi->second); + + // position relative to the detector start + double relPos = vehInfo.entryOffset + newPos; + + // update current distance to the detector end + vehInfo.distToDetectorEnd = myDetectorLength - relPos; + +#ifdef DEBUG_E2_NOTIFY_MOVE + std::cout << "\n" << SIMTIME + << " MSE2Collector::notifyMove()" + << " called by vehicle '" << vehID << "'" + << " at relative position " << relPos + << ", distToDetectorEnd = " << vehInfo.distToDetectorEnd << std::endl; +#endif + + // Check whether vehicle has reached the detector begin + if (relPos <= 0) { + // detector not yet reached, request being informed further +#ifdef DEBUG_E2_NOTIFY_MOVE + std::cout << "Vehicle has not yet reached the detector start position." << std::endl; +#endif + return true; + } else if (!vehInfo.hasEntered) { + vehInfo.hasEntered = true; + myNumberOfEnteredVehicles++; + } + + myMoveNotifications.push_back(makeMoveNotification(veh, oldPos, newPos, newSpeed, vehInfo)); + + // determine whether vehicle has moved beyond the detector's end + bool vehPassedDetectorEnd = relPos - veh.getVehicleType().getLength() >= vehInfo.exitOffset; + + if (vehPassedDetectorEnd) { +#ifdef DEBUG_E2_NOTIFY_MOVE + std::cout << "Vehicle has left the detector along a junction." << std::endl; +#endif + // Vehicle is beyond the detector, unsubscribe and register removal from myVehicleInfos + myLeftVehicles.insert(vehID); + return false; + } else { + // Receive further notifications + return true; + } +} + +bool +MSE2Collector::notifyLeave(SUMOVehicle& veh, double /* lastPos */, MSMoveReminder::Notification reason, const MSLane* enteredLane) { +#ifdef DEBUG_E2_NOTIFY_ENTER_AND_LEAVE + std::cout << "\n" << SIMTIME << " notifyLeave() called by vehicle '" << veh.getID() << "'" << std::endl; +#endif + + if (reason == MSMoveReminder::NOTIFICATION_JUNCTION) { + // vehicle left lane via junction, unsubscription and registering in myLeftVehicles when + // moving beyond the detector end is controlled in notifyMove. +#ifdef DEBUG_E2_NOTIFY_ENTER_AND_LEAVE + std::cout << SIMTIME << " Left longitudinally (along junction) -> keep subscription [handle exit in notifyMove()]" << std::endl; +#endif + + if (std::find(myLanes.begin(), myLanes.end(), enteredLane->getID()) == myLanes.end()) { + // Entered lane is not part of the detector + VehicleInfoMap::iterator vi = myVehicleInfos.find(veh.getID()); + // Determine exit offset, where vehicle left the detector + double exitOffset = myOffsets[vi->second->currentOffsetIndex] + vi->second->currentLane->getLength(); + vi->second->exitOffset = MIN2(vi->second->exitOffset, exitOffset); +#ifdef DEBUG_E2_NOTIFY_ENTER_AND_LEAVE + std::cout << SIMTIME << " Vehicle '" << veh.getID() << "' leaves the detector. Exit offset = " << exitOffset << std::endl; +#endif + } + + return true; + } else { + VehicleInfoMap::iterator vi = myVehicleInfos.find(veh.getID()); + // erase vehicle, which leaves in a non-longitudinal way, immediately + delete vi->second; + myVehicleInfos.erase(vi); + myNumberOfLeftVehicles++; +#ifdef DEBUG_E2_NOTIFY_ENTER_AND_LEAVE + std::cout << SIMTIME << " Left non-longitudinally (lanechange, teleport, parking, etc) -> discard subscription" << std::endl; +#endif return false; } - return true; } bool -MSE2Collector::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification /* reason */) { +MSE2Collector::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification /* reason */, const MSLane* enteredLane) { +#ifdef DEBUG_E2_NOTIFY_ENTER_AND_LEAVE + std::cout << "\n" << SIMTIME << " notifyEnter() called by vehicle '" << veh.getID() + << "' entering lane '" << (enteredLane != 0 ? enteredLane->getID() : "NULL") << "'" << std::endl; +#endif + + // notifyEnter() should only be called for lanes of the detector + assert(std::find(myLanes.begin(), myLanes.end(), enteredLane->getID()) != myLanes.end()); + + assert(veh.getLane() == enteredLane); + if (!vehicleApplies(veh)) { + // That's not my type... return false; } +#ifdef DEBUG_E2_NOTIFY_ENTER_AND_LEAVE if (!veh.isOnRoad()) { - // vehicle is teleporting over the edge - return false; + // Vehicle is teleporting over the edge + std::cout << "Vehicle is off road (teleporting over edge)..." << std::endl; } - // is vehicle beyond detector? - return veh.getBackPositionOnLane(myLane) < myEndPos; -} +#endif + const std::string& vehID = veh.getID(); + VehicleInfoMap::iterator vi = myVehicleInfos.find(vehID); + if (vi != myVehicleInfos.end()) { + // Register move current offset to the next lane + vi->second->currentOffsetIndex++; + vi->second->currentLane = enteredLane; + +#ifdef DEBUG_E2_NOTIFY_ENTER_AND_LEAVE + std::cout << SIMTIME << " Vehicle '" << veh.getID() << "' on lane '" << veh.getLane()->getID() + << "' already known. No new VehicleInfo is created.\n" + << "enteredLane = " << enteredLane->getID() << "\nmyLanes[vi->offset] = " << myLanes[vi->second->currentOffsetIndex] + << std::endl; +#endif + assert(myLanes[vi->second->currentOffsetIndex] == enteredLane->getID()); -void -MSE2Collector::reset() { - mySpeedSum = 0; - myStartedHalts = 0; - myJamLengthInMetersSum = 0; - myJamLengthInVehiclesSum = 0; - myVehicleSamples = 0; - myOccupancySum = 0; - myMaxOccupancy = 0; - myMeanMaxJamInVehicles = 0; - myMeanMaxJamInMeters = 0; - myMaxJamInVehicles = 0; - myMaxJamInMeters = 0; - myTimeSamples = 0; - myMeanVehicleNumber = 0; - myMaxVehicleNumber = 0; - for (std::map::iterator i = myIntervalHaltingVehicleDurations.begin(); i != myIntervalHaltingVehicleDurations.end(); ++i) { - (*i).second = 0; + // but don't add a second subscription for another lane + return false; } - myPastStandingDurations.clear(); - myPastIntervalStandingDurations.clear(); - myPassedVeh = 0; -} +#ifdef DEBUG_E2_NOTIFY_ENTER_AND_LEAVE + std::cout << SIMTIME << " Adding VehicleInfo for vehicle '" << veh.getID() << "'." << std::endl; +#endif + + // Add vehicle info + myVehicleInfos.insert(std::make_pair(vehID, makeVehicleInfo(veh, enteredLane))); + // Subscribe to vehicle's movement notifications + return true; +} +MSE2Collector::VehicleInfo* +MSE2Collector::makeVehicleInfo(const SUMOVehicle& veh, const MSLane* enteredLane) const { + // The vehicle's distance to the detector end + std::size_t j = std::find(myLanes.begin(), myLanes.end(), enteredLane->getID()) - myLanes.begin(); + assert(j >= 0 && j < myLanes.size()); + double entryOffset = myOffsets[j]; + double distToDetectorEnd = myDetectorLength - (entryOffset + veh.getPositionOnLane()); + bool onDetector = -entryOffset < veh.getPositionOnLane() && distToDetectorEnd > -veh.getVehicleType().getLength(); + +#ifdef DEBUG_E2_MAKE_VEHINFO + std::cout << SIMTIME << " Making VehicleInfo for vehicle '" << veh.getID() << "'." + << "\ndistToDetectorEnd = " << distToDetectorEnd + << "\nveh.getPositionOnLane() = " << veh.getPositionOnLane() + << "\nentry lane offset (lane begin from detector begin) = " << entryOffset + << std::endl; +#endif + return new VehicleInfo(veh.getID(), veh.getVehicleType().getID(), veh.getVehicleType().getLength(), veh.getVehicleType().getMinGap(), enteredLane, entryOffset, j, myDetectorLength, distToDetectorEnd, onDetector); +} void MSE2Collector::detectorUpdate(const SUMOTime /* step */) { - JamInfo* currentJam = 0; - std::map haltingVehicles; - std::map intervalHaltingVehicles; - std::vector jams; - SUMOReal lengthSum = 0; +#ifdef DEBUG_E2_DETECTOR_UPDATE + std::cout << "\n" << SIMTIME << " detectorUpdate() for detector '" << myID << "'" + << "\nmyCurrentMeanSpeed = " << myCurrentMeanSpeed + << "\nmyCurrentMeanLength = " << myCurrentMeanLength + << "\nmyNumberOfEnteredVehicles = " << myNumberOfEnteredVehicles + << std::endl; +#endif + + // sort myMoveNotifications (required for jam processing) ascendingly according to vehicle's distance to the detector end + // (min = myMoveNotifications[0].distToDetectorEnd) + std::sort(myMoveNotifications.begin(), myMoveNotifications.end(), compareMoveNotification); + + // reset values concerning current time step (these are updated in integrateMoveNotification() and aggregateOutputValues()) myCurrentMeanSpeed = 0; myCurrentMeanLength = 0; myCurrentStartedHalts = 0; myCurrentHaltingsNumber = 0; - // go through the (sorted) list of vehicles positioned on the detector - // sum up values and prepare the list of jams - const int numVehicles = (int)myKnownVehicles.size(); - for (std::vector::const_iterator i = myKnownVehicles.begin(); i != myKnownVehicles.end(); ++i) { - myVehicleSamples += i->timeOnDet; - mySpeedSum += i->speed * i->timeOnDet; - myCurrentMeanSpeed += i->speed * i->timeOnDet; - lengthSum += i->lengthOnDet; - myCurrentMeanLength += i->lengthOnDet; - - // jam-checking begins - bool isInJam = false; - // first, check whether the vehicle is slow enough to be states as halting - if (i->speed < myJamHaltingSpeedThreshold) { - myCurrentHaltingsNumber++; - // we have to track the time it was halting; - // so let's look up whether it was halting before and compute the overall halting time - bool wasHalting = myHaltingVehicleDurations.count(i->id) > 0; - if (wasHalting) { - haltingVehicles[i->id] = myHaltingVehicleDurations[i->id] + DELTA_T; - intervalHaltingVehicles[i->id] = myIntervalHaltingVehicleDurations[i->id] + DELTA_T; - } else { - haltingVehicles[i->id] = DELTA_T; - intervalHaltingVehicles[i->id] = DELTA_T; - myCurrentStartedHalts++; - myStartedHalts++; - } - // we now check whether the halting time is large enough - if (haltingVehicles[i->id] > myJamHaltingTimeThreshold) { - // yep --> the vehicle is a part of a jam - isInJam = true; - } + JamInfo* currentJam = 0; + std::vector jams; + std::map haltingVehicles; + std::map intervalHaltingVehicles; + + // go through the list of vehicles positioned on the detector + for (std::vector::iterator i = myMoveNotifications.begin(); i != myMoveNotifications.end(); ++i) { + // The ID of the vehicle that has sent this notification in the last step + const std::string& vehID = (*i)->id; + VehicleInfoMap::iterator vi = myVehicleInfos.find(vehID); + + if (vi == myVehicleInfos.end()) { + // The vehicle has already left the detector by lanechange, teleport, etc. (not longitudinal) + integrateMoveNotification(0, *i); } else { - // is not standing anymore; keep duration information - std::map::iterator v = myHaltingVehicleDurations.find(i->id); - if (v != myHaltingVehicleDurations.end()) { - myPastStandingDurations.push_back((*v).second); - myHaltingVehicleDurations.erase(v); - } - v = myIntervalHaltingVehicleDurations.find(i->id); - if (v != myIntervalHaltingVehicleDurations.end()) { - myPastIntervalStandingDurations.push_back((*v).second); - myIntervalHaltingVehicleDurations.erase(v); - } + // Add move notification infos to detector values and VehicleInfo + integrateMoveNotification(vi->second, *i); } + // construct jam structure + bool isInJam = checkJam(i, haltingVehicles, intervalHaltingVehicles); + buildJam(isInJam, i, currentJam, jams); + } - // jam-building - if (isInJam) { - // the vehicle is in a jam; - // it may be a new one or already an existing one - if (currentJam == 0) { - // the vehicle is the first vehicle in a jam - currentJam = new JamInfo(); - currentJam->firstStandingVehicle = i; - } else { - // ok, we have a jam already. But - maybe it is too far away - // ... honestly, I can hardly find a reason for doing this, - // but jams were defined this way in an earlier version... - if (i->position - currentJam->lastStandingVehicle->position > myJamDistanceThreshold) { - // yep, yep, yep - it's a new one... - // close the frist, build a new - jams.push_back(currentJam); - currentJam = new JamInfo(); - currentJam->firstStandingVehicle = i; - } - } - currentJam->lastStandingVehicle = i; + // extract some aggregated values from the jam structure + processJams(jams, currentJam); + + // Aggregate and normalize values for the detector output + aggregateOutputValues(); + + // save information about halting vehicles + myHaltingVehicleDurations = haltingVehicles; + myIntervalHaltingVehicleDurations = intervalHaltingVehicles; + +#ifdef DEBUG_E2_DETECTOR_UPDATE + std::cout << "\n" << SIMTIME << " Current lanes for vehicles still on the detector:" << std::endl; +#endif + // update current and entered lanes for remaining vehicles + VehicleInfoMap::iterator iv; + for (iv = myVehicleInfos.begin(); iv != myVehicleInfos.end(); ++iv) { +#ifdef DEBUG_E2_DETECTOR_UPDATE + std::cout << " Vehicle '" << iv->second->id << "'" << ": '" + << iv->second->currentLane->getID() << "'" + << std::endl; +#endif + } + +#ifdef DEBUG_E2_DETECTOR_UPDATE + std::cout << SIMTIME << " Discarding vehicles that have left the detector:" << std::endl; +#endif + // Remove the vehicles that have left the detector + std::set::const_iterator i; + for (i = myLeftVehicles.begin(); i != myLeftVehicles.end(); ++i) { + VehicleInfoMap::iterator j = myVehicleInfos.find(*i); + delete j->second; + myVehicleInfos.erase(*i); + myNumberOfLeftVehicles++; +#ifdef DEBUG_E2_DETECTOR_UPDATE + std::cout << "Erased vehicle '" << *i << "'" << std::endl; +#endif + } + myLeftVehicles.clear(); + + // reset move notifications + for (std::vector::iterator j = myMoveNotifications.begin(); j != myMoveNotifications.end(); ++j) { + delete *j; + } + myMoveNotifications.clear(); +} + + +void +MSE2Collector::aggregateOutputValues() { + myTimeSamples += 1; + // compute occupancy values (note myCurrentMeanLength is still not normalized here, but holds the sum of all vehicle lengths) + const double currentOccupancy = myCurrentMeanLength / myDetectorLength * (double) 100.; + myCurrentOccupancy = currentOccupancy; + myOccupancySum += currentOccupancy; + myMaxOccupancy = MAX2(myMaxOccupancy, currentOccupancy); + // compute jam values + myMeanMaxJamInVehicles += myCurrentMaxJamLengthInVehicles; + myMeanMaxJamInMeters += myCurrentMaxJamLengthInMeters; + myMaxJamInVehicles = MAX2(myMaxJamInVehicles, myCurrentMaxJamLengthInVehicles); + myMaxJamInMeters = MAX2(myMaxJamInMeters, myCurrentMaxJamLengthInMeters); + // compute information about vehicle numbers + const int numVehicles = (int)myMoveNotifications.size(); + myMeanVehicleNumber += numVehicles; + myMaxVehicleNumber = MAX2(numVehicles, myMaxVehicleNumber); + // norm current values + myCurrentMeanSpeed = numVehicles != 0 ? myCurrentMeanSpeed / (double) numVehicles : -1; + myCurrentMeanLength = numVehicles != 0 ? myCurrentMeanLength / (double) numVehicles : -1; +} + + + +void +MSE2Collector::integrateMoveNotification(VehicleInfo* vi, const MoveNotificationInfo* mni) { + +#ifdef DEBUG_E2_DETECTOR_UPDATE + std::cout << SIMTIME << " integrateMoveNotification() for vehicle '" << mni->id << "'" + << "\ntimeOnDetector = " << mni->timeOnDetector + << "\nlengthOnDetector = " << mni->lengthOnDetector + << "\ntimeLoss = " << mni->timeLoss + << "\nspeed = " << mni->speed + << std::endl; +#endif + + // Accumulate detector values + myVehicleSamples += mni->timeOnDetector; + myTotalTimeLoss += mni->timeLoss; + mySpeedSum += mni->speed * mni->timeOnDetector; + myCurrentMeanSpeed += mni->speed * mni->timeOnDetector; + myCurrentMeanLength += mni->lengthOnDetector; + + if (vi != 0) { + // Accumulate individual values for the vehicle. + // @note vi==0 occurs, if the vehicle info has been erased at + // notifyLeave() in case of a non-longitudinal exit (lanechange, teleport, etc.) + vi->totalTimeOnDetector += mni->timeOnDetector; + vi->accumulatedTimeLoss += mni->timeLoss; + vi->lastAccel = mni->accel; + vi->lastSpeed = mni->speed; + vi->lastPos = myStartPos + vi->entryOffset + mni->newPos; + vi->onDetector = mni->onDetector; + } +} + + + +MSE2Collector::MoveNotificationInfo* +MSE2Collector::makeMoveNotification(const SUMOVehicle& veh, double oldPos, double newPos, double newSpeed, const VehicleInfo& vehInfo) const { +#ifdef DEBUG_E2_NOTIFY_MOVE + std::cout << SIMTIME << " makeMoveNotification() for vehicle '" << veh.getID() << "'" + << " oldPos = " << oldPos << " newPos = " << newPos << " newSpeed = " << newSpeed + << std::endl; +#endif + + // Timefraction in [0,TS] the vehicle has spend on the detector in the last step + double timeOnDetector; + // Note that at this point, vehInfo.currentLane points to the lane at the beginning of the last timestep, + // and vehInfo.enteredLanes is a list of lanes entered in the last timestep + double timeLoss; + calculateTimeLossAndTimeOnDetector(veh, oldPos, newPos, vehInfo, timeOnDetector, timeLoss); + + // The length of the part of the vehicle on the detector at the end of the last time step + // may be shorter than vehicle's length if its back reaches out + double lengthOnDetector = MAX2(MIN2(vehInfo.length, newPos + vehInfo.entryOffset), 0.); + + // XXX: Fulfulling the specifications of the documentation (lengthOnDetector = time integral + // over length of the vehicle's part on the detector) would be much more cumbersome. + double distToExit = vehInfo.exitOffset - vehInfo.entryOffset - newPos; + // Eventually decrease further to account for the front reaching out + lengthOnDetector = MAX2(0., lengthOnDetector + MIN2(0., distToExit)); + + // whether the vehicle is still on the detector at the end of the time step + bool stillOnDetector = -distToExit < vehInfo.length; + +#ifdef DEBUG_E2_NOTIFY_MOVE + std::cout << SIMTIME << " lengthOnDetector = " << lengthOnDetector + << "\nvehInfo.exitOffset = " << vehInfo.exitOffset + << " vehInfo.entryOffset = " << vehInfo.entryOffset + << " distToExit = " << distToExit + << std::endl; +#endif + + /* Store new infos */ + return new MoveNotificationInfo(veh.getID(), oldPos, newPos, newSpeed, veh.getAcceleration(), myDetectorLength - (vehInfo.entryOffset + newPos), timeOnDetector, lengthOnDetector, timeLoss, stillOnDetector); +} + +void +MSE2Collector::buildJam(bool isInJam, std::vector::const_iterator mni, JamInfo*& currentJam, std::vector& jams) { +#ifdef DEBUG_E2_JAMS + std::cout << SIMTIME << " buildJam() for vehicle '" << (*mni)->id << "'" << std::endl; +#endif + if (isInJam) { + // The vehicle is in a jam; + // it may be a new one or already an existing one + if (currentJam == 0) { +#ifdef DEBUG_E2_JAMS + std::cout << SIMTIME << " vehicle '" << (*mni)->id << "' forms the start of the first jam" << std::endl; +#endif + // the vehicle is the first vehicle in a jam + currentJam = new JamInfo(); + currentJam->firstStandingVehicle = mni; } else { - // the vehicle is not part of a jam... - // maybe we have to close an already computed jam - if (currentJam != 0) { + // ok, we have a jam already. But - maybe it is too far away + // ... honestly, I can hardly find a reason for doing this, + // but jams were defined this way in an earlier version... + MoveNotificationInfo* lastVeh = *currentJam->lastStandingVehicle; + MoveNotificationInfo* currVeh = *mni; + if (lastVeh->distToDetectorEnd - currVeh->distToDetectorEnd > myJamDistanceThreshold) { +#ifdef DEBUG_E2_JAMS + std::cout << SIMTIME << " vehicle '" << (*mni)->id << "' forms the start of a new jam" << std::endl; +#endif + // yep, yep, yep - it's a new one... + // close the frist, build a new jams.push_back(currentJam); - currentJam = 0; + currentJam = new JamInfo(); + currentJam->firstStandingVehicle = mni; } } + currentJam->lastStandingVehicle = mni; + } else { + // the vehicle is not part of a jam... + // maybe we have to close an already computed jam + if (currentJam != 0) { +#ifdef DEBUG_E2_JAMS + std::cout << SIMTIME << " Closing current jam." << std::endl; +#endif + jams.push_back(currentJam); + currentJam = 0; + } } +} + + +bool +MSE2Collector::checkJam(std::vector::const_iterator mni, std::map& haltingVehicles, std::map& intervalHaltingVehicles) { +#ifdef DEBUG_E2_JAMS + std::cout << SIMTIME << " CheckJam() for vehicle '" << (*mni)->id << "'" << std::endl; +#endif + // jam-checking begins + bool isInJam = false; + // first, check whether the vehicle is slow enough to be counted as halting + if ((*mni)->speed < myJamHaltingSpeedThreshold) { + myCurrentHaltingsNumber++; + // we have to track the time it was halting; + // so let's look up whether it was halting before and compute the overall halting time + bool wasHalting = myHaltingVehicleDurations.count((*mni)->id) > 0; + if (wasHalting) { + haltingVehicles[(*mni)->id] = myHaltingVehicleDurations[(*mni)->id] + DELTA_T; + intervalHaltingVehicles[(*mni)->id] = myIntervalHaltingVehicleDurations[(*mni)->id] + DELTA_T; + } else { +#ifdef DEBUG_E2_JAMS + std::cout << SIMTIME << " vehicle '" << (*mni)->id << "' starts halting." << std::endl; +#endif + haltingVehicles[(*mni)->id] = DELTA_T; + intervalHaltingVehicles[(*mni)->id] = DELTA_T; + myCurrentStartedHalts++; + myStartedHalts++; + } + // we now check whether the halting time is large enough + if (haltingVehicles[(*mni)->id] > myJamHaltingTimeThreshold) { + // yep --> the vehicle is a part of a jam + isInJam = true; + } + } else { + // is not standing anymore; keep duration information + std::map::iterator v = myHaltingVehicleDurations.find((*mni)->id); + if (v != myHaltingVehicleDurations.end()) { + myPastStandingDurations.push_back(v->second); + myHaltingVehicleDurations.erase(v); + } + v = myIntervalHaltingVehicleDurations.find((*mni)->id); + if (v != myIntervalHaltingVehicleDurations.end()) { + myPastIntervalStandingDurations.push_back((*v).second); + myIntervalHaltingVehicleDurations.erase(v); + } + } +#ifdef DEBUG_E2_JAMS + std::cout << SIMTIME << " vehicle '" << (*mni)->id << "'" << (isInJam ? "is jammed." : "is not jammed.") << std::endl; +#endif + return isInJam; +} + + +void +MSE2Collector::processJams(std::vector& jams, JamInfo* currentJam) { + // push last jam if (currentJam != 0) { jams.push_back(currentJam); currentJam = 0; } +#ifdef DEBUG_E2_JAMS + std::cout << "\n" << SIMTIME << " processJams()" + << "\nNumber of jams: " << jams.size() << std::endl; +#endif + + // process jam information myCurrentMaxJamLengthInMeters = 0; myCurrentMaxJamLengthInVehicles = 0; myCurrentJamLengthInMeters = 0; myCurrentJamLengthInVehicles = 0; - // process jam information - for (std::vector::iterator i = jams.begin(); i != jams.end(); ++i) { + for (std::vector::const_iterator i = jams.begin(); i != jams.end(); ++i) { // compute current jam's values - const SUMOReal jamLengthInMeters = (*i)->firstStandingVehicle->position - - (*i)->lastStandingVehicle->position - + (*i)->lastStandingVehicle->lengthOnDet; - const int jamLengthInVehicles = (int)distance((*i)->firstStandingVehicle, (*i)->lastStandingVehicle) + 1; + MoveNotificationInfo* lastVeh = *((*i)->lastStandingVehicle); + MoveNotificationInfo* firstVeh = *((*i)->firstStandingVehicle); + const double jamLengthInMeters = lastVeh->distToDetectorEnd + - firstVeh->distToDetectorEnd + + lastVeh->lengthOnDetector; + const int jamLengthInVehicles = (int) distance((*i)->firstStandingVehicle, (*i)->lastStandingVehicle) + 1; // apply them to the statistics myCurrentMaxJamLengthInMeters = MAX2(myCurrentMaxJamLengthInMeters, jamLengthInMeters); myCurrentMaxJamLengthInVehicles = MAX2(myCurrentMaxJamLengthInVehicles, jamLengthInVehicles); @@ -329,49 +1045,94 @@ myJamLengthInVehiclesSum += jamLengthInVehicles; myCurrentJamLengthInMeters += jamLengthInMeters; myCurrentJamLengthInVehicles += jamLengthInVehicles; +#ifdef DEBUG_E2_JAMS + std::cout << SIMTIME << " processing jam nr." << ((int) distance((std::vector::const_iterator) jams.begin(), i) + 1) + << "\njamLengthInMeters = " << jamLengthInMeters + << " jamLengthInVehicles = " << jamLengthInVehicles + << std::endl; +#endif } myCurrentJamNo = (int) jams.size(); - myTimeSamples += 1; - // compute occupancy values - SUMOReal currentOccupancy = lengthSum / (myEndPos - myStartPos) * (SUMOReal) 100.; - myCurrentOccupancy = currentOccupancy; - myOccupancySum += currentOccupancy; - myMaxOccupancy = MAX2(myMaxOccupancy, currentOccupancy); - // compute jam values - myMeanMaxJamInVehicles += myCurrentMaxJamLengthInVehicles; - myMeanMaxJamInMeters += myCurrentMaxJamLengthInMeters; - myMaxJamInVehicles = MAX2(myMaxJamInVehicles, myCurrentMaxJamLengthInVehicles); - myMaxJamInMeters = MAX2(myMaxJamInMeters, myCurrentMaxJamLengthInMeters); - // save information about halting vehicles - myHaltingVehicleDurations = haltingVehicles; - myIntervalHaltingVehicleDurations = intervalHaltingVehicles; - // compute information about vehicle numbers - myMeanVehicleNumber += numVehicles; - myMaxVehicleNumber = MAX2(numVehicles, myMaxVehicleNumber); - // norm current values - myCurrentMeanSpeed = numVehicles != 0 ? myCurrentMeanSpeed / (SUMOReal) numVehicles : -1; - myCurrentMeanLength = numVehicles != 0 ? myCurrentMeanLength / (SUMOReal) numVehicles : -1; - - // clean up + // clean up jam structure for (std::vector::iterator i = jams.begin(); i != jams.end(); ++i) { delete *i; } - myPreviousKnownVehicles = myKnownVehicles; - myKnownVehicles.clear(); +} + +void +MSE2Collector::calculateTimeLossAndTimeOnDetector(const SUMOVehicle& veh, double oldPos, double newPos, const VehicleInfo& vi, double& timeOnDetector, double& timeLoss) const { + assert(veh.getID() == vi.id); + assert(newPos + vi.entryOffset >= 0); + + if (oldPos == newPos) { + // vehicle is stopped + timeLoss = TS; + timeOnDetector = TS; + return; + } + + // Eventual positional offset of the detector start from the lane's start + double entryPos = MAX2(-vi.entryOffset, 0.); + // Time of this vehicle entering the detector in the last time step + double entryTime = 0; + // Take into account the time before entering the detector, if there is. + if (oldPos < entryPos) { + // Vehicle entered the detector in the last step, either traversing the detector start or somewhere in the middle. + entryTime = MSCFModel::passingTime(oldPos, entryPos, newPos, veh.getPreviousSpeed(), veh.getSpeed()); + } + // speed at detector entry + double entrySpeed = MSCFModel::speedAfterTime(entryTime, veh.getPreviousSpeed(), newPos - oldPos); + // Calculate time spent on detector until reaching newPos or a detector exit + double exitPos = MIN2(newPos, vi.exitOffset + vi.length - vi.entryOffset); + assert(entryPos < exitPos); + + // calculate vehicle's time spent on the detector + double exitTime; + if (exitPos == newPos) { + exitTime = TS; + } else { + exitTime = MSCFModel::passingTime(oldPos, exitPos, newPos, veh.getPreviousSpeed(), veh.getSpeed()); + } + + // Vehicle's Speed when leaving the detector + double exitSpeed = MSCFModel::speedAfterTime(exitTime, veh.getPreviousSpeed(), newPos - oldPos); + + // Maximal speed on vehicle's current lane (== lane before last time step) + // Note: this disregards the possibility of different maximal speeds on different traversed lanes. + // (we accept this as discretization error) + double vmax = MAX2(veh.getLane()->getVehicleMaxSpeed(&veh), NUMERICAL_EPS); + + // Time loss suffered on the detector + timeOnDetector = exitTime - entryTime; + timeLoss = MAX2(0., timeOnDetector * (vmax - (entrySpeed + exitSpeed) / 2) / vmax); + +#ifdef DEBUG_E2_TIME_ON_DETECTOR + std::cout << SIMTIME << " calculateTimeLoss() for vehicle '" << veh.getID() << "'" + << " oldPos = " << oldPos << " newPos = " << newPos + << " entryPos = " << entryPos << " exitPos = " << exitPos + << " timeOnDetector = " << timeOnDetector + << " timeLoss = " << timeLoss + << std::endl; +#endif } +void +MSE2Collector::writeXMLDetectorProlog(OutputDevice& dev) const { + dev.writeXMLHeader("detector", "det_e2_file.xsd"); +} void MSE2Collector::writeXMLOutput(OutputDevice& dev, SUMOTime startTime, SUMOTime stopTime) { dev << " ::iterator i = myHaltingVehicleDurations.begin(); i != myHaltingVehicleDurations.end(); ++i) { + for (std::map ::iterator i = myHaltingVehicleDurations.begin(); i != myHaltingVehicleDurations.end(); ++i) { haltingDurationSum += (*i).second; maxHaltingDuration = MAX2(maxHaltingDuration, (*i).second); haltingNo++; @@ -396,16 +1157,30 @@ intervalMaxHaltingDuration = MAX2(intervalMaxHaltingDuration, (*i)); intervalHaltingNo++; } - for (std::map ::iterator i = myIntervalHaltingVehicleDurations.begin(); i != myIntervalHaltingVehicleDurations.end(); ++i) { + for (std::map ::iterator i = myIntervalHaltingVehicleDurations.begin(); i != myIntervalHaltingVehicleDurations.end(); ++i) { intervalHaltingDurationSum += (*i).second; intervalMaxHaltingDuration = MAX2(intervalMaxHaltingDuration, (*i).second); intervalHaltingNo++; } const SUMOTime intervalMeanHaltingDuration = intervalHaltingNo != 0 ? intervalHaltingDurationSum / intervalHaltingNo : 0; +#ifdef DEBUG_E2_XML_OUT + std::stringstream ss; + ss << "sampledSeconds=\"" << myVehicleSamples << "\" " + << "myTimeSamples=\"" << myTimeSamples << "\" " + << "myOccupancySum=\"" << myOccupancySum << "\" " + << "myMeanVehicleNumber=\"" << myMeanVehicleNumber << "\" " + << "nVehEntered=\"" << myNumberOfEnteredVehicles << "\" " + << "meanSpeed=\"" << meanSpeed << "\""; + std::cout << ss.str() << std::endl; +#endif + + dev << "sampledSeconds=\"" << myVehicleSamples << "\" " - << "nVehEntered=\"" << myPassedVeh << "\" " + << "nVehEntered=\"" << myNumberOfEnteredVehicles << "\" " +// << "nVehLeft=\"" << myNumberOfLeftVehicles << "\" " << "meanSpeed=\"" << meanSpeed << "\" " + << "meanTimeLoss=\"" << meanTimeLoss << "\" " << "meanOccupancy=\"" << meanOccupancy << "\" " << "maxOccupancy=\"" << myMaxOccupancy << "\" " << "meanMaxJamLengthInVehicles=\"" << meanJamLengthInVehicles << "\" " @@ -425,43 +1200,94 @@ << "maxVehicleNumber=\"" << myMaxVehicleNumber << "\" " << "/>\n"; reset(); -} +} void -MSE2Collector::writeXMLDetectorProlog(OutputDevice& dev) const { - dev.writeXMLHeader("detector", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/det_e2_file.xsd\""); +MSE2Collector::reset() { + myVehicleSamples = 0; + myTotalTimeLoss = 0.; + myNumberOfEnteredVehicles = 0; + myNumberOfLeftVehicles = 0; + myMaxVehicleNumber = 0; + + mySpeedSum = 0; + myStartedHalts = 0; + myJamLengthInMetersSum = 0; + myJamLengthInVehiclesSum = 0; + myOccupancySum = 0; + myMaxOccupancy = 0; + myMeanMaxJamInVehicles = 0; + myMeanMaxJamInMeters = 0; + myMaxJamInVehicles = 0; + myMaxJamInMeters = 0; + myTimeSamples = 0; + myMeanVehicleNumber = 0; + for (std::map::iterator i = myIntervalHaltingVehicleDurations.begin(); i != myIntervalHaltingVehicleDurations.end(); ++i) { + (*i).second = 0; + } + myPastStandingDurations.clear(); + myPastIntervalStandingDurations.clear(); } int MSE2Collector::getCurrentVehicleNumber() const { int result = 0; - for (std::vector::const_iterator it = myPreviousKnownVehicles.begin(); - it != myPreviousKnownVehicles.end(); it++) { - if (it->stillOnDet) { + for (VehicleInfoMap::const_iterator it = myVehicleInfos.begin(); it != myVehicleInfos.end(); it++) { + if (it->second->onDetector) { result++; } } return result; } + + +std::vector +MSE2Collector::getCurrentVehicleIDs() const { + std::vector ret; + for (VehicleInfoMap::const_iterator i = myVehicleInfos.begin(); i != myVehicleInfos.end(); ++i) { + if (i->second->onDetector) { + ret.push_back(i->second->id); + } + } + std::sort(ret.begin(), ret.end()); + return ret; +} + + +std::vector +MSE2Collector::getCurrentVehicles() const { + std::vector res; + VehicleInfoMap::const_iterator i; + for (i = myVehicleInfos.begin(); i != myVehicleInfos.end(); ++i) { + if (i->second->onDetector) { + res.push_back(i->second); + } + } + return res; +} + + + int -MSE2Collector::getEstimatedCurrentVehicleNumber(SUMOReal speedThreshold) const { +MSE2Collector::getEstimatedCurrentVehicleNumber(double speedThreshold) const { - SUMOReal distance = std::numeric_limits::max(); - SUMOReal thresholdSpeed = myLane->getSpeedLimit() / speedThreshold; +// double distance = std::numeric_limits::max(); + double thresholdSpeed = myLane->getSpeedLimit() / speedThreshold; int count = 0; - for (std::vector::const_iterator it = myPreviousKnownVehicles.begin(); - it != myKnownVehicles.end(); it++) { - if (it->stillOnDet) { - if (it->position < distance) { - distance = it->position; - } - const SUMOReal realDistance = myLane->getLength() - distance; // the closer vehicle get to the light the greater is the distance - if (it->speed <= thresholdSpeed || it->accel > 0) { //TODO speed less than half of the maximum speed for the lane NEED TUNING - count = (int)(realDistance / it->lengthWithGap) + 1; + for (VehicleInfoMap::const_iterator it = myVehicleInfos.begin(); + it != myVehicleInfos.end(); it++) { + if (it->second->onDetector) { +// if (it->position < distance) { +// distance = it->position; +// } +// const double realDistance = myLane->getLength() - distance; // the closer vehicle get to the light the greater is the distance + const double realDistance = it->second->distToDetectorEnd; + if (it->second->lastSpeed <= thresholdSpeed || it->second->lastAccel > 0) { //TODO speed less half of the maximum speed for the lane NEED TUNING + count = (int)(realDistance / (it->second->length + it->second->minGap)) + 1; } } } @@ -469,38 +1295,36 @@ return count; } -SUMOReal +double MSE2Collector::getEstimateQueueLength() const { - if (myPreviousKnownVehicles.empty()) { + if (myVehicleInfos.empty()) { return -1; } - SUMOReal distance = std::numeric_limits::max(); - SUMOReal realDistance = 0; + double distance = std::numeric_limits::max(); + double realDistance = 0; bool flowing = true; - for (std::vector::const_iterator it = myPreviousKnownVehicles.begin(); - it != myPreviousKnownVehicles.end(); it++) { - if (it->stillOnDet) { - if (it->position < distance) { - distance = it->position; - } - // SUMOReal distanceTemp = myLane->getLength() - distance; - if (it->speed <= 0.5) { - realDistance = distance - it->lengthWithGap; + for (VehicleInfoMap::const_iterator it = myVehicleInfos.begin(); + it != myVehicleInfos.end(); it++) { + if (it->second->onDetector) { + distance = MIN2(it->second->lastPos, distance); + // double distanceTemp = myLane->getLength() - distance; + if (it->second->lastSpeed <= 0.5) { + realDistance = distance - it->second->length + it->second->minGap; flowing = false; } - DBG( - std::ostringstream str; - str << time2string(MSNet::getInstance()->getCurrentTimeStep()) - << " MSE2Collector::getEstimateQueueLength::" - << " lane " << myLane->getID() - << " vehicle " << it->id - << " positionOnLane " << it->position - << " vel " << it->speed - << " realDistance " << realDistance; - WRITE_MESSAGE(str.str()); - ) +// DBG( +// std::ostringstream str; +// str << time2string(MSNet::getInstance()->getCurrentTimeStep()) +// << " MSE2Collector::getEstimateQueueLength::" +// << " lane " << myLane->getID() +// << " vehicle " << it->second.id +// << " positionOnLane " << it->second.position +// << " vel " << it->second.speed +// << " realDistance " << realDistance; +// WRITE_MESSAGE(str.str()); +// ) } } if (flowing) { @@ -510,82 +1334,5 @@ } } - -SUMOReal -MSE2Collector::getCurrentOccupancy() const { - return myCurrentOccupancy; -} - - -SUMOReal -MSE2Collector::getCurrentMeanSpeed() const { - return myCurrentMeanSpeed; -} - - -SUMOReal -MSE2Collector::getCurrentMeanLength() const { - return myCurrentMeanLength; -} - - -int -MSE2Collector::getCurrentJamNumber() const { - return myCurrentJamNo; -} - - -int -MSE2Collector::getCurrentMaxJamLengthInVehicles() const { - return myCurrentMaxJamLengthInVehicles; -} - - -SUMOReal -MSE2Collector::getCurrentMaxJamLengthInMeters() const { - return myCurrentMaxJamLengthInMeters; -} - - -int -MSE2Collector::getCurrentJamLengthInVehicles() const { - return myCurrentJamLengthInVehicles; -} - - -SUMOReal -MSE2Collector::getCurrentJamLengthInMeters() const { - return myCurrentJamLengthInMeters; -} - - -int -MSE2Collector::getCurrentStartedHalts() const { - return myCurrentStartedHalts; -} - - -int -MSE2Collector::getCurrentHaltingNumber() const { - return myCurrentHaltingsNumber; -} - - -std::vector -MSE2Collector::getCurrentVehicleIDs() const { - std::vector ret; - for (std::vector::const_iterator i = myPreviousKnownVehicles.begin(); i != myPreviousKnownVehicles.end(); ++i) { - ret.push_back(i->id); - } - std::sort(ret.begin(), ret.end()); - return ret; -} - - -const std::vector& -MSE2Collector::getCurrentVehicles() const { - return myPreviousKnownVehicles; -} - /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSE2Collector.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSE2Collector.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSE2Collector.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSE2Collector.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,13 +6,14 @@ /// @author Michael Behrisch /// @author Robbin Blokpoel /// @author Jakob Erdmann +/// @author Leonhard Luecken /// @date Mon Feb 03 2014 14:13 CET -/// @version $Id: MSE2Collector.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSE2Collector.h 24108 2017-04-27 18:43:30Z behrisch $ /// -// An areal (along a single lane) detector +// An areal detector covering to a sequence of consecutive lanes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,10 +44,7 @@ #include #include #include - -//Debug -//#define SWARM_DEBUG -#include +#include // =========================================================================== // class declarations @@ -59,9 +57,9 @@ // =========================================================================== /** * @class MSE2Collector - * @brief An areal (along a single lane) detector + * @brief An areal detector corresponding to a sequence of consecutive lanes * - * This detector traces vehicles which are at a part of a single lane. A + * This detector traces vehicles which are on a sequence of consecutive lanes. A * vehicle that enters the detector is stored and the stored vehicles' speeds * are used within each timestep to compute the detector values. As soon as the * vehicle leaves the detector, it is no longer tracked. @@ -70,76 +68,201 @@ * interface. The values are computed by an event-callback (at the end of * a time step). * - * Jams are determined as following: A vehicle must at least drive haltingTimeThreshold - * at a speed lesser than haltingSpeedThreshold to be a "halting" vehicle. - * Two or more vehicles are "in jam" if they are halting and their distance is - * lesser than jamDistThreshold. + * @note As soon as a vehicle enters the detector, a VehicleInfo object is created + * and stored in myVehicleInfos. This is constantly updated as long as the + * vehicle stays on the detector (i.e. calls notifyMove()). All movement + * notifications sent by vehicles on the detector are temporarily stored + * in myMoveNotifications, see notifyMove(). Finally they are integrated + * into myVehicleInfos when updateDetector is called. + * @note When subclassing this detector, it is probably sufficient to adapt the + * definition of the structs VehicleInfo and the MoveNotification, as well as + * the methods that define and create those structs, i.e., makeVehicleInfo() + * and makeMoveNotification(). Further the integration of new movement + * notifications of the last time step into the vehicle infos is done + * in updateVehicleInfos(). * - * @see Named - * @see MSMoveReminder - * @see MSDetectorFileOutput - * @see Command */ + + class MSE2Collector : public MSMoveReminder, public MSDetectorFileOutput { public: - /** @brief Internal representation of a vehicle + /** @brief A VehicleInfo stores values that are tracked for the individual vehicles on the detector, + * e.g., accumulated timeloss. These infos are stored in myVehicles. If a vehicle leaves the detector + * (may it be temporarily), the entry in myVehicles is discarded, i.e. all information on the vehicle is reset. */ struct VehicleInfo { - VehicleInfo(std::string _id, std::string _type, SUMOReal _speed, SUMOReal _timeOnDet, SUMOReal _lengthOnDet, SUMOReal _position, SUMOReal _lengthWithGap, SUMOReal _accel, bool _stillOnDet) - : id(_id), type(_type), speed(_speed), timeOnDet(_timeOnDet), lengthOnDet(_lengthOnDet), position(_position), lengthWithGap(_lengthWithGap), accel(_accel), stillOnDet(_stillOnDet) {} + /** @note Constructor expects an _entryLane argument corresponding to a lane, which is part of the detector. + */ + VehicleInfo(std::string id, std::string type, double length, double minGap, const MSLane* entryLane, double entryOffset, + std::size_t currentOffsetIndex, double exitOffset, double distToDetectorEnd, bool onDetector) : + id(id), + type(type), + length(length), + minGap(minGap), + entryLaneID(entryLane->getID()), + entryOffset(entryOffset), + currentLane(entryLane), + currentOffsetIndex(currentOffsetIndex), + exitOffset(exitOffset), + distToDetectorEnd(distToDetectorEnd), + totalTimeOnDetector(0.), + accumulatedTimeLoss(0.), + onDetector(onDetector), + hasEntered(false), + lastAccel(0), + lastSpeed(0), + lastPos(0) { + } + virtual ~VehicleInfo() {}; + /// vehicle's ID std::string id; + /// vehicle's type std::string type; - SUMOReal speed; - SUMOReal timeOnDet; - SUMOReal lengthOnDet; - SUMOReal position; - SUMOReal lengthWithGap; - SUMOReal accel; - bool stillOnDet; + /// vehicle's length + double length; + /// vehicle's minGap + double minGap; + /// ID of the lane, on which the vehicle entered the detector + std::string entryLaneID; + /// Distance of the vehicle's entry lane's beginning to the detector start (can be negative for the first lane) + /// In notifyMove(), the positional input arguments are relative to that position (since the vehicle picks up the MoveReminder + /// on the entry lane) + double entryOffset; + /// Lane, on which the vehicle currently resides (always the one for which the last notifyEnter was received) + const MSLane* currentLane; + /// Index of currentLane in the detector's myLanes vector. + std::size_t currentOffsetIndex; + /// Offset from the detector start, where the vehicle has leaves the detector (defaults to detector length and is updated + /// if the vehicle leaves the detector via a junction before reaching its end, i.e. enters a lane not part of the detector) + double exitOffset; + /// Distance left till the detector end after the last integration step (may become negative if the vehicle passes beyond the detector end) + double distToDetectorEnd; + /// Accumulated time that this vehicle has spent on the detector since its last entry + double totalTimeOnDetector; + /// Accumulated time loss that this vehicle suffered since it entered the detector + double accumulatedTimeLoss; + + /// whether the vehicle is on the detector at the end of the current timestep + bool onDetector; + /// Whether the vehicle has already entered the detector (don't count twice!) + bool hasEntered; + /// Last value of the acceleration + double lastAccel; + /// Last value of the speed + double lastSpeed; + /// Last value of the vehicle position in reference to the start lane + /// @note NOT in reference to the entry lane as newPos argument in notifyMove()! + double lastPos; + }; + + typedef std::map VehicleInfoMap; + + +private: + /** @brief Values collected in notifyMove and needed in detectorUpdate() to + * calculate the accumulated quantities for the detector. These are + * temporarily stored in myMoveNotifications for each step. + */ + struct MoveNotificationInfo { + MoveNotificationInfo(std::string _vehID, double _oldPos, double _newPos, double _speed, double _accel, double _distToDetectorEnd, double _timeOnDetector, double _lengthOnDetector, double _timeLoss, bool _onDetector) : + id(_vehID), + oldPos(_oldPos), + newPos(_newPos), + speed(_speed), + accel(_accel), + distToDetectorEnd(_distToDetectorEnd), + timeOnDetector(_timeOnDetector), + lengthOnDetector(_lengthOnDetector), + timeLoss(_timeLoss), + onDetector(_onDetector) {} + + virtual ~MoveNotificationInfo() {}; + + /// Vehicle's id + std::string id; + /// Position before the last integration step (relative to the vehicle's entry lane on the detector) + double oldPos; + /// Position after the last integration step (relative to the vehicle's entry lane on the detector) + double newPos; + /// Speed after the last integration step + double speed; + /// Acceleration in the last integration step + double accel; + /// Distance left till the detector end after the last integration step (may become negative if the vehicle passes beyond the detector end) + double distToDetectorEnd; + /// Time spent on the detector during the last integration step + double timeOnDetector; + /// The length of the part of the vehicle on the detector at the end of the last time step + double lengthOnDetector; + /// timeloss during the last integration step + double timeLoss; + /// whether the vehicle is on the detector at the end of the current timestep + bool onDetector; }; - /** @brief Constructor + + /** @brief Internal representation of a jam + * + * Used in execute, instances of this structure are used to track + * begin and end positions (as vehicles) of a jam. + */ + struct JamInfo { + /// @brief The first standing vehicle + std::vector::const_iterator firstStandingVehicle; + + /// @brief The last standing vehicle + std::vector::const_iterator lastStandingVehicle; + }; + + +public: + + /** @brief Constructor with given end position and detector length * * @param[in] id The detector's unique id. * @param[in] usage Information how the detector is used - * @param[in] lane The lane to place the detector at - * @param[in] startPos Begin position of the detector - * @param[in] detLength Length of the detector + * @param[in] lane The lane the detector ends + * @param[in] startPos The start position on the lane the detector is placed at + * @param[in] endPos The end position on the lane the detector is placed at + * @param[in] length The length the detector has (heuristic lane selection is done if the continuation is not unique) * @param[in] haltingTimeThreshold The time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed * @param[in] haltingSpeedThreshold The speed a vehicle's speed must be below to be assigned as jammed * @param[in] jamDistThreshold The distance between two vehicles in order to not count them to one jam - * @todo The lane should not be given as a pointer + * @param[in] vTypes Vehicle types, that the detector takes into account + * + * @note Exactly one of the arguments startPos, endPos and length should be invalid (i.e. equal to std::numeric_limits::max()). + * If length is invalid, it is required that 0 <= startPos < endPos <= lane->length + * If endPos is invalid, the detector may span over several lanes downstream of the lane + * If pos is invalid, the detector may span over several lanes upstream of the lane */ - MSE2Collector(const std::string& id, DetectorUsage usage, - MSLane* const lane, SUMOReal startPos, SUMOReal detLength, - SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, + MSE2Collector(const std::string& id, + DetectorUsage usage, MSLane* lane, double startPos, double endPos, double length, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, const std::string& vTypes); - /** @brief Constructor + + /** @brief Constructor with a sequence of lanes and given start and end position on the first and last lanes * * @param[in] id The detector's unique id. * @param[in] usage Information how the detector is used - * @param[in] lane The lane to place the detector at - * @param[in] startPos Begin position of the detector - * @param[in] detLength Length of the detector + * @param[in] lanes A sequence of lanes the detector covers (must form a continuous piece) + * @param[in] startPos The position of the detector start on the first lane the detector is placed at + * @param[in] endPos The position of the detector end on the last lane the detector is placed at * @param[in] haltingTimeThreshold The time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed * @param[in] haltingSpeedThreshold The speed a vehicle's speed must be below to be assigned as jammed * @param[in] jamDistThreshold The distance between two vehicles in order to not count them to one jam - * @todo The lane should not be given as a pointer + * @param[in] vTypes Vehicle types, that the detector takes into account */ - MSE2Collector(const std::string& id, DetectorUsage usage, - MSLane* const lane, SUMOReal startPos, SUMOReal detLength, - SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, - const std::set& vTypes); + MSE2Collector(const std::string& id, + DetectorUsage usage, std::vector lanes, double startPos, double endPos, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, + const std::string& vTypes); /// @brief Destructor virtual ~MSE2Collector(); - /** @brief Returns the detector's usage type * * @see DetectorUsage @@ -164,13 +287,15 @@ * @param[in] veh The vehicle in question. * @param[in] oldPos Position before the move-micro-timestep. * @param[in] newPos Position after the move-micro-timestep. + * Note that this position is given in reference + * to the begin of the entry lane of the vehicle. * @param[in] newSpeed Unused here. * @return False, if vehicle passed the detector entirely, else true. * @see MSMoveReminder * @see MSMoveReminder::notifyMove */ - bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, SUMOReal newPos, - SUMOReal newSpeed); + virtual bool notifyMove(SUMOVehicle& veh, double oldPos, double newPos, + double newSpeed); /** @brief Removes a known vehicle due to its lane-change @@ -184,7 +309,7 @@ * @param[in] isLaneChange whether the vehicle changed from the lane * @see MSMoveReminder::notifyLeave */ - bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason); + virtual bool notifyLeave(SUMOVehicle& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /** @brief Adds the vehicle to known vehicles if not beyond the dector @@ -199,11 +324,16 @@ * @see MSMoveReminder::notifyEnter * @see MSMoveReminder::Notification */ - bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason); + virtual bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane); /// @} + + + /// @name Methods inherited from MSDetectorFileOutput. + /// @{ + /** @brief Computes the detector values in each time step * * This method should be called at the end of a simulation step, when @@ -212,31 +342,28 @@ * * @param[in] currentTime The current simulation time */ - void detectorUpdate(const SUMOTime step); - + virtual void detectorUpdate(const SUMOTime step); - /// @name Methods inherited from MSDetectorFileOutput. - /// @{ - - /** @brief Writes collected values into the given stream - * + /** @brief Write the generated output to the given device * @param[in] dev The output device to write the data into * @param[in] startTime First time step the data were gathered * @param[in] stopTime Last time step the data were gathered - * @see MSDetectorFileOutput::writeXMLOutput - * @exception IOError If an error on writing occurs (!!! not yet implemented) + * @exception IOError If an error on writing occurs */ - void writeXMLOutput(OutputDevice& dev, SUMOTime startTime, SUMOTime stopTime); + virtual void writeXMLOutput(OutputDevice& dev, SUMOTime startTime, SUMOTime stopTime); - /** @brief Opens the XML-output using "detector" as root element + /** @brief Open the XML-output + * + * The implementing function should open an xml element using + * OutputDevice::writeXMLHeader. * * @param[in] dev The output device to write the root into - * @see MSDetectorFileOutput::writeXMLDetectorProlog - * @exception IOError If an error on writing occurs (!!! not yet implemented) + * @exception IOError If an error on writing occurs */ - void writeXMLDetectorProlog(OutputDevice& dev) const; + virtual void writeXMLDetectorProlog(OutputDevice& dev) const; + /// @} @@ -244,7 +371,7 @@ * * @return The detector's begin position */ - SUMOReal getStartPos() const { + double getStartPos() const { return myStartPos; } @@ -253,10 +380,31 @@ * * @return The detector's end position */ - SUMOReal getEndPos() const { + double getEndPos() const { return myEndPos; } + /** @brief Returns the length of the detector + * + * @return The detector's length + */ + double getLength() const { + return myDetectorLength; + } + + + /** @brief Returns the id of the detector's last lane + * + * @return The detector's end position + */ + MSLane* getLastLane() const { + return myLastLane; + } + + + /** @brief Returns a vector containing pointers to the lanes covered by the detector ordered from its first to its last lane + */ + std::vector getLanes(); /** @brief Resets all values * @@ -264,13 +412,8 @@ * were written. Values for the next interval may be collected, then. * The list of known vehicles stays untouched. */ - void reset(); - - /** @brief Returns an estimate of the number of vehicles currently on the detector */ - int getEstimatedCurrentVehicleNumber(SUMOReal speedThreshold) const; + virtual void reset(); - /** @brief Returns an estimate of the lenght of the queue of vehicles currently stopped on the detector */ - SUMOReal getEstimateQueueLength() const; /// @name Methods returning current values /// @{ @@ -278,32 +421,50 @@ /** @brief Returns the number of vehicles currently on the detector */ int getCurrentVehicleNumber() const; - /** @brief Returns the curent detector occupancy */ - SUMOReal getCurrentOccupancy() const; + /** @brief Returns the current detector occupancy */ + double getCurrentOccupancy() const { + return myCurrentOccupancy; + } /** @brief Returns the mean vehicle speed of vehicles currently on the detector*/ - SUMOReal getCurrentMeanSpeed() const; + double getCurrentMeanSpeed() const { + return myCurrentMeanSpeed; + } /** @brief Returns the mean vehicle length of vehicles currently on the detector*/ - SUMOReal getCurrentMeanLength() const; + double getCurrentMeanLength() const { + return myCurrentMeanLength; + } /** @brief Returns the current number of jams */ - int getCurrentJamNumber() const; + int getCurrentJamNumber() const { + return myCurrentJamNo; + } /** @brief Returns the length in vehicles of the currently largest jam */ - int getCurrentMaxJamLengthInVehicles() const; + int getCurrentMaxJamLengthInVehicles() const { + return myCurrentMaxJamLengthInVehicles; + } /** @brief Returns the length in meters of the currently largest jam */ - SUMOReal getCurrentMaxJamLengthInMeters() const; + double getCurrentMaxJamLengthInMeters() const { + return myCurrentMaxJamLengthInMeters; + } /** @brief Returns the length of all jams in vehicles */ - int getCurrentJamLengthInVehicles() const; + int getCurrentJamLengthInVehicles() const { + return myCurrentJamLengthInVehicles; + } /** @brief Returns the length of all jams in meters */ - SUMOReal getCurrentJamLengthInMeters() const; + double getCurrentJamLengthInMeters() const { + return myCurrentJamLengthInMeters; + } /** @brief Returns the length of all jams in meters */ - int getCurrentStartedHalts() const; + int getCurrentStartedHalts() const { + return myCurrentStartedHalts; + } /** @brief Returns the number of current haltings within the area * @@ -311,26 +472,26 @@ * * @return The mean number of haltings within the area */ - int getCurrentHaltingNumber() const; + int getCurrentHaltingNumber() const { + return myCurrentHaltingsNumber; + } /** @brief Returns the IDs of the vehicles within the area * * @return The IDs of the vehicles that have passed the entry, but not yet an exit point */ std::vector getCurrentVehicleIDs() const; - /** @brief Returns the vehicles within the area - * - * @return The vehicles that have passed the entry, but not yet an exit point + + /** @brief Returns the VehicleInfos for the vehicles currently on the detector */ - const std::vector& getCurrentVehicles() const; - /// @} + std::vector getCurrentVehicles() const; - /** \brief Returns the number of vehicles passed over the sensor. + /** \brief Returns the number of vehicles passed over the sensor (i.e. entered the sensor) * * @return number of cars passed over the sensor */ int getPassedVeh() { - return myPassedVeh; + return myNumberOfEnteredVehicles; } /** \brief Subtract the number of vehicles indicated from passed from the sensor count. @@ -338,120 +499,275 @@ * @param[in] passed - int that indicates the number of vehicles to subtract */ void subtractPassedVeh(int passed) { - myPassedVeh -= passed; + myNumberOfEnteredVehicles -= passed; } + /// @} + + + + + + /// @name Estimation methods + /// TODO: Need documentation, used for tls control in MSSOTLE2Sensors (->Daniel?) + /// @{ + /** @brief Returns an estimate of the number of vehicles currently on the detector */ + int getEstimatedCurrentVehicleNumber(double speedThreshold) const; + + /** @brief Returns an estimate of the lenght of the queue of vehicles currently stopped on the detector */ + double getEstimateQueueLength() const; + /// @} + + + private: - /** @brief Internal representation of a jam + + /** @brief checks whether the vehicle stands in a jam * - * Used in execute, instances of this structure are used to track - * begin and end positions (as vehicles) of a jam. + * @param[in] mni + * @param[in/out] haltingVehicles + * @param[in/out] intervalHaltingVehicles + * @return Whether vehicle is in a jam. */ - struct JamInfo { - /// @brief The first standing vehicle - std::vector::const_iterator firstStandingVehicle; + bool checkJam(std::vector::const_iterator mni, std::map& haltingVehicles, std::map& intervalHaltingVehicles); + + + /** @brief Either adds the vehicle to the end of an existing jam, or closes the last jam, and/or creates a new jam + * + * @param isInJam + * @param mni + * @param[in/out] currentJam + * @param[in/out] jams + */ + void buildJam(bool isInJam, std::vector::const_iterator mni, JamInfo*& currentJam, std::vector& jams); + + + /** @brief Calculates aggregated values from the given jam structure, deletes all jam-pointers + * + * @param jams + */ + void processJams(std::vector& jams, JamInfo* currentJam); + + /** @brief Calculates the time spent on the detector in the last step and the timeloss suffered in the last step for the given vehicle + * + * @param[in] veh Vehicle for which the values are to be calculated + * @param[in] oldPos Last position (before the last timestep) of the vehicle relative to the beginning of its entry lane + * @param[in] newPos Current position of the vehicle + * @param[in] vi VehicleInfo corresponding to the vehicle + * @param[in/out] timeOnDetector Total time spent on the detector during the last step + * @param[in/out] timeLoss Total time loss suffered during the last integration step + */ + void calculateTimeLossAndTimeOnDetector(const SUMOVehicle& veh, double oldPos, double newPos, const VehicleInfo& vi, double& timeOnDetector, double& timeLoss) const; + + /** @brief Checks integrity of myLanes, adds internal-lane information, inits myLength, myFirstLane, myLastLane, myOffsets + * Called once at construction. + * @requires myLanes should form a continuous sequence. + */ + void initAuxiliaries(std::vector& lanes); + + /** @brief Adjusts positioning if the detector length is less than POSITION_EPS and tests some assertions + */ + void checkPositioning(bool posGiven = false, double desiredLength = 0.); + + /** @brief Snaps value to snpPoint if they are closer than snapDist + */ + static double snap(double value, double snapPoint, double snapDist); + + /** @brief Updates the detector length after myStartPos and myEndPos have been modified + */ + void recalculateDetectorLength(); + + + + /** @brief This is called if no lane sequence is given to the constructor. Builds myLanes from the given information. + * Also inits startPos (case dir=="bw") / endPos (case dir=="fw"). + * Selects lanes heuristically if no unambiguous continuation exists. + * + * @param[in] lane Lane, where the detector starts/ends + * @param[in] length Length of the detector + * @param[in] dir Direction of detector extension with value in {"fw", "bw"} (forward / backward) + * If dir == "fw" lane is interpreted as corresponding to the start lane of the detector, + * otherwise the lane is interpreted as the end lane. + */ + std::vector selectLanes(MSLane* endLane, double length, std::string dir); + + + /** @brief This adds the detector as a MoveReminder to the associated lanes. + */ + void addDetectorToLanes(std::vector& lanes); + + + /** @brief Aggregates and normalize some values for the detector output during detectorUpdate() + */ + void aggregateOutputValues(); + + + /** @brief This updates the detector values and the VehicleInfo of a vehicle on the detector + * with the given MoveNotificationInfo generated by the vehicle during the last time step. + * + * @param[in/out] vi VehicleInfo corresponding to the notifying vehicle + * @param[in] mni MoveNotification for the vehicle + */ + void integrateMoveNotification(VehicleInfo* vi, const MoveNotificationInfo* mni); + + /** @brief Creates and returns a MoveNotificationInfo containing detector specific information on the vehicle's last movement + * + * @param veh The vehicle sending the notification + * @param oldPos The vehicle's position before the last integration step + * @param newPos The vehicle's position after the last integration step + * @param newSpeed The vehicle's speed after the last integration step + * @param vehInfo Info on the detector's memory of the vehicle + * @return A MoveNotificationInfo containing quantities of interest for the detector + */ + MoveNotificationInfo* makeMoveNotification(const SUMOVehicle& veh, double oldPos, double newPos, double newSpeed, const VehicleInfo& vehInfo) const; + + /** @brief Creates and returns a VehicleInfo (called at the vehicle's entry) + * + * @param veh The entering vehicle + * @param enteredLane The entry lane + * @return A vehicle info which can be used to store information about the vehicle's stay on the detector + */ + VehicleInfo* makeVehicleInfo(const SUMOVehicle& veh, const MSLane* enteredLane) const; + + /** @brief Calculates the time loss for a segment with constant vmax + * + * @param timespan time needed to cover the segment + * @param initialSpeed speed at segment entry + * @param accel constant acceleration assumed during movement on the segment + * @param vmax Maximal possible speed for the considered vehicle on the segment + * @return Time loss (== MAX(timespan*(vmax - (initialSpeed + accel/2))/vmax), 0) + */ + static double calculateSegmentTimeLoss(double timespan, double initialSpeed, double accel, double vmax); + + /** brief returns true if the vehicle corresponding to mni1 is closer to the detector end than the vehicle corresponding to mni2 + */ + static bool compareMoveNotification(MoveNotificationInfo* mni1, MoveNotificationInfo* mni2) { + return mni1->distToDetectorEnd < mni2->distToDetectorEnd; + } - /// @brief The last standing vehicle - std::vector::const_iterator lastStandingVehicle; - }; +private: + + /// @brief Information about how this detector is used + DetectorUsage myUsage; /// @name Detector parameter /// @{ + /// @brief The detector's lane sequence + std::vector myLanes; + /// @brief The distances of the lane-beginnings from the detector start-point + std::vector myOffsets; + /// @brief The first lane of the detector's lane sequence + MSLane* myFirstLane; + /// @brief The last lane of the detector's lane sequence + MSLane* myLastLane; + /// @brief The position the detector starts at on the first lane + double myStartPos; + /// @brief The position the detector ends at on the last lane + double myEndPos; + /// @brief The total detector length + double myDetectorLength; /// @brief A vehicle must driver slower than this to be counted as a part of a jam - SUMOReal myJamHaltingSpeedThreshold; + double myJamHaltingSpeedThreshold; /// @brief A vehicle must be that long beyond myJamHaltingSpeedThreshold to be counted as a part of a jam SUMOTime myJamHaltingTimeThreshold; /// @brief Two standing vehicles must be closer than this to be counted into the same jam - SUMOReal myJamDistanceThreshold; - /// @brief The position the detector starts at - SUMOReal myStartPos; - /// @brief The position the detector ends at - SUMOReal myEndPos; + double myJamDistanceThreshold; /// @} - /// @brief Information about how this detector is used - DetectorUsage myUsage; - /// @brief List of known vehicles - std::vector myKnownVehicles; + /// @name Container + /// @{ + /// @brief List of informations about the vehicles currently on the detector + VehicleInfoMap myVehicleInfos; - /// @brief List of previously known vehicles - std::vector myPreviousKnownVehicles; + /// @brief Temporal storage for notifications from vehicles that did call the + /// detector's notifyMove() in the last time step. + std::vector myMoveNotifications; + + /// @brief Keep track of vehicles that left the detector by a regular move along a junction (not lanechange, teleport, etc.) + /// and should be removed from myVehicleInfos after taking into account their movement. Non-longitudinal exits + /// are processed immediately in notifyLeave() + std::set myLeftVehicles; /// @brief Storage for halting durations of known vehicles (for halting vehicles) - std::map myHaltingVehicleDurations; + std::map myHaltingVehicleDurations; /// @brief Storage for halting durations of known vehicles (current interval) - std::map myIntervalHaltingVehicleDurations; + std::map myIntervalHaltingVehicleDurations; /// @brief Halting durations of ended halts [s] std::vector myPastStandingDurations; /// @brief Halting durations of ended halts for the current interval [s] std::vector myPastIntervalStandingDurations; + /// @} + /// @name Values generated for aggregated file output /// @{ - + /// @brief The number of collected samples [time x vehicle] since the last reset + double myVehicleSamples; + /// @brief The total amount of all time losses [time x vehicle] since the last reset + double myTotalTimeLoss; + /// @brief The number of vehicles, which have entered the detector since the last reset + int myNumberOfEnteredVehicles; /// @brief The sum of collected vehicle speeds [m/s] - SUMOReal mySpeedSum; + double mySpeedSum; /// @brief The number of started halts [#] - SUMOReal myStartedHalts; + double myStartedHalts; /// @brief The sum of jam lengths [m] - SUMOReal myJamLengthInMetersSum; + double myJamLengthInMetersSum; /// @brief The sum of jam lengths [#veh] int myJamLengthInVehiclesSum; - /// @brief The number of collected samples [#] - SUMOReal myVehicleSamples; /// @brief The current aggregation duration [#steps] int myTimeSamples; /// @brief The sum of occupancies [%] - SUMOReal myOccupancySum; + double myOccupancySum; /// @brief The maximum occupancy [%] - SUMOReal myMaxOccupancy; + double myMaxOccupancy; /// @brief The mean jam length [#veh] int myMeanMaxJamInVehicles; /// @brief The mean jam length [m] - SUMOReal myMeanMaxJamInMeters; + double myMeanMaxJamInMeters; /// @brief The max jam length [#veh] int myMaxJamInVehicles; /// @brief The max jam length [m] - SUMOReal myMaxJamInMeters; + double myMaxJamInMeters; /// @brief The mean number of vehicles [#veh] int myMeanVehicleNumber; - /// @brief The max number of vehicles [#veh] - int myMaxVehicleNumber; /// @} /// @name Values generated describing the current state /// @{ + /// @brief The number of vehicles, which have left the detector since the last reset + int myNumberOfLeftVehicles; + /// @brief The maximal number of vehicles located on the detector simultaneously since the last reset + int myMaxVehicleNumber; /// @brief The current occupancy - SUMOReal myCurrentOccupancy; + double myCurrentOccupancy; /// @brief The current mean speed - SUMOReal myCurrentMeanSpeed; + double myCurrentMeanSpeed; /// @brief The current mean length - SUMOReal myCurrentMeanLength; + double myCurrentMeanLength; /// @brief The current jam number int myCurrentJamNo; /// @brief the current maximum jam length in meters - SUMOReal myCurrentMaxJamLengthInMeters; + double myCurrentMaxJamLengthInMeters; /// @brief The current maximum jam length in vehicles int myCurrentMaxJamLengthInVehicles; /// @brief The overall jam length in meters - SUMOReal myCurrentJamLengthInMeters; + double myCurrentJamLengthInMeters; /// @brief The overall jam length in vehicles int myCurrentJamLengthInVehicles; /// @brief The number of started halts in the last step int myCurrentStartedHalts; /// @brief The number of halted vehicles [#] int myCurrentHaltingsNumber; - /// @brief The number of vehicles passed on the sensor - int myPassedVeh; /// @} @@ -461,8 +777,6 @@ /// @brief Invalidated assignment operator. MSE2Collector& operator=(const MSE2Collector&); - - }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MS_E2_ZS_CollectorOverLanes.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MS_E2_ZS_CollectorOverLanes.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MS_E2_ZS_CollectorOverLanes.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MS_E2_ZS_CollectorOverLanes.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,269 +0,0 @@ -/****************************************************************************/ -/// @file MS_E2_ZS_CollectorOverLanes.cpp -/// @author Daniel Krajzewicz -/// @author Michael Behrisch -/// @author Jakob Erdmann -/// @date Oct 2003 -/// @version $Id: MS_E2_ZS_CollectorOverLanes.cpp 21851 2016-10-31 12:20:12Z behrisch $ -/// -// A detector which joins E2Collectors over consecutive lanes (backward) -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2003-2016 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ - - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include -#include -#include -#include "MS_E2_ZS_CollectorOverLanes.h" -#include "MSE2Collector.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - - -// =========================================================================== -// method definitions -// =========================================================================== -MS_E2_ZS_CollectorOverLanes::MS_E2_ZS_CollectorOverLanes(const std::string& id, - DetectorUsage usage, - MSLane* lane, - SUMOReal startPos, - SUMOTime haltingTimeThreshold, - SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, - const std::string& vTypes) - : MSDetectorFileOutput(id, vTypes), - startPosM(startPos), haltingTimeThresholdM(haltingTimeThreshold), - haltingSpeedThresholdM(haltingSpeedThreshold), jamDistThresholdM(jamDistThreshold), - myStartLaneID(lane->getID()), myUsage(usage) {} - - -void -MS_E2_ZS_CollectorOverLanes::init(MSLane* lane, SUMOReal detLength) { - myLength = detLength; - if (startPosM == 0) { - startPosM = (SUMOReal) 0.1; - } - SUMOReal length = lane->getLength() - startPosM - (SUMOReal) 0.1; - SUMOReal dlength = detLength; - if (length > dlength) { - length = dlength; - } - myLengths.push_back(length); - myLaneCombinations.push_back(LaneVector()); - myLaneCombinations[0].push_back(lane); - myDetectorCombinations.push_back(DetectorVector()); - MSE2Collector* c = - buildCollector(0, 0, lane, startPosM, length, myVehicleTypes); - myDetectorCombinations[0].push_back(c); - myAlreadyBuild[lane] = c; - extendTo(detLength); -} - - -MS_E2_ZS_CollectorOverLanes::~MS_E2_ZS_CollectorOverLanes() {} - - -void -MS_E2_ZS_CollectorOverLanes::extendTo(SUMOReal length) { - bool done = false; - while (!done) { - done = true; - LengthVector::iterator leni = myLengths.begin(); - LaneVectorVector::iterator lanei = myLaneCombinations.begin(); - DetectorVectorVector::iterator deti = myDetectorCombinations.begin(); - for (; leni != myLengths.end(); leni++, lanei++, deti++) { - if ((*leni) < length) { - done = false; - // copy current values - LaneVector lv = *lanei; - DetectorVector dv = *deti; - SUMOReal clength = *leni; - assert(lv.size() > 0); - assert(dv.size() > 0); - // erase previous elements - assert(leni != myLengths.end()); - myLengths.erase(leni); - myLaneCombinations.erase(lanei); - myDetectorCombinations.erase(deti); - // get the lane to look before - MSLane* toExtend = lv.back(); - // and her predecessors - std::vector predeccessors = getLanePredeccessorLanes(toExtend); - if (predeccessors.size() == 0) { - int off = 1; - MSEdge& e = toExtend->getEdge(); - const std::vector& lanes = e.getLanes(); - int idx = (int) distance(lanes.begin(), find(lanes.begin(), lanes.end(), toExtend)); - while (predeccessors.size() == 0) { - if (idx - off >= 0) { - MSLane* tryMe = lanes[idx - off]; - predeccessors = getLanePredeccessorLanes(tryMe); - } - if (predeccessors.size() == 0 && idx + off < (int) lanes.size()) { - MSLane* tryMe = lanes[idx + off]; - predeccessors = getLanePredeccessorLanes(tryMe); - } - off++; - } - } - - /* LaneContinuations::const_iterator conts = - laneContinuations.find(toExtend->id()); - assert(conts!=laneContinuations.end()); - const std::vector &predeccessors = - (*conts).second;*/ - // go through the predeccessors and extend the detector - for (std::vector::const_iterator i = predeccessors.begin(); i != predeccessors.end(); i++) { - // get the lane - MSLane* l = *i; - // compute detector length - SUMOReal lanelen = length - clength; - if (lanelen > l->getLength()) { - lanelen = l->getLength() - (SUMOReal) 0.2; - } - // build new info - LaneVector nlv = lv; - nlv.push_back(l); - DetectorVector ndv = dv; - MSE2Collector* coll = 0; - if (myAlreadyBuild.find(l) == myAlreadyBuild.end()) { - coll = buildCollector(0, 0, l, (SUMOReal) 0.1, lanelen, myVehicleTypes); - } else { - coll = myAlreadyBuild.find(l)->second; - } - myAlreadyBuild[l] = coll; - ndv.push_back(coll); - // store new info - myLaneCombinations.push_back(nlv); - myDetectorCombinations.push_back(ndv); - myLengths.push_back(clength + lanelen); - } - // restart - leni = myLengths.end() - 1; - } - } - } -} - - -std::vector -MS_E2_ZS_CollectorOverLanes::getLanePredeccessorLanes(MSLane* l) { - std::string eid = l->getEdge().getID(); - // get predecessing edges - const MSEdgeVector& predEdges = l->getEdge().getIncomingEdges(); - std::vector ret; - // find predecessing lanes - MSEdgeVector::const_iterator i = predEdges.begin(); - for (; i != predEdges.end(); ++i) { - MSEdge* e = *i; - assert(e != 0); - typedef std::vector LaneVector; - const LaneVector* cl = e->allowedLanes(l->getEdge(), SVC_IGNORING); - bool fastAbort = false; - if (cl != 0) { - for (LaneVector::const_iterator j = cl->begin(); !fastAbort && j != cl->end(); j++) { - const MSLinkCont& lc = (*j)->getLinkCont(); - for (MSLinkCont::const_iterator k = lc.begin(); !fastAbort && k != lc.end(); k++) { - if ((*k)->getLane() == l) { - ret.push_back(*j); - fastAbort = true; - } - } - } - } - } - return ret; -} - - -MSE2Collector* -MS_E2_ZS_CollectorOverLanes::buildCollector(int c, int r, MSLane* l, - SUMOReal start, SUMOReal end, - const std::set& vTypes) { - std::string id = makeID(l->getID(), c, r); - if (start + end < l->getLength()) { - start = l->getLength() - end - (SUMOReal) 0.1; - } - return new MSE2Collector(id, myUsage, - l, start, end, haltingTimeThresholdM, - haltingSpeedThresholdM, jamDistThresholdM, vTypes); -} - - -void -MS_E2_ZS_CollectorOverLanes::writeXMLOutput(OutputDevice& /*&dev*/, - SUMOTime /*startTime*/, SUMOTime /*stopTime*/) { - /* - dev<<"writeXMLOutput(dev, startTime, stopTime); - dev<<"/>\n"; - */ -} - - -void -MS_E2_ZS_CollectorOverLanes::writeXMLDetectorProlog(OutputDevice& dev) const { - dev.writeXMLHeader("detector"); -} - - -int bla = 0; - -std::string -MS_E2_ZS_CollectorOverLanes::makeID(const std::string& baseID , - int /*col*/, int /*row*/) const { - std::string add; - switch (myUsage) { - case DU_USER_DEFINED: - add = "(u)"; - break; - case DU_SUMO_INTERNAL: - add = "(i)"; - break; - case DU_TL_CONTROL: - add = "(c)"; - break; - default: - break; - } - std::string ret = baseID + add + toString(bla++); - return ret; -} - - -const std::string& -MS_E2_ZS_CollectorOverLanes::getStartLaneID() const { - return myStartLaneID; -} - - -/****************************************************************************/ - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MS_E2_ZS_CollectorOverLanes.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MS_E2_ZS_CollectorOverLanes.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MS_E2_ZS_CollectorOverLanes.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MS_E2_ZS_CollectorOverLanes.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,263 +0,0 @@ -/****************************************************************************/ -/// @file MS_E2_ZS_CollectorOverLanes.h -/// @author Daniel Krajzewicz -/// @author Michael Behrisch -/// @date Oct 2003 -/// @version $Id: MS_E2_ZS_CollectorOverLanes.h 21851 2016-10-31 12:20:12Z behrisch $ -/// -// A detector which joins E2Collectors over consecutive lanes (backward) -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ -#ifndef MS_E2_ZS_CollectorOverLanes_h -#define MS_E2_ZS_CollectorOverLanes_h - - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include -#include - - -// =========================================================================== -// class declarations -// =========================================================================== -class MSLane; -class SUMOVehicle; -class OutputDevice; -class MSE2Collector; - - -// =========================================================================== -// class definitions -// =========================================================================== -/** - * @class MS_E2_ZS_CollectorOverLanes - * @brief A detector which joins E2Collectors over consecutive lanes (backward) - * - * This class is somekind of a wrapper over several MSE2Collectors. - * - * For some reasons it may be necessary to use MSE2Collectors that are - * longer than the lane they begin at. In this case, this class should be - * used. MSE2Collectors are laid on consecutive lanes backwards, building - * a virtual detector for each lane combination. - * - * There are still some problems with it: we do not know how the different - * combinations shall be treated. - */ -class MS_E2_ZS_CollectorOverLanes : public MSDetectorFileOutput { -public: - /// Definition of a E2 collector storage - typedef std::vector< MSE2Collector* > CollectorCont; - - /** @brief Constructor - * - * @param[in] id The id of the detector - * @param[in] usage Information how the detector is used - * @param[in] lane The lane the detector starts at - * @param[in] startPos Begin position of the detector - * @param[in] detLength Length of the detector - * @param[in] haltingTimeThreshold The time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed - * @param[in] haltingSpeedThreshold The speed a vehicle's speed must be below to be assigned as jammed - * @param[in] jamDistThreshold The distance between two vehicles in order to not count them to one jam - * @todo The lane should not be given as a pointer - */ - MS_E2_ZS_CollectorOverLanes(const std::string& id, - DetectorUsage usage, MSLane* lane, SUMOReal startPos, - SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, - const std::string& vTypes); - - - /** @brief Builds the consecutive E2 detectors - * - * This is not done within the constructor to allow overriding of - * most functions but the building of detectors itself which in fact - * is depending on whether the normal or the gui-version is used - * @param[in] lane The lane the detector starts at - * @param[in] startPos Begin position of the detector - */ - void init(MSLane* lane, SUMOReal detLength); - - - /// @brief Destructor - virtual ~MS_E2_ZS_CollectorOverLanes(); - - - /** @brief Returns the id of the lane this detector starts at - * @return The id of the lane this detector starts at - * @todo Check whether this is needed - */ - const std::string& getStartLaneID() const; - - - - /// @name Methods inherited from MSDetectorFileOutput. - /// @{ - - /** @brief Writes collected values into the given stream - * - * @param[in] dev The output device to write the data into - * @param[in] startTime First time step the data were gathered - * @param[in] stopTime Last time step the data were gathered - * @see MSDetectorFileOutput::writeXMLOutput - * @exception IOError If an error on writing occurs (!!! not yet implemented) - */ - void writeXMLOutput(OutputDevice& dev, - SUMOTime startTime, SUMOTime stopTime); - - - /** @brief Opens the XML-output using "detector" as root element - * - * @param[in] dev The output device to write the root into - * @see MSDetectorFileOutput::writeXMLDetectorProlog - * @todo What happens with the additional information if several detectors use the same output? - * @exception IOError If an error on writing occurs (!!! not yet implemented) - */ - void writeXMLDetectorProlog(OutputDevice& dev) const; - /// @} - - - - /** @brief Returns this detector's length [m] - * @return This detector's length in meters - */ - SUMOReal getLength() const { - return myLength; - } - -protected: - /** @brief This method extends the current length up to the given - * - * This method is called consecutively until all paths have the desired length - * @param[in] length !!! - * @todo Describe length's usage - */ - void extendTo(SUMOReal length); - - - /** @brief Builds an id for one of the E2 collectors this detector uses - * - * @param[in] baseID The id of the parent detector - * @param[in] c !!! - * @param[in] r !!! - * @todo Describe! - */ - std::string makeID(const std::string& baseID, - int c, int r) const; - - - /** @brief Builds a single collector - * - * @param[in] c !!! - * @param[in] r !!! - * @param[in] start !!! - * @param[in] end !!! - * @todo Describe! - */ - virtual MSE2Collector* buildCollector(int c, int r, - MSLane* l, SUMOReal start, SUMOReal end, - const std::set& vTypes); - - - /** @brief Returns the list of lanes predecessing the given one - * - * @param[in] l The lane to return predecessors of - * @return List of lanes predecessing the given one - */ - std::vector getLanePredeccessorLanes(MSLane* l); - -protected: - /// @brief The position the collector starts at - SUMOReal startPosM; - - /// @brief The length of the collector - SUMOReal myLength; - - /// @brief Describes how long a vehicle shall stay before being assigned to a jam - SUMOTime haltingTimeThresholdM; - - /// @brief Describes how slow a vehicle must be before being assigned to a jam - SUMOReal haltingSpeedThresholdM; - - /// @brief Describes how long a jam must be before being recognized - SUMOReal jamDistThresholdM; - - /// @brief Definition of a lane storage - typedef std::vector LaneVector; - - /// @brief Definition of a storage for lane vectors - typedef std::vector LaneVectorVector; - - /// @brief Definition of a detector storage - typedef std::vector DetectorVector; - - /// @brief Definition of a storage for detector vectors - typedef std::vector DetectorVectorVector; - - /// @brief Definition of a storage for SUMOReal vectors - typedef std::vector LengthVector; - - - /** @brief Storage for lane combinations - * - * Each lane combination is a vector of consecutive lanes (backwards) */ - LaneVectorVector myLaneCombinations; - - - /** @brief Storage for detector combinations - * - * Each detector combination is a vector of consecutive lanes (backwards) */ - DetectorVectorVector myDetectorCombinations; - - - /** @brief Storage for length combinations - * - * Each length combination is a vector of consecutive lanes (backwards) */ - LengthVector myLengths; - - - /// @brief The id of the lane this detector starts at - std::string myStartLaneID; - - /// @brief Definition of a map from a lane to the detector lying on it - typedef std::map LaneDetMap; - - /// @brief Storage for detectors which already have been build for a single lane - LaneDetMap myAlreadyBuild; - - /// @brief Information about how this detector is used - DetectorUsage myUsage; - - -private: - /// @brief Invalidated copy constructor. - MS_E2_ZS_CollectorOverLanes(const MS_E2_ZS_CollectorOverLanes&); - - /// @brief Invalidated assignment operator. - MS_E2_ZS_CollectorOverLanes& operator=(const MS_E2_ZS_CollectorOverLanes&); - - -}; - - -#endif - -/****************************************************************************/ - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSE3Collector.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSE3Collector.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSE3Collector.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSE3Collector.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Tue Dec 02 2003 22:17 CET -/// @version $Id: MSE3Collector.cpp 21652 2016-10-10 13:30:25Z luecken $ +/// @version $Id: MSE3Collector.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A detector of vehicles passing an area between entry/exit points /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -55,19 +51,19 @@ bool -MSE3Collector::MSE3EntryReminder::notifyMove(SUMOVehicle& veh, SUMOReal oldPos, - SUMOReal newPos, SUMOReal newSpeed) { +MSE3Collector::MSE3EntryReminder::notifyMove(SUMOVehicle& veh, double oldPos, + double newPos, double newSpeed) { if (myCollector.myEnteredContainer.find(&veh) == myCollector.myEnteredContainer.end() && newPos > myPosition) { if (oldPos > myPosition) { // was behind the detector already in the last step return false; } else { // entered in this step - const SUMOReal oldSpeed = veh.getPreviousSpeed(); - const SUMOReal entryTime = STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()); + const double oldSpeed = veh.getPreviousSpeed(); + const double entryTime = STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()); assert(!MSGlobals::gSemiImplicitEulerUpdate || newSpeed != 0); // how could it move across the detector otherwise - const SUMOReal timeBeforeEnter = MSCFModel::passingTime(oldPos, myPosition, newPos, oldSpeed, newSpeed); - const SUMOReal fractionTimeOnDet = TS - timeBeforeEnter; + const double timeBeforeEnter = MSCFModel::passingTime(oldPos, myPosition, newPos, oldSpeed, newSpeed); + const double fractionTimeOnDet = TS - timeBeforeEnter; myCollector.enter(veh, entryTime - fractionTimeOnDet, fractionTimeOnDet); } } @@ -76,7 +72,7 @@ bool -MSE3Collector::MSE3EntryReminder::notifyLeave(SUMOVehicle& veh, SUMOReal, MSMoveReminder::Notification reason) { +MSE3Collector::MSE3EntryReminder::notifyLeave(SUMOVehicle& veh, double, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { if (reason >= MSMoveReminder::NOTIFICATION_ARRIVED) { WRITE_WARNING("Vehicle '" + veh.getID() + "' arrived inside " + toString(SUMO_TAG_E3DETECTOR) + " '" + myCollector.getID() + "'."); myCollector.myEnteredContainer.erase(&veh); @@ -96,40 +92,45 @@ bool -MSE3Collector::MSE3LeaveReminder::notifyMove(SUMOVehicle& veh, SUMOReal oldPos, - SUMOReal newPos, SUMOReal newSpeed) { +MSE3Collector::MSE3LeaveReminder::notifyMove(SUMOVehicle& veh, double oldPos, + double newPos, double newSpeed) { if (newPos < myPosition) { // crossSection not yet reached return true; } - const SUMOReal oldSpeed = veh.getPreviousSpeed(); + const double oldSpeed = veh.getPreviousSpeed(); if (oldPos < myPosition) { assert(!MSGlobals::gSemiImplicitEulerUpdate || newSpeed != 0); // how could it move across the detector otherwise - const SUMOReal timeBeforeLeave = MSCFModel::passingTime(oldPos, myPosition, newPos, oldSpeed, newSpeed); -// const SUMOReal leaveTimeFront = SIMTIME - TS + (myPosition - oldPos) / newSpeed; - const SUMOReal leaveTimeFront = SIMTIME - TS + timeBeforeLeave; + const double timeBeforeLeave = MSCFModel::passingTime(oldPos, myPosition, newPos, oldSpeed, newSpeed); +// const double leaveTimeFront = SIMTIME - TS + (myPosition - oldPos) / newSpeed; + const double leaveTimeFront = SIMTIME - TS + timeBeforeLeave; myCollector.leaveFront(veh, leaveTimeFront); } - const SUMOReal backPos = newPos - veh.getVehicleType().getLength(); + const double backPos = newPos - veh.getVehicleType().getLength(); if (backPos < myPosition) { // crossSection not yet left return true; } // crossSection left - const SUMOReal oldBackPos = oldPos - veh.getVehicleType().getLength(); - const SUMOReal leaveStep = SIMTIME; + const double oldBackPos = oldPos - veh.getVehicleType().getLength(); + const double leaveStep = SIMTIME; assert(!MSGlobals::gSemiImplicitEulerUpdate || newSpeed != 0); // how could it move across the detector otherwise - const SUMOReal timeBeforeLeave = MSCFModel::passingTime(oldBackPos, myPosition, backPos, oldSpeed, newSpeed); + const double timeBeforeLeave = MSCFModel::passingTime(oldBackPos, myPosition, backPos, oldSpeed, newSpeed); myCollector.leave(veh, leaveStep - TS + timeBeforeLeave, timeBeforeLeave); return false; } bool -MSE3Collector::MSE3LeaveReminder::notifyLeave(SUMOVehicle& /* veh */, SUMOReal /* lastPos */, MSMoveReminder::Notification reason) { +MSE3Collector::MSE3LeaveReminder::notifyLeave(SUMOVehicle& veh , double /* lastPos */, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { if (reason == MSMoveReminder::NOTIFICATION_LANE_CHANGE) { return false; } + if (reason == MSMoveReminder::NOTIFICATION_TELEPORT) { + WRITE_WARNING("Vehicle '" + veh.getID() + "' teleported from " + toString(SUMO_TAG_E3DETECTOR) + " '" + myCollector.getID() + "'."); + myCollector.myEnteredContainer.erase(&veh); + return false; + } return true; } @@ -139,7 +140,7 @@ MSE3Collector::MSE3Collector(const std::string& id, const CrossSectionVector& entries, const CrossSectionVector& exits, - SUMOReal haltingSpeedThreshold, + double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string& vTypes) : MSDetectorFileOutput(id, vTypes), myEntries(entries), myExits(exits), @@ -174,12 +175,12 @@ void -MSE3Collector::enter(const SUMOVehicle& veh, const SUMOReal entryTimestep, const SUMOReal fractionTimeOnDet) { +MSE3Collector::enter(const SUMOVehicle& veh, const double entryTimestep, const double fractionTimeOnDet) { if (myEnteredContainer.find(&veh) != myEnteredContainer.end()) { WRITE_WARNING("Vehicle '" + veh.getID() + "' reentered " + toString(SUMO_TAG_E3DETECTOR) + " '" + getID() + "'."); return; } - const SUMOReal speedFraction = veh.getSpeed() * fractionTimeOnDet; + const double speedFraction = veh.getSpeed() * fractionTimeOnDet; E3Values v; v.entryTime = entryTimestep; v.frontLeaveTime = 0; @@ -196,12 +197,17 @@ } } v.hadUpdate = false; + if (!MSGlobals::gUseMesoSim) { + v.timeLoss = static_cast(veh).getTimeLoss(); + v.intervalTimeLoss = v.timeLoss; + } + myEnteredContainer[&veh] = v; } void -MSE3Collector::leaveFront(const SUMOVehicle& veh, const SUMOReal leaveTimestep) { +MSE3Collector::leaveFront(const SUMOVehicle& veh, const double leaveTimestep) { if (myEnteredContainer.find(&veh) == myEnteredContainer.end()) { WRITE_WARNING("Vehicle '" + veh.getID() + "' left " + toString(SUMO_TAG_E3DETECTOR) + " '" + getID() + "' without entering it."); } else { @@ -211,15 +217,22 @@ void -MSE3Collector::leave(const SUMOVehicle& veh, const SUMOReal leaveTimestep, const SUMOReal fractionTimeOnDet) { +MSE3Collector::leave(const SUMOVehicle& veh, const double leaveTimestep, const double fractionTimeOnDet) { if (myEnteredContainer.find(&veh) == myEnteredContainer.end()) { WRITE_WARNING("Vehicle '" + veh.getID() + "' left " + toString(SUMO_TAG_E3DETECTOR) + " '" + getID() + "' without entering it."); } else { E3Values values = myEnteredContainer[&veh]; values.backLeaveTime = leaveTimestep; - const SUMOReal speedFraction = veh.getSpeed() * (TS - fractionTimeOnDet); + const double speedFraction = veh.getSpeed() * (TS - fractionTimeOnDet); values.speedSum -= speedFraction; values.intervalSpeedSum -= speedFraction; + if (MSGlobals::gUseMesoSim) { + // not yet supported + values.timeLoss = 0; + } else { + // timeLoss was initialized when entering + values.timeLoss = static_cast(veh).getTimeLoss() - values.timeLoss; + } myEnteredContainer.erase(&veh); myLeftContainer[&veh] = values; } @@ -231,39 +244,43 @@ SUMOTime startTime, SUMOTime stopTime) { dev << " ::iterator i = myLeftContainer.begin(); i != myLeftContainer.end(); ++i) { - meanHaltsPerVehicle += (SUMOReal)(*i).second.haltings; + meanHaltsPerVehicle += (double)(*i).second.haltings; meanTravelTime += (*i).second.frontLeaveTime - (*i).second.entryTime; - const SUMOReal steps = (*i).second.backLeaveTime - (*i).second.entryTime; + const double steps = (*i).second.backLeaveTime - (*i).second.entryTime; meanOverlapTravelTime += steps; meanSpeed += ((*i).second.speedSum / steps); + meanTimeLoss += STEPS2TIME((*i).second.timeLoss); } - meanTravelTime = vehicleSum != 0 ? meanTravelTime / (SUMOReal)vehicleSum : -1; - meanOverlapTravelTime = vehicleSum != 0 ? meanOverlapTravelTime / (SUMOReal)vehicleSum : -1; - meanSpeed = vehicleSum != 0 ? meanSpeed / (SUMOReal)vehicleSum : -1; - meanHaltsPerVehicle = vehicleSum != 0 ? meanHaltsPerVehicle / (SUMOReal) vehicleSum : -1; + meanTravelTime = vehicleSum != 0 ? meanTravelTime / (double)vehicleSum : -1; + meanOverlapTravelTime = vehicleSum != 0 ? meanOverlapTravelTime / (double)vehicleSum : -1; + meanSpeed = vehicleSum != 0 ? meanSpeed / (double)vehicleSum : -1; + meanHaltsPerVehicle = vehicleSum != 0 ? meanHaltsPerVehicle / (double) vehicleSum : -1; + meanTimeLoss = vehicleSum != 0 ? meanTimeLoss / (double) vehicleSum : -1; // clear container myLeftContainer.clear(); // collect values about vehicles within the container - int vehicleSumWithin = (int) myEnteredContainer.size(); - SUMOReal meanSpeedWithin = 0.; - SUMOReal meanDurationWithin = 0.; - SUMOReal meanHaltsPerVehicleWithin = 0.; - SUMOReal meanIntervalSpeedWithin = 0.; - SUMOReal meanIntervalHaltsPerVehicleWithin = 0.; - SUMOReal meanIntervalDurationWithin = 0.; + const int vehicleSumWithin = (int) myEnteredContainer.size(); + double meanSpeedWithin = 0.; + double meanDurationWithin = 0.; + double meanHaltsPerVehicleWithin = 0.; + double meanIntervalSpeedWithin = 0.; + double meanIntervalHaltsPerVehicleWithin = 0.; + double meanIntervalDurationWithin = 0.; + double meanTimeLossWithin = 0.; for (std::map::iterator i = myEnteredContainer.begin(); i != myEnteredContainer.end(); ++i) { - meanHaltsPerVehicleWithin += (SUMOReal)(*i).second.haltings; - meanIntervalHaltsPerVehicleWithin += (SUMOReal)(*i).second.intervalHaltings; - const SUMOReal end = (*i).second.backLeaveTime == 0 ? STEPS2TIME(stopTime) : (*i).second.backLeaveTime; - const SUMOReal time = end - (*i).second.entryTime; - const SUMOReal timeWithin = MIN2(time, end - STEPS2TIME(startTime)); + meanHaltsPerVehicleWithin += (double)(*i).second.haltings; + meanIntervalHaltsPerVehicleWithin += (double)(*i).second.intervalHaltings; + const double end = (*i).second.backLeaveTime == 0 ? STEPS2TIME(stopTime) : (*i).second.backLeaveTime; + const double time = end - (*i).second.entryTime; + const double timeWithin = MIN2(time, end - STEPS2TIME(startTime)); if (i->second.speedSum > 0.) { meanSpeedWithin += i->second.speedSum / time; } @@ -275,20 +292,28 @@ // reset interval values (*i).second.intervalHaltings = 0; (*i).second.intervalSpeedSum = 0; + + if (!MSGlobals::gUseMesoSim) { + const SUMOTime currentTimeLoss = static_cast(i->first)->getTimeLoss(); + meanTimeLossWithin += STEPS2TIME(currentTimeLoss - (*i).second.intervalTimeLoss); + (*i).second.intervalTimeLoss = currentTimeLoss; + } } myLastResetTime = stopTime; - meanSpeedWithin = vehicleSumWithin != 0 ? meanSpeedWithin / (SUMOReal) vehicleSumWithin : -1; - meanHaltsPerVehicleWithin = vehicleSumWithin != 0 ? meanHaltsPerVehicleWithin / (SUMOReal) vehicleSumWithin : -1; - meanDurationWithin = vehicleSumWithin != 0 ? meanDurationWithin / (SUMOReal) vehicleSumWithin : -1; - meanIntervalSpeedWithin = vehicleSumWithin != 0 ? meanIntervalSpeedWithin / (SUMOReal) vehicleSumWithin : -1; - meanIntervalHaltsPerVehicleWithin = vehicleSumWithin != 0 ? meanIntervalHaltsPerVehicleWithin / (SUMOReal) vehicleSumWithin : -1; - meanIntervalDurationWithin = vehicleSumWithin != 0 ? meanIntervalDurationWithin / (SUMOReal) vehicleSumWithin : -1; + meanSpeedWithin = vehicleSumWithin != 0 ? meanSpeedWithin / (double) vehicleSumWithin : -1; + meanHaltsPerVehicleWithin = vehicleSumWithin != 0 ? meanHaltsPerVehicleWithin / (double) vehicleSumWithin : -1; + meanDurationWithin = vehicleSumWithin != 0 ? meanDurationWithin / (double) vehicleSumWithin : -1; + meanIntervalSpeedWithin = vehicleSumWithin != 0 ? meanIntervalSpeedWithin / (double) vehicleSumWithin : -1; + meanIntervalHaltsPerVehicleWithin = vehicleSumWithin != 0 ? meanIntervalHaltsPerVehicleWithin / (double) vehicleSumWithin : -1; + meanIntervalDurationWithin = vehicleSumWithin != 0 ? meanIntervalDurationWithin / (double) vehicleSumWithin : -1; + meanTimeLossWithin = vehicleSumWithin != 0 ? meanTimeLossWithin / (double) vehicleSumWithin : -1; // write values dev << "meanTravelTime=\"" << meanTravelTime << "\" meanOverlapTravelTime=\"" << meanOverlapTravelTime << "\" meanSpeed=\"" << meanSpeed << "\" meanHaltsPerVehicle=\"" << meanHaltsPerVehicle + << "\" meanTimeLoss=\"" << meanTimeLoss << "\" vehicleSum=\"" << vehicleSum << "\" meanSpeedWithin=\"" << meanSpeedWithin << "\" meanHaltsPerVehicleWithin=\"" << meanHaltsPerVehicleWithin @@ -297,13 +322,14 @@ << "\" meanIntervalSpeedWithin=\"" << meanIntervalSpeedWithin << "\" meanIntervalHaltsPerVehicleWithin=\"" << meanIntervalHaltsPerVehicleWithin << "\" meanIntervalDurationWithin=\"" << meanIntervalDurationWithin + << "\" meanTimeLossWithin=\"" << meanTimeLossWithin << "\"/>\n"; } void MSE3Collector::writeXMLDetectorProlog(OutputDevice& dev) const { - dev.writeXMLHeader("e3Detector", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/det_e3_file.xsd\""); + dev.writeXMLHeader("e3Detector", "det_e3_file.xsd"); } @@ -339,7 +365,7 @@ } -SUMOReal +double MSE3Collector::getCurrentMeanSpeed() const { return myCurrentMeanSpeed; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSE3Collector.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSE3Collector.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSE3Collector.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSE3Collector.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Tue Dec 02 2003 22:17 CET -/// @version $Id: MSE3Collector.h 21496 2016-09-19 10:39:08Z behrisch $ +/// @version $Id: MSE3Collector.h 23188 2017-03-02 11:59:04Z luecken $ /// // A detector of vehicles passing an area between entry/exit points /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2003-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2003-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -96,7 +96,7 @@ * @see MSMoveReminder::notifyMove * @see MSE3Collector::enter */ - bool notifyMove(SUMOVehicle& veh, SUMOReal , SUMOReal newPos, SUMOReal); + bool notifyMove(SUMOVehicle& veh, double , double newPos, double); /** @brief Processes state changes of a vehicle @@ -109,7 +109,7 @@ * @param[in] reason The reason for the state change * @see MSMoveReminder::notifyLeave */ - bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason); + bool notifyLeave(SUMOVehicle& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /// @} @@ -118,7 +118,7 @@ MSE3Collector& myCollector; /// @brief The position on the lane - SUMOReal myPosition; + double myPosition; private: /// @brief Invalidated copy constructor. @@ -163,7 +163,7 @@ * @see MSMoveReminder::notifyMove * @see MSE3Collector::leave */ - bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal); + bool notifyMove(SUMOVehicle& veh, double oldPos, double newPos, double); /** @brief Processes state changes of a vehicle * @@ -174,7 +174,7 @@ * @param[in] reason The reason for the state change * @see MSMoveReminder::notifyLeave */ - bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason); + bool notifyLeave(SUMOVehicle& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); //@} @@ -183,7 +183,7 @@ MSE3Collector& myCollector; /// @brief The position on the lane - SUMOReal myPosition; + double myPosition; private: /// @brief Invalidated copy constructor. @@ -207,7 +207,7 @@ */ MSE3Collector(const std::string& id, const CrossSectionVector& entries, const CrossSectionVector& exits, - SUMOReal haltingSpeedThreshold, + double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string& vTypes); @@ -229,7 +229,7 @@ * @param[in] entryTimestep The time in seconds the vehicle entered the area * @param[in] fractionTimeOnDet The interpolated time in seconds the vehicle already spent on the detector */ - void enter(const SUMOVehicle& veh, const SUMOReal entryTimestep, const SUMOReal fractionTimeOnDet); + void enter(const SUMOVehicle& veh, const double entryTimestep, const double fractionTimeOnDet); /** @brief Called if a vehicle front passes a leave-cross-section. @@ -237,7 +237,7 @@ * @param[in] veh The vehicle that left the area * @param[in] leaveTimestep The time in seconds the vehicle started crossing the line */ - void leaveFront(const SUMOVehicle& veh, const SUMOReal leaveTimestep); + void leaveFront(const SUMOVehicle& veh, const double leaveTimestep); /** @brief Called if a vehicle back passes a leave-cross-section. @@ -248,7 +248,7 @@ * @param[in] leaveTimestep The time in seconds the vehicle left the area * @param[in] fractionTimeOnDet The interpolated time in seconds the vehicle still spent on the detector */ - void leave(const SUMOVehicle& veh, const SUMOReal leaveTimestep, const SUMOReal fractionTimeOnDet); + void leave(const SUMOVehicle& veh, const double leaveTimestep, const double fractionTimeOnDet); /// @name Methods returning current values @@ -260,7 +260,7 @@ * * @return The mean speed [m/s] of all vehicles within the area, -1 if there is none */ - SUMOReal getCurrentMeanSpeed() const; + double getCurrentMeanSpeed() const; /** @brief Returns the number of current haltings within the area @@ -342,7 +342,7 @@ SUMOTime myHaltingTimeThreshold; /// @brief Speed-threshold to determine if a vehicle is halting. - SUMOReal myHaltingSpeedThreshold; + double myHaltingSpeedThreshold; /** * @struct E3Values @@ -354,21 +354,25 @@ */ struct E3Values { /// @brief The vehicle's entry time - SUMOReal entryTime; + double entryTime; /// @brief The time the vehicle's front was crossing the leave line - SUMOReal frontLeaveTime; + double frontLeaveTime; /// @brief The time the vehicle's back was crossing the leave line - SUMOReal backLeaveTime; + double backLeaveTime; /// @brief The sum of registered speeds the vehicle has/had inside the area - SUMOReal speedSum; + double speedSum; /// @brief The sum of haltings the vehicle has/had within the area int haltings; /// @brief Begin time of last halt begin - SUMOReal haltingBegin; + double haltingBegin; /// @brief The sum of registered speeds the vehicle has/had inside the area during the current interval - SUMOReal intervalSpeedSum; + double intervalSpeedSum; /// @brief The sum of haltings the vehicle has/had within the area during the current interval int intervalHaltings; + /// @brief The timeLoss of the vehicle when entering. Updated to the actual time loss within the area when leaving + SUMOTime timeLoss; + /// @brief The timeLoss of the vehicle when entering. Updated to the current timeLoss at interval write + SUMOTime intervalTimeLoss; /// @brief An internal information whether the update step was performed bool hadUpdate; }; @@ -384,7 +388,7 @@ /// @{ /// @brief The current mean speed of known vehicles (inside) - SUMOReal myCurrentMeanSpeed; + double myCurrentMeanSpeed; /// @brief The current number of haltings (inside) int myCurrentHaltingsNumber; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSEmissionExport.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSEmissionExport.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSEmissionExport.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSEmissionExport.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 2012-04-26 -/// @version $Id: MSEmissionExport.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSEmissionExport.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Realises dumping Emission Data /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,6 @@ #include #include "MSEmissionExport.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -73,6 +69,6 @@ of.closeTag(); } } - of.setPrecision(OUTPUT_ACCURACY); + of.setPrecision(gPrecision); of.closeTag(); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSFCDExport.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSFCDExport.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSFCDExport.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSFCDExport.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Mario Krumnow /// @author Michael Behrisch /// @date 2012-04-26 -/// @version $Id: MSFCDExport.cpp 20911 2016-06-08 06:59:31Z namdre $ +/// @version $Id: MSFCDExport.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Realises dumping Floating Car Data (FCD) Data /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,10 +45,6 @@ #include #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -65,7 +61,7 @@ if (veh->isOnRoad() || veh->isParking() || veh->isRemoteControlled()) { Position pos = veh->getPosition(); if (useGeo) { - of.setPrecision(GEO_OUTPUT_ACCURACY); + of.setPrecision(gPrecisionGeo); GeoConvHelper::getFinal().cartesian2geo(pos); } of.openTag(SUMO_TAG_VEHICLE); @@ -130,7 +126,7 @@ MSFCDExport::writeTransportable(OutputDevice& of, const MSEdge* e, MSTransportable* p, SumoXMLTag tag, bool useGeo, bool elevation) { Position pos = p->getPosition(); if (useGeo) { - of.setPrecision(GEO_OUTPUT_ACCURACY); + of.setPrecision(gPrecisionGeo); GeoConvHelper::getFinal().cartesian2geo(pos); } of.openTag(tag); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSFCDExport.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSFCDExport.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSFCDExport.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSFCDExport.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSFCDExport.h /// @author Mario Krumnow /// @date 2012-04-26 -/// @version $Id: MSFCDExport.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSFCDExport.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Realises dumping Floating Car Data (FCD) Data /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSFullExport.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSFullExport.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSFullExport.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSFullExport.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 2012-04-26 -/// @version $Id: MSFullExport.cpp 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: MSFullExport.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Dumping a hugh List of Parameters available in the Simulation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,10 +43,6 @@ #include #include "MSFullExport.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSFullExport.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSFullExport.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSFullExport.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSFullExport.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSFullExport.h /// @author Mario Krumnow /// @date 2012-04-26 -/// @version $Id: MSFullExport.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSFullExport.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Dumping a hugh List of Parameters available in the Simulation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSInductLoop.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSInductLoop.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSInductLoop.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSInductLoop.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date 2004-11-23 -/// @version $Id: MSInductLoop.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSInductLoop.cpp 23800 2017-04-04 09:37:29Z behrisch $ /// // An unextended detector measuring at a fixed position on a fixed lane. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,17 +48,13 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - #define HAS_NOT_LEFT_DETECTOR -1 // =========================================================================== // method definitions // =========================================================================== MSInductLoop::MSInductLoop(const std::string& id, MSLane* const lane, - SUMOReal positionInMeters, + double positionInMeters, const std::string& vTypes) : MSMoveReminder(id, lane), MSDetectorFileOutput(id, vTypes), @@ -84,7 +80,7 @@ bool -MSInductLoop::notifyEnter(SUMOVehicle& veh, Notification reason) { +MSInductLoop::notifyEnter(SUMOVehicle& veh, Notification reason, const MSLane* /* enteredLane */) { if (!vehicleApplies(veh)) { return false; } @@ -102,27 +98,27 @@ bool -MSInductLoop::notifyMove(SUMOVehicle& veh, SUMOReal oldPos, - SUMOReal newPos, SUMOReal newSpeed) { +MSInductLoop::notifyMove(SUMOVehicle& veh, double oldPos, + double newPos, double newSpeed) { if (newPos < myPosition) { // detector not reached yet return true; } - const SUMOReal oldSpeed = veh.getPreviousSpeed(); + const double oldSpeed = veh.getPreviousSpeed(); if (newPos >= myPosition && oldPos < myPosition) { // entered the detector by move - const SUMOReal timeBeforeEnter = MSCFModel::passingTime(oldPos, myPosition, newPos, oldSpeed, newSpeed); - SUMOReal entryTime = SIMTIME + timeBeforeEnter; + const double timeBeforeEnter = MSCFModel::passingTime(oldPos, myPosition, newPos, oldSpeed, newSpeed); + double entryTime = SIMTIME + timeBeforeEnter; enterDetectorByMove(veh, entryTime); } - SUMOReal oldBackPos = oldPos - veh.getVehicleType().getLength(); - SUMOReal newBackPos = newPos - veh.getVehicleType().getLength(); + double oldBackPos = oldPos - veh.getVehicleType().getLength(); + double newBackPos = newPos - veh.getVehicleType().getLength(); if (newBackPos > myPosition) { // vehicle passed the detector (it may have changed onto this lane somewhere past the detector) assert(!MSGlobals::gSemiImplicitEulerUpdate || newSpeed > 0 || myVehiclesOnDet.find(&veh) == myVehiclesOnDet.end()); if (oldBackPos <= myPosition) { - const SUMOReal timeBeforeLeave = MSCFModel::passingTime(oldBackPos, myPosition, newBackPos, oldSpeed, newSpeed); - const SUMOReal leaveTime = SIMTIME + timeBeforeLeave; + const double timeBeforeLeave = MSCFModel::passingTime(oldBackPos, myPosition, newBackPos, oldSpeed, newSpeed); + const double leaveTime = SIMTIME + timeBeforeLeave; leaveDetectorByMove(veh, leaveTime); } else { // vehicle is already beyond the detector... @@ -145,7 +141,7 @@ bool -MSInductLoop::notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason) { +MSInductLoop::notifyLeave(SUMOVehicle& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { if (reason != MSMoveReminder::NOTIFICATION_JUNCTION) { leaveDetectorByLaneChange(veh, lastPos); return false; @@ -154,39 +150,39 @@ } -SUMOReal +double MSInductLoop::getCurrentSpeed() const { std::vector d = collectVehiclesOnDet(MSNet::getInstance()->getCurrentTimeStep() - DELTA_T); return d.size() != 0 - ? accumulate(d.begin(), d.end(), (SUMOReal) 0.0, speedSum) / (SUMOReal) d.size() + ? accumulate(d.begin(), d.end(), (double) 0.0, speedSum) / (double) d.size() : -1; } -SUMOReal +double MSInductLoop::getCurrentLength() const { std::vector d = collectVehiclesOnDet(MSNet::getInstance()->getCurrentTimeStep() - DELTA_T); return d.size() != 0 - ? accumulate(d.begin(), d.end(), (SUMOReal) 0.0, lengthSum) / (SUMOReal) d.size() + ? accumulate(d.begin(), d.end(), (double) 0.0, lengthSum) / (double) d.size() : -1; } -SUMOReal +double MSInductLoop::getCurrentOccupancy() const { SUMOTime tbeg = MSNet::getInstance()->getCurrentTimeStep() - DELTA_T; std::vector d = collectVehiclesOnDet(tbeg); if (d.size() == 0) { return -1; } - SUMOReal occupancy = 0; - SUMOReal csecond = STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()); + double occupancy = 0; + double csecond = STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()); for (std::vector< VehicleData >::const_iterator i = d.begin(); i != d.end(); ++i) { - const SUMOReal leaveTime = (*i).leaveTimeM == HAS_NOT_LEFT_DETECTOR ? csecond : (*i).leaveTimeM; - const SUMOReal timeOnDetDuringInterval = leaveTime - MAX2(STEPS2TIME(tbeg), (*i).entryTimeM); + const double leaveTime = (*i).leaveTimeM == HAS_NOT_LEFT_DETECTOR ? csecond : (*i).leaveTimeM; + const double timeOnDetDuringInterval = leaveTime - MAX2(STEPS2TIME(tbeg), (*i).entryTimeM); occupancy += MIN2(timeOnDetDuringInterval, TS); } - return occupancy / TS * (SUMOReal) 100.; + return occupancy / TS * (double) 100.; } @@ -208,42 +204,42 @@ } -SUMOReal -MSInductLoop::getTimestepsSinceLastDetection() const { +double +MSInductLoop::getTimeSinceLastDetection() const { if (myVehiclesOnDet.size() != 0) { // detector is occupied return 0; } - return STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()) - myLastLeaveTime; + return SIMTIME - myLastLeaveTime; } void MSInductLoop::writeXMLDetectorProlog(OutputDevice& dev) const { - dev.writeXMLHeader("detector", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/det_e1_file.xsd\""); + dev.writeXMLHeader("detector", "det_e1_file.xsd"); } void MSInductLoop::writeXMLOutput(OutputDevice& dev, SUMOTime startTime, SUMOTime stopTime) { - const SUMOReal t(STEPS2TIME(stopTime - startTime)); - const SUMOReal flow = ((SUMOReal)myVehicleDataCont.size() / t) * (SUMOReal) 3600.0; - SUMOReal occupancy = 0.; - SUMOReal speedSum = 0.; - SUMOReal lengthSum = 0.; + const double t(STEPS2TIME(stopTime - startTime)); + const double flow = ((double)myVehicleDataCont.size() / t) * (double) 3600.0; + double occupancy = 0.; + double speedSum = 0.; + double lengthSum = 0.; for (std::deque< VehicleData >::const_iterator i = myVehicleDataCont.begin(); i != myVehicleDataCont.end(); ++i) { - const SUMOReal timeOnDetDuringInterval = i->leaveTimeM - MAX2(STEPS2TIME(startTime), i->entryTimeM); + const double timeOnDetDuringInterval = i->leaveTimeM - MAX2(STEPS2TIME(startTime), i->entryTimeM); occupancy += MIN2(timeOnDetDuringInterval, t); speedSum += i->speedM; lengthSum += i->lengthM; } - for (std::map< SUMOVehicle*, SUMOReal >::const_iterator i = myVehiclesOnDet.begin(); i != myVehiclesOnDet.end(); ++i) { + for (std::map< SUMOVehicle*, double >::const_iterator i = myVehiclesOnDet.begin(); i != myVehiclesOnDet.end(); ++i) { occupancy += STEPS2TIME(stopTime) - MAX2(STEPS2TIME(startTime), i->second); } - occupancy = occupancy / t * (SUMOReal) 100.; - const SUMOReal meanSpeed = myVehicleDataCont.size() != 0 ? speedSum / (SUMOReal)myVehicleDataCont.size() : -1; - const SUMOReal meanLength = myVehicleDataCont.size() != 0 ? lengthSum / (SUMOReal)myVehicleDataCont.size() : -1; + occupancy = occupancy / t * (double) 100.; + const double meanSpeed = myVehicleDataCont.size() != 0 ? speedSum / (double)myVehicleDataCont.size() : -1; + const double meanLength = myVehicleDataCont.size() != 0 ? lengthSum / (double)myVehicleDataCont.size() : -1; dev.openTag(SUMO_TAG_INTERVAL).writeAttr(SUMO_ATTR_BEGIN, STEPS2TIME(startTime)).writeAttr(SUMO_ATTR_END, STEPS2TIME(stopTime)); dev.writeAttr(SUMO_ATTR_ID, StringUtils::escapeXML(getID())).writeAttr("nVehContrib", myVehicleDataCont.size()); dev.writeAttr("flow", flow).writeAttr("occupancy", occupancy).writeAttr("speed", meanSpeed); @@ -254,7 +250,7 @@ void MSInductLoop::enterDetectorByMove(SUMOVehicle& veh, - SUMOReal entryTimestep) { + double entryTimestep) { // // Debug (Leo) // std::cout << "enterDetectorByMove(), detector = '"<< myID <<"', veh = '" << veh.getID() << "'\n"; @@ -265,14 +261,14 @@ void MSInductLoop::leaveDetectorByMove(SUMOVehicle& veh, - SUMOReal leaveTimestep) { + double leaveTimestep) { // // Debug (Leo) // std::cout << "leaveDetectorByMove(), detector = '"<< myID <<"', veh = '" << veh.getID() << "'\n"; VehicleMap::iterator it = myVehiclesOnDet.find(&veh); if (it != myVehiclesOnDet.end()) { - SUMOReal entryTimestep = it->second; + double entryTimestep = it->second; myVehiclesOnDet.erase(it); assert(entryTimestep < leaveTimestep); myVehicleDataCont.push_back(VehicleData(veh.getID(), veh.getVehicleType().getLength(), entryTimestep, leaveTimestep, veh.getVehicleType().getID())); @@ -284,7 +280,7 @@ void -MSInductLoop::leaveDetectorByLaneChange(SUMOVehicle& veh, SUMOReal /* lastPos */) { +MSInductLoop::leaveDetectorByLaneChange(SUMOVehicle& veh, double /* lastPos */) { // // Debug (Leo) // std::cout << "leaveDetectorByLaneChange(), detector = '"<< myID <<"', veh = '" << veh.getID() << "'\n"; @@ -296,7 +292,7 @@ std::vector MSInductLoop::collectVehiclesOnDet(SUMOTime tMS, bool leaveTime) const { - SUMOReal t = STEPS2TIME(tMS); + double t = STEPS2TIME(tMS); std::vector ret; for (VehicleDataCont::const_iterator i = myVehicleDataCont.begin(); i != myVehicleDataCont.end(); ++i) { if ((*i).entryTimeM >= t || (leaveTime && (*i).leaveTimeM >= t)) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSInductLoop.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSInductLoop.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSInductLoop.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSInductLoop.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 2004-11-23 -/// @version $Id: MSInductLoop.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSInductLoop.h 23800 2017-04-04 09:37:29Z behrisch $ /// // An unextended detector measuring at a fixed position on a fixed lane. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -77,12 +77,12 @@ * Adds reminder to MSLane. * * @param[in] id Unique id - * @param[in] lane Lane where detector woks on + * @param[in] lane Lane where detector works on * @param[in] position Position of the detector within the lane - * @param[in] splitByType Whether additional information split by vehicle classes shall be generated + * @param[in] vTypes which vehicle types are considered */ MSInductLoop(const std::string& id, MSLane* const lane, - SUMOReal positionInMeters, + double positionInMeters, const std::string& vTypes); @@ -98,7 +98,7 @@ /** @brief Returns the position of the detector on the lane * @return The detector's position in meters */ - SUMOReal getPosition() const { + double getPosition() const { return myPosition; } @@ -115,7 +115,7 @@ * @return True if vehicle enters the induction loop * @see Notification */ - bool notifyEnter(SUMOVehicle& veh, Notification reason); + bool notifyEnter(SUMOVehicle& veh, Notification reason, const MSLane* enteredLane = 0); /** @brief Checks whether the vehicle shall be counted and/or shall still touch this MSMoveReminder * @@ -133,7 +133,7 @@ * @see enterDetectorByMove * @see leaveDetectorByMove */ - bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed); + bool notifyMove(SUMOVehicle& veh, double oldPos, double newPos, double newSpeed); /** @brief Dismisses the vehicle if it is on the detector due to a lane change @@ -150,7 +150,7 @@ * @see MSMoveReminder * @see MSMoveReminder::notifyLeave */ - bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason); + bool notifyLeave(SUMOVehicle& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); //@} @@ -167,7 +167,7 @@ * * @return The speed [m/s] of the vehicle if one is on the detector, -1 otherwise */ - SUMOReal getCurrentSpeed() const; + double getCurrentSpeed() const; /** @brief Returns the length of the vehicle on the detector @@ -177,7 +177,7 @@ * * @return The length [m] of the vehicle if one is on the detector, -1 otherwise */ - SUMOReal getCurrentLength() const; + double getCurrentLength() const; /** @brief Returns the current occupancy @@ -189,7 +189,7 @@ * @return This detector's current occupancy * @todo recheck (especially if more than one vehicle has passed) */ - SUMOReal getCurrentOccupancy() const; + double getCurrentOccupancy() const; /** @brief Returns the number of vehicles that have passed the detector @@ -216,7 +216,7 @@ * * @return Timesteps from last leaving (detection) of the detector */ - SUMOReal getTimestepsSinceLastDetection() const; + double getTimeSinceLastDetection() const; //@} @@ -261,7 +261,7 @@ * @param[in] entryTimestep The time at which the vehicle entered the detector * @param[in] leaveTimestep The time at which the vehicle left the detector */ - VehicleData(const std::string& id, SUMOReal vehLength, SUMOReal entryTimestep, SUMOReal leaveTimestep, + VehicleData(const std::string& id, double vehLength, double entryTimestep, double leaveTimestep, const std::string& typeID) : idM(id), lengthM(vehLength), entryTimeM(entryTimestep), leaveTimeM(leaveTimestep), speedM(vehLength / MAX2(leaveTimestep - entryTimestep, NUMERICAL_EPS)), typeIDM(typeID) {} @@ -269,13 +269,13 @@ /// @brief The id of the vehicle std::string idM; /// @brief Length of the vehicle - SUMOReal lengthM; + double lengthM; /// @brief Entry-time of the vehicle in [s] - SUMOReal entryTimeM; + double entryTimeM; /// @brief Leave-time of the vehicle in [s] - SUMOReal leaveTimeM; + double leaveTimeM; /// @brief Speed of the vehicle in [m/s] - SUMOReal speedM; + double speedM; /// @brief Type of the vehicle in std::string typeIDM; }; @@ -299,7 +299,7 @@ * @param veh The entering vehicle. * @param entryTimestep Timestep (not necessary integer) of entrance. */ - virtual void enterDetectorByMove(SUMOVehicle& veh, SUMOReal entryTimestep); + virtual void enterDetectorByMove(SUMOVehicle& veh, double entryTimestep); /** @brief Processes a vehicle that leaves the detector @@ -310,14 +310,14 @@ * @param veh The leaving vehicle. * @param leaveTimestep Timestep (not necessary integer) of leaving. */ - virtual void leaveDetectorByMove(SUMOVehicle& veh, SUMOReal leaveTimestep); + virtual void leaveDetectorByMove(SUMOVehicle& veh, double leaveTimestep); /** @brief Removes a vehicle from the detector's map myVehiclesOnDet. * @param veh The leaving vehicle. * @param lastPos The last position of the leaving vehicle. */ - virtual void leaveDetectorByLaneChange(SUMOVehicle& veh, SUMOReal lastPos); + virtual void leaveDetectorByLaneChange(SUMOVehicle& veh, double lastPos); /// @} @@ -326,12 +326,12 @@ ///@{ /// @brief Adds up VehicleData::speedM - static inline SUMOReal speedSum(SUMOReal sumSoFar, const MSInductLoop::VehicleData& data) { + static inline double speedSum(double sumSoFar, const MSInductLoop::VehicleData& data) { return sumSoFar + data.speedM; } /// @brief Adds up VehicleData::lengthM - static inline SUMOReal lengthSum(SUMOReal sumSoFar, const MSInductLoop::VehicleData& data) { + static inline double lengthSum(double sumSoFar, const MSInductLoop::VehicleData& data) { return sumSoFar + data.lengthM; } ///@} @@ -339,13 +339,13 @@ protected: /// @brief Detector's position on lane [m] - const SUMOReal myPosition; + const double myPosition; /// @brief Leave-time of the last vehicle detected [s] - SUMOReal myLastLeaveTime; + double myLastLeaveTime; /// @brief Occupancy by the last vehicle detected. - SUMOReal myLastOccupancy; + double myLastOccupancy; /// @brief The number of entered vehicles int myEnteredVehicleNumber; @@ -362,7 +362,8 @@ /// @brief Type of myVehiclesOnDet - typedef std::map< SUMOVehicle*, SUMOReal > VehicleMap; + + typedef std::map< SUMOVehicle*, double > VehicleMap; /// @brief Data for vehicles that have entered the detector (vehicle -> enter time) VehicleMap myVehiclesOnDet; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSInstantInductLoop.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSInstantInductLoop.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSInstantInductLoop.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSInstantInductLoop.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 2011-09.08 -/// @version $Id: MSInstantInductLoop.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSInstantInductLoop.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // An instantaneous induction loop /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,16 +45,12 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== MSInstantInductLoop::MSInstantInductLoop(const std::string& id, - OutputDevice& od, MSLane* const lane, SUMOReal positionInMeters, + OutputDevice& od, MSLane* const lane, double positionInMeters, const std::string& vTypes) : MSMoveReminder(id, lane), MSDetectorFileOutput(id, vTypes), @@ -70,8 +66,8 @@ bool -MSInstantInductLoop::notifyMove(SUMOVehicle& veh, SUMOReal oldPos, - SUMOReal newPos, SUMOReal newSpeed) { +MSInstantInductLoop::notifyMove(SUMOVehicle& veh, double oldPos, + double newPos, double newSpeed) { if (!vehicleApplies(veh)) { return false; } @@ -80,12 +76,12 @@ return true; } - const SUMOReal oldSpeed = veh.getPreviousSpeed(); - SUMOReal enterSpeed = MSGlobals::gSemiImplicitEulerUpdate ? newSpeed : oldSpeed; // NOTE: For the euler update, the vehicle is assumed to travel at constant speed for the whole time step + const double oldSpeed = veh.getPreviousSpeed(); + double enterSpeed = MSGlobals::gSemiImplicitEulerUpdate ? newSpeed : oldSpeed; // NOTE: For the euler update, the vehicle is assumed to travel at constant speed for the whole time step if (newPos >= myPosition && oldPos < myPosition/* && static_cast(veh).getLane() == myLane*/) { - const SUMOReal timeBeforeEnter = MSCFModel::passingTime(oldPos, myPosition, newPos, oldSpeed, newSpeed); - const SUMOReal entryTime = SIMTIME - TS + timeBeforeEnter; + const double timeBeforeEnter = MSCFModel::passingTime(oldPos, myPosition, newPos, oldSpeed, newSpeed); + const double entryTime = SIMTIME - TS + timeBeforeEnter; enterSpeed = MSCFModel::speedAfterTime(timeBeforeEnter, oldSpeed, newPos - oldPos); if (myLastExitTime >= 0) { write("enter", entryTime, veh, enterSpeed, "gap", entryTime - myLastExitTime); @@ -94,14 +90,14 @@ } myEntryTimes[&veh] = entryTime; } - const SUMOReal newBackPos = newPos - veh.getVehicleType().getLength(); - const SUMOReal oldBackPos = oldPos - veh.getVehicleType().getLength(); + const double newBackPos = newPos - veh.getVehicleType().getLength(); + const double oldBackPos = oldPos - veh.getVehicleType().getLength(); if (newBackPos > myPosition) { - std::map::iterator i = myEntryTimes.find(&veh); + std::map::iterator i = myEntryTimes.find(&veh); if (i != myEntryTimes.end()) { // vehicle passed the detector - const SUMOReal timeBeforeLeave = MSCFModel::passingTime(oldBackPos, myPosition, newBackPos, oldSpeed, newSpeed); - const SUMOReal leaveTime = SIMTIME - TS + timeBeforeLeave; + const double timeBeforeLeave = MSCFModel::passingTime(oldBackPos, myPosition, newBackPos, oldSpeed, newSpeed); + const double leaveTime = SIMTIME - TS + timeBeforeLeave; write("leave", leaveTime, veh, newSpeed, "occupancy", leaveTime - (*i).second); myEntryTimes.erase(i); myLastExitTime = leaveTime; @@ -115,7 +111,7 @@ void -MSInstantInductLoop::write(const char* state, SUMOReal t, SUMOVehicle& veh, SUMOReal speed, const char* add, SUMOReal addValue) { +MSInstantInductLoop::write(const char* state, double t, SUMOVehicle& veh, double speed, const char* add, double addValue) { myOutputDevice.openTag("instantOut").writeAttr( "id", getID()).writeAttr("time", toString(t)).writeAttr("state", state).writeAttr( "vehID", veh.getID()).writeAttr("speed", toString(speed)).writeAttr( @@ -129,13 +125,13 @@ bool -MSInstantInductLoop::notifyLeave(SUMOVehicle& veh, SUMOReal /* lastPos */, MSMoveReminder::Notification reason) { +MSInstantInductLoop::notifyLeave(SUMOVehicle& veh, double /* lastPos */, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { if (reason == MSMoveReminder::NOTIFICATION_JUNCTION) { // vehicle might have jumped over detector at the end of the lane. we need // one more notifyMove to register it return true; } - std::map::iterator i = myEntryTimes.find(&veh); + std::map::iterator i = myEntryTimes.find(&veh); if (i != myEntryTimes.end()) { write("leave", SIMTIME, veh, veh.getSpeed()); myEntryTimes.erase(i); @@ -146,7 +142,7 @@ void MSInstantInductLoop::writeXMLDetectorProlog(OutputDevice& dev) const { - dev.writeXMLHeader("instantE1"); + dev.writeXMLHeader("instantE1", "instant_e1_file.xsd"); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSInstantInductLoop.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSInstantInductLoop.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSInstantInductLoop.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSInstantInductLoop.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,7 +3,7 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2011-09.08 -/// @version $Id: MSInstantInductLoop.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSInstantInductLoop.h 23188 2017-03-02 11:59:04Z luecken $ /// // An instantaneous induction loop /****************************************************************************/ @@ -69,7 +69,7 @@ * @param[in] position Position of the detector within the lane. */ MSInstantInductLoop(const std::string& id, OutputDevice& od, - MSLane* const lane, SUMOReal positionInMeters, + MSLane* const lane, double positionInMeters, const std::string& vTypes); @@ -97,7 +97,7 @@ * @see enterDetectorByMove * @see leaveDetectorByMove */ - bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed); + bool notifyMove(SUMOVehicle& veh, double oldPos, double newPos, double newSpeed); /** @brief Dismisses the vehicle if it is on the detector due to a lane change @@ -114,7 +114,7 @@ * @see MSMoveReminder * @see MSMoveReminder::notifyLeave */ - bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason); + bool notifyLeave(SUMOVehicle& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); //@} @@ -156,7 +156,7 @@ * @param[in] add An optional attribute to report * @param[in] addValue The value of the optional attribute */ - void write(const char* state, SUMOReal t, SUMOVehicle& veh, SUMOReal speed, const char* add = 0, SUMOReal addValue = -1); + void write(const char* state, double t, SUMOVehicle& veh, double speed, const char* add = 0, double addValue = -1); protected: @@ -164,13 +164,13 @@ OutputDevice& myOutputDevice; /// @brief Detector's position on lane [m] - const SUMOReal myPosition; + const double myPosition; /// @brief The last exit time - SUMOReal myLastExitTime; + double myLastExitTime; /// @brief The last exit time - std::map myEntryTimes; + std::map myEntryTimes; private: /// @brief Invalidated copy constructor. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData_Amitran.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData_Amitran.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData_Amitran.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData_Amitran.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 10.05.2004 -/// @version $Id: MSMeanData_Amitran.cpp 21652 2016-10-10 13:30:25Z luecken $ +/// @version $Id: MSMeanData_Amitran.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Network state mean data collector for edges/lanes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,6 @@ #include "MSMeanData_Amitran.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -51,7 +47,7 @@ // MSMeanData_Amitran::MSLaneMeanDataValues - methods // --------------------------------------------------------------------------- MSMeanData_Amitran::MSLaneMeanDataValues::MSLaneMeanDataValues(MSLane* const lane, - const SUMOReal length, + const double length, const bool doAdd, const MSMeanData_Amitran* parent) : MSMeanData::MeanDataValues(lane, length, doAdd, parent), amount(0) {} @@ -79,17 +75,17 @@ for (std::map::const_iterator it = typedAmount.begin(); it != typedAmount.end(); ++it) { v.typedAmount[it->first] += it->second; } - for (std::map::const_iterator it = typedSamples.begin(); it != typedSamples.end(); ++it) { + for (std::map::const_iterator it = typedSamples.begin(); it != typedSamples.end(); ++it) { v.typedSamples[it->first] += it->second; } - for (std::map::const_iterator it = typedTravelDistance.begin(); it != typedTravelDistance.end(); ++it) { + for (std::map::const_iterator it = typedTravelDistance.begin(); it != typedTravelDistance.end(); ++it) { v.typedTravelDistance[it->first] += it->second; } } void -MSMeanData_Amitran::MSLaneMeanDataValues::notifyMoveInternal(const SUMOVehicle& veh, const SUMOReal /* frontOnLane */, const SUMOReal timeOnLane, const SUMOReal /*meanSpeedFrontOnLane*/, const SUMOReal /*meanSpeedVehicleOnLane*/, const SUMOReal /*travelledDistanceFrontOnLane*/, const SUMOReal travelledDistanceVehicleOnLane) { +MSMeanData_Amitran::MSLaneMeanDataValues::notifyMoveInternal(const SUMOVehicle& veh, const double /* frontOnLane */, const double timeOnLane, const double /*meanSpeedFrontOnLane*/, const double /*meanSpeedVehicleOnLane*/, const double /*travelledDistanceFrontOnLane*/, const double travelledDistanceVehicleOnLane) { sampleSeconds += timeOnLane; travelledDistance += travelledDistanceVehicleOnLane; typedSamples[&veh.getVehicleType()] += timeOnLane; @@ -98,7 +94,7 @@ bool -MSMeanData_Amitran::MSLaneMeanDataValues::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason) { +MSMeanData_Amitran::MSLaneMeanDataValues::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { if (myParent->vehicleApplies(veh)) { if (getLane() == 0 || getLane() == static_cast(veh).getLane()) { if (reason == MSMoveReminder::NOTIFICATION_DEPARTED || reason == MSMoveReminder::NOTIFICATION_JUNCTION) { @@ -120,7 +116,7 @@ void MSMeanData_Amitran::MSLaneMeanDataValues::write(OutputDevice& dev, const SUMOTime /* period */, - const SUMOReal /* numLanes */, const SUMOReal defaultTravelTime, const int /* numVehicles */) const { + const double /* numLanes */, const double defaultTravelTime, const int /* numVehicles */) const { if (sampleSeconds > 0) { dev.writeAttr("amount", amount).writeAttr("averageSpeed", int(100 * travelledDistance / sampleSeconds)); } else if (defaultTravelTime >= 0.) { @@ -147,9 +143,9 @@ const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, - const SUMOReal maxTravelTime, - const SUMOReal minSamples, - const SUMOReal haltSpeed, + const double maxTravelTime, + const double minSamples, + const double haltSpeed, const std::string& vTypes) : MSMeanData(id, dumpBegin, dumpEnd, useLanes, withEmpty, printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, vTypes), @@ -162,7 +158,7 @@ void MSMeanData_Amitran::writeXMLDetectorProlog(OutputDevice& dev) const { - dev.writeXMLHeader("linkData", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/amitran/linkdata.xsd\""); + dev.writeXMLHeader("linkData", "amitran/linkdata.xsd"); } @@ -190,7 +186,7 @@ MSMeanData::MeanDataValues* -MSMeanData_Amitran::createValues(MSLane* const lane, const SUMOReal length, const bool doAdd) const { +MSMeanData_Amitran::createValues(MSLane* const lane, const double length, const bool doAdd) const { return new MSLaneMeanDataValues(lane, length, doAdd, this); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData_Amitran.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData_Amitran.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData_Amitran.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData_Amitran.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Mon, 10.05.2004 -/// @version $Id: MSMeanData_Amitran.h 21652 2016-10-10 13:30:25Z luecken $ +/// @version $Id: MSMeanData_Amitran.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Network state mean data collector for edges/lanes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -75,7 +75,7 @@ /** @brief Constructor * @param[in] length The length of the object for which the data gets collected */ - MSLaneMeanDataValues(MSLane* const lane, const SUMOReal length, const bool doAdd, + MSLaneMeanDataValues(MSLane* const lane, const double length, const bool doAdd, const MSMeanData_Amitran* parent); /** @brief Destructor */ @@ -107,7 +107,7 @@ * @see MSMoveReminder::notifyEnter * @see MSMoveReminder::Notification */ - bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason); + bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); //@} bool isEmpty() const; @@ -120,14 +120,14 @@ * @exception IOError If an error on writing occurs (!!! not yet implemented) */ void write(OutputDevice& dev, const SUMOTime period, - const SUMOReal numLanes, const SUMOReal defaultTravelTime, + const double numLanes, const double defaultTravelTime, const int numVehicles = -1) const; protected: /** @brief Internal notification about the vehicle moves * @see MSMoveReminder::notifyMoveInternal() */ - void notifyMoveInternal(const SUMOVehicle& veh, const SUMOReal /* frontOnLane */, const SUMOReal timeOnLane, const SUMOReal /*meanSpeedFrontOnLane*/, const SUMOReal meanSpeedVehicleOnLane, const SUMOReal travelledDistanceFrontOnLane, const SUMOReal travelledDistanceVehicleOnLane); + void notifyMoveInternal(const SUMOVehicle& veh, const double /* frontOnLane */, const double timeOnLane, const double /*meanSpeedFrontOnLane*/, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane); private: /// @name Collected values @@ -139,10 +139,10 @@ std::map typedAmount; /// @brief The number of sampled vehicle movements by type (in s) - std::map typedSamples; + std::map typedSamples; /// @brief The sum of the distances the vehicles travelled by type - std::map typedTravelDistance; + std::map typedTravelDistance; //@} }; @@ -168,8 +168,8 @@ const SUMOTime dumpBegin, const SUMOTime dumpEnd, const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, - const SUMOReal maxTravelTime, const SUMOReal minSamples, - const SUMOReal haltSpeed, const std::string& vTypes); + const double maxTravelTime, const double minSamples, + const double haltSpeed, const std::string& vTypes); /// @brief Destructor @@ -219,7 +219,7 @@ * @param[in] lane The lane to create for * @param[in] doAdd whether to add the values as reminder to the lane */ - MSMeanData::MeanDataValues* createValues(MSLane* const lane, const SUMOReal length, const bool doAdd) const; + MSMeanData::MeanDataValues* createValues(MSLane* const lane, const double length, const bool doAdd) const; /** @brief Resets network value in order to allow processing of the next interval * @@ -230,7 +230,7 @@ private: /// @brief the minimum sample seconds - const SUMOReal myHaltSpeed; + const double myHaltSpeed; /// @brief Invalidated copy constructor. MSMeanData_Amitran(const MSMeanData_Amitran&); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Mon, 10.05.2004 -/// @version $Id: MSMeanData.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSMeanData.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Data collector for edges/lanes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,10 +48,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -60,7 +56,7 @@ // MSMeanData::MeanDataValues - methods // --------------------------------------------------------------------------- MSMeanData::MeanDataValues::MeanDataValues( - MSLane* const lane, const SUMOReal length, const bool doAdd, + MSLane* const lane, const double length, const bool doAdd, const MSMeanData* const parent) : MSMoveReminder("meandata_" + (lane == 0 ? "NULL" : lane->getID()), lane, doAdd), myParent(parent), @@ -74,44 +70,44 @@ bool -MSMeanData::MeanDataValues::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason) { +MSMeanData::MeanDataValues::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { UNUSED_PARAMETER(reason); return myParent == 0 || myParent->vehicleApplies(veh); } bool -MSMeanData::MeanDataValues::notifyMove(SUMOVehicle& veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed) { +MSMeanData::MeanDataValues::notifyMove(SUMOVehicle& veh, double oldPos, double newPos, double newSpeed) { // if the vehicle has arrived, the reminder must be kept so it can be // notified of the arrival subsequently - const SUMOReal oldSpeed = veh.getPreviousSpeed(); - SUMOReal enterSpeed = MSGlobals::gSemiImplicitEulerUpdate ? newSpeed : oldSpeed; // NOTE: For the euler update, the vehicle is assumed to travel at constant speed for the whole time step - SUMOReal leaveSpeed = newSpeed, leaveSpeedFront = newSpeed; + const double oldSpeed = veh.getPreviousSpeed(); + double enterSpeed = MSGlobals::gSemiImplicitEulerUpdate ? newSpeed : oldSpeed; // NOTE: For the euler update, the vehicle is assumed to travel at constant speed for the whole time step + double leaveSpeed = newSpeed, leaveSpeedFront = newSpeed; // These values will be further decreased below - SUMOReal timeOnLane = TS; - SUMOReal frontOnLane = oldPos > myLaneLength ? 0. : TS; + double timeOnLane = TS; + double frontOnLane = oldPos > myLaneLength ? 0. : TS; bool ret = true; // Treat the case that the vehicle entered the lane in the last step if (oldPos < 0 && newPos >= 0) { // Vehicle was not on this lane in the last time step - const SUMOReal timeBeforeEnter = MSCFModel::passingTime(oldPos, 0, newPos, oldSpeed, newSpeed); + const double timeBeforeEnter = MSCFModel::passingTime(oldPos, 0, newPos, oldSpeed, newSpeed); timeOnLane = TS - timeBeforeEnter; frontOnLane = timeOnLane; enterSpeed = MSCFModel::speedAfterTime(timeBeforeEnter, oldSpeed, newPos - oldPos); } // Treat the case that the vehicle's back left the lane in the last step - const SUMOReal oldBackPos = oldPos - veh.getVehicleType().getLength(); - const SUMOReal newBackPos = newPos - veh.getVehicleType().getLength(); + const double oldBackPos = oldPos - veh.getVehicleType().getLength(); + const double newBackPos = newPos - veh.getVehicleType().getLength(); if (newBackPos > myLaneLength // vehicle's back has left the lane && oldBackPos <= myLaneLength) { // and hasn't left the lane before, XXX: this shouldn't occur, should it? For instance, in the E2 code this is not checked (Leo) assert(!MSGlobals::gSemiImplicitEulerUpdate || newSpeed != 0); // how could it move across the lane boundary otherwise // (Leo) vehicle left this lane (it can also have skipped over it in one time step -> therefore we use "timeOnLane -= ..." and ( ... - timeOnLane) below) - const SUMOReal timeBeforeLeave = MSCFModel::passingTime(oldBackPos, myLaneLength, newBackPos, oldSpeed, newSpeed); - const SUMOReal timeAfterLeave = TS - timeBeforeLeave; + const double timeBeforeLeave = MSCFModel::passingTime(oldBackPos, myLaneLength, newBackPos, oldSpeed, newSpeed); + const double timeAfterLeave = TS - timeBeforeLeave; timeOnLane -= timeAfterLeave; leaveSpeed = MSCFModel::speedAfterTime(timeBeforeLeave, oldSpeed, newPos - oldPos); // XXX: Do we really need this? Why would this "reduce rounding errors"? (Leo) Refs. #2579 @@ -126,8 +122,8 @@ if (newPos > myLaneLength && oldPos <= myLaneLength) { // vehicle's front has left the lane and has not left before assert(!MSGlobals::gSemiImplicitEulerUpdate || newSpeed != 0); - const SUMOReal timeBeforeLeave = MSCFModel::passingTime(oldPos, myLaneLength, newPos, oldSpeed, newSpeed); - const SUMOReal timeAfterLeave = TS - timeBeforeLeave; + const double timeBeforeLeave = MSCFModel::passingTime(oldPos, myLaneLength, newPos, oldSpeed, newSpeed); + const double timeAfterLeave = TS - timeBeforeLeave; frontOnLane -= timeAfterLeave; // XXX: Do we really need this? Why would this "reduce rounding errors"? (Leo) Refs. #2579 if (fabs(frontOnLane) < NUMERICAL_EPS) { // reduce rounding errors @@ -145,16 +141,16 @@ } // XXX: use this, when #2556 is fixed! Refs. #2575 -// const SUMOReal travelledDistanceFrontOnLane = MIN2(newPos, myLaneLength) - MAX2(oldPos, 0.); -// const SUMOReal travelledDistanceVehicleOnLane = MIN2(newPos, myLaneLength) - MAX2(oldPos, 0.) + MIN2(MAX2(0., newPos-myLaneLength), veh.getVehicleType().getLength()); +// const double travelledDistanceFrontOnLane = MIN2(newPos, myLaneLength) - MAX2(oldPos, 0.); +// const double travelledDistanceVehicleOnLane = MIN2(newPos, myLaneLength) - MAX2(oldPos, 0.) + MIN2(MAX2(0., newPos-myLaneLength), veh.getVehicleType().getLength()); // XXX: #2556 fixed for ballistic update - const SUMOReal travelledDistanceFrontOnLane = MSGlobals::gSemiImplicitEulerUpdate ? frontOnLane * newSpeed - : MAX2((SUMOReal)0., MIN2(newPos, myLaneLength) - MAX2(oldPos, (SUMOReal)0.)); - const SUMOReal travelledDistanceVehicleOnLane = MSGlobals::gSemiImplicitEulerUpdate ? timeOnLane * newSpeed - : MIN2(newPos, myLaneLength) - MAX2(oldPos, (SUMOReal)0.) + MIN2(MAX2((SUMOReal)0., newPos - myLaneLength), veh.getVehicleType().getLength()); + const double travelledDistanceFrontOnLane = MSGlobals::gSemiImplicitEulerUpdate ? frontOnLane * newSpeed + : MAX2(0., MIN2(newPos, myLaneLength) - MAX2(oldPos, 0.)); + const double travelledDistanceVehicleOnLane = MSGlobals::gSemiImplicitEulerUpdate ? timeOnLane * newSpeed + : MIN2(newPos, myLaneLength) - MAX2(oldPos, 0.) + MIN2(MAX2(0., newPos - myLaneLength), veh.getVehicleType().getLength()); // // XXX: no fix -// const SUMOReal travelledDistanceFrontOnLane = frontOnLane*newSpeed; -// const SUMOReal travelledDistanceVehicleOnLane = timeOnLane*newSpeed; +// const double travelledDistanceFrontOnLane = frontOnLane*newSpeed; +// const double travelledDistanceVehicleOnLane = timeOnLane*newSpeed; notifyMoveInternal(veh, frontOnLane, timeOnLane, (enterSpeed + leaveSpeedFront) / 2., (enterSpeed + leaveSpeed) / 2., travelledDistanceFrontOnLane, travelledDistanceVehicleOnLane); // notifyMoveInternal(veh, frontOnLane, timeOnLane, newSpeed, newSpeed, travelledDistanceFrontOnLane, travelledDistanceVehicleOnLane); @@ -163,7 +159,7 @@ bool -MSMeanData::MeanDataValues::notifyLeave(SUMOVehicle& /*veh*/, SUMOReal /*lastPos*/, MSMoveReminder::Notification reason) { +MSMeanData::MeanDataValues::notifyLeave(SUMOVehicle& /*veh*/, double /*lastPos*/, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { if (MSGlobals::gUseMesoSim) { return false; // reminder is re-added on every segment (@recheck for performance) } @@ -182,7 +178,7 @@ } -SUMOReal +double MSMeanData::MeanDataValues::getSamples() const { return sampleSeconds; } @@ -192,7 +188,7 @@ // MSMeanData::MeanDataValueTracker - methods // --------------------------------------------------------------------------- MSMeanData::MeanDataValueTracker::MeanDataValueTracker(MSLane* const lane, - const SUMOReal length, + const double length, const MSMeanData* const parent) : MSMeanData::MeanDataValues(lane, length, true, parent) { myCurrentData.push_back(new TrackerEntry(parent->createValues(lane, length, false))); @@ -234,13 +230,13 @@ void -MSMeanData::MeanDataValueTracker::notifyMoveInternal(const SUMOVehicle& veh, const SUMOReal frontOnLane, const SUMOReal timeOnLane, const SUMOReal meanSpeedFrontOnLane, const SUMOReal meanSpeedVehicleOnLane, const SUMOReal travelledDistanceFrontOnLane, const SUMOReal travelledDistanceVehicleOnLane) { +MSMeanData::MeanDataValueTracker::notifyMoveInternal(const SUMOVehicle& veh, const double frontOnLane, const double timeOnLane, const double meanSpeedFrontOnLane, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane) { myTrackedData[&veh]->myValues->notifyMoveInternal(veh, frontOnLane, timeOnLane, meanSpeedFrontOnLane, meanSpeedVehicleOnLane, travelledDistanceFrontOnLane, travelledDistanceVehicleOnLane); } bool -MSMeanData::MeanDataValueTracker::notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason) { +MSMeanData::MeanDataValueTracker::notifyLeave(SUMOVehicle& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { if (myParent == 0 || reason != MSMoveReminder::NOTIFICATION_SEGMENT) { myTrackedData[&veh]->myNumVehicleLeft++; } @@ -249,7 +245,7 @@ bool -MSMeanData::MeanDataValueTracker::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason) { +MSMeanData::MeanDataValueTracker::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { if (reason == MSMoveReminder::NOTIFICATION_SEGMENT) { return true; } @@ -276,8 +272,8 @@ void MSMeanData::MeanDataValueTracker::write(OutputDevice& dev, const SUMOTime period, - const SUMOReal numLanes, - const SUMOReal defaultTravelTime, + const double numLanes, + const double defaultTravelTime, const int /*numVehicles*/) const { myCurrentData.front()->myValues->write(dev, period, numLanes, defaultTravelTime, @@ -299,7 +295,7 @@ } -SUMOReal +double MSMeanData::MeanDataValueTracker::getSamples() const { return myCurrentData.front()->myValues->getSamples(); } @@ -312,8 +308,8 @@ const SUMOTime dumpBegin, const SUMOTime dumpEnd, const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, - const SUMOReal maxTravelTime, - const SUMOReal minSamples, + const double maxTravelTime, + const double minSamples, const std::string& vTypes) : MSDetectorFileOutput(id, vTypes), myMinSamples(minSamples), @@ -428,7 +424,7 @@ } if (writePrefix(dev, *data, SUMO_TAG_EDGE, getEdgeID(edge))) { data->write(dev, stopTime - startTime, - (SUMOReal)edge->getLanes().size(), + (double)edge->getLanes().size(), myPrintDefaults ? edge->getLength() / edge->getSpeedLimit() : -1.); } data->reset(true); @@ -462,7 +458,7 @@ if (myTrackVehicles) { MeanDataValues& meanData = **edgeValues.begin(); if (writePrefix(dev, meanData, SUMO_TAG_EDGE, edge->getID())) { - meanData.write(dev, stopTime - startTime, (SUMOReal)edge->getLanes().size(), myPrintDefaults ? edge->getLength() / edge->getSpeedLimit() : -1.); + meanData.write(dev, stopTime - startTime, (double)edge->getLanes().size(), myPrintDefaults ? edge->getLength() / edge->getSpeedLimit() : -1.); } meanData.reset(true); } else { @@ -473,7 +469,7 @@ meanData.reset(); } if (writePrefix(dev, *sumData, SUMO_TAG_EDGE, getEdgeID(edge))) { - sumData->write(dev, stopTime - startTime, (SUMOReal)edge->getLanes().size(), myPrintDefaults ? edge->getLength() / edge->getSpeedLimit() : -1.); + sumData->write(dev, stopTime - startTime, (double)edge->getLanes().size(), myPrintDefaults ? edge->getLength() / edge->getSpeedLimit() : -1.); } delete sumData; } @@ -539,7 +535,7 @@ void MSMeanData::writeXMLDetectorProlog(OutputDevice& dev) const { - dev.writeXMLHeader("meandata", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/meandata_file.xsd\""); + dev.writeXMLHeader("meandata", "meandata_file.xsd"); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData_Emissions.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData_Emissions.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData_Emissions.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData_Emissions.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 10.05.2004 -/// @version $Id: MSMeanData_Emissions.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSMeanData_Emissions.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Emission data collector for edges/lanes that /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -51,7 +47,7 @@ // MSMeanData_Emissions::MSLaneMeanDataValues - methods // --------------------------------------------------------------------------- MSMeanData_Emissions::MSLaneMeanDataValues::MSLaneMeanDataValues(MSLane* const lane, - const SUMOReal length, const bool doAdd, + const double length, const bool doAdd, const MSMeanData_Emissions* parent) : MSMeanData::MeanDataValues(lane, length, doAdd, parent), myEmissions() {} @@ -79,7 +75,7 @@ void -MSMeanData_Emissions::MSLaneMeanDataValues::notifyMoveInternal(const SUMOVehicle& veh, const SUMOReal /* frontOnLane */, const SUMOReal timeOnLane, const SUMOReal /*meanSpeedFrontOnLane*/, const SUMOReal meanSpeedVehicleOnLane, const SUMOReal /*travelledDistanceFrontOnLane*/, const SUMOReal travelledDistanceVehicleOnLane) { +MSMeanData_Emissions::MSLaneMeanDataValues::notifyMoveInternal(const SUMOVehicle& veh, const double /* frontOnLane */, const double timeOnLane, const double /*meanSpeedFrontOnLane*/, const double meanSpeedVehicleOnLane, const double /*travelledDistanceFrontOnLane*/, const double travelledDistanceVehicleOnLane) { sampleSeconds += timeOnLane; travelledDistance += travelledDistanceVehicleOnLane; const double a = veh.getAcceleration(); @@ -91,8 +87,8 @@ void MSMeanData_Emissions::MSLaneMeanDataValues::write(OutputDevice& dev, const SUMOTime period, - const SUMOReal /*numLanes*/, const SUMOReal defaultTravelTime, const int /*numVehicles*/) const { - const SUMOReal normFactor = SUMOReal(3600. / STEPS2TIME(period) / myLaneLength); + const double /*numLanes*/, const double defaultTravelTime, const int /*numVehicles*/) const { + const double normFactor = double(3600. / STEPS2TIME(period) / myLaneLength); dev << " CO_abs=\"" << OutputDevice::realString(myEmissions.CO, 6) << "\" CO2_abs=\"" << OutputDevice::realString(myEmissions.CO2, 6) << "\" HC_abs=\"" << OutputDevice::realString(myEmissions.HC, 6) << @@ -108,8 +104,8 @@ "\" fuel_normed=\"" << OutputDevice::realString(normFactor * myEmissions.fuel, 6) << "\" electricity_normed=\"" << OutputDevice::realString(normFactor * myEmissions.electricity, 6); if (sampleSeconds > myParent->getMinSamples()) { - SUMOReal vehFactor = myParent->getMaxTravelTime() / sampleSeconds; - SUMOReal traveltime = myParent->getMaxTravelTime(); + double vehFactor = myParent->getMaxTravelTime() / sampleSeconds; + double traveltime = myParent->getMaxTravelTime(); if (travelledDistance > 0.f) { vehFactor = MIN2(vehFactor, myLaneLength / travelledDistance); traveltime = MIN2(traveltime, myLaneLength * sampleSeconds / travelledDistance); @@ -124,7 +120,7 @@ "\" electricity_perVeh=\"" << OutputDevice::realString(myEmissions.electricity * vehFactor, 6); } else if (defaultTravelTime >= 0.) { const MSVehicleType* t = MSNet::getInstance()->getVehicleControl().getVType(); - const SUMOReal speed = MIN2(myLaneLength / defaultTravelTime, t->getMaxSpeed()); + const double speed = MIN2(myLaneLength / defaultTravelTime, t->getMaxSpeed()); dev << "\"\n traveltime=\"" << OutputDevice::realString(defaultTravelTime) << "\" CO_perVeh=\"" << OutputDevice::realString(PollutantsInterface::computeDefault(t->getEmissionClass(), PollutantsInterface::CO, speed, t->getCarFollowModel().getMaxAccel(), 0, defaultTravelTime), 6) << // @todo: give correct slope "\" CO2_perVeh=\"" << OutputDevice::realString(PollutantsInterface::computeDefault(t->getEmissionClass(), PollutantsInterface::CO2, speed, t->getCarFollowModel().getMaxAccel(), 0, defaultTravelTime), 6) << // @todo: give correct slope @@ -150,8 +146,8 @@ const bool printDefaults, const bool withInternal, const bool trackVehicles, - const SUMOReal maxTravelTime, - const SUMOReal minSamples, + const double maxTravelTime, + const double minSamples, const std::string& vTypes) : MSMeanData(id, dumpBegin, dumpEnd, useLanes, withEmpty, printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, vTypes) { @@ -162,7 +158,7 @@ MSMeanData::MeanDataValues* -MSMeanData_Emissions::createValues(MSLane* const lane, const SUMOReal length, const bool doAdd) const { +MSMeanData_Emissions::createValues(MSLane* const lane, const double length, const bool doAdd) const { return new MSLaneMeanDataValues(lane, length, doAdd, this); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData_Emissions.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData_Emissions.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData_Emissions.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData_Emissions.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 10.05.2004 -/// @version $Id: MSMeanData_Emissions.h 21652 2016-10-10 13:30:25Z luecken $ +/// @version $Id: MSMeanData_Emissions.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Emission data collector for edges/lanes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -72,7 +72,7 @@ class MSLaneMeanDataValues : public MSMeanData::MeanDataValues { public: /** @brief Constructor */ - MSLaneMeanDataValues(MSLane* const lane, const SUMOReal length, const bool doAdd, + MSLaneMeanDataValues(MSLane* const lane, const double length, const bool doAdd, const MSMeanData_Emissions* parent); /** @brief Destructor */ @@ -100,7 +100,7 @@ * @exception IOError If an error on writing occurs (!!! not yet implemented) */ void write(OutputDevice& dev, const SUMOTime period, - const SUMOReal numLanes, const SUMOReal defaultTravelTime, + const double numLanes, const double defaultTravelTime, const int numVehicles = -1) const; @@ -108,7 +108,7 @@ /** @brief Internal notification about the vehicle moves * @see MSMoveReminder::notifyMoveInternal() */ - void notifyMoveInternal(const SUMOVehicle& veh, const SUMOReal /* frontOnLane */, const SUMOReal timeOnLane, const SUMOReal /*meanSpeedFrontOnLane*/, const SUMOReal meanSpeedVehicleOnLane, const SUMOReal travelledDistanceFrontOnLane, const SUMOReal travelledDistanceVehicleOnLane); + void notifyMoveInternal(const SUMOVehicle& veh, const double /* frontOnLane */, const double timeOnLane, const double /*meanSpeedFrontOnLane*/, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane); private: @@ -137,7 +137,7 @@ const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, - const SUMOReal minSamples, const SUMOReal maxTravelTime, + const double minSamples, const double maxTravelTime, const std::string& vTypes); @@ -152,7 +152,7 @@ * @param[in] lane The lane to create for * @param[in] doAdd whether to add the values as reminder to the lane */ - MSMeanData::MeanDataValues* createValues(MSLane* const lane, const SUMOReal length, const bool doAdd) const; + MSMeanData::MeanDataValues* createValues(MSLane* const lane, const double length, const bool doAdd) const; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Tue, 17.11.2009 -/// @version $Id: MSMeanData.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSMeanData.h 23188 2017-03-02 11:59:04Z luecken $ /// // Data collector for edges/lanes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -76,7 +76,7 @@ class MeanDataValues : public MSMoveReminder { public: /** @brief Constructor */ - MeanDataValues(MSLane* const lane, const SUMOReal length, const bool doAdd, const MSMeanData* const parent); + MeanDataValues(MSLane* const lane, const double length, const bool doAdd, const MSMeanData* const parent); /** @brief Destructor */ virtual ~MeanDataValues(); @@ -101,7 +101,7 @@ * @see MSMoveReminder::notifyEnter * @see MSMoveReminder::Notification */ - virtual bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason); + virtual bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /** @brief Checks whether the reminder still has to be notified about the vehicle moves @@ -117,8 +117,8 @@ * * @return True if vehicle hasn't passed the reminder completely. */ - bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, - SUMOReal newPos, SUMOReal newSpeed); + bool notifyMove(SUMOVehicle& veh, double oldPos, + double newPos, double newSpeed); /** @brief Called if the vehicle leaves the reminder's lane @@ -129,8 +129,8 @@ * @see MSMoveReminder * @see MSMoveReminder::notifyLeave */ - virtual bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, - MSMoveReminder::Notification reason); + virtual bool notifyLeave(SUMOVehicle& veh, double lastPos, + MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /** @brief Returns whether any data was collected. @@ -152,18 +152,18 @@ * @exception IOError If an error on writing occurs (!!! not yet implemented) */ virtual void write(OutputDevice& dev, const SUMOTime period, - const SUMOReal numLanes, const SUMOReal defaultTravelTime, + const double numLanes, const double defaultTravelTime, const int numVehicles = -1) const = 0; /** @brief Returns the number of collected sample seconds. * @return the number of collected sample seconds */ - virtual SUMOReal getSamples() const; + virtual double getSamples() const; /** @brief Returns the total travelled distance. * @return the total travelled distance */ - SUMOReal getTravelledDistance() const { + double getTravelledDistance() const { return travelledDistance; } @@ -172,15 +172,15 @@ const MSMeanData* const myParent; /// @brief The length of the lane / edge the data collector is on - const SUMOReal myLaneLength; + const double myLaneLength; /// @name Collected values /// @{ /// @brief The number of sampled vehicle movements (in s) - SUMOReal sampleSeconds; + double sampleSeconds; /// @brief The sum of the distances the vehicles travelled - SUMOReal travelledDistance; + double travelledDistance; //@} }; @@ -193,7 +193,7 @@ class MeanDataValueTracker : public MeanDataValues { public: /** @brief Constructor */ - MeanDataValueTracker(MSLane* const lane, const SUMOReal length, + MeanDataValueTracker(MSLane* const lane, const double length, const MSMeanData* const parent); /** @brief Destructor */ @@ -215,7 +215,7 @@ /** @brief Internal notification about the vehicle moves * @see MSMoveReminder::notifyMoveInternal(). */ - void notifyMoveInternal(const SUMOVehicle& veh, const SUMOReal frontOnLane, const SUMOReal timeOnLane, const SUMOReal meanSpeedFrontOnLane, const SUMOReal meanSpeedVehicleOnLane, const SUMOReal travelledDistanceFrontOnLane, const SUMOReal travelledDistanceVehicleOnLane); + void notifyMoveInternal(const SUMOVehicle& veh, const double frontOnLane, const double timeOnLane, const double meanSpeedFrontOnLane, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane); /** @brief Called if the vehicle leaves the reminder's lane @@ -227,7 +227,7 @@ * @see MSMoveReminder * @see MSMoveReminder::notifyLeave */ - bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason); + bool notifyLeave(SUMOVehicle& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /** @brief Computes current values and adds them to their sums @@ -241,7 +241,7 @@ * @see MSMoveReminder::notifyEnter * @return Always true */ - bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason); + bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); //@} bool isEmpty() const; @@ -254,14 +254,14 @@ * @exception IOError If an error on writing occurs (!!! not yet implemented) */ void write(OutputDevice& dev, const SUMOTime period, - const SUMOReal numLanes, const SUMOReal defaultTravelTime, + const double numLanes, const double defaultTravelTime, const int numVehicles = -1) const; int getNumReady() const; void clearFirst(); - SUMOReal getSamples() const; + double getSamples() const; private: class TrackerEntry { @@ -313,8 +313,8 @@ const SUMOTime dumpBegin, const SUMOTime dumpEnd, const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, - const bool trackVehicles, const SUMOReal minSamples, - const SUMOReal maxTravelTime, + const bool trackVehicles, const double minSamples, + const double maxTravelTime, const std::string& vTypes); @@ -357,11 +357,11 @@ */ virtual void detectorUpdate(const SUMOTime step); - SUMOReal getMinSamples() const { + double getMinSamples() const { return myMinSamples; } - SUMOReal getMaxTravelTime() const { + double getMaxTravelTime() const { return myMaxTravelTime; } @@ -372,7 +372,7 @@ * @param[in] lane The lane to create for * @param[in] doAdd whether to add the values as reminder to the lane */ - virtual MSMeanData::MeanDataValues* createValues(MSLane* const lane, const SUMOReal length, const bool doAdd) const = 0; + virtual MSMeanData::MeanDataValues* createValues(MSLane* const lane, const double length, const bool doAdd) const = 0; /** @brief Resets network value in order to allow processing of the next interval * @@ -426,10 +426,10 @@ protected: /// @brief the minimum sample seconds - const SUMOReal myMinSamples; + const double myMinSamples; /// @brief the maximum travel time to write - const SUMOReal myMaxTravelTime; + const double myMaxTravelTime; /// @brief Value collectors; sorted by edge, then by lane std::vector > myMeasures; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData_Harmonoise.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData_Harmonoise.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData_Harmonoise.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData_Harmonoise.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 10.05.2004 -/// @version $Id: MSMeanData_Harmonoise.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSMeanData_Harmonoise.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Redirector for mean data output (net->edgecontrol) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -50,7 +46,7 @@ // --------------------------------------------------------------------------- // MSMeanData_Harmonoise::MSLaneMeanDataValues - methods // --------------------------------------------------------------------------- -MSMeanData_Harmonoise::MSLaneMeanDataValues::MSLaneMeanDataValues(MSLane* const lane, const SUMOReal length, const bool doAdd, +MSMeanData_Harmonoise::MSLaneMeanDataValues::MSLaneMeanDataValues(MSLane* const lane, const double length, const bool doAdd, const MSMeanData_Harmonoise* parent) : MSMeanData::MeanDataValues(lane, length, doAdd, parent), currentTimeN(0), meanNTemp(0), myParent(parent) {} @@ -73,24 +69,24 @@ MSMeanData_Harmonoise::MSLaneMeanDataValues::addTo(MSMeanData::MeanDataValues& val) const { MSLaneMeanDataValues& v = (MSLaneMeanDataValues&) val; v.sampleSeconds += sampleSeconds; - v.meanNTemp += (SUMOReal) pow(10., HelpersHarmonoise::sum(meanNTemp) / 10.); + v.meanNTemp += (double) pow(10., HelpersHarmonoise::sum(meanNTemp) / 10.); v.travelledDistance += travelledDistance; } void MSMeanData_Harmonoise::MSLaneMeanDataValues::update() { - meanNTemp += (SUMOReal) pow(10., HelpersHarmonoise::sum(currentTimeN) / 10.); + meanNTemp += (double) pow(10., HelpersHarmonoise::sum(currentTimeN) / 10.); currentTimeN = 0; } void -MSMeanData_Harmonoise::MSLaneMeanDataValues::notifyMoveInternal(const SUMOVehicle& veh, const SUMOReal /* frontOnLane */, const SUMOReal timeOnLane, const SUMOReal /*meanSpeedFrontOnLane*/, const SUMOReal meanSpeedVehicleOnLane, const SUMOReal /*travelledDistanceFrontOnLane*/, const SUMOReal travelledDistanceVehicleOnLane) { - const SUMOReal sn = HelpersHarmonoise::computeNoise(veh.getVehicleType().getEmissionClass(), - // XXX: recheck, which value to use here for the speed. (Leo) Refs. #2579 - (double) meanSpeedVehicleOnLane, veh.getAcceleration()); - currentTimeN += (SUMOReal) pow(10., (sn / 10.)); +MSMeanData_Harmonoise::MSLaneMeanDataValues::notifyMoveInternal(const SUMOVehicle& veh, const double /* frontOnLane */, const double timeOnLane, const double /*meanSpeedFrontOnLane*/, const double meanSpeedVehicleOnLane, const double /*travelledDistanceFrontOnLane*/, const double travelledDistanceVehicleOnLane) { + const double sn = HelpersHarmonoise::computeNoise(veh.getVehicleType().getEmissionClass(), + // XXX: recheck, which value to use here for the speed. (Leo) Refs. #2579 + (double) meanSpeedVehicleOnLane, veh.getAcceleration()); + currentTimeN += (double) pow(10., (sn / 10.)); sampleSeconds += timeOnLane; travelledDistance += travelledDistanceVehicleOnLane; } @@ -98,10 +94,10 @@ void MSMeanData_Harmonoise::MSLaneMeanDataValues::write(OutputDevice& dev, const SUMOTime period, - const SUMOReal /*numLanes*/, const SUMOReal defaultTravelTime, const int /*numVehicles*/) const { - dev.writeAttr("noise", (meanNTemp != 0 ? (SUMOReal)(10. * log10(meanNTemp * TS / STEPS2TIME(period))) : (SUMOReal) 0.)); + const double /*numLanes*/, const double defaultTravelTime, const int /*numVehicles*/) const { + dev.writeAttr("noise", (meanNTemp != 0 ? (double)(10. * log10(meanNTemp * TS / STEPS2TIME(period))) : (double) 0.)); if (sampleSeconds > myParent->myMinSamples) { - SUMOReal traveltime = myParent->myMaxTravelTime; + double traveltime = myParent->myMaxTravelTime; if (travelledDistance > 0.f) { traveltime = MIN2(traveltime, myLaneLength * sampleSeconds / travelledDistance); } @@ -123,7 +119,7 @@ const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, - const SUMOReal maxTravelTime, const SUMOReal minSamples, + const double maxTravelTime, const double minSamples, const std::string& vTypes) : MSMeanData(id, dumpBegin, dumpEnd, useLanes, withEmpty, printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, vTypes) { @@ -134,7 +130,7 @@ MSMeanData::MeanDataValues* -MSMeanData_Harmonoise::createValues(MSLane* const lane, const SUMOReal length, const bool doAdd) const { +MSMeanData_Harmonoise::createValues(MSLane* const lane, const double length, const bool doAdd) const { return new MSLaneMeanDataValues(lane, length, doAdd, this); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData_Harmonoise.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData_Harmonoise.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData_Harmonoise.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData_Harmonoise.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 10.05.2004 -/// @version $Id: MSMeanData_Harmonoise.h 21652 2016-10-10 13:30:25Z luecken $ +/// @version $Id: MSMeanData_Harmonoise.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Noise data collector for edges/lanes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -69,7 +69,7 @@ class MSLaneMeanDataValues : public MSMeanData::MeanDataValues { public: /** @brief Constructor */ - MSLaneMeanDataValues(MSLane* const lane, const SUMOReal length, const bool doAdd, + MSLaneMeanDataValues(MSLane* const lane, const double length, const bool doAdd, const MSMeanData_Harmonoise* parent); /** @brief Destructor */ @@ -101,7 +101,7 @@ * @exception IOError If an error on writing occurs (!!! not yet implemented) */ void write(OutputDevice& dev, const SUMOTime period, - const SUMOReal numLanes, const SUMOReal defaultTravelTime, + const double numLanes, const double defaultTravelTime, const int numVehicles = -1) const; @@ -109,17 +109,17 @@ /** @brief Internal notification about the vehicle moves * @see MSMoveReminder::notifyMoveInternal() */ - void notifyMoveInternal(const SUMOVehicle& veh, const SUMOReal /* frontOnLane */, const SUMOReal timeOnLane, const SUMOReal meanSpeedFrontOnLane, const SUMOReal meanSpeedVehicleOnLane, const SUMOReal travelledDistanceFrontOnLane, const SUMOReal travelledDistanceVehicleOnLane); + void notifyMoveInternal(const SUMOVehicle& veh, const double /* frontOnLane */, const double timeOnLane, const double meanSpeedFrontOnLane, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane); private: /// @name Collected values /// @{ /// @brief Sum of produced noise at this time step(pow(10, (/10.))) - SUMOReal currentTimeN; + double currentTimeN; /// @brief Sum of produced noise over time (pow(10, (/10.))) - SUMOReal meanNTemp; + double meanNTemp; //@} @@ -148,7 +148,7 @@ const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, - const SUMOReal minSamples, const SUMOReal maxTravelTime, + const double minSamples, const double maxTravelTime, const std::string& vTypes); @@ -166,7 +166,7 @@ * @param[in] lane The lane to create for * @param[in] doAdd whether to add the values as reminder to the lane */ - MSMeanData::MeanDataValues* createValues(MSLane* const lane, const SUMOReal length, const bool doAdd) const; + MSMeanData::MeanDataValues* createValues(MSLane* const lane, const double length, const bool doAdd) const; private: /// @brief Invalidated copy constructor. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData_Net.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData_Net.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData_Net.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData_Net.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Mon, 10.05.2004 -/// @version $Id: MSMeanData_Net.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSMeanData_Net.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Network state mean data collector for edges/lanes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,10 +44,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -56,7 +52,7 @@ // MSMeanData_Net::MSLaneMeanDataValues - methods // --------------------------------------------------------------------------- MSMeanData_Net::MSLaneMeanDataValues::MSLaneMeanDataValues(MSLane* const lane, - const SUMOReal length, + const double length, const bool doAdd, const MSMeanData_Net* parent) : MSMeanData::MeanDataValues(lane, length, doAdd, parent), @@ -109,7 +105,7 @@ void -MSMeanData_Net::MSLaneMeanDataValues::notifyMoveInternal(const SUMOVehicle& veh, const SUMOReal frontOnLane, const SUMOReal timeOnLane, const SUMOReal /*meanSpeedFrontOnLane*/, const SUMOReal meanSpeedVehicleOnLane, const SUMOReal travelledDistanceFrontOnLane, const SUMOReal travelledDistanceVehicleOnLane) { +MSMeanData_Net::MSLaneMeanDataValues::notifyMoveInternal(const SUMOVehicle& veh, const double frontOnLane, const double timeOnLane, const double /*meanSpeedFrontOnLane*/, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane) { sampleSeconds += timeOnLane; travelledDistance += travelledDistanceVehicleOnLane; vehLengthSum += veh.getVehicleType().getLength() * timeOnLane; @@ -123,7 +119,7 @@ bool -MSMeanData_Net::MSLaneMeanDataValues::notifyLeave(SUMOVehicle& veh, SUMOReal /*lastPos*/, MSMoveReminder::Notification reason) { +MSMeanData_Net::MSLaneMeanDataValues::notifyLeave(SUMOVehicle& veh, double /*lastPos*/, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { if ((myParent == 0 || myParent->vehicleApplies(veh)) && (getLane() == 0 || getLane() == static_cast(veh).getLane())) { if (MSGlobals::gUseMesoSim) { removeFromVehicleUpdateValues(veh); @@ -147,7 +143,7 @@ bool -MSMeanData_Net::MSLaneMeanDataValues::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason) { +MSMeanData_Net::MSLaneMeanDataValues::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { if (myParent == 0 || myParent->vehicleApplies(veh)) { if (getLane() == 0 || getLane() == static_cast(veh).getLane()) { if (reason == MSMoveReminder::NOTIFICATION_DEPARTED) { @@ -173,11 +169,11 @@ void MSMeanData_Net::MSLaneMeanDataValues::write(OutputDevice& dev, const SUMOTime period, - const SUMOReal numLanes, const SUMOReal defaultTravelTime, const int numVehicles) const { + const double numLanes, const double defaultTravelTime, const int numVehicles) const { if (myParent == 0) { if (sampleSeconds > 0) { - dev.writeAttr("density", sampleSeconds / STEPS2TIME(period) * (SUMOReal) 1000 / myLaneLength) - .writeAttr("occupancy", vehLengthSum / STEPS2TIME(period) / myLaneLength / numLanes * (SUMOReal) 100) + dev.writeAttr("density", sampleSeconds / STEPS2TIME(period) * (double) 1000 / myLaneLength) + .writeAttr("occupancy", vehLengthSum / STEPS2TIME(period) / myLaneLength / numLanes * (double) 100) .writeAttr("waitingTime", waitSeconds).writeAttr("speed", travelledDistance / sampleSeconds); } dev.writeAttr("departed", nVehDeparted).writeAttr("arrived", nVehArrived).writeAttr("entered", nVehEntered).writeAttr("left", nVehLeft); @@ -188,7 +184,7 @@ return; } if (sampleSeconds > myParent->myMinSamples) { - SUMOReal overlapTraveltime = myParent->myMaxTravelTime; + double overlapTraveltime = myParent->myMaxTravelTime; if (travelledDistance > 0.f) { // one vehicle has to drive lane length + vehicle length before it has left the lane // thus we need to scale with an extended length, approximated by lane length + average vehicle length @@ -197,7 +193,7 @@ if (numVehicles > 0) { dev.writeAttr("traveltime", sampleSeconds / numVehicles).writeAttr("waitingTime", waitSeconds).writeAttr("speed", travelledDistance / sampleSeconds); } else { - SUMOReal traveltime = myParent->myMaxTravelTime; + double traveltime = myParent->myMaxTravelTime; if (frontTravelledDistance > 0.f) { traveltime = MIN2(traveltime, myLaneLength * frontSampleSeconds / frontTravelledDistance); dev.writeAttr("traveltime", traveltime); @@ -205,8 +201,8 @@ dev.writeAttr("traveltime", defaultTravelTime); } dev.writeAttr("overlapTraveltime", overlapTraveltime) - .writeAttr("density", sampleSeconds / STEPS2TIME(period) * (SUMOReal) 1000 / myLaneLength) - .writeAttr("occupancy", vehLengthSum / STEPS2TIME(period) / myLaneLength / numLanes * (SUMOReal) 100) + .writeAttr("density", sampleSeconds / STEPS2TIME(period) * (double) 1000 / myLaneLength) + .writeAttr("occupancy", vehLengthSum / STEPS2TIME(period) / myLaneLength / numLanes * (double) 100) .writeAttr("waitingTime", waitSeconds).writeAttr("speed", travelledDistance / sampleSeconds); } } else if (defaultTravelTime >= 0.) { @@ -229,9 +225,9 @@ const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, - const SUMOReal maxTravelTime, - const SUMOReal minSamples, - const SUMOReal haltSpeed, + const double maxTravelTime, + const double minSamples, + const double haltSpeed, const std::string& vTypes) : MSMeanData(id, dumpBegin, dumpEnd, useLanes, withEmpty, printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, vTypes), @@ -243,7 +239,7 @@ MSMeanData::MeanDataValues* -MSMeanData_Net::createValues(MSLane* const lane, const SUMOReal length, const bool doAdd) const { +MSMeanData_Net::createValues(MSLane* const lane, const double length, const bool doAdd) const { return new MSLaneMeanDataValues(lane, length, doAdd, this); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData_Net.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData_Net.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSMeanData_Net.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSMeanData_Net.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Mon, 10.05.2004 -/// @version $Id: MSMeanData_Net.h 21652 2016-10-10 13:30:25Z luecken $ +/// @version $Id: MSMeanData_Net.h 23188 2017-03-02 11:59:04Z luecken $ /// // Network state mean data collector for edges/lanes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -76,7 +76,7 @@ /** @brief Constructor * @param[in] length The length of the object for which the data gets collected */ - MSLaneMeanDataValues(MSLane* const lane, const SUMOReal length, const bool doAdd, + MSLaneMeanDataValues(MSLane* const lane, const double length, const bool doAdd, const MSMeanData_Net* parent); /** @brief Destructor */ @@ -104,7 +104,7 @@ * @see MSMoveReminder * @see MSMoveReminder::notifyLeave */ - bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason); + bool notifyLeave(SUMOVehicle& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /** @brief Computes current values and adds them to their sums @@ -120,7 +120,7 @@ * @see MSMoveReminder::notifyEnter * @see MSMoveReminder::Notification */ - bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason); + bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); //@} bool isEmpty() const; @@ -133,14 +133,14 @@ * @exception IOError If an error on writing occurs (!!! not yet implemented) */ void write(OutputDevice& dev, const SUMOTime period, - const SUMOReal numLanes, const SUMOReal defaultTravelTime, + const double numLanes, const double defaultTravelTime, const int numVehicles = -1) const; protected: /** @brief Internal notification about the vehicle moves * @see MSMoveReminder::notifyMoveInternal */ - void notifyMoveInternal(const SUMOVehicle& veh, const SUMOReal frontOnLane, const SUMOReal timeOnLane, const SUMOReal meanSpeedFrontOnLane, const SUMOReal meanSpeedVehicleOnLane, const SUMOReal travelledDistanceFrontOnLane, const SUMOReal travelledDistanceVehicleOnLane); + void notifyMoveInternal(const SUMOVehicle& veh, const double frontOnLane, const double timeOnLane, const double meanSpeedFrontOnLane, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane); public: /// @name Collected values @@ -161,7 +161,7 @@ int nVehVaporized; /// @brief The number of vehicle probes with small speed - SUMOReal waitSeconds; + double waitSeconds; private: /// @brief The number of vehicles that changed from this lane @@ -171,13 +171,13 @@ int nVehLaneChangeTo; /// @brief The number of vehicle probes regarding the vehicle front - SUMOReal frontSampleSeconds; + double frontSampleSeconds; /// @brief The travelled distance regarding the vehicle front - SUMOReal frontTravelledDistance; + double frontTravelledDistance; /// @brief The sum of the lengths the vehicles had - SUMOReal vehLengthSum; + double vehLengthSum; //@} /// @brief The meandata parent @@ -206,8 +206,8 @@ const SUMOTime dumpBegin, const SUMOTime dumpEnd, const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, - const SUMOReal maxTravelTime, const SUMOReal minSamples, - const SUMOReal haltSpeed, const std::string& vTypes); + const double maxTravelTime, const double minSamples, + const double haltSpeed, const std::string& vTypes); /// @brief Destructor @@ -219,7 +219,7 @@ * @param[in] lane The lane to create for * @param[in] doAdd whether to add the values as reminder to the lane */ - MSMeanData::MeanDataValues* createValues(MSLane* const lane, const SUMOReal length, const bool doAdd) const; + MSMeanData::MeanDataValues* createValues(MSLane* const lane, const double length, const bool doAdd) const; /** @brief Resets network value in order to allow processing of the next interval * @@ -230,7 +230,7 @@ private: /// @brief the minimum sample seconds - const SUMOReal myHaltSpeed; + const double myHaltSpeed; /// @brief Invalidated copy constructor. MSMeanData_Net(const MSMeanData_Net&); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSQueueExport.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSQueueExport.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSQueueExport.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSQueueExport.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Mario Krumnow /// @author Michael Behrisch /// @date 2012-04-26 -/// @version $Id: MSQueueExport.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSQueueExport.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Export the queueing length in front of a junction (very experimental!) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,10 +45,6 @@ #include #endif -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -80,12 +76,12 @@ void MSQueueExport::writeLane(OutputDevice& of, const MSLane& lane) { // maximum of all vehicle waiting times - SUMOReal queueing_time = 0.0; + double queueing_time = 0.0; // back of last stopped vehicle (XXX does not check for continuous queue) - SUMOReal queueing_length = 0.0; + double queueing_length = 0.0; // back of last slow vehicle (XXX does not check for continuous queue) - SUMOReal queueing_length2 = 0.0; - const SUMOReal threshold_velocity = 5 / 3.6; // slow + double queueing_length2 = 0.0; + const double threshold_velocity = 5 / 3.6; // slow if (!lane.empty()) { for (MSLane::VehCont::const_iterator it_veh = lane.myVehicles.begin(); it_veh != lane.myVehicles.end(); ++it_veh) { @@ -96,13 +92,13 @@ if (veh.getWaitingSeconds() > 0) { queueing_time = MAX2(veh.getWaitingSeconds(), queueing_time); - const SUMOReal veh_back_to_lane_end = (lane.getLength() - veh.getPositionOnLane()) + veh.getVehicleType().getLength(); + const double veh_back_to_lane_end = (lane.getLength() - veh.getPositionOnLane()) + veh.getVehicleType().getLength(); queueing_length = MAX2(veh_back_to_lane_end, queueing_length); } //Experimental if (veh.getSpeed() < (threshold_velocity) && (veh.getPositionOnLane() > (veh.getLane()->getLength()) * 0.25)) { - const SUMOReal veh_back_to_lane_end = (lane.getLength() - veh.getPositionOnLane()) + veh.getVehicleType().getLength(); + const double veh_back_to_lane_end = (lane.getLength() - veh.getPositionOnLane()) + veh.getVehicleType().getLength(); queueing_length2 = MAX2(veh_back_to_lane_end, queueing_length2); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSQueueExport.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSQueueExport.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSQueueExport.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSQueueExport.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSQueueExport.h /// @author Mario Krumnow /// @date 2012-04-26 -/// @version $Id: MSQueueExport.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSQueueExport.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Export the queueing length in front of a junction (very experimental!) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSRouteProbe.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSRouteProbe.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSRouteProbe.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSRouteProbe.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Tino Morenz /// @author Jakob Erdmann /// @date Thu, 04.12.2008 -/// @version $Id: MSRouteProbe.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSRouteProbe.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Writes route distributions at a certain edge /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,10 +43,6 @@ #include #include "MSRouteProbe.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -79,9 +75,9 @@ bool -MSRouteProbe::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason) { +MSRouteProbe::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { if (reason != MSMoveReminder::NOTIFICATION_SEGMENT && reason != MSMoveReminder::NOTIFICATION_LANE_CHANGE) { - if (myCurrentRouteDistribution.second->add(1., &veh.getRoute())) { + if (myCurrentRouteDistribution.second->add(&veh.getRoute(), 1.)) { veh.getRoute().addReference(); } } @@ -95,7 +91,7 @@ if (myCurrentRouteDistribution.second->getOverallProb() > 0) { dev.openTag("routeDistribution") << " id=\"" << getID() + "_" + time2string(startTime) << "\""; const std::vector& routes = myCurrentRouteDistribution.second->getVals(); - const std::vector& probs = myCurrentRouteDistribution.second->getProbs(); + const std::vector& probs = myCurrentRouteDistribution.second->getProbs(); for (int j = 0; j < (int)routes.size(); ++j) { const MSRoute* r = routes[j]; dev.openTag("route") << " id=\"" << r->getID() + "_" + time2string(startTime) << "\" edges=\""; @@ -122,7 +118,7 @@ void MSRouteProbe::writeXMLDetectorProlog(OutputDevice& dev) const { - dev.writeXMLHeader("route-probes"); + dev.writeXMLHeader("routes", "routes_file.xsd"); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSRouteProbe.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSRouteProbe.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSRouteProbe.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSRouteProbe.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Tino Morenz /// @date Thu, 04.12.2008 -/// @version $Id: MSRouteProbe.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSRouteProbe.h 23341 2017-03-13 10:11:12Z behrisch $ /// // Writes route distributions at a certain edge /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,7 +35,7 @@ #include #include #include -#include +#include // =========================================================================== @@ -97,7 +97,7 @@ * @see MSMoveReminder::notifyEnter * @see MSMoveReminder::Notification */ - bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason); + bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /// @} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSStopOut.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSStopOut.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSStopOut.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSStopOut.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,128 @@ +/****************************************************************************/ +/// @file MSStopOut.h +/// @author Jakob Erdmann +/// @date Wed, 21.12.2016 +/// @version $Id: MSStopOut.cpp 23739 2017-03-30 12:34:00Z namdre $ +/// +// Ouput information about planned vehicle stop +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include "MSStopOut.h" + + +// --------------------------------------------------------------------------- +// static initialisation methods +// --------------------------------------------------------------------------- +MSStopOut* MSStopOut::myInstance = 0; + +void +MSStopOut::init() { + if (OptionsCont::getOptions().isSet("stop-output")) { + myInstance = new MSStopOut(OutputDevice::getDeviceByOption("stop-output")); + } +} + + +// =========================================================================== +// method definitions +// =========================================================================== +MSStopOut::MSStopOut(OutputDevice& dev) : + myDevice(dev) { +} + +MSStopOut::~MSStopOut() {} + + +void +MSStopOut::stopStarted(const SUMOVehicle* veh, int numPersons, int numContainers) { + assert(veh != 0); + if (myStopped.count(veh) != 0) { + WRITE_WARNING("Vehicle '" + veh->getID() + "' is already stopped."); + } + StopInfo stopInfo(MSNet::getInstance()->getCurrentTimeStep(), numPersons, numContainers); + myStopped[veh] = stopInfo; +} + +void +MSStopOut::loadedPersons(const SUMOVehicle* veh, int n) { + myStopped[veh].loadedPersons += n; +} + +void +MSStopOut::unloadedPersons(const SUMOVehicle* veh, int n) { + myStopped[veh].unloadedPersons += n; +} + +void +MSStopOut::loadedContainers(const SUMOVehicle* veh, int n) { + myStopped[veh].loadedContainers += n; +} + +void +MSStopOut::unloadedContainers(const SUMOVehicle* veh, int n) { + myStopped[veh].unloadedContainers += n; +} + +void +MSStopOut::stopEnded(const SUMOVehicle* veh, const MSVehicle::Stop& stop) { + assert(veh != 0); + if (myStopped.count(veh) == 0) { + WRITE_WARNING("Vehicle '" + veh->getID() + "' is not stopped."); + return; + } + StopInfo& si = myStopped[veh]; + myDevice.openTag("stopinfo"); + myDevice.writeAttr(SUMO_ATTR_ID, veh->getID()); + myDevice.writeAttr(SUMO_ATTR_TYPE, veh->getVehicleType().getID()); + myDevice.writeAttr(SUMO_ATTR_LANE, stop.lane->getID()); + myDevice.writeAttr(SUMO_ATTR_POSITION, veh->getPositionOnLane()); + myDevice.writeAttr(SUMO_ATTR_PARKING, stop.parking); + myDevice.writeAttr("started", time2string(si.started)); + myDevice.writeAttr("ended", time2string(MSNet::getInstance()->getCurrentTimeStep())); + myDevice.writeAttr("initialPersons", si.initialNumPersons); + myDevice.writeAttr("loadedPersons", si.loadedPersons); + myDevice.writeAttr("unloadedPersons", si.unloadedPersons); + myDevice.writeAttr("initialContainers", si.initialNumContainers); + myDevice.writeAttr("loadedContainers", si.loadedContainers); + myDevice.writeAttr("unloadedContainers", si.unloadedContainers); + if (stop.busstop != 0) { + myDevice.writeAttr(SUMO_ATTR_BUS_STOP, stop.busstop->getID()); + } + if (stop.containerstop != 0) { + myDevice.writeAttr(SUMO_ATTR_CONTAINER_STOP, stop.containerstop->getID()); + } + if (stop.parkingarea != 0) { + myDevice.writeAttr(SUMO_ATTR_PARKING_AREA, stop.parkingarea->getID()); + } + if (stop.chargingStation != 0) { + myDevice.writeAttr(SUMO_ATTR_CHARGING_STATION, stop.chargingStation->getID()); + } + myDevice.closeTag(); + myStopped.erase(veh); +} + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSStopOut.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSStopOut.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSStopOut.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSStopOut.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,142 @@ +/****************************************************************************/ +/// @file MSStopOut.h +/// @author Jakob Erdmann +/// @date Wed, 21.12.2016 +/// @version $Id: MSStopOut.h 22929 2017-02-13 14:38:39Z behrisch $ +/// +// Ouput information about planned vehicle stop +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef MSStopOut_h +#define MSStopOut_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include + + +// =========================================================================== +// class declarations +// =========================================================================== +class OutputDevice; +class SUMOVehicle; + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class MSStopOut + * @brief Realises dumping the complete network state + * + * The class offers a static method, which writes the complete dump of + * the given network into the given OutputDevice. + * + * @todo consider error-handling on write (using IOError) + */ +class MSStopOut { +public: + + /** @brief Static intialization + */ + static void init(); + + static bool active() { + return myInstance != 0; + } + + static MSStopOut* getInstance() { + return myInstance; + } + + /// @brief constructor. + MSStopOut(OutputDevice& dev); + + /// @brief Destructor. + virtual ~MSStopOut(); + + void stopStarted(const SUMOVehicle* veh, int numPersons, int numContainers); + + void loadedPersons(const SUMOVehicle* veh, int n); + void unloadedPersons(const SUMOVehicle* veh, int n); + + void loadedContainers(const SUMOVehicle* veh, int n); + void unloadedContainers(const SUMOVehicle* veh, int n); + + void stopEnded(const SUMOVehicle* veh, const MSVehicle::Stop& stop); + + +private: + struct StopInfo { + + StopInfo(SUMOTime t, int numPersons, int numContainers) : + started(t), + initialNumPersons(numPersons), + loadedPersons(0), + unloadedPersons(0), + initialNumContainers(numContainers), + loadedContainers(0), + unloadedContainers(0) { + } + + // @note: need default constructor or std::map doesn't work + StopInfo() : + started(-1), + initialNumPersons(0), + loadedPersons(0), + unloadedPersons(0), + initialNumContainers(0), + loadedContainers(0), + unloadedContainers(0) { + } + + SUMOTime started; + int initialNumPersons; + int loadedPersons; + int unloadedPersons; + int initialNumContainers; + int loadedContainers; + int unloadedContainers; + }; + + typedef std::map Stopped; + Stopped myStopped; + + OutputDevice& myDevice; + + static MSStopOut* myInstance; + + /// @brief Invalidated copy constructor. + MSStopOut(const MSStopOut&); + + /// @brief Invalidated assignment operator. + MSStopOut& operator=(const MSStopOut&); + + +}; + + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSVTKExport.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSVTKExport.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSVTKExport.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSVTKExport.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 2012-04-26 -/// @version $Id: MSVTKExport.cpp 21217 2016-07-22 10:57:44Z behrisch $ +/// @version $Id: MSVTKExport.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Realises VTK Export /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,10 +48,6 @@ #include #endif -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSVTKExport.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSVTKExport.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSVTKExport.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSVTKExport.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSVTKExport.h /// @author Mario Krumnow /// @date 2012-04-26 -/// @version $Id: MSVTKExport.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSVTKExport.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Produce a VTK output to use with Tools like ParaView /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSVTypeProbe.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSVTypeProbe.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSVTypeProbe.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSVTypeProbe.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Wed, 24.10.2007 -/// @version $Id: MSVTypeProbe.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSVTypeProbe.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // Writes positions of vehicles that have a certain (named) type /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,10 +41,6 @@ #include "MSVTypeProbe.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -53,8 +49,8 @@ const std::string& vType, OutputDevice& od, SUMOTime frequency) : Named(id), myVType(vType), myOutputDevice(od), myFrequency(frequency) { - MSNet::getInstance()->getEndOfTimestepEvents()->addEvent(this, 0, MSEventControl::ADAPT_AFTER_EXECUTION); - myOutputDevice.writeXMLHeader("vehicle-type-probes"); + MSNet::getInstance()->getEndOfTimestepEvents()->addEvent(this); + myOutputDevice.writeXMLHeader("vehicle-type-probes", "vtypeprobe_file.xsd"); } @@ -88,7 +84,7 @@ } if (GeoConvHelper::getFinal().usingGeoProjection()) { GeoConvHelper::getFinal().cartesian2geo(pos); - myOutputDevice.setPrecision(GEO_OUTPUT_ACCURACY); + myOutputDevice.setPrecision(gPrecisionGeo); myOutputDevice.writeAttr(SUMO_ATTR_LAT, pos.y()); myOutputDevice.writeAttr(SUMO_ATTR_LON, pos.x()); myOutputDevice.setPrecision(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSVTypeProbe.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSVTypeProbe.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSVTypeProbe.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSVTypeProbe.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 24.10.2007 -/// @version $Id: MSVTypeProbe.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSVTypeProbe.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Writes positions of vehicles that have a certain (named) type /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSXMLRawOut.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSXMLRawOut.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSXMLRawOut.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSXMLRawOut.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Bjoern Hendriks /// @author Michael Behrisch /// @date Mon, 10.05.2004 -/// @version $Id: MSXMLRawOut.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSXMLRawOut.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Realises dumping the complete network state /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,10 +47,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -64,7 +60,7 @@ for (MSEdgeVector::const_iterator e = edges.begin(); e != edges.end(); ++e) { writeEdge(of, **e, timestep); } - of.setPrecision(OUTPUT_ACCURACY); + of.setPrecision(gPrecision); of.closeTag(); } @@ -153,7 +149,7 @@ const MSVehicle& microVeh = static_cast(veh); // microsim-specific stuff if (MSGlobals::gLateralResolution > 0) { - const SUMOReal posLat = microVeh.getLateralPositionOnLane(); + const double posLat = microVeh.getLateralPositionOnLane(); of.writeAttr(SUMO_ATTR_POSITION_LAT, posLat); } const int personNumber = microVeh.getPersonNumber(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSXMLRawOut.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSXMLRawOut.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/output/MSXMLRawOut.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/output/MSXMLRawOut.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Bjoern Hendriks /// @author Michael Behrisch /// @date Mon, 10.05.2004 -/// @version $Id: MSXMLRawOut.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSXMLRawOut.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Realises dumping the complete network state /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/pedestrians/MSPerson.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/pedestrians/MSPerson.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/pedestrians/MSPerson.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/pedestrians/MSPerson.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Mon, 9 Jul 2001 -/// @version $Id: MSPerson.cpp 20773 2016-05-20 13:43:03Z behrisch $ +/// @version $Id: MSPerson.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The class for modelling person-movements /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,10 +47,6 @@ #include #include "MSPModel.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== @@ -59,12 +55,13 @@ * ----------------------------------------------------------------------- */ MSPerson::MSPersonStage_Walking::MSPersonStage_Walking(const ConstMSEdgeVector& route, MSStoppingPlace* toStop, - SUMOTime walkingTime, SUMOReal speed, - SUMOReal departPos, SUMOReal arrivalPos) : + SUMOTime walkingTime, double speed, + double departPos, double arrivalPos, double departPosLat) : MSTransportable::Stage(*route.back(), toStop, SUMOVehicleParameter::interpretEdgePos( arrivalPos, route.back()->getLength(), SUMO_ATTR_ARRIVALPOS, "person walking to " + route.back()->getID()), MOVING_WITHOUT_VEHICLE), myWalkingTime(walkingTime), myRoute(route), myCurrentInternalEdge(0), myDepartPos(departPos), + myDepartPosLat(departPosLat), mySpeed(speed), myPedestrianState(0) { myDepartPos = SUMOVehicleParameter::interpretEdgePos( @@ -95,7 +92,7 @@ } -SUMOReal +double MSPerson::MSPersonStage_Walking::getEdgePos(SUMOTime now) const { return myPedestrianState->getEdgePos(*this, now); } @@ -107,7 +104,7 @@ } -SUMOReal +double MSPerson::MSPersonStage_Walking::getAngle(SUMOTime now) const { return myPedestrianState->getAngle(*this, now); } @@ -119,12 +116,17 @@ } -SUMOReal +double MSPerson::MSPersonStage_Walking::getSpeed() const { return myPedestrianState->getSpeed(*this); } +ConstMSEdgeVector +MSPerson::MSPersonStage_Walking::getEdges() const { + return myRoute; +} + void MSPerson::MSPersonStage_Walking::proceed(MSNet* net, MSTransportable* person, SUMOTime now, Stage* previous) { previous->getEdge()->removePerson(person); @@ -145,10 +147,21 @@ (*myRouteStep)->addPerson(person); } +void +MSPerson::MSPersonStage_Walking::abort(MSTransportable*) { + MSPModel::getModel()->remove(myPedestrianState); + myPedestrianState = 0; +} + +void +MSPerson::MSPersonStage_Walking::setSpeed(double speed) { + mySpeed = speed; +} + -SUMOReal +double MSPerson::MSPersonStage_Walking::computeAverageSpeed() const { - SUMOReal length = 0; + double length = 0; for (ConstMSEdgeVector::const_iterator i = myRoute.begin(); i != myRoute.end(); ++i) { length += (*i)->getLength(); } @@ -221,7 +234,7 @@ * MSPerson::MSPersonStage_Driving - methods * ----------------------------------------------------------------------- */ MSPerson::MSPersonStage_Driving::MSPersonStage_Driving(const MSEdge& destination, - MSStoppingPlace* toStop, const SUMOReal arrivalPos, const std::vector& lines) + MSStoppingPlace* toStop, const double arrivalPos, const std::vector& lines) : MSTransportable::Stage_Driving(destination, toStop, arrivalPos, lines) {} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/pedestrians/MSPerson.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/pedestrians/MSPerson.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/pedestrians/MSPerson.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/pedestrians/MSPerson.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Mon, 9 Jul 2001 -/// @version $Id: MSPerson.h 20768 2016-05-20 08:38:44Z behrisch $ +/// @version $Id: MSPerson.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The class for modelling person-movements /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -80,7 +80,8 @@ public: /// constructor - MSPersonStage_Walking(const ConstMSEdgeVector& route, MSStoppingPlace* toStop, SUMOTime walkingTime, SUMOReal speed, SUMOReal departPos, SUMOReal arrivalPos); + MSPersonStage_Walking(const ConstMSEdgeVector& route, MSStoppingPlace* toStop, SUMOTime walkingTime, + double speed, double departPos, double arrivalPos, double departPosLat); /// destructor ~MSPersonStage_Walking(); @@ -88,19 +89,28 @@ /// proceeds to the next step virtual void proceed(MSNet* net, MSTransportable* person, SUMOTime now, Stage* previous); + /// abort this stage (TraCI) + void abort(MSTransportable*); + + /// sets the walking speed (ignored in other stages) + void setSpeed(double speed); + /// Returns the current edge const MSEdge* getEdge() const; const MSEdge* getFromEdge() const; - SUMOReal getEdgePos(SUMOTime now) const; + double getEdgePos(SUMOTime now) const; /// Position getPosition(SUMOTime now) const; - SUMOReal getAngle(SUMOTime now) const; + double getAngle(SUMOTime now) const; SUMOTime getWaitingTime(SUMOTime now) const; - SUMOReal getSpeed() const; + double getSpeed() const; + + /// @brief the edges of the current stage + ConstMSEdgeVector getEdges() const; std::string getStageDescription() const { return "walking"; @@ -136,13 +146,18 @@ /// @brief accessors to be used by MSPModel //@{ - inline SUMOReal getMaxSpeed() const { + inline double getMaxSpeed() const { return mySpeed; } - inline SUMOReal getDepartPos() const { + inline double getDepartPos() const { return myDepartPos; } - inline SUMOReal getArrivalPos() const { + + inline double getDepartPosLat() const { + return myDepartPosLat; + } + + inline double getArrivalPos() const { return myArrivalPos; } @@ -165,8 +180,8 @@ private: /* @brief compute average speed if the total walking duration is given - * @note Must be callled when the previous stage changes myDepartPos from the default*/ - SUMOReal computeAverageSpeed() const; + * @note Must be called when the previous stage changes myDepartPos from the default*/ + double computeAverageSpeed() const; private: @@ -182,8 +197,9 @@ /// @brief The current internal edge this person is on or 0 MSEdge* myCurrentInternalEdge; - SUMOReal myDepartPos; - SUMOReal mySpeed; + double myDepartPos; + double myDepartPosLat; + double mySpeed; /// @brief state that is to be manipulated by MSPModel PedestrianState* myPedestrianState; @@ -194,7 +210,7 @@ explicit arrival_finder(SUMOTime time) : myTime(time) {} /// comparison operator - bool operator()(SUMOReal t) const { + bool operator()(double t) const { return myTime > t; } @@ -220,7 +236,7 @@ public: /// constructor MSPersonStage_Driving(const MSEdge& destination, MSStoppingPlace* toStop, - const SUMOReal arrivalPos, const std::vector& lines); + const double arrivalPos, const std::vector& lines); /// destructor ~MSPersonStage_Driving(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/pedestrians/MSPModel.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/pedestrians/MSPModel.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/pedestrians/MSPModel.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/pedestrians/MSPModel.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSPModel.h /// @author Jakob Erdmann /// @date Mon, 13 Jan 2014 -/// @version $Id: MSPModel.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSPModel.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // The pedestrian following model (prototype) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -50,9 +50,9 @@ const int MSPModel::UNDEFINED_DIRECTION(0); // parameters shared by all models -const SUMOReal MSPModel::SAFETY_GAP(1.0); +const double MSPModel::SAFETY_GAP(1.0); -const SUMOReal MSPModel::SIDEWALK_OFFSET(3); +const double MSPModel::SIDEWALK_OFFSET(3); // =========================================================================== // MSPModel method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/pedestrians/MSPModel.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/pedestrians/MSPModel.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/pedestrians/MSPModel.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/pedestrians/MSPModel.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSPModel.h /// @author Jakob Erdmann /// @date Mon, 13 Jan 2014 -/// @version $Id: MSPModel.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSPModel.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The pedestrian following model (prototype) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -64,8 +64,11 @@ /// @brief register the given person as a pedestrian virtual PedestrianState* add(MSPerson* person, MSPerson::MSPersonStage_Walking* stage, SUMOTime now) = 0; + /// @brief remove the specified person from the pedestrian simulation + virtual void remove(PedestrianState* state) = 0; + /// @brief whether a pedestrian is blocking the crossing of lane at offset distToCrossing - virtual bool blockedAtDist(const MSLane* lane, SUMOReal distToCrossing, std::vector* collectBlockers) = 0; + virtual bool blockedAtDist(const MSLane* lane, double distToCrossing, std::vector* collectBlockers) = 0; virtual void cleanupHelper() {}; @@ -75,10 +78,10 @@ static const int UNDEFINED_DIRECTION; // @brief the safety gap to keep between the car and the pedestrian in all directions - static const SUMOReal SAFETY_GAP; + static const double SAFETY_GAP; /// @brief the offset for computing person positions when walking on edges without a sidewalk - static const SUMOReal SIDEWALK_OFFSET; + static const double SIDEWALK_OFFSET; /// @brief return whether the route may traversed with the given starting direction static bool canTraverse(int dir, const ConstMSEdgeVector& route); @@ -95,19 +98,19 @@ virtual ~PedestrianState() {}; /// @brief return the offset from the start of the current edge measured in its natural direction - virtual SUMOReal getEdgePos(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const = 0; + virtual double getEdgePos(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const = 0; /// @brief return the network coordinate of the person virtual Position getPosition(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const = 0; /// @brief return the direction in which the person faces in degrees - virtual SUMOReal getAngle(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const = 0; + virtual double getAngle(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const = 0; /// @brief return the time the person spent standing virtual SUMOTime getWaitingTime(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const = 0; /// @brief return the current speed of the person - virtual SUMOReal getSpeed(const MSPerson::MSPersonStage_Walking& stage) const = 0; + virtual double getSpeed(const MSPerson::MSPersonStage_Walking& stage) const = 0; /// @brief return the list of internal edges if the pedestrian is on an intersection virtual const MSEdge* getNextEdge(const MSPerson::MSPersonStage_Walking& stage) const = 0; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/pedestrians/MSPModel_NonInteracting.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/pedestrians/MSPModel_NonInteracting.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/pedestrians/MSPModel_NonInteracting.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/pedestrians/MSPModel_NonInteracting.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,7 +2,7 @@ /// @file MSPModel_NonInteracting.h /// @author Jakob Erdmann /// @date Mon, 13 Jan 2014 -/// @version $Id: MSPModel_NonInteracting.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSPModel_NonInteracting.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // The pedestrian following model (prototype) /****************************************************************************/ @@ -74,24 +74,33 @@ PedestrianState* MSPModel_NonInteracting::add(MSPerson* person, MSPerson::MSPersonStage_Walking* stage, SUMOTime now) { - PState* state = new PState(); + MoveToNextEdge* cmd = new MoveToNextEdge(person, *stage); + PState* state = new PState(cmd); const SUMOTime firstEdgeDuration = state->computeWalkingTime(0, *stage, now); - myNet->getBeginOfTimestepEvents()->addEvent(new MoveToNextEdge(person, *stage), - now + firstEdgeDuration, MSEventControl::ADAPT_AFTER_EXECUTION); + myNet->getBeginOfTimestepEvents()->addEvent(cmd, now + firstEdgeDuration); //if DEBUGCOND(person->getID()) std::cout << SIMTIME << " " << person->getID() << " inserted on " << stage->getEdge()->getID() << "\n"; return state; } +void +MSPModel_NonInteracting::remove(PedestrianState* state) { + dynamic_cast(state)->getCommand()->abortWalk(); +} + + bool -MSPModel_NonInteracting::blockedAtDist(const MSLane*, SUMOReal, std::vector*) { +MSPModel_NonInteracting::blockedAtDist(const MSLane*, double, std::vector*) { return false; } SUMOTime MSPModel_NonInteracting::MoveToNextEdge::execute(SUMOTime currentTime) { + if (myPerson == 0) { + return 0; // descheduled + } PState* state = dynamic_cast(myParent.getPedestrianState()); const MSEdge* old = myParent.getEdge(); const bool arrived = myParent.moveToNextEdge(myPerson, currentTime); @@ -136,7 +145,7 @@ } -SUMOReal +double MSPModel_NonInteracting::PState::getEdgePos(const MSPerson::MSPersonStage_Walking&, SUMOTime now) const { //std::cout << SIMTIME << " pos=" << (myCurrentBeginPos + (myCurrentEndPos - myCurrentBeginPos) / myCurrentDuration * (now - myLastEntryTime)) << "\n"; return myCurrentBeginPos + (myCurrentEndPos - myCurrentBeginPos) / myCurrentDuration * (now - myLastEntryTime); @@ -146,15 +155,15 @@ Position MSPModel_NonInteracting::PState::getPosition(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const { const MSLane* lane = getSidewalk(stage.getEdge()); - const SUMOReal lateral_offset = lane->allowsVehicleClass(SVC_PEDESTRIAN) ? 0 : SIDEWALK_OFFSET; + const double lateral_offset = lane->allowsVehicleClass(SVC_PEDESTRIAN) ? 0 : SIDEWALK_OFFSET; return stage.getLanePosition(lane, getEdgePos(stage, now), lateral_offset); } -SUMOReal +double MSPModel_NonInteracting::PState::getAngle(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const { //std::cout << SIMTIME << " rawAngle=" << stage.getEdgeAngle(stage.getEdge(), getEdgePos(stage, now)) << " angle=" << stage.getEdgeAngle(stage.getEdge(), getEdgePos(stage, now)) + (myCurrentEndPos < myCurrentBeginPos ? 180 : 0) << "\n"; - SUMOReal angle = stage.getEdgeAngle(stage.getEdge(), getEdgePos(stage, now)) + (myCurrentEndPos < myCurrentBeginPos ? M_PI : 0); + double angle = stage.getEdgeAngle(stage.getEdge(), getEdgePos(stage, now)) + (myCurrentEndPos < myCurrentBeginPos ? M_PI : 0); if (angle > M_PI) { angle -= 2 * M_PI; } @@ -168,7 +177,7 @@ } -SUMOReal +double MSPModel_NonInteracting::PState::getSpeed(const MSPerson::MSPersonStage_Walking& stage) const { return stage.getMaxSpeed(); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/pedestrians/MSPModel_NonInteracting.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/pedestrians/MSPModel_NonInteracting.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/pedestrians/MSPModel_NonInteracting.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/pedestrians/MSPModel_NonInteracting.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSPModel_NonInteracting.h /// @author Jakob Erdmann /// @date Mon, 13 Jan 2014 -/// @version $Id: MSPModel_NonInteracting.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSPModel_NonInteracting.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The pedestrian following model (prototype) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -64,8 +64,11 @@ /// @brief register the given person as a pedestrian PedestrianState* add(MSPerson* person, MSPerson::MSPersonStage_Walking* stage, SUMOTime now); + /// @brief remove the specified person from the pedestrian simulation + void remove(PedestrianState* state); + /// @brief whether a pedestrian is blocking the crossing of lane at offset distToCrossing - bool blockedAtDist(const MSLane* lane, SUMOReal distToCrossing, std::vector* collectBlockers); + bool blockedAtDist(const MSLane* lane, double distToCrossing, std::vector* collectBlockers); private: class MoveToNextEdge : public Command { @@ -73,6 +76,9 @@ MoveToNextEdge(MSPerson* person, MSPerson::MSPersonStage_Walking& walk) : myParent(walk), myPerson(person) {} ~MoveToNextEdge() {} SUMOTime execute(SUMOTime currentTime); + void abortWalk() { + myPerson = 0; + } private: MSPerson::MSPersonStage_Walking& myParent; @@ -85,27 +91,30 @@ /// @brief abstract base class for managing callbacks to retrieve various state information from the model class PState : public PedestrianState { public: - PState() {}; + PState(MoveToNextEdge* cmd): myCommand(cmd) {}; /// @brief abstract methods inherited from PedestrianState /// @{ - SUMOReal getEdgePos(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const; + double getEdgePos(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const; Position getPosition(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const; - SUMOReal getAngle(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const; + double getAngle(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const; SUMOTime getWaitingTime(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const; - SUMOReal getSpeed(const MSPerson::MSPersonStage_Walking& stage) const; + double getSpeed(const MSPerson::MSPersonStage_Walking& stage) const; const MSEdge* getNextEdge(const MSPerson::MSPersonStage_Walking& stage) const; /// @} /// @brief compute walking time on edge and update state members SUMOTime computeWalkingTime(const MSEdge* prev, const MSPerson::MSPersonStage_Walking& stage, SUMOTime currentTime); - + MoveToNextEdge* getCommand() { + return myCommand; + } private: SUMOTime myLastEntryTime; SUMOTime myCurrentDuration; - SUMOReal myCurrentBeginPos; - SUMOReal myCurrentEndPos; + double myCurrentBeginPos; + double myCurrentEndPos; + MoveToNextEdge* myCommand; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/pedestrians/MSPModel_Striping.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/pedestrians/MSPModel_Striping.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/pedestrians/MSPModel_Striping.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/pedestrians/MSPModel_Striping.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 13 Jan 2014 -/// @version $Id: MSPModel_Striping.cpp 21038 2016-06-27 06:15:50Z namdre $ +/// @version $Id: MSPModel_Striping.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The pedestrian following model (prototype) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -67,36 +67,37 @@ // =========================================================================== // distances are comparable with lower values being "more important" -#define DIST_FAR_AWAY 10000 -#define DIST_BEHIND 1000 -#define DIST_OVERLAP -1 - +const double MSPModel_Striping::DIST_FAR_AWAY(10000); +const double MSPModel_Striping::DIST_BEHIND(1000); +const double MSPModel_Striping::DIST_OVERLAP(-1); // =========================================================================== // static members // =========================================================================== MSPModel_Striping::WalkingAreaPaths MSPModel_Striping::myWalkingAreaPaths; +MSPModel_Striping::MinNextLengths MSPModel_Striping::myMinNextLengths; MSPModel_Striping::Pedestrians MSPModel_Striping::noPedestrians; // model parameters (static to simplify access from class PState -SUMOReal MSPModel_Striping::stripeWidth; -SUMOReal MSPModel_Striping::dawdling; +double MSPModel_Striping::stripeWidth; +double MSPModel_Striping::dawdling; SUMOTime MSPModel_Striping::jamTime; -const SUMOReal MSPModel_Striping::LOOKAHEAD_SAMEDIR(4.0); // seconds -const SUMOReal MSPModel_Striping::LOOKAHEAD_ONCOMING(10.0); // seconds -const SUMOReal MSPModel_Striping::LATERAL_PENALTY(-1.); // meters -const SUMOReal MSPModel_Striping::OBSTRUCTED_PENALTY(-300000.); // meters -const SUMOReal MSPModel_Striping::INAPPROPRIATE_PENALTY(-20000.); // meters -const SUMOReal MSPModel_Striping::ONCOMING_CONFLICT_PENALTY(-1000.); // meters -const SUMOReal MSPModel_Striping::OBSTRUCTION_THRESHOLD(MSPModel_Striping::OBSTRUCTED_PENALTY * 0.5); // despite obstruction, additional utility may have been added -const SUMOReal MSPModel_Striping::SQUEEZE(0.7); -const SUMOReal MSPModel_Striping::BLOCKER_LOOKAHEAD(10.0); // meters -const SUMOReal MSPModel_Striping::RESERVE_FOR_ONCOMING_FACTOR(0.0); -const SUMOReal MSPModel_Striping::MAX_WAIT_TOLERANCE(120.); // seconds -const SUMOReal MSPModel_Striping::LATERAL_SPEED_FACTOR(0.4); -const SUMOReal MSPModel_Striping::MIN_STARTUP_DIST(0.4); // meters +const double MSPModel_Striping::LOOKAHEAD_SAMEDIR(4.0); // seconds +const double MSPModel_Striping::LOOKAHEAD_ONCOMING(10.0); // seconds +const double MSPModel_Striping::LATERAL_PENALTY(-1.); // meters +const double MSPModel_Striping::OBSTRUCTED_PENALTY(-300000.); // meters +const double MSPModel_Striping::INAPPROPRIATE_PENALTY(-20000.); // meters +const double MSPModel_Striping::ONCOMING_CONFLICT_PENALTY(-1000.); // meters +const double MSPModel_Striping::OBSTRUCTION_THRESHOLD(MSPModel_Striping::OBSTRUCTED_PENALTY * 0.5); // despite obstruction, additional utility may have been added +const double MSPModel_Striping::SQUEEZE(0.7); +const double MSPModel_Striping::BLOCKER_LOOKAHEAD(10.0); // meters +const double MSPModel_Striping::RESERVE_FOR_ONCOMING_FACTOR(0.0); +const double MSPModel_Striping::RESERVE_FOR_ONCOMING_FACTOR_JUNCTIONS(0.34); +const double MSPModel_Striping::MAX_WAIT_TOLERANCE(120.); // seconds +const double MSPModel_Striping::LATERAL_SPEED_FACTOR(0.4); +const double MSPModel_Striping::MIN_STARTUP_DIST(0.4); // meters // =========================================================================== @@ -106,7 +107,7 @@ MSPModel_Striping::MSPModel_Striping(const OptionsCont& oc, MSNet* net) : myNumActivePedestrians(0) { myCommand = new MovePedestrians(this); - net->getBeginOfTimestepEvents()->addEvent(myCommand, net->getCurrentTimeStep() + DELTA_T, MSEventControl::ADAPT_AFTER_EXECUTION); + net->getBeginOfTimestepEvents()->addEvent(myCommand, net->getCurrentTimeStep() + DELTA_T); initWalkingAreaPaths(net); // configurable parameters stripeWidth = oc.getFloat("pedestrian.striping.stripe-width"); @@ -134,15 +135,29 @@ } +void +MSPModel_Striping::remove(PedestrianState* state) { + const MSLane* lane = dynamic_cast(state)->myLane; + Pedestrians& pedestrians = myActiveLanes[lane]; + for (Pedestrians::iterator it = pedestrians.begin(); it != pedestrians.end(); ++it) { + if (*it == state) { + delete state; + pedestrians.erase(it); + return; + } + } +} + + bool -MSPModel_Striping::blockedAtDist(const MSLane* lane, SUMOReal distToCrossing, std::vector* collectBlockers) { +MSPModel_Striping::blockedAtDist(const MSLane* lane, double distToCrossing, std::vector* collectBlockers) { const Pedestrians& pedestrians = getPedestrians(lane); for (Pedestrians::const_iterator it_ped = pedestrians.begin(); it_ped != pedestrians.end(); ++it_ped) { const PState& ped = **it_ped; - const SUMOReal halfVehicleWidth = 1.0; // @note could get the actual value from the vehicle - const SUMOReal leaderBackDist = (ped.myDir == FORWARD - ? distToCrossing - (ped.myRelX - ped.getLength() - MSPModel::SAFETY_GAP - halfVehicleWidth) - : (ped.myRelX + ped.getLength() + MSPModel::SAFETY_GAP + halfVehicleWidth) - distToCrossing); + const double halfVehicleWidth = 1.0; // @note could get the actual value from the vehicle + const double leaderBackDist = (ped.myDir == FORWARD + ? distToCrossing - (ped.myRelX - ped.getLength() - MSPModel::SAFETY_GAP - halfVehicleWidth) + : (ped.myRelX + ped.getLength() + MSPModel::SAFETY_GAP + halfVehicleWidth) - distToCrossing); //std::cout << SIMTIME << " foe=" << foeLane->getID() << " dir=" << p.myDir << " pX=" << ped.myRelX << " pL=" << ped.getLength() << " fDTC=" << distToCrossing << " lBD=" << leaderBackDist << "\n"; if (leaderBackDist >= 0 && leaderBackDist <= BLOCKER_LOOKAHEAD) { // found one pedestrian that is not completely past the crossing point @@ -184,6 +199,7 @@ myActiveLanes.clear(); myNumActivePedestrians = 0; myWalkingAreaPaths.clear(); // need to recompute when lane pointers change + myMinNextLengths.clear(); } @@ -215,10 +231,11 @@ const MSEdge* edge = *i; if (edge->isWalkingArea()) { const MSLane* walkingArea = getSidewalk(edge); + myMinNextLengths[walkingArea] = walkingArea->getLength(); // build all possible paths across this walkingArea // gather all incident lanes std::vector lanes; - const MSEdgeVector& incoming = edge->getIncomingEdges(); + const MSEdgeVector& incoming = edge->getPredecessors(); for (int j = 0; j < (int)incoming.size(); ++j) { lanes.push_back(getSidewalk(incoming[j])); } @@ -238,8 +255,8 @@ PositionVector shape; Position fromPos = from->getShape()[fromDir == FORWARD ? -1 : 0]; Position toPos = to->getShape()[toDir == FORWARD ? 0 : -1]; - const SUMOReal maxExtent = fromPos.distanceTo2D(toPos) / 4; // prevent sharp corners - const SUMOReal extrapolateBy = MIN2(maxExtent, walkingArea->getWidth() / 2); + const double maxExtent = fromPos.distanceTo2D(toPos) / 4; // prevent sharp corners + const double extrapolateBy = MIN2(maxExtent, walkingArea->getWidth() / 2); // assemble shape shape.push_back(fromPos); if (extrapolateBy > POSITION_EPS) { @@ -261,7 +278,9 @@ // will be walking backward on walkingArea shape = shape.reverse(); } - myWalkingAreaPaths[std::make_pair(from, to)] = WalkingAreaPath(from, walkingArea, to, shape); + WalkingAreaPath wap = WalkingAreaPath(from, walkingArea, to, shape); + myWalkingAreaPaths[std::make_pair(from, to)] = wap; + myMinNextLengths[walkingArea] = MIN2(myMinNextLengths[walkingArea], wap.length); } } } @@ -303,9 +322,9 @@ // departPos can be 0 because the direction of the walkingArea does not matter // for the arrivalPos, we need to make sure that the route does not deviate across other junctions const int nextRouteEdgeDir = nextRouteEdge->getFromJunction() == junction ? FORWARD : BACKWARD; - const SUMOReal arrivalPos = (nextRouteEdge == ped.myStage->getRoute().back() - ? ped.myStage->getArrivalPos() - : (nextRouteEdgeDir == FORWARD ? 0 : nextRouteEdge->getLength())); + const double arrivalPos = (nextRouteEdge == ped.myStage->getRoute().back() + ? ped.myStage->getArrivalPos() + : (nextRouteEdgeDir == FORWARD ? 0 : nextRouteEdge->getLength())); MSEdgeVector prohibited; prohibited.push_back(&prevLane->getEdge()); MSNet::getInstance()->getPedestrianRouter(prohibited).compute(currentEdge, nextRouteEdge, 0, arrivalPos, ped.myStage->getMaxSpeed(), 0, junction, crossingRoute, true); @@ -366,24 +385,20 @@ // direct links only exist if built explicitly. They are used to model tl-controlled links if there are no crossings if (ped.myDir == FORWARD) { link = MSLinkContHelper::getConnectingLink(*currentLane, *nextRouteLane); -#ifdef HAVE_INTERNAL_LANES if (link != 0) { if DEBUGCOND(ped.myPerson->getID()) { std::cout << " direct forward\n"; } nextLane = MSLinkContHelper::getInternalFollowingLane(currentLane, nextRouteLane); } -#endif } else { link = MSLinkContHelper::getConnectingLink(*nextRouteLane, *currentLane); -#ifdef HAVE_INTERNAL_LANES if (link != 0) { if DEBUGCOND(ped.myPerson->getID()) { std::cout << " direct backward\n"; } nextLane = MSLinkContHelper::getInternalFollowingLane(nextRouteLane, currentLane); } -#endif } } if (nextLane == 0) { @@ -476,48 +491,69 @@ } +int +MSPModel_Striping::getStripeOffset(int origStripes, int destStripes, bool addRemainder) { + int offset = (destStripes - origStripes) / 2; + if (addRemainder) { + offset += (destStripes - origStripes) % 2; + } + return offset; +} + + const MSPModel_Striping::Obstacles& MSPModel_Striping::getNextLaneObstacles(NextLanesObstacles& nextLanesObs, const - MSLane* lane, const MSLane* nextLane, int stripes, SUMOReal nextLength, int nextDir, - SUMOReal currentLength, int currentDir) { + MSLane* lane, const MSLane* nextLane, int stripes, int nextDir, + double currentLength, int currentDir) { if (nextLanesObs.count(nextLane) == 0) { + const double nextLength = nextLane->getEdge().isWalkingArea() ? myMinNextLengths[nextLane] : nextLane->getLength(); + // figure out the which pedestrians are ahead on the next lane + const int nextStripes = numStripes(nextLane); + // do not move past the end of the next lane in a single step + Obstacles obs(stripes, Obstacle(nextDir == FORWARD ? nextLength : 0, 0, "nextEnd", 0, true)); + + const int offset = getStripeOffset(nextStripes, stripes, currentDir != nextDir && nextStripes > stripes); //std::cout << SIMTIME << " getNextLaneObstacles" // << " nextLane=" << nextLane->getID() // << " nextLength=" << nextLength // << " nextDir=" << nextDir // << " currentLength=" << currentLength // << " currentDir=" << currentDir + // << " stripes=" << stripes + // << " nextStripes=" << nextStripes + // << " offset=" << offset // << "\n"; - - // figure out the which pedestrians are ahead on the next lane - const int nextStripes = numStripes(nextLane); - Obstacles obs(stripes, Obstacle(nextDir)); if (nextStripes < stripes) { - int offset = (stripes - nextStripes) / 2; - if (currentDir == nextDir) { - // for odd stripe number differences there is a bigger offset at the beginning - offset += (stripes - nextStripes) % 2; - } // some stripes do not continue for (int ii = 0; ii < stripes; ++ii) { if (ii < offset || ii >= nextStripes + offset) { - obs[ii] = Obstacle(nextDir == FORWARD ? 0 : nextLength, 0, "stripeEnd"); + obs[ii] = Obstacle(nextDir == FORWARD ? 0 : nextLength, 0, "stripeEnd", 0, true); } } } Pedestrians& pedestrians = getPedestrians(nextLane); if (nextLane->getEdge().isWalkingArea()) { + transformToCurrentLanePositions(obs, currentDir, nextDir, currentLength, nextLength); // complex transformation into the coordinate system of the current lane // (pedestrians on next lane may walk at arbitrary angles relative to the current lane) - const SUMOReal lateral_offset = (lane->getWidth() - stripeWidth) * 0.5; + double lateral_offset = (lane->getWidth() - stripeWidth) * 0.5; + if ((stripes - nextStripes) % 2 != 0) { + lateral_offset += 0.5 * stripeWidth; + } nextDir = currentDir; // transform pedestrians into the current coordinate system for (int ii = 0; ii < (int)pedestrians.size(); ++ii) { PState& p = *pedestrians[ii]; + if (p.myWaitingToEnter || p.myAmJammed) { + continue; + } Position relPos = lane->getShape().transformToVectorCoordinates(p.getPosition(*p.myStage, -1), true); - const SUMOReal newY = relPos.y() + lateral_offset; - addCloserObstacle(obs, relPos.x(), p.stripe(newY), stripes, p.myPerson->getID(), p.myPerson->getVehicleType().getWidth(), currentDir); - addCloserObstacle(obs, relPos.x(), p.otherStripe(newY), stripes, p.myPerson->getID(), p.myPerson->getVehicleType().getWidth(), currentDir); + const double newY = relPos.y() + lateral_offset; + //if (p.myPerson->getID() == "ped200") std::cout << " ped=" << p.myPerson->getID() << " relX=" << relPos.x() << " relY=" << newY << " latOff=" << lateral_offset << " s=" << p.stripe(newY) << " os=" << p.otherStripe(newY) << "\n"; + if ((currentDir == FORWARD && relPos.x() >= lane->getLength()) || (currentDir == BACKWARD && relPos.x() < 0)) { + addCloserObstacle(obs, relPos.x(), p.stripe(newY), stripes, p.myPerson->getID(), p.myPerson->getVehicleType().getWidth(), currentDir); + addCloserObstacle(obs, relPos.x(), p.otherStripe(newY), stripes, p.myPerson->getID(), p.myPerson->getVehicleType().getWidth(), currentDir); + } } } else { // simple transformation into the coordinate system of the current lane @@ -526,48 +562,61 @@ sort(pedestrians.begin(), pedestrians.end(), by_xpos_sorter(nextDir)); for (int ii = 0; ii < (int)pedestrians.size(); ++ii) { const PState& p = *pedestrians[ii]; - if (p.myWaitingToEnter) { + if (p.myWaitingToEnter || p.myAmJammed) { continue; } - SUMOReal newY = p.myRelY; + double newY = p.myRelY; + Obstacle pObs(p); if (nextDir != currentDir) { - newY = nextLane->getWidth() - stripeWidth - newY; + newY = (nextStripes - 1) * stripeWidth - newY; + pObs.speed *= -1; } - newY += 0.5 * (lane->getWidth() - nextLane->getWidth()); + newY += offset * stripeWidth; const int stripe = p.stripe(newY); if (stripe >= 0 && stripe < stripes) { - obs[stripe] = Obstacle(p); + obs[stripe] = pObs; } const int otherStripe = p.otherStripe(newY); if (otherStripe >= 0 && otherStripe < stripes) { - obs[otherStripe] = Obstacle(p); - } - } - for (int ii = 0; ii < stripes; ++ii) { - Obstacle& o = obs[ii]; - if (nextDir == BACKWARD) { - const SUMOReal xfwd = nextLength - o.xBack; - o.xBack = nextLength - o.xFwd; - o.xFwd = xfwd; - } - if (currentDir == FORWARD) { - o.xFwd += currentLength; - o.xBack += currentLength; - } else { - const SUMOReal xfwd = -o.xBack; - o.xBack = -o.xFwd; - o.xFwd = xfwd; + obs[otherStripe] = pObs; } } + transformToCurrentLanePositions(obs, currentDir, nextDir, currentLength, nextLength); } nextLanesObs[nextLane] = obs; } return nextLanesObs[nextLane]; } +void +MSPModel_Striping::transformToCurrentLanePositions(Obstacles& obs, int currentDir, int nextDir, double currentLength, double nextLength) { + for (int ii = 0; ii < (int)obs.size(); ++ii) { + Obstacle& o = obs[ii]; + if (currentDir == FORWARD) { + if (nextDir == FORWARD) { + o.xFwd += currentLength; + o.xBack += currentLength; + } else { + const double tmp = o.xFwd; + o.xFwd = currentLength + nextLength - o.xBack; + o.xBack = currentLength + nextLength - tmp; + } + } else { + if (nextDir == FORWARD) { + const double tmp = o.xFwd; + o.xFwd = -o.xBack; + o.xBack = -tmp; + } else { + o.xFwd -= nextLength; + o.xBack -= nextLength; + } + } + } +} + void -MSPModel_Striping::addCloserObstacle(Obstacles& obs, SUMOReal x, int stripe, int numStripes, const std::string& id, SUMOReal width, int dir) { +MSPModel_Striping::addCloserObstacle(Obstacles& obs, double x, int stripe, int numStripes, const std::string& id, double width, int dir) { if (stripe >= 0 && stripe < numStripes) { if ((dir == FORWARD && x - width / 2. < obs[stripe].xBack) || (dir == BACKWARD && x + width / 2. > obs[stripe].xFwd)) { obs[stripe] = Obstacle(x, 0, id, width); @@ -582,9 +631,9 @@ Pedestrians& pedestrians = it_lane->second; //std::cout << SIMTIME << ">>> lane=" << lane->getID() << " numPeds=" << pedestrians.size() << "\n"; if (lane->getEdge().isWalkingArea()) { - const SUMOReal lateral_offset = (lane->getWidth() - stripeWidth) * 0.5; - const SUMOReal minY = stripeWidth * - 0.5 + NUMERICAL_EPS; - const SUMOReal maxY = stripeWidth * (numStripes(lane) - 0.5) - NUMERICAL_EPS; + const double lateral_offset = (lane->getWidth() - stripeWidth) * 0.5; + const double minY = stripeWidth * - 0.5 + NUMERICAL_EPS; + const double maxY = stripeWidth * (numStripes(lane) - 0.5) - NUMERICAL_EPS; const WalkingAreaPath* debugPath = 0; // need to handle each walkingAreaPath seperately and transform // coordinates beforehand @@ -615,7 +664,7 @@ << path->shape.transformToVectorCoordinates(p->getPosition(*p->myStage, -1)) << "\n"; } else { const Position relPos = path->shape.transformToVectorCoordinates(p->getPosition(*p->myStage, -1)); - const SUMOReal newY = relPos.y() + lateral_offset; + const double newY = relPos.y() + lateral_offset; if (relPos != Position::INVALID && newY >= minY && newY <= maxY) { PState* tp = new PState(*p); tp->myRelX = relPos.x(); @@ -636,6 +685,7 @@ } } moveInDirectionOnLane(transformedPeds, lane, currentTime, changedLane, dir); + arriveAndAdvance(pedestrians, currentTime, changedLane, dir); // clean up for (Pedestrians::iterator it_p = toDelete.begin(); it_p != toDelete.end(); ++it_p) { delete *it_p; @@ -643,25 +693,31 @@ } } else { moveInDirectionOnLane(pedestrians, lane, currentTime, changedLane, dir); + arriveAndAdvance(pedestrians, currentTime, changedLane, dir); } - // advance to the next lane / arrive at destination - sort(pedestrians.begin(), pedestrians.end(), by_xpos_sorter(dir)); - // can't use iterators because we do concurrent modification - for (int i = 0; i < (int)pedestrians.size(); i++) { - PState* const p = pedestrians[i]; - if (p->myDir == dir && p->distToLaneEnd() < 0) { - // moveToNextLane may trigger re-insertion (for consecutive - // walks) so erase must be called first - pedestrians.erase(pedestrians.begin() + i); - i--; - p->moveToNextLane(currentTime); - if (p->myLane != 0) { - changedLane.insert(p->myPerson); - myActiveLanes[p->myLane].push_back(p); - } else { - delete p; - myNumActivePedestrians--; - } + } +} + + +void +MSPModel_Striping::arriveAndAdvance(Pedestrians& pedestrians, SUMOTime currentTime, std::set& changedLane, int dir) { + // advance to the next lane / arrive at destination + sort(pedestrians.begin(), pedestrians.end(), by_xpos_sorter(dir)); + // can't use iterators because we do concurrent modification + for (int i = 0; i < (int)pedestrians.size(); i++) { + PState* const p = pedestrians[i]; + if (p->myDir == dir && p->distToLaneEnd() < 0) { + // moveToNextLane may trigger re-insertion (for consecutive + // walks) so erase must be called first + pedestrians.erase(pedestrians.begin() + i); + i--; + p->moveToNextLane(currentTime); + if (p->myLane != 0) { + changedLane.insert(p->myPerson); + myActiveLanes[p->myLane].push_back(p); + } else { + delete p; + myNumActivePedestrians--; } } } @@ -680,7 +736,14 @@ Obstacles currentObs = obs; if (p.myDir != dir || changedLane.count(p.myPerson) != 0) { if (!p.myWaitingToEnter) { + //if DEBUGCOND(p.myPerson->getID()) { + // std::cout << " obs=" << p.myPerson->getID() << " y=" << p.myRelY << " stripe=" << p.stripe() << " oStripe=" << p.otherStripe() << "\n"; + //} Obstacle o(p); + if (p.myDir != dir && p.mySpeed == 0) { + // ensure recognition of oncoming + o.speed = (p.myDir == FORWARD ? 0.1 : -0.1); + } obs[p.stripe()] = o; obs[p.otherStripe()] = o; } @@ -693,15 +756,13 @@ } const MSLane* nextLane = p.myNLI.lane; const MSLink* link = p.myNLI.link; - const SUMOReal dist = p.distToLaneEnd(); - const SUMOReal speed = p.myStage->getMaxSpeed(); + const double dist = p.distToLaneEnd(); + const double speed = p.myStage->getMaxSpeed(); if (nextLane != 0 && dist <= LOOKAHEAD_ONCOMING) { - const SUMOReal currentLength = (p.myWalkingAreaPath == 0 ? lane->getLength() : p.myWalkingAreaPath->length); - const SUMOReal nextLength = nextLane->getLength(); // XXX what to do if nextLane is a walkingArea? + const double currentLength = (p.myWalkingAreaPath == 0 ? lane->getLength() : p.myWalkingAreaPath->length); const Obstacles& nextObs = getNextLaneObstacles( nextLanesObs, lane, nextLane, stripes, - nextLength, p.myNLI.dir, - currentLength, dir); + p.myNLI.dir, currentLength, dir); if DEBUGCOND(p.myPerson->getID()) { std::cout << SIMTIME << " ped=" << p.myPerson->getID() << " nextObs="; @@ -726,7 +787,7 @@ // @todo check for presence of vehicles blocking the path )) { // prevent movement passed a closed link - Obstacles closedLink(stripes, Obstacle(p.myRelX + dir * (dist + NUMERICAL_EPS), 0, "closedLink")); + Obstacles closedLink(stripes, Obstacle(p.myRelX + dir * (dist + NUMERICAL_EPS), 0, "closedLink", 0, true)); p.mergeObstacles(currentObs, closedLink); if DEBUGCOND(p.myPerson->getID()) { std::cout << SIMTIME << " ped=" << p.myPerson->getID() << " obsWitTLS="; @@ -739,7 +800,7 @@ } } if (&lane->getEdge() == &p.myStage->getDestination() && p.myStage->getDestinationStop() != 0) { - Obstacles arrival(stripes, Obstacle(p.myStage->getArrivalPos() + dir * p.getMinGap(), 0, "arrival")); + Obstacles arrival(stripes, Obstacle(p.myStage->getArrivalPos() + dir * p.getMinGap(), 0, "arrival", 0, true)); p.mergeObstacles(currentObs, arrival); } p.walk(currentObs, currentTime); @@ -772,11 +833,12 @@ // =========================================================================== // MSPModel_Striping::Obstacle method definitions // =========================================================================== -MSPModel_Striping::Obstacle::Obstacle(int dir) : - xFwd(dir * DIST_FAR_AWAY), // far away when seen in dir - xBack(dir * DIST_FAR_AWAY), // far away when seen in dir +MSPModel_Striping::Obstacle::Obstacle(int dir, double dist) : + xFwd(dir * dist), // by default, far away when seen in dir + xBack(dir * dist), // by default, far away when seen in dir speed(0), - description("") { + description(""), + border(false) { } @@ -786,6 +848,7 @@ xFwd = ped.getMaxX(); xBack = ped.getMinX(); speed = ped.myDir * ped.mySpeed; + border = false; } @@ -799,7 +862,7 @@ myStage(stage), myLane(lane), myRelX(stage->getDepartPos()), - myRelY(0), + myRelY(stage->getDepartPosLat()), myDir(FORWARD), mySpeed(0), myWaitingToEnter(true), @@ -838,7 +901,7 @@ } if (myDir == FORWARD) { // start at the right side of the sidewalk - myRelY = stripeWidth * (numStripes(lane) - 1); + myRelY = stripeWidth * (numStripes(lane) - 1) - myRelY; } if DEBUGCOND(myPerson->getID()) { std::cout << " added new pedestrian " << myPerson->getID() << " on " << lane->getID() << " myRelX=" << myRelX << " myRelY=" << myRelY << " dir=" << myDir << " route=" << toString(myStage->getRoute()) << "\n"; @@ -848,7 +911,7 @@ } -SUMOReal +double MSPModel_Striping::PState::getMinX(const bool includeMinGap) const { // @todo speed should have an influence here because faster persons need more space if (myDir == FORWARD) { @@ -858,7 +921,7 @@ } -SUMOReal +double MSPModel_Striping::PState::getMaxX(const bool includeMinGap) const { // @todo speed should have an influence here because faster persons need more space if (myDir == FORWARD) { @@ -868,29 +931,29 @@ } -SUMOReal +double MSPModel_Striping::PState::getLength() const { return myPerson->getVehicleType().getLength(); } -SUMOReal +double MSPModel_Striping::PState::getMinGap() const { return myPerson->getVehicleType().getMinGap(); } int -MSPModel_Striping::PState::stripe(SUMOReal relY) const { +MSPModel_Striping::PState::stripe(double relY) const { return (int)floor(relY / stripeWidth + 0.5); } int -MSPModel_Striping::PState::otherStripe(SUMOReal relY) const { +MSPModel_Striping::PState::otherStripe(double relY) const { const int s = stripe(relY); - const SUMOReal offset = relY - s * stripeWidth; - const SUMOReal threshold = MAX2(NUMERICAL_EPS, stripeWidth - SQUEEZE * myPerson->getVehicleType().getWidth()); + const double offset = relY - s * stripeWidth; + const double threshold = MAX2(NUMERICAL_EPS, stripeWidth - SQUEEZE * myPerson->getVehicleType().getWidth()); int result; if (offset > threshold) { result = s + 1; @@ -917,12 +980,12 @@ } -SUMOReal +double MSPModel_Striping::PState::distToLaneEnd() const { if (myStage->getNextRouteEdge() == 0) { return myDir * (myStage->getArrivalPos() - myRelX) - POSITION_EPS; } else { - const SUMOReal length = myWalkingAreaPath == 0 ? myLane->getLength() : myWalkingAreaPath->length; + const double length = myWalkingAreaPath == 0 ? myLane->getLength() : myWalkingAreaPath->length; return myDir == FORWARD ? length - myRelX : myRelX; } } @@ -930,7 +993,7 @@ bool MSPModel_Striping::PState::moveToNextLane(SUMOTime currentTime) { - const SUMOReal dist = distToLaneEnd(); + double dist = distToLaneEnd(); if (myPerson->getID() == DEBUG1) { std::cout << SIMTIME << " myRelX=" << myRelX << " dist=" << dist << "\n"; } @@ -952,6 +1015,8 @@ << " new=" << (myLane == 0 ? "NULL" : myLane->getID()) << " oldDir=" << oldDir << " newDir=" << myDir + << " myRelX=" << myRelX + << " dist=" << dist << "\n"; } if (myLane == 0) { @@ -991,18 +1056,41 @@ myWalkingAreaPath = 0; } // adapt x to fit onto the new lane + // (make sure we do not move past the end of the new lane since that + // lane was not checked for obstacles) + const double newLength = (myWalkingAreaPath == 0 ? myLane->getLength() : myWalkingAreaPath->length); + if (-dist > newLength) { + assert(false); + // should not happen because the end of myLane should have been an obstacle as well + dist = -newLength; + } if (myDir == BACKWARD) { - const SUMOReal newLength = (myWalkingAreaPath == 0 ? myLane->getLength() : myWalkingAreaPath->length); myRelX = newLength + dist; } else { myRelX = -dist; } + if DEBUGCOND(myPerson->getID()) { + std::cout << SIMTIME << " update myRelX ped=" << myPerson->getID() + << " newLength=" << newLength + << " dist=" << dist + << " myRelX=" << myRelX + << "\n"; + } // adjust to change in direction if (myDir != oldDir) { - myRelY = oldLane->getWidth() - stripeWidth - myRelY; + myRelY = (numStripes(oldLane) - 1) * stripeWidth - myRelY; } // adjust to differences in sidewalk width - myRelY += 0.5 * (myLane->getWidth() - oldLane->getWidth()); + const int offset = getStripeOffset(numStripes(oldLane), numStripes(myLane), oldDir != myDir && numStripes(myLane) < numStripes(oldLane)); + myRelY += offset * stripeWidth; + if DEBUGCOND(myPerson->getID()) { + std::cout << SIMTIME << " transformY ped=" << myPerson->getID() + << " newLane=" << Named::getIDSecure(myLane) + << " newY=" << myRelY + << " os=" << numStripes(oldLane) << " ns=" << numStripes(myLane) + << " od=" << oldDir << " nd=" << myDir + << " offset=" << offset << "\n"; + } } return true; } else { @@ -1016,24 +1104,20 @@ const int stripes = (int)obs.size(); const int sMax = stripes - 1; assert(stripes == numStripes(myLane)); - const SUMOReal vMax = myStage->getMaxSpeed(); + const double vMax = myStage->getMaxSpeed(); // ultimate goal is to choose the prefered stripe (chosen) const int current = stripe(); const int other = otherStripe(); - // compute utility for all stripes - std::vector utility(stripes); - // penalize lateral movement (may increase jamming) - for (int i = 0; i < stripes; ++i) { - utility[i] = abs(i - current) * LATERAL_PENALTY; - } // compute distances - std::vector distance(stripes); + std::vector distance(stripes); for (int i = 0; i < stripes; ++i) { - distance[i] = distanceTo(obs[i]); + distance[i] = distanceTo(obs[i], !obs[i].border); } + // compute utility for all stripes + std::vector utility(stripes, 0); // forbid stripes which are blocked and also all stripes behind them for (int i = 0; i < stripes; ++i) { - if (distanceTo(obs[i]) == DIST_OVERLAP) { + if (distance[i] == DIST_OVERLAP) { if (i == current && !myWaitingToEnter) { utility[i] += OBSTRUCTED_PENALTY; } @@ -1052,14 +1136,15 @@ // forbid a portion of the leftmost stripes (in walking direction). // lanes with stripes less than 1 / RESERVE_FOR_ONCOMING_FACTOR // may still deadlock in heavy pedestrian traffic - const int reserved = (int)floor(stripes * RESERVE_FOR_ONCOMING_FACTOR); + const bool onJunction = myLane->getEdge().isWalkingArea() || myLane->getEdge().isCrossing(); + const int reserved = (int)floor(stripes * (onJunction ? RESERVE_FOR_ONCOMING_FACTOR_JUNCTIONS : RESERVE_FOR_ONCOMING_FACTOR)); if (myDir == FORWARD) { for (int i = 0; i < reserved; ++i) { - utility[i] += INAPPROPRIATE_PENALTY; + utility[i] += INAPPROPRIATE_PENALTY * (i == current ? 0.5 : 1); } } else { for (int i = sMax; i > sMax - reserved; --i) { - utility[i] += INAPPROPRIATE_PENALTY; + utility[i] += INAPPROPRIATE_PENALTY * (i == current ? 0.5 : 1); } } // adapt utility based on obstacles @@ -1073,11 +1158,11 @@ } } // compute expected distance achievable by staying on this stripe for a time horizon - const SUMOReal walkDist = MAX2((SUMOReal)0, distance[i]); // disregard special distance flags - const SUMOReal lookAhead = obs[i].speed * myDir >= 0 ? LOOKAHEAD_SAMEDIR : LOOKAHEAD_ONCOMING; - const SUMOReal expectedDist = MIN2(vMax * LOOKAHEAD_SAMEDIR, walkDist + obs[i].speed * myDir * lookAhead); + const double walkDist = MAX2(0., distance[i]); // disregard special distance flags + const double lookAhead = obs[i].speed * myDir >= 0 ? LOOKAHEAD_SAMEDIR : LOOKAHEAD_ONCOMING; + const double expectedDist = MIN2(vMax * LOOKAHEAD_SAMEDIR, walkDist + obs[i].speed * myDir * lookAhead); if (DEBUGCOND(myPerson->getID())) { - std::cout << " util=" << utility[i] << " exp=" << expectedDist << "\n"; + std::cout << " util=" << utility[i] << " exp=" << expectedDist << " dist=" << distance[i] << "\n"; } if (expectedDist >= 0) { utility[i] += expectedDist; @@ -1086,19 +1171,17 @@ utility[i] += ONCOMING_CONFLICT_PENALTY + distance[i]; } } - // bonus to remain on the rightmost lane (in walking direction) if there - // are oncoming - if (((myDir == FORWARD && current == sMax) - || (myDir == BACKWARD && current == 0)) - && obs[current].speed * myDir < 0) { - utility[current] -= ONCOMING_CONFLICT_PENALTY; - } - // bonus to leave the leftmost lane (in walking direction) if there - // are oncoming - if (((myDir == BACKWARD && current == sMax) - || (myDir == FORWARD && current == 0)) - && obs[current].speed * myDir < 0) { - utility[current] += ONCOMING_CONFLICT_PENALTY; + // discourage use of the leftmost lane (in walking direction) if there are oncoming + if (myDir == FORWARD && obs[0].speed < 0) { + utility[0] += ONCOMING_CONFLICT_PENALTY; + } else if (myDir == BACKWARD && obs[sMax].speed > 0) { + utility[sMax] += ONCOMING_CONFLICT_PENALTY; + } + // penalize lateral movement (if the current stripe permits walking) + if (distance[current] > 0 && myWaitingTime == 0) { + for (int i = 0; i < stripes; ++i) { + utility[i] += abs(i - current) * LATERAL_PENALTY; + } } // select best stripe @@ -1110,10 +1193,10 @@ } // compute speed components along both axes const int next = (chosen == current ? current : (chosen < current ? current - 1 : current + 1)); - const SUMOReal xDist = MIN3(distance[current], distance[other], distance[next]); + const double xDist = MIN3(distance[current], distance[other], distance[next]); // XXX preferred gap differs between approaching a standing obstacle or a moving obstacle - const SUMOReal preferredGap = NUMERICAL_EPS; - SUMOReal xSpeed = MIN2(vMax, MAX2((SUMOReal)0, DIST2SPEED(xDist - preferredGap))); + const double preferredGap = NUMERICAL_EPS; + double xSpeed = MIN2(vMax, MAX2(0., DIST2SPEED(xDist - preferredGap))); if (xSpeed < NUMERICAL_EPS) { xSpeed = 0.; } @@ -1122,7 +1205,13 @@ } // avoid tiny steps // XXX pressure from behind? - if (mySpeed == 0 && xDist < MIN_STARTUP_DIST) { + if (mySpeed == 0 && xDist < MIN_STARTUP_DIST && + // unless walking towards a short lane + !( + (xDist == distance[current] && obs[current].border) + || (xDist == distance[other] && obs[other].border) + || (xDist == distance[next] && obs[next].border)) + ) { xSpeed = 0; } if (xSpeed == 0) { @@ -1137,11 +1226,12 @@ } xSpeed = vMax / 4; } - } else { + } else if (stripe(myRelY) >= 0 && stripe(myRelY) <= sMax) { myAmJammed = false; } // dawdling - const SUMOReal dawdle = MIN2(xSpeed, RandHelper::rand() * vMax * dawdling); + const double dawdle = MIN2(xSpeed, RandHelper::rand() * vMax * dawdling); + xSpeed -= dawdle; // XXX ensure that diagonal speed <= vMax // avoid deadlocks on narrow sidewalks @@ -1154,9 +1244,9 @@ // chosen -= 1; // } //} - const SUMOReal maxYSpeed = MAX2(vMax * LATERAL_SPEED_FACTOR, vMax - xSpeed); - SUMOReal ySpeed = 0; - SUMOReal yDist = 0; + const double maxYSpeed = MIN2(MAX2(vMax * LATERAL_SPEED_FACTOR, vMax - xSpeed), stripeWidth); + double ySpeed = 0; + double yDist = 0; if (utility[next] > OBSTRUCTION_THRESHOLD && utility[chosen] > OBSTRUCTION_THRESHOLD) { // don't move laterally if the stripes are blocked yDist = (chosen * stripeWidth) - myRelY; @@ -1204,15 +1294,14 @@ } -SUMOReal +double MSPModel_Striping::PState::getImpatience(SUMOTime now) const { - return MAX2((SUMOReal)0, MIN2(SUMOReal(1), - myPerson->getVehicleType().getImpatience() - + STEPS2TIME(myStage->getWaitingTime(now)) / MAX_WAIT_TOLERANCE)); + return MAX2(0., MIN2(1., myPerson->getVehicleType().getImpatience() + + STEPS2TIME(myStage->getWaitingTime(now)) / MAX_WAIT_TOLERANCE)); } -SUMOReal +double MSPModel_Striping::PState::getEdgePos(const MSPerson::MSPersonStage_Walking&, SUMOTime) const { return myRelX; } @@ -1224,23 +1313,34 @@ // pedestrian has already finished return Position::INVALID; } - const SUMOReal lateral_offset = myRelY + (stripeWidth - myLane->getWidth()) * 0.5; + const double lateral_offset = myRelY + (stripeWidth - myLane->getWidth()) * 0.5; if (myWalkingAreaPath == 0) { return stage.getLanePosition(myLane, myRelX, lateral_offset); } else { + //if DEBUGCOND(myPerson->getID()) { + // std::cout << SIMTIME + // << " getPosition (walkingArea)" + // << " p=" << myPerson->getID() + // << " x=" << myRelX + // << " y=" << myRelY + // << " latOffset=" << lateral_offset + // << " shape=" << myWalkingAreaPath->shape + // << " pos=" << myWalkingAreaPath->shape.positionAtOffset(myRelX, lateral_offset) + // << "\n"; + //} return myWalkingAreaPath->shape.positionAtOffset(myRelX, lateral_offset); } } -SUMOReal +double MSPModel_Striping::PState::getAngle(const MSPerson::MSPersonStage_Walking&, SUMOTime) const { if (myLane == 0) { // pedestrian has already finished return 0; } const PositionVector& shp = myWalkingAreaPath == 0 ? myLane->getShape() : myWalkingAreaPath->shape; - SUMOReal angle = shp.rotationAtOffset(myRelX) + (myDir == MSPModel::BACKWARD ? M_PI : 0); + double angle = shp.rotationAtOffset(myRelX) + (myDir == MSPModel::BACKWARD ? M_PI : 0); if (angle > M_PI) { angle -= 2 * M_PI; } @@ -1254,7 +1354,7 @@ } -SUMOReal +double MSPModel_Striping::PState::getSpeed(const MSPerson::MSPersonStage_Walking&) const { return mySpeed; } @@ -1266,11 +1366,14 @@ } -SUMOReal +double MSPModel_Striping::PState::distanceTo(const Obstacle& obs, const bool includeMinGap) const { // check for overlap - const SUMOReal maxX = getMaxX(includeMinGap); - const SUMOReal minX = getMinX(includeMinGap); + const double maxX = getMaxX(includeMinGap); + const double minX = getMinX(includeMinGap); + //if (DEBUGCOND(myPerson->getID())) { + // std::cout << std::setprecision(2) << " distanceTo=" << obs.description << " maxX=" << maxX << " minX=" << minX << " obs.xFwd=" << obs.xFwd << " obs.xBack=" << obs.xBack << "\n"; + //} if ((obs.xFwd >= maxX && obs.xBack <= maxX) || (obs.xFwd <= maxX && obs.xFwd >= minX)) { return DIST_OVERLAP; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/pedestrians/MSPModel_Striping.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/pedestrians/MSPModel_Striping.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/pedestrians/MSPModel_Striping.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/pedestrians/MSPModel_Striping.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 13 Jan 2014 -/// @version $Id: MSPModel_Striping.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: MSPModel_Striping.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The pedestrian following model (prototype) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -69,8 +69,11 @@ /// @brief register the given person as a pedestrian PedestrianState* add(MSPerson* person, MSPerson::MSPersonStage_Walking* stage, SUMOTime now); + /// @brief remove the specified person from the pedestrian simulation + void remove(PedestrianState* state); + /// @brief whether a pedestrian is blocking the crossing of lane at offset distToCrossing - bool blockedAtDist(const MSLane* lane, SUMOReal distToCrossing, std::vector* collectBlockers); + bool blockedAtDist(const MSLane* lane, double distToCrossing, std::vector* collectBlockers); /// @brief remove state at simulation end void cleanupHelper(); @@ -79,56 +82,61 @@ ///@{ // @brief the width of a pedstrian stripe - static SUMOReal stripeWidth; + static double stripeWidth; // @brief the factor for random slow-down - static SUMOReal dawdling; + static double dawdling; // @brief the time threshold before becoming jammed static SUMOTime jamTime; // @brief the distance (in seconds) to look ahead for changing stripes - static const SUMOReal LOOKAHEAD_SAMEDIR; + static const double LOOKAHEAD_SAMEDIR; // @brief the distance (in seconds) to look ahead for changing stripes (regarding oncoming pedestrians) - static const SUMOReal LOOKAHEAD_ONCOMING; + static const double LOOKAHEAD_ONCOMING; // @brief the utility penalty for moving sideways (corresponds to meters) - static const SUMOReal LATERAL_PENALTY; + static const double LATERAL_PENALTY; // @brief the utility penalty for obstructed (physically blocking me) stripes (corresponds to meters) - static const SUMOReal OBSTRUCTED_PENALTY; + static const double OBSTRUCTED_PENALTY; // @brief the utility penalty for inappropriate (reserved for oncoming traffic or may violate my min gap) stripes (corresponds to meters) - static const SUMOReal INAPPROPRIATE_PENALTY; + static const double INAPPROPRIATE_PENALTY; // @brief the utility penalty for oncoming conflicts on stripes (corresponds to meters) - static const SUMOReal ONCOMING_CONFLICT_PENALTY; + static const double ONCOMING_CONFLICT_PENALTY; // @brief the minimum utility that indicates obstruction - static const SUMOReal OBSTRUCTION_THRESHOLD; + static const double OBSTRUCTION_THRESHOLD; // @brief the factor by which pedestrian width is reduced when sqeezing past each other - static const SUMOReal SQUEEZE; + static const double SQUEEZE; // @brief the maximum distance (in meters) at which oncoming pedestrians block right turning traffic - static const SUMOReal BLOCKER_LOOKAHEAD; + static const double BLOCKER_LOOKAHEAD; // @brief fraction of the leftmost lanes to reserve for oncoming traffic - static const SUMOReal RESERVE_FOR_ONCOMING_FACTOR; + static const double RESERVE_FOR_ONCOMING_FACTOR; + static const double RESERVE_FOR_ONCOMING_FACTOR_JUNCTIONS; // @brief the time pedestrians take to reach maximum impatience - static const SUMOReal MAX_WAIT_TOLERANCE; + static const double MAX_WAIT_TOLERANCE; // @brief the fraction of forward speed to be used for lateral movemenk - static const SUMOReal LATERAL_SPEED_FACTOR; + static const double LATERAL_SPEED_FACTOR; // @brief the minimum distance to the next obstacle in order to start walking after stopped - static const SUMOReal MIN_STARTUP_DIST; + static const double MIN_STARTUP_DIST; ///@} protected: + static const double DIST_FAR_AWAY; + static const double DIST_BEHIND; + static const double DIST_OVERLAP; + class lane_by_numid_sorter { public: /// comparing operation @@ -145,6 +153,7 @@ typedef std::vector Obstacles; typedef std::map NextLanesObstacles; typedef std::map, WalkingAreaPath> WalkingAreaPaths; + typedef std::map MinNextLengths; struct NextLaneInfo { NextLaneInfo(const MSLane* _lane, const MSLink* _link, int _dir) : @@ -170,21 +179,23 @@ /// @brief information regarding surround Pedestrians (and potentially other things) struct Obstacle { /// @brief create No-Obstacle - Obstacle(int dir); + Obstacle(int dir, double dist = DIST_FAR_AWAY); /// @brief create an obstacle from ped for ego moving in dir Obstacle(const PState& ped); /// @brief create an obstacle from explict values - Obstacle(SUMOReal _x, SUMOReal _speed, const std::string& _description, const SUMOReal width = 0.) - : xFwd(_x + width / 2.), xBack(_x - width / 2.), speed(_speed), description(_description) {}; + Obstacle(double _x, double _speed, const std::string& _description, const double width = 0., bool _border = false) + : xFwd(_x + width / 2.), xBack(_x - width / 2.), speed(_speed), description(_description), border(_border) {}; /// @brief maximal position on the current lane in forward direction - SUMOReal xFwd; + double xFwd; /// @brief maximal position on the current lane in backward direction - SUMOReal xBack; + double xBack; /// @brief speed relative to lane direction (positive means in the same direction) - SUMOReal speed; + double speed; /// @brief the id / description of the obstacle std::string description; + /// @brief whether this obstacle denotes a border or a pedestrian + bool border; }; struct WalkingAreaPath { @@ -202,7 +213,7 @@ const MSLane* to; const MSLane* lane; // the walkingArea; PositionVector shape; // actually const but needs to be copyable by some stl code - SUMOReal length; + double length; }; @@ -232,11 +243,11 @@ /// @brief abstract methods inherited from PedestrianState /// @{ - SUMOReal getEdgePos(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const; + double getEdgePos(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const; Position getPosition(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const; - SUMOReal getAngle(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const; + double getAngle(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const; SUMOTime getWaitingTime(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const; - SUMOReal getSpeed(const MSPerson::MSPersonStage_Walking& stage) const; + double getSpeed(const MSPerson::MSPersonStage_Walking& stage) const; const MSEdge* getNextEdge(const MSPerson::MSPersonStage_Walking& stage) const; /// @} @@ -248,13 +259,13 @@ /// @brief the current lane of this pedestrian const MSLane* myLane; /// @brief the advancement along the current lane - SUMOReal myRelX; + double myRelX; /// @brief the orthogonal shift on the current lane - SUMOReal myRelY; + double myRelY; /// @brief the walking direction on the current lane (1 forward, -1 backward) int myDir; /// @brief the current walking speed - SUMOReal mySpeed; + double mySpeed; /// @brief whether the pedestrian is waiting to start its walk bool myWaitingToEnter; /// @brief the consecutive time spent at speed 0 @@ -267,19 +278,19 @@ bool myAmJammed; /// @brief return the minimum position on the lane - SUMOReal getMinX(const bool includeMinGap = true) const; + double getMinX(const bool includeMinGap = true) const; /// @brief return the maximum position on the lane - SUMOReal getMaxX(const bool includeMinGap = true) const; + double getMaxX(const bool includeMinGap = true) const; /// @brief return the length of the pedestrian - SUMOReal getLength() const; + double getLength() const; /// @brief return the minimum gap of the pedestrian - SUMOReal getMinGap() const; + double getMinGap() const; /// @brief the absolute distance to the end of the lane in walking direction (or to the arrivalPos) - SUMOReal distToLaneEnd() const; + double distToLaneEnd() const; /// @brief return whether this pedestrian has passed the end of the current lane and update myRelX if so bool moveToNextLane(SUMOTime currentTime); @@ -288,13 +299,13 @@ void walk(const Obstacles& obs, SUMOTime currentTime); /// @brief returns the impatience - SUMOReal getImpatience(SUMOTime now) const; + double getImpatience(SUMOTime now) const; int stripe() const; int otherStripe() const; - int stripe(const SUMOReal relY) const; - int otherStripe(const SUMOReal relY) const; + int stripe(const double relY) const; + int otherStripe(const double relY) const; /* @brief calculate distance to the given obstacle, * - non-negative values signify an obstacle in front of ego @@ -302,7 +313,7 @@ * obstacles that overlap and obstacles behind ego respectively * the result is the same regardless of walking direction */ - SUMOReal distanceTo(const Obstacle& obs, const bool includeMinGap = true) const; + double distanceTo(const Obstacle& obs, const bool includeMinGap = true) const; /// @brief replace obstacles in the first vector with obstacles from the second if they are closer to me void mergeObstacles(Obstacles& into, const Obstacles& obs2); @@ -351,6 +362,9 @@ /// @brief move pedestrians forward on one lane void moveInDirectionOnLane(Pedestrians& pedestrians, const MSLane* lane, SUMOTime currentTime, std::set& changedLane, int dir); + /// @brief handle arrivals and lane advancement + void arriveAndAdvance(Pedestrians& pedestrians, SUMOTime currentTime, std::set& changedLane, int dir); + const ActiveLanes& getActiveLanes() { return myActiveLanes; } @@ -379,13 +393,21 @@ static Obstacles getNeighboringObstacles(const Pedestrians& pedestrians, int egoIndex, int stripes); const Obstacles& getNextLaneObstacles(NextLanesObstacles& nextLanesObs, const MSLane* lane, const MSLane* nextLane, int stripes, - SUMOReal nextLength, int nextDir, SUMOReal currentLength, int currentDir); + int nextDir, double currentLength, int currentDir); - static void addCloserObstacle(Obstacles& obs, SUMOReal x, int stripe, int numStripes, const std::string& id, SUMOReal width, int dir); + static void transformToCurrentLanePositions(Obstacles& o, int currentDir, int nextDir, double currentLength, double nextLength); + + static void addCloserObstacle(Obstacles& obs, double x, int stripe, int numStripes, const std::string& id, double width, int dir); /// @brief retrieves the pedestian vector for the given lane (may be empty) Pedestrians& getPedestrians(const MSLane* lane); + /* @brief compute stripe-offset to transform relY values from a lane with origStripes into a lane wit destStrips + * @note this is called once for transforming nextLane peds to into the current system as obstacles and another time + * (in reverse) to transform the pedestrian coordinates into the nextLane-coordinates when changing lanes + */ + static int getStripeOffset(int origStripes, int destStripes, bool addRemainder); + private: /// @brief the MovePedestrians command that is registered @@ -399,6 +421,7 @@ /// @brief store for walkinArea elements static WalkingAreaPaths myWalkingAreaPaths; + static MinNextLengths myMinNextLengths; /// @brief empty pedestrian vector static Pedestrians noPedestrians; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -2,6 +2,7 @@ libmicrosimtls_a_SOURCES = \ MSActuatedTrafficLightLogic.cpp MSActuatedTrafficLightLogic.h \ +MSDelayBasedTrafficLightLogic.cpp MSDelayBasedTrafficLightLogic.h \ MSOffTrafficLightLogic.cpp MSOffTrafficLightLogic.h \ MSRailSignal.cpp MSRailSignal.h \ MSPhaseDefinition.h \ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -99,6 +99,7 @@ libmicrosimtls_a_AR = $(AR) $(ARFLAGS) libmicrosimtls_a_LIBADD = am_libmicrosimtls_a_OBJECTS = MSActuatedTrafficLightLogic.$(OBJEXT) \ + MSDelayBasedTrafficLightLogic.$(OBJEXT) \ MSOffTrafficLightLogic.$(OBJEXT) MSRailSignal.$(OBJEXT) \ MSPhasedTrafficLightLogic.$(OBJEXT) MSPushButton.$(OBJEXT) \ MSRailCrossing.$(OBJEXT) MSSimpleTrafficLightLogic.$(OBJEXT) \ @@ -349,6 +350,7 @@ noinst_LIBRARIES = libmicrosimtls.a libmicrosimtls_a_SOURCES = \ MSActuatedTrafficLightLogic.cpp MSActuatedTrafficLightLogic.h \ +MSDelayBasedTrafficLightLogic.cpp MSDelayBasedTrafficLightLogic.h \ MSOffTrafficLightLogic.cpp MSOffTrafficLightLogic.h \ MSRailSignal.cpp MSRailSignal.h \ MSPhaseDefinition.h \ @@ -431,6 +433,7 @@ -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSActuatedTrafficLightLogic.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSDelayBasedTrafficLightLogic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSDeterministicHiLevelTrafficLightLogic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSOffTrafficLightLogic.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MSPhasedTrafficLightLogic.Po@am__quote@ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSActuatedTrafficLightLogic.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSActuatedTrafficLightLogic.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSActuatedTrafficLightLogic.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSActuatedTrafficLightLogic.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Sept 2002 -/// @version $Id: MSActuatedTrafficLightLogic.cpp 21496 2016-09-19 10:39:08Z behrisch $ +/// @version $Id: MSActuatedTrafficLightLogic.cpp 23800 2017-04-04 09:37:29Z behrisch $ /// // An actuated (adaptive) traffic light logic /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,10 +47,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // parameter defaults definitions @@ -71,12 +67,12 @@ const std::string& basePath) : MSSimpleTrafficLightLogic(tlcontrol, id, programID, phases, step, delay, parameter) { - myMaxGap = TplConvert::_2SUMOReal(getParameter("max-gap", DEFAULT_MAX_GAP).c_str()); - myPassingTime = TplConvert::_2SUMOReal(getParameter("passing-time", DEFAULT_PASSING_TIME).c_str()); - myDetectorGap = TplConvert::_2SUMOReal(getParameter("detector-gap", DEFAULT_DETECTOR_GAP).c_str()); + myMaxGap = TplConvert::_2double(getParameter("max-gap", DEFAULT_MAX_GAP).c_str()); + myPassingTime = TplConvert::_2double(getParameter("passing-time", DEFAULT_PASSING_TIME).c_str()); // passing-time seems obsolete... (Leo) + myDetectorGap = TplConvert::_2double(getParameter("detector-gap", DEFAULT_DETECTOR_GAP).c_str()); myShowDetectors = TplConvert::_2bool(getParameter("show-detectors", "false").c_str()); myFile = FileHelpers::checkForRelativity(getParameter("file", "NUL"), basePath); - myFreq = TIME2STEPS(TplConvert::_2SUMOReal(getParameter("freq", "300").c_str())); + myFreq = TIME2STEPS(TplConvert::_2double(getParameter("freq", "300").c_str())); myVehicleTypes = getParameter("vTypes", ""); } @@ -94,19 +90,19 @@ const LaneVector& lanes = *i2; for (i = lanes.begin(); i != lanes.end(); i++) { MSLane* lane = (*i); - SUMOReal length = lane->getLength(); - SUMOReal speed = lane->getSpeedLimit(); - SUMOReal inductLoopPosition = myDetectorGap * speed; + double length = lane->getLength(); + double speed = lane->getSpeedLimit(); + double inductLoopPosition = myDetectorGap * speed; // check whether the lane is long enough - SUMOReal ilpos = length - inductLoopPosition; + double ilpos = length - inductLoopPosition; if (ilpos < 0) { ilpos = 0; } // Build the induct loop and set it into the container std::string id = "TLS" + myID + "_" + myProgramID + "_InductLoopOn_" + lane->getID(); if (myInductLoops.find(lane) == myInductLoops.end()) { - myInductLoops[lane] = nb.createInductLoop(id, lane, ilpos, myVehicleTypes); - MSNet::getInstance()->getDetectorControl().add(SUMO_TAG_INDUCTION_LOOP, myInductLoops[lane], myFile, myFreq, myShowDetectors); + myInductLoops[lane] = nb.createInductLoop(id, lane, ilpos, myVehicleTypes, myShowDetectors); + MSNet::getInstance()->getDetectorControl().add(SUMO_TAG_INDUCTION_LOOP, myInductLoops[lane], myFile, myFreq); } } } @@ -123,8 +119,8 @@ // @note any vehicles which arrived during the previous phases which are now waiting between the detector and the stop line are not // considere here. RiLSA recommends to set minDuration in a way that lets all vehicles pass the detector // @todo: it would be nice to warn users if (inductLoopPosition / defaultLengthWithGap * myPassingTime > minDuration) - const SUMOReal detectionGap = gapControl(); - if (detectionGap < std::numeric_limits::max()) { + const double detectionGap = gapControl(); + if (detectionGap < std::numeric_limits::max()) { return duration(detectionGap); } // increment the index to the current phase @@ -142,7 +138,7 @@ // ------------ "actuated" algorithm methods SUMOTime -MSActuatedTrafficLightLogic::duration(const SUMOReal detectionGap) const { +MSActuatedTrafficLightLogic::duration(const double detectionGap) const { assert(getCurrentPhaseDef().isGreenPhase()); assert((int)myPhases.size() > myStep); const SUMOTime actDuration = MSNet::getInstance()->getCurrentTimeStep() - myPhases[myStep]->myLastSwitch; @@ -161,11 +157,11 @@ } -SUMOReal +double MSActuatedTrafficLightLogic::gapControl() { //intergreen times should not be lenghtend assert((int)myPhases.size() > myStep); - SUMOReal result = std::numeric_limits::max(); + double result = std::numeric_limits::max(); if (!getCurrentPhaseDef().isGreenPhase()) { return result; // end current phase } @@ -185,8 +181,8 @@ if (myInductLoops.find(*j) == myInductLoops.end()) { continue; } - if (!MSGlobals::gUseMesoSim) { - const SUMOReal actualGap = static_cast(myInductLoops.find(*j)->second)->getTimestepsSinceLastDetection(); + if (!MSGlobals::gUseMesoSim) { // why not check outside the loop? (Leo) + const double actualGap = static_cast(myInductLoops.find(*j)->second)->getTimeSinceLastDetection(); if (actualGap < myMaxGap) { result = MIN2(result, actualGap); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSActuatedTrafficLightLogic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSActuatedTrafficLightLogic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSActuatedTrafficLightLogic.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSActuatedTrafficLightLogic.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: MSActuatedTrafficLightLogic.h 21496 2016-09-19 10:39:08Z behrisch $ +/// @version $Id: MSActuatedTrafficLightLogic.h 23150 2017-02-27 12:08:30Z behrisch $ /// // An actuated (adaptive) traffic light logic /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -109,12 +109,12 @@ * @param[in] detectionGap The minimum detection gap for the current phase * @return The minimum duration of the current phase */ - SUMOTime duration(const SUMOReal detectionGap) const; + SUMOTime duration(const double detectionGap) const; - /** @brief Return the minimum detection gap of all detectors if the current phase should be extended and SUMOReal::max otherwise + /** @brief Return the minimum detection gap of all detectors if the current phase should be extended and double::max otherwise */ - SUMOReal gapControl(); + double gapControl(); /// @} @@ -123,13 +123,13 @@ InductLoopMap myInductLoops; /// The maximum gap to check in seconds - SUMOReal myMaxGap; + double myMaxGap; /// The passing time used in seconds - SUMOReal myPassingTime; + double myPassingTime; /// The detector distance in seconds - SUMOReal myDetectorGap; + double myDetectorGap; /// Whether the detectors shall be shown in the GUI bool myShowDetectors; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSDelayBasedTrafficLightLogic.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSDelayBasedTrafficLightLogic.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSDelayBasedTrafficLightLogic.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSDelayBasedTrafficLightLogic.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,247 @@ +/****************************************************************************/ +/// @file MSDelayBasedTrafficLightLogic.cpp +/// @author Leonhard Luecken +/// @date Feb 2017 +/// @version +/// +// An actuated traffic light logic based on time delay of approaching vehicles +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include "MSSimpleTrafficLightLogic.h" +#include "MSDelayBasedTrafficLightLogic.h" +#include +#include +#include + +#define INVALID_POSITION std::numeric_limits::max() + +// =========================================================================== +// parameter defaults definitions +// =========================================================================== + +//#define DEBUG_TIMELOSS_CONTROL + +// =========================================================================== +// method definitions +// =========================================================================== +MSDelayBasedTrafficLightLogic::MSDelayBasedTrafficLightLogic(MSTLLogicControl& tlcontrol, + const std::string& id, const std::string& programID, + const Phases& phases, + int step, SUMOTime delay, + const std::map& parameter, + const std::string& basePath) : + MSSimpleTrafficLightLogic(tlcontrol, id, programID, phases, step, delay, parameter) { +#ifdef DEBUG_TIMELOSS_CONTROL + std::cout << "Building delay based tls logic '" << id << "'" << std::endl; +#endif + myShowDetectors = TplConvert::_2bool(getParameter("show-detectors", "false").c_str()); + myDetectionRange = TplConvert::_2double(getParameter("detectorRange", "-1.0").c_str()); + myTimeLossThreshold = TplConvert::_2double(getParameter("minTimeloss", "1.0").c_str()); + myFile = FileHelpers::checkForRelativity(getParameter("file", "NUL"), basePath); + myFreq = TIME2STEPS(TplConvert::_2double(getParameter("freq", "300").c_str())); + myVehicleTypes = getParameter("vTypes", ""); +#ifdef DEBUG_TIMELOSS_CONTROL + std::cout << "show-detectors: " << myShowDetectors + << " detectorRange: " << myDetectionRange + << " minTimeLoss: " << myTimeLossThreshold + << " file: " << myFile + << " freq: " << myFreq + << " vTypes: " << myVehicleTypes + << std::endl; +#endif +} + + +void +MSDelayBasedTrafficLightLogic::init(NLDetectorBuilder& nb) { + MSTrafficLightLogic::init(nb); + assert(myLanes.size() > 0); + LaneVectorVector::const_iterator i2; + LaneVector::const_iterator i; + // build the E2 detectors + for (i2 = myLanes.begin(); i2 != myLanes.end(); ++i2) { + const LaneVector& lanes = *i2; + for (i = lanes.begin(); i != lanes.end(); i++) { + MSLane* lane = (*i); + // Build the detectors and register them at the detector control + std::string id = "TLS" + myID + "_" + myProgramID + "_E2CollectorOn_" + lane->getID(); + if (myLaneDetectors.find(lane) == myLaneDetectors.end()) { + myLaneDetectors[lane] = nb.createE2Detector(id, DU_TL_CONTROL, lane, INVALID_POSITION, lane->getLength(), myDetectionRange, 0, 0, 0, myVehicleTypes, myShowDetectors); + MSNet::getInstance()->getDetectorControl().add(SUMO_TAG_E2DETECTOR, myLaneDetectors[lane], myFile, myFreq); + } + } + } +} + + + +MSDelayBasedTrafficLightLogic::~MSDelayBasedTrafficLightLogic() { } + +// ------------ Switching and setting current rows + + +SUMOTime +MSDelayBasedTrafficLightLogic::proposeProlongation(const SUMOTime actDuration, const SUMOTime maxDuration, bool& othersEmpty) { +#ifdef DEBUG_TIMELOSS_CONTROL + std::cout << "\n" << SIMTIME << " MSDelayBasedTrafficLightLogic::proposeProlongation() for TLS '" << this->getID() << "' (current phase = " << myStep << ")" << std::endl; +#endif + SUMOTime prolongation = 0; + const std::string& state = getCurrentPhaseDef().getState(); + // iterate over green lanes, eventually increase the proposed prolongationTime to the estimated passing time for each lane. + for (int i = 0; i < (int) state.size(); i++) { + // this lane index corresponds to a non-green time + bool igreen = state[i] == LINKSTATE_TL_GREEN_MAJOR || state[i] == LINKSTATE_TL_GREEN_MINOR; + const std::vector& lanes = getLanesAt(i); + for (LaneVector::const_iterator j = lanes.begin(); j != lanes.end(); j++) { + LaneDetectorMap::iterator i = myLaneDetectors.find(*j); +#ifdef DEBUG_TIMELOSS_CONTROL + if (i == myLaneDetectors.end()) { + // no detector for this lane!? + std::cout << "no detector on lane '" << (*j)->getID() << std::endl; + continue; + } +#endif + MSE2Collector* detector = static_cast(i->second); + const std::vector vehInfos = detector->getCurrentVehicles(); +#ifdef DEBUG_TIMELOSS_CONTROL + int nrVehs = 0; // count vehicles on detector +#endif + if (igreen) { + // green phase + for (std::vector::const_iterator ivp = vehInfos.begin(); ivp != vehInfos.end(); ++ivp) { + MSE2Collector::VehicleInfo* iv = *ivp; + if (iv->accumulatedTimeLoss > myTimeLossThreshold && iv->distToDetectorEnd > 0) { + const SUMOTime estimatedTimeToJunction = TIME2STEPS((iv->distToDetectorEnd) / (*j)->getSpeedLimit()); + if (actDuration + estimatedTimeToJunction <= maxDuration) { + // only prolong if vehicle has a chance to pass until max duration is reached + prolongation = MAX2(prolongation, estimatedTimeToJunction); + } +#ifdef DEBUG_TIMELOSS_CONTROL + nrVehs++; +#endif + +#ifdef DEBUG_TIMELOSS_CONTROL + std::cout << "vehicle '" << iv->id << "' with accumulated timeloss: " << iv->accumulatedTimeLoss + << "\nestimated passing time: " << estimatedTimeToJunction << std::endl; + } else { + std::string reason = iv->accumulatedTimeLoss <= myTimeLossThreshold ? " (time loss below threshold)" : " (front already left detector)"; + std::cout << "disregarded: (vehicle '" << iv->id << "' with accumulated timeloss " << iv->accumulatedTimeLoss << ")" << reason << std::endl; +#endif + } + } + } else { + // non-green phase + if (vehInfos.size() > 0) { + // here is a car on a non-green approach + othersEmpty = false; + if (actDuration >= getCurrentPhaseDef().maxDuration) { +#ifdef DEBUG_TIMELOSS_CONTROL + std::cout << "Actual duration exceeds maxDuration and a vehicle is on concurrent approach: " << nrVehs << std::endl; +#endif + // don't prolong + return 0; + } + break; + } +#ifdef DEBUG_TIMELOSS_CONTROL + std::cout << "Number of current vehicles on detector: " << nrVehs << std::endl; +#endif + } + } + } +#ifdef DEBUG_TIMELOSS_CONTROL + std::cout << "Proposed prolongation (maximal estimated passing time): " << prolongation << std::endl; // debug +#endif + return prolongation; +} + + +SUMOTime +MSDelayBasedTrafficLightLogic::trySwitch() { + /* check if the actual phase should be prolonged */ + const MSPhaseDefinition& currentPhase = getCurrentPhaseDef(); + // time since last switch + const SUMOTime actDuration = MSNet::getInstance()->getCurrentTimeStep() - currentPhase.myLastSwitch; + +#ifdef DEBUG_TIMELOSS_CONTROL + std::cout << "last switch = " << currentPhase.myLastSwitch + << "\nactDuration = " << actDuration + << "\nmaxDuration = " << currentPhase.maxDuration + << std::endl; +#endif + + // flag whether to prolong or not + if (currentPhase.isGreenPhase() && !MSGlobals::gUseMesoSim) { + bool othersEmpty = true; // whether no vehicles are present on concurrent approaches + SUMOTime proposedProlongation = proposeProlongation(actDuration, currentPhase.maxDuration, othersEmpty); + +#ifdef DEBUG_TIMELOSS_CONTROL + std::cout << "othersEmpty = " << othersEmpty + << std::endl; +#endif + + // keep this phase a little longer? + bool prolong = othersEmpty || actDuration < currentPhase.maxDuration; + // assure minimal duration + proposedProlongation = MAX3(SUMOTime(0), proposedProlongation, currentPhase.minDuration - actDuration); + if (othersEmpty) { + // prolong by one second if no vehicles on other approaches + proposedProlongation = MAX2(proposedProlongation, TIME2STEPS(1.)); + } else { + // vehicles are present on other approaches -> prolong no further than the max green time + proposedProlongation = MIN2(proposedProlongation, MAX2(SUMOTime(0), currentPhase.maxDuration - actDuration)); + } + +#ifdef DEBUG_TIMELOSS_CONTROL + std::cout << "Proposed prolongation = " << proposedProlongation << std::endl; +#endif + + prolong = proposedProlongation > 0; + if (prolong) { + // check again after the prolonged period (must be positive...) + // XXX: Can it be harmful not to return a duration of integer seconds? + return proposedProlongation; + } + } + // Don't prolong... switch to the next phase + myStep++; + assert(myStep <= (int)myPhases.size()); + if (myStep == (int)myPhases.size()) { + myStep = 0; + } + MSPhaseDefinition* newPhase = myPhases[myStep]; + //stores the time the phase started + newPhase->myLastSwitch = MSNet::getInstance()->getCurrentTimeStep(); + // set the next event + return newPhase->minDuration; +} + + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSDelayBasedTrafficLightLogic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSDelayBasedTrafficLightLogic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSDelayBasedTrafficLightLogic.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSDelayBasedTrafficLightLogic.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,153 @@ +/****************************************************************************/ +/// @file MSDelayBasedTrafficLightLogic.h +/// @author Leonhard Luecken +/// @date Feb 2017 +/// @version +/// +// An actuated traffic light logic based on time delay of approaching vehicles +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef MSDelayBasedTrafficLightLogic_h +#define MSDelayBasedTrafficLightLogic_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include "MSSimpleTrafficLightLogic.h" + + +// =========================================================================== +// class declarations +// =========================================================================== +class NLDetectorBuilder; + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class MSDelayBasedTrafficLightLogic + * @brief An actuated traffic light logic based on time delay of approaching vehicles + * @todo Validate against the original algorithm's details. + * @note The current phase is not prolonged if the passing time of the next approaching vehicle + * is larger than the remaining greentime (in contrast to the original algorithm) + * @note The maximal green time can be exceeded if no vehicles are present on other approaches; + */ +class MSDelayBasedTrafficLightLogic : public MSSimpleTrafficLightLogic { +public: + /// @brief Definition of a map from lanes to corresponding areal detectors +// typedef std::map LaneDetectorMap; + typedef std::map LaneDetectorMap; + +public: + /** @brief Constructor + * @param[in] tlcontrol The tls control responsible for this tls + * @param[in] id This tls' id + * @param[in] programID This tls' sub-id (program id) + * @param[in] phases Definitions of the phases + * @param[in] step The initial phase index + * @param[in] delay The time to wait before the first switch + * @param[in] parameter The parameter to use for tls set-up + */ + MSDelayBasedTrafficLightLogic(MSTLLogicControl& tlcontrol, + const std::string& id, const std::string& programID, + const MSSimpleTrafficLightLogic::Phases& phases, + int step, SUMOTime delay, + const std::map& parameter, + const std::string& basePath); + + + /** @brief Initializes the tls with information about incoming lanes + * @param[in] nb The detector builder + * @exception ProcessError If something fails on initialization + */ + void init(NLDetectorBuilder& nb); + + + /// @brief Destructor + ~MSDelayBasedTrafficLightLogic(); + + + + /// @name Switching and setting current rows + /// @{ + + /** @brief Switches to the next phase, if possible + * @return The time of the next switch + * @see MSTrafficLightLogic::trySwitch + */ + SUMOTime trySwitch(); + /// @} + + +protected: + /// @name "actuated" algorithm methods + /// @{ + + /** + * @brief Checks for approaching vehicles on the lanes associated with green signals + * and returns the minimal time to keep the green phase going. + * This is zero if no vehicle on the lane has gathered any waiting time + * or if the green time is exhausted (maximal green time has passed since switch). + * @return Minimal remaining green time. + */ + SUMOTime checkForWaitingTime(); + + /** + * @brief The returned, proposed prolongation for the green phase is oriented on the + * largest estimated passing time among the vehicles with waiting time. + * @param actDuration Duration of the current phase + * @param maxDuration Maximal duration of the current phase + * @param[in/out] othersEmpty Whether there are vehicles on another approach, which is not part of a green signal group for the current phase + * @return The proposed prolongation time for the current phase + */ + SUMOTime proposeProlongation(const SUMOTime actDuration, const SUMOTime maxDuration, bool& othersEmpty); + +protected: + /// A map from lanes to the corresponding lane detectors + LaneDetectorMap myLaneDetectors; + + /// Whether the detectors shall be shown in the GUI + bool myShowDetectors; + + /// Range of the connected detector, which provides the information on approaching vehicles + double myDetectionRange; + + /// If a vehicle's timeloss is below myTimeLossThreshold, this is counted as insignificant, + /// since this may stem from dawdling, or driving only slightly slower than the maximal velocity on the lane. + // (Idea: this might be adapted to the detector-length and the vehicle's maximal speed) + double myTimeLossThreshold; + + /// The output file for generated detectors + std::string myFile; + + /// The frequency for aggregating detector output + SUMOTime myFreq; + + /// Whether detector output separates by vType + std::string myVehicleTypes; +}; + + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSDeterministicHiLevelTrafficLightLogic.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSDeterministicHiLevelTrafficLightLogic.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSDeterministicHiLevelTrafficLightLogic.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSDeterministicHiLevelTrafficLightLogic.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSDeterministicHiLevelTrafficLightLogic.cpp /// @author Riccardo Belletti /// @date Mar 2014 -/// @version $Id: MSDeterministicHiLevelTrafficLightLogic.cpp 21314 2016-08-22 10:37:46Z namdre $ +/// @version $Id: MSDeterministicHiLevelTrafficLightLogic.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The class for deterministic high level traffic light logic /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -97,15 +97,15 @@ countVehicles(getCurrentPhaseDef())); } -SUMOReal MSDeterministicHiLevelTrafficLightLogic::getMeanSpeedForInputLanes() { +double MSDeterministicHiLevelTrafficLightLogic::getMeanSpeedForInputLanes() { if (inputLanes.size() == 0) { return 0; } - SUMOReal vSpeedInTot = 0; + double vSpeedInTot = 0; for (MSLaneID_set::iterator laneIterator = inputLanes.begin(); laneIterator != inputLanes.end(); laneIterator++) { std::string laneId = *laneIterator; - SUMOReal maxSpeed = getSensors()->meanVehiclesSpeed(laneId); + double maxSpeed = getSensors()->meanVehiclesSpeed(laneId); if (maxSpeed > -1) { vSpeedInTot += (13.89 - maxSpeed) * 10. / 13.89; } @@ -115,15 +115,15 @@ return vSpeedInTot / inputLanes.size(); } -SUMOReal MSDeterministicHiLevelTrafficLightLogic::getMeanSpeedForOutputLanes() { +double MSDeterministicHiLevelTrafficLightLogic::getMeanSpeedForOutputLanes() { if (outputLanes.size() == 0) { return 0; } - SUMOReal vSpeedOutTot = 0; + double vSpeedOutTot = 0; for (MSLaneID_set::iterator laneIterator = outputLanes.begin(); laneIterator != outputLanes.end(); laneIterator++) { std::string laneId = *laneIterator; - SUMOReal maxSpeed = getSensors()->meanVehiclesSpeed(laneId); + double maxSpeed = getSensors()->meanVehiclesSpeed(laneId); if (maxSpeed > -1) { vSpeedOutTot += (13.89 - maxSpeed) * 10. / 13.89; } @@ -135,8 +135,8 @@ void MSDeterministicHiLevelTrafficLightLogic::decidePolicy() { // Decide if it is the case to check for another plan - SUMOReal mean_vSpeed_in = getMeanSpeedForInputLanes(); - SUMOReal mean_vSpeed_out = getMeanSpeedForOutputLanes(); + double mean_vSpeed_in = getMeanSpeedForInputLanes(); + double mean_vSpeed_out = getMeanSpeedForOutputLanes(); MSSOTLPolicy* oldPolicy = getCurrentPolicy(); choosePolicy(mean_vSpeed_in, mean_vSpeed_out); MSSOTLPolicy* newPolicy = getCurrentPolicy(); @@ -153,14 +153,14 @@ } void MSDeterministicHiLevelTrafficLightLogic::choosePolicy( - SUMOReal mean_vSpeed_in, SUMOReal mean_vSpeed_out) { + double mean_vSpeed_in, double mean_vSpeed_out) { int index_maxStimulus = 0; - SUMOReal maxStimulus = -1; + double maxStimulus = -1; // Compute simulus for each policy for (int i = 0; i < (int)getPolicies().size(); i++) { - SUMOReal stimulus = getPolicies()[i]->computeDesirability(mean_vSpeed_in, - mean_vSpeed_out); + double stimulus = getPolicies()[i]->computeDesirability(mean_vSpeed_in, + mean_vSpeed_out); if (stimulus > maxStimulus) { maxStimulus = stimulus; index_maxStimulus = i; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSDeterministicHiLevelTrafficLightLogic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSDeterministicHiLevelTrafficLightLogic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSDeterministicHiLevelTrafficLightLogic.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSDeterministicHiLevelTrafficLightLogic.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSDeterministicHiLevelTrafficLightLogic.h /// @author Riccardo Belletti /// @date Mar 2014 -/// @version $Id: MSDeterministicHiLevelTrafficLightLogic.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSDeterministicHiLevelTrafficLightLogic.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The class for deterministic high level traffic light logic /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -106,12 +106,12 @@ /* * @return The average pheromone level regarding congestion on input lanes */ - SUMOReal getMeanSpeedForInputLanes(); + double getMeanSpeedForInputLanes(); /* * @return The average pheromone level regarding congestion on output lanes */ - SUMOReal getMeanSpeedForOutputLanes(); + double getMeanSpeedForOutputLanes(); @@ -121,7 +121,7 @@ */ void decidePolicy(); - void choosePolicy(SUMOReal mean_vSpeed_in, SUMOReal mean_vSpeed_out); + void choosePolicy(double mean_vSpeed_in, double mean_vSpeed_out); }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSOffTrafficLightLogic.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSOffTrafficLightLogic.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSOffTrafficLightLogic.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSOffTrafficLightLogic.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 08.05.2007 -/// @version $Id: MSOffTrafficLightLogic.cpp 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: MSOffTrafficLightLogic.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A traffic lights logic which represents a tls in an off-mode /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,10 +36,6 @@ #include "MSTrafficLightLogic.h" #include "MSOffTrafficLightLogic.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSOffTrafficLightLogic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSOffTrafficLightLogic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSOffTrafficLightLogic.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSOffTrafficLightLogic.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 08.05.2007 -/// @version $Id: MSOffTrafficLightLogic.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSOffTrafficLightLogic.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A traffic lights logic which represents a tls in an off-mode /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSPhaseDefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSPhaseDefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSPhaseDefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSPhaseDefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Jan 2004 -/// @version $Id: MSPhaseDefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSPhaseDefinition.h 22840 2017-02-03 22:08:43Z luecken $ /// // The definition of a single phase of a tls logic /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -112,6 +112,7 @@ this->duration = durationArg; this->minDuration = minDurationArg < 0 ? durationArg : minDurationArg; this->maxDuration = (maxDurationArg < 0 || maxDurationArg < minDurationArg) ? durationArg : maxDurationArg; + // assert(this->minDuration <= this->maxDuration); // not ensured by the previous lines this->state = stateArg; this->myLastSwitch = string2time(OptionsCont::getOptions().getString("begin")); // SUMOTime-option //For SOTL phases diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSPhasedTrafficLightLogic.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSPhasedTrafficLightLogic.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSPhasedTrafficLightLogic.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSPhasedTrafficLightLogic.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSPhasedTrafficLightLogic.cpp /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: MSPhasedTrafficLightLogic.cpp 21316 2016-08-22 13:08:50Z behrisch $ +/// @version $Id: MSPhasedTrafficLightLogic.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // The base class for traffic light logic with phases /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include "MSTrafficLightLogic.h" #include "MSPhasedTrafficLightLogic.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== @@ -199,8 +195,7 @@ mySwitchCommand = new SwitchCommand(tlcontrol, this, stepDuration + simStep); myStep = step; MSNet::getInstance()->getBeginOfTimestepEvents()->addEvent( - mySwitchCommand, stepDuration + simStep, - MSEventControl::ADAPT_AFTER_EXECUTION); + mySwitchCommand, stepDuration + simStep); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSPhasedTrafficLightLogic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSPhasedTrafficLightLogic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSPhasedTrafficLightLogic.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSPhasedTrafficLightLogic.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSPhasedTrafficLightLogic.h /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: MSPhasedTrafficLightLogic.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSPhasedTrafficLightLogic.h 22627 2017-01-18 12:56:36Z behrisch $ /// // The base class for traffic light logic with phases /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSPushButton.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSPushButton.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSPushButton.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSPushButton.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSPushButton.h /// @author Federico Caselli /// @date 2015-07-15 -/// @version $Id: MSPushButton.cpp 20113 2016-03-01 13:22:42Z martintaraz $ +/// @version $Id: MSPushButton.cpp 22689 2017-01-24 10:37:24Z behrisch $ /// // The class for a PushButton /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -131,8 +131,8 @@ ///@brief Get the walking areas adjacent to the crossing const std::vector getWalkingAreas(const MSEdge* crossing) { std::vector walkingEdges; - getWalking(crossing->getOutgoingEdges(), walkingEdges); - getWalking(crossing->getIncomingEdges(), walkingEdges); + getWalking(crossing->getSuccessors(), walkingEdges); + getWalking(crossing->getPredecessors(), walkingEdges); return walkingEdges; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSPushButton.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSPushButton.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSPushButton.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSPushButton.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSPushButton.h /// @author Federico Caselli /// @date May 2015 -/// @version $Id: MSPushButton.h 20113 2016-03-01 13:22:42Z martintaraz $ +/// @version $Id: MSPushButton.h 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for a PushButton /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSRailCrossing.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSRailCrossing.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSRailCrossing.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSRailCrossing.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSRailCrossing.cpp /// @author Jakob Erdmann /// @date Dez 2015 -/// @version $Id: MSRailCrossing.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSRailCrossing.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A rail signal logic /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,10 +41,6 @@ #include "MSPhaseDefinition.h" #include "MSTLLogicControl.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -111,12 +107,10 @@ stayRedUntil = MAX2(stayRedUntil, avi.leavingTime); } } -#ifdef HAVE_INTERNAL_LANES if ((*it_link)->getViaLane() != 0 && (*it_link)->getViaLane()->getVehicleNumberWithPartials() > 0) { // do not open if there is still a train on the crossing stayRedUntil = MAX2(stayRedUntil, now + DELTA_T); } -#endif } //if (getID() == "cluster_1088529493_1260626727") std::cout << SIMTIME << " stayRedUntil=" << stayRedUntil; const SUMOTime wait = stayRedUntil - now; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSRailCrossing.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSRailCrossing.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSRailCrossing.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSRailCrossing.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSRailCrossing.h /// @author Jakob Erdmann /// @date Dez 2015 -/// @version $Id: MSRailCrossing.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSRailCrossing.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A rail signal logic /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSRailSignal.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSRailSignal.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSRailSignal.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSRailSignal.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Melanie Weber /// @author Andreas Kendziorra /// @date Jan 2015 -/// @version $Id: MSRailSignal.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSRailSignal.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A rail signal logic /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,10 +42,6 @@ #include "MSPhaseDefinition.h" #include "MSTLLogicControl.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== @@ -75,10 +71,10 @@ myLinkIndices[link] = (int)std::distance(myLinks.begin(), i2); //assign the index of link to link //find all lanes leading from a previous signal to link (we presume that there exists only one path from a previous signal to link) - std::vector afferentBlock; //the vector of lanes leading from a previous signal to link + std::vector afferentBlock; //the vector of lanes leading from a previous signal to link bool noRailSignal = true; //true if the considered lane is not outgoing from a rail signal //get the approaching lane of the link - MSLane* approachingLane = link->getApproachingLane(); //the lane this link is coming from + const MSLane* approachingLane = link->getLaneBefore(); //the lane this link is coming from afferentBlock.push_back(approachingLane); const MSLane* currentLane = approachingLane; //look recursively for all lanes that lie before approachingLane and add them to afferentBlock until a rail signal is found @@ -200,7 +196,7 @@ bool hasOccupiedBlock = false; std::vector::const_iterator k; for (k = myLinksToLane[lane].begin(); k != myLinksToLane[lane].end(); k++) { //for every link leading to lane - std::vector::const_iterator l; + std::vector::const_iterator l; for (l = myAfferentBlocks[(*k)].begin(); l != myAfferentBlocks[(*k)].end(); l++) { //for every lane of the block leading from a previous signal to the link (*k) if (!(*l)->isEmpty()) { //if this lane is not empty hasOccupiedBlock = true; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSRailSignal.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSRailSignal.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSRailSignal.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSRailSignal.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Melanie Weber /// @author Andreas Kendziorra /// @date Jan 2015 -/// @version $Id: MSRailSignal.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSRailSignal.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A rail signal logic /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -219,7 +219,7 @@ std::map > myLinksToLane; /// A map that maps a link from the junction to its vector of lanes leading from a previous signal to this link - std::map > myAfferentBlocks; + std::map > myAfferentBlocks; /// A map that maps an outgoing lane from the junction to its vector of lanes leading to the next signal std::map > mySucceedingBlocks; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSimpleTrafficLightLogic.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSimpleTrafficLightLogic.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSimpleTrafficLightLogic.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSimpleTrafficLightLogic.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Friedemann Wesner /// @date Sept 2002 -/// @version $Id: MSSimpleTrafficLightLogic.cpp 21316 2016-08-22 13:08:50Z behrisch $ +/// @version $Id: MSSimpleTrafficLightLogic.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // A fixed traffic light logic /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,10 +43,6 @@ #include "MSTrafficLightLogic.h" #include "MSSimpleTrafficLightLogic.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions @@ -202,8 +198,7 @@ tlcontrol.get(getID()).executeOnSwitchActions(); } MSNet::getInstance()->getBeginOfTimestepEvents()->addEvent( - mySwitchCommand, stepDuration + simStep, - MSEventControl::ADAPT_AFTER_EXECUTION); + mySwitchCommand, stepDuration + simStep); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSimpleTrafficLightLogic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSimpleTrafficLightLogic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSimpleTrafficLightLogic.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSimpleTrafficLightLogic.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Friedemann Wesner /// @date Sept 2002 -/// @version $Id: MSSimpleTrafficLightLogic.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSSimpleTrafficLightLogic.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A fixed traffic light logic /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLCongestionPolicy.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLCongestionPolicy.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLCongestionPolicy.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLCongestionPolicy.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Alessio Bonfietti /// @author Riccardo Belletti /// @date Feb 2014 -/// @version $Id: MSSOTLCongestionPolicy.cpp 20113 2016-03-01 13:22:42Z martintaraz $ +/// @version $Id: MSSOTLCongestionPolicy.cpp 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Congestion logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLCongestionPolicy.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLCongestionPolicy.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLCongestionPolicy.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLCongestionPolicy.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Alessio Bonfietti /// @author Riccardo Belletti /// @date 2014-03-20 -/// @version $Id: MSSOTLCongestionPolicy.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: MSSOTLCongestionPolicy.h 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Congestion logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLDefinitions.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLDefinitions.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLDefinitions.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLDefinitions.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSSOTLDefinitions.h /// @author Gianfilippo Slager /// @date Mar 2010 -/// @version $Id: MSSOTLDefinitions.h 20113 2016-03-01 13:22:42Z martintaraz $ +/// @version $Id: MSSOTLDefinitions.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The repository for definitions about SOTL and Swarm-based logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -60,17 +60,17 @@ typedef std::map MSLaneID_MSE2CollectorMap; //Every lane has its speed limit, it can be retrieved by lane Id -typedef std::pair MSLaneID_MaxSpeed; -typedef std::map MSLaneID_MaxSpeedMap; +typedef std::pair MSLaneID_MaxSpeed; +typedef std::map MSLaneID_MaxSpeedMap; //**************************************************** //Type definitions to implement the pheromone paradigm -typedef std::pair MSLaneId_Pheromone; +typedef std::pair MSLaneId_Pheromone; /** * This map type definition identifies a set of lanes, connected to a kind of pheromone. * Pheromone can be of different kinds to express different stimuli */ -typedef std::map MSLaneId_PheromoneMap; +typedef std::map MSLaneId_PheromoneMap; //**************************************************** diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLE2Sensors.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLE2Sensors.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLE2Sensors.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLE2Sensors.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Alessio Bonfietti /// @author Federico Caselli /// @date 2010-02-25 -/// @version $Id: MSSOTLE2Sensors.cpp 21577 2016-09-29 09:58:48Z behrisch $ +/// @version $Id: MSSOTLE2Sensors.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The class for SOTL sensors of "E2" type /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -26,6 +26,8 @@ #include #include "MSSOTLE2Sensors.h" +#define INVALID_POSITION std::numeric_limits::max() + MSSOTLE2Sensors::MSSOTLE2Sensors(std::string tlLogicID, const MSTrafficLightLogic::Phases* phases) : MSSOTLSensors(tlLogicID, phases) { @@ -43,7 +45,7 @@ void MSSOTLE2Sensors::buildSensors( MSTrafficLightLogic::LaneVectorVector controlledLanes, - NLDetectorBuilder& nb, SUMOReal sensorLength) { + NLDetectorBuilder& nb, double sensorLength) { //for each lane build an appropriate sensor on it MSLane* currentLane = NULL; @@ -104,7 +106,7 @@ } void MSSOTLE2Sensors::buildOutSensors( MSTrafficLightLogic::LaneVectorVector controlledLanes, - NLDetectorBuilder& nb, SUMOReal sensorLength) { + NLDetectorBuilder& nb, double sensorLength) { //for each lane build an appropriate sensor on it MSLane* currentLane = NULL; @@ -121,8 +123,8 @@ } void MSSOTLE2Sensors::buildCountSensorForLane(MSLane* lane, NLDetectorBuilder& nb) { - SUMOReal sensorPos; - SUMOReal lensorLength; + double sensorPos; + double lensorLength; MSE2Collector* newSensor = NULL; //Check not to have more than a sensor for lane if (m_sensorMap.find(lane->getID()) == m_sensorMap.end()) { @@ -131,29 +133,28 @@ sensorPos = COUNT_SENSOR_START <= lane->getLength() ? COUNT_SENSOR_START : 0; //Original: - SUMOReal sensorLength = INPUT_COUNT_SENSOR_LENGTH; + double sensorLength = INPUT_COUNT_SENSOR_LENGTH; //Check and trim if the lane is not long enough for the specified sensor length lensorLength = sensorLength <= (lane->getLength() - sensorPos) ? sensorLength : (lane->getLength() - sensorPos); //TODO check this lengths - DBG( - std::ostringstream phero_str; - phero_str << " lane " << lane->getID() << " sensorPos= " << sensorPos - << " ,SENSOR_START " << SENSOR_START << "; lane->getLength = " - << lane->getLength() << " ,lensorLength= " << lensorLength - << " ,SENSOR_LENGTH= " << INPUT_SENSOR_LENGTH; - WRITE_MESSAGE( - "MSSOTLE2Sensors::buildSensorForLane::" + phero_str.str()); - ) +// DBG( +// std::ostringstream phero_str; +// phero_str << " lane " << lane->getID() << " sensorPos= " << sensorPos +// << " ,SENSOR_START " << SENSOR_START << "; lane->getLength = " +// << lane->getLength() << " ,lensorLength= " << lensorLength +// << " ,SENSOR_LENGTH= " << INPUT_SENSOR_LENGTH; +// WRITE_MESSAGE( +// "MSSOTLE2Sensors::buildSensorForLane::" + phero_str.str()); +// ) //Create sensor for lane and insert it into the map - newSensor = nb.buildSingleLaneE2Det( + newSensor = nb.createE2Detector( "SOTL_E2_lane:" + lane->getID() + "_tl:" + tlLogicID, DU_TL_CONTROL, lane, - (lane->getLength() - sensorPos - lensorLength), lensorLength, + (lane->getLength() - sensorPos - lensorLength), INVALID_POSITION, lensorLength, HALTING_TIME_THRS, HALTING_SPEED_THRS, DIST_THRS, ""); - //newSensor = nb.buildSingleLaneE2Det("SOTL_E2_lane:"+lane->getID()+"_tl:"+tlLogicID, DU_TL_CONTROL, lane, (lane->getLength() - sensorPos- 5), lensorLength, HALTING_TIME_THRS, HALTING_SPEED_THRS, DIST_THRS); MSNet::getInstance()->getDetectorControl().add( SUMO_TAG_LANE_AREA_DETECTOR, newSensor); @@ -164,14 +165,14 @@ } void MSSOTLE2Sensors::buildCountSensorForOutLane(MSLane* lane, NLDetectorBuilder& nb) { - SUMOReal sensorPos; - SUMOReal lensorLength; + double sensorPos; + double lensorLength; MSE2Collector* newSensor = NULL; //Check not to have more than a sensor for lane if (m_sensorMap.find(lane->getID()) == m_sensorMap.end()) { //Original: - SUMOReal sensorLength = OUTPUT_COUNT_SENSOR_LENGTH; + double sensorLength = OUTPUT_COUNT_SENSOR_LENGTH; //Check and set zero if the lane is not long enough for the specified sensor start sensorPos = (lane->getLength() - sensorLength) - (SENSOR_START <= lane->getLength() ? SENSOR_START : 0); @@ -182,23 +183,22 @@ sensorLength : (lane->getLength() - sensorPos); //TODO check this lengths - DBG( - std::ostringstream phero_str; - phero_str << " lane " << lane->getID() << " sensorPos= " << sensorPos - << " ,SENSOR_START " << SENSOR_START << "; lane->getLength = " - << lane->getLength() << " ,lensorLength= " << lensorLength - << " ,SENSOR_LENGTH= " << INPUT_SENSOR_LENGTH; - WRITE_MESSAGE( - "MSSOTLE2Sensors::buildSensorForLane::" + phero_str.str()); - ) +// DBG( +// std::ostringstream phero_str; +// phero_str << " lane " << lane->getID() << " sensorPos= " << sensorPos +// << " ,SENSOR_START " << SENSOR_START << "; lane->getLength = " +// << lane->getLength() << " ,lensorLength= " << lensorLength +// << " ,SENSOR_LENGTH= " << INPUT_SENSOR_LENGTH; +// WRITE_MESSAGE( +// "MSSOTLE2Sensors::buildSensorForLane::" + phero_str.str()); +// ) //Create sensor for lane and insert it into the map - newSensor = nb.buildSingleLaneE2Det( + newSensor = nb.createE2Detector( "SOTL_E2_lane:" + lane->getID() + "_tl:" + tlLogicID, DU_TL_CONTROL, lane, - (lane->getLength() - sensorPos - lensorLength), lensorLength, + (lane->getLength() - sensorPos - lensorLength), INVALID_POSITION, lensorLength, HALTING_TIME_THRS, HALTING_SPEED_THRS, DIST_THRS, ""); - //newSensor = nb.buildSingleLaneE2Det("SOTL_E2_lane:"+lane->getID()+"_tl:"+tlLogicID, DU_TL_CONTROL, lane, (lane->getLength() - sensorPos- 5), lensorLength, HALTING_TIME_THRS, HALTING_SPEED_THRS, DIST_THRS); MSNet::getInstance()->getDetectorControl().add( SUMO_TAG_LANE_AREA_DETECTOR, newSensor); @@ -239,26 +239,6 @@ } /*******************************************************************************/ -/* @brief Builds an e2 detector that lies on only one lane - * - * @param[in] id The id the detector shall have - * @param[in] usage Information how the detector is used within the simulation - * @param[in] lane The lane the detector is placed at - * @param[in] pos The position on the lane the detector is placed at - * @param[in] length The length the detector has - * @param[in] haltingTimeThreshold Detector parameter: the time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed - * @param[in] haltingSpeedThreshold Detector parameter: the speed a vehicle's speed must be below to be assigned as jammed - * @param[in] jamDistThreshold Detector parameter: the distance between two vehicles in order to not count them to one jam - * @todo Check whether this method is really needful - */ -/* - Using - MSE2Collector* buildSingleLaneE2Det(const std::string& id, - DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length, - SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold); - - */ void MSSOTLE2Sensors::buildSensorForLane(MSLane* lane, NLDetectorBuilder& nb) { buildSensorForLane(lane, nb, INPUT_SENSOR_LENGTH); @@ -266,13 +246,13 @@ -void MSSOTLE2Sensors::buildSensorForLane(MSLane* lane, NLDetectorBuilder& nb, SUMOReal sensorLength) { +void MSSOTLE2Sensors::buildSensorForLane(MSLane* lane, NLDetectorBuilder& nb, double sensorLength) { const MSEdge* edge = &lane->getEdge(); if (edge->isInternal() || edge->isWalkingArea() || edge->isCrossing()) { return; } - SUMOReal sensorPos; - SUMOReal lensorLength; + double sensorPos; + double lensorLength; MSE2Collector* newSensor = NULL; //Check not to have more than a sensor for lane if (m_sensorMap.find(lane->getID()) == m_sensorMap.end()) { @@ -282,23 +262,22 @@ //Check and trim if the lane is not long enough for the specified sensor lenght lensorLength = sensorLength <= (lane->getLength() - sensorPos) ? sensorLength : (lane->getLength() - sensorPos); //TODO check this lengths - DBG( - std::ostringstream phero_str; - phero_str << " lane " << lane->getID() << " sensorPos= " << sensorPos - << " ,SENSOR_START " << SENSOR_START << "; lane->getLength = " - << lane->getLength() << " ,lensorLength= " << lensorLength - << " ,SENSOR_LENGTH= " << INPUT_SENSOR_LENGTH; - WRITE_MESSAGE( - "MSSOTLE2Sensors::buildSensorForLane::" + phero_str.str()); - ) +// DBG( +// std::ostringstream phero_str; +// phero_str << " lane " << lane->getID() << " sensorPos= " << sensorPos +// << " ,SENSOR_START " << SENSOR_START << "; lane->getLength = " +// << lane->getLength() << " ,lensorLength= " << lensorLength +// << " ,SENSOR_LENGTH= " << INPUT_SENSOR_LENGTH; +// WRITE_MESSAGE( +// "MSSOTLE2Sensors::buildSensorForLane::" + phero_str.str()); +// ) //Create sensor for lane and insert it into the map - newSensor = nb.buildSingleLaneE2Det( + newSensor = nb.createE2Detector( "SOTL_E2_lane:" + lane->getID() + "_tl:" + tlLogicID, DU_TL_CONTROL, lane, - (lane->getLength() - sensorPos - lensorLength), lensorLength, + (lane->getLength() - sensorPos - lensorLength), INVALID_POSITION, lensorLength, HALTING_TIME_THRS, HALTING_SPEED_THRS, DIST_THRS, ""); -//newSensor = nb.buildSingleLaneE2Det("SOTL_E2_lane:"+lane->getID()+"_tl:"+tlLogicID, DU_TL_CONTROL, lane, (lane->getLength() - sensorPos- 5), lensorLength, HALTING_TIME_THRS, HALTING_SPEED_THRS, DIST_THRS); MSNet::getInstance()->getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, newSensor); @@ -319,14 +298,14 @@ } } -void MSSOTLE2Sensors::buildContinueSensior(MSLane* lane, NLDetectorBuilder& nb, SUMOReal sensorLength, MSLane* continueOnLane, SUMOReal usedLength) { - SUMOReal availableLength = sensorLength - usedLength; +void MSSOTLE2Sensors::buildContinueSensior(MSLane* lane, NLDetectorBuilder& nb, double sensorLength, MSLane* continueOnLane, double usedLength) { + double availableLength = sensorLength - usedLength; if (m_sensorMap.find(continueOnLane->getID()) == m_sensorMap.end()) { - SUMOReal length = availableLength <= continueOnLane->getLength() ? availableLength : continueOnLane->getLength(); - MSE2Collector* newSensor = nb.buildSingleLaneE2Det( + double length = availableLength <= continueOnLane->getLength() ? availableLength : continueOnLane->getLength(); + MSE2Collector* newSensor = nb.createE2Detector( "SOTL_E2_lane:" + continueOnLane->getID() + "_tl:" + tlLogicID, DU_TL_CONTROL, continueOnLane, - (continueOnLane->getLength() - length), length, + (continueOnLane->getLength() - length), INVALID_POSITION, length, HALTING_TIME_THRS, HALTING_SPEED_THRS, DIST_THRS, ""); MSNet::getInstance()->getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, newSensor); m_sensorMap.insert(MSLaneID_MSE2Collector(continueOnLane->getID(), newSensor)); @@ -352,15 +331,15 @@ } void MSSOTLE2Sensors::buildSensorForOutLane(MSLane* lane, - NLDetectorBuilder& nb, SUMOReal sensorLength) { - SUMOReal sensorPos; - SUMOReal lensorLength; + NLDetectorBuilder& nb, double sensorLength) { + double sensorPos; + double lensorLength; MSE2Collector* newSensor = NULL; //Check not to have more than a sensor for lane if (m_sensorMap.find(lane->getID()) == m_sensorMap.end()) { //Original: - //SUMOReal sensorLength = OUTPUT_SENSOR_LENGTH; + //double sensorLength = OUTPUT_SENSOR_LENGTH; //Check and set zero if the lane is not long enough for the specified sensor start sensorPos = (lane->getLength() - sensorLength) - (SENSOR_START <= lane->getLength() ? SENSOR_START : 0); @@ -371,23 +350,22 @@ sensorLength : (lane->getLength() - sensorPos); //TODO check this lengths - DBG( - std::ostringstream phero_str; - phero_str << " lane " << lane->getID() << " sensorPos= " << sensorPos - << " ,SENSOR_START " << SENSOR_START << "; lane->getLength = " - << lane->getLength() << " ,lensorLength= " << lensorLength - << " ,SENSOR_LENGTH= " << INPUT_SENSOR_LENGTH; - WRITE_MESSAGE( - "MSSOTLE2Sensors::buildSensorForLane::" + phero_str.str()); - ) +// DBG( +// std::ostringstream phero_str; +// phero_str << " lane " << lane->getID() << " sensorPos= " << sensorPos +// << " ,SENSOR_START " << SENSOR_START << "; lane->getLength = " +// << lane->getLength() << " ,lensorLength= " << lensorLength +// << " ,SENSOR_LENGTH= " << INPUT_SENSOR_LENGTH; +// WRITE_MESSAGE( +// "MSSOTLE2Sensors::buildSensorForLane::" + phero_str.str()); +// ) //Create sensor for lane and insert it into the map - newSensor = nb.buildSingleLaneE2Det( + newSensor = nb.createE2Detector( "SOTL_E2_lane:" + lane->getID() + "_tl:" + tlLogicID, DU_TL_CONTROL, lane, - (lane->getLength() - sensorPos - lensorLength), lensorLength, + (lane->getLength() - sensorPos - lensorLength), INVALID_POSITION, lensorLength, HALTING_TIME_THRS, HALTING_SPEED_THRS, DIST_THRS, ""); - //newSensor = nb.buildSingleLaneE2Det("SOTL_E2_lane:"+lane->getID()+"_tl:"+tlLogicID, DU_TL_CONTROL, lane, (lane->getLength() - sensorPos- 5), lensorLength, HALTING_TIME_THRS, HALTING_SPEED_THRS, DIST_THRS); MSNet::getInstance()->getDetectorControl().add( SUMO_TAG_LANE_AREA_DETECTOR, newSensor); @@ -405,23 +383,25 @@ * Estimate queue lenght according to the distance of the last vehicles */ -SUMOReal MSSOTLE2Sensors::getEstimateQueueLength(std::string laneId) { +double MSSOTLE2Sensors::getEstimateQueueLength(std::string laneId) { MSLaneID_MSE2CollectorMap::const_iterator sensorsIterator = m_sensorMap.find(laneId); if (sensorsIterator == m_sensorMap.end()) { assert(0); return 0; } else { - SUMOReal estQL = sensorsIterator->second->getEstimateQueueLength(); + double estQL = sensorsIterator->second->getEstimateQueueLength(); if (estQL == -1) { return 0; } else - DBG( - std::ostringstream str; - str << "MSSOTLE2Sensors::getEstimateQueueLength lane " << sensorsIterator->second->getLane()->getID() - << " laneLength " << sensorsIterator->second->getLane()->getLength() << " estimateQueueLength " << estQL; - WRITE_MESSAGE(str.str()); - ) +// DBG( +// std::ostringstream str; +// str << "MSSOTLE2Sensors::getEstimateQueueLength lane " << sensorsIterator->second->getLane()->getID() +// << " laneLength " << sensorsIterator->second->getLane()->getLength() << " estimateQueueLength " << estQL; +// WRITE_MESSAGE(str.str()); +// ) + { return estQL; + } } } @@ -462,7 +442,7 @@ return count(sensorsIterator->second) + additional; } -SUMOReal MSSOTLE2Sensors::getMaxSpeed(std::string laneId) { +double MSSOTLE2Sensors::getMaxSpeed(std::string laneId) { MSLaneID_MaxSpeedMap::const_iterator sensorsIteratorIn = m_maxSpeedMap.find(laneId); if (sensorsIteratorIn == m_maxSpeedMap.end()) { assert(0); @@ -472,35 +452,35 @@ return sensorsIteratorIn->second; } -SUMOReal MSSOTLE2Sensors::meanVehiclesSpeed(MSLane* lane) { +double MSSOTLE2Sensors::meanVehiclesSpeed(MSLane* lane) { return meanVehiclesSpeed(lane->getID()); } -SUMOReal MSSOTLE2Sensors::meanVehiclesSpeed(std::string laneId) { +double MSSOTLE2Sensors::meanVehiclesSpeed(std::string laneId) { MSLaneID_MSE2CollectorMap::const_iterator sensorsIteratorOut = m_sensorMap.find(laneId); if (sensorsIteratorOut == m_sensorMap.end()) { assert(0); WRITE_ERROR("MSSOTLE2Sensors::meanVehiclesSpeed:: No lane found " + laneId); return 0; } - SUMOReal meanSpeedAcc = 0; + double meanSpeedAcc = 0; int totalCarNumer = 0; if (m_continueSensorOnLanes.find(laneId) != m_continueSensorOnLanes.end()) for (std::vector::iterator it = m_continueSensorOnLanes[laneId].begin(); it != m_continueSensorOnLanes[laneId].end(); ++ it) { int number = 0; - SUMOReal mean = -1; + double mean = -1; if (!getVelueFromSensor(*it, &MSE2Collector::getCurrentVehicleNumber, number)) { continue; } totalCarNumer += number; getVelueFromSensor(*it, &MSE2Collector::getCurrentMeanSpeed, mean); - meanSpeedAcc += mean * (SUMOReal) number; + meanSpeedAcc += mean * (double) number; } int number = sensorsIteratorOut->second->getCurrentVehicleNumber(); totalCarNumer += number; - SUMOReal mean = sensorsIteratorOut->second->getCurrentMeanSpeed(); - meanSpeedAcc += mean * (SUMOReal) number; - return totalCarNumer == 0 ? -1 : meanSpeedAcc / (SUMOReal) totalCarNumer; + double mean = sensorsIteratorOut->second->getCurrentMeanSpeed(); + meanSpeedAcc += mean * (double) number; + return totalCarNumer == 0 ? -1 : meanSpeedAcc / (double) totalCarNumer; } std::string trim(std::string& str) { @@ -544,23 +524,23 @@ return totCars; } int number = 0; - const std::vector vehicles = sensor->getCurrentVehicles(); + const std::vector vehicles = sensor->getCurrentVehicles(); std::ostringstream logstr; logstr << "[MSSOTLE2Sensors::count]"; - for (std::vector::const_iterator vit = vehicles.begin(); vit != vehicles.end(); ++vit) { - if (vit->stillOnDet) { - const std::string vtype = vit->type; + for (std::vector::const_iterator vit = vehicles.begin(); vit != vehicles.end(); ++vit) { + if ((*vit)->onDetector) { + const std::string vtype = (*vit)->type; if (m_typeWeightMap.find(vtype) != m_typeWeightMap.end()) { number += m_typeWeightMap[vtype]; - DBG(logstr << " Added " << m_typeWeightMap[vtype] << " for vtype " << vtype;) +// DBG(logstr << " Added " << m_typeWeightMap[vtype] << " for vtype " << vtype;) } else { ++number; } } } - DBG(if (totCars != number) { - logstr << ". Real number " << totCars << "; weighted " << number; - WRITE_MESSAGE(logstr.str()); - }) +// DBG(if (totCars != number) { +// logstr << ". Real number " << totCars << "; weighted " << number; +// WRITE_MESSAGE(logstr.str()); +// }) return number; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLE2Sensors.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLE2Sensors.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLE2Sensors.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLE2Sensors.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,14 @@ /// @author Gianfilippo Slager /// @author Federico Caselli /// @date Feb 2010 -/// @version $Id: MSSOTLE2Sensors.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSSOTLE2Sensors.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The class for SOTL sensors of "E2" type +// XXX: Not tested with MSMultiLaneE2Collector (Generalization of MSE2Collector). If this is to be used in the future and you run into problems, +// start taking a look at the getEstimateQueueLength() method of the collector. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,10 +36,10 @@ class MSSOTLE2Sensors : public MSSOTLSensors { protected : void buildSensorForLane(MSLane* lane, NLDetectorBuilder& nb); - void buildSensorForLane(MSLane* lane, NLDetectorBuilder& nb, SUMOReal sensorLength); - void buildContinueSensior(MSLane* lane, NLDetectorBuilder& nb, SUMOReal sensorLength, MSLane* continueOnLane, SUMOReal usedLength); + void buildSensorForLane(MSLane* lane, NLDetectorBuilder& nb, double sensorLength); + void buildContinueSensior(MSLane* lane, NLDetectorBuilder& nb, double sensorLength, MSLane* continueOnLane, double usedLength); void buildSensorForOutLane(MSLane* lane, NLDetectorBuilder& nb); - void buildSensorForOutLane(MSLane* lane, NLDetectorBuilder& nb, SUMOReal sensorLength); + void buildSensorForOutLane(MSLane* lane, NLDetectorBuilder& nb, double sensorLength); void buildCountSensorForLane(MSLane* lane, NLDetectorBuilder& nb); void buildCountSensorForOutLane(MSLane* lane, NLDetectorBuilder& nb); @@ -54,9 +56,9 @@ ~MSSOTLE2Sensors(void); void buildSensors(MSTrafficLightLogic::LaneVectorVector controlledLanes, NLDetectorBuilder& nb); - void buildSensors(MSTrafficLightLogic::LaneVectorVector controlledLanes, NLDetectorBuilder& nb, SUMOReal sensorLength); + void buildSensors(MSTrafficLightLogic::LaneVectorVector controlledLanes, NLDetectorBuilder& nb, double sensorLength); void buildOutSensors(MSTrafficLightLogic::LaneVectorVector controlledLanes, NLDetectorBuilder& nb); - void buildOutSensors(MSTrafficLightLogic::LaneVectorVector controlledLanes, NLDetectorBuilder& nb, SUMOReal sensorLength); + void buildOutSensors(MSTrafficLightLogic::LaneVectorVector controlledLanes, NLDetectorBuilder& nb, double sensorLength); void buildCountSensors(MSTrafficLightLogic::LaneVectorVector controlledLanes, NLDetectorBuilder& nb); void buildCountOutSensors(MSTrafficLightLogic::LaneVectorVector controlledLanes, NLDetectorBuilder& nb); @@ -75,7 +77,7 @@ */ void subtractPassedVeh(std::string laneId, int passed); - void setSpeedThresholdParam(SUMOReal newThreshold) { + void setSpeedThresholdParam(double newThreshold) { speedThresholdParam = newThreshold; } @@ -97,12 +99,12 @@ int estimateVehicles(std::string laneId); - SUMOReal getEstimateQueueLength(std::string laneId); + double getEstimateQueueLength(std::string laneId); /* * @param[in] The lane given by Id * @return The maximum speed allowed for the given laneId */ - virtual SUMOReal getMaxSpeed(std::string laneId); + virtual double getMaxSpeed(std::string laneId); /* * Returns the average speed of vehicles currently approaching or leaving the @@ -110,7 +112,7 @@ * Vehicles speed is effectively sensed or guessed in the space from the sensor. * @param[in] lane The lane to count vehicles */ - virtual SUMOReal meanVehiclesSpeed(MSLane* lane); + virtual double meanVehiclesSpeed(MSLane* lane); /* * Returns the average speed of vehicles currently approaching or leaving the @@ -118,7 +120,7 @@ * Vehicles speed is effectively sensed or guessed in the space from the sensor. * @param[in] laneID The lane to count vehicles by ID */ - virtual SUMOReal meanVehiclesSpeed(std::string laneId); + virtual double meanVehiclesSpeed(std::string laneId); /* * Set the weight of the vehicle types to be used by countVehicles @@ -145,7 +147,7 @@ // MSLaneID_MSE2CollectorMap mySensorsIDMap_OutLanes; // MSLaneID_MaxSpeedMap myMaxSpeedMap_OutLanes; - SUMOReal speedThresholdParam; + double speedThresholdParam; std::map > m_continueSensorOnLanes; std::map m_typeWeightMap; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLHiLevelTrafficLightLogic.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLHiLevelTrafficLightLogic.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLHiLevelTrafficLightLogic.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLHiLevelTrafficLightLogic.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,11 +2,11 @@ /// @file MSSOTLHiLevelTrafficLightLogic.cpp /// @author Alessio Bonfietti /// @date Jun 2013 -/// @version $Id: MSSOTLHiLevelTrafficLightLogic.cpp 21217 2016-07-22 10:57:44Z behrisch $ +/// @version $Id: MSSOTLHiLevelTrafficLightLogic.cpp 22627 2017-01-18 12:56:36Z behrisch $ /// /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2013 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLHiLevelTrafficLightLogic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLHiLevelTrafficLightLogic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLHiLevelTrafficLightLogic.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLHiLevelTrafficLightLogic.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,11 +5,11 @@ /// @author Anna Chiara Bellini /// @author Federico Caselli /// @date Jun 2013 -/// @version $Id: MSSOTLHiLevelTrafficLightLogic.h 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: MSSOTLHiLevelTrafficLightLogic.h 22627 2017-01-18 12:56:36Z behrisch $ /// /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2013 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLMarchingPolicy.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLMarchingPolicy.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLMarchingPolicy.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLMarchingPolicy.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Riccardo Belletti /// @author Federico Caselli /// @date 2014-03-20 -/// @version $Id: MSSOTLMarchingPolicy.cpp 20113 2016-03-01 13:22:42Z martintaraz $ +/// @version $Id: MSSOTLMarchingPolicy.cpp 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Marching logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLMarchingPolicy.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLMarchingPolicy.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLMarchingPolicy.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLMarchingPolicy.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Riccardo Belletti /// @author Federico Caselli /// @date Feb 2014 -/// @version $Id: MSSOTLMarchingPolicy.h 20113 2016-03-01 13:22:42Z martintaraz $ +/// @version $Id: MSSOTLMarchingPolicy.h 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Marching logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPhasePolicy.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPhasePolicy.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPhasePolicy.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPhasePolicy.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Gianfilippo Slager /// @author Federico Caselli /// @date Feb 2010 -/// @version $Id: MSSOTLPhasePolicy.cpp 20113 2016-03-01 13:22:42Z martintaraz $ +/// @version $Id: MSSOTLPhasePolicy.cpp 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Phase logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPhasePolicy.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPhasePolicy.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPhasePolicy.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPhasePolicy.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Gianfilippo Slager /// @author Federico Caselli /// @date Feb 2010 -/// @version $Id: MSSOTLPhasePolicy.h 20113 2016-03-01 13:22:42Z martintaraz $ +/// @version $Id: MSSOTLPhasePolicy.h 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Phase logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPhaseTrafficLightLogic.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPhaseTrafficLightLogic.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPhaseTrafficLightLogic.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPhaseTrafficLightLogic.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSSOTLPhaseTrafficLightLogic.cpp /// @author Gianfilippo Slager /// @date Feb 2010 -/// @version $Id: MSSOTLPhaseTrafficLightLogic.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSSOTLPhaseTrafficLightLogic.cpp 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Phase logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPhaseTrafficLightLogic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPhaseTrafficLightLogic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPhaseTrafficLightLogic.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPhaseTrafficLightLogic.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSSOTLPhaseTrafficLightLogic.h /// @author Gianfilippo Slager /// @date Feb 2010 -/// @version $Id: MSSOTLPhaseTrafficLightLogic.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSSOTLPhaseTrafficLightLogic.h 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Phase logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPlatoonPolicy.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPlatoonPolicy.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPlatoonPolicy.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPlatoonPolicy.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Gianfilippo Slager /// @author Federico Caselli /// @date Feb 2010 -/// @version $Id: MSSOTLPlatoonPolicy.cpp 20113 2016-03-01 13:22:42Z martintaraz $ +/// @version $Id: MSSOTLPlatoonPolicy.cpp 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Platoon logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPlatoonPolicy.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPlatoonPolicy.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPlatoonPolicy.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPlatoonPolicy.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Gianfilippo Slager /// @author Federico Caselli /// @date Feb 2010 -/// @version $Id: MSSOTLPlatoonPolicy.h 20113 2016-03-01 13:22:42Z martintaraz $ +/// @version $Id: MSSOTLPlatoonPolicy.h 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Platoon logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPlatoonTrafficLightLogic.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPlatoonTrafficLightLogic.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPlatoonTrafficLightLogic.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPlatoonTrafficLightLogic.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSSOTLPlatoonTrafficLightLogic.cpp /// @author Gianfilippo Slager /// @date Feb 2010 -/// @version $Id: MSSOTLPlatoonTrafficLightLogic.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSSOTLPlatoonTrafficLightLogic.cpp 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Platoon logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPlatoonTrafficLightLogic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPlatoonTrafficLightLogic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPlatoonTrafficLightLogic.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPlatoonTrafficLightLogic.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSSOTLPlatoonTrafficLightLogic.h /// @author Gianfilippo Slager /// @date 2010-02-25 -/// @version $Id: MSSOTLPlatoonTrafficLightLogic.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSSOTLPlatoonTrafficLightLogic.h 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Platoon logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy3DStimulus.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy3DStimulus.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy3DStimulus.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy3DStimulus.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSSOTLPolicyStimulus.cpp /// @author Riccardo Belletti /// @date Mar 2014 -/// @version $Id: MSSOTLPolicy3DStimulus.cpp 20113 2016-03-01 13:22:42Z martintaraz $ +/// @version $Id: MSSOTLPolicy3DStimulus.cpp 22628 2017-01-18 12:58:45Z behrisch $ /// // The class for Swarm-based low-level policy /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2013 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy3DStimulus.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy3DStimulus.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy3DStimulus.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy3DStimulus.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSSOTLPolicyStimulus.h /// @author Riccardo Belletti /// @date Mar 2014 -/// @version $Id: MSSOTLPolicy3DStimulus.h 20113 2016-03-01 13:22:42Z martintaraz $ +/// @version $Id: MSSOTLPolicy3DStimulus.h 22628 2017-01-18 12:58:45Z behrisch $ /// // The class the low-level policy stimulus /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2013 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy5DFamilyStimulus.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy5DFamilyStimulus.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy5DFamilyStimulus.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy5DFamilyStimulus.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Riccardo Belletti /// @author Simone Bacchilega /// @date 2014-09-30 -/// @version $Id: MSSOTLPolicy5DFamilyStimulus.cpp 21201 2016-07-19 11:57:22Z behrisch $ +/// @version $Id: MSSOTLPolicy5DFamilyStimulus.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The class for Swarm-based low-level policy /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2013 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -19,8 +19,23 @@ // /****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include #include "MSSOTLPolicy5DFamilyStimulus.h" + +// =========================================================================== +// method definitions +// =========================================================================== MSSOTLPolicy5DFamilyStimulus::MSSOTLPolicy5DFamilyStimulus(std::string keyPrefix, const std::map& parameters) : MSSOTLPolicyDesirability(keyPrefix, parameters) { @@ -72,27 +87,22 @@ for (int i = 0; i < (int)params_names.size(); i ++) { std::string key = keyPrefix + params_names[i]; std::string param_list = getParameter(key, default_values[params_names[i]]); + std::vector tokens = StringTokenizer(param_list, ";").getVector(); - char* dup = strdup(param_list.c_str()); - int token_counter; - char* pch; - - for (token_counter = 0, pch = strtok(dup, ";"); token_counter < size_family; ++token_counter, pch = strtok(NULL, ";")) { - if (pch == NULL) { + for (int token_counter = 0; token_counter < size_family; ++token_counter) { + if (token_counter >= (int)tokens.size()) { std::ostringstream errorMessage; errorMessage << "Error in " << key << ": not enough tokens."; WRITE_ERROR(errorMessage.str()); assert(-1); } - std::string token_found(pch); DBG( std::ostringstream str; - str << "found token " << token_found << " position " << token_counter; + str << "found token " << tokens[token_counter] << " position " << token_counter; WRITE_MESSAGE(str.str()); ) - (sliced_maps[token_counter])[key] = token_found; + sliced_maps[token_counter][key] = tokens[token_counter]; } - free(dup); } for (int i = 0; i < size_family; i++) { @@ -103,7 +113,7 @@ } -SUMOReal MSSOTLPolicy5DFamilyStimulus::computeDesirability(SUMOReal vehInMeasure, SUMOReal vehOutMeasure, SUMOReal vehInDispersionMeasure, SUMOReal vehOutDispersionMeasure) { +double MSSOTLPolicy5DFamilyStimulus::computeDesirability(double vehInMeasure, double vehOutMeasure, double vehInDispersionMeasure, double vehOutDispersionMeasure) { /*DBG( std::ostringstream str; str << "cox=" << getStimCox() << ", cox_exp_in=" << getStimCoxExpIn() << ", cox_exp_out=" << getStimCoxExpOut() @@ -112,9 +122,9 @@ // it seems to be not enough, a strange segmentation fault appears... // if((getStimCoxExpIn()!=0.0 && getStimDivisorIn()==0.0)||(getStimCoxExpOut()!=0.0 && getStimDivisorOut()==0.0)){ - SUMOReal best_stimulus = -1; + double best_stimulus = -1; for (std::vector::const_iterator it = family.begin(); it != family.end(); it++) { - SUMOReal temp_stimulus = (*it)->computeDesirability(vehInMeasure, vehOutMeasure, vehInDispersionMeasure, vehOutDispersionMeasure); + double temp_stimulus = (*it)->computeDesirability(vehInMeasure, vehOutMeasure, vehInDispersionMeasure, vehOutDispersionMeasure); DBG( std::ostringstream str; str << "STIMULUS: " << temp_stimulus; @@ -134,7 +144,7 @@ } -SUMOReal MSSOTLPolicy5DFamilyStimulus::computeDesirability(SUMOReal vehInMeasure, SUMOReal vehOutMeasure) { +double MSSOTLPolicy5DFamilyStimulus::computeDesirability(double vehInMeasure, double vehOutMeasure) { return computeDesirability(vehInMeasure, vehOutMeasure, 0, 0); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy5DFamilyStimulus.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy5DFamilyStimulus.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy5DFamilyStimulus.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy5DFamilyStimulus.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Riccardo Belletti /// @author Simone Bacchilega /// @date 2014-09-30 -/// @version $Id: MSSOTLPolicy5DFamilyStimulus.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: MSSOTLPolicy5DFamilyStimulus.h 24108 2017-04-27 18:43:30Z behrisch $ /// // The class the low-level policy stimulus /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2013 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -51,7 +51,7 @@ private: - /*SUMOReal stimCoxDVal, + /*double stimCoxDVal, stimOffsetInDVal, stimOffsetOutDVal, stimOffsetDispersionInDVal, stimOffsetDispersionOutDVal, stimDivInDVal, stimDivOutDVal, stimDivDispersionInDVal, stimDivDispersionOutDVal, stimCoxExpInDVal, stimCoxExpOutDVal, stimCoxExpDispersionInDVal, stimCoxExpDispersionOutDVal;*/ @@ -76,10 +76,10 @@ * @brief Computes stimulus function * stimulus = cox * exp(-pow(pheroIn - offsetIn, 2)/divisor -pow(pheroOut - offsetOut, 2)/divisor); */ - virtual SUMOReal computeDesirability(SUMOReal vehInMeasure, - SUMOReal vehOutMeasure); + virtual double computeDesirability(double vehInMeasure, + double vehOutMeasure); - virtual SUMOReal computeDesirability(SUMOReal vehInMeasure, SUMOReal vehOutMeasure, SUMOReal vehInDispersionMeasure, SUMOReal vehOutDispersionMeasure); + virtual double computeDesirability(double vehInMeasure, double vehOutMeasure, double vehInDispersionMeasure, double vehOutDispersionMeasure); }; #endif /* MSSOTLPOLICY5DFAMILYSTIMULUS_H_ */ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy5DStimulus.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy5DStimulus.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy5DStimulus.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy5DStimulus.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Riccardo Belletti /// @author Simone Bacchilega /// @date 2014-09-30 -/// @version $Id: MSSOTLPolicy5DStimulus.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: MSSOTLPolicy5DStimulus.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The class for Swarm-based low-level policy /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2013 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,7 +40,7 @@ stimCoxExpDispersionOutDVal = 0; } -SUMOReal MSSOTLPolicy5DStimulus::computeDesirability(SUMOReal vehInMeasure, SUMOReal vehOutMeasure, SUMOReal vehInDispersionMeasure, SUMOReal vehOutDispersionMeasure) { +double MSSOTLPolicy5DStimulus::computeDesirability(double vehInMeasure, double vehOutMeasure, double vehInDispersionMeasure, double vehOutDispersionMeasure) { DBG( std::ostringstream str; str << "cox=" << getStimCox() << ", cox_exp_in=" << getStimCoxExpIn() << ", cox_exp_out=" << getStimCoxExpOut() @@ -58,27 +58,27 @@ assert(-1); return -1; } else { - SUMOReal stimulus = getStimCox() - * exp( - -getStimCoxExpIn() - * pow(vehInMeasure - getStimOffsetIn(), 2) - / getStimDivisorIn() - - getStimCoxExpOut() - * pow(vehOutMeasure - getStimOffsetOut(), 2) - / getStimDivisorOut() - - getStimCoxExpDispersionIn() - * pow(vehInDispersionMeasure - getStimOffsetDispersionIn(), 2) - / getStimDivisorDispersionIn() - - getStimCoxExpDispersionOut() - * pow(vehOutDispersionMeasure - getStimOffsetDispersionOut(), 2) - / getStimDivisorDispersionOut() + double stimulus = getStimCox() + * exp( + -getStimCoxExpIn() + * pow(vehInMeasure - getStimOffsetIn(), 2) + / getStimDivisorIn() + - getStimCoxExpOut() + * pow(vehOutMeasure - getStimOffsetOut(), 2) + / getStimDivisorOut() + - getStimCoxExpDispersionIn() + * pow(vehInDispersionMeasure - getStimOffsetDispersionIn(), 2) + / getStimDivisorDispersionIn() + - getStimCoxExpDispersionOut() + * pow(vehOutDispersionMeasure - getStimOffsetDispersionOut(), 2) + / getStimDivisorDispersionOut() - ); + ); return stimulus; } } -SUMOReal MSSOTLPolicy5DStimulus::computeDesirability(SUMOReal vehInMeasure, SUMOReal vehOutMeasure) { +double MSSOTLPolicy5DStimulus::computeDesirability(double vehInMeasure, double vehOutMeasure) { return computeDesirability(vehInMeasure, vehOutMeasure, 0, 0); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy5DStimulus.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy5DStimulus.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy5DStimulus.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy5DStimulus.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Riccardo Belletti /// @author Simone Bacchilega /// @date 2014-09-30 -/// @version $Id: MSSOTLPolicy5DStimulus.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: MSSOTLPolicy5DStimulus.h 24108 2017-04-27 18:43:30Z behrisch $ /// // The class the low-level policy stimulus /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2013 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -49,113 +49,113 @@ private: - SUMOReal stimCoxDVal, - stimOffsetInDVal, stimOffsetOutDVal, stimOffsetDispersionInDVal, stimOffsetDispersionOutDVal, - stimDivInDVal, stimDivOutDVal, stimDivDispersionInDVal, stimDivDispersionOutDVal, - stimCoxExpInDVal, stimCoxExpOutDVal, stimCoxExpDispersionInDVal, stimCoxExpDispersionOutDVal; + double stimCoxDVal, + stimOffsetInDVal, stimOffsetOutDVal, stimOffsetDispersionInDVal, stimOffsetDispersionOutDVal, + stimDivInDVal, stimDivOutDVal, stimDivDispersionInDVal, stimDivDispersionOutDVal, + stimCoxExpInDVal, stimCoxExpOutDVal, stimCoxExpDispersionInDVal, stimCoxExpDispersionOutDVal; public: MSSOTLPolicy5DStimulus(std::string keyPrefix, const std::map& parameters); - SUMOReal getStimCox() { + double getStimCox() { std::string key = getKeyPrefix() + "_STIM_COX"; return readParameter(key, stimCoxDVal); } - void setStimCoxDefVal(SUMOReal defVal) { + void setStimCoxDefVal(double defVal) { stimCoxDVal = defVal; } - SUMOReal getStimOffsetIn() { + double getStimOffsetIn() { std::string key = getKeyPrefix() + "_STIM_OFFSET_IN"; return readParameter(key, stimOffsetInDVal); } - void setStimOffsetInDefVal(SUMOReal defVal) { + void setStimOffsetInDefVal(double defVal) { stimOffsetInDVal = defVal; } - SUMOReal getStimOffsetOut() { + double getStimOffsetOut() { std::string key = getKeyPrefix() + "_STIM_OFFSET_OUT"; return readParameter(key, stimOffsetOutDVal); } - void setStimOffsetOutDefVal(SUMOReal defVal) { + void setStimOffsetOutDefVal(double defVal) { stimOffsetOutDVal = defVal; } - SUMOReal getStimOffsetDispersionIn() { + double getStimOffsetDispersionIn() { std::string key = getKeyPrefix() + "_STIM_OFFSET_DISPERSION_IN"; return readParameter(key, stimOffsetDispersionInDVal); } - void setStimOffsetDispersionInDefVal(SUMOReal defVal) { + void setStimOffsetDispersionInDefVal(double defVal) { stimOffsetDispersionInDVal = defVal; } - SUMOReal getStimOffsetDispersionOut() { + double getStimOffsetDispersionOut() { std::string key = getKeyPrefix() + "_STIM_OFFSET_DISPERSION_OUT"; return readParameter(key, stimOffsetDispersionOutDVal); } - void setStimOffsetDispersionOutDefVal(SUMOReal defVal) { + void setStimOffsetDispersionOutDefVal(double defVal) { stimOffsetDispersionOutDVal = defVal; } - SUMOReal getStimDivisorIn() { + double getStimDivisorIn() { std::string key = getKeyPrefix() + "_STIM_DIVISOR_IN"; return readParameter(key, stimDivInDVal); } - void setStimDivisorInDefVal(SUMOReal defVal) { + void setStimDivisorInDefVal(double defVal) { stimDivInDVal = defVal; } - SUMOReal getStimDivisorOut() { + double getStimDivisorOut() { std::string key = getKeyPrefix() + "_STIM_DIVISOR_OUT"; return readParameter(key, stimDivOutDVal); } - void setStimDivisorOutDefVal(SUMOReal defVal) { + void setStimDivisorOutDefVal(double defVal) { stimDivOutDVal = defVal; } - SUMOReal getStimDivisorDispersionIn() { + double getStimDivisorDispersionIn() { std::string key = getKeyPrefix() + "_STIM_DIVISOR_DISPERSION_IN"; return readParameter(key, stimDivDispersionInDVal); } - void setStimDivisorDispersionInDefVal(SUMOReal defVal) { + void setStimDivisorDispersionInDefVal(double defVal) { stimDivDispersionInDVal = defVal; } - SUMOReal getStimDivisorDispersionOut() { + double getStimDivisorDispersionOut() { std::string key = getKeyPrefix() + "_STIM_DIVISOR_DISPERSION_OUT"; return readParameter(key, stimDivDispersionOutDVal); } - void setStimDivisorDispersionOutDefVal(SUMOReal defVal) { + void setStimDivisorDispersionOutDefVal(double defVal) { stimDivDispersionOutDVal = defVal; } - SUMOReal getStimCoxExpIn() { + double getStimCoxExpIn() { std::string key = getKeyPrefix() + "_STIM_COX_EXP_IN"; return readParameter(key, stimCoxExpInDVal); } - void setStimCoxExpInDefVal(SUMOReal defVal) { + void setStimCoxExpInDefVal(double defVal) { stimCoxExpInDVal = defVal; } - SUMOReal getStimCoxExpOut() { + double getStimCoxExpOut() { std::string key = getKeyPrefix() + "_STIM_COX_EXP_OUT"; return readParameter(key, stimCoxExpOutDVal); } - void setStimCoxExpOutDefVal(SUMOReal defVal) { + void setStimCoxExpOutDefVal(double defVal) { stimCoxExpOutDVal = defVal; } - SUMOReal getStimCoxExpDispersionIn() { + double getStimCoxExpDispersionIn() { std::string key = getKeyPrefix() + "_STIM_COX_EXP_DISPERSION_IN"; return readParameter(key, stimCoxExpDispersionInDVal); } - void setStimCoxExpDispersionInDefVal(SUMOReal defVal) { + void setStimCoxExpDispersionInDefVal(double defVal) { stimCoxExpDispersionInDVal = defVal; } - SUMOReal getStimCoxExpDispersionOut() { + double getStimCoxExpDispersionOut() { std::string key = getKeyPrefix() + "_STIM_COX_EXP_DISPERSION_OUT"; return readParameter(key, stimCoxExpDispersionOutDVal); } - void setStimCoxExpDispersionOutDefVal(SUMOReal defVal) { + void setStimCoxExpDispersionOutDefVal(double defVal) { stimCoxExpDispersionOutDVal = defVal; } std::string getMessage(); @@ -163,10 +163,10 @@ * @brief Computes stimulus function * stimulus = cox * exp(-pow(pheroIn - offsetIn, 2)/divisor -pow(pheroOut - offsetOut, 2)/divisor); */ - virtual SUMOReal computeDesirability(SUMOReal vehInMeasure, - SUMOReal vehOutMeasure); + virtual double computeDesirability(double vehInMeasure, + double vehOutMeasure); - virtual SUMOReal computeDesirability(SUMOReal vehInMeasure, SUMOReal vehOutMeasure, SUMOReal vehInDispersionMeasure, SUMOReal vehOutDispersionMeasure); + virtual double computeDesirability(double vehInMeasure, double vehOutMeasure, double vehInDispersionMeasure, double vehOutDispersionMeasure); }; #endif /* MSSOTLPOLICYSTIMULUS_H_ */ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicyBasedTrafficLightLogic.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicyBasedTrafficLightLogic.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicyBasedTrafficLightLogic.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicyBasedTrafficLightLogic.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Alessio Bonfietti /// @author Riccardo Belletti /// @date 2014-03-20 -/// @version $Id: MSSOTLPolicyBasedTrafficLightLogic.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSSOTLPolicyBasedTrafficLightLogic.cpp 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Congestion logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicyBasedTrafficLightLogic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicyBasedTrafficLightLogic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicyBasedTrafficLightLogic.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicyBasedTrafficLightLogic.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Alessio Bonfietti /// @author Riccardo Belletti /// @date 2014-03-20 -/// @version $Id: MSSOTLPolicyBasedTrafficLightLogic.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSSOTLPolicyBasedTrafficLightLogic.h 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Policy-based logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Anna Chiara Bellini /// @author Federico Caselli /// @date Jun 2013 -/// @version $Id: MSSOTLPolicy.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: MSSOTLPolicy.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // The class for low-level policy /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2013 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -27,7 +27,7 @@ void PushButtonLogic::init(std::string prefix, const Parameterised* parameterised) { m_prefix = prefix; - m_pushButtonScaleFactor = TplConvert::_2SUMOReal(parameterised->getParameter("PUSH_BUTTON_SCALE_FACTOR", "1").c_str()); + m_pushButtonScaleFactor = TplConvert::_2double(parameterised->getParameter("PUSH_BUTTON_SCALE_FACTOR", "1").c_str()); WRITE_MESSAGE(m_prefix + "::PushButtonLogic::init use " + parameterised->getParameter("USE_PUSH_BUTTON", "0") + " scale " + parameterised->getParameter("PUSH_BUTTON_SCALE_FACTOR", "1")); } @@ -48,12 +48,12 @@ void SigmoidLogic::init(std::string prefix, const Parameterised* parameterised) { m_prefix = prefix; m_useSigmoid = parameterised->getParameter("PLATOON_USE_SIGMOID", "0") != "0"; - m_k = TplConvert::_2SUMOReal(parameterised->getParameter("PLATOON_SIGMOID_K_VALUE", "1").c_str()); + m_k = TplConvert::_2double(parameterised->getParameter("PLATOON_SIGMOID_K_VALUE", "1").c_str()); // DBG( WRITE_MESSAGE(m_prefix + "::SigmoidLogic::init use " + parameterised->getParameter("PLATOON_USE_SIGMOID", "0") + " k " + parameterised->getParameter("PLATOON_SIGMOID_K_VALUE", "1")); // for (int elapsed = 10; elapsed < 51; ++elapsed) // { -// SUMOReal sigmoidValue = 1.0 / (1.0 + exp(-m_k * (elapsed - 31))); +// double sigmoidValue = 1.0 / (1.0 + exp(-m_k * (elapsed - 31))); // std::ostringstream oss; // oss << "elapsed " << elapsed << " value " << sigmoidValue; // WRITE_MESSAGE(oss.str()) @@ -64,8 +64,8 @@ bool SigmoidLogic::sigmoidLogic(SUMOTime elapsed, const MSPhaseDefinition* stage, int vehicleCount) { //use the sigmoid logic if (m_useSigmoid && vehicleCount == 0) { - SUMOReal sigmoidValue = 1.0 / (1.0 + exp(-m_k * (elapsed / 1000 - stage->duration / 1000))); - SUMOReal rnd = RandHelper::rand(); + double sigmoidValue = 1.0 / (1.0 + exp(-m_k * (elapsed / 1000 - stage->duration / 1000))); + double rnd = RandHelper::rand(); // DBG( std::ostringstream oss; oss << m_prefix << "::sigmoidLogic [k=" << m_k << " elapsed " << elapsed << " stage->duration " << stage->duration << " ] value " @@ -97,13 +97,13 @@ const std::map& parameters) : Parameterised(parameters), myName(name), myDesirabilityAlgorithm( desirabilityAlgorithm) { - theta_sensitivity = TplConvert::_2SUMOReal(getParameter("THETA_INIT", "0.5").c_str()); + theta_sensitivity = TplConvert::_2double(getParameter("THETA_INIT", "0.5").c_str()); } MSSOTLPolicy::~MSSOTLPolicy(void) { } -SUMOReal MSSOTLPolicy::computeDesirability(SUMOReal vehInMeasure, SUMOReal vehOutMeasure, SUMOReal vehInDispersionMeasure, SUMOReal vehOutDispersionMeasure) { +double MSSOTLPolicy::computeDesirability(double vehInMeasure, double vehOutMeasure, double vehInDispersionMeasure, double vehOutDispersionMeasure) { DBG( std::ostringstream str; str << "\nMSSOTLPolicy::computeStimulus\n" << getName(); WRITE_MESSAGE(str.str());) @@ -112,7 +112,7 @@ } -SUMOReal MSSOTLPolicy::computeDesirability(SUMOReal vehInMeasure, SUMOReal vehOutMeasure) { +double MSSOTLPolicy::computeDesirability(double vehInMeasure, double vehOutMeasure) { DBG( std::ostringstream str; str << "\nMSSOTLPolicy::computeStimulus\n" << getName(); WRITE_MESSAGE(str.str());) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicyDesirability.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicyDesirability.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicyDesirability.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicyDesirability.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSSOTLPolicyDesirability.cpp /// @author Riccardo Belletti /// @date 2014-03-20 -/// @version $Id: MSSOTLPolicyDesirability.cpp 20113 2016-03-01 13:22:42Z martintaraz $ +/// @version $Id: MSSOTLPolicyDesirability.cpp 22628 2017-01-18 12:58:45Z behrisch $ /// // The class for Swarm-based low-level policy /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2013 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicyDesirability.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicyDesirability.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicyDesirability.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicyDesirability.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSSOTLPolicyDesirability.h /// @author Riccardo Belletti /// @date 2014-03-20 -/// @version $Id: MSSOTLPolicyDesirability.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: MSSOTLPolicyDesirability.h 24108 2017-04-27 18:43:30Z behrisch $ /// // The class a low-level policy desirability /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2013 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,8 +46,8 @@ std::string myKeyPrefix; protected: - SUMOReal readParameter(std::string parName, SUMOReal defValue) { - return TplConvert::_2SUMORealSec(getParameter(parName, "").c_str(), defValue); + double readParameter(std::string parName, double defValue) { + return TplConvert::_2doubleSec(getParameter(parName, "").c_str(), defValue); } public: @@ -59,14 +59,14 @@ /** * \brief Calculates the desirability of the policy */ - virtual SUMOReal computeDesirability(SUMOReal vehInMeasure, - SUMOReal vehOutMeasure) = 0; + virtual double computeDesirability(double vehInMeasure, + double vehOutMeasure) = 0; /** * \brief Calculates the desirability of the policy */ - virtual SUMOReal computeDesirability(SUMOReal vehInMeasure, SUMOReal vehOutMeasure, - SUMOReal vehInDispersionMeasure, - SUMOReal vehOutDispersionMeasure) = 0; + virtual double computeDesirability(double vehInMeasure, double vehOutMeasure, + double vehInDispersionMeasure, + double vehOutDispersionMeasure) = 0; virtual std::string getMessage() = 0; void setKeyPrefix(std::string val) { myKeyPrefix = val; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLPolicy.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Anna Chiara Bellini /// @author Federico Caselli /// @date Jun 2013 -/// @version $Id: MSSOTLPolicy.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: MSSOTLPolicy.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The class for low-level policy /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2013 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -49,7 +49,7 @@ bool pushButtonLogic(SUMOTime elapsed, bool pushButtonPressed, const MSPhaseDefinition* stage); - SUMOReal m_pushButtonScaleFactor; + double m_pushButtonScaleFactor; std::string m_prefix; }; @@ -60,7 +60,7 @@ bool sigmoidLogic(SUMOTime elapsed, const MSPhaseDefinition* stage, int vehicleCount); bool m_useSigmoid; - SUMOReal m_k; + double m_k; std::string m_prefix; }; @@ -75,7 +75,7 @@ /** * \brief The sensitivity of this policy */ - SUMOReal theta_sensitivity; + double theta_sensitivity; /** * \brief The name of the policy */ @@ -116,10 +116,10 @@ int currentPhaseIndex, int phaseMaxCTS, bool thresholdPassed, bool pushButtonPressed, int vehicleCount); - virtual SUMOReal getThetaSensitivity() { + virtual double getThetaSensitivity() { return theta_sensitivity; } - virtual void setThetaSensitivity(SUMOReal val) { + virtual void setThetaSensitivity(double val) { theta_sensitivity = val; } std::string getName() { @@ -131,9 +131,9 @@ /** * @brief Computes the desirability of this policy, necessary when used in combination with an high level policy. */ - SUMOReal computeDesirability(SUMOReal vehInMeasure, SUMOReal vehOutMeasure, SUMOReal vehInDispersionMeasure, SUMOReal vehOutDispersionMeasure); + double computeDesirability(double vehInMeasure, double vehOutMeasure, double vehInDispersionMeasure, double vehOutDispersionMeasure); - SUMOReal computeDesirability(SUMOReal vehInMeasure, SUMOReal vehOutMeasure); + double computeDesirability(double vehInMeasure, double vehOutMeasure); }; #endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLRequestPolicy.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLRequestPolicy.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLRequestPolicy.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLRequestPolicy.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Gianfilippo Slager /// @author Anna Chiara Bellini /// @date Apr 2013 -/// @version $Id: MSSOTLRequestPolicy.cpp 20113 2016-03-01 13:22:42Z martintaraz $ +/// @version $Id: MSSOTLRequestPolicy.cpp 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Request logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLRequestPolicy.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLRequestPolicy.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLRequestPolicy.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLRequestPolicy.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Gianfilippo Slager /// @author Anna Chiara Bellini /// @date Apr 2013 -/// @version $Id: MSSOTLRequestPolicy.h 20113 2016-03-01 13:22:42Z martintaraz $ +/// @version $Id: MSSOTLRequestPolicy.h 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Request logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLRequestTrafficLightLogic.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLRequestTrafficLightLogic.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLRequestTrafficLightLogic.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLRequestTrafficLightLogic.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Gianfilippo Slager /// @author Anna Chiara Bellini /// @date 2013-02-25 -/// @version $Id: MSSOTLRequestTrafficLightLogic.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSSOTLRequestTrafficLightLogic.cpp 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Request logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLRequestTrafficLightLogic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLRequestTrafficLightLogic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLRequestTrafficLightLogic.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLRequestTrafficLightLogic.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Gianfilippo Slager /// @author Anna Chiara Bellini /// @date 2013-02-25 -/// @version $Id: MSSOTLRequestTrafficLightLogic.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSSOTLRequestTrafficLightLogic.h 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Request logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLSensors.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLSensors.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLSensors.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLSensors.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MSSOTLSensors.cpp /// @author Gianfilippo Slager /// @date Feb 2010 -/// @version $Id: MSSOTLSensors.cpp 20113 2016-03-01 13:22:42Z martintaraz $ +/// @version $Id: MSSOTLSensors.cpp 22627 2017-01-18 12:56:36Z behrisch $ /// // The base abstract class for SOTL sensors /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLSensors.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLSensors.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLSensors.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLSensors.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Gianfilippo Slager /// @author Anna Chiara Bellini /// @date Feb 2010 -/// @version $Id: MSSOTLSensors.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSSOTLSensors.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The base abstract class for SOTL sensors /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -107,7 +107,7 @@ * Vehicles speed is effectively sensed or guessed in the space from the sensor. * @param[in] lane The lane to count vehicles */ - virtual SUMOReal meanVehiclesSpeed(MSLane* lane) = 0; + virtual double meanVehiclesSpeed(MSLane* lane) = 0; /* * Returns the average speed of vehicles currently approaching the @@ -115,13 +115,13 @@ * Vehicles speed is effectively sensed or guessed in the space from the sensor. * @param[in] laneId The lane to count vehicles by ID */ - virtual SUMOReal meanVehiclesSpeed(std::string laneId) = 0; + virtual double meanVehiclesSpeed(std::string laneId) = 0; /* * @param[in] laneId The lane given by Id * @return The maximum speed allowed for the given laneId */ - virtual SUMOReal getMaxSpeed(std::string laneId) = 0; + virtual double getMaxSpeed(std::string laneId) = 0; /* * @brief Indicate which lane has given green diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLTrafficLightLogic.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLTrafficLightLogic.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLTrafficLightLogic.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLTrafficLightLogic.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Anna Chiara Bellini /// @author Federico Caselli /// @date Apr 2013 -/// @version $Id: MSSOTLTrafficLightLogic.cpp 21217 2016-07-22 10:57:44Z behrisch $ +/// @version $Id: MSSOTLTrafficLightLogic.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The base abstract class for SOTL logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2013 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -25,10 +25,6 @@ #include "../MSEdge.h" #include "MSPushButton.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - #if 1 #define ANALYSIS_DBG(X) {X} #else @@ -321,8 +317,8 @@ /* * if a dynamic threshold based on the exponential decrease, if passed we force the phase change */ -// SUMOReal random = ((SUMOReal) RandHelper::rand(RAND_MAX) / (RAND_MAX)); - SUMOReal random = RandHelper::rand(); +// double random = ((double) RandHelper::rand(RAND_MAX) / (RAND_MAX)); + double random = RandHelper::rand(); // ANALYSIS_DBG( DBG( if (isDecayThresholdActivated()) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLTrafficLightLogic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLTrafficLightLogic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLTrafficLightLogic.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLTrafficLightLogic.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Anna Chiara Bellini /// @author Federico Caselli /// @date Apr 2013 -/// @version $Id: MSSOTLTrafficLightLogic.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSSOTLTrafficLightLogic.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The base abstract class for SOTL logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2013 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -158,16 +158,16 @@ return TplConvert::_2int(getParameter("THRESHOLD", "10").c_str()); } - SUMOReal getSpeedThreshold() { - return TplConvert::_2SUMOReal(getParameter("THRESHOLDSPEED", "2").c_str()); + double getSpeedThreshold() { + return TplConvert::_2double(getParameter("THRESHOLDSPEED", "2").c_str()); } - SUMOReal getInputSensorsLength() { - return TplConvert::_2SUMOReal(getParameter("INSENSORSLENGTH", "100").c_str()); + double getInputSensorsLength() { + return TplConvert::_2double(getParameter("INSENSORSLENGTH", "100").c_str()); } - SUMOReal getOutputSensorsLength() { - return TplConvert::_2SUMOReal(getParameter("OUTSENSORSLENGTH", "80").c_str()); + double getOutputSensorsLength() { + return TplConvert::_2double(getParameter("OUTSENSORSLENGTH", "80").c_str()); } /* @@ -240,7 +240,7 @@ */ int lastChain; - SUMOReal decayThreshold; + double decayThreshold; /* * @brief Check for phases compliancy */ @@ -289,8 +289,8 @@ return TplConvert::_2bool(getParameter("DECAY_THRESHOLD", "0").c_str()); } - SUMOReal getDecayConstant() { - return TplConvert::_2SUMOReal(getParameter("DECAY_CONSTANT", "-0.001").c_str()); + double getDecayConstant() { + return TplConvert::_2double(getParameter("DECAY_CONSTANT", "-0.001").c_str()); } }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLWaveTrafficLightLogic.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLWaveTrafficLightLogic.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLWaveTrafficLightLogic.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLWaveTrafficLightLogic.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Riccardo Belletti /// @author Anna Chiara Bellini /// @date Sep 2013 -/// @version $Id: MSSOTLWaveTrafficLightLogic.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSSOTLWaveTrafficLightLogic.cpp 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Platoon logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLWaveTrafficLightLogic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLWaveTrafficLightLogic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLWaveTrafficLightLogic.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSOTLWaveTrafficLightLogic.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Riccardo Belletti /// @author Anna Chiara Bellini /// @date 2013-10-26 -/// @version $Id: MSSOTLWaveTrafficLightLogic.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSSOTLWaveTrafficLightLogic.h 22627 2017-01-18 12:56:36Z behrisch $ /// // The class for SOTL Platoon logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSwarmTrafficLightLogic.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSwarmTrafficLightLogic.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSwarmTrafficLightLogic.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSwarmTrafficLightLogic.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Gianfilippo Slager /// @author Federico Caselli /// @date Mar 2010 -/// @version $Id: MSSwarmTrafficLightLogic.cpp 21217 2016-07-22 10:57:44Z behrisch $ +/// @version $Id: MSSwarmTrafficLightLogic.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // The class for Swarm-based logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -79,12 +79,12 @@ if (logData && swarmLogFile.is_open()) { swarmLogFile.close(); } - for (std::map*>::iterator it = m_meanSpeedHistory.begin(); + for (std::map*>::iterator it = m_meanSpeedHistory.begin(); it != m_meanSpeedHistory.end(); ++it) { delete it->second; } m_meanSpeedHistory.clear(); - for (std::map*>::iterator it = m_derivativeHistory.begin(); + for (std::map*>::iterator it = m_derivativeHistory.begin(); it != m_derivativeHistory.end(); ++it) { delete it->second; } @@ -128,7 +128,7 @@ // Derivative const int derivativeHistorySize = TplConvert::_2int(getParameter("PHERO_DERIVATIVE_HISTORY_SIZE", "3").c_str()); const int meanSpeedHistorySize = TplConvert::_2int(getParameter("PHERO_MEAN_SPEED_HISTORY_SIZE", "3").c_str()); - m_derivativeAlpha = TplConvert::_2SUMOReal(getParameter("PHERO_DERIVATIVE_ALPHA", "1").c_str()); + m_derivativeAlpha = TplConvert::_2double(getParameter("PHERO_DERIVATIVE_ALPHA", "1").c_str()); m_losCounter = 0; m_losMaxLimit = TplConvert::_2int(getParameter("LOSS_OF_SIGNAL_LIMIT", "10").c_str()); @@ -143,8 +143,8 @@ if (allowLine(currentLane)) { pheromoneInputLanes.insert(MSLaneId_Pheromone(currentLane->getID(), 0.0)); // Consider the derivative only for the input lane - m_meanSpeedHistory.insert(std::make_pair(currentLane->getID(), new CircularBuffer(meanSpeedHistorySize))); - m_derivativeHistory.insert(std::make_pair(currentLane->getID(), new CircularBuffer(derivativeHistorySize))); + m_meanSpeedHistory.insert(std::make_pair(currentLane->getID(), new CircularBuffer(meanSpeedHistorySize))); + m_derivativeHistory.insert(std::make_pair(currentLane->getID(), new CircularBuffer(derivativeHistorySize))); ANALYSIS_DBG( WRITE_MESSAGE("MSSwarmTrafficLightLogic::init Intersection " + getID() + " pheromoneInputLanes adding " + currentLane->getID());) } else { @@ -259,7 +259,7 @@ gotTargetLane = false; } -// SUMOReal phero =0; +// double phero =0; // if(getCurrentPhaseDef().isDecisional()) // { // for(LaneIdVector::const_iterator it = targetLanes.begin(); it != targetLanes.end(); ++it) @@ -298,7 +298,7 @@ } void MSSwarmTrafficLightLogic::updatePheromoneLevels(MSLaneId_PheromoneMap& pheroMap, std::string logString, - const SUMOReal beta, const SUMOReal gamma) { + const double beta, const double gamma) { // ANALYSIS_DBG( DBG( std::ostringstream _str; _str << logString << " Lanes " << pheroMap.size() << " TL " << getID() << " ."; WRITE_MESSAGE(time2string(MSNet::getInstance()->getCurrentTimeStep()) + " MSSwarmTrafficLightLogic::updatePheromoneLevels:: " + _str.str());) @@ -306,19 +306,19 @@ for (MSLaneId_PheromoneMap::iterator laneIterator = pheroMap.begin(); laneIterator != pheroMap.end(); ++laneIterator) { std::string laneId = laneIterator->first; - SUMOReal oldPhero = laneIterator->second; - SUMOReal maxSpeed = getSensors()->getMaxSpeed(laneId); - SUMOReal meanVehiclesSpeed = getSensors()->meanVehiclesSpeed(laneId); + double oldPhero = laneIterator->second; + double maxSpeed = getSensors()->getMaxSpeed(laneId); + double meanVehiclesSpeed = getSensors()->meanVehiclesSpeed(laneId); bool updatePheromone = (meanVehiclesSpeed > -1); - // SUMOReal pheroAdd = getSensors()->countVehicles(laneId); + // double pheroAdd = getSensors()->countVehicles(laneId); //derivative - SUMOReal derivative = 0; + double derivative = 0; //If i need to use the derivative for the lane if (m_meanSpeedHistory.find(laneId) != m_meanSpeedHistory.end()) { //Update the derivative if (updatePheromone) { - SUMOReal currentDerivative = 0; + double currentDerivative = 0; m_losCounter = 0; if (m_meanSpeedHistory[laneId]->size() > 0) { //Calculate the current derivative mean with the old speed points @@ -352,7 +352,7 @@ } } } - SUMOReal pheroAdd = MAX2((maxSpeed - meanVehiclesSpeed) * 10 / maxSpeed, (SUMOReal)0.0); + double pheroAdd = MAX2((maxSpeed - meanVehiclesSpeed) * 10 / maxSpeed, 0.0); // Use the derivative only if it has a value if (derivative > 0) // Correct the pheromone value by dividing it for the derivative. @@ -370,7 +370,7 @@ ) // Evaporation + current contribute - SUMOReal phero = beta * oldPhero + gamma * pheroAdd * updatePheromone; + double phero = beta * oldPhero + gamma * pheroAdd * updatePheromone; ANALYSIS_DBG( if (phero > 10) { std::ostringstream i_str; @@ -378,7 +378,7 @@ WRITE_MESSAGE(i_str.str()) }); - phero = MIN2(MAX2(phero, (SUMOReal)0.0), getPheroMaxVal()); + phero = MIN2(MAX2(phero, 0.0), getPheroMaxVal()); pheroMap[laneId] = phero; ANALYSIS_DBG( // DBG( @@ -401,7 +401,7 @@ std::ostringstream str; str << time2string(MSNet::getInstance()->getCurrentTimeStep()) << " MSSwarmTrafficLightLogic::countSensors:: lane " << laneId << " passedVeh " << getCountSensors()->getPassedVeh(laneId, false); WRITE_MESSAGE(str.str());) // int vehicles = getSensors()->countVehicles(laneId); -// SUMOReal pheroIn = getBetaNo() * oldPheroIn + // Evaporation +// double pheroIn = getBetaNo() * oldPheroIn + // Evaporation // getGammaNo() * vehicles; // DBG( // std::ostringstream i_str; @@ -409,12 +409,12 @@ // MsgHandler::getMessageInstance()->inform(time2string(MSNet::getInstance()->getCurrentTimeStep()) +" MSSwarmTrafficLightLogic::updatePheromoneLevels:: PheroIn"+i_str.str()); // ) // -// pheroIn = MIN2(MAX2(pheroIn, (SUMOReal)0.0), getPheroMaxVal()); +// pheroIn = MIN2(MAX2(pheroIn, 0.0), getPheroMaxVal()); // pheromoneInputLanes[laneId] = pheroIn; } } void MSSwarmTrafficLightLogic::updateSensitivities() { - SUMOReal elapsedTime = STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep() - lastThetaSensitivityUpdate); + double elapsedTime = STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep() - lastThetaSensitivityUpdate); lastThetaSensitivityUpdate = MSNet::getInstance()->getCurrentTimeStep(); MSSOTLPolicy* currentPolicy = getCurrentPolicy(); @@ -431,7 +431,7 @@ return; } - SUMOReal eta = -1.; + double eta = -1.; // If skipEta it means that we've had Congestion for too much time. Forcing forgetting. if (!skipEta || currentPolicy->getName().compare("Congestion") != 0) { switch (getReinforcementMode()) { @@ -451,7 +451,7 @@ } for (int i = 0; i < (int)policies.size(); i++) { MSSOTLPolicy* policy = policies[i]; - SUMOReal newSensitivity; + double newSensitivity; if (eta < 0) { //bad performance if (policy == currentPolicy) { // punish the current policy newSensitivity = policy->getThetaSensitivity() + getForgettingCox() * (-eta); @@ -498,11 +498,11 @@ } } -SUMOReal MSSwarmTrafficLightLogic::getPheromoneForInputLanes() { +double MSSwarmTrafficLightLogic::getPheromoneForInputLanes() { if (pheromoneInputLanes.size() == 0) { return 0; } - SUMOReal pheroIn = 0; + double pheroIn = 0; for (MSLaneId_PheromoneMap::const_iterator iterator = pheromoneInputLanes.begin(); iterator != pheromoneInputLanes.end(); iterator++) { std::string laneId = iterator->first; @@ -516,11 +516,11 @@ return pheroIn / pheromoneInputLanes.size(); } -SUMOReal MSSwarmTrafficLightLogic::getPheromoneForOutputLanes() { +double MSSwarmTrafficLightLogic::getPheromoneForOutputLanes() { if (pheromoneOutputLanes.size() == 0) { return 0; } - SUMOReal pheroOut = 0; + double pheroOut = 0; for (MSLaneId_PheromoneMap::const_iterator iterator = pheromoneOutputLanes.begin(); iterator != pheromoneOutputLanes.end(); iterator++) { DBG( @@ -532,51 +532,51 @@ return pheroOut / pheromoneOutputLanes.size(); } -SUMOReal MSSwarmTrafficLightLogic::getDispersionForInputLanes(SUMOReal average_phero_in) { +double MSSwarmTrafficLightLogic::getDispersionForInputLanes(double average_phero_in) { if (pheromoneInputLanes.size() == 0) { return 0; } - SUMOReal sum = 0; + double sum = 0; for (MSLaneId_PheromoneMap::const_iterator iterator = pheromoneInputLanes.begin(); iterator != pheromoneInputLanes.end(); iterator++) { std::string laneId = iterator->first; sum += pow(iterator->second - average_phero_in, 2); } - SUMOReal result = sqrt(sum / pheromoneInputLanes.size()) * getScaleFactorDispersionIn(); + double result = sqrt(sum / pheromoneInputLanes.size()) * getScaleFactorDispersionIn(); DBG( ostringstream so_str; so_str << " dispersionIn " << result; WRITE_MESSAGE("MSSwarmTrafficLightLogic::getDispersionForInputLanes::" + so_str.str());) return result; } -SUMOReal MSSwarmTrafficLightLogic::getDispersionForOutputLanes(SUMOReal average_phero_out) { +double MSSwarmTrafficLightLogic::getDispersionForOutputLanes(double average_phero_out) { if (pheromoneOutputLanes.size() == 0) { return 0; } - SUMOReal sum = 0; + double sum = 0; for (MSLaneId_PheromoneMap::const_iterator iterator = pheromoneOutputLanes.begin(); iterator != pheromoneOutputLanes.end(); iterator++) { sum += pow(iterator->second - average_phero_out, 2); } - SUMOReal result = sqrt(sum / pheromoneOutputLanes.size()) * getScaleFactorDispersionOut(); + double result = sqrt(sum / pheromoneOutputLanes.size()) * getScaleFactorDispersionOut(); DBG( ostringstream so_str; so_str << " dispersionOut " << result; WRITE_MESSAGE("MSSwarmTrafficLightLogic::getDispersionForOutputLanes::" + so_str.str());) return result; } -SUMOReal MSSwarmTrafficLightLogic::getDistanceOfMaxPheroForInputLanes() { +double MSSwarmTrafficLightLogic::getDistanceOfMaxPheroForInputLanes() { if (pheromoneInputLanes.size() == 0) { return 0; } - SUMOReal max_phero_val_current = 0; - SUMOReal max_phero_val_old = 0; - SUMOReal temp_avg_other_lanes = 0; + double max_phero_val_current = 0; + double max_phero_val_old = 0; + double temp_avg_other_lanes = 0; std::string laneId_max; int counter = 0; for (MSLaneId_PheromoneMap::const_iterator iterator = pheromoneInputLanes.begin(); iterator != pheromoneInputLanes.end(); iterator++) { std::string laneId = iterator->first; - SUMOReal lanePhero = iterator->second; + double lanePhero = iterator->second; if (counter == 0) { max_phero_val_current = lanePhero; counter++; @@ -593,25 +593,25 @@ counter++; } - SUMOReal result = max_phero_val_current - temp_avg_other_lanes; + double result = max_phero_val_current - temp_avg_other_lanes; DBG( ostringstream so_str; so_str << " currentMaxPhero " << max_phero_val_current << " lane " << laneId_max << " avgOtherLanes " << temp_avg_other_lanes << " distance " << result; WRITE_MESSAGE("MSSwarmTrafficLightLogic::getDistanceOfMaxPheroForInputLanes::" + so_str.str());) return result; } -SUMOReal MSSwarmTrafficLightLogic::getDistanceOfMaxPheroForOutputLanes() { +double MSSwarmTrafficLightLogic::getDistanceOfMaxPheroForOutputLanes() { if (pheromoneOutputLanes.size() == 0) { return 0; } - SUMOReal max_phero_val_current = 0; - SUMOReal max_phero_val_old = 0; - SUMOReal temp_avg_other_lanes = 0; + double max_phero_val_current = 0; + double max_phero_val_old = 0; + double temp_avg_other_lanes = 0; std::string laneId_max; int counter = 0; for (MSLaneId_PheromoneMap::const_iterator iterator = pheromoneOutputLanes.begin(); iterator != pheromoneOutputLanes.end(); iterator++) { std::string laneId = iterator->first; - SUMOReal lanePhero = iterator->second; + double lanePhero = iterator->second; if (counter == 0) { max_phero_val_current = lanePhero; counter++; @@ -628,7 +628,7 @@ counter++; } - SUMOReal result = max_phero_val_current - temp_avg_other_lanes; + double result = max_phero_val_current - temp_avg_other_lanes; DBG( ostringstream so_str; so_str << " currentMaxPhero " << max_phero_val_current << " lane " << laneId_max << " avgOtherLanes " << temp_avg_other_lanes << " distance " << result; WRITE_MESSAGE("MSSwarmTrafficLightLogic::getDistanceOfMaxPheroForOutputLanes::" + so_str.str());) return result; @@ -636,19 +636,19 @@ void MSSwarmTrafficLightLogic::decidePolicy() { // MSSOTLPolicy* currentPolicy = getCurrentPolicy(); // Decide if it is the case to check for another plan -// SUMOReal sampled = (SUMOReal) RandHelper::rand(RAND_MAX); - SUMOReal sampled = RandHelper::rand(); - SUMOReal changeProb = getChangePlanProbability(); +// double sampled = (double) RandHelper::rand(RAND_MAX); + double sampled = RandHelper::rand(); + double changeProb = getChangePlanProbability(); // changeProb = changeProb * RAND_MAX; if (sampled <= changeProb || mustChange) { // Check for another plan - SUMOReal pheroIn = getPheromoneForInputLanes(); - SUMOReal pheroOut = getPheromoneForOutputLanes(); - //SUMOReal dispersionIn = getDispersionForInputLanes(pheroIn); - //SUMOReal dispersionOut = getDispersionForOutputLanes(pheroOut); - SUMOReal distancePheroIn = getDistanceOfMaxPheroForInputLanes(); - SUMOReal distancePheroOut = getDistanceOfMaxPheroForOutputLanes(); + double pheroIn = getPheromoneForInputLanes(); + double pheroOut = getPheromoneForOutputLanes(); + //double dispersionIn = getDispersionForInputLanes(pheroIn); + //double dispersionOut = getDispersionForOutputLanes(pheroOut); + double distancePheroIn = getDistanceOfMaxPheroForInputLanes(); + double distancePheroOut = getDistanceOfMaxPheroForOutputLanes(); MSSOTLPolicy* oldPolicy = getCurrentPolicy(); choosePolicy(pheroIn, pheroOut, distancePheroIn, distancePheroOut); MSSOTLPolicy* newPolicy = getCurrentPolicy(); @@ -669,23 +669,23 @@ } } -SUMOReal MSSwarmTrafficLightLogic::calculatePhi(int factor) { +double MSSwarmTrafficLightLogic::calculatePhi(int factor) { if (factor == 0) { return 1; } if (factor == 1) { return 0.2; } else { - return 1 - (1 / ((SUMOReal) factor)); + return 1 - (1 / ((double) factor)); } } -SUMOReal MSSwarmTrafficLightLogic::calculateEtaDiff() { +double MSSwarmTrafficLightLogic::calculateEtaDiff() { MSLane* currentLane = NULL; int count = 0, minIn = 0, minOut = 0, toSub, tmp; bool inInit = true, outInit = true; - SUMOReal eta, normalized, diff, phi, delta; + double eta, normalized, diff, phi, delta; LaneIdVector toReset; carsIn = 0; @@ -870,11 +870,11 @@ return eta; } -SUMOReal MSSwarmTrafficLightLogic::calculateEtaRatio() { +double MSSwarmTrafficLightLogic::calculateEtaRatio() { MSLane* currentLane = NULL; int count = 0, minIn = 0, minOut = 0, toSub, tmp; bool inInit = true, outInit = true; - SUMOReal eta, ratio, phi, normalized, delta; + double eta, ratio, phi, normalized, delta; LaneIdVector toReset; carsIn = 0; @@ -983,11 +983,11 @@ //Normalized to 1 if (carsOut != 0) { - ratio = ((SUMOReal) inTarget) / carsOut; + ratio = ((double) inTarget) / carsOut; normalized = ratio / (inTarget + carsOut); } else { - ratio = std::numeric_limits::infinity(); - normalized = std::numeric_limits::infinity(); + ratio = std::numeric_limits::infinity(); + normalized = std::numeric_limits::infinity(); } DBG( @@ -1088,8 +1088,8 @@ } } -void MSSwarmTrafficLightLogic::choosePolicy(SUMOReal phero_in, SUMOReal phero_out, SUMOReal dispersion_in, - SUMOReal dispersion_out) { +void MSSwarmTrafficLightLogic::choosePolicy(double phero_in, double phero_out, double dispersion_in, + double dispersion_out) { if (m_useVehicleTypesWeights) { for (std::vector::iterator it = getPolicies().begin(); it != getPolicies().end(); ++it) { if (it.operator * ()->getName() == "Phase") { @@ -1098,12 +1098,12 @@ } } } - std::vector thetaStimuli; - SUMOReal thetaSum = 0.0; + std::vector thetaStimuli; + double thetaSum = 0.0; // Compute stimulus for each policy for (int i = 0; i < (int)getPolicies().size(); i++) { - SUMOReal stimulus = getPolicies()[i]->computeDesirability(phero_in, phero_out, dispersion_in, dispersion_out); - SUMOReal thetaStimulus = pow(stimulus, 2) / (pow(stimulus, 2) + pow(getPolicies()[i]->getThetaSensitivity(), 2)); + double stimulus = getPolicies()[i]->computeDesirability(phero_in, phero_out, dispersion_in, dispersion_out); + double thetaStimulus = pow(stimulus, 2) / (pow(stimulus, 2) + pow(getPolicies()[i]->getThetaSensitivity(), 2)); thetaStimuli.push_back(thetaStimulus); thetaSum += thetaStimulus; @@ -1115,11 +1115,11 @@ } // Compute a random value between 0 and the sum of the thetaSum -// SUMOReal r = RandHelper::rand(RAND_MAX); +// double r = RandHelper::rand(RAND_MAX); // r = r / RAND_MAX * thetaSum; - SUMOReal r = RandHelper::rand((SUMOReal)thetaSum); + double r = RandHelper::rand((double)thetaSum); - SUMOReal partialSum = 0; + double partialSum = 0; for (int i = 0; i < (int)getPolicies().size(); i++) { partialSum += thetaStimuli[i]; @@ -1134,7 +1134,7 @@ } } -void MSSwarmTrafficLightLogic::choosePolicy(SUMOReal phero_in, SUMOReal phero_out) { +void MSSwarmTrafficLightLogic::choosePolicy(double phero_in, double phero_out) { choosePolicy(phero_in, phero_out, 0, 0); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSwarmTrafficLightLogic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSwarmTrafficLightLogic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSSwarmTrafficLightLogic.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSSwarmTrafficLightLogic.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Gianfilippo Slager /// @author Federico Caselli /// @date Mar 2010 -/// @version $Id: MSSwarmTrafficLightLogic.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSSwarmTrafficLightLogic.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The class for Swarm-based logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright 2001-2009 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -137,55 +137,55 @@ return TplConvert::_2int(getParameter("MAX_CONGESTION_DUR", "120").c_str()); } - SUMOReal getPheroMaxVal() { - return TplConvert::_2SUMOReal(getParameter("PHERO_MAXVAL", "10").c_str()); + double getPheroMaxVal() { + return TplConvert::_2double(getParameter("PHERO_MAXVAL", "10").c_str()); } - SUMOReal getBetaNo() { - return TplConvert::_2SUMOReal(getParameter("BETA_NO", "0.99").c_str()); + double getBetaNo() { + return TplConvert::_2double(getParameter("BETA_NO", "0.99").c_str()); } - SUMOReal getGammaNo() { - return TplConvert::_2SUMOReal(getParameter("GAMMA_NO", "1.0").c_str()); + double getGammaNo() { + return TplConvert::_2double(getParameter("GAMMA_NO", "1.0").c_str()); } - SUMOReal getBetaSp() { - return TplConvert::_2SUMOReal(getParameter("BETA_SP", "0.99").c_str()); + double getBetaSp() { + return TplConvert::_2double(getParameter("BETA_SP", "0.99").c_str()); } - SUMOReal getGammaSp() { - return TplConvert::_2SUMOReal(getParameter("GAMMA_SP", "1.0").c_str()); + double getGammaSp() { + return TplConvert::_2double(getParameter("GAMMA_SP", "1.0").c_str()); } - SUMOReal getChangePlanProbability() { - return TplConvert::_2SUMOReal(getParameter("CHANGE_PLAN_PROBABILITY", "0.003").c_str()); + double getChangePlanProbability() { + return TplConvert::_2double(getParameter("CHANGE_PLAN_PROBABILITY", "0.003").c_str()); } - SUMOReal getThetaMax() { - return TplConvert::_2SUMOReal(getParameter("THETA_MAX", "0.8").c_str()); + double getThetaMax() { + return TplConvert::_2double(getParameter("THETA_MAX", "0.8").c_str()); } - SUMOReal getThetaMin() { - return TplConvert::_2SUMOReal(getParameter("THETA_MIN", "0.2").c_str()); + double getThetaMin() { + return TplConvert::_2double(getParameter("THETA_MIN", "0.2").c_str()); } - SUMOReal getThetaInit() { - return TplConvert::_2SUMOReal(getParameter("THETA_INIT", "0.5").c_str()); + double getThetaInit() { + return TplConvert::_2double(getParameter("THETA_INIT", "0.5").c_str()); } - SUMOReal getLearningCox() { - return TplConvert::_2SUMOReal(getParameter("LEARNING_COX", "0.0005").c_str()); + double getLearningCox() { + return TplConvert::_2double(getParameter("LEARNING_COX", "0.0005").c_str()); } - SUMOReal getForgettingCox() { - return TplConvert::_2SUMOReal(getParameter("FORGETTING_COX", "0.0005").c_str()); + double getForgettingCox() { + return TplConvert::_2double(getParameter("FORGETTING_COX", "0.0005").c_str()); } - SUMOReal getScaleFactorDispersionIn() { + double getScaleFactorDispersionIn() { return scaleFactorDispersionIn; } - SUMOReal getScaleFactorDispersionOut() { + double getScaleFactorDispersionOut() { return scaleFactorDispersionOut; } @@ -246,32 +246,32 @@ /* * @return The average pheromone level regarding congestion on input lanes */ - SUMOReal getPheromoneForInputLanes(); + double getPheromoneForInputLanes(); /* * @return The average pheromone level regarding congestion on output lanes */ - SUMOReal getPheromoneForOutputLanes(); + double getPheromoneForOutputLanes(); /* * @return The dispersion level regarding congestion on input lanes */ - SUMOReal getDispersionForInputLanes(SUMOReal average_phero_in); + double getDispersionForInputLanes(double average_phero_in); /* * @return The dispersion level regarding congestion on output lanes */ - SUMOReal getDispersionForOutputLanes(SUMOReal average_phero_out); + double getDispersionForOutputLanes(double average_phero_out); /* * @return The difference between the current max phero value and the average phero of the other lanes */ - SUMOReal getDistanceOfMaxPheroForInputLanes(); + double getDistanceOfMaxPheroForInputLanes(); /* * @return The difference between the current max phero value and the average phero of the other lanes */ - SUMOReal getDistanceOfMaxPheroForOutputLanes(); + double getDistanceOfMaxPheroForOutputLanes(); /** * @brief Update pheromone levels * Pheromone on input lanes is costantly updated @@ -282,7 +282,7 @@ /** * @brief Utility method to avoid code duplication */ - void updatePheromoneLevels(MSLaneId_PheromoneMap&, std::string, const SUMOReal, const SUMOReal); + void updatePheromoneLevels(MSLaneId_PheromoneMap&, std::string, const double, const double); /** * After a policy has been chosen, for every iteration thresholds has to be updated. @@ -303,7 +303,7 @@ * or the number of cars in the lanes with a red tl. * @param[in] factor - the value to consider to compute this coefficient. */ - SUMOReal calculatePhi(int factor); + double calculatePhi(int factor); /** * \brief Method that should calculate the valor of eta a coefficient to evaluate the current @@ -311,17 +311,17 @@ * and the ones that exit it. It consider vehicles on a lane with a tl set to red as well to determinate * policy work. */ - SUMOReal calculateEtaDiff(); + double calculateEtaDiff(); - SUMOReal calculateEtaRatio(); + double calculateEtaRatio(); /* * \brief Method to reset the map that stores if a lane is already been checked during the * evaluation of eta. */ void resetLaneCheck(); - void choosePolicy(SUMOReal phero_in, SUMOReal phero_out, SUMOReal dispersion_in, SUMOReal dispersion_out); - void choosePolicy(SUMOReal phero_in, SUMOReal phero_out); + void choosePolicy(double phero_in, double phero_out, double dispersion_in, double dispersion_out); + void choosePolicy(double phero_in, double phero_out); std::string getPoliciesParam() { return getParameter("POLICIES", "Platoon;Phase;Marching;Congestion"); @@ -338,7 +338,7 @@ } void initScaleFactorDispersionIn(int lanes_in) { - std::vector phero_values; + std::vector phero_values; for (int i = 0; i < lanes_in / 2; i++) { phero_values.push_back(getPheroMaxVal()); @@ -347,26 +347,26 @@ phero_values.push_back(0.0); } - SUMOReal sum_avg_tmp = 0; + double sum_avg_tmp = 0; for (int i = 0; i < (int)phero_values.size(); i++) { sum_avg_tmp += phero_values[i]; } - SUMOReal mean = sum_avg_tmp / phero_values.size(); + double mean = sum_avg_tmp / phero_values.size(); - SUMOReal sum_dev_tmp = 0; + double sum_dev_tmp = 0; for (int i = 0; i < (int)phero_values.size(); i++) { sum_dev_tmp += pow(phero_values[i] - mean, 2); } - SUMOReal deviation = sqrt(sum_dev_tmp / phero_values.size()); + double deviation = sqrt(sum_dev_tmp / phero_values.size()); scaleFactorDispersionIn = getPheroMaxVal() / deviation; } void initScaleFactorDispersionOut(int lanes_out) { - std::vector phero_values; + std::vector phero_values; for (int i = 0; i < lanes_out / 2; i++) { phero_values.push_back(getPheroMaxVal()); @@ -375,19 +375,19 @@ phero_values.push_back(0.0); } - SUMOReal sum_avg_tmp = 0; + double sum_avg_tmp = 0; for (int i = 0; i < (int)phero_values.size(); i++) { sum_avg_tmp += phero_values[i]; } - SUMOReal mean = sum_avg_tmp / phero_values.size(); + double mean = sum_avg_tmp / phero_values.size(); - SUMOReal sum_dev_tmp = 0; + double sum_dev_tmp = 0; for (int i = 0; i < (int)phero_values.size(); i++) { sum_dev_tmp += pow(phero_values[i] - mean, 2); } - SUMOReal deviation = sqrt(sum_dev_tmp / phero_values.size()); + double deviation = sqrt(sum_dev_tmp / phero_values.size()); scaleFactorDispersionOut = getPheroMaxVal() / deviation; } @@ -434,8 +434,8 @@ /** * \factors to scale pheromoneDispersion in range [0, 10] */ - SUMOReal scaleFactorDispersionIn; - SUMOReal scaleFactorDispersionOut; + double scaleFactorDispersionIn; + double scaleFactorDispersionOut; // For every lane its index. Esed to get the current lane state for the lane std::map > m_laneIndexMap; @@ -444,14 +444,14 @@ std::map m_pheroLevelLog; //derivative - std::map* > m_meanSpeedHistory; - std::map* > m_derivativeHistory; - SUMOReal m_derivativeAlpha; + std::map* > m_meanSpeedHistory; + std::map* > m_derivativeHistory; + double m_derivativeAlpha; int m_losCounter;//los: loss of signal int m_losMaxLimit; bool m_useVehicleTypesWeights; -// SUMOReal pheroBegin; +// double pheroBegin; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSTLLogicControl.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSTLLogicControl.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSTLLogicControl.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSTLLogicControl.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -8,12 +8,12 @@ /// @author Michael Behrisch /// @author Sascha Krieg /// @date Sept 2002 -/// @version $Id: MSTLLogicControl.cpp 21217 2016-07-22 10:57:44Z behrisch $ +/// @version $Id: MSTLLogicControl.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // A class that stores and controls tls and switching of their programs /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,10 +46,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -405,7 +401,7 @@ assert(def.end >= def.begin); deltaPossible += TIME2STEPS(def.end - def.begin); } - int stretchUmlaufAnz = (int) TplConvert::_2SUMOReal(myTo->getParameter("StretchUmlaufAnz", "").c_str()); + int stretchUmlaufAnz = (int) TplConvert::_2double(myTo->getParameter("StretchUmlaufAnz", "").c_str()); deltaPossible = stretchUmlaufAnz * deltaPossible; if ((deltaPossible > deltaToCut) && (deltaToCut < (cycleTime / 2))) { cutLogic(step, gspTo, deltaToCut); @@ -470,8 +466,8 @@ SUMOTime durOfPhase = myTo->getPhase(currStep).duration; SUMOTime remainingStretchTime = allStretchTime; SUMOTime StretchTimeOfPhase = 0; - int stretchUmlaufAnz = (int) TplConvert::_2SUMOReal(myTo->getParameter("StretchUmlaufAnz", "").c_str()); - SUMOReal facSum = 0; + int stretchUmlaufAnz = (int) TplConvert::_2double(myTo->getParameter("StretchUmlaufAnz", "").c_str()); + double facSum = 0; int areasNo = getStretchAreaNo(myTo); for (int x = 0; x < areasNo; x++) { StretchBereichDef def = getStretchBereichDef(myTo, x + 1); @@ -486,8 +482,8 @@ SUMOTime end = TIME2STEPS(def.end); SUMOTime endOfPhase = (startPos + durOfPhase - diffToStart); if (end <= endOfPhase && end >= startPos) { - SUMOReal fac = def.fac; - SUMOReal actualfac = fac / facSum; + double fac = def.fac; + double actualfac = fac / facSum; facSum = facSum - fac; StretchTimeOfPhase = TIME2STEPS(int(STEPS2TIME(remainingStretchTime) * actualfac + 0.5)); remainingStretchTime = allStretchTime - StretchTimeOfPhase; @@ -510,9 +506,9 @@ for (int j = 0; j < areasNo && remainingStretchTime > 0; j++) { StretchBereichDef def = getStretchBereichDef(myTo, j + 1); SUMOTime end = TIME2STEPS(def.end); - SUMOReal fac = def.fac; + double fac = def.fac; if ((beginOfPhase <= end) && (endOfPhase >= end)) { - SUMOReal actualfac = fac / facSum; + double actualfac = fac / facSum; StretchTimeOfPhase = TIME2STEPS(int(STEPS2TIME(remainingStretchTime) * actualfac + 0.5)); facSum -= fac; durOfPhase += StretchTimeOfPhase; @@ -538,9 +534,9 @@ MSTLLogicControl::WAUTSwitchProcedure_Stretch::StretchBereichDef MSTLLogicControl::WAUTSwitchProcedure_Stretch::getStretchBereichDef(MSTrafficLightLogic* from, int index) const { StretchBereichDef def; - def.begin = TplConvert::_2SUMOReal(from->getParameter("B" + toString(index) + ".begin", "").c_str()); - def.end = TplConvert::_2SUMOReal(from->getParameter("B" + toString(index) + ".end", "").c_str()); - def.fac = TplConvert::_2SUMOReal(from->getParameter("B" + toString(index) + ".factor", "").c_str()); + def.begin = TplConvert::_2double(from->getParameter("B" + toString(index) + ".begin", "").c_str()); + def.end = TplConvert::_2double(from->getParameter("B" + toString(index) + ".end", "").c_str()); + def.fac = TplConvert::_2double(from->getParameter("B" + toString(index) + ".factor", "").c_str()); return def; } @@ -773,7 +769,7 @@ std::vector::const_iterator mbegin = w->switches.begin(); MSNet::getInstance()->getBeginOfTimestepEvents()->addEvent( new SwitchInitCommand(*this, wautid, (int)distance(mbegin, first)), - (*first).when, MSEventControl::NO_CHANGE); + (*first).when); } /* // set the current program to all junctions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSTLLogicControl.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSTLLogicControl.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSTLLogicControl.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSTLLogicControl.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Friedemann Wesner /// @date Sept 2002 -/// @version $Id: MSTLLogicControl.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSTLLogicControl.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A class that stores and controls tls and switching of their programs /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -102,7 +102,7 @@ /** @brief Verifies traffic lights loaded from the network * - * Comparse the phase state sizes of each phase with the accoring tls' number + * Compare the phase state sizes of each phase with the according tls' number * of controlled links. * @return Whether all tls programs are valid */ @@ -757,11 +757,11 @@ */ struct StretchBereichDef { /// @brief The begin of a stretch/cut area (time, in s) - SUMOReal begin; + double begin; /// @brief The end of a stretch/cut area (time, in s) - SUMOReal end; + double end; /// @brief The weight factor of a stretch/cut area - SUMOReal fac; + double fac; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSTrafficLightLogic.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSTrafficLightLogic.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSTrafficLightLogic.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSTrafficLightLogic.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: MSTrafficLightLogic.cpp 21217 2016-07-22 10:57:44Z behrisch $ +/// @version $Id: MSTrafficLightLogic.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // The parent class for traffic light logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,10 +44,6 @@ #include "MSTLLogicControl.h" #include "MSTrafficLightLogic.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static value definitions @@ -116,8 +112,7 @@ myCurrentDurationIncrement(-1), myDefaultCycleTime(0) { mySwitchCommand = new SwitchCommand(tlcontrol, this, delay); - MSNet::getInstance()->getBeginOfTimestepEvents()->addEvent( - mySwitchCommand, delay, MSEventControl::NO_CHANGE); + MSNet::getInstance()->getBeginOfTimestepEvents()->addEvent(mySwitchCommand, delay); } @@ -289,11 +284,13 @@ void MSTrafficLightLogic::initMesoTLSPenalties() { // set mesoscopic time penalties const Phases& phases = getPhases(); - const int numLinks = (int)phases.front()->getState().size(); - assert((int)myLinks.size() >= numLinks); + const int numLinks = (int)myLinks.size(); + // warning already given if not all states are used + assert(numLinks <= (int)phases.front()->getState().size()); SUMOTime duration = 0; - std::vector redDuration(numLinks, 0); - std::vector penalty(numLinks, 0); + std::vector redDuration(numLinks, 0); + std::vector totalRedDuration(numLinks, 0); + std::vector penalty(numLinks, 0); for (int i = 0; i < (int)phases.size(); ++i) { const std::string& state = phases[i]->getState(); duration += phases[i]->duration; @@ -302,6 +299,7 @@ if ((LinkState)state[j] == LINKSTATE_TL_RED || (LinkState)state[j] == LINKSTATE_TL_REDYELLOW) { redDuration[j] += STEPS2TIME(phases[i]->duration); + totalRedDuration[j] += STEPS2TIME(phases[i]->duration); } else if (redDuration[j] > 0) { penalty[j] += 0.5 * (redDuration[j] * redDuration[j] + redDuration[j]); redDuration[j] = 0; @@ -315,13 +313,14 @@ redDuration[j] = 0; } } - const SUMOReal durationSeconds = STEPS2TIME(duration); + const double durationSeconds = STEPS2TIME(duration); std::set controlledJunctions; for (int j = 0; j < numLinks; ++j) { for (int k = 0; k < (int)myLinks[j].size(); ++k) { myLinks[j][k]->setMesoTLSPenalty(TIME2STEPS(MSGlobals::gMesoTLSPenalty * penalty[j] / durationSeconds)); + myLinks[j][k]->setGreenFraction(MAX2((durationSeconds - MSGlobals::gMesoTLSPenalty * totalRedDuration[j]) / durationSeconds, NUMERICAL_EPS)); // avoid zero capacity (warning issued before) controlledJunctions.insert(myLinks[j][k]->getLane()->getEdge().getFromJunction()); // MSLink::myJunction is not yet initialized - //std::cout << " tls=" << getID() << " link=" << j << " penalty=" << penalty[j] / durationSeconds << " durSecs=" << durationSeconds << "\n"; + //std::cout << " tls=" << getID() << " i=" << j << " link=" << myLinks[j][k]->getViaLaneOrLane()->getID() << " penalty=" << penalty[j] / durationSeconds << " durSecs=" << durationSeconds << " greenTime=" << " gF=" << myLinks[j][k]->getGreenFraction() << "\n"; } } // initialize empty-net travel times diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSTrafficLightLogic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSTrafficLightLogic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/traffic_lights/MSTrafficLightLogic.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/traffic_lights/MSTrafficLightLogic.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Friedemann Wesner /// @date Sept 2002 -/// @version $Id: MSTrafficLightLogic.h 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: MSTrafficLightLogic.h 22840 2017-02-03 22:08:43Z luecken $ /// // The parent class for traffic light logics /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -68,16 +68,16 @@ /// @brief Definition of a list of phases, being the junction logic typedef std::vector Phases; - /// @brief Definition of the list of links that participate in this tl-light + /// @brief Definition of the list of links that are subjected to this tls typedef std::vector LinkVector; /// @brief Definition of a list that holds lists of links that do have the same attribute typedef std::vector LinkVectorVector; - /// @brief Definition of the list of links that participate in this tl-light + /// @brief Definition of the list of arrival lanes subjected to this tls typedef std::vector LaneVector; - /// @brief Definition of a list that holds lists of links that do have the same attribute + /// @brief Definition of a list that holds lists of lanes that do have the same attribute typedef std::vector LaneVectorVector; /// @} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSCalibrator.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSCalibrator.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSCalibrator.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSCalibrator.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, May 2005 -/// @version $Id: MSCalibrator.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSCalibrator.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // Calibrates the flow on an edge by removing an inserting vehicles /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,14 +46,10 @@ #include #include #include -#include +#include #include #include "MSCalibrator.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - //#define MSCalibrator_DEBUG // =========================================================================== @@ -66,10 +62,10 @@ // method definitions // =========================================================================== MSCalibrator::MSCalibrator(const std::string& id, - const MSEdge* const edge, const SUMOReal pos, + const MSEdge* const edge, const double pos, const std::string& aXMLFilename, const std::string& outputFilename, - const SUMOTime freq, const SUMOReal length, + const SUMOTime freq, const double length, const MSRouteProbe* probe, const bool addLaneMeanData) : MSTrigger(id), @@ -84,7 +80,7 @@ myAmActive(false) { if (outputFilename != "") { myOutput = &OutputDevice::getDevice(outputFilename); - myOutput->writeXMLHeader("calibratorstats"); + myOutput->writeXMLHeader("calibratorstats", "calibratorstats_file.xsd"); } if (aXMLFilename != "") { XMLSubSys::runParser(*this, aXMLFilename); @@ -115,9 +111,7 @@ } myCurrentStateInterval = myIntervals.begin(); // calibration should happen after regular insertions have taken place - MSNet::getInstance()->getEndOfTimestepEvents()->addEvent(this, - MSNet::getInstance()->getCurrentTimeStep(), - MSEventControl::ADAPT_AFTER_EXECUTION); + MSNet::getInstance()->getEndOfTimestepEvents()->addEvent(this); } else { WRITE_WARNING("No flow intervals in calibrator '" + myID + "'."); } @@ -149,8 +143,8 @@ } try { bool ok = true; - state.q = attrs.getOpt(SUMO_ATTR_VEHSPERHOUR, 0, ok, -1.); - state.v = attrs.getOpt(SUMO_ATTR_SPEED, 0, ok, -1.); + state.q = attrs.getOpt(SUMO_ATTR_VEHSPERHOUR, 0, ok, -1.); + state.v = attrs.getOpt(SUMO_ATTR_SPEED, 0, ok, -1.); state.begin = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, myID.c_str(), ok); if (state.begin < lastEnd) { WRITE_ERROR("Overlapping or unsorted intervals in calibrator '" + myID + "'."); @@ -209,8 +203,8 @@ const int discrepancy = myEdgeMeanData.nVehEntered + myEdgeMeanData.nVehDeparted - myEdgeMeanData.nVehVaporized - passed(); assert(discrepancy >= 0); const std::string ds = (discrepancy > 0 ? "\" vaporizedOnNextEdge=\"" + toString(discrepancy) : ""); - const SUMOReal durationSeconds = STEPS2TIME(myCurrentStateInterval->end - myCurrentStateInterval->begin); - (*myOutput) << " begin) << + const double durationSeconds = STEPS2TIME(myCurrentStateInterval->end - myCurrentStateInterval->begin); + (*myOutput) << " begin) << "\" end=\"" << time2string(myCurrentStateInterval->end) << "\" id=\"" << myID << "\" nVehContrib=\"" << p << @@ -246,7 +240,7 @@ int MSCalibrator::totalWished() const { if (myCurrentStateInterval != myIntervals.end()) { - const SUMOReal totalHourFraction = STEPS2TIME(myCurrentStateInterval->end - myCurrentStateInterval->begin) / (SUMOReal) 3600.; + const double totalHourFraction = STEPS2TIME(myCurrentStateInterval->end - myCurrentStateInterval->begin) / (double) 3600.; return (int)std::floor(myCurrentStateInterval->q * totalHourFraction + 0.5); // round to closest int } else { return -1; @@ -327,7 +321,7 @@ #endif if (calibrateFlow && adaptedNum < totalWishedNum && !hadRemovals) { // we need to insert some vehicles - const SUMOReal hourFraction = STEPS2TIME(currentTime - myCurrentStateInterval->begin + DELTA_T) / (SUMOReal) 3600.; + const double hourFraction = STEPS2TIME(currentTime - myCurrentStateInterval->begin + DELTA_T) / (double) 3600.; const int wishedNum = (int)std::floor(myCurrentStateInterval->q * hourFraction + 0.5); // round to closest int // only the difference between inflow and aspiredFlow should be added, thus // we should not count vehicles vaporized from a jam here @@ -443,7 +437,7 @@ MSVehicle* last = lane->getLastFullVehicle(); const SUMOVehicleParameter* pars = myCurrentStateInterval->vehicleParameter; const MSVehicleType* vtype = MSNet::getInstance()->getVehicleControl().getVType(pars->vtypeid); - const SUMOReal spacePerVehicle = vtype->getLengthWithGap() + myEdge->getSpeedLimit() * vtype->getCarFollowModel().getHeadwayTime(); + const double spacePerVehicle = vtype->getLengthWithGap() + myEdge->getSpeedLimit() * vtype->getCarFollowModel().getHeadwayTime(); if (last == 0) { // ensure vehicles can be inserted on short edges return MAX2(1, (int)(myEdge->getLength() / spacePerVehicle)); @@ -476,7 +470,7 @@ } } -bool MSCalibrator::VehicleRemover::notifyEnter(SUMOVehicle& veh, Notification /* reason */) { +bool MSCalibrator::VehicleRemover::notifyEnter(SUMOVehicle& veh, Notification /* reason */, const MSLane* /* enteredLane */) { if (myParent == 0) { return false; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSCalibrator.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSCalibrator.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSCalibrator.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSCalibrator.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, May 2005 -/// @version $Id: MSCalibrator.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MSCalibrator.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Calibrates the flow on an edge by removing an inserting vehicles /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -58,10 +58,10 @@ public: /** constructor */ MSCalibrator(const std::string& id, - const MSEdge* const edge, const SUMOReal pos, + const MSEdge* const edge, const double pos, const std::string& aXMLFilename, const std::string& outputFilename, - const SUMOTime freq, const SUMOReal length, + const SUMOTime freq, const double length, const MSRouteProbe* probe, const bool addLaneMeanData = true); /** destructor */ @@ -120,7 +120,7 @@ * @see Notification */ //@} - virtual bool notifyEnter(SUMOVehicle& veh, Notification reason); + virtual bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); void disable() { myParent = 0; @@ -143,8 +143,8 @@ AspiredState() : begin(-1), end(-1), q(-1.), v(-1.), vehicleParameter(0) {} SUMOTime begin; SUMOTime end; - SUMOReal q; - SUMOReal v; + double q; + double v; SUMOVehicleParameter* vehicleParameter; }; @@ -210,7 +210,7 @@ /// @brief the edge on which this calibrator lies const MSEdge* const myEdge; /// @brief the position on the edge where this calibrator lies - const SUMOReal myPos; + const double myPos; /// @brief the route probe to retrieve routes from const MSRouteProbe* const myProbe; /// @brief data collector for the calibrator @@ -248,7 +248,7 @@ /// @brief The information whether init was called bool myDidInit; /// @brief The default (maximum) speed on the segment - SUMOReal myDefaultSpeed; + double myDefaultSpeed; /// @brief The default (maximum) speed on the segment bool myHaveWarnedAboutClearingJam; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSChargingStation.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSChargingStation.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSChargingStation.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSChargingStation.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Tamas Kurczveil /// @author Pablo Alvarez Lopez /// @date 20-12-13 -/// @version $Id: MSChargingStation.cpp 21148 2016-07-12 08:47:10Z behrisch $ +/// @version $Id: MSChargingStation.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Chargin Station for Electric vehicles /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,46 +35,45 @@ #include #include #include +#include +#include #include "MSChargingStation.h" #include "MSTrigger.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions // =========================================================================== -MSChargingStation::MSChargingStation(const std::string& chargingStationID, MSLane& lane, SUMOReal startPos, SUMOReal endPos, - SUMOReal chargingPower, SUMOReal efficency, bool chargeInTransit, int chargeDelay) : +MSChargingStation::MSChargingStation(const std::string& chargingStationID, MSLane& lane, double startPos, double endPos, + double chargingPower, double efficency, bool chargeInTransit, int chargeDelay) : MSStoppingPlace(chargingStationID, std::vector(), lane, startPos, endPos), myChargingPower(0), myEfficiency(0), myChargeInTransit(chargeInTransit), myChargeDelay(0), - myChargingVehicle(false) { + myChargingVehicle(false), + myTotalCharge(0) { if (chargingPower < 0) - WRITE_WARNING("Parameter 'charging power' for Charging Station with ID = " + getID() + " is invalid (" + TplConvert::_2str(getChargingPower()) + ").") + WRITE_WARNING("Parameter " + toString(SUMO_ATTR_CHARGINGPOWER) + " for " + toString(SUMO_TAG_CHARGING_STATION) + " with ID = " + getID() + " is invalid (" + toString(getChargingPower()) + ").") else { myChargingPower = chargingPower; } - if (efficency < 0 || efficency > 1) - WRITE_WARNING("Parameter 'efficiency' for Charging Station with ID = " + getID() + " is invalid (" + TplConvert::_2str(getEfficency()) + ").") - else { - myEfficiency = efficency; - } + if (efficency < 0 || efficency > 1) { + WRITE_WARNING("Parameter " + toString(SUMO_ATTR_EFFICIENCY) + " for " + toString(SUMO_TAG_CHARGING_STATION) + " with ID = " + getID() + " is invalid (" + toString(getEfficency()) + ").") + } else { + myEfficiency = efficency; + } - if (chargeDelay < 0) - WRITE_WARNING("Parameter 'charge delay' for Charging Station with ID = " + getID() + " is invalid (" + TplConvert::_2str(getEfficency()) + ").") - else { - myChargeDelay = chargeDelay; - } + if (chargeDelay < 0) { + WRITE_WARNING("Parameter " + toString(SUMO_ATTR_CHARGEDELAY) + " for " + toString(SUMO_TAG_CHARGING_STATION) + " with ID = " + getID() + " is invalid (" + toString(getEfficency()) + ").") + } else { + myChargeDelay = chargeDelay; + } if (getBeginLanePosition() > getEndLanePosition()) { - WRITE_WARNING("Charging Station with ID = " + getID() + " don't have a valid range (" + TplConvert::_2str(getBeginLanePosition()) + " < " + TplConvert::_2str(getEndLanePosition()) + ")."); + WRITE_WARNING(toString(SUMO_TAG_CHARGING_STATION) + " with ID = " + getID() + " doesn't have a valid range (" + toString(getBeginLanePosition()) + " < " + toString(getEndLanePosition()) + ")."); } } @@ -83,13 +82,13 @@ } -SUMOReal +double MSChargingStation::getChargingPower() const { return myChargingPower; } -SUMOReal +double MSChargingStation::getEfficency() const { return myEfficiency; } @@ -101,29 +100,29 @@ } -SUMOReal +double MSChargingStation::getChargeDelay() const { return myChargeDelay; } void -MSChargingStation::setChargingPower(SUMOReal chargingPower) { - if (chargingPower < 0) - WRITE_WARNING("new charging power for Chargin Station with ID = " + getID() + " not valid (" + TplConvert::_2str(chargingPower) + ").") - else { - myChargingPower = chargingPower; - } +MSChargingStation::setChargingPower(double chargingPower) { + if (chargingPower < 0) { + WRITE_WARNING("New " + toString(SUMO_ATTR_CHARGINGPOWER) + " for " + toString(SUMO_TAG_CHARGING_STATION) + " with ID = " + getID() + " isn't valid (" + toString(chargingPower) + ").") + } else { + myChargingPower = chargingPower; + } } void -MSChargingStation::setEfficency(SUMOReal efficency) { - if (efficency < 0 || efficency > 1) - WRITE_WARNING("new efficiency for Chargin Station with ID = " + getID() + " not valid (" + TplConvert::_2str(efficency) + ").") - else { - myEfficiency = efficency; - } +MSChargingStation::setEfficency(double efficency) { + if (efficency < 0 || efficency > 1) { + WRITE_WARNING("New " + toString(SUMO_ATTR_EFFICIENCY) + " for " + toString(SUMO_TAG_CHARGING_STATION) + " with ID = " + getID() + " isn't valid (" + toString(efficency) + ").") + } else { + myEfficiency = efficency; + } } @@ -135,11 +134,11 @@ void MSChargingStation::setChargeDelay(int chargeDelay) { - if (chargeDelay < 0) - WRITE_WARNING("new charge delay for Chargin Station with ID = " + getID() + " not valid (" + TplConvert::_2str(chargeDelay) + ").") - else { - myChargeDelay = chargeDelay; - } + if (chargeDelay < 0) { + WRITE_WARNING("New " + toString(SUMO_ATTR_CHARGEDELAY) + " for " + toString(SUMO_TAG_CHARGING_STATION) + " with ID = " + getID() + " isn't valid (" + toString(chargeDelay) + ").") + } else { + myChargeDelay = chargeDelay; + } } @@ -150,7 +149,7 @@ bool -MSChargingStation::vehicleIsInside(const SUMOReal position) const { +MSChargingStation::vehicleIsInside(const double position) const { if ((position >= getBeginLanePosition()) && (position <= getEndLanePosition())) { return true; } else { @@ -165,4 +164,118 @@ } +void +MSChargingStation::addChargeValueForOutput(double WCharged, MSDevice_Battery* battery) { + std::string status = ""; + if (battery->getChargingStartTime() > myChargeDelay) { + if (battery->getHolder().getSpeed() < battery->getStoppingTreshold()) { + status = "chargingStopped"; + } else if (myChargeInTransit == true) { + status = "chargingInTransit"; + } else { + status = "noCharging"; + } + } else { + if (myChargeInTransit == true) { + status = "waitingChargeInTransit"; + } else if (battery->getHolder().getSpeed() < battery->getStoppingTreshold()) { + status = "waitingChargeStopped"; + } else { + status = "noWaitingCharge"; + } + } + // update total charge + myTotalCharge += WCharged; + // create charge row and insert it in myChargeValues + charge C(MSNet::getInstance()->getCurrentTimeStep(), battery->getHolder().getID(), battery->getHolder().getVehicleType().getID(), + status, WCharged, battery->getActualBatteryCapacity(), battery->getMaximumBatteryCapacity(), + myChargingPower, myEfficiency, myTotalCharge); + myChargeValues.push_back(C); +} + + +void +MSChargingStation::writeChargingStationOutput(OutputDevice& output) { + output.openTag(SUMO_TAG_CHARGING_STATION); + output.writeAttr(SUMO_ATTR_ID, myID); + output.writeAttr(SUMO_ATTR_TOTALENERGYCHARGED, myTotalCharge); + output.writeAttr(SUMO_ATTR_CHARGINGSTEPS, myChargeValues.size()); + // start writting + if (myChargeValues.size() > 0) { + // First calculate charge for every vehicle + std::vector charge; + std::vector > vectorBeginEndCharge; + SUMOTime firsTimeStep = myChargeValues.at(0).timeStep; + // set first value + charge.push_back(0); + vectorBeginEndCharge.push_back(std::pair(firsTimeStep, 0)); + // iterate over charging values + for (std::vector::const_iterator i = myChargeValues.begin(); i != myChargeValues.end(); i++) { + // update chargue + charge.back() += i->WCharged; + // update end time + vectorBeginEndCharge.back().second = i->timeStep; + // update timestep of charge + firsTimeStep += 1000; + // check if charge is continuous. If not, open a new vehicle tag + if (((i + 1) != myChargeValues.end()) && (((i + 1)->timeStep) != firsTimeStep)) { + // set new firsTimeStep of charge + firsTimeStep = (i + 1)->timeStep; + charge.push_back(0); + vectorBeginEndCharge.push_back(std::pair(firsTimeStep, 0)); + } + } + // now write values + firsTimeStep = myChargeValues.at(0).timeStep; + int vehicleCounter = 0; + // open tag for first vehicle and write id and type of vehicle + output.openTag(SUMO_TAG_VEHICLE); + output.writeAttr(SUMO_ATTR_ID, myChargeValues.at(0).vehicleID); + output.writeAttr(SUMO_ATTR_TYPE, myChargeValues.at(0).vehicleType); + output.writeAttr(SUMO_ATTR_TOTALENERGYCHARGED_VEHICLE, charge.at(0)); + output.writeAttr(SUMO_ATTR_CHARGINGBEGIN, vectorBeginEndCharge.at(0).first); + output.writeAttr(SUMO_ATTR_CHARGINGEND, vectorBeginEndCharge.at(0).second); + // iterate over charging values + for (std::vector::const_iterator i = myChargeValues.begin(); i != myChargeValues.end(); i++) { + // open tag for timestep and write all parameters + output.openTag(SUMO_TAG_STEP); + output.writeAttr(SUMO_ATTR_TIME, i->timeStep); + // charge values + output.writeAttr(SUMO_ATTR_CHARGING_STATUS, i->status); + output.writeAttr(SUMO_ATTR_ENERGYCHARGED, i->WCharged); + output.writeAttr(SUMO_ATTR_PARTIALCHARGE, i->totalEnergyCharged); + // charging values of charging station in this timestep + output.writeAttr(SUMO_ATTR_CHARGINGPOWER, i->chargingPower); + output.writeAttr(SUMO_ATTR_EFFICIENCY, i->chargingEfficiency); + // battery status of vehicle + output.writeAttr(SUMO_ATTR_ACTUALBATTERYCAPACITY, i->actualBatteryCapacity); + output.writeAttr(SUMO_ATTR_MAXIMUMBATTERYCAPACITY, i->maxBatteryCapacity); + // close tag timestep + output.closeTag(); + // update timestep of charge + firsTimeStep += 1000; + // check if charge is continuous. If not, open a new vehicle tag + if (((i + 1) != myChargeValues.end()) && (((i + 1)->timeStep) != firsTimeStep)) { + // set new firsTimeStep of charge + firsTimeStep = (i + 1)->timeStep; + // update counter + vehicleCounter++; + // close previous vehicle tag + output.closeTag(); + // open tag for new vehicle and write id and type of vehicle + output.openTag(SUMO_TAG_VEHICLE); + output.writeAttr(SUMO_ATTR_ID, (i + 1)->vehicleID); + output.writeAttr(SUMO_ATTR_TYPE, (i + 1)->vehicleType); + output.writeAttr(SUMO_ATTR_TOTALENERGYCHARGED_VEHICLE, charge.at(vehicleCounter)); + output.writeAttr(SUMO_ATTR_CHARGINGBEGIN, vectorBeginEndCharge.at(vehicleCounter).first); + output.writeAttr(SUMO_ATTR_CHARGINGEND, vectorBeginEndCharge.at(vehicleCounter).second); + } + } + // close vehicle tag + output.closeTag(); + } + // close charging station tag + output.closeTag(); +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSChargingStation.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSChargingStation.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSChargingStation.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSChargingStation.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Tamas Kurczveil /// @author Pablo Alvarez Lopez /// @date 20-12-13 -/// @version $Id: MSChargingStation.h 21014 2016-06-21 09:02:22Z behrisch $ +/// @version $Id: MSChargingStation.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Chargin Station for Electric vehicles /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,6 +45,7 @@ class MSLane; class MSBusStop; class OptionsCont; +class MSDevice_Battery; // =========================================================================== @@ -58,29 +59,29 @@ public: /// @brief constructor - MSChargingStation(const std::string& chargingStationID, MSLane& lane, SUMOReal startPos, SUMOReal endPos, - SUMOReal chargingPower, SUMOReal efficency, bool chargeInTransit, int chargeDelay); + MSChargingStation(const std::string& chargingStationID, MSLane& lane, double startPos, double endPos, + double chargingPower, double efficency, bool chargeInTransit, int chargeDelay); /// @brief destructor ~MSChargingStation(); /// @brief Get charging station's charging power - SUMOReal getChargingPower() const; + double getChargingPower() const; /// @brief Get efficiency of the charging station - SUMOReal getEfficency() const; + double getEfficency() const; /// @brief Get chargeInTransit bool getChargeInTransit() const; /// @brief Get Charge Delay - SUMOReal getChargeDelay() const; + double getChargeDelay() const; /// @brief Set charging station's charging power - void setChargingPower(SUMOReal chargingPower); + void setChargingPower(double chargingPower); /// @brief Set efficiency of the charging station - void setEfficency(SUMOReal efficency); + void setEfficency(double efficency); /// @brief Set charge in transit of the charging station void setChargeInTransit(bool chargeInTransit); @@ -95,18 +96,63 @@ * @param[in] position Position of vehicle in the LANE * @return true if is between StartPostion and EndPostion */ - bool vehicleIsInside(const SUMOReal position) const; + bool vehicleIsInside(const double position) const; /// @brief Return true if in the current time step charging station is charging a vehicle bool isCharging() const; + /// @brief add charge value for output + void addChargeValueForOutput(double WCharged, MSDevice_Battery* battery); + + /// @brief write charging station values + void writeChargingStationOutput(OutputDevice& output); + protected: + /// @brief struct to save information for the cahrgingStation output + struct charge { + /// @brief constructor + charge(SUMOTime _timeStep, std::string _vehicleID, std::string _vehicleType, std::string _status, + double _WCharged, double _actualBatteryCapacity, double _maxBatteryCapacity, double _chargingPower, + double _chargingEfficiency, double _totalEnergyCharged) : + timeStep(_timeStep), + vehicleID(_vehicleID), + vehicleType(_vehicleType), + status(_status), + WCharged(_WCharged), + actualBatteryCapacity(_actualBatteryCapacity), + maxBatteryCapacity(_maxBatteryCapacity), + chargingPower(_chargingPower), + chargingEfficiency(_chargingEfficiency), + totalEnergyCharged(_totalEnergyCharged) {} + + // @brief vehicle TimeStep + SUMOTime timeStep; + // @brief vehicle ID + std::string vehicleID; + // @brief vehicle Type + std::string vehicleType; + /// @brief status + std::string status; + // @brief W charged + double WCharged; + // @brief actual battery capacity AFTER charging + double actualBatteryCapacity; + // @brief battery max capacity + double maxBatteryCapacity; + // @brief current charging power of charging station + double chargingPower; + // @brief current efficiency of charging station + double chargingEfficiency; + // @brief current energy charged by charging stations AFTER charging + double totalEnergyCharged; + }; + /// @brief Charging station's charging power - SUMOReal myChargingPower; + double myChargingPower; /// @brief Efficiency of the charging station - SUMOReal myEfficiency; + double myEfficiency; /// @brief Allow charge in transit bool myChargeInTransit; @@ -117,8 +163,13 @@ /// @brief Check if in the current TimeStep chargingStation is charging a vehicle bool myChargingVehicle; -private: + /// @brief total energy charged by this charging station + double myTotalCharge; + + /// @brief vector with the charges of this charging station + std::vector myChargeValues; +private: /// @brief Invalidated copy constructor. MSChargingStation(const MSChargingStation&); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSLaneSpeedTrigger.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSLaneSpeedTrigger.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSLaneSpeedTrigger.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSLaneSpeedTrigger.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Sept 2002 -/// @version $Id: MSLaneSpeedTrigger.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSLaneSpeedTrigger.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // Changes the speed allowed on a set of lanes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -49,10 +49,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -96,7 +92,7 @@ // add the processing to the event handler MSNet::getInstance()->getBeginOfTimestepEvents()->addEvent( new WrappingCommand(this, &MSLaneSpeedTrigger::execute), - (*myCurrentEntry).first, MSEventControl::NO_CHANGE); + (*myCurrentEntry).first); myDidInit = true; } @@ -114,7 +110,7 @@ MSLaneSpeedTrigger::processCommand(bool move2next, SUMOTime currentTime) { UNUSED_PARAMETER(currentTime); std::vector::iterator i; - const SUMOReal speed = getCurrentSpeed(); + const double speed = getCurrentSpeed(); if (MSGlobals::gUseMesoSim) { if (myDestLanes.size() > 0 && myDestLanes.front()->getSpeedLimit() != speed) { myDestLanes.front()->getEdge().setMaxSpeed(speed); @@ -154,7 +150,7 @@ // extract the values bool ok = true; SUMOTime next = attrs.getSUMOTimeReporting(SUMO_ATTR_TIME, getID().c_str(), ok); - SUMOReal speed = attrs.getOpt(SUMO_ATTR_SPEED, getID().c_str(), ok, -1); + double speed = attrs.getOpt(SUMO_ATTR_SPEED, getID().c_str(), ok, -1); // check the values if (next < 0) { WRITE_ERROR("Wrong time in vss '" + getID() + "'."); @@ -181,7 +177,7 @@ } -SUMOReal +double MSLaneSpeedTrigger::getDefaultSpeed() const { return myDefaultSpeed; } @@ -195,13 +191,13 @@ void -MSLaneSpeedTrigger::setOverridingValue(SUMOReal val) { +MSLaneSpeedTrigger::setOverridingValue(double val) { mySpeedOverrideValue = val; processCommand(false, MSNet::getInstance()->getCurrentTimeStep()); } -SUMOReal +double MSLaneSpeedTrigger::getLoadedSpeed() { if (myCurrentEntry != myLoadedSpeeds.begin()) { return (*(myCurrentEntry - 1)).second; @@ -211,7 +207,7 @@ } -SUMOReal +double MSLaneSpeedTrigger::getCurrentSpeed() const { if (myAmOverriding) { return mySpeedOverrideValue; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSLaneSpeedTrigger.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSLaneSpeedTrigger.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSLaneSpeedTrigger.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSLaneSpeedTrigger.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: MSLaneSpeedTrigger.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSLaneSpeedTrigger.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Changes the speed allowed on a set of lanes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -88,16 +88,16 @@ SUMOTime processCommand(bool move2next, SUMOTime currentTime); - SUMOReal getDefaultSpeed() const; + double getDefaultSpeed() const; void setOverriding(bool val); - void setOverridingValue(SUMOReal val); + void setOverridingValue(double val); - SUMOReal getLoadedSpeed(); + double getLoadedSpeed(); /// Returns the current speed - SUMOReal getCurrentSpeed() const; + double getCurrentSpeed() const; protected: /// @name inherited from GenericSAXHandler @@ -128,19 +128,19 @@ std::vector myDestLanes; /** the speed that will be set on the next call */ - SUMOReal myCurrentSpeed; + double myCurrentSpeed; /// The original speed allowed on the lanes - SUMOReal myDefaultSpeed; + double myDefaultSpeed; /// The information whether the read speed shall be overridden bool myAmOverriding; /// The speed to use if overriding the read speed - SUMOReal mySpeedOverrideValue; + double mySpeedOverrideValue; - std::vector > myLoadedSpeeds; - std::vector >::iterator myCurrentEntry; + std::vector > myLoadedSpeeds; + std::vector >::iterator myCurrentEntry; private: /// @brief Invalidated copy constructor. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSTrigger.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSTrigger.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSTrigger.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSTrigger.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Sept 2012 -/// @version $Id: MSTrigger.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSTrigger.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // An abstract device that changes the state of the micro simulation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSTriggeredRerouter.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSTriggeredRerouter.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSTriggeredRerouter.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSTriggeredRerouter.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,13 +3,14 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @author Michael Behrisch +/// @author Mirco Sturari /// @date Mon, 25 July 2005 -/// @version $Id: MSTriggeredRerouter.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: MSTriggeredRerouter.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // Reroutes vehicles passing an edge /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,6 +33,7 @@ #include #include +#include #include #include #include @@ -55,10 +57,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - //#define DEBUG_REROUTER #define DEBUGCOND (veh.getID() == "disabled") @@ -73,7 +71,7 @@ // =========================================================================== MSTriggeredRerouter::MSTriggeredRerouter(const std::string& id, const MSEdgeVector& edges, - SUMOReal prob, const std::string& file, bool off) : + double prob, const std::string& file, bool off) : MSTrigger(id), MSMoveReminder(id), SUMOSAXHandler(file), @@ -128,7 +126,7 @@ } // get the probability to reroute bool ok = true; - SUMOReal prob = attrs.getOpt(SUMO_ATTR_PROB, getID().c_str(), ok, 1.); + double prob = attrs.getOpt(SUMO_ATTR_PROB, getID().c_str(), ok, 1.); if (!ok) { throw ProcessError(); } @@ -136,9 +134,10 @@ throw ProcessError("MSTriggeredRerouter " + getID() + ": Attribute 'probability' for destination '" + dest + "' is negative (must not)."); } // add - myCurrentEdgeProb.add(prob, to); + myCurrentEdgeProb.add(to, prob); } + if (element == SUMO_TAG_CLOSING_REROUTE) { // by closing std::string closed_id = attrs.getStringSecure(SUMO_ATTR_ID, ""); @@ -187,7 +186,7 @@ // get the probability to reroute bool ok = true; - SUMOReal prob = attrs.getOpt(SUMO_ATTR_PROB, getID().c_str(), ok, 1.); + double prob = attrs.getOpt(SUMO_ATTR_PROB, getID().c_str(), ok, 1.); if (!ok) { throw ProcessError(); } @@ -195,7 +194,33 @@ throw ProcessError("MSTriggeredRerouter " + getID() + ": Attribute 'probability' for route '" + routeStr + "' is negative (must not)."); } // add - myCurrentRouteProb.add(prob, route); + myCurrentRouteProb.add(route, prob); + } + + if (element == SUMO_TAG_PARKING_ZONE_REROUTE) { + // by giving probabilities of new destinations + // get the destination edge + std::string parkingarea = attrs.getStringSecure(SUMO_ATTR_ID, ""); + if (parkingarea == "") { + throw ProcessError("MSTriggeredRerouter " + getID() + ": No parking area id given."); + } + MSParkingArea* pa = MSNet::getInstance()->getParkingArea(parkingarea); + if (pa == 0) { + throw ProcessError("MSTriggeredRerouter " + getID() + ": Parking area '" + parkingarea + "' is not known."); + } + // get the probability to reroute + bool ok = true; + const double prob = attrs.getOpt(SUMO_ATTR_PROB, getID().c_str(), ok, 1.); + if (!ok) { + throw ProcessError(); + } + if (prob < 0) { + throw ProcessError("MSTriggeredRerouter " + getID() + ": Attribute 'probability' for destination '" + parkingarea + "' is negative (must not)."); + } + // add + myCurrentParkProb.add(pa, prob); + //MSEdge* to = &(pa->getLane().getEdge()); + //myCurrentEdgeProb.add(prob, to); } } @@ -211,6 +236,7 @@ ri.edgeProbs = myCurrentEdgeProb; ri.routeProbs = myCurrentRouteProb; ri.permissions = myCurrentPermissions; + ri.parkProbs = myCurrentParkProb; if (ri.closedLanes.size() > 0) { // collect edges that are affect by a closed lane std::set affected; @@ -223,12 +249,12 @@ myCurrentClosedLanes.clear(); myCurrentEdgeProb.clear(); myCurrentRouteProb.clear(); + myCurrentParkProb.clear(); myIntervals.push_back(ri); myIntervals.back().id = (long)&myIntervals.back(); if (!(ri.closed.empty() && ri.closedLanes.empty()) && ri.permissions != SVCAll) { MSNet::getInstance()->getBeginOfTimestepEvents()->addEvent( - new WrappingCommand(this, &MSTriggeredRerouter::setPermissions), ri.begin, - MSEventControl::ADAPT_AFTER_EXECUTION); + new WrappingCommand(this, &MSTriggeredRerouter::setPermissions), ri.begin); } } } @@ -253,8 +279,7 @@ (*l)->getEdge().rebuildAllowedLanes(); } MSNet::getInstance()->getBeginOfTimestepEvents()->addEvent( - new WrappingCommand(this, &MSTriggeredRerouter::setPermissions), i->end, - MSEventControl::ADAPT_AFTER_EXECUTION); + new WrappingCommand(this, &MSTriggeredRerouter::setPermissions), i->end); } if (i->end == currentTime && !(i->closed.empty() && i->closedLanes.empty()) && i->permissions != SVCAll) { for (MSEdgeVector::iterator e = i->closed.begin(); e != i->closed.end(); ++e) { @@ -283,6 +308,8 @@ i->edgeProbs.getOverallProb() > 0 || // routeProbReroute i->routeProbs.getOverallProb() > 0 || + // parkingZoneReroute + i->parkProbs.getOverallProb() > 0 || // affected by closingReroute veh.getRoute().containsAnyOf(i->closed) || // affected by closingLaneReroute @@ -299,7 +326,7 @@ MSTriggeredRerouter::getCurrentReroute(SUMOTime time) const { for (std::vector::const_iterator i = myIntervals.begin(); i != myIntervals.end(); ++i) { if (i->begin <= time && i->end > time) { - if (i->edgeProbs.getOverallProb() != 0 || i->routeProbs.getOverallProb() != 0 || !i->closed.empty()) { + if (i->parkProbs.getOverallProb() != 0 || i->edgeProbs.getOverallProb() != 0 || i->routeProbs.getOverallProb() != 0 || !i->closed.empty()) { return &*i; } } @@ -309,28 +336,28 @@ bool -MSTriggeredRerouter::notifyMove(SUMOVehicle& veh, SUMOReal /*oldPos*/, - SUMOReal /*newPos*/, SUMOReal /*newSpeed*/) { +MSTriggeredRerouter::notifyMove(SUMOVehicle& veh, double /*oldPos*/, + double /*newPos*/, double /*newSpeed*/) { return notifyEnter(veh, NOTIFICATION_JUNCTION); } bool -MSTriggeredRerouter::notifyLeave(SUMOVehicle& /*veh*/, SUMOReal /*lastPos*/, - MSMoveReminder::Notification reason) { +MSTriggeredRerouter::notifyLeave(SUMOVehicle& /*veh*/, double /*lastPos*/, + MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) { return reason == NOTIFICATION_LANE_CHANGE; } bool -MSTriggeredRerouter::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification /*reason*/) { +MSTriggeredRerouter::notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification /*reason*/, const MSLane* /* enteredLane */) { // check whether the vehicle shall be rerouted const SUMOTime time = MSNet::getInstance()->getCurrentTimeStep(); const MSTriggeredRerouter::RerouteInterval* rerouteDef = getCurrentReroute(time, veh); if (rerouteDef == 0) { return true; // an active interval could appear later } - SUMOReal prob = myAmInUserMode ? myUserProbability : myProbability; + double prob = myAmInUserMode ? myUserProbability : myProbability; if (RandHelper::rand() > prob) { return false; // XXX another interval could appear later but we would have to track whether the current interval was already tried } @@ -347,6 +374,41 @@ std::cout << SIMTIME << " veh=" << veh.getID() << " check rerouter " << getID() << " lane=" << veh.getLane()->getID() << " edge=" << veh.getEdge()->getID() << " finalEdge=" << lastEdge->getID() << " arrivalPos=" << veh.getArrivalPos() << "\n"; } #endif + + if (rerouteDef->parkProbs.getOverallProb() > 0) { + MSParkingArea* newParkingArea = rerouteParkingZone(rerouteDef, veh); + if (newParkingArea != 0) { + const MSEdge* newEdge = &(newParkingArea->getLane().getEdge()); + + SUMOAbstractRouter& router = hasReroutingDevice + ? MSDevice_Routing::getRouterTT(rerouteDef->closed) + : MSNet::getInstance()->getRouterTT(rerouteDef->closed); + + // Compute the route from the current edge to the parking area edge + ConstMSEdgeVector edgesToPark; + router.compute(veh.getEdge(), newEdge, &veh, MSNet::getInstance()->getCurrentTimeStep(), edgesToPark); + + // Compute the route from the parking area edge to the end of the route + ConstMSEdgeVector edgesFromPark; + router.compute(newEdge, lastEdge, &veh, MSNet::getInstance()->getCurrentTimeStep(), edgesFromPark); + + // we have a new destination, let's replace the vehicle route + ConstMSEdgeVector edges = edgesToPark; + if (edgesFromPark.size() > 0) { + edges.insert(edges.end(), edgesFromPark.begin() + 1, edgesFromPark.end()); + } + + veh.replaceRouteEdges(edges, false, false, false); + std::string errorMsg; + if (!veh.replaceParkingArea(newParkingArea, errorMsg)) { + WRITE_WARNING("Vehicle '" + veh.getID() + "' at rerouter '" + getID() + + "' could not reroute to new parkingArea '" + newParkingArea->getID() + + "' reason=" + errorMsg + ", time=" + time2string(MSNet::getInstance()->getCurrentTimeStep()) + "."); + } + } + return false; + } + // get rerouting params const MSRoute* newRoute = rerouteDef->routeProbs.getOverallProb() > 0 ? rerouteDef->routeProbs.get() : 0; // we will use the route if given rather than calling our own dijsktra... @@ -361,7 +423,7 @@ } const MSEdge* newEdge = lastEdge; // ok, try using a new destination - SUMOReal newArrivalPos = -1; + double newArrivalPos = -1; const bool destUnreachable = std::find(rerouteDef->closed.begin(), rerouteDef->closed.end(), lastEdge) != rerouteDef->closed.end(); // if we have a closingReroute, only assign new destinations to vehicles which cannot reach their original destination // if we have a closingLaneReroute, no new destinations should be assigned @@ -419,7 +481,7 @@ void -MSTriggeredRerouter::setUserUsageProbability(SUMOReal prob) { +MSTriggeredRerouter::setUserUsageProbability(double prob) { myUserProbability = prob; } @@ -430,18 +492,228 @@ } -SUMOReal +double MSTriggeredRerouter::getProbability() const { return myAmInUserMode ? myUserProbability : myProbability; } -SUMOReal +double MSTriggeredRerouter::getUserProbability() const { return myUserProbability; } +double +MSTriggeredRerouter::getWeight(SUMOVehicle& veh, const std::string param, const double defaultWeight) const { + // get custom vehicle parameter + if (veh.getParameter().knowsParameter(param)) { + try { + return TplConvert::_2double(veh.getParameter().getParameter(param, "-1").c_str()); + } catch (...) { + WRITE_WARNING("Invalid value '" + veh.getParameter().getParameter(param, "-1") + "' for vehicle parameter '" + param + "'"); + } + } else { + // get custom vType parameter + if (veh.getVehicleType().getParameter().knowsParameter(param)) { + try { + return TplConvert::_2double(veh.getVehicleType().getParameter().getParameter(param, "-1").c_str()); + } catch (...) { + WRITE_WARNING("Invalid value '" + veh.getVehicleType().getParameter().getParameter(param, "-1") + "' for vType parameter '" + param + "'"); + } + } + } + //WRITE_MESSAGE("Vehicle '" +veh.getID() + "' does not supply vehicle parameter '" + param + "'. Using default of " + toString(defaultWeight) + "\n"; + return defaultWeight; +} + + +MSParkingArea* +MSTriggeredRerouter::rerouteParkingZone(const MSTriggeredRerouter::RerouteInterval* rerouteDef, SUMOVehicle& veh) const { + + MSParkingArea* nearParkArea = 0; + + // get vehicle params + MSParkingArea* destParkArea = veh.getNextParkingArea(); + const MSRoute& route = veh.getRoute(); + + // I reroute destination from initial parking area to the near parking area + // if the next stop is a parking area and if it is full + if (destParkArea != 0 && + destParkArea->getOccupancy() == destParkArea->getCapacity()) { + + typedef std::map ParkingParamMap_t; + typedef std::map MSParkingAreaMap_t; + + ParkingParamMap_t weights; + + // The probability of choosing this area inside the zone + weights["probability"] = getWeight(veh, "parking.probability.weight", 0.0); + + // The capacity of this area + weights["capacity"] = getWeight(veh, "parking.capacity.weight", 0.0); + + // The absolute number of free spaces + weights["absfreespace"] = getWeight(veh, "parking.absfreespace.weight", 0.0); + + // The relative number of free spaces + weights["relfreespace"] = getWeight(veh, "parking.relfreespace.weight", 0.0); + + // The distance to the new parking area + weights["distanceto"] = getWeight(veh, "parking.distanceto.weight", getWeight(veh, "parking.distance.weight", 1.0)); + + // The time to reach this area + weights["timeto"] = getWeight(veh, "parking.timeto.weight", 0.0); + + // The distance from the new parking area + weights["distancefrom"] = getWeight(veh, "parking.distancefrom.weight", 0.0); + + // The time to reach the end from this area + weights["timefrom"] = getWeight(veh, "parking.timefrom.weight", 0.0); + + // a map stores maximum values to normalize parking values + ParkingParamMap_t maxValues; + + maxValues["probability"] = 0.0; + maxValues["capacity"] = 0.0; + maxValues["absfreespace"] = 0.0; + maxValues["relfreespace"] = 0.0; + maxValues["distanceto"] = 0.0; + maxValues["timeto"] = 0.0; + maxValues["distancefrom"] = 0.0; + maxValues["timefrom"] = 0.0; + + // a map stores elegible parking areas + MSParkingAreaMap_t parkAreas; + + SUMOAbstractRouter& router = MSNet::getInstance()->getRouterTT(rerouteDef->closed); + + std::vector parks = rerouteDef->parkProbs.getVals(); + std::vector probs = rerouteDef->parkProbs.getProbs(); + + for (int i = 0; i < (int)parks.size(); ++i) { + MSParkingArea* pa = parks[i]; + const double prob = probs[i]; + if (pa->getOccupancy() < pa->getCapacity()) { + + // a map stores the parking values + ParkingParamMap_t parkValues; + + const RGBColor& c = route.getColor(); + const MSEdge* parkEdge = &(pa->getLane().getEdge()); + + const bool includeInternalLengths = MSGlobals::gUsingInternalLanes && MSNet::getInstance()->hasInternalLinks(); + + // Compute the route from the current edge to the parking area edge + ConstMSEdgeVector edgesToPark; + router.compute(veh.getEdge(), parkEdge, &veh, MSNet::getInstance()->getCurrentTimeStep(), edgesToPark); + + if (edgesToPark.size() > 0) { + // Compute the route from the parking area edge to the end of the route + ConstMSEdgeVector edgesFromPark; + router.compute(parkEdge, route.getLastEdge(), &veh, MSNet::getInstance()->getCurrentTimeStep(), edgesFromPark); + + if (edgesFromPark.size() > 0) { + + parkValues["probability"] = prob; + + if (parkValues["probability"] > maxValues["probability"]) { + maxValues["probability"] = parkValues["probability"]; + } + + parkValues["capacity"] = (double)(pa->getCapacity()); + parkValues["absfreespace"] = (double)(pa->getCapacity() - pa->getOccupancy()); + parkValues["relfreespace"] = parkValues["absfreespace"] / parkValues["capacity"]; + + if (parkValues["capacity"] > maxValues["capacity"]) { + maxValues["capacity"] = parkValues["capacity"]; + } + + if (parkValues["absfreespace"] > maxValues["absfreespace"]) { + maxValues["absfreespace"] = parkValues["absfreespace"]; + } + + if (parkValues["relfreespace"] > maxValues["relfreespace"]) { + maxValues["relfreespace"] = parkValues["relfreespace"]; + } + + MSRoute routeToPark(route.getID() + "!topark#1", edgesToPark, false, &c == &RGBColor::DEFAULT_COLOR ? 0 : new RGBColor(c), route.getStops()); + + // The distance from the current edge to the new parking area + parkValues["distanceto"] = routeToPark.getDistanceBetween(veh.getPositionOnLane(), pa->getBeginLanePosition(), + routeToPark.begin(), routeToPark.end(), includeInternalLengths); + + // The time to reach the new parking area + parkValues["timeto"] = router.recomputeCosts(edgesToPark, &veh, MSNet::getInstance()->getCurrentTimeStep()); + + if (parkValues["distanceto"] > maxValues["distanceto"]) { + maxValues["distanceto"] = parkValues["distanceto"]; + } + + if (parkValues["timeto"] > maxValues["timeto"]) { + maxValues["timeto"] = parkValues["timeto"]; + } + + MSRoute routeFromPark(route.getID() + "!frompark#1", edgesFromPark, false, &c == &RGBColor::DEFAULT_COLOR ? 0 : new RGBColor(c), route.getStops()); + + // The distance from the new parking area to the end of the route + parkValues["distancefrom"] = routeFromPark.getDistanceBetween(pa->getBeginLanePosition(), routeFromPark.getLastEdge()->getLength(), + routeFromPark.begin(), routeFromPark.end(), includeInternalLengths); + + // The time to reach this area + parkValues["timefrom"] = router.recomputeCosts(edgesFromPark, &veh, MSNet::getInstance()->getCurrentTimeStep()); + + if (parkValues["distancefrom"] > maxValues["distancefrom"]) { + maxValues["distancefrom"] = parkValues["distancefrom"]; + } + + if (parkValues["timefrom"] > maxValues["timefrom"]) { + maxValues["timefrom"] = parkValues["timefrom"]; + } + + parkAreas[pa] = parkValues; + } + } + } + } + + // minimum cost to get the parking area + double minParkingCost = 0.0; + + for (MSParkingAreaMap_t::iterator it = parkAreas.begin(); it != parkAreas.end(); ++it) { + // get the parking values + ParkingParamMap_t parkValues = it->second; + + // normalizing parking values with maximum values (we want to maximize some parameters then we reverse the value) + parkValues["probability"] = maxValues["probability"] > 0.0 ? 1.0 - parkValues["probability"] / maxValues["probability"] : 0.0; + parkValues["capacity"] = maxValues["capacity"] > 0.0 ? 1.0 - parkValues["capacity"] / maxValues["capacity"] : 0.0; + parkValues["absfreespace"] = maxValues["absfreespace"] > 0.0 ? 1.0 - parkValues["absfreespace"] / maxValues["absfreespace"] : 0.0; + parkValues["relfreespace"] = maxValues["relfreespace"] > 0.0 ? 1.0 - parkValues["relfreespace"] / maxValues["relfreespace"] : 0.0; + + parkValues["distanceto"] = maxValues["distanceto"] > 0.0 ? parkValues["distanceto"] / maxValues["distanceto"] : 0.0; + parkValues["timeto"] = maxValues["timeto"] > 0.0 ? parkValues["timeto"] / maxValues["timeto"] : 0.0; + + parkValues["distancefrom"] = maxValues["distancefrom"] > 0.0 ? parkValues["distancefrom"] / maxValues["distancefrom"] : 0.0; + parkValues["timefrom"] = maxValues["timefrom"] > 0.0 ? parkValues["timefrom"] / maxValues["timefrom"] : 0.0; + + // get the parking area cost + double parkingCost = 0.0; + + // sum every index with its weight + for (ParkingParamMap_t::iterator pc = parkValues.begin(); pc != parkValues.end(); ++pc) { + parkingCost += weights[pc->first] * pc->second; + } + + // get the parking area with minimum cost + if (nearParkArea == 0 || parkingCost < minParkingCost) { + minParkingCost = parkingCost; + nearParkArea = it->first; + } + } + } + + return nearParkArea; +} /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSTriggeredRerouter.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSTriggeredRerouter.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSTriggeredRerouter.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSTriggeredRerouter.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,13 +3,14 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @author Michael Behrisch +/// @author Mirco Sturari /// @date Mon, 25 July 2005 -/// @version $Id: MSTriggeredRerouter.h 21519 2016-09-23 06:46:37Z namdre $ +/// @version $Id: MSTriggeredRerouter.h 23341 2017-03-13 10:11:12Z behrisch $ /// // Reroutes vehicles passing an edge /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,7 +39,7 @@ #include #include "MSTrigger.h" #include -#include +#include // =========================================================================== @@ -80,7 +81,7 @@ */ MSTriggeredRerouter(const std::string& id, const MSEdgeVector& edges, - SUMOReal prob, const std::string& file, bool off); + double prob, const std::string& file, bool off); /** @brief Destructor */ @@ -92,6 +93,8 @@ * Describes the rerouting definitions valid for an interval */ struct RerouteInterval { + /// unique ID for this interval + long id; /// The begin time these definitions are valid SUMOTime begin; /// The end time these definitions are valid @@ -108,8 +111,8 @@ RandomDistributor routeProbs; /// The permissions to use SVCPermissions permissions; - /// unique ID for this interval - long id; + /// The distributions of new parking areas to use as destinations + RandomDistributor parkProbs; }; /** @brief Tries to reroute the vehicle @@ -126,7 +129,7 @@ * @see MSMoveReminder::notifyEnter * @see MSMoveReminder::Notification */ - bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason); + bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /// @name Methods called on vehicle movement / state change, overwriting MSDevice /// @{ @@ -139,7 +142,7 @@ * @param[in] newSpeed Moving speed. * @return True (always). */ - bool notifyMove(SUMOVehicle& veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed); + bool notifyMove(SUMOVehicle& veh, double oldPos, double newPos, double newSpeed); /** @brief Removes the reminder * @@ -149,7 +152,7 @@ * @param[in] isLaneChange whether the vehicle changed from the lane * @return false if the vehicle left th edge */ - bool notifyLeave(SUMOVehicle& veh, SUMOReal lastPos, MSMoveReminder::Notification reason); + bool notifyLeave(SUMOVehicle& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0); /// Returns the rerouting definition valid for the given time and vehicle, 0 if none const RerouteInterval* getCurrentReroute(SUMOTime time, SUMOVehicle& veh) const; @@ -164,16 +167,20 @@ void setUserMode(bool val); /// Sets the probability with which a vehicle is rerouted given by the user - void setUserUsageProbability(SUMOReal prob); + void setUserUsageProbability(double prob); /// Returns whether the user is setting the rerouting probability bool inUserMode() const; /// Returns the rerouting probability - SUMOReal getProbability() const; + double getProbability() const; /// Returns the rerouting probability given by the user - SUMOReal getUserProbability() const; + double getUserProbability() const; + + double getWeight(SUMOVehicle& veh, const std::string param, const double defaultWeight) const; + + MSParkingArea* rerouteParkingZone(const MSTriggeredRerouter::RerouteInterval* rerouteDef, SUMOVehicle& veh) const; protected: /// @name inherited from GenericSAXHandler @@ -204,7 +211,7 @@ std::vector myIntervals; /// The probability and the user-given probability - SUMOReal myProbability, myUserProbability; + double myProbability, myUserProbability; /// Information whether the current rerouting probability is the user-given bool myAmInUserMode; @@ -221,6 +228,8 @@ /// List of permissions for closed edges SVCPermissions myCurrentPermissions; /// new destinations with probabilities + RandomDistributor myCurrentParkProb; + /// new destinations with probabilities RandomDistributor myCurrentEdgeProb; /// new routes with probabilities RandomDistributor myCurrentRouteProb; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSTrigger.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSTrigger.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/microsim/trigger/MSTrigger.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/microsim/trigger/MSTrigger.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: MSTrigger.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSTrigger.h 22608 2017-01-17 06:28:54Z behrisch $ /// // An abstract device that changes the state of the micro simulation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ NBAlgorithms_Ramps.cpp NBAlgorithms_Ramps.h \ NBCapacity2Lanes.h NBConnection.cpp NBConnection.h \ NBConnectionDefs.h NBCont.h NBContHelper.cpp NBContHelper.h \ -NBDistribution.cpp NBDistribution.h NBDistrict.cpp NBDistrict.h \ +NBDistrict.cpp NBDistrict.h \ NBDistrictCont.cpp NBDistrictCont.h NBEdge.cpp NBEdge.h \ NBEdgeCont.cpp NBEdgeCont.h NBFrame.cpp NBFrame.h \ NBHeightMapper.cpp NBHeightMapper.h \ @@ -12,6 +12,8 @@ NBLinkPossibilityMatrix.h NBNode.cpp NBNode.h \ NBNodeCont.cpp NBNodeCont.h \ NBNodeShapeComputer.cpp NBNodeShapeComputer.h \ +NBPTStop.cpp NBPTStop.h \ +NBPTStopCont.cpp NBPTStopCont.h \ NBRequest.cpp NBRequest.h \ NBTrafficLightDefinition.cpp NBTrafficLightDefinition.h \ NBTrafficLightLogic.cpp NBTrafficLightLogic.h \ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -100,12 +100,13 @@ libnetbuild_a_LIBADD = am_libnetbuild_a_OBJECTS = NBAlgorithms.$(OBJEXT) \ NBAlgorithms_Ramps.$(OBJEXT) NBConnection.$(OBJEXT) \ - NBContHelper.$(OBJEXT) NBDistribution.$(OBJEXT) \ - NBDistrict.$(OBJEXT) NBDistrictCont.$(OBJEXT) NBEdge.$(OBJEXT) \ - NBEdgeCont.$(OBJEXT) NBFrame.$(OBJEXT) \ - NBHeightMapper.$(OBJEXT) NBHelpers.$(OBJEXT) NBNode.$(OBJEXT) \ - NBNodeCont.$(OBJEXT) NBNodeShapeComputer.$(OBJEXT) \ - NBRequest.$(OBJEXT) NBTrafficLightDefinition.$(OBJEXT) \ + NBContHelper.$(OBJEXT) NBDistrict.$(OBJEXT) \ + NBDistrictCont.$(OBJEXT) NBEdge.$(OBJEXT) NBEdgeCont.$(OBJEXT) \ + NBFrame.$(OBJEXT) NBHeightMapper.$(OBJEXT) NBHelpers.$(OBJEXT) \ + NBNode.$(OBJEXT) NBNodeCont.$(OBJEXT) \ + NBNodeShapeComputer.$(OBJEXT) NBPTStop.$(OBJEXT) \ + NBPTStopCont.$(OBJEXT) NBRequest.$(OBJEXT) \ + NBTrafficLightDefinition.$(OBJEXT) \ NBTrafficLightLogic.$(OBJEXT) \ NBTrafficLightLogicCont.$(OBJEXT) NBTypeCont.$(OBJEXT) \ NBSign.$(OBJEXT) NBOwnTLDef.$(OBJEXT) NBLoadedTLDef.$(OBJEXT) \ @@ -342,7 +343,7 @@ NBAlgorithms_Ramps.cpp NBAlgorithms_Ramps.h \ NBCapacity2Lanes.h NBConnection.cpp NBConnection.h \ NBConnectionDefs.h NBCont.h NBContHelper.cpp NBContHelper.h \ -NBDistribution.cpp NBDistribution.h NBDistrict.cpp NBDistrict.h \ +NBDistrict.cpp NBDistrict.h \ NBDistrictCont.cpp NBDistrictCont.h NBEdge.cpp NBEdge.h \ NBEdgeCont.cpp NBEdgeCont.h NBFrame.cpp NBFrame.h \ NBHeightMapper.cpp NBHeightMapper.h \ @@ -350,6 +351,8 @@ NBLinkPossibilityMatrix.h NBNode.cpp NBNode.h \ NBNodeCont.cpp NBNodeCont.h \ NBNodeShapeComputer.cpp NBNodeShapeComputer.h \ +NBPTStop.cpp NBPTStop.h \ +NBPTStopCont.cpp NBPTStopCont.h \ NBRequest.cpp NBRequest.h \ NBTrafficLightDefinition.cpp NBTrafficLightDefinition.h \ NBTrafficLightLogic.cpp NBTrafficLightLogic.h \ @@ -414,7 +417,6 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NBAlgorithms_Ramps.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NBConnection.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NBContHelper.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NBDistribution.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NBDistrict.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NBDistrictCont.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NBEdge.Po@am__quote@ @@ -429,6 +431,8 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NBNodeCont.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NBNodeShapeComputer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NBOwnTLDef.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NBPTStop.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NBPTStopCont.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NBRequest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NBSign.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NBTrafficLightDefinition.Po@am__quote@ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBAlgorithms.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBAlgorithms.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBAlgorithms.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBAlgorithms.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date 02. March 2012 -/// @version $Id: NBAlgorithms.cpp 21255 2016-07-28 08:31:26Z namdre $ +/// @version $Id: NBAlgorithms.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Algorithms for network computation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,10 +41,6 @@ #include "NBNode.h" #include "NBAlgorithms.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -73,13 +69,13 @@ for (std::vector::const_iterator k = incoming.begin(); k != incoming.end(); ++k) { NBEdge* e = *k; // @todo: check whether NBHelpers::relAngle is properly defined and whether it should really be used, here - const SUMOReal signedAngle = NBHelpers::normRelAngle(e->getAngleAtNode(node), outedge->getAngleAtNode(node)); + const double signedAngle = NBHelpers::normRelAngle(e->getAngleAtNode(node), outedge->getAngleAtNode(node)); if (signedAngle > 0 && signedAngle < 177 && e->getGeometry().back().distanceTo2D(outedge->getGeometry().front()) < POSITION_EPS) { // backwards curving edges can only be turnaround when there are // non-default endpoints continue; } - SUMOReal angle = fabs(signedAngle); + double angle = fabs(signedAngle); // std::cout << "incoming=" << e->getID() << " outgoing=" << outedge->getID() << " relAngle=" << NBHelpers::relAngle(e->getAngleAtNode(node), outedge->getAngleAtNode(node)) << "\n"; if (e->getFromNode() == outedge->getToNode() && angle > 120) { // they connect the same nodes; should be the turnaround direction @@ -133,73 +129,7 @@ void NBNodesEdgesSorter::sortNodesEdges(NBNodeCont& nc, bool useNodeShape) { for (std::map::const_iterator i = nc.begin(); i != nc.end(); ++i) { - NBNode* const n = i->second; - if (n->myAllEdges.size() == 0) { - continue; - } - EdgeVector& allEdges = n->myAllEdges; - EdgeVector& incoming = n->myIncomingEdges; - EdgeVector& outgoing = n->myOutgoingEdges; - std::vector& crossings = n->myCrossings; - if (!useNodeShape || n->getShape().area() < 1) { - // if the area is too small (i.e. for simple-continuation nodes) we better not use it - // sort by the angle of the adjoining line segment of the edge geometry - // sort the edges - std::sort(allEdges.begin(), allEdges.end(), edge_by_junction_angle_sorter(n)); - std::sort(incoming.begin(), incoming.end(), edge_by_junction_angle_sorter(n)); - std::sort(outgoing.begin(), outgoing.end(), edge_by_junction_angle_sorter(n)); - std::vector::iterator j; - for (j = allEdges.begin(); j != allEdges.end() - 1 && j != allEdges.end(); ++j) { - swapWhenReversed(n, j, j + 1); - } - if (allEdges.size() > 1 && j != allEdges.end()) { - swapWhenReversed(n, allEdges.end() - 1, allEdges.begin()); - } - } else { - NBEdge* firstOfAll = allEdges.front(); - NBEdge* firstOfIncoming = incoming.size() > 0 ? incoming.front() : 0; - NBEdge* firstOfOutgoing = outgoing.size() > 0 ? outgoing.front() : 0; - // sort by the angle between the node shape center and the point where the edge meets the node shape - sort(allEdges.begin(), allEdges.end(), NBContHelper::edge_by_angle_to_nodeShapeCentroid_sorter(n)); - sort(incoming.begin(), incoming.end(), NBContHelper::edge_by_angle_to_nodeShapeCentroid_sorter(n)); - sort(outgoing.begin(), outgoing.end(), NBContHelper::edge_by_angle_to_nodeShapeCentroid_sorter(n)); - // let the first edge remain the first - rotate(allEdges.begin(), std::find(allEdges.begin(), allEdges.end(), firstOfAll), allEdges.end()); - if (firstOfIncoming != 0) { - rotate(incoming.begin(), std::find(incoming.begin(), incoming.end(), firstOfIncoming), incoming.end()); - } - if (firstOfOutgoing != 0) { - rotate(outgoing.begin(), std::find(outgoing.begin(), outgoing.end(), firstOfOutgoing), outgoing.end()); - } - } - // fixing some pathological all edges orderings - // if every of the edges a,b,c has a turning edge a',b',c' the all edges ordering should be a,a',b,b',c,c' - if (incoming.size() == outgoing.size() && incoming.front() == allEdges.front()) { - std::vector::const_iterator in, out; - std::vector allTmp; - for (in = incoming.begin(), out = outgoing.begin(); in != incoming.end(); ++in, ++out) { - if ((*in)->isTurningDirectionAt(*out)) { - allTmp.push_back(*in); - allTmp.push_back(*out); - } else { - break; - } - } - if (allTmp.size() == allEdges.size()) { - allEdges = allTmp; - } - } - // sort the crossings - std::sort(crossings.begin(), crossings.end(), crossing_by_junction_angle_sorter(n, allEdges)); - // DEBUG - //if (n->getID() == "cluster_492462300_671564296") { - // if (crossings.size() > 0) { - // std::cout << " crossings at " << n->getID() << "\n"; - // for (std::vector::iterator it = crossings.begin(); it != crossings.end(); ++it) { - // std::cout << " " << toString((*it).edges) << "\n"; - // } - // } - //} + i->second->sortEdges(useNodeShape); } } @@ -228,7 +158,7 @@ for (std::map::const_iterator i = nc.begin(); i != nc.end(); ++i) { NBNode* n = (*i).second; // the type may already be set from the data - if (n->myType != NODETYPE_UNKNOWN) { + if (n->myType != NODETYPE_UNKNOWN && n->myType != NODETYPE_DEAD_END) { continue; } // check whether the node is a waterway node. Set to unregulated by default @@ -239,7 +169,7 @@ break; } } - if (waterway && n->myType == NODETYPE_UNKNOWN) { + if (waterway && (n->myType == NODETYPE_UNKNOWN || n->myType == NODETYPE_DEAD_END)) { n->myType = NODETYPE_NOJUNCTION; continue; } @@ -264,11 +194,11 @@ } // @todo check against a legal document // @todo figure out when NODETYPE_PRIORITY_STOP is appropriate - const SUMOReal s1 = (*i)->getSpeed() * (SUMOReal) 3.6; - const SUMOReal s2 = (*j)->getSpeed() * (SUMOReal) 3.6; + const double s1 = (*i)->getSpeed() * (double) 3.6; + const double s2 = (*j)->getSpeed() * (double) 3.6; const int p1 = (*i)->getPriority(); const int p2 = (*j)->getPriority(); - if (fabs(s1 - s2) > (SUMOReal) 9.5 || MAX2(s1, s2) >= (SUMOReal) 49. || p1 != p2) { + if (fabs(s1 - s2) > (double) 9.5 || MAX2(s1, s2) >= (double) 49. || p1 != p2) { type = NODETYPE_PRIORITY; break; } @@ -280,6 +210,55 @@ } +void +NBNodeTypeComputer::computeSingleNodeType(NBNode* node) { + // the type may already be set from the data + if (node->myType != NODETYPE_UNKNOWN && node->myType != NODETYPE_DEAD_END) { + } + // check whether the node is a waterway node. Set to unregulated by default + bool waterway = true; + for (EdgeVector::const_iterator i = node->getEdges().begin(); i != node->getEdges().end(); ++i) { + if (!isWaterway((*i)->getPermissions())) { + waterway = false; + break; + } + } + if (waterway && (node->myType == NODETYPE_UNKNOWN || node->myType == NODETYPE_DEAD_END)) { + node->myType = NODETYPE_NOJUNCTION; + } + + // check whether the junction is not a real junction + if (node->myIncomingEdges.size() == 1) { + node->myType = NODETYPE_PRIORITY; + } + // @todo "isSimpleContinuation" should be revalidated + if (node->isSimpleContinuation()) { + node->myType = NODETYPE_PRIORITY; + } + // determine the type + SumoXMLNodeType type = NODETYPE_RIGHT_BEFORE_LEFT; + for (EdgeVector::const_iterator i = node->myIncomingEdges.begin(); i != node->myIncomingEdges.end(); i++) { + for (EdgeVector::const_iterator j = i + 1; j != node->myIncomingEdges.end(); j++) { + // @todo "getOppositeIncoming" should probably be refactored into something the edge knows + if (node->getOppositeIncoming(*j) == *i && node->myIncomingEdges.size() > 2) { + continue; + } + // @todo check against a legal document + // @todo figure out when NODETYPE_PRIORITY_STOP is appropriate + const double s1 = (*i)->getSpeed() * (double) 3.6; + const double s2 = (*j)->getSpeed() * (double) 3.6; + const int p1 = (*i)->getPriority(); + const int p2 = (*j)->getPriority(); + if (fabs(s1 - s2) > (double) 9.5 || MAX2(s1, s2) >= (double) 49. || p1 != p2) { + type = NODETYPE_PRIORITY; + break; + } + } + } + // save type + node->myType = type; +} + // --------------------------------------------------------------------------- // NBEdgePriorityComputer // --------------------------------------------------------------------------- @@ -304,6 +283,22 @@ void +NBEdgePriorityComputer::computeEdgePrioritiesSingleNode(NBNode* node) { + // preset all junction's edge priorities to zero + for (EdgeVector::iterator j = node->myAllEdges.begin(); j != node->myAllEdges.end(); ++j) { + (*j)->setJunctionPriority(node, NBEdge::MINOR_ROAD); + } + // check if the junction is not a real junction + if (node->myIncomingEdges.size() == 1 && node->myOutgoingEdges.size() == 1) { + } + // compute the priorities on junction when needed + if (node->getType() != NODETYPE_RIGHT_BEFORE_LEFT) { + setPriorityJunctionPriorities(*node); + } +} + + +void NBEdgePriorityComputer::setPriorityJunctionPriorities(NBNode& n) { if (n.myIncomingEdges.size() == 0 || n.myOutgoingEdges.size() == 0) { return; @@ -382,24 +377,24 @@ // has the best continuation... // This means, when several incoming roads have the same priority, // we want a (any) straight connection to be more priorised than a turning - SUMOReal bestAngle = 0; + double bestAngle = 0; NBEdge* bestFirst = 0; NBEdge* bestSecond = 0; bool hadBest = false; for (i = bestIncoming.begin(); i != bestIncoming.end(); ++i) { EdgeVector::iterator j; NBEdge* t1 = *i; - SUMOReal angle1 = t1->getAngleAtNode(&n) + 180; + double angle1 = t1->getAngleAtNode(&n) + 180; if (angle1 >= 360) { angle1 -= 360; } for (j = i + 1; j != bestIncoming.end(); ++j) { NBEdge* t2 = *j; - SUMOReal angle2 = t2->getAngleAtNode(&n) + 180; + double angle2 = t2->getAngleAtNode(&n) + 180; if (angle2 >= 360) { angle2 -= 360; } - SUMOReal angle = GeomHelper::getMinAngleDiff(angle1, angle2); + double angle = GeomHelper::getMinAngleDiff(angle1, angle2); if (!hadBest || angle > bestAngle) { bestAngle = angle; bestFirst = *i; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBAlgorithms.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBAlgorithms.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBAlgorithms.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBAlgorithms.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date 02. March 2012 -/// @version $Id: NBAlgorithms.h 21201 2016-07-19 11:57:22Z behrisch $ +/// @version $Id: NBAlgorithms.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Algorithms for network computation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,14 +32,14 @@ #endif #include - +#include "NBEdgeCont.h" +#include "NBNodeCont.h" // =========================================================================== // class declarations // =========================================================================== class NBEdge; -class NBNodeCont; -class NBTypeCont; +class NBNode; // =========================================================================== // class definitions @@ -75,7 +75,7 @@ struct Combination { NBEdge* from; NBEdge* to; - SUMOReal angle; + double angle; }; @@ -144,7 +144,6 @@ crossing_by_junction_angle_sorter& operator=(const crossing_by_junction_angle_sorter& s); }; -private: /** @brief Assures correct order for same-angle opposite-direction edges * @param[in] n The currently processed node * @param[in] i1 Pointer to first edge @@ -167,22 +166,22 @@ protected: /// @brief Converts the angle of the edge if it is an incoming edge - SUMOReal getConvAngle(NBEdge* e) const { - SUMOReal angle = e->getAngleAtNode(myNode); + double getConvAngle(NBEdge* e) const { + double angle = e->getAngleAtNode(myNode); if (angle < 0.) { angle = 360. + angle; } // convert angle if the edge is an outgoing edge if (e->getFromNode() == myNode) { - angle += (SUMOReal) 180.; - if (angle >= (SUMOReal) 360.) { - angle -= (SUMOReal) 360.; + angle += (double) 180.; + if (angle >= (double) 360.) { + angle -= (double) 360.; } } if (angle < 0.1 || angle > 359.9) { - angle = (SUMOReal) 0.; + angle = (double) 0.; } - assert(angle >= (SUMOReal)0 && angle < (SUMOReal)360); + assert(angle >= 0 && angle < (double)360); return angle; } @@ -209,6 +208,10 @@ */ static void computeNodeTypes(NBNodeCont& nc); + /** @brief Computes a single node type + * @param[in] node the single node to compute node type + */ + static void computeSingleNodeType(NBNode* node); }; @@ -226,6 +229,11 @@ */ static void computeEdgePriorities(NBNodeCont& nc); + /** @brief Computes edge priorities within a single node + * @param[in] node the single node + */ + static void computeEdgePrioritiesSingleNode(NBNode* node); + private: /** @brief Sets the priorites in case of a priority junction * @param[in] n The node to set edges' priorities diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBAlgorithms_Ramps.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBAlgorithms_Ramps.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBAlgorithms_Ramps.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBAlgorithms_Ramps.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 29. March 2012 -/// @version $Id: NBAlgorithms_Ramps.cpp 21179 2016-07-16 10:00:39Z namdre $ +/// @version $Id: NBAlgorithms_Ramps.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Algorithms for highway on-/off-ramps computation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,10 +40,6 @@ #include "NBEdge.h" #include "NBAlgorithms_Ramps.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members @@ -58,9 +54,9 @@ // --------------------------------------------------------------------------- void NBRampsComputer::computeRamps(NBNetBuilder& nb, OptionsCont& oc) { - SUMOReal minHighwaySpeed = oc.getFloat("ramps.min-highway-speed"); - SUMOReal maxRampSpeed = oc.getFloat("ramps.max-ramp-speed"); - SUMOReal rampLength = oc.getFloat("ramps.ramp-length"); + double minHighwaySpeed = oc.getFloat("ramps.min-highway-speed"); + double maxRampSpeed = oc.getFloat("ramps.max-ramp-speed"); + double rampLength = oc.getFloat("ramps.ramp-length"); bool dontSplit = oc.getBool("ramps.no-split"); std::set incremented; // check whether on-off ramps shall be guessed @@ -133,7 +129,7 @@ bool -NBRampsComputer::mayNeedOnRamp(NBNode* cur, SUMOReal minHighwaySpeed, SUMOReal maxRampSpeed, const std::set& noramps) { +NBRampsComputer::mayNeedOnRamp(NBNode* cur, double minHighwaySpeed, double maxRampSpeed, const std::set& noramps) { if (cur->getOutgoingEdges().size() != 1 || cur->getIncomingEdges().size() != 2) { return false; } @@ -145,7 +141,7 @@ bool -NBRampsComputer::mayNeedOffRamp(NBNode* cur, SUMOReal minHighwaySpeed, SUMOReal maxRampSpeed, const std::set& noramps) { +NBRampsComputer::mayNeedOffRamp(NBNode* cur, double minHighwaySpeed, double maxRampSpeed, const std::set& noramps) { if (cur->getIncomingEdges().size() != 1 || cur->getOutgoingEdges().size() != 2) { return false; } @@ -157,7 +153,7 @@ void -NBRampsComputer::buildOnRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDistrictCont& dc, SUMOReal rampLength, bool dontSplit) { +NBRampsComputer::buildOnRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDistrictCont& dc, double rampLength, bool dontSplit) { NBEdge* potHighway, *potRamp, *cont; getOnRampEdges(cur, &potHighway, &potRamp, &cont); // compute the number of lanes to append @@ -168,7 +164,7 @@ NBEdge* curr = cont; std::set incremented; if (toAdd > 0 && find(incremented.begin(), incremented.end(), cont) == incremented.end()) { - SUMOReal currLength = 0; + double currLength = 0; while (curr != 0 && currLength + curr->getGeometry().length() - POSITION_EPS < rampLength) { if (find(incremented.begin(), incremented.end(), curr) == incremented.end()) { curr->incLaneNo(toAdd); @@ -179,6 +175,10 @@ moveRampRight(curr, toAdd); currLength += curr->getGeometry().length(); // !!! loaded length? last = curr; + // mark acceleration lanes + for (int i = 0; i < curr->getNumLanes() - potHighway->getNumLanes(); ++i) { + curr->setAcceleration(i, true); + } } NBNode* nextN = curr->getToNode(); if (nextN->getOutgoingEdges().size() == 1) { @@ -220,11 +220,20 @@ if (wasFirst) { first = curr; } + // mark acceleration lanes + for (int i = 0; i < curr->getNumLanes() - potHighway->getNumLanes(); ++i) { + curr->setAcceleration(i, true); + } } if (curr == cont && dontSplit) { WRITE_WARNING("Could not build on-ramp for edge '" + curr->getID() + "' due to option '--ramps.no-split'"); return; } + } else { + // mark acceleration lanes + for (int i = 0; i < firstLaneNumber - potHighway->getNumLanes(); ++i) { + cont->setAcceleration(i, true); + } } // set connections from ramp/highway to added ramp if (potHighway->getStep() < NBEdge::LANES2LANES_USER) { @@ -242,11 +251,12 @@ p.pop_back(); p.push_back(first->getLaneShape(0)[0]); potRamp->setGeometry(p); + } void -NBRampsComputer::buildOffRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDistrictCont& dc, SUMOReal rampLength, bool dontSplit) { +NBRampsComputer::buildOffRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDistrictCont& dc, double rampLength, bool dontSplit) { NBEdge* potHighway, *potRamp, *prev; getOffRampEdges(cur, &potHighway, &potRamp, &prev); // compute the number of lanes to append @@ -257,7 +267,7 @@ NBEdge* curr = prev; std::set incremented; if (toAdd > 0 && find(incremented.begin(), incremented.end(), prev) == incremented.end()) { - SUMOReal currLength = 0; + double currLength = 0; while (curr != 0 && currLength + curr->getGeometry().length() - POSITION_EPS < rampLength) { if (find(incremented.begin(), incremented.end(), curr) == incremented.end()) { curr->incLaneNo(toAdd); @@ -342,8 +352,8 @@ } try { PositionVector g = ramp->getGeometry(); - const SUMOReal offset = (0.5 * addedLanes * - (ramp->getLaneWidth() == NBEdge::UNSPECIFIED_WIDTH ? SUMO_const_laneWidth : ramp->getLaneWidth())); + const double offset = (0.5 * addedLanes * + (ramp->getLaneWidth() == NBEdge::UNSPECIFIED_WIDTH ? SUMO_const_laneWidth : ramp->getLaneWidth())); g.move2side(offset); ramp->setGeometry(g); } catch (InvalidArgument&) { @@ -394,10 +404,7 @@ } */ // heuristic: ramp comes from right - const std::vector& edges2 = n->getEdges(); - std::vector::const_iterator i = std::find(edges2.begin(), edges2.end(), *other); - NBContHelper::nextCW(edges2, i); - if ((*i) == *potHighway) { + if (NBContHelper::relative_incoming_edge_sorter(*other)(*potRamp, *potHighway)) { std::swap(*potHighway, *potRamp); } } @@ -427,12 +434,18 @@ if ((*i) == *potRamp) { std::swap(*potHighway, *potRamp); } + // the following would be better but runs afoul of misleading angles when both edges + // have the same geometry start point but different references lanes are + // chosen for NBEdge::computeAngle() + //if (NBContHelper::relative_outgoing_edge_sorter(*other)(*potHighway, *potRamp)) { + // std::swap(*potHighway, *potRamp); + //} } bool NBRampsComputer::fulfillsRampConstraints( - NBEdge* potHighway, NBEdge* potRamp, NBEdge* other, SUMOReal minHighwaySpeed, SUMOReal maxRampSpeed, + NBEdge* potHighway, NBEdge* potRamp, NBEdge* other, double minHighwaySpeed, double maxRampSpeed, const std::set& noramps) { // check modes that are not appropriate for rampsdo not build ramps on rail edges if (hasWrongMode(potHighway) || hasWrongMode(potRamp) || hasWrongMode(other)) { @@ -443,11 +456,11 @@ return false; } // check whether a lane is missing - if (potHighway->getNumLanes() + potRamp->getNumLanes() <= other->getNumLanes()) { + if (potHighway->getNumLanes() + potRamp->getNumLanes() < other->getNumLanes()) { return false; } // is it really a highway? - SUMOReal maxSpeed = MAX3(potHighway->getSpeed(), other->getSpeed(), potRamp->getSpeed()); + double maxSpeed = MAX3(potHighway->getSpeed(), other->getSpeed(), potRamp->getSpeed()); if (maxSpeed < minHighwaySpeed) { return false; } @@ -465,6 +478,16 @@ return false; } } + // are the angles between highway and other / ramp and other more or less straight? + const NBNode* node = potHighway->getToNode() == potRamp->getToNode() ? potHighway->getToNode() : potHighway->getFromNode(); + double angle = fabs(NBHelpers::relAngle(potHighway->getAngleAtNode(node), other->getAngleAtNode(node))); + if (angle >= 60) { + return false; + } + angle = fabs(NBHelpers::relAngle(potRamp->getAngleAtNode(node), other->getAngleAtNode(node))); + if (angle >= 60) { + return false; + } /* if (potHighway->getSpeed() < minHighwaySpeed || other->getSpeed() < minHighwaySpeed) { return false; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBAlgorithms_Ramps.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBAlgorithms_Ramps.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBAlgorithms_Ramps.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBAlgorithms_Ramps.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date 29. March 2012 -/// @version $Id: NBAlgorithms_Ramps.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NBAlgorithms_Ramps.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Algorithms for highway on-/off-ramps computation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -72,7 +72,7 @@ * @param[in] noramps Edges that shall not be treated as ramps * @return Whether the node is assumed to be an on-ramp begin */ - static bool mayNeedOnRamp(NBNode* cur, SUMOReal minHighwaySpeed, SUMOReal maxRampSpeed, + static bool mayNeedOnRamp(NBNode* cur, double minHighwaySpeed, double maxRampSpeed, const std::set& noramps); @@ -83,7 +83,7 @@ * @param[in] noramps Edges that shall not be treated as ramps * @return Whether the node is assumed to be an off-ramp end */ - static bool mayNeedOffRamp(NBNode* cur, SUMOReal minHighwaySpeed, SUMOReal maxRampSpeed, + static bool mayNeedOffRamp(NBNode* cur, double minHighwaySpeed, double maxRampSpeed, const std::set& noramps); @@ -96,7 +96,7 @@ * @param[in] dontSplit Whether no edges shall be split * @param[in, filled] incremented The list of edges which lane number was already incremented */ - static void buildOnRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDistrictCont& dc, SUMOReal rampLength, bool dontSplit); + static void buildOnRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDistrictCont& dc, double rampLength, bool dontSplit); /** @brief Builds an off-ramp ending at the given node @@ -108,7 +108,7 @@ * @param[in] dontSplit Whether no edges shall be split * @param[in, filled] incremented The list of edges which lane number was already incremented */ - static void buildOffRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDistrictCont& dc, SUMOReal rampLength, bool dontSplit); + static void buildOffRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDistrictCont& dc, double rampLength, bool dontSplit); static void getOnRampEdges(NBNode* n, NBEdge** potHighway, NBEdge** potRamp, NBEdge** other); @@ -129,7 +129,7 @@ * @param[in] noramps Edges that shall not be treated as ramps * @return Whether a ramp can be built here */ - static bool fulfillsRampConstraints(NBEdge* potHighway, NBEdge* potRamp, NBEdge* other, SUMOReal minHighwaySpeed, SUMOReal maxRampSpeed, + static bool fulfillsRampConstraints(NBEdge* potHighway, NBEdge* potRamp, NBEdge* other, double minHighwaySpeed, double maxRampSpeed, const std::set& noramps); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBCapacity2Lanes.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBCapacity2Lanes.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBCapacity2Lanes.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBCapacity2Lanes.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Sascha Krieg /// @date Fri, 19 Jul 2002 -/// @version $Id: NBCapacity2Lanes.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NBCapacity2Lanes.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A helper class which computes the lane number from given capacity /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -50,7 +50,7 @@ * * @param[in] divider Value for the norming divider */ - NBCapacity2Lanes(SUMOReal divider) : myDivider(divider) { } + NBCapacity2Lanes(double divider) : myDivider(divider) { } /// @brief Destructor @@ -65,7 +65,7 @@ * @param[in] capacity The capacity to convert * @return The capacity converted to the number of lanes */ - int get(SUMOReal capacity) const { + int get(double capacity) const { capacity /= myDivider; if (capacity > (int) capacity) { capacity += 1; @@ -79,7 +79,7 @@ private: /// @brief The norming divider - SUMOReal myDivider; + double myDivider; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBConnection.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBConnection.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBConnection.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBConnection.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NBConnection.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NBConnection.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The class holds a description of a connection between two edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include "NBEdge.h" #include "NBConnection.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members @@ -130,7 +126,9 @@ } else { myFromID = "invalidFrom"; } - myFromLane = byLane; + if (byLane >= 0) { + myFromLane = byLane; + } return true; } return false; @@ -162,7 +160,9 @@ } else { myToID = "invalidTo"; } - myToLane = byLane; + if (byLane >= 0) { + myToLane = byLane; + } return true; } return false; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBConnectionDefs.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBConnectionDefs.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBConnectionDefs.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBConnectionDefs.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NBConnectionDefs.h /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NBConnectionDefs.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NBConnectionDefs.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Some container for connections /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBConnection.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBConnection.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBConnection.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBConnection.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @brief @author Jakob Erdmann /// @brief @author Sascha Krieg /// @brief @date Sept 2002 -/// @brief @version $Id: NBConnection.h 21756 2016-10-23 09:15:22Z palcraft $ +/// @brief @version $Id: NBConnection.h 22608 2017-01-17 06:28:54Z behrisch $ /// // The class holds a description of a connection between two edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBCont.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBCont.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBCont.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBCont.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Sascha Krieg /// @date Mon, 17 Dec 2001 -/// @version $Id: NBCont.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NBCont.h 22929 2017-02-13 14:38:39Z behrisch $ /// -// Some list definitions +// Some typedef definitions fir containers /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,15 +44,13 @@ // =========================================================================== // container definitions // =========================================================================== -/** container for (sorted) edges */ +/// @brief container for (sorted) edges typedef std::vector EdgeVector; -/** container for unique edges */ +/// @brief container for unique edges typedef std::set EdgeSet; - -/** container for (sorted) lanes. - The lanes are sorted from rightmost (id=0) to leftmost (id=nolanes-1) */ +/// @brief container for (sorted) lanes. The lanes are sorted from rightmost (id=0) to leftmost (id=nolanes-1) typedef std::vector LaneVector; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBContHelper.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBContHelper.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBContHelper.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBContHelper.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: NBContHelper.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NBContHelper.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Some methods for traversing lists of edges /****************************************************************************/ @@ -36,10 +36,6 @@ #include "NBContHelper.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -88,10 +84,10 @@ -SUMOReal +double NBContHelper::maxSpeed(const EdgeVector& ev) { assert(ev.size() > 0); - SUMOReal max = (*(ev.begin()))->getSpeed(); + double max = (*(ev.begin()))->getSpeed(); for (EdgeVector::const_iterator i = ev.begin() + 1; i != ev.end(); i++) { max = max > (*i)->getSpeed() @@ -152,12 +148,12 @@ if (e1 == 0 || e2 == 0) { return -1; } - SUMOReal relAngle1 = NBHelpers::normRelAngle( - myEdge->getEndAngle(), e1->getStartAngle()); - SUMOReal relAngle2 = NBHelpers::normRelAngle( - myEdge->getEndAngle(), e2->getStartAngle()); + double relAngle1 = NBHelpers::normRelAngle( + myEdge->getEndAngle(), e1->getStartAngle()); + double relAngle2 = NBHelpers::normRelAngle( + myEdge->getEndAngle(), e2->getStartAngle()); - SUMOReal lookAhead = 2 * NBEdge::ANGLE_LOOKAHEAD; + double lookAhead = 2 * NBEdge::ANGLE_LOOKAHEAD; while (fabs(relAngle1 - relAngle2) < 3.0) { // look at further geometry segments to resolve ambiguity const Position referencePos1 = e1->getGeometry().positionAtOffset2D(lookAhead); @@ -183,21 +179,21 @@ if (e1 == 0 || e2 == 0) { return -1; } - SUMOReal relAngle1 = NBHelpers::normRelAngle( - myReferenceAngle, myRefIncoming ? e1->getShapeStartAngle() : e1->getShapeEndAngle()); - SUMOReal relAngle2 = NBHelpers::normRelAngle( - myReferenceAngle, myRefIncoming ? e2->getShapeStartAngle() : e2->getShapeEndAngle()); + double relAngle1 = NBHelpers::normRelAngle( + myReferenceAngle, myRefIncoming ? e1->getShapeStartAngle() : e1->getShapeEndAngle()); + double relAngle2 = NBHelpers::normRelAngle( + myReferenceAngle, myRefIncoming ? e2->getShapeStartAngle() : e2->getShapeEndAngle()); const int geomIndex = myRefIncoming ? 0 : -1; //std::cout << " e1=" << e1->getID() << " e2=" << e2->getID() << " refA=" << myReferenceAngle << " initially a1=" << relAngle1 << " a2=" << relAngle2 << "\n"; - const SUMOReal e1Length = e1->getGeometry().length2D(); - const SUMOReal e2Length = e2->getGeometry().length2D(); - const SUMOReal maxLookAhead = MAX2(e1Length, e2Length); - SUMOReal lookAhead = MIN2(maxLookAhead, 2 * NBEdge::ANGLE_LOOKAHEAD); + const double e1Length = e1->getGeometry().length2D(); + const double e2Length = e2->getGeometry().length2D(); + const double maxLookAhead = MAX2(e1Length, e2Length); + double lookAhead = MIN2(maxLookAhead, 2 * NBEdge::ANGLE_LOOKAHEAD); while (fabs(relAngle1 - relAngle2) < 3.0) { // look at further geometry segments to resolve ambiguity - const SUMOReal offset1 = myRefIncoming ? lookAhead : e1Length - lookAhead; - const SUMOReal offset2 = myRefIncoming ? lookAhead : e2Length - lookAhead; + const double offset1 = myRefIncoming ? lookAhead : e1Length - lookAhead; + const double offset2 = myRefIncoming ? lookAhead : e2Length - lookAhead; const Position referencePos1 = e1->getGeometry().positionAtOffset2D(offset1); const Position referencePos2 = e2->getGeometry().positionAtOffset2D(offset2); @@ -234,12 +230,12 @@ if (e1 == 0 || e2 == 0) { return -1; } - SUMOReal relAngle1 = NBHelpers::normRelAngle( - myEdge->getStartAngle(), e1->getEndAngle()); - SUMOReal relAngle2 = NBHelpers::normRelAngle( - myEdge->getStartAngle(), e2->getEndAngle()); + double relAngle1 = NBHelpers::normRelAngle( + myEdge->getStartAngle(), e1->getEndAngle()); + double relAngle2 = NBHelpers::normRelAngle( + myEdge->getStartAngle(), e2->getEndAngle()); - SUMOReal lookAhead = 2 * NBEdge::ANGLE_LOOKAHEAD; + double lookAhead = 2 * NBEdge::ANGLE_LOOKAHEAD; while (fabs(relAngle1 - relAngle2) < 3.0) { // look at further geometry segments to resolve ambiguity const Position referencePos1 = e1->getGeometry().positionAtOffset2D(e1->getGeometry().length() - lookAhead); @@ -271,12 +267,12 @@ -SUMOReal +double NBContHelper::getMaxSpeed(const EdgeVector& edges) { if (edges.size() == 0) { return -1; } - SUMOReal ret = (*(edges.begin()))->getSpeed(); + double ret = (*(edges.begin()))->getSpeed(); for (EdgeVector::const_iterator i = edges.begin() + 1; i != edges.end(); i++) { if ((*i)->getSpeed() > ret) { ret = (*i)->getSpeed(); @@ -286,12 +282,12 @@ } -SUMOReal +double NBContHelper::getMinSpeed(const EdgeVector& edges) { if (edges.size() == 0) { return -1; } - SUMOReal ret = (*(edges.begin()))->getSpeed(); + double ret = (*(edges.begin()))->getSpeed(); for (EdgeVector::const_iterator i = edges.begin() + 1; i != edges.end(); i++) { if ((*i)->getSpeed() < ret) { ret = (*i)->getSpeed(); @@ -305,9 +301,9 @@ NBContHelper::edge_by_angle_to_nodeShapeCentroid_sorter::operator()(const NBEdge* e1, const NBEdge* e2) const { assert(e1->getFromNode() == myNode || e1->getToNode() == myNode); assert(e2->getFromNode() == myNode || e2->getToNode() == myNode); - const SUMOReal angle1 = e1->getAngleAtNodeToCenter(myNode); - const SUMOReal angle2 = e2->getAngleAtNodeToCenter(myNode); - const SUMOReal absDiff = fabs(angle1 - angle2); + const double angle1 = e1->getAngleAtNodeToCenter(myNode); + const double angle2 = e2->getAngleAtNodeToCenter(myNode); + const double absDiff = fabs(angle1 - angle2); // cannot trust the angle difference hence a heuristic: if (absDiff < 2 || absDiff > (360 - 2)) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBContHelper.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBContHelper.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBContHelper.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBContHelper.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 17 Dec 2001 -/// @version $Id: NBContHelper.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NBContHelper.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Some methods for traversing lists of edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -65,9 +65,9 @@ static void nextCCW(const EdgeVector& edges, EdgeVector::const_iterator& from); - static SUMOReal getMaxSpeed(const EdgeVector& edges); + static double getMaxSpeed(const EdgeVector& edges); - static SUMOReal getMinSpeed(const EdgeVector& edges); + static double getMinSpeed(const EdgeVector& edges); /** writes the vector of bools to the given stream */ static std::ostream& out(std::ostream& os, const std::vector& v); @@ -122,7 +122,7 @@ private: bool myRefIncoming; Position myReferencePos; - SUMOReal myReferenceAngle; + double myReferenceAngle; }; @@ -200,7 +200,7 @@ * @param[in] e The edge to compare the angle difference of * @return The angle difference */ - SUMOReal getDiff(const NBEdge* const e) const { + double getDiff(const NBEdge* const e) const { return fabs(GeomHelper::angleDiff(getEdgeAngleAt(e, myNode), myAngle)); } @@ -210,7 +210,7 @@ * @param[in] e The edge to which the sorting relates * @param[in] n The node to consider */ - SUMOReal getEdgeAngleAt(const NBEdge* const e, const NBNode* const n) const { + double getEdgeAngleAt(const NBEdge* const e, const NBNode* const n) const { if (e->getFromNode() == n) { return e->getGeometry().angleAt2D(0); } else { @@ -220,7 +220,7 @@ private: /// @brief The angle of the related edge at the given node - SUMOReal myAngle; + double myAngle; /// @brief The related node const NBNode* const myNode; @@ -247,14 +247,14 @@ /// comparing operation int operator()(NBEdge* e1, NBEdge* e2) const { - SUMOReal d1 = GeomHelper::getMinAngleDiff(e1->getTotalAngle(), myAngle); - SUMOReal d2 = GeomHelper::getMinAngleDiff(e2->getTotalAngle(), myAngle); + double d1 = GeomHelper::getMinAngleDiff(e1->getTotalAngle(), myAngle); + double d2 = GeomHelper::getMinAngleDiff(e2->getTotalAngle(), myAngle); return d1 < d2; } private: /// the angle to find the edge with the opposite direction - SUMOReal myAngle; + double myAngle; }; @@ -324,7 +324,7 @@ /** returns the maximum speed allowed on the edges */ - static SUMOReal maxSpeed(const EdgeVector& ev); + static double maxSpeed(const EdgeVector& ev); /** * same_connection_edge_sorter @@ -339,8 +339,8 @@ /// comparing operation int operator()(NBEdge* e1, NBEdge* e2) const { - std::pair mm1 = getMinMaxRelAngles(e1); - std::pair mm2 = getMinMaxRelAngles(e2); + std::pair mm1 = getMinMaxRelAngles(e1); + std::pair mm2 = getMinMaxRelAngles(e2); if (mm1.first == mm2.first && mm1.second == mm2.second) { // ok, let's simply sort them arbitrarily return e1->getID() < e2->getID(); @@ -356,13 +356,13 @@ /** * */ - std::pair getMinMaxRelAngles(NBEdge* e) const { - SUMOReal min = 360; - SUMOReal max = 360; + std::pair getMinMaxRelAngles(NBEdge* e) const { + double min = 360; + double max = 360; const EdgeVector& ev = e->getConnectedEdges(); for (EdgeVector::const_iterator i = ev.begin(); i != ev.end(); ++i) { - SUMOReal angle = NBHelpers::normRelAngle( - e->getTotalAngle(), (*i)->getTotalAngle()); + double angle = NBHelpers::normRelAngle( + e->getTotalAngle(), (*i)->getTotalAngle()); if (min == 360 || min > angle) { min = angle; } @@ -370,7 +370,7 @@ max = angle; } } - return std::pair(min, max); + return std::pair(min, max); } }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBDistribution.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBDistribution.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBDistribution.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBDistribution.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -/****************************************************************************/ -/// @file NBDistribution.cpp -/// @author Daniel Krajzewicz -/// @date Sept 2002 -/// @version $Id: NBDistribution.cpp 20433 2016-04-13 08:00:14Z behrisch $ -/// -// The base class for statistical distribution descriptions -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include "NBDistribution.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - - -// =========================================================================== -// static member variables -// =========================================================================== -NBDistribution::TypedDistDict NBDistribution::myDict; - - -// =========================================================================== -// method definitions -// =========================================================================== -bool -NBDistribution::dictionary(const std::string& type, const std::string& id, - Distribution* d) { - TypedDistDict::iterator i = myDict.find(type); - - if (i == myDict.end()) { - myDict[type][id] = d; - return true; - } - DistDict& dict = (*i).second; - DistDict::iterator j = dict.find(id); - if (j == dict.end()) { - myDict[type][id] = d; - return true; - } - return false; -} - - -Distribution* -NBDistribution::dictionary(const std::string& type, - const std::string& id) { - TypedDistDict::iterator i = myDict.find(type); - if (i == myDict.end()) { - return 0; - } - DistDict& dict = (*i).second; - DistDict::iterator j = dict.find(id); - if (j == dict.end()) { - return 0; - } - return (*j).second; -} - - -void -NBDistribution::clear() { - for (TypedDistDict::iterator i = myDict.begin(); i != myDict.end(); i++) { - DistDict& dict = (*i).second; - for (DistDict::iterator j = dict.begin(); j != dict.end(); j++) { - delete(*j).second; - } - } -} - - - -/****************************************************************************/ - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBDistribution.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBDistribution.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBDistribution.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBDistribution.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -/****************************************************************************/ -/// @file NBDistribution.h -/// @author Daniel Krajzewicz -/// @author Sascha Krieg -/// @date Sept 2002 -/// @version $Id: NBDistribution.h 20433 2016-04-13 08:00:14Z behrisch $ -/// -// The base class for statistical distribution descriptions -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ -#ifndef NBDistribution_h -#define NBDistribution_h - - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include -#include -#include - - -// =========================================================================== -// class definitions -// =========================================================================== -/** - * @class NBDistribution - * @brief The base class for statistical distribution descriptions - */ -class NBDistribution { -public: - static bool dictionary(const std::string& type, const std::string& id, - Distribution* d); - static Distribution* dictionary(const std::string& type, - const std::string& id); - static void clear(); -private: - typedef std::map DistDict; - typedef std::map TypedDistDict; - static TypedDistDict myDict; -}; - - -#endif - -/****************************************************************************/ - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBDistrictCont.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBDistrictCont.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBDistrictCont.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBDistrictCont.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: NBDistrictCont.cpp 21201 2016-07-19 11:57:22Z behrisch $ +/// @version $Id: NBDistrictCont.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A container for districts /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include "NBDistrict.h" #include "NBDistrictCont.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -85,7 +81,7 @@ bool NBDistrictCont::addSource(const std::string& dist, NBEdge* const source, - SUMOReal weight) { + double weight) { NBDistrict* o = retrieve(dist); if (o == 0) { return false; @@ -96,7 +92,7 @@ bool NBDistrictCont::addSink(const std::string& dist, NBEdge* const destination, - SUMOReal weight) { + double weight) { NBDistrict* o = retrieve(dist); if (o == 0) { return false; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBDistrictCont.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBDistrictCont.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBDistrictCont.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBDistrictCont.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NBDistrictCont.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NBDistrictCont.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A container for districts /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -116,7 +116,7 @@ * @return Whether the source could be added (the district exists and the suorce was not added to it before) */ bool addSource(const std::string& dist, NBEdge* const source, - SUMOReal weight); + double weight); /** @brief Adds a sink to the named district @@ -132,7 +132,7 @@ * @return Whether the source could be added (the district exists and the suorce was not added to it before) */ bool addSink(const std::string& dist, NBEdge* const destination, - SUMOReal weight); + double weight); /** @brief Removes the given edge from the lists of sources and sinks in all stored districts diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBDistrict.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBDistrict.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBDistrict.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBDistrict.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NBDistrict.cpp 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: NBDistrict.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A class representing a single district /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,10 +42,6 @@ #include "NBEdge.h" #include "NBDistrict.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions @@ -64,7 +60,7 @@ // ----------- Applying offset void -NBDistrict::reshiftPosition(SUMOReal xoff, SUMOReal yoff) { +NBDistrict::reshiftPosition(double xoff, double yoff) { myPosition.add(xoff, yoff, 0); myShape.add(xoff, yoff, 0); } @@ -78,7 +74,7 @@ bool -NBDistrict::addSource(NBEdge* const source, SUMOReal weight) { +NBDistrict::addSource(NBEdge* const source, double weight) { EdgeVector::iterator i = find(mySources.begin(), mySources.end(), source); if (i != mySources.end()) { return false; @@ -91,7 +87,7 @@ bool -NBDistrict::addSink(NBEdge* const sink, SUMOReal weight) { +NBDistrict::addSink(NBEdge* const sink, double weight) { EdgeVector::iterator i = find(mySinks.begin(), mySinks.end(), sink); if (i != mySinks.end()) { return false; @@ -114,13 +110,13 @@ // temporary structures EdgeVector newList; WeightsCont newWeights; - SUMOReal joinedVal = 0; + double joinedVal = 0; // go through the list of sinks EdgeVector::iterator i = mySinks.begin(); WeightsCont::iterator j = mySinkWeights.begin(); for (; i != mySinks.end(); i++, j++) { NBEdge* tmp = (*i); - SUMOReal val = (*j); + double val = (*j); if (find(which.begin(), which.end(), tmp) == which.end()) { // if the current edge shall not be replaced, add to the // temporary list @@ -146,13 +142,13 @@ // temporary structures EdgeVector newList; WeightsCont newWeights; - SUMOReal joinedVal = 0; + double joinedVal = 0; // go through the list of sinks EdgeVector::iterator i = mySources.begin(); WeightsCont::iterator j = mySourceWeights.begin(); for (; i != mySources.end(); i++, j++) { NBEdge* tmp = (*i); - SUMOReal val = (*j); + double val = (*j); if (find(which.begin(), which.end(), tmp) == which.end()) { // if the current edge shall not be replaced, add to the // temporary list diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBDistrict.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBDistrict.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBDistrict.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBDistrict.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NBDistrict.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NBDistrict.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A class representing a single district /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -104,7 +104,7 @@ * @return Whether the source could be added (was not added before) * @todo Consider using only one list for sources/weights */ - bool addSource(NBEdge* const source, SUMOReal weight); + bool addSource(NBEdge* const source, double weight); /** @brief Adds a sink @@ -119,7 +119,7 @@ * @return Whether the sink could be added (was not added before) * @todo Consider using only one list for sinks/weights */ - bool addSink(NBEdge* const sink, SUMOReal weight); + bool addSink(NBEdge* const sink, double weight); /** @brief Returns the position of this district's center @@ -187,7 +187,7 @@ /** @brief Returns the weights of the sources * @return The source weights */ - const std::vector& getSourceWeights() const { + const std::vector& getSourceWeights() const { return mySourceWeights; } @@ -203,7 +203,7 @@ /** @brief Returns the weights of the sinks * @return The sink weights */ - const std::vector& getSinkWeights() const { + const std::vector& getSinkWeights() const { return mySinkWeights; } @@ -232,7 +232,7 @@ * @param[in] xoff The x-offset to apply * @param[in] yoff The y-offset to apply */ - void reshiftPosition(SUMOReal xoff, SUMOReal yoff); + void reshiftPosition(double xoff, double yoff); /// @brief mirror coordinates along the x-axis void mirrorX(); @@ -244,7 +244,7 @@ private: /// @brief Definition of a vector of connection weights - typedef std::vector WeightsCont; + typedef std::vector WeightsCont; /// @brief The sources (connection from district to network) EdgeVector mySources; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBEdgeCont.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBEdgeCont.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBEdgeCont.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBEdgeCont.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: NBEdgeCont.cpp 21714 2016-10-17 11:21:44Z namdre $ +/// @version $Id: NBEdgeCont.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Storage for edges, including some functionality operating on multiple edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -56,10 +56,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -117,9 +113,9 @@ std::vector polyS = oc.getStringVector(oc.isSet("keep-edges.in-boundary") ? "keep-edges.in-boundary" : "keep-edges.in-geo-boundary"); // !!! throw something if length<4 || length%2!=0? - std::vector poly; + std::vector poly; for (std::vector::iterator i = polyS.begin(); i != polyS.end(); ++i) { - poly.push_back(TplConvert::_2SUMOReal((*i).c_str())); // !!! may throw something anyhow... + poly.push_back(TplConvert::_2double((*i).c_str())); // !!! may throw something anyhow... } if (poly.size() < 4) { throw ProcessError("Invalid boundary: need at least 2 coordinates"); @@ -132,9 +128,9 @@ myPrunningBoundary.push_back(Position(poly[2], poly[3])); myPrunningBoundary.push_back(Position(poly[0], poly[3])); } else { - for (std::vector::iterator j = poly.begin(); j != poly.end();) { - SUMOReal x = *j++; - SUMOReal y = *j++; + for (std::vector::iterator j = poly.begin(); j != poly.end();) { + double x = *j++; + double y = *j++; myPrunningBoundary.push_back(Position(x, y)); } } @@ -188,7 +184,15 @@ // check whether the edge is a named edge to keep if (!myRemoveEdgesAfterJoining && myEdges2Keep.size() != 0) { if (find(myEdges2Keep.begin(), myEdges2Keep.end(), edge->getID()) == myEdges2Keep.end()) { - return true; + // explicit whitelisting may be combined additively with other filters + if (myVehicleClasses2Keep == 0 && myVehicleClasses2Remove == 0 + && myTypes2Keep.size() == 0 && myTypes2Remove.size() == 0 + && myPrunningBoundary.size() == 0) { + return true; + } + } else { + // explicit whitelisting overrides other filters + return false; } } // check whether the edge is a named edge to remove @@ -232,7 +236,7 @@ } myNeedGeoTransformedPrunningBoundary = false; } - if (!(edge->getGeometry().getBoxBoundary().grow((SUMOReal) POSITION_EPS).overlapsWith(myPrunningBoundary))) { + if (!(edge->getGeometry().getBoxBoundary().grow((double) POSITION_EPS).overlapsWith(myPrunningBoundary))) { return true; } } @@ -333,7 +337,7 @@ NBEdge* -NBEdgeCont::retrievePossiblySplit(const std::string& id, SUMOReal pos) const { +NBEdgeCont::retrievePossiblySplit(const std::string& id, double pos) const { // check whether the edge was not split, yet NBEdge* edge = retrieve(id); if (edge != 0) { @@ -347,7 +351,7 @@ } } // find the part of the edge which matches the position - SUMOReal seen = 0; + double seen = 0; std::vector names; names.push_back(id + "[1]"); names.push_back(id + "[0]"); @@ -420,9 +424,9 @@ const std::string& firstEdgeName, const std::string& secondEdgeName, int noLanesFirstEdge, int noLanesSecondEdge, - const SUMOReal speed, + const double speed, const int changedLeft) { - SUMOReal pos; + double pos; pos = edge->getGeometry().nearest_offset_to_point2D(node->getPosition()); if (pos <= 0) { pos = GeomHelper::nearest_offset_on_line_to_point2D( @@ -439,11 +443,11 @@ bool NBEdgeCont::splitAt(NBDistrictCont& dc, - NBEdge* edge, SUMOReal pos, NBNode* node, + NBEdge* edge, double pos, NBNode* node, const std::string& firstEdgeName, const std::string& secondEdgeName, int noLanesFirstEdge, int noLanesSecondEdge, - const SUMOReal speed, + const double speed, const int changedLeft ) { // there must be at least some overlap between first and second edge @@ -506,6 +510,8 @@ } } // erase the splitted edge + patchRoundabouts(edge, one, two, myRoundabouts); + patchRoundabouts(edge, one, two, myGuessedRoundabouts); erase(dc, edge); insert(one, true); insert(two, true); @@ -514,6 +520,22 @@ } +void +NBEdgeCont::patchRoundabouts(NBEdge* orig, NBEdge* part1, NBEdge* part2, std::set& roundabouts) { + std::set addLater; + for (std::set::iterator it = roundabouts.begin(); it != roundabouts.end(); ++it) { + EdgeSet roundaboutSet = *it; + if (roundaboutSet.count(orig) > 0) { + roundaboutSet.erase(orig); + roundaboutSet.insert(part1); + roundaboutSet.insert(part2); + } + addLater.insert(roundaboutSet); + } + roundabouts.clear(); + roundabouts.insert(addLater.begin(), addLater.end()); +} + // ----- container access methods std::vector @@ -556,7 +578,7 @@ void -NBEdgeCont::reduceGeometries(const SUMOReal minDist) { +NBEdgeCont::reduceGeometries(const double minDist) { for (EdgeCont::iterator i = myEdges.begin(); i != myEdges.end(); ++i) { (*i).second->reduceGeometry(minDist); } @@ -564,7 +586,7 @@ void -NBEdgeCont::checkGeometries(const SUMOReal maxAngle, const SUMOReal minRadius, bool fix) { +NBEdgeCont::checkGeometries(const double maxAngle, const double minRadius, bool fix) { if (maxAngle > 0 || minRadius > 0) { for (EdgeCont::iterator i = myEdges.begin(); i != myEdges.end(); ++i) { (*i).second->checkGeometry(maxAngle, minRadius, fix); @@ -609,20 +631,24 @@ void NBEdgeCont::recheckLanes() { for (EdgeCont::iterator i = myEdges.begin(); i != myEdges.end(); i++) { - i->second->recheckLanes(); + NBEdge* edge = i->second; + edge->recheckLanes(); // check opposites - if (i->second->getNumLanes() > 0) { - const std::string& oppositeID = i->second->getLanes().back().oppositeID; + if (edge->getNumLanes() > 0) { + const std::string& oppositeID = edge->getLanes().back().oppositeID; if (oppositeID != "" && oppositeID != "-") { - const NBEdge* oppEdge = retrieve(oppositeID.substr(0, oppositeID.rfind("_"))); - if (oppEdge == 0) { - throw ProcessError("Unknown opposite lane '" + oppositeID + "' for edge '" + i->second->getID() + "'!"); + NBEdge* oppEdge = retrieve(oppositeID.substr(0, oppositeID.rfind("_"))); + if (oppEdge == 0 || oppEdge->getLaneID(oppEdge->getNumLanes() - 1) != oppositeID) { + WRITE_WARNING("Removing unknown opposite lane '" + oppositeID + "' for edge '" + edge->getID() + "'."); + edge->getLaneStruct(edge->getNumLanes() - 1).oppositeID = ""; + continue; } - if (fabs(oppEdge->getLoadedLength() - i->second->getLoadedLength()) > POSITION_EPS) { - throw ProcessError("Opposite lane '" + oppositeID + "' differs in length from edge '" + i->second->getID() + "'!"); + if (fabs(oppEdge->getLoadedLength() - edge->getLoadedLength()) > POSITION_EPS) { + throw ProcessError("Opposite lane '" + oppositeID + "' (length " + toString(oppEdge->getLoadedLength()) + ") differs in length from edge '" + edge->getID() + "' (length " + + toString(edge->getLoadedLength()) + ")!"); } - if (oppEdge->getFromNode() != i->second->getToNode() || oppEdge->getToNode() != i->second->getFromNode()) { - throw ProcessError("Opposite lane '" + oppositeID + "' does not connect the same nodes as edge '" + i->second->getID() + "'!"); + if (oppEdge->getFromNode() != edge->getToNode() || oppEdge->getToNode() != edge->getFromNode()) { + throw ProcessError("Opposite lane '" + oppositeID + "' does not connect the same nodes as edge '" + edge->getID() + "'!"); } } } @@ -673,7 +699,7 @@ // count the number of lanes, the speed and the id int nolanes = 0; - SUMOReal speed = 0; + double speed = 0; int priority = 0; std::string id; sort(edges.begin(), edges.end(), NBContHelper::same_connection_edge_sorter()); @@ -752,7 +778,7 @@ void NBEdgeCont::guessOpposites() { //@todo magic values - const SUMOReal distanceThreshold = 7; + const double distanceThreshold = 7; for (EdgeCont::iterator i = myEdges.begin(); i != myEdges.end(); ++i) { NBEdge* edge = i->second; const int numLanes = edge->getNumLanes(); @@ -760,10 +786,10 @@ NBEdge::Lane& lastLane = edge->getLaneStruct(numLanes - 1); if (lastLane.oppositeID == "") { NBEdge* opposite = 0; - //SUMOReal minOppositeDist = std::numeric_limits::max(); + //double minOppositeDist = std::numeric_limits::max(); for (EdgeVector::const_iterator j = edge->getToNode()->getOutgoingEdges().begin(); j != edge->getToNode()->getOutgoingEdges().end(); ++j) { if ((*j)->getToNode() == edge->getFromNode() && !(*j)->getLanes().empty()) { - const SUMOReal distance = VectorHelper::maxValue(lastLane.shape.distances((*j)->getLanes().back().shape)); + const double distance = VectorHelper::maxValue(lastLane.shape.distances((*j)->getLanes().back().shape)); if (distance < distanceThreshold) { //minOppositeDist = distance; opposite = *j; @@ -782,38 +808,52 @@ void NBEdgeCont::recheckLaneSpread() { for (EdgeCont::iterator i = myEdges.begin(); i != myEdges.end(); ++i) { - std::string oppositeID; - if ((*i).first[0] == '-') { - oppositeID = (*i).first.substr(1); + NBEdge* opposite = getOppositeByID(i->first); + if (opposite != 0) { + i->second->setLaneSpreadFunction(LANESPREAD_RIGHT); + opposite->setLaneSpreadFunction(LANESPREAD_RIGHT); } else { - oppositeID = "-" + (*i).first; - } - if (myEdges.find(oppositeID) != myEdges.end()) { - (*i).second->setLaneSpreadFunction(LANESPREAD_RIGHT); - myEdges.find(oppositeID)->second->setLaneSpreadFunction(LANESPREAD_RIGHT); - } else { - (*i).second->setLaneSpreadFunction(LANESPREAD_CENTER); + i->second->setLaneSpreadFunction(LANESPREAD_CENTER); } } } +NBEdge* +NBEdgeCont::getOppositeByID(const std::string& edgeID) const { + const std::string oppositeID = edgeID[0] == '-' ? edgeID.substr(1) : "-" + edgeID; + EdgeCont::const_iterator it = myEdges.find(oppositeID); + return it != myEdges.end() ? it->second : (NBEdge*)0; +} + +NBEdge* +NBEdgeCont::getByID(const std::string& edgeID) const { + EdgeCont::const_iterator it = myEdges.find(edgeID); + return it != myEdges.end() ? it->second : (NBEdge*)0; +} // ----- other void -NBEdgeCont::addPostProcessConnection(const std::string& from, int fromLane, const std::string& to, int toLane, bool mayDefinitelyPass, bool keepClear, SUMOReal contPos, SUMOReal visibility) { - myConnections.push_back(PostProcessConnection(from, fromLane, to, toLane, mayDefinitelyPass, keepClear, contPos, visibility)); +NBEdgeCont::addPostProcessConnection(const std::string& from, int fromLane, const std::string& to, int toLane, bool mayDefinitelyPass, + bool keepClear, double contPos, double visibility, bool warnOnly) { + myConnections.push_back(PostProcessConnection(from, fromLane, to, toLane, mayDefinitelyPass, keepClear, contPos, visibility, warnOnly)); } void NBEdgeCont::recheckPostProcessConnections() { + const bool warnOnly = OptionsCont::getOptions().exists("ignore-errors.connections") && OptionsCont::getOptions().getBool("ignore-errors.connections"); for (std::vector::const_iterator i = myConnections.begin(); i != myConnections.end(); ++i) { NBEdge* from = retrievePossiblySplit((*i).from, true); NBEdge* to = retrievePossiblySplit((*i).to, false); if (from == 0 || to == 0 || !from->addLane2LaneConnection((*i).fromLane, to, (*i).toLane, NBEdge::L2L_USER, true, (*i).mayDefinitelyPass, (*i).keepClear, (*i).contPos)) { - WRITE_ERROR("Could not insert connection between '" + (*i).from + "' and '" + (*i).to + "' after build."); + const std::string msg = "Could not insert connection between '" + (*i).from + "' and '" + (*i).to + "' after build."; + if (warnOnly || (*i).warnOnly) { + WRITE_WARNING(msg); + } else { + WRITE_ERROR(msg); + } } } // during loading we also kept some ambiguous connections in hope they might be valid after processing @@ -925,7 +965,7 @@ EdgeVector::const_iterator me = find(edges.begin(), edges.end(), e); NBContHelper::nextCW(edges, me); NBEdge* left = *me; - SUMOReal angle = fabs(NBHelpers::relAngle(e->getAngleAtNode(e->getToNode()), left->getAngleAtNode(e->getToNode()))); + double angle = fabs(NBHelpers::relAngle(e->getAngleAtNode(e->getToNode()), left->getAngleAtNode(e->getToNode()))); if (angle >= 90) { // roundabouts do not have sharp turns (or they wouldn't be called 'round') doLoop = false; @@ -973,13 +1013,13 @@ } -SUMOReal +double NBEdgeCont::formFactor(const EdgeVector& loopEdges) { PositionVector points; for (EdgeVector::const_iterator it = loopEdges.begin(); it != loopEdges.end(); ++it) { points.append((*it)->getGeometry()); } - SUMOReal circumference = points.length2D(); + double circumference = points.length2D(); return 4 * M_PI * points.area() / (circumference * circumference); } @@ -1035,7 +1075,7 @@ NBEdgeCont::generateStreetSigns() { for (EdgeCont::iterator i = myEdges.begin(); i != myEdges.end(); ++i) { NBEdge* e = i->second; - const SUMOReal offset = MAX2((SUMOReal)0, e->getLength() - 3); + const double offset = MAX2(0., e->getLength() - 3); if (e->getToNode()->isSimpleContinuation(false)) { // not a "real" junction? continue; @@ -1072,7 +1112,7 @@ int -NBEdgeCont::guessSidewalks(SUMOReal width, SUMOReal minSpeed, SUMOReal maxSpeed, bool fromPermissions) { +NBEdgeCont::guessSidewalks(double width, double minSpeed, double maxSpeed, bool fromPermissions) { int sidewalksCreated = 0; const std::vector edges = OptionsCont::getOptions().getStringVector("sidewalks.guess.exclude"); std::set exclude(edges.begin(), edges.end()); @@ -1097,17 +1137,28 @@ int -NBEdgeCont::mapToNumericalIDs() { - IDSupplier idSupplier("", getAllNames()); - EdgeVector toChange; +NBEdgeCont::remapIDs(bool numericaIDs, bool reservedIDs) { + std::vector avoid = getAllNames(); + std::set reserve; + if (reservedIDs) { + NBHelpers::loadPrefixedIDsFomFile(OptionsCont::getOptions().getString("reserved-ids"), "edge:", reserve); + avoid.insert(avoid.end(), reserve.begin(), reserve.end()); + } + IDSupplier idSupplier("", avoid); + std::set toChange; for (EdgeCont::iterator it = myEdges.begin(); it != myEdges.end(); it++) { - try { - TplConvert::_str2int(it->first); - } catch (NumberFormatException&) { - toChange.push_back(it->second); + if (numericaIDs) { + try { + TplConvert::_str2long(it->first); + } catch (NumberFormatException&) { + toChange.insert(it->second); + } + } + if (reservedIDs && reserve.count(it->first) > 0) { + toChange.insert(it->second); } } - for (EdgeVector::iterator it = toChange.begin(); it != toChange.end(); ++it) { + for (std::set::iterator it = toChange.begin(); it != toChange.end(); ++it) { NBEdge* edge = *it; myEdges.erase(edge->getID()); edge->setID(idSupplier.getNext()); @@ -1116,4 +1167,57 @@ return (int)toChange.size(); } + +void +NBEdgeCont::checkOverlap(double threshold, double zThreshold) const { + for (EdgeCont::const_iterator it = myEdges.begin(); it != myEdges.end(); it++) { + const NBEdge* e1 = it->second; + Boundary b1 = e1->getGeometry().getBoxBoundary(); + b1.grow(e1->getTotalWidth()); + PositionVector outline1 = e1->getCCWBoundaryLine(*e1->getFromNode()); + outline1.append(e1->getCCWBoundaryLine(*e1->getToNode())); + // check is symmetric. only check once per pair + for (EdgeCont::const_iterator it2 = it; it2 != myEdges.end(); it2++) { + const NBEdge* e2 = it2->second; + if (e1 == e2) { + continue; + } + Boundary b2 = e2->getGeometry().getBoxBoundary(); + b2.grow(e2->getTotalWidth()); + if (b1.overlapsWith(b2)) { + PositionVector outline2 = e2->getCCWBoundaryLine(*e2->getFromNode()); + outline2.append(e2->getCCWBoundaryLine(*e2->getToNode())); + const double overlap = outline1.getOverlapWith(outline2, zThreshold); + if (overlap > threshold) { + WRITE_WARNING("Edge '" + e1->getID() + "' overlaps with edge '" + e2->getID() + "' by " + toString(overlap) + "."); + } + } + } + } +} + + +void +NBEdgeCont::checkGrade(double threshold) const { + for (EdgeCont::const_iterator it = myEdges.begin(); it != myEdges.end(); it++) { + const NBEdge* edge = it->second; + for (int i = 0; i < (int)edge->getNumLanes(); i++) { + const double grade = edge->getLaneShape(i).getMaxGrade(); + if (grade > threshold) { + WRITE_WARNING("Edge '" + edge->getID() + "' has a grade of " + toString(grade * 100) + "%."); + break; + } + } + const std::vector& connections = edge->getConnections(); + for (std::vector::const_iterator it_con = connections.begin(); it_con != connections.end(); ++it_con) { + const NBEdge::Connection& c = *it_con; + const double grade = MAX2(c.shape.getMaxGrade(), c.viaShape.getMaxGrade()); + if (grade > threshold) { + WRITE_WARNING("Connection '" + c.getDescription(edge) + "' has a grade of " + toString(grade * 100) + "%."); + break; + } + } + } +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBEdgeCont.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBEdgeCont.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBEdgeCont.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBEdgeCont.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: NBEdgeCont.h 21714 2016-10-17 11:21:44Z namdre $ +/// @version $Id: NBEdgeCont.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Storage for edges, including some functionality operating on multiple edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -160,7 +160,7 @@ * @return The searched edge * @todo Recheck usage */ - NBEdge* retrievePossiblySplit(const std::string& id, SUMOReal pos) const; + NBEdge* retrievePossiblySplit(const std::string& id, double pos) const; /** @brief Removes the given edge from the container (deleting it) @@ -227,7 +227,7 @@ * edge to the given node. If this position is too near to the edges begin/end, * false is returned. * - * Otherwise, "splitAt(NBDistrictCont &, NBEdge *, SUMOReal, NBNode *, const std::string &, const std::string &, int , int)" + * Otherwise, "splitAt(NBDistrictCont &, NBEdge *, double, NBNode *, const std::string &, const std::string &, int , int)" * is used to perform the split. * * @param[in] dc The district container, in order to remove/add the edge from/to sources/sinks @@ -242,12 +242,12 @@ * (By default all added/removed lanes are assumed to be on the right when computing connections) * @return Whether the edge could be split * @exception ProcessError If connections between the edges can not be built - * @see NBEdge::splitAt(NBDistrictCont &, NBEdge *, SUMOReal, NBNode *, const std::string &, const std::string &, int , int) + * @see NBEdge::splitAt(NBDistrictCont &, NBEdge *, double, NBNode *, const std::string &, const std::string &, int , int) */ bool splitAt(NBDistrictCont& dc, NBEdge* edge, NBNode* node, const std::string& firstEdgeName, const std::string& secondEdgeName, int noLanesFirstEdge, int noLanesSecondEdge, - const SUMOReal speed = -1., const int changedLeft = 0); + const double speed = -1., const int changedLeft = 0); /** @brief Splits the edge at the position nearest to the given node using the given modifications @@ -265,10 +265,10 @@ * @return Whether the edge could be split * @exception ProcessError If connections between the edges can not be built */ - bool splitAt(NBDistrictCont& dc, NBEdge* edge, SUMOReal edgepos, NBNode* node, + bool splitAt(NBDistrictCont& dc, NBEdge* edge, double edgepos, NBNode* node, const std::string& firstEdgeName, const std::string& secondEdgeName, int noLanesFirstEdge, int noLanesSecondEdge, - const SUMOReal speed = -1., const int changedLeft = 0); + const double speed = -1., const int changedLeft = 0); /// @} @@ -326,7 +326,7 @@ * @param[in] nc The node container needed to build (geometry) nodes * @see NBEdge::reduceGeometry */ - void reduceGeometries(const SUMOReal minDist); + void reduceGeometries(const double minDist); /** @brief @@ -335,7 +335,7 @@ * @param[in] fix Whether to prune geometry points to avoid sharp turns at start and end * @see NBEdge::checkGeometry */ - void checkGeometries(const SUMOReal maxAngle, const SUMOReal minRadius, bool fix); + void checkGeometries(const double maxAngle, const double minRadius, bool fix); /// @} @@ -452,9 +452,14 @@ * @todo Recheck usage; check whether this is really needed and whether it works at all */ void recheckLaneSpread(); + /// @} + /// @brief Returns the edge with negated id if it exists + NBEdge* getOppositeByID(const std::string& edgeID) const; + /// @brief Returns the edge with id if it exists + NBEdge* getByID(const std::string& edgeID) const; /** @brief Determines which edges belong to roundabouts and increases their priority * @param[out] marked Edges which belong to a roundabout are stored here @@ -499,8 +504,10 @@ * @param[in] keepClear Whether the connection must check to keep the junction clear * @param[in] contPos Custom position for internal junction * @param[in] visibility Custom foe visiblity connection + * @param[in] warnOnly Whether a failure to set this connection should only result in a warning */ - void addPostProcessConnection(const std::string& from, int fromLane, const std::string& to, int toLane, bool mayDefinitelyPass, bool keepClear, SUMOReal contPos, SUMOReal visibility); + void addPostProcessConnection(const std::string& from, int fromLane, const std::string& to, int toLane, bool mayDefinitelyPass, bool keepClear, double contPos, double visibility, + bool warnOnly = false); /** @brief Try to set any stored connections @@ -512,7 +519,7 @@ void generateStreetSigns(); /// @brief add sidwalks to edges within the given limits or permissions and return the number of edges affected - int guessSidewalks(SUMOReal width, SUMOReal minSpeed, SUMOReal maxSpeed, bool fromPermissions); + int guessSidewalks(double width, double minSpeed, double maxSpeed, bool fromPermissions); /** @brief Returns the determined roundabouts @@ -526,13 +533,22 @@ /// @brief mark edge priorities and prohibit turn-arounds for all roundabout edges void markRoundabouts(); + /// @brief fix roundabout information after splitting an edge + void patchRoundabouts(NBEdge* orig, NBEdge* part1, NBEdge* part2, std::set& roundabouts); + /// @brief Returns true if this edge matches one of the removal criteria bool ignoreFilterMatch(NBEdge* edge); - /// @brief ensure that all edge ids are integers - int mapToNumericalIDs(); + /// @brief remap node IDs accoring to options --numerical-ids and --reserved-ids + int remapIDs(bool numericaIDs, bool reservedIDs); + + /// @brief check whether edges overlap + void checkOverlap(double threshold, double zThreshold) const; + + /// @brief check whether edges are to steep + void checkGrade(double threshold) const; + -private: /** @brief Returns the edges which have been built by splitting the edge of the given id * * @param[in] id The id of the original edge @@ -541,9 +557,9 @@ */ EdgeVector getGeneratedFrom(const std::string& id) const; - +private: /// @brief compute the form factor for a loop of edges - static SUMOReal formFactor(const EdgeVector& loopEdges); + static double formFactor(const EdgeVector& loopEdges); private: /// @brief The network builder; used to obtain type information @@ -561,8 +577,11 @@ * @param[in] toLane The number of the lane the connection ends at * @param[in] mayDefinitelyPass Whether the connection may be passed without braking */ - PostProcessConnection(const std::string& from_, int fromLane_, const std::string& to_, int toLane_, bool mayDefinitelyPass_, bool keepClear_, SUMOReal contPos_, SUMOReal visibility_) : - from(from_), fromLane(fromLane_), to(to_), toLane(toLane_), mayDefinitelyPass(mayDefinitelyPass_), keepClear(keepClear_), contPos(contPos_), visibility(visibility_) { + PostProcessConnection(const std::string& from_, int fromLane_, const std::string& to_, int toLane_, bool mayDefinitelyPass_, bool keepClear_, double contPos_, double visibility_, + bool warnOnly_ = false) : + from(from_), fromLane(fromLane_), to(to_), toLane(toLane_), mayDefinitelyPass(mayDefinitelyPass_), keepClear(keepClear_), contPos(contPos_), + visibility(visibility_), + warnOnly(warnOnly_) { } /// @brief The id of the edge the connection starts at std::string from; @@ -577,9 +596,11 @@ /// @brief Whether the connection may be passed without braking bool keepClear; /// @brief custom position for internal junction on this connection - SUMOReal contPos; + double contPos; /// @brief custom foe visiblity for connection - SUMOReal visibility; + double visibility; + /// @brief whether a failure to set this connection is a warning or an error + bool warnOnly; }; /// @brief The list of connections to recheck @@ -605,7 +626,7 @@ /// @{ /// @brief The minimum speed an edge may have in order to be kept (default: -1) - SUMOReal myEdgesMinSpeed; + double myEdgesMinSpeed; /// @brief Whether edges shall be joined first, then removed bool myRemoveEdgesAfterJoining; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBEdge.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBEdge.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBEdge.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBEdge.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Tue, 20 Nov 2001 -/// @version $Id: NBEdge.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NBEdge.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Methods for the representation of a single edge /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -54,25 +54,23 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - //#define DEBUG_CONNECTION_GUESSING -#define DEBUGCOND true +//#define DEBUG_ANGLES +//#define DEBUG_NODE_BORDER +#define DEBUGCOND (getID() == "disabled") // =========================================================================== // static members // =========================================================================== -const SUMOReal NBEdge::UNSPECIFIED_WIDTH = -1; -const SUMOReal NBEdge::UNSPECIFIED_OFFSET = 0; -const SUMOReal NBEdge::UNSPECIFIED_SPEED = -1; -const SUMOReal NBEdge::UNSPECIFIED_CONTPOS = -1; -const SUMOReal NBEdge::UNSPECIFIED_VISIBILITY_DISTANCE = -1; - -const SUMOReal NBEdge::UNSPECIFIED_SIGNAL_OFFSET = -1; -const SUMOReal NBEdge::UNSPECIFIED_LOADED_LENGTH = -1; -const SUMOReal NBEdge::ANGLE_LOOKAHEAD = 10.0; +const double NBEdge::UNSPECIFIED_WIDTH = -1; +const double NBEdge::UNSPECIFIED_OFFSET = 0; +const double NBEdge::UNSPECIFIED_SPEED = -1; +const double NBEdge::UNSPECIFIED_CONTPOS = -1; +const double NBEdge::UNSPECIFIED_VISIBILITY_DISTANCE = -1; + +const double NBEdge::UNSPECIFIED_SIGNAL_OFFSET = -1; +const double NBEdge::UNSPECIFIED_LOADED_LENGTH = -1; +const double NBEdge::ANGLE_LOOKAHEAD = 10.0; const int NBEdge::UNSPECIFIED_INTERNAL_LANE_INDEX = -1; // =========================================================================== @@ -84,6 +82,12 @@ } +std::string +NBEdge::Connection::getDescription(const NBEdge* parent) const { + return Named::getIDSecure(parent) + "_" + toString(fromLane) + "->" + Named::getIDSecure(toEdge) + "_" + toString(toLane); +} + + NBEdge::Connection::Connection(int fromLane_, NBEdge* toEdge_, int toLane_) : fromLane(fromLane_), toEdge(toEdge_), @@ -94,12 +98,12 @@ visibility(UNSPECIFIED_VISIBILITY_DISTANCE), id(toEdge_ == 0 ? "" : toEdge->getFromNode()->getID()), haveVia(false), - internalLaneIndex(UNSPECIFIED_INTERNAL_LANE_INDEX) - -{} + internalLaneIndex(UNSPECIFIED_INTERNAL_LANE_INDEX), + uncontrolled(false) { +} -NBEdge::Connection::Connection(int fromLane_, NBEdge* toEdge_, int toLane_, bool mayDefinitelyPass_, bool keepClear_, SUMOReal contPos_, SUMOReal visibility_, bool haveVia_) : +NBEdge::Connection::Connection(int fromLane_, NBEdge* toEdge_, int toLane_, bool mayDefinitelyPass_, bool keepClear_, double contPos_, double visibility_, bool haveVia_, bool uncontrolled_) : fromLane(fromLane_), toEdge(toEdge_), toLane(toLane_), @@ -109,15 +113,19 @@ visibility(visibility_), id(toEdge_ == 0 ? "" : toEdge->getFromNode()->getID()), haveVia(haveVia_), - internalLaneIndex(UNSPECIFIED_INTERNAL_LANE_INDEX) { + internalLaneIndex(UNSPECIFIED_INTERNAL_LANE_INDEX), + uncontrolled(uncontrolled_) { } + NBEdge::Lane::Lane(NBEdge* e, const std::string& origID_) : speed(e->getSpeed()), permissions(SVCAll), preferred(0), endOffset(e->getEndOffset()), width(e->getLaneWidth()), - origID(origID_) { + origID(origID_), + accelRamp(false), + connectionsDone(false) { } @@ -235,8 +243,8 @@ * NBEdge-methods * ----------------------------------------------------------------------- */ NBEdge::NBEdge(const std::string& id, NBNode* from, NBNode* to, - std::string type, SUMOReal speed, int nolanes, - int priority, SUMOReal laneWidth, SUMOReal offset, + std::string type, double speed, int nolanes, + int priority, double laneWidth, double offset, const std::string& streetName, LaneSpreadFunction spread) : Named(StringUtils::convertUmlaute(id)), @@ -258,8 +266,8 @@ NBEdge::NBEdge(const std::string& id, NBNode* from, NBNode* to, - std::string type, SUMOReal speed, int nolanes, - int priority, SUMOReal laneWidth, SUMOReal offset, + std::string type, double speed, int nolanes, + int priority, double laneWidth, double offset, PositionVector geom, const std::string& streetName, const std::string& origID, @@ -317,8 +325,8 @@ void NBEdge::reinit(NBNode* from, NBNode* to, const std::string& type, - SUMOReal speed, int nolanes, int priority, - PositionVector geom, SUMOReal laneWidth, SUMOReal offset, + double speed, int nolanes, int priority, + PositionVector geom, double laneWidth, double offset, const std::string& streetName, LaneSpreadFunction spread, bool tryIgnoreNodePositions) { @@ -446,7 +454,7 @@ // ----------- Applying offset void -NBEdge::reshiftPosition(SUMOReal xoff, SUMOReal yoff) { +NBEdge::reshiftPosition(double xoff, double yoff) { myGeom.add(xoff, yoff, 0); for (int i = 0; i < (int)myLanes.size(); i++) { myLanes[i].shape.add(xoff, yoff, 0); @@ -489,6 +497,17 @@ } +bool +NBEdge::hasDefaultGeometryEndpointAtNode(const NBNode* node) const { + // do not extend past the node position + if (node == myFrom) { + return myGeom.front() == node->getPosition(); + } else { + assert(node == myTo); + return myGeom.back() == node->getPosition(); + } +} + void NBEdge::setGeometry(const PositionVector& s, bool inner) { Position begin = myGeom.front(); // may differ from node position @@ -502,29 +521,60 @@ computeAngle(); } + void -NBEdge::setNodeBorder(const NBNode* node, const Position& p) { - const SUMOReal extend = 200; - const SUMOReal distanceOfClosestThreshold = 1.0; // very rough heuristic, actually depends on angle - SUMOReal distanceOfClosest = distanceOfClosestThreshold; - PositionVector border = myGeom.getOrthogonal(p, extend, distanceOfClosest); - if (distanceOfClosest < distanceOfClosestThreshold) { - // shift border forward / backward - const SUMOReal shiftDirection = (node == myFrom ? 1.0 : -1.0); - SUMOReal base = myGeom.nearest_offset_to_point2D(p); - if (base != GeomHelper::INVALID_OFFSET) { - base += shiftDirection * (distanceOfClosestThreshold - distanceOfClosest); - PositionVector tmp = myGeom; - tmp.move2side(1.0); - border = myGeom.getOrthogonal(tmp.positionAtOffset2D(base), extend, distanceOfClosest); +NBEdge::extendGeometryAtNode(const NBNode* node, double maxExtent) { + //std::cout << "extendGeometryAtNode edge=" << getID() << " node=" << node->getID() << " nodePos=" << node->getPosition() << " extent=" << maxExtent << " geom=" << myGeom; + if (node == myFrom) { + myGeom.extrapolate(maxExtent, true); + double offset = myGeom.nearest_offset_to_point2D(node->getPosition()); + //std::cout << " geom2=" << myGeom << " offset=" << offset; + if (offset != GeomHelper::INVALID_OFFSET) { + myGeom = myGeom.getSubpart2D(offset, myGeom.length2D()); } + } else { + assert(node == myTo); + myGeom.extrapolate(maxExtent, false, true); + double offset = myGeom.nearest_offset_to_point2D(node->getPosition()); + //std::cout << " geom2=" << myGeom << " offset=" << offset; + if (offset != GeomHelper::INVALID_OFFSET) { + myGeom = myGeom.getSubpart2D(0, offset); + } + } + //std::cout << " geom3=" << myGeom << "\n"; +} + + +void +NBEdge::shortenGeometryAtNode(const NBNode* node, double reduction) { + //std::cout << "shortenGeometryAtNode edge=" << getID() << " node=" << node->getID() << " nodePos=" << node->getPosition() << " reduction=" << reduction << " geom=" << myGeom; + reduction = MIN2(reduction, myGeom.length2D() - 2 * POSITION_EPS); + if (node == myFrom) { + myGeom = myGeom.getSubpart2D(reduction, myGeom.length2D()); + } else { + myGeom = myGeom.getSubpart2D(0, myGeom.length2D() - reduction); + } + computeLaneShapes(); + //std::cout << " geom2=" << myGeom << "\n"; +} + + +void +NBEdge::setNodeBorder(const NBNode* node, const Position& p, const Position& p2, bool rectangularCut) { + PositionVector border; + if (rectangularCut) { + const double extend = 100; + border = myGeom.getOrthogonal(p, extend, node == myTo); + } else { + border.push_back(p); + border.push_back(p2); } if (border.size() == 2) { - SUMOReal edgeWidth = 0; + double edgeWidth = 0; for (int i = 0; i < (int)myLanes.size(); i++) { edgeWidth += getLaneWidth(i); } - border.extrapolate2D(edgeWidth); + border.extrapolate2D(getTotalWidth()); if (node == myFrom) { myFromBorder = border; } else { @@ -532,6 +582,27 @@ myToBorder = border; } } +#ifdef DEBUG_NODE_BORDER + gDebugFlag1 = DEBUGCOND; + if (DEBUGCOND) std::cout << "setNodeBorder edge=" << getID() << " node=" << node->getID() + << " rect=" << rectangularCut + << " p=" << p << " p2=" << p2 + << " border=" << border + << " myGeom=" << myGeom + << "\n"; + +#endif +} + + +void +NBEdge::resetNodeBorder(const NBNode* node) { + if (node == myFrom) { + myFromBorder.clear(); + } else { + assert(node == myTo); + myToBorder.clear(); + } } @@ -541,7 +612,7 @@ shape = startShapeAt(shape, myFrom, myFromBorder); if (shape.size() < 2) { // only keep the last snippet - const SUMOReal oldLength = old.length(); + const double oldLength = old.length(); shape = old.getSubpart(oldLength - 2 * POSITION_EPS, oldLength); } shape = startShapeAt(shape.reverse(), myTo, myToBorder).reverse(); @@ -550,7 +621,7 @@ if (old.length() < 2 * POSITION_EPS) { shape = old; } else { - const SUMOReal midpoint = old.length() / 2; + const double midpoint = old.length() / 2; // EPS*2 because otherwhise shape has only a single point shape = old.getSubpart(midpoint - POSITION_EPS, midpoint + POSITION_EPS); assert(shape.size() >= 2); @@ -564,20 +635,29 @@ PositionVector tmp; tmp.push_back(shape[0]); tmp.push_back(shape[-1]); + // 3D geometry may be messed up since positions were extrapolated rather than interpolated due to cutting in the wrong direction + // make the edge level with one of the intersections (try to pick one that needs to be flat as well) + if (myTo->geometryLike()) { + tmp[0].setz(myFrom->getPosition().z()); + tmp[1].setz(myFrom->getPosition().z()); + } else { + tmp[0].setz(myTo->getPosition().z()); + tmp[1].setz(myTo->getPosition().z()); + } shape = tmp; if (tmp.length() < POSITION_EPS) { // fall back to original shape if (old.length() < 2 * POSITION_EPS) { shape = old; } else { - const SUMOReal midpoint = old.length() / 2; + const double midpoint = old.length() / 2; // EPS*2 because otherwhise shape has only a single point shape = old.getSubpart(midpoint - POSITION_EPS, midpoint + POSITION_EPS); assert(shape.size() >= 2); assert(shape.length() > 0); } } else { - const SUMOReal midpoint = shape.length() / 2; + const double midpoint = shape.length() / 2; // cut to size and reverse shape = shape.getSubpart(midpoint - POSITION_EPS, midpoint + POSITION_EPS); if (shape.length() < POSITION_EPS) { @@ -598,12 +678,12 @@ myLanes[i].shape = cutAtIntersection(myLanes[i].shape); } // recompute edge's length as the average of lane lenghts - SUMOReal avgLength = 0; + double avgLength = 0; for (int i = 0; i < (int)myLanes.size(); i++) { assert(myLanes[i].shape.length() > 0); avgLength += myLanes[i].shape.length(); } - myLength = avgLength / (SUMOReal) myLanes.size(); + myLength = avgLength / (double) myLanes.size(); computeAngle(); // update angles using the finalized node and lane shapes } @@ -618,27 +698,45 @@ lb.extrapolate(100.0); if (nodeShape.intersects(laneShape)) { // shape intersects directly - std::vector pbv = laneShape.intersectsAtLengths2D(nodeShape); + std::vector pbv = laneShape.intersectsAtLengths2D(nodeShape); assert(pbv.size() > 0); // ensure that the subpart has at least two points - SUMOReal pb = MIN2(laneShape.length2D() - POSITION_EPS - NUMERICAL_EPS, VectorHelper::maxValue(pbv)); + double pb = MIN2(laneShape.length2D() - POSITION_EPS - NUMERICAL_EPS, VectorHelper::maxValue(pbv)); if (pb < 0) { return laneShape; } PositionVector ns = laneShape.getSubpart2D(pb, laneShape.length2D()); //PositionVector ns = pb < (laneShape.length() - POSITION_EPS) ? laneShape.getSubpart2D(pb, laneShape.length()) : laneShape; - ns[0].set(ns[0].x(), ns[0].y(), startNode->getPosition().z()); + if (!startNode->geometryLike() || pb < 1) { + // make "real" intersections and small intersections flat + ns[0].setz(startNode->getPosition().z()); + // cutting and patching z-coordinate may cause steep grades which should be smoothed + const double dZ = ns.size() >= 2 ? fabs(ns[0].z() - ns[1].z()) : 0; + if (dZ > 0) { + ns = ns.smoothedZFront(MIN2(ns.length2D(), + dZ * 4 * OptionsCont::getOptions().getFloat("geometry.max-grade"))); + } + } assert(ns.size() >= 2); return ns; } else if (nodeShape.intersects(lb)) { // extension of first segment intersects - std::vector pbv = lb.intersectsAtLengths2D(nodeShape); + std::vector pbv = lb.intersectsAtLengths2D(nodeShape); assert(pbv.size() > 0); - SUMOReal pb = VectorHelper::maxValue(pbv); + double pb = VectorHelper::maxValue(pbv); assert(pb >= 0); PositionVector result = laneShape.getSubpartByIndex(1, (int)laneShape.size() - 1); Position np = PositionVector::positionAtOffset2D(lb[0], lb[1], pb); - result.push_front_noDoublePos(Position(np.x(), np.y(), startNode->getPosition().z())); + if (!startNode->geometryLike()) { + // make "real" intersections flat + np.setz(startNode->getPosition().z()); + } + result.push_front_noDoublePos(np); + const double dZ = result.size() >= 2 ? fabs(result[0].z() - result[1].z()) : 0; + if (dZ > 0) { + result = result.smoothedZFront(MIN2(result.length2D(), + dZ * 4 * OptionsCont::getOptions().getFloat("geometry.max-grade"))); + } return result; //if (result.size() >= 2) { // return result; @@ -723,18 +821,18 @@ void -NBEdge::reduceGeometry(const SUMOReal minDist) { +NBEdge::reduceGeometry(const double minDist) { myGeom.removeDoublePoints(minDist, true); } void -NBEdge::checkGeometry(const SUMOReal maxAngle, const SUMOReal minRadius, bool fix) { +NBEdge::checkGeometry(const double maxAngle, const double minRadius, bool fix) { if (myGeom.size() < 3) { return; } //std::cout << "checking geometry of " << getID() << " geometry = " << toString(myGeom) << "\n"; - std::vector angles; // absolute segment angles + std::vector angles; // absolute segment angles //std::cout << " absolute angles:"; for (int i = 0; i < (int)myGeom.size() - 1; ++i) { angles.push_back(myGeom.angleAt2D(i)); @@ -742,7 +840,7 @@ } //std::cout << "\n relative angles: "; for (int i = 0; i < (int)angles.size() - 1; ++i) { - const SUMOReal relAngle = fabs(GeomHelper::angleDiff(angles[i], angles[i + 1])); + const double relAngle = fabs(GeomHelper::angleDiff(angles[i], angles[i + 1])); //std::cout << relAngle << " "; if (maxAngle > 0 && relAngle > maxAngle) { WRITE_WARNING("Found angle of " + toString(RAD2DEG(relAngle)) + " degrees at edge '" + getID() + "', segment " + toString(i)); @@ -752,8 +850,8 @@ } if (i == 0 || i == (int)angles.size() - 2) { const bool start = i == 0; - const SUMOReal dist = (start ? myGeom[0].distanceTo2D(myGeom[1]) : myGeom[-2].distanceTo2D(myGeom[-1])); - const SUMOReal r = tan(0.5 * (M_PI - relAngle)) * dist; + const double dist = (start ? myGeom[0].distanceTo2D(myGeom[1]) : myGeom[-2].distanceTo2D(myGeom[-1])); + const double r = tan(0.5 * (M_PI - relAngle)) * dist; //std::cout << (start ? " start" : " end") << " length=" << dist << " radius=" << r << " "; if (minRadius > 0 && r < minRadius) { if (fix) { @@ -804,8 +902,8 @@ bool mayUseSameDestination, bool mayDefinitelyPass, bool keepClear, - SUMOReal contPos, - SUMOReal visibility) { + double contPos, + double visibility) { if (myStep == INIT_REJECT_CONNECTIONS) { return true; } @@ -845,8 +943,8 @@ bool mayUseSameDestination, bool mayDefinitelyPass, bool keepClear, - SUMOReal contPos, - SUMOReal visibility) { + double contPos, + double visibility) { if (myStep == INIT_REJECT_CONNECTIONS) { return false; } @@ -892,7 +990,7 @@ // yes, the connection was set using an algorithm which requires a recheck myStep = LANES2LANES_RECHECK; } else { - // ok, let's only not recheck it if we did no add something that has to be recheked + // ok, let's only not recheck it if we did no add something that has to be rechecked if (myStep != LANES2LANES_RECHECK) { myStep = LANES2LANES_DONE; } @@ -956,7 +1054,7 @@ bool -NBEdge::isConnectedTo(NBEdge* e) { +NBEdge::isConnectedTo(const NBEdge* e) const { if (e == myTurnDestination) { return true; } @@ -1017,6 +1115,19 @@ } +EdgeVector +NBEdge::getIncomingEdges() const { + EdgeVector ret; + const EdgeVector& candidates = myFrom->getIncomingEdges(); + for (EdgeVector::const_iterator i = candidates.begin(); i != candidates.end(); i++) { + if ((*i)->isConnectedTo(this)) { + ret.push_back(*i); + } + } + return ret; +} + + std::vector NBEdge::getConnectionLanes(NBEdge* currentOutgoing) const { std::vector ret; @@ -1060,8 +1171,10 @@ void -NBEdge::removeFromConnections(NBEdge* toEdge, int fromLane, int toLane, bool tryLater) { +NBEdge::removeFromConnections(NBEdge* toEdge, int fromLane, int toLane, bool tryLater, const bool adaptToLaneRemoval) { // remove from "myConnections" + const int fromLaneRemoved = adaptToLaneRemoval && fromLane >= 0 ? fromLane : -1; + const int toLaneRemoved = adaptToLaneRemoval && toLane >= 0 ? toLane : -1; for (std::vector::iterator i = myConnections.begin(); i != myConnections.end();) { Connection& c = *i; if ((toEdge == 0 || c.toEdge == toEdge) @@ -1076,6 +1189,20 @@ i = myConnections.erase(i); tryLater = false; } else { + if (fromLaneRemoved >= 0 && c.fromLane > fromLaneRemoved) { + c.fromLane--; + if (myTo->isTLControlled()) { + std::set tldefs = myTo->getControllingTLS(); + for (std::set::iterator it = tldefs.begin(); it != tldefs.end(); it++) { + for (NBConnectionVector::iterator tlcon = (*it)->getControlledLinks().begin(); tlcon != (*it)->getControlledLinks().end(); ++tlcon) { + tlcon->shiftLaneIndex(this, -1); + } + } + } + } + if (toLaneRemoved >= 0 && c.toLane > toLaneRemoved) { + c.toLane--; + } ++i; } } @@ -1263,7 +1390,7 @@ } // crossingPosition, list of foe link indices - std::pair > crossingPositions(-1, std::vector()); + std::pair > crossingPositions(-1, std::vector()); std::set tmpFoeIncomingLanes; switch (dir) { case LINKDIR_RIGHT: @@ -1286,11 +1413,11 @@ const PositionVector otherShape = n.computeInternalLaneShape(*i2, *k2, numPoints); // vehicles are typically less wide than the lane // they drive on but but bicycle lanes should be kept clear for their whole width - SUMOReal width2 = (*k2).toEdge->getLaneWidth((*k2).toLane); + double width2 = (*k2).toEdge->getLaneWidth((*k2).toLane); if ((*k2).toEdge->getPermissions((*k2).toLane) != SVC_BICYCLE) { width2 *= 0.5; } - const SUMOReal minDV = firstIntersection(shape, otherShape, width2); + const double minDV = firstIntersection(shape, otherShape, width2); if (minDV < shape.length() - POSITION_EPS && minDV > POSITION_EPS) { // !!!? assert(minDV >= 0); if (crossingPositions.first < 0 || crossingPositions.first > minDV) { @@ -1326,7 +1453,7 @@ // build internal junctions (not for left turns at uncontrolled intersections) PositionVector crossingShape = crossing.shape; crossingShape.extrapolate(1.0); // sometimes shapes miss each other by a small margin - const SUMOReal minDV = firstIntersection(shape, crossingShape, crossing.width / 2); + const double minDV = firstIntersection(shape, crossingShape, crossing.width / 2); if (minDV < shape.length() - POSITION_EPS && minDV > POSITION_EPS) { assert(minDV >= 0); if (crossingPositions.first < 0 || crossingPositions.first > minDV) { @@ -1342,7 +1469,7 @@ if (dir == LINKDIR_TURN && crossingPositions.first < 0 && crossingPositions.second.size() != 0 && shape.length() > 2. * POSITION_EPS) { // let turnarounds wait in the middle if no other crossing point was found and it has a sensible length // (if endOffset is used, the crossing point is in the middle of the part within the junction shape) - crossingPositions.first = (SUMOReal)(shape.length() + getEndOffset(con.fromLane)) / 2.; + crossingPositions.first = (double)(shape.length() + getEndOffset(con.fromLane)) / 2.; } } break; @@ -1363,13 +1490,13 @@ // @todo compute the maximum speed allowed based on angular velocity // see !!! for an explanation (with a_lat_mean ~0.3) /* - SUMOReal vmax = (SUMOReal) 0.3 * (SUMOReal) 9.80778 * + double vmax = (double) 0.3 * (double) 9.80778 * getLaneShape(con.fromLane).back().distanceTo( con.toEdge->getLaneShape(con.toLane).front()) - / (SUMOReal) 2.0 / (SUMOReal) M_PI; - vmax = MIN2(vmax, ((getSpeed() + con.toEdge->getSpeed()) / (SUMOReal) 2.0)); + / (double) 2.0 / (double) M_PI; + vmax = MIN2(vmax, ((getSpeed() + con.toEdge->getSpeed()) / (double) 2.0)); */ - SUMOReal vmax = (getSpeed() + con.toEdge->getSpeed()) / (SUMOReal) 2.0; + double vmax = (getSpeed() + con.toEdge->getSpeed()) / (double) 2.0; // Position end = con.toEdge->getLaneShape(con.toLane).front(); Position beg = getLaneShape(con.fromLane).back(); @@ -1399,9 +1526,9 @@ } -SUMOReal -NBEdge::firstIntersection(const PositionVector& v1, const PositionVector& v2, SUMOReal width2) { - SUMOReal intersect = std::numeric_limits::max(); +double +NBEdge::firstIntersection(const PositionVector& v1, const PositionVector& v2, double width2) { + double intersect = std::numeric_limits::max(); if (v2.length() < POSITION_EPS) { return intersect; } @@ -1412,7 +1539,7 @@ v2Left.move2side(-width2); // intersect center line of v1 with left and right border of v2 - std::vector tmp = v1.intersectsAtLengths2D(v2Right); + std::vector tmp = v1.intersectsAtLengths2D(v2Right); if (tmp.size() > 0) { intersect = MIN2(intersect, tmp[0]); } @@ -1445,7 +1572,7 @@ } -SUMOReal +double NBEdge::getAngleAtNode(const NBNode* const atNode) const { // myStartAngle, myEndAngle are in [0,360] and this returns results in [-180,180] if (atNode == myFrom) { @@ -1457,10 +1584,10 @@ } -SUMOReal +double NBEdge::getAngleAtNodeToCenter(const NBNode* const atNode) const { if (atNode == myFrom) { - SUMOReal res = myStartAngle - 180; + double res = myStartAngle - 180; if (res < 0) { res += 360; } @@ -1481,7 +1608,7 @@ } -SUMOReal +double NBEdge::getLaneSpeed(int lane) const { return myLanes[lane].speed; } @@ -1494,21 +1621,21 @@ return; } // compute lane offset, first - std::vector offsets(myLanes.size(), 0.); - SUMOReal offset = 0; + std::vector offsets(myLanes.size(), 0.); + double offset = 0; for (int i = (int)myLanes.size() - 2; i >= 0; --i) { offset += (getLaneWidth(i) + getLaneWidth(i + 1)) / 2. + SUMO_const_laneOffset; offsets[i] = offset; } if (myLaneSpreadFunction == LANESPREAD_RIGHT) { - SUMOReal laneWidth = myLanes.back().width != UNSPECIFIED_WIDTH ? myLanes.back().width : SUMO_const_laneWidth; + double laneWidth = myLanes.back().width != UNSPECIFIED_WIDTH ? myLanes.back().width : SUMO_const_laneWidth; offset = (laneWidth + SUMO_const_laneOffset) / 2.; // @todo: why is the lane offset counted in here? } else { - SUMOReal width = 0; + double width = 0; for (int i = 0; i < (int)myLanes.size(); ++i) { width += getLaneWidth(i); } - width += SUMO_const_laneOffset * SUMOReal(myLanes.size() - 1); + width += SUMO_const_laneOffset * double(myLanes.size() - 1); offset = -width / 2. + getLaneWidth((int)myLanes.size() - 1) / 2.; } for (int i = 0; i < (int)myLanes.size(); ++i) { @@ -1528,7 +1655,7 @@ PositionVector -NBEdge::computeLaneShape(int lane, SUMOReal offset) const { +NBEdge::computeLaneShape(int lane, double offset) const { PositionVector shape = myGeom; try { shape.move2side(offset); @@ -1566,26 +1693,35 @@ toCenter = myTo->getPosition(); } - const SUMOReal angleLookahead = MIN2(shape.length2D() / 2, ANGLE_LOOKAHEAD); + const double angleLookahead = MIN2(shape.length2D() / 2, ANGLE_LOOKAHEAD); const Position referencePosStart = shape.positionAtOffset2D(angleLookahead); myStartAngle = GeomHelper::legacyDegree(fromCenter.angleTo2D(referencePosStart), true); const Position referencePosEnd = shape.positionAtOffset2D(shape.length() - angleLookahead); myEndAngle = GeomHelper::legacyDegree(referencePosEnd.angleTo2D(toCenter), true); myTotalAngle = GeomHelper::legacyDegree(myFrom->getPosition().angleTo2D(myTo->getPosition()), true); +#ifdef DEBUG_ANGLES + if (DEBUGCOND) std::cout << "computeAngle edge=" << getID() << " fromCenter=" << fromCenter << " toCenter=" << toCenter + << " refStart=" << referencePosStart << " refEnd=" << referencePosEnd << " shape=" << shape + << " hasFromShape=" << hasFromShape + << " hasToShape=" << hasToShape + << " numLanes=" << getNumLanes() + << " shapeLane=" << getNumLanes() / 2 + << " startA=" << myStartAngle << " endA=" << myEndAngle << " totA=" << myTotalAngle << "\n"; +#endif } -SUMOReal +double NBEdge::getShapeStartAngle() const { - const SUMOReal angleLookahead = MIN2(myGeom.length2D() / 2, ANGLE_LOOKAHEAD); + const double angleLookahead = MIN2(myGeom.length2D() / 2, ANGLE_LOOKAHEAD); const Position referencePosStart = myGeom.positionAtOffset2D(angleLookahead); return GeomHelper::legacyDegree(myGeom.front().angleTo2D(referencePosStart), true); } -SUMOReal +double NBEdge::getShapeEndAngle() const { - const SUMOReal angleLookahead = MIN2(myGeom.length2D() / 2, ANGLE_LOOKAHEAD); + const double angleLookahead = MIN2(myGeom.length2D() / 2, ANGLE_LOOKAHEAD); const Position referencePosEnd = myGeom.positionAtOffset2D(myGeom.length() - angleLookahead); return GeomHelper::legacyDegree(referencePosEnd.angleTo2D(myGeom.back()), true); } @@ -1650,8 +1786,23 @@ bool +NBEdge::hasAccelLane() const { + for (std::vector::const_iterator i = myLanes.begin(); i != myLanes.end(); ++i) { + if (i->accelRamp) { + return true; + } + } + return false; +} + +bool NBEdge::needsLaneSpecificOutput() const { - return hasLaneSpecificPermissions() || hasLaneSpecificSpeed() || hasLaneSpecificWidth() || hasLaneSpecificEndOffset() || (!myLanes.empty() && myLanes.back().oppositeID != ""); + return (hasLaneSpecificPermissions() + || hasLaneSpecificSpeed() + || hasLaneSpecificWidth() + || hasLaneSpecificEndOffset() + || hasAccelLane() + || (!myLanes.empty() && myLanes.back().oppositeID != "")); } @@ -1663,14 +1814,12 @@ if (myStep >= EDGE2EDGES) { return true; } - if (myConnections.size() == 0) { - const EdgeVector& o = myTo->getOutgoingEdges(); - for (EdgeVector::const_iterator i = o.begin(); i != o.end(); ++i) { - if (noLeftMovers && myTo->isLeftMover(this, *i)) { - continue; - } - myConnections.push_back(Connection(-1, *i, -1)); + const EdgeVector& o = myTo->getOutgoingEdges(); + for (EdgeVector::const_iterator i = o.begin(); i != o.end(); ++i) { + if (noLeftMovers && myTo->isLeftMover(this, *i)) { + continue; } + myConnections.push_back(Connection(-1, *i, -1)); } myStep = EDGE2EDGES; return true; @@ -1783,6 +1932,29 @@ for (std::vector::iterator it = myConnectionsToDelete.begin(); it != myConnectionsToDelete.end(); ++it) { removeFromConnections(it->toEdge, it->fromLane, it->toLane); } + // check involuntary dead end at "real" junctions + if (getPermissions() != SVC_PEDESTRIAN) { + if (myConnections.empty() && myTo->getOutgoingEdges().size() > 1) { + WRITE_WARNING("Edge '" + getID() + "' is not connected to outgoing edges at junction '" + myTo->getID() + "'."); + } + const EdgeVector& incoming = myFrom->getIncomingEdges(); + if (incoming.size() > 1) { + for (int i = 0; i < (int)myLanes.size(); i++) { + if (getPermissions(i) != 0 && getPermissions(i) != SVC_PEDESTRIAN) { + bool connected = false; + for (std::vector::const_iterator in = incoming.begin(); in != incoming.end(); ++in) { + if ((*in)->hasConnectionTo(this, i)) { + connected = true; + break; + } + } + if (!connected) { + WRITE_WARNING("Lane '" + getID() + "_" + toString(i) + "' is not connected from any incoming edge at junction '" + myFrom->getID() + "'."); + } + } + } + } + } return true; } @@ -1875,19 +2047,19 @@ // compute the resulting number of lanes that should be used to // reach the following edge const int numOutgoing = (int) outgoing->size(); - std::vector resultingLanes; + std::vector resultingLanes; resultingLanes.reserve(numOutgoing); - SUMOReal sumResulting = 0.; // the sum of resulting lanes - SUMOReal minResulting = 10000.; // the least number of lanes to reach an edge + double sumResulting = 0.; // the sum of resulting lanes + double minResulting = 10000.; // the least number of lanes to reach an edge for (int i = 0; i < numOutgoing; i++) { // res will be the number of lanes which are meant to reach the // current outgoing edge - SUMOReal res = - (SUMOReal)(*priorities)[i] * - (SUMOReal) availableLanes.size() / (SUMOReal) prioSum; + double res = + (double)(*priorities)[i] * + (double) availableLanes.size() / (double) prioSum; // do not let this number be greater than the number of available lanes if (res > availableLanes.size()) { - res = (SUMOReal) availableLanes.size(); + res = (double) availableLanes.size(); } // add it to the list resultingLanes.push_back(res); @@ -1911,7 +2083,7 @@ assert(i < (int)resultingLanes.size()); const int tmpNum = (int)std::ceil(resultingLanes[i] / minResulting); numVirtual += tmpNum; - for (SUMOReal j = 0; j < tmpNum; j++) { + for (double j = 0; j < tmpNum; j++) { transition.push_back((*outgoing)[i]); } } @@ -1963,7 +2135,11 @@ } continue; } - + if (myLanes[fromIndex].connectionsDone) { + // we already have complete information about connections from + // this lane. do not add anything else + continue; + } myConnections.push_back(Connection(fromIndex, target, -1)); #ifdef DEBUG_CONNECTION_GUESSING if (DEBUGCOND) { @@ -2020,6 +2196,8 @@ && ((getPermissions(fromIndex) & target->getPermissions()) != 0) // more than pedestrians && ((getPermissions(fromIndex) & target->getPermissions()) != SVC_PEDESTRIAN) + // lane not yet fully defined + && !myLanes[fromIndex].connectionsDone ) { #ifdef DEBUG_CONNECTION_GUESSING if (DEBUGCOND) { @@ -2199,7 +2377,7 @@ NBNode* -NBEdge::tryGetNodeAtPosition(SUMOReal pos, SUMOReal tolerance) const { +NBEdge::tryGetNodeAtPosition(double pos, double tolerance) const { // return the from-node when the position is at the begin of the edge if (pos < tolerance) { return myFrom; @@ -2232,9 +2410,9 @@ } -SUMOReal +double NBEdge::getMaxLaneOffset() { - return (SUMOReal) SUMO_const_laneWidthAndOffset * myLanes.size(); + return (double) SUMO_const_laneWidthAndOffset * myLanes.size(); } @@ -2335,7 +2513,7 @@ PositionVector NBEdge::getCWBoundaryLine(const NBNode& n) const { PositionVector ret; - SUMOReal width; + double width; if (myFrom == (&n)) { // outgoing ret = myLanes[0].shape; @@ -2353,7 +2531,7 @@ PositionVector NBEdge::getCCWBoundaryLine(const NBNode& n) const { PositionVector ret; - SUMOReal width; + double width; if (myFrom == (&n)) { // outgoing ret = myLanes.back().shape; @@ -2456,6 +2634,7 @@ if (myLanes[i].origID != e->myLanes[i].origID) { myLanes[i].origID += " " + e->myLanes[i].origID; } + myLanes[i].connectionsDone = e->myLanes[i].connectionsDone; } // recompute length myLength += e->myLength; @@ -2466,6 +2645,7 @@ myPossibleTurnDestination = e->myPossibleTurnDestination; // set the node myTo = e->myTo; + myToBorder = e->myToBorder; if (e->getSignalOffset() != UNSPECIFIED_SIGNAL_OFFSET) { mySignalOffset = e->getSignalOffset(); } else { @@ -2508,10 +2688,10 @@ bool -NBEdge::isNearEnough2BeJoined2(NBEdge* e, SUMOReal threshold) const { - std::vector distances = myGeom.distances(e->getGeometry()); +NBEdge::isNearEnough2BeJoined2(NBEdge* e, double threshold) const { + std::vector distances = myGeom.distances(e->getGeometry()); assert(distances.size() > 0); - return VectorHelper::maxValue(distances) < threshold; + return VectorHelper::maxValue(distances) < threshold; } @@ -2554,9 +2734,9 @@ NBEdge::deleteLane(int index, bool recompute) { assert(index < (int)myLanes.size()); myLanes.erase(myLanes.begin() + index); - const EdgeVector& incs = myFrom->getIncomingEdges(); if (recompute) { computeLaneShapes(); + const EdgeVector& incs = myFrom->getIncomingEdges(); for (EdgeVector::const_iterator i = incs.begin(); i != incs.end(); ++i) { (*i)->invalidateConnections(true); } @@ -2624,7 +2804,7 @@ void -NBEdge::setLaneWidth(int lane, SUMOReal width) { +NBEdge::setLaneWidth(int lane, double width) { if (lane < 0) { // all lanes are meant... myLaneWidth = width; @@ -2639,7 +2819,7 @@ } -SUMOReal +double NBEdge::getLaneWidth(int lane) const { return myLanes[lane].width != UNSPECIFIED_WIDTH ? myLanes[lane].width @@ -2647,23 +2827,23 @@ } -SUMOReal +double NBEdge::getTotalWidth() const { - SUMOReal result = 0; + double result = 0; for (int i = 0; i < (int)myLanes.size(); i++) { result += getLaneWidth(i); } return result; } -SUMOReal +double NBEdge::getEndOffset(int lane) const { return myLanes[lane].endOffset != UNSPECIFIED_OFFSET ? myLanes[lane].endOffset : getEndOffset(); } void -NBEdge::setEndOffset(int lane, SUMOReal offset) { +NBEdge::setEndOffset(int lane, double offset) { if (lane < 0) { // all lanes are meant... myEndOffset = offset; @@ -2679,7 +2859,7 @@ void -NBEdge::setSpeed(int lane, SUMOReal speed) { +NBEdge::setSpeed(int lane, double speed) { if (lane < 0) { // all lanes are meant... mySpeed = speed; @@ -2693,6 +2873,13 @@ myLanes[lane].speed = speed; } +void +NBEdge::setAcceleration(int lane, bool accelRamp) { + assert(lane >= 0); + assert(lane < (int)myLanes.size()); + myLanes[lane].accelRamp = accelRamp; +} + void NBEdge::setPermissions(SVCPermissions permissions, int lane) { @@ -2738,7 +2925,7 @@ void -NBEdge::setLoadedLength(SUMOReal val) { +NBEdge::setLoadedLength(double val) { myLoadedLength = val; } @@ -2794,9 +2981,9 @@ } -SUMOReal +double NBEdge::getCrossingAngle(NBNode* node) { - SUMOReal angle = getAngleAtNode(node) + (getFromNode() == node ? 180.0 : 0.0); + double angle = getAngleAtNode(node) + (getFromNode() == node ? 180.0 : 0.0); if (angle < 0) { angle += 360.0; } @@ -2821,7 +3008,7 @@ void -NBEdge::addSidewalk(SUMOReal width) { +NBEdge::addSidewalk(double width) { addRestrictedLane(width, SVC_PEDESTRIAN); } @@ -2832,18 +3019,8 @@ } -bool -NBEdge::hatSidewalk() const { - if (myLanes[0].permissions == SVC_PEDESTRIAN) { - return true; - } else { - return false; - } -} - - void -NBEdge::addBikeLane(SUMOReal width) { +NBEdge::addBikeLane(double width) { addRestrictedLane(width, SVC_BICYCLE); } @@ -2854,18 +3031,8 @@ } -bool -NBEdge::hatBikelane() const { - if (myLanes[0].permissions == SVC_BICYCLE) { - return true; - } else { - return false; - } -} - - void -NBEdge::addRestrictedLane(SUMOReal width, SUMOVehicleClass vclass) { +NBEdge::addRestrictedLane(double width, SUMOVehicleClass vclass) { if (myLanes[0].permissions == vclass) { WRITE_WARNING("Edge '" + getID() + "' already has a dedicated lane for " + toString(vclass) + "s. Not adding another one."); return; @@ -2937,11 +3104,11 @@ if (myLaneSpreadFunction == LANESPREAD_CENTER && !isRailway(getPermissions())) { const int i = (node == myTo ? -1 : 0); const int i2 = (node == myTo ? 0 : -1); - const SUMOReal dist = myGeom[i].distanceTo2D(node->getPosition()); - const SUMOReal neededOffset = (getTotalWidth() + getNumLanes() * SUMO_const_laneOffset) / 2; - const SUMOReal dist2 = MIN2(myGeom.distance2D(other->getGeometry()[i2]), - other->getGeometry().distance2D(myGeom[i])); - const SUMOReal neededOffset2 = neededOffset + (other->getTotalWidth() + other->getNumLanes() * SUMO_const_laneOffset) / 2; + const double dist = myGeom[i].distanceTo2D(node->getPosition()); + const double neededOffset = (getTotalWidth() + getNumLanes() * SUMO_const_laneOffset) / 2; + const double dist2 = MIN2(myGeom.distance2D(other->getGeometry()[i2]), + other->getGeometry().distance2D(myGeom[i])); + const double neededOffset2 = neededOffset + (other->getTotalWidth() + other->getNumLanes() * SUMO_const_laneOffset) / 2; if (dist < neededOffset && dist2 < neededOffset2) { PositionVector tmp = myGeom; // @note this doesn't work well for vissim networks @@ -2957,9 +3124,9 @@ } -SUMOReal +double NBEdge::getFinalLength() const { - SUMOReal result = getLoadedLength(); + double result = getLoadedLength(); if (OptionsCont::getOptions().getBool("no-internal-links") && !hasLoadedLength()) { // use length to junction center even if a modified geometry was given PositionVector geom = cutAtIntersection(myGeom); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBEdge.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBEdge.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBEdge.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBEdge.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: NBEdge.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NBEdge.h 23967 2017-04-18 13:45:25Z namdre $ /// // The representation of a single edge during network building /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -129,7 +129,7 @@ PositionVector shape; /// @brief The speed allowed on this lane - SUMOReal speed; + double speed; /// @brief List of vehicle types that are allowed on this lane SVCPermissions permissions; @@ -138,16 +138,23 @@ SVCPermissions preferred; /// @brief This lane's offset to the intersection begin - SUMOReal endOffset; + double endOffset; /// @brief This lane's width - SUMOReal width; + double width; /// @brief An original ID, if given std::string origID; /// @brief An opposite lane ID, if given std::string oppositeID; + + /// @brief Whether this lane is an acceleration lane + bool accelRamp; + + /// @brief Whether connection information for this lane is already completed + // @note (see NIImporter_DlrNavteq::ConnectedLanesHandler) + bool connectionsDone; }; @@ -163,7 +170,12 @@ Connection(int fromLane_, NBEdge* toEdge_, int toLane_); /// @brief constructor with more parameters - Connection(int fromLane_, NBEdge* toEdge_, int toLane_, bool mayDefinitelyPass_, bool keepClear_, SUMOReal contPos_, SUMOReal visibility_, bool haveVia_ = false); + Connection(int fromLane_, NBEdge* toEdge_, int toLane_, bool mayDefinitelyPass_, + bool keepClear_ = true, + double contPos_ = UNSPECIFIED_CONTPOS, + double visibility_ = UNSPECIFIED_VISIBILITY_DISTANCE, + bool haveVia_ = false, + bool uncontrolled_ = false); /// @brief destructor ~Connection() { } @@ -190,10 +202,10 @@ bool keepClear; /// @brief custom position for internal junction on this connection - SUMOReal contPos; + double contPos; /// @brief custom foe visiblity for connection - SUMOReal visibility; + double visibility; /// @brief origin ID std::string origID; @@ -205,7 +217,7 @@ PositionVector shape; /// @brief maximun velocity - SUMOReal vmax; + double vmax; /// @brief check if Connection have a Via bool haveVia; @@ -214,7 +226,7 @@ std::string viaID; /// @brief Maximun velocity of via - SUMOReal viaVmax; + double viaVmax; /// @brief shape of via PositionVector viaShape; @@ -228,34 +240,40 @@ /// @brief The lane index of this internal lane within the internal edge int internalLaneIndex; - /// @brief get ID of internal lnae + /// @brief check if Connection is uncontrolled + bool uncontrolled; + + /// @brief get ID of internal lane std::string getInternalLaneID() const; + + /// @brief get string describing this connection + std::string getDescription(const NBEdge* parent) const; }; /// @brief unspecified lane width - static const SUMOReal UNSPECIFIED_WIDTH; + static const double UNSPECIFIED_WIDTH; /// @brief unspecified lane offset - static const SUMOReal UNSPECIFIED_OFFSET; + static const double UNSPECIFIED_OFFSET; /// @brief unspecified lane speed - static const SUMOReal UNSPECIFIED_SPEED; + static const double UNSPECIFIED_SPEED; /// @brief unspecified internal junction position - static const SUMOReal UNSPECIFIED_CONTPOS; + static const double UNSPECIFIED_CONTPOS; /// @brief unspecified foe visibility for connections - static const SUMOReal UNSPECIFIED_VISIBILITY_DISTANCE; + static const double UNSPECIFIED_VISIBILITY_DISTANCE; /// @brief no length override given - static const SUMOReal UNSPECIFIED_LOADED_LENGTH; + static const double UNSPECIFIED_LOADED_LENGTH; /// @brief unspecified signal offset - static const SUMOReal UNSPECIFIED_SIGNAL_OFFSET; + static const double UNSPECIFIED_SIGNAL_OFFSET; /// @brief the distance at which to take the default angle - static const SUMOReal ANGLE_LOOKAHEAD; + static const double ANGLE_LOOKAHEAD; /// @brief internal lane computation not yet done static const int UNSPECIFIED_INTERNAL_LANE_INDEX; @@ -287,8 +305,8 @@ */ NBEdge(const std::string& id, NBNode* from, NBNode* to, std::string type, - SUMOReal speed, int nolanes, int priority, - SUMOReal width, SUMOReal offset, + double speed, int nolanes, int priority, + double width, double offset, const std::string& streetName = "", LaneSpreadFunction spread = LANESPREAD_RIGHT); @@ -316,8 +334,8 @@ */ NBEdge(const std::string& id, NBNode* from, NBNode* to, std::string type, - SUMOReal speed, int nolanes, int priority, - SUMOReal width, SUMOReal offset, + double speed, int nolanes, int priority, + double width, double offset, PositionVector geom, const std::string& streetName = "", const std::string& origID = "", @@ -362,8 +380,8 @@ * @param[in] tryIgnoreNodePositions Does not add node geometries if geom.size()>=2 */ void reinit(NBNode* from, NBNode* to, const std::string& type, - SUMOReal speed, int nolanes, int priority, - PositionVector geom, SUMOReal width, SUMOReal offset, + double speed, int nolanes, int priority, + PositionVector geom, double width, double offset, const std::string& streetName, LaneSpreadFunction spread = LANESPREAD_RIGHT, bool tryIgnoreNodePositions = false); @@ -380,7 +398,7 @@ * @param[in] xoff The x-offset to apply * @param[in] yoff The y-offset to apply */ - void reshiftPosition(SUMOReal xoff, SUMOReal yoff); + void reshiftPosition(double xoff, double yoff); /// @brief mirror coordinates along the x-axis void mirrorX(); @@ -422,7 +440,7 @@ * The angle is computed in computeAngle() * @return This edge's start angle */ - inline SUMOReal getStartAngle() const { + inline double getStartAngle() const { return myStartAngle; } @@ -431,7 +449,7 @@ * The angle is computed in computeAngle() * @return This edge's end angle */ - inline SUMOReal getEndAngle() const { + inline double getEndAngle() const { return myEndAngle; } @@ -439,7 +457,7 @@ * @note only using edge shape * @return This edge's start angle */ - SUMOReal getShapeStartAngle() const; + double getShapeStartAngle() const; /** @brief Returns the angle at the end of the edge @@ -447,20 +465,20 @@ * @note The angle is computed in computeAngle() * @return This edge's end angle */ - SUMOReal getShapeEndAngle() const; + double getShapeEndAngle() const; /** @brief Returns the angle at the start of the edge * @note The angle is computed in computeAngle() * @return This edge's angle */ - inline SUMOReal getTotalAngle() const { + inline double getTotalAngle() const { return myTotalAngle; } /** @brief Returns the computed length of the edge * @return The edge's computed length */ - SUMOReal getLength() const { + double getLength() const { return myLength; } @@ -469,12 +487,12 @@ * @todo consolidate use of myLength and myLoaded length * @return The edge's specified length */ - SUMOReal getLoadedLength() const { + double getLoadedLength() const { return myLoadedLength > 0 ? myLoadedLength : myLength; } /// @brief get length that will be assigned to the lanes in the final network - SUMOReal getFinalLength() const; + double getFinalLength() const; /** @brief Returns whether a length was set explicitly * @return Wether the edge's length was specified @@ -486,7 +504,7 @@ /** @brief Returns the speed allowed on this edge * @return The maximum speed allowed on this edge */ - SUMOReal getSpeed() const { + double getSpeed() const { return mySpeed; } @@ -502,17 +520,17 @@ /** @brief Returns the default width of lanes of this edge * @return The width of lanes of this edge */ - SUMOReal getLaneWidth() const { + double getLaneWidth() const { return myLaneWidth; } /** @brief Returns the width of the lane of this edge * @return The width of the lane of this edge */ - SUMOReal getLaneWidth(int lane) const; + double getLaneWidth(int lane) const; /// @brief Returns the combined width of all lanes of this edge - SUMOReal getTotalWidth() const; + double getTotalWidth() const; /// @brief Returns the street name of this edge const std::string& getStreetName() const { @@ -527,22 +545,22 @@ /** @brief Returns the offset to the destination node * @return The offset to the destination node */ - SUMOReal getEndOffset() const { + double getEndOffset() const { return myEndOffset; } /** @brief Returns the offset to the destination node a the specified lane * @return The offset to the destination node */ - SUMOReal getEndOffset(int lane) const; + double getEndOffset(int lane) const; /// @brief Returns the offset of a traffic signal from the end of this edge - SUMOReal getSignalOffset() const { + double getSignalOffset() const { return mySignalOffset; } /// @brief sets the offset of a traffic signal from the end of this edge - void setSignalOffset(SUMOReal offset) { + void setSignalOffset(double offset) { mySignalOffset = offset; } @@ -567,7 +585,7 @@ std::set getPermissionVariants(int iStart, int iEnd) const; /// @brief return the angle for computing pedestrian crossings at the given node - SUMOReal getCrossingAngle(NBNode* node); + double getCrossingAngle(NBNode* node); /// @name Edge geometry access and computation //@{ @@ -591,6 +609,13 @@ */ bool hasDefaultGeometryEndpoints() const; + /** @brief Returns whether the geometry is terminated by the node positions + * This default may be violated by initializing with + * tryIgnoreNodePositions=true' or with setGeometry() + * non-default endpoints are useful to control the generated node shape + */ + bool hasDefaultGeometryEndpointAtNode(const NBNode* node) const; + /** @brief (Re)sets the edge's geometry * * Replaces the edge's prior geometry by the given. Then, computes @@ -614,6 +639,12 @@ */ void addGeometryPoint(int index, const Position& p); + /// @brief linearly extend the geometry at the given node + void extendGeometryAtNode(const NBNode* node, double maxExtent); + + /// @brief linearly extend the geometry at the given node + void shortenGeometryAtNode(const NBNode* node, double reduction); + /// @brief shift geometry at the given node to avoid overlap void shiftPositionAtNode(NBNode* node, NBEdge* opposite); @@ -657,14 +688,14 @@ /** @brief Removes points with a distance lesser than the given * @param[in] minDist The minimum distance between two position to keep the second */ - void reduceGeometry(const SUMOReal minDist); + void reduceGeometry(const double minDist); /** @brief Check the angles of successive geometry segments * @param[in] maxAngle The maximum angle allowed * @param[in] minRadius The minimum turning radius allowed at the start and end * @param[in] fix Whether to prune geometry points to avoid sharp turns at start and end */ - void checkGeometry(const SUMOReal maxAngle, const SUMOReal minRadius, bool fix); + void checkGeometry(const double maxAngle, const double minRadius, bool fix); //@} /// @name Setting and getting connections @@ -710,8 +741,8 @@ bool mayUseSameDestination = false, bool mayDefinitelyPass = false, bool keepClear = true, - SUMOReal contPos = UNSPECIFIED_CONTPOS, - SUMOReal visibility = UNSPECIFIED_VISIBILITY_DISTANCE); + double contPos = UNSPECIFIED_CONTPOS, + double visibility = UNSPECIFIED_VISIBILITY_DISTANCE); /** @brief Builds no connections starting at the given lanes * @@ -751,8 +782,8 @@ bool mayUseSameDestination = false, bool mayDefinitelyPass = false, bool keepClear = true, - SUMOReal contPos = UNSPECIFIED_CONTPOS, - SUMOReal visibility = UNSPECIFIED_VISIBILITY_DISTANCE); + double contPos = UNSPECIFIED_CONTPOS, + double visibility = UNSPECIFIED_VISIBILITY_DISTANCE); /// @brief insert a previously created NBEdge::connection void insertConnection(NBEdge::Connection connection); @@ -795,7 +826,7 @@ * @param[in] e The destination edge * @return Whether a connection to the specified edge exists */ - bool isConnectedTo(NBEdge* e); + bool isConnectedTo(const NBEdge* e) const; /** @brief Returns the connections * @return This edge's connections to following edges @@ -821,6 +852,11 @@ */ EdgeVector getConnectedEdges() const; + /** @brief Returns the list of incoming edges unsorted + * @return Connected predecessor edges + */ + EdgeVector getIncomingEdges() const; + /** @brief Returns the list of lanes that may be used to reach the given edge * @return Lanes approaching the given edge */ @@ -844,8 +880,9 @@ * @param[in] fromLane The lane from which connections shall be removed; -1 means remove all * @param[in] toLane The lane to which connections shall be removed; -1 means remove all * @param[in] tryLater If the connection does not exist, try again during recheckLanes() + * @param[in] adaptToLaneRemoval we are in the process of removing a complete lane, adapt all connections accordingly */ - void removeFromConnections(NBEdge* toEdge, int fromLane = -1, int toLane = -1, bool tryLater = false); + void removeFromConnections(NBEdge* toEdge, int fromLane = -1, int toLane = -1, bool tryLater = false, const bool adaptToLaneRemoval = false); /// @brief remove an existent connection of edge bool removeFromConnections(NBEdge::Connection connectionToRemove); @@ -925,7 +962,7 @@ int getJunctionPriority(const NBNode* const node) const; /// @brief set loaded lenght - void setLoadedLength(SUMOReal val); + void setLoadedLength(double val); /// @brief dimiss vehicle class information void dismissVehicleClassInformation(); @@ -953,6 +990,9 @@ /// @brief whether lanes differ in offset bool hasLaneSpecificEndOffset() const; + /// @brief whether one of the lanes is an acceleration lane + bool hasAccelLane() const; + /// @brief computes the edge (step1: computation of approached edges) bool computeEdge2Edges(bool noLeftMovers); @@ -975,10 +1015,10 @@ /** @brief Returns the node at the given edges length (using an epsilon) @note When no node is existing at the given position, 0 is returned The epsilon is a static member of NBEdge, should be setable via program options */ - NBNode* tryGetNodeAtPosition(SUMOReal pos, SUMOReal tolerance = 5.0) const; + NBNode* tryGetNodeAtPosition(double pos, double tolerance = 5.0) const; /// @brief get max lane offset - SUMOReal getMaxLaneOffset(); + double getMaxLaneOffset(); /// @brief Check if lanes were assigned bool lanesWereAssigned() const; @@ -1026,10 +1066,10 @@ std::string getLaneIDInsecure(int lane) const; /// @brief get lane speed - SUMOReal getLaneSpeed(int lane) const; + double getLaneSpeed(int lane) const; /// @brief Check if edge is near enought to be joined to another edge - bool isNearEnough2BeJoined2(NBEdge* e, SUMOReal threshold) const; + bool isNearEnough2BeJoined2(NBEdge* e, double threshold) const; /** @brief Returns the angle of the edge's geometry at the given node * @@ -1038,7 +1078,7 @@ * @param[in] node The node for which the edge's angle shall be returned * @return This edge's angle at the given node */ - SUMOReal getAngleAtNode(const NBNode* const node) const; + double getAngleAtNode(const NBNode* const node) const; /** @brief Returns the angle of from the node shape center to where the edge meets * the node shape @@ -1048,7 +1088,7 @@ * @param[in] node The node for which the edge's angle shall be returned * @return This edge's angle at the given node shape */ - SUMOReal getAngleAtNodeToCenter(const NBNode* const node) const; + double getAngleAtNodeToCenter(const NBNode* const node) const; /// @brief increment lane void incLaneNo(int by); @@ -1066,23 +1106,17 @@ void markAsInLane2LaneState(); /// @brief add a pedestrian sidewalk of the given width and shift existing connctions - void addSidewalk(SUMOReal width); + void addSidewalk(double width); /// @brief restore an previously added sidewalk void restoreSidewalk(std::vector oldLanes, PositionVector oldGeometry, std::vector oldConnections); - /// @brief check if current edge hat a sideWalk - bool hatSidewalk() const; - /// add a bicycle lane of the given width and shift existing connctions - void addBikeLane(SUMOReal width); + void addBikeLane(double width); /// @brief restore an previously added BikeLane void restoreBikelane(std::vector oldLanes, PositionVector oldGeometry, std::vector oldConnections); - /// @brief check if current edge hat a bikelane - bool hatBikelane() const; - /// @brief set allowed/disallowed classes for the given lane or for all lanes if -1 is given void setPermissions(SVCPermissions permissions, int lane = -1); @@ -1099,13 +1133,16 @@ void preferVehicleClass(int lane, SUMOVehicleClass vclass); /// @brief set lane specific width (negative lane implies set for all lanes) - void setLaneWidth(int lane, SUMOReal width); + void setLaneWidth(int lane, double width); /// @brief set lane specific end-offset (negative lane implies set for all lanes) - void setEndOffset(int lane, SUMOReal offset); + void setEndOffset(int lane, double offset); /// @brief set lane specific speed (negative lane implies set for all lanes) - void setSpeed(int lane, SUMOReal speed); + void setSpeed(int lane, double speed); + + /// @brief marks one lane as acceleration lane + void setAcceleration(int lane, bool accelRamp); /// @brief get the union of allowed classes over all lanes or for a specific lane SVCPermissions getPermissions(int lane = -1) const; @@ -1115,19 +1152,21 @@ // @brief returns a reference to the internal structure for the convenience of NETEDIT Lane& getLaneStruct(int lane) { + assert(lane >= 0); assert(lane < (int)myLanes.size()); return myLanes[lane]; } // @brief returns a reference to the internal structure for the convenience of NETEDIT const Lane& getLaneStruct(int lane) const { + assert(lane >= 0); assert(lane < (int)myLanes.size()); return myLanes[lane]; } /// @brief declares connections as fully loaded. This is needed to avoid recomputing connections if an edge has no connections intentionally. - void declareConnectionsAsLoaded() { - myStep = LANES2LANES_USER; + void declareConnectionsAsLoaded(EdgeBuildingStep step = LANES2LANES_USER) { + myStep = step; } /* @brief fill connection attributes shape, viaShape, ... @@ -1152,7 +1191,8 @@ PositionVector cutAtIntersection(const PositionVector& old) const; /// @brief Set Node border - void setNodeBorder(const NBNode* node, const Position& p); + void setNodeBorder(const NBNode* node, const Position& p, const Position& p2, bool rectangularCut); + void resetNodeBorder(const NBNode* node); private: /** @class ToEdgeConnectionsAdder @@ -1228,7 +1268,7 @@ }; /// @brief Computes the shape for the given lane - PositionVector computeLaneShape(int lane, SUMOReal offset) const; + PositionVector computeLaneShape(int lane, double offset) const; /// @brief compute lane shapes void computeLaneShapes(); @@ -1292,10 +1332,10 @@ void computeAngle(); /// @brief compute the first intersection point between the given lane geometries considering their rspective widths - static SUMOReal firstIntersection(const PositionVector& v1, const PositionVector& v2, SUMOReal width2); + static double firstIntersection(const PositionVector& v1, const PositionVector& v2, double width2); /// @brief add a lane of the given width, restricted to the given class and shift existing connections - void addRestrictedLane(SUMOReal width, SUMOVehicleClass vclass); + void addRestrictedLane(double width, SUMOVehicleClass vclass); /// @brief restore a restricted lane void restoreRestrictedLane(SUMOVehicleClass vclass, std::vector oldLanes, PositionVector oldGeometry, std::vector oldConnections); @@ -1313,20 +1353,20 @@ NBNode* myFrom, *myTo; /// @brief The length of the edge - SUMOReal myLength; + double myLength; /// @brief The angles of the edge /// @{ - SUMOReal myStartAngle; - SUMOReal myEndAngle; - SUMOReal myTotalAngle; + double myStartAngle; + double myEndAngle; + double myTotalAngle; /// @} /// @brief The priority of the edge int myPriority; /// @brief The maximal speed - SUMOReal mySpeed; + double mySpeed; /** @brief List of connections to following edges * @see Connection @@ -1355,10 +1395,10 @@ LaneSpreadFunction myLaneSpreadFunction; /// @brief This edges's offset to the intersection begin (will be applied to all lanes) - SUMOReal myEndOffset; + double myEndOffset; /// @brief This width of this edge's lanes - SUMOReal myLaneWidth; + double myLaneWidth; /** @brief Lane information * @see Lane @@ -1366,7 +1406,7 @@ std::vector myLanes; /// @brief An optional length to use (-1 if not valid) - SUMOReal myLoadedLength; + double myLoadedLength; /// @brief Information whether this is a junction-inner edge bool myAmInnerEdge; @@ -1391,7 +1431,7 @@ std::vector mySigns; /// @brief the offset of a traffic light signal from the end of this edge (-1 for None) - SUMOReal mySignalOffset; + double mySignalOffset; /// @brief intersection borders (because the node shape might be invalid) /// @{ @@ -1434,7 +1474,7 @@ class connections_toedge_finder { public: /// @brief constructor - connections_toedge_finder(NBEdge* const edge2find, bool hasFromLane = false) : + connections_toedge_finder(const NBEdge* const edge2find, bool hasFromLane = false) : myHasFromLane(hasFromLane), myEdge2Find(edge2find) { } @@ -1448,7 +1488,7 @@ const bool myHasFromLane; /// @brief edge to find - NBEdge* const myEdge2Find; + const NBEdge* const myEdge2Find; private: /// @brief invalidated assignment operator diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBFrame.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 09.05.2011 -/// @version $Id: NBFrame.cpp 21739 2016-10-18 12:00:49Z namdre $ +/// @version $Id: NBFrame.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Sets and checks options for netbuild /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,7 +37,6 @@ #include "NBEdgeCont.h" #include "NBTrafficLightLogicCont.h" #include "NBDistrictCont.h" -#include "NBDistribution.h" #include "NBRequest.h" #include "NBTypeCont.h" #include @@ -49,10 +48,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -69,7 +64,7 @@ oc.addSynonyme("default.lanewidth", "lanewidth", true); oc.addDescription("default.lanewidth", "Building Defaults", "The default width of lanes"); - oc.doRegister("default.speed", 'S', new Option_Float((SUMOReal) 13.9)); + oc.doRegister("default.speed", 'S', new Option_Float((double) 13.9)); oc.addSynonyme("default.speed", "speed", true); oc.addDescription("default.speed", "Building Defaults", "The default speed on an edge (in m/s)"); @@ -77,7 +72,7 @@ oc.addSynonyme("default.priority", "priority", true); oc.addDescription("default.priority", "Building Defaults", "The default priority of an edge"); - oc.doRegister("default.sidewalk-width", new Option_Float((SUMOReal) 2.0)); + oc.doRegister("default.sidewalk-width", new Option_Float((double) 2.0)); oc.addDescription("default.sidewalk-width", "Building Defaults", "The default width of added sidewalks"); oc.doRegister("default.disallow", new Option_String()); @@ -96,6 +91,10 @@ oc.doRegister("numerical-ids", new Option_Bool(false)); oc.addDescription("numerical-ids", "Processing", "Remaps alphanumerical IDs of nodes and edges to ensure that all IDs are integers"); + /// @todo not working for netgen + oc.doRegister("reserved-ids", new Option_FileName()); + oc.addDescription("reserved-ids", "Processing", "Ensures that generated ids do not included any of the typed IDs from FILE (SUMO-GUI selection file format)"); + if (!forNetgen) { oc.doRegister("dismiss-vclasses", new Option_Bool(false)); oc.addDescription("dismiss-vclasses", "Processing", "Removes vehicle class restrictions from imported edges"); @@ -144,6 +143,15 @@ oc.doRegister("geometry.junction-mismatch-threshold", new Option_Float(20)); oc.addDescription("geometry.junction-mismatch-threshold", "Processing", "Warn if the junction shape is to far away from the original node position"); + + oc.doRegister("geometry.check-overlap", new Option_Float(0)); + oc.addDescription("geometry.check-overlap", "Processing", "Warn if edges overlap by more than the given threshold value"); + + oc.doRegister("geometry.check-overlap.vertical-threshold", new Option_Float(4)); + oc.addDescription("geometry.check-overlap.vertical-threshold", "Processing", "Ignore overlapping edges if they are separated vertically by the given threshold."); + + oc.doRegister("geometry.max-grade", new Option_Float(10)); + oc.addDescription("geometry.max-grade", "Processing", "Warn about edge geometries with a grade in % above FLOAT. The threshold applies to roads with a speed limit of 50km/h and is scaled according to road speed."); } oc.doRegister("offset.disable-normalization", new Option_Bool(false)); @@ -222,11 +230,11 @@ oc.addDescription("sidewalks.guess", "Processing", "Guess pedestrian sidewalks based on edge speed"); - oc.doRegister("sidewalks.guess.max-speed", new Option_Float((SUMOReal) 13.89)); + oc.doRegister("sidewalks.guess.max-speed", new Option_Float((double) 13.89)); oc.addDescription("sidewalks.guess.max-speed", "Processing", "Add sidewalks for edges with a speed equal or below the given limit"); - oc.doRegister("sidewalks.guess.min-speed", new Option_Float((SUMOReal) 5.8)); + oc.doRegister("sidewalks.guess.min-speed", new Option_Float((double) 5.8)); oc.addDescription("sidewalks.guess.min-speed", "Processing", "Add sidewalks for edges with a speed above the given limit"); @@ -339,10 +347,10 @@ oc.doRegister("keep-edges.explicit", new Option_String()); oc.addSynonyme("keep-edges.explicit", "keep-edges"); - oc.addDescription("keep-edges.explicit", "Edge Removal", "Only keep edges in STR"); + oc.addDescription("keep-edges.explicit", "Edge Removal", "Only keep edges in STR or those which are kept due to other keep-edges or remove-edges options"); oc.doRegister("keep-edges.input-file", new Option_FileName()); - oc.addDescription("keep-edges.input-file", "Edge Removal", "Only keep edges in FILE (Each id on a single line. Selection files from SUMO-GUI are also supported)"); + oc.addDescription("keep-edges.input-file", "Edge Removal", "Only keep edges in FILE (Each id on a single line. Selection files from SUMO-GUI are also supported) or those which are kept due to other keep-edges or remove-edges options"); oc.doRegister("remove-edges.input-file", new Option_FileName()); oc.addDescription("remove-edges.input-file", "Edge Removal", "Remove edges in FILE. (Each id on a single line. Selection files from SUMO-GUI are also supported)"); @@ -402,7 +410,7 @@ oc.addSynonyme("ramps.max-ramp-speed", "ramp-guess.max-ramp-speed", true); oc.addDescription("ramps.max-ramp-speed", "Ramp Guessing", "Treat edges with speed > FLOAT as no ramps"); - oc.doRegister("ramps.min-highway-speed", new Option_Float((SUMOReal)(79 / 3.6))); + oc.doRegister("ramps.min-highway-speed", new Option_Float((double)(79 / 3.6))); oc.addSynonyme("ramps.min-highway-speed", "ramp-guess.min-highway-speed", true); oc.addDescription("ramps.min-highway-speed", "Ramp Guessing", "Treat edges with speed < FLOAT as no highways"); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBFrame.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 09.05.2011 -/// @version $Id: NBFrame.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NBFrame.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Sets and checks options for netbuild /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBHeightMapper.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBHeightMapper.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBHeightMapper.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBHeightMapper.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date Sept 2011 -/// @version $Id: NBHeightMapper.cpp 21440 2016-09-07 11:06:14Z behrisch $ +/// @version $Id: NBHeightMapper.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Set z-values for all network positions based on data from a height map /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,14 +41,17 @@ #include #ifdef HAVE_GDAL +#if __GNUC__ > 3 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" +#endif #include #include #include +#if __GNUC__ > 3 +#pragma GCC diagnostic pop +#endif #endif - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS // =========================================================================== // static members @@ -82,18 +85,18 @@ } -SUMOReal +double NBHeightMapper::getZ(const Position& geo) const { if (!ready()) { WRITE_WARNING("Cannot supply height since no height data was loaded"); return 0; } if (myRaster != 0) { - SUMOReal result = -1e6; + double result = -1e6; if (myBoundary.around(geo)) { const int xSize = int((myBoundary.xmax() - myBoundary.xmin()) / mySizeOfPixel.x() + .5); - const SUMOReal normX = (geo.x() - myBoundary.xmin()) / mySizeOfPixel.x(); - const SUMOReal normY = (geo.y() - myBoundary.ymax()) / mySizeOfPixel.y(); + const double normX = (geo.x() - myBoundary.xmin()) / mySizeOfPixel.x(); + const double normY = (geo.y() - myBoundary.ymax()) / mySizeOfPixel.y(); PositionVector corners; corners.push_back(Position(floor(normX) + 0.5, floor(normY) + 0.5, myRaster[(int)normY * xSize + (int)normX])); if (normX - floor(normX) > 0.5) { @@ -218,7 +221,7 @@ assert(cgeom->getNumPoints() == 4); PositionVector corners; for (int j = 0; j < 3; j++) { - Position pos((SUMOReal) cgeom->getX(j), (SUMOReal) cgeom->getY(j), (SUMOReal) cgeom->getZ(j)); + Position pos((double) cgeom->getX(j), (double) cgeom->getY(j), (double) cgeom->getZ(j)); corners.push_back(pos); myBoundary.add(pos); } @@ -364,7 +367,7 @@ } -SUMOReal +double NBHeightMapper::Triangle::getZ(const Position& geo) const { // en.wikipedia.org/wiki/Line-plane_intersection Position p0 = myCorners.front(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBHeightMapper.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBHeightMapper.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBHeightMapper.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBHeightMapper.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date Sept 2011 -/// @version $Id: NBHeightMapper.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NBHeightMapper.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Set z-values for all network positions based on data from a height map /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -86,7 +86,7 @@ } /// @brief returns height for the given geo coordinate (WGS84) - SUMOReal getZ(const Position& geo) const; + double getZ(const Position& geo) const; class QueryResult; /* @brief content class for the rtree. Since we wish to be able to use the @@ -107,7 +107,7 @@ bool contains(const Position& pos) const; /// @brief returns the projection of the give geoCoordinate (WGS84) onto triangle plane - SUMOReal getZ(const Position& geo) const; + double getZ(const Position& geo) const; /// @brief returns the normal vector for this triangles plane Position normalVector() const; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBHelpers.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBHelpers.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBHelpers.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBHelpers.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,7 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Tue, 20 Nov 2001 -/// @version $Id: NBHelpers.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NBHelpers.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Some mathematical helper methods /****************************************************************************/ @@ -44,16 +44,12 @@ #include "NBNode.h" #include "NBHelpers.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== -SUMOReal -NBHelpers::relAngle(SUMOReal angle1, SUMOReal angle2) { +double +NBHelpers::relAngle(double angle1, double angle2) { angle2 -= angle1; if (angle2 > 180) { angle2 = (360 - angle2) * -1; @@ -65,9 +61,9 @@ } -SUMOReal -NBHelpers::normRelAngle(SUMOReal angle1, SUMOReal angle2) { - SUMOReal rel = relAngle(angle1, angle2); +double +NBHelpers::normRelAngle(double angle1, double angle2) { + double rel = relAngle(angle1, angle2); if (rel + NUMERICAL_EPS >= 180) { return -180; } else { @@ -87,7 +83,7 @@ } -SUMOReal +double NBHelpers::distance(NBNode* node1, NBNode* node2) { return node1->getPosition().distanceTo(node2->getPosition()); } @@ -109,6 +105,22 @@ } } } + + +void +NBHelpers::loadPrefixedIDsFomFile(const std::string& file, const std::string prefix, std::set& into) { + std::ifstream strm(file.c_str()); + if (!strm.good()) { + throw ProcessError("Could not load IDs from '" + file + "'."); + } + while (strm.good()) { + std::string prefixedID; + strm >> prefixedID; + if (StringUtils::startsWith(prefixedID, prefix)) { + into.insert(prefixedID.substr(prefix.size())); + } + } +} /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBHelpers.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBHelpers.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBHelpers.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBHelpers.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Tue, 20 Nov 2001 -/// @version $Id: NBHelpers.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NBHelpers.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Some mathematical helper methods /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -53,21 +53,23 @@ */ class NBHelpers { public: - /** computes the relative angle between the two angles */ - static SUMOReal relAngle(SUMOReal angle1, SUMOReal angle2); + /// @brief computes the relative angle between the two angles + static double relAngle(double angle1, double angle2); - ///@brief ensure that reverse relAngles (>=179.999) always count as turnarounds (-180) - static SUMOReal normRelAngle(SUMOReal angle1, SUMOReal angle2); + /// @brief ensure that reverse relAngles (>=179.999) always count as turnarounds (-180) + static double normRelAngle(double angle1, double angle2); - /** converts the numerical id to its "normal" string representation */ + /// @brief converts the numerical id to its "normal" string representation static std::string normalIDRepresentation(const std::string& id); - /** returns the distance between both nodes */ - static SUMOReal distance(NBNode* node1, NBNode* node2); + /// @brief returns the distance between both nodes + static double distance(NBNode* node1, NBNode* node2); - /// @brief Add edge ids defined in file (either ID or edge::ID per line) into the given set + /// @brief Add edge ids defined in file (either ID or edge:ID per line) into the given set static void loadEdgesFromFile(const std::string& file, std::set& into); + /// @brief Add prefixed ids defined in file + static void loadPrefixedIDsFomFile(const std::string& file, const std::string prefix, std::set& into); }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBLinkPossibilityMatrix.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBLinkPossibilityMatrix.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBLinkPossibilityMatrix.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBLinkPossibilityMatrix.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NBLinkPossibilityMatrix.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NBLinkPossibilityMatrix.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A matric to describe whether two links are foes to each other /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBLoadedSUMOTLDef.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBLoadedSUMOTLDef.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBLoadedSUMOTLDef.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBLoadedSUMOTLDef.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,13 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Mar 2011 -/// @version $Id: NBLoadedSUMOTLDef.cpp 21210 2016-07-21 10:02:38Z behrisch $ +/// @version $Id: NBLoadedSUMOTLDef.cpp 23654 2017-03-24 12:21:55Z namdre $ /// // A complete traffic light logic loaded from a sumo-net. (opted to reimplement // since NBLoadedTLDef is quite vissim specific) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,10 +43,6 @@ #include "NBLoadedSUMOTLDef.h" #include "NBNode.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== @@ -315,7 +311,7 @@ for (std::vector::iterator i = myControlledNodes.begin(); i != myControlledNodes.end(); i++) { const std::vector& c = (*i)->getCrossings(); // set tl indices for crossings - (*i)->setCrossingTLIndices(noLinksAll); + (*i)->setCrossingTLIndices(getID(), noLinksAll); copy(c.begin(), c.end(), std::back_inserter(crossings)); noLinksAll += (int)c.size(); oldCrossings += (*i)->numCrossingsFromSumoNet(); @@ -390,7 +386,7 @@ for (NBConnectionVector::const_iterator it1 = myControlledLinks.begin(); it1 != myControlledLinks.end(); it1++) { const NBConnection& c1 = *it1; const int i1 = c1.getTLIndex(); - if (i1 == NBConnection::InvalidTlIndex || state[i1] != 'g' || c1.getFrom() == 0 || c1.getTo() == 0) { + if (i1 == NBConnection::InvalidTlIndex || (state[i1] != 'g' && state[i1] != 's') || c1.getFrom() == 0 || c1.getTo() == 0) { continue; } for (NBConnectionVector::const_iterator it2 = myControlledLinks.begin(); it2 != myControlledLinks.end(); it2++) { @@ -403,7 +399,7 @@ const bool rightTurnConflict = NBNode::rightTurnConflict( c1.getFrom(), c1.getTo(), c1.getFromLane(), c2.getFrom(), c2.getTo(), c2.getFromLane()); const bool forbidden = forbids(c2.getFrom(), c2.getTo(), c1.getFrom(), c1.getTo(), true, controlledWithin); - const bool isFoes = foes(c2.getFrom(), c2.getTo(), c1.getFrom(), c1.getTo()); + const bool isFoes = foes(c2.getFrom(), c2.getTo(), c1.getFrom(), c1.getTo()) && !c2.getFrom()->isTurningDirectionAt(c2.getTo()); if (forbidden || rightTurnConflict) { myNeedsContRelation.insert(StreamPair(c1.getFrom(), c1.getTo(), c2.getFrom(), c2.getTo())); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBLoadedSUMOTLDef.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBLoadedSUMOTLDef.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBLoadedSUMOTLDef.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBLoadedSUMOTLDef.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,13 +3,13 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mar 2011 -/// @version $Id: NBLoadedSUMOTLDef.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NBLoadedSUMOTLDef.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A complete traffic light logic loaded from a sumo-net. (opted to reimplement // since NBLoadedTLDef is quite vissim specific) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBLoadedTLDef.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBLoadedTLDef.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBLoadedTLDef.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBLoadedTLDef.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Tue, 29.05.2005 -/// @version $Id: NBLoadedTLDef.cpp 21210 2016-07-21 10:02:38Z behrisch $ +/// @version $Id: NBLoadedTLDef.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A loaded (complete) traffic light logic /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,10 +42,6 @@ #include "NBLoadedTLDef.h" #include "NBNode.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -96,12 +92,12 @@ } -std::vector +std::vector NBLoadedTLDef::SignalGroup::getTimes(SUMOTime cycleDuration) const { // within the phase container, we should have the green and red phases add their times - std::vector ret; // !!! time vector + std::vector ret; // !!! time vector for (std::vector::const_iterator i = myPhases.begin(); i != myPhases.end(); i++) { - ret.push_back((SUMOReal)(*i).myTime); + ret.push_back((double)(*i).myTime); } // further, we possibly should set the yellow phases if (myTYellow > 0) { @@ -111,7 +107,7 @@ if (time > cycleDuration) { time = time - cycleDuration; } - ret.push_back((SUMOReal) time); + ret.push_back((double) time); } } } @@ -296,7 +292,7 @@ MsgHandler::getWarningInstance()->clear(); // !!! NBLoadedTLDef::SignalGroupCont::const_iterator i; // compute the switching times - std::set tmpSwitchTimes; + std::set tmpSwitchTimes; for (i = mySignalGroups.begin(); i != mySignalGroups.end(); i++) { NBLoadedTLDef::SignalGroup* group = (*i).second; // needed later @@ -306,12 +302,12 @@ // copy the now valid times into the container // both the given red and green phases are added and also the // yellow times - std::vector gtimes = group->getTimes(myCycleDuration); - for (std::vector::const_iterator k = gtimes.begin(); k != gtimes.end(); k++) { + std::vector gtimes = group->getTimes(myCycleDuration); + for (std::vector::const_iterator k = gtimes.begin(); k != gtimes.end(); k++) { tmpSwitchTimes.insert(*k); } } - std::vector switchTimes; + std::vector switchTimes; copy(tmpSwitchTimes.begin(), tmpSwitchTimes.end(), back_inserter(switchTimes)); sort(switchTimes.begin(), switchTimes.end()); @@ -322,7 +318,7 @@ } // build the phases NBTrafficLightLogic* logic = new NBTrafficLightLogic(getID(), getProgramID(), noSignals, myOffset, myType); - for (std::vector::iterator l = switchTimes.begin(); l != switchTimes.end(); l++) { + for (std::vector::iterator l = switchTimes.begin(); l != switchTimes.end(); l++) { // compute the duration of the current phase int duration; if (l != switchTimes.end() - 1) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBLoadedTLDef.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBLoadedTLDef.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBLoadedTLDef.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBLoadedTLDef.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Sascha Krieg /// @date Fri, 29.04.2005 -/// @version $Id: NBLoadedTLDef.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NBLoadedTLDef.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A loaded (complete) traffic light logic /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -82,7 +82,7 @@ * @param[in] cycleDuration The duration of the complete cycle * @return The switch times of this signal */ - std::vector getTimes(SUMOTime cycleDuration) const; + std::vector getTimes(SUMOTime cycleDuration) const; /** @brief Sorts the phases */ void sortPhases(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBNetBuilder.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBNetBuilder.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBNetBuilder.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBNetBuilder.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ /// @author Michael Behrisch /// @author Walter Bamberger /// @date 20 Nov 2001 -/// @version $Id: NBNetBuilder.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NBNetBuilder.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Instance responsible for building networks /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,7 +41,6 @@ #include "NBTrafficLightLogicCont.h" #include "NBDistrictCont.h" #include "NBDistrict.h" -#include "NBDistribution.h" #include "NBRequest.h" #include "NBTypeCont.h" #include @@ -56,17 +55,14 @@ #include "NBAlgorithms_Ramps.h" #include "NBHeightMapper.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== NBNetBuilder::NBNetBuilder() : myEdgeCont(myTypeCont), - myHaveLoadedNetworkWithoutInternalEdges(false) { + myHaveLoadedNetworkWithoutInternalEdges(false), + myNetworkHaveCrossings(false) { } @@ -86,12 +82,9 @@ void -NBNetBuilder::compute(OptionsCont& oc, - const std::set& explicitTurnarounds, - bool removeElements) { +NBNetBuilder::compute(OptionsCont& oc, const std::set& explicitTurnarounds, bool mayAddOrRemove) { GeoConvHelper& geoConvHelper = GeoConvHelper::getProcessing(); - const bool lefthand = oc.getBool("lefthand"); if (lefthand) { mirrorX(); @@ -163,7 +156,7 @@ WRITE_MESSAGE(" Joined " + toString(numJoined) + " junction cluster(s)."); } // - if (removeElements) { + if (mayAddOrRemove) { int no = 0; const bool removeGeometryNodes = oc.exists("geometry.remove") && oc.getBool("geometry.remove"); before = SysUtils::getCurrentMillis(); @@ -199,7 +192,7 @@ } // @note: removing geometry can create similar edges so joinSimilarEdges must come afterwards // @note: likewise splitting can destroy similarities so joinSimilarEdges must come before - if (removeElements && oc.getBool("edges.join")) { + if (mayAddOrRemove && oc.getBool("edges.join")) { before = SysUtils::getCurrentMillis(); PROGRESS_BEGIN_MESSAGE("Joining similar edges"); myNodeCont.joinSimilarEdges(myDistrictCont, myEdgeCont, myTLLCont); @@ -211,7 +204,7 @@ PROGRESS_DONE_MESSAGE(); } // - if (oc.exists("geometry.split") && oc.getBool("geometry.split")) { + if (mayAddOrRemove && oc.exists("geometry.split") && oc.getBool("geometry.split")) { before = SysUtils::getCurrentMillis(); PROGRESS_BEGIN_MESSAGE("Splitting geometry edges"); myEdgeCont.splitGeometry(myNodeCont); @@ -225,12 +218,14 @@ // correct edge geometries to avoid overlap myNodeCont.avoidOverlap(); // guess ramps - if ((oc.exists("ramps.guess") && oc.getBool("ramps.guess")) || (oc.exists("ramps.set") && oc.isSet("ramps.set"))) { - before = SysUtils::getCurrentMillis(); - PROGRESS_BEGIN_MESSAGE("Guessing and setting on-/off-ramps"); - NBNodesEdgesSorter::sortNodesEdges(myNodeCont); - NBRampsComputer::computeRamps(*this, oc); - PROGRESS_TIME_MESSAGE(before); + if (mayAddOrRemove) { + if ((oc.exists("ramps.guess") && oc.getBool("ramps.guess")) || (oc.exists("ramps.set") && oc.isSet("ramps.set"))) { + before = SysUtils::getCurrentMillis(); + PROGRESS_BEGIN_MESSAGE("Guessing and setting on-/off-ramps"); + NBNodesEdgesSorter::sortNodesEdges(myNodeCont); + NBRampsComputer::computeRamps(*this, oc); + PROGRESS_TIME_MESSAGE(before); + } } // guess sidewalks if (oc.getBool("sidewalks.guess") || oc.getBool("sidewalks.guess.from-permissions")) { @@ -245,12 +240,10 @@ myEdgeCont.recheckPostProcessConnections(); // remap ids if wished - if (oc.getBool("numerical-ids")) { - int numChangedEdges = myEdgeCont.mapToNumericalIDs(); - int numChangedNodes = myNodeCont.mapToNumericalIDs(); - if (numChangedEdges + numChangedNodes > 0) { - WRITE_MESSAGE("Remapped " + toString(numChangedEdges) + " edge IDs and " + toString(numChangedNodes) + " node IDs."); - } + int numChangedEdges = myEdgeCont.remapIDs(oc.getBool("numerical-ids"), oc.isSet("reserved-ids")); + int numChangedNodes = myNodeCont.remapIDs(oc.getBool("numerical-ids"), oc.isSet("reserved-ids")); + if (numChangedEdges + numChangedNodes > 0) { + WRITE_MESSAGE("Remapped " + toString(numChangedEdges) + " edge IDs and " + toString(numChangedNodes) + " node IDs."); } // @@ -269,7 +262,6 @@ PROGRESS_TIME_MESSAGE(before); myEdgeCont.computeLaneShapes(); // - // PABLO PARTE IMPORTANTE before = SysUtils::getCurrentMillis(); PROGRESS_BEGIN_MESSAGE("Computing node shapes"); if (oc.exists("geometry.junction-mismatch-threshold")) { @@ -289,10 +281,10 @@ // APPLY SPEED MODIFICATIONS if (oc.exists("speed.offset")) { - const SUMOReal speedOffset = oc.getFloat("speed.offset"); - const SUMOReal speedFactor = oc.getFloat("speed.factor"); + const double speedOffset = oc.getFloat("speed.offset"); + const double speedFactor = oc.getFloat("speed.factor"); if (speedOffset != 0 || speedFactor != 1) { - const SUMOReal speedMin = oc.getFloat("speed.minimum"); + const double speedMin = oc.getFloat("speed.minimum"); before = SysUtils::getCurrentMillis(); PROGRESS_BEGIN_MESSAGE("Applying speed modifications"); for (std::map::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) { @@ -309,27 +301,31 @@ NBNodeTypeComputer::computeNodeTypes(myNodeCont); PROGRESS_TIME_MESSAGE(before); // - bool haveCrossings = false; + myNetworkHaveCrossings = false; if (oc.getBool("crossings.guess")) { - haveCrossings = true; + myNetworkHaveCrossings = true; int crossings = 0; for (std::map::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) { crossings += (*i).second->guessCrossings(); } WRITE_MESSAGE("Guessed " + toString(crossings) + " pedestrian crossings."); } - if (!haveCrossings) { + if (!myNetworkHaveCrossings) { // recheck whether we had crossings in the input for (std::map::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) { if (i->second->getCrossings().size() > 0) { - haveCrossings = true; + myNetworkHaveCrossings = true; break; } } } - if (oc.isDefault("no-internal-links") && !haveCrossings && myHaveLoadedNetworkWithoutInternalEdges) { + if (oc.isDefault("no-internal-links") && !myNetworkHaveCrossings && myHaveLoadedNetworkWithoutInternalEdges) { oc.set("no-internal-links", "true"); + } else if (!mayAddOrRemove && myNetworkHaveCrossings) { + // crossings added via netedit + oc.resetWritable(); + oc.set("no-internal-links", "false"); } // @@ -379,7 +375,7 @@ myEdgeCont.recheckLanes(); PROGRESS_TIME_MESSAGE(before); - if (haveCrossings && !oc.getBool("no-internal-links")) { + if (myNetworkHaveCrossings && !oc.getBool("no-internal-links")) { for (std::map::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) { i->second->buildCrossingsAndWalkingAreas(); } @@ -440,13 +436,13 @@ PROGRESS_TIME_MESSAGE(before); } + for (std::map::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) { + (*i).second->sortOutgoingConnectionsByIndex(); + } // FINISHING INNER EDGES if (!oc.getBool("no-internal-links")) { before = SysUtils::getCurrentMillis(); PROGRESS_BEGIN_MESSAGE("Building inner edges"); - for (std::map::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) { - (*i).second->sortOutgoingConnectionsByIndex(); - } // walking areas shall only be built if crossings are wished as well for (std::map::const_iterator i = myNodeCont.begin(); i != myNodeCont.end(); ++i) { (*i).second->buildInnerEdges(); @@ -454,8 +450,8 @@ PROGRESS_TIME_MESSAGE(before); } // PATCH NODE SHAPES - if (OptionsCont::getOptions().getFloat("junctions.scurve-stretch") > 0) { - // @note: notes have collected correction hints in buildInnerEdges() + if (oc.getFloat("junctions.scurve-stretch") > 0) { + // @note: nodes have collected correction hints in buildInnerEdges() before = SysUtils::getCurrentMillis(); PROGRESS_BEGIN_MESSAGE("stretching junctions to smooth geometries"); myEdgeCont.computeLaneShapes(); @@ -470,6 +466,26 @@ mirrorX(); }; + if (oc.exists("geometry.check-overlap") && oc.getFloat("geometry.check-overlap") > 0) { + before = SysUtils::getCurrentMillis(); + PROGRESS_BEGIN_MESSAGE("Checking overlapping edges"); + myEdgeCont.checkOverlap(oc.getFloat("geometry.check-overlap"), oc.getFloat("geometry.check-overlap.vertical-threshold")); + PROGRESS_TIME_MESSAGE(before); + } + if (oc.exists("geometry.max-grade") && oc.getFloat("geometry.max-grade") > 0 && geoConvHelper.getConvBoundary().getZRange() > 0) { + before = SysUtils::getCurrentMillis(); + PROGRESS_BEGIN_MESSAGE("Checking edge grade"); + // user input is in % + myEdgeCont.checkGrade(oc.getFloat("geometry.max-grade") / 100); + PROGRESS_TIME_MESSAGE(before); + } + if (oc.exists("ptstop-output") && oc.isSet("ptstop-output")) { + before = SysUtils::getCurrentMillis(); + PROGRESS_BEGIN_MESSAGE("Processing public transport stops"); + myPTStopCont.process(myEdgeCont); + PROGRESS_TIME_MESSAGE(before); + } + // report WRITE_MESSAGE("-----------------------------------------------------"); WRITE_MESSAGE("Summary:"); @@ -489,12 +505,287 @@ void +NBNetBuilder::computeSingleNode(NBNode* node, OptionsCont& oc, const std::set& explicitTurnarounds, bool mayAddOrRemove) { + + GeoConvHelper& geoConvHelper = GeoConvHelper::getProcessing(); + + const bool lefthand = oc.getBool("lefthand"); + if (lefthand) { + mirrorX(); + }; + + // MODIFYING THE SETS OF NODES AND EDGES + + // Removes edges that are connecting the same node + node->removeSelfLoops(myDistrictCont, myEdgeCont, myTLLCont); + // + if (oc.exists("remove-edges.isolated") && oc.getBool("remove-edges.isolated")) { + myNodeCont.removeIsolatedRoads(myDistrictCont, myEdgeCont, myTLLCont); + } + // + if (oc.exists("keep-edges.postload") && oc.getBool("keep-edges.postload")) { + if (oc.isSet("keep-edges.explicit") || oc.isSet("keep-edges.input-file")) { + myEdgeCont.removeUnwishedEdges(myDistrictCont); + } + } + if (oc.getBool("junctions.join") || (oc.exists("ramps.guess") && oc.getBool("ramps.guess"))) { + // preliminary geometry computations to determine the length of edges + // This depends on turning directions and sorting of edge list + // in case junctions are joined geometry computations have to be repeated + // preliminary roundabout computations to avoid damaging roundabouts via junctions.join or ramps.guess + NBTurningDirectionsComputer::computeTurnDirectionsForNode(node, false); + node->sortEdges(false); + myEdgeCont.computeLaneShapes(); + node->computeNodeShape(-1); + myEdgeCont.computeEdgeShapes(); + if (oc.getBool("roundabouts.guess")) { + myEdgeCont.guessRoundabouts(); + } + const std::set& roundabouts = myEdgeCont.getRoundabouts(); + for (std::set::const_iterator it_round = roundabouts.begin(); + it_round != roundabouts.end(); ++it_round) { + std::vector nodeIDs; + for (EdgeSet::const_iterator it_edge = it_round->begin(); it_edge != it_round->end(); ++it_edge) { + nodeIDs.push_back((*it_edge)->getToNode()->getID()); + } + myNodeCont.addJoinExclusion(nodeIDs); + } + } + // join junctions (may create new "geometry"-nodes so it needs to come before removing these + if (oc.exists("junctions.join-exclude") && oc.isSet("junctions.join-exclude")) { + myNodeCont.addJoinExclusion(oc.getStringVector("junctions.join-exclude")); + } + int numJoined = myNodeCont.joinLoadedClusters(myDistrictCont, myEdgeCont, myTLLCont); + if (oc.getBool("junctions.join")) { + numJoined += myNodeCont.joinJunctions(oc.getFloat("junctions.join-dist"), myDistrictCont, myEdgeCont, myTLLCont); + } + if (oc.getBool("junctions.join") || (oc.exists("ramps.guess") && oc.getBool("ramps.guess"))) { + // reset geometry to avoid influencing subsequent steps (ramps.guess) + myEdgeCont.computeLaneShapes(); + } + // + if (mayAddOrRemove) { + const bool removeGeometryNodes = oc.exists("geometry.remove") && oc.getBool("geometry.remove"); + // removeUnwishedNodes needs turnDirections. @todo: try to call this less often + NBTurningDirectionsComputer::computeTurnDirectionsForNode(node, false); + myNodeCont.removeUnwishedNodes(myDistrictCont, myEdgeCont, myTLLCont, removeGeometryNodes); + } + + // MOVE TO ORIGIN + // compute new boundary after network modifications have taken place + Boundary boundary; + boundary.add(node->getPosition()); + for (std::map::const_iterator it = myEdgeCont.begin(); it != myEdgeCont.end(); ++it) { + boundary.add(it->second->getGeometry().getBoxBoundary()); + } + geoConvHelper.setConvBoundary(boundary); + + if (!oc.getBool("offset.disable-normalization") && oc.isDefault("offset.x") && oc.isDefault("offset.y")) { + moveToOrigin(geoConvHelper, lefthand); + } + geoConvHelper.computeFinal(lefthand); // information needed for location element fixed at this point + + if (oc.exists("geometry.min-dist") && !oc.isDefault("geometry.min-dist")) { + myEdgeCont.reduceGeometries(oc.getFloat("geometry.min-dist")); + } + // @note: removing geometry can create similar edges so joinSimilarEdges must come afterwards + // @note: likewise splitting can destroy similarities so joinSimilarEdges must come before + if (mayAddOrRemove && oc.getBool("edges.join")) { + myNodeCont.joinSimilarEdges(myDistrictCont, myEdgeCont, myTLLCont); + } + if (oc.getBool("opposites.guess")) { + myEdgeCont.guessOpposites(); + } + // + if (mayAddOrRemove && oc.exists("geometry.split") && oc.getBool("geometry.split")) { + myEdgeCont.splitGeometry(myNodeCont); + } + // turning direction + NBTurningDirectionsComputer::computeTurnDirectionsForNode(node, true); + // correct edge geometries to avoid overlap + node->avoidOverlap(); + // guess ramps + if (mayAddOrRemove) { + if ((oc.exists("ramps.guess") && oc.getBool("ramps.guess")) || (oc.exists("ramps.set") && oc.isSet("ramps.set"))) { + node->sortEdges(false); + NBRampsComputer::computeRamps(*this, oc); + } + } + // guess sidewalks + if (oc.getBool("sidewalks.guess") || oc.getBool("sidewalks.guess.from-permissions")) { + myEdgeCont.guessSidewalks(oc.getFloat("default.sidewalk-width"), + oc.getFloat("sidewalks.guess.min-speed"), + oc.getFloat("sidewalks.guess.max-speed"), + oc.getBool("sidewalks.guess.from-permissions")); + } + + // check whether any not previously setable connections may be set now + myEdgeCont.recheckPostProcessConnections(); + + // remap ids if wished + myEdgeCont.remapIDs(oc.getBool("numerical-ids"), oc.isSet("reserved-ids")); + myNodeCont.remapIDs(oc.getBool("numerical-ids"), oc.isSet("reserved-ids")); + + // + if (oc.exists("geometry.max-angle")) { + myEdgeCont.checkGeometries( + DEG2RAD(oc.getFloat("geometry.max-angle")), + oc.getFloat("geometry.min-radius"), + oc.getBool("geometry.min-radius.fix")); + } + + // GEOMETRY COMPUTATION + // + node->sortEdges(false); + myEdgeCont.computeLaneShapes(); + // + if (oc.exists("geometry.junction-mismatch-threshold")) { + node->computeNodeShape(oc.getFloat("geometry.junction-mismatch-threshold")); + } else { + node->computeNodeShape(-1); + } + // + myEdgeCont.computeEdgeShapes(); + // resort edges based on the node and edge shapes + node->sortEdges(true); + NBTurningDirectionsComputer::computeTurnDirectionsForNode(node, false); + + // APPLY SPEED MODIFICATIONS + if (oc.exists("speed.offset")) { + const double speedOffset = oc.getFloat("speed.offset"); + const double speedFactor = oc.getFloat("speed.factor"); + if (speedOffset != 0 || speedFactor != 1) { + const double speedMin = oc.getFloat("speed.minimum"); + for (std::map::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) { + (*i).second->setSpeed(-1, MAX2((*i).second->getSpeed() * speedFactor + speedOffset, speedMin)); + } + } + } + + // CONNECTIONS COMPUTATION + // + NBNodeTypeComputer::computeSingleNodeType(node); + // + myNetworkHaveCrossings = false; + if (oc.getBool("crossings.guess")) { + myNetworkHaveCrossings = true; + int crossings = 0; + crossings += node->guessCrossings(); + } + if (!myNetworkHaveCrossings) { + // recheck whether we had crossings in the input + if (node->getCrossings().size() > 0) { + myNetworkHaveCrossings = true; + } + } + + if (oc.isDefault("no-internal-links") && !myNetworkHaveCrossings && myHaveLoadedNetworkWithoutInternalEdges) { + oc.set("no-internal-links", "true"); + } else if (!mayAddOrRemove && myNetworkHaveCrossings) { + // crossings added via netedit + oc.resetWritable(); + oc.set("no-internal-links", "false"); + } + + // + NBEdgePriorityComputer::computeEdgePrioritiesSingleNode(node); + // + myEdgeCont.computeEdge2Edges(oc.getBool("no-left-connections")); + // + if (oc.getBool("roundabouts.guess")) { + myEdgeCont.guessRoundabouts(); + } + myEdgeCont.markRoundabouts(); + // + myEdgeCont.computeLanes2Edges(); + // + node->computeLanes2Lanes(); + myEdgeCont.sortOutgoingLanesConnections(); + // + if (!oc.getBool("no-turnarounds")) { + myEdgeCont.appendTurnarounds(oc.getBool("no-turnarounds.tls")); + } else { + myEdgeCont.appendTurnarounds(explicitTurnarounds, oc.getBool("no-turnarounds.tls")); + } + // + myEdgeCont.recheckLanes(); + + if (myNetworkHaveCrossings && !oc.getBool("no-internal-links")) { + node->buildCrossingsAndWalkingAreas(); + } + + // GUESS TLS POSITIONS + if (oc.isSet("tls.set")) { + std::vector tlControlledNodes = oc.getStringVector("tls.set"); + TrafficLightType type = SUMOXMLDefinitions::TrafficLightTypes.get(oc.getString("tls.default-type")); + for (std::vector::const_iterator i = tlControlledNodes.begin(); i != tlControlledNodes.end(); ++i) { + if (node != 0) { + myNodeCont.setAsTLControlled(node, myTLLCont, type); + } + } + } + myNodeCont.guessTLs(oc, myTLLCont); + // + if (oc.getBool("tls.join")) { + myNodeCont.joinTLS(myTLLCont, oc.getFloat("tls.join-dist")); + } + + // COMPUTING RIGHT-OF-WAY AND TRAFFIC LIGHT PROGRAMS + // + myTLLCont.setTLControllingInformation(myEdgeCont, myNodeCont); + // + node->computeLogic(myEdgeCont, oc); + // + std::pair numbers = myTLLCont.computeLogics(oc); + std::string progCount = ""; + if (numbers.first != numbers.second) { + progCount = "(" + toString(numbers.second) + " programs) "; + } + // + if (oc.isSet("street-sign-output")) { + myEdgeCont.generateStreetSigns(); + } + + for (std::map::const_iterator i = myEdgeCont.begin(); i != myEdgeCont.end(); ++i) { + (*i).second->sortOutgoingConnectionsByIndex(); + } + // FINISHING INNER EDGES + if (!oc.getBool("no-internal-links")) { + // walking areas shall only be built if crossings are wished as well + node->buildInnerEdges(); + } + // PATCH NODE SHAPES + if (oc.getFloat("junctions.scurve-stretch") > 0) { + // @note: nodes have collected correction hints in buildInnerEdges() + myEdgeCont.computeLaneShapes(); + node->computeNodeShape(-1); + myEdgeCont.computeEdgeShapes(); + node->buildInnerEdges(); + } + if (lefthand) { + mirrorX(); + }; + + if (oc.exists("geometry.check-overlap") && oc.getFloat("geometry.check-overlap") > 0) { + myEdgeCont.checkOverlap(oc.getFloat("geometry.check-overlap"), oc.getFloat("geometry.check-overlap.vertical-threshold")); + } + if (oc.exists("geometry.max-grade") && oc.getFloat("geometry.max-grade") > 0 && geoConvHelper.getConvBoundary().getZRange() > 0) { + // user input is in % + myEdgeCont.checkGrade(oc.getFloat("geometry.max-grade") / 100); + } + if (oc.exists("ptstop-output") && oc.isSet("ptstop-output")) { + myPTStopCont.process(myEdgeCont); + } +} + + +void NBNetBuilder::moveToOrigin(GeoConvHelper& geoConvHelper, bool lefthand) { long before = SysUtils::getCurrentMillis(); PROGRESS_BEGIN_MESSAGE("Moving network to origin"); Boundary boundary = geoConvHelper.getConvBoundary(); - const SUMOReal x = -boundary.xmin(); - const SUMOReal y = -(lefthand ? boundary.ymax() : boundary.ymin()); + const double x = -boundary.xmin(); + const double y = -(lefthand ? boundary.ymax() : boundary.ymin()); //if (lefthand) { // y = boundary.ymax(); //} @@ -507,6 +798,9 @@ for (std::map::const_iterator i = myDistrictCont.begin(); i != myDistrictCont.end(); ++i) { (*i).second->reshiftPosition(x, y); } + for (std::map::const_iterator i = myPTStopCont.begin(); i != myPTStopCont.end(); ++i) { + (*i).second->reshiftPostion(x, y); + } geoConvHelper.moveConvertedBy(x, y); PROGRESS_TIME_MESSAGE(before); } @@ -528,7 +822,7 @@ bool -NBNetBuilder::transformCoordinates(Position& from, bool includeInBoundary, GeoConvHelper* from_srs) { +NBNetBuilder::transformCoordinate(Position& from, bool includeInBoundary, GeoConvHelper* from_srs) { Position orig(from); bool ok = GeoConvHelper::getProcessing().x2cartesian(from, includeInBoundary); if (ok) { @@ -537,7 +831,7 @@ if (from_srs != 0 && from_srs->usingGeoProjection()) { from_srs->cartesian2geo(orig); } - SUMOReal z = hm.getZ(orig); + double z = hm.getZ(orig); from = Position(from.x(), from.y(), z); } } @@ -547,12 +841,12 @@ bool NBNetBuilder::transformCoordinates(PositionVector& from, bool includeInBoundary, GeoConvHelper* from_srs) { - const SUMOReal maxLength = OptionsCont::getOptions().getFloat("geometry.max-segment-length"); + const double maxLength = OptionsCont::getOptions().getFloat("geometry.max-segment-length"); if (maxLength > 0 && from.size() > 1) { // transformation to cartesian coordinates must happen before we can check segment length PositionVector copy = from; for (int i = 0; i < (int) from.size(); i++) { - transformCoordinates(copy[i], false); + transformCoordinate(copy[i], false); } // check lengths and insert new points where needed (in the original // coordinate system) @@ -560,7 +854,7 @@ for (int i = 0; i < (int)copy.size() - 1; i++) { Position start = from[i + inserted]; Position end = from[i + inserted + 1]; - SUMOReal length = copy[i].distanceTo(copy[i + 1]); + double length = copy[i].distanceTo(copy[i + 1]); const Position step = (end - start) * (maxLength / length); int steps = 0; while (length > maxLength) { @@ -575,7 +869,7 @@ } bool ok = true; for (int i = 0; i < (int) from.size(); i++) { - ok = ok && transformCoordinates(from[i], includeInBoundary, from_srs); + ok = ok && transformCoordinate(from[i], includeInBoundary, from_srs); } return ok; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBNetBuilder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBNetBuilder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBNetBuilder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBNetBuilder.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,14 @@ /// @author Jakob Erdmann /// @author Sascha Krieg /// @author Michael Behrisch +/// @author Gregor Laemmel /// @date Fri, 29.04.2005 -/// @version $Id: NBNetBuilder.h 20896 2016-06-07 10:40:32Z behrisch $ +/// @version $Id: NBNetBuilder.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Instance responsible for building networks /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,6 +44,7 @@ #include "NBNode.h" #include "NBTrafficLightLogicCont.h" #include "NBDistrictCont.h" +#include "NBPTStopCont.h" #include @@ -119,7 +121,6 @@ /// @brief Destructor ~NBNetBuilder(); - /** @brief Initialises the storage by applying given options * * Options, mainly steering the acceptance of edges, are parsed @@ -130,69 +131,68 @@ */ void applyOptions(OptionsCont& oc); - /** @brief Performs the network building steps * * @param[in] oc Container that contains options for building * @param[in] explicitTurnarounds List of edge ids for which turn-arounds should be added (used by NETEDIT) - * @param[in] removeElements whether processing steps which cause nodes and edges to be removed shall be triggered + * @param[in] mayAddOrRemove whether processing steps which cause nodes and edges to be added or removed shall be triggered (used by netedit) * @exception ProcessError (recheck) */ - void compute(OptionsCont& oc, - const std::set& explicitTurnarounds = std::set(), - bool removeElements = true); - + void compute(OptionsCont& oc, const std::set& explicitTurnarounds = std::set(), bool mayAddOrRemove = true); + /** @brief Performs the network building steps only for a single Node + * + * @param[in] oc Container that contains options for building + * @param[in] explicitTurnarounds List of edge ids for which turn-arounds should be added (used by NETEDIT) + * @param[in] mayAddOrRemove whether processing steps which cause nodes and edges to be added or removed shall be triggered (used by netedit) + * @exception ProcessError (recheck) + */ + void computeSingleNode(NBNode* node, OptionsCont& oc, const std::set& explicitTurnarounds = std::set(), bool mayAddOrRemove = true); /// @name Retrieval of subcontainers /// @{ - - /** @brief Returns the edge container - * @return The edge container (reference) - */ + /// @brief Returns a reference to edge container NBEdgeCont& getEdgeCont() { return myEdgeCont; } - - /** @brief Returns the node container - * @return The node container (reference) - */ + /// @brief Returns a reference to the node container NBNodeCont& getNodeCont() { return myNodeCont; } - - /** @brief Returns the type container - * @return The type container (reference) - */ + /// @brief Returns a reference to the type container NBTypeCont& getTypeCont() { return myTypeCont; } - - /** @brief Returns the traffic light logics container - * @return The traffic light logics container (reference) - */ + /// @brief Returns a reference to the traffic light logics container NBTrafficLightLogicCont& getTLLogicCont() { return myTLLCont; } - - /** @brief Returns the districts container - * @return The districts container (reference) - */ + /// @brief Returns a reference the districts container NBDistrictCont& getDistrictCont() { return myDistrictCont; } - /// @} - /// @brief notify about style of loaded network + /// @brief Returns a reference to the pt stop container + NBPTStopCont& getPTStopCont() { + return myPTStopCont; + } + /// @} + + /// @brief notify about style of loaded network (Without internal edges void haveLoadedNetworkWithoutInternalEdges() { myHaveLoadedNetworkWithoutInternalEdges = true; } + /// @brief notify about style of loaded network (Without Crossings) + bool haveNetworkCrossings() { + return myNetworkHaveCrossings; + } + /** * @brief transforms loaded coordinates * handles projections, offsets (using GeoConvHelper) and import of height data (using NBHeightMapper) @@ -201,7 +201,7 @@ * @param[in] from_srs The spatial reference system of the input coordinate * @notde These methods are located outside of GeoConvHelper to avoid linker-dependencies on GDAL for libgeom */ - static bool transformCoordinates(Position& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0); + static bool transformCoordinate(Position& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0); static bool transformCoordinates(PositionVector& from, bool includeInBoundary = true, GeoConvHelper* from_srs = 0); @@ -213,12 +213,12 @@ class by_id_sorter { public: /// @brief constructor - explicit by_id_sorter() { } + explicit by_id_sorter() {} + /// @brief selection operator int operator()(const NBNode* n1, const NBNode* n2) const { return n1->getID() < n2->getID(); } - }; protected: @@ -237,9 +237,15 @@ /// @brief The used container for districts NBDistrictCont myDistrictCont; + /// @brief The used container for pt stops + NBPTStopCont myPTStopCont; + /// @brief whether a .net.xml without internal edges was loaded bool myHaveLoadedNetworkWithoutInternalEdges; + /// @brief flag to indicate that network has crossings + bool myNetworkHaveCrossings; + private: /// @brief shift network so its lower left corner is at 0,0 void moveToOrigin(GeoConvHelper& geoConvHelper, bool lefthand); @@ -253,7 +259,6 @@ /// @brief invalidated assignment operator NBNetBuilder& operator=(const NBNetBuilder& s); - }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBNodeCont.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBNodeCont.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBNodeCont.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBNodeCont.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -8,12 +8,12 @@ /// @author Michael Behrisch /// @author Sascha Krieg /// @date Tue, 20 Nov 2001 -/// @version $Id: NBNodeCont.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NBNodeCont.cpp 23810 2017-04-04 12:42:30Z behrisch $ /// // Container for nodes during the netbuilding process /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -58,10 +58,6 @@ #include "NBOwnTLDef.h" #include "NBNodeCont.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -117,8 +113,8 @@ NBNode* -NBNodeCont::retrieve(const Position& position, const SUMOReal offset) const { - const SUMOReal extOffset = offset + POSITION_EPS; +NBNodeCont::retrieve(const Position& position, const double offset) const { + const double extOffset = offset + POSITION_EPS; const float cmin[2] = {(float)(position.x() - extOffset), (float)(position.y() - extOffset)}; const float cmax[2] = {(float)(position.x() + extOffset), (float)(position.y() + extOffset)}; std::set into; @@ -180,8 +176,8 @@ void NBNodeCont::joinSimilarEdges(NBDistrictCont& dc, NBEdgeCont& ec, NBTrafficLightLogicCont& tlc) { // magic values - SUMOReal distanceThreshold = 7; // don't merge edges further apart - SUMOReal lengthThreshold = 0.10; // don't merge edges with higher relative length-difference + const double distanceThreshold = 7.; // don't merge edges further apart + const double lengthThreshold = 0.10; // don't merge edges with higher relative length-difference for (NodeCont::iterator i = myNodes.begin(); i != myNodes.end(); i++) { // count the edges to other nodes outgoing from the current node @@ -203,7 +199,7 @@ const NBEdge* const first = ev.front(); EdgeVector::const_iterator jci; // join candidate iterator for (jci = ev.begin() + 1; jci != ev.end(); ++jci) { - const SUMOReal relativeLengthDifference = fabs(first->getLoadedLength() - (*jci)->getLoadedLength()) / first->getLoadedLength(); + const double relativeLengthDifference = fabs(first->getLoadedLength() - (*jci)->getLoadedLength()) / first->getLoadedLength(); if ((!first->isNearEnough2BeJoined2(*jci, distanceThreshold)) || (relativeLengthDifference > lengthThreshold) || (fabs(first->getSpeed() - (*jci)->getSpeed()) >= 0.01) || // output accuracy @@ -395,7 +391,7 @@ // ----------- (Helper) methods for joining nodes void -NBNodeCont::generateNodeClusters(SUMOReal maxDist, NodeClusters& into) const { +NBNodeCont::generateNodeClusters(double maxDist, NodeClusters& into) const { std::set visited; for (NodeCont::const_iterator i = myNodes.begin(); i != myNodes.end(); i++) { std::vector toProc; @@ -407,7 +403,7 @@ while (!toProc.empty()) { NodeAndDist nodeAndDist = toProc.back(); NBNode* n = nodeAndDist.first; - SUMOReal dist = nodeAndDist.second; + double dist = nodeAndDist.second; toProc.pop_back(); if (visited.find(n) != visited.end()) { continue; @@ -505,7 +501,7 @@ int -NBNodeCont::joinJunctions(SUMOReal maxDist, NBDistrictCont& dc, NBEdgeCont& ec, NBTrafficLightLogicCont& tlc) { +NBNodeCont::joinJunctions(double maxDist, NBDistrictCont& dc, NBEdgeCont& ec, NBTrafficLightLogicCont& tlc) { NodeClusters cands; NodeClusters clusters; generateNodeClusters(maxDist, cands); @@ -529,7 +525,7 @@ ++j; // compute clusterDist for node (length of shortest edge which connects this node to the cluster) - SUMOReal clusterDist = std::numeric_limits::max(); + double clusterDist = std::numeric_limits::max(); for (EdgeVector::const_iterator it_edge = n->getOutgoingEdges().begin(); it_edge != n->getOutgoingEdges().end(); ++it_edge) { NBNode* neighbor = (*it_edge)->getToNode(); if (cluster.count(neighbor) != 0) { @@ -546,7 +542,7 @@ // (they have 1 neighbor in the cluster and at most 1 neighbor outside the cluster) std::set neighbors; std::set clusterNeigbors; - const SUMOReal pedestrianFringeThreshold = 1.0; + const double pedestrianFringeThreshold = 1.0; for (EdgeVector::const_iterator it_edge = n->getOutgoingEdges().begin(); it_edge != n->getOutgoingEdges().end(); ++it_edge) { NBNode* neighbor = (*it_edge)->getToNode(); if (cluster.count(neighbor) == 0) { @@ -595,8 +591,8 @@ } // check for clusters which are to complex and probably won't work very well // we count the incoming edges of the final junction - std::map finalIncomingAngles; - std::map finalOutgoingAngles; + std::map finalIncomingAngles; + std::map finalOutgoingAngles; std::vector nodeIDs; for (std::set::const_iterator j = cluster.begin(); j != cluster.end(); ++j) { nodeIDs.push_back((*j)->getID()); @@ -622,10 +618,10 @@ continue; } // check for incoming parallel edges - const SUMOReal PARALLEL_INCOMING_THRESHOLD = 10.0; + const double PARALLEL_INCOMING_THRESHOLD = 10.0; bool foundParallel = false; - for (std::map::const_iterator j = finalIncomingAngles.begin(); j != finalIncomingAngles.end() && !foundParallel; ++j) { - std::map::const_iterator k = j; + for (std::map::const_iterator j = finalIncomingAngles.begin(); j != finalIncomingAngles.end() && !foundParallel; ++j) { + std::map::const_iterator k = j; for (++k; k != finalIncomingAngles.end() && !foundParallel; ++k) { if (fabs(j->second - k->second) < PARALLEL_INCOMING_THRESHOLD) { WRITE_WARNING("Not joining junctions " + joinToStringSorting(nodeIDs, ',') + " because the cluster is too complex (parallel incoming " @@ -635,8 +631,8 @@ } } // check for outgoing parallel edges - for (std::map::const_iterator j = finalOutgoingAngles.begin(); j != finalOutgoingAngles.end() && !foundParallel; ++j) { - std::map::const_iterator k = j; + for (std::map::const_iterator j = finalOutgoingAngles.begin(); j != finalOutgoingAngles.end() && !foundParallel; ++j) { + std::map::const_iterator k = j; for (++k; k != finalOutgoingAngles.end() && !foundParallel; ++k) { if (fabs(j->second - k->second) < PARALLEL_INCOMING_THRESHOLD) { WRITE_WARNING("Not joining junctions " + joinToStringSorting(nodeIDs, ',') + " because the cluster is too complex (parallel outgoing " @@ -751,6 +747,10 @@ // connections to removed edges will be ignored for (std::vector::iterator k = conns.begin(); k != conns.end(); ++k) { e->addLane2LaneConnection((*k).fromLane, (*k).toEdge, (*k).toLane, NBEdge::L2L_USER, false, (*k).mayDefinitelyPass); + if ((*k).fromLane >= 0 && (*k).fromLane < e->getNumLanes() && e->getLaneStruct((*k).fromLane).connectionsDone) { + // @note (see NIImporter_DlrNavteq::ConnectedLanesHandler) + e->declareConnectionsAsLoaded(NBEdge::INIT); + } } } // remove original nodes @@ -812,7 +812,7 @@ int noIncoming = 0; int noOutgoing = 0; bool tooFast = false; - SUMOReal f = 0; + double f = 0; std::set seen; for (std::set::const_iterator j = c.begin(); j != c.end(); ++j) { const EdgeVector& edges = (*j)->getEdges(); @@ -822,7 +822,7 @@ } if ((*j)->hasIncoming(*k)) { ++noIncoming; - f += (SUMOReal)(*k)->getNumLanes() * (*k)->getLaneSpeed(0); + f += (double)(*k)->getNumLanes() * (*k)->getLaneSpeed(0); } else { ++noOutgoing; } @@ -871,7 +871,7 @@ // This assumes nodes are already joined if (oc.exists("tls.guess-signals") && oc.getBool("tls.guess-signals")) { // prepare candidate edges - const SUMOReal signalDist = oc.getFloat("tls.guess-signals.dist"); + const double signalDist = oc.getFloat("tls.guess-signals.dist"); for (std::map::const_iterator i = myNodes.begin(); i != myNodes.end(); ++i) { NBNode* node = (*i).second; if (node->isTLControlled() && node->geometryLike()) { @@ -1001,7 +1001,7 @@ void -NBNodeCont::joinTLS(NBTrafficLightLogicCont& tlc, SUMOReal maxdist) { +NBNodeCont::joinTLS(NBTrafficLightLogicCont& tlc, double maxdist) { std::vector > cands; generateNodeClusters(maxdist, cands); int index = 0; @@ -1095,15 +1095,20 @@ std::string NBNodeCont::getFreeID() { - // !!! not guaranteed to be free - std::string ret = "SUMOGenerated" + toString(size()); - assert(retrieve(ret) == 0); - return ret; + int counter = 0; + std::string freeID = "SUMOGenerated" + toString(counter); + // While there is a node with id equal to freeID + while (retrieve(freeID) != 0) { + // update counter and generate a new freeID + counter++; + freeID = "SUMOGenerated" + toString(counter); + } + return freeID; } void -NBNodeCont::computeNodeShapes(SUMOReal mismatchThreshold) { +NBNodeCont::computeNodeShapes(double mismatchThreshold) { for (NodeCont::iterator i = myNodes.begin(); i != myNodes.end(); i++) { (*i).second->computeNodeShape(mismatchThreshold); } @@ -1222,17 +1227,28 @@ int -NBNodeCont::mapToNumericalIDs() { - IDSupplier idSupplier("", getAllNames()); - std::vector toChange; +NBNodeCont::remapIDs(bool numericaIDs, bool reservedIDs) { + std::vector avoid = getAllNames(); + std::set reserve; + if (reservedIDs) { + NBHelpers::loadPrefixedIDsFomFile(OptionsCont::getOptions().getString("reserved-ids"), "node:", reserve); + avoid.insert(avoid.end(), reserve.begin(), reserve.end()); + } + IDSupplier idSupplier("", avoid); + std::set toChange; for (NodeCont::iterator it = myNodes.begin(); it != myNodes.end(); it++) { - try { - TplConvert::_str2int(it->first); - } catch (NumberFormatException&) { - toChange.push_back(it->second); + if (numericaIDs) { + try { + TplConvert::_str2long(it->first); + } catch (NumberFormatException&) { + toChange.insert(it->second); + } + } + if (reservedIDs && reserve.count(it->first) > 0) { + toChange.insert(it->second); } } - for (std::vector::iterator it = toChange.begin(); it != toChange.end(); ++it) { + for (std::set::iterator it = toChange.begin(); it != toChange.end(); ++it) { NBNode* node = *it; myNodes.erase(node->getID()); node->setID(idSupplier.getNext()); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBNodeCont.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBNodeCont.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBNodeCont.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBNodeCont.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Walter Bamberger /// @date Tue, 20 Nov 2001 -/// @version $Id: NBNodeCont.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NBNodeCont.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Container for nodes during the netbuilding process /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -65,24 +65,18 @@ /// @brief Constructor NBNodeCont(); - /// @brief Destructor ~NBNodeCont(); - - /// @name Insertion/removal/retrieval of nodes /// @{ - /** @brief Inserts a node into the map * @param[in] id The node's id * @param[in] position The node's position * @param[in] A district assigned to the node * @return Whether the node could be added (no other with the same id or position is stored) */ - bool insert(const std::string& id, const Position& position, - NBDistrict* district = 0); - + bool insert(const std::string& id, const Position& position, NBDistrict* district = 0); /** @brief Inserts a node into the map * @param[in] node The node to insert @@ -90,14 +84,12 @@ */ bool insert(NBNode* node); - /** @brief Removes the given node, deleting it * @param[in] node The node to delete and remove * @return Whether the node could be removed (existed) */ bool erase(NBNode* node); - /** @brief Removes the given node but does not delete it * @param[in] node The node to delete and remove * @param[in] remember Whether to keep the node for future reference @@ -111,36 +103,26 @@ */ NBNode* retrieve(const std::string& id) const; - /** @brief Returns the node with the given coordinates * @param[in] position The position at which the node to retrieve lies * @param[in] offset An offset which can be applied in the case positions are blurred * @return The node at the given position, or 0 if no such node exists */ - NBNode* retrieve(const Position& position, const SUMOReal offset = 0.) const; - + NBNode* retrieve(const Position& position, const double offset = 0.) const; - /** @brief Returns the pointer to the begin of the stored nodes - * @return The iterator to the beginning of stored nodes - */ + /// @brief Returns the pointer to the begin of the stored nodes std::map::const_iterator begin() const { return myNodes.begin(); } - - /** @brief Returns the pointer to the end of the stored nodes - * @return The iterator to the end of stored nodes - */ + /// @brief Returns the pointer to the end of the stored nodes std::map::const_iterator end() const { return myNodes.end(); } /// @} - - /// @name Methods for for joining nodes /// @{ - /* @brief add ids of nodes wich shall not be joined * @param[in] ids A list of ids to exclude from joining * @param[in] check Whether to check if these nodes are known @@ -148,28 +130,20 @@ */ void addJoinExclusion(const std::vector& ids, bool check = false); - /** @brief add ids of nodes which shall be joined into a single node * @param[in] cluster The cluster to add */ void addCluster2Join(std::set cluster); - - /** @brief Joins loaded junction clusters (see NIXMLNodesHandler) - */ + /// @brief Joins loaded junction clusters (see NIXMLNodesHandler) int joinLoadedClusters(NBDistrictCont& dc, NBEdgeCont& ec, NBTrafficLightLogicCont& tlc); - - /** @brief Joins junctions that are very close together - */ - int joinJunctions(SUMOReal maxDist, NBDistrictCont& dc, NBEdgeCont& ec, NBTrafficLightLogicCont& tlc); + /// @brief Joins junctions that are very close together + int joinJunctions(double maxDist, NBDistrictCont& dc, NBEdgeCont& ec, NBTrafficLightLogicCont& tlc); /// @} - - /// @name Adapting the input /// @{ - /** @brief Removes self-loop edges (edges where the source and the destination node are the same) * @param[in, opt. changed] dc The districts container to update * @param[in, opt. changed] ec The edge container to remove the edges from @@ -178,7 +152,6 @@ */ void removeSelfLoops(NBDistrictCont& dc, NBEdgeCont& ec, NBTrafficLightLogicCont& tc); - /** @brief Joins edges connecting the same nodes * @param[in, opt. changed] dc The districts container to update * @param[in, opt. changed] ec The edge container to remove the edges from @@ -187,12 +160,9 @@ */ void joinSimilarEdges(NBDistrictCont& dc, NBEdgeCont& ec, NBTrafficLightLogicCont& tlc); - - /** @brief fix overlap - */ + /// @brief fix overlap void avoidOverlap(); - /** @brief Removes sequences of edges that are not connected with a junction. * Simple roads without junctions sometimes remain when converting from OpenStreetMake, * but they make no sense. Remaining empty nodes are also deleted. @@ -203,7 +173,6 @@ */ void removeIsolatedRoads(NBDistrictCont& dc, NBEdgeCont& ec, NBTrafficLightLogicCont& tc); - /** @brief Removes "unwished" nodes * * Removes nodes if a) no incoming/outgoing edges exist or @@ -218,15 +187,11 @@ * @param[in] removeGeometryNodes Whether geometry nodes shall also be removed * @return The number of removed nodes */ - int removeUnwishedNodes(NBDistrictCont& dc, NBEdgeCont& ec, - NBTrafficLightLogicCont& tlc, bool removeGeometryNodes); + int removeUnwishedNodes(NBDistrictCont& dc, NBEdgeCont& ec, NBTrafficLightLogicCont& tlc, bool removeGeometryNodes); /// @} - - /// @name Methods for guessing/computing traffic lights /// @{ - /** @brief Guesses which junctions or junction clusters shall be controlled by tls * @param[in] oc The options that steer the guessing process * @param[filled] tlc The traffic lights control into which new traffic light definitions shall be stored @@ -234,14 +199,12 @@ */ void guessTLs(OptionsCont& oc, NBTrafficLightLogicCont& tlc); - /** @brief Builds clusters of tls-controlled junctions and joins the control if possible * @param[changed] tlc The traffic lights control for adding/removing new/prior tls * @param[in] maxdist The maximum distance between nodes for clustering * @todo Recheck exception handling */ - void joinTLS(NBTrafficLightLogicCont& tlc, SUMOReal maxdist); - + void joinTLS(NBTrafficLightLogicCont& tlc, double maxdist); /** @brief Sets the given node as being controlled by a tls * @param[in] node The node that shall be controlled by a tls @@ -253,36 +216,30 @@ void setAsTLControlled(NBNode* node, NBTrafficLightLogicCont& tlc, TrafficLightType type, std::string id = ""); /// @} - - /** @brief Renames the node. Throws exception if newID already exists - */ + /// @brief Renames the node. Throws exception if newID already exists void rename(NBNode* node, const std::string& newID); - /// divides the incoming lanes on outgoing lanes void computeLanes2Lanes(); /// build the list of outgoing edges and lanes void computeLogics(const NBEdgeCont& ec, OptionsCont& oc); - /** @brief Returns the number of known nodes - * @return The number of nodes stored in this container - */ + /// @brief Returns the number of nodes stored in this container int size() const { return (int) myNodes.size(); } - /** deletes all nodes */ + /// @brief deletes all nodes void clear(); - - + /// @brief generates a new node ID std::string getFreeID(); /** @brief Compute the junction shape for this node * @param[in] mismatchThreshold The threshold for warning about shapes which are away from myPosition */ - void computeNodeShapes(SUMOReal mismatchThreshold = -1); + void computeNodeShapes(double mismatchThreshold = -1); /** @brief Prints statistics about built nodes * @@ -291,11 +248,9 @@ */ void printBuiltNodesStatistics() const; - /// @brief get all node names std::vector getAllNames() const; - /* @brief analyzes a cluster of nodes which shall be joined * @param[in] cluster The nodes to be joined * @param[out] id The name for the new node @@ -303,8 +258,7 @@ * @param[out] hasTLS Whether the new node has a traffic light * @param[out] tlType The type of traffic light (if any) */ - void analyzeCluster(std::set cluster, std::string& id, Position& pos, - bool& hasTLS, TrafficLightType& type); + void analyzeCluster(std::set cluster, std::string& id, Position& pos, bool& hasTLS, TrafficLightType& type); /// @brief gets all joined clusters (see doc for myClusters2Join) void registerJoinedCluster(const std::set& cluster); @@ -314,7 +268,6 @@ return myJoinedClusters; } - /* @brief discards traffic lights * @param[in] geometryLike Whether only tls at geometry-like nodes shall be discarded */ @@ -325,18 +278,16 @@ mySplit.insert(node); } - /// @brief ensure that all node ids are integers - int mapToNumericalIDs(); + /// @brief remap node IDs accoring to options --numerical-ids and --reserved-ids + int remapIDs(bool numericaIDs, bool reservedIDs); private: - /// @name Helper methods for for joining nodes - /// @{ - /// @brief Definition of a node cluster container typedef std::vector > NodeClusters; - typedef std::pair NodeAndDist; - + typedef std::pair NodeAndDist; + /// @name Helper methods for for joining nodes + /// @{ /** @brief Builds node clusters * * A node cluster is made up from nodes which are near by (distance myExtractedNodes; - // @brief set of node ids which should not be joined + /// @brief set of node ids which should not be joined std::set myJoinExclusions; - // @brief loaded sets of node ids to join (cleared after use) + /// @brief loaded sets of node ids to join (cleared after use) std::vector > myClusters2Join; - // @brief sets of node ids which were joined + + /// @brief sets of node ids which were joined std::vector > myJoinedClusters; /// @brief ids found in loaded join clusters used for error checking diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBNode.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBNode.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBNode.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBNode.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: NBNode.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NBNode.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The representation of a single node /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -65,10 +65,6 @@ #include "NBTrafficLightLogicCont.h" #include "NBTrafficLightDefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // allow to extend a crossing across multiple edges #define EXTEND_CROSSING_ANGLE_THRESHOLD 35.0 // degrees // create intermediate walking areas if either of the following thresholds is exceeded @@ -86,8 +82,8 @@ // =========================================================================== const int NBNode::FORWARD(1); const int NBNode::BACKWARD(-1); -const SUMOReal NBNode::DEFAULT_CROSSING_WIDTH(4); -const SUMOReal NBNode::UNSPECIFIED_RADIUS = -1; +const double NBNode::DEFAULT_CROSSING_WIDTH(4); +const double NBNode::UNSPECIFIED_RADIUS = -1; // =========================================================================== // method definitions @@ -157,7 +153,7 @@ int dest) const { std::deque* ret = new std::deque(); int noLanes = (int) approachingLanes.size(); - // when only one lane is approached, we check, whether the SUMOReal-value + // when only one lane is approached, we check, whether the double-value // is assigned more to the left or right lane if (noLanes == 1) { ret->push_back(dest); @@ -180,7 +176,7 @@ return ret; } - // as due to the conversion of SUMOReal->uint the numbers will be lower + // as due to the conversion of double->uint the numbers will be lower // than they should be, we try to append to the left side first // // check whether the left boundary of the approached street has @@ -289,7 +285,7 @@ // ----------- Applying offset void -NBNode::reshiftPosition(SUMOReal xoff, SUMOReal yoff) { +NBNode::reshiftPosition(double xoff, double yoff) { myPosition.add(xoff, yoff, 0); myPoly.add(xoff, yoff, 0); } @@ -396,19 +392,9 @@ NBEdge* dummy = *j; WRITE_WARNING(" Removing self-looping edge '" + dummy->getID() + "'"); // get the list of incoming edges connected to the self-loop - EdgeVector incomingConnected; - for (EdgeVector::const_iterator i = myIncomingEdges.begin(); i != myIncomingEdges.end(); i++) { - if ((*i)->isConnectedTo(dummy) && *i != dummy) { - incomingConnected.push_back(*i); - } - } + EdgeVector incomingConnected = dummy->getIncomingEdges();; // get the list of outgoing edges connected to the self-loop - EdgeVector outgoingConnected; - for (EdgeVector::const_iterator i = myOutgoingEdges.begin(); i != myOutgoingEdges.end(); i++) { - if (dummy->isConnectedTo(*i) && *i != dummy) { - outgoingConnected.push_back(*i); - } - } + EdgeVector outgoingConnected = dummy->getConnectedEdges(); // let the self-loop remap its connections dummy->remapConnections(incomingConnected); remapRemoved(tc, dummy, incomingConnected, outgoingConnected); @@ -476,8 +462,8 @@ const PositionVector& endShape, int numPoints, bool isTurnaround, - SUMOReal extrapolateBeg, - SUMOReal extrapolateEnd, + double extrapolateBeg, + double extrapolateEnd, NBNode* recordError) const { bool ok = true; @@ -493,7 +479,7 @@ ret.push_back(endShape.front()); return ret; } else { - return bezier(init, numPoints); + return bezier(init, numPoints).smoothedZFront(); } } @@ -502,14 +488,15 @@ const PositionVector& begShape, const PositionVector& endShape, bool isTurnaround, - SUMOReal extrapolateBeg, - SUMOReal extrapolateEnd, + double extrapolateBeg, + double extrapolateEnd, bool& ok, - NBNode* recordError) { + NBNode* recordError, + double straightThresh) { const Position beg = begShape.back(); const Position end = endShape.front(); - const SUMOReal dist = beg.distanceTo2D(end); + const double dist = beg.distanceTo2D(end); PositionVector init; if (dist < POSITION_EPS || beg.distanceTo2D(begShape[-2]) < POSITION_EPS || end.distanceTo2D(endShape[1]) < POSITION_EPS) { #ifdef DEBUG_SMOOTH_GEOM @@ -528,21 +515,21 @@ // - end of incoming lane // - position between incoming/outgoing end/begin shifted by the distance orthogonally // - begin of outgoing lane - Position center = PositionVector::positionAtOffset2D(beg, end, beg.distanceTo2D(end) / (SUMOReal) 2.); + Position center = PositionVector::positionAtOffset2D(beg, end, beg.distanceTo2D(end) / (double) 2.); center.sub(beg.y() - end.y(), end.x() - beg.x()); init.push_back(center); } else { - const SUMOReal angle = GeomHelper::angleDiff(begShape.angleAt2D(-2), endShape.angleAt2D(0)); + const double angle = GeomHelper::angleDiff(begShape.angleAt2D(-2), endShape.angleAt2D(0)); PositionVector endShapeBegLine(endShape[0], endShape[1]); PositionVector begShapeEndLineRev(begShape[-1], begShape[-2]); endShapeBegLine.extrapolate2D(100, true); begShapeEndLineRev.extrapolate2D(100, true); if (fabs(angle) < M_PI / 4.) { // very low angle: could be an s-shape or a straight line - const SUMOReal displacementAngle = GeomHelper::angleDiff(begShape.angleAt2D(-2), beg.angleTo2D(end)); - const SUMOReal bendDeg = RAD2DEG(fabs(displacementAngle - angle)); - const SUMOReal halfDistance = dist / 2; - if (fabs(displacementAngle) <= DEG2RAD(5)) { + const double displacementAngle = GeomHelper::angleDiff(begShape.angleAt2D(-2), beg.angleTo2D(end)); + const double bendDeg = RAD2DEG(fabs(displacementAngle - angle)); + const double halfDistance = dist / 2; + if (fabs(displacementAngle) <= straightThresh && fabs(angle) <= straightThresh) { #ifdef DEBUG_SMOOTH_GEOM if (DEBUGCOND) std::cout << " bezierControlPoints identified straight line beg=" << beg << " end=" << end << " angle=" << RAD2DEG(angle) << " displacementAngle=" << RAD2DEG(displacementAngle) << "\n"; @@ -560,14 +547,14 @@ #endif ok = false; if (recordError != 0) { - recordError->myDisplacementError = MAX2(recordError->myDisplacementError, (SUMOReal)fabs(sin(displacementAngle) * dist)); + recordError->myDisplacementError = MAX2(recordError->myDisplacementError, (double)fabs(sin(displacementAngle) * dist)); } return PositionVector(); } else { - const SUMOReal endLength = begShape[-2].distanceTo2D(begShape[-1]); - const SUMOReal off1 = endLength + MIN2(extrapolateBeg, halfDistance); + const double endLength = begShape[-2].distanceTo2D(begShape[-1]); + const double off1 = endLength + MIN2(extrapolateBeg, halfDistance); init.push_back(PositionVector::positionAtOffset2D(begShapeEndLineRev[1], begShapeEndLineRev[0], off1)); - const SUMOReal off2 = 100. - MIN2(extrapolateEnd, halfDistance); + const double off2 = 100. - MIN2(extrapolateEnd, halfDistance); init.push_back(PositionVector::positionAtOffset2D(endShapeBegLine[0], endShapeBegLine[1], off2)); #ifdef DEBUG_SMOOTH_GEOM if (DEBUGCOND) std::cout << " bezierControlPoints found s-curve beg=" << beg << " end=" << end @@ -591,11 +578,11 @@ ok = false; if (recordError != 0) { // it's unclear if this error can be solved via stretching the intersection. - recordError->myDisplacementError = MAX2(recordError->myDisplacementError, (SUMOReal)1.0); + recordError->myDisplacementError = MAX2(recordError->myDisplacementError, (double)1.0); } return PositionVector(); } - const SUMOReal minControlLength = MIN2((SUMOReal)1.0, dist / 2); + const double minControlLength = MIN2((double)1.0, dist / 2); const bool lengthenBeg = intersect.distanceTo2D(beg) <= minControlLength; const bool lengthenEnd = intersect.distanceTo2D(end) <= minControlLength; if (lengthenBeg && lengthenEnd) { @@ -605,7 +592,7 @@ #endif if (recordError != 0) { // This should be fixable with minor stretching - recordError->myDisplacementError = MAX2(recordError->myDisplacementError, (SUMOReal)1.0); + recordError->myDisplacementError = MAX2(recordError->myDisplacementError, (double)1.0); } ok = false; return PositionVector(); @@ -613,10 +600,10 @@ init.push_back(begShapeEndLineRev.positionAtOffset2D(100 - minControlLength)); init.push_back(endShapeBegLine.positionAtOffset2D(100 - minControlLength)); } else { - SUMOReal z; - const SUMOReal z1 = begShapeEndLineRev.positionAtOffset2D(begShapeEndLineRev.nearest_offset_to_point2D(intersect)).z(); - const SUMOReal z2 = endShapeBegLine.positionAtOffset2D(endShapeBegLine.nearest_offset_to_point2D(intersect)).z(); - const SUMOReal z3 = 0.5 * (beg.z() + end.z()); + double z; + const double z1 = begShapeEndLineRev.positionAtOffset2D(begShapeEndLineRev.nearest_offset_to_point2D(intersect)).z(); + const double z2 = endShapeBegLine.positionAtOffset2D(endShapeBegLine.nearest_offset_to_point2D(intersect)).z(); + const double z3 = 0.5 * (beg.z() + end.z()); // if z1 and z2 are on the same side in regard to z3 then we // can use their avarage. Otherwise, the intersection in 3D // is not good and we are better of using z3 @@ -639,10 +626,10 @@ PositionVector NBNode::computeInternalLaneShape(NBEdge* fromE, const NBEdge::Connection& con, int numPoints, NBNode* recordError) const { if (con.fromLane >= fromE->getNumLanes()) { - throw ProcessError("Connection '" + fromE->getID() + "_" + toString(con.fromLane) + "->" + con.toEdge->getID() + "_" + toString(con.toLane) + "' starts at a non-existant lane."); + throw ProcessError("Connection '" + con.getDescription(fromE) + "' starts at a non-existant lane."); } if (con.toLane >= con.toEdge->getNumLanes()) { - throw ProcessError("Connection '" + fromE->getID() + "_" + toString(con.fromLane) + "->" + con.toEdge->getID() + "_" + toString(con.toLane) + "' targets a non-existant lane."); + throw ProcessError("Connection '" + con.getDescription(fromE) + "' targets a non-existant lane."); } PositionVector ret; if (myCustomLaneShapes.size() > 0 && con.internalLaneIndex != NBEdge::UNSPECIFIED_INTERNAL_LANE_INDEX) { @@ -665,8 +652,8 @@ ret = computeSmoothShape(fromE->getLaneShape(con.fromLane), con.toEdge->getLaneShape(con.toLane), numPoints, fromE->getTurnDestination() == con.toEdge, - (SUMOReal) 5. * (SUMOReal) fromE->getNumLanes(), - (SUMOReal) 5. * (SUMOReal) con.toEdge->getNumLanes(), recordError); + (double) 5. * (double) fromE->getNumLanes(), + (double) 5. * (double) con.toEdge->getNumLanes(), recordError); const NBEdge::Lane& lane = fromE->getLaneStruct(con.fromLane); if (lane.endOffset > 0) { PositionVector beg = lane.shape.getSubpart(lane.shape.length() - lane.endOffset, lane.shape.length());; @@ -712,7 +699,7 @@ return false; } if (c.tlID != "" && !bothLeft) { - assert(myTrafficLights.size() > 0); + assert(myTrafficLights.size() > 0 || myType == NODETYPE_RAIL_CROSSING || myType == NODETYPE_RAIL_SIGNAL); for (std::set::const_iterator it = myTrafficLights.begin(); it != myTrafficLights.end(); ++it) { if ((*it)->needsCont(fromE, toE, otherFromE, otherToE)) { return true; @@ -733,12 +720,16 @@ myRequest = 0; if (myIncomingEdges.size() == 0 || myOutgoingEdges.size() == 0) { // no logic if nothing happens here - myType = NODETYPE_NOJUNCTION; + myType = NODETYPE_DEAD_END; std::set trafficLights = myTrafficLights; // make a copy because we will modify the original - removeTrafficLights(); for (std::set::const_iterator i = trafficLights.begin(); i != trafficLights.end(); ++i) { - (*i)->setParticipantsInformation(); - (*i)->setTLControllingInformation(); + // if this is the only controlled node we keep the tlDef as it is to generate a warning later + if ((*i)->getNodes().size() > 1) { + myTrafficLights.erase(*i); + (*i)->removeNode(this); + (*i)->setParticipantsInformation(); + (*i)->setTLControllingInformation(); + } } return; } @@ -787,7 +778,7 @@ void -NBNode::computeNodeShape(SUMOReal mismatchThreshold) { +NBNode::computeNodeShape(double mismatchThreshold) { if (myHaveCustomPoly) { return; } @@ -862,10 +853,10 @@ && in2->isConnectedTo(out) && isLongEnough(out, MIN_WEAVE_LENGTH)) { // for internal: check which one is the rightmost - SUMOReal a1 = in1->getAngleAtNode(this); - SUMOReal a2 = in2->getAngleAtNode(this); - SUMOReal ccw = GeomHelper::getCCWAngleDiff(a1, a2); - SUMOReal cw = GeomHelper::getCWAngleDiff(a1, a2); + double a1 = in1->getAngleAtNode(this); + double a2 = in2->getAngleAtNode(this); + double ccw = GeomHelper::getCCWAngleDiff(a1, a2); + double cw = GeomHelper::getCWAngleDiff(a1, a2); if (ccw > cw) { std::swap(in1, in2); std::swap(in1Offset, in2Offset); @@ -928,7 +919,7 @@ } } // special case f): - // one in, one out, same number of lanes + // one in, one out, out has reduced or same number of lanes if (myIncomingEdges.size() == 1 && myOutgoingEdges.size() == 1) { NBEdge* in = myIncomingEdges[0]; NBEdge* out = myOutgoingEdges[0]; @@ -937,14 +928,17 @@ // will be added later or not... return; } - const int inOffset = MAX2(0, in->getFirstNonPedestrianLaneIndex(FORWARD, true)); + int inOffset = MAX2(0, in->getFirstNonPedestrianLaneIndex(FORWARD, true)); const int outOffset = MAX2(0, out->getFirstNonPedestrianLaneIndex(FORWARD, true)); + const int reduction = (in->getNumLanes() - inOffset) - (out->getNumLanes() - outOffset); if (in->getStep() <= NBEdge::LANES2EDGES - && in->getNumLanes() - inOffset == out->getNumLanes() - outOffset + && reduction >= 0 && in != out && in->isConnectedTo(out)) { - for (int i = inOffset; i < in->getNumLanes(); ++i) { - in->setConnection(i, out, i - inOffset + outOffset, NBEdge::L2L_COMPUTED); + // in case of reduced lane number, let the rightmost lanse end + inOffset += reduction; + for (int i = outOffset; i < out->getNumLanes(); ++i) { + in->setConnection(i + inOffset - outOffset, out, i, NBEdge::L2L_COMPUTED); } //std::cout << " special case f at node=" << getID() << " inOffset=" << inOffset << " outOffset=" << outOffset << "\n"; return; @@ -991,7 +985,7 @@ if ((incoming->getPermissions(fromLane) & unsatisfied) != 0) { for (int toLane = 0; toLane < currentOutgoing->getNumLanes(); ++toLane) { const SVCPermissions satisfied = incoming->getPermissions(fromLane) & currentOutgoing->getPermissions(toLane) & unsatisfied; - if (satisfied != 0) { + if (satisfied != 0 && !incoming->getLaneStruct(fromLane).connectionsDone) { incoming->setConnection((int)fromLane, currentOutgoing, toLane, NBEdge::L2L_COMPUTED); //std::cout << " new connection from=" << fromLane << " to=" << currentOutgoing->getID() << "_" << toLane << " satisfies=" << getVehicleClassNames(satisfied) << "\n"; unsatisfied &= ~satisfied; @@ -1040,8 +1034,8 @@ } bool -NBNode::isLongEnough(NBEdge* out, SUMOReal minLength) { - SUMOReal seen = out->getLoadedLength(); +NBNode::isLongEnough(NBEdge* out, double minLength) { + double seen = out->getLoadedLength(); while (seen < minLength) { // advance along trivial continuations if (out->getToNode()->getOutgoingEdges().size() != 1 @@ -1104,7 +1098,7 @@ replaceOutgoing(*i, by, laneOff); laneOff += (*i)->getNumLanes(); } - // removed SUMOReal occurences + // removed double occurences removeDoubleEdges(); // check whether this node belongs to a district and the edges // must here be also remapped @@ -1136,7 +1130,7 @@ replaceIncoming(*i, by, laneOff); laneOff += (*i)->getNumLanes(); } - // removed SUMOReal occurences + // removed double occurences removeDoubleEdges(); // check whether this node belongs to a district and the edges // must here be also remapped @@ -1331,17 +1325,17 @@ NBNode* conn = (*i)->getFromNode(); Position toAdd = conn->getPosition(); toAdd.sub(myPosition); - toAdd.mul((SUMOReal) 1.0 / sqrt(toAdd.x()*toAdd.x() + toAdd.y()*toAdd.y())); + toAdd.mul((double) 1.0 / sqrt(toAdd.x()*toAdd.x() + toAdd.y()*toAdd.y())); pos.add(toAdd); } for (i = myOutgoingEdges.begin(); i != myOutgoingEdges.end(); i++) { NBNode* conn = (*i)->getToNode(); Position toAdd = conn->getPosition(); toAdd.sub(myPosition); - toAdd.mul((SUMOReal) 1.0 / sqrt(toAdd.x()*toAdd.x() + toAdd.y()*toAdd.y())); + toAdd.mul((double) 1.0 / sqrt(toAdd.x()*toAdd.x() + toAdd.y()*toAdd.y())); pos.add(toAdd); } - pos.mul((SUMOReal) - 1.0 / (myIncomingEdges.size() + myOutgoingEdges.size())); + pos.mul((double) - 1.0 / (myIncomingEdges.size() + myOutgoingEdges.size())); if (pos.x() == 0 && pos.y() == 0) { pos = Position(1, 0); } @@ -1426,8 +1420,8 @@ (lefthand && fromLane >= prohibitorFromLane)) { return false; } - const SUMOReal toAngleAtNode = fmod(to->getStartAngle() + 180, (SUMOReal)360.0); - const SUMOReal prohibitorToAngleAtNode = fmod(prohibitorTo->getStartAngle() + 180, (SUMOReal)360.0); + const double toAngleAtNode = fmod(to->getStartAngle() + 180, (double)360.0); + const double prohibitorToAngleAtNode = fmod(prohibitorTo->getStartAngle() + 180, (double)360.0); return (lefthand != (GeomHelper::getCWAngleDiff(from->getEndAngle(), toAngleAtNode) < GeomHelper::getCWAngleDiff(from->getEndAngle(), prohibitorToAngleAtNode))); } @@ -1441,10 +1435,10 @@ if (myIncomingEdges.size() == 1 || myOutgoingEdges.size() == 1) { return false; } - SUMOReal fromAngle = from->getAngleAtNode(this); - SUMOReal toAngle = to->getAngleAtNode(this); - SUMOReal cw = GeomHelper::getCWAngleDiff(fromAngle, toAngle); - SUMOReal ccw = GeomHelper::getCCWAngleDiff(fromAngle, toAngle); + double fromAngle = from->getAngleAtNode(this); + double toAngle = to->getAngleAtNode(this); + double cw = GeomHelper::getCWAngleDiff(fromAngle, toAngle); + double ccw = GeomHelper::getCCWAngleDiff(fromAngle, toAngle); std::vector::const_iterator i = std::find(myAllEdges.begin(), myAllEdges.end(), from); do { NBContHelper::nextCW(myAllEdges, i); @@ -1562,7 +1556,7 @@ return leftHand ? LINKDIR_TURN_LEFTHAND : LINKDIR_TURN; } // get the angle between incoming/outgoing at the junction - SUMOReal angle = + double angle = NBHelpers::normRelAngle(incoming->getAngleAtNode(this), outgoing->getAngleAtNode(this)); // ok, should be a straight connection if (abs((int) angle) + 1 < 45) { @@ -1903,10 +1897,10 @@ return 0; } else { // check whether the edges may be part of a common crossing due to having similar angle - SUMOReal prevAngle = -100000; // dummy + double prevAngle = -100000; // dummy for (int i = 0; i < (int)candidates.size(); ++i) { NBEdge* edge = candidates[i]; - SUMOReal angle = edge->getCrossingAngle(this); + double angle = edge->getCrossingAngle(this); // edges should be sorted by angle but this only holds true approximately if (i > 0 && fabs(angle - prevAngle) > EXTEND_CROSSING_ANGLE_THRESHOLD) { if (gDebugFlag1) { @@ -1914,7 +1908,7 @@ } return 0; } - if (!isTLControlled() && edge->getSpeed() > OptionsCont::getOptions().getFloat("crossings.guess.speed-threshold")) { + if (!isTLControlled() && myType != NODETYPE_RAIL_CROSSING && edge->getSpeed() > OptionsCont::getOptions().getFloat("crossings.guess.speed-threshold")) { if (gDebugFlag1) { std::cout << "no crossing added (uncontrolled, edge with speed > " << edge->getSpeed() << ")\n"; } @@ -1930,16 +1924,16 @@ return 1; } else { // check for intermediate walking areas - SUMOReal prevAngle = -100000; // dummy + double prevAngle = -100000; // dummy for (EdgeVector::iterator it = candidates.begin(); it != candidates.end(); ++it) { - SUMOReal angle = (*it)->getCrossingAngle(this); + double angle = (*it)->getCrossingAngle(this); if (it != candidates.begin()) { NBEdge* prev = *(it - 1); NBEdge* curr = *it; Position prevPos, currPos; int laneI; // compute distance between candiate edges - SUMOReal intermediateWidth = 0; + double intermediateWidth = 0; if (prev->getToNode() == this) { laneI = prev->getNumLanes() - 1; prevPos = prev->getLanes()[laneI].shape[-1]; @@ -1983,6 +1977,23 @@ bool +NBNode::checkCrossingDuplicated(EdgeVector edges) { + // sort edge vector + std::sort(edges.begin(), edges.end()); + // iterate over crossing to find a crossing with the same edges + for (std::vector::iterator it = myCrossings.begin(); it != myCrossings.end(); it++) { + // sort edges of crossing before compare + EdgeVector edgesOfCrossing = it->edges; + std::sort(edgesOfCrossing.begin(), edgesOfCrossing.end()); + if (edgesOfCrossing == edges) { + return true; + } + } + return false; +} + + +bool NBNode::forbidsPedestriansAfter(std::vector > normalizedLanes, int startIndex) { for (int i = startIndex; i < (int)normalizedLanes.size(); ++i) { if (!normalizedLanes[i].second) { @@ -1994,21 +2005,23 @@ void -NBNode::buildCrossingsAndWalkingAreas() { +NBNode::buildCrossingsAndWalkingAreas(bool discardInvalid) { buildCrossings(); buildWalkingAreas(OptionsCont::getOptions().getInt("junctions.corner-detail")); // ensure that all crossings are properly connected - for (std::vector::iterator it = myCrossings.begin(); it != myCrossings.end();) { - if ((*it).prevWalkingArea == "" || (*it).nextWalkingArea == "") { - WRITE_WARNING("Discarding invalid crossing '" + (*it).id + "' at junction '" + getID() + "' with edges '" + toString((*it).edges) + "'."); - for (std::vector::iterator it_wa = myWalkingAreas.begin(); it_wa != myWalkingAreas.end(); it_wa++) { - if ((*it_wa).nextCrossing == (*it).id) { - (*it_wa).nextCrossing = ""; + if (discardInvalid) { + for (std::vector::iterator it = myCrossings.begin(); it != myCrossings.end();) { + if ((*it).prevWalkingArea == "" || (*it).nextWalkingArea == "") { + WRITE_WARNING("Discarding invalid crossing '" + (*it).id + "' at junction '" + getID() + "' with edges '" + toString((*it).edges) + "'."); + for (std::vector::iterator it_wa = myWalkingAreas.begin(); it_wa != myWalkingAreas.end(); it_wa++) { + if ((*it_wa).nextCrossing == (*it).id) { + (*it_wa).nextCrossing = ""; + } } + it = myCrossings.erase(it); + } else { + ++it; } - it = myCrossings.erase(it); - } else { - ++it; } } } @@ -2073,11 +2086,11 @@ std::cout << " sortedEdges=" << toString(edges) << "\n"; }; // rotate the edges so that the largest relative angle difference comes at the end - SUMOReal maxAngleDiff = 0; + double maxAngleDiff = 0; int maxAngleDiffIndex = 0; // index before maxDist for (int i = 0; i < (int) edges.size(); i++) { - SUMOReal diff = NBHelpers::relAngle(edges[i]->getAngleAtNodeToCenter(this), - edges[(i + 1) % edges.size()]->getAngleAtNodeToCenter(this)); + double diff = NBHelpers::relAngle(edges[i]->getAngleAtNodeToCenter(this), + edges[(i + 1) % edges.size()]->getAngleAtNodeToCenter(this)); if (diff < 0) { diff += 360; } @@ -2242,8 +2255,8 @@ if (gDebugFlag1) { std::cout << "build walkingArea " << wa.id << " start=" << start << " end=" << end << " count=" << count << " prev=" << prev << ":\n"; } - SUMOReal endCrossingWidth = 0; - SUMOReal startCrossingWidth = 0; + double endCrossingWidth = 0; + double startCrossingWidth = 0; PositionVector endCrossingShape; PositionVector startCrossingShape; // check for connected crossings @@ -2401,7 +2414,7 @@ } } // determine length (average of all possible connections) - SUMOReal lengthSum = 0; + double lengthSum = 0; int combinations = 0; for (std::vector::const_iterator it1 = connectedPoints.begin(); it1 != connectedPoints.end(); ++it1) { for (std::vector::const_iterator it2 = connectedPoints.begin(); it2 != connectedPoints.end(); ++it2) { @@ -2506,8 +2519,8 @@ NBEdge* out1 = myOutgoingEdges[1]; for (EdgeVector::const_iterator it = myIncomingEdges.begin(); it != myIncomingEdges.end(); ++it) { NBEdge* inEdge = *it; - SUMOReal angle0 = fabs(NBHelpers::relAngle(inEdge->getAngleAtNode(this), out0->getAngleAtNode(this))); - SUMOReal angle1 = fabs(NBHelpers::relAngle(inEdge->getAngleAtNode(this), out1->getAngleAtNode(this))); + double angle0 = fabs(NBHelpers::relAngle(inEdge->getAngleAtNode(this), out0->getAngleAtNode(this))); + double angle1 = fabs(NBHelpers::relAngle(inEdge->getAngleAtNode(this), out1->getAngleAtNode(this))); if (MAX2(angle0, angle1) <= 160) { // neither of the outgoing edges is parallel to inEdge return false; @@ -2528,7 +2541,7 @@ void -NBNode::addCrossing(EdgeVector edges, SUMOReal width, bool priority, bool fromSumoNet) { +NBNode::addCrossing(EdgeVector edges, double width, bool priority, bool fromSumoNet) { myCrossings.push_back(Crossing(this, edges, width, priority)); if (fromSumoNet) { myCrossingsLoadedFromSumoNet += 1; @@ -2560,11 +2573,22 @@ throw ProcessError("Request for unknown crossing '" + id + "'"); } +NBNode::Crossing& +NBNode::getCrossingRef(const std::string& id) { + for (std::vector::iterator it = myCrossings.begin(); it != myCrossings.end(); ++it) { + if ((*it).id == id) { + return *it; + } + } + throw ProcessError("Request for unknown crossing '" + id + "'"); +} + void -NBNode::setCrossingTLIndices(int startIndex) { +NBNode::setCrossingTLIndices(const std::string& tlID, int startIndex) { for (std::vector::iterator it = myCrossings.begin(); it != myCrossings.end(); ++it) { (*it).tlLinkNo = startIndex++; + (*it).tlID = tlID; } } @@ -2574,6 +2598,26 @@ return myRequest->getSizes().second; } + +int +NBNode::getConnectionIndex(const NBEdge* from, const NBEdge::Connection& con) const { + int result = 0; + for (EdgeVector::const_iterator i = myIncomingEdges.begin(); i != myIncomingEdges.end(); i++) { + const std::vector& elv = (*i)->getConnections(); + for (std::vector::const_iterator k = elv.begin(); k != elv.end(); ++k) { + const NBEdge::Connection& cand = *k; + if (*i == from + && cand.fromLane == con.fromLane + && cand.toLane == con.toLane + && cand.toEdge == con.toEdge) { + return result; + }; + result++; + } + } + return -1; +} + Position NBNode::getCenter() const { /* Conceptually, the center point would be identical with myPosition. @@ -2671,5 +2715,75 @@ } +void +NBNode::sortEdges(bool useNodeShape) { + if (myAllEdges.size() == 0) { + return; + } + EdgeVector& allEdges = myAllEdges; + EdgeVector& incoming = myIncomingEdges; + EdgeVector& outgoing = myOutgoingEdges; + std::vector& crossings = myCrossings; + if (!useNodeShape || getShape().area() < 1) { + // if the area is too small (i.e. for simple-continuation nodes) we better not use it + // sort by the angle of the adjoining line segment of the edge geometry + // sort the edges + std::sort(allEdges.begin(), allEdges.end(), NBNodesEdgesSorter::edge_by_junction_angle_sorter(this)); + std::sort(incoming.begin(), incoming.end(), NBNodesEdgesSorter::edge_by_junction_angle_sorter(this)); + std::sort(outgoing.begin(), outgoing.end(), NBNodesEdgesSorter::edge_by_junction_angle_sorter(this)); + std::vector::iterator j; + for (j = allEdges.begin(); j != allEdges.end() - 1 && j != allEdges.end(); ++j) { + NBNodesEdgesSorter::swapWhenReversed(this, j, j + 1); + } + if (allEdges.size() > 1 && j != allEdges.end()) { + NBNodesEdgesSorter::swapWhenReversed(this, allEdges.end() - 1, allEdges.begin()); + } + } else { + NBEdge* firstOfAll = allEdges.front(); + NBEdge* firstOfIncoming = incoming.size() > 0 ? incoming.front() : 0; + NBEdge* firstOfOutgoing = outgoing.size() > 0 ? outgoing.front() : 0; + // sort by the angle between the node shape center and the point where the edge meets the node shape + sort(allEdges.begin(), allEdges.end(), NBContHelper::edge_by_angle_to_nodeShapeCentroid_sorter(this)); + sort(incoming.begin(), incoming.end(), NBContHelper::edge_by_angle_to_nodeShapeCentroid_sorter(this)); + sort(outgoing.begin(), outgoing.end(), NBContHelper::edge_by_angle_to_nodeShapeCentroid_sorter(this)); + // let the first edge remain the first + rotate(allEdges.begin(), std::find(allEdges.begin(), allEdges.end(), firstOfAll), allEdges.end()); + if (firstOfIncoming != 0) { + rotate(incoming.begin(), std::find(incoming.begin(), incoming.end(), firstOfIncoming), incoming.end()); + } + if (firstOfOutgoing != 0) { + rotate(outgoing.begin(), std::find(outgoing.begin(), outgoing.end(), firstOfOutgoing), outgoing.end()); + } + } + // fixing some pathological all edges orderings + // if every of the edges a,b,c has a turning edge a',b',c' the all edges ordering should be a,a',b,b',c,c' + if (incoming.size() == outgoing.size() && incoming.front() == allEdges.front()) { + std::vector::const_iterator in, out; + std::vector allTmp; + for (in = incoming.begin(), out = outgoing.begin(); in != incoming.end(); ++in, ++out) { + if ((*in)->isTurningDirectionAt(*out)) { + allTmp.push_back(*in); + allTmp.push_back(*out); + } else { + break; + } + } + if (allTmp.size() == allEdges.size()) { + allEdges = allTmp; + } + } + // sort the crossings + std::sort(crossings.begin(), crossings.end(), NBNodesEdgesSorter::crossing_by_junction_angle_sorter(this, allEdges)); + // DEBUG + //if (getID() == "cluster_492462300_671564296") { + // if (crossings.size() > 0) { + // std::cout << " crossings at " << getID() << "\n"; + // for (std::vector::iterator it = crossings.begin(); it != crossings.end(); ++it) { + // std::cout << " " << toString((*it).edges) << "\n"; + // } + // } + //} +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBNode.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBNode.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBNode.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBNode.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Yun-Pang Floetteroed /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: NBNode.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NBNode.h 23575 2017-03-21 12:14:01Z namdre $ /// // The representation of a single node /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -73,12 +74,14 @@ */ class NBNode : public Named { friend class NBNodeCont; - friend class GNEJunction; // < used for visualization (NETEDIT) - friend class NBNodesEdgesSorter; // < sorts the edges - friend class NBNodeTypeComputer; // < computes type + friend class GNEJunction; // < used for visualization (NETEDIT) + friend class NBNodesEdgesSorter; // < sorts the edges + friend class NBNodeTypeComputer; // < computes type friend class NBEdgePriorityComputer; // < computes priorities of edges per intersection + friend class NBNodeShapeComputer; // < computes node's shape public: + /// @brief map for custon shapes typedef std::map CustomShapeMap; /** @@ -104,7 +107,7 @@ std::vector myAvailableLanes; public: - /** @brief Constructor + /**@brief Constructor * @param[in] approaching The list of the edges that approach the outgoing edge * @param[in] currentOutgoing The outgoing edge */ @@ -113,15 +116,15 @@ /// @brief Destructor ~ApproachingDivider(); + /// @ get number of avaliable lanes int numAvailableLanes() const { return (int)myAvailableLanes.size(); } - /** the bresenham-callback */ + /// @brief the bresenham-callback void execute(const int src, const int dest); - /** the method that spreads the wished number of lanes from the - the lane given by the bresenham-call to both left and right */ + /// @brief the method that spreads the wished number of lanes from the the lane given by the bresenham-call to both left and right std::deque* spread(const std::vector& approachingLanes, int dest) const; }; @@ -130,8 +133,13 @@ * @brief A definition of a pedestrian crossing */ struct Crossing { - Crossing(const NBNode* _node, const EdgeVector& _edges, SUMOReal _width, bool _priority) : - node(_node), edges(_edges), width(_width), priority(_priority), tlLinkNo(-1) { + /// @brief constructor + Crossing(const NBNode* _node, const EdgeVector& _edges, double _width, bool _priority) : + node(_node), + edges(_edges), + width(_width), + priority(_priority), + tlLinkNo(-1) { } /// @brief The parent node of this crossing const NBNode* node; @@ -140,7 +148,7 @@ /// @brief The lane's shape PositionVector shape; /// @brief This lane's width - SUMOReal width; + double width; /// @brief the (edge)-id of this crossing std::string id; /// @brief the lane-id of the previous walkingArea @@ -151,6 +159,8 @@ bool priority; /// @brief the traffic light index of this crossing (if controlled) int tlLinkNo; + /// @brief The id of the traffic light that controls this connection + std::string tlID; }; @@ -158,7 +168,8 @@ * @brief A definition of a pedestrian walking area */ struct WalkingArea { - WalkingArea(const std::string& _id, SUMOReal _width) : + /// @brief constructor + WalkingArea(const std::string& _id, double _width) : id(_id), width(_width), nextCrossing("") { @@ -166,9 +177,9 @@ /// @brief the (edge)-id of this walkingArea std::string id; /// @brief This lane's width - SUMOReal width; + double width; /// @brief This lane's width - SUMOReal length; + double length; /// @brief The polygonal shape PositionVector shape; /// @brief the lane-id of the next crossing @@ -183,33 +194,30 @@ static const int FORWARD; static const int BACKWARD; /// @brief default width of pedetrian crossings - static const SUMOReal DEFAULT_CROSSING_WIDTH; + static const double DEFAULT_CROSSING_WIDTH; /// @brief unspecified lane width - static const SUMOReal UNSPECIFIED_RADIUS; + static const double UNSPECIFIED_RADIUS; public: - /** @brief Constructor + /**@brief Constructor * @param[in] id The id of the node * @param[in] position The position of the node * @param[in] type The type of the node */ NBNode(const std::string& id, const Position& position, SumoXMLNodeType type); - - /** @brief Constructor + /**@brief Constructor * @param[in] id The id of the node * @param[in] position The position of the node * @param[in] district The district this district node represents, 0 means no district node */ NBNode(const std::string& id, const Position& position, NBDistrict* district = 0); - /// @brief Destructor ~NBNode(); - - /** @brief Resets initial values + /**@brief Resets initial values * @param[in] position The position of the node * @param[in] type The type of the node * @param[in] updateEdgeGeometries Whether the geometires of all @@ -218,108 +226,79 @@ void reinit(const Position& position, SumoXMLNodeType type, bool updateEdgeGeometries = false); - /// @name Atomar getter methods /// @{ - - /** @brief Returns the position of this node - * @return This node's position - */ + /// @brief Returns the position of this node const Position& getPosition() const { return myPosition; } - - /** @brief Returns a position that is guaranteed to lie within the node shape */ + /// @brief Returns a position that is guaranteed to lie within the node shape Position getCenter() const; - - /** @brief Returns this node's incoming edges - * @return The edges which yield in this node - */ + /// @brief Returns this node's incoming edges (The edges which yield in this node) const EdgeVector& getIncomingEdges() const { return myIncomingEdges; } - - /** @brief Returns this node's outgoing edges - * @return The edges which start at this node - */ + /// @brief Returns this node's outgoing edges (The edges which start at this node) const EdgeVector& getOutgoingEdges() const { return myOutgoingEdges; } - - /** @brief Returns all edges which participate in this node - * @return Edges that start or end at this node - */ + /// @brief Returns all edges which participate in this node (Edges that start or end at this node) const EdgeVector& getEdges() const { return myAllEdges; } - - /** @brief Returns the type of this node - * @return The type of this node + /**@brief Returns the type of this node * @see SumoXMLNodeType */ SumoXMLNodeType getType() const { return myType; } - /** @brief Returns the turning radius of this node - * @return The turning radius of this node - */ - SUMOReal getRadius() const { + /// @brief Returns the turning radius of this node + double getRadius() const { return myRadius; } - /** @brief Returns the keepClear flag - */ + /// @brief Returns the keepClear flag bool getKeepClear() const { return myKeepClear; } /// @} - - /// @name Methods for dealing with assigned traffic lights /// @{ - - /** @brief Adds a traffic light to the list of traffic lights that control this node + /**@brief Adds a traffic light to the list of traffic lights that control this node * @param[in] tld The traffic light that controls this node */ void addTrafficLight(NBTrafficLightDefinition* tlDef); - /** @brief Removes the given traffic light from this node */ + /// @brief Removes the given traffic light from this node void removeTrafficLight(NBTrafficLightDefinition* tlDef); - /** @brief Removes all references to traffic lights that control this tls - */ + /// @brief Removes all references to traffic lights that control this tls void removeTrafficLights(); - - /** @brief Returns whether this node is controlled by any tls + /**@brief Returns whether this node is controlled by any tls * @return Whether a traffic light was assigned to this node */ bool isTLControlled() const { return myTrafficLights.size() != 0; } - - /** @brief Returns whether this node is controlled by a tls that spans over more than one node + /**@brief Returns whether this node is controlled by a tls that spans over more than one node * @return Whether a "joined" traffic light was assigned to this node */ bool isJoinedTLSControlled() const; - - /** @brief Returns the traffic lights that were assigned to this node - * @return The set of tls that control this node - */ + /// @brief Returns the traffic lights that were assigned to this node (The set of tls that control this node) const std::set& getControllingTLS() const { return myTrafficLights; } - /// @brief causes the traffic light to be computed anew void invalidateTLS(NBTrafficLightLogicCont& tlCont); @@ -328,11 +307,10 @@ /// @} - /// @name Prunning the input /// @{ - /** @brief Removes edges which are both incoming and outgoing into this node + /**@brief Removes edges which are both incoming and outgoing into this node * * If given, the connections to other edges participating in this node are updated * @@ -345,79 +323,76 @@ /// @} - /// @name Applying offset /// @{ - - /** @brief Applies an offset to the node + /**@brief Applies an offset to the node * @param[in] xoff The x-offset to apply * @param[in] yoff The y-offset to apply */ - void reshiftPosition(SUMOReal xoff, SUMOReal yoff); + void reshiftPosition(double xoff, double yoff); /// @brief mirror coordinates along the x-axis void mirrorX(); /// @} - - - /// adds an incoming edge + /// @brief adds an incoming edge void addIncomingEdge(NBEdge* edge); - /// adds an outgoing edge + /// @brief adds an outgoing edge void addOutgoingEdge(NBEdge* edge); - - - - /// computes the connections of lanes to edges + /// @brief computes the connections of lanes to edges void computeLanes2Lanes(); - /// computes the node's type, logic and traffic light + /// @brief computes the node's type, logic and traffic light void computeLogic(const NBEdgeCont& ec, OptionsCont& oc); - /** writes the XML-representation of the logic as a bitset-logic - XML representation */ + /// @brief writes the XML-representation of the logic as a bitset-logic XML representation bool writeLogic(OutputDevice& into, const bool checkLaneFoes) const; - /** @brief Returns something like the most unused direction - Should only be used to add source or sink nodes */ + /// @brief Returns something like the most unused direction Should only be used to add source or sink nodes Position getEmptyDir() const; - - /** @brief Returns whether the given edge ends at this node + /**@brief Returns whether the given edge ends at this node * @param[in] e The edge * @return Whether the given edge is one of this node's incoming edges */ bool hasIncoming(const NBEdge* const e) const; - - /** @brief Returns whether the given edge starts at this node + /**@brief Returns whether the given edge starts at this node * @param[in] e The edge * @return Whether the given edge is one of this node's outgoing edges */ bool hasOutgoing(const NBEdge* const e) const; - + /// @brief returns the opposite incoming edge of certain edge NBEdge* getOppositeIncoming(NBEdge* e) const; + + /// @brief invalidate incoming connections void invalidateIncomingConnections(); + + /// @brief invalidate outgoing connections void invalidateOutgoingConnections(); + /// @brief remove duble edges void removeDoubleEdges(); - NBEdge* getConnectionTo(NBNode* n) const; + /// @brief get connection to certain node + NBEdge* getConnectionTo(NBNode* n) const; - void addSortedLinkFoes(const NBConnection& mayDrive, - const NBConnection& mustStop); + /// @brief add shorted link FOES + void addSortedLinkFoes(const NBConnection& mayDrive, const NBConnection& mustStop); + /// @brief get possibly splitted incoming edge NBEdge* getPossiblySplittedIncoming(const std::string& edgeid); + + /// @brief get possibly splitted outgoing edge NBEdge* getPossiblySplittedOutgoing(const std::string& edgeid); - /** @brief Removes edge from this node and optionally removes connections as well - */ + /// @brief Removes edge from this node and optionally removes connections as well void removeEdge(NBEdge* edge, bool removeFromConnections = true); - /** @brief Computes whether the given connection is a left mover across the junction + /**@brief Computes whether the given connection is a left mover across the junction * * It is assumed, that it is a left-mover if the clockwise angle is lower * than the counter-clockwise angle. @@ -428,8 +403,7 @@ */ bool isLeftMover(const NBEdge* const from, const NBEdge* const to) const; - - /** @brief Returns the information whether the described flow must let any other flow pass + /**@brief Returns the information whether the described flow must let any other flow pass * @param[in] from The connection's start edge * @param[in] to The connection's end edge * @param[in] fromLane The lane the connection start at @@ -439,7 +413,7 @@ */ bool mustBrake(const NBEdge* const from, const NBEdge* const to, int fromLane, int toLane, bool includePedCrossings) const; - /** @brief Returns the information whether the described flow must brake for the given crossing + /**@brief Returns the information whether the described flow must brake for the given crossing * @param[in] from The connection's start edge * @param[in] to The connection's end edge * @param[in] crossing The pedestrian crossing to check @@ -447,12 +421,12 @@ */ bool mustBrakeForCrossing(const NBEdge* const from, const NBEdge* const to, const Crossing& crossing) const; - /** @brief return whether the given laneToLane connection is a right turn which must yield to a bicycle crossings - */ + /// @brief return whether the given laneToLane connection is a right turn which must yield to a bicycle crossings static bool rightTurnConflict(const NBEdge* from, const NBEdge* to, int fromLane, - const NBEdge* prohibitorFrom, const NBEdge* prohibitorTo, int prohibitorFromLane, bool lefthand = false); + const NBEdge* prohibitorFrom, const NBEdge* prohibitorTo, int prohibitorFromLane, + bool lefthand = false); - /** @brief Returns the information whether "prohibited" flow must let "prohibitor" flow pass + /**@brief Returns the information whether "prohibited" flow must let "prohibitor" flow pass * @param[in] possProhibitedFrom The maybe prohibited connection's begin * @param[in] possProhibitedTo The maybe prohibited connection's end * @param[in] possProhibitorFrom The maybe prohibiting connection's begin @@ -464,8 +438,7 @@ const NBEdge* const possProhibitedFrom, const NBEdge* const possProhibitedTo, bool regardNonSignalisedLowerPriority) const; - - /** @brief Returns the information whether the given flows cross + /**@brief Returns the information whether the given flows cross * @param[in] from1 The starting edge of the first stream * @param[in] to1 The ending edge of the first stream * @param[in] from2 The starting edge of the second stream @@ -475,8 +448,7 @@ bool foes(const NBEdge* const from1, const NBEdge* const to1, const NBEdge* const from2, const NBEdge* const to2) const; - - /** @brief Returns the representation of the described stream's direction + /**@brief Returns the representation of the described stream's direction * @param[in] incoming The edge the stream starts at * @param[in] outgoing The edge the stream ends at * @param[in] leftHand Whether a lefthand network is being built. Should only be set at writing time @@ -484,13 +456,14 @@ */ LinkDirection getDirection(const NBEdge* const incoming, const NBEdge* const outgoing, bool leftHand = false) const; + /// @brief get link state LinkState getLinkState(const NBEdge* incoming, NBEdge* outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string& tlID) const; - /** @brief Compute the junction shape for this node + /**@brief Compute the junction shape for this node * @param[in] mismatchThreshold The threshold for warning about shapes which are away from myPosition */ - void computeNodeShape(SUMOReal mismatchThreshold); + void computeNodeShape(double mismatchThreshold); /// @brief retrieve the junction shape const PositionVector& getShape() const; @@ -507,7 +480,7 @@ } /// @brief set the turning radius - void setRadius(SUMOReal radius) { + void setRadius(double radius) { myRadius = radius; } @@ -521,22 +494,23 @@ return myHaveCustomPoly; } + /// @brief check if node is removable bool checkIsRemovable() const; - + /// @brief get edges to join std::vector > getEdgesToJoin() const; - - friend class NBNodeShapeComputer; - + /// @chech if node is near district bool isNearDistrict() const; + + /// @brief check if node is a district bool isDistrict() const; /// @brief whether an internal junction should be built at from and respect other bool needsCont(const NBEdge* fromE, const NBEdge* otherFromE, const NBEdge::Connection& c, const NBEdge::Connection& otherC) const; - /** @brief Compute the shape for an internal lane + /**@brief Compute the shape for an internal lane * @param[in] fromE The starting edge * @param[in] con The connection for this internal lane * @param[in] numPoints The number of geometry points for the internal lane @@ -545,8 +519,7 @@ */ PositionVector computeInternalLaneShape(NBEdge* fromE, const NBEdge::Connection& con, int numPoints, NBNode* recordError = 0) const; - - /** @brief Compute a smooth curve between the given geometries + /**@brief Compute a smooth curve between the given geometries * @param[in] begShape The geometry at the start * @param[in] endShape The geometry at the end * @param[in] numPoints The number of geometry points for the internal lane @@ -556,44 +529,30 @@ * @param[in] recordError The node itself if the displacement error during shape computation shall be recorded * @return The shape of the internal lane */ - PositionVector computeSmoothShape( - const PositionVector& begShape, - const PositionVector& endShape, - int numPoints, - bool isTurnaround, - SUMOReal extrapolateBeg, - SUMOReal extrapolateEnd, - NBNode* recordError = 0) const; - - static PositionVector bezierControlPoints( - const PositionVector& begShape, - const PositionVector& endShape, - bool isTurnaround, - SUMOReal extrapolateBeg, - SUMOReal extrapolateEnd, - bool& ok, - NBNode* recordError = 0); + PositionVector computeSmoothShape(const PositionVector& begShape, const PositionVector& endShape, int numPoints, + bool isTurnaround, double extrapolateBeg, double extrapolateEnd, + NBNode* recordError = 0) const; + /// @brief get bezier control points + static PositionVector bezierControlPoints(const PositionVector& begShape, const PositionVector& endShape, + bool isTurnaround, double extrapolateBeg, double extrapolateEnd, + bool& ok, NBNode* recordError = 0, double straightThresh = DEG2RAD(5)); /// @brief compute the displacement error during s-curve computation - SUMOReal getDisplacementError() const { + double getDisplacementError() const { return myDisplacementError; } - /** @brief Replaces occurences of the first edge within the list of incoming by the second - Connections are remapped, too */ + /// @brief Replaces occurences of the first edge within the list of incoming by the second Connections are remapped, too void replaceIncoming(NBEdge* which, NBEdge* by, int laneOff); - /** @brief Replaces occurences of every edge from the given list within the list of incoming by the second - Connections are remapped, too */ + /// @brief Replaces occurences of every edge from the given list within the list of incoming by the second Connections are remapped, too void replaceIncoming(const EdgeVector& which, NBEdge* by); - /** @brief Replaces occurences of the first edge within the list of outgoing by the second - Connections are remapped, too */ + /// @brief Replaces occurences of the first edge within the list of outgoing by the second Connections are remapped, too void replaceOutgoing(NBEdge* which, NBEdge* by, int laneOff); - /** @brief Replaces occurences of every edge from the given list within the list of outgoing by the second - Connections are remapped, too */ + /// @brief Replaces occurences of every edge from the given list within the list of outgoing by the second Connections are remapped, too void replaceOutgoing(const EdgeVector& which, NBEdge* by); /// @brief guess pedestrian crossings and return how many were guessed @@ -605,22 +564,24 @@ * */ int checkCrossing(EdgeVector candidates); + /// @brief return true if already exist a crossing with the same edges as the input + bool checkCrossingDuplicated(EdgeVector edges); + /// @brief build internal lanes, pedestrian crossings and walking areas void buildInnerEdges(); - /* @brief build pedestrian crossings + /**@brief build pedestrian crossings * @return The next index for creating internal lanes - * */ + **/ int buildCrossings(); - /* @brief build pedestrian walking areas and set connections from/to walkingAreas + /**@brief build pedestrian walking areas and set connections from/to walkingAreas * @param[in] cornerDetail The detail level when generating the inner curve - * */ + */ void buildWalkingAreas(int cornerDetail); - /* @brief build crossings, and walkingareas. Also removes invalid loaded - * crossings*/ - void buildCrossingsAndWalkingAreas(); + /// @brief build crossings, and walkingareas. Also removes invalid loaded crossings if wished + void buildCrossingsAndWalkingAreas(bool discardInvalid = true); /// @brief return all edges that lie clockwise between the given edges EdgeVector edgesBetween(const NBEdge* e1, const NBEdge* e2) const; @@ -628,27 +589,29 @@ /// @brief return true if the given edges are connected by a crossing bool crossingBetween(const NBEdge* e1, const NBEdge* e2) const; + /// @brief get prohibitions (BLocked connections) const NBConnectionProhibits& getProhibitions() { return myBlockedConnections; } - /** @brief whether this is structurally similar to a geometry node - */ + /// @brief whether this is structurally similar to a geometry node bool geometryLike() const; /// @brief update the type of this node as a roundabout void setRoundabout(); /// @brief add a pedestrian crossing to this node - void addCrossing(EdgeVector edges, SUMOReal width, bool priority, bool fromSumoNet = false); + void addCrossing(EdgeVector edges, double width, bool priority, bool fromSumoNet = false); /// @brief remove a pedestrian crossing from this node (identified by its edges) void removeCrossing(const EdgeVector& edges); + /// @brief discard all crossings void discardAllCrossings() { myDiscardAllCrossings = true; } + /// @brief get num of crossings from sumo net int numCrossingsFromSumoNet() const { return myCrossingsLoadedFromSumoNet; } @@ -666,19 +629,27 @@ /// @brief return the crossing with the given id const Crossing& getCrossing(const std::string& id) const; + /// @brief return a reference to the crossing with the given id + Crossing& getCrossingRef(const std::string& id); + /// @brief set tl indices of this nodes crossing starting at the given index - void setCrossingTLIndices(int startIndex); + void setCrossingTLIndices(const std::string& tlID, int startIndex); /// @brief return the number of lane-to-lane connections at this junction (excluding crossings) int numNormalConnections() const; - /** @brief fix overlap - */ + /// @brief fix overlap void avoidOverlap(); /// @brief whether the given index must yield to the foeIndex while turing right on a red light bool rightOnRedConflict(int index, int foeIndex) const; + /// @brief sort all edge containers for this node + void sortEdges(bool useNodeShape); + + /// @brief return the index of the given connection + int getConnectionIndex(const NBEdge* from, const NBEdge::Connection& con) const; + /** * @class nodes_by_id_sorter * @brief Used for sorting the cells by the begin time they describe @@ -688,21 +659,21 @@ /// @brief Constructor explicit nodes_by_id_sorter() { } - /** @brief Comparing operator - */ + /// @brief Comparing operator int operator()(NBNode* n1, NBNode* n2) const { return n1->getID() < n2->getID(); } - }; - /** @class edge_by_direction_sorter * @brief Sorts outgoing before incoming edges */ class edge_by_direction_sorter { public: + /// @brief constructor explicit edge_by_direction_sorter(NBNode* n) : myNode(n) {} + + /// @brief operator of selection int operator()(NBEdge* e1, NBEdge* e2) const { UNUSED_PARAMETER(e2); return e1->getFromNode() == myNode; @@ -721,36 +692,31 @@ /// @brief return whether the given type is a traffic light static bool isTrafficLight(SumoXMLNodeType type); + /// @brief check if node is a simple continuation bool isSimpleContinuation(bool checkLaneNumbers = true) const; private: - /// sets the priorites in case of a priority junction + /// @brief sets the priorites in case of a priority junction void setPriorityJunctionPriorities(); - /** returns a list of edges which are connected to the given - outgoing edge */ + /// @brief returns a list of edges which are connected to the given outgoing edge EdgeVector* getEdgesThatApproach(NBEdge* currentOutgoing); + /// @brief replace incoming connections prohibitions + void replaceInConnectionProhibitions(NBEdge* which, NBEdge* by, int whichLaneOff, int byLaneOff); - - - void replaceInConnectionProhibitions(NBEdge* which, NBEdge* by, - int whichLaneOff, int byLaneOff); - - - void remapRemoved(NBTrafficLightLogicCont& tc, - NBEdge* removed, const EdgeVector& incoming, const EdgeVector& outgoing); - + /// @brief remap removed + void remapRemoved(NBTrafficLightLogicCont& tc, NBEdge* removed, const EdgeVector& incoming, const EdgeVector& outgoing); /// @brief return whether there is a non-sidewalk lane after the given index; bool forbidsPedestriansAfter(std::vector > normalizedLanes, int startIndex); - /// @brief returns the list of all edges sorted clockwise by getAngleAtNodeToCenter EdgeVector getEdgesSortedByAngleAtNodeCenter() const; - static bool isLongEnough(NBEdge* out, SUMOReal minLength); + /// @brief check if is long enough + static bool isLongEnough(NBEdge* out, double minLength); private: /// @brief The position the node lies at @@ -774,28 +740,31 @@ /// @brief The type of the junction SumoXMLNodeType myType; - /** The container for connection block dependencies */ + /// @brief The container for connection block dependencies NBConnectionProhibits myBlockedConnections; - /// The district the node is the centre of + /// @brief The district the node is the centre of NBDistrict* myDistrict; - /// the (outer) shape of the junction + /// @brief the (outer) shape of the junction PositionVector myPoly; /// @brief whether this nodes shape was set by the user bool myHaveCustomPoly; + /// @brief Node requests NBRequest* myRequest; + /// @brief traffic lights of node std::set myTrafficLights; /// @brief the turning radius (for all corners) at this node in m. - SUMOReal myRadius; + double myRadius; /// @brief whether the junction area must be kept clear bool myKeepClear; + /// @brief custom lane shapes CustomShapeMap myCustomLaneShapes; /// @brief whether to discard all pedestrian crossings @@ -805,7 +774,7 @@ int myCrossingsLoadedFromSumoNet; /// @brief geometry error after computation of internal lane shapes - SUMOReal myDisplacementError; + double myDisplacementError; private: /// @brief invalidated copy constructor @@ -813,8 +782,6 @@ /// @brief invalidated assignment operator NBNode& operator=(const NBNode& s); - - }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBNodeShapeComputer.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBNodeShapeComputer.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBNodeShapeComputer.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBNodeShapeComputer.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NBNodeShapeComputer.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NBNodeShapeComputer.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // This class computes shapes of junctions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,10 +43,6 @@ #include "NBNode.h" #include "NBNodeShapeComputer.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - //#define DEBUG_NODE_SHAPE #define DEBUGCOND (myNode.getID() == "disabled") @@ -86,12 +82,12 @@ // (otherwise, we will try to compute the shape in a different way) const EdgeVector& incoming = myNode.getIncomingEdges(); const EdgeVector& outgoing = myNode.getOutgoingEdges(); - SUMOReal maxAngle = SUMOReal(0); + double maxAngle = 0.; for (EdgeVector::const_iterator i = incoming.begin(); i != incoming.end(); ++i) { - SUMOReal ia = (*i)->getAngleAtNode(&myNode); + double ia = (*i)->getAngleAtNode(&myNode); for (EdgeVector::const_iterator j = outgoing.begin(); j != outgoing.end(); ++j) { - SUMOReal oa = (*j)->getAngleAtNode(&myNode); - SUMOReal ad = GeomHelper::getMinAngleDiff(ia, oa); + double oa = (*j)->getAngleAtNode(&myNode); + double ad = GeomHelper::getMinAngleDiff(ia, oa); if (22.5 >= ad) { maxAngle = MAX2(ad, maxAngle); } @@ -124,7 +120,7 @@ tmp[1].add(tmp[0]); tmp.extrapolate2D(100); if (l2.intersects(tmp[0], tmp[1])) { - const SUMOReal offset = l2.intersectsAtLengths2D(tmp)[0]; + const double offset = l2.intersectsAtLengths2D(tmp)[0]; if (l2.length2D() - offset > POSITION_EPS) { PositionVector tl2 = l2.getSubpart2D(offset, l2.length2D()); tl2.extrapolate2D(100); @@ -142,12 +138,21 @@ return PositionVector(); } // magic values + const OptionsCont& oc = OptionsCont::getOptions(); const bool defaultRadius = myNode.getRadius() == NBNode::UNSPECIFIED_RADIUS; - const SUMOReal radius = (defaultRadius ? OptionsCont::getOptions().getFloat("default.junctions.radius") : myNode.getRadius()); - const int cornerDetail = OptionsCont::getOptions().getInt("junctions.corner-detail"); - const SUMOReal sCurveStretch = OptionsCont::getOptions().getFloat("junctions.scurve-stretch"); - const bool rectangularCut = OptionsCont::getOptions().getBool("rectangular-lane-cut"); - const bool openDriveOutput = OptionsCont::getOptions().isSet("opendrive-output"); + const double radius = (defaultRadius ? oc.getFloat("default.junctions.radius") : myNode.getRadius()); + const int cornerDetail = oc.getInt("junctions.corner-detail"); + const double sCurveStretch = oc.getFloat("junctions.scurve-stretch"); + const bool rectangularCut = oc.getBool("rectangular-lane-cut"); + const bool openDriveOutput = oc.isSet("opendrive-output"); + + // Extend geometries to move the stop line forward. + // In OpenDrive the junction starts whenever the geometry changes. Stop + // line information is not given or ambiguous (sign positions at most) + // In SUMO, stop lines are where the junction starts. This is computed + // heuristically from intersecting the junctions roads geometries. + const double advanceStopLine = oc.exists("opendrive-files") && oc.isSet("opendrive-files") ? oc.getFloat("opendrive.advance-stopline") : 0; + #ifdef DEBUG_NODE_SHAPE if (DEBUGCOND) { @@ -177,14 +182,14 @@ // intersection ends and the edge starts. This value is saved in 'distances' // If the geometries need to be extended to get an intersection, this is // recorded in 'myExtended' - std::map distances; + std::map distances; std::map myExtended; for (i = newAll.begin(); i != newAll.end(); ++i) { EdgeVector::const_iterator cwi = i; EdgeVector::const_iterator ccwi = i; - SUMOReal ccad; - SUMOReal cad; + double ccad; + double cad; initNeighbors(newAll, i, geomsCW, geomsCCW, cwi, ccwi, cad, ccad); assert(geomsCCW.find(*i) != geomsCCW.end()); assert(geomsCW.find(*ccwi) != geomsCW.end()); @@ -194,7 +199,7 @@ if (*cwi == *ccwi && ( // no change in lane numbers, even low angles still give a good intersection - (simpleContinuation && fabs(ccad - cad) < (SUMOReal) 0.1) + (simpleContinuation && fabs(ccad - cad) < (double) 0.1) // lane numbers change, a direct intersection could be far away from the node position // so we use a larger threshold || (!simpleContinuation && fabs(ccad - cad) < DEG2RAD(22.5))) @@ -223,9 +228,9 @@ #endif } // ... compute the distance to this point ... - SUMOReal dist = MAX2( - geomsCCW[*i].nearest_offset_to_point2D(p), - geomsCW[*i].nearest_offset_to_point2D(p)); + double dist = MAX2( + geomsCCW[*i].nearest_offset_to_point2D(p), + geomsCW[*i].nearest_offset_to_point2D(p)); if (dist < 0) { // ok, we have the problem that even the extrapolated geometry // does not reach the point @@ -256,9 +261,9 @@ dist += radius; } else { // if the angles change, junction should have some size to avoid degenerate shape - SUMOReal radius2 = fabs(ccad - cad) * (*i)->getNumLanes(); + double radius2 = fabs(ccad - cad) * (*i)->getNumLanes(); if (radius2 > NUMERICAL_EPS || openDriveOutput) { - radius2 = MAX2((SUMOReal)0.15, radius2); + radius2 = MAX2(0.15, radius2); } dist += radius2; #ifdef DEBUG_NODE_SHAPE @@ -296,20 +301,22 @@ } #endif if (*cwi != *ccwi && currGeom2.intersects(neighGeom2)) { - const SUMOReal farAngleDist = ccwCloser ? cad : ccad; - SUMOReal a1 = distances[*i]; - SUMOReal a2 = radius + closestIntersection(currGeom2, neighGeom2, 100); + // also use the second intersection point + // but prevent very large node shapes + const double farAngleDist = ccwCloser ? cad : ccad; + double a1 = distances[*i]; + double a2 = radius + closestIntersection(currGeom2, neighGeom2, 100); #ifdef DEBUG_NODE_SHAPE if (DEBUGCOND) { std::cout << " neigh2 also intersects a1=" << a1 << " a2=" << a2 << " ccad=" << RAD2DEG(ccad) << " cad=" << RAD2DEG(cad) << " dist[cwi]=" << distances[*cwi] << " dist[ccwi]=" << distances[*ccwi] << " farAngleDist=" << RAD2DEG(farAngleDist) << " currGeom2=" << currGeom2 << " neighGeom2=" << neighGeom2 << "\n"; } #endif + //if (RAD2DEG(farAngleDist) < 175) { + // distances[*i] = MAX2(a1, MIN2(a2, a1 + 180 - RAD2DEG(farAngleDist))); + //} if (ccad > DEG2RAD(90. + 45.) && cad > DEG2RAD(90. + 45.)) { - SUMOReal mmin = MIN2(distances[*cwi], distances[*ccwi]); - if (mmin > 100 && mmin < 205) { - distances[*i] = (SUMOReal) 5. + (SUMOReal) 100. - (SUMOReal)(mmin - 100); //100 + 1.5; - } - } else if (fabs(a2 - a1) < 10 || farAngleDist < DEG2RAD(135)) { + // do nothing. + } else if (farAngleDist < DEG2RAD(135) || (fabs(RAD2DEG(farAngleDist) - 180) > 1 && fabs(a2 - a1) < 10)) { distances[*i] = MAX2(a1, a2); } #ifdef DEBUG_NODE_SHAPE @@ -339,22 +346,29 @@ if (currGeom.intersects(neighGeom)) { distances[*i] = currGeom.intersectsAtLengths2D(neighGeom)[0]; } else { - distances[*i] = (SUMOReal) 100.; + distances[*i] = (double) 100.; } } } if (defaultRadius && sCurveStretch > 0) { - SUMOReal sCurveWidth = myNode.getDisplacementError(); + double sCurveWidth = myNode.getDisplacementError(); if (sCurveWidth > 0) { - const SUMOReal sCurveRadius = radius + sCurveWidth / SUMO_const_laneWidth * sCurveStretch * pow((*i)->getSpeed(), 2 + sCurveStretch) / 1000; - distances[*i] = MAX2(distances[*i], 100 + sCurveRadius); - // @dirty: update radius so it is exported to the network - const_cast(myNode).setRadius(sCurveRadius); + const double sCurveRadius = radius + sCurveWidth / SUMO_const_laneWidth * sCurveStretch * pow((*i)->getSpeed(), 2 + sCurveStretch) / 1000; + const double stretch = 100 + sCurveRadius - distances[*i]; + if (stretch > 0) { + distances[*i] += stretch; + // fixate extended geometry for repeated computation + const double shorten = distances[*i] - 100; + (*i)->shortenGeometryAtNode(&myNode, shorten); + for (std::set::iterator k = same[*i].begin(); k != same[*i].end(); ++k) { + (*k)->shortenGeometryAtNode(&myNode, shorten); + } #ifdef DEBUG_NODE_SHAPE - if (DEBUGCOND) { - std::cout << " stretching junction: sCurveWidth=" << sCurveWidth << " sCurveRadius=" << sCurveRadius << " dist=" << distances[*i] << "\n"; - } + if (DEBUGCOND) { + std::cout << " stretching junction: sCurveWidth=" << sCurveWidth << " sCurveRadius=" << sCurveRadius << " stretch=" << stretch << " dist=" << distances[*i] << "\n"; + } #endif + } } } } @@ -365,38 +379,74 @@ distances[*i] = 100; } } + // prevent inverted node shapes + // (may happen with near-parallel edges) + const double minDistSum = 2 * (100 + radius); + for (i = newAll.begin(); i != newAll.end(); ++i) { + if (distances[*i] < 100 && (*i)->hasDefaultGeometryEndpointAtNode(&myNode)) { + for (EdgeVector::const_iterator j = newAll.begin(); j != newAll.end(); ++j) { + if (distances[*j] > 100 && (*j)->hasDefaultGeometryEndpointAtNode(&myNode) && distances[*i] + distances[*j] < minDistSum) { + const double angleDiff = fabs(NBHelpers::relAngle((*i)->getAngleAtNode(&myNode), (*j)->getAngleAtNode(&myNode))); + if (angleDiff > 160 || angleDiff < 20) { +#ifdef DEBUG_NODE_SHAPE + if (DEBUGCOND) { + std::cout << " increasing dist for i=" << (*i)->getID() << " because of j=" << (*j)->getID() << " jDist=" << distances[*j] + << " oldI=" << distances[*i] << " newI=" << minDistSum - distances[*j] + << " angleDiff=" << angleDiff + << " geomI=" << (*i)->getGeometry() << " geomJ=" << (*j)->getGeometry() << "\n"; + } +#endif + distances[*i] = minDistSum - distances[*j]; + } + } + } + } + } + // build PositionVector ret; for (i = newAll.begin(); i != newAll.end(); ++i) { const PositionVector& ccwBound = geomsCCW[*i]; - SUMOReal offset = distances[*i]; + const PositionVector& cwBound = geomsCW[*i]; + //double offset = MIN3(distances[*i], cwBound.length2D() - POSITION_EPS, ccwBound.length2D() - POSITION_EPS); + double offset = distances[*i]; + if (!(*i)->hasDefaultGeometryEndpointAtNode(&myNode)) { + // for non geometry-endpoints, only shorten but never extend the geometry + if (advanceStopLine > 0 && offset < 100) { +#ifdef DEBUG_NODE_SHAPE + std::cout << " i=" << (*i)->getID() << " offset=" << offset << " advanceStopLine=" << advanceStopLine << "\n"; +#endif + // fixate extended geometry for repeated computation + (*i)->extendGeometryAtNode(&myNode, advanceStopLine); + for (std::set::iterator k = same[*i].begin(); k != same[*i].end(); ++k) { + (*k)->extendGeometryAtNode(&myNode, advanceStopLine); + } + } + offset = MAX2(100.0 - advanceStopLine, offset); + } if (offset == -1) { WRITE_WARNING("Fixing offset for edge '" + (*i)->getID() + "' at node '" + myNode.getID() + "."); - offset = (SUMOReal) - .1; + offset = (double) - .1; } - Position p; - p = ccwBound.positionAtOffset2D(offset); - p.set(p.x(), p.y(), myNode.getPosition().z()); + Position p = ccwBound.positionAtOffset2D(offset); + p.setz(myNode.getPosition().z()); if (i != newAll.begin()) { ret.append(getSmoothCorner(geomsCW[*(i - 1)].reverse(), ccwBound, ret[-1], p, cornerDetail)); } ret.push_back_noDoublePos(p); // - const PositionVector& cwBound = geomsCW[*i]; - p = cwBound.positionAtOffset2D(offset); - p.set(p.x(), p.y(), myNode.getPosition().z()); - ret.push_back_noDoublePos(p); + Position p2 = cwBound.positionAtOffset2D(offset); + p2.setz(myNode.getPosition().z()); + ret.push_back_noDoublePos(p2); #ifdef DEBUG_NODE_SHAPE if (DEBUGCOND) { - std::cout << " build stopLine for i=" << (*i)->getID() << " offset=" << offset << " ccwBound=" << ccwBound << " cwBound=" << cwBound << "\n"; + std::cout << " build stopLine for i=" << (*i)->getID() << " offset=" << offset << " dist=" << distances[*i] << " cwLength=" << cwBound.length2D() << " ccwLength=" << ccwBound.length2D() << " p=" << p << " p2=" << p2 << " ccwBound=" << ccwBound << " cwBound=" << cwBound << "\n"; } #endif - if (rectangularCut) { - (*i)->setNodeBorder(&myNode, p); - for (std::set::iterator k = same[*i].begin(); k != same[*i].end(); ++k) { - (*k)->setNodeBorder(&myNode, p); - } + (*i)->setNodeBorder(&myNode, p, p2, rectangularCut); + for (std::set::iterator k = same[*i].begin(); k != same[*i].end(); ++k) { + (*k)->setNodeBorder(&myNode, p, p2, rectangularCut); } } // final curve segment @@ -405,11 +455,11 @@ } -SUMOReal -NBNodeShapeComputer::closestIntersection(const PositionVector& geom1, const PositionVector& geom2, SUMOReal offset) { - std::vector intersections = geom1.intersectsAtLengths2D(geom2); - SUMOReal result = intersections[0]; - for (std::vector::iterator it = intersections.begin() + 1; it != intersections.end(); ++it) { +double +NBNodeShapeComputer::closestIntersection(const PositionVector& geom1, const PositionVector& geom2, double offset) { + std::vector intersections = geom1.intersectsAtLengths2D(geom2); + double result = intersections[0]; + for (std::vector::iterator it = intersections.begin() + 1; it != intersections.end(); ++it) { if (fabs(*it - offset) < fabs(result - offset)) { result = *it; } @@ -478,7 +528,7 @@ // compute same (edges where an intersection doesn't work well // (always check an edge and its cw neightbor) // distance to look ahead for a misleading angle - const SUMOReal angleChangeLookahead = 35; + const double angleChangeLookahead = 35; EdgeSet foundOpposite; for (i = myNode.myAllEdges.begin(); i != myNode.myAllEdges.end(); i++) { EdgeVector::const_iterator j; @@ -493,12 +543,12 @@ const Position positionAtNode2 = (*j)->getGeometry()[incoming2 ? -1 : 0]; const PositionVector g1 = incoming ? (*i)->getCCWBoundaryLine(myNode) : (*i)->getCWBoundaryLine(myNode); const PositionVector g2 = incoming ? (*j)->getCCWBoundaryLine(myNode) : (*j)->getCWBoundaryLine(myNode); - const SUMOReal angle1further = (g1.size() > 2 && g1[0].distanceTo2D(g1[1]) < angleChangeLookahead ? - g1.angleAt2D(1) : g1.angleAt2D(0)); - const SUMOReal angle2further = (g2.size() > 2 && g2[0].distanceTo2D(g2[1]) < angleChangeLookahead ? - g2.angleAt2D(1) : g2.angleAt2D(0)); - const SUMOReal angleDiff = GeomHelper::angleDiff(g1.angleAt2D(0), g2.angleAt2D(0)); - const SUMOReal angleDiffFurther = GeomHelper::angleDiff(angle1further, angle2further); + const double angle1further = (g1.size() > 2 && g1[0].distanceTo2D(g1[1]) < angleChangeLookahead ? + g1.angleAt2D(1) : g1.angleAt2D(0)); + const double angle2further = (g2.size() > 2 && g2[0].distanceTo2D(g2[1]) < angleChangeLookahead ? + g2.angleAt2D(1) : g2.angleAt2D(0)); + const double angleDiff = GeomHelper::angleDiff(g1.angleAt2D(0), g2.angleAt2D(0)); + const double angleDiffFurther = GeomHelper::angleDiff(angle1further, angle2further); const bool ambiguousGeometry = ((angleDiff > 0 && angleDiffFurther < 0) || (angleDiff < 0 && angleDiffFurther > 0)); const bool differentDirs = (incoming != incoming2); //if (ambiguousGeometry) { @@ -541,10 +591,10 @@ bool NBNodeShapeComputer::badIntersection(const NBEdge* e1, const NBEdge* e2, const PositionVector& e1cw, const PositionVector& e2ccw, - SUMOReal distance) { + double distance) { // check whether the two edges are on top of each other. In that case they should be joined // also, if they never touch along their common length - const SUMOReal commonLength = MIN3(distance, e1->getGeometry().length(), e2->getGeometry().length()); + const double commonLength = MIN3(distance, e1->getGeometry().length(), e2->getGeometry().length()); PositionVector geom1 = e1->getGeometry(); PositionVector geom2 = e2->getGeometry(); // shift to make geom the centerline of the edge regardless of spreadtype @@ -563,10 +613,10 @@ } geom1 = geom1.getSubpart2D(0, commonLength); geom2 = geom2.getSubpart2D(0, commonLength); - std::vector distances = geom1.distances(geom2, true); - const SUMOReal minDistanceThreshold = (e1->getTotalWidth() + e2->getTotalWidth()) / 2 + POSITION_EPS; - const SUMOReal minDist = VectorHelper::minValue(distances); - const SUMOReal maxDist = VectorHelper::maxValue(distances); + std::vector distances = geom1.distances(geom2, true); + const double minDistanceThreshold = (e1->getTotalWidth() + e2->getTotalWidth()) / 2 + POSITION_EPS; + const double minDist = VectorHelper::minValue(distances); + const double maxDist = VectorHelper::maxValue(distances); const bool onTop = maxDist - POSITION_EPS < minDistanceThreshold; const bool curvingTowards = geom1[0].distanceTo2D(geom2[0]) > minDistanceThreshold && minDist < minDistanceThreshold; const bool intersects = e1cw.intersects(e2ccw); @@ -619,9 +669,9 @@ GeomsMap& geomsCCW, EdgeVector::const_iterator& cwi, EdgeVector::const_iterator& ccwi, - SUMOReal& cad, - SUMOReal& ccad) { - const SUMOReal twoPI = (SUMOReal)(2 * M_PI); + double& cad, + double& ccad) { + const double twoPI = (double)(2 * M_PI); cwi = current; cwi++; if (cwi == edges.end()) { @@ -634,10 +684,10 @@ ccwi--; } - const SUMOReal angleCurCCW = geomsCCW[*current].angleAt2D(0); - const SUMOReal angleCurCW = geomsCW[*current].angleAt2D(0); - const SUMOReal angleCCW = geomsCW[*ccwi].angleAt2D(0); - const SUMOReal angleCW = geomsCCW[*cwi].angleAt2D(0); + const double angleCurCCW = geomsCCW[*current].angleAt2D(0); + const double angleCurCW = geomsCW[*current].angleAt2D(0); + const double angleCCW = geomsCW[*ccwi].angleAt2D(0); + const double angleCW = geomsCCW[*cwi].angleAt2D(0); ccad = angleCCW - angleCurCCW; while (ccad < 0.) { ccad += twoPI; @@ -679,6 +729,7 @@ np.set(np.x(), np.y(), myNode.getPosition().z()); ret.push_back_noDoublePos(np); } + (*i)->resetNodeBorder(&myNode); } return ret; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBNodeShapeComputer.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBNodeShapeComputer.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBNodeShapeComputer.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBNodeShapeComputer.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 2004-01-12 -/// @version $Id: NBNodeShapeComputer.h 21545 2016-09-27 12:26:01Z namdre $ +/// @version $Id: NBNodeShapeComputer.h 23150 2017-02-27 12:08:30Z behrisch $ /// // This class computes shapes of junctions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -135,15 +135,15 @@ GeomsMap& geomsCCW, EdgeVector::const_iterator& cwi, EdgeVector::const_iterator& ccwi, - SUMOReal& cad, - SUMOReal& ccad); + double& cad, + double& ccad); /// @return whether trying to intersect these edges would probably fail bool badIntersection(const NBEdge* e1, const NBEdge* e2, - const PositionVector& e1cw, const PositionVector& e2ccw, SUMOReal distance); + const PositionVector& e1cw, const PositionVector& e2ccw, double distance); /// @brief return the intersection point closest to the given offset - SUMOReal closestIntersection(const PositionVector& geom1, const PositionVector& geom2, SUMOReal offset); + double closestIntersection(const PositionVector& geom1, const PositionVector& geom2, double offset); private: /// The node to compute the geometry for diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBOwnTLDef.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBOwnTLDef.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBOwnTLDef.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBOwnTLDef.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Tue, 29.05.2005 -/// @version $Id: NBOwnTLDef.cpp 21210 2016-07-21 10:02:38Z behrisch $ +/// @version $Id: NBOwnTLDef.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A traffic light logics which must be computed (only nodes/edges are given) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,10 +44,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - #define MIN_GREEN_TIME 5 // =========================================================================== @@ -84,7 +80,7 @@ } -SUMOReal +double NBOwnTLDef::getDirectionalWeight(LinkDirection dir) { switch (dir) { case LINKDIR_STRAIGHT: @@ -100,9 +96,9 @@ return 0; } -SUMOReal +double NBOwnTLDef::computeUnblockedWeightedStreamNumber(const NBEdge* const e1, const NBEdge* const e2) { - SUMOReal val = 0; + double val = 0; for (int e1l = 0; e1l < e1->getNumLanes(); e1l++) { std::vector approached1 = e1->getConnectionsFromLane(e1l); for (int e2l = 0; e2l < e2->getNumLanes(); e2l++) { @@ -130,16 +126,16 @@ std::pair NBOwnTLDef::getBestCombination(const EdgeVector& edges) { std::pair bestPair(static_cast(0), static_cast(0)); - SUMOReal bestValue = -1; + double bestValue = -1; for (EdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) { for (EdgeVector::const_iterator j = i + 1; j != edges.end(); ++j) { - const SUMOReal value = computeUnblockedWeightedStreamNumber(*i, *j); + const double value = computeUnblockedWeightedStreamNumber(*i, *j); if (value > bestValue) { bestValue = value; bestPair = std::pair(*i, *j); } else if (value == bestValue) { - const SUMOReal ca = GeomHelper::getMinAngleDiff((*i)->getAngleAtNode((*i)->getToNode()), (*j)->getAngleAtNode((*j)->getToNode())); - const SUMOReal oa = GeomHelper::getMinAngleDiff(bestPair.first->getAngleAtNode(bestPair.first->getToNode()), bestPair.second->getAngleAtNode(bestPair.second->getToNode())); + const double ca = GeomHelper::getMinAngleDiff((*i)->getAngleAtNode((*i)->getToNode()), (*j)->getAngleAtNode((*j)->getToNode())); + const double oa = GeomHelper::getMinAngleDiff(bestPair.first->getAngleAtNode(bestPair.first->getToNode()), bestPair.second->getAngleAtNode(bestPair.second->getToNode())); if (fabs(oa - ca) < NUMERICAL_EPS) { // break ties by id if (bestPair.first->getID() < (*i)->getID()) { bestPair = std::pair(*i, *j); @@ -231,7 +227,7 @@ const std::vector& c = (*i)->getCrossings(); if (!onlyConts) { // set tl indices for crossings - (*i)->setCrossingTLIndices(noLinksAll); + (*i)->setCrossingTLIndices(getID(), noLinksAll); } copy(c.begin(), c.end(), std::back_inserter(crossings)); noLinksAll += (int)c.size(); @@ -249,7 +245,7 @@ if (incoming.size() == 2) { // if there are only 2 incoming edges we need to decide whether they are a crossing or a "continuation" // @node: this heuristic could be extended to also check the number of outgoing edges - SUMOReal angle = fabs(NBHelpers::relAngle(incoming[0]->getAngleAtNode(incoming[0]->getToNode()), incoming[1]->getAngleAtNode(incoming[1]->getToNode()))); + double angle = fabs(NBHelpers::relAngle(incoming[0]->getAngleAtNode(incoming[0]->getToNode()), incoming[1]->getAngleAtNode(incoming[1]->getToNode()))); // angle would be 180 for straight opposing incoming edges if (angle < 135) { chosen = std::pair(toProc[0], static_cast(0)); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBOwnTLDef.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBOwnTLDef.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBOwnTLDef.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBOwnTLDef.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Sascha Krieg /// @date Tue, 29.05.2005 -/// @version $Id: NBOwnTLDef.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NBOwnTLDef.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A traffic light logics which must be computed (only nodes/edges are given) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -185,7 +185,7 @@ * @return This stream's weight * @todo There are several magic numbers; describe */ - SUMOReal getDirectionalWeight(LinkDirection dir); + double getDirectionalWeight(LinkDirection dir); /** @brief Returns this edge's priority at the node it ends at @@ -200,7 +200,7 @@ * @param[in] e2 The second edge * @todo There are several magic numbers; describe */ - SUMOReal computeUnblockedWeightedStreamNumber(const NBEdge* const e1, const NBEdge* const e2); + double computeUnblockedWeightedStreamNumber(const NBEdge* const e1, const NBEdge* const e2); /** @brief Returns the combination of two edges from the given which has most unblocked streams diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBPTStopCont.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBPTStopCont.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBPTStopCont.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBPTStopCont.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,58 @@ +/****************************************************************************/ +/// @file NBPTStopCont.cpp +/// @author Gregor Laemmel +/// @date Tue, 20 Mar 2017 +/// @version $Id: NBPTStopCont.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +// Container for pt stops during the netbuilding process +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +#include +#include "NBPTStopCont.h" +#include "NBEdgeCont.h" +#include "NBEdge.h" + +bool NBPTStopCont::insert(NBPTStop* ptStop) { + std::string id = ptStop->getID(); + PTStopsCont::iterator i = myPTStops.find(id); + if (i != myPTStops.end()) { + return false; + } + myPTStops[id] = ptStop; + return true; +} +void NBPTStopCont::process(NBEdgeCont& cont) { + + for (PTStopsCont::iterator i = myPTStops.begin(); i != myPTStops.end();) { + std::string edgeId = i->second->getEdgeId(); + NBEdge* edge = cont.getByID(edgeId); + + if (edge != 0) { + const std::string& lane = edge->getLaneID(0); + i->second->setLaneID(lane); + const PositionVector& shape = edge->getLaneShape(0); + double offset = shape.nearest_offset_to_point2D(i->second->getPosition(), true); + i->second->computExtent(offset, edge->getLength()); + i++; + } else { + WRITE_WARNING("Could not find corresponding edge for pt stop: " + i->second->getName() + ". Thus, it will be removed!"); + EdgeVector edgeVector = cont.getGeneratedFrom((*i).second->getOrigEdgeId()); + //std::cout << edgeVector.size() << std::endl; + myPTStops.erase(i++); + } + + } + +} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBPTStopCont.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBPTStopCont.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBPTStopCont.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBPTStopCont.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,71 @@ +/****************************************************************************/ +/// @file NBPTStopCont.h +/// @author Gregor Laemmel +/// @date Tue, 20 Mar 2017 +/// @version $Id: NBPTStopCont.h 23771 2017-04-02 12:49:52Z behrisch $ +/// +// Container for pt stops during the netbuilding process +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +#ifndef SUMO_NBPTSTOPCONT_H +#define SUMO_NBPTSTOPCONT_H + +#include +#include +#include "NBPTStop.h" + +class NBEdgeCont; + +class NBPTStopCont { + +public: + /** @brief Inserts a node into the map + * @param[in] stop The pt stop to insert + * @return Whether the pt stop could be added + */ + bool insert(NBPTStop* ptStop); + + + /// @brief Returns the number of pt stops stored in this container + int size() const { + return (int) myPTStops.size(); + } + + /** @brief Returns the pointer to the begin of the stored pt stops + * @return The iterator to the beginning of stored pt stops + */ + std::map::const_iterator begin() const { + return myPTStops.begin(); + } + + + /** @brief Returns the pointer to the end of the stored pt stops + * @return The iterator to the end of stored pt stops + */ + std::map::const_iterator end() const { + return myPTStops.end(); + } + + + void process(NBEdgeCont& cont); +private: + /// @brief Definition of the map of names to pt stops + typedef std::map PTStopsCont; + + /// @brief The map of names to pt stops + PTStopsCont myPTStops; + +}; + +#endif //SUMO_NBPTSTOPCONT_H diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBPTStop.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBPTStop.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBPTStop.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBPTStop.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,99 @@ +/****************************************************************************/ +/// @file NBPtStop.cpp +/// @author Gregor Laemmel +/// @date Tue, 20 Mar 2017 +/// @version $Id: NBPTStop.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +// The representation of a single pt stop +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include "NBPTStop.h" + + +// =========================================================================== +// method definitions +// =========================================================================== +NBPTStop::NBPTStop(std::string ptStopId, Position position, std::string edgeId, std::string origEdgeId, double length, std::string name) : + myPTStopId(ptStopId), + myPosition(position), + myEdgeId(edgeId), + myOrigEdgeId(origEdgeId), + myPTStopLength(length), + myName(name), + myFriendlyPos(false) { + +} + +std::string +NBPTStop::getID() const { + return myPTStopId; +} + +const std::string +NBPTStop::getOrigEdgeId() { + return myOrigEdgeId; +} + +const std::string +NBPTStop::getEdgeId() { + return myEdgeId; +} + +const std::string +NBPTStop::getName() { + return myName; +} +const Position& NBPTStop::getPosition() { + return myPosition; +} +void NBPTStop::computExtent(double center, double edgeLength) { + myFrom = center - myPTStopLength / 2.; + myTo = center + myPTStopLength / 2.; + if (myFrom < 0 || myTo > edgeLength) { + myFriendlyPos = true; + } +} +void NBPTStop::setLaneID(const std::string& laneId) { + myLaneId = laneId; +} +void NBPTStop::write(OutputDevice& device) { + device.openTag(SUMO_TAG_BUS_STOP); + device.writeAttr(SUMO_ATTR_ID, myPTStopId); + if (myName != "") { + device.writeAttr(SUMO_ATTR_NAME, myName); + } + device.writeAttr(SUMO_ATTR_LANE, myLaneId); + device.writeAttr(SUMO_ATTR_STARTPOS, myFrom); + device.writeAttr(SUMO_ATTR_ENDPOS, myTo); + if (myFriendlyPos) { + device.writeAttr(SUMO_ATTR_FRIENDLY_POS, "true"); + } + device.closeTag(); + +} +void NBPTStop::reshiftPostion(const double offsetX, const double offsetY) { + myPosition.add(offsetX, offsetY, 0); + +} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBPTStop.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBPTStop.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBPTStop.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBPTStop.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,92 @@ +/****************************************************************************/ +/// @file NBPtStop.h +/// @author Gregor Laemmel +/// @date Tue, 20 Mar 2017 +/// @version $Id: NBPTStop.h 24030 2017-04-24 07:16:24Z behrisch $ +/// +// The representation of a single pt stop +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef SUMO_NBPTSTOP_H +#define SUMO_NBPTSTOP_H + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include + + +// =========================================================================== +// class declarations +// =========================================================================== +class OutputDevice; + + +// =========================================================================== +// class definitions +// =========================================================================== +/** +* @class NBPTStop +* @brief The representation of a single pt stop +*/ +class NBPTStop { + +public: + /**@brief Constructor + * @param[in] id The id of the pt stop + * @param[in] position The position of the pt stop + * @param[in] edgeId The edge id of the pt stop + * @param[in] length The length of the pt stop + */ + NBPTStop(std::string ptStopId, Position position, std::string edgeId, std::string origEdgeId, double length, std::string name); + std::string getID() const; + + const std::string getEdgeId(); + const std::string getOrigEdgeId(); + const std::string getName(); + const Position& getPosition(); + void computExtent(double center, double d); + void setLaneID(const std::string& laneId); + void write(OutputDevice& device); + void reshiftPostion(const double offsetX, const double offsetY); + + +private: + const std::string myPTStopId; + Position myPosition; + const std::string myEdgeId; + const std::string myOrigEdgeId; + const double myPTStopLength; + const std::string myName; + std::string myLaneId; + + double myFrom; + double myTo; + bool myFriendlyPos; + + +private: + /// @brief Invalidated assignment operator. + NBPTStop& operator=(const NBPTStop&); + + +}; + +#endif //SUMO_NBPTSTOP_H diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBRequest.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBRequest.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBRequest.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBRequest.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Tue, 20 Nov 2001 -/// @version $Id: NBRequest.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NBRequest.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // This class computes the logic of a junction /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,10 +48,6 @@ #include "NBNode.h" #include "NBRequest.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member variables @@ -645,13 +641,13 @@ // since we know that the edge2edge connections are in conflict, the only // situation in which the lane2lane connections can be conflict-free is, if // they target the same edge but do not cross each other - SUMOReal angle = NBHelpers::relAngle( - from->getAngleAtNode(from->getToNode()), to->getAngleAtNode(to->getFromNode())); + double angle = NBHelpers::relAngle( + from->getAngleAtNode(from->getToNode()), to->getAngleAtNode(to->getFromNode())); if (angle == 180) { angle = -180; // turnarounds are left turns } - const SUMOReal prohibitorAngle = NBHelpers::relAngle( - prohibitorFrom->getAngleAtNode(prohibitorFrom->getToNode()), to->getAngleAtNode(to->getFromNode())); + const double prohibitorAngle = NBHelpers::relAngle( + prohibitorFrom->getAngleAtNode(prohibitorFrom->getToNode()), to->getAngleAtNode(to->getFromNode())); const bool rightOfProhibitor = prohibitorFrom->isTurningDirectionAt(to) || (angle > prohibitorAngle && !from->isTurningDirectionAt(to)); return rightOfProhibitor ? toLane >= prohibitorToLane : toLane <= prohibitorToLane; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBRequest.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBRequest.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBRequest.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBRequest.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: NBRequest.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NBRequest.h 22608 2017-01-17 06:28:54Z behrisch $ /// // This class computes the logic of a junction /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBSign.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBSign.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBSign.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBSign.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Nov 2012 -/// @version $Id: NBSign.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: NBSign.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A class representing a street sign /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include "NBEdge.h" #include "NBSign.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members @@ -68,7 +64,7 @@ // member method definitions // =========================================================================== -NBSign::NBSign(SignType type, SUMOReal offset, const std::string label) : +NBSign::NBSign(SignType type, double offset, const std::string label) : myType(type), myOffset(offset), myLabel(label) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBSign.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBSign.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBSign.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBSign.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Nov 2012 -/// @version $Id: NBSign.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NBSign.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A class representing a street sign /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -72,7 +72,7 @@ * @param[in] offset The offset of the sign from the start of its edge * @param[in] label The (optional) label (for SPEED, SLOPE etc) */ - NBSign(SignType type, SUMOReal offset, const std::string label = ""); + NBSign(SignType type, double offset, const std::string label = ""); /// @brief Destructor @@ -87,7 +87,7 @@ SignType myType; /// @brief The offset of the sign from the start of its edge - SUMOReal myOffset; + double myOffset; /// @brief The (optional) label (for SPEED, SLOPE etc) std::string myLabel; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBTrafficLightDefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBTrafficLightDefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBTrafficLightDefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBTrafficLightDefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NBTrafficLightDefinition.cpp 21474 2016-09-14 09:05:31Z behrisch $ +/// @version $Id: NBTrafficLightDefinition.cpp 23654 2017-03-24 12:21:55Z namdre $ /// // The base class for traffic light logic definitions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,10 +44,6 @@ #include "NBOwnTLDef.h" #include "NBContHelper.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members // =========================================================================== @@ -142,8 +138,8 @@ int -NBTrafficLightDefinition::computeBrakingTime(SUMOReal minDecel) const { - SUMOReal vmax = NBContHelper::maxSpeed(myIncomingEdges); +NBTrafficLightDefinition::computeBrakingTime(double minDecel) const { + double vmax = NBContHelper::maxSpeed(myIncomingEdges); return (int)(vmax / minDecel); } @@ -437,6 +433,9 @@ } } } + if (myControlledLinks.size() > 0 && tlIndex == 0) { + WRITE_WARNING("The rail crossing '" + getID() + "' does not have any roads."); + } } @@ -477,6 +476,10 @@ (*i)->removeTrafficLight(&dummy); } myRightOnRedConflictsReady = true; + //std::cout << " rightOnRedConflicts tls=" << getID() << " pro=" << getProgramID() << "\n"; + //for (RightOnRedConflicts::const_iterator it = myRightOnRedConflicts.begin(); it != myRightOnRedConflicts.end(); ++it) { + // std::cout << " " << it->first << ", " << it->second << "\n"; + //} } return std::find(myRightOnRedConflicts.begin(), myRightOnRedConflicts.end(), std::make_pair(index, foeIndex)) != myRightOnRedConflicts.end(); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBTrafficLightDefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBTrafficLightDefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBTrafficLightDefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBTrafficLightDefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NBTrafficLightDefinition.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NBTrafficLightDefinition.h 23926 2017-04-12 09:54:45Z behrisch $ /// // The base class for traffic light logic definitions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -302,6 +302,12 @@ } + /// @brief returns the controlled links (non const version) + NBConnectionVector& getControlledLinks() { + return myControlledLinks; + } + + /** @brief Returns the ProgramID * @return The ID of the program (subID) */ @@ -376,7 +382,7 @@ * This time depends on the maximum speed allowed on incoming junctions. * It is computed as max_speed_allowed / minimum_vehicle_decleration */ - int computeBrakingTime(SUMOReal minDecel) const; + int computeBrakingTime(double minDecel) const; // @return whether this traffic light is invalid and should be computed diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBTrafficLightLogicCont.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBTrafficLightLogicCont.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBTrafficLightLogicCont.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBTrafficLightLogicCont.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NBTrafficLightLogicCont.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NBTrafficLightLogicCont.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A container for traffic light definitions and built programs /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,10 +43,6 @@ #include "NBEdgeCont.h" #include "NBNodeCont.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members @@ -170,6 +166,9 @@ bool NBTrafficLightLogicCont::computeSingleLogic(OptionsCont& oc, NBTrafficLightDefinition* def) { + if (def->getNodes().size() == 0) { + return false; + } const std::string& id = def->getID(); const std::string& programID = def->getProgramID(); // build program @@ -293,6 +292,7 @@ NBOwnTLDef dummy(n->getID(), n, 0, TLTYPE_STATIC); dummy.setParticipantsInformation(); dummy.setTLControllingInformation(); + n->setCrossingTLIndices(dummy.getID(), (int)dummy.getControlledLinks().size()); n->removeTrafficLight(&dummy); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBTrafficLightLogicCont.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBTrafficLightLogicCont.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBTrafficLightLogicCont.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBTrafficLightLogicCont.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NBTrafficLightLogicCont.h 21201 2016-07-19 11:57:22Z behrisch $ +/// @version $Id: NBTrafficLightLogicCont.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A container for traffic light definitions and built programs /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBTrafficLightLogic.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBTrafficLightLogic.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBTrafficLightLogic.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBTrafficLightLogic.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NBTrafficLightLogic.cpp 21210 2016-07-21 10:02:38Z behrisch $ +/// @version $Id: NBTrafficLightLogic.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A SUMO-compliant built logic for a traffic light /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,10 +45,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBTrafficLightLogic.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBTrafficLightLogic.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBTrafficLightLogic.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBTrafficLightLogic.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NBTrafficLightLogic.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NBTrafficLightLogic.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A SUMO-compliant built logic for a traffic light /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBTypeCont.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBTypeCont.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBTypeCont.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBTypeCont.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Walter Bamberger /// @date Tue, 20 Nov 2001 -/// @version $Id: NBTypeCont.cpp 21492 2016-09-19 07:21:24Z behrisch $ +/// @version $Id: NBTypeCont.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A storage for the available types of an edge /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,18 +39,14 @@ #include #include "NBTypeCont.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== void NBTypeCont::setDefaults(int defaultNumLanes, - SUMOReal defaultLaneWidth, - SUMOReal defaultSpeed, + double defaultLaneWidth, + double defaultSpeed, int defaultPriority, SVCPermissions defaultPermissions) { myDefaultType.numLanes = defaultNumLanes; @@ -62,8 +58,8 @@ void -NBTypeCont::insert(const std::string& id, int numLanes, SUMOReal maxSpeed, int prio, - SVCPermissions permissions, SUMOReal width, bool oneWayIsDefault, SUMOReal sidewalkWidth, SUMOReal bikeLaneWidth) { +NBTypeCont::insert(const std::string& id, int numLanes, double maxSpeed, int prio, + SVCPermissions permissions, double width, bool oneWayIsDefault, double sidewalkWidth, double bikeLaneWidth) { TypeDefinition newType(numLanes, maxSpeed, prio, width, permissions, oneWayIsDefault, sidewalkWidth, bikeLaneWidth); TypesCont::iterator old = myTypes.find(id); @@ -104,7 +100,7 @@ bool -NBTypeCont::addRestriction(const std::string& id, const SUMOVehicleClass svc, const SUMOReal speed) { +NBTypeCont::addRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed) { TypesCont::iterator i = myTypes.find(id); if (i == myTypes.end()) { return false; @@ -160,7 +156,7 @@ if (type.attrs.count(SUMO_ATTR_BIKELANEWIDTH) > 0) { into.writeAttr(SUMO_ATTR_BIKELANEWIDTH, type.bikeLaneWidth); } - for (std::map::const_iterator j = type.restrictions.begin(); j != type.restrictions.end(); ++j) { + for (std::map::const_iterator j = type.restrictions.begin(); j != type.restrictions.end(); ++j) { into.openTag(SUMO_TAG_RESTRICTION); into.writeAttr(SUMO_ATTR_VCLASS, getVehicleClassNames(j->first)); into.writeAttr(SUMO_ATTR_SPEED, j->second); @@ -181,7 +177,7 @@ } -SUMOReal +double NBTypeCont::getSpeed(const std::string& type) const { return getType(type).speed; } @@ -217,19 +213,19 @@ } -SUMOReal +double NBTypeCont::getWidth(const std::string& type) const { return getType(type).width; } -SUMOReal +double NBTypeCont::getSidewalkWidth(const std::string& type) const { return getType(type).sidewalkWidth; } -SUMOReal +double NBTypeCont::getBikeLaneWidth(const std::string& type) const { return getType(type).bikeLaneWidth; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBTypeCont.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBTypeCont.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netbuild/NBTypeCont.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netbuild/NBTypeCont.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Walter Bamberger /// @date Tue, 20 Nov 2001 -/// @version $Id: NBTypeCont.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NBTypeCont.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A storage for available types of edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -76,8 +76,8 @@ * @param[in] defaultPriority The default priority of an edge * @param[in] defaultPermissions The default permissions of an edge */ - void setDefaults(int defaultNumLanes, SUMOReal defaultLaneWidth, - SUMOReal defaultSpeed, int defaultPriority, + void setDefaults(int defaultNumLanes, double defaultLaneWidth, + double defaultSpeed, int defaultPriority, SVCPermissions defaultPermissions); @@ -92,11 +92,11 @@ * @return Whether the type could be added (no type with the same id existed) */ void insert(const std::string& id, int numLanes, - SUMOReal maxSpeed, int prio, + double maxSpeed, int prio, SVCPermissions permissions, - SUMOReal width, bool oneWayIsDefault, - SUMOReal sidewalkWidth, - SUMOReal bikeLaneWidth); + double width, bool oneWayIsDefault, + double sidewalkWidth, + double bikeLaneWidth); /** @brief Returns the number of known types * @return The number of known edge types (excluding the default) @@ -128,7 +128,7 @@ * @param[in] svc The vehicle class the restriction refers to * @param[in] speed The restricted speed */ - bool addRestriction(const std::string& id, const SUMOVehicleClass svc, const SUMOReal speed); + bool addRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed); /** @brief Copy restrictions to a type * @param[in] fromId The id of the source type @@ -157,7 +157,7 @@ * @param[in] type The name of the type to return the speed for * @return The allowed speed on edges of this type */ - SUMOReal getSpeed(const std::string& type) const; + double getSpeed(const std::string& type) const; /** @brief Returns the priority for the given type @@ -211,7 +211,7 @@ * @param[in] type The name of the type to return the width for * @return The width of lanes of edges of this type */ - SUMOReal getWidth(const std::string& type) const; + double getWidth(const std::string& type) const; /** @brief Returns the lane width for a sidewalk to be added [m] @@ -220,7 +220,7 @@ * @param[in] type The name of the type to return the width for * @return The width of lanes of edges of this type */ - SUMOReal getSidewalkWidth(const std::string& type) const; + double getSidewalkWidth(const std::string& type) const; /** @brief Returns the lane width for a bike lane to be added [m] @@ -229,7 +229,7 @@ * @param[in] type The name of the type to return the width for * @return The width of lanes of edges of this type */ - SUMOReal getBikeLaneWidth(const std::string& type) const; + double getBikeLaneWidth(const std::string& type) const; /// @} @@ -237,7 +237,7 @@ struct TypeDefinition { /// @brief Constructor TypeDefinition() : - numLanes(1), speed((SUMOReal) 13.9), priority(-1), + numLanes(1), speed((double) 13.9), priority(-1), permissions(SVC_UNSPECIFIED), oneWay(true), discard(false), width(NBEdge::UNSPECIFIED_WIDTH), @@ -246,10 +246,10 @@ } /// @brief Constructor - TypeDefinition(int _numLanes, SUMOReal _speed, int _priority, - SUMOReal _width, SVCPermissions _permissions, bool _oneWay, - SUMOReal _sideWalkWidth, - SUMOReal _bikeLaneWidth) : + TypeDefinition(int _numLanes, double _speed, int _priority, + double _width, SVCPermissions _permissions, bool _oneWay, + double _sideWalkWidth, + double _bikeLaneWidth) : numLanes(_numLanes), speed(_speed), priority(_priority), permissions(_permissions), oneWay(_oneWay), discard(false), width(_width), @@ -260,7 +260,7 @@ /// @brief The number of lanes of an edge int numLanes; /// @brief The maximal velocity on an edge in m/s - SUMOReal speed; + double speed; /// @brief The priority of an edge int priority; /// @brief List of vehicle types that are allowed on this edge @@ -270,15 +270,15 @@ /// @brief Whether edges of this type shall be discarded bool discard; /// @brief The width of lanes of edges of this type [m] - SUMOReal width; + double width; /* @brief The width of the sidewalk that should be added as an additional lane * a value of NBEdge::UNSPECIFIED_WIDTH indicates that no sidewalk should be added */ - SUMOReal sidewalkWidth; + double sidewalkWidth; /* @brief The width of the bike lane that should be added as an additional lane * a value of NBEdge::UNSPECIFIED_WIDTH indicates that no bike lane should be added */ - SUMOReal bikeLaneWidth; + double bikeLaneWidth; /// @brief The vehicle class specific speed restrictions - std::map restrictions; + std::map restrictions; /// @brief The attributes which have been set std::set attrs; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netconvert_main.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netconvert_main.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netconvert_main.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netconvert_main.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: netconvert_main.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: netconvert_main.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Main for NETCONVERT /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -48,14 +47,11 @@ #include #include #include +#include #include #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -92,6 +88,7 @@ bool ok = NIFrame::checkOptions(); ok &= NBFrame::checkOptions(); ok &= NWFrame::checkOptions(); + ok &= SystemFrame::checkOptions(); return ok; } @@ -161,7 +158,7 @@ ret = 1; #endif } - NBDistribution::clear(); + DistributionCont::clear(); SystemFrame::close(); // report about ending if (ret == 0) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditional.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditional.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditional.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditional.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEAdditional.cpp /// @author Pablo Alvarez Lopez /// @date Dec 2015 -/// @version $Id: GNEAdditional.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEAdditional.cpp 23560 2017-03-20 14:57:08Z palcraft $ /// /// A abstract class for representation of additional elements /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,25 +55,20 @@ #include "GNEUndoList.h" #include "GNEViewNet.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif - // =========================================================================== // member method definitions // =========================================================================== -GNEAdditional::GNEAdditional(const std::string& id, GNEViewNet* viewNet, Position pos, SumoXMLTag tag, GNEAdditionalSet* additionalSetParent, bool blocked) : +GNEAdditional::GNEAdditional(const std::string& id, GNEViewNet* viewNet, Position pos, SumoXMLTag tag, GUIIcon icon) : GUIGlObject(GLO_ADDITIONAL, id), - GNEAttributeCarrier(tag), + GNEAttributeCarrier(tag, icon), myViewNet(viewNet), myEdge(NULL), myLane(NULL), myPosition(pos), - myAdditionalSetParent(additionalSetParent), myBlockIconRotation(0), - myBlocked(blocked), + myBlocked(false), myInspectionable(true), mySelectable(true), myMovable(true), @@ -82,19 +77,10 @@ myAdditionalDialog(NULL) { // Set rotation left hand myRotationLefthand = OptionsCont::getOptions().getBool("lefthand"); - // If this additional belongs to a set, add it. - if (myAdditionalSetParent) { - myAdditionalSetParent->addAdditionalChild(this); - } } -GNEAdditional::~GNEAdditional() { - // If this additional belongs to a set, remove it. - if (myAdditionalSetParent) { - myAdditionalSetParent->removeAdditionalGeometryChild(this); - } -} +GNEAdditional::~GNEAdditional() {} void @@ -163,12 +149,6 @@ } -GNEAdditionalSet* -GNEAdditional::getAdditionalSetParent() const { - return myAdditionalSetParent; -} - - void GNEAdditional::setAdditionalID(const std::string& id) { // Save old ID @@ -225,46 +205,34 @@ GNELane* lane = myViewNet->getNet()->retrieveLane(getParentName(), false); if (lane) { // Show menu command inner position - const SUMOReal innerPos = myShape.nearest_offset_to_point2D(parent.getPositionInformation()); + const double innerPos = myShape.nearest_offset_to_point2D(parent.getPositionInformation()); new FXMenuCommand(ret, ("inner position: " + toString(innerPos)).c_str(), 0, 0, 0); // If shape isn't empty, show menu command lane position if (myShape.size() > 0) { - const SUMOReal lanePos = lane->getShape().nearest_offset_to_point2D(myShape[0]); - new FXMenuCommand(ret, ("lane position: " + toString(innerPos + lanePos)).c_str(), 0, 0, 0); + const double lanePos = lane->getShape().nearest_offset_to_point2D(myShape[0]); + new FXMenuCommand(ret, ("position over " + toString(SUMO_TAG_LANE) + ": " + toString(innerPos + lanePos)).c_str(), 0, 0, 0); } } else { - throw InvalidArgument("Additional with id = '" + getMicrosimID() + "' don't have their lane as a ParentName()"); + throw InvalidArgument(toString(getTag()) + " with ID '" + getMicrosimID() + "' doesn't have their lane as a ParentName()"); } } else if (std::find(attributes.begin(), attributes.end(), SUMO_ATTR_EDGE) != attributes.end()) { // If additional own an edge as attribute, get lane GNEEdge* edge = myViewNet->getNet()->retrieveEdge(getParentName(), false); if (edge) { // Show menu command inner position - const SUMOReal innerPos = myShape.nearest_offset_to_point2D(parent.getPositionInformation()); + const double innerPos = myShape.nearest_offset_to_point2D(parent.getPositionInformation()); new FXMenuCommand(ret, ("inner position: " + toString(innerPos)).c_str(), 0, 0, 0); // If shape isn't empty, show menu command edge position if (myShape.size() > 0) { - const SUMOReal edgePos = edge->getLanes().at(0)->getShape().nearest_offset_to_point2D(myShape[0]); - new FXMenuCommand(ret, ("edge position: " + toString(innerPos + edgePos)).c_str(), 0, 0, 0); + const double edgePos = edge->getLanes().at(0)->getShape().nearest_offset_to_point2D(myShape[0]); + new FXMenuCommand(ret, ("position over " + toString(SUMO_TAG_LANE) + ": " + toString(innerPos + edgePos)).c_str(), 0, 0, 0); } } else { - throw InvalidArgument("Additional with id = '" + getMicrosimID() + "' don't have their edge as a ParentName()"); + throw InvalidArgument(toString(getTag()) + " with ID '" + getMicrosimID() + "' don't have their edge as a ParentName()"); } } else { new FXMenuCommand(ret, ("position in view: " + toString(myPosition.x()) + "," + toString(myPosition.y())).c_str(), 0, 0, 0); } - // Show childs if this is is an additionalSet - GNEAdditionalSet* additionalSet = dynamic_cast(this); - if (additionalSet) { - new FXMenuSeparator(ret); - if (additionalSet->getNumberOfAdditionalChilds() > 0) { - new FXMenuCommand(ret, ("number of additional childs: " + toString(additionalSet->getNumberOfAdditionalChilds())).c_str(), 0, 0, 0); - } else if (additionalSet->getNumberOfEdgeChilds() > 0) { - new FXMenuCommand(ret, ("number of edge childs: " + toString(additionalSet->getNumberOfEdgeChilds())).c_str(), 0, 0, 0); - } else if (additionalSet->getNumberOfLaneChilds() > 0) { - new FXMenuCommand(ret, ("number of lane childs: " + toString(additionalSet->getNumberOfLaneChilds())).c_str(), 0, 0, 0); - } - } new FXMenuSeparator(ret); // let the GNEViewNet store the popup position dynamic_cast(parent).markPopupPosition(); @@ -278,12 +246,12 @@ UNUSED_PARAMETER(parent); // get attributes std::vector attributes = getAttrs(); - // Create tanñe + // Create table GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this, (int)attributes.size()); // Iterate over attributes for (std::vector::iterator i = attributes.begin(); i != attributes.end(); i++) { // Add attribute and set it dynamic if aren't unique - if (GNEAttributeCarrier::isUnique(*i)) { + if (GNEAttributeCarrier::isUnique(getTag(), *i)) { ret->mkItem(toString(*i).c_str(), false, getAttribute(*i)); } else { ret->mkItem(toString(*i).c_str(), true, getAttribute(*i)); @@ -307,11 +275,11 @@ void GNEAdditional::setBlockIconRotation(GNELane* lane) { if (myShape.size() > 0 && myShape.length() != 0) { - // If lenght of the shape is distint to 0, Obtain rotation of center of shape + // If length of the shape is distint to 0, Obtain rotation of center of shape myBlockIconRotation = myShape.rotationDegreeAtOffset((myShape.length() / 2.)) - 90; } else if (lane != NULL) { // If additional is over a lane, set rotation in the position over lane - myBlockIconRotation = lane->getShape().rotationDegreeAtOffset(lane->getPositionRelativeToParametricLenght(myPosition.x())) - 90; + myBlockIconRotation = lane->getShape().rotationDegreeAtOffset(lane->getPositionRelativeToParametricLength(myPosition.x())) - 90; } else { // In other case, rotation is 0 myBlockIconRotation = 0; @@ -320,7 +288,7 @@ void -GNEAdditional::drawLockIcon(SUMOReal size) const { +GNEAdditional::drawLockIcon(double size) const { if (myViewNet->showLockIcon()) { // Start pushing matrix glPushMatrix(); @@ -330,7 +298,7 @@ glColor3d(1, 1, 1); // Rotate depending of myBlockIconRotation glRotated(myBlockIconRotation, 0, 0, -1); - // Rotate 180º + // Rotate 180 degrees glRotated(180, 0, 0, 1); // Traslate depending of the offset glTranslated(myBlockIconOffset.x(), myBlockIconOffset.y(), 0); @@ -338,24 +306,24 @@ if (isAdditionalSelected()) { if (myMovable == false) { // Draw not movable texture if additional isn't movable and is selected - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_NOTMOVINGSELECTED), size); + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_NOTMOVINGSELECTED), size); } else if (myBlocked) { // Draw lock texture if additional is movable, is blocked and is selected - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_LOCKSELECTED), size); + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_LOCKSELECTED), size); } else { // Draw empty texture if additional is movable, isn't blocked and is selected - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_EMPTYSELECTED), size); + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_EMPTYSELECTED), size); } } else { if (myMovable == false) { // Draw not movable texture if additional isn't movable - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_NOTMOVING), size); + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_NOTMOVING), size); } else if (myBlocked) { // Draw lock texture if additional is movable and is blocked - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_LOCK), size); + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_LOCK), size); } else { // Draw empty texture if additional is movable and isn't blocked - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_EMPTY), size); + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_EMPTY), size); } } // Pop matrix @@ -365,9 +333,29 @@ void +GNEAdditional::drawParentAndChildrenConnections() const { + // Iterate over myConnectionPositions + for (std::vector >::const_iterator i = myConnectionPositions.begin(); i != myConnectionPositions.end(); i++) { + // Add a draw matrix + glPushMatrix(); + // traslate in the Z axis + glTranslated(0, 0, getType() - 0.01); + // Set color of the base + GLHelper::setColor(RGBColor(255, 235, 0, 255)); + for (std::vector::const_iterator j = (*i).begin(); (j + 1) != (*i).end(); j++) { + // Draw Lines + GLHelper::drawLine((*j), (*(j + 1))); + } + // Pop draw matrix + glPopMatrix(); + } +} + + +void GNEAdditional::changeEdge(const std::string& edgeID) { if (myEdge == NULL) { - throw InvalidArgument("Additional with id = '" + getMicrosimID() + "' doesn't belong to a edge"); + throw InvalidArgument(toString(getTag()) + " with ID '" + getMicrosimID() + "' doesn't belong to an " + toString(SUMO_TAG_EDGE)); } else { myEdge->removeAdditionalChild(this); myEdge = getViewNet()->getNet()->retrieveEdge(edgeID); @@ -381,7 +369,7 @@ void GNEAdditional::changeLane(const std::string& laneID) { if (myLane == NULL) { - throw InvalidArgument("Additional with id = '" + getMicrosimID() + "' doesn't belong to a lane"); + throw InvalidArgument(toString(getTag()) + " with ID '" + getMicrosimID() + "' doesn't belong to a " + toString(SUMO_TAG_LANE)); } else { myLane->removeAdditionalChild(this); myLane = getViewNet()->getNet()->retrieveLane(laneID); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditionalDialog.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditionalDialog.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditionalDialog.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditionalDialog.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEAdditionalDialog.cpp /// @author Pablo Alvarez Lopez /// @date April 2016 -/// @version $Id: GNEAdditionalDialog.cpp 21320 2016-08-23 11:11:18Z behrisch $ +/// @version $Id: GNEAdditionalDialog.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// /// A abstract class for editing additional elements /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -29,14 +29,13 @@ #include #include +#include +#include + #include "GNEAdditionalDialog.h" #include "GNEAdditional.h" #include "GNEViewNet.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif - // =========================================================================== // FOX callback mapping @@ -56,21 +55,32 @@ // =========================================================================== GNEAdditionalDialog::GNEAdditionalDialog(GNEAdditional* parent, int width, int height) : - FXDialogBox(parent->getViewNet(), ("Edit '" + parent->getID() + "' data").c_str(), LAYOUT_EXPLICIT | DECOR_TITLE | DECOR_BORDER, 0, 0, width, height) { - // Create frames - myContentFrame = new FXVerticalFrame(this, LAYOUT_EXPLICIT, 0, 0, width, height - 30); - myButtonFrame = new FXHorizontalFrame(this, LAYOUT_EXPLICIT, 0, height - 30, width, 30); - // create buttons - new FXHorizontalFrame(myButtonFrame, LAYOUT_FILL_X); - myAcceptButton = new FXButton(myButtonFrame, "accept\t\tclose", 0, this, MID_GNE_MODE_ADDITIONALDIALOG_ACCEPT, ICON_BEFORE_TEXT | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT | FRAME_THICK | FRAME_RAISED, 0, 0, 75, 23, 2, 2, 2, 2); - myCancelButton = new FXButton(myButtonFrame, "cancel\t\tclose", 0, this, MID_GNE_MODE_ADDITIONALDIALOG_CANCEL, ICON_BEFORE_TEXT | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT | FRAME_THICK | FRAME_RAISED, 0, 0, 75, 23, 2, 2, 2, 2); - myResetButton = new FXButton(myButtonFrame, "reset\t\tclose", 0, this, MID_GNE_MODE_ADDITIONALDIALOG_RESET, ICON_BEFORE_TEXT | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT | FRAME_THICK | FRAME_RAISED, 0, 0, 75, 23, 2, 2, 2, 2); - new FXHorizontalFrame(myButtonFrame, LAYOUT_FILL_X); + FXDialogBox(parent->getViewNet(), ("Edit '" + parent->getID() + "' data").c_str(), GUIDesignDialogBoxExplicit, 0, 0, width, height, 0, 0, 0, 0) { + // check that parent isn't NULL + assert(parent != NULL); + // set icon + setIcon(parent->getIcon()); + // create main frame + FXVerticalFrame* mainFrame = new FXVerticalFrame(this, GUIDesignAuxiliarFrame); + // Create frame for contents + myContentFrame = new FXVerticalFrame(mainFrame, GUIDesignContentsFrame); + // create buttons centered + FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(mainFrame, GUIDesignHorizontalFrame); + new FXHorizontalFrame(buttonsFrame, GUIDesignAuxiliarHorizontalFrame); + myAcceptButton = new FXButton(buttonsFrame, "accept\t\tclose", GUIIconSubSys::getIcon(ICON_ACCEPT), this, MID_GNE_MODE_ADDITIONALDIALOG_ACCEPT, GUIDesignButtonAccept); + myCancelButton = new FXButton(buttonsFrame, "cancel\t\tclose", GUIIconSubSys::getIcon(ICON_CANCEL), this, MID_GNE_MODE_ADDITIONALDIALOG_CANCEL, GUIDesignButtonCancel); + myResetButton = new FXButton(buttonsFrame, "reset\t\tclose", GUIIconSubSys::getIcon(ICON_RESET), this, MID_GNE_MODE_ADDITIONALDIALOG_RESET, GUIDesignButtonReset); + new FXHorizontalFrame(buttonsFrame, GUIDesignAuxiliarHorizontalFrame); } -GNEAdditionalDialog::~GNEAdditionalDialog() { -} +GNEAdditionalDialog::~GNEAdditionalDialog() {} + +void +GNEAdditionalDialog::changeAdditionalDialogHeader(const std::string& newHeader) { + // change FXDialogBox title + setTitle(newHeader.c_str()); +} /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditionalDialog.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditionalDialog.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditionalDialog.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditionalDialog.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEAdditionalDialog.h /// @author Pablo Alvarez Lopez /// @date April 2016 -/// @version $Id: GNEAdditionalDialog.h 21320 2016-08-23 11:11:18Z behrisch $ +/// @version $Id: GNEAdditionalDialog.h 22929 2017-02-13 14:38:39Z behrisch $ /// /// A abstract class for editing additional elements /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,6 +31,7 @@ #endif #include +#include // =========================================================================== @@ -52,12 +53,15 @@ FXDECLARE_ABSTRACT(GNEAdditionalDialog) public: - // Constructor + /// @brief constructor GNEAdditionalDialog(GNEAdditional* parent, int width, int height); - // destructor + /// @brief destructor ~GNEAdditionalDialog(); + /// @brief change additional dialog header + void changeAdditionalDialogHeader(const std::string& newHeader); + /// @name FOX-callbacks /// @{ /// @brief event after press accept button @@ -87,13 +91,6 @@ FXButton* myResetButton; private: - /// @brief update data table - /// @note must be implemented in all childs - virtual void updateTable() = 0; - - /// @brief frame for buttons (Not accesible for childs) - FXHorizontalFrame* myButtonFrame; - /// @brief Invalidated copy constructor GNEAdditionalDialog(const GNEAdditionalDialog&); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditionalFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditionalFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditionalFrame.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditionalFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEAdditionalFrame.cpp /// @author Pablo Alvarez Lopez /// @date Dec 2015 -/// @version $Id: GNEAdditionalFrame.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEAdditionalFrame.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// /// The Widget for add additional elements /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -27,10 +27,6 @@ #include #endif -#ifdef HAVE_VERSION_H -#include -#endif - #include #include #include @@ -38,8 +34,10 @@ #include #include #include +#include #include #include + #include "GNEAdditionalFrame.h" #include "GNEViewNet.h" #include "GNEViewParent.h" @@ -53,13 +51,8 @@ #include "GNEAttributeCarrier.h" #include "GNEChange_Additional.h" #include "GNEAdditional.h" -#include "GNEAdditionalSet.h" #include "GNEAdditionalHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping @@ -69,83 +62,92 @@ FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONAL_ITEM, GNEAdditionalFrame::onCmdSelectAdditional), }; -FXDEFMAP(GNEAdditionalFrame::additionalParameterList) GNEAdditionalParameterListMap[] = { - FXMAPFUNC(SEL_COMMAND, MID_GNE_ADDROW, GNEAdditionalFrame::additionalParameterList::onCmdAddRow), - FXMAPFUNC(SEL_COMMAND, MID_GNE_REMOVEROW, GNEAdditionalFrame::additionalParameterList::onCmdRemoveRow), +FXDEFMAP(GNEAdditionalFrame::AdditionalAttributeSingle) GNEsingleAdditionalParameterMap[] = { + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_TEXT, GNEAdditionalFrame::AdditionalAttributeSingle::onCmdSetAttribute), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_BOOL, GNEAdditionalFrame::AdditionalAttributeSingle::onCmdSetBooleanAttribute), +}; + +FXDEFMAP(GNEAdditionalFrame::AdditionalAttributeList) GNEsingleAdditionalParameterListMap[] = { + FXMAPFUNC(SEL_COMMAND, MID_GNE_ADDROW, GNEAdditionalFrame::AdditionalAttributeList::onCmdAddRow), + FXMAPFUNC(SEL_COMMAND, MID_GNE_REMOVEROW, GNEAdditionalFrame::AdditionalAttributeList::onCmdRemoveRow), }; -FXDEFMAP(GNEAdditionalFrame::additionalParameters) GNEAdditionalParametersMap[] = { - FXMAPFUNC(SEL_COMMAND, MID_HELP, GNEAdditionalFrame::additionalParameters::onCmdHelp), +FXDEFMAP(GNEAdditionalFrame::AdditionalAttributes) GNEadditionalParametersMap[] = { + FXMAPFUNC(SEL_COMMAND, MID_HELP, GNEAdditionalFrame::AdditionalAttributes::onCmdHelp), }; -FXDEFMAP(GNEAdditionalFrame::editorParameters) GNEEditorParametersMap[] = { - FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONAL_REFERENCEPOINT, GNEAdditionalFrame::editorParameters::onCmdSelectReferencePoint), - FXMAPFUNC(SEL_COMMAND, MID_HELP, GNEAdditionalFrame::editorParameters::onCmdHelp), +FXDEFMAP(GNEAdditionalFrame::NeteditAttributes) GNEEditorParametersMap[] = { + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_TEXT, GNEAdditionalFrame::NeteditAttributes::onCmdSetLength), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONAL_REFERENCEPOINT, GNEAdditionalFrame::NeteditAttributes::onCmdSelectReferencePoint), + FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_BLOCKING, GNEAdditionalFrame::NeteditAttributes::onCmdSetBlocking), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONAL_FORCEPOSITION, GNEAdditionalFrame::NeteditAttributes::onCmdSetForcePosition), + FXMAPFUNC(SEL_COMMAND, MID_HELP, GNEAdditionalFrame::NeteditAttributes::onCmdHelp), }; -FXDEFMAP(GNEAdditionalFrame::additionalSet) GNEAdditionalSetMap[] = { - FXMAPFUNC(SEL_COMMAND, MID_GNE_SELECTADDITIONALSET, GNEAdditionalFrame::additionalSet::onCmdSelectAdditionalSet), - FXMAPFUNC(SEL_COMMAND, MID_HELP, GNEAdditionalFrame::additionalSet::onCmdHelp), +FXDEFMAP(GNEAdditionalFrame::SelectorParentAdditional) GNEadditionalParentSelectorMap[] = { + FXMAPFUNC(SEL_COMMAND, MID_GNE_SELECTADDITIONALPARENT, GNEAdditionalFrame::SelectorParentAdditional::onCmdSelectAdditionalParent), + FXMAPFUNC(SEL_COMMAND, MID_HELP, GNEAdditionalFrame::SelectorParentAdditional::onCmdHelp), }; -FXDEFMAP(GNEAdditionalFrame::edgesSelector) GNEEdgesMap[] = { - FXMAPFUNC(SEL_COMMAND, MID_GNE_USESELECTEDEDGES, GNEAdditionalFrame::edgesSelector::onCmdUseSelectedEdges), - FXMAPFUNC(SEL_COMMAND, MID_GNE_CLEAREDGESELECTION, GNEAdditionalFrame::edgesSelector::onCmdClearSelection), - FXMAPFUNC(SEL_COMMAND, MID_GNE_INVERTEDGESELECTION, GNEAdditionalFrame::edgesSelector::onCmdInvertSelection), - FXMAPFUNC(SEL_CHANGED, MID_GNE_SEARCHEDGE, GNEAdditionalFrame::edgesSelector::onCmdTypeInSearchBox), - FXMAPFUNC(SEL_COMMAND, MID_GNE_SELECTEDGE, GNEAdditionalFrame::edgesSelector::onCmdSelectEdge), - FXMAPFUNC(SEL_COMMAND, MID_HELP, GNEAdditionalFrame::edgesSelector::onCmdHelp), +FXDEFMAP(GNEAdditionalFrame::SelectorParentEdges) GNEedgeParentsSelectorMap[] = { + FXMAPFUNC(SEL_COMMAND, MID_GNE_SHOWONLYSELECTEDEDGES, GNEAdditionalFrame::SelectorParentEdges::onCmdUseSelectedEdges), + FXMAPFUNC(SEL_COMMAND, MID_GNE_CLEAREDGESELECTION, GNEAdditionalFrame::SelectorParentEdges::onCmdClearSelection), + FXMAPFUNC(SEL_COMMAND, MID_GNE_INVERTEDGESELECTION, GNEAdditionalFrame::SelectorParentEdges::onCmdInvertSelection), + FXMAPFUNC(SEL_CHANGED, MID_GNE_SEARCHEDGE, GNEAdditionalFrame::SelectorParentEdges::onCmdTypeInSearchBox), + FXMAPFUNC(SEL_COMMAND, MID_GNE_SELECTEDGE, GNEAdditionalFrame::SelectorParentEdges::onCmdSelectEdge), + FXMAPFUNC(SEL_COMMAND, MID_HELP, GNEAdditionalFrame::SelectorParentEdges::onCmdHelp), }; -FXDEFMAP(GNEAdditionalFrame::lanesSelector) GNELanesMap[] = { - FXMAPFUNC(SEL_COMMAND, MID_GNE_USESELECTEDLANES, GNEAdditionalFrame::lanesSelector::onCmdUseSelectedLanes), - FXMAPFUNC(SEL_COMMAND, MID_GNE_CLEARLANESELECTION, GNEAdditionalFrame::lanesSelector::onCmdClearSelection), - FXMAPFUNC(SEL_COMMAND, MID_GNE_INVERTLANESELECTION, GNEAdditionalFrame::lanesSelector::onCmdInvertSelection), - FXMAPFUNC(SEL_CHANGED, MID_GNE_SEARCHLANE, GNEAdditionalFrame::lanesSelector::onCmdTypeInSearchBox), - FXMAPFUNC(SEL_COMMAND, MID_GNE_SELECTLANE, GNEAdditionalFrame::lanesSelector::onCmdSelectLane), - FXMAPFUNC(SEL_COMMAND, MID_HELP, GNEAdditionalFrame::lanesSelector::onCmdHelp), +FXDEFMAP(GNEAdditionalFrame::SelectorParentLanes) GNElaneParentsSelectorMap[] = { + FXMAPFUNC(SEL_COMMAND, MID_GNE_USESELECTEDLANES, GNEAdditionalFrame::SelectorParentLanes::onCmdUseSelectedLanes), + FXMAPFUNC(SEL_COMMAND, MID_GNE_CLEARLANESELECTION, GNEAdditionalFrame::SelectorParentLanes::onCmdClearSelection), + FXMAPFUNC(SEL_COMMAND, MID_GNE_INVERTLANESELECTION, GNEAdditionalFrame::SelectorParentLanes::onCmdInvertSelection), + FXMAPFUNC(SEL_CHANGED, MID_GNE_SEARCHLANE, GNEAdditionalFrame::SelectorParentLanes::onCmdTypeInSearchBox), + FXMAPFUNC(SEL_COMMAND, MID_GNE_SELECTLANE, GNEAdditionalFrame::SelectorParentLanes::onCmdSelectLane), + FXMAPFUNC(SEL_COMMAND, MID_HELP, GNEAdditionalFrame::SelectorParentLanes::onCmdHelp), }; // Object implementation -FXIMPLEMENT(GNEAdditionalFrame, FXScrollWindow, GNEAdditionalMap, ARRAYNUMBER(GNEAdditionalMap)) -FXIMPLEMENT(GNEAdditionalFrame::additionalParameterList, FXMatrix, GNEAdditionalParameterListMap, ARRAYNUMBER(GNEAdditionalParameterListMap)) -FXIMPLEMENT(GNEAdditionalFrame::additionalParameters, FXGroupBox, GNEAdditionalParametersMap, ARRAYNUMBER(GNEAdditionalParametersMap)) -FXIMPLEMENT(GNEAdditionalFrame::editorParameters, FXGroupBox, GNEEditorParametersMap, ARRAYNUMBER(GNEEditorParametersMap)) -FXIMPLEMENT(GNEAdditionalFrame::additionalSet, FXGroupBox, GNEAdditionalSetMap, ARRAYNUMBER(GNEAdditionalSetMap)) -FXIMPLEMENT(GNEAdditionalFrame::edgesSelector, FXGroupBox, GNEEdgesMap, ARRAYNUMBER(GNEEdgesMap)) -FXIMPLEMENT(GNEAdditionalFrame::lanesSelector, FXGroupBox, GNELanesMap, ARRAYNUMBER(GNELanesMap)) +FXIMPLEMENT(GNEAdditionalFrame, FXVerticalFrame, GNEAdditionalMap, ARRAYNUMBER(GNEAdditionalMap)) +FXIMPLEMENT(GNEAdditionalFrame::AdditionalAttributeSingle, FXHorizontalFrame, GNEsingleAdditionalParameterMap, ARRAYNUMBER(GNEsingleAdditionalParameterMap)) +FXIMPLEMENT(GNEAdditionalFrame::AdditionalAttributeList, FXVerticalFrame, GNEsingleAdditionalParameterListMap, ARRAYNUMBER(GNEsingleAdditionalParameterListMap)) +FXIMPLEMENT(GNEAdditionalFrame::AdditionalAttributes, FXGroupBox, GNEadditionalParametersMap, ARRAYNUMBER(GNEadditionalParametersMap)) +FXIMPLEMENT(GNEAdditionalFrame::NeteditAttributes, FXGroupBox, GNEEditorParametersMap, ARRAYNUMBER(GNEEditorParametersMap)) +FXIMPLEMENT(GNEAdditionalFrame::SelectorParentAdditional, FXGroupBox, GNEadditionalParentSelectorMap, ARRAYNUMBER(GNEadditionalParentSelectorMap)) +FXIMPLEMENT(GNEAdditionalFrame::SelectorParentEdges, FXGroupBox, GNEedgeParentsSelectorMap, ARRAYNUMBER(GNEedgeParentsSelectorMap)) +FXIMPLEMENT(GNEAdditionalFrame::SelectorParentLanes, FXGroupBox, GNElaneParentsSelectorMap, ARRAYNUMBER(GNElaneParentsSelectorMap)) // =========================================================================== // method definitions // =========================================================================== -GNEAdditionalFrame::GNEAdditionalFrame(FXComposite* parent, GNEViewNet* viewNet): - GNEFrame(parent, viewNet, "Additionals"), +GNEAdditionalFrame::GNEAdditionalFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet): + GNEFrame(horizontalFrameParent, viewNet, "Additionals"), myActualAdditionalType(SUMO_TAG_NOTHING) { // Create groupBox for myAdditionalMatchBox - myGroupBoxForMyAdditionalMatchBox = new FXGroupBox(myContentFrame, "Additional element", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X); + myGroupBoxForMyAdditionalMatchBox = new FXGroupBox(myContentFrame, "Additional element", GUIDesignGroupBoxFrame); // Create FXListBox in myGroupBoxForMyAdditionalMatchBox - myAdditionalMatchBox = new FXComboBox(myGroupBoxForMyAdditionalMatchBox, 12, this, MID_GNE_MODE_ADDITIONAL_ITEM, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC | LAYOUT_CENTER_Y | LAYOUT_FILL_X); + myAdditionalMatchBox = new FXComboBox(myGroupBoxForMyAdditionalMatchBox, GUIDesignComboBoxNCol, this, MID_GNE_MODE_ADDITIONAL_ITEM, GUIDesignComboBox); // Create additional parameters - myAdditionalParameters = new GNEAdditionalFrame::additionalParameters(myContentFrame, this); + myadditionalParameters = new GNEAdditionalFrame::AdditionalAttributes(myViewNet, myContentFrame); - // Create editor parameter - myEditorParameters = new GNEAdditionalFrame::editorParameters(myContentFrame, this); + // Create Netedit parameter + myEditorParameters = new GNEAdditionalFrame::NeteditAttributes(myContentFrame); // Create create list for additional Set - myAdditionalSet = new GNEAdditionalFrame::additionalSet(myContentFrame, this, myViewNet); + myAdditionalParentSelector = new GNEAdditionalFrame::SelectorParentAdditional(myContentFrame, myViewNet); - /// Create list for edgesSelector - myEdgesSelector = new GNEAdditionalFrame::edgesSelector(myContentFrame, myViewNet); + /// Create list for SelectorParentEdges + myedgeParentsSelector = new GNEAdditionalFrame::SelectorParentEdges(myContentFrame, myViewNet); - /// Create list for lanesSelector - myLanesSelector = new GNEAdditionalFrame::lanesSelector(myContentFrame, myViewNet); + /// Create list for SelectorParentLanes + mylaneParentsSelector = new GNEAdditionalFrame::SelectorParentLanes(myContentFrame, myViewNet); // Add options to myAdditionalMatchBox - const std::vector& additionalTags = GNEAttributeCarrier::allowedAdditionalTags(); + const std::vector& additionalTags = GNEAttributeCarrier::allowedTags(false); for (std::vector::const_iterator i = additionalTags.begin(); i != additionalTags.end(); i++) { myAdditionalMatchBox->appendItem(toString(*i).c_str()); } @@ -167,10 +169,19 @@ } -bool +GNEAdditionalFrame::AddAdditionalResult GNEAdditionalFrame::addAdditional(GNENetElement* netElement, GUISUMOAbstractView* parent) { + // check if current selected additional is valid + if (myActualAdditionalType == SUMO_TAG_NOTHING) { + myViewNet->setStatusBarText("Current selected additional isn't valid."); + return ADDADDITIONAL_INVALID_ARGUMENTS; + } + // Declare map to keep values - std::map valuesOfElement = myAdditionalParameters->getAttributes(); + std::map valuesOfElement = myadditionalParameters->getAttributesAndValues(); + + // limit position depending if show grid is enabled + Position currentPosition = parent->snapToActiveGrid(parent->getPositionInformation()); // Declare pointer to netElements GNEJunction* pointed_junction = NULL; @@ -182,12 +193,17 @@ if (GNEAttributeCarrier::hasAttribute(myActualAdditionalType, SUMO_ATTR_JUNCTION)) { pointed_junction = dynamic_cast(netElement); if (pointed_junction != NULL) { + // show warning dialogbox and stop check if input parameters are valid + if (myadditionalParameters->areValuesValid() == false) { + myadditionalParameters->showWarningMessage(); + return ADDADDITIONAL_INVALID_ARGUMENTS; + } // Get attribute junction valuesOfElement[SUMO_ATTR_JUNCTION] = pointed_junction->getID(); // Generate id of element based on the junction valuesOfElement[SUMO_ATTR_ID] = generateID(pointed_junction); } else { - return false; + return ADDADDITIONAL_INVALID_PARENT; } } // Check if additional should be placed over a edge @@ -197,94 +213,145 @@ pointed_edge = &(dynamic_cast(netElement)->getParentEdge()); } if (pointed_edge != NULL) { + // show warning dialogbox and stop check if input parameters are valid + if (myadditionalParameters->areValuesValid() == false) { + myadditionalParameters->showWarningMessage(); + return ADDADDITIONAL_INVALID_ARGUMENTS; + } // Get attribute edge valuesOfElement[SUMO_ATTR_EDGE] = pointed_edge->getID(); // Generate id of element based on the edge valuesOfElement[SUMO_ATTR_ID] = generateID(pointed_edge); } else { - return false; + return ADDADDITIONAL_INVALID_PARENT; } } // Check if additional should be placed over a lane else if (GNEAttributeCarrier::hasAttribute(myActualAdditionalType, SUMO_ATTR_LANE)) { pointed_lane = dynamic_cast(netElement); if (pointed_lane != NULL) { + // show warning dialogbox and stop check if input parameters are valid + if (myadditionalParameters->areValuesValid() == false) { + myadditionalParameters->showWarningMessage(); + return ADDADDITIONAL_INVALID_ARGUMENTS; + } // Get attribute lane valuesOfElement[SUMO_ATTR_LANE] = pointed_lane->getID(); // Generate id of element based on the lane valuesOfElement[SUMO_ATTR_ID] = generateID(pointed_lane); } else { - return false; + return ADDADDITIONAL_INVALID_PARENT; } } // Check if additional should be placed over a crossing else if (GNEAttributeCarrier::hasAttribute(myActualAdditionalType, SUMO_ATTR_CROSSING)) { pointed_crossing = dynamic_cast(netElement); if (pointed_crossing != NULL) { + // show warning dialogbox and stop check if input parameters are valid + if (myadditionalParameters->areValuesValid() == false) { + myadditionalParameters->showWarningMessage(); + return ADDADDITIONAL_INVALID_ARGUMENTS; + } // Get attribute crossing valuesOfElement[SUMO_ATTR_CROSSING] = pointed_crossing->getID(); // Generate id of element based on the crossing valuesOfElement[SUMO_ATTR_ID] = generateID(pointed_crossing); } else { - return false; + return ADDADDITIONAL_INVALID_PARENT; } } else { // Generate id of element valuesOfElement[SUMO_ATTR_ID] = generateID(NULL); } + // show warning dialogbox and stop check if input parameters are valid + if (myadditionalParameters->areValuesValid() == false) { + myadditionalParameters->showWarningMessage(); + return ADDADDITIONAL_INVALID_ARGUMENTS; + } + // Obtain position attribute if (pointed_edge) { // Obtain position of the mouse over edge - SUMOReal positionOfTheMouseOverEdge = pointed_edge->getLanes().at(0)->getShape().nearest_offset_to_point2D(parent->getPositionInformation()); + double positionOfTheMouseOverEdge = pointed_edge->getLanes().at(0)->getShape().nearest_offset_to_point2D(currentPosition); // If element has a StartPosition and EndPosition over edge, extract attributes if (GNEAttributeCarrier::hasAttribute(myActualAdditionalType, SUMO_ATTR_STARTPOS) && GNEAttributeCarrier::hasAttribute(myActualAdditionalType, SUMO_ATTR_ENDPOS)) { - SUMOReal startPos = setStartPosition(positionOfTheMouseOverEdge, myEditorParameters->getLenght()); - SUMOReal endPos = setEndPosition(pointed_edge->getLanes().at(0)->getLaneShapeLenght(), positionOfTheMouseOverEdge, myEditorParameters->getLenght()); - // Only set start position if are valid (!= -1) - if (startPos != -1) { - valuesOfElement[SUMO_ATTR_STARTPOS] = toString(startPos); - } else { - WRITE_WARNING("Additonal '" + toString(myActualAdditionalType) + "' cannot be placed over edge. Attribute '" + toString(SUMO_ATTR_STARTPOS) + "' isn't valid"); - return false; - } - // Only set end position if are valid (!= -1) - if (endPos != -1) { - valuesOfElement[SUMO_ATTR_ENDPOS] = toString(endPos); + // First check that current length is valid + if (myEditorParameters->isCurrentLengthValid()) { + // check if current reference point is valid + if (myEditorParameters->getActualReferencePoint() == NeteditAttributes::GNE_ADDITIONALREFERENCEPOINT_INVALID) { + myadditionalParameters->showWarningMessage("Current selected reference point isn't valid"); + return ADDADDITIONAL_INVALID_ARGUMENTS; + } + double startPos = setStartPosition(positionOfTheMouseOverEdge, myEditorParameters->getLength()); + double endPos = setEndPosition(pointed_edge->getLanes().at(0)->getLaneShapeLength(), positionOfTheMouseOverEdge, myEditorParameters->getLength()); + // Only set start position if are valid (!= -1) + if (startPos != -1) { + valuesOfElement[SUMO_ATTR_STARTPOS] = toString(startPos); + } else { + myadditionalParameters->showWarningMessage("'" + toString(SUMO_ATTR_STARTPOS) + "' takes a negative value. Use 'force position' or another reference point."); + return ADDADDITIONAL_INVALID_ARGUMENTS; + } + // Only set end position if are valid (!= -1) + if (endPos != -1) { + valuesOfElement[SUMO_ATTR_ENDPOS] = toString(endPos); + } else { + myadditionalParameters->showWarningMessage("'" + toString(SUMO_ATTR_STARTPOS) + "' overpass " + toString(SUMO_TAG_EDGE) + "'s lenght. Use 'force position' or another reference point."); + return ADDADDITIONAL_INVALID_ARGUMENTS; + } } else { - WRITE_WARNING("Additonal '" + toString(myActualAdditionalType) + "' cannot be placed over edge. Attribute '" + toString(SUMO_ATTR_ENDPOS) + "' isn't valid"); - return false; + return ADDADDITIONAL_INVALID_ARGUMENTS; } } // Extract position of lane valuesOfElement[SUMO_ATTR_POSITION] = toString(positionOfTheMouseOverEdge); } else if (pointed_lane) { // Obtain position of the mouse over lane - SUMOReal positionOfTheMouseOverLane = pointed_lane->getShape().nearest_offset_to_point2D(parent->getPositionInformation()); + double positionOfTheMouseOverLane = pointed_lane->getShape().nearest_offset_to_point2D(currentPosition); // If element has a StartPosition and EndPosition over lane, extract attributes if (GNEAttributeCarrier::hasAttribute(myActualAdditionalType, SUMO_ATTR_STARTPOS) && GNEAttributeCarrier::hasAttribute(myActualAdditionalType, SUMO_ATTR_ENDPOS)) { - SUMOReal startPos = setStartPosition(positionOfTheMouseOverLane, myEditorParameters->getLenght()); - SUMOReal endPos = setEndPosition(pointed_lane->getLaneShapeLenght(), positionOfTheMouseOverLane, myEditorParameters->getLenght()); - // Only set start position if are valid (!= -1) - if (startPos != -1) { - valuesOfElement[SUMO_ATTR_STARTPOS] = toString(startPos); - } else { - WRITE_WARNING("Additonal '" + toString(myActualAdditionalType) + "' cannot be placed over lane. Attribute '" + toString(SUMO_ATTR_STARTPOS) + "' isn't valid"); - return false; - } - // Only set end position if are valid (!= -1) - if (endPos != -1) { - valuesOfElement[SUMO_ATTR_ENDPOS] = toString(endPos); + // First check that current length is valid + if (myEditorParameters->isCurrentLengthValid()) { + // check if current reference point is valid + if (myEditorParameters->getActualReferencePoint() == NeteditAttributes::GNE_ADDITIONALREFERENCEPOINT_INVALID) { + myadditionalParameters->showWarningMessage("Current selected reference point isn't valid"); + return ADDADDITIONAL_INVALID_ARGUMENTS; + } + double startPos = setStartPosition(positionOfTheMouseOverLane, myEditorParameters->getLength()); + double endPos = setEndPosition(pointed_lane->getLaneShapeLength(), positionOfTheMouseOverLane, myEditorParameters->getLength()); + // Only set start position if are valid (!= -1) + if (startPos != -1) { + valuesOfElement[SUMO_ATTR_STARTPOS] = toString(startPos); + } else { + myadditionalParameters->showWarningMessage("'" + toString(SUMO_ATTR_STARTPOS) + "' takes a negative value. Use 'force position' or another reference point."); + return ADDADDITIONAL_INVALID_ARGUMENTS; + } + // Only set end position if are valid (!= -1) + if (endPos != -1) { + valuesOfElement[SUMO_ATTR_ENDPOS] = toString(endPos); + } else { + myadditionalParameters->showWarningMessage("'" + toString(SUMO_ATTR_STARTPOS) + "' overpass " + toString(SUMO_TAG_LANE) + "'s lenght. Use 'force position' or another reference point."); + return ADDADDITIONAL_INVALID_ARGUMENTS; + } } else { - WRITE_WARNING("Additonal '" + toString(myActualAdditionalType) + "' cannot be placed over lane. Attribute '" + toString(SUMO_ATTR_ENDPOS) + "' isn't valid"); - return false; + return ADDADDITIONAL_INVALID_ARGUMENTS; } } // Extract position of lane valuesOfElement[SUMO_ATTR_POSITION] = toString(positionOfTheMouseOverLane); } else { // get position in map - valuesOfElement[SUMO_ATTR_POSITION] = toString(parent->getPositionInformation()); + valuesOfElement[SUMO_ATTR_POSITION] = toString(currentPosition); + } + + // If additional has a interval defined by a begin or end, check that is valid + if (GNEAttributeCarrier::hasAttribute(myActualAdditionalType, SUMO_ATTR_STARTTIME) && GNEAttributeCarrier::hasAttribute(myActualAdditionalType, SUMO_ATTR_END)) { + double begin = GNEAttributeCarrier::parse(valuesOfElement[SUMO_ATTR_STARTTIME]); + double end = GNEAttributeCarrier::parse(valuesOfElement[SUMO_ATTR_END]); + if (begin > end) { + myadditionalParameters->showWarningMessage("Attribute '" + toString(SUMO_ATTR_STARTTIME) + "' cannot be greater than attribute '" + toString(SUMO_ATTR_END) + "'."); + return ADDADDITIONAL_INVALID_ARGUMENTS; + } } // If additional own the attribute SUMO_ATTR_FILE but was't defined, will defined as .txt @@ -300,19 +367,19 @@ // Save block value valuesOfElement[GNE_ATTR_BLOCK_MOVEMENT] = toString(myEditorParameters->isBlockEnabled()); - // If element belongst to an additional Set, get id of parent from myAdditionalSet - if (GNEAttributeCarrier::hasParent(myActualAdditionalType)) { - if (myAdditionalSet->getIdSelected() != "") { - valuesOfElement[GNE_ATTR_PARENT] = myAdditionalSet->getIdSelected(); + // If element belongst to an additional Set, get id of parent from myAdditionalParentSelector + if ((myActualAdditionalType == SUMO_TAG_DET_ENTRY) || (myActualAdditionalType == SUMO_TAG_DET_EXIT)) { + if (myAdditionalParentSelector->getIdSelected() != "") { + valuesOfElement[GNE_ATTR_PARENT] = myAdditionalParentSelector->getIdSelected(); } else { - WRITE_WARNING("A " + toString(myAdditionalSet->getCurrentlyTag()) + " must be selected before insertion of " + toString(myActualAdditionalType) + "."); - return false; + myadditionalParameters->showWarningMessage("A " + toString(SUMO_TAG_E3DETECTOR) + " must be selected before insertion of " + toString(myActualAdditionalType) + "."); + return ADDADDITIONAL_INVALID_ARGUMENTS; } } - // If element own a list of edgesSelector as attribute + // If element own a list of SelectorParentEdges as attribute if (GNEAttributeCarrier::hasAttribute(myActualAdditionalType, SUMO_ATTR_EDGES)) { - if (myEdgesSelector->isUseSelectedEdgesEnable()) { + if (myedgeParentsSelector->isUseSelectedEdgesEnable()) { // Declare a vector of Id's std::vector vectorOfIds; // get Selected edges @@ -324,18 +391,18 @@ // Set saved Ids in attribute edges valuesOfElement[SUMO_ATTR_EDGES] = joinToString(vectorOfIds, " "); } else { - valuesOfElement[SUMO_ATTR_EDGES] = myEdgesSelector->getIdsSelected(); + valuesOfElement[SUMO_ATTR_EDGES] = myedgeParentsSelector->getIdsSelected(); } - // check if attribute has at least an Edge + // check if attribute has at least one edge if (valuesOfElement[SUMO_ATTR_EDGES] == "") { - WRITE_WARNING("A " + toString(myActualAdditionalType) + " must have at least one edge associated."); - return false; + myadditionalParameters->showWarningMessage("List of " + toString(SUMO_TAG_EDGE) + "s cannot be empty"); + return ADDADDITIONAL_INVALID_ARGUMENTS; } } - // If element own a list of lanesSelector as attribute + // If element own a list of SelectorParentLanes as attribute if (GNEAttributeCarrier::hasAttribute(myActualAdditionalType, SUMO_ATTR_LANES)) { - if (myLanesSelector->isUseSelectedLanesEnable()) { + if (mylaneParentsSelector->isUseSelectedLanesEnable()) { // Declare a vector of Id's std::vector vectorOfIds; // get Selected lanes @@ -347,59 +414,68 @@ // Set saved Ids in attribute lanes valuesOfElement[SUMO_ATTR_LANES] = joinToString(vectorOfIds, " "); } else { - valuesOfElement[SUMO_ATTR_LANES] = myLanesSelector->getIdsSelected(); + valuesOfElement[SUMO_ATTR_LANES] = mylaneParentsSelector->getIdsSelected(); } // check if attribute has at least a lane if (valuesOfElement[SUMO_ATTR_LANES] == "") { - WRITE_WARNING("A " + toString(myActualAdditionalType) + " must have at least one lane associated."); - return false; + myadditionalParameters->showWarningMessage("List of " + toString(SUMO_TAG_LANE) + "s cannot be empty"); + return ADDADDITIONAL_INVALID_ARGUMENTS; } } // Create additional - return GNEAdditionalHandler::buildAdditional(myViewNet, myActualAdditionalType, valuesOfElement); + if (GNEAdditionalHandler::buildAdditional(myViewNet, myActualAdditionalType, valuesOfElement) == true) { + return ADDADDITIONAL_SUCCESS; + } else { + return ADDADDITIONAL_INVALID_ARGUMENTS; + } } void GNEAdditionalFrame::removeAdditional(GNEAdditional* additional) { myViewNet->getUndoList()->p_begin("delete " + additional->getDescription()); - myViewNet->getUndoList()->add(new GNEChange_Additional(myViewNet->getNet(), additional, false), true); + myViewNet->getUndoList()->add(new GNEChange_Additional(additional, false), true); myViewNet->getUndoList()->p_end(); } long GNEAdditionalFrame::onCmdSelectAdditional(FXObject*, FXSelector, void*) { - // set myActualAdditionalType - const std::vector& additionalTags = GNEAttributeCarrier::allowedAdditionalTags(); + // obtain current allowed additional tags + const std::vector& additionalTags = GNEAttributeCarrier::allowedTags(false); + bool additionalNameCorrect = false; + // set parameters of additional, if it's correct for (std::vector::const_iterator i = additionalTags.begin(); i != additionalTags.end(); i++) { if (toString(*i) == myAdditionalMatchBox->getText().text()) { + myAdditionalMatchBox->setTextColor(FXRGB(0, 0, 0)); + myadditionalParameters->show(); + myEditorParameters->show(); setParametersOfAdditional(*i); + additionalNameCorrect = true; } } + // if additional name isn't correct, hidde all + if (additionalNameCorrect == false) { + myActualAdditionalType = SUMO_TAG_NOTHING; + myAdditionalMatchBox->setTextColor(FXRGB(255, 0, 0)); + myadditionalParameters->hide(); + myEditorParameters->hide(); + myAdditionalParentSelector->hide(); + myedgeParentsSelector->hide(); + mylaneParentsSelector->hide(); + } return 1; } void GNEAdditionalFrame::show() { - // Show Scroll window - FXScrollWindow::show(); - // Show Frame Area in which this GNEFrame is placed - myViewNet->getViewParent()->showFramesArea(); - // Update UseAelectedLane CheckBox - myEdgesSelector->updateUseSelectedEdges(); - // Update UseAelectedLane CheckBox - myLanesSelector->updateUseSelectedLanes(); -} - - -void -GNEAdditionalFrame::hide() { - // Hide ScrollWindow - FXScrollWindow::hide(); - // Hide Frame Area in which this GNEFrame is placed - myViewNet->getViewParent()->hideFramesArea(); + // Show frame + GNEFrame::show(); + // Update UseSelectedLane CheckBox + myedgeParentsSelector->updateUseSelectedEdges(); + // Update UseSelectedLane CheckBox + mylaneParentsSelector->updateUseSelectedLanes(); } @@ -407,45 +483,45 @@ GNEAdditionalFrame::setParametersOfAdditional(SumoXMLTag actualAdditionalType) { // Set new actualAdditionalType myActualAdditionalType = actualAdditionalType; - // Clear default parameters - myAdditionalParameters->clearAttributes(); - // Hide lenght field and reference point + // Clear internal attributes + myadditionalParameters->clearAttributes(); + // Hide length field and reference point myEditorParameters->hideLengthField(); myEditorParameters->hideReferencePoint(); // Obtain attributes of actual myActualAdditionalType std::vector > attrs = GNEAttributeCarrier::allowedAttributes(myActualAdditionalType); // Iterate over attributes of myActualAdditionalType for (std::vector >::iterator i = attrs.begin(); i != attrs.end(); i++) { - if (!GNEAttributeCarrier::isUnique(i->first)) { - myAdditionalParameters->addAttribute(myActualAdditionalType, i->first); + if (!GNEAttributeCarrier::isUnique(myActualAdditionalType, i->first)) { + myadditionalParameters->addAttribute(myActualAdditionalType, i->first); } else if (i->first == SUMO_ATTR_ENDPOS) { myEditorParameters->showLengthField(); myEditorParameters->showReferencePoint(); } } // if there are parmeters, show and Recalc groupBox - if (myAdditionalParameters->getNumberOfAddedAttributes() > 0) { - myAdditionalParameters->showAdditionalParameters(); + if (myadditionalParameters->getNumberOfAddedAttributes() > 0) { + myadditionalParameters->showAdditionalParameters(); } else { - myAdditionalParameters->hideAdditionalParameters(); + myadditionalParameters->hideAdditionalParameters(); } - // Show set parameter if we're adding an additional with parent - if (GNEAttributeCarrier::hasParent(myActualAdditionalType)) { - myAdditionalSet->showList(GNEAttributeCarrier::getParentType(myActualAdditionalType)); + // Show myAdditionalParentSelector if we're adding a Entry/Exit + if ((myActualAdditionalType == SUMO_TAG_DET_ENTRY) || (myActualAdditionalType == SUMO_TAG_DET_EXIT)) { + myAdditionalParentSelector->showListOfAdditionals(SUMO_TAG_E3DETECTOR, true); } else { - myAdditionalSet->hideList(); + myAdditionalParentSelector->hideListOfAdditionals(); } - // Show edgesSelector if we're adding an additional that own the attribute SUMO_ATTR_EDGES + // Show SelectorParentEdges if we're adding an additional that own the attribute SUMO_ATTR_EDGES if (GNEAttributeCarrier::hasAttribute(myActualAdditionalType, SUMO_ATTR_EDGES)) { - myEdgesSelector->showList(); + myedgeParentsSelector->showList(); } else { - myEdgesSelector->hideList(); + myedgeParentsSelector->hideList(); } - // Show lanesSelector if we're adding an additional that own the attribute SUMO_ATTR_LANES + // Show SelectorParentLanes if we're adding an additional that own the attribute SUMO_ATTR_LANES if (GNEAttributeCarrier::hasAttribute(myActualAdditionalType, SUMO_ATTR_LANES)) { - myLanesSelector->showList(); + mylaneParentsSelector->showList(); } else { - myLanesSelector->hideList(); + mylaneParentsSelector->hideList(); } } @@ -469,23 +545,23 @@ } -SUMOReal -GNEAdditionalFrame::setStartPosition(SUMOReal positionOfTheMouseOverLane, SUMOReal lenghtOfAdditional) { +double +GNEAdditionalFrame::setStartPosition(double positionOfTheMouseOverLane, double lengthOfAdditional) { switch (myEditorParameters->getActualReferencePoint()) { - case editorParameters::GNE_ADDITIONALREFERENCEPOINT_LEFT: + case NeteditAttributes::GNE_ADDITIONALREFERENCEPOINT_LEFT: return positionOfTheMouseOverLane; - case editorParameters::GNE_ADDITIONALREFERENCEPOINT_RIGHT: { - if (positionOfTheMouseOverLane - lenghtOfAdditional >= 0.01) { - return positionOfTheMouseOverLane - lenghtOfAdditional; + case NeteditAttributes::GNE_ADDITIONALREFERENCEPOINT_RIGHT: { + if (positionOfTheMouseOverLane - lengthOfAdditional >= 0.01) { + return positionOfTheMouseOverLane - lengthOfAdditional; } else if (myEditorParameters->isForcePositionEnabled()) { return 0.01; } else { return -1; } } - case editorParameters::GNE_ADDITIONALREFERENCEPOINT_CENTER: { - if (positionOfTheMouseOverLane - lenghtOfAdditional / 2 >= 0.01) { - return positionOfTheMouseOverLane - lenghtOfAdditional / 2; + case NeteditAttributes::GNE_ADDITIONALREFERENCEPOINT_CENTER: { + if (positionOfTheMouseOverLane - lengthOfAdditional / 2 >= 0.01) { + return positionOfTheMouseOverLane - lengthOfAdditional / 2; } else if (myEditorParameters->isForcePositionEnabled()) { return 0; } else { @@ -498,25 +574,25 @@ } -SUMOReal -GNEAdditionalFrame::setEndPosition(SUMOReal laneLenght, SUMOReal positionOfTheMouseOverLane, SUMOReal lenghtOfAdditional) { +double +GNEAdditionalFrame::setEndPosition(double laneLength, double positionOfTheMouseOverLane, double lengthOfAdditional) { switch (myEditorParameters->getActualReferencePoint()) { - case editorParameters::GNE_ADDITIONALREFERENCEPOINT_LEFT: { - if (positionOfTheMouseOverLane + lenghtOfAdditional <= laneLenght - 0.01) { - return positionOfTheMouseOverLane + lenghtOfAdditional; + case NeteditAttributes::GNE_ADDITIONALREFERENCEPOINT_LEFT: { + if (positionOfTheMouseOverLane + lengthOfAdditional <= laneLength - 0.01) { + return positionOfTheMouseOverLane + lengthOfAdditional; } else if (myEditorParameters->isForcePositionEnabled()) { - return laneLenght - 0.01; + return laneLength - 0.01; } else { return -1; } } - case editorParameters::GNE_ADDITIONALREFERENCEPOINT_RIGHT: + case NeteditAttributes::GNE_ADDITIONALREFERENCEPOINT_RIGHT: return positionOfTheMouseOverLane; - case editorParameters::GNE_ADDITIONALREFERENCEPOINT_CENTER: { - if (positionOfTheMouseOverLane + lenghtOfAdditional / 2 <= laneLenght - 0.01) { - return positionOfTheMouseOverLane + lenghtOfAdditional / 2; + case NeteditAttributes::GNE_ADDITIONALREFERENCEPOINT_CENTER: { + if (positionOfTheMouseOverLane + lengthOfAdditional / 2 <= laneLength - 0.01) { + return positionOfTheMouseOverLane + lengthOfAdditional / 2; } else if (myEditorParameters->isForcePositionEnabled()) { - return laneLenght - 0.01; + return laneLength - 0.01; } else { return -1; } @@ -527,193 +603,316 @@ } // --------------------------------------------------------------------------- -// GNEAdditionalFrame::additionalParameter - methods +// GNEAdditionalFrame::AdditionalAttributeSingle - methods // --------------------------------------------------------------------------- -GNEAdditionalFrame::additionalParameter::additionalParameter(FXComposite* parent, FXObject* tgt) : - FXMatrix(parent, 3, MATRIX_BY_COLUMNS | LAYOUT_FILL_X), - myAttr(SUMO_ATTR_NOTHING) { - // Create elements - myLabel = new FXLabel(this, "name", 0, JUSTIFY_RIGHT | LAYOUT_FIX_WIDTH, 0, 0, 60, 0); - myTextField = new FXTextField(this, 10, tgt, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_TEXT, LAYOUT_FILL_COLUMN | LAYOUT_FILL_X); - myMenuCheck = new FXMenuCheck(this, "", tgt, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_BOOL, LAYOUT_FIX_WIDTH); - // Set widht of menuCheck manually - myMenuCheck->setWidth(20); +GNEAdditionalFrame::AdditionalAttributeSingle::AdditionalAttributeSingle(FXComposite* parent) : + FXHorizontalFrame(parent, GUIDesignAuxiliarHorizontalFrame), + myAdditionalTag(SUMO_TAG_NOTHING), + myAdditionalAttr(SUMO_ATTR_NOTHING) { + // Create visual elements + myLabel = new FXLabel(this, "name", 0, GUIDesignLabelAttribute); + myTextFieldInt = new FXTextField(this, GUIDesignTextFieldNCol, this, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_TEXT, GUIDesignTextFieldInt); + myTextFieldReal = new FXTextField(this, GUIDesignTextFieldNCol, this, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_TEXT, GUIDesignTextFieldReal); + myTextFieldStrings = new FXTextField(this, GUIDesignTextFieldNCol, this, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_TEXT, GUIDesignTextField); + myBoolCheckButton = new FXCheckButton(this, "Disabled", this, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_BOOL, GUIDesignCheckButtonAttribute); // Hide elements hideParameter(); } -GNEAdditionalFrame::additionalParameter::~additionalParameter() {} +GNEAdditionalFrame::AdditionalAttributeSingle::~AdditionalAttributeSingle() {} void -GNEAdditionalFrame::additionalParameter::showParameter(SumoXMLAttr attr, std::string value) { - myAttr = attr; - myLabel->setText(toString(myAttr).c_str()); +GNEAdditionalFrame::AdditionalAttributeSingle::showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::string value) { + myAdditionalTag = additionalTag; + myAdditionalAttr = additionalAttr; + myInvalidValue = ""; + myLabel->setText(toString(myAdditionalAttr).c_str()); myLabel->show(); - myTextField->setText(value.c_str()); - myTextField->show(); + myTextFieldStrings->setTextColor(FXRGB(0, 0, 0)); + myTextFieldStrings->setText(value.c_str()); + myTextFieldStrings->show(); show(); } void -GNEAdditionalFrame::additionalParameter::showParameter(SumoXMLAttr attr, int value) { - myAttr = attr; - myLabel->setText(toString(myAttr).c_str()); +GNEAdditionalFrame::AdditionalAttributeSingle::showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, int value) { + myAdditionalTag = additionalTag; + myAdditionalAttr = additionalAttr; + myInvalidValue = ""; + myLabel->setText(toString(myAdditionalAttr).c_str()); myLabel->show(); - myTextField->setText(toString(value).c_str()); - myTextField->show(); + myTextFieldInt->setTextColor(FXRGB(0, 0, 0)); + myTextFieldInt->setText(toString(value).c_str()); + myTextFieldInt->show(); show(); } void -GNEAdditionalFrame::additionalParameter::showParameter(SumoXMLAttr attr, SUMOReal value) { - myAttr = attr; - myLabel->setText(toString(myAttr).c_str()); +GNEAdditionalFrame::AdditionalAttributeSingle::showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, double value) { + myAdditionalTag = additionalTag; + myAdditionalAttr = additionalAttr; + myInvalidValue = ""; + myLabel->setText(toString(myAdditionalAttr).c_str()); myLabel->show(); - myTextField->setText(toString(value).c_str()); - myTextField->show(); + myTextFieldReal->setTextColor(FXRGB(0, 0, 0)); + myTextFieldReal->setText(toString(value).c_str()); + myTextFieldReal->show(); show(); } void -GNEAdditionalFrame::additionalParameter::showParameter(SumoXMLAttr attr, bool value) { - myAttr = attr; - myLabel->setText(toString(myAttr).c_str()); +GNEAdditionalFrame::AdditionalAttributeSingle::showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, bool value) { + myAdditionalTag = additionalTag; + myAdditionalAttr = additionalAttr; + myInvalidValue = ""; + myLabel->setText(toString(myAdditionalAttr).c_str()); myLabel->show(); - myMenuCheck->setCheck(value); - myMenuCheck->show(); + if (value == true) { + myBoolCheckButton->setCheck(true); + myBoolCheckButton->setText("true"); + } else { + myBoolCheckButton->setCheck(false); + myBoolCheckButton->setText("false"); + } + myBoolCheckButton->show(); show(); } void -GNEAdditionalFrame::additionalParameter::hideParameter() { - myAttr = SUMO_ATTR_NOTHING; +GNEAdditionalFrame::AdditionalAttributeSingle::hideParameter() { + myAdditionalTag = SUMO_TAG_NOTHING; + myAdditionalAttr = SUMO_ATTR_NOTHING; myLabel->hide(); - myTextField->hide(); - myMenuCheck->hide(); + myTextFieldInt->hide(); + myTextFieldReal->hide(); + myTextFieldStrings->hide(); + myBoolCheckButton->hide(); hide(); } +SumoXMLTag +GNEAdditionalFrame::AdditionalAttributeSingle::getTag() const { + return myAdditionalTag; +} + + SumoXMLAttr -GNEAdditionalFrame::additionalParameter::getAttr() const { - return myAttr; +GNEAdditionalFrame::AdditionalAttributeSingle::getAttr() const { + return myAdditionalAttr; } std::string -GNEAdditionalFrame::additionalParameter::getValue() const { - if (GNEAttributeCarrier::isBool(myAttr)) { - return (myMenuCheck->getCheck() == 1) ? "true" : "false"; +GNEAdditionalFrame::AdditionalAttributeSingle::getValue() const { + if (GNEAttributeCarrier::isBool(myAdditionalTag, myAdditionalAttr)) { + return (myBoolCheckButton->getCheck() == 1) ? "true" : "false"; + } else if (GNEAttributeCarrier::isInt(myAdditionalTag, myAdditionalAttr)) { + return myTextFieldInt->getText().text(); + } else if (GNEAttributeCarrier::isFloat(myAdditionalTag, myAdditionalAttr) || GNEAttributeCarrier::isTime(myAdditionalTag, myAdditionalAttr)) { + return myTextFieldReal->getText().text(); + } else { + return myTextFieldStrings->getText().text(); + } +} + + +const std::string& +GNEAdditionalFrame::AdditionalAttributeSingle::isAttributeValid() const { + return myInvalidValue; +} + + +long +GNEAdditionalFrame::AdditionalAttributeSingle::onCmdSetAttribute(FXObject*, FXSelector, void*) { + // We assume that current value is valid + myInvalidValue = ""; + // Check if format of current value of myTextField is correct + if (GNEAttributeCarrier::isInt(myAdditionalTag, myAdditionalAttr)) { + if (GNEAttributeCarrier::canParse(myTextFieldInt->getText().text())) { + // convert string to int + int intValue = GNEAttributeCarrier::parse(myTextFieldInt->getText().text()); + // Check if int value must be positive + if (GNEAttributeCarrier::isPositive(myAdditionalTag, myAdditionalAttr) && (intValue < 0)) { + myInvalidValue = "'" + toString(myAdditionalAttr) + "' cannot be negative"; + } + } else { + myInvalidValue = "'" + toString(myAdditionalAttr) + "' doesn't have a valid 'int' format"; + } + } else if (GNEAttributeCarrier::isTime(myAdditionalTag, myAdditionalAttr)) { + // time attributes work as positive doubles + if (GNEAttributeCarrier::canParse(myTextFieldReal->getText().text())) { + // convert string to double + double doubleValue = GNEAttributeCarrier::parse(myTextFieldReal->getText().text()); + // Check if parsed value is negative + if (doubleValue < 0) { + myInvalidValue = "'" + toString(myAdditionalAttr) + "' cannot be negative"; + } + } else { + myInvalidValue = "'" + toString(myAdditionalAttr) + "' doesn't have a valid 'time' format"; + } + } else if (GNEAttributeCarrier::isFloat(myAdditionalTag, myAdditionalAttr)) { + if (GNEAttributeCarrier::canParse(myTextFieldReal->getText().text())) { + // convert string to double + double doubleValue = GNEAttributeCarrier::parse(myTextFieldReal->getText().text()); + // Check if double value must be positive + if (GNEAttributeCarrier::isPositive(myAdditionalTag, myAdditionalAttr) && (doubleValue < 0)) { + myInvalidValue = "'" + toString(myAdditionalAttr) + "' cannot be negative"; + // check if double value is a probability + } else if (GNEAttributeCarrier::isProbability(myAdditionalTag, myAdditionalAttr) && ((doubleValue < 0) || doubleValue > 1)) { + myInvalidValue = "'" + toString(myAdditionalAttr) + "' takes only values between 0 and 1"; + } + } else { + myInvalidValue = "'" + toString(myAdditionalAttr) + "' doesn't have a valid 'float' format"; + } + } else if (GNEAttributeCarrier::isFilename(myAdditionalTag, myAdditionalAttr)) { + // check if filename format is valid + if (GNEAttributeCarrier::isValidFilename(myTextFieldStrings->getText().text()) == false) { + myInvalidValue = "input contains invalid characters for a filename"; + } + } + // change color of text field depending of myCurrentValueValid + if (myInvalidValue.size() == 0) { + myTextFieldInt->setTextColor(FXRGB(0, 0, 0)); + myTextFieldInt->killFocus(); + myTextFieldReal->setTextColor(FXRGB(0, 0, 0)); + myTextFieldReal->killFocus(); + myTextFieldStrings->setTextColor(FXRGB(0, 0, 0)); + myTextFieldStrings->killFocus(); } else { - return myTextField->getText().text(); + // IF value of TextField isn't valid, change their color to Red + myTextFieldInt->setTextColor(FXRGB(255, 0, 0)); + myTextFieldReal->setTextColor(FXRGB(255, 0, 0)); + myTextFieldStrings->setTextColor(FXRGB(255, 0, 0)); } + // Update aditional frame + update(); + return 1; +} + + +long +GNEAdditionalFrame::AdditionalAttributeSingle::onCmdSetBooleanAttribute(FXObject*, FXSelector, void*) { + if (myBoolCheckButton->getCheck()) { + myBoolCheckButton->setText("true"); + } else { + myBoolCheckButton->setText("false"); + } + return 0; } // --------------------------------------------------------------------------- -// GNEAdditionalFrame::additionalParameterList - methods +// GNEAdditionalFrame::AdditionalAttributeList - methods // --------------------------------------------------------------------------- -GNEAdditionalFrame::additionalParameterList::additionalParameterList(FXComposite* parent, FXObject* tgt) : - FXMatrix(parent, 2, MATRIX_BY_COLUMNS | LAYOUT_FILL_X), - myAttr(SUMO_ATTR_NOTHING), - numberOfVisibleTextfields(1), +GNEAdditionalFrame::AdditionalAttributeList::AdditionalAttributeList(FXComposite* parent) : + FXVerticalFrame(parent, GUIDesignAuxiliarHorizontalFrame), + myAdditionalTag(SUMO_TAG_NOTHING), + myAdditionalAttr(SUMO_ATTR_NOTHING), + myNumberOfVisibleTextfields(1), myMaxNumberOfValuesInParameterList(20) { // Create elements for (int i = 0; i < myMaxNumberOfValuesInParameterList; i++) { - myLabels.push_back(new FXLabel(this, "name", 0, JUSTIFY_RIGHT | LAYOUT_FIX_WIDTH, 0, 0, 60, 0)); - myTextFields.push_back(new FXTextField(this, 10, tgt, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_TEXT, LAYOUT_FILL_COLUMN | LAYOUT_FILL_X)); + myHorizontalFrames.push_back(new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame)); + myLabels.push_back(new FXLabel(myHorizontalFrames.back(), "name", 0, GUIDesignLabelAttribute)); + myTextFields.push_back(new FXTextField(myHorizontalFrames.back(), GUIDesignTextFieldNCol, this, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_TEXT, GUIDesignTextField)); } // Create label Row - myLabels.push_back(new FXLabel(this, "Rows", 0, JUSTIFY_RIGHT | LAYOUT_FIX_WIDTH, 0, 0, 60, 0)); - FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(this, LAYOUT_FILL_COLUMN | LAYOUT_FILL_X); + myHorizontalFrameButtons = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame); + myLabels.push_back(new FXLabel(myHorizontalFrameButtons, "Rows", 0, GUIDesignLabelAttribute)); + FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(myHorizontalFrameButtons, GUIDesignAuxiliarHorizontalFrame); // Create add button - add = new FXButton(buttonsFrame, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_ADDROW, - ICON_BEFORE_TEXT | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT | FRAME_THICK | FRAME_RAISED, - 0, 0, 20, 20); - // Create delete buttons - remove = new FXButton(buttonsFrame, "", GUIIconSubSys::getIcon(ICON_REMOVE), this, MID_GNE_REMOVEROW, - ICON_BEFORE_TEXT | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT | FRAME_THICK | FRAME_RAISED, - 0, 0, 20, 20); + myAddButton = new FXButton(buttonsFrame, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_ADDROW, GUIDesignButtonIcon); + // Create remove buttons + myRemoveButton = new FXButton(buttonsFrame, "", GUIIconSubSys::getIcon(ICON_REMOVE), this, MID_GNE_REMOVEROW, GUIDesignButtonIcon); // Hide all para meters hideParameter(); } -GNEAdditionalFrame::additionalParameterList::~additionalParameterList() {} +GNEAdditionalFrame::AdditionalAttributeList::~AdditionalAttributeList() {} void -GNEAdditionalFrame::additionalParameterList::showListParameter(SumoXMLAttr attr, std::vector /* value */) { - myAttr = attr; - std::cout << "FINISH" << std::endl; +GNEAdditionalFrame::AdditionalAttributeList::showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector /* value */) { + myAdditionalTag = additionalTag; + myAdditionalAttr = additionalAttr; + // @todo finish } + void -GNEAdditionalFrame::additionalParameterList::showListParameter(SumoXMLAttr attr, std::vector /* value */) { - myAttr = attr; - std::cout << "FINISH" << std::endl; +GNEAdditionalFrame::AdditionalAttributeList::showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector /* value */, bool /*isTime*/) { + myAdditionalTag = additionalTag; + myAdditionalAttr = additionalAttr; + // @todo finish } + void -GNEAdditionalFrame::additionalParameterList::showListParameter(SumoXMLAttr attr, std::vector /* value */) { - myAttr = attr; - std::cout << "FINISH" << std::endl; +GNEAdditionalFrame::AdditionalAttributeList::showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector /* value */) { + myAdditionalTag = additionalTag; + myAdditionalAttr = additionalAttr; + // @todo finish } + void -GNEAdditionalFrame::additionalParameterList::showListParameter(SumoXMLAttr attr, std::vector value) { +GNEAdditionalFrame::AdditionalAttributeList::showListParameter(SumoXMLTag tag, SumoXMLAttr attr, std::vector value) { if ((int)value.size() < myMaxNumberOfValuesInParameterList) { - myAttr = attr; - numberOfVisibleTextfields = (int)value.size(); - if (numberOfVisibleTextfields == 0) { - numberOfVisibleTextfields++; + myAdditionalTag = tag; + myAdditionalAttr = attr; + myNumberOfVisibleTextfields = (int)value.size(); + if (myNumberOfVisibleTextfields == 0) { + myNumberOfVisibleTextfields++; } for (int i = 0; i < myMaxNumberOfValuesInParameterList; i++) { myLabels.at(i)->setText((toString(attr) + ": " + toString(i)).c_str()); } - for (int i = 0; i < numberOfVisibleTextfields; i++) { - myLabels.at(i)->show(); - myTextFields.at(i)->show(); + for (int i = 0; i < myNumberOfVisibleTextfields; i++) { + myHorizontalFrames.at(i)->show(); } - add->show(); - remove->show(); - show(); + myHorizontalFrameButtons->show(); + FXVerticalFrame::show(); } } void -GNEAdditionalFrame::additionalParameterList::hideParameter() { - myAttr = SUMO_ATTR_NOTHING; - for (int i = 0; i < myMaxNumberOfValuesInParameterList; i++) { - myLabels.at(i)->hide(); - myTextFields.at(i)->hide(); - myTextFields.at(i)->setText(""); +GNEAdditionalFrame::AdditionalAttributeList::hideParameter() { + myAdditionalTag = SUMO_TAG_NOTHING; + myAdditionalAttr = SUMO_ATTR_NOTHING; + for (int i = 0; i < (int)myHorizontalFrames.size(); i++) { + myHorizontalFrames.at(i)->hide(); } - add->hide(); - remove->hide(); - hide(); + myHorizontalFrameButtons->hide(); + FXVerticalFrame::hide(); } +SumoXMLTag +GNEAdditionalFrame::AdditionalAttributeList::getTag() const { + return myAdditionalTag; +} + SumoXMLAttr -GNEAdditionalFrame::additionalParameterList::getAttr() const { - return myAttr; +GNEAdditionalFrame::AdditionalAttributeList::getAttr() const { + return myAdditionalAttr; } std::string -GNEAdditionalFrame::additionalParameterList::getListValues() { +GNEAdditionalFrame::AdditionalAttributeList::getListValues() { // Declare, fill and return a string with the list values std::string value; - for (int i = 0; i < numberOfVisibleTextfields; i++) { + for (int i = 0; i < myNumberOfVisibleTextfields; i++) { if (!myTextFields.at(i)->getText().empty()) { value += (myTextFields.at(i)->getText().text() + std::string(" ")); } @@ -722,12 +921,18 @@ } +bool +GNEAdditionalFrame::AdditionalAttributeList::isCurrentListValid() const { + /// @todo finish check validity of values in lists + return true; +} + + long -GNEAdditionalFrame::additionalParameterList::onCmdAddRow(FXObject*, FXSelector, void*) { - if (numberOfVisibleTextfields < (myMaxNumberOfValuesInParameterList - 1)) { - myLabels.at(numberOfVisibleTextfields)->show(); - myTextFields.at(numberOfVisibleTextfields)->show(); - numberOfVisibleTextfields++; +GNEAdditionalFrame::AdditionalAttributeList::onCmdAddRow(FXObject*, FXSelector, void*) { + if (myNumberOfVisibleTextfields < (myMaxNumberOfValuesInParameterList - 1)) { + myHorizontalFrames.at(myNumberOfVisibleTextfields)->show(); + myNumberOfVisibleTextfields++; getParent()->recalc(); } return 1; @@ -735,58 +940,57 @@ long -GNEAdditionalFrame::additionalParameterList::onCmdRemoveRow(FXObject*, FXSelector, void*) { - if (numberOfVisibleTextfields > 1) { - numberOfVisibleTextfields--; - myLabels.at(numberOfVisibleTextfields)->hide(); - myTextFields.at(numberOfVisibleTextfields)->hide(); - myTextFields.at(numberOfVisibleTextfields)->setText(""); - +GNEAdditionalFrame::AdditionalAttributeList::onCmdRemoveRow(FXObject*, FXSelector, void*) { + if (myNumberOfVisibleTextfields > 1) { + myNumberOfVisibleTextfields--; + myHorizontalFrames.at(myNumberOfVisibleTextfields)->hide(); + myTextFields.at(myNumberOfVisibleTextfields)->setText(""); getParent()->recalc(); } return 1; } // --------------------------------------------------------------------------- -// GNEAdditionalFrame::editorParameters- methods +// GNEAdditionalFrame::NeteditAttributes- methods // --------------------------------------------------------------------------- -GNEAdditionalFrame::additionalParameters::additionalParameters(FXComposite* parent, FXObject* tgt) : - FXGroupBox(parent, "Default parameters", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X), +GNEAdditionalFrame::AdditionalAttributes::AdditionalAttributes(GNEViewNet* viewNet, FXComposite* parent) : + FXGroupBox(parent, "Internal attributes", GUIDesignGroupBoxFrame), + myViewNet(viewNet), myIndexParameter(0), myIndexParameterList(0), maxNumberOfParameters(GNEAttributeCarrier::getHigherNumberOfAttributes()), maxNumberOfListParameters(2) { - // Create widgets for parameters + // Create single parameters for (int i = 0; i < maxNumberOfParameters; i++) { - myVectorOfAdditionalParameter.push_back(new additionalParameter(this, tgt)); + myVectorOfsingleAdditionalParameter.push_back(new AdditionalAttributeSingle(this)); } - // Create widgets for parameters + // Create single list parameters for (int i = 0; i < maxNumberOfListParameters; i++) { - myVectorOfAdditionalParameterList.push_back(new additionalParameterList(this, tgt)); + myVectorOfsingleAdditionalParameterList.push_back(new AdditionalAttributeList(this)); } // Create help button - helpAdditional = new FXButton(this, "Help", 0, this, MID_HELP); + helpAdditional = new FXButton(this, "Help", 0, this, MID_HELP, GUIDesignButtonRectangular); } -GNEAdditionalFrame::additionalParameters::~additionalParameters() { +GNEAdditionalFrame::AdditionalAttributes::~AdditionalAttributes() { } void -GNEAdditionalFrame::additionalParameters::clearAttributes() { +GNEAdditionalFrame::AdditionalAttributes::clearAttributes() { // Hidde al fields for (int i = 0; i < maxNumberOfParameters; i++) { - myVectorOfAdditionalParameter.at(i)->hideParameter(); + myVectorOfsingleAdditionalParameter.at(i)->hideParameter(); } // Hidde al list fields for (int i = 0; i < maxNumberOfListParameters; i++) { - myVectorOfAdditionalParameterList.at(i)->hideParameter(); + myVectorOfsingleAdditionalParameterList.at(i)->hideParameter(); } // Reset indexs @@ -796,22 +1000,24 @@ void -GNEAdditionalFrame::additionalParameters::addAttribute(SumoXMLTag additional, SumoXMLAttr attribute) { +GNEAdditionalFrame::AdditionalAttributes::addAttribute(SumoXMLTag additionalTag, SumoXMLAttr AdditionalAttributeSingle) { // Set current additional - myAdditional = additional; + myAdditionalTag = additionalTag; // If parameter is of type list - if (GNEAttributeCarrier::isList(attribute)) { + if (GNEAttributeCarrier::isList(myAdditionalTag, AdditionalAttributeSingle)) { // If parameter can be show if (myIndexParameterList < maxNumberOfListParameters) { // Check type of attribute list - if (GNEAttributeCarrier::isInt(attribute)) { - myVectorOfAdditionalParameterList.at(myIndexParameterList)->showListParameter(attribute, GNEAttributeCarrier::getDefaultValue< std::vector >(additional, attribute)); - } else if (GNEAttributeCarrier::isFloat(attribute)) { - myVectorOfAdditionalParameterList.at(myIndexParameterList)->showListParameter(attribute, GNEAttributeCarrier::getDefaultValue< std::vector >(additional, attribute)); - } else if (GNEAttributeCarrier::isBool(attribute)) { - myVectorOfAdditionalParameterList.at(myIndexParameterList)->showListParameter(attribute, GNEAttributeCarrier::getDefaultValue< std::vector >(additional, attribute)); - } else if (GNEAttributeCarrier::isString(attribute)) { - myVectorOfAdditionalParameterList.at(myIndexParameterList)->showListParameter(attribute, GNEAttributeCarrier::getDefaultValue< std::vector >(additional, attribute)); + if (GNEAttributeCarrier::isInt(myAdditionalTag, AdditionalAttributeSingle)) { + myVectorOfsingleAdditionalParameterList.at(myIndexParameterList)->showListParameter(myAdditionalTag, AdditionalAttributeSingle, GNEAttributeCarrier::getDefaultValue< std::vector >(myAdditionalTag, AdditionalAttributeSingle)); + } else if (GNEAttributeCarrier::isFloat(myAdditionalTag, AdditionalAttributeSingle)) { + myVectorOfsingleAdditionalParameterList.at(myIndexParameterList)->showListParameter(myAdditionalTag, AdditionalAttributeSingle, GNEAttributeCarrier::getDefaultValue< std::vector >(myAdditionalTag, AdditionalAttributeSingle)); + } else if (GNEAttributeCarrier::isTime(myAdditionalTag, AdditionalAttributeSingle)) { + myVectorOfsingleAdditionalParameterList.at(myIndexParameterList)->showListParameter(myAdditionalTag, AdditionalAttributeSingle, GNEAttributeCarrier::getDefaultValue< std::vector >(myAdditionalTag, AdditionalAttributeSingle), true); + } else if (GNEAttributeCarrier::isBool(myAdditionalTag, AdditionalAttributeSingle)) { + myVectorOfsingleAdditionalParameterList.at(myIndexParameterList)->showListParameter(myAdditionalTag, AdditionalAttributeSingle, GNEAttributeCarrier::getDefaultValue< std::vector >(myAdditionalTag, AdditionalAttributeSingle)); + } else if (GNEAttributeCarrier::isString(myAdditionalTag, AdditionalAttributeSingle)) { + myVectorOfsingleAdditionalParameterList.at(myIndexParameterList)->showListParameter(myAdditionalTag, AdditionalAttributeSingle, GNEAttributeCarrier::getDefaultValue< std::vector >(myAdditionalTag, AdditionalAttributeSingle)); } // Update index myIndexParameterList++; @@ -821,16 +1027,16 @@ } else { if (myIndexParameter < maxNumberOfParameters) { // Check type of attribute list - if (GNEAttributeCarrier::isInt(attribute)) { - myVectorOfAdditionalParameter.at(myIndexParameter)->showParameter(attribute, GNEAttributeCarrier::getDefaultValue(additional, attribute)); - } else if (GNEAttributeCarrier::isFloat(attribute)) { - myVectorOfAdditionalParameter.at(myIndexParameter)->showParameter(attribute, GNEAttributeCarrier::getDefaultValue(additional, attribute)); - } else if (GNEAttributeCarrier::isBool(attribute)) { - myVectorOfAdditionalParameter.at(myIndexParameter)->showParameter(attribute, GNEAttributeCarrier::getDefaultValue(additional, attribute)); - } else if (GNEAttributeCarrier::isString(attribute)) { - myVectorOfAdditionalParameter.at(myIndexParameter)->showParameter(attribute, GNEAttributeCarrier::getDefaultValue(additional, attribute)); + if (GNEAttributeCarrier::isInt(myAdditionalTag, AdditionalAttributeSingle)) { + myVectorOfsingleAdditionalParameter.at(myIndexParameter)->showParameter(myAdditionalTag, AdditionalAttributeSingle, GNEAttributeCarrier::getDefaultValue(myAdditionalTag, AdditionalAttributeSingle)); + } else if (GNEAttributeCarrier::isFloat(myAdditionalTag, AdditionalAttributeSingle) || GNEAttributeCarrier::isTime(myAdditionalTag, AdditionalAttributeSingle)) { + myVectorOfsingleAdditionalParameter.at(myIndexParameter)->showParameter(myAdditionalTag, AdditionalAttributeSingle, GNEAttributeCarrier::getDefaultValue(myAdditionalTag, AdditionalAttributeSingle)); + } else if (GNEAttributeCarrier::isBool(myAdditionalTag, AdditionalAttributeSingle)) { + myVectorOfsingleAdditionalParameter.at(myIndexParameter)->showParameter(myAdditionalTag, AdditionalAttributeSingle, GNEAttributeCarrier::getDefaultValue(myAdditionalTag, AdditionalAttributeSingle)); + } else if (GNEAttributeCarrier::isString(myAdditionalTag, AdditionalAttributeSingle)) { + myVectorOfsingleAdditionalParameter.at(myIndexParameter)->showParameter(myAdditionalTag, AdditionalAttributeSingle, GNEAttributeCarrier::getDefaultValue(myAdditionalTag, AdditionalAttributeSingle)); } else { - WRITE_WARNING("Attribute '" + toString(attribute) + "' don't have a defined type. Check definition in GNEAttributeCarrier"); + WRITE_WARNING("Attribute '" + toString(AdditionalAttributeSingle) + "' doesn't have a defined type. Check definition in GNEAttributeCarrier"); } // Update index parameter myIndexParameter++; @@ -842,43 +1048,97 @@ void -GNEAdditionalFrame::additionalParameters::showAdditionalParameters() { +GNEAdditionalFrame::AdditionalAttributes::showAdditionalParameters() { recalc(); show(); } void -GNEAdditionalFrame::additionalParameters::hideAdditionalParameters() { +GNEAdditionalFrame::AdditionalAttributes::hideAdditionalParameters() { hide(); } std::map -GNEAdditionalFrame::additionalParameters::getAttributes() const { +GNEAdditionalFrame::AdditionalAttributes::getAttributesAndValues() const { std::map values; // get standar Parameters for (int i = 0; i < myIndexParameter; i++) { - values[myVectorOfAdditionalParameter.at(i)->getAttr()] = myVectorOfAdditionalParameter.at(i)->getValue(); + values[myVectorOfsingleAdditionalParameter.at(i)->getAttr()] = myVectorOfsingleAdditionalParameter.at(i)->getValue(); } // get list parameters for (int i = 0; i < myIndexParameterList; i++) { - values[myVectorOfAdditionalParameterList.at(i)->getAttr()] = myVectorOfAdditionalParameterList.at(i)->getListValues(); + values[myVectorOfsingleAdditionalParameterList.at(i)->getAttr()] = myVectorOfsingleAdditionalParameterList.at(i)->getListValues(); } return values; } +void +GNEAdditionalFrame::AdditionalAttributes::showWarningMessage(std::string extra) const { + std::string errorMessage; + // iterate over standar parameters + for (int i = 0; (i < myIndexParameter) && (errorMessage.empty() == true); i++) { + // Return string with the error if at least one of the parameter isn't valid + std::string attributeValue = myVectorOfsingleAdditionalParameter.at(i)->isAttributeValid(); + if (attributeValue.size() != 0) { + errorMessage = attributeValue; + } + } + // iterate over list parameters + for (int i = 0; i < myIndexParameterList; i++) { + // Return false if at least one of the list parameter isn't valid + if (myVectorOfsingleAdditionalParameterList.at(i)->isCurrentListValid() == false) { + ; + } + } + // show warning box if input parameters aren't invalid + if (extra.size() == 0) { + errorMessage = "Invalid input parameter of " + toString(myAdditionalTag) + ": " + errorMessage; + } else { + errorMessage = "Invalid input parameter of " + toString(myAdditionalTag) + ": " + extra; + } + + // set message in status bar + myViewNet->setStatusBarText(errorMessage); + // Write Warning in console if we're in testing mode + if (myViewNet->isTestingModeEnabled() == true) { + WRITE_WARNING(errorMessage); + } +} + + +bool +GNEAdditionalFrame::AdditionalAttributes::areValuesValid() const { + // iterate over standar parameters + for (int i = 0; i < myIndexParameter; i++) { + // Return false if error message of attriuve isn't empty + if (myVectorOfsingleAdditionalParameter.at(i)->isAttributeValid().size() != 0) { + return false; + } + } + // iterate over list parameters + for (int i = 0; i < myIndexParameterList; i++) { + // Return false if at least one of the list parameter isn't valid + if (myVectorOfsingleAdditionalParameterList.at(i)->isCurrentListValid() == false) { + return false; + } + } + return true; +} + + int -GNEAdditionalFrame::additionalParameters::getNumberOfAddedAttributes() const { +GNEAdditionalFrame::AdditionalAttributes::getNumberOfAddedAttributes() const { return (myIndexParameter + myIndexParameterList); } long -GNEAdditionalFrame::additionalParameters::onCmdHelp(FXObject*, FXSelector, void*) { +GNEAdditionalFrame::AdditionalAttributes::onCmdHelp(FXObject*, FXSelector, void*) { // Create help dialog - FXDialogBox* helpDialog = new FXDialogBox(this, ("Parameters of " + toString(myAdditional)).c_str(), DECOR_CLOSE | DECOR_TITLE); + FXDialogBox* helpDialog = new FXDialogBox(this, ("Parameters of " + toString(myAdditionalTag)).c_str(), GUIDesignDialogBox); // Create FXTable FXTable* myTable = new FXTable(helpDialog, this, MID_TABLE, TABLE_READONLY); myTable->setVisibleRows((FXint)(myIndexParameter + myIndexParameterList)); @@ -897,196 +1157,260 @@ int maxSizeColumnDefinitions = 0; // Iterate over vector of additional parameters for (int i = 0; i < myIndexParameter; i++) { - SumoXMLAttr attr = myVectorOfAdditionalParameter.at(i)->getAttr(); + SumoXMLTag tag = myVectorOfsingleAdditionalParameter.at(i)->getTag(); + SumoXMLAttr attr = myVectorOfsingleAdditionalParameter.at(i)->getAttr(); // Set name of attribute myTable->setItem(i, 0, new FXTableItem(toString(attr).c_str())); // Set type FXTableItem* type = new FXTableItem(""); - if (GNEAttributeCarrier::isInt(attr)) { + if (GNEAttributeCarrier::isInt(tag, attr)) { type->setText("int"); - } else if (GNEAttributeCarrier::isFloat(attr)) { + } else if (GNEAttributeCarrier::isFloat(tag, attr)) { type->setText("float"); - } else if (GNEAttributeCarrier::isBool(attr)) { + } else if (GNEAttributeCarrier::isTime(tag, attr)) { + type->setText("time"); + } else if (GNEAttributeCarrier::isBool(tag, attr)) { type->setText("bool"); - } else if (GNEAttributeCarrier::isString(attr)) { + } else if (GNEAttributeCarrier::isString(tag, attr)) { type->setText("string"); } type->setJustify(FXTableItem::CENTER_X); myTable->setItem(i, 1, type); // Set definition - FXTableItem* definition = new FXTableItem(GNEAttributeCarrier::getDefinition(myAdditional, attr).c_str()); + FXTableItem* definition = new FXTableItem(GNEAttributeCarrier::getDefinition(myAdditionalTag, attr).c_str()); definition->setJustify(FXTableItem::LEFT); myTable->setItem(i, 2, definition); - if ((int)GNEAttributeCarrier::getDefinition(myAdditional, attr).size() > maxSizeColumnDefinitions) { - maxSizeColumnDefinitions = int(GNEAttributeCarrier::getDefinition(myAdditional, attr).size()); + if ((int)GNEAttributeCarrier::getDefinition(myAdditionalTag, attr).size() > maxSizeColumnDefinitions) { + maxSizeColumnDefinitions = int(GNEAttributeCarrier::getDefinition(myAdditionalTag, attr).size()); } } // Iterate over vector of additional parameters list for (int i = 0; i < myIndexParameterList; i++) { - SumoXMLAttr attr = myVectorOfAdditionalParameterList.at(i)->getAttr(); + SumoXMLTag tag = myVectorOfsingleAdditionalParameterList.at(i)->getTag(); + SumoXMLAttr attr = myVectorOfsingleAdditionalParameterList.at(i)->getAttr(); // Set name of attribute myTable->setItem(i, 0, new FXTableItem(toString(attr).c_str())); // Set type FXTableItem* type = new FXTableItem(""); - if (GNEAttributeCarrier::isInt(attr)) { - type->setText("list of int"); - } else if (GNEAttributeCarrier::isFloat(attr)) { - type->setText("list of float"); - } else if (GNEAttributeCarrier::isBool(attr)) { - type->setText("list of bool"); - } else if (GNEAttributeCarrier::isString(attr)) { - type->setText("list of string"); + if (GNEAttributeCarrier::isInt(tag, attr)) { + type->setText("list of integers"); + } else if (GNEAttributeCarrier::isFloat(tag, attr)) { + type->setText("list of floats"); + } else if (GNEAttributeCarrier::isTime(tag, attr)) { + type->setText("list of times"); + } else if (GNEAttributeCarrier::isBool(tag, attr)) { + type->setText("list of booleans"); + } else if (GNEAttributeCarrier::isString(tag, attr)) { + type->setText("list of strings"); } type->setJustify(FXTableItem::CENTER_X); myTable->setItem(i, 1, type); // Set definition - FXTableItem* definition = new FXTableItem(GNEAttributeCarrier::getDefinition(myAdditional, attr).c_str()); + FXTableItem* definition = new FXTableItem(GNEAttributeCarrier::getDefinition(myAdditionalTag, attr).c_str()); definition->setJustify(FXTableItem::LEFT); myTable->setItem(i, 2, definition); - if ((int)GNEAttributeCarrier::getDefinition(myAdditional, attr).size() > maxSizeColumnDefinitions) { - maxSizeColumnDefinitions = int(GNEAttributeCarrier::getDefinition(myAdditional, attr).size()); + if ((int)GNEAttributeCarrier::getDefinition(myAdditionalTag, attr).size() > maxSizeColumnDefinitions) { + maxSizeColumnDefinitions = int(GNEAttributeCarrier::getDefinition(myAdditionalTag, attr).size()); } } // Set size of column header->setItemJustify(2, JUSTIFY_CENTER_X); header->setItemSize(2, maxSizeColumnDefinitions * 6); // Button Close - new FXButton(helpDialog, "OK\t\tclose", 0, helpDialog, FXDialogBox::ID_ACCEPT, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 3, 3); + new FXButton(helpDialog, "OK\t\tclose", GUIIconSubSys::getIcon(ICON_ACCEPT), helpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK); helpDialog->create(); helpDialog->show(); return 1; } // --------------------------------------------------------------------------- -// GNEAdditionalFrame::editorParameters- methods +// GNEAdditionalFrame::NeteditAttributes- methods // --------------------------------------------------------------------------- -GNEAdditionalFrame::editorParameters::editorParameters(FXComposite* parent, FXObject* tgt) : - FXGroupBox(parent, "editor parameters", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X), - myActualAdditionalReferencePoint(GNE_ADDITIONALREFERENCEPOINT_LEFT) { - // Create FXListBox for the reference points - myReferencePointMatchBox = new FXComboBox(this, 12, this, MID_GNE_MODE_ADDITIONAL_REFERENCEPOINT, - FRAME_SUNKEN | LAYOUT_LEFT | COMBOBOX_STATIC | LAYOUT_FILL_X); - - // Create Frame for Label and TextField - FXHorizontalFrame* lengthFrame = new FXHorizontalFrame(this, LAYOUT_FILL_X | LAYOUT_LEFT); - - // Create length label - myLengthLabel = new FXLabel(lengthFrame, "Length:", 0, JUSTIFY_LEFT | LAYOUT_FILL_X); - - // Create length text field - myLengthTextField = new FXTextField(lengthFrame, 10, tgt, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_TEXT, LAYOUT_FILL_COLUMN | LAYOUT_FILL_X); - - // Set default value of length - myLengthTextField->setText("10"); - - // Create FXMenuCheck for the force option - myCheckForcePosition = new FXMenuCheck(this, "Force position", this, MID_GNE_MODE_ADDITIONAL_FORCEPOSITION, - LAYOUT_LEFT | LAYOUT_FILL_X); - - // Create FXMenuCheck for the force option - myCheckBlock = new FXMenuCheck(this, "Block movement", this, MID_GNE_SET_BLOCKING, - LAYOUT_LEFT | LAYOUT_FILL_X); - - // Create help button - helpReferencePoint = new FXButton(this, "Help", 0, this, MID_HELP); - - // Add options to myReferencePointMatchBox +GNEAdditionalFrame::NeteditAttributes::NeteditAttributes(FXComposite* parent) : + FXGroupBox(parent, "Netedit attributes", GUIDesignGroupBoxFrame), + myActualAdditionalReferencePoint(GNE_ADDITIONALREFERENCEPOINT_LEFT), + myCurrentLengthValid(true) { + // Create FXListBox for the reference points and fill it + myReferencePointMatchBox = new FXComboBox(this, GUIDesignComboBoxNCol, this, MID_GNE_MODE_ADDITIONAL_REFERENCEPOINT, GUIDesignComboBox); myReferencePointMatchBox->appendItem("reference left"); myReferencePointMatchBox->appendItem("reference right"); myReferencePointMatchBox->appendItem("reference center"); - + // Create Frame for Length Label and textField + FXHorizontalFrame* lengthFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame); + myLengthLabel = new FXLabel(lengthFrame, toString(SUMO_ATTR_LENGTH).c_str(), 0, GUIDesignLabelAttribute); + myLengthTextField = new FXTextField(lengthFrame, GUIDesignTextFieldNCol, this, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_TEXT, GUIDesignTextField); + myLengthTextField->setText("10"); + // Create Frame for force position Label and checkBox (By default disabled) + FXHorizontalFrame* forcePositionFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame); + myForcePositionLabel = new FXLabel(forcePositionFrame, "force position", 0, GUIDesignLabelAttribute); + myForcePositionCheckButton = new FXCheckButton(forcePositionFrame, "false", this, MID_GNE_MODE_ADDITIONAL_FORCEPOSITION, GUIDesignCheckButtonAttribute); + myForcePositionCheckButton->setCheck(false); + // Create Frame for block movement label and checkBox (By default disabled) + FXHorizontalFrame* blockMovement = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame); + myBlockLabel = new FXLabel(blockMovement, "block movement", 0, GUIDesignLabelAttribute); + myBlockMovementCheckButton = new FXCheckButton(blockMovement, "false", this, MID_GNE_SET_BLOCKING, GUIDesignCheckButtonAttribute); + myBlockMovementCheckButton->setCheck(false); + // Create help button + helpReferencePoint = new FXButton(this, "Help", 0, this, MID_HELP, GUIDesignButtonRectangular); // Set visible items myReferencePointMatchBox->setNumVisible((int)myReferencePointMatchBox->getNumItems()); } -GNEAdditionalFrame::editorParameters::~editorParameters() {} +GNEAdditionalFrame::NeteditAttributes::~NeteditAttributes() {} void -GNEAdditionalFrame::editorParameters::showLengthField() { +GNEAdditionalFrame::NeteditAttributes::showLengthField() { myLengthLabel->show(); myLengthTextField->show(); } void -GNEAdditionalFrame::editorParameters::hideLengthField() { +GNEAdditionalFrame::NeteditAttributes::hideLengthField() { myLengthLabel->hide(); myLengthTextField->hide(); } void -GNEAdditionalFrame::editorParameters::showReferencePoint() { +GNEAdditionalFrame::NeteditAttributes::showReferencePoint() { myReferencePointMatchBox->show(); - myCheckForcePosition->show(); + myForcePositionLabel->show(); + myForcePositionCheckButton->show(); } void -GNEAdditionalFrame::editorParameters::hideReferencePoint() { +GNEAdditionalFrame::NeteditAttributes::hideReferencePoint() { myReferencePointMatchBox->hide(); - myCheckForcePosition->hide(); + myForcePositionLabel->hide(); + myForcePositionCheckButton->hide(); } -GNEAdditionalFrame::editorParameters::additionalReferencePoint -GNEAdditionalFrame::editorParameters::getActualReferencePoint() { +GNEAdditionalFrame::NeteditAttributes::additionalReferencePoint +GNEAdditionalFrame::NeteditAttributes::getActualReferencePoint() { return myActualAdditionalReferencePoint; } -SUMOReal -GNEAdditionalFrame::editorParameters::getLenght() { - return GNEAttributeCarrier::parse(myLengthTextField->getText().text()); +double +GNEAdditionalFrame::NeteditAttributes::getLength() { + return GNEAttributeCarrier::parse(myLengthTextField->getText().text()); } bool -GNEAdditionalFrame::editorParameters::isBlockEnabled() { - return myCheckBlock->getCheck() == 1 ? true : false; +GNEAdditionalFrame::NeteditAttributes::isBlockEnabled() { + return myBlockMovementCheckButton->getCheck() == 1 ? true : false; } bool -GNEAdditionalFrame::editorParameters::isForcePositionEnabled() { - return myCheckForcePosition->getCheck() == 1 ? true : false; +GNEAdditionalFrame::NeteditAttributes::isForcePositionEnabled() { + return myForcePositionCheckButton->getCheck() == 1 ? true : false; +} + +bool +GNEAdditionalFrame::NeteditAttributes::isCurrentLengthValid() const { + return myCurrentLengthValid; } long -GNEAdditionalFrame::editorParameters::onCmdSelectReferencePoint(FXObject*, FXSelector, void*) { +GNEAdditionalFrame::NeteditAttributes::onCmdSetLength(FXObject*, FXSelector, void*) { + // change color of text field depending of the input length + if (GNEAttributeCarrier::canParse(myLengthTextField->getText().text()) && + GNEAttributeCarrier::parse(myLengthTextField->getText().text()) > 0) { + myLengthTextField->setTextColor(FXRGB(0, 0, 0)); + myLengthTextField->killFocus(); + myCurrentLengthValid = true; + } else { + myLengthTextField->setTextColor(FXRGB(255, 0, 0)); + myCurrentLengthValid = false; + } + // Update aditional frame + update(); + return 1; +} + + +long +GNEAdditionalFrame::NeteditAttributes::onCmdSelectReferencePoint(FXObject*, FXSelector, void*) { // Cast actual reference point type - myActualAdditionalReferencePoint = static_cast(myReferencePointMatchBox->getCurrentItem()); + if (myReferencePointMatchBox->getText() == "reference left") { + myReferencePointMatchBox->setTextColor(FXRGB(0, 0, 0)); + myActualAdditionalReferencePoint = GNE_ADDITIONALREFERENCEPOINT_LEFT; + myLengthTextField->enable(); + myForcePositionCheckButton->enable(); + } else if (myReferencePointMatchBox->getText() == "reference right") { + myReferencePointMatchBox->setTextColor(FXRGB(0, 0, 0)); + myActualAdditionalReferencePoint = GNE_ADDITIONALREFERENCEPOINT_RIGHT; + myLengthTextField->enable(); + myForcePositionCheckButton->enable(); + } else if (myReferencePointMatchBox->getText() == "reference center") { + myLengthTextField->enable(); + myForcePositionCheckButton->enable(); + myReferencePointMatchBox->setTextColor(FXRGB(0, 0, 0)); + myActualAdditionalReferencePoint = GNE_ADDITIONALREFERENCEPOINT_CENTER; + myLengthTextField->enable(); + myForcePositionCheckButton->enable(); + } else { + myReferencePointMatchBox->setTextColor(FXRGB(255, 0, 0)); + myActualAdditionalReferencePoint = GNE_ADDITIONALREFERENCEPOINT_INVALID; + myLengthTextField->disable(); + myForcePositionCheckButton->disable(); + } return 1; } long -GNEAdditionalFrame::editorParameters::onCmdHelp(FXObject*, FXSelector, void*) { - FXDialogBox* helpDialog = new FXDialogBox(this, "Parameter editor Help", DECOR_CLOSE | DECOR_TITLE); +GNEAdditionalFrame::NeteditAttributes::onCmdSetBlocking(FXObject*, FXSelector, void*) { + if (myBlockMovementCheckButton->getCheck()) { + myBlockMovementCheckButton->setText("true"); + } else { + myBlockMovementCheckButton->setText("false"); + } + return 1; +} + + +long +GNEAdditionalFrame::NeteditAttributes::onCmdSetForcePosition(FXObject*, FXSelector, void*) { + if (myForcePositionCheckButton->getCheck()) { + myForcePositionCheckButton->setText("true"); + } else { + myForcePositionCheckButton->setText("false"); + } + return 1; +} + + +long +GNEAdditionalFrame::NeteditAttributes::onCmdHelp(FXObject*, FXSelector, void*) { + FXDialogBox* helpDialog = new FXDialogBox(this, "Parameter editor Help", GUIDesignDialogBox); std::ostringstream help; help << "Referece point: Mark the initial position of the additional element.\n" - << "Example: If you want to create a busStop with a lenght of 30 in the point 100 of the lane:\n" + << "Example: If you want to create a busStop with a length of 30 in the point 100 of the lane:\n" << "- Reference Left will create it with startPos = 70 and endPos = 100.\n" << "- Reference Right will create it with startPos = 100 and endPos = 130.\n" << "- Reference Center will create it with startPos = 85 and endPos = 115.\n" << "\n" << "Force position: if is enabled, will create the additional adapting size of additional element to lane.\n" - << "Example: If you have a lane with lenght = 100, but you try to create a busStop with size = 50\n" + << "Example: If you have a lane with length = 100, but you try to create a busStop with size = 50\n" << "in the position 80 of the lane, a busStop with startPos = 80 and endPos = 100 will be created\n" << "instead of a busStop with startPos = 80 and endPos = 130.\n" << "\n" << "Block movement: if is enabled, the created additional element will be blocked. i.e. cannot be moved with\n" << "the mouse. This option can be modified with the Inspector."; - new FXLabel(helpDialog, help.str().c_str(), 0, JUSTIFY_LEFT); + new FXLabel(helpDialog, help.str().c_str(), 0, GUIDesignLabelLeft); // "OK" - new FXButton(helpDialog, "OK\t\tclose", 0, helpDialog, FXDialogBox::ID_ACCEPT, - ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, - 0, 0, 0, 0, 4, 4, 3, 3); + new FXButton(helpDialog, "OK\t\tclose", GUIIconSubSys::getIcon(ICON_ACCEPT), helpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK); helpDialog->create(); helpDialog->show(); return 1; @@ -1111,33 +1435,33 @@ // --------------------------------------------------------------------------- -// GNEAdditionalFrame::additionalSet - methods +// GNEAdditionalFrame::SelectorParentAdditional - methods // --------------------------------------------------------------------------- -GNEAdditionalFrame::additionalSet::additionalSet(FXComposite* parent, FXObject* tgt, GNEViewNet* viewNet) : - FXGroupBox(parent, "Additional Set", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X), - myType(SUMO_TAG_NOTHING), +GNEAdditionalFrame::SelectorParentAdditional::SelectorParentAdditional(FXComposite* parent, GNEViewNet* viewNet) : + FXGroupBox(parent, "Additional Set selector", GUIDesignGroupBoxFrame), + myUniqueSelection(false), myViewNet(viewNet) { - // Create label with the type of additionalSet - mySetLabel = new FXLabel(this, "Set Type:", 0, JUSTIFY_LEFT | LAYOUT_FILL_X); + // Create label with the type of SelectorParentAdditional + mySetLabel = new FXLabel(this, "No additional selected", 0, GUIDesignLabelLeftThick); // Create list - myList = new FXList(this, tgt, MID_GNE_SELECTADDITIONALSET, LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT, 0, 0, 0, 100); + myList = new FXList(this, this, MID_GNE_SELECTADDITIONALPARENT, GUIDesignList, 0, 0, 0, 100); // Create help button - helpAdditionalSet = new FXButton(this, "Help", 0, this, MID_HELP); + myHelpAdditionalParentSelector = new FXButton(this, "Help", 0, this, MID_HELP, GUIDesignButtonRectangular); // Hide List - hideList(); + hideListOfAdditionals(); } -GNEAdditionalFrame::additionalSet::~additionalSet() {} +GNEAdditionalFrame::SelectorParentAdditional::~SelectorParentAdditional() {} std::string -GNEAdditionalFrame::additionalSet::getIdSelected() const { +GNEAdditionalFrame::SelectorParentAdditional::getIdSelected() const { for (int i = 0; i < myList->getNumItems(); i++) { if (myList->isItemSelected(i)) { return myList->getItem(i)->getText().text(); @@ -1147,19 +1471,15 @@ } -SumoXMLTag -GNEAdditionalFrame::additionalSet::getCurrentlyTag() const { - return myType; -} - - void -GNEAdditionalFrame::additionalSet::showList(SumoXMLTag type) { - myType = type; - mySetLabel->setText(("Type of set: " + toString(myType)).c_str()); +GNEAdditionalFrame::SelectorParentAdditional::showListOfAdditionals(SumoXMLTag type, bool uniqueSelection) { + myUniqueSelection = uniqueSelection; + mySetLabel->setText(("" + toString(type)).c_str()); myList->clearItems(); - const std::vector& vectorOfAdditionalSets = myViewNet->getNet()->getAdditionals(myType); - for (std::vector::const_iterator i = vectorOfAdditionalSets.begin(); i != vectorOfAdditionalSets.end(); i++) { + // obtain all additionals of class "type" + std::vector vectorOfAdditionalParents = myViewNet->getNet()->getAdditionals(type); + // fill list with IDs of additionals + for (std::vector::iterator i = vectorOfAdditionalParents.begin(); i != vectorOfAdditionalParents.end(); i++) { myList->appendItem((*i)->getID().c_str()); } show(); @@ -1167,78 +1487,81 @@ void -GNEAdditionalFrame::additionalSet::hideList() { - myType = SUMO_TAG_NOTHING; +GNEAdditionalFrame::SelectorParentAdditional::hideListOfAdditionals() { hide(); } long -GNEAdditionalFrame::additionalSet::onCmdSelectAdditionalSet(FXObject*, FXSelector, void*) { +GNEAdditionalFrame::SelectorParentAdditional::onCmdSelectAdditionalParent(FXObject*, FXSelector, void*) { return 1; } long -GNEAdditionalFrame::additionalSet::onCmdHelp(FXObject*, FXSelector, void*) { +GNEAdditionalFrame::SelectorParentAdditional::onCmdHelp(FXObject*, FXSelector, void*) { return 1; } // --------------------------------------------------------------------------- -// GNEAdditionalFrame::edgesSelector - methods +// GNEAdditionalFrame::SelectorParentEdges - methods // --------------------------------------------------------------------------- -GNEAdditionalFrame::edgesSelector::edgesSelector(FXComposite* parent, GNEViewNet* viewNet) : - FXGroupBox(parent, "Edges", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X), +GNEAdditionalFrame::SelectorParentEdges::SelectorParentEdges(FXComposite* parent, GNEViewNet* viewNet) : + FXGroupBox(parent, "Edges", GUIDesignGroupBoxFrame), myViewNet(viewNet) { - // Create CheckBox for selected edges - myUseSelectedEdges = new FXMenuCheck(this, "Use selected Edges", this, MID_GNE_USESELECTEDEDGES); + // Create menuCheck for selected edges + myUseSelectedEdgesCheckButton = new FXCheckButton(this, ("Use selected " + toString(SUMO_TAG_EDGE) + "s").c_str(), this, MID_GNE_SHOWONLYSELECTEDEDGES, GUIDesignCheckButtonAttribute); // Create search box - myEdgesSearch = new FXTextField(this, 10, this, MID_GNE_SEARCHEDGE, LAYOUT_FILL_X); + myEdgesSearch = new FXTextField(this, GUIDesignTextFieldNCol, this, MID_GNE_SEARCHEDGE, GUIDesignTextField); // Create list - myList = new FXList(this, this, MID_GNE_SELECTEDGE, LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT, 0, 0, 0, 100); + myList = new FXList(this, this, MID_GNE_SELECTEDGE, GUIDesignList, 0, 0, 0, 100); // Create horizontal frame - FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(this, LAYOUT_FILL_X); + FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame); // Create button for clear selection - clearEdgesSelection = new FXButton(buttonsFrame, "clear", 0, this, MID_GNE_CLEAREDGESELECTION); + myClearEdgesSelection = new FXButton(buttonsFrame, "Clear", 0, this, MID_GNE_CLEAREDGESELECTION, GUIDesignButtonRectangular); // Create button for invert selection - invertEdgesSelection = new FXButton(buttonsFrame, "invert", 0, this, MID_GNE_INVERTEDGESELECTION); + myInvertEdgesSelection = new FXButton(buttonsFrame, "Invert", 0, this, MID_GNE_INVERTEDGESELECTION, GUIDesignButtonRectangular); // Create help button - helpEdges = new FXButton(this, "Help", 0, this, MID_HELP); + myHelpedgeParentsSelector = new FXButton(this, "Help", 0, this, MID_HELP, GUIDesignButtonRectangular); // Hide List hideList(); } -GNEAdditionalFrame::edgesSelector::~edgesSelector() {} +GNEAdditionalFrame::SelectorParentEdges::~SelectorParentEdges() {} std::string -GNEAdditionalFrame::edgesSelector::getIdsSelected() const { +GNEAdditionalFrame::SelectorParentEdges::getIdsSelected() const { return GNEAdditionalFrame::getIdsSelected(myList); } void -GNEAdditionalFrame::edgesSelector::showList(std::string search) { - // FIll list +GNEAdditionalFrame::SelectorParentEdges::showList(std::string search) { + // clear list of egdge ids myList->clearItems(); + // get all edges of net + /// @todo this function must be improved. std::vector vectorOfEdges = myViewNet->getNet()->retrieveEdges(false); + // iterate over edges of net for (std::vector::iterator i = vectorOfEdges.begin(); i != vectorOfEdges.end(); i++) { + // If search criterium is correct, then append ittem if ((*i)->getID().find(search) != std::string::npos) { myList->appendItem((*i)->getID().c_str()); } } // By default, CheckBox for useSelectedEdges isn't checked - myUseSelectedEdges->setCheck(false); + myUseSelectedEdgesCheckButton->setCheck(false); // Recalc Frame recalc(); // Update Frame @@ -1249,25 +1572,25 @@ void -GNEAdditionalFrame::edgesSelector::hideList() { +GNEAdditionalFrame::SelectorParentEdges::hideList() { FXGroupBox::hide(); } void -GNEAdditionalFrame::edgesSelector::updateUseSelectedEdges() { +GNEAdditionalFrame::SelectorParentEdges::updateUseSelectedEdges() { // Enable or disable use selected edges if (myViewNet->getNet()->retrieveEdges(true).size() > 0) { - myUseSelectedEdges->enable(); + myUseSelectedEdgesCheckButton->enable(); } else { - myUseSelectedEdges->disable(); + myUseSelectedEdgesCheckButton->disable(); } } bool -GNEAdditionalFrame::edgesSelector::isUseSelectedEdgesEnable() const { - if (myUseSelectedEdges->getCheck()) { +GNEAdditionalFrame::SelectorParentEdges::isUseSelectedEdgesEnable() const { + if (myUseSelectedEdgesCheckButton->getCheck()) { return true; } else { return false; @@ -1276,19 +1599,19 @@ long -GNEAdditionalFrame::edgesSelector::onCmdUseSelectedEdges(FXObject*, FXSelector, void*) { - if (myUseSelectedEdges->getCheck()) { +GNEAdditionalFrame::SelectorParentEdges::onCmdUseSelectedEdges(FXObject*, FXSelector, void*) { + if (myUseSelectedEdgesCheckButton->getCheck()) { myEdgesSearch->hide(); myList->hide(); - clearEdgesSelection->hide(); - invertEdgesSelection->hide(); - helpEdges->hide(); + myClearEdgesSelection->hide(); + myInvertEdgesSelection->hide(); + myHelpedgeParentsSelector->hide(); } else { myEdgesSearch->show(); myList->show(); - clearEdgesSelection->show(); - invertEdgesSelection->show(); - helpEdges->show(); + myClearEdgesSelection->show(); + myInvertEdgesSelection->show(); + myHelpedgeParentsSelector->show(); } // Recalc Frame recalc(); @@ -1299,21 +1622,21 @@ long -GNEAdditionalFrame::edgesSelector::onCmdTypeInSearchBox(FXObject*, FXSelector, void*) { - // Show only Id's of edgesSelector that contains the searched string +GNEAdditionalFrame::SelectorParentEdges::onCmdTypeInSearchBox(FXObject*, FXSelector, void*) { + // Show only Id's of SelectorParentEdges that contains the searched string showList(myEdgesSearch->getText().text()); return 1; } long -GNEAdditionalFrame::edgesSelector::onCmdSelectEdge(FXObject*, FXSelector, void*) { +GNEAdditionalFrame::SelectorParentEdges::onCmdSelectEdge(FXObject*, FXSelector, void*) { return 1; } long -GNEAdditionalFrame::edgesSelector::onCmdClearSelection(FXObject*, FXSelector, void*) { +GNEAdditionalFrame::SelectorParentEdges::onCmdClearSelection(FXObject*, FXSelector, void*) { for (int i = 0; i < myList->getNumItems(); i++) { if (myList->getItem(i)->isSelected()) { myList->deselectItem(i); @@ -1324,7 +1647,7 @@ long -GNEAdditionalFrame::edgesSelector::onCmdInvertSelection(FXObject*, FXSelector, void*) { +GNEAdditionalFrame::SelectorParentEdges::onCmdInvertSelection(FXObject*, FXSelector, void*) { for (int i = 0; i < myList->getNumItems(); i++) { if (myList->getItem(i)->isSelected()) { myList->deselectItem(i); @@ -1337,55 +1660,55 @@ long -GNEAdditionalFrame::edgesSelector::onCmdHelp(FXObject*, FXSelector, void*) { +GNEAdditionalFrame::SelectorParentEdges::onCmdHelp(FXObject*, FXSelector, void*) { std::cout << "IMPLEMENT" << std::endl; return 1; } // --------------------------------------------------------------------------- -// GNEAdditionalFrame::lanesSelector - methods +// GNEAdditionalFrame::SelectorParentLanes - methods // --------------------------------------------------------------------------- -GNEAdditionalFrame::lanesSelector::lanesSelector(FXComposite* parent, GNEViewNet* viewNet) : - FXGroupBox(parent, "lanesSelector", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X), +GNEAdditionalFrame::SelectorParentLanes::SelectorParentLanes(FXComposite* parent, GNEViewNet* viewNet) : + FXGroupBox(parent, "Lanes", GUIDesignGroupBoxFrame), myViewNet(viewNet) { // Create CheckBox for selected lanes - myUseSelectedLanes = new FXMenuCheck(this, "Use selected Lanes", this, MID_GNE_USESELECTEDLANES); + myUseSelectedLanesCheckButton = new FXCheckButton(this, ("Use selected " + toString(SUMO_TAG_LANE) + "s").c_str(), this, MID_GNE_USESELECTEDLANES, GUIDesignCheckButtonAttribute); // Create search box - myLanesSearch = new FXTextField(this, 10, this, MID_GNE_SEARCHLANE, LAYOUT_FILL_X); + myLanesSearch = new FXTextField(this, GUIDesignTextFieldNCol, this, MID_GNE_SEARCHLANE, GUIDesignTextField); // Create list - myList = new FXList(this, this, MID_GNE_SELECTLANE, LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT, 0, 0, 0, 100); + myList = new FXList(this, this, MID_GNE_SELECTLANE, GUIDesignList, 0, 0, 0, 100); // Create horizontal frame - FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(this, LAYOUT_FILL_X); + FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame); // Create button for clear selection - clearLanesSelection = new FXButton(buttonsFrame, "clear", 0, this, MID_GNE_CLEARLANESELECTION); + clearLanesSelection = new FXButton(buttonsFrame, "clear", 0, this, MID_GNE_CLEARLANESELECTION, GUIDesignButtonRectangular); // Create button for invert selection - invertLanesSelection = new FXButton(buttonsFrame, "invert", 0, this, MID_GNE_INVERTLANESELECTION); + invertLanesSelection = new FXButton(buttonsFrame, "invert", 0, this, MID_GNE_INVERTLANESELECTION, GUIDesignButtonRectangular); // Create help button - helpLanes = new FXButton(this, "Help", 0, this, MID_HELP); + helpLanes = new FXButton(this, "Help", 0, this, MID_HELP, GUIDesignButtonRectangular); // Hide List hideList(); } -GNEAdditionalFrame::lanesSelector::~lanesSelector() {} +GNEAdditionalFrame::SelectorParentLanes::~SelectorParentLanes() {} std::string -GNEAdditionalFrame::lanesSelector::getIdsSelected() const { +GNEAdditionalFrame::SelectorParentLanes::getIdsSelected() const { return GNEAdditionalFrame::getIdsSelected(myList); } void -GNEAdditionalFrame::lanesSelector::showList(std::string search) { +GNEAdditionalFrame::SelectorParentLanes::showList(std::string search) { myList->clearItems(); std::vector vectorOfLanes = myViewNet->getNet()->retrieveLanes(false); for (std::vector::iterator i = vectorOfLanes.begin(); i != vectorOfLanes.end(); i++) { @@ -1394,32 +1717,32 @@ } } // By default, CheckBox for useSelectedLanes isn't checked - myUseSelectedLanes->setCheck(false); + myUseSelectedLanesCheckButton->setCheck(false); // Show list show(); } void -GNEAdditionalFrame::lanesSelector::hideList() { +GNEAdditionalFrame::SelectorParentLanes::hideList() { hide(); } void -GNEAdditionalFrame::lanesSelector::updateUseSelectedLanes() { +GNEAdditionalFrame::SelectorParentLanes::updateUseSelectedLanes() { // Enable or disable use selected Lanes if (myViewNet->getNet()->retrieveLanes(true).size() > 0) { - myUseSelectedLanes->enable(); + myUseSelectedLanesCheckButton->enable(); } else { - myUseSelectedLanes->disable(); + myUseSelectedLanesCheckButton->disable(); } } bool -GNEAdditionalFrame::lanesSelector::isUseSelectedLanesEnable() const { - if (myUseSelectedLanes->getCheck()) { +GNEAdditionalFrame::SelectorParentLanes::isUseSelectedLanesEnable() const { + if (myUseSelectedLanesCheckButton->getCheck()) { return true; } else { return false; @@ -1428,8 +1751,8 @@ long -GNEAdditionalFrame::lanesSelector::onCmdUseSelectedLanes(FXObject*, FXSelector, void*) { - if (myUseSelectedLanes->getCheck()) { +GNEAdditionalFrame::SelectorParentLanes::onCmdUseSelectedLanes(FXObject*, FXSelector, void*) { + if (myUseSelectedLanesCheckButton->getCheck()) { myLanesSearch->hide(); myList->hide(); clearLanesSelection->hide(); @@ -1451,21 +1774,21 @@ long -GNEAdditionalFrame::lanesSelector::onCmdTypeInSearchBox(FXObject*, FXSelector, void*) { - // Show only Id's of lanesSelector that contains the searched string +GNEAdditionalFrame::SelectorParentLanes::onCmdTypeInSearchBox(FXObject*, FXSelector, void*) { + // Show only Id's of SelectorParentLanes that contains the searched string showList(myLanesSearch->getText().text()); return 1; } long -GNEAdditionalFrame::lanesSelector::onCmdSelectLane(FXObject*, FXSelector, void*) { +GNEAdditionalFrame::SelectorParentLanes::onCmdSelectLane(FXObject*, FXSelector, void*) { return 1; } long -GNEAdditionalFrame::lanesSelector::onCmdClearSelection(FXObject*, FXSelector, void*) { +GNEAdditionalFrame::SelectorParentLanes::onCmdClearSelection(FXObject*, FXSelector, void*) { for (int i = 0; i < myList->getNumItems(); i++) { if (myList->getItem(i)->isSelected()) { myList->deselectItem(i); @@ -1476,7 +1799,7 @@ long -GNEAdditionalFrame::lanesSelector::onCmdInvertSelection(FXObject*, FXSelector, void*) { +GNEAdditionalFrame::SelectorParentLanes::onCmdInvertSelection(FXObject*, FXSelector, void*) { for (int i = 0; i < myList->getNumItems(); i++) { if (myList->getItem(i)->isSelected()) { myList->deselectItem(i); @@ -1489,7 +1812,7 @@ long -GNEAdditionalFrame::lanesSelector::onCmdHelp(FXObject*, FXSelector, void*) { +GNEAdditionalFrame::SelectorParentLanes::onCmdHelp(FXObject*, FXSelector, void*) { return 1; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditionalFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditionalFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditionalFrame.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditionalFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEAdditionalFrame.h /// @author Pablo Alvarez Lopez /// @date Dec 2015 -/// @version $Id: GNEAdditionalFrame.h 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: GNEAdditionalFrame.h 24108 2017-04-27 18:43:30Z behrisch $ /// /// The Widget for add additional elements /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,14 +38,13 @@ class GNEAttributeCarrier; class GNENetElement; class GNEAdditional; -class GNEAdditionalSet; // =========================================================================== // class definitions // =========================================================================== /** * @class GNEAdditionalFrame - * The Widget for setting default parameters of additional elements + * The Widget for setting internal attributes of additional elements */ class GNEAdditionalFrame : public GNEFrame { /// @brief FOX-declaration @@ -53,90 +52,136 @@ public: + /// @brief enum with all possible values after try to create an additional using frame + enum AddAdditionalResult { + ADDADDITIONAL_INVALID_ARGUMENTS, // Parameters of additionals are invalid + ADDADDITIONAL_INVALID_PARENT, // NetElement parent is invalid + ADDADDITIONAL_SUCCESS // additional was successfully created + }; + // =========================================================================== - // class additionalParameter + // class AdditionalAttributeSingle // =========================================================================== - class additionalParameter : public FXMatrix { + class AdditionalAttributeSingle : public FXHorizontalFrame { + /// @brief FOX-declaration + FXDECLARE(GNEAdditionalFrame::AdditionalAttributeSingle) public: /// @brief constructor - additionalParameter(FXComposite* parent, FXObject* tgt); + AdditionalAttributeSingle(FXComposite* parent); /// @brief destructor - ~additionalParameter(); + ~AdditionalAttributeSingle(); /// @brief show name and value of attribute of type string - void showParameter(SumoXMLAttr attr, std::string value); + void showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::string value); /// @brief show name and value of parameters of type int - void showParameter(SumoXMLAttr attr, int value); + void showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, int value); - /// @brief show name and value of parameters of type float/real - void showParameter(SumoXMLAttr attr, SUMOReal value); + /// @brief show name and value of parameters of type float/real/time + void showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, double value); /// @brief show name and value of parameters of type bool - void showParameter(SumoXMLAttr attr, bool value); + void showParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, bool value); /// @brief hide all parameters void hideParameter(); + /// @brief return tag + SumoXMLTag getTag() const; + /// @brief return Attr SumoXMLAttr getAttr() const; /// @brief return value - std::string getValue() const ; + std::string getValue() const; + + /// @brief returns a empty string if current value is valid, a string with information about invalid value in other case + const std::string& isAttributeValid() const; + + /// @name FOX-callbacks + /// @{ + /// @brief called when user set the value of an attribute of type int/float/string + long onCmdSetAttribute(FXObject*, FXSelector, void*); + + /// @brief called when user change the value of myBoolCheckButton + long onCmdSetBooleanAttribute(FXObject*, FXSelector, void*); + /// @} + + protected: + /// @brief FOX needs this + AdditionalAttributeSingle() {} private: - /// @brief XML attribute - SumoXMLAttr myAttr; + /// @brief current XML attribute + SumoXMLTag myAdditionalTag; + + /// @brief current XML attribute + SumoXMLAttr myAdditionalAttr; /// @brief lael with the name of the parameter FXLabel* myLabel; - /// @brief textField to modify the value of parameter - FXTextField* myTextField; + /// @brief textField to modify the default value of int/float/string parameters + FXTextField* myTextFieldInt; + + /// @brief textField to modify the default value of real/times parameters + FXTextField* myTextFieldReal; - /// @brief menuCheck to enable/disable the value of parameter - FXMenuCheck* myMenuCheck; + /// @brief textField to modify the default value of string parameters + FXTextField* myTextFieldStrings; + + /// @brief check button to enable/disable the value of boolean parameters + FXCheckButton* myBoolCheckButton; + + /// @brief string which indicates the reason due current value is invalid + std::string myInvalidValue; }; // =========================================================================== - // class additionalParameterList + // class AdditionalAttributeList // =========================================================================== - class additionalParameterList : public FXMatrix { + class AdditionalAttributeList : public FXVerticalFrame { /// @brief FOX-declaration - FXDECLARE(GNEAdditionalFrame::additionalParameterList) + FXDECLARE(GNEAdditionalFrame::AdditionalAttributeList) public: /// @brief constructor - additionalParameterList(FXComposite* parent, FXObject* tgt); + AdditionalAttributeList(FXComposite* parent); /// @brief destructor - ~additionalParameterList(); + ~AdditionalAttributeList(); /// @brief show name and value of parameters of type int - void showListParameter(SumoXMLAttr attr, std::vector value); + void showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector value); /// @brief show name and value of parameters of type float - void showListParameter(SumoXMLAttr attr, std::vector value); + void showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector value, bool isTime = false); /// @brief show name and value of parameters of type bool - void showListParameter(SumoXMLAttr attr, std::vector value); + void showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector value); /// @brief show name and value of parameters of type string - void showListParameter(SumoXMLAttr attr, std::vector value); + void showListParameter(SumoXMLTag additionalTag, SumoXMLAttr additionalAttr, std::vector value); /// @brief hide all parameters void hideParameter(); + /// @brief return tag of list + SumoXMLTag getTag() const; + /// @brief return attribute of list SumoXMLAttr getAttr() const; /// @brief return the value of list std::string getListValues(); + /// @brief check that current list is valid + bool isCurrentListValid() const; + /// @name FOX-callbacks /// @{ /// @brief add a new row int the list @@ -148,11 +193,17 @@ protected: /// @brief FOX needs this - additionalParameterList() {} + AdditionalAttributeList() {} private: - /// @brief XML attribute - SumoXMLAttr myAttr; + /// @brief current XML tag + SumoXMLTag myAdditionalTag; + + /// @brief current XML attribute + SumoXMLAttr myAdditionalAttr; + + /// @brief Vector with HorizontalFrames + std::vectormyHorizontalFrames; /// @brief vector with with the name of every parameter std::vector myLabels; @@ -160,39 +211,42 @@ /// @brief vector textField to modify the value of parameter std::vector myTextFields; + /// @brief horizontal frame for buttons + FXHorizontalFrame* myHorizontalFrameButtons; + /// @brief Button to increase the number of textFields - FXButton* add; + FXButton* myAddButton; /// @brief Button to decrease the number of textFields - FXButton* remove; + FXButton* myRemoveButton; /// @brief number of visible text fields - int numberOfVisibleTextfields; + int myNumberOfVisibleTextfields; /// @brief Number max of values in a parameter of type list int myMaxNumberOfValuesInParameterList; }; // =========================================================================== - // class additionalParameters + // class AdditionalAttributes // =========================================================================== - class additionalParameters : public FXGroupBox { + class AdditionalAttributes : public FXGroupBox { /// @brief FOX-declaration - FXDECLARE(GNEAdditionalFrame::additionalParameters) + FXDECLARE(GNEAdditionalFrame::AdditionalAttributes) public: /// @brief constructor - additionalParameters(FXComposite* parent, FXObject* tgt); + AdditionalAttributes(GNEViewNet* viewNet, FXComposite* parent); /// @brief destructor - ~additionalParameters(); + ~AdditionalAttributes(); /// @brief clear attributes void clearAttributes(); /// @brief add attribute - void addAttribute(SumoXMLTag additional, SumoXMLAttr attribute); + void addAttribute(SumoXMLTag additionalTag, SumoXMLAttr AdditionalAttributeSingle); /// @brief show group box void showAdditionalParameters(); @@ -200,8 +254,14 @@ /// @brief hide group box void hideAdditionalParameters(); - /// @brief get attributes - std::map getAttributes() const; + /// @brief get attributes and their values + std::map getAttributesAndValues() const; + + /// @brief check if parameters of attributes are valid + bool areValuesValid() const; + + /// @brief show warning message with information about non-valid attributes + void showWarningMessage(std::string extra = "") const; /// @brief get number of added attributes int getNumberOfAddedAttributes() const; @@ -214,20 +274,23 @@ protected: /// @brief FOX needs this - additionalParameters() {} + AdditionalAttributes() {} private: - /// @brief current additional - SumoXMLTag myAdditional; + /// @brief pointer to viewNet + GNEViewNet* myViewNet; + + /// @brief current additional tag + SumoXMLTag myAdditionalTag; /// @brief vector with the additional parameters - std::vector myVectorOfAdditionalParameter; + std::vector myVectorOfsingleAdditionalParameter; - /// @brief Index for myVectorOfAdditionalParameter + /// @brief Index for myVectorOfsingleAdditionalParameter int myIndexParameter; /// @brief vector with the additional parameters of type list - std::vector myVectorOfAdditionalParameterList; + std::vector myVectorOfsingleAdditionalParameterList; /// @brief index for myIndexParameterList int myIndexParameterList; @@ -243,26 +306,27 @@ }; // =========================================================================== - // class editorParameters + // class NeteditAttributes // =========================================================================== - class editorParameters : public FXGroupBox { + class NeteditAttributes : public FXGroupBox { /// @brief FOX-declaration - FXDECLARE(GNEAdditionalFrame::editorParameters) + FXDECLARE(GNEAdditionalFrame::NeteditAttributes) public: /// @brief list of the reference points enum additionalReferencePoint { GNE_ADDITIONALREFERENCEPOINT_LEFT, GNE_ADDITIONALREFERENCEPOINT_RIGHT, - GNE_ADDITIONALREFERENCEPOINT_CENTER + GNE_ADDITIONALREFERENCEPOINT_CENTER, + GNE_ADDITIONALREFERENCEPOINT_INVALID }; /// @brief constructor - editorParameters(FXComposite* parent, FXObject* tgt); + NeteditAttributes(FXComposite* parent); /// @brief destructor - ~editorParameters(); + ~NeteditAttributes(); /// @brief show length field void showLengthField(); @@ -279,8 +343,8 @@ /// @brief get actual reference point additionalReferencePoint getActualReferencePoint(); - /// @brief get value of lenght - SUMOReal getLenght(); + /// @brief get value of length + double getLength(); /// @brief check if block is enabled bool isBlockEnabled(); @@ -288,20 +352,30 @@ /// @brief check if force position is enabled bool isForcePositionEnabled(); + /// @brief check if current length is valid + bool isCurrentLengthValid() const; + /// @name FOX-callbacks /// @{ - /// @brief Called when the user enters another reference point + /// @brief Called when user enters a new length + long onCmdSetLength(FXObject*, FXSelector, void*); + + /// @brief Called when user enters another reference point long onCmdSelectReferencePoint(FXObject*, FXSelector, void*); - /*** @todo write callback for LENGTH **/ + /// @brief Called when user changes the checkbox "set blocking" + long onCmdSetBlocking(FXObject*, FXSelector, void*); - /// @brief Called when help button is pressed + /// @brief Called when user changes the checkbox "force position" + long onCmdSetForcePosition(FXObject*, FXSelector, void*); + + /// @brief Called when user press the help button long onCmdHelp(FXObject*, FXSelector, void*); /// @} protected: /// @brief FOX needs this - editorParameters() {} + NeteditAttributes() {} private: /// @brief match box with the list of reference points @@ -313,50 +387,56 @@ /// @brief actual additional reference point selected in the match Box additionalReferencePoint myActualAdditionalReferencePoint; - /// @brief Label for lenght + /// @brief Label for length FXLabel* myLengthLabel; - /// @brief textField for lenght + /// @brief textField for length FXTextField* myLengthTextField; + /// @brief Label for force position + FXLabel* myForcePositionLabel; + /// @brief checkBox for the option "force position" - FXMenuCheck* myCheckForcePosition; + FXCheckButton* myForcePositionCheckButton; + + /// @brief Label for block movement + FXLabel* myBlockLabel; + + /// @brief checkBox for block movement + FXCheckButton* myBlockMovementCheckButton; - /// @brief checkBox for blocking movement - FXMenuCheck* myCheckBlock; + /// @brief Flag to check if current length is valid + bool myCurrentLengthValid; }; // =========================================================================== - // class additionalSet + // class SelectorParentAdditional // =========================================================================== - class additionalSet : public FXGroupBox { + class SelectorParentAdditional : public FXGroupBox { /// @brief FOX-declaration - FXDECLARE(GNEAdditionalFrame::additionalSet) + FXDECLARE(GNEAdditionalFrame::SelectorParentAdditional) public: /// @brief constructor - additionalSet(FXComposite* parent, FXObject* tgt, GNEViewNet* viewNet); + SelectorParentAdditional(FXComposite* parent, GNEViewNet* viewNet); /// @brief destructor - ~additionalSet(); + ~SelectorParentAdditional(); /// @brief get if currently additional Set std::string getIdSelected() const; - /// @brief get current tag - SumoXMLTag getCurrentlyTag() const; + /// @brief Show list of SelectorParentAdditional + void showListOfAdditionals(SumoXMLTag type, bool uniqueSelection); - /// @brief Show list of additionalSet - void showList(SumoXMLTag type); - - /// @brief hide additionalSet - void hideList(); + /// @brief hide SelectorParentAdditional + void hideListOfAdditionals(); /// @name FOX-callbacks /// @{ - /// @brief called when user select an additionalSet of the list - long onCmdSelectAdditionalSet(FXObject*, FXSelector, void*); + /// @brief called when user select an SelectorParentAdditional of the list + long onCmdSelectAdditionalParent(FXObject*, FXSelector, void*); /// @brief Called when help button is pressed long onCmdHelp(FXObject*, FXSelector, void*); @@ -364,47 +444,48 @@ protected: /// @brief FOX needs this - additionalSet() {} + SelectorParentAdditional() {} private: - /// @brief current type - SumoXMLTag myType; /// @brief List of additional sets FXList* myList; - /// @brief Label with the name of Set + /// @brief Label with the name of additional FXLabel* mySetLabel; + /// @brief flag to check if only a single parent is allowed + bool myUniqueSelection; + /// @brief button for help - FXButton* helpAdditionalSet; + FXButton* myHelpAdditionalParentSelector; /// @brief viewNet associated to GNEAdditionalFrame GNEViewNet* myViewNet; }; // =========================================================================== - // class edgesSelector + // class SelectorParentEdges // =========================================================================== - class edgesSelector : public FXGroupBox { + class SelectorParentEdges : public FXGroupBox { /// @brief FOX-declaration - FXDECLARE(GNEAdditionalFrame::edgesSelector) + FXDECLARE(GNEAdditionalFrame::SelectorParentEdges) public: /// @brief constructor - edgesSelector(FXComposite* parent, GNEViewNet* viewNet); + SelectorParentEdges(FXComposite* parent, GNEViewNet* viewNet); /// @brief destructor - ~edgesSelector(); + ~SelectorParentEdges(); /// @brief get list of selecte id's in string format std::string getIdsSelected() const; - /// @brief Show list of edgesSelector + /// @brief Show list of SelectorParentEdges void showList(std::string search = ""); - /// @brief hide edgesSelector + /// @brief hide SelectorParentEdges void hideList(); /// @brief Update use selectedEdges @@ -436,53 +517,53 @@ protected: /// @brief FOX needs this - edgesSelector() {} + SelectorParentEdges() {} private: /// @brief CheckBox for selected edges - FXMenuCheck* myUseSelectedEdges; + FXCheckButton* myUseSelectedEdgesCheckButton; - /// @brief List of edgesSelector + /// @brief List of SelectorParentEdges FXList* myList; /// @brief text field for search edge IDs FXTextField* myEdgesSearch; /// @brief button for help - FXButton* helpEdges; + FXButton* myHelpedgeParentsSelector; /// @brief button for clear selection - FXButton* clearEdgesSelection; + FXButton* myClearEdgesSelection; /// @brief button for invert selection - FXButton* invertEdgesSelection; + FXButton* myInvertEdgesSelection; /// @brief viewNet associated to GNEAdditionalFrame GNEViewNet* myViewNet; }; // =========================================================================== - // class lanesSelector + // class SelectorParentLanes // =========================================================================== - class lanesSelector : public FXGroupBox { + class SelectorParentLanes : public FXGroupBox { /// @brief FOX-declaration - FXDECLARE(GNEAdditionalFrame::lanesSelector) + FXDECLARE(GNEAdditionalFrame::SelectorParentLanes) public: /// @brief constructor - lanesSelector(FXComposite* parent, GNEViewNet* viewNet); + SelectorParentLanes(FXComposite* parent, GNEViewNet* viewNet); /// @brief destructor - ~lanesSelector(); + ~SelectorParentLanes(); /// @brief get list of selecte id's in string format std::string getIdsSelected() const; - /// @brief Show list of lanesSelector + /// @brief Show list of SelectorParentLanes void showList(std::string search = ""); - /// @brief hide lanesSelector + /// @brief hide SelectorParentLanes void hideList(); // @brief Update use selectedLanes @@ -514,13 +595,13 @@ protected: /// @brief FOX needs this - lanesSelector() {} + SelectorParentLanes() {} private: /// @brief CheckBox for selected lanes - FXMenuCheck* myUseSelectedLanes; + FXCheckButton* myUseSelectedLanesCheckButton; - /// @brief List of lanesSelector + /// @brief List of SelectorParentLanes FXList* myList; /// @brief text field for search lane IDs @@ -540,10 +621,10 @@ }; /**@brief Constructor - * @brief parent FXFrame in which this GNEFrame is placed + * @brief parent FXHorizontalFrame in which this GNEFrame is placed * @brief viewNet viewNet that uses this GNEFrame */ - GNEAdditionalFrame(FXComposite* parent, GNEViewNet* viewNet); + GNEAdditionalFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet); /// @brief Destructor ~GNEAdditionalFrame(); @@ -551,9 +632,9 @@ /**@brief add additional element * @param[in] netElement clicked netElement. if user dind't clicked over a GNENetElement in view, netElement will be NULL * @param[in] parent AbstractView to obtain the position of the mouse over the lane. - * @return true if an additional (GNEAdditional or GNEAdditionalSet) was added, false in other case + * @return AddAdditionalStatus with the result of operation */ - bool addAdditional(GNENetElement* netElement, GUISUMOAbstractView* parent); + AddAdditionalResult addAdditional(GNENetElement* netElement, GUISUMOAbstractView* parent); /**@brief remove an additional element previously added * @param[in] additional element to erase @@ -566,12 +647,9 @@ long onCmdSelectAdditional(FXObject*, FXSelector, void*); /// @} - /// @brief show additional frame + /// @brief show additional frame and update use selected edges/lanes void show(); - /// @brief hidde additional frame - void hide(); - /// @brief get list of selecte id's in string format static std::string getIdsSelected(const FXList* list); @@ -587,10 +665,10 @@ std::string generateID(GNENetElement* netElement) const; /// @brief obtain the Start position values of StoppingPlaces and E2 detector over the lane - SUMOReal setStartPosition(SUMOReal positionOfTheMouseOverLane, SUMOReal lenghtOfAdditional); + double setStartPosition(double positionOfTheMouseOverLane, double lengthOfAdditional); /// @brief obtain the End position values of StoppingPlaces and E2 detector over the lane - SUMOReal setEndPosition(SUMOReal laneLenght, SUMOReal positionOfTheMouseOverLane, SUMOReal lenghtOfAdditional); + double setEndPosition(double laneLength, double positionOfTheMouseOverLane, double lengthOfAdditional); /// @brief groupBox for Match Box of additionals FXGroupBox* myGroupBoxForMyAdditionalMatchBox; @@ -598,20 +676,20 @@ /// @brief combo box with the list of additional elements FXComboBox* myAdditionalMatchBox; - /// @brief additional default parameters - GNEAdditionalFrame::additionalParameters* myAdditionalParameters; + /// @brief additional internal attributes + GNEAdditionalFrame::AdditionalAttributes* myadditionalParameters; - /// @brief editor parameter - GNEAdditionalFrame::editorParameters* myEditorParameters; + /// @brief Netedit parameter + GNEAdditionalFrame::NeteditAttributes* myEditorParameters; /// @brief list of additional Set - GNEAdditionalFrame::additionalSet* myAdditionalSet; + GNEAdditionalFrame::SelectorParentAdditional* myAdditionalParentSelector; - /// @brief list of edgesSelector - GNEAdditionalFrame::edgesSelector* myEdgesSelector; + /// @brief list of SelectorParentEdges + GNEAdditionalFrame::SelectorParentEdges* myedgeParentsSelector; - /// @brief list of lanesSelector - GNEAdditionalFrame::lanesSelector* myLanesSelector; + /// @brief list of SelectorParentLanes + GNEAdditionalFrame::SelectorParentLanes* mylaneParentsSelector; /// @brief actual additional type selected in the match Box SumoXMLTag myActualAdditionalType; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditional.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditional.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditional.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditional.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEAdditional.h /// @author Pablo Alvarez Lopez /// @date Jan 2016 -/// @version $Id: GNEAdditional.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEAdditional.h 23150 2017-02-27 12:08:30Z behrisch $ /// /// A abstract class for representation of additional elements /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,7 +48,6 @@ class GNELane; class GNENet; class GNEViewNet; -class GNEAdditionalSet; class GNEAdditionalDialog; // =========================================================================== @@ -67,17 +66,16 @@ * @param[in] viewNet pointer to GNEViewNet of this additional element belongs * @param[in] pos position of view in which additional is located * @param[in] tag Type of xml tag that define the additional element (SUMO_TAG_BUS_STOP, SUMO_TAG_REROUTER, etc...) - * @param[in] additionalSetParent pointer to parent, if this additional belongs to an additionalSet - * @param[in] blocked enable or disable blocking. By default additional element isn't blocked (i.e. value is false) + * @param[in] icon GUIIcon associated to the additional */ - GNEAdditional(const std::string& id, GNEViewNet* viewNet, Position pos, SumoXMLTag tag, GNEAdditionalSet* additionalSetParent = NULL, bool blocked = false); + GNEAdditional(const std::string& id, GNEViewNet* viewNet, Position pos, SumoXMLTag tag, GUIIcon icon); /// @brief Destructor ~GNEAdditional(); /**@brief change the position of the additional geometry * @param[in] offset offset of movement - * @note simply call the function moveAdditionalGeometry(SUMOReal offsetx, SUMOReal offsety) + * @note simply call the function moveAdditionalGeometry(double offsetx, double offsety) */ void moveAdditionalGeometry(const Position& offset); @@ -87,12 +85,12 @@ * @note if additional belongs to a Lane, offsety is ignored * @note must be implemented in ALL childrens */ - virtual void moveAdditionalGeometry(SUMOReal offsetx, SUMOReal offsety) = 0; + virtual void moveAdditionalGeometry(double offsetx, double offsety) = 0; /**@brief updated geometry changes in the attributes of additional * @param[in] oldPos old position X of additional * @param[in] undoList The undoList on which to register changes - * @note simply call function commmitAdditionalGeometryMoved(SUMOReal oldPosx, SUMOReal oldPosy, GNEUndoList* undoList) + * @note simply call function commmitAdditionalGeometryMoved(double oldPosx, double oldPosy, GNEUndoList* undoList) */ void commmitAdditionalGeometryMoved(const Position& oldPos, GNEUndoList* undoList); @@ -103,7 +101,7 @@ * @note if additional belongs to a Lane, oldPosy is ignored * @note must be implemented in ALL childrens */ - virtual void commmitAdditionalGeometryMoved(SUMOReal oldPosx, SUMOReal oldPosy, GNEUndoList* undoList) = 0; + virtual void commmitAdditionalGeometryMoved(double oldPosx, double oldPosy, GNEUndoList* undoList) = 0; /// @brief update pre-computed geometry information /// @note: must be called when geometry changes (i.e. lane moved) and implemented in ALL childrens @@ -113,7 +111,7 @@ virtual Position getPositionInView() const = 0; /// @brief open Additional Dialog - /// @note: if additional needs an additional dialog, this function has to be implemented in childrens (see GNERerouter and GNEVariableSpeedSignal) + /// @note: if additional needs an additional dialog, this function has to be implemented in childrens (see GNERerouter and GNEVariableSpeedSign) virtual void openAdditionalDialog(); /// @brief returns the ID of additional @@ -140,9 +138,6 @@ // @brief Check if additional item is selected bool isAdditionalSelected() const; - /// @brief get additionalSet parent, or NULL if don't belongs to an additionalSet - GNEAdditionalSet* getAdditionalSetParent() const; - /// @brief set the ID of additional void setAdditionalID(const std::string& id); @@ -150,10 +145,11 @@ /// @note movement cannot be undo with GNEUndoRedo void setPositionInView(const Position& pos); - /// @brief writte additional element into a xml file - /// @param[in] device device in which write parameters of additional element - /// @note must be implemented in all childrens - virtual void writeAdditional(OutputDevice& device, const std::string& currentDirectory) = 0; + /**@brief writte additional element into a xml file + * @param[in] device device in which write parameters of additional element + * @note must be implemented in all derived classes + */ + virtual void writeAdditional(OutputDevice& device) const = 0; /// @brief get edge of additional, or NULL if additional isn't placed over an edge GNEEdge* getEdge() const; @@ -163,8 +159,7 @@ /// @name inherited from GUIGlObject /// @{ - /// @brief Returns the name of the parent object - /// @return This object's parent id + /// @brief Returns the name (ID) of the parent object virtual const std::string& getParentName() const = 0; /**@brief Returns an own popup-menu @@ -238,32 +233,33 @@ /// @brief The GNEViewNet this additional element belongs GNEViewNet* myViewNet; - /// @brief The edge this additional belongs - /// @bote NULL if additional doesnt' belongs to a edge + /**@brief The edge this additional belongs. + * @note is NULL if additional doesnt' belongs to a edge + */ GNEEdge* myEdge; - /// @brief The lane this additional belongs - /// @bote NULL if additional doesnt' belongs to a lane + /**@brief The lane this additional belongs. + * @note is NULL if additional doesnt' belongs to a lane + */ GNELane* myLane; - /// @brief The position in which this additional element is located - /// @note if this element belongs to a Lane, x() value will be the position over Lane + /**@brief The position in which this additional element is located + * @note if this element belongs to a Lane, x() value will be the position over Lane + */ Position myPosition; - /// @brief The shape of the additional element - /// @note must be configured in updateGeometry() + /**@brief The shape of the additional element + * @note must be configured in updateGeometry() + */ PositionVector myShape; - /// @brief pointer to additional set parent, if belong to set - GNEAdditionalSet* myAdditionalSetParent; - /// @name computed only once (for performance) in updateGeometry() /// @{ /// The rotations of the shape parts - std::vector myShapeRotations; + std::vector myShapeRotations; /// The lengths of the shape parts - std::vector myShapeLengths; + std::vector myShapeLengths; /// @} /// @brief rotation depending of the option "Lefthand" @@ -271,12 +267,16 @@ /// @name members and functions relative to block icon /// @{ - /// @brief set Rotation of block Icon - /// @note must be called in updateGeometry() after setting of Shape, and use parameter "lane" if additional is placed over a lane + /**@brief set Rotation of block Icon + * @note must be called in updateGeometry() after setting of Shape, and use parameter "lane" if additional is placed over a lane + */ void setBlockIconRotation(GNELane* lane = NULL); /// @brief draw lock icon - void drawLockIcon(SUMOReal size = 0.5) const; + void drawLockIcon(double size = 0.5) const; + + /// @brief draw connections between Parent and childrens + void drawParentAndChildrenConnections() const; /// @brief position of the block icon Position myBlockIconPosition; @@ -285,7 +285,7 @@ Position myBlockIconOffset; /// @brief The rotation of the block icon - SUMOReal myBlockIconRotation; + double myBlockIconRotation; /// @} /// @brief boolean to check if additional element is blocked (i.e. cannot be moved with mouse) @@ -300,17 +300,22 @@ /// @brief boolean to check if additional element is movable (with the mouse). By default true bool myMovable; - /// @brief base color (Default green) - /// @note default color can be defined in the constructor of every additional + /**@brief base color (Default green) + * @note default color can be defined in the constructor of every additional + */ RGBColor myBaseColor; - /// @brief base color selected (Default blue) - /// @note default color can be defined in the constructor of every additional + /**@brief base color selected (Default blue) + * @note default color can be defined in the constructor of every additional + */ RGBColor myBaseColorSelected; /// @brief pointer to additional dialog GNEAdditionalDialog* myAdditionalDialog; + /// @brief Matrix with the Vertex's positions of connections between Additional Parent an their childs + std::vector > myConnectionPositions; + private: /// @brief set attribute after validation virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditionalHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditionalHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditionalHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditionalHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEAdditionalHandler /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEAdditionalHandler.cpp 21824 2016-10-27 13:03:52Z behrisch $ +/// @version $Id: GNEAdditionalHandler.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// -/// Builds trigger objects for netEdit +/// Builds trigger objects for netedit /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -30,27 +30,30 @@ #include #include "GNEAdditionalHandler.h" -#include "GNEUndoList.h" -#include "GNEEdge.h" -#include "GNELane.h" -#include "GNEJunction.h" -#include "GNENet.h" -#include "GNEViewNet.h" -#include "GNEChange_Additional.h" #include "GNEBusStop.h" +#include "GNEChange_Additional.h" #include "GNEChargingStation.h" +#include "GNEClosingLaneReroute.h" +#include "GNEClosingReroute.h" +#include "GNEContainerStop.h" +#include "GNEDestProbReroute.h" #include "GNEDetectorE1.h" #include "GNEDetectorE2.h" #include "GNEDetectorE3.h" #include "GNEDetectorEntry.h" #include "GNEDetectorExit.h" +#include "GNEEdge.h" +#include "GNEJunction.h" +#include "GNELane.h" +#include "GNENet.h" +#include "GNERerouter.h" +#include "GNERerouterInterval.h" +#include "GNERouteProbReroute.h" #include "GNERouteProbe.h" -#include "GNEContainerStop.h" +#include "GNEUndoList.h" #include "GNEVaporizer.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif +#include "GNEViewNet.h" +#include "GNECalibrator.h" // =========================================================================== @@ -60,7 +63,11 @@ GNEAdditionalHandler::GNEAdditionalHandler(const std::string& file, GNEViewNet* viewNet) : SUMOSAXHandler(file), myViewNet(viewNet), - rerouterIntervalToInsertValues(NULL) { + myE3Parent(NULL), + myCalibratorParent(NULL), + myVariableSpeedSignParent(NULL), + rerouterIntervalToInsertValues(NULL), + myLastTag(SUMO_TAG_NOTHING) { } @@ -71,104 +78,150 @@ GNEAdditionalHandler::myStartElement(int element, const SUMOSAXAttributes& attrs) { // Obtain tag of element SumoXMLTag tag = static_cast(element); - // Call parse and build depending of tag - switch (element) { - case SUMO_TAG_BUS_STOP: - parseAndBuildBusStop(attrs, tag); - break; - case SUMO_TAG_CONTAINER_STOP: - parseAndBuildContainerStop(attrs, tag); - break; - case SUMO_TAG_CHARGING_STATION: - parseAndBuildChargingStation(attrs, tag); - break; - case SUMO_TAG_E1DETECTOR: - case SUMO_TAG_INDUCTION_LOOP: - parseAndBuildDetectorE1(attrs, tag); - break; - case SUMO_TAG_E2DETECTOR: - case SUMO_TAG_LANE_AREA_DETECTOR: - parseAndBuildDetectorE2(attrs, tag); - break; - case SUMO_TAG_E3DETECTOR: - case SUMO_TAG_ENTRY_EXIT_DETECTOR: - parseAndBuildDetectorE3(attrs, tag); - break; - case SUMO_TAG_DET_ENTRY: - parseAndBuildDetectorEntry(attrs, tag); - break; - case SUMO_TAG_DET_EXIT: - parseAndBuildDetectorExit(attrs, tag); - break; - case SUMO_TAG_VSS: - parseAndBuildVariableSpeedSignal(attrs, tag); - break; - case SUMO_TAG_REROUTER: - parseAndBuildRerouter(attrs, tag); - break; - case SUMO_TAG_CALIBRATOR: - parseAndBuildCalibrator(attrs, tag); - break; - case SUMO_TAG_VAPORIZER: - parseAndBuildVaporizer(attrs, tag); - break; - case SUMO_TAG_ROUTEPROBE: - parseAndBuildRouteProbe(attrs, tag); - break; - case SUMO_TAG_FLOW: - parseCalibratorFlow(attrs, tag); - break; - case SUMO_TAG_STEP: - parseVariableSpeedSignalStep(attrs, tag); - break; - default: - break; + // first chek additional parent tag + if (checkAdditionalParent(tag)) { + // Call parse and build depending of tag + switch (element) { + case SUMO_TAG_BUS_STOP: + parseAndBuildBusStop(attrs, tag); + // disable other additional parents + myCalibratorParent = NULL; + myE3Parent = NULL; + myVariableSpeedSignParent = NULL; + break; + case SUMO_TAG_CONTAINER_STOP: + parseAndBuildContainerStop(attrs, tag); + // disable other additional parents + myCalibratorParent = NULL; + myE3Parent = NULL; + myVariableSpeedSignParent = NULL; + break; + case SUMO_TAG_CHARGING_STATION: + parseAndBuildChargingStation(attrs, tag); + // disable other additional parents + myCalibratorParent = NULL; + myE3Parent = NULL; + break; + case SUMO_TAG_E1DETECTOR: + case SUMO_TAG_INDUCTION_LOOP: + parseAndBuildDetectorE1(attrs, tag); + // disable other additional parents + myCalibratorParent = NULL; + myE3Parent = NULL; + myVariableSpeedSignParent = NULL; + break; + case SUMO_TAG_E2DETECTOR: + case SUMO_TAG_LANE_AREA_DETECTOR: + parseAndBuildDetectorE2(attrs, tag); + // disable other additional parents + myCalibratorParent = NULL; + myE3Parent = NULL; + myVariableSpeedSignParent = NULL; + break; + case SUMO_TAG_E3DETECTOR: + case SUMO_TAG_ENTRY_EXIT_DETECTOR: + parseAndBuildDetectorE3(attrs, tag); + // disable other additional parents + myCalibratorParent = NULL; + myVariableSpeedSignParent = NULL; + break; + case SUMO_TAG_DET_ENTRY: + parseAndBuildDetectorEntry(attrs, tag); + // disable other additional parents + myCalibratorParent = NULL; + myVariableSpeedSignParent = NULL; + break; + case SUMO_TAG_DET_EXIT: + parseAndBuildDetectorExit(attrs, tag); + // disable other additional parents + myCalibratorParent = NULL; + break; + case SUMO_TAG_VSS: + parseAndBuildVariableSpeedSign(attrs, tag); + // disable other additional parents + myCalibratorParent = NULL; + myE3Parent = NULL; + break; + case SUMO_TAG_REROUTER: + parseAndBuildRerouter(attrs, tag); + // disable other additional parents + myCalibratorParent = NULL; + myE3Parent = NULL; + myVariableSpeedSignParent = NULL; + break; + case SUMO_TAG_CALIBRATOR: + parseAndBuildCalibrator(attrs, tag); + // disable other additional parents + myE3Parent = NULL; + myVariableSpeedSignParent = NULL; + break; + case SUMO_TAG_VAPORIZER: + parseAndBuildVaporizer(attrs, tag); + // disable other additional parents + myCalibratorParent = NULL; + myE3Parent = NULL; + myVariableSpeedSignParent = NULL; + break; + case SUMO_TAG_ROUTEPROBE: + parseAndBuildRouteProbe(attrs, tag); + // disable other additional parents + myCalibratorParent = NULL; + myE3Parent = NULL; + myVariableSpeedSignParent = NULL; + break; + case SUMO_TAG_VTYPE: + parseCalibratorVehicleType(attrs, tag); + // disable other additional parents + myCalibratorParent = NULL; + myVariableSpeedSignParent = NULL; + break; + case SUMO_TAG_ROUTE: + parseCalibratorRoute(attrs, tag); + // disable other additional parents + myCalibratorParent = NULL; + // disable other additional parents + myE3Parent = NULL; + myVariableSpeedSignParent = NULL; + break; + case SUMO_TAG_FLOW: + parseCalibratorFlow(attrs, tag); + // disable other additional parents + myE3Parent = NULL; + myVariableSpeedSignParent = NULL; + break; + case SUMO_TAG_STEP: + parseVariableSpeedSignStep(attrs, tag); + // disable other additional parents + myCalibratorParent = NULL; + myE3Parent = NULL; + break; + default: + break; + } } } void GNEAdditionalHandler::parseAndBuildVaporizer(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { - bool ok = true; bool abort = false; - // get ID of additional - const std::string id = attrs.get(SUMO_ATTR_ID, 0, ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_ID) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get edge ID - const std::string edgeId = attrs.get(SUMO_ATTR_EDGE, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_EDGE) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get start Time - const SUMOReal startTime = attrs.get(SUMO_ATTR_STARTTIME, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_STARTTIME) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get end Time - const SUMOReal endTime = attrs.get(SUMO_ATTR_END, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_END) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } + // parse attributes of Vaporizer + const std::string edgeId = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_EDGE, abort); + double startTime = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_STARTTIME, abort); + double endTime = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_END, abort); // Continue if all parameters were successfully loaded if (!abort) { // get edge GNEEdge* edge = myViewNet->getNet()->retrieveEdge(edgeId, false); if (edge == NULL) { // Write error if lane isn't valid - WRITE_WARNING("The edge '" + edgeId + "' to use within the " + toString(tag) + " '" + id + "' is not known."); + WRITE_WARNING("The edge '" + edgeId + "' to use within the " + toString(tag) + " is not known."); + } else if (startTime > endTime) { + // write error if time interval ins't valid + WRITE_WARNING("Time interval of " + toString(tag) + " isn't valid. Attribute '" + toString(SUMO_ATTR_STARTTIME) + "' is greater than attribute '" + toString(SUMO_ATTR_END) + "'."); } else { // build Vaporizer - buildVaporizer(myViewNet, id, edge, startTime, endTime, false); + buildVaporizer(myViewNet, edge, startTime, endTime); } } } @@ -177,38 +230,13 @@ void GNEAdditionalHandler::parseAndBuildRouteProbe(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { - bool ok = true; bool abort = false; - // get ID of additional - const std::string id = attrs.get(SUMO_ATTR_ID, 0, ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_ID) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get edge ID - const std::string edgeId = attrs.get(SUMO_ATTR_EDGE, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_EDGE) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get frequency - const int freq = attrs.get(SUMO_ATTR_FREQUENCY, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_FREQUENCY) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get File - const std::string file = attrs.get(SUMO_ATTR_FILE, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_FILE) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // Get optionals attributes - const int begin = attrs.getOpt(SUMO_ATTR_BEGIN, id.c_str(), ok, false); + // parse attributes of RouteProbe + std::string id = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ID, abort); + std::string edgeId = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_EDGE, abort); + double freq = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_FREQUENCY, abort); + std::string file = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_FILE, abort); + double begin = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_BEGIN, abort); // Continue if all parameters were sucesfully loaded if (!abort) { // get edge @@ -218,145 +246,208 @@ WRITE_WARNING("The edge '" + edgeId + "' to use within the " + toString(tag) + " '" + id + "' is not known."); } else { // build Vaporizer - buildRouteProbe(myViewNet, id, edge, freq, file, begin, false); + buildRouteProbe(myViewNet, id, edge, freq, file, begin); } } } void -GNEAdditionalHandler::parseCalibratorFlow(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { - // Declare calibrator to keep flow - GNECalibrator::CalibratorFlow flow; - bool ok = true; +GNEAdditionalHandler::parseCalibratorRoute(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { bool abort = false; - // Load non empty values - std::string flowId = attrs.get(SUMO_ATTR_ID, 0, ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_ID) + "' of " + toString(tag) + "'s " + toString(SUMO_TAG_CALIBRATOR) + " is missing"); - ok = true; - abort = true; - } - flow.type = attrs.get(SUMO_ATTR_TYPE, flowId.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_TYPE) + "' of " + toString(tag) + "'s " + toString(SUMO_TAG_CALIBRATOR) + " is missing"); - ok = true; - abort = true; - } - flow.route = attrs.get(SUMO_ATTR_ROUTE, flowId.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_ROUTE) + "' of " + toString(tag) + "'s " + toString(SUMO_TAG_CALIBRATOR) + " is missing"); - ok = true; - abort = true; - } - // Load rest of parameters - flow.color = attrs.getOpt(SUMO_ATTR_COLOR, flowId.c_str(), ok, "", false); - flow.departLane = attrs.getOpt(SUMO_ATTR_DEPARTLANE, flowId.c_str(), ok, "first", false); - flow.departPos = attrs.getOpt(SUMO_ATTR_DEPARTPOS, flowId.c_str(), ok, "base", false); - flow.departSpeed = attrs.getOpt(SUMO_ATTR_DEPARTSPEED, flowId.c_str(), ok, "0", false); - flow.arrivalLane = attrs.getOpt(SUMO_ATTR_ARRIVALLANE, flowId.c_str(), ok, "current", false); - flow.arrivalPos = attrs.getOpt(SUMO_ATTR_ARRIVALPOS, flowId.c_str(), ok, "max", false); - flow.arrivalSpeed = attrs.getOpt(SUMO_ATTR_ARRIVALSPEED, flowId.c_str(), ok, "current", false); - flow.line = attrs.getOpt(SUMO_ATTR_LINE, flowId.c_str(), ok, "", false); - flow.personNumber = attrs.getOpt(SUMO_ATTR_PERSON_NUMBER, flowId.c_str(), ok, 0, false); - flow.containerNumber = attrs.getOpt(SUMO_ATTR_CONTAINER_NUMBER, flowId.c_str(), ok, 0, false); - flow.begin = attrs.getOpt(SUMO_ATTR_BEGIN, flowId.c_str(), ok, 0, false); - flow.end = attrs.getOpt(SUMO_ATTR_END, flowId.c_str(), ok, 0, false); - flow.vehsPerHour = attrs.getOpt(SUMO_ATTR_VEHSPERHOUR, flowId.c_str(), ok, 0, false); - flow.period = attrs.getOpt(SUMO_ATTR_PERIOD, flowId.c_str(), ok, 0, false); - flow.probability = attrs.getOpt(SUMO_ATTR_PROB, flowId.c_str(), ok, 0, false); - flow.number = attrs.getOpt(SUMO_ATTR_NUMBER, flowId.c_str(), ok, 0, false); + // parse attribute of calibrator routes + std::string routeID = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ID, abort); + std::vector edgeIDs = getParsedAttribute >(attrs, 0, tag, SUMO_ATTR_EDGES, abort); + std::string color = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_COLOR, abort); + // Continue if all parameters were sucesfully loaded if (!abort) { - // Obtain calibrator - GNECalibrator* calibratorToInsertFlow = dynamic_cast(myViewNet->getNet()->getAdditional(SUMO_TAG_CALIBRATOR, myAdditionalSetParent)); - if (calibratorToInsertFlow == NULL) { - WRITE_WARNING("A " + toString(SUMO_TAG_CALIBRATOR) + " must be inserter before insertion of the " + toString(tag) + " '" + flowId + "'"); - } else { - calibratorToInsertFlow->insertFlow(flowId, flow); + // check if already exist a route with the same ID + if (myViewNet->getNet()->routeExists(routeID)) { + WRITE_WARNING(toString(SUMO_TAG_ROUTE) + " with ID = '" + routeID + "' cannot be created; Another " + + toString(SUMO_TAG_ROUTE) + " with the same ID was previously declared"); + abort = true; + } + // declare vector with pointers to GNEEdges + std::vector edges; + for (std::vector::const_iterator i = edgeIDs.begin(); (i != edgeIDs.end()) && (abort == false); i++) { + GNEEdge* retrievedEdge = myViewNet->getNet()->retrieveEdge((*i), false); + // stop + if (retrievedEdge != NULL) { + edges.push_back(retrievedEdge); + } else { + WRITE_WARNING(toString(SUMO_TAG_ROUTE) + " with ID = '" + routeID + "' cannot be created; " + + toString(SUMO_TAG_EDGE) + " with id '" + (*i) + "' doesn't exist in net"); + } + } + // create vehicle type if calibrator parent is currently defined + if ((myCalibratorParent != NULL) && (abort == false)) { + // create vehicle type and add it to calibrator parent + GNECalibratorRoute route(myCalibratorParent, routeID, edges, color); + myCalibratorParent->addCalibratorRoute(route); } } } void -GNEAdditionalHandler::parseVariableSpeedSignalStep(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { - bool ok = true; +GNEAdditionalHandler::parseCalibratorVehicleType(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { bool abort = false; - // Load step values - SUMOTime time = attrs.get(SUMO_ATTR_TIME, 0, ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_TIME) + "' of " + toString(tag) + "'s " + toString(SUMO_TAG_VSS) + " is missing"); - ok = true; - abort = true; - } - SUMOReal speed = attrs.get(SUMO_ATTR_SPEED, 0, ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_SPEED) + "' of " + toString(tag) + "'s " + toString(SUMO_TAG_VSS) + " is missing"); - ok = true; - abort = true; - } + + // parse attribute of calibrator vehicle types + std::string vehicleTypeID = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ID, abort); + double accel = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ACCEL, abort); + double decel = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_DECEL, abort); + double sigma = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_SIGMA, abort); + double tau = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_TAU, abort); + double length = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_LENGTH, abort); + double minGap = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_MINGAP, abort); + double maxSpeed = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_MAXSPEED, abort); + double speedFactor = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_SPEEDFACTOR, abort); + double speedDev = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_SPEEDDEV, abort); + std::string color = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_COLOR, abort); + SUMOVehicleClass vClass = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_VCLASS, abort); + std::string emissionClass = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_EMISSIONCLASS, abort); + SUMOVehicleShape shape = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_GUISHAPE, abort); + double width = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_WIDTH, abort); + std::string filename = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_IMGFILE, abort); + double impatience = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_IMPATIENCE, abort); + std::string laneChangeModel = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_LANE_CHANGE_MODEL, abort); + std::string carFollowModel = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_CAR_FOLLOW_MODEL, abort); + int personCapacity = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_PERSON_CAPACITY, abort); + int containerCapacity = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_CONTAINER_CAPACITY, abort); + double boardingDuration = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_BOARDING_DURATION, abort); + double loadingDuration = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_LOADING_DURATION, abort); + std::string latAlignment = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_LATALIGNMENT, abort); + double minGapLat = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_MINGAP_LAT, abort); + double maxSpeedLat = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_MAXSPEED_LAT, abort); + // Continue if all parameters were sucesfully loaded if (!abort) { - GNEVariableSpeedSignal* variableSpeedSignalToInsertStep = dynamic_cast(myViewNet->getNet()->getAdditional(SUMO_TAG_VSS, myAdditionalSetParent)); - if (variableSpeedSignalToInsertStep == NULL) { - WRITE_WARNING("A " + toString(SUMO_TAG_VSS) + " must be inserter before insertion of a " + toString(tag)); - } else if (!variableSpeedSignalToInsertStep->insertStep(time, speed)) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_TIME) + "' of " + toString(tag) + "'s " + toString(SUMO_TAG_VSS) + " is duplicated"); + // check if already exist a vehicleType with the same ID + if (myViewNet->getNet()->vehicleTypeExists(vehicleTypeID)) { + WRITE_WARNING(toString(SUMO_TAG_VTYPE) + " with ID = '" + vehicleTypeID + "' cannot be created; Another " + toString(SUMO_TAG_VTYPE) + " with the same ID was previously declared"); + } else if (myCalibratorParent != NULL) { + // create vehicle type and add it to calibrator parent + GNECalibratorVehicleType vehicleType(myCalibratorParent, vehicleTypeID, accel, decel, sigma, tau, length, minGap, maxSpeed, + speedFactor, speedDev, color, vClass, emissionClass, shape, width, filename, impatience, + laneChangeModel, carFollowModel, personCapacity, containerCapacity, boardingDuration, + loadingDuration, latAlignment, minGapLat, maxSpeedLat); + myCalibratorParent->addCalibratorVehicleType(vehicleType); } } } void -GNEAdditionalHandler::parseAndBuildVariableSpeedSignal(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { - bool ok = true; +GNEAdditionalHandler::parseCalibratorFlow(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { bool abort = false; - // get ID of additional - const std::string id = attrs.get(SUMO_ATTR_ID, 0, ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_ID) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; + + // parse attributes of calibrator flows + std::string flowID = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ID, abort); + std::string vehicleType = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_TYPE, abort); + std::string route = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ROUTE, abort); + std::string color = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_COLOR, abort); + std::string departLane = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_DEPARTLANE, abort); + std::string departPos = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_DEPARTPOS, abort); + std::string departSpeed = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_DEPARTSPEED, abort); + std::string arrivalLane = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ARRIVALLANE, abort); + std::string arrivalPos = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ARRIVALPOS, abort); + std::string arrivalSpeed = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ARRIVALSPEED, abort); + std::string line = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_LINE, abort); + int personNumber = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_PERSON_NUMBER, abort); + int containerNumber = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_CONTAINER_NUMBER, abort); + bool reroute = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_REROUTE, abort); + std::string departPosLat = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_DEPARTPOS_LAT, abort); + std::string arrivalPosLat = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ARRIVALPOS_LAT, abort); + double begin = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_BEGIN, abort); + double end = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_END, abort); + double vehsPerHour = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_VEHSPERHOUR, abort); + double period = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_PERIOD, abort); + double probability = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_PROB, abort); + int number = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_NUMBER, abort); + + // Continue if all parameters were sucesfully loaded + if (!abort) { + // check if flowID, route and vehicle type already exists + if (myViewNet->getNet()->flowExists(flowID) == false) { + WRITE_WARNING(toString(SUMO_TAG_FLOW) + " with ID = '" + flowID + "' cannot be created; Another " + toString(SUMO_TAG_FLOW) + " with the same ID was previously declared"); + abort = true; + } else if (myViewNet->getNet()->routeExists(route) == false) { + WRITE_WARNING(toString(SUMO_TAG_FLOW) + " with ID = '" + flowID + "' cannot be created; their " + toString(SUMO_TAG_ROUTE) + " with ID = '" + route + "' doesn't exist"); + abort = true; + } else if (myViewNet->getNet()->vehicleTypeExists(vehicleType) == false) { + WRITE_WARNING(toString(SUMO_TAG_FLOW) + " with ID = '" + flowID + "' cannot be created; their " + toString(SUMO_TAG_VTYPE) + " with ID = '" + vehicleType + "' doesn't exist"); + abort = true; + } + // check if distributions are correct and calibrator parent is defined + if ((myCalibratorParent != NULL) && (abort == false)) { + // obtain type of distribution + GNECalibratorFlow::TypeOfFlow flowType = getTypeOfFlowDistribution(flowID, vehsPerHour, period, probability); + if (flowType == GNECalibratorFlow::GNE_CALIBRATORFLOW_INVALID) { + WRITE_WARNING(toString(SUMO_TAG_FLOW) + " with ID = '" + flowID + "' cannot be created; Type of distribution undefined"); + } else { + // create Flow and add it to calibrator parent + GNECalibratorFlow flow(myCalibratorParent, flowID, vehicleType, route, color, departLane, departPos, departSpeed, + arrivalLane, arrivalPos, arrivalSpeed, line, personNumber, containerNumber, reroute, + departPosLat, arrivalPosLat, begin, end, vehsPerHour, period, probability, number); + myCalibratorParent->addCalibratorFlow(flow); + } + } } - // get file - const std::string file = attrs.get(SUMO_ATTR_FILE, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_FILE) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; +} + + +void +GNEAdditionalHandler::parseVariableSpeedSignStep(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { + bool abort = false; + // Load step values + double time = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_TIME, abort); + double speed = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_SPEED, abort); + // Continue if all parameters were sucesfully loaded + if ((!abort) && (myVariableSpeedSignParent != NULL)) { + // create step and check that is valid + GNEVariableSpeedSignStep step(myVariableSpeedSignParent, time, speed); + // show warning if is duplicated + if (std::find(myVariableSpeedSignParent->getSteps().begin(), myVariableSpeedSignParent->getSteps().end(), step) != myVariableSpeedSignParent->getSteps().end()) { + WRITE_WARNING(toString(step.getTag()) + " cannot be inserted into " + toString(myVariableSpeedSignParent->getTag()) + " with id = '" + myVariableSpeedSignParent->getID() + + "'; Already exist another " + toString(step.getTag()) + " with the same " + toString(SUMO_ATTR_TIME) + "."); + } else { + myVariableSpeedSignParent->addStep(step); + } } - // get lanes - const std::string listOfLanes = attrs.get(SUMO_ATTR_LANES, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_LANES) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // Get optional attributes - const SUMOReal posx = attrs.getOpt(SUMO_ATTR_X, id.c_str(), ok, 0, false); - const SUMOReal posy = attrs.getOpt(SUMO_ATTR_Y, id.c_str(), ok, 0, false); +} + + +void +GNEAdditionalHandler::parseAndBuildVariableSpeedSign(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { + bool abort = false; + // parse attributes of VSS + std::string id = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ID, abort); + std::string file = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_FILE, abort); + std::vector lanesID = getParsedAttribute >(attrs, id.c_str(), tag, SUMO_ATTR_LANES, abort); + double posx = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_X, abort); + double posy = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_Y, abort); // Continue if all parameters were sucesfully loaded if (!abort) { - // Obtain lanes - std::vector lanesID; - SUMOSAXAttributes::parseStringVector(listOfLanes, lanesID); // obtain VSS Values // @todo - std::map VSSValues; + std::vector steps; // Obtain pointer to lanes std::vector lanes; - for (int i = 0; i < (int)lanesID.size(); i++) { - GNELane* lane = myViewNet->getNet()->retrieveLane(lanesID.at(i)); - if (lane) { + for (std::vector::iterator i = lanesID.begin(); (i < lanesID.end()) && (abort == false); i++) { + GNELane* lane = myViewNet->getNet()->retrieveLane((*i), false); + if (lane != NULL) { lanes.push_back(lane); } else { - WRITE_WARNING("lane '" + lanesID.at(i) + "' isn't valid"); + WRITE_WARNING(toString(SUMO_TAG_VSS) + " with ID = '" + id + "' cannot be created; " + toString(SUMO_TAG_LANE) + " '" + (*i) + "' doesn't exist."); + abort = true; } } // if operation of build variable speed signal was sucesfully, save Id - if (buildVariableSpeedSignal(myViewNet, id, Position(posx, posy), lanes, file, VSSValues, false)) { - myAdditionalSetParent = id; + if ((abort == false) && buildVariableSpeedSign(myViewNet, id, Position(posx, posy), lanes, file, steps)) { + myVariableSpeedSignParent = dynamic_cast(myViewNet->getNet()->retrieveAdditional(id)); + myLastTag = myVariableSpeedSignParent->getTag(); } } } @@ -364,36 +455,19 @@ void GNEAdditionalHandler::parseAndBuildRerouter(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { - bool ok = true; bool abort = false; - // get ID of additional - const std::string id = attrs.get(SUMO_ATTR_ID, 0, ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_ID) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get Edges - const std::string edgesAttribute = attrs.get(SUMO_ATTR_EDGES, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_EDGES) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get rest of parameters - const std::string file = attrs.getOpt(SUMO_ATTR_FILE, id.c_str(), ok, "", false); - const SUMOReal probability = attrs.getOpt(SUMO_ATTR_PROB, id.c_str(), ok, 1, false); - const bool off = attrs.getOpt(SUMO_ATTR_OFF, id.c_str(), ok, 0, false); - const SUMOReal posx = attrs.getOpt(SUMO_ATTR_X, id.c_str(), ok, 0, false); - const SUMOReal posy = attrs.getOpt(SUMO_ATTR_Y, id.c_str(), ok, 0, false); + // parse attributes of Rerouter + std::string id = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ID, abort); + std::vector edgesID = getParsedAttribute >(attrs, id.c_str(), tag, SUMO_ATTR_EDGES, abort); + std::string file = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_FILE, abort); + double probability = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_PROB, abort); + bool off = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_OFF, abort); + double posx = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_X, abort); + double posy = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_Y, abort); // Continue if all parameters were sucesfully loaded if (!abort) { - // Obtain edges - std::vector edgesID; - SUMOSAXAttributes::parseStringVector(attrs.getOpt(SUMO_ATTR_EDGES, id.c_str(), ok, "", false), edgesID); // obtain Rerouter values Values - // @ToDo Finish - std::set rerouterIntervals; + // Obtain pointer to edges std::vector edges; for (int i = 0; i < (int)edgesID.size(); i++) { @@ -405,8 +479,8 @@ } } // if operation of build variable speed signal was sucesfully, save Id - if (buildRerouter(myViewNet, id, Position(posx, posy), edges, probability, file, off , rerouterIntervals, false)) { - myAdditionalSetParent = id; + if (buildRerouter(myViewNet, id, Position(posx, posy), edges, probability, file, off)) { + ;//myAdditionalParent = id; } } } @@ -414,55 +488,25 @@ void GNEAdditionalHandler::parseAndBuildBusStop(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { - bool ok = true; bool abort = false; - // get ID of additional - const std::string id = attrs.get(SUMO_ATTR_ID, 0, ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_ID) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get lane ID - const std::string laneId = attrs.get(SUMO_ATTR_LANE, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_LANE) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get startPosition - SUMOReal startPos = attrs.get(SUMO_ATTR_STARTPOS, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_STARTPOS) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get End Position - SUMOReal endPos = attrs.get(SUMO_ATTR_ENDPOS, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_ENDPOS) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get optional atributes - const std::string linesAttribute = attrs.getOpt(SUMO_ATTR_LINES, id.c_str(), ok, "", false); - const bool friendlyPos = attrs.getOpt(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false); + // parse attributes of bus stop + std::string id = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ID, abort); + std::string laneId = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_LANE, abort); + double startPos = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_STARTPOS, abort); + double endPos = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_ENDPOS, abort); + std::vector lines = getParsedAttribute >(attrs, id.c_str(), tag, SUMO_ATTR_LINES, abort, false); // Continue if all parameters were sucesfully loaded if (!abort) { - // Parse lines - std::vector lines; - SUMOSAXAttributes::parseStringVector(linesAttribute, lines); // get pointer to lane GNELane* lane = myViewNet->getNet()->retrieveLane(laneId, false); if (lane == NULL) { // Write error if lane isn't valid WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(tag) + " '" + id + "' is not known."); - } else if (!checkStopPos(startPos, endPos, lane->getLaneShapeLenght(), POSITION_EPS, friendlyPos)) { + } else if (!checkStopPos(startPos, endPos, lane->getLaneShapeLength(), POSITION_EPS, getFriendlyPosition(attrs, id.c_str()))) { // Write error if position isn't valid - WRITE_WARNING("Invalid position for " + toString(tag) + " '" + id + "'."); - } else { - // build busStop - buildBusStop(myViewNet, id, lane, startPos, endPos, lines, false); + WRITE_WARNING("Invalid position for " + toString(tag) + " with ID = '" + id + "'."); + } else if (buildBusStop(myViewNet, id, lane, startPos, endPos, lines)) { + myLastTag = tag; } } } @@ -470,54 +514,25 @@ void GNEAdditionalHandler::parseAndBuildContainerStop(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { - bool ok = true; bool abort = false; - // get ID of additional - const std::string id = attrs.get(SUMO_ATTR_ID, 0, ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_ID) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get lane ID - const std::string laneId = attrs.get(SUMO_ATTR_LANE, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_LANE) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get startPosition - SUMOReal startPos = attrs.get(SUMO_ATTR_STARTPOS, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_STARTPOS) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get End Position - SUMOReal endPos = attrs.get(SUMO_ATTR_ENDPOS, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_ENDPOS) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get lines - const std::string linesAttribute = attrs.getOpt(SUMO_ATTR_LINES, id.c_str(), ok, "", false); - const bool friendlyPos = attrs.getOpt(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false); + // parse attributes of container stop + std::string id = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ID, abort); + std::string laneId = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_LANE, abort); + double startPos = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_STARTPOS, abort); + double endPos = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_ENDPOS, abort); + std::vector lines = getParsedAttribute >(attrs, id.c_str(), tag, SUMO_ATTR_LINES, abort, false); // Continue if all parameters were sucesfully loaded if (!abort) { - // Parse lines - std::vector lines; - SUMOSAXAttributes::parseStringVector(linesAttribute, lines); // get pointer to lane GNELane* lane = myViewNet->getNet()->retrieveLane(laneId, false); if (lane == NULL) { // Write error if lane isn't valid WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(tag) + " '" + id + "' is not known."); - // Check position and build container stop - } else if (!checkStopPos(startPos, endPos, lane->getLaneShapeLenght(), POSITION_EPS, friendlyPos)) { - WRITE_WARNING("Invalid position for " + toString(tag) + " '" + id + "'."); - } else { - buildContainerStop(myViewNet, id, lane, startPos, endPos, lines, false); + } else if (!checkStopPos(startPos, endPos, lane->getLaneShapeLength(), POSITION_EPS, getFriendlyPosition(attrs, id.c_str()))) { + // write error if position isn't valid + WRITE_WARNING("Invalid position for " + toString(tag) + " with ID = '" + id + "'."); + } else if (buildContainerStop(myViewNet, id, lane, startPos, endPos, lines)) { + myLastTag = tag; } } } @@ -525,42 +540,16 @@ void GNEAdditionalHandler::parseAndBuildChargingStation(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { - bool ok = true; bool abort = false; - // get ID of additional - const std::string id = attrs.get(SUMO_ATTR_ID, 0, ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_ID) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get lane ID - const std::string laneId = attrs.get(SUMO_ATTR_LANE, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_LANE) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get startPosition - SUMOReal startPos = attrs.get(SUMO_ATTR_STARTPOS, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_STARTPOS) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get End Position - SUMOReal endPos = attrs.get(SUMO_ATTR_ENDPOS, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_ENDPOS) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get rest of parameters - const SUMOReal chrgpower = attrs.getOpt(SUMO_ATTR_CHARGINGPOWER, id.c_str(), ok, 22000, false); - const SUMOReal efficiency = attrs.getOpt(SUMO_ATTR_EFFICIENCY, id.c_str(), ok, 0.95, false); - const bool chargeInTransit = attrs.getOpt(SUMO_ATTR_CHARGEINTRANSIT, id.c_str(), ok, 0, false); - const SUMOReal chargeDelay = attrs.getOpt(SUMO_ATTR_CHARGEDELAY, id.c_str(), ok, 0, false); - const bool friendlyPos = attrs.getOpt(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false); + // parse attributes of charging station + std::string id = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ID, abort); + std::string laneId = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_LANE, abort); + double startPos = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_STARTPOS, abort); + double endPos = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_ENDPOS, abort); + double chrgpower = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_CHARGINGPOWER, abort); + double efficiency = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_EFFICIENCY, abort); + bool chargeInTransit = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_CHARGEINTRANSIT, abort); + double chargeDelay = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_CHARGEDELAY, abort); // Continue if all parameters were sucesfully loaded if (!abort) { // get pointer to lane @@ -568,10 +557,11 @@ if (lane == NULL) { // Write error if lane isn't valid WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(tag) + " '" + id + "' is not known."); - } else if (!checkStopPos(startPos, endPos, lane->getLaneShapeLenght(), POSITION_EPS, friendlyPos)) { - WRITE_WARNING("Invalid position for " + toString(tag) + " '" + id + "'."); - } else { - buildChargingStation(myViewNet, id, lane, startPos, endPos, chrgpower, efficiency, chargeInTransit, chargeDelay, false); + } else if (!checkStopPos(startPos, endPos, lane->getLaneShapeLength(), POSITION_EPS, getFriendlyPosition(attrs, id.c_str()))) { + // write error if position isn't valid + WRITE_WARNING("Invalid position for " + toString(tag) + " with ID = '" + id + "'."); + } else if (buildChargingStation(myViewNet, id, lane, startPos, endPos, chrgpower, efficiency, chargeInTransit, chargeDelay)) { + myLastTag = tag; } } } @@ -579,46 +569,26 @@ void GNEAdditionalHandler::parseAndBuildCalibrator(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { - bool ok = true; bool abort = false; - // get ID of additional - const std::string id = attrs.get(SUMO_ATTR_ID, 0, ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_ID) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get lane ID - const std::string laneID = attrs.get(SUMO_ATTR_LANE, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_LANE) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get Output file - const std::string outfile = attrs.getOpt(SUMO_ATTR_OUTPUT, id.c_str(), ok, "", false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_OUTPUT) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get rest of parameters - const SUMOReal position = attrs.getOpt(SUMO_ATTR_POSITION, id.c_str(), ok, 0, false); - SUMOTime freq = attrs.getOptSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), ok, DELTA_T, false); - // Currently routeProbe not used - // std::string routeProbe = attrs.getOpt(SUMO_ATTR_ROUTEPROBE, id.c_str(), ok, ""); + // parse attributes of calibrator + std::string id = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ID, abort); + std::string laneId = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_LANE, abort); + std::string outfile = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_OUTPUT, abort); + double position = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_POSITION, abort); + double freq = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_FREQUENCY, abort); + // std::string routeProbe = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_ROUTEPROBE, abort); Currently routeProbe not used + std::vector calibratorRoutes; + std::vector calibratorFlows; + std::vector calibratorVehicleTypes; // Continue if all parameters were sucesfully loaded if (!abort) { - // get pointer to edge - GNEEdge* edge = &(myViewNet->getNet()->retrieveLane(laneID, false)->getParentEdge()); - if (edge == NULL) { + // get pointer to lane + GNELane* lane = myViewNet->getNet()->retrieveLane(laneId, false); + if (lane == NULL) { // Write error if lane isn't valid - WRITE_WARNING("The lane '" + laneID + "' to use within the " + toString(tag) + " '" + id + "' is not known."); - } else { - if (buildCalibrator(myViewNet, id, edge, position, outfile, freq, std::map(), false)) { - // Save id for insert flows - myAdditionalSetParent = id; - } + WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(tag) + " '" + id + "' is not known."); + } else if (buildCalibrator(myViewNet, id, lane, position, outfile, freq, calibratorRoutes, calibratorFlows, calibratorVehicleTypes)) { + myLastTag = tag; } } } @@ -626,45 +596,14 @@ void GNEAdditionalHandler::parseAndBuildDetectorE1(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { - bool ok = true; bool abort = false; - // get ID of additional - const std::string id = attrs.get(SUMO_ATTR_ID, 0, ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_ID) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get lane ID - const std::string laneId = attrs.get(SUMO_ATTR_LANE, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_LANE) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // Load position - const SUMOReal position = attrs.get(SUMO_ATTR_POSITION, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_POSITION) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // Load frequency - const SUMOTime frequency = attrs.get(SUMO_ATTR_FREQUENCY, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_FREQUENCY) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // Load file - const std::string file = attrs.get(SUMO_ATTR_FILE, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_FILE) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get rest of attributes - const bool splitByType = attrs.getOpt(SUMO_ATTR_SPLIT_VTYPE, id.c_str(), ok, false, false); + // parse attributes of E1 + std::string id = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ID, abort); + std::string laneId = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_LANE, abort); + double position = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_POSITION, abort); + double frequency = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_FREQUENCY, abort); + std::string file = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_FILE, abort); + bool splitByType = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_SPLIT_VTYPE, abort); // Continue if all parameters were sucesfully loaded if (!abort) { // get pointer to lane @@ -672,9 +611,10 @@ if (lane == NULL) { // Write error if lane isn't valid WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(tag) + " '" + id + "' is not known."); - } else { - // build detector E1 - buildDetectorE1(myViewNet, id, lane, position, frequency, file, splitByType, false); + } else if ((position < 0) || (position > (lane->getLaneShapeLength()))) { + WRITE_WARNING("Invalid position for " + toString(tag) + " with ID = '" + id + "'."); + } else if (buildDetectorE1(myViewNet, id, lane, position, frequency, file, splitByType)) { + myLastTag = tag; } } } @@ -682,56 +622,18 @@ void GNEAdditionalHandler::parseAndBuildDetectorE2(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { - bool ok = true; bool abort = false; - // get ID of additional - const std::string id = attrs.get(SUMO_ATTR_ID, 0, ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_ID) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get lane ID - const std::string laneId = attrs.get(SUMO_ATTR_LANE, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_LANE) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // Load position - const SUMOReal position = attrs.get(SUMO_ATTR_POSITION, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_POSITION) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // Load frequency - const SUMOTime frequency = attrs.get(SUMO_ATTR_FREQUENCY, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_FREQUENCY) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // Load file - const std::string file = attrs.get(SUMO_ATTR_FILE, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_FILE) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // Load lenght - const SUMOReal length = attrs.get(SUMO_ATTR_LENGTH, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_LENGTH) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get Rest of parameters - const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), ok, TIME2STEPS(1), false); - const SUMOReal haltingSpeedThreshold = attrs.getOpt(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), ok, 5.0f / 3.6f, false); - const SUMOReal jamDistThreshold = attrs.getOpt(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), ok, 10.0f, false); - const bool cont = attrs.getOpt(SUMO_ATTR_CONT, id.c_str(), ok, false); - // Check if parsing of parameters was correct + // parse attributes of E2 + std::string id = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ID, abort); + std::string laneId = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_LANE, abort); + double position = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_POSITION, abort); + double frequency = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_FREQUENCY, abort); + std::string file = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_FILE, abort); + double length = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_LENGTH, abort); + double haltingTimeThreshold = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_HALTING_TIME_THRESHOLD, abort); + double haltingSpeedThreshold = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_HALTING_SPEED_THRESHOLD, abort); + double jamDistThreshold = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_JAM_DIST_THRESHOLD, abort); + bool cont = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_CONT, abort); // Continue if all parameters were sucesfully loaded if (!abort) { // get pointer to lane @@ -739,9 +641,10 @@ if (lane == NULL) { // Write error if lane isn't valid WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(tag) + " '" + id + "' is not known."); - } else { - // build detector E2 - buildDetectorE2(myViewNet, id, lane, position, length, frequency, file, cont, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, false); + } else if ((position < 0) || ((position + length) > (lane->getLaneShapeLength()))) { + WRITE_WARNING("Invalid position for " + toString(tag) + " with ID = '" + id + "'."); + } else if (buildDetectorE2(myViewNet, id, lane, position, length, frequency, file, cont, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold)) { + myLastTag = tag; } } } @@ -749,39 +652,24 @@ void GNEAdditionalHandler::parseAndBuildDetectorE3(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { - bool ok = true; bool abort = false; - // get ID of additional - const std::string id = attrs.get(SUMO_ATTR_ID, 0, ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_ID) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // Load frequency - const SUMOTime frequency = attrs.get(SUMO_ATTR_FREQUENCY, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_FREQUENCY) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // Load file - const std::string file = attrs.get(SUMO_ATTR_FILE, id.c_str(), ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_FILE) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // Load rest of parameters - const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), ok, TIME2STEPS(1), false); - const SUMOReal haltingSpeedThreshold = attrs.getOpt(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), ok, 5.0f / 3.6f, false); - const SUMOReal posx = attrs.getOpt(SUMO_ATTR_X, id.c_str(), ok, 0, false); - const SUMOReal posy = attrs.getOpt(SUMO_ATTR_Y, id.c_str(), ok, 0, false); + // parse attributes of E3 + std::string id = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_ID, abort); + double frequency = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_FREQUENCY, abort); + std::string file = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_FILE, abort); + double haltingTimeThreshold = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_HALTING_TIME_THRESHOLD, abort); + double haltingSpeedThreshold = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_HALTING_SPEED_THRESHOLD, abort); + double posx = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_X, abort); + double posy = getParsedAttribute(attrs, id.c_str(), tag, SUMO_ATTR_Y, abort); // Continue if all parameters were sucesfully loaded if (!abort) { - // if operation of build detector E3 was sucesfully, save Id - if (buildDetectorE3(myViewNet, id, Position(posx, posy), frequency, file, haltingTimeThreshold, haltingSpeedThreshold, false)) { - myAdditionalSetParent = id; + // Create without possibility of undo/redo + if (myViewNet->getNet()->getAdditional(SUMO_TAG_E3DETECTOR, id) == NULL) { + myE3Parent = new GNEDetectorE3(id, myViewNet, Position(posx, posy), frequency, file, haltingTimeThreshold, haltingSpeedThreshold); + myLastTag = myE3Parent->getTag(); + } else { + WRITE_WARNING("Could not build " + toString(SUMO_TAG_E3DETECTOR) + " with ID '" + id + "' in netedit; probably declared twice."); + myE3Parent = NULL; } } } @@ -789,22 +677,10 @@ void GNEAdditionalHandler::parseAndBuildDetectorEntry(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { - bool ok = true; bool abort = false; - // Load position - const SUMOReal position = attrs.get(SUMO_ATTR_POSITION, 0, ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_POSITION) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get lane ID - const std::string laneId = attrs.get(SUMO_ATTR_LANE, 0, ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_LANE) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } + // parse attributes of Entry + std::string laneId = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_LANE, abort); + double position = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_POSITION, abort); // Check if parsing of parameters was correct if (!abort) { // get pointer to lane @@ -812,14 +688,10 @@ if (lane == NULL) { // Write error if lane isn't valid WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(tag) + " is not known."); - } else { - // get the ID. Note: This Id is interne, and cannot be defined by user - int indexEntry = 0; - while (myViewNet->getNet()->getAdditional(tag, toString(tag) + "_" + toString(indexEntry) + "_" + myAdditionalSetParent) != NULL) { - indexEntry++; - } - // build detector entry - buildDetectorEntry(myViewNet, toString(tag) + "_" + toString(indexEntry) + "_" + myAdditionalSetParent, lane, position, myAdditionalSetParent, false); + } else if ((position < 0) || (position > (lane->getLaneShapeLength()))) { + WRITE_WARNING("Invalid position for " + toString(tag) + "."); + } else if (myE3Parent != NULL && buildDetectorEntry(myViewNet, myE3Parent, lane, position)) { + myLastTag = tag; } } } @@ -827,22 +699,10 @@ void GNEAdditionalHandler::parseAndBuildDetectorExit(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag) { - bool ok = true; bool abort = false; - // Load position - const SUMOReal position = attrs.get(SUMO_ATTR_POSITION, 0, ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_POSITION) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } - // get lane ID - const std::string laneId = attrs.get(SUMO_ATTR_LANE, 0, ok, false); - if (!ok) { - WRITE_WARNING("Parameter '" + toString(SUMO_ATTR_LANE) + "' of additional " + toString(tag) + " is missing"); - ok = true; - abort = true; - } + // parse attributes of Exit + std::string laneId = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_LANE, abort); + double position = getParsedAttribute(attrs, 0, tag, SUMO_ATTR_POSITION, abort); // Check if parsing of parameters was correct if (!abort) { // get pointer to lane @@ -850,14 +710,10 @@ if (lane == NULL) { // Write error if lane isn't valid WRITE_WARNING("The lane '" + laneId + "' to use within the " + toString(tag) + " is not known."); - } else { - // get the ID. Note: This Id is interne, and cannot be defined by user - int indexExit = 0; - while (myViewNet->getNet()->getAdditional(tag, toString(tag) + "_" + toString(indexExit) + "_" + myAdditionalSetParent) != NULL) { - indexExit++; - } - // build detector Exit - buildDetectorExit(myViewNet, toString(tag) + "_" + toString(indexExit) + "_" + myAdditionalSetParent, lane, position, myAdditionalSetParent, false); + } else if ((position < 0) || (position > (lane->getLaneShapeLength()))) { + WRITE_WARNING("Invalid position for " + toString(tag) + "."); + } else if (myE3Parent != NULL && buildDetectorExit(myViewNet, myE3Parent, lane, position)) { + myLastTag = tag; } } } @@ -865,135 +721,136 @@ bool GNEAdditionalHandler::buildAdditional(GNEViewNet* viewNet, SumoXMLTag tag, std::map values) { - // Extract common attributes - std::string id = values[SUMO_ATTR_ID]; - bool blocked = GNEAttributeCarrier::parse(values[GNE_ATTR_BLOCK_MOVEMENT]); // create additional depending of the tag switch (tag) { case SUMO_TAG_BUS_STOP: { - // get own attributes of busStop + // obtain specify attributes of busStop + std::string id = values[SUMO_ATTR_ID]; GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false); - SUMOReal startPos = GNEAttributeCarrier::parse(values[SUMO_ATTR_STARTPOS]); - SUMOReal endPos = GNEAttributeCarrier::parse(values[SUMO_ATTR_ENDPOS]); - std::vector lines; - SUMOSAXAttributes::parseStringVector(values[SUMO_ATTR_LINES], lines); + double startPos = GNEAttributeCarrier::parse(values[SUMO_ATTR_STARTPOS]); + double endPos = GNEAttributeCarrier::parse(values[SUMO_ATTR_ENDPOS]); + std::vector lines = GNEAttributeCarrier::parse >(values[SUMO_ATTR_LINES]); // Build busStop if (lane) { - return buildBusStop(viewNet, id, lane, startPos, endPos, lines, blocked); + return buildBusStop(viewNet, id, lane, startPos, endPos, lines); } else { return false; } } case SUMO_TAG_CONTAINER_STOP: { - // get own attributes of containerStop + // obtain specify attributes of containerStop + std::string id = values[SUMO_ATTR_ID]; GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false); - SUMOReal startPos = GNEAttributeCarrier::parse(values[SUMO_ATTR_STARTPOS]); - SUMOReal endPos = GNEAttributeCarrier::parse(values[SUMO_ATTR_ENDPOS]); - std::vector lines; - SUMOSAXAttributes::parseStringVector(values[SUMO_ATTR_LINES], lines); + double startPos = GNEAttributeCarrier::parse(values[SUMO_ATTR_STARTPOS]); + double endPos = GNEAttributeCarrier::parse(values[SUMO_ATTR_ENDPOS]); + std::vector lines = GNEAttributeCarrier::parse >(values[SUMO_ATTR_LINES]); // Build containerStop if (lane) { - return buildContainerStop(viewNet, id, lane, startPos, endPos, lines, blocked); + return buildContainerStop(viewNet, id, lane, startPos, endPos, lines); } else { return false; } } case SUMO_TAG_CHARGING_STATION: { - // get own attributes of chargingStation + // obtain specify attributes of chargingStation + std::string id = values[SUMO_ATTR_ID]; GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false); - SUMOReal startPos = GNEAttributeCarrier::parse(values[SUMO_ATTR_STARTPOS]); - SUMOReal endPos = GNEAttributeCarrier::parse(values[SUMO_ATTR_ENDPOS]); - SUMOReal chargingPower = GNEAttributeCarrier::parse(values[SUMO_ATTR_CHARGINGPOWER]); - SUMOReal efficiency = GNEAttributeCarrier::parse(values[SUMO_ATTR_EFFICIENCY]); + double startPos = GNEAttributeCarrier::parse(values[SUMO_ATTR_STARTPOS]); + double endPos = GNEAttributeCarrier::parse(values[SUMO_ATTR_ENDPOS]); + double chargingPower = GNEAttributeCarrier::parse(values[SUMO_ATTR_CHARGINGPOWER]); + double efficiency = GNEAttributeCarrier::parse(values[SUMO_ATTR_EFFICIENCY]); bool chargeInTransit = GNEAttributeCarrier::parse(values[SUMO_ATTR_CHARGEINTRANSIT]); - int chargeDelay = GNEAttributeCarrier::parse(values[SUMO_ATTR_CHARGEDELAY]); + double chargeDelay = GNEAttributeCarrier::parse(values[SUMO_ATTR_CHARGEDELAY]); // Build chargingStation if (lane) { - return buildChargingStation(viewNet, id, lane, startPos, endPos, chargingPower, efficiency, chargeInTransit, chargeDelay, blocked); + return buildChargingStation(viewNet, id, lane, startPos, endPos, chargingPower, efficiency, chargeInTransit, chargeDelay); } else { return false; } } case SUMO_TAG_E1DETECTOR: { - // get own attributes of detector E1 + // obtain specify attributes of detector E1 + std::string id = values[SUMO_ATTR_ID]; GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false); - SUMOReal pos = GNEAttributeCarrier::parse(values[SUMO_ATTR_POSITION]); - int freq = GNEAttributeCarrier::parse(values[SUMO_ATTR_FREQUENCY]); + double pos = GNEAttributeCarrier::parse(values[SUMO_ATTR_POSITION]); + double freq = GNEAttributeCarrier::parse(values[SUMO_ATTR_FREQUENCY]); std::string filename = values[SUMO_ATTR_FILE]; bool splitByType = GNEAttributeCarrier::parse(values[SUMO_ATTR_SPLIT_VTYPE]); // Build detector E1 if (lane) { - return buildDetectorE1(viewNet, id, lane, pos, freq, filename, splitByType, blocked); + return buildDetectorE1(viewNet, id, lane, pos, freq, filename, splitByType); } else { return false; } } case SUMO_TAG_E2DETECTOR: { - // get own attributes of detector E2 + // obtain specify attributes of detector E2 + std::string id = values[SUMO_ATTR_ID]; GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false); - SUMOReal pos = GNEAttributeCarrier::parse(values[SUMO_ATTR_POSITION]); - int freq = GNEAttributeCarrier::parse(values[SUMO_ATTR_FREQUENCY]); - SUMOReal lenght = GNEAttributeCarrier::parse(values[SUMO_ATTR_LENGTH]); + double pos = GNEAttributeCarrier::parse(values[SUMO_ATTR_POSITION]); + double freq = GNEAttributeCarrier::parse(values[SUMO_ATTR_FREQUENCY]); + double length = GNEAttributeCarrier::parse(values[SUMO_ATTR_LENGTH]); std::string filename = values[SUMO_ATTR_FILE]; bool cont = GNEAttributeCarrier::parse(values[SUMO_ATTR_CONT]); - int timeThreshold = GNEAttributeCarrier::parse(values[SUMO_ATTR_HALTING_TIME_THRESHOLD]); - SUMOReal speedThreshold = GNEAttributeCarrier::parse(values[SUMO_ATTR_HALTING_SPEED_THRESHOLD]); - SUMOReal jamThreshold = GNEAttributeCarrier::parse(values[SUMO_ATTR_JAM_DIST_THRESHOLD]); + double timeThreshold = GNEAttributeCarrier::parse(values[SUMO_ATTR_HALTING_TIME_THRESHOLD]); + double speedThreshold = GNEAttributeCarrier::parse(values[SUMO_ATTR_HALTING_SPEED_THRESHOLD]); + double jamThreshold = GNEAttributeCarrier::parse(values[SUMO_ATTR_JAM_DIST_THRESHOLD]); // Build detector E2 if (lane) { - return buildDetectorE2(viewNet, id, lane, pos, lenght, freq, filename, cont, timeThreshold, speedThreshold, jamThreshold, blocked); + return buildDetectorE2(viewNet, id, lane, pos, length, freq, filename, cont, timeThreshold, speedThreshold, jamThreshold); } else { return false; } } case SUMO_TAG_E3DETECTOR: { - // get own attributes of detector E3 + // obtain specify attributes of detector E3 bool ok; + std::string id = values[SUMO_ATTR_ID]; PositionVector pos = GeomConvHelper::parseShapeReporting(values[SUMO_ATTR_POSITION], "user-supplied position", 0, ok, false); - int freq = GNEAttributeCarrier::parse(values[SUMO_ATTR_FREQUENCY]); + double freq = GNEAttributeCarrier::parse(values[SUMO_ATTR_FREQUENCY]); std::string filename = values[SUMO_ATTR_FILE]; - int timeThreshold = GNEAttributeCarrier::parse(values[SUMO_ATTR_HALTING_TIME_THRESHOLD]); - SUMOReal speedThreshold = GNEAttributeCarrier::parse(values[SUMO_ATTR_HALTING_SPEED_THRESHOLD]); + double timeThreshold = GNEAttributeCarrier::parse(values[SUMO_ATTR_HALTING_TIME_THRESHOLD]); + double speedThreshold = GNEAttributeCarrier::parse(values[SUMO_ATTR_HALTING_SPEED_THRESHOLD]); // Build detector E3 if (pos.size() == 1) { - return buildDetectorE3(viewNet, id, pos[0], freq, filename, timeThreshold, speedThreshold, blocked); + return buildDetectorE3(viewNet, id, pos[0], freq, filename, timeThreshold, speedThreshold); } else { return false; } } case SUMO_TAG_DET_ENTRY: { - // get own attributes of detector Entry + // obtain specify attributes of detector Entry GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false); - SUMOReal pos = GNEAttributeCarrier::parse(values[SUMO_ATTR_POSITION]); - std::string detectorE3ParentID = values[GNE_ATTR_PARENT]; + double pos = GNEAttributeCarrier::parse(values[SUMO_ATTR_POSITION]); + GNEDetectorE3* E3 = dynamic_cast(viewNet->getNet()->retrieveAdditional(values[GNE_ATTR_PARENT])); // Build detector Entry - if (lane && !detectorE3ParentID.empty()) { - return buildDetectorEntry(viewNet, id, lane, pos, detectorE3ParentID, blocked); + if (lane && E3) { + return buildDetectorEntry(viewNet, E3, lane, pos); } else { return false; } } case SUMO_TAG_DET_EXIT: { - // get own attributes of Detector Exit + // obtain specify attributes of Detector Exit GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false); - SUMOReal pos = GNEAttributeCarrier::parse(values[SUMO_ATTR_POSITION]); - std::string detectorE3ParentID = values[GNE_ATTR_PARENT]; + double pos = GNEAttributeCarrier::parse(values[SUMO_ATTR_POSITION]); + GNEDetectorE3* E3 = dynamic_cast(viewNet->getNet()->retrieveAdditional(values[GNE_ATTR_PARENT])); // Build detector Exit - if (lane && !detectorE3ParentID.empty()) { - return buildDetectorExit(viewNet, id, lane, pos, detectorE3ParentID, blocked); + if (lane && E3) { + return buildDetectorExit(viewNet, E3, lane, pos); } else { return false; } } case SUMO_TAG_VSS: { - // get own attributes of variable speed signal + // obtain specify attributes of variable speed signal + std::string id = values[SUMO_ATTR_ID]; bool ok; PositionVector pos = GeomConvHelper::parseShapeReporting(values[SUMO_ATTR_POSITION], "user-supplied position", 0, ok, false); // Parse lane Ids - std::vector laneIds; - SUMOSAXAttributes::parseStringVector(values[SUMO_ATTR_LANES], laneIds); - // By default, VSSValues are empty - std::map VSSValues; + std::vector laneIds = GNEAttributeCarrier::parse >(values[SUMO_ATTR_LANES]); + // By default, steps are empty + std::vector steps; // Obtain pointers to lanes std::vector lanes; for (int i = 0; i < (int)laneIds.size(); i++) { @@ -1001,74 +858,76 @@ } std::string file = values[SUMO_ATTR_FILE]; if (pos.size() == 1) { - return buildVariableSpeedSignal(viewNet, id, pos[0], lanes, file, VSSValues, blocked); + return buildVariableSpeedSign(viewNet, id, pos[0], lanes, file, steps); } else { return false; } } case SUMO_TAG_CALIBRATOR: { - // get own attributes of calibrator - GNEEdge* edge = &(viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false)->getParentEdge()); + // obtain specify attributes of calibrator + std::string id = values[SUMO_ATTR_ID]; + GNELane* lane = viewNet->getNet()->retrieveLane(values[SUMO_ATTR_LANE], false); // get rest of parameters - // Currently unused SUMOReal pos = GNEAttributeCarrier::parse(values[SUMO_ATTR_POSITION]); - SUMOReal pos = 0; + // Currently unused double pos = GNEAttributeCarrier::parse(values[SUMO_ATTR_POSITION]); + double pos = 0; std::string outfile = values[SUMO_ATTR_OUTPUT]; - SUMOTime freq = GNEAttributeCarrier::parse(values[SUMO_ATTR_FREQUENCY]); - // get flow values - std::map flowValues; + double freq = GNEAttributeCarrier::parse(values[SUMO_ATTR_FREQUENCY]); + // get Calibrator values + std::vector calibratorRoutes; + std::vector calibratorFlows; + std::vector calibratorVehicleTypes; // Build calibrator - if (edge) { - return buildCalibrator(viewNet, id, edge, pos, outfile, freq, flowValues, blocked); + if (lane) { + return buildCalibrator(viewNet, id, lane, pos, outfile, freq, calibratorRoutes, calibratorFlows, calibratorVehicleTypes); } else { return false; } } case SUMO_TAG_REROUTER: { - // get own attributes of rerouter + // obtain specify attributes of rerouter + std::string id = values[SUMO_ATTR_ID]; bool ok; PositionVector pos = GeomConvHelper::parseShapeReporting(values[SUMO_ATTR_POSITION], "user-supplied position", 0, ok, false); // Parse edges Ids - std::vector edgeIds; - SUMOSAXAttributes::parseStringVector(values[SUMO_ATTR_EDGES], edgeIds); + std::vector edgeIds = GNEAttributeCarrier::parse >(values[SUMO_ATTR_EDGES]); // Get rest of parameters bool off = GNEAttributeCarrier::parse(values[SUMO_ATTR_OFF]); - SUMOReal prob = GNEAttributeCarrier::parse(values[SUMO_ATTR_PROB]); + double prob = GNEAttributeCarrier::parse(values[SUMO_ATTR_PROB]); std::string file = values[SUMO_ATTR_FILE]; // Obtain pointers to edges std::vector edges; for (int i = 0; i < (int)edgeIds.size(); i++) { edges.push_back(viewNet->getNet()->retrieveEdge(edgeIds.at(i))); } - // Obtain routerIntervals - std::set rerouterIntervals; // Build rerouter if (pos.size() == 1) { - return buildRerouter(viewNet, id, pos[0], edges, prob, file, off, rerouterIntervals, blocked); + return buildRerouter(viewNet, id, pos[0], edges, prob, file, off); } else { return false; } } case SUMO_TAG_ROUTEPROBE: { - // get own attributes of RouteProbe + // obtain specify attributes of RouteProbe + std::string id = values[SUMO_ATTR_ID]; GNEEdge* edge = viewNet->getNet()->retrieveEdge(values[SUMO_ATTR_EDGE], false); - int freq = GNEAttributeCarrier::parse(values[SUMO_ATTR_FREQUENCY]); + double freq = GNEAttributeCarrier::parse(values[SUMO_ATTR_FREQUENCY]); std::string filename = values[SUMO_ATTR_FILE]; - int begin = GNEAttributeCarrier::parse(values[SUMO_ATTR_BEGIN]); + double begin = GNEAttributeCarrier::parse(values[SUMO_ATTR_BEGIN]); // Build RouteProbe if (edge) { - return buildRouteProbe(viewNet, id, edge, freq, filename, begin, blocked); + return buildRouteProbe(viewNet, id, edge, freq, filename, begin); } else { return false; } } case SUMO_TAG_VAPORIZER: { - // get own attributes of vaporizer + // obtain specify attributes of vaporizer GNEEdge* edge = viewNet->getNet()->retrieveEdge(values[SUMO_ATTR_EDGE], false); - int startTime = GNEAttributeCarrier::parse(values[SUMO_ATTR_STARTTIME]); - int end = GNEAttributeCarrier::parse(values[SUMO_ATTR_END]); + double startTime = GNEAttributeCarrier::parse(values[SUMO_ATTR_STARTTIME]); + double end = GNEAttributeCarrier::parse(values[SUMO_ATTR_END]); // Build RouteProbe if (edge) { - return buildVaporizer(viewNet, id, edge, startTime, end, blocked); + return buildVaporizer(viewNet, edge, startTime, end); } else { return false; } @@ -1080,211 +939,217 @@ bool -GNEAdditionalHandler::buildBusStop(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal startPos, SUMOReal endPos, const std::vector& lines, bool blocked) { +GNEAdditionalHandler::buildBusStop(GNEViewNet* viewNet, const std::string& id, GNELane* lane, double startPos, double endPos, const std::vector& lines) { if (viewNet->getNet()->getAdditional(SUMO_TAG_BUS_STOP, id) == NULL) { viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_BUS_STOP)); - GNEBusStop* busStop = new GNEBusStop(id, lane, viewNet, startPos, endPos, lines, blocked); - viewNet->getUndoList()->add(new GNEChange_Additional(viewNet->getNet(), busStop, true), true); + GNEBusStop* busStop = new GNEBusStop(id, lane, viewNet, startPos, endPos, lines); + viewNet->getUndoList()->add(new GNEChange_Additional(busStop, true), true); viewNet->getUndoList()->p_end(); return true; } else { - WRITE_WARNING("Could not build " + toString(SUMO_TAG_BUS_STOP) + " with id '" + id + "' in netEdit; probably declared twice."); + WRITE_WARNING("Could not build " + toString(SUMO_TAG_BUS_STOP) + " with ID '" + id + "' in netedit; probably declared twice."); return false; } } bool -GNEAdditionalHandler::buildContainerStop(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal startPos, SUMOReal endPos, const std::vector& lines, bool blocked) { +GNEAdditionalHandler::buildContainerStop(GNEViewNet* viewNet, const std::string& id, GNELane* lane, double startPos, double endPos, const std::vector& lines) { if (viewNet->getNet()->getAdditional(SUMO_TAG_CONTAINER_STOP, id) == NULL) { viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_CONTAINER_STOP)); - GNEContainerStop* containerStop = new GNEContainerStop(id, lane, viewNet, startPos, endPos, lines, blocked); - viewNet->getUndoList()->add(new GNEChange_Additional(viewNet->getNet(), containerStop, true), true); + GNEContainerStop* containerStop = new GNEContainerStop(id, lane, viewNet, startPos, endPos, lines); + viewNet->getUndoList()->add(new GNEChange_Additional(containerStop, true), true); viewNet->getUndoList()->p_end(); return true; } else { - WRITE_WARNING("Could not build " + toString(SUMO_TAG_CONTAINER_STOP) + " with id '" + id + "' in netEdit; probably declared twice."); + WRITE_WARNING("Could not build " + toString(SUMO_TAG_CONTAINER_STOP) + " with ID '" + id + "' in netedit; probably declared twice."); return false; } } bool -GNEAdditionalHandler::buildChargingStation(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal startPos, SUMOReal endPos, SUMOReal chargingPower, SUMOReal efficiency, bool chargeInTransit, SUMOReal chargeDelay, bool blocked) { +GNEAdditionalHandler::buildChargingStation(GNEViewNet* viewNet, const std::string& id, GNELane* lane, double startPos, double endPos, double chargingPower, double efficiency, bool chargeInTransit, double chargeDelay) { if (viewNet->getNet()->getAdditional(SUMO_TAG_CHARGING_STATION, id) == NULL) { viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_CHARGING_STATION)); - GNEChargingStation* chargingStation = new GNEChargingStation(id, lane, viewNet, startPos, endPos, chargingPower, efficiency, chargeInTransit, chargeDelay, blocked); - viewNet->getUndoList()->add(new GNEChange_Additional(viewNet->getNet(), chargingStation, true), true); + GNEChargingStation* chargingStation = new GNEChargingStation(id, lane, viewNet, startPos, endPos, chargingPower, efficiency, chargeInTransit, chargeDelay); + viewNet->getUndoList()->add(new GNEChange_Additional(chargingStation, true), true); viewNet->getUndoList()->p_end(); return true; } else { - WRITE_WARNING("Could not build " + toString(SUMO_TAG_CHARGING_STATION) + " with id '" + id + "' in netEdit; probably declared twice."); + WRITE_WARNING("Could not build " + toString(SUMO_TAG_CHARGING_STATION) + " with ID '" + id + "' in netedit; probably declared twice."); return false; } } bool -GNEAdditionalHandler::buildDetectorE1(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal pos, int freq, const std::string& filename, bool splitByType, bool blocked) { +GNEAdditionalHandler::buildDetectorE1(GNEViewNet* viewNet, const std::string& id, GNELane* lane, double pos, double freq, const std::string& filename, bool splitByType) { if (viewNet->getNet()->getAdditional(SUMO_TAG_E1DETECTOR, id) == NULL) { viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_E1DETECTOR)); - GNEDetectorE1* detectorE1 = new GNEDetectorE1(id, lane, viewNet, pos, freq, filename, splitByType, blocked); - viewNet->getUndoList()->add(new GNEChange_Additional(viewNet->getNet(), detectorE1, true), true); + GNEDetectorE1* detectorE1 = new GNEDetectorE1(id, lane, viewNet, pos, freq, filename, splitByType); + viewNet->getUndoList()->add(new GNEChange_Additional(detectorE1, true), true); viewNet->getUndoList()->p_end(); return true; } else { - WRITE_WARNING("Could not build " + toString(SUMO_TAG_E1DETECTOR) + " with id '" + id + "' in netEdit; probably declared twice."); + WRITE_WARNING("Could not build " + toString(SUMO_TAG_E1DETECTOR) + " with ID '" + id + "' in netedit; probably declared twice."); return false; } } bool -GNEAdditionalHandler::buildDetectorE2(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal pos, SUMOReal length, SUMOReal freq, const std::string& filename, bool cont, int timeThreshold, SUMOReal speedThreshold, SUMOReal jamThreshold, bool blocked) { +GNEAdditionalHandler::buildDetectorE2(GNEViewNet* viewNet, const std::string& id, GNELane* lane, double pos, double length, double freq, const std::string& filename, + bool cont, const double timeThreshold, double speedThreshold, double jamThreshold) { if (viewNet->getNet()->getAdditional(SUMO_TAG_E2DETECTOR, id) == NULL) { viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_E2DETECTOR)); - GNEDetectorE2* detectorE2 = new GNEDetectorE2(id, lane, viewNet, pos, length, freq, filename, cont, timeThreshold, speedThreshold, jamThreshold, blocked); - viewNet->getUndoList()->add(new GNEChange_Additional(viewNet->getNet(), detectorE2, true), true); + GNEDetectorE2* detectorE2 = new GNEDetectorE2(id, lane, viewNet, pos, length, freq, filename, cont, timeThreshold, speedThreshold, jamThreshold); + viewNet->getUndoList()->add(new GNEChange_Additional(detectorE2, true), true); viewNet->getUndoList()->p_end(); return true; } else { - WRITE_WARNING("Could not build " + toString(SUMO_TAG_E2DETECTOR) + " with id '" + id + "' in netEdit; probably declared twice."); + WRITE_WARNING("Could not build " + toString(SUMO_TAG_E2DETECTOR) + " with ID '" + id + "' in netedit; probably declared twice."); return false; } } bool -GNEAdditionalHandler::buildDetectorE3(GNEViewNet* viewNet, const std::string& id, Position pos, int freq, const std::string& filename, SUMOTime timeThreshold, SUMOReal speedThreshold, bool blocked) { +GNEAdditionalHandler::buildDetectorE3(GNEViewNet* viewNet, const std::string& id, Position pos, double freq, const std::string& filename, const double timeThreshold, double speedThreshold) { if (viewNet->getNet()->getAdditional(SUMO_TAG_E3DETECTOR, id) == NULL) { viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_E3DETECTOR)); - GNEDetectorE3* detectorE3 = new GNEDetectorE3(id, viewNet, pos, freq, filename, timeThreshold, speedThreshold, blocked); - viewNet->getUndoList()->add(new GNEChange_Additional(viewNet->getNet(), detectorE3, true), true); + GNEDetectorE3* detectorE3 = new GNEDetectorE3(id, viewNet, pos, freq, filename, timeThreshold, speedThreshold); + viewNet->getUndoList()->add(new GNEChange_Additional(detectorE3, true), true); viewNet->getUndoList()->p_end(); return true; } else { - WRITE_WARNING("Could not build " + toString(SUMO_TAG_E3DETECTOR) + " with id '" + id + "' in netEdit; probably declared twice."); + WRITE_WARNING("Could not build " + toString(SUMO_TAG_E3DETECTOR) + " with ID '" + id + "' in netedit; probably declared twice."); return false; } } bool -GNEAdditionalHandler::buildDetectorEntry(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal pos, std::string idDetectorE3Parent, bool blocked) { - // get DetectorE3 parent - GNEDetectorE3* detectorE3Parent = dynamic_cast(viewNet->getNet()->getAdditional(SUMO_TAG_E3DETECTOR, idDetectorE3Parent)); - // Check if DetectorE3 parent is correct - if (detectorE3Parent == NULL) { - WRITE_WARNING("Could not build " + toString(SUMO_TAG_DET_ENTRY) + " '" + id + "' in netEdit; '" + toString(SUMO_TAG_E3DETECTOR) + " '" + idDetectorE3Parent + "' don't valid."); +GNEAdditionalHandler::buildDetectorEntry(GNEViewNet* viewNet, GNEDetectorE3* E3Parent, GNELane* lane, double pos) { + // Check if Detector E3 parent and lane is correct + if (lane == NULL) { + WRITE_WARNING("Could not build " + toString(SUMO_TAG_DET_ENTRY) + " in netedit; " + toString(SUMO_TAG_LANE) + " doesn't exist."); + return false; + } else if (E3Parent == NULL) { + WRITE_WARNING("Could not build " + toString(SUMO_TAG_DET_ENTRY) + " in netedit; " + toString(SUMO_TAG_E3DETECTOR) + " parent doesn't exist."); return false; - } else if (viewNet->getNet()->getAdditional(SUMO_TAG_DET_ENTRY, id) == NULL) { + } else { + // insert E3 parent in net if previoulsy wasn't inserted + if (viewNet->getNet()->getAdditional(E3Parent->getTag(), E3Parent->getID()) == NULL) { + viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_E3DETECTOR)); + viewNet->getUndoList()->add(new GNEChange_Additional(E3Parent, true), true); + viewNet->getUndoList()->p_end(); + } // Create detector Entry if don't exist already in the net viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_DET_ENTRY)); - GNEDetectorEntry* entry = new GNEDetectorEntry(id, viewNet, lane, pos, detectorE3Parent, blocked); - viewNet->getUndoList()->add(new GNEChange_Additional(viewNet->getNet(), entry, true), true); + GNEDetectorEntry* entry = new GNEDetectorEntry(viewNet, E3Parent, lane, pos); + viewNet->getUndoList()->add(new GNEChange_Additional(entry, true), true); viewNet->getUndoList()->p_end(); return true; - } else { - WRITE_WARNING("Could not build " + toString(SUMO_TAG_DET_ENTRY) + " with id '" + id + "' in netEdit; probably declared twice."); - return false; } } bool -GNEAdditionalHandler::buildDetectorExit(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal pos, std::string idDetectorE3Parent, bool blocked) { - // get DetectorE3 parent - GNEDetectorE3* detectorE3Parent = dynamic_cast(viewNet->getNet()->getAdditional(SUMO_TAG_E3DETECTOR, idDetectorE3Parent)); - // Check if DetectorE3 parent is correct - if (detectorE3Parent == NULL) { - WRITE_WARNING("Could not build " + toString(SUMO_TAG_DET_EXIT) + " '" + id + "' in netEdit; '" + idDetectorE3Parent + "' don't valid."); +GNEAdditionalHandler::buildDetectorExit(GNEViewNet* viewNet, GNEDetectorE3* E3Parent, GNELane* lane, double pos) { + // Check if Detector E3 parent and lane is correct + if (lane == NULL) { + WRITE_WARNING("Could not build " + toString(SUMO_TAG_DET_ENTRY) + " in netedit; " + toString(SUMO_TAG_LANE) + " doesn't exist."); return false; - } else if (viewNet->getNet()->getAdditional(SUMO_TAG_DET_EXIT, id) == NULL) { + } else if (E3Parent == NULL) { + WRITE_WARNING("Could not build " + toString(SUMO_TAG_DET_ENTRY) + " in netedit; " + toString(SUMO_TAG_E3DETECTOR) + " parent doesn't exist."); + return false; + } else { + // insert E3 parent in net if previoulsy wasn't inserted + if (viewNet->getNet()->getAdditional(E3Parent->getTag(), E3Parent->getID()) == NULL) { + viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_E3DETECTOR)); + viewNet->getUndoList()->add(new GNEChange_Additional(E3Parent, true), true); + viewNet->getUndoList()->p_end(); + } // Create detector Exit if don't exist already in the net viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_DET_EXIT)); - GNEDetectorExit* exit = new GNEDetectorExit(id, viewNet, lane, pos, detectorE3Parent, blocked); - viewNet->getUndoList()->add(new GNEChange_Additional(viewNet->getNet(), exit, true), true); + GNEDetectorExit* exit = new GNEDetectorExit(viewNet, E3Parent, lane, pos); + viewNet->getUndoList()->add(new GNEChange_Additional(exit, true), true); viewNet->getUndoList()->p_end(); return true; - } else { - WRITE_WARNING("Could not build " + toString(SUMO_TAG_DET_EXIT) + " with id '" + id + "' in netEdit; probably declared twice."); - return false; } } bool -GNEAdditionalHandler::buildCalibrator(GNEViewNet* viewNet, const std::string& id, GNEEdge* edge, SUMOReal pos, const std::string& outfile, const SUMOTime freq, const std::map& flowValues, bool blocked) { +GNEAdditionalHandler::buildCalibrator(GNEViewNet* viewNet, const std::string& id, GNELane* lane, double pos, const std::string& outfile, const double freq, + const std::vector& calibratorRoutes, const std::vector& calibratorFlows, + const std::vector& calibratorVehicleTypes) { if (viewNet->getNet()->getAdditional(SUMO_TAG_CALIBRATOR, id) == NULL) { viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_CALIBRATOR)); - GNECalibrator* calibrator = new GNECalibrator(id, edge, viewNet, pos, freq, outfile, flowValues, blocked); - viewNet->getUndoList()->add(new GNEChange_Additional(viewNet->getNet(), calibrator, true), true); + GNECalibrator* calibrator = new GNECalibrator(id, lane, viewNet, pos, freq, outfile, calibratorRoutes, calibratorFlows, calibratorVehicleTypes); + viewNet->getUndoList()->add(new GNEChange_Additional(calibrator, true), true); viewNet->getUndoList()->p_end(); return true; } else { - WRITE_WARNING("Could not build " + toString(SUMO_TAG_CALIBRATOR) + " with id '" + id + "' in netEdit; probably declared twice."); + WRITE_WARNING("Could not build " + toString(SUMO_TAG_CALIBRATOR) + " with ID '" + id + "' in netedit; probably declared twice."); return false; } } bool -GNEAdditionalHandler::buildRerouter(GNEViewNet* viewNet, const std::string& id, Position pos, const std::vector& edges, SUMOReal prob, const std::string& file, bool off, const std::set& rerouterIntervals, bool blocked) { +GNEAdditionalHandler::buildRerouter(GNEViewNet* viewNet, const std::string& id, Position pos, const std::vector& edges, double prob, const std::string& file, bool off) { if (viewNet->getNet()->getAdditional(SUMO_TAG_REROUTER, id) == NULL) { viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_REROUTER)); - GNERerouter* rerouter = new GNERerouter(id, viewNet, pos, edges, file, prob, off, rerouterIntervals, blocked); - viewNet->getUndoList()->add(new GNEChange_Additional(viewNet->getNet(), rerouter, true), true); + GNERerouter* rerouter = new GNERerouter(id, viewNet, pos, edges, file, prob, off); + viewNet->getUndoList()->add(new GNEChange_Additional(rerouter, true), true); viewNet->getUndoList()->p_end(); return true; } else { - WRITE_WARNING("Could not build " + toString(SUMO_TAG_REROUTER) + " with id '" + id + "' in netEdit; probably declared twice."); + WRITE_WARNING("Could not build " + toString(SUMO_TAG_REROUTER) + " with ID '" + id + "' in netedit; probably declared twice."); return false; } } bool -GNEAdditionalHandler::buildRouteProbe(GNEViewNet* viewNet, const std::string& id, GNEEdge* edge, int freq, const std::string& file, int begin, bool blocked) { - if (viewNet->getNet()->getAdditional(SUMO_TAG_REROUTER, id) == NULL) { +GNEAdditionalHandler::buildRouteProbe(GNEViewNet* viewNet, const std::string& id, GNEEdge* edge, double freq, const std::string& file, double begin) { + if (viewNet->getNet()->getAdditional(SUMO_TAG_ROUTEPROBE, id) == NULL) { viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_ROUTEPROBE)); - GNERouteProbe* routeProbe = new GNERouteProbe(id, viewNet, edge, freq, file, begin, blocked); - viewNet->getUndoList()->add(new GNEChange_Additional(viewNet->getNet(), routeProbe, true), true); + GNERouteProbe* routeProbe = new GNERouteProbe(id, viewNet, edge, freq, file, begin); + viewNet->getUndoList()->add(new GNEChange_Additional(routeProbe, true), true); viewNet->getUndoList()->p_end(); return true; } else { - WRITE_WARNING("Could not build " + toString(SUMO_TAG_ROUTEPROBE) + " with id '" + id + "' in netEdit; probably declared twice."); + WRITE_WARNING("Could not build " + toString(SUMO_TAG_ROUTEPROBE) + " with ID '" + id + "' in netedit; probably declared twice."); return false; } } bool -GNEAdditionalHandler::buildVariableSpeedSignal(GNEViewNet* viewNet, const std::string& id, Position pos, const std::vector& lanes, const std::string& file, const std::map& VSSValues, bool blocked) { +GNEAdditionalHandler::buildVariableSpeedSign(GNEViewNet* viewNet, const std::string& id, Position pos, const std::vector& lanes, const std::string& file, const std::vector& steps) { if (viewNet->getNet()->getAdditional(SUMO_TAG_VSS, id) == NULL) { viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_VSS)); - GNEVariableSpeedSignal* variableSpeedSignal = new GNEVariableSpeedSignal(id, viewNet, pos, lanes, file, VSSValues, blocked); - viewNet->getUndoList()->add(new GNEChange_Additional(viewNet->getNet(), variableSpeedSignal, true), true); + GNEVariableSpeedSign* variableSpeedSign = new GNEVariableSpeedSign(id, viewNet, pos, lanes, file, steps); + viewNet->getUndoList()->add(new GNEChange_Additional(variableSpeedSign, true), true); viewNet->getUndoList()->p_end(); return true; } else { - WRITE_WARNING("Could not build " + toString(SUMO_TAG_VSS) + " with id '" + id + "' in netEdit; probably declared twice."); + WRITE_WARNING("Could not build " + toString(SUMO_TAG_VSS) + " with ID '" + id + "' in netedit; probably declared twice."); return false; } } bool -GNEAdditionalHandler::buildVaporizer(GNEViewNet* viewNet, const std::string& id, GNEEdge* edge, SUMOTime startTime, SUMOTime end, bool blocked) { - if (viewNet->getNet()->getAdditional(SUMO_TAG_VAPORIZER, id) == NULL) { - viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_VAPORIZER)); - GNEVaporizer* vaporizer = new GNEVaporizer(id, viewNet, edge, startTime, end, blocked); - viewNet->getUndoList()->add(new GNEChange_Additional(viewNet->getNet(), vaporizer, true), true); - viewNet->getUndoList()->p_end(); - return true; - } else { - WRITE_WARNING("Could not build " + toString(SUMO_TAG_VAPORIZER) + " with id '" + id + "' in netEdit; probably declared twice."); - return false; - } +GNEAdditionalHandler::buildVaporizer(GNEViewNet* viewNet, GNEEdge* edge, double startTime, double end) { + viewNet->getUndoList()->p_begin("add " + toString(SUMO_TAG_VAPORIZER)); + GNEVaporizer* vaporizer = new GNEVaporizer(viewNet, edge, startTime, end); + viewNet->getUndoList()->add(new GNEChange_Additional(vaporizer, true), true); + viewNet->getUndoList()->p_end(); + return true; } @@ -1307,20 +1172,20 @@ } -SUMOReal +double GNEAdditionalHandler::getPosition(const SUMOSAXAttributes& attrs, GNELane& lane, const std::string& tt, const std::string& tid) { bool ok = true; - SUMOReal pos = attrs.get(SUMO_ATTR_POSITION, 0, ok, false); + double pos = attrs.get(SUMO_ATTR_POSITION, 0, ok, false); const bool friendlyPos = attrs.getOpt(SUMO_ATTR_FRIENDLY_POS, 0, ok, false); if (!ok) { WRITE_WARNING("Error on parsing a position information."); } if (pos < 0) { - pos = lane.getLaneShapeLenght() + pos; + pos = lane.getLaneShapeLength() + pos; } - if (pos > lane.getLaneShapeLenght()) { + if (pos > lane.getLaneShapeLength()) { if (friendlyPos) { - pos = lane.getLaneShapeLenght() - (SUMOReal) 0.1; + pos = lane.getLaneShapeLength() - (double) 0.1; } else { WRITE_WARNING("The position of " + tt + " '" + tid + "' lies beyond the lane's '" + lane.getID() + "' length."); } @@ -1330,7 +1195,7 @@ bool -GNEAdditionalHandler::checkStopPos(SUMOReal& startPos, SUMOReal& endPos, const SUMOReal laneLength, const SUMOReal minLength, const bool friendlyPos) { +GNEAdditionalHandler::checkStopPos(double& startPos, double& endPos, const double laneLength, const double minLength, const bool friendlyPos) { if (minLength > laneLength) { return false; } @@ -1366,4 +1231,226 @@ } +template T +GNEAdditionalHandler::getParsedAttribute(const SUMOSAXAttributes& attrs, const char* objectid, SumoXMLTag tag, SumoXMLAttr attribute, bool& abort, bool report) { + bool ok = true; + std::string parsedAttribute = "0"; + // only show one warning for every error/warning loading additional + if (!abort) { + // set additionalOfWarningMessage + std::string additionalOfWarningMessage; + if (objectid) { + additionalOfWarningMessage = toString(tag) + " with ID '" + toString(objectid) + "'"; + } else { + additionalOfWarningMessage = toString(tag); + } + // first check that attribute exists + if (attrs.hasAttribute(attribute)) { + // Parse attribute as string + parsedAttribute = attrs.get(attribute, objectid, ok, false); + // Check if is the attribute is a file name or special attribute "COLOR" + if (!ok && ((attribute == SUMO_ATTR_COLOR) || GNEAttributeCarrier::isFilename(tag, attribute))) { + ok = true; + } + // check that parsed attribute can be converted to type T + if (ok && !GNEAttributeCarrier::canParse(parsedAttribute)) { + ok = false; + } + std::string errorFormat; + // Set extra checks for int values + if (GNEAttributeCarrier::isInt(tag, attribute)) { + if (GNEAttributeCarrier::canParse(parsedAttribute)) { + // parse to int and check if can be negative + int parsedIntAttribute = GNEAttributeCarrier::parse(parsedAttribute); + if (GNEAttributeCarrier::isPositive(tag, attribute) && parsedIntAttribute < 0) { + errorFormat = "Cannot be negative; "; + ok = false; + } + } else { + errorFormat = "Cannot be parsed to int; "; + ok = false; + } + } + // Set extra checks for float(double) values + if (GNEAttributeCarrier::isFloat(tag, attribute)) { + if (GNEAttributeCarrier::canParse(parsedAttribute)) { + // parse to double and check if can be negative + double parsedSumoRealAttribute = GNEAttributeCarrier::parse(parsedAttribute); + if (GNEAttributeCarrier::isPositive(tag, attribute) && parsedSumoRealAttribute < 0) { + errorFormat = "Cannot be negative; "; + ok = false; + } + } else { + errorFormat = "Cannot be parsed to float; "; + ok = false; + } + } + // set extra check for time(double) values + if (GNEAttributeCarrier::isTime(tag, attribute)) { + if (GNEAttributeCarrier::canParse(parsedAttribute)) { + // parse to SUMO Real and check if is negative + double parsedSumoRealAttribute = GNEAttributeCarrier::parse(parsedAttribute); + if (parsedSumoRealAttribute < 0) { + errorFormat = "Time cannot be negative; "; + ok = false; + } + } else { + errorFormat = "Cannot be parsed to time; "; + ok = false; + } + } + // set extra check for filename values + if (GNEAttributeCarrier::isFilename(tag, attribute) && (GNEAttributeCarrier::isValidFilename(parsedAttribute) == false)) { + errorFormat = "Filename contains invalid characters; "; + ok = false; + } + // set extra check for Vehicle Classes + if ((!ok) && (attribute == SUMO_ATTR_VCLASS)) { + errorFormat = "Is not a part of defined set of Vehicle Classes; "; + } + // set extra check for Vehicle Classes + if ((!ok) && (attribute == SUMO_ATTR_GUISHAPE)) { + errorFormat = "Is not a part of defined set of Gui Vehicle Shapes; "; + } + // If attribute has an invalid format + if (!ok) { + // if attribute has a default value, take it as string. In other case, abort. + if (GNEAttributeCarrier::hasDefaultValue(tag, attribute)) { + parsedAttribute = toString(GNEAttributeCarrier::getDefaultValue(tag, attribute)); + // report warning of default value + if (report) { + WRITE_WARNING("Format of optional " + GNEAttributeCarrier::getAttributeType(tag, attribute) + " attribute '" + toString(attribute) + "' of " + + additionalOfWarningMessage + " is invalid; " + errorFormat + "Default value '" + toString(parsedAttribute) + "' will be used."); + } + } else { + WRITE_WARNING("Format of essential " + GNEAttributeCarrier::getAttributeType(tag, attribute) + " attribute '" + toString(attribute) + "' of " + + additionalOfWarningMessage + " is invalid; " + errorFormat + "Additional cannot be created"); + // set default value of parsedAttribute (to avoid exceptions during conversions) + parsedAttribute = "0"; + abort = true; + } + } + } else { + // if attribute has a default value, take it. In other case, abort. + if (GNEAttributeCarrier::hasDefaultValue(tag, attribute)) { + parsedAttribute = toString(GNEAttributeCarrier::getDefaultValue(tag, attribute)); + // report warning of default value + if (report) { + WRITE_WARNING("Optional " + GNEAttributeCarrier::getAttributeType(tag, attribute) + " attribute '" + toString(attribute) + "' of " + + additionalOfWarningMessage + " is missing; Default value '" + toString(parsedAttribute) + "' will be used."); + } + } else { + WRITE_WARNING("Essential " + GNEAttributeCarrier::getAttributeType(tag, attribute) + " attribute '" + toString(attribute) + "' of " + + additionalOfWarningMessage + " is missing; Additional cannot be created"); + abort = true; + } + } + } + // return parsed attribute + return GNEAttributeCarrier::parse(parsedAttribute); +} + + +bool +GNEAdditionalHandler::getFriendlyPosition(const SUMOSAXAttributes& attrs, const char* objectid) { + bool ok = true; + return attrs.getOpt(SUMO_ATTR_FRIENDLY_POS, objectid, ok, false); +} + + +GNECalibratorFlow::TypeOfFlow +GNEAdditionalHandler::getTypeOfFlowDistribution(std::string flowID, double vehsPerHour, double period, double probability) { + if ((vehsPerHour == -1) && (period == -1) && (probability == -1)) { + WRITE_WARNING("A type of distribution (" + toString(SUMO_ATTR_VEHSPERHOUR) + ", " + toString(SUMO_ATTR_PERIOD) + " or " + + toString(SUMO_ATTR_PROB) + ") must be defined in " + toString(SUMO_TAG_FLOW) + " '" + flowID + "'"); + return GNECalibratorFlow::GNE_CALIBRATORFLOW_INVALID; + } else { + int vehsPerHourDefined = (vehsPerHour != -1) ? 1 : 0; + int periodDefined = (period != -1) ? 1 : 0; + int probabilityDefined = (probability != -1) ? 1 : 0; + + if ((vehsPerHourDefined + periodDefined + probabilityDefined) != 1) { + WRITE_WARNING("Only a type of distribution (" + toString(SUMO_ATTR_VEHSPERHOUR) + ", " + toString(SUMO_ATTR_PERIOD) + " or " + + toString(SUMO_ATTR_PROB) + ") can be defined at the same time in " + toString(SUMO_TAG_FLOW) + " '" + flowID + "'"); + return GNECalibratorFlow::GNE_CALIBRATORFLOW_INVALID; + } else if (vehsPerHourDefined == 1) { + return GNECalibratorFlow::GNE_CALIBRATORFLOW_VEHSPERHOUR; + } else if (periodDefined == 1) { + return GNECalibratorFlow::GNE_CALIBRATORFLOW_PERIOD; + } else if (probabilityDefined == 1) { + return GNECalibratorFlow::GNE_CALIBRATORFLOW_PROBABILITY; + } else { + return GNECalibratorFlow::GNE_CALIBRATORFLOW_INVALID; + } + } +} + + +void +GNEAdditionalHandler::resetLastTag() { + myLastTag = SUMO_TAG_NOTHING; + if (myE3Parent != NULL && ((myE3Parent->getNumberOfEntryChilds() + myE3Parent->getNumberOfExitChilds()) == 0)) { + WRITE_WARNING((toString(myE3Parent->getTag()) + "s without " + toString(SUMO_TAG_DET_ENTRY) + "s or " + toString(SUMO_TAG_DET_EXIT) + " aren't allowed; " + + toString(myE3Parent->getTag()) + " with ID = '" + myE3Parent->getID() + "' cannot be created.").c_str()); + delete myE3Parent; + myE3Parent = NULL; + } +} + + +bool +GNEAdditionalHandler::checkAdditionalParent(SumoXMLTag currentTag) { + // If last tag was an E3 but next tag isn't an Entry or Exit + if (((myLastTag == SUMO_TAG_E3DETECTOR) || (myLastTag == SUMO_TAG_ENTRY_EXIT_DETECTOR)) && + !((currentTag == SUMO_TAG_DET_ENTRY) || (currentTag == SUMO_TAG_DET_EXIT))) { + // Remove created E3 to avoid load empty detectors + if (myE3Parent != NULL) { + // show E3 empty warning and delete empty E3 + WRITE_WARNING((toString(myE3Parent->getTag()) + "s without " + toString(SUMO_TAG_DET_ENTRY) + "s or " + toString(SUMO_TAG_DET_EXIT) + " aren't allowed; " + + toString(myE3Parent->getTag()) + " with ID = '" + myE3Parent->getID() + "' cannot be created.").c_str()); + delete myE3Parent; + myE3Parent = NULL; + } + // continue with the processing of additional + return true; + } + + // if last tag wasn't an E3 but next tag is an entry or exit + if (!((myLastTag == SUMO_TAG_E3DETECTOR) || (myLastTag == SUMO_TAG_ENTRY_EXIT_DETECTOR)) && + ((currentTag == SUMO_TAG_DET_ENTRY) || (currentTag == SUMO_TAG_DET_EXIT))) { + if (myE3Parent != NULL) { + // In this case, we're loading a E3 with multiple entry exits, then continue + return true; + } else { + // return false to stop procesing current entry or exit and go to the next tag (this avoid some useless warnings) + return false; + } + } + + // if last tag was a Calibrator but next tag is a vehicle type, route or flow + if (!(myLastTag == SUMO_TAG_CALIBRATOR) && ((currentTag == SUMO_TAG_ROUTE) || (currentTag == SUMO_TAG_FLOW) || (currentTag == SUMO_TAG_VTYPE))) { + if (myCalibratorParent != NULL) { + // In this case, we're loading a Calibrator with multiple routes/flows/vehicleTypes, then continue + return true; + } else { + // return false to stop procesing current route/flow/vehicleType and go to the next tag (this avoid some useless warnings) + return false; + } + } + + // if last tag wasn't a Variable speed Sign but next tag is a step + if (!(myLastTag != SUMO_TAG_CALIBRATOR) && (currentTag == SUMO_TAG_STEP)) { + if (myVariableSpeedSignParent != NULL) { + // In this case, we're loading a Variable Speed Signal with multiple steps, then continue + return true; + } else { + // return false to stop procesing current step and go to the next tag (this avoid some useless warnings) + return false; + } + } + + // all OK + return true; +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditionalHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditionalHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditionalHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditionalHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEAdditionalHandler /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEAdditionalHandler.h 21142 2016-07-11 08:02:07Z palcraft $ +/// @version $Id: GNEAdditionalHandler.h 24108 2017-04-27 18:43:30Z behrisch $ /// -/// Builds trigger objects for netEdit +/// Builds trigger objects for netedit /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,8 +37,8 @@ #include #include "GNECalibrator.h" -#include "GNERerouter.h" -#include "GNEVariableSpeedSignal.h" +#include "GNEVariableSpeedSign.h" +#include "GNERerouterInterval.h" // =========================================================================== // class declarations @@ -50,6 +50,8 @@ class GNEJunction; class GNEEdge; class GNELane; +class GNEDetectorE3; +class GNECalibrator; // =========================================================================== // class definitions @@ -93,7 +95,7 @@ * @param[in] tag of the additional * @see buildLaneSpeedTrigger */ - void parseAndBuildVariableSpeedSignal(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag); + void parseAndBuildVariableSpeedSign(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag); /**@brief Parses his values and builds a rerouter * @param[in] attrs SAX-attributes which define the trigger @@ -161,24 +163,36 @@ */ void parseAndBuildRouteProbe(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag); + /**@brief Parses route values of Calibrators + * @param[in] attrs SAX-attributes which define the routes + * @param[in] tag of the additional + */ + void parseCalibratorRoute(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag); + + /**@brief Parses vehicle type values of Calibrators + * @param[in] attrs SAX-attributes which define the vehicle types + * @param[in] tag of the additional + */ + void parseCalibratorVehicleType(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag); + /**@brief Parses flow values of Calibrators * @param[in] attrs SAX-attributes which define the flows * @param[in] tag of the additional */ void parseCalibratorFlow(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag); - /**@brief Parses step values of VariableSpeedSignals + /**@brief Parses step values of VariableSpeedSigns * @param[in] attrs SAX-attributes which define the steps * @param[in] tag of the additional */ - void parseVariableSpeedSignalStep(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag); + void parseVariableSpeedSignStep(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag); /// @} /// @name building methods /// /// Called with parsed values, these methods build the trigger. /// @{ - /**@brief Builds additional / additionalSet + /**@brief Build additionals * @param[in] viewNet pointer to viewNet in wich additional will be created * @param[in] tag tag of the additiona lto create * @param[in] values map with the attributes and values of the additional to create @@ -193,11 +207,10 @@ * @param[in] startPos Begin position of the bus stop on the lane * @param[in] endPos End position of the bus stop on the lane * @param[in] lines Names of the bus lines that halt on this bus stop - * @param[in] blocked set initial blocking state of item * @return true if was sucesfully created, false in other case * @exception InvalidArgument If the bus stop can not be added to the net (is duplicate) */ - static bool buildBusStop(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal startPos, SUMOReal endPos, const std::vector& lines, bool blocked); + static bool buildBusStop(GNEViewNet* viewNet, const std::string& id, GNELane* lane, double startPos, double endPos, const std::vector& lines); /**@brief Builds a container stop * @param[in] viewNet viewNet in which element will be inserted @@ -206,11 +219,10 @@ * @param[in] startPos Begin position of the container stop on the lane * @param[in] endPos End position of the container stop on the lane * @param[in] lines Names of the bus lines that halt on this container stop - * @param[in] blocked set initial blocking state of item * @return true if was sucesfully created, false in other case * @exception InvalidArgument If the container stop can not be added to the net (is duplicate) */ - static bool buildContainerStop(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal startPos, SUMOReal endPos, const std::vector& lines, bool blocked); + static bool buildContainerStop(GNEViewNet* viewNet, const std::string& id, GNELane* lane, double startPos, double endPos, const std::vector& lines); /**@brief Builds a charging Station * @param[in] viewNet viewNet in which element will be inserted @@ -222,11 +234,10 @@ * @param[in] efficiency efficiency of the charge * @param[in] chargeInTransit enable or disable charge in transit * @param[in] chargeDelay delay in the charge - * @param[in] blocked set initial blocking state of item * @return true if was sucesfully created, false in other case * @exception InvalidArgument If the charging Station can not be added to the net (is duplicate) */ - static bool buildChargingStation(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal startPos, SUMOReal endPos, SUMOReal chargingPower, SUMOReal efficiency, bool chargeInTransit, SUMOReal chargeDelay, bool blocked); + static bool buildChargingStation(GNEViewNet* viewNet, const std::string& id, GNELane* lane, double startPos, double endPos, double chargingPower, double efficiency, bool chargeInTransit, double chargeDelay); /**@brief Builds a induction loop detector (E1) * @param[in] viewNet viewNet in which element will be inserted @@ -236,11 +247,10 @@ * @param[in] freq the aggregation period the values the detector collects shall be summed up. * @param[in] filename The path to the output file. * @param[in] splitByType If set, the collected values will be additionally reported on per-vehicle type base. - * @param[in] blocked set initial blocking state of item * @return true if was sucesfully created, false in other case * @exception InvalidArgument If the detector can not be added to the net (is duplicate) */ - static bool buildDetectorE1(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal pos, int freq, const std::string& filename, bool splitByType, bool blocked); + static bool buildDetectorE1(GNEViewNet* viewNet, const std::string& id, GNELane* lane, double pos, double freq, const std::string& filename, bool splitByType); /**@brief Builds a lane Area Detector (E2) * @param[in] viewNet viewNet in which element will be inserted @@ -253,13 +263,12 @@ * @param[in] cont Holds the information whether detectors longer than a lane shall be cut off or continued * @param[in] timeThreshold The time-based threshold that describes how much time has to pass until a vehicle is recognized as halting * @param[in] speedThreshold The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting - * @param[in] jamThreshold The minimum distance to the next standing vehicle in order to make this vehicle count as a participant to the jam - * @param[in] blocked set initial blocking state of item + * @param[in] jamThreshold The minimum distance to the next standing vehicle in order to make this vehicle count as a participant to the jam * @return true if was sucesfully created, false in other case * @exception InvalidArgument If the detector can not be added to the net (is duplicate) */ - static bool buildDetectorE2(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal pos, SUMOReal length, SUMOReal freq, const std::string& filename, - bool cont, int timeThreshold, SUMOReal speedThreshold, SUMOReal jamThreshold, bool blocked); + static bool buildDetectorE2(GNEViewNet* viewNet, const std::string& id, GNELane* lane, double pos, double length, double freq, const std::string& filename, + bool cont, const double timeThreshold, double speedThreshold, double jamThreshold); /**@brief Builds a multi entry exit detector (E3) * @param[in] viewNet viewNet in which element will be inserted @@ -269,50 +278,48 @@ * @param[in] filename The path to the output file. * @param[in] timeThreshold The time-based threshold that describes how much time has to pass until a vehicle is recognized as halting * @param[in] speedThreshold The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting - * @param[in] blocked set initial blocking state of item * @return true if was sucesfully created, false in other case * @exception InvalidArgument If the detector can not be added to the net (is duplicate) */ - static bool buildDetectorE3(GNEViewNet* viewNet, const std::string& id, Position pos, int freq, const std::string& filename, SUMOTime timeThreshold, SUMOReal speedThreshold, bool blocked); + static bool buildDetectorE3(GNEViewNet* viewNet, const std::string& id, Position pos, double freq, const std::string& filename, const double timeThreshold, double speedThreshold); /**@brief Builds a entry detector (E3) * @param[in] viewNet viewNet in which element will be inserted - * @param[in] id The id of the entry detector + * @param[in] E3Parent pointer to E3 detector parent * @param[in] lane The lane in which the entry detector is placed on * @param[in] pos position of the entry detector on the lane - * @param[in] idDetectorE3Parent id to parent detectorE3 - * @param[in] blocked set initial blocking state of item * @return true if was sucesfully created, false in other case - * @exception InvalidArgument If the entry detector can not be added to the net (is duplicate) + * @exception InvalidArgument If the entry detector can not be added to the net (invalid parent or lane) */ - static bool buildDetectorEntry(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal pos, std::string idDetectorE3Parent, bool blocked); + static bool buildDetectorEntry(GNEViewNet* viewNet, GNEDetectorE3* E3Parent, GNELane* lane, double pos); /**@brief Builds a exit detector (E3) * @param[in] viewNet viewNet in which element will be inserted - * @param[in] id The id of the exit detector + * @param[in] E3Parent pointer to E3 detector parent * @param[in] lane The lane in which the exit detector is placed on * @param[in] pos position of the exit detector on the lane - * @param[in] idDetectorE3Parent id to parent detectorE3 - * @param[in] blocked set initial blocking state of item * @return true if was sucesfully created, false in other case - * @exception InvalidArgument If the exit detector can not be added to the net (is duplicate) + * @exception InvalidArgument If the exit detector can not be added to the net (invalid parent or lane */ - static bool buildDetectorExit(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal pos, std::string idDetectorE3Parent, bool blocked); + static bool buildDetectorExit(GNEViewNet* viewNet, GNEDetectorE3* E3Parent, GNELane* lane, double pos); /**@brief builds a microscopic calibrator * @param[in] viewNet viewNet in which element will be inserted * @param[in] id The id of the calibrator - * @param[in] edge The edge the calibrator is placed at + * @param[in] lane The lane the calibrator is placed at * @param[in] pos The position on the edge the calibrator lies at * @param[in] outfile te file in which write results - * @param[in] flowValues flow of calibrator - * @param[in] blocked set initial blocking state of item + * @param[in] calibratorRoutes routes of calibrator + * @param[in] calibratorFlows flows of calibrator + * @param[in] calibratorVehicleTypes vehicleTypes of calibrator * @return true if was sucesfully created, false in other case * @todo Is the position correct/needed * @return true if was sucesfully created, false in other case * @exception InvalidArgument If the entry detector can not be added to the net (is duplicate) */ - static bool buildCalibrator(GNEViewNet* viewNet, const std::string& id, GNEEdge* edge, SUMOReal pos, const std::string& outfile, const SUMOTime freq, const std::map& flowValues, bool blocked); + static bool buildCalibrator(GNEViewNet* viewNet, const std::string& id, GNELane* lane, double pos, const std::string& outfile, double freq, + const std::vector& calibratorRoutes, const std::vector& calibratorFlows, + const std::vector& calibratorVehicleTypes); /**@brief builds a rerouter * @param[in] viewNet viewNet in which element will be inserted @@ -321,11 +328,9 @@ * @param[in] edges The edges the rerouter is placed at * @param[in] prob The probability the rerouter reoutes vehicles with * @param[in] file The file to read the reroute definitions from - * @param[in] rerouterInterval set with the rerouterintervals of rerouter - * @param[in] blocked set initial blocking state of item * @return true if was sucesfully created, false in other case */ - static bool buildRerouter(GNEViewNet* viewNet, const std::string& id, Position pos, const std::vector& edges, SUMOReal prob, const std::string& file, bool off, const std::set& rerouterIntervals, bool blocked); + static bool buildRerouter(GNEViewNet* viewNet, const std::string& id, Position pos, const std::vector& edges, double prob, const std::string& file, bool off); /**@brief builds a Route probe * @param[in] viewNet viewNet in which element will be inserted @@ -334,35 +339,31 @@ * @param[in] freq the aggregation period the values the routeprobe collects shall be summed up. * @param[in] file The file to read the routeprobe definitions from * @param[in] begin The time at which to start generating output - * @param[in] blocked set initial blocking state of item * @return true if was sucesfully created, false in other case * @exception InvalidArgument If the entry detector can not be added to the net (is duplicate) */ - static bool buildRouteProbe(GNEViewNet* viewNet, const std::string& id, GNEEdge* edge, int freq, const std::string& file, int begin, bool blocked); + static bool buildRouteProbe(GNEViewNet* viewNet, const std::string& id, GNEEdge* edge, double freq, const std::string& file, double begin); - /**@brief Builds a VariableSpeedSignal (lane speed trigger) + /**@brief Builds a VariableSpeedSign (lane speed trigger) * @param[in] viewNet viewNet in which element will be inserted * @param[in] id The id of the lane speed trigger * @param[in] destLanes List of lanes affected by this speed trigger * @param[in] file Name of the file to read the speeds to set from - * @param[in] blocked set initial blocking state of item - * @param[in] VSSValues Step and speed values of variable speed signal + * @param[in] steps Step and speed values of variable speed signal * @return true if was sucesfully created, false in other case * @exception InvalidArgument If the entry detector can not be added to the net (is duplicate) */ - static bool buildVariableSpeedSignal(GNEViewNet* viewNet, const std::string& id, Position pos, const std::vector& destLanes, const std::string& file, const std::map& VSSValues, bool blocked); + static bool buildVariableSpeedSign(GNEViewNet* viewNet, const std::string& id, Position pos, const std::vector& destLanes, const std::string& file, const std::vector& steps); /**@brief Builds a vaporizer (lane speed trigger) * @param[in] viewNet viewNet in which element will be inserted - * @param[in] id The id of the lane speed trigger * @param[in] edge edge in which tis vaporizer is placed * @param[in] startTime time in which this vaporizer start * @param[in] end time in which this vaporizer ends - * @param[in] blocked set initial blocking state of item * @return true if was sucesfully created, false in other case * @exception ProcessError If the XML definition file is errornous */ - static bool buildVaporizer(GNEViewNet* viewNet, const std::string& id, GNEEdge* edge, SUMOTime startTime, SUMOTime end, bool blocked); + static bool buildVaporizer(GNEViewNet* viewNet, GNEEdge* edge, double startTime, double end); /**@brief Helper method to obtain the filename * @param[in] attrs The attributes to obtain the file name from @@ -380,27 +381,59 @@ * @return The position on the lane * @exception InvalidArgument If the position is beyond the lane */ - SUMOReal getPosition(const SUMOSAXAttributes& attrs, GNELane& lane, const std::string& tt, const std::string& tid); + double getPosition(const SUMOSAXAttributes& attrs, GNELane& lane, const std::string& tt, const std::string& tid); /**@brief check if the position of an stoppingPlace over a lane is valid * @param[in] startPos Start position of stoppingPlace * @param[in] endPos End position of stoppingPlace - * @param[in] laneLength Lenght of the lane + * @param[in] laneLength Length of the lane * @param[in] minLength Min length of the stoppingPlace * @param[in] friendlyPos Attribute of stoppingPlace * @return true if the stoppingPlace position is valid, false in otherweise */ - bool checkStopPos(SUMOReal& startPos, SUMOReal& endPos, const SUMOReal laneLength, const SUMOReal minLength, const bool friendlyPos); + bool checkStopPos(double& startPos, double& endPos, const double laneLength, const double minLength, const bool friendlyPos); + + /**@brief reset last Tag and clear non-valid Additionals (For example, created E3 withouts Entry/Exit childs) + * @note must be called after a XML parsing + */ + void resetLastTag(); protected: /// @brief pointer to View's Net GNEViewNet* myViewNet; - /// @brief Id of the last inserted GNEAdditionalSet - std::string myAdditionalSetParent; + /// @brief Pointer to the last inserted E3 + GNEDetectorE3* myE3Parent; + + /// @brief Pointer to the last inserted Calibrator + GNECalibrator* myCalibratorParent; + + /// @brief Pointer to the last inserted variableSpeedSign + GNEVariableSpeedSign* myVariableSpeedSignParent; + + /// @brief pointer to rerouterInterval in which insert GNEClosingReroute, GNEDestProbReroute, etc. + GNERerouterInterval* rerouterIntervalToInsertValues; + + /// @brief last used Tag + SumoXMLTag myLastTag; + + /// @brief vector in wich save calibratorVehicleTypes during loading calibrators + std::vector myLoadingCalibratorVehicleTypes; + + /// @brief used to check hierarchy of aditionals with parents and childs (for example, E3) + bool checkAdditionalParent(SumoXMLTag currentTag); + + +private: + /// @brief get parsed attribute of XML and show warnings if there are problems + template + static T getParsedAttribute(const SUMOSAXAttributes& attrs, const char* objectid, SumoXMLTag tag, SumoXMLAttr attribute, bool& abort, bool report = true); + + /// @brief get special attribute friendly position, used in stopping places + bool getFriendlyPosition(const SUMOSAXAttributes& attrs, const char* objectid); - /// @brief rerouterInterval in whicn insert closingReroute, destProbReroute, etc. - GNERerouter::rerouterInterval* rerouterIntervalToInsertValues; + /// @brief get a error message, if configuration of flow distribution is invalid + GNECalibratorFlow::TypeOfFlow getTypeOfFlowDistribution(std::string flowID, double vehsPerHour, double period, double probability); }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditionalSet.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditionalSet.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditionalSet.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditionalSet.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,388 +0,0 @@ -/****************************************************************************/ -/// @file GNEAdditionalSet.cpp -/// @author Pablo Alvarez Lopez -/// @date Feb 2015 -/// @version $Id: GNEAdditionalSet.cpp 21640 2016-10-09 20:28:52Z palcraft $ -/// -/// A abstract class for representation of set of additional elements -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "GNEAdditionalSet.h" -#include "GNEAdditional.h" -#include "GNEUndoList.h" -#include "GNELane.h" -#include "GNEEdge.h" -#include "GNENet.h" -#include "GNEViewNet.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif - - -// =========================================================================== -// member method definitions -// =========================================================================== - -GNEAdditionalSet::GNEAdditionalSet(const std::string& id, GNEViewNet* viewNet, Position pos, SumoXMLTag tag, bool blocked, std::vector additionalChilds, std::vector edgeChilds, std::vector laneChilds) : - GNEAdditional(id, viewNet, pos, tag, NULL, blocked) { - // Insert additionals - for (int i = 0; i < (int)additionalChilds.size(); i++) { - addAdditionalChild(additionalChilds.at(i)); - } - // Insert edges - for (int i = 0; i < (int)edgeChilds.size(); i++) { - edgeChilds.at(i)->addAdditionalSet(this); - edgeChild myEdgeChild; - myEdgeChild.edge = edgeChilds.at(i); - myChildEdges.push_back(myEdgeChild); - } - // Insert lanes - for (int i = 0; i < (int)laneChilds.size(); i++) { - laneChilds.at(i)->addAdditionalSet(this); - laneChild myLaneChild; - myLaneChild.lane = laneChilds.at(i); - myChildLanes.push_back(myLaneChild); - } - // Update connections - updateConnections(); -} - - -GNEAdditionalSet::~GNEAdditionalSet() { - // Remove references to this additional Set in edges - childEdges childEdgesToRemove = myChildEdges; - for (childEdges::iterator i = childEdgesToRemove.begin(); i != childEdgesToRemove.end(); i++) { - (i->edge->removeAdditionalGeometrySet(this)); - } - // Remove references to this additional Set in lanes - childLanes childLanesToRemove = myChildLanes; - for (childLanes::iterator i = childLanesToRemove.begin(); i != childLanesToRemove.end(); i++) { - (i->lane->removeAdditionalGeometrySet(this)); - } -} - - -bool -GNEAdditionalSet::addAdditionalChild(GNEAdditional* additional) { - for (childAdditionals::iterator i = myChildAdditionals.begin(); i != myChildAdditionals.end(); i++) { - if ((*i) == additional) { - return false; - } - } - // If wasn't found, insert it - myChildAdditionals.push_back(additional); - return true; -} - - -bool -GNEAdditionalSet::removeAdditionalGeometryChild(GNEAdditional* additional) { - for (childAdditionals::iterator i = myChildAdditionals.begin(); i != myChildAdditionals.end(); i++) { - if ((*i) == additional) { - myChildAdditionals.erase(i); - updateConnections(); - return true; - } - } - // If wasn't found, return false - return false; -} - - -bool -GNEAdditionalSet::addEdgeChild(GNEEdge* edge) { - for (childEdges::iterator i = myChildEdges.begin(); i != myChildEdges.end(); i++) { - if (i->edge == edge) { - return false; - } - } - // If wasn't found, insert it - edgeChild myEdgeChild; - myEdgeChild.edge = edge; - myChildEdges.push_back(myEdgeChild); - updateConnections(); - return true; -} - - -bool -GNEAdditionalSet::removeEdgeChild(GNEEdge* edge) { - for (childEdges::iterator i = myChildEdges.begin(); i != myChildEdges.end(); i++) { - if (i->edge == edge) { - myChildEdges.erase(i); - updateConnections(); - return true; - } - } - // If wasn't found, return false - return false; -} - - -bool -GNEAdditionalSet::addLaneChild(GNELane* lane) { - for (childLanes::iterator i = myChildLanes.begin(); i != myChildLanes.end(); i++) { - if (i->lane == lane) { - return false; - } - } - // If wasn't found, insert it - laneChild myLaneChild; - myLaneChild.lane = lane; - myChildLanes.push_back(myLaneChild); - updateConnections(); - return true; -} - - -bool -GNEAdditionalSet::removeLaneChild(GNELane* lane) { - for (childLanes::iterator i = myChildLanes.begin(); i != myChildLanes.end(); i++) { - if (i->lane == lane) { - myChildLanes.erase(i); - updateConnections(); - return true; - } - } - // If wasn't found, return false - return false; -} - - -void -GNEAdditionalSet::updateConnections() { - // Clear map with the middle positions - myConnectionMiddlePosition.clear(); - - // Iterate over additonals - for (childAdditionals::iterator i = myChildAdditionals.begin(); i != myChildAdditionals.end(); i++) { - Position PositionOfChild = (*i)->getPositionInView(); - SUMOReal angleBetweenParentAndChild = myPosition.angleTo2D(PositionOfChild); - SUMOReal distancieBetweenParentAndChild = myPosition.distanceTo2D(PositionOfChild); - // Calculate middle point - myConnectionMiddlePosition[*i] = Position(myPosition.x() + cos(angleBetweenParentAndChild) * distancieBetweenParentAndChild, myPosition.y()); - } - - // Iterate over eges - for (childEdges::iterator i = myChildEdges.begin(); i != myChildEdges.end(); i++) { - // clear position of lanes and rotations - i->positionsOverLanes.clear(); - i->rotationsOverLanes.clear(); - // Calculate position and rotation of every lane - for (int j = 0; j < (int)i->edge->getLanes().size(); j++) { - i->positionsOverLanes.push_back(i->edge->getLanes().at(j)->getShape().positionAtOffset(i->edge->getLanes().at(j)->getShape().length() - 10)); - i->rotationsOverLanes.push_back(i->edge->getLanes().at(j)->getShape().rotationDegreeAtOffset(i->edge->getLanes().at(j)->getShape().length() - 10) * -1); - } - // Calculate middle position of lanes - Position middlePoint((i->positionsOverLanes.front().x() + i->positionsOverLanes.back().x()) / 2, (i->positionsOverLanes.front().y() + i->positionsOverLanes.back().y()) / 2); - // Set position of connection - SUMOReal angleBetweenParentAndChild = myPosition.angleTo2D(middlePoint); - SUMOReal distancieBetweenParentAndChild = myPosition.distanceTo2D(middlePoint); - myConnectionMiddlePosition[i->edge] = Position(myPosition.x() + cos(angleBetweenParentAndChild) * distancieBetweenParentAndChild, myPosition.y()); - } - - // Iterate over lanes - for (childLanes::iterator i = myChildLanes.begin(); i != myChildLanes.end(); i++) { - // Calculate position and rotation of every lane - i->positionOverLane = i->lane->getShape().positionAtOffset(i->lane->getShape().length() - 10); - i->rotationOverLane = i->lane->getShape().rotationDegreeAtOffset(i->lane->getShape().length() - 10) * -1; - // Set position of connection - SUMOReal angleBetweenParentAndChild = myPosition.angleTo2D(i->positionOverLane); - SUMOReal distancieBetweenParentAndChild = myPosition.distanceTo2D(i->positionOverLane); - myConnectionMiddlePosition[i->lane] = Position(myPosition.x() + cos(angleBetweenParentAndChild) * distancieBetweenParentAndChild, myPosition.y()); - } -} - - -void -GNEAdditionalSet::drawConnections() const { - // Iterate over list of additionals - for (childAdditionals::const_iterator i = myChildAdditionals.begin(); i != myChildAdditionals.end(); i++) { - // Add a draw matrix - glPushMatrix(); - // traslate in the Z axis - glTranslated(0, 0, getType() - 0.01); - // Set color of the base - GLHelper::setColor(RGBColor(255, 235, 0, 255)); - // Draw Line - GLHelper::drawLine(myPosition, myConnectionMiddlePosition.at(*i)); - GLHelper::drawLine(myConnectionMiddlePosition.at(*i), (*i)->getPositionInView()); - // Pop draw matrix - glPopMatrix(); - } - // Iterate over edges - for (childEdges::const_iterator i = myChildEdges.begin(); i != myChildEdges.end(); i++) { - // Add a draw matrix - glPushMatrix(); - // traslate in the Z axis - glTranslated(0, 0, getType() - 0.01); - // Set color of the base - GLHelper::setColor(RGBColor(255, 235, 0, 255)); - // Calculate middle point between lanes - /*** @todo ADD DISTANCE AS PARAMETER **/ - Position middlePoint((i->positionsOverLanes.front().x() + i->positionsOverLanes.back().x()) / 2, (i->positionsOverLanes.front().y() + i->positionsOverLanes.back().y()) / 2); - // Draw Line - GLHelper::drawLine(myPosition, myConnectionMiddlePosition.at(i->edge)); - GLHelper::drawLine(myConnectionMiddlePosition.at(i->edge), middlePoint); - // Pop draw matrix - glPopMatrix(); - } - // Iterate over lanes - for (childLanes::const_iterator i = myChildLanes.begin(); i != myChildLanes.end(); i++) { - // Add a draw matrix - glPushMatrix(); - // traslate in the Z axis - glTranslated(0, 0, getType() - 0.01); - // Set color of the base - GLHelper::setColor(RGBColor(255, 235, 0, 255)); - // Draw Line - GLHelper::drawLine(myPosition, myConnectionMiddlePosition.at(i->lane)); - GLHelper::drawLine(myConnectionMiddlePosition.at(i->lane), i->positionOverLane); - // Pop draw matrix - glPopMatrix(); - } -} - - -void -GNEAdditionalSet::writeAdditionalChildrens(OutputDevice& device, const std::string& currentDirectory) { - for (childAdditionals::iterator i = myChildAdditionals.begin(); i != myChildAdditionals.end(); i++) { - (*i)->writeAdditional(device, currentDirectory); - } -} - - -int -GNEAdditionalSet::getNumberOfAdditionalChilds() const { - return int(myChildAdditionals.size()); -} - - -int -GNEAdditionalSet::getNumberOfEdgeChilds() const { - return int(myChildEdges.size()); -} - - -int -GNEAdditionalSet::getNumberOfLaneChilds() const { - return int(myChildLanes.size()); -} - - -std::vector -GNEAdditionalSet::getAdditionalChildIds() const { - // Declare and resize vector - std::vector vectorOfAdditionalsIds; - vectorOfAdditionalsIds.resize(myChildAdditionals.size()); - // Save Ids - for (int i = 0; i < (int)myChildAdditionals.size(); i++) { - vectorOfAdditionalsIds[i] = myChildAdditionals.at(i)->getID(); - } - return vectorOfAdditionalsIds; -} - - -std::vector -GNEAdditionalSet::getEdgeChildIds() const { - // Declare and resize vector - std::vector vectorOfEdgesIds; - vectorOfEdgesIds.resize(myChildEdges.size()); - // Save Ids - for (int i = 0; i < (int)myChildEdges.size(); i++) { - vectorOfEdgesIds[i] = myChildEdges.at(i).edge->getID(); - } - return vectorOfEdgesIds; -} - - -std::vector -GNEAdditionalSet::getLaneChildIds() const { - // Declare and resize vector - std::vector vectorOfLanesIds; - vectorOfLanesIds.resize(myChildLanes.size()); - // Save Ids - for (int i = 0; i < (int)myChildLanes.size(); i++) { - vectorOfLanesIds[i] = myChildLanes.at(i).lane->getID(); - } - return vectorOfLanesIds; -} - - -void -GNEAdditionalSet::setEdgeChilds(std::vector edges) { - // First remove all existent edges - for (childEdges::iterator i = myChildEdges.begin(); i != myChildEdges.end(); i++) { - i->edge->removeAdditionalGeometrySet(this); - } - // clear edge childs vector - myChildEdges.clear(); - // Iterate over vector of new edges - for (std::vector::iterator i = edges.begin(); i != edges.end(); i++) { - (*i)->addAdditionalSet(this); - addEdgeChild(*i); - } - // Update geometry - updateGeometry(); -} - - -void -GNEAdditionalSet::setLaneChilds(std::vector lanes) { - // First remove all existent lanes - for (childLanes::iterator i = myChildLanes.begin(); i != myChildLanes.end(); i++) { - i->lane->removeAdditionalGeometrySet(this); - } - // clear lane childs vector - myChildLanes.clear(); - // Iterate over vector of new lanes - for (std::vector::iterator i = lanes.begin(); i != lanes.end(); i++) { - (*i)->addAdditionalSet(this); - addLaneChild(*i); - } - // Update geometry - updateGeometry(); -} - -/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditionalSet.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditionalSet.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAdditionalSet.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAdditionalSet.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,240 +0,0 @@ -/****************************************************************************/ -/// @file GNEAdditionalSet.h -/// @author Pablo Alvarez Lopez -/// @date Feb 2016 -/// @version $Id: GNEAdditionalSet.h 21640 2016-10-09 20:28:52Z palcraft $ -/// -/// A abstract class for representation of additionalSet elements -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ -#ifndef GNEAdditionalSet_h -#define GNEAdditionalSet_h - - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include "GNEAdditional.h" - -// =========================================================================== -// class declarations -// =========================================================================== - -class GUIGLObjectPopupMenu; -class PositionVector; -class GNEAdditional; -class GNENet; -class GNEViewNet; - -// =========================================================================== -// class definitions -// =========================================================================== - -/** - * @class GNEAdditionalSet - * @brief An Element wich group additionalSet elements - */ -class GNEAdditionalSet : public GNEAdditional { -public: - - /**@brief Constructor. - * @param[in] id Gl-id of the additionalSet element (Must be unique) - * @param[in] viewNet pointer to GNEViewNet of this additionalSet element belongs - * @param[in] tag Type of xml tag that define the additionalSet element (SUMO_TAG_DETECTORE3, SUMO_TAG_REROUTER, etc...) - * @param[in] blocked enable or disable blocking. By default additionalSet element isn't blocked (i.e. value is false) - * @param[in] additionalChilds - * @param[in] edgeChilds - * @param[in] laneChilds - */ - GNEAdditionalSet(const std::string& id, GNEViewNet* viewNet, Position pos, SumoXMLTag tag, bool blocked = false, - std::vector additionalChilds = std::vector(), - std::vector edgeChilds = std::vector(), - std::vector laneChilds = std::vector()); - - /// @brief Destructor - ~GNEAdditionalSet(); - - /// @brief update pre-computed geometry information - // @note: must be called when geometry changes (i.e. lane moved) - virtual void updateGeometry() = 0; - - /**@brief writte additionalSet element into a xml file - * @param[in] device device in which write parameters of additionalSet element - */ - virtual void writeAdditional(OutputDevice& device, const std::string& currentDirectory) = 0; - - /**@brief add additional element to this set - * @param[in] additionalSet pointer to GNEadditionalSet element to add - * @return true if was sucesfully added, false in other case - */ - bool addAdditionalChild(GNEAdditional* additional); - - /**@brief remove additional element to this set - * @param[in] additionalSet pointer to GNEadditionalSet element to remove - * @return true if was sucesfully removed, false in other case - */ - bool removeAdditionalGeometryChild(GNEAdditional* additional); - - /**@brief add edge element to this set - * @param[in] edgeSet pointer to GNEEdge element to add - * @param[in] position position of edge in which connection will be placed - * @return true if was sucesfully added, false in other case - */ - bool addEdgeChild(GNEEdge* edge); - - /**@brief remove edge element to this set - * @param[in] edgeSet pointer to GNEEdge element to remove - * @return true if was sucesfully removed, false in other case - */ - bool removeEdgeChild(GNEEdge* edge); - - /**@brief add lane element to this set - * @param[in] laneSet pointer to GNELane element to add - * @param[in] position position of edge in which connection will be placed - * @return true if was sucesfully added, false in other case - */ - bool addLaneChild(GNELane* lane); - - /**@brief remove lane element to this set - * @param[in] laneSet pointer to GNELane element to remove - * @return true if was sucesfully removed, false in other case - */ - bool removeLaneChild(GNELane* lane); - - /// @brief get number of additional childs of this additionalSet - int getNumberOfAdditionalChilds() const; - - /// @brief get number of edge childs of this additionalSet - int getNumberOfEdgeChilds() const; - - /// @brief get number of lane childs of this additionalSet - int getNumberOfLaneChilds() const; - - /// @brief get ids of additional childs - std::vector getAdditionalChildIds() const; - - /// @brief get ids of edge childs - std::vector getEdgeChildIds() const; - - /// @brief get ids of lane childs - std::vector getLaneChildIds() const; - - /// @brief set edge childs - /// @note preexisting edge childs will be erased - void setEdgeChilds(std::vector edges); - - /// @brief set lane childs - /// @note preexisting lane childs will be erased - void setLaneChilds(std::vector lanes); - - /// @name inherited from GUIGlObject - /// @{ - /// @brief Returns the name of the parent object - /// @return This object's parent id - virtual const std::string& getParentName() const = 0; - - /**@brief Draws the object - * @param[in] s The settings for the current view (may influence drawing) - * @see GUIGlObject::drawGL - */ - virtual void drawGL(const GUIVisualizationSettings& s) const = 0; - /// @} - - /// @name inherited from GNEAttributeCarrier - /// @{ - /* @brief method for getting the Attribute of an XML key - * @param[in] key The attribute key - * @return string with the value associated to key - */ - virtual std::string getAttribute(SumoXMLAttr key) const = 0; - - /* @brief method for setting the attribute and letting the object perform additionalSet changes - * @param[in] key The attribute key - * @param[in] value The new value - * @param[in] undoList The undoList on which to register changes - */ - virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0; - - /* @brief method for checking if the key and their conrrespond attribute are valids - * @param[in] key The attribute key - * @param[in] value The value asociated to key key - * @return true if the value is valid, false in other case - */ - virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0; - /// @} - -protected: - /// @brief struct for edge childs - struct edgeChild { - GNEEdge* edge; - std::vector positionsOverLanes; - std::vector rotationsOverLanes; - }; - - /// @brief struct for lane childs - struct laneChild { - GNELane* lane; - Position positionOverLane; - SUMOReal rotationOverLane; - }; - - /// @brief typedef for containers - typedef std::vector childAdditionals; - typedef std::vector childEdges; - typedef std::vector childLanes; - - /// @brief list of additional childs (Position and rotations is derived from additional) - std::vector myChildAdditionals; - - /// @brief map of child edges and their positions and rotation - childEdges myChildEdges; - - /// @brief list of child lanes and their positions and rotation - childLanes myChildLanes; - - /// @brief map to keep the middle position of connection - std::map myConnectionMiddlePosition; - - /// @brief update connections. - /// @note must be called at end of function updateGeometry() of additionalSet - void updateConnections(); - - /// @brief draw connections. - /// @note must be called at end of function drawGl(...) of additionalSet - void drawConnections() const; - - /**@brief writte children of this additionalSet - * @param[in] device device in which write parameters of additional element - * @param[in] currentDirectory current directory in which this additional are writted - */ - void writeAdditionalChildrens(OutputDevice& device, const std::string& currentDirectory); - -private: - /// @brief set attribute after validation - virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0; - - /// @brief Invalidated copy constructor. - GNEAdditionalSet(const GNEAdditionalSet&); - - /// @brief Invalidated assignment operator. - GNEAdditionalSet& operator=(const GNEAdditionalSet&); -}; - - -#endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEApplicationWindow.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEApplicationWindow.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEApplicationWindow.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEApplicationWindow.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEApplicationWindow.cpp /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNEApplicationWindow.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEApplicationWindow.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The main window of Netedit (adapted from GUIApplicationWindow) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,8 +36,6 @@ #include #include -#include -#include #include #include #include @@ -48,7 +46,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -72,11 +72,6 @@ #include "GNEAdditionalHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif - - // =========================================================================== // FOX-declarations // =========================================================================== @@ -124,13 +119,23 @@ FXMAPFUNC(FXEX::SEL_THREAD, ID_LOADTHREAD_EVENT, GNEApplicationWindow::onLoadThreadEvent), FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_CREATE_EDGE, GNEApplicationWindow::onCmdSetMode), + FXMAPFUNC(SEL_UPDATE, MID_GNE_MODE_CREATE_EDGE, GNEApplicationWindow::onUpdNeedsNetwork), FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_MOVE, GNEApplicationWindow::onCmdSetMode), + FXMAPFUNC(SEL_UPDATE, MID_GNE_MODE_MOVE, GNEApplicationWindow::onUpdNeedsNetwork), FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_DELETE, GNEApplicationWindow::onCmdSetMode), + FXMAPFUNC(SEL_UPDATE, MID_GNE_MODE_DELETE, GNEApplicationWindow::onUpdNeedsNetwork), FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_INSPECT, GNEApplicationWindow::onCmdSetMode), + FXMAPFUNC(SEL_UPDATE, MID_GNE_MODE_INSPECT, GNEApplicationWindow::onUpdNeedsNetwork), FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_SELECT, GNEApplicationWindow::onCmdSetMode), + FXMAPFUNC(SEL_UPDATE, MID_GNE_MODE_SELECT, GNEApplicationWindow::onUpdNeedsNetwork), FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_CONNECT, GNEApplicationWindow::onCmdSetMode), + FXMAPFUNC(SEL_UPDATE, MID_GNE_MODE_CONNECT, GNEApplicationWindow::onUpdNeedsNetwork), FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_TLS, GNEApplicationWindow::onCmdSetMode), + FXMAPFUNC(SEL_UPDATE, MID_GNE_MODE_TLS, GNEApplicationWindow::onUpdNeedsNetwork), FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONAL, GNEApplicationWindow::onCmdSetMode), + FXMAPFUNC(SEL_UPDATE, MID_GNE_MODE_ADDITIONAL, GNEApplicationWindow::onUpdNeedsNetwork), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_CROSSING, GNEApplicationWindow::onCmdSetMode), + FXMAPFUNC(SEL_UPDATE, MID_GNE_MODE_CROSSING, GNEApplicationWindow::onUpdNeedsNetwork), FXMAPFUNC(SEL_COMMAND, MID_GNE_SAVE_NETWORK, GNEApplicationWindow::onCmdSaveNetwork), FXMAPFUNC(SEL_UPDATE, MID_GNE_SAVE_NETWORK, GNEApplicationWindow::onUpdSaveNetwork), @@ -150,6 +155,7 @@ FXMAPFUNC(SEL_COMMAND, MID_GNE_ABORT, GNEApplicationWindow::onCmdAbort), FXMAPFUNC(SEL_COMMAND, MID_GNE_HOTKEY_DEL, GNEApplicationWindow::onCmdDel), FXMAPFUNC(SEL_COMMAND, MID_GNE_HOTKEY_ENTER, GNEApplicationWindow::onCmdEnter), + FXMAPFUNC(SEL_COMMAND, MID_GNE_FOCUS_FRAME, GNEApplicationWindow::onCmdFocusFrame), FXMAPFUNC(SEL_COMMAND, MID_HELP, GNEApplicationWindow::onCmdHelp), FXMAPFUNC(SEL_COMMAND, MID_GNE_COMPUTE_JUNCTIONS, GNEApplicationWindow::onCmdComputeJunctions), FXMAPFUNC(SEL_UPDATE, MID_GNE_COMPUTE_JUNCTIONS, GNEApplicationWindow::onUpdNeedsNetwork), @@ -158,6 +164,7 @@ FXMAPFUNC(SEL_COMMAND, MID_GNE_JOIN_JUNCTIONS, GNEApplicationWindow::onCmdJoinJunctions), FXMAPFUNC(SEL_UPDATE, MID_GNE_JOIN_JUNCTIONS, GNEApplicationWindow::onUpdNeedsNetwork), FXMAPFUNC(SEL_COMMAND, MID_GNE_OPTIONS, GNEApplicationWindow::onCmdOptions), + FXMAPFUNC(SEL_COMMAND, MID_EDITVIEWPORT, GNEApplicationWindow::onCmdEditViewport), }; // Object implementation @@ -167,6 +174,7 @@ // member method definitions // =========================================================================== #ifdef _MSC_VER +#pragma warning(push) #pragma warning(disable: 4355) #endif GNEApplicationWindow::GNEApplicationWindow(FXApp* a, const std::string& configPattern) : @@ -179,13 +187,13 @@ myNet(0), myUndoList(new GNEUndoList(this)), myTitlePrefix("NETEDIT " VERSION_STRING) { - // Load icons - GUIIconSubSys::init(a); - // Load Gifs (Textures) - GUITextureSubSys::init(a); + // init icons + GUIIconSubSys::initIcons(a); + // init Textures + GUITextureSubSys::initTextures(a); } #ifdef _MSC_VER -#pragma warning(default: 4355) +#pragma warning(pop) #endif @@ -202,41 +210,32 @@ setSelector(MID_WINDOW); // build menu bar - myMenuBarDrag = new FXToolBarShell(this, FRAME_NORMAL); - myMenuBar = new FXMenuBar(myTopDock, myMenuBarDrag, - LAYOUT_SIDE_TOP | LAYOUT_FILL_X | FRAME_RAISED); - new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP, - TOOLBARGRIP_DOUBLE); + myMenuBarDrag = new FXToolBarShell(this, GUIDesignToolBarShell3); + myMenuBar = new FXMenuBar(myTopDock, myMenuBarDrag, GUIDesignBar); + new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip); // build the thread - io myLoadThreadEvent.setTarget(this), myLoadThreadEvent.setSelector(ID_LOADTHREAD_EVENT); // build the status bar - myStatusbar = new FXStatusBar(this, LAYOUT_SIDE_BOTTOM | LAYOUT_FILL_X | FRAME_RAISED); + myStatusbar = new FXStatusBar(this, GUIDesignStatusBar); { myGeoFrame = - new FXHorizontalFrame(myStatusbar, LAYOUT_FIX_WIDTH | LAYOUT_FILL_Y | LAYOUT_RIGHT | FRAME_SUNKEN, - 0, 0, 20, 0, 0, 0, 0, 0, 0, 0); + new FXHorizontalFrame(myStatusbar, GUIDesignHorizontalFrameStatusBar); myGeoCoordinate = new FXLabel(myGeoFrame, "N/A\t\tOriginal coordinate (before coordinate transformation in NETCONVERT)", 0, LAYOUT_CENTER_Y); myCartesianFrame = - new FXHorizontalFrame(myStatusbar, LAYOUT_FIX_WIDTH | LAYOUT_FILL_Y | LAYOUT_RIGHT | FRAME_SUNKEN, - 0, 0, 20, 0, 0, 0, 0, 0, 0, 0); + new FXHorizontalFrame(myStatusbar, GUIDesignHorizontalFrameStatusBar); myCartesianCoordinate = new FXLabel(myCartesianFrame, "N/A\t\tNetwork coordinate", 0, LAYOUT_CENTER_Y); } // make the window a mdi-window - myMainSplitter = new FXSplitter(this, - SPLITTER_REVERSED | SPLITTER_VERTICAL | LAYOUT_FILL_X | LAYOUT_FILL_Y | SPLITTER_TRACKING | FRAME_RAISED | FRAME_THICK); - myMDIClient = new FXMDIClient(myMainSplitter, - LAYOUT_FILL_X | LAYOUT_FILL_Y | FRAME_SUNKEN | FRAME_THICK); + myMainSplitter = new FXSplitter(this, GUIDesignSplitter | SPLITTER_VERTICAL | SPLITTER_REVERSED); + myMDIClient = new FXMDIClient(myMainSplitter, GUIDesignSplitterMDI); myMDIMenu = new FXMDIMenu(this, myMDIClient); - new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient, - FXMDIClient::ID_MDI_MENUWINDOW, LAYOUT_LEFT); - new FXMDIDeleteButton(myMenuBar, myMDIClient, - FXMDIClient::ID_MDI_MENUCLOSE, FRAME_RAISED | LAYOUT_RIGHT); - new FXMDIRestoreButton(myMenuBar, myMDIClient, - FXMDIClient::ID_MDI_MENURESTORE, FRAME_RAISED | LAYOUT_RIGHT); - new FXMDIMinimizeButton(myMenuBar, myMDIClient, - FXMDIClient::ID_MDI_MENUMINIMIZE, FRAME_RAISED | LAYOUT_RIGHT); + // Due netedit only have a view, this buttons must be disabled (see #2807) + //new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient, FXMDIClient::ID_MDI_MENUWINDOW, GUIDesignMDIButtonLeft); + //new FXMDIDeleteButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUCLOSE, GUIDesignMDIButtonRight); + //new FXMDIRestoreButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENURESTORE, GUIDesignMDIButtonRight); + //new FXMDIMinimizeButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUMINIMIZE, GUIDesignMDIButtonRight); // build the message window myMessageWindow = new GUIMessageWindow(myMainSplitter); @@ -261,33 +260,17 @@ getAccelTable()->addAccel(parseAccel("c"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_CONNECT)); getAccelTable()->addAccel(parseAccel("t"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_TLS)); getAccelTable()->addAccel(parseAccel("a"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_ADDITIONAL)); + getAccelTable()->addAccel(parseAccel("r"), this, FXSEL(SEL_COMMAND, MID_GNE_MODE_CROSSING)); getAccelTable()->addAccel(parseAccel("Esc"), this, FXSEL(SEL_COMMAND, MID_GNE_ABORT)); getAccelTable()->addAccel(parseAccel("Del"), this, FXSEL(SEL_COMMAND, MID_GNE_HOTKEY_DEL)); getAccelTable()->addAccel(parseAccel("Enter"), this, FXSEL(SEL_COMMAND, MID_GNE_HOTKEY_ENTER)); + getAccelTable()->addAccel(parseAccel("f"), this, FXSEL(SEL_COMMAND, MID_GNE_FOCUS_FRAME)); + getAccelTable()->addAccel(parseAccel("v"), this, FXSEL(SEL_COMMAND, MID_EDITVIEWPORT)); } void GNEApplicationWindow::create() { - int windowWidth = getApp()->reg().readIntEntry("SETTINGS", "width", 600); - int windowHeight = getApp()->reg().readIntEntry("SETTINGS", "height", 400); - const OptionsCont& oc = OptionsCont::getOptions(); - if (oc.isSet("window-size")) { - std::vector windowSize = oc.getStringVector("window-size"); - if (windowSize.size() != 2 - || !TplCheck::_str2int(windowSize[0]) - || !TplCheck::_str2int(windowSize[1])) { - WRITE_ERROR("option window-size requires INT,INT"); - } else { - windowWidth = TplConvert::_str2int(windowSize[0]); - windowHeight = TplConvert::_str2int(windowSize[1]); - } - } - if (oc.isSet("window-size") || getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 0) { - setX(getApp()->reg().readIntEntry("SETTINGS", "x", 150)); - setY(getApp()->reg().readIntEntry("SETTINGS", "y", 150)); - setWidth(windowWidth); - setHeight(windowHeight); - } + setWindowSizeAndPos(); gCurrentFolder = getApp()->reg().readStringEntry("SETTINGS", "basedir", ""); FXMainWindow::create(); myMenuBarDrag->create(); @@ -301,12 +284,13 @@ myCartesianFrame->setWidth(width); myGeoFrame->setWidth(width); - show(PLACEMENT_SCREEN); + show(PLACEMENT_DEFAULT); if (!OptionsCont::getOptions().isSet("window-size")) { if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 1) { maximize(); } } + } @@ -321,6 +305,7 @@ // (http://www.fox-toolkit.net/faq#TOC-What-happens-when-the-application-s) delete myFileMenu; delete myEditMenu; + delete myLocatorMenu; delete myProcessingMenu; delete myWindowsMenu; delete myHelpMenu; @@ -350,13 +335,13 @@ myFileMenu = new FXMenuPane(this); new FXMenuTitle(myMenuBar, "&File", 0, myFileMenu); new FXMenuCommand(myFileMenu, - "&New Network...\tCtrl+A\tCreate a new network.", + "&New Network...\tCtrl+N\tCreate a new network.", GUIIconSubSys::getIcon(ICON_OPEN_NET), this, MID_GNE_NEW_NETWORK); new FXMenuCommand(myFileMenu, - "&Open Network...\tCtrl+N\tOpen a SUMO network.", + "&Open Network...\tCtrl+O\tOpen a SUMO network.", GUIIconSubSys::getIcon(ICON_OPEN_NET), this, MID_OPEN_NETWORK); new FXMenuCommand(myFileMenu, - "Open &Configuration...\tCtrl+O\tOpen a NETCONVERT configuration file.", + "Open Configura&tion...\tCtrl+T\tOpen a NETCONVERT configuration file.", GUIIconSubSys::getIcon(ICON_OPEN_CONFIG), this, MID_OPEN_CONFIG); new FXMenuCommand(myFileMenu, "Import &Foreign Network...\t\tImport a foreign network such as OSM.", @@ -365,7 +350,7 @@ "Load S&hapes...\tCtrl+P\tLoad shapes into the network view.", GUIIconSubSys::getIcon(ICON_OPEN_SHAPES), this, MID_OPEN_SHAPES); new FXMenuCommand(myFileMenu, - "&Load Additionals...\tCtrl+D\tLoad additional elements.", + "Load A&dditionals...\tCtrl+D\tLoad additional elements.", GUIIconSubSys::getIcon(ICON_OPEN_ADDITIONALS), this, MID_OPEN_ADDITIONALS); new FXMenuCommand(myFileMenu, "&Reload\tCtrl+R\tReloads the network.", @@ -374,26 +359,26 @@ "&Save Network...\tCtrl+S\tSave the network.", GUIIconSubSys::getIcon(ICON_SAVE), this, MID_GNE_SAVE_NETWORK); new FXMenuCommand(myFileMenu, - "Save Net&work As...\tCtrl+Shift-S\tSave the network.", + "Save Net&work As...\tCtrl+Shift+S\tSave the network in another file.", GUIIconSubSys::getIcon(ICON_SAVE), this, MID_GNE_SAVE_AS_NETWORK); new FXMenuCommand(myFileMenu, - "Save plain &xml...\t\tSave plain xml representation the network.", + "Save plain XM&L...\tCtrl+L\tSave plain xml representation the network.", GUIIconSubSys::getIcon(ICON_SAVE), this, MID_GNE_SAVE_PLAIN_XML); new FXMenuCommand(myFileMenu, - "Save &joined junctions...\t\tSave log of joined junctions (allows reproduction of joins).", + "Save &joined junctions...\tCtrl+J\tSave log of joined junctions (allows reproduction of joins).", GUIIconSubSys::getIcon(ICON_SAVE), this, MID_GNE_SAVE_JOINED); new FXMenuCommand(myFileMenu, - "Save &POIs As ...\t\tSave the POIs.", + "Save POIs As ...\tCtrl+Shift+P\tSave the POIs.", GUIIconSubSys::getIcon(ICON_SAVE), this, MID_GNE_SAVE_POIS); new FXMenuCommand(myFileMenu, - "Save &additionals\t\tSave additional elements.", + "Save additionals\tCtrl+Shift+D\tSave additional elements.", GUIIconSubSys::getIcon(ICON_SAVE), this, MID_GNE_SAVE_ADDITIONALS); new FXMenuCommand(myFileMenu, - "Save a&dditionals As...\t\tSave additional elements.", + "Save additionals As...\t\tSave additional elements in another file.", GUIIconSubSys::getIcon(ICON_SAVE), this, MID_GNE_SAVE_ADDITIONALS_AS); new FXMenuSeparator(myFileMenu); new FXMenuCommand(myFileMenu, - "Close\tCtrl+W\tClose &the network.", + "Close\tCtrl+W\tClose the net&work.", GUIIconSubSys::getIcon(ICON_CLOSE), this, MID_CLOSE); // Recent files FXMenuSeparator* sep1 = new FXMenuSeparator(myFileMenu); @@ -436,6 +421,8 @@ // build edit menu myEditMenu = new FXMenuPane(this); new FXMenuTitle(myMenuBar, "&Edit", 0, myEditMenu); + + // build undo/redo command new FXMenuCommand(myEditMenu, "&Undo\tCtrl+Z\tUndo the last change.", GUIIconSubSys::getIcon(ICON_UNDO), myUndoList, FXUndoList::ID_UNDO); @@ -443,6 +430,36 @@ "&Redo\tCtrl+Y\tRedo the last change.", GUIIconSubSys::getIcon(ICON_REDO), myUndoList, FXUndoList::ID_REDO); + new FXMenuSeparator(myEditMenu); + + // build modes command + new FXMenuCommand(myEditMenu, + "&Edge mode\tE\tCreate junction and edges.", + GUIIconSubSys::getIcon(ICON_MODECREATEEDGE), this, MID_GNE_MODE_CREATE_EDGE); + new FXMenuCommand(myEditMenu, + "&Move mode\tM\tMove elements.", + GUIIconSubSys::getIcon(ICON_MODEMOVE), this, MID_GNE_MODE_MOVE); + new FXMenuCommand(myEditMenu, + "&Delete mode\tD\tDelete elements.", + GUIIconSubSys::getIcon(ICON_MODEDELETE), this, MID_GNE_MODE_DELETE); + new FXMenuCommand(myEditMenu, + "&Inspect mode\tI\tInspect elements and change their attributes.", + GUIIconSubSys::getIcon(ICON_MODEINSPECT), this, MID_GNE_MODE_INSPECT); + new FXMenuCommand(myEditMenu, + "&Select mode\tS\tSelect elements.", + GUIIconSubSys::getIcon(ICON_MODESELECT), this, MID_GNE_MODE_SELECT); + new FXMenuCommand(myEditMenu, + "&Connection mode\tC\tEdit connections between lanes.", + GUIIconSubSys::getIcon(ICON_MODECONNECTION), this, MID_GNE_MODE_CONNECT); + new FXMenuCommand(myEditMenu, + "&Traffic light mode\tT\tEdit traffic lights over junctions.", + GUIIconSubSys::getIcon(ICON_MODETLS), this, MID_GNE_MODE_TLS); + new FXMenuCommand(myEditMenu, + "&Additional mode\tA\tCreate additional elements.", + GUIIconSubSys::getIcon(ICON_MODEADDITIONAL), this, MID_GNE_MODE_ADDITIONAL); + new FXMenuCommand(myEditMenu, + "C&rossing mode\tR\tCreate crossings between edges.", + GUIIconSubSys::getIcon(ICON_MODECROSSING), this, MID_GNE_MODE_CROSSING); /* new FXMenuSeparator(myEditMenu); @@ -455,18 +472,17 @@ myProcessingMenu = new FXMenuPane(this); new FXMenuTitle(myMenuBar, "&Processing", 0, myProcessingMenu); new FXMenuCommand(myProcessingMenu, - "&Compute Junctions\tF5\tComputes junction shape and logic.", - 0, this, MID_GNE_COMPUTE_JUNCTIONS); + "Compute Junctions\tF5\tComputes junction shape and logic.", + GUIIconSubSys::getIcon(ICON_COMPUTEJUNCTIONS), this, MID_GNE_COMPUTE_JUNCTIONS); new FXMenuCommand(myProcessingMenu, - "Clean &Junctions\tF6\tRemoves solitary junctions.", - 0, this, MID_GNE_CLEAN_JUNCTIONS); + "Clean Junctions\tF6\tRemoves solitary junctions.", + GUIIconSubSys::getIcon(ICON_CLEANJUNCTIONS), this, MID_GNE_CLEAN_JUNCTIONS); new FXMenuCommand(myProcessingMenu, - "Join &Selected Junctions\tF7\tJoins selected junctions into a single junction.", - 0, this, MID_GNE_JOIN_JUNCTIONS); + "Join Selected Junctions\tF7\tJoins selected junctions into a single junction.", + GUIIconSubSys::getIcon(ICON_JOINJUNCTIONS), this, MID_GNE_JOIN_JUNCTIONS); new FXMenuCommand(myProcessingMenu, - "&Options\t\tConfigure Processing Options.", - 0, this, MID_GNE_OPTIONS); - + "Options\tF10\t\tConfigure Processing Options.", + GUIIconSubSys::getIcon(ICON_OPTIONS), this, MID_GNE_OPTIONS); // build settings menu /* mySettingsMenu = new FXMenuPane(this); @@ -474,18 +490,18 @@ new FXMenuCheck(mySettingsMenu, "Gaming Mode\t\tToggle gaming mode on/off.", this,MID_GAMING); - */ + */ // build Locate menu myLocatorMenu = new FXMenuPane(this); new FXMenuTitle(myMenuBar, "&Locate", NULL, myLocatorMenu); new FXMenuCommand(myLocatorMenu, - "Locate &Junctions\t\tOpen a Dialog for Locating a Junction.", + "Locate &Junctions\tShift+J\tOpen a Dialog for Locating a Junction.", GUIIconSubSys::getIcon(ICON_LOCATEJUNCTION), this, MID_LOCATEJUNCTION); new FXMenuCommand(myLocatorMenu, - "Locate &Edges\t\tOpen a Dialog for Locating an Edge.", + "Locate &Edges\tShift+E\tOpen a Dialog for Locating an Edge.", GUIIconSubSys::getIcon(ICON_LOCATEEDGE), this, MID_LOCATEEDGE); new FXMenuCommand(myLocatorMenu, - "Locate &TLS\t\tOpen a Dialog for Locating a Traffic Light.", + "Locate &TLS\tShift+T\tOpen a Dialog for Locating a Traffic Light.", GUIIconSubSys::getIcon(ICON_LOCATETLS), this, MID_LOCATETLS); // build windows menu @@ -526,9 +542,15 @@ // build help menu myHelpMenu = new FXMenuPane(this); - new FXMenuTitle(myMenuBar, "&Help", 0, myHelpMenu); - new FXMenuCommand(myHelpMenu, "&Online Documentation", 0, this, MID_HELP); - new FXMenuCommand(myHelpMenu, "&About", 0, this, MID_ABOUT); + new FXMenuTitle(myMenuBar, + "&Help", + 0, myHelpMenu); + new FXMenuCommand(myHelpMenu, + "&Online Documentation\tF1\tOpen Online documentation.", + 0, this, MID_HELP); + new FXMenuCommand(myHelpMenu, + "&About\tF2\tAbout netedit.", + 0, this, MID_ABOUT); } @@ -695,13 +717,15 @@ // Start operation for undo/redo myUndoList->p_begin("load additionals"); // Create additional handler - GNEAdditionalHandler additionalHandler(file, getView()); + GNEAdditionalHandler additionalHandler(file, myNet->getViewNet()); // Run parser if (!XMLSubSys::runParser(additionalHandler, file, false)) { WRITE_MESSAGE("Loading of " + file + " failed."); // Abort undo/redo myUndoList->abort(); } else { + // reset last tag (needed if user want to load more additionals) + additionalHandler.resetLastTag(); // commit undo/redo operation myUndoList->p_end(); update(); @@ -767,8 +791,7 @@ long GNEApplicationWindow::onCmdAbout(FXObject*, FXSelector, void*) { - GNEDialog_About* about = - new GNEDialog_About(this); + GNEDialog_About* about = new GNEDialog_About(this); about->create(); about->show(PLACEMENT_OWNER); return 1; @@ -848,15 +871,24 @@ } getApp()->endWaitCursor(); myMessageWindow->registerMsgHandlers(); - if (OptionsCont::getOptions().isSet("sumo-additionals-file")) { - std::string additionalFile = OptionsCont::getOptions().getString("sumo-additionals-file"); - WRITE_MESSAGE("Loading additionals from '" + additionalFile + "'"); - GNEAdditionalHandler additionalHandler(additionalFile, myNet->getViewNet()); + // check if additionals has to be loaded at start + if (OptionsCont::getOptions().isSet("sumo-additionals-file") && myNet) { + myAdditionalsFile = OptionsCont::getOptions().getString("sumo-additionals-file"); + WRITE_MESSAGE("Loading additionals from '" + myAdditionalsFile + "'"); + GNEAdditionalHandler additionalHandler(myAdditionalsFile, myNet->getViewNet()); // Run parser - if (!XMLSubSys::runParser(additionalHandler, additionalFile, false)) { - WRITE_ERROR("Loading of " + additionalFile + " failed."); + if (!XMLSubSys::runParser(additionalHandler, myAdditionalsFile, false)) { + WRITE_ERROR("Loading of " + myAdditionalsFile + " failed."); + } else { + // reset last tag (needed if user want to load more additionals) + additionalHandler.resetLastTag(); } } + // check if additionals output must be changed + if (OptionsCont::getOptions().isSet("additionals-output")) { + myAdditionalsFile = OptionsCont::getOptions().getString("additionals-output"); + } + update(); } @@ -893,19 +925,16 @@ GNEApplicationWindow::openNewView() { std::string caption = "View #" + toString(myViewNumber++); FXuint opts = MDI_TRACKING; - GNEViewParent* w = new GNEViewParent(myMDIClient, - myMDIMenu, FXString(caption.c_str()), this, - getBuildGLCanvas(), myNet, myUndoList, - GUIIconSubSys::getIcon(ICON_EMPTY), - opts, 10, 10, 300, 200); + GNEViewParent* viewParent = new GNEViewParent(myMDIClient, myMDIMenu, FXString(caption.c_str()), this, getBuildGLCanvas(), + myNet, myUndoList, NULL, opts, 10, 10, 300, 200); if (myMDIClient->numChildren() == 1) { - w->maximize(); + viewParent->maximize(); } else { myMDIClient->vertical(true); } - myMDIClient->setActiveChild(w); + myMDIClient->setActiveChild(viewParent); //v->grabKeyboard(); - return w->getView(); + return viewParent->getView(); } @@ -969,7 +998,7 @@ } myMessageWindow->unregisterMsgHandlers(); // Reset textures - GUITextureSubSys::reset(); + GUITextureSubSys::resetTextures(); } @@ -987,9 +1016,15 @@ void -GNEApplicationWindow::setStatusBarText(const std::string& text) { - myStatusbar->getStatusLine()->setText(text.c_str()); - myStatusbar->getStatusLine()->setNormalText(text.c_str()); +GNEApplicationWindow::setStatusBarText(const std::string& statusBarText) { + myStatusbar->getStatusLine()->setText(statusBarText.c_str()); + myStatusbar->getStatusLine()->setNormalText(statusBarText.c_str()); +} + + +void +GNEApplicationWindow::setAdditionalsFile(const std::string& additionalsFile) { + myAdditionalsFile = additionalsFile; } @@ -1031,6 +1066,24 @@ long +GNEApplicationWindow::onCmdFocusFrame(FXObject*, FXSelector, void*) { + if (getView()) { + getView()->hotkeyFocusFrame(); + } + return 1; +} + + +long +GNEApplicationWindow::onCmdEditViewport(FXObject*, FXSelector, void*) { + if (getView()) { + getView()->showViewportEditor(); + } + return 1; +} + + +long GNEApplicationWindow::onCmdHelp(FXObject*, FXSelector, void*) { FXLinkLabel::fxexecute("http://sumo.dlr.de/wiki/NETEDIT"); return 1; @@ -1092,7 +1145,7 @@ long GNEApplicationWindow::onCmdSaveAsPlainXML(FXObject*, FXSelector, void*) { FXString file = MFXUtils::getFilename2Write(this, - "Select name of the plain-xml edge-file (other names will be deduced from this)", ".edg.xml", + "Select name of the plain-xml edge-file (other names will be deduced from this)", "", GUIIconSubSys::getIcon(ICON_EMPTY), gCurrentFolder); if (file == "") { @@ -1103,7 +1156,10 @@ std::string oldPrefix = oc.getString("plain-output-prefix"); oc.resetWritable(); std::string prefix = file.text(); - prefix = prefix.substr(0, prefix.size() - 8); + // if last character is a dot, remove it + if (prefix.at(prefix.size() - 1) == '.') { + prefix = prefix.substr(0, prefix.size() - 1); + } oc.set("plain-output-prefix", prefix); getApp()->beginWaitCursor(); try { @@ -1111,7 +1167,16 @@ myUndoList->unmark(); myUndoList->mark(); } catch (IOError& e) { + // write warning if netedit is running in testing mode + if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Opening FXMessageBox of type 'error'"); + } + // open message box FXMessageBox::error(this, MBOX_OK, "Saving plain xml failed!", "%s", e.what()); + // write warning if netedit is running in testing mode + if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'error' with 'OK'"); + } } myMessageWindow->appendMsg(EVENT_MESSAGE_OCCURED, "Plain XML saved with prefix '" + prefix + "'.\n"); myMessageWindow->addSeparator(); @@ -1145,7 +1210,16 @@ try { myNet->saveJoined(oc); } catch (IOError& e) { + // write warning if netedit is running in testing mode + if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Opening FXMessageBox of type 'error'"); + } + // opening error message FXMessageBox::error(this, MBOX_OK, "Saving joined junctions failed!", "%s", e.what()); + // write warning if netedit is running in testing mode + if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'error' with 'OK'"); + } } myMessageWindow->appendMsg(EVENT_MESSAGE_OCCURED, "Joined junctions saved to '" + filename + "'.\n"); myMessageWindow->addSeparator(); @@ -1175,7 +1249,16 @@ try { GNEPOI::saveToFile(filename); } catch (IOError& e) { + // write warning if netedit is running in testing mode + if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Opening FXMessageBox of type 'error'"); + } + // open error dialog box FXMessageBox::error(this, MBOX_OK, "Saving POIs failed!", "%s", e.what()); + // write warning if netedit is running in testing mode + if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'error' with 'OK'"); + } } myMessageWindow->addSeparator(); getApp()->endWaitCursor(); @@ -1199,46 +1282,67 @@ long GNEApplicationWindow::onCmdSaveNetwork(FXObject*, FXSelector, void*) { - getApp()->beginWaitCursor(); - try { - OptionsCont& oc = OptionsCont::getOptions(); - myNet->save(oc); - myUndoList->unmark(); - myUndoList->mark(); - } catch (IOError& e) { - FXMessageBox::error(this, MBOX_OK, "Saving Network failed!", "%s", e.what()); + OptionsCont& oc = OptionsCont::getOptions(); + // function onCmdSaveAsNetwork must be executed if this is the first save + if (oc.getString("output-file") == "") { + return onCmdSaveAsNetwork(0, 0, 0); + } else { + getApp()->beginWaitCursor(); + try { + myNet->save(oc); + myUndoList->unmark(); + myUndoList->mark(); + } catch (IOError& e) { + // write warning if netedit is running in testing mode + if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Opening FXMessageBox of type 'error'"); + } + // open error message box + FXMessageBox::error(this, MBOX_OK, "Saving Network failed!", "%s", e.what()); + // write warning if netedit is running in testing mode + if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'error' with 'OK'"); + } + } + myMessageWindow->appendMsg(EVENT_MESSAGE_OCCURED, "Network saved in " + oc.getString("output-file") + ".\n"); + myMessageWindow->addSeparator(); + getApp()->endWaitCursor(); + return 1; } - myMessageWindow->appendMsg(EVENT_MESSAGE_OCCURED, "Network saved.\n"); - myMessageWindow->addSeparator(); - getApp()->endWaitCursor(); - return 1; } long GNEApplicationWindow::onCmdSaveAdditionals(FXObject*, FXSelector, void*) { - OptionsCont& oc = OptionsCont::getOptions(); - std::string filename; - if (!oc.isSet("additionals-output")) { + // Check if additionals file was already set at start of netedit or with a previous save + if (myAdditionalsFile == "") { FXString file = MFXUtils::getFilename2Write(this, "Select name of the additional file", ".xml", GUIIconSubSys::getIcon(ICON_EMPTY), gCurrentFolder); if (file == "") { - return 1; + // None additionals file was selected, then stop function + return 0; } else { - oc.set("additionals-output", file.text()); - filename = file.text(); + myAdditionalsFile = file.text(); } - } else { - filename = oc.getString("additionals-output"); } + // Start saving additionals getApp()->beginWaitCursor(); try { - myNet->saveAdditionals(filename); - myMessageWindow->appendMsg(EVENT_MESSAGE_OCCURED, "Additionals saved.\n"); + myNet->saveAdditionals(myAdditionalsFile); + myMessageWindow->appendMsg(EVENT_MESSAGE_OCCURED, "Additionals saved in " + myAdditionalsFile + ".\n"); } catch (IOError& e) { + // write warning if netedit is running in testing mode + if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Opening FXMessageBox of type 'error'"); + } + // open error message box FXMessageBox::error(this, MBOX_OK, "Saving additionals failed!", "%s", e.what()); + // write warning if netedit is running in testing mode + if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'error' with 'OK'"); + } } myMessageWindow->addSeparator(); getApp()->endWaitCursor(); @@ -1248,25 +1352,19 @@ long GNEApplicationWindow::onCmdSaveAdditionalsAs(FXObject*, FXSelector, void*) { + // Open window to select additionasl file FXString file = MFXUtils::getFilename2Write(this, "Select name of the additional file", ".xml", GUIIconSubSys::getIcon(ICON_EMPTY), gCurrentFolder); if (file != "") { - OptionsCont& oc = OptionsCont::getOptions(); - oc.set("additionals-output", file.text()); - std::string filename = file.text(); - getApp()->beginWaitCursor(); - try { - myNet->saveAdditionals(filename); - myMessageWindow->appendMsg(EVENT_MESSAGE_OCCURED, "Additionals saved.\n"); - } catch (IOError& e) { - FXMessageBox::error(this, MBOX_OK, "Saving additionals failed!", "%s", e.what()); - } - myMessageWindow->addSeparator(); - getApp()->endWaitCursor(); + // Set new additional file + myAdditionalsFile = file.text(); + // save additionals + return onCmdSaveAdditionals(0, 0, 0); + } else { + return 1; } - return 1; } @@ -1295,19 +1393,82 @@ bool GNEApplicationWindow::continueWithUnsavedChanges() { + FXuint answer = 0; if (myUndoList->canUndo() && !myUndoList->marked()) { - FXuint answer = FXMessageBox::question(this, MBOX_YES_NO, - "Confirm Closing Network", "%s", - "You have unsaved changes. Do you wish to close the network and discard all changes?"); - if (answer == 1) { //1:yes, 2:no, 4:esc - myUndoList->p_clear(); // only ask once - return true; + // write warning if netedit is running in testing mode + if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Opening FXMessageBox of type 'question'"); + } + // open question box + answer = FXMessageBox::question(this, MBOX_QUIT_SAVE_CANCEL, + "Confirm closing Network", "%s", + "You have unsaved changes in the network. Do you wish to quit and discard all changes?"); + if (answer == MBOX_CLICKED_QUIT) { + // write warning if netedit is running in testing mode + if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Quit'"); + } + return continueWithUnsavedAdditionalChanges(); + } else if (answer == MBOX_CLICKED_SAVE) { + onCmdSaveNetwork(0, 0, 0); + if (!myUndoList->marked()) { + // saving failed + return false; + } + return continueWithUnsavedAdditionalChanges(); } else { + // write warning if netedit is running in testing mode + if ((answer == 2) && ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true))) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'"); + } else if ((answer == 4) && ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true))) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'"); + } + // return false to stop closing/reloading return false; } } else { - return true; + return continueWithUnsavedAdditionalChanges(); + } +} + +bool +GNEApplicationWindow::continueWithUnsavedAdditionalChanges() { + // Check if there are non saved additionals + if ((myNet != NULL) && (myNet->getNumberOfAdditionals() > 0) && (myNet->isAdditionalsSaved() == false)) { + if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Opening FXMessageBox of type 'question'"); + } + // open question box + FXuint answer = FXMessageBox::question(this, MBOX_QUIT_SAVE_CANCEL, + "Save additionals before exit", "%s", + "You have unsaved additionals. Do you wish to quit and discard all changes?"); + // if answer was affirmative, but there was an error during saving additional, return false to stop closing/reloading + if (answer == MBOX_CLICKED_QUIT) { + if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Quit'"); + } + return true; + } else if (answer == MBOX_CLICKED_SAVE) { + // write warning if netedit is running in testing mode + if ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Yes'"); + } + if (onCmdSaveAdditionals(0, 0, 0) == 0) { + return false; + } + } else { + // write warning if netedit is running in testing mode + if ((answer == 2) && ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true))) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'"); + } else if ((answer == 4) && ((myNet != NULL) && (myNet->getViewNet()->isTestingModeEnabled() == true))) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'"); + } + return false; + } } + // clear undo list and return true to continue with closing/reload + myUndoList->p_clear(); //only ask once + return true; } @@ -1320,14 +1481,18 @@ Position -GNEApplicationWindow::GNEShapeHandler::getLanePos(const std::string& poiID, const std::string& laneID, SUMOReal lanePos) { +GNEApplicationWindow::GNEShapeHandler::getLanePos(const std::string& poiID, const std::string& laneID, double lanePos) { std::string edgeID = laneID; int lane = 0; const std::string::size_type underscore = laneID.rfind('_'); if (underscore != std::string::npos) { edgeID = laneID.substr(0, underscore); - lane = TplConvert::_2intSec(laneID.substr(underscore).c_str(), 0); + if (laneID.substr(underscore).empty()) { + lane = 0; + } else { + lane = GNEAttributeCarrier::parse(laneID.substr(underscore).c_str()); + } } NBEdge* edge = myNet->retrieveEdge(edgeID)->getNBEdge(); if (edge == 0 || edge->getNumLanes() <= lane) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEApplicationWindow.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEApplicationWindow.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEApplicationWindow.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEApplicationWindow.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEApplicationWindow.h /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNEApplicationWindow.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEApplicationWindow.h 23977 2017-04-19 14:46:38Z namdre $ /// // The main window of Netedit (adapted from GUIApplicationWindow) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -67,8 +67,7 @@ * may also have some further views (children) assigned which are stored * within a separate list. */ -class GNEApplicationWindow : - public GUIMainWindow, public MFXInterThreadEventClient { +class GNEApplicationWindow : public GUIMainWindow, public MFXInterThreadEventClient { /// @brief FOX-declaration FXDECLARE(GNEApplicationWindow) @@ -96,7 +95,10 @@ void dependentBuild(); /// @brief set text of the statusBar - void setStatusBarText(const std::string&); + void setStatusBarText(const std::string& statusBarText); + + /// @brief set additionals file + void setAdditionalsFile(const std::string& additionalsFile); /// @name Inter-thread event handling /// @{ @@ -222,6 +224,12 @@ /// @brief called if the user hits enter long onCmdEnter(FXObject* sender, FXSelector sel, void* ptr); + /// @brief called if the user hits f + long onCmdFocusFrame(FXObject* sender, FXSelector sel, void* ptr); + + /// @brief called if the user press key v to open zoom editor + long onCmdEditViewport(FXObject*, FXSelector, void*); + /// @brief called if the user selects help->Documentation long onCmdHelp(FXObject* sender, FXSelector sel, void* ptr); @@ -254,10 +262,10 @@ void updateControls(); protected: - /// FOX needs this for static members - GNEApplicationWindow() { } + /// @brief FOX needs this for static members + GNEApplicationWindow() {} - /// Builds the menu bar + /// @brief Builds the menu bar virtual void fillMenuBar(); /// @brief the name of the simulation @@ -275,8 +283,8 @@ /// @brief the submenus FXMenuPane* myFileMenu, *myEditMenu, - *myLocatorMenu, *myProcessingMenu, + *myLocatorMenu, *myWindowsMenu, *myHelpMenu; @@ -327,6 +335,9 @@ /// @brief the prefix for the window title const FXString myTitlePrefix; + /// @brief filename for load/save additionals + std::string myAdditionalsFile; + /** * @class GNEShapeHandler * @brief The XML-Handler for shapes loading network loading @@ -350,7 +361,7 @@ * @param[in] laneID lane ID * @param[in] SlanePos position in the lane */ - Position getLanePos(const std::string& poiID, const std::string& laneID, SUMOReal lanePos); + Position getLanePos(const std::string& poiID, const std::string& laneID, double lanePos); private: /// @brief pointer of the net @@ -364,7 +375,7 @@ /// @brief this method closes all windows and deletes the current simulation */ void closeAllWindows(); - /// @brief opens a new simulation display */ + /// @brief opens a new simulation display GUISUMOAbstractView* openNewView(); /// @brief convenience method @@ -372,6 +383,7 @@ /// @brief warns about unsaved changes and gives the user the option to abort bool continueWithUnsavedChanges(); + bool continueWithUnsavedAdditionalChanges(); }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAttributeCarrier.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAttributeCarrier.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAttributeCarrier.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAttributeCarrier.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEAttributeCarrier.cpp /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNEAttributeCarrier.cpp 21721 2016-10-17 13:47:02Z namdre $ +/// @version $Id: GNEAttributeCarrier.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Abstract Base class for gui objects which carry attributes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,38 +31,44 @@ #include #include #include +#include #include "GNEAttributeCarrier.h" #include "GNEUndoList.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members // =========================================================================== std::map > > GNEAttributeCarrier::_allowedAttributes; -std::vector GNEAttributeCarrier::myAllowedTags; std::vector GNEAttributeCarrier::myAllowedNetElementTags; std::vector GNEAttributeCarrier::myAllowedAdditionalTags; -std::set GNEAttributeCarrier::myNumericalIntAttrs; -std::set GNEAttributeCarrier::myNumericalFloatAttrs; -std::set GNEAttributeCarrier::myListAttrs; -std::set GNEAttributeCarrier::myUniqueAttrs; +std::map > GNEAttributeCarrier::myNumericalIntAttrs; +std::map > GNEAttributeCarrier::myNumericalFloatAttrs; +std::map > GNEAttributeCarrier::myTimeAttrs; +std::map > GNEAttributeCarrier::myBoolAttrs; +std::map > GNEAttributeCarrier::myListAttrs; +std::map > GNEAttributeCarrier::myUniqueAttrs; +std::map > GNEAttributeCarrier::myNonEditableAttrs; +std::map > GNEAttributeCarrier::myPositiveAttrs; +std::map > GNEAttributeCarrier::myProbabilityAttrs; +std::map > GNEAttributeCarrier::myFileAttrs; std::map GNEAttributeCarrier::myAllowedAdditionalWithParentTags; std::map > > GNEAttributeCarrier::myDiscreteChoices; std::map > GNEAttributeCarrier::myAttrDefinitions; +int GNEAttributeCarrier::myMaxNumAttribute = 0; const std::string GNEAttributeCarrier::LOADED = "loaded"; const std::string GNEAttributeCarrier::GUESSED = "guessed"; const std::string GNEAttributeCarrier::MODIFIED = "modified"; const std::string GNEAttributeCarrier::APPROVED = "approved"; +#define NODEFAULTVALUE "" + // =========================================================================== // method definitions // =========================================================================== -GNEAttributeCarrier::GNEAttributeCarrier(SumoXMLTag tag) : - myTag(tag) { +GNEAttributeCarrier::GNEAttributeCarrier(SumoXMLTag tag, GUIIcon icon) : + myTag(tag), + myIcon(icon) { } @@ -72,9 +78,9 @@ } -template<> SUMOReal +template<> double GNEAttributeCarrier::parse(const std::string& string) { - return TplConvert::_str2SUMOReal(string); + return TplConvert::_str2double(string); } @@ -84,6 +90,77 @@ } +template<> std::string +GNEAttributeCarrier::parse(const std::string& string) { + return string; +} + + +template<> SUMOVehicleClass +GNEAttributeCarrier::parse(const std::string& string) { + if (string.size() == 0) { + throw EmptyData(); + } else if (SumoVehicleClassStrings.hasString(string) == false) { + return SVC_IGNORING; + } else { + return SumoVehicleClassStrings.get(string); + } +} + + +template<> SUMOVehicleShape +GNEAttributeCarrier::parse(const std::string& string) { + if (string.size() == 0) { + throw EmptyData(); + } else if ((string == "unknown") || (SumoVehicleShapeStrings.hasString(string) == false)) { + return SVS_UNKNOWN; + } else { + return SumoVehicleShapeStrings.get(string); + } +} + + +template<> std::vector +GNEAttributeCarrier::parse(const std::string& string) { + std::vector parsedValues; + SUMOSAXAttributes::parseStringVector(string, parsedValues); + return parsedValues; +} + + +template<> std::vector +GNEAttributeCarrier::parse(const std::string& string) { + std::vector parsedValues = parse >(string); + std::vector parsedIntValues; + for (std::vector::const_iterator i = parsedValues.begin(); i != parsedValues.end(); i++) { + parsedIntValues.push_back(parse(*i)); + } + return parsedIntValues; +} + + +template<> std::vector +GNEAttributeCarrier::parse(const std::string& string) { + std::vector parsedValues = parse >(string); + std::vector parsedDoubleValues; + for (std::vector::const_iterator i = parsedValues.begin(); i != parsedValues.end(); i++) { + parsedDoubleValues.push_back(parse(*i)); + } + return parsedDoubleValues; +} + + +template<> std::vector +GNEAttributeCarrier::parse(const std::string& string) { + std::vector parsedValues = parse >(string); + std::vector parsedBoolValues; + for (std::vector::const_iterator i = parsedValues.begin(); i != parsedValues.end(); i++) { + parsedBoolValues.push_back(parse(*i)); + } + return parsedBoolValues; +} + + bool GNEAttributeCarrier::isValid(SumoXMLAttr key, const std::string& value) { UNUSED_PARAMETER(value); @@ -103,6 +180,18 @@ } +FXIcon* +GNEAttributeCarrier::getIcon() const { + return GUIIconSubSys::getIcon(myIcon); +} + + +GUIIcon +GNEAttributeCarrier::getGUIIcon() const { + return myIcon; +} + + std::vector GNEAttributeCarrier::getAttrs() const { std::vector attr; @@ -119,12 +208,22 @@ } -SumoXMLTag -GNEAttributeCarrier::getParentType(SumoXMLTag tag) { - if (hasParent(tag)) { - return myAllowedAdditionalWithParentTags[tag]; +std::string +GNEAttributeCarrier::getAttributeType(SumoXMLTag tag, SumoXMLAttr attr) { + if (isInt(tag, attr)) { + return "int"; + } else if (isFloat(tag, attr)) { + return "float"; + } else if (isTime(tag, attr)) { + return "time"; + } else if (isBool(tag, attr)) { + return "bool"; + } else if (isString(tag, attr)) { + return "string"; + } else if (isList(tag, attr)) { + return "list"; } else { - return SUMO_TAG_NOTHING; + throw ProcessError("Undeterminted type for '" + toString(tag) + "' '" + toString(attr) + "'"); } } @@ -136,48 +235,13 @@ bool -GNEAttributeCarrier::isValidFileValue(const std::string& value) { +GNEAttributeCarrier::isValidFilename(const std::string& value) { // @note Only characteres that aren't permited in a file path or belong // to XML sintax - return value.find_first_of("\t\n\r@$%^&|\\{}*'\";:<>") == std::string::npos; + return (value.find_first_of("\t\n\r@$%^&|\\{}*'\";:<>") == std::string::npos); } -bool -GNEAttributeCarrier::isValidStringVector(const std::string& value) { - // 1) check if value is empty - if (value.empty()) { - return true; - } - // 2) Check if there are duplicated spaces - for (int i = 1; i < (int)value.size(); i++) { - if (value.at(i - 1) == ' ' && value.at(i) == ' ') { - return false; - } - } - // 3) Check if the first and last character aren't spaces - if ((value.at(0) == ' ') || (value.at(value.size() - 1) == ' ')) { - return false; - } - // 4) Check if every sub-string is valid - int index = 0; - std::string subString; - while (index < (int)value.size()) { - if (value.at(index) == ' ') { - if (!isValidFileValue(subString)) { - return false; - } else { - subString.clear(); - } - } else { - subString.push_back(value.at(index)); - } - index++; - } - // 5) All right, then return true - return true; -} - // =========================================================================== // static methods // =========================================================================== @@ -189,63 +253,62 @@ std::vector >& attrs = _allowedAttributes[tag]; switch (tag) { case SUMO_TAG_EDGE: - attrs.push_back(std::pair(SUMO_ATTR_ID, "")); - attrs.push_back(std::pair(SUMO_ATTR_FROM, "")); - attrs.push_back(std::pair(SUMO_ATTR_TO, "")); - attrs.push_back(std::pair(SUMO_ATTR_SPEED, "")); - attrs.push_back(std::pair(SUMO_ATTR_PRIORITY, "")); - attrs.push_back(std::pair(SUMO_ATTR_NUMLANES, "")); + attrs.push_back(std::pair(SUMO_ATTR_ID, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_FROM, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_TO, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_SPEED, "13.89")); + attrs.push_back(std::pair(SUMO_ATTR_PRIORITY, "1")); + attrs.push_back(std::pair(SUMO_ATTR_NUMLANES, "1")); attrs.push_back(std::pair(SUMO_ATTR_TYPE, "")); - attrs.push_back(std::pair(SUMO_ATTR_ALLOW, "")); + attrs.push_back(std::pair(SUMO_ATTR_ALLOW, "all")); attrs.push_back(std::pair(SUMO_ATTR_DISALLOW, "")); //attrs.push_back(std::pair(SUMO_ATTR_PREFER, )); attrs.push_back(std::pair(SUMO_ATTR_SHAPE, "")); - attrs.push_back(std::pair(SUMO_ATTR_LENGTH, "")); - attrs.push_back(std::pair(SUMO_ATTR_SPREADTYPE, "")); + attrs.push_back(std::pair(SUMO_ATTR_LENGTH, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_SPREADTYPE, "right")); attrs.push_back(std::pair(SUMO_ATTR_NAME, "")); - attrs.push_back(std::pair(SUMO_ATTR_WIDTH, "")); - attrs.push_back(std::pair(SUMO_ATTR_ENDOFFSET, "")); + attrs.push_back(std::pair(SUMO_ATTR_WIDTH, "default")); + attrs.push_back(std::pair(SUMO_ATTR_ENDOFFSET, "0")); + attrs.push_back(std::pair(GNE_ATTR_SHAPE_START, "")); // virtual attribute used to define an endPoint + attrs.push_back(std::pair(GNE_ATTR_SHAPE_END, "")); // virtual attribute from to define an endPoint break; case SUMO_TAG_JUNCTION: - attrs.push_back(std::pair(SUMO_ATTR_ID, "")); - /* virtual attribute from the combination of the actuall - * attributes SUMO_ATTR_X, SUMO_ATTR_Y */ - attrs.push_back(std::pair(SUMO_ATTR_POSITION, "")); + attrs.push_back(std::pair(SUMO_ATTR_ID, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_POSITION, NODEFAULTVALUE)); // virtual attribute from the combination of the actually attributes SUMO_ATTR_X, SUMO_ATTR_Y attrs.push_back(std::pair(SUMO_ATTR_TYPE, "")); attrs.push_back(std::pair(SUMO_ATTR_SHAPE, "")); - attrs.push_back(std::pair(SUMO_ATTR_RADIUS, "")); - attrs.push_back(std::pair(SUMO_ATTR_KEEP_CLEAR, "")); + attrs.push_back(std::pair(SUMO_ATTR_RADIUS, "1.5")); + attrs.push_back(std::pair(SUMO_ATTR_KEEP_CLEAR, "true")); attrs.push_back(std::pair(SUMO_ATTR_TLTYPE, "")); attrs.push_back(std::pair(SUMO_ATTR_TLID, "")); break; case SUMO_TAG_LANE: - attrs.push_back(std::pair(SUMO_ATTR_ID, "")); - attrs.push_back(std::pair(SUMO_ATTR_SPEED, "")); - attrs.push_back(std::pair(SUMO_ATTR_ALLOW, "")); + attrs.push_back(std::pair(SUMO_ATTR_ID, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_SPEED, "13.89")); + attrs.push_back(std::pair(SUMO_ATTR_ALLOW, "all")); attrs.push_back(std::pair(SUMO_ATTR_DISALLOW, "")); //attrs.push_back(std::pair(SUMO_ATTR_PREFER, )); - attrs.push_back(std::pair(SUMO_ATTR_WIDTH, "")); - attrs.push_back(std::pair(SUMO_ATTR_ENDOFFSET, "")); - attrs.push_back(std::pair(SUMO_ATTR_INDEX, "")); // read-only attribute + attrs.push_back(std::pair(SUMO_ATTR_WIDTH, "default")); + attrs.push_back(std::pair(SUMO_ATTR_ENDOFFSET, "0")); + attrs.push_back(std::pair(SUMO_ATTR_ACCELERATION, "false")); + attrs.push_back(std::pair(SUMO_ATTR_INDEX, NODEFAULTVALUE)); break; case SUMO_TAG_POI: - attrs.push_back(std::pair(SUMO_ATTR_ID, "")); - /* virtual attribute from the combination of the actuall - * attributes SUMO_ATTR_X, SUMO_ATTR_Y */ - attrs.push_back(std::pair(SUMO_ATTR_POSITION, "")); + attrs.push_back(std::pair(SUMO_ATTR_ID, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_POSITION, NODEFAULTVALUE)); // virtual attribute from the combination of the actually attributes SUMO_ATTR_X, SUMO_ATTR_Y attrs.push_back(std::pair(SUMO_ATTR_TYPE, "")); break; case SUMO_TAG_CROSSING: - attrs.push_back(std::pair(SUMO_ATTR_ID, "")); - attrs.push_back(std::pair(SUMO_ATTR_PRIORITY, "")); - attrs.push_back(std::pair(SUMO_ATTR_WIDTH, "")); - attrs.push_back(std::pair(SUMO_ATTR_EDGES, "")); + attrs.push_back(std::pair(SUMO_ATTR_ID, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_EDGES, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_PRIORITY, "false")); + attrs.push_back(std::pair(SUMO_ATTR_WIDTH, "3")); break; case SUMO_TAG_CONNECTION: - attrs.push_back(std::pair(SUMO_ATTR_FROM, "")); - attrs.push_back(std::pair(SUMO_ATTR_TO, "")); - attrs.push_back(std::pair(SUMO_ATTR_FROM_LANE, "")); - attrs.push_back(std::pair(SUMO_ATTR_TO_LANE, "")); + attrs.push_back(std::pair(SUMO_ATTR_FROM, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_TO, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_FROM_LANE, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_TO_LANE, NODEFAULTVALUE)); attrs.push_back(std::pair(SUMO_ATTR_PASS, "false")); attrs.push_back(std::pair(SUMO_ATTR_KEEP_CLEAR, "false")); attrs.push_back(std::pair(SUMO_ATTR_CONTPOS, "0")); @@ -253,41 +316,41 @@ attrs.push_back(std::pair(SUMO_ATTR_VISIBILITY_DISTANCE, "4.5")); break; case SUMO_TAG_BUS_STOP: - attrs.push_back(std::pair(SUMO_ATTR_ID, "")); - attrs.push_back(std::pair(SUMO_ATTR_LANE, "")); - attrs.push_back(std::pair(SUMO_ATTR_STARTPOS, "")); - attrs.push_back(std::pair(SUMO_ATTR_ENDPOS, "10")); + attrs.push_back(std::pair(SUMO_ATTR_ID, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_LANE, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_STARTPOS, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_ENDPOS, NODEFAULTVALUE)); attrs.push_back(std::pair(SUMO_ATTR_LINES, "")); break; case SUMO_TAG_CONTAINER_STOP: - attrs.push_back(std::pair(SUMO_ATTR_ID, "")); - attrs.push_back(std::pair(SUMO_ATTR_LANE, "")); - attrs.push_back(std::pair(SUMO_ATTR_STARTPOS, "")); - attrs.push_back(std::pair(SUMO_ATTR_ENDPOS, "10")); + attrs.push_back(std::pair(SUMO_ATTR_ID, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_LANE, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_STARTPOS, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_ENDPOS, NODEFAULTVALUE)); attrs.push_back(std::pair(SUMO_ATTR_LINES, "")); break; case SUMO_TAG_CHARGING_STATION: - attrs.push_back(std::pair(SUMO_ATTR_ID, "")); - attrs.push_back(std::pair(SUMO_ATTR_LANE, "")); - attrs.push_back(std::pair(SUMO_ATTR_STARTPOS, "")); - attrs.push_back(std::pair(SUMO_ATTR_ENDPOS, "10")); + attrs.push_back(std::pair(SUMO_ATTR_ID, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_LANE, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_STARTPOS, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_ENDPOS, NODEFAULTVALUE)); attrs.push_back(std::pair(SUMO_ATTR_CHARGINGPOWER, "22000")); attrs.push_back(std::pair(SUMO_ATTR_EFFICIENCY, "0.95")); attrs.push_back(std::pair(SUMO_ATTR_CHARGEINTRANSIT, "false")); attrs.push_back(std::pair(SUMO_ATTR_CHARGEDELAY, "0")); break; case SUMO_TAG_E1DETECTOR: - attrs.push_back(std::pair(SUMO_ATTR_ID, "")); - attrs.push_back(std::pair(SUMO_ATTR_LANE, "")); - attrs.push_back(std::pair(SUMO_ATTR_POSITION, "")); + attrs.push_back(std::pair(SUMO_ATTR_ID, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_LANE, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_POSITION, NODEFAULTVALUE)); attrs.push_back(std::pair(SUMO_ATTR_FREQUENCY, "100")); attrs.push_back(std::pair(SUMO_ATTR_FILE, "")); attrs.push_back(std::pair(SUMO_ATTR_SPLIT_VTYPE, "false")); break; case SUMO_TAG_E2DETECTOR: - attrs.push_back(std::pair(SUMO_ATTR_ID, "")); - attrs.push_back(std::pair(SUMO_ATTR_LANE, "")); - attrs.push_back(std::pair(SUMO_ATTR_POSITION, "")); + attrs.push_back(std::pair(SUMO_ATTR_ID, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_LANE, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_POSITION, NODEFAULTVALUE)); attrs.push_back(std::pair(SUMO_ATTR_LENGTH, "10")); attrs.push_back(std::pair(SUMO_ATTR_FREQUENCY, "100")); attrs.push_back(std::pair(SUMO_ATTR_FILE, "")); @@ -297,54 +360,117 @@ attrs.push_back(std::pair(SUMO_ATTR_JAM_DIST_THRESHOLD, "10")); break; case SUMO_TAG_E3DETECTOR: - attrs.push_back(std::pair(SUMO_ATTR_ID, "")); + attrs.push_back(std::pair(SUMO_ATTR_ID, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_X, "0")); + attrs.push_back(std::pair(SUMO_ATTR_Y, "0")); attrs.push_back(std::pair(SUMO_ATTR_FREQUENCY, "100")); attrs.push_back(std::pair(SUMO_ATTR_FILE, "")); attrs.push_back(std::pair(SUMO_ATTR_HALTING_TIME_THRESHOLD, "1")); attrs.push_back(std::pair(SUMO_ATTR_HALTING_SPEED_THRESHOLD, "1.39")); break; case SUMO_TAG_DET_ENTRY: - attrs.push_back(std::pair(SUMO_ATTR_LANE, "")); - attrs.push_back(std::pair(SUMO_ATTR_POSITION, "")); + attrs.push_back(std::pair(SUMO_ATTR_LANE, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_POSITION, NODEFAULTVALUE)); break; case SUMO_TAG_DET_EXIT: - attrs.push_back(std::pair(SUMO_ATTR_LANE, "")); - attrs.push_back(std::pair(SUMO_ATTR_POSITION, "")); + attrs.push_back(std::pair(SUMO_ATTR_LANE, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_POSITION, NODEFAULTVALUE)); break; case SUMO_TAG_VSS: - attrs.push_back(std::pair(SUMO_ATTR_ID, "")); + attrs.push_back(std::pair(SUMO_ATTR_ID, NODEFAULTVALUE)); attrs.push_back(std::pair(SUMO_ATTR_LANES, "")); attrs.push_back(std::pair(SUMO_ATTR_FILE, "")); break; case SUMO_TAG_CALIBRATOR: - attrs.push_back(std::pair(SUMO_ATTR_ID, "")); - attrs.push_back(std::pair(SUMO_ATTR_LANE, "")); - // Currently unused attrs.push_back(std::pair(SUMO_ATTR_POSITION, "")); + attrs.push_back(std::pair(SUMO_ATTR_ID, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_LANE, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_POSITION, "0")); attrs.push_back(std::pair(SUMO_ATTR_FREQUENCY, "100")); attrs.push_back(std::pair(SUMO_ATTR_ROUTEPROBE, "")); attrs.push_back(std::pair(SUMO_ATTR_OUTPUT, "")); break; case SUMO_TAG_REROUTER: - attrs.push_back(std::pair(SUMO_ATTR_ID, "")); - attrs.push_back(std::pair(SUMO_ATTR_EDGES, "")); + attrs.push_back(std::pair(SUMO_ATTR_ID, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_EDGES, NODEFAULTVALUE)); attrs.push_back(std::pair(SUMO_ATTR_FILE, "")); attrs.push_back(std::pair(SUMO_ATTR_PROB, "1")); attrs.push_back(std::pair(SUMO_ATTR_OFF, "false")); break; case SUMO_TAG_ROUTEPROBE: - attrs.push_back(std::pair(SUMO_ATTR_ID, "")); - attrs.push_back(std::pair(SUMO_ATTR_EDGE, "")); + attrs.push_back(std::pair(SUMO_ATTR_ID, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_EDGE, NODEFAULTVALUE)); attrs.push_back(std::pair(SUMO_ATTR_FREQUENCY, "100")); attrs.push_back(std::pair(SUMO_ATTR_FILE, "")); attrs.push_back(std::pair(SUMO_ATTR_BEGIN, "0")); break; case SUMO_TAG_VAPORIZER: - attrs.push_back(std::pair(SUMO_ATTR_EDGE, "")); + attrs.push_back(std::pair(SUMO_ATTR_EDGE, NODEFAULTVALUE)); attrs.push_back(std::pair(SUMO_ATTR_STARTTIME, "0")); attrs.push_back(std::pair(SUMO_ATTR_END, "10")); break; + case SUMO_TAG_FLOW: + attrs.push_back(std::pair(SUMO_ATTR_ID, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_TYPE, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_ROUTE, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_BEGIN, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_END, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_VEHSPERHOUR, "-1")); + attrs.push_back(std::pair(SUMO_ATTR_PERIOD, "-1")); + attrs.push_back(std::pair(SUMO_ATTR_PROB, "-1")); + attrs.push_back(std::pair(SUMO_ATTR_NUMBER, "100")); + attrs.push_back(std::pair(SUMO_ATTR_DEPARTLANE, "first")); + attrs.push_back(std::pair(SUMO_ATTR_DEPARTPOS, "base")); + attrs.push_back(std::pair(SUMO_ATTR_DEPARTSPEED, "0")); + attrs.push_back(std::pair(SUMO_ATTR_ARRIVALLANE, "current")); + attrs.push_back(std::pair(SUMO_ATTR_ARRIVALPOS, "max")); + attrs.push_back(std::pair(SUMO_ATTR_ARRIVALSPEED, "current")); + attrs.push_back(std::pair(SUMO_ATTR_LINE, "")); + attrs.push_back(std::pair(SUMO_ATTR_PERSON_NUMBER, "0")); + attrs.push_back(std::pair(SUMO_ATTR_CONTAINER_NUMBER, "0")); + attrs.push_back(std::pair(SUMO_ATTR_REROUTE, "false")); + attrs.push_back(std::pair(SUMO_ATTR_DEPARTPOS_LAT, "center")); + attrs.push_back(std::pair(SUMO_ATTR_ARRIVALPOS_LAT, "")); + break; + case SUMO_TAG_ROUTE: + attrs.push_back(std::pair(SUMO_ATTR_ID, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_EDGES, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_COLOR, "")); + break; + case SUMO_TAG_VTYPE: + attrs.push_back(std::pair(SUMO_ATTR_ID, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_ACCEL, "2.6")); + attrs.push_back(std::pair(SUMO_ATTR_DECEL, "4.5")); + attrs.push_back(std::pair(SUMO_ATTR_SIGMA, "0.5")); + attrs.push_back(std::pair(SUMO_ATTR_TAU, "1.0")); + attrs.push_back(std::pair(SUMO_ATTR_LENGTH, "5.0")); + attrs.push_back(std::pair(SUMO_ATTR_MINGAP, "2.5")); + attrs.push_back(std::pair(SUMO_ATTR_MAXSPEED, "70.0")); + attrs.push_back(std::pair(SUMO_ATTR_SPEEDFACTOR, "1.0")); + attrs.push_back(std::pair(SUMO_ATTR_SPEEDDEV, "0.0")); + attrs.push_back(std::pair(SUMO_ATTR_COLOR, "1,1,0")); + attrs.push_back(std::pair(SUMO_ATTR_VCLASS, "unknown")); + attrs.push_back(std::pair(SUMO_ATTR_EMISSIONCLASS, "P_7_7")); + attrs.push_back(std::pair(SUMO_ATTR_GUISHAPE, "unknown")); + attrs.push_back(std::pair(SUMO_ATTR_WIDTH, "2.0")); + attrs.push_back(std::pair(SUMO_ATTR_IMGFILE, "")); + attrs.push_back(std::pair(SUMO_ATTR_IMPATIENCE, "0.0")); + attrs.push_back(std::pair(SUMO_ATTR_LANE_CHANGE_MODEL, "LC2013")); + attrs.push_back(std::pair(SUMO_ATTR_CAR_FOLLOW_MODEL, "Krauss")); + attrs.push_back(std::pair(SUMO_ATTR_PERSON_CAPACITY, "4")); + attrs.push_back(std::pair(SUMO_ATTR_CONTAINER_CAPACITY, "0")); + attrs.push_back(std::pair(SUMO_ATTR_BOARDING_DURATION, "0.5")); + attrs.push_back(std::pair(SUMO_ATTR_LOADING_DURATION, "90.0")); + attrs.push_back(std::pair(SUMO_ATTR_LATALIGNMENT, "center")); + attrs.push_back(std::pair(SUMO_ATTR_MINGAP_LAT, "0.12")); + attrs.push_back(std::pair(SUMO_ATTR_MAXSPEED_LAT, "1.0")); + break; + case SUMO_TAG_STEP: + attrs.push_back(std::pair(SUMO_ATTR_TIME, NODEFAULTVALUE)); + attrs.push_back(std::pair(SUMO_ATTR_SPEED, "50.0")); + break; default: - WRITE_WARNING("allowed attributes for tag '" + toString(tag) + "' not defined"); + // Throw exception if tag isn't defined + throw ProcessError("allowed attributes for tag '" + toString(tag) + "' not defined"); } } return _allowedAttributes[tag]; @@ -352,166 +478,296 @@ const std::vector& -GNEAttributeCarrier::allowedTags() { - // define on first access - if (myAllowedTags.empty()) { - myAllowedTags.push_back(SUMO_TAG_JUNCTION); - myAllowedTags.push_back(SUMO_TAG_EDGE); - myAllowedTags.push_back(SUMO_TAG_LANE); - myAllowedTags.push_back(SUMO_TAG_CONNECTION); - myAllowedTags.push_back(SUMO_TAG_BUS_STOP); - myAllowedTags.push_back(SUMO_TAG_CONTAINER_STOP); - myAllowedTags.push_back(SUMO_TAG_CHARGING_STATION); - myAllowedTags.push_back(SUMO_TAG_E1DETECTOR); - myAllowedTags.push_back(SUMO_TAG_E2DETECTOR); - myAllowedTags.push_back(SUMO_TAG_E3DETECTOR); - myAllowedTags.push_back(SUMO_TAG_DET_ENTRY); - myAllowedTags.push_back(SUMO_TAG_DET_EXIT); - myAllowedTags.push_back(SUMO_TAG_VSS); - myAllowedTags.push_back(SUMO_TAG_CALIBRATOR); - myAllowedTags.push_back(SUMO_TAG_REROUTER); - myAllowedTags.push_back(SUMO_TAG_ROUTEPROBE); - myAllowedTags.push_back(SUMO_TAG_VAPORIZER); - } - return myAllowedTags; -} - - -const std::vector& -GNEAttributeCarrier::allowedNetElementTags() { +GNEAttributeCarrier::allowedTags(bool net) { // define on first access if (myAllowedNetElementTags.empty()) { - myAllowedNetElementTags.push_back(SUMO_TAG_JUNCTION); myAllowedNetElementTags.push_back(SUMO_TAG_EDGE); + myAllowedNetElementTags.push_back(SUMO_TAG_JUNCTION); myAllowedNetElementTags.push_back(SUMO_TAG_LANE); myAllowedNetElementTags.push_back(SUMO_TAG_CONNECTION); + myAllowedNetElementTags.push_back(SUMO_TAG_CROSSING); } - return myAllowedNetElementTags; -} - - -const std::vector& -GNEAttributeCarrier::allowedAdditionalTags() { - // define on first access if (myAllowedAdditionalTags.empty()) { myAllowedAdditionalTags.push_back(SUMO_TAG_BUS_STOP); - myAllowedAdditionalTags.push_back(SUMO_TAG_CONTAINER_STOP); + myAllowedAdditionalTags.push_back(SUMO_TAG_CALIBRATOR); myAllowedAdditionalTags.push_back(SUMO_TAG_CHARGING_STATION); + myAllowedAdditionalTags.push_back(SUMO_TAG_CONTAINER_STOP); + myAllowedAdditionalTags.push_back(SUMO_TAG_DET_ENTRY); + myAllowedAdditionalTags.push_back(SUMO_TAG_DET_EXIT); myAllowedAdditionalTags.push_back(SUMO_TAG_E1DETECTOR); myAllowedAdditionalTags.push_back(SUMO_TAG_E2DETECTOR); myAllowedAdditionalTags.push_back(SUMO_TAG_E3DETECTOR); - myAllowedAdditionalTags.push_back(SUMO_TAG_DET_ENTRY); - myAllowedAdditionalTags.push_back(SUMO_TAG_DET_EXIT); - myAllowedAdditionalTags.push_back(SUMO_TAG_VSS); - myAllowedAdditionalTags.push_back(SUMO_TAG_CALIBRATOR); myAllowedAdditionalTags.push_back(SUMO_TAG_REROUTER); myAllowedAdditionalTags.push_back(SUMO_TAG_ROUTEPROBE); myAllowedAdditionalTags.push_back(SUMO_TAG_VAPORIZER); + myAllowedAdditionalTags.push_back(SUMO_TAG_VSS); } - return myAllowedAdditionalTags; + return net ? myAllowedNetElementTags : myAllowedAdditionalTags; } bool -GNEAttributeCarrier::isNumerical(SumoXMLAttr attr) { - return (isInt(attr) || isFloat(attr)); +GNEAttributeCarrier::isNumerical(SumoXMLTag tag, SumoXMLAttr attr) { + return (isInt(tag, attr) || isFloat(tag, attr)); } bool -GNEAttributeCarrier::isInt(SumoXMLAttr attr) { +GNEAttributeCarrier::isInt(SumoXMLTag tag, SumoXMLAttr attr) { // define on first access if (myNumericalIntAttrs.empty()) { - myNumericalIntAttrs.insert(SUMO_ATTR_NUMLANES); - myNumericalIntAttrs.insert(SUMO_ATTR_PRIORITY); - myNumericalIntAttrs.insert(SUMO_ATTR_INDEX); - myNumericalIntAttrs.insert(SUMO_ATTR_CHARGEDELAY); - myNumericalIntAttrs.insert(SUMO_ATTR_FREQUENCY); - myNumericalIntAttrs.insert(SUMO_ATTR_HALTING_TIME_THRESHOLD); - myNumericalIntAttrs.insert(SUMO_ATTR_BEGIN); - myNumericalIntAttrs.insert(SUMO_ATTR_FROM_LANE); - myNumericalIntAttrs.insert(SUMO_ATTR_TO_LANE); + // connection + myNumericalIntAttrs[SUMO_TAG_CONNECTION].insert(SUMO_ATTR_FROM_LANE); + myNumericalIntAttrs[SUMO_TAG_CONNECTION].insert(SUMO_ATTR_TO_LANE); + // edge + myNumericalIntAttrs[SUMO_TAG_EDGE].insert(SUMO_ATTR_NUMLANES); + myNumericalIntAttrs[SUMO_TAG_EDGE].insert(SUMO_ATTR_PRIORITY); + // lane + myNumericalIntAttrs[SUMO_TAG_LANE].insert(SUMO_ATTR_INDEX); + // flow + myNumericalIntAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_PROB); + myNumericalIntAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_PERSON_NUMBER); + myNumericalIntAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_CONTAINER_NUMBER); + myNumericalIntAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_NUMBER); + // vehicle type + myNumericalIntAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_PERSON_CAPACITY); + myNumericalIntAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_CONTAINER_CAPACITY); } - return myNumericalIntAttrs.count(attr) == 1; + return myNumericalIntAttrs[tag].count(attr) == 1; } bool -GNEAttributeCarrier::isFloat(SumoXMLAttr attr) { +GNEAttributeCarrier::isFloat(SumoXMLTag tag, SumoXMLAttr attr) { // define on first access if (myNumericalFloatAttrs.empty()) { - myNumericalFloatAttrs.insert(SUMO_ATTR_SPEED); - myNumericalFloatAttrs.insert(SUMO_ATTR_LENGTH); - myNumericalFloatAttrs.insert(SUMO_ATTR_WIDTH); - myNumericalFloatAttrs.insert(SUMO_ATTR_ENDOFFSET); - myNumericalFloatAttrs.insert(SUMO_ATTR_RADIUS); - myNumericalFloatAttrs.insert(SUMO_ATTR_STARTPOS); - myNumericalFloatAttrs.insert(SUMO_ATTR_ENDPOS); - myNumericalFloatAttrs.insert(SUMO_ATTR_CHARGINGPOWER); - myNumericalFloatAttrs.insert(SUMO_ATTR_EFFICIENCY); - myNumericalFloatAttrs.insert(SUMO_ATTR_LENGTH); - myNumericalFloatAttrs.insert(SUMO_ATTR_HALTING_SPEED_THRESHOLD); - myNumericalFloatAttrs.insert(SUMO_ATTR_JAM_DIST_THRESHOLD); - myNumericalFloatAttrs.insert(SUMO_ATTR_PROB); - myNumericalFloatAttrs.insert(SUMO_ATTR_CONTPOS); - myNumericalFloatAttrs.insert(SUMO_ATTR_VISIBILITY_DISTANCE); - } - return myNumericalFloatAttrs.count(attr) == 1; + // bus stop + myNumericalFloatAttrs[SUMO_TAG_BUS_STOP].insert(SUMO_ATTR_ENDPOS); + myNumericalFloatAttrs[SUMO_TAG_BUS_STOP].insert(SUMO_ATTR_STARTPOS); + // charging station + myNumericalFloatAttrs[SUMO_TAG_CHARGING_STATION].insert(SUMO_ATTR_CHARGINGPOWER); + myNumericalFloatAttrs[SUMO_TAG_CHARGING_STATION].insert(SUMO_ATTR_EFFICIENCY); + myNumericalFloatAttrs[SUMO_TAG_CHARGING_STATION].insert(SUMO_ATTR_ENDPOS); + myNumericalFloatAttrs[SUMO_TAG_CHARGING_STATION].insert(SUMO_ATTR_STARTPOS); + // connection + myNumericalFloatAttrs[SUMO_TAG_CONNECTION].insert(SUMO_ATTR_CONTPOS); + myNumericalFloatAttrs[SUMO_TAG_CONNECTION].insert(SUMO_ATTR_VISIBILITY_DISTANCE); + // container stop + myNumericalFloatAttrs[SUMO_TAG_CONTAINER_STOP].insert(SUMO_ATTR_ENDPOS); + myNumericalFloatAttrs[SUMO_TAG_CONTAINER_STOP].insert(SUMO_ATTR_STARTPOS); + // crossing + myNumericalFloatAttrs[SUMO_TAG_CROSSING].insert(SUMO_ATTR_WIDTH); + // E2 + myNumericalFloatAttrs[SUMO_TAG_E2DETECTOR].insert(SUMO_ATTR_HALTING_SPEED_THRESHOLD); + myNumericalFloatAttrs[SUMO_TAG_E2DETECTOR].insert(SUMO_ATTR_JAM_DIST_THRESHOLD); + myNumericalFloatAttrs[SUMO_TAG_E2DETECTOR].insert(SUMO_ATTR_LENGTH); + // E3 + myNumericalFloatAttrs[SUMO_TAG_E3DETECTOR].insert(SUMO_ATTR_X); + myNumericalFloatAttrs[SUMO_TAG_E3DETECTOR].insert(SUMO_ATTR_Y); + myNumericalFloatAttrs[SUMO_TAG_E3DETECTOR].insert(SUMO_ATTR_HALTING_SPEED_THRESHOLD); + // Edge + myNumericalFloatAttrs[SUMO_TAG_EDGE].insert(SUMO_ATTR_ENDOFFSET); + myNumericalFloatAttrs[SUMO_TAG_EDGE].insert(SUMO_ATTR_LENGTH); + myNumericalFloatAttrs[SUMO_TAG_EDGE].insert(SUMO_ATTR_SPEED); + // Junction + myNumericalFloatAttrs[SUMO_TAG_JUNCTION].insert(SUMO_ATTR_RADIUS); + // Lane + myNumericalFloatAttrs[SUMO_TAG_LANE].insert(SUMO_ATTR_ENDOFFSET); + myNumericalFloatAttrs[SUMO_TAG_LANE].insert(SUMO_ATTR_SPEED); + // Rerouter + myNumericalFloatAttrs[SUMO_TAG_REROUTER].insert(SUMO_ATTR_PROB); + // Calibrator + myNumericalFloatAttrs[SUMO_TAG_CALIBRATOR].insert(SUMO_ATTR_POSITION); + // vehicle type + myNumericalFloatAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_ACCEL); + myNumericalFloatAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_DECEL); + myNumericalFloatAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_SIGMA); + myNumericalFloatAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_TAU); + myNumericalFloatAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_LENGTH); + myNumericalFloatAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_MINGAP); + myNumericalFloatAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_MAXSPEED); + myNumericalFloatAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_SPEEDFACTOR); + myNumericalFloatAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_SPEEDDEV); + myNumericalFloatAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_WIDTH); + myNumericalFloatAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_MINGAP_LAT); + myNumericalFloatAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_MAXSPEED_LAT); + myNumericalFloatAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_IMPATIENCE); + // flow + myNumericalFloatAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_VEHSPERHOUR); + myNumericalFloatAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_PERIOD); + myNumericalFloatAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_PROB); + // step + myNumericalFloatAttrs[SUMO_TAG_STEP].insert(SUMO_ATTR_SPEED); + } + return myNumericalFloatAttrs[tag].count(attr) == 1; } bool -GNEAttributeCarrier::isBool(SumoXMLAttr attr) { - // Iterate over additional tags - for (std::vector::const_iterator i = allowedTags().begin(); i != allowedTags().end(); i++) { - // Obtain choices - std::vector choices = discreteChoices(*i, attr); - // CHeck if choices are exactly "true" and "false" - if ((choices.size() == 2) && (choices.at(0) == "true") && (choices.at(1) == "false")) { - return true; - } +GNEAttributeCarrier::isTime(SumoXMLTag tag, SumoXMLAttr attr) { + // define on first access + if (myTimeAttrs.empty()) { + // calibrator + myTimeAttrs[SUMO_TAG_CALIBRATOR].insert(SUMO_ATTR_FREQUENCY); + // charging station + myTimeAttrs[SUMO_TAG_CHARGING_STATION].insert(SUMO_ATTR_CHARGEDELAY); + // E1 + myTimeAttrs[SUMO_TAG_E1DETECTOR].insert(SUMO_ATTR_FREQUENCY); + // E2 + myTimeAttrs[SUMO_TAG_E2DETECTOR].insert(SUMO_ATTR_FREQUENCY); + myTimeAttrs[SUMO_TAG_E2DETECTOR].insert(SUMO_ATTR_HALTING_TIME_THRESHOLD); + // E3 + myTimeAttrs[SUMO_TAG_E3DETECTOR].insert(SUMO_ATTR_FREQUENCY); + myTimeAttrs[SUMO_TAG_E3DETECTOR].insert(SUMO_ATTR_HALTING_TIME_THRESHOLD); + // RouteProbe + myTimeAttrs[SUMO_TAG_ROUTEPROBE].insert(SUMO_ATTR_BEGIN); + myTimeAttrs[SUMO_TAG_ROUTEPROBE].insert(SUMO_ATTR_FREQUENCY); + // Vaporizer + myTimeAttrs[SUMO_TAG_VAPORIZER].insert(SUMO_ATTR_END); + myTimeAttrs[SUMO_TAG_VAPORIZER].insert(SUMO_ATTR_STARTTIME); + // Vehicle type + myTimeAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_BOARDING_DURATION); + myTimeAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_LOADING_DURATION); + // Flow + myTimeAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_BEGIN); + myTimeAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_END); + // step + myTimeAttrs[SUMO_TAG_STEP].insert(SUMO_ATTR_TIME); } - return false; + return myTimeAttrs[tag].count(attr) == 1; +} + + +bool +GNEAttributeCarrier::isBool(SumoXMLTag tag, SumoXMLAttr attr) { + // define on first access + if (myBoolAttrs.empty()) { + // charging station + myBoolAttrs[SUMO_TAG_CHARGING_STATION].insert(SUMO_ATTR_CHARGEINTRANSIT); + // lane + myBoolAttrs[SUMO_TAG_LANE].insert(SUMO_ATTR_ACCELERATION); + // connection + myBoolAttrs[SUMO_TAG_CONNECTION].insert(SUMO_ATTR_PASS); + myBoolAttrs[SUMO_TAG_CONNECTION].insert(SUMO_ATTR_UNCONTROLLED); + // crossing + myBoolAttrs[SUMO_TAG_CROSSING].insert(SUMO_ATTR_PRIORITY); + // E1 + myBoolAttrs[SUMO_TAG_E1DETECTOR].insert(SUMO_ATTR_SPLIT_VTYPE); + // E2 + myBoolAttrs[SUMO_TAG_E2DETECTOR].insert(SUMO_ATTR_CONT); + // junction + myBoolAttrs[SUMO_TAG_JUNCTION].insert(SUMO_ATTR_KEEP_CLEAR); + // rerouter + myBoolAttrs[SUMO_TAG_REROUTER].insert(SUMO_ATTR_OFF); + // flow + myBoolAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_REROUTE); + } + return myBoolAttrs[tag].count(attr) == 1; } bool -GNEAttributeCarrier::isString(SumoXMLAttr attr) { - return (!isNumerical(attr) && !isBool(attr) && !isFloat(attr)); +GNEAttributeCarrier::isString(SumoXMLTag tag, SumoXMLAttr attr) { + return (!isNumerical(tag, attr) && !isBool(tag, attr) && !isTime(tag, attr)); } bool -GNEAttributeCarrier::isList(SumoXMLAttr attr) { +GNEAttributeCarrier::isList(SumoXMLTag tag, SumoXMLAttr attr) { // define on first access if (myListAttrs.empty()) { - myListAttrs.insert(SUMO_ATTR_LINES); - myListAttrs.insert(SUMO_ATTR_EDGES); - myListAttrs.insert(SUMO_ATTR_LANES); + // bus stop + myListAttrs[SUMO_TAG_BUS_STOP].insert(SUMO_ATTR_LINES); + // container stop + myListAttrs[SUMO_TAG_CONTAINER_STOP].insert(SUMO_ATTR_LINES); + // crossing + myListAttrs[SUMO_TAG_CROSSING].insert(SUMO_ATTR_EDGES); + // rerouter + myListAttrs[SUMO_TAG_REROUTER].insert(SUMO_ATTR_EDGES); + // variable speed signal + myListAttrs[SUMO_TAG_VSS].insert(SUMO_ATTR_LANES); + // route + myListAttrs[SUMO_TAG_ROUTE].insert(SUMO_ATTR_EDGES); } - return myListAttrs.count(attr) == 1; + return myListAttrs[tag].count(attr) == 1; } bool -GNEAttributeCarrier::isUnique(SumoXMLAttr attr) { - // define on first access - if (myUniqueAttrs.empty()) { - myUniqueAttrs.insert(SUMO_ATTR_ID); - myUniqueAttrs.insert(SUMO_ATTR_FROM); - myUniqueAttrs.insert(SUMO_ATTR_TO); - myUniqueAttrs.insert(SUMO_ATTR_SHAPE); - myUniqueAttrs.insert(SUMO_ATTR_POSITION); - myUniqueAttrs.insert(SUMO_ATTR_EDGES); - myUniqueAttrs.insert(SUMO_ATTR_STARTPOS); - myUniqueAttrs.insert(SUMO_ATTR_ENDPOS); - myUniqueAttrs.insert(SUMO_ATTR_LANE); - myUniqueAttrs.insert(SUMO_ATTR_EDGE); - myUniqueAttrs.insert(SUMO_ATTR_ROUTEPROBE); - myUniqueAttrs.insert(SUMO_ATTR_FROM_LANE); - myUniqueAttrs.insert(SUMO_ATTR_TO_LANE); +GNEAttributeCarrier::isUnique(SumoXMLTag tag, SumoXMLAttr attr) { + // ID is an atribute that always is unique + if (attr == SUMO_ATTR_ID) { + return true; + } else { + // define on first access + if (myUniqueAttrs.empty()) { + // connection + myUniqueAttrs[SUMO_TAG_CONNECTION].insert(SUMO_ATTR_FROM_LANE); + myUniqueAttrs[SUMO_TAG_CONNECTION].insert(SUMO_ATTR_TO); + myUniqueAttrs[SUMO_TAG_CONNECTION].insert(SUMO_ATTR_TO_LANE); + // edge + myUniqueAttrs[SUMO_TAG_EDGE].insert(SUMO_ATTR_FROM); + myUniqueAttrs[SUMO_TAG_EDGE].insert(SUMO_ATTR_TO); + // busstop + myUniqueAttrs[SUMO_TAG_BUS_STOP].insert(SUMO_ATTR_ENDPOS); + myUniqueAttrs[SUMO_TAG_BUS_STOP].insert(SUMO_ATTR_LANE); + myUniqueAttrs[SUMO_TAG_BUS_STOP].insert(SUMO_ATTR_STARTPOS); + // calibrator + myUniqueAttrs[SUMO_TAG_CALIBRATOR].insert(SUMO_ATTR_LANE); + myUniqueAttrs[SUMO_TAG_CALIBRATOR].insert(SUMO_ATTR_OUTPUT); + myUniqueAttrs[SUMO_TAG_CALIBRATOR].insert(SUMO_ATTR_ROUTEPROBE); + // charging station + myUniqueAttrs[SUMO_TAG_CHARGING_STATION].insert(SUMO_ATTR_ENDPOS); + myUniqueAttrs[SUMO_TAG_CHARGING_STATION].insert(SUMO_ATTR_LANE); + myUniqueAttrs[SUMO_TAG_CHARGING_STATION].insert(SUMO_ATTR_STARTPOS); + // connection + myUniqueAttrs[SUMO_TAG_CONNECTION].insert(SUMO_ATTR_FROM); + // container stop + myUniqueAttrs[SUMO_TAG_CONTAINER_STOP].insert(SUMO_ATTR_ENDPOS); + myUniqueAttrs[SUMO_TAG_CONTAINER_STOP].insert(SUMO_ATTR_LANE); + myUniqueAttrs[SUMO_TAG_CONTAINER_STOP].insert(SUMO_ATTR_STARTPOS); + // crossing + myUniqueAttrs[SUMO_TAG_CROSSING].insert(SUMO_ATTR_EDGES); + // det entry + myUniqueAttrs[SUMO_TAG_DET_ENTRY].insert(SUMO_ATTR_LANE); + myUniqueAttrs[SUMO_TAG_DET_ENTRY].insert(SUMO_ATTR_POSITION); + // det exit + myUniqueAttrs[SUMO_TAG_DET_EXIT].insert(SUMO_ATTR_LANE); + myUniqueAttrs[SUMO_TAG_DET_EXIT].insert(SUMO_ATTR_POSITION); + // E1 + myUniqueAttrs[SUMO_TAG_E1DETECTOR].insert(SUMO_ATTR_FILE); + myUniqueAttrs[SUMO_TAG_E1DETECTOR].insert(SUMO_ATTR_LANE); + myUniqueAttrs[SUMO_TAG_E1DETECTOR].insert(SUMO_ATTR_POSITION); + // E2 + myUniqueAttrs[SUMO_TAG_E2DETECTOR].insert(SUMO_ATTR_FILE); + myUniqueAttrs[SUMO_TAG_E2DETECTOR].insert(SUMO_ATTR_LANE); + myUniqueAttrs[SUMO_TAG_E2DETECTOR].insert(SUMO_ATTR_POSITION); + // E3 + myUniqueAttrs[SUMO_TAG_E3DETECTOR].insert(SUMO_ATTR_FILE); + myUniqueAttrs[SUMO_TAG_E3DETECTOR].insert(SUMO_ATTR_X); + myUniqueAttrs[SUMO_TAG_E3DETECTOR].insert(SUMO_ATTR_Y); + // Edge + myUniqueAttrs[SUMO_TAG_EDGE].insert(SUMO_ATTR_SHAPE); + // Junction + myUniqueAttrs[SUMO_TAG_JUNCTION].insert(SUMO_ATTR_POSITION); + myUniqueAttrs[SUMO_TAG_JUNCTION].insert(SUMO_ATTR_SHAPE); + myUniqueAttrs[SUMO_TAG_JUNCTION].insert(SUMO_ATTR_TLID); + // POI + myUniqueAttrs[SUMO_TAG_POI].insert(SUMO_ATTR_POSITION); + // Rerouter + myUniqueAttrs[SUMO_TAG_REROUTER].insert(SUMO_ATTR_EDGES); + myUniqueAttrs[SUMO_TAG_REROUTER].insert(SUMO_ATTR_FILE); + // Routeprobe + myUniqueAttrs[SUMO_TAG_ROUTEPROBE].insert(SUMO_ATTR_EDGE); + myUniqueAttrs[SUMO_TAG_ROUTEPROBE].insert(SUMO_ATTR_FILE); + // Vaporizer + myUniqueAttrs[SUMO_TAG_VAPORIZER].insert(SUMO_ATTR_EDGE); + myUniqueAttrs[SUMO_TAG_VAPORIZER].insert(SUMO_ATTR_FILE); + // VSS + myUniqueAttrs[SUMO_TAG_VSS].insert(SUMO_ATTR_FILE); + } + return myUniqueAttrs[tag].count(attr) == 1; } - return myUniqueAttrs.count(attr) == 1; } @@ -526,13 +782,134 @@ bool -GNEAttributeCarrier::hasParent(SumoXMLTag tag) { +GNEAttributeCarrier::isPositive(SumoXMLTag tag, SumoXMLAttr attr) { + // define on first access + if (myPositiveAttrs.empty()) { + // edge + myPositiveAttrs[SUMO_TAG_EDGE].insert(SUMO_ATTR_SPEED); + myPositiveAttrs[SUMO_TAG_EDGE].insert(SUMO_ATTR_PRIORITY); + myPositiveAttrs[SUMO_TAG_EDGE].insert(SUMO_ATTR_NUMLANES); + myPositiveAttrs[SUMO_TAG_EDGE].insert(SUMO_ATTR_LENGTH); + myPositiveAttrs[SUMO_TAG_EDGE].insert(SUMO_ATTR_WIDTH); + myPositiveAttrs[SUMO_TAG_EDGE].insert(SUMO_ATTR_ENDOFFSET); + // junction + myPositiveAttrs[SUMO_TAG_JUNCTION].insert(SUMO_ATTR_RADIUS); + // lane + myPositiveAttrs[SUMO_TAG_LANE].insert(SUMO_ATTR_SPEED); + myPositiveAttrs[SUMO_TAG_LANE].insert(SUMO_ATTR_WIDTH); + myPositiveAttrs[SUMO_TAG_LANE].insert(SUMO_ATTR_ENDOFFSET); + // poi + myPositiveAttrs[SUMO_TAG_POI].insert(SUMO_ATTR_POSITION); + // crossing + myPositiveAttrs[SUMO_TAG_CROSSING].insert(SUMO_ATTR_PRIORITY); + // connection + myPositiveAttrs[SUMO_TAG_CONNECTION].insert(SUMO_ATTR_CONTPOS); + myPositiveAttrs[SUMO_TAG_CONNECTION].insert(SUMO_ATTR_VISIBILITY_DISTANCE); + // busstop + myPositiveAttrs[SUMO_TAG_BUS_STOP].insert(SUMO_ATTR_STARTPOS); + myPositiveAttrs[SUMO_TAG_BUS_STOP].insert(SUMO_ATTR_ENDPOS); + // container stop + myPositiveAttrs[SUMO_TAG_CONTAINER_STOP].insert(SUMO_ATTR_STARTPOS); + myPositiveAttrs[SUMO_TAG_CONTAINER_STOP].insert(SUMO_ATTR_ENDPOS); + // charging station + myPositiveAttrs[SUMO_TAG_CHARGING_STATION].insert(SUMO_ATTR_STARTPOS); + myPositiveAttrs[SUMO_TAG_CHARGING_STATION].insert(SUMO_ATTR_ENDPOS); + myPositiveAttrs[SUMO_TAG_CHARGING_STATION].insert(SUMO_ATTR_CHARGINGPOWER); + myPositiveAttrs[SUMO_TAG_CHARGING_STATION].insert(SUMO_ATTR_EFFICIENCY); + myPositiveAttrs[SUMO_TAG_CHARGING_STATION].insert(SUMO_ATTR_CHARGEINTRANSIT); + // E1 + myPositiveAttrs[SUMO_TAG_E1DETECTOR].insert(SUMO_ATTR_POSITION); + // E2 + myPositiveAttrs[SUMO_TAG_E2DETECTOR].insert(SUMO_ATTR_POSITION); + myPositiveAttrs[SUMO_TAG_E2DETECTOR].insert(SUMO_ATTR_LENGTH); + myPositiveAttrs[SUMO_TAG_E2DETECTOR].insert(SUMO_ATTR_HALTING_TIME_THRESHOLD); + myPositiveAttrs[SUMO_TAG_E2DETECTOR].insert(SUMO_ATTR_HALTING_SPEED_THRESHOLD); + myPositiveAttrs[SUMO_TAG_E2DETECTOR].insert(SUMO_ATTR_JAM_DIST_THRESHOLD); + // entry + myPositiveAttrs[SUMO_TAG_DET_ENTRY].insert(SUMO_ATTR_POSITION); + // exit + myPositiveAttrs[SUMO_TAG_DET_EXIT].insert(SUMO_ATTR_POSITION); + // calibrator + myPositiveAttrs[SUMO_TAG_CALIBRATOR].insert(SUMO_ATTR_POSITION); + // flow + myPositiveAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_PERSON_NUMBER); + myPositiveAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_CONTAINER_NUMBER); + myPositiveAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_VEHSPERHOUR); + myPositiveAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_PERIOD); + myPositiveAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_NUMBER); + // vehicle type + myPositiveAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_ACCEL); + myPositiveAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_DECEL); + myPositiveAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_SIGMA); + myPositiveAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_TAU); + myPositiveAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_LENGTH); + myPositiveAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_MINGAP); + myPositiveAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_MAXSPEED); + myPositiveAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_SPEEDFACTOR); + myPositiveAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_SPEEDDEV); + myPositiveAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_WIDTH); + myPositiveAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_MINGAP_LAT); + myPositiveAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_MAXSPEED_LAT); + myPositiveAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_PERSON_CAPACITY); + myPositiveAttrs[SUMO_TAG_VTYPE].insert(SUMO_ATTR_CONTAINER_CAPACITY); + } + return myPositiveAttrs[tag].count(attr) == 1; +} + + +bool +GNEAttributeCarrier::isProbability(SumoXMLTag tag, SumoXMLAttr attr) { // define on first access - if (myAllowedAdditionalWithParentTags.empty()) { - myAllowedAdditionalWithParentTags[SUMO_TAG_DET_ENTRY] = SUMO_TAG_E3DETECTOR; - myAllowedAdditionalWithParentTags[SUMO_TAG_DET_EXIT] = SUMO_TAG_E3DETECTOR; + if (myProbabilityAttrs.empty()) { + // charging station + myProbabilityAttrs[SUMO_TAG_CHARGING_STATION].insert(SUMO_ATTR_EFFICIENCY); + // rerouter + myProbabilityAttrs[SUMO_TAG_REROUTER].insert(SUMO_ATTR_PROB); + // flow + myProbabilityAttrs[SUMO_TAG_FLOW].insert(SUMO_ATTR_PROB); } - return myAllowedAdditionalWithParentTags.count(tag) == 1; + return myProbabilityAttrs[tag].count(attr) == 1; +} + + +bool +GNEAttributeCarrier::isFilename(SumoXMLTag tag, SumoXMLAttr attr) { + // define on first access + if (myFileAttrs.empty()) { + // E1 + myFileAttrs[SUMO_TAG_E1DETECTOR].insert(SUMO_ATTR_FILE); + // E2 + myFileAttrs[SUMO_TAG_E2DETECTOR].insert(SUMO_ATTR_FILE); + // E3 + myFileAttrs[SUMO_TAG_E3DETECTOR].insert(SUMO_ATTR_FILE); + // calibrator + myFileAttrs[SUMO_TAG_CALIBRATOR].insert(SUMO_ATTR_OUTPUT); + // rerouter + myFileAttrs[SUMO_TAG_REROUTER].insert(SUMO_ATTR_FILE); + // routeprobe + myFileAttrs[SUMO_TAG_ROUTEPROBE].insert(SUMO_ATTR_FILE); + // Variable Speed Signal + myFileAttrs[SUMO_TAG_VSS].insert(SUMO_ATTR_FILE); + } + return myFileAttrs[tag].count(attr) == 1; +} + + +bool +GNEAttributeCarrier::isNonEditable(SumoXMLTag tag, SumoXMLAttr attr) { + // define on first access + if (myNonEditableAttrs.empty()) { + // connection + myNonEditableAttrs[SUMO_TAG_CONNECTION].insert(SUMO_ATTR_FROM); + myNonEditableAttrs[SUMO_TAG_CONNECTION].insert(SUMO_ATTR_FROM_LANE); + myNonEditableAttrs[SUMO_TAG_CONNECTION].insert(SUMO_ATTR_TO); + myNonEditableAttrs[SUMO_TAG_CONNECTION].insert(SUMO_ATTR_TO_LANE); + // crossing + myNonEditableAttrs[SUMO_TAG_CROSSING].insert(SUMO_ATTR_ID); + // lane + myNonEditableAttrs[SUMO_TAG_LANE].insert(SUMO_ATTR_INDEX); + } + return myNonEditableAttrs[tag].count(attr) == 1; } @@ -548,66 +925,76 @@ } + +bool +GNEAttributeCarrier::hasDefaultValue(SumoXMLTag tag, SumoXMLAttr attr) { + const std::vector >& attrs = allowedAttributes(tag); + for (std::vector >::const_iterator i = attrs.begin(); i != attrs.end(); i++) { + if ((*i).first == attr) { + if ((*i).second != NODEFAULTVALUE) { + return true; + } else { + return false; + } + } + } + throw ProcessError("Attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' not defined"); +} + + const std::vector& GNEAttributeCarrier::discreteChoices(SumoXMLTag tag, SumoXMLAttr attr) { // define on first access if (myDiscreteChoices.empty()) { std::vector choices; + // Get type of nodes choices = SUMOXMLDefinitions::NodeTypes.getStrings(); for (std::vector::const_iterator it = choices.begin(); it != choices.end(); ++it) { if (*it != toString(NODETYPE_DEAD_END_DEPRECATED)) { + // junction myDiscreteChoices[SUMO_TAG_JUNCTION][SUMO_ATTR_TYPE].push_back(*it); } } - + // Get types of traffic lights choices = SUMOXMLDefinitions::TrafficLightTypes.getStrings(); for (std::vector::const_iterator it = choices.begin(); it != choices.end(); ++it) { if (*it != toString(TLTYPE_INVALID)) { + // junction myDiscreteChoices[SUMO_TAG_JUNCTION][SUMO_ATTR_TLTYPE].push_back(*it); } } - - myDiscreteChoices[SUMO_TAG_JUNCTION][SUMO_ATTR_KEEP_CLEAR].push_back("true"); - myDiscreteChoices[SUMO_TAG_JUNCTION][SUMO_ATTR_KEEP_CLEAR].push_back("false"); - + // get type of lane spread functions choices = SUMOXMLDefinitions::LaneSpreadFunctions.getStrings(); for (std::vector::const_iterator it = choices.begin(); it != choices.end(); ++it) { + // edge myDiscreteChoices[SUMO_TAG_EDGE][SUMO_ATTR_SPREADTYPE].push_back(*it); } - + // get vehicle types choices = SumoVehicleClassStrings.getStrings(); for (std::vector::const_iterator it = choices.begin(); it != choices.end(); ++it) { + // edge myDiscreteChoices[SUMO_TAG_EDGE][SUMO_ATTR_ALLOW].push_back(*it); myDiscreteChoices[SUMO_TAG_EDGE][SUMO_ATTR_DISALLOW].push_back(*it); + // lane myDiscreteChoices[SUMO_TAG_LANE][SUMO_ATTR_ALLOW].push_back(*it); myDiscreteChoices[SUMO_TAG_LANE][SUMO_ATTR_DISALLOW].push_back(*it); + // vehicle type + myDiscreteChoices[SUMO_TAG_VTYPE][SUMO_ATTR_VCLASS].push_back(*it); } - - myDiscreteChoices[SUMO_TAG_CROSSING][SUMO_ATTR_PRIORITY].push_back("true"); - myDiscreteChoices[SUMO_TAG_CROSSING][SUMO_ATTR_PRIORITY].push_back("false"); - - myDiscreteChoices[SUMO_TAG_CHARGING_STATION][SUMO_ATTR_CHARGEINTRANSIT].push_back("true"); - myDiscreteChoices[SUMO_TAG_CHARGING_STATION][SUMO_ATTR_CHARGEINTRANSIT].push_back("false"); - - myDiscreteChoices[SUMO_TAG_E1DETECTOR][SUMO_ATTR_SPLIT_VTYPE].push_back("true"); - myDiscreteChoices[SUMO_TAG_E1DETECTOR][SUMO_ATTR_SPLIT_VTYPE].push_back("false"); - - myDiscreteChoices[SUMO_TAG_E2DETECTOR][SUMO_ATTR_CONT].push_back("true"); - myDiscreteChoices[SUMO_TAG_E2DETECTOR][SUMO_ATTR_CONT].push_back("false"); - - myDiscreteChoices[SUMO_TAG_REROUTER][SUMO_ATTR_OFF].push_back("true"); - myDiscreteChoices[SUMO_TAG_REROUTER][SUMO_ATTR_OFF].push_back("false"); - - myDiscreteChoices[SUMO_TAG_CONNECTION][SUMO_ATTR_KEEP_CLEAR].push_back("true"); - myDiscreteChoices[SUMO_TAG_CONNECTION][SUMO_ATTR_KEEP_CLEAR].push_back("false"); - - myDiscreteChoices[SUMO_TAG_CONNECTION][SUMO_ATTR_UNCONTROLLED].push_back("true"); - myDiscreteChoices[SUMO_TAG_CONNECTION][SUMO_ATTR_UNCONTROLLED].push_back("false"); - - myDiscreteChoices[SUMO_TAG_CONNECTION][SUMO_ATTR_PASS].push_back("true"); - myDiscreteChoices[SUMO_TAG_CONNECTION][SUMO_ATTR_PASS].push_back("false"); + // get vehicle shapes + choices = SumoVehicleShapeStrings.getStrings(); + for (std::vector::const_iterator it = choices.begin(); it != choices.end(); ++it) { + // vehicle type + myDiscreteChoices[SUMO_TAG_VTYPE][SUMO_ATTR_GUISHAPE].push_back(*it); + } + // lat alignments of vehicle types + myDiscreteChoices[SUMO_TAG_VTYPE][SUMO_ATTR_LATALIGNMENT].push_back("left"); + myDiscreteChoices[SUMO_TAG_VTYPE][SUMO_ATTR_LATALIGNMENT].push_back("right"); + myDiscreteChoices[SUMO_TAG_VTYPE][SUMO_ATTR_LATALIGNMENT].push_back("center"); + myDiscreteChoices[SUMO_TAG_VTYPE][SUMO_ATTR_LATALIGNMENT].push_back("compact"); + myDiscreteChoices[SUMO_TAG_VTYPE][SUMO_ATTR_LATALIGNMENT].push_back("nice"); + myDiscreteChoices[SUMO_TAG_VTYPE][SUMO_ATTR_LATALIGNMENT].push_back("arbitrary"); } - return myDiscreteChoices[tag][attr]; } @@ -623,49 +1010,49 @@ // define on first access if (myAttrDefinitions.empty()) { // Edge - myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_ID] = "ID (Must be unique)"; - myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_FROM] = ""; - myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_TO] = ""; - myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_SPEED] = ""; - myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_PRIORITY] = ""; - myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_NUMLANES] = ""; - myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_TYPE] = ""; - myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_ALLOW] = ""; - myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_DISALLOW] = ""; - myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_PREFER] = ""; - myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_SHAPE] = ""; - myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_LENGTH] = ""; - myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_SPREADTYPE] = ""; - myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_NAME] = ""; - myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_WIDTH] = ""; - myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_ENDOFFSET] = ""; + myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_ID] = "The id of the edge (must be unique)."; + myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_FROM] = "The name of a node within the nodes-file the edge shall start at."; + myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_TO] = "The name of a node within the nodes-file the edge shall end at."; + myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_SPEED] = "The maximum speed allowed on the edge in m/s."; + myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_PRIORITY] = "The priority of the edge."; + myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_NUMLANES] = "The number of lanes of the edge."; + myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_TYPE] = "The name of a type within the SUMO edge type file"; + myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_ALLOW] = "Explicitly allows the given vehicle classes (not given will be not allowed)."; + myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_DISALLOW] = "Explicitly disallows the given vehicle classes (not given will be allowed)."; + //myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_PREFER] = ""; + myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_SHAPE] = "If the shape is given it should start and end with the positions of the from-node and to-node."; + myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_LENGTH] = "The length of the edge in meter"; + myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_SPREADTYPE] = "Lane width for all lanes of this edge in meters (used for visualization)."; + myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_NAME] = "street name (need not be unique, used for visualization)."; + myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_WIDTH] = "Lane width for all lanes of this edge in meters (used for visualization)."; + myAttrDefinitions[SUMO_TAG_EDGE][SUMO_ATTR_ENDOFFSET] = "Move the stop line back from the intersection by the given amount."; // Junction - myAttrDefinitions[SUMO_TAG_JUNCTION][SUMO_ATTR_ID] = "ID (Must be unique)"; - myAttrDefinitions[SUMO_TAG_JUNCTION][SUMO_ATTR_POSITION] = ""; - myAttrDefinitions[SUMO_TAG_JUNCTION][SUMO_ATTR_TYPE] = ""; - myAttrDefinitions[SUMO_TAG_JUNCTION][SUMO_ATTR_SHAPE] = ""; - myAttrDefinitions[SUMO_TAG_JUNCTION][SUMO_ATTR_RADIUS] = ""; - myAttrDefinitions[SUMO_TAG_JUNCTION][SUMO_ATTR_KEEP_CLEAR] = ""; - myAttrDefinitions[SUMO_TAG_JUNCTION][SUMO_ATTR_TLTYPE] = ""; - myAttrDefinitions[SUMO_TAG_JUNCTION][SUMO_ATTR_TLID] = ""; + myAttrDefinitions[SUMO_TAG_JUNCTION][SUMO_ATTR_ID] = "The name of the node (Must be unique)."; + myAttrDefinitions[SUMO_TAG_JUNCTION][SUMO_ATTR_POSITION] = "The x-y-z position of the node on the plane in meters."; + myAttrDefinitions[SUMO_TAG_JUNCTION][SUMO_ATTR_TYPE] = "An optional type for the node."; + myAttrDefinitions[SUMO_TAG_JUNCTION][SUMO_ATTR_SHAPE] = "A custom shape for that node."; + myAttrDefinitions[SUMO_TAG_JUNCTION][SUMO_ATTR_RADIUS] = "Optional turning radius (for all corners) for that node in meters."; + myAttrDefinitions[SUMO_TAG_JUNCTION][SUMO_ATTR_KEEP_CLEAR] = "Whether the junction-blocking-heuristic should be activated at this node."; + myAttrDefinitions[SUMO_TAG_JUNCTION][SUMO_ATTR_TLTYPE] = "An optional type for the traffic light algorithm."; + myAttrDefinitions[SUMO_TAG_JUNCTION][SUMO_ATTR_TLID] = "An optional id for the traffic light program."; // Lane - myAttrDefinitions[SUMO_TAG_LANE][SUMO_ATTR_ID] = "ID (Must be unique)"; - myAttrDefinitions[SUMO_TAG_LANE][SUMO_ATTR_SPEED] = ""; - myAttrDefinitions[SUMO_TAG_LANE][SUMO_ATTR_ALLOW] = ""; - myAttrDefinitions[SUMO_TAG_LANE][SUMO_ATTR_DISALLOW] = ""; - myAttrDefinitions[SUMO_TAG_LANE][SUMO_ATTR_PREFER] = ""; - myAttrDefinitions[SUMO_TAG_LANE][SUMO_ATTR_WIDTH] = ""; - myAttrDefinitions[SUMO_TAG_LANE][SUMO_ATTR_ENDOFFSET] = ""; - myAttrDefinitions[SUMO_TAG_LANE][SUMO_ATTR_INDEX] = ""; + myAttrDefinitions[SUMO_TAG_LANE][SUMO_ATTR_ID] = "ID of lane (Automatic)"; + myAttrDefinitions[SUMO_TAG_LANE][SUMO_ATTR_SPEED] = "Speed in meters per second"; + myAttrDefinitions[SUMO_TAG_LANE][SUMO_ATTR_ALLOW] = "Explicitly allows the given vehicle classes (not given will be not allowed)."; + myAttrDefinitions[SUMO_TAG_LANE][SUMO_ATTR_DISALLOW] = "Explicitly disallows the given vehicle classes (not given will be allowed)."; + //myAttrDefinitions[SUMO_TAG_LANE][SUMO_ATTR_PREFER] = ""; + myAttrDefinitions[SUMO_TAG_LANE][SUMO_ATTR_WIDTH] = "Width in meters (used for visualization)."; + myAttrDefinitions[SUMO_TAG_LANE][SUMO_ATTR_ENDOFFSET] = "Move the stop line back from the intersection by the given amount."; + myAttrDefinitions[SUMO_TAG_LANE][SUMO_ATTR_INDEX] = "The enumeration index of the lane (0 is the rightmost lane, -1 is the leftmost one)."; // POI myAttrDefinitions[SUMO_TAG_POI][SUMO_ATTR_ID] = "ID (Must be unique)"; - myAttrDefinitions[SUMO_TAG_POI][SUMO_ATTR_POSITION] = ""; - myAttrDefinitions[SUMO_TAG_POI][SUMO_ATTR_TYPE] = ""; + myAttrDefinitions[SUMO_TAG_POI][SUMO_ATTR_POSITION] = "The position of the poi along the xyz-axis in meters."; + myAttrDefinitions[SUMO_TAG_POI][SUMO_ATTR_TYPE] = "A typename for the poi."; // Crossing - myAttrDefinitions[SUMO_TAG_CROSSING][SUMO_ATTR_ID] = "ID (Must be unique)"; - myAttrDefinitions[SUMO_TAG_CROSSING][SUMO_ATTR_PRIORITY] = ""; - myAttrDefinitions[SUMO_TAG_CROSSING][SUMO_ATTR_WIDTH] = ""; - myAttrDefinitions[SUMO_TAG_CROSSING][SUMO_ATTR_EDGES] = ""; + myAttrDefinitions[SUMO_TAG_CROSSING][SUMO_ATTR_ID] = "ID (Automatic)"; + myAttrDefinitions[SUMO_TAG_CROSSING][SUMO_ATTR_PRIORITY] = "Whether the pedestrians have priority over the vehicles (automatically set to true at tls-controlled intersections)."; + myAttrDefinitions[SUMO_TAG_CROSSING][SUMO_ATTR_WIDTH] = "The width of the crossings."; + myAttrDefinitions[SUMO_TAG_CROSSING][SUMO_ATTR_EDGES] = "The (road) edges which are crossed."; // Connection myAttrDefinitions[SUMO_TAG_CONNECTION][SUMO_ATTR_FROM] = "The name of the edge the vehicles leave "; myAttrDefinitions[SUMO_TAG_CONNECTION][SUMO_ATTR_TO] = "The name of the edge the vehicles may reach when leaving 'from'"; @@ -719,6 +1106,10 @@ myAttrDefinitions[SUMO_TAG_E3DETECTOR][SUMO_ATTR_ID] = "ID (Must be unique)"; myAttrDefinitions[SUMO_TAG_E3DETECTOR][SUMO_ATTR_FREQUENCY] = "The aggregation period the values the detector collects shall be summed up"; myAttrDefinitions[SUMO_TAG_E3DETECTOR][SUMO_ATTR_FILE] = "The path to the output file"; + myAttrDefinitions[SUMO_TAG_E3DETECTOR][SUMO_ATTR_HALTING_TIME_THRESHOLD] = "The time-based threshold that describes how much time has to pass until a vehicle is recognized as halting; in s, default: 1s"; + myAttrDefinitions[SUMO_TAG_E3DETECTOR][SUMO_ATTR_HALTING_SPEED_THRESHOLD] = "The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting; in m/s, default: 5/3.6m/s"; + myAttrDefinitions[SUMO_TAG_E3DETECTOR][SUMO_ATTR_X] = "X position in editor (Only used in netedit)"; + myAttrDefinitions[SUMO_TAG_E3DETECTOR][SUMO_ATTR_Y] = "Y position in editor (Only used in netedit)"; // Entry myAttrDefinitions[SUMO_TAG_DET_ENTRY][SUMO_ATTR_LANE] = "The id of the lane the detector shall be laid on. The lane must be a part of the network used"; myAttrDefinitions[SUMO_TAG_DET_ENTRY][SUMO_ATTR_POSITION] = "The position on the lane the detector shall be laid on in meters"; @@ -731,7 +1122,7 @@ myAttrDefinitions[SUMO_TAG_VSS][SUMO_ATTR_FILE] = "The path to the output file"; // Calibrator myAttrDefinitions[SUMO_TAG_CALIBRATOR][SUMO_ATTR_ID] = "ID (Must be unique)"; - myAttrDefinitions[SUMO_TAG_CALIBRATOR][SUMO_ATTR_LANE] = "List of lanes of calibrator"; + myAttrDefinitions[SUMO_TAG_CALIBRATOR][SUMO_ATTR_LANE] = "The id of lane in the simulation network"; myAttrDefinitions[SUMO_TAG_CALIBRATOR][SUMO_ATTR_POSITION] = "The position of the calibrator on the specified lane"; myAttrDefinitions[SUMO_TAG_CALIBRATOR][SUMO_ATTR_FREQUENCY] = "The aggregation interval in which to calibrate the flows. default is step-length"; myAttrDefinitions[SUMO_TAG_CALIBRATOR][SUMO_ATTR_ROUTEPROBE] = "The id of the routeProbe element from which to determine the route distribution for generated vehicles"; @@ -742,12 +1133,65 @@ myAttrDefinitions[SUMO_TAG_REROUTER][SUMO_ATTR_FILE] = "The path to the definition file (alternatively, the intervals may defined as children of the rerouter)"; myAttrDefinitions[SUMO_TAG_REROUTER][SUMO_ATTR_PROB] = "The probability for vehicle rerouting (0-1), default 1"; myAttrDefinitions[SUMO_TAG_REROUTER][SUMO_ATTR_OFF] = "Whether the router should be inactive initially (and switched on in the gui), default:false"; - // SUMO_TAG_ROUTEPROBE + // route probe myAttrDefinitions[SUMO_TAG_ROUTEPROBE][SUMO_ATTR_ID] = "ID (Must be unique)"; myAttrDefinitions[SUMO_TAG_ROUTEPROBE][SUMO_ATTR_EDGE] = "The id of an edge in the simulation network"; myAttrDefinitions[SUMO_TAG_ROUTEPROBE][SUMO_ATTR_FREQUENCY] = "The frequency in which to report the distribution"; myAttrDefinitions[SUMO_TAG_ROUTEPROBE][SUMO_ATTR_FILE] = "The file for generated output"; myAttrDefinitions[SUMO_TAG_ROUTEPROBE][SUMO_ATTR_BEGIN] = "The time at which to start generating output"; + // flow + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_ID] = "The name of the vehicle (Must be unique)"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_TYPE] = "The id of the vehicle type to use for this vehicle."; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_ROUTE] = "The id of the route the vehicle shall drive along"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_BEGIN] = "First vehicle departure time"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_END] = "End of departure interval"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_VEHSPERHOUR] = "Number of vehicles per hour, equally spaced (not together with period or probability)"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_PERIOD] = "Insert equally spaced vehicles at that period (not together with vehsPerHour or probability)"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_PROB] = "Probability for emitting a vehicle each second (not together with vehsPerHour or period)"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_NUMBER] = "Total number of vehicles, equally spaced"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_DEPARTLANE] = "The lane on which the vehicle shall be inserted"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_DEPARTPOS] = "The position at which the vehicle shall enter the net"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_DEPARTSPEED] = "The speed with which the vehicle shall enter the network"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_ARRIVALLANE] = "The lane at which the vehicle shall leave the network"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_ARRIVALPOS] = "The position at which the vehicle shall leave the network"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_ARRIVALSPEED] = "The speed with which the vehicle shall leave the network"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_LINE] = "A string specifying the id of a public transport line which can be used when specifying person rides"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_PERSON_NUMBER] = "The number of occupied seats when the vehicle is inserted"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_CONTAINER_NUMBER] = "The number of occupied container places when the vehicle is inserted"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_REROUTE] = " Whether the vehicle should be equipped with a rerouting device"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_DEPARTPOS_LAT] = "The lateral position on the departure lane at which the vehicle shall enter the net"; + myAttrDefinitions[SUMO_TAG_FLOW][SUMO_ATTR_ARRIVALPOS_LAT] = "The lateral position on the arrival lane at which the vehicle shall arrive"; + // route + myAttrDefinitions[SUMO_TAG_ROUTE][SUMO_ATTR_ID] = "The name of the route (Must be unique)"; + myAttrDefinitions[SUMO_TAG_ROUTE][SUMO_ATTR_EDGES] = "The edges the vehicle shall drive along, given as their ids, separated using spaces"; + myAttrDefinitions[SUMO_TAG_ROUTE][SUMO_ATTR_COLOR] = "This route's color"; + // vehicle type + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_ID] = "The name of the vehicle type (Must be unique)"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_ACCEL] = "The acceleration ability of vehicles of this type [m/s^2]"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_DECEL] = "The deceleration ability of vehicles of this type [m/s^2]"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_SIGMA] = "Car-following model parameter"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_TAU] = "Car-following model parameter"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_LENGTH] = "The vehicle's netto-length (length) [m]"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_MINGAP] = "Empty space after leader [m]"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_MAXSPEED] = "The vehicle's maximum velocity [m/s]"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_SPEEDFACTOR] = "The vehicles expected multiplicator for lane speed limits"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_SPEEDDEV] = "The deviation of the speedFactor"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_COLOR] = "This vehicle type's color"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_VCLASS] = "An abstract vehicle class"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_EMISSIONCLASS] = "An abstract emission class"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_GUISHAPE] = "How this vehicle is rendered"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_WIDTH] = "The vehicle's width [m] (only used for drawing)"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_IMGFILE] = "Image file for rendering vehicles of this type (should be grayscale to allow functional coloring)"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_IMPATIENCE] = "Willingess of drivers to impede vehicles with higher priority"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_LANE_CHANGE_MODEL] = "The model used for changing lanes"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_CAR_FOLLOW_MODEL] = "The model used for car following"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_PERSON_CAPACITY] = "The number of persons (excluding an autonomous driver) the vehicle can transport"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_CONTAINER_CAPACITY] = "The number of containers the vehicle can transport"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_BOARDING_DURATION] = "The time required by a person to board the vehicle"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_LOADING_DURATION] = "The time required to load a container onto the vehicle"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_LATALIGNMENT] = "The preferred lateral alignment when using the sublane-model"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_MINGAP_LAT] = "The minimum lateral gap at a speed difference of 50km/h when using the sublane-model"; + myAttrDefinitions[SUMO_TAG_VTYPE][SUMO_ATTR_MAXSPEED_LAT] = "The maximum lateral speed when using the sublane-model"; } return myAttrDefinitions[tag][attr]; } @@ -755,95 +1199,126 @@ int GNEAttributeCarrier::getHigherNumberOfAttributes() { - int higherNumber = 0; - for (std::vector::const_iterator i = allowedTags().begin(); i != allowedTags().end(); i++) { - if ((int)allowedAttributes(*i).size() > higherNumber) { - higherNumber = (int)allowedAttributes(*i).size(); + if (myMaxNumAttribute == 0) { + // initialize both vectors + GNEAttributeCarrier::allowedTags(true); + for (std::vector::const_iterator i = myAllowedNetElementTags.begin(); i != myAllowedNetElementTags.end(); i++) { + myMaxNumAttribute = MAX2(myMaxNumAttribute, (int)allowedAttributes(*i).size()); + } + for (std::vector::const_iterator i = myAllowedAdditionalTags.begin(); i != myAllowedAdditionalTags.end(); i++) { + myMaxNumAttribute = MAX2(myMaxNumAttribute, (int)allowedAttributes(*i).size()); } } - return higherNumber; + return myMaxNumAttribute; } template<> int GNEAttributeCarrier::getDefaultValue(SumoXMLTag tag, SumoXMLAttr attr) { for (std::vector >::iterator i = _allowedAttributes.at(tag).begin(); i != _allowedAttributes.at(tag).end(); i++) { - if ((*i).first == attr) { - return TplConvert::_str2int((*i).second); + if (((*i).first == attr) && ((*i).second != NODEFAULTVALUE)) { + return parse((*i).second); } } - // Write warning if attribute don't have a default value and return a empty value to avoid warnings - WRITE_WARNING("attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' don't have a default value"); - return 0; + // throw exception if attribute doesn't have a default value and return a empty value to avoid warnings + throw ProcessError("attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' doesn't have a default value"); } -template<> SUMOReal +template<> double GNEAttributeCarrier::getDefaultValue(SumoXMLTag tag, SumoXMLAttr attr) { for (std::vector >::iterator i = _allowedAttributes.at(tag).begin(); i != _allowedAttributes.at(tag).end(); i++) { - if ((*i).first == attr) { - return TplConvert::_str2SUMOReal((*i).second); + if (((*i).first == attr) && ((*i).second != NODEFAULTVALUE)) { + return parse((*i).second); } } - // Write warning if attribute don't have a default value and return a empty value to avoid warnings - WRITE_WARNING("attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' don't have a default value"); - return 0; + // throw exception if attribute doesn't have a default value and return a empty value to avoid warnings + throw ProcessError("attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' doesn't have a default value"); } template<> bool GNEAttributeCarrier::getDefaultValue(SumoXMLTag tag, SumoXMLAttr attr) { for (std::vector >::iterator i = _allowedAttributes.at(tag).begin(); i != _allowedAttributes.at(tag).end(); i++) { - if ((*i).first == attr) { - return TplConvert::_str2Bool((*i).second); + if (((*i).first == attr) && ((*i).second != NODEFAULTVALUE)) { + return parse((*i).second); } } - // Write warning if attribute don't have a default value and return a empty value to avoid warnings - WRITE_WARNING("attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' don't have a default value"); - return false; + // throw exception if attribute doesn't have a default value and return a empty value to avoid warnings + throw ProcessError("attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' doesn't have a default value"); } template<> std::string GNEAttributeCarrier::getDefaultValue(SumoXMLTag tag, SumoXMLAttr attr) { for (std::vector >::iterator i = _allowedAttributes.at(tag).begin(); i != _allowedAttributes.at(tag).end(); i++) { - if ((*i).first == attr) { + if (((*i).first == attr) && ((*i).second != NODEFAULTVALUE)) { return (*i).second; } } - // Write warning if attribute don't have a default value and return a empty value to avoid warnings - WRITE_WARNING("attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' don't have a default value"); - return ""; + // throw exception if attribute doesn't have a default value and return a empty value to avoid warnings + throw ProcessError("attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' doesn't have a default value"); } -template<> std::vector +template<> SUMOVehicleClass GNEAttributeCarrier::getDefaultValue(SumoXMLTag tag, SumoXMLAttr attr) { - std::cout << "FINISH" << std::endl; + for (std::vector >::iterator i = _allowedAttributes.at(tag).begin(); i != _allowedAttributes.at(tag).end(); i++) { + if (((*i).first == attr) && ((*i).second != NODEFAULTVALUE)) { + return parse((*i).second); + } + } + // throw exception if attribute doesn't have a default value and return a empty value to avoid warnings + throw ProcessError("attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' doesn't have a default value"); +} + + - // Write warning if attribute don't have a default value and return a empty value to avoid warnings - WRITE_WARNING("attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' don't have a default value"); - return std::vector(); +template<> SUMOVehicleShape +GNEAttributeCarrier::getDefaultValue(SumoXMLTag tag, SumoXMLAttr attr) { + for (std::vector >::iterator i = _allowedAttributes.at(tag).begin(); i != _allowedAttributes.at(tag).end(); i++) { + if (((*i).first == attr) && ((*i).second != NODEFAULTVALUE)) { + return parse((*i).second); + } + } + // throw exception if attribute doesn't have a default value and return a empty value to avoid warnings + throw ProcessError("attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' doesn't have a default value"); } -template<> std::vector +template<> std::vector GNEAttributeCarrier::getDefaultValue(SumoXMLTag tag, SumoXMLAttr attr) { - std::cout << "FINISH" << std::endl; + for (std::vector >::iterator i = _allowedAttributes.at(tag).begin(); i != _allowedAttributes.at(tag).end(); i++) { + if (((*i).first == attr) && ((*i).second != NODEFAULTVALUE)) { + return parse >((*i).second); + } + } + // throw exception if attribute doesn't have a default value and return a empty value to avoid warnings + throw ProcessError("attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' doesn't have a default value"); +} - // Write warning if attribute don't have a default value and return a empty value to avoid warnings - WRITE_WARNING("attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' don't have a default value"); - return std::vector(); + +template<> std::vector +GNEAttributeCarrier::getDefaultValue(SumoXMLTag tag, SumoXMLAttr attr) { + for (std::vector >::iterator i = _allowedAttributes.at(tag).begin(); i != _allowedAttributes.at(tag).end(); i++) { + if (((*i).first == attr) && ((*i).second != NODEFAULTVALUE)) { + return parse >((*i).second); + } + } + // throw exception if attribute doesn't have a default value and return a empty value to avoid warnings + throw ProcessError("attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' doesn't have a default value"); } template<> std::vector GNEAttributeCarrier::getDefaultValue(SumoXMLTag tag, SumoXMLAttr attr) { - std::cout << "FINISH" << std::endl; - - // Write warning if attribute don't have a default value and return a empty value to avoid warnings - WRITE_WARNING("attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' don't have a default value"); - return std::vector(); + for (std::vector >::iterator i = _allowedAttributes.at(tag).begin(); i != _allowedAttributes.at(tag).end(); i++) { + if (((*i).first == attr) && ((*i).second != NODEFAULTVALUE)) { + return parse >((*i).second); + } + } + // throw exception if attribute doesn't have a default value and return a empty value to avoid warnings + throw ProcessError("attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' doesn't have a default value"); } @@ -851,14 +1326,11 @@ GNEAttributeCarrier::getDefaultValue(SumoXMLTag tag, SumoXMLAttr attr) { for (std::vector >::iterator i = _allowedAttributes.at(tag).begin(); i != _allowedAttributes.at(tag).end(); i++) { if ((*i).first == attr) { - std::vector myVectorString; - SUMOSAXAttributes::parseStringVector((*i).second, myVectorString); - return myVectorString; + return parse >((*i).second); } } - // Write warning if attribute don't have a default value and return a empty value to avoid warnings - WRITE_WARNING("attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' don't have a default value"); - return std::vector(); + // throw exception if attribute doesn't have a default value and return a empty value to avoid warnings + throw ProcessError("attribute '" + toString(attr) + "' for tag '" + toString(tag) + "' doesn't have a default value"); } /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAttributeCarrier.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAttributeCarrier.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEAttributeCarrier.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEAttributeCarrier.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEAttributeCarrier.h /// @author Jakob Erdmann /// @date Mar 2011 -/// @version $Id: GNEAttributeCarrier.h 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: GNEAttributeCarrier.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Abstract Base class for gui objects which carry attributes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,6 +36,7 @@ #include #include #include +#include #include "GNEReferenceCounter.h" @@ -61,8 +62,9 @@ public: /**@brief Constructor * @param[in] tag SUMO Tag assigned to this type of object + * @param[in] icon GUIIcon associated to the type of object */ - GNEAttributeCarrier(SumoXMLTag tag); + GNEAttributeCarrier(SumoXMLTag tag, GUIIcon icon); /// @brief Destructor virtual ~GNEAttributeCarrier() {}; @@ -91,61 +93,75 @@ /// @brief how should this attribute carrier be called virtual std::string getDescription(); - /// @brief get Tag assigned to this object + /// @brief get XML Tag assigned to this object SumoXMLTag getTag() const; + /// @brief get FXIcon assigned to this object + FXIcon* getIcon() const; + + /// @brief get GUI icon assigned to this object + GUIIcon getGUIIcon() const; + /// @brief get vector of attributes std::vector getAttrs() const; /// @brief function to support debugging const std::string getID() const; - /// @brief get parent's tag of a certain additional element - static SumoXMLTag getParentType(SumoXMLTag tag); + /// @brief get type of attribute + static std::string getAttributeType(SumoXMLTag tag, SumoXMLAttr attr); /// @brief get all editable attributes for tag and their default values. - static const std::vector >& allowedAttributes(SumoXMLTag tag); - - /// @brief get all editable for tag. - static const std::vector& allowedTags(); + static const std::vector >& allowedAttributes(SumoXMLTag tag); - /// @brief get all editable tags for netElements - static const std::vector& allowedNetElementTags(); - - /// @brief get all editable tags for additionals - static const std::vector& allowedAdditionalTags(); + /// @brief get all editable for tag (net or additional). + static const std::vector& allowedTags(bool net); /// @brief whether an attribute is numerical (int or float) - static bool isNumerical(SumoXMLAttr attr); + static bool isNumerical(SumoXMLTag tag, SumoXMLAttr attr); /// @brief whether an attribute is numerical or type int - static bool isInt(SumoXMLAttr attr); + static bool isInt(SumoXMLTag tag, SumoXMLAttr attr); /// @brief whether an attribute is numerical of type float - static bool isFloat(SumoXMLAttr attr); + static bool isFloat(SumoXMLTag tag, SumoXMLAttr attr); - /// @brief whether an attribute is of type bool - static bool isBool(SumoXMLAttr attr); + /// @brief whether an attribute is time + static bool isTime(SumoXMLTag tag, SumoXMLAttr attr); + + /// @brief whether an attribute is of type bool for a certain tag + static bool isBool(SumoXMLTag tag, SumoXMLAttr attr); /// @brief whether an attribute is of type string - static bool isString(SumoXMLAttr attr); + static bool isString(SumoXMLTag tag, SumoXMLAttr attr); /// @brief whether an attribute is of type bool - static bool isList(SumoXMLAttr attr); + static bool isList(SumoXMLTag tag, SumoXMLAttr attr); - /// @brief whether an attribute is unique (may not be edited for a multi-selection) - /// @note unique attributes don't have a default value - static bool isUnique(SumoXMLAttr attr); + /// @brief whether an attribute is unique (may not be edited for a multi-selection and don't have a default value) + static bool isUnique(SumoXMLTag tag, SumoXMLAttr attr); /// @brief whether an attribute is Discrete static bool isDiscrete(SumoXMLTag tag, SumoXMLAttr attr); - /// @brief check if a element with certain tag has another additional element as parent - static bool hasParent(SumoXMLTag tag); + /// @brief whether an attribute is only Positive (i.e. cannot take negative values) + static bool isPositive(SumoXMLTag tag, SumoXMLAttr attr); + + /// @brief whether an attribute is a probability (i.e. oly can values between [0, 1]) + static bool isProbability(SumoXMLTag tag, SumoXMLAttr attr); + + /// @brief whether a string attribute is a filename + static bool isFilename(SumoXMLTag tag, SumoXMLAttr attr); - /// @brief check if a element with certain tag has a certain attribute + /// @brief whether an attribute is non editable + static bool isNonEditable(SumoXMLTag tag, SumoXMLAttr attr); + + /// @brief check if an element with certain tag has a certain attribute static bool hasAttribute(SumoXMLTag tag, SumoXMLAttr attr); + /// @brief check if attribute of an element has a default avlue + static bool hasDefaultValue(SumoXMLTag tag, SumoXMLAttr attr); + /// @brief return a list of discrete choices for this attribute or an empty vector static const std::vector& discreteChoices(SumoXMLTag tag, SumoXMLAttr attr); @@ -192,10 +208,7 @@ static bool isValidID(const std::string& value); /// @brief true if value is a valid file value - static bool isValidFileValue(const std::string& value); - - /// @brief true if value is a valid string vector - static bool isValidStringVector(const std::string& value); + static bool isValidFilename(const std::string& value); /// @brief feature is still unchanged after being loaded (implies approval) static const std::string LOADED; @@ -213,14 +226,14 @@ /// @brief method for setting the attribute and nothing else (used in GNEChange_Attribute) virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0; - /// @brief the xml tag to which this carrier corresponds + /// @brief the xml tag to which this attribute carrier corresponds const SumoXMLTag myTag; - /// @brief map with the allowed attributes - static std::map > > _allowedAttributes; + /// @brief icon associated to this AC + GUIIcon myIcon; - /// @brief vector with the allowed tags - static std::vector myAllowedTags; + /// @brief map with the allowed attributes and their default values + static std::map > > _allowedAttributes; /// @brief vector with the allowed tags of netElements static std::vector myAllowedNetElementTags; @@ -228,17 +241,35 @@ /// @brief vector with the allowed tags of additionals static std::vector myAllowedAdditionalTags; - /// @brief set with the numerical attributes of type Int - static std::set myNumericalIntAttrs; + /// @brief map with the numerical attributes of type Int + static std::map > myNumericalIntAttrs; + + /// @brief map with the numerical attributes of type Float + static std::map > myNumericalFloatAttrs; + + /// @brief map with the attributes of type time + static std::map > myTimeAttrs; - /// @brief set with the numerical attributes of type Float - static std::set myNumericalFloatAttrs; + /// @brief map with the boolean attributes + static std::map > myBoolAttrs; - /// @brief set with the attributes of type list - static std::set myListAttrs; + /// @brief map with the attributes of type list + static std::map > myListAttrs; - /// @brief set with the unique attributes (i.e. attributes without default values) - static std::set myUniqueAttrs; + /// @brief map with the unique attributes (i.e. attributes without default values) + static std::map > myUniqueAttrs; + + /// @brief map with the non-editable attributes + static std::map > myNonEditableAttrs; + + /// @brief map with the positive attributes + static std::map > myPositiveAttrs; + + /// @brief map with the probability attributes + static std::map > myProbabilityAttrs; + + /// @brief map with the empty attributes + static std::map > myFileAttrs; /// @brief map with the allowed tags of additionals with parent and their parent static std::map myAllowedAdditionalWithParentTags; @@ -249,6 +280,9 @@ /// @brief map with the definition of attributes static std::map > myAttrDefinitions; + /// @brief maximum number of attributes of all tags + static int myMaxNumAttribute; + private: /// @brief Invalidated assignment operator GNEAttributeCarrier& operator=(const GNEAttributeCarrier& src); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEBusStop.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEBusStop.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEBusStop.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEBusStop.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEBusStop.cpp /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEBusStop.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEBusStop.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// /// A lane area vehicles can halt at (GNE version) /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,6 +46,7 @@ #include #include #include +#include #include "GNEBusStop.h" #include "GNELane.h" @@ -56,16 +57,12 @@ #include "GNEChange_Attribute.h" #include "GNEViewNet.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== -GNEBusStop::GNEBusStop(const std::string& id, GNELane* lane, GNEViewNet* viewNet, SUMOReal startPos, SUMOReal endPos, const std::vector& lines, bool blocked) : - GNEStoppingPlace(id, viewNet, SUMO_TAG_BUS_STOP, lane, startPos, endPos, blocked), +GNEBusStop::GNEBusStop(const std::string& id, GNELane* lane, GNEViewNet* viewNet, double startPos, double endPos, const std::vector& lines) : + GNEStoppingPlace(id, viewNet, SUMO_TAG_BUS_STOP, ICON_BUSSTOP, lane, startPos, endPos), myLines(lines) { // When a new additional element is created, updateGeometry() must be called updateGeometry(); @@ -89,7 +86,7 @@ myShapeLengths.clear(); // Get value of option "lefthand" - SUMOReal offsetSign = OptionsCont::getOptions().getBool("lefthand") ? -1 : 1; + double offsetSign = OptionsCont::getOptions().getBool("lefthand") ? -1 : 1; // Get shape of lane parent myShape = myLane->getShape(); @@ -98,7 +95,7 @@ myShape.move2side(1.65 * offsetSign); // Cut shape using as delimitators from start position and end position - myShape = myShape.getSubpart(myLane->getPositionRelativeToParametricLenght(myStartPos), myLane->getPositionRelativeToParametricLenght(myEndPos)); + myShape = myShape.getSubpart(myLane->getPositionRelativeToParametricLength(myStartPos), myLane->getPositionRelativeToParametricLength(myEndPos)); // Get number of parts of the shape int numberOfSegments = (int) myShape.size() - 1; @@ -123,7 +120,7 @@ myShapeLengths.push_back(f.distanceTo(s)); // Save rotation (angle) of the vector constructed by points f and s - myShapeRotations.push_back((SUMOReal) atan2((s.x() - f.x()), (f.y() - s.y())) * (SUMOReal) 180.0 / (SUMOReal) PI); + myShapeRotations.push_back((double) atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double) PI); } } @@ -148,7 +145,7 @@ void -GNEBusStop::writeAdditional(OutputDevice& device, const std::string&) { +GNEBusStop::writeAdditional(OutputDevice& device) const { // Write parameters device.openTag(getTag()); device.writeAttr(SUMO_ATTR_ID, getID()); @@ -191,9 +188,9 @@ } // Obtain exaggeration of the draw - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); - // Draw the area using shape, shapeRotations, shapeLenghts and value of exaggeration + // Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, exaggeration); // Check if the distance is enought to draw details @@ -203,7 +200,7 @@ glPushMatrix(); // Obtain rotation of the sing depeding of the option "lefthand" - SUMOReal rotSign = OptionsCont::getOptions().getBool("lefthand"); + double rotSign = OptionsCont::getOptions().getBool("lefthand"); // Set color of the lines if (isAdditionalSelected()) { @@ -248,10 +245,10 @@ // Start drawing sign traslating matrix to signal position glTranslated(mySignPos.x(), mySignPos.y(), 0); - // Define nº points (for efficiency) + // Define number of points (for efficiency) int noPoints = 9; - // If the scale * exaggeration is more than 25, recalculate nº points + // If the scale * exaggeration is more than 25, recalculate number of points if (s.scale * exaggeration > 25) { noPoints = MIN2((int)(9.0 + (s.scale * exaggeration) / 10.0), 36); } @@ -260,7 +257,7 @@ glScaled(exaggeration, exaggeration, 1); // Draw green circle - GLHelper::drawFilledCircle((SUMOReal) 1.1, noPoints); + GLHelper::drawFilledCircle((double) 1.1, noPoints); // Traslate to front glTranslated(0, 0, .1); @@ -273,7 +270,7 @@ } // draw another circle in the same position, but a little bit more small - GLHelper::drawFilledCircle((SUMOReal) 0.9, noPoints); + GLHelper::drawFilledCircle((double) 0.9, noPoints); // If the scale * exageration is equal or more than 4.5, draw H if (s.scale * exaggeration >= 4.5) { @@ -318,7 +315,7 @@ case GNE_ATTR_BLOCK_MOVEMENT: return toString(myBlocked); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -339,7 +336,7 @@ updateGeometry(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -360,18 +357,33 @@ return false; } case SUMO_ATTR_STARTPOS: - return (canParse(value) && parse(value) >= 0 && parse(value) < (myEndPos - 1)); + return (canParse(value) && parse(value) >= 0 && parse(value) < (myEndPos - 1)); case SUMO_ATTR_ENDPOS: { - if (canParse(value) && parse(value) >= 1 && parse(value) > myStartPos) { + if (canParse(value) && parse(value) >= 1 && parse(value) > myStartPos) { // If extension is larger than Lane - if (parse(value) > myLane->getLaneParametricLenght()) { - // Ask user if want to assign the lenght of lane as endPosition + if (parse(value) > myLane->getLaneParametricLength()) { + // write warning if netedit is running in testing mode + if (myViewNet->isTestingModeEnabled() == true) { + WRITE_WARNING("Opening FXMessageBox of type 'question'"); + } + // Ask user if want to assign the length of lane as endPosition FXuint answer = FXMessageBox::question(getViewNet()->getApp(), MBOX_YES_NO, - "EndPosition exceeds the size of the lane", "%s", - "EndPosition exceeds the size of the lane. You want to assign the size of the lane as endPosition?"); + (toString(SUMO_ATTR_ENDPOS) + " exceeds the size of the " + toString(SUMO_TAG_LANE)).c_str(), "%s", + (toString(SUMO_ATTR_ENDPOS) + " exceeds the size of the " + toString(SUMO_TAG_LANE) + + ". Do you want to assign the length of the " + toString(SUMO_TAG_LANE) + " as " + toString(SUMO_ATTR_ENDPOS) + "?").c_str()); if (answer == 1) { //1:yes, 2:no, 4:esc + // write warning if netedit is running in testing mode + if (myViewNet->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Yes'"); + } return true; } else { + // write warning if netedit is running in testing mode + if ((answer == 2) && (myViewNet->isTestingModeEnabled() == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'"); + } else if ((answer == 4) && (myViewNet->isTestingModeEnabled() == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'"); + } return false; } } else { @@ -382,11 +394,11 @@ } } case SUMO_ATTR_LINES: - return isValidStringVector(value); + return canParse >(value); case GNE_ATTR_BLOCK_MOVEMENT: return canParse(value); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -404,22 +416,21 @@ changeLane(value); break; case SUMO_ATTR_STARTPOS: - myStartPos = parse(value); + myStartPos = parse(value); updateGeometry(); getViewNet()->update(); break; case SUMO_ATTR_ENDPOS: - if (parse(value) > myLane->getLaneParametricLenght()) { - myEndPos = myLane->getLaneParametricLenght(); + if (parse(value) > myLane->getLaneParametricLength()) { + myEndPos = myLane->getLaneParametricLength(); } else { - myEndPos = parse(value); + myEndPos = parse(value); } updateGeometry(); getViewNet()->update(); break; case SUMO_ATTR_LINES: - myLines.clear(); - SUMOSAXAttributes::parseStringVector(value, myLines); + myLines = GNEAttributeCarrier::parse >(value); getViewNet()->update(); break; case GNE_ATTR_BLOCK_MOVEMENT: @@ -427,8 +438,9 @@ getViewNet()->update(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEBusStop.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEBusStop.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEBusStop.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEBusStop.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEBusStop.h /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEBusStop.h 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: GNEBusStop.h 23150 2017-02-27 12:08:30Z behrisch $ /// /// A class for visualizing busStop geometry (adapted from GUILaneWrapper) /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -64,9 +64,8 @@ * @param[in] startPos Start position of the StoppingPlace * @param[in] endPos End position of the StoppingPlace * @param[in] lines lines of the busStop - * @param[in] blocked set initial blocking state of item */ - GNEBusStop(const std::string& id, GNELane* lane, GNEViewNet* viewNet, SUMOReal startPos, SUMOReal endPos, const std::vector& lines, bool blocked); + GNEBusStop(const std::string& id, GNELane* lane, GNEViewNet* viewNet, double startPos, double endPos, const std::vector& lines); /// @brief Destructor ~GNEBusStop(); @@ -77,7 +76,7 @@ /**@brief writte additional element into a xml file * @param[in] device device in which write parameters of additional element */ - void writeAdditional(OutputDevice& device, const std::string&); + void writeAdditional(OutputDevice& device) const; /// @brief get string vector with the lines of the busStop std::vector getLines() const; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibrator.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibrator.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibrator.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibrator.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNECalibrator.cpp /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNECalibrator.cpp 21640 2016-10-09 20:28:52Z palcraft $ +/// @version $Id: GNECalibrator.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -57,23 +57,23 @@ #include "GNERouteProbe.h" #include "GNECalibratorDialog.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif - // =========================================================================== // member method definitions // =========================================================================== -GNECalibrator::GNECalibrator(const std::string& id, GNEEdge* edge, GNEViewNet* viewNet, SUMOReal pos, SUMOTime frequency, const std::string& output, const std::map& flowValues, bool blocked) : - GNEAdditional(id, viewNet, Position(pos, 0), SUMO_TAG_CALIBRATOR, NULL, blocked), +GNECalibrator::GNECalibrator(const std::string& id, GNELane* lane, GNEViewNet* viewNet, double pos, + double frequency, const std::string& output, const std::vector& calibratorRoutes, + const std::vector& calibratorFlows, const std::vector& calibratorVehicleTypes) : + GNEAdditional(id, viewNet, Position(pos, 0), SUMO_TAG_CALIBRATOR, ICON_CALIBRATOR), myFrequency(frequency), myOutput(output), myRouteProbe(NULL), /** change this in the future **/ - myFlowValues(flowValues) { - // This additional belong to a edge - myEdge = edge; + myCalibratorRoutes(calibratorRoutes), + myCalibratorFlows(calibratorFlows), + myCalibratorVehicleTypes(calibratorVehicleTypes) { + // This additional belong to a lane + myLane = lane; // this additional ISN'T movable myMovable = false; // Update geometry; @@ -86,18 +86,17 @@ } -GNECalibrator::~GNECalibrator() { -} +GNECalibrator::~GNECalibrator() {} void -GNECalibrator::moveAdditionalGeometry(SUMOReal, SUMOReal) { +GNECalibrator::moveAdditionalGeometry(double, double) { // This additional cannot be moved } void -GNECalibrator::commmitAdditionalGeometryMoved(SUMOReal, SUMOReal, GNEUndoList*) { +GNECalibrator::commmitAdditionalGeometryMoved(double, double, GNEUndoList*) { // This additional cannot be moved } @@ -107,25 +106,20 @@ // Clear all containers myShapeRotations.clear(); myShapeLengths.clear(); - // clear Shape myShape.clear(); - // Iterate over lanes - for (int i = 0; i < (int)myEdge->getLanes().size(); i++) { - - // Get shape of lane parent - myShape.push_back(myEdge->getLanes().at(i)->getShape().positionAtOffset(myEdge->getLanes().at(i)->getPositionRelativeToParametricLenght(myPosition.x()))); + // Get shape of lane parent + myShape.push_back(myLane->getShape().positionAtOffset(myLane->getPositionRelativeToParametricLength(myPosition.x()))); - // Obtain first position - Position f = myShape[i] - Position(1, 0); + // Obtain first position + Position f = myShape[0] - Position(1, 0); - // Obtain next position - Position s = myShape[i] + Position(1, 0); + // Obtain next position + Position s = myShape[0] + Position(1, 0); - // Save rotation (angle) of the vector constructed by points f and s - myShapeRotations.push_back(myEdge->getLanes().at(i)->getShape().rotationDegreeAtOffset(myEdge->getLanes().at(i)->getPositionRelativeToParametricLenght(myPosition.x())) * -1); - } + // Save rotation (angle) of the vector constructed by points f and s + myShapeRotations.push_back(myLane->getShape().rotationDegreeAtOffset(myLane->getPositionRelativeToParametricLength(myPosition.x())) * -1); // Refresh element (neccesary to avoid grabbing problems) myViewNet->getNet()->refreshAdditional(this); @@ -145,56 +139,137 @@ void -GNECalibrator::writeAdditional(OutputDevice& device, const std::string&) { +GNECalibrator::writeAdditional(OutputDevice& device) const { // Write parameters device.openTag(getTag()); device.writeAttr(SUMO_ATTR_ID, getID()); - device.writeAttr(SUMO_ATTR_LANE, myEdge->getLanes().at(0)->getID()); + device.writeAttr(SUMO_ATTR_LANE, myLane->getID()); device.writeAttr(SUMO_ATTR_POSITION, myPosition.x()); - device.writeAttr(SUMO_ATTR_FREQUENCY, time2string(myFrequency)); + device.writeAttr(SUMO_ATTR_FREQUENCY, myFrequency); device.writeAttr(SUMO_ATTR_OUTPUT, myOutput); + // write all routes of this calibrator + for (std::vector::const_iterator i = myCalibratorRoutes.begin(); i != myCalibratorRoutes.end(); ++i) { + // Open route tag + device.openTag(i->getTag()); + // Write route ID + device.writeAttr(SUMO_ATTR_BEGIN, i->getRouteID()); + // Write edge IDs + device.writeAttr(SUMO_ATTR_BEGIN, i->getEdgesIDs()); + // Write Color + device.writeAttr(SUMO_ATTR_BEGIN, i->getColor()); + // Close flow tag + device.closeTag(); + } + // write all vehicle types of this calibrator + for (std::vector::const_iterator i = myCalibratorVehicleTypes.begin(); i != myCalibratorVehicleTypes.end(); ++i) { + // Open vehicle type tag + device.openTag(i->getTag()); + // write id + device.writeAttr(SUMO_ATTR_ID, i->getVehicleTypeID()); + //write accel + device.writeAttr(SUMO_ATTR_ACCEL, i->getAccel()); + // write decel + device.writeAttr(SUMO_ATTR_DECEL, i->getDecel()); + // write sigma + device.writeAttr(SUMO_ATTR_SIGMA, i->getSigma()); + // write tau + device.writeAttr(SUMO_ATTR_TAU, i->getTau()); + // write lenght + device.writeAttr(SUMO_ATTR_LENGTH, i->getLength()); + // write min gap + device.writeAttr(SUMO_ATTR_MINGAP, i->getMinGap()); + // write max speed + device.writeAttr(SUMO_ATTR_MAXSPEED, i->getMaxSpeed()); + // write speed factor + device.writeAttr(SUMO_ATTR_SPEEDFACTOR, i->getSpeedFactor()); + // write speed dev + device.writeAttr(SUMO_ATTR_SPEEDDEV, i->getSpeedDev()); + // write color + device.writeAttr(SUMO_ATTR_COLOR, i->getColor()); + // write vehicle class + device.writeAttr(SUMO_ATTR_VCLASS, i->getVClass()); + // write emission class + device.writeAttr(SUMO_ATTR_EMISSIONCLASS, i->getEmissionClass()); + // write shape + device.writeAttr(SUMO_ATTR_SHAPE, i->getShape()); + // write width + device.writeAttr(SUMO_ATTR_WIDTH, i->getWidth()); + // write filename + device.writeAttr(SUMO_ATTR_FILE, i->getFilename()); + // write impatience + device.writeAttr(SUMO_ATTR_IMPATIENCE, i->getImpatience()); + // write lane change model + device.writeAttr(SUMO_ATTR_LANE_CHANGE_MODEL, i->getLaneChangeModel()); + // write car follow model + device.writeAttr(SUMO_ATTR_CAR_FOLLOW_MODEL, i->getCarFollowModel()); + // write person capacity + device.writeAttr(SUMO_ATTR_PERSON_CAPACITY, i->getPersonCapacity()); + // write container capacity + device.writeAttr(SUMO_ATTR_CONTAINER_CAPACITY, i->getContainerCapacity()); + // write boarding duration + device.writeAttr(SUMO_ATTR_BOARDING_DURATION, i->getBoardingDuration()); + // write loading duration + device.writeAttr(SUMO_ATTR_LOADING_DURATION, i->getLoadingDuration()); + // write get lat alignment + device.writeAttr(SUMO_ATTR_LATALIGNMENT, i->getLatAlignment()); + // write min gap lat + device.writeAttr(SUMO_ATTR_MINGAP_LAT, i->getMinGapLat()); + // write max speed lat + device.writeAttr(SUMO_ATTR_MAXSPEED_LAT, i->getMaxSpeedLat()); + // Close vehicle type tag + device.closeTag(); + } // Write all flows of this calibrator - for (std::map::iterator i = myFlowValues.begin(); i != myFlowValues.end(); ++i) { + for (std::vector::const_iterator i = myCalibratorFlows.begin(); i != myCalibratorFlows.end(); ++i) { // Open flow tag - device.openTag(SUMO_TAG_FLOW); - // Write ID - device.writeAttr(SUMO_ATTR_ID, i->first); + device.openTag(i->getTag()); // Write begin - device.writeAttr(SUMO_ATTR_BEGIN, i->second.begin); - // Write nd - device.writeAttr(SUMO_ATTR_END, i->second.end); + device.writeAttr(SUMO_ATTR_BEGIN, i->getBegin()); + // Write end + device.writeAttr(SUMO_ATTR_END, i->getEnd()); // Write type - device.writeAttr(SUMO_ATTR_TYPE, i->second.type); + device.writeAttr(SUMO_ATTR_TYPE, i->getVehicleType()); // Write route - device.writeAttr(SUMO_ATTR_ROUTE, i->second.route); + device.writeAttr(SUMO_ATTR_ROUTE, i->getRoute()); // Write color - device.writeAttr(SUMO_ATTR_COLOR, i->second.color); + device.writeAttr(SUMO_ATTR_COLOR, i->getColor()); // Write depart lane - device.writeAttr(SUMO_ATTR_DEPARTLANE, i->second.departLane); + device.writeAttr(SUMO_ATTR_DEPARTLANE, i->getDepartLane()); // Write depart pos - device.writeAttr(SUMO_ATTR_DEPARTPOS, i->second.departPos); + device.writeAttr(SUMO_ATTR_DEPARTPOS, i->getDepartPos()); // Write depart speed - device.writeAttr(SUMO_ATTR_DEPARTSPEED, i->second.departSpeed); + device.writeAttr(SUMO_ATTR_DEPARTSPEED, i->getDepartSpeed()); // Write arrival lane - device.writeAttr(SUMO_ATTR_ARRIVALLANE, i->second.arrivalLane); + device.writeAttr(SUMO_ATTR_ARRIVALLANE, i->getArrivalLane()); // Write arrival pos - device.writeAttr(SUMO_ATTR_ARRIVALPOS, i->second.arrivalPos); + device.writeAttr(SUMO_ATTR_ARRIVALPOS, i->getArrivalPos()); // Write arrival speed - device.writeAttr(SUMO_ATTR_ARRIVALSPEED, i->second.arrivalSpeed); + device.writeAttr(SUMO_ATTR_ARRIVALSPEED, i->getArrivalSpeed()); // Write line - device.writeAttr(SUMO_ATTR_LINE, i->second.line); + device.writeAttr(SUMO_ATTR_LINE, i->getLine()); // Write person number - device.writeAttr(SUMO_ATTR_PERSON_NUMBER, i->second.personNumber); + device.writeAttr(SUMO_ATTR_PERSON_NUMBER, i->getPersonNumber()); // Write container number - device.writeAttr(SUMO_ATTR_CONTAINER_NUMBER, i->second.containerNumber); - // Write vehsPerHour - device.writeAttr(SUMO_ATTR_VEHSPERHOUR, i->second.vehsPerHour); - // Write period - device.writeAttr(SUMO_ATTR_PERIOD, i->second.period); - // Write probability - device.writeAttr(SUMO_ATTR_PROB, i->second.probability); + device.writeAttr(SUMO_ATTR_CONTAINER_NUMBER, i->getContainerNumber()); + // Write reroute + device.writeAttr(SUMO_ATTR_REROUTE, i->getReroute()); + // Write departPosLat + device.writeAttr(SUMO_ATTR_DEPARTPOS_LAT, i->getDepartPosLat()); + // Write arrivalPosLat + device.writeAttr(SUMO_ATTR_ARRIVALPOS_LAT, i->getArrivalPosLat()); // Write number - device.writeAttr(SUMO_ATTR_NUMBER, i->second.number); + device.writeAttr(SUMO_ATTR_NUMBER, i->getNumber()); + // Write type of flow + if (i->getFlowType() == GNECalibratorFlow::GNE_CALIBRATORFLOW_PERIOD) { + // write period + device.writeAttr(SUMO_ATTR_PERIOD, i->getPeriod()); + } else if (i->getFlowType() == GNECalibratorFlow::GNE_CALIBRATORFLOW_VEHSPERHOUR) { + // write vehs per hour + device.writeAttr(SUMO_ATTR_VEHSPERHOUR, i->getVehsPerHour()); + } else if (i->getFlowType() == GNECalibratorFlow::GNE_CALIBRATORFLOW_PROBABILITY) { + // write probability + device.writeAttr(SUMO_ATTR_PROB, i->getProbability()); + } // Close flow tag device.closeTag(); } @@ -203,43 +278,158 @@ } -std::map -GNECalibrator::getFlowValues() const { - return myFlowValues; +void +GNECalibrator::addCalibratorVehicleType(const GNECalibratorVehicleType& vehicleType) { + myCalibratorVehicleTypes.push_back(vehicleType); } void -GNECalibrator::setFlowValues(std::map calibratorFlowValues) { - myFlowValues = calibratorFlowValues; +GNECalibrator::addCalibratorFlow(const GNECalibratorFlow& flow) { + myCalibratorFlows.push_back(flow); } void -GNECalibrator::insertFlow(const std::string& id, const CalibratorFlow& flow) { - if (myFlowValues.find(id) == myFlowValues.end()) { - myFlowValues[id] = flow; - } else { - throw InvalidArgument("Calibrators don't allow Flows with duplicate Id's (" + id + ")"); - } +GNECalibrator::addCalibratorRoute(const GNECalibratorRoute& route) { + myCalibratorRoutes.push_back(route); +} + +const std::vector& +GNECalibrator::getCalibratorVehicleTypes() const { + return myCalibratorVehicleTypes; +} + + +const std::vector& +GNECalibrator::getCalibratorFlows() const { + return myCalibratorFlows; +} + + +const std::vector& +GNECalibrator::getCalibratorRoutes() const { + return myCalibratorRoutes; +} + + +void +GNECalibrator::setCalibratorVehicleTypes(const std::vector& calibratorVehicleTypes) { + myCalibratorVehicleTypes = calibratorVehicleTypes; +} + + +void +GNECalibrator::setCalibratorFlows(const std::vector& calibratorFlows) { + myCalibratorFlows = calibratorFlows; } void -GNECalibrator::removeFlow(const std::string& id) { - if (myFlowValues.find(id) != myFlowValues.end()) { - myFlowValues.erase(id); - } else { - throw InvalidArgument("Calibrator with Id''" + id + "' not exists"); +GNECalibrator::setCalibratorRoutes(const std::vector& calibratorRoutes) { + myCalibratorRoutes = calibratorRoutes; +} + + +std::string +GNECalibrator::generateVehicleTypeID() const { + int counter = 0; + while (myViewNet->getNet()->vehicleTypeExists(toString(SUMO_TAG_VTYPE) + toString(counter)) == true) { + counter++; } + return (toString(SUMO_TAG_VTYPE) + toString(counter)); +} + +std::string +GNECalibrator::generateFlowID() const { + int counter = 0; + while (myViewNet->getNet()->flowExists(toString(SUMO_TAG_FLOW) + toString(counter)) == true) { + counter++; + } + return (toString(SUMO_TAG_FLOW) + toString(counter)); } +std::string +GNECalibrator::generateRouteID() const { + int counter = 0; + while (myViewNet->getNet()->routeExists(toString(SUMO_TAG_ROUTE) + toString(counter)) == true) { + counter++; + } + return (toString(SUMO_TAG_ROUTE) + toString(counter)); +} + + +bool +GNECalibrator::vehicleTypeExists(std::string vehicleTypeID) const { + for (std::vector::const_iterator i = myCalibratorVehicleTypes.begin(); i != myCalibratorVehicleTypes.end(); i++) { + if (i->getVehicleTypeID() == vehicleTypeID) { + return true; + } + } + return false; +} + + +bool +GNECalibrator::flowExists(std::string flowID) const { + for (std::vector::const_iterator i = myCalibratorFlows.begin(); i != myCalibratorFlows.end(); i++) { + if (i->getFlowID() == flowID) { + return true; + } + } + return false; +} + + +bool +GNECalibrator::routeExists(std::string routeID) const { + for (std::vector::const_iterator i = myCalibratorRoutes.begin(); i != myCalibratorRoutes.end(); i++) { + if (i->getRouteID() == routeID) { + return true; + } + } + return false; +} + + +const GNECalibratorVehicleType& +GNECalibrator::getCalibratorVehicleType(const std::string& vehicleTypeID) { + for (std::vector::iterator i = myCalibratorVehicleTypes.begin(); i != myCalibratorVehicleTypes.end(); i++) { + if (i->getVehicleTypeID() == vehicleTypeID) { + return (*i); + } + } + throw InvalidArgument(toString(getTag()) + " " + getID() + " doesn't have a " + toString(SUMO_TAG_VTYPE) + " with id = '" + vehicleTypeID + "'"); +} + + +const GNECalibratorFlow& +GNECalibrator::getCalibratorFlow(const std::string& flowID) { + for (std::vector::iterator i = myCalibratorFlows.begin(); i != myCalibratorFlows.end(); i++) { + if (i->getFlowID() == flowID) { + return (*i); + } + } + throw InvalidArgument(toString(getTag()) + " " + getID() + " doesn't have a " + toString(SUMO_TAG_FLOW) + " with id = '" + flowID + "'"); +} + + +const GNECalibratorRoute& +GNECalibrator::getCalibratorRoute(const std::string& routeID) { + for (std::vector::iterator i = myCalibratorRoutes.begin(); i != myCalibratorRoutes.end(); i++) { + if (i->getRouteID() == routeID) { + return (*i); + } + } + throw InvalidArgument(toString(getTag()) + " " + getID() + " doesn't have a " + toString(SUMO_TAG_ROUTE) + " with id = '" + routeID + "'"); +} + const std::string& GNECalibrator::getParentName() const { - return myEdge->getMicrosimID(); + return myLane->getMicrosimID(); } @@ -248,12 +438,11 @@ // get values glPushName(getGlID()); glLineWidth(1.0); - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); - glPushName(getGlID()); for (int i = 0; i < (int)myShape.size(); ++i) { const Position& pos = myShape[i]; - SUMOReal rot = myShapeRotations[i]; + double rot = myShapeRotations[i]; glPushMatrix(); glTranslated(pos.x(), pos.y(), getType()); glRotated(rot, 0, 0, 1); @@ -278,7 +467,7 @@ glColor3d(0, 0, 0); pfSetPosition(0, 0); pfSetScale(3.f); - SUMOReal w = pfdkGetStringWidth("C"); + double w = pfdkGetStringWidth("C"); glRotated(180, 0, 1, 0); glTranslated(-w / 2., 2, 0); pfDrawString("C"); @@ -297,11 +486,11 @@ case SUMO_ATTR_ID: return getAdditionalID(); case SUMO_ATTR_LANE: - return toString(myEdge->getLanes().at(0)->getAttribute(SUMO_ATTR_ID)); + return toString(myLane->getID()); case SUMO_ATTR_POSITION: return toString(myPosition.x()); case SUMO_ATTR_FREQUENCY: - return time2string(myFrequency); + return toString(myFrequency); case SUMO_ATTR_OUTPUT: return myOutput; case SUMO_ATTR_ROUTEPROBE: @@ -311,7 +500,7 @@ return ""; } default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -332,7 +521,7 @@ updateGeometry(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -355,9 +544,9 @@ } case SUMO_ATTR_POSITION: case SUMO_ATTR_FREQUENCY: - return (canParse(value) && parse(value) >= 0); + return (canParse(value) && parse(value) >= 0); case SUMO_ATTR_OUTPUT: - return isValidFileValue(value); + return isValidFilename(value); case SUMO_ATTR_ROUTEPROBE: if (myViewNet->getNet()->getAdditional(SUMO_TAG_ROUTEPROBE, value) != NULL) { return true; @@ -365,7 +554,7 @@ return false; } default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -383,12 +572,12 @@ changeLane(value); break; case SUMO_ATTR_POSITION: - myPosition = Position(parse(value), 0); + myPosition = Position(parse(value), 0); updateGeometry(); getViewNet()->update(); break; case SUMO_ATTR_FREQUENCY: - myFrequency = string2time(value); + myFrequency = parse(value); break; case SUMO_ATTR_OUTPUT: myOutput = value; @@ -397,8 +586,9 @@ myRouteProbe = dynamic_cast(myViewNet->getNet()->getAdditional(SUMO_TAG_ROUTEPROBE, value)); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorDialog.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorDialog.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorDialog.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorDialog.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -1,13 +1,13 @@ /****************************************************************************/ /// @file GNECalibratorDialog.cpp /// @author Pablo Alvarez Lopez -/// @date Jun 2016 -/// @version $Id: GNECalibratorDialog.cpp 21790 2016-10-25 12:37:24Z behrisch $ +/// @date March 2017 +/// @version $Id: GNECalibratorDialog.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// -/// Dialog for edit rerouters +/// Dialog for edit calibrators /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -28,26 +28,33 @@ #endif #include -#include #include #include +#include +#include #include "GNECalibratorDialog.h" +#include "GNECalibrator.h" +#include "GNEViewNet.h" +#include "GNECalibratorFlowDialog.h" +#include "GNECalibratorRouteDialog.h" +#include "GNECalibratorVehicleTypeDialog.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // =========================================================================== // FOX callback mapping // =========================================================================== FXDEFMAP(GNECalibratorDialog) GNECalibratorDialogMap[] = { - FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_ACCEPT, GNECalibratorDialog::onCmdAccept), - FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_CANCEL, GNECalibratorDialog::onCmdCancel), - FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_RESET, GNECalibratorDialog::onCmdReset), - FXMAPFUNC(SEL_COMMAND, MID_GNE_CALIBRATOR_ADDROW, GNECalibratorDialog::onCmdAddRow), - FXMAPFUNC(SEL_DOUBLECLICKED, MID_GNE_CALIBRATOR_REMOVEROW, GNECalibratorDialog::onCmdRemoveRow), + FXMAPFUNC(SEL_COMMAND, MID_GNE_CALIBRATORDIALOG_ADD_ROUTE, GNECalibratorDialog::onCmdAddRoute), + FXMAPFUNC(SEL_CLICKED, MID_GNE_CALIBRATORDIALOG_TABLE_ROUTE, GNECalibratorDialog::onCmdClickedRoute), + FXMAPFUNC(SEL_COMMAND, MID_GNE_CALIBRATORDIALOG_ADD_FLOW, GNECalibratorDialog::onCmdAddFlow), + FXMAPFUNC(SEL_CLICKED, MID_GNE_CALIBRATORDIALOG_TABLE_FLOW, GNECalibratorDialog::onCmdClickedFlow), + FXMAPFUNC(SEL_COMMAND, MID_GNE_CALIBRATORDIALOG_ADD_VEHICLETYPE, GNECalibratorDialog::onCmdAddVehicleType), + FXMAPFUNC(SEL_CLICKED, MID_GNE_CALIBRATORDIALOG_TABLE_VEHICLETYPE, GNECalibratorDialog::onCmdClickedVehicleType), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_ACCEPT, GNECalibratorDialog::onCmdAccept), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_CANCEL, GNECalibratorDialog::onCmdCancel), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_RESET, GNECalibratorDialog::onCmdReset), }; // Object implementation @@ -58,368 +65,480 @@ // =========================================================================== GNECalibratorDialog::GNECalibratorDialog(GNECalibrator* calibratorParent) : - GNEAdditionalDialog(calibratorParent, 1024, 360), + GNEAdditionalDialog(calibratorParent, 640, 480), myCalibratorParent(calibratorParent) { - // create List with the data - myDataList = new FXTable(myContentFrame, this, MID_GNE_CALIBRATOR_REMOVEROW, LAYOUT_FILL_X | LAYOUT_FILL_Y); - myDataList->setEditable(false); - - // create Horizontal frame for row elements - myRowFrame = new FXHorizontalFrame(myContentFrame, LAYOUT_FILL_X); - - // create Text field for id - myTextFieldId = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, FRAME_THICK | LAYOUT_FILL_X); - - // create Text field for begin - myTextFieldBegin = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, TEXTFIELD_INTEGER | FRAME_THICK | LAYOUT_FILL_X); - - // create Text field for end - myTextFieldEnd = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, TEXTFIELD_INTEGER | FRAME_THICK | LAYOUT_FILL_X); - - // create Text field for type - myTextFieldType = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, FRAME_THICK | LAYOUT_FILL_X); - - // create Text field for route - myTextFieldRoute = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, FRAME_THICK | LAYOUT_FILL_X); - - // create Text field for color - myTextFieldColor = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, FRAME_THICK | LAYOUT_FILL_X); - - // create Text field for depart lane - myTextFieldDepartLane = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, FRAME_THICK | LAYOUT_FILL_X); + // Create two columns, one for Routes and VehicleTypes, and other for Flows + FXHorizontalFrame* columns = new FXHorizontalFrame(myContentFrame, GUIDesignUniformHorizontalFrame); + FXVerticalFrame* columnLeft = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame); + FXVerticalFrame* columnRight = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame); + + // create add buton and label for routes + FXHorizontalFrame* buttonAndLabelRoute = new FXHorizontalFrame(columnLeft, GUIDesignAuxiliarHorizontalFrame); + myAddRoute = new FXButton(buttonAndLabelRoute, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_CALIBRATORDIALOG_ADD_ROUTE, GUIDesignButtonIcon); + new FXLabel(buttonAndLabelRoute, ("Add new " + toString(SUMO_TAG_ROUTE) + "s").c_str(), 0, GUIDesignLabelThick); + + // Create table in left frame + myRouteList = new FXTable(columnLeft, this, MID_GNE_CALIBRATORDIALOG_TABLE_ROUTE, GUIDesignTableAdditionals); + myRouteList->setSelBackColor(FXRGBA(255, 255, 255, 255)); + myRouteList->setSelTextColor(FXRGBA(0, 0, 0, 255)); + myRouteList->setEditable(false); + + // create add buton and label for vehicle types + FXHorizontalFrame* buttonAndLabelVehicleType = new FXHorizontalFrame(columnLeft, GUIDesignAuxiliarHorizontalFrame); + myAddVehicleType = new FXButton(buttonAndLabelVehicleType, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_CALIBRATORDIALOG_ADD_VEHICLETYPE, GUIDesignButtonIcon); + new FXLabel(buttonAndLabelVehicleType, ("Add new " + toString(SUMO_TAG_VTYPE) + "s").c_str(), 0, GUIDesignLabelThick); + + // Create table in left frame + myVehicleTypeList = new FXTable(columnLeft, this, MID_GNE_CALIBRATORDIALOG_TABLE_VEHICLETYPE, GUIDesignTableAdditionals); + myVehicleTypeList->setSelBackColor(FXRGBA(255, 255, 255, 255)); + myVehicleTypeList->setSelTextColor(FXRGBA(0, 0, 0, 255)); + myVehicleTypeList->setEditable(false); + + // create add buton and label for flows in right frame + FXHorizontalFrame* buttonAndLabelFlow = new FXHorizontalFrame(columnRight, GUIDesignAuxiliarHorizontalFrame); + myAddFlow = new FXButton(buttonAndLabelFlow, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_CALIBRATORDIALOG_ADD_FLOW, GUIDesignButtonIcon); + myLabelFlow = new FXLabel(buttonAndLabelFlow, ("Add new " + toString(SUMO_TAG_FLOW) + "s").c_str(), 0, GUIDesignLabelThick); + + // Create table in right frame + myFlowList = new FXTable(columnRight, this, MID_GNE_CALIBRATORDIALOG_TABLE_FLOW, GUIDesignTableAdditionals); + myFlowList->setSelBackColor(FXRGBA(255, 255, 255, 255)); + myFlowList->setSelTextColor(FXRGBA(0, 0, 0, 255)); + myFlowList->setEditable(false); + + // obtain copy of calibrator values + myCopyOfCalibratorRoutes = myCalibratorParent->getCalibratorRoutes(); + myCopyOfCalibratorFlows = myCalibratorParent->getCalibratorFlows(); + myCopyOfCalibratorVehicleTypes = myCalibratorParent->getCalibratorVehicleTypes(); + + // update tables + updateRouteTable(); + updateFlowTable(); + updateVehicleTypeTable(); - // create Text field for depart pos - myTextFieldDepartPos = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, FRAME_THICK | LAYOUT_FILL_X); - - // create Text field for depart speed - myTextFieldDepartSpeed = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, FRAME_THICK | LAYOUT_FILL_X); - - // create Text field for arrival lane - myTextFieldArrivalLane = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, FRAME_THICK | LAYOUT_FILL_X); - - // create Text field for arrival pos - myTextFieldArrivalPos = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, FRAME_THICK | LAYOUT_FILL_X); - - // create Text field for arrival speed - myTextFieldArrivalSpeed = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, FRAME_THICK | LAYOUT_FILL_X); - - // create Text field for line - myTextFieldLine = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, FRAME_THICK | LAYOUT_FILL_X); - - // create Text field for person number - myTextFieldPersonNumber = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, TEXTFIELD_INTEGER | FRAME_THICK | LAYOUT_FILL_X); - - // create Text field for container number - myTextFieldContainerNumber = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, TEXTFIELD_INTEGER | FRAME_THICK | LAYOUT_FILL_X); + // Execute additional dialog (To make it modal) + execute(); +} - // create Text field for vehsPerHour - myTextFieldVehsPerHour = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, TEXTFIELD_REAL | FRAME_THICK | LAYOUT_FILL_X); - // create Text field for period - myTextFieldPeriod = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, TEXTFIELD_REAL | FRAME_THICK | LAYOUT_FILL_X); +GNECalibratorDialog::~GNECalibratorDialog() { +} - // create Text field for probability - myTextFieldProbability = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, TEXTFIELD_REAL | FRAME_THICK | LAYOUT_FILL_X); - // create Text field for number - myTextFieldNumber = new FXTextField(myRowFrame, 10, this, MID_GNE_CALIBRATOR_CHANGEVALUE, TEXTFIELD_INTEGER | FRAME_THICK | LAYOUT_FILL_X); +GNECalibrator* +GNECalibratorDialog::getCalibratorParent() const { + return myCalibratorParent; +} - // create Button for insert row - myAddRow = new FXButton(myRowFrame, "Add", 0, this, MID_GNE_CALIBRATOR_ADDROW, FRAME_THICK | LAYOUT_FILL_X); - // Get values of variable speed signal - myFlowValues = myCalibratorParent->getFlowValues(); +long +GNECalibratorDialog::onCmdAccept(FXObject*, FXSelector, void*) { + // Stop Modal + getApp()->stopModal(this, TRUE); + return 1; +} - // Fill table - updateTable(); - // Execute additional dialog (To make it modal) - execute(); +long +GNECalibratorDialog::onCmdCancel(FXObject*, FXSelector, void*) { + // set original VTypes, routes and flows into calibrator + myCalibratorParent->setCalibratorVehicleTypes(myCopyOfCalibratorVehicleTypes); + myCalibratorParent->setCalibratorRoutes(myCopyOfCalibratorRoutes); + myCalibratorParent->setCalibratorFlows(myCopyOfCalibratorFlows); + // Stop Modal + getApp()->stopModal(this, FALSE); + return 1; } -GNECalibratorDialog::~GNECalibratorDialog() { +long +GNECalibratorDialog::onCmdReset(FXObject*, FXSelector, void*) { + // set original VTypes, routes and flows into calibrator + myCalibratorParent->setCalibratorVehicleTypes(myCopyOfCalibratorVehicleTypes); + myCalibratorParent->setCalibratorRoutes(myCopyOfCalibratorRoutes); + myCalibratorParent->setCalibratorFlows(myCopyOfCalibratorFlows); + // update tables + updateRouteTable(); + updateVehicleTypeTable(); + updateFlowTable(); + return 1; } long -GNECalibratorDialog::onCmdAddRow(FXObject*, FXSelector, void*) { - // Declare new calibrator - GNECalibrator::CalibratorFlow calibratorFlow; - // set ID - std::string id = myTextFieldId->getText().text(); - - // set Start - if (myTextFieldBegin->getText().empty()) { - return 0; +GNECalibratorDialog::onCmdAddRoute(FXObject*, FXSelector, void*) { + // create empty calibrator route and configure it with GNECalibratorRouteDialog + GNECalibratorRoute newRoute(myCalibratorParent); + if (GNECalibratorRouteDialog(this, newRoute, false).execute() == TRUE) { + // if new route was sucesfully configured, add it to calibrator routes + std::vector vehicleTypes = myCalibratorParent->getCalibratorRoutes(); + vehicleTypes.push_back(newRoute); + myCalibratorParent->setCalibratorRoutes(vehicleTypes); + // update routes table + updateRouteTable(); + return 1; } else { - // @todo SUMOTIME - calibratorFlow.begin = TplConvert::_str2int(myTextFieldBegin->getText().text()); - } - - // set End - if (myTextFieldEnd->getText().empty()) { return 0; - } else { - // @todo SUMOTIME - calibratorFlow.end = TplConvert::_str2int(myTextFieldEnd->getText().text()); } +} - // set Type - if (myTextFieldType->getText().empty()) { - return 0; - } else { - calibratorFlow.type = myTextFieldType->getText().text(); - } - // set Route - if (myTextFieldType->getText().empty()) { - return 0; - } else { - calibratorFlow.route = myTextFieldRoute->getText().text(); +long +GNECalibratorDialog::onCmdClickedRoute(FXObject*, FXSelector, void*) { + // check if some delete button was pressed + for (int i = 0; i < (int)myCalibratorParent->getCalibratorRoutes().size(); i++) { + if (myRouteList->getItem(i, 2)->hasFocus()) { + // find all flows that contains route to delete as "route" parameter + std::vector calibratorFlowsToErase; + for (std::vector::const_iterator j = myCalibratorParent->getCalibratorFlows().begin(); j != myCalibratorParent->getCalibratorFlows().end(); j++) { + if (j->getRoute() == myRouteList->getItem(i, 0)->getText().text()) { + calibratorFlowsToErase.push_back(*j); + } + } + // if there are flows that has route to remove as "route" parameter + if (calibratorFlowsToErase.size() > 0) { + // write warning if netedit is running in testing mode + if (myCalibratorParent->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Opening FXMessageBox of type 'question'"); + } + // open question dialog box + FXuint answer = FXMessageBox::question(myCalibratorParent->getViewNet()->getApp(), MBOX_YES_NO, ("Remove " + toString(SUMO_TAG_FLOW) + "s").c_str(), "%s", + ("Deletion of " + toString(SUMO_TAG_ROUTE) + " '" + myRouteList->getItem(i, 0)->getText().text() + + "' will remove " + toString(calibratorFlowsToErase.size()) + " " + toString(SUMO_TAG_FLOW) + (calibratorFlowsToErase.size() > 1 ? ("s") : ("")) + + ". Continue?").c_str()); + if (answer != 1) { //1:yes, 2:no, 4:esc + // write warning if netedit is running in testing mode + if ((answer == 2) && (myCalibratorParent->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'"); + } else if ((answer == 4) && (myCalibratorParent->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'"); + } + // abort deletion of route + return 0; + } else { + // write warning if netedit is running in testing mode + if (myCalibratorParent->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Yes'"); + } + // remove flows with route to delete + std::vector flowSubstraction; + for (std::vector::const_iterator j = myCalibratorParent->getCalibratorFlows().begin(); j != myCalibratorParent->getCalibratorFlows().end(); j++) { + if (std::find(calibratorFlowsToErase.begin(), calibratorFlowsToErase.end(), *j) == calibratorFlowsToErase.end()) { + flowSubstraction.push_back(*j); + } + } + // set substracted flows into calibrator + myCalibratorParent->setCalibratorFlows(flowSubstraction); + // update flows table + updateFlowTable(); + } + } + // remove route of calibrator routes + std::vector vehicleTypes = myCalibratorParent->getCalibratorRoutes(); + vehicleTypes.erase(vehicleTypes.begin() + i); + myCalibratorParent->setCalibratorRoutes(vehicleTypes); + // update routes table + updateRouteTable(); + return 1; + } } + // check if other field was pressed + for (int i = 0; i < (int)myCalibratorParent->getCalibratorRoutes().size(); i++) { + if (myRouteList->getItem(i, 0)->hasFocus() || myRouteList->getItem(i, 1)->hasFocus()) { + // modify route of calibrator routes + std::vector routes = myCalibratorParent->getCalibratorRoutes(); + if (GNECalibratorRouteDialog(this, routes.at(i), true).execute() == TRUE) { + myCalibratorParent->setCalibratorRoutes(routes); + // update routes table + updateRouteTable(); + } + return 1; + } + } + // nothing to do + return 0; +} - // Set color - calibratorFlow.color = myTextFieldColor->getText().text(); - - // Set depart lane - calibratorFlow.departLane = myTextFieldDepartLane->getText().text(); - - // Set depart pos - calibratorFlow.departPos = myTextFieldDepartPos->getText().text(); - - // Set depart speed - calibratorFlow.departSpeed = myTextFieldDepartSpeed->getText().text(); - - // Set arrival lane - calibratorFlow.arrivalLane = myTextFieldArrivalLane->getText().text(); - - // Set arrival pos - calibratorFlow.arrivalPos = myTextFieldArrivalPos->getText().text(); - - // Set arrival speed - calibratorFlow.arrivalSpeed = myTextFieldArrivalSpeed->getText().text(); - - // Set Line - calibratorFlow.line = myTextFieldLine->getText().text(); - - // set PersionNumber - calibratorFlow.personNumber = TplConvert::_str2int(myTextFieldPersonNumber->getText().text()); - - // set Container Number - calibratorFlow.containerNumber = TplConvert::_str2int(myTextFieldContainerNumber->getText().text()); - - // Set vehsPerHour - calibratorFlow.vehsPerHour = TplConvert::_str2SUMOReal(myTextFieldVehsPerHour->getText().text()); - - // set Period - calibratorFlow.period = TplConvert::_str2SUMOReal(myTextFieldPeriod->getText().text()); - - // set Probability - calibratorFlow.probability = TplCheck::_str2SUMOReal(myTextFieldProbability->getText().text()); - - // set Number - calibratorFlow.number = TplConvert::_str2int(myTextFieldNumber->getText().text()); - // Set new time and their speed if don't exist already a flow with the same ID - if (myFlowValues.find(id) == myFlowValues.end()) { - myFlowValues[id] = calibratorFlow; +long +GNECalibratorDialog::onCmdAddFlow(FXObject*, FXSelector, void*) { + // create empty calibrator flow and configure it with GNECalibratorFlowDialog + GNECalibratorFlow newFlow(myCalibratorParent); + if (GNECalibratorFlowDialog(this, newFlow, false).execute() == TRUE) { + // if new flow was sucesfully configured, add it to calibrator flows + std::vector vehicleTypes = myCalibratorParent->getCalibratorFlows(); + vehicleTypes.push_back(newFlow); + myCalibratorParent->setCalibratorFlows(vehicleTypes); + // update flows table + updateFlowTable(); + return 1; } else { return 0; } - - // Update table - updateTable(); - return 1; } long -GNECalibratorDialog::onCmdRemoveRow(FXObject*, FXSelector, void*) { - // Iterate over rows to find the row to erase - for (int i = 0; i < myDataList->getNumRows(); i++) { - if (myDataList->getItem(i, 19)->isSelected()) { - // Remove element of table and map - myFlowValues.erase(myDataList->getItem(i, 0)->getText().text()); - myDataList->removeRows(i); - // update table - updateTable(); +GNECalibratorDialog::onCmdClickedFlow(FXObject*, FXSelector, void*) { + // check if some delete button was pressed + for (int i = 0; i < (int)myCalibratorParent->getCalibratorFlows().size(); i++) { + if (myFlowList->getItem(i, 3)->hasFocus()) { + // remove flow of calibrator flows + std::vector flows = myCalibratorParent->getCalibratorFlows(); + flows.erase(flows.begin() + i); + myCalibratorParent->setCalibratorFlows(flows); + // update flows table + updateFlowTable(); return 1; } } + // check if other field was pressed + for (int i = 0; i < (int)myCalibratorParent->getCalibratorFlows().size(); i++) { + if (myFlowList->getItem(i, 0)->hasFocus() || myFlowList->getItem(i, 1)->hasFocus() || myFlowList->getItem(i, 2)->hasFocus()) { + // modify flow of calibrator flows + std::vector flows = myCalibratorParent->getCalibratorFlows(); + if (GNECalibratorFlowDialog(this, flows.at(i), true).execute() == TRUE) { + myCalibratorParent->setCalibratorFlows(flows); + // update flows table + updateFlowTable(); + } + return 1; + } + } + // nothing to do return 0; } long -GNECalibratorDialog::onCmdAccept(FXObject*, FXSelector, void*) { - // Get values of variable speed signal - myCalibratorParent->setFlowValues(myFlowValues); - // Stop Modal - getApp()->stopModal(this, TRUE); - return 1; +GNECalibratorDialog::onCmdAddVehicleType(FXObject*, FXSelector, void*) { + // create empty calibrator flow and configure it with GNECalibratorVehicleTypeDialog + GNECalibratorVehicleType newVehicleType(myCalibratorParent); + if (GNECalibratorVehicleTypeDialog(this, newVehicleType, false).execute() == TRUE) { + // if new vehicle type was sucesfully configured, add it to calibrator vehicle types + std::vector vehicleTypes = myCalibratorParent->getCalibratorVehicleTypes(); + vehicleTypes.push_back(newVehicleType); + myCalibratorParent->setCalibratorVehicleTypes(vehicleTypes); + // update vehicle types table + updateVehicleTypeTable(); + return 1; + } else { + return 0; + } } long -GNECalibratorDialog::onCmdCancel(FXObject*, FXSelector, void*) { - // Stop Modal - getApp()->stopModal(this, TRUE); - return 1; +GNECalibratorDialog::onCmdClickedVehicleType(FXObject*, FXSelector, void*) { + // check if some delete button was pressed + for (int i = 0; i < (int)myCalibratorParent->getCalibratorVehicleTypes().size(); i++) { + if (myVehicleTypeList->getItem(i, 2)->hasFocus()) { + // find all flows that contains vehicle type to delete as "vehicle type" parameter + std::vector calibratorFlowsToErase; + for (std::vector::const_iterator j = myCalibratorParent->getCalibratorFlows().begin(); j != myCalibratorParent->getCalibratorFlows().end(); j++) { + if (j->getVehicleType() == myVehicleTypeList->getItem(i, 0)->getText().text()) { + calibratorFlowsToErase.push_back(*j); + } + } + // if there are flows that has vehicle type to remove as "vehicle type" parameter + if (calibratorFlowsToErase.size() > 0) { + FXuint answer = FXMessageBox::question(myCalibratorParent->getViewNet()->getApp(), MBOX_YES_NO, ("Remove " + toString(SUMO_TAG_FLOW) + "s").c_str(), "%s", + ("Deletion of " + toString(SUMO_TAG_ROUTE) + " '" + myRouteList->getItem(i, 0)->getText().text() + + "' will remove " + toString(calibratorFlowsToErase.size()) + " " + toString(SUMO_TAG_FLOW) + (calibratorFlowsToErase.size() > 1 ? ("s") : ("")) + + ". Continue?").c_str()); + if (answer != 1) { //1:yes, 2:no, 4:esc + // write warning if netedit is running in testing mode + if ((answer == 2) && (myCalibratorParent->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'"); + } else if ((answer == 4) && (myCalibratorParent->getViewNet()->isTestingModeEnabled() == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'"); + } + // abort deletion of vehicle type + return 0; + } else { + // write warning if netedit is running in testing mode + if (myCalibratorParent->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Yes'"); + } + // remove flows with vehicle type to delete + std::vector flowSubstraction; + for (std::vector::const_iterator j = myCalibratorParent->getCalibratorFlows().begin(); j != myCalibratorParent->getCalibratorFlows().end(); j++) { + if (std::find(calibratorFlowsToErase.begin(), calibratorFlowsToErase.end(), *j) == calibratorFlowsToErase.end()) { + flowSubstraction.push_back(*j); + } + } + // set substracted flows into calibrator + myCalibratorParent->setCalibratorFlows(flowSubstraction); + // update flows table + updateFlowTable(); + } + } + // remove vehicle type of calibrator vehicle types + std::vector vehicleTypes = myCalibratorParent->getCalibratorVehicleTypes(); + vehicleTypes.erase(vehicleTypes.begin() + i); + myCalibratorParent->setCalibratorVehicleTypes(vehicleTypes); + // update vehicle types table + updateVehicleTypeTable(); + return 1; + } + } + // check if other field was pressed + for (int i = 0; i < (int)myCalibratorParent->getCalibratorVehicleTypes().size(); i++) { + if (myVehicleTypeList->getItem(i, 0)->hasFocus() || myVehicleTypeList->getItem(i, 1)->hasFocus()) { + // modify vehicle type of calibratorVehicleTypes + std::vector vehicleTypes = myCalibratorParent->getCalibratorVehicleTypes(); + if (GNECalibratorVehicleTypeDialog(this, vehicleTypes.at(i), true).execute() == TRUE) { + myCalibratorParent->setCalibratorVehicleTypes(vehicleTypes); + // update vehicle types table + updateVehicleTypeTable(); + } + return 1; + } + } + // nothing to do + return 0; } -long -GNECalibratorDialog::onCmdReset(FXObject*, FXSelector, void*) { - // Get values of variable speed signal - myFlowValues = myCalibratorParent->getFlowValues(); - // Update Table - updateTable(); - return 1; +void +GNECalibratorDialog::updateRouteTable() { + // clear table + myRouteList->clearItems(); + // set number of rows + myRouteList->setTableSize(int(myCalibratorParent->getCalibratorRoutes().size()), 3); + // Configure list + myRouteList->setVisibleColumns(4); + myRouteList->setColumnWidth(0, 136); + myRouteList->setColumnWidth(1, 136); + myRouteList->setColumnWidth(2, GUIDesignTableIconCellWidth); + myRouteList->setColumnText(0, toString(SUMO_ATTR_ID).c_str()); + myRouteList->setColumnText(1, toString(SUMO_ATTR_EDGES).c_str()); + myRouteList->setColumnText(2, ""); + myRouteList->getRowHeader()->setWidth(0); + // Declare index for rows and pointer to FXTableItem + int indexRow = 0; + FXTableItem* item = 0; + // iterate over values + for (std::vector::const_iterator i = myCalibratorParent->getCalibratorRoutes().begin(); i != myCalibratorParent->getCalibratorRoutes().end(); i++) { + // Set ID + item = new FXTableItem(toString(i->getRouteID()).c_str()); + myRouteList->setItem(indexRow, 0, item); + // Set edges + item = new FXTableItem(toString(i->getEdgesIDs()).c_str()); + myRouteList->setItem(indexRow, 1, item); + // set remove + item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE)); + item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y); + item->setEnabled(false); + myRouteList->setItem(indexRow, 2, item); + // Update index + indexRow++; + } + // enable or disable flow and label button + updateFlowAndLabelButton(); } void -GNECalibratorDialog::updateTable() { +GNECalibratorDialog::updateFlowTable() { // clear table - myDataList->clearItems(); + myFlowList->clearItems(); // set number of rows - myDataList->setTableSize(int(myFlowValues.size()), 20); + myFlowList->setTableSize(int(myCalibratorParent->getCalibratorFlows().size()), 4); // Configure list - myDataList->setVisibleColumns(20); - myDataList->setColumnWidth(0, getWidth() / 20); - myDataList->setColumnWidth(1, getWidth() / 20); - myDataList->setColumnWidth(2, getWidth() / 20); - myDataList->setColumnWidth(3, getWidth() / 20); - myDataList->setColumnWidth(4, getWidth() / 20); - myDataList->setColumnWidth(5, getWidth() / 20); - myDataList->setColumnWidth(6, getWidth() / 20); - myDataList->setColumnWidth(7, getWidth() / 20); - myDataList->setColumnWidth(8, getWidth() / 20); - myDataList->setColumnWidth(9, getWidth() / 20); - myDataList->setColumnWidth(10, getWidth() / 20); - myDataList->setColumnWidth(11, getWidth() / 20); - myDataList->setColumnWidth(12, getWidth() / 20); - myDataList->setColumnWidth(13, getWidth() / 20); - myDataList->setColumnWidth(14, getWidth() / 20); - myDataList->setColumnWidth(15, getWidth() / 20); - myDataList->setColumnWidth(16, getWidth() / 20); - myDataList->setColumnWidth(17, getWidth() / 20); - myDataList->setColumnWidth(18, getWidth() / 20); - myDataList->setColumnWidth(19, getWidth() / 20 - 10); - myDataList->setColumnText(0, "Id"); - myDataList->setColumnText(1, "Begin"); - myDataList->setColumnText(2, "End"); - myDataList->setColumnText(3, "Type"); - myDataList->setColumnText(4, "Route"); - myDataList->setColumnText(5, "Color"); - myDataList->setColumnText(6, "Dep.Lane"); - myDataList->setColumnText(7, "Dep.Pos."); - myDataList->setColumnText(8, "Dep.Speed"); - myDataList->setColumnText(9, "Arr.Lane"); - myDataList->setColumnText(10, "Arr.Pos."); - myDataList->setColumnText(11, "Arr.Speed"); - myDataList->setColumnText(12, "Line"); - myDataList->setColumnText(13, "Per.Num."); - myDataList->setColumnText(14, "Con.Num"); - myDataList->setColumnText(15, "VehPerHour"); - myDataList->setColumnText(16, "Period"); - myDataList->setColumnText(17, "Prob."); - myDataList->setColumnText(18, "Number"); - myDataList->setColumnText(19, "Del."); - myDataList->getRowHeader()->setWidth(0); - + myFlowList->setVisibleColumns(4); + myFlowList->setColumnWidth(0, 92); + myFlowList->setColumnWidth(1, 90); + myFlowList->setColumnWidth(2, 90); + myFlowList->setColumnWidth(3, GUIDesignTableIconCellWidth); + myFlowList->setColumnText(0, toString(SUMO_ATTR_ID).c_str()); + myFlowList->setColumnText(1, toString(SUMO_ATTR_VCLASS).c_str()); + myFlowList->setColumnText(2, toString(SUMO_ATTR_ROUTE).c_str()); + myFlowList->setColumnText(3, ""); + myFlowList->getRowHeader()->setWidth(0); // Declare index for rows and pointer to FXTableItem int indexRow = 0; FXTableItem* item = 0; - // iterate over values - for (std::map::iterator i = myFlowValues.begin(); i != myFlowValues.end(); i++) { - // set ID - item = new FXTableItem(toString(i->first).c_str()); - myDataList->setItem(indexRow, 0, item); - - // set begin - item = new FXTableItem(toString(i->second.begin).c_str()); - myDataList->setItem(indexRow, 1, item); - - // set end - item = new FXTableItem(toString(i->second.end).c_str()); - myDataList->setItem(indexRow, 2, item); - - // set type - item = new FXTableItem(toString(i->second.type).c_str()); - myDataList->setItem(indexRow, 3, item); - - // set route - item = new FXTableItem(toString(i->second.route).c_str()); - myDataList->setItem(indexRow, 4, item); - - // set color - item = new FXTableItem(toString(i->second.color).c_str()); - myDataList->setItem(indexRow, 5, item); - - // set depart lane - item = new FXTableItem(toString(i->second.departLane).c_str()); - myDataList->setItem(indexRow, 6, item); - - // set depart pos - item = new FXTableItem(toString(i->second.departPos).c_str()); - myDataList->setItem(indexRow, 7, item); - - // set depart speed - item = new FXTableItem(toString(i->second.departSpeed).c_str()); - myDataList->setItem(indexRow, 8, item); - - // set arrival lane - item = new FXTableItem(toString(i->second.arrivalLane).c_str()); - myDataList->setItem(indexRow, 9, item); - - // set arrival pos - item = new FXTableItem(toString(i->second.arrivalPos).c_str()); - myDataList->setItem(indexRow, 10, item); - - // set arrival speed - item = new FXTableItem(toString(i->second.arrivalSpeed).c_str()); - myDataList->setItem(indexRow, 11, item); - - // set line - item = new FXTableItem(toString(i->second.line).c_str()); - myDataList->setItem(indexRow, 12, item); - - // set person number - item = new FXTableItem(toString(i->second.personNumber).c_str()); - myDataList->setItem(indexRow, 13, item); - - // set container number - item = new FXTableItem(toString(i->second.containerNumber).c_str()); - myDataList->setItem(indexRow, 14, item); - - // set vehsPerHour - item = new FXTableItem(toString(i->second.vehsPerHour).c_str()); - myDataList->setItem(indexRow, 15, item); - - // set period - item = new FXTableItem(toString(i->second.period).c_str()); - myDataList->setItem(indexRow, 16, item); - - // set probability - item = new FXTableItem(toString(i->second.probability).c_str()); - myDataList->setItem(indexRow, 17, item); - - // set number - item = new FXTableItem(toString(i->second.number).c_str()); - myDataList->setItem(indexRow, 18, item); - + for (std::vector::const_iterator i = myCalibratorParent->getCalibratorFlows().begin(); i != myCalibratorParent->getCalibratorFlows().end(); i++) { + // Set id + item = new FXTableItem(toString(i->getFlowID()).c_str()); + myFlowList->setItem(indexRow, 0, item); + // Set vehicle type + item = new FXTableItem(toString(i->getVehicleType()).c_str()); + myFlowList->setItem(indexRow, 1, item); + // Set route + item = new FXTableItem(toString(i->getRoute()).c_str()); + myFlowList->setItem(indexRow, 2, item); // set remove item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE)); item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y); - myDataList->setItem(indexRow, 19, item); + item->setEnabled(false); + myFlowList->setItem(indexRow, 3, item); + // Update index + indexRow++; + } + // enable or disable flow and label button + updateFlowAndLabelButton(); +} + +void +GNECalibratorDialog::updateVehicleTypeTable() { + // clear table + myVehicleTypeList->clearItems(); + // set number of rows + myVehicleTypeList->setTableSize(int(myCalibratorParent->getCalibratorVehicleTypes().size()), 3); + // Configure list + myVehicleTypeList->setVisibleColumns(4); + myVehicleTypeList->setColumnWidth(0, 136); + myVehicleTypeList->setColumnWidth(1, 136); + myVehicleTypeList->setColumnWidth(2, GUIDesignTableIconCellWidth); + myVehicleTypeList->setColumnText(0, toString(SUMO_ATTR_ID).c_str()); + myVehicleTypeList->setColumnText(1, toString(SUMO_ATTR_VCLASS).c_str()); + myVehicleTypeList->setColumnText(2, ""); + myVehicleTypeList->getRowHeader()->setWidth(0); + // Declare index for rows and pointer to FXTableItem + int indexRow = 0; + FXTableItem* item = 0; + // iterate over values + for (std::vector::const_iterator i = myCalibratorParent->getCalibratorVehicleTypes().begin(); i != myCalibratorParent->getCalibratorVehicleTypes().end(); i++) { + // Set id + item = new FXTableItem(toString(i->getVehicleTypeID()).c_str()); + myVehicleTypeList->setItem(indexRow, 0, item); + // Set VClass + item = new FXTableItem(toString(i->getVClass()).c_str()); + myVehicleTypeList->setItem(indexRow, 1, item); + // set remove + item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE)); + item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y); + item->setEnabled(false); + myVehicleTypeList->setItem(indexRow, 2, item); // Update index indexRow++; } + // enable or disable flow and label button + updateFlowAndLabelButton(); +} + +void +GNECalibratorDialog::updateFlowAndLabelButton() { + // Enable or disable AddFlow button and flow list depending of currently there are routes and vehicle types defined + std::string errorMsg; + if (myCalibratorParent->getCalibratorRoutes().empty() && myCalibratorParent->getCalibratorVehicleTypes().empty()) { + errorMsg = " and "; + } + if (myCalibratorParent->getCalibratorRoutes().size() == 0 || myCalibratorParent->getCalibratorVehicleTypes().size() == 0) { + myAddFlow->disable(); + myFlowList->disable(); + std::string errorMessage = "No " + (myCalibratorParent->getCalibratorRoutes().empty() ? (toString(SUMO_TAG_ROUTE) + "s") : ("")) + errorMsg + + (myCalibratorParent->getCalibratorVehicleTypes().empty() ? (toString(SUMO_TAG_VTYPE) + "s") : ("")) + " defined"; + myLabelFlow->setText(errorMessage.c_str()); + } else { + myAddFlow->enable(); + myFlowList->enable(); + myLabelFlow->setText(("Add new " + toString(SUMO_TAG_FLOW) + "s").c_str()); + } } /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorDialog.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorDialog.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorDialog.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorDialog.h 2017-07-23 16:22:03.000000000 +0000 @@ -1,13 +1,13 @@ /****************************************************************************/ /// @file GNECalibratorDialog.h /// @author Pablo Alvarez Lopez -/// @date Jun 2016 -/// @version $Id: GNECalibratorDialog.h 21131 2016-07-08 07:59:22Z behrisch $ +/// @date March 2017 +/// @version $Id: GNECalibratorDialog.h 24108 2017-04-27 18:43:30Z behrisch $ /// /// Dialog for edit calibrators /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,7 +31,16 @@ #endif #include "GNEAdditionalDialog.h" -#include "GNECalibrator.h" + + +// =========================================================================== +// class declarations +// =========================================================================== + +class GNECalibrator; +class GNECalibratorRoute; +class GNECalibratorFlow; +class GNECalibratorVehicleType; // =========================================================================== // class definitions @@ -46,20 +55,17 @@ FXDECLARE(GNECalibratorDialog) public: - // Constructor + /// @brief Constructor GNECalibratorDialog(GNECalibrator* calibratorParent); - // destructor + /// @brief destructor ~GNECalibratorDialog(); + /// @brief get calibrator parent + GNECalibrator* getCalibratorParent() const; + /// @name FOX-callbacks /// @{ - /// @brief event called after press add row button - long onCmdAddRow(FXObject*, FXSelector, void*); - - /// @brief event called after press remove row - long onCmdRemoveRow(FXObject*, FXSelector, void*); - /// @brief event after press accept button long onCmdAccept(FXObject*, FXSelector, void*); @@ -68,89 +74,76 @@ /// @brief event after press reset button long onCmdReset(FXObject*, FXSelector, void*); - /// @} -protected: + /// @brief add new route + long onCmdAddRoute(FXObject*, FXSelector, void*); - /// @brief FOX needs this - GNECalibratorDialog() {} + /// @brief remove or edit route + long onCmdClickedRoute(FXObject*, FXSelector, void*); - /// @brief pointer to calibrator parent - GNECalibrator* myCalibratorParent; - - /// @brief Map with the temporal FlowValues - std::map myFlowValues; - - /// @brief Table with the data - FXTable* myDataList; + /// @brief add new flow + long onCmdAddFlow(FXObject*, FXSelector, void*); - /// @brief textField for insert a flow's Id - FXTextField* myTextFieldId; + /// @brief remove or edit flow + long onCmdClickedFlow(FXObject*, FXSelector, void*); - /// @brief textField for insert a flow's begin - FXTextField* myTextFieldBegin; + /// @brief add new vehicle type + long onCmdAddVehicleType(FXObject*, FXSelector, void*); - /// @brief textField for insert a flow's end - FXTextField* myTextFieldEnd; - - /// @brief textField for insert a flow's Type - FXTextField* myTextFieldType; - - /// @brief textField for insert a flow's Route - FXTextField* myTextFieldRoute; + /// @brief remove or edit vehicle type + long onCmdClickedVehicleType(FXObject*, FXSelector, void*); + /// @} - /// @brief textField for insert a flow's color - FXTextField* myTextFieldColor; +protected: + /// @brief FOX needs this + GNECalibratorDialog() {} - /// @brief textField for insert a flow's DepartLane - FXTextField* myTextFieldDepartLane; + /// @brief pointer to calibrator parent + GNECalibrator* myCalibratorParent; - /// @brief textField for insert a flow's DepartPos - FXTextField* myTextFieldDepartPos; + /// @brief button for add new route + FXButton* myAddRoute; - /// @brief textField for insert a flow's DepartSpeed - FXTextField* myTextFieldDepartSpeed; + /// @brief list with routes + FXTable* myRouteList; - /// @brief textField for insert a flow's ArrivalLane - FXTextField* myTextFieldArrivalLane; + /// @brief label for flows + FXLabel* myLabelFlow; - /// @brief textField for insert a flow's ArrivalPos - FXTextField* myTextFieldArrivalPos; + /// @brief button for add new flow + FXButton* myAddFlow; - /// @brief textField for insert a flow's ArrivalSpeed - FXTextField* myTextFieldArrivalSpeed; + /// @brief list with flows + FXTable* myFlowList; - /// @brief textField for insert a flow's Line - FXTextField* myTextFieldLine; + /// @brief button for add new vehicle type + FXButton* myAddVehicleType; - /// @brief textField for insert a flow's PersonNumber - FXTextField* myTextFieldPersonNumber; + /// @brief list with vehicle types + FXTable* myVehicleTypeList; - /// @brief textField for insert a flow's ContainerNumber - FXTextField* myTextFieldContainerNumber; + /// @brief vector with a copy of calibrator routes (used by reset) + std::vector myCopyOfCalibratorRoutes; - /// @brief textField for insert a flow's vehsPerHour - FXTextField* myTextFieldVehsPerHour; + /// @brief vector with a copy of calibrator flows (used by reset) + std::vector myCopyOfCalibratorFlows; - /// @brief textField for insert a flow's period - FXTextField* myTextFieldPeriod; + /// @brief vector with a copy of calibrator vehicle types (used by reset) + std::vector myCopyOfCalibratorVehicleTypes; - /// @brief textField for insert a flow's probability - FXTextField* myTextFieldProbability; + /// @brief update data table with routes + void updateRouteTable(); - /// @brief textField for insert a flow's number - FXTextField* myTextFieldNumber; + /// @brief update data table with flows + void updateFlowTable(); - /// @brief Button for insert row - FXButton* myAddRow; + /// @brief update data table with vehicle types + void updateVehicleTypeTable(); - /// @brief Horizontal frame for row elements - FXHorizontalFrame* myRowFrame; + /// @brief update flow and label button + void updateFlowAndLabelButton(); private: - /// @brief update data table - void updateTable(); - /// @brief Invalidated copy constructor. GNECalibratorDialog(const GNECalibratorDialog&); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorFlow.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorFlow.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorFlow.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorFlow.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,662 @@ +/****************************************************************************/ +/// @file GNECalibratorFlow.cpp +/// @author Pablo Alvarez Lopez +/// @date March 2016 +/// @version $Id: GNECalibratorFlow.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "GNEViewNet.h" +#include "GNENet.h" +#include "GNECalibratorFlow.h" +#include "GNECalibrator.h" + + +// =========================================================================== +// member method definitions +// =========================================================================== + + +GNECalibratorFlow::GNECalibratorFlow(GNECalibrator* calibratorParent) : + myCalibratorParent(calibratorParent), myFlowID(calibratorParent->generateFlowID()), myVehicleType(""), myRoute(""), myColor(""), myDepartLane("first"), + myDepartPos("base"), myDepartSpeed("0"), myArrivalLane("current"), myArrivalPos("max"), myArrivalSpeed("current"), + myLine(""), myPersonNumber(0), myContainerNumber(0), myReroute(false), myDepartPosLat("center"), myArrivalPosLat(""), + myBegin(0), myEnd(0), myVehsPerHour(0), myPeriod(0), myProbability(0), myNumber(0), myTypeOfFlow(GNE_CALIBRATORFLOW_VEHSPERHOUR) { + if (myCalibratorParent->getCalibratorRoutes().size() > 0) { + myRoute = myCalibratorParent->getCalibratorRoutes().front().getRouteID(); + } + if (myCalibratorParent->getCalibratorVehicleTypes().size() > 0) { + myVehicleType = myCalibratorParent->getCalibratorVehicleTypes().front().getVehicleTypeID(); + } +} + + +GNECalibratorFlow::GNECalibratorFlow(GNECalibrator* calibratorParent, std::string flowID, std::string vehicleType, std::string route, + std::string color, std::string departLane, std::string departPos, std::string departSpeed, std::string arrivalLane, std::string arrivalPos, + std::string arrivalSpeed, std::string line, int personNumber, int containerNumber, bool reroute, std::string departPosLat, + std::string arrivalPosLat, double begin, double end, double vehsPerHour, double period, double probability, int number) : + myCalibratorParent(calibratorParent), myFlowID(calibratorParent->generateFlowID()), myVehicleType(vehicleType), myRoute(route), myColor(""), myDepartLane("first"), + myDepartPos("base"), myDepartSpeed("0"), myArrivalLane("current"), myArrivalPos("max"), myArrivalSpeed("current"), + myLine(""), myPersonNumber(0), myContainerNumber(0), myReroute(false), myDepartPosLat("center"), myArrivalPosLat(""), + myBegin(0), myEnd(0), myVehsPerHour(0), myPeriod(0), myProbability(0), myNumber(0), myTypeOfFlow(GNE_CALIBRATORFLOW_VEHSPERHOUR) { + // set parameters using the set functions, to avoid non valid values + setFlowID(flowID); + setVehicleType(vehicleType); + setRoute(route); + setColor(color); + setDepartLane(departLane); + setDepartPos(departPos); + setDepartSpeed(departSpeed); + setArrivalLane(arrivalLane); + setArrivalPos(arrivalPos); + setArrivalSpeed(arrivalSpeed); + setLine(line); + setPersonNumber(personNumber); + setContainerNumber(containerNumber); + setReroute(reroute); + setDepartPosLat(departPosLat); + setArrivalPosLat(arrivalPosLat); + setBegin(begin); + setEnd(end); + setVehsPerHour(vehsPerHour); + setPeriod(period); + setProbability(probability); + setNumber(number); +} + + +GNECalibratorFlow::~GNECalibratorFlow() {} + + +GNECalibrator* +GNECalibratorFlow::getCalibratorParent() const { + return myCalibratorParent; +} + + +SumoXMLTag +GNECalibratorFlow::getTag() const { + return SUMO_TAG_FLOW; +} + + +const std::string& +GNECalibratorFlow::getFlowID() const { + return myFlowID; +} + + +const std::string& +GNECalibratorFlow::getVehicleType() const { + return myVehicleType; +} + + +const std::string& +GNECalibratorFlow::getRoute() const { + return myRoute; +} + + +const std::string& +GNECalibratorFlow::getColor() const { + return myColor; +} + + +const std::string& +GNECalibratorFlow::getDepartLane() const { + return myDepartLane; +} + + +const std::string& +GNECalibratorFlow::getDepartPos() const { + return myDepartPos; +} + + +const std::string& +GNECalibratorFlow::getDepartSpeed() const { + return myDepartSpeed; +} + + +const std::string& +GNECalibratorFlow::getArrivalLane() const { + return myArrivalLane; +} + + +const std::string& +GNECalibratorFlow::getArrivalPos() const { + return myArrivalPos; +} + + +const std::string& +GNECalibratorFlow::getArrivalSpeed() const { + return myArrivalSpeed; +} + + +const std::string& +GNECalibratorFlow::getLine() const { + return myLine; +} + + +int +GNECalibratorFlow::getPersonNumber() const { + return myPersonNumber; +} + + +int +GNECalibratorFlow::getContainerNumber() const { + return myContainerNumber; +} + + +bool +GNECalibratorFlow::getReroute() const { + return myReroute; +} + + +std::string +GNECalibratorFlow::getDepartPosLat() const { + return myDepartPosLat; +} + + +std::string +GNECalibratorFlow::getArrivalPosLat() const { + return myArrivalPosLat; +} + + +double +GNECalibratorFlow::getBegin() const { + return myBegin; +} + + +double +GNECalibratorFlow::getEnd() const { + return myEnd; +} + + +double +GNECalibratorFlow::getVehsPerHour() const { + return myVehsPerHour; +} + + +double +GNECalibratorFlow::getPeriod() const { + return myPeriod; +} + + +double +GNECalibratorFlow::getProbability() const { + return myProbability; +} + + +int +GNECalibratorFlow::getNumber() const { + return myNumber; +} + + +GNECalibratorFlow::TypeOfFlow +GNECalibratorFlow::getFlowType() const { + return myTypeOfFlow; +} + + +bool +GNECalibratorFlow::setFlowID(std::string flowID) { + if (flowID.empty()) { + return false; + } else if (myCalibratorParent->getViewNet()->getNet()->flowExists(flowID) == true) { + return false; + } else { + myFlowID = flowID; + return true; + } +} + + +bool +GNECalibratorFlow::setVehicleType(std::string vehicleType) { + if (vehicleType.empty()) { + return false; + } else if (myCalibratorParent->getViewNet()->getNet()->vehicleTypeExists(vehicleType) == false) { + return false; + } else { + myVehicleType = vehicleType; + return true; + } +} + + +bool +GNECalibratorFlow::setRoute(std::string route) { + if (route.empty()) { + return false; + } else if (myCalibratorParent->getViewNet()->getNet()->routeExists(route) == false) { + return false; + } else { + myRoute = route; + return true; + } +} + + +bool +GNECalibratorFlow::setColor(std::string color) { + myColor = color; + return true; +} + + +bool +GNECalibratorFlow::setDepartLane(std::string departLane) { + int departLaneInt = -1; + if (GNEAttributeCarrier::canParse(departLane)) { + departLaneInt = GNEAttributeCarrier::parse(departLane); + } + if ((departLaneInt < 0) && (departLane != "random") && (departLane != "free") && + (departLane != "allowed") && (departLane != "best") && (departLane != "first")) { + return false; + } else { + myDepartLane = departLane; + return true; + } +} + + +bool +GNECalibratorFlow::setDepartPos(std::string departPos) { + double departPosFloat = -1; + if (GNEAttributeCarrier::canParse(departPos)) { + departPosFloat = GNEAttributeCarrier::parse(departPos); + } + if ((departPosFloat < 0) && (departPos != "random") && (departPos != "free") && + (departPos != "random_free") && (departPos != "base") && (departPos != "last")) { + return false; + } else { + myDepartPos = departPos; + return true; + } +} + + +bool +GNECalibratorFlow::setDepartSpeed(std::string departSpeed) { + double departSpeedDouble = -1; + if (GNEAttributeCarrier::canParse(departSpeed)) { + departSpeedDouble = GNEAttributeCarrier::parse(departSpeed); + } + if ((departSpeedDouble < 0) && (departSpeed != "random") && (departSpeed != "max")) { + return false; + } else { + myDepartSpeed = departSpeed; + return true; + } +} + + +bool +GNECalibratorFlow::setArrivalLane(std::string arrivalLane) { + int arrivalLaneInt = -1; + if (GNEAttributeCarrier::canParse(arrivalLane)) { + arrivalLaneInt = GNEAttributeCarrier::parse(arrivalLane); + } + if ((arrivalLaneInt < 0) && (arrivalLane != "current")) { + return false; + } else { + myArrivalLane = arrivalLane; + return true; + } +} + + +bool +GNECalibratorFlow::setArrivalPos(std::string arrivalPos) { + double arrivalPosFloat = -1; + if (GNEAttributeCarrier::canParse(arrivalPos)) { + arrivalPosFloat = GNEAttributeCarrier::parse(arrivalPos); + } + if ((arrivalPosFloat < 0) && (arrivalPos != "random") && (arrivalPos != "max")) { + return false; + } else { + myArrivalPos = arrivalPos; + return true; + } +} + + +bool +GNECalibratorFlow::setArrivalSpeed(std::string arrivalSpeed) { + double arrivalSpeedDouble = -1; + if (GNEAttributeCarrier::canParse(arrivalSpeed)) { + arrivalSpeedDouble = GNEAttributeCarrier::parse(arrivalSpeed); + } + if ((arrivalSpeedDouble < 0) && (arrivalSpeed != "current")) { + return false; + } else { + myArrivalSpeed = arrivalSpeed; + return true; + } +} + + +bool +GNECalibratorFlow::setLine(std::string line) { + myLine = line; + return true; +} + + +bool +GNECalibratorFlow::setPersonNumber(int personNumber) { + if (personNumber < 0) { + return false; + } else { + myPersonNumber = personNumber; + return true; + } +} + + +bool +GNECalibratorFlow::setPersonNumber(std::string personNumber) { + if (GNEAttributeCarrier::canParse(personNumber)) { + return setPersonNumber(GNEAttributeCarrier::parse(personNumber)); + } else if (GNEAttributeCarrier::canParse(personNumber)) { + double personNumberDouble = GNEAttributeCarrier::parse(personNumber); + // check if double is an integer + if (fmod(personNumberDouble, 1) == 0) { + return setPersonNumber((int)personNumberDouble); + } else { + return false; + } + } else { + return false; + } +} + + +bool +GNECalibratorFlow::setContainerNumber(int containerNumber) { + if (containerNumber < 0) { + return false; + } else { + myContainerNumber = containerNumber; + return true; + } +} + + +bool +GNECalibratorFlow::setContainerNumber(std::string ContainerNumber) { + if (GNEAttributeCarrier::canParse(ContainerNumber)) { + return setContainerNumber(GNEAttributeCarrier::parse(ContainerNumber)); + } else if (GNEAttributeCarrier::canParse(ContainerNumber)) { + double ContainerNumberDouble = GNEAttributeCarrier::parse(ContainerNumber); + // check if double is an integer + if (fmod(ContainerNumberDouble, 1) == 0) { + return setContainerNumber((int)ContainerNumberDouble); + } else { + return false; + } + } else { + return false; + } +} + + +bool +GNECalibratorFlow::setReroute(bool value) { + myReroute = value; + return true; +} + + +bool +GNECalibratorFlow::setReroute(std::string value) { + if (GNEAttributeCarrier::canParse(value)) { + return setReroute(GNEAttributeCarrier::parse(value)); + } else { + return false; + } +} + + +bool +GNECalibratorFlow::setDepartPosLat(std::string departPosLat) { + double departPosLatFloat = -1; + if (GNEAttributeCarrier::canParse(departPosLat)) { + departPosLatFloat = GNEAttributeCarrier::parse(departPosLat); + } + if ((departPosLatFloat < 0) && (departPosLat != "random") && (departPosLat != "random_free") && + (departPosLat != "left") && (departPosLat != "right") && (departPosLat != "center")) { + return false; + } else { + myDepartPosLat = departPosLat; + return true; + } +} + + +bool +GNECalibratorFlow::setArrivalPosLat(std::string arrivalPosLat) { + double arrivalPosLatFloat = -1; + if (GNEAttributeCarrier::canParse(arrivalPosLat)) { + arrivalPosLatFloat = GNEAttributeCarrier::parse(arrivalPosLat); + } + if ((arrivalPosLatFloat < 0) && (arrivalPosLat != "left") && (arrivalPosLat != "right") && (arrivalPosLat != "center") && (arrivalPosLat != "")) { + return false; + } else { + myArrivalPosLat = arrivalPosLat; + return true; + } +} + + +bool +GNECalibratorFlow::setBegin(double begin) { + if (begin < 0) { + return false; + } else { + myBegin = begin; + return true; + } +} + + +bool +GNECalibratorFlow::setBegin(std::string begin) { + if (GNEAttributeCarrier::canParse(begin)) { + return setBegin(GNEAttributeCarrier::parse(begin)); + } else { + return false; + } +} + + +bool +GNECalibratorFlow::setEnd(double end) { + if (end < 0) { + return false; + } else { + myEnd = end; + return true; + } +} + + +bool +GNECalibratorFlow::setEnd(std::string end) { + if (GNEAttributeCarrier::canParse(end)) { + return setEnd(GNEAttributeCarrier::parse(end)); + } else { + return false; + } +} + + +bool +GNECalibratorFlow::setVehsPerHour(double vehsPerHour) { + if (vehsPerHour < 0) { + return false; + } else { + myVehsPerHour = vehsPerHour; + return true; + } +} + + +bool +GNECalibratorFlow::setVehsPerHour(std::string vehsPerHour) { + if (GNEAttributeCarrier::canParse(vehsPerHour)) { + return setVehsPerHour(GNEAttributeCarrier::parse(vehsPerHour)); + } else { + return false; + } +} + + +bool +GNECalibratorFlow::setPeriod(double period) { + if (period < 0) { + return false; + } else { + myPeriod = period; + return true; + } +} + + +bool +GNECalibratorFlow::setPeriod(std::string period) { + if (GNEAttributeCarrier::canParse(period)) { + return setPeriod(GNEAttributeCarrier::parse(period)); + } else { + return false; + } +} + +bool +GNECalibratorFlow::setProbability(double probability) { + if ((probability < 0) || (probability > 1)) { + return false; + } else { + myProbability = probability; + return true; + } +} + + +bool +GNECalibratorFlow::setProbability(std::string probability) { + if (GNEAttributeCarrier::canParse(probability)) { + return setProbability(GNEAttributeCarrier::parse(probability)); + } else { + return false; + } +} + + +bool +GNECalibratorFlow::setNumber(int number) { + if (number < 0) { + return false; + } else { + myNumber = number; + return true; + } +} + + +bool +GNECalibratorFlow::setNumber(std::string number) { + if (GNEAttributeCarrier::canParse(number)) { + return setNumber(GNEAttributeCarrier::parse(number)); + } else if (GNEAttributeCarrier::canParse(number)) { + double numberDouble = GNEAttributeCarrier::parse(number); + // check if double is an integer + if (fmod(numberDouble, 1) == 0) { + return setNumber((int)numberDouble); + } else { + return false; + } + } else { + return false; + } +} + + +bool +GNECalibratorFlow::setTypeOfFlow(TypeOfFlow type) { + if ((type == GNE_CALIBRATORFLOW_VEHSPERHOUR) || (type == GNE_CALIBRATORFLOW_PERIOD) || (type == GNE_CALIBRATORFLOW_PROBABILITY)) { + myTypeOfFlow = type; + return true; + } else { + return false; + } +} + + +bool +GNECalibratorFlow::operator==(const GNECalibratorFlow& calibratorFlow) const { + return (myFlowID == calibratorFlow.getFlowID()); +} + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorFlowDialog.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorFlowDialog.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorFlowDialog.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorFlowDialog.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,497 @@ +/****************************************************************************/ +/// @file GNECalibratorFlowDialog.cpp +/// @author Pablo Alvarez Lopez +/// @date March 2017 +/// @version $Id: GNECalibratorFlowDialog.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// Dialog for edit calibrator flows +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include + +#include "GNECalibratorFlowDialog.h" +#include "GNECalibratorDialog.h" +#include "GNECalibrator.h" +#include "GNEEdge.h" +#include "GNELane.h" +#include "GNEViewNet.h" +#include "GNENet.h" + + +// =========================================================================== +// FOX callback mapping +// =========================================================================== + +FXDEFMAP(GNECalibratorFlowDialog) GNECalibratorFlowDialogMap[] = { + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_ACCEPT, GNECalibratorFlowDialog::onCmdAccept), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_CANCEL, GNECalibratorFlowDialog::onCmdCancel), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_RESET, GNECalibratorFlowDialog::onCmdReset), + FXMAPFUNC(SEL_COMMAND, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GNECalibratorFlowDialog::onCmdSetVariable), + FXMAPFUNC(SEL_COMMAND, MID_GNE_CALIBRATORDIALOG_SET_FLOWTYPE, GNECalibratorFlowDialog::onCmdSetTypeOfFlow), +}; + +// Object implementation +FXIMPLEMENT(GNECalibratorFlowDialog, FXDialogBox, GNECalibratorFlowDialogMap, ARRAYNUMBER(GNECalibratorFlowDialogMap)) + +// =========================================================================== +// member method definitions +// =========================================================================== + +GNECalibratorFlowDialog::GNECalibratorFlowDialog(GNECalibratorDialog* calibratorDialog, GNECalibratorFlow& calibratorFlow, bool updatingElement) : + GNEAdditionalDialog(calibratorFlow.getCalibratorParent(), 600, 300), + myCalibratorDialogParent(calibratorDialog), + myCalibratorFlow(&calibratorFlow), + myUpdatingElement(updatingElement), + myCalibratorFlowValid(true) { + // change default header + changeAdditionalDialogHeader("Edit " + toString(calibratorFlow.getTag()) + " of " + toString(calibratorFlow.getCalibratorParent()->getTag()) + + " '" + calibratorFlow.getCalibratorParent()->getID() + "'"); + // Create auxiliar frames for tables + FXHorizontalFrame* columns = new FXHorizontalFrame(myContentFrame, GUIDesignUniformHorizontalFrame); + FXVerticalFrame* columnLeftLabel = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame); + FXVerticalFrame* columnLeftValue = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame); + FXVerticalFrame* columnRightLabel = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame); + FXVerticalFrame* columnRightValue = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame); + + // 1 create textfield for flowID + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_ID).c_str(), 0, GUIDesignLabelThick); + myTextFieldFlowID = new FXTextField(columnLeftValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + // 2 create combobox for type + new FXLabel(columnLeftLabel, toString(SUMO_TAG_VTYPE).c_str(), 0, GUIDesignLabelThick); + myComboBoxVehicleType = new FXComboBox(columnLeftValue, GUIDesignComboBoxNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignComboBox); + // 3 create combobox for route + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_ROUTE).c_str(), 0, GUIDesignLabelThick); + myComboBoxRoute = new FXComboBox(columnLeftValue, GUIDesignComboBoxNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignComboBox); + // 4 create textfield for color + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_COLOR).c_str(), 0, GUIDesignLabelThick); + myTextFieldColor = new FXTextField(columnLeftValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + // 5 create textfield for lane + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_DEPARTLANE).c_str(), 0, GUIDesignLabelThick); + myTextFieldDepartLane = new FXTextField(columnLeftValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + // 6 create textfield for pos + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_DEPARTPOS).c_str(), 0, GUIDesignLabelThick); + myTextFieldDepartPos = new FXTextField(columnLeftValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + // 7 create textfield for speed + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_DEPARTSPEED).c_str(), 0, GUIDesignLabelThick); + myTextFieldDepartSpeed = new FXTextField(columnLeftValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + // 8 create textfield for lane + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_ARRIVALLANE).c_str(), 0, GUIDesignLabelThick); + myTextFieldArrivalLane = new FXTextField(columnLeftValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + // 9 create textfield for arrival pos + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_ARRIVALPOS).c_str(), 0, GUIDesignLabelThick); + myTextFieldArrivalPos = new FXTextField(columnLeftValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + // 10 create textfield for arrival speed + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_ARRIVALSPEED).c_str(), 0, GUIDesignLabelThick); + myTextFieldArrivalSpeed = new FXTextField(columnLeftValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + // 11 create textfield for arrival line + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_LINE).c_str(), 0, GUIDesignLabelThick); + myTextFieldLine = new FXTextField(columnLeftValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + // 1 create textfield for person number + new FXLabel(columnRightLabel, toString(SUMO_ATTR_PERSON_NUMBER).c_str(), 0, GUIDesignLabelThick); + myTextFieldPersonNumber = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldInt); + // 2 create textfield for container number + new FXLabel(columnRightLabel, toString(SUMO_ATTR_CONTAINER_NUMBER).c_str(), 0, GUIDesignLabelThick); + myTextFieldContainerNumber = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldInt); + // 3 create textfield for reroute + new FXLabel(columnRightLabel, toString(SUMO_ATTR_REROUTE).c_str(), 0, GUIDesignLabelThick); + myRerouteCheckButton = new FXCheckButton(columnRightValue, "false", this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignCheckButtonAttribute); + // 4 create textfield for depart pos lat + new FXLabel(columnRightLabel, toString(SUMO_ATTR_DEPARTPOS_LAT).c_str(), 0, GUIDesignLabelThick); + myTextFieldDepartPosLat = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + // 5 create textfield for arrival pos lat + new FXLabel(columnRightLabel, toString(SUMO_ATTR_ARRIVALPOS_LAT).c_str(), 0, GUIDesignLabelThick); + myTextFieldArrivalPosLat = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + // 6 create textfield for begin + new FXLabel(columnRightLabel, toString(SUMO_ATTR_BEGIN).c_str(), 0, GUIDesignLabelThick); + myTextFieldBegin = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + // 7 create textfield for end + new FXLabel(columnRightLabel, toString(SUMO_ATTR_END).c_str(), 0, GUIDesignLabelThick); + myTextFieldEnd = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + // 8 create textfield for vehicle number + new FXLabel(columnRightLabel, toString(SUMO_ATTR_NUMBER).c_str(), 0, GUIDesignLabelThick); + myTextFieldNumber = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldInt); + // 9 create textfield for vehs per hour + myRadioButtonVehsPerHour = new FXRadioButton(columnRightLabel, toString(SUMO_ATTR_VEHSPERHOUR).c_str(), this, MID_GNE_CALIBRATORDIALOG_SET_FLOWTYPE, GUIDesignRadioButtonAttribute); + myTextFieldVehsPerHour = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + // 10 create textfield for period + myRadioButtonPeriod = new FXRadioButton(columnRightLabel, toString(SUMO_ATTR_PERIOD).c_str(), this, MID_GNE_CALIBRATORDIALOG_SET_FLOWTYPE, GUIDesignRadioButtonAttribute); + myTextFieldPeriod = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + // 11 create textfield for probability + myRadioButtonProbability = new FXRadioButton(columnRightLabel, toString(SUMO_ATTR_PROB).c_str(), this, MID_GNE_CALIBRATORDIALOG_SET_FLOWTYPE, GUIDesignRadioButtonAttribute); + myTextFieldProbability = new FXTextField(columnRightValue, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + + // fill comboBox of VTypes + const std::vector& vtypes = myCalibratorFlow->getCalibratorParent()->getCalibratorVehicleTypes(); + for (std::vector::const_iterator i = vtypes.begin(); i != vtypes.end(); i++) { + myComboBoxVehicleType->appendItem(i->getVehicleTypeID().c_str()); + } + myComboBoxVehicleType->setNumVisible(10); + + // fill comboBox of Routes + const std::vector& routes = myCalibratorFlow->getCalibratorParent()->getCalibratorRoutes(); + for (std::vector::const_iterator i = routes.begin(); i != routes.end(); i++) { + myComboBoxRoute->appendItem(i->getRouteID().c_str()); + } + myComboBoxRoute->setNumVisible(10); + + // create copy of GNECalibratorFlow + myCopyOfCalibratorFlow = new GNECalibratorFlow(myCalibratorFlow->getCalibratorParent()); + + // copy all values of myCalibratorFlow into myCopyOfCalibratorFlow to set initial values + (*myCopyOfCalibratorFlow) = (*myCalibratorFlow); + + // update tables + updateCalibratorFlowValues(); +} + + +GNECalibratorFlowDialog::~GNECalibratorFlowDialog() { + // delete copy + delete myCopyOfCalibratorFlow; +} + + +long +GNECalibratorFlowDialog::onCmdAccept(FXObject*, FXSelector, void*) { + if (myCalibratorFlowValid == false) { + // write warning if netedit is running in testing mode + if (myCalibratorDialogParent->getCalibratorParent()->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Opening FXMessageBox of type 'warning'"); + } + // open warning dialog box + FXMessageBox::warning(getApp(), MBOX_OK, + ("Error " + std::string((myUpdatingElement == true) ? ("updating") : ("creating")) + " " + toString(myCalibratorFlow->getCalibratorParent()->getTag()) + + "'s " + toString(myCalibratorFlow->getTag())).c_str(), "%s", + (toString(myCalibratorFlow->getCalibratorParent()->getTag()) + "'s " + toString(myCalibratorFlow->getTag()) + + " cannot be " + std::string((myUpdatingElement == true) ? ("updated") : ("created")) + " because parameter " + toString(myInvalidAttr) + + " is invalid.").c_str()); + // write warning if netedit is running in testing mode + if (myCalibratorDialogParent->getCalibratorParent()->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'"); + } + return 0; + } else { + // copy all values of myCopyOfCalibratorFlow into myCalibratorFlow + (*myCalibratorFlow) = (*myCopyOfCalibratorFlow); + getApp()->stopModal(this, TRUE); + return 1; + } +} + + +long +GNECalibratorFlowDialog::onCmdCancel(FXObject*, FXSelector, void*) { + // Stop Modal + getApp()->stopModal(this, FALSE); + return 1; +} + + +long +GNECalibratorFlowDialog::onCmdReset(FXObject*, FXSelector, void*) { + // copy all values of myCalibratorFlow into myCopyOfCalibratorFlow to set initial values + (*myCopyOfCalibratorFlow) = (*myCalibratorFlow); + // update fields + updateCalibratorFlowValues(); + return 1; +} + + +long +GNECalibratorFlowDialog::onCmdSetVariable(FXObject*, FXSelector, void*) { + // At start we assumed, that all values are valid + myCalibratorFlowValid = true; + myInvalidAttr = SUMO_ATTR_NOTHING; + // set color of myTextFieldFlowID, depending if current value is valid or not + if (myCopyOfCalibratorFlow->getFlowID() == myTextFieldFlowID->getText().text()) { + myTextFieldFlowID->setTextColor(FXRGB(0, 0, 0)); + } else if (myCopyOfCalibratorFlow->setFlowID(myTextFieldFlowID->getText().text()) == true) { + myTextFieldFlowID->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldFlowID->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_ID; + } + // set color of myComboBoxVehicleType, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setVehicleType(myComboBoxVehicleType->getText().text()) == true) { + myComboBoxVehicleType->setTextColor(FXRGB(0, 0, 0)); + } else { + myComboBoxVehicleType->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_TYPE; + } + // set color of myComboBoxRoute, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setRoute(myComboBoxRoute->getText().text()) == true) { + myComboBoxRoute->setTextColor(FXRGB(0, 0, 0)); + } else { + myComboBoxRoute->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_ROUTE; + } + // set color of myTextFieldColor, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setColor(myTextFieldColor->getText().text()) == true) { + myTextFieldColor->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldColor->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_COLOR; + } + // set color of myTextFieldDepartLane, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setDepartLane(myTextFieldDepartLane->getText().text()) == true) { + myTextFieldDepartLane->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldDepartLane->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_DEPARTLANE; + } + // set color of myTextFieldDepartPos, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setDepartPos(myTextFieldDepartPos->getText().text()) == true) { + myTextFieldDepartPos->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldDepartPos->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_DEPARTPOS; + } + // set color of setDepartSpeed, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setDepartSpeed(myTextFieldDepartSpeed->getText().text()) == true) { + myTextFieldDepartSpeed->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldDepartSpeed->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_DEPARTSPEED; + } + // set color of myTextFieldArrivalLane, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setArrivalLane(myTextFieldArrivalLane->getText().text()) == true) { + myTextFieldArrivalLane->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldArrivalLane->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_ARRIVALLANE; + } + // set color of myTextFieldArrivalPos, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setArrivalPos(myTextFieldArrivalPos->getText().text()) == true) { + myTextFieldArrivalPos->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldArrivalPos->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_ARRIVALPOS; + } + // set color of setArrivalSpeed, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setArrivalSpeed(myTextFieldArrivalSpeed->getText().text()) == true) { + myTextFieldArrivalSpeed->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldArrivalSpeed->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_ARRIVALSPEED; + } + // set color of myTextFieldLine, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setLine(myTextFieldLine->getText().text()) == true) { + myTextFieldLine->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldLine->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_LINE; + } + // set color of myTextFieldPersonNumber, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setPersonNumber(myTextFieldPersonNumber->getText().text()) == true) { + myTextFieldPersonNumber->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldPersonNumber->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_PERSON_NUMBER; + } + // set color of myTextFieldContainerNumber, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setContainerNumber(myTextFieldContainerNumber->getText().text()) == true) { + myTextFieldContainerNumber->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldContainerNumber->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_CONTAINER_NUMBER; + } + // set reroute + if (myRerouteCheckButton->getCheck()) { + myCopyOfCalibratorFlow->setReroute(true); + myRerouteCheckButton->setText("true"); + } else { + myCopyOfCalibratorFlow->setReroute(false); + myRerouteCheckButton->setText("false"); + } + // set color of myTextFieldDepartPosLat, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setDepartPosLat(myTextFieldDepartPosLat->getText().text()) == true) { + myTextFieldDepartPosLat->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldDepartPosLat->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_DEPARTPOS_LAT; + } + // set color of myTextFieldArrivalPosLat, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setArrivalPosLat(myTextFieldArrivalPosLat->getText().text()) == true) { + myTextFieldArrivalPosLat->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldArrivalPosLat->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_ARRIVALPOS_LAT; + } + // set color of myTextFieldBegin, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setBegin(myTextFieldBegin->getText().text()) == true) { + myTextFieldBegin->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldBegin->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_END; + } + // set color of myTextFieldEnd, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setEnd(myTextFieldEnd->getText().text()) == true) { + myTextFieldEnd->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldEnd->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_BEGIN; + } + // set color of myTextFieldNumber, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setNumber(myTextFieldNumber->getText().text()) == true) { + myTextFieldNumber->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldNumber->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_NUMBER; + } + // set color of myTextFieldVehsPerHour, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setVehsPerHour(myTextFieldVehsPerHour->getText().text()) == true) { + myTextFieldVehsPerHour->setTextColor(FXRGB(0, 0, 0)); + } else if (myRadioButtonVehsPerHour->getCheck()) { + myTextFieldVehsPerHour->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_VEHSPERHOUR; + } else { + // if radio button is disabled, set default color + myTextFieldVehsPerHour->setTextColor(FXRGB(0, 0, 0)); + } + // set color of myTextFieldPeriod, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setPeriod(myTextFieldPeriod->getText().text()) == true) { + myTextFieldPeriod->setTextColor(FXRGB(0, 0, 0)); + } else if (myRadioButtonPeriod->getCheck()) { + myTextFieldPeriod->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_PERIOD; + } else { + // if radio button is disabled, set default color + myTextFieldPeriod->setTextColor(FXRGB(0, 0, 0)); + } + // set color of myTextFieldProbability, depending if current value is valid or not + if (myCopyOfCalibratorFlow->setProbability(myTextFieldProbability->getText().text()) == true) { + myTextFieldProbability->setTextColor(FXRGB(0, 0, 0)); + } else if (myRadioButtonProbability->getCheck()) { + myTextFieldProbability->setTextColor(FXRGB(255, 0, 0)); + myCalibratorFlowValid = false; + myInvalidAttr = SUMO_ATTR_PROB; + } else { + // if radio button is disabled, set default color + myTextFieldProbability->setTextColor(FXRGB(0, 0, 0)); + } + return 1; +} + + +long +GNECalibratorFlowDialog::onCmdSetTypeOfFlow(FXObject* radioButton, FXSelector, void*) { + if (radioButton == myRadioButtonVehsPerHour) { + myRadioButtonVehsPerHour->setCheck(true); + myTextFieldVehsPerHour->enable(); + myCopyOfCalibratorFlow->setTypeOfFlow(GNECalibratorFlow::GNE_CALIBRATORFLOW_VEHSPERHOUR); + // disable other options + myRadioButtonPeriod->setCheck(false); + myTextFieldPeriod->disable(); + myRadioButtonProbability->setCheck(false); + myTextFieldProbability->disable(); + onCmdSetVariable(0, 0, 0); + return 1; + } else if (radioButton == myRadioButtonPeriod) { + myRadioButtonPeriod->setCheck(true); + myTextFieldPeriod->enable(); + myCopyOfCalibratorFlow->setTypeOfFlow(GNECalibratorFlow::GNE_CALIBRATORFLOW_PERIOD); + // disable other options + myRadioButtonVehsPerHour->setCheck(false); + myTextFieldVehsPerHour->disable(); + myRadioButtonProbability->setCheck(false); + myTextFieldProbability->disable(); + onCmdSetVariable(0, 0, 0); + return 1; + } else if (radioButton == myRadioButtonProbability) { + myRadioButtonProbability->setCheck(true); + myTextFieldProbability->enable(); + myCopyOfCalibratorFlow->setTypeOfFlow(GNECalibratorFlow::GNE_CALIBRATORFLOW_PROBABILITY); + // disable other options + myRadioButtonVehsPerHour->setCheck(false); + myTextFieldVehsPerHour->disable(); + myRadioButtonPeriod->setCheck(false); + myTextFieldPeriod->disable(); + onCmdSetVariable(0, 0, 0); + return 1; + } else { + return 0; + } +} + + +void +GNECalibratorFlowDialog::updateCalibratorFlowValues() { + // update fields + myTextFieldFlowID->setText(myCopyOfCalibratorFlow->getFlowID().c_str()); + myComboBoxVehicleType->setText(myCopyOfCalibratorFlow->getVehicleType().c_str()); + myComboBoxRoute->setText(myCopyOfCalibratorFlow->getRoute().c_str()); + myTextFieldColor->setText(myCopyOfCalibratorFlow->getColor().c_str()); + myTextFieldDepartLane->setText(myCopyOfCalibratorFlow->getDepartLane().c_str()); + myTextFieldDepartPos->setText(myCopyOfCalibratorFlow->getDepartPos().c_str()); + myTextFieldDepartSpeed->setText(myCopyOfCalibratorFlow->getDepartSpeed().c_str()); + myTextFieldArrivalLane->setText(myCopyOfCalibratorFlow->getArrivalLane().c_str()); + myTextFieldArrivalPos->setText(myCopyOfCalibratorFlow->getArrivalPos().c_str()); + myTextFieldArrivalSpeed->setText(myCopyOfCalibratorFlow->getArrivalSpeed().c_str()); + myTextFieldLine->setText(myCopyOfCalibratorFlow->getLine().c_str()); + myTextFieldPersonNumber->setText(toString(myCopyOfCalibratorFlow->getPersonNumber()).c_str()); + myTextFieldContainerNumber->setText(toString(myCopyOfCalibratorFlow->getContainerNumber()).c_str()); + myRerouteCheckButton->setCheck(myCopyOfCalibratorFlow->getReroute()); + myTextFieldDepartPosLat->setText(myCopyOfCalibratorFlow->getDepartPosLat().c_str()); + myTextFieldArrivalPosLat->setText(myCopyOfCalibratorFlow->getArrivalPosLat().c_str()); + myTextFieldBegin->setText(toString(myCopyOfCalibratorFlow->getBegin()).c_str()); + myTextFieldEnd->setText(toString(myCopyOfCalibratorFlow->getEnd()).c_str()); + myTextFieldNumber->setText(toString(myCopyOfCalibratorFlow->getNumber()).c_str()); + myTextFieldVehsPerHour->setText(toString(myCopyOfCalibratorFlow->getVehsPerHour()).c_str()); + myTextFieldPeriod->setText(toString(myCopyOfCalibratorFlow->getPeriod()).c_str()); + myTextFieldProbability->setText(toString(myCopyOfCalibratorFlow->getProbability()).c_str()); + // upsate type of flow + if (myCopyOfCalibratorFlow->getFlowType() == GNECalibratorFlow::GNE_CALIBRATORFLOW_VEHSPERHOUR) { + onCmdSetTypeOfFlow(myRadioButtonVehsPerHour, 0, 0); + } else if (myCopyOfCalibratorFlow->getFlowType() == GNECalibratorFlow::GNE_CALIBRATORFLOW_PERIOD) { + onCmdSetTypeOfFlow(myRadioButtonPeriod, 0, 0); + } else if (myCopyOfCalibratorFlow->getFlowType() == GNECalibratorFlow::GNE_CALIBRATORFLOW_PROBABILITY) { + onCmdSetTypeOfFlow(myRadioButtonProbability, 0, 0); + } +} + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorFlowDialog.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorFlowDialog.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorFlowDialog.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorFlowDialog.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,188 @@ +/****************************************************************************/ +/// @file GNECalibratorFlowDialog.h +/// @author Pablo Alvarez Lopez +/// @date March 2017 +/// @version $Id: GNECalibratorFlowDialog.h 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// Dialog for edit calibrator flows +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNECalibratorFlowDialog_h +#define GNECalibratorFlowDialog_h + +// =========================================================================== +// included modules +// =========================================================================== + +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include "GNEAdditionalDialog.h" +#include "GNECalibratorFlow.h" + +// =========================================================================== +// class declarations +// =========================================================================== + +class GNECalibratorDialog; + +// =========================================================================== +// class definitions +// =========================================================================== + +/** + * @class GNECalibratorFlowDialog + * @brief Dialog for edit rerouter intervals + */ + +class GNECalibratorFlowDialog : public GNEAdditionalDialog { + /// @brief FOX-declaration + FXDECLARE(GNECalibratorFlowDialog) + +public: + /// @brief constructor + GNECalibratorFlowDialog(GNECalibratorDialog* calibratorDialog, GNECalibratorFlow& calibratorFlow, bool updatingElement); + + /// @brief destructor + ~GNECalibratorFlowDialog(); + + /// @name FOX-callbacks + /// @{ + /// @brief event after press accept button + long onCmdAccept(FXObject*, FXSelector, void*); + + /// @brief event after press cancel button + long onCmdCancel(FXObject*, FXSelector, void*); + + /// @brief event after press reset button + long onCmdReset(FXObject*, FXSelector, void*); + + /// @brief event after change value + long onCmdSetVariable(FXObject*, FXSelector, void*); + + /// @brief event after change type of flow + long onCmdSetTypeOfFlow(FXObject* radioButton, FXSelector, void*); + /// @} + +protected: + /// @brief FOX needs this + GNECalibratorFlowDialog() {} + + /// @brief update data fields + void updateCalibratorFlowValues(); + + /// @brief pointer to GNECalibratorDialog parent + GNECalibratorDialog* myCalibratorDialogParent; + + /// @brief pointer to rerouter interval + GNECalibratorFlow* myCalibratorFlow; + + /// @brief flag to indicate if flow are being created or modified + bool myUpdatingElement; + + /// @brief pointer in which save modifications of CalibratorFlow + GNECalibratorFlow* myCopyOfCalibratorFlow; + + /// @brief flag to check if current calibrator flow is valid + bool myCalibratorFlowValid; + + /// @brief current sumo attribute invalid + SumoXMLAttr myInvalidAttr; + + /// @brief TextField for flow ID + FXTextField* myTextFieldFlowID; + + /// @brief ComboBox for Type + FXComboBox* myComboBoxVehicleType; + + /// @brief TextField for Route + FXComboBox* myComboBoxRoute; + + /// @brief TextField for Color + FXTextField* myTextFieldColor; + + /// @brief TextField for Depart Lane + FXTextField* myTextFieldDepartLane; + + /// @brief TextField for Depart Pos + FXTextField* myTextFieldDepartPos; + + /// @brief TextField for Depart Speed + FXTextField* myTextFieldDepartSpeed; + + /// @brief TextField for Arrival Lane + FXTextField* myTextFieldArrivalLane; + + /// @brief TextField for Arrival Pos + FXTextField* myTextFieldArrivalPos; + + /// @brief TextField for Arrival Speed + FXTextField* myTextFieldArrivalSpeed; + + /// @brief TextField for Line + FXTextField* myTextFieldLine; + + /// @brief TextField for PersonNumber + FXTextField* myTextFieldPersonNumber; + + /// @brief TextField for Container Number + FXTextField* myTextFieldContainerNumber; + + /// @brief checkButton for Reroute + FXCheckButton* myRerouteCheckButton; + + /// @brief TextField for DepartPosLat + FXTextField* myTextFieldDepartPosLat; + + /// @brief TextField for ArrivalPosLat + FXTextField* myTextFieldArrivalPosLat; + + /// @brief TextField for Begin + FXTextField* myTextFieldBegin; + + /// @brief TextField for End + FXTextField* myTextFieldEnd; + + /// @brief TextField for Number + FXTextField* myTextFieldNumber; + + /// @brief RadioButton for VehsPerHour + FXRadioButton* myRadioButtonVehsPerHour; + + /// @brief TextField for VehsPerHour + FXTextField* myTextFieldVehsPerHour; + + /// @brief RadioButton for Period + FXRadioButton* myRadioButtonPeriod; + + /// @brief TextField for Period + FXTextField* myTextFieldPeriod; + + /// @brief RadioButton for Probability + FXRadioButton* myRadioButtonProbability; + + /// @brief TextField for Probability + FXTextField* myTextFieldProbability; + +private: + /// @brief Invalidated copy constructor. + GNECalibratorFlowDialog(const GNECalibratorFlowDialog&); + + /// @brief Invalidated assignment operator. + GNECalibratorFlowDialog& operator=(const GNECalibratorFlowDialog&); +}; + +#endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorFlow.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorFlow.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorFlow.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorFlow.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,394 @@ +/****************************************************************************/ +/// @file GNECalibratorFlow.h +/// @author Pablo Alvarez Lopez +/// @date Nov 2015 +/// @version $Id: GNECalibratorFlow.h 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// Flow used by GNECalibrators +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNECalibratorFlow_h +#define GNECalibratorFlow_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include + +// =========================================================================== +// class declaration +// =========================================================================== + +class GNECalibrator; + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class GNECalibratorFlow + * flow flow used by GNECalibrators + */ +class GNECalibratorFlow { +public: + + /// @brief type of flow + enum TypeOfFlow { + GNE_CALIBRATORFLOW_INVALID, + GNE_CALIBRATORFLOW_VEHSPERHOUR, + GNE_CALIBRATORFLOW_PERIOD, + GNE_CALIBRATORFLOW_PROBABILITY + }; + + /// @brief constructor + GNECalibratorFlow(GNECalibrator* calibratorParent); + + /// @brief parameter constructor + GNECalibratorFlow(GNECalibrator* calibratorParent, std::string flowID, std::string vehicleType, std::string route, std::string color, std::string departLane, + std::string departPos, std::string departSpeed, std::string arrivalLane, std::string arrivalPos, std::string arrivalSpeed, std::string line, + int personNumber, int containerNumber, bool reroute, std::string departPosLat, std::string arrivalPosLat, double begin, double end, + double vehsPerHour, double period, double probability, int number); + + /// @brief destructor + ~GNECalibratorFlow(); + + /// @brief get pointer to calibrator parent + GNECalibrator* getCalibratorParent() const; + + /// @brief get tag + SumoXMLTag getTag() const; + + /// @brief get ID of flow + const std::string& getFlowID() const; + + /// @brief get vehicle type of flow + const std::string& getVehicleType() const; + + /// @brief get route in which this flow is used + const std::string& getRoute() const; + + /// @brief get color of flow + const std::string& getColor() const; + + /// @brief get depart lane + const std::string& getDepartLane() const; + + /// @brief get depart position + const std::string& getDepartPos() const; + + /// @brief get arrival speed + const std::string& getDepartSpeed() const; + + /// @brief get arrival lane + const std::string& getArrivalLane() const; + + /// @brief get arrival position + const std::string& getArrivalPos() const; + + /// @brief get arrival speed + const std::string& getArrivalSpeed() const; + + /// @brief get line of busStop/containerStop + const std::string& getLine() const; + + /// @brief get number of persons + int getPersonNumber() const; + + /// @brief get number of containers + int getContainerNumber() const; + + /// @brief get reroute + bool getReroute() const; + + /// @brief get departPosLat + std::string getDepartPosLat() const; + + //// @brief set arrivalPosLat + std::string getArrivalPosLat() const; + + /// @name value specific of + ///{ + /// @brief get begin time step + double getBegin() const; + + /// @brief get end time step + double getEnd() const; + + /// @brief get flows per hour + double getVehsPerHour() const; + + /// @brief get period of flow + double getPeriod() const; + + /// @brief get probability of flow + double getProbability() const; + + /// @brief get number of flows + int getNumber() const; + + /// @brief get type of flow + TypeOfFlow getFlowType() const; + /// @} + + /**@brief set ID of flow + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setFlowID(std::string ID); + + /**@brief set vehicleType of flow + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setVehicleType(std::string vehicleType); + + /**@brief set route in which this flow is used + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setRoute(std::string route); + + /**@brief set color of flow + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setColor(std::string color = ""); + + /**@brief set depart lane + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setDepartLane(std::string departLane = "first"); + + /**@brief set depart position + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setDepartPos(std::string departPos = "base"); + + /**@brief set depart speed + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setDepartSpeed(std::string departSpeed = "0"); + + /**@brief set arrival lane + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setArrivalLane(std::string arrivalLane = "current"); + + /**@brief set arrival position + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setArrivalPos(std::string arrivalPos = "max"); + + /**@brief set arrival speed + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setArrivalSpeed(std::string arrivalSpeed = "current"); + + /**@brief set line of busStop/containerStop + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setLine(std::string line = ""); + + /**@brief set number of persons + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setPersonNumber(int personNumber = 0); + + /**@brief set number of persons (String) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setPersonNumber(std::string personNumber = "0"); + + /**@brief set number of container + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setContainerNumber(int containerNumber = 0); + + /**@brief set number of container (string) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setContainerNumber(std::string containerNumber = "0"); + + /**@brief set reroute + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setReroute(bool value); + + /**@brief set reroute (string) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setReroute(std::string value); + + /**@brief set departPosLat + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setDepartPosLat(std::string departPosLat = "center"); + + /**@brief set arrivalPosLat + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setArrivalPosLat(std::string arrivalPosLat = ""); + + /// @name values specific of Flows + /// @{ + /**@brief set begin step + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setBegin(double begin); + + /**@brief set begin step (string) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setBegin(std::string begin); + + /**@brief set end step + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setEnd(double end); + + /**@brief set end step (string) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setEnd(std::string end); + + /**@brief set flows per hour + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setVehsPerHour(double vehsPerHour); + + /**@brief set flows per hour (string) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setVehsPerHour(std::string vehsPerHour); + + /**@brief set period of flows + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setPeriod(double period); + + /**@brief set period of flows (string) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setPeriod(std::string period); + + /**@brief set probability of flow + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setProbability(double probability); + + /**@brief set probability of flow (string) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setProbability(std::string probability); + + /**@brief set number of flows + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setNumber(int number); + + /**@brief set number of flows (string) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setNumber(std::string number); + + /**@brief set type of flow + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setTypeOfFlow(TypeOfFlow type); + /// @} + + /// @brief overload operator == + bool operator==(const GNECalibratorFlow& calibratorFlow) const; + +private: + /// @brief pointer to calibrator parent + GNECalibrator* myCalibratorParent; + + /// @brief ID of flow + std::string myFlowID; + + /// @brief type of flow + std::string myVehicleType; + + /// @brief route in which this flow is used + std::string myRoute; + + /// @brief color of flow + std::string myColor; + + /// @brief depart lane + std::string myDepartLane; + + /// @brief depart position + std::string myDepartPos; + + /// @brief depart speed + std::string myDepartSpeed; + + /// @brief arrival lane + std::string myArrivalLane; + + /// @brief arrival pos + std::string myArrivalPos; + + /// @brief arrival speed + std::string myArrivalSpeed; + + /// @brief line of bus/container stop + std::string myLine; + + /// @brief number of person + int myPersonNumber; + + /// @brief number of container + int myContainerNumber; + + /// @brief reroute + bool myReroute; + + /// @brief departPosLat + std::string myDepartPosLat; + + //// @brief arrivalPosLat + std::string myArrivalPosLat; + + /// @name specific of flows + /// @{ + /// @brief time step begin + double myBegin; + + /// @brief time step end + double myEnd; + + /// @brief flows per hour + double myVehsPerHour; + + /// @brief period + double myPeriod; + + /// @brief probability + double myProbability; + + /// @brief number of flow + int myNumber; + /// @} + + /// @brief type of flow + TypeOfFlow myTypeOfFlow; +}; + +#endif +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibrator.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibrator.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibrator.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibrator.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNECalibrator.h /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNECalibrator.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNECalibrator.h 24109 2017-04-27 20:27:11Z behrisch $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,6 +31,9 @@ #endif #include "GNEAdditional.h" +#include "GNECalibratorRoute.h" +#include "GNECalibratorFlow.h" +#include "GNECalibratorVehicleType.h" // =========================================================================== // class declaration @@ -43,54 +46,34 @@ // =========================================================================== /** * @class GNECalibrator - * ------------ + * class for represent Calibratos in netedit */ class GNECalibrator : public GNEAdditional { public: - /// @brief calibrator flow - struct CalibratorFlow { - // Parameters of vehicles - std::string type; - std::string route; - std::string color; - std::string departLane; - std::string departPos; - std::string departSpeed; - std::string arrivalLane; - std::string arrivalPos; - std::string arrivalSpeed; - std::string line; - int personNumber; - int containerNumber; - // Parameters of flows - SUMOTime begin; - SUMOTime end; - SUMOReal vehsPerHour; - SUMOReal period; - SUMOReal probability; - int number; - }; /**@brief Constructor * @param[in] id The storage of gl-ids to get the one for this lane representation from - * @param[in] edge Lane of this StoppingPlace belongs + * @param[in] lane Lane of this calibrator belongs * @param[in] viewNet pointer to GNEViewNet of this additional element belongs * @param[in] pos position of the calibrator on the edge (Currently not used) * @param[in] frequency the aggregation interval in which to calibrate the flows * @param[in] output The output file for writing calibrator information - * @param[in] flowValues values with the flow of calibrator - * @param[in] blocked set initial blocking state of item - */ - GNECalibrator(const std::string& id, GNEEdge* edge, GNEViewNet* viewNet, SUMOReal pos, SUMOTime frequency, const std::string& output, const std::map& flowValues, bool blocked); + * @param[in] calibratorRoutes vector with the calibratorRoutes of calibrator + * @param[in] calibratorFlows vector with the calibratorFlows of calibrator + * @param[in] calibratorVehicleTypes vector with the CalibratorVehicleType of calibrator + */ + GNECalibrator(const std::string& id, GNELane* lane, GNEViewNet* viewNet, double pos, double frequency, const std::string& output, + const std::vector& calibratorRoutes, const std::vector& calibratorFlows, + const std::vector& calibratorVehicleTypes); /// @brief Destructor ~GNECalibrator(); /// @brief change the position of the calibrator geometry - void moveAdditionalGeometry(SUMOReal, SUMOReal); + void moveAdditionalGeometry(double, double); /// @brief updated geometry changes in the attributes of additional - void commmitAdditionalGeometryMoved(SUMOReal, SUMOReal, GNEUndoList*); + void commmitAdditionalGeometryMoved(double, double, GNEUndoList*); /// @brief update pre-computed geometry information /// @note: must be called when geometry c6hanges (i.e. lane moved) @@ -105,19 +88,67 @@ /**@brief writte additional element into a xml file * @param[in] device device in which write parameters of additional element */ - void writeAdditional(OutputDevice& device, const std::string&); + void writeAdditional(OutputDevice& device) const; + + /// @brief add calibrator vehicleType + void addCalibratorVehicleType(const GNECalibratorVehicleType& vehicleType); + + /// @brief add calibrator flow + void addCalibratorFlow(const GNECalibratorFlow& flow); + + /// @brief add calibrator route + void addCalibratorRoute(const GNECalibratorRoute& route); + + /// @brief get calibrator vehicleTypes + const std::vector& getCalibratorVehicleTypes() const; + + /// @brief get calibrator flows + const std::vector& getCalibratorFlows() const; + + /// @brief get calibrator routes + const std::vector& getCalibratorRoutes() const; + + /// @brief set calibrator vehicleTypes values + void setCalibratorVehicleTypes(const std::vector& calibratorVehicleType); + + /// @brief set calibrator flow values + void setCalibratorFlows(const std::vector& calibratorFlows); + + /// @brief set calibrator route values + void setCalibratorRoutes(const std::vector& calibratorRoutes); - /// @brief get Calbratorflow values - std::map getFlowValues() const; + /// @brief generate a vehicleType ID + std::string generateVehicleTypeID() const; - /// @brief set Calbratorflow values - void setFlowValues(std::map calibratorFlowValues); + /// @brief generate a flow ID + std::string generateFlowID() const; - /// @brief insert a new flow - void insertFlow(const std::string& id, const CalibratorFlow& flow); + /// @brief generate a route ID + std::string generateRouteID() const; - /// @brief remove a existent flow - void removeFlow(const std::string& id); + /// @brief check if a vehicelType with ID = vehicleTypeID exists + bool vehicleTypeExists(std::string vehicleTypeID) const; + + /// @brief check if a flow with ID = flowID exists + bool flowExists(std::string flowID) const; + + /// @brief check if a route with ID = routeID exists + bool routeExists(std::string routeID) const; + + /**@brief get reference to calibrator vehicle type + * @throw ivalid argument if calibrator doesn't exist + */ + const GNECalibratorVehicleType& getCalibratorVehicleType(const std::string& vehicleTypeID); + + /**@brief get reference to calibrator flow + * @throw ivalid argument if calibrator doesn't exist + */ + const GNECalibratorFlow& getCalibratorFlow(const std::string& flowID); + + /**@brief get reference calibrator route + * @throw ivalid argument if calibrator doesn't exist + */ + const GNECalibratorRoute& getCalibratorRoute(const std::string& routeID); /// @name inherited from GUIGlObject /// @{ @@ -157,16 +188,22 @@ protected: /// @brief Frequency of calibrator - SUMOTime myFrequency; + double myFrequency; /// @brief output of calibrator std::string myOutput; - /// @brief pointer to RouteProbe + /// @brief pointer to current RouteProbe GNERouteProbe* myRouteProbe; - /// @brief Calbratorflow values - std::map myFlowValues; + /// @brief calibrator route values + std::vector myCalibratorRoutes; + + /// @brief calibrator flow values + std::vector myCalibratorFlows; + + /// @brief calibrator vehicleType values + std::vector myCalibratorVehicleTypes; private: /// @brief set attribute after validation diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorRoute.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorRoute.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorRoute.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorRoute.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,216 @@ +/****************************************************************************/ +/// @file GNECalibratorRoute.cpp +/// @author Pablo Alvarez Lopez +/// @date March 2016 +/// @version $Id: GNECalibratorRoute.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "GNECalibratorRoute.h" +#include "GNECalibrator.h" +#include "GNEEdge.h" +#include "GNEViewNet.h" +#include "GNENet.h" +#include "GNEJunction.h" + + +// =========================================================================== +// member method definitions +// =========================================================================== + +GNECalibratorRoute::GNECalibratorRoute(GNECalibrator* calibratorParent) : + myCalibratorParent(calibratorParent), myRouteID(calibratorParent->generateRouteID()), myColor("") { +} + + +GNECalibratorRoute::GNECalibratorRoute(GNECalibrator* calibratorParent, std::string routeID, std::vector edges, std::string color) : + myCalibratorParent(calibratorParent), myRouteID(calibratorParent->generateRouteID()), myColor("") { + // set values using set functions to avoid non-valid values + setRouteID(routeID); + setEdges(edges); + setColor(color); +} + + +GNECalibratorRoute::GNECalibratorRoute(GNECalibrator* calibratorParent, std::string routeID, std::vector edges, std::string color) : + myCalibratorParent(calibratorParent), myRouteID(""), myColor("") { + // set values using set functions to avoid non-valid values + setRouteID(routeID); + setEdges(edges); + setColor(color); +} + +GNECalibratorRoute::~GNECalibratorRoute() {} + + +GNECalibrator* +GNECalibratorRoute::getCalibratorParent() const { + return myCalibratorParent; +} + + +SumoXMLTag +GNECalibratorRoute::getTag() const { + return SUMO_TAG_ROUTE; +} + + +const std::string& +GNECalibratorRoute::getRouteID() const { + return myRouteID; +} + + +std::vector +GNECalibratorRoute::getEdgesIDs() const { + std::vector edgeIDs; + for (std::vector::const_iterator i = myEdges.begin(); i != myEdges.end(); i++) { + edgeIDs.push_back((*i)->getID()); + } + return edgeIDs; +} + + +const std::vector& +GNECalibratorRoute::getEdges() const { + return myEdges; +} + + +const std::string& +GNECalibratorRoute::getColor() const { + return myColor; +} + + +bool +GNECalibratorRoute::setRouteID(std::string routeID) { + if (routeID.empty()) { + return false; + } else if (myCalibratorParent->getViewNet()->getNet()->routeExists(routeID) == true) { + return false; + } else { + myRouteID = routeID; + return true; + } +} + + +bool +GNECalibratorRoute::setEdges(const std::vector& edgeIDs) { + std::vector edges; + GNEEdge* edgeTmp; + for (std::vector::const_iterator i = edgeIDs.begin(); i != edgeIDs.end(); i++) { + // check that current edges exist in the net + edgeTmp = myCalibratorParent->getViewNet()->getNet()->retrieveEdge((*i), false); + if (edgeTmp != NULL) { + edges.push_back(edgeTmp); + } else { + return false; + } + } + return setEdges(edges); +} + + +bool +GNECalibratorRoute::setEdges(const std::vector& edges) { + myEdges = edges; + return true; +} + + +bool +GNECalibratorRoute::setEdges(const std::string& edgeIDs) { + if (GNEAttributeCarrier::canParse >(edgeIDs)) { + return setEdges(GNEAttributeCarrier::parse >(edgeIDs)); + } else { + return false; + } +} + + +bool +GNECalibratorRoute::setColor(std::string color) { + myColor = color; + return true; +} + + +std::string +GNECalibratorRoute::checkEdgeRoute(const std::vector& edgeIDs) const { + std::vector edges; + // check that there aren't to equal adjacent edges + for (std::vector::const_iterator i = edgeIDs.begin() + 1; i != edgeIDs.end(); i++) { + GNEEdge* retrievedEdge = myCalibratorParent->getViewNet()->getNet()->retrieveEdge((*i), false); + if (retrievedEdge != NULL) { + edges.push_back(retrievedEdge); + } else { + return (toString(SUMO_TAG_EDGE) + " '" + *i + "' doesn't exist"); + } + } + // check that there aren't to equal adjacent edges + for (std::vector::const_iterator i = edges.begin() + 1; i != edges.end(); i++) { + if ((*(i - 1))->getID() == (*i)->getID()) { + return (toString(SUMO_TAG_EDGE) + " '" + (*i)->getID() + "' is adjacent to itself"); + } + } + // check that edges are adjacents + for (std::vector::const_iterator i = edges.begin() + 1; i != edges.end(); i++) { + std::vector adyacents = (*(i - 1))->getGNEJunctionDestiny()->getGNEOutgoingEdges(); + if (std::find(adyacents.begin(), adyacents.end(), (*i)) == adyacents.end()) { + return (toString(SUMO_TAG_EDGE) + " '" + (*(i - 1))->getID() + "' isn't adjacent to " + toString(SUMO_TAG_EDGE) + " '" + (*i)->getID() + "'"); + } + } + // all ok, then return "" + return ""; +} + + +bool +GNECalibratorRoute::operator==(const GNECalibratorRoute& calibratorRoute) const { + return (myRouteID == calibratorRoute.getRouteID()); +} + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorRouteDialog.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorRouteDialog.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorRouteDialog.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorRouteDialog.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,225 @@ +/****************************************************************************/ +/// @file GNECalibratorRouteDialog.cpp +/// @author Pablo Alvarez Lopez +/// @date March 2017 +/// @version $Id: GNECalibratorRouteDialog.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// Dialog for edit calibrator routes +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include + +#include "GNECalibratorRouteDialog.h" +#include "GNECalibratorDialog.h" +#include "GNECalibrator.h" +#include "GNEEdge.h" +#include "GNELane.h" +#include "GNEViewNet.h" +#include "GNENet.h" + + +// =========================================================================== +// FOX callback mapping +// =========================================================================== + +FXDEFMAP(GNECalibratorRouteDialog) GNECalibratorRouteDialogMap[] = { + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_ACCEPT, GNECalibratorRouteDialog::onCmdAccept), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_CANCEL, GNECalibratorRouteDialog::onCmdCancel), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_RESET, GNECalibratorRouteDialog::onCmdReset), + FXMAPFUNC(SEL_COMMAND, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GNECalibratorRouteDialog::onCmdSetVariable), +}; + +// Object implementation +FXIMPLEMENT(GNECalibratorRouteDialog, FXDialogBox, GNECalibratorRouteDialogMap, ARRAYNUMBER(GNECalibratorRouteDialogMap)) + +// =========================================================================== +// member method definitions +// =========================================================================== + +GNECalibratorRouteDialog::GNECalibratorRouteDialog(GNECalibratorDialog* calibratorDialog, GNECalibratorRoute& calibratorRoute, bool updatingElement) : + GNEAdditionalDialog(calibratorRoute.getCalibratorParent(), 400, 300), + myCalibratorDialogParent(calibratorDialog), + myCalibratorRoute(&calibratorRoute), + myUpdatingElement(updatingElement), + myCalibratorRouteValid(true) { + // change default header + changeAdditionalDialogHeader("Edit " + toString(calibratorRoute.getTag()) + " of " + toString(calibratorRoute.getCalibratorParent()->getTag()) + + " '" + calibratorRoute.getCalibratorParent()->getID() + "'"); + + // Create auxiliar frames for data + FXHorizontalFrame* columns = new FXHorizontalFrame(myContentFrame, GUIDesignUniformHorizontalFrame); + FXVerticalFrame* columnLeft = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame); + FXVerticalFrame* columnRight = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame); + + // create ID's elements + new FXLabel(columnLeft, toString(SUMO_ATTR_ID).c_str(), 0, GUIDesignLabelLeftThick); + myTextFieldRouteID = new FXTextField(columnRight, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + + // create list of edge's elements + new FXLabel(columnLeft, toString(SUMO_ATTR_EDGES).c_str(), 0, GUIDesignLabelLeftThick); + myTextFieldEdges = new FXTextField(columnRight, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + + // create color's elements + new FXLabel(columnLeft, toString(SUMO_ATTR_COLOR).c_str(), 0, GUIDesignLabelLeftThick); + myTextFieldColor = new FXTextField(columnRight, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + + // create Edges of net's elements + new FXLabel(columnLeft, (toString(SUMO_TAG_EDGE) + "s of " + toString(SUMO_TAG_NET)).c_str(), 0, GUIDesignLabelLeftThick); + myListOfEdgesOfNet = new FXList(columnLeft, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignListExtended); + + // create Edges of route's elements + new FXLabel(columnRight, ("current " + toString(SUMO_TAG_EDGE) + "s of " + toString(SUMO_TAG_ROUTE)).c_str(), 0, GUIDesignLabelLeftThick); + myListOfEdgesOfRoute = new FXList(columnRight, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignListExtended); + + // fill list of net's edges + std::vector edgesOfNet = calibratorRoute.getCalibratorParent()->getViewNet()->getNet()->retrieveEdges(); + for (std::vector::iterator i = edgesOfNet.begin(); i != edgesOfNet.end(); i++) { + myListOfEdgesOfNet->appendItem((*i)->getID().c_str()); + } + + // create copy of GNECalibratorRoute + myCopyOfCalibratorRoute = new GNECalibratorRoute(myCalibratorRoute->getCalibratorParent()); + + // copy all values of myCalibratorRoute into myCopyOfCalibratorRoute to set initial values + (*myCopyOfCalibratorRoute) = (*myCalibratorRoute); + + // update tables + updateCalibratorRouteValues(); +} + + +GNECalibratorRouteDialog::~GNECalibratorRouteDialog() { + // delete copy + delete myCopyOfCalibratorRoute; +} + + +long +GNECalibratorRouteDialog::onCmdAccept(FXObject*, FXSelector, void*) { + if (myCalibratorRouteValid == false) { + // write warning if netedit is running in testing mode + if (myCalibratorDialogParent->getCalibratorParent()->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Opening FXMessageBox of type 'warning'"); + } + FXMessageBox::warning(getApp(), MBOX_OK, + ("Error " + std::string((myUpdatingElement == true) ? ("updating") : ("creating")) + " " + toString(myCalibratorRoute->getCalibratorParent()->getTag()) + + "'s " + toString(myCalibratorRoute->getTag())).c_str(), "%s", + (toString(myCalibratorRoute->getCalibratorParent()->getTag()) + "'s " + toString(myCalibratorRoute->getTag()) + + " cannot be " + std::string((myUpdatingElement == true) ? ("updated") : ("created")) + " because parameter " + toString(myInvalidAttr) + + " is invalid.").c_str()); + // write warning if netedit is running in testing mode + if (myCalibratorDialogParent->getCalibratorParent()->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'"); + } + return 0; + } else { + // copy all values of myCopyOfCalibratorRoute into myCalibratorRoute + (*myCalibratorRoute) = (*myCopyOfCalibratorRoute); + getApp()->stopModal(this, TRUE); + return 1; + } +} + + +long +GNECalibratorRouteDialog::onCmdCancel(FXObject*, FXSelector, void*) { + // Stop Modal + getApp()->stopModal(this, FALSE); + return 1; +} + + +long +GNECalibratorRouteDialog::onCmdReset(FXObject*, FXSelector, void*) { + // copy all values of myCalibratorRoute into myCopyOfCalibratorRoute to set initial values + (*myCopyOfCalibratorRoute) = (*myCalibratorRoute); + // update fields + updateCalibratorRouteValues(); + return 1; +} + + +long +GNECalibratorRouteDialog::onCmdSetVariable(FXObject*, FXSelector, void*) { + // At start we assumed, that all values are valid + myCalibratorRouteValid = true; + myInvalidAttr = SUMO_ATTR_NOTHING; + + // set color of myTextFieldRouteID, depending if current value is valid or not + if (myCopyOfCalibratorRoute->getRouteID() == myTextFieldRouteID->getText().text()) { + myTextFieldRouteID->setTextColor(FXRGB(0, 0, 0)); + } else if (myCopyOfCalibratorRoute->setRouteID(myTextFieldRouteID->getText().text()) == true) { + myTextFieldRouteID->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldRouteID->setTextColor(FXRGB(255, 0, 0)); + myCalibratorRouteValid = false; + myInvalidAttr = SUMO_ATTR_ID; + } + + // set color of myTextFieldRouteEdges, depending if current value is valEdges or not + if (myCopyOfCalibratorRoute->setEdges(myTextFieldEdges->getText().text()) == true) { + myTextFieldEdges->setTextColor(FXRGB(0, 0, 0)); + // fill list of router's edges + myListOfEdgesOfRoute->clearItems(); + std::vector edgesOfRouter = myCopyOfCalibratorRoute->getEdges(); + for (std::vector::iterator i = edgesOfRouter.begin(); i != edgesOfRouter.end(); i++) { + myListOfEdgesOfRoute->appendItem((*i)->getID().c_str()); + } + } else { + myTextFieldEdges->setTextColor(FXRGB(255, 0, 0)); + myCalibratorRouteValid = false; + myInvalidAttr = SUMO_ATTR_EDGES; + } + + // set color of myTextFieldColor, depending if current value is valid or not + if (myCopyOfCalibratorRoute->getColor() == myTextFieldColor->getText().text()) { + myTextFieldColor->setTextColor(FXRGB(0, 0, 0)); + } else if (myCopyOfCalibratorRoute->setColor(myTextFieldColor->getText().text()) == true) { + myTextFieldColor->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldColor->setTextColor(FXRGB(255, 0, 0)); + myCalibratorRouteValid = false; + myInvalidAttr = SUMO_ATTR_COLOR; + } + return 1; +} + + +void +GNECalibratorRouteDialog::updateCalibratorRouteValues() { + myTextFieldRouteID->setText(myCopyOfCalibratorRoute->getRouteID().c_str()); + myTextFieldEdges->setText(joinToString(myCopyOfCalibratorRoute->getEdgesIDs(), " ").c_str()); + myTextFieldColor->setText(myCopyOfCalibratorRoute->getColor().c_str()); + // fill list of router's edges + myListOfEdgesOfRoute->clearItems(); + std::vector edgesOfRouter = myCopyOfCalibratorRoute->getEdges(); + for (std::vector::iterator i = edgesOfRouter.begin(); i != edgesOfRouter.end(); i++) { + myListOfEdgesOfRoute->appendItem((*i)->getID().c_str()); + } +} + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorRouteDialog.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorRouteDialog.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorRouteDialog.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorRouteDialog.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,125 @@ +/****************************************************************************/ +/// @file GNECalibratorRouteDialog.h +/// @author Pablo Alvarez Lopez +/// @date March 2017 +/// @version $Id: GNECalibratorRouteDialog.h 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// Dialog for edit calibrator routes +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNECalibratorRouteDialog_h +#define GNECalibratorRouteDialog_h + +// =========================================================================== +// included modules +// =========================================================================== + +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include "GNEAdditionalDialog.h" +#include "GNECalibratorRoute.h" + +// =========================================================================== +// class declarations +// =========================================================================== + +class GNECalibratorDialog; + +// =========================================================================== +// class definitions +// =========================================================================== + +/** + * @class GNECalibratorRouteDialog + * @brief Dialog for edit rerouter intervals + */ + +class GNECalibratorRouteDialog : public GNEAdditionalDialog { + /// @brief FOX-declaration + FXDECLARE(GNECalibratorRouteDialog) + +public: + /// @brief constructor + GNECalibratorRouteDialog(GNECalibratorDialog* calibratorDialog, GNECalibratorRoute& calibratorRoute, bool updatingElement); + + /// @brief destructor + ~GNECalibratorRouteDialog(); + + /// @name FOX-callbacks + /// @{ + /// @brief event after press accept button + long onCmdAccept(FXObject*, FXSelector, void*); + + /// @brief event after press cancel button + long onCmdCancel(FXObject*, FXSelector, void*); + + /// @brief event after press reset button + long onCmdReset(FXObject*, FXSelector, void*); + + /// @brief event after change value + long onCmdSetVariable(FXObject*, FXSelector, void*); + /// @} + +protected: + /// @brief FOX needs this + GNECalibratorRouteDialog() {} + + /// @brief update data fields + void updateCalibratorRouteValues(); + + /// @brief pointer to GNECalibratorDialog parent + GNECalibratorDialog* myCalibratorDialogParent; + + /// @brief pointer to modified rerouter interval + GNECalibratorRoute* myCalibratorRoute; + + /// @brief flag to indicate if flow are being created or modified + bool myUpdatingElement; + + /// @brief pointer in which save modifications of CalibratorRoute + GNECalibratorRoute* myCopyOfCalibratorRoute; + + /// @brief flag to check if current calibrator vehicleType is valid + bool myCalibratorRouteValid; + + /// @brief current sumo attribute invalid + SumoXMLAttr myInvalidAttr; + + /// @brief route ID + FXTextField* myTextFieldRouteID; + + /// @brief list of edges (string) + FXTextField* myTextFieldEdges; + + /// @brief color of route + FXTextField* myTextFieldColor; + + /// @brief list of edges of net + FXList* myListOfEdgesOfNet; + + /// @brief list of edges of route + FXList* myListOfEdgesOfRoute; + +private: + /// @brief Invalidated copy constructor. + GNECalibratorRouteDialog(const GNECalibratorRouteDialog&); + + /// @brief Invalidated assignment operator. + GNECalibratorRouteDialog& operator=(const GNECalibratorRouteDialog&); +}; + +#endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorRoute.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorRoute.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorRoute.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorRoute.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,131 @@ +/****************************************************************************/ +/// @file GNECalibratorRoute.h +/// @author Pablo Alvarez Lopez +/// @date Nov 2015 +/// @version $Id: GNECalibratorRoute.h 23896 2017-04-10 10:48:28Z palcraft $ +/// +/// Route used by GNECalibrators +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNECalibratorRoute_h +#define GNECalibratorRoute_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include + +// =========================================================================== +// class declaration +// =========================================================================== + +class GNECalibrator; +class GNEEdge; + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class GNECalibratorRoute + * vehicle route used by GNECalibrators + */ +class GNECalibratorRoute { +public: + + /// @brief default constructor + GNECalibratorRoute(GNECalibrator* calibratorParent); + + /// @brief parameter constructor 1 (Using edges IDs) + GNECalibratorRoute(GNECalibrator* calibratorParent, std::string routeID, std::vector edges, std::string color); + + /// @brief parameter constructor 2 (Using GNEEdges) + GNECalibratorRoute(GNECalibrator* calibratorParent, std::string routeID, std::vector edges, std::string color); + + /// @brief destructor + ~GNECalibratorRoute(); + + /// @brief get pointer to calibrator parent + GNECalibrator* getCalibratorParent() const; + + /// @brief get tag + SumoXMLTag getTag() const; + + /// @brief get route ID + const std::string& getRouteID() const; + + /// @brief get IDs of Edges + std::vector getEdgesIDs() const; + + /// @brief get edges + const std::vector& getEdges() const; + + /// @brief get color of route + const std::string& getColor() const; + + /**@brief set route ID + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setRouteID(std::string routeID); + + /**@brief set edges of route using IDs + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setEdges(const std::vector& edgeIDs); + + /**@brief set edges of route using pointers + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setEdges(const std::vector& edges); + + /**@brief set edges of route using a single string + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setEdges(const std::string& edgeIDs); + + /**@brief set color of route + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setColor(std::string color = ""); + + /**@brief check if a list of edges is valid to set a route + * @return "" if is correct, a error string in other case + */ + std::string checkEdgeRoute(const std::vector& edge) const; + + /// @brief overload operator == + bool operator==(const GNECalibratorRoute& calibratorRoute) const; + +private: + /// @brief pointer to calibrator parent + GNECalibrator* myCalibratorParent; + + /// @brief route in which this flow is used + std::string myRouteID; + + /// @brief edges of route + std::vector myEdges; + + /// @brief color of flow + std::string myColor; +}; + +#endif +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorVehicleType.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorVehicleType.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorVehicleType.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorVehicleType.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,767 @@ +/****************************************************************************/ +/// @file GNECalibratorVehicleType.cpp +/// @author Pablo Alvarez Lopez +/// @date March 2016 +/// @version $Id: GNECalibratorVehicleType.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "GNECalibratorVehicleType.h" +#include "GNECalibrator.h" +#include "GNEViewNet.h" +#include "GNENet.h" + + +// =========================================================================== +// member method definitions +// =========================================================================== + + +GNECalibratorVehicleType::GNECalibratorVehicleType(GNECalibrator* calibratorParent) : + myCalibratorParent(calibratorParent), myVehicleTypeID(calibratorParent->generateVehicleTypeID()) { + // setset default parameters + setAccel(); + setDecel(); + setSigma(); + setTau(); + setLength(); + setMinGap(); + setMaxSpeed(); + setSpeedFactor(); + setSpeedDev(); + setColor(); + setVClass(); + setEmissionClass(); + setShape(); + setWidth(); + setFilename(); + setImpatience(); + setLaneChangeModel(); + setCarFollowModel(); + setPersonCapacity(); + setContainerCapacity(); + setBoardingDuration(); + setLoadingDuration(); + setLatAlignment(); + setMinGapLat(); + setMaxSpeedLat(); +} + + +GNECalibratorVehicleType::GNECalibratorVehicleType(GNECalibrator* calibratorParent, std::string vehicleTypeID, + double accel, double decel, double sigma, double tau, double length, double minGap, double maxSpeed, + double speedFactor, double speedDev, const std::string& color, SUMOVehicleClass vClass, const std::string& emissionClass, + SUMOVehicleShape shape, double width, const std::string& filename, double impatience, const std::string& laneChangeModel, + const std::string& carFollowModel, int personCapacity, int containerCapacity, double boardingDuration, + double loadingDuration, const std::string& latAlignment, double minGapLat, double maxSpeedLat) : + myCalibratorParent(calibratorParent), myVehicleTypeID(calibratorParent->generateVehicleTypeID()) { + // set parameters using the set functions, to avoid non valid values + setVehicleTypeID(vehicleTypeID); + setAccel(accel); + setDecel(decel); + setSigma(sigma); + setTau(tau); + setLength(length); + setMinGap(minGap); + setMaxSpeed(maxSpeed); + setSpeedFactor(speedFactor); + setSpeedDev(speedDev); + setColor(color); + setVClass(vClass); + setEmissionClass(emissionClass); + setShape(shape); + setWidth(width); + setFilename(filename); + setImpatience(impatience); + setLaneChangeModel(laneChangeModel); + setCarFollowModel(carFollowModel); + setPersonCapacity(personCapacity); + setContainerCapacity(containerCapacity); + setBoardingDuration(boardingDuration); + setLoadingDuration(loadingDuration); + setLatAlignment(latAlignment); + setMinGapLat(minGapLat); + setMaxSpeedLat(maxSpeedLat); +} + + +GNECalibratorVehicleType::~GNECalibratorVehicleType() {} + + +GNECalibrator* +GNECalibratorVehicleType::getCalibratorParent() const { + return myCalibratorParent; +} + + +SumoXMLTag +GNECalibratorVehicleType::getTag() const { + return SUMO_TAG_VTYPE; +} + + +std::string +GNECalibratorVehicleType::getVehicleTypeID() const { + return myVehicleTypeID; +} + + +double +GNECalibratorVehicleType::getAccel() const { + return myAccel; +} + + +double +GNECalibratorVehicleType::getDecel() const { + return myDecel; +} + + +double +GNECalibratorVehicleType::getSigma() const { + return mySigma; +} + + +double +GNECalibratorVehicleType::getTau() const { + return myTau; +} + + +double +GNECalibratorVehicleType::getLength() const { + return myLength; +} + + +double +GNECalibratorVehicleType::getMinGap() const { + return myMinGap; +} + + +double +GNECalibratorVehicleType::getMaxSpeed() const { + return myMaxSpeed; +} + + +double +GNECalibratorVehicleType::getSpeedFactor() const { + return mySpeedFactor; +} + + +double +GNECalibratorVehicleType::getSpeedDev() const { + return mySpeedDev; +} + + +std::string +GNECalibratorVehicleType::getColor() const { + return myColor; +} + + +SUMOVehicleClass +GNECalibratorVehicleType::getVClass() const { + return myVClass; +} + + +std::string +GNECalibratorVehicleType::getEmissionClass() const { + return myEmissionClass; +} + + +SUMOVehicleShape +GNECalibratorVehicleType::getShape() const { + return myShape; +} + + +double +GNECalibratorVehicleType::getWidth() const { + return myWidth; +} + + +std::string +GNECalibratorVehicleType::getFilename() const { + return myFilename; +} + + +double +GNECalibratorVehicleType::getImpatience() const { + return myImpatience; +} + + +std::string +GNECalibratorVehicleType::getLaneChangeModel() const { + return myLaneChangeModel; +} + + +std::string +GNECalibratorVehicleType::getCarFollowModel() const { + return myCarFollowModel; +} + + +int +GNECalibratorVehicleType::getPersonCapacity() const { + return myPersonCapacity; +} + + +int +GNECalibratorVehicleType::getContainerCapacity() const { + return myContainerCapacity; +} + + +double +GNECalibratorVehicleType::getBoardingDuration() const { + return myBoardingDuration; +} + + +double +GNECalibratorVehicleType::getLoadingDuration() const { + return myLoadingDuration; +} + + +std::string +GNECalibratorVehicleType::getLatAlignment() const { + return myLatAlignment; +} + + +double +GNECalibratorVehicleType::getMinGapLat() const { + return myMinGapLat; +} + + +double +GNECalibratorVehicleType::getMaxSpeedLat() const { + return myMaxSpeedLat; +} + +bool +GNECalibratorVehicleType::setVehicleTypeID(std::string vehicleTypeID) { + if (vehicleTypeID.empty()) { + return false; + } else if (myCalibratorParent->getViewNet()->getNet()->vehicleTypeExists(vehicleTypeID) == true) { + return false; + } else { + myVehicleTypeID = vehicleTypeID; + return true; + } +} + + +bool +GNECalibratorVehicleType::setAccel(double accel) { + if (accel < 0) { + return false; + } else { + myAccel = accel; + return true; + } +} + + +bool +GNECalibratorVehicleType::setAccel(std::string accel) { + if (GNEAttributeCarrier::canParse(accel)) { + return setAccel(GNEAttributeCarrier::parse(accel)); + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setDecel(double decel) { + if (decel < 0) { + return false; + } else { + myDecel = decel; + return true; + } +} + + +bool +GNECalibratorVehicleType::setDecel(std::string decel) { + if (GNEAttributeCarrier::canParse(decel)) { + return setDecel(GNEAttributeCarrier::parse(decel)); + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setSigma(double sigma) { + if (sigma < 0) { + return false; + } else { + mySigma = sigma; + return true; + } +} + + +bool +GNECalibratorVehicleType::setSigma(std::string sigma) { + if (GNEAttributeCarrier::canParse(sigma)) { + return setSigma(GNEAttributeCarrier::parse(sigma)); + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setTau(double tau) { + if (tau < 0) { + return false; + } else { + myTau = tau; + return true; + } +} + + +bool +GNECalibratorVehicleType::setTau(std::string tau) { + if (GNEAttributeCarrier::canParse(tau)) { + return setTau(GNEAttributeCarrier::parse(tau)); + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setLength(double length) { + if (length < 0) { + return false; + } else { + myLength = length; + return true; + } +} + + +bool +GNECalibratorVehicleType::setLength(std::string length) { + if (GNEAttributeCarrier::canParse(length)) { + return setLength(GNEAttributeCarrier::parse(length)); + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setMinGap(double minGap) { + if (minGap < 0) { + return false; + } else { + myMinGap = minGap; + return true; + } +} + + +bool +GNECalibratorVehicleType::setMinGap(std::string minGap) { + if (GNEAttributeCarrier::canParse(minGap)) { + return setMinGap(GNEAttributeCarrier::parse(minGap)); + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setMaxSpeed(double maxSpeed) { + if (maxSpeed < 0) { + return false; + } else { + myMaxSpeed = maxSpeed; + return true; + } +} + + +bool +GNECalibratorVehicleType::setMaxSpeed(std::string maxSpeed) { + if (GNEAttributeCarrier::canParse(maxSpeed)) { + return setMaxSpeed(GNEAttributeCarrier::parse(maxSpeed)); + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setSpeedFactor(double speedFactor) { + if (speedFactor < 0) { + return false; + } else { + mySpeedFactor = speedFactor; + return true; + } +} + + +bool +GNECalibratorVehicleType::setSpeedFactor(std::string speedFactor) { + if (GNEAttributeCarrier::canParse(speedFactor)) { + return setSpeedFactor(GNEAttributeCarrier::parse(speedFactor)); + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setSpeedDev(double speedDev) { + if (speedDev < 0) { + return false; + } else { + mySpeedDev = speedDev; + return true; + } +} + + +bool +GNECalibratorVehicleType::setSpeedDev(std::string speedDev) { + if (GNEAttributeCarrier::canParse(speedDev)) { + return setSpeedDev(GNEAttributeCarrier::parse(speedDev)); + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setColor(std::string color) { + myColor = color; + return true; +} + + +bool +GNECalibratorVehicleType::setVClass(SUMOVehicleClass vClass) { + myVClass = vClass; + return true; +} + + +bool +GNECalibratorVehicleType::setVClass(std::string vClass) { + if (canParseVehicleClasses(vClass) == true) { + return setVClass(getVehicleClassID(vClass)); + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setEmissionClass(std::string emissionClass) { + myEmissionClass = emissionClass; + return true; +} + + +bool +GNECalibratorVehicleType::setShape(SUMOVehicleShape shape) { + myShape = shape; + return true; +} + + +bool +GNECalibratorVehicleType::setShape(std::string shape) { + if (canParseVehicleShape(shape)) { + return setShape(getVehicleShapeID(shape)); + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setWidth(double width) { + if (width < 0) { + return false; + } else { + myWidth = width; + return true; + } +} + + +bool +GNECalibratorVehicleType::setWidth(std::string width) { + if (GNEAttributeCarrier::canParse(width)) { + return setWidth(GNEAttributeCarrier::parse(width)); + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setFilename(std::string filename) { + myFilename = filename; + return true; +} + + +bool +GNECalibratorVehicleType::setImpatience(double impatience) { + if (impatience < 0) { + return false; + } else { + myImpatience = impatience; + return true; + } +} + + +bool +GNECalibratorVehicleType::setImpatience(std::string impatience) { + if (GNEAttributeCarrier::canParse(impatience)) { + return setImpatience(GNEAttributeCarrier::parse(impatience)); + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setLaneChangeModel(std::string laneChangeModel) { + myLaneChangeModel = laneChangeModel; + return true; +} + + +bool +GNECalibratorVehicleType::setCarFollowModel(std::string carFollowModel) { + myCarFollowModel = carFollowModel; + return true; +} + + +bool +GNECalibratorVehicleType::setPersonCapacity(int personCapacity) { + if (personCapacity < 0) { + return false; + } else { + myPersonCapacity = personCapacity; + return true; + } +} + + +bool +GNECalibratorVehicleType::setPersonCapacity(std::string personCapacity) { + if (GNEAttributeCarrier::canParse(personCapacity)) { + double personCapacityD = GNEAttributeCarrier::parse(personCapacity); + // Check that double doesn't have decimals + if (fmod(personCapacityD, 1) == 0) { + return setPersonCapacity((int)personCapacityD); + } else { + return false; + } + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setContainerCapacity(int containerCapacity) { + if (containerCapacity < 0) { + return false; + } else { + myContainerCapacity = containerCapacity; + return true; + } +} + + +bool +GNECalibratorVehicleType::setContainerCapacity(std::string containerCapacity) { + if (GNEAttributeCarrier::canParse(containerCapacity)) { + double containerCapacityD = GNEAttributeCarrier::parse(containerCapacity); + // Check that double doesn't have decimals + if (fmod(containerCapacityD, 1) == 0) { + return setContainerCapacity((int)containerCapacityD); + } else { + return false; + } + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setBoardingDuration(double boardingDuration) { + if (boardingDuration < 0) { + return false; + } else { + myBoardingDuration = boardingDuration; + return true; + } +} + + +bool +GNECalibratorVehicleType::setBoardingDuration(std::string boardingDuration) { + if (GNEAttributeCarrier::canParse(boardingDuration)) { + return setBoardingDuration(GNEAttributeCarrier::parse(boardingDuration)); + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setLoadingDuration(double loadingDuration) { + if (loadingDuration < 0) { + return false; + } else { + myLoadingDuration = loadingDuration; + return true; + } +} + + +bool +GNECalibratorVehicleType::setLoadingDuration(std::string loadingDuration) { + if (GNEAttributeCarrier::canParse(loadingDuration)) { + return setLoadingDuration(GNEAttributeCarrier::parse(loadingDuration)); + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setLatAlignment(std::string latAlignment) { + if ((latAlignment == "left") || (latAlignment == "right") || (latAlignment == "center") || + (latAlignment == "compact") || (latAlignment == "nice") || (latAlignment == "arbitrary")) { + myLatAlignment = latAlignment; + return true; + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setMinGapLat(double minGapLat) { + if (minGapLat < 0) { + return false; + } else { + myMinGapLat = minGapLat; + return true; + } +} + + +bool +GNECalibratorVehicleType::setMinGapLat(std::string minGapLat) { + if (GNEAttributeCarrier::canParse(minGapLat)) { + return setMinGapLat(GNEAttributeCarrier::parse(minGapLat)); + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::setMaxSpeedLat(double maxSpeedLat) { + if (maxSpeedLat < 0) { + return false; + } else { + myMaxSpeedLat = maxSpeedLat; + return true; + } +} + + +bool +GNECalibratorVehicleType::setMaxSpeedLat(std::string maxSpeedLat) { + if (GNEAttributeCarrier::canParse(maxSpeedLat)) { + return setMaxSpeedLat(GNEAttributeCarrier::parse(maxSpeedLat)); + } else { + return false; + } +} + + +bool +GNECalibratorVehicleType::operator==(const GNECalibratorVehicleType& calibratorVehicleType) const { + return (myVehicleTypeID == calibratorVehicleType.getVehicleTypeID()); +} + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorVehicleTypeDialog.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorVehicleTypeDialog.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorVehicleTypeDialog.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorVehicleTypeDialog.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,607 @@ +/****************************************************************************/ +/// @file GNECalibratorVehicleTypeDialog.cpp +/// @author Pablo Alvarez Lopez +/// @date March 2017 +/// @version $Id: GNECalibratorVehicleTypeDialog.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// Dialog for edit calibrator vehicleTypes +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include + +#include "GNECalibratorVehicleTypeDialog.h" +#include "GNECalibratorDialog.h" +#include "GNECalibrator.h" +#include "GNEEdge.h" +#include "GNELane.h" +#include "GNEViewNet.h" +#include "GNENet.h" + + +// =========================================================================== +// FOX callback mapping +// =========================================================================== + +FXDEFMAP(GNECalibratorVehicleTypeDialog) GNECalibratorVehicleTypeDialogMap[] = { + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_ACCEPT, GNECalibratorVehicleTypeDialog::onCmdAccept), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_CANCEL, GNECalibratorVehicleTypeDialog::onCmdCancel), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_RESET, GNECalibratorVehicleTypeDialog::onCmdReset), + FXMAPFUNC(SEL_COMMAND, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GNECalibratorVehicleTypeDialog::onCmdSetVariable), +}; + +// Object implementation +FXIMPLEMENT(GNECalibratorVehicleTypeDialog, FXDialogBox, GNECalibratorVehicleTypeDialogMap, ARRAYNUMBER(GNECalibratorVehicleTypeDialogMap)) + +// =========================================================================== +// member method definitions +// =========================================================================== + +GNECalibratorVehicleTypeDialog::GNECalibratorVehicleTypeDialog(GNECalibratorDialog* calibratorDialog, GNECalibratorVehicleType& calibratorVehicleType, bool updatingElement) : + GNEAdditionalDialog(calibratorVehicleType.getCalibratorParent(), 500, 375), + myCalibratorDialogParent(calibratorDialog), + myCalibratorVehicleType(&calibratorVehicleType), + myUpdatingElement(updatingElement), + myCalibratorVehicleTypeValid(true), + myInvalidAttr(SUMO_ATTR_NOTHING) { + // change default header + changeAdditionalDialogHeader("Edit " + toString(calibratorVehicleType.getTag()) + " of " + toString(calibratorVehicleType.getCalibratorParent()->getTag()) + + " '" + calibratorVehicleType.getCalibratorParent()->getID() + "'"); + + // Create auxiliar frames for values + FXHorizontalFrame* columns = new FXHorizontalFrame(myContentFrame, GUIDesignUniformHorizontalFrame); + FXVerticalFrame* columnLeftLabel = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame); + FXVerticalFrame* columnLeftValues = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame); + FXVerticalFrame* columnRightLabel = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame); + FXVerticalFrame* columnRightValues = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame); + + // FXComboBox for VClass + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_VCLASS).c_str(), 0, GUIDesignLabelThick); + myComboBoxVClass = new FXComboBox(columnLeftLabel, GUIDesignComboBoxNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignComboBox); + myComboBoxVClassLabelImage = new FXLabel(columnLeftValues, "", 0, GUIDesignLabelIconExtendedx46Ticked); + myComboBoxVClassLabelImage->setBackColor(FXRGBA(255, 255, 255, 255)); + // fill combo Box + std::vector VClassStrings = SumoVehicleClassStrings.getStrings(); + for (std::vector::iterator i = VClassStrings.begin(); i != VClassStrings.end(); i++) { + if ((*i) != SumoVehicleClassStrings.getString(SVC_IGNORING)) { + myComboBoxVClass->appendItem(i->c_str()); + } + } + myComboBoxVClass->setNumVisible(10); + + // FXComboBox for Shape + new FXLabel(columnRightLabel, toString(SUMO_ATTR_SHAPE).c_str(), 0, GUIDesignLabelThick); + myComboBoxShape = new FXComboBox(columnRightLabel, GUIDesignComboBoxNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignComboBox); + myComboBoxShapeLabelImage = new FXLabel(columnRightValues, "", 0, GUIDesignLabelIconExtendedx46Ticked); + myComboBoxShapeLabelImage->setBackColor(FXRGBA(255, 255, 255, 255)); + // fill combo Box + std::vector VShapeStrings = SumoVehicleShapeStrings.getStrings(); + for (std::vector::iterator i = VShapeStrings.begin(); i != VShapeStrings.end(); i++) { + if ((*i) != SumoVehicleShapeStrings.getString(SVS_UNKNOWN)) { + myComboBoxShape->appendItem(i->c_str()); + } + } + myComboBoxShape->setNumVisible(10); + + // 01 create FXTextField and Label for vehicleTypeID + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_ID).c_str(), 0, GUIDesignLabelThick); + myTextFieldVehicleTypeID = new FXTextField(columnLeftValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + + // 02 create FXTextField and Label for Accel + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_ACCEL).c_str(), 0, GUIDesignLabelThick); + myTextFieldAccel = new FXTextField(columnLeftValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + + // 03 create FXTextField and Label for Decel + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_DECEL).c_str(), 0, GUIDesignLabelThick); + myTextFieldDecel = new FXTextField(columnLeftValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + + // 04 create FXTextField and Label for Sigma + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_SIGMA).c_str(), 0, GUIDesignLabelThick); + myTextFieldSigma = new FXTextField(columnLeftValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + + // 05 create FXTextField and Label for Tau + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_TAU).c_str(), 0, GUIDesignLabelThick); + myTextFieldTau = new FXTextField(columnLeftValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + + // 06 create FXTextField and Label for Length + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_LENGTH).c_str(), 0, GUIDesignLabelThick); + myTextFieldLength = new FXTextField(columnLeftValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + + // 07 create FXTextField and Label for MinGap + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_MINGAP).c_str(), 0, GUIDesignLabelThick); + myTextFieldMinGap = new FXTextField(columnLeftValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + + // 08 create FXTextField and Label for MaxSpeed + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_MAXSPEED).c_str(), 0, GUIDesignLabelThick); + myTextFieldMaxSpeed = new FXTextField(columnLeftValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + + // 09 create FXTextField and Label for SpeedFactor + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_SPEEDFACTOR).c_str(), 0, GUIDesignLabelThick); + myTextFieldSpeedFactor = new FXTextField(columnLeftValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + + // 10 create FXTextField and Label for SpeedDev + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_SPEEDDEV).c_str(), 0, GUIDesignLabelThick); + myTextFieldSpeedDev = new FXTextField(columnLeftValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + + // 11 create FXTextField and Label for Color + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_COLOR).c_str(), 0, GUIDesignLabelThick); + myTextFieldColor = new FXTextField(columnLeftValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + + // 12 create FXTextField and Label for EmissionClass + new FXLabel(columnLeftLabel, toString(SUMO_ATTR_EMISSIONCLASS).c_str(), 0, GUIDesignLabelThick); + myTextFieldEmissionClass = new FXTextField(columnLeftValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + + // 01 create FXTextField and Label for Width + new FXLabel(columnRightLabel, toString(SUMO_ATTR_WIDTH).c_str(), 0, GUIDesignLabelThick); + myTextFieldWidth = new FXTextField(columnRightValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + + // 02 create FXTextField and Label for Filename + new FXLabel(columnRightLabel, toString(SUMO_ATTR_FILE).c_str(), 0, GUIDesignLabelThick); + myTextFieldFilename = new FXTextField(columnRightValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + + // 03 create FXTextField and Label for Impatience + new FXLabel(columnRightLabel, toString(SUMO_ATTR_IMPATIENCE).c_str(), 0, GUIDesignLabelThick); + myTextFieldImpatience = new FXTextField(columnRightValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + + // 04 create FXTextField and Label for LaneChangeModel + new FXLabel(columnRightLabel, toString(SUMO_ATTR_LANE_CHANGE_MODEL).c_str(), 0, GUIDesignLabelThick); + myTextFieldLaneChangeModel = new FXTextField(columnRightValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + + // 05 create FXTextField and Label for CarFollowModel + new FXLabel(columnRightLabel, toString(SUMO_ATTR_CAR_FOLLOW_MODEL).c_str(), 0, GUIDesignLabelThick); + myTextFieldCarFollowModel = new FXTextField(columnRightValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + + // 06 create FXTextField and Label for PersonCapacity + new FXLabel(columnRightLabel, toString(SUMO_ATTR_PERSON_CAPACITY).c_str(), 0, GUIDesignLabelThick); + myTextFieldPersonCapacity = new FXTextField(columnRightValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldInt); + + // 07 create FXTextField and Label for ContainerCapacity + new FXLabel(columnRightLabel, toString(SUMO_ATTR_CONTAINER_CAPACITY).c_str(), 0, GUIDesignLabelThick); + myTextFieldContainerCapacity = new FXTextField(columnRightValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldInt); + + // 08 create FXTextField and Label for BoardingDuration + new FXLabel(columnRightLabel, toString(SUMO_ATTR_BOARDING_DURATION).c_str(), 0, GUIDesignLabelThick); + myTextFieldBoardingDuration = new FXTextField(columnRightValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + + // 09 create FXTextField and Label for LoadingDuration + new FXLabel(columnRightLabel, toString(SUMO_ATTR_LOADING_DURATION).c_str(), 0, GUIDesignLabelThick); + myTextFieldLoadingDuration = new FXTextField(columnRightValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + + // 10 create FXTextField and Label for LatAlignment + new FXLabel(columnRightLabel, toString(SUMO_ATTR_LATALIGNMENT).c_str(), 0, GUIDesignLabelThick); + myTextFieldLatAlignment = new FXTextField(columnRightValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextField); + + // 11 create FXTextField and Label for MinGapLat + new FXLabel(columnRightLabel, toString(SUMO_ATTR_MINGAP_LAT).c_str(), 0, GUIDesignLabelThick); + myTextFieldMinGapLat = new FXTextField(columnRightValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + + // 12 create FXTextField and Label for MaxSpeedLat + new FXLabel(columnRightLabel, toString(SUMO_ATTR_MAXSPEED_LAT).c_str(), 0, GUIDesignLabelThick); + myTextFieldMaxSpeedLat = new FXTextField(columnRightValues, GUIDesignTextFieldNCol, this, MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, GUIDesignTextFieldReal); + + // create copy of GNECalibratorVehicleType + myCopyOfCalibratorVehicleType = new GNECalibratorVehicleType(myCalibratorVehicleType->getCalibratorParent()); + + // copy all values of myCalibratorVehicleType into myCopyOfCalibratorVehicleType to set initial values + (*myCopyOfCalibratorVehicleType) = (*myCalibratorVehicleType); + + // update fields + updateCalibratorVehicleTypeValues(); +} + + +GNECalibratorVehicleTypeDialog::~GNECalibratorVehicleTypeDialog() { + // delete copy + delete myCopyOfCalibratorVehicleType; +} + + +long +GNECalibratorVehicleTypeDialog::onCmdAccept(FXObject*, FXSelector, void*) { + if (myCalibratorVehicleTypeValid == false) { + // write warning if netedit is running in testing mode + if (myCalibratorDialogParent->getCalibratorParent()->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Opening FXMessageBox of type 'warning'"); + } + // open warning dialogBox + FXMessageBox::warning(getApp(), MBOX_OK, + ("Error " + std::string((myUpdatingElement == true) ? ("updating") : ("creating")) + " " + toString(myCalibratorVehicleType->getCalibratorParent()->getTag()) + + "'s " + toString(myCalibratorVehicleType->getTag())).c_str(), "%s", + (toString(myCalibratorVehicleType->getCalibratorParent()->getTag()) + "'s " + toString(myCalibratorVehicleType->getTag()) + + " cannot be " + std::string((myUpdatingElement == true) ? ("updated") : ("created")) + " because parameter " + toString(myInvalidAttr) + + " is invalid.").c_str()); + // write warning if netedit is running in testing mode + if (myCalibratorDialogParent->getCalibratorParent()->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'"); + } + return 0; + } else { + // copy all values of myCopyOfCalibratorVehicleType into myCalibratorVehicleType + (*myCalibratorVehicleType) = (*myCopyOfCalibratorVehicleType); + getApp()->stopModal(this, TRUE); + return 1; + } +} + + +long +GNECalibratorVehicleTypeDialog::onCmdCancel(FXObject*, FXSelector, void*) { + // Stop Modal + getApp()->stopModal(this, FALSE); + return 1; +} + + +long +GNECalibratorVehicleTypeDialog::onCmdReset(FXObject*, FXSelector, void*) { + // copy all values of myCalibratorVehicleType into myCopyOfCalibratorVehicleType to set initial values + (*myCopyOfCalibratorVehicleType) = (*myCalibratorVehicleType); + // update fields + updateCalibratorVehicleTypeValues(); + return 1; +} + + +long +GNECalibratorVehicleTypeDialog::onCmdSetVariable(FXObject*, FXSelector, void*) { + // At start we assumed, that all values are valid + myCalibratorVehicleTypeValid = true; + myInvalidAttr = SUMO_ATTR_NOTHING; + // set color of myComboBoxShape, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setShape(myComboBoxShape->getText().text()) == true) { + myComboBoxShape->setTextColor(FXRGB(0, 0, 0)); + } else { + myComboBoxShape->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_SHAPE; + } + // set color of myComboBoxVClass, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setVClass(myComboBoxVClass->getText().text()) == true) { + myComboBoxVClass->setTextColor(FXRGB(0, 0, 0)); + setVClassLabelImage(); + } else { + myComboBoxVClass->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_VCLASS; + } + // set color of myTextFieldVehicleTypeID, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->getVehicleTypeID() == myTextFieldVehicleTypeID->getText().text()) { + myTextFieldVehicleTypeID->setTextColor(FXRGB(0, 0, 0)); + } else if (myCopyOfCalibratorVehicleType->setVehicleTypeID(myTextFieldVehicleTypeID->getText().text()) == true) { + myTextFieldVehicleTypeID->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldVehicleTypeID->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_ID; + } + // set color of myTextFieldAccel, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setAccel(myTextFieldAccel->getText().text()) == true) { + myTextFieldAccel->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldAccel->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_ACCEL; + } + // set color of myTextFieldDecel, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setDecel(myTextFieldDecel->getText().text()) == true) { + myTextFieldDecel->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldDecel->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_DECEL; + } + // set color of myTextFieldSigma, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setSigma(myTextFieldSigma->getText().text()) == true) { + myTextFieldSigma->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldSigma->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_SIGMA; + } + // set color of myTextFieldTau, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setTau(myTextFieldTau->getText().text()) == true) { + myTextFieldTau->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldTau->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_TAU; + } + // set color of myTextFieldLength, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setLength(myTextFieldLength->getText().text()) == true) { + myTextFieldLength->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldLength->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_LENGTH; + } + // set color of myTextFieldMinGap, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setMinGap(myTextFieldMinGap->getText().text()) == true) { + myTextFieldMinGap->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldMinGap->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_MINGAP; + } + // set color of myTextFieldMaxSpeed, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setMaxSpeed(myTextFieldMaxSpeed->getText().text()) == true) { + myTextFieldMaxSpeed->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldMaxSpeed->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_MAXSPEED; + } + // set color of myTextFieldSpeedFactor, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setSpeedFactor(myTextFieldSpeedFactor->getText().text()) == true) { + myTextFieldSpeedFactor->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldSpeedFactor->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_SPEEDFACTOR; + } + // set color of myTextFieldSpeedDev, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setSpeedDev(myTextFieldSpeedDev->getText().text()) == true) { + myTextFieldSpeedDev->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldSpeedDev->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_SPEEDDEV; + } + // set color of myTextFieldColor, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setColor(myTextFieldColor->getText().text()) == true) { + myTextFieldColor->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldColor->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_COLOR; + } + // set color of myTextFieldEmissionClass, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setEmissionClass(myTextFieldEmissionClass->getText().text()) == true) { + myTextFieldEmissionClass->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldEmissionClass->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_EMISSIONCLASS; + } + // set color of myTextFieldWidth, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setWidth(myTextFieldWidth->getText().text()) == true) { + myTextFieldWidth->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldWidth->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_WIDTH; + } + // set color of myTextFieldFilename, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setFilename(myTextFieldFilename->getText().text()) == true) { + myTextFieldFilename->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldFilename->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_FILE; + } + // set color of myTextFieldImpatience, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setImpatience(myTextFieldImpatience->getText().text()) == true) { + myTextFieldImpatience->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldImpatience->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_IMPATIENCE; + } + // set color of myTextFieldLaneChangeModel, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setLaneChangeModel(myTextFieldLaneChangeModel->getText().text()) == true) { + myTextFieldLaneChangeModel->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldLaneChangeModel->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_LANE_CHANGE_MODEL; + } + // set color of myTextFieldCarFollowModel, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setCarFollowModel(myTextFieldCarFollowModel->getText().text()) == true) { + myTextFieldCarFollowModel->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldCarFollowModel->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_CAR_FOLLOW_MODEL; + } + // set color of myTextFieldPersonCapacity, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setPersonCapacity(myTextFieldPersonCapacity->getText().text()) == true) { + myTextFieldPersonCapacity->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldPersonCapacity->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_PERSON_CAPACITY; + } + // set color of myTextFieldContainerCapacity, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setContainerCapacity(myTextFieldContainerCapacity->getText().text()) == true) { + myTextFieldContainerCapacity->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldContainerCapacity->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_CONTAINER_CAPACITY; + } + // set color of myTextFieldBoardingDuration, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setBoardingDuration(myTextFieldBoardingDuration->getText().text()) == true) { + myTextFieldBoardingDuration->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldBoardingDuration->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_BOARDING_DURATION; + } + // set color of myTextFieldLoadingDuration, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setLoadingDuration(myTextFieldLoadingDuration->getText().text()) == true) { + myTextFieldLoadingDuration->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldLoadingDuration->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_LOADING_DURATION; + } + // set color of myTextFieldLatAlignment, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setLatAlignment(myTextFieldLatAlignment->getText().text()) == true) { + myTextFieldLatAlignment->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldLatAlignment->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_LATALIGNMENT; + } + // set color of myTextFieldMinGapLat, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setMinGapLat(myTextFieldMinGapLat->getText().text()) == true) { + myTextFieldMinGapLat->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldMinGapLat->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_MINGAP_LAT; + } + // set color of myTextFieldVehicleTypeID, depending if current value is valid or not + if (myCopyOfCalibratorVehicleType->setMaxSpeedLat(myTextFieldMaxSpeedLat->getText().text()) == true) { + myTextFieldMaxSpeedLat->setTextColor(FXRGB(0, 0, 0)); + } else { + myTextFieldMaxSpeedLat->setTextColor(FXRGB(255, 0, 0)); + myCalibratorVehicleTypeValid = false; + myInvalidAttr = SUMO_ATTR_MAXSPEED_LAT; + } + return 1; +} + + +void +GNECalibratorVehicleTypeDialog::updateCalibratorVehicleTypeValues() { + //set values of myCopyOfCalibratorVehicleType int fields + myTextFieldVehicleTypeID->setText(myCopyOfCalibratorVehicleType->getVehicleTypeID().c_str()); + myComboBoxVClass->setText(getVehicleClassNames(myCopyOfCalibratorVehicleType->getVClass()).c_str()); + myComboBoxShape->setText(getVehicleShapeName(myCopyOfCalibratorVehicleType->getShape()).c_str()); + myTextFieldAccel->setText(toString(myCopyOfCalibratorVehicleType->getAccel()).c_str()); + myTextFieldDecel->setText(toString(myCopyOfCalibratorVehicleType->getDecel()).c_str()); + myTextFieldSigma->setText(toString(myCopyOfCalibratorVehicleType->getSigma()).c_str()); + myTextFieldTau->setText(toString(myCopyOfCalibratorVehicleType->getTau()).c_str()); + myTextFieldLength->setText(toString(myCopyOfCalibratorVehicleType->getLength()).c_str()); + myTextFieldMinGap->setText(toString(myCopyOfCalibratorVehicleType->getMinGap()).c_str()); + myTextFieldMaxSpeed->setText(toString(myCopyOfCalibratorVehicleType->getMaxSpeed()).c_str()); + myTextFieldSpeedFactor->setText(toString(myCopyOfCalibratorVehicleType->getSpeedFactor()).c_str()); + myTextFieldSpeedDev->setText(toString(myCopyOfCalibratorVehicleType->getSpeedDev()).c_str()); + myTextFieldColor->setText(myCopyOfCalibratorVehicleType->getColor().c_str()); + myTextFieldEmissionClass->setText(myCopyOfCalibratorVehicleType->getEmissionClass().c_str()); + myTextFieldWidth->setText(toString(myCopyOfCalibratorVehicleType->getWidth()).c_str()); + myTextFieldFilename->setText(myCopyOfCalibratorVehicleType->getFilename().c_str()); + myTextFieldImpatience->setText(toString(myCopyOfCalibratorVehicleType->getImpatience()).c_str()); + myTextFieldLaneChangeModel->setText(toString(myCopyOfCalibratorVehicleType->getLaneChangeModel()).c_str()); + myTextFieldCarFollowModel->setText(myCopyOfCalibratorVehicleType->getCarFollowModel().c_str()); + myTextFieldPersonCapacity->setText(toString(myCopyOfCalibratorVehicleType->getPersonCapacity()).c_str()); + myTextFieldContainerCapacity->setText(toString(myCopyOfCalibratorVehicleType->getContainerCapacity()).c_str()); + myTextFieldBoardingDuration->setText(toString(myCopyOfCalibratorVehicleType->getBoardingDuration()).c_str()); + myTextFieldLoadingDuration->setText(toString(myCopyOfCalibratorVehicleType->getLoadingDuration()).c_str()); + myTextFieldLatAlignment->setText(toString(myCopyOfCalibratorVehicleType->getLatAlignment()).c_str()); + myTextFieldMinGapLat->setText(toString(myCopyOfCalibratorVehicleType->getMinGapLat()).c_str()); + myTextFieldMaxSpeedLat->setText(toString(myCopyOfCalibratorVehicleType->getMaxSpeedLat()).c_str()); + // set image labels + setVClassLabelImage(); +} + + +void +GNECalibratorVehicleTypeDialog::setVClassLabelImage() { + // set Icon in label depending of current VClass + switch (myCopyOfCalibratorVehicleType->getVClass()) { + case SVC_PRIVATE: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_PRIVATE)); + break; + case SVC_EMERGENCY: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_EMERGENCY)); + break; + case SVC_AUTHORITY: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_AUTHORITY)); + break; + case SVC_ARMY: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_ARMY)); + break; + case SVC_VIP: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_VIP)); + break; + case SVC_PASSENGER: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_PASSENGER)); + break; + case SVC_HOV: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_HOV)); + break; + case SVC_TAXI: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_TAXI)); + break; + case SVC_BUS: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_BUS)); + break; + case SVC_COACH: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_COACH)); + break; + case SVC_DELIVERY: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_DELIVERY)); + break; + case SVC_TRUCK: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_TRUCK)); + break; + case SVC_TRAILER: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_TRAILER)); + break; + case SVC_TRAM: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_TRAM)); + break; + case SVC_RAIL_URBAN: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_RAIL_URBAN)); + break; + case SVC_RAIL: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_RAIL)); + break; + case SVC_RAIL_ELECTRIC: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_RAIL_ELECTRIC)); + break; + case SVC_MOTORCYCLE: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_MOTORCYCLE)); + break; + case SVC_MOPED: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_MOPED)); + break; + case SVC_BICYCLE: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_BICYCLE)); + break; + case SVC_PEDESTRIAN: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_PEDESTRIAN)); + break; + case SVC_E_VEHICLE: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_EVEHICLE)); + break; + case SVC_SHIP: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_SHIP)); + break; + case SVC_CUSTOM1: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_CUSTOM1)); + break; + case SVC_CUSTOM2: + myComboBoxVClassLabelImage->setIcon(GUIIconSubSys::getIcon(ICON_VCLASS_CUSTOM2)); + break; + default: + throw InvalidArgument("Invalid " + toString(SUMO_ATTR_VCLASS) + " " + toString(myCopyOfCalibratorVehicleType->getVClass())); + break; + } +} + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorVehicleTypeDialog.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorVehicleTypeDialog.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorVehicleTypeDialog.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorVehicleTypeDialog.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,197 @@ +/****************************************************************************/ +/// @file GNECalibratorVehicleTypeDialog.h +/// @author Pablo Alvarez Lopez +/// @date March 2017 +/// @version $Id: GNECalibratorVehicleTypeDialog.h 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// Dialog for edit calibrator vehicleTypes +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNECalibratorVehicleTypeDialog_h +#define GNECalibratorVehicleTypeDialog_h + +// =========================================================================== +// included modules +// =========================================================================== + +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include "GNEAdditionalDialog.h" +#include "GNECalibratorVehicleType.h" + +// =========================================================================== +// class declarations +// =========================================================================== + +class GNECalibratorDialog; + +// =========================================================================== +// class definitions +// =========================================================================== + +/** + * @class GNECalibratorVehicleTypeDialog + * @brief Dialog for edit rerouter intervals + */ + +class GNECalibratorVehicleTypeDialog : public GNEAdditionalDialog { + /// @brief FOX-declaration + FXDECLARE(GNECalibratorVehicleTypeDialog) + +public: + /// @brief constructor + GNECalibratorVehicleTypeDialog(GNECalibratorDialog* calibratorDialog, GNECalibratorVehicleType& calibratorVehicleType, bool updatingElement); + + /// @brief destructor + ~GNECalibratorVehicleTypeDialog(); + + /// @name FOX-callbacks + /// @{ + /// @brief event after press accept button + long onCmdAccept(FXObject*, FXSelector, void*); + + /// @brief event after press cancel button + long onCmdCancel(FXObject*, FXSelector, void*); + + /// @brief event after press reset button + long onCmdReset(FXObject*, FXSelector, void*); + + /// @event after change a variable of vehicle type + long onCmdSetVariable(FXObject*, FXSelector, void*); + /// @} + +protected: + /// @brief FOX needs this + GNECalibratorVehicleTypeDialog() {} + + /// @brief update data fields + void updateCalibratorVehicleTypeValues(); + + /// @brief set VClass texture + void setVClassLabelImage(); + + /// @brief pointer to GNECalibratorDialog parent + GNECalibratorDialog* myCalibratorDialogParent; + + /// @brief pointer to original calibrator vehicle type + GNECalibratorVehicleType* myCalibratorVehicleType; + + /// @brief flag to indicate if flow are being created or modified + bool myUpdatingElement; + + /// @brief pointer in which save modifications of CalibratorVehicleType + GNECalibratorVehicleType* myCopyOfCalibratorVehicleType; + + /// @brief flag to check if current calibrator vehicleType is valid + bool myCalibratorVehicleTypeValid; + + /// @brief current sumo attribute invalid + SumoXMLAttr myInvalidAttr; + + /// @brief FXTextfield for vehicleTypeID + FXTextField* myTextFieldVehicleTypeID; + + /// @brief FXComboBox for VClass + FXComboBox* myComboBoxVClass; + + /// @brief label with image of VClass + FXLabel* myComboBoxVClassLabelImage; + + /// @brief FXComboBox for Shape + FXComboBox* myComboBoxShape; + + /// @brief label with image of Shape + FXLabel* myComboBoxShapeLabelImage; + + /// @brief FXTextfield for Accel + FXTextField* myTextFieldAccel; + + /// @brief FXTextfield for Decel + FXTextField* myTextFieldDecel; + + /// @brief FXTextfield for Sigma + FXTextField* myTextFieldSigma; + + /// @brief FXTextfield for Tau + FXTextField* myTextFieldTau; + + /// @brief FXTextfield for Length + FXTextField* myTextFieldLength; + + /// @brief FXTextfield for MinGap + FXTextField* myTextFieldMinGap; + + /// @brief FXTextfield for MaxSpeed + FXTextField* myTextFieldMaxSpeed; + + /// @brief FXTextfield for SpeedFactor + FXTextField* myTextFieldSpeedFactor; + + /// @brief FXTextfield for SpeedDev + FXTextField* myTextFieldSpeedDev; + + /// @brief FXTextfield for Color + FXTextField* myTextFieldColor; + + /// @brief FXTextfield for EmissionClass + FXTextField* myTextFieldEmissionClass; + + /// @brief FXTextfield for Width + FXTextField* myTextFieldWidth; + + /// @brief FXTextfield for Filename + FXTextField* myTextFieldFilename; + + /// @brief FXTextfield for Impatience + FXTextField* myTextFieldImpatience; + + /// @brief FXTextfield for LaneChangeModel + FXTextField* myTextFieldLaneChangeModel; + + /// @brief FXTextfield for CarFollowModel + FXTextField* myTextFieldCarFollowModel; + + /// @brief FXTextfield for PersonCapacity + FXTextField* myTextFieldPersonCapacity; + + /// @brief FXTextfield for ContainerCapacity + FXTextField* myTextFieldContainerCapacity; + + /// @brief FXTextfield for BoardingDuration + FXTextField* myTextFieldBoardingDuration; + + /// @brief FXTextfield for LoadingDuration + FXTextField* myTextFieldLoadingDuration; + + /// @brief FXTextfield for LatAlignment + FXTextField* myTextFieldLatAlignment; + + /// @brief FXTextfield for MinGapLat + FXTextField* myTextFieldMinGapLat; + + /// @brief FXTextfield for MaxSpeedLat + FXTextField* myTextFieldMaxSpeedLat; + +private: + /// @brief Invalidated copy constructor. + GNECalibratorVehicleTypeDialog(const GNECalibratorVehicleTypeDialog&); + + /// @brief Invalidated assignment operator. + GNECalibratorVehicleTypeDialog& operator=(const GNECalibratorVehicleTypeDialog&); +}; + +#endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorVehicleType.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorVehicleType.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECalibratorVehicleType.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECalibratorVehicleType.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,463 @@ +/****************************************************************************/ +/// @file GNECalibratorVehicleType.h +/// @author Pablo Alvarez Lopez +/// @date Nov 2015 +/// @version $Id: GNECalibratorVehicleType.h 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// VehicleType used by GNECalibrators +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNECalibratorVehicleType_h +#define GNECalibratorVehicleType_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include + +// =========================================================================== +// class declaration +// =========================================================================== + +class GNECalibrator; + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class GNECalibratorVehicleType + * vehicleType vehicleType used by GNECalibrators + */ +class GNECalibratorVehicleType { +public: + /// @brief constructor + GNECalibratorVehicleType(GNECalibrator* calibratorParent); + + /// @brief parameter constructor + GNECalibratorVehicleType(GNECalibrator* calibratorParent, std::string vehicleTypeID, + double accel, double decel, double sigma, double tau, double length, double minGap, + double maxSpeed, double speedFactor, double speedDev, const std::string& color, + SUMOVehicleClass vClass, const std::string& emissionClass, SUMOVehicleShape shape, + double width, const std::string& filename, double impatience, const std::string& laneChangeModel, + const std::string& carFollowModel, int personCapacity, int containerCapacity, double boardingDuration, + double loadingDuration, const std::string& latAlignment, double minGapLat, double maxSpeedLat); + + /// @brief destructor + ~GNECalibratorVehicleType(); + + /// @brief get pointer to calibrator parent + GNECalibrator* getCalibratorParent() const; + + /// @brief get tag + SumoXMLTag getTag() const; + + /// @brief get VehicleTypeID + std::string getVehicleTypeID() const; + + /// @brief get accel + double getAccel() const; + + /// @brief get decel + double getDecel() const; + + /// @brief get sigma + double getSigma() const; + + /// @brief get tau + double getTau() const; + + /// @brief get length + double getLength() const; + + /// @brief get min gap + double getMinGap() const; + + /// @brief get max speed + double getMaxSpeed() const; + + /// @brief get speed factor + double getSpeedFactor() const; + + /// @brief get speed dev + double getSpeedDev() const; + + /// @brief get color + std::string getColor() const; + + /// @brief get VClass + SUMOVehicleClass getVClass() const; + + /// @brief get emission class + std::string getEmissionClass() const; + + /// @brief get shape + SUMOVehicleShape getShape() const; + + /// @brief get width + double getWidth() const; + + /// @brief get filename + std::string getFilename() const; + + /// @brief get impatience + double getImpatience() const; + + /// @brief get lane change model + std::string getLaneChangeModel() const; + + /// @brief get car follow model + std::string getCarFollowModel() const; + + /// @brief get person capacity + int getPersonCapacity() const; + + /// @brief get container capacity + int getContainerCapacity() const; + + /// @brief get boarding duration + double getBoardingDuration() const; + + /// @brief get loading duration + double getLoadingDuration() const; + + /// @brief get lateral lat + std::string getLatAlignment() const; + + /// @brief get min gap lat + double getMinGapLat() const; + + /// @brief get max speed lat + double getMaxSpeedLat() const; + + /**@brief set vehicleType ID + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setVehicleTypeID(std::string vehicleTypeID); + + /**@brief set accel + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setAccel(double accel = 2.6); + + /**@brief set accel (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setAccel(std::string accel); + + /**@brief set decel + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setDecel(double decel = 4.5); + + /**@brief set decel (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setDecel(std::string decel); + + /**@brief set sigma + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setSigma(double sigma = 0.5); + + /**@brief set sigma (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setSigma(std::string sigma); + + /**@brief set tau + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setTau(double tau = 1.0); + + /**@brief set tau (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setTau(std::string tau); + + /**@brief set length + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setLength(double length = 5.0); + + /**@brief set length (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setLength(std::string length); + + /**@brief set min gap + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setMinGap(double minGap = 2.5); + + /**@brief set min gap (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setMinGap(std::string minGap); + + /**@brief set max speed + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setMaxSpeed(double maxSpeed = 70.0); + + /**@brief set max speed (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setMaxSpeed(std::string maxSpeed); + + /**@brief set speed factor + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setSpeedFactor(double speedFactor = 1.0); + + /**@brief set speed factor (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setSpeedFactor(std::string speedFactor); + + /**@brief set speed dev + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setSpeedDev(double speedDev = 0.0); + + /**@brief set speed dev (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setSpeedDev(std::string speedDev); + + /**@brief set color + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setColor(std::string color = "1,1,0"); + + /**@brief set VClass + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setVClass(SUMOVehicleClass vClass = SVC_PRIVATE); + + /**@brief set VClass (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setVClass(std::string vClass); + + /**@brief set emission class + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setEmissionClass(std::string emissionClass = "P_7_7"); + + /**@brief set shape (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setShape(std::string shape); + + /**@brief set shape + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setShape(SUMOVehicleShape shape = SVS_PASSENGER); + + /**@brief set width + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setWidth(double width = 2.0); + + /**@brief set width (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setWidth(std::string width); + + /**@brief set filename + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setFilename(std::string filename = ""); + + /**@brief set impatience + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setImpatience(double impatience = 0.0); + + /**@brief set impatience (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setImpatience(std::string impatience); + + /**@brief set lane change model + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setLaneChangeModel(std::string laneChangeModel = "LC2013"); + + /**@brief set car follow model + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setCarFollowModel(std::string carFollowModel = "Krauss"); + + /**@brief set person capacity + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setPersonCapacity(int personCapacity = 4); + + /**@brief set person capacity (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setPersonCapacity(std::string personCapacity); + + /**@brief set container capacity + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setContainerCapacity(int containerCapacity = 0); + + /**@brief set container capacity (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setContainerCapacity(std::string containerCapacity); + + /**@brief set boarding duration + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setBoardingDuration(double boardingDuration = 0.5); + + /**@brief set boarding duration (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setBoardingDuration(std::string boardingDuration); + + /**@brief set loading duration + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setLoadingDuration(double loadingDuration = 90.0); + + /**@brief set loading duration (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setLoadingDuration(std::string loadingDuration); + + /**@brief set lateral lat + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setLatAlignment(std::string latAlignment = "center"); + + /**@brief set min gap lat + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setMinGapLat(double minGapLat = 0.12); + + /**@brief set min gap lat (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setMinGapLat(std::string minGapLat); + + /**@brief set max speed lat + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setMaxSpeedLat(double maxSpeedLat = 1.0); + + /**@brief set max speed lat (string version) + * @return true if was sucesfully set, or false if value isn't valid + */ + bool setMaxSpeedLat(std::string maxSpeedLat); + + /// @brief overload operator == + bool operator==(const GNECalibratorVehicleType& calibratorVehicleType) const; + +private: + /// @brief pointer to calibrator parent + GNECalibrator* myCalibratorParent; + + /// @brief vehicleType ID + std::string myVehicleTypeID; + + /// @brief The acceleration ability of vehicles of this type (in m/s^2) + double myAccel; + + /// @brief The deceleration ability of vehicles of this type (in m/s^2) + double myDecel; + + /// @brief Car-following model parameter + double mySigma; + + /// @brief Car-following model parameter + double myTau; + + /// @brief The vehicle's netto-length (length) (in m) + double myLength; + + /// @brief Empty space after leader [m] + double myMinGap; + + /// @brief The vehicle's maximum velocity (in m/s) + double myMaxSpeed; + + /// @brief The vehicles expected multiplicator for lane speed limits + double mySpeedFactor; + + /// @brief The deviation of the speedFactor; see below for details + double mySpeedDev; + + /// @brief This vehicle type's color + std::string myColor; + + /// @brief An abstract vehicle class + SUMOVehicleClass myVClass; + + /// @brief An abstract emission class + std::string myEmissionClass; + + /// @brief How this vehicle is rendered + SUMOVehicleShape myShape; + + /// @brief The vehicle's width [m] (only used for drawing) + double myWidth; + + /// @brief Image file for rendering vehicles of this type (should be grayscale to allow functional coloring) + std::string myFilename; + + /// @brief Willingess of drivers to impede vehicles with higher priority. See below for semantics. + double myImpatience; + + /// @brief The model used for changing lanes + std::string myLaneChangeModel; + + /// @brief The model used for car following + std::string myCarFollowModel; + + /// @brief The number of persons (excluding an autonomous driver) the vehicle can transport. + int myPersonCapacity; + + /// @brief The number of containers the vehicle can transport. + int myContainerCapacity; + + /// @brief The time required by a person to board the vehicle. + double myBoardingDuration; + + /// @brief The time required to load a container onto the vehicle. + double myLoadingDuration; + + /// @brief The preferred lateral alignment when using the sublane-model. One of (left, right, center, compact, nice, arbitrary). + std::string myLatAlignment; + + /// @brief The minimum lateral gap at a speed difference of 100km/h when using the sublane-model + double myMinGapLat; + + /// @brief The maximum lateral speed when using the sublane-model + double myMaxSpeedLat; +}; + +#endif +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Additional.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Additional.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Additional.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Additional.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEChange_Additional.cpp /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEChange_Additional.cpp 21150 2016-07-12 12:28:35Z behrisch $ +/// @version $Id: GNEChange_Additional.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// /// A network change in which a busStop is created or deleted /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -27,14 +27,19 @@ #include #endif +#include + #include "GNEChange_Additional.h" #include "GNENet.h" +#include "GNELane.h" +#include "GNEEdge.h" #include "GNEAdditional.h" #include "GNEViewNet.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif +#include "GNEDetectorE3.h" +#include "GNEDetectorEntry.h" +#include "GNEDetectorExit.h" +#include "GNEStoppingPlace.h" +#include "GNERerouter.h" // =========================================================================== @@ -46,11 +51,36 @@ // member method definitions // =========================================================================== -GNEChange_Additional::GNEChange_Additional(GNENet* net, GNEAdditional* additional, bool forward) : - GNEChange(net, forward), - myAdditional(additional) { +GNEChange_Additional::GNEChange_Additional(GNEAdditional* additional, bool forward) : + GNEChange(additional->getViewNet()->getNet(), forward), + myAdditional(additional), + myLaneParent(NULL), + myEdgeParent(NULL), + myE3Parent(NULL) { assert(myNet); myAdditional->incRef("GNEChange_Additional"); + // handle additionals with lane parent + if (myAdditional->getLane() != NULL) { + myLaneParent = myAdditional->getLane(); + } + // handle additionals with edge parent + if (myAdditional->getEdge() != NULL) { + myEdgeParent = myAdditional->getEdge(); + } + // handle additional with childs + if (myAdditional->getTag() == SUMO_TAG_E3DETECTOR) { + GNEDetectorE3* E3 = dynamic_cast(myAdditional); + myEntryChilds = E3->myGNEDetectorEntrys; + myExitChilds = E3->myGNEDetectorExits; + } else if (myAdditional->getTag() == SUMO_TAG_DET_ENTRY) { + myE3Parent = dynamic_cast(myAdditional)->getE3Parent(); + } else if (myAdditional->getTag() == SUMO_TAG_DET_EXIT) { + myE3Parent = dynamic_cast(myAdditional)->getE3Parent(); + } + // handle additional with edge chidls + if (myAdditional->getTag() == SUMO_TAG_REROUTER) { + myEdgeChilds = dynamic_cast(myAdditional)->getEdgeChilds(); + } } @@ -58,42 +88,245 @@ assert(myAdditional); myAdditional->decRef("GNEChange_Additional"); if (myAdditional->unreferenced()) { + // show extra information for tests + if (myNet->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting unreferenced " + toString(myAdditional->getTag()) + " '" + myAdditional->getID() + "'"); + } delete myAdditional; } } -void GNEChange_Additional::undo() { +void +GNEChange_Additional::undo() { if (myForward) { + // show extra information for tests + if (myNet->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting " + toString(myAdditional->getTag()) + " '" + myAdditional->getID() + "'"); + } + // delete additional of test myNet->deleteAdditional(myAdditional); + // 1 - If additional own a lane parent, remove it from lane + if (myAdditional->getLane() != NULL) { + assert(myLaneParent); + myAdditional->getLane()->removeAdditionalChild(myAdditional); + } + // 2 - If additional own a lane parent, remove it from edge + if (myAdditional->getEdge() != NULL) { + assert(myEdgeParent); + myAdditional->getEdge()->removeAdditionalChild(myAdditional); + } + // 3 - If additional is an E3 Detector, delete Entry/Exit childs + if (myAdditional->getTag() == SUMO_TAG_E3DETECTOR) { + for (std::vector::iterator i = myEntryChilds.begin(); i != myEntryChilds.end(); i++) { + // delete entry of their lane parent before remove + (*i)->getLane()->removeAdditionalChild(*i); + myNet->deleteAdditional(*i); + } + for (std::vector::iterator i = myExitChilds.begin(); i != myExitChilds.end(); i++) { + // delete entry of their lane parent before remove + (*i)->getLane()->removeAdditionalChild(*i); + myNet->deleteAdditional(*i); + } + } + // 4 - If additiona is an Entry detector, remove it from E3 parent + if (myAdditional->getTag() == SUMO_TAG_DET_ENTRY) { + assert(myE3Parent); + myE3Parent->removeEntryChild(dynamic_cast(myAdditional)); + myE3Parent->updateGeometry(); + myNet->getViewNet()->update(); + } + // 5 - If additiona is an Exit detector, remove it from E3 parent + if (myAdditional->getTag() == SUMO_TAG_DET_EXIT) { + assert(myE3Parent); + myE3Parent->removeExitChild(dynamic_cast(myAdditional)); + myE3Parent->updateGeometry(); + myNet->getViewNet()->update(); + } + // 6 - if Additional if a rerouter, remove it of all of their edge childs + if (myAdditional->getTag() == SUMO_TAG_REROUTER) { + GNERerouter* rerouter = dynamic_cast(myAdditional); + for (std::vector::iterator i = myEdgeChilds.begin(); i != myEdgeChilds.end(); i++) { + (*i)->removeGNERerouter(rerouter); + } + } } else { + // show extra information for tests + if (myNet->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Inserting " + toString(myAdditional->getTag()) + " '" + myAdditional->getID() + "'"); + } + // insert additional of test myNet->insertAdditional(myAdditional); + // 1 - If additional own a Lane parent, add it to lane + if (myAdditional->getLane() != NULL) { + assert(myLaneParent); + myAdditional->getLane()->addAdditionalChild(myAdditional); + } + // 2 - If additional own a lane parent, add it to edge + if (myAdditional->getEdge() != NULL) { + assert(myEdgeParent); + myAdditional->getEdge()->addAdditionalChild(myAdditional); + } + // 3 - If additional is an E3 detector, add it their Entry/Exit childs + if (myAdditional->getTag() == SUMO_TAG_E3DETECTOR) { + for (std::vector::iterator i = myEntryChilds.begin(); i != myEntryChilds.end(); i++) { + // add entry of their lane parent before insert + (*i)->getLane()->addAdditionalChild(*i); + myNet->insertAdditional(*i); + } + for (std::vector::iterator i = myExitChilds.begin(); i != myExitChilds.end(); i++) { + // add entry of their lane parent before insert + (*i)->getLane()->addAdditionalChild(*i); + myNet->insertAdditional(*i); + } + } + // 4 - If additional is an Exit detector, add id to E3 parent + if (myAdditional->getTag() == SUMO_TAG_DET_ENTRY) { + assert(myE3Parent); + myE3Parent->addEntryChild(dynamic_cast(myAdditional)); + myE3Parent->updateGeometry(); + myNet->getViewNet()->update(); + } + // 5 - If additional is an Exit detector, add id to E3 parent + if (myAdditional->getTag() == SUMO_TAG_DET_EXIT) { + assert(myE3Parent); + myE3Parent->addExitChild(dynamic_cast(myAdditional)); + myE3Parent->updateGeometry(); + myNet->getViewNet()->update(); + } + // 6 - if Additional if a rerouter, add it of all of their edge childs + if (myAdditional->getTag() == SUMO_TAG_REROUTER) { + GNERerouter* rerouter = dynamic_cast(myAdditional); + for (std::vector::iterator i = myEdgeChilds.begin(); i != myEdgeChilds.end(); i++) { + (*i)->addGNERerouter(rerouter); + } + } } } -void GNEChange_Additional::redo() { +void +GNEChange_Additional::redo() { if (myForward) { + // show extra information for tests + if (myNet->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Inserting " + toString(myAdditional->getTag()) + " '" + myAdditional->getID() + "'"); + } + // insert additional into net myNet->insertAdditional(myAdditional); + // 1 - If additional own a Lane parent, add it to lane + if (myAdditional->getLane() != NULL) { + assert(myLaneParent); + myAdditional->getLane()->addAdditionalChild(myAdditional); + } + // 2 - If additional own a lane parent, add it to edge + if (myAdditional->getEdge() != NULL) { + assert(myEdgeParent); + myAdditional->getEdge()->addAdditionalChild(myAdditional); + } + // 3 - If additional is an E3 detector, add it their Entry/Exit childs + if (myAdditional->getTag() == SUMO_TAG_E3DETECTOR) { + for (std::vector::iterator i = myEntryChilds.begin(); i != myEntryChilds.end(); i++) { + // add entry of their lane parent before insert + (*i)->getLane()->addAdditionalChild(*i); + myNet->insertAdditional(*i); + } + for (std::vector::iterator i = myExitChilds.begin(); i != myExitChilds.end(); i++) { + // add entry of their lane parent before insert + (*i)->getLane()->addAdditionalChild(*i); + myNet->insertAdditional(*i); + } + } + // 4 - If additional is an Entry detector, add id to E3 parent + if (myAdditional->getTag() == SUMO_TAG_DET_ENTRY) { + assert(myE3Parent); + myE3Parent->addEntryChild(dynamic_cast(myAdditional)); + myE3Parent->updateGeometry(); + myNet->getViewNet()->update(); + } + // 5 - If additional is an Exit detector, add id to E3 parent + if (myAdditional->getTag() == SUMO_TAG_DET_EXIT) { + assert(myE3Parent); + myE3Parent->addExitChild(dynamic_cast(myAdditional)); + myE3Parent->updateGeometry(); + myNet->getViewNet()->update(); + } + // 6 - if Additional if a rerouter, add it of all of their edge childs + if (myAdditional->getTag() == SUMO_TAG_REROUTER) { + GNERerouter* rerouter = dynamic_cast(myAdditional); + for (std::vector::iterator i = myEdgeChilds.begin(); i != myEdgeChilds.end(); i++) { + (*i)->addGNERerouter(rerouter); + } + } } else { + // show extra information for tests + if (myNet->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting " + toString(myAdditional->getTag()) + " '" + myAdditional->getID() + "'"); + } myNet->deleteAdditional(myAdditional); + // 1 - If additionl own a Lane Parent, remove it from lane + if (myAdditional->getLane() != NULL) { + assert(myLaneParent); + myAdditional->getLane()->removeAdditionalChild(myAdditional); + } + // 2 - If additional own a lane parent, remove it from lane + if (myAdditional->getEdge() != NULL) { + assert(myEdgeParent); + myAdditional->getEdge()->removeAdditionalChild(myAdditional); + } + // 3 - If additional is an E3 Detector, delete Entry/Exit childs + if (myAdditional->getTag() == SUMO_TAG_E3DETECTOR) { + for (std::vector::iterator i = myEntryChilds.begin(); i != myEntryChilds.end(); i++) { + // delete entry of their lane parent before remove + (*i)->getLane()->removeAdditionalChild(*i); + myNet->deleteAdditional(*i); + } + for (std::vector::iterator i = myExitChilds.begin(); i != myExitChilds.end(); i++) { + // delete entry of their lane parent before remove + (*i)->getLane()->removeAdditionalChild(*i); + myNet->deleteAdditional(*i); + } + } + // 4 - If additiona is an Entry detector, remove it from E3 parent + if (myAdditional->getTag() == SUMO_TAG_DET_ENTRY) { + assert(myE3Parent); + myE3Parent->removeEntryChild(dynamic_cast(myAdditional)); + myE3Parent->updateGeometry(); + myNet->getViewNet()->update(); + } + // 5 - If additiona is an Exit detector, remove it from E3 parent + if (myAdditional->getTag() == SUMO_TAG_DET_EXIT) { + assert(myE3Parent); + myE3Parent->removeExitChild(dynamic_cast(myAdditional)); + myE3Parent->updateGeometry(); + myNet->getViewNet()->update(); + } + // 6 - if Additional if a rerouter, remove it of all of their edge childs + if (myAdditional->getTag() == SUMO_TAG_REROUTER) { + GNERerouter* rerouter = dynamic_cast(myAdditional); + for (std::vector::iterator i = myEdgeChilds.begin(); i != myEdgeChilds.end(); i++) { + (*i)->removeGNERerouter(rerouter); + } + } } } -FXString GNEChange_Additional::undoName() const { +FXString +GNEChange_Additional::undoName() const { if (myForward) { - return ("Undo create additional"); + return ("Undo create " + toString(myAdditional->getTag())).c_str(); } else { - return ("Undo delete additional"); + return ("Undo delete " + toString(myAdditional->getTag())).c_str(); } } -FXString GNEChange_Additional::redoName() const { +FXString +GNEChange_Additional::redoName() const { if (myForward) { - return ("Redo create additional"); + return ("Redo create " + toString(myAdditional->getTag())).c_str(); } else { - return ("Redo delete additional"); + return ("Redo delete " + toString(myAdditional->getTag())).c_str(); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Additional.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Additional.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Additional.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Additional.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEChange_Additional.h /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEChange_Additional.h 21150 2016-07-12 12:28:35Z behrisch $ +/// @version $Id: GNEChange_Additional.h 24049 2017-04-24 15:15:07Z palcraft $ /// /// A network change in which a additional element is created or deleted /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,6 +39,11 @@ // =========================================================================== class GNEAdditional; class GNEViewNet; +class GNEDetectorEntry; +class GNEDetectorExit; +class GNEDetectorE3; +class GNELane; +class GNEEdge; // =========================================================================== // class definitions @@ -52,11 +57,10 @@ public: /**@brief Constructor for creating/deleting an additional element - * @param[in] net The net on which to apply changes * @param[in] additional The additional element to be created/deleted * @param[in] forward Whether to create/delete (true/false) */ - GNEChange_Additional(GNENet* net, GNEAdditional* additional, bool forward); + GNEChange_Additional(GNEAdditional* additional, bool forward); /// @brief Destructor ~GNEChange_Additional(); @@ -77,8 +81,28 @@ /// @} private: - /// @brief full information regarding the additional element that is to be created/deleted + /**@brief full information regarding the additional element that is to be created/deleted + * @note we assume shared responsibility for the pointer (via reference counting) + */ GNEAdditional* myAdditional; + + /// @brief pointer to lane (used by additionals with lane parent) + GNELane* myLaneParent; + + /// @brief pointer to edge (used by additionals with edge parent) + GNEEdge* myEdgeParent; + + /// @brief pointer to E3 parent (used by Entry/exits) + GNEDetectorE3* myE3Parent; + + /// @brief list of Entry detectors child (used by E3 Detector) + std::vector myEntryChilds; + + /// @brief list of Exit detectors child used (used by E3 Detector) + std::vector myExitChilds; + + /// @brief list of Edge childs (used by Rerouters) + std::vector myEdgeChilds; }; #endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Attribute.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Attribute.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Attribute.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Attribute.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEChange_Attribute.cpp /// @author Jakob Erdmann /// @date Mar 2011 -/// @version $Id: GNEChange_Attribute.cpp 20975 2016-06-15 13:02:40Z palcraft $ +/// @version $Id: GNEChange_Attribute.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A network change in which something is moved (for undo/redo) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,10 +31,6 @@ #include "GNEChange_Attribute.h" #include "GNEAttributeCarrier.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif - // =========================================================================== // FOX-declarations @@ -46,10 +42,8 @@ // =========================================================================== GNEChange_Attribute::GNEChange_Attribute(GNEAttributeCarrier* ac, - SumoXMLAttr key, - const std::string& value, - bool customOrigValue, - const std::string& origValue) : + SumoXMLAttr key, const std::string& value, + bool customOrigValue, const std::string& origValue) : GNEChange(0, true), myAC(ac), myKey(key), @@ -96,3 +90,6 @@ GNEChange_Attribute::redoName() const { return ("Redo change " + myAC->getDescription() + " attribute").c_str(); } + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Attribute.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Attribute.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Attribute.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Attribute.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEChange_Attribute.h /// @author Jakob Erdmann /// @date Mar 2011 -/// @version $Id: GNEChange_Attribute.h 20975 2016-06-15 13:02:40Z palcraft $ +/// @version $Id: GNEChange_Attribute.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A network change in which the attribute of some object is modified /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,7 +55,6 @@ * @param[in] ac The attribute-carrier to be modified * @param[in] key The attribute key * @param[in] value The new value - * @param[in] net Optionally the net on which to apply changes */ GNEChange_Attribute(GNEAttributeCarrier* ac, const SumoXMLAttr key, @@ -87,7 +86,7 @@ private: /**@brief the net to which all operations shall be applied - * (we are not responsible for the pointer) + * @note we are not responsible for the pointer */ GNEAttributeCarrier* myAC; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Connection.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Connection.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Connection.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Connection.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEChange_Connection.cpp /// @author Jakob Erdmann /// @date May 2011 -/// @version $Id: GNEChange_Connection.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEChange_Connection.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A network change in which a single connection is created or deleted /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -27,14 +27,14 @@ #include #endif +#include #include + #include "GNEChange_Connection.h" #include "GNEConnection.h" #include "GNEEdge.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif +#include "GNENet.h" +#include "GNEViewNet.h" // =========================================================================== @@ -48,52 +48,74 @@ GNEChange_Connection::GNEChange_Connection(GNEEdge* edge, NBEdge::Connection nbCon, bool forward) : - GNEChange(0, forward), + GNEChange(edge->getNet(), forward), myEdge(edge), myNBEdgeConnection(nbCon), myConnection(myEdge->retrieveConnection(nbCon.fromLane, nbCon.toEdge, nbCon.toLane)) { assert(myEdge); - //myEdge->incRef("GNEChange_Connection"); } GNEChange_Connection::~GNEChange_Connection() { assert(myEdge); - //myEdge->decRef("GNEChange_Connection"); } -void GNEChange_Connection::undo() { +void +GNEChange_Connection::undo() { if (myForward) { + // show extra information for tests + if (myEdge->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting " + toString(myConnection->getTag()) + " '" + myConnection->getID() + "'"); + } + // remove connection from edge myEdge->removeConnection(myNBEdgeConnection); } else { + // show extra information for tests + if (myEdge->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting " + toString(myConnection->getTag()) + " '" + myConnection->getID() + "'"); + } + // add connection into edge myEdge->addConnection(myNBEdgeConnection, myConnection); } } -void GNEChange_Connection::redo() { +void +GNEChange_Connection::redo() { if (myForward) { + // show extra information for tests + if (myEdge->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting " + toString(myConnection->getTag()) + " '" + myConnection->getID() + "'"); + } + // add connection into edge myEdge->addConnection(myNBEdgeConnection, myConnection); } else { + // show extra information for tests + if (myEdge->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting " + toString(myConnection->getTag()) + " '" + myConnection->getID() + "'"); + } + // remove connection from edge myEdge->removeConnection(myNBEdgeConnection); } } -FXString GNEChange_Connection::undoName() const { +FXString +GNEChange_Connection::undoName() const { if (myForward) { - return ("Undo create connection"); + return ("Undo create " + toString(SUMO_TAG_CONNECTION)).c_str(); } else { - return ("Undo delete connection"); + return ("Undo delete " + toString(SUMO_TAG_CONNECTION)).c_str(); } } -FXString GNEChange_Connection::redoName() const { +FXString +GNEChange_Connection::redoName() const { if (myForward) { - return ("Redo create connection"); + return ("Redo create " + toString(SUMO_TAG_CONNECTION)).c_str(); } else { - return ("Redo delete connection"); + return ("Redo delete " + toString(SUMO_TAG_CONNECTION)).c_str(); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Connection.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Connection.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Connection.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Connection.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEChange_Connection.h /// @author Jakob Erdmann /// @date May 2011 -/// @version $Id: GNEChange_Connection.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEChange_Connection.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A network change in which a single connection is created or deleted /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,13 +2,13 @@ /// @file GNEChange.cpp /// @author Jakob Erdmann /// @date Mar 2011 -/// @version $Id: GNEChange.cpp 21320 2016-08-23 11:11:18Z behrisch $ +/// @version $Id: GNEChange.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The reification of a NETEDIT editing operation (see command pattern) // inherits from FXCommand and is used to for undo/redo /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,10 +31,6 @@ #include "GNEChange.h" #include "GNENet.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif - // =========================================================================== // FOX-declarations diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Crossing.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Crossing.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Crossing.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Crossing.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,130 @@ +/****************************************************************************/ +/// @file GNEChange_Crossing.cpp +/// @author Pablo Alvarez Lopez +/// @date Oct 2016 +/// @version $Id: GNEChange_Crossing.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +// A network change in which a single junction is created or deleted +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include + +#include "GNEChange_Crossing.h" +#include "GNENet.h" +#include "GNEViewNet.h" +#include "GNECrossing.h" +#include "GNEJunction.h" + + +// =========================================================================== +// FOX-declarations +// =========================================================================== +FXIMPLEMENT_ABSTRACT(GNEChange_Crossing, GNEChange, NULL, 0) + +// =========================================================================== +// member method definitions +// =========================================================================== + + +/// @brief constructor for creating an crossing +GNEChange_Crossing::GNEChange_Crossing(GNEJunction* junctionParent, const std::vector& edges, double width, bool priority, bool forward): + GNEChange(junctionParent->getNet(), forward), + myJunctionParent(junctionParent), + myEdges(edges), + myWidth(width), + myPriority(priority) { + assert(myNet); +} + + +GNEChange_Crossing::~GNEChange_Crossing() {} + + +void GNEChange_Crossing::undo() { + if (myForward) { + // show extra information for tests + if (myJunctionParent->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting " + toString(SUMO_TAG_CROSSING) + " from '" + myJunctionParent->getID() + "'"); + } + // remove crossing of NBNode and update geometry + myJunctionParent->getNBNode()->removeCrossing(myEdges); + myJunctionParent->updateGeometry(); + // Update view + myNet->getViewNet()->update(); + } else { + // show extra information for tests + if (myJunctionParent->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting " + toString(SUMO_TAG_CROSSING) + " from '" + myJunctionParent->getID() + "'"); + } + // add crossing of NBNode and update geometry + myJunctionParent->getNBNode()->addCrossing(myEdges, myWidth, myPriority); + myJunctionParent->updateGeometry(); + // Update view + myNet->getViewNet()->update(); + } +} + + +void GNEChange_Crossing::redo() { + if (myForward) { + // show extra information for tests + if (myJunctionParent->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting " + toString(SUMO_TAG_CROSSING) + " from '" + myJunctionParent->getID() + "'"); + } + // add crossing of NBNode and update geometry + myJunctionParent->getNBNode()->addCrossing(myEdges, myWidth, myPriority); + myJunctionParent->updateGeometry(); + // Update view + myNet->getViewNet()->update(); + } else { + // show extra information for tests + if (myJunctionParent->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting " + toString(SUMO_TAG_CROSSING) + " from '" + myJunctionParent->getID() + "'"); + } + // remove crossing of NBNode and update geometry + myJunctionParent->getNBNode()->removeCrossing(myEdges); + myJunctionParent->updateGeometry(); + // Update view + myNet->getViewNet()->update(); + } +} + + +FXString +GNEChange_Crossing::undoName() const { + if (myForward) { + return ("Undo create " + toString(SUMO_TAG_CROSSING)).c_str(); + } else { + return ("Undo delete " + toString(SUMO_TAG_CROSSING)).c_str(); + } +} + + +FXString +GNEChange_Crossing::redoName() const { + if (myForward) { + return ("Redo create " + toString(SUMO_TAG_CROSSING)).c_str(); + } else { + return ("Redo delete " + toString(SUMO_TAG_CROSSING)).c_str(); + } +} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Crossing.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Crossing.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Crossing.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Crossing.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,100 @@ +/****************************************************************************/ +/// @file GNEChange_Crossing.h +/// @author Pablo Alvarez Lopez +/// @date Oct 2016 +/// @version $Id: GNEChange_Crossing.h 23150 2017-02-27 12:08:30Z behrisch $ +/// +// A network change in which a single crossing is created or deleted +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNEChange_Crossing_h +#define GNEChange_Crossing_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include "GNEChange.h" + +// =========================================================================== +// class declarations +// =========================================================================== +class GNENet; +class GNEJunction; +class NBEdge; + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class GNEChange_Crossing + * A network change in which a single crossing is created or deleted + */ +class GNEChange_Crossing : public GNEChange { + // @brief FOX Declaration + FXDECLARE_ABSTRACT(GNEChange_Crossing) + +public: + /**@brief Constructor for creating/deleting an crossing + * @param[in] JunctionParent GNEJunction in which the crossing will be created/deleted + * @param[in] edges vector of edges of crossing + * @param[in] width value with the width of crossing + * @param[in] priority boolean with the priority of crossing + * @param[in] forward Whether to create/delete (true/false) + */ + GNEChange_Crossing(GNEJunction* junctionParent, const std::vector& edges, double width, bool priority, bool forward); + + /// @brief Destructor + ~GNEChange_Crossing(); + + /// @name inherited from GNEChange + /// @{ + /// @brief get undo Name + FXString undoName() const; + + /// @brief get Redo name + FXString redoName() const; + + /// @brief undo action + void undo(); + + /// @brief redo action + void redo(); + /// @} + +private: + /// @brief full information regarding the Junction in which GNECRossing is created + GNEJunction* myJunctionParent; + + /// @brief vector to save all edges of GNECrossing + std::vector myEdges; + + /// @brief width of GNECrossing + double myWidth; + + /// @brief priority of GNECrossing + bool myPriority; +}; + +#endif +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Edge.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Edge.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Edge.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Edge.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEChange_Edge.cpp /// @author Jakob Erdmann /// @date Mar 2011 -/// @version $Id: GNEChange_Edge.cpp 21640 2016-10-09 20:28:52Z palcraft $ +/// @version $Id: GNEChange_Edge.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A network change in which a single junction is created or deleted /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -27,15 +27,14 @@ #include #endif +#include + #include "GNEChange_Edge.h" #include "GNENet.h" #include "GNEEdge.h" #include "GNELane.h" -#include "GNEAdditionalSet.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif +#include "GNERerouter.h" +#include "GNEViewNet.h" // =========================================================================== @@ -48,21 +47,16 @@ // =========================================================================== -// Constructor for creating an edge -GNEChange_Edge::GNEChange_Edge(GNENet* net, GNEEdge* edge, bool forward): - GNEChange(net, forward), +/// @brief constructor for creating an edge +GNEChange_Edge::GNEChange_Edge(GNEEdge* edge, bool forward): + GNEChange(edge->getNet(), forward), myEdge(edge) { assert(myNet); edge->incRef("GNEChange_Edge"); // Save additionals of edge myAdditionalChilds = myEdge->getAdditionalChilds(); - myAdditionalSetParents = myEdge->getAdditionalSets(); - // Iterate over lanes vinculated to edge - for (std::vector::const_iterator i = myEdge->getLanes().begin(); i != myEdge->getLanes().end(); i++) { - // Save additionals vinculated to lane - myAdditionalLanes[*i] = (*i)->getAdditionalChilds(); - myAdditionalSetsLanes[*i] = (*i)->getAdditionalSetParents(); - } + // save rerouters of edge + myGNERerouters = myEdge->getGNERerouters(); } @@ -70,142 +64,102 @@ assert(myEdge); myEdge->decRef("GNEChange_Edge"); if (myEdge->unreferenced()) { + // show extra information for tests + if (myEdge->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting unreferenced " + toString(myEdge->getTag()) + " '" + myEdge->getID() + "'"); + } delete myEdge; } } -void GNEChange_Edge::undo() { +void +GNEChange_Edge::undo() { if (myForward) { + // show extra information for tests + if (myEdge->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting " + toString(myEdge->getTag()) + " '" + myEdge->getID() + "'"); + } + // delete edge from net myNet->deleteSingleEdge(myEdge); - // 1 - Remove additional sets vinculated with this edge of net + // 1 - Remove additionals childs of this edge for (std::vector::iterator i = myAdditionalChilds.begin(); i != myAdditionalChilds.end(); i++) { myNet->deleteAdditional(*i); } - // 2 - Remove references to this edge in their AdditionalSets - for (std::vector::iterator i = myAdditionalSetParents.begin(); i != myAdditionalSetParents.end(); i++) { + // 2 - Remove references to this edge in GNERerouters + for (std::vector::iterator i = myGNERerouters.begin(); i != myGNERerouters.end(); i++) { (*i)->removeEdgeChild(myEdge); - // Remove additional from net if the number of childs is >= 0 - if ((*i)->getNumberOfEdgeChilds() == 0) { - myNet->deleteAdditional(*i); - } - } - // 3 - Remove of the net all additional child of the lanes of edge - for (std::map >::iterator i = myAdditionalLanes.begin(); i != myAdditionalLanes.end(); i++) { - for (std::vector::iterator j = i->second.begin(); j != i->second.end(); j++) { - myNet->deleteAdditional(*j); - } - } - // 4 - Remove references to every lane of edge in their additionalSets - for (std::map >::iterator i = myAdditionalSetsLanes.begin(); i != myAdditionalSetsLanes.end(); i++) { - for (std::vector::iterator j = i->second.begin(); j != i->second.end(); j++) { - (*j)->removeLaneChild(i->first); - // Remove additional from net if the number of childs is >= 0 - if ((*j)->getNumberOfLaneChilds() == 0) { - myNet->deleteAdditional(*j); - } - } } } else { + // show extra information for tests + if (myEdge->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Adding " + toString(myEdge->getTag()) + " '" + myEdge->getID() + "'"); + } + // insert edge into net myNet->insertEdge(myEdge); - // 1 - add additional sets vinculated with this edge to the net + // 1 - add additionals childs of this edge for (std::vector::iterator i = myAdditionalChilds.begin(); i != myAdditionalChilds.end(); i++) { myNet->insertAdditional(*i); } - // 2 - Add references to this edge in their AdditionalSets - for (std::vector::iterator i = myAdditionalSetParents.begin(); i != myAdditionalSetParents.end(); i++) { - myNet->insertAdditional(*i, false); + // 2 - Add references to this edge in GNERerouters + for (std::vector::iterator i = myGNERerouters.begin(); i != myGNERerouters.end(); i++) { (*i)->addEdgeChild(myEdge); } - // 3 - add in the net all additional child of the lanes of edge - for (std::map >::iterator i = myAdditionalLanes.begin(); i != myAdditionalLanes.end(); i++) { - for (std::vector::iterator j = i->second.begin(); j != i->second.end(); j++) { - myNet->insertAdditional(*j); - } - } - // 4 - Add references to every lane of edge in their additionalSets - for (std::map >::iterator i = myAdditionalSetsLanes.begin(); i != myAdditionalSetsLanes.end(); i++) { - for (std::vector::iterator j = i->second.begin(); j != i->second.end(); j++) { - myNet->insertAdditional(*j, false); - (*j)->addLaneChild(i->first); - } - } } } -void GNEChange_Edge::redo() { +void +GNEChange_Edge::redo() { if (myForward) { + // show extra information for tests + if (myEdge->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Adding " + toString(myEdge->getTag()) + " '" + myEdge->getID() + "'"); + } + // insert edge into net myNet->insertEdge(myEdge); - // 1 - Add additional sets vinculated with this edge to the net + // 1 - Add additionals childs of this edge for (std::vector::iterator i = myAdditionalChilds.begin(); i != myAdditionalChilds.end(); i++) { myNet->insertAdditional(*i); } - // 2 - Add references to this edge in their AdditionalSets - for (std::vector::iterator i = myAdditionalSetParents.begin(); i != myAdditionalSetParents.end(); i++) { - myNet->insertAdditional(*i, false); + // 2 - Add references to this edge in GNERerouters + for (std::vector::iterator i = myGNERerouters.begin(); i != myGNERerouters.end(); i++) { (*i)->addEdgeChild(myEdge); } - // 3 - Add in the net all additional child of the lanes of edge - for (std::map >::iterator i = myAdditionalLanes.begin(); i != myAdditionalLanes.end(); i++) { - for (std::vector::iterator j = i->second.begin(); j != i->second.end(); j++) { - myNet->insertAdditional(*j); - } - } - // 4 - Add references to every lane of edge in their additionalSets - for (std::map >::iterator i = myAdditionalSetsLanes.begin(); i != myAdditionalSetsLanes.end(); i++) { - for (std::vector::iterator j = i->second.begin(); j != i->second.end(); j++) { - myNet->insertAdditional(*j, false); - (*j)->addLaneChild(i->first); - } - } } else { + // show extra information for tests + if (myEdge->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting " + toString(myEdge->getTag()) + " '" + myEdge->getID() + "'"); + } + // delte edge from net myNet->deleteSingleEdge(myEdge); - // 1 - Remove additional sets vinculated with this edge of net + // 1 - Remove additionals childs of this edge for (std::vector::iterator i = myAdditionalChilds.begin(); i != myAdditionalChilds.end(); i++) { myNet->deleteAdditional(*i); } - // 2 - Remove references to this edge in their AdditionalSets - for (std::vector::iterator i = myAdditionalSetParents.begin(); i != myAdditionalSetParents.end(); i++) { + // 2 - Remove references to this edge in GNERerouters + for (std::vector::iterator i = myGNERerouters.begin(); i != myGNERerouters.end(); i++) { (*i)->removeEdgeChild(myEdge); - // Remove additional from net if the number of childs is >= 0 - if ((*i)->getNumberOfEdgeChilds() == 0) { - myNet->deleteAdditional(*i); - } - } - // 3 - Remove of the net all additional child of the lanes of edge - for (std::map >::iterator i = myAdditionalLanes.begin(); i != myAdditionalLanes.end(); i++) { - for (std::vector::iterator j = i->second.begin(); j != i->second.end(); j++) { - myNet->deleteAdditional(*j); - } - } - // 4 - Remove references to every lane of edge in their additionalSets - for (std::map >::iterator i = myAdditionalSetsLanes.begin(); i != myAdditionalSetsLanes.end(); i++) { - for (std::vector::iterator j = i->second.begin(); j != i->second.end(); j++) { - (*j)->removeLaneChild(i->first); - // Remove if from net if the number of childs is >= 0 - if ((*j)->getNumberOfLaneChilds() == 0) { - myNet->deleteAdditional(*j); - } - } } } } -FXString GNEChange_Edge::undoName() const { +FXString +GNEChange_Edge::undoName() const { if (myForward) { - return ("Undo create edge"); + return ("Undo create " + toString(SUMO_TAG_EDGE)).c_str(); } else { - return ("Undo delete edge"); + return ("Undo delete " + toString(SUMO_TAG_EDGE)).c_str(); } } -FXString GNEChange_Edge::redoName() const { +FXString +GNEChange_Edge::redoName() const { if (myForward) { - return ("Redo create edge"); + return ("Redo create " + toString(SUMO_TAG_EDGE)).c_str(); } else { - return ("Redo delete edge"); + return ("Redo delete " + toString(SUMO_TAG_EDGE)).c_str(); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Edge.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Edge.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Edge.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Edge.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEChange_Edge.h /// @author Jakob Erdmann /// @date Mar 2011 -/// @version $Id: GNEChange_Edge.h 21640 2016-10-09 20:28:52Z palcraft $ +/// @version $Id: GNEChange_Edge.h 24049 2017-04-24 15:15:07Z palcraft $ /// // A network change in which a single edge is created or deleted /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,7 +43,7 @@ class GNEEdge; class GNELane; class GNEAdditional; -class GNEAdditionalSet; +class GNERerouter; // =========================================================================== // class definitions @@ -58,11 +58,10 @@ public: /**@brief Constructor for creating/deleting an edge - * @param[in] net The net on which to apply changes * @param[in] edge The edge to be created/deleted * @param[in] forward Whether to create/delete (true/false) */ - GNEChange_Edge(GNENet* net, GNEEdge* edge, bool forward); + GNEChange_Edge(GNEEdge* edge, bool forward); /// @brief Destructor ~GNEChange_Edge(); @@ -92,14 +91,14 @@ /// @brief we need to preserve the list of additionals vinculated with this edge std::vector myAdditionalChilds; - /// @brief we need to preserve the list of additional sets in which this edge is a child - std::vector myAdditionalSetParents; + /// @brief we need to preserve the list of rerouters in which this edge is a child + std::vector myGNERerouters; /// @brief we need to preserve additional vinculated with the lanes of edge std::map > myAdditionalLanes; /// @brief we need to preserve the additional sets in which the edge of lanes are childs - std::map > myAdditionalSetsLanes; + std::map > myAdditionalsLanes; }; #endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,13 +2,13 @@ /// @file GNEChange.h /// @author Jakob Erdmann /// @date Mar 2011 -/// @version $Id: GNEChange.h 20975 2016-06-15 13:02:40Z palcraft $ +/// @version $Id: GNEChange.h 22608 2017-01-17 06:28:54Z behrisch $ /// // The reification of a NETEDIT editing operation (see command pattern) // inherits from FXCommand and is used to for undo/redo /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -51,7 +51,7 @@ public: /**@brief Constructor - * @param[in] net The net on which to apply changes + * @param[in] net GNENet net on which to apply changes * @param[in] forward The direction of this change */ GNEChange(GNENet* net, bool forward); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Junction.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Junction.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Junction.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Junction.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,15 +2,12 @@ /// @file GNEChange_Junction.cpp /// @author Jakob Erdmann /// @date Mar 2011 -/// @version $Id: GNEChange_Junction.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GNEChange_Junction.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A network change in which a single junction is created or deleted /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ -// Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -30,13 +27,12 @@ #include #endif +#include + #include "GNEChange_Junction.h" #include "GNENet.h" #include "GNEJunction.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif +#include "GNEViewNet.h" // =========================================================================== @@ -49,9 +45,9 @@ // =========================================================================== -// Constructor for creating a junction -GNEChange_Junction::GNEChange_Junction(GNENet* net, GNEJunction* junction, bool forward): - GNEChange(net, forward), +/// @brief constructor for creating a junction +GNEChange_Junction::GNEChange_Junction(GNEJunction* junction, bool forward): + GNEChange(junction->getNet(), forward), myJunction(junction) { assert(myNet); junction->incRef("GNEChange_Junction"); @@ -62,42 +58,70 @@ assert(myJunction); myJunction->decRef("GNEChange_Junction"); if (myJunction->unreferenced()) { + // show extra information for tests + if (myJunction->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting unreferenced " + toString(myJunction->getTag()) + " '" + myJunction->getID() + "'"); + } delete myJunction; } } -void GNEChange_Junction::undo() { +void +GNEChange_Junction::undo() { if (myForward) { + // show extra information for tests + if (myJunction->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting " + toString(myJunction->getTag()) + " '" + myJunction->getID() + "'"); + } + // add junction to net myNet->deleteSingleJunction(myJunction); } else { + // show extra information for tests + if (myJunction->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Adding " + toString(myJunction->getTag()) + " '" + myJunction->getID() + "'"); + } + // delete junction from net myNet->insertJunction(myJunction); } } -void GNEChange_Junction::redo() { +void +GNEChange_Junction::redo() { if (myForward) { + // show extra information for tests + if (myJunction->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Adding " + toString(myJunction->getTag()) + " '" + myJunction->getID() + "'"); + } + // add junction into net myNet->insertJunction(myJunction); } else { + // show extra information for tests + if (myJunction->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting " + toString(myJunction->getTag()) + " '" + myJunction->getID() + "'"); + } + // delete junction from net myNet->deleteSingleJunction(myJunction); } } -FXString GNEChange_Junction::undoName() const { +FXString +GNEChange_Junction::undoName() const { if (myForward) { - return ("Undo create junction"); + return ("Undo create " + toString(SUMO_TAG_JUNCTION)).c_str(); } else { - return ("Undo delete junction"); + return ("Undo delete " + toString(SUMO_TAG_JUNCTION)).c_str(); } } -FXString GNEChange_Junction::redoName() const { +FXString +GNEChange_Junction::redoName() const { if (myForward) { - return ("Redo create junction"); + return ("Redo create " + toString(SUMO_TAG_JUNCTION)).c_str(); } else { - return ("Redo delete junction"); + return ("Redo delete " + toString(SUMO_TAG_JUNCTION)).c_str(); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Junction.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Junction.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Junction.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Junction.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEChange_Junction.h /// @author Jakob Erdmann /// @date Mar 2011 -/// @version $Id: GNEChange_Junction.h 20975 2016-06-15 13:02:40Z palcraft $ +/// @version $Id: GNEChange_Junction.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A network change in which a single junction is created or deleted /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -52,11 +52,10 @@ public: /**@brief Constructor for creating/deleting a junction - * @param[in] net The net on which to apply changes * @param[in] junction The junction to be created/deleted * @param[in] forward Whether to create/delete (true/false) */ - GNEChange_Junction(GNENet* net, GNEJunction* junction, bool forward); + GNEChange_Junction(GNEJunction* junction, bool forward); /// @brief Destructor ~GNEChange_Junction(); @@ -78,9 +77,8 @@ private: - /**@brief full information regarding the junction that is to be created/deleted - * we assume shared responsibility for the pointer (via reference counting) + * @note we assume shared responsibility for the pointer (via reference counting) */ GNEJunction* myJunction; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Lane.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Lane.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Lane.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Lane.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEChange_Lane.cpp /// @author Jakob Erdmann /// @date April 2011 -/// @version $Id: GNEChange_Lane.cpp 21640 2016-10-09 20:28:52Z palcraft $ +/// @version $Id: GNEChange_Lane.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A network change in which a single lane is created or deleted /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -27,17 +27,14 @@ #include #endif +#include #include + #include "GNEChange_Lane.h" #include "GNEEdge.h" #include "GNELane.h" #include "GNENet.h" -#include "GNEAdditionalSet.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif - +#include "GNEViewNet.h" // =========================================================================== // FOX-declarations @@ -49,19 +46,19 @@ // =========================================================================== -// Constructor for creating an edge +/// @brief constructor for creating an edge GNEChange_Lane::GNEChange_Lane(GNEEdge* edge, GNELane* lane, const NBEdge::Lane& laneAttrs, bool forward): GNEChange(edge->getNet(), forward), myEdge(edge), myLane(lane), myLaneAttrs(laneAttrs) { + assert(myNet); myEdge->incRef("GNEChange_Lane"); if (myLane) { // non-zero pointer is passsed in case of removal or duplication myLane->incRef("GNEChange_Lane"); // Save additionals of lane myAdditionalChilds = myLane->getAdditionalChilds(); - myAdditionalSetParents = myLane->getAdditionalSetParents(); } else { assert(forward); } @@ -72,90 +69,112 @@ assert(myEdge); myEdge->decRef("GNEChange_Lane"); if (myEdge->unreferenced()) { + // show extra information for tests + if (myNet->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting unreferenced " + toString(myEdge->getTag()) + " '" + myEdge->getID() + "'"); + } delete myEdge; } if (myLane) { myLane->decRef("GNEChange_Lane"); if (myLane->unreferenced()) { + // show extra information for tests + if (myNet->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting unreferenced " + toString(myLane->getTag()) + " '" + myLane->getID() + "'"); + } delete myLane; } } } -void GNEChange_Lane::undo() { +void +GNEChange_Lane::undo() { if (myForward) { + // show extra information for tests + if (myEdge->getNet()->getViewNet()->isTestingModeEnabled()) { + if (myLane != NULL) { + WRITE_WARNING("Deleting " + toString(myLane->getTag()) + " '" + myLane->getID() + "'"); + } else { + WRITE_WARNING("Deleting NULL " + toString(SUMO_TAG_LANE)); + } + } + // remove lane from edge myEdge->removeLane(myLane); // Remove additional sets vinculated with this lane of net for (std::vector::iterator i = myAdditionalChilds.begin(); i != myAdditionalChilds.end(); i++) { myNet->deleteAdditional(*i); } - // Remove references to this edge in their AdditionalSets - for (std::vector::iterator i = myAdditionalSetParents.begin(); i != myAdditionalSetParents.end(); i++) { - (*i)->removeLaneChild(myLane); - // Remove additional from net if the number of childs is >= 0 - if ((*i)->getNumberOfEdgeChilds() == 0) { - myNet->deleteAdditional(*i); + } else { + // show extra information for tests + if (myEdge->getNet()->getViewNet()->isTestingModeEnabled()) { + if (myLane != NULL) { + WRITE_WARNING("Adding " + toString(myLane->getTag()) + " '" + myLane->getID() + "'"); + } else { + WRITE_WARNING("Adding NULL " + toString(SUMO_TAG_LANE)); } } - } else { + // add lane and their attributes to edge myEdge->addLane(myLane, myLaneAttrs); // add additional sets vinculated with this lane of net for (std::vector::iterator i = myAdditionalChilds.begin(); i != myAdditionalChilds.end(); i++) { myNet->insertAdditional(*i); } - // Add references to this edge in their AdditionalSets - for (std::vector::iterator i = myAdditionalSetParents.begin(); i != myAdditionalSetParents.end(); i++) { - myNet->insertAdditional(*i, false); - (*i)->addLaneChild(myLane); - } } } -void GNEChange_Lane::redo() { +void +GNEChange_Lane::redo() { if (myForward) { + // show extra information for tests + if (myEdge->getNet()->getViewNet()->isTestingModeEnabled()) { + if (myLane != NULL) { + WRITE_WARNING("Adding " + toString(myLane->getTag()) + " '" + myLane->getID() + "'"); + } else { + WRITE_WARNING("Adding NULL " + toString(SUMO_TAG_LANE)); + } + } + // add lane and their attributes to edge myEdge->addLane(myLane, myLaneAttrs); // add additional sets vinculated with this lane of net for (std::vector::iterator i = myAdditionalChilds.begin(); i != myAdditionalChilds.end(); i++) { myNet->insertAdditional(*i); } - // Add references to this edge in their AdditionalSets - for (std::vector::iterator i = myAdditionalSetParents.begin(); i != myAdditionalSetParents.end(); i++) { - myNet->insertAdditional(*i, false); - (*i)->addLaneChild(myLane); - } } else { + // show extra information for tests + if (myEdge->getNet()->getViewNet()->isTestingModeEnabled()) { + if (myLane != NULL) { + WRITE_WARNING("Deleting " + toString(myLane->getTag()) + " '" + myLane->getID() + "'"); + } else { + WRITE_WARNING("Deleting NULL " + toString(SUMO_TAG_LANE)); + } + } + // remove lane from edge myEdge->removeLane(myLane); // Remove additional sets vinculated with this lane of net for (std::vector::iterator i = myAdditionalChilds.begin(); i != myAdditionalChilds.end(); i++) { myNet->deleteAdditional(*i); } - // Remove references to this edge in their AdditionalSets - for (std::vector::iterator i = myAdditionalSetParents.begin(); i != myAdditionalSetParents.end(); i++) { - (*i)->removeLaneChild(myLane); - // Remove additional from net if the number of childs is >= 0 - if ((*i)->getNumberOfEdgeChilds() == 0) { - myNet->deleteAdditional(*i); - } - } } } -FXString GNEChange_Lane::undoName() const { +FXString +GNEChange_Lane::undoName() const { if (myForward) { - return ("Undo create lane"); + return ("Undo create " + toString(SUMO_TAG_LANE)).c_str(); } else { - return ("Undo delete lane"); + return ("Undo delete " + toString(SUMO_TAG_LANE)).c_str(); } } -FXString GNEChange_Lane::redoName() const { +FXString +GNEChange_Lane::redoName() const { if (myForward) { - return ("Redo create lane"); + return ("Redo create " + toString(SUMO_TAG_LANE)).c_str(); } else { - return ("Redo delete lane"); + return ("Redo delete " + toString(SUMO_TAG_LANE)).c_str(); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Lane.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Lane.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Lane.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Lane.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEChange_Lane.h /// @author Jakob Erdmann /// @date April 2011 -/// @version $Id: GNEChange_Lane.h 21640 2016-10-09 20:28:52Z palcraft $ +/// @version $Id: GNEChange_Lane.h 23777 2017-04-03 08:03:56Z palcraft $ /// // A network change in which a single lane is created or deleted /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,7 +41,6 @@ class GNEEdge; class GNELane; class GNEAdditional; -class GNEAdditionalSet; // =========================================================================== // class definitions @@ -95,7 +94,7 @@ std::vector myAdditionalChilds; /// @brief we need to preserve the list of additional sets in which this lane is a child - std::vector myAdditionalSetParents; + std::vector myAdditionalParents; }; #endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Selection.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Selection.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Selection.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Selection.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEChange_Selection.cpp /// @author Jakob Erdmann /// @date Mar 2015 -/// @version $Id: GNEChange_Selection.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEChange_Selection.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A change to the network selection /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,10 +33,6 @@ #include "GNENet.h" #include "GNEViewNet.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif - // =========================================================================== // FOX-declarations @@ -48,11 +44,12 @@ // =========================================================================== -// Constructor for changing selection +/// @brief constructor for changing selection GNEChange_Selection::GNEChange_Selection(GNENet* net, const std::set& selected, const std::set& deselected, bool forward): GNEChange(net, forward), mySelectedIDs(selected), myDeselectedIDs(deselected) { + assert(myNet); } @@ -60,7 +57,8 @@ } -void GNEChange_Selection::undo() { +void +GNEChange_Selection::undo() { if (myForward) { for (std::set::const_iterator it = mySelectedIDs.begin(); it != mySelectedIDs.end(); it++) { if (GUIGlObjectStorage::gIDStorage.getObjectBlocking(*it)) { @@ -88,7 +86,8 @@ } -void GNEChange_Selection::redo() { +void +GNEChange_Selection::redo() { if (myForward) { for (std::set::const_iterator it = mySelectedIDs.begin(); it != mySelectedIDs.end(); it++) { if (GUIGlObjectStorage::gIDStorage.getObjectBlocking(*it)) { @@ -116,7 +115,8 @@ } -FXString GNEChange_Selection::undoName() const { +FXString +GNEChange_Selection::undoName() const { if (myForward) { return ("Undo change selection"); } else { @@ -125,7 +125,8 @@ } -FXString GNEChange_Selection::redoName() const { +FXString +GNEChange_Selection::redoName() const { if (myForward) { return ("Redo change selection"); } else { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Selection.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Selection.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_Selection.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_Selection.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEChange_Selection.h /// @author Jakob Erdmann /// @date Mar 2015 -/// @version $Id: GNEChange_Selection.h 21430 2016-09-05 14:42:57Z namdre $ +/// @version $Id: GNEChange_Selection.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A change to the network selection /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -51,6 +51,7 @@ public: /**@brief Constructor for modifying selection + * @param[in] net net in which apply selection chagnes * @param[in] selected The ids to select * @param[in] deselected The ids to deselect * @param[in] forward Whether to select or deselect the selected ids diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_TLS.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_TLS.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_TLS.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_TLS.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEChange_TLS.cpp /// @author Jakob Erdmann /// @date July 2011 -/// @version $Id: GNEChange_TLS.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GNEChange_TLS.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A network change in which a traffic light is created or deleted /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -27,16 +27,16 @@ #include #endif +#include + #include #include #include #include #include "GNEChange_TLS.h" #include "GNEJunction.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif +#include "GNENet.h" +#include "GNEViewNet.h" // =========================================================================== @@ -49,13 +49,13 @@ // =========================================================================== -// Constructor for creating an edge -GNEChange_TLS::GNEChange_TLS( - GNEJunction* junction, NBTrafficLightDefinition* tlDef, bool forward, bool forceInsert, const std::string tlID): - GNEChange(0, forward), +/// @brief constructor for creating an edge +GNEChange_TLS::GNEChange_TLS(GNEJunction* junction, NBTrafficLightDefinition* tlDef, bool forward, bool forceInsert, const std::string tlID): + GNEChange(junction->getNet(), forward), myJunction(junction), myTlDef(tlDef), myForceInsert(forceInsert) { + assert(myNet); myJunction->incRef("GNEChange_TLS"); if (myTlDef == 0) { assert(forward); @@ -70,42 +70,70 @@ assert(myJunction); myJunction->decRef("GNEChange_TLS"); if (myJunction->unreferenced()) { + // show extra information for tests + if (myNet->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting unreferenced " + toString(myJunction->getTag()) + " '" + myJunction->getID() + "'"); + } delete myJunction; } } -void GNEChange_TLS::undo() { +void +GNEChange_TLS::undo() { if (myForward) { + // show extra information for tests + if (myJunction->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting " + toString(myJunction->getTag()) + " '" + myJunction->getID() + "'"); + } + // remove traffic light from junction myJunction->removeTrafficLight(myTlDef); } else { + // show extra information for tests + if (myJunction->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Adding " + toString(myJunction->getTag()) + " '" + myJunction->getID() + "'"); + } + // add traffic light to junction myJunction->addTrafficLight(myTlDef, myForceInsert); } } -void GNEChange_TLS::redo() { +void +GNEChange_TLS::redo() { if (myForward) { + // show extra information for tests + if (myJunction->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Adding " + toString(myJunction->getTag()) + " '" + myJunction->getID() + "'"); + } + // add traffic light to junction myJunction->addTrafficLight(myTlDef, myForceInsert); } else { + // show extra information for tests + if (myJunction->getNet()->getViewNet()->isTestingModeEnabled()) { + WRITE_WARNING("Deleting " + toString(myJunction->getTag()) + " '" + myJunction->getID() + "'"); + } + // remove traffic light from junction myJunction->removeTrafficLight(myTlDef); } } -FXString GNEChange_TLS::undoName() const { +FXString +GNEChange_TLS::undoName() const { if (myForward) { - return ("Undo create traffic light"); + return ("Undo create " + toString(SUMO_TAG_TRAFFIC_LIGHT)).c_str(); } else { - return ("Undo delete traffic light"); + return ("Undo delete " + toString(SUMO_TAG_TRAFFIC_LIGHT)).c_str(); } } -FXString GNEChange_TLS::redoName() const { +FXString +GNEChange_TLS::redoName() const { if (myForward) { - return ("Redo create traffic light"); + return ("Redo create " + toString(SUMO_TAG_TRAFFIC_LIGHT)).c_str(); } else { - return ("Redo delete traffic light"); + return ("Redo delete " + toString(SUMO_TAG_TRAFFIC_LIGHT)).c_str(); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_TLS.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_TLS.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChange_TLS.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChange_TLS.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,7 +2,7 @@ /// @file GNEChange_TLS.h /// @author Jakob Erdmann /// @date July 2011 -/// @version $Id: GNEChange_TLS.h 20975 2016-06-15 13:02:40Z palcraft $ +/// @version $Id: GNEChange_TLS.h 22929 2017-02-13 14:38:39Z behrisch $ /// // A network change in which a traffic light is created or deleted /****************************************************************************/ @@ -79,12 +79,14 @@ private: - /* we need the junction because it is the target of our change commands - * we assume shared responsiblity for the junction via reference counting */ + /**@brief we need the junction because it is the target of our change commands + * @note we assume shared responsiblity for the junction via reference counting + */ GNEJunction* myJunction; - /* the traffic light to be created/deleted. We assume no responsiblity for the pointer - * since it is hard to track by which NBnodes a tlDef is used (may be more than one). */ + /**@brief the traffic light to be created/deleted. We assume no responsiblity for the pointer + * @note since it is hard to track by which NBnodes a tlDef is used (may be more than one). + */ NBTrafficLightDefinition* myTlDef; /// @brief check if forceInsert is enabled diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChargingStation.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChargingStation.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChargingStation.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChargingStation.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEChargingStation.cpp /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEChargingStation.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEChargingStation.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// /// A class for visualizing chargingStation geometry (adapted from GUILaneWrapper) /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,6 +46,7 @@ #include #include #include +#include #include "GNEChargingStation.h" #include "GNELane.h" @@ -56,16 +57,13 @@ #include "GNEChange_Attribute.h" #include "GNEViewNet.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // =========================================================================== // member method definitions // =========================================================================== -GNEChargingStation::GNEChargingStation(const std::string& id, GNELane* lane, GNEViewNet* viewNet, SUMOReal startPos, SUMOReal endPos, SUMOReal chargingPower, SUMOReal efficiency, bool chargeInTransit, int chargeDelay, bool blocked) : - GNEStoppingPlace(id, viewNet, SUMO_TAG_CHARGING_STATION, lane, startPos, endPos, blocked), +GNEChargingStation::GNEChargingStation(const std::string& id, GNELane* lane, GNEViewNet* viewNet, double startPos, double endPos, double chargingPower, double efficiency, bool chargeInTransit, const double chargeDelay) : + GNEStoppingPlace(id, viewNet, SUMO_TAG_CHARGING_STATION, ICON_CHARGINGSTATION, lane, startPos, endPos), myChargingPower(chargingPower), myEfficiency(efficiency), myChargeInTransit(chargeInTransit), @@ -98,7 +96,7 @@ myShape = myLane->getShape(); // Cut shape using as delimitators from start position and end position - myShape = myShape.getSubpart(myLane->getPositionRelativeToParametricLenght(myStartPos), myLane->getPositionRelativeToParametricLenght(myEndPos)); + myShape = myShape.getSubpart(myLane->getPositionRelativeToParametricLength(myStartPos), myLane->getPositionRelativeToParametricLength(myEndPos)); // Get number of parts of the shape int numberOfSegments = (int) myShape.size() - 1; @@ -123,7 +121,7 @@ myShapeLengths.push_back(f.distanceTo(s)); // Save rotation (angle) of the vector constructed by points f and s - myShapeRotations.push_back((SUMOReal) atan2((s.x() - f.x()), (f.y() - s.y())) * (SUMOReal) 180.0 / (SUMOReal) PI); + myShapeRotations.push_back((double) atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double) PI); } } @@ -152,7 +150,7 @@ void -GNEChargingStation::writeAdditional(OutputDevice& device, const std::string&) { +GNEChargingStation::writeAdditional(OutputDevice& device) const { // Write additional device.openTag(getTag()); device.writeAttr(SUMO_ATTR_ID, getID()); @@ -171,13 +169,13 @@ } -SUMOReal +double GNEChargingStation::getChargingPower() { return myChargingPower; } -SUMOReal +double GNEChargingStation::getEfficiency() { return myEfficiency; } @@ -189,24 +187,24 @@ } -SUMOReal +double GNEChargingStation::getChargeDelay() { return myChargeDelay; } void -GNEChargingStation::setChargingPower(SUMOReal chargingPower) { +GNEChargingStation::setChargingPower(double chargingPower) { if (chargingPower > 0) { myChargingPower = chargingPower; } else { - throw InvalidArgument("Value of charging Power must be greather than 0"); + throw InvalidArgument("Value of charging Power must be greater than 0"); } } void -GNEChargingStation::setEfficiency(SUMOReal efficiency) { +GNEChargingStation::setEfficiency(double efficiency) { if (efficiency >= 0 && efficiency <= 1) { myEfficiency = efficiency; } else { @@ -222,12 +220,11 @@ void -GNEChargingStation::setChargeDelay(SUMOReal chargeDelay) { +GNEChargingStation::setChargeDelay(double chargeDelay) { if (chargeDelay < 0) { - myChargeDelay = chargeDelay; - } else { throw InvalidArgument("Value of chargeDelay cannot be negative"); } + myChargeDelay = chargeDelay; } @@ -250,7 +247,7 @@ } // Get exaggeration - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); // Draw base GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, exaggeration); @@ -300,10 +297,10 @@ // Set position over sign glTranslated(mySignPos.x(), mySignPos.y(), 0); - // Define nº points (for efficiency) + // Define number of points (for efficiency) int noPoints = 9; - // If the scale * exaggeration is more than 25, recalculate nº points + // If the scale * exaggeration is more than 25, recalculate number of points if (s.scale * exaggeration > 25) { noPoints = MIN2((int)(9.0 + (s.scale * exaggeration) / 10.0), 36); } @@ -319,7 +316,7 @@ } // Draw extern - GLHelper::drawFilledCircle((SUMOReal) 1.1, noPoints); + GLHelper::drawFilledCircle((double) 1.1, noPoints); // Move to top glTranslated(0, 0, .1); @@ -331,7 +328,7 @@ GLHelper::setColor(mySignColor); } // Draw internt sign - GLHelper::drawFilledCircle((SUMOReal) 0.9, noPoints); + GLHelper::drawFilledCircle((double) 0.9, noPoints); // Draw sign 'C' if (s.scale * exaggeration >= 4.5) { @@ -381,7 +378,7 @@ case GNE_ATTR_BLOCK_MOVEMENT: return toString(myBlocked); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -404,7 +401,7 @@ undoList->p_add(new GNEChange_Attribute(this, key, value)); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -425,18 +422,33 @@ return false; } case SUMO_ATTR_STARTPOS: - return (canParse(value) && parse(value) >= 0 && parse(value) < (myEndPos - 1)); + return (canParse(value) && parse(value) >= 0 && parse(value) < (myEndPos - 1)); case SUMO_ATTR_ENDPOS: { - if (canParse(value) && parse(value) >= 1 && parse(value) > myStartPos) { + if (canParse(value) && parse(value) >= 1 && parse(value) > myStartPos) { // If extension is larger than Lane - if (parse(value) > myLane->getLaneParametricLenght()) { - // Ask user if want to assign the lenght of lane as endPosition + if (parse(value) > myLane->getLaneParametricLength()) { + // write warning if netedit is running in testing mode + if (myViewNet->isTestingModeEnabled() == true) { + WRITE_WARNING("Opening FXMessageBox of type 'question'"); + } + // Ask user if want to assign the length of lane as endPosition FXuint answer = FXMessageBox::question(getViewNet()->getApp(), MBOX_YES_NO, - "EndPosition exceeds the size of the lane", "%s", - "EndPosition exceeds the size of the lane. You want to assign the size of the lane as endPosition?"); + (toString(SUMO_ATTR_ENDPOS) + " exceeds the size of the " + toString(SUMO_TAG_LANE)).c_str(), "%s", + (toString(SUMO_ATTR_ENDPOS) + " exceeds the size of the " + toString(SUMO_TAG_LANE) + + ". Do you want to assign the length of the " + toString(SUMO_TAG_LANE) + " as " + toString(SUMO_ATTR_ENDPOS) + "?").c_str()); if (answer == 1) { //1:yes, 2:no, 4:esc + // write warning if netedit is running in testing mode + if (myViewNet->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Yes'"); + } return true; } else { + // write warning if netedit is running in testing mode + if ((answer == 2) && (myViewNet->isTestingModeEnabled() == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'"); + } else if ((answer == 4) && (myViewNet->isTestingModeEnabled() == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'"); + } return false; } } else { @@ -447,17 +459,17 @@ } } case SUMO_ATTR_CHARGINGPOWER: - return (canParse(value) && parse(value) >= 0); + return (canParse(value) && parse(value) >= 0); case SUMO_ATTR_EFFICIENCY: - return (canParse(value) && parse(value) >= 0 && parse(value) <= 1); + return (canParse(value) && parse(value) >= 0 && parse(value) <= 1); case SUMO_ATTR_CHARGEINTRANSIT: return canParse(value); case SUMO_ATTR_CHARGEDELAY: - return (canParse(value) && parse(value) >= 0); + return (canParse(value) && parse(value) >= 0); case GNE_ATTR_BLOCK_MOVEMENT: return canParse(value); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -475,38 +487,39 @@ changeLane(value); break; case SUMO_ATTR_STARTPOS: - myStartPos = parse(value); + myStartPos = parse(value); updateGeometry(); getViewNet()->update(); break; case SUMO_ATTR_ENDPOS: - if (parse(value) > myLane->getLaneParametricLenght()) { - myEndPos = myLane->getLaneParametricLenght(); + if (parse(value) > myLane->getLaneParametricLength()) { + myEndPos = myLane->getLaneParametricLength(); } else { - myEndPos = parse(value); + myEndPos = parse(value); } updateGeometry(); getViewNet()->update(); break; case SUMO_ATTR_CHARGINGPOWER: - myChargingPower = parse(value); + myChargingPower = parse(value); break; case SUMO_ATTR_EFFICIENCY: - myEfficiency = parse(value); + myEfficiency = parse(value); break; case SUMO_ATTR_CHARGEINTRANSIT: myChargeInTransit = parse(value); break; case SUMO_ATTR_CHARGEDELAY: - myChargeDelay = parse(value); + myChargeDelay = parse(value); break; case GNE_ATTR_BLOCK_MOVEMENT: myBlocked = parse(value); getViewNet()->update(); break; default: - throw InvalidArgument(toString(getType()) + "attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + "attribute '" + toString(key) + "' not allowed"); } } + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChargingStation.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChargingStation.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEChargingStation.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEChargingStation.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEChargingStation.h /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEChargingStation.h 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: GNEChargingStation.h 23150 2017-02-27 12:08:30Z behrisch $ /// /// A class for visualizing chargingStation geometry (adapted from GUILaneWrapper) /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -58,9 +58,8 @@ * @param[in] efficiency efficiency of the charge [0,1] * @param[in] chargeInTransit enable or disable charge in transit * @param[in] chargeDelay delay in timeSteps in the charge - * @param[in] blocked set initial blocking state of item */ - GNEChargingStation(const std::string& id, GNELane* lane, GNEViewNet* viewNet, SUMOReal startPos, SUMOReal endPos, SUMOReal chargingPower, SUMOReal efficiency, bool chargeInTransit, int chargeDelay, bool blocked); + GNEChargingStation(const std::string& id, GNELane* lane, GNEViewNet* viewNet, double startPos, double endPos, double chargingPower, double efficiency, bool chargeInTransit, const double chargeDelay); /// @brief Destructor ~GNEChargingStation(); @@ -71,17 +70,17 @@ /**@brief writte additional element into a xml file * @param[in] device device in which write parameters of additional element */ - void writeAdditional(OutputDevice& device, const std::string&); + void writeAdditional(OutputDevice& device) const; /**@brief Returns the charging power of the chargingStation * @return The charging power of the chargingStation */ - SUMOReal getChargingPower(); + double getChargingPower(); /**@brief Returns the charging efficiency of the chargingStation * @return The charging efficiency of the chargingStation */ - SUMOReal getEfficiency(); + double getEfficiency(); /**@brief Returns the value of charge in transit of the chargingStation * @return True if charge in transit is enabled, false in other case */ @@ -89,19 +88,19 @@ /**@brief Returns the charge delay of the chargingStation * @return The charge delay of the chargingStation */ - SUMOReal getChargeDelay(); + double getChargeDelay(); /**@brief Set a new charging power in the charging station * @param[in] chargingPower new charging power * @throws InvalidArgument if value of chargingPower isn't valid */ - void setChargingPower(SUMOReal chargingPower); + void setChargingPower(double chargingPower); /**@brief Set a new efficiency in the charging station * @param[in] efficiency new efficiency * @throws InvalidArgument if value of efficiency isn't valid */ - void setEfficiency(SUMOReal efficiency); + void setEfficiency(double efficiency); /**@brief Enable or disable charge in transit in the charging station * @param[in] chargeInTransit new charge in Transit value (0 or 1) */ @@ -110,7 +109,7 @@ * @param[in] chargeDelay new charge delay value (true or false) * @throws InvalidArgument if value of chargeDelay isn't valid */ - void setChargeDelay(SUMOReal chargeDelay); + void setChargeDelay(double chargeDelay); /// @name inherited from GUIGlObject /// @{ @@ -146,16 +145,16 @@ protected: /// @brief Charging power pro timestep - SUMOReal myChargingPower; + double myChargingPower; /// @brief efficiency of the charge - SUMOReal myEfficiency; + double myEfficiency; /// @brief enable or disable charge in transit bool myChargeInTransit; /// @brief delay in the starting of charge - int myChargeDelay; + double myChargeDelay; private: /// @brief set attribute after validation diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEClosingLaneReroute.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEClosingLaneReroute.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEClosingLaneReroute.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEClosingLaneReroute.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,111 @@ +/****************************************************************************/ +/// @file GNEClosingLaneReroute.cpp +/// @author Pablo Alvarez Lopez +/// @date Jan 2017 +/// @version $Id: GNEClosingLaneReroute.cpp 23640 2017-03-24 09:17:38Z palcraft $ +/// +/// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include + +#include "GNEClosingLaneReroute.h" +#include "GNELane.h" + + +// =========================================================================== +// member method definitions +// =========================================================================== + +GNEClosingLaneReroute::GNEClosingLaneReroute(GNERerouterInterval& rerouterIntervalParent, GNELane* closedLane, SVCPermissions allowedVehicles, SVCPermissions disallowedVehicles) : + myRerouterIntervalParent(&rerouterIntervalParent), + myClosedLane(closedLane), + myAllowedVehicles(allowedVehicles), + myDisallowedVehicles(disallowedVehicles), + myTag(SUMO_TAG_CLOSING_LANE_REROUTE) { +} + + +GNEClosingLaneReroute::~GNEClosingLaneReroute() { +} + +SVCPermissions +GNEClosingLaneReroute::getAllowedVehicles() const { + return myAllowedVehicles; +} + + +SVCPermissions +GNEClosingLaneReroute::getDisallowedVehicles() const { + return myDisallowedVehicles; +} + + +void +GNEClosingLaneReroute::setAllowedVehicles(SVCPermissions allowed) { + myAllowedVehicles = allowed; +} + + +void +GNEClosingLaneReroute::setDisallowedVehicles(SVCPermissions disallowed) { + myDisallowedVehicles = disallowed; +} + + +GNELane* +GNEClosingLaneReroute::getClosedLane() const { + return myClosedLane; +} + + +void +GNEClosingLaneReroute::setClosedLane(GNELane* lane) { + myClosedLane = lane; +} + + +SumoXMLTag +GNEClosingLaneReroute::getTag() const { + return myTag; +} + + +const GNERerouterInterval& +GNEClosingLaneReroute::getRerouterIntervalParent() const { + return *myRerouterIntervalParent; +} + + +bool +GNEClosingLaneReroute::operator==(const GNEClosingLaneReroute& closingReroute) const { + if ((myRerouterIntervalParent == closingReroute.myRerouterIntervalParent) && + (myClosedLane == closingReroute.myClosedLane) && + (myAllowedVehicles == closingReroute.myAllowedVehicles) && + (myDisallowedVehicles == closingReroute.myDisallowedVehicles)) { + return true; + } else { + return false; + } +} +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEClosingLaneReroute.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEClosingLaneReroute.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEClosingLaneReroute.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEClosingLaneReroute.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,107 @@ +/****************************************************************************/ +/// @file GNEClosingLaneReroute.h +/// @author Pablo Alvarez Lopez +/// @date Jan 2017 +/// @version $Id: GNEClosingLaneReroute.h 23640 2017-03-24 09:17:38Z palcraft $ +/// +/// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNEClosingLaneReroute_h +#define GNEClosingLaneReroute_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include + +// =========================================================================== +// class declarations +// =========================================================================== + +class GNELane; +class GNERerouterInterval; + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class GNEClosingLaneReroute + * forces the rerouter to close the lane + */ +class GNEClosingLaneReroute { +public: + /// @brief constructor + GNEClosingLaneReroute(GNERerouterInterval& rerouterIntervalParent, GNELane* closedLane, + SVCPermissions allowedVehicles = SVC_IGNORING, SVCPermissions disallowedVehicles = SVC_IGNORING); + + /// @brief destructor + ~GNEClosingLaneReroute(); + + /// @brief get allowed vehicles + SVCPermissions getAllowedVehicles() const; + + /// @brief get disallowed vehicles + SVCPermissions getDisallowedVehicles() const; + + /// @brief set allowed vehicles + void setAllowedVehicles(SVCPermissions allowed); + + /// @brief set disallowed vehicles + void setDisallowedVehicles(SVCPermissions disallowed); + + /// @brief get closed lane Id + GNELane* getClosedLane() const; + + /// @brief set closed lane Id + void setClosedLane(GNELane* lane); + + /// @brief get tag + SumoXMLTag getTag() const; + + /// @brief get rerouter interval parent + const GNERerouterInterval& getRerouterIntervalParent() const; + + /// @brief overload operator == + bool operator==(const GNEClosingLaneReroute& closingLaneReroute) const; + +protected: + /// @brief reference to rerouter interval parent + GNERerouterInterval* myRerouterIntervalParent; + + /// @brief closed lane + GNELane* myClosedLane; + + /// @brief codified allowed vehicles + SVCPermissions myAllowedVehicles; + + /// @brief codified disallowed vehicles + SVCPermissions myDisallowedVehicles; + + /// @brief XML Tag of closing lane reroute + SumoXMLTag myTag; +}; + +#endif + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEClosingReroute.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEClosingReroute.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEClosingReroute.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEClosingReroute.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,113 @@ +/****************************************************************************/ +/// @file GNEClosingReroute.cpp +/// @author Pablo Alvarez Lopez +/// @date Jan 2017 +/// @version $Id: GNEClosingReroute.cpp 23640 2017-03-24 09:17:38Z palcraft $ +/// +/// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include + +#include "GNEClosingReroute.h" +#include "GNEEdge.h" + + +// =========================================================================== +// member method definitions +// =========================================================================== + +GNEClosingReroute::GNEClosingReroute(GNERerouterInterval& rerouterIntervalParent, GNEEdge* closedEdge, SVCPermissions allowedVehicles, SVCPermissions disallowedVehicles) : + myRerouterIntervalParent(&rerouterIntervalParent), + myClosedEdge(closedEdge), + myAllowedVehicles(allowedVehicles), + myDisallowedVehicles(disallowedVehicles), + myTag(SUMO_TAG_CLOSING_REROUTE) { +} + + +GNEClosingReroute::~GNEClosingReroute() { +} + + +SVCPermissions +GNEClosingReroute::getAllowedVehicles() const { + return myAllowedVehicles; +} + + +SVCPermissions +GNEClosingReroute::getDisallowedVehicles() const { + return myDisallowedVehicles; +} + + +void +GNEClosingReroute::setAllowedVehicles(SVCPermissions allowed) { + myAllowedVehicles = allowed; +} + + +void +GNEClosingReroute::setDisallowedVehicles(SVCPermissions disallowed) { + myDisallowedVehicles = disallowed; +} + + +GNEEdge* +GNEClosingReroute::getClosedEdge() const { + return myClosedEdge; +} + + +void +GNEClosingReroute::setClosedEdge(GNEEdge* edge) { + myClosedEdge = edge; +} + + +SumoXMLTag +GNEClosingReroute::getTag() const { + return myTag; +} + + +const GNERerouterInterval& +GNEClosingReroute::getRerouterIntervalParent() const { + return *myRerouterIntervalParent; +} + + +bool +GNEClosingReroute::operator==(const GNEClosingReroute& closingReroute) const { + if ((myRerouterIntervalParent == closingReroute.myRerouterIntervalParent) && + (myClosedEdge == closingReroute.myClosedEdge) && + (myAllowedVehicles == closingReroute.myAllowedVehicles) && + (myDisallowedVehicles == closingReroute.myDisallowedVehicles)) { + return true; + } else { + return false; + } +} + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEClosingReroute.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEClosingReroute.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEClosingReroute.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEClosingReroute.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,108 @@ +/****************************************************************************/ +/// @file GNEClosingReroute.h +/// @author Pablo Alvarez Lopez +/// @date Jan 2017 +/// @version $Id: GNEClosingReroute.h 23640 2017-03-24 09:17:38Z palcraft $ +/// +/// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNEClosingReroute_h +#define GNEClosingReroute_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include + +// =========================================================================== +// class declarations +// =========================================================================== + +class GNEEdge; +class GNERerouterInterval; + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class GNEClosingReroute + * the rerouter to close the street (edge) + */ + +class GNEClosingReroute { +public: + /// @brief constructor + GNEClosingReroute(GNERerouterInterval& rerouterIntervalParent, GNEEdge* closedEdge, + SVCPermissions allowedVehicles = SVC_IGNORING, SVCPermissions disallowedVehicles = SVC_IGNORING); + + /// @brief destructor + ~GNEClosingReroute(); + + /// @brief get allowed vehicles + SVCPermissions getAllowedVehicles() const; + + /// @brief get disallowed vehicles + SVCPermissions getDisallowedVehicles() const; + + /// @brief set allowed vehicles + void setAllowedVehicles(SVCPermissions allowed); + + /// @brief set disallowed vehicles + void setDisallowedVehicles(SVCPermissions disallowed); + + /// @brief get closed edge + GNEEdge* getClosedEdge() const; + + /// @brief set closed edge + void setClosedEdge(GNEEdge* edge); + + /// @brief get tag + SumoXMLTag getTag() const; + + /// @brief get rerouter interval parent + const GNERerouterInterval& getRerouterIntervalParent() const; + + /// @brief overload operator == + bool operator==(const GNEClosingReroute& closingReroute) const; + +protected: + /// @brief reference to rerouter interval parent + GNERerouterInterval* myRerouterIntervalParent; + + /// @brief closed edge + GNEEdge* myClosedEdge; + + /// @brief codified allowed vehicles + SVCPermissions myAllowedVehicles; + + /// @brief codified disallowed vehicles + SVCPermissions myDisallowedVehicles; + + /// @brief XML Tag of closing reroute + SumoXMLTag myTag; +}; + +#endif + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEConnection.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEConnection.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEConnection.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEConnection.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEConnection.cpp /// @author Pablo Alvarez Lopez /// @date Jun 2016 -/// @version $Id: GNEConnection.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEConnection.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A class for visualizing connections between lanes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,10 +55,6 @@ #include "GNEViewNet.h" #include "GNEInternalLane.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== @@ -71,9 +67,8 @@ // =========================================================================== GNEConnection::GNEConnection(GNELane* from, GNELane* to) : - GNENetElement(from->getNet(), - std::string(":") + from->getMicrosimID() + "->" + to->getMicrosimID(), - GLO_CONNECTION, SUMO_TAG_CONNECTION), + GNENetElement(from->getNet(), from->getMicrosimID() + " -> " + to->getMicrosimID(), + GLO_CONNECTION, SUMO_TAG_CONNECTION, ICON_CONNECTION), myFromLane(from), myToLane(to), myLinkState(LINKSTATE_TL_OFF_NOSIGNAL), @@ -111,8 +106,8 @@ laneShapeFrom, laneShapeTo, NUM_POINTS, getEdgeFrom()->getNBEdge()->getTurnDestination() == nbCon.toEdge, - (SUMOReal) 5. * (SUMOReal) getEdgeFrom()->getNBEdge()->getNumLanes(), - (SUMOReal) 5. * (SUMOReal) nbCon.toEdge->getNumLanes()); + (double) 5. * (double) getEdgeFrom()->getNBEdge()->getNumLanes(), + (double) 5. * (double) nbCon.toEdge->getNumLanes()); } else { myShape.clear(); @@ -120,7 +115,7 @@ myShape.push_back(laneShapeTo.positionAtOffset(1)); } - // Obtain lenghts and shape rotations + // Obtain lengths and shape rotations int segments = (int) myShape.size() - 1; if (segments >= 0) { myShapeRotations.reserve(segments); @@ -129,7 +124,7 @@ const Position& f = myShape[i]; const Position& s = myShape[i + 1]; myShapeLengths.push_back(f.distanceTo2D(s)); - myShapeRotations.push_back((SUMOReal) atan2((s.x() - f.x()), (f.y() - s.y())) * (SUMOReal) 180.0 / (SUMOReal) PI); + myShapeRotations.push_back((double) atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double) PI); } } } @@ -191,6 +186,12 @@ } +void +GNEConnection::updateID() { + setMicrosimID(myFromLane->getMicrosimID() + " -> " + myToLane->getMicrosimID()); +} + + LinkState GNEConnection::getLinkState() const { return myLinkState; @@ -308,11 +309,11 @@ case SUMO_ATTR_CONTPOS: return toString(nbCon.contPos); case SUMO_ATTR_UNCONTROLLED: - return toString(!getEdgeFrom()->getNBEdge()->mayBeTLSControlled(nbCon.fromLane, nbCon.toEdge, nbCon.toLane)); + return toString(nbCon.uncontrolled); case SUMO_ATTR_VISIBILITY_DISTANCE: return toString(nbCon.visibility); default: - throw InvalidArgument("connection attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -333,7 +334,7 @@ undoList->p_add(new GNEChange_Attribute(this, key, value)); break; default: - throw InvalidArgument("connection attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -352,14 +353,13 @@ case SUMO_ATTR_KEEP_CLEAR: return canParse(value); case SUMO_ATTR_CONTPOS: - return canParse(value); + return canParse(value); case SUMO_ATTR_UNCONTROLLED: - return false; // XXX see #2599 - //return canParse(value); + return canParse(value); case SUMO_ATTR_VISIBILITY_DISTANCE: - return isPositive(value); + return isPositive(value); default: - throw InvalidArgument("connection attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -374,19 +374,17 @@ case SUMO_ATTR_KEEP_CLEAR: nbCon.keepClear = parse(value); break; - /* case SUMO_ATTR_UNCONTROLLED: - // XXX see @2599 - break; - */ + nbCon.uncontrolled = parse(value); + break; case SUMO_ATTR_CONTPOS: - nbCon.contPos = parse(value); + nbCon.contPos = parse(value); break; case SUMO_ATTR_VISIBILITY_DISTANCE: - nbCon.visibility = parse(value); + nbCon.visibility = parse(value); break; default: - throw InvalidArgument("connection attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEConnection.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEConnection.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEConnection.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEConnection.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEConnection.h /// @author Pablo Alvarez Lopez /// @date Jun 2016 -/// @version $Id: GNEConnection.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEConnection.h 23716 2017-03-29 17:19:58Z palcraft $ /// // A class for represent connections between Lanes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2016-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -85,15 +85,18 @@ /// @brief get NBConnection NBConnection getNBConnection() const; - /// @brief get Draw connection - bool getDrawConnection() const; - /// @brief get LinkState LinkState getLinkState() const; + /// @brief update internal ID of Connection + void updateID(); + /// @brief recompute cached myLinkState void updateLinkState(); + /// @brief get Draw connection + bool getDrawConnection() const; + /// @brief enable or disable draw connection void setDrawConnection(bool drawConnection); @@ -166,19 +169,19 @@ /// @name computed only once (for performance) in updateGeometry() /// @{ /// @brief The rotations of the shape parts - std::vector myShapeRotations; + std::vector myShapeRotations; /// @brief The lengths of the shape parts - std::vector myShapeLengths; + std::vector myShapeLengths; /// @} + /// @brief Linkstate. @note cached because after 'undo' the connection needs to be drawn while the node logic (NBRequest) has not been recomputed + LinkState myLinkState; + /// @brief Enable or disable draw connection /// @note by default is enabled bool myDrawConnection; - /// @brief Linkstate. @note cached because after 'undo' the connection needs to be drawn while the node logic (NBRequest) has not been recomputed - LinkState myLinkState; - private: /// @brief set attribute after validation void setAttribute(SumoXMLAttr key, const std::string& value); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEConnectorFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEConnectorFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEConnectorFrame.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEConnectorFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEConnectorFrame.cpp /// @author Jakob Erdmann /// @date May 2011 -/// @version $Id: GNEConnectorFrame.cpp 21780 2016-10-25 10:06:16Z namdre $ +/// @version $Id: GNEConnectorFrame.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The Widget for modifying lane-to-lane connections /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -28,17 +28,16 @@ #include #endif -#ifdef HAVE_VERSION_H -#include -#endif - #include #include #include #include #include #include +#include #include +#include + #include "GNEInspectorFrame.h" #include "GNEConnectorFrame.h" #include "GNESelectorFrame.h" @@ -53,10 +52,6 @@ #include "GNEEdge.h" #include "GNEJunction.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping @@ -73,7 +68,7 @@ }; // Object implementation -FXIMPLEMENT(GNEConnectorFrame, FXScrollWindow, GNEConnectorFrameMap, ARRAYNUMBER(GNEConnectorFrameMap)) +FXIMPLEMENT(GNEConnectorFrame, FXVerticalFrame, GNEConnectorFrameMap, ARRAYNUMBER(GNEConnectorFrameMap)) // =========================================================================== // static members @@ -87,66 +82,55 @@ // =========================================================================== // method definitions // =========================================================================== -GNEConnectorFrame::GNEConnectorFrame(FXComposite* parent, GNEViewNet* viewNet): - GNEFrame(parent, viewNet, "Edit Connections"), +GNEConnectorFrame::GNEConnectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet): + GNEFrame(horizontalFrameParent, viewNet, "Edit Connections"), myCurrentLane(0) { - // heading - myDescription = new FXLabel(myContentFrame, "", 0, JUSTIFY_LEFT); - new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4); + // Create groupbox for lane information + myGroupBoxDescription = new FXGroupBox(myContentFrame, "Lane", GUIDesignGroupBoxFrame); + + // Create label for lane description and update it + myLaneDescriptionLabel = new FXLabel(myGroupBoxDescription, "", 0, GUIDesignLabelLeft); updateDescription(); - // buttons - // "Cancel" - new FXButton(myContentFrame, "Cancel\t\tDiscard connection modifications (Esc)", 0, this, MID_CANCEL, - ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, - 0, 0, 0, 0, 4, 4, 3, 3); - // "OK" - new FXButton(myContentFrame, "OK\t\tSave connection modifications (Enter)", 0, this, MID_OK, - ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, - 0, 0, 0, 0, 4, 4, 3, 3); - new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4); - // "Select Dead Ends" - new FXButton(myContentFrame, - "Select Dead Ends\t\tSelects all lanes that have no outgoing connection (clears previous selection)", - 0, this, MID_GNE_SELECT_DEAD_ENDS, - ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, - 0, 0, 0, 0, 4, 4, 3, 3); - // "Select Dead Starts" - new FXButton(myContentFrame, - "Select Dead Starts\t\tSelects all lanes that have no incoming connection (clears previous selection)", - 0, this, MID_GNE_SELECT_DEAD_STARTS, - ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, - 0, 0, 0, 0, 4, 4, 3, 3); - // "Select Conflicts" - new FXButton(myContentFrame, - "Select Conflicts\t\tSelects all lanes with more than one incoming connection from the same edge (clears previous selection)", - 0, this, MID_GNE_SELECT_CONFLICTS, - ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, - 0, 0, 0, 0, 4, 4, 3, 3); - // "Select Edges which may always pass" - new FXButton(myContentFrame, - "Select Passing\t\tSelects all lanes with a connection that has has the 'pass' attribute set", - 0, this, MID_GNE_SELECT_PASS, - ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, - 0, 0, 0, 0, 4, 4, 3, 3); - // "Clear Selected" - new FXButton(myContentFrame, - "Clear Selected\t\tClears all connections of all selected objects", - 0, this, MID_CHOOSEN_CLEAR, - ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, - 0, 0, 0, 0, 4, 4, 3, 3); - // "Reset Selected" - new FXButton(myContentFrame, - "Reset Selected\nJunctions\t\tRecomputes connections at all selected junctions", - 0, this, MID_CHOOSEN_RESET, - ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, - 0, 0, 0, 0, 4, 4, 3, 3); + // Create GroupBox for Buttons + myGroupBoxModifications = new FXGroupBox(myContentFrame, "Modifications", GUIDesignGroupBoxFrame); + + // Create "Cancel" button + myCancelButton = new FXButton(myGroupBoxModifications, "Cancel\t\tDiscard connection modifications (Esc)", + GUIIconSubSys::getIcon(ICON_CANCEL), this, MID_CANCEL, GUIDesignButton); + // Create "OK" button + mySaveButton = new FXButton(myGroupBoxModifications, "OK\t\tSave connection modifications (Enter)", + GUIIconSubSys::getIcon(ICON_ACCEPT), this, MID_OK, GUIDesignButton); + + // Create groupbox for operations + myGroupBoxOperations = new FXGroupBox(myContentFrame, "Operations", GUIDesignGroupBoxFrame); + + // Create "Select Dead Ends" button + mySelectDeadEndsButton = new FXButton(myGroupBoxOperations, "Select Dead Ends\t\tSelects all lanes that have no outgoing connection (clears previous selection)", + 0, this, MID_GNE_SELECT_DEAD_ENDS, GUIDesignButton); + // Create "Select Dead Starts" button + mySelectDeadStartsButton = new FXButton(myGroupBoxOperations, "Select Dead Starts\t\tSelects all lanes that have no incoming connection (clears previous selection)", + 0, this, MID_GNE_SELECT_DEAD_STARTS, GUIDesignButton); + // Create "Select Conflicts" button + mySelectConflictsButton = new FXButton(myGroupBoxOperations, "Select Conflicts\t\tSelects all lanes with more than one incoming connection from the same edge (clears previous selection)", + 0, this, MID_GNE_SELECT_CONFLICTS, GUIDesignButton); + // Create "Select Edges which may always pass" button + mySelectPassingButton = new FXButton(myGroupBoxOperations, "Select Passing\t\tSelects all lanes with a connection that has has the 'pass' attribute set", + 0, this, MID_GNE_SELECT_PASS, GUIDesignButton); + // Create "Clear Selected" button + myClearSelectedButton = new FXButton(myGroupBoxOperations, "Clear Selected\t\tClears all connections of all selected objects", + 0, this, MID_CHOOSEN_CLEAR, GUIDesignButton); + // Create "Reset Selected" button + myResetSelectedButton = new FXButton(myGroupBoxOperations, "Reset Selected\nJunctions\t\tRecomputes connections at all selected junctions", + 0, this, MID_CHOOSEN_RESET, GUIDesignButton); + + // Create groupbox for selection hints + myGroupBoxSelection = new FXGroupBox(myContentFrame, "Selection", GUIDesignGroupBoxFrame); - new FXHorizontalSeparator(this, SEPARATOR_GROOVE | LAYOUT_FILL_X); // Selection Hint - new FXLabel(myContentFrame, "Hold while\nclicking to create\nunyielding conn's.\n", 0, JUSTIFY_LEFT); - new FXLabel(myContentFrame, "Hold while\nclicking to create\nconflicting conn's.\n", 0, JUSTIFY_LEFT); - // Legend + myHoldShiftLabel = new FXLabel(myGroupBoxSelection, "Hold while clicking\nto create unyielding\nconnections (pass=true).", 0, GUIDesignLabelLeft); + myHoldControlLabel = new FXLabel(myGroupBoxSelection, "Hold while clicking\nto create conflicting\nconnections (i.e. at zipper nodes)", 0, GUIDesignLabelLeft); + // init colors here to avoid static order fiasco (https://isocpp.org/wiki/faq/ctors#static-init-order) sourceColor = RGBColor::CYAN; potentialTargetColor = RGBColor(0, 64, 0, 255); @@ -154,44 +138,35 @@ targetPassColor = RGBColor::MAGENTA; conflictColor = RGBColor::YELLOW; - new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4); - FXLabel* l; - new FXLabel(myContentFrame, "Color Legend:", 0, JUSTIFY_LEFT); - l = new FXLabel(myContentFrame, "Source", 0, JUSTIFY_LEFT); - l->setBackColor(MFXUtils::getFXColor(sourceColor)); - l = new FXLabel(myContentFrame, "Target", 0, JUSTIFY_LEFT); - l->setBackColor(MFXUtils::getFXColor(targetColor)); - l = new FXLabel(myContentFrame, "Possible Target", 0, JUSTIFY_LEFT); - l->setBackColor(MFXUtils::getFXColor(potentialTargetColor)); - l = new FXLabel(myContentFrame, "Target (pass)", 0, JUSTIFY_LEFT); - l->setBackColor(MFXUtils::getFXColor(targetPassColor)); - l = new FXLabel(myContentFrame, "Conflict", 0, JUSTIFY_LEFT); - l->setBackColor(MFXUtils::getFXColor(conflictColor)); -} + // create groupbox for legend + myGroupBoxLegend = new FXGroupBox(myContentFrame, "Legend", GUIDesignGroupBoxFrame); -GNEConnectorFrame::~GNEConnectorFrame() { -} + // create source label + mySourceLabel = new FXLabel(myGroupBoxLegend, "Source", 0, GUIDesignLabelLeft); + mySourceLabel->setBackColor(MFXUtils::getFXColor(sourceColor)); + // create target label + myTargetLabel = new FXLabel(myGroupBoxLegend, "Target", 0, GUIDesignLabelLeft); + myTargetLabel->setBackColor(MFXUtils::getFXColor(targetColor)); -void -GNEConnectorFrame::show() { - // Show Scroll window - FXScrollWindow::show(); - // Show Frame Area in which this GNEFrame is placed - myViewNet->getViewParent()->showFramesArea(); -} + // create possible target label + myPossibleTargetLabel = new FXLabel(myGroupBoxLegend, "Possible Target", 0, GUIDesignLabelLeft); + myPossibleTargetLabel->setBackColor(MFXUtils::getFXColor(potentialTargetColor)); + // create target (pass) label + myTargetPassLabel = new FXLabel(myGroupBoxLegend, "Target (pass)", 0, GUIDesignLabelLeft); + myTargetPassLabel->setBackColor(MFXUtils::getFXColor(targetPassColor)); -void -GNEConnectorFrame::hide() { - // Hide ScrollWindow - FXScrollWindow::hide(); - // Hide Frame Area in which this GNEFrame is placed - myViewNet->getViewParent()->hideFramesArea(); + // create conflict label + myConflictLabel = new FXLabel(myGroupBoxLegend, "Conflict", 0, GUIDesignLabelLeft); + myConflictLabel->setBackColor(MFXUtils::getFXColor(conflictColor)); } +GNEConnectorFrame::~GNEConnectorFrame() {} + + void GNEConnectorFrame::handleLaneClick(GNELane* lane, bool mayDefinitelyPass, bool allowConflict, bool toggle) { if (myCurrentLane == 0) { @@ -199,12 +174,11 @@ myCurrentLane->setSpecialColor(&sourceColor); initTargets(); myNumChanges = 0; - myViewNet->getUndoList()->p_begin("modify connections"); + myViewNet->getUndoList()->p_begin("modify " + toString(SUMO_TAG_CONNECTION) + "s"); } else if (myPotentialTargets.count(lane) || allowConflict) { const int fromIndex = myCurrentLane->getIndex(); GNEEdge& srcEdge = myCurrentLane->getParentEdge(); GNEEdge& destEdge = lane->getParentEdge(); - const std::string& destEdgeID = destEdge.getMicrosimID(); std::vector connections = srcEdge.getNBEdge()->getConnectionsFromLane(fromIndex); bool changed = false; LaneStatus status = getLaneStatus(connections, lane); @@ -215,11 +189,10 @@ case UNCONNECTED: if (toggle) { // create new connection - NBEdge::Connection newCon(fromIndex, destEdge.getNBEdge(), lane->getIndex()); + NBEdge::Connection newCon(fromIndex, destEdge.getNBEdge(), lane->getIndex(), mayDefinitelyPass); myViewNet->getUndoList()->add(new GNEChange_Connection(&srcEdge, newCon, true), true); lane->setSpecialColor(mayDefinitelyPass ? &targetPassColor : &targetColor); - GNEJunction* affected = srcEdge.getGNEJunctionDest(); - affected->invalidateTLS(myViewNet->getUndoList()); + srcEdge.getGNEJunctionDestiny()->invalidateTLS(myViewNet->getUndoList()); } break; case CONNECTED: @@ -232,14 +205,14 @@ break; } case CONFLICTED: - myViewNet->setStatusBarText("Another lane from the same edge already connects to that lane"); + myViewNet->setStatusBarText("Another lane from the same edge already connects to that " + toString(SUMO_TAG_LANE)); break; } if (changed) { myNumChanges += 1; } } else { - myViewNet->setStatusBarText("Invalid target for connection"); + myViewNet->setStatusBarText("Invalid target for " + toString(SUMO_TAG_CONNECTION)); } updateDescription(); } @@ -378,7 +351,7 @@ long GNEConnectorFrame::onCmdClearSelectedConnections(FXObject*, FXSelector, void*) { onCmdCancel(0, 0, 0); - myViewNet->getUndoList()->p_begin("clear connections from selected lanes, edges and junctions"); + myViewNet->getUndoList()->p_begin("clear connections from selected lanes, edges and " + toString(SUMO_TAG_JUNCTION) + "s"); const std::set ids = gSelected.getSelected(); for (std::set::const_iterator it = ids.begin(); it != ids.end(); it++) { GUIGlID id = *it; @@ -445,11 +418,9 @@ void GNEConnectorFrame::updateDescription() const { if (myCurrentLane == 0) { - myDescription->setText("No Lane Selected\n"); + myLaneDescriptionLabel->setText("No Lane Selected\n"); } else { - myDescription->setText(( - myCurrentLane->getMicrosimID() + "\n(" + - toString(myNumChanges) + " changes)").c_str()); + myLaneDescriptionLabel->setText(("Lane id: " + myCurrentLane->getMicrosimID() + "\nNumber of changes: " + toString(myNumChanges)).c_str()); } } @@ -457,7 +428,7 @@ void GNEConnectorFrame::initTargets() { // gather potential targets - NBNode* nbn = myCurrentLane->getParentEdge().getGNEJunctionDest()->getNBNode(); + NBNode* nbn = myCurrentLane->getParentEdge().getGNEJunctionDestiny()->getNBNode(); const EdgeVector& outgoing = nbn->getOutgoingEdges(); for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEConnectorFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEConnectorFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEConnectorFrame.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEConnectorFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEConnectorFrame.h /// @author Jakob Erdmann /// @date May 2011 -/// @version $Id: GNEConnectorFrame.h 21780 2016-10-25 10:06:16Z namdre $ +/// @version $Id: GNEConnectorFrame.h 22929 2017-02-13 14:38:39Z behrisch $ /// // The Widget for modifying lane-to-lane connections /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -50,20 +50,14 @@ public: /**@brief Constructor - * @brief parent FXFrame in which this GNEFrame is placed + * @brief parent FXHorizontalFrame in which this GNEFrame is placed * @brief viewNet viewNet that uses this GNEFrame */ - GNEConnectorFrame(FXComposite* parent, GNEViewNet* viewNet); + GNEConnectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet); /// @brief Destructor ~GNEConnectorFrame(); - /// @brief show Frame - void show(); - - /// @brief hide Frame - void hide(); - /**@brief either sets the current lane or toggles the connection of the * current lane to this lane (if they share a junction) * @param[in] lane Either the lane to set as current lane, or the destination from current lane @@ -103,8 +97,68 @@ CONFLICTED }; + /// @brief Groupbox for description + FXGroupBox* myGroupBoxDescription; + /// @brief the label that shows the current editing state - FXLabel* myDescription; + FXLabel* myLaneDescriptionLabel; + + /// @brief GroupBox for Buttons + FXGroupBox* myGroupBoxModifications; + + /// @brief "Cancel" button + FXButton* myCancelButton; + + /// @brief "OK" button + FXButton* mySaveButton; + + /// @brief groupbox for operations + FXGroupBox* myGroupBoxOperations; + + /// @brief "Select Dead Ends" button + FXButton* mySelectDeadEndsButton; + + /// @brief "Select Dead Starts" button + FXButton* mySelectDeadStartsButton; + + /// @brief "Select Conflicts" button + FXButton* mySelectConflictsButton; + + /// @brief "Select Edges which may always pass" + FXButton* mySelectPassingButton; + + /// @brief "Clear Selected" + FXButton* myClearSelectedButton; + + /// @brief "Reset Selected" + FXButton* myResetSelectedButton; + + /// @brief groupbox for selection hints + FXGroupBox* myGroupBoxSelection; + + /// @brief Selection Hint + FXLabel* myHoldShiftLabel; + + /// @brief hold control label + FXLabel* myHoldControlLabel; + + /// @brief group box for legend + FXGroupBox* myGroupBoxLegend; + + /// @brief source label + FXLabel* mySourceLabel; + + /// @brief target label + FXLabel* myTargetLabel; + + /// @brief possible target label + FXLabel* myPossibleTargetLabel; + + /// @brief target pass label + FXLabel* myTargetPassLabel; + + /// @brief conflict label + FXLabel* myConflictLabel; /// @brief the lane of which connections are to be modified GNELane* myCurrentLane; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEContainerStop.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEContainerStop.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEContainerStop.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEContainerStop.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEContainerStop.cpp /// @author Pablo Alvarez Lopez /// @date Jun 2016 -/// @version $Id: GNEContainerStop.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEContainerStop.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// /// A lane area vehicles can halt at (GNE version) /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,6 +46,7 @@ #include #include #include +#include #include "GNEContainerStop.h" #include "GNELane.h" @@ -56,16 +57,12 @@ #include "GNEChange_Attribute.h" #include "GNEViewNet.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== -GNEContainerStop::GNEContainerStop(const std::string& id, GNELane* lane, GNEViewNet* viewNet, SUMOReal startPos, SUMOReal endPos, const std::vector& lines, bool blocked) : - GNEStoppingPlace(id, viewNet, SUMO_TAG_CONTAINER_STOP, lane, startPos, endPos, blocked), +GNEContainerStop::GNEContainerStop(const std::string& id, GNELane* lane, GNEViewNet* viewNet, double startPos, double endPos, const std::vector& lines) : + GNEStoppingPlace(id, viewNet, SUMO_TAG_CONTAINER_STOP, ICON_CONTAINERSTOP, lane, startPos, endPos), myLines(lines) { // When a new additional element is created, updateGeometry() must be called updateGeometry(); @@ -89,7 +86,7 @@ myShapeLengths.clear(); // Get value of option "lefthand" - SUMOReal offsetSign = OptionsCont::getOptions().getBool("lefthand") ? -1 : 1; + double offsetSign = OptionsCont::getOptions().getBool("lefthand") ? -1 : 1; // Get shape of lane parent myShape = myLane->getShape(); @@ -98,7 +95,7 @@ myShape.move2side(1.65 * offsetSign); // Cut shape using as delimitators from start position and end position - myShape = myShape.getSubpart(myLane->getPositionRelativeToParametricLenght(myStartPos), myLane->getPositionRelativeToParametricLenght(myEndPos)); + myShape = myShape.getSubpart(myLane->getPositionRelativeToParametricLength(myStartPos), myLane->getPositionRelativeToParametricLength(myEndPos)); // Get number of parts of the shape int numberOfSegments = (int) myShape.size() - 1; @@ -123,7 +120,7 @@ myShapeLengths.push_back(f.distanceTo(s)); // Save rotation (angle) of the vector constructed by points f and s - myShapeRotations.push_back((SUMOReal) atan2((s.x() - f.x()), (f.y() - s.y())) * (SUMOReal) 180.0 / (SUMOReal) PI); + myShapeRotations.push_back((double) atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double) PI); } } @@ -148,7 +145,7 @@ void -GNEContainerStop::writeAdditional(OutputDevice& device, const std::string&) { +GNEContainerStop::writeAdditional(OutputDevice& device) const { // Write parameters device.openTag(getTag()); device.writeAttr(SUMO_ATTR_ID, getID()); @@ -191,9 +188,9 @@ } // Obtain exaggeration of the draw - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); - // Draw the area using shape, shapeRotations, shapeLenghts and value of exaggeration + // Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, exaggeration); // Check if the distance is enought to draw details @@ -203,7 +200,7 @@ glPushMatrix(); // Obtain rotation of the sing depeding of the option "lefthand" - SUMOReal rotSign = OptionsCont::getOptions().getBool("lefthand"); + double rotSign = OptionsCont::getOptions().getBool("lefthand"); // Set color of the lines if (isAdditionalSelected()) { @@ -248,10 +245,10 @@ // Start drawing sign traslating matrix to signal position glTranslated(mySignPos.x(), mySignPos.y(), 0); - // Define nº points (for efficiency) + // Define number of points (for efficiency) int noPoints = 9; - // If the scale * exaggeration is more than 25, recalculate nº points + // If the scale * exaggeration is more than 25, recalculate number of points if (s.scale * exaggeration > 25) { noPoints = MIN2((int)(9.0 + (s.scale * exaggeration) / 10.0), 36); } @@ -260,7 +257,7 @@ glScaled(exaggeration, exaggeration, 1); // Draw green circle - GLHelper::drawFilledCircle((SUMOReal) 1.1, noPoints); + GLHelper::drawFilledCircle((double) 1.1, noPoints); // Traslate to front glTranslated(0, 0, .1); @@ -273,7 +270,7 @@ } // draw another circle in the same position, but a little bit more small - GLHelper::drawFilledCircle((SUMOReal) 0.9, noPoints); + GLHelper::drawFilledCircle((double) 0.9, noPoints); // If the scale * exageration is equal or more than 4.5, draw H if (s.scale * exaggeration >= 4.5) { @@ -318,7 +315,7 @@ case GNE_ATTR_BLOCK_MOVEMENT: return toString(myBlocked); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -339,7 +336,7 @@ updateGeometry(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -360,18 +357,33 @@ return false; } case SUMO_ATTR_STARTPOS: - return (canParse(value) && parse(value) >= 0 && parse(value) < (myEndPos - 1)); + return (canParse(value) && parse(value) >= 0 && parse(value) < (myEndPos - 1)); case SUMO_ATTR_ENDPOS: { - if (canParse(value) && parse(value) >= 1 && parse(value) > myStartPos) { + if (canParse(value) && parse(value) >= 1 && parse(value) > myStartPos) { // If extension is larger than Lane - if (parse(value) > myLane->getLaneParametricLenght()) { - // Ask user if want to assign the lenght of lane as endPosition + if (parse(value) > myLane->getLaneParametricLength()) { + // write warning if netedit is running in testing mode + if (myViewNet->isTestingModeEnabled() == true) { + WRITE_WARNING("Opening FXMessageBox of type 'question'"); + } + // Ask user if want to assign the length of lane as endPosition FXuint answer = FXMessageBox::question(getViewNet()->getApp(), MBOX_YES_NO, - "EndPosition exceeds the size of the lane", "%s", - "EndPosition exceeds the size of the lane. You want to assign the size of the lane as endPosition?"); + (toString(SUMO_ATTR_ENDPOS) + " exceeds the size of the " + toString(SUMO_TAG_LANE)).c_str(), "%s", + (toString(SUMO_ATTR_ENDPOS) + " exceeds the size of the " + toString(SUMO_TAG_LANE) + + ". Do you want to assign the length of the " + toString(SUMO_TAG_LANE) + " as " + toString(SUMO_ATTR_ENDPOS) + "?").c_str()); if (answer == 1) { //1:yes, 2:no, 4:esc + // write warning if netedit is running in testing mode + if (myViewNet->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Yes'"); + } return true; } else { + // write warning if netedit is running in testing mode + if ((answer == 2) && (myViewNet->isTestingModeEnabled() == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'"); + } else if ((answer == 4) && (myViewNet->isTestingModeEnabled() == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'"); + } return false; } } else { @@ -382,11 +394,11 @@ } } case SUMO_ATTR_LINES: - return isValidStringVector(value); + return canParse >(value); case GNE_ATTR_BLOCK_MOVEMENT: return canParse(value); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -404,22 +416,21 @@ changeLane(value); break; case SUMO_ATTR_STARTPOS: - myStartPos = parse(value); + myStartPos = parse(value); updateGeometry(); getViewNet()->update(); break; case SUMO_ATTR_ENDPOS: - if (parse(value) > myLane->getLaneParametricLenght()) { - myEndPos = myLane->getLaneParametricLenght(); + if (parse(value) > myLane->getLaneParametricLength()) { + myEndPos = myLane->getLaneParametricLength(); } else { - myEndPos = parse(value); + myEndPos = parse(value); } updateGeometry(); getViewNet()->update(); break; case SUMO_ATTR_LINES: - myLines.clear(); - SUMOSAXAttributes::parseStringVector(value, myLines); + myLines = GNEAttributeCarrier::parse >(value); getViewNet()->update(); break; case GNE_ATTR_BLOCK_MOVEMENT: @@ -427,7 +438,7 @@ getViewNet()->update(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEContainerStop.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEContainerStop.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEContainerStop.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEContainerStop.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEContainerStop.h /// @author Pablo Alvarez Lopez /// @date Jun 2016 -/// @version $Id: GNEContainerStop.h 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: GNEContainerStop.h 23150 2017-02-27 12:08:30Z behrisch $ /// /// A class for visualizing busStop geometry (adapted from GUILaneWrapper) /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -64,9 +64,8 @@ * @param[in] startPos Start position of the StoppingPlace * @param[in] endPos End position of the StoppingPlace * @param[in] lines lines of the busStop - * @param[in] blocked set initial blocking state of item */ - GNEContainerStop(const std::string& id, GNELane* lane, GNEViewNet* viewNet, SUMOReal startPos, SUMOReal endPos, const std::vector& lines, bool blocked); + GNEContainerStop(const std::string& id, GNELane* lane, GNEViewNet* viewNet, double startPos, double endPos, const std::vector& lines); /// @brief Destructor ~GNEContainerStop(); @@ -77,7 +76,7 @@ /**@brief writte additional element into a xml file * @param[in] device device in which write parameters of additional element */ - void writeAdditional(OutputDevice& device, const std::string&); + void writeAdditional(OutputDevice& device) const; /// @brief get string vector with the lines of the busStop std::vector getLines() const; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECrossing.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECrossing.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECrossing.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECrossing.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNECrossing.cpp /// @author Jakob Erdmann /// @date June 2011 -/// @version $Id: GNECrossing.cpp 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: GNECrossing.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A class for visualizing Inner Lanes (used when editing traffic lights) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,20 +47,18 @@ #include "GNECrossing.h" #include "GNEJunction.h" #include "GNEUndoList.h" +#include "GNENet.h" +#include "GNEEdge.h" +#include "GNEViewNet.h" #include "GNEChange_Attribute.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== -GNECrossing::GNECrossing(GNEJunction& parentJunction, const std::string& id) : - GNENetElement(parentJunction.getNet(), id, GLO_CROSSING, SUMO_TAG_CROSSING), +GNECrossing::GNECrossing(GNEJunction* parentJunction, const std::string& id) : + GNENetElement(parentJunction->getNet(), id, GLO_CROSSING, SUMO_TAG_CROSSING, ICON_CROSSING), myParentJunction(parentJunction), - myCrossing(parentJunction.getNBNode()->getCrossing(id)), - myShape(myCrossing.shape) { + myCrossing(parentJunction->getNBNode()->getCrossingRef(id)) { // Update geometry updateGeometry(); } @@ -71,49 +69,75 @@ void GNECrossing::updateGeometry() { - int segments = (int) myShape.size() - 1; - if (segments >= 0) { - myShapeRotations.reserve(segments); - myShapeLengths.reserve(segments); - for (int i = 0; i < segments; ++i) { - const Position& f = myShape[i]; - const Position& s = myShape[i + 1]; - myShapeLengths.push_back(f.distanceTo2D(s)); - myShapeRotations.push_back((SUMOReal) atan2((s.x() - f.x()), (f.y() - s.y())) * (SUMOReal) 180.0 / (SUMOReal) PI); + // Clear Shape rotations and segments + myShapeRotations.clear(); + myShapeLengths.clear(); + // only rebuild shape if junction's shape isn't in Buuble mode + if (myParentJunction->getNBNode()->getShape().size() > 0) { + // Obtain segments of size and calculate it + int segments = (int) myCrossing.shape.size() - 1; + if (segments >= 0) { + myShapeRotations.reserve(segments); + myShapeLengths.reserve(segments); + for (int i = 0; i < segments; ++i) { + const Position& f = myCrossing.shape[i]; + const Position& s = myCrossing.shape[i + 1]; + myShapeLengths.push_back(f.distanceTo2D(s)); + myShapeRotations.push_back((double) atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double) PI); + } } } } +GNEJunction* +GNECrossing::getParentJunction() const { + return myParentJunction; +} + + +NBNode::Crossing& +GNECrossing::getNBCrossing() const { + return myCrossing; +} + + void GNECrossing::drawGL(const GUIVisualizationSettings& s) const { - if (!s.drawCrossingsAndWalkingareas) { - return; - } - glPushMatrix(); - glPushName(getGlID()); - glTranslated(0, 0, GLO_JUNCTION + 0.1); // must draw on top of junction - - if (myCrossing.priority) { - glColor3d(0.9, 0.9, 0.9); - } else { - glColor3d(0.1, 0.1, 0.1); - } - glTranslated(0, 0, .2); - // @todo: duplicate eliminate duplicate code with GNELane::drawCrossties(0.5, 1.0, myCrossing.width * 0.5); - { - SUMOReal length = 0.5; - SUMOReal spacing = 1.0; - SUMOReal halfWidth = myCrossing.width * 0.5; + // only draw if option drawCrossingsAndWalkingareas is enabled and size of shape is greather than 0 + if (s.drawCrossingsAndWalkingareas == true && myShapeRotations.size() > 0 && myShapeLengths.size() > 0) { + // push first draw matrix + glPushMatrix(); + // push name + glPushName(getGlID()); + // must draw on top of junction + glTranslated(0, 0, GLO_JUNCTION + 0.1); + // set color depending of selection and priority + if (gSelected.isSelected(getType(), getGlID())) { + glColor3d(0.118, 0.565, 1.000); + } else if (myCrossing.priority) { + glColor3d(0.9, 0.9, 0.9); + } else { + glColor3d(0.1, 0.1, 0.1); + } + // traslate to front + glTranslated(0, 0, .2); + // set default values + double length = 0.5; + double spacing = 1.0; + double halfWidth = myCrossing.width * 0.5; + // push second draw matrix glPushMatrix(); // draw on top of of the white area between the rails glTranslated(0, 0, 0.1); - int e = (int) myShape.size() - 1; - for (int i = 0; i < e; ++i) { + for (int i = 0; i < (int)myCrossing.shape.size() - 1; ++i) { + // push three draw matrix glPushMatrix(); - glTranslated(myShape[i].x(), myShape[i].y(), 0.0); + // traslete and rotate + glTranslated(myCrossing.shape[i].x(), myCrossing.shape[i].y(), 0.0); glRotated(myShapeRotations[i], 0, 0, 1); - for (SUMOReal t = 0; t < myShapeLengths[i]; t += spacing) { + // draw crossing + for (double t = 0; t < myShapeLengths[i]; t += spacing) { glBegin(GL_QUADS); glVertex2d(-halfWidth, -t); glVertex2d(-halfWidth, -t - length); @@ -121,14 +145,19 @@ glVertex2d(halfWidth, -t); glEnd(); } + // pop three draw matrix glPopMatrix(); } + // XXX draw junction index / tls index + // pop second draw matrix + glPopMatrix(); + // traslate to back + glTranslated(0, 0, -.2); + // pop name + glPopName(); + // pop draw matrix glPopMatrix(); } - - glTranslated(0, 0, -.2); - glPopName(); - glPopMatrix(); } @@ -141,8 +170,7 @@ GUIParameterTableWindow* -GNECrossing::getParameterWindow(GUIMainWindow& app, - GUISUMOAbstractView&) { +GNECrossing::getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView&) { GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this, 2); // add items @@ -154,7 +182,7 @@ Boundary GNECrossing::getCenteringBoundary() const { - Boundary b = myShape.getBoxBoundary(); + Boundary b = myCrossing.shape.getBoxBoundary(); b.grow(10); return b; } @@ -176,7 +204,7 @@ return toString(myCrossing.edges); break; default: - throw InvalidArgument("junction attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -188,14 +216,14 @@ } switch (key) { case SUMO_ATTR_ID: + throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + toString(getTag()) + " isn't allowed"); case SUMO_ATTR_EDGES: - throw InvalidArgument("modifying crossing attribute '" + toString(key) + "' not allowed"); case SUMO_ATTR_WIDTH: case SUMO_ATTR_PRIORITY: undoList->add(new GNEChange_Attribute(this, key, value), true); break; default: - throw InvalidArgument("crossing attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -204,14 +232,23 @@ GNECrossing::isValid(SumoXMLAttr key, const std::string& value) { switch (key) { case SUMO_ATTR_ID: - case SUMO_ATTR_EDGES: return false; + case SUMO_ATTR_EDGES: { + std::vector NBEdgeIDs = GNEAttributeCarrier::parse > (value); + // Obtain NBEdges of GNENet and check if exists + for (std::vector::iterator i = NBEdgeIDs.begin(); i != NBEdgeIDs.end(); i++) { + if (myNet->retrieveEdge((*i), false) == NULL) { + return false; + } + } + return true; + } case SUMO_ATTR_WIDTH: - return isPositive(value); + return isPositive(value); case SUMO_ATTR_PRIORITY: - return value == "true" || value == "false"; + return ((value == "true") || (value == "false")); default: - throw InvalidArgument("crossing attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -223,18 +260,28 @@ GNECrossing::setAttribute(SumoXMLAttr key, const std::string& value) { switch (key) { case SUMO_ATTR_ID: - case SUMO_ATTR_EDGES: - throw InvalidArgument("modifying crossing attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + toString(getTag()) + " isn't allowed"); + case SUMO_ATTR_EDGES: { + // remove edges of crossing + myCrossing.edges.clear(); + std::vector NBEdgeIDs = GNEAttributeCarrier::parse > (value); + // Obtain NBEdges of GNENet and insert it in the crossing + for (std::vector::iterator i = NBEdgeIDs.begin(); i != NBEdgeIDs.end(); i++) { + myCrossing.edges.push_back(myNet->retrieveEdge(*i)->getNBEdge()); + } + break; + } case SUMO_ATTR_WIDTH: - myCrossing.width = parse(value); - myParentJunction.updateCrossingAttributes(myCrossing); + // Change width an refresh element + myCrossing.width = parse(value); + myNet->refreshElement(this); break; case SUMO_ATTR_PRIORITY: - myCrossing.priority = value == "true"; - myParentJunction.updateCrossingAttributes(myCrossing); + myCrossing.priority = parse(value); break; default: - throw InvalidArgument("crossing attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECrossingFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECrossingFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECrossingFrame.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECrossingFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,654 @@ +/****************************************************************************/ +/// @file GNECrossingFrame.cpp +/// @author Pablo Alvarez Lopez +/// @date Oct 2016 +/// @version $Id: GNECrossingFrame.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// The Widget for add Crossing elements +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ +// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "GNECrossingFrame.h" +#include "GNEViewNet.h" +#include "GNEViewParent.h" +#include "GNENet.h" +#include "GNEJunction.h" +#include "GNEEdge.h" +#include "GNELane.h" +#include "GNECrossing.h" +#include "GNEUndoList.h" +#include "GNEChange_Selection.h" +#include "GNEAttributeCarrier.h" +#include "GNEChange_Crossing.h" +#include "GNECrossing.h" + + +// =========================================================================== +// FOX callback mapping +// =========================================================================== + +FXDEFMAP(GNECrossingFrame) GNECrossingMap[] = { + FXMAPFUNC(SEL_COMMAND, MID_GNE_CREATE_CROSSING, GNECrossingFrame::onCmdCreateCrossing), +}; + +FXDEFMAP(GNECrossingFrame::edgesSelector) GNEEdgesMap[] = { + FXMAPFUNC(SEL_COMMAND, MID_GNE_USEONLYSELECTEDEDGES, GNECrossingFrame::edgesSelector::onCmdUseSelectedEdges), + FXMAPFUNC(SEL_COMMAND, MID_GNE_CLEAREDGESELECTION, GNECrossingFrame::edgesSelector::onCmdClearSelection), + FXMAPFUNC(SEL_COMMAND, MID_GNE_INVERTEDGESELECTION, GNECrossingFrame::edgesSelector::onCmdInvertSelection), + FXMAPFUNC(SEL_COMMAND, MID_HELP, GNECrossingFrame::edgesSelector::onCmdHelp), +}; + +FXDEFMAP(GNECrossingFrame::crossingParameters) GNECrossingParametersMap[] = { + FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_ATTRIBUTE, GNECrossingFrame::crossingParameters::onCmdSetAttribute), + FXMAPFUNC(SEL_COMMAND, MID_HELP, GNECrossingFrame::crossingParameters::onCmdHelp), +}; + +// Object implementation +FXIMPLEMENT(GNECrossingFrame, FXVerticalFrame, GNECrossingMap, ARRAYNUMBER(GNECrossingMap)) +FXIMPLEMENT(GNECrossingFrame::edgesSelector, FXGroupBox, GNEEdgesMap, ARRAYNUMBER(GNEEdgesMap)) +FXIMPLEMENT(GNECrossingFrame::crossingParameters, FXGroupBox, GNECrossingParametersMap, ARRAYNUMBER(GNECrossingParametersMap)) + +// =========================================================================== +// static members +// =========================================================================== +RGBColor GNECrossingFrame::crossingParameters::myCandidateColor; +RGBColor GNECrossingFrame::crossingParameters::mySelectedColor; + +// =========================================================================== +// method definitions +// =========================================================================== + +// --------------------------------------------------------------------------- +// GNECrossingFrame::edgesSelector - methods +// --------------------------------------------------------------------------- + +GNECrossingFrame::edgesSelector::edgesSelector(FXComposite* parent, GNECrossingFrame* crossingFrameParent) : + FXGroupBox(parent, ("selection of " + toString(SUMO_TAG_EDGE) + "s").c_str(), GUIDesignGroupBoxFrame), + myCrossingFrameParent(crossingFrameParent), + myCurrentJunction(0) { + + // Create button for selected edges + myUseSelectedEdges = new FXButton(this, ("Use selected " + toString(SUMO_TAG_EDGE) + "s").c_str(), 0, this, MID_GNE_USEONLYSELECTEDEDGES, GUIDesignButton); + + // Create button for clear selection + myClearEdgesSelection = new FXButton(this, ("clear " + toString(SUMO_TAG_EDGE) + "s").c_str(), 0, this, MID_GNE_CLEAREDGESELECTION, GUIDesignButton); + + // Create button for invert selection + myInvertEdgesSelection = new FXButton(this, ("invert " + toString(SUMO_TAG_EDGE) + "s").c_str(), 0, this, MID_GNE_INVERTEDGESELECTION, GUIDesignButton); + + // Create help button + helpEdges = new FXButton(this, "Help", 0, this, MID_HELP, GUIDesignButtonRectangular); +} + + +GNECrossingFrame::edgesSelector::~edgesSelector() {} + + +GNEJunction* +GNECrossingFrame::edgesSelector::getCurrentJunction() const { + return myCurrentJunction; +} + + +void +GNECrossingFrame::edgesSelector::enableEdgeSelector(GNEJunction* currentJunction) { + // Set current junction + myCurrentJunction = currentJunction; + // Update view net to show the new colors + myCrossingFrameParent->getViewNet()->update(); + // check if use selected eges must be enabled + myUseSelectedEdges->disable(); + for (std::vector::const_iterator i = myCurrentJunction->getGNEEdges().begin(); i != myCurrentJunction->getGNEEdges().end(); i++) { + if (gSelected.isSelected((*i)->getType(), (*i)->getGlID())) { + myUseSelectedEdges->enable(); + } + } + // Enable rest of elements + helpEdges->enable(); + myClearEdgesSelection->enable(); + myInvertEdgesSelection->enable(); +} + + +void +GNECrossingFrame::edgesSelector::disableEdgeSelector() { + // disable current junction + myCurrentJunction = NULL; + // disable all elements of the edgesSelector + myUseSelectedEdges->disable(); + helpEdges->disable(); + myClearEdgesSelection->disable(); + myInvertEdgesSelection->disable(); + // Disable crossing parameters + myCrossingFrameParent->getCrossingParameters()->disableCrossingParameters(); +} + + +void +GNECrossingFrame::edgesSelector::restoreEdgeColors() { + if (myCurrentJunction != NULL) { + // restore color of all lanes of edge candidates + for (std::vector::const_iterator i = myCurrentJunction->getGNEEdges().begin(); i != myCurrentJunction->getGNEEdges().end(); i++) { + for (std::vector::const_iterator j = (*i)->getLanes().begin(); j != (*i)->getLanes().end(); j++) { + (*j)->setSpecialColor(0); + } + } + // Update view net to show the new colors + myCrossingFrameParent->getViewNet()->update(); + myCurrentJunction = NULL; + } +} + + +long +GNECrossingFrame::edgesSelector::onCmdUseSelectedEdges(FXObject*, FXSelector, void*) { + myCrossingFrameParent->getCrossingParameters()->useSelectedEdges(myCurrentJunction); + return 1; +} + + +long +GNECrossingFrame::edgesSelector::onCmdClearSelection(FXObject*, FXSelector, void*) { + myCrossingFrameParent->getCrossingParameters()->clearEdges(); + return 1; +} + + +long +GNECrossingFrame::edgesSelector::onCmdInvertSelection(FXObject*, FXSelector, void*) { + myCrossingFrameParent->getCrossingParameters()->invertEdges(myCurrentJunction); + return 1; +} + + +long +GNECrossingFrame::edgesSelector::onCmdHelp(FXObject*, FXSelector, void*) { + // @todo finish + return 0; +} + + +// --------------------------------------------------------------------------- +// GNECrossingFrame::NeteditAttributes- methods +// --------------------------------------------------------------------------- + +GNECrossingFrame::crossingParameters::crossingParameters(GNECrossingFrame* crossingFrameParent, GNECrossingFrame::edgesSelector* es) : + FXGroupBox(crossingFrameParent->myContentFrame, "Crossing parameters", GUIDesignGroupBoxFrame), + myCrossingFrameParent(crossingFrameParent), + myEdgeSelector(es), + myCurrentParametersValid(true) { + FXHorizontalFrame* crossingParameter = NULL; + // create label and string textField for edges + crossingParameter = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame); + myCrossingEdgesLabel = new FXLabel(crossingParameter, toString(SUMO_ATTR_EDGES).c_str(), 0, GUIDesignLabelAttribute); + myCrossingEdges = new FXTextField(crossingParameter, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField); + myCrossingEdgesLabel->disable(); + myCrossingEdges->disable(); + // create label and checkbox for Priority + crossingParameter = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame); + myCrossingPriorityLabel = new FXLabel(crossingParameter, toString(SUMO_ATTR_PRIORITY).c_str(), 0, GUIDesignLabelAttribute); + myCrossingPriorityCheckButton = new FXCheckButton(crossingParameter, "", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButtonAttribute); + myCrossingPriorityLabel->disable(); + myCrossingPriorityCheckButton->disable(); + // create label and textfield for width + crossingParameter = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame); + myCrossingWidthLabel = new FXLabel(crossingParameter, toString(SUMO_ATTR_WIDTH).c_str(), 0, GUIDesignLabelAttribute); + myCrossingWidth = new FXTextField(crossingParameter, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldReal); + myCrossingWidthLabel->disable(); + myCrossingWidth->disable(); + // Create help button + myHelpCrossingAttribute = new FXButton(this, "Help", 0, this, MID_HELP, GUIDesignButtonRectangular); + myHelpCrossingAttribute->disable(); + // set colors + myCandidateColor = RGBColor(0, 64, 0, 255); + mySelectedColor = RGBColor::GREEN; +} + + +GNECrossingFrame::crossingParameters::~crossingParameters() {} + + +void +GNECrossingFrame::crossingParameters::enableCrossingParameters() { + // Enable all elements of the crossing frames + myCrossingEdgesLabel->enable(); + myCrossingEdges->enable(); + myCrossingPriorityLabel->enable(); + myCrossingPriorityCheckButton->enable(); + myCrossingWidthLabel->enable(); + myCrossingWidth->enable(); + myHelpCrossingAttribute->enable(); + // set values of parameters + onCmdSetAttribute(0, 0, 0); + myCrossingPriorityCheckButton->setCheck(GNEAttributeCarrier::getDefaultValue(SUMO_TAG_CROSSING, SUMO_ATTR_PRIORITY)); + myCrossingWidth->setText(GNEAttributeCarrier::getDefaultValue(SUMO_TAG_CROSSING, SUMO_ATTR_WIDTH).c_str()); + myCrossingWidth->setTextColor(FXRGB(0, 0, 0)); +} + + +void +GNECrossingFrame::crossingParameters::disableCrossingParameters() { + // clear all values of parameters + myCrossingEdges->setText(""); + myCrossingPriorityCheckButton->setCheck(false); + myCrossingPriorityCheckButton->setText("false"); + myCrossingWidth->setText(""); + // Disable all elements of the crossing frames + myCrossingEdgesLabel->disable(); + myCrossingEdges->disable(); + myCrossingPriorityLabel->disable(); + myCrossingPriorityCheckButton->disable(); + myCrossingWidthLabel->disable(); + myCrossingWidth->disable(); + myHelpCrossingAttribute->disable(); + myCrossingFrameParent->setCreateCrossingButton(false); +} + + +bool +GNECrossingFrame::crossingParameters::isCrossingParametersEnabled() const { + return myCrossingEdgesLabel->isEnabled(); +} + + +void +GNECrossingFrame::crossingParameters::markEdge(GNEEdge* edge) { + GNEJunction* currentJunction = myCrossingFrameParent->getEdgeSelector()->getCurrentJunction(); + if (currentJunction != NULL) { + // Check if edge belongs to junction's edge + if (std::find(currentJunction->getGNEEdges().begin(), currentJunction->getGNEEdges().end(), edge) != currentJunction->getGNEEdges().end()) { + // Update text field with the new edge + std::vector crossingEdges = GNEAttributeCarrier::parse > (myCrossingEdges->getText().text()); + // Check if new edge must be added or removed + std::vector::iterator itFinder = std::find(crossingEdges.begin(), crossingEdges.end(), edge->getID()); + if (itFinder == crossingEdges.end()) { + crossingEdges.push_back(edge->getID()); + } else { + crossingEdges.erase(itFinder); + } + myCrossingEdges->setText(joinToString(crossingEdges, " ").c_str()); + } + // Update colors and attributes + onCmdSetAttribute(0, 0, 0); + } +} + + +void +GNECrossingFrame::crossingParameters::clearEdges() { + myCrossingEdges->setText(""); + // Update colors and attributes + onCmdSetAttribute(0, 0, 0); +} + + +void +GNECrossingFrame::crossingParameters::invertEdges(GNEJunction* parentJunction) { + std::vector crossingEdges; + for (std::vector::const_iterator i = parentJunction->getGNEEdges().begin(); i != parentJunction->getGNEEdges().end(); i++) { + if (std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), (*i)) == myCurrentSelectedEdges.end()) { + crossingEdges.push_back((*i)->getID()); + } + } + myCrossingEdges->setText(joinToString(crossingEdges, " ").c_str()); + // Update colors and attributes + onCmdSetAttribute(0, 0, 0); +} + + +void +GNECrossingFrame::crossingParameters::useSelectedEdges(GNEJunction* parentJunction) { + std::vector crossingEdges; + for (std::vector::const_iterator i = parentJunction->getGNEEdges().begin(); i != parentJunction->getGNEEdges().end(); i++) { + if (gSelected.isSelected((*i)->getType(), (*i)->getGlID())) { + crossingEdges.push_back((*i)->getID()); + } + } + myCrossingEdges->setText(joinToString(crossingEdges, " ").c_str()); + // Update colors and attributes + onCmdSetAttribute(0, 0, 0); +} + + +std::vector +GNECrossingFrame::crossingParameters::getCrossingEdges() const { + std::vector NBEdgeVector; + // Iterate over myCurrentSelectedEdges + for (std::vector::const_iterator i = myCurrentSelectedEdges.begin(); i != myCurrentSelectedEdges.end(); i++) { + NBEdgeVector.push_back((*i)->getNBEdge()); + } + return NBEdgeVector; +} + + +bool +GNECrossingFrame::crossingParameters::getCrossingPriority() const { + if (myCrossingPriorityCheckButton->getCheck()) { + return true; + } else { + return false; + } +} + + +bool +GNECrossingFrame::crossingParameters::isCurrentParametersValid() const { + return myCurrentParametersValid; +} + + +double +GNECrossingFrame::crossingParameters::getCrossingWidth() const { + return GNEAttributeCarrier::parse(myCrossingWidth->getText().text()); +} + + +const RGBColor& +GNECrossingFrame::crossingParameters::getCandidateColor() const { + return myCandidateColor; +} + + +const RGBColor& +GNECrossingFrame::crossingParameters::getSelectedColor() const { + return mySelectedColor; +} + + +long +GNECrossingFrame::crossingParameters::onCmdSetAttribute(FXObject*, FXSelector, void*) { + myCurrentParametersValid = true; + // get string vector with the edges + std::vector crossingEdges = GNEAttributeCarrier::parse > (myCrossingEdges->getText().text()); + // Clear selected edges + myCurrentSelectedEdges.clear(); + // iterate over vector of edge IDs + for (std::vector::iterator i = crossingEdges.begin(); i != crossingEdges.end(); i++) { + GNEEdge* edge = myCrossingFrameParent->getViewNet()->getNet()->retrieveEdge((*i), false); + GNEJunction* currentJunction = myCrossingFrameParent->getEdgeSelector()->getCurrentJunction(); + // Check that edge exists and belongs to Junction + if (edge == 0) { + myCurrentParametersValid = false; + } else if (std::find(currentJunction->getGNEEdges().begin(), currentJunction->getGNEEdges().end(), edge) == currentJunction->getGNEEdges().end()) { + myCurrentParametersValid = false; + } else { + // select or unselected edge + std::vector::iterator itFinder = std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), edge); + if (itFinder == myCurrentSelectedEdges.end()) { + myCurrentSelectedEdges.push_back(edge); + } else { + myCurrentSelectedEdges.erase(itFinder); + } + } + } + + // change color of textfield dependig of myCurrentParametersValid + if (myCurrentParametersValid) { + myCrossingEdges->setTextColor(FXRGB(0, 0, 0)); + myCrossingEdges->killFocus(); + } else { + myCrossingEdges->setTextColor(FXRGB(255, 0, 0)); + myCurrentParametersValid = false; + } + + // Update colors of edges + for (std::vector::const_iterator i = myEdgeSelector->getCurrentJunction()->getGNEEdges().begin(); i != myEdgeSelector->getCurrentJunction()->getGNEEdges().end(); i++) { + if (std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), *i) != myCurrentSelectedEdges.end()) { + for (std::vector::const_iterator j = (*i)->getLanes().begin(); j != (*i)->getLanes().end(); j++) { + (*j)->setSpecialColor(&mySelectedColor); + } + } else { + for (std::vector::const_iterator j = (*i)->getLanes().begin(); j != (*i)->getLanes().end(); j++) { + (*j)->setSpecialColor(&myCandidateColor); + } + } + } + // Update view net + myCrossingFrameParent->getViewNet()->update(); + + // Check that at least there are a selected edge + if (crossingEdges.empty()) { + myCurrentParametersValid = false; + } + + // change label of crossing priority + if (myCrossingPriorityCheckButton->getCheck()) { + myCrossingPriorityCheckButton->setText("true"); + } else { + myCrossingPriorityCheckButton->setText("false"); + } + + // Check width + if (GNEAttributeCarrier::canParse(myCrossingWidth->getText().text()) && + GNEAttributeCarrier::parse(myCrossingWidth->getText().text()) > 0) { + myCrossingWidth->setTextColor(FXRGB(0, 0, 0)); + myCrossingWidth->killFocus(); + } else { + myCrossingWidth->setTextColor(FXRGB(255, 0, 0)); + myCurrentParametersValid = false; + } + + // Enable or disable create crossing button depending of the current parameters + myCrossingFrameParent->setCreateCrossingButton(myCurrentParametersValid); + return 0; +} + + +long +GNECrossingFrame::crossingParameters::onCmdHelp(FXObject*, FXSelector, void*) { + // Create help dialog + FXDialogBox* helpDialog = new FXDialogBox(this, ("Parameters of " + toString(SUMO_TAG_CROSSING)).c_str(), GUIDesignDialogBox); + // Create FXTable + FXTable* myTable = new FXTable(helpDialog, this, MID_TABLE, TABLE_READONLY); + myTable->setVisibleRows((FXint)(GNEAttributeCarrier::allowedAttributes(SUMO_TAG_CROSSING).size())); + myTable->setVisibleColumns(3); + myTable->setTableSize((FXint)(GNEAttributeCarrier::allowedAttributes(SUMO_TAG_CROSSING).size()), 3); + myTable->setBackColor(FXRGB(255, 255, 255)); + myTable->setColumnText(0, "Name"); + myTable->setColumnText(1, "Value"); + myTable->setColumnText(2, "Definition"); + myTable->getRowHeader()->setWidth(0); + FXHeader* header = myTable->getColumnHeader(); + header->setItemJustify(0, JUSTIFY_CENTER_X); + header->setItemSize(0, 120); + header->setItemJustify(1, JUSTIFY_CENTER_X); + header->setItemSize(1, 80); + int maxSizeColumnDefinitions = 0; + // Iterate over vector of additional parameters + for (int i = 0; i < (int)GNEAttributeCarrier::allowedAttributes(SUMO_TAG_CROSSING).size(); i++) { + SumoXMLAttr attr = GNEAttributeCarrier::allowedAttributes(SUMO_TAG_CROSSING).at(i).first; + // Set name of attribute + myTable->setItem(i, 0, new FXTableItem(toString(attr).c_str())); + // Set type + FXTableItem* type = new FXTableItem(""); + if (GNEAttributeCarrier::isInt(SUMO_TAG_CROSSING, attr)) { + type->setText("int"); + } else if (GNEAttributeCarrier::isFloat(SUMO_TAG_CROSSING, attr)) { + type->setText("float"); + } else if (GNEAttributeCarrier::isTime(SUMO_TAG_CROSSING, attr)) { + type->setText("time"); + } else if (GNEAttributeCarrier::isBool(SUMO_TAG_CROSSING, attr)) { + type->setText("bool"); + } else if (GNEAttributeCarrier::isString(SUMO_TAG_CROSSING, attr)) { + type->setText("string"); + } + type->setJustify(FXTableItem::CENTER_X); + myTable->setItem(i, 1, type); + // Set definition + FXTableItem* definition = new FXTableItem(GNEAttributeCarrier::getDefinition(SUMO_TAG_CROSSING, attr).c_str()); + definition->setJustify(FXTableItem::LEFT); + myTable->setItem(i, 2, definition); + if ((int)GNEAttributeCarrier::getDefinition(SUMO_TAG_CROSSING, attr).size() > maxSizeColumnDefinitions) { + maxSizeColumnDefinitions = int(GNEAttributeCarrier::getDefinition(SUMO_TAG_CROSSING, attr).size()); + } + } + // Set size of column + header->setItemJustify(2, JUSTIFY_CENTER_X); + header->setItemSize(2, maxSizeColumnDefinitions * 6); + // Button Close + new FXButton(helpDialog, "OK\t\tclose", GUIIconSubSys::getIcon(ICON_ACCEPT), helpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK); + helpDialog->create(); + helpDialog->show(); + return 1; +} + +// --------------------------------------------------------------------------- +// GNECrossingFrame - methods +// --------------------------------------------------------------------------- + +GNECrossingFrame::GNECrossingFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet) : + GNEFrame(horizontalFrameParent, viewNet, "Crossings") { + // Create Groupbox for labels + myGroupBoxLabel = new FXGroupBox(myContentFrame, "Junction", GUIDesignGroupBoxFrame); + myCurrentJunctionLabel = new FXLabel(myGroupBoxLabel, "No junction selected", 0, GUIDesignLabelLeft); + + // Create edge Selector + myEdgeSelector = new edgesSelector(myContentFrame, this); + + // Create crossingParameters + myCrossingParameters = new crossingParameters(this, myEdgeSelector); + + // Create groupbox for create crossings + myGroupBoxButtons = new FXGroupBox(myContentFrame, "Create", GUIDesignGroupBoxFrame); + myCreateCrossingButton = new FXButton(myGroupBoxButtons, "Create crossing", 0, this, MID_GNE_CREATE_CROSSING, GUIDesignButton); + myCreateCrossingButton->disable(); + + // Create groupbox and labels for legends + myGroupBoxLegend = new FXGroupBox(myContentFrame, "Legend", GUIDesignGroupBoxFrame); + myColorCandidateLabel = new FXLabel(myGroupBoxLegend, "Candidate", 0, GUIDesignLabelLeft); + myColorCandidateLabel->setBackColor(MFXUtils::getFXColor(myCrossingParameters->getCandidateColor())); + myColorSelectedLabel = new FXLabel(myGroupBoxLegend, "Selected", 0, GUIDesignLabelLeft); + myColorSelectedLabel->setBackColor(MFXUtils::getFXColor(myCrossingParameters->getSelectedColor())); + + // disable edge selector + myEdgeSelector->disableEdgeSelector(); +} + + +GNECrossingFrame::~GNECrossingFrame() { + gSelected.remove2Update(); +} + + +void +GNECrossingFrame::hide() { + // Set default colors of edges (if a junction is yet selected) + if (myEdgeSelector->getCurrentJunction() != NULL) { + // remove color of edges + for (std::vector::const_iterator i = myEdgeSelector->getCurrentJunction()->getGNEEdges().begin(); i != myEdgeSelector->getCurrentJunction()->getGNEEdges().end(); i++) { + for (std::vector::const_iterator j = (*i)->getLanes().begin(); j != (*i)->getLanes().end(); j++) { + (*j)->setSpecialColor(0); + } + } + } + + // hide frame + GNEFrame::hide(); +} + + +bool +GNECrossingFrame::addCrossing(GNENetElement* netElement) { + // cast netElement + GNEJunction* currentJunction = dynamic_cast(netElement); + GNEEdge* selectedEdge = dynamic_cast(netElement); + GNELane* selectedLane = dynamic_cast(netElement); + + // If current element is a junction + if (currentJunction != NULL) { + // change label + myCurrentJunctionLabel->setText((std::string("Current Junction: ") + currentJunction->getID()).c_str()); + // Enable edge selector and crossing parameters + myEdgeSelector->enableEdgeSelector(currentJunction); + myCrossingParameters->enableCrossingParameters(); + } else if (selectedEdge != NULL) { + myCrossingParameters->markEdge(selectedEdge); + } else if (selectedLane != NULL) { + myCrossingParameters->markEdge(&selectedLane->getParentEdge()); + } else { + // set default label + myCurrentJunctionLabel->setText("No junction selected"); + // restore color of all lanes of edge candidates + myEdgeSelector->restoreEdgeColors(); + // Disable edge selector + myEdgeSelector->disableEdgeSelector(); + } + return false; +} + + +long +GNECrossingFrame::onCmdCreateCrossing(FXObject*, FXSelector, void*) { + // First check that current parameters are valid + if (myCrossingParameters->isCurrentParametersValid()) { + // iterate over junction's crossing to find duplicated crossings + if (myEdgeSelector->getCurrentJunction()->getNBNode()->checkCrossingDuplicated(myCrossingParameters->getCrossingEdges()) == false) { + // create new crossing + myViewNet->getUndoList()->add(new GNEChange_Crossing(myEdgeSelector->getCurrentJunction(), + myCrossingParameters->getCrossingEdges(), + myCrossingParameters->getCrossingWidth(), + myCrossingParameters->getCrossingPriority(), + true), true); + // clear selected edges + myEdgeSelector->onCmdClearSelection(0, 0, 0); + } else { + WRITE_WARNING("There is already another crossing with the same edges in the junction; Duplicated crossing aren't allowed."); + } + } + return 1; +} + + +void +GNECrossingFrame::setCreateCrossingButton(bool value) { + if (value) { + myCreateCrossingButton->enable(); + } else { + myCreateCrossingButton->disable(); + } +} + + +GNECrossingFrame::edgesSelector* +GNECrossingFrame::getEdgeSelector() const { + return myEdgeSelector; +} + + +GNECrossingFrame::crossingParameters* +GNECrossingFrame::getCrossingParameters() const { + return myCrossingParameters; +} + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECrossingFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECrossingFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECrossingFrame.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECrossingFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,314 @@ +/****************************************************************************/ +/// @file GNECrossingFrame.h +/// @author Pablo Alvarez Lopez +/// @date Oct 2016 +/// @version $Id: GNECrossingFrame.h 23958 2017-04-17 10:00:31Z palcraft $ +/// +/// The Widget for add Crossing elements +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ +// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNECrossingFrame_h +#define GNECrossingFrame_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include "GNEFrame.h" + +// =========================================================================== +// class declarations +// =========================================================================== +class GNENetElement; +class GNECrossing; +class GNEJunction; +class GNEEdge; + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class GNECrossingFrame + * The Widget for setting internal attributes of Crossing elements + */ +class GNECrossingFrame : public GNEFrame { + /// @brief FOX-declaration + FXDECLARE(GNECrossingFrame) + +public: + + // =========================================================================== + // class edgesSelector + // =========================================================================== + + class edgesSelector : public FXGroupBox { + /// @brief FOX-declaration + FXDECLARE(GNECrossingFrame::edgesSelector) + + public: + /// @brief constructor + edgesSelector(FXComposite* parent, GNECrossingFrame* crossingFrameParent); + + /// @brief destructor + ~edgesSelector(); + + /// @brief get current junction + GNEJunction* getCurrentJunction() const; + + /// @brief enable edgeSelector + void enableEdgeSelector(GNEJunction* currentJunction); + + /// @brief disable edgeSelector + void disableEdgeSelector(); + + /// @brief restore colors of all edges + void restoreEdgeColors(); + + /// @brief return candidate color + const RGBColor& getCandidateColor() const; + + /// @brief return selected color + const RGBColor& getSelectedColor() const; + + /// @name FOX-callbacks + /// @{ + /// @brief called when useSelectedEdges button edge is pressed + long onCmdUseSelectedEdges(FXObject*, FXSelector, void*); + + /// @brief called when clear selection button is pressed + long onCmdClearSelection(FXObject*, FXSelector, void*); + + /// @brief called when invert selection button is pressed + long onCmdInvertSelection(FXObject*, FXSelector, void*); + + /// @brief called when help button is pressed + long onCmdHelp(FXObject*, FXSelector, void*); + /// @} + + protected: + /// @brief FOX needs this + edgesSelector() {} + + private: + /// @brief pointer to GNECrossingFrame parent + GNECrossingFrame* myCrossingFrameParent; + + /// @brief CheckBox for selected edges + FXButton* myUseSelectedEdges; + + /// @brief button for help + FXButton* helpEdges; + + /// @brief button for clear selection + FXButton* myClearEdgesSelection; + + /// @brief button for invert selection + FXButton* myInvertEdgesSelection; + + /// @brief current Junction + GNEJunction* myCurrentJunction; + }; + + // =========================================================================== + // class crossingParameters + // =========================================================================== + + class crossingParameters : public FXGroupBox { + /// @brief FOX-declaration + FXDECLARE(GNECrossingFrame::crossingParameters) + + public: + /// @brief constructor + crossingParameters(GNECrossingFrame* crossingFrameParent, GNECrossingFrame::edgesSelector* es); + + /// @brief destructor + ~crossingParameters(); + + /// @brief enable crossing parameters and set the default value of parameters + void enableCrossingParameters(); + + /// @brief disable crossing parameters and clear parameters + void disableCrossingParameters(); + + /// @brief check if currently the crossingParameters is enabled + bool isCrossingParametersEnabled() const; + + /// @brief mark or dismark edge + void markEdge(GNEEdge* edge); + + /// @brief clear edges + void clearEdges(); + + /// @brief invert edges + void invertEdges(GNEJunction* parentJunction); + + /// @brief use selected eges + void useSelectedEdges(GNEJunction* parentJunction); + + /// @brief get crossing NBedges + std::vector getCrossingEdges() const; + + /// @brief get crossing priority + bool getCrossingPriority() const; + + /// @brief get crossing width + double getCrossingWidth() const; + + /// @brief get candidate color + const RGBColor& getCandidateColor() const; + + /// @brief get selected color + const RGBColor& getSelectedColor() const; + + /// @brief check if current parameters are valid + bool isCurrentParametersValid() const; + + /// @name FOX-callbacks + /// @{ + /// @brief Called when user set a value + long onCmdSetAttribute(FXObject*, FXSelector, void*); + + /// @brief Called when help button is pressed + long onCmdHelp(FXObject*, FXSelector, void*); + /// @} + + protected: + /// @brief FOX needs this + crossingParameters() {} + + private: + /// @brief pointer to GNECrossingFrame parent + GNECrossingFrame* myCrossingFrameParent; + + /// @brief pointer to edge selector + GNECrossingFrame::edgesSelector* myEdgeSelector; + + /// @brief current selected edges + std::vector myCurrentSelectedEdges; + + /// @brief Label for edges + FXLabel* myCrossingEdgesLabel; + + /// @brief TextField for edges + FXTextField* myCrossingEdges; + + /// @brief Label for Priority + FXLabel* myCrossingPriorityLabel; + + /// @brief CheckBox for Priority + FXCheckButton* myCrossingPriorityCheckButton; + + /// @brief Label for width + FXLabel* myCrossingWidthLabel; + + /// @brief TextField for width + FXTextField* myCrossingWidth; + + /// @brief button for help + FXButton* myHelpCrossingAttribute; + + /// @brief flag to check if current parameters are valid + bool myCurrentParametersValid; + + /// @brief color for candidate edges + static RGBColor myCandidateColor; + + /// @brief color for selected edges + static RGBColor mySelectedColor; + }; + + + /**@brief Constructor + * @brief parent FXHorizontalFrame in which this GNEFrame is placed + * @brief viewNet viewNet that uses this GNEFrame + */ + GNECrossingFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet); + + /// @brief Destructor + ~GNECrossingFrame(); + + /// @brief hide crossing frame + void hide(); + + /**@brief add Crossing element + * @param[in] netElement clicked netElement. if user didn't clicked over a GNENetElement in view, netElement will be NULL + * @return true if a GNECrossing was added, false in other case + */ + bool addCrossing(GNENetElement* netElement); + + /**@brief remove an Crossing element previously added + * @param[in] Crossing element to erase + */ + void removeCrossing(GNECrossing* Crossing); + + /// @brief enable or disable button create edges + void setCreateCrossingButton(bool value); + + /// @name FOX-callbacks + /// @{ + /// @brief Called when the user press the button create edge + long onCmdCreateCrossing(FXObject*, FXSelector, void*); + /// @} + + /// @brief get list of selecte id's in string format + static std::string getIdsSelected(const FXList* list); + + /// @brief get edge selector + GNECrossingFrame::edgesSelector* getEdgeSelector() const; + + /// @brief get Crossing parameters + GNECrossingFrame::crossingParameters* getCrossingParameters() const; + +protected: + /// @brief FOX needs this + GNECrossingFrame() {} + +private: + /// @brief edge selector + GNECrossingFrame::edgesSelector* myEdgeSelector; + + /// @brief crossing parameters + GNECrossingFrame::crossingParameters* myCrossingParameters; + + /// @brief groupbox for the junction label + FXGroupBox* myGroupBoxLabel; + + /// @brief Label for current Junction + FXLabel* myCurrentJunctionLabel; + + /// @brief groupbox for buttons + FXGroupBox* myGroupBoxButtons; + + /// @field FXButton for create Crossing + FXButton* myCreateCrossingButton; + + /// @brief groupbox for Legend + FXGroupBox* myGroupBoxLegend; + + /// @brief Label for color candidate + FXLabel* myColorCandidateLabel; + + /// @brief Label for color selected + FXLabel* myColorSelectedLabel; +}; + + +#endif + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECrossing.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECrossing.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNECrossing.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNECrossing.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNECrossing.h /// @author Jakob Erdmann /// @date June 2011 -/// @version $Id: GNECrossing.h 20975 2016-06-15 13:02:40Z palcraft $ +/// @version $Id: GNECrossing.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A class for visualizing Inner Lanes (used when editing traffic lights) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -49,16 +49,13 @@ * editor (hence inheritance from FXDelegator) */ class GNECrossing : public GNENetElement { - public: /**@brief Constructor - * @param[in] editor The editor to notify about changes - * @param[in] id The id of this internal lane - * @param[in] shape The shape of the lane - * @param[in] tlIndex The tl-index of the lane + * @param[in] parentJunction GNEJunction in which this crossing is placed + * @param[in] id The id of the crossing (inmutable) */ - GNECrossing(GNEJunction& parentJunction, const std::string& id); + GNECrossing(GNEJunction* parentJunction, const std::string& id); /// @brief Destructor virtual ~GNECrossing(); @@ -66,6 +63,12 @@ /// @brief update pre-computed geometry information void updateGeometry(); + /// @brief get parent Junction + GNEJunction* getParentJunction() const; + + ///@brief get referente to NBode::Crossing + NBNode::Crossing& getNBCrossing() const; + /// @name inherited from GUIGlObject /// @{ /**@brief Returns an own popup-menu @@ -125,10 +128,10 @@ private: /// @brief the parent junction of this crossing - GNEJunction& myParentJunction; + GNEJunction* myParentJunction; /// @brief the data for this crossing - NBNode::Crossing myCrossing; + NBNode::Crossing& myCrossing; /// @brief the shape of the edge const PositionVector myShape; @@ -136,10 +139,10 @@ /// @name computed only once (for performance) in updateGeometry() /// @{ /// The rotations of the shape parts - std::vector myShapeRotations; + std::vector myShapeRotations; /// The lengths of the shape parts - std::vector myShapeLengths; + std::vector myShapeLengths; /// @} /// @brief the created popup @@ -154,7 +157,6 @@ /// @brief Invalidated assignment operator. GNECrossing& operator=(const GNECrossing&); - }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDeleteFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDeleteFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDeleteFrame.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDeleteFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,566 @@ +/****************************************************************************/ +/// @file GNEDeleteFrame.cpp +/// @author Pablo Alvarez Lopex +/// @date Dec 2016 +/// @version $Id: GNEDeleteFrame.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +// The Widget for remove network-elements +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "GNEAdditionalFrame.h" +#include "GNEAttributeCarrier.h" +#include "GNEChange_Selection.h" +#include "GNEConnection.h" +#include "GNECrossing.h" +#include "GNEDeleteFrame.h" +#include "GNEEdge.h" +#include "GNEInspectorFrame.h" +#include "GNEJunction.h" +#include "GNELane.h" +#include "GNENet.h" +#include "GNEPOI.h" +#include "GNEPoly.h" +#include "GNEUndoList.h" +#include "GNEViewNet.h" +#include "GNEViewParent.h" +#include "GNERerouter.h" + + +// =========================================================================== +// FOX callback mapping +// =========================================================================== + +FXDEFMAP(GNEDeleteFrame) GNEDeleteFrameMap[] = { + FXMAPFUNC(SEL_RIGHTBUTTONRELEASE, MID_GNE_CHILDS, GNEDeleteFrame::onCmdShowChildMenu), + FXMAPFUNC(SEL_COMMAND, MID_GNE_DELETEFRAME_CENTER, GNEDeleteFrame::onCmdCenterItem), + FXMAPFUNC(SEL_COMMAND, MID_GNE_DELETEFRAME_INSPECT, GNEDeleteFrame::onCmdInspectItem), + FXMAPFUNC(SEL_COMMAND, MID_GNE_DELETEFRAME_DELETE, GNEDeleteFrame::onCmdDeleteItem), +}; + +// Object implementation +FXIMPLEMENT(GNEDeleteFrame, FXVerticalFrame, GNEDeleteFrameMap, ARRAYNUMBER(GNEDeleteFrameMap)) + +// =========================================================================== +// method definitions +// =========================================================================== +GNEDeleteFrame::GNEDeleteFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet) : + GNEFrame(horizontalFrameParent, viewNet, "Delete"), + myCurrentAC(NULL), + myMarkedAC(NULL) { + // Create Groupbox for current element + myGroupBoxCurrentElement = new FXGroupBox(myContentFrame, "Current element", GUIDesignGroupBoxFrame); + myCurrentElementLabel = new FXLabel(myGroupBoxCurrentElement, "No item under cursor", 0, GUIDesignLabelLeft); + + // Create Groupbox for current element + myGroupBoxOptions = new FXGroupBox(myContentFrame, "Options", GUIDesignGroupBoxFrame); + + // Create checkbox for enabling/disabling automatic deletion of additionals childs (by default, enabled) + myAutomaticallyDeleteAdditionalsCheckButton = new FXCheckButton(myGroupBoxOptions, "Force deletion of additionals", this, MID_GNE_AUTOMATICALLYDELETEADDITIONALS, GUIDesignCheckButtonAttribute); + myAutomaticallyDeleteAdditionalsCheckButton->setCheck(true); + + // Create groupbox for tree list + myGroupBoxTreeList = new FXGroupBox(myContentFrame, "Childs", GUIDesignGroupBoxFrame); + myMarkedElementLabel = new FXLabel(myGroupBoxTreeList, "No item marked", 0, GUIDesignLabelLeft); + myTreelist = new FXTreeList(myGroupBoxTreeList, this, MID_GNE_CHILDS, GUIDesignTreeListFrame); + + // Create groupbox for help + myGroupBoxInformation = new FXGroupBox(myContentFrame, "Information", GUIDesignGroupBoxFrame); + myInformationLabel = new FXLabel(myGroupBoxInformation, " - Left click to delete element.\n - Hold and left click\n to mark element.\n - Left click in another element\n dismark marked element.", 0, GUIDesignLabelLeft); +} + + +GNEDeleteFrame::~GNEDeleteFrame() {} + + +void +GNEDeleteFrame::showAttributeCarrierChilds(GNEAttributeCarrier* ac) { + myCurrentAC = ac; + // clear items + myTreelist->clearItems(); + myTreeItemToACMap.clear(); + myTreeItemsWithoutAC.clear(); + // Switch gl type of ac + if (ac) { + switch (dynamic_cast(ac)->getType()) { + case GLO_JUNCTION: { + // insert junction root + GNEJunction* junction = dynamic_cast(ac); + FXTreeItem* junctionItem = myTreelist->insertItem(0, 0, toString(junction->getTag()).c_str(), junction->getIcon(), junction->getIcon()); + myTreeItemToACMap[junctionItem] = junction; + junctionItem->setExpanded(true); + // insert edges + for (int i = 0; i < (int)junction->getGNEEdges().size(); i++) { + GNEEdge* edge = junction->getGNEEdges().at(i); + FXTreeItem* edgeItem = myTreelist->insertItem(0, junctionItem, (toString(edge->getTag()) + " " + toString(i)).c_str(), edge->getIcon(), edge->getIcon()); + myTreeItemToACMap[edgeItem] = edge; + edgeItem->setExpanded(true); + // insert lanes + for (int j = 0; j < (int)edge->getLanes().size(); j++) { + GNELane* lane = edge->getLanes().at(j); + FXTreeItem* laneItem = myTreelist->insertItem(0, edgeItem, (toString(lane->getTag()) + " " + toString(j)).c_str(), lane->getIcon(), lane->getIcon()); + myTreeItemToACMap[laneItem] = lane; + laneItem->setExpanded(true); + // insert additionals of lanes + for (int k = 0; k < (int)lane->getAdditionalChilds().size(); k++) { + GNEAdditional* additional = lane->getAdditionalChilds().at(k); + FXTreeItem* additionalItem = myTreelist->insertItem(0, laneItem, (toString(additional->getTag()) + " " + toString(k)).c_str(), additional->getIcon(), additional->getIcon()); + myTreeItemToACMap[additionalItem] = additional; + additionalItem->setExpanded(true); + } + // insert incoming connections of lanes (by default isn't expanded) + if (lane->getGNEIncomingConnections().size() > 0) { + FXTreeItem* incomingConnections = myTreelist->insertItem(0, laneItem, "Incomings", lane->getGNEIncomingConnections().front()->getIcon(), lane->getGNEIncomingConnections().front()->getIcon()); + myTreeItemsWithoutAC.insert(incomingConnections); + incomingConnections->setExpanded(false); + for (int k = 0; k < (int)lane->getGNEIncomingConnections().size(); k++) { + GNEConnection* connection = lane->getGNEIncomingConnections().at(k); + FXTreeItem* connectionItem = myTreelist->insertItem(0, incomingConnections, (toString(connection->getTag()) + " " + toString(k)).c_str(), connection->getIcon(), connection->getIcon()); + myTreeItemToACMap[connectionItem] = connection; + connectionItem->setExpanded(true); + } + } + // insert outcoming connections of lanes (by default isn't expanded) + if (lane->getGNEOutcomingConnections().size() > 0) { + FXTreeItem* outgoingConnections = myTreelist->insertItem(0, laneItem, "Outcomings", lane->getGNEOutcomingConnections().front()->getIcon(), lane->getGNEOutcomingConnections().front()->getIcon()); + myTreeItemsWithoutAC.insert(outgoingConnections); + outgoingConnections->setExpanded(false); + for (int k = 0; k < (int)lane->getGNEOutcomingConnections().size(); k++) { + GNEConnection* connection = lane->getGNEOutcomingConnections().at(k); + FXTreeItem* connectionItem = myTreelist->insertItem(0, outgoingConnections, (toString(connection->getTag()) + " " + toString(k)).c_str(), connection->getIcon(), connection->getIcon()); + myTreeItemToACMap[connectionItem] = connection; + connectionItem->setExpanded(true); + } + } + } + // insert additionals of edge + for (int j = 0; j < (int)edge->getAdditionalChilds().size(); j++) { + GNEAdditional* additional = edge->getAdditionalChilds().at(j); + FXTreeItem* additionalItem = myTreelist->insertItem(0, edgeItem, (toString(additional->getTag()) + " " + toString(j)).c_str(), additional->getIcon(), additional->getIcon()); + myTreeItemToACMap[additionalItem] = additional; + additionalItem->setExpanded(true); + } + + } + // insert crossings + for (int i = 0; i < (int)junction->getGNECrossings().size(); i++) { + GNECrossing* crossing = junction->getGNECrossings().at(i); + FXTreeItem* crossingItem = myTreelist->insertItem(0, junctionItem, (toString(crossing->getTag()) + " " + toString(i)).c_str(), crossing->getIcon(), crossing->getIcon()); + myTreeItemToACMap[crossingItem] = crossing; + crossingItem->setExpanded(true); + } + break; + } + case GLO_EDGE: { + // insert edge root + GNEEdge* edge = dynamic_cast(ac); + FXTreeItem* edgeItem = myTreelist->insertItem(0, 0, toString(edge->getTag()).c_str(), edge->getIcon(), edge->getIcon()); + myTreeItemToACMap[edgeItem] = edge; + edgeItem->setExpanded(true); + // insert lanes + for (int i = 0; i < (int)edge->getLanes().size(); i++) { + GNELane* lane = edge->getLanes().at(i); + FXTreeItem* laneItem = myTreelist->insertItem(0, edgeItem, (toString(lane->getTag()) + " " + toString(i)).c_str(), lane->getIcon(), lane->getIcon()); + myTreeItemToACMap[laneItem] = lane; + laneItem->setExpanded(true); + // insert additionals of lanes + for (int j = 0; j < (int)lane->getAdditionalChilds().size(); j++) { + GNEAdditional* additional = lane->getAdditionalChilds().at(j); + FXTreeItem* additionalItem = myTreelist->insertItem(0, laneItem, (toString(additional->getTag()) + " " + toString(j)).c_str(), additional->getIcon(), additional->getIcon()); + myTreeItemToACMap[additionalItem] = additional; + additionalItem->setExpanded(true); + } + // insert incoming connections of lanes (by default isn't expanded) + if (lane->getGNEIncomingConnections().size() > 0) { + FXTreeItem* incomingConnections = myTreelist->insertItem(0, laneItem, "Incomings", lane->getGNEIncomingConnections().front()->getIcon(), lane->getGNEIncomingConnections().front()->getIcon()); + myTreeItemsWithoutAC.insert(incomingConnections); + incomingConnections->setExpanded(false); + for (int j = 0; j < (int)lane->getGNEIncomingConnections().size(); j++) { + GNEConnection* connection = lane->getGNEIncomingConnections().at(j); + FXTreeItem* connectionItem = myTreelist->insertItem(0, incomingConnections, (toString(connection->getTag()) + " " + toString(j)).c_str(), connection->getIcon(), connection->getIcon()); + myTreeItemToACMap[connectionItem] = connection; + connectionItem->setExpanded(true); + } + } + // insert outcoming connections of lanes (by default isn't expanded) + if (lane->getGNEOutcomingConnections().size() > 0) { + FXTreeItem* outgoingConnections = myTreelist->insertItem(0, laneItem, "Outcomings", lane->getGNEOutcomingConnections().front()->getIcon(), lane->getGNEOutcomingConnections().front()->getIcon()); + myTreeItemsWithoutAC.insert(outgoingConnections); + outgoingConnections->setExpanded(false); + for (int j = 0; j < (int)lane->getGNEOutcomingConnections().size(); j++) { + GNEConnection* connection = lane->getGNEOutcomingConnections().at(j); + FXTreeItem* connectionItem = myTreelist->insertItem(0, outgoingConnections, (toString(connection->getTag()) + " " + toString(j)).c_str(), connection->getIcon(), connection->getIcon()); + myTreeItemToACMap[connectionItem] = connection; + connectionItem->setExpanded(true); + } + } + } + // insert additionals of edge + for (int i = 0; i < (int)edge->getAdditionalChilds().size(); i++) { + GNEAdditional* additional = edge->getAdditionalChilds().at(i); + FXTreeItem* additionalItem = myTreelist->insertItem(0, edgeItem, (toString(additional->getTag()) + " " + toString(i)).c_str(), additional->getIcon(), additional->getIcon()); + myTreeItemToACMap[additionalItem] = additional; + additionalItem->setExpanded(true); + } + // add a extra section for rerouter in which this edge is part + if (edge->getNumberOfGNERerouters() > 0) { + FXTreeItem* rerouters = myTreelist->insertItem(0, edgeItem, (toString(SUMO_TAG_REROUTER) + "s").c_str(), edge->getGNERerouters().front()->getIcon(), edge->getGNERerouters().front()->getIcon()); + myTreeItemsWithoutAC.insert(rerouters); + rerouters->setExpanded(true); + // insert reroutes of edge + for (int i = 0; i < (int)edge->getNumberOfGNERerouters(); i++) { + GNERerouter* rerouter = edge->getGNERerouters().at(i); + FXTreeItem* rerouterItem = myTreelist->insertItem(0, rerouters, (toString(rerouter->getTag()) + " " + toString(i)).c_str(), rerouter->getIcon(), rerouter->getIcon()); + myTreeItemToACMap[rerouterItem] = rerouter; + rerouterItem->setExpanded(true); + } + } + break; + } + case GLO_LANE: { + // insert lane root + GNELane* lane = dynamic_cast(ac); + FXTreeItem* laneItem = myTreelist->insertItem(0, 0, toString(lane->getTag()).c_str(), lane->getIcon(), lane->getIcon()); + myTreeItemToACMap[laneItem] = lane; + laneItem->setExpanded(true); + // insert additionals of lanes + for (int i = 0; i < (int)lane->getAdditionalChilds().size(); i++) { + GNEAdditional* additional = lane->getAdditionalChilds().at(i); + FXTreeItem* additionalItem = myTreelist->insertItem(0, laneItem, (toString(additional->getTag()) + " " + toString(i)).c_str(), additional->getIcon(), additional->getIcon()); + myTreeItemToACMap[additionalItem] = additional; + additionalItem->setExpanded(true); + } + // insert incoming connections of lanes (by default isn't expanded) + if (lane->getGNEIncomingConnections().size() > 0) { + FXTreeItem* incomingConnections = myTreelist->insertItem(0, laneItem, "Incomings", lane->getGNEIncomingConnections().front()->getIcon(), lane->getGNEIncomingConnections().front()->getIcon()); + myTreeItemsWithoutAC.insert(incomingConnections); + incomingConnections->setExpanded(false); + for (int i = 0; i < (int)lane->getGNEIncomingConnections().size(); i++) { + GNEConnection* connection = lane->getGNEIncomingConnections().at(i); + FXTreeItem* connectionItem = myTreelist->insertItem(0, incomingConnections, (toString(connection->getTag()) + " " + toString(i)).c_str(), connection->getIcon(), connection->getIcon()); + myTreeItemToACMap[connectionItem] = connection; + connectionItem->setExpanded(true); + } + } + // insert outcoming connections of lanes (by default isn't expanded) + if (lane->getGNEOutcomingConnections().size() > 0) { + FXTreeItem* outgoingConnections = myTreelist->insertItem(0, laneItem, "Outcomings", lane->getGNEOutcomingConnections().front()->getIcon(), lane->getGNEOutcomingConnections().front()->getIcon()); + myTreeItemsWithoutAC.insert(outgoingConnections); + outgoingConnections->setExpanded(false); + for (int i = 0; i < (int)lane->getGNEOutcomingConnections().size(); i++) { + GNEConnection* connection = lane->getGNEOutcomingConnections().at(i); + FXTreeItem* connectionItem = myTreelist->insertItem(0, outgoingConnections, (toString(connection->getTag()) + " " + toString(i)).c_str(), connection->getIcon(), connection->getIcon()); + myTreeItemToACMap[connectionItem] = connection; + connectionItem->setExpanded(true); + } + } + break; + } + case GLO_POI: { + // insert POI root + GNEPOI* POI = dynamic_cast(ac); + FXTreeItem* POIItem = myTreelist->insertItem(0, 0, toString(POI->getTag()).c_str(), POI->getIcon(), POI->getIcon()); + myTreeItemToACMap[POIItem] = POI; + POIItem->setExpanded(true); + break; + } + case GLO_POLYGON: { + // insert polygon root + GNEPoly* polygon = dynamic_cast(ac); + FXTreeItem* polygonItem = myTreelist->insertItem(0, 0, toString(polygon->getTag()).c_str(), polygon->getIcon(), polygon->getIcon()); + myTreeItemToACMap[polygonItem] = polygon; + polygonItem->setExpanded(true); + break; + } + case GLO_CROSSING: { + // insert crossing root + GNECrossing* crossing = dynamic_cast(ac); + FXTreeItem* crossingItem = myTreelist->insertItem(0, 0, toString(crossing->getTag()).c_str(), crossing->getIcon(), crossing->getIcon()); + myTreeItemToACMap[crossingItem] = crossing; + crossingItem->setExpanded(true); + break; + } + case GLO_ADDITIONAL: { + // insert additional root + GNEAdditional* additional = dynamic_cast(ac); + FXTreeItem* additionalItem = myTreelist->insertItem(0, 0, toString(additional->getTag()).c_str(), additional->getIcon(), additional->getIcon()); + myTreeItemToACMap[additionalItem] = additional; + additionalItem->setExpanded(true); + break; + } + case GLO_CONNECTION: { + // insert connection root + GNEConnection* connection = dynamic_cast(ac); + FXTreeItem* connectionItem = myTreelist->insertItem(0, 0, toString(connection->getTag()).c_str(), connection->getIcon(), connection->getIcon()); + myTreeItemToACMap[connectionItem] = connection; + connectionItem->setExpanded(true); + break; + } + default: { + break; + } + } + } +} + + +void +GNEDeleteFrame::removeAttributeCarrier(GNEAttributeCarrier* ac) { + // To remove an attribute carrier deleteFrame must be visible + if (shown() == false) { + // Hide inspector frame and show delete frame + myViewNet->getViewParent()->getInspectorFrame()->hide(); + show(); + } else { + // check type of of GL object + switch (dynamic_cast(ac)->getType()) { + case GLO_JUNCTION: { + myViewNet->getNet()->deleteJunction(dynamic_cast(ac), myViewNet->getUndoList()); + break; + } + case GLO_EDGE: { + GNEEdge* edge = dynamic_cast(ac); + int numberOfAdditionals = (int)edge->getAdditionalChilds().size(); + int numberOfRerouters = (int)edge->getGNERerouters().size(); + // Iterate over lanes and obtain total number of additional childs + for (std::vector::const_iterator i = edge->getLanes().begin(); i != edge->getLanes().end(); i++) { + numberOfAdditionals += (int)(*i)->getAdditionalChilds().size(); + } + // Check if edge can be deleted + if (myAutomaticallyDeleteAdditionalsCheckButton->getCheck()) { + myViewNet->getNet()->deleteGeometryOrEdge(edge, myViewNet->getPositionInformation(), myViewNet->getUndoList()); + } else { + if (numberOfAdditionals > 0) { + // write warning if netedit is running in testing mode + if (myViewNet->isTestingModeEnabled() == true) { + WRITE_WARNING("Opening FXMessageBox of type 'warning'"); + } + std::string plural = numberOfAdditionals > 1 ? "s" : ""; + // Open warning DialogBox + FXMessageBox::warning(getViewNet()->getApp(), MBOX_OK, ("Problem deleting " + toString(edge->getTag())).c_str(), "%s", + (toString(edge->getTag()) + " '" + edge->getID() + "' cannot be deleted because owns " + + toString(numberOfAdditionals) + " additional child" + plural + ".\n Check 'Force deletion of additionals' to force deletion.").c_str()); + // write warning if netedit is running in testing mode + if (myViewNet->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'"); + } + } else if (numberOfRerouters > 0) { + // write warning if netedit is running in testing mode + if (myViewNet->isTestingModeEnabled() == true) { + WRITE_WARNING("Opening FXMessageBox of type 'warning'"); + } + std::string plural = numberOfRerouters > 1 ? "s" : ""; + // Open warning DialogBox + FXMessageBox::warning(getViewNet()->getApp(), MBOX_OK, ("Problem deleting " + toString(edge->getTag())).c_str(), "%s", + (toString(edge->getTag()) + " '" + edge->getID() + "' cannot be deleted because is part of " + + toString(numberOfRerouters) + " " + toString(SUMO_TAG_REROUTER) + plural + ".\n Check 'Force deletion of additionals' to force deletion.").c_str()); + // write warning if netedit is running in testing mode + if (myViewNet->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'"); + } + } else { + myViewNet->getNet()->deleteGeometryOrEdge(edge, myViewNet->getPositionInformation(), myViewNet->getUndoList()); + } + } + break; + } + case GLO_LANE: { + GNELane* lane = dynamic_cast(ac); + // Check if lane can be deleted + if (myAutomaticallyDeleteAdditionalsCheckButton->getCheck()) { + myViewNet->getNet()->deleteLane(lane, myViewNet->getUndoList()); + } else { + if (lane->getAdditionalChilds().size() == 0) { + myViewNet->getNet()->deleteLane(lane, myViewNet->getUndoList()); + } else { + // write warning if netedit is running in testing mode + if (myViewNet->isTestingModeEnabled() == true) { + WRITE_WARNING("Opening FXMessageBox of type 'warning'"); + } + // open warning box + FXMessageBox::warning(getViewNet()->getApp(), MBOX_OK, ("Problem deleting " + toString(lane->getTag())).c_str(), "%s", + (toString(lane->getTag()) + " '" + lane->getID() + "' cannot be deleted because it has " + + toString(lane->getAdditionalChilds().size()) + " additional childs.\n Check 'Force deletion of Additionals' to force deletion.").c_str()); + // write warning if netedit is running in testing mode + if (myViewNet->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'"); + } + } + } + break; + } + case GLO_POI: { + // XXX this is a dirty dirty hack! implemente GNEChange_POI + myViewNet->getNet()->getShapeContainer().removePOI(dynamic_cast(ac)->getMicrosimID()); + break; + } + case GLO_POLYGON: { + // + break; + } + case GLO_CROSSING: { + myViewNet->getNet()->deleteCrossing(dynamic_cast(ac), myViewNet->getUndoList()); + break; + } + case GLO_ADDITIONAL: { + myViewNet->getViewParent()->getAdditionalFrame()->removeAdditional(dynamic_cast(ac)); + break; + } + case GLO_CONNECTION: { + myViewNet->getNet()->deleteConnection(dynamic_cast(ac), myViewNet->getUndoList()); + break; + } + default: { + break; + } + } + } + // update view to show changes + myViewNet->update(); +} + + +void +GNEDeleteFrame::markAttributeCarrier(GNEAttributeCarrier* ac) { + // Check if under cursor there are an Attribute Carrier + if (ac != NULL) { + myMarkedElementLabel->setText((" " + toString(ac->getTag()) + " '" + ac->getID() + "'").c_str()); + myMarkedElementLabel->setIcon(ac->getIcon()); + } else { + myMarkedElementLabel->setText("No item marked"); + myMarkedElementLabel->setIcon(GUIIconSubSys::getIcon(ICON_EMPTY)); + } + // mark ac + myMarkedAC = ac; +} + + +void +GNEDeleteFrame::updateCurrentLabel(GNEAttributeCarrier* ac) { + // change label + if (ac != NULL) { + myCurrentElementLabel->setText((toString(ac->getTag()) + " '" + ac->getID() + "'").c_str()); + myCurrentElementLabel->setIcon(ac->getIcon()); + } else { + myCurrentElementLabel->setText("No item under cursor"); + myCurrentElementLabel->setIcon(GUIIconSubSys::getIcon(ICON_EMPTY)); + } +} + + +GNEAttributeCarrier* +GNEDeleteFrame::getMarkedAttributeCarrier() const { + return myMarkedAC; +} + + +long +GNEDeleteFrame::onCmdShowChildMenu(FXObject*, FXSelector, void* data) { + // Obtain event + FXEvent* e = (FXEvent*) data; + FXTreeItem* item = myTreelist->getItemAt(e->win_x, e->win_y); + // Check if there are an item in the position and create pop-up menu + if (item && (myTreeItemsWithoutAC.find(item) == myTreeItemsWithoutAC.end())) { + createPopUpMenu(e->root_x, e->root_y, myTreeItemToACMap[myTreelist->getItemAt(e->win_x, e->win_y)]); + } + return 1; +} + + +long +GNEDeleteFrame::onCmdCenterItem(FXObject*, FXSelector, void*) { + if (dynamic_cast(myClickedAC)) { + myViewNet->centerTo(dynamic_cast(myClickedAC)->getGlID(), false); + } else if (dynamic_cast(myClickedAC)) { + myViewNet->centerTo(dynamic_cast(myClickedAC)->getGlID(), false); + } else if (dynamic_cast(myClickedAC)) { + myViewNet->centerTo(dynamic_cast(myClickedAC)->getGlID(), false); + } else if (dynamic_cast(myClickedAC)) { + myViewNet->centerTo(dynamic_cast(myClickedAC)->getGlID(), false); + } + myViewNet->update(); + return 1; +} + + +long +GNEDeleteFrame::onCmdInspectItem(FXObject*, FXSelector, void*) { + if (myMarkedAC != NULL) { + myViewNet->getViewParent()->getInspectorFrame()->show(); + myViewNet->getViewParent()->getInspectorFrame()->inspectFromDeleteFrame(myClickedAC, myMarkedAC, true); + // Hide delete frame and show inspector frame + hide(); + } else if (myCurrentAC != NULL) { + myViewNet->getViewParent()->getInspectorFrame()->show(); + myViewNet->getViewParent()->getInspectorFrame()->inspectFromDeleteFrame(myClickedAC, myCurrentAC, false); + // Hide delete frame and show inspector frame + hide(); + } + return 1; +} + + +long +GNEDeleteFrame::onCmdDeleteItem(FXObject*, FXSelector, void*) { + removeAttributeCarrier(myClickedAC); + showAttributeCarrierChilds(myCurrentAC); + return 1; +} + + +void +GNEDeleteFrame::createPopUpMenu(int X, int Y, GNEAttributeCarrier* ac) { + // create FXMenuPane + FXMenuPane* pane = new FXMenuPane(myTreelist); + // set current clicked AC + myClickedAC = ac; + // set name + new MFXMenuHeader(pane, myViewNet->getViewParent()->getApp()->getBoldFont(), (toString(myClickedAC->getTag()) + ": " + myClickedAC->getID()).c_str(), myClickedAC->getIcon()); + new FXMenuSeparator(pane); + // Fill FXMenuCommand + new FXMenuCommand(pane, "Center", GUIIconSubSys::getIcon(ICON_RECENTERVIEW), this, MID_GNE_DELETEFRAME_CENTER); + new FXMenuCommand(pane, "Inspect", GUIIconSubSys::getIcon(ICON_MODEINSPECT), this, MID_GNE_DELETEFRAME_INSPECT); + new FXMenuCommand(pane, "Delete", GUIIconSubSys::getIcon(ICON_MODEDELETE), this, MID_GNE_DELETEFRAME_DELETE); + // Center in the mouse position and create pane + pane->setX(X); + pane->setY(Y); + pane->create(); + pane->show(); +} + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDeleteFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDeleteFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDeleteFrame.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDeleteFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,148 @@ +/****************************************************************************/ +/// @file GNEDeleteFrame.h +/// @author Pablo Alvarez Lopex +/// @date Dec 2016 +/// @version $Id: GNEDeleteFrame.h 23958 2017-04-17 10:00:31Z palcraft $ +/// +// The Widget for remove network-elements +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNEDeleteFrame_h +#define GNEDeleteFrame_h + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include "GNEFrame.h" + +// =========================================================================== +// class declarations +// =========================================================================== +class GNEAttributeCarrier; + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class GNEDeleteFrame + * The Widget for deleting elements + */ +class GNEDeleteFrame : public GNEFrame { + /// @brief FOX-declaration + FXDECLARE(GNEDeleteFrame) + +public: + + /**@brief Constructor + * @brief parent FXHorizontalFrame in which this GNEFrame is placed + * @brief viewNet viewNet that uses this GNEFrame + */ + GNEDeleteFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet); + + /// @brief Destructor + ~GNEDeleteFrame(); + + /// @brief show child of attributeCarrier in frame if previously there isn't a marked element + void showAttributeCarrierChilds(GNEAttributeCarrier* ac); + + /// @brief remove attribute carrier (element) + void removeAttributeCarrier(GNEAttributeCarrier* ac); + + /**@brief mark attribute carrier (element) + * @note if ac == NULL current marked attribute carrier will be dismarked + */ + void markAttributeCarrier(GNEAttributeCarrier* ac); + + /// @brief update current label + void updateCurrentLabel(GNEAttributeCarrier* ac); + + /// @brief returns marked atrribute carrier + GNEAttributeCarrier* getMarkedAttributeCarrier() const; + + /// @name FOX-callbacks + /// @{ + /// @brief called when user press right click over an item of list of childs + long onCmdShowChildMenu(FXObject*, FXSelector, void* data); + + /// @brief called when user select option "center item" of child Menu + long onCmdCenterItem(FXObject*, FXSelector, void*); + + /// @brief called when user select option "inspect item" of child menu + long onCmdInspectItem(FXObject*, FXSelector, void*); + + /// @brief called when user select option "delte item" of child menu + long onCmdDeleteItem(FXObject*, FXSelector, void*); + /// @} + +protected: + /// @brief FOX needs this + GNEDeleteFrame() {} + + // @brief create pop-up menu in the positions X-Y for the attribute carrier ac + void createPopUpMenu(int X, int Y, GNEAttributeCarrier* ac); + +private: + /// @brief groupbox for current element + FXGroupBox* myGroupBoxCurrentElement; + + /// @brief label for current element + FXLabel* myCurrentElementLabel; + + /// @brief label for marked element + FXLabel* myMarkedElementLabel; + + /// @brief groupbox options + FXGroupBox* myGroupBoxOptions; + + /// @brief groupbox for tree list childs + FXGroupBox* myGroupBoxTreeList; + + /// @brief groupbox for information + FXGroupBox* myGroupBoxInformation; + + /// @brief Label for information 1 + FXLabel* myInformationLabel; + + /// @brief checkbox for enable/disble automatically delete additionals childs + FXCheckButton* myAutomaticallyDeleteAdditionalsCheckButton; + + /// @brief tree list to show the childs of the element to erase + FXTreeList* myTreelist; + + /// @brief map used to save the Tree items with their AC + std::map myTreeItemToACMap; + + /// @brief set used to save tree items without AC assigned (for example, Incoming/Outcoming connections) + std::set myTreeItemsWithoutAC; + + /// @brief pointer to current AC + GNEAttributeCarrier* myCurrentAC; + + /// @brief pointer to marked attributeCarrier (element) + GNEAttributeCarrier* myMarkedAC; + + /// @brief current attribute carrier selected in three + GNEAttributeCarrier* myClickedAC; +}; + + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDestProbReroute.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDestProbReroute.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDestProbReroute.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDestProbReroute.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,107 @@ +/****************************************************************************/ +/// @file GNEDestProbReroute.cpp +/// @author Pablo Alvarez Lopez +/// @date Jan 2017 +/// @version $Id: GNEDestProbReroute.cpp 23640 2017-03-24 09:17:38Z palcraft $ +/// +/// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include + +#include "GNEDestProbReroute.h" +#include "GNEEdge.h" + + +// =========================================================================== +// member method definitions +// =========================================================================== + +GNEDestProbReroute::GNEDestProbReroute(GNERerouterInterval& rerouterIntervalParent, GNEEdge* newEdgeDestination, double probability): + myRerouterIntervalParent(&rerouterIntervalParent), + myNewEdgeDestination(newEdgeDestination), + myProbability(0), + myTag(SUMO_TAG_DEST_PROB_REROUTE) { + // set probability manually to avoid non valid values + setProbability(probability); +} + + +GNEDestProbReroute::~GNEDestProbReroute() { +} + + +GNEEdge* +GNEDestProbReroute::getNewDestination() const { + return myNewEdgeDestination; +} + + +void +GNEDestProbReroute::setNewDestination(GNEEdge* edge) { + myNewEdgeDestination = edge; +} + + +double +GNEDestProbReroute::getProbability() const { + return myProbability; +} + + +bool +GNEDestProbReroute::setProbability(double probability) { + if (probability >= 0 && probability <= 1) { + myProbability = probability; + return true; + } else { + return false; + } +} + + +SumoXMLTag +GNEDestProbReroute::getTag() const { + return myTag; +} + + +const GNERerouterInterval& +GNEDestProbReroute::getRerouterIntervalParent() const { + return *myRerouterIntervalParent; +} + + +bool +GNEDestProbReroute::operator==(const GNEDestProbReroute& destProbReroute) const { + if ((myRerouterIntervalParent == destProbReroute.myRerouterIntervalParent) && + (myNewEdgeDestination == destProbReroute.myNewEdgeDestination) && + (myProbability == destProbReroute.myProbability)) { + return true; + } else { + return false; + } +} + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDestProbReroute.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDestProbReroute.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDestProbReroute.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDestProbReroute.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,96 @@ +/****************************************************************************/ +/// @file GNEDestProbReroute.h +/// @author Pablo Alvarez Lopez +/// @date Jan 2017 +/// @version $Id: GNEDestProbReroute.h 23640 2017-03-24 09:17:38Z palcraft $ +/// +/// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNEDestProbReroute_h +#define GNEDestProbReroute_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include + +// =========================================================================== +// class declarations +// =========================================================================== + +class GNEEdge; +class GNERerouterInterval; + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class GNEDestProbReroute + * forces the rerouter to assign a new route + */ +class GNEDestProbReroute { +public: + /// @brief constructor + GNEDestProbReroute(GNERerouterInterval& rerouterIntervalParent, GNEEdge* newEdgeDestination, double probability); + + /// @brief destructor + ~GNEDestProbReroute(); + + /// @brief get edge destination + GNEEdge* getNewDestination() const; + + /// @brief set edge destination + void setNewDestination(GNEEdge* edge); + + /// @brief get probability + double getProbability() const; + + /// @brief set probability, if new probability is valid + bool setProbability(double probability); + + /// @brief get tag + SumoXMLTag getTag() const; + + /// @brief get rerouter interval parent + const GNERerouterInterval& getRerouterIntervalParent() const; + + /// @brief overload operator == + bool operator==(const GNEDestProbReroute& destProbReroute) const; + +protected: + /// @brief reference to rerouter interval parent + GNERerouterInterval* myRerouterIntervalParent; + + /// @brief id of new edge destination + GNEEdge* myNewEdgeDestination; + + /// @brief probability with which a vehicle will use the given edge as destination + double myProbability; + + /// @brief XML Tag of destiny probability reroute + SumoXMLTag myTag; +}; + +#endif + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetector.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetector.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetector.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetector.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEDetectorE1.cpp /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEDetector.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEDetector.cpp 23560 2017-03-20 14:57:08Z palcraft $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,16 +55,12 @@ #include "GNEViewNet.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif - // =========================================================================== // member method definitions // =========================================================================== -GNEDetector::GNEDetector(const std::string& id, GNEViewNet* viewNet, SumoXMLTag tag, GNELane* lane, SUMOReal posOverLane, int freq, const std::string& filename, bool blocked, GNEAdditionalSet* parent) : - GNEAdditional(id, viewNet, Position(posOverLane, 0), tag, parent, blocked), +GNEDetector::GNEDetector(const std::string& id, GNEViewNet* viewNet, SumoXMLTag tag, GUIIcon icon, GNELane* lane, double posOverLane, double freq, const std::string& filename) : + GNEAdditional(id, viewNet, Position(posOverLane, 0), tag, icon), myFreq(freq), myFilename(filename) { // This additional belongs to a Lane @@ -77,18 +73,18 @@ void -GNEDetector::moveAdditionalGeometry(SUMOReal offsetx, SUMOReal offsety) { +GNEDetector::moveAdditionalGeometry(double offsetx, double offsety) { // Due a detector is placed over an lane ignore Warning of posy UNUSED_PARAMETER(offsety); // declare start and end positions - SUMOReal startPos = myPosition.x(); - SUMOReal endPos = 0; - // set endPos if additional has the attribute lenght + double startPos = myPosition.x(); + double endPos = 0; + // set endPos if additional has the attribute length if (GNEAttributeCarrier::hasAttribute(getTag(), SUMO_ATTR_LENGTH)) { - endPos = startPos + GNEAttributeCarrier::parse(getAttribute(SUMO_ATTR_LENGTH)); + endPos = startPos + GNEAttributeCarrier::parse(getAttribute(SUMO_ATTR_LENGTH)); } // Move to Right if distance is positive, to left if distance is negative - if (((offsetx > 0) && ((endPos + offsetx) < myLane->getLaneShapeLenght())) || ((offsetx < 0) && ((startPos + offsetx) > 0))) { + if (((offsetx > 0) && ((endPos + offsetx) < myLane->getLaneShapeLength())) || ((offsetx < 0) && ((startPos + offsetx) > 0))) { // change attribute myPosition.set(myPosition.x() + offsetx, 0); // Update geometry @@ -98,7 +94,7 @@ void -GNEDetector::commmitAdditionalGeometryMoved(SUMOReal oldPosx, SUMOReal, GNEUndoList* undoList) { +GNEDetector::commmitAdditionalGeometryMoved(double oldPosx, double, GNEUndoList* undoList) { undoList->p_begin("position of " + toString(getTag())); undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, toString(myPosition.x()), true, toString(oldPosx))); undoList->p_end(); @@ -107,13 +103,13 @@ } -SUMOReal +double GNEDetector::getPositionOverLane() const { return myPosition.x(); } -int +double GNEDetector::getFrequency() const { return myFreq; } @@ -126,11 +122,11 @@ void -GNEDetector::setPositionOverLane(SUMOReal pos) { +GNEDetector::setPositionOverLane(double pos) { if (pos < 0) { - throw InvalidArgument("Position '" + toString(pos) + "' not allowed. Must be greather than 0"); - } else if (pos > myLane->getLaneShapeLenght()) { - throw InvalidArgument("Position '" + toString(pos) + "' not allowed. Must be smaller than lane length"); + throw InvalidArgument("Position '" + toString(pos) + "' of " + toString(getTag()) + " not allowed. Must be greater than 0"); + } else if (pos > myLane->getLaneShapeLength()) { + throw InvalidArgument("Position '" + toString(pos) + "' of " + toString(getTag()) + " not allowed. Must be smaller than lane length"); } else { myPosition = Position(pos, 0); } @@ -138,11 +134,11 @@ void -GNEDetector::setFrequency(int freq) { - if (freq >= 0) { +GNEDetector::setFrequency(const double freq) { + if (freq > 0) { myFreq = freq; } else { - throw InvalidArgument("Frequency '" + toString(freq) + "' not allowed. Must be greather than 0"); + throw InvalidArgument("Frequency '" + toString(freq) + "' not allowed. Must be greater than 0"); } } @@ -160,7 +156,7 @@ void -GNEDetector::drawDetectorIcon(const int GNELogoID, SUMOReal sizex, SUMOReal sizey) const { +GNEDetector::drawDetectorIcon(const int GNELogoID, double sizex, double sizey) const { // Add a draw matrix glPushMatrix(); // Traslate to center diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorE1.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorE1.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorE1.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorE1.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEDetectorE1.cpp /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEDetectorE1.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEDetectorE1.cpp 24016 2017-04-22 14:13:39Z palcraft $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -54,16 +54,13 @@ #include "GNENet.h" #include "GNEChange_Attribute.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // =========================================================================== // member method definitions // =========================================================================== -GNEDetectorE1::GNEDetectorE1(const std::string& id, GNELane* lane, GNEViewNet* viewNet, SUMOReal pos, SUMOReal freq, const std::string& filename, bool splitByType, bool blocked) : - GNEDetector(id, viewNet, SUMO_TAG_E1DETECTOR, lane, pos, freq, filename, blocked), +GNEDetectorE1::GNEDetectorE1(const std::string& id, GNELane* lane, GNEViewNet* viewNet, double pos, double freq, const std::string& filename, bool splitByType) : + GNEDetector(id, viewNet, SUMO_TAG_E1DETECTOR, ICON_E1, lane, pos, freq, filename), mySplitByType(splitByType) { // Update geometry; updateGeometry(); @@ -87,7 +84,7 @@ myShape.clear(); // Get shape of lane parent - myShape.push_back(myLane->getShape().positionAtOffset(myLane->getPositionRelativeToParametricLenght(myPosition.x()))); + myShape.push_back(myLane->getShape().positionAtOffset(myLane->getPositionRelativeToParametricLength(myPosition.x()))); // Obtain first position Position f = myShape[0] - Position(1, 0); @@ -96,7 +93,7 @@ Position s = myShape[0] + Position(1, 0); // Save rotation (angle) of the vector constructed by points f and s - myShapeRotations.push_back(myLane->getShape().rotationDegreeAtOffset(myLane->getPositionRelativeToParametricLenght(myPosition.x())) * -1); + myShapeRotations.push_back(myLane->getShape().rotationDegreeAtOffset(myLane->getPositionRelativeToParametricLength(myPosition.x())) * -1); // Set offset of logo myDetectorLogoOffset = Position(1, 0); @@ -117,12 +114,12 @@ Position GNEDetectorE1::getPositionInView() const { - return myLane->getShape().positionAtOffset(myLane->getPositionRelativeToParametricLenght(myPosition.x())); + return myLane->getShape().positionAtOffset(myLane->getPositionRelativeToParametricLength(myPosition.x())); } void -GNEDetectorE1::writeAdditional(OutputDevice& device, const std::string&) { +GNEDetectorE1::writeAdditional(OutputDevice& device) const { // Write parameters device.openTag(getTag()); device.writeAttr(SUMO_ATTR_ID, getID()); @@ -145,9 +142,9 @@ GNEDetectorE1::drawGL(const GUIVisualizationSettings& s) const { // get values glPushName(getGlID()); - SUMOReal width = (SUMOReal) 2.0 * s.scale; + double width = (double) 2.0 * s.scale; glLineWidth(1.0); - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); // draw shape glColor3d(1, 1, 0); @@ -197,7 +194,7 @@ // Check if the distance is enought to draw details if (s.scale * exaggeration >= 10) { // Add a draw matrix - drawDetectorIcon(GUITextureSubSys::getGif(GNETEXTURE_E1)); + drawDetectorIcon(GUITextureSubSys::getTexture(GNETEXTURE_E1)); // Show Lock icon depending of the Edit mode drawLockIcon(); @@ -227,7 +224,7 @@ case GNE_ATTR_BLOCK_MOVEMENT: return toString(myBlocked); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -249,7 +246,7 @@ updateGeometry(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -271,17 +268,17 @@ return false; } case SUMO_ATTR_POSITION: - return (canParse(value) && parse(value) >= 0 && parse(value) <= (myLane->getLaneParametricLenght())); + return (canParse(value) && parse(value) >= 0 && parse(value) <= (myLane->getLaneParametricLength())); case SUMO_ATTR_FREQUENCY: - return (canParse(value) && parse(value) >= 0); + return (canParse(value) && parse(value) >= 0); case SUMO_ATTR_FILE: - return isValidFileValue(value); + return isValidFilename(value); case SUMO_ATTR_SPLIT_VTYPE: return canParse(value); case GNE_ATTR_BLOCK_MOVEMENT: return canParse(value); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -299,12 +296,12 @@ changeLane(value); break; case SUMO_ATTR_POSITION: - myPosition = Position(parse(value), 0); + myPosition = Position(parse(value), 0); updateGeometry(); getViewNet()->update(); break; case SUMO_ATTR_FREQUENCY: - myFreq = parse(value); + myFreq = parse(value); break; case SUMO_ATTR_FILE: myFilename = value; @@ -317,7 +314,7 @@ getViewNet()->update(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorE1.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorE1.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorE1.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorE1.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEDetectorE1.h /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEDetectorE1.h 21150 2016-07-12 12:28:35Z behrisch $ +/// @version $Id: GNEDetectorE1.h 23150 2017-02-27 12:08:30Z behrisch $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -54,9 +54,8 @@ * @param[in] freq the aggregation period the values the detector collects shall be summed up. * @param[in] filename The path to the output file. * @param[in] splitByType If set, the collected values will be additionally reported on per-vehicle type base. - * @param[in] blocked set initial blocking state of item */ - GNEDetectorE1(const std::string& id, GNELane* lane, GNEViewNet* viewNet, SUMOReal pos, SUMOReal freq, const std::string& filename, bool splitByType, bool blocked); + GNEDetectorE1(const std::string& id, GNELane* lane, GNEViewNet* viewNet, double pos, double freq, const std::string& filename, bool splitByType); /// @brief Destructor ~GNEDetectorE1(); @@ -71,7 +70,7 @@ /**@brief writte additional element into a xml file * @param[in] device device in which write parameters of additional element */ - void writeAdditional(OutputDevice& device, const std::string&); + void writeAdditional(OutputDevice& device) const; /// @name inherited from GUIGlObject /// @{ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorE2.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorE2.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorE2.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorE2.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEDetectorE2.cpp /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEDetectorE2.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEDetectorE2.cpp 24016 2017-04-22 14:13:39Z palcraft $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -54,17 +54,14 @@ #include "GNENet.h" #include "GNEChange_Attribute.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // =========================================================================== // member method definitions // =========================================================================== -GNEDetectorE2::GNEDetectorE2(const std::string& id, GNELane* lane, GNEViewNet* viewNet, SUMOReal pos, SUMOReal length, SUMOReal freq, const std::string& filename, - bool cont, SUMOTime timeThreshold, SUMOReal speedThreshold, SUMOReal jamThreshold, bool blocked) : - GNEDetector(id, viewNet, SUMO_TAG_E2DETECTOR, lane, pos, freq, filename, blocked), +GNEDetectorE2::GNEDetectorE2(const std::string& id, GNELane* lane, GNEViewNet* viewNet, double pos, double length, double freq, const std::string& filename, + bool cont, const double timeThreshold, double speedThreshold, double jamThreshold) : + GNEDetector(id, viewNet, SUMO_TAG_E2DETECTOR, ICON_E2, lane, pos, freq, filename), myLength(length), myCont(cont), myTimeThreshold(timeThreshold), @@ -92,7 +89,7 @@ myShape = myLane->getShape(); // Cut shape using as delimitators myPos and their length (myPos + length) - myShape = myShape.getSubpart(myLane->getPositionRelativeToParametricLenght(myPosition.x()), myLane->getPositionRelativeToParametricLenght(myPosition.x() + myLength)); + myShape = myShape.getSubpart(myLane->getPositionRelativeToParametricLength(myPosition.x()), myLane->getPositionRelativeToParametricLength(myPosition.x() + myLength)); // Get number of parts of the shape int numberOfSegments = (int) myShape.size() - 1; @@ -117,7 +114,7 @@ myShapeLengths.push_back(f.distanceTo(s)); // Save rotation (angle) of the vector constructed by points f and s - myShapeRotations.push_back((SUMOReal) atan2((s.x() - f.x()), (f.y() - s.y())) * (SUMOReal) 180.0 / (SUMOReal) PI); + myShapeRotations.push_back((double) atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double) PI); } } @@ -140,12 +137,12 @@ Position GNEDetectorE2::getPositionInView() const { - return myLane->getShape().positionAtOffset(myLane->getPositionRelativeToParametricLenght(myPosition.x())); + return myLane->getShape().positionAtOffset(myLane->getPositionRelativeToParametricLength(myPosition.x())); } void -GNEDetectorE2::writeAdditional(OutputDevice& device, const std::string&) { +GNEDetectorE2::writeAdditional(OutputDevice& device) const { // Write parameters device.openTag(getTag()); device.writeAttr(SUMO_ATTR_ID, getID()); @@ -157,7 +154,7 @@ device.writeAttr(SUMO_ATTR_FILE, myFilename); } device.writeAttr(SUMO_ATTR_CONT, myCont); - device.writeAttr(SUMO_ATTR_HALTING_TIME_THRESHOLD, time2string(myTimeThreshold)); + device.writeAttr(SUMO_ATTR_HALTING_TIME_THRESHOLD, myTimeThreshold); device.writeAttr(SUMO_ATTR_HALTING_SPEED_THRESHOLD, mySpeedThreshold); device.writeAttr(SUMO_ATTR_JAM_DIST_THRESHOLD, myJamThreshold); if (myBlocked) { @@ -187,9 +184,9 @@ } // Obtain exaggeration of the draw - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); - // Draw the area using shape, shapeRotations, shapeLenghts and value of exaggeration + // Draw the area using shape, shapeRotations, shapeLengths and value of exaggeration GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, exaggeration); // Pop last matrix @@ -198,7 +195,7 @@ // Check if the distance is enought to draw details if (s.scale * exaggeration >= 10) { // Draw icon - this->drawDetectorIcon(GUITextureSubSys::getGif(GNETEXTURE_E2)); + this->drawDetectorIcon(GUITextureSubSys::getTexture(GNETEXTURE_E2)); // Show Lock icon depending of the Edit mode drawLockIcon(); @@ -230,7 +227,7 @@ case SUMO_ATTR_CONT: return toString(myCont); case SUMO_ATTR_HALTING_TIME_THRESHOLD: - return time2string(myTimeThreshold); + return toString(myTimeThreshold); case SUMO_ATTR_HALTING_SPEED_THRESHOLD: return toString(mySpeedThreshold); case SUMO_ATTR_JAM_DIST_THRESHOLD: @@ -238,7 +235,7 @@ case GNE_ATTR_BLOCK_MOVEMENT: return toString(myBlocked); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -264,7 +261,7 @@ updateGeometry(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -285,25 +282,25 @@ return false; } case SUMO_ATTR_POSITION: - return (canParse(value) && parse(value) >= 0 && parse(value) <= (myLane->getLaneParametricLenght())); + return (canParse(value) && parse(value) >= 0 && parse(value) <= (myLane->getLaneParametricLength())); case SUMO_ATTR_FREQUENCY: - return (canParse(value) && parse(value) >= 0); + return (canParse(value) && parse(value) >= 0); case SUMO_ATTR_LENGTH: - return (canParse(value) && parse(value) >= 0); + return (canParse(value) && parse(value) >= 0); case SUMO_ATTR_FILE: - return isValidFileValue(value); + return isValidFilename(value); case SUMO_ATTR_CONT: return canParse(value); case SUMO_ATTR_HALTING_TIME_THRESHOLD: - return canParse(value); + return (canParse(value) && parse(value) >= 0); case SUMO_ATTR_HALTING_SPEED_THRESHOLD: - return canParse(value); + return (canParse(value) && parse(value) >= 0); case SUMO_ATTR_JAM_DIST_THRESHOLD: - return canParse(value); + return (canParse(value) && parse(value) >= 0); case GNE_ATTR_BLOCK_MOVEMENT: return canParse(value); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -321,15 +318,15 @@ changeLane(value); break; case SUMO_ATTR_POSITION: - myPosition = Position(parse(value), 0); + myPosition = Position(parse(value), 0); updateGeometry(); getViewNet()->update(); break; case SUMO_ATTR_FREQUENCY: - myFreq = parse(value); + myFreq = parse(value); break; case SUMO_ATTR_LENGTH: - myLength = parse(value); + myLength = parse(value); updateGeometry(); getViewNet()->update(); break; @@ -340,20 +337,20 @@ myCont = parse(value); break; case SUMO_ATTR_HALTING_TIME_THRESHOLD: - myTimeThreshold = string2time(value); + myTimeThreshold = parse(value); break; case SUMO_ATTR_HALTING_SPEED_THRESHOLD: - mySpeedThreshold = parse(value); + mySpeedThreshold = parse(value); break; case SUMO_ATTR_JAM_DIST_THRESHOLD: - myJamThreshold = parse(value); + myJamThreshold = parse(value); break; case GNE_ATTR_BLOCK_MOVEMENT: myBlocked = parse(value); getViewNet()->update(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorE2.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorE2.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorE2.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorE2.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEDetectorE2.h /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEDetectorE2.h 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: GNEDetectorE2.h 23560 2017-03-20 14:57:08Z palcraft $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -58,10 +58,9 @@ * @param[in] timeThreshold The time-based threshold that describes how much time has to pass until a vehicle is recognized as halting * @param[in] speedThreshold The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting * @param[in] speedThreshold The minimum distance to the next standing vehicle in order to make this vehicle count as a participant to the jam - * @param[in] blocked set initial blocking state of item */ - GNEDetectorE2(const std::string& id, GNELane* lane, GNEViewNet* viewNet, SUMOReal pos, SUMOReal length, SUMOReal freq, const std::string& filename, - bool cont, SUMOTime timeThreshold, SUMOReal speedThreshold, SUMOReal jamThreshold, bool blocked); + GNEDetectorE2(const std::string& id, GNELane* lane, GNEViewNet* viewNet, double pos, double length, double freq, const std::string& filename, + bool cont, const double timeThreshold, double speedThreshold, double jamThreshold); /// @brief Destructor ~GNEDetectorE2(); @@ -76,7 +75,7 @@ /**@brief writte additional element into a xml file * @param[in] device device in which write parameters of additional element */ - void writeAdditional(OutputDevice& device, const std::string&); + void writeAdditional(OutputDevice& device) const; /// @name inherited from GUIGlObject /// @{ @@ -111,20 +110,20 @@ /// @} protected: - /// @brief attribute lenght - SUMOReal myLength; + /// @brief attribute length + double myLength; /// @brief attribute to enable or disable splitByType bool myCont; /// @brief The time-based threshold that describes how much time has to pass until a vehicle is recognized as halting - SUMOTime myTimeThreshold; + double myTimeThreshold; /// @brief The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting - SUMOReal mySpeedThreshold; + double mySpeedThreshold; /// @brief The minimum distance to the next standing vehicle in order to make this vehicle count as a participant to the jam - SUMOReal myJamThreshold; + double myJamThreshold; private: /// @brief set attribute after validation diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorE3.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorE3.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorE3.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorE3.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEDetectorE3.cpp /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEDetectorE3.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEDetectorE3.cpp 24016 2017-04-22 14:13:39Z palcraft $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -50,22 +50,21 @@ #include #include "GNEDetectorE3.h" +#include "GNEDetectorEntry.h" +#include "GNEDetectorExit.h" #include "GNELane.h" #include "GNEViewNet.h" #include "GNEUndoList.h" #include "GNENet.h" #include "GNEChange_Attribute.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // =========================================================================== // member method definitions // =========================================================================== -GNEDetectorE3::GNEDetectorE3(const std::string& id, GNEViewNet* viewNet, Position pos, int freq, const std::string& filename, SUMOTime timeThreshold, SUMOReal speedThreshold, bool blocked) : - GNEAdditionalSet(id, viewNet, pos, SUMO_TAG_E3DETECTOR, blocked), +GNEDetectorE3::GNEDetectorE3(const std::string& id, GNEViewNet* viewNet, Position pos, double freq, const std::string& filename, const double timeThreshold, double speedThreshold) : + GNEAdditional(id, viewNet, pos, SUMO_TAG_E3DETECTOR, ICON_E3), myFreq(freq), myFilename(filename), myTimeThreshold(timeThreshold), @@ -99,16 +98,26 @@ // Set position myShape.push_back(myPosition); - // Add shape of childs (To avoid graphics errors) - for (childAdditionals::iterator i = myChildAdditionals.begin(); i != myChildAdditionals.end(); i++) { - myShape.append((*i)->getShape()); + // Refresh element (neccesary to avoid grabbing problems) + myViewNet->getNet()->refreshAdditional(this); + + // Clear all containers + myShapeRotations.clear(); + myShapeLengths.clear(); + + + // iterate over entry childs and update their gemometries + for (std::vector::iterator i = myGNEDetectorEntrys.begin(); i != myGNEDetectorEntrys.end(); i++) { + (*i)->updateGeometryByParent(); } - // Update connections - updateConnections(); + // iterate over entry childs and update their gemometries + for (std::vector::iterator i = myGNEDetectorExits.begin(); i != myGNEDetectorExits.end(); i++) { + (*i)->updateGeometryByParent(); + } - // Refresh element (neccesary to avoid grabbing problems) - myViewNet->getNet()->refreshAdditional(this); + // Update connection's geometry + updateGeometryConnections(); } @@ -119,17 +128,18 @@ void -GNEDetectorE3::moveAdditionalGeometry(SUMOReal offsetx, SUMOReal offsety) { +GNEDetectorE3::moveAdditionalGeometry(double offsetx, double offsety) { // change Position - myPosition = Position(offsetx, offsety); + myPosition.set(offsetx, offsety); updateGeometry(); } void -GNEDetectorE3::commmitAdditionalGeometryMoved(SUMOReal oldPosx, SUMOReal oldPosy, GNEUndoList* undoList) { +GNEDetectorE3::commmitAdditionalGeometryMoved(double oldPosx, double oldPosy, GNEUndoList* undoList) { undoList->p_begin("position of " + toString(getTag())); - undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, toString(myPosition), true, toString(Position(oldPosx, oldPosy)))); + undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_X, toString(myPosition.x()), true, toString(oldPosx))); + undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_Y, toString(myPosition.y()), true, toString(oldPosy))); undoList->p_end(); // Refresh element myViewNet->getNet()->refreshAdditional(this); @@ -137,9 +147,9 @@ void -GNEDetectorE3::writeAdditional(OutputDevice& device, const std::string& currentDirectory) { +GNEDetectorE3::writeAdditional(OutputDevice& device) const { // Only save E3 if have Entry/Exits - if (getNumberOfAdditionalChilds() > 0) { + if ((myGNEDetectorEntrys.size() + myGNEDetectorExits.size()) > 0) { // Write parameters device.openTag(getTag()); device.writeAttr(SUMO_ATTR_ID, getID()); @@ -151,16 +161,48 @@ device.writeAttr(SUMO_ATTR_HALTING_SPEED_THRESHOLD, mySpeedThreshold); device.writeAttr(SUMO_ATTR_X, myPosition.x()); device.writeAttr(SUMO_ATTR_Y, myPosition.y()); - if (myBlocked) { - device.writeAttr(GNE_ATTR_BLOCK_MOVEMENT, myBlocked); + + // Write entrys + for (std::vector::const_iterator i = myGNEDetectorEntrys.begin(); i != myGNEDetectorEntrys.end(); i++) { + device.openTag((*i)->getTag()); + device.writeAttr(SUMO_ATTR_LANE, (*i)->getLane()->getID()); + device.writeAttr(SUMO_ATTR_POSITION, (*i)->getPositionOverLane()); + device.closeTag(); } - // Write childs of this element - writeAdditionalChildrens(device, currentDirectory); - // Close tag + + // Write exits + for (std::vector::const_iterator i = myGNEDetectorExits.begin(); i != myGNEDetectorExits.end(); i++) { + device.openTag((*i)->getTag()); + device.writeAttr(SUMO_ATTR_LANE, (*i)->getLane()->getID()); + device.writeAttr(SUMO_ATTR_POSITION, (*i)->getPositionOverLane()); + device.closeTag(); + } + + // Close E3 tag device.closeTag(); } else { - WRITE_WARNING(toString(getTag()) + " with ID = '" + getID() + "' cannot be writed in additional file because don't have childs."); + WRITE_WARNING(toString(getTag()) + " with ID '" + getID() + "' cannot be writed in additional file because doesn't have childs."); + } +} + + +std::string +GNEDetectorE3::generateEntryID() { + int counter = 0; + while (myViewNet->getNet()->getAdditional(SUMO_TAG_DET_ENTRY, getID() + toString(SUMO_TAG_DET_ENTRY) + toString(counter)) != NULL) { + counter++; + } + return (getID() + toString(SUMO_TAG_DET_ENTRY) + toString(counter)); +} + + +std::string +GNEDetectorE3::generateExitID() { + int counter = 0; + while (myViewNet->getNet()->getAdditional(SUMO_TAG_DET_EXIT, getID() + toString(SUMO_TAG_DET_EXIT) + toString(counter)) != NULL) { + counter++; } + return (getID() + toString(SUMO_TAG_DET_EXIT) + toString(counter)); } @@ -171,6 +213,70 @@ void +GNEDetectorE3::addEntryChild(GNEDetectorEntry* entry) { + // Check that entry is valid and doesn't exist previously + if (entry == NULL) { + throw InvalidArgument("Trying to add an empty " + toString(SUMO_TAG_DET_ENTRY) + " child in " + toString(SUMO_TAG_E3DETECTOR) + " with ID='" + getID() + "'"); + } else if (std::find(myGNEDetectorEntrys.begin(), myGNEDetectorEntrys.end(), entry) != myGNEDetectorEntrys.end()) { + throw InvalidArgument("Trying to add a duplicated " + toString(SUMO_TAG_DET_ENTRY) + " child in " + toString(SUMO_TAG_E3DETECTOR) + " with ID='" + getID() + "'"); + } else { + myGNEDetectorEntrys.push_back(entry); + } +} + + +void +GNEDetectorE3::removeEntryChild(GNEDetectorEntry* entry) { + // Check that entry is valid and exist previously + if (entry == NULL) { + throw InvalidArgument("Trying to remove an empty " + toString(SUMO_TAG_DET_ENTRY) + " child in " + toString(SUMO_TAG_E3DETECTOR) + " with ID='" + getID() + "'"); + } else if (std::find(myGNEDetectorEntrys.begin(), myGNEDetectorEntrys.end(), entry) == myGNEDetectorEntrys.end()) { + throw InvalidArgument("Trying to remove a non previously inserted " + toString(SUMO_TAG_DET_ENTRY) + " child in " + toString(SUMO_TAG_E3DETECTOR) + " with ID='" + getID() + "'"); + } else { + myGNEDetectorEntrys.erase(std::find(myGNEDetectorEntrys.begin(), myGNEDetectorEntrys.end(), entry)); + } +} + + +void +GNEDetectorE3::addExitChild(GNEDetectorExit* exit) { + // Check that exit is valid and doesn't exist previously + if (exit == NULL) { + throw InvalidArgument("Trying to add an empty " + toString(SUMO_TAG_DET_EXIT) + " child in " + toString(SUMO_TAG_E3DETECTOR) + " with ID='" + getID() + "'"); + } else if (std::find(myGNEDetectorExits.begin(), myGNEDetectorExits.end(), exit) != myGNEDetectorExits.end()) { + throw InvalidArgument("Trying to add a duplicated " + toString(SUMO_TAG_DET_EXIT) + " child in " + toString(SUMO_TAG_E3DETECTOR) + " with ID='" + getID() + "'"); + } else { + myGNEDetectorExits.push_back(exit); + } +} + + +void +GNEDetectorE3::removeExitChild(GNEDetectorExit* exit) { + // Check that exit is valid and exist previously + if (exit == NULL) { + throw InvalidArgument("Trying to remove an empty " + toString(SUMO_TAG_DET_EXIT) + " child in " + toString(SUMO_TAG_E3DETECTOR) + " with ID='" + getID() + "'"); + } else if (std::find(myGNEDetectorExits.begin(), myGNEDetectorExits.end(), exit) == myGNEDetectorExits.end()) { + throw InvalidArgument("Trying to remove a non previously inserted " + toString(SUMO_TAG_DET_EXIT) + " child in " + toString(SUMO_TAG_E3DETECTOR) + " with ID='" + getID() + "'"); + } else { + myGNEDetectorExits.erase(std::find(myGNEDetectorExits.begin(), myGNEDetectorExits.end(), exit)); + } +} + + +int +GNEDetectorE3::getNumberOfEntryChilds() const { + return (int)myGNEDetectorEntrys.size(); +} + + +int +GNEDetectorE3::getNumberOfExitChilds() const { + return (int)myGNEDetectorExits.size(); +} + + +void GNEDetectorE3::drawGL(const GUIVisualizationSettings& s) const { // Start drawing adding an gl identificator glPushName(getGlID()); @@ -180,12 +286,11 @@ glTranslated(myShape[0].x(), myShape[0].y(), getType()); glColor3d(1, 1, 1); glRotated(180, 0, 0, 1); - // Draw icon depending of detector is or isn't selected if (isAdditionalSelected()) { - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_E3SELECTED), 1); + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_E3SELECTED), 1); } else { - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_E3), 1); + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_E3), 1); } // Pop logo matrix @@ -195,7 +300,7 @@ drawLockIcon(0.4); // Draw connections - drawConnections(); + drawParentAndChildrenConnections(); // Pop name glPopName(); @@ -210,8 +315,10 @@ switch (key) { case SUMO_ATTR_ID: return getAdditionalID(); - case SUMO_ATTR_POSITION: - return toString(myPosition); + case SUMO_ATTR_X: + return toString(myPosition.x()); + case SUMO_ATTR_Y: + return toString(myPosition.y()); case SUMO_ATTR_FREQUENCY: return toString(myFreq); case SUMO_ATTR_FILE: @@ -223,7 +330,7 @@ case GNE_ATTR_BLOCK_MOVEMENT: return toString(myBlocked); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -236,7 +343,8 @@ switch (key) { case SUMO_ATTR_ID: case SUMO_ATTR_FREQUENCY: - case SUMO_ATTR_POSITION: + case SUMO_ATTR_X: + case SUMO_ATTR_Y: case SUMO_ATTR_FILE: case SUMO_ATTR_HALTING_TIME_THRESHOLD: case SUMO_ATTR_HALTING_SPEED_THRESHOLD: @@ -245,7 +353,7 @@ updateGeometry(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -259,22 +367,22 @@ } else { return false; } - case SUMO_ATTR_POSITION: - bool ok; - return GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, false).size() == 1; + case SUMO_ATTR_X: + return canParse(value); + case SUMO_ATTR_Y: + return canParse(value); case SUMO_ATTR_FREQUENCY: - return (canParse(value) && parse(value) >= 0); + return (canParse(value) && parse(value) >= 0); case SUMO_ATTR_FILE: - return isValidFileValue(value); + return isValidFilename(value); case SUMO_ATTR_HALTING_TIME_THRESHOLD: - // @ToDo SUMOTIME - return canParse(value); + return (canParse(value) && parse(value) >= 0); case SUMO_ATTR_HALTING_SPEED_THRESHOLD: - return canParse(value); + return (canParse(value) && parse(value) >= 0); case GNE_ATTR_BLOCK_MOVEMENT: return canParse(value); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -284,32 +392,94 @@ switch (key) { case SUMO_ATTR_ID: setAdditionalID(value); + // Change Ids of all Entry/Exits childs + for (std::vector::iterator i = myGNEDetectorEntrys.begin(); i != myGNEDetectorEntrys.end(); i++) { + (*i)->setAdditionalID(generateEntryID()); + } + for (std::vector::iterator i = myGNEDetectorExits.begin(); i != myGNEDetectorExits.end(); i++) { + (*i)->setAdditionalID(generateExitID()); + } break; - case SUMO_ATTR_POSITION: - bool ok; - myPosition = GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, false)[0]; + case SUMO_ATTR_X: + myPosition.setx(parse(value)); + updateGeometry(); + getViewNet()->update(); + break; + case SUMO_ATTR_Y: + myPosition.sety(parse(value)); updateGeometry(); getViewNet()->update(); break; case SUMO_ATTR_FREQUENCY: - myFreq = parse(value); + myFreq = parse(value); break; case SUMO_ATTR_FILE: myFilename = value; break; case SUMO_ATTR_HALTING_TIME_THRESHOLD: - // @todo SUMOTIME - myTimeThreshold = parse(value); + myTimeThreshold = parse(value); break; case SUMO_ATTR_HALTING_SPEED_THRESHOLD: - mySpeedThreshold = parse(value); + mySpeedThreshold = parse(value); break; case GNE_ATTR_BLOCK_MOVEMENT: myBlocked = parse(value); getViewNet()->update(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); + } +} + + +void +GNEDetectorE3::updateGeometryConnections() { + myConnectionPositions.clear(); + // Iterate over Entrys + for (std::vector::iterator i = myGNEDetectorEntrys.begin(); i != myGNEDetectorEntrys.end(); i++) { + std::vector posConnection; + double A = std::abs((*i)->getPositionInView().x() - getPositionInView().x()); + double B = std::abs((*i)->getPositionInView().y() - getPositionInView().y()); + // Set positions of connection's vertex. Connection is build from Entry to E3 + posConnection.push_back((*i)->getPositionInView()); + if (getPositionInView().x() > (*i)->getPositionInView().x()) { + if (getPositionInView().y() > (*i)->getPositionInView().y()) { + posConnection.push_back(Position((*i)->getPositionInView().x() + A, (*i)->getPositionInView().y())); + } else { + posConnection.push_back(Position((*i)->getPositionInView().x(), (*i)->getPositionInView().y() - B)); + } + } else { + if (getPositionInView().y() > (*i)->getPositionInView().y()) { + posConnection.push_back(Position((*i)->getPositionInView().x(), (*i)->getPositionInView().y() + B)); + } else { + posConnection.push_back(Position((*i)->getPositionInView().x() - A, (*i)->getPositionInView().y())); + } + } + posConnection.push_back(getPositionInView()); + myConnectionPositions.push_back(posConnection); + } + // Iterate over exits + for (std::vector::iterator i = myGNEDetectorExits.begin(); i != myGNEDetectorExits.end(); i++) { + std::vector posConnection; + double A = std::abs((*i)->getPositionInView().x() - getPositionInView().x()); + double B = std::abs((*i)->getPositionInView().y() - getPositionInView().y()); + // Set positions of connection's vertex. Connection is build from Entry to E3 + posConnection.push_back((*i)->getPositionInView()); + if (getPositionInView().x() > (*i)->getPositionInView().x()) { + if (getPositionInView().y() > (*i)->getPositionInView().y()) { + posConnection.push_back(Position((*i)->getPositionInView().x() + A, (*i)->getPositionInView().y())); + } else { + posConnection.push_back(Position((*i)->getPositionInView().x(), (*i)->getPositionInView().y() - B)); + } + } else { + if (getPositionInView().y() > (*i)->getPositionInView().y()) { + posConnection.push_back(Position((*i)->getPositionInView().x(), (*i)->getPositionInView().y() + B)); + } else { + posConnection.push_back(Position((*i)->getPositionInView().x() - A, (*i)->getPositionInView().y())); + } + } + posConnection.push_back(getPositionInView()); + myConnectionPositions.push_back(posConnection); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorE3.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorE3.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorE3.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorE3.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEDetectorE3.h /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEDetectorE3.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEDetectorE3.h 23150 2017-02-27 12:08:30Z behrisch $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -30,34 +30,38 @@ #include #endif -#include "GNEAdditionalSet.h" +#include "GNEAdditional.h" // =========================================================================== // class declarations // =========================================================================== -class GNEDetectorE3EntryExit; + class GNELane; +class GNEDetectorEntry; +class GNEDetectorExit; // =========================================================================== // class definitions // =========================================================================== /** * @class GNEDetectorE3 - * ------------ + * Class for multy Entry/multy Exits detectors */ -class GNEDetectorE3 : public GNEAdditionalSet { +class GNEDetectorE3 : public GNEAdditional { + /// @brief declare friend class (needed to manage Entry/Exit childs) + friend class GNEChange_Additional; + public: /**@brief GNEDetectorE3 Constructor * @param[in] id The storage of gl-ids to get the one for this lane representation from - * @param[in] viewNet pointer to GNEViewNet of this additionalSet element belongs + * @param[in] viewNet pointer to GNEViewNet of this additional element belongs * @param[in] pos position (center) of the detector in the map * @param[in] freq the aggregation period the values the detector collects shall be summed up. * @param[in] filename The path to the output file * @param[in] timeThreshold The time-based threshold that describes how much time has to pass until a vehicle is recognized as halting * @param[in] speedThreshold The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting - * @param[in] blocked set initial blocking state of item */ - GNEDetectorE3(const std::string& id, GNEViewNet* viewNet, Position pos, int freq, const std::string& filename, SUMOTime timeThreshold, SUMOReal speedThreshold, bool blocked); + GNEDetectorE3(const std::string& id, GNEViewNet* viewNet, Position pos, double freq, const std::string& filename, const double timeThreshold, double speedThreshold); /// @brief GNEDetectorE3 6Destructor ~GNEDetectorE3(); @@ -70,15 +74,39 @@ Position getPositionInView() const; /// @brief change the position of the E3 geometry - void moveAdditionalGeometry(SUMOReal offsetx, SUMOReal offsety); + void moveAdditionalGeometry(double offsetx, double offsety); /// @brief updated geometry changes in the attributes of additional - void commmitAdditionalGeometryMoved(SUMOReal oldPosx, SUMOReal oldPosy, GNEUndoList* undoList); + void commmitAdditionalGeometryMoved(double oldPosx, double oldPosy, GNEUndoList* undoList); - /**@brief writte additionalSet element into a xml file - * @param[in] device device in which write parameters of additionalSet element + /**@brief writte additionals element into a xml file + * @param[in] device device in which write parameters of additional element */ - void writeAdditional(OutputDevice& device, const std::string& currentDirectory); + void writeAdditional(OutputDevice& device) const; + + /// @brief gererate a new ID for an Entry detector child + std::string generateEntryID(); + + /// @brief gererate a new ID for an Exit detector child + std::string generateExitID(); + + /// @brief add an Entry child + void addEntryChild(GNEDetectorEntry* entry); + + /// @brief delete an Entry child + void removeEntryChild(GNEDetectorEntry* entry); + + /// @brief add an Exit child + void addExitChild(GNEDetectorExit* exit); + + /// @brief delete an Exit child + void removeExitChild(GNEDetectorExit* exit); + + /// @brief get number of entry childs + int getNumberOfEntryChilds() const; + + /// @brief get number of exit childs + int getNumberOfExitChilds() const; /// @name inherited from GUIGlObject /// @{ @@ -101,7 +129,7 @@ */ std::string getAttribute(SumoXMLAttr key) const; - /* @brief method for setting the attribute and letting the object perform additionalSet changes + /* @brief method for setting the attribute and letting the object perform additional changes * @param[in] key The attribute key * @param[in] value The new value * @param[in] undoList The undoList on which to register changes @@ -118,24 +146,30 @@ protected: /// @brief frequency of E3 detector - int myFreq; + double myFreq; /// @brief fielname of E3 detector std::string myFilename; /// @brief The time-based threshold that describes how much time has to pass until a vehicle is recognized as halting - SUMOTime myTimeThreshold; + double myTimeThreshold; /// @brief The speed-based threshold that describes how slow a vehicle has to be to be recognized as halting - SUMOReal mySpeedThreshold; + double mySpeedThreshold; /// @brief vector with the GNEDetectorE3EntryExits of the detector - std::vector myGNEDetectorE3EntryExits; + std::vector myGNEDetectorEntrys; + + /// @brief vector with the GNEDetectorE3EntryExits of the detector + std::vector myGNEDetectorExits; private: /// @brief set attribute after validation void setAttribute(SumoXMLAttr key, const std::string& value); + /// @brief update Connection's geometry + void updateGeometryConnections(); + /// @brief Invalidated copy constructor. GNEDetectorE3(const GNEDetectorE3&); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorEntry.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorEntry.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorEntry.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorEntry.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEDetectorEntry.cpp /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEDetectorEntry.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEDetectorEntry.cpp 24016 2017-04-22 14:13:39Z palcraft $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,18 +55,16 @@ #include "GNENet.h" #include "GNEChange_Attribute.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // =========================================================================== // member method definitions // =========================================================================== -GNEDetectorEntry::GNEDetectorEntry(const std::string& id, GNEViewNet* viewNet, GNELane* lane, SUMOReal pos, GNEDetectorE3* parent, bool blocked) : - GNEDetector(id, viewNet, SUMO_TAG_DET_ENTRY, lane, pos, 0, "", blocked, parent) { - // Update geometry; - updateGeometry(); +GNEDetectorEntry::GNEDetectorEntry(GNEViewNet* viewNet, GNEDetectorE3* parent, GNELane* lane, double pos) : + GNEDetector(parent->generateEntryID(), viewNet, SUMO_TAG_DET_ENTRY, ICON_E3ENTRY, lane, pos, 0, ""), + myE3Parent(parent) { + // Update geometry + updateGeometryByParent(); // Set colors myBaseColor = RGBColor(0, 204, 0, 255); myBaseColorSelected = RGBColor(125, 204, 0, 255); @@ -78,6 +76,12 @@ void GNEDetectorEntry::updateGeometry() { + myE3Parent->updateGeometry(); +} + + +void +GNEDetectorEntry::updateGeometryByParent() { // Clear all containers myShapeRotations.clear(); myShapeLengths.clear(); @@ -86,10 +90,10 @@ myShape.clear(); // Get shape of lane parent - myShape.push_back(myLane->getShape().positionAtOffset(myLane->getPositionRelativeToParametricLenght(myPosition.x()))); + myShape.push_back(myLane->getShape().positionAtOffset(myLane->getPositionRelativeToParametricLength(myPosition.x()))); // Save rotation (angle) of the vector constructed by points f and s - myShapeRotations.push_back(myLane->getShape().rotationDegreeAtOffset(myLane->getPositionRelativeToParametricLenght(myPosition.x())) * -1); + myShapeRotations.push_back(myLane->getShape().rotationDegreeAtOffset(myLane->getPositionRelativeToParametricLength(myPosition.x())) * -1); // Set block icon position myBlockIconPosition = myShape.getLineCenter(); @@ -100,31 +104,25 @@ // Set block icon rotation, and using their rotation for logo setBlockIconRotation(myLane); - // Update parent geometry - myAdditionalSetParent->updateGeometry(); - // Refresh element (neccesary to avoid grabbing problems) myViewNet->getNet()->refreshAdditional(this); } - Position GNEDetectorEntry::getPositionInView() const { - return myLane->getShape().positionAtOffset(myLane->getPositionRelativeToParametricLenght(myPosition.x())); + return myLane->getShape().positionAtOffset(myLane->getPositionRelativeToParametricLength(myPosition.x())); +} + + +GNEDetectorE3* +GNEDetectorEntry::getE3Parent() const { + return myE3Parent; } void -GNEDetectorEntry::writeAdditional(OutputDevice& device, const std::string&) { - // Write parameters - device.openTag(getTag()); - device.writeAttr(SUMO_ATTR_LANE, myLane->getID()); - device.writeAttr(SUMO_ATTR_POSITION, myPosition.x()); - if (myBlocked) { - device.writeAttr(GNE_ATTR_BLOCK_MOVEMENT, myBlocked); - } - // Close tag - device.closeTag(); +GNEDetectorEntry::writeAdditional(OutputDevice&) const { + // This additional cannot be writted calling this function because is writted by their E3Parent } @@ -143,7 +141,7 @@ } else { glColor3d(myBaseColor.red(), myBaseColor.green(), myBaseColor.blue()); } - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); // Push poligon matrix @@ -167,12 +165,12 @@ // first Arrow glTranslated(1.5, 0, 0); GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05); - GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25); // second Arrow glTranslated(-3, 0, 0); GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05); - GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25); // Pop poligon matrix glPopMatrix(); @@ -183,7 +181,7 @@ // Check if the distance is enought to draw details if (s.scale * exaggeration >= 10) { // Draw icon - drawDetectorIcon(GUITextureSubSys::getGif(GNETEXTURE_ENTRY), 1.5, 1); + drawDetectorIcon(GUITextureSubSys::getTexture(GNETEXTURE_ENTRY), 1.5, 1); // Show Lock icon depending of the Edit mode drawLockIcon(0.4); @@ -208,7 +206,7 @@ case GNE_ATTR_BLOCK_MOVEMENT: return toString(myBlocked); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -227,7 +225,7 @@ updateGeometry(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -248,11 +246,11 @@ return false; } case SUMO_ATTR_POSITION: - return (canParse(value) && parse(value) >= 0 && parse(value) <= (myLane->getLaneParametricLenght())); + return (canParse(value) && (parse(value) >= 0) && (parse(value) <= (myLane->getLaneParametricLength()))); case GNE_ATTR_BLOCK_MOVEMENT: return canParse(value); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -266,7 +264,7 @@ changeLane(value); break; case SUMO_ATTR_POSITION: - myPosition = Position(parse(value), 0); + myPosition = Position(parse(value), 0); updateGeometry(); getViewNet()->update(); break; @@ -275,7 +273,7 @@ getViewNet()->update(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorEntry.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorEntry.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorEntry.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorEntry.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEDetectorEntry.h /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEDetectorEntry.h 21150 2016-07-12 12:28:35Z behrisch $ +/// @version $Id: GNEDetectorEntry.h 23150 2017-02-27 12:08:30Z behrisch $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,14 +47,12 @@ class GNEDetectorEntry : public GNEDetector { public: /**@brief Constructor - * @param[in] id The storage of gl-ids to get the one for this lane representation from * @param[in] viewNet pointer to GNEViewNet of this additional element belongs + * @param[in] parent pointer to GNEDetectorE3 of this Entry belongs * @param[in] lane Lane of this StoppingPlace belongs * @param[in] pos position of the detector on the lane - * @param[in] parent pointer to GNEDetectorE3 of this additional element belongs - * @param[in] blocked set initial blocking state of item */ - GNEDetectorEntry(const std::string& id, GNEViewNet* viewNet, GNELane* lane, SUMOReal pos, GNEDetectorE3* parent, bool blocked = false); + GNEDetectorEntry(GNEViewNet* viewNet, GNEDetectorE3* parent, GNELane* lane, double pos); /// @brief destructor ~GNEDetectorEntry(); @@ -63,13 +61,19 @@ /// @note: must be called when geometry changes (i.e. lane moved) void updateGeometry(); + /// @brief update pre-computed geometry information called by E3 parent + void updateGeometryByParent(); + /// @brief Returns position of detector Entry in view Position getPositionInView() const; + /// @brief get E3 Detector parent + GNEDetectorE3* getE3Parent() const; + /**@brief writte additional element into a xml file * @param[in] device device in which write parameters of additional element */ - void writeAdditional(OutputDevice& device, const std::string&); + void writeAdditional(OutputDevice& device) const; /// @name inherited from GUIGlObject /// @{ @@ -104,11 +108,14 @@ /// @} private: + /// @brief pointer to E3 parent + GNEDetectorE3* myE3Parent; + /// @brief variable to save detectorEntry icon - static GUIGlID detectorE3EntryGlID; + static GUIGlID detectorEntryGlID; /// @brief check if detectorEntry icon was inicilalizated - static bool detectorE3EntryInitialized; + static bool detectorEntryInitialized; /// @brief set attribute after validation void setAttribute(SumoXMLAttr key, const std::string& value); @@ -126,7 +133,7 @@ int getFrequency() const; /// @brief Invalidated set filename - void setFrequency(int freq); + void setFrequency(double freq); /// @brief Invalidated void setFilename(std::string filename); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorExit.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorExit.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorExit.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorExit.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEDetectorExit.cpp /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEDetectorExit.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEDetectorExit.cpp 24016 2017-04-22 14:13:39Z palcraft $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,19 +55,16 @@ #include "GNENet.h" #include "GNEChange_Attribute.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif - // =========================================================================== // member method definitions // =========================================================================== -GNEDetectorExit::GNEDetectorExit(const std::string& id, GNEViewNet* viewNet, GNELane* lane, SUMOReal pos, GNEDetectorE3* parent, bool blocked) : - GNEDetector(id, viewNet, SUMO_TAG_DET_EXIT, lane, pos, 0, "", blocked, parent) { - // Update geometry; - updateGeometry(); +GNEDetectorExit::GNEDetectorExit(GNEViewNet* viewNet, GNEDetectorE3* parent, GNELane* lane, double pos) : + GNEDetector(parent->generateExitID(), viewNet, SUMO_TAG_DET_EXIT, ICON_E3EXIT, lane, pos, 0, ""), + myE3Parent(parent) { + // Update geometry + updateGeometryByParent(); // Set colors myBaseColor = RGBColor(204, 0, 0, 255); myBaseColorSelected = RGBColor(204, 125, 0, 255); @@ -79,6 +76,12 @@ void GNEDetectorExit::updateGeometry() { + myE3Parent->updateGeometry(); +} + + +void +GNEDetectorExit::updateGeometryByParent() { // Clear all containers myShapeRotations.clear(); myShapeLengths.clear(); @@ -87,10 +90,10 @@ myShape.clear(); // Get shape of lane parent - myShape.push_back(myLane->getShape().positionAtOffset(myLane->getPositionRelativeToParametricLenght(myPosition.x()))); + myShape.push_back(myLane->getShape().positionAtOffset(myLane->getPositionRelativeToParametricLength(myPosition.x()))); // Save rotation (angle) of the vector constructed by points f and s - myShapeRotations.push_back(myLane->getShape().rotationDegreeAtOffset(myLane->getPositionRelativeToParametricLenght(myPosition.x())) * -1); + myShapeRotations.push_back(myLane->getShape().rotationDegreeAtOffset(myLane->getPositionRelativeToParametricLength(myPosition.x())) * -1); // Set offset of logo myDetectorLogoOffset = Position(-2, 0); @@ -101,9 +104,6 @@ // Set block icon rotation, and using their rotation for logo setBlockIconRotation(myLane); - // Update parent geometry - myAdditionalSetParent->updateGeometry(); - // Refresh element (neccesary to avoid grabbing problems) myViewNet->getNet()->refreshAdditional(this); } @@ -111,21 +111,19 @@ Position GNEDetectorExit::getPositionInView() const { - return myLane->getShape().positionAtOffset(myLane->getPositionRelativeToParametricLenght(myPosition.x())); + return myLane->getShape().positionAtOffset(myLane->getPositionRelativeToParametricLength(myPosition.x())); +} + + +GNEDetectorE3* +GNEDetectorExit::getE3Parent() const { + return myE3Parent; } void -GNEDetectorExit::writeAdditional(OutputDevice& device, const std::string&) { - // Write parameters - device.openTag(getTag()); - device.writeAttr(SUMO_ATTR_LANE, myLane->getID()); - device.writeAttr(SUMO_ATTR_POSITION, myPosition.x()); - if (myBlocked) { - device.writeAttr(GNE_ATTR_BLOCK_MOVEMENT, myBlocked); - } - // Close tag - device.closeTag(); +GNEDetectorExit::writeAdditional(OutputDevice&) const { + // This additional cannot be writted calling this function because is writted by their E3Parent } @@ -144,7 +142,7 @@ } else { glColor3d(myBaseColor.red(), myBaseColor.green(), myBaseColor.blue()); } - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); // Push poligon matrix @@ -168,12 +166,12 @@ // first Arrow glTranslated(1.5, 0, 0); GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05); - GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25); // second Arrow glTranslated(-3, 0, 0); GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05); - GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25); // Pop poligon matrix glPopMatrix(); @@ -184,7 +182,7 @@ // Check if the distance is enought to draw details if (s.scale * exaggeration >= 10) { // Draw icon - drawDetectorIcon(GUITextureSubSys::getGif(GNETEXTURE_EXIT), 1.5, 1); + drawDetectorIcon(GUITextureSubSys::getTexture(GNETEXTURE_EXIT), 1.5, 1); // Show Lock icon depending of the Edit mode drawLockIcon(0.4); @@ -209,7 +207,7 @@ case GNE_ATTR_BLOCK_MOVEMENT: return toString(myBlocked); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -228,7 +226,7 @@ updateGeometry(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -250,11 +248,11 @@ return false; } case SUMO_ATTR_POSITION: - return (canParse(value) && parse(value) >= 0 && parse(value) <= (myLane->getLaneParametricLenght())); + return (canParse(value) && (parse(value) >= 0) && (parse(value) <= (myLane->getLaneParametricLength()))); case GNE_ATTR_BLOCK_MOVEMENT: return canParse(value); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -268,7 +266,7 @@ changeLane(value); break; case SUMO_ATTR_POSITION: - myPosition = Position(parse(value), 0); + myPosition = Position(parse(value), 0); updateGeometry(); getViewNet()->update(); break; @@ -277,7 +275,7 @@ getViewNet()->update(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorExit.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorExit.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetectorExit.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetectorExit.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEDetectorExit.h /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEDetectorExit.h 21150 2016-07-12 12:28:35Z behrisch $ +/// @version $Id: GNEDetectorExit.h 23150 2017-02-27 12:08:30Z behrisch $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,14 +47,12 @@ class GNEDetectorExit : public GNEDetector { public: /**@brief Constructor - * @param[in] id The storage of gl-ids to get the one for this lane representation from * @param[in] viewNet pointer to GNEViewNet of this additional element belongs + * @param[in] parent pointer to GNEDetectorE3 of this Exit belongs * @param[in] lane Lane of this StoppingPlace belongs * @param[in] pos position of the detector on the lane - * @param[in] parent pointer to GNEDetectorE3 of this additional element belongs - * @param[in] blocked set initial blocking state of item */ - GNEDetectorExit(const std::string& id, GNEViewNet* viewNet, GNELane* lane, SUMOReal pos, GNEDetectorE3* parent, bool blocked = false); + GNEDetectorExit(GNEViewNet* viewNet, GNEDetectorE3* parent, GNELane* lane, double pos); /// @brief destructor ~GNEDetectorExit(); @@ -66,10 +64,16 @@ /// @brief Returns position of detector Exit in view Position getPositionInView() const; + /// @brief get E3 Detector parent + GNEDetectorE3* getE3Parent() const; + /**@brief writte additional element into a xml file * @param[in] device device in which write parameters of additional element */ - void writeAdditional(OutputDevice& device, const std::string&); + void writeAdditional(OutputDevice& device) const; + + /// @brief update pre-computed geometry information called by E3 parent + void updateGeometryByParent(); /// @name inherited from GUIGlObject /// @{ @@ -104,11 +108,14 @@ /// @} private: + /// @brief pointer to E3 parent + GNEDetectorE3* myE3Parent; + /// @brief variable to save detectorExit icon - static GUIGlID detectorE3ExitGlID; + static GUIGlID detectorExitGlID; /// @brief check if detectorExit icon was inicilalizated - static bool detectorE3ExitInitialized; + static bool detectorExitInitialized; /// @brief set attribute after validation void setAttribute(SumoXMLAttr key, const std::string& value); @@ -126,7 +133,7 @@ int getFrequency() const; /// @brief Invalidated set filename - void setFrequency(int freq); + void setFrequency(double freq); /// @brief Invalidated void setFilename(std::string filename); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetector.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetector.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDetector.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDetector.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEDetectorE1.h /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNEDetector.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEDetector.h 23150 2017-02-27 12:08:30Z behrisch $ /// /// A abstract class to define common parameters of detectors /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -52,13 +52,12 @@ * @param[in] lane Lane of this detector belongs * @param[in] viewNet pointer to GNEViewNet of this additional element belongs * @param[in] tag Type of xml tag that define the detector (SUMO_TAG_E1DETECTOR, SUMO_TAG_LANE_AREA_DETECTOR, etc...) + * @param[in] icon GUIIcon associated to the detector * @param[in] posOverLane position of detector in lane * @param[in] freq the aggregation period the values the detector collects shall be summed up. * @param[in] filename The path to the output file. - * @param[in] blocked set initial blocking state of item - * @param[in] parent pointer to parent, if this additional belongs to an additionalSet */ - GNEDetector(const std::string& id, GNEViewNet* viewNet, SumoXMLTag tag, GNELane* lane, SUMOReal posOverLane, int freq, const std::string& filename, bool blocked = false, GNEAdditionalSet* parent = NULL); + GNEDetector(const std::string& id, GNEViewNet* viewNet, SumoXMLTag tag, GUIIcon icon, GNELane* lane, double posOverLane, double freq, const std::string& filename); /// @brief Destructor ~GNEDetector(); @@ -70,22 +69,22 @@ virtual Position getPositionInView() const = 0; /// @brief change the position of the additional geometry - void moveAdditionalGeometry(SUMOReal offsetx, SUMOReal offsety); + void moveAdditionalGeometry(double offsetx, double offsety); /// @brief updated geometry changes in the attributes of additional - void commmitAdditionalGeometryMoved(SUMOReal oldPosx, SUMOReal, GNEUndoList* undoList); + void commmitAdditionalGeometryMoved(double oldPosx, double, GNEUndoList* undoList); /**@brief writte additional element into a xml file * @param[in] device device in which write parameters of additional element * @param[in] currentDirectory current directory in which this additional are writted */ - virtual void writeAdditional(OutputDevice& device, const std::string& currentDirectory) = 0; + virtual void writeAdditional(OutputDevice& device) const = 0; /// @brief Returns the position of the detector over lane - SUMOReal getPositionOverLane() const; + double getPositionOverLane() const; /// @brief returns the aggregation period the values the detector collects shall be summed up. - int getFrequency() const; + double getFrequency() const; /// @brief returns the path to the output file std::string getFilename() const; @@ -94,13 +93,13 @@ * @param[in] pos new position of detector over lane * @throws InvalidArgument if value of pos isn't valid */ - void setPositionOverLane(SUMOReal pos); + void setPositionOverLane(double pos); /**@brief Set a new frequency in detector * @param[in] freq new frequency of detector * @throws InvalidArgument if value of frequency isn't valid */ - void setFrequency(int freq); + void setFrequency(const double freq); /**@brief Set a new filename in detector * @param[in] filename new filename of detector @@ -145,7 +144,7 @@ protected: /// @brief The aggregation period the values the detector collects shall be summed up. - int myFreq; + double myFreq; /// @brief The path to the output file std::string myFilename; @@ -153,7 +152,7 @@ /// @name members and functions relative to detector icon /// @{ /// @brief set Rotation of block Icon - void drawDetectorIcon(const int GNELogoID, SUMOReal sizex = 0.5, SUMOReal sizey = 0.5) const; + void drawDetectorIcon(const int GNELogoID, double sizex = 0.5, double sizey = 0.5) const; /// @brief The position of detector Position myDetectorLogoOffset; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDialog_About.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDialog_About.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDialog_About.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDialog_About.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEDialog_About.cpp /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNEDialog_About.cpp 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: GNEDialog_About.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The "About" - dialog for NETEDIT, (adapted from GUIDialog_AboutSUMO) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,107 +35,58 @@ #include #include #include +#include #include "GNEDialog_About.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - - -// =========================================================================== -// bitmap definitions -// =========================================================================== -static const char* dlr_icon[] = { - "40 42 3 1", - "# c #000000", - "a c #333333", - ". c #ffffff", - "........................................", - "........................................", - "...........................#............", - "..........................##............", - ".........................###............", - "........................####............", - ".......................#####............", - "......................###.##............", - ".....................###..##............", - "....................###...##............", - "...................###....##............", - "..................###.....##............", - ".........##############################.", - "........##############################..", - ".......###.....###.......###......###...", - "......###.....###.......###......###....", - ".....###.....###.......###......###.....", - "....###.....###.......###......###......", - "...###.....###.......###......###.......", - "..##############################........", - ".##############################.........", - "...........##.....###...................", - "...........##....###....................", - "...........##...###.....................", - "...........##..###......................", - "...........##.###.......................", - "...........#####........................", - "...........####.........................", - "...........###..........................", - "...........##...........................", - "...........#...#####....##.....#####....", - "...............######...##.....######...", - "...............##..###..##.....##..##...", - "...............##...##..##.....##..##...", - "...............##...##..##.....#####....", - "...............##...##..##.....#####....", - "...............##..###..##.....##.###...", - "...............######...#####..##..##...", - "...............#####....#####..##..###..", - "........................................", - "........................................", - "........................................" -}; - // =========================================================================== // method definitions // =========================================================================== GNEDialog_About::GNEDialog_About(FXWindow* parent) : - FXDialogBox(parent, "About NETEDIT", DECOR_CLOSE | DECOR_TITLE) { - FXVerticalFrame* f1 = new FXVerticalFrame(this, LAYOUT_TOP | FRAME_NONE | LAYOUT_FILL_X, 0, 0, 0, 0, 0, 0, 1, 1); - // build icons - FXHorizontalFrame* f2 = new FXHorizontalFrame(f1, LAYOUT_TOP | LAYOUT_CENTER_X | FRAME_NONE, 0, 0, 0, 0, 0, 0, 1, 1); - myDLRIcon = new FXXPMIcon(getApp(), dlr_icon); - new FXButton(f2, "\tDLR\t.", myDLRIcon, 0, 0, LAYOUT_CENTER_Y | TEXT_OVER_ICON, 5, 0, 40 + 5, 0, 0, 0, 0, 0); + FXDialogBox(parent, "About NETEDIT", GUIDesignDialogBox) { + // set dialog icon + setIcon(GUIIconSubSys::getIcon(ICON_NETEDIT)); + + // create frame for main info + FXHorizontalFrame* mainInfoFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame); + + // DLR Icon + new FXLabel(mainInfoFrame, "", GUIIconSubSys::getIcon(ICON_DLR), GUIDesignLabelIcon64x64noSpacing); + // "NETEDIT " - FXVerticalFrame* f4 = new FXVerticalFrame(f2, FRAME_NONE, 0, 0, 0, 0, 20, 0, 0, 0); - new FXButton(f2, "", GUIIconSubSys::getIcon(ICON_NETEDIT), 0, 0, LAYOUT_CENTER_Y | TEXT_OVER_ICON, 5, 0, 40 + 5, 0, 12, 0, 0, 0); + FXVerticalFrame* descriptionFrame = new FXVerticalFrame(mainInfoFrame, GUIDesignLabelAboutInfo); myHeadlineFont = new FXFont(getApp(), "Arial", 18, FXFont::Bold); - FXLabel* l = new FXLabel(f4, "NETEDIT " VERSION_STRING, 0, LAYOUT_CENTER_Y | LAYOUT_CENTER_X | JUSTIFY_CENTER_X | LABEL_NORMAL, 0, 0, 0, 0, 0, 0, 0, 0); - l->setFont(myHeadlineFont); - new FXLabel(f4, "Network editor for SUMO, the Simulation of Urban MObility", 0, LAYOUT_CENTER_Y | LAYOUT_CENTER_X | JUSTIFY_CENTER_X | LABEL_NORMAL, 0, 0, 0, 0, 0, 0, 0, 0); - new FXLabel(f4, HAVE_ENABLED, 0, LAYOUT_CENTER_Y | LAYOUT_CENTER_X | JUSTIFY_CENTER_X | LABEL_NORMAL, 0, 0, 0, 0, 0, 0, 0, 0); - // - // additional infos - FXVerticalFrame* f3 = new FXVerticalFrame(f1, FRAME_NONE, 0, 0, 0, 0, 0, 0, 0, 0); + FXLabel* neteditLabel = new FXLabel(descriptionFrame, "NETEDIT " VERSION_STRING, 0, GUIDesignLabelAboutInfo); + neteditLabel->setFont(myHeadlineFont); + new FXLabel(descriptionFrame, "Network editor for SUMO, the Simulation of Urban MObility", 0, GUIDesignLabelAboutInfo); + new FXLabel(descriptionFrame, HAVE_ENABLED, 0, GUIDesignLabelAboutInfo); + + // Netedit icon + new FXLabel(mainInfoFrame, "", GUIIconSubSys::getIcon(ICON_NETEDIT), GUIDesignLabelIcon64x64noSpacing); + // copyright notice - new FXLabel(f3, "Copyright (C) 2001-2016 DLR / Institute of Transportation Systems", 0, LAYOUT_CENTER_X | JUSTIFY_CENTER_X | LABEL_NORMAL, 0, 0, 0, 0, 0, 0, 0, 0); + new FXLabel(this, "Part of SUMO, the Simulation of Urban MObility.", 0, GUIDesignLabelAboutInfo); + new FXLabel(this, "Copyright (C) 2001-2017 DLR / Institute of Transportation Systems", 0, GUIDesignLabelAboutInfo); - FXLinkLabel* link = new FXLinkLabel(f3, "http://sumo.dlr.de", 0, LAYOUT_CENTER_X | JUSTIFY_CENTER_X | LABEL_NORMAL, 0, 0, 0, 0, 5, 5, 5, 5); + // link to homepage + FXLinkLabel* link = new FXLinkLabel(this, "http://sumo.dlr.de", 0, GUIDesignLabelCenter); link->setTipText("http://sumo.dlr.de"); - // ok-button - new FXButton(f1, "OK\t\t", 0, this, ID_ACCEPT, LAYOUT_FIX_WIDTH | LAYOUT_CENTER_X | JUSTIFY_CENTER_X | FRAME_THICK | FRAME_RAISED, 0, 0, 50, 30); - setIcon(GUIIconSubSys::getIcon(ICON_NETEDIT)); + + // centered ok-button + FXHorizontalFrame* buttonFrame = new FXHorizontalFrame(this, GUIDesignHorizontalFrame); + new FXHorizontalFrame(buttonFrame, GUIDesignAuxiliarHorizontalFrame); + new FXButton(buttonFrame, "OK\t\t", GUIIconSubSys::getIcon(ICON_ACCEPT), this, ID_ACCEPT, GUIDesignButtonOK); + new FXHorizontalFrame(buttonFrame, GUIDesignAuxiliarHorizontalFrame); } void GNEDialog_About::create() { FXDialogBox::create(); - myDLRIcon->create(); } GNEDialog_About::~GNEDialog_About() { - delete myDLRIcon; delete myHeadlineFont; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDialog_About.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDialog_About.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDialog_About.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDialog_About.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEDialog_About.h /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNEDialog_About.h 20975 2016-06-15 13:02:40Z palcraft $ +/// @version $Id: GNEDialog_About.h 22743 2017-01-29 11:07:55Z palcraft $ /// // The "About" - dialog for NETEDIT, (adapted from GUIDialog_AboutSUMO) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -50,14 +50,10 @@ /// @brief Destructor ~GNEDialog_About(); - /// @brief Creates the widget (and the icons) + /// @brief Creates the widget void create(); - private: - /// @brief Icons for the widget - FXIcon* myDLRIcon; - /// @brief Font for the widget FXFont* myHeadlineFont; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDialog_AllowDisallow.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDialog_AllowDisallow.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDialog_AllowDisallow.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDialog_AllowDisallow.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,245 @@ +/****************************************************************************/ +/// @file GNEDialog_AllowDisallow.cpp +/// @author Pablo Alvarez Lopez +/// @date April 2016 +/// @version $Id: GNEDialog_AllowDisallow.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// Dialog for edit rerouters +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include "GNEDialog_AllowDisallow.h" + + +// =========================================================================== +// FOX callback mapping +// =========================================================================== + +FXDEFMAP(GNEDialog_AllowDisallow) GNEDialog_AllowDisallowMap[] = { + FXMAPFUNC(SEL_COMMAND, MID_GNE_ALLOWDISALLOW_CHANGE, GNEDialog_AllowDisallow::onCmdValueChanged), + FXMAPFUNC(SEL_COMMAND, MID_GNE_ALLOWDISALLOW_SELECTALL, GNEDialog_AllowDisallow::onCmdSelectAll), + FXMAPFUNC(SEL_COMMAND, MID_GNE_ALLOWDISALLOW_UNSELECTALL, GNEDialog_AllowDisallow::onCmdUnselectAll), + FXMAPFUNC(SEL_COMMAND, MID_GNE_ALLOWDISALLOW_SELECTONLYNONROAD, GNEDialog_AllowDisallow::onCmdSelectOnlyNonRoad), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_ACCEPT, GNEDialog_AllowDisallow::onCmdAccept), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_CANCEL, GNEDialog_AllowDisallow::onCmdCancel), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_RESET, GNEDialog_AllowDisallow::onCmdReset), +}; + +// Object implementation +FXIMPLEMENT(GNEDialog_AllowDisallow, FXDialogBox, GNEDialog_AllowDisallowMap, ARRAYNUMBER(GNEDialog_AllowDisallowMap)) + +// =========================================================================== +// member method definitions +// =========================================================================== + +GNEDialog_AllowDisallow::GNEDialog_AllowDisallow(FXApp* app, std::string* allow) : + FXDialogBox(app, ("Edit allowed and disallowed " + toString(SUMO_ATTR_VCLASS) + "es").c_str(), GUIDesignDialogBox), + myAllow(allow), + myCopyOfAllow(*allow) { + // set vehicle icon for this dialog + this->setIcon(GUIIconSubSys::getIcon(ICON_GREENVEHICLE)); + // create main frame + FXVerticalFrame* mainFrame = new FXVerticalFrame(this, GUIDesignAuxiliarFrame); + // create groupbox for options + FXGroupBox* myGroupBoxOptions = new FXGroupBox(mainFrame, "Selection options", GUIDesignGroupBoxFrame); + FXHorizontalFrame* myOptionsFrame = new FXHorizontalFrame(myGroupBoxOptions, GUIDesignAuxiliarHorizontalFrame); + mySelectAllVClassButton = new FXButton(myOptionsFrame, "", GUIIconSubSys::getIcon(ICON_OK), this, MID_GNE_ALLOWDISALLOW_SELECTALL, GUIDesignButtonIcon); + new FXLabel(myOptionsFrame, "Select all vehicles", NULL, GUIDesignLabelLeftThick); + myUnselectAllVClassButton = new FXButton(myOptionsFrame, "", GUIIconSubSys::getIcon(ICON_OK), this, MID_GNE_ALLOWDISALLOW_UNSELECTALL, GUIDesignButtonIcon); + new FXLabel(myOptionsFrame, "Unselect all vehicles", NULL, GUIDesignLabelLeftThick); + mySelectOnlyNonRoadVClassButton = new FXButton(myOptionsFrame, "", GUIIconSubSys::getIcon(ICON_OK), this, MID_GNE_ALLOWDISALLOW_SELECTONLYNONROAD, GUIDesignButtonIcon); + new FXLabel(myOptionsFrame, "Select only non-road vehicles", NULL, GUIDesignLabelLeftThick); + // create groupbox for vehicles + FXGroupBox* myGroupBoxVehiclesFrame = new FXGroupBox(mainFrame, ("Select " + toString(SUMO_ATTR_VCLASS) + "es").c_str(), GUIDesignGroupBoxFrame); + // Create frame for vehicles's columns + FXHorizontalFrame* myVehiclesFrame = new FXHorizontalFrame(myGroupBoxVehiclesFrame, GUIDesignContentsFrame); + // create left frame and fill it + FXVerticalFrame* myContentLeftFrame = new FXVerticalFrame(myVehiclesFrame, GUIDesignAuxiliarFrame); + buildVClass(myContentLeftFrame, SVC_PASSENGER, ICON_VCLASS_PASSENGER, "Default vehicle class"); + buildVClass(myContentLeftFrame, SVC_TAXI, ICON_VCLASS_TAXI, "Vehicle for hire with a driver"); + buildVClass(myContentLeftFrame, SVC_BUS, ICON_VCLASS_BUS, "Urban line traffic"); + buildVClass(myContentLeftFrame, SVC_COACH, ICON_VCLASS_COACH, "Overland transport"); + buildVClass(myContentLeftFrame, SVC_DELIVERY, ICON_VCLASS_DELIVERY, "Vehicles specialized to deliver goods"); + buildVClass(myContentLeftFrame, SVC_TRUCK, ICON_VCLASS_TRUCK, "Vehicle designed to transport cargo"); + buildVClass(myContentLeftFrame, SVC_TRAILER, ICON_VCLASS_TRAILER, "Truck with trailer"); + buildVClass(myContentLeftFrame, SVC_EMERGENCY, ICON_VCLASS_EMERGENCY, "Vehicle designated to respond to an emergency"); + // create center frame and fill it + FXVerticalFrame* myContentCenterFrame = new FXVerticalFrame(myVehiclesFrame, GUIDesignAuxiliarFrame); + buildVClass(myContentCenterFrame, SVC_MOTORCYCLE, ICON_VCLASS_MOTORCYCLE, "Two- or three-wheeled motor vehicle"); + buildVClass(myContentCenterFrame, SVC_MOPED, ICON_VCLASS_MOPED, "Motorcycle not allowed in motorways"); + buildVClass(myContentCenterFrame, SVC_BICYCLE, ICON_VCLASS_BICYCLE, "Human-powered, pedal-driven vehicle"); + buildVClass(myContentCenterFrame, SVC_PEDESTRIAN, ICON_VCLASS_PEDESTRIAN, "Person traveling on foot"); + buildVClass(myContentCenterFrame, SVC_TRAM, ICON_VCLASS_TRAM, "Rail vehicle which runs on tracks"); + buildVClass(myContentCenterFrame, SVC_RAIL_URBAN, ICON_VCLASS_RAIL_URBAN, "Heavier than tram"); + buildVClass(myContentCenterFrame, SVC_RAIL, ICON_VCLASS_RAIL, "Heavy rail vehicle (ICE)"); + buildVClass(myContentCenterFrame, SVC_RAIL_ELECTRIC, ICON_VCLASS_RAIL_ELECTRIC, "Rail electric vehicle (Trolleybus)"); + buildVClass(myContentCenterFrame, SVC_SHIP, ICON_VCLASS_SHIP, "Basic class for navigating waterway"); + buildVClass(myContentCenterFrame, SVC_E_VEHICLE, ICON_VCLASS_EVEHICLE, "Future electric mobility vehicles"); + // create right frame and fill it (8 vehicles) + FXVerticalFrame* myContentRightFrame = new FXVerticalFrame(myVehiclesFrame, GUIDesignAuxiliarFrame); + buildVClass(myContentRightFrame, SVC_PRIVATE, ICON_VCLASS_PRIVATE, "A passenger car assigned for private use"); + buildVClass(myContentRightFrame, SVC_ARMY, ICON_VCLASS_ARMY, "Vehicle designed for military forces"); + buildVClass(myContentRightFrame, SVC_AUTHORITY, ICON_VCLASS_AUTHORITY, "Vehicle of a governmental security agency"); + buildVClass(myContentRightFrame, SVC_VIP, ICON_VCLASS_VIP, "A civilian security armored car used by VIPs"); + buildVClass(myContentRightFrame, SVC_HOV, ICON_VCLASS_HOV, "High-Occupancy Vehicle (two or more passengers)"); + buildVClass(myContentRightFrame, SVC_CUSTOM1, ICON_VCLASS_CUSTOM1, "Reserved for user-defined semantics"); + buildVClass(myContentRightFrame, SVC_CUSTOM2, ICON_VCLASS_CUSTOM2, "Reserved for user-defined semantics"); + // create dialog buttons bot centered + FXHorizontalFrame* buttonsFrame = new FXHorizontalFrame(mainFrame, GUIDesignHorizontalFrame); + new FXHorizontalFrame(buttonsFrame, GUIDesignAuxiliarHorizontalFrame); + myAcceptButton = new FXButton(buttonsFrame, "accept\t\tclose", GUIIconSubSys::getIcon(ICON_ACCEPT), this, MID_GNE_MODE_ADDITIONALDIALOG_ACCEPT, GUIDesignButtonAccept); + myCancelButton = new FXButton(buttonsFrame, "cancel\t\tclose", GUIIconSubSys::getIcon(ICON_CANCEL), this, MID_GNE_MODE_ADDITIONALDIALOG_CANCEL, GUIDesignButtonCancel); + myResetButton = new FXButton(buttonsFrame, "reset\t\tclose", GUIIconSubSys::getIcon(ICON_RESET), this, MID_GNE_MODE_ADDITIONALDIALOG_RESET, GUIDesignButtonReset); + new FXHorizontalFrame(buttonsFrame, GUIDesignAuxiliarHorizontalFrame); + // reset dialog + onCmdReset(0, 0, 0); +} + + +GNEDialog_AllowDisallow::~GNEDialog_AllowDisallow() { +} + + +long +GNEDialog_AllowDisallow::onCmdValueChanged(FXObject* obj, FXSelector, void*) { + FXButton* buttonPressed = dynamic_cast(obj); + // change icon of button + for (std::map >::iterator i = myVClassMap.begin(); i != myVClassMap.end(); i++) { + if (i->second.first == buttonPressed) { + if (buttonPressed->getIcon() == GUIIconSubSys::getIcon(ICON_ACCEPT)) { + buttonPressed->setIcon(GUIIconSubSys::getIcon(ICON_CANCEL)); + } else { + buttonPressed->setIcon(GUIIconSubSys::getIcon(ICON_ACCEPT)); + } + return 1; + } + } + return 1; +} + + +long +GNEDialog_AllowDisallow::onCmdSelectAll(FXObject*, FXSelector, void*) { + // change all icons to accept + for (std::map >::iterator i = myVClassMap.begin(); i != myVClassMap.end(); i++) { + i->second.first->setIcon(GUIIconSubSys::getIcon(ICON_ACCEPT)); + } + return 1; +} + + +long +GNEDialog_AllowDisallow::onCmdUnselectAll(FXObject*, FXSelector, void*) { + // change all icons to cancel + for (std::map >::iterator i = myVClassMap.begin(); i != myVClassMap.end(); i++) { + i->second.first->setIcon(GUIIconSubSys::getIcon(ICON_CANCEL)); + } + return 1; +} + + +long +GNEDialog_AllowDisallow::onCmdSelectOnlyNonRoad(FXObject*, FXSelector, void*) { + // change all non-road icons to accept, and to cancel for the rest + for (std::map >::iterator i = myVClassMap.begin(); i != myVClassMap.end(); i++) { + if ((i->first == SVC_TRAM) || (i->first == SVC_RAIL) || (i->first == SVC_RAIL_URBAN) || (i->first == SVC_RAIL_ELECTRIC) || (i->first == SVC_SHIP)) { + i->second.first->setIcon(GUIIconSubSys::getIcon(ICON_ACCEPT)); + } else { + i->second.first->setIcon(GUIIconSubSys::getIcon(ICON_CANCEL)); + } + } + return 1; +} + + +long +GNEDialog_AllowDisallow::onCmdAccept(FXObject*, FXSelector, void*) { + // clear allow and disallow VClasses + std::vector allowedVehicles; + for (std::map >::iterator i = myVClassMap.begin(); i != myVClassMap.end(); i++) { + // check if vehicle is alloweddepending of the Icon + if (i->second.first->getIcon() == GUIIconSubSys::getIcon(ICON_ACCEPT)) { + allowedVehicles.push_back(getVehicleClassNames(i->first)); + } + } + // chek if all vehicles are enabled and set new allowed vehicles + if (allowedVehicles.size() == 25) { + (*myAllow) = "all"; + } else { + (*myAllow) = joinToString(allowedVehicles, " "); + } + // Stop Modal + getApp()->stopModal(this, TRUE); + return 1; +} + + +long +GNEDialog_AllowDisallow::onCmdCancel(FXObject*, FXSelector, void*) { + // Stop Modal + getApp()->stopModal(this, FALSE); + return 1; +} + + +long +GNEDialog_AllowDisallow::onCmdReset(FXObject*, FXSelector, void*) { + // clear allow and disallow VClasses + std::vector allowStringVector; + SUMOSAXAttributes::parseStringVector(myCopyOfAllow, allowStringVector); + // iterate over myVClassMap and set icons + for (std::map >::iterator i = myVClassMap.begin(); i != myVClassMap.end(); i++) { + if (std::find(allowStringVector.begin(), allowStringVector.end(), getVehicleClassNames(i->first)) != allowStringVector.end()) { + i->second.first->setIcon(GUIIconSubSys::getIcon(ICON_ACCEPT)); + i->second.second->setText((getVehicleClassNames(i->first) + " allowed").c_str()); + } else { + i->second.first->setIcon(GUIIconSubSys::getIcon(ICON_CANCEL)); + i->second.second->setText((getVehicleClassNames(i->first) + " disallowed").c_str()); + } + } + return 1; +} + + +void +GNEDialog_AllowDisallow::buildVClass(FXVerticalFrame* contentsFrame, SUMOVehicleClass vclass, GUIIcon icon, const std::string& description) { + // add frame for vehicle icons + FXHorizontalFrame* vehicleFrame = new FXHorizontalFrame(contentsFrame, GUIDesignAuxiliarHorizontalFrame); + FXLabel* labelVehicleIcon = new FXLabel(vehicleFrame, "", GUIIconSubSys::getIcon(icon), GUIDesignLabelIcon64x32Thicked); + labelVehicleIcon->setBackColor(FXRGBA(255, 255, 255, 255)); + // create frame for information and button + FXVerticalFrame* buttonAndInformationFrame = new FXVerticalFrame(vehicleFrame, GUIDesignAuxiliarHorizontalFrame); + FXHorizontalFrame* buttonAndStatusFrame = new FXHorizontalFrame(buttonAndInformationFrame, GUIDesignAuxiliarHorizontalFrame); + // create status and text button + myVClassMap[vclass].first = new FXButton(buttonAndStatusFrame, "", GUIIconSubSys::getIcon(ICON_EMPTY), this, MID_GNE_ALLOWDISALLOW_CHANGE, GUIDesignButtonIcon); + myVClassMap[vclass].second = new FXLabel(buttonAndStatusFrame, "status", NULL, GUIDesignLabelLeftThick); + // create label for description of vehicle + new FXLabel(buttonAndInformationFrame, description.c_str(), 0, GUIDesignLabelLeftThick); +} + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDialog_AllowDisallow.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDialog_AllowDisallow.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDialog_AllowDisallow.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDialog_AllowDisallow.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,120 @@ +/****************************************************************************/ +/// @file GNEDialog_AllowDisallow.h +/// @author Pablo Alvarez Lopez +/// @date Feb 2017 +/// @version $Id: GNEDialog_AllowDisallow.h 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// Dialog for edit rerouters +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNEDialog_AllowDisallow_h +#define GNEDialog_AllowDisallow_h + +// =========================================================================== +// included modules +// =========================================================================== + +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include + +// =========================================================================== +// class definitions +// =========================================================================== + +/** + * @class GNEDialog_AllowDisallow + * @brief Dialog for edit rerouters + */ +class GNEDialog_AllowDisallow : public FXDialogBox { + /// @brief FOX-declaration + FXDECLARE(GNEDialog_AllowDisallow) + +public: + /// @brief Constructor + GNEDialog_AllowDisallow(FXApp* app, std::string* allow); + + /// @brief destructor + ~GNEDialog_AllowDisallow(); + + /// @name FOX-callbacks + /// @{ + /// @brief event when user press a enable/disable button + long onCmdValueChanged(FXObject*, FXSelector, void*); + + /// @brief event when user press select all VClasses button + long onCmdSelectAll(FXObject*, FXSelector, void*); + + /// @brief event when user press unselect all VClasses button + long onCmdUnselectAll(FXObject*, FXSelector, void*); + + /// @brief event when user press select only non road button + long onCmdSelectOnlyNonRoad(FXObject*, FXSelector, void*); + + /// @brief event after press accept button + long onCmdAccept(FXObject*, FXSelector, void*); + + /// @brief event after press cancel button + long onCmdCancel(FXObject*, FXSelector, void*); + + /// @brief event after press reset button + long onCmdReset(FXObject*, FXSelector, void*); + /// @} + +protected: + /// @brief FOX needs this + GNEDialog_AllowDisallow() {} + + /// @brief pointer to current allowed vehicles + std::string* myAllow; + + /// @brief copy of current allowed vehicles + std::string myCopyOfAllow; + + /// @brief select all VClass + FXButton* mySelectAllVClassButton; + + /// @brief unselect all VCLass + FXButton* myUnselectAllVClassButton; + + /// @brief select only non-road vehicles + FXButton* mySelectOnlyNonRoadVClassButton; + + /// @brief accept button + FXButton* myAcceptButton; + + /// @brief cancel button + FXButton* myCancelButton; + + /// @brief cancel button + FXButton* myResetButton; + + /// @brief map with the buttons for every VClass + std::map > myVClassMap; + +private: + /// @brief build VClass + void buildVClass(FXVerticalFrame* contentsFrame, SUMOVehicleClass vclass, GUIIcon icon, const std::string& description); + + /// @brief Invalidated copy constructor. + GNEDialog_AllowDisallow(const GNEDialog_AllowDisallow&); + + /// @brief Invalidated assignment operator. + GNEDialog_AllowDisallow& operator=(const GNEDialog_AllowDisallow&); +}; + +#endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDialog_Wizard.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDialog_Wizard.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDialog_Wizard.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDialog_Wizard.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEDialog_Wizard.cpp /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNEDialog_Wizard.cpp 21044 2016-06-28 09:07:49Z palcraft $ +/// @version $Id: GNEDialog_Wizard.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The "About" - dialog for NETEDIT, (adapted from GUIDialog_AboutSUMO) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -28,21 +28,14 @@ #include #endif -#ifdef HAVE_VERSION_H -#include -#endif - #include #include #include #include #include +#include #include "GNEDialog_Wizard.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping @@ -70,12 +63,11 @@ // method definitions // =========================================================================== GNEDialog_Wizard::GNEDialog_Wizard(FXWindow* parent, const char* name, int width, int height) : - FXDialogBox(parent, name, DECOR_CLOSE | DECOR_TITLE, 0, 0, width, height) { + FXDialogBox(parent, name, GUIDesignDialogBox, 0, 0, width, height) { OptionsCont& oc = OptionsCont::getOptions(); - FXVerticalFrame* contentFrame = new FXVerticalFrame(this, LAYOUT_FILL_X | LAYOUT_FILL_Y); + FXVerticalFrame* contentFrame = new FXVerticalFrame(this, GUIDesignContentsFrame); - FXTabBook* tabbook = new FXTabBook( - contentFrame, 0, 0, TABBOOK_LEFTTABS | PACK_UNIFORM_WIDTH | PACK_UNIFORM_HEIGHT | LAYOUT_FILL_X | LAYOUT_FILL_Y | LAYOUT_RIGHT); + FXTabBook* tabbook = new FXTabBook(contentFrame, 0, 0, GUIDesignTabBook); const std::vector& topics = oc.getSubTopics(); for (std::vector::const_iterator it_topic = topics.begin(); it_topic != topics.end(); it_topic++) { @@ -89,22 +81,24 @@ const std::vector entries = oc.getSubTopicsEntries(topic); for (std::vector::const_iterator it_opt = entries.begin(); it_opt != entries.end(); it_opt++) { std::string name = *it_opt; - std::string type = oc.getTypeName(name); - if (type == "STR" || type == "FILE") { - new InputString(tabContent, name); - } else if (type == "BOOL") { - new InputBool(tabContent, name); - } else if (type == "INT") { - new InputInt(tabContent, name); - } else if (type == "FLOAT") { - new InputFloat(tabContent, name); + if (name != "geometry.remove" && name != "edges.join" && name != "geometry.split" && name != "ramps.guess" && name != "ramps.set") { + std::string type = oc.getTypeName(name); + if (type == "STR" || type == "FILE") { + new InputString(tabContent, name); + } else if (type == "BOOL") { + new InputBool(tabContent, name); + } else if (type == "INT") { + new InputInt(tabContent, name); + } else if (type == "FLOAT") { + new InputFloat(tabContent, name); + } + // @todo missing types (type INT[] is only used in microsim) } - // @todo missing types (type INT[] is only used in microsim) } } // ok-button - new FXButton(contentFrame, "OK\t\tContine with the import.", 0, this, ID_ACCEPT, LAYOUT_FIX_WIDTH | LAYOUT_CENTER_X | JUSTIFY_CENTER_X | FRAME_THICK | FRAME_RAISED, 0, 0, 50, 30); + new FXButton(contentFrame, "OK\t\tContine with the import.", GUIIconSubSys::getIcon(ICON_ACCEPT), this, ID_ACCEPT, GUIDesignButtonOK); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDialog_Wizard.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDialog_Wizard.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEDialog_Wizard.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEDialog_Wizard.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEDialog_Wizard.h /// @author Jakob Erdmann /// @date July 2011 -/// @version $Id: GNEDialog_Wizard.h 20975 2016-06-15 13:02:40Z palcraft $ +/// @version $Id: GNEDialog_Wizard.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A Dialog for setting options (see OptionsCont) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEEdge.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEEdge.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEEdge.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEEdge.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,13 +2,13 @@ /// @file GNEEdge.cpp /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNEEdge.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEEdge.cpp 24128 2017-05-01 17:39:47Z behrisch $ /// // A road/street connecting two junctions (netedit-version, adapted from GUIEdge) // Basically a container for an NBEdge with drawing and editing capabilities /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -50,27 +50,27 @@ #include "GNEJunction.h" #include "GNELane.h" #include "GNEAdditional.h" -#include "GNEAdditionalSet.h" #include "GNEConnection.h" +#include "GNERouteProbe.h" +#include "GNEVaporizer.h" +#include "GNERerouter.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static // =========================================================================== -const SUMOReal GNEEdge::SNAP_RADIUS = SUMO_const_halfLaneWidth; +const double GNEEdge::SNAP_RADIUS = SUMO_const_halfLaneWidth; // =========================================================================== // members methods // =========================================================================== GNEEdge::GNEEdge(NBEdge& nbe, GNENet* net, bool wasSplit, bool loaded): - GNENetElement(net, nbe.getID(), GLO_EDGE, SUMO_TAG_EDGE), + GNENetElement(net, nbe.getID(), GLO_EDGE, SUMO_TAG_EDGE, ICON_EDGE), myNBEdge(nbe) , + myGNEJunctionSource(myNet->retrieveJunction(myNBEdge.getFromNode()->getID())), + myGNEJunctionDestiny(myNet->retrieveJunction(myNBEdge.getToNode()->getID())), myOrigShape(nbe.getInnerGeometry()), myLanes(0), myAmResponsible(false), @@ -83,18 +83,22 @@ myLanes.push_back(new GNELane(*this, i)); myLanes.back()->incRef("GNEEdge::GNEEdge"); } + // update Lane geometries + for (LaneVector::iterator i = myLanes.begin(); i != myLanes.end(); i++) { + (*i)->updateGeometry(); + } } GNEEdge::~GNEEdge() { - // Delete edges + // Delete references to this eddge in lanes for (LaneVector::iterator i = myLanes.begin(); i != myLanes.end(); ++i) { (*i)->decRef("GNEEdge::~GNEEdge"); if ((*i)->unreferenced()) { delete *i; } } - // delete connections + // delete references to this eddge in connections for (ConnectionVector::const_iterator i = myGNEConnections.begin(); i != myGNEConnections.end(); ++i) { (*i)->decRef("GNEEdge::~GNEEdge"); if ((*i)->unreferenced()) { @@ -117,10 +121,6 @@ for (AdditionalVector::iterator i = myAdditionals.begin(); i != myAdditionals.end(); ++i) { (*i)->updateGeometry(); } - // Update geometry of additionalSets vinculated to this edge - for (AdditionalSetVector::iterator i = myAdditionalSets.begin(); i != myAdditionalSets.end(); ++i) { - (*i)->updateGeometry(); - } } @@ -157,13 +157,13 @@ GNEJunction* GNEEdge::getGNEJunctionSource() const { - return myNet->retrieveJunction(myNBEdge.getFromNode()->getID(), false); + return myGNEJunctionSource; } GNEJunction* -GNEEdge::getGNEJunctionDest() const { - return myNet->retrieveJunction(myNBEdge.getToNode()->getID(), false); +GNEEdge::getGNEJunctionDestiny() const { + return myGNEJunctionDestiny; } void @@ -202,7 +202,7 @@ Position pos = geom[i]; glPushMatrix(); glTranslated(pos.x(), pos.y(), GLO_JUNCTION - 0.01); - GLHelper:: drawFilledCircle(SNAP_RADIUS, 32); + GLHelper:: drawFilledCircle(SNAP_RADIUS * MIN2((double)1, s.laneWidthExaggeration), 32); glPopMatrix(); } glPopName(); @@ -215,10 +215,10 @@ glPushName(getGlID()); GNELane* lane1 = myLanes[0]; GNELane* lane2 = myLanes[myLanes.size() - 1]; - Position p = lane1->getShape().positionAtOffset(lane1->getShape().length() / (SUMOReal) 2.); - p.add(lane2->getShape().positionAtOffset(lane2->getShape().length() / (SUMOReal) 2.)); + Position p = lane1->getShape().positionAtOffset(lane1->getShape().length() / (double) 2.); + p.add(lane2->getShape().positionAtOffset(lane2->getShape().length() / (double) 2.)); p.mul(.5); - SUMOReal angle = lane1->getShape().rotationDegreeAtOffset(lane1->getShape().length() / (SUMOReal) 2.); + double angle = lane1->getShape().rotationDegreeAtOffset(lane1->getShape().length() / (double) 2.); angle += 90; if (angle > 90 && angle < 270) { angle -= 180; @@ -249,7 +249,7 @@ Position delta = junction->getNBNode()->getPosition() - origPos; PositionVector geom = myNBEdge.getGeometry(); // geometry endpoint need not equal junction position hence we modify it with delta - if (junction == getGNEJunctionSource()) { + if (junction == myGNEJunctionSource) { geom[0].add(delta); } else { geom[-1].add(delta); @@ -293,15 +293,15 @@ bool GNEEdge::changeGeometry(PositionVector& geom, const std::string& id, const Position& oldPos, const Position& newPos, bool relative, bool moveEndPoints) { if (geom.size() < 2) { - throw ProcessError("Invalid geometry size in edge " + id); + throw ProcessError("Invalid geometry size in " + toString(SUMO_TAG_EDGE) + " with ID='" + id + "'"); } else { int index = geom.indexOfClosest(oldPos); - const SUMOReal nearestOffset = geom.nearest_offset_to_point2D(oldPos, true); + const double nearestOffset = geom.nearest_offset_to_point2D(oldPos, true); if (nearestOffset != GeomHelper::INVALID_OFFSET && (moveEndPoints || (nearestOffset >= SNAP_RADIUS && nearestOffset <= geom.length2D() - SNAP_RADIUS))) { const Position nearest = geom.positionAtOffset2D(nearestOffset); - const SUMOReal distance = geom[index].distanceTo2D(nearest); + const double distance = geom[index].distanceTo2D(nearest); if (distance < SNAP_RADIUS) { //move existing if (moveEndPoints || (index != 0 && index != (int)geom.size() - 1)) { const bool closed = geom.isClosed(); @@ -368,14 +368,14 @@ if (geom[index].distanceTo(pos) < SNAP_RADIUS) { // snap to existing geometry pos = geom[index]; } - Position destPos = getGNEJunctionDest()->getNBNode()->getPosition(); - Position sourcePos = getGNEJunctionSource()->getNBNode()->getPosition(); + Position destPos = myGNEJunctionDestiny->getNBNode()->getPosition(); + Position sourcePos = myGNEJunctionSource->getNBNode()->getPosition(); if (pos.distanceTo2D(destPos) < pos.distanceTo2D(sourcePos)) { setAttribute(GNE_ATTR_SHAPE_END, toString(pos), undoList); - getGNEJunctionDest()->invalidateShape(); + myGNEJunctionDestiny->invalidateShape(); } else { setAttribute(GNE_ATTR_SHAPE_START, toString(pos), undoList); - getGNEJunctionSource()->invalidateShape(); + myGNEJunctionSource->invalidateShape(); } // possibly existing inner point is no longer needed deleteGeometry(pos, undoList); @@ -385,14 +385,14 @@ void GNEEdge::resetEndpoint(const Position& pos, GNEUndoList* undoList) { - Position destPos = getGNEJunctionDest()->getNBNode()->getPosition(); - Position sourcePos = getGNEJunctionSource()->getNBNode()->getPosition(); + Position destPos = myGNEJunctionDestiny->getNBNode()->getPosition(); + Position sourcePos = myGNEJunctionSource->getNBNode()->getPosition(); if (pos.distanceTo2D(destPos) < pos.distanceTo2D(sourcePos)) { setAttribute(GNE_ATTR_SHAPE_END, toString(destPos), undoList); - getGNEJunctionDest()->invalidateShape(); + myGNEJunctionDestiny->invalidateShape(); } else { setAttribute(GNE_ATTR_SHAPE_START, toString(sourcePos), undoList); - getGNEJunctionSource()->invalidateShape(); + myGNEJunctionSource->invalidateShape(); } } @@ -401,17 +401,14 @@ GNEEdge::setGeometry(PositionVector geom, bool inner) { myNBEdge.setGeometry(geom, inner); updateGeometry(); - getGNEJunctionSource()->invalidateShape(); - getGNEJunctionDest()->invalidateShape(); + myGNEJunctionSource->invalidateShape(); + myGNEJunctionDestiny->invalidateShape(); myNet->refreshElement(this); } void GNEEdge::remakeIncomingGNEConnections() { - GNEJunction* from = getGNEJunctionSource(); - assert(from); - std::vector incomingEdges = from->getGNEIncomingEdges(); - for (std::vector::iterator i = incomingEdges.begin(); i != incomingEdges.end(); i++) { + for (std::vector::const_iterator i = myGNEJunctionSource->getGNEIncomingEdges().begin(); i != myGNEJunctionSource->getGNEIncomingEdges().end(); i++) { (*i)->remakeGNEConnections(); } } @@ -419,6 +416,32 @@ void GNEEdge::remakeGNEConnections() { // @note: this method may only be called once the whole network is initialized + + // first check that there are the same number of NBLanes as GNELanes + while (myLanes.size() < myNBEdge.getLanes().size()) { + GNELane* lane = new GNELane(*this, (int)myLanes.size()); + const NBEdge::Lane& laneAttrs = myNBEdge.getLanes().at(myLanes.size()); + myLanes.push_back(lane); + lane->incRef("GNEEdge::addLane"); + // we copy all attributes except shape since this is recomputed from edge shape + myNBEdge.setSpeed(lane->getIndex(), myNBEdge.getSpeed()); + myNBEdge.setPermissions(laneAttrs.permissions, lane->getIndex()); + myNBEdge.setPreferredVehicleClass(laneAttrs.preferred, lane->getIndex()); + myNBEdge.setEndOffset(lane->getIndex(), laneAttrs.endOffset); + myNBEdge.setLaneWidth(lane->getIndex(), laneAttrs.width); + // update indices + for (int i = 0; i < (int)myLanes.size(); ++i) { + myLanes[i]->setIndex(i); + } + lane->updateGeometry(); + // Remake connections for this edge and all edges that target this lane + remakeGNEConnections(); + remakeIncomingGNEConnections(); + // Update element + myNet->refreshElement(this); + updateGeometry(); + } + // Create connections (but reuse existing objects) std::vector& myConnections = myNBEdge.getConnections(); ConnectionVector newCons; @@ -427,7 +450,6 @@ newCons.push_back(retrieveConnection(con.fromLane, con.toEdge, con.toLane)); newCons.back()->incRef("GNEEdge::GNEEdge"); newCons.back()->updateLinkState(); - //std::cout << " remakeGNEConnection " << newCons.back()->getNBConnection() << "\n"; } clearGNEConnections(); myGNEConnections = newCons; @@ -449,6 +471,42 @@ } +int +GNEEdge::getRouteProbeRelativePosition(GNERouteProbe* routeProbe) const { + AdditionalVector routeProbes; + for (AdditionalVector::const_iterator i = myAdditionals.begin(); i != myAdditionals.end(); i++) { + if ((*i)->getTag() == routeProbe->getTag()) { + routeProbes.push_back(*i); + } + } + // return index of routeProbe in routeProbes vector + AdditionalVector::const_iterator it = std::find(routeProbes.begin(), routeProbes.end(), routeProbe); + if (it == routeProbes.end()) { + return -1; + } else { + return (int)(it - routeProbes.begin()); + } +} + + +int +GNEEdge::getVaporizerRelativePosition(GNEVaporizer* vaporizer) const { + AdditionalVector vaporizers; + for (AdditionalVector::const_iterator i = myAdditionals.begin(); i != myAdditionals.end(); i++) { + if ((*i)->getTag() == vaporizer->getTag()) { + vaporizers.push_back(*i); + } + } + // return index of routeProbe in routeProbes vector + AdditionalVector::const_iterator it = std::find(vaporizers.begin(), vaporizers.end(), vaporizer); + if (it == vaporizers.end()) { + return -1; + } else { + return (int)(it - vaporizers.begin()); + } +} + + void GNEEdge::copyTemplate(GNEEdge* tpl, GNEUndoList* undoList) { undoList->p_begin("copy template"); @@ -505,9 +563,9 @@ case SUMO_ATTR_ID: return getMicrosimID(); case SUMO_ATTR_FROM: - return getGNEJunctionSource()->getMicrosimID(); + return myGNEJunctionSource->getMicrosimID(); case SUMO_ATTR_TO: - return getGNEJunctionDest()->getMicrosimID(); + return myGNEJunctionDestiny->getMicrosimID(); case SUMO_ATTR_NUMLANES: return toString(myNBEdge.getNumLanes()); case SUMO_ATTR_PRIORITY: @@ -524,16 +582,14 @@ return myNBEdge.getStreetName(); case SUMO_ATTR_ALLOW: // return all allowed classes (may differ from the written attributes) - return (getVehicleClassNames(myNBEdge.getPermissions()) + - (myNBEdge.hasLaneSpecificPermissions() ? " (combined!)" : "")); + return (getVehicleClassNames(myNBEdge.getPermissions()) + (myNBEdge.hasLaneSpecificPermissions() ? " (combined!)" : "")); case SUMO_ATTR_DISALLOW: { // return classes disallowed on at least one lane (may differ from the written attributes) SVCPermissions combinedDissallowed = 0; for (int i = 0; i < (int)myNBEdge.getNumLanes(); ++i) { combinedDissallowed |= ~myNBEdge.getPermissions(i); } - return (getVehicleClassNames(combinedDissallowed) + - (myNBEdge.hasLaneSpecificPermissions() ? " (combined!)" : "")); + return (getVehicleClassNames(combinedDissallowed) + (myNBEdge.hasLaneSpecificPermissions() ? " (combined!)" : "")); } case SUMO_ATTR_SPEED: if (myNBEdge.hasLaneSpecificSpeed()) { @@ -544,6 +600,8 @@ case SUMO_ATTR_WIDTH: if (myNBEdge.hasLaneSpecificWidth()) { return "lane specific"; + } else if (myNBEdge.getLaneWidth() == NBEdge::UNSPECIFIED_WIDTH) { + return "default"; } else { return toString(myNBEdge.getLaneWidth()); } @@ -556,11 +614,19 @@ case GNE_ATTR_MODIFICATION_STATUS: return myConnectionStatus; case GNE_ATTR_SHAPE_START: - return toString(myNBEdge.getGeometry()[0]); + if (myNBEdge.getGeometry()[0] == myGNEJunctionSource->getPosition()) { + return ""; + } else { + return toString(myNBEdge.getGeometry()[0]); + } case GNE_ATTR_SHAPE_END: - return toString(myNBEdge.getGeometry()[-1]); + if (myNBEdge.getGeometry()[-1] == myGNEJunctionDestiny->getPosition()) { + return ""; + } else { + return toString(myNBEdge.getGeometry()[-1]); + } default: - throw InvalidArgument("edge attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -573,8 +639,8 @@ case SUMO_ATTR_SPEED: case SUMO_ATTR_ALLOW: case SUMO_ATTR_DISALLOW: { - undoList->p_begin("change edge attribute"); - const std::string origValue = getAttribute(key); // will have intermediate value of "lane specific" + undoList->p_begin("change " + toString(getTag()) + " attribute"); + const std::string origValue = myLanes.at(0)->getAttribute(key); // will have intermediate value of "lane specific" // lane specific attributes need to be changed via lanes to allow undo for (LaneVector::iterator it = myLanes.begin(); it != myLanes.end(); it++) { (*it)->setAttribute(key, value, undoList); @@ -585,22 +651,22 @@ break; } case SUMO_ATTR_FROM: { - undoList->p_begin("change edge attribute"); + undoList->p_begin("change " + toString(getTag()) + " attribute"); undoList->p_add(new GNEChange_Attribute(this, key, value)); - getGNEJunctionSource()->setLogicValid(false, undoList); + myGNEJunctionSource->setLogicValid(false, undoList); myNet->retrieveJunction(value)->setLogicValid(false, undoList); - setAttribute(GNE_ATTR_SHAPE_START, toString(getGNEJunctionSource()->getNBNode()->getPosition()), undoList); - getGNEJunctionSource()->invalidateShape(); + setAttribute(GNE_ATTR_SHAPE_START, toString(myGNEJunctionSource->getNBNode()->getPosition()), undoList); + myGNEJunctionSource->invalidateShape(); undoList->p_end(); break; } case SUMO_ATTR_TO: { - undoList->p_begin("change edge attribute"); + undoList->p_begin("change " + toString(getTag()) + " attribute"); undoList->p_add(new GNEChange_Attribute(this, key, value)); - getGNEJunctionDest()->setLogicValid(false, undoList); + myGNEJunctionDestiny->setLogicValid(false, undoList); myNet->retrieveJunction(value)->setLogicValid(false, undoList); - setAttribute(GNE_ATTR_SHAPE_END, toString(getGNEJunctionDest()->getNBNode()->getPosition()), undoList); - getGNEJunctionDest()->invalidateShape(); + setAttribute(GNE_ATTR_SHAPE_END, toString(myGNEJunctionDestiny->getNBNode()->getPosition()), undoList); + myGNEJunctionDestiny->invalidateShape(); undoList->p_end(); break; } @@ -634,7 +700,7 @@ undoList->p_add(new GNEChange_Attribute(this, key, value)); break; default: - throw InvalidArgument("edge attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -646,13 +712,13 @@ return isValidID(value) && myNet->retrieveEdge(value, false) == 0; break; case SUMO_ATTR_FROM: - return isValidID(value) && myNet->retrieveJunction(value, false) != 0 && value != getGNEJunctionDest()->getMicrosimID(); + return isValidID(value) && myNet->retrieveJunction(value, false) != 0 && value != myGNEJunctionDestiny->getMicrosimID(); break; case SUMO_ATTR_TO: - return isValidID(value) && myNet->retrieveJunction(value, false) != 0 && value != getGNEJunctionSource()->getMicrosimID(); + return isValidID(value) && myNet->retrieveJunction(value, false) != 0 && value != myGNEJunctionSource->getMicrosimID(); break; case SUMO_ATTR_SPEED: - return isPositive(value); + return isPositive(value); break; case SUMO_ATTR_NUMLANES: return isPositive(value); @@ -661,7 +727,7 @@ return canParse(value); break; case SUMO_ATTR_LENGTH: - return canParse(value) && (isPositive(value) || parse(value) == NBEdge::UNSPECIFIED_LOADED_LENGTH); + return canParse(value) && (isPositive(value) || parse(value) == NBEdge::UNSPECIFIED_LOADED_LENGTH); break; case SUMO_ATTR_ALLOW: case SUMO_ATTR_DISALLOW: @@ -672,8 +738,7 @@ break; case SUMO_ATTR_SHAPE: { bool ok = true; - PositionVector shape = GeomConvHelper::parseShapeReporting( - value, "user-supplied position", 0, ok, true); + PositionVector shape = GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, true); return ok; break; } @@ -684,13 +749,27 @@ return true; break; case SUMO_ATTR_WIDTH: - return canParse(value) && (isPositive(value) || parse(value) == NBEdge::UNSPECIFIED_WIDTH); + if (value == "default") { + return true; + } else { + return canParse(value) && (isPositive(value) || parse(value) == NBEdge::UNSPECIFIED_WIDTH); + } break; case SUMO_ATTR_ENDOFFSET: - return canParse(value); + return canParse(value); break; + case GNE_ATTR_SHAPE_START: { + bool ok; + return value == "" || GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, false).size() == 1; + break; + } + case GNE_ATTR_SHAPE_END: { + bool ok; + return value == "" || GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, false).size() == 1; + break; + } default: - throw InvalidArgument("edge attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -703,6 +782,7 @@ // =========================================================================== // private // =========================================================================== + void GNEEdge::setAttribute(SumoXMLAttr key, const std::string& value) { switch (key) { @@ -710,10 +790,22 @@ myNet->renameEdge(this, value); break; case SUMO_ATTR_FROM: - myNet->changeEdgeEndpoints(this, value, getGNEJunctionDest()->getMicrosimID()); + myNet->changeEdgeEndpoints(this, value, myGNEJunctionDestiny->getMicrosimID()); + // update this edge of list of outgoings edges of the old GNEJunctionSource + myGNEJunctionSource->removeOutgoingGNEEdge(this); + // update GNEJunctionSource + myGNEJunctionSource = myNet->retrieveJunction(myNBEdge.getFromNode()->getID()); + // update this edge of list of outgoings edges of the new GNEJunctionSource + myGNEJunctionSource->addOutgoingGNEEdge(this); break; case SUMO_ATTR_TO: - myNet->changeEdgeEndpoints(this, getGNEJunctionSource()->getMicrosimID(), value); + myNet->changeEdgeEndpoints(this, myGNEJunctionSource->getMicrosimID(), value); + // update this edge of list of incomings edges of the old GNEJunctionDestiny + myGNEJunctionDestiny->removeIncomingGNEEdge(this); + // update GNEJunctionDestiny + myGNEJunctionDestiny = myNet->retrieveJunction(myNBEdge.getToNode()->getID()); + // update this edge of list of incomings edges of the new GNEJunctionDestiny + myGNEJunctionDestiny->addIncomingGNEEdge(this); break; case SUMO_ATTR_NUMLANES: throw InvalidArgument("GNEEdge::setAttribute (private) called for attr SUMO_ATTR_NUMLANES. This should never happen"); @@ -722,7 +814,7 @@ myNBEdge.myPriority = parse(value); break; case SUMO_ATTR_LENGTH: - myNBEdge.setLoadedLength(parse(value)); + myNBEdge.setLoadedLength(parse(value)); break; case SUMO_ATTR_TYPE: myNBEdge.myType = value; @@ -739,13 +831,17 @@ myNBEdge.setStreetName(value); break; case SUMO_ATTR_SPEED: - myNBEdge.setSpeed(-1, parse(value)); + myNBEdge.setSpeed(-1, parse(value)); break; case SUMO_ATTR_WIDTH: - myNBEdge.setLaneWidth(-1, parse(value)); + if (value == "default") { + myNBEdge.setLaneWidth(-1, NBEdge::UNSPECIFIED_WIDTH); + } else { + myNBEdge.setLaneWidth(-1, parse(value)); + } break; case SUMO_ATTR_ENDOFFSET: - myNBEdge.setEndOffset(-1, parse(value)); + myNBEdge.setEndOffset(-1, parse(value)); break; case SUMO_ATTR_ALLOW: break; // no edge value @@ -755,33 +851,46 @@ myConnectionStatus = value; if (value == GUESSED) { myNBEdge.invalidateConnections(true); + clearGNEConnections(); } else if (value != GUESSED) { myNBEdge.declareConnectionsAsLoaded(); } break; case GNE_ATTR_SHAPE_START: { + // get geometry of NBEdge, remove FIRST element with the new value (or with the Junction Source position) and set it back to edge PositionVector geom = myNBEdge.getGeometry(); - geom[0] = GeomConvHelper::parseShapeReporting(value, "netedit-given", 0, ok, false)[0]; + geom.erase(geom.begin()); + if (value == "") { + geom.push_front_noDoublePos(myGNEJunctionSource->getPosition()); + } else { + geom.push_front_noDoublePos(GeomConvHelper::parseShapeReporting(value, "netedit-given", 0, ok, false)[0]); + } setGeometry(geom, false); break; } case GNE_ATTR_SHAPE_END: { + // get geometry of NBEdge, remove LAST element with the new value (or with the Junction Destiny position) and set it back to edge PositionVector geom = myNBEdge.getGeometry(); - geom[-1] = GeomConvHelper::parseShapeReporting(value, "netedit-given", 0, ok, false)[0]; + geom.pop_back(); + if (value == "") { + geom.push_back_noDoublePos(myGNEJunctionDestiny->getPosition()); + } else { + geom.push_back_noDoublePos(GeomConvHelper::parseShapeReporting(value, "netedit-given", 0, ok, false)[0]); + } setGeometry(geom, false); break; } default: - throw InvalidArgument("edge attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } void GNEEdge::setNumLanes(int numLanes, GNEUndoList* undoList) { - undoList->p_begin("change number of lanes"); - getGNEJunctionSource()->setLogicValid(false, undoList); - getGNEJunctionDest()->setLogicValid(false, undoList); + undoList->p_begin("change number of " + toString(SUMO_TAG_LANE) + "s"); + myGNEJunctionSource->setLogicValid(false, undoList); + myGNEJunctionDestiny->setLogicValid(false, undoList); const int oldNumLanes = (int)myLanes.size(); for (int i = oldNumLanes; i < numLanes; i++) { @@ -823,8 +932,8 @@ myLanes[i]->setIndex(i); } /* while technically correct, this looks ugly - getGNEJunctionSource()->invalidateShape(); - getGNEJunctionDest()->invalidateShape(); + myGNEJunctionSource->invalidateShape(); + myGNEJunctionDestiny->invalidateShape(); */ // Remake connections for this edge and all edges that target this lane remakeGNEConnections(); @@ -838,7 +947,7 @@ void GNEEdge::removeLane(GNELane* lane) { if (myLanes.size() == 0) { - throw ProcessError("Should not remove the last lane from an edge\n"); + throw ProcessError("Should not remove the last " + toString(SUMO_TAG_LANE) + " from an " + toString(getTag())); } if (lane == 0) { lane = myLanes.back(); @@ -856,8 +965,8 @@ myLanes[i]->setIndex(i); } /* while technically correct, this looks ugly - getGNEJunctionSource()->invalidateShape(); - getGNEJunctionDest()->invalidateShape(); + myGNEJunctionSource->invalidateShape(); + myGNEJunctionDestiny->invalidateShape(); */ // Remake connections for this edge and all edges that target this lane remakeGNEConnections(); @@ -925,28 +1034,26 @@ void GNEEdge::addAdditionalChild(GNEAdditional* additional) { // First check that additional wasn't already inserted - for (AdditionalVector::iterator i = myAdditionals.begin(); i != myAdditionals.end(); i++) { - if (*i == additional) { - throw ProcessError("additional element with ID='" + additional->getID() + "' was already inserted in edge with ID='" + getID() + "'"); - } + if (std::find(myAdditionals.begin(), myAdditionals.end(), additional) != myAdditionals.end()) { + throw ProcessError(toString(additional->getTag()) + " with ID='" + additional->getID() + "' was already inserted in " + toString(getTag()) + " with ID='" + getID() + "'"); + } else { + myAdditionals.push_back(additional); + // update geometry is needed for stacked additionals (routeProbes and Vaporicers) + updateGeometry(); } - myAdditionals.push_back(additional); } void GNEEdge::removeAdditionalChild(GNEAdditional* additional) { - // Declare iterator - AdditionalVector::iterator i = myAdditionals.begin(); - // Find additional - while ((*i != additional) && (i != myAdditionals.end())) { - i++; - } - // If additional was found, remove it - if (i == myAdditionals.end()) { - throw ProcessError("additional element with ID='" + additional->getID() + "' doesn't exist in edge with ID='" + getID() + "'"); + // First check that additional was already inserted + AdditionalVector::iterator it = std::find(myAdditionals.begin(), myAdditionals.end(), additional); + if (it == myAdditionals.end()) { + throw ProcessError(toString(additional->getTag()) + " with ID='" + additional->getID() + "' doesn't exist in " + toString(getTag()) + " with ID='" + getID() + "'"); } else { - myAdditionals.erase(i); + myAdditionals.erase(it); + // update geometry is needed for stacked additionals (routeProbes and Vaporicers) + updateGeometry(); } } @@ -957,37 +1064,36 @@ } -bool -GNEEdge::addAdditionalSet(GNEAdditionalSet* additionalSet) { - // Check if additionalSet already exists before insertion - for (AdditionalSetVector::iterator i = myAdditionalSets.begin(); i != myAdditionalSets.end(); i++) { - if ((*i) == additionalSet) { - return false; - } +void +GNEEdge::addGNERerouter(GNERerouter* rerouter) { + if (std::find(myReroutes.begin(), myReroutes.end(), rerouter) == myReroutes.end()) { + myReroutes.push_back(rerouter); + } else { + throw ProcessError(toString(rerouter->getTag()) + " '" + rerouter->getID() + "' was previously inserted"); } - // Insert it and retur true - myAdditionalSets.push_back(additionalSet); - return true; } -bool -GNEEdge::removeAdditionalGeometrySet(GNEAdditionalSet* additionalSet) { - // search additionalSet and remove it - for (AdditionalSetVector::iterator i = myAdditionalSets.begin(); i != myAdditionalSets.end(); i++) { - if ((*i) == additionalSet) { - myAdditionalSets.erase(i); - return true; - } +void +GNEEdge::removeGNERerouter(GNERerouter* rerouter) { + std::vector::iterator it = std::find(myReroutes.begin(), myReroutes.end(), rerouter); + if (it != myReroutes.end()) { + myReroutes.erase(it); + } else { + throw ProcessError(toString(rerouter->getTag()) + " '" + rerouter->getID() + "' wasn't previously inserted"); } - // If additionalSet wasn't found, return false - return false; } -const std::vector& -GNEEdge::getAdditionalSets() { - return myAdditionalSets; +const std::vector& +GNEEdge::getGNERerouters() const { + return myReroutes; +} + + +int +GNEEdge::getNumberOfGNERerouters() const { + return (int)myReroutes.size(); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEEdge.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEEdge.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEEdge.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEEdge.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,13 +2,13 @@ /// @file GNEEdge.h /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNEEdge.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEEdge.h 24108 2017-04-27 18:43:30Z behrisch $ /// // A road/street connecting two junctions (netedit-version, adapted from GUIEdge) // Basically a container for an NBEdge with drawing and editing capabilities /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,7 +41,9 @@ class GNELane; class GNEConnection; class GNEAdditional; -class GNEAdditionalSet; +class GNERouteProbe; +class GNEVaporizer; +class GNERerouter; // =========================================================================== // class definitions @@ -68,9 +70,6 @@ /// @brief Definition of the additionals vector typedef std::vector AdditionalVector; - /// @brief Definition of the additionalSets vector - typedef std::vector AdditionalSetVector; - /**@brief Constructor. * @param[in] nbe The represented edge * @param[in] net The net to inform about gui updates @@ -132,7 +131,7 @@ GNEJunction* getGNEJunctionSource() const; /// @brief returns the destination-junction - GNEJunction* getGNEJunctionDest() const; + GNEJunction* getGNEJunctionDestiny() const; /**@brief change the edge geometry * It is up to the Edge to decide whether an new geometry node should be @@ -213,8 +212,7 @@ /// @brief returns a reference to the GNEConnection vector const std::vector& getGNEConnections(); - /**@brief get connection - */ + /// @brief get connection GNEConnection* retrieveConnection(int fromLane, NBEdge* to, int toLane); /// @brief whether this edge was created from a split @@ -236,27 +234,43 @@ /// @brief return list of additionals associated with this edge const std::vector& getAdditionalChilds() const; - /// @brief add GNEAdditionalSet to this edge - bool addAdditionalSet(GNEAdditionalSet* additionalSet); + /// @brief add a reference to a rerouter that has this edge as parameter + void addGNERerouter(GNERerouter* rerouter); + + /// @brief remove a reference to a rerouter that has this edge as parameter + void removeGNERerouter(GNERerouter* rerouter); - /// @brief remove GNEAdditionalSet from this edge - bool removeAdditionalGeometrySet(GNEAdditionalSet* additionalSet); + /// @brief get rerouters vinculated with this edge + const std::vector& getGNERerouters() const; - /// @brief return list of additionalSets associated with this edge - const std::vector& getAdditionalSets(); + /// @brief get number of rerouters that has this edge as parameters + int getNumberOfGNERerouters() const; /// @brief check if edge has a restricted lane bool hasRestrictedLane(SUMOVehicleClass vclass) const; // the radius in which to register clicks for geometry nodes - static const SUMOReal SNAP_RADIUS; + static const double SNAP_RADIUS; /// @brief clear current connections void clearGNEConnections(); + + /// @brief obtain relative positions of RouteProbes + int getRouteProbeRelativePosition(GNERouteProbe* routeProbe) const; + + /// @brief obtain relative positions of Vaporizer + int getVaporizerRelativePosition(GNEVaporizer* vaporizer) const; + protected: /// @brief the underlying NBEdge NBEdge& myNBEdge; + /// @brief pointer to GNEJunction source + GNEJunction* myGNEJunctionSource; + + /// @brief pointer to GNEJunction destiny + GNEJunction* myGNEJunctionDestiny; + /// @brief restore point for undo PositionVector myOrigShape; @@ -275,11 +289,11 @@ /// @brief modification status of the connections std::string myConnectionStatus; - /// @brief list with the additonals vinculated with this edge + /// @brief list with the additionals vinculated with this edge AdditionalVector myAdditionals; - /// @brief list with the additonalSets vinculated with this edge - AdditionalSetVector myAdditionalSets; + /// @brief list of reroutes that has this edge as parameter + std::vector myReroutes; private: /// @brief set attribute after validation diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEEvent_NetworkLoaded.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEEvent_NetworkLoaded.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEEvent_NetworkLoaded.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEEvent_NetworkLoaded.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEEvent_NetworkLoaded.h /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNEEvent_NetworkLoaded.h 20975 2016-06-15 13:02:40Z palcraft $ +/// @version $Id: GNEEvent_NetworkLoaded.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Event to send when the network has been loaded by GNELoadThread /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEFrame.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEFrame.cpp /// @author Pablo Alvarez Lopez /// @date Jun 2016 -/// @version $Id: GNEFrame.cpp 21640 2016-10-09 20:28:52Z palcraft $ +/// @version $Id: GNEFrame.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// /// The Widget for add additional elements /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -27,10 +27,6 @@ #include #endif -#ifdef HAVE_VERSION_H -#include -#endif - #include #include #include @@ -38,6 +34,7 @@ #include #include #include +#include #include #include @@ -45,42 +42,44 @@ #include "GNEViewParent.h" #include "GNEViewNet.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== -GNEFrame::GNEFrame(FXComposite* parent, GNEViewNet* viewNet, const std::string& frameLabel) : - FXScrollWindow(parent, LAYOUT_FILL), +GNEFrame::GNEFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet, const std::string& frameLabel) : + FXVerticalFrame(horizontalFrameParent, GUIDesignAuxiliarFrame), myViewNet(viewNet) { // Create font myFrameHeaderFont = new FXFont(getApp(), "Arial", 14, FXFont::Bold), - // Create frame for contect - myContentFrame = new FXVerticalFrame(this, LAYOUT_FILL); - // Create frame for header - myHeaderFrame = new FXHorizontalFrame(myContentFrame, LAYOUT_FILL_X); + myHeaderFrame = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame); // Create frame for left elements of header (By default unused) - myHeaderLeftFrame = new FXHorizontalFrame(myHeaderFrame); + myHeaderLeftFrame = new FXHorizontalFrame(myHeaderFrame, GUIDesignAuxiliarHorizontalFrame); myHeaderLeftFrame->hide(); // Create titel frame - myFrameHeaderLabel = new FXLabel(myHeaderFrame, frameLabel.c_str(), 0, JUSTIFY_LEFT | LAYOUT_FILL_X); + myFrameHeaderLabel = new FXLabel(myHeaderFrame, frameLabel.c_str(), 0, GUIDesignLabelLeft); // Create frame for right elements of header (By default unused) - myHeaderRightFrame = new FXHorizontalFrame(myHeaderFrame); + myHeaderRightFrame = new FXHorizontalFrame(myHeaderFrame, GUIDesignAuxiliarHorizontalFrame); myHeaderRightFrame->hide(); + // Add separator + new FXHorizontalSeparator(this, GUIDesignHorizontalSeparator); + + // Create frame for contents + myScrollWindowsContents = new FXScrollWindow(this, GUIDesignContentsScrollWindow); + + // Create frame for contents + myContentFrame = new FXVerticalFrame(myScrollWindowsContents, GUIDesignContentsFrame); + // Set font of header myFrameHeaderLabel->setFont(myFrameHeaderFont); // Hide Frame - FXScrollWindow::hide(); + FXVerticalFrame::hide(); } @@ -89,6 +88,37 @@ } +void +GNEFrame::focusUpperElement() { + myFrameHeaderLabel->setFocus(); +} + + +void +GNEFrame::show() { + // show scroll window + FXVerticalFrame::show(); + // Show and update Frame Area in which this GNEFrame is placed + myViewNet->getViewParent()->showFramesArea(); +} + + +void +GNEFrame::hide() { + // hide scroll window + FXVerticalFrame::hide(); + // Hide Frame Area in which this GNEFrame is placed + myViewNet->getViewParent()->hideFramesArea(); +} + + +void +GNEFrame::setFrameWidth(int width) { + setWidth(width); + myScrollWindowsContents->setWidth(width); +} + + GNEViewNet* GNEFrame::getViewNet() const { return myViewNet; @@ -106,4 +136,5 @@ return myFrameHeaderFont; } + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEFrame.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEFrame.h /// @author Pablo Alvarez Lopez /// @date Jun 2016 -/// @version $Id: GNEFrame.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEFrame.h 23266 2017-03-08 09:52:54Z palcraft $ /// /// Abstract class for lateral frames in NetEdit /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -50,23 +50,33 @@ * @class GNEFrame * Abstract class for lateral frames in NetEdit */ -class GNEFrame : public FXScrollWindow { +class GNEFrame : public FXVerticalFrame { public: /**@brief Constructor - * @brief parent FXFrame in which this GNEFrame is placed + * @brief parent FXHorizontalFrame in which this GNEFrame is placed * @brief viewNet viewNet that uses this GNEFrame * @brief frameLabel label of the frame */ - GNEFrame(FXComposite* parent, GNEViewNet* viewNet, const std::string& frameLabel); + GNEFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet, const std::string& frameLabel); /// @brief destructor ~GNEFrame(); - /// @brief show Frame - virtual void show() = 0; + /// @brief focus upper element of frame + void focusUpperElement(); - /// @brief hide Frame - virtual void hide() = 0; + /**@brief show Frame + * @note some GNEFrames needs a re-implementation + */ + virtual void show(); + + /**@brief hide Frame + * @note some GNEFrames needs a re-implementation + */ + virtual void hide(); + + /// @brief set width of GNEFrame + void setFrameWidth(int width); /// @brief get view net GNEViewNet* getViewNet() const; @@ -90,7 +100,7 @@ /// @brief the label for the frame's header FXLabel* myFrameHeaderLabel; - /// @brief the panel to hold all member widgets + /// @brief Vertical frame that holds all widgets of frame FXVerticalFrame* myContentFrame; /// @brief fame for header elements @@ -103,6 +113,9 @@ FXHorizontalFrame* myHeaderRightFrame; private: + /// @brief scroll windows that holds the content frame + FXScrollWindow* myScrollWindowsContents; + /// @brief Invalidated copy constructor. GNEFrame(const GNEFrame&); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEInspectorFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEInspectorFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEInspectorFrame.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEInspectorFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEInspectorFrame.cpp /// @author Jakob Erdmann /// @date Mar 2011 -/// @version $Id: GNEInspectorFrame.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEInspectorFrame.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The Widget for modifying network-element attributes (i.e. lane speed) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -28,125 +28,122 @@ #include #endif -#ifdef HAVE_VERSION_H -#include -#endif - -#include -#include #include -#include +#include +#include #include -#include +#include +#include +#include +#include +#include +#include +#include #include -#include "GNEInspectorFrame.h" -#include "GNEUndoList.h" +#include +#include +#include + +#include "GNEAdditional.h" +#include "GNEAdditionalFrame.h" +#include "GNEAttributeCarrier.h" +#include "GNEChange_Selection.h" +#include "GNEConnection.h" +#include "GNECrossing.h" +#include "GNEDeleteFrame.h" #include "GNEEdge.h" +#include "GNEInspectorFrame.h" +#include "GNEJunction.h" #include "GNELane.h" -#include "GNEAttributeCarrier.h" -#include "GNEAdditional.h" +#include "GNENet.h" +#include "GNEPOI.h" +#include "GNEPoly.h" +#include "GNEUndoList.h" #include "GNEViewNet.h" #include "GNEViewParent.h" -#include "GNEConnection.h" -#include "GNEViewNet.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS +#include "GNEDialog_AllowDisallow.h" // =========================================================================== -// static -// =========================================================================== - -const unsigned int MAXNUMBEROFATTRCONNECTIONS = 50; - -// =========================================================================== // FOX callback mapping // =========================================================================== FXDEFMAP(GNEInspectorFrame) GNEInspectorFrameMap[] = { - FXMAPFUNC(SEL_COMMAND, MID_GNE_COPY_TEMPLATE, GNEInspectorFrame::onCmdCopyTemplate), - FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_TEMPLATE, GNEInspectorFrame::onCmdSetTemplate), - FXMAPFUNC(SEL_UPDATE, MID_GNE_COPY_TEMPLATE, GNEInspectorFrame::onUpdCopyTemplate), - FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_BLOCKING, GNEInspectorFrame::onCmdSetBlocking), - FXMAPFUNC(SEL_COMMAND, MID_GNE_INSPECT_GOBACK, GNEInspectorFrame::onCmdGoBack), -}; - - -FXDEFMAP(GNEInspectorFrame::AttrInput) AttrInputMap[] = { - FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_ATTRIBUTE, GNEInspectorFrame::AttrInput::onCmdSetAttribute), - FXMAPFUNC(SEL_COMMAND, MID_GNE_OPEN_ATTRIBUTE_EDITOR, GNEInspectorFrame::AttrInput::onCmdOpenAttributeEditor) + FXMAPFUNC(SEL_COMMAND, MID_GNE_COPY_TEMPLATE, GNEInspectorFrame::onCmdCopyTemplate), + FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_TEMPLATE, GNEInspectorFrame::onCmdSetTemplate), + FXMAPFUNC(SEL_UPDATE, MID_GNE_COPY_TEMPLATE, GNEInspectorFrame::onUpdCopyTemplate), + FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_BLOCKING, GNEInspectorFrame::onCmdSetBlocking), + FXMAPFUNC(SEL_COMMAND, MID_GNE_INSPECT_GOBACK, GNEInspectorFrame::onCmdGoBack), + FXMAPFUNC(SEL_RIGHTBUTTONRELEASE, MID_GNE_CHILDS, GNEInspectorFrame::onCmdShowChildMenu), + FXMAPFUNC(SEL_COMMAND, MID_GNE_INSPECTFRAME_CENTER, GNEInspectorFrame::onCmdCenterItem), + FXMAPFUNC(SEL_COMMAND, MID_GNE_INSPECTFRAME_INSPECT, GNEInspectorFrame::onCmdInspectItem), + FXMAPFUNC(SEL_COMMAND, MID_GNE_INSPECTFRAME_DELETE, GNEInspectorFrame::onCmdDeleteItem), }; -FXDEFMAP(GNEInspectorFrame::AttrEditor) AttrEditorMap[] = { - FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_INSPECT_RESET, GNEInspectorFrame::AttrEditor::onCmdReset), -}; -FXDEFMAP(GNEInspectorFrame::AttrConnection) AttrConnectionMap[] = { - FXMAPFUNC(SEL_COMMAND, MID_GNE_SHOW_CONNECTION, GNEInspectorFrame::AttrConnection::onCmdSetShowConnection), - FXMAPFUNC(SEL_COMMAND, MID_GNE_INSPECT_CONNECTION, GNEInspectorFrame::AttrConnection::onCmdInspectConnection), +FXDEFMAP(GNEInspectorFrame::AttributeInput) AttrInputMap[] = { + FXMAPFUNC(SEL_COMMAND, MID_GNE_SET_ATTRIBUTE, GNEInspectorFrame::AttributeInput::onCmdSetAttribute), + FXMAPFUNC(SEL_COMMAND, MID_GNE_OPEN_ATTRIBUTE_EDITOR, GNEInspectorFrame::AttributeInput::onCmdOpenAllowDisallowEditor) }; // Object implementation -FXIMPLEMENT(GNEInspectorFrame, FXScrollWindow, GNEInspectorFrameMap, ARRAYNUMBER(GNEInspectorFrameMap)) -FXIMPLEMENT(GNEInspectorFrame::AttrInput, FXMatrix, AttrInputMap, ARRAYNUMBER(AttrInputMap)) -FXIMPLEMENT(GNEInspectorFrame::AttrEditor, FXDialogBox, AttrEditorMap, ARRAYNUMBER(AttrEditorMap)) -FXIMPLEMENT(GNEInspectorFrame::AttrConnection, FXHorizontalFrame, AttrConnectionMap, ARRAYNUMBER(AttrConnectionMap)) +FXIMPLEMENT(GNEInspectorFrame, FXVerticalFrame, GNEInspectorFrameMap, ARRAYNUMBER(GNEInspectorFrameMap)) +FXIMPLEMENT(GNEInspectorFrame::AttributeInput, FXHorizontalFrame, AttrInputMap, ARRAYNUMBER(AttrInputMap)) // =========================================================================== // method definitions // =========================================================================== -GNEInspectorFrame::GNEInspectorFrame(FXComposite* parent, GNEViewNet* viewNet): - GNEFrame(parent, viewNet, "Inspector"), - myEdgeTemplate(0), - myAdditional(0), - myPreviousElement(0) { +GNEInspectorFrame::GNEInspectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet): + GNEFrame(horizontalFrameParent, viewNet, "Inspector"), + myEdgeTemplate(NULL), + myAdditional(NULL), + myPreviousElementInspect(NULL), + myPreviousElementDelete(NULL) { // Create back button - myBackButton = new FXButton(myHeaderLeftFrame, "", GUIIconSubSys::getIcon(ICON_NETEDITARROW), this, MID_GNE_INSPECT_GOBACK, ICON_BEFORE_TEXT | FRAME_THICK | FRAME_RAISED | LAYOUT_FILL); + myBackButton = new FXButton(myHeaderLeftFrame, "", GUIIconSubSys::getIcon(ICON_NETEDITARROW), this, MID_GNE_INSPECT_GOBACK, GUIDesignButtonIconRectangular); + myHeaderLeftFrame->hide(); myBackButton->hide(); // Create groupBox for attributes - myGroupBoxForAttributes = new FXGroupBox(myContentFrame, "attributes", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X); + myGroupBoxForAttributes = new FXGroupBox(myContentFrame, "Internal attributes", GUIDesignGroupBoxFrame); myGroupBoxForAttributes->hide(); - // Create AttrInput - for (int i = 0; i < GNEAttributeCarrier::getHigherNumberOfAttributes(); i++) { - vectorOfAttrInput.push_back(new AttrInput(myGroupBoxForAttributes, this)); + // Create AttributeInput + for (int i = 0; i < (int)GNEAttributeCarrier::getHigherNumberOfAttributes(); i++) { + myVectorOfAttributeInputs.push_back(new AttributeInput(myGroupBoxForAttributes, this)); } + // Create groupBox for Netedit parameters + myGroupBoxForEditor = new FXGroupBox(myContentFrame, "Netedit attributes", GUIDesignGroupBoxFrame); + myGroupBoxForEditor->hide(); + + // Create check blocked label and button + FXHorizontalFrame* blockMovementHorizontalFrame = new FXHorizontalFrame(myGroupBoxForEditor, GUIDesignAuxiliarHorizontalFrame); + myCheckBlockedLabel = new FXLabel(blockMovementHorizontalFrame, "block movement", 0, GUIDesignLabelAttribute); + myCheckBlocked = new FXCheckButton(blockMovementHorizontalFrame, "", this, MID_GNE_SET_BLOCKING, GUIDesignCheckButtonAttribute); + myCheckBlocked->hide(); + + // Create groupbox and tree list + myGroupBoxForTreeList = new FXGroupBox(myContentFrame, "Childs", GUIDesignGroupBoxFrame); + myTreelist = new FXTreeList(myGroupBoxForTreeList, this, MID_GNE_CHILDS, GUIDesignTreeListFrame); + myGroupBoxForTreeList->hide(); + // Create groupBox for templates - myGroupBoxForTemplates = new FXGroupBox(myContentFrame, "Templates", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X); + myGroupBoxForTemplates = new FXGroupBox(myContentFrame, "Templates", GUIDesignGroupBoxFrame); myGroupBoxForTemplates->hide(); // Create copy template button - myCopyTemplateButton = new FXButton(myGroupBoxForTemplates, "", 0, this, MID_GNE_COPY_TEMPLATE, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 3, 3); + myCopyTemplateButton = new FXButton(myGroupBoxForTemplates, "", 0, this, MID_GNE_COPY_TEMPLATE, GUIDesignButton); myCopyTemplateButton->hide(); // Create set template button - mySetTemplateButton = new FXButton(myGroupBoxForTemplates, "Set as Template\t\t", 0, this, MID_GNE_SET_TEMPLATE, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 3, 3); + mySetTemplateButton = new FXButton(myGroupBoxForTemplates, "Set as Template\t\t", 0, this, MID_GNE_SET_TEMPLATE, GUIDesignButton); mySetTemplateButton->hide(); - - // Create groupBox for editor parameters - myGroupBoxForEditor = new FXGroupBox(myContentFrame, "editor", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X); - myGroupBoxForEditor->hide(); - - // Create check blocked button - myCheckBlocked = new FXCheckButton(myGroupBoxForEditor, "Block movement", this, MID_GNE_SET_BLOCKING); - myCheckBlocked->hide(); - - // Create groupBox for AttrConnection - myGroupBoxForAttrConnections = new FXGroupBox(myContentFrame, "Connections", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X); - myGroupBoxForAttrConnections->hide(); - - // Create AttrConnections - for (int i = 0; i < MAXNUMBEROFATTRCONNECTIONS; i++) { - myAttrConnections.push_back(new AttrConnection(myGroupBoxForAttrConnections, this)); - } } + GNEInspectorFrame::~GNEInspectorFrame() { if (myEdgeTemplate) { myEdgeTemplate->decRef("GNEInspectorFrame::~GNEInspectorFrame"); @@ -159,44 +156,29 @@ void GNEInspectorFrame::show() { - // Show Scroll window - FXScrollWindow::show(); - // Show and update Frame Area in which this GNEFrame is placed - myViewNet->getViewParent()->showFramesArea(); -} - - -void -GNEInspectorFrame::hide() { - // Hide ScrollWindow - FXScrollWindow::hide(); - // Hide Frame Area in which this GNEFrame is placed - myViewNet->getViewParent()->hideFramesArea(); + inspectElement(NULL); + GNEFrame::show(); } void -GNEInspectorFrame::inspect(GNEAttributeCarrier* AC, GNEAttributeCarrier* previousElement) { +GNEInspectorFrame::inspectElement(GNEAttributeCarrier* AC) { // Use the implementation of inspect for multiple AttributeCarriers to avoid repetition of code std::vector itemToInspect; - itemToInspect.push_back(AC); - inspect(itemToInspect, previousElement); + if (AC != NULL) { + itemToInspect.push_back(AC); + } + inspectMultisection(itemToInspect); } void -GNEInspectorFrame::inspect(const std::vector& ACs, GNEAttributeCarrier* previousElement) { +GNEInspectorFrame::inspectMultisection(const std::vector& ACs) { + // hide back button + myHeaderLeftFrame->hide(); + myBackButton->hide(); // Assing ACs to myACs myACs = ACs; - // Show back button if previousElement was defined - myPreviousElement = previousElement; - if (myPreviousElement != NULL) { - myHeaderLeftFrame->show(); - myBackButton->show(); - } else { - myHeaderLeftFrame->hide(); - myBackButton->hide(); - } // Hide all elements myGroupBoxForAttributes->hide(); myGroupBoxForTemplates->hide(); @@ -205,7 +187,7 @@ myGroupBoxForEditor->hide(); myGroupBoxForEditor->hide(); myCheckBlocked->hide(); - myGroupBoxForAttrConnections->hide(); + myGroupBoxForTreeList->hide(); // If vector of attribute Carriers contain data if (myACs.size() > 0) { // Set header @@ -225,25 +207,24 @@ //Show myGroupBoxForAttributes myGroupBoxForAttributes->show(); - // Hide all AttrInput - for (std::vector::iterator i = vectorOfAttrInput.begin(); i != vectorOfAttrInput.end(); i++) { + // Hide all AttributeInput + for (std::vector::iterator i = myVectorOfAttributeInputs.begin(); i != myVectorOfAttributeInputs.end(); i++) { (*i)->hideAttribute(); } - // Hide all AttrConnections - for (int i = 0; i < MAXNUMBEROFATTRCONNECTIONS; i++) { - myAttrConnections.at(i)->hideAttrConnection(); - } - - // Gets attributes of element + // Gets tag and attributes of element + SumoXMLTag tag = myACs.front()->getTag(); const std::vector& attrs = myACs.front()->getAttrs(); - // Declare iterator over AttrImput - std::vector::iterator itAttrs = vectorOfAttrInput.begin(); + // Declare iterator over AttrInput + std::vector::iterator itAttrs = myVectorOfAttributeInputs.begin(); + + // check if current AC is a Junction without TLSs (needed to hidde TLS options) + bool disableTLSinJunctions = (dynamic_cast(myACs.front()) && (dynamic_cast(myACs.front())->getNBNode()->getControllingTLS().empty())); // Iterate over attributes for (std::vector::const_iterator it = attrs.begin(); it != attrs.end(); it++) { - if (myACs.size() > 1 && GNEAttributeCarrier::isUnique(*it)) { + if (myACs.size() > 1 && GNEAttributeCarrier::isUnique(tag, *it)) { // disable editing for some attributes in case of multi-selection // even displaying is problematic because of string rendering restrictions continue; @@ -262,10 +243,35 @@ oss << *it_val; } // Show attribute - (*itAttrs)->showAttribute(myACs.front()->getTag(), *it, oss.str()); + if (((disableTLSinJunctions == true) && (tag == SUMO_TAG_JUNCTION) && ((*it == SUMO_ATTR_TLTYPE) || (*it == SUMO_ATTR_TLID))) == false) { + (*itAttrs)->showAttribute(myACs.front()->getTag(), (*it), oss.str()); + } + // update attribute iterator itAttrs++; } + // If attributes correspond to an Additional + if (dynamic_cast(myACs.front())) { + // Get pointer to additional + myAdditional = dynamic_cast(myACs.front()); + // Show check blocked if additional is movable + if (myAdditional->isAdditionalMovable()) { + myCheckBlocked->setCheck(myAdditional->isAdditionalBlocked()); + if (myAdditional->isAdditionalBlocked()) { + myCheckBlocked->setText("true"); + } else { + myCheckBlocked->setText("false"); + } + myCheckBlocked->show(); + myGroupBoxForEditor->show(); + } + } + + // if we inspect a single Attribute carrier vector, show their childs + if (myACs.size() == 1) { + showAttributeCarrierChilds(); + } + // If attributes correspond to an Edge if (dynamic_cast(myACs.front())) { // show groupBox for templates @@ -276,60 +282,42 @@ if (myACs.size() == 1) { mySetTemplateButton->show(); } - // Obtain connections of edge - const std::vector& connections = dynamic_cast(myACs.front())->getGNEConnections(); - if (connections.size() > 0) { - // Check if all connections are editables - if (connections.size() > MAXNUMBEROFATTRCONNECTIONS) { - WRITE_WARNING("Number of connections of " + myACs.front()->getID() + " is greater than the number of editable connections (" + toString(MAXNUMBEROFATTRCONNECTIONS) + ")"); - } - // Show AttrConnections - for (int i = 0; i < (int)connections.size() && i < MAXNUMBEROFATTRCONNECTIONS; i++) { - myAttrConnections.at(i)->showConnections(connections.at(i)); - } - myGroupBoxForAttrConnections->show(); - } } + } else { + getFrameHeaderLabel()->setText("No Object selected"); + myContentFrame->recalc(); + } +} - // If attributes correspond to a lane - if (dynamic_cast(myACs.front())) { - // Obtain connections of lane - std::vector connections = dynamic_cast(myACs.front())->getGNEOutcomingConnections(); - if (connections.size() > 0) { - // Check if all connections are editables - if (connections.size() > MAXNUMBEROFATTRCONNECTIONS) { - WRITE_WARNING("Number of connections of " + myACs.front()->getID() + " is greater than the number of editable connections (" + toString(MAXNUMBEROFATTRCONNECTIONS) + ")"); - } - // Show AttrConnections - for (int i = 0; i < (int)connections.size() && i < MAXNUMBEROFATTRCONNECTIONS; i++) { - myAttrConnections.at(i)->showConnections(connections.at(i)); - } - myGroupBoxForAttrConnections->show(); - } - } - // If attributes correspond to an Additional - if (dynamic_cast(myACs.front())) { - // Get pointer to additional - myAdditional = dynamic_cast(myACs.front()); - bool showGroupBoxForEditor = false; +void +GNEInspectorFrame::inspectChild(GNEAttributeCarrier* AC, GNEAttributeCarrier* previousElement) { + // Show back button if myPreviousElementInspect was defined + myPreviousElementInspect = previousElement; + if (myPreviousElementInspect != NULL) { + // disable myPreviousElementDelete to avoid inconsistences + myPreviousElementDelete = NULL; + inspectElement(AC); + myHeaderLeftFrame->show(); + myBackButton->show(); + } +} - // Show check blocked if additional is movable - if (myAdditional->isAdditionalMovable()) { - myCheckBlocked->setCheck(myAdditional->isAdditionalBlocked()); - myCheckBlocked->show(); - showGroupBoxForEditor = true; - } - // Show groupBox for editor Attributes if some of additional attributes are editable - if (showGroupBoxForEditor == true) { - myGroupBoxForEditor->show(); - } - } - } else { - getFrameHeaderLabel()->setText("No Object selected"); + +void GNEInspectorFrame::inspectFromDeleteFrame(GNEAttributeCarrier* AC, GNEAttributeCarrier* previousElement, bool previousElementWasMarked) { + myPreviousElementDelete = previousElement; + myPreviousElementDeleteWasMarked = previousElementWasMarked; + // Show back button if myPreviousElementDelete is valid + if (myPreviousElementDelete != NULL) { + // disable myPreviousElementInspect to avoid inconsistences + myPreviousElementInspect = NULL; + inspectElement(AC); + myHeaderLeftFrame->show(); + myBackButton->show(); } } + GNEEdge* GNEInspectorFrame::getEdgeTemplate() const { return myEdgeTemplate; @@ -355,7 +343,7 @@ GNEEdge* edge = dynamic_cast(*it); assert(edge); edge->copyTemplate(myEdgeTemplate, myViewNet->getUndoList()); - inspect(myACs); + inspectMultisection(myACs); } return 1; } @@ -391,8 +379,10 @@ if (myAdditional) { if (myCheckBlocked->getCheck() == 1) { myAdditional->setAttribute(GNE_ATTR_BLOCK_MOVEMENT, "true", getViewNet()->getUndoList()); + myCheckBlocked->setText("true"); } else { myAdditional->setAttribute(GNE_ATTR_BLOCK_MOVEMENT, "false", getViewNet()->getUndoList()); + myCheckBlocked->setText("false"); } } return 1; @@ -401,9 +391,19 @@ long GNEInspectorFrame::onCmdGoBack(FXObject*, FXSelector, void*) { - // Inspect previous element (if was defined) - if (myPreviousElement) { - inspect(myPreviousElement); + // Inspect previous element or go back to Delete Frame + if (myPreviousElementInspect) { + inspectElement(myPreviousElementInspect); + myPreviousElementInspect = NULL; + } else if (myPreviousElementDelete != NULL) { + myViewNet->getViewParent()->getDeleteFrame()->showAttributeCarrierChilds(myPreviousElementDelete); + if (myPreviousElementDeleteWasMarked) { + myViewNet->getViewParent()->getDeleteFrame()->markAttributeCarrier(myPreviousElementDelete); + } + myPreviousElementDelete = NULL; + // Hide inspect frame and show delete frame + hide(); + myViewNet->getViewParent()->getDeleteFrame()->show(); } return 1; } @@ -414,55 +414,365 @@ return myACs; } + +long +GNEInspectorFrame::onCmdShowChildMenu(FXObject*, FXSelector, void* data) { + // Obtain event + FXEvent* e = (FXEvent*) data; + FXTreeItem* item = myTreelist->getItemAt(e->win_x, e->win_y); + // Check if there are an item in the position and create pop-up menu + if (item && (myTreeItemsWithoutAC.find(item) == myTreeItemsWithoutAC.end())) { + createPopUpMenu(e->root_x, e->root_y, myTreeItemToACMap[myTreelist->getItemAt(e->win_x, e->win_y)]); + } + return 1; +} + + +long +GNEInspectorFrame::onCmdCenterItem(FXObject*, FXSelector, void*) { + if (dynamic_cast(myRightClickedAC)) { + myViewNet->centerTo(dynamic_cast(myRightClickedAC)->getGlID(), false); + } else if (dynamic_cast(myRightClickedAC)) { + myViewNet->centerTo(dynamic_cast(myRightClickedAC)->getGlID(), false); + } else if (dynamic_cast(myRightClickedAC)) { + myViewNet->centerTo(dynamic_cast(myRightClickedAC)->getGlID(), false); + } else if (dynamic_cast(myRightClickedAC)) { + myViewNet->centerTo(dynamic_cast(myRightClickedAC)->getGlID(), false); + } + myViewNet->update(); + return 1; +} + + +long +GNEInspectorFrame::onCmdInspectItem(FXObject*, FXSelector, void*) { + assert(myACs.size() == 1); + inspectChild(myRightClickedAC, myACs.front()); + return 1; +} + + +long +GNEInspectorFrame::onCmdDeleteItem(FXObject*, FXSelector, void*) { + // Remove Attribute Carrier + myViewNet->getViewParent()->getDeleteFrame()->show(); + myViewNet->getViewParent()->getDeleteFrame()->removeAttributeCarrier(myRightClickedAC); + myViewNet->getViewParent()->getDeleteFrame()->hide(); + // show again childs of attribute carrier + showAttributeCarrierChilds(); + return 1; +} + + +void +GNEInspectorFrame::createPopUpMenu(int X, int Y, GNEAttributeCarrier* ac) { + // create FXMenuPane + FXMenuPane* pane = new FXMenuPane(myTreelist); + // set current clicked AC + myRightClickedAC = ac; + // set name + new MFXMenuHeader(pane, myViewNet->getViewParent()->getApp()->getBoldFont(), (toString(myRightClickedAC->getTag()) + ": " + myRightClickedAC->getID()).c_str(), myRightClickedAC->getIcon()); + new FXMenuSeparator(pane); + // Fill FXMenuCommand + new FXMenuCommand(pane, "Center", GUIIconSubSys::getIcon(ICON_RECENTERVIEW), this, MID_GNE_INSPECTFRAME_CENTER); + new FXMenuCommand(pane, "Inspect", GUIIconSubSys::getIcon(ICON_MODEINSPECT), this, MID_GNE_INSPECTFRAME_INSPECT); + new FXMenuCommand(pane, "Delete", GUIIconSubSys::getIcon(ICON_MODEDELETE), this, MID_GNE_INSPECTFRAME_DELETE); + // Center in the mouse position and create pane + pane->setX(X); + pane->setY(Y); + pane->create(); + pane->show(); +} + + +void +GNEInspectorFrame::showAttributeCarrierChilds() { + // Only show attributes of ONE attribute carrier + assert(myACs.size() == 1); + // clear items + myTreelist->clearItems(); + myTreeItemToACMap.clear(); + myTreeItemsWithoutAC.clear(); + myGroupBoxForTreeList->show(); + // Switch gl type of ac + switch (dynamic_cast(myACs.front())->getType()) { + case GLO_JUNCTION: { + // insert junction root + GNEJunction* junction = dynamic_cast(myACs.front()); + FXTreeItem* junctionItem = myTreelist->insertItem(0, 0, toString(junction->getTag()).c_str(), junction->getIcon(), junction->getIcon()); + myTreeItemToACMap[junctionItem] = junction; + junctionItem->setExpanded(true); + // insert edges + for (int i = 0; i < (int)junction->getGNEEdges().size(); i++) { + GNEEdge* edge = junction->getGNEEdges().at(i); + FXTreeItem* edgeItem = myTreelist->insertItem(0, junctionItem, (toString(edge->getTag()) + " " + toString(i)).c_str(), edge->getIcon(), edge->getIcon()); + myTreeItemToACMap[edgeItem] = edge; + edgeItem->setExpanded(true); + // insert lanes + for (int j = 0; j < (int)edge->getLanes().size(); j++) { + GNELane* lane = edge->getLanes().at(j); + FXTreeItem* laneItem = myTreelist->insertItem(0, edgeItem, (toString(lane->getTag()) + " " + toString(j)).c_str(), lane->getIcon(), lane->getIcon()); + myTreeItemToACMap[laneItem] = lane; + laneItem->setExpanded(true); + // insert additionals of lanes + for (int k = 0; k < (int)lane->getAdditionalChilds().size(); k++) { + GNEAdditional* additional = lane->getAdditionalChilds().at(k); + FXTreeItem* additionalItem = myTreelist->insertItem(0, laneItem, (toString(additional->getTag()) + " " + toString(k)).c_str(), additional->getIcon(), additional->getIcon()); + myTreeItemToACMap[additionalItem] = additional; + additionalItem->setExpanded(true); + } + // insert incoming connections of lanes (by default isn't expanded) + if (lane->getGNEIncomingConnections().size() > 0) { + FXTreeItem* incomingConnections = myTreelist->insertItem(0, laneItem, "Incomings", lane->getGNEIncomingConnections().front()->getIcon(), lane->getGNEIncomingConnections().front()->getIcon()); + myTreeItemsWithoutAC.insert(incomingConnections); + incomingConnections->setExpanded(false); + for (int k = 0; k < (int)lane->getGNEIncomingConnections().size(); k++) { + GNEConnection* connection = lane->getGNEIncomingConnections().at(k); + FXTreeItem* connectionItem = myTreelist->insertItem(0, incomingConnections, (toString(connection->getTag()) + " " + toString(k)).c_str(), connection->getIcon(), connection->getIcon()); + myTreeItemToACMap[connectionItem] = connection; + connectionItem->setExpanded(true); + } + } + // insert outcoming connections of lanes (by default isn't expanded) + if (lane->getGNEOutcomingConnections().size() > 0) { + FXTreeItem* outgoingConnections = myTreelist->insertItem(0, laneItem, "Outcomings", lane->getGNEOutcomingConnections().front()->getIcon(), lane->getGNEOutcomingConnections().front()->getIcon()); + myTreeItemsWithoutAC.insert(outgoingConnections); + outgoingConnections->setExpanded(false); + for (int k = 0; k < (int)lane->getGNEOutcomingConnections().size(); k++) { + GNEConnection* connection = lane->getGNEOutcomingConnections().at(k); + FXTreeItem* connectionItem = myTreelist->insertItem(0, outgoingConnections, (toString(connection->getTag()) + " " + toString(k)).c_str(), connection->getIcon(), connection->getIcon()); + myTreeItemToACMap[connectionItem] = connection; + connectionItem->setExpanded(true); + } + } + } + // insert additionals of edge + for (int j = 0; j < (int)edge->getAdditionalChilds().size(); j++) { + GNEAdditional* additional = edge->getAdditionalChilds().at(j); + FXTreeItem* additionalItem = myTreelist->insertItem(0, edgeItem, (toString(additional->getTag()) + " " + toString(j)).c_str(), additional->getIcon(), additional->getIcon()); + myTreeItemToACMap[additionalItem] = additional; + additionalItem->setExpanded(true); + } + + } + // insert crossings + for (int i = 0; i < (int)junction->getGNECrossings().size(); i++) { + GNECrossing* crossing = junction->getGNECrossings().at(i); + FXTreeItem* crossingItem = myTreelist->insertItem(0, junctionItem, (toString(crossing->getTag()) + " " + toString(i)).c_str(), crossing->getIcon(), crossing->getIcon()); + myTreeItemToACMap[crossingItem] = crossing; + crossingItem->setExpanded(true); + } + break; + } + case GLO_EDGE: { + // insert edge root + GNEEdge* edge = dynamic_cast(myACs.front()); + FXTreeItem* edgeItem = myTreelist->insertItem(0, 0, toString(edge->getTag()).c_str(), edge->getIcon(), edge->getIcon()); + myTreeItemToACMap[edgeItem] = edge; + edgeItem->setExpanded(true); + // insert lanes + for (int i = 0; i < (int)edge->getLanes().size(); i++) { + GNELane* lane = edge->getLanes().at(i); + FXTreeItem* laneItem = myTreelist->insertItem(0, edgeItem, (toString(lane->getTag()) + " " + toString(i)).c_str(), lane->getIcon(), lane->getIcon()); + myTreeItemToACMap[laneItem] = lane; + laneItem->setExpanded(true); + // insert additionals of lanes + for (int j = 0; j < (int)lane->getAdditionalChilds().size(); j++) { + GNEAdditional* additional = lane->getAdditionalChilds().at(j); + FXTreeItem* additionalItem = myTreelist->insertItem(0, laneItem, (toString(additional->getTag()) + " " + toString(j)).c_str(), additional->getIcon(), additional->getIcon()); + myTreeItemToACMap[additionalItem] = additional; + additionalItem->setExpanded(true); + } + // insert incoming connections of lanes (by default isn't expanded) + if (lane->getGNEIncomingConnections().size() > 0) { + FXTreeItem* incomingConnections = myTreelist->insertItem(0, laneItem, "Incomings", lane->getGNEIncomingConnections().front()->getIcon(), lane->getGNEIncomingConnections().front()->getIcon()); + myTreeItemsWithoutAC.insert(incomingConnections); + incomingConnections->setExpanded(false); + for (int j = 0; j < (int)lane->getGNEIncomingConnections().size(); j++) { + GNEConnection* connection = lane->getGNEIncomingConnections().at(j); + FXTreeItem* connectionItem = myTreelist->insertItem(0, incomingConnections, (toString(connection->getTag()) + " " + toString(j)).c_str(), connection->getIcon(), connection->getIcon()); + myTreeItemToACMap[connectionItem] = connection; + connectionItem->setExpanded(true); + } + } + // insert outcoming connections of lanes (by default isn't expanded) + if (lane->getGNEOutcomingConnections().size() > 0) { + FXTreeItem* outgoingConnections = myTreelist->insertItem(0, laneItem, "Outcomings", lane->getGNEOutcomingConnections().front()->getIcon(), lane->getGNEOutcomingConnections().front()->getIcon()); + myTreeItemsWithoutAC.insert(outgoingConnections); + outgoingConnections->setExpanded(false); + for (int j = 0; j < (int)lane->getGNEOutcomingConnections().size(); j++) { + GNEConnection* connection = lane->getGNEOutcomingConnections().at(j); + FXTreeItem* connectionItem = myTreelist->insertItem(0, outgoingConnections, (toString(connection->getTag()) + " " + toString(j)).c_str(), connection->getIcon(), connection->getIcon()); + myTreeItemToACMap[connectionItem] = connection; + connectionItem->setExpanded(true); + } + } + } + // insert additionals of edge + for (int i = 0; i < (int)edge->getAdditionalChilds().size(); i++) { + GNEAdditional* additional = edge->getAdditionalChilds().at(i); + FXTreeItem* additionalItem = myTreelist->insertItem(0, edgeItem, (toString(additional->getTag()) + " " + toString(i)).c_str(), additional->getIcon(), additional->getIcon()); + myTreeItemToACMap[additionalItem] = additional; + additionalItem->setExpanded(true); + } + break; + } + case GLO_LANE: { + // insert lane root + GNELane* lane = dynamic_cast(myACs.front()); + FXTreeItem* laneItem = myTreelist->insertItem(0, 0, toString(lane->getTag()).c_str(), lane->getIcon(), lane->getIcon()); + myTreeItemToACMap[laneItem] = lane; + laneItem->setExpanded(true); + // insert additionals of lanes + for (int i = 0; i < (int)lane->getAdditionalChilds().size(); i++) { + GNEAdditional* additional = lane->getAdditionalChilds().at(i); + FXTreeItem* additionalItem = myTreelist->insertItem(0, laneItem, (toString(additional->getTag()) + " " + toString(i)).c_str(), additional->getIcon(), additional->getIcon()); + myTreeItemToACMap[additionalItem] = additional; + additionalItem->setExpanded(true); + } + // insert incoming connections of lanes (by default isn't expanded) + if (lane->getGNEIncomingConnections().size() > 0) { + FXTreeItem* incomingConnections = myTreelist->insertItem(0, laneItem, "Incomings", lane->getGNEIncomingConnections().front()->getIcon(), lane->getGNEIncomingConnections().front()->getIcon()); + myTreeItemsWithoutAC.insert(incomingConnections); + incomingConnections->setExpanded(false); + for (int i = 0; i < (int)lane->getGNEIncomingConnections().size(); i++) { + GNEConnection* connection = lane->getGNEIncomingConnections().at(i); + FXTreeItem* connectionItem = myTreelist->insertItem(0, incomingConnections, (toString(connection->getTag()) + " " + toString(i)).c_str(), connection->getIcon(), connection->getIcon()); + myTreeItemToACMap[connectionItem] = connection; + connectionItem->setExpanded(true); + } + } + // insert outcoming connections of lanes (by default isn't expanded) + if (lane->getGNEOutcomingConnections().size() > 0) { + FXTreeItem* outgoingConnections = myTreelist->insertItem(0, laneItem, "Outcomings", lane->getGNEOutcomingConnections().front()->getIcon(), lane->getGNEOutcomingConnections().front()->getIcon()); + myTreeItemsWithoutAC.insert(outgoingConnections); + outgoingConnections->setExpanded(false); + for (int i = 0; i < (int)lane->getGNEOutcomingConnections().size(); i++) { + GNEConnection* connection = lane->getGNEOutcomingConnections().at(i); + FXTreeItem* connectionItem = myTreelist->insertItem(0, outgoingConnections, (toString(connection->getTag()) + " " + toString(i)).c_str(), connection->getIcon(), connection->getIcon()); + myTreeItemToACMap[connectionItem] = connection; + connectionItem->setExpanded(true); + } + } + break; + } + case GLO_POI: { + // insert POI root + GNEPOI* POI = dynamic_cast(myACs.front()); + FXTreeItem* POIItem = myTreelist->insertItem(0, 0, toString(POI->getTag()).c_str(), POI->getIcon(), POI->getIcon()); + myTreeItemToACMap[POIItem] = POI; + POIItem->setExpanded(true); + break; + } + case GLO_POLYGON: { + // insert polygon root + GNEPoly* polygon = dynamic_cast(myACs.front()); + FXTreeItem* polygonItem = myTreelist->insertItem(0, 0, toString(polygon->getTag()).c_str(), polygon->getIcon(), polygon->getIcon()); + myTreeItemToACMap[polygonItem] = polygon; + polygonItem->setExpanded(true); + break; + } + case GLO_CROSSING: { + // insert crossing root + GNECrossing* crossing = dynamic_cast(myACs.front()); + FXTreeItem* crossingItem = myTreelist->insertItem(0, 0, toString(crossing->getTag()).c_str(), crossing->getIcon(), crossing->getIcon()); + myTreeItemToACMap[crossingItem] = crossing; + crossingItem->setExpanded(true); + break; + } + case GLO_ADDITIONAL: { + // insert additional root + GNEAdditional* additional = dynamic_cast(myACs.front()); + FXTreeItem* additionalItem = myTreelist->insertItem(0, 0, toString(additional->getTag()).c_str(), additional->getIcon(), additional->getIcon()); + myTreeItemToACMap[additionalItem] = additional; + additionalItem->setExpanded(true); + break; + } + case GLO_CONNECTION: { + // insert connection root + GNEConnection* connection = dynamic_cast(myACs.front()); + FXTreeItem* connectionItem = myTreelist->insertItem(0, 0, toString(connection->getTag()).c_str(), connection->getIcon(), connection->getIcon()); + myTreeItemToACMap[connectionItem] = connection; + connectionItem->setExpanded(true); + break; + } + default: { + myGroupBoxForTreeList->hide(); + break; + } + } +} + // =========================================================================== -// AttrInput method definitions +// AttributeInput method definitions // =========================================================================== -GNEInspectorFrame::AttrInput::AttrInput(FXComposite* parent, GNEInspectorFrame* inspectorFrameParent) : - FXMatrix(parent, 8, MATRIX_BY_COLUMNS | LAYOUT_FILL_X | PACK_UNIFORM_WIDTH), +GNEInspectorFrame::AttributeInput::AttributeInput(FXComposite* parent, GNEInspectorFrame* inspectorFrameParent) : + FXHorizontalFrame(parent, GUIDesignAuxiliarHorizontalFrame), myInspectorFrameParent(inspectorFrameParent), myTag(SUMO_TAG_NOTHING), myAttr(SUMO_ATTR_NOTHING) { // Create and hide ButtonCombinableChoices - myButtonCombinableChoices = new FXButton(this, "AttributeButton", 0, this, MID_GNE_OPEN_ATTRIBUTE_EDITOR, ICON_BEFORE_TEXT | LAYOUT_FILL_COLUMN | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED); + myButtonCombinableChoices = new FXButton(this, "AttributeButton", 0, this, MID_GNE_OPEN_ATTRIBUTE_EDITOR, GUIDesignButtonAttribute); myButtonCombinableChoices->hide(); // Create and hide label - myLabel = new FXLabel(this, "attributeLabel", 0, FRAME_THICK | LAYOUT_FILL_COLUMN | LAYOUT_FILL_X); + myLabel = new FXLabel(this, "attributeLabel", 0, GUIDesignLabelAttribute); myLabel->hide(); - // Create and hide textField int - myTextFieldInt = new FXTextField(this, 1, this, MID_GNE_SET_ATTRIBUTE, FRAME_THICK | TEXTFIELD_INTEGER | LAYOUT_FILL_COLUMN | LAYOUT_FILL_X); + // Create and hide textField for int attributes + myTextFieldInt = new FXTextField(this, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldInt); myTextFieldInt->hide(); - // Create and hide textField real - myTextFieldReal = new FXTextField(this, 1, this, MID_GNE_SET_ATTRIBUTE, FRAME_THICK | TEXTFIELD_REAL | LAYOUT_FILL_COLUMN | LAYOUT_FILL_X); + // Create and hide textField for real/time attributes + myTextFieldReal = new FXTextField(this, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldReal); myTextFieldReal->hide(); - // Create and hide textField string - myTextFieldStrings = new FXTextField(this, 1, this, MID_GNE_SET_ATTRIBUTE, TEXTFIELD_NORMAL | LAYOUT_FILL_COLUMN | LAYOUT_FILL_X); + // Create and hide textField for string attributes + myTextFieldStrings = new FXTextField(this, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField); myTextFieldStrings->hide(); // Create and hide ComboBox - myChoicesCombo = new FXComboBox(this, 1, this, MID_GNE_SET_ATTRIBUTE, FRAME_THICK | LAYOUT_CENTER_Y | LAYOUT_FILL_COLUMN | LAYOUT_FILL_X); + myChoicesCombo = new FXComboBox(this, GUIDesignComboBoxNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignComboBoxAttribute); myChoicesCombo->hide(); // Create and hide checkButton - myCheckBox = new FXCheckButton(this, "", this, MID_GNE_SET_ATTRIBUTE, JUSTIFY_LEFT | ICON_BEFORE_TEXT | LAYOUT_FILL_COLUMN | LAYOUT_FILL_X); - myCheckBox->hide(); + myBoolCheckButton = new FXCheckButton(this, "", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButtonAttribute); + myBoolCheckButton->hide(); } void -GNEInspectorFrame::AttrInput::showAttribute(SumoXMLTag tag, SumoXMLAttr attr, const std::string& value) { +GNEInspectorFrame::AttributeInput::showAttribute(SumoXMLTag tag, SumoXMLAttr attr, const std::string& value) { // Set actual Tag and attribute myTag = tag; myAttr = attr; - // ShowLabel + // Show attribute Label myLabel->setText(toString(myAttr).c_str()); myLabel->show(); // Set field depending of the type of value - if (GNEAttributeCarrier::isBool(myAttr)) { + if (GNEAttributeCarrier::isBool(myTag, myAttr)) { + // this is an special case for inspection of multiple attribute carriers with bools + std::vector boolValues = GNEAttributeCarrier::parse >(value); // set value of checkbox - myCheckBox->setCheck(GNEAttributeCarrier::parse(value)); - myCheckBox->show(); + if (boolValues.size() == 1) { + myBoolCheckButton->setCheck(boolValues.front()); + } else { + int sum = 0; + for (std::vector::iterator i = boolValues.begin(); i != boolValues.end(); i++) { + sum += (int)(*i); + } + // only set true if all checkbox are true + if ((sum == 0) || (sum != (int)boolValues.size())) { + myBoolCheckButton->setCheck(false); + } else { + myBoolCheckButton->setCheck(true); + } + } + // set text + if (myBoolCheckButton->getCheck()) { + myBoolCheckButton->setText("true"); + } else { + myBoolCheckButton->setText("false"); + } + myBoolCheckButton->show(); } else if (GNEAttributeCarrier::isDiscrete(myTag, myAttr)) { // Obtain choices - const std::vector& choices = GNEAttributeCarrier::discreteChoices(myTag, myAttr); + const std::vector choices = GNEAttributeCarrier::discreteChoices(myTag, myAttr); // Check if are combinable coices if (choices.size() > 0 && GNEAttributeCarrier::discreteCombinableChoices(myTag, myAttr)) { // hide label @@ -484,12 +794,12 @@ myChoicesCombo->setCurrentItem(myChoicesCombo->findItem(value.c_str())); myChoicesCombo->show(); } - } else if (GNEAttributeCarrier::isFloat(myAttr)) { - // show TextField for real values + } else if (GNEAttributeCarrier::isFloat(myTag, myAttr) || GNEAttributeCarrier::isTime(myTag, myAttr)) { + // show TextField for real/time values myTextFieldReal->setText(value.c_str()); myTextFieldReal->setTextColor(FXRGB(0, 0, 0)); myTextFieldReal->show(); - } else if (GNEAttributeCarrier::isInt(myAttr)) { + } else if (GNEAttributeCarrier::isInt(myTag, myAttr)) { // Show textField for int attributes myTextFieldInt->setText(value.c_str()); myTextFieldInt->setTextColor(FXRGB(0, 0, 0)); @@ -500,56 +810,86 @@ myTextFieldStrings->setTextColor(FXRGB(0, 0, 0)); myTextFieldStrings->show(); } - // Show AttrInput + // Show AttributeInput show(); } void -GNEInspectorFrame::AttrInput::hideAttribute() { +GNEInspectorFrame::AttributeInput::hideAttribute() { // Hide all elements myLabel->hide(); myTextFieldInt->hide(); myTextFieldReal->hide(); myTextFieldStrings->hide(); myChoicesCombo->hide(); - myCheckBox->hide(); + myBoolCheckButton->hide(); myButtonCombinableChoices->hide(); - // hide AttrInput + // hide AttributeInput hide(); } SumoXMLTag -GNEInspectorFrame::AttrInput::getTag() const { +GNEInspectorFrame::AttributeInput::getTag() const { return myTag; } SumoXMLAttr -GNEInspectorFrame::AttrInput::getAttr() const { +GNEInspectorFrame::AttributeInput::getAttr() const { return myAttr; } long -GNEInspectorFrame::AttrInput::onCmdOpenAttributeEditor(FXObject*, FXSelector, void*) { - // Open AttrEditor - AttrEditor(this, myTextFieldStrings); +GNEInspectorFrame::AttributeInput::onCmdOpenAllowDisallowEditor(FXObject*, FXSelector, void*) { + // in XML either allow or disallow can be defined for convenience + // In the input dialog, only the positive-list (allow) is defined even when + // clicking on 'disallow' + std::string allowed = myTextFieldStrings->getText().text(); + std::string disallowed = ""; + if (myAttr == SUMO_ATTR_DISALLOW) { + std::swap(allowed, disallowed); + } + // remove special word "(combined!)" + std::string::size_type i = allowed.find(" (combined!)"); + if (i != std::string::npos) { + allowed.erase(i, 12); + } + SVCPermissions permissions; + if (allowed == "all") { + permissions = SVCAll; + } else { + permissions = parseVehicleClasses(allowed, disallowed); + } + // use expanded form + allowed = getVehicleClassNames(permissions, true); + GNEDialog_AllowDisallow(getApp(), &allowed).execute(); + if (myAttr == SUMO_ATTR_DISALLOW) { + // invert again + std::string disallowed = getVehicleClassNames(SVCAll & ~parseVehicleClasses(allowed)); + myTextFieldStrings->setText((disallowed).c_str()); + } else { + myTextFieldStrings->setText((allowed).c_str()); + } + onCmdSetAttribute(0, 0, 0); return 1; } long -GNEInspectorFrame::AttrInput::onCmdSetAttribute(FXObject*, FXSelector, void*) { +GNEInspectorFrame::AttributeInput::onCmdSetAttribute(FXObject*, FXSelector, void*) { // Declare changed value std::string newVal; // First, obtain the string value of the new attribute depending of their type - if (GNEAttributeCarrier::isBool(myAttr)) { + if (GNEAttributeCarrier::isBool(myTag, myAttr)) { // Set true o false depending of the checBox - if (myCheckBox->getCheck()) { + if (myBoolCheckButton->getCheck()) { + myBoolCheckButton->setText("true"); newVal = "true"; } else { + myBoolCheckButton->setText("false"); newVal = "false"; } } else if (GNEAttributeCarrier::isDiscrete(myTag, myAttr)) { @@ -557,209 +897,80 @@ const std::vector& choices = GNEAttributeCarrier::discreteChoices(myTag, myAttr); // Check if are combinable coices if (choices.size() > 0 && GNEAttributeCarrier::discreteCombinableChoices(myTag, myAttr)) { - // Get value obtained using AttrEditor + // Get value obtained using AttributeEditor newVal = myTextFieldStrings->getText().text(); } else { // Get value of ComboBox newVal = myChoicesCombo->getText().text(); } - } else if (GNEAttributeCarrier::isFloat(myAttr)) { - // obtain value of myTextFieldReal - newVal = myTextFieldReal->getText().text(); - } else if (GNEAttributeCarrier::isInt(myAttr)) { - // obtain value of myTextFieldInt - newVal = myTextFieldInt->getText().text(); - } else if (GNEAttributeCarrier::isString(myAttr)) { - // obtain value of myTextFieldStrings - newVal = myTextFieldStrings->getText().text(); + } else if (GNEAttributeCarrier::isFloat(myTag, myAttr) || GNEAttributeCarrier::isTime(myTag, myAttr)) { + // Check if default value of attribute must be set + if (myTextFieldReal->getText().empty() && GNEAttributeCarrier::hasDefaultValue(myTag, myAttr)) { + newVal = GNEAttributeCarrier::getDefaultValue(myTag, myAttr); + myTextFieldReal->setText(newVal.c_str()); + } else { + // obtain value of myTextFieldReal + newVal = myTextFieldReal->getText().text(); + } + } else if (GNEAttributeCarrier::isInt(myTag, myAttr)) { + // Check if default value of attribute must be set + if (myTextFieldInt->getText().empty() && GNEAttributeCarrier::hasDefaultValue(myTag, myAttr)) { + newVal = GNEAttributeCarrier::getDefaultValue(myTag, myAttr); + myTextFieldInt->setText(newVal.c_str()); + } else { + // obtain value of myTextFieldInt + newVal = myTextFieldInt->getText().text(); + } + } else if (GNEAttributeCarrier::isString(myTag, myAttr)) { + // Check if default value of attribute must be set + if (myTextFieldStrings->getText().empty() && GNEAttributeCarrier::hasDefaultValue(myTag, myAttr)) { + newVal = GNEAttributeCarrier::getDefaultValue(myTag, myAttr); + myTextFieldStrings->setText(newVal.c_str()); + } else { + // obtain value of myTextFieldStrings + newVal = myTextFieldStrings->getText().text(); + } } - // Check if newvalue is valid + // Check if attribute must be changed if (myInspectorFrameParent->getACs().front()->isValid(myAttr, newVal)) { // if its valid for the first AC than its valid for all (of the same type) if (myInspectorFrameParent->getACs().size() > 1) { myInspectorFrameParent->getViewNet()->getUndoList()->p_begin("Change multiple attributes"); } - // Set all attributes + // Set new value of attribute in all selected ACs for (std::vector::const_iterator it_ac = myInspectorFrameParent->getACs().begin(); it_ac != myInspectorFrameParent->getACs().end(); it_ac++) { (*it_ac)->setAttribute(myAttr, newVal, myInspectorFrameParent->getViewNet()->getUndoList()); } + // finish change multiple attributes if (myInspectorFrameParent->getACs().size() > 1) { myInspectorFrameParent->getViewNet()->getUndoList()->p_end(); } // If previously value of TextField was red, change color to black - if (GNEAttributeCarrier::isFloat(myAttr) && myTextFieldStrings != 0) { + if ((GNEAttributeCarrier::isFloat(myTag, myAttr) || GNEAttributeCarrier::isTime(myTag, myAttr)) && myTextFieldStrings != 0) { myTextFieldReal->setTextColor(FXRGB(0, 0, 0)); myTextFieldReal->killFocus(); - } else if (GNEAttributeCarrier::isInt(myAttr) && myTextFieldStrings != 0) { + } else if (GNEAttributeCarrier::isInt(myTag, myAttr) && myTextFieldStrings != 0) { myTextFieldInt->setTextColor(FXRGB(0, 0, 0)); myTextFieldInt->killFocus(); - } else if (GNEAttributeCarrier::isString(myAttr) && myTextFieldStrings != 0) { + } else if (GNEAttributeCarrier::isString(myTag, myAttr) && myTextFieldStrings != 0) { myTextFieldStrings->setTextColor(FXRGB(0, 0, 0)); myTextFieldStrings->killFocus(); } } else { // IF value of TextField isn't valid, change color to Red depending of type - if (GNEAttributeCarrier::isFloat(myAttr) && myTextFieldStrings != 0) { + if ((GNEAttributeCarrier::isFloat(myTag, myAttr) || GNEAttributeCarrier::isTime(myTag, myAttr)) && myTextFieldStrings != 0) { myTextFieldReal->setTextColor(FXRGB(255, 0, 0)); - } else if (GNEAttributeCarrier::isInt(myAttr) && myTextFieldStrings != 0) { + } else if (GNEAttributeCarrier::isInt(myTag, myAttr) && myTextFieldStrings != 0) { myTextFieldInt->setTextColor(FXRGB(255, 0, 0)); - } else if (GNEAttributeCarrier::isString(myAttr) && myTextFieldStrings != 0) { + } else if (GNEAttributeCarrier::isString(myTag, myAttr) && myTextFieldStrings != 0) { myTextFieldStrings->setTextColor(FXRGB(255, 0, 0)); } - } - // Update view net - myInspectorFrameParent->getViewNet()->update(); - return 1; -} - - -void -GNEInspectorFrame::AttrInput::show() { - FXMatrix::show(); -} - -void -GNEInspectorFrame::AttrInput::hide() { - FXMatrix::hide(); -} - -// =========================================================================== -// AttrEditor method definitions -// =========================================================================== - -GNEInspectorFrame::AttrEditor::AttrEditor(AttrInput* attrInputParent, FXTextField* textFieldAttr) : - FXDialogBox(attrInputParent->getApp(), ("Editing attribute '" + toString(attrInputParent->getAttr()) + "'").c_str(), DECOR_CLOSE | DECOR_TITLE), - myAttrInputParent(attrInputParent), - myTextFieldAttr(textFieldAttr) { - // Create matrix - myCheckBoxMatrix = new FXMatrix(this, 2, MATRIX_BY_COLUMNS); - - // Obtain vector with the choices - const std::vector& choices = GNEAttributeCarrier::discreteChoices(myAttrInputParent->getTag(), myAttrInputParent->getAttr()); - - // Get old value - const std::string oldValue = myTextFieldAttr->getText().text(); - - // Resize myVectorOfCheckBox - myVectorOfCheckBox.resize(choices.size(), NULL); - - // Iterate over choices - for (int i = 0; i < (int)choices.size(); i++) { - // Create checkBox - myVectorOfCheckBox.at(i) = new FXCheckButton(myCheckBoxMatrix, choices.at(i).c_str()); - // Set initial value - if (oldValue.find(choices.at(i)) != std::string::npos) { - myVectorOfCheckBox.at(i)->setCheck(true); - } - } - - // Add separator - new FXHorizontalSeparator(this, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4); - - // Create frame for buttons - frameButtons = new FXHorizontalFrame(this, LAYOUT_FILL_X); - - // Create accept button - myAcceptButton = new FXButton(frameButtons, "Accept", 0, this, FXDialogBox::ID_ACCEPT, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED); - - // Create cancel button - myCancelButton = new FXButton(frameButtons, "Cancel", 0, this, FXDialogBox::ID_CANCEL, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED); - - // Create reset button - myResetButton = new FXButton(frameButtons, "Reset", 0, this, MID_GNE_MODE_INSPECT_RESET, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED); - - // Execute dialog to make it modal, and if user press button "accept", save attribute - if (execute()) { - std::vector attrSolution; - // Iterate over myVectorOfCheckBox - for (int i = 0; i < (int)myVectorOfCheckBox.size(); i++) { - // If checkBox is cheked, save attribute - if (myVectorOfCheckBox.at(i)->getCheck()) { - attrSolution.push_back(std::string(myVectorOfCheckBox.at(i)->getText().text())); - } + // Write Warning in console if we're in testing mode + if (myInspectorFrameParent->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Value '" + newVal + "' for attribute " + toString(myAttr) + " of " + toString(myTag) + " isn't valid"); } - // join to string - myTextFieldAttr->setText(joinToString(attrSolution, " ").c_str()); - // Set attribute - myAttrInputParent->onCmdSetAttribute(0, 0, 0); - } -} - - -GNEInspectorFrame::AttrEditor::~AttrEditor() {} - -long -GNEInspectorFrame::AttrEditor::onCmdReset(FXObject*, FXSelector, void*) { - // Obtain vector with the choices - const std::vector& choices = GNEAttributeCarrier::discreteChoices(myAttrInputParent->getTag(), myAttrInputParent->getAttr()); - // Get old value - const std::string oldValue = myTextFieldAttr->getText().text(); - // Reset values - for (int i = 0; i < (int)choices.size(); i++) { - if (oldValue.find(choices.at(i)) != std::string::npos) { - myVectorOfCheckBox.at(i)->setCheck(true); - } else { - myVectorOfCheckBox.at(i)->setCheck(false); - } - } - return 1; -} - - - -GNEInspectorFrame::AttrConnection::AttrConnection(FXComposite* parent, GNEInspectorFrame* inspectorFrameParent) : - FXHorizontalFrame(parent, LAYOUT_FILL_X), - myInspectorFrameParent(inspectorFrameParent), - myConnection(NULL) { - // Create label for connection - myConnectionInfoLabel = new FXLabel(this, "", NULL, FRAME_THICK | LAYOUT_FILL_X); - // Create checkButton for show connection - myShowConnection = new FXCheckButton(this, "Show", this, MID_GNE_SHOW_CONNECTION); - // Create FXButton for inspectConnection - myInspectConnection = new FXButton(this, "inspect", 0, this, MID_GNE_INSPECT_CONNECTION, ICON_BEFORE_TEXT | LAYOUT_FILL_COLUMN | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED); -} - - -GNEInspectorFrame::AttrConnection::~AttrConnection() {} - - -void -GNEInspectorFrame::AttrConnection::showConnections(GNEConnection* connection) { - // Set pointer to current connection - myConnection = connection; - // set Label - const NBEdge::Connection& con = myConnection->getNBEdgeConnection(); - myConnectionInfoLabel->setText(std::string( - myConnection->getEdgeFrom()->getNBEdge()->getLaneID(con.toLane) + - "->" + con.toEdge->getLaneID(con.toLane)).c_str()); - // Show Label - myConnectionInfoLabel->show(); - // set show Connection - myShowConnection->setCheck(myConnection->getDrawConnection()); - // show Show Connection - myShowConnection->show(); - // Show AttrConnection - show(); -} - - -void -GNEInspectorFrame::AttrConnection::hideAttrConnection() { - // hide all elements - myConnectionInfoLabel->hide(); - myShowConnection->hide(); - hide(); -} - - -long -GNEInspectorFrame::AttrConnection::onCmdSetShowConnection(FXObject*, FXSelector, void*) { - if (myShowConnection->getCheck()) { - myConnection->setDrawConnection(true); - } else { - myConnection->setDrawConnection(false); } // Update view net myInspectorFrameParent->getViewNet()->update(); @@ -767,28 +978,15 @@ } -long -GNEInspectorFrame::AttrConnection::onCmdInspectConnection(FXObject*, FXSelector, void*) { - // Inspect connection depending of the checkBox "selectEdges" - if (myInspectorFrameParent->getViewNet()->selectEdges()) { - myInspectorFrameParent->inspect(myConnection, myConnection->getEdgeFrom()); - } else { - myInspectorFrameParent->inspect(myConnection, myConnection->getLaneFrom()); - } - return 1; -} - - void -GNEInspectorFrame::AttrConnection::show() { +GNEInspectorFrame::AttributeInput::show() { FXHorizontalFrame::show(); } void -GNEInspectorFrame::AttrConnection::hide() { +GNEInspectorFrame::AttributeInput::hide() { FXHorizontalFrame::hide(); } - /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEInspectorFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEInspectorFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEInspectorFrame.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEInspectorFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEInspectorFrame.h /// @author Jakob Erdmann /// @date Mar 2011 -/// @version $Id: GNEInspectorFrame.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEInspectorFrame.h 24015 2017-04-22 14:12:17Z palcraft $ /// // The Widget for modifying network-element attributes (i.e. lane speed) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,11 +35,9 @@ // =========================================================================== // class declarations // =========================================================================== -class GNENet; -class GNEEdge; class GNEAttributeCarrier; class GNEAdditional; -class GNEConnection; +class GNEEdge; // =========================================================================== // class definitions @@ -55,18 +53,18 @@ public: // =========================================================================== - // class AttrInput + // class AttributeInput // =========================================================================== - class AttrInput : public FXMatrix { + class AttributeInput : public FXHorizontalFrame { /// @brief FOX-declaration - FXDECLARE(GNEInspectorFrame::AttrInput) + FXDECLARE(GNEInspectorFrame::AttributeInput) public: /// @brief constructor - AttrInput(FXComposite* parent, GNEInspectorFrame* inspectorFrameParent); + AttributeInput(FXComposite* parent, GNEInspectorFrame* inspectorFrameParent); - /// @brief show attribute + /// @brief show attribute of ac void showAttribute(SumoXMLTag tag, SumoXMLAttr attr, const std::string& value); /// @brief show attribute @@ -82,11 +80,11 @@ long onCmdSetAttribute(FXObject*, FXSelector, void*); /// @brief open model dialog for more comfortable attribute editing - long onCmdOpenAttributeEditor(FXObject*, FXSelector, void*); + long onCmdOpenAllowDisallowEditor(FXObject*, FXSelector, void*); protected: /// @brief FOX needs this - AttrInput() {} + AttributeInput() {} private: /// @brief pointer to GNEInspectorFrame parent @@ -101,20 +99,20 @@ /// @brief pointer to label FXLabel* myLabel; - /// @brief textField to modify the value of int values + /// @brief textField to modify the value of int attributes FXTextField* myTextFieldInt; - /// @brief textField to modify the value of real values + /// @brief textField to modify the value of real/Time attributes FXTextField* myTextFieldReal; - /// @brief textField to modify the value of strings values + /// @brief textField to modify the value of string attributes FXTextField* myTextFieldStrings; /// @brief pointer to combo box choices FXComboBox* myChoicesCombo; - /// @brief pointer to checkBox - FXCheckButton* myCheckBox; + /// @brief pointer to menu check + FXCheckButton* myBoolCheckButton; /// @brief pointer to buttonCombinableChoices FXButton* myButtonCombinableChoices; @@ -126,129 +124,30 @@ void hide(); }; - // =========================================================================== - // class AttrEditor - // =========================================================================== - - class AttrEditor : public FXDialogBox { - /// @brief FOX-declaration - FXDECLARE(GNEInspectorFrame::AttrEditor) - - public: - /// @brief constructor - AttrEditor(AttrInput* attrInputParent, FXTextField* textFieldAttr); - - /// @brief destructor - ~AttrEditor(); - - /// @brief call when user press button reset - long onCmdReset(FXObject*, FXSelector, void*); - - protected: - /// @brief FOX needs this - AttrEditor() {} - - private: - /// @brief Pointer to AttrInput parent - AttrInput* myAttrInputParent; - - // @brief Pointer to TexField in which write attribute - FXTextField* myTextFieldAttr; - - // @brief Matrix in that CheckBoxs will be inserted - FXMatrix* myCheckBoxMatrix; - - /// @brief vector of CheckBoxs - std::vector myVectorOfCheckBox; - - /// @brief frame for the buttons - FXHorizontalFrame* frameButtons; - - /// @brief Button Accept - FXButton* myAcceptButton; - - /// @brief Button Cancel - FXButton* myCancelButton; - - /// @brief Button Reset - FXButton* myResetButton; - }; - - // =========================================================================== - // class AttrConnection - // =========================================================================== - - class AttrConnection : public FXHorizontalFrame { - /// @brief FOX-declaration - FXDECLARE(GNEInspectorFrame::AttrConnection) - - public: - /// @brief constructor - AttrConnection(FXComposite* parent, GNEInspectorFrame* inspectorFrameParent); - - /// @brief destructor - ~AttrConnection(); - - /// @brief show attribute - void showConnections(GNEConnection* connection); - - /// @brief show attribute - void hideAttrConnection(); - - /// @brief set show connection attribute - long onCmdSetShowConnection(FXObject*, FXSelector, void*); - - /// @brief inspect connection - long onCmdInspectConnection(FXObject*, FXSelector, void*); - - protected: - /// @brief FOX needs this - AttrConnection() {} - - private: - /// @brief pointer to inspectorFrame Parent - GNEInspectorFrame* myInspectorFrameParent; - - /// @brief pointer to current connection - GNEConnection* myConnection; - - /// @brief Label for show information of connection - FXLabel* myConnectionInfoLabel; - - /// @brief FXCheckBox to hide/show connection individually - FXCheckButton* myShowConnection; - - /// @brief FXCheckBox to hide/show connection individually - FXButton* myInspectConnection; - - /// @brief set show as private function - void show(); - - /// @brief set hide as private function - void hide(); - }; - public: /**@brief Constructor - * @brief parent FXFrame in which this GNEFrame is placed + * @brief parent FXHorizontalFrame in which this GNEFrame is placed * @brief viewNet viewNet that uses this GNEFrame */ - GNEInspectorFrame(FXComposite* parent, GNEViewNet* viewNet); + GNEInspectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet); /// @brief Destructor ~GNEInspectorFrame(); - /// @brief show Frame + /// @brief show inspector frame void show(); - /// @brief hide Frame - void hide(); - /// @brief Inspect a single element - void inspect(GNEAttributeCarrier* AC, GNEAttributeCarrier* previousElement = NULL); + void inspectElement(GNEAttributeCarrier* AC); /// @brief Inspect the given multi-selection - void inspect(const std::vector& ACs, GNEAttributeCarrier* previousElement = NULL); + void inspectMultisection(const std::vector& ACs); + + /// @brief inspect child of already inspected element + void inspectChild(GNEAttributeCarrier* AC, GNEAttributeCarrier* previousElement); + + /// @brief inspect called from DeleteFrame + void inspectFromDeleteFrame(GNEAttributeCarrier* AC, GNEAttributeCarrier* previousElement, bool previousElementWasMarked); /// @brief get current list of ACs const std::vector& getACs() const; @@ -259,6 +158,8 @@ /// @brief seh the template edge (we assume shared responsibility via reference counting) void setEdgeTemplate(GNEEdge* tpl); + /// @name FOX-callbacks + /// @{ /// @brief copy edge attributes from edge template long onCmdCopyTemplate(FXObject*, FXSelector, void*); @@ -274,16 +175,35 @@ /// @brief called when user toogle the go back button long onCmdGoBack(FXObject*, FXSelector, void*); + /// @brief called when user press right click over an item of list of childs + long onCmdShowChildMenu(FXObject*, FXSelector, void* data); + + /// @brief called when user select option "center item" of child Menu + long onCmdCenterItem(FXObject*, FXSelector, void*); + + /// @brief called when user select option "inspect item" of child menu + long onCmdInspectItem(FXObject*, FXSelector, void*); + + /// @brief called when user select option "delte item" of child menu + long onCmdDeleteItem(FXObject*, FXSelector, void*); + /// @} + protected: /// @brief FOX needs this GNEInspectorFrame() {} + // @brief create pop-up menu in the positions X-Y for the attribute carrier ac + void createPopUpMenu(int X, int Y, GNEAttributeCarrier* ac); + + /// @brief show child of current attributeCarrier + void showAttributeCarrierChilds(); + private: /// @brief groupBox for attributes FXGroupBox* myGroupBoxForAttributes; /// @brief list of Attribute inputs - std::vector vectorOfAttrInput; + std::vector myVectorOfAttributeInputs; /// @brief back Button FXButton* myBackButton; @@ -303,23 +223,41 @@ /// @brief GropuBox for editor attributes FXGroupBox* myGroupBoxForEditor; - /// @brief pointer to check button block + /// @brief Label for Check blocked + FXLabel* myCheckBlockedLabel; + + /// @brief pointer to menu check block FXCheckButton* myCheckBlocked; /// @brief pointer to additional element GNEAdditional* myAdditional; - /// @brief pointer to previous element (If exist) - GNEAttributeCarrier* myPreviousElement; + /// @brief pointer to previous element called by Inspector Frame + GNEAttributeCarrier* myPreviousElementInspect; - /// @brief groupBox for AttrConnection - FXGroupBox* myGroupBoxForAttrConnections; + /// @brief pointer to previous element called by Delete Frame + GNEAttributeCarrier* myPreviousElementDelete; - /// @brief vector of attrConnections - std::vector myAttrConnections; + /// @brief flag to ckec if myPreviousElementDelete was marked in Delete Frame + bool myPreviousElementDeleteWasMarked; /// @brief the multi-selection currently being inspected std::vector myACs; + + /// @brief groupBox for AttrConnection + FXGroupBox* myGroupBoxForTreeList; + + /// @brief tree list to show the childs of the element to erase + FXTreeList* myTreelist; + + /// @brief map used to save the Tree items with their AC + std::map myTreeItemToACMap; + + /// @brief set used to save tree items without AC assigned (for example, Incoming/Outcoming connections) + std::set myTreeItemsWithoutAC; + + /// @brief pointer to current right clicked Attribute Carrier + GNEAttributeCarrier* myRightClickedAC; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEInternalLane.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEInternalLane.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEInternalLane.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEInternalLane.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEInternalLane.cpp /// @author Jakob Erdmann /// @date June 2011 -/// @version $Id: GNEInternalLane.cpp 21640 2016-10-09 20:28:52Z palcraft $ +/// @version $Id: GNEInternalLane.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A class for visualizing Inner Lanes (used when editing traffic lights) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -54,10 +54,6 @@ #include "GNEInternalLane.h" #include "GNETLSEditorFrame.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping @@ -111,7 +107,7 @@ const Position& f = myShape[i]; const Position& s = myShape[i + 1]; myShapeLengths.push_back(f.distanceTo2D(s)); - myShapeRotations.push_back((SUMOReal) atan2((s.x() - f.x()), (f.y() - s.y())) * (SUMOReal) 180.0 / (SUMOReal) PI); + myShapeRotations.push_back((double) atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double) PI); } } } @@ -226,7 +222,7 @@ // special case (default gui does not distinguish between yellow major/minor return RGBColor(179, 179, 0, 255); } else { - return getLinkColor((LinkState)state); + return GUIVisualizationSettings::getLinkColor((LinkState)state); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEInternalLane.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEInternalLane.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEInternalLane.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEInternalLane.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEInternalLane.h /// @author Jakob Erdmann /// @date June 2011 -/// @version $Id: GNEInternalLane.h 21640 2016-10-09 20:28:52Z palcraft $ +/// @version $Id: GNEInternalLane.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A class for visualizing Inner Lanes (used when editing traffic lights) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -128,10 +128,10 @@ /// @name computed only once (for performance) in updateGeometry() /// @{ /// The rotations of the shape parts - std::vector myShapeRotations; + std::vector myShapeRotations; /// The lengths of the shape parts - std::vector myShapeLengths; + std::vector myShapeLengths; /// @} /// @brief the state of the link (used for visualization) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEJunction.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEJunction.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEJunction.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEJunction.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,13 +2,13 @@ /// @file GNEJunction.cpp /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNEJunction.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEJunction.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A class for visualizing and editing junctions in netedit (adapted from // GUIJunctionWrapper) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -59,15 +59,11 @@ #include "GNEConnection.h" #include "GNEJunction.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== GNEJunction::GNEJunction(NBNode& nbn, GNENet* net, bool loaded) : - GNENetElement(net, nbn.getID(), GLO_JUNCTION, SUMO_TAG_JUNCTION), + GNENetElement(net, nbn.getID(), GLO_JUNCTION, SUMO_TAG_JUNCTION, ICON_JUNCTION), myNBNode(nbn), myOrigPos(nbn.getPosition()), myAmCreateEdgeSource(false), @@ -76,7 +72,6 @@ myHasValidLogic(loaded), myAmTLSSelected(false) { updateGeometry(); - rebuildCrossings(false); } @@ -84,12 +79,14 @@ if (myAmResponsible) { delete &myNBNode; } - rebuildCrossings(true); + dropGNECrossings(); } void GNEJunction::updateGeometry() { + //myNet->getNetBuilder()->computeSingleNode(&myNBNode, OptionsCont::getOptions()); + const double EXTENT = 2; myBoundary = Boundary( myOrigPos.x() - EXTENT, myOrigPos.y() - EXTENT, @@ -98,23 +95,22 @@ myBoundary.add(myNBNode.getShape().getBoxBoundary()); } myMaxSize = MAX2(myBoundary.getWidth(), myBoundary.getHeight()); + rebuildGNECrossings(); } void -GNEJunction::rebuildCrossings(bool deleteOnly) { - for (std::vector::const_iterator it = myCrossings.begin(); it != myCrossings.end(); it++) { - (*it)->decRef(); - if ((*it)->unreferenced()) { - delete *it; - } - } - myCrossings.clear(); - if (!deleteOnly) { +GNEJunction::rebuildGNECrossings() { + // drop existent GNECrossings + dropGNECrossings(); + // rebuild GNECrossings only if create crossings and walkingAreas in net is enabled + if (myNet->getNetBuilder()->haveNetworkCrossings() == true) { + // build new NBNode::Crossings and walking areas and create GNECrossings + myNBNode.buildCrossingsAndWalkingAreas(); const std::vector& crossings = myNBNode.getCrossings(); for (std::vector::const_iterator it = crossings.begin(); it != crossings.end(); it++) { - myCrossings.push_back(new GNECrossing(*this, (*it).id)); - myCrossings.back()->incRef(); + myGNECrossings.push_back(new GNECrossing(this, (*it).id)); + myGNECrossings.back()->incRef(); } } } @@ -169,7 +165,7 @@ void GNEJunction::drawGL(const GUIVisualizationSettings& s) const { glPushName(getGlID()); - SUMOReal exaggeration = gSelected.isSelected(getType(), getGlID()) ? s.selectionScale : 1; + double exaggeration = gSelected.isSelected(getType(), getGlID()) ? s.selectionScale : 1; exaggeration *= s.junctionSize.getExaggeration(s); if (s.scale * exaggeration * myMaxSize < 1.) { // draw something simple so that selection still works @@ -199,6 +195,20 @@ } glPopMatrix(); } + // Check if a buuble must be drawed over junction + if (myNet->getViewNet()->showJunctionAsBubbles()) { + setColor(s, true); + // recognize full transparency and simply don't draw + GLfloat color[4]; + glGetFloatv(GL_CURRENT_COLOR, color); + if (color[3] != 0) { + glPushMatrix(); + Position pos = myNBNode.getPosition(); + glTranslated(pos.x(), pos.y(), getType() + 0.05); + GLHelper::drawFilledCircle(4 * exaggeration, 32); + glPopMatrix(); + } + } } if (drawBubble) { setColor(s, true); @@ -219,14 +229,14 @@ Position pos = myNBNode.getPosition(); glTranslated(pos.x(), pos.y(), getType() + 0.1); glColor3d(1, 1, 1); - const SUMOReal halfWidth = 32 / s.scale; - const SUMOReal halfHeight = 64 / s.scale; - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_TLS), -halfWidth, -halfHeight, halfWidth, halfHeight); + const double halfWidth = 32 / s.scale; + const double halfHeight = 64 / s.scale; + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_TLS), -halfWidth, -halfHeight, halfWidth, halfHeight); glPopMatrix(); } // draw crossings if (s.editMode != GNE_MODE_TLS) { - for (std::vector::const_iterator it = myCrossings.begin(); it != myCrossings.end(); it++) { + for (std::vector::const_iterator it = myGNECrossings.begin(); it != myGNECrossings.end(); it++) { (*it)->drawGL(s); } } @@ -248,44 +258,105 @@ } -std::vector -GNEJunction::getGNEEdges() const { - std::vector edges; - // iterate over incoming edges - for (std::vector::const_iterator i = myNBNode.getIncomingEdges().begin(); i != myNBNode.getIncomingEdges().end(); i++) { - edges.push_back(myNet->retrieveEdge((*i)->getID())); +Position +GNEJunction::getPosition() const { + return myNBNode.getPosition(); +} + + +std::vector +GNEJunction::getJunctionNeighbours() const { + // use set to avoid duplicates junctions + std::set junctions; + for (std::vector::const_iterator i = myGNEIncomingEdges.begin(); i != myGNEIncomingEdges.end(); i++) { + junctions.insert((*i)->getGNEJunctionSource()); } - // iterate over outgoing edges - for (std::vector::const_iterator i = myNBNode.getOutgoingEdges().begin(); i != myNBNode.getOutgoingEdges().end(); i++) { - edges.push_back(myNet->retrieveEdge((*i)->getID())); + for (std::vector::const_iterator i = myGNEOutgoingEdges.begin(); i != myGNEOutgoingEdges.end(); i++) { + junctions.insert((*i)->getGNEJunctionDestiny()); } - return edges; + return std::vector(junctions.begin(), junctions.end()); } -std::vector -GNEJunction::getGNEIncomingEdges() const { - std::vector incomingEdges; - // iterate over incoming edges - for (std::vector::const_iterator i = myNBNode.getIncomingEdges().begin(); i != myNBNode.getIncomingEdges().end(); i++) { - incomingEdges.push_back(myNet->retrieveEdge((*i)->getID())); +void +GNEJunction::addIncomingGNEEdge(GNEEdge* edge) { + // Check if incoming edge was already inserted + std::vector::iterator i = std::find(myGNEIncomingEdges.begin(), myGNEIncomingEdges.end(), edge); + if (i != myGNEIncomingEdges.end()) { + throw InvalidArgument("Incoming " + toString(SUMO_TAG_EDGE) + " with ID '" + edge->getID() + "' was already inserted into " + toString(getTag()) + " with ID " + getID() + "'"); + } else { + // Add edge into containers + myGNEIncomingEdges.push_back(edge); + myGNEEdges.push_back(edge); } - return incomingEdges; } -std::vector -GNEJunction::getGNEOutgoingEdges() const { - std::vector outgoingEdges; - // iterate over outgoing edges - for (std::vector::const_iterator i = myNBNode.getOutgoingEdges().begin(); i != myNBNode.getOutgoingEdges().end(); i++) { - outgoingEdges.push_back(myNet->retrieveEdge((*i)->getID())); +void +GNEJunction::addOutgoingGNEEdge(GNEEdge* edge) { + // Check if outgoing edge was already inserted + std::vector::iterator i = std::find(myGNEOutgoingEdges.begin(), myGNEOutgoingEdges.end(), edge); + if (i != myGNEOutgoingEdges.end()) { + throw InvalidArgument("Outgoing " + toString(SUMO_TAG_EDGE) + " with ID '" + edge->getID() + "' was already inserted into " + toString(getTag()) + " with ID " + getID() + "'"); + } else { + // Add edge into containers + myGNEOutgoingEdges.push_back(edge); + myGNEEdges.push_back(edge); } - return outgoingEdges; } void +GNEJunction::removeIncomingGNEEdge(GNEEdge* edge) { + // Check if incoming edge was already inserted + std::vector::iterator i = std::find(myGNEIncomingEdges.begin(), myGNEIncomingEdges.end(), edge); + if (i == myGNEIncomingEdges.end()) { + throw InvalidArgument("Incoming " + toString(SUMO_TAG_EDGE) + " with ID '" + edge->getID() + "' doesn't found into " + toString(getTag()) + " with ID " + getID() + "'"); + } else { + // remove edge from containers + myGNEIncomingEdges.erase(i); + myGNEEdges.erase(std::find(myGNEEdges.begin(), myGNEEdges.end(), edge)); + } +} + + +void +GNEJunction::removeOutgoingGNEEdge(GNEEdge* edge) { + // Check if outgoing edge was already inserted + std::vector::iterator i = std::find(myGNEOutgoingEdges.begin(), myGNEOutgoingEdges.end(), edge); + if (i == myGNEOutgoingEdges.end()) { + throw InvalidArgument("Outgoing " + toString(SUMO_TAG_EDGE) + " with ID '" + edge->getID() + "' doesn't found into " + toString(getTag()) + " with ID " + getID() + "'"); + } else { + // remove edge from containers + myGNEOutgoingEdges.erase(i); + myGNEEdges.erase(std::find(myGNEEdges.begin(), myGNEEdges.end(), edge)); + } +} + + +const std::vector& +GNEJunction::getGNEEdges() const { + return myGNEEdges; +} + + +const std::vector& +GNEJunction::getGNEIncomingEdges() const { + return myGNEIncomingEdges; +} + + +const std::vector& +GNEJunction::getGNEOutgoingEdges() const { + return myGNEOutgoingEdges; +} + +const std::vector& +GNEJunction::getGNECrossings() const { + return myGNECrossings; +} + +void GNEJunction::markAsCreateEdgeSource() { myAmCreateEdgeSource = true; } @@ -304,6 +375,23 @@ void +GNEJunction::recomputeNeighborsJunctions() { + std::set neighborsJunctions; + // obtain all neighbors junctions + for (std::vector::const_iterator i = myGNEIncomingEdges.begin(); i != myGNEIncomingEdges.end(); i++) { + neighborsJunctions.insert((*i)->getGNEJunctionSource()); + } + for (std::vector::const_iterator i = myGNEOutgoingEdges.begin(); i != myGNEOutgoingEdges.end(); i++) { + neighborsJunctions.insert((*i)->getGNEJunctionDestiny()); + } + // recompute all neighbors junctions + //for(std::set::iterator i = neighborsJunctions.begin(); i != neighborsJunctions.end(); i++) { + // myNet->getNetBuilder()->computeSingleNode((*i)->getNBNode(), OptionsCont::getOptions()); + //} +} + + +void GNEJunction::move(Position pos) { const Position orig = myNBNode.getPosition(); setPosition(pos); @@ -312,6 +400,10 @@ GNEEdge* edge = myNet->retrieveEdge((*it)->getID()); edge->updateJunctionPosition(this, orig); } + // recompute neighbors junctions + recomputeNeighborsJunctions(); + // recompute junction + //myNet->getNetBuilder()->computeSingleNode(&myNBNode, OptionsCont::getOptions()); // Update shapes without include connections, because the aren't showed in Move mode updateShapesAndGeometries(); } @@ -321,14 +413,19 @@ GNEJunction::registerMove(GNEUndoList* undoList) { Position newPos = myNBNode.getPosition(); std::string newPosValue = getAttribute(SUMO_ATTR_POSITION); - // actually the geometry is already up to date - // set the restore point to the end of the last change-set - setPosition(myOrigPos); - // do not execute the command to avoid changing the edge geometry twice - undoList->add(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, newPosValue), false); - setPosition(newPos); - // Refresh element to avoid grabbing problems - myNet->refreshElement(this); + if (isValid(SUMO_ATTR_POSITION, newPosValue)) { + // actually the geometry is already up to date + // set the restore point to the end of the last change-set + setPosition(myOrigPos); + // do not execute the command to avoid changing the edge geometry twice + undoList->add(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, newPosValue), false); + setPosition(newPos); + // Refresh element to avoid grabbing problems + myNet->refreshElement(this); + } else { + // tried to set an invalid position, revert back to the previous one + move(myOrigPos); + } } @@ -337,56 +434,36 @@ // First declare three sets with all affected GNEJunctions, GNEEdges and GNEConnections std::set affectedJunctions; std::set affectedEdges; - // Fill sets - std::vector GNEEdges = getGNEEdges(); // @Improve efficiency - std::vector edgesNeighbor; // Iterate over GNEEdges - for (std::vector::const_iterator i = GNEEdges.begin(); i != GNEEdges.end(); i++) { + for (std::vector::const_iterator i = myGNEEdges.begin(); i != myGNEEdges.end(); i++) { // Add source and destiny junctions - affectedJunctions.insert((*i)->getGNEJunctionSource()); // @Improve efficiency - affectedJunctions.insert((*i)->getGNEJunctionDest()); // @Improve efficiency + affectedJunctions.insert((*i)->getGNEJunctionSource()); + affectedJunctions.insert((*i)->getGNEJunctionDestiny()); // Obtain neighbors of Junction source - edgesNeighbor = (*i)->getGNEJunctionSource()->getGNEEdges(); // @Improve efficiency - for (std::vector::const_iterator j = edgesNeighbor.begin(); j != edgesNeighbor.end(); j++) { + for (std::vector::const_iterator j = (*i)->getGNEJunctionSource()->getGNEEdges().begin(); j != (*i)->getGNEJunctionSource()->getGNEEdges().end(); j++) { affectedEdges.insert(*j); } // Obtain neighbors of Junction destiny - edgesNeighbor = (*i)->getGNEJunctionDest()->getGNEEdges(); // @Improve efficiency - for (std::vector::const_iterator j = edgesNeighbor.begin(); j != edgesNeighbor.end(); j++) { + for (std::vector::const_iterator j = (*i)->getGNEJunctionDestiny()->getGNEEdges().begin(); j != (*i)->getGNEJunctionDestiny()->getGNEEdges().end(); j++) { affectedEdges.insert(*j); } } // Iterate over affected Junctions for (std::set::iterator i = affectedJunctions.begin(); i != affectedJunctions.end(); i++) { - // Check that Node doesn't have a custom shape - if ((*i)->getNBNode()->hasCustomShape() == false) { - // Set new shape depending of the representation - if (myNet->getViewNet()->showJunctionAsBubbles() == true) { - // Only save Position to draw bubble - (*i)->getNBNode()->myPoly.clear(); - (*i)->getNBNode()->myPoly.push_back((*i)->getNBNode()->getPosition()); - } else { - // Compute polygon - (*i)->getNBNode()->computeNodeShape(-1); - } - // Update geometry of Junction - (*i)->updateGeometry(); - } + // Update geometry of Junction + (*i)->updateGeometry(); } // Iterate over affected Edges for (std::set::iterator i = affectedEdges.begin(); i != affectedEdges.end(); i++) { - if (myNet->getViewNet()->showJunctionAsBubbles() == true) { - // Only compute lane shapes - (*i)->getNBEdge()->computeLaneShapes(); - } else { - // Compute full edge shape because this funcion is related to computeNodeShape - (*i)->getNBEdge()->computeEdgeShape(); - } // Update edge geometry (*i)->updateGeometry(); } + // Finally update geometry of this edge + updateGeometry(); // Update view to show the new shapes - myNet->getViewNet()->update(); + if (myNet->getViewNet()) { + myNet->getViewNet()->update(); + } } @@ -428,7 +505,7 @@ undoList->add(new GNEChange_Attribute(this, GNE_ATTR_MODIFICATION_STATUS, status), true); invalidateTLS(undoList); } else { - rebuildCrossings(false); + rebuildGNECrossings(); } } @@ -497,6 +574,19 @@ } +void +GNEJunction::dropGNECrossings() { + // delete all GNECrossing + for (std::vector::const_iterator it = myGNECrossings.begin(); it != myGNECrossings.end(); it++) { + (*it)->decRef(); + if ((*it)->unreferenced()) { + delete *it; + } + } + myGNECrossings.clear(); +} + + std::string GNEJunction::getAttribute(SumoXMLAttr key) const { switch (key) { @@ -524,7 +614,7 @@ case SUMO_ATTR_KEEP_CLEAR: return myNBNode.getKeepClear() ? "true" : "false"; default: - throw InvalidArgument("junction attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -545,8 +635,18 @@ undoList->add(new GNEChange_Attribute(this, key, value), true); break; case SUMO_ATTR_TYPE: { - undoList->p_begin("change junction type"); + undoList->p_begin("change " + toString(getTag()) + " type"); if (NBNode::isTrafficLight(SUMOXMLDefinitions::NodeTypes.get(value))) { + if (getNBNode()->isTLControlled() && + // if switching changing from or to traffic_light_right_on_red we need to remove the old plan + (getNBNode()->getType() == NODETYPE_TRAFFIC_LIGHT_RIGHT_ON_RED + || SUMOXMLDefinitions::NodeTypes.get(value) == NODETYPE_TRAFFIC_LIGHT_RIGHT_ON_RED) + ) { + const std::set tls = myNBNode.getControllingTLS(); + for (std::set::iterator it = tls.begin(); it != tls.end(); it++) { + undoList->add(new GNEChange_TLS(this, *it, false), true); + } + } if (!getNBNode()->isTLControlled()) { // create new traffic light undoList->add(new GNEChange_TLS(this, 0, true), true); @@ -565,7 +665,7 @@ break; } case SUMO_ATTR_TLID: { - undoList->p_begin("change tls id"); + undoList->p_begin("change " + toString(SUMO_TAG_TRAFFIC_LIGHT) + " id"); // junction is already controlled, remove from previous tls const std::set tls = myNBNode.getControllingTLS(); for (std::set::iterator it = tls.begin(); it != tls.end(); it++) { @@ -603,7 +703,7 @@ break; } default: - throw InvalidArgument("junction attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -623,13 +723,12 @@ break; case SUMO_ATTR_SHAPE: { bool ok = true; - PositionVector shape = GeomConvHelper::parseShapeReporting( - value, "user-supplied position", 0, ok, true); + PositionVector shape = GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, true); return ok; break; } case SUMO_ATTR_RADIUS: - return canParse(value); + return canParse(value); break; case SUMO_ATTR_TLTYPE: return myNBNode.isTLControlled() && SUMOXMLDefinitions::TrafficLightTypes.hasString(value); @@ -639,7 +738,7 @@ return value == "true" || value == "false"; break; default: - throw InvalidArgument("junction attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -667,6 +766,10 @@ bool ok; myOrigPos = GeomConvHelper::parseShapeReporting(value, "netedit-given", 0, ok, false)[0]; move(myOrigPos); + // recompute neighbors junctions + recomputeNeighborsJunctions(); + // recompute junction + //myNet->getNetBuilder()->computeSingleNode(&myNBNode, OptionsCont::getOptions()); // Refresh element to avoid grabbing problems myNet->refreshElement(this); break; @@ -674,8 +777,8 @@ if (myLogicStatus == GUESSED && value != GUESSED) { // clear guessed connections. previous connections will be restored myNBNode.invalidateIncomingConnections(); - std::vector incomingEdges = getGNEIncomingEdges(); - for (std::vector::iterator i = incomingEdges.begin(); i != incomingEdges.end(); i++) { + // Clear GNEConnections of incoming edges + for (std::vector::iterator i = myGNEIncomingEdges.begin(); i != myGNEIncomingEdges.end(); i++) { (*i)->clearGNEConnections(); } } @@ -688,7 +791,7 @@ break; } case SUMO_ATTR_RADIUS: - myNBNode.setRadius(parse(value)); + myNBNode.setRadius(parse(value)); break; case SUMO_ATTR_TLTYPE: { const std::set tls = myNBNode.getControllingTLS(); @@ -701,7 +804,7 @@ myNBNode.setKeepClear(value == "true"); break; default: - throw InvalidArgument("junction attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -718,7 +821,7 @@ } -SUMOReal +double GNEJunction::getColorValue(const GUIVisualizationSettings& s, bool bubble) const { switch (s.junctionColorer.getActive()) { case 0: @@ -799,18 +902,4 @@ myNBNode.removeTrafficLight(tlDef); } -void -GNEJunction::updateCrossingAttributes(NBNode::Crossing crossing) { - EdgeSet edgeSet(crossing.edges.begin(), crossing.edges.end()); - for (std::vector::iterator it = myNBNode.myCrossings.begin(); it != myNBNode.myCrossings.end(); ++it) { - EdgeSet edgeSet2((*it).edges.begin(), (*it).edges.end()); - if (edgeSet == edgeSet2) { - (*it).width = crossing.width; - (*it).priority = crossing.priority; - myNet->refreshElement(this); - break; - } - } -} - /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEJunction.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEJunction.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEJunction.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEJunction.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,13 +2,13 @@ /// @file GNEJunction.h /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNEJunction.h 21788 2016-10-25 11:05:18Z namdre $ +/// @version $Id: GNEJunction.h 23890 2017-04-09 09:52:50Z palcraft $ /// // A class for visualizing and editing junctions in netedit (adapted from // GUIJunctionWrapper) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,6 +55,7 @@ /// @brief Declare friend class friend class GNEChange_TLS; + friend class GNEChange_Crossing; public: /**@brief Constructor @@ -107,14 +108,35 @@ /// @brief Return net build node NBNode* getNBNode() const; - /// @brief Return all GNEEdges vinculated with this Junction - std::vector getGNEEdges() const; + /// @brief Return current position + Position getPosition() const; - /// @brief Return incoming GNEEdges - std::vector getGNEIncomingEdges() const; + /// @brief return GNEJunction neighbours + std::vector getJunctionNeighbours() const; - /// @brief Return incoming GNEEdges - std::vector getGNEOutgoingEdges() const; + /// @brief add incoming GNEEdge + void addIncomingGNEEdge(GNEEdge* edge); + + /// @brief add outgoing GNEEdge + void addOutgoingGNEEdge(GNEEdge* edge); + + /// @brief remove incoming GNEEdge + void removeIncomingGNEEdge(GNEEdge* edge); + + /// @brief remove outgoing GNEEdge + void removeOutgoingGNEEdge(GNEEdge* edge); + + /// @brief Returns all GNEEdges vinculated with this Junction + const std::vector& getGNEEdges() const; + + /// @brief Returns incoming GNEEdges + const std::vector& getGNEIncomingEdges() const; + + /// @brief Returns incoming GNEEdges + const std::vector& getGNEOutgoingEdges() const; + + /// @brief Returns GNECrossings + const std::vector& getGNECrossings() const; /// @brief marks as first junction in createEdge-mode void markAsCreateEdgeSource(); @@ -125,9 +147,12 @@ /// @brief notify the junction of being selected in tls-mode. (used to control drawing) void selectTLS(bool selected); - /**@brief Update the boundary of the junction */ + /// @brief Update the boundary of the junction void updateGeometry(); + /// @brief recompute neighbors junctions + void recomputeNeighborsJunctions(); + /**@brief reposition the node at pos and informs the edges * @param[in] pos The new position * @note: those operations are not added to the undoList. This is handled in @@ -189,8 +214,7 @@ * @param[in] deletedConnection If a valid connection is given a replacement def with this connection removed * but all other information intact will be computed instead of guessing a new tlDef * @note: this should always be called with an active command group */ - void invalidateTLS(GNEUndoList* undoList, - const NBConnection& deletedConnection = NBConnection::InvalidConnection); + void invalidateTLS(GNEUndoList* undoList, const NBConnection& deletedConnection = NBConnection::InvalidConnection); /// @brief removes the given edge from all pedestrian crossings void removeFromCrossings(GNEEdge* edge, GNEUndoList* undoList); @@ -198,18 +222,27 @@ /// @brief whether this junction has a valid logic bool isLogicValid(); - /// @brief modify the specified crossing (using friend privileges) - void updateCrossingAttributes(NBNode::Crossing crossing); + /// @brief drop crossings + void dropGNECrossings(); private: /// @brief A reference to the represented junction NBNode& myNBNode; + /// @brief vector with the GNEEdges vinculated with this junction + std::vector myGNEEdges; + + /// @brief vector with the incomings GNEEdges vinculated with this junction + std::vector myGNEIncomingEdges; + + /// @brief vector with the outgoings GNEEdges vinculated with this junction + std::vector myGNEOutgoingEdges; + /// @brief restore point for undo Position myOrigPos; /// @brief The maximum size (in either x-, or y-dimension) for determining whether to draw or not - SUMOReal myMaxSize; + double myMaxSize; /// @brief The represented junction's boundary Boundary myBoundary; @@ -231,7 +264,7 @@ bool myAmTLSSelected; /// @brief the built crossing objects - std::vector myCrossings; + std::vector myGNECrossings; private: /// @brief Invalidated copy constructor. @@ -250,7 +283,7 @@ void setColor(const GUIVisualizationSettings& s, bool bubble) const; /// @brief determines color value - SUMOReal getColorValue(const GUIVisualizationSettings& s, bool bubble) const; + double getColorValue(const GUIVisualizationSettings& s, bool bubble) const; /// @brief adds a traffic light void addTrafficLight(NBTrafficLightDefinition* tlDef, bool forceInsert); @@ -259,7 +292,7 @@ void removeTrafficLight(NBTrafficLightDefinition* tlDef); /// @brief rebuilds crossing objects for this junction - void rebuildCrossings(bool deleteOnly); + void rebuildGNECrossings(); }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNELane.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNELane.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNELane.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNELane.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNELane.cpp /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNELane.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNELane.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A class for visualizing Lane geometry (adapted from GNELaneWrapper) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -61,10 +61,6 @@ #include "GNEViewParent.h" #include "GNEConnection.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping // =========================================================================== @@ -77,16 +73,15 @@ // =========================================================================== GNELane::GNELane(GNEEdge& edge, const int index) : - GNENetElement(edge.getNet(), edge.getNBEdge()->getLaneID(index), GLO_LANE, SUMO_TAG_LANE), + GNENetElement(edge.getNet(), edge.getNBEdge()->getLaneID(index), GLO_LANE, SUMO_TAG_LANE, ICON_LANE), myParentEdge(edge), myIndex(index), mySpecialColor(0), myTLSEditor(0) { - updateGeometry(); } GNELane::GNELane() : - GNENetElement(NULL, "dummyConstructorGNELane", GLO_LANE, SUMO_TAG_LANE), + GNENetElement(NULL, "dummyConstructorGNELane", GLO_LANE, SUMO_TAG_LANE, ICON_LOCATEEDGE), myParentEdge(*static_cast(0)), myIndex(-1), mySpecialColor(0), @@ -99,12 +94,49 @@ void -GNELane::drawLinkNo() const { +GNELane::drawLinkNo(const GUIVisualizationSettings& s) const { + const std::vector& cons = myParentEdge.getNBEdge()->getConnectionsFromLane(myIndex); + int noLinks = (int)cons.size(); + if (noLinks == 0) { + return; + } + // draw all links + glPushMatrix(); + glTranslated(0, 0, GLO_LANE + 0.1); + double w = myParentEdge.getNBEdge()->getLaneWidth(myIndex) / (double) noLinks; + double x1 = myParentEdge.getNBEdge()->getLaneWidth(myIndex) / 2; + const bool lefthand = OptionsCont::getOptions().getBool("lefthand"); + for (int i = noLinks; --i >= 0;) { + double x2 = x1 - (double)(w / 2.); + const int linkIndex = myParentEdge.getNBEdge()->getToNode()->getConnectionIndex(myParentEdge.getNBEdge(), + cons[lefthand ? noLinks - 1 - i : i]); + GLHelper::drawTextAtEnd(toString(linkIndex), getShape(), x2, s.drawLinkJunctionIndex.size, s.drawLinkJunctionIndex.color); + x1 -= w; + } + glPopMatrix(); } void -GNELane::drawTLSLinkNo() const { +GNELane::drawTLSLinkNo(const GUIVisualizationSettings& s) const { + const std::vector& cons = myParentEdge.getNBEdge()->getConnectionsFromLane(myIndex); + int noLinks = (int)cons.size(); + if (noLinks == 0) { + return; + } + // draw all links + glPushMatrix(); + glTranslated(0, 0, GLO_LANE + 0.1); + double w = myParentEdge.getNBEdge()->getLaneWidth(myIndex) / (double) noLinks; + double x1 = myParentEdge.getNBEdge()->getLaneWidth(myIndex) / 2; + const bool lefthand = OptionsCont::getOptions().getBool("lefthand"); + for (int i = noLinks; --i >= 0;) { + double x2 = x1 - (double)(w / 2.); + int linkNo = cons[lefthand ? noLinks - 1 - i : i].tlLinkNo; + GLHelper::drawTextAtEnd(toString(linkNo), getShape(), x2, s.drawLinkTLIndex.size, s.drawLinkTLIndex.color); + x1 -= w; + } + glPopMatrix(); } @@ -117,7 +149,7 @@ GNELane::drawArrows() const { const Position& end = getShape().back(); const Position& f = getShape()[-2]; - SUMOReal rot = (SUMOReal) atan2((end.x() - f.x()), (f.y() - end.y())) * (SUMOReal) 180.0 / (SUMOReal) PI; + double rot = (double) atan2((end.x() - f.x()), (f.y() - end.y())) * (double) 180.0 / (double) PI; glPushMatrix(); glPushName(0); glTranslated(0, 0, GLO_JUNCTION + .1); // must draw on top of junction shape @@ -134,39 +166,39 @@ switch (dir) { case LINKDIR_STRAIGHT: GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05); - GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25); break; case LINKDIR_LEFT: GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05); GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05); - GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (double) 1, (double) .25); break; case LINKDIR_RIGHT: GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05); GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05); - GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (double) 1, (double) .25); break; case LINKDIR_TURN: GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05); GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05); GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05); - GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (double) 1, (double) .25); break; case LINKDIR_TURN_LEFTHAND: GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05); GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05); GLHelper::drawBoxLine(Position(-0.5, 2.5), -180, 1, .05); - GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (double) 1, (double) .25); break; case LINKDIR_PARTLEFT: GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05); GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05); - GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (double) 1, (double) .25); break; case LINKDIR_PARTRIGHT: GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05); GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05); - GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (SUMOReal) 1, (SUMOReal) .25); + GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (double) 1, (double) .25); break; case LINKDIR_NODIR: GLHelper::drawBoxLine(Position(1, 5.8), 245, 2, .05); @@ -226,7 +258,7 @@ glVertex2d(startPos.x(), startPos.y()); glVertex2d(endPos.x(), endPos.y()); glEnd(); - GLHelper::drawTriangleAtEnd(startPos, endPos, (SUMOReal) 1.5, (SUMOReal) .2); + GLHelper::drawTriangleAtEnd(startPos, endPos, (double) 1.5, (double) .2); } glPopName(); glPopMatrix(); @@ -262,9 +294,9 @@ } } - // start drawing lane checikg whether it is not too small - const SUMOReal selectionScale = selected || selectedEdge ? s.selectionScale : 1; - SUMOReal exaggeration = selectionScale * s.laneWidthExaggeration; // * s.laneScaler.getScheme().getColor(getScaleValue(s.laneScaler.getActive())); + // start drawing lane checking whether it is not too small + const double selectionScale = selected || selectedEdge ? s.selectionScale : 1; + double exaggeration = selectionScale * s.laneWidthExaggeration; // * s.laneScaler.getScheme().getColor(getScaleValue(s.laneScaler.getActive())); // XXX apply usefull scale values //exaggeration *= s.laneScaler.getScheme().getColor(getScaleValue(s.laneScaler.getActive())); @@ -286,7 +318,7 @@ } else { if (drawAsRailway(s)) { // draw as railway - const SUMOReal halfRailWidth = 0.725 * exaggeration; + const double halfRailWidth = 0.725 * exaggeration; // Draw box depending of myShapeColors if (myShapeColors.size() > 0) { GLHelper::drawBoxLines(getShape(), myShapeRotations, myShapeLengths, myShapeColors, halfRailWidth); @@ -307,7 +339,7 @@ drawCrossties(0.3 * exaggeration, 1 * exaggeration, 1 * exaggeration); } else { // Draw as a normal lane, and reduce width to make sure that a selected edge can still be seen - const SUMOReal halfWidth = selectionScale * (myParentEdge.getNBEdge()->getLaneWidth(myIndex) / 2 - (selectedEdge ? .3 : 0)); + const double halfWidth = exaggeration * (myParentEdge.getNBEdge()->getLaneWidth(myIndex) / 2 - (selectedEdge ? .3 : 0)); if (myShapeColors.size() > 0) { GLHelper::drawBoxLines(getShape(), myShapeRotations, myShapeLengths, myShapeColors, halfWidth); } else { @@ -321,13 +353,19 @@ drawMarkings(selectedEdge, exaggeration); } // draw ROWs only if target junction has a valid logic) - if (myParentEdge.getGNEJunctionDest()->isLogicValid() && s.scale > 3) { + if (myParentEdge.getGNEJunctionDestiny()->isLogicValid() && s.scale > 3) { drawArrows(); } // Draw direction indicators if the correspondient option is enabled if (s.showLaneDirection) { drawDirectionIndicators(); } + if (s.drawLinkJunctionIndex.show) { + drawLinkNo(s); + } + if (s.drawLinkTLIndex.show) { + drawTLSLinkNo(s); + } // If there are texture of restricted lanes to draw, and draw lane icons is enabled in options if ((OptionsCont::getOptions().getBool("disable-laneIcons") == false) && myLaneRestrictedTexturePositions.size() > 0) { // Declare default width of icon (3) @@ -349,11 +387,11 @@ glRotated(90, 0, 0, 1); // draw texture box depending of type of restriction if (isRestricted(SVC_PEDESTRIAN)) { - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_LANEPEDESTRIAN), iconWidth); + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_LANEPEDESTRIAN), iconWidth); } else if (isRestricted(SVC_BICYCLE)) { - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_LANEBIKE), iconWidth); + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_LANEBIKE), iconWidth); } else if (isRestricted(SVC_BUS)) { - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_LANEBUS), iconWidth); + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_LANEBUS), iconWidth); } // Pop draw matrix 2 glPopMatrix(); @@ -366,21 +404,21 @@ void -GNELane::drawMarkings(const bool& selectedEdge, SUMOReal scale) const { +GNELane::drawMarkings(const bool& selectedEdge, double scale) const { glPushMatrix(); glTranslated(0, 0, GLO_EDGE); - const SUMOReal halfWidth = myParentEdge.getNBEdge()->getLaneWidth(myIndex) * 0.5; + const double halfWidth = myParentEdge.getNBEdge()->getLaneWidth(myIndex) * 0.5; // optionally draw inverse markings if (myIndex > 0 && (myParentEdge.getNBEdge()->getPermissions(myIndex - 1) & myParentEdge.getNBEdge()->getPermissions(myIndex)) != 0) { - SUMOReal mw = (halfWidth + SUMO_const_laneOffset + .01) * scale; + double mw = (halfWidth + SUMO_const_laneOffset + .01) * scale; int e = (int) getShape().size() - 1; for (int i = 0; i < e; ++i) { glPushMatrix(); glTranslated(getShape()[i].x(), getShape()[i].y(), 0.1); glRotated(myShapeRotations[i], 0, 0, 1); - for (SUMOReal t = 0; t < myShapeLengths[i]; t += 6) { - const SUMOReal length = MIN2((SUMOReal)3, myShapeLengths[i] - t); + for (double t = 0; t < myShapeLengths[i]; t += 6) { + const double length = MIN2((double)3, myShapeLengths[i] - t); glBegin(GL_QUADS); glVertex2d(-mw, -t); glVertex2d(-mw, -t - length); @@ -415,7 +453,7 @@ GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this); buildPopupHeader(ret, app); buildCenterPopupEntry(ret); - new FXMenuCommand(ret, "Copy edge name to clipboard", 0, ret, MID_COPY_EDGE_NAME); + new FXMenuCommand(ret, ("Copy " + toString(SUMO_TAG_EDGE) + " name to clipboard").c_str(), 0, ret, MID_COPY_EDGE_NAME); buildNameCopyPopupEntry(ret); buildSelectionPopupEntry(ret); buildPositionCopyEntry(ret, false); @@ -427,19 +465,19 @@ FXIcon* bikeIcon = GUIIconSubSys::getIcon(ICON_LANEBIKE); FXIcon* busIcon = GUIIconSubSys::getIcon(ICON_LANEBUS); // Create basic commands - new FXMenuCommand(ret, "Split edge here", 0, &parent, MID_GNE_SPLIT_EDGE); - new FXMenuCommand(ret, "Split edges in both direction here", 0, &parent, MID_GNE_SPLIT_EDGE_BIDI); - new FXMenuCommand(ret, "Reverse edge", 0, &parent, MID_GNE_REVERSE_EDGE); + new FXMenuCommand(ret, ("Split " + toString(SUMO_TAG_EDGE) + " here").c_str(), 0, &parent, MID_GNE_SPLIT_EDGE); + new FXMenuCommand(ret, ("Split " + toString(SUMO_TAG_EDGE) + "s in both direction here").c_str(), 0, &parent, MID_GNE_SPLIT_EDGE_BIDI); + new FXMenuCommand(ret, ("Reverse " + toString(SUMO_TAG_EDGE)).c_str(), 0, &parent, MID_GNE_REVERSE_EDGE); new FXMenuCommand(ret, "Add reverse direction", 0, &parent, MID_GNE_ADD_REVERSE_EDGE); new FXMenuCommand(ret, "Set geometry endpoint here", 0, &parent, MID_GNE_SET_EDGE_ENDPOINT); new FXMenuCommand(ret, "Restore geometry endpoint", 0, &parent, MID_GNE_RESET_EDGE_ENDPOINT); if (gSelected.isSelected(GLO_LANE, getGlID())) { - new FXMenuCommand(ret, "Straighten selected Edges", 0, &parent, MID_GNE_STRAIGHTEN); + new FXMenuCommand(ret, ("Straighten selected " + toString(SUMO_TAG_EDGE) + "s").c_str(), 0, &parent, MID_GNE_STRAIGHTEN); } else { - new FXMenuCommand(ret, "Straighten edge", 0, &parent, MID_GNE_STRAIGHTEN); + new FXMenuCommand(ret, ("Straighten " + toString(SUMO_TAG_EDGE)).c_str(), 0, &parent, MID_GNE_STRAIGHTEN); } if (gSelected.isSelected(GLO_LANE, getGlID())) { - new FXMenuCommand(ret, "Duplicate selected lanes", 0, &parent, MID_GNE_DUPLICATE_LANE); + new FXMenuCommand(ret, ("Duplicate selected" + toString(SUMO_TAG_LANE) + "s").c_str(), 0, &parent, MID_GNE_DUPLICATE_LANE); // Create panel for lane operations FXMenuPane* addSpecialLanes = new FXMenuPane(ret); ret->insertMenuPaneChild(addSpecialLanes); @@ -456,16 +494,16 @@ new FXMenuCommand(removeSpecialLanes, "Bikelanes", bikeIcon, &parent, MID_GNE_REMOVE_LANE_BIKE); new FXMenuCommand(removeSpecialLanes, "Buslanes", busIcon, &parent, MID_GNE_REMOVE_LANE_BUS); // Create menu comands for all trasform special lanes and disable it - new FXMenuCommand(transformSlanes, "Sidewalsk", pedestrianIcon, &parent, MID_GNE_TRANSFORM_LANE_SIDEWALK); + new FXMenuCommand(transformSlanes, "Sidewalks", pedestrianIcon, &parent, MID_GNE_TRANSFORM_LANE_SIDEWALK); new FXMenuCommand(transformSlanes, "Bikelanes", bikeIcon, &parent, MID_GNE_TRANSFORM_LANE_BIKE); new FXMenuCommand(transformSlanes, "Buslanes", busIcon, &parent, MID_GNE_TRANSFORM_LANE_BUS); new FXMenuCommand(transformSlanes, "revert transformations", 0, &parent, MID_GNE_REVERT_TRANSFORMATION); // add menuCascade for lane operations - new FXMenuCascade(ret, "add special lanes", 0, addSpecialLanes); - new FXMenuCascade(ret, "remove special lanes", 0, removeSpecialLanes); - new FXMenuCascade(ret, "transform to special lanes", 0, transformSlanes); + new FXMenuCascade(ret, ("add special" + toString(SUMO_TAG_LANE) + "s").c_str(), 0, addSpecialLanes); + new FXMenuCascade(ret, ("remove special" + toString(SUMO_TAG_LANE) + "s").c_str(), 0, removeSpecialLanes); + new FXMenuCascade(ret, ("transform to special" + toString(SUMO_TAG_LANE) + "s").c_str(), 0, transformSlanes); } else { - new FXMenuCommand(ret, "Duplicate lane", 0, &parent, MID_GNE_DUPLICATE_LANE); + new FXMenuCommand(ret, ("Duplicate" + toString(SUMO_TAG_LANE)).c_str(), 0, &parent, MID_GNE_DUPLICATE_LANE); // Declare flags bool edgeHasSidewalk = myParentEdge.hasRestrictedLane(SVC_PEDESTRIAN); bool edgeHasBikelane = myParentEdge.hasRestrictedLane(SVC_BICYCLE); @@ -494,9 +532,9 @@ FXMenuCommand* transformLaneToBuslane = new FXMenuCommand(transformSlanes, "Buslane", busIcon, &parent, MID_GNE_TRANSFORM_LANE_BUS); FXMenuCommand* revertTransformation = new FXMenuCommand(transformSlanes, "revert transformation", 0, &parent, MID_GNE_REVERT_TRANSFORMATION); // add menuCascade for lane operations - FXMenuCascade* cascadeAddSpecialLane = new FXMenuCascade(ret, "add special lane", 0, addSpecialLanes); - FXMenuCascade* cascadeRemoveSpecialLane = new FXMenuCascade(ret, "remove special lane", 0, removeSpecialLanes); - new FXMenuCascade(ret, "transform to special lane", 0, transformSlanes); + FXMenuCascade* cascadeAddSpecialLane = new FXMenuCascade(ret, ("add special" + toString(SUMO_TAG_LANE)).c_str(), 0, addSpecialLanes); + FXMenuCascade* cascadeRemoveSpecialLane = new FXMenuCascade(ret, ("remove special" + toString(SUMO_TAG_LANE)).c_str(), 0, removeSpecialLanes); + new FXMenuCascade(ret, ("transform to special" + toString(SUMO_TAG_LANE)).c_str(), 0, transformSlanes); // Enable and disable options depending of current transform of the lane if (edgeHasSidewalk) { transformLaneToSidewalk->disable(); @@ -545,10 +583,10 @@ } // buildShowParamsPopupEntry(ret, false); new FXMenuSeparator(ret); - const SUMOReal pos = getShape().nearest_offset_to_point2D(parent.getPositionInformation()); - const SUMOReal height = getShape().positionAtOffset2D(getShape().nearest_offset_to_point2D(parent.getPositionInformation())).z(); + const double pos = getShape().nearest_offset_to_point2D(parent.getPositionInformation()); + const double height = getShape().positionAtOffset2D(getShape().nearest_offset_to_point2D(parent.getPositionInformation())).z(); new FXMenuCommand(ret, ("Shape pos: " + toString(pos)).c_str(), 0, 0, 0); - new FXMenuCommand(ret, ("Length pos: " + toString(getPositionRelativeToShapeLenght(pos))).c_str(), 0, 0, 0); + new FXMenuCommand(ret, ("Length pos: " + toString(getPositionRelativeToShapeLength(pos))).c_str(), 0, 0, 0); new FXMenuCommand(ret, ("Height: " + toString(height)).c_str(), 0, 0, 0); // new FXMenuSeparator(ret); // buildPositionCopyEntry(ret, false); @@ -585,13 +623,13 @@ } -const std::vector& +const std::vector& GNELane::getShapeRotations() const { return myShapeRotations; } -const std::vector& +const std::vector& GNELane::getShapeLengths() const { return myShapeLengths; } @@ -610,7 +648,7 @@ myShapeLengths.clear(); myLaneRestrictedTexturePositions.clear(); myLaneRestrictedTextureRotations.clear(); - //SUMOReal length = myParentEdge.getLength(); // @todo see ticket #448 + //double length = myParentEdge.getLength(); // @todo see ticket #448 // may be different from length // Obtain lane and shape rotations @@ -622,17 +660,13 @@ const Position& f = getShape()[i]; const Position& s = getShape()[i + 1]; myShapeLengths.push_back(f.distanceTo2D(s)); - myShapeRotations.push_back((SUMOReal) atan2((s.x() - f.x()), (f.y() - s.y())) * (SUMOReal) 180.0 / (SUMOReal) PI); + myShapeRotations.push_back((double) atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double) PI); } } // Update geometry of additionals vinculated with this lane for (AdditionalVector::iterator i = myAdditionals.begin(); i != myAdditionals.end(); i++) { (*i)->updateGeometry(); } - // Update geometry of additionalSets vinculated to this lane - for (AdditionalSetVector::iterator i = myAdditionalSetParents.begin(); i != myAdditionalSetParents.end(); ++i) { - (*i)->updateGeometry(); - } // In Move mode, connections aren't updated if (myNet->getViewNet() && myNet->getViewNet()->getCurrentEditMode() != GNE_MODE_MOVE) { // Update incoming connections of this lane @@ -646,12 +680,12 @@ (*i)->updateGeometry(); } } - // If lane has enought lenght for show textures of restricted lanes - if ((getLaneShapeLenght() > 4)) { + // If lane has enought length for show textures of restricted lanes + if ((getLaneShapeLength() > 4)) { // if lane is restricted if (isRestricted(SVC_PEDESTRIAN) || isRestricted(SVC_BICYCLE) || isRestricted(SVC_BUS)) { // get values for position and rotation of icons - for (int i = 2; i < getLaneShapeLenght() - 1; i += 15) { + for (int i = 2; i < getLaneShapeLength() - 1; i += 15) { myLaneRestrictedTexturePositions.push_back(getShape().positionAtOffset(i)); myLaneRestrictedTextureRotations.push_back(getShape().rotationDegreeAtOffset(i)); } @@ -671,33 +705,33 @@ } -SUMOReal +double GNELane::getSpeed() const { return myParentEdge.getNBEdge()->getLaneSpeed(myIndex); } -SUMOReal -GNELane::getLaneParametricLenght() const { +double +GNELane::getLaneParametricLength() const { return myParentEdge.getNBEdge()->getLoadedLength(); } -SUMOReal -GNELane::getLaneShapeLenght() const { +double +GNELane::getLaneShapeLength() const { return getShape().length(); } -SUMOReal -GNELane::getPositionRelativeToParametricLenght(SUMOReal position) const { - return (position * getLaneShapeLenght()) / getLaneParametricLenght(); +double +GNELane::getPositionRelativeToParametricLength(double position) const { + return (position * getLaneShapeLength()) / getLaneParametricLength(); } -SUMOReal -GNELane::getPositionRelativeToShapeLenght(SUMOReal position) const { - return (position * getLaneParametricLenght()) / getLaneShapeLenght(); +double +GNELane::getPositionRelativeToShapeLength(double position) const { + return (position * getLaneParametricLength()) / getLaneShapeLength(); } @@ -706,7 +740,7 @@ // First check that additional wasn't already inserted for (AdditionalVector::iterator i = myAdditionals.begin(); i != myAdditionals.end(); i++) { if (*i == additional) { - throw ProcessError("additional element with ID='" + additional->getID() + "' was already inserted in lane with ID='" + getID() + "'"); + throw ProcessError(toString(getTag()) + " with ID='" + additional->getID() + "' was already inserted in lane with ID='" + getID() + "'"); } } myAdditionals.push_back(additional); @@ -723,7 +757,7 @@ } // If additional was found, remove it if (i == myAdditionals.end()) { - throw ProcessError("additional element with ID='" + additional->getID() + "' doesn't exist in lane with ID='" + getID() + "'"); + throw ProcessError(toString(getTag()) + " with ID='" + additional->getID() + "' doesn't exist in lane with ID='" + getID() + "'"); } else { myAdditionals.erase(i); } @@ -737,50 +771,8 @@ bool -GNELane::addAdditionalSet(GNEAdditionalSet* additionalSet) { - // Check if additionalSet already exists before insertion - for (AdditionalSetVector::iterator i = myAdditionalSetParents.begin(); i != myAdditionalSetParents.end(); i++) { - if ((*i) == additionalSet) { - return false; - } - } - // Insert it and retur true - myAdditionalSetParents.push_back(additionalSet); - return true; -} - - -bool -GNELane::removeAdditionalGeometrySet(GNEAdditionalSet* additionalSet) { - // search additionalSet and remove it - for (AdditionalSetVector::iterator i = myAdditionalSetParents.begin(); i != myAdditionalSetParents.end(); i++) { - if ((*i) == additionalSet) { - myAdditionalSetParents.erase(i); - return true; - } - } - // If additionalSet wasn't found, return false - return false; -} - - -const std::vector& -GNELane::getAdditionalSetParents() { - return myAdditionalSetParents; -} - - -bool GNELane::isRestricted(SUMOVehicleClass vclass) const { - if (vclass == SVC_PEDESTRIAN) { - return (myParentEdge.getNBEdge()->getPermissions(myIndex) == 1048576); - } else if (vclass == SVC_BICYCLE) { - return (myParentEdge.getNBEdge()->getPermissions(myIndex) == 524288); - } else if (vclass == SVC_BUS) { - return (myParentEdge.getNBEdge()->getPermissions(myIndex) == 256); - } else { - return false; - } + return myParentEdge.getNBEdge()->getPermissions(myIndex) == vclass; } @@ -799,13 +791,19 @@ // return all disallowed classes (may differ from the written attributes) return getVehicleClassNames(~(edge->getPermissions(myIndex))); case SUMO_ATTR_WIDTH: - return toString(edge->getLaneStruct(myIndex).width); + if (edge->getLaneStruct(myIndex).width == NBEdge::UNSPECIFIED_WIDTH) { + return "default"; + } else { + return toString(edge->getLaneStruct(myIndex).width); + } case SUMO_ATTR_ENDOFFSET: return toString(edge->getLaneStruct(myIndex).endOffset); + case SUMO_ATTR_ACCELERATION: + return toString(edge->getLaneStruct(myIndex).accelRamp); case SUMO_ATTR_INDEX: return toString(myIndex); default: - throw InvalidArgument("lane attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -814,18 +812,19 @@ GNELane::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) { switch (key) { case SUMO_ATTR_ID: - throw InvalidArgument("modifying lane attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + toString(getTag()) + " isn't allowed"); case SUMO_ATTR_SPEED: case SUMO_ATTR_ALLOW: case SUMO_ATTR_DISALLOW: case SUMO_ATTR_WIDTH: case SUMO_ATTR_ENDOFFSET: + case SUMO_ATTR_ACCELERATION: case SUMO_ATTR_INDEX: // no special handling undoList->p_add(new GNEChange_Attribute(this, key, value)); break; default: - throw InvalidArgument("lane attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -836,18 +835,24 @@ case SUMO_ATTR_ID: return false; case SUMO_ATTR_SPEED: - return canParse(value); + return canParse(value); case SUMO_ATTR_ALLOW: case SUMO_ATTR_DISALLOW: return canParseVehicleClasses(value); case SUMO_ATTR_WIDTH: - return canParse(value) && (isPositive(value) || parse(value) == NBEdge::UNSPECIFIED_WIDTH); + if (value == "default") { + return true; + } else { + return canParse(value) && (isPositive(value) || parse(value) == NBEdge::UNSPECIFIED_WIDTH); + } case SUMO_ATTR_ENDOFFSET: - return canParse(value); + return canParse(value); + case SUMO_ATTR_ACCELERATION: + return canParse(value); case SUMO_ATTR_INDEX: return value == toString(myIndex); default: - throw InvalidArgument("lane attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -866,9 +871,9 @@ NBEdge* edge = myParentEdge.getNBEdge(); switch (key) { case SUMO_ATTR_ID: - throw InvalidArgument("modifying lane attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + toString(getTag()) + " isn't allowed"); case SUMO_ATTR_SPEED: - edge->setSpeed(myIndex, parse(value)); + edge->setSpeed(myIndex, parse(value)); break; case SUMO_ATTR_ALLOW: edge->setPermissions(parseVehicleClasses(value), myIndex); @@ -881,13 +886,22 @@ myNet->getViewNet()->update(); break; case SUMO_ATTR_WIDTH: - edge->setLaneWidth(myIndex, parse(value)); + if (value == "default") { + edge->setLaneWidth(myIndex, NBEdge::UNSPECIFIED_WIDTH); + } else { + edge->setLaneWidth(myIndex, parse(value)); + } + updateGeometry(); + myNet->getViewNet()->update(); break; case SUMO_ATTR_ENDOFFSET: - edge->setEndOffset(myIndex, parse(value)); + edge->setEndOffset(myIndex, parse(value)); + break; + case SUMO_ATTR_ACCELERATION: + edge->setAcceleration(myIndex, parse(value)); break; default: - throw InvalidArgument("lane attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -896,7 +910,7 @@ GNELane::setFunctionalColor(int activeScheme) const { switch (activeScheme) { case 6: { - SUMOReal hue = GeomHelper::naviDegree(getShape().beginEndAngle()); // [0-360] + double hue = GeomHelper::naviDegree(getShape().beginEndAngle()); // [0-360] GLHelper::setColor(RGBColor::fromHSV(hue, 1., 1.)); return true; } @@ -918,7 +932,7 @@ return true; case 11: // color by inclination at segment start for (int ii = 1; ii < (int)getShape().size(); ++ii) { - const SUMOReal inc = (getShape()[ii].z() - getShape()[ii - 1].z()) / MAX2(POSITION_EPS, getShape()[ii].distanceTo2D(getShape()[ii - 1])); + const double inc = (getShape()[ii].z() - getShape()[ii - 1].z()) / MAX2(POSITION_EPS, getShape()[ii].distanceTo2D(getShape()[ii - 1])); myShapeColors.push_back(c.getScheme().getColor(inc)); } return true; @@ -928,9 +942,12 @@ } -SUMOReal +double GNELane::getColorValue(int activeScheme) const { - const SVCPermissions myPermissions = myParentEdge.getNBEdge()->getPermissions(myIndex); + SVCPermissions myPermissions = myParentEdge.getNBEdge()->getPermissions(myIndex); + if (getVehicleClassNames(~myPermissions) == "all") { + myPermissions = 0; + } switch (activeScheme) { case 0: switch (myPermissions) { @@ -954,7 +971,7 @@ return gSelected.isSelected(getType(), getGlID()) || gSelected.isSelected(GLO_EDGE, dynamic_cast(&myParentEdge)->getGlID()); case 2: - return (SUMOReal)myPermissions; + return (double)myPermissions; case 3: return myParentEdge.getNBEdge()->getLaneSpeed(myIndex); case 4: @@ -993,7 +1010,7 @@ void -GNELane::drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const { +GNELane::drawCrossties(double length, double spacing, double halfWidth) const { glPushMatrix(); // draw on top of of the white area between the rails glTranslated(0, 0, 0.1); @@ -1002,7 +1019,7 @@ glPushMatrix(); glTranslated(getShape()[i].x(), getShape()[i].y(), 0.0); glRotated(myShapeRotations[i], 0, 0, 1); - for (SUMOReal t = 0; t < myShapeLengths[i]; t += spacing) { + for (double t = 0; t < myShapeLengths[i]; t += spacing) { glBegin(GL_QUADS); glVertex2d(-halfWidth, -t); glVertex2d(-halfWidth, -t - length); @@ -1018,7 +1035,7 @@ void GNELane::drawDirectionIndicators() const { - const SUMOReal width = myParentEdge.getNBEdge()->getLaneWidth(myIndex); + const double width = myParentEdge.getNBEdge()->getLaneWidth(myIndex); glColor3d(0.3, 0.3, 0.3); glPushMatrix(); glTranslated(0, 0, GLO_JUNCTION + 0.1); @@ -1027,8 +1044,8 @@ glPushMatrix(); glTranslated(getShape()[i].x(), getShape()[i].y(), 0.1); glRotated(myShapeRotations[i], 0, 0, 1); - for (SUMOReal t = 0; t < myShapeLengths[i]; t += width) { - const SUMOReal length = MIN2(width * (SUMOReal)0.5, myShapeLengths[i] - t); + for (double t = 0; t < myShapeLengths[i]; t += width) { + const double length = MIN2(width * 0.5, myShapeLengths[i] - t); glBegin(GL_TRIANGLES); glVertex2d(0, -t - length); glVertex2d(-width * 0.25, -t); @@ -1070,9 +1087,8 @@ // Obtain incoming edges if junction source was already created GNEJunction* junctionSource = myParentEdge.getGNEJunctionSource(); if (junctionSource) { - std::vector incomingEdges = junctionSource->getGNEIncomingEdges(); - // Iterate over incoming edges - for (std::vector::iterator i = incomingEdges.begin(); i != incomingEdges.end(); i++) { + // Iterate over incoming GNEEdges of junction + for (std::vector::const_iterator i = junctionSource->getGNEIncomingEdges().begin(); i != junctionSource->getGNEIncomingEdges().end(); i++) { // Iterate over connection of incoming edges for (std::vector::const_iterator j = (*i)->getGNEConnections().begin(); j != (*i)->getGNEConnections().end(); j++) { if ((*j)->getNBEdgeConnection().fromLane == getIndex()) { @@ -1099,4 +1115,19 @@ return outcomingConnections; } + +void +GNELane::updateConnectionIDs() { + // update incoming connections of lane + std::vector incomingConnections = getGNEIncomingConnections(); + for (std::vector::iterator i = incomingConnections.begin(); i != incomingConnections.end(); i++) { + (*i)->updateID(); + } + // update outocming connections of lane + std::vector outcomingConnections = getGNEOutcomingConnections(); + for (std::vector::iterator i = outcomingConnections.begin(); i != outcomingConnections.end(); i++) { + (*i)->updateID(); + } +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNELane.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNELane.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNELane.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNELane.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNELane.h /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNELane.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNELane.h 24108 2017-04-27 18:43:30Z behrisch $ /// // A class for visualizing Lane geometry (adapted from GUILaneWrapper) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,7 +41,6 @@ class GNEEdge; class GNENet; class GNEAdditional; -class GNEAdditionalSet; class GNEConnection; // =========================================================================== @@ -60,9 +59,6 @@ /// @brief Definition of the additionals vector typedef std::vector AdditionalVector; - /// @brief Definition of the additionalSets vector - typedef std::vector AdditionalSetVector; - /**@brief Constructor * @param[in] idStorage The storage of gl-ids to get the one for this lane representation from * @param[in] the edge this lane belongs to @@ -73,6 +69,18 @@ /// @brief Destructor ~GNELane(); + /// @brief Returns underlying parent edge + GNEEdge& getParentEdge(); + + /// @brief returns a vector with the incoming GNEConnections of this lane + std::vector getGNEIncomingConnections(); + + /// @brief returns a vector with the outgoing GNEConnections of this lane + std::vector getGNEOutcomingConnections(); + + // update IDs of incoming connections of this lane + void updateConnectionIDs(); + /// @name inherited from GUIGlObject /// @{ // @brief Returns the name of the parent object (if any) @@ -100,15 +108,6 @@ /// @brief multiplexes message to two targets long onDefault(FXObject*, FXSelector, void*); - /// @brief Returns underlying parent edge - GNEEdge& getParentEdge(); - - /// @brief returns a vector with the incoming GNEConnections of this lane - std::vector getGNEIncomingConnections(); - - /// @brief returns a vector with the outgoing GNEConnections of this lane - std::vector getGNEOutcomingConnections(); - /**@brief Returns the boundary to which the view shall be centered in order to show the object * * @return The boundary the object is within @@ -127,10 +126,10 @@ const PositionVector& getShape() const; /// @brief returns the vector with the shape rotations - const std::vector& getShapeRotations() const; + const std::vector& getShapeRotations() const; /// @brief returns the vector with the shape lengths - const std::vector& getShapeLengths() const; + const std::vector& getShapeLengths() const; /// @brief returns the boundry (including lanes) Boundary getBoundary() const; @@ -143,7 +142,7 @@ int getIndex() const; /// @nrief returns the current speed of lane - SUMOReal getSpeed() const; + double getSpeed() const; /* @brief method for setting the index of the lane * @param[in] index The new index of lane @@ -152,24 +151,24 @@ /// @brief returns the parameteric length of the lane /// @note is the same as their Edge parent - SUMOReal getLaneParametricLenght() const; + double getLaneParametricLength() const; /// @brief returns the length of the lane's shape - SUMOReal getLaneShapeLenght() const; + double getLaneShapeLength() const; - /* @brief returns the relative position of an element in the lane's shape depending of the parametric lenght - * Examples: Lane with Parametric lenght = 100 and Shape lenght = 250. Position 50 returns 125, Position 80 returns 200 - * @param[in] position to calculate their relative position in the lane's shape [0 < position < LaneParametricLenght()] + /* @brief returns the relative position of an element in the lane's shape depending of the parametric length + * Examples: Lane with Parametric length = 100 and Shape length = 250. Position 50 returns 125, Position 80 returns 200 + * @param[in] position to calculate their relative position in the lane's shape [0 < position < LaneParametricLength()] * @return the relative position in the lane's shape */ - SUMOReal getPositionRelativeToParametricLenght(SUMOReal position) const; + double getPositionRelativeToParametricLength(double position) const; - /* @brief returns the relative position of an element in the lane's shape depending of the shape's lenght - * Examples: Lane with Parametric lenght = 100 and Shape lenght = 250. Position = 100 returns 40, Position 220 returns 88 - * @param[in] position to calculate their relative position in the lane's shape [0 < position < LaneShapeLenght] + /* @brief returns the relative position of an element in the lane's shape depending of the shape's length + * Examples: Lane with Parametric length = 100 and Shape length = 250. Position = 100 returns 40, Position 220 returns 88 + * @param[in] position to calculate their relative position in the lane's shape [0 < position < LaneShapeLength] * @return the relative position in the lane's shape */ - SUMOReal getPositionRelativeToShapeLenght(SUMOReal position) const; + double getPositionRelativeToShapeLength(double position) const; /// @brief add additional child to this lane void addAdditionalChild(GNEAdditional* additional); @@ -180,15 +179,6 @@ /// @brief get additional childs of lane const std::vector& getAdditionalChilds() const; - /// @brief add GNEAdditionalSet to this lane - bool addAdditionalSet(GNEAdditionalSet* additionalSet); - - /// @brief remove GNEAdditionalSet from this lane - bool removeAdditionalGeometrySet(GNEAdditionalSet* additionalSet); - - /// @brief return list of additionalSets parents of this lane - const std::vector& getAdditionalSetParents(); - /// @brief check if this lane is restricted bool isRestricted(SUMOVehicleClass vclass) const; @@ -233,24 +223,21 @@ /// @name computed only once (for performance) in updateGeometry() /// @{ /// @brief The rotations of the shape parts - std::vector myShapeRotations; + std::vector myShapeRotations; /// @brief The lengths of the shape parts - std::vector myShapeLengths; + std::vector myShapeLengths; /// @brief Position of textures of restricted lanes std::vector myLaneRestrictedTexturePositions; /// @brief Rotations of textures of restricted lanes - std::vector myLaneRestrictedTextureRotations; + std::vector myLaneRestrictedTextureRotations; /// @} - /// @brief list with the additonals vinculated with this lane + /// @brief list with the additionals vinculated with this lane AdditionalVector myAdditionals; - /// @brief list with the additonalSets parents of this lane - AdditionalSetVector myAdditionalSetParents; - /// @brief optional special color const RGBColor* mySpecialColor; @@ -271,13 +258,13 @@ GNELane& operator=(const GNELane&); /// @brief draw lane markings - void drawMarkings(const bool& selectedEdge, SUMOReal scale) const; + void drawMarkings(const bool& selectedEdge, double scale) const; /// @brief draw link Number - void drawLinkNo() const; + void drawLinkNo(const GUIVisualizationSettings& s) const; /// @brief draw TLS Link Number - void drawTLSLinkNo() const; + void drawTLSLinkNo(const GUIVisualizationSettings& s) const; /// @brief draw link rules void drawLinkRules() const; @@ -289,7 +276,7 @@ void drawLane2LaneConnections() const; /// @brief return value for lane coloring according to the given scheme - SUMOReal getColorValue(int activeScheme) const; + double getColorValue(int activeScheme) const; /// @brief sets the color according to the current scheme index and some lane function bool setFunctionalColor(int activeScheme) const; @@ -305,7 +292,7 @@ /// @brief draw crossties for railroads /// @todo: XXX This duplicates the code of GUILane::drawCrossties and needs to be - void drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const; + void drawCrossties(double length, double spacing, double halfWidth) const; /// @brief direction indicators for lanes void drawDirectionIndicators() const; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNELoadThread.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNELoadThread.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNELoadThread.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNELoadThread.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,13 +2,13 @@ /// @file GNELoadThread.cpp /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNELoadThread.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNELoadThread.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The thread that performs the loading of a Netedit-net (adapted from // GUILoadThread) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,10 +55,6 @@ #include "GNEEvent_NetworkLoaded.h" #include "GNEAdditionalHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions @@ -99,7 +95,8 @@ MsgHandler::initOutputOptions(); if (!(NIFrame::checkOptions() && NBFrame::checkOptions() && - NWFrame::checkOptions())) { + NWFrame::checkOptions() && + SystemFrame::checkOptions())) { // options are not valid WRITE_ERROR("Invalid Options. Nothing loaded"); submitEndAndCleanup(net); @@ -148,17 +145,12 @@ throw ProcessError(); } else { net = new GNENet(netBuilder); + if (oc.getBool("lefthand")) { + // force initial geometry computation because the net will look strange otherwise + net->computeAndUpdate(oc); + } } - // enable load additionals after creation of net if was specified in the command line - if (myAdditionalFile != "") { - net->setAdditionalsFile(myAdditionalFile); - } - - // Set additionals output file - if (myAdditionalOutputFile != "") { - net->setAdditionalsOutputFile(myAdditionalOutputFile); - } } catch (ProcessError& e) { if (std::string(e.what()) != std::string("Process Error") && std::string(e.what()) != std::string("")) { WRITE_ERROR(e.what()); @@ -219,7 +211,10 @@ oc.addDescription("new", "Input", "Start with a new network"); oc.doRegister("sumo-additionals-file", new Option_String()); - oc.addDescription("sumo-additionals-file", "Input", "load additionals"); + oc.addDescription("sumo-additionals-file", "Input", "file in which additionals are loaded"); + + oc.doRegister("additionals-output", new Option_String()); + oc.addDescription("additionals-output", "Input", "file in which additionals must be saved"); oc.doRegister("disable-laneIcons", new Option_Bool(false)); oc.addDescription("disable-laneIcons", "Visualisation", "Disable icons of special lanes"); @@ -236,8 +231,11 @@ oc.doRegister("window-size", new Option_String()); oc.addDescription("window-size", "Visualisation", "Create initial window with the given x,y size"); - oc.doRegister("additionals-output", new Option_String()); - oc.addDescription("additionals-output", "Output", "default value for additionals output file"); + oc.doRegister("window-pos", new Option_String()); + oc.addDescription("window-pos", "Visualisation", "Create initial window at the given x,y position"); + + oc.doRegister("gui-testing", new Option_Bool(false)); + oc.addDescription("gui-testing", "Visualisation", "Enable ovelay for screen recognition"); SystemFrame::addReportOptions(oc); // this subtopic is filled here, too @@ -287,15 +285,6 @@ GNELoadThread::loadConfigOrNet(const std::string& file, bool isNet, bool useStartupOptions, bool newNet) { myFile = file; myLoadNet = isNet; - - const OptionsCont& OC = OptionsCont::getOptions(); - if (OC.isSet("sumo-additionals-file")) { - myAdditionalFile = OC.getString("sumo-additionals-file"); - } - if (OC.isSet("additionals-output")) { - myAdditionalOutputFile = OC.getString("additionals-output"); - } - if (myFile != "" && !useStartupOptions) { OptionsIO::setArgs(0, 0); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNELoadThread.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNELoadThread.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNELoadThread.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNELoadThread.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,13 +2,13 @@ /// @file GNELoadThread.h /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNELoadThread.h 21814 2016-10-27 07:23:55Z namdre $ +/// @version $Id: GNELoadThread.h 22608 2017-01-17 06:28:54Z behrisch $ /// // The thread that performs the loading of a Netedit-net (adapted from // GUILoadThread) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -112,12 +112,6 @@ /// @brief if true, a new net is created bool myNewNet; - - /// @brief filename with additionals input - std::string myAdditionalFile; - - /// @brief filename for the additionals output - std::string myAdditionalOutputFile; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNENet.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNENet.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNENet.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNENet.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,7 +2,7 @@ /// @file GNENet.cpp /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNENet.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNENet.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A visual container for GNE-network-components such as GNEEdge and GNEJunction. // GNE components wrap netbuild-components and supply visualisation and editing @@ -15,7 +15,7 @@ // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,54 +36,54 @@ #include #endif -#include +#include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include -#include -#include -#include -#include +#include +#include #include #include +#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include "GNENet.h" +#include +#include +#include + +#include "GNEAdditional.h" +#include "GNEAdditionalFrame.h" #include "GNEApplicationWindow.h" -#include "GNEJunction.h" -#include "GNEEdge.h" -#include "GNELane.h" -#include "GNEConnection.h" -#include "GNEUndoList.h" +#include "GNEChange_Additional.h" #include "GNEChange_Attribute.h" -#include "GNEChange_Junction.h" +#include "GNEChange_Connection.h" +#include "GNEChange_Crossing.h" #include "GNEChange_Edge.h" +#include "GNEChange_Junction.h" #include "GNEChange_Lane.h" -#include "GNEChange_Connection.h" #include "GNEChange_Selection.h" -#include "GNEChange_Additional.h" -#include "GNEAdditional.h" -#include "GNEAdditionalSet.h" -#include "GNEStoppingPlace.h" +#include "GNEConnection.h" +#include "GNECrossing.h" #include "GNEDetector.h" +#include "GNEEdge.h" +#include "GNEJunction.h" +#include "GNEPoly.h" +#include "GNEPOI.h" +#include "GNELane.h" +#include "GNENet.h" +#include "GNEStoppingPlace.h" +#include "GNEUndoList.h" #include "GNEViewNet.h" +#include "GNEViewParent.h" +#include "GNERerouter.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members @@ -91,7 +91,7 @@ const RGBColor GNENet::selectionColor(0, 0, 204, 255); const RGBColor GNENet::selectedLaneColor(0, 0, 128, 255); const RGBColor GNENet::selectedConnectionColor(0, 0, 100, 255); -const SUMOReal GNENet::Z_INITIALIZED = 1; +const double GNENet::Z_INITIALIZED = 1; // =========================================================================== // member method definitions @@ -105,9 +105,18 @@ myEdgeIDSupplier("gneE", netBuilder->getEdgeCont().getAllNames()), myJunctionIDSupplier("gneJ", netBuilder->getNodeCont().getAllNames()), myShapeContainer(myGrid), - myNeedRecompute(true) { + myNeedRecompute(true), + myAdditionalsSaved(true) { GUIGlObjectStorage::gIDStorage.setNetObject(this); + // init junctions (by default Crossing and walking areas aren't created) + NBNodeCont& nc = myNetBuilder->getNodeCont(); + const std::vector& nodeNames = nc.getAllNames(); + for (std::vector::const_iterator name_it = nodeNames.begin(); name_it != nodeNames.end(); ++name_it) { + NBNode* nbn = nc.retrieve(*name_it); + registerJunction(new GNEJunction(*nbn, this, true)); + } + // init edges NBEdgeCont& ec = myNetBuilder->getEdgeCont(); const std::vector& edgeNames = ec.getAllNames(); @@ -119,13 +128,6 @@ } } - // init junctions - NBNodeCont& nc = myNetBuilder->getNodeCont(); - const std::vector& nodeNames = nc.getAllNames(); - for (std::vector::const_iterator name_it = nodeNames.begin(); name_it != nodeNames.end(); ++name_it) { - NBNode* nbn = nc.retrieve(*name_it); - registerJunction(new GNEJunction(*nbn, this, true)); - } // make sure myGrid is initialized even for an empty net if (myEdges.size() == 0) { myGrid.add(Boundary(0, 0, 100, 100)); @@ -149,7 +151,6 @@ if (myZBoundary.ymin() != Z_INITIALIZED) { myZBoundary.add(0, 0); } - } @@ -191,8 +192,7 @@ GUIGLObjectPopupMenu* -GNENet::getPopUpMenu(GUIMainWindow& app, - GUISUMOAbstractView& parent) { +GNENet::getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) { GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this); buildPopupHeader(ret, app); buildCenterPopupEntry(ret); @@ -241,7 +241,7 @@ std::string id = myJunctionIDSupplier.getNext(); NBNode* nbn = new NBNode(id, pos); GNEJunction* junction = new GNEJunction(*nbn, this); - undoList->add(new GNEChange_Junction(this, junction, true), true); + undoList->add(new GNEChange_Junction(junction, true), true); assert(myJunctions[id]); return junction; } @@ -278,12 +278,12 @@ edge = new GNEEdge(*nbe, this, wasSplit); } else { // default if no template is given - SUMOReal defaultSpeed = 50 / 3.6; + double defaultSpeed = 50 / 3.6; std::string defaultType = ""; int defaultNrLanes = 1; int defaultPriority = 1; - SUMOReal defaultWidth = NBEdge::UNSPECIFIED_WIDTH; - SUMOReal defaultOffset = NBEdge::UNSPECIFIED_OFFSET; + double defaultWidth = NBEdge::UNSPECIFIED_WIDTH; + double defaultOffset = NBEdge::UNSPECIFIED_OFFSET; NBEdge* nbe = new NBEdge(id, src->getNBNode(), dest->getNBNode(), defaultType, defaultSpeed, defaultNrLanes, defaultPriority, @@ -291,8 +291,8 @@ defaultOffset); edge = new GNEEdge(*nbe, this, wasSplit); } - undoList->p_begin("create edge"); - undoList->add(new GNEChange_Edge(this, edge, true), true); + undoList->p_begin("create " + toString(SUMO_TAG_EDGE)); + undoList->add(new GNEChange_Edge(edge, true), true); src->setLogicValid(false, undoList); dest->setLogicValid(false, undoList); requireRecompute(); @@ -307,7 +307,12 @@ // we have to delete all incident edges because they cannot exist without that junction // all deletions must be undone/redone together so we start a new command group // @todo if any of those edges are dead-ends should we remove their orphan junctions as well? - undoList->p_begin("delete junction"); + undoList->p_begin("delete " + toString(SUMO_TAG_JUNCTION)); + + // delete all crossings vinculated with junction + while (junction->getGNECrossings().size() > 0) { + deleteCrossing(junction->getGNECrossings().front(), undoList); + } // deleting edges changes in the underlying EdgeVector so we have to make a copy const EdgeVector incident = junction->getNBNode()->getEdges(); @@ -317,7 +322,7 @@ // remove any traffic lights from the traffic light container (avoids lots of warnings) junction->setAttribute(SUMO_ATTR_TYPE, toString(NODETYPE_PRIORITY), undoList); - undoList->add(new GNEChange_Junction(this, junction, false), true); + undoList->add(new GNEChange_Junction(junction, false), true); if (gSelected.isSelected(GLO_JUNCTION, junction->getGlID())) { std::set deselected; deselected.insert(junction->getGlID()); @@ -329,16 +334,30 @@ void GNENet::deleteEdge(GNEEdge* edge, GNEUndoList* undoList) { - undoList->p_begin("delete edge"); + undoList->p_begin("delete " + toString(SUMO_TAG_EDGE)); + // obtain a copy of GNERerouters of edge + std::vector rerouters = edge->getGNERerouters(); + // delete additionals childs of edge + std::vector copyOfEdgeAdditionals = edge->getAdditionalChilds(); + for (std::vector::iterator i = copyOfEdgeAdditionals.begin(); i != copyOfEdgeAdditionals.end(); i++) { + undoList->add(new GNEChange_Additional((*i), false), true); + } + // delete additionals childs of lane + for (std::vector::const_iterator i = edge->getLanes().begin(); i != edge->getLanes().end(); i++) { + std::vector copyOfLaneAdditionals = (*i)->getAdditionalChilds(); + for (std::vector::iterator j = copyOfLaneAdditionals.begin(); j != copyOfLaneAdditionals.end(); j++) { + undoList->add(new GNEChange_Additional((*j), false), true); + } + } // invalidate junction (saving connections) edge->getGNEJunctionSource()->removeFromCrossings(edge, undoList); - edge->getGNEJunctionDest()->removeFromCrossings(edge, undoList); + edge->getGNEJunctionDestiny()->removeFromCrossings(edge, undoList); edge->getGNEJunctionSource()->setLogicValid(false, undoList); - edge->getGNEJunctionDest()->setLogicValid(false, undoList); + edge->getGNEJunctionDestiny()->setLogicValid(false, undoList); // Delete edge - undoList->add(new GNEChange_Edge(this, edge, false), true); + undoList->add(new GNEChange_Edge(edge, false), true); // If previously was selected if (gSelected.isSelected(GLO_EDGE, edge->getGlID())) { @@ -347,6 +366,13 @@ undoList->add(new GNEChange_Selection(this, std::set(), deselected, true), true); } + // check if after removing there are Rerouters without edge Childs + for (std::vector::iterator i = rerouters.begin(); i != rerouters.end(); i++) { + if ((*i)->getEdgeChilds().size() == 0) { + undoList->add(new GNEChange_Additional((*i), false), true); + } + } + // remove edge requieres always a recompute (due geometry and connections) requireRecompute(); undoList->p_end(); } @@ -359,12 +385,17 @@ // remove the whole edge instead deleteEdge(edge, undoList); } else { - undoList->p_begin("delete lane"); + undoList->p_begin("delete " + toString(SUMO_TAG_LANE)); + // delete additionals childs of lane + std::vector copyOfAdditionals = lane->getAdditionalChilds(); + for (std::vector::const_iterator i = copyOfAdditionals.begin(); i != copyOfAdditionals.end(); i++) { + undoList->add(new GNEChange_Additional((*i), false), true); + } // invalidate junctions (saving connections) edge->getGNEJunctionSource()->removeFromCrossings(edge, undoList); - edge->getGNEJunctionDest()->removeFromCrossings(edge, undoList); + edge->getGNEJunctionDestiny()->removeFromCrossings(edge, undoList); edge->getGNEJunctionSource()->setLogicValid(false, undoList); - edge->getGNEJunctionDest()->setLogicValid(false, undoList); + edge->getGNEJunctionDestiny()->setLogicValid(false, undoList); // delete lane const NBEdge::Lane& laneAttrs = edge->getNBEdge()->getLaneStruct(lane->getIndex()); @@ -382,12 +413,12 @@ void GNENet::deleteConnection(GNEConnection* connection, GNEUndoList* undoList) { - undoList->p_begin("delete connection"); + undoList->p_begin("delete " + toString(SUMO_TAG_CONNECTION)); NBConnection deleted = connection->getNBConnection(); + GNEJunction* affected = connection->getEdgeFrom()->getGNEJunctionDestiny(); + affected->markAsModified(undoList); undoList->add(new GNEChange_Connection(connection->getEdgeFrom(), connection->getNBEdgeConnection(), false), true); - GNEJunction* affected = connection->getEdgeFrom()->getGNEJunctionDest(); affected->invalidateTLS(myViewNet->getUndoList(), deleted); - affected->markAsModified(undoList); if (gSelected.isSelected(GLO_CONNECTION, connection->getGlID())) { std::set deselected; deselected.insert(connection->getGlID()); @@ -399,8 +430,22 @@ void +GNENet::deleteCrossing(GNECrossing* crossing, GNEUndoList* undoList) { + undoList->p_begin("delete crossing"); + undoList->add(new GNEChange_Crossing(crossing->getParentJunction(), crossing->getNBCrossing().edges, + crossing->getNBCrossing().width, crossing->getNBCrossing().priority, false), true); + if (gSelected.isSelected(GLO_CROSSING, crossing->getGlID())) { + std::set deselected; + deselected.insert(crossing->getGlID()); + undoList->add(new GNEChange_Selection(this, std::set(), deselected, true), true); + } + requireRecompute(); + undoList->p_end(); +} + +void GNENet::duplicateLane(GNELane* lane, GNEUndoList* undoList) { - undoList->p_begin("duplicate lane"); + undoList->p_begin("duplicate " + toString(SUMO_TAG_LANE)); GNEEdge* edge = &lane->getParentEdge(); const NBEdge::Lane& laneAttrs = edge->getNBEdge()->getLaneStruct(lane->getIndex()); GNELane* newLane = new GNELane(*edge, lane->getIndex()); @@ -412,28 +457,27 @@ bool GNENet::restrictLane(SUMOVehicleClass vclass, GNELane* lane, GNEUndoList* undoList) { - // First check that edge don't have a sidewalk - GNEEdge& edge = lane->getParentEdge(); - for (std::vector::const_iterator i = edge.getLanes().begin(); i != edge.getLanes().end(); i++) { - if ((*i)->isRestricted(vclass)) { - return false; + bool addRestriction = true; + if (vclass == SVC_PEDESTRIAN) { + GNEEdge& edge = lane->getParentEdge(); + for (std::vector::const_iterator i = edge.getLanes().begin(); i != edge.getLanes().end(); i++) { + if ((*i)->isRestricted(SVC_PEDESTRIAN)) { + // prevent adding a 2nd sidewalk + addRestriction = false; + } else { + // ensure that the sidewalk is used exclusively + const SVCPermissions allOldWithoutPeds = edge.getNBEdge()->getPermissions((*i)->getIndex()) & ~SVC_PEDESTRIAN; + (*i)->setAttribute(SUMO_ATTR_ALLOW, getVehicleClassNames(allOldWithoutPeds), undoList); + } } } - // Get all possible vehicle classes - std::vector VClasses = SumoVehicleClassStrings.getStrings(); - std::vector disallowedVClasses; - std::string restriction = toString(vclass); - std::string ignoring = toString(SVC_IGNORING); - // Iterate over vehicle classes to filter - for (int i = 0; i < (int)VClasses.size(); i++) { - if ((VClasses.at(i) != restriction) && (VClasses.at(i) != ignoring)) { - disallowedVClasses.push_back(VClasses.at(i)); - } + // restrict the lane + if (addRestriction) { + lane->setAttribute(SUMO_ATTR_ALLOW, toString(vclass), undoList); + return true; + } else { + return false; } - // Change allow and disallow attributes of lane - lane->setAttribute(SUMO_ATTR_ALLOW, restriction, undoList); - lane->setAttribute(SUMO_ATTR_DISALLOW, joinToString(disallowedVClasses, " "), undoList); - return true; } @@ -466,7 +510,7 @@ // duplicate last lane duplicateLane(edge.getLanes().at(0), undoList); // transform the created (last) lane to a sidewalk - return restrictLane(vclass, edge.getLanes().at(0), undoList); + return restrictLane(vclass, edge.getLanes()[0], undoList); } @@ -494,11 +538,11 @@ GNEJunction* GNENet::splitEdge(GNEEdge* edge, const Position& pos, GNEUndoList* undoList, GNEJunction* newJunction) { - undoList->p_begin("split edge"); + undoList->p_begin("split " + toString(SUMO_TAG_EDGE)); deleteEdge(edge, undoList); // still exists. we delete it so we can reuse the name in case of resplit // compute geometry const PositionVector& oldGeom = edge->getNBEdge()->getGeometry(); - const SUMOReal linePos = oldGeom.nearest_offset_to_point2D(pos, false); + const double linePos = oldGeom.nearest_offset_to_point2D(pos, false); std::pair newGeoms = oldGeom.splitAt(linePos); // figure out the new name int posBase = 0; @@ -508,7 +552,7 @@ if (sep_index != std::string::npos) { // edge may have been renamed in between std::string posString = baseName.substr(sep_index + 1); try { - posBase = TplConvert::_2int(posString.c_str()); + posBase = GNEAttributeCarrier::parse(posString.c_str()); baseName = baseName.substr(0, sep_index); // includes the . } catch (NumberFormatException) { } @@ -521,7 +565,7 @@ } GNEEdge* firstPart = createEdge(edge->getGNEJunctionSource(), newJunction, edge, undoList, baseName + toString(posBase), true); - GNEEdge* secondPart = createEdge(newJunction, edge->getGNEJunctionDest(), edge, + GNEEdge* secondPart = createEdge(newJunction, edge->getGNEJunctionDestiny(), edge, undoList, baseName + toString(posBase + (int)linePos), true); // fix geometry firstPart->setAttribute(GNE_ATTR_SHAPE_START, toString(newGeoms.first[0]), undoList); @@ -548,7 +592,7 @@ void GNENet::splitEdgesBidi(const std::set& edges, const Position& pos, GNEUndoList* undoList) { GNEJunction* newJunction = 0; - undoList->p_begin("split edges"); + undoList->p_begin("split " + toString(SUMO_TAG_EDGE) + "s"); for (std::set::const_iterator it = edges.begin(); it != edges.end(); ++it) { newJunction = splitEdge(*it, pos, undoList, newJunction); } @@ -558,9 +602,9 @@ void GNENet::reverseEdge(GNEEdge* edge, GNEUndoList* undoList) { - undoList->p_begin("reverse edge"); + undoList->p_begin("reverse " + toString(SUMO_TAG_EDGE)); deleteEdge(edge, undoList); // still exists. we delete it so we can reuse the name in case of resplit - GNEEdge* reversed = createEdge(edge->getGNEJunctionDest(), edge->getGNEJunctionSource(), edge, undoList, edge->getID(), false, true); + GNEEdge* reversed = createEdge(edge->getGNEJunctionDestiny(), edge->getGNEJunctionSource(), edge, undoList, edge->getID(), false, true); assert(reversed != 0); reversed->setAttribute(SUMO_ATTR_SHAPE, toString(edge->getNBEdge()->getInnerGeometry().reverse()), undoList); undoList->p_end(); @@ -569,10 +613,11 @@ GNEEdge* GNENet::addReversedEdge(GNEEdge* edge, GNEUndoList* undoList) { - undoList->p_begin("add reversed edge"); + undoList->p_begin("add reversed " + toString(SUMO_TAG_EDGE)); GNEEdge* reversed = 0; - if (edge->getNBEdge()->getLaneSpreadFunction() == LANESPREAD_RIGHT) { - GNEEdge* reversed = createEdge(edge->getGNEJunctionDest(), edge->getGNEJunctionSource(), edge, undoList, "-" + edge->getID(), false, true); + if (edge->getNBEdge()->getLaneSpreadFunction() == LANESPREAD_RIGHT || isRailway(edge->getNBEdge()->getPermissions())) { + // for rail edges, we assume bi-directional tracks are wanted + GNEEdge* reversed = createEdge(edge->getGNEJunctionDestiny(), edge->getGNEJunctionSource(), edge, undoList, "-" + edge->getID(), false, true); assert(reversed != 0); reversed->setAttribute(SUMO_ATTR_SHAPE, toString(edge->getNBEdge()->getInnerGeometry().reverse()), undoList); } else { @@ -580,7 +625,7 @@ // make it easy to move and reconnect it PositionVector orig = edge->getNBEdge()->getGeometry(); PositionVector origInner = edge->getNBEdge()->getInnerGeometry(); - const SUMOReal tentativeShift = edge->getNBEdge()->getTotalWidth() + 2; + const double tentativeShift = edge->getNBEdge()->getTotalWidth() + 2; orig.move2side(-tentativeShift); origInner.move2side(-tentativeShift); GNEJunction* src = createJunction(orig.back(), undoList); @@ -602,7 +647,7 @@ void GNENet::mergeJunctions(GNEJunction* moved, GNEJunction* target, GNEUndoList* undoList) { - undoList->p_begin("merge junctions"); + undoList->p_begin("merge " + toString(SUMO_TAG_JUNCTION) + "s"); // position of moved and target are probably a bit different (snap radius) moved->move(target->getNBNode()->getPosition()); // register the move with undolist (must happend within the undo group) @@ -617,7 +662,7 @@ const EdgeVector outgoing = moved->getNBNode()->getOutgoingEdges(); for (EdgeVector::const_iterator it = outgoing.begin(); it != outgoing.end(); it++) { GNEEdge* oldEdge = myEdges[(*it)->getID()]; - remapEdge(oldEdge, target, oldEdge->getGNEJunctionDest(), undoList); + remapEdge(oldEdge, target, oldEdge->getGNEJunctionDestiny(), undoList); } deleteJunction(moved, undoList); undoList->p_end(); @@ -641,27 +686,23 @@ void GNENet::save(OptionsCont& oc) { + // compute and update network computeAndUpdate(oc); + // write network NWFrame::writeNetwork(oc, *myNetBuilder); } void GNENet::saveAdditionals(const std::string& filename) { - // Extract path of filename - std::string path = filename; - while (!path.empty() && path[path.size() - 1] != '\\') { - path = path.substr(0, path.size() - 1); - } OutputDevice& device = OutputDevice::getDevice(filename); device.openTag("additionals"); for (GNEAdditionals::const_iterator i = myAdditionals.begin(); i != myAdditionals.end(); ++i) { - // Only write additional if don't belong to another additionalSet - if (i->second->getAdditionalSetParent() == NULL) { - i->second->writeAdditional(device, path); - } + i->second->writeAdditional(device); } device.close(); + // change value of flag + myAdditionalsSaved = true; } @@ -753,7 +794,7 @@ } if (failHard) { // Throw exception if failHard is enabled - throw UnknownElement("lane " + id); + throw UnknownElement(toString(SUMO_TAG_LANE) + " " + id); } } return 0; @@ -792,6 +833,16 @@ } +std::string +GNENet::generateVaporizerID() const { + int counter = 0; + while (myAdditionals.find(std::pair("vaporizer_" + toString(counter), SUMO_TAG_VAPORIZER)) != myAdditionals.end()) { + counter++; + } + return "vaporizer_" + toString(counter); +} + + std::vector GNENet::retrieveAttributeCarriers(const std::set& ids, GUIGlObjectType type) { std::vector result; @@ -812,11 +863,19 @@ ac = dynamic_cast(object); break; case GLO_ADDITIONAL: - if (dynamic_cast(object)) { - ac = dynamic_cast(object); - } else if (dynamic_cast(object)) { - ac = dynamic_cast(object); - } + ac = dynamic_cast(object); + break; + case GLO_CONNECTION: + ac = dynamic_cast(object); + break; + case GLO_CROSSING: + ac = dynamic_cast(object); + break; + case GLO_POLYGON: + ac = dynamic_cast(object); + break; + case GLO_POI: + ac = dynamic_cast(object); break; default: break; @@ -846,6 +905,7 @@ // knownTypes.insert(GLO_TLLOGIC); makes no sense to include them knownTypes.insert(GLO_ADDITIONAL); knownTypes.insert(GLO_CONNECTION); + knownTypes.insert(GLO_CROSSING); for (std::set::const_iterator it = knownTypes.begin(); it != knownTypes.end(); it++) { const std::set tmp = getGlIDs(*it); result.insert(tmp.begin(), tmp.end()); @@ -894,7 +954,19 @@ const std::vector& connections = i->second->getGNEConnections(); // Iterate over connections for (std::vector::const_iterator j = connections.begin(); j != connections.end(); j++) { - // Insert every connection of edge it in result + // Insert every connection of edge in result + result.insert((*j)->getGlID()); + } + } + break; + } + case GLO_CROSSING: { + for (GNEJunctions::const_iterator i = myJunctions.begin(); i != myJunctions.end(); i++) { + // Get crossings of junction + const std::vector& crossings = i->second->getGNECrossings(); + // Iterate over crossings + for (std::vector::const_iterator j = crossings.begin(); j != crossings.end(); j++) { + // Insert every crossing of junction in result result.insert((*j)->getGlID()); } } @@ -949,19 +1021,19 @@ void -GNENet::updateJunctionShapes() { - // Update shapes of all junctions - for (GNEJunctions::iterator i = myJunctions.begin(); i != myJunctions.end(); i++) { - i->second->updateShapesAndGeometries(); - } - // Update view to show the new shapes - myViewNet->update(); +GNENet::requireRecompute() { + myNeedRecompute = true; } -void -GNENet::requireRecompute() { - myNeedRecompute = true; +bool +GNENet::netHasCrossings() const { + for (std::map::const_iterator i = myNetBuilder->getNodeCont().begin(); i != myNetBuilder->getNodeCont().end() ; i++) { + if (i->second->getCrossings().size() > 0) { + return true; + } + } + return false; } @@ -971,13 +1043,19 @@ } +NBNetBuilder* +GNENet::getNetBuilder() const { + return myNetBuilder; +} + + void GNENet::joinSelectedJunctions(GNEUndoList* undoList) { std::vector selected = retrieveJunctions(true); if (selected.size() < 2) { return; } - undoList->p_begin("Join selected junctions"); + undoList->p_begin("Join selected " + toString(SUMO_TAG_JUNCTION) + "s"); EdgeVector allIncoming; EdgeVector allOutgoing; @@ -1010,7 +1088,7 @@ } for (EdgeVector::const_iterator it = allOutgoing.begin(); it != allOutgoing.end(); it++) { GNEEdge* oldEdge = myEdges[(*it)->getID()]; - remapEdge(oldEdge, joined, oldEdge->getGNEJunctionDest(), undoList, true); + remapEdge(oldEdge, joined, oldEdge->getGNEJunctionDestiny(), undoList, true); } // delete original junctions for (std::vector::iterator it = selected.begin(); it != selected.end(); it++) { @@ -1023,7 +1101,7 @@ void GNENet::removeSolitaryJunctions(GNEUndoList* undoList) { - undoList->p_begin("Clean junctions"); + undoList->p_begin("Clean " + toString(SUMO_TAG_JUNCTION) + "s"); std::vector toRemove; for (GNEJunctions::const_iterator it = myJunctions.begin(); it != myJunctions.end(); it++) { GNEJunction* junction = it->second; @@ -1048,7 +1126,7 @@ GNEEdge* continuation = myEdges[(*j).second->getID()]; deleteEdge(begin, undoList); deleteEdge(continuation, undoList); - GNEEdge* newEdge = createEdge(begin->getGNEJunctionSource(), continuation->getGNEJunctionDest(), begin, undoList, begin->getMicrosimID(), false, true); + GNEEdge* newEdge = createEdge(begin->getGNEJunctionSource(), continuation->getGNEJunctionDestiny(), begin, undoList, begin->getMicrosimID(), false, true); PositionVector newShape = begin->getNBEdge()->getInnerGeometry(); newShape.push_back(junction->getNBNode()->getPosition()); newShape.append(continuation->getNBEdge()->getInnerGeometry()); @@ -1059,12 +1137,17 @@ undoList->p_end(); } + void GNENet::renameEdge(GNEEdge* edge, const std::string& newID) { myEdges.erase(edge->getNBEdge()->getID()); myNetBuilder->getEdgeCont().rename(edge->getNBEdge(), newID); edge->setMicrosimID(newID); myEdges[newID] = edge; + // rename all connections related to this edge + for (std::vector::const_iterator i = edge->getLanes().begin(); i != edge->getLanes().end(); i++) { + (*i)->updateConnectionIDs(); + } } @@ -1129,7 +1212,7 @@ GNEEdge* edge = *it; if (edge) { if (junctionSet.count(edge->getGNEJunctionSource()) > 0 && - junctionSet.count(edge->getGNEJunctionDest()) > 0) { + junctionSet.count(edge->getGNEJunctionDestiny()) > 0) { // edge and its endpoints are selected, move all the inner points as well edge->moveGeometry(delta); } else { @@ -1172,65 +1255,33 @@ void -GNENet::setAdditionalsFile(const std::string& additionalFile) { - OptionsCont::getOptions().set("sumo-additionals-file", additionalFile); -} - - -void -GNENet::setAdditionalsOutputFile(const std::string& additionalOutputFile) { - OptionsCont::getOptions().set("additionals-output", additionalOutputFile); -} - - -void GNENet::insertAdditional(GNEAdditional* additional, bool hardFail) { // Check if additional element exists before insertion if (myAdditionals.find(std::pair(additional->getID(), additional->getTag())) != myAdditionals.end()) { // Throw exception only if hardFail is enabled if (hardFail) { - throw ProcessError("additional element with ID='" + additional->getID() + "' already exist"); + throw ProcessError(toString(additional->getTag()) + " with ID='" + additional->getID() + "' already exist"); } } else { myAdditionals[std::pair(additional->getID(), additional->getTag())] = additional; myGrid.addAdditionalGLObject(additional); - // If additional is vinculated with a lane, add a reference - if (additional->getEdge()) { - additional->getEdge()->addAdditionalChild(additional); - } - // If additional is vinculated with an edge, add a reference - if (additional->getLane()) { - additional->getLane()->addAdditionalChild(additional); - } - if (additional->getAdditionalSetParent() != NULL) { - additional->getAdditionalSetParent()->addAdditionalChild(additional); - } update(); + myAdditionalsSaved = false; } } void GNENet::deleteAdditional(GNEAdditional* additional) { - GNEAdditionals::iterator positionToRemove = myAdditionals.find(std::pair(additional->getID(), additional->getTag())); + GNEAdditionals::iterator additionalToRemove = myAdditionals.find(std::pair(additional->getID(), additional->getTag())); // Check if additional element exists before deletion - if (positionToRemove == myAdditionals.end()) { - throw ProcessError("additional element with ID='" + additional->getID() + "' don't exist"); + if (additionalToRemove == myAdditionals.end()) { + throw ProcessError(toString(additional->getTag()) + " with ID='" + additional->getID() + "' doesn't exist"); } else { - myAdditionals.erase(positionToRemove); + myAdditionals.erase(additionalToRemove); myGrid.removeAdditionalGLObject(additional); - // If additional is vinculated with an edge, remove reference - if (additional->getEdge()) { - additional->getEdge()->removeAdditionalChild(additional); - } - // If additional is vinculated with a lane, remove reference - if (additional->getLane()) { - additional->getLane()->removeAdditionalChild(additional); - } - if (additional->getAdditionalSetParent() != NULL) { - additional->getAdditionalSetParent()->removeAdditionalGeometryChild(additional); - } update(); + myAdditionalsSaved = false; } } @@ -1238,15 +1289,45 @@ void GNENet::updateAdditionalID(const std::string& oldID, GNEAdditional* additional) { GNEAdditionals::iterator additionalToUpdate = myAdditionals.find(std::pair(oldID, additional->getTag())); - if (additionalToUpdate != myAdditionals.end()) { + if (additionalToUpdate == myAdditionals.end()) { + throw ProcessError(toString(additional->getTag()) + " with old ID='" + oldID + "' doesn't exist"); + } else { // remove an insert additional again into container myAdditionals.erase(additionalToUpdate); myAdditionals[std::pair(additional->getID(), additional->getTag())] = additional; + myAdditionalsSaved = false; } } GNEAdditional* +GNENet::retrieveAdditional(const std::string& id, bool hardFail) const { + for (GNEAdditionals::const_iterator i = myAdditionals.begin(); i != myAdditionals.end(); i++) { + if (i->second->getID() == id) { + return i->second; + } + } + if (hardFail) { + throw ProcessError("Attempted to retrieve non-existant additional"); + } else { + return NULL; + } +} + + +std::vector +GNENet::retrieveAdditionals(bool onlySelected) { + std::vector result; + for (GNEAdditionals::const_iterator it = myAdditionals.begin(); it != myAdditionals.end(); ++it) { + if (!onlySelected || gSelected.isSelected(GLO_ADDITIONAL, it->second->getGlID())) { + result.push_back(it->second); + } + } + return result; +} + + +GNEAdditional* GNENet::getAdditional(SumoXMLTag type, const std::string& id) const { if (myAdditionals.empty()) { return NULL; @@ -1259,7 +1340,7 @@ std::string -GNENet::getAdditionalID(SumoXMLTag type, const GNELane* lane, const SUMOReal pos) const { +GNENet::getAdditionalID(SumoXMLTag type, const GNELane* lane, const double pos) const { for (GNEAdditionals::const_iterator it = myAdditionals.begin(); it != myAdditionals.end(); ++it) { if ((it->second->getTag() == type) && (it->second->getLane() != NULL) && (it->second->getLane() == lane) && (fabs(it->second->getPositionInView().x() - pos) < POSITION_EPS)) { return it->second->getID(); @@ -1270,9 +1351,9 @@ std::vector -GNENet::getAdditionals(SumoXMLTag type) { +GNENet::getAdditionals(SumoXMLTag type) const { std::vector vectorOfAdditionals; - for (GNEAdditionals::iterator i = myAdditionals.begin(); i != myAdditionals.end(); i++) { + for (GNEAdditionals::const_iterator i = myAdditionals.begin(); i != myAdditionals.end(); i++) { if (type == SUMO_TAG_NOTHING || type == i->second->getTag()) { vectorOfAdditionals.push_back(i->second); } @@ -1282,9 +1363,9 @@ int -GNENet::getNumberOfAdditionals(SumoXMLTag type) { +GNENet::getNumberOfAdditionals(SumoXMLTag type) const { int counter = 0; - for (GNEAdditionals::iterator i = myAdditionals.begin(); i != myAdditionals.end(); i++) { + for (GNEAdditionals::const_iterator i = myAdditionals.begin(); i != myAdditionals.end(); i++) { if (type == SUMO_TAG_NOTHING || type == i->second->getTag()) { counter++; } @@ -1292,6 +1373,84 @@ return counter; } + +const GNECalibratorRoute& +GNENet::getGNECalibratorRoute(const std::string& calibratorRouteID) const { + std::vector calibrators = getAdditionals(SUMO_TAG_CALIBRATOR); + for (std::vector::iterator i = calibrators.begin(); i != calibrators.end(); i++) { + GNECalibrator* calibrator = dynamic_cast(*i); + if (calibrator->routeExists(calibratorRouteID)) { + return calibrator->getCalibratorRoute(calibratorRouteID); + } + } + throw InvalidArgument("A " + toString(SUMO_TAG_VTYPE) + "'s " + toString(SUMO_TAG_VTYPE) + " with ID = '" + calibratorRouteID + "' doesn't exists"); +} + + +const GNECalibratorVehicleType& +GNENet::getGNECalibratorVehicleType(const std::string& calibratorVehicleTypeID) const { + std::vector calibrators = getAdditionals(SUMO_TAG_CALIBRATOR); + for (std::vector::iterator i = calibrators.begin(); i != calibrators.end(); i++) { + GNECalibrator* calibrator = dynamic_cast(*i); + if (calibrator->vehicleTypeExists(calibratorVehicleTypeID)) { + return calibrator->getCalibratorVehicleType(calibratorVehicleTypeID); + } + } + throw InvalidArgument("A " + toString(SUMO_TAG_VTYPE) + "'s " + toString(SUMO_TAG_VTYPE) + " with ID = '" + calibratorVehicleTypeID + "' doesn't exists"); +} + + +const GNECalibratorFlow& +GNENet::getGNECalibratorFlow(const std::string& calibratorFlowID) const { + std::vector calibrators = getAdditionals(SUMO_TAG_CALIBRATOR); + for (std::vector::iterator i = calibrators.begin(); i != calibrators.end(); i++) { + GNECalibrator* calibrator = dynamic_cast(*i); + if (calibrator->flowExists(calibratorFlowID)) { + return calibrator->getCalibratorFlow(calibratorFlowID); + } + } + throw InvalidArgument("A " + toString(SUMO_TAG_VTYPE) + "'s " + toString(SUMO_TAG_VTYPE) + " with ID = '" + calibratorFlowID + "' doesn't exists"); +} + + +bool +GNENet::routeExists(const std::string& routeID) const { + std::vector calibrators = getAdditionals(SUMO_TAG_CALIBRATOR); + for (std::vector::iterator i = calibrators.begin(); i != calibrators.end(); i++) { + GNECalibrator* calibrator = dynamic_cast(*i); + if (calibrator->routeExists(routeID)) { + return true; + } + } + return false; +} + + +bool +GNENet::vehicleTypeExists(const std::string& vehicleTypeID) const { + std::vector calibrators = getAdditionals(SUMO_TAG_CALIBRATOR); + for (std::vector::iterator i = calibrators.begin(); i != calibrators.end(); i++) { + GNECalibrator* calibrator = dynamic_cast(*i); + if (calibrator->vehicleTypeExists(vehicleTypeID)) { + return true; + } + } + return false; +} + + +bool +GNENet::flowExists(const std::string& flowID) const { + std::vector calibrators = getAdditionals(SUMO_TAG_CALIBRATOR); + for (std::vector::iterator i = calibrators.begin(); i != calibrators.end(); i++) { + GNECalibrator* calibrator = dynamic_cast(*i); + if (calibrator->flowExists(flowID)) { + return true; + } + } + return false; +} + // =========================================================================== // private // =========================================================================== @@ -1307,8 +1466,7 @@ GNENet::insertEdge(GNEEdge* edge) { NBEdge* nbe = edge->getNBEdge(); myNetBuilder->getEdgeCont().insert(nbe); // should we ignore pruning double edges? - // if this edge was previouls extracted from the edgeContainer we have to - // rewire the nodes + // if this edge was previouls extracted from the edgeContainer we have to rewire the nodes nbe->getFromNode()->addOutgoingEdge(nbe); nbe->getToNode()->addIncomingEdge(nbe); registerEdge(edge); @@ -1323,7 +1481,7 @@ myGrid.add(junction->getBoundary()); myGrid.addAdditionalGLObject(junction); // @todo let Boundary class track z-coordinate natively - const SUMOReal z = junction->getNBNode()->getPosition().z(); + const double z = junction->getNBNode()->getPosition().z(); if (z != 0) { myZBoundary.add(z, Z_INITIALIZED); } @@ -1336,9 +1494,15 @@ GNENet::registerEdge(GNEEdge* edge) { edge->incRef("GNENet::registerEdge"); edge->setResponsible(false); + // add edge to internal container of GNENet myEdges[edge->getMicrosimID()] = edge; + // add edge to grid myGrid.add(edge->getBoundary()); myGrid.addAdditionalGLObject(edge); + // Add references into GNEJunctions + edge->getGNEJunctionSource()->addOutgoingGNEEdge(edge); + edge->getGNEJunctionDestiny()->addIncomingGNEEdge(edge); + // update view update(); return edge; } @@ -1359,14 +1523,18 @@ void GNENet::deleteSingleEdge(GNEEdge* edge) { + // remove edge from visual grid and container myGrid.removeAdditionalGLObject(edge); myEdges.erase(edge->getMicrosimID()); - myNetBuilder->getEdgeCont().extract( - myNetBuilder->getDistrictCont(), edge->getNBEdge()); + // extract edge of district container + myNetBuilder->getEdgeCont().extract(myNetBuilder->getDistrictCont(), edge->getNBEdge()); edge->decRef("GNENet::deleteSingleEdge"); edge->setResponsible(true); // selection status is lost when removing edge via undo and the selection operation was not part of a command group gSelected.deselect(edge->getGlID()); + // Remove refrences from GNEJunctions + edge->getGNEJunctionSource()->removeOutgoingGNEEdge(edge); + edge->getGNEJunctionDestiny()->removeIncomingGNEEdge(edge); // invalidate junction logic update(); } @@ -1412,17 +1580,53 @@ } } myNetBuilder->compute(oc, liveExplicitTurnarounds, false); + // update ids if necessary + if (oc.getBool("numerical-ids") || oc.isSet("reserved-ids")) { + GNEEdges newEdgeMap; + GNEJunctions newJunctionMap; + for (GNEEdges::const_iterator it = myEdges.begin(); it != myEdges.end(); it++) { + it->second->setMicrosimID(it->second->getNBEdge()->getID()); + newEdgeMap[it->second->getNBEdge()->getID()] = it->second; + } + for (GNEJunctions::const_iterator it = myJunctions.begin(); it != myJunctions.end(); it++) { + newJunctionMap[it->second->getNBNode()->getID()] = it->second; + it->second->setMicrosimID(it->second->getNBNode()->getID()); + } + myEdges = newEdgeMap; + myJunctions = newJunctionMap; + } + // update rtree if necessary + if (!oc.getBool("offset.disable-normalization")) { + for (GNEEdges::const_iterator it = myEdges.begin(); it != myEdges.end(); it++) { + refreshElement(it->second); + } + } + myGrid.reset(); + myGrid.add(GeoConvHelper::getFinal().getConvBoundary()); // update precomputed geometries initGNEConnections(); + for (GNEJunctions::const_iterator it = myJunctions.begin(); it != myJunctions.end(); it++) { it->second->setLogicValid(true); // updated shape it->second->updateGeometry(); refreshElement(it->second); } - // Set flag to false + myNeedRecompute = false; } +bool +GNENet::isAdditionalsSaved() const { + return myAdditionalsSaved; +} + + +void +GNENet::setAdditionalSaved(bool value) { + myAdditionalsSaved = value; +} + + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNENetElement.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNENetElement.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNENetElement.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNENetElement.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNENetElement.cpp /// @author Pablo Alvarez Lopez /// @date Jun 2016 -/// @version $Id: GNENetElement.cpp 21201 2016-07-19 11:57:22Z behrisch $ +/// @version $Id: GNENetElement.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A abstract class for netElements /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -27,38 +27,19 @@ #else #include #endif -/* -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -*/ + + #include "GNENetElement.h" #include "GNENet.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== -GNENetElement::GNENetElement(GNENet* net, const std::string& id, GUIGlObjectType type, SumoXMLTag tag) : +GNENetElement::GNENetElement(GNENet* net, const std::string& id, GUIGlObjectType type, SumoXMLTag tag, GUIIcon icon) : GUIGlObject(type, id), - GNEAttributeCarrier(tag), + GNEAttributeCarrier(tag, icon), myNet(net) { } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNENetElement.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNENetElement.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNENetElement.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNENetElement.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNENetElement.h /// @author Pablo Alvarez Lopez /// @date Jun 2016 -/// @version $Id: GNENetElement.h 21640 2016-10-09 20:28:52Z palcraft $ +/// @version $Id: GNENetElement.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A abstract class for net elements /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -60,8 +60,9 @@ * @param[in] id of the element * @param[in] type type of GL object * @param[in] tag sumo xml tag of the element + * @param[in] icon GUIIcon associated to the additional */ - GNENetElement(GNENet* net, const std::string& id, GUIGlObjectType type, SumoXMLTag tag); + GNENetElement(GNENet* net, const std::string& id, GUIGlObjectType type, SumoXMLTag tag, GUIIcon icon); /// @brief Destructor ~GNENetElement(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNENet.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNENet.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNENet.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNENet.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,7 +2,7 @@ /// @file GNENet.h /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNENet.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNENet.h 24108 2017-04-27 18:43:30Z behrisch $ /// // The lop level container for GNE-network-components such as GNEEdge and // GNEJunction. Contains an internal instances of NBNetBuilder GNE components @@ -16,7 +16,7 @@ // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -56,6 +56,7 @@ #include #include #include "GNEDetectorE3.h" +#include "GNECalibrator.h" // =========================================================================== @@ -68,7 +69,6 @@ class GNEJunction; class GNEUndoList; class GNEAdditional; -class GNEAdditionalSet; class GNEBusStop; class GNEChargingStation; class GNEDetectorE1; @@ -76,6 +76,7 @@ class GNEDetectorE3; class GNEDetectorE3EntryExit; class GNEConnection; +class GNECrossing; // =========================================================================== // class definitions @@ -197,12 +198,18 @@ */ void deleteLane(GNELane* lane, GNEUndoList* undoList); - /**@brief remove connectino + /**@brief remove connection * @param[in] connection The connection to be removed * @param[in] undoList The undolist in which to mark changes */ void deleteConnection(GNEConnection* connection, GNEUndoList* undoList); + /**@brief remove crossing + * @param[in] crossing The crossing to be removed + * @param[in] undoList The undolist in which to mark changes + */ + void deleteCrossing(GNECrossing* crossing, GNEUndoList* undoList); + /**@brief duplicates lane * @param[in] lane The lane to be duplicated * @param[in] undoList The undolist in which to mark changes @@ -211,7 +218,7 @@ /**@brief transform lane to restricted lane * @param[in] vclass vehicle class to restrict - * @param[in] lane The lane to be trasformed + * @param[in] lane The lane to be transformed * @param[in] undoList The undolist in which to mark changes */ bool restrictLane(SUMOVehicleClass vclass, GNELane* lane, GNEUndoList* undoList); @@ -349,6 +356,9 @@ /// @note only non removed additional will be refresh void refreshAdditional(GNEAdditional* additional); + /// @brief generate an ID for vaporizers + std::string generateVaporizerID() const; + /// @brief updates the map and reserves new id void renameEdge(GNEEdge* edge, const std::string& newID); @@ -375,6 +385,12 @@ /// @brief recompute the network and update lane geometries void computeAndUpdate(OptionsCont& oc); + /// @brief check if additional are saved + bool isAdditionalsSaved() const; + + /// @brief set manually the flag of additionals + void setAdditionalSaved(bool value); + /* @brief trigger full netbuild computation * param[in] window The window to inform about delay * param[in] force Whether to force recomputation even if not needed @@ -389,13 +405,10 @@ */ void joinSelectedJunctions(GNEUndoList* undoList); - /* @brief removes junctions that have no edges - */ + /// @brief removes junctions that have no edges void removeSolitaryJunctions(GNEUndoList* undoList); - /* @brief replace the selected junction by geometry node(s) - * and merge the edges - */ + /// @brief replace the selected junction by geometry node(s) and merge the edges void replaceJunctionByGeometry(GNEJunction* junction, GNEUndoList* undoList); /* @brief trigger recomputation of junction shape and logic @@ -403,15 +416,18 @@ */ void computeJunction(GNEJunction* junction); - /// @brief update junction shapes - void updateJunctionShapes(); - /// @brief inform the net about the need for recomputation void requireRecompute(); + /// @brief check if net has crossings + bool netHasCrossings() const; + /// @brief get pointer to the main App FXApp* getApp(); + /// @brief get net builder + NBNetBuilder* getNetBuilder() const; + /// @brief add edge id to the list of explicit turnarounds void addExplicitTurnaround(std::string id); @@ -428,14 +444,6 @@ /// @brief get shape container ShapeContainer& getShapeContainer(); - /// @brief set additionals File - /// @note used to load additionals throught command line - void setAdditionalsFile(const std::string& additionalFile); - - /// @brief set additionals File - /// @note used to set additionals output file throught command line - void setAdditionalsOutputFile(const std::string& additionalOutputFile); - /**@brief Insert a additional element previously created in GNEAdditionalHandler * @param[in] additional pointer to the additional element to add * @param[in] hardFail enable or disable exception if additional to insert is duplicated @@ -452,6 +460,17 @@ void updateAdditionalID(const std::string& oldID, GNEAdditional* additional); /**@brief Returns the named additional + * @param[in] id The id of the additional to return. + * @param[in] hardFail enable or disable exception if additional to insert is duplicated + */ + GNEAdditional* retrieveAdditional(const std::string& idl, bool hardFail = true) const; + + /**@brief return all additionals + * @param[in] onlySelected Whether to return only selected additionals + * */ + std::vector retrieveAdditionals(bool onlySelected = false); + + /**@brief Returns the named additional * @param[in] type tag with the type of additional * @param[in] id The id of the additional to return. * @return The named additional, or 0 if don't exists @@ -464,19 +483,37 @@ * @param[in] pos the position of the additional to return. * @return The additional id on the location, or "" if don't exists */ - std::string getAdditionalID(SumoXMLTag type, const GNELane* lane, const SUMOReal pos) const; + std::string getAdditionalID(SumoXMLTag type, const GNELane* lane, const double pos) const; /**@brief get vector with additionals * @param[in] type type of additional to get. SUMO_TAG_NOTHING will get all additionals * @return vector with pointers to additionals. */ - std::vector getAdditionals(SumoXMLTag type = SUMO_TAG_NOTHING); + std::vector getAdditionals(SumoXMLTag type = SUMO_TAG_NOTHING) const; /**@brief Returns the number of additionals of the net * @param[in] type type of additional to count. SUMO_TAG_NOTHING will count all additionals * @return Number of additionals of the net */ - int getNumberOfAdditionals(SumoXMLTag type = SUMO_TAG_NOTHING); + int getNumberOfAdditionals(SumoXMLTag type = SUMO_TAG_NOTHING) const; + + /// @brief Returns a reference to a calibrator route finding in all calibrators of net + const GNECalibratorRoute& getGNECalibratorRoute(const std::string& calibratorRouteID) const; + + /// @brief Returns a reference to a calibrator vehicle type finding in all calibrators of net + const GNECalibratorVehicleType& getGNECalibratorVehicleType(const std::string& calibratorVehicleTypeID) const; + + /// @brief Returns a reference to a calibrator flow finding in all calibrators of net + const GNECalibratorFlow& getGNECalibratorFlow(const std::string& calibratorFlowID) const; + + /// @brief Check if exist a route with these ID + bool routeExists(const std::string& routeID) const; + + /// @brief Check if exist a vehicle type with these ID + bool vehicleTypeExists(const std::string& vehicleTypeID) const; + + /// @brief Check if exist a flow with these ID + bool flowExists(const std::string& flowID) const; protected: /// @brief the rtree which contains all GUIGlObjects (so named for historical reasons) @@ -519,6 +556,9 @@ /// @brief whether the net needs recomputation bool myNeedRecompute; + /// @brief Flag to check if additionals must be saved + bool myAdditionalsSaved; + private: /// @brief Initialises the detector wrappers void initDetectors(); @@ -532,8 +572,6 @@ /// @brief inserts a single edge into the net and into the underlying netbuild-container void insertEdge(GNEEdge* edge); - - /// @brief registers a junction with GNENet containers GNEJunction* registerJunction(GNEJunction* junction); @@ -564,7 +602,7 @@ Boundary myZBoundary; /// @brief marker for whether the z-boundary is initialized - static const SUMOReal Z_INITIALIZED; + static const double Z_INITIALIZED; }; #endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEPOI.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEPOI.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEPOI.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEPOI.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,13 +2,13 @@ /// @file GNEPOI.cpp /// @author Jakob Erdmann /// @date Sept 2012 -/// @version $Id: GNEPOI.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: GNEPOI.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A class for visualizing and editing POIS in netedit (adapted from // GUIPointOfInterest and NLHandler) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -58,10 +57,6 @@ #include "GNEChange_Attribute.h" #include "GNEPOI.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members @@ -70,30 +65,25 @@ // =========================================================================== // method definitions // =========================================================================== -GNEPOI::GNEPOI(const std::string& id, const std::string& type, - const RGBColor& color, SUMOReal layer, SUMOReal angle, const std::string& imgFile, - const Position& pos, SUMOReal width, SUMOReal height) : +GNEPOI::GNEPOI(GNENet* net, const std::string& id, const std::string& type, + const RGBColor& color, double layer, double angle, const std::string& imgFile, + const Position& pos, double width, double height) : GUIPointOfInterest(id, type, color, pos, layer, angle, imgFile, width, height), - GNEAttributeCarrier(SUMO_TAG_POI) { + GNEAttributeCarrier(SUMO_TAG_POI, ICON_LOCATEPOI), + myNet(net) { } GNEPOI::~GNEPOI() { } -//void -//GNEPOI::move(Position pos) { -// const Position orig = myNBNode.getPosition(); -// setPosition(pos); -// myNet->refreshElement(this); -// const EdgeVector& incident = getNBNode()->getEdges(); -// for (EdgeVector::const_iterator it = incident.begin(); it != incident.end(); it++) { -// GNEEdge *edge = myNet->retrieveEdge((*it)->getID()); -// edge->updateJunctionPosition(this, orig); -// } -//} -// -// +void +GNEPOI::move(Position pos) { + set(pos); + myNet->refreshElement(this); +} + + //void //GNEPOI::registerMove(GNEUndoList *undoList) { // Position newPos = myNBNode.getPosition(); @@ -182,7 +172,7 @@ void GNEPOI::saveToFile(const std::string& file) { OutputDevice& out = OutputDevice::getDevice(file); - out.writeXMLHeader("pois"); + out.writeXMLHeader("additional", "additional_file.xsd"); GeoConvHelper::writeLocation(out); const std::vector& additionals = GUIGlObject_AbstractAdd::getObjectList(); for (std::vector::const_iterator it = additionals.begin(); it != additionals.end(); ++it) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEPOI.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEPOI.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEPOI.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEPOI.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,7 +2,7 @@ /// @file GNEPOI.h /// @author Jakob Erdmann /// @date Sept 2012 -/// @version $Id: GNEPOI.h 20975 2016-06-15 13:02:40Z palcraft $ +/// @version $Id: GNEPOI.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A class for visualizing and editing POIS in netedit (adapted from // GUIPointOfInterest and NLHandler) @@ -55,19 +55,19 @@ public: /// @brief Constructor - GNEPOI(const std::string& id, const std::string& type, - const RGBColor& color, SUMOReal layer, SUMOReal angle, const std::string& imgFile, - const Position& pos, SUMOReal width, SUMOReal height); + GNEPOI(GNENet* net, const std::string& id, const std::string& type, + const RGBColor& color, double layer, double angle, const std::string& imgFile, + const Position& pos, double width, double height); /// @brief Destructor virtual ~GNEPOI(); - /**@brief reposition the node at pos and informs the edges + /**@brief reposition the POI at pos and informs the edges * @param[in] pos The new position * @note: those operations are not added to the undoList. This is handled in * registerMove to avoids merging lots of tiny movements */ - //void move(Position pos); + void move(Position pos); /// @brief registers completed movement with the undoList //void registerMove(GNEUndoList *undoList); @@ -98,6 +98,10 @@ /// @brief save POIs to file static void saveToFile(const std::string& file); +protected: + /// @brief the net for querying updates + GNENet* myNet; + private: /// @brief Invalidated copy constructor. GNEPOI(const GNEPOI&); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEPoly.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEPoly.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEPoly.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEPoly.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,13 +2,13 @@ /// @file GNEPoly.cpp /// @author Jakob Erdmann /// @date Sept 2012 -/// @version $Id: GNEPoly.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: GNEPoly.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A class for visualizing and editing POIS in netedit (adapted from // GUIPolygon and NLHandler) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -59,10 +58,6 @@ #include "GNEChange_Attribute.h" #include "GNEPoly.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members @@ -72,10 +67,10 @@ // method definitions // =========================================================================== GNEPoly::GNEPoly(GNENet* net, GNEJunction* junction, const std::string& id, const std::string& type, const PositionVector& shape, bool fill, - const RGBColor& color, SUMOReal layer, - SUMOReal angle, const std::string& imgFile) : + const RGBColor& color, double layer, + double angle, const std::string& imgFile) : GUIPolygon(id, type, color, shape, fill, layer, angle, imgFile), - GNEAttributeCarrier(SUMO_TAG_POLY), + GNEAttributeCarrier(SUMO_TAG_POLY, ICON_LOCATEPOLY), myNet(net), myJunction(junction) { } @@ -86,7 +81,7 @@ void GNEPoly::drawGL(const GUIVisualizationSettings& s) const { - const SUMOReal hintSize = 0.8; + const double hintSize = 0.8; GUIPolygon::drawGL(s); // draw geometry hints if (s.scale * hintSize > 1.) { // check whether it is not too small diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEPoly.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEPoly.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEPoly.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEPoly.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,13 +2,13 @@ /// @file GNEPoly.h /// @author Jakob Erdmann /// @date Sept 2012 -/// @version $Id: GNEPoly.h 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: GNEPoly.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A class for visualizing and editing POIS in netedit (adapted from // GUIPolygon and NLHandler) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -103,8 +103,8 @@ /**@brief Constructor */ GNEPoly(GNENet* net, GNEJunction* junction, const std::string& id, const std::string& type, const PositionVector& shape, bool fill, - const RGBColor& color, SUMOReal layer, - SUMOReal angle = 0, const std::string& imgFile = ""); + const RGBColor& color, double layer, + double angle = 0, const std::string& imgFile = ""); /// @brief Destructor virtual ~GNEPoly(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEProhibition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEProhibition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEProhibition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEProhibition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEProhibition.cpp /// @author Pablo Alvarez Lopez /// @date Jun 2016 -/// @version $Id: GNEProhibition.cpp 21117 2016-07-05 12:57:12Z palcraft $ +/// @version $Id: GNEProhibition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A class for visualizing prohibitions between edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,10 +46,6 @@ #include "GNEProhibition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEProhibition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEProhibition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEProhibition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEProhibition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEProhibition.h /// @author Pablo Alvarez Lopez /// @date Jun 2016 -/// @version $Id: GNEProhibition.h 21117 2016-07-05 12:57:12Z palcraft $ +/// @version $Id: GNEProhibition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A class for represent prohibitions between edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEReferenceCounter.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEReferenceCounter.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEReferenceCounter.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEReferenceCounter.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,14 +2,14 @@ /// @file GNEReferenceCounter.h /// @author Jakob Erdmann /// @date Mar 2011 -/// @version $Id: GNEReferenceCounter.h 21786 2016-10-25 10:56:00Z namdre $ +/// @version $Id: GNEReferenceCounter.h 22839 2017-02-03 15:31:17Z palcraft $ /// // A class that counts references to itself // We may wish to keep references to junctions/nodes either in the network or in the undoList // to clean up properly we have to resort to reference counting /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,10 +46,10 @@ */ class GNEReferenceCounter { public: - /// constructor + //// @brief constructor GNEReferenceCounter(): myCount(0) {} - /// destructor + //// @brief destructor ~GNEReferenceCounter() { if (myCount) { // cannot print id here, it already got destructed diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERerouter.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERerouter.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERerouter.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERerouter.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNERerouter.cpp /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNERerouter.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNERerouter.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -51,6 +51,7 @@ #include "GNEViewNet.h" #include "GNERerouter.h" #include "GNERerouterDialog.h" +#include "GNERerouterInterval.h" #include "GNELane.h" #include "GNEEdge.h" #include "GNEViewNet.h" @@ -58,304 +59,17 @@ #include "GNENet.h" #include "GNEChange_Attribute.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // =========================================================================== // member method definitions // =========================================================================== -// --------------------------------------------------------------------------- -// GNERerouter::closingReroute - methods -// --------------------------------------------------------------------------- - -GNERerouter::closingReroute::closingReroute(std::string closedEdgeId, std::vector allowVehicles, std::vector disallowVehicles) : - myClosedEdgeId(closedEdgeId), - myAllowVehicles(allowVehicles), - myDisallowVehicles(disallowVehicles) { -} - - -GNERerouter::closingReroute::~closingReroute() { -} - - -void -GNERerouter::closingReroute::insertAllowVehicle(std::string vehicleid) { - // Check if was already inserted - for (std::vector::iterator i = myAllowVehicles.begin(); i != myAllowVehicles.end(); i++) { - if ((*i) == vehicleid) { - throw ProcessError(vehicleid + " already inserted"); - } - } - // insert in vector - myAllowVehicles.push_back(vehicleid); -} - - -void -GNERerouter::closingReroute::removeAllowVehicle(std::string vehicleid) { - // find and remove - for (std::vector::iterator i = myAllowVehicles.begin(); i != myAllowVehicles.end(); i++) { - if ((*i) == vehicleid) { - myAllowVehicles.erase(i); - return; - } - } - // Throw error if don't exist - throw ProcessError(vehicleid + " not exist"); -} - - -void -GNERerouter::closingReroute::insertDisallowVehicle(std::string vehicleid) { - // Check if was already inserted - for (std::vector::iterator i = myDisallowVehicles.begin(); i != myDisallowVehicles.end(); i++) { - if ((*i) == vehicleid) { - throw ProcessError(vehicleid + " already inserted"); - } - } - // insert in vector - myDisallowVehicles.push_back(vehicleid); -} - - -void -GNERerouter::closingReroute::removeDisallowVehicle(std::string vehicleid) { - // find and remove - for (std::vector::iterator i = myDisallowVehicles.begin(); i != myDisallowVehicles.end(); i++) { - if ((*i) == vehicleid) { - myDisallowVehicles.erase(i); - return; - } - } - // Throw error if don't exist - throw ProcessError(vehicleid + " not exist"); -} - - -std::vector -GNERerouter::closingReroute::getAllowVehicles() const { - return myAllowVehicles; -} - - -std::vector -GNERerouter::closingReroute::getDisallowVehicles() const { - return myDisallowVehicles; -} - - -std::string -GNERerouter::closingReroute::getClosedEdgeId() const { - return myClosedEdgeId; -} - -// --------------------------------------------------------------------------- -// GNERerouter::destProbReroute - methods -// --------------------------------------------------------------------------- - -GNERerouter::destProbReroute::destProbReroute(std::string newDestinationId, SUMOReal probability): - myNewDestinationId(newDestinationId), - myProbability(probability) { -} - - -GNERerouter::destProbReroute::~destProbReroute() { -} - - -std::string -GNERerouter::destProbReroute::getNewDestinationId() const { - return myNewDestinationId; -} - - -SUMOReal -GNERerouter::destProbReroute::getProbability() const { - return myProbability; -} - - -void -GNERerouter::destProbReroute::setProbability(SUMOReal probability) { - if (probability >= 0 && probability <= 1) { - myProbability = probability; - } else { - throw InvalidArgument(toString(probability) + " isn't a probability"); - } -} - -// --------------------------------------------------------------------------- -// GNERerouter::routeProbReroute - methods -// --------------------------------------------------------------------------- - -GNERerouter::routeProbReroute::routeProbReroute(std::string newRouteId, SUMOReal probability) : - myNewRouteId(newRouteId), - myProbability(probability) { -} - - -GNERerouter::routeProbReroute::~routeProbReroute() { -} - - -std::string -GNERerouter::routeProbReroute::getNewRouteId() const { - return myNewRouteId; -} - - -SUMOReal -GNERerouter::routeProbReroute::getProbability() const { - return myProbability; -} - - -void -GNERerouter::routeProbReroute::setProbability(SUMOReal probability) { - if (probability >= 0 && probability <= 1) { - myProbability = probability; - } else { - throw InvalidArgument(toString(probability) + " isn't a probability"); - } -} - -// --------------------------------------------------------------------------- -// GNERerouter::rerouterInterval - methods -// --------------------------------------------------------------------------- - -GNERerouter::rerouterInterval::rerouterInterval(SUMOTime begin, SUMOTime end) : - std::pair(begin, end) { -} - - -GNERerouter::rerouterInterval::~rerouterInterval() { -} - - -void -GNERerouter::rerouterInterval::insertClosingReroutes(GNERerouter::closingReroute* cr) { - // Check if was already inserted - for (std::vector::iterator i = myClosingReroutes.begin(); i != myClosingReroutes.end(); i++) { - if ((*i) == cr) { - throw ProcessError("closing reroute " + cr->getClosedEdgeId() + " already inserted"); - } - } - // insert in vector - myClosingReroutes.push_back(cr); -} - - -void -GNERerouter::rerouterInterval::removeClosingReroutes(GNERerouter::closingReroute* cr) { - // find and remove - for (std::vector::iterator i = myClosingReroutes.begin(); i != myClosingReroutes.end(); i++) { - if ((*i) == cr) { - myClosingReroutes.erase(i); - return; - } - } - // Throw error if don't exist - throw ProcessError("closing reroute " + cr->getClosedEdgeId() + " not exist"); -} - - -void -GNERerouter::rerouterInterval::insertDestProbReroutes(GNERerouter::destProbReroute* dpr) { - // Check if was already inserted - for (std::vector::iterator i = myDestProbReroutes.begin(); i != myDestProbReroutes.end(); i++) { - if ((*i) == dpr) { - throw ProcessError("destiny probability reroute " + dpr->getNewDestinationId() + " already inserted"); - } - } - // insert in vector - myDestProbReroutes.push_back(dpr); -} - - -void -GNERerouter::rerouterInterval::removeDestProbReroutes(GNERerouter::destProbReroute* dpr) { - // find and remove - for (std::vector::iterator i = myDestProbReroutes.begin(); i != myDestProbReroutes.end(); i++) { - if ((*i) == dpr) { - myDestProbReroutes.erase(i); - return; - } - } - // Throw error if don't exist - throw ProcessError("destiny probability reroute " + dpr->getNewDestinationId() + " not exist"); -} - - -void -GNERerouter::rerouterInterval::insertRouteProbReroute(GNERerouter::routeProbReroute* rpr) { - // Check if was already inserted - for (std::vector::iterator i = myRouteProbReroutes.begin(); i != myRouteProbReroutes.end(); i++) { - if ((*i) == rpr) { - throw ProcessError("route probability reroute " + rpr->getNewRouteId() + " already inserted"); - } - } - // insert in vector - myRouteProbReroutes.push_back(rpr); -} - - -void -GNERerouter::rerouterInterval::removeRouteProbReroute(GNERerouter::routeProbReroute* rpr) { - // find and remove - for (std::vector::iterator i = myRouteProbReroutes.begin(); i != myRouteProbReroutes.end(); i++) { - if ((*i) == rpr) { - myRouteProbReroutes.erase(i); - return; - } - } - // Throw error if don't exist - throw ProcessError("route probability reroute " + rpr->getNewRouteId() + " not exist"); -} - - -SUMOTime -GNERerouter::rerouterInterval::getBegin() const { - return first; -} - - -SUMOTime -GNERerouter::rerouterInterval::getEnd() const { - return second; -} - - -std::vector -GNERerouter::rerouterInterval::getClosingReroutes() const { - return myClosingReroutes; -} - - -std::vector -GNERerouter::rerouterInterval::getDestProbReroutes() const { - return myDestProbReroutes; -} - - -std::vector -GNERerouter::rerouterInterval::getRouteProbReroutes() const { - return myRouteProbReroutes; -} - - -// --------------------------------------------------------------------------- -// GNERerouter - methods -// --------------------------------------------------------------------------- - -GNERerouter::GNERerouter(const std::string& id, GNEViewNet* viewNet, Position pos, std::vector edges, const std::string& filename, SUMOReal probability, bool off, const std::set& rerouterIntervals, bool blocked) : - GNEAdditionalSet(id, viewNet, pos, SUMO_TAG_REROUTER, blocked, std::vector(), edges), +GNERerouter::GNERerouter(const std::string& id, GNEViewNet* viewNet, Position pos, std::vector edges, const std::string& filename, double probability, bool off) : + GNEAdditional(id, viewNet, pos, SUMO_TAG_REROUTER, ICON_REROUTER), + myEdges(edges), myFilename(filename), myProbability(probability), - myOff(off), - myRerouterIntervals(rerouterIntervals) { + myOff(off) { // Update geometry; updateGeometry(); // Set colors @@ -385,14 +99,15 @@ // Set position myShape.push_back(myPosition); + /* // Add shape of childs (To avoid graphics errors) for (childEdges::iterator i = myChildEdges.begin(); i != myChildEdges.end(); i++) { myShape.append(i->edge->getLanes().at(0)->getShape()); } - // Update geometry of additionalSet parent + // Update geometry of additional parent updateConnections(); - + */ // Refresh element (neccesary to avoid grabbing problems) myViewNet->getNet()->refreshAdditional(this); } @@ -406,12 +121,13 @@ void GNERerouter::openAdditionalDialog() { - //GNERerouterDialog rerouterDialog(this); + // Open rerouter dialog + GNERerouterDialog(this); } void -GNERerouter::moveAdditionalGeometry(SUMOReal offsetx, SUMOReal offsety) { +GNERerouter::moveAdditionalGeometry(double offsetx, double offsety) { // change Position myPosition = Position(offsetx, offsety); updateGeometry(); @@ -419,7 +135,7 @@ void -GNERerouter::commmitAdditionalGeometryMoved(SUMOReal oldPosx, SUMOReal oldPosy, GNEUndoList* undoList) { +GNERerouter::commmitAdditionalGeometryMoved(double oldPosx, double oldPosy, GNEUndoList* undoList) { undoList->p_begin("position of " + toString(getTag())); undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, toString(myPosition), true, toString(Position(oldPosx, oldPosy)))); undoList->p_end(); @@ -429,58 +145,135 @@ void -GNERerouter::writeAdditional(OutputDevice& device, const std::string&) { +GNERerouter::writeAdditional(OutputDevice& device) const { // Write parameters device.openTag(getTag()); device.writeAttr(SUMO_ATTR_ID, getID()); - device.writeAttr(SUMO_ATTR_EDGES, joinToString(getEdgeChildIds(), " ").c_str()); + // obtain ID's of Edges + std::vector edgeIDs; + for (std::vector::const_iterator i = myEdges.begin(); i != myEdges.end(); i++) { + edgeIDs.push_back((*i)->getID()); + } + device.writeAttr(SUMO_ATTR_EDGES, joinToString(edgeIDs, " ").c_str()); device.writeAttr(SUMO_ATTR_PROB, myProbability); if (!myFilename.empty()) { device.writeAttr(SUMO_ATTR_FILE, myFilename); } + device.writeAttr(SUMO_ATTR_OFF, myOff); device.writeAttr(SUMO_ATTR_X, myPosition.x()); device.writeAttr(SUMO_ATTR_Y, myPosition.y()); if (myBlocked) { device.writeAttr(GNE_ATTR_BLOCK_MOVEMENT, myBlocked); } + // write intervals + for (std::vector::const_iterator i = myRerouterIntervals.begin(); i != myRerouterIntervals.end(); i++) { + device.openTag(i->getTag()); + device.writeAttr(SUMO_ATTR_BEGIN, i->getBegin()); + device.writeAttr(SUMO_ATTR_END, i->getEnd()); + + // write closing lane reroutes + for (std::vector::const_iterator j = i->getClosingLaneReroutes().begin(); j != i->getClosingLaneReroutes().end(); j++) { + device.openTag(j->getTag()); + device.writeAttr(SUMO_ATTR_LANE, j->getClosedLane()->getID()); + device.writeAttr(SUMO_ATTR_ALLOW, getVehicleClassNames(j->getAllowedVehicles())); + device.writeAttr(SUMO_ATTR_DISALLOW, getVehicleClassNames(j->getDisallowedVehicles())); + device.closeTag(); + } + + // write closing reroutes + for (std::vector::const_iterator j = i->getClosingReroutes().begin(); j != i->getClosingReroutes().end(); j++) { + device.openTag(j->getTag()); + device.writeAttr(SUMO_ATTR_EDGE, j->getClosedEdge()->getID()); + device.writeAttr(SUMO_ATTR_ALLOW, getVehicleClassNames(j->getAllowedVehicles())); + device.writeAttr(SUMO_ATTR_DISALLOW, getVehicleClassNames(j->getDisallowedVehicles())); + device.closeTag(); + } + + // write dest prob reroutes + for (std::vector::const_iterator j = i->getDestProbReroutes().begin(); j != i->getDestProbReroutes().end(); j++) { + device.openTag(j->getTag()); + device.writeAttr(SUMO_ATTR_EDGE, j->getNewDestination()->getID()); + device.writeAttr(SUMO_ATTR_PROB, j->getProbability()); + device.closeTag(); + } + + // write route prob reroutes + for (std::vector::const_iterator j = i->getRouteProbReroutes().begin(); j != i->getRouteProbReroutes().end(); j++) { + device.openTag(j->getTag()); + device.writeAttr(SUMO_ATTR_ROUTE, j->getNewRouteId()); + device.writeAttr(SUMO_ATTR_PROB, j->getProbability()); + device.closeTag(); + } + + // Close tag + device.closeTag(); + } + // Close tag device.closeTag(); } -std::string -GNERerouter::getFilename() const { - return myFilename; +void +GNERerouter::addEdgeChild(GNEEdge* edge) { + // Check that edge is valid and doesn't exist previously + if (edge == NULL) { + throw InvalidArgument("Trying to add an empty " + toString(SUMO_TAG_EDGE) + " child in " + toString(getTag()) + " with ID='" + getID() + "'"); + } else if (std::find(myEdges.begin(), myEdges.end(), edge) != myEdges.end()) { + throw InvalidArgument("Trying to add a duplicate " + toString(SUMO_TAG_EDGE) + " child in " + toString(getTag()) + " with ID='" + getID() + "'"); + } else { + myEdges.push_back(edge); + } } -SUMOReal -GNERerouter::getProbability() const { - return myProbability; +void +GNERerouter::removeEdgeChild(GNEEdge* edge) { + // Check that edge is valid and exist previously + if (edge == NULL) { + throw InvalidArgument("Trying to remove an empty " + toString(SUMO_TAG_EDGE) + " child in " + toString(getTag()) + " with ID='" + getID() + "'"); + } else if (std::find(myEdges.begin(), myEdges.end(), edge) == myEdges.end()) { + throw InvalidArgument("Trying to remove a non previously inserted " + toString(SUMO_TAG_EDGE) + " child in " + toString(getTag()) + " with ID='" + getID() + "'"); + } else { + myEdges.erase(std::find(myEdges.begin(), myEdges.end(), edge)); + } } -bool -GNERerouter::getOff() const { - return myOff; +const std::vector& +GNERerouter::getEdgeChilds() const { + return myEdges; } -void -GNERerouter::setFilename(std::string filename) { - myFilename = filename; +bool +GNERerouter::addRerouterInterval(const GNERerouterInterval& rerouterInterval) { + // obtain a copy of current rerouter Intervals to check overlapping + std::vector copyOfMyRerouterIntervals; + copyOfMyRerouterIntervals.push_back(rerouterInterval); + if (checkOverlapping(copyOfMyRerouterIntervals) == true) { + myRerouterIntervals = copyOfMyRerouterIntervals; + return true; + } else { + return false; + } } -void -GNERerouter::setProbability(SUMOReal probability) { - myProbability = probability; +const std::vector& +GNERerouter::getRerouterIntervals() const { + return myRerouterIntervals; } -void -GNERerouter::setOff(bool off) { - myOff = off; +bool +GNERerouter::setRerouterIntervals(const std::vector& rerouterIntervals) { + if (checkOverlapping(rerouterIntervals) == true) { + myRerouterIntervals = rerouterIntervals; + return true; + } else { + return false; + } } @@ -503,9 +296,9 @@ // Draw icon depending of rerouter is or isn't selected if (isAdditionalSelected()) { - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_REROUTERSELECTED), 1); + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_REROUTERSELECTED), 1); } else { - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_REROUTER), 1); + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_REROUTER), 1); } // Pop draw matrix @@ -514,10 +307,13 @@ // Show Lock icon depending of the Edit mode drawLockIcon(0.4); + /* // Draw symbols in every lane - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); + if (s.scale * exaggeration >= 3) { // draw rerouter symbol over all lanes + for (childEdges::const_iterator i = myChildEdges.begin(); i != myChildEdges.end(); i++) { for (int lanePosIt = 0; lanePosIt < (int)i->positionsOverLanes.size(); lanePosIt++) { glPushMatrix(); @@ -542,7 +338,7 @@ glColor3d(0, 0, 0); pfSetPosition(0, 0); pfSetScale(3.f); - SUMOReal w = pfdkGetStringWidth("U"); + double w = pfdkGetStringWidth("U"); glRotated(180, 0, 1, 0); glTranslated(-w / 2., 2, 0); pfDrawString("U"); @@ -562,7 +358,7 @@ // Draw connections drawConnections(); - + */ // Pop name glPopName(); @@ -576,8 +372,14 @@ switch (key) { case SUMO_ATTR_ID: return getAdditionalID(); - case SUMO_ATTR_EDGES: - return joinToString(getEdgeChildIds(), " "); + case SUMO_ATTR_EDGES: { + // obtain ID's of Edges + std::vector edgeIDs; + for (std::vector::const_iterator i = myEdges.begin(); i != myEdges.end(); i++) { + edgeIDs.push_back((*i)->getID()); + } + return joinToString(edgeIDs, " "); + } case SUMO_ATTR_POSITION: return toString(myPosition); case SUMO_ATTR_FILE: @@ -589,7 +391,7 @@ case GNE_ATTR_BLOCK_MOVEMENT: return toString(myBlocked); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -611,7 +413,7 @@ updateGeometry(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -626,33 +428,33 @@ return false; } case SUMO_ATTR_EDGES: { - std::vector edgeIds; - SUMOSAXAttributes::parseStringVector(value, edgeIds); + std::vector edgeIds = GNEAttributeCarrier::parse > (value); // Empty Edges aren't valid if (edgeIds.empty()) { return false; } - // Iterate over parsed edges + // Iterate over parsed edges and check that exists for (int i = 0; i < (int)edgeIds.size(); i++) { if (myViewNet->getNet()->retrieveEdge(edgeIds.at(i), false) == NULL) { return false; } } + // all edges exist, then is valid return true; } case SUMO_ATTR_POSITION: bool ok; return GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, false).size() == 1; case SUMO_ATTR_FILE: - return isValidFileValue(value); + return isValidFilename(value); case SUMO_ATTR_PROB: - return canParse(value); + return canParse(value) && (parse(value)) >= 0 && (parse(value) <= 1); case SUMO_ATTR_OFF: return canParse(value); case GNE_ATTR_BLOCK_MOVEMENT: return canParse(value); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -664,20 +466,25 @@ setAdditionalID(value); break; case SUMO_ATTR_EDGES: { - // Declare variables - std::vector edgeIds; - std::vector edges; + // Declare auxiliar variables + std::vector edgeIds = GNEAttributeCarrier::parse > (value); GNEEdge* edge; - SUMOSAXAttributes::parseStringVector(value, edgeIds); + // first remove references of current rerouter in all edge childs + for (std::vector::iterator i = myEdges.begin(); i != myEdges.end(); i++) { + (*i)->removeGNERerouter(this); + } + // clear previous edges + myEdges.clear(); // Iterate over parsed edges and obtain pointer to edges for (int i = 0; i < (int)edgeIds.size(); i++) { edge = myViewNet->getNet()->retrieveEdge(edgeIds.at(i), false); if (edge) { - edges.push_back(edge); + myEdges.push_back(edge); + edge->addGNERerouter(this); + } else { + throw InvalidArgument("Trying to set an non-valid edge in " + getID()); } } - // Set new childs - setEdgeChilds(edges); break; } case SUMO_ATTR_POSITION: @@ -690,7 +497,7 @@ myFilename = value; break; case SUMO_ATTR_PROB: - myProbability = parse(value); + myProbability = parse(value); break; case SUMO_ATTR_OFF: myOff = parse(value); @@ -700,8 +507,34 @@ getViewNet()->update(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } + +bool +GNERerouter::checkOverlapping(std::vector rerouterIntervals) { + // only can be overlapping if there are more than two elements + if (rerouterIntervals.size() <= 1) { + return true; + } + // first short vector + std::sort(rerouterIntervals.begin(), rerouterIntervals.end()); + + // first check that all Begins are differents + for (std::vector::const_iterator i = (rerouterIntervals.begin() + 1); i != rerouterIntervals.end(); i++) { + if ((i - 1)->getBegin() == i->getBegin()) { + return false; + } + } + // now check that end of every interval isn't overlapped with the begin of the next interval + for (std::vector::const_iterator i = rerouterIntervals.begin(); i != (rerouterIntervals.end() - 1); i++) { + if (i->getEnd() > (i + 1)->getBegin()) { + return false; + } + } + + // all ok, then return true + return true; +} /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERerouterDialog.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERerouterDialog.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERerouterDialog.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERerouterDialog.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNERerouterDialog.cpp /// @author Pablo Alvarez Lopez /// @date April 2016 -/// @version $Id: GNERerouterDialog.cpp 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: GNERerouterDialog.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// /// Dialog for edit rerouters /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -29,21 +29,25 @@ #include #include +#include +#include + #include "GNERerouterDialog.h" #include "GNERerouter.h" +#include "GNERerouterInterval.h" +#include "GNERerouterIntervalDialog.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // =========================================================================== // FOX callback mapping // =========================================================================== FXDEFMAP(GNERerouterDialog) GNERerouterDialogMap[] = { - FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_ACCEPT, GNERerouterDialog::onCmdAccept), - FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_CANCEL, GNERerouterDialog::onCmdCancel), - FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_RESET, GNERerouterDialog::onCmdReset), + FXMAPFUNC(SEL_COMMAND, MID_GNE_REROUTEDIALOG_ADD_INTERVAL, GNERerouterDialog::onCmdAddInterval), + FXMAPFUNC(SEL_CLICKED, MID_GNE_REROUTEDIALOG_TABLE_INTERVAL, GNERerouterDialog::onCmdClickedInterval), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_ACCEPT, GNERerouterDialog::onCmdAccept), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_CANCEL, GNERerouterDialog::onCmdCancel), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_RESET, GNERerouterDialog::onCmdReset), }; // Object implementation @@ -56,6 +60,20 @@ GNERerouterDialog::GNERerouterDialog(GNERerouter* rerouterParent) : GNEAdditionalDialog(rerouterParent, 320, 240), myRerouterParent(rerouterParent) { + + // create add buton and label + FXHorizontalFrame* buttonAndLabelInterval = new FXHorizontalFrame(myContentFrame, GUIDesignAuxiliarHorizontalFrame); + myAddInterval = new FXButton(buttonAndLabelInterval, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_REROUTEDIALOG_ADD_INTERVAL, GUIDesignButtonIcon); + new FXLabel(buttonAndLabelInterval, ("Add new " + toString(SUMO_TAG_CLOSING_LANE_REROUTE) + "s").c_str(), 0, GUIDesignLabelThick); + + // Create table, copy intervals and update table + myIntervalList = new FXTable(myContentFrame, this, MID_GNE_REROUTEDIALOG_TABLE_INTERVAL, GUIDesignTableAdditionals); + myIntervalList->setSelBackColor(FXRGBA(255, 255, 255, 255)); + myIntervalList->setSelTextColor(FXRGBA(0, 0, 0, 255)); + myIntervalList->setEditable(false); + myCopyOfRerouterIntervals = myRerouterParent->getRerouterIntervals(); + updateIntervalTable(); + // Execute additional dialog (To make it modal) execute(); } @@ -65,8 +83,60 @@ } +GNERerouter* +GNERerouterDialog::getRerouterParent() const { + return myRerouterParent; +} + + +bool +GNERerouterDialog::findInterval(double begin, double end) const { + // Iterate over intervals + for (std::vector::const_iterator i = myCopyOfRerouterIntervals.begin(); i != myCopyOfRerouterIntervals.end(); i++) { + if ((i->getBegin() == begin) && (i->getEnd() == end)) { + return true; + } + } + return false; +} + + +bool +GNERerouterDialog::checkModifyInterval(const GNERerouterInterval& rerouterInterval, double newBegin, double newEnd) const { + // first check that values are correct + if ((newBegin < 0) || (newEnd < 0)) { + return false; + } else if ((newBegin == 0) && (newEnd == 0)) { + return false; + } else if (newBegin >= newEnd) { + return false; + } + // declare a temporal copy of rerouter intervals to check overlapping + std::vector auxCopyOfRerouterIntervals = myCopyOfRerouterIntervals; + std::vector::iterator it = std::find(auxCopyOfRerouterIntervals.begin(), auxCopyOfRerouterIntervals.end(), rerouterInterval); + // if wasn't found add it (we're adding a new interval) + if (it == auxCopyOfRerouterIntervals.end()) { + auxCopyOfRerouterIntervals.push_back(GNERerouterInterval(rerouterInterval.getRerouterParent(), newBegin, newEnd)); + } else { + // set new values and check overlapping + it->setBegin(newBegin); + it->setEnd(newEnd); + } + // check overlapping + if (myRerouterParent->checkOverlapping(auxCopyOfRerouterIntervals) == true) { + return true; + } else { + return false; + } +} + + long GNERerouterDialog::onCmdAccept(FXObject*, FXSelector, void*) { + // in this point we need to use GNEChange_RerouterInterval to allow undo/redos of rerouterIntervals + // see Ticket #2844 + // set new intervals into rerouter + myRerouterParent->setRerouterIntervals(myCopyOfRerouterIntervals); // Stop Modal getApp()->stopModal(this, TRUE); return 1; @@ -76,20 +146,95 @@ long GNERerouterDialog::onCmdCancel(FXObject*, FXSelector, void*) { // Stop Modal - getApp()->stopModal(this, TRUE); + getApp()->stopModal(this, FALSE); return 1; } long GNERerouterDialog::onCmdReset(FXObject*, FXSelector, void*) { + // Copy original intervals again and update table + myCopyOfRerouterIntervals = myRerouterParent->getRerouterIntervals(); + updateIntervalTable(); return 1; } -void -GNERerouterDialog::updateTable() { +long +GNERerouterDialog::onCmdAddInterval(FXObject*, FXSelector, void*) { + // create empty rerouter interval and configure it with GNERerouterIntervalDialog + GNERerouterInterval newInterval(myRerouterParent, 0, 0); + if (GNERerouterIntervalDialog(this, newInterval).execute() == TRUE) { + // if new interval was sucesfully configured, add it to myCopyOfRerouterIntervals + myCopyOfRerouterIntervals.push_back(newInterval); + updateIntervalTable(); + return 1; + } else { + return 0; + } +} + +long +GNERerouterDialog::onCmdClickedInterval(FXObject*, FXSelector, void*) { + // check if some delete button was pressed + for (int i = 0; i < (int)myCopyOfRerouterIntervals.size(); i++) { + if (myIntervalList->getItem(i, 2)->hasFocus()) { + // remove row + myIntervalList->removeRows(i); + myCopyOfRerouterIntervals.erase(myCopyOfRerouterIntervals.begin() + i); + return 1; + } + } + // check if some begin or o end button was pressed + for (int i = 0; i < (int)myCopyOfRerouterIntervals.size(); i++) { + if (myIntervalList->getItem(i, 0)->hasFocus() || myIntervalList->getItem(i, 1)->hasFocus()) { + // edit interval + GNERerouterIntervalDialog(this, *(myCopyOfRerouterIntervals.begin() + i)).execute(); + return 1; + } + } + // nothing to do + return 0; +} + + +void +GNERerouterDialog::updateIntervalTable() { + // clear table + myIntervalList->clearItems(); + // set number of rows + myIntervalList->setTableSize(int(myCopyOfRerouterIntervals.size()), 3); + // Configure list + myIntervalList->setVisibleColumns(4); + myIntervalList->setColumnWidth(0, 137); + myIntervalList->setColumnWidth(1, 136); + myIntervalList->setColumnWidth(2, GUIDesignTableIconCellWidth); + myIntervalList->setColumnText(0, toString(SUMO_ATTR_BEGIN).c_str()); + myIntervalList->setColumnText(1, toString(SUMO_ATTR_END).c_str()); + myIntervalList->setColumnText(2, ""); + myIntervalList->getRowHeader()->setWidth(0); + // Declare index for rows and pointer to FXTableItem + int indexRow = 0; + FXTableItem* item = 0; + // sort rerouter intervals + std::sort(myCopyOfRerouterIntervals.begin(), myCopyOfRerouterIntervals.end()); + // iterate over values + for (std::vector::iterator i = myCopyOfRerouterIntervals.begin(); i != myCopyOfRerouterIntervals.end(); i++) { + // Set time + item = new FXTableItem(toString(i->getBegin()).c_str()); + myIntervalList->setItem(indexRow, 0, item); + // Set speed + item = new FXTableItem(toString(i->getEnd()).c_str()); + myIntervalList->setItem(indexRow, 1, item); + // set remove + item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE)); + item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y); + item->setEnabled(false); + myIntervalList->setItem(indexRow, 2, item); + // Update index + indexRow++; + } } /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERerouterDialog.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERerouterDialog.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERerouterDialog.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERerouterDialog.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNERerouterDialog.h /// @author Pablo Alvarez Lopez /// @date April 2016 -/// @version $Id: GNERerouterDialog.h 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: GNERerouterDialog.h 24108 2017-04-27 18:43:30Z behrisch $ /// /// Dialog for edit rerouters /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,6 +38,8 @@ // =========================================================================== class GNERerouter; +class GNERerouterInterval; +class GNERerouterIntervalDialog; // =========================================================================== // class definitions @@ -47,18 +49,26 @@ * @class GNERerouterDialog * @brief Dialog for edit rerouters */ - class GNERerouterDialog : public GNEAdditionalDialog { /// @brief FOX-declaration FXDECLARE(GNERerouterDialog) public: - // Constructor + /// @brief Constructor GNERerouterDialog(GNERerouter* rerouterParent); - // destructor + /// @brief destructor ~GNERerouterDialog(); + /// @brief get rerouter parent + GNERerouter* getRerouterParent() const; + + /// @brief check if a interval exists + bool findInterval(double begin, double end) const; + + /// @brief check if begin and end of an existent interval can be modified + bool checkModifyInterval(const GNERerouterInterval& rerouterInterval, double newBegin, double newEnd) const; + /// @name FOX-callbacks /// @{ /// @brief event after press accept button @@ -69,6 +79,12 @@ /// @brief event after press reset button long onCmdReset(FXObject*, FXSelector, void*); + + /// @brief add new interval + long onCmdAddInterval(FXObject*, FXSelector, void*); + + /// @brief remove or edit interval + long onCmdClickedInterval(FXObject*, FXSelector, void*); /// @} protected: @@ -78,10 +94,19 @@ /// @brief pointer to rerouter parent GNERerouter* myRerouterParent; -private: + /// @brief button for add new interval + FXButton* myAddInterval; + + /// @brief list with intervals + FXTable* myIntervalList; + + /// @brief set with a copy of rerouter intervals + std::vector myCopyOfRerouterIntervals; + /// @brief update data table - void updateTable(); + void updateIntervalTable(); +private: /// @brief Invalidated copy constructor. GNERerouterDialog(const GNERerouterDialog&); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERerouter.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERerouter.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERerouter.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERerouter.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNERerouter.h /// @author Pablo Alvarez Lopez /// @date Nov 2015 -/// @version $Id: GNERerouter.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNERerouter.h 24108 2017-04-27 18:43:30Z behrisch $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -30,194 +30,24 @@ #include #endif -#include "GNEAdditionalSet.h" +#include "GNEAdditional.h" // =========================================================================== // class declarations // =========================================================================== class GNEEdge; +class GNERerouterInterval; // =========================================================================== // class definitions // =========================================================================== /** * @class GNERerouter - * ------------ + * Rerouter changes the route of a vehicle as soon as the vehicle moves onto a specified edge. */ -class GNERerouter : public GNEAdditionalSet { +class GNERerouter : public GNEAdditional { public: - - // =========================================================================== - // class closingReroute - // =========================================================================== - - class closingReroute { - public: - /// @brief constructor - closingReroute(std::string closedEdgeId, std::vector allowVehicles, std::vector disallowVehicles); - - /// @brief destructor - ~closingReroute(); - - /// @brief insert an allow vehicle - /// @throw ProcessError if allowed vehicle was already inserted - void insertAllowVehicle(std::string vehicleid); - - /// @brief remove a previously inserted allow vehicle - /// @throw ProcessError if allowed vehicle cannot be found in the container - void removeAllowVehicle(std::string vehicleid); - - /// @brief insert a disallow vehicle - /// @throw ProcessError if disallowed vehicle was already inserted - void insertDisallowVehicle(std::string vehicleid); - - /// @brief remove a previously inserted disallow vehicle - /// @throw ProcessError if disallowed vehicle cannot be found in the container - void removeDisallowVehicle(std::string vehicleid); - - /// @brief get allow vehicles - std::vector getAllowVehicles() const; - - /// @brief get disallow vehicles - std::vector getDisallowVehicles() const; - - /// @brief get closed edge Id - std::string getClosedEdgeId() const; - - private: - /// @brief edge ID - std::string myClosedEdgeId; - - /// @brief vector of allow vehicles - std::vector myAllowVehicles; - - /// @brief vector of disallow vehicles - std::vector myDisallowVehicles; - }; - - // =========================================================================== - // class destProbReroute - // =========================================================================== - - class destProbReroute { - public: - /// @brief constructor - destProbReroute(std::string newDestinationId, SUMOReal probability); - - /// @brief destructor - ~destProbReroute(); - - /// @brief id of new edge destination - std::string getNewDestinationId() const; - - /// @brief get probability - SUMOReal getProbability() const; - - /// @brief set probability - /// @throw InvalidArgument if probability isn't valid - void setProbability(SUMOReal probability); - - private: - /// @brief id of new edge destination - std::string myNewDestinationId; - - /// @brief probability with which a vehicle will use the given edge as destination - SUMOReal myProbability; - }; - - // =========================================================================== - // class routeProbReroute - // =========================================================================== - - class routeProbReroute { - public: - /// @brief constructor - routeProbReroute(std::string newRouteId, SUMOReal probability); - - /// @brief destructor - ~routeProbReroute(); - - /// @brief get new route id - std::string getNewRouteId() const; - - /// @brief get probability - SUMOReal getProbability() const; - - /// @brief set probability - /// @throw InvalidArgument if probability isn't valid - void setProbability(SUMOReal probability); - - private: - /// @brief id of new route - std::string myNewRouteId; - - /// @brief probability with which a vehicle will use the given edge as destination - SUMOReal myProbability; - }; - - // =========================================================================== - // class rerouterInterval - // =========================================================================== - - class rerouterInterval : public std::pair { - public: - /// @brief constructor - rerouterInterval(SUMOTime begin, SUMOTime end); - - /// @brief destructor - ~rerouterInterval(); - - /// @brief insert a new closing reroute - /// @throw ProcessError if closing reroute was already inserted - void insertClosingReroutes(closingReroute* cr); - - /// @brief remove a previously inserted closing reroute - /// @throw ProcessError if closing reroute cannot be found in the container - void removeClosingReroutes(closingReroute* cr); - - /// @brief insert destiny probability reroute - /// @throw ProcessError if destiny probability reroute was already inserted - void insertDestProbReroutes(destProbReroute* dpr); - - /// @brief remove a previously inserted destiny probability reroute - /// @throw ProcessError if destiny probability reroute cannot be found in the container - void removeDestProbReroutes(destProbReroute* dpr); - - /// @brief insert route probability reroute - /// @throw ProcessError if route probability reroute was already inserted - void insertRouteProbReroute(routeProbReroute* rpr); - - /// @brief remove a previously inserted route probability reroute - /// @throw ProcessError if route probability reroute cannot be found in the container - void removeRouteProbReroute(routeProbReroute* rpr); - - /// @brief get time begin - SUMOTime getBegin() const; - - /// @brief get time end - SUMOTime getEnd() const; - - /// @brief get closing reroutes - std::vector getClosingReroutes() const; - - /// @brief get destiny probability reroutes - std::vector getDestProbReroutes() const; - - /// @brief get reoute probability reroutes - std::vector getRouteProbReroutes() const; - - private: - /// @brief vector with the closingReroutes - std::vector myClosingReroutes; - - /// @brief vector with the destProbReroutes - std::vector myDestProbReroutes; - - /// @brief vector with the routeProbReroutes - std::vector myRouteProbReroutes; - }; - /**@brief Constructor * @param[in] id The storage of gl-ids to get the one for this lane representation from * @param[in] viewNet pointer to GNEViewNet of this additional element belongs @@ -226,10 +56,8 @@ * @param[in] filename The path to the definition file * @param[in] probability The probability for vehicle rerouting * @param[in] off Whether the router should be inactive initially - * @param[in] rerouterIntervals set with the rerouter intervals - * @param[in] blocked set initial blocking state of item */ - GNERerouter(const std::string& id, GNEViewNet* viewNet, Position pos, std::vector edges, const std::string& filename, SUMOReal probability, bool off, const std::set& rerouterIntervals, bool blocked); + GNERerouter(const std::string& id, GNEViewNet* viewNet, Position pos, std::vector edges, const std::string& filename, double probability, bool off); /// @brief Destructor ~GNERerouter(); @@ -245,48 +73,44 @@ void openAdditionalDialog(); /// @brief change the position of the rerouter geometry - void moveAdditionalGeometry(SUMOReal offsetx, SUMOReal offsety); + void moveAdditionalGeometry(double offsetx, double offsety); /// @brief updated geometry changes in the attributes of additional - void commmitAdditionalGeometryMoved(SUMOReal oldPosx, SUMOReal oldPosy, GNEUndoList* undoList); + void commmitAdditionalGeometryMoved(double oldPosx, double oldPosy, GNEUndoList* undoList); /**@brief writte additional element into a xml file * @param[in] device device in which write parameters of additional element */ - void writeAdditional(OutputDevice& device, const std::string&); - - /// @brief add edge to rerouter - /// @return true if was sucesfully inserted, false if is duplicated - bool addEdge(GNEEdge* edge); - - /// @brief remove edge of rerouter - /// @return true if was scuesfully removed, false if wasn't found - bool removeEdge(GNEEdge* edge); + void writeAdditional(OutputDevice& device) const; - /// @brief get filename of rerouter - std::string getFilename() const; + /// @brief add edge child + void addEdgeChild(GNEEdge* edge); - /// @brief get probability of rerouter - SUMOReal getProbability() const; + /// @brief remove edge child + void removeEdgeChild(GNEEdge* edge); - /// @brief get attribute to enable or disable inactive initially - bool getOff() const; + /// @brief get edge chidls + const std::vector& getEdgeChilds() const; - /// @brief set filename of rerouter - void setFilename(std::string filename); + /**@brief add rerouter interval + * @return true if was sucesfully added, false if wasn't added due overlapping + */ + bool addRerouterInterval(const GNERerouterInterval& rerouterInterval); - /// @brief set probability of rerouter - void setProbability(SUMOReal probability); + /// @brief get rerouter intervals + const std::vector& getRerouterIntervals() const; - /// @brief set attribute to enable or disable inactive initially - void setOff(bool off); + /**@brief set rerouter intervals + * @return true if was sucesfully set, false if wasn't set due overlapping + */ + bool setRerouterIntervals(const std::vector& rerouterIntervals); /// @name inherited from GUIGlObject /// @{ /// @brief Returns the name of the parent object /// @return This object's parent id - const std::string& getParentName() const; + /**@brief Draws the object * @param[in] s The settings for the current view (may influence drawing) * @see GUIGlObject::drawGL @@ -317,18 +141,24 @@ bool isValid(SumoXMLAttr key, const std::string& value); /// @} + /// @brief check overlapping of a vector of rerouter intervals + bool checkOverlapping(std::vector rerouterIntervals); + protected: + /// @brief edges of Rerouter + std::vector myEdges; + /// @brief filename of rerouter std::string myFilename; /// @brief probability of rerouter - SUMOReal myProbability; + double myProbability; /// @brief attribute to enable or disable inactive initially bool myOff; - /// @brief set with the rerouterInterval - std::set myRerouterIntervals; + /// @brief set with the GNERerouterInterval + std::vector myRerouterIntervals; private: /// @brief set attribute after validation diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERerouterInterval.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERerouterInterval.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERerouterInterval.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERerouterInterval.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,303 @@ +/****************************************************************************/ +/// @file GNERerouterInterval.cpp +/// @author Pablo Alvarez Lopez +/// @date Jan 2017 +/// @version $Id: GNERerouterInterval.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include + +#include "GNERerouterInterval.h" +#include "GNEEdge.h" +#include "GNELane.h" + + +// =========================================================================== +// member method definitions +// =========================================================================== + +GNERerouterInterval::GNERerouterInterval(GNERerouter* rerouterParent, double begin, double end) : + myRerouterParent(rerouterParent), + myBegin(begin), + myEnd(end), + myTag(SUMO_TAG_INTERVAL) { + assert(begin <= end); +} + + +GNERerouterInterval::~GNERerouterInterval() { +} + + +bool +GNERerouterInterval::insertClosinLanegReroutes(const GNEClosingLaneReroute& clr) { + if (std::find(myClosingLaneReroutes.begin(), myClosingLaneReroutes.end(), clr) != myClosingLaneReroutes.end()) { + WRITE_WARNING(toString(clr.getTag()) + " for lane '" + clr.getClosedLane()->getID() + "' was already inserted; duplicates aren't allowed"); + return false; + } else { + myClosingLaneReroutes.push_back(clr); + return true; + } +} + + +bool +GNERerouterInterval::removeClosingLaneReroutes(const GNEClosingLaneReroute& clr) { + std::vector::iterator i = std::find(myClosingLaneReroutes.begin(), myClosingLaneReroutes.end(), clr); + if (i == myClosingLaneReroutes.end()) { + WRITE_WARNING(toString(clr.getTag()) + " for lane '" + clr.getClosedLane()->getID() + "' wasn't previously inserted"); + return false; + } else { + myClosingLaneReroutes.erase(i); + return true; + } +} + + +bool +GNERerouterInterval::insertClosingReroutes(const GNEClosingReroute& cr) { + if (std::find(myClosingReroutes.begin(), myClosingReroutes.end(), cr) != myClosingReroutes.end()) { + WRITE_WARNING(toString(cr.getTag()) + " for edge '" + cr.getClosedEdge()->getID() + "' was already inserted; duplicates aren't allowed"); + return false; + } else { + myClosingReroutes.push_back(cr); + return true; + } +} + + +bool +GNERerouterInterval::removeClosingReroutes(const GNEClosingReroute& cr) { + std::vector::iterator i = std::find(myClosingReroutes.begin(), myClosingReroutes.end(), cr); + if (i == myClosingReroutes.end()) { + WRITE_WARNING(toString(cr.getTag()) + " for edge '" + cr.getClosedEdge()->getID() + "' wasn't previously inserted"); + return false; + } else { + myClosingReroutes.erase(i); + return true; + } +} + + +bool +GNERerouterInterval::insertDestProbReroutes(const GNEDestProbReroute& dpr) { + if (std::find(myDestProbReroutes.begin(), myDestProbReroutes.end(), dpr) != myDestProbReroutes.end()) { + WRITE_WARNING(toString(dpr.getTag()) + " to edge '" + dpr.getNewDestination()->getID() + "' was already inserted; duplicates aren't allowed"); + return false; + } else { + myDestProbReroutes.push_back(dpr); + return true; + } +} + + +bool +GNERerouterInterval::removeDestProbReroutes(const GNEDestProbReroute& dpr) { + std::vector::iterator i = std::find(myDestProbReroutes.begin(), myDestProbReroutes.end(), dpr); + if (i == myDestProbReroutes.end()) { + WRITE_WARNING(toString(dpr.getTag()) + " to edge '" + dpr.getNewDestination()->getID() + "' wasn't previously inserted"); + return false; + } else { + myDestProbReroutes.erase(i); + return true; + } +} + + +bool +GNERerouterInterval::insertRouteProbReroute(const GNERouteProbReroute& rpr) { + if (std::find(myRouteProbReroutes.begin(), myRouteProbReroutes.end(), rpr) != myRouteProbReroutes.end()) { + WRITE_WARNING(toString(rpr.getTag()) + " for route '" + rpr.getNewRouteId() + "' was already inserted; duplicates aren't allowed"); + return false; + } else { + myRouteProbReroutes.push_back(rpr); + return true; + } +} + + +bool +GNERerouterInterval::removeRouteProbReroute(const GNERouteProbReroute& rpr) { + std::vector::iterator i = std::find(myRouteProbReroutes.begin(), myRouteProbReroutes.end(), rpr); + if (i == myRouteProbReroutes.end()) { + WRITE_WARNING(toString(rpr.getTag()) + " for route '" + rpr.getNewRouteId() + "' wasn't previously inserted"); + return false; + } else { + myRouteProbReroutes.erase(i); + return true; + } +} + + +GNERerouter* +GNERerouterInterval::getRerouterParent() const { + return myRerouterParent; +} + + +SumoXMLTag +GNERerouterInterval::getTag() const { + return myTag; +} + + +double +GNERerouterInterval::getBegin() const { + return myBegin; +} + + +double +GNERerouterInterval::getEnd() const { + return myEnd; +} + + +void +GNERerouterInterval::setBegin(double begin) { + myBegin = begin; +} + + +void +GNERerouterInterval::setEnd(double end) { + myEnd = end; +} + + +const std::vector& +GNERerouterInterval::getClosingLaneReroutes() const { + return myClosingLaneReroutes; +} + + +const std::vector& +GNERerouterInterval::getClosingReroutes() const { + return myClosingReroutes; +} + + +const std::vector& +GNERerouterInterval::getDestProbReroutes() const { + return myDestProbReroutes; +} + + +const std::vector& +GNERerouterInterval::getRouteProbReroutes() const { + return myRouteProbReroutes; +} + + +void +GNERerouterInterval::setClosingLaneReroutes(const std::vector& closingLaneReroutes) { + myClosingLaneReroutes = closingLaneReroutes; +} + + +void +GNERerouterInterval::setClosingReroutes(const std::vector& closingReroutes) { + myClosingReroutes = closingReroutes; +} + + +void +GNERerouterInterval::setDestProbReroutes(const std::vector& destProbReroutes) { + myDestProbReroutes = destProbReroutes; +} + + +void +GNERerouterInterval::setRouteProbReroutes(const std::vector& rerouteProbabilityReroutes) { + myRouteProbReroutes = rerouteProbabilityReroutes; +} + + +GNERerouterInterval& +GNERerouterInterval::operator=(const GNERerouterInterval& rerouterInterval) { + if (this != &rerouterInterval) { + myRerouterParent = rerouterInterval.myRerouterParent; + myBegin = rerouterInterval.myBegin; + myEnd = rerouterInterval.myEnd; + } + return *this; +} + + +bool +GNERerouterInterval::operator==(const GNERerouterInterval& rerouterInterval) const { + return (myBegin == rerouterInterval.myBegin) && (myEnd == rerouterInterval.myEnd); +} + + +bool +GNERerouterInterval::operator>(const GNERerouterInterval& rerouterInterval) const { + if (myBegin > rerouterInterval.myBegin) { + return true; + } else if (myBegin == rerouterInterval.myBegin) { + return (myEnd > rerouterInterval.myEnd); + } else { + return false; + } +} + + +bool +GNERerouterInterval::operator>=(const GNERerouterInterval& rerouterInterval) const { + if (myBegin > rerouterInterval.myBegin) { + return true; + } else if (myBegin == rerouterInterval.myBegin) { + return (myEnd >= rerouterInterval.myEnd); + } else { + return false; + } +} + + +bool +GNERerouterInterval::operator<(const GNERerouterInterval& rerouterInterval) const { + if (myBegin < rerouterInterval.myBegin) { + return true; + } else if (myBegin == rerouterInterval.myBegin) { + return (myEnd < rerouterInterval.myEnd); + } else { + return false; + } +} + + +bool +GNERerouterInterval::operator<=(const GNERerouterInterval& rerouterInterval) const { + if (myBegin < rerouterInterval.myBegin) { + return true; + } else if (myBegin == rerouterInterval.myBegin) { + return (myEnd <= rerouterInterval.myEnd); + } else { + return false; + } +} + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERerouterIntervalDialog.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERerouterIntervalDialog.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERerouterIntervalDialog.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERerouterIntervalDialog.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,768 @@ +/****************************************************************************/ +/// @file GNERerouterIntervalDialog.cpp +/// @author Pablo Alvarez Lopez +/// @date eb 2017 +/// @version $Id: GNERerouterIntervalDialog.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// Dialog for edit rerouter intervals +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include + +#include "GNERerouterIntervalDialog.h" +#include "GNERerouterDialog.h" +#include "GNERerouter.h" +#include "GNERerouterInterval.h" +#include "GNERerouterInterval.h" +#include "GNEClosingLaneReroute.h" +#include "GNEClosingReroute.h" +#include "GNEDestProbReroute.h" +#include "GNERouteProbReroute.h" +#include "GNEEdge.h" +#include "GNELane.h" +#include "GNEViewNet.h" +#include "GNENet.h" + + +// =========================================================================== +// FOX callback mapping +// =========================================================================== + +FXDEFMAP(GNERerouterIntervalDialog) GNERerouterIntervalDialogMap[] = { + FXMAPFUNC(SEL_COMMAND, MID_GNE_REROUTEDIALOG_ADD_CLOSINGLANEREROUTE, GNERerouterIntervalDialog::onCmdAddClosingLaneReroute), + FXMAPFUNC(SEL_COMMAND, MID_GNE_REROUTEDIALOG_ADD_CLOSINGREROUTE, GNERerouterIntervalDialog::onCmdAddClosingReroute), + FXMAPFUNC(SEL_COMMAND, MID_GNE_REROUTEDIALOG_ADD_DESTPROBREROUTE, GNERerouterIntervalDialog::onCmdAddDestProbReroute), + FXMAPFUNC(SEL_COMMAND, MID_GNE_REROUTEDIALOG_ADD_ROUTEPROBREROUTE, GNERerouterIntervalDialog::onCmdAddRouteProbReroute), + FXMAPFUNC(SEL_CLICKED, MID_GNE_REROUTEDIALOG_TABLE_CLOSINGLANEREROUTE, GNERerouterIntervalDialog::onCmdClickedClosingLaneReroute), + FXMAPFUNC(SEL_CLICKED, MID_GNE_REROUTEDIALOG_TABLE_CLOSINGREROUTE, GNERerouterIntervalDialog::onCmdClickedClosingReroute), + FXMAPFUNC(SEL_CLICKED, MID_GNE_REROUTEDIALOG_TABLE_DESTPROBREROUTE, GNERerouterIntervalDialog::onCmdClickedDestProbReroute), + FXMAPFUNC(SEL_CLICKED, MID_GNE_REROUTEDIALOG_TABLE_ROUTEPROBREROUTE, GNERerouterIntervalDialog::onCmdClickedRouteProbReroute), + FXMAPFUNC(SEL_CHANGED, MID_GNE_REROUTEDIALOG_TABLE_CLOSINGLANEREROUTE, GNERerouterIntervalDialog::onCmdEditClosingLaneReroute), + FXMAPFUNC(SEL_CHANGED, MID_GNE_REROUTEDIALOG_TABLE_CLOSINGREROUTE, GNERerouterIntervalDialog::onCmdEditClosingReroute), + FXMAPFUNC(SEL_CHANGED, MID_GNE_REROUTEDIALOG_TABLE_DESTPROBREROUTE, GNERerouterIntervalDialog::onCmdEditDestProbReroute), + FXMAPFUNC(SEL_CHANGED, MID_GNE_REROUTEDIALOG_TABLE_ROUTEPROBREROUTE, GNERerouterIntervalDialog::onCmdEditRouteProbReroute), + FXMAPFUNC(SEL_COMMAND, MID_GNE_REROUTEDIALOG_EDIT_INTERVAL, GNERerouterIntervalDialog::onCmdChangeBeginEnd), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_ACCEPT, GNERerouterIntervalDialog::onCmdAccept), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_CANCEL, GNERerouterIntervalDialog::onCmdCancel), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_RESET, GNERerouterIntervalDialog::onCmdReset), +}; + +// Object implementation +FXIMPLEMENT(GNERerouterIntervalDialog, FXDialogBox, GNERerouterIntervalDialogMap, ARRAYNUMBER(GNERerouterIntervalDialogMap)) + +// =========================================================================== +// member method definitions +// =========================================================================== + +GNERerouterIntervalDialog::GNERerouterIntervalDialog(GNERerouterDialog* rerouterDialog, GNERerouterInterval& rerouterInterval) : + GNEAdditionalDialog(rerouterInterval.getRerouterParent(), 640, 480), + myRerouterDialogParent(rerouterDialog), + myRerouterInterval(&rerouterInterval), + myBeginEndValid(true), + myClosingLaneReroutesValid(true), + myClosingReroutesValid(true), + myDestProbReroutesValid(true), + myRouteProbReroutesValid(true) { + // change default header + changeAdditionalDialogHeader("Edit " + toString(rerouterInterval.getTag()) + " of " + toString(rerouterInterval.getRerouterParent()->getTag()) + + " '" + rerouterInterval.getRerouterParent()->getID() + "'"); + + // Create auxiliar frames for tables + FXHorizontalFrame* columns = new FXHorizontalFrame(myContentFrame, GUIDesignUniformHorizontalFrame); + FXVerticalFrame* columnLeft = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame); + FXVerticalFrame* columnRight = new FXVerticalFrame(columns, GUIDesignAuxiliarFrame); + + // create horizontal frame for begin and end label + FXHorizontalFrame* beginEndElementsLeft = new FXHorizontalFrame(columnLeft, GUIDesignAuxiliarHorizontalFrame); + new FXLabel(beginEndElementsLeft, (toString(SUMO_ATTR_BEGIN) + " and " + toString(SUMO_ATTR_END) + " of " + toString(rerouterInterval.getTag())).c_str(), 0, GUIDesignLabelLeftThick); + myCheckLabel = new FXLabel(beginEndElementsLeft, "", 0, GUIDesignLabelIcon32x32Thicked); + + // create horizontal frame for begin and end text fields + FXHorizontalFrame* beginEndElementsRight = new FXHorizontalFrame(columnRight, GUIDesignAuxiliarHorizontalFrame); + myBeginTextField = new FXTextField(beginEndElementsRight, GUIDesignTextFieldNCol, this, MID_GNE_REROUTEDIALOG_EDIT_INTERVAL, GUIDesignTextFieldReal); + myBeginTextField->setText(toString(myRerouterInterval->getBegin()).c_str()); + myEndTextField = new FXTextField(beginEndElementsRight, GUIDesignTextFieldNCol, this, MID_GNE_REROUTEDIALOG_EDIT_INTERVAL, GUIDesignTextFieldReal); + myEndTextField->setText(toString(myRerouterInterval->getEnd()).c_str()); + + // set interval flag depending if interval exists + if (myRerouterDialogParent->findInterval(myRerouterInterval->getBegin(), myRerouterInterval->getEnd())) { + myCheckLabel->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT)); + myBeginEndValid = true; + } else { + myCheckLabel->setIcon(GUIIconSubSys::getIcon(ICON_ERROR)); + myBeginEndValid = false; + } + + // Create labels and tables + FXHorizontalFrame* buttonAndLabelClosingLaneReroute = new FXHorizontalFrame(columnLeft, GUIDesignAuxiliarHorizontalFrame); + myAddClosingLaneReroutes = new FXButton(buttonAndLabelClosingLaneReroute, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_REROUTEDIALOG_ADD_CLOSINGLANEREROUTE, GUIDesignButtonIcon); + new FXLabel(buttonAndLabelClosingLaneReroute, ("Add new " + toString(SUMO_TAG_CLOSING_LANE_REROUTE) + "s").c_str(), 0, GUIDesignLabelThick); + myClosingLaneRerouteList = new FXTable(columnLeft, this, MID_GNE_REROUTEDIALOG_TABLE_CLOSINGLANEREROUTE, GUIDesignTableAdditionals); + myClosingLaneRerouteList->setSelBackColor(FXRGBA(255, 255, 255, 255)); + myClosingLaneRerouteList->setSelTextColor(FXRGBA(0, 0, 0, 255)); + + FXHorizontalFrame* buttonAndLabelClosinReroute = new FXHorizontalFrame(columnLeft, GUIDesignAuxiliarHorizontalFrame); + myAddClosingReroutes = new FXButton(buttonAndLabelClosinReroute, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_REROUTEDIALOG_ADD_CLOSINGREROUTE, GUIDesignButtonIcon); + new FXLabel(buttonAndLabelClosinReroute, ("Add new " + toString(SUMO_TAG_CLOSING_REROUTE) + "s").c_str(), 0, GUIDesignLabelThick); + myClosingRerouteList = new FXTable(columnLeft, this, MID_GNE_REROUTEDIALOG_TABLE_CLOSINGREROUTE, GUIDesignTableAdditionals); + myClosingRerouteList->setSelBackColor(FXRGBA(255, 255, 255, 255)); + myClosingRerouteList->setSelTextColor(FXRGBA(0, 0, 0, 255)); + + FXHorizontalFrame* buttonAndLabelDestProbReroute = new FXHorizontalFrame(columnRight, GUIDesignAuxiliarHorizontalFrame); + myAddDestProbReroutes = new FXButton(buttonAndLabelDestProbReroute, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_REROUTEDIALOG_ADD_DESTPROBREROUTE, GUIDesignButtonIcon); + new FXLabel(buttonAndLabelDestProbReroute, ("Add new " + toString(SUMO_TAG_DEST_PROB_REROUTE) + "s").c_str(), 0, GUIDesignLabelThick); + myDestProbRerouteList = new FXTable(columnRight, this, MID_GNE_REROUTEDIALOG_TABLE_DESTPROBREROUTE, GUIDesignTableAdditionals); + myDestProbRerouteList->setSelBackColor(FXRGBA(255, 255, 255, 255)); + myDestProbRerouteList->setSelTextColor(FXRGBA(0, 0, 0, 255)); + + FXHorizontalFrame* buttonAndLabelRouteProbReroute = new FXHorizontalFrame(columnRight, GUIDesignAuxiliarHorizontalFrame); + myAddRouteProbReroute = new FXButton(buttonAndLabelRouteProbReroute, "", GUIIconSubSys::getIcon(ICON_ADD), this, MID_GNE_REROUTEDIALOG_ADD_ROUTEPROBREROUTE, GUIDesignButtonIcon); + new FXLabel(buttonAndLabelRouteProbReroute, ("Add new " + toString(SUMO_TAG_ROUTE_PROB_REROUTE) + "s").c_str(), 0, GUIDesignLabelThick); + myRouteProbRerouteList = new FXTable(columnRight, this, MID_GNE_REROUTEDIALOG_TABLE_ROUTEPROBREROUTE, GUIDesignTableAdditionals); + myRouteProbRerouteList->setSelBackColor(FXRGBA(255, 255, 255, 255)); + myRouteProbRerouteList->setSelTextColor(FXRGBA(0, 0, 0, 255)); + + // copy Elements + myCopyOfClosingLaneReroutes = myRerouterInterval->getClosingLaneReroutes(); + myCopyOfClosingReroutes = myRerouterInterval->getClosingReroutes(); + myCopyOfDestProbReroutes = myRerouterInterval->getDestProbReroutes(); + myCopyOfRouteProbReroutes = myRerouterInterval->getRouteProbReroutes(); + + // update tables + updateClosingLaneReroutesTable(); + updateClosingReroutesTable(); + updateDestProbReroutesTable(); + updateRouteProbReroutesTable(); +} + + +GNERerouterIntervalDialog::~GNERerouterIntervalDialog() { +} + + +long +GNERerouterIntervalDialog::onCmdAccept(FXObject*, FXSelector, void*) { + if (myBeginEndValid == false) { + // write warning if netedit is running in testing mode + if (myRerouterDialogParent->getRerouterParent()->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Opening FXMessageBox of type 'warning'"); + } + // open warning Box + FXMessageBox::warning(getApp(), MBOX_OK, + ("Error updating " + toString(myRerouterInterval->getTag()) + " of " + toString(myRerouterInterval->getRerouterParent()->getTag())).c_str(), "%s", + (toString(myRerouterInterval->getRerouterParent()->getTag()) + "'s " + toString(myRerouterInterval->getTag()) + + " cannot be updated because " + toString(myRerouterInterval->getTag()) + " defined by " + toString(SUMO_ATTR_BEGIN) + " and " + toString(SUMO_ATTR_END) + " is invalid.").c_str()); + + + // write warning if netedit is running in testing mode + if (myRerouterDialogParent->getRerouterParent()->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'"); + } + return 0; + } else if (myCopyOfClosingLaneReroutes.empty() && myCopyOfClosingReroutes.empty() && myCopyOfDestProbReroutes.empty() && myCopyOfRouteProbReroutes.empty()) { + // write warning if netedit is running in testing mode + if (myRerouterDialogParent->getRerouterParent()->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Opening FXMessageBox of type 'warning'"); + } + // open warning Box + FXMessageBox::warning(getApp(), MBOX_OK, + ("Error updating " + toString(myRerouterInterval->getTag()) + " of " + toString(myRerouterInterval->getRerouterParent()->getTag())).c_str(), "%s", + (toString(myRerouterInterval->getRerouterParent()->getTag()) + "'s " + toString(myRerouterInterval->getTag()) + + " cannot be updated because at least one " + toString(myRerouterInterval->getTag()) + "'s element must be defined.").c_str()); + // write warning if netedit is running in testing mode + if (myRerouterDialogParent->getRerouterParent()->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'"); + } + return 0; + } else if (myClosingLaneReroutesValid == false) { + // write warning if netedit is running in testing mode + if (myRerouterDialogParent->getRerouterParent()->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Opening FXMessageBox of type 'warning'"); + } + // open warning Box + FXMessageBox::warning(getApp(), MBOX_OK, + ("Error updating " + toString(myRerouterInterval->getTag()) + " of " + toString(myRerouterInterval->getRerouterParent()->getTag())).c_str(), "%s", + (toString(myRerouterInterval->getRerouterParent()->getTag()) + "'s " + toString(myRerouterInterval->getTag()) + + " cannot be updated because there are invalid " + toString(SUMO_TAG_CLOSING_LANE_REROUTE) + "s.").c_str()); + // write warning if netedit is running in testing mode + if (myRerouterDialogParent->getRerouterParent()->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'"); + } + return 0; + } else if (myClosingReroutesValid == false) { + // write warning if netedit is running in testing mode + if (myRerouterDialogParent->getRerouterParent()->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Opening FXMessageBox of type 'warning'"); + } + // open warning Box + FXMessageBox::warning(getApp(), MBOX_OK, + ("Error updating " + toString(myRerouterInterval->getTag()) + " of " + toString(myRerouterInterval->getRerouterParent()->getTag())).c_str(), "%s", + (toString(myRerouterInterval->getRerouterParent()->getTag()) + "'s " + toString(myRerouterInterval->getTag()) + + " cannot be updated because there are invalid " + toString(SUMO_TAG_CLOSING_REROUTE) + "s.").c_str()); + // write warning if netedit is running in testing mode + if (myRerouterDialogParent->getRerouterParent()->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'"); + } + return 0; + } else if (myDestProbReroutesValid == false) { + // write warning if netedit is running in testing mode + if (myRerouterDialogParent->getRerouterParent()->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Opening FXMessageBox of type 'warning'"); + } + // open warning Box + FXMessageBox::warning(getApp(), MBOX_OK, + ("Error updating " + toString(myRerouterInterval->getTag()) + " of " + toString(myRerouterInterval->getRerouterParent()->getTag())).c_str(), "%s", + (toString(myRerouterInterval->getRerouterParent()->getTag()) + "'s " + toString(myRerouterInterval->getTag()) + + " cannot be updated because there are invalid " + toString(SUMO_TAG_DEST_PROB_REROUTE) + "s.").c_str()); + // write warning if netedit is running in testing mode + if (myRerouterDialogParent->getRerouterParent()->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'"); + } + return 0; + } else if (myRouteProbReroutesValid == false) { + // write warning if netedit is running in testing mode + if (myRerouterDialogParent->getRerouterParent()->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Opening FXMessageBox of type 'warning'"); + } + // open warning Box + FXMessageBox::warning(getApp(), MBOX_OK, + ("Error updating " + toString(myRerouterInterval->getTag()) + " of " + toString(myRerouterInterval->getRerouterParent()->getTag())).c_str(), "%s", + (toString(myRerouterInterval->getRerouterParent()->getTag()) + "'s " + toString(myRerouterInterval->getTag()) + + " cannot be updated because there are invalid " + toString(SUMO_TAG_ROUTE_PROB_REROUTE) + "s.").c_str()); + // write warning if netedit is running in testing mode + if (myRerouterDialogParent->getRerouterParent()->getViewNet()->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'warning' with 'OK'"); + } + return 0; + } else { + // set new values of rerouter interval + myRerouterInterval->setClosingLaneReroutes(myCopyOfClosingLaneReroutes); + myRerouterInterval->setClosingReroutes(myCopyOfClosingReroutes); + myRerouterInterval->setDestProbReroutes(myCopyOfDestProbReroutes); + myRerouterInterval->setRouteProbReroutes(myCopyOfRouteProbReroutes); + myRerouterInterval->setBegin(GNEAttributeCarrier::parse(myBeginTextField->getText().text())); + myRerouterInterval->setEnd(GNEAttributeCarrier::parse(myEndTextField->getText().text())); + + // Stop Modal + getApp()->stopModal(this, TRUE); + return 1; + } +} + + +long +GNERerouterIntervalDialog::onCmdCancel(FXObject*, FXSelector, void*) { + // Stop Modal + getApp()->stopModal(this, FALSE); + return 1; +} + + +long +GNERerouterIntervalDialog::onCmdReset(FXObject*, FXSelector, void*) { + // Copy original intervals again + myCopyOfClosingLaneReroutes = myRerouterInterval->getClosingLaneReroutes(); + myCopyOfClosingReroutes = myRerouterInterval->getClosingReroutes(); + myCopyOfDestProbReroutes = myRerouterInterval->getDestProbReroutes(); + myCopyOfRouteProbReroutes = myRerouterInterval->getRouteProbReroutes(); + // update tables + updateClosingLaneReroutesTable(); + updateClosingReroutesTable(); + updateDestProbReroutesTable(); + updateRouteProbReroutesTable(); + return 1; +} + + +long +GNERerouterIntervalDialog::onCmdAddClosingLaneReroute(FXObject*, FXSelector, void*) { + // add new element and update table + myCopyOfClosingLaneReroutes.push_back(GNEClosingLaneReroute(*myRerouterInterval, NULL)); + updateClosingLaneReroutesTable(); + onCmdEditClosingLaneReroute(0, 0, 0); + return 1; +} + + +long +GNERerouterIntervalDialog::onCmdAddClosingReroute(FXObject*, FXSelector, void*) { + // add new element and update table + myCopyOfClosingReroutes.push_back(GNEClosingReroute(*myRerouterInterval, NULL)); + updateClosingReroutesTable(); + onCmdEditClosingLaneReroute(0, 0, 0); + return 1; +} + + +long +GNERerouterIntervalDialog::onCmdAddDestProbReroute(FXObject*, FXSelector, void*) { + // add new element and update table + myCopyOfDestProbReroutes.push_back(GNEDestProbReroute(*myRerouterInterval, NULL, 0)); + updateDestProbReroutesTable(); + onCmdEditDestProbReroute(0, 0, 0); + return 1; +} + + +long +GNERerouterIntervalDialog::onCmdAddRouteProbReroute(FXObject*, FXSelector, void*) { + // add new element and update table + myCopyOfRouteProbReroutes.push_back(GNERouteProbReroute(*myRerouterInterval, "", 0)); + updateRouteProbReroutesTable(); + onCmdEditRouteProbReroute(0, 0, 0); + return 1; +} + + +long +GNERerouterIntervalDialog::onCmdClickedClosingLaneReroute(FXObject*, FXSelector, void*) { + // check if some delete button was pressed + for (int i = 0; i < (int)myCopyOfClosingLaneReroutes.size(); i++) { + if (myClosingLaneRerouteList->getItem(i, 4)->hasFocus()) { + myClosingLaneRerouteList->removeRows(i); + myCopyOfClosingLaneReroutes.erase(myCopyOfClosingLaneReroutes.begin() + i); + updateClosingLaneReroutesTable(); + return 1; + } + } + return 0; +} + + +long +GNERerouterIntervalDialog::onCmdClickedClosingReroute(FXObject*, FXSelector, void*) { + // check if some delete button was pressed + for (int i = 0; i < (int)myCopyOfClosingReroutes.size(); i++) { + if (myClosingRerouteList->getItem(i, 4)->hasFocus()) { + myClosingRerouteList->removeRows(i); + myCopyOfClosingReroutes.erase(myCopyOfClosingReroutes.begin() + i); + updateClosingReroutesTable(); + return 1; + } + } + return 1; +} + + +long +GNERerouterIntervalDialog::onCmdClickedDestProbReroute(FXObject*, FXSelector, void*) { + // check if some delete button was pressed + for (int i = 0; i < (int)myCopyOfDestProbReroutes.size(); i++) { + if (myDestProbRerouteList->getItem(i, 3)->hasFocus()) { + myDestProbRerouteList->removeRows(i); + myCopyOfDestProbReroutes.erase(myCopyOfDestProbReroutes.begin() + i); + updateDestProbReroutesTable(); + return 1; + } + } + return 0; +} + + +long +GNERerouterIntervalDialog::onCmdClickedRouteProbReroute(FXObject*, FXSelector, void*) { + // check if some delete button was pressed + for (int i = 0; i < (int)myCopyOfRouteProbReroutes.size(); i++) { + if (myRouteProbRerouteList->getItem(i, 3)->hasFocus()) { + myRouteProbRerouteList->removeRows(i); + myCopyOfRouteProbReroutes.erase(myCopyOfRouteProbReroutes.begin() + i); + updateRouteProbReroutesTable(); + return 1; + } + } + return 0; +} + + +long +GNERerouterIntervalDialog::onCmdEditClosingLaneReroute(FXObject*, FXSelector, void*) { + myClosingLaneReroutesValid = true; + // iterate over table and check that all parameters are correct + for (int i = 0; i < myClosingLaneRerouteList->getNumRows(); i++) { + GNELane* lane = myRerouterInterval->getRerouterParent()->getViewNet()->getNet()->retrieveLane(myClosingLaneRerouteList->getItem(i, 0)->getText().text(), false); + if (lane == NULL) { + myClosingLaneReroutesValid = false; + myClosingLaneRerouteList->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR)); + } else if (canParseVehicleClasses(myClosingLaneRerouteList->getItem(i, 1)->getText().text()) == false) { + myClosingLaneReroutesValid = false; + myClosingLaneRerouteList->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR)); + } else if (canParseVehicleClasses(myClosingLaneRerouteList->getItem(i, 2)->getText().text()) == false) { + myClosingLaneReroutesValid = false; + myClosingLaneRerouteList->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR)); + } else { + myCopyOfClosingLaneReroutes.at(i).setAllowedVehicles(parseVehicleClasses(myClosingLaneRerouteList->getItem(i, 1)->getText().text())); + myCopyOfClosingLaneReroutes.at(i).setDisallowedVehicles(parseVehicleClasses(myClosingLaneRerouteList->getItem(i, 2)->getText().text())); + myCopyOfClosingLaneReroutes.at(i).setClosedLane(lane); + myClosingLaneRerouteList->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT)); + } + } + // update list + myClosingLaneRerouteList->update(); + return 1; +} + + +long +GNERerouterIntervalDialog::onCmdEditClosingReroute(FXObject*, FXSelector, void*) { + myClosingReroutesValid = true; + // iterate over table and check that all parameters are correct + for (int i = 0; i < myClosingRerouteList->getNumRows(); i++) { + GNEEdge* edge = myRerouterInterval->getRerouterParent()->getViewNet()->getNet()->retrieveEdge(myClosingRerouteList->getItem(i, 0)->getText().text(), false); + if (edge == NULL) { + myClosingReroutesValid = false; + myClosingRerouteList->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR)); + } else if (canParseVehicleClasses(myClosingRerouteList->getItem(i, 1)->getText().text()) == false) { + myClosingReroutesValid = false; + myClosingRerouteList->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR)); + } else if (canParseVehicleClasses(myClosingRerouteList->getItem(i, 2)->getText().text()) == false) { + myClosingReroutesValid = false; + myClosingRerouteList->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR)); + } else { + myCopyOfClosingReroutes.at(i).setAllowedVehicles(parseVehicleClasses(myClosingRerouteList->getItem(i, 1)->getText().text())); + myCopyOfClosingReroutes.at(i).setDisallowedVehicles(parseVehicleClasses(myClosingRerouteList->getItem(i, 2)->getText().text())); + myCopyOfClosingReroutes.at(i).setClosedEdge(edge); + myClosingRerouteList->getItem(i, 3)->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT)); + } + } + // update list + myClosingRerouteList->update(); + return 1; +} + + +long +GNERerouterIntervalDialog::onCmdEditDestProbReroute(FXObject*, FXSelector, void*) { + myDestProbReroutesValid = true; + // iterate over table and check that all parameters are correct + for (int i = 0; i < myDestProbRerouteList->getNumRows(); i++) { + GNEEdge* edge = myRerouterInterval->getRerouterParent()->getViewNet()->getNet()->retrieveEdge(myDestProbRerouteList->getItem(i, 0)->getText().text(), false); + double probability = -1; + // try to parse probability + if (GNEAttributeCarrier::canParse(myDestProbRerouteList->getItem(i, 1)->getText().text())) { + probability = GNEAttributeCarrier::parse(myDestProbRerouteList->getItem(i, 1)->getText().text()); + } + // check if values are valid + if (edge == NULL) { + myDestProbReroutesValid = false; + myDestProbRerouteList->getItem(i, 2)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR)); + } else if ((probability < 0) || (probability > 1)) { + myDestProbReroutesValid = false; + myDestProbRerouteList->getItem(i, 2)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR)); + } else { + myCopyOfDestProbReroutes.at(i).setNewDestination(edge); + myCopyOfDestProbReroutes.at(i).setProbability(probability); + myDestProbRerouteList->getItem(i, 2)->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT)); + myDestProbRerouteList->update(); + } + } + // update list + myDestProbRerouteList->update(); + return 1; +} + + +long +GNERerouterIntervalDialog::onCmdEditRouteProbReroute(FXObject*, FXSelector, void*) { + myRouteProbReroutesValid = true; + // iterate over table and check that all parameters are correct + for (int i = 0; i < myRouteProbRerouteList->getNumRows(); i++) { + double probability = -1; + std::string route = myRouteProbRerouteList->getItem(i, 0)->getText().text(); + // try to parse probability + if (GNEAttributeCarrier::canParse(myRouteProbRerouteList->getItem(i, 1)->getText().text())) { + probability = GNEAttributeCarrier::parse(myRouteProbRerouteList->getItem(i, 1)->getText().text()); + } + // check if values are valid + if (route.empty()) { + myRouteProbReroutesValid = false; + myRouteProbRerouteList->getItem(i, 2)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR)); + } else if ((probability < 0) || (probability > 1)) { + myRouteProbReroutesValid = false; + myRouteProbRerouteList->getItem(i, 2)->setIcon(GUIIconSubSys::getIcon(ICON_ERROR)); + } else { + myCopyOfRouteProbReroutes.at(i).setNewRouteId(myRouteProbRerouteList->getItem(i, 0)->getText().text()); + myCopyOfRouteProbReroutes.at(i).setProbability(probability); + myRouteProbRerouteList->getItem(i, 2)->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT)); + myRouteProbRerouteList->update(); + } + } + // update list + myRouteProbRerouteList->update(); + return 1; +} + + +long +GNERerouterIntervalDialog::onCmdChangeBeginEnd(FXObject*, FXSelector, void*) { + double newBegin; + double newEnd; + // check if interval is valid + if (GNEAttributeCarrier::canParse(myBeginTextField->getText().text()) == false) { + return false; + } else { + newBegin = GNEAttributeCarrier::parse(myBeginTextField->getText().text()); + } + if (GNEAttributeCarrier::canParse(myEndTextField->getText().text()) == false) { + return false; + } else { + newEnd = GNEAttributeCarrier::parse(myEndTextField->getText().text()); + } + // check if new begin provoke an overlapping + if (myRerouterDialogParent->checkModifyInterval(*myRerouterInterval, newBegin, newEnd) == true) { + myBeginEndValid = true; + myCheckLabel->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT)); + return 1; + } else { + myBeginEndValid = false; + myCheckLabel->setIcon(GUIIconSubSys::getIcon(ICON_ERROR)); + return 0; + } +} + + +void +GNERerouterIntervalDialog::updateClosingLaneReroutesTable() { + // clear table + myClosingLaneRerouteList->clearItems(); + // set number of rows + myClosingLaneRerouteList->setTableSize(int(myCopyOfClosingLaneReroutes.size()), 5); + // Configure list + myClosingLaneRerouteList->setVisibleColumns(5); + myClosingLaneRerouteList->setColumnWidth(0, 83); + myClosingLaneRerouteList->setColumnWidth(1, 83); + myClosingLaneRerouteList->setColumnWidth(2, 82); + myClosingLaneRerouteList->setColumnWidth(3, GUIDesignTableIconCellWidth); + myClosingLaneRerouteList->setColumnWidth(4, GUIDesignTableIconCellWidth); + myClosingLaneRerouteList->setColumnText(0, toString(SUMO_ATTR_LANE).c_str()); + myClosingLaneRerouteList->setColumnText(1, toString(SUMO_ATTR_ALLOW).c_str()); + myClosingLaneRerouteList->setColumnText(2, toString(SUMO_ATTR_DISALLOW).c_str()); + myClosingLaneRerouteList->setColumnText(3, ""); + myClosingLaneRerouteList->setColumnText(4, ""); + myClosingLaneRerouteList->getRowHeader()->setWidth(0); + // Declare index for rows and pointer to FXTableItem + int indexRow = 0; + FXTableItem* item = 0; + // iterate over values + for (std::vector::iterator i = myCopyOfClosingLaneReroutes.begin(); i != myCopyOfClosingLaneReroutes.end(); i++) { + // Set closing edge + if (i->getClosedLane() != NULL) { + item = new FXTableItem(i->getClosedLane()->getID().c_str()); + myClosingLaneRerouteList->setItem(indexRow, 0, item); + } else { + item = new FXTableItem(""); + myClosingLaneRerouteList->setItem(indexRow, 0, item); + } + // set allow vehicles + item = new FXTableItem(getVehicleClassNames(i->getAllowedVehicles()).c_str()); + myClosingLaneRerouteList->setItem(indexRow, 1, item); + // set disallow vehicles + item = new FXTableItem(getVehicleClassNames(i->getDisallowedVehicles()).c_str()); + myClosingLaneRerouteList->setItem(indexRow, 2, item); + // set valid icon + item = new FXTableItem(""); + if (myClosingLaneReroutesValid) { + item->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT)); + } else { + item->setIcon(GUIIconSubSys::getIcon(ICON_ERROR)); + } + item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y); + item->setEnabled(false); + myClosingLaneRerouteList->setItem(indexRow, 3, item); + // set remove + item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE)); + item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y); + item->setEnabled(false); + myClosingLaneRerouteList->setItem(indexRow, 4, item); + // Update index + indexRow++; + } +} + + +void +GNERerouterIntervalDialog::updateClosingReroutesTable() { + // clear table + myClosingRerouteList->clearItems(); + // set number of rows + myClosingRerouteList->setTableSize(int(myCopyOfClosingReroutes.size()), 5); + // Configure list + myClosingRerouteList->setVisibleColumns(5); + myClosingRerouteList->setColumnWidth(0, 83); + myClosingRerouteList->setColumnWidth(1, 83); + myClosingRerouteList->setColumnWidth(2, 82); + myClosingRerouteList->setColumnWidth(3, GUIDesignTableIconCellWidth); + myClosingRerouteList->setColumnWidth(4, GUIDesignTableIconCellWidth); + myClosingRerouteList->setColumnText(0, toString(SUMO_ATTR_EDGE).c_str()); + myClosingRerouteList->setColumnText(1, toString(SUMO_ATTR_ALLOW).c_str()); + myClosingRerouteList->setColumnText(2, toString(SUMO_ATTR_DISALLOW).c_str()); + myClosingRerouteList->setColumnText(3, ""); + myClosingRerouteList->setColumnText(4, ""); + myClosingRerouteList->getRowHeader()->setWidth(0); + // Declare index for rows and pointer to FXTableItem + int indexRow = 0; + FXTableItem* item = 0; + // iterate over values + for (std::vector::iterator i = myCopyOfClosingReroutes.begin(); i != myCopyOfClosingReroutes.end(); i++) { + // Set closing edge + if (i->getClosedEdge() != NULL) { + item = new FXTableItem(i->getClosedEdge()->getID().c_str()); + myClosingRerouteList->setItem(indexRow, 0, item); + } else { + item = new FXTableItem(""); + myClosingRerouteList->setItem(indexRow, 0, item); + } + // set allow vehicles + item = new FXTableItem(getVehicleClassNames(i->getAllowedVehicles()).c_str()); + myClosingRerouteList->setItem(indexRow, 1, item); + // set disallow vehicles + item = new FXTableItem(getVehicleClassNames(i->getDisallowedVehicles()).c_str()); + myClosingRerouteList->setItem(indexRow, 2, item); + // set valid + item = new FXTableItem(""); + if (myClosingReroutesValid) { + item->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT)); + } else { + item->setIcon(GUIIconSubSys::getIcon(ICON_ERROR)); + } + item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y); + item->setEnabled(false); + myClosingRerouteList->setItem(indexRow, 3, item); + // set remove + item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE)); + item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y); + item->setEnabled(false); + myClosingRerouteList->setItem(indexRow, 4, item); + // Update index + indexRow++; + } +} + + +void +GNERerouterIntervalDialog::updateDestProbReroutesTable() { + // clear table + myDestProbRerouteList->clearItems(); + // set number of rows + myDestProbRerouteList->setTableSize(int(myCopyOfDestProbReroutes.size()), 4); + // Configure list + myDestProbRerouteList->setVisibleColumns(4); + myDestProbRerouteList->setColumnWidth(0, 124); + myDestProbRerouteList->setColumnWidth(1, 124); + myDestProbRerouteList->setColumnWidth(2, GUIDesignTableIconCellWidth); + myDestProbRerouteList->setColumnWidth(3, GUIDesignTableIconCellWidth); + myDestProbRerouteList->setColumnText(0, toString(SUMO_ATTR_EDGE).c_str()); + myDestProbRerouteList->setColumnText(1, toString(SUMO_ATTR_PROB).c_str()); + myDestProbRerouteList->setColumnText(2, ""); + myDestProbRerouteList->setColumnText(3, ""); + myDestProbRerouteList->getRowHeader()->setWidth(0); + // Declare index for rows and pointer to FXTableItem + int indexRow = 0; + FXTableItem* item = 0; + // iterate over values + for (std::vector::iterator i = myCopyOfDestProbReroutes.begin(); i != myCopyOfDestProbReroutes.end(); i++) { + // Set new destination + if (i->getNewDestination() != NULL) { + item = new FXTableItem(i->getNewDestination()->getID().c_str()); + myDestProbRerouteList->setItem(indexRow, 0, item); + } else { + item = new FXTableItem(""); + myDestProbRerouteList->setItem(indexRow, 0, item); + } + // Set probability + item = new FXTableItem(toString(i->getProbability()).c_str()); + myDestProbRerouteList->setItem(indexRow, 1, item); + // set valid + item = new FXTableItem(""); + if (myDestProbReroutesValid) { + item->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT)); + } else { + item->setIcon(GUIIconSubSys::getIcon(ICON_ERROR)); + } + item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y); + item->setEnabled(false); + myDestProbRerouteList->setItem(indexRow, 2, item); + // set remove + item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE)); + item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y); + item->setEnabled(false); + myDestProbRerouteList->setItem(indexRow, 3, item); + // Update index + indexRow++; + } +} + + +void +GNERerouterIntervalDialog::updateRouteProbReroutesTable() { + // clear table + myRouteProbRerouteList->clearItems(); + // set number of rows + myRouteProbRerouteList->setTableSize(int(myCopyOfRouteProbReroutes.size()), 4); + // Configure list + myRouteProbRerouteList->setVisibleColumns(4); + myRouteProbRerouteList->setColumnWidth(0, 124); + myRouteProbRerouteList->setColumnWidth(1, 124); + myRouteProbRerouteList->setColumnWidth(2, GUIDesignTableIconCellWidth); + myRouteProbRerouteList->setColumnWidth(3, GUIDesignTableIconCellWidth); + myRouteProbRerouteList->setColumnText(0, toString(SUMO_ATTR_ROUTE).c_str()); + myRouteProbRerouteList->setColumnText(1, toString(SUMO_ATTR_PROB).c_str()); + myRouteProbRerouteList->setColumnText(2, ""); + myRouteProbRerouteList->setColumnText(3, ""); + myRouteProbRerouteList->getRowHeader()->setWidth(0); + // Declare index for rows and pointer to FXTableItem + int indexRow = 0; + FXTableItem* item = 0; + // iterate over values + for (std::vector::iterator i = myCopyOfRouteProbReroutes.begin(); i != myCopyOfRouteProbReroutes.end(); i++) { + // Set new route + item = new FXTableItem(i->getNewRouteId().c_str()); + myRouteProbRerouteList->setItem(indexRow, 0, item); + // Set probability + item = new FXTableItem(toString(i->getProbability()).c_str()); + myRouteProbRerouteList->setItem(indexRow, 1, item); + // set valid + item = new FXTableItem(""); + if (myRouteProbReroutesValid) { + item->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT)); + } else { + item->setIcon(GUIIconSubSys::getIcon(ICON_ERROR)); + } + item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y); + item->setEnabled(false); + myRouteProbRerouteList->setItem(indexRow, 2, item); + // set remove + item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE)); + item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y); + item->setEnabled(false); + myRouteProbRerouteList->setItem(indexRow, 3, item); + // Update index + indexRow++; + } +} + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERerouterIntervalDialog.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERerouterIntervalDialog.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERerouterIntervalDialog.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERerouterIntervalDialog.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,210 @@ +/****************************************************************************/ +/// @file GNERerouterIntervalDialog.h +/// @author Pablo Alvarez Lopez +/// @date Feb 2017 +/// @version $Id: GNERerouterIntervalDialog.h 23961 2017-04-18 10:32:08Z palcraft $ +/// +/// Dialog for edit rerouter intervals +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNERerouterIntervalDialog_h +#define GNERerouterIntervalDialog_h + +// =========================================================================== +// included modules +// =========================================================================== + +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include "GNEAdditionalDialog.h" +#include "GNERerouterInterval.h" +#include "GNEClosingLaneReroute.h" +#include "GNEClosingReroute.h" +#include "GNEDestProbReroute.h" +#include "GNERouteProbReroute.h" + + +// =========================================================================== +// class declarations +// =========================================================================== + +class GNERerouterDialog; + + +// =========================================================================== +// class definitions +// =========================================================================== + +/** + * @class GNERerouterIntervalDialog + * @brief Dialog for edit rerouter intervals + */ + +class GNERerouterIntervalDialog : public GNEAdditionalDialog { + /// @brief FOX-declaration + FXDECLARE(GNERerouterIntervalDialog) + +public: + /// @brief constructor + GNERerouterIntervalDialog(GNERerouterDialog* rerouterDialog, GNERerouterInterval& rerouterInterval); + + /// @brief destructor + ~GNERerouterIntervalDialog(); + + /// @name FOX-callbacks + /// @{ + /// @brief event after press accept button + long onCmdAccept(FXObject*, FXSelector, void*); + + /// @brief event after press cancel button + long onCmdCancel(FXObject*, FXSelector, void*); + + /// @brief event after press reset button + long onCmdReset(FXObject*, FXSelector, void*); + + /// @brief add closing lane reroute + long onCmdAddClosingLaneReroute(FXObject*, FXSelector, void*); + + /// @brief add closing reroute + long onCmdAddClosingReroute(FXObject*, FXSelector, void*); + + /// @brief add dest prob reroute + long onCmdAddDestProbReroute(FXObject*, FXSelector, void*); + + /// @brief add route prob reroute + long onCmdAddRouteProbReroute(FXObject*, FXSelector, void*); + + /// @brief remove closing lane reroute + long onCmdClickedClosingLaneReroute(FXObject*, FXSelector, void*); + + /// @brief remove closing reroute + long onCmdClickedClosingReroute(FXObject*, FXSelector, void*); + + /// @brief remove dest prob reroute + long onCmdClickedDestProbReroute(FXObject*, FXSelector, void*); + + /// @brief remove route prob reroute + long onCmdClickedRouteProbReroute(FXObject*, FXSelector, void*); + + /// @brief /edit closing lane reroute + long onCmdEditClosingLaneReroute(FXObject*, FXSelector, void*); + + /// @brief /edit closing reroute + long onCmdEditClosingReroute(FXObject*, FXSelector, void*); + + /// @brief /edit dest prob reroute + long onCmdEditDestProbReroute(FXObject*, FXSelector, void*); + + /// @brief /edit route prob reroute + long onCmdEditRouteProbReroute(FXObject*, FXSelector, void*); + + /// @brief called when begin or endis changed + long onCmdChangeBeginEnd(FXObject*, FXSelector, void*); + + /// @} + +protected: + /// @brief FOX needs this + GNERerouterIntervalDialog() {} + + /// @brief pointer to GNERerouterDialog parent + GNERerouterDialog* myRerouterDialogParent; + + /// @brief pointer to rerouter interval + GNERerouterInterval* myRerouterInterval; + + /// @brief begin time text field + FXTextField* myBeginTextField; + + /// @brief end time text field + FXTextField* myEndTextField; + + /// @brief begin/end time check label + FXLabel* myCheckLabel; + + /// @brief button for add new closing lane reroutes + FXButton* myAddClosingLaneReroutes; + + /// @brief button for add new closing reroutes + FXButton* myAddClosingReroutes; + + /// @brief button for add new destiny probability reroutes + FXButton* myAddDestProbReroutes; + + /// @brief button for add new route probability reroutes + FXButton* myAddRouteProbReroute; + + /// @brief list with closing lane reroutes + FXTable* myClosingLaneRerouteList; + + /// @brief list with closing reroutes + FXTable* myClosingRerouteList; + + /// @brief list with destiny probability reroutes + FXTable* myDestProbRerouteList; + + /// @brief list with route probability reroute + FXTable* myRouteProbRerouteList; + + /// @brief flag to check if begin an end are valid + bool myBeginEndValid; + + /// @brief vector with the closingLaneReroutes + std::vector myCopyOfClosingLaneReroutes; + + /// @brief flag to check if closing lane reroutes are valid + bool myClosingLaneReroutesValid; + + /// @brief vector with a copy of the closingReroutes + std::vector myCopyOfClosingReroutes; + + /// @brief flag to check if closing reroutes are valid + bool myClosingReroutesValid; + + /// @brief vector with a copy of the destProbReroutes + std::vector myCopyOfDestProbReroutes; + + /// @brief flag to check if Destiny probability reroutes are valid + bool myDestProbReroutesValid; + + /// @brief vector with a copy of the routeProbReroutes + std::vector myCopyOfRouteProbReroutes; + + /// @brief flag to check if route prob reroutes are valid + bool myRouteProbReroutesValid; + + /// @brief update data of closing lane reroute table + void updateClosingLaneReroutesTable(); + + /// @brief update data of closing reroute table + void updateClosingReroutesTable(); + + /// @brief update data of destiny probabilitry reroute table + void updateDestProbReroutesTable(); + + /// @brief update data of probabilitry reroutes table + void updateRouteProbReroutesTable(); + +private: + /// @brief Invalidated copy constructor. + GNERerouterIntervalDialog(const GNERerouterIntervalDialog&); + + /// @brief Invalidated assignment operator. + GNERerouterIntervalDialog& operator=(const GNERerouterIntervalDialog&); +}; + +#endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERerouterInterval.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERerouterInterval.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERerouterInterval.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERerouterInterval.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,186 @@ +/****************************************************************************/ +/// @file GNERerouterInterval.h +/// @author Pablo Alvarez Lopez +/// @date Jan 2017 +/// @version $Id: GNERerouterInterval.h 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNERerouterInterval_h +#define GNERerouterInterval_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include "GNERerouter.h" + +#include "GNEClosingLaneReroute.h" +#include "GNEClosingReroute.h" +#include "GNEDestProbReroute.h" +#include "GNERouteProbReroute.h" + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class GNERerouterInterval + * class used to represent a interval used in rerouters + */ +class GNERerouterInterval { +public: + /// @brief constructor + GNERerouterInterval(GNERerouter* rerouterParent, double begin, double end); + + /// @brief destructor + ~GNERerouterInterval(); + + /**@brief insert a new closing lane reroute + * @return true if insertion was sucesfully, false if is duplicated + */ + bool insertClosinLanegReroutes(const GNEClosingLaneReroute& clr); + + /**@brief remove a previously inserted closing reroute + * @return true if deletetion was sucesfully, false if wasn't found + */ + bool removeClosingLaneReroutes(const GNEClosingLaneReroute& clr); + + /**@brief insert a new closing lane reroute + * @return true if insertion was sucesfully, false if is duplicated + */ + bool insertClosingReroutes(const GNEClosingReroute& cr); + + /**@brief remove a previously inserted closing reroute + * @return true if deletetion was sucesfully, false if wasn't found + */ + bool removeClosingReroutes(const GNEClosingReroute& cr); + + /**@brief insert destiny probability reroute + * @return true if deletetion was sucesfully, false if wasn't found + */ + bool insertDestProbReroutes(const GNEDestProbReroute& dpr); + + /**@brief remove a previously inserted destiny probability reroute + * @return true if deletetion was sucesfully, false if wasn't found + */ + bool removeDestProbReroutes(const GNEDestProbReroute& dpr); + + /**@brief insert route probability reroute + * @return true if insertion was sucesfully, false if is duplicated + */ + bool insertRouteProbReroute(const GNERouteProbReroute& rpr); + + /**@brief remove a previously inserted route probability reroute + * @return true if deletetion was sucesfully, false if wasn't found + */ + bool removeRouteProbReroute(const GNERouteProbReroute& rpr); + + /// @brief get rerouter parent + GNERerouter* getRerouterParent() const; + + /// @brief get tag + SumoXMLTag getTag() const; + + /// @brief get begin time + double getBegin() const; + + /// @brief get end time + double getEnd() const; + + /// @brief set begin time + void setBegin(double begin); + + /// @brief set end time + void setEnd(double end); + + /// @brief get closing reroutes + const std::vector& getClosingLaneReroutes() const; + + /// @brief get closing reroutes + const std::vector& getClosingReroutes() const; + + /// @brief get destiny probability reroutes + const std::vector& getDestProbReroutes() const; + + /// @brief get reoute probability reroutes + const std::vector& getRouteProbReroutes() const; + + /// @brief set closing reroutes + void setClosingLaneReroutes(const std::vector& closingLaneReroutes); + + /// @brief set closing reroutes + void setClosingReroutes(const std::vector& closingReroutes); + + /// @brief set destiny probability reroutes + void setDestProbReroutes(const std::vector& destProbReroutes); + + /// @brief set reoute probability reroutes + void setRouteProbReroutes(const std::vector& rerouteProbabilityReroutes); + + /// @brief overload operator = + GNERerouterInterval& operator=(const GNERerouterInterval& rerouterInterval); + + /// @brief overload operator = + bool operator==(const GNERerouterInterval& rerouterInterval) const; + + /// @brief overload operator > + bool operator>(const GNERerouterInterval& rerouterInterval) const; + + /// @brief overload operator >= + bool operator>=(const GNERerouterInterval& rerouterInterval) const; + + /// @brief overload operator < + bool operator<(const GNERerouterInterval& rerouterInterval) const; + + /// @brief overload operator <= + bool operator<=(const GNERerouterInterval& rerouterInterval) const; + +protected: + /// @brief pointer to rerouter parent + GNERerouter* myRerouterParent; + + /// @brief begin timeStep + double myBegin; + + /// @brief end timeStep + double myEnd; + + /// @brief XML Tag of a rerouter interval + SumoXMLTag myTag; + + /// @brief vector with the closingLaneReroutes + std::vector myClosingLaneReroutes; + + /// @brief vector with the closingReroutes + std::vector myClosingReroutes; + + /// @brief vector with the destProbReroutes + std::vector myDestProbReroutes; + + /// @brief vector with the routeProbReroutes + std::vector myRouteProbReroutes; +}; + +#endif + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERouteProbe.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERouteProbe.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERouteProbe.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERouteProbe.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNERouteProbe.cpp /// @author Pablo Alvarez Lopez /// @date May 2016 -/// @version $Id: GNERouteProbe.cpp 21640 2016-10-09 20:28:52Z palcraft $ +/// @version $Id: GNERouteProbe.cpp 24016 2017-04-22 14:13:39Z palcraft $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -57,19 +57,18 @@ #include "GNENet.h" #include "GNEChange_Attribute.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // =========================================================================== // member method definitions // =========================================================================== -GNERouteProbe::GNERouteProbe(const std::string& id, GNEViewNet* viewNet, GNEEdge* edge, int frequency, const std::string& filename, int begin, bool blocked) : - GNEAdditional(id, viewNet, Position(), SUMO_TAG_ROUTEPROBE, NULL, blocked), +GNERouteProbe::GNERouteProbe(const std::string& id, GNEViewNet* viewNet, GNEEdge* edge, double frequency, const std::string& filename, double begin) : + GNEAdditional(id, viewNet, Position(), SUMO_TAG_ROUTEPROBE, ICON_ROUTEPROBE), myFrequency(frequency), myFilename(filename), - myBegin(begin) { + myBegin(begin), + myNumberOfLanes(0), + myRelativePosition(0) { // This additional belongs to a edge myEdge = edge; // this additional ISN'T movable @@ -94,11 +93,14 @@ // clear Shape myShape.clear(); + // obtain relative position of routeProbe in edge + myRelativePosition = 2 * myEdge->getRouteProbeRelativePosition(this); + // get lanes of edge GNELane* firstLane = myEdge->getLanes().at(0); // Save number of lanes - numberOfLanes = int(myEdge->getLanes().size()); + myNumberOfLanes = int(myEdge->getLanes().size()); // Get shape of lane parent myShape.push_back(firstLane->getShape().positionAtOffset(5)); @@ -116,7 +118,7 @@ myBlockIconPosition = myShape.getLineCenter(); // Set offset of the block icon - myBlockIconOffset = Position(1.1, -3.06); + myBlockIconOffset = Position(1.1, (-3.06) - myRelativePosition); // Set block icon rotation, and using their rotation for logo setBlockIconRotation(firstLane); @@ -137,18 +139,18 @@ void -GNERouteProbe::moveAdditionalGeometry(SUMOReal, SUMOReal) { +GNERouteProbe::moveAdditionalGeometry(double, double) { // This additional cannot be moved } void -GNERouteProbe::commmitAdditionalGeometryMoved(SUMOReal, SUMOReal, GNEUndoList*) { +GNERouteProbe::commmitAdditionalGeometryMoved(double, double, GNEUndoList*) { // This additional cannot be moved } void -GNERouteProbe::writeAdditional(OutputDevice& device, const std::string&) { +GNERouteProbe::writeAdditional(OutputDevice& device) const { // Write parameters device.openTag(getTag()); device.writeAttr(SUMO_ATTR_ID, getID()); @@ -169,13 +171,13 @@ } -int +double GNERouteProbe::getFrequency() const { return myFrequency; } -int +double GNERouteProbe::getBegin() const { return myBegin; } @@ -188,13 +190,13 @@ void -GNERouteProbe::setFrequency(int frequency) { +GNERouteProbe::setFrequency(double frequency) { myFrequency = frequency; } void -GNERouteProbe::setBegin(int begin) { +GNERouteProbe::setBegin(double begin) { myBegin = begin; } @@ -209,9 +211,9 @@ GNERouteProbe::drawGL(const GUIVisualizationSettings& s) const { // get values glPushName(getGlID()); - SUMOReal width = (SUMOReal) 2.0 * s.scale; + double width = (double) 2.0 * s.scale; glLineWidth(1.0); - const SUMOReal exaggeration = s.addSize.getExaggeration(s); + const double exaggeration = s.addSize.getExaggeration(s); // draw shape glColor3ub(255, 216, 0); @@ -224,8 +226,8 @@ glBegin(GL_QUADS); glVertex2d(0, 0.25); glVertex2d(0, -0.25); - glVertex2d((numberOfLanes * 3.3), -0.25); - glVertex2d((numberOfLanes * 3.3), 0.25); + glVertex2d((myNumberOfLanes * 3.3), -0.25); + glVertex2d((myNumberOfLanes * 3.3), 0.25); glEnd(); glTranslated(0, 0, .01); glBegin(GL_LINES); @@ -239,7 +241,7 @@ glColor3d(1, 1, 1); glBegin(GL_LINES); glVertex2d(0, 0); - glVertex2d(0, (numberOfLanes * 3.3)); + glVertex2d(0, (myNumberOfLanes * 3.3)); glEnd(); } @@ -250,15 +252,15 @@ glPushMatrix(); glTranslated(myShape[0].x(), myShape[0].y(), getType()); glRotated(myShapeRotations[0], 0, 0, 1); - glTranslated(-2.56, - 1.6, 0); + glTranslated((-2.56) - myRelativePosition, (-1.6), 0); glColor3d(1, 1, 1); glRotated(-90, 0, 0, 1); // Draw icon depending of detector is or isn't selected if (isAdditionalSelected()) { - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_ROUTEPROBESELECTED), 1); + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_ROUTEPROBESELECTED), 1); } else { - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_ROUTEPROBE), 1); + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_ROUTEPROBE), 1); } // Pop logo matrix @@ -290,7 +292,7 @@ case SUMO_ATTR_BEGIN: return toString(myBegin); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -310,7 +312,7 @@ updateGeometry(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -331,13 +333,13 @@ return false; } case SUMO_ATTR_FILE: - return isValidFileValue(value); + return isValidFilename(value); case SUMO_ATTR_FREQUENCY: - return canParse(value); + return (canParse(value) && (parse(value) >= 0)); case SUMO_ATTR_BEGIN: - return canParse(value); + return (canParse(value) && (parse(value) >= 0)); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -355,13 +357,13 @@ myFilename = value; break; case SUMO_ATTR_FREQUENCY: - myFrequency = parse(value); + myFrequency = parse(value); break; case SUMO_ATTR_BEGIN: - myBegin = parse(value); + myBegin = parse(value); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERouteProbe.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERouteProbe.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERouteProbe.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERouteProbe.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNERouteProbe.h /// @author Pablo Alvarez Lopez /// @date May 2016 -/// @version $Id: GNERouteProbe.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNERouteProbe.h 23469 2017-03-16 10:04:05Z palcraft $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -54,18 +54,17 @@ * @param[in] frequency The frequency in which to report the distribution * @param[in] filename The file for generated output * @param[in] begin The time at which to start generating output - * @param[in] blocked set initial blocking state of item */ - GNERouteProbe(const std::string& id, GNEViewNet* viewNet, GNEEdge* edge, int frequency, const std::string& filename, int begin, bool blocked); + GNERouteProbe(const std::string& id, GNEViewNet* viewNet, GNEEdge* edge, double frequency, const std::string& filename, double begin); /// @brief Destructor ~GNERouteProbe(); /// @brief change the position of the RouteProbe geometry - void moveAdditionalGeometry(SUMOReal, SUMOReal); + void moveAdditionalGeometry(double, double); /// @brief updated geometry changes in the attributes of additional - void commmitAdditionalGeometryMoved(SUMOReal, SUMOReal, GNEUndoList*); + void commmitAdditionalGeometryMoved(double, double, GNEUndoList*); /// @brief update pre-computed geometry information /// @note: must be called when geometry changes (i.e. lane moved) @@ -77,29 +76,25 @@ /**@brief writte additional element into a xml file * @param[in] device device in which write parameters of additional element */ - void writeAdditional(OutputDevice& device, const std::string&); - - /// @brief remove reference to edge - /// @note this function will be called automatically in destructor of GNEEdge - void removeEdgeReference(); + void writeAdditional(OutputDevice& device) const; /// @brief get filename of RouteProbe std::string getFilename() const; /// @brief get frequency of RouteProbe - int getFrequency() const; + double getFrequency() const; /// @brief get begin of RouteProbe - int getBegin() const; + double getBegin() const; /// @brief set filename of RouteProbe void setFilename(std::string filename); /// @brief set frequency of RouteProbe - void setFrequency(int frequency); + void setFrequency(double frequency); /// @brief set begin of RouteProbe - void setBegin(int begin); + void setBegin(double begin); /// @name inherited from GUIGlObject /// @{ @@ -139,19 +134,22 @@ protected: /// @brief Frequency of RouteProbe - int myFrequency; + double myFrequency; /// @brief filename of RouteProbe std::string myFilename; /// @brief begin of rerouter - int myBegin; + double myBegin; /// @brief route probe logo offset Position myRouteProbeLogoOffset; /// @brief number of lanes of edge (To improve efficiency) - int numberOfLanes; + int myNumberOfLanes; + + /// @brief relative position regarding to other route probes + int myRelativePosition; private: /// @brief set attribute after validation diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERouteProbReroute.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERouteProbReroute.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERouteProbReroute.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERouteProbReroute.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,106 @@ +/****************************************************************************/ +/// @file GNERouteProbReroute.cpp +/// @author Pablo Alvarez Lopez +/// @date Jan 2017 +/// @version $Id: GNERouteProbReroute.cpp 23640 2017-03-24 09:17:38Z palcraft $ +/// +/// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include + +#include "GNERouteProbReroute.h" +#include "GNEEdge.h" + + +// =========================================================================== +// member method definitions +// =========================================================================== + +GNERouteProbReroute::GNERouteProbReroute(GNERerouterInterval& rerouterIntervalParent, std::string newRouteId, double probability) : + myRerouterIntervalParent(&rerouterIntervalParent), + myNewRouteId(newRouteId), + myProbability(probability), + myTag(SUMO_TAG_ROUTE_PROB_REROUTE) { + // set probability manually to avoid non valid values + setProbability(probability); +} + + +GNERouteProbReroute::~GNERouteProbReroute() { +} + + +std::string +GNERouteProbReroute::getNewRouteId() const { + return myNewRouteId; +} + + +void +GNERouteProbReroute::setNewRouteId(std::string newRouteId) { + myNewRouteId = newRouteId; +} + + +double +GNERouteProbReroute::getProbability() const { + return myProbability; +} + + +bool +GNERouteProbReroute::setProbability(double probability) { + if (probability >= 0 && probability <= 1) { + myProbability = probability; + return true; + } else { + return false; + } +} + + +SumoXMLTag +GNERouteProbReroute::getTag() const { + return myTag; +} + + +const GNERerouterInterval& +GNERouteProbReroute::getRerouterIntervalParent() const { + return *myRerouterIntervalParent; +} + + +bool +GNERouteProbReroute::operator==(const GNERouteProbReroute& routeProbReroute) const { + if ((myRerouterIntervalParent == routeProbReroute.myRerouterIntervalParent) && + (myNewRouteId == routeProbReroute.myNewRouteId) && + (myProbability && routeProbReroute.myProbability)) { + return true; + } else { + return false; + } +} + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERouteProbReroute.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERouteProbReroute.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNERouteProbReroute.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNERouteProbReroute.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,98 @@ +/****************************************************************************/ +/// @file GNERouteProbReroute.h +/// @author Pablo Alvarez Lopez +/// @date Jan 2017 +/// @version $Id: GNERouteProbReroute.h 23640 2017-03-24 09:17:38Z palcraft $ +/// +/// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNERouteProbReroute_h +#define GNERouteProbReroute_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include + +// =========================================================================== +// class declarations +// =========================================================================== + +class GNEEdge; +class GNERerouterInterval; + +// =========================================================================== +// class definitions +// =========================================================================== + +/** + * @class GNERerouter + * GNERouteProbReroute + */ +class GNERouteProbReroute { +public: + /// @brief constructor + GNERouteProbReroute(GNERerouterInterval& rerouterIntervalParent, std::string newRouteId, double probability); + + /// @brief destructor + ~GNERouteProbReroute(); + + /// @brief get new route id + std::string getNewRouteId() const; + + /// @brief set new route id + void setNewRouteId(std::string newRouteId); + + /// @brief get probability + double getProbability() const; + + /// @brief set probability, if the new probability is valid + bool setProbability(double probability); + + /// @brief get tag + SumoXMLTag getTag() const; + + /// @brief get rerouter interval parent + const GNERerouterInterval& getRerouterIntervalParent() const; + + /// @brief overload == operator + bool operator==(const GNERouteProbReroute& routeProbReroute) const; + +protected: + /// @brief reference to rerouter interval parent + GNERerouterInterval* myRerouterIntervalParent; + + /// @brief id of new route + /// @todo change string to GNERoute + std::string myNewRouteId; + + /// @brief probability with which a vehicle will use the given edge as destination + double myProbability; + + /// @brief XML Tag of route probability reroute + SumoXMLTag myTag; +}; + +#endif + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNESelectorFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNESelectorFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNESelectorFrame.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNESelectorFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,13 +2,13 @@ /// @file GNESelectorFrame.cpp /// @author Jakob Erdmann /// @date Mar 2011 -/// @version $Id: GNESelectorFrame.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNESelectorFrame.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The Widget for modifying selections of network-elements // (some elements adapted from GUIDialog_GLChosenEditor) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -29,10 +29,6 @@ #include #endif -#ifdef HAVE_VERSION_H -#include -#endif - #include #include #include @@ -40,8 +36,10 @@ #include #include #include +#include #include #include + #include "GNESelectorFrame.h" #include "GNEViewNet.h" #include "GNEViewParent.h" @@ -53,96 +51,96 @@ #include "GNEChange_Selection.h" #include "GNEAttributeCarrier.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping // =========================================================================== FXDEFMAP(GNESelectorFrame) GNESelectorFrameMap[] = { - FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_ELEMENTS, GNESelectorFrame::onCmdSubset), - FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_LOAD, GNESelectorFrame::onCmdLoad), - FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_SAVE, GNESelectorFrame::onCmdSave), - FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_INVERT, GNESelectorFrame::onCmdInvert), - FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_CLEAR, GNESelectorFrame::onCmdClear), - FXMAPFUNC(SEL_COMMAND, MID_GNE_SELMB_TAG, GNESelectorFrame::onCmdSelMBTag), - FXMAPFUNC(SEL_COMMAND, MID_GNE_SELMB_STRING, GNESelectorFrame::onCmdSelMBString), - FXMAPFUNC(SEL_COMMAND, MID_HELP, GNESelectorFrame::onCmdHelp), - FXMAPFUNC(SEL_COMMAND, MID_GNE_SELECT_SCALE, GNESelectorFrame::onCmdScaleSelection) + FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_OPERATION, GNESelectorFrame::onCmdSelectOperation), + FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_ELEMENTS, GNESelectorFrame::onCmdSubset), + FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_LOAD, GNESelectorFrame::onCmdLoad), + FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_SAVE, GNESelectorFrame::onCmdSave), + FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_INVERT, GNESelectorFrame::onCmdInvert), + FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_CLEAR, GNESelectorFrame::onCmdClear), + FXMAPFUNC(SEL_COMMAND, MID_GNE_SELMB_TAG, GNESelectorFrame::onCmdSelMBTag), + FXMAPFUNC(SEL_COMMAND, MID_GME_SELMB_ATTRIBUTE, GNESelectorFrame::onCmdSelMBAttribute), + FXMAPFUNC(SEL_COMMAND, MID_GNE_SELMB_STRING, GNESelectorFrame::onCmdSelMBString), + FXMAPFUNC(SEL_COMMAND, MID_HELP, GNESelectorFrame::onCmdHelp), + FXMAPFUNC(SEL_COMMAND, MID_GNE_SELECT_SCALE, GNESelectorFrame::onCmdScaleSelection) }; // Object implementation -FXIMPLEMENT(GNESelectorFrame, FXScrollWindow, GNESelectorFrameMap, ARRAYNUMBER(GNESelectorFrameMap)) +FXIMPLEMENT(GNESelectorFrame, FXVerticalFrame, GNESelectorFrameMap, ARRAYNUMBER(GNESelectorFrameMap)) // =========================================================================== // method definitions // =========================================================================== -GNESelectorFrame::GNESelectorFrame(FXComposite* parent, GNEViewNet* viewNet): - GNEFrame(parent, viewNet, getStats().c_str()), +GNESelectorFrame::GNESelectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet): + GNEFrame(horizontalFrameParent, viewNet, getStats().c_str()), mySetOperation(SET_ADD), - mySetOperationTarget(mySetOperation), + myCurrentTag(SUMO_TAG_NOTHING), + myCurrentAttribute(SUMO_ATTR_NOTHING), ALL_VCLASS_NAMES_MATCH_STRING("all " + joinToString(SumoVehicleClassStrings.getStrings(), " ")) { // selection modification mode - FXGroupBox* selBox = new FXGroupBox(myContentFrame, "Modification Mode", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X); + FXGroupBox* selBox = new FXGroupBox(myContentFrame, "Modification Mode", GUIDesignGroupBoxFrame); // Create all options buttons - new FXRadioButton(selBox, "add\t\tSelected objects are added to the previous selection", - &mySetOperationTarget, FXDataTarget::ID_OPTION + SET_ADD); - new FXRadioButton(selBox, "remove\t\tSelected objects are removed from the previous selection", - &mySetOperationTarget, FXDataTarget::ID_OPTION + SET_SUB); - new FXRadioButton(selBox, "keep\t\tRestrict previous selection by the current selection", - &mySetOperationTarget, FXDataTarget::ID_OPTION + SET_RESTRICT); - new FXRadioButton(selBox, "replace\t\tReplace previous selection by the current selection", - &mySetOperationTarget, FXDataTarget::ID_OPTION + SET_REPLACE); + myAddRadioButton = new FXRadioButton(selBox, "add\t\tSelected objects are added to the previous selection", + this, MID_CHOOSEN_OPERATION, GUIDesignRadioButton); + myRemoveRadioButton = new FXRadioButton(selBox, "remove\t\tSelected objects are removed from the previous selection", + this, MID_CHOOSEN_OPERATION, GUIDesignRadioButton); + myKeepRadioButton = new FXRadioButton(selBox, "keep\t\tRestrict previous selection by the current selection", + this, MID_CHOOSEN_OPERATION, GUIDesignRadioButton); + myReplaceRadioButton = new FXRadioButton(selBox, "replace\t\tReplace previous selection by the current selection", + this, MID_CHOOSEN_OPERATION, GUIDesignRadioButton); + myAddRadioButton->setCheck(true); // Create groupBox for selection by expression matching (match box) - FXGroupBox* elementBox = new FXGroupBox(myContentFrame, "type of element", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X); + FXGroupBox* elementBox = new FXGroupBox(myContentFrame, "type of element", GUIDesignGroupBoxFrame); // Create MatchTagBox for tags and fill it - mySetBox = new FXListBox(elementBox, this, MID_CHOOSEN_ELEMENTS, FRAME_GROOVE | LAYOUT_FILL_X); - mySetBox->appendItem("Net Element"); - mySetBox->appendItem("Additional"); - mySetBox->setNumVisible(mySetBox->getNumItems()); + mySetComboBox = new FXComboBox(elementBox, GUIDesignComboBoxNCol, this, MID_CHOOSEN_ELEMENTS, GUIDesignComboBox); + mySetComboBox->appendItem("Net Element"); + mySetComboBox->appendItem("Additional"); + mySetComboBox->setNumVisible(mySetComboBox->getNumItems()); // Create groupBox fro selection by expression matching (match box) - FXGroupBox* matchBox = new FXGroupBox(myContentFrame, "Match Attribute", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X); + FXGroupBox* matchBox = new FXGroupBox(myContentFrame, "Match Attribute", GUIDesignGroupBoxFrame); // Create MatchTagBox for tags - myMatchTagBox = new FXListBox(matchBox, this, MID_GNE_SELMB_TAG, FRAME_GROOVE | LAYOUT_FILL_X); + myMatchTagComboBox = new FXComboBox(matchBox, GUIDesignComboBoxNCol, this, MID_GNE_SELMB_TAG, GUIDesignComboBox); // Create listBox for Attributes - myMatchAttrBox = new FXListBox(matchBox, NULL, 0, FRAME_GROOVE | LAYOUT_FILL_X); - // Set netElements as default tag - mySetBox->setCurrentItem(0); + myMatchAttrComboBox = new FXComboBox(matchBox, GUIDesignComboBoxNCol, this, MID_GME_SELMB_ATTRIBUTE, GUIDesignComboBox); + // Create TextField for Match string + myMatchString = new FXTextField(matchBox, GUIDesignTextFieldNCol, this, MID_GNE_SELMB_STRING, GUIDesignTextField); // Fill list of sub-items onCmdSubset(0, 0, 0); - // Set speed as default attribute - myMatchAttrBox->setCurrentItem(3); - // Create TextField for Match string - myMatchString = new FXTextField(matchBox, 12, this, MID_GNE_SELMB_STRING, FRAME_THICK | LAYOUT_FILL_X); + // Set speed of edge as default attribute + myCurrentTag = SUMO_TAG_EDGE; + myMatchAttrComboBox->setCurrentItem(3); + myCurrentAttribute = SUMO_ATTR_SPEED; // Set default value for Match string myMatchString->setText(">10.0"); // Create help button - new FXButton(matchBox, "Help", 0, this, MID_HELP); + new FXButton(matchBox, "Help", 0, this, MID_HELP, GUIDesignButtonRectangular); // Create Groupbox for visual scalings - FXGroupBox* selSizeBox = new FXGroupBox(myContentFrame, "Visual Scaling", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X); + FXGroupBox* selSizeBox = new FXGroupBox(myContentFrame, "Visual Scaling", GUIDesignGroupBoxFrame); // Create spin button and configure it - mySelectionScaling = new FXRealSpinDial(selSizeBox, 7, this, MID_GNE_SELECT_SCALE, LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | LAYOUT_FILL_Y); + mySelectionScaling = new FXRealSpinDial(selSizeBox, 7, this, MID_GNE_SELECT_SCALE, GUIDesignSpinDial); mySelectionScaling->setNumberFormat(1); mySelectionScaling->setIncrements(0.1, .5, 1); mySelectionScaling->setRange(1, 100); mySelectionScaling->setValue(1); mySelectionScaling->setHelpText("Enlarge selected objects"); // Create groupbox for additional buttons - FXGroupBox* additionalButtons = new FXGroupBox(myContentFrame, "Operations for selections", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X); + FXGroupBox* additionalButtons = new FXGroupBox(myContentFrame, "Operations for selections", GUIDesignGroupBoxFrame); // Create "Clear List" Button - new FXButton(additionalButtons, "Clear\t\t", 0, this, MID_CHOOSEN_CLEAR, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED); + new FXButton(additionalButtons, "Clear\t\t", 0, this, MID_CHOOSEN_CLEAR, GUIDesignButton); // Create "Invert" Button - new FXButton(additionalButtons, "Invert\t\t", 0, this, MID_CHOOSEN_INVERT, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED); + new FXButton(additionalButtons, "Invert\t\t", 0, this, MID_CHOOSEN_INVERT, GUIDesignButton); // Create "Save" Button - new FXButton(additionalButtons, "Save\t\tSave ids of currently selected objects to a file.", 0, this, MID_CHOOSEN_SAVE, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED); + new FXButton(additionalButtons, "Save\t\tSave ids of currently selected objects to a file.", 0, this, MID_CHOOSEN_SAVE, GUIDesignButton); // Create "Load" Button - new FXButton(additionalButtons, "Load\t\tLoad ids from a file according to the current modfication mode.", 0, this, MID_CHOOSEN_LOAD, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED); + new FXButton(additionalButtons, "Load\t\tLoad ids from a file according to the current modfication mode.", 0, this, MID_CHOOSEN_LOAD, GUIDesignButton); // Create groupbox for information about selections - FXGroupBox* selectionHintGroupBox = new FXGroupBox(myContentFrame, "Information", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X); + FXGroupBox* selectionHintGroupBox = new FXGroupBox(myContentFrame, "Information", GUIDesignGroupBoxFrame); // Create Selection Hint - new FXLabel(selectionHintGroupBox, " - Hold for \n rectangle selection.\n - Press to\n delete selected items.", 0, JUSTIFY_LEFT); + new FXLabel(selectionHintGroupBox, " - Hold for \n rectangle selection.\n - Press to\n delete selected items.", 0, GUIDesignLabelLeft); } @@ -152,36 +150,68 @@ long +GNESelectorFrame::onCmdSelectOperation(FXObject* obj, FXSelector, void*) { + if (obj == myAddRadioButton) { + mySetOperation = SET_ADD; + myAddRadioButton->setCheck(true); + myRemoveRadioButton->setCheck(false); + myKeepRadioButton->setCheck(false); + myReplaceRadioButton->setCheck(false); + return 1; + } else if (obj == myRemoveRadioButton) { + mySetOperation = SET_SUB; + myAddRadioButton->setCheck(false); + myRemoveRadioButton->setCheck(true); + myKeepRadioButton->setCheck(false); + myReplaceRadioButton->setCheck(false); + return 1; + } else if (obj == myKeepRadioButton) { + mySetOperation = SET_RESTRICT; + myAddRadioButton->setCheck(false); + myRemoveRadioButton->setCheck(false); + myKeepRadioButton->setCheck(true); + myReplaceRadioButton->setCheck(false); + return 1; + } else if (obj == myReplaceRadioButton) { + mySetOperation = SET_REPLACE; + myAddRadioButton->setCheck(false); + myRemoveRadioButton->setCheck(false); + myKeepRadioButton->setCheck(false); + myReplaceRadioButton->setCheck(true); + return 1; + } else { + return 0; + } +} + + +long GNESelectorFrame::onCmdSubset(FXObject*, FXSelector, void*) { - // Clear items of myMatchTagBox - myMatchTagBox->clearItems(); - // Set items depending of current items - if (mySetBox->getCurrentItem() == 0) { - // If we want to work with net elementsn Get net Elements allowed tags - const std::vector& tags = GNEAttributeCarrier::allowedNetElementTags(); - // iterate over tags + if ((mySetComboBox->getText() == "Net Element") || (mySetComboBox->getText() == "Additional")) { + mySetComboBox->setTextColor(FXRGB(0, 0, 0)); + myMatchTagComboBox->enable(); + myMatchAttrComboBox->enable(); + myMatchString->enable(); + // Clear items of myMatchTagComboBox + myMatchTagComboBox->clearItems(); + // Set items depending of current items + const bool netElements = mySetComboBox->getText() == "Net Element"; + const std::vector& tags = GNEAttributeCarrier::allowedTags(netElements); for (std::vector::const_iterator it = tags.begin(); it != tags.end(); it++) { - // Add trag to MatchTagBox - myMatchTagBox->appendItem(toString(*it).c_str()); + myMatchTagComboBox->appendItem(toString(*it).c_str()); } - myMatchTagBox->setCurrentItem(1); // edges - myMatchTagBox->setNumVisible(myMatchTagBox->getNumItems()); - // Fill attributes with the current element type - onCmdSelMBTag(0, 0, 0); - } else { - // If we want to work with additionals, get net additionals allowed tags - const std::vector& tags = GNEAttributeCarrier::allowedAdditionalTags(); - // iterate over tags - for (std::vector::const_iterator it = tags.begin(); it != tags.end(); it++) { - // Add trag to MatchTagBox - myMatchTagBox->appendItem(toString(*it).c_str()); - } - myMatchTagBox->setCurrentItem(1); // busStops - myMatchTagBox->setNumVisible(myMatchTagBox->getNumItems()); + myMatchTagComboBox->setCurrentItem(0); // edges + myMatchTagComboBox->setNumVisible(myMatchTagComboBox->getNumItems()); // Fill attributes with the current element type onCmdSelMBTag(0, 0, 0); + return 1; + } else { + mySetComboBox->setTextColor(FXRGB(255, 0, 0)); + myMatchTagComboBox->disable(); + myMatchAttrComboBox->disable(); + myMatchString->disable(); + return 1; } - return 1; } @@ -203,7 +233,16 @@ std::set ids = gSelected.loadIDs(file, errors); handleIDs(std::vector(ids.begin(), ids.end()), false); if (errors != "") { + // write warning if netedit is running in testing mode + if (myViewNet->isTestingModeEnabled() == true) { + WRITE_WARNING("Opening FXMessageBox of type 'error'"); + } + // open message box error FXMessageBox::error(this, MBOX_OK, "Errors while loading Selection", "%s", errors.c_str()); + // write warning if netedit is running in testing mode + if (myViewNet->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'error' with 'OK'"); + } } } myViewNet->update(); @@ -221,7 +260,16 @@ try { gSelected.save(file.text()); } catch (IOError& e) { + // write warning if netedit is running in testing mode + if (myViewNet->isTestingModeEnabled() == true) { + WRITE_WARNING("Opening FXMessageBox of type 'error'"); + } + // open message box error FXMessageBox::error(this, MBOX_OK, "Storing Selection failed", "%s", e.what()); + // write warning if netedit is running in testing mode + if (myViewNet->isTestingModeEnabled() == true) { + WRITE_WARNING("Closed FXMessageBox of type 'error' with 'OK'"); + } } return 1; } @@ -241,7 +289,7 @@ for (std::set::const_iterator it = ids.begin(); it != ids.end(); it++) { gSelected.toggleSelection(*it); } - ids = myViewNet->getNet()->getGlIDs(myViewNet->selectEdges() ? GLO_EDGE : GLO_LANE); + ids = myViewNet->getNet()->getGlIDs((myViewNet->selectEdges() == true) ? GLO_EDGE : GLO_LANE); for (std::set::const_iterator it = ids.begin(); it != ids.end(); it++) { gSelected.toggleSelection(*it); } @@ -260,34 +308,66 @@ long GNESelectorFrame::onCmdSelMBTag(FXObject*, FXSelector, void*) { - const std::vector& tags = GNEAttributeCarrier::allowedTags(); - SumoXMLTag tag = tags[myMatchTagBox->getCurrentItem()]; - myMatchAttrBox->clearItems(); - const std::vector >& attrs = GNEAttributeCarrier::allowedAttributes(tag); - for (std::vector >::const_iterator it = attrs.begin(); it != attrs.end(); it++) { - myMatchAttrBox->appendItem(toString(it->first).c_str()); + const bool netElements = mySetComboBox->getText() == "Net Element"; + myCurrentTag = SUMO_TAG_NOTHING; + const std::vector& tags = GNEAttributeCarrier::allowedTags(netElements); + for (std::vector::const_iterator i = tags.begin(); (i != tags.end()) && (myCurrentTag == SUMO_TAG_NOTHING); i++) { + if (toString(*i) == myMatchTagComboBox->getText().text()) { + myCurrentTag = *i; + } + } + // check that typed by user value is correct + if (myCurrentTag != SUMO_TAG_NOTHING) { + // set color and enable items + myMatchTagComboBox->setTextColor(FXRGB(0, 0, 0)); + myMatchAttrComboBox->enable(); + myMatchString->enable(); + myMatchAttrComboBox->clearItems(); + const std::vector >& attrs = GNEAttributeCarrier::allowedAttributes(myCurrentTag); + for (std::vector >::const_iterator it = attrs.begin(); it != attrs.end(); it++) { + myMatchAttrComboBox->appendItem(toString(it->first).c_str()); + } + // @ToDo: Here can be placed a butto to set the default value + myMatchAttrComboBox->setNumVisible(myMatchAttrComboBox->getNumItems()); + } else { + // change color to red and disable items + myMatchTagComboBox->setTextColor(FXRGB(255, 0, 0)); + myMatchAttrComboBox->disable(); + myMatchString->disable(); } - - // @ToDo: Here can be placed a butto to set the default value - myMatchAttrBox->setNumVisible(myMatchAttrBox->getNumItems()); update(); return 1; } long +GNESelectorFrame::onCmdSelMBAttribute(FXObject*, FXSelector, void*) { + const std::vector >& attrs = GNEAttributeCarrier::allowedAttributes(myCurrentTag); + myCurrentAttribute = SUMO_ATTR_NOTHING; + for (std::vector >::const_iterator i = attrs.begin(); (i != attrs.end()) && (myCurrentAttribute == SUMO_ATTR_NOTHING); i++) { + if (toString(i->first) == myMatchAttrComboBox->getText().text()) { + myCurrentAttribute = i->first; + } + } + if (myCurrentAttribute != SUMO_ATTR_NOTHING) { + myMatchAttrComboBox->setTextColor(FXRGB(0, 0, 0)); + myMatchString->enable(); + } else { + myMatchAttrComboBox->setTextColor(FXRGB(255, 0, 0)); + myMatchString->disable(); + } + return 1; +} + + +long GNESelectorFrame::onCmdSelMBString(FXObject*, FXSelector, void*) { - const std::vector& tags = GNEAttributeCarrier::allowedTags(); - SumoXMLTag tag = tags[myMatchTagBox->getCurrentItem()]; - const std::vector >& attrs = GNEAttributeCarrier::allowedAttributes(tag); - SumoXMLAttr attr = attrs.at(myMatchAttrBox->getCurrentItem()).first; std::string expr(myMatchString->getText().text()); bool valid = true; - if (expr == "") { // the empty expression matches all objects - handleIDs(getMatches(tag, attr, '@', 0, expr), false); - } else if (GNEAttributeCarrier::isNumerical(attr)) { + handleIDs(getMatches(myCurrentTag, myCurrentAttribute, '@', 0, expr), false); + } else if (GNEAttributeCarrier::isNumerical(myCurrentTag, myCurrentAttribute)) { // The expression must have the form // val matches if attr > val @@ -299,12 +379,11 @@ } else { compOp = '='; } - SUMOReal val; - std::istringstream buf(expr); - buf >> val; - if (!buf.fail() && (int)buf.tellg() == (int)expr.size()) { - handleIDs(getMatches(tag, attr, compOp, val, expr), false); - } else { + try { + handleIDs(getMatches(myCurrentTag, myCurrentAttribute, compOp, GNEAttributeCarrier::parse(expr.c_str()), expr), false); + } catch (EmptyData&) { + valid = false; + } catch (NumberFormatException&) { valid = false; } } else { @@ -320,7 +399,7 @@ } else { compOp = '@'; } - handleIDs(getMatches(tag, attr, compOp, 0, expr), false); + handleIDs(getMatches(myCurrentTag, myCurrentAttribute, compOp, 0, expr), false); } if (valid) { myMatchString->setTextColor(FXRGB(0, 0, 0)); @@ -328,14 +407,13 @@ } else { myMatchString->setTextColor(FXRGB(255, 0, 0)); } - return 1; } long GNESelectorFrame::onCmdHelp(FXObject*, FXSelector, void*) { - FXDialogBox* helpDialog = new FXDialogBox(this, "Match Attribute Help", DECOR_CLOSE | DECOR_TITLE); + FXDialogBox* helpDialog = new FXDialogBox(this, "Match Attribute Help", GUIDesignDialogBox); std::ostringstream help; help << "The 'Match Attribute' controls allow to specify a set of objects which are then applied to the current selection " @@ -358,11 +436,9 @@ << "junction; id; 'foo' -> match all junctions that have 'foo' in their id\n" << "junction; type; '=priority' -> match all junctions of type 'priority', but not of type 'priority_stop'\n" << "edge; speed; '>10' -> match all edges with a speed above 10\n"; - new FXLabel(helpDialog, help.str().c_str(), 0, JUSTIFY_LEFT); + new FXLabel(helpDialog, help.str().c_str(), 0, GUIDesignLabelLeft); // "OK" - new FXButton(helpDialog, "OK\t\tSave modifications", 0, helpDialog, FXDialogBox::ID_ACCEPT, - ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, - 0, 0, 0, 0, 4, 4, 3, 3); + new FXButton(helpDialog, "OK\t\tSave modifications", GUIIconSubSys::getIcon(ICON_ACCEPT), helpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK); helpDialog->create(); helpDialog->show(); return 1; @@ -379,20 +455,20 @@ void GNESelectorFrame::show() { + // selection may have changed due to deletions gSelected.add2Update(this); - selectionUpdated(); // selection may have changed due to deletions - FXScrollWindow::show(); - // Show and Frame Area in which this GNEFrame is placed - myViewNet->getViewParent()->showFramesArea(); + selectionUpdated(); + // Show frame + GNEFrame::show(); } void GNESelectorFrame::hide() { + // selection may have changed due to deletions gSelected.remove2Update(); - FXScrollWindow::hide(); - // Hide Frame Area in which this GNEFrame is placed - myViewNet->getViewParent()->hideFramesArea(); + // hide frame + GNEFrame::hide(); } @@ -403,7 +479,8 @@ toString(gSelected.getSelected(GLO_EDGE).size()) + " Edges\n" + toString(gSelected.getSelected(GLO_LANE).size()) + " Lanes\n" + toString(gSelected.getSelected(GLO_CONNECTION).size()) + " Connections\n" + - toString(gSelected.getSelected(GLO_ADDITIONAL).size()) + " Additionals\n"; + toString(gSelected.getSelected(GLO_ADDITIONAL).size()) + " Additionals\n" + + toString(gSelected.getSelected(GLO_CROSSING).size()) + " Crossings"; } @@ -415,7 +492,7 @@ void -GNESelectorFrame::handleIDs(std::vector ids, bool selectEdges, SetOperation setop) { +GNESelectorFrame::handleIDs(std::vector ids, bool selectEdgesEnabled, SetOperation setop) { const SetOperation setOperation = (setop == SET_DEFAULT ? (SetOperation)mySetOperation : setop); std::set previousSelection; myViewNet->getUndoList()->p_begin("change selection"); @@ -436,10 +513,10 @@ GUIGlID id = *it; if (id > 0) { // net object? object = GUIGlObjectStorage::gIDStorage.getObjectBlocking(id); - if (object->getType() == GLO_LANE && selectEdges) { + if ((object->getType() == GLO_LANE) && (selectEdgesEnabled == true)) { const GNEEdge& edge = (static_cast(object))->getParentEdge(); idsSet.insert(edge.getGNEJunctionSource()->getGlID()); - idsSet.insert(edge.getGNEJunctionDest()->getGlID()); + idsSet.insert(edge.getGNEJunctionDestiny()->getGlID()); } GUIGlObjectStorage::gIDStorage.unblockObject(id); } @@ -458,7 +535,7 @@ } type = object->getType(); GUIGlObjectStorage::gIDStorage.unblockObject(id); - if (type == GLO_LANE && selectEdges) { + if ((type == GLO_LANE) && (selectEdgesEnabled == true)) { // @note edge may be selected/deselected multiple times but this shouldn't // hurt unless we add SET_TOGGLE id = (static_cast(object))->getParentEdge().getGlID(); @@ -489,12 +566,12 @@ std::vector -GNESelectorFrame::getMatches(SumoXMLTag tag, SumoXMLAttr attr, char compOp, SUMOReal val, const std::string& expr) { +GNESelectorFrame::getMatches(SumoXMLTag tag, SumoXMLAttr attr, char compOp, double val, const std::string& expr) { GUIGlObject* object; GNEAttributeCarrier* ac; std::vector result; const std::set allIDs = myViewNet->getNet()->getGlIDs(); - const bool numerical = GNEAttributeCarrier::isNumerical(attr); + const bool numerical = GNEAttributeCarrier::isNumerical(tag, attr); for (std::set::const_iterator it = allIDs.begin(); it != allIDs.end(); it++) { GUIGlID id = *it; object = GUIGlObjectStorage::gIDStorage.getObjectBlocking(id); @@ -506,7 +583,7 @@ if (expr == "") { result.push_back(id); } else if (numerical) { - SUMOReal acVal; + double acVal; std::istringstream buf(ac->getAttribute(attr)); buf >> acVal; switch (compOp) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNESelectorFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNESelectorFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNESelectorFrame.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNESelectorFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,13 +2,13 @@ /// @file GNESelectorFrame.h /// @author Jakob Erdmann /// @date Mar 2011 -/// @version $Id: GNESelectorFrame.h 21640 2016-10-09 20:28:52Z palcraft $ +/// @version $Id: GNESelectorFrame.h 24108 2017-04-27 18:43:30Z behrisch $ /// // The Widget for modifying selections of network-elements // (some elements adapted from GUIDialog_GLChosenEditor) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -59,10 +59,10 @@ }; /**@brief Constructor - * @brief parent FXFrame in which this GNEFrame is placed + * @brief parent FXHorizontalFrame in which this GNEFrame is placed * @brief viewNet viewNet that uses this GNEFrame */ - GNESelectorFrame(FXComposite* parent, GNEViewNet* viewNet); + GNESelectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet); /// @brief Destructor ~GNESelectorFrame(); @@ -75,46 +75,62 @@ /// @name FOX-callbacks /// @{ + /// @brief called when user change type of selction operation + long onCmdSelectOperation(FXObject*, FXSelector, void*); + /// @brief Called when the user change the type of element to search (netElement or Additional) long onCmdSubset(FXObject*, FXSelector, void*); - /// @brief Called when the user presses the Load-button - /// @note Opens a file dialog and forces the parent to load the list of selected - /// objects when a file was chosen. Rebuilds the list, then, and redraws itself. + /**@brief Called when the user presses the Load-button + * @note Opens a file dialog and forces the parent to load the list of selected + * objects when a file was chosen. Rebuilds the list, then, and redraws itself. + */ long onCmdLoad(FXObject*, FXSelector, void*); - /// @brief Called when the user presses the Save-button - /// @note Opens a file dialog and forces the selection container to save the list - /// of selected objects when a file was chosen. If the saveing failed, a message window is shown. + /** @brief Called when the user presses the Save-button + * @note Opens a file dialog and forces the selection container to save the list + of selected objects when a file was chosen. If the saveing failed, a message window is shown. + */ long onCmdSave(FXObject*, FXSelector, void*); - /// @brief Called when the user presses the Clear-button - /// @note Clear the internal list and calls GUISelectedStorage::clear and repaints itself + /**@brief Called when the user presses the Clear-button + * @note Clear the internal list and calls GUISelectedStorage::clear and repaints itself + */ long onCmdClear(FXObject*, FXSelector, void*); - /// @brief Called when the user presses the Invert-button - /// @note invert the selection and repaints itself + /**@brief Called when the user presses the Invert-button + * @note invert the selection and repaints itself + */ long onCmdInvert(FXObject*, FXSelector, void*); - /// @brief Called when the user selectes a tag in the match box - /// @note updates the attr listbox and repaints itself + /**@brief Called when the user selectes a tag in the match box + * @note updates the attr listbox and repaints itself + */ long onCmdSelMBTag(FXObject*, FXSelector, void*); - /// @brief Called when the user enters a new selection expression - /// @note validates expression and modifies current selection + /**@brief Called when the user selectes a tag in the match box + * @note updates the attr listbox and repaints itself + */ + long onCmdSelMBAttribute(FXObject*, FXSelector, void*); + + /**@brief Called when the user enters a new selection expression + * @note validates expression and modifies current selection + */ long onCmdSelMBString(FXObject*, FXSelector, void*); - /// @brief Called when the user clicks the help button - /// @note pop up help window + /**@brief Called when the user clicks the help button + * @note pop up help window + */ long onCmdHelp(FXObject*, FXSelector, void*); /// @brief Called when the user changes visual scaling long onCmdScaleSelection(FXObject*, FXSelector, void*); /// @} - /// @brief apply list of ids to the current selection according to SetOperation, - /// @note if setop==SET_DEFAULT than the currently set mode (mySetOperation) is used - void handleIDs(std::vector ids, bool selectEdges, SetOperation setop = SET_DEFAULT); + /**@brief apply list of ids to the current selection according to SetOperation, + * @note if setop==SET_DEFAULT than the currently set mode (mySetOperation) is used + */ + void handleIDs(std::vector ids, bool selectEdgesEnabled, SetOperation setop = SET_DEFAULT); /// @brief called if currently registered for updates for changes of global selection void selectionUpdated(); @@ -125,19 +141,28 @@ private: /// @brief how to modify selection - FXuint mySetOperation; + SetOperation mySetOperation; + + /// @brief add radio button + FXRadioButton* myAddRadioButton; + + /// @brief remove radio button + FXRadioButton* myRemoveRadioButton; - /// @brief target of modify selection - FXDataTarget mySetOperationTarget; + /// @brief keep button + FXRadioButton* myKeepRadioButton; + + /// @brief replace radio button + FXRadioButton* myReplaceRadioButton; /// @brief tag of the sets of elements - FXListBox* mySetBox; + FXComboBox* mySetComboBox; /// @brief tag of the match box - FXListBox* myMatchTagBox; + FXComboBox* myMatchTagComboBox; /// @brief attributes of the match box - FXListBox* myMatchAttrBox; + FXComboBox* myMatchAttrComboBox; /// @brief string of the match FXTextField* myMatchString; @@ -145,15 +170,22 @@ /// @brief selection scaling FXRealSpinDial* mySelectionScaling; + /// @brief current SumoXMLTag tag + SumoXMLTag myCurrentTag; + + /// @brief current SumoXMLTag Attribute + SumoXMLAttr myCurrentAttribute; + private: /// @brief get stats std::string getStats() const; - /// @brief return objects of the given type with matching attrs - /// @param[in] compOp One of {<,>,=} for matching against val or '@' for matching against expr - std::vector getMatches(SumoXMLTag tag, SumoXMLAttr attr, char compOp, SUMOReal val, const std::string& expr); + /**@brief return objects of the given type with matching attrs + * @param[in] compOp One of {<,>,=} for matching against val or '@' for matching against expr + */ + std::vector getMatches(SumoXMLTag tag, SumoXMLAttr attr, char compOp, double val, const std::string& expr); - /// @brief the string that should be matched against if attr 'allowed' or 'disalloed' are set to "all" + /// @brief the string that should be matched against if attr 'allowed' or 'disallowed' are set to "all" const std::string ALL_VCLASS_NAMES_MATCH_STRING; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEStoppingPlace.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEStoppingPlace.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEStoppingPlace.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEStoppingPlace.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEStoppingPlace.cpp /// @author Pablo Alvarez Lopez /// @date Dec 2015 -/// @version $Id: GNEStoppingPlace.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEStoppingPlace.cpp 23560 2017-03-20 14:57:08Z palcraft $ /// /// A abstract class to define common parameters of lane area in which vehicles can halt (GNE version) /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -56,17 +56,13 @@ #include "GNEChange_Attribute.h" #include "GNEViewNet.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif - // =========================================================================== // member method definitions // =========================================================================== -GNEStoppingPlace::GNEStoppingPlace(const std::string& id, GNEViewNet* viewNet, SumoXMLTag tag, GNELane* lane, SUMOReal startPos, SUMOReal endPos, bool blocked) : - GNEAdditional(id, viewNet, Position(), tag, NULL, blocked), +GNEStoppingPlace::GNEStoppingPlace(const std::string& id, GNEViewNet* viewNet, SumoXMLTag tag, GUIIcon icon, GNELane* lane, double startPos, double endPos) : + GNEAdditional(id, viewNet, Position(), tag, icon), myStartPos(startPos), myEndPos(endPos), mySignColor(RGBColor::YELLOW), @@ -84,18 +80,18 @@ Position GNEStoppingPlace::getPositionInView() const { - return myLane->getShape().positionAtOffset(myLane->getPositionRelativeToParametricLenght(myPosition.x())); + return myLane->getShape().positionAtOffset(myLane->getPositionRelativeToParametricLength(myPosition.x())); } void -GNEStoppingPlace::moveAdditionalGeometry(SUMOReal offsetx, SUMOReal offsety) { +GNEStoppingPlace::moveAdditionalGeometry(double offsetx, double offsety) { // Due a stoppingplace is placed over an lane ignore Warning of posy UNUSED_PARAMETER(offsety); // Move to Right if distance is positive, to left if distance is negative if (((offsetx > 0) && - ((myLane->getPositionRelativeToParametricLenght(myEndPos) + offsetx) < myLane->getLaneParametricLenght())) || - ((offsetx < 0) && ((myLane->getPositionRelativeToParametricLenght(myStartPos) + offsetx) > 0))) { + ((myLane->getPositionRelativeToParametricLength(myEndPos) + offsetx) < myLane->getLaneParametricLength())) || + ((offsetx < 0) && ((myLane->getPositionRelativeToParametricLength(myStartPos) + offsetx) > 0))) { // change attribute myStartPos += offsetx; myEndPos += offsetx; @@ -106,7 +102,7 @@ void -GNEStoppingPlace::commmitAdditionalGeometryMoved(SUMOReal oldPosx, SUMOReal oldPosy, GNEUndoList* undoList) { +GNEStoppingPlace::commmitAdditionalGeometryMoved(double oldPosx, double oldPosy, GNEUndoList* undoList) { undoList->p_begin("position of " + toString(getTag())); undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_STARTPOS, toString(getStartPosition()), true, toString(oldPosx))); undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_ENDPOS, toString(getEndPosition()), true, toString(oldPosy))); @@ -116,26 +112,26 @@ } -SUMOReal +double GNEStoppingPlace::getStartPosition() const { return myStartPos; } -SUMOReal +double GNEStoppingPlace::getEndPosition() const { return myEndPos; } void -GNEStoppingPlace::setStartPosition(SUMOReal startPos) { +GNEStoppingPlace::setStartPosition(double startPos) { if (startPos < 0) { - throw InvalidArgument("Start position '" + toString(startPos) + "' not allowed. Must be greather than 0"); + throw InvalidArgument(toString(SUMO_ATTR_STARTPOS) + " '" + toString(startPos) + "' not allowed. Must be greater than 0"); } else if (startPos >= myEndPos) { - throw InvalidArgument("Start position '" + toString(startPos) + "' not allowed. Must be smaller than endPos '" + toString(myEndPos) + "'"); + throw InvalidArgument(toString(SUMO_ATTR_STARTPOS) + " '" + toString(startPos) + "' not allowed. Must be smaller than endPos '" + toString(myEndPos) + "'"); } else if ((myEndPos - startPos) < 1) { - throw InvalidArgument("Start position '" + toString(startPos) + "' not allowed. Lenght of StoppingPlace must be equal or greather than 1"); + throw InvalidArgument(toString(SUMO_ATTR_STARTPOS) + " '" + toString(startPos) + "' not allowed. Length of StoppingPlace must be equal or greater than 1"); } else { myStartPos = startPos; } @@ -143,13 +139,13 @@ void -GNEStoppingPlace::setEndPosition(SUMOReal endPos) { - if (endPos > myLane->getLaneShapeLenght()) { - throw InvalidArgument("End position '" + toString(endPos) + "' not allowed. Must be smaller than lane length"); +GNEStoppingPlace::setEndPosition(double endPos) { + if (endPos > myLane->getLaneShapeLength()) { + throw InvalidArgument(toString(SUMO_ATTR_ENDPOS) + " '" + toString(endPos) + "' not allowed. Must be smaller than lane length"); } else if (myStartPos >= endPos) { - throw InvalidArgument("End position '" + toString(endPos) + "' not allowed. Must be smaller than endPos '" + toString(myEndPos) + "'"); + throw InvalidArgument(toString(SUMO_ATTR_ENDPOS) + " '" + toString(endPos) + "' not allowed. Must be smaller than endPos '" + toString(myEndPos) + "'"); } else if ((endPos - myStartPos) < 1) { - throw InvalidArgument("End position '" + toString(endPos) + "' not allowed. Lenght of StoppingPlace must be equal or greather than 1"); + throw InvalidArgument(toString(SUMO_ATTR_ENDPOS) + " '" + toString(endPos) + "' not allowed. Length of StoppingPlace must be equal or greater than 1"); } else { myEndPos = endPos; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEStoppingPlace.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEStoppingPlace.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEStoppingPlace.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEStoppingPlace.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEStoppingPlace.h /// @author Pablo Alvarez Lopez /// @date Dec 2015 -/// @version $Id: GNEStoppingPlace.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEStoppingPlace.h 23150 2017-02-27 12:08:30Z behrisch $ /// /// A abstract class to define common parameters of lane area in which vehicles can halt (GNE version) /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -53,12 +53,12 @@ * @param[in] id Gl-id of the stopping place (Must be unique) * @param[in] viewNet pointer to GNEViewNet of this additional element belongs * @param[in] tag Type of xml tag that define the StoppingPlace (SUMO_TAG_BUS_STOP, SUMO_TAG_CHARGING_STATION, etc...) + * @param[in] icon GUIIcon associated to the stopping place * @param[in] lane Lane of this StoppingPlace belongs * @param[in] startPos Start position of the StoppingPlace * @param[in] endPos End position of the StoppingPlace - * @param[in] blocked set initial blocking state of item */ - GNEStoppingPlace(const std::string& id, GNEViewNet* viewNet, SumoXMLTag tag, GNELane* lane, SUMOReal startPos, SUMOReal endPos, bool blocked = false); + GNEStoppingPlace(const std::string& id, GNEViewNet* viewNet, SumoXMLTag tag, GUIIcon icon, GNELane* lane, double startPos, double endPos); /// @brief Destructor ~GNEStoppingPlace(); @@ -70,34 +70,34 @@ Position getPositionInView() const; /// @brief change the position of the StoppingPlace geometry - void moveAdditionalGeometry(SUMOReal offsetx, SUMOReal offsety); + void moveAdditionalGeometry(double offsetx, double offsety); /// @brief updated geometry changes in the attributes of additional - void commmitAdditionalGeometryMoved(SUMOReal oldPosx, SUMOReal oldPosy, GNEUndoList* undoList); + void commmitAdditionalGeometryMoved(double oldPosx, double oldPosy, GNEUndoList* undoList); /**@brief writte additional element into a xml file * @param[in] device device in which write parameters of additional element * @param[in] currentDirectory current directory in which this additional are writted */ - virtual void writeAdditional(OutputDevice& device, const std::string& currentDirectory) = 0; + virtual void writeAdditional(OutputDevice& device) const = 0; /// @brief Returns the Start position of the stoppingPlace - SUMOReal getStartPosition() const; + double getStartPosition() const; /// @brief Returns the End position of the stoppingPlace - SUMOReal getEndPosition() const; + double getEndPosition() const; /**@brief Set a new Start position in StoppingPlace * @param[in] startPos new Start position of StoppingPlace * @throws InvalidArgument if value of startPos isn't valid */ - void setStartPosition(SUMOReal startPos); + void setStartPosition(double startPos); /**@brief Set a new End position in StoppingPlace * @param[in] endPos new End position of StoppingPlace * @throws InvalidArgument if value of endPos isn't valid */ - void setEndPosition(SUMOReal endPos); + void setEndPosition(double endPos); /// @name inherited from GNEAdditional /// @{ @@ -137,10 +137,10 @@ protected: /// @brief The start position this stopping place is located at - SUMOReal myStartPos; + double myStartPos; /// @brief The end position this stopping place is located at - SUMOReal myEndPos; + double myEndPos; /// @brief The position of the sign Position mySignPos; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNETLSEditorFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNETLSEditorFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNETLSEditorFrame.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNETLSEditorFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNETLSEditorFrame.cpp /// @author Jakob Erdmann /// @date May 2011 -/// @version $Id: GNETLSEditorFrame.cpp 21217 2016-07-22 10:57:44Z behrisch $ +/// @version $Id: GNETLSEditorFrame.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The Widget for modifying traffic lights /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -28,20 +28,17 @@ #include #endif -#ifdef HAVE_VERSION_H -#include -#endif - #include #include #include -#include #include #include #include +#include #include #include #include + #include "GNETLSEditorFrame.h" #include "GNEViewNet.h" #include "GNEViewParent.h" @@ -53,10 +50,6 @@ #include "GNEInternalLane.h" #include "GNEChange_TLS.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping // =========================================================================== @@ -77,7 +70,6 @@ FXMAPFUNC(SEL_DESELECTED, MID_GNE_PHASE_TABLE, GNETLSEditorFrame::onCmdPhaseSwitch), FXMAPFUNC(SEL_CHANGED, MID_GNE_PHASE_TABLE, GNETLSEditorFrame::onCmdPhaseSwitch), FXMAPFUNC(SEL_REPLACED, MID_GNE_PHASE_TABLE, GNETLSEditorFrame::onCmdPhaseEdit), - FXMAPFUNC(SEL_UPDATE, MID_GNE_DEF_CREATE, GNETLSEditorFrame::onUpdDefCreate), FXMAPFUNC(SEL_UPDATE, MID_GNE_DEF_DELETE, GNETLSEditorFrame::onUpdDefSwitch), FXMAPFUNC(SEL_UPDATE, MID_GNE_DEF_SWITCH, GNETLSEditorFrame::onUpdDefSwitch), @@ -90,47 +82,59 @@ // Object implementation -FXIMPLEMENT(GNETLSEditorFrame, FXScrollWindow, GNETLSEditorFrameMap, ARRAYNUMBER(GNETLSEditorFrameMap)) +FXIMPLEMENT(GNETLSEditorFrame, FXVerticalFrame, GNETLSEditorFrameMap, ARRAYNUMBER(GNETLSEditorFrameMap)) // =========================================================================== // method definitions // =========================================================================== -GNETLSEditorFrame::GNETLSEditorFrame(FXComposite* parent, GNEViewNet* viewNet): - GNEFrame(parent, viewNet, "Edit Traffic Light"), +GNETLSEditorFrame::GNETLSEditorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet): + GNEFrame(horizontalFrameParent, viewNet, "Edit Traffic Light"), myTableFont(new FXFont(getApp(), "Courier New", 9)), myCurrentJunction(0), myHaveModifications(false), myEditedDef(0) { - // heading - myDescription = new FXLabel(myContentFrame, "", 0, JUSTIFY_LEFT); - new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4); - - // create tlDef button - new FXButton(myContentFrame, "Create TLS\t\tCreate a new traffic light program", 0, this, MID_GNE_DEF_CREATE, - ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, - 0, 0, 0, 0, 4, 4, 3, 3); - - // delete tlDef button - new FXButton(myContentFrame, - "Delete TLS\t\tDelete a traffic light program. If all programs are deleted the junction turns into a priority junction.", - 0, this, MID_GNE_DEF_DELETE, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, - 0, 0, 0, 0, 4, 4, 3, 3); - - // definitions list - new FXLabel(myContentFrame, "Name, Program"); - myDefBox = new FXListBox(myContentFrame, this, MID_GNE_DEF_SWITCH, - FRAME_SUNKEN | FRAME_THICK | LISTBOX_NORMAL | LAYOUT_FIX_WIDTH); - - // offset control - new FXLabel(myContentFrame, "Offset"); - myOffset = new FXTextField(myContentFrame, 6, - this, MID_GNE_DEF_OFFSET, TEXTFIELD_NORMAL | TEXTFIELD_REAL, 0, 0, 0, 0, 4, 2, 0, 2); - - new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4); - - // phase table - new FXLabel(myContentFrame, "Phases"); - myPhaseTable = new FXTable(myContentFrame, this, MID_GNE_PHASE_TABLE, LAYOUT_FIX_HEIGHT | LAYOUT_FIX_WIDTH); + // create groupbox for description + myGroupBoxJunction = new FXGroupBox(myContentFrame, "Junction", GUIDesignGroupBoxFrame); + + // create description label + myDescription = new FXLabel(myGroupBoxJunction, "No Junction Selected\n", 0, GUIDesignLabelLeft); + + // create groupbox for tl df + myGroupBoxTLSDef = new FXGroupBox(myContentFrame, "Traffic lights definition", GUIDesignGroupBoxFrame); + + // create create tlDef button + myNewTLProgram = new FXButton(myGroupBoxTLSDef, "Create TLS\t\tCreate a new traffic light program", 0, this, MID_GNE_DEF_CREATE, GUIDesignButton); + + // create delete tlDef button + myDeleteTLProgram = new FXButton(myGroupBoxTLSDef, "Delete TLS\t\tDelete a traffic light program. If all programs are deleted the junction turns into a priority junction.", 0, this, MID_GNE_DEF_DELETE, GUIDesignButton); + + // create groupbox for phases + myGroupBoxAttributes = new FXGroupBox(myContentFrame, "Attributes", GUIDesignGroupBoxFrame); + + // Create matrix + myAttributeMatrix = new FXMatrix(myGroupBoxAttributes, 2, GUIDesignMatrixAttributes); + + // create label for name + myNameLabel = new FXLabel(myAttributeMatrix, "Name", 0, GUIDesignLabelAttribute); + + // create text field for name + myNameTextField = new FXTextField(myAttributeMatrix, GUIDesignTextFieldNCol, this, MID_GNE_DEF_SWITCH, GUIDesignTextField); + + // create label for program + myProgramLabel = new FXLabel(myAttributeMatrix, "Program", 0, GUIDesignLabelAttribute); + + // create combo box for program + myProgramComboBox = new FXComboBox(myAttributeMatrix, GUIDesignComboBoxNCol, this, MID_GNE_DEF_SWITCH, GUIDesignComboBoxAttribute); + + // create offset control + myOffsetLabel = new FXLabel(myAttributeMatrix, "Offset", 0, GUIDesignLabelAttribute); + myOffset = new FXTextField(myAttributeMatrix, GUIDesignTextFieldNCol, this, MID_GNE_DEF_OFFSET, GUIDesignTextFieldReal); + + // create groupbox for phases + myGroupBoxPhases = new FXGroupBox(myContentFrame, "Phases", GUIDesignGroupBoxFrame); + + // create and configure phase table + myPhaseTable = new FXTable(myGroupBoxPhases, this, MID_GNE_PHASE_TABLE, GUIDesignTableLimitedHeight); myPhaseTable->setColumnHeaderMode(LAYOUT_FIX_HEIGHT); myPhaseTable->setColumnHeaderHeight(0); myPhaseTable->setRowHeaderMode(LAYOUT_FIX_WIDTH); @@ -139,36 +143,29 @@ myPhaseTable->setFont(myTableFont); myPhaseTable->setHelpText("phase duration in seconds | phase state"); - // total duration info - myCycleDuration = new FXLabel(myContentFrame, ""); + // create total duration info label + myCycleDuration = new FXLabel(myGroupBoxPhases, "", 0, GUIDesignLabelLeft); + + // create new phase button + myInsertDuplicateButton = new FXButton(myGroupBoxPhases, "Copy Phase\t\tInsert duplicate phase after selected phase", 0, this, MID_GNE_PHASE_CREATE, GUIDesignButton); + + // create delete phase button + myDeleteSelectedPhaseButton = new FXButton(myGroupBoxPhases, "Delete Phase\t\tDelete selected phase", 0, this, MID_GNE_PHASE_DELETE, GUIDesignButton); + + // create groupbox for modifications + myGroupBoxModifications = new FXGroupBox(myContentFrame, "Modifications", GUIDesignGroupBoxFrame); + + // create discard modifications buttons + myDiscardModificationsButtons = new FXButton(myGroupBoxModifications, "Cancel\t\tDiscard program modifications (Esc)", 0, this, MID_CANCEL, GUIDesignButton); + + // create save modifications button + mySaveModificationsButtons = new FXButton(myGroupBoxModifications, "Save\t\tSave program modifications (Enter)", 0, this, MID_OK, GUIDesignButton); + - // insert new phase button - new FXButton(myContentFrame, "Copy Phase\t\tInsert duplicate phase after selected phase", 0, this, MID_GNE_PHASE_CREATE, - ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, - 0, 0, 0, 0, 4, 4, 3, 3); - - // delete phase button - new FXButton(myContentFrame, "Delete Phase\t\tDelete selected phase", 0, this, MID_GNE_PHASE_DELETE, - ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, - 0, 0, 0, 0, 4, 4, 3, 3); - - new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4); - // buttons - // "Cancel" - new FXButton(myContentFrame, "Cancel\t\tDiscard program modifications (Esc)", 0, this, MID_CANCEL, - ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, - 0, 0, 0, 0, 4, 4, 3, 3); - // "OK" - new FXButton(myContentFrame, "Save\t\tSave program modifications (Enter)", 0, this, MID_OK, - ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, - 0, 0, 0, 0, 4, 4, 3, 3); - new FXHorizontalSeparator(myContentFrame, SEPARATOR_GROOVE | LAYOUT_FILL_X, 0, 0, 0, 2, 2, 2, 4, 4); // "Add 'off' program" /* new FXButton(myContentFrame, "Add \"Off\"-Program\t\tAdds a program for switching off this traffic light", - 0, this, MID_GNE_DEF_ADDOFF, - ICON_BEFORE_TEXT|LAYOUT_FILL_X|FRAME_THICK|FRAME_RAISED, - 0, 0, 0, 0, 4, 4, 3, 3); + 0, this, MID_GNE_DEF_ADDOFF, GUIDesignButton); */ } @@ -180,23 +177,6 @@ void -GNETLSEditorFrame::show() { - // Show Scroll window - FXScrollWindow::show(); - // Show and update Frame Area in which this GNEFrame is placed - myViewNet->getViewParent()->showFramesArea(); -} - - -void -GNETLSEditorFrame::hide() { - // Hide ScrollWindow - FXScrollWindow::hide(); - // Hide Frame Area in which this GNEFrame is placed - myViewNet->getViewParent()->hideFramesArea(); -} - -void GNETLSEditorFrame::editJunction(GNEJunction* junction) { if (myCurrentJunction == 0 || (!myHaveModifications && (junction != myCurrentJunction))) { onCmdCancel(0, 0, 0); @@ -225,7 +205,7 @@ GNETLSEditorFrame::onCmdOK(FXObject*, FXSelector, void*) { if (myCurrentJunction != 0) { if (myHaveModifications) { - NBTrafficLightDefinition* old = myDefinitions[myDefBox->getCurrentItem()]; + NBTrafficLightDefinition* old = myDefinitions[myProgramComboBox->getCurrentItem()]; std::vector nodes = old->getNodes(); for (std::vector::iterator it = nodes.begin(); it != nodes.end(); it++) { GNEJunction* junction = myViewNet->getNet()->retrieveJunction((*it)->getID()); @@ -266,7 +246,7 @@ if (changeType) { junction->setAttribute(SUMO_ATTR_TYPE, toString(NODETYPE_PRIORITY), myViewNet->getUndoList()); } else { - NBTrafficLightDefinition* tlDef = myDefinitions[myDefBox->getCurrentItem()]; + NBTrafficLightDefinition* tlDef = myDefinitions[myProgramComboBox->getCurrentItem()]; myViewNet->getUndoList()->add(new GNEChange_TLS(junction, tlDef, false), true); } return 1; @@ -276,8 +256,8 @@ long GNETLSEditorFrame::onCmdDefSwitch(FXObject*, FXSelector, void*) { assert(myCurrentJunction != 0); - assert((int)myDefinitions.size() == myDefBox->getNumItems()); - NBTrafficLightDefinition* tlDef = myDefinitions[myDefBox->getCurrentItem()]; + assert((int)myDefinitions.size() == myProgramComboBox->getNumItems()); + NBTrafficLightDefinition* tlDef = myDefinitions[myProgramComboBox->getCurrentItem()]; // logic may not have been recomputed yet. recompute to be sure NBTrafficLightLogicCont& tllCont = myViewNet->getNet()->getTLLogicCont(); myViewNet->getNet()->computeJunction(myCurrentJunction); @@ -432,7 +412,7 @@ FXString value = myPhaseTable->getItemText(tp->row, tp->col); if (tp->col == 0) { // duration edited - if (GNEAttributeCarrier::canParse(value.text())) { + if (GNEAttributeCarrier::canParse(value.text())) { SUMOTime duration = getSUMOTime(value); if (duration > 0) { myEditedDef->getLogic()->setPhaseDuration(tp->row, duration); @@ -467,7 +447,7 @@ description = "No Junction Selected\n"; } else { NBNode* nbn = myCurrentJunction->getNBNode(); - description = "Junction '" + nbn->getID() + "'\n("; + description = "Current junction: " + nbn->getID() + "\n("; if (!nbn->isTLControlled()) { description += "uncontrolled, "; } @@ -489,9 +469,10 @@ myEditedDef = 0; buildIinternalLanes(0); // only clears // clean up controls + myNameTextField->setText(""); myOffset->setText(""); myDefinitions.clear(); - myDefBox->hide(); + myProgramComboBox->hide(); initPhaseTable(); // only clears when there are no definitions myCycleDuration->hide(); updateDescription(); @@ -539,19 +520,20 @@ void GNETLSEditorFrame::initDefinitions() { myDefinitions.clear(); - myDefBox->clearItems(); + myNameTextField->setText(""); + myProgramComboBox->clearItems(); assert(myCurrentJunction); NBNode* nbn = myCurrentJunction->getNBNode(); std::set tldefs = nbn->getControllingTLS(); for (std::set::iterator it = tldefs.begin(); it != tldefs.end(); it++) { myDefinitions.push_back(*it); - std::string item = (*it)->getID() + ", " + (*it)->getProgramID(); - myDefBox->appendItem(item.c_str()); + myNameTextField->setText((*it)->getID().c_str()); + myProgramComboBox->appendItem((*it)->getProgramID().c_str()); } if (myDefinitions.size() > 0) { - myDefBox->setCurrentItem(0); - myDefBox->setNumVisible(myDefBox->getNumItems()); - myDefBox->show(); + myProgramComboBox->setCurrentItem(0); + myProgramComboBox->setNumVisible(myProgramComboBox->getNumItems()); + myProgramComboBox->show(); onCmdDefSwitch(0, 0, 0); } updateDescription(); @@ -574,12 +556,7 @@ myPhaseTable->getItem(row, 1)->setJustify(FXTableItem::LEFT); } myPhaseTable->fitColumnsToContents(0, 2); - const int maxWidth = 140 - 4; - int desiredWidth = myPhaseTable->getColumnWidth(0) + - myPhaseTable->getColumnWidth(1) + 3; - int spaceForScrollBar = desiredWidth > maxWidth ? 15 : 0; - myPhaseTable->setHeight((int)phases.size() * 21 + spaceForScrollBar); // experimental - myPhaseTable->setWidth(MIN2(desiredWidth, maxWidth)); + myPhaseTable->setHeight((int)phases.size() * 21); // experimental myPhaseTable->setCurrentItem(index, 0); myPhaseTable->selectRow(index, true); myPhaseTable->show(); @@ -673,8 +650,8 @@ SUMOTime GNETLSEditorFrame::getSUMOTime(const FXString& string) { - assert(GNEAttributeCarrier::canParse(string.text())); - return TIME2STEPS(GNEAttributeCarrier::parse(string.text())); + assert(GNEAttributeCarrier::canParse(string.text())); + return TIME2STEPS(GNEAttributeCarrier::parse(string.text())); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNETLSEditorFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNETLSEditorFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNETLSEditorFrame.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNETLSEditorFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNETLSEditorFrame.h /// @author Jakob Erdmann /// @date May 2011 -/// @version $Id: GNETLSEditorFrame.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: GNETLSEditorFrame.h 22929 2017-02-13 14:38:39Z behrisch $ /// // The Widget for modifying traffic lights /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -54,20 +54,14 @@ public: /**@brief Constructor - * @brief parent FXFrame in which this GNEFrame is placed + * @brief parent FXHorizontalFrame in which this GNEFrame is placed * @brief viewNet viewNet that uses this GNEFrame */ - GNETLSEditorFrame(FXComposite* parent, GNEViewNet* viewNet); + GNETLSEditorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet); /// @brief Destructor ~GNETLSEditorFrame(); - /// @brief show Frame - void show(); - - /// @brief hide Frame - void hide(); - /// @brief edits the traffic light for the given junction /// @param[in] junction The junction of which the traffic light shall be edited void editJunction(GNEJunction* junction); @@ -157,9 +151,69 @@ /// @brief font for the phase table FXFont* myTableFont; + /// @brief groupbox for current junction + FXGroupBox* myGroupBoxJunction; + /// @brief the label that shows the current editing state FXLabel* myDescription; + /// @brief groupbox for TLS Definition buttons + FXGroupBox* myGroupBoxTLSDef; + + /// @brief button for create new Traffic light program + FXButton* myNewTLProgram; + + /// @brief button for delete traffic light program + FXButton* myDeleteTLProgram; + + /// @brief groupbox for TLS attributes + FXGroupBox* myGroupBoxAttributes; + + /// @brief matrix for attributes + FXMatrix* myAttributeMatrix; + + /// @brief name label + FXLabel* myNameLabel; + + /// @brief name text field + FXTextField* myNameTextField; + + /// @brief program label + FXLabel* myProgramLabel; + + /// @brief the comboBox for selecting the tl-definition to edit + FXComboBox* myProgramComboBox; + + /// @brief offset label + FXLabel* myOffsetLabel; + + /// @brief the control for modifying offset + FXTextField* myOffset; + + /// @brief groupbox for phases + FXGroupBox* myGroupBoxPhases; + + /// @brief table for selecting and rearranging phases and for changing duration + FXTable* myPhaseTable; + + /// @brief label with the cycle duration + FXLabel* myCycleDuration; + + /// @brief insert new phase button + FXButton* myInsertDuplicateButton; + + /// @brief delete phase button + FXButton* myDeleteSelectedPhaseButton; + + /// @brief groupbox for buttons modifications + FXGroupBox* myGroupBoxModifications; + + /// @brief button for cancel modifications + FXButton* myDiscardModificationsButtons; + + /// @brief button for save modifications + FXButton* mySaveModificationsButtons; + /// @brief the junction of the tls is being modified GNEJunction* myCurrentJunction; @@ -176,22 +230,9 @@ /// @brief the traffic light definition being edited NBLoadedSUMOTLDef* myEditedDef; - /// @brief the listbox for selecting the tl-definition to edit - FXListBox* myDefBox; - - /// @brief the control for modifying offset - FXTextField* myOffset; - - /// @brief label with the cycle duration - FXLabel* myCycleDuration; - - /// @brief table for selecting and rearranging phases and for changing duration - FXTable* myPhaseTable; - /// @brief index of the phase being shown int myPhaseIndex; -private: /// @brief update descrition void updateDescription() const; @@ -204,8 +245,9 @@ /// @brief initializes the definitions and corresponding listbox void initDefinitions(); - /// @brief initialies the phase table - /// @param[in] index The index to select + /**@brief initialies the phase table + * @param[in] index The index to select + */ void initPhaseTable(int index = 0); /// @brief the phase of the current traffic light diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEUndoList.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEUndoList.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEUndoList.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEUndoList.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,7 +2,7 @@ /// @file GNEUndoList.cpp /// @author Jakob Erdmann /// @date Mar 2011 -/// @version $Id: GNEUndoList.cpp 21777 2016-10-25 09:19:08Z namdre $ +/// @version $Id: GNEUndoList.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // FXUndoList is pretty dandy but some features are missing: // - we cannot find out wether we have currently begun an undo-group and @@ -13,7 +13,7 @@ // prefixed with p_ /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,10 +40,6 @@ #include "GNEChange_Attribute.h" #include "GNEApplicationWindow.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif - // =========================================================================== // FOX callback mapping diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEUndoList.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEUndoList.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEUndoList.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEUndoList.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,7 +2,7 @@ /// @file GNEUndoList.h /// @author Jakob Erdmann /// @date Mar 2011 -/// @version $Id: GNEUndoList.h 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: GNEUndoList.h 22608 2017-01-17 06:28:54Z behrisch $ /// // FXUndoList is pretty dandy but some features are missing: // - we cannot find out wether we have currently begun an undo-group and @@ -13,7 +13,7 @@ // prefixed with p_ /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVaporizer.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVaporizer.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVaporizer.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVaporizer.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEVaporizer.cpp /// @author Pablo Alvarez Lopez /// @date Jun 2016 -/// @version $Id: GNEVaporizer.cpp 21640 2016-10-09 20:28:52Z palcraft $ +/// @version $Id: GNEVaporizer.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -57,16 +57,13 @@ #include "GNENet.h" #include "GNEChange_Attribute.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // =========================================================================== // member method definitions // =========================================================================== -GNEVaporizer::GNEVaporizer(const std::string& id, GNEViewNet* viewNet, GNEEdge* edge, SUMOTime startTime, SUMOTime end, bool blocked) : - GNEAdditional(id, viewNet, Position(), SUMO_TAG_VAPORIZER, NULL, blocked), +GNEVaporizer::GNEVaporizer(GNEViewNet* viewNet, GNEEdge* edge, double startTime, double end) : + GNEAdditional(viewNet->getNet()->generateVaporizerID(), viewNet, Position(), SUMO_TAG_VAPORIZER, ICON_VAPORIZER), myStartTime(startTime), myEnd(end) { // This additional belongs to a edge @@ -93,11 +90,17 @@ // clear Shape myShape.clear(); + // obtain relative position of vaporizer in edge + myRelativePosition = 2 * myEdge->getVaporizerRelativePosition(this); + // get lanes of edge GNELane* firstLane = myEdge->getLanes().at(0); + // Save number of lanes + myNumberOfLanes = int(myEdge->getLanes().size()); + // Get shape of lane parent - myShape.push_back(firstLane->getShape().positionAtOffset(3)); + myShape.push_back(firstLane->getShape().positionAtOffset(5)); // Obtain first position Position f = myShape[0] - Position(1, 0); @@ -112,7 +115,7 @@ myBlockIconPosition = myShape.getLineCenter(); // Set offset of the block icon - myBlockIconOffset = Position(1.1, -3.06); + myBlockIconOffset = Position(1.1, (-3.06) - myRelativePosition); // Set block icon rotation, and using their rotation for logo setBlockIconRotation(firstLane); @@ -133,22 +136,21 @@ void -GNEVaporizer::moveAdditionalGeometry(SUMOReal, SUMOReal) { +GNEVaporizer::moveAdditionalGeometry(double, double) { // This additional cannot be moved } void -GNEVaporizer::commmitAdditionalGeometryMoved(SUMOReal, SUMOReal, GNEUndoList*) { +GNEVaporizer::commmitAdditionalGeometryMoved(double, double, GNEUndoList*) { // This additional cannot be moved } void -GNEVaporizer::writeAdditional(OutputDevice& device, const std::string&) { +GNEVaporizer::writeAdditional(OutputDevice& device) const { // Write parameters device.openTag(getTag()); - device.writeAttr(SUMO_ATTR_ID, getID()); device.writeAttr(SUMO_ATTR_EDGE, myEdge->getID()); device.writeAttr(SUMO_ATTR_STARTTIME, myStartTime); device.writeAttr(SUMO_ATTR_END, myEnd); @@ -157,26 +159,26 @@ } -SUMOTime +double GNEVaporizer::getStartTime() const { return myStartTime; } -SUMOTime +double GNEVaporizer::getEnd() const { return myEnd; } void -GNEVaporizer::setStartTime(SUMOTime startTime) { +GNEVaporizer::setStartTime(double startTime) { myStartTime = startTime; } void -GNEVaporizer::setEndTime(SUMOTime end) { +GNEVaporizer::setEndTime(double end) { myEnd = end; } @@ -191,12 +193,9 @@ GNEVaporizer::drawGL(const GUIVisualizationSettings& s) const { // get values glPushName(getGlID()); + double width = (double) 2.0 * s.scale; glLineWidth(1.0); - - // Declare auxiliar values - const SUMOReal exaggeration = s.addSize.getExaggeration(s); - int numberOfLanes = int(myEdge->getLanes().size()); - SUMOReal width = (SUMOReal) 2.0 * s.scale; + const double exaggeration = s.addSize.getExaggeration(s); // draw shape glColor3ub(120, 216, 0); @@ -209,8 +208,8 @@ glBegin(GL_QUADS); glVertex2d(0, 0.25); glVertex2d(0, -0.25); - glVertex2d((numberOfLanes * 3.3), -0.25); - glVertex2d((numberOfLanes * 3.3), 0.25); + glVertex2d((myNumberOfLanes * 3.3), -0.25); + glVertex2d((myNumberOfLanes * 3.3), 0.25); glEnd(); glTranslated(0, 0, .01); glBegin(GL_LINES); @@ -224,7 +223,7 @@ glColor3d(1, 1, 1); glBegin(GL_LINES); glVertex2d(0, 0); - glVertex2d(0, (numberOfLanes * 3.3)); + glVertex2d(0, (myNumberOfLanes * 3.3)); glEnd(); } @@ -235,15 +234,15 @@ glPushMatrix(); glTranslated(myShape[0].x(), myShape[0].y(), getType()); glRotated(myShapeRotations[0], 0, 0, 1); - glTranslated(-2.56, - 1.6, 0); + glTranslated((-2.56) - myRelativePosition, (-1.6), 0); glColor3d(1, 1, 1); glRotated(-90, 0, 0, 1); // Draw icon depending of detector is or isn't selected if (isAdditionalSelected()) { - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_VAPORIZERSELECTED), 1); + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_VAPORIZERSELECTED), 1); } else { - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_VAPORIZER), 1); + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_VAPORIZER), 1); } // Pop logo matrix @@ -273,7 +272,7 @@ case SUMO_ATTR_END: return toString(myEnd); default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -292,7 +291,7 @@ updateGeometry(); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -313,11 +312,29 @@ return false; } case SUMO_ATTR_STARTTIME: - return canParse(value); + if (canParse(value) && (parse(value) >= 0)) { + double startTime = parse(value); + if (startTime <= myEnd) { + return true; + } else { + return false; + } + } else { + return false; + } case SUMO_ATTR_END: - return canParse(value); + if (canParse(value) && (parse(value) >= 0)) { + double end = parse(value); + if (myStartTime <= end) { + return true; + } else { + return false; + } + } else { + return false; + } default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } @@ -332,13 +349,13 @@ changeEdge(value); break; case SUMO_ATTR_STARTTIME: - myStartTime = parse(value); + myStartTime = parse(value); break; case SUMO_ATTR_END: - myEnd = parse(value); + myEnd = parse(value); break; default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVaporizer.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVaporizer.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVaporizer.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVaporizer.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEVaporizer.h /// @author Pablo Alvarez Lopez /// @date Jun 2016 -/// @version $Id: GNEVaporizer.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEVaporizer.h 23483 2017-03-16 13:45:41Z palcraft $ /// /// /****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,23 +48,21 @@ class GNEVaporizer : public GNEAdditional { public: /**@brief Constructor - * @param[in] id The storage of gl-ids to get the one for this lane representation from * @param[in] viewNet pointer to GNEViewNet of this additional element belongs * @param[in] edge edge in which this vaporizer is placed - * @param[in] startTime - * @param[in] end - * @param[in] blocked set initial blocking state of item + * @param[in] startTime start time of vaporizer + * @param[in] end end time of vaporizer */ - GNEVaporizer(const std::string& id, GNEViewNet* viewNet, GNEEdge* edge, SUMOTime startTime, SUMOTime end, bool blocked); + GNEVaporizer(GNEViewNet* viewNet, GNEEdge* edge, double startTime, double end); /// @brief Destructor ~GNEVaporizer(); /// @brief change the position of the RouteProbe geometry - void moveAdditionalGeometry(SUMOReal, SUMOReal); + void moveAdditionalGeometry(double, double); /// @brief updated geometry changes in the attributes of additional - void commmitAdditionalGeometryMoved(SUMOReal, SUMOReal, GNEUndoList*); + void commmitAdditionalGeometryMoved(double, double, GNEUndoList*); /// @brief update pre-computed geometry information /// @note: must be called when geometry changes (i.e. lane moved) @@ -76,23 +74,23 @@ /**@brief writte additional element into a xml file * @param[in] device device in which write parameters of additional element */ - void writeAdditional(OutputDevice& device, const std::string&); + void writeAdditional(OutputDevice& device) const; /// @brief remove reference to edge /// @note this function will be called automatically in destructor of GNEEdge void removeEdgeReference(); /// @brief get start time - SUMOTime getStartTime() const; + double getStartTime() const; /// @brief get end - SUMOTime getEnd() const; + double getEnd() const; /// @brief set start time - void setStartTime(SUMOTime startTime); + void setStartTime(double startTime); /// @brief set end - void setEndTime(SUMOTime end); + void setEndTime(double end); /// @name inherited from GUIGlObject /// @{ @@ -132,10 +130,16 @@ protected: /// @brief start time of vaporizer - SUMOTime myStartTime; + double myStartTime; /// @brief end time in which this vaporizer is placed - SUMOTime myEnd; + double myEnd; + + /// @brief number of lanes of edge (To improve efficiency) + int myNumberOfLanes; + + /// @brief relative position regarding to other route probes + int myRelativePosition; private: /// @brief set attribute after validation diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignal.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignal.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignal.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignal.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,439 +0,0 @@ -/****************************************************************************/ -/// @file GNEVariableSpeedSignal.cpp -/// @author Pablo Alvarez Lopez -/// @date Nov 2015 -/// @version $Id: GNEVariableSpeedSignal.cpp 21851 2016-10-31 12:20:12Z behrisch $ -/// -/// -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "GNEVariableSpeedSignal.h" -#include "GNELane.h" -#include "GNEViewNet.h" -#include "GNEUndoList.h" -#include "GNENet.h" -#include "GNEChange_Attribute.h" -#include "GNEVariableSpeedSignalDialog.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif - -// =========================================================================== -// member method definitions -// =========================================================================== - -GNEVariableSpeedSignal::GNEVariableSpeedSignal(const std::string& id, GNEViewNet* viewNet, Position pos, std::vector lanes, const std::string& filename, const std::map& VSSValues, bool blocked) : - GNEAdditionalSet(id, viewNet, pos, SUMO_TAG_VSS, blocked, std::vector(), std::vector(), lanes), - myFilename(filename), - myVSSValues(VSSValues), - mySaveInFilename(false) { - // Update geometry; - updateGeometry(); - // Set colors - myBaseColor = RGBColor(76, 170, 50, 255); - myBaseColorSelected = RGBColor(161, 255, 135, 255); -} - - -GNEVariableSpeedSignal::~GNEVariableSpeedSignal() { -} - - -void -GNEVariableSpeedSignal::updateGeometry() { - // Clear shape - myShape.clear(); - - // Set block icon position - myBlockIconPosition = myPosition; - - // Set block icon offset - myBlockIconOffset = Position(-0.5, -0.5); - - // Set block icon rotation, and using their rotation for draw logo - setBlockIconRotation(); - - // Set position - myShape.push_back(myPosition); - - // Add shape of childs (To avoid graphics errors) - for (childLanes::iterator i = myChildLanes.begin(); i != myChildLanes.end(); i++) { - myShape.append(i->lane->getShape()); - } - - // Update connections - updateConnections(); - - // Refresh element (neccesary to avoid grabbing problems) - myViewNet->getNet()->refreshAdditional(this); -} - - -Position -GNEVariableSpeedSignal::getPositionInView() const { - return myPosition; -} - - -void -GNEVariableSpeedSignal::openAdditionalDialog() { - GNEVariableSpeedSignalDialog variableSpeedSignalDialog(this); -} - - -void -GNEVariableSpeedSignal::moveAdditionalGeometry(SUMOReal offsetx, SUMOReal offsety) { - // change Position - myPosition = Position(offsetx, offsety); - updateGeometry(); -} - - -void -GNEVariableSpeedSignal::commmitAdditionalGeometryMoved(SUMOReal oldPosx, SUMOReal oldPosy, GNEUndoList* undoList) { - undoList->p_begin("position of " + toString(getTag())); - undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, toString(myPosition), true, toString(Position(oldPosx, oldPosy)))); - undoList->p_end(); - // Refresh element - myViewNet->getNet()->refreshAdditional(this); -} - - -void -GNEVariableSpeedSignal::writeAdditional(OutputDevice& device, const std::string& currentDirectory) { - // Write parameters - device.openTag(getTag()); - device.writeAttr(SUMO_ATTR_ID, getID()); - device.writeAttr(SUMO_ATTR_LANES, joinToString(getLaneChildIds(), " ").c_str()); - device.writeAttr(SUMO_ATTR_X, myPosition.x()); - device.writeAttr(SUMO_ATTR_Y, myPosition.y()); - // If filenam isn't empty and save in filename is enabled, save in a different file. In other case, save in the same additional XML - if (!myFilename.empty() && mySaveInFilename == true) { - // Write filename attribute - device.writeAttr(SUMO_ATTR_FILE, myFilename); - // Save values in a different file - OutputDevice& deviceVSS = OutputDevice::getDevice(currentDirectory + myFilename); - deviceVSS.openTag("VSS"); - for (std::map::const_iterator i = myVSSValues.begin(); i != myVSSValues.end(); ++i) { - // Open VSS tag - deviceVSS.openTag(SUMO_TAG_STEP); - // Write TimeSTep - deviceVSS.writeAttr(SUMO_ATTR_TIME, i->first); - // Write speed - deviceVSS.writeAttr(SUMO_ATTR_SPEED, i->second); - // Close VSS tag - deviceVSS.closeTag(); - } - deviceVSS.close(); - } else { - for (std::map::const_iterator i = myVSSValues.begin(); i != myVSSValues.end(); ++i) { - // Open VSS tag - device.openTag(SUMO_TAG_STEP); - // Write TimeSTep - device.writeAttr(SUMO_ATTR_TIME, i->first); - // Write speed - device.writeAttr(SUMO_ATTR_SPEED, i->second); - // Close VSS tag - device.closeTag(); - } - } - if (myBlocked) { - device.writeAttr(GNE_ATTR_BLOCK_MOVEMENT, myBlocked); - } - // Close tag - device.closeTag(); -} - - -std::string -GNEVariableSpeedSignal::getFilename() const { - return myFilename; -} - - -std::map -GNEVariableSpeedSignal::getVariableSpeedSignalSteps() const { - return myVSSValues; -} - - -void -GNEVariableSpeedSignal::setFilename(std::string filename) { - myFilename = filename; -} - - -void -GNEVariableSpeedSignal::setVariableSpeedSignalSteps(const std::map& vssValues) { - myVSSValues = vssValues; -} - - -bool -GNEVariableSpeedSignal::insertStep(const SUMOTime time, const SUMOReal speed) { - if (myVSSValues.find(time) == myVSSValues.end()) { - myVSSValues[time] = speed; - return true; - } else { - return false; - } -} - - -const std::string& -GNEVariableSpeedSignal::getParentName() const { - return myViewNet->getNet()->getMicrosimID(); -} - - -void -GNEVariableSpeedSignal::drawGL(const GUIVisualizationSettings& s) const { - // Start drawing adding an gl identificator - glPushName(getGlID()); - - // Add a draw matrix for drawing logo - glPushMatrix(); - glTranslated(myShape[0].x(), myShape[0].y(), getType()); - glColor3d(1, 1, 1); - glRotated(180, 0, 0, 1); - - // Draw icon depending of rerouter is or isn't selected - if (isAdditionalSelected()) { - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_VARIABLESPEEDSIGNALSELECTED), 1); - } else { - GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getGif(GNETEXTURE_VARIABLESPEEDSIGNAL), 1); - } - - // Pop draw icon matrix - glPopMatrix(); - - // Show Lock icon depending of the Edit mode - drawLockIcon(0.4); - - // Push matrix to draw every symbol over lane - glPushMatrix(); - - // Traslate to 0,0 - glTranslated(0, 0, getType()); - - // Obtain exaggeration - const SUMOReal exaggeration = s.addSize.getExaggeration(s); - - // Iterate over lanes - for (childLanes::const_iterator i = myChildLanes.begin(); i != myChildLanes.end(); i++) { - // Draw every signal over Lane - glPushMatrix(); - glScaled(exaggeration, exaggeration, 1); - glTranslated(i->positionOverLane.x(), i->positionOverLane.y(), 0); - glRotated(i->rotationOverLane, 0, 0, 1); - glTranslated(0, -1.5, 0); - - int noPoints = 9; - if (s.scale > 25) { - noPoints = (int)(9.0 + s.scale / 10.0); - if (noPoints > 36) { - noPoints = 36; - } - } - glColor3d(1, 0, 0); - GLHelper::drawFilledCircle((SUMOReal) 1.3, noPoints); - if (s.scale >= 5) { - glTranslated(0, 0, .1); - glColor3d(0, 0, 0); - GLHelper::drawFilledCircle((SUMOReal) 1.1, noPoints); - // Draw speed - SUMOReal speed = i->lane->getSpeed(); - // Show as Km/h - speed *= 3.6f; - if (((int) speed + 1) % 10 == 0) { - speed = (SUMOReal)(((int) speed + 1) / 10 * 10); - } - // draw the speed string - std::string speedToDraw = toString(speed); - glColor3d(1, 1, 0); - glTranslated(0, 0, .1); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - pfSetPosition(0, 0); - pfSetScale(1.2f); - SUMOReal w = pfdkGetStringWidth(speedToDraw.c_str()); - glRotated(180, 0, 1, 0); - glTranslated(-w / 2., 0.3, 0); - pfDrawString(speedToDraw.c_str()); - } - glPopMatrix(); - } - - // Pop symbol matrix - glPopMatrix(); - - // Draw connections - drawConnections(); - - // Draw name - drawName(getCenteringBoundary().getCenter(), s.scale, s.addName); - - // Pop name - glPopName(); -} - - -std::string -GNEVariableSpeedSignal::getAttribute(SumoXMLAttr key) const { - switch (key) { - case SUMO_ATTR_ID: - return getAdditionalID(); - case SUMO_ATTR_LANES: - return joinToString(getLaneChildIds(), " "); - case SUMO_ATTR_POSITION: - return toString(myPosition); - case SUMO_ATTR_FILE: - return myFilename; - case GNE_ATTR_BLOCK_MOVEMENT: - return toString(myBlocked); - default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); - } -} - - -void -GNEVariableSpeedSignal::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) { - if (value == getAttribute(key)) { - return; //avoid needless changes, later logic relies on the fact that attributes have changed - } - switch (key) { - case SUMO_ATTR_ID: - case SUMO_ATTR_LANES: - case SUMO_ATTR_POSITION: - case SUMO_ATTR_FILE: - case GNE_ATTR_BLOCK_MOVEMENT: - undoList->p_add(new GNEChange_Attribute(this, key, value)); - updateGeometry(); - break; - default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); - } -} - - -bool -GNEVariableSpeedSignal::isValid(SumoXMLAttr key, const std::string& value) { - switch (key) { - case SUMO_ATTR_ID: - if (myViewNet->getNet()->getAdditional(getTag(), value) == NULL) { - return true; - } else { - return false; - } - case SUMO_ATTR_POSITION: - bool ok; - return GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, false).size() == 1; - case SUMO_ATTR_LANES: { - std::vector laneIds; - SUMOSAXAttributes::parseStringVector(value, laneIds); - // Empty Lanes aren't valid - if (laneIds.empty()) { - return false; - } - // Iterate over parsed lanes - for (int i = 0; i < (int)laneIds.size(); i++) { - if (myViewNet->getNet()->retrieveLane(laneIds.at(i), false) == NULL) { - return false; - } - } - return true; - } - case SUMO_ATTR_FILE: - return isValidFileValue(value); - case GNE_ATTR_BLOCK_MOVEMENT: - return canParse(value); - default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); - } -} - - -void -GNEVariableSpeedSignal::setAttribute(SumoXMLAttr key, const std::string& value) { - switch (key) { - case SUMO_ATTR_ID: - setAdditionalID(value); - break; - case SUMO_ATTR_LANES: { - // Declare variables - std::vector laneIds; - std::vector lanes; - GNELane* lane; - SUMOSAXAttributes::parseStringVector(value, laneIds); - // Iterate over parsed lanes and obtain pointer to lanes - for (int i = 0; i < (int)laneIds.size(); i++) { - lane = myViewNet->getNet()->retrieveLane(laneIds.at(i), false); - if (lane) { - lanes.push_back(lane); - } - } - // Set new childs - setLaneChilds(lanes); - break; - } - case SUMO_ATTR_POSITION: - bool ok; - myPosition = GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, false)[0]; - updateGeometry(); - getViewNet()->update(); - break; - case SUMO_ATTR_FILE: - myFilename = value; - break; - case GNE_ATTR_BLOCK_MOVEMENT: - myBlocked = parse(value); - getViewNet()->update(); - break; - default: - throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); - } -} - -/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignalDialog.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignalDialog.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignalDialog.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignalDialog.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,210 +0,0 @@ -/****************************************************************************/ -/// @file GNEVariableSpeedSignalDialog.cpp -/// @author Pablo Alvarez Lopez -/// @date April 2016 -/// @version $Id: GNEVariableSpeedSignalDialog.cpp 21824 2016-10-27 13:03:52Z behrisch $ -/// -/// A class for edit phases of Variable Speed Signals -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include -#include -#include -#include - -#include "GNEVariableSpeedSignalDialog.h" -#include "GNEVariableSpeedSignal.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif - - -// =========================================================================== -// FOX callback mapping -// =========================================================================== - -FXDEFMAP(GNEVariableSpeedSignalDialog) GNERerouterDialogMap[] = { - FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_ACCEPT, GNEVariableSpeedSignalDialog::onCmdAccept), - FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_CANCEL, GNEVariableSpeedSignalDialog::onCmdCancel), - FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_RESET, GNEVariableSpeedSignalDialog::onCmdReset), - FXMAPFUNC(SEL_COMMAND, MID_GNE_VARIABLESPEEDSIGNAL_ADDROW, GNEVariableSpeedSignalDialog::onCmdAddRow), - FXMAPFUNC(SEL_DOUBLECLICKED, MID_GNE_VARIABLESPEEDSIGNAL_REMOVEROW, GNEVariableSpeedSignalDialog::onCmdRemoveRow), -}; - -// Object implementation -FXIMPLEMENT(GNEVariableSpeedSignalDialog, FXDialogBox, GNERerouterDialogMap, ARRAYNUMBER(GNERerouterDialogMap)) - -// =========================================================================== -// member method definitions -// =========================================================================== - -GNEVariableSpeedSignalDialog::GNEVariableSpeedSignalDialog(GNEVariableSpeedSignal* variableSpeedSignalParent) : - GNEAdditionalDialog(variableSpeedSignalParent, 240, 240), - myVariableSpeedSignalParent(variableSpeedSignalParent) { - - // create List with the data - myDataList = new FXTable(myContentFrame, this, MID_GNE_VARIABLESPEEDSIGNAL_REMOVEROW, LAYOUT_FILL_X | LAYOUT_FILL_Y); - myDataList->setEditable(false); - - // create Horizontal frame for row elements - myRowFrame = new FXHorizontalFrame(myContentFrame, LAYOUT_FILL_X); - - // create Text field for the timeStep - myRowStep = new FXTextField(myRowFrame, 10, this, MID_GNE_VARIABLESPEEDSIGNAL_CHANGEVALUE, FRAME_THICK | LAYOUT_FILL_X); - - // create Text field for the speed - myRowSpeed = new FXTextField(myRowFrame, 10, this, MID_GNE_VARIABLESPEEDSIGNAL_CHANGEVALUE, FRAME_THICK | LAYOUT_FILL_X); - - // create Button for insert row - myAddRow = new FXButton(myRowFrame, "Add", 0, this, MID_GNE_VARIABLESPEEDSIGNAL_ADDROW, FRAME_THICK); - - // Get values of variable speed signal - myVSSValues = myVariableSpeedSignalParent->getVariableSpeedSignalSteps(); - - // update table - updateTable(); - - // Execute additional dialog (To make it modal) - execute(); -} - -GNEVariableSpeedSignalDialog::~GNEVariableSpeedSignalDialog() { -} - - -long -GNEVariableSpeedSignalDialog::onCmdAddRow(FXObject*, FXSelector, void*) { - // Declare variables for time and speed - SUMOTime time; - SUMOReal speed; - - // Get Time - if (TplCheck::_str2SUMOTime(myRowStep->getText().text()) == false) { - return 0; - } else { -// @toDo IMPLEMENT _str2Time TO TIME - time = TplConvert::_str2int(myRowStep->getText().text()); - } - - // get SPeed - if (TplCheck::_str2SUMOReal(myRowSpeed->getText().text()) == false) { - return 0; - } else { - speed = TplConvert::_str2SUMOReal(myRowSpeed->getText().text()); - } - - // Set new time and their speed if don't exist already - if (myVSSValues.find(time) == myVSSValues.end()) { - myVSSValues[time] = speed; - } else { - return false; - } - - // Update table - updateTable(); - return 1; -} - - -long -GNEVariableSpeedSignalDialog::onCmdRemoveRow(FXObject*, FXSelector, void*) { - // Iterate over rows to find the row to erase - for (int i = 0; i < myDataList->getNumRows(); i++) { - if (myDataList->getItem(i, 2)->isSelected()) { - // Remove element of table and map -// @todo IMPLEMENT _2SUMOTIme - myVSSValues.erase(TplConvert::_2int(myDataList->getItem(i, 0)->getText().text())); - myDataList->removeRows(i); - // update table - updateTable(); - return 1; - } - } - return 0; -} - - -long -GNEVariableSpeedSignalDialog::onCmdAccept(FXObject*, FXSelector, void*) { - // Save new data in Variable Speed Signal edited - myVariableSpeedSignalParent->setVariableSpeedSignalSteps(myVSSValues); - // Stop Modal with positive out - getApp()->stopModal(this, TRUE); - return 1; -} - - -long -GNEVariableSpeedSignalDialog::onCmdCancel(FXObject*, FXSelector, void*) { - // Stop Modal with negative out - getApp()->stopModal(this, FALSE); - return 1; -} - - -long -GNEVariableSpeedSignalDialog::onCmdReset(FXObject*, FXSelector, void*) { - // Get old values - myVSSValues = myVariableSpeedSignalParent->getVariableSpeedSignalSteps(); - updateTable(); - return 1; -} - - -void -GNEVariableSpeedSignalDialog::updateTable() { - // clear table - myDataList->clearItems(); - // set number of rows - myDataList->setTableSize(int(myVSSValues.size()), 3); - // Configure list - myDataList->setVisibleColumns(3); - myDataList->setColumnWidth(0, getWidth() / 3); - myDataList->setColumnWidth(1, getWidth() / 3); - myDataList->setColumnWidth(2, getWidth() / 3 - 10); - myDataList->setColumnText(0, "timeStep"); - myDataList->setColumnText(1, "speed (km/h)"); - myDataList->setColumnText(2, "remove"); - myDataList->getRowHeader()->setWidth(0); - // Declare index for rows and pointer to FXTableItem - int indexRow = 0; - FXTableItem* item = 0; - // iterate over values - for (std::map::iterator i = myVSSValues.begin(); i != myVSSValues.end(); i++) { - // Set time - item = new FXTableItem(toString(i->first).c_str()); - myDataList->setItem(indexRow, 0, item); - // Set speed - item = new FXTableItem(toString(i->second).c_str()); - myDataList->setItem(indexRow, 1, item); - // set remove - item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE)); - item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y); - myDataList->setItem(indexRow, 2, item); - // Update index - indexRow++; - } -} - -/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignalDialog.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignalDialog.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignalDialog.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignalDialog.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ -/****************************************************************************/ -/// @file GNEVariableSpeedSignalDialog.h -/// @author Pablo Alvarez Lopez -/// @date April 2016 -/// @version $Id: GNEVariableSpeedSignalDialog.h 21131 2016-07-08 07:59:22Z behrisch $ -/// -/// A class for edit phases of Variable Speed Signals -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ -#ifndef GNEVariableSpeedSignalDialog_h -#define GNEVariableSpeedSignalDialog_h - -// =========================================================================== -// included modules -// =========================================================================== - -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include -#include -#include "GNEAdditionalDialog.h" - - -// =========================================================================== -// class declarations -// =========================================================================== - -class GNEVariableSpeedSignal; - -// =========================================================================== -// class definitions -// =========================================================================== - -/** - * @class GNEAdditionalDialog - * @brief Dialog to edit sequences, parameters, etc.. of Additionals - */ -class GNEVariableSpeedSignalDialog : public GNEAdditionalDialog { - /// @brief FOX-declaration - FXDECLARE(GNEVariableSpeedSignalDialog) - -public: - // Constructor - GNEVariableSpeedSignalDialog(GNEVariableSpeedSignal* variableSpeedSignalParent); - - // destructor - ~GNEVariableSpeedSignalDialog(); - - /// @name FOX-callbacks - /// @{ - /// @brief event called after press add row button - long onCmdAddRow(FXObject*, FXSelector, void*); - - /// @brief event called after press remove row - long onCmdRemoveRow(FXObject*, FXSelector, void*); - - /// @brief event called after press accept button - long onCmdAccept(FXObject*, FXSelector, void*); - - /// @brief event called after press cancel button - long onCmdCancel(FXObject*, FXSelector, void*); - - /// @brief event called after press cancel button - long onCmdReset(FXObject*, FXSelector, void*); - /// @} - -protected: - /// @brief FOX needs this - GNEVariableSpeedSignalDialog() {} - - /// @brief Pointer to Variable Speed Signal - GNEVariableSpeedSignal* myVariableSpeedSignalParent; - - /// @brief Map with the temporal VSSValues - std::map myVSSValues; - - /// @brief Table with the data - FXTable* myDataList; - - /// @brief Horizontal frame for row elements - FXHorizontalFrame* myRowFrame; - - /// @bbriefie Text field with step - FXTextField* myRowStep; - - /// @brief Text field with speed - FXTextField* myRowSpeed; - - /// @brief Button for insert row - FXButton* myAddRow; - -private: - /// @brief update data table - void updateTable(); - - /// @brief Invalidated copy constructor. - GNEVariableSpeedSignalDialog(const GNEVariableSpeedSignalDialog&); - - /// @brief Invalidated assignment operator. - GNEVariableSpeedSignalDialog& operator=(const GNEVariableSpeedSignalDialog&); -}; - -#endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignal.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignal.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignal.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignal.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,156 +0,0 @@ -/****************************************************************************/ -/// @file GNEVariableSpeedSignal.h -/// @author Pablo Alvarez Lopez -/// @date Nov 2015 -/// @version $Id: GNEVariableSpeedSignal.h 21851 2016-10-31 12:20:12Z behrisch $ -/// -/// -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/ -// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ -#ifndef GNEVariableSpeedSignal_h -#define GNEVariableSpeedSignal_h - - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include "GNEAdditionalSet.h" - -// =========================================================================== -// class definitions -// =========================================================================== -/** - * @class GNEVariableSpeedSignal - * ------------ - */ -class GNEVariableSpeedSignal : public GNEAdditionalSet { -public: - - /**@brief Constructor - * @param[in] id The storage of gl-ids to get the one for this lane representation from - * @param[in] viewNet pointer to GNEViewNet of this additional element belongs - * @param[in] pos position (center) of the rerouter in the map - * @param[in] lanes vector with the lanes of variable speed signal - * @param[in] filename The path to the definition file - * @param[in] VSSValues values with the interval and speeds of variable speed signals - * @param[in] blocked set initial blocking state of item - */ - GNEVariableSpeedSignal(const std::string& id, GNEViewNet* viewNet, Position pos, std::vector lanes, const std::string& filename, const std::map& VSSValues, bool blocked); - - /// @brief Destructor - ~GNEVariableSpeedSignal(); - - /// @brief update pre-computed geometry information - /// @note: must be called when geometry changes (i.e. lane moved) - void updateGeometry(); - - /// @brief Returns position of Variable Speed Signal in view - Position getPositionInView() const; - - /// @brief open GNEVariableSpeedSignalDialog - void openAdditionalDialog(); - - /// @brief change the position of the rerouter geometry - void moveAdditionalGeometry(SUMOReal offsetx, SUMOReal offsety); - - /// @brief updated geometry changes in the attributes of additional - void commmitAdditionalGeometryMoved(SUMOReal oldPosx, SUMOReal oldPosy, GNEUndoList* undoList); - - /**@brief writte additional element into a xml file - * @param[in] device device in which write parameters of additional element - * @param[in] currentDirectory current directory in which this additional are writted - */ - void writeAdditional(OutputDevice& device, const std::string& currentDirectory); - - /// @brief get filename of rerouter - std::string getFilename() const; - - /// @brief get values of variable speed signal - std::map getVariableSpeedSignalSteps() const; - - /// @brief set filename of rerouter - void setFilename(std::string filename); - - /// @brief set values of variable speed signal - void setVariableSpeedSignalSteps(const std::map& vssValues); - - /// @brief insert a new step in variable speed signal - /// @return true if step was sucesfully inserted, false in other case (Time duplicated) - bool insertStep(const SUMOTime time, const SUMOReal speed); - - /// @name inherited from GUIGlObject - /// @{ - /// @brief Returns the name of the parent object - /// @return This object's parent id - const std::string& getParentName() const; - - /**@brief Draws the object - * @param[in] s The settings for the current view (may influence drawing) - * @see GUIGlObject::drawGL - */ - void drawGL(const GUIVisualizationSettings& s) const; - /// @} - - /// @name inherited from GNEAttributeCarrier - /// @{ - /* @brief method for getting the Attribute of an XML key - * @param[in] key The attribute key - * @return string with the value associated to key - */ - std::string getAttribute(SumoXMLAttr key) const; - - /* @brief method for setting the attribute and letting the object perform additional changes - * @param[in] key The attribute key - * @param[in] value The new value - * @param[in] undoList The undoList on which to register changes - */ - void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList); - - /* @brief method for checking if the key and their correspond attribute are valids - * @param[in] key The attribute key - * @param[in] value The value asociated to key key - * @return true if the value is valid, false in other case - */ - bool isValid(SumoXMLAttr key, const std::string& value); - /// @} - -protected: - /// @brief filename of rerouter - std::string myFilename; - - /// @brief values of variable speed signal - std::map myVSSValues; - - /// @brief enable or disable save in external filename - bool mySaveInFilename; - -private: - /// @brief set attribute after validation - void setAttribute(SumoXMLAttr key, const std::string& value); - - /// @brief Invalidated copy constructor. - GNEVariableSpeedSignal(const GNEVariableSpeedSignal&); - - /// @brief Invalidated assignment operator. - GNEVariableSpeedSignal& operator=(const GNEVariableSpeedSignal&); -}; - -#endif - -/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSign.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSign.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSign.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSign.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,428 @@ +/****************************************************************************/ +/// @file GNEVariableSpeedSign.cpp +/// @author Pablo Alvarez Lopez +/// @date Nov 2015 +/// @version $Id: GNEVariableSpeedSign.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "GNEVariableSpeedSign.h" +#include "GNELane.h" +#include "GNEViewNet.h" +#include "GNEUndoList.h" +#include "GNENet.h" +#include "GNEChange_Attribute.h" +#include "GNEVariableSpeedSignDialog.h" + + +// =========================================================================== +// member method definitions +// =========================================================================== + +GNEVariableSpeedSign::GNEVariableSpeedSign(const std::string& id, GNEViewNet* viewNet, Position pos, std::vector /* lanes */, const std::string& filename, const std::vector& steps) : + GNEAdditional(id, viewNet, pos, SUMO_TAG_VSS, ICON_VARIABLESPEEDSIGN), + myFilename(filename), + mySteps(steps), + mySaveInFilename(false) { + // Update geometry; + updateGeometry(); + // Set colors + myBaseColor = RGBColor(76, 170, 50, 255); + myBaseColorSelected = RGBColor(161, 255, 135, 255); +} + + +GNEVariableSpeedSign::~GNEVariableSpeedSign() { +} + + +void +GNEVariableSpeedSign::updateGeometry() { + // Clear shape + myShape.clear(); + + // Set block icon position + myBlockIconPosition = myPosition; + + // Set block icon offset + myBlockIconOffset = Position(-0.5, -0.5); + + // Set block icon rotation, and using their rotation for draw logo + setBlockIconRotation(); + + // Set position + myShape.push_back(myPosition); + /* + // Add shape of childs (To avoid graphics errors) + for (childLanes::iterator i = myChildLanes.begin(); i != myChildLanes.end(); i++) { + myShape.append(i->lane->getShape()); + } + + // Update connections + updateConnections(); + */ + // Refresh element (neccesary to avoid grabbing problems) + myViewNet->getNet()->refreshAdditional(this); +} + + +Position +GNEVariableSpeedSign::getPositionInView() const { + return myPosition; +} + + +void +GNEVariableSpeedSign::openAdditionalDialog() { + GNEVariableSpeedSignDialog variableSpeedSignDialog(this); +} + + +void +GNEVariableSpeedSign::moveAdditionalGeometry(double offsetx, double offsety) { + // change Position + myPosition = Position(offsetx, offsety); + updateGeometry(); +} + + +void +GNEVariableSpeedSign::commmitAdditionalGeometryMoved(double oldPosx, double oldPosy, GNEUndoList* undoList) { + undoList->p_begin("position of " + toString(getTag())); + undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, toString(myPosition), true, toString(Position(oldPosx, oldPosy)))); + undoList->p_end(); + // Refresh element + myViewNet->getNet()->refreshAdditional(this); +} + + +void +GNEVariableSpeedSign::writeAdditional(OutputDevice& device) const { + // Write parameters + device.openTag(getTag()); + device.writeAttr(SUMO_ATTR_ID, getID()); + device.writeAttr(SUMO_ATTR_LANES, /*joinToString(getLaneChildIds(), " ").c_str()*/""); + device.writeAttr(SUMO_ATTR_X, myPosition.x()); + device.writeAttr(SUMO_ATTR_Y, myPosition.y()); + // If filenam isn't empty and save in filename is enabled, save in a different file. In other case, save in the same additional XML + if (!myFilename.empty() && mySaveInFilename == true) { + // Write filename attribute + device.writeAttr(SUMO_ATTR_FILE, myFilename); + // Save values in a different file + /* + OutputDevice& deviceVSS = OutputDevice::getDevice(currentDirectory + myFilename); + deviceVSS.openTag("VSS"); + for (std::vector::const_iterator i = myVSSValues.begin(); i != myVSSValues.end(); ++i) { + // Open VSS tag + deviceVSS.openTag(SUMO_TAG_STEP); + // Write TimeSTep + deviceVSS.writeAttr(SUMO_ATTR_TIME, i->getTime()); + // Write speed + deviceVSS.writeAttr(SUMO_ATTR_SPEED, i->getSpeed()); + // Close VSS tag + deviceVSS.closeTag(); + } + deviceVSS.close(); + */ + } else { + for (std::vector::const_iterator i = mySteps.begin(); i != mySteps.end(); ++i) { + // Open VSS tag + device.openTag(SUMO_TAG_STEP); + // Write TimeSTep + device.writeAttr(SUMO_ATTR_TIME, i->getTime()); + // Write speed + device.writeAttr(SUMO_ATTR_SPEED, i->getSpeed()); + // Close VSS tag + device.closeTag(); + } + } + if (myBlocked) { + device.writeAttr(GNE_ATTR_BLOCK_MOVEMENT, myBlocked); + } + // Close tag + device.closeTag(); +} + + +const std::string& +GNEVariableSpeedSign::getFilename() const { + return myFilename; +} + + +const std::vector& +GNEVariableSpeedSign::getSteps() const { + return mySteps; +} + + +void +GNEVariableSpeedSign::setFilename(const std::string& filename) { + myFilename = filename; +} + + +void +GNEVariableSpeedSign::setVariableSpeedSignSteps(const std::vector& steps) { + mySteps = steps; +} + + +void +GNEVariableSpeedSign::addStep(const GNEVariableSpeedSignStep& step) { + mySteps.push_back(step); +} + + +const std::string& +GNEVariableSpeedSign::getParentName() const { + return myViewNet->getNet()->getMicrosimID(); +} + + +void +GNEVariableSpeedSign::drawGL(const GUIVisualizationSettings& s) const { + // Start drawing adding an gl identificator + glPushName(getGlID()); + + // Add a draw matrix for drawing logo + glPushMatrix(); + glTranslated(myShape[0].x(), myShape[0].y(), getType()); + glColor3d(1, 1, 1); + glRotated(180, 0, 0, 1); + + // Draw icon depending of variable speed sign is or isn't selected + if (isAdditionalSelected()) { + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_VARIABLESPEEDSIGNSELECTED), 1); + } else { + GUITexturesHelper::drawTexturedBox(GUITextureSubSys::getTexture(GNETEXTURE_VARIABLESPEEDSIGN), 1); + } + + // Pop draw icon matrix + glPopMatrix(); + + // Show Lock icon depending of the Edit mode + drawLockIcon(0.4); + + // Push matrix to draw every symbol over lane + glPushMatrix(); + + // Translate to 0,0 + glTranslated(0, 0, getType()); + /* + // Obtain exaggeration + const double exaggeration = s.addSize.getExaggeration(s); + + // Iterate over lanes + for (childLanes::const_iterator i = myChildLanes.begin(); i != myChildLanes.end(); i++) { + // Draw every signal over Lane + glPushMatrix(); + glScaled(exaggeration, exaggeration, 1); + glTranslated(i->positionOverLane.x(), i->positionOverLane.y(), 0); + glRotated(i->rotationOverLane, 0, 0, 1); + glTranslated(0, -1.5, 0); + + int noPoints = 9; + if (s.scale > 25) { + noPoints = (int)(9.0 + s.scale / 10.0); + if (noPoints > 36) { + noPoints = 36; + } + } + glColor3d(1, 0, 0); + GLHelper::drawFilledCircle((double) 1.3, noPoints); + if (s.scale >= 5) { + glTranslated(0, 0, .1); + glColor3d(0, 0, 0); + GLHelper::drawFilledCircle((double) 1.1, noPoints); + // Draw speed + double speed = i->lane->getSpeed(); + // Show as Km/h + speed *= 3.6f; + if (((int) speed + 1) % 10 == 0) { + speed = (double)(((int) speed + 1) / 10 * 10); + } + // draw the speed string + std::string speedToDraw = toString(speed); + glColor3d(1, 1, 0); + glTranslated(0, 0, .1); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + pfSetPosition(0, 0); + pfSetScale(1.2f); + double w = pfdkGetStringWidth(speedToDraw.c_str()); + glRotated(180, 0, 1, 0); + glTranslated(-w / 2., 0.3, 0); + pfDrawString(speedToDraw.c_str()); + } + glPopMatrix(); + } + */ + // Pop symbol matrix + glPopMatrix(); + + // Draw name + drawName(getCenteringBoundary().getCenter(), s.scale, s.addName); + + // Pop name + glPopName(); +} + + +std::string +GNEVariableSpeedSign::getAttribute(SumoXMLAttr key) const { + switch (key) { + case SUMO_ATTR_ID: + return getAdditionalID(); + case SUMO_ATTR_LANES: + return /*joinToString(getLaneChildIds(), " ")*/ ""; + case SUMO_ATTR_POSITION: + return toString(myPosition); + case SUMO_ATTR_FILE: + return myFilename; + case GNE_ATTR_BLOCK_MOVEMENT: + return toString(myBlocked); + default: + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); + } +} + + +void +GNEVariableSpeedSign::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) { + if (value == getAttribute(key)) { + return; //avoid needless changes, later logic relies on the fact that attributes have changed + } + switch (key) { + case SUMO_ATTR_ID: + case SUMO_ATTR_LANES: + case SUMO_ATTR_POSITION: + case SUMO_ATTR_FILE: + case GNE_ATTR_BLOCK_MOVEMENT: + undoList->p_add(new GNEChange_Attribute(this, key, value)); + updateGeometry(); + break; + default: + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); + } +} + + +bool +GNEVariableSpeedSign::isValid(SumoXMLAttr key, const std::string& value) { + switch (key) { + case SUMO_ATTR_ID: + if (myViewNet->getNet()->getAdditional(getTag(), value) == NULL) { + return true; + } else { + return false; + } + case SUMO_ATTR_POSITION: + bool ok; + return (GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, false).size() == 1); + case SUMO_ATTR_LANES: { + std::vector laneIds = GNEAttributeCarrier::parse > (value); + // Empty Lanes aren't valid + if (laneIds.empty()) { + return false; + } + // Iterate over parsed lanes + for (int i = 0; i < (int)laneIds.size(); i++) { + if (myViewNet->getNet()->retrieveLane(laneIds.at(i), false) == NULL) { + return false; + } + } + return true; + } + case SUMO_ATTR_FILE: + return isValidFilename(value); + case GNE_ATTR_BLOCK_MOVEMENT: + return canParse(value); + default: + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); + } +} + + +void +GNEVariableSpeedSign::setAttribute(SumoXMLAttr key, const std::string& value) { + switch (key) { + case SUMO_ATTR_ID: + setAdditionalID(value); + break; + case SUMO_ATTR_LANES: { + // Declare variables + std::vector laneIds = GNEAttributeCarrier::parse > (value); + std::vector lanes; + GNELane* lane; + // Iterate over parsed lanes and obtain pointer to lanes + for (int i = 0; i < (int)laneIds.size(); i++) { + lane = myViewNet->getNet()->retrieveLane(laneIds.at(i), false); + if (lane) { + lanes.push_back(lane); + } + } + // Set new childs + //setLaneChilds(lanes); + break; + } + case SUMO_ATTR_POSITION: + bool ok; + myPosition = GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, false)[0]; + updateGeometry(); + getViewNet()->update(); + break; + case SUMO_ATTR_FILE: + myFilename = value; + break; + case GNE_ATTR_BLOCK_MOVEMENT: + myBlocked = parse(value); + getViewNet()->update(); + break; + default: + throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'"); + } +} + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignDialog.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignDialog.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignDialog.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignDialog.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,203 @@ +/****************************************************************************/ +/// @file GNEVariableSpeedSignDialog.cpp +/// @author Pablo Alvarez Lopez +/// @date April 2016 +/// @version $Id: GNEVariableSpeedSignDialog.cpp 23928 2017-04-12 11:35:51Z palcraft $ +/// +/// A class for edit phases of Variable Speed Signals +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include + +#include "GNEVariableSpeedSignDialog.h" +#include "GNEVariableSpeedSign.h" + + +// =========================================================================== +// FOX callback mapping +// =========================================================================== + +FXDEFMAP(GNEVariableSpeedSignDialog) GNERerouterDialogMap[] = { + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_ACCEPT, GNEVariableSpeedSignDialog::onCmdAccept), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_CANCEL, GNEVariableSpeedSignDialog::onCmdCancel), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONALDIALOG_RESET, GNEVariableSpeedSignDialog::onCmdReset), + FXMAPFUNC(SEL_COMMAND, MID_GNE_VARIABLESPEEDSIGN_ADDROW, GNEVariableSpeedSignDialog::onCmdAddRow), + FXMAPFUNC(SEL_DOUBLECLICKED, MID_GNE_VARIABLESPEEDSIGN_REMOVEROW, GNEVariableSpeedSignDialog::onCmdRemoveRow), +}; + +// Object implementation +FXIMPLEMENT(GNEVariableSpeedSignDialog, FXDialogBox, GNERerouterDialogMap, ARRAYNUMBER(GNERerouterDialogMap)) + +// =========================================================================== +// member method definitions +// =========================================================================== + +GNEVariableSpeedSignDialog::GNEVariableSpeedSignDialog(GNEVariableSpeedSign* variableSpeedSignParent) : + GNEAdditionalDialog(variableSpeedSignParent, 240, 240), + myVariableSpeedSignParent(variableSpeedSignParent) { + + // create List with the data + myDataList = new FXTable(myContentFrame, this, MID_GNE_VARIABLESPEEDSIGN_REMOVEROW, GUIDesignTableLimitedHeight); + myDataList->setEditable(false); + + // create Horizontal frame for row elements + myRowFrame = new FXHorizontalFrame(myContentFrame, GUIDesignAuxiliarHorizontalFrame); + + // create Text field for the timeStep + myRowStep = new FXTextField(myRowFrame, 10, this, MID_GNE_VARIABLESPEEDSIGN_CHANGEVALUE, GUIDesignTextField); + + // create Text field for the speed + myRowSpeed = new FXTextField(myRowFrame, 10, this, MID_GNE_VARIABLESPEEDSIGN_CHANGEVALUE, GUIDesignTextField); + + // create Button for insert row + myAddRow = new FXButton(myRowFrame, "Add", 0, this, MID_GNE_VARIABLESPEEDSIGN_ADDROW, GUIDesignButtonIcon); + + // Get values of variable speed signal + mySteps = myVariableSpeedSignParent->getSteps(); + + // update table + updateTable(); + + // Execute additional dialog (To make it modal) + execute(); +} + +GNEVariableSpeedSignDialog::~GNEVariableSpeedSignDialog() { +} + + +long +GNEVariableSpeedSignDialog::onCmdAddRow(FXObject*, FXSelector, void*) { + // Declare variables for time and speed + GNEVariableSpeedSignStep step(myVariableSpeedSignParent); + + // Get Time + if (GNEAttributeCarrier::canParse(myRowStep->getText().text()) == false) { + return 0; + } else { + step.setTime(GNEAttributeCarrier::parse(myRowStep->getText().text())); + } + + // get SPeed + if (GNEAttributeCarrier::canParse(myRowSpeed->getText().text()) == false) { + return 0; + } else { + step.setSpeed(GNEAttributeCarrier::parse(myRowSpeed->getText().text())); + } + + // Set new time and their speed if don't exist already + if (std::find(mySteps.begin(), mySteps.end(), step) == mySteps.end()) { + mySteps.push_back(step); + } else { + return false; + } + + // Update table + updateTable(); + return 1; +} + + +long +GNEVariableSpeedSignDialog::onCmdRemoveRow(FXObject*, FXSelector, void*) { + // Iterate over rows to find the row to erase + for (int i = 0; i < myDataList->getNumRows(); i++) { + if (myDataList->getItem(i, 2)->isSelected()) { + // Remove element of table and map + mySteps.erase(mySteps.begin() + i); + myDataList->removeRows(i); + // update table + updateTable(); + return 1; + } + } + return 0; +} + + +long +GNEVariableSpeedSignDialog::onCmdAccept(FXObject*, FXSelector, void*) { + // Save new data in Variable Speed Signal edited + myVariableSpeedSignParent->setVariableSpeedSignSteps(mySteps); + // Stop Modal with positive out + getApp()->stopModal(this, TRUE); + return 1; +} + + +long +GNEVariableSpeedSignDialog::onCmdCancel(FXObject*, FXSelector, void*) { + // Stop Modal with negative out + getApp()->stopModal(this, FALSE); + return 1; +} + + +long +GNEVariableSpeedSignDialog::onCmdReset(FXObject*, FXSelector, void*) { + // Get old values + mySteps = myVariableSpeedSignParent->getSteps(); + updateTable(); + return 1; +} + + +void +GNEVariableSpeedSignDialog::updateTable() { + // clear table + myDataList->clearItems(); + // set number of rows + myDataList->setTableSize(int(mySteps.size()), 3); + // Configure list + myDataList->setVisibleColumns(3); + myDataList->setColumnWidth(0, getWidth() / 3); + myDataList->setColumnWidth(1, getWidth() / 3); + myDataList->setColumnWidth(2, getWidth() / 3 - 10); + myDataList->setColumnText(0, "timeStep"); + myDataList->setColumnText(1, "speed (km/h)"); + myDataList->setColumnText(2, "remove"); + myDataList->getRowHeader()->setWidth(0); + // Declare index for rows and pointer to FXTableItem + int indexRow = 0; + FXTableItem* item = 0; + // iterate over values + for (std::vector::iterator i = mySteps.begin(); i != mySteps.end(); i++) { + // Set time + item = new FXTableItem(toString(i->getTime()).c_str()); + myDataList->setItem(indexRow, 0, item); + // Set speed + item = new FXTableItem(toString(i->getSpeed()).c_str()); + myDataList->setItem(indexRow, 1, item); + // set remove + item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE)); + item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y); + myDataList->setItem(indexRow, 2, item); + // Update index + indexRow++; + } +} + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignDialog.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignDialog.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignDialog.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignDialog.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,117 @@ +/****************************************************************************/ +/// @file GNEVariableSpeedSignDialog.h +/// @author Pablo Alvarez Lopez +/// @date April 2016 +/// @version $Id: GNEVariableSpeedSignDialog.h 23928 2017-04-12 11:35:51Z palcraft $ +/// +/// A class for edit phases of Variable Speed Signals +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNEVariableSpeedSignDialog_h +#define GNEVariableSpeedSignDialog_h + +// =========================================================================== +// included modules +// =========================================================================== + +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include "GNEAdditionalDialog.h" +#include "GNEVariableSpeedSignStep.h" + + +// =========================================================================== +// class declarations +// =========================================================================== + +class GNEVariableSpeedSign; + +// =========================================================================== +// class definitions +// =========================================================================== + +/** + * @class GNEAdditionalDialog + * @brief Dialog to edit sequences, parameters, etc.. of Additionals + */ +class GNEVariableSpeedSignDialog : public GNEAdditionalDialog { + /// @brief FOX-declaration + FXDECLARE(GNEVariableSpeedSignDialog) + +public: + /// @brief constructor + GNEVariableSpeedSignDialog(GNEVariableSpeedSign* variableSpeedSignParent); + + /// @brief destructor + ~GNEVariableSpeedSignDialog(); + + /// @name FOX-callbacks + /// @{ + /// @brief event called after press add row button + long onCmdAddRow(FXObject*, FXSelector, void*); + + /// @brief event called after press remove row + long onCmdRemoveRow(FXObject*, FXSelector, void*); + + /// @brief event called after press accept button + long onCmdAccept(FXObject*, FXSelector, void*); + + /// @brief event called after press cancel button + long onCmdCancel(FXObject*, FXSelector, void*); + + /// @brief event called after press cancel button + long onCmdReset(FXObject*, FXSelector, void*); + /// @} + +protected: + /// @brief FOX needs this + GNEVariableSpeedSignDialog() {} + + /// @brief Pointer to Variable Speed Signal + GNEVariableSpeedSign* myVariableSpeedSignParent; + + /// @brief Map with the temporal VSSValues + std::vector mySteps; + + /// @brief Table with the data + FXTable* myDataList; + + /// @brief Horizontal frame for row elements + FXHorizontalFrame* myRowFrame; + + /// @bbriefie Text field with step + FXTextField* myRowStep; + + /// @brief Text field with speed + FXTextField* myRowSpeed; + + /// @brief Button for insert row + FXButton* myAddRow; + +private: + /// @brief update data table + void updateTable(); + + /// @brief Invalidated copy constructor. + GNEVariableSpeedSignDialog(const GNEVariableSpeedSignDialog&); + + /// @brief Invalidated assignment operator. + GNEVariableSpeedSignDialog& operator=(const GNEVariableSpeedSignDialog&); +}; + +#endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSign.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSign.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSign.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSign.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,156 @@ +/****************************************************************************/ +/// @file GNEVariableSpeedSign.h +/// @author Pablo Alvarez Lopez +/// @date Nov 2015 +/// @version $Id: GNEVariableSpeedSign.h 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNEVariableSpeedSign_h +#define GNEVariableSpeedSign_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include "GNEAdditional.h" +#include "GNEVariableSpeedSignStep.h" + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class GNEVariableSpeedSign + * allows the simulation of variable speed signs + */ +class GNEVariableSpeedSign : public GNEAdditional { +public: + + /**@brief Constructor + * @param[in] id The storage of gl-ids to get the one for this lane representation from + * @param[in] viewNet pointer to GNEViewNet of this additional element belongs + * @param[in] pos position (center) of the variable speed sign in the map + * @param[in] lanes vector with the lanes of variable speed signal + * @param[in] filename The path to the definition file + * @param[in] steps vector with the steps of variable speed signal + */ + GNEVariableSpeedSign(const std::string& id, GNEViewNet* viewNet, Position pos, std::vector lanes, const std::string& filename, const std::vector& vssValues); + + /// @brief Destructor + ~GNEVariableSpeedSign(); + + /// @brief update pre-computed geometry information + /// @note: must be called when geometry changes (i.e. lane moved) + void updateGeometry(); + + /// @brief Returns position of Variable Speed Signal in view + Position getPositionInView() const; + + /// @brief open GNEVariableSpeedSignDialog + void openAdditionalDialog(); + + /// @brief change the position of the variable speed sign geometry + void moveAdditionalGeometry(double offsetx, double offsety); + + /// @brief updated geometry changes in the attributes of additional + void commmitAdditionalGeometryMoved(double oldPosx, double oldPosy, GNEUndoList* undoList); + + /**@brief writte additional element into a xml file + * @param[in] device device in which write parameters of additional element + * @param[in] currentDirectory current directory in which this additional are writted + */ + void writeAdditional(OutputDevice& device) const; + + /// @brief get filename of variable speed sign + const std::string& getFilename() const; + + /// @brief get values of variable speed signal + const std::vector& getSteps() const; + + /// @brief set filename of variable speed sign + void setFilename(const std::string& filename); + + /// @brief set values of variable speed signal + void setVariableSpeedSignSteps(const std::vector& steps); + + /// @brief insert a new step in variable speed signal + void addStep(const GNEVariableSpeedSignStep& step); + + /// @name inherited from GUIGlObject + /// @{ + /**@brief Returns the name of the parent object + * @return This object's parent id + */ + const std::string& getParentName() const; + + /**@brief Draws the object + * @param[in] s The settings for the current view (may influence drawing) + * @see GUIGlObject::drawGL + */ + void drawGL(const GUIVisualizationSettings& s) const; + /// @} + + /// @name inherited from GNEAttributeCarrier + /// @{ + /* @brief method for getting the Attribute of an XML key + * @param[in] key The attribute key + * @return string with the value associated to key + */ + std::string getAttribute(SumoXMLAttr key) const; + + /* @brief method for setting the attribute and letting the object perform additional changes + * @param[in] key The attribute key + * @param[in] value The new value + * @param[in] undoList The undoList on which to register changes + */ + void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList); + + /* @brief method for checking if the key and their correspond attribute are valids + * @param[in] key The attribute key + * @param[in] value The value asociated to key key + * @return true if the value is valid, false in other case + */ + bool isValid(SumoXMLAttr key, const std::string& value); + /// @} + +protected: + /// @brief filename of variable speed sign + std::string myFilename; + + /// @brief values of variable speed signal + std::vector mySteps; + + /// @brief enable or disable save in external filename + bool mySaveInFilename; + +private: + /// @brief set attribute after validation + void setAttribute(SumoXMLAttr key, const std::string& value); + + /// @brief Invalidated copy constructor. + GNEVariableSpeedSign(const GNEVariableSpeedSign&); + + /// @brief Invalidated assignment operator. + GNEVariableSpeedSign& operator=(const GNEVariableSpeedSign&); +}; + +#endif + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignStep.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignStep.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignStep.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignStep.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,143 @@ +/****************************************************************************/ +/// @file GNEVariableSpeedSignStep.cpp +/// @author Pablo Alvarez Lopez +/// @date Apr 2017 +/// @version $Id: GNEVariableSpeedSignStep.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +/// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include + +#include "GNEVariableSpeedSignStep.h" +#include "GNEVariableSpeedSign.h" + + +// =========================================================================== +// member method definitions +// =========================================================================== + +GNEVariableSpeedSignStep::GNEVariableSpeedSignStep(GNEVariableSpeedSign* variableSpeedSignParent) : + myVariableSpeedSignParent(variableSpeedSignParent), + myTime(0), + mySpeed(50), + myTag(SUMO_TAG_STEP) { +} + + +GNEVariableSpeedSignStep::GNEVariableSpeedSignStep(GNEVariableSpeedSign* variableSpeedSignParent, double time, double speed) : + myVariableSpeedSignParent(variableSpeedSignParent), + myTime(0), + mySpeed(50), + myTag(SUMO_TAG_STEP) { + // use set functions to avid non valid intervals + setTime(time); + setSpeed(speed); +} + + +GNEVariableSpeedSignStep::~GNEVariableSpeedSignStep() {} + + +GNEVariableSpeedSign* +GNEVariableSpeedSignStep::getVariableSpeedSignParent() const { + return myVariableSpeedSignParent; +} + + +SumoXMLTag +GNEVariableSpeedSignStep::getTag() const { + return myTag; +} + + +double +GNEVariableSpeedSignStep::getTime() const { + return myTime; +} + + +double +GNEVariableSpeedSignStep::getSpeed() const { + return mySpeed; +} + + +bool +GNEVariableSpeedSignStep::setTime(double time) { + if (time >= 0) { + myTime = time; + return true; + } else { + return false; + } +} + + +bool +GNEVariableSpeedSignStep::setSpeed(double speed) { + if (speed >= 0) { + mySpeed = speed; + return true; + } else { + return false; + } +} + + +bool +GNEVariableSpeedSignStep::operator==(const GNEVariableSpeedSignStep& variableSpeedSignStep) const { + return (myTime == variableSpeedSignStep.myTime); +} + + +bool +GNEVariableSpeedSignStep::operator!=(const GNEVariableSpeedSignStep& variableSpeedSignStep) const { + return (myTime != variableSpeedSignStep.myTime); +} + + +bool +GNEVariableSpeedSignStep::operator>(const GNEVariableSpeedSignStep& variableSpeedSignStep) const { + return (myTime > variableSpeedSignStep.myTime); +} + + +bool +GNEVariableSpeedSignStep::operator<(const GNEVariableSpeedSignStep& variableSpeedSignStep) const { + return (myTime < variableSpeedSignStep.myTime); +} + + +bool +GNEVariableSpeedSignStep::operator>=(const GNEVariableSpeedSignStep& variableSpeedSignStep) const { + return (myTime >= variableSpeedSignStep.myTime); +} + + +bool +GNEVariableSpeedSignStep::operator<=(const GNEVariableSpeedSignStep& variableSpeedSignStep) const { + return (myTime <= variableSpeedSignStep.myTime); +} +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignStep.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignStep.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignStep.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEVariableSpeedSignStep.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,117 @@ +/****************************************************************************/ +/// @file GNEVariableSpeedSignStep.h +/// @author Pablo Alvarez Lopez +/// @date Apr 2017 +/// @version $Id: GNEVariableSpeedSignStep.h 24030 2017-04-24 07:16:24Z behrisch $ +/// +/// +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GNEVariableSpeedSignStep_h +#define GNEVariableSpeedSignStep_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include + +// =========================================================================== +// class declarations +// =========================================================================== + +class GNEVariableSpeedSign; + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class GNEVariableSpeedSignStep + * class used to represent a interval used in variable speed sign + */ +class GNEVariableSpeedSignStep { +public: + /// @brief default constructor + GNEVariableSpeedSignStep(GNEVariableSpeedSign* variableSpeedSignParent); + + /// @brief constructor + GNEVariableSpeedSignStep(GNEVariableSpeedSign* variableSpeedSignParent, double time, double speed); + + /// @brief destructor + ~GNEVariableSpeedSignStep(); + + /// @brief get variable speed sign parent + GNEVariableSpeedSign* getVariableSpeedSignParent() const; + + /// @brief get tag + SumoXMLTag getTag() const; + + /// @brief get time + double getTime() const; + + /// @brief get speed + double getSpeed() const; + + /**@brief set time + * @brief return true if was sucesfully set, false in other case + */ + bool setTime(double time); + + /**@brief set speed time + * @brief return true if was sucesfully set, false in other case + */ + bool setSpeed(double speed); + + /// @brief overload operator == + bool operator==(const GNEVariableSpeedSignStep& variableSpeedSignStep) const; + + /// @brief overload operator != + bool operator!=(const GNEVariableSpeedSignStep& variableSpeedSignStep) const; + + /// @brief overload operator > + bool operator>(const GNEVariableSpeedSignStep& variableSpeedSignStep) const; + + /// @brief overload operator < + bool operator<(const GNEVariableSpeedSignStep& variableSpeedSignStep) const; + + /// @brief overload operator >= + bool operator>=(const GNEVariableSpeedSignStep& variableSpeedSignStep) const; + + /// @brief overload operator <= + bool operator<=(const GNEVariableSpeedSignStep& variableSpeedSignStep) const; + +protected: + /// @brief pointer to variable speed sign parent + GNEVariableSpeedSign* myVariableSpeedSignParent; + + /// @brief timeStep + double myTime; + + /// @brief speed in this timeStep + double mySpeed; + + /// @brief XML Tag of a variable speed sign interval + SumoXMLTag myTag; +}; + +#endif + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEViewNet.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEViewNet.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEViewNet.cpp 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEViewNet.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -1,13 +1,14 @@ /****************************************************************************/ /// @file GNEViewNet.cpp /// @author Jakob Erdmann +/// @author Pablo Alvarez Lopez /// @date Feb 2011 -/// @version $Id: GNEViewNet.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEViewNet.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A view on the network being edited (adapted from GUIViewTraffic) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -49,6 +51,7 @@ #include #include #include +#include #include #include "GNEViewNet.h" @@ -65,25 +68,30 @@ #include "GNEConnectorFrame.h" #include "GNETLSEditorFrame.h" #include "GNEAdditionalFrame.h" +#include "GNECrossingFrame.h" +#include "GNEDeleteFrame.h" #include "GNEAdditionalHandler.h" #include "GNEPoly.h" #include "GNECrossing.h" #include "GNEAdditional.h" -#include "GNEAdditionalSet.h" #include "GNEAdditionalDialog.h" #include "GNERerouter.h" #include "GNEConnection.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping // =========================================================================== FXDEFMAP(GNEViewNet) GNEViewNetMap[] = { - FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_CHANGE, GNEViewNet::onCmdChangeMode), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_CREATE_EDGE, GNEViewNet::onCmdSetModeCreateEdge), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_MOVE, GNEViewNet::onCmdSetModeMove), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_DELETE, GNEViewNet::onCmdSetModeDelete), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_INSPECT, GNEViewNet::onCmdSetModeInspect), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_SELECT, GNEViewNet::onCmdSetModeSelect), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_CONNECT, GNEViewNet::onCmdSetModeConnect), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_TLS, GNEViewNet::onCmdSetModeTLS), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_ADDITIONAL, GNEViewNet::onCmdSetModeAdditional), + FXMAPFUNC(SEL_COMMAND, MID_GNE_MODE_CROSSING, GNEViewNet::onCmdSetModeCrossing), FXMAPFUNC(SEL_COMMAND, MID_GNE_SPLIT_EDGE, GNEViewNet::onCmdSplitEdge), FXMAPFUNC(SEL_COMMAND, MID_GNE_SPLIT_EDGE_BIDI, GNEViewNet::onCmdSplitEdgeBidi), FXMAPFUNC(SEL_COMMAND, MID_GNE_REVERSE_EDGE, GNEViewNet::onCmdReverseEdge), @@ -107,7 +115,9 @@ FXMAPFUNC(SEL_COMMAND, MID_GNE_NODE_SHAPE, GNEViewNet::onCmdNodeShape), FXMAPFUNC(SEL_COMMAND, MID_GNE_NODE_REPLACE, GNEViewNet::onCmdNodeReplace), FXMAPFUNC(SEL_COMMAND, MID_GNE_SHOW_CONNECTIONS, GNEViewNet::onCmdToogleShowConnection), - FXMAPFUNC(SEL_COMMAND, MID_GNE_SHOW_BUBBLES, GNEViewNet::onCmdToogleShowBubbles) + FXMAPFUNC(SEL_COMMAND, MID_GNE_SELECT_EDGES, GNEViewNet::onCmdToogleSelectEdges), + FXMAPFUNC(SEL_COMMAND, MID_GNE_SHOW_BUBBLES, GNEViewNet::onCmdToogleShowBubbles), + FXMAPFUNC(SEL_COMMAND, MID_GNE_SHOW_GRID, GNEViewNet::onCmdShowGrid) }; // Object implementation @@ -124,19 +134,31 @@ myNet(net), myEditMode(GNE_MODE_MOVE), myPreviousEditMode(GNE_MODE_MOVE), - myShowConnectionActivated(false), + myCurrentFrame(0), + myShowConnections(false), + mySelectEdges(true), myCreateEdgeSource(0), myJunctionToMove(0), myEdgeToMove(0), myPolyToMove(0), + myPoiToMove(0), myAdditionalToMove(0), myMoveSelection(false), myAmInRectSelect(false), myToolbar(toolBar), - myEditModesCombo(0), + myEditModeCreateEdge(0), + myEditModeMove(0), + myEditModeDelete(0), + myEditModeInspect(0), + myEditModeSelect(0), + myEditModeConnection(0), + myEditModeTrafficLight(0), + myEditModeAdditional(0), + myEditModeCrossing(0), myEditModeNames(), myUndoList(undoList), - myCurrentPoly(0) { + myCurrentPoly(0), + myTestingMode(OptionsCont::getOptions().getBool("gui-testing")) { // view must be the final member of actualParent reparent(actualParent); @@ -159,71 +181,71 @@ scheme.addColor(RGBColor(0, 80, 180, 255), 1, "selected"); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by permission code", RGBColor(240, 240, 240), "nobody"); - scheme.addColor(RGBColor(10, 10, 10), (SUMOReal)SVC_PASSENGER, "passenger"); - scheme.addColor(RGBColor(128, 128, 128), (SUMOReal)SVC_PEDESTRIAN, "pedestrian"); - scheme.addColor(RGBColor(80, 80, 80), (SUMOReal)(SVC_PEDESTRIAN | SVC_DELIVERY), "pedestrian_delivery"); - scheme.addColor(RGBColor(192, 66, 44), (SUMOReal)SVC_BICYCLE, "bicycle"); - scheme.addColor(RGBColor(40, 100, 40), (SUMOReal)SVC_BUS, "bus"); - scheme.addColor(RGBColor(166, 147, 26), (SUMOReal)SVC_TAXI, "taxi"); - scheme.addColor(RGBColor::BLACK, (SUMOReal)(SVCAll & ~SVC_NON_ROAD), "normal_road"); - scheme.addColor(RGBColor::BLACK, (SUMOReal)(SVCAll & ~(SVC_PEDESTRIAN | SVC_NON_ROAD)), "disallow_pedestrian"); - scheme.addColor(RGBColor(255, 206, 0), (SUMOReal)(SVCAll & ~(SVC_PEDESTRIAN | SVC_BICYCLE | SVC_MOPED | SVC_NON_ROAD)), "motorway"); - scheme.addColor(RGBColor(150, 200, 200), (SUMOReal)SVC_SHIP, "waterway"); - scheme.addColor(RGBColor::GREEN, (SUMOReal)SVCAll, "all"); + scheme.addColor(RGBColor(10, 10, 10), (double)SVC_PASSENGER, "passenger"); + scheme.addColor(RGBColor(128, 128, 128), (double)SVC_PEDESTRIAN, "pedestrian"); + scheme.addColor(RGBColor(80, 80, 80), (double)(SVC_PEDESTRIAN | SVC_DELIVERY), "pedestrian_delivery"); + scheme.addColor(RGBColor(192, 66, 44), (double)SVC_BICYCLE, "bicycle"); + scheme.addColor(RGBColor(40, 100, 40), (double)SVC_BUS, "bus"); + scheme.addColor(RGBColor(166, 147, 26), (double)SVC_TAXI, "taxi"); + scheme.addColor(RGBColor::BLACK, (double)(SVCAll & ~SVC_NON_ROAD), "normal_road"); + scheme.addColor(RGBColor::BLACK, (double)(SVCAll & ~(SVC_PEDESTRIAN | SVC_NON_ROAD)), "disallow_pedestrian"); + scheme.addColor(RGBColor(255, 206, 0), (double)(SVCAll & ~(SVC_PEDESTRIAN | SVC_BICYCLE | SVC_MOPED | SVC_NON_ROAD)), "motorway"); + scheme.addColor(RGBColor(150, 200, 200), (double)SVC_SHIP, "waterway"); + scheme.addColor(RGBColor::GREEN, (double)SVCAll, "all"); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by allowed speed (lanewise)", RGBColor::RED); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)(30 / 3.6)); - scheme.addColor(RGBColor::GREEN, (SUMOReal)(55 / 3.6)); - scheme.addColor(RGBColor::CYAN, (SUMOReal)(80 / 3.6)); - scheme.addColor(RGBColor::BLUE, (SUMOReal)(120 / 3.6)); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)(150 / 3.6)); + scheme.addColor(RGBColor::YELLOW, (double)(30 / 3.6)); + scheme.addColor(RGBColor::GREEN, (double)(55 / 3.6)); + scheme.addColor(RGBColor::CYAN, (double)(80 / 3.6)); + scheme.addColor(RGBColor::BLUE, (double)(120 / 3.6)); + scheme.addColor(RGBColor::MAGENTA, (double)(150 / 3.6)); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by lane number (streetwise)", RGBColor::RED); - scheme.addColor(RGBColor::BLUE, (SUMOReal)5); + scheme.addColor(RGBColor::BLUE, (double)5); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by given length/geometrical length", RGBColor::BLACK); - scheme.addColor(RGBColor::RED, (SUMOReal)0.25); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)0.5); - scheme.addColor(RGBColor(179, 179, 179, 255), (SUMOReal)1.0); - scheme.addColor(RGBColor::GREEN, (SUMOReal)2.0); - scheme.addColor(RGBColor::BLUE, (SUMOReal)4.0); + scheme.addColor(RGBColor::RED, 0.25); + scheme.addColor(RGBColor::YELLOW, 0.5); + scheme.addColor(RGBColor(179, 179, 179, 255), (double)1.0); + scheme.addColor(RGBColor::GREEN, (double)2.0); + scheme.addColor(RGBColor::BLUE, (double)4.0); laneColorer.addScheme(scheme); laneColorer.addScheme(GUIColorScheme("by angle", RGBColor::YELLOW, "", true)); scheme = GUIColorScheme("by priority", RGBColor::YELLOW); - scheme.addColor(RGBColor::RED, (SUMOReal) - 20); - scheme.addColor(RGBColor::GREEN, (SUMOReal)20); + scheme.addColor(RGBColor::RED, (double) - 20); + scheme.addColor(RGBColor::GREEN, (double)20); scheme.setAllowsNegativeValues(true); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by height at start", RGBColor::RED); - scheme.addColor(RGBColor::BLUE, (SUMOReal) - 10); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)50); - scheme.addColor(RGBColor::GREEN, (SUMOReal)100); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)200); + scheme.addColor(RGBColor::BLUE, (double) - 10); + scheme.addColor(RGBColor::YELLOW, (double)50); + scheme.addColor(RGBColor::GREEN, (double)100); + scheme.addColor(RGBColor::MAGENTA, (double)200); scheme.setAllowsNegativeValues(true); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by height at segment start", RGBColor::RED); - scheme.addColor(RGBColor::BLUE, (SUMOReal) - 10); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)50); - scheme.addColor(RGBColor::GREEN, (SUMOReal)100); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)200); + scheme.addColor(RGBColor::BLUE, (double) - 10); + scheme.addColor(RGBColor::YELLOW, (double)50); + scheme.addColor(RGBColor::GREEN, (double)100); + scheme.addColor(RGBColor::MAGENTA, (double)200); scheme.setAllowsNegativeValues(true); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by inclination", RGBColor::GREY); - scheme.addColor(RGBColor::YELLOW, (SUMOReal) .1); - scheme.addColor(RGBColor::RED, (SUMOReal) .3); - scheme.addColor(RGBColor::GREEN, (SUMOReal) - .1); - scheme.addColor(RGBColor::BLUE, (SUMOReal) - .3); + scheme.addColor(RGBColor::YELLOW, (double) .1); + scheme.addColor(RGBColor::RED, (double) .3); + scheme.addColor(RGBColor::GREEN, (double) - .1); + scheme.addColor(RGBColor::BLUE, (double) - .3); scheme.setAllowsNegativeValues(true); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by segment inclination", RGBColor::GREY); - scheme.addColor(RGBColor::YELLOW, (SUMOReal) .1); - scheme.addColor(RGBColor::RED, (SUMOReal) .3); - scheme.addColor(RGBColor::GREEN, (SUMOReal) - .1); - scheme.addColor(RGBColor::BLUE, (SUMOReal) - .3); + scheme.addColor(RGBColor::YELLOW, (double) .1); + scheme.addColor(RGBColor::RED, (double) .3); + scheme.addColor(RGBColor::GREEN, (double) - .1); + scheme.addColor(RGBColor::BLUE, (double) - .3); scheme.setAllowsNegativeValues(true); laneColorer.addScheme(scheme); @@ -252,6 +274,13 @@ scheme.addColor(RGBColor(128, 0, 128), 12, "rail_crossing"); // dark purple junctionColorer.addScheme(scheme); myVisualizationSettings->junctionColorer = junctionColorer; + + if (myTestingMode && OptionsCont::getOptions().isSet("window-size")) { + std::vector windowSize = OptionsCont::getOptions().getStringVector("window-size"); + assert(windowSize.size() == 2); + myTestingWidth = GNEAttributeCarrier::parse(windowSize[0]); + myTestingHeight = GNEAttributeCarrier::parse(windowSize[1]); + } } @@ -264,35 +293,47 @@ void GNEViewNet::buildViewToolBars(GUIGlChildWindow& cw) { - /* // build coloring tools { - const std::vector &names = gSchemeStorage.getNames(); - for (std::vector::const_iterator i=names.begin(); i!=names.end(); ++i) { - v.getColoringSchemesCombo().appendItem((*i).c_str()); + const std::vector& names = gSchemeStorage.getNames(); + for (std::vector::const_iterator i = names.begin(); i != names.end(); ++i) { + cw.getColoringSchemesCombo().appendItem((*i).c_str()); if ((*i) == myVisualizationSettings->name) { - v.getColoringSchemesCombo().setCurrentItem(v.getColoringSchemesCombo().getNumItems()-1); + cw.getColoringSchemesCombo().setCurrentItem(cw.getColoringSchemesCombo().getNumItems() - 1); } } - v.getColoringSchemesCombo().setNumVisible(5); + cw.getColoringSchemesCombo().setNumVisible(MAX2(5, (int)names.size() + 1)); } - */ - - // locator button for junctions + // for junctions new FXButton(cw.getLocatorPopup(), "\tLocate Junction\tLocate a junction within the network.", GUIIconSubSys::getIcon(ICON_LOCATEJUNCTION), &cw, MID_LOCATEJUNCTION, ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED); - // locator button for edges + // for edges new FXButton(cw.getLocatorPopup(), "\tLocate Street\tLocate a street within the network.", GUIIconSubSys::getIcon(ICON_LOCATEEDGE), &cw, MID_LOCATEEDGE, ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED); - // locator button for tls + // for tls new FXButton(cw.getLocatorPopup(), - "\tLocate TLS\tLocate a traffic light within the network.", + "\tLocate TLS\tLocate a tls within the network.", GUIIconSubSys::getIcon(ICON_LOCATETLS), &cw, MID_LOCATETLS, ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED); + // for additional stuff + new FXButton(cw.getLocatorPopup(), + "\tLocate Additional\tLocate an additional structure within the network.", + GUIIconSubSys::getIcon(ICON_LOCATEADD), &cw, MID_LOCATEADD, + ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED); + // for pois + new FXButton(cw.getLocatorPopup(), + "\tLocate PoI\tLocate a PoI within the network.", + GUIIconSubSys::getIcon(ICON_LOCATEPOI), &cw, MID_LOCATEPOI, + ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED); + // for polygons + new FXButton(cw.getLocatorPopup(), + "\tLocate Polygon\tLocate a Polygon within the network.", + GUIIconSubSys::getIcon(ICON_LOCATEPOLY), &cw, MID_LOCATEPOLY, + ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED); } @@ -320,7 +361,7 @@ bool GNEViewNet::selectEdges() { - return mySelectEdges->getCheck() != 0; + return mySelectEdges; } @@ -328,38 +369,43 @@ GNEViewNet::showConnections() { if (myEditMode == GNE_MODE_CONNECT) { return true; - } else if (myShowConnections->shown() == false) { + } else if (myMenuCheckShowConnections->shown() == false) { return false; } else { - return (myShowConnections->getCheck() == 1); + return (myMenuCheckShowConnections->getCheck() != 0); } } bool GNEViewNet::autoSelectNodes() { - return myExtendToEdgeNodes->getCheck() != 0; + return (myMenuCheckExtendToEdgeNodes->getCheck() != 0); } void -GNEViewNet::setSelectionScaling(SUMOReal selectionScale) { +GNEViewNet::setSelectionScaling(double selectionScale) { myVisualizationSettings->selectionScale = selectionScale; } bool GNEViewNet::changeAllPhases() const { - return myChangeAllPhases->getCheck() != FALSE; + return (myMenuCheckChangeAllPhases->getCheck() != 0); } bool GNEViewNet::showJunctionAsBubbles() const { - return (myEditMode == GNE_MODE_MOVE) && (myShowJunctionAsBubble->getCheck()); + return (myEditMode == GNE_MODE_MOVE) && (myMenuCheckShowBubbleOverJunction->getCheck()); } +bool +GNEViewNet::isTestingModeEnabled() const { + return myTestingMode; +} + int GNEViewNet::doPaintGL(int mode, const Boundary& bound) { // init view settings @@ -388,12 +434,43 @@ } // compute lane width - SUMOReal lw = m2p(SUMO_const_laneWidth); + double lw = m2p(SUMO_const_laneWidth); // draw decals (if not in grabbing mode) if (!myUseToolTips) { drawDecals(); + // depending of the visualizationSettings, enable or disable check box show grid if (myVisualizationSettings->showGrid) { + myMenuCheckShowGrid->setCheck(true); paintGLGrid(); + } else { + myMenuCheckShowGrid->setCheck(false); + } + if (myTestingMode) { + if (myTestingWidth > 0 && (getWidth() != myTestingWidth || getHeight() != myTestingHeight)) { + // only resize once to avoid flickering + //std::cout << " before resize: view=" << getWidth() << ", " << getHeight() << " app=" << myApp->getWidth() << ", " << myApp->getHeight() << "\n"; + myApp->resize(myTestingWidth + myTestingWidth - getWidth(), myTestingHeight + myTestingHeight - getHeight()); + //std::cout << " directly after resize: view=" << getWidth() << ", " << getHeight() << " app=" << myApp->getWidth() << ", " << myApp->getHeight() << "\n"; + myTestingWidth = 0; + } + //std::cout << " fixed: view=" << getWidth() << ", " << getHeight() << " app=" << myApp->getWidth() << ", " << myApp->getHeight() << "\n"; + // draw pink square in the upper left corner on top of everything + glPushMatrix(); + const double size = p2m(32); + Position center = screenPos2NetPos(8, 8); + GLHelper::setColor(RGBColor::MAGENTA); + glTranslated(center.x(), center.y(), GLO_MAX - 1); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + glBegin(GL_QUADS); + glVertex2d(0, 0); + glVertex2d(0, -size); + glVertex2d(size, -size); + glVertex2d(size, 0); + glEnd(); + glPopMatrix(); + + // Reset textures due bug #2780. This solution is only provisional, and must be updated in the future + GUITextureSubSys::resetTextures(); } } glLineWidth(1); @@ -416,9 +493,12 @@ long -GNEViewNet::onLeftBtnPress(FXObject* obj, FXSelector sel, void* data) { +GNEViewNet::onLeftBtnPress(FXObject*, FXSelector, void* data) { FXEvent* e = (FXEvent*) data; setFocus(); + // limit position depending of myMenuCheckShowGrid + Position clickedPosition = snapToActiveGrid(getPositionInformation()); + // interpret object under curser if (makeCurrent()) { int id = getObjectUnderCursor(); @@ -467,14 +547,14 @@ // decide what to do based on mode switch (myEditMode) { - case GNE_MODE_CREATE_EDGE: + case GNE_MODE_CREATE_EDGE: { if ((e->state & CONTROLMASK) == 0) { // allow moving when control is held down if (!myUndoList->hasCommandGroup()) { - myUndoList->p_begin("create new edge"); + myUndoList->p_begin("create new " + toString(SUMO_TAG_EDGE)); } if (!pointed_junction) { - pointed_junction = myNet->createJunction(getPositionInformation(), myUndoList); + pointed_junction = myNet->createJunction(clickedPosition, myUndoList); } if (myCreateEdgeSource == 0) { myCreateEdgeSource = pointed_junction; @@ -486,11 +566,12 @@ GNEEdge* newEdge = myNet->createEdge( myCreateEdgeSource, pointed_junction, myViewParent->getInspectorFrame()->getEdgeTemplate(), myUndoList); if (newEdge) { + // create another edge, if create opposite edge is enabled if (myAutoCreateOppositeEdge->getCheck()) { - myNet->createEdge( - pointed_junction, myCreateEdgeSource, myViewParent->getInspectorFrame()->getEdgeTemplate(), myUndoList, "-" + newEdge->getNBEdge()->getID()); + myNet->createEdge(pointed_junction, myCreateEdgeSource, myViewParent->getInspectorFrame()->getEdgeTemplate(), myUndoList, "-" + newEdge->getNBEdge()->getID()); } myCreateEdgeSource->unMarkAsCreateEdgeSource(); + if (myUndoList->hasCommandGroup()) { myUndoList->p_end(); } else { @@ -499,26 +580,30 @@ if (myChainCreateEdge->getCheck()) { myCreateEdgeSource = pointed_junction; myCreateEdgeSource->markAsCreateEdgeSource(); - myUndoList->p_begin("create new edge"); + myUndoList->p_begin("create new " + toString(SUMO_TAG_EDGE)); } else { myCreateEdgeSource = 0; } } else { - setStatusBarText("An edge with the same geometry already exists!"); + setStatusBarText("An " + toString(SUMO_TAG_EDGE) + " with the same geometry already exists!"); } } else { - setStatusBarText("Start- and endpoint for an edge must be distinct!"); + setStatusBarText("Start- and endpoint for an " + toString(SUMO_TAG_EDGE) + " must be distinct!"); } update(); } } - GUISUMOAbstractView::onLeftBtnPress(obj, sel, data); + // process click + processClick(e, data); break; - - case GNE_MODE_MOVE: + } + case GNE_MODE_MOVE: { if (pointed_poly) { myPolyToMove = pointed_poly; myMoveSrc = getPositionInformation(); + } else if (pointed_poi) { + myPoiToMove = pointed_poi; + myMoveSrc = getPositionInformation(); } else if (pointed_junction) { if (gSelected.isSelected(GLO_JUNCTION, pointed_junction->getGlID())) { myMoveSelection = true; @@ -543,69 +628,66 @@ if (myAdditionalToMove->getLane()) { if (GNEAttributeCarrier::hasAttribute(myAdditionalToMove->getTag(), SUMO_ATTR_STARTPOS)) { // Obtain start position - SUMOReal startPos = GNEAttributeCarrier::parse(myAdditionalToMove->getAttribute(SUMO_ATTR_STARTPOS)); + double startPos = GNEAttributeCarrier::parse(myAdditionalToMove->getAttribute(SUMO_ATTR_STARTPOS)); if (GNEAttributeCarrier::hasAttribute(myAdditionalToMove->getTag(), SUMO_ATTR_ENDPOS)) { // Obtain end position - SUMOReal endPos = GNEAttributeCarrier::parse(myAdditionalToMove->getAttribute(SUMO_ATTR_ENDPOS)); + double endPos = GNEAttributeCarrier::parse(myAdditionalToMove->getAttribute(SUMO_ATTR_ENDPOS)); // Save both values in myOldAdditionalPosition myOldAdditionalPosition.set(startPos, endPos); } else if (GNEAttributeCarrier::hasAttribute(myAdditionalToMove->getTag(), SUMO_ATTR_LENGTH)) { // Obtain length attribute - SUMOReal length = GNEAttributeCarrier::parse(myAdditionalToMove->getAttribute(SUMO_ATTR_LENGTH)); + double length = GNEAttributeCarrier::parse(myAdditionalToMove->getAttribute(SUMO_ATTR_LENGTH)); // Save both values in myOldAdditionalPosition myOldAdditionalPosition.set(startPos, length); } else { // Save only startpos in myOldAdditionalPosition myOldAdditionalPosition.set(startPos, 0); } + } else if (GNEAttributeCarrier::hasAttribute(myAdditionalToMove->getTag(), SUMO_ATTR_POSITION)) { + myOldAdditionalPosition.set(GNEAttributeCarrier::parse(myAdditionalToMove->getAttribute(SUMO_ATTR_POSITION)), 0); } // Set myAdditionalMovingReference - myAdditionalMovingReference.set(pointed_additional->getLane()->getShape().nearest_offset_to_point2D(getPositionInformation(), false), 0, 0); + myAdditionalMovingReference.set(pointed_additional->getLane()->getShape().nearest_offset_to_point2D(clickedPosition, false), 0, 0); } else { // Set myOldAdditionalPosition and myAdditionalMovingReference myOldAdditionalPosition = getPositionInformation(); - myAdditionalMovingReference = pointed_additional->getPositionInView() - getPositionInformation(); + myAdditionalMovingReference = pointed_additional->getPositionInView() - clickedPosition; } } } } else { - GUISUMOAbstractView::onLeftBtnPress(obj, sel, data); + // process click + processClick(e, data); } update(); break; - - case GNE_MODE_DELETE: - if (pointed_junction) { - /* - if (gSelected.isSelected(GLO_JUNCTION, pointed_junction->getGlID())) { - deleteSelectedJunctions(); - } - */ - myNet->deleteJunction(pointed_junction, myUndoList); - } else if (pointed_lane && !mySelectEdges->getCheck()) { - myNet->deleteLane(pointed_lane, myUndoList); - } else if (pointed_edge) { - /* - if (gSelected.isSelected(GLO_EDGE, pointed_edge->getGlID())) { - deleteSelectedEdges(); + } + case GNE_MODE_DELETE: { + // Check if Control key is pressed + bool markElementMode = (((FXEvent*)data)->state & CONTROLMASK) != 0; + GNEAttributeCarrier* ac = dynamic_cast(pointed); + if ((pointed_lane != NULL) && (mySelectEdges == true)) { + ac = pointed_edge; + } + if (ac) { + // if pointed element is an attribute carrier, remove it or mark it + if (markElementMode) { + if (myViewParent->getDeleteFrame()->getMarkedAttributeCarrier() != ac) { + myViewParent->getDeleteFrame()->markAttributeCarrier(ac); + myViewParent->getDeleteFrame()->showAttributeCarrierChilds(ac); + } + } else if (myViewParent->getDeleteFrame()->getMarkedAttributeCarrier() != NULL) { + myViewParent->getDeleteFrame()->markAttributeCarrier(NULL); + myViewParent->getDeleteFrame()->showAttributeCarrierChilds(ac); + } else { + myViewParent->getDeleteFrame()->removeAttributeCarrier(ac); } - */ - myNet->deleteGeometryOrEdge(pointed_edge, getPositionInformation(), myUndoList); - } else if (pointed_poi) { - // XXX this is a dirty dirty hack! implemente GNEChange_POI - myNet->getShapeContainer().removePOI(pointed_poi->getMicrosimID()); - update(); - } else if (pointed_additional) { - myViewParent->getAdditionalFrame()->removeAdditional(pointed_additional); - update(); - } else if (pointed_connection) { - myNet->deleteConnection(pointed_connection, myUndoList); - update(); } else { - GUISUMOAbstractView::onLeftBtnPress(obj, sel, data); + // process click + processClick(e, data); } break; - + } case GNE_MODE_INSPECT: { GNEAttributeCarrier* pointedAC = 0; GUIGlObject* pointedO = 0; @@ -613,7 +695,7 @@ pointedAC = pointed_junction; pointedO = pointed_junction; } else if (pointed_lane) { // implies pointed_edge - if (selectEdges()) { + if (mySelectEdges == true) { pointedAC = pointed_edge; pointedO = pointed_edge; } else { @@ -633,22 +715,37 @@ pointedAC = pointed_connection; pointedO = pointed_connection; } - - std::vector selected; + // obtain selected ACs + std::vector selectedElements; + std::vector selectedFilteredElements; if (pointedO && gSelected.isSelected(pointedO->getType(), pointedO->getGlID())) { std::set selectedIDs = gSelected.getSelected(pointedO->getType()); - selected = myNet->retrieveAttributeCarriers(selectedIDs, pointedO->getType()); - } else if (pointedAC != 0) { - selected.push_back(pointedAC); + selectedElements = myNet->retrieveAttributeCarriers(selectedIDs, pointedO->getType()); + // filter selected elements (example: if we have two E2 and one busStop selected, and user click over one E2, + // attribues of busstop musn't be shown + for (std::vector::iterator i = selectedElements.begin(); i != selectedElements.end(); i++) { + if ((*i)->getTag() == pointedAC->getTag()) { + selectedFilteredElements.push_back(*i); + } + } + } + // Inspect seleted ACs, or single clicked AC + if (selectedFilteredElements.size() > 0) { + myViewParent->getInspectorFrame()->inspectMultisection(selectedFilteredElements); + } else if (pointedAC != NULL) { + myViewParent->getInspectorFrame()->inspectElement(pointedAC); + } + // process click + processClick(e, data); + // focus upper element of inspector frame + if ((selectedFilteredElements.size() > 0) || (pointedAC != NULL)) { + myViewParent->getInspectorFrame()->focusUpperElement(); } - myViewParent->getInspectorFrame()->inspect(selected); - GUISUMOAbstractView::onLeftBtnPress(obj, sel, data); update(); break; } - case GNE_MODE_SELECT: - if (pointed_lane && selectEdges()) { + if ((pointed_lane != NULL) && (mySelectEdges == true)) { gSelected.toggleSelection(pointed_edge->getGlID()); } else if (pointed) { gSelected.toggleSelection(pointed->getGlID()); @@ -659,41 +756,61 @@ mySelCorner1 = getPositionInformation(); mySelCorner2 = getPositionInformation(); } else { - GUISUMOAbstractView::onLeftBtnPress(obj, sel, data); + // process click + processClick(e, data); } update(); break; - case GNE_MODE_CONNECT: + case GNE_MODE_CONNECT: { if (pointed_lane) { const bool mayPass = (((FXEvent*)data)->state & SHIFTMASK) != 0; const bool allowConflict = (((FXEvent*)data)->state & CONTROLMASK) != 0; myViewParent->getConnectorFrame()->handleLaneClick(pointed_lane, mayPass, allowConflict, true); update(); } - GUISUMOAbstractView::onLeftBtnPress(obj, sel, data); + // process click + processClick(e, data); break; - - case GNE_MODE_TLS: + } + case GNE_MODE_TLS: { if (pointed_junction) { myViewParent->getTLSEditorFrame()->editJunction(pointed_junction); update(); } - GUISUMOAbstractView::onLeftBtnPress(obj, sel, data); + // process click + processClick(e, data); break; - - case GNE_MODE_ADDITIONAL: + } + case GNE_MODE_ADDITIONAL: { if (pointed_additional == NULL) { GNENetElement* netElement = dynamic_cast(pointed); - if (myViewParent->getAdditionalFrame()->addAdditional(netElement, this)) { + GNEAdditionalFrame::AddAdditionalResult result = myViewParent->getAdditionalFrame()->addAdditional(netElement, this); + // process click or update view depending of the result of "add additional" + if ((result == GNEAdditionalFrame::ADDADDITIONAL_SUCCESS) || (result == GNEAdditionalFrame::ADDADDITIONAL_INVALID_PARENT)) { update(); + // process click + processClick(e, data); } } - GUISUMOAbstractView::onLeftBtnPress(obj, sel, data); - break; - default: - GUISUMOAbstractView::onLeftBtnPress(obj, sel, data); + break; + } + case GNE_MODE_CROSSING: { + if (pointed_crossing == NULL) { + GNENetElement* netElement = dynamic_cast(pointed); + if (myViewParent->getCrossingFrame()->addCrossing(netElement)) { + update(); + } + } + // process click + processClick(e, data); + break; + } + default: { + // process click + processClick(e, data); + } } makeNonCurrent(); } @@ -706,6 +823,8 @@ GUISUMOAbstractView::onLeftBtnRelease(obj, sel, data); if (myPolyToMove) { myPolyToMove = 0; + } else if (myPoiToMove) { + myPoiToMove = 0; } else if (myJunctionToMove) { // position is already up to date but we must register with myUndoList if (!mergeJunctions(myJunctionToMove)) { @@ -737,7 +856,7 @@ Boundary b; b.add(mySelCorner1); b.add(mySelCorner2); - myViewParent->getSelectorFrame()->handleIDs(getObjectsInBoundary(b), selectEdges()); + myViewParent->getSelectorFrame()->handleIDs(getObjectsInBoundary(b), mySelectEdges); makeNonCurrent(); } } @@ -757,10 +876,10 @@ int id = getObjectUnderCursor(); GUIGlObject* pointed = GUIGlObjectStorage::gIDStorage.getObjectBlocking(id); GUIGlObjectStorage::gIDStorage.unblockObject(id); - // If there are a pointed element an is an additional - if (pointed && pointed->getType() == GLO_ADDITIONAL) { - // Obtain pointer additional an open an AdditionalDialog if item own it - GNEAdditional* pointed_additional = (GNEAdditional*)pointed; + GNEAdditional* pointed_additional = dynamic_cast(pointed); + // If pointed element is an additional + if (pointed_additional != NULL) { + // If additional has a additional dialog, open it. pointed_additional->openAdditionalDialog(); } makeNonCurrent(); @@ -773,31 +892,60 @@ long GNEViewNet::onMouseMove(FXObject* obj, FXSelector sel, void* data) { GUISUMOAbstractView::onMouseMove(obj, sel, data); - if (myPolyToMove) { - myMoveSrc = myPolyToMove->moveGeometry(myMoveSrc, getPositionInformation()); - } else if (myJunctionToMove) { - myJunctionToMove->move(getPositionInformation()); - } else if (myEdgeToMove) { - myMoveSrc = myEdgeToMove->moveGeometry(myMoveSrc, getPositionInformation()); - } else if (myAdditionalToMove) { - // If additional is placed over lane, move it across it - if (myAdditionalToMove->getLane()) { - SUMOReal posOfMouseOverLane = myAdditionalToMove->getLane()->getShape().nearest_offset_to_point2D(getPositionInformation(), false); - myAdditionalToMove->moveAdditionalGeometry(posOfMouseOverLane - myAdditionalMovingReference.x(), 0); - myAdditionalMovingReference.set(posOfMouseOverLane, 0, 0); - } else { - // Calculate offset movement - Position offsetPosition = getPositionInformation() - myOldAdditionalPosition; - myAdditionalToMove->moveAdditionalGeometry(myOldAdditionalPosition + offsetPosition + myAdditionalMovingReference); + // limit position depending of myMenuCheckShowGrid + Position clickedPosition = snapToActiveGrid(getPositionInformation()); + // in delete mode object under cursor must be checked in every mouse movement + if (myEditMode == GNE_MODE_DELETE) { + setFocus(); + // show object information in delete frame + if (makeCurrent()) { + // obtain ac of globjectID + int glid = getObjectUnderCursor(); + GNEAttributeCarrier* ac = dynamic_cast(GUIGlObjectStorage::gIDStorage.getObjectBlocking(glid)); + GUIGlObjectStorage::gIDStorage.unblockObject(glid); + // Update current label of delete frame + myViewParent->getDeleteFrame()->updateCurrentLabel(ac); + // show childs of object in GNEDeleteFrame if current there isn't a marked element + if (myViewParent->getDeleteFrame()->getMarkedAttributeCarrier() == NULL) { + myViewParent->getDeleteFrame()->showAttributeCarrierChilds(ac); + } + } + } else { + if (myPolyToMove) { + myMoveSrc = myPolyToMove->moveGeometry(myMoveSrc, clickedPosition); + } else if (myPoiToMove) { + myPoiToMove->move(clickedPosition); + } else if (myJunctionToMove) { + // check if one of their junctions neighboors is in the position objective + std::vector junctionNeighbours = myJunctionToMove->getJunctionNeighbours(); + for (std::vector::iterator i = junctionNeighbours.begin(); i != junctionNeighbours.end(); i++) { + if ((*i)->getPosition() == clickedPosition) { + return 0; + } + } + myJunctionToMove->move(clickedPosition); + } else if (myEdgeToMove) { + myMoveSrc = myEdgeToMove->moveGeometry(myMoveSrc, clickedPosition); + } else if (myAdditionalToMove) { + // If additional is placed over lane, move it across it + if (myAdditionalToMove->getLane()) { + double posOfMouseOverLane = myAdditionalToMove->getLane()->getShape().nearest_offset_to_point2D(clickedPosition, false); + myAdditionalToMove->moveAdditionalGeometry(posOfMouseOverLane - myAdditionalMovingReference.x(), 0); + myAdditionalMovingReference.set(posOfMouseOverLane, 0, 0); + } else { + // Calculate offset movement + Position offsetPosition = clickedPosition - myOldAdditionalPosition; + myAdditionalToMove->moveAdditionalGeometry(myOldAdditionalPosition + offsetPosition + myAdditionalMovingReference); + } + update(); + } else if (myMoveSelection) { + Position moveTarget = clickedPosition; + myNet->moveSelection(myMoveSrc, moveTarget); + myMoveSrc = moveTarget; + } else if (myAmInRectSelect) { + mySelCorner2 = getPositionInformation(); + update(); } - update(); - } else if (myMoveSelection) { - Position moveTarget = getPositionInformation(); - myNet->moveSelection(myMoveSrc, moveTarget); - myMoveSrc = moveTarget; - } else if (myAmInRectSelect) { - mySelCorner2 = getPositionInformation(); - update(); } return 1; } @@ -805,8 +953,10 @@ void GNEViewNet::abortOperation(bool clearSelection) { - setFocus(); // steal focus from any text fields - if (myCreateEdgeSource) { + // steal focus from any text fields + setFocus(); + if (myCreateEdgeSource != NULL) { + // remove current created edge source myCreateEdgeSource->unMarkAsCreateEdgeSource(); myCreateEdgeSource = 0; } else if (myEditMode == GNE_MODE_SELECT) { @@ -833,6 +983,8 @@ myUndoList->p_begin("delete selection"); deleteSelectedJunctions(); deleteSelectedEdges(); + deleteSelectedAdditionals(); + /// @todo impelent deleteSelectedCrossings, deleteSelectdConnections myUndoList->p_end(); } } @@ -854,10 +1006,12 @@ } -long -GNEViewNet::onCmdChangeMode(FXObject*, FXSelector, void* data) { - setEditMode(myEditModeNames.get((char*) data)); - return 1; +void +GNEViewNet::hotkeyFocusFrame() { + // if current focus is placed over GNEViewnet, set focus to current frame + if (hasFocus() && (myCurrentFrame != NULL)) { + myCurrentFrame->focusUpperElement(); + } } @@ -888,11 +1042,13 @@ case MID_GNE_MODE_ADDITIONAL: setEditMode(GNE_MODE_ADDITIONAL); break; + case MID_GNE_MODE_CROSSING: + setEditMode(GNE_MODE_CROSSING); + break; default: - FXMessageBox::error(this, MBOX_OK, "invalid edit mode", "%s", "..."); + throw ProcessError("invalid edit mode called by hotkey"); break; } - myEditModesCombo->setCurrentItem(myEditModesCombo->findItem(myEditModeNames.getString(myEditMode).c_str())); } @@ -1023,6 +1179,69 @@ long +GNEViewNet::onCmdSetModeCreateEdge(FXObject*, FXSelector, void*) { + setEditMode(GNE_MODE_CREATE_EDGE); + return 1; +} + + +long +GNEViewNet::onCmdSetModeMove(FXObject*, FXSelector, void*) { + setEditMode(GNE_MODE_MOVE); + return 1; +} + + +long +GNEViewNet::onCmdSetModeDelete(FXObject*, FXSelector, void*) { + setEditMode(GNE_MODE_DELETE); + return 1; +} + + +long +GNEViewNet::onCmdSetModeInspect(FXObject*, FXSelector, void*) { + setEditMode(GNE_MODE_INSPECT); + return 1; +} + + +long +GNEViewNet::onCmdSetModeSelect(FXObject*, FXSelector, void*) { + setEditMode(GNE_MODE_SELECT); + return 1; +} + + +long +GNEViewNet::onCmdSetModeConnect(FXObject*, FXSelector, void*) { + setEditMode(GNE_MODE_CONNECT); + return 1; +} + + +long +GNEViewNet::onCmdSetModeTLS(FXObject*, FXSelector, void*) { + setEditMode(GNE_MODE_TLS); + return 1; +} + + +long +GNEViewNet::onCmdSetModeAdditional(FXObject*, FXSelector, void*) { + setEditMode(GNE_MODE_ADDITIONAL); + return 1; +} + + +long +GNEViewNet::onCmdSetModeCrossing(FXObject*, FXSelector, void*) { + setEditMode(GNE_MODE_CROSSING); + return 1; +} + + +long GNEViewNet::onCmdSplitEdge(FXObject*, FXSelector, void*) { GNEEdge* edge = getEdgeAtCursorPosition(myPopupSpot); if (edge != 0) { @@ -1087,14 +1306,14 @@ GNEEdge* edge = getEdgeAtCursorPosition(myPopupSpot); if (edge != 0) { if (gSelected.isSelected(GLO_EDGE, edge->getGlID())) { - myUndoList->p_begin("straighten selected edges"); + myUndoList->p_begin("straighten selected " + toString(SUMO_TAG_EDGE) + "s"); std::vector edges = myNet->retrieveEdges(true); for (std::vector::iterator it = edges.begin(); it != edges.end(); it++) { (*it)->setAttribute(SUMO_ATTR_SHAPE, "", myUndoList); } myUndoList->p_end(); } else { - myUndoList->p_begin("straighten edge"); + myUndoList->p_begin("straighten " + toString(SUMO_TAG_EDGE)); edge->setAttribute(SUMO_ATTR_SHAPE, "", myUndoList); myUndoList->p_end(); } @@ -1128,14 +1347,14 @@ GNELane* lane = getLaneAtCurserPosition(myPopupSpot); if (lane != 0) { if (gSelected.isSelected(GLO_LANE, lane->getGlID())) { - myUndoList->p_begin("duplicate selected lanes"); + myUndoList->p_begin("duplicate selected " + toString(SUMO_TAG_LANE) + "s"); std::vector lanes = myNet->retrieveLanes(true); for (std::vector::iterator it = lanes.begin(); it != lanes.end(); it++) { myNet->duplicateLane(*it, myUndoList); } myUndoList->p_end(); } else { - myUndoList->p_begin("duplicate lane"); + myUndoList->p_begin("duplicate " + toString(SUMO_TAG_LANE)); myNet->duplicateLane(lane, myUndoList); myUndoList->p_end(); } @@ -1213,8 +1432,8 @@ // Throw warning dialog if there hare multiple lanes selected in the same edge if (mapOfEdgesAndLanes.size() != lanes.size()) { FXMessageBox::information(getApp(), MBOX_OK, - ("Multiple lane in the same edge selected"), "%s", - ("There are selected lanes that belong to the same edge.\n Only one lane pro edge will be restricted for " + toString(vclass) + ".").c_str()); + "Multiple lane in the same edge selected", "%s", + ("There are selected lanes that belong to the same edge.\n Only one lane per edge will be restricted for " + toString(vclass) + ".").c_str()); } // If we handeln a set of lanes if (mapOfEdgesAndLanes.size() > 0) { @@ -1228,17 +1447,31 @@ } // if all edges parent own a Sidewalk, stop function if (counter == (int)mapOfEdgesAndLanes.size()) { - FXMessageBox::information(getApp(), MBOX_OK, "%s", + FXMessageBox::information(getApp(), MBOX_OK, ("Set vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s", ("All lanes own already another lane in the same edge with a restriction for " + toString(vclass)).c_str()); return 0; } else { + if (myTestingMode == true) { + WRITE_WARNING("Opening FXMessageBox of type 'question'"); + } // Ask confirmation to user FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO, ("Set vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s", (toString(mapOfEdgesAndLanes.size() - counter) + " lanes will be restricted for " + toString(vclass) + ". continue?").c_str()); if (answer != 1) { //1:yes, 2:no, 4:esc + // write warning if netedit is running in testing mode + if ((answer == 2) && (myTestingMode == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'"); + } else if ((answer == 4) && (myTestingMode == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'"); + } return 0; + } else { + // write warning if netedit is running in testing mode + if (myTestingMode == true) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Yes'"); + } } } // begin undo operation @@ -1295,17 +1528,31 @@ } // if all lanes own a Sidewalk, stop function if (counter == (int)setOfEdges.size()) { - FXMessageBox::information(getApp(), MBOX_OK, "%s", + FXMessageBox::information(getApp(), MBOX_OK, ("Add vclass for" + toString(vclass) + " to selected lanes").c_str(), "%s", ("All lanes own already another lane in the same edge with a restriction for " + toString(vclass)).c_str()); return 0; } else { + if (myTestingMode == true) { + WRITE_WARNING("Opening FXMessageBox of type 'question'"); + } // Ask confirmation to user FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO, ("Add vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s", (toString(setOfEdges.size() - counter) + " restrictions for " + toString(vclass) + " will be added. continue?").c_str()); if (answer != 1) { //1:yes, 2:no, 4:esc + // write warning if netedit is running in testing mode + if ((answer == 2) && (myTestingMode == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'"); + } else if ((answer == 4) && (myTestingMode == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'"); + } return 0; + } else { + // write warning if netedit is running in testing mode + if (myTestingMode == true) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Yes'"); + } } } // begin undo operation @@ -1362,17 +1609,31 @@ } // if all lanes don't own a Sidewalk, stop function if (counter == 0) { - FXMessageBox::information(getApp(), MBOX_OK, "%s", + FXMessageBox::information(getApp(), MBOX_OK, ("Remove vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s", ("Selected lanes and edges haven't a restriction for " + toString(vclass)).c_str()); return 0; } else { + if (myTestingMode == true) { + WRITE_WARNING("Opening FXMessageBox of type 'question'"); + } // Ask confirmation to user FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO, ("Remove vclass for " + toString(vclass) + " to selected lanes").c_str(), "%s", (toString(counter) + " restrictions for " + toString(vclass) + " will be removed. continue?").c_str()); if (answer != 1) { //1:yes, 2:no, 4:esc + // write warning if netedit is running in testing mode + if ((answer == 2) && (myTestingMode == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'"); + } else if ((answer == 4) && (myTestingMode == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'"); + } return 0; + } else { + // write warning if netedit is running in testing mode + if (myTestingMode == true) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Yes'"); + } } } // begin undo operation @@ -1397,6 +1658,19 @@ } +void +GNEViewNet::processClick(FXEvent* e, void* data) { + // process click + destroyPopup(); + setFocus(); + myChanger->onLeftBtnPress(data); + grab(); + // Check there are double click + if (e->click_count == 2) { + handle(this, FXSEL(SEL_DOUBLECLICKED, 0), data); + } +} + long GNEViewNet::onCmdRevertRestriction(FXObject*, FXSelector, void*) { GNELane* lane = getLaneAtCurserPosition(myPopupSpot); @@ -1430,15 +1704,30 @@ // if none of selected lanes has a transformation, stop if (counter == 0) { FXMessageBox::information(getApp(), MBOX_OK, - "Revert restriction", "None of selected lanes has a previous restriction"); + "Revert restriction", "%s", + "None of selected lanes has a previous restriction"); return 0; } else { + if (myTestingMode == true) { + WRITE_WARNING("Opening FXMessageBox of type 'question'"); + } // Ask confirmation to user FXuint answer = FXMessageBox::question(getApp(), MBOX_YES_NO, "Revert restriction", "%s", (toString(counter) + " restrictions of lanes lanes will be reverted. continue?").c_str()); if (answer != 1) { //1:yes, 2:no, 4:esc + // write warning if netedit is running in testing mode + if ((answer == 2) && (myTestingMode == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'"); + } else if ((answer == 4) && (myTestingMode == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'"); + } return 0; + } else { + // write warning if netedit is running in testing mode + if (myTestingMode == true) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Yes'"); + } } } // begin undo operation @@ -1479,7 +1768,7 @@ } PositionVector shape = junction->getNBNode()->getShape(); shape.closePolygon(); - myCurrentPoly = new GNEPoly(myNet, junction, "node_shape:" + junction->getMicrosimID(), "node shape", + myCurrentPoly = new GNEPoly(myNet, junction, "junction_shape:" + junction->getMicrosimID(), "junction shape", shape, false, RGBColor::GREEN, GLO_POLYGON); myCurrentPoly->setLineWidth(0.3); myNet->getVisualisationSpeedUp().addAdditionalGLObject(myCurrentPoly); @@ -1519,9 +1808,9 @@ long GNEViewNet::onCmdToogleShowConnection(FXObject*, FXSelector, void*) { - if (!myShowConnectionActivated) { + if (!myShowConnections) { getNet()->initGNEConnections(); - myShowConnectionActivated = true; + myShowConnections = true; } // Update viewnNet to show/hide conections update(); @@ -1532,9 +1821,33 @@ long +GNEViewNet::onCmdToogleSelectEdges(FXObject*, FXSelector, void*) { + if (myMenuCheckSelectEdges->getCheck()) { + mySelectEdges = true; + } else { + mySelectEdges = false; + } + return 1; +} + + +long GNEViewNet::onCmdToogleShowBubbles(FXObject*, FXSelector, void*) { - // Update Junction Shapes - getNet()->updateJunctionShapes(); + // Update view net Shapes + update(); + return 1; +} + + +long +GNEViewNet::onCmdShowGrid(FXObject*, FXSelector, void*) { + // show or hidde grid depending of myMenuCheckShowGrid + if (myMenuCheckShowGrid->getCheck()) { + myVisualizationSettings->showGrid = true; + } else { + myVisualizationSettings->showGrid = false; + } + update(); return 1; } @@ -1549,15 +1862,12 @@ abortOperation(false); if (mode == myEditMode) { setStatusBarText("Mode already selected"); + if (myCurrentFrame != NULL) { + myCurrentFrame->focusUpperElement(); + } } else { myPreviousEditMode = myEditMode; myEditMode = mode; - // First check if previous mode was MOVE - if (myPreviousEditMode == GNE_MODE_MOVE) { - // Update junctions again to calculate connections and disable bubbles - myNet->updateJunctionShapes(); - myShowJunctionAsBubble->setCheck(false); - } switch (mode) { case GNE_MODE_CONNECT: case GNE_MODE_TLS: @@ -1567,8 +1877,8 @@ default: break; } + updateModeSpecificControls(); } - updateModeSpecificControls(); } @@ -1583,132 +1893,173 @@ myEditModeNames.insert("(c) Connect", GNE_MODE_CONNECT); myEditModeNames.insert("(t) Traffic Lights", GNE_MODE_TLS); myEditModeNames.insert("(a) Additionals", GNE_MODE_ADDITIONAL); + myEditModeNames.insert("(r) Crossings", GNE_MODE_CROSSING); - // initialize combo for modes - myEditModesCombo = - new FXComboBox(myToolbar, 12, this, MID_GNE_MODE_CHANGE, - FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC | LAYOUT_CENTER_Y); - - std::vector names = myEditModeNames.getStrings(); - for (std::vector::const_iterator it = names.begin(); it != names.end(); it++) { - myEditModesCombo->appendItem(it->c_str()); - } - myEditModesCombo->setNumVisible((int)myEditModeNames.size()); + // initialize buttons for modes + myEditModeCreateEdge = new MFXCheckableButton(false, myToolbar, "\tset create edge mode\tMode for creating junction and edges.", + GUIIconSubSys::getIcon(ICON_MODECREATEEDGE), this, MID_GNE_MODE_CREATE_EDGE, GUIDesignButtonToolbarCheckable); + myEditModeMove = new MFXCheckableButton(false, myToolbar, "\tset move mode\tMode for move elements.", + GUIIconSubSys::getIcon(ICON_MODEMOVE), this, MID_GNE_MODE_MOVE, GUIDesignButtonToolbarCheckable); + myEditModeDelete = new MFXCheckableButton(false, myToolbar, "\tset delete mode\tMode for delete elements.", + GUIIconSubSys::getIcon(ICON_MODEDELETE), this, MID_GNE_MODE_DELETE, GUIDesignButtonToolbarCheckable); + myEditModeInspect = new MFXCheckableButton(false, myToolbar, "\tset inspect mode\tMode for inspect elements and change their attributes.", + GUIIconSubSys::getIcon(ICON_MODEINSPECT), this, MID_GNE_MODE_INSPECT, GUIDesignButtonToolbarCheckable); + myEditModeSelect = new MFXCheckableButton(false, myToolbar, "\tset select mode\tMode for select elements.", + GUIIconSubSys::getIcon(ICON_MODESELECT), this, MID_GNE_MODE_SELECT, GUIDesignButtonToolbarCheckable); + myEditModeConnection = new MFXCheckableButton(false, myToolbar, "\tset connection mode\tMode for edit connections between lanes.", + GUIIconSubSys::getIcon(ICON_MODECONNECTION), this, MID_GNE_MODE_CONNECT, GUIDesignButtonToolbarCheckable); + myEditModeTrafficLight = new MFXCheckableButton(false, myToolbar, "\tset traffic light mode\tMode for edit traffic lights over junctions.", + GUIIconSubSys::getIcon(ICON_MODETLS), this, MID_GNE_MODE_TLS, GUIDesignButtonToolbarCheckable); + myEditModeAdditional = new MFXCheckableButton(false, myToolbar, "\tset additional mode\tMode for adding additional elements.", + GUIIconSubSys::getIcon(ICON_MODEADDITIONAL), this, MID_GNE_MODE_ADDITIONAL, GUIDesignButtonToolbarCheckable); + myEditModeCrossing = new MFXCheckableButton(false, myToolbar, "\tset crossing mode\tMode for creating crossings between edges.", + GUIIconSubSys::getIcon(ICON_MODECROSSING), this, MID_GNE_MODE_CROSSING, GUIDesignButtonToolbarCheckable); + + // @ToDo add here new FXToolBarGrip(myNavigationToolBar, NULL, 0, GUIDesignToolbarGrip); // initialize mode specific controls - myChainCreateEdge = new FXMenuCheck(myToolbar, "chain\t\tCreate consecutive edges with a single click (hit ESC to cancel chain).", this, 0); - myAutoCreateOppositeEdge = new FXMenuCheck(myToolbar, - "two-way\t\tAutomatically create an edge in the opposite direction", this, 0); - mySelectEdges = new FXMenuCheck(myToolbar, "select edges\t\tToggle whether clicking should select edges or lanes", this, 0); - mySelectEdges->setCheck(); + myChainCreateEdge = new FXMenuCheck(myToolbar, ("chain\t\tCreate consecutive " + toString(SUMO_TAG_EDGE) + "s with a single click (hit ESC to cancel chain).").c_str(), this, 0); + myChainCreateEdge->setCheck(false); + + myAutoCreateOppositeEdge = new FXMenuCheck(myToolbar, ("two-way\t\tAutomatically create an " + toString(SUMO_TAG_EDGE) + " in the opposite direction").c_str(), this, 0); + myAutoCreateOppositeEdge->setCheck(false); + + myMenuCheckSelectEdges = new FXMenuCheck(myToolbar, ("select edges\t\tToggle whether clicking should select " + toString(SUMO_TAG_EDGE) + "s or " + toString(SUMO_TAG_LANE) + "s").c_str(), this, MID_GNE_SELECT_EDGES); + myMenuCheckSelectEdges->setCheck(true); - myShowConnections = new FXMenuCheck(myToolbar, "show connections\t\tToggle show connections over junctions", this, MID_GNE_SHOW_CONNECTIONS); - myShowConnections->setCheck(false); + myMenuCheckShowConnections = new FXMenuCheck(myToolbar, ("show " + toString(SUMO_TAG_CONNECTION) + "s\t\tToggle show " + toString(SUMO_TAG_CONNECTION) + "s over " + toString(SUMO_TAG_JUNCTION) + "s").c_str(), this, MID_GNE_SHOW_CONNECTIONS); + myMenuCheckShowConnections->setCheck(false); - myExtendToEdgeNodes = new FXMenuCheck(myToolbar, "auto-select nodes\t\tToggle whether selecting multiple edges should automatically select their nodes", this, 0); + myMenuCheckExtendToEdgeNodes = new FXMenuCheck(myToolbar, ("auto-select " + toString(SUMO_TAG_JUNCTION) + "s\t\tToggle whether selecting multiple " + toString(SUMO_TAG_EDGE) + "s should automatically select their " + toString(SUMO_TAG_JUNCTION) + "s").c_str(), this, 0); - myWarnAboutMerge = new FXMenuCheck(myToolbar, "ask for merge\t\tAsk for confirmation before merging junctions.", this, 0); - myWarnAboutMerge->setCheck(true); + myMenuCheckWarnAboutMerge = new FXMenuCheck(myToolbar, ("ask for merge\t\tAsk for confirmation before merging " + toString(SUMO_TAG_JUNCTION) + ".").c_str(), this, 0); + myMenuCheckWarnAboutMerge->setCheck(true); - myShowJunctionAsBubble = new FXMenuCheck(myToolbar, "Show junction as bubbles\t\tShow juntion's shape as a bubble.", this, MID_GNE_SHOW_BUBBLES); - myShowJunctionAsBubble->setCheck(false); + myMenuCheckShowBubbleOverJunction = new FXMenuCheck(myToolbar, ("Show bubbles over " + toString(SUMO_TAG_JUNCTION) + "s \t\tShow bubbles over " + toString(SUMO_TAG_JUNCTION) + "'s shapes.").c_str(), this, MID_GNE_SHOW_BUBBLES); + myMenuCheckShowBubbleOverJunction->setCheck(false); - myChangeAllPhases = new FXMenuCheck(myToolbar, "apply change to all phases\t\tToggle whether clicking should apply state changes to all phases of the current traffic light plan", this, 0); - myChangeAllPhases->setCheck(false); + myMenuCheckChangeAllPhases = new FXMenuCheck(myToolbar, ("apply change to all phases\t\tToggle whether clicking should apply state changes to all phases of the current " + toString(SUMO_TAG_TRAFFIC_LIGHT) + " plan").c_str(), this, 0); + myMenuCheckChangeAllPhases->setCheck(false); + + myMenuCheckShowGrid = new FXMenuCheck(myToolbar, "show grid\t\tshow grid with size defined in visualization options", this, MID_GNE_SHOW_GRID); + myMenuCheckShowGrid->setCheck(false); } void GNEViewNet::updateModeSpecificControls() { - // MAGIC modifier to avoid flicker. at least it is consistent for move AND - // zoom. Probably has to do with spacing - const int addChange = 4; - - // hide all controls + // hide grid + myMenuCheckShowGrid->setCheck(myVisualizationSettings->showGrid); + // hide all controls (checkboxs) myChainCreateEdge->hide(); myAutoCreateOppositeEdge->hide(); - mySelectEdges->hide(); - myShowConnections->hide(); - myExtendToEdgeNodes->hide(); - myChangeAllPhases->hide(); - myWarnAboutMerge->hide(); - myShowJunctionAsBubble->hide(); - int widthChange = 0; - // Close all Frames - if (myViewParent->getInspectorFrame()->shown()) { - widthChange += myViewParent->getInspectorFrame()->getWidth() + addChange; - myViewParent->getInspectorFrame()->hide(); - } - if (myViewParent->getSelectorFrame()->shown()) { - widthChange += myViewParent->getSelectorFrame()->getWidth() + addChange; - myViewParent->getSelectorFrame()->hide(); - } - if (myViewParent->getConnectorFrame()->shown()) { - widthChange += myViewParent->getConnectorFrame()->getWidth() + addChange; - myViewParent->getConnectorFrame()->hide(); - } - if (myViewParent->getTLSEditorFrame()->shown()) { - widthChange += myViewParent->getTLSEditorFrame()->getWidth() + addChange; - myViewParent->getTLSEditorFrame()->hide(); - } - if (myViewParent->getAdditionalFrame()->shown()) { - widthChange += myViewParent->getAdditionalFrame()->getWidth() + addChange; - myViewParent->getAdditionalFrame()->hide(); - } + myMenuCheckSelectEdges->hide(); + myMenuCheckShowConnections->hide(); + myMenuCheckExtendToEdgeNodes->hide(); + myMenuCheckChangeAllPhases->hide(); + myMenuCheckWarnAboutMerge->hide(); + myMenuCheckShowBubbleOverJunction->hide(); + myMenuCheckShowGrid->hide(); + // unckeck all edit modes + myEditModeCreateEdge->setChecked(false); + myEditModeMove->setChecked(false); + myEditModeDelete->setChecked(false); + myEditModeInspect->setChecked(false); + myEditModeSelect->setChecked(false); + myEditModeConnection->setChecked(false); + myEditModeTrafficLight->setChecked(false); + myEditModeAdditional->setChecked(false); + myEditModeCrossing->setChecked(false); + myViewParent->hideAllFrames(); // enable selected controls switch (myEditMode) { case GNE_MODE_CREATE_EDGE: myChainCreateEdge->show(); myAutoCreateOppositeEdge->show(); + myEditModeCreateEdge->setChecked(true); + myMenuCheckShowGrid->show(); + break; + case GNE_MODE_MOVE: + myMenuCheckWarnAboutMerge->show(); + myMenuCheckShowBubbleOverJunction->show(); + myEditModeMove->setChecked(true); + myMenuCheckShowGrid->show(); break; case GNE_MODE_DELETE: - mySelectEdges->show(); - myShowConnections->show(); + myViewParent->getDeleteFrame()->show(); + myViewParent->getDeleteFrame()->focusUpperElement(); + myCurrentFrame = myViewParent->getDeleteFrame(); + myMenuCheckShowConnections->show(); + myMenuCheckSelectEdges->show(); + myEditModeDelete->setChecked(true); break; case GNE_MODE_INSPECT: - widthChange -= myViewParent->getInspectorFrame()->getWidth() + addChange; myViewParent->getInspectorFrame()->show(); - mySelectEdges->show(); - myShowConnections->show(); + myViewParent->getInspectorFrame()->focusUpperElement(); + myCurrentFrame = myViewParent->getInspectorFrame(); + myMenuCheckSelectEdges->show(); + myMenuCheckShowConnections->show(); + myEditModeInspect->setChecked(true); break; case GNE_MODE_SELECT: - widthChange -= myViewParent->getSelectorFrame()->getWidth() + addChange; myViewParent->getSelectorFrame()->show(); - mySelectEdges->show(); - myShowConnections->show(); - myExtendToEdgeNodes->show(); - break; - case GNE_MODE_MOVE: - myWarnAboutMerge->show(); - myShowJunctionAsBubble->show(); + myViewParent->getSelectorFrame()->focusUpperElement(); + myCurrentFrame = myViewParent->getSelectorFrame(); + myMenuCheckSelectEdges->show(); + myMenuCheckShowConnections->show(); + myMenuCheckExtendToEdgeNodes->show(); + myEditModeSelect->setChecked(true); break; case GNE_MODE_CONNECT: - widthChange -= myViewParent->getConnectorFrame()->getWidth() + addChange; myViewParent->getConnectorFrame()->show(); + myViewParent->getConnectorFrame()->focusUpperElement(); + myCurrentFrame = myViewParent->getConnectorFrame(); + myEditModeConnection->setChecked(true); break; case GNE_MODE_TLS: - widthChange -= myViewParent->getTLSEditorFrame()->getWidth() + addChange; myViewParent->getTLSEditorFrame()->show(); - myChangeAllPhases->show(); + myViewParent->getTLSEditorFrame()->focusUpperElement(); + myCurrentFrame = myViewParent->getTLSEditorFrame(); + myMenuCheckChangeAllPhases->show(); + myEditModeTrafficLight->setChecked(true); break; case GNE_MODE_ADDITIONAL: - widthChange -= myViewParent->getAdditionalFrame()->getWidth() + addChange; myViewParent->getAdditionalFrame()->show(); + myViewParent->getAdditionalFrame()->focusUpperElement(); + myCurrentFrame = myViewParent->getAdditionalFrame(); + myEditModeAdditional->setChecked(true); + myMenuCheckShowGrid->show(); + break; + case GNE_MODE_CROSSING: + myViewParent->getCrossingFrame()->show(); + myViewParent->getCrossingFrame()->focusUpperElement(); + myCurrentFrame = myViewParent->getCrossingFrame(); + myEditModeCrossing->setChecked(true); + myMenuCheckShowGrid->setCheck(false); break; default: break; } - myChanger->changeCanvassLeft(widthChange); + // Update buttons + myEditModeCreateEdge->update(); + myEditModeMove->update(); + myEditModeDelete->update(); + myEditModeInspect->update(); + myEditModeSelect->update(); + myEditModeConnection->update(); + myEditModeTrafficLight->update(); + myEditModeAdditional->update(); + myEditModeCrossing->update(); + // force repaint because different modes draw different things myToolbar->recalc(); - recalc(); - onPaint(0, 0, 0); // force repaint because different modes draw different things + onPaint(0, 0, 0); update(); } void GNEViewNet::deleteSelectedJunctions() { - myUndoList->p_begin("delete selected junctions"); + myUndoList->p_begin("delete selected " + toString(SUMO_TAG_JUNCTION) + "s"); std::vector junctions = myNet->retrieveJunctions(true); for (std::vector::iterator it = junctions.begin(); it != junctions.end(); it++) { myNet->deleteJunction(*it, myUndoList); @@ -1719,14 +2070,14 @@ void GNEViewNet::deleteSelectedEdges() { - if (mySelectEdges->getCheck()) { - myUndoList->p_begin("delete selected edges"); + if (mySelectEdges == true) { + myUndoList->p_begin("delete selected " + toString(SUMO_TAG_EDGE) + "s"); std::vector edges = myNet->retrieveEdges(true); for (std::vector::iterator it = edges.begin(); it != edges.end(); it++) { myNet->deleteEdge(*it, myUndoList); } } else { - myUndoList->p_begin("delete selected lanes"); + myUndoList->p_begin("delete selected " + toString(SUMO_TAG_LANE) + "s"); std::vector lanes = myNet->retrieveLanes(true); for (std::vector::iterator it = lanes.begin(); it != lanes.end(); it++) { myNet->deleteLane(*it, myUndoList); @@ -1736,6 +2087,17 @@ } +void +GNEViewNet::deleteSelectedAdditionals() { + myUndoList->p_begin("delete selected " + toString(SUMO_TAG_VIEWSETTINGS_ADDITIONALS)); + std::vector additionals = myNet->retrieveAdditionals(true); + for (std::vector::iterator it = additionals.begin(); it != additionals.end(); it++) { + getViewParent()->getAdditionalFrame()->removeAdditional(*it); + } + myUndoList->p_end(); +} + + bool GNEViewNet::mergeJunctions(GNEJunction* moved) { const Position& newPos = moved->getNBNode()->getPosition(); @@ -1764,7 +2126,11 @@ } if (mergeTarget) { // optionally ask for confirmation - if (myWarnAboutMerge->getCheck()) { + if (myMenuCheckWarnAboutMerge->getCheck()) { + if (myTestingMode == true) { + WRITE_WARNING("Opening FXMessageBox of type 'question'"); + } + // open question box FXuint answer = FXMessageBox::question(this, MBOX_YES_NO, "Confirm Junction Merger", "%s", ("Do you wish to merge junctions '" + moved->getMicrosimID() + @@ -1773,7 +2139,18 @@ "' will be eliminated and its roads added to '" + mergeTarget->getMicrosimID() + "')").c_str()); if (answer != 1) { //1:yes, 2:no, 4:esc + // write warning if netedit is running in testing mode + if ((answer == 2) && (myTestingMode == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'No'"); + } else if ((answer == 4) && (myTestingMode == true)) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'ESC'"); + } return false; + } else { + // write warning if netedit is running in testing mode + if (myTestingMode == true) { + WRITE_WARNING("Closed FXMessageBox of type 'question' with 'Yes'"); + } } } myNet->mergeJunctions(moved, mergeTarget, myUndoList); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEViewNet.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEViewNet.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEViewNet.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEViewNet.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GNEViewNet.h /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNEViewNet.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GNEViewNet.h 24109 2017-04-27 20:27:11Z behrisch $ /// // A view on the network being edited (adapted from GUIViewTraffic) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,6 +39,7 @@ #include #include #include +#include // =========================================================================== // enum @@ -61,7 +62,9 @@ ///@brief mode for editing tls GNE_MODE_TLS, ///@brief Mode for editing additionals - GNE_MODE_ADDITIONAL + GNE_MODE_ADDITIONAL, + ///@brief Mode for editing crossing + GNE_MODE_CROSSING }; // =========================================================================== @@ -75,6 +78,8 @@ class GNEUndoList; class GNEAdditional; class GNEPoly; +class GNEPOI; +class GNEFrame; // =========================================================================== // class definitions @@ -112,8 +117,9 @@ /// @brief set color schieme bool setColorScheme(const std::string& name); - /// @brief overloaded handlers + /// @name overloaded handlers /// @{ + /// @brief called when user press mouse's left button long onLeftBtnPress(FXObject*, FXSelector, void*); @@ -127,8 +133,37 @@ long onMouseMove(FXObject*, FXSelector, void*); /// @} - /// @brief sets edit mode via combo box - long onCmdChangeMode(FXObject*, FXSelector, void*); + /// @name set mode call backs + /// @{ + + /// @brief called when user press the button for create edge mode + long onCmdSetModeCreateEdge(FXObject*, FXSelector, void*); + + /// @brief called when user press the button for move mode + long onCmdSetModeMove(FXObject*, FXSelector, void*); + + /// @brief called when user press the button for delete mode + long onCmdSetModeDelete(FXObject*, FXSelector, void*); + + /// @brief called when user press the button for inspect mode + long onCmdSetModeInspect(FXObject*, FXSelector, void*); + + /// @brief called when user press the button for select mode + long onCmdSetModeSelect(FXObject*, FXSelector, void*); + + /// @brief called when user press the button for connect mode + long onCmdSetModeConnect(FXObject*, FXSelector, void*); + + /// @brief called when user press the button for traffic lights mode + long onCmdSetModeTLS(FXObject*, FXSelector, void*); + + /// @brief called when user press the button for additional mode + long onCmdSetModeAdditional(FXObject*, FXSelector, void*); + + /// @brief called when user press the button for crossing mode + long onCmdSetModeCrossing(FXObject*, FXSelector, void*); + + /// @} /// @brief split edge at cursor position long onCmdSplitEdge(FXObject*, FXSelector, void*); @@ -199,11 +234,18 @@ /// @brief toogle show connections long onCmdToogleShowConnection(FXObject*, FXSelector, void*); + /// @brief toogle selet edges + long onCmdToogleSelectEdges(FXObject*, FXSelector, void*); + /// @brief toogle show bubbles long onCmdToogleShowBubbles(FXObject*, FXSelector, void*); - /// @brief sets edit mode (from hotkey) - /// @param[in] selid An id MID_GNE_MODE_ as defined in GUIAppEnum + /// @brief toogle show grid + long onCmdShowGrid(FXObject*, FXSelector, void*); + + /**@brief sets edit mode (from hotkey) + * @param[in] selid An id MID_GNE_MODE_ as defined in GUIAppEnum + **/ void setEditModeFromHotkey(FXushort selid); /// @brief abort current edition operation @@ -215,6 +257,9 @@ /// @brief handle enter keypress void hotkeyEnter(); + /// @brief handle focus frame keypress + void hotkeyFocusFrame(); + /// @brief store the position where a popup-menu was requested void markPopupPosition(); @@ -246,7 +291,7 @@ bool autoSelectNodes(); /// @brief set selection scaling - void setSelectionScaling(SUMOReal selectionScale); + void setSelectionScaling(double selectionScale); /// @brief update control contents after undo/redo or recompute void updateControls(); @@ -257,6 +302,9 @@ /// @brief return true if junction must be showed as bubbles bool showJunctionAsBubbles() const; + /// @brief check if netedit is running in testing mode + bool isTestingModeEnabled() const; + protected: /// @brief FOX needs this GNEViewNet() {} @@ -280,20 +328,29 @@ /// @brief the previous edit mode used for toggling EditMode myPreviousEditMode; + /// @brief the current frame + GNEFrame* myCurrentFrame; + /// @brief menu check to select only edges - FXMenuCheck* mySelectEdges; + FXMenuCheck* myMenuCheckSelectEdges; /// @brief menu check to show connections - FXMenuCheck* myShowConnections; - - /// @brief whether show connections has been activated once - bool myShowConnectionActivated; + FXMenuCheck* myMenuCheckShowConnections; /// @brief menu check to extend to edge nodes - FXMenuCheck* myExtendToEdgeNodes; + FXMenuCheck* myMenuCheckExtendToEdgeNodes; /// @brief menu check to set change all phases - FXMenuCheck* myChangeAllPhases; + FXMenuCheck* myMenuCheckChangeAllPhases; + + /// @brief show grid button + FXMenuCheck* myMenuCheckShowGrid; + + /// @brief whether show connections has been activated once + bool myShowConnections; + + /// @brief flag to check if select edges is enabled + bool mySelectEdges; /// @name the state-variables of the create-edge state-machine // @{ @@ -307,6 +364,13 @@ /// @name the state-variables of the move state-machine // @{ + + /// @brief whether we should warn about merging junctions + FXMenuCheck* myMenuCheckWarnAboutMerge; + + /// @brief show connection as buuble in "Move" mode. + FXMenuCheck* myMenuCheckShowBubbleOverJunction; + /// @brief the Junction to be moved. GNEJunction* myJunctionToMove; @@ -316,6 +380,9 @@ /// @brief the poly of which geometry is being moved GNEPoly* myPolyToMove; + /// @brief the poi which is being moved + GNEPOI* myPoiToMove; + /// @brief the stoppingPlace element which shape is being moved GNEAdditional* myAdditionalToMove; @@ -330,12 +397,6 @@ /// @brief whether a selection is being moved bool myMoveSelection; - - /// @brief whether we should warn about merging junctions - FXMenuCheck* myWarnAboutMerge; - - /// @brief show connection as buuble in "Move" mode. - FXMenuCheck* myShowJunctionAsBubble; // @} /// @name state-variables of inspect-mode and select-mode @@ -350,16 +411,45 @@ Position mySelCorner2; // @} - /// @name toolbar related stuff - /// @{ /// @brief a reference to the toolbar in myParent FXToolBar* myToolbar; - /// @brief combo box for selecting the edit mode - FXComboBox* myEditModesCombo; + /// @name buttons for selecting the edit mode + /// @{ + /// @brief chekable button for edit mode create edge + MFXCheckableButton* myEditModeCreateEdge; + + /// @brief chekable button for edit mode move + MFXCheckableButton* myEditModeMove; + + /// @brief chekable button for edit mode delete + MFXCheckableButton* myEditModeDelete; + + /// @brief chekable button for edit mode inspect + MFXCheckableButton* myEditModeInspect; + + /// @brief chekable button for edit mode select + MFXCheckableButton* myEditModeSelect; + + /// @brief chekable button for edit mode connection + MFXCheckableButton* myEditModeConnection; + + /// @brief chekable button for edit mode traffic light + MFXCheckableButton* myEditModeTrafficLight; + + /// @brief chekable button for edit mode additional + MFXCheckableButton* myEditModeAdditional; + + /// @brief chekable button for edit mode crossing + MFXCheckableButton* myEditModeCrossing; + /// @} /// @brief since we cannot switch on strings we map the mode names to an enum + /// @{ + /// @brief stringBijection for edit mode names StringBijection myEditModeNames; + + /// @brief stringBijection for edit additional mode names StringBijection myEditAdditionalModeNames; /// @} @@ -372,7 +462,18 @@ /// @brief current polygon GNEPoly* myCurrentPoly; -private: + /// @name variables for testing mode + /// @{ + /// @brief flag to enable or disable testing mode + bool myTestingMode; + + /// @brief Width of viewNet in testing mode + int myTestingWidth; + + /// @brief Height of viewNet in testing mode + int myTestingHeight; + /// @} + /// @brief set edit mode void setEditMode(EditMode mode); @@ -388,6 +489,9 @@ /// @brief delete all currently selected edges void deleteSelectedEdges(); + /// @brief delete all currently selected additionals + void deleteSelectedAdditionals(); + /// @brief try to merge moved junction with another junction in that spot return true if merging did take place bool mergeJunctions(GNEJunction* moved); @@ -415,6 +519,9 @@ /// @brief remove restricted lane bool removeRestrictedLane(SUMOVehicleClass vclass); + /// @brief Auxiliar function used by onLeftBtnPress(...) + void processClick(FXEvent* e, void* data); + /// @brief Invalidated copy constructor. GNEViewNet(const GNEViewNet&); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEViewParent.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEViewParent.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEViewParent.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEViewParent.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,7 +2,7 @@ /// @file GNEViewParent.cpp /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNEViewParent.cpp 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: GNEViewParent.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A single child window which contains a view of the edited network (adapted // from GUISUMOViewParent) @@ -10,7 +10,7 @@ // structures than to write everything from scratch. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,10 +44,12 @@ #include #include #include +#include #include #include #include #include +#include #include "GNENet.h" #include "GNEEdge.h" @@ -60,22 +62,22 @@ #include "GNEConnectorFrame.h" #include "GNETLSEditorFrame.h" #include "GNEAdditionalFrame.h" +#include "GNECrossingFrame.h" +#include "GNEDeleteFrame.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS // =========================================================================== // FOX callback mapping // =========================================================================== FXDEFMAP(GNEViewParent) GNEViewParentMap[] = { - FXMAPFUNC(SEL_COMMAND, MID_MAKESNAPSHOT, GNEViewParent::onCmdMakeSnapshot), - //FXMAPFUNC(SEL_COMMAND, MID_ALLOWROTATION, GNEViewParent::onCmdAllowRotation), - FXMAPFUNC(SEL_COMMAND, MID_LOCATEJUNCTION, GNEViewParent::onCmdLocate), - FXMAPFUNC(SEL_COMMAND, MID_LOCATEEDGE, GNEViewParent::onCmdLocate), - FXMAPFUNC(SEL_COMMAND, MID_LOCATETLS, GNEViewParent::onCmdLocate), - FXMAPFUNC(SEL_COMMAND, FXMDIChild::ID_MDI_MENUCLOSE, GNEViewParent::onCmdClose), + FXMAPFUNC(SEL_COMMAND, MID_MAKESNAPSHOT, GNEViewParent::onCmdMakeSnapshot), + //FXMAPFUNC(SEL_COMMAND, MID_ALLOWROTATION, GNEViewParent::onCmdAllowRotation), + FXMAPFUNC(SEL_COMMAND, MID_LOCATEJUNCTION, GNEViewParent::onCmdLocate), + FXMAPFUNC(SEL_COMMAND, MID_LOCATEEDGE, GNEViewParent::onCmdLocate), + FXMAPFUNC(SEL_COMMAND, MID_LOCATETLS, GNEViewParent::onCmdLocate), + FXMAPFUNC(SEL_COMMAND, FXMDIChild::ID_MDI_MENUCLOSE, GNEViewParent::onCmdClose), + FXMAPFUNC(SEL_CHANGED, MID_GNE_SIZEOF_FRAMEAREAWIDTH_UPDATED, GNEViewParent::onCmdUpdateFrameAreaWidth), }; // Object implementation @@ -101,29 +103,23 @@ //} // add undo/redo buttons - new FXButton(myNavigationToolBar, - "\tUndo\tUndo the last Change.", - GUIIconSubSys::getIcon(ICON_UNDO), parentWindow->getUndoList(), FXUndoList::ID_UNDO, - ICON_BEFORE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); - new FXButton(myNavigationToolBar, - "\tRedo\tRedo the last Change.", - GUIIconSubSys::getIcon(ICON_REDO), parentWindow->getUndoList(), FXUndoList::ID_REDO, - ICON_BEFORE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); + new FXButton(myNavigationToolBar, "\tUndo\tUndo the last Change.", GUIIconSubSys::getIcon(ICON_UNDO), parentWindow->getUndoList(), FXUndoList::ID_UNDO, GUIDesignButtonToolbar); + new FXButton(myNavigationToolBar, "\tRedo\tRedo the last Change.", GUIIconSubSys::getIcon(ICON_REDO), parentWindow->getUndoList(), FXUndoList::ID_REDO, GUIDesignButtonToolbar); - // Create FXToolBarGrip - new FXToolBarGrip(myNavigationToolBar, NULL, 0, TOOLBARGRIP_SINGLE | FRAME_SUNKEN); + // Create Vertical separator + new FXVerticalSeparator(myNavigationToolBar, GUIDesignVerticalSeparator); // Create Frame Splitter - myFramesSplitter = new FXSplitter(myContentFrame, SPLITTER_HORIZONTAL | LAYOUT_FILL_X | LAYOUT_FILL_Y | SPLITTER_TRACKING | FRAME_RAISED | FRAME_THICK); + myFramesSplitter = new FXSplitter(myContentFrame, this, MID_GNE_SIZEOF_FRAMEAREAWIDTH_UPDATED, GUIDesignSplitter | SPLITTER_HORIZONTAL); // Create frames Area - myFramesArea = new FXHorizontalFrame(myFramesSplitter, FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0); + myFramesArea = new FXHorizontalFrame(myFramesSplitter, GUIDesignFrameArea); - // Set default width - myFramesArea->setWidth(200); + // Set default width of frames area + myFramesArea->setWidth(220); // Create view area - myViewArea = new FXHorizontalFrame(myFramesSplitter, FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0); + myViewArea = new FXHorizontalFrame(myFramesSplitter, GUIDesignViewnArea); // Add the view to a temporary parent so that we can add items to myViewArea in the desired order FXComposite* tmp = new FXComposite(this); @@ -134,13 +130,20 @@ // Set pointer myView with the created view net myView = viewNet; - // creating order is important - myInspectorFrame = new GNEInspectorFrame(myFramesArea, viewNet); - mySelectorFrame = new GNESelectorFrame(myFramesArea, viewNet); - myConnectorFrame = new GNEConnectorFrame(myFramesArea, viewNet); - myTLSEditorFrame = new GNETLSEditorFrame(myFramesArea, viewNet); - myAdditionalFrame = new GNEAdditionalFrame(myFramesArea, viewNet); - myAdditionalFrame->hide(); + // Create frames + myGNEFrames[MID_GNE_MODE_INSPECT] = new GNEInspectorFrame(myFramesArea, viewNet); + myGNEFrames[MID_GNE_MODE_SELECT] = new GNESelectorFrame(myFramesArea, viewNet); + myGNEFrames[MID_GNE_MODE_CONNECT] = new GNEConnectorFrame(myFramesArea, viewNet); + myGNEFrames[MID_GNE_MODE_TLS] = new GNETLSEditorFrame(myFramesArea, viewNet); + myGNEFrames[MID_GNE_MODE_ADDITIONAL] = new GNEAdditionalFrame(myFramesArea, viewNet); + myGNEFrames[MID_GNE_MODE_CROSSING] = new GNECrossingFrame(myFramesArea, viewNet); + myGNEFrames[MID_GNE_MODE_DELETE] = new GNEDeleteFrame(myFramesArea, viewNet); + + // Update frame areas after creation + onCmdUpdateFrameAreaWidth(0, 0, 0); + + // Hidde all Frames Area + hideFramesArea(); // Buld view toolBars myView->buildViewToolBars(*this); @@ -156,67 +159,94 @@ } +void +GNEViewParent::hideAllFrames() { + for (std::map::iterator i = myGNEFrames.begin(); i != myGNEFrames.end(); i++) { + i->second->hide(); + } +} GNEInspectorFrame* GNEViewParent::getInspectorFrame() const { - return myInspectorFrame; + return dynamic_cast(myGNEFrames.at(MID_GNE_MODE_INSPECT)); } GNESelectorFrame* GNEViewParent::getSelectorFrame() const { - return mySelectorFrame; + return dynamic_cast(myGNEFrames.at(MID_GNE_MODE_SELECT)); } GNEConnectorFrame* GNEViewParent::getConnectorFrame() const { - return myConnectorFrame; + return dynamic_cast(myGNEFrames.at(MID_GNE_MODE_CONNECT)); } GNETLSEditorFrame* GNEViewParent::getTLSEditorFrame() const { - return myTLSEditorFrame; + return dynamic_cast(myGNEFrames.at(MID_GNE_MODE_TLS)); } GNEAdditionalFrame* GNEViewParent::getAdditionalFrame() const { - return myAdditionalFrame; + return dynamic_cast(myGNEFrames.at(MID_GNE_MODE_ADDITIONAL)); +} + + +GNECrossingFrame* +GNEViewParent::getCrossingFrame() const { + return dynamic_cast(myGNEFrames.at(MID_GNE_MODE_CROSSING)); +} + + +GNEDeleteFrame* +GNEViewParent::getDeleteFrame() const { + return dynamic_cast(myGNEFrames.at(MID_GNE_MODE_DELETE)); } void GNEViewParent::showFramesArea() { - if (myInspectorFrame->shown() == true || - mySelectorFrame->shown() == true || - myConnectorFrame->shown() == true || - myTLSEditorFrame->shown() == true || - myAdditionalFrame->shown() == true) { - myFramesArea->show(); + bool showFlag = false; + // Iterate over GNEFrames + for (std::map::iterator i = myGNEFrames.begin(); i != myGNEFrames.end(); i++) { + // if at least one frame is shown, change showFlag + if (i->second->shown() == true) { + showFlag = true; + } + } + // show and recalc framesArea if showFlag is enabled + if (showFlag) { myFramesArea->recalc(); + myFramesArea->show(); } } void GNEViewParent::hideFramesArea() { - if (myInspectorFrame->shown() == false && - mySelectorFrame->shown() == false && - myConnectorFrame->shown() == false && - myTLSEditorFrame->shown() == false && - myAdditionalFrame->shown() == false) { + bool hideFlag = true; + // Iterate over frames + for (std::map::iterator i = myGNEFrames.begin(); i != myGNEFrames.end(); i++) { + // if at least one frame is shown, change hideflag + if (i->second->shown() == true) { + hideFlag = false; + } + } + // hide and recalc frames Area if hideFlag is enabled + if (hideFlag) { myFramesArea->hide(); myFramesArea->recalc(); } } -int -GNEViewParent::getFramesAreaWidth() { - std::cout << myFramesArea->getWidth() << std::endl; - return myFramesArea->getWidth(); +GUIMainWindow* +GNEViewParent::getApp() const { + return myParent; } @@ -243,7 +273,16 @@ std::string file = opendialog.getFilename().text(); std::string error = myView->makeSnapshot(file); if (error != "") { + // write warning if netedit is running in testing mode + if (OptionsCont::getOptions().getBool("gui-testing") == true) { + WRITE_WARNING("Opening FXMessageBox of type 'error'"); + } + // open message box FXMessageBox::error(this, MBOX_OK, "Saving failed.", "%s", error.c_str()); + // write warning if netedit is running in testing mode + if (OptionsCont::getOptions().getBool("gui-testing") == true) { + WRITE_WARNING("Closed FXMessageBox of type 'error' with 'OK'"); + } } return 1; } @@ -329,5 +368,15 @@ return 0; } + +long +GNEViewParent::onCmdUpdateFrameAreaWidth(FXObject*, FXSelector, void*) { + for (std::map::iterator i = myGNEFrames.begin(); i != myGNEFrames.end(); i++) { + // update size of all GNEFrame + i->second->setFrameWidth(myFramesArea->getWidth()); + } + return 0; +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEViewParent.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEViewParent.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/GNEViewParent.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/GNEViewParent.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,7 +2,7 @@ /// @file GNEViewParent.h /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: GNEViewParent.h 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: GNEViewParent.h 22929 2017-02-13 14:38:39Z behrisch $ /// // A single child window which contains a view of the edited network (adapted // from GUISUMOViewParent) @@ -10,7 +10,7 @@ // structures than to write everything from scratch. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,11 +47,14 @@ class GUISUMOAbstractView; class GNENet; class GNEApplicationWindow; +class GNEFrame; class GNEInspectorFrame; class GNESelectorFrame; class GNEConnectorFrame; class GNETLSEditorFrame; class GNEAdditionalFrame; +class GNECrossingFrame; +class GNEDeleteFrame; // =========================================================================== // class declarations @@ -95,6 +98,9 @@ /// @brief Destructor ~GNEViewParent(); + /// @brief hide all frames + void hideAllFrames(); + /// @brief get frame for GNE_MODE_INSPECT GNEInspectorFrame* getInspectorFrame() const; @@ -110,6 +116,12 @@ /// @brief get frame for GNE_MODE_ADDITIONAL GNEAdditionalFrame* getAdditionalFrame() const; + /// @brief get frame for GNE_MODE_CROSSING + GNECrossingFrame* getCrossingFrame() const; + + /// @brief get frame for GNE_MODE_DELETE + GNEDeleteFrame* getDeleteFrame() const; + /// @brief show frames area if at least a GNEFrame is showed /// @note this function is called in GNEFrame::Show(); void showFramesArea(); @@ -118,8 +130,8 @@ /// @note this function is called in GNEFrame::Show(); void hideFramesArea(); - /// @brief get width of the Frames Area - int getFramesAreaWidth(); + /// @brief get App (GUIMainWindow) + GUIMainWindow* getApp() const; /// @name FOX-callbacks /// @{ @@ -137,6 +149,9 @@ /// @brief Called when user releases a key long onKeyRelease(FXObject* o, FXSelector sel, void* data); + + /// @brief Called when user change the splitter between FrameArea and ViewNet + long onCmdUpdateFrameAreaWidth(FXObject*, FXSelector, void*); /// @} /// @brief true if the object is selected (may include extra logic besides calling gSelected) @@ -156,20 +171,8 @@ /// @brief Splitter to divide ViewNet und GNEFrames FXSplitter* myFramesSplitter; - /// @brief the panel for GNE_MODE_INSPECT - GNEInspectorFrame* myInspectorFrame; - - /// @brief the panel for GNE_MODE_SELECT - GNESelectorFrame* mySelectorFrame; - - /// @brief the panel for GNE_MODE_CONNECT - GNEConnectorFrame* myConnectorFrame; - - /// @brief the panel for GNE_MODE_TLS - GNETLSEditorFrame* myTLSEditorFrame; - - /// @brief the panel for GNE_MODE_ADDITIONAL - GNEAdditionalFrame* myAdditionalFrame; + /// @brief map with the Frames + std::map myGNEFrames; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/Makefile.am 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/Makefile.am 2017-07-23 16:22:07.000000000 +0000 @@ -6,10 +6,6 @@ GUI_APPS = netedit endif -if CHECK_MEMORY_LEAKS -MEM_LIBS = ../foreign/nvwa/libnvwa.a -endif - if TRACI TRACI_LIBS = ../traci-server/libtraciserver.a endif @@ -35,16 +31,21 @@ GNEViewParent.h GNEViewParent.cpp \ GNEDialog_About.h GNEDialog_About.cpp \ GNEDialog_Wizard.h GNEDialog_Wizard.cpp \ +GNEDialog_AllowDisallow.h GNEDialog_AllowDisallow.cpp \ GNEAdditionalDialog.h GNEAdditionalDialog.cpp \ GNEChange.h GNEChange.cpp \ GNEChange_Junction.h GNEChange_Junction.cpp \ GNEChange_Edge.h GNEChange_Edge.cpp \ +GNEChange_Crossing.h GNEChange_Crossing.cpp \ GNEChange_Lane.h GNEChange_Lane.cpp \ GNEChange_Connection.h GNEChange_Connection.cpp \ GNEChange_Attribute.h GNEChange_Attribute.cpp \ GNEChange_TLS.h GNEChange_TLS.cpp \ GNEChange_Selection.h GNEChange_Selection.cpp \ GNEChange_Additional.h GNEChange_Additional.cpp \ +GNEChange_RerouterInterval.h GNEChange_RerouterInterval.cpp \ +GNEChange_CalibratorItem.h GNEChange_CalibratorItem.cpp \ +GNEChange_POI.h GNEChange_POI.cpp \ GNEUndoList.h GNEUndoList.cpp \ GNEAttributeCarrier.h GNEAttributeCarrier.cpp \ GNEFrame.h GNEFrame.cpp \ @@ -53,9 +54,10 @@ GNEConnectorFrame.h GNEConnectorFrame.cpp \ GNETLSEditorFrame.h GNETLSEditorFrame.cpp \ GNEAdditionalFrame.h GNEAdditionalFrame.cpp \ +GNECrossingFrame.h GNECrossingFrame.cpp \ +GNEDeleteFrame.h GNEDeleteFrame.cpp \ GNEAdditionalHandler.h GNEAdditionalHandler.cpp \ GNEAdditional.h GNEAdditional.cpp \ -GNEAdditionalSet.h GNEAdditionalSet.cpp \ GNEChargingStation.h GNEChargingStation.cpp \ GNEStoppingPlace.h GNEStoppingPlace.cpp \ GNEBusStop.h GNEBusStop.cpp \ @@ -68,15 +70,26 @@ GNEDetectorExit.h GNEDetectorExit.cpp \ GNERerouter.h GNERerouter.cpp \ GNERerouterDialog.h GNERerouterDialog.cpp \ +GNERerouterIntervalDialog.h GNERerouterIntervalDialog.cpp \ GNERouteProbe.h GNERouteProbe.cpp \ GNEVaporizer.h GNEVaporizer.cpp \ GNECalibrator.h GNECalibrator.cpp \ +GNECalibratorFlow.h GNECalibratorFlow.cpp \ +GNECalibratorVehicleType.h GNECalibratorVehicleType.cpp \ +GNECalibratorRoute.h GNECalibratorRoute.cpp \ GNECalibratorDialog.h GNECalibratorDialog.cpp \ -GNEVariableSpeedSignal.h GNEVariableSpeedSignal.cpp \ -GNEVariableSpeedSignalDialog.h GNEVariableSpeedSignalDialog.cpp \ -GNEReferenceCounter.h \ -GNEEvent_NetworkLoaded.h - +GNECalibratorFlowDialog.h GNECalibratorFlowDialog.cpp \ +GNECalibratorRouteDialog.h GNECalibratorRouteDialog.cpp \ +GNECalibratorVehicleTypeDialog.h GNECalibratorVehicleTypeDialog.cpp \ +GNEVariableSpeedSign.h GNEVariableSpeedSign.cpp \ +GNEVariableSpeedSignStep.h GNEVariableSpeedSignStep.cpp \ +GNEVariableSpeedSignDialog.h GNEVariableSpeedSignDialog.cpp \ +GNEClosingLaneReroute.h GNEClosingLaneReroute.cpp \ +GNEClosingReroute.h GNEClosingReroute.cpp \ +GNEDestProbReroute.h GNEDestProbReroute.cpp \ +GNERouteProbReroute.h GNERouteProbReroute.cpp \ +GNERerouterInterval.h GNERerouterInterval.cpp \ +GNEReferenceCounter.h GNEEvent_NetworkLoaded.h netedit_LDADD = ../netimport/libnetimport.a \ ../netimport/vissim/libvissimimport.a \ @@ -105,7 +118,6 @@ ../utils/importio/libimportio.a \ ../utils/iodevices/libiodevices.a \ ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ $(XERCES_LIBS) $(FFMPEG_LIBS) \ $(FOX_LDFLAGS) $(XERCES_LDFLAGS) $(PROJ_LDFLAGS) $(GDAL_LDFLAGS) $(X_LDFLAGS) endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/Makefile.in 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/Makefile.in 2017-07-23 16:22:07.000000000 +0000 @@ -103,36 +103,54 @@ GNEPOI.h GNEPOI.cpp GNEPoly.h GNEPoly.cpp GNEProhibition.h \ GNEProhibition.cpp GNEViewNet.h GNEViewNet.cpp GNEViewParent.h \ GNEViewParent.cpp GNEDialog_About.h GNEDialog_About.cpp \ - GNEDialog_Wizard.h GNEDialog_Wizard.cpp GNEAdditionalDialog.h \ - GNEAdditionalDialog.cpp GNEChange.h GNEChange.cpp \ - GNEChange_Junction.h GNEChange_Junction.cpp GNEChange_Edge.h \ - GNEChange_Edge.cpp GNEChange_Lane.h GNEChange_Lane.cpp \ + GNEDialog_Wizard.h GNEDialog_Wizard.cpp \ + GNEDialog_AllowDisallow.h GNEDialog_AllowDisallow.cpp \ + GNEAdditionalDialog.h GNEAdditionalDialog.cpp GNEChange.h \ + GNEChange.cpp GNEChange_Junction.h GNEChange_Junction.cpp \ + GNEChange_Edge.h GNEChange_Edge.cpp GNEChange_Crossing.h \ + GNEChange_Crossing.cpp GNEChange_Lane.h GNEChange_Lane.cpp \ GNEChange_Connection.h GNEChange_Connection.cpp \ GNEChange_Attribute.h GNEChange_Attribute.cpp GNEChange_TLS.h \ GNEChange_TLS.cpp GNEChange_Selection.h \ GNEChange_Selection.cpp GNEChange_Additional.h \ - GNEChange_Additional.cpp GNEUndoList.h GNEUndoList.cpp \ - GNEAttributeCarrier.h GNEAttributeCarrier.cpp GNEFrame.h \ - GNEFrame.cpp GNEInspectorFrame.h GNEInspectorFrame.cpp \ - GNESelectorFrame.h GNESelectorFrame.cpp GNEConnectorFrame.h \ - GNEConnectorFrame.cpp GNETLSEditorFrame.h \ - GNETLSEditorFrame.cpp GNEAdditionalFrame.h \ - GNEAdditionalFrame.cpp GNEAdditionalHandler.h \ + GNEChange_Additional.cpp GNEChange_RerouterInterval.h \ + GNEChange_RerouterInterval.cpp GNEChange_CalibratorItem.h \ + GNEChange_CalibratorItem.cpp GNEChange_POI.h GNEChange_POI.cpp \ + GNEUndoList.h GNEUndoList.cpp GNEAttributeCarrier.h \ + GNEAttributeCarrier.cpp GNEFrame.h GNEFrame.cpp \ + GNEInspectorFrame.h GNEInspectorFrame.cpp GNESelectorFrame.h \ + GNESelectorFrame.cpp GNEConnectorFrame.h GNEConnectorFrame.cpp \ + GNETLSEditorFrame.h GNETLSEditorFrame.cpp GNEAdditionalFrame.h \ + GNEAdditionalFrame.cpp GNECrossingFrame.h GNECrossingFrame.cpp \ + GNEDeleteFrame.h GNEDeleteFrame.cpp GNEAdditionalHandler.h \ GNEAdditionalHandler.cpp GNEAdditional.h GNEAdditional.cpp \ - GNEAdditionalSet.h GNEAdditionalSet.cpp GNEChargingStation.h \ - GNEChargingStation.cpp GNEStoppingPlace.h GNEStoppingPlace.cpp \ - GNEBusStop.h GNEBusStop.cpp GNEContainerStop.h \ - GNEContainerStop.cpp GNEDetector.h GNEDetector.cpp \ - GNEDetectorE1.h GNEDetectorE1.cpp GNEDetectorE2.h \ - GNEDetectorE2.cpp GNEDetectorE3.h GNEDetectorE3.cpp \ - GNEDetectorEntry.h GNEDetectorEntry.cpp GNEDetectorExit.h \ - GNEDetectorExit.cpp GNERerouter.h GNERerouter.cpp \ - GNERerouterDialog.h GNERerouterDialog.cpp GNERouteProbe.h \ - GNERouteProbe.cpp GNEVaporizer.h GNEVaporizer.cpp \ - GNECalibrator.h GNECalibrator.cpp GNECalibratorDialog.h \ - GNECalibratorDialog.cpp GNEVariableSpeedSignal.h \ - GNEVariableSpeedSignal.cpp GNEVariableSpeedSignalDialog.h \ - GNEVariableSpeedSignalDialog.cpp GNEReferenceCounter.h \ + GNEChargingStation.h GNEChargingStation.cpp GNEStoppingPlace.h \ + GNEStoppingPlace.cpp GNEBusStop.h GNEBusStop.cpp \ + GNEContainerStop.h GNEContainerStop.cpp GNEDetector.h \ + GNEDetector.cpp GNEDetectorE1.h GNEDetectorE1.cpp \ + GNEDetectorE2.h GNEDetectorE2.cpp GNEDetectorE3.h \ + GNEDetectorE3.cpp GNEDetectorEntry.h GNEDetectorEntry.cpp \ + GNEDetectorExit.h GNEDetectorExit.cpp GNERerouter.h \ + GNERerouter.cpp GNERerouterDialog.h GNERerouterDialog.cpp \ + GNERerouterIntervalDialog.h GNERerouterIntervalDialog.cpp \ + GNERouteProbe.h GNERouteProbe.cpp GNEVaporizer.h \ + GNEVaporizer.cpp GNECalibrator.h GNECalibrator.cpp \ + GNECalibratorFlow.h GNECalibratorFlow.cpp \ + GNECalibratorVehicleType.h GNECalibratorVehicleType.cpp \ + GNECalibratorRoute.h GNECalibratorRoute.cpp \ + GNECalibratorDialog.h GNECalibratorDialog.cpp \ + GNECalibratorFlowDialog.h GNECalibratorFlowDialog.cpp \ + GNECalibratorRouteDialog.h GNECalibratorRouteDialog.cpp \ + GNECalibratorVehicleTypeDialog.h \ + GNECalibratorVehicleTypeDialog.cpp GNEVariableSpeedSign.h \ + GNEVariableSpeedSign.cpp GNEVariableSpeedSignStep.h \ + GNEVariableSpeedSignStep.cpp GNEVariableSpeedSignDialog.h \ + GNEVariableSpeedSignDialog.cpp GNEClosingLaneReroute.h \ + GNEClosingLaneReroute.cpp GNEClosingReroute.h \ + GNEClosingReroute.cpp GNEDestProbReroute.h \ + GNEDestProbReroute.cpp GNERouteProbReroute.h \ + GNERouteProbReroute.cpp GNERerouterInterval.h \ + GNERerouterInterval.cpp GNEReferenceCounter.h \ GNEEvent_NetworkLoaded.h @WITH_GUI_TRUE@am_netedit_OBJECTS = netedit_main.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEApplicationWindow.$(OBJEXT) \ @@ -145,26 +163,31 @@ @WITH_GUI_TRUE@ GNEViewNet.$(OBJEXT) GNEViewParent.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEDialog_About.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEDialog_Wizard.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEDialog_AllowDisallow.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEAdditionalDialog.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChange.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChange_Junction.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChange_Edge.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEChange_Crossing.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChange_Lane.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChange_Connection.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChange_Attribute.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChange_TLS.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChange_Selection.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChange_Additional.$(OBJEXT) \ -@WITH_GUI_TRUE@ GNEUndoList.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEChange_RerouterInterval.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEChange_CalibratorItem.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEChange_POI.$(OBJEXT) GNEUndoList.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEAttributeCarrier.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEFrame.$(OBJEXT) GNEInspectorFrame.$(OBJEXT) \ @WITH_GUI_TRUE@ GNESelectorFrame.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEConnectorFrame.$(OBJEXT) \ @WITH_GUI_TRUE@ GNETLSEditorFrame.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEAdditionalFrame.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNECrossingFrame.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEDeleteFrame.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEAdditionalHandler.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEAdditional.$(OBJEXT) \ -@WITH_GUI_TRUE@ GNEAdditionalSet.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEChargingStation.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEStoppingPlace.$(OBJEXT) GNEBusStop.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEContainerStop.$(OBJEXT) \ @@ -173,11 +196,24 @@ @WITH_GUI_TRUE@ GNEDetectorEntry.$(OBJEXT) \ @WITH_GUI_TRUE@ GNEDetectorExit.$(OBJEXT) GNERerouter.$(OBJEXT) \ @WITH_GUI_TRUE@ GNERerouterDialog.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNERerouterIntervalDialog.$(OBJEXT) \ @WITH_GUI_TRUE@ GNERouteProbe.$(OBJEXT) GNEVaporizer.$(OBJEXT) \ @WITH_GUI_TRUE@ GNECalibrator.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNECalibratorFlow.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNECalibratorVehicleType.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNECalibratorRoute.$(OBJEXT) \ @WITH_GUI_TRUE@ GNECalibratorDialog.$(OBJEXT) \ -@WITH_GUI_TRUE@ GNEVariableSpeedSignal.$(OBJEXT) \ -@WITH_GUI_TRUE@ GNEVariableSpeedSignalDialog.$(OBJEXT) +@WITH_GUI_TRUE@ GNECalibratorFlowDialog.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNECalibratorRouteDialog.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNECalibratorVehicleTypeDialog.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEVariableSpeedSign.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEVariableSpeedSignStep.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEVariableSpeedSignDialog.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEClosingLaneReroute.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEClosingReroute.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNEDestProbReroute.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNERouteProbReroute.$(OBJEXT) \ +@WITH_GUI_TRUE@ GNERerouterInterval.$(OBJEXT) netedit_OBJECTS = $(am_netedit_OBJECTS) am__DEPENDENCIES_1 = @WITH_GUI_TRUE@netedit_DEPENDENCIES = ../netimport/libnetimport.a \ @@ -206,7 +242,7 @@ @WITH_GUI_TRUE@ ../utils/xml/libxml.a \ @WITH_GUI_TRUE@ ../utils/importio/libimportio.a \ @WITH_GUI_TRUE@ ../utils/iodevices/libiodevices.a \ -@WITH_GUI_TRUE@ ../foreign/tcpip/libtcpip.a $(MEM_LIBS) \ +@WITH_GUI_TRUE@ ../foreign/tcpip/libtcpip.a \ @WITH_GUI_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ @WITH_GUI_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ @WITH_GUI_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) @@ -438,7 +474,6 @@ top_srcdir = @top_srcdir@ EXTRA_DIST = netedit64.ico netedit.rc @WITH_GUI_TRUE@GUI_APPS = netedit -@CHECK_MEMORY_LEAKS_TRUE@MEM_LIBS = ../foreign/nvwa/libnvwa.a @TRACI_TRUE@TRACI_LIBS = ../traci-server/libtraciserver.a @WITH_GUI_TRUE@netedit_SOURCES = netedit_main.cpp \ @WITH_GUI_TRUE@GNEApplicationWindow.h GNEApplicationWindow.cpp \ @@ -458,16 +493,21 @@ @WITH_GUI_TRUE@GNEViewParent.h GNEViewParent.cpp \ @WITH_GUI_TRUE@GNEDialog_About.h GNEDialog_About.cpp \ @WITH_GUI_TRUE@GNEDialog_Wizard.h GNEDialog_Wizard.cpp \ +@WITH_GUI_TRUE@GNEDialog_AllowDisallow.h GNEDialog_AllowDisallow.cpp \ @WITH_GUI_TRUE@GNEAdditionalDialog.h GNEAdditionalDialog.cpp \ @WITH_GUI_TRUE@GNEChange.h GNEChange.cpp \ @WITH_GUI_TRUE@GNEChange_Junction.h GNEChange_Junction.cpp \ @WITH_GUI_TRUE@GNEChange_Edge.h GNEChange_Edge.cpp \ +@WITH_GUI_TRUE@GNEChange_Crossing.h GNEChange_Crossing.cpp \ @WITH_GUI_TRUE@GNEChange_Lane.h GNEChange_Lane.cpp \ @WITH_GUI_TRUE@GNEChange_Connection.h GNEChange_Connection.cpp \ @WITH_GUI_TRUE@GNEChange_Attribute.h GNEChange_Attribute.cpp \ @WITH_GUI_TRUE@GNEChange_TLS.h GNEChange_TLS.cpp \ @WITH_GUI_TRUE@GNEChange_Selection.h GNEChange_Selection.cpp \ @WITH_GUI_TRUE@GNEChange_Additional.h GNEChange_Additional.cpp \ +@WITH_GUI_TRUE@GNEChange_RerouterInterval.h GNEChange_RerouterInterval.cpp \ +@WITH_GUI_TRUE@GNEChange_CalibratorItem.h GNEChange_CalibratorItem.cpp \ +@WITH_GUI_TRUE@GNEChange_POI.h GNEChange_POI.cpp \ @WITH_GUI_TRUE@GNEUndoList.h GNEUndoList.cpp \ @WITH_GUI_TRUE@GNEAttributeCarrier.h GNEAttributeCarrier.cpp \ @WITH_GUI_TRUE@GNEFrame.h GNEFrame.cpp \ @@ -476,9 +516,10 @@ @WITH_GUI_TRUE@GNEConnectorFrame.h GNEConnectorFrame.cpp \ @WITH_GUI_TRUE@GNETLSEditorFrame.h GNETLSEditorFrame.cpp \ @WITH_GUI_TRUE@GNEAdditionalFrame.h GNEAdditionalFrame.cpp \ +@WITH_GUI_TRUE@GNECrossingFrame.h GNECrossingFrame.cpp \ +@WITH_GUI_TRUE@GNEDeleteFrame.h GNEDeleteFrame.cpp \ @WITH_GUI_TRUE@GNEAdditionalHandler.h GNEAdditionalHandler.cpp \ @WITH_GUI_TRUE@GNEAdditional.h GNEAdditional.cpp \ -@WITH_GUI_TRUE@GNEAdditionalSet.h GNEAdditionalSet.cpp \ @WITH_GUI_TRUE@GNEChargingStation.h GNEChargingStation.cpp \ @WITH_GUI_TRUE@GNEStoppingPlace.h GNEStoppingPlace.cpp \ @WITH_GUI_TRUE@GNEBusStop.h GNEBusStop.cpp \ @@ -491,14 +532,26 @@ @WITH_GUI_TRUE@GNEDetectorExit.h GNEDetectorExit.cpp \ @WITH_GUI_TRUE@GNERerouter.h GNERerouter.cpp \ @WITH_GUI_TRUE@GNERerouterDialog.h GNERerouterDialog.cpp \ +@WITH_GUI_TRUE@GNERerouterIntervalDialog.h GNERerouterIntervalDialog.cpp \ @WITH_GUI_TRUE@GNERouteProbe.h GNERouteProbe.cpp \ @WITH_GUI_TRUE@GNEVaporizer.h GNEVaporizer.cpp \ @WITH_GUI_TRUE@GNECalibrator.h GNECalibrator.cpp \ +@WITH_GUI_TRUE@GNECalibratorFlow.h GNECalibratorFlow.cpp \ +@WITH_GUI_TRUE@GNECalibratorVehicleType.h GNECalibratorVehicleType.cpp \ +@WITH_GUI_TRUE@GNECalibratorRoute.h GNECalibratorRoute.cpp \ @WITH_GUI_TRUE@GNECalibratorDialog.h GNECalibratorDialog.cpp \ -@WITH_GUI_TRUE@GNEVariableSpeedSignal.h GNEVariableSpeedSignal.cpp \ -@WITH_GUI_TRUE@GNEVariableSpeedSignalDialog.h GNEVariableSpeedSignalDialog.cpp \ -@WITH_GUI_TRUE@GNEReferenceCounter.h \ -@WITH_GUI_TRUE@GNEEvent_NetworkLoaded.h +@WITH_GUI_TRUE@GNECalibratorFlowDialog.h GNECalibratorFlowDialog.cpp \ +@WITH_GUI_TRUE@GNECalibratorRouteDialog.h GNECalibratorRouteDialog.cpp \ +@WITH_GUI_TRUE@GNECalibratorVehicleTypeDialog.h GNECalibratorVehicleTypeDialog.cpp \ +@WITH_GUI_TRUE@GNEVariableSpeedSign.h GNEVariableSpeedSign.cpp \ +@WITH_GUI_TRUE@GNEVariableSpeedSignStep.h GNEVariableSpeedSignStep.cpp \ +@WITH_GUI_TRUE@GNEVariableSpeedSignDialog.h GNEVariableSpeedSignDialog.cpp \ +@WITH_GUI_TRUE@GNEClosingLaneReroute.h GNEClosingLaneReroute.cpp \ +@WITH_GUI_TRUE@GNEClosingReroute.h GNEClosingReroute.cpp \ +@WITH_GUI_TRUE@GNEDestProbReroute.h GNEDestProbReroute.cpp \ +@WITH_GUI_TRUE@GNERouteProbReroute.h GNERouteProbReroute.cpp \ +@WITH_GUI_TRUE@GNERerouterInterval.h GNERerouterInterval.cpp \ +@WITH_GUI_TRUE@GNEReferenceCounter.h GNEEvent_NetworkLoaded.h @WITH_GUI_TRUE@netedit_LDADD = ../netimport/libnetimport.a \ @WITH_GUI_TRUE@../netimport/vissim/libvissimimport.a \ @@ -527,7 +580,6 @@ @WITH_GUI_TRUE@../utils/importio/libimportio.a \ @WITH_GUI_TRUE@../utils/iodevices/libiodevices.a \ @WITH_GUI_TRUE@../foreign/tcpip/libtcpip.a \ -@WITH_GUI_TRUE@$(MEM_LIBS) \ @WITH_GUI_TRUE@$(XERCES_LIBS) $(FFMPEG_LIBS) \ @WITH_GUI_TRUE@$(FOX_LDFLAGS) $(XERCES_LDFLAGS) $(PROJ_LDFLAGS) $(GDAL_LDFLAGS) $(X_LDFLAGS) @@ -629,26 +681,40 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEAdditionalDialog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEAdditionalFrame.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEAdditionalHandler.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEAdditionalSet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEApplicationWindow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEAttributeCarrier.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEBusStop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECalibrator.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECalibratorDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECalibratorFlow.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECalibratorFlowDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECalibratorRoute.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECalibratorRouteDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECalibratorVehicleType.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECalibratorVehicleTypeDialog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_Additional.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_Attribute.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_CalibratorItem.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_Connection.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_Crossing.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_Edge.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_Junction.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_Lane.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_POI.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_RerouterInterval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_Selection.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChange_TLS.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEChargingStation.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEClosingLaneReroute.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEClosingReroute.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEConnection.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEConnectorFrame.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEContainerStop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECrossing.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNECrossingFrame.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDeleteFrame.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDestProbReroute.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDetector.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDetectorE1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDetectorE2.Po@am__quote@ @@ -656,6 +722,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDetectorEntry.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDetectorExit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDialog_About.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDialog_AllowDisallow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEDialog_Wizard.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEEdge.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEFrame.Po@am__quote@ @@ -671,14 +738,18 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEProhibition.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNERerouter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNERerouterDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNERerouterInterval.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNERerouterIntervalDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNERouteProbReroute.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNERouteProbe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNESelectorFrame.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEStoppingPlace.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNETLSEditorFrame.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEUndoList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEVaporizer.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEVariableSpeedSignal.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEVariableSpeedSignalDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEVariableSpeedSign.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEVariableSpeedSignDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEVariableSpeedSignStep.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEViewNet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GNEViewParent.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netedit_main.Po@am__quote@ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/netedit_main.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/netedit_main.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netedit/netedit_main.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netedit/netedit_main.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file netedit_main.cpp /// @author Jakob Erdmann /// @date Feb 2011 -/// @version $Id: netedit_main.cpp 21640 2016-10-09 20:28:52Z palcraft $ +/// @version $Id: netedit_main.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Main for NETEDIT (adapted from guisim_main) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,10 +55,6 @@ #include "GNEApplicationWindow.h" #include "GNELoadThread.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif - // =========================================================================== // main function @@ -72,7 +68,7 @@ OptionsCont& oc = OptionsCont::getOptions(); // give some application descriptions oc.setApplicationDescription("Graphical editor for SUMO networks."); - oc.setApplicationName("netedit.exe", "Netedit Version " VERSION_STRING); + oc.setApplicationName("netedit", "Netedit Version " VERSION_STRING); int ret = 0; #ifndef _DEBUG try { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,3 @@ -if CHECK_MEMORY_LEAKS -MEM_LIBS = ../foreign/nvwa/libnvwa.a -endif - bin_PROGRAMS = netgenerate netgenerate_SOURCES = netgen_main.cpp NGEdge.cpp NGEdge.h NGFrame.cpp NGFrame.h \ @@ -17,6 +13,5 @@ ../utils/importio/libimportio.a \ ../utils/iodevices/libiodevices.a \ ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ -l$(LIB_XERCES) \ $(XERCES_LDFLAGS) $(GDAL_LDFLAGS) $(PROJ_LDFLAGS) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -103,7 +103,7 @@ ../utils/options/liboptions.a ../utils/xml/libxml.a \ ../utils/common/libcommon.a ../utils/importio/libimportio.a \ ../utils/iodevices/libiodevices.a ../foreign/tcpip/libtcpip.a \ - $(MEM_LIBS) $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -331,7 +331,6 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -@CHECK_MEMORY_LEAKS_TRUE@MEM_LIBS = ../foreign/nvwa/libnvwa.a netgenerate_SOURCES = netgen_main.cpp NGEdge.cpp NGEdge.h NGFrame.cpp NGFrame.h \ NGNet.h NGNet.cpp NGNode.cpp NGNode.h \ NGRandomNetBuilder.h NGRandomNetBuilder.cpp @@ -345,7 +344,6 @@ ../utils/importio/libimportio.a \ ../utils/iodevices/libiodevices.a \ ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ -l$(LIB_XERCES) \ $(XERCES_LDFLAGS) $(GDAL_LDFLAGS) $(PROJ_LDFLAGS) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/netgen_main.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/netgen_main.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/netgen_main.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/netgen_main.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mar, 2003 -/// @version $Id: netgen_main.cpp 20507 2016-04-20 11:40:48Z namdre $ +/// @version $Id: netgen_main.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Main for NETGENERATE /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -53,14 +53,11 @@ #include #include #include +#include #include #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -141,9 +138,9 @@ // get options int xNo = oc.getInt("grid.x-number"); int yNo = oc.getInt("grid.y-number"); - SUMOReal xLength = oc.getFloat("grid.x-length"); - SUMOReal yLength = oc.getFloat("grid.y-length"); - SUMOReal attachLength = oc.getFloat("grid.attach-length"); + double xLength = oc.getFloat("grid.x-length"); + double yLength = oc.getFloat("grid.y-length"); + double attachLength = oc.getFloat("grid.attach-length"); if (oc.isDefault("grid.x-number") && !oc.isDefault("grid.number")) { xNo = oc.getInt("grid.number"); } @@ -185,7 +182,7 @@ return net; } // random net - TNeighbourDistribution neighborDist; + RandomDistributor neighborDist; neighborDist.add(1, oc.getFloat("rand.neighbor-dist1")); neighborDist.add(2, oc.getFloat("rand.neighbor-dist2")); neighborDist.add(3, oc.getFloat("rand.neighbor-dist3")); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGEdge.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGEdge.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGEdge.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGEdge.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Mar, 2003 -/// @version $Id: NGEdge.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NGEdge.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A netgen-representation of an edge /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2003-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2003-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,10 +47,6 @@ #include "NGEdge.h" #include "NGNode.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGEdge.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGEdge.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGEdge.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGEdge.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mar, 2003 -/// @version $Id: NGEdge.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NGEdge.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A netgen-representation of an edge /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGFrame.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 06.05.2011 -/// @version $Id: NGFrame.cpp 20507 2016-04-20 11:40:48Z namdre $ +/// @version $Id: NGFrame.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Sets and checks options for netgen /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -153,7 +149,7 @@ oc.addSynonyme("rand.num-tries", "num-tries"); oc.addDescription("rand.num-tries", "Random Network", "The number of tries for creating each node"); - oc.doRegister("rand.connectivity", new Option_Float((SUMOReal) 0.95)); + oc.doRegister("rand.connectivity", new Option_Float((double) 0.95)); oc.addSynonyme("rand.connectivity", "rand-connectivity", true); oc.addSynonyme("rand.connectivity", "connectivity"); oc.addDescription("rand.connectivity", "Random Network", "Probability for roads to continue at each node"); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGFrame.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NGFrame.h /// @author Daniel Krajzewicz /// @date 06.05.2011 -/// @version $Id: NGFrame.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NGFrame.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Sets and checks options for netgen /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGNet.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGNet.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGNet.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGNet.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,7 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Mar, 2003 -/// @version $Id: NGNet.cpp 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: NGNet.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The class storing the generated network /****************************************************************************/ @@ -46,10 +46,6 @@ #include #include "NGNet.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -88,7 +84,7 @@ void -NGNet::createChequerBoard(int numX, int numY, SUMOReal spaceX, SUMOReal spaceY, SUMOReal attachLength, bool alphaIDs) { +NGNet::createChequerBoard(int numX, int numY, double spaceX, double spaceY, double attachLength, bool alphaIDs) { for (int ix = 0; ix < numX; ix++) { for (int iy = 0; iy < numY; iy++) { // create Node @@ -142,20 +138,20 @@ } -SUMOReal -NGNet::radialToX(SUMOReal radius, SUMOReal phi) { +double +NGNet::radialToX(double radius, double phi) { return cos(phi) * radius; } -SUMOReal -NGNet::radialToY(SUMOReal radius, SUMOReal phi) { +double +NGNet::radialToY(double radius, double phi) { return sin(phi) * radius; } void -NGNet::createSpiderWeb(int numRadDiv, int numCircles, SUMOReal spaceRad, bool hasCenter) { +NGNet::createSpiderWeb(int numRadDiv, int numCircles, double spaceRad, bool hasCenter) { if (numRadDiv < 3) { numRadDiv = 3; } @@ -164,7 +160,7 @@ } int ir, ic; - SUMOReal angle = (SUMOReal)(2 * M_PI / numRadDiv); // angle between radial divisions + double angle = (double)(2 * M_PI / numRadDiv); // angle between radial divisions NGNode* Node; for (ir = 1; ir < numRadDiv + 1; ir++) { for (ic = 1; ic < numCircles + 1; ic++) { @@ -224,7 +220,7 @@ myNetBuilder.getEdgeCont().insert(edge); } // now, let's append the reverse directions... - SUMOReal bidiProb = OptionsCont::getOptions().getFloat("rand.bidi-probability"); + double bidiProb = OptionsCont::getOptions().getFloat("rand.bidi-probability"); for (std::vector::const_iterator i = nodes.begin(); i != nodes.end(); ++i) { NBNode* node = *i; EdgeVector incoming = node->getIncomingEdges(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGNet.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGNet.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGNet.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGNet.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mar, 2003 -/// @version $Id: NGNet.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NGNet.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The class storing the generated network /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -91,7 +91,7 @@ * @param[in] phi The angle the position is located at * @return The x-position at the described circle at angle phi */ - SUMOReal radialToX(SUMOReal radius, SUMOReal phi); + double radialToX(double radius, double phi); /** @brief Returns the y-position resulting from the given radius and angle @@ -100,7 +100,7 @@ * @param[in] phi The angle the position is located at * @return The y-position at the described circle at angle phi */ - SUMOReal radialToY(SUMOReal radius, SUMOReal phi); + double radialToY(double radius, double phi); /** @brief Creates a grid network @@ -120,7 +120,7 @@ * @param[in] alphaIDs Whether to use alphanumerial node ids * @see NGNet::connect */ - void createChequerBoard(int numX, int numY, SUMOReal spaceX, SUMOReal spaceY, SUMOReal attachLength, bool alphaIDs); + void createChequerBoard(int numX, int numY, double spaceX, double spaceY, double attachLength, bool alphaIDs); /** @brief Creates a spider network @@ -140,7 +140,7 @@ * @see NGNet::connect * @todo consolidate the name of the center node */ - void createSpiderWeb(int numRadDiv, int numCircles, SUMOReal spaceRad, bool hasCenter); + void createSpiderWeb(int numRadDiv, int numCircles, double spaceRad, bool hasCenter); /** @brief Converts the stored network into its netbuilder-representation diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGNode.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGNode.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGNode.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGNode.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mar, 2003 -/// @version $Id: NGNode.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NGNode.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A netgen-representation of a node /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,10 +46,6 @@ #include #include "NGNode.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGNode.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGNode.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGNode.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGNode.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mar, 2003 -/// @version $Id: NGNode.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NGNode.h 23341 2017-03-13 10:11:12Z behrisch $ /// // A netgen-representation of a node /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -100,7 +100,7 @@ * * @return The maximum neighbour number of the node */ - SUMOReal getMaxNeighbours() { + int getMaxNeighbours() { return myMaxNeighbours; } @@ -109,7 +109,7 @@ * * @param[in] value The new maximum neighbour number of the node */ - void setMaxNeighbours(SUMOReal value) { + void setMaxNeighbours(int value) { myMaxNeighbours = value; } @@ -118,7 +118,7 @@ * * @param[in] value The new x-position of this node */ - void setX(SUMOReal x) { + void setX(double x) { myPosition.set(x, myPosition.y()); } @@ -127,7 +127,7 @@ * * @param[in] value The new y-position of this node */ - void setY(SUMOReal y) { + void setY(double y) { myPosition.set(myPosition.x(), y); } @@ -201,7 +201,7 @@ Position myPosition; /// @brief The maximum number of neighbours - SUMOReal myMaxNeighbours; + int myMaxNeighbours; /// @brief Information whether this is the center of a cpider-net bool myAmCenter; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGRandomNetBuilder.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGRandomNetBuilder.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGRandomNetBuilder.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGRandomNetBuilder.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mar, 2003 -/// @version $Id: NGRandomNetBuilder.cpp 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: NGRandomNetBuilder.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Additional structures for building random nets /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,50 +37,16 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== // --------------------------------------------------------------------------- -// TNeighbourDistribution-definitions -// --------------------------------------------------------------------------- -void -TNeighbourDistribution::add(int NumNeighbours, SUMOReal ratio) { - myNeighbours[NumNeighbours] = ratio; -} - - -int -TNeighbourDistribution::num() { - SUMOReal sum = 0, RandValue; - std::map::iterator i; - // total sum of ratios - for (i = myNeighbours.begin(); i != myNeighbours.end(); ++i) { - sum += (*i).second; - } - // RandValue = [0,sum] - RandValue = RandHelper::rand(sum); - // find selected item - i = myNeighbours.begin(); - sum = (*i).second; - while ((i != myNeighbours.end()) && (sum < RandValue)) { - ++i; - sum += (*i).second; - } - return (*i).first; -} - - -// --------------------------------------------------------------------------- // NGRandomNetBuilder-definitions // --------------------------------------------------------------------------- -NGRandomNetBuilder::NGRandomNetBuilder(NGNet& net, SUMOReal minAngle, SUMOReal minDistance, - SUMOReal maxDistance, SUMOReal connectivity, - int numTries, const TNeighbourDistribution& neighborDist) +NGRandomNetBuilder::NGRandomNetBuilder(NGNet& net, double minAngle, double minDistance, + double maxDistance, double connectivity, + int numTries, const RandomDistributor& neighborDist) : myNet(net), myMinLinkAngle(minAngle), myMinDistance(minDistance), myMaxDistance(maxDistance), myConnectivity(connectivity), myNumTries(numTries), myNeighbourDistribution(neighborDist) { @@ -146,7 +112,7 @@ // check for range between Basenode and Newnode if (connectable) { - SUMOReal dist = n.length(); + double dist = n.length(); if ((dist < myMinDistance) || (dist > myMaxDistance)) { connectable = false; } @@ -175,10 +141,10 @@ } // check NewNode-To-Links distance only, if NewNode isn't part of link if (connectable && (newNode != start) && (newNode != end)) { - const SUMOReal offset = GeomHelper::nearest_offset_on_line_to_point2D(p1, p2, n[1]); + const double offset = GeomHelper::nearest_offset_on_line_to_point2D(p1, p2, n[1]); if (offset != GeomHelper::INVALID_OFFSET) { const Position p = PositionVector(p1, p2).positionAtOffset2D(offset); - const SUMOReal dist = p.distanceTo2D(n[1]); + const double dist = p.distanceTo2D(n[1]); if (dist < myMinDistance) { connectable = false; } @@ -198,8 +164,8 @@ for (ni = myOuterNodes.begin(); ni != myOuterNodes.end(); ++ni) { NGNode* on = *ni; if (!node->connected(on)) { - if ((node->getMaxNeighbours() > node->LinkList.size()) && - ((on)->getMaxNeighbours() > (on)->LinkList.size())) { + if ((node->getMaxNeighbours() > (int)node->LinkList.size()) && + (on->getMaxNeighbours() > (int)on->LinkList.size())) { if (canConnect(node, on)) { myConNodes.push_back(on); } @@ -212,14 +178,14 @@ bool NGRandomNetBuilder::createNewNode(NGNode* baseNode) { // calculate position of new node based on BaseNode - SUMOReal dist = RandHelper::rand(myMinDistance, myMaxDistance); - SUMOReal angle = RandHelper::rand((SUMOReal)(2 * M_PI)); - SUMOReal x = baseNode->getPosition().x() + dist * cos(angle); - SUMOReal y = baseNode->getPosition().y() + dist * sin(angle); + double dist = RandHelper::rand(myMinDistance, myMaxDistance); + double angle = RandHelper::rand((double)(2 * M_PI)); + double x = baseNode->getPosition().x() + dist * cos(angle); + double y = baseNode->getPosition().y() + dist * sin(angle); NGNode* newNode = new NGNode(myNet.getNextFreeID()); newNode->setX(x); newNode->setY(y); - newNode->setMaxNeighbours((SUMOReal) myNeighbourDistribution.num()); + newNode->setMaxNeighbours(myNeighbourDistribution.get()); NGEdge* newLink = new NGEdge(myNet.getNextFreeID(), baseNode, newNode); if (canConnect(baseNode, newNode)) { // add node @@ -229,7 +195,7 @@ myNet.add(newLink); myOuterLinks.push_back(newLink); // check basenode for being outer node - if (baseNode->LinkList.size() >= baseNode->getMaxNeighbours()) { + if ((int)baseNode->LinkList.size() >= baseNode->getMaxNeighbours()) { removeOuterNode(baseNode); } return true; @@ -270,10 +236,10 @@ myNet.add(newLink); myOuterLinks.push_back(newLink); // check nodes for being outer node - if (outerNode->LinkList.size() >= outerNode->getMaxNeighbours()) { + if ((int)outerNode->LinkList.size() >= outerNode->getMaxNeighbours()) { removeOuterNode(outerNode); } - if (myConNodes.back()->LinkList.size() >= myConNodes.back()->getMaxNeighbours()) { + if ((int)myConNodes.back()->LinkList.size() >= myConNodes.back()->getMaxNeighbours()) { removeOuterNode(myConNodes.back()); } created = true; @@ -287,7 +253,7 @@ count++; } while ((count <= myNumTries) && !created); if (!created) { - outerNode->setMaxNeighbours((SUMOReal) outerNode->LinkList.size()); + outerNode->setMaxNeighbours((int)outerNode->LinkList.size()); myOuterNodes.remove(outerNode); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGRandomNetBuilder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGRandomNetBuilder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netgen/NGRandomNetBuilder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netgen/NGRandomNetBuilder.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mar, 2003 -/// @version $Id: NGRandomNetBuilder.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NGRandomNetBuilder.h 23341 2017-03-13 10:11:12Z behrisch $ /// // Additional structures for building random nets /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,46 +32,15 @@ #include #endif -#include "NGNet.h" #include +#include +#include "NGNet.h" // =========================================================================== // class definitions // =========================================================================== /** - * @class TNeighbourDistribution - * @todo Check whether this can be replaced by RandomDistributor - */ -class TNeighbourDistribution { -public: - /** - * @brief adds a neighbour item to list - * - * If NumNeighbours is already existing, the old ratio is overwritten - * - * @param[in] numNeighbours The number of neighbors this item shall describe - * @param[in] ratio The probability of this number of neighbors - */ - void add(int numNeighbours, SUMOReal ratio); - - - /** - * @brief Get random number of neighbours - * - * @return A random number of neighbors - */ - int num(); - - -private: - /// @brief A map from neighbor number to their probabilities - std::map myNeighbours; - -}; - - -/** * @class NGRandomNetBuilder * @brief A class that builds random network using an algorithm by Markus Hartinger. * @@ -89,8 +58,8 @@ * @param[in] numTries ? * @todo check meanings of connectivity/numTries */ - NGRandomNetBuilder(NGNet& net, SUMOReal minAngle, SUMOReal minDistance, SUMOReal maxDistance, SUMOReal connectivity, - int numTries, const TNeighbourDistribution& neighborDist); + NGRandomNetBuilder(NGNet& net, double minAngle, double minDistance, double maxDistance, double connectivity, + int numTries, const RandomDistributor& neighborDist); @@ -168,16 +137,16 @@ //@{ /// @brief Minimum angle allowed between two links - SUMOReal myMinLinkAngle; + double myMinLinkAngle; /// @brief Minimum distance allowed between two nodes - SUMOReal myMinDistance; + double myMinDistance; /// @brief Maximum distance allowed between two nodes - SUMOReal myMaxDistance; + double myMaxDistance; /// @brief Probability of connecting to a existing node if possible - SUMOReal myConnectivity; + double myConnectivity; //@} @@ -187,8 +156,8 @@ /// @brief Number of nodes to be created int myNumNodes; - /// @brief The distrubtion of number of neighbours - TNeighbourDistribution myNeighbourDistribution; + /// @brief The distribution of number of neighbours + RandomDistributor myNeighbourDistribution; private: /// @brief Invalidated copy constructor. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIFrame.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,13 +3,14 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @author Michael Behrisch +/// @author Gregor Laemmel /// @date Tue, 20 Nov 2001 -/// @version $Id: NIFrame.cpp 21744 2016-10-18 13:02:24Z namdre $ +/// @version $Id: NIFrame.cpp 23561 2017-03-20 15:03:10Z laemmel $ /// // Sets and checks options for netimport /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,10 +48,6 @@ #include "NIImporter_DlrNavteq.h" #include "NIFrame.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -151,13 +148,15 @@ oc.doRegister("ignore-errors.edge-type", new Option_Bool(false)); oc.addDescription("ignore-errors.edge-type", "Processing", "Continue on unknown edge types"); - oc.doRegister("lanes-from-capacity.norm", new Option_Float((SUMOReal) 1800)); + oc.doRegister("lanes-from-capacity.norm", new Option_Float((double) 1800)); oc.addSynonyme("lanes-from-capacity.norm", "capacity-norm"); oc.addDescription("lanes-from-capacity.norm", "Processing", "The factor for flow to no. lanes conversion"); oc.doRegister("speed-in-kmh", new Option_Bool(false)); oc.addDescription("speed-in-kmh", "Processing", "vmax is parsed as given in km/h (some)"); + oc.doRegister("construction-date", new Option_String()); + oc.addDescription("construction-date", "Processing", "Use YYYY-MM-DD date to determine the readiness of features under construction"); // register xml options @@ -258,11 +257,24 @@ oc.doRegister("osm.layer-elevation", new Option_Float(0)); oc.addDescription("osm.layer-elevation", "Processing", "Reconstruct (relative) elevation based on layer data. Each layer is raised by FLOAT m"); + oc.doRegister("osm.layer-elevation.max-grade", new Option_Float(10)); + oc.addDescription("osm.layer-elevation.max-grade", "Processing", "Maximum grade threshold in % at 50km/h when reconstrucing elevation based on layer data. The value is scaled according to road speed."); + + oc.doRegister("osm.oneway-spread-right", new Option_Bool(false)); + oc.addDescription("osm.oneway-spread-right", "Processing", "Whether one-way roads should be spread to the side instead of centered"); + + oc.doRegister("osm.stop-output.length", new Option_Float(100)); + oc.addDescription("osm.stop-output.length", "Processing", "The default length of a bus/train stop in FLOAT m"); + // register opendrive options oc.doRegister("opendrive.import-all-lanes", new Option_Bool(false)); oc.addDescription("opendrive.import-all-lanes", "Processing", "Imports all lane types"); oc.doRegister("opendrive.ignore-widths", new Option_Bool(false)); oc.addDescription("opendrive.ignore-widths", "Processing", "Whether lane widths shall be ignored."); + oc.doRegister("opendrive.curve-resolution", new Option_Float(2.0)); + oc.addDescription("opendrive.curve-resolution", "Processing", "The geometry resolution in m when importing curved geometries as line segments."); + oc.doRegister("opendrive.advance-stopline", new Option_Float(12.0)); + oc.addDescription("opendrive.advance-stopline", "Processing", "Allow stop lines to be built beyond the start of the junction if the geometries allow so"); // register some additional options oc.doRegister("tls.discard-loaded", new Option_Bool(false)); @@ -319,9 +331,15 @@ } } } - if (oc.isSet("opendrive-files") && oc.isDefault("tls.left-green.time")) { - // legacy behavior. see #2114 - oc.set("tls.left-green.time", "0"); + if (oc.isSet("opendrive-files")) { + if (oc.isDefault("tls.left-green.time")) { + // legacy behavior. see #2114 + oc.set("tls.left-green.time", "0"); + } + if (oc.isDefault("rectangular-lane-cut")) { + // a better interpretation of imported geometries + oc.set("rectangular-lane-cut", "true"); + } } return ok; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIFrame.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: NIFrame.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIFrame.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Sets and checks options for netimport /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_ArcView.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_ArcView.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_ArcView.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_ArcView.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Thimor Bohn /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIImporter_ArcView.cpp 21440 2016-09-07 11:06:14Z behrisch $ +/// @version $Id: NIImporter_ArcView.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Importer for networks stored in ArcView-shape format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -53,12 +53,15 @@ #include "NIImporter_ArcView.h" #ifdef HAVE_GDAL +#if __GNUC__ > 3 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" +#endif #include +#if __GNUC__ > 3 +#pragma GCC diagnostic pop +#endif #endif - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS // =========================================================================== @@ -192,8 +195,8 @@ } else if (poFeature->GetFieldIndex("ST_TYP_AFT") >= 0) { type = poFeature->GetFieldAsString("ST_TYP_AFT"); } - SUMOReal width = myTypeCont.getWidth(type); - SUMOReal speed = getSpeed(*poFeature, id); + double width = myTypeCont.getWidth(type); + double speed = getSpeed(*poFeature, id); int nolanes = getLaneNo(*poFeature, id, speed); int priority = getPriority(*poFeature, id); if (nolanes == 0 || speed == 0) { @@ -202,20 +205,23 @@ speed = myTypeCont.getSpeed(""); } else { OGRFeature::DestroyFeature(poFeature); - WRITE_ERROR("The description seems to be invalid. Please recheck usage of types."); + WRITE_ERROR("Required field 'nolanes' or 'speed' is missing (add fields or set option --shapefile.use-defaults-on-failure)."); return; } } if (mySpeedInKMH) { - speed = speed / (SUMOReal) 3.6; + speed = speed / (double) 3.6; } // read in the geometry OGRGeometry* poGeometry = poFeature->GetGeometryRef(); OGRwkbGeometryType gtype = poGeometry->getGeometryType(); - assert(gtype == wkbLineString); - UNUSED_PARAMETER(gtype); // ony used for assertion + if (gtype != wkbLineString) { + OGRFeature::DestroyFeature(poFeature); + WRITE_ERROR("Road geometry must be of type 'linestring'."); + return; + } OGRLineString* cgeom = (OGRLineString*) poGeometry; if (poCT != 0) { // try transform to wgs84 @@ -224,8 +230,8 @@ PositionVector shape; for (int j = 0; j < cgeom->getNumPoints(); j++) { - Position pos((SUMOReal) cgeom->getX(j), (SUMOReal) cgeom->getY(j)); - if (!NBNetBuilder::transformCoordinates(pos)) { + Position pos((double) cgeom->getX(j), (double) cgeom->getY(j)); + if (!NBNetBuilder::transformCoordinate(pos)) { WRITE_WARNING("Unable to project coordinates for edge '" + id + "'."); } shape.push_back_noDoublePos(pos); @@ -304,7 +310,7 @@ } #ifdef HAVE_GDAL -SUMOReal +double NIImporter_ArcView::getSpeed(OGRFeature& poFeature, const std::string& edgeid) { if (myOptions.isSet("shapefile.type-id")) { return myTypeCont.getSpeed(poFeature.GetFieldAsString((char*)(myOptions.getString("shapefile.type-id").c_str()))); @@ -313,11 +319,11 @@ // idea by John Michael Calandrino int index = poFeature.GetDefnRef()->GetFieldIndex("speed"); if (index >= 0 && poFeature.IsFieldSet(index)) { - return (SUMOReal) poFeature.GetFieldAsDouble(index); + return (double) poFeature.GetFieldAsDouble(index); } index = poFeature.GetDefnRef()->GetFieldIndex("SPEED"); if (index >= 0 && poFeature.IsFieldSet(index)) { - return (SUMOReal) poFeature.GetFieldAsDouble(index); + return (double) poFeature.GetFieldAsDouble(index); } // try to get the NavTech-information index = poFeature.GetDefnRef()->GetFieldIndex("SPEED_CAT"); @@ -331,7 +337,7 @@ int NIImporter_ArcView::getLaneNo(OGRFeature& poFeature, const std::string& edgeid, - SUMOReal speed) { + double speed) { if (myOptions.isSet("shapefile.type-id")) { return (int) myTypeCont.getNumLanes(poFeature.GetFieldAsString((char*)(myOptions.getString("shapefile.type-id").c_str()))); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_ArcView.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_ArcView.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_ArcView.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_ArcView.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: NIImporter_ArcView.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NIImporter_ArcView.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Importer for networks stored in ArcView-shape format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -100,7 +100,7 @@ * @param[in] f The entry to read the speed from * @param[in] edgeid The id of the edge for error output */ - SUMOReal getSpeed(OGRFeature& f, const std::string& edgeid); + double getSpeed(OGRFeature& f, const std::string& edgeid); /** @brief Parses the number of lanes of the edge currently processed @@ -109,7 +109,7 @@ * @param[in] speed The edge's speed used to help determinig the edge's lane number */ int getLaneNo(OGRFeature& f, - const std::string& edgeid, SUMOReal speed); + const std::string& edgeid, double speed); /** @brief Parses the priority of the edge currently processed * @param[in] f The entry to read the priority from diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_DlrNavteq.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_DlrNavteq.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_DlrNavteq.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_DlrNavteq.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 14.04.2008 -/// @version $Id: NIImporter_DlrNavteq.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NIImporter_DlrNavteq.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Importer for networks stored in Elmar's format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -54,15 +55,12 @@ #include "NIImporter_DlrNavteq.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // --------------------------------------------------------------------------- // static members // --------------------------------------------------------------------------- const int NIImporter_DlrNavteq::GEO_SCALE = 5; const int NIImporter_DlrNavteq::EdgesHandler::MISSING_COLUMN = std::numeric_limits::max(); +const std::string NIImporter_DlrNavteq::UNDEFINED("-1"); // =========================================================================== // method definitions @@ -76,6 +74,8 @@ if (!oc.isSet("dlr-navteq-prefix")) { return; } + time_t csTime; + time(&csTime); // parse file(s) LineReader lr; // load nodes @@ -123,6 +123,58 @@ lr.readAll(handler3); PROGRESS_DONE_MESSAGE(); } + + // load prohibited manoeuvres if given + file = oc.getString("dlr-navteq-prefix") + "_prohibited_manoeuvres.txt"; + if (lr.setFile(file)) { + PROGRESS_BEGIN_MESSAGE("Loading prohibited manoeuvres"); + ProhibitionHandler handler6(nb.getEdgeCont(), file, csTime); + lr.readAll(handler6); + PROGRESS_DONE_MESSAGE(); + } + + // load connected lanes if given + file = oc.getString("dlr-navteq-prefix") + "_connected_lanes.txt"; + if (lr.setFile(file)) { + PROGRESS_BEGIN_MESSAGE("Loading connected lanes"); + ConnectedLanesHandler handler7(nb.getEdgeCont()); + lr.readAll(handler7); + PROGRESS_DONE_MESSAGE(); + } + + // load time restrictions if given + file = oc.getString("dlr-navteq-prefix") + "_links_timerestrictions.txt"; + if (lr.setFile(file)) { + PROGRESS_BEGIN_MESSAGE("Loading time restrictions"); + if (!oc.isDefault("construction-date")) { + csTime = readDate(oc.getString("construction-date")); + } + TimeRestrictionsHandler handler5(nb.getEdgeCont(), nb.getDistrictCont(), csTime); + lr.readAll(handler5); + handler5.printSummary(); + PROGRESS_DONE_MESSAGE(); + } +} + +double +NIImporter_DlrNavteq::readVersion(const std::string& line, const std::string& file) { + assert(line[0] == '#'); + const std::string marker = "extraction version: v"; + const std::string lowerCase = StringUtils::to_lower_case(line); + if (lowerCase.find(marker) == std::string::npos) { + return -1; + } + const int vStart = (int)(lowerCase.find(marker) + marker.size()); + const int vEnd = (int)line.find(" ", vStart); + try { + const double version = TplConvert::_2double(line.substr(vStart, vEnd - vStart).c_str()); + if (version < 0) { + throw ProcessError("Invalid version number '" + toString(version) + "' in file '" + file + "'."); + } + return version; + } catch (NumberFormatException&) { + throw ProcessError("Non-numerical value '" + line.substr(vStart, vEnd - vStart) + "' for version string in file '" + file + "'."); + } } @@ -180,7 +232,7 @@ throw ProcessError("Non-numerical value for y-position in node " + id + "."); } Position pos(x, y); - if (!NBNetBuilder::transformCoordinates(pos, true)) { + if (!NBNetBuilder::transformCoordinate(pos, true)) { throw ProcessError("Unable to project coordinates for node " + id + "."); } geoms.push_back(pos); @@ -226,17 +278,9 @@ if (!myColumns.empty()) { return true; } - const std::string marker = "Extraction version: V"; - if (result.find(marker) == std::string::npos) { - return true; - } - const int vStart = (int)(result.find(marker) + marker.size()); - const int vEnd = (int)result.find(" ", vStart); - try { - myVersion = TplConvert::_2SUMOReal(result.substr(vStart, vEnd - vStart).c_str()); - if (myVersion < 0) { - throw ProcessError("Invalid version number '" + toString(myVersion) + "' in file '" + myFile + "'."); - } + const double version = readVersion(result, myFile); + if (version > 0) { + myVersion = version; // init columns const int NUM_COLUMNS = 25; // @note arrays must match this size! const int MC = MISSING_COLUMN; @@ -250,8 +294,6 @@ const int columns[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}; myColumns = std::vector(columns, columns + NUM_COLUMNS); } - } catch (NumberFormatException&) { - throw ProcessError("Non-numerical value for version string in file '" + myFile + "'."); } return true; } @@ -268,6 +310,13 @@ } catch (NumberFormatException&) { throw ProcessError("Non-numerical value for form_of_way of link '" + id + "'."); } + // brunnel type (bridge/tunnel/ferry (for permissions) + int brunnel_type; + try { + brunnel_type = TplConvert::_2int(getColumn(st, BRUNNEL_TYPE).c_str()); + } catch (NumberFormatException&) { + throw ProcessError("Non-numerical value for brunnel_type of link '" + id + "'."); + } // priority based on street_type / frc int priority; try { @@ -297,7 +346,7 @@ throw ProcessError("The to-node '" + toID + "' of link '" + id + "' could not be found"); } // speed - SUMOReal speed; + double speed; try { speed = TplConvert::_2int(getColumn(st, SPEED_RESTRICTION, "-1").c_str()) / 3.6; } catch (NumberFormatException) { @@ -355,6 +404,10 @@ // unfortunately, the veh_type string is misleading in this case e->disallowVehicleClass(-1, SVC_PASSENGER); } + // permission modifications based on brunnel_type + if (brunnel_type == 10) { // ferry + e->setPermissions(SVC_SHIP, -1); + } } // insert the edge to the network @@ -478,13 +531,300 @@ if (result[0] == '#') { return true; } - StringTokenizer st(result, StringTokenizer::WHITECHARS); + StringTokenizer st(result, StringTokenizer::TAB); if (st.size() == 1) { - return true; // one line with the number of data containing lines in it + return true; // one line with the number of data containing lines in it (also starts with a comment # since ersion 6.5) } assert(st.size() >= 2); const std::string id = st.next(); - myStreetNames[id] = joinToString(st.getVector(), " "); + if (st.size() > 2) { + const std::string permanent_id_info = st.next(); + } + myStreetNames[id] = st.next(); return true; } + + +// --------------------------------------------------------------------------- +// definitions of NIImporter_DlrNavteq::TimeRestrictionsHandler-methods +// --------------------------------------------------------------------------- +NIImporter_DlrNavteq::TimeRestrictionsHandler::TimeRestrictionsHandler(NBEdgeCont& ec, NBDistrictCont& dc, time_t constructionTime): + myEdgeCont(ec), + myDistrictCont(dc), + myConstructionTime(constructionTime), + myCS_min(std::numeric_limits::max()), + myCS_max(std::numeric_limits::min()), + myConstructionEntries(0), + myNotStarted(0), + myUnderConstruction(0), + myFinished(0), + myRemovedEdges(0) { +} + + +NIImporter_DlrNavteq::TimeRestrictionsHandler::~TimeRestrictionsHandler() {} + + +bool +NIImporter_DlrNavteq::TimeRestrictionsHandler::report(const std::string& result) { +// # NAME_ID Name + if (result[0] == '#') { + return true; + } + StringTokenizer st(result, StringTokenizer::WHITECHARS); + const std::string id = st.next(); + const std::string type = st.next(); + const std::string directionOfFlow = st.next(); // can be ignored since unidirectional edge ids are referenced in the file + const std::string throughTraffic = st.next(); + const std::string vehicleType = st.next(); + const std::string validityPeriod = st.next(); + const std::string warning = "Unrecognized TIME_REC '" + validityPeriod + "'"; + if (type == "CS") { + myConstructionEntries++; + if (validityPeriod.size() > 1024) { + WRITE_WARNING(warning); + } + // construction + char start[1024]; + char duration[1024]; + + int matched; + + matched = sscanf(validityPeriod.c_str(), "[(%[^)]){%[^}]}]", start, duration); + if (matched == 2) { + time_t tStart = readTimeRec(start, ""); + time_t tEnd = readTimeRec(start, duration); + myCS_min = MIN2(myCS_min, tStart); + myCS_max = MAX2(myCS_max, tEnd); + //std::cout << " start=" << start << " tStart=" << tStart<< " translation=" << asctime(localtime(&tStart)) << ""; + //std::cout << " duration=" << duration << " tEnd=" << tEnd << " translation=" << asctime(localtime(&tEnd)) << "\n"; + if (myConstructionTime < tEnd) { + NBEdge* edge = myEdgeCont.retrieve(id); + if (edge != 0) { + myRemovedEdges++; + myEdgeCont.extract(myDistrictCont, edge, true); + } + if (myConstructionTime < tStart) { + myNotStarted++; + } else { + myUnderConstruction++; + } + } else { + myFinished++; + } + } else { + WRITE_WARNING(warning); + }; + } + return true; +} + + +void +NIImporter_DlrNavteq::TimeRestrictionsHandler::printSummary() { + if (myConstructionEntries > 0) { + char buff[1024]; + std::ostringstream msg; + strftime(buff, 1024, "%Y-%m-%d", localtime(&myCS_min)); + msg << "Parsed " << myConstructionEntries << " construction entries between " << buff; + strftime(buff, 1024, "%Y-%m-%d", localtime(&myCS_max)); + msg << " and " << buff << ".\n"; + strftime(buff, 1024, "%Y-%m-%d", localtime(&myConstructionTime)); + msg << "Removed " << myRemovedEdges << " edges not yet constructed at " << buff << ".\n"; + msg << " not yet started: " << myNotStarted << "\n"; + msg << " under construction: " << myUnderConstruction << "\n"; + msg << " finished: " << myFinished << "\n"; + WRITE_MESSAGE(msg.str()); + } +} + + +int +NIImporter_DlrNavteq::readPrefixedInt(const std::string& s, const std::string& prefix, int fallBack) { + int result = fallBack; + size_t pos = s.find(prefix); + if (pos != std::string::npos) { + sscanf(s.substr(pos).c_str(), (prefix + "%i").c_str(), &result); + } + return result; +} + +time_t +NIImporter_DlrNavteq::readTimeRec(const std::string& start, const std::string& duration) { + // http://www.cplusplus.com/reference/ctime/mktime/ + struct tm timeinfo; + timeinfo.tm_hour = 0; + timeinfo.tm_min = 0; + timeinfo.tm_sec = 0; + timeinfo.tm_year = 0; + timeinfo.tm_mon = 0; + timeinfo.tm_mday = 1; + timeinfo.tm_wday = 0; + timeinfo.tm_yday = 0; + timeinfo.tm_isdst = 0; + + timeinfo.tm_year = readPrefixedInt(start, "y") + readPrefixedInt(duration, "y") - 1900; + timeinfo.tm_mon = readPrefixedInt(start, "M") + readPrefixedInt(duration, "M") - 1; + timeinfo.tm_mday = 7 * (readPrefixedInt(start, "w") + readPrefixedInt(duration, "w")); + timeinfo.tm_mday += readPrefixedInt(start, "d") + readPrefixedInt(duration, "d"); + + time_t result = mktime(&timeinfo); + return result; +} + + +time_t +NIImporter_DlrNavteq::readDate(const std::string& yyyymmdd) { + struct tm timeinfo; + timeinfo.tm_hour = 0; + timeinfo.tm_min = 0; + timeinfo.tm_sec = 0; + timeinfo.tm_wday = 0; + timeinfo.tm_yday = 0; + timeinfo.tm_isdst = 0; + + if (yyyymmdd.size() == 10 + && yyyymmdd[4] == '-' + && yyyymmdd[7] == '-') { + try { + timeinfo.tm_year = TplConvert::_str2int(yyyymmdd.substr(0, 4)) - 1900; + timeinfo.tm_mon = TplConvert::_str2int(yyyymmdd.substr(5, 2)) - 1; + timeinfo.tm_mday = TplConvert::_str2int(yyyymmdd.substr(8, 2)); + return mktime(&timeinfo); + } catch (...) { + } + } + WRITE_ERROR("Could not parse YYYY-MM-DD date '" + yyyymmdd + "'"); + time_t now; + time(&now); + return now; +} + +// --------------------------------------------------------------------------- +// definitions of NIImporter_DlrNavteq::ProhibitionHandler-methods +// --------------------------------------------------------------------------- +NIImporter_DlrNavteq::ProhibitionHandler::ProhibitionHandler( + NBEdgeCont& ec, const std::string& file, time_t constructionTime) : + myEdgeCont(ec), + myFile(file), + myVersion(0), + myConstructionTime(constructionTime) { +} + + +NIImporter_DlrNavteq::ProhibitionHandler::~ProhibitionHandler() {} + + +bool +NIImporter_DlrNavteq::ProhibitionHandler::report(const std::string& result) { +// # NAME_ID Name + if (result[0] == '#') { + if (myVersion == 0) { + const double version = readVersion(result, myFile); + if (version > 0) { + myVersion = version; + } + } + return true; + } + StringTokenizer st(result, StringTokenizer::TAB); + if (st.size() == 1) { + return true; // one line with the number of data containing lines in it (also starts with a comment # since ersion 6.5) + } + if (myVersion >= 6) { + assert(st.size() >= 7); + const std::string id = st.next(); + const std::string permanent = st.next(); + const std::string validityPeriod = st.next(); + const std::string throughTraffic = st.next(); + const std::string vehicleType = st.next(); + if (validityPeriod != UNDEFINED) { + WRITE_WARNING("Ignoring temporary prohibited manoeuvre (" + validityPeriod + ")"); + return true; + } + } + const std::string startEdge = st.next(); + const std::string endEdge = st.get(st.size() - 1); + + NBEdge* from = myEdgeCont.retrieve(startEdge); + if (from == 0) { + WRITE_WARNING("Ignoring prohibition from unknown start edge '" + startEdge + "'"); + return true; + } + NBEdge* to = myEdgeCont.retrieve(endEdge); + if (to == 0) { + WRITE_WARNING("Ignoring prohibition from unknown end edge '" + endEdge + "'"); + return true; + } + from->removeFromConnections(to, -1, -1, true); + return true; +} + + +// --------------------------------------------------------------------------- +// definitions of NIImporter_DlrNavteq::ConnectedLanesHandler-methods +// --------------------------------------------------------------------------- +NIImporter_DlrNavteq::ConnectedLanesHandler::ConnectedLanesHandler( + NBEdgeCont& ec) : + myEdgeCont(ec) { +} + + +NIImporter_DlrNavteq::ConnectedLanesHandler::~ConnectedLanesHandler() {} + + +bool +NIImporter_DlrNavteq::ConnectedLanesHandler::report(const std::string& result) { + if (result[0] == '#') { + return true; + } + StringTokenizer st(result, StringTokenizer::TAB); + if (st.size() == 1) { + return true; // one line with the number of data containing lines in it (also starts with a comment # since ersion 6.5) + } + assert(st.size() >= 7); + const std::string nodeID = st.next(); + const std::string vehicleType = st.next(); + const std::string fromLaneS = st.next(); + const std::string toLaneS = st.next(); + const std::string throughTraffic = st.next(); + const std::string startEdge = st.next(); + const std::string endEdge = st.get(st.size() - 1); + + NBEdge* from = myEdgeCont.retrieve(startEdge); + if (from == 0) { + WRITE_WARNING("Ignoring prohibition from unknown start edge '" + startEdge + "'"); + return true; + } + NBEdge* to = myEdgeCont.retrieve(endEdge); + if (to == 0) { + WRITE_WARNING("Ignoring prohibition from unknown end edge '" + endEdge + "'"); + return true; + } + int fromLane = TplConvert::_2int(fromLaneS.c_str()) - 1; // one based + if (fromLane < 0 || fromLane >= from->getNumLanes()) { + WRITE_WARNING("Ignoring invalid lane index '" + fromLaneS + "' in connection from edge '" + startEdge + "' with " + toString(from->getNumLanes()) + " lanes"); + return true; + } + int toLane = TplConvert::_2int(toLaneS.c_str()) - 1; // one based + if (toLane < 0 || toLane >= to->getNumLanes()) { + WRITE_WARNING("Ignoring invalid lane index '" + toLaneS + "' in connection to edge '" + endEdge + "' with " + toString(to->getNumLanes()) + " lanes"); + return true; + } + if (!from->addLane2LaneConnection(fromLane, to, toLane, NBEdge::L2L_USER, true)) { + if (OptionsCont::getOptions().getBool("show-errors.connections-first-try")) { + WRITE_WARNING("Could not set loaded connection from '" + from->getLaneID(fromLane) + "' to '" + to->getLaneID(toLane) + "'."); + } + // set as to be re-applied after network processing + // if this connection runs across a node cluster it may not be possible to set this + const bool warnOnly = st.size() > 7; + myEdgeCont.addPostProcessConnection(from->getID(), fromLane, to->getID(), toLane, false, true, + NBEdge::UNSPECIFIED_CONTPOS, NBEdge::UNSPECIFIED_VISIBILITY_DISTANCE, warnOnly); + } + // ensure that connections for other lanes are guessed if not specified + from->declareConnectionsAsLoaded(NBEdge::INIT); + from->getLaneStruct(fromLane).connectionsDone = true; + return true; +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_DlrNavteq.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_DlrNavteq.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_DlrNavteq.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_DlrNavteq.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Mon, 14.04.2008 -/// @version $Id: NIImporter_DlrNavteq.h 21492 2016-09-19 07:21:24Z behrisch $ +/// @version $Id: NIImporter_DlrNavteq.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Importer for networks stored in Elmar's format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -77,6 +77,9 @@ /// @brief scaling factor for geo coordinates (DLRNavteq format uses this to increase floating point precisions) static const int GEO_SCALE; + /// @brief magic value for undefined stuff + static const std::string UNDEFINED; + protected: /** * @class NodesHandler @@ -194,7 +197,7 @@ bool myTryIgnoreNodePositions; /// @brief version number of current file - SUMOReal myVersion; + double myVersion; /// @brief the version number of the edge file being parsed std::vector myColumns; @@ -352,6 +355,172 @@ }; + + /** + * @class TimeRestrictionsHandler + * @brief Importer of street names in DLRNavteq's (aka elmar) format + * + * Being a LineHandler, this class retrieves each line from a LineReader + * and parses these information assuming they contain name definitions + * in DLRNavteq's format. + */ + class TimeRestrictionsHandler : public LineHandler { + public: + /** @brief Constructor + * @param[in] file The name of the parsed file + * @param[filled] streetNames output container for read names + */ + TimeRestrictionsHandler(NBEdgeCont& ec, NBDistrictCont& dc, time_t constructionTime); + + + /// @brief Destructor + ~TimeRestrictionsHandler(); + + + /** @brief Parsing method + * + * Implementation of the LineHandler-interface called by a LineReader; + * interprets the retrieved information and stores the streetNames + * @param[in] result The read line + * @return Whether the parsing shall continue + * @exception ProcessError if something fails + * @see LineHandler::report + */ + bool report(const std::string& result); + + void printSummary(); + + + protected: + /// @brief The edge container + NBEdgeCont& myEdgeCont; + NBDistrictCont& myDistrictCont; + + /// @brief The date for which to build the network (in case some edges are still under construction) + time_t myConstructionTime; + time_t myCS_min; + time_t myCS_max; + int myConstructionEntries; + int myNotStarted; + int myUnderConstruction; + int myFinished; + int myRemovedEdges; // only counts those not already removed through other options + + + private: + /// @brief Invalidated copy constructor. + TimeRestrictionsHandler(const TimeRestrictionsHandler&); + + /// @brief Invalidated assignment operator. + TimeRestrictionsHandler& operator=(const TimeRestrictionsHandler&); + + }; + + + /** + * @class ProhibitionHandler + * @brief Imports prohibitions regarding connectivity + * + * Being a LineHandler, this class retrieves each line from a LineReader + * and parses these information assuming they contain prohibited manoeuver definitions + * in DLRNavteq's format. + */ + class ProhibitionHandler : public LineHandler { + public: + /** @brief Constructor + * @param[in] file The name of the parsed file + * @param[filled] streetNames output container for read names + */ + ProhibitionHandler(NBEdgeCont& ne, const std::string& file, time_t constructionTime); + + + /// @brief Destructor + ~ProhibitionHandler(); + + + /** @brief Parsing method + * + * Implementation of the LineHandler-interface called by a LineReader; + * interprets the retrieved information and stores the streetNames + * @param[in] result The read line + * @return Whether the parsing shall continue + * @exception ProcessError if something fails + * @see LineHandler::report + */ + bool report(const std::string& result); + + + protected: + /// @brief The edge container to store loaded edges into + NBEdgeCont& myEdgeCont; + const std::string myFile; + double myVersion; + time_t myConstructionTime; + + + private: + /// @brief Invalidated copy constructor. + ProhibitionHandler(const ProhibitionHandler&); + + /// @brief Invalidated assignment operator. + ProhibitionHandler& operator=(const ProhibitionHandler&); + + }; + + + /** + * @class ConnectedLanesHandler + * @brief Imports prohibitions regarding connectivity + * + * Being a LineHandler, this class retrieves each line from a LineReader + * and parses these information assuming they contain prohibited manoeuver definitions + * in DLRNavteq's format. + */ + class ConnectedLanesHandler : public LineHandler { + public: + /** @brief Constructor + * @param[in] file The name of the parsed file + * @param[filled] streetNames output container for read names + */ + ConnectedLanesHandler(NBEdgeCont& ne); + + + /// @brief Destructor + ~ConnectedLanesHandler(); + + + /** @brief Parsing method + * + * Implementation of the LineHandler-interface called by a LineReader; + * interprets the retrieved information and stores the streetNames + * @param[in] result The read line + * @return Whether the parsing shall continue + * @exception ProcessError if something fails + * @see LineHandler::report + */ + bool report(const std::string& result); + + + protected: + /// @brief The edge container to store loaded edges into + NBEdgeCont& myEdgeCont; + + + private: + /// @brief Invalidated copy constructor. + ConnectedLanesHandler(const ConnectedLanesHandler&); + + /// @brief Invalidated assignment operator. + ConnectedLanesHandler& operator=(const ConnectedLanesHandler&); + + }; + + + static double readVersion(const std::string& line, const std::string& file); + static int readPrefixedInt(const std::string& s, const std::string& prefix, int fallBack = 0); + static time_t readTimeRec(const std::string& start, const std::string& duration); + static time_t readDate(const std::string& yyyymmdd); + }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_ITSUMO.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_ITSUMO.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_ITSUMO.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_ITSUMO.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 2011-09-16 -/// @version $Id: NIImporter_ITSUMO.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NIImporter_ITSUMO.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Importer for networks stored in ITSUMO format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -49,10 +49,6 @@ #include "NILoader.h" #include "NIImporter_ITSUMO.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== @@ -236,10 +232,10 @@ case ITSUMO_TAG_NODE: { try { std::string id = myParameter["id"]; - SUMOReal x = TplConvert::_2SUMOReal(myParameter["x"].c_str()); - SUMOReal y = TplConvert::_2SUMOReal(myParameter["y"].c_str()); + double x = TplConvert::_2double(myParameter["x"].c_str()); + double y = TplConvert::_2double(myParameter["y"].c_str()); Position pos(x, y); - if (!NBNetBuilder::transformCoordinates(pos)) { + if (!NBNetBuilder::transformCoordinate(pos)) { WRITE_ERROR("Unable to project coordinates for node '" + id + "'."); } NBNode* node = new NBNode(id, pos); @@ -273,11 +269,11 @@ if (myLaneSets.find(id) != myLaneSets.end()) { WRITE_ERROR("Fond laneset-id '" + id + "' twice."); } else { - SUMOReal vSum = 0; + double vSum = 0; for (std::vector::iterator j = myCurrentLanes.begin(); j != myCurrentLanes.end(); ++j) { vSum += (*j).v; } - vSum /= (SUMOReal) myCurrentLanes.size(); + vSum /= (double) myCurrentLanes.size(); LaneSet* ls = new LaneSet(id, myCurrentLanes, vSum, i, from, to); myLaneSets[id] = ls; myCurrentLaneSets.push_back(ls); @@ -295,7 +291,7 @@ try { std::string id = myParameter["laneID"]; int i = TplConvert::_2int(myParameter["i"].c_str()); - SUMOReal v = TplConvert::_2SUMOReal(myParameter["v"].c_str()); + double v = TplConvert::_2double(myParameter["v"].c_str()); myCurrentLanes.push_back(Lane(id, (int) i, v)); } catch (NumberFormatException&) { WRITE_ERROR("Not numeric value in lane '" + myParameter["laneID"] + "'."); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_ITSUMO.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_ITSUMO.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_ITSUMO.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_ITSUMO.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIImporter_ITSUMO.h /// @author Daniel Krajzewicz /// @date 2011-09-16 -/// @version $Id: NIImporter_ITSUMO.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NIImporter_ITSUMO.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Importer for networks stored in ITSUMO format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -136,22 +136,22 @@ struct Lane { public: - Lane(const std::string& _id, int _idx, SUMOReal _v) + Lane(const std::string& _id, int _idx, double _v) : id(_id), index(_idx), v(_v) {} std::string id; int index; - SUMOReal v; + double v; }; std::vector myCurrentLanes; struct LaneSet { public: - LaneSet(const std::string& _id, const std::vector& _lanes, SUMOReal _v, int _pos, NBNode* _from, NBNode* _to) + LaneSet(const std::string& _id, const std::vector& _lanes, double _v, int _pos, NBNode* _from, NBNode* _to) : id(_id), lanes(_lanes), v(_v), position(_pos), from(_from), to(_to) {} std::string id; std::vector lanes; - SUMOReal v; + double v; int position; NBNode* from; NBNode* to; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_MATSim.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_MATSim.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_MATSim.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_MATSim.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 26.04.2011 -/// @version $Id: NIImporter_MATSim.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NIImporter_MATSim.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Importer for networks stored in MATSim format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -49,10 +49,6 @@ #include "NILoader.h" #include "NIImporter_MATSim.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== @@ -151,13 +147,13 @@ // get the id, report a warning if not given or empty... bool ok = true; std::string id = attrs.get(MATSIM_ATTR_ID, 0, ok); - SUMOReal x = attrs.get(MATSIM_ATTR_X, id.c_str(), ok); - SUMOReal y = attrs.get(MATSIM_ATTR_Y, id.c_str(), ok); + double x = attrs.get(MATSIM_ATTR_X, id.c_str(), ok); + double y = attrs.get(MATSIM_ATTR_Y, id.c_str(), ok); if (!ok) { return; } Position pos(x, y); - if (!NBNetBuilder::transformCoordinates(pos)) { + if (!NBNetBuilder::transformCoordinate(pos)) { WRITE_ERROR("Unable to project coordinates for node '" + id + "'."); } NBNode* node = new NBNode(id, pos); @@ -195,7 +191,7 @@ if (attrs.hasAttribute(MATSIM_ATTR_CAPDIVIDER)) { int capDivider = attrs.get(MATSIM_ATTR_CAPDIVIDER, "network", ok); if (ok) { - myCapacityNorm = (SUMOReal)(capDivider * 3600); + myCapacityNorm = (double)(capDivider * 3600); } } } @@ -211,7 +207,7 @@ int hours = TplConvert::_2int(st.next().c_str()); int minutes = TplConvert::_2int(st.next().c_str()); int seconds = TplConvert::_2int(st.next().c_str()); - myCapacityNorm = (SUMOReal)(hours * 3600 + minutes * 60 + seconds); + myCapacityNorm = (double)(hours * 3600 + minutes * 60 + seconds); } catch (NumberFormatException&) { } catch (EmptyData&) { } @@ -225,10 +221,10 @@ std::string id = attrs.get(MATSIM_ATTR_ID, 0, ok); std::string fromNodeID = attrs.get(MATSIM_ATTR_FROM, id.c_str(), ok); std::string toNodeID = attrs.get(MATSIM_ATTR_TO, id.c_str(), ok); - SUMOReal length = attrs.get(MATSIM_ATTR_LENGTH, id.c_str(), ok); // override computed? - SUMOReal freeSpeed = attrs.get(MATSIM_ATTR_FREESPEED, id.c_str(), ok); // - SUMOReal capacity = attrs.get(MATSIM_ATTR_CAPACITY, id.c_str(), ok); // override permLanes? - SUMOReal permLanes = attrs.get(MATSIM_ATTR_PERMLANES, id.c_str(), ok); + double length = attrs.get(MATSIM_ATTR_LENGTH, id.c_str(), ok); // override computed? + double freeSpeed = attrs.get(MATSIM_ATTR_FREESPEED, id.c_str(), ok); // + double capacity = attrs.get(MATSIM_ATTR_CAPACITY, id.c_str(), ok); // override permLanes? + double permLanes = attrs.get(MATSIM_ATTR_PERMLANES, id.c_str(), ok); //bool oneWay = attrs.getOpt(MATSIM_ATTR_ONEWAY, id.c_str(), ok, true); // mandatory? std::string modes = attrs.getOpt(MATSIM_ATTR_MODES, id.c_str(), ok, ""); // which values? std::string origid = attrs.getOpt(MATSIM_ATTR_ORIGID, id.c_str(), ok, ""); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_MATSim.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_MATSim.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_MATSim.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_MATSim.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Tue, 26.04.2011 -/// @version $Id: NIImporter_MATSim.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIImporter_MATSim.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Importer for networks stored in MATSim format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -169,7 +169,7 @@ NBEdgeCont& myEdgeCont; /// @brief The capacity norming - SUMOReal myCapacityNorm; + double myCapacityNorm; /// @brief Whether the loaded lengths shal be used bool myKeepEdgeLengths; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_OpenDrive.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_OpenDrive.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_OpenDrive.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_OpenDrive.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Mon, 14.04.2008 -/// @version $Id: NIImporter_OpenDrive.cpp 21744 2016-10-18 13:02:24Z namdre $ +/// @version $Id: NIImporter_OpenDrive.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Importer for networks stored in openDrive format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -57,15 +57,10 @@ #include "NILoader.h" #include "NIImporter_OpenDrive.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // definitions // =========================================================================== -#define C_LENGTH 10. // =========================================================================== // static variables @@ -82,6 +77,7 @@ { "poly3", NIImporter_OpenDrive::OPENDRIVE_TAG_POLY3 }, { "paramPoly3", NIImporter_OpenDrive::OPENDRIVE_TAG_PARAMPOLY3 }, { "laneSection", NIImporter_OpenDrive::OPENDRIVE_TAG_LANESECTION }, + { "laneOffset", NIImporter_OpenDrive::OPENDRIVE_TAG_LANEOFFSET }, { "left", NIImporter_OpenDrive::OPENDRIVE_TAG_LEFT }, { "center", NIImporter_OpenDrive::OPENDRIVE_TAG_CENTER }, { "right", NIImporter_OpenDrive::OPENDRIVE_TAG_RIGHT }, @@ -212,6 +208,7 @@ } // build nodes for (std::map::iterator i = posMap.begin(); i != posMap.end(); ++i) { + //std::cout << " import node=" << (*i).first << " z=" << (*i).second.getCenter() << " boundary=" << (*i).second << "\n"; if (!nb.getNodeCont().insert((*i).first, (*i).second.getCenter())) { throw ProcessError("Could not add node '" + (*i).first + "'."); } @@ -324,7 +321,7 @@ // ------------------------- // edge building // ------------------------- - SUMOReal defaultSpeed = tc.getSpeed(""); + double defaultSpeed = tc.getSpeed(""); // build edges for (std::map::iterator i = outerEdges.begin(); i != outerEdges.end(); ++i) { OpenDriveEdge* e = (*i).second; @@ -340,11 +337,11 @@ NBNode* sTo = e->to; int priorityR = e->getPriority(OPENDRIVE_TAG_RIGHT); int priorityL = e->getPriority(OPENDRIVE_TAG_LEFT); - SUMOReal sB = 0; - SUMOReal sE = e->length; + double sB = 0; + double sE = e->length; // 0-length geometries are possible if only the inner points are represented - const SUMOReal length2D = e->geom.length2D(); - SUMOReal cF = length2D == 0 ? 1 : e->length / length2D; + const double length2D = e->geom.length2D(); + double cF = length2D == 0 ? 1 : e->length / length2D; NBEdge* prevRight = 0; NBEdge* prevLeft = 0; @@ -364,7 +361,7 @@ sTo = e->to; sE = e->length / cF; } else { - SUMOReal nextS = (j + 1)->s; + double nextS = (j + 1)->s; sTo = new NBNode(e->id + "." + toString(nextS), e->geom.positionAtOffset(nextS)); if (!nb.getNodeCont().insert(sTo)) { throw ProcessError("Could not add node '" + sTo->getID() + "'."); @@ -384,9 +381,6 @@ if ((*j).rightLaneNumber > 0) { currRight = new NBEdge("-" + id, sFrom, sTo, (*j).rightType, defaultSpeed, (*j).rightLaneNumber, priorityR, NBEdge::UNSPECIFIED_WIDTH, NBEdge::UNSPECIFIED_OFFSET, geom, e->streetName, id, LANESPREAD_RIGHT, true); - if (!nb.getEdgeCont().insert(currRight, myImportAllTypes)) { - throw ProcessError("Could not add edge '" + currRight->getID() + "'."); - } lanesBuilt = true; const std::vector& lanes = (*j).lanesByDir[OPENDRIVE_TAG_RIGHT]; for (std::vector::const_iterator k = lanes.begin(); k != lanes.end(); ++k) { @@ -396,20 +390,27 @@ NBEdge::Lane& sumoLane = currRight->getLaneStruct(sumoLaneIndex); const OpenDriveLane& odLane = *k; - sumoLane.origID = e->id + " -" + toString((*k).id); + sumoLane.origID = e->id + "_" + toString((*k).id); sumoLane.speed = odLane.speed != 0 ? odLane.speed : tc.getSpeed(odLane.type); sumoLane.permissions = tc.getPermissions(odLane.type); sumoLane.width = myImportWidths && odLane.width != 0 ? odLane.width : tc.getWidth(odLane.type); } } - // connect lane sections - if (prevRight != 0) { - std::map connections = (*j).getInnerConnections(OPENDRIVE_TAG_RIGHT, *(j - 1)); - for (std::map::const_iterator k = connections.begin(); k != connections.end(); ++k) { - prevRight->addLane2LaneConnection((*k).first, currRight, (*k).second, NBEdge::L2L_VALIDATED); + if (!nb.getEdgeCont().insert(currRight, myImportAllTypes)) { + throw ProcessError("Could not add edge '" + currRight->getID() + "'."); + } + if (nb.getEdgeCont().wasIgnored(id)) { + prevRight = 0; + } else { + // connect lane sections + if (prevRight != 0) { + std::map connections = (*j).getInnerConnections(OPENDRIVE_TAG_RIGHT, *(j - 1)); + for (std::map::const_iterator k = connections.begin(); k != connections.end(); ++k) { + prevRight->addLane2LaneConnection((*k).first, currRight, (*k).second, NBEdge::L2L_VALIDATED); + } } + prevRight = currRight; } - prevRight = currRight; } // build lanes to left @@ -417,9 +418,6 @@ if ((*j).leftLaneNumber > 0) { currLeft = new NBEdge(id, sTo, sFrom, (*j).leftType, defaultSpeed, (*j).leftLaneNumber, priorityL, NBEdge::UNSPECIFIED_WIDTH, NBEdge::UNSPECIFIED_OFFSET, geom.reverse(), e->streetName, id, LANESPREAD_RIGHT, true); - if (!nb.getEdgeCont().insert(currLeft, myImportAllTypes)) { - throw ProcessError("Could not add edge '" + currLeft->getID() + "'."); - } lanesBuilt = true; const std::vector& lanes = (*j).lanesByDir[OPENDRIVE_TAG_LEFT]; for (std::vector::const_iterator k = lanes.begin(); k != lanes.end(); ++k) { @@ -429,20 +427,27 @@ NBEdge::Lane& sumoLane = currLeft->getLaneStruct(sumoLaneIndex); const OpenDriveLane& odLane = *k; - sumoLane.origID = e->id + " " + toString((*k).id); + sumoLane.origID = e->id + "_" + toString((*k).id); sumoLane.speed = odLane.speed != 0 ? odLane.speed : tc.getSpeed(odLane.type); sumoLane.permissions = tc.getPermissions(odLane.type); sumoLane.width = myImportWidths && odLane.width != 0 ? odLane.width : tc.getWidth(odLane.type); } } - // connect lane sections - if (prevLeft != 0) { - std::map connections = (*j).getInnerConnections(OPENDRIVE_TAG_LEFT, *(j - 1)); - for (std::map::const_iterator k = connections.begin(); k != connections.end(); ++k) { - currLeft->addLane2LaneConnection((*k).first, prevLeft, (*k).second, NBEdge::L2L_VALIDATED); + if (!nb.getEdgeCont().insert(currLeft, myImportAllTypes)) { + throw ProcessError("Could not add edge '" + currLeft->getID() + "'."); + } + if (nb.getEdgeCont().wasIgnored(id)) { + prevLeft = 0; + } else { + // connect lane sections + if (prevLeft != 0) { + std::map connections = (*j).getInnerConnections(OPENDRIVE_TAG_LEFT, *(j - 1)); + for (std::map::const_iterator k = connections.begin(); k != connections.end(); ++k) { + currLeft->addLane2LaneConnection((*k).first, prevLeft, (*k).second, NBEdge::L2L_VALIDATED); + } } + prevLeft = currLeft; } - prevLeft = currLeft; } (*j).sumoID = id; @@ -473,7 +478,8 @@ continue; } if (innerEdges.find((*i).toEdge) != innerEdges.end()) { - buildConnectionsToOuter(*i, innerEdges, connections2); + std::set seen; + buildConnectionsToOuter(*i, innerEdges, connections2, seen); } else { connections2.push_back(*i); } @@ -535,7 +541,7 @@ std::vector& cons = from->getConnections(); for (std::vector::iterator k = cons.begin(); k != cons.end(); ++k) { if ((*k).fromLane == fromLane && (*k).toEdge == to && (*k).toLane == toLane) { - (*k).origID = (*i).origID + " " + toString((*i).origLane); + (*k).origID = (*i).origID + "_" + toString((*i).origLane); break; } } @@ -639,26 +645,47 @@ void -NIImporter_OpenDrive::buildConnectionsToOuter(const Connection& c, const std::map& innerEdges, std::vector& into) { +NIImporter_OpenDrive::buildConnectionsToOuter(const Connection& c, const std::map& innerEdges, std::vector& into, std::set& seen) { + //std::cout << "buildConnectionsToOuter " + // << " seen=" << seen.size() + // << " from=" << c.fromEdge + // << " to=" << c.toEdge + // << " fromLane=" << c.fromLane + // << " toLane=" << c.toLane + // << " fromCP=" << c.fromCP + // << " toCP=" << c.toCP + // << " all=" << c.all + // << " origID=" << c.origID + // << " origLane=" << c.origLane + // << " seenlist="; + //for (std::set::const_iterator i = seen.begin(); i != seen.end(); ++i) { + // std::cout << (*i).fromEdge << "," << (*i).toEdge << " "; + //} + //std::cout << "\n"; OpenDriveEdge* dest = innerEdges.find(c.toEdge)->second; if (dest == 0) { /// !!! should not, look in all? return; } + seen.insert(c); const std::set& conts = dest->connections; for (std::set::const_iterator i = conts.begin(); i != conts.end(); ++i) { if (innerEdges.find((*i).toEdge) != innerEdges.end()) { std::vector t; - buildConnectionsToOuter(*i, innerEdges, t); - for (std::vector::const_iterator j = t.begin(); j != t.end(); ++j) { - // @todo this section is unverified - Connection cn = (*j); - cn.fromEdge = c.fromEdge; - cn.fromLane = c.fromLane; - cn.fromCP = c.fromCP; - cn.all = c.all; // @todo "all" is a hack trying to avoid the "from is zero" problem; - into.push_back(cn); + if (seen.count(*i) == 0) { + buildConnectionsToOuter(*i, innerEdges, t, seen); + for (std::vector::const_iterator j = t.begin(); j != t.end(); ++j) { + // @todo this section is unverified + Connection cn = (*j); + cn.fromEdge = c.fromEdge; + cn.fromLane = c.fromLane; + cn.fromCP = c.fromCP; + cn.all = c.all; // @todo "all" is a hack trying to avoid the "from is zero" problem; + into.push_back(cn); + } + } else { + WRITE_WARNING("Circular connections in junction including roads '" + c.fromEdge + "' and '" + c.toEdge + "', loop size " + toString(seen.size())); } } else { if ((*i).fromLane == c.toLane) { @@ -794,6 +821,7 @@ void NIImporter_OpenDrive::computeShapes(std::map& edges) { OptionsCont& oc = OptionsCont::getOptions(); + const double res = oc.getFloat("opendrive.curve-resolution"); for (std::map::iterator i = edges.begin(); i != edges.end(); ++i) { OpenDriveEdge& e = *(*i).second; GeometryType prevType = OPENDRIVE_GT_UNKNOWN; @@ -807,16 +835,16 @@ geom = geomFromLine(e, g); break; case OPENDRIVE_GT_SPIRAL: - geom = geomFromSpiral(e, g); + geom = geomFromSpiral(e, g, res); break; case OPENDRIVE_GT_ARC: - geom = geomFromArc(e, g); + geom = geomFromArc(e, g, res); break; case OPENDRIVE_GT_POLY3: - geom = geomFromPoly(e, g); + geom = geomFromPoly(e, g, res); break; case OPENDRIVE_GT_PARAMPOLY3: - geom = geomFromParamPoly(e, g); + geom = geomFromParamPoly(e, g, res); break; default: break; @@ -831,6 +859,7 @@ } e.geom.pop_back(); } + //std::cout << " adding geometry to road=" << e.id << " old=" << e.geom << " new=" << geom << "\n"; for (PositionVector::iterator k = geom.begin(); k != geom.end(); ++k) { e.geom.push_back_noDoublePos(*k); } @@ -839,21 +868,19 @@ if (oc.exists("geometry.min-dist") && !oc.isDefault("geometry.min-dist")) { e.geom.removeDoublePoints(oc.getFloat("geometry.min-dist"), true); } - for (int j = 0; j < (int)e.geom.size(); ++j) { - if (!NBNetBuilder::transformCoordinates(e.geom[j])) { - WRITE_ERROR("Unable to project coordinates for."); - } + if (!NBNetBuilder::transformCoordinates(e.geom)) { + WRITE_ERROR("Unable to project coordinates for edge '" + e.id + "'."); } // add z-data int k = 0; - SUMOReal pos = 0; + double pos = 0; for (std::vector::iterator j = e.elevations.begin(); j != e.elevations.end(); ++j) { const OpenDriveElevation& el = *j; - const SUMOReal sNext = (j + 1) == e.elevations.end() ? std::numeric_limits::max() : (*(j + 1)).s; + const double sNext = (j + 1) == e.elevations.end() ? std::numeric_limits::max() : (*(j + 1)).s; while (k < (int)e.geom.size() && pos < sNext) { - const SUMOReal ds = pos - el.s; - const SUMOReal z = el.a + el.b * ds + el.c * ds * ds + el.d * ds * ds * ds; - //std::cout << " edge=" << e.id << " k=" << k << " sNext=" << sNext << " pos=" << pos << " z=" << z << " pos=" << pos << " ds=" << ds << " el.s=" << el.s << "el.a=" << el.a << " el.b=" << el.b << " el.c=" << el.c << " el.d=" << el.d << "\n"; + const double ds = pos - el.s; + const double z = el.a + el.b * ds + el.c * ds * ds + el.d * ds * ds * ds; + //std::cout << " edge=" << e.id << " k=" << k << " sNext=" << sNext << " pos=" << pos << " z=" << z << " ds=" << ds << " el.s=" << el.s << "el.a=" << el.a << " el.b=" << el.b << " el.c=" << el.c << " el.d=" << el.d << "\n"; e.geom[k].add(0, 0, z); k++; if (k < (int)e.geom.size()) { @@ -863,6 +890,57 @@ } } } + // add laneoffset + if (e.offsets.size() > 0) { + // make sure there are intermediate points for each offset-section + for (std::vector::iterator j = e.offsets.begin(); j != e.offsets.end(); ++j) { + const OpenDriveLaneOffset& el = *j; + // check wether we need to insert a new point at dist + Position pS = e.geom.positionAtOffset2D(el.s); + int iS = e.geom.indexOfClosest(pS); + // prevent close spacing to reduce impact of rounding errors in z-axis + if (pS.distanceTo2D(e.geom[iS]) > POSITION_EPS) { + e.geom.insertAtClosest(pS); + //std::cout << " edge=" << e.id << " inserting pos=" << pS << " s=" << el.s << " iS=" << iS << " dist=" << pS.distanceTo2D(e.geom[iS]) << "\n"; + } + } + // XXX add further points for sections with non-constant offset + // shift each point orthogonally by the specified offset + int k = 0; + double pos = 0; + PositionVector geom2; + for (std::vector::iterator j = e.offsets.begin(); j != e.offsets.end(); ++j) { + const OpenDriveLaneOffset& el = *j; + const double sNext = (j + 1) == e.offsets.end() ? std::numeric_limits::max() : (*(j + 1)).s; + while (k < (int)e.geom.size() && pos < sNext) { + const double ds = pos - el.s; + const double offset = el.a + el.b * ds + el.c * ds * ds + el.d * ds * ds * ds; + //std::cout << " edge=" << e.id << " k=" << k << " sNext=" << sNext << " pos=" << pos << " offset=" << offset << " ds=" << ds << " el.s=" << el.s << "el.a=" << el.a << " el.b=" << el.b << " el.c=" << el.c << " el.d=" << el.d << "\n"; + if (fabs(offset) > POSITION_EPS) { + try { + PositionVector tmp = e.geom; + // XXX shifting the whole geometry is inefficient. could also use positionAtOffset(lateralOffset=...) + tmp.move2side(-offset); + //std::cout << " edge=" << e.id << " k=" << k << " offset=" << offset << " geom[k]=" << e.geom[k] << " tmp[k]=" << tmp[k] << " gSize=" << e.geom.size() << " tSize=" << tmp.size() << " geom=" << e.geom << " tmp=" << tmp << "\n"; + geom2.push_back(tmp[k]); + } catch (InvalidArgument&) { + geom2.push_back(e.geom[k]); + } + } else { + geom2.push_back(e.geom[k]); + } + k++; + if (k < (int)e.geom.size()) { + // XXX pos understimates the actual position since the + // actual geometry between k-1 and k could be curved + pos += e.geom[k - 1].distanceTo2D(e.geom[k]); + } + } + } + assert(e.geom.size() == geom2.size()); + e.geom = geom2; + } + //std::cout << " loaded geometry " << e.id << "=" << e.geom << "\n"; } } @@ -886,7 +964,7 @@ e.laneSections = newSections; laneSections = e.laneSections; - SUMOReal lastS = -1; + double lastS = -1; // check whether the lane sections are in the right order bool sorted = true; for (std::vector::const_iterator j = laneSections.begin(); j != laneSections.end() && sorted; ++j) { @@ -927,16 +1005,16 @@ PositionVector -NIImporter_OpenDrive::geomFromSpiral(const OpenDriveEdge& e, const OpenDriveGeometry& g) { +NIImporter_OpenDrive::geomFromSpiral(const OpenDriveEdge& e, const OpenDriveGeometry& g, double resolution) { UNUSED_PARAMETER(e); PositionVector ret; - SUMOReal curveStart = g.params[0]; - SUMOReal curveEnd = g.params[1]; + double curveStart = g.params[0]; + double curveEnd = g.params[1]; Point2D end; try { EulerSpiral s(Point2D(g.x, g.y), g.hdg, curveStart, (curveEnd - curveStart) / g.length, g.length); std::vector > into; - s.computeSpiral(into, 1.); + s.computeSpiral(into, resolution); for (std::vector >::iterator i = into.begin(); i != into.end(); ++i) { ret.push_back(Position((*i).getX(), (*i).getY())); } @@ -949,26 +1027,26 @@ PositionVector -NIImporter_OpenDrive::geomFromArc(const OpenDriveEdge& e, const OpenDriveGeometry& g) { +NIImporter_OpenDrive::geomFromArc(const OpenDriveEdge& e, const OpenDriveGeometry& g, double resolution) { UNUSED_PARAMETER(e); PositionVector ret; - SUMOReal dist = 0.0; - SUMOReal centerX = g.x; - SUMOReal centerY = g.y; + double dist = 0.0; + double centerX = g.x; + double centerY = g.y; // left: positive value - SUMOReal curvature = g.params[0]; - SUMOReal radius = 1. / curvature; + double curvature = g.params[0]; + double radius = 1. / curvature; // center point calculateCurveCenter(¢erX, ¢erY, radius, g.hdg); - SUMOReal endX = g.x; - SUMOReal endY = g.y; - SUMOReal startX = g.x; - SUMOReal startY = g.y; - SUMOReal geo_posS = g.s; - SUMOReal geo_posE = g.s; + double endX = g.x; + double endY = g.y; + double startX = g.x; + double startY = g.y; + double geo_posS = g.s; + double geo_posE = g.s; bool end = false; do { - geo_posE += C_LENGTH; + geo_posE += resolution; if (geo_posE - g.s > g.length) { geo_posE = g.s + g.length; } @@ -994,16 +1072,16 @@ PositionVector -NIImporter_OpenDrive::geomFromPoly(const OpenDriveEdge& e, const OpenDriveGeometry& g) { +NIImporter_OpenDrive::geomFromPoly(const OpenDriveEdge& e, const OpenDriveGeometry& g, double resolution) { UNUSED_PARAMETER(e); - const SUMOReal s = sin(g.hdg); - const SUMOReal c = cos(g.hdg); + const double s = sin(g.hdg); + const double c = cos(g.hdg); PositionVector ret; - for (SUMOReal off = 0; off < g.length + 2.; off += 2.) { - SUMOReal x = off; - SUMOReal y = g.params[0] + g.params[1] * off + g.params[2] * pow(off, 2.) + g.params[3] * pow(off, 3.); - SUMOReal xnew = x * c - y * s; - SUMOReal ynew = x * s + y * c; + for (double off = 0; off < g.length + 2.; off += resolution) { + double x = off; + double y = g.params[0] + g.params[1] * off + g.params[2] * pow(off, 2.) + g.params[3] * pow(off, 3.); + double xnew = x * c - y * s; + double ynew = x * s + y * c; ret.push_back(Position(g.x + xnew, g.y + ynew)); } return ret.getSubpart2D(0, g.length); @@ -1011,19 +1089,18 @@ PositionVector -NIImporter_OpenDrive::geomFromParamPoly(const OpenDriveEdge& e, const OpenDriveGeometry& g) { +NIImporter_OpenDrive::geomFromParamPoly(const OpenDriveEdge& e, const OpenDriveGeometry& g, double resolution) { UNUSED_PARAMETER(e); - const SUMOReal s = sin(g.hdg); - const SUMOReal c = cos(g.hdg); - const SUMOReal pMax = g.params[8]; - // import with 2m resolution - const SUMOReal pStep = pMax / ceil(g.length / 2.0); + const double s = sin(g.hdg); + const double c = cos(g.hdg); + const double pMax = g.params[8]; + const double pStep = pMax / ceil(g.length / resolution); PositionVector ret; - for (SUMOReal p = 0; p < pMax + pStep; p += pStep) { - SUMOReal x = g.params[0] + g.params[1] * p + g.params[2] * pow(p, 2.) + g.params[3] * pow(p, 3.); - SUMOReal y = g.params[4] + g.params[5] * p + g.params[6] * pow(p, 2.) + g.params[7] * pow(p, 3.); - SUMOReal xnew = x * c - y * s; - SUMOReal ynew = x * s + y * c; + for (double p = 0; p <= pMax + pStep; p += pStep) { + double x = g.params[0] + g.params[1] * p + g.params[2] * pow(p, 2.) + g.params[3] * pow(p, 3.); + double y = g.params[4] + g.params[5] * p + g.params[6] * pow(p, 2.) + g.params[7] * pow(p, 3.); + double xnew = x * c - y * s; + double ynew = x * s + y * c; ret.push_back(Position(g.x + xnew, g.y + ynew)); } return ret.getSubpart2D(0, g.length); @@ -1043,11 +1120,11 @@ void -NIImporter_OpenDrive::calculateCurveCenter(SUMOReal* ad_x, SUMOReal* ad_y, SUMOReal ad_radius, SUMOReal ad_hdg) { - SUMOReal normX = 1.0; - SUMOReal normY = 0.0; - SUMOReal tmpX; - SUMOReal turn; +NIImporter_OpenDrive::calculateCurveCenter(double* ad_x, double* ad_y, double ad_radius, double ad_hdg) { + double normX = 1.0; + double normY = 0.0; + double tmpX; + double turn; if (ad_radius > 0) { turn = -1.0; } else { @@ -1071,8 +1148,8 @@ void -NIImporter_OpenDrive::calcPointOnCurve(SUMOReal* ad_x, SUMOReal* ad_y, SUMOReal ad_centerX, SUMOReal ad_centerY, - SUMOReal ad_r, SUMOReal ad_length) { +NIImporter_OpenDrive::calcPointOnCurve(double* ad_x, double* ad_y, double ad_centerX, double ad_centerY, + double ad_r, double ad_length) { double rotAngle = ad_length / fabs(ad_r); double vx = *ad_x - ad_centerX; double vy = *ad_y - ad_centerY; @@ -1095,7 +1172,7 @@ // --------------------------------------------------------------------------- // section // --------------------------------------------------------------------------- -NIImporter_OpenDrive::OpenDriveLaneSection::OpenDriveLaneSection(SUMOReal sArg) : s(sArg) { +NIImporter_OpenDrive::OpenDriveLaneSection::OpenDriveLaneSection(double sArg) : s(sArg) { lanesByDir[OPENDRIVE_TAG_LEFT] = std::vector(); lanesByDir[OPENDRIVE_TAG_RIGHT] = std::vector(); lanesByDir[OPENDRIVE_TAG_CENTER] = std::vector(); @@ -1177,20 +1254,20 @@ NIImporter_OpenDrive::OpenDriveLaneSection -NIImporter_OpenDrive::OpenDriveLaneSection::buildLaneSection(SUMOReal startPos) { +NIImporter_OpenDrive::OpenDriveLaneSection::buildLaneSection(double startPos) { OpenDriveLaneSection ret(*this); ret.s += startPos; for (int k = 0; k < (int)ret.lanesByDir[OPENDRIVE_TAG_RIGHT].size(); ++k) { OpenDriveLane& l = ret.lanesByDir[OPENDRIVE_TAG_RIGHT][k]; l.speed = 0; - std::vector >::const_iterator i = std::find_if(l.speeds.begin(), l.speeds.end(), same_position_finder(startPos)); + std::vector >::const_iterator i = std::find_if(l.speeds.begin(), l.speeds.end(), same_position_finder(startPos)); if (i != l.speeds.end()) { l.speed = (*i).second; } } for (int k = 0; k < (int)ret.lanesByDir[OPENDRIVE_TAG_LEFT].size(); ++k) { OpenDriveLane& l = ret.lanesByDir[OPENDRIVE_TAG_LEFT][k]; - std::vector >::const_iterator i = std::find_if(l.speeds.begin(), l.speeds.end(), same_position_finder(startPos)); + std::vector >::const_iterator i = std::find_if(l.speeds.begin(), l.speeds.end(), same_position_finder(startPos)); l.speed = 0; if (i != l.speeds.end()) { l.speed = (*i).second; @@ -1202,10 +1279,10 @@ bool NIImporter_OpenDrive::OpenDriveLaneSection::buildSpeedChanges(const NBTypeCont& tc, std::vector& newSections) { - std::set speedChangePositions; + std::set speedChangePositions; // collect speed change positions and apply initial speed to the begin for (std::vector::iterator k = lanesByDir[OPENDRIVE_TAG_RIGHT].begin(); k != lanesByDir[OPENDRIVE_TAG_RIGHT].end(); ++k) { - for (std::vector >::const_iterator l = (*k).speeds.begin(); l != (*k).speeds.end(); ++l) { + for (std::vector >::const_iterator l = (*k).speeds.begin(); l != (*k).speeds.end(); ++l) { speedChangePositions.insert((*l).first); if ((*l).first == 0) { (*k).speed = (*l).second; @@ -1213,7 +1290,7 @@ } } for (std::vector::iterator k = lanesByDir[OPENDRIVE_TAG_LEFT].begin(); k != lanesByDir[OPENDRIVE_TAG_LEFT].end(); ++k) { - for (std::vector >::const_iterator l = (*k).speeds.begin(); l != (*k).speeds.end(); ++l) { + for (std::vector >::const_iterator l = (*k).speeds.begin(); l != (*k).speeds.end(); ++l) { speedChangePositions.insert((*l).first); if ((*l).first == 0) { (*k).speed = (*l).second; @@ -1228,7 +1305,7 @@ speedChangePositions.insert(0); } // - for (std::set::iterator i = speedChangePositions.begin(); i != speedChangePositions.end(); ++i) { + for (std::set::iterator i = speedChangePositions.begin(); i != speedChangePositions.end(); ++i) { if (i == speedChangePositions.begin()) { newSections.push_back(*this); } else { @@ -1264,13 +1341,14 @@ // --------------------------------------------------------------------------- int NIImporter_OpenDrive::OpenDriveEdge::getPriority(OpenDriveXMLTag dir) const { + // for signal interpretations see https://de.wikipedia.org/wiki/Bildtafel_der_Verkehrszeichen_in_der_Bundesrepublik_Deutschland_seit_2013 int prio = 1; for (std::vector::const_iterator i = signals.begin(); i != signals.end(); ++i) { int tmp = 1; - if ((*i).type == "301" || (*i).type == "306") { + if ((*i).type == "301" || (*i).type == "306") { // priority road or local priority tmp = 2; } - if ((*i).type == "205") { + if ((*i).type == "205" /*|| (*i).type == "206"*/) { // yield or stop tmp = 0; } if (tmp != 1 && dir == OPENDRIVE_TAG_RIGHT && (*i).orientation > 0) { @@ -1316,7 +1394,7 @@ std::string id = attrs.get(OPENDRIVE_ATTR_ID, 0, ok); std::string streetName = attrs.getOpt(OPENDRIVE_ATTR_NAME, 0, ok, "", false); std::string junction = attrs.get(OPENDRIVE_ATTR_JUNCTION, id.c_str(), ok); - SUMOReal length = attrs.get(OPENDRIVE_ATTR_LENGTH, id.c_str(), ok); + double length = attrs.get(OPENDRIVE_ATTR_LENGTH, id.c_str(), ok); myCurrentEdge = OpenDriveEdge(id, streetName, junction, length); } break; @@ -1353,69 +1431,78 @@ } break; case OPENDRIVE_TAG_GEOMETRY: { - SUMOReal length = attrs.get(OPENDRIVE_ATTR_LENGTH, myCurrentEdge.id.c_str(), ok); - SUMOReal s = attrs.get(OPENDRIVE_ATTR_S, myCurrentEdge.id.c_str(), ok); - SUMOReal x = attrs.get(OPENDRIVE_ATTR_X, myCurrentEdge.id.c_str(), ok); - SUMOReal y = attrs.get(OPENDRIVE_ATTR_Y, myCurrentEdge.id.c_str(), ok); - SUMOReal hdg = attrs.get(OPENDRIVE_ATTR_HDG, myCurrentEdge.id.c_str(), ok); + double length = attrs.get(OPENDRIVE_ATTR_LENGTH, myCurrentEdge.id.c_str(), ok); + double s = attrs.get(OPENDRIVE_ATTR_S, myCurrentEdge.id.c_str(), ok); + double x = attrs.get(OPENDRIVE_ATTR_X, myCurrentEdge.id.c_str(), ok); + double y = attrs.get(OPENDRIVE_ATTR_Y, myCurrentEdge.id.c_str(), ok); + double hdg = attrs.get(OPENDRIVE_ATTR_HDG, myCurrentEdge.id.c_str(), ok); myCurrentEdge.geometries.push_back(OpenDriveGeometry(length, s, x, y, hdg)); } break; case OPENDRIVE_TAG_ELEVATION: { - SUMOReal s = attrs.get(OPENDRIVE_ATTR_S, myCurrentEdge.id.c_str(), ok); - SUMOReal a = attrs.get(OPENDRIVE_ATTR_A, myCurrentEdge.id.c_str(), ok); - SUMOReal b = attrs.get(OPENDRIVE_ATTR_B, myCurrentEdge.id.c_str(), ok); - SUMOReal c = attrs.get(OPENDRIVE_ATTR_C, myCurrentEdge.id.c_str(), ok); - SUMOReal d = attrs.get(OPENDRIVE_ATTR_D, myCurrentEdge.id.c_str(), ok); + double s = attrs.get(OPENDRIVE_ATTR_S, myCurrentEdge.id.c_str(), ok); + double a = attrs.get(OPENDRIVE_ATTR_A, myCurrentEdge.id.c_str(), ok); + double b = attrs.get(OPENDRIVE_ATTR_B, myCurrentEdge.id.c_str(), ok); + double c = attrs.get(OPENDRIVE_ATTR_C, myCurrentEdge.id.c_str(), ok); + double d = attrs.get(OPENDRIVE_ATTR_D, myCurrentEdge.id.c_str(), ok); myCurrentEdge.elevations.push_back(OpenDriveElevation(s, a, b, c, d)); } break; case OPENDRIVE_TAG_LINE: { - std::vector vals; + std::vector vals; addGeometryShape(OPENDRIVE_GT_LINE, vals); } break; case OPENDRIVE_TAG_SPIRAL: { - std::vector vals; - vals.push_back(attrs.get(OPENDRIVE_ATTR_CURVSTART, myCurrentEdge.id.c_str(), ok)); - vals.push_back(attrs.get(OPENDRIVE_ATTR_CURVEND, myCurrentEdge.id.c_str(), ok)); + std::vector vals; + vals.push_back(attrs.get(OPENDRIVE_ATTR_CURVSTART, myCurrentEdge.id.c_str(), ok)); + vals.push_back(attrs.get(OPENDRIVE_ATTR_CURVEND, myCurrentEdge.id.c_str(), ok)); addGeometryShape(OPENDRIVE_GT_SPIRAL, vals); } break; case OPENDRIVE_TAG_ARC: { - std::vector vals; - vals.push_back(attrs.get(OPENDRIVE_ATTR_CURVATURE, myCurrentEdge.id.c_str(), ok)); + std::vector vals; + vals.push_back(attrs.get(OPENDRIVE_ATTR_CURVATURE, myCurrentEdge.id.c_str(), ok)); addGeometryShape(OPENDRIVE_GT_ARC, vals); } break; case OPENDRIVE_TAG_POLY3: { - std::vector vals; - vals.push_back(attrs.get(OPENDRIVE_ATTR_A, myCurrentEdge.id.c_str(), ok)); - vals.push_back(attrs.get(OPENDRIVE_ATTR_B, myCurrentEdge.id.c_str(), ok)); - vals.push_back(attrs.get(OPENDRIVE_ATTR_C, myCurrentEdge.id.c_str(), ok)); - vals.push_back(attrs.get(OPENDRIVE_ATTR_D, myCurrentEdge.id.c_str(), ok)); + std::vector vals; + vals.push_back(attrs.get(OPENDRIVE_ATTR_A, myCurrentEdge.id.c_str(), ok)); + vals.push_back(attrs.get(OPENDRIVE_ATTR_B, myCurrentEdge.id.c_str(), ok)); + vals.push_back(attrs.get(OPENDRIVE_ATTR_C, myCurrentEdge.id.c_str(), ok)); + vals.push_back(attrs.get(OPENDRIVE_ATTR_D, myCurrentEdge.id.c_str(), ok)); addGeometryShape(OPENDRIVE_GT_POLY3, vals); } break; case OPENDRIVE_TAG_PARAMPOLY3: { - std::vector vals; - vals.push_back(attrs.get(OPENDRIVE_ATTR_AU, myCurrentEdge.id.c_str(), ok)); - vals.push_back(attrs.get(OPENDRIVE_ATTR_BU, myCurrentEdge.id.c_str(), ok)); - vals.push_back(attrs.get(OPENDRIVE_ATTR_CU, myCurrentEdge.id.c_str(), ok)); - vals.push_back(attrs.get(OPENDRIVE_ATTR_DU, myCurrentEdge.id.c_str(), ok)); - vals.push_back(attrs.get(OPENDRIVE_ATTR_AV, myCurrentEdge.id.c_str(), ok)); - vals.push_back(attrs.get(OPENDRIVE_ATTR_BV, myCurrentEdge.id.c_str(), ok)); - vals.push_back(attrs.get(OPENDRIVE_ATTR_CV, myCurrentEdge.id.c_str(), ok)); - vals.push_back(attrs.get(OPENDRIVE_ATTR_DV, myCurrentEdge.id.c_str(), ok)); - vals.push_back(attrs.getOpt(OPENDRIVE_ATTR_PRANGE, myCurrentEdge.id.c_str(), ok, 1.0, false)); + std::vector vals; + vals.push_back(attrs.get(OPENDRIVE_ATTR_AU, myCurrentEdge.id.c_str(), ok)); + vals.push_back(attrs.get(OPENDRIVE_ATTR_BU, myCurrentEdge.id.c_str(), ok)); + vals.push_back(attrs.get(OPENDRIVE_ATTR_CU, myCurrentEdge.id.c_str(), ok)); + vals.push_back(attrs.get(OPENDRIVE_ATTR_DU, myCurrentEdge.id.c_str(), ok)); + vals.push_back(attrs.get(OPENDRIVE_ATTR_AV, myCurrentEdge.id.c_str(), ok)); + vals.push_back(attrs.get(OPENDRIVE_ATTR_BV, myCurrentEdge.id.c_str(), ok)); + vals.push_back(attrs.get(OPENDRIVE_ATTR_CV, myCurrentEdge.id.c_str(), ok)); + vals.push_back(attrs.get(OPENDRIVE_ATTR_DV, myCurrentEdge.id.c_str(), ok)); + vals.push_back(attrs.getOpt(OPENDRIVE_ATTR_PRANGE, myCurrentEdge.id.c_str(), ok, 1.0, false)); addGeometryShape(OPENDRIVE_GT_PARAMPOLY3, vals); } break; case OPENDRIVE_TAG_LANESECTION: { - SUMOReal s = attrs.get(OPENDRIVE_ATTR_S, myCurrentEdge.id.c_str(), ok); + double s = attrs.get(OPENDRIVE_ATTR_S, myCurrentEdge.id.c_str(), ok); myCurrentEdge.laneSections.push_back(OpenDriveLaneSection(s)); } break; + case OPENDRIVE_TAG_LANEOFFSET: { + double s = attrs.get(OPENDRIVE_ATTR_S, myCurrentEdge.id.c_str(), ok); + double a = attrs.get(OPENDRIVE_ATTR_A, myCurrentEdge.id.c_str(), ok); + double b = attrs.get(OPENDRIVE_ATTR_B, myCurrentEdge.id.c_str(), ok); + double c = attrs.get(OPENDRIVE_ATTR_C, myCurrentEdge.id.c_str(), ok); + double d = attrs.get(OPENDRIVE_ATTR_D, myCurrentEdge.id.c_str(), ok); + myCurrentEdge.offsets.push_back(OpenDriveLaneOffset(s, a, b, c, d)); + } + break; case OPENDRIVE_TAG_LEFT: myCurrentLaneDirection = OPENDRIVE_TAG_LEFT; break; @@ -1440,7 +1527,7 @@ std::string type = attrs.get(OPENDRIVE_ATTR_TYPE, myCurrentEdge.id.c_str(), ok); std::string name = attrs.getOpt(OPENDRIVE_ATTR_NAME, myCurrentEdge.id.c_str(), ok, "", false); int orientation = attrs.get(OPENDRIVE_ATTR_ORIENTATION, myCurrentEdge.id.c_str(), ok) == "-" ? -1 : 1; - SUMOReal s = attrs.get(OPENDRIVE_ATTR_S, myCurrentEdge.id.c_str(), ok); + double s = attrs.get(OPENDRIVE_ATTR_S, myCurrentEdge.id.c_str(), ok); bool dynamic = attrs.get(OPENDRIVE_ATTR_DYNAMIC, myCurrentEdge.id.c_str(), ok) == "no" ? false : true; myCurrentEdge.signals.push_back(OpenDriveSignal(id, type, name, orientation, dynamic, s)); } @@ -1479,7 +1566,7 @@ break; case OPENDRIVE_TAG_WIDTH: { if (myElementStack.size() >= 2 && myElementStack[myElementStack.size() - 1] == OPENDRIVE_TAG_LANE) { - SUMOReal width = attrs.get(OPENDRIVE_ATTR_A, myCurrentEdge.id.c_str(), ok); + double width = attrs.get(OPENDRIVE_ATTR_A, myCurrentEdge.id.c_str(), ok); OpenDriveLane& l = myCurrentEdge.laneSections.back().lanesByDir[myCurrentLaneDirection].back(); l.width = MAX2(l.width, width); } @@ -1487,8 +1574,8 @@ break; case OPENDRIVE_TAG_SPEED: { if (myElementStack.size() >= 2 && myElementStack[myElementStack.size() - 1] == OPENDRIVE_TAG_LANE) { - SUMOReal speed = attrs.get(OPENDRIVE_ATTR_MAX, myCurrentEdge.id.c_str(), ok); - SUMOReal pos = attrs.get(OPENDRIVE_ATTR_SOFFSET, myCurrentEdge.id.c_str(), ok); + double speed = attrs.get(OPENDRIVE_ATTR_MAX, myCurrentEdge.id.c_str(), ok); + double pos = attrs.get(OPENDRIVE_ATTR_SOFFSET, myCurrentEdge.id.c_str(), ok); myCurrentEdge.laneSections.back().lanesByDir[myCurrentLaneDirection].back().speeds.push_back(std::make_pair(pos, speed)); } } @@ -1559,7 +1646,7 @@ void -NIImporter_OpenDrive::addGeometryShape(GeometryType type, const std::vector& vals) { +NIImporter_OpenDrive::addGeometryShape(GeometryType type, const std::vector& vals) { // checks if (myCurrentEdge.geometries.size() == 0) { throw ProcessError("Mismatching paranthesis in geometry definition for road '" + myCurrentEdge.id + "'"); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_OpenDrive.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_OpenDrive.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_OpenDrive.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_OpenDrive.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 14.04.2008 -/// @version $Id: NIImporter_OpenDrive.h 21243 2016-07-26 14:12:28Z namdre $ +/// @version $Id: NIImporter_OpenDrive.h 23258 2017-03-07 15:14:36Z namdre $ /// // Importer for networks stored in openDrive format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -100,6 +100,7 @@ OPENDRIVE_TAG_POLY3, OPENDRIVE_TAG_PARAMPOLY3, OPENDRIVE_TAG_LANESECTION, + OPENDRIVE_TAG_LANEOFFSET, OPENDRIVE_TAG_LEFT, OPENDRIVE_TAG_CENTER, OPENDRIVE_TAG_RIGHT, @@ -233,17 +234,17 @@ * @param[in] yArg y-position at this part's begin * @param[in] hdgArg heading at this part's begin */ - OpenDriveGeometry(SUMOReal lengthArg, SUMOReal sArg, SUMOReal xArg, SUMOReal yArg, SUMOReal hdgArg) + OpenDriveGeometry(double lengthArg, double sArg, double xArg, double yArg, double hdgArg) : length(lengthArg), s(sArg), x(xArg), y(yArg), hdg(hdgArg), type(OPENDRIVE_GT_UNKNOWN) { } - SUMOReal length; - SUMOReal s; - SUMOReal x; - SUMOReal y; - SUMOReal hdg; + double length; + double s; + double x; + double y; + double hdg; GeometryType type; - std::vector params; + std::vector params; }; /** @@ -258,16 +259,19 @@ * @param[in] c second order * @param[in] d third order */ - OpenDriveElevation(SUMOReal _s, SUMOReal _a, SUMOReal _b, SUMOReal _c, SUMOReal _d) : + OpenDriveElevation(double _s, double _a, double _b, double _c, double _d) : s(_s), a(_a), b(_b), c(_c), d(_d) {} - SUMOReal s; - SUMOReal a; - SUMOReal b; - SUMOReal c; - SUMOReal d; + double s; + double a; + double b; + double c; + double d; }; + /// LaneOffset has the same fields as Elevation + typedef OpenDriveElevation OpenDriveLaneOffset; + /** * @struct OpenDriveLane @@ -288,9 +292,9 @@ std::string type; //!< The lane's type int successor; //!< The lane's successor lane int predecessor; //!< The lane's predecessor lane - std::vector > speeds; //!< List of positions/speeds of speed changes - SUMOReal speed; //!< The lane's speed (set in post-processing) - SUMOReal width; //!< The lane's width; @todo: this is the maximum width only + std::vector > speeds; //!< List of positions/speeds of speed changes + double speed; //!< The lane's speed (set in post-processing) + double width; //!< The lane's width; @todo: this is the maximum width only }; @@ -302,7 +306,7 @@ /** @brief Constructor * @param[in] sArg The offset from the start, counted from the begin */ - OpenDriveLaneSection(SUMOReal sArg); + OpenDriveLaneSection(double sArg); /** @brief Build the mapping from OpenDrive to SUMO lanes @@ -323,10 +327,10 @@ bool buildSpeedChanges(const NBTypeCont& tc, std::vector& newSections); - OpenDriveLaneSection buildLaneSection(SUMOReal startPos); + OpenDriveLaneSection buildLaneSection(double startPos); /// @brief The starting offset of this lane section - SUMOReal s; + double s; /// @brief A mapping from OpenDrive to SUMO-index (the first is signed, the second unsigned) std::map laneMap; /// @brief The lanes, sorted by their direction @@ -355,7 +359,7 @@ * @param[in] dynamicArg Whether the signal is dynamic * @param[in] sArg The offset from the start, counted from the begin */ - OpenDriveSignal(int idArg, const std::string typeArg, const std::string nameArg, int orientationArg, bool dynamicArg, SUMOReal sArg) + OpenDriveSignal(int idArg, const std::string typeArg, const std::string nameArg, int orientationArg, bool dynamicArg, double sArg) : id(idArg), type(typeArg), name(nameArg), orientation(orientationArg), dynamic(dynamicArg), s(sArg) { } int id; @@ -363,7 +367,7 @@ std::string name; int orientation; bool dynamic; - SUMOReal s; + double s; }; @@ -389,7 +393,7 @@ * @brief Representation of an openDrive "link" */ struct OpenDriveEdge { - OpenDriveEdge(const std::string& idArg, const std::string& streetNameArg, const std::string& junctionArg, SUMOReal lengthArg) : + OpenDriveEdge(const std::string& idArg, const std::string& streetNameArg, const std::string& junctionArg, double lengthArg) : id(idArg), streetName(streetNameArg), junction(junctionArg), @@ -416,10 +420,11 @@ /// @brief The id of the junction the edge belongs to std::string junction; /// @brief The length of the edge - SUMOReal length; + double length; std::vector links; std::vector geometries; std::vector elevations; + std::vector offsets; NBNode* from; NBNode* to; PositionVector geom; @@ -446,10 +451,10 @@ class same_position_finder { public: /** @brief constructor */ - explicit same_position_finder(SUMOReal pos) : myPosition(pos) { } + explicit same_position_finder(double pos) : myPosition(pos) { } /** @brief the comparing function */ - bool operator()(const std::pair& ps) { + bool operator()(const std::pair& ps) { return ps.first == myPosition; } @@ -457,7 +462,7 @@ same_position_finder& operator=(const same_position_finder&); // just to avoid a compiler warning private: /// @brief The position to search for - SUMOReal myPosition; + double myPosition; }; @@ -504,9 +509,9 @@ private: void addLink(LinkType lt, const std::string& elementType, const std::string& elementID, const std::string& contactPoint); - void addGeometryShape(GeometryType type, const std::vector& vals); + void addGeometryShape(GeometryType type, const std::vector& vals); static void setEdgeLinks2(OpenDriveEdge& e, const std::map& edges); - static void buildConnectionsToOuter(const Connection& c, const std::map& innerEdges, std::vector& into); + static void buildConnectionsToOuter(const Connection& c, const std::map& innerEdges, std::vector& into, std::set& seen); friend bool operator<(const Connection& c1, const Connection& c2); static std::string revertID(const std::string& id); const NBTypeCont& myTypeContainer; @@ -543,14 +548,14 @@ static PositionVector geomFromLine(const OpenDriveEdge& e, const OpenDriveGeometry& g); - static PositionVector geomFromSpiral(const OpenDriveEdge& e, const OpenDriveGeometry& g); - static PositionVector geomFromArc(const OpenDriveEdge& e, const OpenDriveGeometry& g); - static PositionVector geomFromPoly(const OpenDriveEdge& e, const OpenDriveGeometry& g); - static PositionVector geomFromParamPoly(const OpenDriveEdge& e, const OpenDriveGeometry& g); + static PositionVector geomFromSpiral(const OpenDriveEdge& e, const OpenDriveGeometry& g, double resolution); + static PositionVector geomFromArc(const OpenDriveEdge& e, const OpenDriveGeometry& g, double resolution); + static PositionVector geomFromPoly(const OpenDriveEdge& e, const OpenDriveGeometry& g, double resolution); + static PositionVector geomFromParamPoly(const OpenDriveEdge& e, const OpenDriveGeometry& g, double resolution); static Position calculateStraightEndPoint(double hdg, double length, const Position& start); - static void calculateCurveCenter(SUMOReal* ad_x, SUMOReal* ad_y, SUMOReal ad_radius, SUMOReal ad_hdg); - static void calcPointOnCurve(SUMOReal* ad_x, SUMOReal* ad_y, SUMOReal ad_centerX, SUMOReal ad_centerY, - SUMOReal ad_r, SUMOReal ad_length); + static void calculateCurveCenter(double* ad_x, double* ad_y, double ad_radius, double ad_hdg); + static void calcPointOnCurve(double* ad_x, double* ad_y, double ad_centerX, double ad_centerY, + double ad_r, double ad_length); /** @brief Computes a polygon representation of each edge's geometry diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_OpenStreetMap.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_OpenStreetMap.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_OpenStreetMap.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_OpenStreetMap.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,14 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @author Walter Bamberger +/// @author Gregor Laemmel /// @date Mon, 14.04.2008 -/// @version $Id: NIImporter_OpenStreetMap.cpp 21738 2016-10-18 11:39:37Z namdre $ +/// @version $Id: NIImporter_OpenStreetMap.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Importer for networks stored in OpenStreetMap format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -57,16 +58,12 @@ #include "NILoader.h" #include "NIImporter_OpenStreetMap.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - //#define DEBUG_LAYER_ELEVATION // --------------------------------------------------------------------------- // static members // --------------------------------------------------------------------------- -const SUMOReal NIImporter_OpenStreetMap::MAXSPEED_UNGIVEN = -1; +const double NIImporter_OpenStreetMap::MAXSPEED_UNGIVEN = -1; const long long int NIImporter_OpenStreetMap::INVALID_ID = std::numeric_limits::max(); @@ -106,16 +103,13 @@ // --------------------------------------------------------------------------- const std::string NIImporter_OpenStreetMap::compoundTypeSeparator("|"); - void NIImporter_OpenStreetMap::loadNetwork(const OptionsCont& oc, NBNetBuilder& nb) { NIImporter_OpenStreetMap importer; importer.load(oc, nb); } - -NIImporter_OpenStreetMap::NIImporter_OpenStreetMap() {} - +NIImporter_OpenStreetMap::NIImporter_OpenStreetMap() { } NIImporter_OpenStreetMap::~NIImporter_OpenStreetMap() { // delete nodes @@ -128,7 +122,6 @@ } } - void NIImporter_OpenStreetMap::load(const OptionsCont& oc, NBNetBuilder& nb) { // check whether the option is set (properly) @@ -139,7 +132,7 @@ * Each file is parsed twice: first for nodes, second for edges. */ std::vector files = oc.getStringVector("osm-files"); // load nodes, first - NodesHandler nodesHandler(myOSMNodes, myUniqueNodes, oc.getBool("osm.elevation")); + NodesHandler nodesHandler(myOSMNodes, myUniqueNodes, oc); for (std::vector::const_iterator file = files.begin(); file != files.end(); ++file) { // nodes if (!FileHelpers::isReadable(*file)) { @@ -190,7 +183,9 @@ for (std::map::const_iterator i = myEdges.begin(); i != myEdges.end(); ++i) { Edge* e = (*i).second; assert(e->myCurrentIsRoad); - for (std::vector::const_iterator j = e->myCurrentNodes.begin(); j != e->myCurrentNodes.end(); ++j) { + for (std::vector::const_iterator j = e->myCurrentNodes.begin(); + j != e->myCurrentNodes.end(); + ++j) { if (nodeUsage.find(*j) == nodeUsage.end()) { nodeUsage[*j] = 0; } @@ -198,7 +193,9 @@ } } // Mark which nodes are used by traffic lights - for (std::map::const_iterator nodesIt = myOSMNodes.begin(); nodesIt != myOSMNodes.end(); ++nodesIt) { + for (std::map::const_iterator nodesIt = myOSMNodes.begin(); + nodesIt != myOSMNodes.end(); + ++nodesIt) { if (nodesIt->second->tlsControlled /* || nodesIt->second->railwayCrossing*/) { // If the key is not found in the map, the value is automatically // initialized with 0. @@ -233,6 +230,7 @@ running = insertEdge(e, running, currentFrom, currentTo, passed, nb); currentFrom = currentTo; passed.clear(); + passed.push_back(*j); } } if (running == 0) { @@ -241,7 +239,7 @@ insertEdge(e, running, currentFrom, last, passed, nb); } - const SUMOReal layerElevation = oc.getFloat("osm.layer-elevation"); + const double layerElevation = oc.getFloat("osm.layer-elevation"); if (layerElevation > 0) { reconstructLayerElevation(layerElevation, nb); } @@ -258,14 +256,13 @@ } } - NBNode* NIImporter_OpenStreetMap::insertNodeChecking(long long int id, NBNodeCont& nc, NBTrafficLightLogicCont& tlsc) { NBNode* node = nc.retrieve(toString(id)); if (node == 0) { NIOSMNode* n = myOSMNodes.find(id)->second; Position pos(n->lon, n->lat, n->ele); - if (!NBNetBuilder::transformCoordinates(pos, true)) { + if (!NBNetBuilder::transformCoordinate(pos, true)) { WRITE_ERROR("Unable to project coordinates for junction '" + toString(id) + "'."); return 0; } @@ -282,7 +279,8 @@ // ok, this node is a traffic light node where no other nodes // participate // @note: The OSM-community has not settled on a schema for differentiating between fixed and actuated lights - TrafficLightType type = SUMOXMLDefinitions::TrafficLightTypes.get(OptionsCont::getOptions().getString("tls.default-type")); + TrafficLightType type = SUMOXMLDefinitions::TrafficLightTypes.get( + OptionsCont::getOptions().getString("tls.default-type")); NBOwnTLDef* tlDef = new NBOwnTLDef(toString(id), node, 0, type); if (!tlsc.insert(tlDef)) { // actually, nothing should fail here @@ -294,13 +292,14 @@ return node; } - int NIImporter_OpenStreetMap::insertEdge(Edge* e, int index, NBNode* from, NBNode* to, const std::vector& passed, NBNetBuilder& nb) { NBNodeCont& nc = nb.getNodeCont(); NBEdgeCont& ec = nb.getEdgeCont(); NBTypeCont& tc = nb.getTypeCont(); + NBPTStopCont& sc = nb.getPTStopCont(); + NBTrafficLightLogicCont& tlsc = nb.getTLLogicCont(); // patch the id std::string id = toString(e->id); @@ -320,10 +319,10 @@ return index; } // in the special case of a looped way split again using passed - int intermediateIndex = (int)passed.size() / 2; + int intermediateIndex = (int) passed.size() / 2; NBNode* intermediate = insertNodeChecking(passed[intermediateIndex], nc, tlsc); - std::vector part1(passed.begin(), passed.begin() + intermediateIndex); - std::vector part2(passed.begin() + intermediateIndex + 1, passed.end()); + std::vector part1(passed.begin(), passed.begin() + intermediateIndex + 1); + std::vector part2(passed.begin() + intermediateIndex, passed.end()); index = insertEdge(e, index, from, intermediate, part1, nb); return insertEdge(e, index, intermediate, to, part2, nb); } @@ -331,16 +330,25 @@ // convert the shape PositionVector shape; - shape.push_back(from->getPosition()); for (std::vector::const_iterator i = passed.begin(); i != passed.end(); ++i) { NIOSMNode* n = myOSMNodes.find(*i)->second; - Position pos(n->lon, n->lat, n->ele); - if (!NBNetBuilder::transformCoordinates(pos, true)) { - WRITE_ERROR("Unable to project coordinates for edge '" + id + "'."); + + if (n->ptStopPostion) { + Position ptPos(n->lon, n->lat, n->ele); + if (!NBNetBuilder::transformCoordinate(ptPos)) { + WRITE_ERROR("Unable to project coordinates for node '" + toString(n->id) + "'."); + } + NBPTStop* ptStop = new NBPTStop(toString(n->id), ptPos, id, toString(e->id), n->ptStopLength, n->name); + sc.insert(ptStop); + } - shape.push_back_noDoublePos(pos); + Position pos(n->lon, n->lat, n->ele); + shape.push_back(pos); } - shape.push_back_noDoublePos(to->getPosition()); + if (!NBNetBuilder::transformCoordinates(shape)) { + WRITE_ERROR("Unable to project coordinates for edge '" + id + "'."); + } +// shape.in std::string type = e->myHighWayType; if (!tc.knows(type)) { @@ -359,7 +367,9 @@ types.push_back(t); } } else if (tok.size() > 1) { - WRITE_WARNING("Discarding unknown compound '" + t + "' in type '" + type + "' (first occurence for edge '" + id + "')."); + WRITE_WARNING( + "Discarding unknown compound '" + t + "' in type '" + type + "' (first occurence for edge '" + id + + "')."); } } if (types.size() == 0) { @@ -376,11 +386,11 @@ } else { // build a new type by merging all values int numLanes = 0; - SUMOReal maxSpeed = 0; + double maxSpeed = 0; int prio = 0; - SUMOReal width = NBEdge::UNSPECIFIED_WIDTH; - SUMOReal sidewalkWidth = NBEdge::UNSPECIFIED_WIDTH; - SUMOReal bikelaneWidth = NBEdge::UNSPECIFIED_WIDTH; + double width = NBEdge::UNSPECIFIED_WIDTH; + double sidewalkWidth = NBEdge::UNSPECIFIED_WIDTH; + double bikelaneWidth = NBEdge::UNSPECIFIED_WIDTH; bool defaultIsOneWay = false; SVCPermissions permissions = 0; bool discard = true; @@ -406,7 +416,8 @@ return newIndex; } else { WRITE_MESSAGE("Adding new type '" + type + "' (first occurence for edge '" + id + "')."); - tc.insert(newType, numLanes, maxSpeed, prio, permissions, width, defaultIsOneWay, sidewalkWidth, bikelaneWidth); + tc.insert(newType, numLanes, maxSpeed, prio, permissions, width, defaultIsOneWay, sidewalkWidth, + bikelaneWidth); for (std::vector::iterator it = types.begin(); it != types.end(); it++) { if (!tc.getShallBeDiscarded(*it)) { tc.copyRestrictionsAndAttrs(*it, newType); @@ -424,18 +435,20 @@ bool ok = true; int numLanesForward = tc.getNumLanes(type); int numLanesBackward = tc.getNumLanes(type); - SUMOReal speed = tc.getSpeed(type); + double speed = tc.getSpeed(type); bool defaultsToOneWay = tc.getIsOneWay(type); SVCPermissions forwardPermissions = tc.getPermissions(type); SVCPermissions backwardPermissions = tc.getPermissions(type); - SUMOReal forwardWidth = tc.getWidth(type); - SUMOReal backwardWidth = tc.getWidth(type); + double forwardWidth = tc.getWidth(type); + double backwardWidth = tc.getWidth(type); const bool addSidewalk = (tc.getSidewalkWidth(type) != NBEdge::UNSPECIFIED_WIDTH); const bool addBikeLane = (tc.getBikeLaneWidth(type) != NBEdge::UNSPECIFIED_WIDTH); // check directions bool addForward = true; bool addBackward = true; - if (e->myIsOneWay == "true" || e->myIsOneWay == "yes" || e->myIsOneWay == "1" || (defaultsToOneWay && e->myIsOneWay != "no" && e->myIsOneWay != "false" && e->myIsOneWay != "0")) { + if (e->myIsOneWay == "true" || e->myIsOneWay == "yes" || e->myIsOneWay == "1" + || (defaultsToOneWay && e->myIsOneWay != "no" && e->myIsOneWay != "false" && e->myIsOneWay != "0" && + e->getParameter("railway:preferred_direction", "") != "both")) { addBackward = false; } if (e->myIsOneWay == "-1" || e->myIsOneWay == "reverse") { @@ -443,7 +456,8 @@ addForward = false; addBackward = true; } - if (e->myIsOneWay != "" && e->myIsOneWay != "false" && e->myIsOneWay != "no" && e->myIsOneWay != "true" && e->myIsOneWay != "yes" && e->myIsOneWay != "-1" && e->myIsOneWay != "1" && e->myIsOneWay != "reverse") { + if (e->myIsOneWay != "" && e->myIsOneWay != "false" && e->myIsOneWay != "no" && e->myIsOneWay != "true" + && e->myIsOneWay != "yes" && e->myIsOneWay != "-1" && e->myIsOneWay != "1" && e->myIsOneWay != "reverse") { WRITE_WARNING("New value for oneway found: " + e->myIsOneWay); } // if we had been able to extract the number of lanes, override the highway type default @@ -458,7 +472,7 @@ } else if (e->myNoLanesForward < 0) { numLanesForward = e->myNoLanes + e->myNoLanesForward; } else { - numLanesForward = (int)std::ceil(e->myNoLanes / 2.0); + numLanesForward = (int) std::ceil(e->myNoLanes / 2.0); } numLanesBackward = e->myNoLanes - numLanesForward; // sometimes ways are tagged according to their physical width of a single @@ -472,7 +486,7 @@ } // if we had been able to extract the maximum speed, override the type's default if (e->myMaxSpeed != MAXSPEED_UNGIVEN) { - speed = (SUMOReal)(e->myMaxSpeed / 3.6); + speed = (double)(e->myMaxSpeed / 3.6); } if (speed <= 0) { WRITE_WARNING("Skipping edge '" + id + "' because it has speed " + toString(speed)); @@ -510,7 +524,9 @@ } if (ok) { - LaneSpreadFunction lsf = addBackward ? LANESPREAD_RIGHT : LANESPREAD_CENTER; + LaneSpreadFunction lsf = (addBackward || OptionsCont::getOptions().getBool("osm.oneway-spread-right")) && + e->getParameter("railway:preferred_direction", "") != "both" ? LANESPREAD_RIGHT : LANESPREAD_CENTER; + id = StringUtils::escapeXML(id); if (addForward) { assert(numLanesForward > 0); @@ -523,10 +539,14 @@ } if (addBikeLane && (e->myCyclewayType == WAY_UNKNOWN || (e->myCyclewayType & WAY_FORWARD) != 0)) { nbe->addBikeLane(tc.getBikeLaneWidth(type)); + } else if (nbe->getPermissions(0) == SVC_BUS) { + // bikes drive on buslanes if no separate cycle lane is available + nbe->setPermissions(SVC_BUS | SVC_BICYCLE, 0); } if (addSidewalk) { nbe->addSidewalk(tc.getSidewalkWidth(type)); } + nbe->addParameter(*e); if (!ec.insert(nbe)) { delete nbe; throw ProcessError("Could not add edge '" + id + "'."); @@ -543,10 +563,14 @@ } if (addBikeLane && (e->myCyclewayType == WAY_UNKNOWN || (e->myCyclewayType & WAY_BACKWARD) != 0)) { nbe->addBikeLane(tc.getBikeLaneWidth(type)); + } else if (nbe->getPermissions(0) == SVC_BUS) { + // bikes drive on buslanes if no separate cycle lane is available + nbe->setPermissions(SVC_BUS | SVC_BICYCLE, 0); } if (addSidewalk) { nbe->addSidewalk(tc.getSidewalkWidth(type)); } + nbe->addParameter(*e); if (!ec.insert(nbe)) { delete nbe; throw ProcessError("Could not add edge '-" + id + "'."); @@ -556,26 +580,24 @@ return newIndex; } - // --------------------------------------------------------------------------- // definitions of NIImporter_OpenStreetMap::NodesHandler-methods // --------------------------------------------------------------------------- -NIImporter_OpenStreetMap::NodesHandler::NodesHandler( - std::map& toFill, - std::set& uniqueNodes, - bool importElevation) : +NIImporter_OpenStreetMap::NodesHandler::NodesHandler(std::map& toFill, + std::set& uniqueNodes, const OptionsCont& oc) + + : SUMOSAXHandler("osm - file"), myToFill(toFill), myLastNodeID(-1), myIsInValidNodeTag(false), myHierarchyLevel(0), myUniqueNodes(uniqueNodes), - myImportElevation(importElevation) { + myImportElevation(oc.getBool("osm.elevation")), + myOptionsCont(oc) { } - -NIImporter_OpenStreetMap::NodesHandler::~NodesHandler() {} - +NIImporter_OpenStreetMap::NodesHandler::~NodesHandler() { } void NIImporter_OpenStreetMap::NodesHandler::myStartElement(int element, const SUMOSAXAttributes& attrs) { @@ -583,10 +605,14 @@ if (element == SUMO_TAG_NODE) { bool ok = true; if (myHierarchyLevel != 2) { - WRITE_ERROR("Node element on wrong XML hierarchy level (id='" + toString(attrs.get(SUMO_ATTR_ID, 0, ok)) + "', level='" + toString(myHierarchyLevel) + "')."); + WRITE_ERROR("Node element on wrong XML hierarchy level (id='" + toString(attrs.get(SUMO_ATTR_ID, 0, ok)) + "', level='" + toString(myHierarchyLevel) + "')."); return; } - long long int id = attrs.get(SUMO_ATTR_ID, 0, ok); + long long int id = attrs.get(SUMO_ATTR_ID, 0, ok); std::string action = attrs.hasAttribute("action") ? attrs.getStringSecure("action", "") : ""; if (action == "delete") { return; @@ -641,7 +667,7 @@ bool ok = true; std::string key = attrs.get(SUMO_ATTR_K, toString(myLastNodeID).c_str(), ok, false); // we check whether the key is relevant (and we really need to transcode the value) to avoid hitting #1636 - if (key == "highway" || key == "ele" || key == "crossing" || key == "railway") { + if (key == "highway" || key == "ele" || key == "crossing" || key == "railway" || key == "public_transport" || key == "name") { std::string value = attrs.get(SUMO_ATTR_V, toString(myLastNodeID).c_str(), ok, false); if (key == "highway" && value.find("traffic_signal") != std::string::npos) { myToFill[myLastNodeID]->tlsControlled = true; @@ -649,9 +675,15 @@ myToFill[myLastNodeID]->tlsControlled = true; } else if (key == "railway" && value.find("crossing") != std::string::npos) { myToFill[myLastNodeID]->railwayCrossing = true; + } else if (key == "public_transport" && value.find("stop_position") != std::string::npos) { + myToFill[myLastNodeID]->ptStopPostion = true; + myToFill[myLastNodeID]->ptStopLength = myOptionsCont.getFloat( + "osm.stop-output.length");//TODO: extract from osm file [GL March '17] + } else if (key == "name") { + myToFill[myLastNodeID]->name = value; } else if (myImportElevation && key == "ele") { try { - myToFill[myLastNodeID]->ele = TplConvert::_2SUMOReal(value.c_str()); + myToFill[myLastNodeID]->ele = TplConvert::_2double(value.c_str()); } catch (...) { WRITE_WARNING("Value of key '" + key + "' is not numeric ('" + value + "') in node '" + toString(myLastNodeID) + "'."); @@ -661,7 +693,6 @@ } } - void NIImporter_OpenStreetMap::NodesHandler::myEndElement(int element) { if (element == SUMO_TAG_NODE && myHierarchyLevel == 2) { @@ -671,13 +702,13 @@ --myHierarchyLevel; } - // --------------------------------------------------------------------------- // definitions of NIImporter_OpenStreetMap::EdgesHandler-methods // --------------------------------------------------------------------------- NIImporter_OpenStreetMap::EdgesHandler::EdgesHandler( const std::map& osmNodes, - std::map& toFill) : + std::map& toFill) + : SUMOSAXHandler("osm - file"), myOSMNodes(osmNodes), myEdgeMap(toFill) { @@ -691,11 +722,9 @@ } - NIImporter_OpenStreetMap::EdgesHandler::~EdgesHandler() { } - void NIImporter_OpenStreetMap::EdgesHandler::myStartElement(int element, const SUMOSAXAttributes& attrs) { @@ -703,7 +732,9 @@ // parse "way" elements if (element == SUMO_TAG_WAY) { bool ok = true; - long long int id = attrs.get(SUMO_ATTR_ID, 0, ok); + long long int id = attrs.get(SUMO_ATTR_ID, 0, ok); std::string action = attrs.hasAttribute("action") ? attrs.getStringSecure("action", "") : ""; if (action == "delete") { myCurrentEdge = 0; @@ -718,7 +749,9 @@ // parse "nd" (node) elements if (element == SUMO_TAG_ND) { bool ok = true; - long long int ref = attrs.get(SUMO_ATTR_REF, 0, ok); + long long int ref = attrs.get(SUMO_ATTR_REF, 0, ok); if (ok) { std::map::const_iterator node = myOSMNodes.find(ref); if (node == myOSMNodes.end()) { @@ -734,7 +767,8 @@ } } // parse values - if (element == SUMO_TAG_TAG && myParentElements.size() > 2 && myParentElements[myParentElements.size() - 2] == SUMO_TAG_WAY) { + if (element == SUMO_TAG_TAG && myParentElements.size() > 2 + && myParentElements[myParentElements.size() - 2] == SUMO_TAG_WAY) { if (myCurrentEdge == 0) { return; } @@ -771,9 +805,14 @@ key = "ignore"; } } + if (key == "bridge" || key == "tunnel") { + myCurrentEdge->addParameter(key, "true"); // could be differentiated further if necessary + } // we check whether the key is relevant (and we really need to transcode the value) to avoid hitting #1636 - if (!StringUtils::endsWith(key, "way") && !StringUtils::startsWith(key, "lanes") && key != "maxspeed" && key != "junction" && key != "name" && key != "tracks" && key != "layer" && key != "route") { + if (!StringUtils::endsWith(key, "way") && !StringUtils::startsWith(key, "lanes") + && key != "maxspeed" && key != "junction" && key != "name" && key != "tracks" && key != "layer" && key != "route" + && key != "postal_code" && key != "railway:preferred_direction") { return; } std::string value = attrs.get(SUMO_ATTR_V, toString(myCurrentEdge->id).c_str(), ok, false); @@ -807,7 +846,8 @@ if (myCurrentEdge->myHighWayType != "") { // osm-ways may be used by more than one mode (eg railway.tram + highway.residential. this is relevant for multimodal traffic) // we create a new type for this kind of situation which must then be resolved in insertEdge() - std::vector types = StringTokenizer(myCurrentEdge->myHighWayType, compoundTypeSeparator).getVector(); + std::vector types = StringTokenizer(myCurrentEdge->myHighWayType, + compoundTypeSeparator).getVector(); types.push_back(singleTypeID); myCurrentEdge->myHighWayType = joinToStringSorting(types, compoundTypeSeparator); } else { @@ -828,7 +868,9 @@ minLanes = MIN2(minLanes, numLanes); } myCurrentEdge->myNoLanes = minLanes; - WRITE_WARNING("Using minimum lane number from list (" + value + ") for edge '" + toString(myCurrentEdge->id) + "'."); + WRITE_WARNING( + "Using minimum lane number from list (" + value + ") for edge '" + toString(myCurrentEdge->id) + + "'."); } catch (NumberFormatException&) { WRITE_WARNING("Value of key '" + key + "' is not numeric ('" + value + "') in edge '" + toString(myCurrentEdge->id) + "'."); @@ -857,7 +899,7 @@ if (mySpeedMap.find(value) != mySpeedMap.end()) { myCurrentEdge->myMaxSpeed = mySpeedMap[value]; } else { - SUMOReal conversion = 1; // OSM default is km/h + double conversion = 1; // OSM default is km/h if (StringUtils::to_lower_case(value).find("km/h") != std::string::npos) { value = StringUtils::prune(value.substr(0, value.find_first_not_of("0123456789"))); } else if (StringUtils::to_lower_case(value).find("mph") != std::string::npos) { @@ -865,7 +907,7 @@ conversion = 1.609344; // kilometers per mile } try { - myCurrentEdge->myMaxSpeed = TplConvert::_2SUMOReal(value.c_str()) * conversion; + myCurrentEdge->myMaxSpeed = TplConvert::_2double(value.c_str()) * conversion; } catch (...) { WRITE_WARNING("Value of key '" + key + "' is not numeric ('" + value + "') in edge '" + toString(myCurrentEdge->id) + "'."); @@ -897,11 +939,14 @@ WRITE_WARNING("Value of key '" + key + "' is not numeric ('" + value + "') in edge '" + toString(myCurrentEdge->id) + "'."); } + } else if (key == "postal_code") { + myCurrentEdge->addParameter(key, value); + } else if (key == "railway:preferred_direction") { + myCurrentEdge->addParameter(key, value); } } } - void NIImporter_OpenStreetMap::EdgesHandler::myEndElement(int element) { myParentElements.pop_back(); @@ -915,20 +960,19 @@ } } - // --------------------------------------------------------------------------- // definitions of NIImporter_OpenStreetMap::RelationHandler-methods // --------------------------------------------------------------------------- NIImporter_OpenStreetMap::RelationHandler::RelationHandler( const std::map& osmNodes, - const std::map& osmEdges) : + const std::map& osmEdges) + : SUMOSAXHandler("osm - file"), myOSMNodes(osmNodes), myOSMEdges(osmEdges) { resetValues(); } - NIImporter_OpenStreetMap::RelationHandler::~RelationHandler() { } @@ -950,7 +994,9 @@ // parse "way" elements if (element == SUMO_TAG_RELATION) { bool ok = true; - myCurrentRelation = attrs.get(SUMO_ATTR_ID, 0, ok); + myCurrentRelation = attrs.get(SUMO_ATTR_ID, 0, ok); std::string action = attrs.hasAttribute("action") ? attrs.getStringSecure("action", "") : ""; if (action == "delete" || !ok) { myCurrentRelation = INVALID_ID; @@ -963,7 +1009,9 @@ if (element == SUMO_TAG_MEMBER) { bool ok = true; std::string role = attrs.hasAttribute("role") ? attrs.getStringSecure("role", "") : ""; - long long int ref = attrs.get(SUMO_ATTR_REF, 0, ok); + long long int ref = attrs.get(SUMO_ATTR_REF, 0, ok); if (role == "via") { // u-turns for divided ways may be given with 2 via-nodes or 1 via-way std::string memberType = attrs.get(SUMO_ATTR_TYPE, 0, ok); @@ -973,7 +1021,9 @@ if (myOSMNodes.find(ref) != myOSMNodes.end()) { myViaNode = ref; } else { - WRITE_WARNING("No node found for reference '" + toString(ref) + "' in relation '" + toString(myCurrentRelation) + "'"); + WRITE_WARNING( + "No node found for reference '" + toString(ref) + "' in relation '" + toString(myCurrentRelation) + + "'"); } } } else if (role == "from" && checkEdgeRef(ref)) { @@ -1002,7 +1052,8 @@ } else if (value.substr(0, 3) == "no_") { myRestrictionType = RESTRICTION_NO; } else { - WRITE_WARNING("Found unknown restriction type '" + value + "' in relation '" + toString(myCurrentRelation) + "'"); + WRITE_WARNING( + "Found unknown restriction type '" + value + "' in relation '" + toString(myCurrentRelation) + "'"); } return; } @@ -1010,7 +1061,6 @@ } } - bool NIImporter_OpenStreetMap::RelationHandler::checkEdgeRef(long long int ref) const { if (myOSMEdges.find(ref) != myOSMEdges.end()) { @@ -1021,7 +1071,6 @@ } } - void NIImporter_OpenStreetMap::RelationHandler::myEndElement(int element) { myParentElements.pop_back(); @@ -1054,7 +1103,6 @@ } } - bool NIImporter_OpenStreetMap::RelationHandler::applyRestriction() const { // since OSM ways are bidirectional we need the via to figure out which direction was meant @@ -1087,9 +1135,9 @@ return true; } - NBEdge* -NIImporter_OpenStreetMap::RelationHandler::findEdgeRef(long long int wayRef, const std::vector& candidates) const { +NIImporter_OpenStreetMap::RelationHandler::findEdgeRef(long long int wayRef, + const std::vector& candidates) const { const std::string prefix = toString(wayRef); const std::string backPrefix = "-" + prefix; NBEdge* result = 0; @@ -1108,21 +1156,20 @@ return result; } - void -NIImporter_OpenStreetMap::reconstructLayerElevation(const SUMOReal layerElevation, NBNetBuilder& nb) { +NIImporter_OpenStreetMap::reconstructLayerElevation(const double layerElevation, NBNetBuilder& nb) { NBNodeCont& nc = nb.getNodeCont(); NBEdgeCont& ec = nb.getEdgeCont(); // reconstruct elevation from layer info // build a map of raising and lowering forces (attractor and distance) // for all nodes unknownElevation - std::map > > layerForces; + std::map > > layerForces; // collect all nodes that belong to a way with layer information std::set knownElevation; for (std::map::iterator i = myEdges.begin(); i != myEdges.end(); ++i) { Edge* e = (*i).second; - if (e->myLayer != 0) { + if (e->myLayer != 0) { for (std::vector::iterator j = e->myCurrentNodes.begin(); j != e->myCurrentNodes.end(); ++j) { NBNode* node = nc.retrieve(toString(*j)); if (node != 0) { @@ -1135,45 +1182,91 @@ #ifdef DEBUG_LAYER_ELEVATION std::cout << "known elevations:\n"; for (std::set::iterator it = knownElevation.begin(); it != knownElevation.end(); ++it) { - const std::vector >& primaryLayers = layerForces[*it]; + const std::vector >& primaryLayers = layerForces[*it]; std::cout << " node=" << (*it)->getID() << " ele="; - for (std::vector >::const_iterator it_ele = primaryLayers.begin(); it_ele != primaryLayers.end(); ++it_ele) { + for (std::vector >::const_iterator it_ele = primaryLayers.begin(); it_ele != primaryLayers.end(); ++it_ele) { std::cout << it_ele->first << " "; } std::cout << "\n"; } #endif - // collect all nodes within a grade-dependent range around knownElevation-nodes - std::set unknownElevation; + // layer data only provides a lower bound on elevation since it is used to + // resolve the relation among overlapping ways. + // Perform a sanity check for steep inclines and raise the knownElevation if necessary + std::map knownEleMax; for (std::set::iterator it = knownElevation.begin(); it != knownElevation.end(); ++it) { - SUMOReal eleMax = -std::numeric_limits::max(); - SUMOReal eleSum = 0; - const std::vector >& primaryLayers = layerForces[*it]; - for (std::vector >::const_iterator it_ele = primaryLayers.begin(); it_ele != primaryLayers.end(); ++it_ele) { + double eleMax = -std::numeric_limits::max(); + const std::vector >& primaryLayers = layerForces[*it]; + for (std::vector >::const_iterator it_ele = primaryLayers.begin(); + it_ele != primaryLayers.end(); + ++it_ele) { eleMax = MAX2(eleMax, it_ele->first); - eleSum += it_ele->first; } - const SUMOReal eleAvg = eleSum / primaryLayers.size(); - const SUMOReal maxDist = fabs(eleMax) * 100 / layerElevation; - std::map neighbors = getNeighboringNodes(*it, maxDist); - for (std::map::iterator it_neigh = neighbors.begin(); it_neigh != neighbors.end(); ++it_neigh) { - unknownElevation.insert(it_neigh->first); - layerForces[it_neigh->first].push_back(std::make_pair(eleAvg, it_neigh->second)); + knownEleMax[*it] = eleMax; + } + const double gradeThreshold = OptionsCont::getOptions().getFloat("osm.layer-elevation.max-grade") / 100; + bool changed = true; + while (changed) { + changed = false; + for (std::set::iterator it = knownElevation.begin(); it != knownElevation.end(); ++it) { + std::map > neighbors = getNeighboringNodes(*it, + knownEleMax[*it] / gradeThreshold * 3, knownElevation); + for (std::map >::iterator it_neigh = neighbors.begin(); + it_neigh != neighbors.end(); + ++it_neigh) { + if (knownElevation.count(it_neigh->first) != 0) { + const double grade = fabs(knownEleMax[*it] - knownEleMax[it_neigh->first]) + / MAX2(POSITION_EPS, it_neigh->second.first); +#ifdef DEBUG_LAYER_ELEVATION + std::cout << " grade at node=" << (*it)->getID() << " ele=" << knownEleMax[*it] << " neigh=" << it_neigh->first->getID() << " neighEle=" << knownEleMax[it_neigh->first] << " grade=" << grade << " dist=" << it_neigh->second.first << " speed=" << it_neigh->second.second << "\n"; +#endif + if (grade > gradeThreshold * 50 / 3.6 / it_neigh->second.second) { + // raise the lower node to the higher level + const double eleMax = MAX2(knownEleMax[*it], knownEleMax[it_neigh->first]); + if (knownEleMax[*it] < eleMax) { + knownEleMax[*it] = eleMax; + } else { + knownEleMax[it_neigh->first] = eleMax; + } + changed = true; + } + } + } + } + } + + // collect all nodes within a grade-dependent range around knownElevation-nodes and apply knowElevation forces + std::set unknownElevation; + for (std::set::iterator it = knownElevation.begin(); it != knownElevation.end(); ++it) { + const double eleMax = knownEleMax[*it]; + const double maxDist = fabs(eleMax) * 100 / layerElevation; + std::map > neighbors = getNeighboringNodes(*it, maxDist, knownElevation); + for (std::map >::iterator it_neigh = neighbors.begin(); + it_neigh != neighbors.end(); + ++it_neigh) { + if (knownElevation.count(it_neigh->first) == 0) { + unknownElevation.insert(it_neigh->first); + layerForces[it_neigh->first].push_back(std::make_pair(eleMax, it_neigh->second.first)); + } } } - // collect forces from ground-level nodes (neither in knownElevation nor unknownElevation) + // apply forces to ground-level nodes (neither in knownElevation nor unknownElevation) for (std::set::iterator it = unknownElevation.begin(); it != unknownElevation.end(); ++it) { - SUMOReal eleMax = -std::numeric_limits::max(); - const std::vector >& primaryLayers = layerForces[*it]; - for (std::vector >::const_iterator it_ele = primaryLayers.begin(); it_ele != primaryLayers.end(); ++it_ele) { + double eleMax = -std::numeric_limits::max(); + const std::vector >& primaryLayers = layerForces[*it]; + for (std::vector >::const_iterator it_ele = primaryLayers.begin(); + it_ele != primaryLayers.end(); + ++it_ele) { eleMax = MAX2(eleMax, it_ele->first); } - const SUMOReal maxDist = fabs(eleMax) * 100 / layerElevation; - std::map neighbors = getNeighboringNodes(*it, maxDist); - for (std::map::iterator it_neigh = neighbors.begin(); it_neigh != neighbors.end(); ++it_neigh) { + const double maxDist = fabs(eleMax) * 100 / layerElevation; + std::map > neighbors = getNeighboringNodes(*it, maxDist, knownElevation); + for (std::map >::iterator it_neigh = neighbors.begin(); + it_neigh != neighbors.end(); + ++it_neigh) { if (knownElevation.count(it_neigh->first) == 0 && unknownElevation.count(it_neigh->first) == 0) { - layerForces[*it].push_back(std::make_pair(0, it_neigh->second)); + layerForces[*it].push_back(std::make_pair(0, it_neigh->second.first)); } } } @@ -1181,31 +1274,42 @@ #ifdef DEBUG_LAYER_ELEVATION std::cout << "summation of forces\n"; #endif - std::map nodeElevation; - for (std::map > >::iterator it = layerForces.begin(); it != layerForces.end(); ++it) { - const std::vector >& forces = it->second; - if (forces.size() == 1) { - nodeElevation[it->first] = forces.front().first; - } else if (knownElevation.count(it->first) != 0) { + std::map nodeElevation; + for (std::map > >::iterator it = layerForces.begin(); + it != layerForces.end(); + ++it) { + const std::vector >& forces = it->second; + if (knownElevation.count(it->first) != 0) { // use the maximum value - SUMOReal eleMax = -std::numeric_limits::max(); - for (std::vector >::const_iterator it_force = forces.begin(); it_force != forces.end(); ++it_force) { + /* + double eleMax = -std::numeric_limits::max(); + for (std::vector >::const_iterator it_force = forces.begin(); it_force != forces.end(); ++it_force) { eleMax = MAX2(eleMax, it_force->first); } - nodeElevation[it->first] = eleMax; + */ +#ifdef DEBUG_LAYER_ELEVATION + std::cout << " node=" << it->first->getID() << " knownElevation=" << knownEleMax[it->first] << "\n"; +#endif + nodeElevation[it->first] = knownEleMax[it->first]; + } else if (forces.size() == 1) { + nodeElevation[it->first] = forces.front().first; } else { // use the weighted sum - SUMOReal distSum = 0; - for (std::vector >::const_iterator it_force = forces.begin(); it_force != forces.end(); ++it_force) { + double distSum = 0; + for (std::vector >::const_iterator it_force = forces.begin(); + it_force != forces.end(); + ++it_force) { distSum += it_force->second; } - SUMOReal weightSum = 0; - SUMOReal elevation = 0; + double weightSum = 0; + double elevation = 0; #ifdef DEBUG_LAYER_ELEVATION std::cout << " node=" << it->first->getID() << " distSum=" << distSum << "\n"; #endif - for (std::vector >::const_iterator it_force = forces.begin(); it_force != forces.end(); ++it_force) { - const SUMOReal weight = (distSum - it_force->second) / distSum; + for (std::vector >::const_iterator it_force = forces.begin(); + it_force != forces.end(); + ++it_force) { + const double weight = (distSum - it_force->second) / distSum; weightSum += weight; elevation += it_force->first * weight; @@ -1218,12 +1322,12 @@ } #ifdef DEBUG_LAYER_ELEVATION std::cout << "final elevations:\n"; - for (std::map::iterator it = nodeElevation.begin(); it != nodeElevation.end(); ++it) { + for (std::map::iterator it = nodeElevation.begin(); it != nodeElevation.end(); ++it) { std::cout << " node=" << (it->first)->getID() << " ele=" << it->second << "\n";; } #endif - // apply node elevations and interpolate edge shapes in z-direction - for (std::map::iterator it = nodeElevation.begin(); it != nodeElevation.end(); ++it) { + // apply node elevations + for (std::map::iterator it = nodeElevation.begin(); it != nodeElevation.end(); ++it) { NBNode* n = it->first; Position pos = n->getPosition(); n->reinit(n->getPosition() + Position(0, 0, it->second), n->getType()); @@ -1233,27 +1337,26 @@ for (std::map::const_iterator it = ec.begin(); it != ec.end(); ++it) { NBEdge* edge = it->second; const PositionVector& geom = edge->getGeometry(); - const SUMOReal length = geom.length2D(); - const SUMOReal zFrom = nodeElevation[edge->getFromNode()]; - const SUMOReal zTo = nodeElevation[edge->getToNode()]; + const double length = geom.length2D(); + const double zFrom = nodeElevation[edge->getFromNode()]; + const double zTo = nodeElevation[edge->getToNode()]; // XXX if the from- or to-node was part of multiple ways with // different layers, reconstruct the layer value from origID - SUMOReal dist = 0; + double dist = 0; PositionVector newGeom; for (PositionVector::const_iterator it_pos = geom.begin(); it_pos != geom.end(); ++it_pos) { if (it_pos != geom.begin()) { dist += (*it_pos).distanceTo2D(*(it_pos - 1)); } - newGeom.push_back((*it_pos) + Position(0, 0, zFrom + (zTo - zFrom) * dist / length)); + newGeom.push_back((*it_pos) + Position(0, 0, zFrom + (zTo - zFrom)*dist / length)); } edge->setGeometry(newGeom); } } - -std::map -NIImporter_OpenStreetMap::getNeighboringNodes(NBNode* node, SUMOReal maxDist) { - std::map result; +std::map > +NIImporter_OpenStreetMap::getNeighboringNodes(NBNode* node, double maxDist, const std::set& knownElevation) { + std::map > result; std::set visited; std::vector open; open.push_back(node); @@ -1273,13 +1376,14 @@ } else { s = e->getToNode(); } - const SUMOReal dist = result[n] + e->getGeometry().length2D(); + const double dist = result[n].first + e->getGeometry().length2D(); + const double speed = MAX2(e->getSpeed(), result[n].second); if (result.count(s) == 0) { - result[s] = dist; + result[s] = std::make_pair(dist, speed); } else { - result[s] = MIN2(dist, result[s]); + result[s] = std::make_pair(MIN2(dist, result[s].first), MAX2(speed, result[s].second)); } - if (dist < maxDist) { + if (dist < maxDist && knownElevation.count(s) == 0) { open.push_back(s); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_OpenStreetMap.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_OpenStreetMap.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_OpenStreetMap.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_OpenStreetMap.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,14 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @author Walter Bamberger +/// @author Gregor Laemmel /// @date Mon, 14.04.2008 -/// @version $Id: NIImporter_OpenStreetMap.h 21738 2016-10-18 11:39:37Z namdre $ +/// @version $Id: NIImporter_OpenStreetMap.h 23648 2017-03-24 10:35:01Z laemmel $ /// // Importer for networks stored in OpenStreetMap format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,6 +38,7 @@ #include #include #include +#include // =========================================================================== @@ -81,20 +83,26 @@ */ struct NIOSMNode { NIOSMNode(long long int _id, double _lon, double _lat) : - id(_id), lon(_lon), lat(_lat), ele(0), tlsControlled(false), railwayCrossing(false), node(0) {} + id(_id), lon(_lon), lat(_lat), ele(0), tlsControlled(false), railwayCrossing(false), ptStopPostion(false), ptStopLength(0), node(0) {} /// @brief The node's id const long long int id; /// @brief The longitude the node is located at - const SUMOReal lon; + const double lon; /// @brief The latitude the node is located at - const SUMOReal lat; + const double lat; /// @brief The elevation of this node - SUMOReal ele; + double ele; /// @brief Whether this is a tls controlled junction bool tlsControlled; /// @brief Whether this is a railway crossing bool railwayCrossing; + /// @brief Whether this is a public transport stop position + bool ptStopPostion; + /// @brief The length of the pt stop + double ptStopLength; + /// @brief The name of the node + std::string name; /// @brief the NBNode that was instantiated NBNode* node; @@ -118,7 +126,7 @@ /** @brief An internal definition of a loaded edge */ - struct Edge { + struct Edge : public Parameterised { Edge(long long int _id) : id(_id), myNoLanes(-1), myNoLanesForward(0), myMaxSpeed(MAXSPEED_UNGIVEN), @@ -233,13 +241,13 @@ const std::vector& passed, NBNetBuilder& nb); /// @brief reconstruct elevation from layer info - void reconstructLayerElevation(SUMOReal layerElevation, NBNetBuilder& nb); + void reconstructLayerElevation(double layerElevation, NBNetBuilder& nb); - /// @brief collect neighboring nodes with their road distance - std::map getNeighboringNodes(NBNode* node, SUMOReal maxDist); + /// @brief collect neighboring nodes with their road distance and maximum between-speed. Search does not continue beyond knownElevation-nodes + std::map > getNeighboringNodes(NBNode* node, double maxDist, const std::set& knownElevation); protected: - static const SUMOReal MAXSPEED_UNGIVEN; + static const double MAXSPEED_UNGIVEN; static const long long int INVALID_ID; /** @@ -254,9 +262,8 @@ * @param[in, out] uniqueNodes The nodes container for ensuring uniqueness * @param[in] options The options to use */ - NodesHandler(std::map& toFill, - std::set& uniqueNodes, - bool importElevation); + NodesHandler(std::map& toFill, std::set& uniqueNodes, const OptionsCont& cont); /// @brief Destructor @@ -307,6 +314,9 @@ /// @brief whether elevation data should be imported const bool myImportElevation; + /// @brief the options + const OptionsCont& myOptionsCont; + private: /** @brief invalidated copy constructor */ @@ -376,7 +386,7 @@ std::vector myParentElements; /// @brief A map of non-numeric speed descriptions to their numeric values - std::map mySpeedMap; + std::map mySpeedMap; private: /** @brief invalidated copy constructor */ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_RobocupRescue.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_RobocupRescue.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_RobocupRescue.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_RobocupRescue.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 14.04.2008 -/// @version $Id: NIImporter_RobocupRescue.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NIImporter_RobocupRescue.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Importer for networks stored in robocup rescue league format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -50,10 +50,6 @@ #include "NILoader.h" #include "NIImporter_RobocupRescue.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -165,8 +161,8 @@ times.push_back(time); } - Position pos((SUMOReal)(posX / 1000.), -(SUMOReal)(posY / 1000.)); - NBNetBuilder::transformCoordinates(pos); + Position pos((double)(posX / 1000.), -(double)(posY / 1000.)); + NBNetBuilder::transformCoordinate(pos); NBNode* node = new NBNode(toString(id), pos); myNodeCont.insert(node); --noNodes; @@ -195,7 +191,7 @@ >> median >> linesToHead >> linesToTail >> widthForWalkers; NBNode* fromNode = myNodeCont.retrieve(toString(begNode)); NBNode* toNode = myNodeCont.retrieve(toString(endNode)); - SUMOReal speed = (SUMOReal)(50. / 3.6); + double speed = (double)(50. / 3.6); int priority = -1; LaneSpreadFunction spread = linesToHead > 0 && linesToTail > 0 ? LANESPREAD_RIGHT : LANESPREAD_CENTER; if (linesToHead > 0) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_RobocupRescue.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_RobocupRescue.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_RobocupRescue.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_RobocupRescue.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 14.04.2008 -/// @version $Id: NIImporter_RobocupRescue.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIImporter_RobocupRescue.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Importer for networks stored in robocup rescue league format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_SUMO.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_SUMO.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_SUMO.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_SUMO.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 14.04.2008 -/// @version $Id: NIImporter_SUMO.cpp 21714 2016-10-17 11:21:44Z namdre $ +/// @version $Id: NIImporter_SUMO.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Importer for networks stored in SUMO format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -50,13 +50,9 @@ #include #include #include "NILoader.h" -#include "NIXMLEdgesHandler.h" +#include "NIXMLTypesHandler.h" #include "NIImporter_SUMO.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -86,7 +82,8 @@ myHaveSeenInternalEdge(false), myAmLefthand(false), myCornerDetail(0), - myLinkDetail(-1) { + myLinkDetail(-1), + myRectLaneCut(false) { } @@ -109,6 +106,7 @@ return; } // parse file(s) + NIXMLTypesHandler* typesHandler = new NIXMLTypesHandler(myNetBuilder.getTypeCont()); std::vector files = oc.getStringVector("sumo-net-file"); for (std::vector::const_iterator file = files.begin(); file != files.end(); ++file) { if (!FileHelpers::isReadable(*file)) { @@ -118,6 +116,7 @@ setFileName(*file); PROGRESS_BEGIN_MESSAGE("Parsing sumo-net from '" + *file + "'"); XMLSubSys::runParser(*this, *file, true); + XMLSubSys::runParser(*typesHandler, *file, true); PROGRESS_DONE_MESSAGE(); } // build edges @@ -218,6 +217,7 @@ nbe->setLaneWidth(fromLaneIndex, lane->width); nbe->setEndOffset(fromLaneIndex, lane->endOffset); nbe->setSpeed(fromLaneIndex, lane->maxSpeed); + nbe->setAcceleration(fromLaneIndex, lane->accelRamp); nbe->getLaneStruct(fromLaneIndex).oppositeID = lane->oppositeID; } nbe->declareConnectionsAsLoaded(); @@ -269,6 +269,9 @@ if (oc.isDefault("junctions.internal-link-detail") && myLinkDetail > 0) { oc.set("junctions.internal-link-detail", toString(myLinkDetail)); } + if (oc.isDefault("rectangular-lane-cut")) { + oc.set("rectangular-lane-cut", toString(myRectLaneCut)); + } if (!deprecatedVehicleClassesSeen.empty()) { WRITE_WARNING("Deprecated vehicle class(es) '" + toString(deprecatedVehicleClassesSeen) + "' in input network."); deprecatedVehicleClassesSeen.clear(); @@ -335,6 +338,7 @@ myAmLefthand = attrs.getOpt(SUMO_ATTR_LEFTHAND, 0, ok, false); myCornerDetail = attrs.getOpt(SUMO_ATTR_CORNERDETAIL, 0, ok, 0); myLinkDetail = attrs.getOpt(SUMO_ATTR_LINKDETAIL, 0, ok, -1); + myRectLaneCut = attrs.getOpt(SUMO_ATTR_RECTANGULAR_LANE_CUT, 0, ok, false); break; } case SUMO_TAG_EDGE: @@ -443,7 +447,7 @@ myCurrentEdge->type = attrs.getOpt(SUMO_ATTR_TYPE, id.c_str(), ok, ""); myCurrentEdge->shape = attrs.getOpt(SUMO_ATTR_SHAPE, id.c_str(), ok, PositionVector()); NBNetBuilder::transformCoordinates(myCurrentEdge->shape, true, myLocation); - myCurrentEdge->length = attrs.getOpt(SUMO_ATTR_LENGTH, id.c_str(), ok, NBEdge::UNSPECIFIED_LOADED_LENGTH); + myCurrentEdge->length = attrs.getOpt(SUMO_ATTR_LENGTH, id.c_str(), ok, NBEdge::UNSPECIFIED_LOADED_LENGTH); myCurrentEdge->maxSpeed = 0; myCurrentEdge->streetName = attrs.getOpt(SUMO_ATTR_NAME, id.c_str(), ok, ""); if (myCurrentEdge->streetName != "" && OptionsCont::getOptions().isDefault("output.street-names")) { @@ -480,7 +484,7 @@ // save the width and the lane id of the crossing but don't do anything else std::vector& crossings = myPedestrianCrossings[SUMOXMLDefinitions::getJunctionIDFromInternalEdge(myCurrentEdge->id)]; assert(crossings.size() > 0); - crossings.back().width = attrs.get(SUMO_ATTR_WIDTH, id.c_str(), ok); + crossings.back().width = attrs.get(SUMO_ATTR_WIDTH, id.c_str(), ok); return; } else if (myCurrentEdge->func == EDGEFUNC_INTERNAL || myCurrentEdge->func == EDGEFUNC_WALKINGAREA) { myHaveSeenInternalEdge = true; @@ -490,7 +494,7 @@ // !!! deprecated myCurrentLane->maxSpeed = attrs.getFloat("maxspeed"); } else { - myCurrentLane->maxSpeed = attrs.get(SUMO_ATTR_SPEED, id.c_str(), ok); + myCurrentLane->maxSpeed = attrs.get(SUMO_ATTR_SPEED, id.c_str(), ok); } try { myCurrentLane->allow = attrs.getOpt(SUMO_ATTR_ALLOW, id.c_str(), ok, "", false); @@ -499,9 +503,10 @@ myCurrentLane->allow = ""; } myCurrentLane->disallow = attrs.getOpt(SUMO_ATTR_DISALLOW, id.c_str(), ok, ""); - myCurrentLane->width = attrs.getOpt(SUMO_ATTR_WIDTH, id.c_str(), ok, (SUMOReal) NBEdge::UNSPECIFIED_WIDTH); - myCurrentLane->endOffset = attrs.getOpt(SUMO_ATTR_ENDOFFSET, id.c_str(), ok, (SUMOReal) NBEdge::UNSPECIFIED_OFFSET); + myCurrentLane->width = attrs.getOpt(SUMO_ATTR_WIDTH, id.c_str(), ok, (double) NBEdge::UNSPECIFIED_WIDTH); + myCurrentLane->endOffset = attrs.getOpt(SUMO_ATTR_ENDOFFSET, id.c_str(), ok, (double) NBEdge::UNSPECIFIED_OFFSET); myCurrentLane->shape = attrs.get(SUMO_ATTR_SHAPE, id.c_str(), ok); + myCurrentLane->accelRamp = attrs.getOpt(SUMO_ATTR_ACCELERATION, id.c_str(), ok, false); // lane coordinates are derived (via lane spread) do not include them in convex boundary NBNetBuilder::transformCoordinates(myCurrentLane->shape, false, myLocation); } @@ -532,7 +537,7 @@ WRITE_WARNING("Unknown node type for junction '" + id + "'."); } Position pos = readPosition(attrs, id, ok); - NBNetBuilder::transformCoordinates(pos, true, myLocation); + NBNetBuilder::transformCoordinate(pos, true, myLocation); NBNode* node = new NBNode(id, pos, type); if (!myNodeCont.insert(node)) { WRITE_ERROR("Problems on adding junction '" + id + "'."); @@ -543,7 +548,7 @@ SUMOSAXAttributes::parseStringVector(attrs.get(SUMO_ATTR_INTLANES, 0, ok, false), myCurrentJunction.intLanes); // set optional radius if (attrs.hasAttribute(SUMO_ATTR_RADIUS)) { - node->setRadius(attrs.get(SUMO_ATTR_RADIUS, id.c_str(), ok)); + node->setRadius(attrs.get(SUMO_ATTR_RADIUS, id.c_str(), ok)); } // handle custom shape if (attrs.getOpt(SUMO_ATTR_CUSTOMSHAPE, 0, ok, false)) { @@ -587,8 +592,8 @@ conn.tlID = attrs.getOpt(SUMO_ATTR_TLID, 0, ok, ""); conn.mayDefinitelyPass = attrs.getOpt(SUMO_ATTR_PASS, 0, ok, false); conn.keepClear = attrs.getOpt(SUMO_ATTR_KEEP_CLEAR, 0, ok, true); - conn.contPos = attrs.getOpt(SUMO_ATTR_CONTPOS, 0, ok, NBEdge::UNSPECIFIED_CONTPOS); - conn.visibility = attrs.getOpt(SUMO_ATTR_VISIBILITY_DISTANCE, 0, ok, NBEdge::UNSPECIFIED_VISIBILITY_DISTANCE); + conn.contPos = attrs.getOpt(SUMO_ATTR_CONTPOS, 0, ok, NBEdge::UNSPECIFIED_CONTPOS); + conn.visibility = attrs.getOpt(SUMO_ATTR_VISIBILITY_DISTANCE, 0, ok, NBEdge::UNSPECIFIED_VISIBILITY_DISTANCE); if (conn.tlID != "") { conn.tlLinkNo = attrs.get(SUMO_ATTR_TLLINKINDEX, 0, ok); } @@ -675,7 +680,7 @@ } bool ok = true; std::string id = attrs.get(SUMO_ATTR_ID, 0, ok); - SUMOTime offset = TIME2STEPS(attrs.get(SUMO_ATTR_OFFSET, id.c_str(), ok)); + SUMOTime offset = TIME2STEPS(attrs.get(SUMO_ATTR_OFFSET, id.c_str(), ok)); std::string programID = attrs.getOpt(SUMO_ATTR_PROGRAMID, id.c_str(), ok, ""); std::string typeS = attrs.get(SUMO_ATTR_TYPE, 0, ok); TrafficLightType type; @@ -702,7 +707,7 @@ const std::string& id = currentTL->getID(); bool ok = true; std::string state = attrs.get(SUMO_ATTR_STATE, id.c_str(), ok); - SUMOTime duration = TIME2STEPS(attrs.get(SUMO_ATTR_DURATION, id.c_str(), ok)); + SUMOTime duration = TIME2STEPS(attrs.get(SUMO_ATTR_DURATION, id.c_str(), ok)); if (duration < 0) { WRITE_ERROR("Phase duration for tl-logic '" + id + "/" + currentTL->getProgramID() + "' must be positive."); return; @@ -726,11 +731,11 @@ // reverse logic of NBEdge::computeLaneShape // !!! this will only work for old-style constant width lanes const int noLanes = (int)edge->lanes.size(); - SUMOReal offset; + double offset; if (edge->lsf == LANESPREAD_RIGHT) { offset = (SUMO_const_laneWidth + SUMO_const_laneOffset) / 2.; // @todo: why is the lane offset counted in here? } else { - offset = (SUMO_const_laneWidth) / 2. - (SUMO_const_laneWidth * (SUMOReal)noLanes - 1) / 2.; ///= -2.; // @todo: actually, when looking at the road networks, the center line is not in the center + offset = (SUMO_const_laneWidth) / 2. - (SUMO_const_laneWidth * (double)noLanes - 1) / 2.; ///= -2.; // @todo: actually, when looking at the road networks, the center line is not in the center } for (int i = 1; i < (int)firstLane.size() - 1; i++) { const Position& from = firstLane[i - 1]; @@ -775,11 +780,11 @@ Position NIImporter_SUMO::readPosition(const SUMOSAXAttributes& attrs, const std::string& id, bool& ok) { - SUMOReal x = attrs.get(SUMO_ATTR_X, id.c_str(), ok); - SUMOReal y = attrs.get(SUMO_ATTR_Y, id.c_str(), ok); - SUMOReal z = 0; + double x = attrs.get(SUMO_ATTR_X, id.c_str(), ok); + double y = attrs.get(SUMO_ATTR_Y, id.c_str(), ok); + double z = 0; if (attrs.hasAttribute(SUMO_ATTR_Z)) { - z = attrs.get(SUMO_ATTR_Z, id.c_str(), ok); + z = attrs.get(SUMO_ATTR_Z, id.c_str(), ok); } return Position(x, y, z); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_SUMO.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_SUMO.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_SUMO.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_SUMO.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 14.04.2008 -/// @version $Id: NIImporter_SUMO.h 21714 2016-10-17 11:21:44Z namdre $ +/// @version $Id: NIImporter_SUMO.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Importer for networks stored in SUMO format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -192,9 +192,9 @@ /// @brief Whether the junction must be kept clear coming from this connection bool keepClear; /// @brief custom position for internal junction on this connection - SUMOReal contPos; + double contPos; /// @brief custom foe visibility for connection - SUMOReal visibility; + double visibility; }; @@ -203,7 +203,7 @@ */ struct LaneAttrs { /// @brief The maximum velocity allowed on this lane - SUMOReal maxSpeed; + double maxSpeed; /// @brief This lane's shape (needed to reconstruct edge shape for legacy networks) PositionVector shape; /// @brief This lane's connections @@ -213,9 +213,11 @@ /// @brief This lane's disallowed vehicle classes std::string disallow; /// @brief The width of this lane - SUMOReal width; + double width; /// @brief This lane's offset from the intersection - SUMOReal endOffset; + double endOffset; + /// @brief Whether this lane is an acceleration lane + bool accelRamp; /// @brief This lane's opposite lane std::string oppositeID; }; @@ -240,11 +242,11 @@ /// @brief This edges's shape PositionVector shape; /// @brief The length of the edge if set explicitly - SUMOReal length; + double length; /// @brief This edge's priority int priority; /// @brief The maximum velocity allowed on this edge (!!!) - SUMOReal maxSpeed; + double maxSpeed; /// @brief This edge's lanes std::vector lanes; /// @brief The built edge @@ -270,7 +272,7 @@ struct Crossing { std::string edgeID; std::vector crossingEdges; - SUMOReal width; + double width; bool priority; }; @@ -330,6 +332,9 @@ /// @brief the level of geometry detail for internal lanes in the loaded network int myLinkDetail; + /// @brief whether all lanes of an edge should have the same stop line + bool myRectLaneCut; + /// @brief loaded roundabout edges std::vector > myRoundabouts; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_VISUM.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_VISUM.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_VISUM.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_VISUM.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Fri, 19 Jul 2002 -/// @version $Id: NIImporter_VISUM.cpp 21472 2016-09-14 08:50:06Z behrisch $ +/// @version $Id: NIImporter_VISUM.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A VISUM network importer /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -43,10 +44,6 @@ #include "NILoader.h" #include "NIImporter_VISUM.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -230,13 +227,13 @@ // get the id myCurrentID = NBHelpers::normalIDRepresentation(myLineParser.get("Nr")); // get the maximum speed - const SUMOReal speed = getNamedFloat("v0-IV", "V0IV"); + const double speed = getNamedFloat("v0-IV", "V0IV"); // get the priority const int priority = 1000 - TplConvert::_2int(myLineParser.get("Rang").c_str()); // try to retrieve the number of lanes const int numLanes = myCapacity2Lanes.get(getNamedFloat("Kap-IV", "KAPIV")); // insert the type - myNetBuilder.getTypeCont().insert(myCurrentID, numLanes, speed / (SUMOReal) 3.6, priority, SVCAll, NBEdge::UNSPECIFIED_WIDTH, false, NBEdge::UNSPECIFIED_WIDTH, NBEdge::UNSPECIFIED_WIDTH); + myNetBuilder.getTypeCont().insert(myCurrentID, numLanes, speed / (double) 3.6, priority, SVCAll, NBEdge::UNSPECIFIED_WIDTH, false, NBEdge::UNSPECIFIED_WIDTH, NBEdge::UNSPECIFIED_WIDTH); myNetBuilder.getTypeCont().markAsSet(myCurrentID, SUMO_ATTR_NUMLANES); myNetBuilder.getTypeCont().markAsSet(myCurrentID, SUMO_ATTR_SPEED); myNetBuilder.getTypeCont().markAsSet(myCurrentID, SUMO_ATTR_PRIORITY); @@ -249,10 +246,10 @@ // get the id myCurrentID = NBHelpers::normalIDRepresentation(myLineParser.get("Nr")); // get the position - SUMOReal x = getNamedFloat("XKoord"); - SUMOReal y = getNamedFloat("YKoord"); + double x = getNamedFloat("XKoord"); + double y = getNamedFloat("YKoord"); Position pos(x, y); - if (!NBNetBuilder::transformCoordinates(pos)) { + if (!NBNetBuilder::transformCoordinate(pos)) { WRITE_ERROR("Unable to project coordinates for node " + myCurrentID + "."); return; } @@ -272,10 +269,10 @@ //bool sourcesWeighted = getWeightedBool("Proz_Q"); //bool destWeighted = getWeightedBool("Proz_Z"); // get the node information - SUMOReal x = getNamedFloat("XKoord"); - SUMOReal y = getNamedFloat("YKoord"); + double x = getNamedFloat("XKoord"); + double y = getNamedFloat("YKoord"); Position pos(x, y); - if (!NBNetBuilder::transformCoordinates(pos, false)) { + if (!NBNetBuilder::transformCoordinate(pos, false)) { WRITE_ERROR("Unable to project coordinates for district " + myCurrentID + "."); return; } @@ -296,10 +293,10 @@ void NIImporter_VISUM::parse_Point() { long long int id = TplConvert::_2long(myLineParser.get("ID").c_str()); - SUMOReal x = TplConvert::_2SUMOReal(myLineParser.get("XKOORD").c_str()); - SUMOReal y = TplConvert::_2SUMOReal(myLineParser.get("YKOORD").c_str()); + double x = TplConvert::_2double(myLineParser.get("XKOORD").c_str()); + double y = TplConvert::_2double(myLineParser.get("YKOORD").c_str()); Position pos(x, y); - if (!NBNetBuilder::transformCoordinates(pos, false)) { + if (!NBNetBuilder::transformCoordinate(pos, false)) { WRITE_ERROR("Unable to project coordinates for point " + toString(id) + "."); return; } @@ -324,15 +321,15 @@ // get the type std::string type = myLineParser.know("Typ") ? myLineParser.get("Typ") : myLineParser.get("TypNr"); // get the speed - SUMOReal speed = myNetBuilder.getTypeCont().getSpeed(type); + double speed = myNetBuilder.getTypeCont().getSpeed(type); if (!OptionsCont::getOptions().getBool("visum.use-type-speed")) { try { std::string speedS = myLineParser.know("v0-IV") ? myLineParser.get("v0-IV") : myLineParser.get("V0IV"); if (speedS.find("km/h") != std::string::npos) { speedS = speedS.substr(0, speedS.find("km/h")); } - speed = TplConvert::_2SUMORealSec(speedS.c_str(), -1); - speed = speed / (SUMOReal) 3.6; + speed = TplConvert::_2doubleSec(speedS.c_str(), -1); + speed = speed / (double) 3.6; } catch (OutOfBoundsException) {} } if (speed <= 0) { @@ -355,9 +352,9 @@ } catch (UnknownElement) { } } else { - SUMOReal cap = myLineParser.know("KAPIV") - ? TplConvert::_2SUMORealSec(myLineParser.get("KAPIV").c_str(), -1) - : TplConvert::_2SUMORealSec(myLineParser.get("KAP-IV").c_str(), -1); + double cap = myLineParser.know("KAPIV") + ? TplConvert::_2doubleSec(myLineParser.get("KAPIV").c_str(), -1) + : TplConvert::_2doubleSec(myLineParser.get("KAP-IV").c_str(), -1); nolanes = myCapacity2Lanes.get(cap); } // check whether the id is already used @@ -447,14 +444,14 @@ return; } // get the weight of the connection - SUMOReal proz = getWeightedFloat("Proz"); + double proz = getWeightedFloat("Proz"); if (proz > 0) { proz /= 100.; } else { proz = 1; } // get the duration to wait (unused) -// SUMOReal retard = -1; +// double retard = -1; // if (myLineParser.know("t0-IV")) { // retard = getNamedFloat("t0-IV", -1); // } @@ -593,7 +590,7 @@ } bool failed = false; int index; - SUMOReal x, y; + double x, y; try { index = TplConvert::_2int(myLineParser.get("INDEX").c_str()); x = getNamedFloat("XKoord"); @@ -603,7 +600,7 @@ return; } Position pos(x, y); - if (!NBNetBuilder::transformCoordinates(pos)) { + if (!NBNetBuilder::transformCoordinate(pos)) { WRITE_ERROR("Unable to project coordinates for node '" + from->getID() + "'."); return; } @@ -663,9 +660,9 @@ } // get the length std::string lengthS = NBHelpers::normalIDRepresentation(myLineParser.get("LAENGE")); - SUMOReal length = -1; + double length = -1; try { - length = TplConvert::_2SUMOReal(lengthS.c_str()); + length = TplConvert::_2double(lengthS.c_str()); } catch (NumberFormatException&) { WRITE_ERROR("A lane length for edge '" + edge->getID() + "' is not numeric (" + lengthS + ")."); return; @@ -702,14 +699,14 @@ // nope, we have to split the edge... // maybe it is not the proper edge to split - VISUM seems not to sort the splits... bool mustRecheck = true; - SUMOReal seenLength = 0; + double seenLength = 0; while (mustRecheck) { if (edge->getID().substr(edge->getID().length() - node->getID().length() - 1) == "_" + node->getID()) { // ok, we have a previously created edge here std::string sub = edge->getID(); sub = sub.substr(sub.rfind('_', sub.rfind('_') - 1)); sub = sub.substr(1, sub.find('_', 1) - 1); - SUMOReal dist = TplConvert::_2SUMOReal(sub.c_str()); + double dist = TplConvert::_2double(sub.c_str()); if (dist < length) { seenLength += edge->getLength(); if (dirS == "1") { @@ -729,7 +726,7 @@ } // compute position Position p; - SUMOReal useLength = length - seenLength; + double useLength = length - seenLength; useLength = edge->getLength() - useLength; std::string edgeID = edge->getID(); p = edge->getGeometry().positionAtOffset(useLength); @@ -781,9 +778,9 @@ NIImporter_VISUM::parse_SignalGroups() { myCurrentID = NBHelpers::normalIDRepresentation(myLineParser.get("Nr")); std::string LSAid = NBHelpers::normalIDRepresentation(myLineParser.get("LsaNr")); - SUMOReal startTime = getNamedFloat("GzStart", "GRUENANF"); - SUMOReal endTime = getNamedFloat("GzEnd", "GRUENENDE"); - SUMOReal yellowTime = myLineParser.know("GELB") ? getNamedFloat("GELB") : -1; + double startTime = getNamedFloat("GzStart", "GRUENANF"); + double endTime = getNamedFloat("GzEnd", "GRUENENDE"); + double yellowTime = myLineParser.know("GELB") ? getNamedFloat("GELB") : -1; // add to the list if (myTLS.find(LSAid) == myTLS.end()) { WRITE_ERROR("Could not find TLS '" + LSAid + "' for setting the signal group."); @@ -900,9 +897,9 @@ // get the id std::string phaseid = NBHelpers::normalIDRepresentation(myLineParser.get("Nr")); std::string LSAid = NBHelpers::normalIDRepresentation(myLineParser.get("LsaNr")); - SUMOReal startTime = getNamedFloat("GzStart", "GRUENANF"); - SUMOReal endTime = getNamedFloat("GzEnd", "GRUENENDE"); - SUMOReal yellowTime = myLineParser.know("GELB") ? getNamedFloat("GELB") : -1; + double startTime = getNamedFloat("GzStart", "GRUENANF"); + double endTime = getNamedFloat("GzEnd", "GRUENENDE"); + double yellowTime = myLineParser.know("GELB") ? getNamedFloat("GELB") : -1; myTLS.find(LSAid)->second->addPhase(phaseid, (SUMOTime) startTime, (SUMOTime) endTime, (SUMOTime) yellowTime); } @@ -1015,13 +1012,13 @@ -SUMOReal +double NIImporter_VISUM::getWeightedFloat(const std::string& name) { try { - return TplConvert::_2SUMOReal(myLineParser.get(name).c_str()); + return TplConvert::_2double(myLineParser.get(name).c_str()); } catch (...) {} try { - return TplConvert::_2SUMOReal(myLineParser.get((name + "(IV)")).c_str()); + return TplConvert::_2double(myLineParser.get((name + "(IV)")).c_str()); } catch (...) {} return -1; } @@ -1193,25 +1190,27 @@ } -SUMOReal +double NIImporter_VISUM::getNamedFloat(const std::string& fieldName) { - std::string valS = NBHelpers::normalIDRepresentation(myLineParser.get(fieldName)); - return TplConvert::_2SUMOReal(valS.c_str()); + std::string value = myLineParser.get(fieldName); + if (StringUtils::endsWith(myLineParser.get(fieldName), "km/h")) { + value = value.substr(0, value.length() - 4); + } + return TplConvert::_2double(value.c_str()); } -SUMOReal -NIImporter_VISUM::getNamedFloat(const std::string& fieldName, SUMOReal defaultValue) { +double +NIImporter_VISUM::getNamedFloat(const std::string& fieldName, double defaultValue) { try { - std::string valS = NBHelpers::normalIDRepresentation(myLineParser.get(fieldName)); - return TplConvert::_2SUMOReal(valS.c_str()); + return TplConvert::_2double(myLineParser.get(fieldName).c_str()); } catch (...) { return defaultValue; } } -SUMOReal +double NIImporter_VISUM::getNamedFloat(const std::string& fieldName1, const std::string& fieldName2) { if (myLineParser.know(fieldName1)) { return getNamedFloat(fieldName1); @@ -1221,9 +1220,9 @@ } -SUMOReal +double NIImporter_VISUM::getNamedFloat(const std::string& fieldName1, const std::string& fieldName2, - SUMOReal defaultValue) { + double defaultValue) { if (myLineParser.know(fieldName1)) { return getNamedFloat(fieldName1, defaultValue); } else { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_VISUM.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_VISUM.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIImporter_VISUM.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIImporter_VISUM.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Fri, 19 Jul 2002 -/// @version $Id: NIImporter_VISUM.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIImporter_VISUM.h 24108 2017-04-27 18:43:30Z behrisch $ /// // A VISUM network importer /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -129,7 +129,7 @@ * @exception NumberFormatException If the float is not numeric * @exception UnknownElement If the named data field is not in the line */ - SUMOReal getNamedFloat(const std::string& fieldName); + double getNamedFloat(const std::string& fieldName); /** @brief The same, but two different names for the field are allowed * @@ -140,7 +140,7 @@ * @exception NumberFormatException If the float is not numeric * @exception UnknownElement If the named data field is not in the line */ - SUMOReal getNamedFloat(const std::string& fieldName1, const std::string& fieldName2); + double getNamedFloat(const std::string& fieldName1, const std::string& fieldName2); /** @brief Returns the value from the named column as a float or the default value if an error occurs @@ -149,7 +149,7 @@ * @param[in] defaultValue The default to return in the case of an error * @return The parsed real or the default value if an error while parsing occured */ - SUMOReal getNamedFloat(const std::string& fieldName, SUMOReal defaultValue); + double getNamedFloat(const std::string& fieldName, double defaultValue); /** @brief The same, but two different names for the field are allowed * @@ -158,8 +158,8 @@ * @param[in] defaultValue The default to return in the case of an error * @return The parsed real or the default value if an error while parsing occured */ - SUMOReal getNamedFloat(const std::string& fieldName1, const std::string& fieldName2, - SUMOReal defaultValue); + double getNamedFloat(const std::string& fieldName1, const std::string& fieldName2, + double defaultValue); /** @brief Returns the value from the named column as a normalised string @@ -186,16 +186,16 @@ std::string getNamedString(const std::string& fieldName1, const std::string& fieldName2); - /** @brief tries to get a SUMOReal which is possibly assigned to a certain modality + /** @brief tries to get a double which is possibly assigned to a certain modality * - * When the SUMOReal cannot be extracted using the given name, "(IV)" is + * When the double cannot be extracted using the given name, "(IV)" is * appended to the begin of the name. Note that this function does not * yet support public traffic. * * @param[in] name Name of the column to extract the real from * @return The real stored under the named column, or if not found the one from "(IV)"+name, or if not found -1 */ - SUMOReal getWeightedFloat(const std::string& name); + double getWeightedFloat(const std::string& name); /** @brief tries to get a bool which is possibly assigned to a certain modality diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NILoader.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NILoader.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NILoader.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NILoader.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Robert Hilbrich /// @date Tue, 20 Nov 2001 -/// @version $Id: NILoader.cpp 21276 2016-08-02 11:39:45Z rhilbrich $ +/// @version $Id: NILoader.cpp 23567 2017-03-21 09:14:36Z laemmel $ /// // Perfoms network import /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -68,21 +68,14 @@ #include "typemap.h" #include "NILoader.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - - // =========================================================================== // method definitions // =========================================================================== NILoader::NILoader(NBNetBuilder& nb) : myNetBuilder(nb) {} - NILoader::~NILoader() {} - void NILoader::load(OptionsCont& oc) { // load types first @@ -140,14 +133,19 @@ } WRITE_MESSAGE(" " + toString(myNetBuilder.getEdgeCont().size()) + " edges loaded."); if (myNetBuilder.getEdgeCont().getNoEdgeSplits() > 0) { - WRITE_MESSAGE("The split of edges was performed " + toString(myNetBuilder.getEdgeCont().getNoEdgeSplits()) + " times."); + WRITE_MESSAGE( + "The split of edges was performed " + toString(myNetBuilder.getEdgeCont().getNoEdgeSplits()) + " times."); } + + //TODO: uncomment the following lines + adapt tests! [Gregor March '17] +// if (myNetBuilder.getPTStopCont().size() > 0) { +// WRITE_MESSAGE(" " + toString(myNetBuilder.getPTStopCont().size()) + " pt stops loaded."); +// } if (GeoConvHelper::getProcessing().usingGeoProjection()) { WRITE_MESSAGE("Proj projection parameters used: '" + GeoConvHelper::getProcessing().getProjString() + "'."); } } - /* ------------------------------------------------------------------------- * file loading methods * ----------------------------------------------------------------------- */ @@ -169,7 +167,9 @@ WRITE_WARNING("Deprecated vehicle class(es) '" + toString(deprecatedVehicleClassesSeen) + "' in input edge files."); } // load the connections - loadXMLType(new NIXMLConnectionsHandler(myNetBuilder.getEdgeCont(), myNetBuilder.getNodeCont(), myNetBuilder.getTLLogicCont()), + loadXMLType(new NIXMLConnectionsHandler(myNetBuilder.getEdgeCont(), + myNetBuilder.getNodeCont(), + myNetBuilder.getTLLogicCont()), oc.getStringVector("connection-files"), "connections"); // load traffic lights (needs to come last, references loaded edges and connections) loadXMLType(new NIXMLTrafficLightsHandler( @@ -177,7 +177,6 @@ oc.getStringVector("tllogic-files"), "traffic lights"); } - void NILoader::loadXMLType(SUMOSAXHandler* handler, const std::vector& files, const std::string& type, const bool stringParse) { @@ -204,11 +203,12 @@ } } catch (const XERCES_CPP_NAMESPACE::XMLException& toCatch) { exceptMsg = TplConvert::_2str(toCatch.getMessage()) - + "\n The " + type + " could not be loaded from '" + handler->getFileName() + "'."; + + "\n The " + type + " could not be loaded from '" + handler->getFileName() + "'."; } catch (const ProcessError& toCatch) { - exceptMsg = std::string(toCatch.what()) + "\n The " + type + " could not be loaded from '" + handler->getFileName() + "'."; + exceptMsg = + std::string(toCatch.what()) + "\n The " + type + " could not be loaded from '" + handler->getFileName() + "'."; } catch (...) { - exceptMsg = "The " + type + " could not be loaded from '" + handler->getFileName() + "'."; + exceptMsg = "The " + type + " could not be loaded from '" + handler->getFileName() + "'."; } delete handler; if (exceptMsg != "") { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NILoader.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NILoader.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NILoader.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NILoader.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: NILoader.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NILoader.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Perfoms network import /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NINavTeqHelper.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NINavTeqHelper.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NINavTeqHelper.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NINavTeqHelper.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Jul 2006 -/// @version $Id: NINavTeqHelper.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NINavTeqHelper.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Some parser methods shared around several formats containing NavTeq-Nets /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,37 +37,33 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== -SUMOReal +double NINavTeqHelper::getSpeed(const std::string& id, const std::string& speedClassS) { try { int speedClass = TplConvert::_2int(speedClassS.c_str()); switch (speedClass) { case -1: - return (SUMOReal) 1.0 / (SUMOReal) 3.6; + return (double) 1.0 / (double) 3.6; case 1: - return (SUMOReal) 200 / (SUMOReal) 3.6; //> 130 KPH / > 80 MPH + return (double) 200 / (double) 3.6; //> 130 KPH / > 80 MPH case 2: - return (SUMOReal) 120 / (SUMOReal) 3.6; //101-130 KPH / 65-80 MPH + return (double) 120 / (double) 3.6; //101-130 KPH / 65-80 MPH case 3: - return (SUMOReal) 100 / (SUMOReal) 3.6; // 91-100 KPH / 55-64 MPH + return (double) 100 / (double) 3.6; // 91-100 KPH / 55-64 MPH case 4: - return (SUMOReal) 80 / (SUMOReal) 3.6; // 71-90 KPH / 41-54 MPH + return (double) 80 / (double) 3.6; // 71-90 KPH / 41-54 MPH case 5: - return (SUMOReal) 70 / (SUMOReal) 3.6; // 51-70 KPH / 31-40 MPH + return (double) 70 / (double) 3.6; // 51-70 KPH / 31-40 MPH case 6: - return (SUMOReal) 50 / (SUMOReal) 3.6; // 31-50 KPH / 21-30 MPH + return (double) 50 / (double) 3.6; // 31-50 KPH / 21-30 MPH case 7: - return (SUMOReal) 30 / (SUMOReal) 3.6; // 11-30 KPH / 6-20 MPH + return (double) 30 / (double) 3.6; // 11-30 KPH / 6-20 MPH case 8: - return (SUMOReal) 5 / (SUMOReal) 3.6; //< 11 KPH / < 6 MPH + return (double) 5 / (double) 3.6; //< 11 KPH / < 6 MPH default: throw ProcessError("Invalid speed code (edge '" + id + "')."); } @@ -78,7 +74,7 @@ int -NINavTeqHelper::getLaneNumber(const std::string& id, const std::string& laneNoS, SUMOReal speed) { +NINavTeqHelper::getLaneNumber(const std::string& id, const std::string& laneNoS, double speed) { try { int nolanes = TplConvert::_2int(laneNoS.c_str()); if (nolanes < 0) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NINavTeqHelper.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NINavTeqHelper.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NINavTeqHelper.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NINavTeqHelper.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Jul 2006 -/// @version $Id: NINavTeqHelper.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NINavTeqHelper.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Some parser methods shared around several formats containing NavTeq-Nets /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -68,8 +68,8 @@ * @return The converted speed (in m/s) * @exception ProcessError If the given speed class definition is not a number or if it is not known */ - static SUMOReal getSpeed(const std::string& id, - const std::string& speedClassS); + static double getSpeed(const std::string& id, + const std::string& speedClassS); /** @brief Returns the lane number evaluating the given Navteq-description @@ -81,7 +81,7 @@ * @exception ProcessError If the given lane number definition is not a number or if it is not known */ static int getLaneNumber(const std::string& id, - const std::string& laneNoS, SUMOReal speed); + const std::string& laneNoS, double speed); /** @brief Adds vehicle classes parsing the given list of allowed vehicles diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIVisumTL.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIVisumTL.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIVisumTL.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIVisumTL.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Thr, 08 May 2003 -/// @version $Id: NIVisumTL.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NIVisumTL.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Intermediate class for storing visum traffic lights during their import /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2003-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2003-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include #include "NIVisumTL.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIVisumTL.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIVisumTL.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIVisumTL.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIVisumTL.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVisumTL.h /// @author Daniel Krajzewicz /// @date Wed, 07 May 2003 -/// @version $Id: NIVisumTL.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVisumTL.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Intermediate class for storing visum traffic lights during their import /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLConnectionsHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLConnectionsHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLConnectionsHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLConnectionsHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Thu, 17 Oct 2002 -/// @version $Id: NIXMLConnectionsHandler.cpp 21714 2016-10-17 11:21:44Z namdre $ +/// @version $Id: NIXMLConnectionsHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Importer for edge connections stored in XML /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -52,10 +52,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -216,8 +212,8 @@ bool ok = true; const bool mayDefinitelyPass = attrs.getOpt(SUMO_ATTR_PASS, 0, ok, false); const bool keepClear = attrs.getOpt(SUMO_ATTR_KEEP_CLEAR, 0, ok, true); - const SUMOReal contPos = attrs.getOpt(SUMO_ATTR_CONTPOS, 0, ok, NBEdge::UNSPECIFIED_CONTPOS); - const SUMOReal visibility = attrs.getOpt(SUMO_ATTR_VISIBILITY_DISTANCE, 0, ok, NBEdge::UNSPECIFIED_VISIBILITY_DISTANCE); + const double contPos = attrs.getOpt(SUMO_ATTR_CONTPOS, 0, ok, NBEdge::UNSPECIFIED_CONTPOS); + const double visibility = attrs.getOpt(SUMO_ATTR_VISIBILITY_DISTANCE, 0, ok, NBEdge::UNSPECIFIED_VISIBILITY_DISTANCE); if (!ok) { return; } @@ -315,7 +311,7 @@ NBNode* node = 0; EdgeVector edges; const std::string nodeID = attrs.get(SUMO_ATTR_NODE, 0, ok); - const SUMOReal width = attrs.getOpt(SUMO_ATTR_WIDTH, nodeID.c_str(), ok, NBNode::DEFAULT_CROSSING_WIDTH, true); + const double width = attrs.getOpt(SUMO_ATTR_WIDTH, nodeID.c_str(), ok, NBNode::DEFAULT_CROSSING_WIDTH, true); const bool discard = attrs.getOpt(SUMO_ATTR_DISCARD, nodeID.c_str(), ok, false, true); std::vector edgeIDs; if (!attrs.hasAttribute(SUMO_ATTR_EDGES)) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLConnectionsHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLConnectionsHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLConnectionsHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLConnectionsHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: NIXMLConnectionsHandler.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIXMLConnectionsHandler.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Importer for edge connections stored in XML /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLEdgesHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLEdgesHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLEdgesHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLEdgesHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Walter Bamberger /// @author Laura Bieker /// @date Tue, 20 Nov 2001 -/// @version $Id: NIXMLEdgesHandler.cpp 21268 2016-07-29 13:32:04Z namdre $ +/// @version $Id: NIXMLEdgesHandler.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Importer for network edges stored in XML /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,10 +55,6 @@ #include "NIXMLNodesHandler.h" #include "NIXMLEdgesHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -202,10 +198,10 @@ // speed, priority and the number of lanes have now default values; // try to read the real values from the file if (attrs.hasAttribute(SUMO_ATTR_SPEED)) { - myCurrentSpeed = attrs.get(SUMO_ATTR_SPEED, myCurrentID.c_str(), ok); + myCurrentSpeed = attrs.get(SUMO_ATTR_SPEED, myCurrentID.c_str(), ok); } if (myOptions.getBool("speed-in-kmh") && myCurrentSpeed != NBEdge::UNSPECIFIED_SPEED) { - myCurrentSpeed = myCurrentSpeed / (SUMOReal) 3.6; + myCurrentSpeed = myCurrentSpeed / (double) 3.6; } // try to get the number of lanes if (attrs.hasAttribute(SUMO_ATTR_NUMLANES)) { @@ -217,11 +213,11 @@ } // try to get the width if (attrs.hasAttribute(SUMO_ATTR_WIDTH)) { - myCurrentWidth = attrs.get(SUMO_ATTR_WIDTH, myCurrentID.c_str(), ok); + myCurrentWidth = attrs.get(SUMO_ATTR_WIDTH, myCurrentID.c_str(), ok); } // try to get the offset of the stop line from the intersection if (attrs.hasAttribute(SUMO_ATTR_ENDOFFSET)) { - myCurrentEndOffset = attrs.get(SUMO_ATTR_ENDOFFSET, myCurrentID.c_str(), ok); + myCurrentEndOffset = attrs.get(SUMO_ATTR_ENDOFFSET, myCurrentID.c_str(), ok); } // try to get the street name if (attrs.hasAttribute(SUMO_ATTR_NAME)) { @@ -248,11 +244,11 @@ // try to get the spread type myLanesSpread = tryGetLaneSpread(attrs); // try to get the length - myLength = attrs.getOpt(SUMO_ATTR_LENGTH, myCurrentID.c_str(), ok, myLength); + myLength = attrs.getOpt(SUMO_ATTR_LENGTH, myCurrentID.c_str(), ok, myLength); // try to get the sidewalkWidth - mySidewalkWidth = attrs.getOpt(SUMO_ATTR_SIDEWALKWIDTH, myCurrentID.c_str(), ok, mySidewalkWidth); + mySidewalkWidth = attrs.getOpt(SUMO_ATTR_SIDEWALKWIDTH, myCurrentID.c_str(), ok, mySidewalkWidth); // try to get the bikeLaneWidth - myBikeLaneWidth = attrs.getOpt(SUMO_ATTR_BIKELANEWIDTH, myCurrentID.c_str(), ok, myBikeLaneWidth); + myBikeLaneWidth = attrs.getOpt(SUMO_ATTR_BIKELANEWIDTH, myCurrentID.c_str(), ok, myBikeLaneWidth); // insert the parsed edge into the edges map if (!ok) { return; @@ -323,15 +319,19 @@ } // try to get the width if (attrs.hasAttribute(SUMO_ATTR_WIDTH)) { - myCurrentEdge->setLaneWidth(lane, attrs.get(SUMO_ATTR_WIDTH, myCurrentID.c_str(), ok)); + myCurrentEdge->setLaneWidth(lane, attrs.get(SUMO_ATTR_WIDTH, myCurrentID.c_str(), ok)); } // try to get the end-offset (lane shortened due to pedestrian crossing etc..) if (attrs.hasAttribute(SUMO_ATTR_ENDOFFSET)) { - myCurrentEdge->setEndOffset(lane, attrs.get(SUMO_ATTR_ENDOFFSET, myCurrentID.c_str(), ok)); + myCurrentEdge->setEndOffset(lane, attrs.get(SUMO_ATTR_ENDOFFSET, myCurrentID.c_str(), ok)); } // try to get lane specific speed (should not occur for german networks) if (attrs.hasAttribute(SUMO_ATTR_SPEED)) { - myCurrentEdge->setSpeed(lane, attrs.get(SUMO_ATTR_SPEED, myCurrentID.c_str(), ok)); + myCurrentEdge->setSpeed(lane, attrs.get(SUMO_ATTR_SPEED, myCurrentID.c_str(), ok)); + } + // check whether this is an acceleration lane + if (attrs.hasAttribute(SUMO_ATTR_ACCELERATION)) { + myCurrentEdge->setAcceleration(lane, attrs.get(SUMO_ATTR_ACCELERATION, myCurrentID.c_str(), ok)); } } @@ -345,7 +345,7 @@ } bool ok = true; Split e; - e.pos = attrs.get(SUMO_ATTR_POSITION, 0, ok); + e.pos = attrs.get(SUMO_ATTR_POSITION, 0, ok); if (ok) { if (fabs(e.pos) > myCurrentEdge->getGeometry().length()) { WRITE_ERROR("Edge '" + myCurrentID + "' has a split at invalid position " + toString(e.pos) + "."); @@ -379,8 +379,10 @@ } e.speed = attrs.getOpt(SUMO_ATTR_SPEED, 0, ok, myCurrentEdge->getSpeed()); if (attrs.hasAttribute(SUMO_ATTR_SPEED) && myOptions.getBool("speed-in-kmh")) { - e.speed /= (SUMOReal) 3.6; + e.speed /= (double) 3.6; } + e.idBefore = attrs.getOpt(SUMO_ATTR_ID_BEFORE, 0, ok, std::string("")); + e.idAfter = attrs.getOpt(SUMO_ATTR_ID_AFTER, 0, ok, std::string("")); if (!ok) { return; } @@ -482,7 +484,17 @@ myCurrentID + "'"); return; } - myEdgeCont.extract(myDistrictCont, edge, true); + const int lane = attrs.getOpt(SUMO_ATTR_INDEX, myCurrentID.c_str(), ok, -1); + if (lane < 0) { + myEdgeCont.extract(myDistrictCont, edge, true); + } else { + edge->removeFromConnections(0, lane, -1, false, true); + const EdgeVector incoming = edge->getIncomingEdges(); + for (EdgeVector::const_iterator e = incoming.begin(); e != incoming.end(); ++e) { + (*e)->removeFromConnections(edge, -1, lane, false, true); + } + edge->deleteLane(lane, false); + } } @@ -534,8 +546,8 @@ e->invalidateConnections(true); } - std::string edgeid = e->getID(); - SUMOReal seen = 0; + std::string firstID = ""; + double seen = 0; for (i = mySplits.begin(); i != mySplits.end(); ++i) { const Split& exp = *i; assert(exp.lanes.size() != 0); @@ -543,13 +555,17 @@ if (myNodeCont.insert(exp.node)) { myNodeCont.markAsSplit(exp.node); // split the edge - std::string pid = e->getID(); + std::string idBefore = exp.idBefore == "" ? e->getID() : exp.idBefore; + std::string idAfter = exp.idAfter == "" ? exp.node->getID() : exp.idAfter; + if (firstID == "") { + firstID = idBefore; + } myEdgeCont.splitAt(myDistrictCont, e, exp.pos - seen, exp.node, - pid, exp.node->getID(), e->getNumLanes(), (int) exp.lanes.size(), exp.speed); + idBefore, idAfter, e->getNumLanes(), (int) exp.lanes.size(), exp.speed); seen = exp.pos; std::vector newLanes = exp.lanes; - NBEdge* pe = myEdgeCont.retrieve(pid); - NBEdge* ne = myEdgeCont.retrieve(exp.node->getID()); + NBEdge* pe = myEdgeCont.retrieve(idBefore); + NBEdge* ne = myEdgeCont.retrieve(idAfter); // reconnect lanes pe->invalidateConnections(true); // new on right @@ -596,7 +612,7 @@ } } // patch lane offsets - e = myEdgeCont.retrieve(edgeid); + e = myEdgeCont.retrieve(firstID); if (mySplits.front().pos != 0) { // add a dummy split at the beginning to ensure correct offset Split start; @@ -609,7 +625,7 @@ i = mySplits.begin(); for (; i != mySplits.end(); ++i) { int maxLeft = (*i).lanes.back(); - SUMOReal offset = 0; + double offset = 0; if (maxLeft < noLanesMax) { if (e->getLaneSpreadFunction() == LANESPREAD_RIGHT) { offset = SUMO_const_laneWidthAndOffset * (noLanesMax - 1 - maxLeft); @@ -631,6 +647,7 @@ } } } + myCurrentEdge = 0; } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLEdgesHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLEdgesHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLEdgesHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLEdgesHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: NIXMLEdgesHandler.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIXMLEdgesHandler.h 23910 2017-04-11 10:13:26Z behrisch $ /// // Importer for network edges stored in XML /****************************************************************************/ @@ -149,7 +149,7 @@ std::string myCurrentID; /// @brief The current edge's maximum speed - SUMOReal myCurrentSpeed; + double myCurrentSpeed; /// @brief The current edge's priority int myCurrentPriority; @@ -158,10 +158,10 @@ int myCurrentLaneNo; /// @brief The current edge's lane width - SUMOReal myCurrentWidth; + double myCurrentWidth; /// @brief The current edge's offset till the destination node - SUMOReal myCurrentEndOffset; + double myCurrentEndOffset; /// @brief The current edge's street name std::string myCurrentStreetName; @@ -173,7 +173,7 @@ NBNode* myFromNode, *myToNode; /// @brief The current edge's length - SUMOReal myLength; + double myLength; /// @brief The shape of the edge PositionVector myShape; @@ -188,10 +188,10 @@ bool myReinitKeepEdgeShape; /// @brief The width of the sidewalk that shall be added to the current edge - SUMOReal mySidewalkWidth; + double mySidewalkWidth; /// @brief The width of the bike lane that shall be added to the current edge - SUMOReal myBikeLaneWidth; + double myBikeLaneWidth; /// @} @@ -231,11 +231,15 @@ /// @brief The lanes after this change std::vector lanes; /// @brief The position of this change - SUMOReal pos; + double pos; /// @brief The speed after this change - SUMOReal speed; + double speed; /// @brief The new node that is created for this split NBNode* node; + /// @brief The id for the edge before the split + std::string idBefore; + /// @brief The id for the edge after the split + std::string idAfter; }; /// @brief The list of this edge's splits @@ -263,7 +267,7 @@ class split_by_pos_finder { public: /// @brief Constructor - explicit split_by_pos_finder(SUMOReal pos) + explicit split_by_pos_finder(double pos) : myPosition(pos) { } /// @brief Comparing operator @@ -273,7 +277,7 @@ private: /// @brief The position to search for - SUMOReal myPosition; + double myPosition; }; @@ -297,8 +301,8 @@ */ void addEdge(const SUMOSAXAttributes& attrs); - /** @brief parses delete tag and deletes the specified edge - * @param[in] attrs The attributes to get the edge's id from + /** @brief parses delete tag and deletes the specified edge or lane + * @param[in] attrs The attributes to get the edge id and the optional lane index from */ void deleteEdge(const SUMOSAXAttributes& attrs); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLNodesHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLNodesHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLNodesHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLNodesHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: NIXMLNodesHandler.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: NIXMLNodesHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Importer for network nodes stored in XML /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -52,10 +52,6 @@ #include "NIXMLNodesHandler.h" #include "NIImporter_SUMO.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -122,20 +118,20 @@ myPosition.set(0, 0, 0); // better to reset than to reuse the previous (z)-value } if (attrs.hasAttribute(SUMO_ATTR_X)) { - myPosition.set(attrs.get(SUMO_ATTR_X, myID.c_str(), ok), myPosition.y()); + myPosition.set(attrs.get(SUMO_ATTR_X, myID.c_str(), ok), myPosition.y()); xOk = true; needConversion = true; } if (attrs.hasAttribute(SUMO_ATTR_Y)) { - myPosition.set(myPosition.x(), attrs.get(SUMO_ATTR_Y, myID.c_str(), ok)); + myPosition.set(myPosition.x(), attrs.get(SUMO_ATTR_Y, myID.c_str(), ok)); yOk = true; needConversion = true; } if (attrs.hasAttribute(SUMO_ATTR_Z)) { - myPosition.set(myPosition.x(), myPosition.y(), attrs.get(SUMO_ATTR_Z, myID.c_str(), ok)); + myPosition.set(myPosition.x(), myPosition.y(), attrs.get(SUMO_ATTR_Z, myID.c_str(), ok)); } if (xOk && yOk) { - if (needConversion && !NBNetBuilder::transformCoordinates(myPosition, true, myLocation)) { + if (needConversion && !NBNetBuilder::transformCoordinate(myPosition, true, myLocation)) { WRITE_ERROR("Unable to project coordinates for node '" + myID + "'."); } } else { @@ -203,7 +199,7 @@ } // set optional radius if (attrs.hasAttribute(SUMO_ATTR_RADIUS)) { - node->setRadius(attrs.get(SUMO_ATTR_RADIUS, nodeID.c_str(), ok)); + node->setRadius(attrs.get(SUMO_ATTR_RADIUS, nodeID.c_str(), ok)); } // set optional keepClear flag if (attrs.hasAttribute(SUMO_ATTR_KEEP_CLEAR)) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLNodesHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLNodesHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLNodesHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLNodesHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: NIXMLNodesHandler.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIXMLNodesHandler.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Importer for network nodes stored in XML /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLTrafficLightsHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLTrafficLightsHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLTrafficLightsHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLTrafficLightsHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 2011-10-05 -/// @version $Id: NIXMLTrafficLightsHandler.cpp 21130 2016-07-08 05:50:46Z namdre $ +/// @version $Id: NIXMLTrafficLightsHandler.cpp 23879 2017-04-07 12:31:47Z namdre $ /// // Importer for traffic lights stored in XML /****************************************************************************/ @@ -53,10 +53,6 @@ #include "NIImporter_SUMO.h" #include "NIXMLTrafficLightsHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -127,7 +123,7 @@ bool ok = true; std::string id = attrs.get(SUMO_ATTR_ID, 0, ok); std::string programID = attrs.getOpt(SUMO_ATTR_PROGRAMID, id.c_str(), ok, ""); - SUMOTime offset = attrs.hasAttribute(SUMO_ATTR_OFFSET) ? TIME2STEPS(attrs.get(SUMO_ATTR_OFFSET, id.c_str(), ok)) : 0; + SUMOTime offset = attrs.hasAttribute(SUMO_ATTR_OFFSET) ? TIME2STEPS(attrs.get(SUMO_ATTR_OFFSET, id.c_str(), ok)) : 0; std::string typeS = attrs.getOpt(SUMO_ATTR_TYPE, 0, ok, OptionsCont::getOptions().getString("tls.default-type")); TrafficLightType type; @@ -137,7 +133,7 @@ WRITE_ERROR("Unknown traffic light type '" + typeS + "' for tlLogic '" + id + "'."); return 0; } - // there are two scenarios to consider + // there are three scenarios to consider // 1) the tll.xml is loaded to update traffic lights defined in a net.xml: // simply retrieve the loaded definitions and update them // 2) the tll.xml is loaded to define new traffic lights @@ -262,7 +258,10 @@ } } } else { - WRITE_ERROR("The traffic light '" + tlID + "' is not known."); + SumoXMLNodeType type = from->getToNode()->getType(); + if (type != NODETYPE_RAIL_CROSSING && type != NODETYPE_RAIL_SIGNAL) { + WRITE_ERROR("The traffic light '" + tlID + "' is not known."); + } } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLTrafficLightsHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLTrafficLightsHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLTrafficLightsHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLTrafficLightsHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIXMLTrafficLightsHandler.h /// @author Jakob Erdmann /// @date 2011-10-05 -/// @version $Id: NIXMLTrafficLightsHandler.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIXMLTrafficLightsHandler.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Importer for traffic lights stored in XML /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLTypesHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLTypesHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLTypesHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLTypesHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Walter Bamberger /// @date Tue, 20 Nov 2001 -/// @version $Id: NIXMLTypesHandler.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIXMLTypesHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Importer for edge type information stored in XML /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,10 +47,6 @@ #include #include "NIXMLTypesHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -75,14 +71,14 @@ const std::string defType = myTypeCont.knows(myCurrentTypeID) ? myCurrentTypeID : ""; const int priority = attrs.getOpt(SUMO_ATTR_PRIORITY, id, ok, myTypeCont.getPriority(defType)); const int numLanes = attrs.getOpt(SUMO_ATTR_NUMLANES, id, ok, myTypeCont.getNumLanes(defType)); - const SUMOReal speed = attrs.getOpt(SUMO_ATTR_SPEED, id, ok, myTypeCont.getSpeed(defType)); + const double speed = attrs.getOpt(SUMO_ATTR_SPEED, id, ok, myTypeCont.getSpeed(defType)); const std::string allowS = attrs.getOpt(SUMO_ATTR_ALLOW, id, ok, ""); const std::string disallowS = attrs.getOpt(SUMO_ATTR_DISALLOW, id, ok, ""); const bool oneway = attrs.getOpt(SUMO_ATTR_ONEWAY, id, ok, myTypeCont.getIsOneWay(defType)); const bool discard = attrs.getOpt(SUMO_ATTR_DISCARD, id, ok, false); - const SUMOReal width = attrs.getOpt(SUMO_ATTR_WIDTH, id, ok, myTypeCont.getWidth(defType)); - const SUMOReal sidewalkWidth = attrs.getOpt(SUMO_ATTR_SIDEWALKWIDTH, id, ok, myTypeCont.getSidewalkWidth(defType)); - const SUMOReal bikeLaneWidth = attrs.getOpt(SUMO_ATTR_BIKELANEWIDTH, id, ok, myTypeCont.getBikeLaneWidth(defType)); + const double width = attrs.getOpt(SUMO_ATTR_WIDTH, id, ok, myTypeCont.getWidth(defType)); + const double sidewalkWidth = attrs.getOpt(SUMO_ATTR_SIDEWALKWIDTH, id, ok, myTypeCont.getSidewalkWidth(defType)); + const double bikeLaneWidth = attrs.getOpt(SUMO_ATTR_BIKELANEWIDTH, id, ok, myTypeCont.getBikeLaneWidth(defType)); if (!ok) { return; } @@ -109,7 +105,7 @@ case SUMO_TAG_RESTRICTION: { bool ok = true; const SUMOVehicleClass svc = getVehicleClassID(attrs.get(SUMO_ATTR_VCLASS, myCurrentTypeID.c_str(), ok)); - const SUMOReal speed = attrs.get(SUMO_ATTR_SPEED, myCurrentTypeID.c_str(), ok); + const double speed = attrs.get(SUMO_ATTR_SPEED, myCurrentTypeID.c_str(), ok); if (ok) { myTypeCont.addRestriction(myCurrentTypeID, svc, speed); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLTypesHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLTypesHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/NIXMLTypesHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/NIXMLTypesHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: NIXMLTypesHandler.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIXMLTypesHandler.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Importer for edge type information stored in XML /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/NIImporter_Vissim.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/NIImporter_Vissim.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/NIImporter_Vissim.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/NIImporter_Vissim.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Lukas Grohmann (AIT) /// @author Gerald Richter (AIT) /// @date Sept 2002 -/// @version $Id: NIImporter_Vissim.cpp 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: NIImporter_Vissim.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -117,13 +117,9 @@ #include #include #include +#include #include // !!! only for debugging purposes -#include - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS // =========================================================================== @@ -321,15 +317,15 @@ std::vector sPos_v(StringTokenizer( myElemData["pos"].front(), " ").getVector()); myElemData["pos"].pop_front(); - std::vector pos_v(3); + std::vector pos_v(3); // doing a transform with explicit hint on function signature std::transform(sPos_v.begin(), sPos_v.end(), pos_v.begin(), - TplConvert::_str2SUMOReal); + TplConvert::_str2double); geom.push_back_noDoublePos(Position(pos_v[0], pos_v[1], pos_v[2])); } // FIXME: a length = 0 PosVec seems fatal -> segfault - SUMOReal length(geom.length()); + double length(geom.length()); if (isConnector == false) { // Add Edge @@ -337,8 +333,8 @@ myElemData["name"].front(), myElemData["type"].front(), (int)myElemData["width"].size(), // numLanes, - TplConvert::_str2SUMOReal(myElemData["zuschlag1"].front()), - TplConvert::_str2SUMOReal(myElemData["zuschlag2"].front()), + TplConvert::_str2double(myElemData["zuschlag1"].front()), + TplConvert::_str2double(myElemData["zuschlag2"].front()), length, geom, clv); NIVissimEdge::dictionary(id, edge); if (id == 85 || id == 91) { @@ -363,7 +359,7 @@ NIVissimExtendedEdgePoint from_def( TplConvert::_str2int(myElemData["from_id"].front()), laneVec, - TplConvert::_str2SUMOReal(myElemData["from_pos"].front()), + TplConvert::_str2double(myElemData["from_pos"].front()), assignedVehicles); //NOTE: there should be only 1 lane number in XML @@ -377,7 +373,7 @@ NIVissimExtendedEdgePoint to_def( TplConvert::_str2int(myElemData["to_id"].front()), laneVec, - TplConvert::_str2SUMOReal(myElemData["to_pos"].front()), + TplConvert::_str2double(myElemData["to_pos"].front()), assignedVehicles); NIVissimConnection* connector = new @@ -444,15 +440,15 @@ int id = attrs.get(VISSIM_ATTR_NO, 0, ok); int edgeid = attrs.get(VISSIM_ATTR_INTLINK, 0, ok); std::string name = attrs.get(VISSIM_ATTR_NAME, 0, ok, false); - SUMOReal position = attrs.get(VISSIM_ATTR_POS, 0, ok); + double position = attrs.get(VISSIM_ATTR_POS, 0, ok); std::vector > assignedVehicles; // (vclass, vwunsch) //FIXME: vWunsch + Fahzeugklassen einlesen // There can be s std::vector districts; //FIXME: Parkplatzdefinition für mehrere Zonen implementieren - std::vector percentages; + std::vector percentages; districts.push_back(attrs.get(VISSIM_ATTR_DISTRICT, 0, ok)); - percentages.push_back(attrs.get(VISSIM_ATTR_PERCENTAGE, 0, ok)); + percentages.push_back(attrs.get(VISSIM_ATTR_PERCENTAGE, 0, ok)); NIVissimDistrictConnection::dictionary(id, name, @@ -568,22 +564,14 @@ void NIImporter_Vissim::NIVissimXMLHandler_Geschwindigkeitsverteilungsdefinition::myEndElement(int element) { if (element == VISSIM_TAG_SPEED_DIST && myHierarchyLevel == 3) { - PositionVector points; + Distribution_Points* points = new Distribution_Points(myElemData["id"].front()); while (!myElemData["points"].empty()) { std::vector sPos_v(StringTokenizer( myElemData["points"].front(), " ").getVector()); myElemData["points"].pop_front(); - std::vector pos_v(2); - - // doing a transform with explicit hint on function signature - std::transform(sPos_v.begin(), sPos_v.end(), pos_v.begin(), - TplConvert::_str2SUMOReal); - points.push_back_noDoublePos(Position(pos_v[0], pos_v[1])); + points->add(TplConvert::_str2double(sPos_v[0]), TplConvert::_str2double(sPos_v[1])); } - NBDistribution::dictionary("speed", - myElemData["id"].front(), - new Distribution_Points(myElemData["id"].front(), - points)); + DistributionCont::dictionary("speed", myElemData["id"].front(), points); myElemData.clear(); } --myHierarchyLevel; @@ -778,7 +766,7 @@ Position NIImporter_Vissim::VissimSingleTypeParser::getPosition(std::istream& from) { - SUMOReal x, y; + double x, y; from >> x; // type-checking is missing! from >> y; // type-checking is missing! return Position(x, y); @@ -818,7 +806,7 @@ lanes.push_back(lane - 1); } } - SUMOReal position; + double position; from >> position; std::vector dummy; return NIVissimExtendedEdgePoint(edgeid, lanes, position, dummy); @@ -1051,7 +1039,7 @@ void -NIImporter_Vissim::postLoadBuild(SUMOReal offset) { +NIImporter_Vissim::postLoadBuild(double offset) { // close the loading process NIVissimBoundedClusterObject::closeLoading(); NIVissimConnection::dict_assignToEdges(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/NIImporter_Vissim.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/NIImporter_Vissim.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/NIImporter_Vissim.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/NIImporter_Vissim.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Lukas Grohmann (AIT) /// @author Gerald Richter (AIT) /// @date Sept 2002 -/// @version $Id: NIImporter_Vissim.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIImporter_Vissim.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Importer for networks stored in Vissim format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -558,7 +558,7 @@ private: bool readContents(std::istream& strm); - void postLoadBuild(SUMOReal offset); + void postLoadBuild(double offset); /// adds name-to-id - relationships of known elements into myKnownElements diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/NIVissimElements.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/NIVissimElements.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/NIVissimElements.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/NIVissimElements.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimElements.h /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimElements.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimElements.h 22608 2017-01-17 06:28:54Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimAbstractEdge.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimAbstractEdge.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimAbstractEdge.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimAbstractEdge.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimAbstractEdge.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimAbstractEdge.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,10 +40,6 @@ #include #include "NIVissimAbstractEdge.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - NIVissimAbstractEdge::DictType NIVissimAbstractEdge::myDict; @@ -53,7 +49,7 @@ // convert/publicate geometry for (PositionVector::const_iterator i = geom.begin(); i != geom.end(); ++i) { Position p = *i; - if (!NBNetBuilder::transformCoordinates(p)) { + if (!NBNetBuilder::transformCoordinate(p)) { WRITE_WARNING("Unable to project coordinates for edge '" + toString(id) + "'."); } myGeom.push_back_noDoublePos(p); @@ -89,14 +85,14 @@ Position -NIVissimAbstractEdge::getGeomPosition(SUMOReal pos) const { +NIVissimAbstractEdge::getGeomPosition(double pos) const { if (myGeom.length() > pos) { return myGeom.positionAtOffset(pos); } else if (myGeom.length() == pos) { return myGeom[-1]; } else { PositionVector g(myGeom); - const SUMOReal amount = pos - myGeom.length(); + const double amount = pos - myGeom.length(); g.extrapolate(amount * 2); return g.positionAtOffset(pos + amount * 2); } @@ -131,7 +127,7 @@ std::vector -NIVissimAbstractEdge::getWithin(const AbstractPoly& p, SUMOReal offset) { +NIVissimAbstractEdge::getWithin(const AbstractPoly& p, double offset) { std::vector ret; for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) { NIVissimAbstractEdge* e = (*i).second; @@ -144,7 +140,7 @@ bool -NIVissimAbstractEdge::overlapsWith(const AbstractPoly& p, SUMOReal offset) const { +NIVissimAbstractEdge::overlapsWith(const AbstractPoly& p, double offset) const { return myGeom.overlapsWith(p, offset); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimAbstractEdge.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimAbstractEdge.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimAbstractEdge.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimAbstractEdge.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimAbstractEdge.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimAbstractEdge.h 23150 2017-02-27 12:08:30Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,11 +45,11 @@ public: NIVissimAbstractEdge(int id, const PositionVector& geom); virtual ~NIVissimAbstractEdge(); - Position getGeomPosition(SUMOReal pos) const; + Position getGeomPosition(double pos) const; void splitAssigning(); bool crossesEdge(NIVissimAbstractEdge* c) const; Position crossesEdgeAtPoint(NIVissimAbstractEdge* c) const; - bool overlapsWith(const AbstractPoly& p, SUMOReal offset = 0.0) const; + bool overlapsWith(const AbstractPoly& p, double offset = 0.0) const; virtual void setNodeCluster(int nodeid) = 0; bool hasNodeCluster() const; @@ -65,7 +65,7 @@ static bool dictionary(int id, NIVissimAbstractEdge* e); static NIVissimAbstractEdge* dictionary(int id); static void splitAndAssignToNodes(); - static std::vector getWithin(const AbstractPoly& p, SUMOReal offset = 0.0); + static std::vector getWithin(const AbstractPoly& p, double offset = 0.0); static void clearDict(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimBoundedClusterObject.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimBoundedClusterObject.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimBoundedClusterObject.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimBoundedClusterObject.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimBoundedClusterObject.cpp /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimBoundedClusterObject.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimBoundedClusterObject.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,10 +33,6 @@ #include #include "NIVissimBoundedClusterObject.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - NIVissimBoundedClusterObject::ContType NIVissimBoundedClusterObject::myDict; NIVissimBoundedClusterObject::NIVissimBoundedClusterObject() @@ -52,7 +48,7 @@ bool NIVissimBoundedClusterObject::crosses(const AbstractPoly& poly, - SUMOReal offset) const { + double offset) const { assert(myBoundary != 0 && myBoundary->xmax() >= myBoundary->xmin()); return myBoundary->overlapsWith(poly, offset); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimBoundedClusterObject.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimBoundedClusterObject.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimBoundedClusterObject.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimBoundedClusterObject.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimBoundedClusterObject.h /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimBoundedClusterObject.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimBoundedClusterObject.h 23150 2017-02-27 12:08:30Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -50,7 +50,7 @@ NIVissimBoundedClusterObject(); virtual ~NIVissimBoundedClusterObject(); virtual void computeBounding() = 0; - bool crosses(const AbstractPoly& poly, SUMOReal offset = 0) const; + bool crosses(const AbstractPoly& poly, double offset = 0) const; void inCluster(int id); bool clustered() const; const Boundary& getBoundary() const; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosedLaneDef.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosedLaneDef.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosedLaneDef.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosedLaneDef.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimClosedLaneDef.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimClosedLaneDef.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,10 +32,6 @@ #include #include "NIVissimClosedLaneDef.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - NIVissimClosedLaneDef::NIVissimClosedLaneDef(const std::vector& assignedVehicles) : myAssignedVehicles(assignedVehicles) {} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosedLaneDef.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosedLaneDef.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosedLaneDef.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosedLaneDef.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimClosedLaneDef.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimClosedLaneDef.h 22608 2017-01-17 06:28:54Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosedLanesVector.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosedLanesVector.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosedLanesVector.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosedLanesVector.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimClosedLanesVector.h /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimClosedLanesVector.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimClosedLanesVector.h 22608 2017-01-17 06:28:54Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosures.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosures.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosures.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosures.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimClosures.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimClosures.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,10 +33,6 @@ #include #include "NIVissimClosures.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - NIVissimClosures::DictType NIVissimClosures::myDict; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosures.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosures.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosures.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimClosures.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimClosures.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimClosures.h 22608 2017-01-17 06:28:54Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConflictArea.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConflictArea.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConflictArea.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConflictArea.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimConflictArea.cpp /// @author Lukas Grohmann /// @date Aug 2015 -/// @version $Id: NIVissimConflictArea.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: NIVissimConflictArea.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A temporary storage for conflict areas imported from Vissim /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConflictArea.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConflictArea.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConflictArea.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConflictArea.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimConflictArea.h /// @author Lukas Grohmann /// @date Aug 2015 -/// @version $Id: NIVissimConflictArea.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimConflictArea.h 22608 2017-01-17 06:28:54Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConnectionCluster.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConnectionCluster.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConnectionCluster.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConnectionCluster.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimConnectionCluster.cpp 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: NIVissimConnectionCluster.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,10 +47,6 @@ #include "NIVissimTL.h" #include "NIVissimConnectionCluster.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members @@ -111,7 +107,7 @@ bool NIVissimConnectionCluster::NodeSubCluster::overlapsWith( const NIVissimConnectionCluster::NodeSubCluster& c, - SUMOReal offset) { + double offset) { assert(myBoundary.xmax() >= myBoundary.xmin()); assert(c.myBoundary.xmax() >= c.myBoundary.xmin()); return myBoundary.overlapsWith(c.myBoundary, offset); @@ -180,7 +176,7 @@ bool NIVissimConnectionCluster::overlapsWith(NIVissimConnectionCluster* c, - SUMOReal offset) const { + double offset) const { assert(myBoundary.xmax() >= myBoundary.xmin()); assert(c->myBoundary.xmax() >= c->myBoundary.xmin()); return c->myBoundary.overlapsWith(myBoundary, offset); @@ -218,7 +214,7 @@ void -NIVissimConnectionCluster::joinBySameEdges(SUMOReal offset) { +NIVissimConnectionCluster::joinBySameEdges(double offset) { // !!! ... // Further, we try to omit joining of overlaping nodes. This is done by holding // the lists of incoming and outgoing edges and incrementally building the nodes @@ -327,7 +323,7 @@ bool -NIVissimConnectionCluster::joinable(NIVissimConnectionCluster* c2, SUMOReal offset) { +NIVissimConnectionCluster::joinable(NIVissimConnectionCluster* c2, double offset) { // join clusters which have at least one connection in common if (VectorHelper::subSetExists(myConnections, c2->myConnections)) { return true; @@ -436,10 +432,10 @@ if (c1->getFromEdgeID() == c2->getFromEdgeID()) { NIVissimEdge* e = NIVissimEdge::dictionary(c1->getFromEdgeID()); const PositionVector& g = e->getGeometry(); - SUMOReal pos1 = GeomHelper::nearest_offset_on_line_to_point2D( - g.front(), g.back(), c1->getBoundary().getCenter()); - SUMOReal pos2 = GeomHelper::nearest_offset_on_line_to_point2D( - g.front(), g.back(), c2->getBoundary().getCenter()); + double pos1 = GeomHelper::nearest_offset_on_line_to_point2D( + g.front(), g.back(), c1->getBoundary().getCenter()); + double pos2 = GeomHelper::nearest_offset_on_line_to_point2D( + g.front(), g.back(), c2->getBoundary().getCenter()); if (pos1 <= 5.0 && pos2 <= 5.0) { return true; } @@ -447,10 +443,10 @@ if (c1->getToEdgeID() == c2->getToEdgeID()) { NIVissimEdge* e = NIVissimEdge::dictionary(c1->getFromEdgeID()); const PositionVector& g = e->getGeometry(); - SUMOReal pos1 = GeomHelper::nearest_offset_on_line_to_point2D( - g.front(), g.back(), c1->getBoundary().getCenter()); - SUMOReal pos2 = GeomHelper::nearest_offset_on_line_to_point2D( - g.front(), g.back(), c2->getBoundary().getCenter()); + double pos1 = GeomHelper::nearest_offset_on_line_to_point2D( + g.front(), g.back(), c1->getBoundary().getCenter()); + double pos2 = GeomHelper::nearest_offset_on_line_to_point2D( + g.front(), g.back(), c2->getBoundary().getCenter()); if (pos1 >= g.length() - 5.0 && pos2 >= g.length() - 5.0) { return true; } @@ -591,7 +587,7 @@ bool -NIVissimConnectionCluster::around(const Position& p, SUMOReal offset) const { +NIVissimConnectionCluster::around(const Position& p, double offset) const { assert(myBoundary.xmax() >= myBoundary.xmin()); return myBoundary.around(p, offset); } @@ -629,11 +625,11 @@ } -SUMOReal +double NIVissimConnectionCluster::getPositionForEdge(int edgeid) const { // return the middle of the connections when there are any if (myConnections.size() != 0) { - SUMOReal sum = 0; + double sum = 0; int part = 0; std::vector::const_iterator i; for (i = myConnections.begin(); i != myConnections.end(); i++) { @@ -648,7 +644,7 @@ } } if (part > 0) { - return sum / (SUMOReal) part; + return sum / (double) part; } } // use the position of the node if possible @@ -658,21 +654,21 @@ NIVissimNodeDef* node = NIVissimNodeDef::dictionary(myNodeCluster); if (node != 0) { - SUMOReal pos = node->getEdgePosition(edgeid); + double pos = node->getEdgePosition(edgeid); if (pos >= 0) { return pos; } } /* - SUMOReal try1 = GeomHelper::nearest_offset_on_line_to_point( + double try1 = GeomHelper::nearest_offset_on_line_to_point( edge->getBegin2D(), edge->getEnd2D(), node->getPos()); if(try1>=0) { return try1; } // try to use simple distance - SUMOReal dist1 = + double dist1 = GeomHelper::distance(node->getPos(), edge->getBegin2D()); - SUMOReal dist2 = + double dist2 = GeomHelper::distance(node->getPos(), edge->getEnd2D()); return dist1getLength(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConnectionCluster.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConnectionCluster.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConnectionCluster.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConnectionCluster.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimConnectionCluster.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NIVissimConnectionCluster.h 23150 2017-02-27 12:08:30Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -71,15 +71,15 @@ ~NIVissimConnectionCluster(); /// Returns the information whether the given cluster overlaps the current - bool overlapsWith(NIVissimConnectionCluster* c, SUMOReal offset = 0) const; + bool overlapsWith(NIVissimConnectionCluster* c, double offset = 0) const; bool hasNodeCluster() const; NBNode* getNBNode() const; - bool around(const Position& p, SUMOReal offset = 0) const; + bool around(const Position& p, double offset = 0) const; - SUMOReal getPositionForEdge(int edgeid) const; + double getPositionForEdge(int edgeid) const; friend class NIVissimEdge; // !!! debug @@ -96,9 +96,9 @@ public: /** @brief Tries to joind clusters participating within a node This is done by joining clusters which overlap */ - static void joinBySameEdges(SUMOReal offset); + static void joinBySameEdges(double offset); - static void joinByDisturbances(SUMOReal offset); + static void joinByDisturbances(double offset); static void buildNodeClusters(); @@ -119,7 +119,7 @@ void add(NIVissimConnection* c); void add(const NodeSubCluster& c); int size() const; - bool overlapsWith(const NodeSubCluster& c, SUMOReal offset = 0); + bool overlapsWith(const NodeSubCluster& c, double offset = 0); std::vector getConnectionIDs() const; friend class NIVissimConnectionCluster; public: @@ -130,11 +130,11 @@ class same_direction_sorter { private: - SUMOReal myAngle; + double myAngle; public: /// constructor - explicit same_direction_sorter(SUMOReal angle) + explicit same_direction_sorter(double angle) : myAngle(angle) { } public: @@ -158,7 +158,7 @@ void recheckEdges(); - bool joinable(NIVissimConnectionCluster* c2, SUMOReal offset); + bool joinable(NIVissimConnectionCluster* c2, double offset); std::vector getDisturbanceParticipators(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConnection.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConnection.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConnection.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConnection.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Sept 2002 -/// @version $Id: NIVissimConnection.cpp 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: NIVissimConnection.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -52,10 +52,6 @@ #include "NIVissimConnection.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members @@ -176,13 +172,13 @@ } -SUMOReal +double NIVissimConnection::getFromPosition() const { return myFromDef.getPosition(); } -SUMOReal +double NIVissimConnection::getToPosition() const { return myToDef.getPosition(); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConnection.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConnection.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConnection.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimConnection.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimConnection.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NIVissimConnection.h 23150 2017-02-27 12:08:30Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -70,8 +70,8 @@ void computeBounding(); int getFromEdgeID() const; int getToEdgeID() const; - SUMOReal getFromPosition() const; - SUMOReal getToPosition() const; + double getFromPosition() const; + double getToPosition() const; Position getFromGeomPosition() const; Position getToGeomPosition() const; void setNodeCluster(int nodeid); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimDistrictConnection.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimDistrictConnection.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimDistrictConnection.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimDistrictConnection.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimDistrictConnection.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimDistrictConnection.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -49,14 +49,9 @@ #include #include #include "NIVissimDistrictConnection.h" -#include -#include +#include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions @@ -70,14 +65,14 @@ // =========================================================================== NIVissimDistrictConnection::NIVissimDistrictConnection(int id, const std::string& name, - const std::vector& districts, const std::vector& percentages, - int edgeid, SUMOReal position, + const std::vector& districts, const std::vector& percentages, + int edgeid, double position, const std::vector >& assignedVehicles) : myID(id), myName(name), myDistricts(districts), myEdgeID(edgeid), myPosition(position), myAssignedVehicles(assignedVehicles) { std::vector::iterator i = myDistricts.begin(); - std::vector::const_iterator j = percentages.begin(); + std::vector::const_iterator j = percentages.begin(); while (i != myDistricts.end()) { myPercentages[*i] = *j; i++; @@ -92,8 +87,8 @@ bool NIVissimDistrictConnection::dictionary(int id, const std::string& name, - const std::vector& districts, const std::vector& percentages, - int edgeid, SUMOReal position, + const std::vector& districts, const std::vector& percentages, + int edgeid, double position, const std::vector >& assignedVehicles) { NIVissimDistrictConnection* o = new NIVissimDistrictConnection(id, name, districts, percentages, @@ -194,11 +189,10 @@ void NIVissimDistrictConnection::dict_BuildDistricts(NBDistrictCont& dc, NBEdgeCont& ec, - NBNodeCont& nc/*, - NBDistribution &distc*/) { + NBNodeCont& nc) { // add the sources and sinks // their normalised probability is computed within NBDistrict - // to avoid SUMOReal code writing and more securty within the converter + // to avoid double code writing and more securty within the converter // go through the district table for (std::map >::iterator k = myDistrictsConnections.begin(); k != myDistrictsConnections.end(); k++) { // get the connections @@ -223,7 +217,7 @@ std::string id = "ParkingPlace" + toString(*l); NBNode* parkingPlace = nc.retrieve(id); if (parkingPlace == 0) { - SUMOReal pos = c->getPosition(); + double pos = c->getPosition(); if (pos < e->getLength() - pos) { parkingPlace = e->getFromNode(); parkingPlace->invalidateIncomingConnections(); @@ -242,12 +236,12 @@ id = "VissimFromParkingplace" + toString((*k).first) + "-" + toString(c->myID); NBEdge* source = new NBEdge(id, districtNode, parkingPlace, - "Connection", c->getMeanSpeed(/*distc*/) / (SUMOReal) 3.6, 3, -1, + "Connection", c->getMeanSpeed(/*distc*/) / (double) 3.6, 3, -1, NBEdge::UNSPECIFIED_WIDTH, NBEdge::UNSPECIFIED_OFFSET); if (!ec.insert(source)) { // !!! in den Konstruktor throw 1; // !!! } - SUMOReal percNormed = + double percNormed = c->myPercentages[(*k).first]; if (!district->addSource(source, percNormed)) { throw 1; @@ -259,12 +253,12 @@ id = "VissimToParkingplace" + toString((*k).first) + "-" + toString(c->myID); NBEdge* destination = new NBEdge(id, parkingPlace, districtNode, - "Connection", (SUMOReal) 100 / (SUMOReal) 3.6, 2, -1, + "Connection", (double) 100 / (double) 3.6, 2, -1, NBEdge::UNSPECIFIED_WIDTH, NBEdge::UNSPECIFIED_OFFSET); if (!ec.insert(destination)) { // !!! (in den Konstruktor) throw 1; // !!! } - SUMOReal percNormed2 = + double percNormed2 = c->myPercentages[(*k).first]; if (!district->addSink(destination, percNormed2)) { throw 1; // !!! @@ -273,12 +267,12 @@ /* if(e->getToNode()==districtNode) { - SUMOReal percNormed = + double percNormed = c->myPercentages[(*k).first]; district->addSink(e, percNormed); } if(e->getFromNode()==districtNode) { - SUMOReal percNormed = + double percNormed = c->myPercentages[(*k).first]; district->addSource(e, percNormed); } @@ -315,7 +309,7 @@ "Connection", 100/3.6, 2, 100, 0, NBEdge::EDGEFUNCTION_SOURCE); NBEdgeCont::insert(source); // !!! (in den Konstruktor) - SUMOReal percNormed = + double percNormed = c->myPercentages[(*k).first]; district->addSource(source, percNormed); } else { @@ -330,7 +324,7 @@ NBEdgeCont::insert(destination); // !!! (in den Konstruktor) // add both the source and the sink to the district - SUMOReal percNormed = + double percNormed = c->myPercentages[(*k).first]; district->addSink(destination, percNormed); } @@ -368,33 +362,33 @@ } -SUMOReal -NIVissimDistrictConnection::getMeanSpeed(/*NBDistribution &dc*/) const { +double +NIVissimDistrictConnection::getMeanSpeed() const { //assert(myAssignedVehicles.size()!=0); if (myAssignedVehicles.size() == 0) { WRITE_WARNING("No streams assigned at district'" + toString(myID) + "'.\n Using default speed 200km/h"); - return (SUMOReal) 200 / (SUMOReal) 3.6; + return (double) 200 / (double) 3.6; } - SUMOReal speed = 0; + double speed = 0; std::vector >::const_iterator i; for (i = myAssignedVehicles.begin(); i != myAssignedVehicles.end(); i++) { - speed += getRealSpeed(/*dc, */(*i).second); + speed += getRealSpeed((*i).second); } - return speed / (SUMOReal) myAssignedVehicles.size(); + return speed / (double) myAssignedVehicles.size(); } -SUMOReal -NIVissimDistrictConnection::getRealSpeed(/*NBDistribution &dc, */int distNo) const { +double +NIVissimDistrictConnection::getRealSpeed(int distNo) const { std::string id = toString(distNo); - Distribution* dist = NBDistribution::dictionary("speed", id); + Distribution* dist = DistributionCont::dictionary("speed", id); if (dist == 0) { WRITE_WARNING("The referenced speed distribution '" + id + "' is not known."); WRITE_WARNING(". Using default."); return OptionsCont::getOptions().getFloat("vissim.default-speed"); } assert(dist != 0); - SUMOReal speed = dist->getMax(); + double speed = dist->getMax(); if (speed < 0 || speed > 1000) { WRITE_WARNING(" False speed at district '" + id); WRITE_WARNING(". Using default."); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimDistrictConnection.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimDistrictConnection.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimDistrictConnection.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimDistrictConnection.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date End of 2002 -/// @version $Id: NIVissimDistrictConnection.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimDistrictConnection.h 23341 2017-03-13 10:11:12Z behrisch $ /// // An edge imported from Vissim together for a container for /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,8 +47,8 @@ public: /// Contructor NIVissimDistrictConnection(int id, const std::string& name, - const std::vector& districts, const std::vector& percentages, - int edgeid, SUMOReal position, + const std::vector& districts, const std::vector& percentages, + int edgeid, double position, const std::vector >& assignedVehicles); // Destructor @@ -64,17 +64,17 @@ } /// Returns the position of the connection at the edge - SUMOReal getPosition() const { + double getPosition() const { return myPosition; } - SUMOReal getMeanSpeed(/*NBDistribution &dc*/) const; + double getMeanSpeed() const; public: /// Inserts the connection into the dictionary after building it static bool dictionary(int id, const std::string& name, - const std::vector& districts, const std::vector& percentages, - int edgeid, SUMOReal position, + const std::vector& districts, const std::vector& percentages, + int edgeid, double position, const std::vector >& assignedVehicles); /// Inserts the build connection to the dictionary @@ -89,7 +89,7 @@ /// Builds the districts static void dict_BuildDistricts(NBDistrictCont& dc, - NBEdgeCont& ec, NBNodeCont& nc/*, NBDistribution &distc*/); + NBEdgeCont& ec, NBNodeCont& nc); /** @brief Returns the connection to a district placed at the given node Yep, there onyl should be one, there is no need to build a single edge as connection between two parking places */ @@ -105,7 +105,7 @@ private: void checkEdgeEnd(); - SUMOReal getRealSpeed(/*NBDistribution &dc, */int distNo) const; + double getRealSpeed(int distNo) const; private: /// The id of the connections @@ -118,7 +118,7 @@ std::vector myDistricts; /// Definition of a map of how many vehicles should leave to a certain district - typedef std::map DistrictPercentages; + typedef std::map DistrictPercentages; /// A map how many vehicles (key, amount) should leave to a district (key) DistrictPercentages myPercentages; @@ -127,7 +127,7 @@ int myEdgeID; /// The position on the edge - SUMOReal myPosition; + double myPosition; /// The vehicles using this connection std::vector > myAssignedVehicles; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimDisturbance.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimDisturbance.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimDisturbance.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimDisturbance.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimDisturbance.cpp 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: NIVissimDisturbance.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,10 +48,6 @@ #include "NIVissimDisturbance.h" #include "NIVissimNodeParticipatingEdgeVector.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member variables diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimDisturbance.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimDisturbance.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimDisturbance.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimDisturbance.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimDisturbance.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: NIVissimDisturbance.h 22608 2017-01-17 06:28:54Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimEdge.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimEdge.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimEdge.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimEdge.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimEdge.cpp 21217 2016-07-22 10:57:44Z behrisch $ +/// @version $Id: NIVissimEdge.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A temporary storage for edges imported from Vissim /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,8 +42,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -55,10 +54,6 @@ #include "NIVissimEdge.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members @@ -80,10 +75,10 @@ int c2id) const { NIVissimConnection* c1 = NIVissimConnection::dictionary(c1id); NIVissimConnection* c2 = NIVissimConnection::dictionary(c2id); - SUMOReal pos1 = + double pos1 = c1->getFromEdgeID() == myEdgeID ? c1->getFromPosition() : c1->getToPosition(); - SUMOReal pos2 = + double pos2 = c2->getFromEdgeID() == myEdgeID ? c2->getFromPosition() : c2->getToPosition(); return pos1 < pos2; @@ -104,8 +99,8 @@ NIVissimEdge::connection_cluster_position_sorter::operator()( NIVissimConnectionCluster* cc1, NIVissimConnectionCluster* cc2) const { - SUMOReal pos1 = cc1->getPositionForEdge(myEdgeID); - SUMOReal pos2 = cc2->getPositionForEdge(myEdgeID); + double pos1 = cc1->getPositionForEdge(myEdgeID); + double pos2 = cc2->getPositionForEdge(myEdgeID); if (pos2 < 0 || pos1 < 0) { cc1->getPositionForEdge(myEdgeID); cc2->getPositionForEdge(myEdgeID); @@ -119,8 +114,8 @@ NIVissimEdge::NIVissimEdge(int id, const std::string& name, const std::string& type, int noLanes, - SUMOReal zuschlag1, SUMOReal zuschlag2, - SUMOReal /*length*/, const PositionVector& geom, + double zuschlag1, double zuschlag2, + double /*length*/, const PositionVector& geom, const NIVissimClosedLanesVector& clv) : NIVissimAbstractEdge(id, geom), myName(name), myType(type), myNoLanes(noLanes), @@ -147,7 +142,7 @@ bool NIVissimEdge::dictionary(int id, const std::string& name, const std::string& type, int noLanes, - SUMOReal zuschlag1, SUMOReal zuschlag2, SUMOReal length, + double zuschlag1, double zuschlag2, double length, const PositionVector& geom, const NIVissimClosedLanesVector& clv) { NIVissimEdge* o = new NIVissimEdge(id, name, type, noLanes, zuschlag1, @@ -185,7 +180,7 @@ void NIVissimEdge::buildConnectionClusters() { - const SUMOReal MAX_CLUSTER_DISTANCE = 10; + const double MAX_CLUSTER_DISTANCE = 10; // build clusters for all edges made up from not previously assigne // connections for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) { @@ -203,9 +198,9 @@ std::vector currentCluster; std::vector::iterator j = connectors.begin(); bool outgoing = NIVissimConnection::dictionary(*j)->getFromEdgeID() == (*i).first; - SUMOReal position = outgoing - ? NIVissimConnection::dictionary(*j)->getFromPosition() - : NIVissimConnection::dictionary(*j)->getToPosition(); + double position = outgoing + ? NIVissimConnection::dictionary(*j)->getFromPosition() + : NIVissimConnection::dictionary(*j)->getToPosition(); // skip connections already in a cluster // !!! (?) @@ -219,9 +214,9 @@ do { if (j + 1 != connectors.end() && !NIVissimConnection::dictionary(*j)->hasNodeCluster()) { bool n_outgoing = NIVissimConnection::dictionary(*(j + 1))->getFromEdgeID() == edgeid; - SUMOReal n_position = n_outgoing - ? NIVissimConnection::dictionary(*(j + 1))->getFromPosition() - : NIVissimConnection::dictionary(*(j + 1))->getToPosition(); + double n_position = n_outgoing + ? NIVissimConnection::dictionary(*(j + 1))->getFromPosition() + : NIVissimConnection::dictionary(*(j + 1))->getToPosition(); if (n_outgoing == outgoing && fabs(n_position - position) < MAX_CLUSTER_DISTANCE) { // ok, in same cluster as prior currentCluster.push_back(*(j + 1)); @@ -248,7 +243,7 @@ void NIVissimEdge::dict_buildNBEdges(NBDistrictCont& dc, NBNodeCont& nc, - NBEdgeCont& ec, SUMOReal offset) { + NBEdgeCont& ec, double offset) { for (DictType::iterator i = myDict.begin(); i != myDict.end(); i++) { NIVissimEdge* edge = (*i).second; edge->buildNBEdge(dc, nc, ec, offset); @@ -257,34 +252,34 @@ void -NIVissimEdge::dict_propagateSpeeds(/* NBDistribution &dc */) { +NIVissimEdge::dict_propagateSpeeds() { DictType::iterator i; for (i = myDict.begin(); i != myDict.end(); i++) { NIVissimEdge* edge = (*i).second; - edge->setDistrictSpeed(/* dc */); + edge->setDistrictSpeed(); } for (i = myDict.begin(); i != myDict.end(); i++) { NIVissimEdge* edge = (*i).second; - edge->propagateSpeed(/* dc */ -1, std::vector()); + edge->propagateSpeed(-1, std::vector()); } for (int j = 0; j < 3; j++) { for (i = myDict.begin(); i != myDict.end(); i++) { NIVissimEdge* edge = (*i).second; - edge->propagateOwn(/* dc */); + edge->propagateOwn(); } for (i = myDict.begin(); i != myDict.end(); i++) { NIVissimEdge* edge = (*i).second; - edge->checkUnconnectedLaneSpeeds(/* dc */); + edge->checkUnconnectedLaneSpeeds(); } } } void -NIVissimEdge::checkUnconnectedLaneSpeeds(/* NBDistribution &dc */) { +NIVissimEdge::checkUnconnectedLaneSpeeds() { for (int i = 0; i < (int) myLaneSpeeds.size(); i++) { if (myLaneSpeeds[i] == -1) { - SUMOReal speed = -1; + double speed = -1; int j1 = i - 1; // !!! recheck - j1 may become negative? int j2 = i; while (j2 != (int) myLaneSpeeds.size() && myLaneSpeeds[j2] == -1) { @@ -298,7 +293,7 @@ if (j2 >= (int) myLaneSpeeds.size()) { speed = myLaneSpeeds[j1]; } else { - speed = (myLaneSpeeds[j1] + myLaneSpeeds[j2]) / (SUMOReal) 2.0; + speed = (myLaneSpeeds[j1] + myLaneSpeeds[j2]) / (double) 2.0; } } if (speed == -1) { @@ -318,7 +313,7 @@ void -NIVissimEdge::propagateOwn(/* NBDistribution &dc */) { +NIVissimEdge::propagateOwn() { for (int i = 0; i < (int) myLaneSpeeds.size(); i++) { if (myLaneSpeeds[i] == -1) { continue; @@ -335,7 +330,7 @@ void -NIVissimEdge::propagateSpeed(/* NBDistribution &dc */ SUMOReal speed, std::vector forLanes) { +NIVissimEdge::propagateSpeed(double speed, std::vector forLanes) { // if no lane is given, all set be set if (forLanes.size() == 0) { for (int i = 0; i < myNoLanes; i++) { @@ -378,14 +373,14 @@ void -NIVissimEdge::setDistrictSpeed(/* NBDistribution &dc */) { +NIVissimEdge::setDistrictSpeed() { if (myDistrictConnections.size() > 0) { - SUMOReal pos = *(myDistrictConnections.begin()); + double pos = *(myDistrictConnections.begin()); if (pos < getLength() - pos) { NIVissimDistrictConnection* d = NIVissimDistrictConnection::dict_findForEdge(myID); if (d != 0) { - SUMOReal speed = d->getMeanSpeed(/*dc*/); + double speed = d->getMeanSpeed(/*dc*/); if (speed == -1) { return; } @@ -427,7 +422,7 @@ void NIVissimEdge::buildNBEdge(NBDistrictCont& dc, NBNodeCont& nc, NBEdgeCont& ec, - SUMOReal sameNodesOffset) { + double sameNodesOffset) { // build the edge std::pair fromInf, toInf; NBNode* fromNode, *toNode; @@ -485,7 +480,7 @@ } // build the edge - SUMOReal avgSpeed = 0; + double avgSpeed = 0; for (int i = 0; i < myNoLanes; i++) { if ((int)myLaneSpeeds.size() <= i || myLaneSpeeds[i] == -1) { myLanesWithMissingSpeeds.push_back(toString(myID) + "_" + toString(i)); @@ -494,7 +489,7 @@ avgSpeed += myLaneSpeeds[i]; } } - avgSpeed /= (SUMOReal) myLaneSpeeds.size(); + avgSpeed /= (double) myLaneSpeeds.size(); avgSpeed *= OptionsCont::getOptions().getFloat("vissim.speed-norm"); if (fromNode == toNode) { @@ -503,14 +498,14 @@ } NBEdge* buildEdge = new NBEdge(toString(myID), fromNode, toNode, myType, - avgSpeed / (SUMOReal) 3.6, myNoLanes, -1, + avgSpeed / (double) 3.6, myNoLanes, -1, NBEdge::UNSPECIFIED_WIDTH, NBEdge::UNSPECIFIED_OFFSET, myGeom, myName, "", LANESPREAD_CENTER, true); for (int i = 0; i < myNoLanes; i++) { if ((int) myLaneSpeeds.size() <= i || myLaneSpeeds[i] == -1) { - buildEdge->setSpeed(i, OptionsCont::getOptions().getFloat("vissim.default-speed") / (SUMOReal) 3.6); + buildEdge->setSpeed(i, OptionsCont::getOptions().getFloat("vissim.default-speed") / (double) 3.6); } else { - buildEdge->setSpeed(i, myLaneSpeeds[i] / (SUMOReal) 3.6); + buildEdge->setSpeed(i, myLaneSpeeds[i] / (double) 3.6); } } ec.insert(buildEdge); @@ -528,16 +523,16 @@ } -SUMOReal -NIVissimEdge::getRealSpeed(/* NBDistribution &dc */ int distNo) { +double +NIVissimEdge::getRealSpeed(int distNo) { std::string id = toString(distNo); - Distribution* dist = NBDistribution::dictionary("speed", id); + Distribution* dist = DistributionCont::dictionary("speed", id); if (dist == 0) { WRITE_WARNING("The referenced speed distribution '" + id + "' is not known."); return -1; } assert(dist != 0); - SUMOReal speed = dist->getMax(); + double speed = dist->getMax(); if (speed < 0 || speed > 1000) { WRITE_WARNING("What about distribution '" + toString(distNo) + "' "); } @@ -551,23 +546,23 @@ // int speed_idx = -1; // check set speeds if(myPatchedSpeeds.size()!=0) { - std::vector::iterator i = + std::vector::iterator i = find(myPatchedSpeeds.begin(), myPatchedSpeeds.end(), -1); if(myPatchedSpeeds.size()!=myNoLanes||i!=myPatchedSpeeds.end()) { cot << "Warning! Not all lanes are patched! (edge:" << myID << ")." << endl; } // - if(std::vectorHelper::maxValue(myPatchedSpeeds)!=std::vectorHelper::minValue(myPatchedSpeeds)) { + if(std::vectorHelper::maxValue(myPatchedSpeeds)!=std::vectorHelper::minValue(myPatchedSpeeds)) { cot << "Warning! Not all lanes have the same speed!! (edge:" << myID << ")." << endl; } // / // !!! ist natuerlich Quatsch - erst recht, wenn Edges zusammengefasst werden - speed = std::vectorHelper::sum(myPatchedSpeeds); - speed /= (SUMOReal) myPatchedSpeeds.size();*/ + speed = std::vectorHelper::sum(myPatchedSpeeds); + speed /= (double) myPatchedSpeeds.size();*/ /* return true; } if(myDistrictConnections.size()>0) { - SUMOReal pos = *(myDistrictConnections.begin()); + double pos = *(myDistrictConnections.begin()); // if(pos<10) { NIVissimDistrictConnection *d = NIVissimDistrictConnection::dict_findForEdge(myID); @@ -585,7 +580,7 @@ std::pair NIVissimEdge::getFromNode(NBNodeCont& nc, ConnectionClusters& clusters) { // changed MAX_DISTANCE from 10 to 3.5, because 3.5 is the default lane width in VISSIM - const SUMOReal MAX_DISTANCE = 3.5; + const double MAX_DISTANCE = 3.5; assert(clusters.size() >= 1); const Position& beg = myGeom.front(); NIVissimConnectionCluster* c = *(clusters.begin()); @@ -597,7 +592,7 @@ } // check for a parking place at the begin if (myDistrictConnections.size() > 0) { - SUMOReal pos = *(myDistrictConnections.begin()); + double pos = *(myDistrictConnections.begin()); if (pos < 10) { NBNode* node = new NBNode(toString(myID) + "-begin", beg, NODETYPE_NOJUNCTION); if (!nc.insert(node)) { @@ -622,7 +617,7 @@ NIVissimEdge::getToNode(NBNodeCont& nc, ConnectionClusters& clusters) { const Position& end = myGeom.back(); if (clusters.size() > 0) { - const SUMOReal MAX_DISTANCE = 10.; + const double MAX_DISTANCE = 10.; assert(clusters.size() >= 1); NIVissimConnectionCluster* c = *(clusters.end() - 1); // check whether the edge ends within a already build node @@ -633,7 +628,7 @@ } // check for a parking place at the end if (myDistrictConnections.size() > 0) { - SUMOReal pos = *(myDistrictConnections.end() - 1); + double pos = *(myDistrictConnections.end() - 1); if (pos > myGeom.length() - 10) { NBNode* node = new NBNode(toString(myID) + "-end", end, NODETYPE_NOJUNCTION); if (!nc.insert(node)) { @@ -693,7 +688,7 @@ std::pair -NIVissimEdge::resolveSameNode(NBNodeCont& nc, SUMOReal offset, +NIVissimEdge::resolveSameNode(NBNodeCont& nc, double offset, NBNode* prevFrom, NBNode* prevTo) { // check whether the edge is connected to a district // use it if so @@ -701,7 +696,7 @@ NIVissimDistrictConnection::dict_findForEdge(myID); if (d != 0) { Position pos = d->geomPosition(); - SUMOReal position = d->getPosition(); + double position = d->getPosition(); // the district is at the begin of the edge if (myGeom.length() - position > position) { std::string nid = "ParkingPlace" + toString(d->getID()); @@ -844,14 +839,14 @@ } -SUMOReal +double NIVissimEdge::getLength() const { return myGeom.length(); } void -NIVissimEdge::checkDistrictConnectionExistanceAt(SUMOReal pos) { +NIVissimEdge::checkDistrictConnectionExistanceAt(double pos) { if (find(myDistrictConnections.begin(), myDistrictConnections.end(), pos) == myDistrictConnections.end()) { myDistrictConnections.push_back(pos); /* int id = NIVissimConnection::getMaxID() + 1; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimEdge.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimEdge.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimEdge.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimEdge.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date End of 2002 -/// @version $Id: NIVissimEdge.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NIVissimEdge.h 23341 2017-03-13 10:11:12Z behrisch $ /// // A temporary storage for edges imported from Vissim /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,9 +46,8 @@ // class declarations // =========================================================================== class NBNode; -class NIVissimDistrictConnection; -class NBDistribution; class NBDistrictCont; +class NIVissimDistrictConnection; // =========================================================================== @@ -63,8 +62,8 @@ public: /// Constructor NIVissimEdge(int id, const std::string& name, - const std::string& type, int noLanes, SUMOReal zuschlag1, - SUMOReal zuschlag2, SUMOReal length, + const std::string& type, int noLanes, double zuschlag1, + double zuschlag2, double length, const PositionVector& geom, const NIVissimClosedLanesVector& clv); @@ -91,9 +90,9 @@ Position getEnd2D() const; /// Returns the length of the node - SUMOReal getLength() const; + double getLength() const; - void checkDistrictConnectionExistanceAt(SUMOReal pos); + void checkDistrictConnectionExistanceAt(double pos); void mergedInto(NIVissimConnectionCluster* old, NIVissimConnectionCluster* act); @@ -124,8 +123,8 @@ /** @brief Adds the described item to the dictionary Builds the edge first */ static bool dictionary(int id, const std::string& name, - const std::string& type, int noLanes, SUMOReal zuschlag1, - SUMOReal zuschlag2, SUMOReal length, + const std::string& type, int noLanes, double zuschlag1, + double zuschlag2, double length, const PositionVector& geom, const NIVissimClosedLanesVector& clv); @@ -147,9 +146,9 @@ /// Builds NBEdges from the VissimEdges within the dictionary static void dict_buildNBEdges(NBDistrictCont& dc, NBNodeCont& nc, - NBEdgeCont& ec, SUMOReal offset); + NBEdgeCont& ec, double offset); - static void dict_propagateSpeeds(/* NBDistribution &dc */); + static void dict_propagateSpeeds(); static void dict_checkEdges2Join(); @@ -179,7 +178,7 @@ * @exception ProcessError If one of the built nodes or edges could not be added to the according container */ void buildNBEdge(NBDistrictCont& dc, NBNodeCont& nc, - NBEdgeCont& ec, SUMOReal sameNodesOffset); + NBEdgeCont& ec, double sameNodesOffset); /// Returns the origin node std::pair @@ -191,19 +190,19 @@ /// Tries to resolve the problem that the same node has been returned as origin and destination node std::pair resolveSameNode(NBNodeCont& nc, - SUMOReal offset, NBNode* prevFrom, NBNode* prevTo); + double offset, NBNode* prevFrom, NBNode* prevTo); -// SUMOReal recheckSpeedPatches(); +// double recheckSpeedPatches(); std::vector getOutgoingConnected(int lane) const; - void propagateSpeed(/* NBDistribution &dc */SUMOReal speed, std::vector forLanes); + void propagateSpeed(double speed, std::vector forLanes); - void setDistrictSpeed(/* NBDistribution &dc */); - SUMOReal getRealSpeed(/* NBDistribution &dc */int distNo); - void checkUnconnectedLaneSpeeds(/* NBDistribution &dc */); - void propagateOwn(/* NBDistribution &dc */); + void setDistrictSpeed(); + double getRealSpeed(int distNo); + void checkUnconnectedLaneSpeeds(); + void propagateOwn(); @@ -266,7 +265,7 @@ int myNoLanes; /// Additional load values for this edge - SUMOReal myZuschlag1, myZuschlag2; + double myZuschlag1, myZuschlag2; /// List of lanes closed on this edge NIVissimClosedLanesVector myClosedLanes; @@ -280,11 +279,11 @@ /// List of connections outgoing from this edge std::vector myOutgoingConnections; - std::vector myDistrictConnections; + std::vector myDistrictConnections; std::vector myPatchedSpeeds; - std::vector myLaneSpeeds; + std::vector myLaneSpeeds; std::vector myToTreatAsSame; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimEdgePosMap.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimEdgePosMap.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimEdgePosMap.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimEdgePosMap.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimEdgePosMap.cpp /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimEdgePosMap.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimEdgePosMap.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,10 +32,6 @@ #include #include "NIVissimEdgePosMap.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - NIVissimEdgePosMap::NIVissimEdgePosMap() {} @@ -44,15 +40,15 @@ void -NIVissimEdgePosMap::add(int edgeid, SUMOReal pos) { +NIVissimEdgePosMap::add(int edgeid, double pos) { add(edgeid, pos, pos); } void -NIVissimEdgePosMap::add(int edgeid, SUMOReal from, SUMOReal to) { +NIVissimEdgePosMap::add(int edgeid, double from, double to) { if (from > to) { - SUMOReal tmp = from; + double tmp = from; from = to; to = tmp; } @@ -60,8 +56,8 @@ if (i == myCont.end()) { myCont[edgeid] = Range(from, to); } else { - SUMOReal pfrom = (*i).second.first; - SUMOReal pto = (*i).second.second; + double pfrom = (*i).second.first; + double pto = (*i).second.second; if (pfrom < from) { from = pfrom; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimEdgePosMap.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimEdgePosMap.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimEdgePosMap.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimEdgePosMap.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimEdgePosMap.h /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimEdgePosMap.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimEdgePosMap.h 23150 2017-02-27 12:08:30Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,11 +43,11 @@ public: NIVissimEdgePosMap(); ~NIVissimEdgePosMap(); - void add(int edgeid, SUMOReal pos); - void add(int edgeid, SUMOReal from, SUMOReal to); + void add(int edgeid, double pos); + void add(int edgeid, double from, double to); void join(NIVissimEdgePosMap& with); private: - typedef std::pair Range; + typedef std::pair Range; typedef std::map ContType; ContType myCont; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimExtendedEdgePoint.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimExtendedEdgePoint.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimExtendedEdgePoint.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimExtendedEdgePoint.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimExtendedEdgePoint.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimExtendedEdgePoint.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,16 +34,12 @@ #include "NIVissimExtendedEdgePoint.h" #include "NIVissimEdge.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== NIVissimExtendedEdgePoint::NIVissimExtendedEdgePoint( - int edgeid, const std::vector& lanes, SUMOReal position, + int edgeid, const std::vector& lanes, double position, const std::vector& assignedVehicles) : myEdgeID(edgeid), myLanes(lanes), myPosition(position), myAssignedVehicles(assignedVehicles) {} @@ -58,7 +54,7 @@ } -SUMOReal +double NIVissimExtendedEdgePoint::getPosition() const { return myPosition; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimExtendedEdgePoint.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimExtendedEdgePoint.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimExtendedEdgePoint.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimExtendedEdgePoint.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimExtendedEdgePoint.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimExtendedEdgePoint.h 23150 2017-02-27 12:08:30Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -56,10 +56,10 @@ * @param[in] assignedVehicles Vehicle (type) indices which should be regarded by this point */ NIVissimExtendedEdgePoint(int edgeid, const std::vector& lanes, - SUMOReal position, const std::vector& assignedVehicles); + double position, const std::vector& assignedVehicles); ~NIVissimExtendedEdgePoint(); int getEdgeID() const; - SUMOReal getPosition() const; + double getPosition() const; Position getGeomPosition() const; const std::vector& getLanes() const; @@ -76,7 +76,7 @@ private: int myEdgeID; std::vector myLanes; - SUMOReal myPosition; + double myPosition; std::vector myAssignedVehicles; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimExtendedEdgePointVector.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimExtendedEdgePointVector.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimExtendedEdgePointVector.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimExtendedEdgePointVector.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimExtendedEdgePointVector.h /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimExtendedEdgePointVector.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimExtendedEdgePointVector.h 22608 2017-01-17 06:28:54Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeCluster.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeCluster.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeCluster.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeCluster.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimNodeCluster.cpp 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: NIVissimNodeCluster.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,10 +44,6 @@ #include "NIVissimConnection.h" #include "NIVissimNodeCluster.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member variables diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeCluster.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeCluster.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeCluster.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeCluster.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimNodeCluster.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NIVissimNodeCluster.h 22608 2017-01-17 06:28:54Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimNodeDef.cpp 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: NIVissimNodeDef.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include "NIVissimDisturbance.h" #include "NIVissimTL.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member variables @@ -97,7 +93,7 @@ /* std::vector -NIVissimNodeDef::getWithin(const AbstractPoly &p, SUMOReal off) +NIVissimNodeDef::getWithin(const AbstractPoly &p, double off) { std::vector ret; for(DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) { @@ -110,7 +106,7 @@ } bool -NIVissimNodeDef::partialWithin(const AbstractPoly &p, SUMOReal off) const +NIVissimNodeDef::partialWithin(const AbstractPoly &p, double off) const { assert(myBoundary!=0&&myBoundary->xmax()>=myBoundary->xmin()); return myBoundary->partialWithin(p, off); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef_Edges.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef_Edges.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef_Edges.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef_Edges.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimNodeDef_Edges.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimNodeDef_Edges.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,10 +43,6 @@ #include "NIVissimDisturbance.h" #include "NIVissimConnection.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -110,12 +106,12 @@ */ -SUMOReal +double NIVissimNodeDef_Edges::getEdgePosition(int edgeid) const { for (NIVissimNodeParticipatingEdgeVector::const_iterator i = myEdges.begin(); i != myEdges.end(); i++) { NIVissimNodeParticipatingEdge* edge = *i; if (edge->getID() == edgeid) { - return (edge->getFromPos() + edge->getToPos()) / (SUMOReal) 2.0; + return (edge->getFromPos() + edge->getToPos()) / (double) 2.0; } } return -1; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef_Edges.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef_Edges.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef_Edges.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef_Edges.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimNodeDef_Edges.h /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimNodeDef_Edges.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimNodeDef_Edges.h 23150 2017-02-27 12:08:30Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,7 +47,7 @@ const NIVissimNodeParticipatingEdgeVector& edges); // virtual void computeBounding(); // virtual void searchAndSetConnections(); - virtual SUMOReal getEdgePosition(int edgeid) const; + virtual double getEdgePosition(int edgeid) const; /** * diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimNodeDef.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NIVissimNodeDef.h 23150 2017-02-27 12:08:30Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,14 +44,14 @@ virtual ~NIVissimNodeDef(); int buildNodeCluster(); // virtual void computeBounding() = 0; -// bool partialWithin(const AbstractPoly &p, SUMOReal off=0.0) const; +// bool partialWithin(const AbstractPoly &p, double off=0.0) const; // virtual void searchAndSetConnections() = 0; - virtual SUMOReal getEdgePosition(int edgeid) const = 0; + virtual double getEdgePosition(int edgeid) const = 0; public: static bool dictionary(int id, NIVissimNodeDef* o); static NIVissimNodeDef* dictionary(int id); -// static std::vector getWithin(const AbstractPoly &p, SUMOReal off=0.0); +// static std::vector getWithin(const AbstractPoly &p, double off=0.0); // static void buildNodeClusters(); // static void dict_assignConnectionsToNodes(); static int dictSize(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef_Poly.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef_Poly.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef_Poly.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef_Poly.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimNodeDef_Poly.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimNodeDef_Poly.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,10 +42,6 @@ #include "NIVissimAbstractEdge.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef_Poly.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef_Poly.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef_Poly.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeDef_Poly.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimNodeDef_Poly.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimNodeDef_Poly.h 23150 2017-02-27 12:08:30Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,8 +46,8 @@ static bool dictionary(int id, const std::string& name, const PositionVector& poly); // virtual void computeBounding(); -// SUMOReal getEdgePosition(int edgeid) const; -// void searchAndSetConnections(SUMOReal offset); +// double getEdgePosition(int edgeid) const; +// void searchAndSetConnections(double offset); private: PositionVector myPoly; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeParticipatingEdge.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeParticipatingEdge.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeParticipatingEdge.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeParticipatingEdge.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimNodeParticipatingEdge.cpp /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimNodeParticipatingEdge.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimNodeParticipatingEdge.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,14 +33,10 @@ #include "NIVissimConnection.h" #include "NIVissimNodeParticipatingEdge.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - NIVissimNodeParticipatingEdge::NIVissimNodeParticipatingEdge( - int edgeid, SUMOReal frompos, SUMOReal topos) + int edgeid, double frompos, double topos) : myEdgeID(edgeid), myFromPos(frompos), myToPos(topos) {} NIVissimNodeParticipatingEdge::~NIVissimNodeParticipatingEdge() {} @@ -53,20 +49,20 @@ bool -NIVissimNodeParticipatingEdge::positionLiesWithin(SUMOReal pos) const { +NIVissimNodeParticipatingEdge::positionLiesWithin(double pos) const { return (myFromPos < myToPos && myFromPos >= pos && myToPos <= pos) || (myFromPos > myToPos && myFromPos <= pos && myToPos >= pos); } -SUMOReal +double NIVissimNodeParticipatingEdge::getFromPos() const { return myFromPos; } -SUMOReal +double NIVissimNodeParticipatingEdge::getToPos() const { return myToPos; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeParticipatingEdge.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeParticipatingEdge.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeParticipatingEdge.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeParticipatingEdge.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimNodeParticipatingEdge.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimNodeParticipatingEdge.h 23150 2017-02-27 12:08:30Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,15 +44,15 @@ class NIVissimNodeParticipatingEdge { public: NIVissimNodeParticipatingEdge(int edgeid, - SUMOReal frompos, SUMOReal topos); + double frompos, double topos); ~NIVissimNodeParticipatingEdge(); int getID() const; - bool positionLiesWithin(SUMOReal pos) const; - SUMOReal getFromPos() const; - SUMOReal getToPos() const; + bool positionLiesWithin(double pos) const; + double getFromPos() const; + double getToPos() const; private: int myEdgeID; - SUMOReal myFromPos, myToPos; + double myFromPos, myToPos; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeParticipatingEdgeVector.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeParticipatingEdgeVector.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeParticipatingEdgeVector.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimNodeParticipatingEdgeVector.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimNodeParticipatingEdgeVector.h /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimNodeParticipatingEdgeVector.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimNodeParticipatingEdgeVector.h 22608 2017-01-17 06:28:54Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimSource.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimSource.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimSource.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimSource.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSource.cpp /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimSource.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSource.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,10 +33,6 @@ #include #include "NIVissimSource.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - NIVissimSource::DictType NIVissimSource::myDict; NIVissimSource::NIVissimSource(const std::string& id, const std::string& name, diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimSource.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimSource.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimSource.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimSource.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSource.h /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimSource.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSource.h 22608 2017-01-17 06:28:54Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimTL.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimTL.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimTL.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimTL.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimTL.cpp 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: NIVissimTL.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,10 +48,6 @@ #include "NIVissimEdge.h" #include "NIVissimTL.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member variables @@ -67,7 +63,7 @@ const std::vector& groupids, int edgeid, int laneno, - SUMOReal position, + double position, const std::vector& vehicleTypes) : myID(id), myName(name), myGroupIDs(groupids), myEdgeID(edgeid), myLane(laneno), myPosition(position), @@ -212,7 +208,7 @@ NIVissimTL::NIVissimTLSignalGroup::NIVissimTLSignalGroup( int id, const std::string& name, - bool isGreenBegin, const std::vector& times, + bool isGreenBegin, const std::vector& times, SUMOTime tredyellow, SUMOTime tyellow) : myID(id), myName(name), myTimes(times), myFirstIsRed(!isGreenBegin), myTRedYellow(tredyellow), @@ -288,7 +284,7 @@ ? NBTrafficLightDefinition::TLCOLOR_RED : NBTrafficLightDefinition::TLCOLOR_GREEN; std::string id = toString(myID); tl->addSignalGroup(id); // !!! myTimes als SUMOTime - for (std::vector::const_iterator i = myTimes.begin(); i != myTimes.end(); i++) { + for (std::vector::const_iterator i = myTimes.begin(); i != myTimes.end(); i++) { tl->addSignalGroupPhaseBegin(id, (SUMOTime) *i, color); color = color == NBTrafficLightDefinition::TLCOLOR_RED ? NBTrafficLightDefinition::TLCOLOR_GREEN : NBTrafficLightDefinition::TLCOLOR_RED; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimTL.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimTL.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimTL.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimTL.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,7 +3,7 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimTL.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimTL.h 23150 2017-02-27 12:08:30Z behrisch $ /// // ------------------- /****************************************************************************/ @@ -68,7 +68,7 @@ const std::string& name, SUMOTime absdur, SUMOTime offset); static bool dictionary(int id, NIVissimTL* o); static NIVissimTL* dictionary(int id); -// static std::vector getWithin(const AbstractPoly &poly, SUMOReal offset); +// static std::vector getWithin(const AbstractPoly &poly, double offset); static void clearDict(); static bool dict_SetSignals(NBTrafficLightLogicCont& tlc, NBEdgeCont& ec); @@ -88,7 +88,7 @@ public: NIVissimTLSignal(int id, const std::string& name, const std::vector& groupids, int edgeid, int laneno, - SUMOReal position, const std::vector& assignedVehicleTypes); + double position, const std::vector& assignedVehicleTypes); ~NIVissimTLSignal(); bool isWithin(const PositionVector& poly) const; Position getPosition() const; @@ -106,7 +106,7 @@ std::vector myGroupIDs; int myEdgeID; int myLane; - SUMOReal myPosition; + double myPosition; std::vector myVehicleTypes; static SignalDictType myDict; }; @@ -114,7 +114,7 @@ class NIVissimTLSignalGroup { public: NIVissimTLSignalGroup(int id, const std::string& name, - bool isGreenBegin, const std::vector& times, + bool isGreenBegin, const std::vector& times, SUMOTime tredyellow, SUMOTime tyellow); ~NIVissimTLSignalGroup(); bool addTo(NBLoadedTLDef* node) const; @@ -127,7 +127,7 @@ private: int myID; std::string myName; - std::vector myTimes; + std::vector myTimes; bool myFirstIsRed; SUMOTime myTRedYellow, myTYellow; static GroupDictType myDict; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimTrafficDescription.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimTrafficDescription.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimTrafficDescription.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimTrafficDescription.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimTrafficDescription.cpp /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimTrafficDescription.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimTrafficDescription.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,10 +34,6 @@ #include "NIVissimVehicleClassVector.h" #include "NIVissimTrafficDescription.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member function definitions @@ -107,7 +103,7 @@ -SUMOReal +double NIVissimTrafficDescription::meanSpeed(int id) { NIVissimTrafficDescription* i = dictionary(id); assert(i != 0); @@ -115,13 +111,13 @@ } -SUMOReal +double NIVissimTrafficDescription::meanSpeed() const { - SUMOReal speed = 0; + double speed = 0; for (NIVissimVehicleClassVector::const_iterator i = myVehicleTypes.begin(); i != myVehicleTypes.end(); i++) { speed += (*i)->getSpeed(); } - return speed / (SUMOReal) myVehicleTypes.size(); + return speed / (double) myVehicleTypes.size(); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimTrafficDescription.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimTrafficDescription.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimTrafficDescription.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimTrafficDescription.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimTrafficDescription.h /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimTrafficDescription.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimTrafficDescription.h 23150 2017-02-27 12:08:30Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -51,8 +51,8 @@ static bool dictionary(int id, NIVissimTrafficDescription* o); static NIVissimTrafficDescription* dictionary(int id); static void clearDict(); - static SUMOReal meanSpeed(int id); - SUMOReal meanSpeed() const; + static double meanSpeed(int id); + double meanSpeed() const; private: std::string myName; NIVissimVehicleClassVector myVehicleTypes; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleClass.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleClass.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleClass.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleClass.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimVehicleClass.cpp /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimVehicleClass.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimVehicleClass.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,10 +31,6 @@ #include "NIVissimVehicleClass.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - NIVissimVehicleClass::NIVissimVehicleClass(int vwish) : myVWish(vwish) {} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleClass.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleClass.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleClass.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleClass.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimVehicleClass.h /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimVehicleClass.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimVehicleClass.h 22608 2017-01-17 06:28:54Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleClassVector.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleClassVector.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleClassVector.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleClassVector.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimVehicleClassVector.h /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimVehicleClassVector.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimVehicleClassVector.h 22608 2017-01-17 06:28:54Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleType.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleType.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleType.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleType.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimVehicleType.cpp /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimVehicleType.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimVehicleType.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,10 +31,6 @@ #include "NIVissimVehicleType.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - NIVissimVehicleType::DictType NIVissimVehicleType::myDict; NIVissimVehicleType::NIVissimVehicleType(const std::string& name, diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleType.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleType.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleType.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehicleType.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimVehicleType.h /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimVehicleType.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimVehicleType.h 22608 2017-01-17 06:28:54Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehTypeClass.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehTypeClass.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehTypeClass.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehTypeClass.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NIVissimVehTypeClass.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimVehTypeClass.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,10 +34,6 @@ #include #include "NIVissimVehTypeClass.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - NIVissimVehTypeClass::DictType NIVissimVehTypeClass::myDict; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehTypeClass.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehTypeClass.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehTypeClass.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/tempstructs/NIVissimVehTypeClass.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Michael Behrisch /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: NIVissimVehTypeClass.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimVehTypeClass.h 23150 2017-02-27 12:08:30Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -52,7 +52,7 @@ static bool dictionary(int id, NIVissimVehTypeClass* o); static NIVissimVehTypeClass* dictionary(int name); static void clearDict(); - SUMOReal meanSpeed() const; + double meanSpeed() const; private: int myID; std::string myName; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Auswertungsdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Auswertungsdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Auswertungsdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Auswertungsdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Fri, 21 Mar 2003 -/// @version $Id: NIVissimSingleTypeParser_Auswertungsdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Auswertungsdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_Auswertungsdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Auswertungsdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Auswertungsdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Auswertungsdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Auswertungsdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Auswertungsdefinition.h /// @author Daniel Krajzewicz /// @date Fri, 21 Mar 2003 -/// @version $Id: NIVissimSingleTypeParser_Auswertungsdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Auswertungsdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Detektordefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Detektordefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Detektordefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Detektordefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Detektordefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Detektordefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimClosures.h" #include "NIVissimSingleTypeParser_Detektordefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Detektordefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Detektordefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Detektordefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Detektordefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Detektordefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Detektordefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Detektordefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_DynUml.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_DynUml.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_DynUml.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_DynUml.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_DynUml.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_DynUml.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../NIImporter_Vissim.h" #include "NIVissimSingleTypeParser_DynUml.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_DynUml.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_DynUml.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_DynUml.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_DynUml.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_DynUml.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_DynUml.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_DynUml.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Einheitendefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Einheitendefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Einheitendefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Einheitendefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Einheitendefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Einheitendefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_Einheitendefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Einheitendefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Einheitendefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Einheitendefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Einheitendefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Einheitendefinition.h /// @author Daniel Krajzewicz /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Einheitendefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Einheitendefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Emission.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Emission.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Emission.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Emission.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Emission.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Emission.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_Emission.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Emission.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Emission.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Emission.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Emission.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Emission.h /// @author Daniel Krajzewicz /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Emission.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Emission.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrtverlaufdateien.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrtverlaufdateien.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrtverlaufdateien.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrtverlaufdateien.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Fahrtverlaufdateien.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Fahrtverlaufdateien.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_Fahrtverlaufdateien.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrtverlaufdateien.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrtverlaufdateien.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrtverlaufdateien.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrtverlaufdateien.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Fahrtverlaufdateien.h /// @author Daniel Krajzewicz /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Fahrtverlaufdateien.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Fahrtverlaufdateien.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrverhaltendefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrverhaltendefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrverhaltendefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrverhaltendefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Fahrverhaltendefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Fahrverhaltendefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,10 +33,6 @@ #include "../NIImporter_Vissim.h" #include "NIVissimSingleTypeParser_Fahrverhaltendefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrverhaltendefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrverhaltendefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrverhaltendefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrverhaltendefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Fahrverhaltendefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Fahrverhaltendefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Fahrverhaltendefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrzeugklassendefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrzeugklassendefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrzeugklassendefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrzeugklassendefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Fahrzeugklassendefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Fahrzeugklassendefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include "../tempstructs/NIVissimVehTypeClass.h" #include "NIVissimSingleTypeParser_Fahrzeugklassendefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrzeugklassendefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrzeugklassendefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrzeugklassendefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrzeugklassendefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Fahrzeugklassendefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Fahrzeugklassendefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Fahrzeugklassendefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrzeugtypdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrzeugtypdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrzeugtypdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrzeugtypdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,7 +3,7 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Fahrzeugtypdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Fahrzeugtypdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ @@ -36,10 +36,6 @@ #include "../tempstructs/NIVissimVehicleType.h" #include "NIVissimSingleTypeParser_Fahrzeugtypdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -92,19 +88,19 @@ } tag = myRead(from); } - SUMOReal length; + double length; from >> length; // overread until "Maxbeschleunigung" while (tag != "maxbeschleunigung") { tag = myRead(from); } - SUMOReal amax; + double amax; from >> amax; // type-checking is missing! // overread until "Maxverzoegerung" while (tag != "maxverzoegerung") { tag = myRead(from); } - SUMOReal dmax; + double dmax; from >> dmax; // type-checking is missing! while (tag != "besetzungsgrad") { tag = myRead(from); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrzeugtypdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrzeugtypdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrzeugtypdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fahrzeugtypdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Fahrzeugtypdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Fahrzeugtypdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Fahrzeugtypdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fensterdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fensterdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fensterdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fensterdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Fri, 21 Mar 2003 -/// @version $Id: NIVissimSingleTypeParser_Fensterdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Fensterdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_Fensterdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fensterdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fensterdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fensterdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Fensterdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Fensterdefinition.h /// @author Daniel Krajzewicz /// @date Fri, 21 Mar 2003 -/// @version $Id: NIVissimSingleTypeParser_Fensterdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Fensterdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Gefahrwarnungsdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Gefahrwarnungsdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Gefahrwarnungsdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Gefahrwarnungsdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Gefahrwarnungsdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Gefahrwarnungsdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_Gefahrwarnungsdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Gefahrwarnungsdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Gefahrwarnungsdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Gefahrwarnungsdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Gefahrwarnungsdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Gefahrwarnungsdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Gefahrwarnungsdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Gefahrwarnungsdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Gelbverhaltendefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Gelbverhaltendefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Gelbverhaltendefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Gelbverhaltendefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Gelbverhaltendefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Gelbverhaltendefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_Gelbverhaltendefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Geschwindigkeitsverteilungsdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Geschwindigkeitsverteilungsdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Geschwindigkeitsverteilungsdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Geschwindigkeitsverteilungsdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Geschwindigkeitsverteilungsdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Geschwindigkeitsverteilungsdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,15 +34,11 @@ #include #include #include -#include #include +#include #include "../NIImporter_Vissim.h" #include "NIVissimSingleTypeParser_Geschwindigkeitsverteilungsdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -60,7 +56,7 @@ std::string id; from >> id; // list of points - PositionVector points; + Distribution_Points* points = new Distribution_Points(id); std::string tag; do { tag = readEndSecure(from); @@ -69,14 +65,13 @@ tag = readEndSecure(from); } if (tag != "DATAEND") { - SUMOReal p1 = TplConvert::_2SUMOReal(tag.c_str()); + const double p1 = TplConvert::_2double(tag.c_str()); from >> tag; - SUMOReal p2 = TplConvert::_2SUMOReal(tag.c_str()); - points.push_back(Position(p1, p2)); + const double p2 = TplConvert::_2double(tag.c_str()); + points->add(p1, p2); } } while (tag != "DATAEND"); - NBDistribution::dictionary("speed", - id, new Distribution_Points(id, points)); + DistributionCont::dictionary("speed", id, points); return true; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Geschwindigkeitsverteilungsdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Geschwindigkeitsverteilungsdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Geschwindigkeitsverteilungsdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Geschwindigkeitsverteilungsdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Geschwindigkeitsverteilungsdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Geschwindigkeitsverteilungsdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Geschwindigkeitsverteilungsdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Haltestellendefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Haltestellendefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Haltestellendefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Haltestellendefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Haltestellendefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Haltestellendefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimClosures.h" #include "NIVissimSingleTypeParser_Haltestellendefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Haltestellendefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Haltestellendefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Haltestellendefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Haltestellendefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Haltestellendefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Haltestellendefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Haltestellendefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Kantensperrung.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Kantensperrung.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Kantensperrung.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Kantensperrung.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Kantensperrung.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Kantensperrung.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimClosures.h" #include "NIVissimSingleTypeParser_Kantensperrung.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Kantensperrung.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Kantensperrung.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Kantensperrung.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Kantensperrung.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Kantensperrung.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Kantensperrung.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Kantensperrung.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Kennungszeile.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Kennungszeile.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Kennungszeile.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Kennungszeile.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Thu, 6 Mar 2003 -/// @version $Id: NIVissimSingleTypeParser_Kennungszeile.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Kennungszeile.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,10 +34,6 @@ #include "../NIImporter_Vissim.h" #include "NIVissimSingleTypeParser_Kennungszeile.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Kennungszeile.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Kennungszeile.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Kennungszeile.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Kennungszeile.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Kennungszeile.h /// @author Daniel Krajzewicz /// @date Thu, 6 Mar 2003 -/// @version $Id: NIVissimSingleTypeParser_Kennungszeile.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Kennungszeile.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Knotendefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Knotendefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Knotendefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Knotendefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Knotendefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Knotendefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,10 +41,6 @@ #include "../tempstructs/NIVissimNodeDef.h" #include "NIVissimSingleTypeParser_Knotendefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -77,7 +73,7 @@ NIVissimNodeParticipatingEdgeVector edges; while (tag == "strecke") { int edgeid; - SUMOReal from_pos, to_pos; + double from_pos, to_pos; from_pos = to_pos = -1.0; from >> edgeid; tag = readEndSecure(from, "strecke"); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Knotendefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Knotendefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Knotendefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Knotendefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Knotendefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Knotendefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Knotendefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Laengenverteilungsdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Laengenverteilungsdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Laengenverteilungsdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Laengenverteilungsdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Laengenverteilungsdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Laengenverteilungsdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,13 +34,9 @@ #include #include "../NIImporter_Vissim.h" #include -#include +#include #include "NIVissimSingleTypeParser_Laengenverteilungsdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -58,19 +54,18 @@ std::string id; from >> id; // list of points - PositionVector points; + Distribution_Points* points = new Distribution_Points(id); std::string tag; do { tag = readEndSecure(from); if (tag != "DATAEND") { - SUMOReal p1 = TplConvert::_2SUMOReal(tag.c_str()); + double p1 = TplConvert::_2double(tag.c_str()); from >> tag; - SUMOReal p2 = TplConvert::_2SUMOReal(tag.c_str()); - points.push_back(Position(p1, p2)); + double p2 = TplConvert::_2double(tag.c_str()); + points->add(p1, p2); } } while (tag != "DATAEND"); - NBDistribution::dictionary("length", - id, new Distribution_Points(id, points)); + DistributionCont::dictionary("length", id, points); return true; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Laengenverteilungsdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Laengenverteilungsdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Laengenverteilungsdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Laengenverteilungsdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Laengenverteilungsdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Laengenverteilungsdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Laengenverteilungsdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Langsamfahrbereichdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Langsamfahrbereichdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Langsamfahrbereichdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Langsamfahrbereichdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Langsamfahrbereichdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Langsamfahrbereichdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,10 +34,6 @@ #include "../NIImporter_Vissim.h" #include "NIVissimSingleTypeParser_Langsamfahrbereichdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Langsamfahrbereichdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Langsamfahrbereichdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Langsamfahrbereichdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Langsamfahrbereichdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Langsamfahrbereichdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Langsamfahrbereichdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Langsamfahrbereichdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Lichtsignalanlagendefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Lichtsignalanlagendefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Lichtsignalanlagendefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Lichtsignalanlagendefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Lichtsignalanlagendefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Lichtsignalanlagendefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ @@ -37,10 +37,6 @@ #include "../tempstructs/NIVissimTL.h" #include "NIVissimSingleTypeParser_Lichtsignalanlagendefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -106,11 +102,11 @@ std::string tag; from >> tag; // - SUMOReal absdur; + double absdur; from >> absdur; // type-checking is missing! // tag = readEndSecure(from); - SUMOReal offset = 0; + double offset = 0; if (tag == "versatz") { from >> offset; // type-checking is missing! } @@ -130,11 +126,11 @@ std::string tag; from >> tag; // - SUMOReal absdur; + double absdur; from >> absdur; // type-checking is missing! // tag = readEndSecure(from); - SUMOReal offset = 0; + double offset = 0; if (tag == "versatz") { from >> offset; // type-checking is missing! } @@ -148,11 +144,11 @@ std::string tag; from >> tag; // - SUMOReal absdur; + double absdur; from >> absdur; // type-checking is missing! // tag = readEndSecure(from); - SUMOReal offset = 0; + double offset = 0; if (tag == "versatz") { from >> offset; // type-checking is missing! } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Lichtsignalanlagendefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Lichtsignalanlagendefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Lichtsignalanlagendefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Lichtsignalanlagendefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Lichtsignalanlagendefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Lichtsignalanlagendefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Lichtsignalanlagendefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Liniendefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Liniendefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Liniendefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Liniendefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Liniendefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Liniendefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimClosures.h" #include "NIVissimSingleTypeParser_Liniendefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Liniendefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Liniendefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Liniendefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Liniendefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Liniendefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Liniendefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Liniendefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Linksverkehr.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Linksverkehr.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Linksverkehr.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Linksverkehr.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Linksverkehr.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Linksverkehr.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_Linksverkehr.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Linksverkehr.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Linksverkehr.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Linksverkehr.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Linksverkehr.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Linksverkehr.h /// @author Daniel Krajzewicz /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Linksverkehr.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Linksverkehr.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_LSAKopplungsdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_LSAKopplungsdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_LSAKopplungsdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_LSAKopplungsdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_LSAKopplungsdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_LSAKopplungsdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_LSAKopplungsdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_LSAKopplungsdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_LSAKopplungsdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_LSAKopplungsdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_LSAKopplungsdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_LSAKopplungsdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_LSAKopplungsdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_LSAKopplungsdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Messungsdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Messungsdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Messungsdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Messungsdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Messungsdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Messungsdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimClosures.h" #include "NIVissimSingleTypeParser_Messungsdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Messungsdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Messungsdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Messungsdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Messungsdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Messungsdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Messungsdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Messungsdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Netzobjektdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Netzobjektdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Netzobjektdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Netzobjektdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Netzobjektdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Netzobjektdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_Netzobjektdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Netzobjektdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Netzobjektdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Netzobjektdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Netzobjektdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Netzobjektdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Netzobjektdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Netzobjektdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Parkplatzdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Parkplatzdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Parkplatzdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Parkplatzdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Parkplatzdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Parkplatzdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,10 +43,6 @@ #include "../tempstructs/NIVissimDistrictConnection.h" #include "NIVissimSingleTypeParser_Parkplatzdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -72,10 +68,10 @@ // A district may be already saved when another parking place with // the same district was already build. std::vector districts; - std::vector percentages; + std::vector percentages; readUntil(from, "bezirke"); // "Bezirke" while (tag != "ort") { - SUMOReal perc = -1; + double perc = -1; int districtid; from >> districtid; tag = myRead(from); @@ -91,11 +87,11 @@ int edgeid; from >> edgeid; - SUMOReal position; + double position; from >> tag; // "bei" from >> position; - SUMOReal length; + double length; from >> tag; from >> length; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Parkplatzdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Parkplatzdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Parkplatzdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Parkplatzdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Parkplatzdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Parkplatzdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Parkplatzdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Querschnittsmessungsdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Querschnittsmessungsdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Querschnittsmessungsdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Querschnittsmessungsdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Querschnittsmessungsdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Querschnittsmessungsdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimClosures.h" #include "NIVissimSingleTypeParser_Querschnittsmessungsdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Querschnittsmessungsdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Querschnittsmessungsdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Querschnittsmessungsdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Querschnittsmessungsdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Querschnittsmessungsdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Querschnittsmessungsdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Querschnittsmessungsdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,10 +38,6 @@ #include "../tempstructs/NIVissimDisturbance.h" #include "NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -87,14 +83,14 @@ from >> tag; // "Strecke" NIVissimExtendedEdgePoint by = parsePos(from); // - SUMOReal timegap; + double timegap; from >> timegap; from >> tag; - SUMOReal waygap; + double waygap; from >> waygap; - SUMOReal vmax = -1; + double vmax = -1; tag = readEndSecure(from); if (tag == "vmax") { from >> vmax; @@ -131,14 +127,14 @@ from >> tag; // "Strecke" NIVissimExtendedEdgePoint by = parsePos(from); // - SUMOReal timegap; + double timegap; from >> timegap; - SUMOReal waygap; + double waygap; from >> tag; from >> waygap; - SUMOReal vmax = -1; + double vmax = -1; tag = readEndSecure(from); if (tag == "vmax") { from >> vmax; @@ -169,7 +165,7 @@ lanes.push_back(TplConvert::_2int(tag.c_str())); } // - SUMOReal position; + double position; from >> tag; from >> position; // assigned vehicle types diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Rautedefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Rautedefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Rautedefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Rautedefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Rautedefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Rautedefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_Rautedefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Reisezeitmessungsdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Reisezeitmessungsdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Reisezeitmessungsdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Reisezeitmessungsdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Reisezeitmessungsdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Reisezeitmessungsdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimClosures.h" #include "NIVissimSingleTypeParser_Reisezeitmessungsdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Reisezeitmessungsdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Reisezeitmessungsdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Reisezeitmessungsdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Reisezeitmessungsdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Reisezeitmessungsdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Reisezeitmessungsdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Reisezeitmessungsdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Richtungsentscheidungsdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Richtungsentscheidungsdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Richtungsentscheidungsdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Richtungsentscheidungsdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Richtungsentscheidungsdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Richtungsentscheidungsdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,10 +34,6 @@ #include "../NIImporter_Vissim.h" #include "NIVissimSingleTypeParser_Richtungsentscheidungsdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Richtungsentscheidungsdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Richtungsentscheidungsdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Richtungsentscheidungsdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Richtungsentscheidungsdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Richtungsentscheidungsdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Richtungsentscheidungsdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Richtungsentscheidungsdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Richtungspfeildefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Richtungspfeildefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Richtungspfeildefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Richtungspfeildefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Richtungspfeildefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Richtungspfeildefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_Richtungspfeildefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Richtungspfeildefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Richtungspfeildefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Richtungspfeildefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Richtungspfeildefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Richtungspfeildefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Richtungspfeildefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Richtungspfeildefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Routenentscheidungsdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Routenentscheidungsdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Routenentscheidungsdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Routenentscheidungsdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Routenentscheidungsdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Routenentscheidungsdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,10 +34,6 @@ #include "../NIImporter_Vissim.h" #include "NIVissimSingleTypeParser_Routenentscheidungsdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Routenentscheidungsdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Routenentscheidungsdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Routenentscheidungsdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Routenentscheidungsdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Routenentscheidungsdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Routenentscheidungsdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Routenentscheidungsdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Signalgeberdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Signalgeberdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Signalgeberdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Signalgeberdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Signalgeberdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Signalgeberdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,6 @@ #include "../tempstructs/NIVissimTL.h" #include "NIVissimSingleTypeParser_Signalgeberdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -101,7 +97,7 @@ from >> laneno; from >> tag; - SUMOReal position; + double position; from >> position; // while (tag != "fahrzeugklassen") { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Signalgeberdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Signalgeberdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Signalgeberdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Signalgeberdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Signalgeberdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Signalgeberdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Signalgeberdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Signalgruppendefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Signalgruppendefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Signalgruppendefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Signalgruppendefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Signalgruppendefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Signalgruppendefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,10 +40,6 @@ #include "../tempstructs/NIVissimTL.h" #include "NIVissimSingleTypeParser_Signalgruppendefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -113,7 +109,7 @@ int id, const std::string& name, int lsaid, std::istream& from) { // bool isGreenBegin; - std::vector times; + std::vector times; std::string tag = myRead(from); if (tag == "dauergruen") { isGreenBegin = true; @@ -125,7 +121,7 @@ // the first phase will be green isGreenBegin = true; while (tag == "rotende" || tag == "gruenanfang") { - SUMOReal point; + double point; from >> point; // type-checking is missing! times.push_back(point); from >> tag; @@ -135,7 +131,7 @@ } } // - SUMOReal tredyellow, tyellow; + double tredyellow, tyellow; from >> tredyellow; from >> tag; from >> tyellow; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Signalgruppendefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Signalgruppendefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Signalgruppendefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Signalgruppendefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Signalgruppendefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Signalgruppendefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Signalgruppendefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Simdauer.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Simdauer.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Simdauer.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Simdauer.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Simdauer.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Simdauer.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,10 +36,6 @@ #include "../NIImporter_Vissim.h" #include "NIVissimSingleTypeParser_Simdauer.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -57,7 +53,7 @@ from >> duration; // !!! try { - TplConvert::_2SUMOReal(duration.c_str()); + TplConvert::_2double(duration.c_str()); } catch (...) { WRITE_ERROR("Simulation duration could not be parsed"); return false; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Simdauer.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Simdauer.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Simdauer.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Simdauer.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Simdauer.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Simdauer.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Simdauer.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_SimRate.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_SimRate.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_SimRate.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_SimRate.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_SimRate.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_SimRate.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_SimRate.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_SimRate.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_SimRate.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_SimRate.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_SimRate.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_SimRate.h /// @author Daniel Krajzewicz /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_SimRate.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_SimRate.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Startuhrzeit.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Startuhrzeit.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Startuhrzeit.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Startuhrzeit.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,7 +3,7 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Startuhrzeit.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Startuhrzeit.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ @@ -34,10 +34,6 @@ #include "../NIImporter_Vissim.h" #include "NIVissimSingleTypeParser_Startuhrzeit.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Startuhrzeit.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Startuhrzeit.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Startuhrzeit.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Startuhrzeit.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Startuhrzeit.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Startuhrzeit.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Startuhrzeit.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Startzufallszahl.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Startzufallszahl.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Startzufallszahl.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Startzufallszahl.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Startzufallszahl.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Startzufallszahl.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_Startzufallszahl.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Startzufallszahl.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Startzufallszahl.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Startzufallszahl.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Startzufallszahl.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Startzufallszahl.h /// @author Daniel Krajzewicz /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Startzufallszahl.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Startzufallszahl.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stauparameterdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stauparameterdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stauparameterdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stauparameterdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Stauparameterdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Stauparameterdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_Stauparameterdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stauparameterdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stauparameterdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stauparameterdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stauparameterdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Stauparameterdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Stauparameterdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Stauparameterdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stauzaehlerdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stauzaehlerdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stauzaehlerdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stauzaehlerdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Stauzaehlerdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Stauzaehlerdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimClosures.h" #include "NIVissimSingleTypeParser_Stauzaehlerdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stauzaehlerdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stauzaehlerdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stauzaehlerdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stauzaehlerdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Stauzaehlerdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Stauzaehlerdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Stauzaehlerdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stopschilddefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stopschilddefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stopschilddefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stopschilddefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Stopschilddefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Stopschilddefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,10 +34,6 @@ #include "../NIImporter_Vissim.h" #include "NIVissimSingleTypeParser_Stopschilddefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stopschilddefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stopschilddefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stopschilddefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Stopschilddefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Stopschilddefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Stopschilddefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Stopschilddefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Streckendefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Streckendefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Streckendefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Streckendefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Streckendefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Streckendefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,6 @@ #include "../tempstructs/NIVissimClosedLanesVector.h" #include "NIVissimSingleTypeParser_Streckendefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -64,7 +60,7 @@ // the following elements may occure: "Name", "Beschriftung", "Typ", // followed by the mandatory "Laenge" std::string name, label, type; - SUMOReal length = -1; + double length = -1; while (length < 0) { tag = overrideOptionalLabel(from); if (tag == "name") { @@ -81,7 +77,7 @@ from >> noLanes; // skip some parameter, except optional "Zuschlag" until "Von" (mandatory) // occurs - SUMOReal zuschlag1, zuschlag2; + double zuschlag1, zuschlag2; zuschlag1 = zuschlag2 = 0; while (tag != "von") { tag = myRead(from); @@ -99,7 +95,7 @@ geom.push_back_noDoublePos(getPosition(from)); tag = myRead(from); try { - TplConvert::_2SUMOReal(tag.c_str()); + TplConvert::_2double(tag.c_str()); tag = myRead(from); } catch (NumberFormatException&) {} } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Streckendefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Streckendefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Streckendefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Streckendefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Streckendefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Streckendefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Streckendefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Streckentypdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Streckentypdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Streckentypdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Streckentypdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Thu, 6 Mar 2003 -/// @version $Id: NIVissimSingleTypeParser_Streckentypdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Streckentypdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../NIImporter_Vissim.h" #include "NIVissimSingleTypeParser_Streckentypdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Streckentypdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Streckentypdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Streckentypdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Streckentypdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Streckentypdefinition.h /// @author Daniel Krajzewicz /// @date Thu, 6 Mar 2003 -/// @version $Id: NIVissimSingleTypeParser_Streckentypdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Streckentypdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_TEAPACDefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_TEAPACDefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_TEAPACDefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_TEAPACDefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_TEAPACDefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_TEAPACDefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_TEAPACDefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_TEAPACDefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_TEAPACDefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_TEAPACDefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_TEAPACDefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_TEAPACDefinition.h /// @author Daniel Krajzewicz /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_TEAPACDefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_TEAPACDefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verbindungsdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verbindungsdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verbindungsdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verbindungsdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Verbindungsdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Verbindungsdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,10 +36,6 @@ #include "../tempstructs/NIVissimConnection.h" #include "NIVissimSingleTypeParser_Verbindungsdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -74,12 +70,12 @@ if (y != "nach") { geom.push_back_noDoublePos( Position( - TplConvert::_2SUMOReal(x.c_str()), - TplConvert::_2SUMOReal(y.c_str()) + TplConvert::_2double(x.c_str()), + TplConvert::_2double(y.c_str()) )); tag = myRead(from); try { - TplConvert::_2SUMOReal(tag.c_str()); + TplConvert::_2double(tag.c_str()); tag = myRead(from); } catch (NumberFormatException&) {} } else { @@ -88,11 +84,11 @@ } NIVissimExtendedEdgePoint to_def = readExtEdgePointDef(from); // read some optional values until mandatory "Fahrzeugklassen" occurs - SUMOReal dxnothalt = 0; - SUMOReal dxeinordnen = 0; - SUMOReal zuschlag1, zuschlag2; + double dxnothalt = 0; + double dxeinordnen = 0; + double zuschlag1, zuschlag2; zuschlag1 = zuschlag2 = 0; - SUMOReal seglength = 0; + double seglength = 0; tag = myRead(from); // NIVissimConnection::Direction direction = NIVissimConnection::NIVC_DIR_ALL; while (tag != "fahrzeugklassen" && tag != "sperrung" && tag != "auswertung" && tag != "DATAEND") { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verbindungsdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verbindungsdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verbindungsdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verbindungsdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Verbindungsdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Verbindungsdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Verbindungsdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include "../tempstructs/NIVissimTrafficDescription.h" #include "NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -71,7 +67,7 @@ while (tag != "DATAEND") { int type; from >> type; - SUMOReal percentage; + double percentage; from >> tag; from >> percentage; int vwish; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Verkehrszusammensetzungsdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verlustzeitmessungsdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verlustzeitmessungsdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verlustzeitmessungsdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verlustzeitmessungsdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Verlustzeitmessungsdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Verlustzeitmessungsdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimClosures.h" #include "NIVissimSingleTypeParser_Verlustzeitmessungsdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verlustzeitmessungsdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verlustzeitmessungsdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verlustzeitmessungsdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Verlustzeitmessungsdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Verlustzeitmessungsdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Verlustzeitmessungsdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Verlustzeitmessungsdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_VWunschentscheidungsdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_VWunschentscheidungsdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_VWunschentscheidungsdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_VWunschentscheidungsdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_VWunschentscheidungsdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_VWunschentscheidungsdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,10 +38,6 @@ #include "../tempstructs/NIVissimConnection.h" #include "NIVissimSingleTypeParser_VWunschentscheidungsdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_VWunschentscheidungsdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_VWunschentscheidungsdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_VWunschentscheidungsdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_VWunschentscheidungsdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_VWunschentscheidungsdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_VWunschentscheidungsdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_VWunschentscheidungsdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser__XKurvedefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser__XKurvedefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser__XKurvedefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser__XKurvedefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser__XKurvedefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser__XKurvedefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser__XKurvedefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser__XKurvedefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser__XKurvedefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser__XKurvedefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser__XKurvedefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser__XKurvedefinition.h /// @author Daniel Krajzewicz /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser__XKurvedefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser__XKurvedefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser__XVerteilungsdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser__XVerteilungsdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser__XVerteilungsdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser__XVerteilungsdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser__XVerteilungsdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser__XVerteilungsdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser__XVerteilungsdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser__XVerteilungsdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser__XVerteilungsdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser__XVerteilungsdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser__XVerteilungsdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser__XVerteilungsdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser__XVerteilungsdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser__XVerteilungsdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zeitenverteilungsdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zeitenverteilungsdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zeitenverteilungsdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zeitenverteilungsdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Zeitenverteilungsdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Zeitenverteilungsdefinition.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,15 +34,11 @@ #include #include #include "../NIImporter_Vissim.h" +#include #include -#include -#include +#include #include "NIVissimSingleTypeParser_Zeitenverteilungsdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -60,30 +56,28 @@ std::string id; from >> id; // list of points - PositionVector points; + Distribution_Points* points = new Distribution_Points(id); std::string tag; do { tag = readEndSecure(from); if (tag == "mittelwert") { - SUMOReal mean, deviation; + double mean, deviation; from >> mean; from >> tag; from >> deviation; - return NBDistribution::dictionary("times", id, - new Distribution_MeanDev(id, mean, deviation)); + delete points; + return DistributionCont::dictionary("times", id, + new Distribution_Parameterized(id, mean, deviation)); } if (tag != "DATAEND") { - SUMOReal p1 = TplConvert::_2SUMOReal(tag.c_str()); + double p1 = TplConvert::_2double(tag.c_str()); from >> tag; - SUMOReal p2 = TplConvert::_2SUMOReal(tag.c_str()); - points.push_back(Position(p1, p2)); + double p2 = TplConvert::_2double(tag.c_str()); + points->add(p1, p2); } } while (tag != "DATAEND"); - return NBDistribution::dictionary("times", - id, new Distribution_Points(id, points)); + return DistributionCont::dictionary("times", id, points); } - /****************************************************************************/ - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zeitenverteilungsdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zeitenverteilungsdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zeitenverteilungsdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zeitenverteilungsdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Zeitenverteilungsdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Zeitenverteilungsdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Zeitenverteilungsdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zeitschrittfaktor.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zeitschrittfaktor.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zeitschrittfaktor.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zeitschrittfaktor.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Zeitschrittfaktor.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Zeitschrittfaktor.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_Zeitschrittfaktor.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zeitschrittfaktor.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zeitschrittfaktor.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zeitschrittfaktor.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zeitschrittfaktor.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Zeitschrittfaktor.h /// @author Daniel Krajzewicz /// @date Wed, 30 Apr 2003 -/// @version $Id: NIVissimSingleTypeParser_Zeitschrittfaktor.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Zeitschrittfaktor.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zuflussdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zuflussdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zuflussdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zuflussdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Zuflussdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Zuflussdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_Zuflussdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -71,14 +67,14 @@ // exact = true; tag = myRead(from); } - // SUMOReal q = TplConvert::_2SUMOReal(tag.c_str()); + // double q = TplConvert::_2double(tag.c_str()); // read the vehicle types from >> tag; int vehicle_combination; from >> vehicle_combination; // check whether optional time information is available tag = readEndSecure(from); - SUMOReal beg, end; + double beg, end; beg = -1; end = -1; if (tag == "zeit") { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zuflussdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zuflussdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zuflussdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zuflussdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Zuflussdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Zuflussdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Zuflussdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zusammensetzungsdefinition.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zusammensetzungsdefinition.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zusammensetzungsdefinition.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zusammensetzungsdefinition.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Zusammensetzungsdefinition.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Zusammensetzungsdefinition.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "../tempstructs/NIVissimSource.h" #include "NIVissimSingleTypeParser_Zusammensetzungsdefinition.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zusammensetzungsdefinition.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zusammensetzungsdefinition.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zusammensetzungsdefinition.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netimport/vissim/typeloader/NIVissimSingleTypeParser_Zusammensetzungsdefinition.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NIVissimSingleTypeParser_Zusammensetzungsdefinition.h /// @author Daniel Krajzewicz /// @date Wed, 18 Dec 2002 -/// @version $Id: NIVissimSingleTypeParser_Zusammensetzungsdefinition.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NIVissimSingleTypeParser_Zusammensetzungsdefinition.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLBuilder.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLBuilder.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLBuilder.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLBuilder.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 9 Jul 2001 -/// @version $Id: NLBuilder.cpp 21198 2016-07-19 11:34:56Z namdre $ +/// @version $Id: NLBuilder.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // The main interface for loading a microsim /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -30,43 +30,47 @@ #include #endif -#include "NLBuilder.h" -#include -#include -#include #include #include -#include -#include #include #include -#include "NLHandler.h" -#include "NLEdgeControlBuilder.h" -#include "NLJunctionControlBuilder.h" -#include "NLDetectorBuilder.h" -#include "NLTriggerBuilder.h" -#include -#include -#include -#include + #include #include +#include +#include #include #include +#include #include #include #include #include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include #include #include #include #include -#include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS +#include "NLHandler.h" +#include "NLEdgeControlBuilder.h" +#include "NLJunctionControlBuilder.h" +#include "NLDetectorBuilder.h" +#include "NLTriggerBuilder.h" +#include "NLBuilder.h" + +#ifndef NO_TRACI +#include +#endif // =========================================================================== // method definitions @@ -76,7 +80,7 @@ // --------------------------------------------------------------------------- void NLBuilder::EdgeFloatTimeLineRetriever_EdgeEffort::addEdgeWeight(const std::string& id, - SUMOReal value, SUMOReal begTime, SUMOReal endTime) const { + double value, double begTime, double endTime) const { MSEdge* edge = MSEdge::dictionary(id); if (edge != 0) { myNet.getWeightsStorage().addEffort(edge, begTime, endTime, value); @@ -91,7 +95,7 @@ // --------------------------------------------------------------------------- void NLBuilder::EdgeFloatTimeLineRetriever_EdgeTravelTime::addEdgeWeight(const std::string& id, - SUMOReal value, SUMOReal begTime, SUMOReal endTime) const { + double value, double begTime, double endTime) const { MSEdge* edge = MSEdge::dictionary(id); if (edge != 0) { myNet.getWeightsStorage().addTravelTime(edge, begTime, endTime, value); @@ -125,33 +129,17 @@ return false; } // check whether the loaded net agrees with the simulation options -#ifdef HAVE_INTERNAL_LANES if (myOptions.getBool("no-internal-links") && myXMLHandler.haveSeenInternalEdge()) { WRITE_WARNING("Network contains internal links but option --no-internal-links is set. Vehicles will 'jump' across junctions and thus underestimate route lengths and travel times."); } -#endif if (myOptions.getString("lanechange.duration") != "0" && myXMLHandler.haveSeenNeighs()) { throw ProcessError("Network contains explicit neigh lanes which do not work together with option --lanechange.duration."); } buildNet(); - // load the previous state if wished - if (myOptions.isSet("load-state")) { - long before = SysUtils::getCurrentMillis(); - const std::string& f = myOptions.getString("load-state"); - PROGRESS_BEGIN_MESSAGE("Loading state from '" + f + "'"); - MSStateHandler h(f, string2time(OptionsCont::getOptions().getString("load-state.offset"))); - XMLSubSys::runParser(h, f); - if (myOptions.isDefault("begin")) { - myOptions.set("begin", time2string(h.getTime())); - } - if (MsgHandler::getErrorInstance()->wasInformed()) { - return false; - } - if (h.getTime() != string2time(myOptions.getString("begin"))) { - WRITE_WARNING("State was written at a different time " + time2string(h.getTime()) + " than the begin time " + myOptions.getString("begin") + "!"); - } - PROGRESS_TIME_MESSAGE(before); - } + // @note on loading order constraints: + // - additional-files before route-files and state-files due to referencing + // - weight-files before additional-files since the latter might contain trips which depend on the weights + // load weights if wished if (myOptions.isSet("weight-files")) { if (!myOptions.isUsableFileList("weight-files")) { @@ -184,12 +172,6 @@ } } } - // load routes - if (myOptions.isSet("route-files") && string2time(myOptions.getString("route-steps")) <= 0) { - if (!load("route-files")) { - return false; - } - } // load additional net elements (sources, detectors, ...) if (myOptions.isSet("additional-files")) { if (!load("additional-files")) { @@ -200,6 +182,33 @@ if (!ShapeHandler::loadFiles(myOptions.getStringVector("additional-files"), sh)) { return false; } + if (myXMLHandler.haveSeenAdditionalSpeedRestrictions()) { + myNet.getEdgeControl().setAdditionalRestrictions(); + } + } + // load the previous state if wished + if (myOptions.isSet("load-state")) { + long before = SysUtils::getCurrentMillis(); + const std::string& f = myOptions.getString("load-state"); + PROGRESS_BEGIN_MESSAGE("Loading state from '" + f + "'"); + MSStateHandler h(f, string2time(myOptions.getString("load-state.offset"))); + XMLSubSys::runParser(h, f); + if (myOptions.isDefault("begin")) { + myOptions.set("begin", time2string(h.getTime())); + } + if (MsgHandler::getErrorInstance()->wasInformed()) { + return false; + } + if (h.getTime() != string2time(myOptions.getString("begin"))) { + WRITE_WARNING("State was written at a different time " + time2string(h.getTime()) + " than the begin time " + myOptions.getString("begin") + "!"); + } + PROGRESS_TIME_MESSAGE(before); + } + // load routes + if (myOptions.isSet("route-files") && string2time(myOptions.getString("route-steps")) <= 0) { + if (!load("route-files")) { + return false; + } } // optionally switch off traffic lights if (myOptions.getBool("tls.all-off")) { @@ -210,6 +219,59 @@ } +int +NLBuilder::loadAndRun() { + MSNet::SimulationState state = MSNet::SIMSTATE_LOADING; + while (state == MSNet::SIMSTATE_LOADING) { + OptionsCont& oc = OptionsCont::getOptions(); + oc.clear(); + MSFrame::fillOptions(); + OptionsIO::getOptions(); + if (oc.processMetaOptions(OptionsIO::getArgC() < 2)) { + SystemFrame::close(); + return 0; + } + XMLSubSys::setValidation(oc.getString("xml-validation"), oc.getString("xml-validation.net")); + if (!MSFrame::checkOptions()) { + throw ProcessError(); + } + MsgHandler::initOutputOptions(); + RandHelper::initRandGlobal(); + RandHelper::initRandGlobal(MSRouteHandler::getParsingRNG()); + RandHelper::initRandGlobal(MSDevice::getEquipmentRNG()); + MSFrame::setMSGlobals(oc); + MSVehicleControl* vc = 0; + if (MSGlobals::gUseMesoSim) { + vc = new MEVehicleControl(); + } else { + vc = new MSVehicleControl(); + } + MSNet* net = new MSNet(vc, new MSEventControl(), new MSEventControl(), new MSEventControl()); +#ifndef NO_TRACI + // need to init TraCI-Server before loading routes to catch VEHICLE_STATE_BUILT + TraCIServer::openSocket(std::map()); +#endif + + NLEdgeControlBuilder eb; + NLDetectorBuilder db(*net); + NLJunctionControlBuilder jb(*net, db); + NLTriggerBuilder tb; + NLHandler handler("", *net, db, tb, eb, jb); + tb.setHandler(&handler); + NLBuilder builder(oc, *net, eb, jb, db, handler); + if (builder.build()) { + state = net->simulate(string2time(oc.getString("begin")), string2time(oc.getString("end"))); + delete net; + } else { + MsgHandler::getErrorInstance()->inform("Quitting (on error).", false); + delete net; + return 1; + } + } + return 0; +} + + void NLBuilder::buildNet() { MSEdgeControl* edges = 0; @@ -263,10 +325,10 @@ bool NLBuilder::load(const std::string& mmlWhat, const bool isNet) { - if (!OptionsCont::getOptions().isUsableFileList(mmlWhat)) { + if (!myOptions.isUsableFileList(mmlWhat)) { return false; } - std::vector files = OptionsCont::getOptions().getStringVector(mmlWhat); + std::vector files = myOptions.getStringVector(mmlWhat); for (std::vector::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) { PROGRESS_BEGIN_MESSAGE("Loading " + mmlWhat + " from '" + *fileIt + "'"); long before = SysUtils::getCurrentMillis(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLBuilder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLBuilder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLBuilder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLBuilder.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 9 Jul 2001 -/// @version $Id: NLBuilder.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NLBuilder.h 23645 2017-03-24 09:23:31Z behrisch $ /// // The main interface for loading a microsim /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -100,6 +100,11 @@ */ virtual bool build(); + /** + * loads the net, additional routes and the detectors and starts the simulation + */ + static int loadAndRun(); + protected: /** @brief Loads a described subpart form the given list of files @@ -159,7 +164,7 @@ * @see SAXWeightsHandler::EdgeFloatTimeLineRetriever::addEdgeWeight */ void addEdgeWeight(const std::string& id, - SUMOReal val, SUMOReal beg, SUMOReal end) const; + double val, double beg, double end) const; private: /// @brief The network edges shall be obtained from @@ -190,7 +195,7 @@ * @see SAXWeightsHandler::EdgeFloatTimeLineRetriever::addEdgeWeight */ void addEdgeWeight(const std::string& id, - SUMOReal val, SUMOReal beg, SUMOReal end) const; + double val, double beg, double end) const; private: /// @brief The network edges shall be obtained from diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLDetectorBuilder.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLDetectorBuilder.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLDetectorBuilder.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLDetectorBuilder.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ /// @author Christian Roessel /// @author Jakob Erdmann /// @date Mon, 15 Apr 2002 -/// @version $Id: NLDetectorBuilder.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NLDetectorBuilder.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Builds detectors for microsim /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,7 +40,7 @@ #include #include #include -#include +// #include #include #include #include @@ -63,10 +63,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -75,7 +71,7 @@ * NLDetectorBuilder::E3DetectorDefinition-methods * ----------------------------------------------------------------------- */ NLDetectorBuilder::E3DetectorDefinition::E3DetectorDefinition(const std::string& id, - const std::string& device, SUMOReal haltingSpeedThreshold, + const std::string& device, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, SUMOTime splInterval, const std::string& vTypes) : myID(id), myDevice(device), @@ -102,7 +98,7 @@ void NLDetectorBuilder::buildInductLoop(const std::string& id, - const std::string& lane, SUMOReal pos, SUMOTime splInterval, + const std::string& lane, double pos, SUMOTime splInterval, const std::string& device, bool friendlyPos, const std::string& vTypes) { checkSampleInterval(splInterval, SUMO_TAG_E1DETECTOR, id); @@ -119,7 +115,7 @@ void NLDetectorBuilder::buildInstantInductLoop(const std::string& id, - const std::string& lane, SUMOReal pos, + const std::string& lane, double pos, const std::string& device, bool friendlyPos, const std::string& vTypes) { // get and check the lane @@ -134,139 +130,169 @@ void -NLDetectorBuilder::buildE2Detector(const std::string& id, - const std::string& lane, SUMOReal pos, SUMOReal length, - bool cont, SUMOTime splInterval, - const std::string& device, - SUMOTime haltingTimeThreshold, - SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, bool friendlyPos, - const std::string& vTypes) { - checkSampleInterval(splInterval, SUMO_TAG_E2DETECTOR, id); - MSLane* clane = getLaneChecking(lane, SUMO_TAG_E2DETECTOR, id); - // check whether the detector may lie over more than one lane - MSDetectorFileOutput* det = 0; - if (!cont) { - convUncontE2PosLength(id, clane, pos, length, friendlyPos); - det = buildSingleLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes); - myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det, device, splInterval); - } else { - convContE2PosLength(id, clane, pos, length, friendlyPos); - det = buildMultiLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes); - myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det, device, splInterval); +NLDetectorBuilder::buildE2Detector(const std::string& id, MSLane* lane, double pos, double endPos, double length, + const std::string& device, SUMOTime frequency, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, + const std::string& vTypes, bool friendlyPos, bool showDetector, + MSTLLogicControl::TLSLogicVariants* tlls, MSLane* toLane) { + + bool tlsGiven = tlls != 0; + bool toLaneGiven = toLane != 0; + bool posGiven = pos != std::numeric_limits::max(); + bool endPosGiven = endPos != std::numeric_limits::max(); + + assert(posGiven || endPosGiven); + + // Check positioning + if (posGiven) { + if (pos >= lane->getLength() || (pos < 0 && -pos > lane->getLength())) { + std::stringstream ss; + ss << "The given position (=" << pos << ") for detector '" << id + << "' does not lie on the given lane '" << lane->getID() + << "' with length " << lane->getLength(); + if (friendlyPos) { + double newPos = pos > 0 ? lane->getLength() - POSITION_EPS : 0.; + ss << " (adjusting to new position " << newPos; + WRITE_WARNING(ss.str()); + pos = newPos; + } else { + ss << " (0 <= pos < lane->getLength() is required)"; + throw InvalidArgument(ss.str()); + } + } } -} - - -void -NLDetectorBuilder::buildE2Detector(const std::string& id, - const std::string& lane, SUMOReal pos, SUMOReal length, - bool cont, - MSTLLogicControl::TLSLogicVariants& tlls, - const std::string& device, - SUMOTime haltingTimeThreshold, - SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, bool friendlyPos, - const std::string& vTypes) { - if (tlls.getActive() == 0) { - throw InvalidArgument("The detector '" + id + "' refers to the unknown lsa."); + if (endPosGiven) { + if (endPos > lane->getLength() || (endPos <= 0 && -endPos >= lane->getLength())) { + std::stringstream ss; + ss << "The given end position (=" << endPos << ") for detector '" << id + << "' does not lie on the given lane '" << lane->getID() + << "' with length " << lane->getLength(); + if (friendlyPos) { + double newEndPos = endPos > 0 ? lane->getLength() : POSITION_EPS; + ss << " (adjusting to new position " << newEndPos; + WRITE_WARNING(ss.str()); + pos = newEndPos; + } else { + std::stringstream ss; + ss << " (0 <= pos < lane->getLength() is required)"; + throw InvalidArgument(ss.str()); + } + } } - MSLane* clane = getLaneChecking(lane, SUMO_TAG_E2DETECTOR, id); - // check whether the detector may lie over more than one lane - MSDetectorFileOutput* det = 0; - if (!cont) { - convUncontE2PosLength(id, clane, pos, length, friendlyPos); - det = buildSingleLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes); + + MSE2Collector* det = 0; + if (tlsGiven) { + // Detector connected to TLS + det = createE2Detector(id, DU_USER_DEFINED, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector); myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det); + // add the file output (XXX: Where's the corresponding delete?) + if (toLaneGiven) { + // Detector also associated to specific link + MSLane* lastLane = det->getLastLane(); + MSLink* link = MSLinkContHelper::getConnectingLink(*lastLane, *toLane); + if (link == 0) { + throw InvalidArgument( + "The detector '" + id + "' cannot be build as no connection between lanes '" + + lastLane->getID() + "' and '" + toLane->getID() + "' exists."); + } + new Command_SaveTLCoupledLaneDet(*tlls, det, myNet.getCurrentTimeStep(), OutputDevice::getDevice(device), link); + } else { + // detector for tls but without specific link + new Command_SaveTLCoupledDet(*tlls, det, myNet.getCurrentTimeStep(), OutputDevice::getDevice(device)); + } } else { - convContE2PosLength(id, clane, pos, length, friendlyPos); - det = buildMultiLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes); - myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det); + // User specified detector for xml-output + checkSampleInterval(frequency, SUMO_TAG_E2DETECTOR, id); + det = createE2Detector(id, DU_USER_DEFINED, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector); + myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det, device, frequency); } - // add the file output - new Command_SaveTLCoupledDet(tlls, det, myNet.getCurrentTimeStep(), OutputDevice::getDevice(device)); -} +} void -NLDetectorBuilder::buildE2Detector(const std::string& id, - const std::string& lane, SUMOReal pos, SUMOReal length, - bool cont, - MSTLLogicControl::TLSLogicVariants& tlls, - const std::string& tolane, - const std::string& device, - SUMOTime haltingTimeThreshold, - SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, bool friendlyPos, - const std::string& vTypes) { - if (tlls.getActive() == 0) { - throw InvalidArgument("The detector '" + id + "' refers to the unknown lsa."); - } - MSLane* clane = getLaneChecking(lane, SUMO_TAG_E2DETECTOR, id); - MSLane* ctoLane = getLaneChecking(tolane, SUMO_TAG_E2DETECTOR, id); - MSLink* link = MSLinkContHelper::getConnectingLink(*clane, *ctoLane); - if (link == 0) { - throw InvalidArgument( - "The detector output can not be build as no connection between lanes '" - + lane + "' and '" + tolane + "' exists."); - } - if (pos < 0) { - pos = -pos; - } - // check whether the detector may lie over more than one lane - MSDetectorFileOutput* det = 0; - if (!cont) { - convUncontE2PosLength(id, clane, pos, length, friendlyPos); - det = buildSingleLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes); - myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det); - } else { - convContE2PosLength(id, clane, pos, length, friendlyPos); - det = buildMultiLaneE2Det(id, DU_USER_DEFINED, clane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes); - myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det); - } - // add the file output - new Command_SaveTLCoupledLaneDet(tlls, det, myNet.getCurrentTimeStep(), OutputDevice::getDevice(device), link); -} +NLDetectorBuilder::buildE2Detector(const std::string& id, std::vector lanes, double pos, double endPos, + const std::string& device, SUMOTime frequency, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, + const std::string& vTypes, bool friendlyPos, bool showDetector, + MSTLLogicControl::TLSLogicVariants* tlls, MSLane* toLane) { + bool tlsGiven = tlls != 0; + bool toLaneGiven = toLane != 0; + assert(pos != std::numeric_limits::max()); + assert(endPos != std::numeric_limits::max()); + assert(lanes.size() != 0); -void -NLDetectorBuilder::convUncontE2PosLength(const std::string& id, MSLane* clane, - SUMOReal& pos, SUMOReal& length, - bool friendlyPos) { - // get and check the position - pos = getPositionChecking(pos, clane, friendlyPos, id); - // check length - if (length <= 0) { + MSLane* firstLane = lanes[0]; + MSLane* lastLane = lanes[lanes.size() - 1]; + + // Check positioning + if (pos >= firstLane->getLength() || (pos < 0 && -pos > firstLane->getLength())) { + std::stringstream ss; + ss << "The given position (=" << pos << ") for detector '" << id + << "' does not lie on the given lane '" << firstLane->getID() + << "' with length " << firstLane->getLength(); if (friendlyPos) { - length = (SUMOReal) 0.1; + double newPos = pos > 0 ? firstLane->getLength() - POSITION_EPS : 0.; + ss << " (adjusting to new position " << newPos; + WRITE_WARNING(ss.str()); + pos = newPos; } else { - throw InvalidArgument("Invalid length for detector '" + id + "'."); + ss << " (0 <= pos < lane->getLength() is required)"; + throw InvalidArgument(ss.str()); } } - if (length + pos > clane->getLength()) { + if (endPos > lastLane->getLength() || (endPos <= 0 && -endPos >= lastLane->getLength())) { + std::stringstream ss; + ss << "The given end position (=" << endPos << ") for detector '" << id + << "' does not lie on the given lane '" << lastLane->getID() + << "' with length " << lastLane->getLength(); if (friendlyPos) { - length = clane->getLength() - pos; + double newEndPos = endPos > 0 ? lastLane->getLength() : POSITION_EPS; + ss << " (adjusting to new position " << newEndPos; + WRITE_WARNING(ss.str()); + pos = newEndPos; } else { - throw InvalidArgument("The length of detector '" + id + "' reaches beyond the lane's '" + clane->getID() + "' length."); + ss << " (0 <= pos < lane->getLength() is required)"; + throw InvalidArgument(ss.str()); } } -} + MSE2Collector* det = 0; + if (tlsGiven) { + // Detector connected to TLS + det = createE2Detector(id, DU_USER_DEFINED, lanes, pos, endPos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector); + myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det); + // add the file output (XXX: Where's the corresponding delete?) + if (toLaneGiven) { + // Detector also associated to specific link + MSLane* lastLane = det->getLastLane(); + MSLink* link = MSLinkContHelper::getConnectingLink(*lastLane, *toLane); + if (link == 0) { + throw InvalidArgument( + "The detector '" + id + "' cannot be build as no connection between lanes '" + + lastLane->getID() + "' and '" + toLane->getID() + "' exists."); + } + new Command_SaveTLCoupledLaneDet(*tlls, det, myNet.getCurrentTimeStep(), OutputDevice::getDevice(device), link); + } else { + // detector for tls but without specific link + new Command_SaveTLCoupledDet(*tlls, det, myNet.getCurrentTimeStep(), OutputDevice::getDevice(device)); + } + } else { + // User specified detector for xml-output + checkSampleInterval(frequency, SUMO_TAG_E2DETECTOR, id); + + det = createE2Detector(id, DU_USER_DEFINED, lanes, pos, endPos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector); + myNet.getDetectorControl().add(SUMO_TAG_LANE_AREA_DETECTOR, det, device, frequency); + } -void -NLDetectorBuilder::convContE2PosLength(const std::string& id, MSLane* clane, - SUMOReal& pos, SUMOReal& /*length*/, - bool friendlyPos) { - // get and check the position - pos = getPositionChecking(pos, clane, friendlyPos, id); - // length will be kept as is } + void NLDetectorBuilder::beginE3Detector(const std::string& id, const std::string& device, SUMOTime splInterval, - SUMOReal haltingSpeedThreshold, + double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string& vTypes) { checkSampleInterval(splInterval, SUMO_TAG_E3DETECTOR, id); @@ -276,7 +302,7 @@ void NLDetectorBuilder::addE3Entry(const std::string& lane, - SUMOReal pos, bool friendlyPos) { + double pos, bool friendlyPos) { if (myE3Definition == 0) { return; } @@ -290,7 +316,7 @@ void NLDetectorBuilder::addE3Exit(const std::string& lane, - SUMOReal pos, bool friendlyPos) { + double pos, bool friendlyPos) { if (myE3Definition == 0) { return; } @@ -354,40 +380,9 @@ myNet.getDetectorControl().add(SUMO_TAG_ROUTEPROBE, probe, device, frequency, begin); } - -// ------------------- -MSE2Collector* -NLDetectorBuilder::buildSingleLaneE2Det(const std::string& id, - DetectorUsage usage, - MSLane* lane, SUMOReal pos, SUMOReal length, - SUMOTime haltingTimeThreshold, - SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, - const std::string& vTypes) { - return createSingleLaneE2Detector(id, usage, lane, pos, - length, haltingTimeThreshold, haltingSpeedThreshold, - jamDistThreshold, vTypes); -} - - -MSDetectorFileOutput* -NLDetectorBuilder::buildMultiLaneE2Det(const std::string& id, DetectorUsage usage, - MSLane* lane, SUMOReal pos, SUMOReal length, - SUMOTime haltingTimeThreshold, - SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, - const std::string& vTypes) { - MSDetectorFileOutput* ret = createMultiLaneE2Detector(id, usage, - lane, pos, haltingTimeThreshold, haltingSpeedThreshold, - jamDistThreshold, vTypes); - static_cast(ret)->init(lane, length); - return ret; -} - - MSDetectorFileOutput* NLDetectorBuilder::createInductLoop(const std::string& id, - MSLane* lane, SUMOReal pos, + MSLane* lane, double pos, const std::string& vTypes, bool) { if (MSGlobals::gUseMesoSim) { return new MEInductLoop(id, MSGlobals::gMesoNet->getSegmentForEdge(lane->getEdge(), pos), pos, vTypes); @@ -398,43 +393,41 @@ MSDetectorFileOutput* NLDetectorBuilder::createInstantInductLoop(const std::string& id, - MSLane* lane, SUMOReal pos, const std::string& od, + MSLane* lane, double pos, const std::string& od, const std::string& vTypes) { return new MSInstantInductLoop(id, OutputDevice::getDevice(od), lane, pos, vTypes); } MSE2Collector* -NLDetectorBuilder::createSingleLaneE2Detector(const std::string& id, - DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length, - SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, - const std::string& vTypes) { - return new MSE2Collector(id, usage, lane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes); +NLDetectorBuilder::createE2Detector(const std::string& id, + DetectorUsage usage, MSLane* lane, double pos, double endPos, double length, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, + const std::string& vTypes, bool /* showDetector */) { + return new MSE2Collector(id, usage, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes); } - -MSDetectorFileOutput* -NLDetectorBuilder::createMultiLaneE2Detector(const std::string& id, - DetectorUsage usage, MSLane* lane, SUMOReal pos, - SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, - const std::string& vTypes) { - return new MS_E2_ZS_CollectorOverLanes(id, usage, lane, pos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes); +MSE2Collector* +NLDetectorBuilder::createE2Detector(const std::string& id, + DetectorUsage usage, std::vector lanes, double pos, double endPos, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, + const std::string& vTypes, bool /* showDetector */) { + return new MSE2Collector(id, usage, lanes, pos, endPos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes); } - MSDetectorFileOutput* NLDetectorBuilder::createE3Detector(const std::string& id, const CrossSectionVector& entries, const CrossSectionVector& exits, - SUMOReal haltingSpeedThreshold, + double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string& vTypes) { return new MSE3Collector(id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold, vTypes); } -SUMOReal -NLDetectorBuilder::getPositionChecking(SUMOReal pos, MSLane* lane, bool friendlyPos, +double +NLDetectorBuilder::getPositionChecking(double pos, MSLane* lane, bool friendlyPos, const std::string& detid) { // check whether it is given from the end if (pos < 0) { @@ -464,8 +457,8 @@ SUMOTime begin, SUMOTime end, const std::string& type, const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, - const SUMOReal maxTravelTime, const SUMOReal minSamples, - const SUMOReal haltSpeed, const std::string& vTypes, + const double maxTravelTime, const double minSamples, + const double haltSpeed, const std::string& vTypes, const std::string& device) { if (begin < 0) { throw InvalidArgument("Negative begin time for meandata dump '" + id + "'."); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLDetectorBuilder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLDetectorBuilder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLDetectorBuilder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLDetectorBuilder.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Christian Roessel /// @author Michael Behrisch /// @date Mon, 15 Apr 2002 -/// @version $Id: NLDetectorBuilder.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NLDetectorBuilder.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Builds detectors for microsim /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,6 +37,7 @@ #include #include #include +// #include // =========================================================================== // class declarations @@ -92,11 +93,11 @@ * @param[in] splInterval The aggregation time span the detector shall use * @param[in] device The output device the detector shall write into * @param[in] friendlyPos Whether the position information shall be used "friendly" (see user docs) - * @param[in] splitByType Whether vehicle types shall be disaggregated + * @param[in] vTypes which vehicle types are considered * @exception InvalidArgument If one of the values is invalid */ void buildInductLoop(const std::string& id, - const std::string& lane, SUMOReal pos, SUMOTime splInterval, + const std::string& lane, double pos, SUMOTime splInterval, const std::string& device, bool friendlyPos, const std::string& vTypes); @@ -117,105 +118,35 @@ * @exception InvalidArgument If one of the values is invalid */ void buildInstantInductLoop(const std::string& id, - const std::string& lane, SUMOReal pos, + const std::string& lane, double pos, const std::string& device, bool friendlyPos, const std::string& vTypes); - /** @brief Builds an e2 detector with a fixed interval and adds it to the net - * - * Checks the given values, first. If one of the values is invalid - * (lane is not known, sampling frequency<=0, position is larger - * than lane's length, length is too large, the id is already in use), - * an InvalidArgument is thrown. - * - * Otherwise the e2 detector is built, either by calling "buildMultiLaneE2Det" - * if the detector shall continue on consecutive lanes, or by calling - * "buildSingleLaneE2Det" if it is a one-lane detector. - * - * @param[in] id The id the detector shall have - * @param[in] lane The name of the lane the detector is placed at - * @param[in] pos The definition of the position on the lane the detector shall be placed at - * @param[in] length The definition of the length the detector shall have - * @param[in] cont Whether the detector shall continue on predeceeding lanes - * @param[in] splInterval The aggregation time span the detector shall use - * @param[in] device The output device the detector shall write into - * @param[in] haltingTimeThreshold Detector parameter: the time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed - * @param[in] haltingSpeedThreshold Detector parameter: the speed a vehicle's speed must be below to be assigned as jammed - * @param[in] jamDistThreshold Detector parameter: the distance between two vehicles in order to not count them to one jam - * @param[in] friendlyPos Whether the position information shall be used "friendly" (see user docs) - * @exception InvalidArgument If one of the values is invalid - */ - void buildE2Detector(const std::string& id, const std::string& lane, SUMOReal pos, SUMOReal length, - bool cont, SUMOTime splInterval, const std::string& device, SUMOTime haltingTimeThreshold, - SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, - bool friendlyPos, - const std::string& vTypes); - /** @brief Builds an e2 detector connected to a lsa - * - * Checks the given values, first. If one of the values is invalid - * (lane is not known, position is larger than lane's length, length is too large, - * the tls is not known, the id is already in use), - * an InvalidArgument is thrown. - * - * Otherwise the e2 detector is built, either by calling "buildMultiLaneE2Det" - * if the detector shall continue on consecutive lanes, or by calling - * "buildSingleLaneE2Det" if it is a one-lane detector. - * - * @param[in] id The id the detector shall have - * @param[in] lane The name of the lane the detector is placed at - * @param[in] pos The definition of the position on the lane the detector shall be placed at - * @param[in] length The definition of the length the detector shall have - * @param[in] cont Whether the detector shall continue on predeceeding lanes - * @param[in] tlls The tls the detector is assigned to - * @param[in] device The output device the detector shall write into - * @param[in] haltingTimeThreshold Detector parameter: the time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed - * @param[in] haltingSpeedThreshold Detector parameter: the speed a vehicle's speed must be below to be assigned as jammed - * @param[in] jamDistThreshold Detector parameter: the distance between two vehicles in order to not count them to one jam - * @param[in] friendlyPos Whether the position information shall be used "friendly" (see user docs) - * @exception InvalidArgument If one of the values is invalid - */ - void buildE2Detector(const std::string& id, const std::string& lane, SUMOReal pos, SUMOReal length, - bool cont, MSTLLogicControl::TLSLogicVariants& tlls, - const std::string& device, SUMOTime haltingTimeThreshold, - SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, - bool friendlyPos, - const std::string& vTypes); - - - /** @brief Builds an e2 detector connected to a link's state - * - * Checks the given values, first. If one of the values is invalid - * (lane is not known, position is larger than lane's length, length is too large, - * the tls or the destination lane is not known, the id is already in use), - * an InvalidArgument is thrown. - * - * Otherwise the e2 detector is built, either by calling "buildMultiLaneE2Det" - * if the detector shall continue on consecutive lanes, or by calling - * "buildSingleLaneE2Det" if it is a one-lane detector. - * - * @param[in] id The id the detector shall have - * @param[in] lane The name of the lane the detector is placed at - * @param[in] pos The definition of the position on the lane the detector shall be placed at - * @param[in] length The definition of the length the detector shall have - * @param[in] cont Whether the detector shall continue on predeceeding lanes - * @param[in] tlls The tls the detector is assigned to - * @param[in] tolane The name of the lane to which the link to which the detector to build shall be assigned to points - * @param[in] device The output device the detector shall write into - * @param[in] haltingTimeThreshold Detector parameter: the time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed - * @param[in] haltingSpeedThreshold Detector parameter: the speed a vehicle's speed must be below to be assigned as jammed - * @param[in] jamDistThreshold Detector parameter: the distance between two vehicles in order to not count them to one jam - * @param[in] friendlyPos Whether the position information shall be used "friendly" (see user docs) - * @exception InvalidArgument If one of the values is invalid - */ - void buildE2Detector(const std::string& id, const std::string& lane, SUMOReal pos, SUMOReal length, - bool cont, MSTLLogicControl::TLSLogicVariants& tlls, const std::string& tolane, - const std::string& device, SUMOTime haltingTimeThreshold, - SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, - bool friendlyPos, - const std::string& vTypes); + /** @brief Builds a new E2 detector and adds it to the net's detector control. Also performs some + * consistency checks for the detector positioning and applies "friendly positioning" + * + * @param[in] tlls Traffic light logic associated to the detector + * @param[in] toLane Lane associated to the detector (only for tlls != 0) + * @param[in] friendlyPos Whether automatic adjustments of the detector position shall be applied in case of erroneous specification + * @see For the other parameters see the MSE2Collector constructors + * + * @todo Add parameter showDetector to indicate whether the detector should be visible in the GUI + * + */ + void buildE2Detector(const std::string& id, MSLane* lane, double pos, double endPos, double length, + const std::string& device, SUMOTime frequency, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, + const std::string& vTypes, bool friendlyPos, bool showDetector, + MSTLLogicControl::TLSLogicVariants* tlls = 0, MSLane* toLane = 0); + + void buildE2Detector(const std::string& id, std::vector lanes, double pos, double endPos, + const std::string& device, SUMOTime frequency, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, + const std::string& vTypes, bool friendlyPos, bool showDetector, + MSTLLogicControl::TLSLogicVariants* tlls = 0, MSLane* toLane = 0); /** @brief Stores temporary the initial information about an e3 detector to build @@ -232,7 +163,7 @@ * @exception InvalidArgument If one of the values is invalid */ void beginE3Detector(const std::string& id, const std::string& device, SUMOTime splInterval, - SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold, + double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string& vTypes); @@ -248,7 +179,7 @@ * @param[in] friendlyPos Whether the position information shall be used "friendly" (see user docs) * @exception InvalidArgument If one of the values is invalid */ - void addE3Entry(const std::string& lane, SUMOReal pos, bool friendlyPos); + void addE3Entry(const std::string& lane, double pos, bool friendlyPos); /** @brief Builds an exit point of an e3 detector @@ -263,7 +194,7 @@ * @param[in] friendlyPos Whether the position information shall be used "friendly" (see user docs) * @exception InvalidArgument If one of the values is invalid */ - void addE3Exit(const std::string& lane, SUMOReal pos, bool friendlyPos); + void addE3Exit(const std::string& lane, double pos, bool friendlyPos); /** @brief Builds of an e3 detector using collected values @@ -340,11 +271,11 @@ * @param[in] id The id the detector shall have * @param[in] lane The lane the detector is placed at * @param[in] pos The position on the lane the detector is placed at - * @param[in] splitByType Whether additional information split by vehicle classes shall be generated + * @param[in] vTypes which vehicle types are considered * @param[in] show Whether to show the detector in the gui if available */ virtual MSDetectorFileOutput* createInductLoop(const std::string& id, - MSLane* lane, SUMOReal pos, + MSLane* lane, double pos, const std::string& vTypes, bool show = true); @@ -358,48 +289,25 @@ * @param[in] od The output device the loop shall use */ virtual MSDetectorFileOutput* createInstantInductLoop(const std::string& id, - MSLane* lane, SUMOReal pos, const std::string& od, - const std::string& vTypes); - - /** @brief Creates an instance of an e2 detector using the given values - * - * Simply calls the MSE2Collector constructor - * - * @param[in] id The id the detector shall have - * @param[in] lane The lane the detector is placed at - * @param[in] pos The position on the lane the detector is placed at - * @param[in] length The length the detector has - * @param[in] haltingTimeThreshold Detector parameter: the time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed - * @param[in] haltingSpeedThreshold Detector parameter: the speed a vehicle's speed must be below to be assigned as jammed - * @param[in] jamDistThreshold Detector parameter: the distance between two vehicles in order to not count them to one jam - */ - virtual MSE2Collector* createSingleLaneE2Detector(const std::string& id, - DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length, - SUMOTime haltingTimeThreshold, - SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, + MSLane* lane, double pos, const std::string& od, const std::string& vTypes); - /** @brief Creates an instance of an e2ol-detector using the given values + /** @brief Creates a MSE2Collector instance, overridden by GUIE2Collector::createE2Detector() * - * Simply calls the MS_E2_ZS_CollectorOverLanes constructor. After this call, - * the detector must be initialised. + * Simply calls the MSE2Collector constructor * - * @param[in] id The id the detector shall have - * @param[in] lane The lane the detector is placed at - * @param[in] pos The position on the lane the detector is placed at - * @param[in] length The length the detector has - * @param[in] haltingTimeThreshold Detector parameter: the time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed - * @param[in] haltingSpeedThreshold Detector parameter: the speed a vehicle's speed must be below to be assigned as jammed - * @param[in] jamDistThreshold Detector parameter: the distance between two vehicles in order to not count them to one jam + * @see MSE2Collector Constructor documentation */ - virtual MSDetectorFileOutput* createMultiLaneE2Detector( - const std::string& id, DetectorUsage usage, MSLane* lane, SUMOReal pos, - SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, - const std::string& vTypes); - + virtual MSE2Collector* createE2Detector(const std::string& id, + DetectorUsage usage, MSLane* lane, double pos, double endPos, double length, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, + const std::string& vTypes, bool showDetector = true); + + virtual MSE2Collector* createE2Detector(const std::string& id, + DetectorUsage usage, std::vector lanes, double pos, double endPos, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, + const std::string& vTypes, bool showDetector = true); /** @brief Creates an instance of an e3 detector using the given values * @@ -413,7 +321,7 @@ */ virtual MSDetectorFileOutput* createE3Detector(const std::string& id, const CrossSectionVector& entries, const CrossSectionVector& exits, - SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold, + double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string& vTypes); @@ -438,8 +346,8 @@ SUMOTime begin, SUMOTime end, const std::string& type, const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, - const SUMOReal maxTravelTime, const SUMOReal minSamples, - const SUMOReal haltSpeed, const std::string& vTypes, + const double maxTravelTime, const double minSamples, + const double haltSpeed, const std::string& vTypes, const std::string& device); /// @} @@ -458,32 +366,12 @@ * @todo Check whether this method is really needful */ MSE2Collector* buildSingleLaneE2Det(const std::string& id, - DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length, - SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, + DetectorUsage usage, MSLane* lane, double pos, double length, + SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, + double jamDistThreshold, const std::string& vTypes); - /** @brief Builds an e2 detector that continues on preceeding lanes - * - * @param[in] id The id the detector shall have - * @param[in] usage Information how the detector is used within the simulation - * @param[in] lane The lane the detector is placed at - * @param[in] pos The position on the lane the detector is placed at - * @param[in] length The length the detector has - * @param[in] haltingTimeThreshold Detector parameter: the time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed - * @param[in] haltingSpeedThreshold Detector parameter: the speed a vehicle's speed must be below to be assigned as jammed - * @param[in] jamDistThreshold Detector parameter: the distance between two vehicles in order to not count them to one jam - * @todo Check whether this method is really needful - */ - MSDetectorFileOutput* buildMultiLaneE2Det(const std::string& id, DetectorUsage usage, MSLane* lane, SUMOReal pos, SUMOReal length, - SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, - SUMOReal jamDistThreshold, - const std::string& vTypes); - - - - protected: /** * @class E3DetectorDefinition @@ -499,7 +387,7 @@ * @param[in] splInterval The aggregation time span the detector shall use */ E3DetectorDefinition(const std::string& id, - const std::string& device, SUMOReal haltingSpeedThreshold, + const std::string& device, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, SUMOTime splInterval, const std::string& vTypes); @@ -511,7 +399,7 @@ /// @brief The device the detector shall use const std::string myDevice; /// @brief The speed a vehicle's speed must be below to be assigned as jammed - SUMOReal myHaltingSpeedThreshold; + double myHaltingSpeedThreshold; /// @brief The time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed SUMOTime myHaltingTimeThreshold; /// @brief List of detector's entries @@ -551,33 +439,8 @@ * @param[in] detid The id of the currently built detector (for error message generation) * @exception InvalidArgument If the defined position is invalid */ - SUMOReal getPositionChecking(SUMOReal pos, MSLane* lane, bool friendlyPos, - const std::string& detid); - - - /** @brief Converts the length and the position information for an e2 detector - * - * @param[in] id The id of the currently built detector (for error message generation) - * @param[in] clane The lane the detector is placed at - * @param[in, out] pos The position definition to convert - * @param[in, out] length The length definition to convert - * @exception InvalidArgument If the defined position or the defined length is invalid - */ - void convUncontE2PosLength(const std::string& id, MSLane* clane, - SUMOReal& pos, SUMOReal& length, bool frinedly_pos); - - - /** @brief Converts the length and the position information for an e2ol-detector - * - * @param[in] id The id of the currently built detector (for error message generation) - * @param[in] clane The lane the detector is placed at - * @param[in, out] pos The position definition to convert - * @param[in, out] length The length definition to convert - * @exception InvalidArgument If the defined position or the defined length is invalid - */ - void convContE2PosLength(const std::string& id, MSLane* clane, - SUMOReal& pos, SUMOReal& length, bool frinedly_pos); - + double getPositionChecking(double pos, MSLane* lane, bool friendlyPos, + const std::string& detid); /// @name Value checking/adapting methods @@ -592,7 +455,7 @@ MSEdge* getEdgeChecking(const std::string& edgeID, SumoXMLTag type, const std::string& detid); - +public: /** @brief Returns the named lane * @param[in] laneID The id of the lane * @param[in] type The type of the detector (for error message generation) @@ -602,7 +465,7 @@ MSLane* getLaneChecking(const std::string& laneID, SumoXMLTag type, const std::string& detid); - +protected: /** @brief Checks whether the given frequency (sample interval) is valid * @param[in] splInterval The sample interval * @param[in] type The type of the detector (for error message generation) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLDiscreteEventBuilder.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLDiscreteEventBuilder.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLDiscreteEventBuilder.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLDiscreteEventBuilder.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Sep, 2003 -/// @version $Id: NLDiscreteEventBuilder.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NLDiscreteEventBuilder.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // } /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,10 +44,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLDiscreteEventBuilder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLDiscreteEventBuilder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLDiscreteEventBuilder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLDiscreteEventBuilder.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sep, 2003 -/// @version $Id: NLDiscreteEventBuilder.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NLDiscreteEventBuilder.h 22608 2017-01-17 06:28:54Z behrisch $ /// // missing_desc /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLEdgeControlBuilder.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLEdgeControlBuilder.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLEdgeControlBuilder.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLEdgeControlBuilder.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 9 Jul 2001 -/// @version $Id: NLEdgeControlBuilder.cpp 20550 2016-04-26 10:57:45Z namdre $ +/// @version $Id: NLEdgeControlBuilder.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Interface for building edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,10 +46,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -82,10 +78,10 @@ MSLane* NLEdgeControlBuilder::addLane(const std::string& id, - SUMOReal maxSpeed, SUMOReal length, - const PositionVector& shape, SUMOReal width, - SVCPermissions permissions, int index) { - MSLane* lane = new MSLane(id, maxSpeed, length, myActiveEdge, myCurrentNumericalLaneID++, shape, width, permissions, index); + double maxSpeed, double length, + const PositionVector& shape, double width, + SVCPermissions permissions, int index, bool isRampAccel) { + MSLane* lane = new MSLane(id, maxSpeed, length, myActiveEdge, myCurrentNumericalLaneID++, shape, width, permissions, index, isRampAccel); myLaneStorage->push_back(lane); return lane; } @@ -121,10 +117,10 @@ for (MSEdgeVector::iterator i1 = myEdges.begin(); i1 != myEdges.end(); i1++) { MSEdge* edge = *i1; if (edge->isInternal()) { - if (edge->getNumSuccessors() != 1 || edge->getIncomingEdges().size() != 1) { + if (edge->getNumSuccessors() != 1 || edge->getNumPredecessors() != 1) { throw ProcessError("Internal edge '" + edge->getID() + "' is not properly connected (probably a manually modified net.xml)."); } - if (edge->getSuccessors()[0]->isRoundabout() || edge->getIncomingEdges()[0]->isRoundabout()) { + if (edge->getSuccessors()[0]->isRoundabout() || edge->getPredecessors()[0]->isRoundabout()) { edge->markAsRoundabout(); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLEdgeControlBuilder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLEdgeControlBuilder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLEdgeControlBuilder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLEdgeControlBuilder.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 9 Jul 2001 -/// @version $Id: NLEdgeControlBuilder.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NLEdgeControlBuilder.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Interface for building edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -101,9 +101,9 @@ * @see MSLane * @todo Definitely not a good way */ - virtual MSLane* addLane(const std::string& id, SUMOReal maxSpeed, - SUMOReal length, const PositionVector& shape, - SUMOReal width, SVCPermissions permissions, int index); + virtual MSLane* addLane(const std::string& id, double maxSpeed, + double length, const PositionVector& shape, + double width, SVCPermissions permissions, int index, bool isRampAccel); /** @brief Adds a neighbor to the current lane diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -7,7 +7,7 @@ /// @author Michael Behrisch /// @author Felix Brack /// @date Mon, 9 Jul 2001 -/// @version $Id: NLHandler.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NLHandler.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The XML-Handler for network loading /****************************************************************************/ @@ -57,10 +57,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -80,6 +76,7 @@ myLastParameterised(0), myHaveSeenInternalEdge(false), myHaveSeenNeighs(false), + myHaveSeenAdditionalSpeedRestrictions(false), myLefthand(false), myNetworkVersion(0), myNetIsLoaded(false) { @@ -97,7 +94,7 @@ case SUMO_TAG_NET: { bool ok; myLefthand = attrs.getOpt(SUMO_ATTR_LEFTHAND, 0, ok, false); - myNetworkVersion = attrs.get(SUMO_ATTR_VERSION, 0, ok, false); + myNetworkVersion = attrs.get(SUMO_ATTR_VERSION, 0, ok, false); break; } case SUMO_TAG_EDGE: @@ -170,6 +167,12 @@ case SUMO_TAG_CONTAINER_STOP: myTriggerBuilder.parseAndBuildStoppingPlace(myNet, attrs, (SumoXMLTag)element); break; + case SUMO_TAG_PARKING_SPACE: + myTriggerBuilder.parseAndAddLotEntry(attrs); + break; + case SUMO_TAG_PARKING_AREA: + myTriggerBuilder.parseAndBeginParkingArea(myNet, attrs); + break; case SUMO_TAG_ACCESS: myTriggerBuilder.addAccess(myNet, attrs); break; @@ -217,10 +220,13 @@ case SUMO_TAG_RESTRICTION: { bool ok = true; const SUMOVehicleClass svc = getVehicleClassID(attrs.get(SUMO_ATTR_VCLASS, myCurrentTypeID.c_str(), ok)); - const SUMOReal speed = attrs.get(SUMO_ATTR_SPEED, myCurrentTypeID.c_str(), ok); + const double speed = attrs.get(SUMO_ATTR_SPEED, myCurrentTypeID.c_str(), ok); if (ok) { myNet.addRestriction(myCurrentTypeID, svc, speed); } + if (myNetIsLoaded) { + myHaveSeenAdditionalSpeedRestrictions = true; + } break; } default: @@ -253,10 +259,12 @@ } break; case SUMO_TAG_TLLOGIC: - try { - myJunctionControlBuilder.closeTrafficLightLogic(getFileName()); - } catch (InvalidArgument& e) { - WRITE_ERROR(e.what()); + if (!myCurrentIsBroken) { + try { + myJunctionControlBuilder.closeTrafficLightLogic(getFileName()); + } catch (InvalidArgument& e) { + WRITE_ERROR(e.what()); + } } myAmInTLLogicMode = false; break; @@ -267,6 +275,9 @@ case SUMO_TAG_ENTRY_EXIT_DETECTOR: endE3Detector(); break; + case SUMO_TAG_PARKING_AREA: + myTriggerBuilder.endParkingArea(); + break; case SUMO_TAG_NET: // build junction graph for (JunctionGraph::iterator it = myJunctionGraph.begin(); it != myJunctionGraph.end(); ++it) { @@ -315,7 +326,7 @@ myJunctionGraph[id] = std::make_pair( attrs.get(SUMO_ATTR_FROM, 0, ok), attrs.get(SUMO_ATTR_TO, 0, ok)); - } else { + } else if (id[0] == ':') { // must be an internal edge std::string junctionID = SUMOXMLDefinitions::getJunctionIDFromInternalEdge(id); myJunctionGraph[id] = std::make_pair(junctionID, junctionID); @@ -411,13 +422,14 @@ myCurrentIsBroken = true; return; } - const SUMOReal maxSpeed = attrs.get(SUMO_ATTR_SPEED, id.c_str(), ok); - const SUMOReal length = attrs.get(SUMO_ATTR_LENGTH, id.c_str(), ok); + const double maxSpeed = attrs.get(SUMO_ATTR_SPEED, id.c_str(), ok); + const double length = attrs.get(SUMO_ATTR_LENGTH, id.c_str(), ok); const std::string allow = attrs.getOpt(SUMO_ATTR_ALLOW, id.c_str(), ok, "", false); const std::string disallow = attrs.getOpt(SUMO_ATTR_DISALLOW, id.c_str(), ok, ""); - const SUMOReal width = attrs.getOpt(SUMO_ATTR_WIDTH, id.c_str(), ok, SUMO_const_laneWidth); + const double width = attrs.getOpt(SUMO_ATTR_WIDTH, id.c_str(), ok, SUMO_const_laneWidth); const PositionVector shape = attrs.get(SUMO_ATTR_SHAPE, id.c_str(), ok); const int index = attrs.get(SUMO_ATTR_INDEX, id.c_str(), ok); + const bool isRampAccel = attrs.getOpt(SUMO_ATTR_ACCELERATION, id.c_str(), ok, false); if (shape.size() < 2) { WRITE_ERROR("Shape of lane '" + id + "' is broken.\n Can not build according edge."); myCurrentIsBroken = true; @@ -430,7 +442,7 @@ myCurrentIsBroken |= !ok; if (!myCurrentIsBroken) { try { - MSLane* lane = myEdgeControlBuilder.addLane(id, maxSpeed, length, shape, width, permissions, index); + MSLane* lane = myEdgeControlBuilder.addLane(id, maxSpeed, length, shape, width, permissions, index, isRampAccel); // insert the lane into the lane-dictionary, checking if (!MSLane::dictionary(id, lane)) { delete lane; @@ -464,8 +476,8 @@ shape.closePolygon(); } } - SUMOReal x = attrs.get(SUMO_ATTR_X, id.c_str(), ok); - SUMOReal y = attrs.get(SUMO_ATTR_Y, id.c_str(), ok); + double x = attrs.get(SUMO_ATTR_X, id.c_str(), ok); + double y = attrs.get(SUMO_ATTR_Y, id.c_str(), ok); bool typeOK = true; SumoXMLNodeType type = attrs.getNodeType(typeOK); if (!typeOK) { @@ -478,11 +490,9 @@ parseLanes(id, attrs.getStringSecure(SUMO_ATTR_INCLANES, ""), incomingLanes, ok); // internal lanes std::vector internalLanes; -#ifdef HAVE_INTERNAL_LANES if (MSGlobals::gUsingInternalLanes) { parseLanes(id, attrs.getStringSecure(SUMO_ATTR_INTLANES, ""), internalLanes, ok); } -#endif if (!ok) { myCurrentIsBroken = true; } else { @@ -609,9 +619,7 @@ bool ok = true; int request = attrs.get(SUMO_ATTR_INDEX, 0, ok); bool cont = false; -#ifdef HAVE_INTERNAL_LANES cont = attrs.getOpt(SUMO_ATTR_CONT, 0, ok, false); -#endif std::string response = attrs.get(SUMO_ATTR_RESPONSE, 0, ok); std::string foes = attrs.get(SUMO_ATTR_FOES, 0, ok); if (!ok) { @@ -644,6 +652,7 @@ void NLHandler::initTrafficLightLogic(const SUMOSAXAttributes& attrs) { + myCurrentIsBroken = false; myAmInTLLogicMode = true; bool ok = true; std::string id = attrs.get(SUMO_ATTR_ID, 0, ok); @@ -651,9 +660,13 @@ TrafficLightType type = TLTYPE_STATIC; std::string typeS; if (myJunctionControlBuilder.getTLLogicControlToUse().get(id, programID) == 0) { - // SUMO_ATTR_TYPE is not needed when only modifying the offst of an + // SUMO_ATTR_TYPE is not needed when only modifying the offset of an // existing program - typeS = attrs.get(SUMO_ATTR_TYPE, 0, ok); + typeS = attrs.get(SUMO_ATTR_TYPE, id.c_str(), ok); + if (!ok) { + myCurrentIsBroken = true; + return; + } if (SUMOXMLDefinitions::TrafficLightTypes.hasString(typeS)) { type = SUMOXMLDefinitions::TrafficLightTypes.get(typeS); } else { @@ -661,8 +674,9 @@ } } // - SUMOTime offset = attrs.getOptSUMOTimeReporting(SUMO_ATTR_OFFSET, id.c_str(), ok, 0); + const SUMOTime offset = attrs.getOptSUMOTimeReporting(SUMO_ATTR_OFFSET, id.c_str(), ok, 0); if (!ok) { + myCurrentIsBroken = true; return; } myJunctionControlBuilder.initTrafficLightLogic(id, programID, type, offset); @@ -769,7 +783,7 @@ return; } const SUMOTime frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), ok); - const SUMOReal position = attrs.get(SUMO_ATTR_POSITION, id.c_str(), ok); + const double position = attrs.get(SUMO_ATTR_POSITION, id.c_str(), ok); const bool friendlyPos = attrs.getOpt(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false); const std::string vTypes = attrs.getOpt(SUMO_ATTR_VTYPES, id.c_str(), ok, ""); const std::string lane = attrs.get(SUMO_ATTR_LANE, id.c_str(), ok); @@ -797,7 +811,7 @@ if (!ok) { return; } - const SUMOReal position = attrs.get(SUMO_ATTR_POSITION, id.c_str(), ok); + const double position = attrs.get(SUMO_ATTR_POSITION, id.c_str(), ok); const bool friendlyPos = attrs.getOpt(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false); const std::string lane = attrs.get(SUMO_ATTR_LANE, id.c_str(), ok); const std::string file = attrs.get(SUMO_ATTR_FILE, id.c_str(), ok); @@ -861,55 +875,186 @@ void NLHandler::addE2Detector(const SUMOSAXAttributes& attrs) { - // check whether this is a detector connected to a tls an optionally to a link + + // check whether this is a detector connected to a tls and optionally to a link bool ok = true; const std::string id = attrs.get(SUMO_ATTR_ID, 0, ok); - const std::string lsaid = attrs.getOpt(SUMO_ATTR_TLID, id.c_str(), ok, ""); - const std::string toLane = attrs.getOpt(SUMO_ATTR_TO, id.c_str(), ok, ""); + const std::string lsaid = attrs.getOpt(SUMO_ATTR_TLID, id.c_str(), ok, ""); + const std::string toLane = attrs.getOpt(SUMO_ATTR_TO, id.c_str(), ok, ""); const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), ok, TIME2STEPS(1)); - const SUMOReal haltingSpeedThreshold = attrs.getOpt(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), ok, 5.0f / 3.6f); - const SUMOReal jamDistThreshold = attrs.getOpt(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), ok, 10.0f); - const SUMOReal position = attrs.get(SUMO_ATTR_POSITION, id.c_str(), ok); - const SUMOReal length = attrs.get(SUMO_ATTR_LENGTH, id.c_str(), ok); + const double haltingSpeedThreshold = attrs.getOpt(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), ok, 5.0f / 3.6f); + const double jamDistThreshold = attrs.getOpt(SUMO_ATTR_JAM_DIST_THRESHOLD, id.c_str(), ok, 10.0f); + double position = attrs.getOpt(SUMO_ATTR_POSITION, id.c_str(), ok, std::numeric_limits::max()); + const double length = attrs.getOpt(SUMO_ATTR_LENGTH, id.c_str(), ok, std::numeric_limits::max()); const bool friendlyPos = attrs.getOpt(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false); - const bool cont = attrs.getOpt(SUMO_ATTR_CONT, id.c_str(), ok, false); - const std::string lane = attrs.get(SUMO_ATTR_LANE, id.c_str(), ok); + // const bool showDetector = attrs.getOpt(SUMO_ATTR_SHOW_DETECTOR, id.c_str(), ok, true); + // TODO: introduce show-detector attribute + const bool showDetector = true; + const std::string contStr = attrs.getOpt(SUMO_ATTR_CONT, id.c_str(), ok, ""); + if (contStr != "") { + WRITE_WARNING("Ignoring deprecated argument 'cont' for E2 detector '" + id + "'"); + } + std::string lane = attrs.getOpt(SUMO_ATTR_LANE, id.c_str(), ok, ""); const std::string file = attrs.get(SUMO_ATTR_FILE, id.c_str(), ok); const std::string vTypes = attrs.getOpt(SUMO_ATTR_VTYPES, id.c_str(), ok, ""); + + double endPosition = attrs.getOpt(SUMO_ATTR_ENDPOS, id.c_str(), ok, std::numeric_limits::max()); + const std::string lanes = attrs.getOpt(SUMO_ATTR_LANES, id.c_str(), ok, ""); // lanes has priority to lane if (!ok) { return; } - try { - if (lsaid != "") { - if (toLane == "") { - myDetectorBuilder.buildE2Detector(id, lane, position, length, cont, - myJunctionControlBuilder.getTLLogic(lsaid), - FileHelpers::checkForRelativity(file, getFileName()), - haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, - friendlyPos, vTypes); - } else { - myDetectorBuilder.buildE2Detector(id, lane, position, length, cont, - myJunctionControlBuilder.getTLLogic(lsaid), toLane, - FileHelpers::checkForRelativity(file, getFileName()), - haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, - friendlyPos, vTypes); + + bool lanesGiven = lanes != ""; + bool laneGiven = lane != ""; + if (!(lanesGiven || laneGiven)) { + // in absence of any lane-specification assume specification by id + WRITE_WARNING("Trying to specify detector's lane by the given id since the argument 'lane' is missing.") + lane = id; + laneGiven = true; + } + bool lengthGiven = length != std::numeric_limits::max(); + bool posGiven = position != std::numeric_limits::max(); + bool endPosGiven = endPosition != std::numeric_limits::max(); + bool lsaGiven = lsaid != ""; + bool toLaneGiven = toLane != ""; + + MSLane* clane = 0; + std::vector clanes; + if (lanesGiven) { + // If lanes is given, endPos and startPos are required. lane, endLane and length are ignored + std::string seps = " ,\t\n"; + StringTokenizer st = StringTokenizer(lanes, seps, true); +// std::cout << "Parsing lanes..." << std::endl; + while (st.hasNext()) { + std::string nextLaneID = st.next(); +// std::cout << "Next: " << nextLaneID << std::endl; + if (nextLaneID.find_first_of(seps) != nextLaneID.npos) { + continue; + } + clane = myDetectorBuilder.getLaneChecking(nextLaneID, SUMO_TAG_E2DETECTOR, id); + clanes.push_back(clane); + } + if (clanes.size() == 0) { + throw InvalidArgument("Malformed argument 'lanes' for E2Detector '" + id + "'.\nSpecify 'lanes' as a sequence of lane-IDs seperated by whitespace or comma (',')"); + } + if (laneGiven) { + WRITE_WARNING("Ignoring argument 'lane' for E2Detector '" + id + "' since argument 'lanes' was given.\n" + "Usage combinations for positional specification: [lane, pos, length], [endLane/lane, endPos, length], or [lanes, pos, endPos]"); + } + if (lengthGiven) { + WRITE_WARNING("Ignoring argument 'length' for E2Detector '" + id + "' since argument 'lanes' was given.\n" + "Usage combinations for positional specification: [lane, pos, length], [lane, endPos, length], or [lanes, pos, endPos]"); + } + if (!posGiven) { + // assuming start pos == lane start + position = 0; + WRITE_WARNING("Missing argument 'pos' for E2Detector '" + id + "'. Assuming detector start == lane start of lane '" + clanes[0]->getID() + "'."); + } + if (!endPosGiven) { + // assuming end pos == lane end + endPosition = clanes[clanes.size() - 1]->getLength(); + WRITE_WARNING("Missing argument 'endPos' for E2Detector '" + id + "'. Assuming detector end == lane end of lane '" + clanes[clanes.size() - 1]->getID() + "'."); + } + + } else { + if (!laneGiven) { + std::stringstream ss; + ss << "Missing argument 'lane' for E2Detector '" << id << "'." + << "\nUsage combinations for positional specification: [lane, pos, length], [lane, endPos, length], or [lanes, pos, endPos]"; + throw InvalidArgument(ss.str()); + } + clane = myDetectorBuilder.getLaneChecking(lane, SUMO_TAG_E2DETECTOR, id); + + if (posGiven) { + // start pos is given + if (endPosGiven && lengthGiven) { + std::stringstream ss; + ss << "Ignoring argument 'endPos' for E2Detector '" << id << "' since argument 'pos' was given." + << "\nUsage combinations for positional specification: [lane, pos, length], [lane, endPos, length], or [lanes, pos, endPos]"; + WRITE_WARNING(ss.str()); + endPosition = std::numeric_limits::max(); + } + if (!lengthGiven && !endPosGiven) { + std::stringstream ss; + ss << "Missing arguments 'length'/'endPos' for E2Detector '" << id << "'. Assuming detector end == lane end of lane '" << lane << "'."; + WRITE_WARNING(ss.str()); + endPosition = clane->getLength(); + } + } else if (endPosGiven) { + // endPos is given, pos is not given + if (!lengthGiven) { + std::stringstream ss; + ss << "Missing arguments 'length'/'pos' for E2Detector '" << id << "'. Assuming detector start == lane start of lane '" << lane << "'."; + WRITE_WARNING(ss.str()); } } else { - bool ok = true; - SUMOTime frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), ok); - if (!ok) { - return; + std::stringstream ss; + if (lengthGiven && fabs(length - clane->getLength()) > NUMERICAL_EPS) { + ss << "Incomplete positional specification for E2Detector '" << id << "'." + << "\nUsage combinations for positional specification: [lane, pos, length], [lane, endPos, length], or [lanes, pos, endPos]"; + throw InvalidArgument(ss.str()); } - myDetectorBuilder.buildE2Detector(id, lane, position, length, cont, frequency, - FileHelpers::checkForRelativity(file, getFileName()), - haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, - friendlyPos, vTypes); + endPosition = clane->getLength(); + position = 0; + ss << "Missing arguments 'pos'/'endPos' for E2Detector '" << id << "'. Assuming that the detector covers the whole lane '" << lane << "'."; + WRITE_WARNING(ss.str()); } - } catch (InvalidArgument& e) { - WRITE_ERROR(e.what()); + } + + // Frequency + + SUMOTime frequency; + if (!lsaGiven) { + frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), ok); + if (!ok) { + return; + } + } else { + frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), ok, false); + } + + // TLS + MSTLLogicControl::TLSLogicVariants* tlls = 0; + if (lsaGiven) { + tlls = &myJunctionControlBuilder.getTLLogic(lsaid); + if (tlls->getActive() == 0) { + throw InvalidArgument("The detector '" + id + "' refers to an unknown lsa '" + lsaid + "'."); + } + if (frequency != -1) { + WRITE_WARNING("Ignoring argument 'frequency' for E2Detector '" + id + "' since argument 'tl' was given."); + frequency = -1; + } + } + + // Link + MSLane* cToLane = 0; + if (toLaneGiven) { + cToLane = myDetectorBuilder.getLaneChecking(toLane, SUMO_TAG_E2DETECTOR, id); + } + + // File + std::string filename; + try { + filename = FileHelpers::checkForRelativity(file, getFileName()); } catch (IOError& e) { WRITE_ERROR(e.what()); } + + // Build detector + if (lanesGiven) { + // specification by a lane sequence + myDetectorBuilder.buildE2Detector(id, clanes, position, endPosition, filename, frequency, + haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, + vTypes, friendlyPos, showDetector, + tlls, cToLane); + } else { + // specification by start or end lane + myDetectorBuilder.buildE2Detector(id, clane, position, endPosition, length, filename, frequency, + haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, + vTypes, friendlyPos, showDetector, + tlls, cToLane); + } + } @@ -919,7 +1064,7 @@ std::string id = attrs.get(SUMO_ATTR_ID, 0, ok); const SUMOTime frequency = attrs.getSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), ok); const SUMOTime haltingTimeThreshold = attrs.getOptSUMOTimeReporting(SUMO_ATTR_HALTING_TIME_THRESHOLD, id.c_str(), ok, TIME2STEPS(1)); - const SUMOReal haltingSpeedThreshold = attrs.getOpt(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), ok, 5.0f / 3.6f); + const double haltingSpeedThreshold = attrs.getOpt(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), ok, 5.0f / 3.6f); const std::string file = attrs.get(SUMO_ATTR_FILE, id.c_str(), ok); const std::string vTypes = attrs.getOpt(SUMO_ATTR_VTYPES, id.c_str(), ok, ""); if (!ok) { @@ -940,7 +1085,7 @@ void NLHandler::addE3Entry(const SUMOSAXAttributes& attrs) { bool ok = true; - const SUMOReal position = attrs.get(SUMO_ATTR_POSITION, myDetectorBuilder.getCurrentE3ID().c_str(), ok); + const double position = attrs.get(SUMO_ATTR_POSITION, myDetectorBuilder.getCurrentE3ID().c_str(), ok); const bool friendlyPos = attrs.getOpt(SUMO_ATTR_FRIENDLY_POS, myDetectorBuilder.getCurrentE3ID().c_str(), ok, false); const std::string lane = attrs.get(SUMO_ATTR_LANE, myDetectorBuilder.getCurrentE3ID().c_str(), ok); if (!ok) { @@ -953,7 +1098,7 @@ void NLHandler::addE3Exit(const SUMOSAXAttributes& attrs) { bool ok = true; - const SUMOReal position = attrs.get(SUMO_ATTR_POSITION, myDetectorBuilder.getCurrentE3ID().c_str(), ok); + const double position = attrs.get(SUMO_ATTR_POSITION, myDetectorBuilder.getCurrentE3ID().c_str(), ok); const bool friendlyPos = attrs.getOpt(SUMO_ATTR_FRIENDLY_POS, myDetectorBuilder.getCurrentE3ID().c_str(), ok, false); const std::string lane = attrs.get(SUMO_ATTR_LANE, myDetectorBuilder.getCurrentE3ID().c_str(), ok); if (!ok) { @@ -967,9 +1112,9 @@ NLHandler::addEdgeLaneMeanData(const SUMOSAXAttributes& attrs, int objecttype) { bool ok = true; std::string id = attrs.get(SUMO_ATTR_ID, 0, ok); - const SUMOReal maxTravelTime = attrs.getOpt(SUMO_ATTR_MAX_TRAVELTIME, id.c_str(), ok, 100000); - const SUMOReal minSamples = attrs.getOpt(SUMO_ATTR_MIN_SAMPLES, id.c_str(), ok, 0); - const SUMOReal haltingSpeedThreshold = attrs.getOpt(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), ok, POSITION_EPS); + const double maxTravelTime = attrs.getOpt(SUMO_ATTR_MAX_TRAVELTIME, id.c_str(), ok, 100000); + const double minSamples = attrs.getOpt(SUMO_ATTR_MIN_SAMPLES, id.c_str(), ok, 0); + const double haltingSpeedThreshold = attrs.getOpt(SUMO_ATTR_HALTING_SPEED_THRESHOLD, id.c_str(), ok, POSITION_EPS); const std::string excludeEmpty = attrs.getOpt(SUMO_ATTR_EXCLUDE_EMPTY, id.c_str(), ok, "false"); const bool withInternal = attrs.getOpt(SUMO_ATTR_WITH_INTERNAL, id.c_str(), ok, false); const bool trackVehicles = attrs.getOpt(SUMO_ATTR_TRACK_VEHICLES, id.c_str(), ok, false); @@ -1011,15 +1156,13 @@ bool ok = true; const std::string toID = attrs.get(SUMO_ATTR_TO, 0, ok); const int fromLaneIdx = attrs.get(SUMO_ATTR_FROM_LANE, 0, ok); - const SUMOReal foeVisibilityDistance = attrs.getOpt(SUMO_ATTR_VISIBILITY_DISTANCE, 0, ok, 4.5); + const double foeVisibilityDistance = attrs.getOpt(SUMO_ATTR_VISIBILITY_DISTANCE, 0, ok, 4.5); const int toLaneIdx = attrs.get(SUMO_ATTR_TO_LANE, 0, ok); LinkDirection dir = parseLinkDir(attrs.get(SUMO_ATTR_DIR, 0, ok)); LinkState state = parseLinkState(attrs.get(SUMO_ATTR_STATE, 0, ok)); bool keepClear = attrs.getOpt(SUMO_ATTR_KEEP_CLEAR, 0, ok, true); std::string tlID = attrs.getOpt(SUMO_ATTR_TLID, 0, ok, ""); -#ifdef HAVE_INTERNAL_LANES std::string viaID = attrs.getOpt(SUMO_ATTR_VIA, 0, ok, ""); -#endif MSEdge* from = MSEdge::dictionary(fromID); if (from == 0) { @@ -1058,10 +1201,9 @@ return; } } - SUMOReal length = fromLane->getShape()[-1].distanceTo(toLane->getShape()[0]); + double length = fromLane->getShape()[-1].distanceTo(toLane->getShape()[0]); // build the link -#ifdef HAVE_INTERNAL_LANES MSLane* via = 0; if (viaID != "" && MSGlobals::gUsingInternalLanes) { via = MSLane::dictionary(viaID); @@ -1078,10 +1220,6 @@ } else { toLane->addIncomingLane(fromLane, link); } -#else - link = new MSLink(fromLane, toLane, dir, state, length, foeVisibilityDistance, keepClear, logic, tlLinkIdx); - toLane->addIncomingLane(fromLane, link); -#endif toLane->addApproachingLane(fromLane, myNetworkVersion < 0.25); // if a traffic light is responsible for it, inform the traffic light @@ -1262,7 +1400,7 @@ Position -NLShapeHandler::getLanePos(const std::string& poiID, const std::string& laneID, SUMOReal lanePos) { +NLShapeHandler::getLanePos(const std::string& poiID, const std::string& laneID, double lanePos) { MSLane* lane = MSLane::dictionary(laneID); if (lane == 0) { WRITE_ERROR("Lane '" + laneID + "' to place poi '" + poiID + "' on is not known."); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Clemens Honomichl /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: NLHandler.h 20743 2016-05-18 15:14:24Z behrisch $ +/// @version $Id: NLHandler.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The XML-Handler for network loading /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -69,7 +69,7 @@ /// @brief Destructor virtual ~NLShapeHandler() {} - Position getLanePos(const std::string& poiID, const std::string& laneID, SUMOReal lanePos); + Position getLanePos(const std::string& poiID, const std::string& laneID, double lanePos); }; @@ -113,11 +113,15 @@ return myHaveSeenNeighs; } + bool haveSeenAdditionalSpeedRestrictions() const { + return myHaveSeenAdditionalSpeedRestrictions; + } + bool lefthand() const { return myLefthand; } - SUMOReal networkVersion() const { + double networkVersion() const { return myNetworkVersion; } @@ -339,11 +343,14 @@ /// @brief whether the loaded network contains explicit neighbor lanes bool myHaveSeenNeighs; + /// @brief whether additional files contained type-specific speed limits + bool myHaveSeenAdditionalSpeedRestrictions; + /// @brief whether the loaded network was built for left hand traffic bool myLefthand; /// @brief the loaded network version - SUMOReal myNetworkVersion; + double myNetworkVersion; /// @brief whether the location element was already loadee bool myNetIsLoaded; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLJunctionControlBuilder.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLJunctionControlBuilder.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLJunctionControlBuilder.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLJunctionControlBuilder.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Mon, 9 Jul 2001 -/// @version $Id: NLJunctionControlBuilder.cpp 21480 2016-09-15 08:49:36Z namdre $ +/// @version $Id: NLJunctionControlBuilder.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Builder of microsim-junctions and tls /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -66,10 +67,6 @@ #include "NLBuilder.h" #include "NLJunctionControlBuilder.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members @@ -100,15 +97,11 @@ NLJunctionControlBuilder::openJunction(const std::string& id, const std::string& key, const SumoXMLNodeType type, - SUMOReal x, SUMOReal y, + double x, double y, const PositionVector& shape, const std::vector& incomingLanes, const std::vector& internalLanes) { -#ifdef HAVE_INTERNAL_LANES myActiveInternalLanes = internalLanes; -#else - UNUSED_PARAMETER(internalLanes); -#endif myActiveIncomingLanes = incomingLanes; myActiveID = id; myActiveKey = key; @@ -142,11 +135,9 @@ junction = buildLogicJunction(); break; case NODETYPE_INTERNAL: -#ifdef HAVE_INTERNAL_LANES if (MSGlobals::gUsingInternalLanes) { junction = buildInternalJunction(); } -#endif break; case NODETYPE_RAIL_SIGNAL: case NODETYPE_RAIL_CROSSING: @@ -178,11 +169,8 @@ MSJunction* NLJunctionControlBuilder::buildNoLogicJunction() { - return new MSNoLogicJunction(myActiveID, myType, myPosition, myShape, myActiveIncomingLanes -#ifdef HAVE_INTERNAL_LANES - , myActiveInternalLanes -#endif - ); + return new MSNoLogicJunction(myActiveID, myType, myPosition, myShape, + myActiveIncomingLanes, myActiveInternalLanes); } @@ -191,21 +179,17 @@ MSJunctionLogic* jtype = getJunctionLogicSecure(); // build the junction return new MSRightOfWayJunction(myActiveID, myType, myPosition, myShape, myActiveIncomingLanes, -#ifdef HAVE_INTERNAL_LANES myActiveInternalLanes, -#endif jtype); } -#ifdef HAVE_INTERNAL_LANES MSJunction* NLJunctionControlBuilder::buildInternalJunction() { // build the junction return new MSInternalJunction(myActiveID, myType, myPosition, myShape, myActiveIncomingLanes, myActiveInternalLanes); } -#endif MSJunctionLogic* @@ -309,7 +293,12 @@ myActivePhases, step, (*i)->minDuration + myNet.getCurrentTimeStep(), myAdditionalParameter, basePath); break; - case TLTYPE_DELAYBASED: // placeholder for future development + case TLTYPE_DELAYBASED: + tlLogic = new MSDelayBasedTrafficLightLogic(getTLLogicControlToUse(), + myActiveKey, myActiveProgram, + myActivePhases, step, (*i)->minDuration + myNet.getCurrentTimeStep(), + myAdditionalParameter, basePath); + break; case TLTYPE_STATIC: tlLogic = new MSSimpleTrafficLightLogic(getTLLogicControlToUse(), diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLJunctionControlBuilder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLJunctionControlBuilder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLJunctionControlBuilder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLJunctionControlBuilder.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 9 Jul 2001 -/// @version $Id: NLJunctionControlBuilder.h 21201 2016-07-19 11:57:22Z behrisch $ +/// @version $Id: NLJunctionControlBuilder.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Builder of microsim-junctions and tls /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -105,7 +105,7 @@ * @todo Check why "key" is given */ void openJunction(const std::string& id, const std::string& key, - const SumoXMLNodeType type, SUMOReal x, SUMOReal y, + const SumoXMLNodeType type, double x, double y, const PositionVector& shape, const std::vector& incomingLanes, const std::vector& internalLanes); @@ -333,7 +333,6 @@ virtual MSJunction* buildLogicJunction(); -#ifdef HAVE_INTERNAL_LANES /** @brief Builds an internal junction * * Builds a MSInternalJunction @@ -341,7 +340,6 @@ * @return The built junction */ virtual MSJunction* buildInternalJunction(); -#endif /// @} @@ -382,10 +380,8 @@ /// @brief The list of the incoming lanes of the currently chosen junction LaneVector myActiveIncomingLanes; -#ifdef HAVE_INTERNAL_LANES /// @brief The list of the internal lanes of the currently chosen junction LaneVector myActiveInternalLanes; -#endif /// @brief The id of the currently chosen junction std::string myActiveID; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLTriggerBuilder.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLTriggerBuilder.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLTriggerBuilder.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLTriggerBuilder.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Thu, 17 Oct 2002 -/// @version $Id: NLTriggerBuilder.cpp 20687 2016-05-10 11:27:00Z behrisch $ +/// @version $Id: NLTriggerBuilder.cpp 24010 2017-04-21 17:00:09Z behrisch $ /// // Builds trigger objects for microsim /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -59,16 +59,12 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== NLTriggerBuilder::NLTriggerBuilder() - : myHandler(0) {} + : myHandler(0), myParkingArea(0) {} NLTriggerBuilder::~NLTriggerBuilder() {} @@ -107,9 +103,9 @@ } if (end >= string2time(OptionsCont::getOptions().getString("begin"))) { Command* cb = new WrappingCommand< MSEdge >(e, &MSEdge::incVaporization); - MSNet::getInstance()->getBeginOfTimestepEvents()->addEvent(cb, begin, MSEventControl::ADAPT_AFTER_EXECUTION); + MSNet::getInstance()->getBeginOfTimestepEvents()->addEvent(cb, begin); Command* ce = new WrappingCommand< MSEdge >(e, &MSEdge::decVaporization); - MSNet::getInstance()->getBeginOfTimestepEvents()->addEvent(ce, end, MSEventControl::ADAPT_AFTER_EXECUTION); + MSNet::getInstance()->getBeginOfTimestepEvents()->addEvent(ce, end); } } @@ -169,10 +165,10 @@ MSLane* lane = getLane(attrs, "chargingStation", id); // get the positions - SUMOReal frompos = attrs.getOpt(SUMO_ATTR_STARTPOS, id.c_str(), ok, 0); - SUMOReal topos = attrs.getOpt(SUMO_ATTR_ENDPOS, id.c_str(), ok, lane->getLength()); - SUMOReal chargingPower = attrs.getOpt(SUMO_ATTR_CHARGINGPOWER, id.c_str(), ok, 0); - SUMOReal efficiency = attrs.getOpt(SUMO_ATTR_EFFICIENCY, id.c_str(), ok, 0); + double frompos = attrs.getOpt(SUMO_ATTR_STARTPOS, id.c_str(), ok, 0); + double topos = attrs.getOpt(SUMO_ATTR_ENDPOS, id.c_str(), ok, lane->getLength()); + double chargingPower = attrs.getOpt(SUMO_ATTR_CHARGINGPOWER, id.c_str(), ok, 0); + double efficiency = attrs.getOpt(SUMO_ATTR_EFFICIENCY, id.c_str(), ok, 0); bool chargeInTransit = attrs.getOpt(SUMO_ATTR_CHARGEINTRANSIT, id.c_str(), ok, 0); int ChargeDelay = attrs.getOpt(SUMO_ATTR_CHARGEDELAY, id.c_str(), ok, 0); @@ -195,11 +191,15 @@ if (!ok) { throw ProcessError(); } + + //get the name, leave blank if not given + const std::string ptStopName = attrs.getOpt(SUMO_ATTR_NAME, id.c_str(), ok, ""); + // get the lane MSLane* lane = getLane(attrs, toString(element), id); // get the positions - SUMOReal frompos = attrs.getOpt(SUMO_ATTR_STARTPOS, id.c_str(), ok, 0); - SUMOReal topos = attrs.getOpt(SUMO_ATTR_ENDPOS, id.c_str(), ok, lane->getLength()); + double frompos = attrs.getOpt(SUMO_ATTR_STARTPOS, id.c_str(), ok, 0); + double topos = attrs.getOpt(SUMO_ATTR_ENDPOS, id.c_str(), ok, lane->getLength()); const bool friendlyPos = attrs.getOpt(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false); if (!ok || !myHandler->checkStopPos(frompos, topos, lane->getLength(), POSITION_EPS, friendlyPos)) { throw InvalidArgument("Invalid position for " + toString(element) + " '" + id + "'."); @@ -208,7 +208,7 @@ std::vector lines; SUMOSAXAttributes::parseStringVector(attrs.getOpt(SUMO_ATTR_LINES, id.c_str(), ok, "", false), lines); // build the bus stop - buildStoppingPlace(net, id, lines, lane, frompos, topos, element); + buildStoppingPlace(net, id, lines, lane, frompos, topos, element, ptStopName); } @@ -218,7 +218,7 @@ MSLane* lane = getLane(attrs, "access" , ""); // get the positions bool ok = true; - SUMOReal pos = attrs.getOpt(SUMO_ATTR_POSITION, "access", ok, 0); + double pos = attrs.getOpt(SUMO_ATTR_POSITION, "access", ok, 0); const bool friendlyPos = attrs.getOpt(SUMO_ATTR_FRIENDLY_POS, "access", ok, false); if (!ok || !myHandler->checkStopPos(pos, pos, lane->getLength(), 0, friendlyPos)) { throw InvalidArgument("Invalid position for access in stop '" + myCurrentStop->getID() + "'."); @@ -229,6 +229,61 @@ void +NLTriggerBuilder::parseAndBeginParkingArea(MSNet& net, const SUMOSAXAttributes& attrs) { + bool ok = true; + // get the id, throw if not given or empty... + std::string id = attrs.get(SUMO_ATTR_ID, 0, ok); + if (!ok) { + throw ProcessError(); + } + // get the lane + MSLane* lane = getLane(attrs, "parkingArea", id); + // get the positions + double frompos = attrs.getOpt(SUMO_ATTR_STARTPOS, id.c_str(), ok, 0); + double topos = attrs.getOpt(SUMO_ATTR_ENDPOS, id.c_str(), ok, lane->getLength()); + const bool friendlyPos = attrs.getOpt(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false); + unsigned int capacity = attrs.getOpt(SUMO_ATTR_ROADSIDE_CAPACITY, id.c_str(), ok, 0); + double width = attrs.getOpt(SUMO_ATTR_WIDTH, id.c_str(), ok, 0); + double length = attrs.getOpt(SUMO_ATTR_LENGTH, id.c_str(), ok, 0); + double angle = attrs.getOpt(SUMO_ATTR_ANGLE, id.c_str(), ok, 0); + if (!ok || !myHandler->checkStopPos(frompos, topos, lane->getLength(), POSITION_EPS, friendlyPos)) { + throw InvalidArgument("Invalid position for parking area '" + id + "'."); + } + // get the lines + std::vector lines; + SUMOSAXAttributes::parseStringVector(attrs.getOpt(SUMO_ATTR_LINES, id.c_str(), ok, "", false), lines); + // build the parking area + beginParkingArea(net, id, lines, lane, frompos, topos, capacity, width, length, angle); +} + + + +void +NLTriggerBuilder::parseAndAddLotEntry(const SUMOSAXAttributes& attrs) { + bool ok = true; + // Check for open parking area + if (myParkingArea == 0) { + throw ProcessError(); + } + // get the positions + double x = attrs.get(SUMO_ATTR_X, "", ok); + if (!ok) { + throw InvalidArgument("Invalid x position for lot entry."); + } + double y = attrs.get(SUMO_ATTR_Y, "", ok); + if (!ok) { + throw InvalidArgument("Invalid y position for lot entry."); + } + double z = attrs.getOpt(SUMO_ATTR_Z, "", ok, 0.); + double width = attrs.getOpt(SUMO_ATTR_WIDTH, "", ok, myParkingArea->getWidth()); + double length = attrs.getOpt(SUMO_ATTR_LENGTH, "", ok, myParkingArea->getLength()); + double angle = attrs.getOpt(SUMO_ATTR_ANGLE, "", ok, myParkingArea->getAngle()); + // add the lot entry + addLotEntry(x, y, z, width, length, angle); +} + + +void NLTriggerBuilder::parseAndBuildCalibrator(MSNet& net, const SUMOSAXAttributes& attrs, const std::string& base) { bool ok = true; @@ -239,7 +294,7 @@ } // get the file name to read further definitions from MSLane* lane = getLane(attrs, "calibrator", id); - const SUMOReal pos = getPosition(attrs, lane, "calibrator", id); + const double pos = getPosition(attrs, lane, "calibrator", id); const SUMOTime freq = attrs.getOptSUMOTimeReporting(SUMO_ATTR_FREQUENCY, id.c_str(), ok, DELTA_T); // !!! no error handling std::string file = getFileName(attrs, base, true); std::string outfile = attrs.getOpt(SUMO_ATTR_OUTPUT, id.c_str(), ok, ""); @@ -290,7 +345,7 @@ if (edges.size() == 0) { throw InvalidArgument("No edges found for MSTriggeredRerouter '" + id + "'."); } - SUMOReal prob = attrs.getOpt(SUMO_ATTR_PROB, id.c_str(), ok, 1); + double prob = attrs.getOpt(SUMO_ATTR_PROB, id.c_str(), ok, 1); bool off = attrs.getOpt(SUMO_ATTR_OFF, id.c_str(), ok, false); if (!ok) { throw InvalidArgument("Could not parse MSTriggeredRerouter '" + id + "'."); @@ -318,7 +373,7 @@ METriggeredCalibrator* NLTriggerBuilder::buildMECalibrator(MSNet& /*net*/, const std::string& id, - const MSEdge* edge, SUMOReal pos, + const MSEdge* edge, double pos, const std::string& file, const std::string& outfile, const SUMOTime freq, MSRouteProbe* probe) { @@ -328,7 +383,7 @@ MSCalibrator* NLTriggerBuilder::buildCalibrator(MSNet& /*net*/, const std::string& id, - MSEdge* edge, SUMOReal pos, + MSEdge* edge, double pos, const std::string& file, const std::string& outfile, const SUMOTime freq, const MSRouteProbe* probe) { @@ -339,16 +394,15 @@ MSTriggeredRerouter* NLTriggerBuilder::buildRerouter(MSNet&, const std::string& id, MSEdgeVector& edges, - SUMOReal prob, const std::string& file, bool off) { + double prob, const std::string& file, bool off) { return new MSTriggeredRerouter(id, edges, prob, file, off); } void -NLTriggerBuilder::buildStoppingPlace(MSNet& net, const std::string& id, - const std::vector& lines, - MSLane* lane, SUMOReal frompos, SUMOReal topos, const SumoXMLTag element) { - myCurrentStop = new MSStoppingPlace(id, lines, *lane, frompos, topos); +NLTriggerBuilder::buildStoppingPlace(MSNet& net, std::string id, std::vector lines, MSLane* lane, + double frompos, double topos, const SumoXMLTag element, std::string ptStopName) { + myCurrentStop = new MSStoppingPlace(id, lines, *lane, frompos, topos, ptStopName); const bool success = element == SUMO_TAG_CONTAINER_STOP ? net.addContainerStop(myCurrentStop) : net.addBusStop(myCurrentStop); if (!success) { delete myCurrentStop; @@ -358,8 +412,47 @@ void -NLTriggerBuilder::buildChargingStation(MSNet& net, const std::string& id, MSLane* lane, SUMOReal frompos, SUMOReal topos, - SUMOReal chargingPower, SUMOReal efficiency, bool chargeInTransit, int ChargeDelay) { +NLTriggerBuilder::beginParkingArea(MSNet& net, const std::string& id, + const std::vector& lines, + MSLane* lane, double frompos, double topos, + unsigned int capacity, + double width, double length, double angle) { + // Close previous parking area if there are not lots inside + + MSParkingArea* stop = new MSParkingArea(id, lines, *lane, frompos, topos, capacity, width, length, angle); + if (!net.addParkingArea(stop)) { + delete stop; + throw InvalidArgument("Could not build parking area '" + id + "'; probably declared twice."); + } else { + myParkingArea = stop; + } +} + + +void +NLTriggerBuilder::addLotEntry(double x, double y, double z, + double width, double length, double angle) { + if (myParkingArea != 0) { + myParkingArea->addLotEntry(x, y, z, width, length, angle); + } else { + throw InvalidArgument("Could not add lot entry outside a parking area."); + } +} + + +void +NLTriggerBuilder::endParkingArea() { + if (myParkingArea != 0) { + myParkingArea = 0; + } else { + throw InvalidArgument("Could not end a parking area that is not opened."); + } +} + + +void +NLTriggerBuilder::buildChargingStation(MSNet& net, const std::string& id, MSLane* lane, double frompos, double topos, + double chargingPower, double efficiency, bool chargeInTransit, int ChargeDelay) { MSChargingStation* chargingStation = new MSChargingStation(id, *lane, frompos, topos, chargingPower, efficiency, chargeInTransit, ChargeDelay); if (!net.addChargingStation(chargingStation)) { @@ -403,12 +496,12 @@ } -SUMOReal +double NLTriggerBuilder::getPosition(const SUMOSAXAttributes& attrs, MSLane* lane, const std::string& tt, const std::string& tid) { bool ok = true; - SUMOReal pos = attrs.get(SUMO_ATTR_POSITION, 0, ok); + double pos = attrs.get(SUMO_ATTR_POSITION, 0, ok); const bool friendlyPos = attrs.getOpt(SUMO_ATTR_FRIENDLY_POS, 0, ok, false); if (!ok) { throw InvalidArgument("Error on parsing a position information."); @@ -418,7 +511,7 @@ } if (pos > lane->getLength()) { if (friendlyPos) { - pos = lane->getLength() - (SUMOReal) 0.1; + pos = lane->getLength() - (double) 0.1; } else { throw InvalidArgument("The position of " + tt + " '" + tid + "' lies beyond the lane's '" + lane->getID() + "' length."); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLTriggerBuilder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLTriggerBuilder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netload/NLTriggerBuilder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netload/NLTriggerBuilder.h 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Thu, 17 Oct 2002 -/// @version $Id: NLTriggerBuilder.h 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: NLTriggerBuilder.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Builds trigger objects for microsim /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -140,6 +140,46 @@ void parseAndBuildStoppingPlace(MSNet& net, const SUMOSAXAttributes& attrs, const SumoXMLTag element); + /** @brief Begin a parking area + * + * Simply calls the MSParkingArea constructor. + * + * @param[in] net The net the parking area belongs to + * @param[in] id The id of the parking area + * @param[in] lines Names of the lines that halt on this parking area + * @param[in] lane The lane the parking area is placed on + * @param[in] frompos Begin position of the parking area on the lane + * @param[in] topos End position of the parking area on the lane + * @param[in] capacity Capacity of the parking area + * @param[in] width Width of the default lot rectangle + * @param[in] length Length of the default lot rectangle + * @param[in] angle Angle of the default lot rectangle + * @exception InvalidArgument If the parking area can not be added to the net (is duplicate) + */ + virtual void beginParkingArea(MSNet& net, + const std::string& id, const std::vector& lines, + MSLane* lane, double frompos, double topos, + unsigned int capacity, + double width, double length, double angle); + + + /** @brief Add a lot entry to current parking area + * + * Simply calls the addLotEntry method for current parking area. + * + * @param[in] x X position of the lot center + * @param[in] y Y position of the lot center + * @param[in] z Z position of the lot center + * @param[in] width Width of the lot rectangle + * @param[in] length Length of the lot rectangle + * @param[in] angle Angle of the lot rectangle + * @exception InvalidArgument If the current parking area is 0 + */ + void addLotEntry(double x, double y, double z, + double width, double length, double angle); + + + /** @brief Parses the values and adds an access point to the currently parsed stopping place * * @param[in] net The network the stop belongs to @@ -149,6 +189,29 @@ void addAccess(MSNet& net, const SUMOSAXAttributes& attrs); + /** @brief Parses his values and builds a parking area + * + * @param[in] net The network the parking area belongs to + * @param[in] attrs SAX-attributes which define the trigger + * @exception InvalidArgument If a parameter (lane/position) is not valid + */ + void parseAndBeginParkingArea(MSNet& net, const SUMOSAXAttributes& attrs); + + + /** @brief Parses his values and adds a lot entry to current parking area + * + * @param[in] attrs SAX-attributes which define the lot entry + */ + void parseAndAddLotEntry(const SUMOSAXAttributes& attrs); + + + /** @brief End a parking area + * + * @exception InvalidArgument If the current parking area is 0 + */ + void endParkingArea(); + + /** @brief Parses his values and builds a charging station * * @param[in] net The network the charging station belongs to @@ -168,7 +231,6 @@ const std::string& base); //@} - protected: /// @name building methods /// @@ -209,8 +271,8 @@ * @param[in] element which kind of stop is to be built * @exception InvalidArgument If the stop can not be added to the net (is duplicate) */ - virtual void buildStoppingPlace(MSNet& net, const std::string& id, const std::vector& lines, - MSLane* lane, SUMOReal frompos, SUMOReal topos, const SumoXMLTag element); + virtual void buildStoppingPlace(MSNet& net, std::string id, std::vector lines, MSLane* lane, + double frompos, double topos, const SumoXMLTag element, std::string string); /** @brief Builds a charging Station * @@ -227,8 +289,8 @@ * @param[in] ChargeDelay * @exception InvalidArgument If the charging Station can not be added to the net (is duplicate) */ - virtual void buildChargingStation(MSNet& net, const std::string& id, MSLane* lane, SUMOReal frompos, SUMOReal topos, - SUMOReal chargingPower, SUMOReal efficiency, bool chargeInTransit, int ChargeDelay); + virtual void buildChargingStation(MSNet& net, const std::string& id, MSLane* lane, double frompos, double topos, + double chargingPower, double efficiency, bool chargeInTransit, int ChargeDelay); /** @brief builds a microscopic calibrator * @@ -242,7 +304,7 @@ * @todo Is the position correct/needed */ virtual MSCalibrator* buildCalibrator(MSNet& net, - const std::string& id, MSEdge* edge, SUMOReal pos, + const std::string& id, MSEdge* edge, double pos, const std::string& file, const std::string& outfile, const SUMOTime freq, const MSRouteProbe* probe); @@ -258,7 +320,7 @@ * @todo Is the position correct/needed */ virtual METriggeredCalibrator* buildMECalibrator(MSNet& net, - const std::string& id, const MSEdge* edge, SUMOReal pos, + const std::string& id, const MSEdge* edge, double pos, const std::string& file, const std::string& outfile, const SUMOTime freq, MSRouteProbe* probe); @@ -275,7 +337,7 @@ */ virtual MSTriggeredRerouter* buildRerouter(MSNet& net, const std::string& id, MSEdgeVector& edges, - SUMOReal prob, const std::string& file, bool off); + double prob, const std::string& file, bool off); //@} @@ -327,15 +389,16 @@ * @return The position on the lane * @exception InvalidArgument If the position is beyond the lane */ - SUMOReal getPosition(const SUMOSAXAttributes& attrs, - MSLane* lane, const std::string& tt, const std::string& tid); + double getPosition(const SUMOSAXAttributes& attrs, + MSLane* lane, const std::string& tt, const std::string& tid); /// @} protected: /// @brief The parent handler to set for subhandlers NLHandler* myHandler; - + /// @brief definition of the currently parsed parking area + MSParkingArea* myParkingArea; /// @brief The currently parsed stop to add access points to MSStoppingPlace* myCurrentStop; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWFrame.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: NWFrame.cpp 21569 2016-09-29 07:09:35Z namdre $ +/// @version $Id: NWFrame.cpp 23611 2017-03-22 11:45:08Z laemmel $ /// // Sets and checks options for netwrite /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,14 +46,10 @@ #include "NWWriter_OpenDrive.h" #include "NWWriter_DlrNavteq.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members // =========================================================================== -const std::string NWFrame::MAJOR_VERSION = "version=\"0.27\""; +const std::string NWFrame::MAJOR_VERSION = "0.27"; // =========================================================================== @@ -96,6 +92,9 @@ oc.doRegister("dlr-navteq-output", new Option_FileName()); oc.addDescription("dlr-navteq-output", "Output", "The generated net will be written to dlr-navteq files with the given PREFIX"); + oc.doRegister("dlr-navteq.precision", new Option_Integer(2)); + oc.addDescription("dlr-navteq.precision", "Output", "The network coordinates are written with the specified level of output precision"); + oc.doRegister("output.street-names", new Option_Bool(false)); oc.addDescription("output.street-names", "Output", "Street names will be included in the output (if available)"); @@ -104,6 +103,15 @@ oc.doRegister("street-sign-output", new Option_FileName()); oc.addDescription("street-sign-output", "Output", "Writes street signs as POIs to FILE"); + + if (!forNetgen) { + oc.doRegister("ptstop-output", new Option_FileName()); + oc.addDescription("ptstop-output", "Output", "Writes public transport stops to FILE"); + } + + // register opendrive options + oc.doRegister("opendrive-output.straight-threshold", new Option_Float(0.00000001)); // matching the angular output precision in NWWriter_OpenDrive + oc.addDescription("opendrive-output.straight-threshold", "Output", "Builds parameterized curves whenever the angular change between straight segments exceeds FLOAT degrees"); } @@ -135,6 +143,9 @@ if (oc.isSet("opendrive-output") && !oc.getBool("rectangular-lane-cut")) { WRITE_WARNING("OpenDRIVE cannot represent oblique lane cuts and should use option 'rectangular-lane-cut'."); } + if (oc.isSet("dlr-navteq-output") && oc.isDefault("numerical-ids")) { + oc.set("numerical-ids", "true"); + } return ok; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWFrame.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: NWFrame.h 20975 2016-06-15 13:02:40Z palcraft $ +/// @version $Id: NWFrame.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Sets and checks options for netwrite /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_Amitran.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_Amitran.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_Amitran.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_Amitran.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NWWriter_Amitran.cpp /// @author Michael Behrisch /// @date 13.03.2014 -/// @version $Id: NWWriter_Amitran.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NWWriter_Amitran.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Exporter writing networks using the Amitran format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,6 @@ #include "NWWriter_DlrNavteq.h" #include "NWWriter_Amitran.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_Amitran.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_Amitran.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_Amitran.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_Amitran.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NWWriter_Amitran.h /// @author Michael Behrisch /// @date 13.03.2014 -/// @version $Id: NWWriter_Amitran.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NWWriter_Amitran.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Exporter writing networks using the Amitran format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_DlrNavteq.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_DlrNavteq.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_DlrNavteq.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_DlrNavteq.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 26.10.2012 -/// @version $Id: NWWriter_DlrNavteq.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NWWriter_DlrNavteq.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Exporter writing networks using DlrNavteq (Elmar) format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,15 +40,14 @@ #include #include #include +#include #include #include #include #include "NWFrame.h" #include "NWWriter_DlrNavteq.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS +#define OUTPUT_VERSION "6.5" // --------------------------------------------------------------------------- @@ -65,9 +64,12 @@ if (!oc.isSet("dlr-navteq-output")) { return; } - writeNodesUnsplitted(oc, nb.getNodeCont(), nb.getEdgeCont()); - writeLinksUnsplitted(oc, nb.getEdgeCont()); + std::map internalNodes; + writeNodesUnsplitted(oc, nb.getNodeCont(), nb.getEdgeCont(), internalNodes); + writeLinksUnsplitted(oc, nb.getEdgeCont(), internalNodes); writeTrafficSignals(oc, nb.getNodeCont()); + writeProhibitedManoeuvres(oc, nb.getNodeCont(), nb.getEdgeCont()); + writeConnectedLanes(oc, nb.getNodeCont()); } @@ -77,7 +79,7 @@ char buffer [80]; strftime(buffer, 80, "on %c", localtime(&rawtime)); device << "# Generated " << buffer << " by " << oc.getFullName() << "\n"; - device << "# Format matches Extraction version: V6.0 \n"; + device << "# Format matches Extraction version: V" << OUTPUT_VERSION << " \n"; std::stringstream tmp; oc.writeConfiguration(tmp, true, false, false); tmp.seekg(std::ios_base::beg); @@ -90,23 +92,46 @@ } void -NWWriter_DlrNavteq::writeNodesUnsplitted(const OptionsCont& oc, NBNodeCont& nc, NBEdgeCont& ec) { +NWWriter_DlrNavteq::writeNodesUnsplitted(const OptionsCont& oc, NBNodeCont& nc, NBEdgeCont& ec, std::map& internalNodes) { // For "real" nodes we simply use the node id. // For internal nodes (geometry vectors describing edge geometry in the parlance of this format) // we use the id of the edge and do not bother with // compression (each direction gets its own internal node). - // XXX add option for generating numerical ids in case the input network has string ids and the target process needs integers OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_nodes_unsplitted.txt"); writeHeader(device, oc); const GeoConvHelper& gch = GeoConvHelper::getFinal(); const bool haveGeo = gch.usingGeoProjection(); - const SUMOReal geoScale = pow(10.0f, haveGeo ? 5 : 2); // see NIImporter_DlrNavteq::GEO_SCALE - device.setPrecision(0); + const double geoScale = pow(10.0f, haveGeo ? 5 : 2); // see NIImporter_DlrNavteq::GEO_SCALE + device.setPrecision(oc.getInt("dlr-navteq.precision")); if (!haveGeo) { WRITE_WARNING("DlrNavteq node data will be written in (floating point) cartesian coordinates"); } // write format specifier device << "# NODE_ID\tIS_BETWEEN_NODE\tamount_of_geocoordinates\tx1\ty1\t[x2 y2 ... xn yn]\n"; + // write header + Boundary boundary = gch.getConvBoundary(); + Position min(boundary.xmin(), boundary.ymin()); + Position max(boundary.xmax(), boundary.ymax()); + gch.cartesian2geo(min); + min.mul(geoScale); + gch.cartesian2geo(max); + max.mul(geoScale); + int multinodes = 0; + for (std::map::const_iterator i = ec.begin(); i != ec.end(); ++i) { + if ((*i).second->getGeometry().size() > 2) { + multinodes++; + } + } + device << "# [xmin_region] " << min.x() << "\n"; + device << "# [xmax_region] " << max.x() << "\n"; + device << "# [ymin_region] " << min.y() << "\n"; + device << "# [ymax_region] " << max.y() << "\n"; + device << "# [elements_multinode] " << multinodes << "\n"; + device << "# [elements_normalnode] " << nc.size() << "\n"; + device << "# [xmin] " << min.x() << "\n"; + device << "# [xmax] " << max.x() << "\n"; + device << "# [ymin] " << min.y() << "\n"; + device << "# [ymax] " << max.y() << "\n"; // write normal nodes for (std::map::const_iterator i = nc.begin(); i != nc.end(); ++i) { NBNode* n = (*i).second; @@ -117,20 +142,47 @@ } // write "internal" nodes std::vector avoid; + std::set reservedNodeIDs; const bool numericalIDs = oc.getBool("numerical-ids"); + if (oc.isSet("reserved-ids")) { + NBHelpers::loadPrefixedIDsFomFile(oc.getString("reserved-ids"), "node:", reservedNodeIDs); + } if (numericalIDs) { avoid = nc.getAllNames(); std::vector avoid2 = ec.getAllNames(); avoid.insert(avoid.end(), avoid2.begin(), avoid2.end()); + avoid.insert(avoid.end(), reservedNodeIDs.begin(), reservedNodeIDs.end()); } IDSupplier idSupplier("", avoid); for (std::map::const_iterator i = ec.begin(); i != ec.end(); ++i) { NBEdge* e = (*i).second; - const PositionVector& geom = e->getGeometry(); + PositionVector geom = e->getGeometry(); if (geom.size() > 2) { + // the import NIImporter_DlrNavteq checks for the presence of a + // negated edge id to determine spread type. We may need to do some + // shifting to make this consistent + const bool hasOppositeID = ec.getOppositeByID(e->getID()) != 0; + if (e->getLaneSpreadFunction() == LANESPREAD_RIGHT && !hasOppositeID) { + // need to write center-line geometry instead + try { + geom.move2side(e->getTotalWidth() / 2); + } catch (InvalidArgument& exception) { + WRITE_WARNING("Could not reconstruct shape for edge:'" + e->getID() + "' (" + exception.what() + ")."); + } + } else if (e->getLaneSpreadFunction() == LANESPREAD_CENTER && hasOppositeID) { + // need to write left-border geometry instead + try { + geom.move2side(-e->getTotalWidth() / 2); + } catch (InvalidArgument& exception) { + WRITE_WARNING("Could not reconstruct shape for edge:'" + e->getID() + "' (" + exception.what() + ")."); + } + } + std::string internalNodeID = e->getID(); - if (internalNodeID == UNDEFINED || - (nc.retrieve(internalNodeID) != 0)) { + if (internalNodeID == UNDEFINED + || (nc.retrieve(internalNodeID) != 0) + || reservedNodeIDs.count(internalNodeID) > 0 + ) { // need to invent a new name to avoid clashing with the id of a 'real' node or a reserved name if (numericalIDs) { internalNodeID = idSupplier.getNext(); @@ -138,6 +190,7 @@ internalNodeID += "_geometry"; } } + internalNodes[e] = internalNodeID; device << internalNodeID << "\t1\t" << geom.size() - 2; for (int ii = 1; ii < (int)geom.size() - 1; ++ii) { Position pos = geom[(int)ii]; @@ -153,7 +206,7 @@ void -NWWriter_DlrNavteq::writeLinksUnsplitted(const OptionsCont& oc, NBEdgeCont& ec) { +NWWriter_DlrNavteq::writeLinksUnsplitted(const OptionsCont& oc, NBEdgeCont& ec, std::map& internalNodes) { std::map nameIDs; OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_links_unsplitted.txt"); writeHeader(device, oc); @@ -163,7 +216,7 @@ for (std::map::const_iterator i = ec.begin(); i != ec.end(); ++i) { NBEdge* e = (*i).second; const int kph = speedInKph(e->getSpeed()); - const std::string& betweenNodeID = (e->getGeometry().size() > 2) ? e->getID() : UNDEFINED; + const std::string& betweenNodeID = (e->getGeometry().size() > 2) ? internalNodes[e] : UNDEFINED; std::string nameID = UNDEFINED; if (oc.getBool("output.street-names")) { const std::string& name = i->second->getStreetName(); @@ -178,8 +231,8 @@ << betweenNodeID << "\t" << getGraphLength(e) << "\t" << getAllowedTypes(e->getPermissions()) << "\t" - << "3\t" // Speed Category 1-8 XXX refine this - << UNDEFINED << "\t" // no special brunnel type (we don't know yet) + << getFormOfWay(e) << "\t" + << getBrunnelType(e) << "\t" << getRoadClass(e) << "\t" << getSpeedCategory(kph) << "\t" << getNavteqLaneCode(e->getNumLanes()) << "\t" @@ -189,7 +242,7 @@ << UNDEFINED << "\t" // NAME_ID2_LOCAL XXX << UNDEFINED << "\t" // housenumbers_right << UNDEFINED << "\t" // housenumbers_left - << UNDEFINED << "\t" // ZIP_CODE + << getSinglePostalCode(e->getParameter("postal_code", UNDEFINED), e->getID()) << "\t" // ZIP_CODE << UNDEFINED << "\t" // AREA_ID << UNDEFINED << "\t" // SUBAREA_ID << "1\t" // through_traffic (allowed) @@ -203,11 +256,17 @@ OutputDevice& namesDevice = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_names.txt"); writeHeader(namesDevice, oc); // write format specifier - namesDevice << "# NAME_ID\tName\n" << nameIDs.size() << "\n"; + namesDevice << "# NAME_ID\tPERMANENT_ID_INFO\tName\n"; + namesDevice << "# [elements] " << nameIDs.size() << "\n"; for (std::map::const_iterator i = nameIDs.begin(); i != nameIDs.end(); ++i) { - namesDevice << i->second << "\t" << i->first << "\n"; + namesDevice + << i->second << "\t" + << 0 << "\t" + << i->first << "\n"; } + namesDevice.close(); } + device.close(); } @@ -248,14 +307,14 @@ } else if (StringUtils::startsWith(type, "trunk")) { return 1; } else if (StringUtils::startsWith(type, "primary")) { - return 2; + return 1; } else if (StringUtils::startsWith(type, "secondary")) { return 2; } else if (StringUtils::startsWith(type, "tertiary")) { return 3; - } else if (type == "unclassified" || type == "residential") { + } else if (type == "unclassified") { return 3; - } else if (type == "living_street" || type == "road" || type == "service" || type == "track" || type == "cycleway" || type == "path" || type == "footway") { + } else if (type == "living_street" || type == "residential" || type == "road" || type == "service" || type == "track" || type == "cycleway" || type == "path" || type == "footway") { return 4; } // as a fallback we do a simple speed / lane-count mapping anyway @@ -339,7 +398,35 @@ } -SUMOReal +int +NWWriter_DlrNavteq::getBrunnelType(NBEdge* edge) { + if (edge->knowsParameter("bridge")) { + return 1; + } else if (edge->knowsParameter("tunnel")) { + return 4; + } else if (edge->getTypeID() == "route.ferry") { + return 10; + } + return -1; // UNDEFINED +} + + +int +NWWriter_DlrNavteq::getFormOfWay(NBEdge* edge) { + if (edge->getPermissions() == SVC_PEDESTRIAN) { + return 15; + } else if (edge->getJunctionPriority(edge->getToNode()) == NBEdge::ROUNDABOUT) { + return 4; + } else if (edge->getTypeID() == "highway.service") { + return 14; + } else if (edge->getTypeID().find("_link") != std::string::npos) { + return 10; + } + return 3; // speed category 1-8; +} + + +double NWWriter_DlrNavteq::getGraphLength(NBEdge* edge) { PositionVector geom = edge->getGeometry(); geom.push_back_noDoublePos(edge->getToNode()->getPosition()); @@ -348,14 +435,28 @@ } +std::string +NWWriter_DlrNavteq::getSinglePostalCode(const std::string& zipCode, const std::string edgeID) { + // might be multiple codes + if (zipCode.find_first_of(" ,;") != std::string::npos) { + WRITE_WARNING("ambiguous zip code '" + zipCode + "' for edge '" + edgeID + "'. (using first value)"); + StringTokenizer st(zipCode, " ,;", true); + std::vector ret = st.getVector(); + return ret[0]; + } else if (zipCode.size() > 16) { + WRITE_WARNING("long zip code '" + zipCode + "' for edge '" + edgeID + "'"); + } + return zipCode; +} + void NWWriter_DlrNavteq::writeTrafficSignals(const OptionsCont& oc, NBNodeCont& nc) { OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_traffic_signals.txt"); writeHeader(device, oc); const GeoConvHelper& gch = GeoConvHelper::getFinal(); const bool haveGeo = gch.usingGeoProjection(); - const SUMOReal geoScale = pow(10.0f, haveGeo ? 5 : 2); // see NIImporter_DlrNavteq::GEO_SCALE - device.setPrecision(0); + const double geoScale = pow(10.0f, haveGeo ? 5 : 2); // see NIImporter_DlrNavteq::GEO_SCALE + device.setPrecision(oc.getInt("dlr-navteq.precision")); // write format specifier device << "#Traffic signal related to LINK_ID and NODE_ID with location relative to driving direction.\n#column format like pointcollection.\n#DESCRIPTION->LOCATION: 1-rechts von LINK; 2-links von LINK; 3-oberhalb LINK -1-keineAngabe\n#RELATREC_ID\tPOICOL_TYPE\tDESCRIPTION\tLONGITUDE\tLATITUDE\tLINK_ID\n"; // write record for every edge incoming to a tls controlled node @@ -377,8 +478,85 @@ } } } + device.close(); +} + + +void +NWWriter_DlrNavteq::writeProhibitedManoeuvres(const OptionsCont& oc, const NBNodeCont& nc, const NBEdgeCont& ec) { + OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_prohibited_manoeuvres.txt"); + writeHeader(device, oc); + // need to invent id for relation + std::set reservedRelIDs; + if (oc.isSet("reserved-ids")) { + NBHelpers::loadPrefixedIDsFomFile(oc.getString("reserved-ids"), "rel:", reservedRelIDs); + } + std::vector avoid = ec.getAllNames(); // already used for tls RELATREC_ID + avoid.insert(avoid.end(), reservedRelIDs.begin(), reservedRelIDs.end()); + IDSupplier idSupplier("", avoid); // @note: use a global relRecIDsupplier if this is used more often + // write format specifier + device << "#No driving allowed from ID1 to ID2 or the complete chain from ID1 to IDn\n"; + device << "#RELATREC_ID\tPERMANENT_ID_INFO\tVALIDITY_PERIOD\tTHROUGH_TRAFFIC\tVEHICLE_TYPE\tNAVTEQ_LINK_ID1\t[NAVTEQ_LINK_ID2 ...]\n"; + // write record for every pair of incoming/outgoing edge that are not connected despite having common permissions + for (std::map::const_iterator i = nc.begin(); i != nc.end(); ++i) { + NBNode* n = (*i).second; + const EdgeVector& incoming = n->getIncomingEdges(); + const EdgeVector& outgoing = n->getOutgoingEdges(); + for (EdgeVector::const_iterator j = incoming.begin(); j != incoming.end(); ++j) { + NBEdge* inEdge = *j; + const SVCPermissions inPerm = inEdge->getPermissions(); + for (EdgeVector::const_iterator k = outgoing.begin(); k != outgoing.end(); ++k) { + NBEdge* outEdge = *k; + const SVCPermissions outPerm = outEdge->getPermissions(); + const SVCPermissions commonPerm = inPerm & outPerm; + if (commonPerm != 0 && commonPerm != SVC_PEDESTRIAN && !inEdge->isConnectedTo(outEdge)) { + device + << idSupplier.getNext() << "\t" + << 1 << "\t" // permanent id + << UNDEFINED << "\t" + << 1 << "\t" + << getAllowedTypes(SVCAll) << "\t" + << inEdge->getID() << "\t" << outEdge->getID() << "\n"; + } + } + } + } + device.close(); } +void +NWWriter_DlrNavteq::writeConnectedLanes(const OptionsCont& oc, NBNodeCont& nc) { + OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_connected_lanes.txt"); + writeHeader(device, oc); + // write format specifier + device << "#Lane connections related to LINK-IDs and NODE-ID.\n"; + device << "#column format like pointcollection.\n"; + device << "#NODE-ID\tVEHICLE-TYPE\tFROM_LANE\tTO_LANE\tTHROUGH_TRAFFIC\tLINK_IDs[2..*]\n"; + // write record for every connection + for (std::map::const_iterator i = nc.begin(); i != nc.end(); ++i) { + NBNode* n = (*i).second; + const EdgeVector& incoming = n->getIncomingEdges(); + for (EdgeVector::const_iterator j = incoming.begin(); j != incoming.end(); ++j) { + NBEdge* from = *j; + const SVCPermissions fromPerm = from->getPermissions(); + const std::vector& connections = from->getConnections(); + for (std::vector::const_iterator it_c = connections.begin(); it_c != connections.end(); it_c++) { + const NBEdge::Connection& c = *it_c; + device + << n->getID() << "\t" + << getAllowedTypes(fromPerm & c.toEdge->getPermissions()) << "\t" + << c.fromLane + 1 << "\t" // one-based + << c.toLane + 1 << "\t" // one-based + << 1 << "\t" // no information regarding permissibility of through traffic + << from->getID() << "\t" + << c.toEdge->getID() << "\t" + << "\n"; + } + } + } + device.close(); +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_DlrNavteq.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_DlrNavteq.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_DlrNavteq.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_DlrNavteq.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 26.10.2012 -/// @version $Id: NWWriter_DlrNavteq.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NWWriter_DlrNavteq.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Exporter writing networks using DlrNavteq (Elmar) format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -70,19 +70,27 @@ /// @brief get the navteq road class static int getRoadClass(NBEdge* edge); + /// @brief get the navteq brunnel type + static int getBrunnelType(NBEdge* edge); + + /// @brief get the form of way + static int getFormOfWay(NBEdge* edge); + private: /** @brief Writes the nodes_unsplitted file * @param[in] oc The options to use * @param[in] nc The node-container from which to read data * @param[in] ec The edge-container from which to read data + * @param[out] internalNodes The internal node ids, generated for edges with complex geometry */ - static void writeNodesUnsplitted(const OptionsCont& oc, NBNodeCont& nc, NBEdgeCont& ec); + static void writeNodesUnsplitted(const OptionsCont& oc, NBNodeCont& nc, NBEdgeCont& ec, std::map& internalNodes); /** @brief Writes the links_unsplitted file * @param[in] oc The options to use * @param[in] ec The edge-container from which to read data + * @param[int] internalNodes The internal node ids, generated for edges with complex geometry */ - static void writeLinksUnsplitted(const OptionsCont& oc, NBEdgeCont& ec); + static void writeLinksUnsplitted(const OptionsCont& oc, NBEdgeCont& ec, std::map& internalNodes); /** @brief Writes the traffic_signals file * @param[in] oc The options to use @@ -91,6 +99,18 @@ static void writeTrafficSignals(const OptionsCont& oc, NBNodeCont& nc); + /** @brief Writes the prohibited_manoeuvres file + * @param[in] oc The options to use + * @param[in] nc The node-container from which to read data + */ + static void writeProhibitedManoeuvres(const OptionsCont& oc, const NBNodeCont& nc, const NBEdgeCont& ec); + + /** @brief Writes the connected_lanes file + * @param[in] oc The options to use + * @param[in] nc The node-container from which to read data + */ + static void writeConnectedLanes(const OptionsCont& oc, NBNodeCont& nc); + /// @brief write header comments (input paramters, date, etc...) static void writeHeader(OutputDevice& device, const OptionsCont& oc); @@ -107,13 +127,15 @@ static int getNavteqLaneCode(const int numLanes); /// @brief get the length of the edge when measured up to the junction center - static SUMOReal getGraphLength(NBEdge* edge); + static double getGraphLength(NBEdge* edge); + + static std::string getSinglePostalCode(const std::string& zipCode, const std::string edgeID); /// @brief magic value for undefined stuff static const std::string UNDEFINED; /// @brief get edge speed rounded to kmh - static inline int speedInKph(SUMOReal metersPerSecond) { + static inline int speedInKph(double metersPerSecond) { return (int)std::floor(metersPerSecond * 3.6 + 0.5); } }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_MATSim.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_MATSim.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_MATSim.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_MATSim.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Tue, 04.05.2011 -/// @version $Id: NWWriter_MATSim.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NWWriter_MATSim.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Exporter writing networks using the MATSim format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,10 +38,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_MATSim.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_MATSim.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_MATSim.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_MATSim.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Tue, 04.05.2011 -/// @version $Id: NWWriter_MATSim.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NWWriter_MATSim.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Exporter writing networks using the MATSim format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_OpenDrive.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_OpenDrive.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_OpenDrive.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_OpenDrive.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Tue, 04.05.2011 -/// @version $Id: NWWriter_OpenDrive.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NWWriter_OpenDrive.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Exporter writing networks using the openDRIVE format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,10 +46,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - //#define DEBUG_SMOOTH_GEOM #define DEBUGCOND true @@ -68,10 +64,13 @@ if (!oc.isSet("opendrive-output")) { return; } + const NBNodeCont& nc = nb.getNodeCont(); + const NBEdgeCont& ec = nb.getEdgeCont(); const bool origNames = oc.getBool("output.original-names"); + const double straightThresh = DEG2RAD(oc.getFloat("opendrive-output.straight-threshold")); // some internal mapping containers - int edgeID = 1; int nodeID = 1; + int edgeID = nc.size() * 10; // distinct from node ids StringBijection edgeMap; StringBijection nodeMap; // @@ -80,8 +79,6 @@ device.openTag("OpenDRIVE"); time_t now = time(0); std::string dstr(ctime(&now)); - const NBNodeCont& nc = nb.getNodeCont(); - const NBEdgeCont& ec = nb.getEdgeCont(); const Boundary& b = GeoConvHelper::getFinal().getConvBoundary(); // write header device.openTag("header"); @@ -104,24 +101,16 @@ // write normal edges (road) for (std::map::const_iterator i = ec.begin(); i != ec.end(); ++i) { const NBEdge* e = (*i).second; - device.openTag("road"); - device.writeAttr("name", StringUtils::escapeXML(e->getStreetName())); - device.writeAttr("length", e->getLength()); - device.writeAttr("id", getID(e->getID(), edgeMap, edgeID)); - device.writeAttr("junction", -1); - device.openTag("link"); - device.openTag("predecessor"); - device.writeAttr("elementType", "junction"); - device.writeAttr("elementId", getID(e->getFromNode()->getID(), nodeMap, nodeID)); - device.closeTag(); - device.openTag("successor"); - device.writeAttr("elementType", "junction"); - device.writeAttr("elementId", getID(e->getToNode()->getID(), nodeMap, nodeID)); - device.closeTag(); - device.closeTag(); - device.openTag("type").writeAttr("s", 0).writeAttr("type", "town").closeTag(); - device.openTag("planView"); - device.setPrecision(8); // geometry hdg requires higher precision + + // buffer output because some fields are computed out of order + OutputDevice_String elevationOSS(false, 3); + elevationOSS.setPrecision(8); + OutputDevice_String planViewOSS(false, 2); + planViewOSS.setPrecision(8); + double length = 0; + + planViewOSS.openTag("planView"); + planViewOSS.setPrecision(8); // geometry hdg requires higher precision // for the shape we need to use the leftmost border of the leftmost lane const std::vector& lanes = e->getLanes(); PositionVector ls = getLeftLaneBorder(e); @@ -130,39 +119,45 @@ std::cout << "write planview for edge " << e->getID() << "\n"; } #endif - OutputDevice_String elevationOSS(false, 3); - elevationOSS.setPrecision(8); + if (ls.size() == 2 || e->getPermissions() == SVC_PEDESTRIAN) { // foot paths may contain sharp angles - writeGeomLines(ls, device, elevationOSS); + length = writeGeomLines(ls, planViewOSS, elevationOSS); } else { - bool ok = writeGeomSmooth(ls, e->getSpeed(), device, elevationOSS); + bool ok = writeGeomSmooth(ls, e->getSpeed(), planViewOSS, elevationOSS, straightThresh, length); if (!ok) { WRITE_WARNING("Could not compute smooth shape for edge '" + e->getID() + "'."); } } - // check if the lane geometries are compatible with OpenDRIVE assumptions (colinear stop line) - if (e->getNumLanes() > 1) { - // compute 'stop line' of rightmost lane - const PositionVector shape0 = e->getLaneShape(0); - assert(shape0.size() >= 2); - const Position& from = shape0[-2]; - const Position& to = shape0[-1]; - PositionVector stopLine; - stopLine.push_back(to); - stopLine.push_back(to - PositionVector::sideOffset(from, to, -1000.0)); - // endpoints of all other lanes should be on the stop line - for (int lane = 1; lane < e->getNumLanes(); ++lane) { - const SUMOReal dist = stopLine.distance2D(e->getLaneShape(lane)[-1]); - if (dist > NUMERICAL_EPS) { - WRITE_WARNING("Uneven stop line at lane '" + e->getLaneID(lane) + "' (dist=" + toString(dist) + ") cannot be represented in OpenDRIVE."); - } + planViewOSS.closeTag(); + + device.openTag("road"); + device.writeAttr("name", StringUtils::escapeXML(e->getStreetName())); + device.setPrecision(8); // length requires higher precision + device.writeAttr("length", MAX2(POSITION_EPS, length)); + device.setPrecision(gPrecision); + device.writeAttr("id", getID(e->getID(), edgeMap, edgeID)); + device.writeAttr("junction", -1); + const bool hasSucc = e->getConnections().size() > 0; + const bool hasPred = e->getIncomingEdges().size() > 0; + if (hasPred || hasSucc) { + device.openTag("link"); + if (hasPred) { + device.openTag("predecessor"); + device.writeAttr("elementType", "junction"); + device.writeAttr("elementId", getID(e->getFromNode()->getID(), nodeMap, nodeID)); + device.closeTag(); + } + if (hasSucc) { + device.openTag("successor"); + device.writeAttr("elementType", "junction"); + device.writeAttr("elementId", getID(e->getToNode()->getID(), nodeMap, nodeID)); + device.closeTag(); } + device.closeTag(); } - - - device.setPrecision(OUTPUT_ACCURACY); - device.closeTag(); + device.openTag("type").writeAttr("s", 0).writeAttr("type", "town").closeTag(); + device << planViewOSS.getString(); writeElevationProfile(ls, device, elevationOSS); device << " \n"; device << " \n"; @@ -197,8 +192,10 @@ device << " getID() << "\"/>\n"; } device.closeTag(); + checkLaneGeometries(e); } device.lf(); + // write junction-internal edges (road). In OpenDRIVE these are called 'paths' or 'connecting roads' for (std::map::const_iterator i = nc.begin(); i != nc.end(); ++i) { NBNode* n = (*i).second; @@ -212,19 +209,19 @@ if (outEdge == 0) { continue; } - const SUMOReal width = c.toEdge->getLaneWidth(c.toLane); + const double width = c.toEdge->getLaneWidth(c.toLane); const PositionVector begShape = getLeftLaneBorder(inEdge, c.fromLane); const PositionVector endShape = getLeftLaneBorder(outEdge, c.toLane); //std::cout << "computing reference line for internal lane " << c.getInternalLaneID() << " begLane=" << inEdge->getLaneShape(c.fromLane) << " endLane=" << outEdge->getLaneShape(c.toLane) << "\n"; - SUMOReal length; + double length; PositionVector fallBackShape; + fallBackShape.push_back(begShape.back()); + fallBackShape.push_back(endShape.front()); const bool turnaround = inEdge->isTurningDirectionAt(outEdge); bool ok = true; - PositionVector init = NBNode::bezierControlPoints(begShape, endShape, turnaround, 25, 25, ok); + PositionVector init = NBNode::bezierControlPoints(begShape, endShape, turnaround, 25, 25, ok, 0, straightThresh); if (init.size() == 0) { - fallBackShape.push_back(begShape.back()); - fallBackShape.push_back(endShape.front()); length = fallBackShape.length2D(); // problem with turnarounds is known, method currently returns 'ok' (#2539) if (!ok) { @@ -236,7 +233,9 @@ device.openTag("road"); device.writeAttr("name", c.getInternalLaneID()); - device.writeAttr("length", length); + device.setPrecision(8); // length requires higher precision + device.writeAttr("length", MAX2(POSITION_EPS, length)); + device.setPrecision(gPrecision); device.writeAttr("id", getID(c.getInternalLaneID(), edgeMap, edgeID)); device.writeAttr("junction", getID(n->getID(), nodeMap, nodeID)); device.openTag("link"); @@ -255,12 +254,17 @@ device.openTag("planView"); device.setPrecision(8); // geometry hdg requires higher precision OutputDevice_String elevationOSS(false, 3); +#ifdef DEBUG_SMOOTH_GEOM + if (DEBUGCOND) { + std::cout << "write planview for internal edge " << c.getInternalLaneID() << " init=" << init << " fallback=" << fallBackShape << "\n"; + } +#endif if (init.size() == 0) { writeGeomLines(fallBackShape, device, elevationOSS); } else { writeGeomPP3(device, elevationOSS, init, length); } - device.setPrecision(OUTPUT_ACCURACY); + device.setPrecision(gPrecision); device.closeTag(); writeElevationProfile(fallBackShape, device, elevationOSS); device << " \n"; @@ -329,13 +333,13 @@ } -SUMOReal -NWWriter_OpenDrive::writeGeomLines(const PositionVector& shape, OutputDevice& device, OutputDevice& elevationDevice, SUMOReal offset) { +double +NWWriter_OpenDrive::writeGeomLines(const PositionVector& shape, OutputDevice& device, OutputDevice& elevationDevice, double offset) { for (int j = 0; j < (int)shape.size() - 1; ++j) { const Position& p = shape[j]; const Position& p2 = shape[j + 1]; - const SUMOReal hdg = shape.angleAt2D(j); - const SUMOReal length = p.distanceTo2D(p2); + const double hdg = shape.angleAt2D(j); + const double length = p.distanceTo2D(p2); device.openTag("geometry"); device.writeAttr("s", offset); device.writeAttr("x", p.x()); @@ -352,7 +356,7 @@ void -NWWriter_OpenDrive::writeEmptyCenterLane(OutputDevice& device, const std::string& mark, SUMOReal markWidth) { +NWWriter_OpenDrive::writeEmptyCenterLane(OutputDevice& device, const std::string& mark, double markWidth) { device << "
\n"; device << " \n"; device << " \n"; @@ -421,7 +425,7 @@ // computations based on the reference line // This assumes that the 'stop line' for all lanes is colinear! const int leftmost = (int)edge->getNumLanes() - 1; - SUMOReal widthOffset = -(edge->getLaneWidth(leftmost) / 2); + double widthOffset = -(edge->getLaneWidth(leftmost) / 2); // collect lane widths from left border of edge to left border of lane to connect to for (int i = leftmost; i > laneIndex; i--) { widthOffset += edge->getLaneWidth(i); @@ -434,28 +438,31 @@ } -SUMOReal +double NWWriter_OpenDrive::writeGeomPP3( OutputDevice& device, OutputDevice& elevationDevice, PositionVector init, - SUMOReal length, - SUMOReal offset) { + double length, + double offset) { assert(init.size() == 3 || init.size() == 4); // avoid division by 0 length = MAX2(POSITION_EPS, length); const Position p = init.front(); - const SUMOReal hdg = init.angleAt2D(0); + const double hdg = init.angleAt2D(0); + + // backup elevation values + const PositionVector initZ = init; // translate to u,v coordinates init.add(-p.x(), -p.y(), -p.z()); init.rotate2D(-hdg); // parametric coefficients - SUMOReal aU, bU, cU, dU; - SUMOReal aV, bV, cV, dV; - SUMOReal aZ, bZ, cZ, dZ; + double aU, bU, cU, dU; + double aV, bV, cV, dV; + double aZ, bZ, cZ, dZ; // unfactor the Bernstein polynomials of degree 2 (or 3) and collect the coefficients if (init.size() == 3) { @@ -471,9 +478,9 @@ dV = 0; // elevation is not parameteric on [0:1] but on [0:length] - aZ = init[0].z(); - bZ = (2 * init[1].z() - 2 * init[0].z()) / length; - cZ = (init[0].z() - 2 * init[1].z() + init[2].z()) / (length * length); + aZ = initZ[0].z(); + bZ = (2 * initZ[1].z() - 2 * initZ[0].z()) / length; + cZ = (initZ[0].z() - 2 * initZ[1].z() + initZ[2].z()) / (length * length); dZ = 0; } else { @@ -489,10 +496,10 @@ dV = -init[0].y() + 3 * init[1].y() - 3 * init[2].y() + init[3].y(); // elevation is not parameteric on [0:1] but on [0:length] - aZ = init[0].z(); - bZ = (3 * init[1].z() - 3 * init[0].z()) / length; - cZ = (3 * init[0].z() - 6 * init[1].z() + 3 * init[2].z()) / (length * length); - dZ = (-init[0].z() + 3 * init[1].z() - 3 * init[2].z() + init[3].z()) / (length * length * length); + aZ = initZ[0].z(); + bZ = (3 * initZ[1].z() - 3 * initZ[0].z()) / length; + cZ = (3 * initZ[0].z() - 6 * initZ[1].z() + 3 * initZ[2].z()) / (length * length); + dZ = (-initZ[0].z() + 3 * initZ[1].z() - 3 * initZ[2].z() + initZ[3].z()) / (length * length * length); } device.openTag("geometry"); @@ -528,39 +535,38 @@ bool -NWWriter_OpenDrive::writeGeomSmooth(const PositionVector& shape, SUMOReal speed, OutputDevice& device, OutputDevice& elevationDevice) { +NWWriter_OpenDrive::writeGeomSmooth(const PositionVector& shape, double speed, OutputDevice& device, OutputDevice& elevationDevice, double straightThresh, double& length) { #ifdef DEBUG_SMOOTH_GEOM if (DEBUGCOND) { std::cout << "writeGeomSmooth\n n=" << shape.size() << " shape=" << toString(shape) << "\n"; } #endif bool ok = true; - const SUMOReal angleThresh = DEG2RAD(5); // changes below thresh are considered to be straight (make configurable) - const SUMOReal longThresh = speed; // 16.0; // make user-configurable (should match the sampling rate of the source data) - const SUMOReal curveCutout = longThresh / 2; // 8.0; // make user-configurable (related to the maximum turning rate) + const double longThresh = speed; // 16.0; // make user-configurable (should match the sampling rate of the source data) + const double curveCutout = longThresh / 2; // 8.0; // make user-configurable (related to the maximum turning rate) // the length of the segment that is added for cutting a corner can be bounded by 2*curveCutout (prevent the segment to be classified as 'long') assert(longThresh >= 2 * curveCutout); assert(shape.size() > 2); // add intermediate points wherever there is a strong angular change between long segments // assume the geometry is simplified so as not to contain consecutive colinear points PositionVector shape2 = shape; - SUMOReal maxAngleDiff = 0; - SUMOReal offset = 0; + double maxAngleDiff = 0; + double offset = 0; for (int j = 1; j < (int)shape.size() - 1; ++j) { - //const SUMOReal hdg = shape.angleAt2D(j); + //const double hdg = shape.angleAt2D(j); const Position& p0 = shape[j - 1]; const Position& p1 = shape[j]; const Position& p2 = shape[j + 1]; - const SUMOReal dAngle = fabs(GeomHelper::angleDiff(p0.angleTo2D(p1), p1.angleTo2D(p2))); - const SUMOReal length1 = p0.distanceTo2D(p1); - const SUMOReal length2 = p1.distanceTo2D(p2); + const double dAngle = fabs(GeomHelper::angleDiff(p0.angleTo2D(p1), p1.angleTo2D(p2))); + const double length1 = p0.distanceTo2D(p1); + const double length2 = p1.distanceTo2D(p2); maxAngleDiff = MAX2(maxAngleDiff, dAngle); #ifdef DEBUG_SMOOTH_GEOM if (DEBUGCOND) { std::cout << " j=" << j << " dAngle=" << RAD2DEG(dAngle) << " length1=" << length1 << " length2=" << length2 << "\n"; } #endif - if (dAngle > angleThresh + if (dAngle > straightThresh && (length1 > longThresh || j == 1) && (length2 > longThresh || j == (int)shape.size() - 2)) { shape2.insertAtClosest(shape.positionAtOffset2D(offset + length1 - MIN2(length1 - POSITION_EPS, curveCutout))); @@ -576,8 +582,8 @@ } #endif - if (maxAngleDiff < angleThresh) { - writeGeomLines(shape2, device, elevationDevice, 0); + if (maxAngleDiff < straightThresh) { + length = writeGeomLines(shape2, device, elevationDevice, 0); #ifdef DEBUG_SMOOTH_GEOM if (DEBUGCOND) { std::cout << " special case: all lines. maxAngleDiff=" << maxAngleDiff << "\n"; @@ -594,7 +600,7 @@ PositionVector line; line.push_back(p0); line.push_back(p1); - const SUMOReal lineLength = line.length2D(); + const double lineLength = line.length2D(); if (lineLength >= longThresh) { offset = writeGeomLines(line, device, elevationDevice, offset); #ifdef DEBUG_SMOOTH_GEOM @@ -606,8 +612,8 @@ // find control points PositionVector begShape; PositionVector endShape; - if (j == 0) { - // keep the angle of the first segment but end at the front of the shape + if (j == 0 || j == numPoints - 2) { + // keep the angle of the first/last segment but end at the front of the shape begShape = line; begShape.add(p0 - begShape.back()); } else if (j == 1 || p0.distanceTo2D(shape2[j - 1]) > longThresh) { @@ -620,8 +626,9 @@ begShape.push_back(p1); begShape.add(p0 - begShape.back()); } - if (j == numPoints - 2) { - // keep the angle of the last segment but start at the end of the shape + + if (j == 0 || j == numPoints - 2) { + // keep the angle of the first/last segment but start at the end of the shape endShape = line; endShape.add(p1 - endShape.front()); } else if (j == numPoints - 3 || p1.distanceTo2D(shape2[j + 2]) > longThresh) { @@ -634,27 +641,29 @@ endShape.push_back(shape2[j + 2]); endShape.add(p1 - endShape.front()); } - PositionVector init = NBNode::bezierControlPoints(begShape, endShape, false, 25, 25, ok); + const double extrapolateLength = MIN2((double)25, lineLength / 4); + PositionVector init = NBNode::bezierControlPoints(begShape, endShape, false, extrapolateLength, extrapolateLength, ok, 0, straightThresh); if (init.size() == 0) { // could not compute control points, write line offset = writeGeomLines(line, device, elevationDevice, offset); #ifdef DEBUG_SMOOTH_GEOM if (DEBUGCOND) { - std::cout << " writeLine lineLength=" << lineLength << " begShape=" << toString(begShape) << " endShape=" << toString(endShape) << " init=" << toString(init) << "\n"; + std::cout << " writeLine lineLength=" << lineLength << " begShape" << j << "=" << toString(begShape) << " endShape" << j << "=" << toString(endShape) << " init" << j << "=" << toString(init) << "\n"; } #endif } else { // write bezier - const SUMOReal curveLength = bezier(init, 12).length2D(); + const double curveLength = bezier(init, 12).length2D(); offset = writeGeomPP3(device, elevationDevice, init, curveLength, offset); #ifdef DEBUG_SMOOTH_GEOM if (DEBUGCOND) { - std::cout << " writeCurve lineLength=" << lineLength << " curveLength=" << curveLength << " begShape=" << toString(begShape) << " endShape=" << toString(endShape) << " init=" << toString(init) << "\n"; + std::cout << " writeCurve lineLength=" << lineLength << " curveLength=" << curveLength << " begShape" << j << "=" << toString(begShape) << " endShape" << j << "=" << toString(endShape) << " init" << j << "=" << toString(init) << "\n"; } #endif } } } + length = offset; return ok; } @@ -663,7 +672,7 @@ NWWriter_OpenDrive::writeElevationProfile(const PositionVector& shape, OutputDevice& device, const OutputDevice_String& elevationDevice) { // check if the shape is flat bool flat = true; - SUMOReal z = shape.size() == 0 ? 0 : shape[0].z(); + double z = shape.size() == 0 ? 0 : shape[0].z(); for (int i = 1; i < (int)shape.size(); ++i) { if (fabs(shape[i].z() - z) > NUMERICAL_EPS) { flat = false; @@ -681,5 +690,26 @@ } +void +NWWriter_OpenDrive::checkLaneGeometries(const NBEdge* e) { + if (e->getNumLanes() > 1) { + // compute 'stop line' of rightmost lane + const PositionVector shape0 = e->getLaneShape(0); + assert(shape0.size() >= 2); + const Position& from = shape0[-2]; + const Position& to = shape0[-1]; + PositionVector stopLine; + stopLine.push_back(to); + stopLine.push_back(to - PositionVector::sideOffset(from, to, -1000.0)); + // endpoints of all other lanes should be on the stop line + for (int lane = 1; lane < e->getNumLanes(); ++lane) { + const double dist = stopLine.distance2D(e->getLaneShape(lane)[-1]); + if (dist > NUMERICAL_EPS) { + WRITE_WARNING("Uneven stop line at lane '" + e->getLaneID(lane) + "' (dist=" + toString(dist) + ") cannot be represented in OpenDRIVE."); + } + } + } +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_OpenDrive.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_OpenDrive.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_OpenDrive.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_OpenDrive.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file NWWriter_OpenDrive.h /// @author Daniel Krajzewicz /// @date Tue, 04.05.2011 -/// @version $Id: NWWriter_OpenDrive.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: NWWriter_OpenDrive.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Exporter writing networks using the openDRIVE format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -64,27 +64,34 @@ protected: /// @brief write geometry as sequence of lines (sumo style) - static SUMOReal writeGeomLines(const PositionVector& shape, OutputDevice& device, OutputDevice& elevationDevice, SUMOReal offset = 0); + static double writeGeomLines(const PositionVector& shape, OutputDevice& device, OutputDevice& elevationDevice, double offset = 0); - /// @brief write geometry as sequence of lines and bezier curves - static bool writeGeomSmooth(const PositionVector& shape, SUMOReal speed, OutputDevice& device, OutputDevice& elevationDevice); + /* @brief write geometry as sequence of lines and bezier curves + * + * @param[in] straightThresh angular changes below threshold are considered to be straight and no curve will be fitted between the segments + * @param[out] length Return the total length of the reference line + */ + static bool writeGeomSmooth(const PositionVector& shape, double speed, OutputDevice& device, OutputDevice& elevationDevice, double straightThresh, double& length); /// @brief write geometry as a single bezier curve (paramPoly3) - static SUMOReal writeGeomPP3(OutputDevice& device, - OutputDevice& elevationDevice, - PositionVector init, - SUMOReal length, - SUMOReal offset = 0); + static double writeGeomPP3(OutputDevice& device, + OutputDevice& elevationDevice, + PositionVector init, + double length, + double offset = 0); static void writeElevationProfile(const PositionVector& shape, OutputDevice& device, const OutputDevice_String& elevationDevice); - static void writeEmptyCenterLane(OutputDevice& device, const std::string& mark, SUMOReal markWidth); + static void writeEmptyCenterLane(OutputDevice& device, const std::string& mark, double markWidth); static int getID(const std::string& origID, StringBijection& map, int& lastID); static std::string getLaneType(SVCPermissions permissions); /// @brief get the left border of the given lane (the leftmost one by default) static PositionVector getLeftLaneBorder(const NBEdge* edge, int laneIndex = -1); + + /// @brief check if the lane geometries are compatible with OpenDRIVE assumptions (colinear stop line) + static void checkLaneGeometries(const NBEdge* e); }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_SUMO.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_SUMO.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_SUMO.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_SUMO.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 04.05.2011 -/// @version $Id: NWWriter_SUMO.cpp 21714 2016-10-17 11:21:44Z namdre $ +/// @version $Id: NWWriter_SUMO.cpp 23569 2017-03-21 11:29:59Z namdre $ /// // Exporter writing networks using the SUMO format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,10 +48,6 @@ #include "NWFrame.h" #include "NWWriter_SUMO.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== @@ -67,15 +63,22 @@ return; } OutputDevice& device = OutputDevice::getDevice(oc.getString("output-file")); - const std::string lefthand = oc.getBool("lefthand") ? " " + toString(SUMO_ATTR_LEFTHAND) + "=\"true\"" : ""; + std::map attrs; + attrs[SUMO_ATTR_VERSION] = NWFrame::MAJOR_VERSION; + if (oc.getBool("lefthand")) { + attrs[SUMO_ATTR_LEFTHAND] = "true"; + } const int cornerDetail = oc.getInt("junctions.corner-detail"); - const int linkDetail = oc.getInt("junctions.internal-link-detail"); - const std::string junctionCornerDetail = (cornerDetail > 0 - ? " " + toString(SUMO_ATTR_CORNERDETAIL) + "=\"" + toString(cornerDetail) + "\"" : ""); - const std::string junctionLinkDetail = (oc.isDefault("junctions.internal-link-detail") ? "" : - " " + toString(SUMO_ATTR_LINKDETAIL) + "=\"" + toString(linkDetail) + "\""); - device.writeXMLHeader("net", NWFrame::MAJOR_VERSION + lefthand + junctionCornerDetail + junctionLinkDetail + - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/net_file.xsd\""); // street names may contain non-ascii chars + if (cornerDetail > 0) { + attrs[SUMO_ATTR_CORNERDETAIL] = toString(cornerDetail); + } + if (!oc.isDefault("junctions.internal-link-detail")) { + attrs[SUMO_ATTR_LINKDETAIL] = toString(oc.getInt("junctions.internal-link-detail")); + } + if (oc.getBool("rectangular-lane-cut")) { + attrs[SUMO_ATTR_RECTANGULAR_LANE_CUT] = "true"; + } + device.writeXMLHeader("net", "net_file.xsd", attrs); // street names may contain non-ascii chars device.lf(); // get involved container const NBNodeCont& nc = nb.getNodeCont(); @@ -143,7 +146,6 @@ int numConnections = 0; for (std::map::const_iterator it_edge = ec.begin(); it_edge != ec.end(); it_edge++) { NBEdge* from = it_edge->second; - from->sortOutgoingConnectionsByIndex(); const std::vector connections = from->getConnections(); numConnections += (int)connections.size(); for (std::vector::const_iterator it_c = connections.begin(); it_c != connections.end(); it_c++) { @@ -181,8 +183,8 @@ device.writeAttr(SUMO_ATTR_TO, (*it).nextCrossing); device.writeAttr(SUMO_ATTR_FROM_LANE, 0); device.writeAttr(SUMO_ATTR_TO_LANE, 0); - if (node->isTLControlled()) { - device.writeAttr(SUMO_ATTR_TLID, (*node->getControllingTLS().begin())->getID()); + if (nextCrossing.tlID != "") { + device.writeAttr(SUMO_ATTR_TLID, nextCrossing.tlID); assert(nextCrossing.tlLinkNo >= 0); device.writeAttr(SUMO_ATTR_TLLINKINDEX, nextCrossing.tlLinkNo); } @@ -257,7 +259,7 @@ NBEdge* toEdge = 0; std::string internalEdgeID = ""; // first pass: compute average lengths of non-via edges - std::map lengthSum; + std::map lengthSum; std::map numLanes; for (std::vector::const_iterator k = elv.begin(); k != elv.end(); ++k) { lengthSum[(*k).toEdge] += MAX2((*k).shape.length(), POSITION_EPS); @@ -284,10 +286,10 @@ // to avoid changing to an internal lane which has a successor // with the wrong permissions we need to inherit them from the successor const NBEdge::Lane& successor = (*k).toEdge->getLanes()[(*k).toLane]; - const SUMOReal length = lengthSum[toEdge] / numLanes[toEdge]; + const double length = lengthSum[toEdge] / numLanes[toEdge]; // @note the actual length should be used once sumo supports lanes of // varying length within the same edge - //const SUMOReal length = MAX2((*k).shape.length(), POSITION_EPS); + //const double length = MAX2((*k).shape.length(), POSITION_EPS); writeLane(into, (*k).getInternalLaneID(), (*k).vmax, successor.permissions, successor.preferred, NBEdge::UNSPECIFIED_OFFSET, successor.width, (*k).shape, (*k).origID, @@ -374,12 +376,12 @@ // write the lanes const std::vector& lanes = e.getLanes(); - const SUMOReal length = e.getFinalLength(); + const double length = e.getFinalLength(); for (int i = 0; i < (int) lanes.size(); i++) { const NBEdge::Lane& l = lanes[i]; writeLane(into, e.getLaneID(i), l.speed, l.permissions, l.preferred, l.endOffset, l.width, l.shape, l.origID, - length, i, origNames, l.oppositeID); + length, i, origNames, l.oppositeID, 0, l.accelRamp); } // close the edge into.closeTag(); @@ -388,10 +390,10 @@ void NWWriter_SUMO::writeLane(OutputDevice& into, const std::string& lID, - SUMOReal speed, SVCPermissions permissions, SVCPermissions preferred, - SUMOReal endOffset, SUMOReal width, PositionVector shape, - const std::string& origID, SUMOReal length, int index, bool origNames, - const std::string& oppositeID, const NBNode* node) { + double speed, SVCPermissions permissions, SVCPermissions preferred, + double endOffset, double width, PositionVector shape, + const std::string& origID, double length, int index, bool origNames, + const std::string& oppositeID, const NBNode* node, bool accelRamp) { // output the lane's attributes into.openTag(SUMO_TAG_LANE).writeAttr(SUMO_ATTR_ID, lID); // the first lane of an edge will be the depart lane @@ -418,6 +420,9 @@ if (width != NBEdge::UNSPECIFIED_WIDTH) { into.writeAttr(SUMO_ATTR_WIDTH, width); } + if (accelRamp) { + into.writeAttr(SUMO_ATTR_ACCELERATION, accelRamp); + } if (node != 0) { const NBNode::CustomShapeMap& cs = node->getCustomLaneShapes(); NBNode::CustomShapeMap::const_iterator it = cs.find(lID); @@ -435,10 +440,11 @@ } if (origNames && origID != "") { into.openTag(SUMO_TAG_PARAM); - into.writeAttr(SUMO_ATTR_KEY, "origId"); + into.writeAttr(SUMO_ATTR_KEY, SUMO_PARAM_ORIGID); into.writeAttr(SUMO_ATTR_VALUE, origID); into.closeTag(); } + into.closeTag(); } @@ -707,10 +713,10 @@ void NWWriter_SUMO::writeDistrict(OutputDevice& into, const NBDistrict& d) { - std::vector sourceW = d.getSourceWeights(); - VectorHelper::normaliseSum(sourceW, 1.0); - std::vector sinkW = d.getSinkWeights(); - VectorHelper::normaliseSum(sinkW, 1.0); + std::vector sourceW = d.getSourceWeights(); + VectorHelper::normaliseSum(sourceW, 1.0); + std::vector sinkW = d.getSinkWeights(); + VectorHelper::normaliseSum(sinkW, 1.0); // write the head and the id of the district into.openTag(SUMO_TAG_TAZ).writeAttr(SUMO_ATTR_ID, d.getID()); if (d.getShape().size() > 0) { @@ -737,7 +743,7 @@ std::string NWWriter_SUMO::writeSUMOTime(SUMOTime steps) { - SUMOReal time = STEPS2TIME(steps); + double time = STEPS2TIME(steps); if (time == std::floor(time)) { return toString(int(time)); } else { @@ -778,13 +784,7 @@ into.writeAttr(SUMO_ATTR_PROGRAMID, (*it)->getProgramID()); into.writeAttr(SUMO_ATTR_OFFSET, writeSUMOTime((*it)->getOffset())); // write params - const std::map& params = (*it)->getMap(); - for (std::map::const_iterator i = params.begin(); i != params.end(); ++i) { - into.openTag(SUMO_TAG_PARAM); - into.writeAttr(SUMO_ATTR_KEY, (*i).first); - into.writeAttr(SUMO_ATTR_VALUE, (*i).second); - into.closeTag(); - } + (*it)->writeParams(into); // write the phases const std::vector& phases = (*it)->getPhases(); for (std::vector::const_iterator j = phases.begin(); j != phases.end(); ++j) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_SUMO.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_SUMO.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_SUMO.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_SUMO.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 04.05.2011 -/// @version $Id: NWWriter_SUMO.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NWWriter_SUMO.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Exporter writing networks using the SUMO format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -133,12 +133,13 @@ * @param[in] origNames Whether original names shall be written as parameter * @param[in] oppositeID The ID of the opposite lane for overtaking * @param[in] node The node to check for custom shape data + * @param[in] accelRamp whether this lane is an acceleration lane */ static void writeLane(OutputDevice& into, const std::string& lID, - SUMOReal speed, SVCPermissions permissions, SVCPermissions preferred, - SUMOReal endOffset, SUMOReal width, PositionVector shape, - const std::string& origID, SUMOReal length, int index, bool origNames, - const std::string& oppositeID, const NBNode* node = 0); + double speed, SVCPermissions permissions, SVCPermissions preferred, + double endOffset, double width, PositionVector shape, + const std::string& origID, double length, int index, bool origNames, + const std::string& oppositeID, const NBNode* node = 0, bool accelRamp = false); /** @brief Writes a junction ( -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== @@ -74,6 +70,9 @@ if (oc.isSet("street-sign-output")) { writeStreetSigns(oc, nb.getEdgeCont()); } + if (oc.exists("ptstop-output") && oc.isSet("ptstop-output")) { + writePTStops(oc, nb.getPTStopCont()); + } } @@ -88,7 +87,9 @@ const bool geoAccuracy = useGeo || gch.usingInverseGeoProjection(); OutputDevice& device = OutputDevice::getDevice(oc.getString("plain-output-prefix") + ".nod.xml"); - device.writeXMLHeader("nodes", NWFrame::MAJOR_VERSION + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/nodes_file.xsd\""); + std::map attrs; + attrs[SUMO_ATTR_VERSION] = NWFrame::MAJOR_VERSION; + device.writeXMLHeader("nodes", "nodes_file.xsd", attrs); // write network offsets and projection to allow reconstruction of original coordinates if (!useGeo) { @@ -106,7 +107,7 @@ gch.cartesian2geo(pos); } if (geoAccuracy) { - device.setPrecision(GEO_OUTPUT_ACCURACY); + device.setPrecision(gPrecisionGeo); } NWFrame::writePositionLong(pos, device); if (geoAccuracy) { @@ -152,7 +153,9 @@ void NWWriter_XML::writeTypes(const OptionsCont& oc, NBTypeCont& tc) { OutputDevice& device = OutputDevice::getDevice(oc.getString("plain-output-prefix") + ".typ.xml"); - device.writeXMLHeader("types", NWFrame::MAJOR_VERSION + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/types_file.xsd\""); + std::map attrs; + attrs[SUMO_ATTR_VERSION] = NWFrame::MAJOR_VERSION; + device.writeXMLHeader("types", "types_file.xsd", attrs); tc.writeTypes(device); device.close(); } @@ -164,10 +167,12 @@ bool useGeo = oc.exists("proj.plain-geo") && oc.getBool("proj.plain-geo"); const bool geoAccuracy = useGeo || gch.usingInverseGeoProjection(); + std::map attrs; + attrs[SUMO_ATTR_VERSION] = NWFrame::MAJOR_VERSION; OutputDevice& edevice = OutputDevice::getDevice(oc.getString("plain-output-prefix") + ".edg.xml"); - edevice.writeXMLHeader("edges", NWFrame::MAJOR_VERSION + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/edges_file.xsd\""); + edevice.writeXMLHeader("edges", "edges_file.xsd", attrs); OutputDevice& cdevice = OutputDevice::getDevice(oc.getString("plain-output-prefix") + ".con.xml"); - cdevice.writeXMLHeader("connections", NWFrame::MAJOR_VERSION + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/connections_file.xsd\""); + cdevice.writeXMLHeader("connections", "connections_file.xsd", attrs); const bool writeNames = oc.getBool("output.street-names"); for (std::map::const_iterator i = ec.begin(); i != ec.end(); ++i) { // write the edge itself to the edges-files @@ -197,7 +202,7 @@ } } if (geoAccuracy) { - edevice.setPrecision(GEO_OUTPUT_ACCURACY); + edevice.setPrecision(gPrecisionGeo); } edevice.writeAttr(SUMO_ATTR_SHAPE, geom); if (geoAccuracy) { @@ -242,6 +247,9 @@ if (e->hasLaneSpecificSpeed()) { edevice.writeAttr(SUMO_ATTR_SPEED, lane.speed); } + if (lane.accelRamp) { + edevice.writeAttr(SUMO_ATTR_ACCELERATION, lane.accelRamp); + } if (lane.oppositeID != "") { edevice.openTag(SUMO_TAG_NEIGH); edevice.writeAttr(SUMO_ATTR_LANE, lane.oppositeID); @@ -252,7 +260,6 @@ } edevice.closeTag(); // write this edge's connections to the connections-files - e->sortOutgoingConnectionsByIndex(); const std::vector connections = e->getConnections(); for (std::vector::const_iterator c = connections.begin(); c != connections.end(); ++c) { NWWriter_SUMO::writeConnection(cdevice, *e, *c, false, NWWriter_SUMO::PLAIN); @@ -303,8 +310,10 @@ void NWWriter_XML::writeTrafficLights(const OptionsCont& oc, NBTrafficLightLogicCont& tc, NBEdgeCont& ec) { + std::map attrs; + attrs[SUMO_ATTR_VERSION] = NWFrame::MAJOR_VERSION; OutputDevice& device = OutputDevice::getDevice(oc.getString("plain-output-prefix") + ".tll.xml"); - device.writeXMLHeader("tlLogics", NWFrame::MAJOR_VERSION + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/tllogic_file.xsd\""); + device.writeXMLHeader("tlLogics", "tllogic_file.xsd", attrs); NWWriter_SUMO::writeTrafficLights(device, tc); // we also need to remember the associations between tlLogics and connections // since the information in con.xml is insufficient @@ -324,8 +333,10 @@ void NWWriter_XML::writeJoinedJunctions(const OptionsCont& oc, NBNodeCont& nc) { + std::map attrs; + attrs[SUMO_ATTR_VERSION] = NWFrame::MAJOR_VERSION; OutputDevice& device = OutputDevice::getDevice(oc.getString("junctions.join-output")); - device.writeXMLHeader("nodes", NWFrame::MAJOR_VERSION + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/nodes_file.xsd\""); + device.writeXMLHeader("nodes", "nodes_file.xsd", attrs); const std::vector >& clusters = nc.getJoinedClusters(); for (std::vector >::const_iterator it = clusters.begin(); it != clusters.end(); it++) { assert((*it).size() > 0); @@ -347,7 +358,7 @@ void NWWriter_XML::writeStreetSigns(const OptionsCont& oc, NBEdgeCont& ec) { OutputDevice& device = OutputDevice::getDevice(oc.getString("street-sign-output")); - device.writeXMLHeader("additional", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/additional_file.xsd\""); + device.writeXMLHeader("additional", "additional_file.xsd"); for (std::map::const_iterator i = ec.begin(); i != ec.end(); ++i) { NBEdge* e = (*i).second; const std::vector& signs = e->getSigns(); @@ -357,5 +368,18 @@ } device.close(); } +void +NWWriter_XML::writePTStops(const OptionsCont& oc, NBPTStopCont& sc) { + OutputDevice& device = OutputDevice::getDevice(oc.getString("ptstop-output")); + device.writeXMLHeader("additional", "additional_file.xsd"); + for (std::map::const_iterator i = sc.begin(); i != sc.end(); ++i) { + i->second->write(device); + } + device.close(); +} + + /****************************************************************************/ + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_XML.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_XML.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/netwrite/NWWriter_XML.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/netwrite/NWWriter_XML.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 11.05.2011 -/// @version $Id: NWWriter_XML.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NWWriter_XML.h 23590 2017-03-21 18:58:41Z laemmel $ /// // Exporter writing networks using XML (native input) format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,6 +46,7 @@ class NBNetBuilder; class NBNode; class NBNodeCont; +class NBPTStopCont; class NBTrafficLightLogicCont; class NBTypeCont; class OptionsCont; @@ -107,6 +108,11 @@ */ static void writeTrafficLights(const OptionsCont& oc, NBTrafficLightLogicCont& tc, NBEdgeCont& ec); + /** @brief Writes the pt stops file + * @param[in] oc The options to use + * @param[in] nc The pt stop container from which to read data + */ + static void writePTStops(const OptionsCont& oc, NBPTStopCont& ec); }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODAmitranHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODAmitranHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODAmitranHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODAmitranHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file ODAmitranHandler.cpp /// @author Michael Behrisch /// @date 27.03.2014 -/// @version $Id: ODAmitranHandler.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ODAmitranHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // An XML-Handler for Amitran OD matrices /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,10 +32,6 @@ #include "ODMatrix.h" #include "ODAmitranHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -62,7 +58,7 @@ } break; case SUMO_TAG_OD_PAIR: - myMatrix.add(attrs.get(SUMO_ATTR_AMOUNT, myVehicleType.c_str(), ok), + myMatrix.add(attrs.get(SUMO_ATTR_AMOUNT, myVehicleType.c_str(), ok), myBegin, myEnd, attrs.get(SUMO_ATTR_ORIGIN, myVehicleType.c_str(), ok), attrs.get(SUMO_ATTR_DESTINATION, myVehicleType.c_str(), ok), myVehicleType); break; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODAmitranHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODAmitranHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODAmitranHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODAmitranHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file ODAmitranHandler.h /// @author Michael Behrisch /// @date 27.03.2014 -/// @version $Id: ODAmitranHandler.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ODAmitranHandler.h 22608 2017-01-17 06:28:54Z behrisch $ /// // An XML-Handler for Amitran OD matrices /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODCell.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODCell.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODCell.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODCell.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Yun-Pang Floetteroed /// @date Sept 2002 -/// @version $Id: ODCell.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ODCell.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A single O/D-matrix cell /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -57,7 +57,7 @@ */ struct ODCell { /// @brief The number of vehicles - SUMOReal vehicleNumber; + double vehicleNumber; /// @brief The begin time this cell describes SUMOTime begin; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODDistrictCont.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODDistrictCont.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODDistrictCont.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODDistrictCont.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Yun-Pang Floetteroed /// @date Sept 2002 -/// @version $Id: ODDistrictCont.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ODDistrictCont.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A container for districts /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,10 +43,6 @@ #include "ODDistrictCont.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODDistrictCont.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODDistrictCont.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODDistrictCont.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODDistrictCont.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Yun-Pang Floetteroed /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: ODDistrictCont.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ODDistrictCont.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A container for districts /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODDistrict.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODDistrict.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODDistrict.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODDistrict.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Yun-Pang Floetteroed /// @date Sept 2002 -/// @version $Id: ODDistrict.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: ODDistrict.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A district (origin/destination) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,6 @@ #include "ODDistrict.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -55,14 +51,14 @@ void -ODDistrict::addSource(const std::string& id, SUMOReal weight) { - mySources.add(weight, id); +ODDistrict::addSource(const std::string& id, double weight) { + mySources.add(id, weight); } void -ODDistrict::addSink(const std::string& id, SUMOReal weight) { - mySinks.add(weight, id); +ODDistrict::addSink(const std::string& id, double weight) { + mySinks.add(id, weight); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODDistrict.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODDistrict.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODDistrict.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODDistrict.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: ODDistrict.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: ODDistrict.h 23341 2017-03-13 10:11:12Z behrisch $ /// // A district (origin/destination) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,7 +36,7 @@ #include #include #include -#include +#include // =========================================================================== @@ -75,7 +75,7 @@ * @param[in] id The id of the source * @param[in] weight The weight (probability to be chosen) of the source */ - void addSource(const std::string& id, SUMOReal weight); + void addSource(const std::string& id, double weight); /** @brief Adds a sink connection @@ -91,7 +91,7 @@ * @param[in] id The id of the sink * @param[in] weight The weight (probability to be chosen) of the sink */ - void addSink(const std::string& id, SUMOReal weight); + void addSink(const std::string& id, double weight); /** @brief Returns the id of a source to use diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODDistrictHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODDistrictHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODDistrictHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODDistrictHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: ODDistrictHandler.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ODDistrictHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // An XML-Handler for districts /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,10 +42,6 @@ #include "ODDistrictCont.h" #include "ODDistrictHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -107,7 +103,7 @@ void ODDistrictHandler::addSource(const SUMOSAXAttributes& attrs) { - std::pair vals = parseTAZ(attrs); + std::pair vals = parseTAZ(attrs); if (vals.second >= 0) { myCurrentDistrict->addSource(vals.first, vals.second); } @@ -116,7 +112,7 @@ void ODDistrictHandler::addSink(const SUMOSAXAttributes& attrs) { - std::pair vals = parseTAZ(attrs); + std::pair vals = parseTAZ(attrs); if (vals.second >= 0) { myCurrentDistrict->addSink(vals.first, vals.second); } @@ -124,28 +120,28 @@ -std::pair +std::pair ODDistrictHandler::parseTAZ(const SUMOSAXAttributes& attrs) { // check the current district first if (myCurrentDistrict == 0) { - return std::pair("", -1); + return std::pair("", -1); } // get the id, report an error if not given or empty... bool ok = true; std::string id = attrs.get(SUMO_ATTR_ID, 0, ok); if (!ok) { - return std::pair("", -1); + return std::pair("", -1); } // get the weight - SUMOReal weight = attrs.get(SUMO_ATTR_WEIGHT, id.c_str(), ok); + double weight = attrs.get(SUMO_ATTR_WEIGHT, id.c_str(), ok); if (ok) { if (weight < 0) { WRITE_ERROR("'probability' must be positive (in definition of " + attrs.getObjectType() + " '" + id + "')."); } else { - return std::pair(id, weight); + return std::pair(id, weight); } } - return std::pair("", -1); + return std::pair("", -1); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODDistrictHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODDistrictHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODDistrictHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODDistrictHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: ODDistrictHandler.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ODDistrictHandler.h 23150 2017-02-27 12:08:30Z behrisch $ /// // An XML-Handler for districts /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -160,7 +160,7 @@ * @param[in] type The type of the currntly processed connection (sink/source) * @return The id and the weight of a taz */ - std::pair parseTAZ(const SUMOSAXAttributes& attrs); + std::pair parseTAZ(const SUMOSAXAttributes& attrs); private: /// The container to add read districts to diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODMatrix.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODMatrix.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODMatrix.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODMatrix.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Yun-Pang Floetteroed /// @date 05 Apr. 2006 -/// @version $Id: ODMatrix.cpp 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: ODMatrix.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // An O/D (origin/destination) matrix /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2006-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2006-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -51,10 +51,6 @@ #include "ODAmitranHandler.h" #include "ODMatrix.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -72,7 +68,7 @@ bool -ODMatrix::add(SUMOReal vehicleNumber, SUMOTime begin, +ODMatrix::add(double vehicleNumber, SUMOTime begin, SUMOTime end, const std::string& origin, const std::string& destination, const std::string& vehicleType) { myNumLoaded += vehicleNumber; @@ -149,27 +145,27 @@ } -SUMOReal +double ODMatrix::computeDeparts(ODCell* cell, int& vehName, std::vector& into, const bool uniform, const bool differSourceSink, const std::string& prefix) { int vehicles2insert = (int) cell->vehicleNumber; // compute whether the fraction forces an additional vehicle insertion - if (RandHelper::rand() < cell->vehicleNumber - (SUMOReal)vehicles2insert) { + if (RandHelper::rand() < cell->vehicleNumber - (double)vehicles2insert) { vehicles2insert++; } if (vehicles2insert == 0) { return cell->vehicleNumber; } - const SUMOReal offset = (SUMOReal)(cell->end - cell->begin) / (SUMOReal) vehicles2insert / (SUMOReal) 2.; + const double offset = (double)(cell->end - cell->begin) / (double) vehicles2insert / (double) 2.; for (int i = 0; i < vehicles2insert; ++i) { ODVehicle veh; veh.id = prefix + toString(vehName++); if (uniform) { - veh.depart = (SUMOTime)(offset + cell->begin + ((SUMOReal)(cell->end - cell->begin) * (SUMOReal) i / (SUMOReal) vehicles2insert)); + veh.depart = (SUMOTime)(offset + cell->begin + ((double)(cell->end - cell->begin) * (double) i / (double) vehicles2insert)); } else { veh.depart = (SUMOTime)RandHelper::rand(cell->begin, cell->end); } @@ -225,7 +221,7 @@ if (myContainer.size() == 0) { return; } - std::map, SUMOReal> fractionLeft; + std::map, double> fractionLeft; int vehName = 0; sortByBeginTime(); // recheck begin time @@ -250,7 +246,7 @@ } // get the new departures (into tmp) const int oldSize = (int)vehicles.size(); - const SUMOReal fraction = computeDeparts(*next, vehName, vehicles, uniform, differSourceSink, prefix); + const double fraction = computeDeparts(*next, vehName, vehicles, uniform, differSourceSink, prefix); if (oldSize != (int)vehicles.size()) { changed = true; } @@ -290,7 +286,8 @@ void ODMatrix::writeFlows(const SUMOTime begin, const SUMOTime end, OutputDevice& dev, bool noVtype, - const std::string& prefix) { + const std::string& prefix, + bool asProbability) { if (myContainer.size() == 0) { return; } @@ -302,7 +299,20 @@ if (c->end > begin && c->begin < end) { dev.openTag(SUMO_TAG_FLOW).writeAttr(SUMO_ATTR_ID, prefix + toString(flowName++)); dev.writeAttr(SUMO_ATTR_BEGIN, time2string(c->begin)); - dev.writeAttr(SUMO_ATTR_END, time2string(c->end)).writeAttr(SUMO_ATTR_NUMBER, int(c->vehicleNumber)); + dev.writeAttr(SUMO_ATTR_END, time2string(c->end)); + if (!asProbability) { + dev.writeAttr(SUMO_ATTR_NUMBER, int(c->vehicleNumber)); + } else { + const double probability = float(c->vehicleNumber) / STEPS2TIME(c->end - c->begin); + if (probability > 1) { + WRITE_WARNING("Flow density of " + toString(probability) + " vehicles per second, cannot be represented with a simple probability. Falling back to even spacing."); + dev.writeAttr(SUMO_ATTR_NUMBER, int(c->vehicleNumber)); + } else { + dev.setPrecision(6); + dev.writeAttr(SUMO_ATTR_PROB, probability); + dev.setPrecision(); + } + } writeDefaultAttrs(dev, noVtype, *i); dev.closeTag(); } @@ -352,12 +362,12 @@ } } -SUMOReal -ODMatrix::readFactor(LineReader& lr, SUMOReal scale) { +double +ODMatrix::readFactor(LineReader& lr, double scale) { std::string line = getNextNonCommentLine(lr); - SUMOReal factor = -1; + double factor = -1; try { - factor = TplConvert::_2SUMOReal(line.c_str()) * scale; + factor = TplConvert::_2double(line.c_str()) * scale; } catch (NumberFormatException&) { throw ProcessError("Broken factor: '" + line + "'."); } @@ -365,7 +375,7 @@ } void -ODMatrix::readV(LineReader& lr, SUMOReal scale, +ODMatrix::readV(LineReader& lr, double scale, std::string vehType, bool matrixHasVehType) { PROGRESS_BEGIN_MESSAGE("Reading matrix '" + lr.getFileName() + "' stored as VMR"); // parse first defs @@ -383,7 +393,7 @@ SUMOTime end = times.second; // factor - SUMOReal factor = readFactor(lr, scale); + double factor = readFactor(lr, scale); // districts line = getNextNonCommentLine(lr); @@ -411,7 +421,7 @@ StringTokenizer st2(line, StringTokenizer::WHITECHARS); while (st2.hasNext()) { assert(di != names.end()); - SUMOReal vehNumber = TplConvert::_2SUMOReal(st2.next().c_str()) * factor; + double vehNumber = TplConvert::_2double(st2.next().c_str()) * factor; if (vehNumber != 0) { add(vehNumber, begin, end, *si, *di, vehType); } @@ -433,7 +443,7 @@ void -ODMatrix::readO(LineReader& lr, SUMOReal scale, +ODMatrix::readO(LineReader& lr, double scale, std::string vehType, bool matrixHasVehType) { PROGRESS_BEGIN_MESSAGE("Reading matrix '" + lr.getFileName() + "' stored as OR"); // parse first defs @@ -452,7 +462,7 @@ SUMOTime end = times.second; // factor - SUMOReal factor = readFactor(lr, scale); + double factor = readFactor(lr, scale); // parse the cells while (lr.hasMore()) { @@ -467,7 +477,7 @@ try { std::string sourceD = st2.next(); std::string destD = st2.next(); - SUMOReal vehNumber = TplConvert::_2SUMOReal(st2.next().c_str()) * factor; + double vehNumber = TplConvert::_2double(st2.next().c_str()) * factor; if (vehNumber != 0) { add(vehNumber, begin, end, sourceD, destD, vehType); } @@ -482,19 +492,19 @@ -SUMOReal +double ODMatrix::getNumLoaded() const { return myNumLoaded; } -SUMOReal +double ODMatrix::getNumWritten() const { return myNumWritten; } -SUMOReal +double ODMatrix::getNumDiscarded() const { return myNumDiscarded; } @@ -502,14 +512,15 @@ void ODMatrix::applyCurve(const Distribution_Points& ps, ODCell* cell, std::vector& newCells) { - for (int i = 0; i < ps.getAreaNo(); ++i) { + const std::vector& times = ps.getVals(); + for (int i = 0; i < (int)times.size() - 1; ++i) { ODCell* ncell = new ODCell(); - ncell->begin = TIME2STEPS(ps.getAreaBegin(i)); - ncell->end = TIME2STEPS(ps.getAreaEnd(i)); + ncell->begin = TIME2STEPS(times[i]); + ncell->end = TIME2STEPS(times[i + 1]); ncell->origin = cell->origin; ncell->destination = cell->destination; ncell->vehicleType = cell->vehicleType; - ncell->vehicleNumber = cell->vehicleNumber * ps.getAreaPerc(i); + ncell->vehicleNumber = cell->vehicleNumber * ps.getProbs()[i] / ps.getOverallProb(); newCells.push_back(ncell); } } @@ -593,31 +604,26 @@ Distribution_Points ODMatrix::parseTimeLine(const std::vector& def, bool timelineDayInHours) { - bool interpolating = !timelineDayInHours; - PositionVector points; - SUMOReal prob = 0; + Distribution_Points result("N/A"); if (timelineDayInHours) { if (def.size() != 24) { throw ProcessError("Assuming 24 entries for a day timeline, but got " + toString(def.size()) + "."); } for (int chour = 0; chour < 24; ++chour) { - prob = TplConvert::_2SUMOReal(def[chour].c_str()); - points.push_back(Position((SUMOReal)(chour * 3600), prob)); + result.add(chour * 3600., TplConvert::_2double(def[chour].c_str())); } - points.push_back(Position((SUMOReal)(24 * 3600), prob)); + result.add(24 * 3600., 0.); // dummy value to finish the last interval } else { - int i = 0; - while (i < (int)def.size()) { - StringTokenizer st2(def[i++], ":"); + for (int i = 0; i < (int)def.size(); i++) { + StringTokenizer st2(def[i], ":"); if (st2.size() != 2) { - throw ProcessError("Broken time line definition: missing a value in '" + def[i - 1] + "'."); + throw ProcessError("Broken time line definition: missing a value in '" + def[i] + "'."); } - const SUMOReal time = TplConvert::_2SUMOReal(st2.next().c_str()); - prob = TplConvert::_2SUMOReal(st2.next().c_str()); - points.push_back(Position(time, prob)); + const double time = TplConvert::_2double(st2.next().c_str()); + result.add(time, TplConvert::_2double(st2.next().c_str())); } } - return Distribution_Points("N/A", points, interpolating); + return result; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODMatrix.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODMatrix.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od/ODMatrix.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od/ODMatrix.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Yun-Pang Floetteroed /// @date 05. Apr. 2006 -/// @version $Id: ODMatrix.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: ODMatrix.h 24108 2017-04-27 18:43:30Z behrisch $ /// // An O/D (origin/destination) matrix /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2006-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2006-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -108,7 +108,7 @@ * @param[in] vehicleType The vehicle type to use for the cell's flows * @return whether the cell could be added */ - bool add(SUMOReal vehicleNumber, SUMOTime begin, + bool add(double vehicleNumber, SUMOTime begin, SUMOTime end, const std::string& origin, const std::string& destination, const std::string& vehicleType); @@ -175,10 +175,12 @@ * @param[in] dev The stream to write the generated vehicle trips to * @param[in] noVtype Whether vtype information shall not be written * @param[in] prefix A prefix for the flow names + * @param[in] asProbability Write probability to spawn per second instead of number of vehicles */ void writeFlows(const SUMOTime begin, const SUMOTime end, OutputDevice& dev, const bool noVtype, - const std::string& prefix); + const std::string& prefix, + bool asProbability = false); /** @brief Returns the number of loaded vehicles @@ -187,7 +189,7 @@ * * @return The number of loaded vehicles */ - SUMOReal getNumLoaded() const; + double getNumLoaded() const; /** @brief Returns the number of written vehicles @@ -196,7 +198,7 @@ * * @return The number of written vehicles */ - SUMOReal getNumWritten() const; + double getNumWritten() const; /** @brief Returns the number of discarded vehicles @@ -205,7 +207,7 @@ * * @return The number of discarded vehicles */ - SUMOReal getNumDiscarded() const; + double getNumDiscarded() const; /** @brief Splits the stored cells dividing them on the given time line @@ -217,13 +219,13 @@ /** @brief read a VISUM-matrix with the O Format * @todo Describe */ - void readO(LineReader& lr, SUMOReal scale, + void readO(LineReader& lr, double scale, std::string vehType, bool matrixHasVehType); /** @brief read a VISUM-matrix with the V Format * @todo Describe */ - void readV(LineReader& lr, SUMOReal scale, + void readV(LineReader& lr, double scale, std::string vehType, bool matrixHasVehType); /** @brief read a matrix in one of several formats @@ -292,10 +294,10 @@ * @param[in] prefix A prefix for the vehicle names * @return The number of left vehicles to insert */ - SUMOReal computeDeparts(ODCell* cell, - int& vehName, std::vector& into, - const bool uniform, const bool differSourceSink, - const std::string& prefix); + double computeDeparts(ODCell* cell, + int& vehName, std::vector& into, + const bool uniform, const bool differSourceSink, + const std::string& prefix); /** @brief Splits the given cell dividing it on the given time line and @@ -336,7 +338,7 @@ /** @used in the functions readV and readO * @todo Describe */ - SUMOReal readFactor(LineReader& lr, SUMOReal scale); + double readFactor(LineReader& lr, double scale); private: @@ -353,13 +355,13 @@ std::set myMissingDistricts; /// @brief Number of loaded vehicles - SUMOReal myNumLoaded; + double myNumLoaded; /// @brief Number of written vehicles - SUMOReal myNumWritten; + double myNumWritten; /// @brief Number of discarded vehicles - SUMOReal myNumDiscarded; + double myNumDiscarded; /** diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od2trips_main.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od2trips_main.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/od2trips_main.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/od2trips_main.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Laura Bieker /// @author Yun-Pang Floetteroed /// @date Thu, 12 September 2002 -/// @version $Id: od2trips_main.cpp 20834 2016-06-01 07:22:25Z behrisch $ +/// @version $Id: od2trips_main.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Main for OD2TRIPS /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -64,10 +64,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // functions @@ -113,6 +109,9 @@ oc.doRegister("flow-output", new Option_FileName()); oc.addDescription("flow-output", "Output", "Writes flow definitions into FILE"); + oc.doRegister("flow-output.probability", new Option_Bool(false)); + oc.addDescription("flow-output.probability", "Output", "Writes probabilistic flow instead of evenly spaced flow"); + oc.doRegister("ignore-vehicle-type", new Option_Bool(false)); oc.addSynonyme("ignore-vehicle-type", "no-vtype", true); oc.addDescription("ignore-vehicle-type", "Output", "Does not save vtype information"); @@ -292,7 +291,8 @@ if (OutputDevice::createDeviceByOption("flow-output", "routes", "routes_file.xsd")) { matrix.writeFlows(string2time(oc.getString("begin")), string2time(oc.getString("end")), OutputDevice::getDeviceByOption("flow-output"), - oc.getBool("ignore-vehicle-type"), oc.getString("prefix")); + oc.getBool("ignore-vehicle-type"), oc.getString("prefix"), + oc.getBool("flow-output.probability")); haveOutput = true; } if (!haveOutput) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/osgview/GUIOSGBoundingBoxCalculator.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/osgview/GUIOSGBoundingBoxCalculator.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/osgview/GUIOSGBoundingBoxCalculator.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/osgview/GUIOSGBoundingBoxCalculator.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,13 +3,13 @@ /// @author Gordon Thomlinson /// @author Michael Behrisch /// @date 19.01.2012 -/// @version $Id: GUIOSGBoundingBoxCalculator.h 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: GUIOSGBoundingBoxCalculator.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Calculates the bounding box of an osg node // original source: http://www.vis-sim.com/osg/code/osgcode_bbox1.htm /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/osgview/GUIOSGBuilder.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/osgview/GUIOSGBuilder.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/osgview/GUIOSGBuilder.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/osgview/GUIOSGBuilder.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 19.01.2012 -/// @version $Id: GUIOSGBuilder.cpp 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: GUIOSGBuilder.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Builds OSG nodes from microsim objects /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,6 +31,10 @@ #ifdef HAVE_OSG +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4127) // do not warn about constant conditional expression +#endif #include #include #include @@ -49,6 +53,10 @@ #include #include #include +#ifdef _MSC_VER +#pragma warning(pop) +#endif + #include #include #include @@ -68,10 +76,6 @@ #include "GUIOSGView.h" #include "GUIOSGBuilder.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member variables @@ -109,7 +113,7 @@ for (MSTrafficLightLogic::LaneVectorVector::const_iterator j = lanes.begin(); j != lanes.end(); ++j, ++idx) { const MSLane* const lane = (*j)[0]; const Position pos = lane->getShape().back(); - const SUMOReal angle = osg::DegreesToRadians(lane->getShape().rotationDegreeAtOffset(-1.) + 90.); + const double angle = osg::DegreesToRadians(lane->getShape().rotationDegreeAtOffset(-1.) + 90.); d.centerZ = pos.z() + 4.; if (lane == lastLane) { d.centerX += 1.2 * sin(angle); @@ -119,10 +123,10 @@ d.centerY = pos.y() - 1.5 * cos(angle); } osg::Switch* switchNode = new osg::Switch(); - switchNode->addChild(getTrafficLight(d, tlg, osg::Vec4(0.1, 0.5, 0.1, 1.0), .25), false); - switchNode->addChild(getTrafficLight(d, tly, osg::Vec4(0.5, 0.5, 0.1, 1.0), .25), false); - switchNode->addChild(getTrafficLight(d, tlr, osg::Vec4(0.5, 0.1, 0.1, 1.0), .25), false); - switchNode->addChild(getTrafficLight(d, tlu, osg::Vec4(0.8, 0.4, 0.0, 1.0), .25), false); + switchNode->addChild(getTrafficLight(d, tlg, osg::Vec4d(0.1, 0.5, 0.1, 1.0), .25), false); + switchNode->addChild(getTrafficLight(d, tly, osg::Vec4d(0.5, 0.5, 0.1, 1.0), .25), false); + switchNode->addChild(getTrafficLight(d, tlr, osg::Vec4d(0.5, 0.1, 0.1, 1.0), .25), false); + switchNode->addChild(getTrafficLight(d, tlu, osg::Vec4d(0.8, 0.4, 0.0, 1.0), .25), false); root->addChild(switchNode); const MSLink* const l = vars.getActive()->getLinksAt(idx)[0]; vars.addSwitchCommand(new GUIOSGView::Command_TLSChange(l, switchNode)); @@ -150,8 +154,8 @@ osg::PositionAttitudeTransform* lightTransform = new osg::PositionAttitudeTransform(); lightTransform->addChild(lightSource); - lightTransform->setPosition(osg::Vec3(d.centerX, d.centerY, d.centerZ)); - lightTransform->setScale(osg::Vec3(0.1, 0.1, 0.1)); + lightTransform->setPosition(osg::Vec3d(d.centerX, d.centerY, d.centerZ)); + lightTransform->setScale(osg::Vec3d(0.1, 0.1, 0.1)); addTo.addChild(lightTransform); } @@ -168,7 +172,7 @@ osg::Geometry* geom = new osg::Geometry(); geode->addDrawable(geom); addTo.addChild(geode); - osg::Vec3Array* osg_coords = new osg::Vec3Array(shape.size() * 2); + osg::Vec3dArray* osg_coords = new osg::Vec3dArray((int)shape.size() * 2); geom->setVertexArray(osg_coords); PositionVector rshape = shape; rshape.move2side(SUMO_const_halfLaneWidth); @@ -197,7 +201,7 @@ geom->setColorArray(osg_colors); geom->setColorBinding(osg::Geometry::BIND_OVERALL); #endif - geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON, 0, shape.size() * 2)); + geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON, 0, (int)shape.size() * 2)); osg::ref_ptr ss = geode->getOrCreateStateSet(); ss->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); @@ -220,12 +224,12 @@ osg::Geometry* geom = new osg::Geometry(); geode->addDrawable(geom); addTo.addChild(geode); - osg::Vec3Array* osg_coords = new osg::Vec3Array(shape.size()); + osg::Vec3dArray* osg_coords = new osg::Vec3dArray((int)shape.size()); geom->setVertexArray(osg_coords); for (int k = 0; k < (int)shape.size(); ++k) { (*osg_coords)[k].set(shape[k].x(), shape[k].y(), shape[k].z()); } - osg::Vec3Array* osg_normals = new osg::Vec3Array(1); + osg::Vec3dArray* osg_normals = new osg::Vec3dArray(1); (*osg_normals)[0] = osg::Vec3(0, 0, 1); #if OSG_MIN_VERSION_REQUIRED(3,2,0) geom->setNormalArray(osg_normals, osg::Array::BIND_PER_PRIMITIVE_SET); @@ -241,7 +245,7 @@ geom->setColorArray(osg_colors); geom->setColorBinding(osg::Geometry::BIND_OVERALL); #endif - geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON, 0, shape.size())); + geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON, 0, (int)shape.size())); osg::ref_ptr ss = geode->getOrCreateStateSet(); ss->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); @@ -270,23 +274,23 @@ pLoadedModel->accept(bboxCalc); const osg::BoundingBox& bbox = bboxCalc.getBoundingBox(); WRITE_MESSAGE("Loaded decal '" + d.filename + "' with bounding box " + toString(Position(bbox.xMin(), bbox.yMin(), bbox.zMin())) + " " + toString(Position(bbox.xMax(), bbox.yMax(), bbox.zMax())) + "."); - SUMOReal xScale = d.width > 0 ? d.width / (bbox.xMax() - bbox.xMin()) : 1.; - SUMOReal yScale = d.height > 0 ? d.height / (bbox.yMax() - bbox.yMin()) : 1.; - const SUMOReal zScale = d.altitude > 0 ? d.altitude / (bbox.zMax() - bbox.zMin()) : 1.; + double xScale = d.width > 0 ? d.width / (bbox.xMax() - bbox.xMin()) : 1.; + double yScale = d.height > 0 ? d.height / (bbox.yMax() - bbox.yMin()) : 1.; + const double zScale = d.altitude > 0 ? d.altitude / (bbox.zMax() - bbox.zMin()) : 1.; if (d.width < 0 && d.height < 0 && d.altitude > 0) { xScale = yScale = zScale; } - base->setScale(osg::Vec3(xScale, yScale, zScale)); - base->setPosition(osg::Vec3(d.centerX, d.centerY, d.centerZ)); - base->setAttitude(osg::Quat(osg::DegreesToRadians(d.roll), osg::Vec3(1, 0, 0), - osg::DegreesToRadians(d.tilt), osg::Vec3(0, 1, 0), - osg::DegreesToRadians(d.rot), osg::Vec3(0, 0, 1))); + base->setScale(osg::Vec3d(xScale, yScale, zScale)); + base->setPosition(osg::Vec3d(d.centerX, d.centerY, d.centerZ)); + base->setAttitude(osg::Quat(osg::DegreesToRadians(d.roll), osg::Vec3d(1, 0, 0), + osg::DegreesToRadians(d.tilt), osg::Vec3d(0, 1, 0), + osg::DegreesToRadians(d.rot), osg::Vec3d(0, 0, 1))); addTo.addChild(base); } osg::PositionAttitudeTransform* -GUIOSGBuilder::getTrafficLight(const GUISUMOAbstractView::Decal& d, osg::Node* tl, const osg::Vec4& color, const SUMOReal size) { +GUIOSGBuilder::getTrafficLight(const GUISUMOAbstractView::Decal& d, osg::Node* tl, const osg::Vec4& color, const double size) { osg::PositionAttitudeTransform* ret = new osg::PositionAttitudeTransform(); if (tl != 0) { osg::PositionAttitudeTransform* base = new osg::PositionAttitudeTransform(); @@ -294,22 +298,22 @@ GUIOSGBoundingBoxCalculator bboxCalc; tl->accept(bboxCalc); const osg::BoundingBox& bbox = bboxCalc.getBoundingBox(); - SUMOReal xScale = d.width > 0 ? d.width / (bbox.xMax() - bbox.xMin()) : 1.; - SUMOReal yScale = d.height > 0 ? d.height / (bbox.yMax() - bbox.yMin()) : 1.; - const SUMOReal zScale = d.altitude > 0 ? d.altitude / (bbox.zMax() - bbox.zMin()) : 1.; + double xScale = d.width > 0 ? d.width / (bbox.xMax() - bbox.xMin()) : 1.; + double yScale = d.height > 0 ? d.height / (bbox.yMax() - bbox.yMin()) : 1.; + const double zScale = d.altitude > 0 ? d.altitude / (bbox.zMax() - bbox.zMin()) : 1.; if (d.width < 0 && d.height < 0 && d.altitude > 0) { xScale = yScale = zScale; } - base->setScale(osg::Vec3(xScale, yScale, zScale)); - base->setPosition(osg::Vec3(d.centerX, d.centerY, d.centerZ)); + base->setScale(osg::Vec3d(xScale, yScale, zScale)); + base->setPosition(osg::Vec3d(d.centerX, d.centerY, d.centerZ)); base->setAttitude(osg::Quat(osg::DegreesToRadians(d.roll), osg::Vec3(1, 0, 0), osg::DegreesToRadians(d.tilt), osg::Vec3(0, 1, 0), osg::DegreesToRadians(d.rot), osg::Vec3(0, 0, 1))); ret->addChild(base); } osg::Geode* geode = new osg::Geode(); - osg::Vec3 center(d.centerX, d.centerY, d.centerZ); - osg::ShapeDrawable* shape = new osg::ShapeDrawable(new osg::Sphere(center, size)); + osg::Vec3d center(d.centerX, d.centerY, d.centerZ); + osg::ShapeDrawable* shape = new osg::ShapeDrawable(new osg::Sphere(center, (float)size)); geode->addDrawable(shape); osg::ref_ptr ss = shape->getOrCreateStateSet(); ss->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); @@ -318,7 +322,7 @@ ellipse->addChild(geode); ellipse->setPivotPoint(center); ellipse->setPosition(center); - ellipse->setScale(osg::Vec3(4., 4., 2.5 * d.altitude + 1.1)); + ellipse->setScale(osg::Vec3d(4., 4., 2.5 * d.altitude + 1.1)); shape->setColor(color); ret->addChild(ellipse); return ret; @@ -337,7 +341,7 @@ GUIOSGBuilder::buildMovable(const MSVehicleType& type) { GUIOSGView::OSGMovable m; m.pos = new osg::PositionAttitudeTransform(); - SUMOReal enlarge = 0.; + double enlarge = 0.; const std::string& osgFile = type.getOSGFile(); if (myCars.find(osgFile) == myCars.end()) { myCars[osgFile] = osgDB::readNodeFile(osgFile); @@ -352,17 +356,17 @@ const osg::BoundingBox& bbox = bboxCalc.getBoundingBox(); osg::PositionAttitudeTransform* base = new osg::PositionAttitudeTransform(); base->addChild(carNode); - base->setPivotPoint(osg::Vec3((bbox.xMin() + bbox.xMax()) / 2., bbox.yMin(), bbox.zMin())); - base->setScale(osg::Vec3(type.getWidth() / (bbox.xMax() - bbox.xMin()), - type.getLength() / (bbox.yMax() - bbox.yMin()), - type.getHeight() / (bbox.zMax() - bbox.zMin()))); + base->setPivotPoint(osg::Vec3d((bbox.xMin() + bbox.xMax()) / 2., bbox.yMin(), bbox.zMin())); + base->setScale(osg::Vec3d(type.getWidth() / (bbox.xMax() - bbox.xMin()), + type.getLength() / (bbox.yMax() - bbox.yMin()), + type.getHeight() / (bbox.zMax() - bbox.zMin()))); m.pos->addChild(base); enlarge = type.getMinGap() / 2.; } m.lights = new osg::Switch(); - for (SUMOReal offset = -0.3; offset < 0.5; offset += 0.6) { + for (double offset = -0.3; offset < 0.5; offset += 0.6) { osg::Geode* geode = new osg::Geode(); - osg::ShapeDrawable* right = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(offset, (type.getLength() - .9) / 2., (type.getHeight() - .5) / 2.), .1f)); + osg::ShapeDrawable* right = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3d(offset, (type.getLength() - .9) / 2., (type.getHeight() - .5) / 2.), .1f)); geode->addDrawable(right); setShapeState(right); right->setColor(osg::Vec4(1.f, .5f, 0.f, .8f)); @@ -381,8 +385,8 @@ osg::Geode* geode = new osg::Geode(); osg::CompositeShape* comp = new osg::CompositeShape(); - comp->addChild(new osg::Sphere(osg::Vec3(-0.3, (type.getLength() + .8) / 2., (type.getHeight() - .5) / 2.), .1f)); - comp->addChild(new osg::Sphere(osg::Vec3(0.3, (type.getLength() + .8) / 2., (type.getHeight() - .5) / 2.), .1f)); + comp->addChild(new osg::Sphere(osg::Vec3d(-0.3, (type.getLength() + .8) / 2., (type.getHeight() - .5) / 2.), .1f)); + comp->addChild(new osg::Sphere(osg::Vec3d(0.3, (type.getLength() + .8) / 2., (type.getHeight() - .5) / 2.), .1f)); osg::ShapeDrawable* brake = new osg::ShapeDrawable(comp); brake->setColor(osg::Vec4(1.f, 0.f, 0.f, .8f)); geode->addDrawable(brake); @@ -390,7 +394,7 @@ m.lights->addChild(geode); geode = new osg::Geode(); - osg::Vec3 center(0, type.getLength() / 2., type.getHeight() / 2.); + osg::Vec3d center(0, type.getLength() / 2., type.getHeight() / 2.); m.geom = new osg::ShapeDrawable(new osg::Sphere(center, .5f)); geode->addDrawable(m.geom); setShapeState(m.geom); @@ -399,7 +403,7 @@ ellipse->addChild(m.lights); ellipse->setPivotPoint(center); ellipse->setPosition(center); - ellipse->setScale(osg::Vec3(type.getWidth() + enlarge, type.getLength() + enlarge, type.getHeight() + enlarge)); + ellipse->setScale(osg::Vec3d(type.getWidth() + enlarge, type.getLength() + enlarge, type.getHeight() + enlarge)); m.pos->addChild(ellipse); return m; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/osgview/GUIOSGBuilder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/osgview/GUIOSGBuilder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/osgview/GUIOSGBuilder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/osgview/GUIOSGBuilder.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUIOSGBuilder.h /// @author Daniel Krajzewicz /// @date 19.01.2012 -/// @version $Id: GUIOSGBuilder.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: GUIOSGBuilder.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Builds OSG nodes from microsim objects /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -68,7 +68,7 @@ static void buildLight(const GUISUMOAbstractView::Decal& d, osg::Group& addTo); - static osg::PositionAttitudeTransform* getTrafficLight(const GUISUMOAbstractView::Decal& d, osg::Node* tl, const osg::Vec4& color, const SUMOReal size = 0.5); + static osg::PositionAttitudeTransform* getTrafficLight(const GUISUMOAbstractView::Decal& d, osg::Node* tl, const osg::Vec4& color, const double size = 0.5); static GUIOSGView::OSGMovable buildMovable(const MSVehicleType& type); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/osgview/GUIOSGView.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/osgview/GUIOSGView.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/osgview/GUIOSGView.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/osgview/GUIOSGView.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 19.01.2012 -/// @version $Id: GUIOSGView.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUIOSGView.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // An OSG-based 3D view on the simulation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,6 +38,8 @@ // osg may include windows.h somewhere so we need to guard against macro pollution #ifdef WIN32 #define NOMINMAX +#pragma warning(push) +#pragma warning(disable: 4127) // do not warn about constant conditional expression #endif #include #include @@ -48,6 +50,7 @@ #include #ifdef WIN32 #undef NOMINMAX +#pragma warning(pop) #endif #include #include @@ -86,10 +89,6 @@ #include "GUIOSGBuilder.h" #include "GUIOSGView.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - FXDEFMAP(GUIOSGView) GUIOSGView_Map[] = { //________Message_Type_________ ___ID___ ________Message_Handler________ @@ -282,7 +281,7 @@ void -GUIOSGView::centerTo(GUIGlID id, bool /* applyZoom */, SUMOReal /* zoomDist */) { +GUIOSGView::centerTo(GUIGlID id, bool /* applyZoom */, double /* zoomDist */) { startTrack(id); } @@ -316,7 +315,7 @@ if (d.filename.length() == 6 && d.filename.substr(0, 5) == "light") { GUIOSGBuilder::buildLight(d, *myRoot); } else if (d.filename.length() > 3 && d.filename.substr(0, 3) == "tl:") { - const int linkStringIdx = d.filename.find(':', 3); + const int linkStringIdx = (int)d.filename.find(':', 3); GUINet* net = (GUINet*) MSNet::getInstance(); try { MSTLLogicControl::TLSLogicVariants& vars = net->getTLSControl().get(d.filename.substr(3, linkStringIdx - 3)); @@ -326,10 +325,10 @@ } const MSLink* const l = vars.getActive()->getLinksAt(linkIdx)[0]; osg::Switch* switchNode = new osg::Switch(); - switchNode->addChild(GUIOSGBuilder::getTrafficLight(d, d.layer < 0 ? 0 : myGreenLight, osg::Vec4(0., 1., 0., .3)), false); - switchNode->addChild(GUIOSGBuilder::getTrafficLight(d, d.layer < 0 ? 0 : myYellowLight, osg::Vec4(1., 1., 0., .3)), false); - switchNode->addChild(GUIOSGBuilder::getTrafficLight(d, d.layer < 0 ? 0 : myRedLight, osg::Vec4(1., 0., 0., .3)), false); - switchNode->addChild(GUIOSGBuilder::getTrafficLight(d, d.layer < 0 ? 0 : myRedYellowLight, osg::Vec4(1., .5, 0., .3)), false); + switchNode->addChild(GUIOSGBuilder::getTrafficLight(d, d.layer < 0 ? 0 : myGreenLight, osg::Vec4d(0., 1., 0., .3)), false); + switchNode->addChild(GUIOSGBuilder::getTrafficLight(d, d.layer < 0 ? 0 : myYellowLight, osg::Vec4d(1., 1., 0., .3)), false); + switchNode->addChild(GUIOSGBuilder::getTrafficLight(d, d.layer < 0 ? 0 : myRedLight, osg::Vec4d(1., 0., 0., .3)), false); + switchNode->addChild(GUIOSGBuilder::getTrafficLight(d, d.layer < 0 ? 0 : myRedYellowLight, osg::Vec4d(1., .5, 0., .3)), false); myRoot->addChild(switchNode); vars.addSwitchCommand(new Command_TLSChange(l, switchNode)); } catch (NumberFormatException&) { @@ -355,11 +354,11 @@ myRoot->addChild(myVehicles[veh].pos); } osg::PositionAttitudeTransform* n = myVehicles[veh].pos; - n->setPosition(osg::Vec3(veh->getPosition().x(), veh->getPosition().y(), veh->getPosition().z())); - const SUMOReal dir = veh->getAngle() + PI / 2.; - const SUMOReal slope = veh->getSlope(); - n->setAttitude(osg::Quat(dir, osg::Vec3(0, 0, 1)) * - osg::Quat(osg::DegreesToRadians(slope), osg::Vec3(0, 1, 0))); + n->setPosition(osg::Vec3d(veh->getPosition().x(), veh->getPosition().y(), veh->getPosition().z())); + const double dir = veh->getAngle() + PI / 2.; + const double slope = veh->getSlope(); + n->setAttitude(osg::Quat(dir, osg::Vec3d(0, 0, 1)) * + osg::Quat(osg::DegreesToRadians(slope), osg::Vec3d(0, 1, 0))); /* osg::ref_ptr path = new osg::AnimationPath; // path->setLoopMode( osg::AnimationPath::NO_LOOPING ); @@ -372,7 +371,7 @@ n->setUpdateCallback(new osg::AnimationPathCallback(path)); */ const RGBColor& col = myVisualizationSettings->vehicleColorer.getScheme().getColor(veh->getColorValue(myVisualizationSettings->vehicleColorer.getActive())); - myVehicles[veh].geom->setColor(osg::Vec4(col.red() / 255., col.green() / 255., col.blue() / 255., col.alpha() / 255.)); + myVehicles[veh].geom->setColor(osg::Vec4d(col.red() / 255., col.green() / 255., col.blue() / 255., col.alpha() / 255.)); myVehicles[veh].lights->setValue(0, veh->signalSet(MSVehicle::VEH_SIGNAL_BLINKER_RIGHT | MSVehicle::VEH_SIGNAL_BLINKER_EMERGENCY)); myVehicles[veh].lights->setValue(1, veh->signalSet(MSVehicle::VEH_SIGNAL_BLINKER_LEFT | MSVehicle::VEH_SIGNAL_BLINKER_EMERGENCY)); myVehicles[veh].lights->setValue(2, veh->signalSet(MSVehicle::VEH_SIGNAL_BRAKELIGHT)); @@ -387,7 +386,7 @@ lookAt[0] = myTracked->getPosition().x(); lookAt[1] = myTracked->getPosition().y(); lookAt[2] = myTracked->getPosition().z(); - const SUMOReal angle = myTracked->getAngle(); + const double angle = myTracked->getAngle(); lookFrom[0] = lookAt[0] + 50. * cos(angle); lookFrom[1] = lookAt[1] + 50. * sin(angle); lookFrom[2] = lookAt[2] + 10.; @@ -405,9 +404,9 @@ } osg::PositionAttitudeTransform* n = myPersons[person].pos; const Position pos = person->getPosition(); - n->setPosition(osg::Vec3(pos.x(), pos.y(), pos.z())); - const SUMOReal dir = person->getAngle() + PI / 2.; - n->setAttitude(osg::Quat(dir, osg::Vec3(0, 0, 1))); + n->setPosition(osg::Vec3d(pos.x(), pos.y(), pos.z())); + const double dir = person->getAngle() + PI / 2.; + n->setAttitude(osg::Quat(dir, osg::Vec3d(0, 0, 1))); } if (myAdapter->makeCurrent()) { myViewer->frame(); @@ -516,7 +515,7 @@ MSTLLogicControl& tlsControl = MSNet::getInstance()->getTLSControl(); const std::vector& logics = tlsControl.getAllLogics(); MSTrafficLightLogic* minTll = 0; - SUMOReal minDist = std::numeric_limits::infinity(); + double minDist = std::numeric_limits::infinity(); for (std::vector::const_iterator i = logics.begin(); i != logics.end(); ++i) { // get the logic MSTrafficLightLogic* tll = (*i); @@ -585,7 +584,7 @@ handle(this, FXSEL(SEL_FOCUS_SELF, 0), ptr); FXEvent* event = (FXEvent*)ptr; - myAdapter->getEventQueue()->mouseButtonPress(event->click_x, event->click_y, 1); + myAdapter->getEventQueue()->mouseButtonPress((float)event->click_x, (float)event->click_y, 1); if (myApp->isGaming()) { onGamingClick(getPositionInformation()); } @@ -595,7 +594,7 @@ long GUIOSGView::onLeftBtnRelease(FXObject* sender, FXSelector sel, void* ptr) { FXEvent* event = (FXEvent*)ptr; - myAdapter->getEventQueue()->mouseButtonRelease(event->click_x, event->click_y, 1); + myAdapter->getEventQueue()->mouseButtonRelease((float)event->click_x, (float)event->click_y, 1); return FXGLCanvas::onLeftBtnRelease(sender, sel, ptr); } @@ -604,14 +603,14 @@ handle(this, FXSEL(SEL_FOCUS_SELF, 0), ptr); FXEvent* event = (FXEvent*)ptr; - myAdapter->getEventQueue()->mouseButtonPress(event->click_x, event->click_y, 2); + myAdapter->getEventQueue()->mouseButtonPress((float)event->click_x, (float)event->click_y, 2); return FXGLCanvas::onMiddleBtnPress(sender, sel, ptr); } long GUIOSGView::onMiddleBtnRelease(FXObject* sender, FXSelector sel, void* ptr) { FXEvent* event = (FXEvent*)ptr; - myAdapter->getEventQueue()->mouseButtonRelease(event->click_x, event->click_y, 2); + myAdapter->getEventQueue()->mouseButtonRelease((float)event->click_x, (float)event->click_y, 2); return FXGLCanvas::onMiddleBtnRelease(sender, sel, ptr); } @@ -620,14 +619,14 @@ handle(this, FXSEL(SEL_FOCUS_SELF, 0), ptr); FXEvent* event = (FXEvent*)ptr; - myAdapter->getEventQueue()->mouseButtonPress(event->click_x, event->click_y, 3); + myAdapter->getEventQueue()->mouseButtonPress((float)event->click_x, (float)event->click_y, 3); return FXGLCanvas::onRightBtnPress(sender, sel, ptr); } long GUIOSGView::onRightBtnRelease(FXObject* sender, FXSelector sel, void* ptr) { FXEvent* event = (FXEvent*)ptr; - myAdapter->getEventQueue()->mouseButtonRelease(event->click_x, event->click_y, 3); + myAdapter->getEventQueue()->mouseButtonRelease((float)event->click_x, (float)event->click_y, 3); return FXGLCanvas::onRightBtnRelease(sender, sel, ptr); } @@ -635,7 +634,7 @@ long GUIOSGView::onMouseMove(FXObject* sender, FXSelector sel, void* ptr) { FXEvent* event = (FXEvent*)ptr; - myAdapter->getEventQueue()->mouseMotion(event->win_x, event->win_y); + myAdapter->getEventQueue()->mouseMotion((float)event->win_x, (float)event->win_y); return FXGLCanvas::onMotion(sender, sel, ptr); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/osgview/GUIOSGView.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/osgview/GUIOSGView.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/osgview/GUIOSGView.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/osgview/GUIOSGView.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUIOSGView.h /// @author Daniel Krajzewicz /// @date 19.01.2012 -/// @version $Id: GUIOSGView.h 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: GUIOSGView.h 23150 2017-02-27 12:08:30Z behrisch $ /// // An OSG-based 3D view on the simulation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -147,7 +147,7 @@ * @param[in] zoomDist The distance in m to use for the zoom, values < 0 means: use the centeringBoundary * @note caller is responsible for calling update */ - void centerTo(GUIGlID id, bool applyZoom, SUMOReal zoomDist = 20); + void centerTo(GUIGlID id, bool applyZoom, double zoomDist = 20); void showViewportEditor(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -1,16 +1,11 @@ XERCES_LIBS = -l$(LIB_XERCES) -if CHECK_MEMORY_LEAKS -MEM_LIBS = ../foreign/nvwa/libnvwa.a -endif - COMMON_LIBS = ../utils/options/liboptions.a \ ../utils/xml/libxml.a \ ../utils/common/libcommon.a \ ../utils/importio/libimportio.a \ ../utils/iodevices/libiodevices.a \ ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ $(XERCES_LIBS) bin_PROGRAMS = polyconvert diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -105,7 +105,7 @@ ../utils/xml/libxml.a ../utils/common/libcommon.a \ ../utils/importio/libimportio.a \ ../utils/iodevices/libiodevices.a ../foreign/tcpip/libtcpip.a \ - $(MEM_LIBS) $(am__DEPENDENCIES_1) + $(am__DEPENDENCIES_1) polyconvert_DEPENDENCIES = ../utils/options/liboptions.a \ ../utils/geom/libgeom.a ../utils/shapes/libshapes.a \ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ @@ -336,14 +336,12 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -@CHECK_MEMORY_LEAKS_TRUE@MEM_LIBS = ../foreign/nvwa/libnvwa.a COMMON_LIBS = ../utils/options/liboptions.a \ ../utils/xml/libxml.a \ ../utils/common/libcommon.a \ ../utils/importio/libimportio.a \ ../utils/iodevices/libiodevices.a \ ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ $(XERCES_LIBS) polyconvert_SOURCES = polyconvert_main.cpp PCLoaderArcView.cpp PCLoaderArcView.h \ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderArcView.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderArcView.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderArcView.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderArcView.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: PCLoaderArcView.cpp 21440 2016-09-07 11:06:14Z behrisch $ +/// @version $Id: PCLoaderArcView.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A reader of pois and polygons from shape files /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,12 +42,15 @@ #include #ifdef HAVE_GDAL +#if __GNUC__ > 3 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" +#endif #include +#if __GNUC__ > 3 +#pragma GCC diagnostic pop +#endif #endif - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS // =========================================================================== @@ -79,7 +82,7 @@ std::string prefix = oc.getString("prefix"); std::string type = oc.getString("type"); RGBColor color = RGBColor::parseColor(oc.getString("color")); - SUMOReal layer = oc.getFloat("layer"); + double layer = oc.getFloat("layer"); std::string idField = oc.getString("shapefile.id-column"); bool useRunningID = oc.getBool("shapefile.use-running-id"); // start parsing @@ -147,7 +150,7 @@ switch (gtype) { case wkbPoint: { OGRPoint* cgeom = (OGRPoint*) poGeometry; - Position pos((SUMOReal) cgeom->getX(), (SUMOReal) cgeom->getY()); + Position pos((double) cgeom->getX(), (double) cgeom->getY()); if (!geoConvHelper.x2cartesian(pos)) { WRITE_ERROR("Unable to project coordinates for POI '" + id + "'."); } @@ -162,7 +165,7 @@ OGRLineString* cgeom = (OGRLineString*) poGeometry; PositionVector shape; for (int j = 0; j < cgeom->getNumPoints(); j++) { - Position pos((SUMOReal) cgeom->getX(j), (SUMOReal) cgeom->getY(j)); + Position pos((double) cgeom->getX(j), (double) cgeom->getY(j)); if (!geoConvHelper.x2cartesian(pos)) { WRITE_ERROR("Unable to project coordinates for polygon '" + id + "'."); } @@ -179,7 +182,7 @@ OGRLinearRing* cgeom = ((OGRPolygon*) poGeometry)->getExteriorRing(); PositionVector shape; for (int j = 0; j < cgeom->getNumPoints(); j++) { - Position pos((SUMOReal) cgeom->getX(j), (SUMOReal) cgeom->getY(j)); + Position pos((double) cgeom->getX(j), (double) cgeom->getY(j)); if (!geoConvHelper.x2cartesian(pos)) { WRITE_ERROR("Unable to project coordinates for polygon '" + id + "'."); } @@ -195,7 +198,7 @@ OGRMultiPoint* cgeom = (OGRMultiPoint*) poGeometry; for (int i = 0; i < cgeom->getNumGeometries(); ++i) { OGRPoint* cgeom2 = (OGRPoint*) cgeom->getGeometryRef(i); - Position pos((SUMOReal) cgeom2->getX(), (SUMOReal) cgeom2->getY()); + Position pos((double) cgeom2->getX(), (double) cgeom2->getY()); std::string tid = id + "#" + toString(i); if (!geoConvHelper.x2cartesian(pos)) { WRITE_ERROR("Unable to project coordinates for POI '" + tid + "'."); @@ -215,7 +218,7 @@ PositionVector shape; std::string tid = id + "#" + toString(i); for (int j = 0; j < cgeom2->getNumPoints(); j++) { - Position pos((SUMOReal) cgeom2->getX(j), (SUMOReal) cgeom2->getY(j)); + Position pos((double) cgeom2->getX(j), (double) cgeom2->getY(j)); if (!geoConvHelper.x2cartesian(pos)) { WRITE_ERROR("Unable to project coordinates for polygon '" + tid + "'."); } @@ -236,7 +239,7 @@ PositionVector shape; std::string tid = id + "#" + toString(i); for (int j = 0; j < cgeom2->getNumPoints(); j++) { - Position pos((SUMOReal) cgeom2->getX(j), (SUMOReal) cgeom2->getY(j)); + Position pos((double) cgeom2->getX(j), (double) cgeom2->getY(j)); if (!geoConvHelper.x2cartesian(pos)) { WRITE_ERROR("Unable to project coordinates for polygon '" + tid + "'."); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderArcView.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderArcView.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderArcView.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderArcView.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: PCLoaderArcView.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: PCLoaderArcView.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A reader of pois and polygons from shape files /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderDlrNavteq.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderDlrNavteq.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderDlrNavteq.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderDlrNavteq.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Christoph Sommer /// @author Michael Behrisch /// @date Thu, 02.11.2006 -/// @version $Id: PCLoaderDlrNavteq.cpp 21217 2016-07-22 10:57:44Z behrisch $ +/// @version $Id: PCLoaderDlrNavteq.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A reader of pois and polygons stored in DLR-Navteq (Elmar)-format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,10 +55,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -155,7 +151,7 @@ // patch the values bool discard = oc.getBool("discard"); - SUMOReal layer = oc.getFloat("layer"); + double layer = oc.getFloat("layer"); RGBColor color; if (tm.has(type)) { const PCTypeMap::TypeDef& def = tm.get(type); @@ -214,8 +210,8 @@ std::string xpos = values[index]; std::string ypos = values[index + 1]; index += 2; - SUMOReal x = TplConvert::_2SUMOReal(xpos.c_str()); - SUMOReal y = TplConvert::_2SUMOReal(ypos.c_str()); + double x = TplConvert::_2double(xpos.c_str()); + double y = TplConvert::_2double(ypos.c_str()); Position pos(x, y); if (!GeoConvHelper::getProcessing().x2cartesian(pos)) { WRITE_WARNING("Unable to project coordinates for polygon '" + id + "'."); @@ -241,7 +237,7 @@ // patch the values bool fill = vec.front() == vec.back(); bool discard = oc.getBool("discard"); - SUMOReal layer = oc.getFloat("layer"); + double layer = oc.getFloat("layer"); RGBColor color; if (tm.has(type)) { const PCTypeMap::TypeDef& def = tm.get(type); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderDlrNavteq.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderDlrNavteq.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderDlrNavteq.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderDlrNavteq.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Thu, 02.11.2006 -/// @version $Id: PCLoaderDlrNavteq.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: PCLoaderDlrNavteq.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A reader of pois and polygons stored in DLR-Navteq (Elmar)-format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderOSM.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderOSM.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderOSM.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderOSM.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Melanie Knocke /// @date Wed, 19.11.2008 -/// @version $Id: PCLoaderOSM.cpp 20801 2016-05-28 05:31:30Z behrisch $ +/// @version $Id: PCLoaderOSM.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A reader of pois and polygons stored in OSM-format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -52,10 +52,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS -// --------------------------------------------------------------------------- // static members // --------------------------------------------------------------------------- const std::set PCLoaderOSM::MyKeysToInclude(PCLoaderOSM::initMyKeysToInclude()); @@ -247,7 +243,7 @@ SUMO::Polygon* poly = new SUMO::Polygon( StringUtils::escapeXML(id), StringUtils::escapeXML(OptionsCont::getOptions().getBool("osm.keep-full-type") ? fullType : def.id), - def.color, vec, def.allowFill && closedShape, (SUMOReal)def.layer); + def.color, vec, def.allowFill && closedShape, (double)def.layer); if (withAttributes) { poly->addParameter(edge->myAttributes); } @@ -270,7 +266,7 @@ PointOfInterest* poi = new PointOfInterest( StringUtils::escapeXML(id), StringUtils::escapeXML(OptionsCont::getOptions().getBool("osm.keep-full-type") ? fullType : def.id), - def.color, pos, (SUMOReal)def.layer); + def.color, pos, (double)def.layer); if (withAttributes) { poi->addParameter(node->myAttributes); } @@ -312,8 +308,8 @@ PCOSMNode* toAdd = new PCOSMNode(); toAdd->id = id; bool ok = true; - toAdd->lon = attrs.get(SUMO_ATTR_LON, toString(id).c_str(), ok); - toAdd->lat = attrs.get(SUMO_ATTR_LAT, toString(id).c_str(), ok); + toAdd->lon = attrs.get(SUMO_ATTR_LON, toString(id).c_str(), ok); + toAdd->lat = attrs.get(SUMO_ATTR_LAT, toString(id).c_str(), ok); if (!ok) { delete toAdd; return; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderOSM.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderOSM.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderOSM.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderOSM.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Melanie Knocke /// @date Wed, 19.11.2008 -/// @version $Id: PCLoaderOSM.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: PCLoaderOSM.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A reader of pois and polygons stored in OSM-format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -79,9 +79,9 @@ /// @brief The node's id long long int id; /// @brief The longitude the node is located at - SUMOReal lon; + double lon; /// @brief The latitude the node is located at - SUMOReal lat; + double lat; /// @brief Additional attributes std::map myAttributes; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderVisum.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderVisum.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderVisum.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderVisum.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Christoph Sommer /// @author Michael Behrisch /// @date Thu, 02.11.2006 -/// @version $Id: PCLoaderVisum.cpp 20801 2016-05-28 05:31:30Z behrisch $ +/// @version $Id: PCLoaderVisum.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A reader of pois and polygons stored in VISUM-format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -54,10 +54,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -103,8 +99,8 @@ if (what == "$PUNKT") { lineParser.parseLine(line); long long int id = TplConvert::_2long(lineParser.get("ID").c_str()); - SUMOReal x = TplConvert::_2SUMOReal(lineParser.get("XKOORD").c_str()); - SUMOReal y = TplConvert::_2SUMOReal(lineParser.get("YKOORD").c_str()); + double x = TplConvert::_2double(lineParser.get("XKOORD").c_str()); + double y = TplConvert::_2double(lineParser.get("YKOORD").c_str()); Position pos(x, y); if (!geoConvHelper.x2cartesian(pos)) { WRITE_WARNING("Unable to project coordinates for point '" + toString(id) + "'."); @@ -125,8 +121,8 @@ lineParser.parseLine(line); long long int id = TplConvert::_2long(lineParser.get("KANTEID").c_str()); int index = TplConvert::_2int(lineParser.get("INDEX").c_str()); - SUMOReal x = TplConvert::_2SUMOReal(lineParser.get("XKOORD").c_str()); - SUMOReal y = TplConvert::_2SUMOReal(lineParser.get("YKOORD").c_str()); + double x = TplConvert::_2double(lineParser.get("XKOORD").c_str()); + double y = TplConvert::_2double(lineParser.get("YKOORD").c_str()); Position pos(x, y); if (!geoConvHelper.x2cartesian(pos)) { WRITE_WARNING("Unable to project coordinates for edge '" + toString(id) + "'."); @@ -225,8 +221,8 @@ std::string id = toString(idL); std::string catid = lineParser.get("CATID"); // process read values - SUMOReal x = TplConvert::_2SUMOReal(lineParser.get("XKoord").c_str()); - SUMOReal y = TplConvert::_2SUMOReal(lineParser.get("YKoord").c_str()); + double x = TplConvert::_2double(lineParser.get("XKoord").c_str()); + double y = TplConvert::_2double(lineParser.get("YKoord").c_str()); Position pos(x, y); if (!geoConvHelper.x2cartesian(pos)) { WRITE_WARNING("Unable to project coordinates for POI '" + id + "'."); @@ -234,7 +230,7 @@ std::string type = typemap[catid]; // patch the values bool discard = oc.getBool("discard"); - SUMOReal layer = oc.getFloat("layer"); + double layer = oc.getFloat("layer"); RGBColor color; if (tm.has(type)) { const PCTypeMap::TypeDef& def = tm.get(type); @@ -262,7 +258,7 @@ if (!first && lastID != id) { // we have parsed a polygon completely RGBColor color; - SUMOReal layer = oc.getFloat("layer"); + double layer = oc.getFloat("layer"); bool discard = oc.getBool("discard"); if (tm.has(polyType)) { const PCTypeMap::TypeDef& def = tm.get(polyType); @@ -288,7 +284,7 @@ std::string index = st.next(); std::string xpos = st.next(); std::string ypos = st.next(); - Position pos2D((SUMOReal) atof(xpos.c_str()), (SUMOReal) atof(ypos.c_str())); + Position pos2D((double) atof(xpos.c_str()), (double) atof(ypos.c_str())); if (!geoConvHelper.x2cartesian(pos2D)) { WRITE_WARNING("Unable to project coordinates for polygon '" + id + "'."); } @@ -302,12 +298,12 @@ long long int idL = TplConvert::_2long(lineParser.get("NR").c_str()); std::string id = toString(idL); long long int area = TplConvert::_2long(lineParser.get("FLAECHEID").c_str()); - SUMOReal x = TplConvert::_2SUMOReal(lineParser.get("XKOORD").c_str()); - SUMOReal y = TplConvert::_2SUMOReal(lineParser.get("YKOORD").c_str()); + double x = TplConvert::_2double(lineParser.get("XKOORD").c_str()); + double y = TplConvert::_2double(lineParser.get("YKOORD").c_str()); // patch the values std::string type = "district"; bool discard = oc.getBool("discard"); - SUMOReal layer = oc.getFloat("layer"); + double layer = oc.getFloat("layer"); RGBColor color; if (tm.has(type)) { const PCTypeMap::TypeDef& def = tm.get(type); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderVisum.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderVisum.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderVisum.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderVisum.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Thu, 02.11.2006 -/// @version $Id: PCLoaderVisum.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: PCLoaderVisum.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A reader of pois and polygons stored in VISUM-format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderXML.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderXML.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderXML.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderXML.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Christoph Sommer /// @author Michael Behrisch /// @date Thu, 02.11.2006 -/// @version $Id: PCLoaderXML.cpp 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: PCLoaderXML.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A reader for polygons and pois stored in XML-format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -50,10 +50,6 @@ #include #include "PCLoaderXML.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -131,7 +127,7 @@ Position -PCLoaderXML::getLanePos(const std::string& poiID, const std::string& laneID, SUMOReal lanePos) { +PCLoaderXML::getLanePos(const std::string& poiID, const std::string& laneID, double lanePos) { static_cast(myShapeContainer).addLanePos(poiID, laneID, lanePos); return Position::INVALID; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderXML.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderXML.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCLoaderXML.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCLoaderXML.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Thu, 02.11.2006 -/// @version $Id: PCLoaderXML.h 21148 2016-07-12 08:47:10Z behrisch $ +/// @version $Id: PCLoaderXML.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A reader for polygons and pois stored in XML-format /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -72,7 +72,7 @@ PCTypeMap& tm); - Position getLanePos(const std::string& poiID, const std::string& laneID, SUMOReal lanePos); + Position getLanePos(const std::string& poiID, const std::string& laneID, double lanePos); protected: /** @brief Constructor diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCNetProjectionLoader.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCNetProjectionLoader.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCNetProjectionLoader.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCNetProjectionLoader.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Thu, 02.11.2006 -/// @version $Id: PCNetProjectionLoader.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: PCNetProjectionLoader.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A reader for a SUMO network's projection description /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -50,10 +50,6 @@ #include #include "PCNetProjectionLoader.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCNetProjectionLoader.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCNetProjectionLoader.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCNetProjectionLoader.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCNetProjectionLoader.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Thu, 02.11.2006 -/// @version $Id: PCNetProjectionLoader.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: PCNetProjectionLoader.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A reader for a SUMO network's projection description /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCPolyContainer.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCPolyContainer.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCPolyContainer.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCPolyContainer.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Melanie Knocke /// @date Mon, 05 Dec 2005 -/// @version $Id: PCPolyContainer.cpp 20801 2016-05-28 05:31:30Z behrisch $ +/// @version $Id: PCPolyContainer.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A storage for loaded polygons and pois /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,10 +45,6 @@ #include #include "PCPolyContainer.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -106,7 +102,7 @@ void -PCPolyContainer::addLanePos(const std::string& poiID, const std::string& laneID, SUMOReal lanePos) { +PCPolyContainer::addLanePos(const std::string& poiID, const std::string& laneID, double lanePos) { myLanePosPois[poiID] = std::make_pair(laneID, lanePos); } @@ -119,9 +115,9 @@ useGeo = false; } OutputDevice& out = OutputDevice::getDevice(file); - out.writeXMLHeader("additional", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/additional_file.xsd\""); + out.writeXMLHeader("additional", "additional_file.xsd"); if (useGeo) { - out.setPrecision(GEO_OUTPUT_ACCURACY); + out.setPrecision(gPrecisionGeo); } else if (gch.usingGeoProjection()) { GeoConvHelper::writeLocation(out); } @@ -130,9 +126,9 @@ i->second->writeXML(out, useGeo); } // write pois - const SUMOReal zOffset = OptionsCont::getOptions().getFloat("poi-layer-offset"); + const double zOffset = OptionsCont::getOptions().getFloat("poi-layer-offset"); for (std::map::const_iterator i = myPOIs.getMyMap().begin(); i != myPOIs.getMyMap().end(); ++i) { - std::map >::const_iterator it = myLanePosPois.find(i->first); + std::map >::const_iterator it = myLanePosPois.find(i->first); if (it == myLanePosPois.end()) { i->second->writeXML(out, useGeo, zOffset); } else { @@ -143,6 +139,80 @@ } +void PCPolyContainer::writeDlrTDPHeader(OutputDevice& device, const OptionsCont& oc) { + // XXX duplicate of NWWriter_DlrNavteq::writeHeader() + const std::string OUTPUT_VERSION = "6.5"; // XXX duplicate of NWWriter_DlrNavteq OUTPUT_VERSION + time_t rawtime; + time(&rawtime); + char buffer [80]; + strftime(buffer, 80, "on %c", localtime(&rawtime)); + device << "# Generated " << buffer << " by " << oc.getFullName() << "\n"; + device << "# Format matches Extraction version: V" << OUTPUT_VERSION << " \n"; + std::stringstream tmp; + oc.writeConfiguration(tmp, true, false, false); + tmp.seekg(std::ios_base::beg); + std::string line; + while (!tmp.eof()) { + std::getline(tmp, line); + device << "# " << line << "\n"; + } + device << "#\n"; +} + + +void +PCPolyContainer::saveDlrTDP(const std::string& prefix) { + const OptionsCont& oc = OptionsCont::getOptions(); + const GeoConvHelper& gch = GeoConvHelper::getFinal(); + const bool haveGeo = gch.usingGeoProjection(); + const double geoScale = pow(10.0f, haveGeo ? 5 : 2); // see NIImporter_DlrNavteq::GEO_SCALE + // write pois + OutputDevice& out = OutputDevice::getDevice(prefix + "_points_of_interest.txt"); + out.setPrecision(0); + writeDlrTDPHeader(out, oc); + // write format specifier + out << "# ID\tCITY\tTYPE\tNAME\tgeo_x\tgeo_y\n"; + int id = 0; + for (std::map::const_iterator i = myPOIs.getMyMap().begin(); i != myPOIs.getMyMap().end(); ++i) { + Position pos(*(i->second)); + gch.cartesian2geo(pos); + pos.mul(geoScale); + out << id << "\t"; + out << "" << "\t"; + out << i->second->getType() << "\t"; + out << i->first << "\t"; + out << pos.x() << "\t"; + out << pos.y() << "\t"; + id++; + } + out.close(); + // write polygons + OutputDevice& out2 = OutputDevice::getDevice(prefix + "_polygons.txt"); + out2.setPrecision(0); + writeDlrTDPHeader(out2, oc); + // write format specifier + out2 << "# ID\tCITY\tTYPE\tNAME\tgeo_x1\tgeo_y1\t[geo_x2 geo_y2 ...]\n"; + id = 0; + for (std::map::const_iterator i = myPolygons.getMyMap().begin(); i != myPolygons.getMyMap().end(); ++i) { + out2 << id << "\t"; + out2 << "" << "\t"; + out2 << i->second->getType() << "\t"; + out2 << i->first << "\t"; + + PositionVector shape(i->second->getShape()); + for (int i = 0; i < (int) shape.size(); i++) { + Position pos = shape[i]; + gch.cartesian2geo(pos); + pos.mul(geoScale); + out2 << pos.x() << "\t"; + out2 << pos.y() << "\t"; + } + id++; + } + out2.close(); +} + + int PCPolyContainer::getEnumIDFor(const std::string& key) { return myIDEnums[key]++; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCPolyContainer.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCPolyContainer.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCPolyContainer.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCPolyContainer.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Mon, 05 Dec 2005 -/// @version $Id: PCPolyContainer.h 20801 2016-05-28 05:31:30Z behrisch $ +/// @version $Id: PCPolyContainer.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A storage for loaded polygons and pois /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -96,7 +96,7 @@ bool add(PointOfInterest* poi, bool ignorePruning = false); - void addLanePos(const std::string& poiID, const std::string& laneID, SUMOReal lanePos); + void addLanePos(const std::string& poiID, const std::string& laneID, double lanePos); /** @brief Saves the stored polygons and pois into the given file * @param[in] file The name of the file to write stored objects' definitions into @@ -105,6 +105,11 @@ */ void save(const std::string& file, bool useGeo); + /** @brief Saves the stored polygons and pois into the given file in dlrTDP format + * @param[in] prefix The prefix of the file to write stored objects' definitions into + */ + void saveDlrTDP(const std::string& prefix); + /** @brief Retuns a unique id for a given name * @@ -119,7 +124,7 @@ private: /// @brief An id to pos map for lane pos specs - std::map > myLanePosPois; + std::map > myLanePosPois; /// @brief An id to int map for proper enumeration std::map myIDEnums; @@ -133,6 +138,7 @@ /// @brief List of names of polygons/pois that shall be removed std::vector myRemoveByNames; + static void writeDlrTDPHeader(OutputDevice& device, const OptionsCont& oc); private: /// @brief Invalidated copy constructor diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCTypeDefHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCTypeDefHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCTypeDefHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCTypeDefHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Thu, 16.03.2006 -/// @version $Id: PCTypeDefHandler.cpp 20801 2016-05-28 05:31:30Z behrisch $ +/// @version $Id: PCTypeDefHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A handler for loading polygon type maps /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,10 +41,6 @@ #include "PCTypeMap.h" #include "PCTypeDefHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -67,7 +63,7 @@ if (!ok) { return; } - const SUMOReal layer = attrs.getOpt(SUMO_ATTR_LAYER, id.c_str(), ok, myOptions.getFloat("layer")); + const double layer = attrs.getOpt(SUMO_ATTR_LAYER, id.c_str(), ok, myOptions.getFloat("layer")); const bool discard = attrs.getOpt(SUMO_ATTR_DISCARD, id.c_str(), ok, false); const bool allowFill = attrs.getOpt(SUMO_ATTR_FILL, id.c_str(), ok, myOptions.getBool("fill")); const std::string type = attrs.getOpt(SUMO_ATTR_NAME, id.c_str(), ok, myOptions.getString("type")); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCTypeDefHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCTypeDefHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCTypeDefHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCTypeDefHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Thu, 16.03.2006 -/// @version $Id: PCTypeDefHandler.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: PCTypeDefHandler.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A handler for loading polygon type maps /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCTypeMap.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCTypeMap.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCTypeMap.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCTypeMap.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 05 Dec 2005 -/// @version $Id: PCTypeMap.cpp 20801 2016-05-28 05:31:30Z behrisch $ +/// @version $Id: PCTypeMap.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A storage for type mappings /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "utils/options/OptionsCont.h" #include "PCTypeMap.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -59,7 +55,7 @@ bool PCTypeMap::add(const std::string& id, const std::string& newid, const std::string& color, const std::string& prefix, - SUMOReal layer, bool discard, bool allowFill) { + double layer, bool discard, bool allowFill) { if (has(id)) { return false; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCTypeMap.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCTypeMap.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/PCTypeMap.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/PCTypeMap.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Mon, 05 Dec 2005 -/// @version $Id: PCTypeMap.h 20801 2016-05-28 05:31:30Z behrisch $ +/// @version $Id: PCTypeMap.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A storage for type mappings /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -71,7 +71,7 @@ /// @brief The prefix to use std::string prefix; /// @brief The layer to use - SUMOReal layer; + double layer; /// @brief Information whether polygons of this type shall be discarded bool discard; /// @brief Information whether polygons of this type can be filled @@ -92,7 +92,7 @@ * @return Whether the type could been added (was not known before) */ bool add(const std::string& id, const std::string& newid, const std::string& color, - const std::string& prefix, SUMOReal layer, bool discard, bool allowFill); + const std::string& prefix, double layer, bool discard, bool allowFill); /** @brief Returns a type definition diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/polyconvert_main.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/polyconvert_main.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/polyconvert/polyconvert_main.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/polyconvert/polyconvert_main.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Melanie Knocke /// @date Mon, 05 Dec 2005 -/// @version $Id: polyconvert_main.cpp 21472 2016-09-14 08:50:06Z behrisch $ +/// @version $Id: polyconvert_main.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Main for POLYCONVERT /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -63,10 +63,6 @@ #include #include "pc_typemap.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -139,7 +135,7 @@ oc.addDescription("shapefile.use-running-id", "Input", "A running number will be used as id"); oc.doRegister("shapefile.add-param", new Option_Bool(false)); - oc.addDescription("shapefile.add-param", "Input", "Extract all additonal columns as params"); + oc.addDescription("shapefile.add-param", "Input", "Extract all additional columns as params"); oc.doRegister("shapefile.fill", new Option_String()); oc.addDescription("shapefile.fill", "Input", "[auto|true|false]. Forces the 'fill' status to the given value. Default 'auto' tries to determine it from the data type"); @@ -151,10 +147,13 @@ // output - oc.doRegister("output-file", 'o', new Option_FileName("polygons.xml")); + oc.doRegister("output-file", 'o', new Option_FileName()); oc.addSynonyme("output-file", "output"); oc.addDescription("output-file", "Output", "Write generated polygons/pois to FILE"); + oc.doRegister("dlr-tdp-output", new Option_FileName()); + oc.addDescription("dlr-tdp-output", "Output", "Write generated polygons/pois to a dlr-tdp file with the given prefix"); + // prunning options oc.doRegister("prune.in-net", new Option_Bool(false)); @@ -328,6 +327,7 @@ } delete reader; } + SystemFrame::checkOptions(); // read in the data PCLoaderXML::loadIfSet(oc, toFill, tm); // SUMO-XML PCLoaderOSM::loadIfSet(oc, toFill, tm); // OSM-XML @@ -339,7 +339,21 @@ if (MsgHandler::getErrorInstance()->wasInformed() && !oc.getBool("ignore-errors")) { throw ProcessError(); } - toFill.save(oc.getString("output-file"), oc.getBool("proj.plain-geo")); + // output + if (!oc.isSet("output-file") && !oc.isSet("dlr-tdp-output")) { + std::string out = "polygons.xml"; + if (oc.isSet("configuration-file")) { + out = FileHelpers::getConfigurationRelative(oc.getString("configuration-file"), out); + } + oc.setDefault("output-file", out); + } + if (oc.isSet("output-file")) { + toFill.save(oc.getString("output-file"), oc.getBool("proj.plain-geo")); + } + if (oc.isSet("dlr-tdp-output")) { + toFill.saveDlrTDP(oc.getString("dlr-tdp-output")); + } + } catch (const ProcessError& e) { if (std::string(e.what()) != std::string("Process Error") && std::string(e.what()) != std::string("")) { WRITE_ERROR(e.what()); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROAbstractEdgeBuilder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROAbstractEdgeBuilder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROAbstractEdgeBuilder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROAbstractEdgeBuilder.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Yun-Pang Floetteroed /// @date Wed, 21 Jan 2004 -/// @version $Id: ROAbstractEdgeBuilder.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: ROAbstractEdgeBuilder.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Interface for building instances of router-edges /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROEdge.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROEdge.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROEdge.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROEdge.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ /// @author Melanie Knocke /// @author Yun-Pang Floetteroed /// @date Sept 2002 -/// @version $Id: ROEdge.cpp 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: ROEdge.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A basic edge for routing applications /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,10 +46,6 @@ #include "ROVehicle.h" #include "ROEdge.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions @@ -96,7 +92,7 @@ ROEdge::addLane(ROLane* lane) { assert(myLanes.empty() || lane->getLength() == myLength); myLength = lane->getLength(); - const SUMOReal speed = lane->getSpeed(); + const double speed = lane->getSpeed(); mySpeed = speed > mySpeed ? speed : mySpeed; myLanes.push_back(lane); @@ -115,22 +111,22 @@ void -ROEdge::addEffort(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd) { +ROEdge::addEffort(double value, double timeBegin, double timeEnd) { myEfforts.add(timeBegin, timeEnd, value); myUsingETimeLine = true; } void -ROEdge::addTravelTime(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd) { +ROEdge::addTravelTime(double value, double timeBegin, double timeEnd) { myTravelTimes.add(timeBegin, timeEnd, value); myUsingTTTimeLine = true; } -SUMOReal -ROEdge::getEffort(const ROVehicle* const veh, SUMOReal time) const { - SUMOReal ret = 0; +double +ROEdge::getEffort(const ROVehicle* const veh, double time) const { + double ret = 0; if (!getStoredEffort(time, ret)) { return myLength / MIN2(veh->getType()->maxSpeed, mySpeed); } @@ -138,7 +134,7 @@ } -SUMOReal +double ROEdge::getDistanceTo(const ROEdge* other) const { if (getToJunction() != 0 && other->getFromJunction() != 0) { return getToJunction()->getPosition().distanceTo2D(other->getFromJunction()->getPosition()); @@ -150,21 +146,21 @@ bool -ROEdge::hasLoadedTravelTime(SUMOReal time) const { +ROEdge::hasLoadedTravelTime(double time) const { return myUsingTTTimeLine && myTravelTimes.describesTime(time); } -SUMOReal -ROEdge::getTravelTime(const ROVehicle* const veh, SUMOReal time) const { +double +ROEdge::getTravelTime(const ROVehicle* const veh, double time) const { if (myUsingTTTimeLine) { if (myTravelTimes.describesTime(time)) { - SUMOReal lineTT = myTravelTimes.getValue(time); + double lineTT = myTravelTimes.getValue(time); if (myInterpolate) { - const SUMOReal inTT = lineTT; - const SUMOReal split = (SUMOReal)(myTravelTimes.getSplitTime(time, time + inTT) - time); + const double inTT = lineTT; + const double split = (double)(myTravelTimes.getSplitTime(time, time + inTT) - time); if (split >= 0) { - lineTT = myTravelTimes.getValue(time + inTT) * ((SUMOReal)1. - split / inTT) + split; + lineTT = myTravelTimes.getValue(time + inTT) * ((double)1. - split / inTT) + split; } } return MAX2(getMinimumTravelTime(veh), lineTT); @@ -175,15 +171,15 @@ } } } - return myLength / MIN2(veh->getType()->maxSpeed, veh->getType()->speedFactor * mySpeed); + return myLength / MIN2(veh->getType()->maxSpeed, veh->getType()->speedFactor.getParameter()[0] * mySpeed); } -SUMOReal -ROEdge::getNoiseEffort(const ROEdge* const edge, const ROVehicle* const veh, SUMOReal time) { - SUMOReal ret = 0; +double +ROEdge::getNoiseEffort(const ROEdge* const edge, const ROVehicle* const veh, double time) { + double ret = 0; if (!edge->getStoredEffort(time, ret)) { - const SUMOReal v = MIN2(veh->getType()->maxSpeed, edge->mySpeed); + const double v = MIN2(veh->getType()->maxSpeed, edge->mySpeed); ret = HelpersHarmonoise::computeNoise(veh->getType()->emissionClass, v, 0); } return ret; @@ -191,7 +187,7 @@ bool -ROEdge::getStoredEffort(SUMOReal time, SUMOReal& ret) const { +ROEdge::getStoredEffort(double time, double& ret) const { if (myUsingETimeLine) { if (!myEfforts.describesTime(time)) { if (!myHaveEWarned) { @@ -201,8 +197,8 @@ return false; } if (myInterpolate) { - SUMOReal inTT = myTravelTimes.getValue(time); - SUMOReal ratio = (SUMOReal)(myEfforts.getSplitTime(time, time + (SUMOTime)inTT) - time) / inTT; + double inTT = myTravelTimes.getValue(time); + double ratio = (double)(myEfforts.getSplitTime(time, time + (SUMOTime)inTT) - time) / inTT; if (ratio >= 0) { ret = ratio * myEfforts.getValue(time) + (1 - ratio) * myEfforts.getValue(time + (SUMOTime)inTT); return true; @@ -236,7 +232,7 @@ void ROEdge::buildTimeLines(const std::string& measure, const bool boundariesOverride) { if (myUsingETimeLine) { - SUMOReal value = myLength / mySpeed; + double value = myLength / mySpeed; const SUMOEmissionClass c = PollutantsInterface::getClassByName("unknown"); if (measure == "CO") { value = PollutantsInterface::compute(c, PollutantsInterface::CO, mySpeed, 0, 0) * value; // @todo: give correct slope diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROEdge.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROEdge.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROEdge.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROEdge.h 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ /// @author Melanie Knocke /// @author Yun-Pang Floetteroed /// @date Sept 2002 -/// @version $Id: ROEdge.h 21252 2016-07-28 06:37:09Z namdre $ +/// @version $Id: ROEdge.h 24122 2017-04-28 12:50:58Z namdre $ /// // A basic edge for routing applications /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -146,7 +146,7 @@ /** @brief Sets the vehicle class specific speed limits of the edge * @param[in] restrictions The restrictions for the edge */ - inline void setRestrictions(const std::map* restrictions) { + inline void setRestrictions(const std::map* restrictions) { myRestrictions = restrictions; } @@ -195,7 +195,7 @@ /** @brief Returns the length of the edge * @return This edge's length */ - SUMOReal getLength() const { + double getLength() const { return myLength; } @@ -210,17 +210,27 @@ /** @brief Returns the speed allowed on this edge * @return The speed allowed on this edge */ - SUMOReal getSpeed() const { + double getSpeedLimit() const { return mySpeed; } + /// @brief return a lower bound on shape.length() / myLength that is + // sufficient for the astar air-distance heuristic + double getLengthGeometryFactor() const { + if (myFromJunction != 0 && myToJunction != 0) { + return MAX2(1.0, myFromJunction->getPosition().distanceTo(myToJunction->getPosition()) / myLength); + } else { + return 1.0; + } + } + /** @brief Returns the lane's maximum speed, given a vehicle's speed limit adaptation * @param[in] The vehicle to return the adapted speed limit for * @return This lane's resulting max. speed */ - inline SUMOReal getVClassMaxSpeed(SUMOVehicleClass vclass) const { + inline double getVClassMaxSpeed(SUMOVehicleClass vclass) const { if (myRestrictions != 0) { - std::map::const_iterator r = myRestrictions->find(vclass); + std::map::const_iterator r = myRestrictions->find(vclass); if (r != myRestrictions->end()) { return r->second; } @@ -278,7 +288,7 @@ * @param[in] timeBegin The begin time of the interval the given value is valid for [s] * @param[in] timeEnd The end time of the interval the given value is valid for [s] */ - void addEffort(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd); + void addEffort(double value, double timeBegin, double timeEnd); /** @brief Adds a travel time value @@ -287,7 +297,7 @@ * @param[in] timeBegin The begin time of the interval the given value is valid for [s] * @param[in] timeEnd The end time of the interval the given value is valid for [s] */ - void addTravelTime(SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd); + void addTravelTime(double value, double timeBegin, double timeEnd); /** @brief Returns the number of edges this edge is connected to @@ -340,7 +350,7 @@ * @return The effort needed by the given vehicle to pass the edge at the given time * @todo Recheck whether the vehicle's maximum speed is considered */ - SUMOReal getEffort(const ROVehicle* const veh, SUMOReal time) const; + double getEffort(const ROVehicle* const veh, double time) const; /** @brief Returns whether a travel time for this edge was loaded @@ -348,7 +358,7 @@ * @param[in] time The time for which the travel time shall be returned [s] * @return whether a value was loaded */ - bool hasLoadedTravelTime(SUMOReal time) const; + bool hasLoadedTravelTime(double time) const; /** @brief Returns the travel time for this edge @@ -357,7 +367,7 @@ * @param[in] time The time for which the travel time shall be returned [s] * @return The travel time needed by the given vehicle to pass the edge at the given time */ - SUMOReal getTravelTime(const ROVehicle* const veh, SUMOReal time) const; + double getTravelTime(const ROVehicle* const veh, double time) const; /** @brief Returns the effort for the given edge @@ -368,7 +378,7 @@ * @return The effort needed by the given vehicle to pass the edge at the given time * @todo Recheck whether the vehicle's maximum speed is considered */ - static inline SUMOReal getEffortStatic(const ROEdge* const edge, const ROVehicle* const veh, SUMOReal time) { + static inline double getEffortStatic(const ROEdge* const edge, const ROVehicle* const veh, double time) { return edge->getEffort(veh, time); } @@ -380,7 +390,7 @@ * @param[in] time The time for which the travel time shall be returned [s] * @return The traveltime needed by the given vehicle to pass the edge at the given time */ - static inline SUMOReal getTravelTimeStatic(const ROEdge* const edge, const ROVehicle* const veh, SUMOReal time) { + static inline double getTravelTimeStatic(const ROEdge* const edge, const ROVehicle* const veh, double time) { return edge->getTravelTime(veh, time); } @@ -390,30 +400,30 @@ * @param[in] veh The vehicle for which the effort on this edge shall be retrieved * @param[in] time The time for which the effort shall be returned [s] */ - inline SUMOReal getMinimumTravelTime(const ROVehicle* const veh) const { + inline double getMinimumTravelTime(const ROVehicle* const veh) const { return myLength / MIN2(veh->getType()->maxSpeed, veh->getChosenSpeedFactor() * mySpeed); } template - static SUMOReal getEmissionEffort(const ROEdge* const edge, const ROVehicle* const veh, SUMOReal time) { - SUMOReal ret = 0; + static double getEmissionEffort(const ROEdge* const edge, const ROVehicle* const veh, double time) { + double ret = 0; if (!edge->getStoredEffort(time, ret)) { const SUMOVTypeParameter* const type = veh->getType(); - const SUMOReal vMax = MIN2(type->maxSpeed, edge->mySpeed); - const SUMOReal accel = type->getCFParam(SUMO_ATTR_ACCEL, SUMOVTypeParameter::getDefaultAccel(type->vehicleClass)) * type->getCFParam(SUMO_ATTR_SIGMA, SUMOVTypeParameter::getDefaultImperfection(type->vehicleClass)) / 2.; + const double vMax = MIN2(type->maxSpeed, edge->mySpeed); + const double accel = type->getCFParam(SUMO_ATTR_ACCEL, SUMOVTypeParameter::getDefaultAccel(type->vehicleClass)) * type->getCFParam(SUMO_ATTR_SIGMA, SUMOVTypeParameter::getDefaultImperfection(type->vehicleClass)) / 2.; ret = PollutantsInterface::computeDefault(type->emissionClass, ET, vMax, accel, 0, edge->getTravelTime(veh, time)); // @todo: give correct slope } return ret; } - static SUMOReal getNoiseEffort(const ROEdge* const edge, const ROVehicle* const veh, SUMOReal time); + static double getNoiseEffort(const ROEdge* const edge, const ROVehicle* const veh, double time); //@} /// @brief optimistic distance heuristic for use in routing - SUMOReal getDistanceTo(const ROEdge* other) const; + double getDistanceTo(const ROEdge* other) const; /** @brief Returns all ROEdges */ @@ -456,7 +466,7 @@ * @param[in] time The tim for which the effort shall be returned * @return Whether the effort is given */ - bool getStoredEffort(SUMOReal time, SUMOReal& ret) const; + bool getStoredEffort(double time, double& ret) const; @@ -472,19 +482,19 @@ const int myPriority; /// @brief The maximum speed allowed on this edge - SUMOReal mySpeed; + double mySpeed; /// @brief The length of the edge - SUMOReal myLength; + double myLength; /// @brief Container storing passing time varying over time for the edge - mutable ValueTimeLine myTravelTimes; + mutable ValueTimeLine myTravelTimes; /// @brief Information whether the time line shall be used instead of the length value bool myUsingTTTimeLine; /// @brief Container storing passing time varying over time for the edge - mutable ValueTimeLine myEfforts; + mutable ValueTimeLine myEfforts; /// @brief Information whether the time line shall be used instead of the length value bool myUsingETimeLine; @@ -506,7 +516,7 @@ EdgeFunc myFunc; /// The vClass speed restrictions for this edge - const std::map* myRestrictions; + const std::map* myRestrictions; /// @brief This edge's lanes std::vector myLanes; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROFrame.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: ROFrame.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ROFrame.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Sets and checks options for routing /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,10 +42,6 @@ #include #include "ROFrame.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROFrame.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: ROFrame.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ROFrame.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Sets and checks options for routing /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROHelper.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROHelper.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROHelper.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROHelper.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: ROHelper.cpp 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: ROHelper.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // Some helping methods for router /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROHelper.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROHelper.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROHelper.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROHelper.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: ROHelper.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ROHelper.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Some helping methods for router /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROLane.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROLane.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROLane.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROLane.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: ROLane.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: ROLane.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A single lane the router may use /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -63,7 +63,7 @@ * @param[in] maxSpeed The maximum speed allowed on the lane * @param[in] permissions Vehicle classes that may pass this lane */ - ROLane(const std::string& id, ROEdge* edge, SUMOReal length, SUMOReal maxSpeed, SVCPermissions permissions) : + ROLane(const std::string& id, ROEdge* edge, double length, double maxSpeed, SVCPermissions permissions) : Named(id), myEdge(edge), myLength(length), myMaxSpeed(maxSpeed), myPermissions(permissions) { } @@ -75,7 +75,7 @@ /** @brief Returns the length of the lane * @return The length of this lane */ - SUMOReal getLength() const { + double getLength() const { return myLength; } @@ -83,7 +83,7 @@ /** @brief Returns the maximum speed allowed on this lane * @return The maximum speed allowed on this lane */ - SUMOReal getSpeed() const { + double getSpeed() const { return myMaxSpeed; } @@ -125,10 +125,10 @@ ROEdge* myEdge; /// @brief The length of the lane - SUMOReal myLength; + double myLength; /// @brief The maximum speed allowed on the lane - SUMOReal myMaxSpeed; + double myMaxSpeed; /// @brief The encoding of allowed vehicle classes SVCPermissions myPermissions; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROLoader.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROLoader.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROLoader.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROLoader.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Christian Roessel /// @date Sept 2002 -/// @version $Id: ROLoader.cpp 21790 2016-10-25 12:37:24Z behrisch $ +/// @version $Id: ROLoader.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Loader for networks and route imports /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,10 +55,6 @@ #include "ROEdge.h" #include "RORouteHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -68,7 +64,7 @@ // --------------------------------------------------------------------------- void ROLoader::EdgeFloatTimeLineRetriever_EdgeTravelTime::addEdgeWeight(const std::string& id, - SUMOReal val, SUMOReal beg, SUMOReal end) const { + double val, double beg, double end) const { ROEdge* e = myNet.getEdge(id); if (e != 0) { e->addTravelTime(val, beg, end); @@ -89,7 +85,7 @@ // --------------------------------------------------------------------------- void ROLoader::EdgeFloatTimeLineRetriever_EdgeWeight::addEdgeWeight(const std::string& id, - SUMOReal val, SUMOReal beg, SUMOReal end) const { + double val, double beg, double end) const { ROEdge* e = myNet.getEdge(id); if (e != 0) { e->addEffort(val, beg, end); @@ -311,7 +307,7 @@ ROLoader::writeStats(const SUMOTime time, const SUMOTime start, const SUMOTime absNo, bool endGiven) { if (myLogSteps) { if (endGiven) { - const SUMOReal perc = (SUMOReal)(time - start) / (SUMOReal) absNo; + const double perc = (double)(time - start) / (double) absNo; std::cout << "Reading up to time step: " + time2string(time) + " (" + time2string(time - start) + "/" + time2string(absNo) + " = " + toString(perc * 100) + "% done) \r"; } else { std::cout << "Reading up to time step: " + time2string(time) + "\r"; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROLoader.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROLoader.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROLoader.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROLoader.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: ROLoader.h 21790 2016-10-25 12:37:24Z behrisch $ +/// @version $Id: ROLoader.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Loader for networks and route imports /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -135,7 +135,7 @@ * @see SAXWeightsHandler::EdgeFloatTimeLineRetriever::addEdgeWeight */ void addEdgeWeight(const std::string& id, - SUMOReal val, SUMOReal beg, SUMOReal end) const; + double val, double beg, double end) const; private: /// @brief The network edges shall be obtained from @@ -166,7 +166,7 @@ * @see SAXWeightsHandler::EdgeFloatTimeLineRetriever::addEdgeWeight */ void addEdgeWeight(const std::string& id, - SUMOReal val, SUMOReal beg, SUMOReal end) const; + double val, double beg, double end) const; private: /// @brief The network edges shall be obtained from diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RONet.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RONet.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RONet.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RONet.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: RONet.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: RONet.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The router's network representation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,10 +48,6 @@ #include "ROVehicle.h" #include "RONet.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions @@ -82,7 +78,7 @@ if (myInstance != 0) { throw ProcessError("A network was already constructed."); } - SUMOVTypeParameter* type = new SUMOVTypeParameter(DEFAULT_VTYPE_ID, SVC_IGNORING); + SUMOVTypeParameter* type = new SUMOVTypeParameter(DEFAULT_VTYPE_ID, SVC_PASSENGER); type->onlyReferenced = true; myVehicleTypes.add(type->id, type); SUMOVTypeParameter* defPedType = new SUMOVTypeParameter(DEFAULT_PEDTYPE_ID, SVC_PEDESTRIAN); @@ -121,14 +117,14 @@ void -RONet::addRestriction(const std::string& id, const SUMOVehicleClass svc, const SUMOReal speed) { +RONet::addRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed) { myRestrictions[id][svc] = speed; } -const std::map* +const std::map* RONet::getRestrictions(const std::string& id) const { - std::map >::const_iterator i = myRestrictions.find(id); + std::map >::const_iterator i = myRestrictions.find(id); if (i == myRestrictions.end()) { return 0; } @@ -220,6 +216,17 @@ } +void +RONet::addParkingArea(const std::string& id, SUMOVehicleParameter::Stop* stop) { + std::map::const_iterator it = myParkingAreas.find(id); + if (it != myParkingAreas.end()) { + WRITE_ERROR("The parking area '" + id + "' occurs at least twice."); + delete stop; + } + myParkingAreas[id] = stop; +} + + bool RONet::addRouteDef(RORouteDef* def) { return myRoutes.add(def->getID(), def); @@ -229,8 +236,9 @@ void RONet::openOutput(const OptionsCont& options, const std::string altFilename) { if (options.isSet("output-file") && options.getString("output-file") != "") { - OutputDevice::createDeviceByOption("output-file", "routes", "routes_file.xsd"); - myRoutesOutput = &OutputDevice::getDeviceByOption("output-file"); + myRoutesOutput = &OutputDevice::getDevice(options.getString("output-file")); + myRoutesOutput->writeHeader(SUMO_TAG_ROUTES); + myRoutesOutput->writeAttr("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance").writeAttr("xsi:noNamespaceSchemaLocation", "http://sumo.dlr.de/xsd/routes_file.xsd"); } if (altFilename != "") { myRouteAlternativesOutput = &OutputDevice::getDevice(altFilename); @@ -238,8 +246,9 @@ myRouteAlternativesOutput->writeAttr("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance").writeAttr("xsi:noNamespaceSchemaLocation", "http://sumo.dlr.de/xsd/routes_file.xsd"); } if (options.isSet("vtype-output") && options.getString("vtype-output") != "") { - OutputDevice::createDeviceByOption("vtype-output", "routes", "routes_file.xsd"); - myTypesOutput = &OutputDevice::getDeviceByOption("vtype-output"); + myTypesOutput = &OutputDevice::getDevice(options.getString("vtype-output")); + myTypesOutput->writeHeader(SUMO_TAG_ROUTES); + myTypesOutput->writeAttr("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance").writeAttr("xsi:noNamespaceSchemaLocation", "http://sumo.dlr.de/xsd/routes_file.xsd"); } } @@ -547,12 +556,19 @@ #ifdef HAVE_FOX // add task if (maxNumThreads > 0) { - // add thread if necessary const int numThreads = (int)myThreadPool.size(); - if (numThreads < maxNumThreads && myThreadPool.isFull()) { + if (numThreads == 0) { + // This is the very first routing. Since at least the CHRouter needs initialization + // before it gets cloned, we do not do this in parallel + routable->computeRoute(provider, removeLoops, myErrorHandler); new WorkerThread(myThreadPool, provider); + } else { + // add thread if necessary + if (numThreads < maxNumThreads && myThreadPool.isFull()) { + new WorkerThread(myThreadPool, provider); + } + myThreadPool.add(new RoutingTask(routable, removeLoops, myErrorHandler)); } - myThreadPool.add(new RoutingTask(routable, removeLoops, myErrorHandler)); continue; } #endif @@ -650,14 +666,19 @@ // add access to all public transport stops for (std::map::const_iterator i = myInstance->myBusStops.begin(); i != myInstance->myBusStops.end(); ++i) { router.addAccess(i->first, myInstance->getEdgeForLaneID(i->second->lane), i->second->endPos); - for (std::multimap::const_iterator a = i->second->accessPos.begin(); a != i->second->accessPos.end(); ++a) { + for (std::multimap::const_iterator a = i->second->accessPos.begin(); a != i->second->accessPos.end(); ++a) { router.addAccess(i->first, myInstance->getEdgeForLaneID(a->first), a->second); } } // fill the public transport router with pre-parsed public transport lines for (std::map::const_iterator i = myInstance->myFlows.getMyMap().begin(); i != myInstance->myFlows.getMyMap().end(); ++i) { if (i->second->line != "") { - router.addSchedule(*i->second); + RORouteDef* route = myInstance->getRouteDef(i->second->routeid); + const std::vector* addStops = 0; + if (route != 0 && route->getFirstRoute() != 0) { + addStops = &route->getFirstRoute()->getStops(); + } + router.addSchedule(*i->second, addStops); } } for (RoutablesMap::const_iterator i = myInstance->myRoutables.begin(); i != myInstance->myRoutables.end(); ++i) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RONet.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RONet.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RONet.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RONet.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Yun-Pang Floetteroed /// @date Sept 2002 -/// @version $Id: RONet.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: RONet.h 23341 2017-03-13 10:11:12Z behrisch $ /// // The router's network representation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include @@ -97,7 +97,7 @@ * @param[in] svc The vehicle class the restriction refers to * @param[in] speed The restricted speed */ - void addRestriction(const std::string& id, const SUMOVehicleClass svc, const SUMOReal speed); + void addRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed); /** @brief Returns the restrictions for an edge type @@ -105,7 +105,7 @@ * @param[in] id The id of the type * @return The mapping of vehicle classes to maximum speeds */ - const std::map* getRestrictions(const std::string& id) const; + const std::map* getRestrictions(const std::string& id) const; /// @name Insertion and retrieval of graph parts @@ -221,6 +221,16 @@ void addContainerStop(const std::string& id, SUMOVehicleParameter::Stop* stop); + /* @brief Adds a read parking area to the network + * + * If the parking area is already known (another one with the same id exists), + * an error is generated and given to msg-error-handler. The stop + * is deleted in this case + * + * @param[in] node The stop to add + */ + void addParkingArea(const std::string& id, SUMOVehicleParameter::Stop* stop); + /** @brief Retrieves a bus stop from the network * * @param[in] name The name of the stop to retrieve @@ -247,6 +257,20 @@ } return it->second; } + + + /** @brief Retrieves a parking area from the network + * + * @param[in] name The name of the stop to retrieve + * @return The named stop if known, otherwise 0 + */ + const SUMOVehicleParameter::Stop* getParkingArea(const std::string& id) const { + std::map::const_iterator it = myParkingAreas.find(id); + if (it == myParkingAreas.end()) { + return 0; + } + return it->second; + } //@} @@ -492,6 +516,9 @@ /// @brief Known container stops std::map myContainerStops; + /// @brief Known parking areas + std::map myParkingAreas; + /// @brief Known vehicle types NamedObjectCont myVehicleTypes; @@ -547,7 +574,7 @@ bool myHavePermissions; /// @brief The vehicle class specific speed restrictions - std::map > myRestrictions; + std::map > myRestrictions; /// @brief The number of internal edges in the dictionary int myNumInternalEdges; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RONetHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RONetHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RONetHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RONetHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Yun-Pang Floetteroed /// @date Sept 2002 -/// @version $Id: RONetHandler.cpp 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: RONetHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The handler for SUMO-Networks /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,10 +48,6 @@ #include "RONetHandler.h" #include "ROAbstractEdgeBuilder.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -91,6 +87,7 @@ case SUMO_TAG_BUS_STOP: case SUMO_TAG_TRAIN_STOP: case SUMO_TAG_CONTAINER_STOP: + case SUMO_TAG_PARKING_AREA: parseStoppingPlace(attrs, (SumoXMLTag)element); break; case SUMO_TAG_ACCESS: @@ -113,7 +110,7 @@ case SUMO_TAG_RESTRICTION: { bool ok = true; const SUMOVehicleClass svc = getVehicleClassID(attrs.get(SUMO_ATTR_VCLASS, myCurrentTypeID.c_str(), ok)); - const SUMOReal speed = attrs.get(SUMO_ATTR_SPEED, myCurrentTypeID.c_str(), ok); + const double speed = attrs.get(SUMO_ATTR_SPEED, myCurrentTypeID.c_str(), ok); if (ok) { myNet.addRestriction(myCurrentTypeID, svc, speed); } @@ -241,8 +238,8 @@ return; } // get the speed - SUMOReal maxSpeed = attrs.get(SUMO_ATTR_SPEED, id.c_str(), ok); - SUMOReal length = attrs.get(SUMO_ATTR_LENGTH, id.c_str(), ok); + double maxSpeed = attrs.get(SUMO_ATTR_SPEED, id.c_str(), ok); + double length = attrs.get(SUMO_ATTR_LENGTH, id.c_str(), ok); std::string allow = attrs.getOpt(SUMO_ATTR_ALLOW, id.c_str(), ok, ""); std::string disallow = attrs.getOpt(SUMO_ATTR_DISALLOW, id.c_str(), ok, ""); if (!ok) { @@ -270,8 +267,8 @@ return; } // get the position of the node - SUMOReal x = attrs.get(SUMO_ATTR_X, id.c_str(), ok); - SUMOReal y = attrs.get(SUMO_ATTR_Y, id.c_str(), ok); + double x = attrs.get(SUMO_ATTR_X, id.c_str(), ok); + double y = attrs.get(SUMO_ATTR_Y, id.c_str(), ok); if (ok) { RONode* n = myNet.getNode(id); if (n == 0) { @@ -331,14 +328,16 @@ throw InvalidArgument("Unknown lane '" + myCurrentStoppingPlace->lane + "' for " + toString(element) + " '" + id + "'."); } // get the positions - myCurrentStoppingPlace->startPos = attrs.getOpt(SUMO_ATTR_STARTPOS, id.c_str(), ok, 0); - myCurrentStoppingPlace->endPos = attrs.getOpt(SUMO_ATTR_ENDPOS, id.c_str(), ok, edge->getLength()); + myCurrentStoppingPlace->startPos = attrs.getOpt(SUMO_ATTR_STARTPOS, id.c_str(), ok, 0); + myCurrentStoppingPlace->endPos = attrs.getOpt(SUMO_ATTR_ENDPOS, id.c_str(), ok, edge->getLength()); const bool friendlyPos = attrs.getOpt(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false); if (!ok || !SUMORouteHandler::checkStopPos(myCurrentStoppingPlace->startPos, myCurrentStoppingPlace->endPos, edge->getLength(), POSITION_EPS, friendlyPos)) { throw InvalidArgument("Invalid position for " + toString(element) + " '" + id + "'."); } if (element == SUMO_TAG_CONTAINER_STOP) { myNet.addContainerStop(id, myCurrentStoppingPlace); + } else if (element == SUMO_TAG_PARKING_AREA) { + myNet.addParkingArea(id, myCurrentStoppingPlace); } else { myNet.addBusStop(id, myCurrentStoppingPlace); } @@ -353,14 +352,13 @@ if (edge == 0) { throw InvalidArgument("Unknown lane '" + lane + "' for access."); } - const SUMOReal pos = attrs.getOpt(SUMO_ATTR_POSITION, "access", ok, 0); + const double pos = attrs.getOpt(SUMO_ATTR_POSITION, "access", ok, 0); if (!ok) { throw ProcessError(); } myCurrentStoppingPlace->accessPos.insert(std::make_pair(lane, pos)); } - void RONetHandler::parseDistrict(const SUMOSAXAttributes& attrs) { myCurrentEdge = 0; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RONetHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RONetHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RONetHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RONetHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: RONetHandler.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RONetHandler.h 22608 2017-01-17 06:28:54Z behrisch $ /// // The handler that parses a SUMO-network for its usage in a router /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RONode.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RONode.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RONode.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RONode.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: RONode.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RONode.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A single router's node /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,10 +32,6 @@ #include #include "RONode.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RONode.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RONode.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RONode.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RONode.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: RONode.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RONode.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Base class for nodes used by the router /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROPerson.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROPerson.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROPerson.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROPerson.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: ROPerson.cpp 20698 2016-05-11 08:25:47Z behrisch $ +/// @version $Id: ROPerson.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A vehicle as used by router /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,10 +47,6 @@ #include "ROHelper.h" #include "RONet.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -69,8 +65,8 @@ void ROPerson::addTrip(const ROEdge* const from, const ROEdge* const to, const SVCPermissions modeSet, - const std::string& vTypes, const SUMOReal departPos, const SUMOReal arrivalPos, const std::string& busStop) { - PersonTrip* trip = new PersonTrip(from, to, modeSet, departPos, arrivalPos, busStop); + const std::string& vTypes, const double departPos, const double arrivalPos, const std::string& busStop, double walkFactor) { + PersonTrip* trip = new PersonTrip(from, to, modeSet, departPos, arrivalPos, busStop, walkFactor); RONet* net = RONet::getInstance(); SUMOVehicleParameter pars; pars.departProcedure = DEPART_TRIGGERED; @@ -104,7 +100,7 @@ void -ROPerson::addWalk(const ConstROEdgeVector& edges, const SUMOReal duration, const SUMOReal speed, const SUMOReal departPos, const SUMOReal arrivalPos, const std::string& busStop) { +ROPerson::addWalk(const ConstROEdgeVector& edges, const double duration, const double speed, const double departPos, const double arrivalPos, const std::string& busStop) { if (myPlan.empty() || myPlan.back()->isStop()) { myPlan.push_back(new PersonTrip()); } @@ -145,10 +141,10 @@ os.writeAttr(SUMO_ATTR_SPEED, v); } os.writeAttr(SUMO_ATTR_EDGES, edges); - if (dep != std::numeric_limits::infinity()) { + if (dep != std::numeric_limits::infinity()) { os.writeAttr(SUMO_ATTR_DEPARTPOS, dep); } - if (arr != std::numeric_limits::infinity()) { + if (arr != std::numeric_limits::infinity()) { os.writeAttr(SUMO_ATTR_ARRIVALPOS, arr); } if (destStop != "") { @@ -170,12 +166,16 @@ ROPerson::computeIntermodal(const RORouterProvider& provider, PersonTrip* const trip, const ROVehicle* const veh, MsgHandler* const errorHandler) { std::vector result; provider.getIntermodalRouter().compute(trip->getOrigin(), trip->getDestination(), trip->getDepartPos(), trip->getArrivalPos(), - myType->maxSpeed, veh, trip->getModes(), 0, result); + myType->maxSpeed * trip->getWalkFactor(), veh, trip->getModes(), myParameter.depart, result); bool carUsed = false; for (std::vector::const_iterator it = result.begin(); it != result.end(); ++it) { if (!it->edges.empty()) { if (it->line == "") { - trip->addTripItem(new Walk(it->edges, it->destStop)); + if (it + 1 == result.end() && !trip->hasBusStopDest()) { + trip->addTripItem(new Walk(it->edges)); + } else { + trip->addTripItem(new Walk(it->edges, it->destStop)); + } } else if (veh != 0 && it->line == veh->getID()) { trip->addTripItem(new Ride(it->edges.front(), it->edges.back(), veh->getID(), it->destStop)); veh->getRouteDefinition()->addLoadedAlternative(new RORoute(veh->getID() + "_RouteDef", it->edges)); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROPerson.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROPerson.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROPerson.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROPerson.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Robert Hilbrich /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: ROPerson.h 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: ROPerson.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A person as used by router /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -69,12 +69,13 @@ virtual ~ROPerson(); void addTrip(const ROEdge* const from, const ROEdge* const to, const SVCPermissions modeSet, - const std::string& vTypes, const SUMOReal departPos, const SUMOReal arrivalPos, const std::string& busStop); + const std::string& vTypes, const double departPos, const double arrivalPos, const std::string& busStop, + double walkFactor); void addRide(const ROEdge* const from, const ROEdge* const to, const std::string& lines, const std::string& destStop); - void addWalk(const ConstROEdgeVector& edges, const SUMOReal duration, const SUMOReal speed, - const SUMOReal departPos, const SUMOReal arrivalPos, const std::string& busStop); + void addWalk(const ConstROEdgeVector& edges, const double duration, const double speed, + const double departPos, const double arrivalPos, const std::string& busStop); void addStop(const SUMOVehicleParameter::Stop& stopPar, const ROEdge* const stopEdge); @@ -185,9 +186,9 @@ class Walk : public TripItem { public: Walk(const ConstROEdgeVector& _edges, const std::string& _destStop = "") - : edges(_edges), dur(-1), v(-1), dep(std::numeric_limits::infinity()), arr(std::numeric_limits::infinity()), destStop(_destStop) {} - Walk(const ConstROEdgeVector& edges, const SUMOReal duration, const SUMOReal speed, - const SUMOReal departPos, const SUMOReal arrivalPos, const std::string& _destStop) + : edges(_edges), dur(-1), v(-1), dep(std::numeric_limits::infinity()), arr(std::numeric_limits::infinity()), destStop(_destStop) {} + Walk(const ConstROEdgeVector& edges, const double duration, const double speed, + const double departPos, const double arrivalPos, const std::string& _destStop) : edges(edges), dur(duration), v(speed), dep(departPos), arr(arrivalPos), destStop(_destStop) {} const ROEdge* getOrigin() const { return edges.front(); @@ -199,7 +200,7 @@ private: const ConstROEdgeVector edges; - const SUMOReal dur, v, dep, arr; + const double dur, v, dep, arr; const std::string destStop; private: @@ -215,10 +216,10 @@ class PersonTrip : public PlanItem { public: PersonTrip() - : from(0), to(0), modes(SVC_PEDESTRIAN), dep(0), arr(0), busStop("") {} + : from(0), to(0), modes(SVC_PEDESTRIAN), dep(0), arr(0), busStop(""), walkFactor(1.0) {} PersonTrip(const ROEdge* const from, const ROEdge* const to, const SVCPermissions modeSet, - const SUMOReal departPos, const SUMOReal arrivalPos, const std::string& busStop) - : from(from), to(to), modes(modeSet), dep(departPos), arr(arrivalPos), busStop(busStop) {} + const double departPos, const double arrivalPos, const std::string& busStop, double _walkFactor) + : from(from), to(to), modes(modeSet), dep(departPos), arr(arrivalPos), busStop(busStop), walkFactor(_walkFactor) {} /// @brief Destructor virtual ~PersonTrip() { for (std::vector::const_iterator it = myTripItems.begin(); it != myTripItems.end(); ++it) { @@ -245,15 +246,18 @@ const ROEdge* getDestination() const { return to != 0 ? to : myTripItems.back()->getDestination(); } - SUMOReal getDepartPos() const { + double getDepartPos() const { return dep; } - SUMOReal getArrivalPos() const { + double getArrivalPos() const { return arr; } SVCPermissions getModes() const { return modes; } + bool hasBusStopDest() const { + return busStop != ""; + } virtual bool needsRouting() const { return myTripItems.empty(); } @@ -263,17 +267,22 @@ (*it)->saveAsXML(os); } } + double getWalkFactor() const { + return walkFactor; + } private: const ROEdge* from; const ROEdge* to; const SVCPermissions modes; - const SUMOReal dep, arr; + const double dep, arr; const std::string busStop; /// @brief the fully specified trips std::vector myTripItems; /// @brief the vehicles which may be used for routing std::vector myVehicles; + /// @brief walking speed factor + double walkFactor; private: /// @brief Invalidated assignment operator diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RORoutable.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RORoutable.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RORoutable.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RORoutable.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file RORoutable.h /// @author Michael Behrisch /// @date Oct 2015 -/// @version $Id: RORoutable.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RORoutable.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A routable thing such as a vehicle or person /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -109,7 +109,7 @@ /// @brief Returns the vehicle's maximum speed - inline SUMOReal getMaxSpeed() const { + inline double getMaxSpeed() const { return myType->maxSpeed; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RORoute.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RORoute.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RORoute.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RORoute.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Yun-Pang Floetteroed /// @date Sept 2002 -/// @version $Id: RORoute.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: RORoute.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A complete router's route /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,15 +40,11 @@ #include "ROHelper.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== -RORoute::RORoute(const std::string& id, SUMOReal costs, SUMOReal prop, +RORoute::RORoute(const std::string& id, double costs, double prop, const ConstROEdgeVector& route, const RGBColor* const color, const std::vector& stops) @@ -74,13 +70,13 @@ void -RORoute::setCosts(SUMOReal costs) { +RORoute::setCosts(double costs) { myCosts = costs; } void -RORoute::setProbability(SUMOReal prob) { +RORoute::setProbability(double prob) { myProbability = prob; } @@ -91,7 +87,7 @@ } void -RORoute::addProbability(SUMOReal prob) { +RORoute::addProbability(double prob) { myProbability += prob; } @@ -124,7 +120,7 @@ } if (withExitTimes) { std::string exitTimes; - SUMOReal time = STEPS2TIME(veh->getDepartureTime()); + double time = STEPS2TIME(veh->getDepartureTime()); for (ConstROEdgeVector::const_iterator i = myRoute.begin(); i != myRoute.end(); ++i) { if (i != myRoute.begin()) { exitTimes += " "; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RORouteDef.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RORouteDef.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RORouteDef.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RORouteDef.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: RORouteDef.cpp 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: RORouteDef.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Base class for a vehicle's route definition /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,10 +48,6 @@ #include "RORouteDef.h" #include "ROVehicle.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members // =========================================================================== @@ -288,7 +284,7 @@ delete myAlternatives[0]; myAlternatives[0] = current; } - const SUMOReal costs = router.recomputeCosts(current->getEdgeVector(), veh, begin); + const double costs = router.recomputeCosts(current->getEdgeVector(), veh, begin); if (costs < 0) { throw ProcessError("Route '" + getID() + "' (vehicle '" + veh->getID() + "') is not valid."); } @@ -300,11 +296,11 @@ myAlternatives.push_back(current); } // recompute the costs and (when a new route was added) scale the probabilities - const SUMOReal scale = SUMOReal(myAlternatives.size() - 1) / SUMOReal(myAlternatives.size()); + const double scale = double(myAlternatives.size() - 1) / double(myAlternatives.size()); for (std::vector::iterator i = myAlternatives.begin(); i != myAlternatives.end(); i++) { RORoute* alt = *i; // recompute the costs for all routes - const SUMOReal newCosts = router.recomputeCosts(alt->getEdgeVector(), veh, begin); + const double newCosts = router.recomputeCosts(alt->getEdgeVector(), veh, begin); if (newCosts < 0.) { throw ProcessError("Route '" + current->getID() + "' (vehicle '" + veh->getID() + "') is not valid."); } @@ -312,7 +308,7 @@ if (myNewRoute) { if (*i == current) { // set initial probability and costs - alt->setProbability((SUMOReal)(1.0 / (SUMOReal) myAlternatives.size())); + alt->setProbability((double)(1.0 / (double) myAlternatives.size())); alt->setCosts(newCosts); } else { // rescale probs for all others @@ -342,7 +338,7 @@ } myAlternatives.erase(myAlternatives.begin() + RouteCostCalculator::getCalculator().getMaxRouteNumber(), myAlternatives.end()); // rescale probabilities - SUMOReal newSum = 0; + double newSum = 0; for (std::vector::iterator i = myAlternatives.begin(); i != myAlternatives.end(); i++) { newSum += (*i)->getProbability(); } @@ -354,7 +350,7 @@ } // find the route to use - SUMOReal chosen = RandHelper::rand(); + double chosen = RandHelper::rand(); int pos = 0; for (std::vector::iterator i = myAlternatives.begin(); i != myAlternatives.end() - 1; i++, pos++) { chosen -= (*i)->getProbability(); @@ -416,9 +412,9 @@ } -SUMOReal +double RORouteDef::getOverallProb() const { - SUMOReal sum = 0.; + double sum = 0.; for (std::vector::const_iterator i = myAlternatives.begin(); i != myAlternatives.end(); i++) { sum += (*i)->getProbability(); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RORouteDef.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RORouteDef.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RORouteDef.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RORouteDef.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: RORouteDef.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: RORouteDef.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Base class for a vehicle's route definition /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -145,7 +145,7 @@ RORouteDef* copy(const std::string& id, const SUMOTime stopOffset) const; /** @brief Returns the sum of the probablities of the contained routes */ - SUMOReal getOverallProb() const; + double getOverallProb() const; static void setUsingJTRR() { myUsingJTRR = true; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RORoute.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RORoute.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RORoute.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RORoute.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Yun-Pang Floetteroed /// @date Sept 2002 -/// @version $Id: RORoute.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: RORoute.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A complete router's route /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -71,7 +71,7 @@ * * @todo Are costs/prob really mandatory? */ - RORoute(const std::string& id, SUMOReal costs, SUMOReal prob, + RORoute(const std::string& id, double costs, double prob, const ConstROEdgeVector& route, const RGBColor* const color, const std::vector& stops); @@ -117,7 +117,7 @@ * @return The route's costs (normally the time needed to pass it) * @todo Recheck why the costs are stored in a route */ - SUMOReal getCosts() const { + double getCosts() const { return myCosts; } @@ -127,7 +127,7 @@ * @return The probability to choose the route * @todo Recheck why the probability is stored in a route */ - SUMOReal getProbability() const { + double getProbability() const { return myProbability; } @@ -136,14 +136,14 @@ * * @todo Recheck why the costs are stored in a route */ - void setCosts(SUMOReal costs); + void setCosts(double costs); /** @brief Sets the probability of the route * * @todo Recheck why the probability is stored in a route */ - void setProbability(SUMOReal prob); + void setProbability(double prob); /** @brief Returns the number of edges in this route @@ -182,7 +182,7 @@ /** @brief add additional vehicles/probability */ - void addProbability(SUMOReal prob); + void addProbability(double prob); /** @brief Returns the list of stops this route contains * @@ -204,10 +204,10 @@ private: /// @brief The costs of the route - SUMOReal myCosts; + double myCosts; /// @brief The probability the driver will take this route with - SUMOReal myProbability; + double myProbability; /// @brief The edges the route consists of ConstROEdgeVector myRoute; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RORouteHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RORouteHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RORouteHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RORouteHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Mon, 9 Jul 2001 -/// @version $Id: RORouteHandler.cpp 21790 2016-10-25 12:37:24Z behrisch $ +/// @version $Id: RORouteHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Parser and container for routes during their loading /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -53,10 +53,6 @@ #include "RORouteDef.h" #include "RORouteHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -182,16 +178,16 @@ case SUMO_TAG_WALK: { bool ok = true; const char* const objId = myVehicleParameter->id.c_str(); - const SUMOReal duration = attrs.getOpt(SUMO_ATTR_DURATION, objId, ok, -1); + const double duration = attrs.getOpt(SUMO_ATTR_DURATION, objId, ok, -1); if (attrs.hasAttribute(SUMO_ATTR_DURATION) && duration <= 0) { throw ProcessError("Non-positive walking duration for '" + myVehicleParameter->id + "'."); } - const SUMOReal speed = attrs.getOpt(SUMO_ATTR_SPEED, objId, ok, -1.); + const double speed = attrs.getOpt(SUMO_ATTR_SPEED, objId, ok, -1.); if (attrs.hasAttribute(SUMO_ATTR_SPEED) && speed <= 0) { throw ProcessError("Non-positive walking speed for '" + myVehicleParameter->id + "'."); } - const SUMOReal departPos = attrs.getOpt(SUMO_ATTR_DEPARTPOS, objId, ok, std::numeric_limits::infinity()); - const SUMOReal arrivalPos = attrs.getOpt(SUMO_ATTR_ARRIVALPOS, objId, ok, std::numeric_limits::infinity()); + const double departPos = attrs.getOpt(SUMO_ATTR_DEPARTPOS, objId, ok, std::numeric_limits::infinity()); + const double arrivalPos = attrs.getOpt(SUMO_ATTR_ARRIVALPOS, objId, ok, std::numeric_limits::infinity()); const std::string busStop = attrs.getOpt(SUMO_ATTR_BUS_STOP, objId, ok, ""); if (!ok) { break; @@ -263,7 +259,7 @@ StringTokenizer st(vTypes); while (st.hasNext()) { SUMOVTypeParameter* type = myNet.getVehicleTypeSecure(st.next()); - myCurrentVTypeDistribution->add(1., type); + myCurrentVTypeDistribution->add(type, 1.); } } } @@ -323,13 +319,13 @@ if (myCurrentAlternatives != 0 && !attrs.hasAttribute(SUMO_ATTR_PROB)) { WRITE_WARNING("No probability for a route in '" + rid + "', using default."); } - myActiveRouteProbability = attrs.getOpt(SUMO_ATTR_PROB, myActiveRouteID.c_str(), ok, DEFAULT_VEH_PROB); + myActiveRouteProbability = attrs.getOpt(SUMO_ATTR_PROB, myActiveRouteID.c_str(), ok, DEFAULT_VEH_PROB); if (ok && myActiveRouteProbability < 0) { myErrorOutput->inform("Invalid probability for route '" + myActiveRouteID + "'."); } myActiveRouteColor = attrs.hasAttribute(SUMO_ATTR_COLOR) ? new RGBColor(attrs.get(SUMO_ATTR_COLOR, myActiveRouteID.c_str(), ok)) : 0; ok = true; - myCurrentCosts = attrs.getOpt(SUMO_ATTR_COST, myActiveRouteID.c_str(), ok, -1); + myCurrentCosts = attrs.getOpt(SUMO_ATTR_COST, myActiveRouteID.c_str(), ok, -1); if (ok && myCurrentCosts != -1 && myCurrentCosts < 0) { myErrorOutput->inform("Invalid cost for route '" + myActiveRouteID + "'."); } @@ -343,7 +339,7 @@ case SUMO_TAG_VTYPE: if (myNet.addVehicleType(myCurrentVType)) { if (myCurrentVTypeDistribution != 0) { - myCurrentVTypeDistribution->add(myCurrentVType->defaultProbability, myCurrentVType); + myCurrentVTypeDistribution->add(myCurrentVType, myCurrentVType->defaultProbability); } } myCurrentVType = 0; @@ -485,6 +481,9 @@ // fix the type id in case we used a distribution myVehicleParameter->vtypeid = type->id; } + if (type->vehicleClass == SVC_PEDESTRIAN) { + WRITE_WARNING("Vehicle type '" + type->id + "' with vClass=pedestrian should only be used for persons and not for vehicle '" + myVehicleParameter->id + "'."); + } // get the route RORouteDef* route = myNet.getRouteDef(myVehicleParameter->routeid); if (route == 0) { @@ -623,11 +622,21 @@ stop.endPos = containerstop->endPos; stop.startPos = containerstop->startPos; edge = myNet.getEdge(stop.lane.substr(0, stop.lane.rfind('_'))); + } // try to parse the assigned parking area + else if (stop.parkingarea != "") { + const SUMOVehicleParameter::Stop* parkingarea = myNet.getParkingArea(stop.parkingarea); + if (parkingarea == 0) { + myErrorOutput->inform("Unknown parking area '" + stop.parkingarea + "'" + errorSuffix); + } + stop.lane = parkingarea->lane; + stop.endPos = parkingarea->endPos; + stop.startPos = parkingarea->startPos; + edge = myNet.getEdge(stop.lane.substr(0, stop.lane.rfind('_'))); } else { // no, the lane and the position should be given stop.lane = attrs.getOpt(SUMO_ATTR_LANE, 0, ok, ""); if (!ok || stop.lane == "") { - myErrorOutput->inform("A stop must be placed on a bus stop, a container stop or a lane" + errorSuffix); + myErrorOutput->inform("A stop must be placed on a bus stop, a container stop, a parking area or a lane" + errorSuffix); return; } edge = myNet.getEdge(stop.lane.substr(0, stop.lane.rfind('_'))); @@ -635,8 +644,8 @@ myErrorOutput->inform("The lane '" + stop.lane + "' for a stop is not known" + errorSuffix); return; } - stop.endPos = attrs.getOpt(SUMO_ATTR_ENDPOS, 0, ok, edge->getLength()); - stop.startPos = attrs.getOpt(SUMO_ATTR_STARTPOS, 0, ok, stop.endPos - 2 * POSITION_EPS); + stop.endPos = attrs.getOpt(SUMO_ATTR_ENDPOS, 0, ok, edge->getLength()); + stop.startPos = attrs.getOpt(SUMO_ATTR_STARTPOS, 0, ok, stop.endPos - 2 * POSITION_EPS); const bool friendlyPos = attrs.getOpt(SUMO_ATTR_FRIENDLY_POS, 0, ok, false); if (!ok || !checkStopPos(stop.startPos, stop.endPos, edge->getLength(), POSITION_EPS, friendlyPos)) { myErrorOutput->inform("Invalid start or end position for stop" + errorSuffix); @@ -702,8 +711,8 @@ + "\n The route can not be build."); ok = false; } - const SUMOReal departPos = attrs.getOpt(SUMO_ATTR_DEPARTPOS, id, ok, 0); - const SUMOReal arrivalPos = attrs.getOpt(SUMO_ATTR_ARRIVALPOS, id, ok, -NUMERICAL_EPS); + const double departPos = attrs.getOpt(SUMO_ATTR_DEPARTPOS, id, ok, 0); + const double arrivalPos = attrs.getOpt(SUMO_ATTR_ARRIVALPOS, id, ok, -NUMERICAL_EPS); SVCPermissions modeSet = 0; for (StringTokenizer st(modes); st.hasNext();) { const std::string mode = st.next(); @@ -717,8 +726,9 @@ throw InvalidArgument("Unknown person mode '" + mode + "'."); } } + double walkFactor = attrs.getOpt(SUMO_ATTR_WALKFACTOR, id, ok, OptionsCont::getOptions().getFloat("persontrip.walkfactor")); if (ok) { - myActivePerson->addTrip(from, to, modeSet, types, departPos, arrivalPos, busStop); + myActivePerson->addTrip(from, to, modeSet, types, departPos, arrivalPos, busStop, walkFactor); } return ok; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RORouteHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RORouteHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/RORouteHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/RORouteHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 9 Jul 2001 -/// @version $Id: RORouteHandler.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RORouteHandler.h 23341 2017-03-13 10:11:12Z behrisch $ /// // Parser and container for routes during their loading /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include #include diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROVehicle.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROVehicle.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROVehicle.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROVehicle.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: ROVehicle.cpp 20542 2016-04-25 11:40:14Z namdre $ +/// @version $Id: ROVehicle.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A vehicle as used by router /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,10 +45,6 @@ #include "ROHelper.h" #include "RONet.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -186,12 +182,7 @@ for (std::vector::const_iterator stop = myParameter.stops.begin(); stop != myParameter.stops.end(); ++stop) { stop->write(os); } - for (std::map::const_iterator j = myParameter.getMap().begin(); j != myParameter.getMap().end(); ++j) { - os.openTag(SUMO_TAG_PARAM); - os.writeAttr(SUMO_ATTR_KEY, (*j).first); - os.writeAttr(SUMO_ATTR_VALUE, (*j).second); - os.closeTag(); - } + myParameter.writeParams(os); os.closeTag(); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROVehicle.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROVehicle.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/router/ROVehicle.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/router/ROVehicle.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: ROVehicle.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: ROVehicle.h 23362 2017-03-14 09:16:46Z behrisch $ /// // A vehicle as used by router /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -121,8 +121,8 @@ * * @return the maximum speed factor */ - inline SUMOReal getChosenSpeedFactor() const { - return SUMOReal(2. * getType()->speedDev + 1.) * getType()->speedFactor; + inline double getChosenSpeedFactor() const { + return getType()->speedFactor.getMax(); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/sumo_main.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/sumo_main.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/sumo_main.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/sumo_main.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Thimor Bohn /// @author Michael Behrisch /// @date Tue, 20 Nov 2001 -/// @version $Id: sumo_main.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: sumo_main.cpp 23645 2017-03-24 09:23:31Z behrisch $ /// // Main for SUMO /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,81 +39,24 @@ #include #include #include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include #include #include #include #include #include -#include -#include #include #include -#include -#include -#include - -#include #ifndef NO_TRACI #include #endif -#ifdef CHECK_MEMORY_LEAKS -#include -#endif - // =========================================================================== // functions // =========================================================================== /* ------------------------------------------------------------------------- - * data processing methods - * ----------------------------------------------------------------------- */ -/** - * loads the net, additional routes and the detectors - */ -MSNet* -load(OptionsCont& oc) { - MSFrame::setMSGlobals(oc); - MSVehicleControl* vc = 0; - if (MSGlobals::gUseMesoSim) { - vc = new MEVehicleControl(); - } else { - vc = new MSVehicleControl(); - } - MSNet* net = new MSNet(vc, new MSEventControl(), - new MSEventControl(), new MSEventControl()); -#ifndef NO_TRACI - // need to init TraCI-Server before loading routes to catch VEHICLE_STATE_BUILT - TraCIServer::openSocket(std::map()); -#endif - - NLEdgeControlBuilder eb; - NLDetectorBuilder db(*net); - NLJunctionControlBuilder jb(*net, db); - NLTriggerBuilder tb; - NLHandler handler("", *net, db, tb, eb, jb); - tb.setHandler(&handler); - NLBuilder builder(oc, *net, eb, jb, db, handler); - if (!builder.build()) { - delete net; - throw ProcessError(); - } - return net; -} - - -/* ------------------------------------------------------------------------- * main * ----------------------------------------------------------------------- */ int @@ -123,29 +66,12 @@ oc.setApplicationDescription("A microscopic road traffic simulation."); oc.setApplicationName("sumo", "SUMO Version " VERSION_STRING); int ret = 0; - MSNet* net = 0; try { // initialise subsystems XMLSubSys::init(); - MSFrame::fillOptions(); OptionsIO::setArgs(argc, argv); - OptionsIO::getOptions(); - if (oc.processMetaOptions(argc < 2)) { - SystemFrame::close(); - return 0; - } - XMLSubSys::setValidation(oc.getString("xml-validation"), oc.getString("xml-validation.net")); - if (!MSFrame::checkOptions()) { - throw ProcessError(); - } - MsgHandler::initOutputOptions(); - RandHelper::initRandGlobal(); - RandHelper::initRandGlobal(MSRouteHandler::getParsingRNG()); // load the net - net = load(oc); - if (net != 0) { - ret = net->simulate(string2time(oc.getString("begin")), string2time(oc.getString("end"))); - } + ret = NLBuilder::loadAndRun(); } catch (const ProcessError& e) { if (std::string(e.what()) != std::string("Process Error") && std::string(e.what()) != std::string("")) { WRITE_ERROR(e.what()); @@ -164,7 +90,9 @@ ret = 1; #endif } - delete net; +#ifndef NO_TRACI + TraCIServer::close(); +#endif SystemFrame::close(); return ret; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/tools/emissionsDrivingCycle_main.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/tools/emissionsDrivingCycle_main.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/tools/emissionsDrivingCycle_main.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/tools/emissionsDrivingCycle_main.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 21.08.2013 -/// @version $Id: emissionsDrivingCycle_main.cpp 21118 2016-07-05 13:46:32Z behrisch $ +/// @version $Id: emissionsDrivingCycle_main.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Main for an emissions calculator /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -54,10 +54,6 @@ #include #include "TrajectoriesHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // functions @@ -187,9 +183,9 @@ int skip = oc.getBool("skip-first") ? 1 : oc.getInt("timeline-file.skip"); const bool inKMH = oc.getBool("kmh"); const bool haveSlope = oc.getBool("have-slope"); - SUMOReal l = 0; - SUMOReal totalA = 0; - SUMOReal totalS = 0; + double l = 0; + double totalA = 0; + double totalS = 0; int time = 0; LineReader lr(oc.getString("timeline-file")); @@ -202,10 +198,10 @@ StringTokenizer st(StringUtils::prune(line), oc.getString("timeline-file.separator")); if (st.hasNext()) { try { - SUMOReal t = TplConvert::_2SUMOReal(st.next().c_str()); - SUMOReal v = 0; + double t = TplConvert::_2double(st.next().c_str()); + double v = 0; if (st.hasNext()) { - v = TplConvert::_2SUMOReal(st.next().c_str()); + v = TplConvert::_2double(st.next().c_str()); } else { v = t; t = time; @@ -213,8 +209,8 @@ if (inKMH) { v /= 3.6; } - SUMOReal a = !computeA && st.hasNext() ? TplConvert::_2SUMOReal(st.next().c_str()) : TrajectoriesHandler::INVALID_VALUE; - SUMOReal s = haveSlope && st.hasNext() ? TplConvert::_2SUMOReal(st.next().c_str()) : TrajectoriesHandler::INVALID_VALUE; + double a = !computeA && st.hasNext() ? TplConvert::_2double(st.next().c_str()) : TrajectoriesHandler::INVALID_VALUE; + double s = haveSlope && st.hasNext() ? TplConvert::_2double(st.next().c_str()) : TrajectoriesHandler::INVALID_VALUE; if (handler.writeEmissions(*out, "", defaultClass, t, v, a, s)) { l += v; totalA += a; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/tools/emissionsMap_main.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/tools/emissionsMap_main.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/tools/emissionsMap_main.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/tools/emissionsMap_main.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,7 +3,7 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 21.08.2013 -/// @version $Id: emissionsMap_main.cpp 20279 2016-03-22 13:55:22Z behrisch $ +/// @version $Id: emissionsMap_main.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Main for an emissions map writer /****************************************************************************/ @@ -49,10 +49,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // functions @@ -63,17 +59,17 @@ * main * ----------------------------------------------------------------------- */ void single(const std::string& of, const std::string& className, SUMOEmissionClass c, - SUMOReal vMin, SUMOReal vMax, SUMOReal vStep, - SUMOReal aMin, SUMOReal aMax, SUMOReal aStep, - SUMOReal sMin, SUMOReal sMax, SUMOReal sStep, + double vMin, double vMax, double vStep, + double aMin, double aMax, double aStep, + double sMin, double sMax, double sStep, bool verbose) { if (verbose) { WRITE_MESSAGE("Writing map of '" + className + "' into '" + of + "'."); } std::ofstream o(of.c_str()); - for (SUMOReal v = vMin; v <= vMax; v += vStep) { - for (SUMOReal a = aMin; a <= aMax; a += aStep) { - for (SUMOReal s = sMin; s <= sMax; s += sStep) { + for (double v = vMin; v <= vMax; v += vStep) { + for (double a = aMin; a <= aMax; a += aStep) { + for (double s = sMin; s <= sMax; s += sStep) { const PollutantsInterface::Emissions result = PollutantsInterface::computeAll(c, v, a, s); o << v << ";" << a << ";" << s << ";" << "CO" << ";" << result.CO << std::endl; o << v << ";" << a << ";" << s << ";" << "CO2" << ";" << result.CO2 << std::endl; @@ -149,15 +145,15 @@ return 0; } - SUMOReal vMin = oc.getFloat("v-min"); - SUMOReal vMax = oc.getFloat("v-max"); - SUMOReal vStep = oc.getFloat("v-step"); - SUMOReal aMin = oc.getFloat("a-min"); - SUMOReal aMax = oc.getFloat("a-max"); - SUMOReal aStep = oc.getFloat("a-step"); - SUMOReal sMin = oc.getFloat("s-min"); - SUMOReal sMax = oc.getFloat("s-max"); - SUMOReal sStep = oc.getFloat("s-step"); + double vMin = oc.getFloat("v-min"); + double vMax = oc.getFloat("v-max"); + double vStep = oc.getFloat("v-step"); + double aMin = oc.getFloat("a-min"); + double aMax = oc.getFloat("a-max"); + double aStep = oc.getFloat("a-step"); + double sMin = oc.getFloat("s-min"); + double sMax = oc.getFloat("s-max"); + double sStep = oc.getFloat("s-step"); if (!oc.getBool("iterate")) { if (!oc.isSet("emission-class")) { throw ProcessError("The emission class (-e) must be given."); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/tools/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/tools/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/tools/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/tools/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -1,7 +1,3 @@ -if CHECK_MEMORY_LEAKS -MEM_LIBS = ../foreign/nvwa/libnvwa.a -endif - bin_PROGRAMS = emissionsDrivingCycle emissionsMap emissionsDrivingCycle_SOURCES = emissionsDrivingCycle_main.cpp \ @@ -18,7 +14,6 @@ ../utils/iodevices/libiodevices.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ -l$(LIB_XERCES) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/tools/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/tools/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/tools/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/tools/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -103,7 +103,7 @@ ../utils/importio/libimportio.a \ ../utils/iodevices/libiodevices.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ - ../foreign/tcpip/libtcpip.a $(MEM_LIBS) + ../foreign/tcpip/libtcpip.a AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -120,7 +120,7 @@ ../utils/importio/libimportio.a \ ../utils/iodevices/libiodevices.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ - ../foreign/tcpip/libtcpip.a $(MEM_LIBS) + ../foreign/tcpip/libtcpip.a emissionsMap_DEPENDENCIES = $(am__DEPENDENCIES_1) emissionsMap_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ @@ -348,7 +348,6 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -@CHECK_MEMORY_LEAKS_TRUE@MEM_LIBS = ../foreign/nvwa/libnvwa.a emissionsDrivingCycle_SOURCES = emissionsDrivingCycle_main.cpp \ TrajectoriesHandler.cpp TrajectoriesHandler.h @@ -362,7 +361,6 @@ ../utils/iodevices/libiodevices.a \ ../foreign/PHEMlight/cpp/libphemlight.a \ ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ -l$(LIB_XERCES) emissionsMap_SOURCES = emissionsMap_main.cpp diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/tools/TrajectoriesHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/tools/TrajectoriesHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/tools/TrajectoriesHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/tools/TrajectoriesHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file TrajectoriesHandler.cpp /// @author Michael Behrisch /// @date 14.03.2014 -/// @version $Id: TrajectoriesHandler.cpp 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: TrajectoriesHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // An XML-Handler for amitran and netstate trajectories /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,17 +41,13 @@ #include #include "TrajectoriesHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== TrajectoriesHandler::TrajectoriesHandler(const bool computeA, const bool computeAForward, const bool accelZeroCorrection, const SUMOEmissionClass defaultClass, - const SUMOReal defaultSlope, std::ostream* stdOut, OutputDevice* xmlOut) + const double defaultSlope, std::ostream* stdOut, OutputDevice* xmlOut) : SUMOSAXHandler(""), myComputeA(computeA), myComputeAForward(computeAForward), myAccelZeroCorrection(accelZeroCorrection), myDefaultClass(defaultClass), myDefaultSlope(defaultSlope), myStdOut(stdOut), myXMLOut(xmlOut), myCurrentTime(-1), myStepSize(TS) {} @@ -72,9 +68,9 @@ break; case SUMO_TAG_VEHICLE: if (attrs.hasAttribute(SUMO_ATTR_SPEED)) { - SUMOReal v = attrs.getFloat(SUMO_ATTR_SPEED); - SUMOReal a = INVALID_VALUE; - SUMOReal s = INVALID_VALUE; + double v = attrs.getFloat(SUMO_ATTR_SPEED); + double a = INVALID_VALUE; + double s = INVALID_VALUE; writeEmissions(std::cout, attrs.getString(SUMO_ATTR_ID), myDefaultClass, STEPS2TIME(myCurrentTime), v, a, s); } else { const std::string acId = attrs.getString(SUMO_ATTR_ACTORCONFIG); @@ -91,7 +87,7 @@ const std::string vClass = attrs.getString(SUMO_ATTR_VEHICLECLASS); const std::string fuel = attrs.getString(SUMO_ATTR_FUEL); const std::string eClass = attrs.getString(SUMO_ATTR_EMISSIONCLASS); - const SUMOReal weight = attrs.getOpt(SUMO_ATTR_WEIGHT, id.c_str(), ok, 0.) * 10.; + const double weight = attrs.getOpt(SUMO_ATTR_WEIGHT, id.c_str(), ok, 0.) * 10.; myEmissionClassByType[id] = PollutantsInterface::getClass(myDefaultClass, vClass, fuel, eClass, weight); break; } @@ -102,9 +98,9 @@ myEmissionClassByVehicle[id] = myDefaultClass; } const SUMOEmissionClass c = myEmissionClassByVehicle[id]; - SUMOReal v = attrs.getFloat(SUMO_ATTR_SPEED) / 100.; - SUMOReal a = attrs.hasAttribute(SUMO_ATTR_ACCELERATION) ? attrs.get(SUMO_ATTR_ACCELERATION, id.c_str(), ok) / 1000. : INVALID_VALUE; - SUMOReal s = attrs.hasAttribute(SUMO_ATTR_SLOPE) ? RAD2DEG(asin(attrs.get(SUMO_ATTR_SLOPE, id.c_str(), ok) / 10000.)) : INVALID_VALUE; + double v = attrs.getFloat(SUMO_ATTR_SPEED) / 100.; + double a = attrs.hasAttribute(SUMO_ATTR_ACCELERATION) ? attrs.get(SUMO_ATTR_ACCELERATION, id.c_str(), ok) / 1000. : INVALID_VALUE; + double s = attrs.hasAttribute(SUMO_ATTR_SLOPE) ? RAD2DEG(asin(attrs.get(SUMO_ATTR_SLOPE, id.c_str(), ok) / 10000.)) : INVALID_VALUE; const SUMOTime time = attrs.getOpt(SUMO_ATTR_TIME, id.c_str(), ok, INVALID_VALUE); if (myXMLOut != 0) { writeXMLEmissions(id, c, time, v, a, s); @@ -122,7 +118,7 @@ const PollutantsInterface::Emissions TrajectoriesHandler::computeEmissions(const std::string id, const SUMOEmissionClass c, - SUMOReal& v, SUMOReal& a, SUMOReal& s) { + double& v, double& a, double& s) { if (myComputeA) { if (myLastV.count(id) == 0) { @@ -156,8 +152,8 @@ bool TrajectoriesHandler::writeEmissions(std::ostream& o, const std::string id, const SUMOEmissionClass c, - SUMOReal t, SUMOReal& v, - SUMOReal& a, SUMOReal& s) { + double t, double& v, + double& a, double& s) { if (myComputeA && myLastV.count(id) == 0) { myLastV[id] = v; return false; @@ -176,8 +172,8 @@ bool TrajectoriesHandler::writeXMLEmissions(const std::string id, const SUMOEmissionClass c, - SUMOTime t, SUMOReal& v, - SUMOReal a, SUMOReal s) { + SUMOTime t, double& v, + double a, double s) { if (myComputeA && myLastV.count(id) == 0) { myLastV[id] = v; return false; @@ -211,7 +207,7 @@ void -TrajectoriesHandler::writeNormedSums(std::ostream& o, const std::string id, const SUMOReal factor) { +TrajectoriesHandler::writeNormedSums(std::ostream& o, const std::string id, const double factor) { o << mySums[id].fuel / factor << "," << mySums[id].electricity / factor << "," << mySums[id].CO2 / factor << "," diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/tools/TrajectoriesHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/tools/TrajectoriesHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/tools/TrajectoriesHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/tools/TrajectoriesHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file TrajectoriesHandler.h /// @author Michael Behrisch /// @date 14.03.2014 -/// @version $Id: TrajectoriesHandler.h 21118 2016-07-05 13:46:32Z behrisch $ +/// @version $Id: TrajectoriesHandler.h 23150 2017-02-27 12:08:30Z behrisch $ /// // An XML-Handler for amitran and netstate trajectories /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,29 +55,29 @@ */ TrajectoriesHandler(const bool computeA, const bool computeAForward, const bool accelZeroCorrection, const SUMOEmissionClass defaultClass, - const SUMOReal defaultSlope, std::ostream* stdOut, OutputDevice* xmlOut); + const double defaultSlope, std::ostream* stdOut, OutputDevice* xmlOut); /// @brief Destructor ~TrajectoriesHandler(); const PollutantsInterface::Emissions computeEmissions(const std::string id, - const SUMOEmissionClass c, SUMOReal& v, - SUMOReal& a, SUMOReal& s); + const SUMOEmissionClass c, double& v, + double& a, double& s); bool writeEmissions(std::ostream& o, const std::string id, const SUMOEmissionClass c, - SUMOReal t, SUMOReal& v, - SUMOReal& a, SUMOReal& s); + double t, double& v, + double& a, double& s); bool writeXMLEmissions(const std::string id, const SUMOEmissionClass c, - SUMOTime t, SUMOReal& v, - SUMOReal a = INVALID_VALUE, SUMOReal s = INVALID_VALUE); + SUMOTime t, double& v, + double a = INVALID_VALUE, double s = INVALID_VALUE); void writeSums(std::ostream& o, const std::string id); - void writeNormedSums(std::ostream& o, const std::string id, const SUMOReal factor); + void writeNormedSums(std::ostream& o, const std::string id, const double factor); protected: @@ -103,12 +103,12 @@ const bool myComputeAForward; const bool myAccelZeroCorrection; const SUMOEmissionClass myDefaultClass; - const SUMOReal myDefaultSlope; + const double myDefaultSlope; std::ostream* myStdOut; OutputDevice* myXMLOut; - std::map myLastV; + std::map myLastV; SUMOTime myCurrentTime; - SUMOReal myStepSize; + double myStepSize; std::map mySums; std::map myEmissionClassByType; std::map myEmissionClassByVehicle; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ +noinst_LIBRARIES = libtraci.a + +libtraci_a_SOURCES = TraCI.cpp \ +TraCI.h \ +TraCI_InductionLoop.cpp \ +TraCI_InductionLoop.h \ +TraCI_Junction.cpp \ +TraCI_Junction.h \ +TraCI_Lane.cpp \ +TraCI_Lane.h \ +TraCI_LaneArea.cpp \ +TraCI_LaneArea.h \ +TraCI_MultiEntryExit.cpp \ +TraCI_MultiEntryExit.h \ +TraCI_POI.cpp \ +TraCI_POI.h \ +TraCI_Vehicle.h \ +TraCI_Vehicle.cpp \ +TraCI_Polygon.h \ +TraCI_Polygon.cpp \ +TraCI_Route.h \ +TraCI_Route.cpp \ +TraCI_VehicleType.h \ +TraCI_VehicleType.cpp diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,652 @@ +# Makefile.in generated by automake 1.13.4 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = src/traci-server/lib +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/depcomp +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +AM_V_AR = $(am__v_AR_@AM_V@) +am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) +am__v_AR_0 = @echo " AR " $@; +am__v_AR_1 = +libtraci_a_AR = $(AR) $(ARFLAGS) +libtraci_a_LIBADD = +am_libtraci_a_OBJECTS = TraCI.$(OBJEXT) TraCI_InductionLoop.$(OBJEXT) \ + TraCI_Junction.$(OBJEXT) TraCI_Lane.$(OBJEXT) \ + TraCI_LaneArea.$(OBJEXT) TraCI_MultiEntryExit.$(OBJEXT) \ + TraCI_POI.$(OBJEXT) TraCI_Vehicle.$(OBJEXT) \ + TraCI_Polygon.$(OBJEXT) TraCI_Route.$(OBJEXT) \ + TraCI_VehicleType.$(OBJEXT) +libtraci_a_OBJECTS = $(am_libtraci_a_OBJECTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libtraci_a_SOURCES) +DIST_SOURCES = $(libtraci_a_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_CPPFLAGS = @AM_CPPFLAGS@ +AM_CXXFLAGS = @AM_CXXFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFMPEG_LIBS = @FFMPEG_LIBS@ +FGREP = @FGREP@ +FOX_CONFIG = @FOX_CONFIG@ +FOX_LDFLAGS = @FOX_LDFLAGS@ +GDAL_CONFIG = @GDAL_CONFIG@ +GDAL_LDFLAGS = @GDAL_LDFLAGS@ +GREP = @GREP@ +GTEST_CONFIG = @GTEST_CONFIG@ +GTEST_LDFLAGS = @GTEST_LDFLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_XERCES = @LIB_XERCES@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OSG_LIBS = @OSG_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +PROJ_LDFLAGS = @PROJ_LDFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XERCES_CFLAGS = @XERCES_CFLAGS@ +XERCES_LDFLAGS = @XERCES_LDFLAGS@ +XERCES_LIBS = @XERCES_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LIBRARIES = libtraci.a +libtraci_a_SOURCES = TraCI.cpp \ +TraCI.h \ +TraCI_InductionLoop.cpp \ +TraCI_InductionLoop.h \ +TraCI_Junction.cpp \ +TraCI_Junction.h \ +TraCI_Lane.cpp \ +TraCI_Lane.h \ +TraCI_LaneArea.cpp \ +TraCI_LaneArea.h \ +TraCI_MultiEntryExit.cpp \ +TraCI_MultiEntryExit.h \ +TraCI_POI.cpp \ +TraCI_POI.h \ +TraCI_Vehicle.h \ +TraCI_Vehicle.cpp \ +TraCI_Polygon.h \ +TraCI_Polygon.cpp \ +TraCI_Route.h \ +TraCI_Route.cpp \ +TraCI_VehicleType.h \ +TraCI_VehicleType.cpp + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/traci-server/lib/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/traci-server/lib/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +libtraci.a: $(libtraci_a_OBJECTS) $(libtraci_a_DEPENDENCIES) $(EXTRA_libtraci_a_DEPENDENCIES) + $(AM_V_at)-rm -f libtraci.a + $(AM_V_AR)$(libtraci_a_AR) libtraci.a $(libtraci_a_OBJECTS) $(libtraci_a_LIBADD) + $(AM_V_at)$(RANLIB) libtraci.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCI.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCI_InductionLoop.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCI_Junction.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCI_Lane.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCI_LaneArea.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCI_MultiEntryExit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCI_POI.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCI_Polygon.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCI_Route.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCI_Vehicle.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCI_VehicleType.Po@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLIBRARIES cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,209 @@ +/****************************************************************************/ +/// @file TraCI.h +/// @author Daniel Krajzewicz +/// @author Mario Krumnow +/// @author Jakob Erdmann +/// @author Michael Behrisch +/// @author Robert Hilbrich +/// @date 30.05.2012 +/// @version $Id: TraCI.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "TraCI.h" + +// =========================================================================== +// static member definitions +// =========================================================================== +std::vector TraCI::myLoadArgs; + +// =========================================================================== +// member definitions +// =========================================================================== +/* void +TraCI::connect(const std::string& host, int port) { +}*/ + +void +TraCI::load(const std::vector& args) { + myLoadArgs = args; +} + +void +TraCI::close() { +} + +/* void +TraCI::subscribe(int domID, const std::string& objID, SUMOTime beginTime, SUMOTime endTime, const std::vector& vars) const { +} + +void +TraCI::subscribeContext(int domID, const std::string& objID, SUMOTime beginTime, SUMOTime endTime, int domain, double range, const std::vector< + int>& vars) const { +} */ + +const TraCI::SubscribedValues& +TraCI::getSubscriptionResults() const { + return mySubscribedValues; +} + +const TraCI::TraCIValues& +TraCI::getSubscriptionResults(const std::string& objID) const { + if (mySubscribedValues.find(objID) != mySubscribedValues.end()) { + return mySubscribedValues.find(objID)->second; + } else { + throw; // Something? + } +} + +const TraCI::SubscribedContextValues& +TraCI::getContextSubscriptionResults() const { + return mySubscribedContextValues; +} + +const TraCI::SubscribedValues& +TraCI::getContextSubscriptionResults(const std::string& objID) const { + if (mySubscribedContextValues.find(objID) != mySubscribedContextValues.end()) { + return mySubscribedContextValues.find(objID)->second; + } else { + throw; // Something? + } +} + + +TraCIPositionVector +TraCI::makeTraCIPositionVector(const PositionVector& positionVector) { + TraCIPositionVector tp; + for (int i = 0; i < (int)positionVector.size(); ++i) { + tp.push_back(makeTraCIPosition(positionVector[i])); + } + return tp; +} + + +PositionVector +TraCI::makePositionVector(const TraCIPositionVector& vector) { + PositionVector pv; + for (int i = 0; i < (int)vector.size(); i++) { + pv.push_back(Position(vector[i].x, vector[i].y)); + } + return pv; +} + + +TraCIColor +TraCI::makeTraCIColor(const RGBColor& color) { + TraCIColor tc; + tc.a = color.alpha(); + tc.b = color.blue(); + tc.g = color.green(); + tc.r = color.red(); + return tc; +} + +RGBColor +TraCI::makeRGBColor(const TraCIColor& c) { + return RGBColor((unsigned char)c.r, (unsigned char)c.g, (unsigned char)c.b, (unsigned char)c.a); +} + + +TraCIPosition +TraCI::makeTraCIPosition(const Position& position) { + TraCIPosition p; + p.x = position.x(); + p.y = position.y(); + p.z = position.z(); + return p; +} + +Position +TraCI::makePosition(const TraCIPosition& tpos) { + Position p; + p.set(tpos.x, tpos.y, tpos.z); + return p; +} + +MSEdge* +TraCI::getEdge(const std::string& edgeID) { + MSEdge* edge = MSEdge::dictionary(edgeID); + if (edge == 0) { + throw TraCIException("Referenced edge '" + edgeID + "' is not known."); + } + return edge; +} + +const MSLane* +TraCI::getLaneChecking(const std::string& edgeID, int laneIndex, double pos) { + const MSEdge* edge = MSEdge::dictionary(edgeID); + if (edge == 0) { + throw TraCIException("Unknown edge " + edgeID); + } + if (laneIndex < 0 || laneIndex >= (int)edge->getLanes().size()) { + throw TraCIException("Invalid lane index for " + edgeID); + } + const MSLane* lane = edge->getLanes()[laneIndex]; + if (pos < 0 || pos > lane->getLength()) { + throw TraCIException("Position on lane invalid"); + } + return lane; +} + +std::pair +TraCI::convertCartesianToRoadMap(Position pos) { + /// XXX use rtree instead + std::pair result; + std::vector allEdgeIds; + double minDistance = std::numeric_limits::max(); + + allEdgeIds = MSNet::getInstance()->getEdgeControl().getEdgeNames(); + for (std::vector::iterator itId = allEdgeIds.begin(); itId != allEdgeIds.end(); itId++) { + const std::vector& allLanes = MSEdge::dictionary((*itId))->getLanes(); + for (std::vector::const_iterator itLane = allLanes.begin(); itLane != allLanes.end(); itLane++) { + const double newDistance = (*itLane)->getShape().distance2D(pos); + if (newDistance < minDistance) { + minDistance = newDistance; + result.first = (*itLane); + } + } + } + // @todo this may be a place where 3D is required but 2D is delivered + result.second = result.first->getShape().nearest_offset_to_point2D(pos, false); + return result; +} + + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,124 @@ +/****************************************************************************/ +/// @file TraCI.h +/// @author Daniel Krajzewicz +/// @author Mario Krumnow +/// @author Michael Behrisch +/// @date 30.05.2012 +/// @version $Id: TraCI.h 24108 2017-04-27 18:43:30Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef TraCI_h +#define TraCI_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include + +class Position; +class PositionVector; +class RGBColor; +class MSEdge; +class MSLane; + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class TraCI + * @brief C++ TraCI client API implementation + */ +class TraCI { +public: + /// @name Connection handling + /// @{ + + /** @brief Connects to the specified SUMO server + * @param[in] host The name of the host to connect to + * @param[in] port The port to connect to + * @exception tcpip::SocketException if the connection fails + */ + //void connect(const std::string& host, int port); + + + /// @brief ends the simulation and closes the connection + void close(); + /// @} + + /// @brief load a simulation with the given arguments + static void load(const std::vector& args); + + /// @brief Advances by one step (or up to the given time) + void simulationStep(SUMOTime time = 0); + + /// @brief {object->{variable->value}} + typedef std::map TraCIValues; + typedef std::map SubscribedValues; + typedef std::map SubscribedContextValues; + + //void subscribe(int domID, const std::string& objID, SUMOTime beginTime, SUMOTime endTime, const std::vector& vars) const; + //void subscribeContext(int domID, const std::string& objID, SUMOTime beginTime, SUMOTime endTime, int domain, double range, const std::vector& vars) const; + + const SubscribedValues& getSubscriptionResults() const; + const TraCIValues& getSubscriptionResults(const std::string& objID) const; + + const SubscribedContextValues& getContextSubscriptionResults() const; + const SubscribedValues& getContextSubscriptionResults(const std::string& objID) const; + + /// @brief helper functions + static TraCIPositionVector makeTraCIPositionVector(const PositionVector& positionVector); + static TraCIPosition makeTraCIPosition(const Position& position); + static Position makePosition(const TraCIPosition& position); + + static PositionVector makePositionVector(const TraCIPositionVector& vector); + static TraCIColor makeTraCIColor(const RGBColor& color); + static RGBColor makeRGBColor(const TraCIColor& color); + + static MSEdge* getEdge(const std::string& edgeID); + static const MSLane* getLaneChecking(const std::string& edgeID, int laneIndex, double pos); + static std::pair convertCartesianToRoadMap(Position pos); + + static std::vector& getLoadArgs() { + return myLoadArgs; + } + +private: + /// @brief invalidated copy constructor + TraCI(const TraCI& src); + + /// @brief invalidated assignment operator + TraCI& operator=(const TraCI& src); + + SubscribedValues mySubscribedValues; + SubscribedContextValues mySubscribedContextValues; + + static std::vector myLoadArgs; +}; + + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_InductionLoop.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_InductionLoop.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_InductionLoop.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_InductionLoop.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,134 @@ +/****************************************************************************/ +/// @file TraCI_InductionLoop.h +/// @author Daniel Krajzewicz +/// @author Mario Krumnow +/// @author Jakob Erdmann +/// @author Michael Behrisch +/// @date 30.05.2012 +/// @version $Id: TraCI_InductionLoop.cpp 23821 2017-04-05 05:36:56Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include "TraCI_InductionLoop.h" + + +// =========================================================================== +// member definitions +// =========================================================================== +std::vector +TraCI_InductionLoop::getIDList() { + std::vector ids; + MSNet::getInstance()->getDetectorControl().getTypedDetectors(SUMO_TAG_INDUCTION_LOOP).insertIDs(ids); + return ids; +} + + +int +TraCI_InductionLoop::getIDCount() { + std::vector ids; + return (int)MSNet::getInstance()->getDetectorControl().getTypedDetectors(SUMO_TAG_INDUCTION_LOOP).size(); +} + + +double +TraCI_InductionLoop::getPosition(const std::string& detID) { + return getDetector(detID)->getPosition(); +} + + +std::string +TraCI_InductionLoop::getLaneID(const std::string& detID) { + return getDetector(detID)->getLane()->getID(); +} + + +int +TraCI_InductionLoop::getLastStepVehicleNumber(const std::string& detID) { + return getDetector(detID)->getCurrentPassedNumber(); +} + + +double +TraCI_InductionLoop::getLastStepMeanSpeed(const std::string& detID) { + return getDetector(detID)->getCurrentSpeed(); +} + + +std::vector +TraCI_InductionLoop::getLastStepVehicleIDs(const std::string& detID) { + return getDetector(detID)->getCurrentVehicleIDs(); +} + + +double +TraCI_InductionLoop::getLastStepOccupancy(const std::string& detID) { + return getDetector(detID)->getCurrentOccupancy(); +} + + +double +TraCI_InductionLoop::getLastStepMeanLength(const std::string& detID) { + return getDetector(detID)->getCurrentLength(); +} + + +double +TraCI_InductionLoop::getTimeSinceDetection(const std::string& detID) { + return getDetector(detID)->getTimeSinceLastDetection(); +} + + +std::vector +TraCI_InductionLoop::getVehicleData(const std::string& detID) { + std::vector vd = getDetector(detID)->collectVehiclesOnDet(MSNet::getInstance()->getCurrentTimeStep() - DELTA_T, true); + std::vector tvd; + for (std::vector::const_iterator vdi = vd.begin(); vdi != vd.end(); ++vdi) { + tvd.push_back(TraCIVehicleData()); + tvd.back().id = vdi->idM; + tvd.back().length = vdi->lengthM; + tvd.back().entryTime = vdi->entryTimeM; + tvd.back().leaveTime = vdi->leaveTimeM; + tvd.back().typeID = vdi->typeIDM; + } + return tvd; + +} + + +MSInductLoop* +TraCI_InductionLoop::getDetector(const std::string& id) { + MSInductLoop* il = dynamic_cast(MSNet::getInstance()->getDetectorControl().getTypedDetectors(SUMO_TAG_INDUCTION_LOOP).get(id)); + if (il == 0) { + throw TraCIException("Induction loop '" + id + "' is not known"); + } + return il; +} + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_InductionLoop.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_InductionLoop.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_InductionLoop.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_InductionLoop.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,82 @@ +/****************************************************************************/ +/// @file TraCI_InductionLoop.h +/// @author Michael Behrisch +/// @date 15.03.2017 +/// @version $Id: TraCI_InductionLoop.h 23800 2017-04-04 09:37:29Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2017-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef TraCI_InductionLoop_h +#define TraCI_InductionLoop_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include + + +// =========================================================================== +// class declarations +// =========================================================================== +class MSInductLoop; +class TraCIVehicleData; + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class TraCI_InductionLoop + * @brief C++ TraCI client API implementation + */ +class TraCI_InductionLoop { +public: + static std::vector getIDList(); + static int getIDCount(); + static double getPosition(const std::string& detID); + static std::string getLaneID(const std::string& detID); + static int getLastStepVehicleNumber(const std::string& detID); + static double getLastStepMeanSpeed(const std::string& detID); + static std::vector getLastStepVehicleIDs(const std::string& detID); + static double getLastStepOccupancy(const std::string& detID); + static double getLastStepMeanLength(const std::string& detID); + static double getTimeSinceDetection(const std::string& detID); + static std::vector getVehicleData(const std::string& detID); + +private: + static MSInductLoop* getDetector(const std::string& detID); + + /// @brief invalidated standard constructor + TraCI_InductionLoop(); + + /// @brief invalidated copy constructor + TraCI_InductionLoop(const TraCI_InductionLoop& src); + + /// @brief invalidated assignment operator + TraCI_InductionLoop& operator=(const TraCI_InductionLoop& src); + +}; + + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Junction.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Junction.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Junction.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Junction.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,78 @@ +/****************************************************************************/ +/// @file TraCI_Junction.h +/// @author Daniel Krajzewicz +/// @author Mario Krumnow +/// @author Jakob Erdmann +/// @author Michael Behrisch +/// @author Robert Hilbrich +/// @date 30.05.2012 +/// @version $Id: TraCI_Junction.cpp 23697 2017-03-28 21:22:44Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2017-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include "TraCI_Junction.h" +#include "TraCI.h" + + +// =========================================================================== +// member definitions +// =========================================================================== +std::vector +TraCI_Junction::getIDList() { + std::vector ids; + MSNet::getInstance()->getJunctionControl().insertIDs(ids); + return ids; +} + +int +TraCI_Junction::getIDCount() { + return (int) getIDList().size(); +} + +TraCIPosition +TraCI_Junction::getPosition(const std::string& junctionID) { + return TraCI::makeTraCIPosition(getJunction(junctionID)->getPosition()); +} + +TraCIPositionVector +TraCI_Junction::getShape(const std::string& junctionID) { + return TraCI::makeTraCIPositionVector(getJunction(junctionID)->getShape()); +} + +MSJunction* +TraCI_Junction::getJunction(const std::string& id) { + MSJunction* j = MSNet::getInstance()->getJunctionControl().get(id); + if (j == 0) { + throw TraCIException("Junction '" + id + "' is not known"); + } + return j; +} + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Junction.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Junction.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Junction.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Junction.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,85 @@ +/****************************************************************************/ +/// @file TraCI_Junction.h +/// @author Daniel Krajzewicz +/// @author Mario Krumnow +/// @author Michael Behrisch +/// @date 30.05.2012 +/// @version $Id: TraCI_Junction.h 23527 2017-03-18 08:45:42Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef TraCI_Junction_h +#define TraCI_Junction_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include + + +// =========================================================================== +// class declarations +// =========================================================================== +class PointOfInterest; + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class TraCI_Junction + * @brief C++ TraCI client API implementation + */ +class TraCI_Junction { +public: + + + static std::vector getIDList(); + static int getIDCount(); + static TraCIPosition getPosition(const std::string& junctionID); + static TraCIPositionVector getShape(const std::string& junctionID); + + + static std::string getType(const std::string& poiID); + static TraCIColor getColor(const std::string& poiID); + + + static void subscribe(const std::string& objID, SUMOTime beginTime, SUMOTime endTime, const std::vector& vars); + static void subscribeContext(const std::string& objID, SUMOTime beginTime, SUMOTime endTime, int domain, double range, const std::vector& vars); + static MSJunction* getJunction(const std::string& id); + +private: + /// @brief invalidated standard constructor + TraCI_Junction(); + + /// @brief invalidated copy constructor + TraCI_Junction(const TraCI_Junction& src); + + /// @brief invalidated assignment operator + TraCI_Junction& operator=(const TraCI_Junction& src); +}; + + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_LaneArea.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_LaneArea.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_LaneArea.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_LaneArea.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,130 @@ +/****************************************************************************/ +/// @file TraCI_LaneArea.h +/// @author Daniel Krajzewicz +/// @author Mario Krumnow +/// @author Jakob Erdmann +/// @author Michael Behrisch +/// @date 30.05.2012 +/// @version $Id: TraCI_LaneArea.cpp 24028 2017-04-24 05:10:18Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include "TraCI_LaneArea.h" + + +// =========================================================================== +// member definitions +// =========================================================================== +std::vector +TraCI_LaneArea::getIDList() { + std::vector ids; + MSNet::getInstance()->getDetectorControl().getTypedDetectors(SUMO_TAG_LANE_AREA_DETECTOR).insertIDs(ids); + return ids; +} + + +int +TraCI_LaneArea::getIDCount() { + std::vector ids; + return (int)MSNet::getInstance()->getDetectorControl().getTypedDetectors(SUMO_TAG_LANE_AREA_DETECTOR).size(); +} + + +int +TraCI_LaneArea::getJamLengthVehicle(const std::string& detID) { + return getDetector(detID)->getCurrentJamLengthInVehicles(); +} + + +double +TraCI_LaneArea::getJamLengthMeters(const std::string& detID) { + return getDetector(detID)->getCurrentJamLengthInMeters(); +} + + +double +TraCI_LaneArea::getLastStepMeanSpeed(const std::string& detID) { + return getDetector(detID)->getCurrentMeanSpeed(); +} + + +std::vector +TraCI_LaneArea::getLastStepVehicleIDs(const std::string& detID) { + return getDetector(detID)->getCurrentVehicleIDs(); +} + + +double +TraCI_LaneArea::getLastStepOccupancy(const std::string& detID) { + return getDetector(detID)->getCurrentOccupancy(); +} + + +double +TraCI_LaneArea::getPosition(const std::string& detID) { + return getDetector(detID)->getStartPos(); +} + + +std::string +TraCI_LaneArea::getLaneID(const std::string& detID) { + return getDetector(detID)->getLane()->getID(); +} + + +double +TraCI_LaneArea::getLength(const std::string& detID) { + const MSE2Collector* const e2 = getDetector(detID); + return e2->getEndPos() - e2->getStartPos(); +} + + +int +TraCI_LaneArea::getLastStepVehicleNumber(const std::string& detID) { + return getDetector(detID)->getCurrentVehicleNumber(); +} + + +int +TraCI_LaneArea::getLastStepHaltingNumber(const std::string& detID) { + return getDetector(detID)->getCurrentHaltingNumber(); +} + + +MSE2Collector* +TraCI_LaneArea::getDetector(const std::string& id) { + MSE2Collector* e2 = dynamic_cast(MSNet::getInstance()->getDetectorControl().getTypedDetectors(SUMO_TAG_LANE_AREA_DETECTOR).get(id)); + if (e2 == 0) { + throw TraCIException("Lane area detector '" + id + "' is not known"); + } + return e2; +} + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_LaneArea.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_LaneArea.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_LaneArea.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_LaneArea.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,82 @@ +/****************************************************************************/ +/// @file TraCI_LaneArea.h +/// @author Michael Behrisch +/// @date 15.03.2017 +/// @version $Id: TraCI_LaneArea.h 24028 2017-04-24 05:10:18Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2017-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef TraCI_LaneArea_h +#define TraCI_LaneArea_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include + + +// =========================================================================== +// class declarations +// =========================================================================== +class MSE2Collector; + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class TraCI_LaneArea + * @brief C++ TraCI client API implementation + */ +class TraCI_LaneArea { +public: + static std::vector getIDList(); + static int getIDCount(); + static int getJamLengthVehicle(const std::string& detID); + static double getJamLengthMeters(const std::string& detID); + static double getLastStepMeanSpeed(const std::string& detID); + static std::vector getLastStepVehicleIDs(const std::string& detID); + static double getLastStepOccupancy(const std::string& detID); + static double getPosition(const std::string& detID); + static std::string getLaneID(const std::string& detID); + static double getLength(const std::string& detID); + static int getLastStepVehicleNumber(const std::string& detID); + static int getLastStepHaltingNumber(const std::string& detID); + +private: + static MSE2Collector* getDetector(const std::string& detID); + + /// @brief invalidated standard constructor + TraCI_LaneArea(); + + /// @brief invalidated copy constructor + TraCI_LaneArea(const TraCI_LaneArea& src); + + /// @brief invalidated assignment operator + TraCI_LaneArea& operator=(const TraCI_LaneArea& src); + +}; + + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Lane.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Lane.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Lane.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Lane.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,326 @@ +/****************************************************************************/ +/// @file TraCI_Lane.h +/// @author Daniel Krajzewicz +/// @author Mario Krumnow +/// @author Jakob Erdmann +/// @author Michael Behrisch +/// @author Robert Hilbrich +/// @author Leonhard Luecken +/// @date 30.05.2012 +/// @version $Id: TraCI_Lane.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2017-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include "TraCI_Lane.h" + + +// =========================================================================== +// member definitions +// =========================================================================== +std::vector +TraCI_Lane::getIDList() { + std::vector ids; + MSLane::insertIDs(ids); + return ids; +} + + +int +TraCI_Lane::getIDCount() { + return (int)getIDList().size(); +} + + +std::string +TraCI_Lane::getEdgeID(std::string laneID) { + return getLane(laneID)->getEdge().getID(); +} + + +double +TraCI_Lane::getLength(std::string laneID) { + return getLane(laneID)->getLength(); +} + + +double +TraCI_Lane::getMaxSpeed(std::string laneID) { + return getLane(laneID)->getSpeedLimit(); +} + + +int +TraCI_Lane::getLinkNumber(std::string laneID) { + return (int) getLane(laneID)->getLinkCont().size(); +} + + +std::vector +TraCI_Lane::getLinks(std::string laneID) { + std::vector v; + const MSLane* lane = getLane(laneID); + const SUMOTime currTime = MSNet::getInstance()->getCurrentTimeStep(); + const MSLinkCont& links = lane->getLinkCont(); + for (MSLinkCont::const_iterator i = links.begin(); i != links.end(); ++i) { + MSLink* link = (*i); + const std::string approachedLane = link->getLane() != 0 ? link->getLane()->getID() : ""; + const bool hasPrio = link->havePriority() ? 1 : 0; + const double speed = MIN2(lane->getSpeedLimit(), link->getLane()->getSpeedLimit()); + const bool isOpen = link->opened(currTime, speed, speed, SUMOVTypeParameter::getDefault().length, + SUMOVTypeParameter::getDefault().impatience, SUMOVTypeParameter::getDefaultDecel(), 0) ? 1 : 0; + const bool hasFoe = link->hasApproachingFoe(currTime, currTime, 0, SUMOVTypeParameter::getDefaultDecel()) ? 1 : 0; + const std::string approachedInternal = link->getViaLane() != 0 ? link->getViaLane()->getID() : ""; + const std::string state = SUMOXMLDefinitions::LinkStates.getString(link->getState()); + const std::string direction = SUMOXMLDefinitions::LinkDirections.getString(link->getDirection()); + const double length = link->getLength(); + v.push_back(TraCIConnection(approachedLane, hasPrio, isOpen, hasFoe, approachedInternal, state, direction, length)); + } + return v; +} + + +std::vector +TraCI_Lane::getAllowed(std::string laneID) { + SVCPermissions permissions = getLane(laneID)->getPermissions(); + if (permissions == SVCAll) { // special case: write nothing + permissions = 0; + } + return getVehicleClassNamesList(permissions); +} + + +std::vector +TraCI_Lane::getDisallowed(std::string laneID) { + return getVehicleClassNamesList(~(getLane(laneID)->getPermissions())); // negation yields disallowed +} + + +TraCIPositionVector +TraCI_Lane::getShape(std::string laneID) { + TraCIPositionVector pv; + const PositionVector& shp = getLane(laneID)->getShape(); + for (PositionVector::const_iterator pi = shp.begin(); pi != shp.end(); ++pi) { + TraCIPosition p; + p.x = pi->x(); + p.y = pi->y(); + p.z = pi->z(); + pv.push_back(p); + } + return pv; +} + + +double +TraCI_Lane::getWidth(std::string laneID) { + return getLane(laneID)->getWidth(); +} + + +double +TraCI_Lane::getCO2Emission(std::string laneID) { + return getLane(laneID)->getCO2Emissions(); +} + + +double +TraCI_Lane::getCOEmission(std::string laneID) { + return getLane(laneID)->getCOEmissions(); +} + + +double +TraCI_Lane::getHCEmission(std::string laneID) { + return getLane(laneID)->getHCEmissions(); +} + + +double +TraCI_Lane::getPMxEmission(std::string laneID) { + return getLane(laneID)->getPMxEmissions(); +} + + +double +TraCI_Lane::getNOxEmission(std::string laneID) { + return getLane(laneID)->getNOxEmissions(); +} + +double +TraCI_Lane::getFuelConsumption(std::string laneID) { + return getLane(laneID)->getFuelConsumption(); +} + + +double +TraCI_Lane::getNoiseEmission(std::string laneID) { + return getLane(laneID)->getHarmonoise_NoiseEmissions(); +} + + +double +TraCI_Lane::getElectricityConsumption(std::string laneID) { + return getLane(laneID)->getElectricityConsumption(); +} + + +double +TraCI_Lane::getLastStepMeanSpeed(std::string laneID) { + return getLane(laneID)->getMeanSpeed(); +} + + +double +TraCI_Lane::getLastStepOccupancy(std::string laneID) { + return getLane(laneID)->getNettoOccupancy(); +} + + +double +TraCI_Lane::getLastStepLength(std::string laneID) { + const MSLane* lane = getLane(laneID); + double length = 0; + const MSLane::VehCont& vehs = lane->getVehiclesSecure(); + for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) { + length += (*j)->getVehicleType().getLength(); + } + if (vehs.size() > 0) { + length = length / (double) vehs.size(); + } + lane->releaseVehicles(); + return length; +} + + +double +TraCI_Lane::getWaitingTime(std::string laneID) { + return getLane(laneID)->getWaitingSeconds(); +} + + +double +TraCI_Lane::getTraveltime(std::string laneID) { + const MSLane* lane = getLane(laneID); + double meanSpeed = lane->getMeanSpeed(); + if (meanSpeed != 0) { + return lane->getLength() / meanSpeed; + } else { + return 1000000.; + } +} + + +int +TraCI_Lane::getLastStepVehicleNumber(std::string laneID) { + return (int) getLane(laneID)->getVehicleNumber(); +} + +int +TraCI_Lane::getLastStepHaltingNumber(std::string laneID) { + const MSLane* lane = getLane(laneID); + int halting = 0; + const MSLane::VehCont& vehs = lane->getVehiclesSecure(); + for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) { + if ((*j)->getSpeed() < SUMO_const_haltingSpeed) { + ++halting; + } + } + lane->releaseVehicles(); + return halting; +} + + +std::vector +TraCI_Lane::getLastStepVehicleIDs(std::string laneID) { + const MSLane* lane = getLane(laneID); + std::vector vehIDs; + const MSLane::VehCont& vehs = lane->getVehiclesSecure(); + for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) { + vehIDs.push_back((*j)->getID()); + } + lane->releaseVehicles(); + return vehIDs; +} + + + + +void +TraCI_Lane::setAllowed(std::string laneID, std::vector allowedClasses) { + MSLane* l = const_cast(getLane(laneID)); + l->setPermissions(parseVehicleClasses(allowedClasses), MSLane::CHANGE_PERMISSIONS_PERMANENT); + l->getEdge().rebuildAllowedLanes(); +} + + +void +TraCI_Lane::setDisallowed(std::string laneID, std::vector disallowedClasses) { + MSLane* l = const_cast(getLane(laneID)); + l->setPermissions(~parseVehicleClasses(disallowedClasses), MSLane::CHANGE_PERMISSIONS_PERMANENT); // negation yields allowed + l->getEdge().rebuildAllowedLanes(); +} + + +void +TraCI_Lane::setMaxSpeed(std::string laneID, double speed) { + MSLane* l = const_cast(getLane(laneID)); + l->setMaxSpeed(speed); +} + + +void +TraCI_Lane::setLength(std::string laneID, double length) { + MSLane* l = const_cast(getLane(laneID)); + l->setLength(length); +} + + +std::string +TraCI_Lane::getParameter(const std::string& laneID, const std::string& param) { + return getLane(laneID)->getParameter(param, ""); +} + + +void +TraCI_Lane::setParameter(const std::string& laneID, const std::string& key, const std::string& value) { + MSLane* l = const_cast(getLane(laneID)); + l->addParameter(key, value); +} + + +const MSLane* +TraCI_Lane::getLane(const std::string& id) { + const MSLane* r = MSLane::dictionary(id); + if (r == 0) { + throw TraCIException("Lane '" + id + "' is not known"); + } + return r; +} + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Lane.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Lane.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Lane.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Lane.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,115 @@ +/****************************************************************************/ +/// @file TraCI_Lane.h +/// @author Daniel Krajzewicz +/// @author Mario Krumnow +/// @author Michael Behrisch +/// @author Leonhard Luecken +/// @date 30.05.2012 +/// @version $Id: TraCI_Lane.h 23999 2017-04-21 09:04:47Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef TraCI_Lane_h +#define TraCI_Lane_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include + + +// =========================================================================== +// class declarations +// =========================================================================== +class MSLane; + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class TraCI_Lane + * @brief C++ TraCI client API implementation + */ +class TraCI_Lane { +public: + + // Getter + static std::vector getIDList(); + static int getIDCount(); + static int getLinkNumber(std::string laneID); + static std::string getEdgeID(std::string laneID); + static double getLength(std::string laneID); + static double getMaxSpeed(std::string laneID); + static std::vector getAllowed(std::string laneID); + static std::vector getDisallowed(std::string laneID); + static std::vector getLinks(std::string laneID); + static TraCIPositionVector getShape(std::string laneID); + static double getWidth(std::string laneID); + static double getCO2Emission(std::string laneID); + static double getCOEmission(std::string laneID); + static double getHCEmission(std::string laneID); + static double getPMxEmission(std::string laneID); + static double getNOxEmission(std::string laneID); + static double getFuelConsumption(std::string laneID); + static double getNoiseEmission(std::string laneID); + static double getElectricityConsumption(std::string laneID); + static double getLastStepMeanSpeed(std::string laneID); + static double getLastStepOccupancy(std::string laneID); + static double getLastStepLength(std::string laneID); + static double getWaitingTime(std::string laneID); + static double getTraveltime(std::string laneID); + static int getLastStepVehicleNumber(std::string laneID); + static int getLastStepHaltingNumber(std::string laneID); + static std::vector getLastStepVehicleIDs(std::string laneID); + + // Setter + static void setAllowed(std::string laneID, std::vector allowedClasses); + static void setDisallowed(std::string laneID, std::vector disallowedClasses); + static void setMaxSpeed(std::string laneID, double speed); + static void setLength(std::string laneID, double length); + + // Generic parameter get/set + static std::string getParameter(const std::string& laneID, const std::string& param); + static void setParameter(const std::string& routeID, const std::string& key, const std::string& value); // not needed so far + + // Subscriptions (TODO?) + static void subscribe(const std::string& objID, SUMOTime beginTime, SUMOTime endTime, const std::vector& vars); + static void subscribeContext(const std::string& objID, SUMOTime beginTime, SUMOTime endTime, int domain, double range, const std::vector& vars); + + static const MSLane* getLane(const std::string& id); + +private: + /// @brief invalidated standard constructor + TraCI_Lane(); + + /// @brief invalidated copy constructor + TraCI_Lane(const TraCI_Lane& src); + + /// @brief invalidated assignment operator + TraCI_Lane& operator=(const TraCI_Lane& src); +}; + + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_MultiEntryExit.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_MultiEntryExit.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_MultiEntryExit.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_MultiEntryExit.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,93 @@ +/****************************************************************************/ +/// @file TraCI_MultiEntryExit.h +/// @author Daniel Krajzewicz +/// @author Mario Krumnow +/// @author Jakob Erdmann +/// @author Michael Behrisch +/// @date 30.05.2012 +/// @version $Id: TraCI_MultiEntryExit.cpp 23804 2017-04-04 12:13:16Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include "TraCI_MultiEntryExit.h" + + +// =========================================================================== +// member definitions +// =========================================================================== +std::vector +TraCI_MultiEntryExit::getIDList() { + std::vector ids; + MSNet::getInstance()->getDetectorControl().getTypedDetectors(SUMO_TAG_ENTRY_EXIT_DETECTOR).insertIDs(ids); + return ids; +} + + +int +TraCI_MultiEntryExit::getIDCount() { + std::vector ids; + return (int)MSNet::getInstance()->getDetectorControl().getTypedDetectors(SUMO_TAG_ENTRY_EXIT_DETECTOR).size(); +} + + +int +TraCI_MultiEntryExit::getLastStepVehicleNumber(const std::string& detID) { + return getDetector(detID)->getVehiclesWithin(); +} + + +double +TraCI_MultiEntryExit::getLastStepMeanSpeed(const std::string& detID) { + return getDetector(detID)->getCurrentMeanSpeed(); +} + + +std::vector +TraCI_MultiEntryExit::getLastStepVehicleIDs(const std::string& detID) { + return getDetector(detID)->getCurrentVehicleIDs(); +} + + +int +TraCI_MultiEntryExit::getLastStepHaltingNumber(const std::string& detID) { + return getDetector(detID)->getCurrentHaltingNumber(); +} + + +MSE3Collector* +TraCI_MultiEntryExit::getDetector(const std::string& id) { + MSE3Collector* e3 = dynamic_cast(MSNet::getInstance()->getDetectorControl().getTypedDetectors(SUMO_TAG_ENTRY_EXIT_DETECTOR).get(id)); + if (e3 == 0) { + throw TraCIException("Multi entry exit detector '" + id + "' is not known"); + } + return e3; +} + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_MultiEntryExit.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_MultiEntryExit.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_MultiEntryExit.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_MultiEntryExit.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,76 @@ +/****************************************************************************/ +/// @file TraCI_MultiEntryExit.h +/// @author Michael Behrisch +/// @date 15.03.2017 +/// @version $Id: TraCI_MultiEntryExit.h 23804 2017-04-04 12:13:16Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2017-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef TraCI_MultiEntryExit_h +#define TraCI_MultiEntryExit_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include + + +// =========================================================================== +// class declarations +// =========================================================================== +class MSE2Collector; + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class TraCI_MultiEntryExit + * @brief C++ TraCI client API implementation + */ +class TraCI_MultiEntryExit { +public: + static std::vector getIDList(); + static int getIDCount(); + static int getLastStepVehicleNumber(const std::string& detID); + static double getLastStepMeanSpeed(const std::string& detID); + static std::vector getLastStepVehicleIDs(const std::string& detID); + static int getLastStepHaltingNumber(const std::string& detID); + +private: + static MSE3Collector* getDetector(const std::string& detID); + + /// @brief invalidated standard constructor + TraCI_MultiEntryExit(); + + /// @brief invalidated copy constructor + TraCI_MultiEntryExit(const TraCI_MultiEntryExit& src); + + /// @brief invalidated assignment operator + TraCI_MultiEntryExit& operator=(const TraCI_MultiEntryExit& src); + +}; + + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_POI.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_POI.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_POI.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_POI.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,140 @@ +/****************************************************************************/ +/// @file TraCI_POI.h +/// @author Daniel Krajzewicz +/// @author Mario Krumnow +/// @author Jakob Erdmann +/// @author Michael Behrisch +/// @author Robert Hilbrich +/// @date 30.05.2012 +/// @version $Id: TraCI_POI.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2017-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include "TraCI_POI.h" +#include "TraCI.h" + + + + +// =========================================================================== +// member definitions +// =========================================================================== +std::vector +TraCI_POI::getIDList() { + std::vector ids; + ShapeContainer& shapeCont = MSNet::getInstance()->getShapeContainer(); + shapeCont.getPOIs().insertIDs(ids); + return ids; +} + +int +TraCI_POI::getIDCount() { + return (int)getIDList().size(); +} + +std::string +TraCI_POI::getType(const std::string& poiID) { + return getPoI(poiID)->getType(); +} + +TraCIColor +TraCI_POI::getColor(const std::string& poiID) { + PointOfInterest* sumoPoi = getPoI(poiID); + RGBColor col = sumoPoi->getColor(); + return TraCI::makeTraCIColor(col); +} + +TraCIPosition +TraCI_POI::getPosition(const std::string& poiID) { + TraCIPosition pos; + PointOfInterest* p = getPoI(poiID); + pos.x = p->x(); + pos.y = p->y(); + pos.z = p->z(); + return pos; +} + +std::string +TraCI_POI::getParameter(const std::string& poiID, const std::string& param) { + PointOfInterest* p = getPoI(poiID); + return p->getParameter(param, ""); +} + +void +TraCI_POI::setType(const std::string& poiID, const std::string& type) { + PointOfInterest* p = getPoI(poiID); + p->setType(type); +} + +void +TraCI_POI::setPosition(const std::string& poiID, const TraCIPosition& pos) { + PointOfInterest* p = getPoI(poiID); + p->set(TraCI::makePosition(pos)); +} + +void +TraCI_POI::setColor(const std::string& poiID, const TraCIColor& c) { + PointOfInterest* p = getPoI(poiID); + p->setColor(TraCI::makeRGBColor(c)); +} + +bool +TraCI_POI::add(const std::string& poiID, const TraCIPosition& pos, const TraCIColor& c, const std::string& type, int layer) { + ShapeContainer& shapeCont = MSNet::getInstance()->getShapeContainer(); + return shapeCont.addPOI(poiID, type, TraCI::makeRGBColor(c), (double) layer, + Shape::DEFAULT_ANGLE, + Shape::DEFAULT_IMG_FILE, + TraCI::makePosition(pos), + Shape::DEFAULT_IMG_WIDTH, + Shape::DEFAULT_IMG_HEIGHT); +} + +bool +TraCI_POI::remove(const std::string& poiID, int /* layer */) { + ShapeContainer& shapeCont = MSNet::getInstance()->getShapeContainer(); + return shapeCont.removePOI(poiID); +} + +void +TraCI_POI::addParameter(const std::string& poiID, const std::string& param, const std::string& value) { + PointOfInterest* p = getPoI(poiID); + p->addParameter(param, value); +} + + +PointOfInterest* +TraCI_POI::getPoI(const std::string& id) { + PointOfInterest* sumoPoi = MSNet::getInstance()->getShapeContainer().getPOIs().get(id); + if (sumoPoi == 0) { + throw TraCIException("POI '" + id + "' is not known"); + } + return sumoPoi; +} + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_POI.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_POI.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_POI.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_POI.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,89 @@ +/****************************************************************************/ +/// @file TraCI_POI.h +/// @author Daniel Krajzewicz +/// @author Mario Krumnow +/// @author Michael Behrisch +/// @author Robert Hilbrich +/// @date 30.05.2012 +/// @version $Id: TraCI_POI.h 23594 2017-03-22 07:37:54Z namdre $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef TraCI_POI_h +#define TraCI_POI_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include + + +// =========================================================================== +// class declarations +// =========================================================================== +class PointOfInterest; + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class TraCI_POI + * @brief C++ TraCI client API implementation + */ +class TraCI_POI { +public: + static std::vector getIDList(); + static int getIDCount(); + static std::string getType(const std::string& poiID); + static TraCIPosition getPosition(const std::string& poiID); + static TraCIColor getColor(const std::string& poiID); + static std::string getParameter(const std::string& poiID, const std::string& param); + + static void setType(const std::string& poiID, const std::string& setType); + static void setColor(const std::string& poiID, const TraCIColor& c); + static void setPosition(const std::string& poiID, const TraCIPosition& pos); + static bool add(const std::string& poiID, const TraCIPosition& pos, const TraCIColor& c, const std::string& type, int layer); + static bool remove(const std::string& poiID, int layer = 0); + + static void subscribe(const std::string& objID, SUMOTime beginTime, SUMOTime endTime, const std::vector& vars); + static void subscribeContext(const std::string& objID, SUMOTime beginTime, SUMOTime endTime, int domain, double range, const std::vector& vars); + static void addParameter(const std::string& poiID, const std::string& param, const std::string& value); + +private: + static PointOfInterest* getPoI(const std::string& id); + + /// @brief invalidated standard constructor + TraCI_POI(); + + /// @brief invalidated copy constructor + TraCI_POI(const TraCI_POI& src); + + /// @brief invalidated assignment operator + TraCI_POI& operator=(const TraCI_POI& src); +}; + + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Polygon.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Polygon.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Polygon.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Polygon.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,100 @@ +/****************************************************************************/ +/// @file TraCI_Polygon.cpp +/// @author Gregor L\"ammel +/// @date 15.03.2017 +/// @version $Id: TraCI_Polygon.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2017 - 2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + + +#include +#include +#include + +#include "TraCI_Polygon.h" +#include "TraCI.h" + +std::vector TraCI_Polygon::getIDList() { + std::vector ids; + ShapeContainer& shapeCont = MSNet::getInstance()->getShapeContainer(); + shapeCont.getPolygons().insertIDs(ids); + return ids; +} +std::string TraCI_Polygon::getType(const std::string& polygonID) { + return getPolygon(polygonID)->getType(); +} +TraCIPositionVector TraCI_Polygon::getShape(const std::string& polygonID) { + SUMO::Polygon* p = getPolygon(polygonID); + return TraCI::makeTraCIPositionVector(p->getShape()); +} +bool TraCI_Polygon::getFilled(const std::string& polygonID) { + return getPolygon(polygonID)->getFill(); +} +TraCIColor TraCI_Polygon::getColor(const std::string& polygonID) { + SUMO::Polygon* p = getPolygon(polygonID); + return TraCI::makeTraCIColor(p->getColor()); +} +std::string TraCI_Polygon::getParameter(const std::string& polygonID, const std::string& paramName) { + return getPolygon(polygonID)->getParameter(paramName, ""); +} +void TraCI_Polygon::setType(const std::string& polygonID, const std::string& setType) { + SUMO::Polygon* p = getPolygon(polygonID); + p->setType(setType); +} +void TraCI_Polygon::setShape(const std::string& polygonID, const TraCIPositionVector& shape) { + PositionVector positionVector = TraCI::makePositionVector(shape); + getPolygon(polygonID); // just to check whether it exists + ShapeContainer& shapeCont = MSNet::getInstance()->getShapeContainer(); + shapeCont.reshapePolygon(polygonID, positionVector); +} +void TraCI_Polygon::setColor(const std::string& polygonID, const TraCIColor& c) { + getPolygon(polygonID)->setColor(TraCI::makeRGBColor(c)); +} +void +TraCI_Polygon::add(const std::string& polygonID, const TraCIPositionVector& shape, const TraCIColor& c, bool fill, const std::string& type, int layer) { + ShapeContainer& shapeCont = MSNet::getInstance()->getShapeContainer(); + PositionVector pShape = TraCI::makePositionVector(shape); + RGBColor col = TraCI::makeRGBColor(c); + if (!shapeCont.addPolygon(polygonID, type, col, (double)layer, Shape::DEFAULT_ANGLE, Shape::DEFAULT_IMG_FILE, pShape, fill)) { + throw TraCIException("Could not add polygon '" + polygonID + "'"); + } +} +void TraCI_Polygon::remove(const std::string& polygonID, int /* layer */) { + // !!! layer not used yet (shouldn't the id be enough?) + ShapeContainer& shapeCont = MSNet::getInstance()->getShapeContainer(); + if (!shapeCont.removePolygon(polygonID)) { + throw TraCIException("Could not remove polygon '" + polygonID + "'"); + } +} + +void TraCI_Polygon::setFilled(std::string polygonID, bool filled) { + SUMO::Polygon* p = getPolygon(polygonID); + p->setFill(filled); +} + +SUMO::Polygon* TraCI_Polygon::getPolygon(const std::string& id) { + SUMO::Polygon* p = MSNet::getInstance()->getShapeContainer().getPolygons().get(id); + if (p == 0) { + throw TraCIException("Polygon '" + id + "' is not known"); + } + return p; +} +void TraCI_Polygon::setParameter(std::string& id, std::string& name, std::string& value) { + SUMO::Polygon* p = getPolygon(id); + p->addParameter(name, value); +} + + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Polygon.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Polygon.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Polygon.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Polygon.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,67 @@ +/****************************************************************************/ +/// @file TraCI_Polygon.h +/// @author Gregor L\"ammel +/// @date 15.03.2017 +/// @version $Id: TraCI_Polygon.h 24108 2017-04-27 18:43:30Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2017 - 2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +#ifndef SUMO_TRACI_POLYGON_H +#define SUMO_TRACI_POLYGON_H + +#include +#include +#include +#include +class TraCI_Polygon { + +public: + + + static std::vector getIDList(); + static std::string getType(const std::string& polygonID); + static TraCIPositionVector getShape(const std::string& polygonID); + static TraCIColor getColor(const std::string& polygonID); + static bool getFilled(const std::string& polygonID); + static std::string getParameter(const std::string& polygonID, const std::string& paramName); + static void setType(const std::string& polygonID, const std::string& setType); + static void setShape(const std::string& polygonID, const TraCIPositionVector& shape); + static void setColor(const std::string& polygonID, const TraCIColor& c); + static void add(const std::string& polygonID, const TraCIPositionVector& shape, const TraCIColor& c, bool fill, const std::string& type, int layer); + static void remove(const std::string& polygonID, int layer = 0); + + + static void subscribe(const std::string& objID, SUMOTime beginTime, SUMOTime endTime, const std::vector& vars); + static void subscribeContext(const std::string& objID, SUMOTime beginTime, SUMOTime endTime, int domain, double range, const std::vector& vars); + + static void setFilled(std::string polygonID, bool filled); + static void setParameter(std::string& name, std::string& value, std::string& string); +private: + + static SUMO::Polygon* getPolygon(const std::string& id); + + /// @brief invalidated standard constructor + TraCI_Polygon(); + + /// @brief invalidated copy constructor + TraCI_Polygon(const TraCI_Polygon& src); + + /// @brief invalidated assignment operator + TraCI_Polygon& operator=(const TraCI_Polygon& src); + +}; + +#endif //SUMO_TRACI_POLYGON_H diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Route.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Route.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Route.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Route.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,108 @@ +/****************************************************************************/ +/// @file TraCI_Route.h +/// @author Daniel Krajzewicz +/// @author Mario Krumnow +/// @author Jakob Erdmann +/// @author Michael Behrisch +/// @author Robert Hilbrich +/// @date 30.05.2012 +/// @version $Id: TraCI_Route.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2017-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include "TraCI_Route.h" + + +// =========================================================================== +// member definitions +// =========================================================================== +std::vector +TraCI_Route::getIDList() { + std::vector ids; + MSRoute::insertIDs(ids); + return ids; +} + +std::vector +TraCI_Route::getEdges(const std::string& routeID) { + const MSRoute* r = getRoute(routeID); + std::vector ids; + for (ConstMSEdgeVector::const_iterator i = r->getEdges().begin(); i != r->getEdges().end(); ++i) { + ids.push_back((*i)->getID()); + } + return ids; +} + + +int +TraCI_Route::getIDCount() { + return (int)getIDList().size(); +} + + +std::string +TraCI_Route::getParameter(const std::string& routeID, const std::string& param) { + const MSRoute* r = getRoute(routeID); + return r->getParameter(param, ""); +} + +void +TraCI_Route::setParameter(const std::string& routeID, const std::string& key, const std::string& value) { + MSRoute* r = const_cast(getRoute(routeID)); + r->addParameter(key, value); +} + + +void +TraCI_Route::add(const std::string& routeID, const std::vector& edgeIDs) { + ConstMSEdgeVector edges; + for (std::vector::const_iterator ei = edgeIDs.begin(); ei != edgeIDs.end(); ++ei) { + MSEdge* edge = MSEdge::dictionary(*ei); + if (edge == 0) { + throw TraCIException("Unknown edge '" + *ei + "' in route."); + } + edges.push_back(edge); + } + const std::vector stops; + if (!MSRoute::dictionary(routeID, new MSRoute(routeID, edges, true, 0, stops))) { + throw TraCIException("Could not add route."); + } +} + + +const MSRoute* +TraCI_Route::getRoute(const std::string& id) { + const MSRoute* r = MSRoute::dictionary(id); + if (r == 0) { + throw TraCIException("Route '" + id + "' is not known"); + } + return r; +} + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Route.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Route.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Route.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Route.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,82 @@ +/****************************************************************************/ +/// @file TraCI_Route.h +/// @author Daniel Krajzewicz +/// @author Mario Krumnow +/// @author Michael Behrisch +/// @date 30.05.2012 +/// @version $Id: TraCI_Route.h 23527 2017-03-18 08:45:42Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef TraCI_Route_h +#define TraCI_Route_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include + + +// =========================================================================== +// class declarations +// =========================================================================== +class MSRoute; + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class TraCI_Route + * @brief C++ TraCI client API implementation + */ +class TraCI_Route { +public: + + static std::vector getIDList(); + static int getIDCount(); + static std::vector getEdges(const std::string& routeID); + static std::string getParameter(const std::string& routeID, const std::string& param); + + static void add(const std::string& routeID, const std::vector& edgeIDs); + static void setParameter(const std::string& routeID, const std::string& key, const std::string& value); // not needed so far + + static void subscribe(const std::string& objID, SUMOTime beginTime, SUMOTime endTime, const std::vector& vars); + static void subscribeContext(const std::string& objID, SUMOTime beginTime, SUMOTime endTime, int domain, double range, const std::vector& vars); + + static const MSRoute* getRoute(const std::string& id); + +private: + /// @brief invalidated standard constructor + TraCI_Route(); + + /// @brief invalidated copy constructor + TraCI_Route(const TraCI_Route& src); + + /// @brief invalidated assignment operator + TraCI_Route& operator=(const TraCI_Route& src); +}; + + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Vehicle.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Vehicle.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Vehicle.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Vehicle.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,770 @@ +/****************************************************************************/ +/// @file TraCI_Vehicle.h +/// @author Jakob Erdmann +/// @date 15.03.2017 +/// @version $Id: TraCI_Vehicle.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +// C++ Vehicle API +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "TraCI.h" +#include "TraCI_Vehicle.h" + + +// =========================================================================== +// member definitions +// =========================================================================== + +MSVehicle* +TraCI_Vehicle::getVehicle(const std::string& id) { + SUMOVehicle* sumoVehicle = MSNet::getInstance()->getVehicleControl().getVehicle(id); + if (sumoVehicle == 0) { + throw TraCIException("Vehicle '" + id + "' is not known"); + } + MSVehicle* v = dynamic_cast(sumoVehicle); + if (v == 0) { + throw TraCIException("Vehicle '" + id + "' is not a micro-simulation vehicle"); + } + return v; +} + + +bool +TraCI_Vehicle::isVisible(const MSVehicle* veh) { + return veh->isOnRoad() || veh->isParking() || veh->wasRemoteControlled(); +} + + +bool +TraCI_Vehicle::onInit(const std::string& vehicleID) { + SUMOVehicle* sumoVehicle = MSNet::getInstance()->getVehicleControl().getVehicle(vehicleID); + return sumoVehicle == 0 || sumoVehicle->getLane() == 0; +} + +std::vector +TraCI_Vehicle::getIDList() { + std::vector ids; + MSVehicleControl& c = MSNet::getInstance()->getVehicleControl(); + for (MSVehicleControl::constVehIt i = c.loadedVehBegin(); i != c.loadedVehEnd(); ++i) { + if ((*i).second->isOnRoad() || (*i).second->isParking()) { + ids.push_back((*i).first); + } + } + return ids; +} + +int +TraCI_Vehicle::getIDCount() { + return (int)getIDList().size(); +} + +double +TraCI_Vehicle::getSpeed(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + return isVisible(veh) ? veh->getSpeed() : INVALID_DOUBLE_VALUE; +} + + +double +TraCI_Vehicle::getSpeedWithoutTraCI(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + return isVisible(veh) ? veh->getSpeedWithoutTraciInfluence() : INVALID_DOUBLE_VALUE; +} + + +TraCIPosition +TraCI_Vehicle::getPosition(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + if (isVisible(veh)) { + return TraCI::makeTraCIPosition(veh->getPosition()); + } else { + TraCIPosition result; + result.x = INVALID_DOUBLE_VALUE; + result.y = INVALID_DOUBLE_VALUE; + result.z = INVALID_DOUBLE_VALUE; + return result; + } +} + + +double +TraCI_Vehicle::getAngle(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + return isVisible(veh) ? GeomHelper::naviDegree(veh->getAngle()) : INVALID_DOUBLE_VALUE; +} + + +double +TraCI_Vehicle::getSlope(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + return veh->isOnRoad() ? veh->getSlope() : INVALID_DOUBLE_VALUE; +} + + +std::string +TraCI_Vehicle::getRoadID(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + return isVisible(veh) ? veh->getLane()->getEdge().getID() : ""; +} + + +std::string +TraCI_Vehicle::getLaneID(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + return veh->isOnRoad() ? veh->getLane()->getID() : ""; +} + + +int +TraCI_Vehicle::getLaneIndex(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + return veh->isOnRoad() ? veh->getLane()->getIndex() : INVALID_INT_VALUE; +} + +std::string +TraCI_Vehicle::getTypeID(const std::string& vehicleID) { + return getVehicle(vehicleID)->getVehicleType().getID(); +} + +std::string +TraCI_Vehicle::getRouteID(const std::string& vehicleID) { + return getVehicle(vehicleID)->getRoute().getID(); +} + +int +TraCI_Vehicle::getRouteIndex(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + return veh->hasDeparted() ? veh->getRoutePosition() : INVALID_INT_VALUE; +} + +TraCIColor +TraCI_Vehicle::getColor(const std::string& vehicleID) { + return TraCI::makeTraCIColor(getVehicle(vehicleID)->getParameter().color); +} + +double +TraCI_Vehicle::getLanePosition(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + return veh->isOnRoad() ? veh->getPositionOnLane() : INVALID_DOUBLE_VALUE; +} + +double +TraCI_Vehicle::getLateralLanePosition(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + return veh->isOnRoad() ? veh->getLateralPositionOnLane() : INVALID_DOUBLE_VALUE; +} + +double +TraCI_Vehicle::getCO2Emission(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + return isVisible(veh) ? veh->getCO2Emissions() : INVALID_DOUBLE_VALUE; +} + +double +TraCI_Vehicle::getCOEmission(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + return isVisible(veh) ? veh->getCOEmissions() : INVALID_DOUBLE_VALUE; +} + +double +TraCI_Vehicle::getHCEmission(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + return isVisible(veh) ? veh->getHCEmissions() : INVALID_DOUBLE_VALUE; +} + +double +TraCI_Vehicle::getPMxEmission(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + return isVisible(veh) ? veh->getPMxEmissions() : INVALID_DOUBLE_VALUE; +} + +double +TraCI_Vehicle::getNOxEmission(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + return isVisible(veh) ? veh->getNOxEmissions() : INVALID_DOUBLE_VALUE; +} + +double +TraCI_Vehicle::getFuelConsumption(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + return isVisible(veh) ? veh->getFuelConsumption() : INVALID_DOUBLE_VALUE; +} + +double +TraCI_Vehicle::getNoiseEmission(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + return isVisible(veh) ? veh->getHarmonoise_NoiseEmissions() : INVALID_DOUBLE_VALUE; +} + +double +TraCI_Vehicle::getElectricityConsumption(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + return isVisible(veh) ? veh->getElectricityConsumption() : INVALID_DOUBLE_VALUE; +} + +int +TraCI_Vehicle::getPersonNumber(const std::string& vehicleID) { + return getVehicle(vehicleID)->getPersonNumber(); +} + + +std::pair +TraCI_Vehicle::getLeader(const std::string& vehicleID, double dist) { + MSVehicle* veh = getVehicle(vehicleID); + if (veh->isOnRoad()) { + std::pair leaderInfo = veh->getLeader(dist); + return std::make_pair( + leaderInfo.first != 0 ? leaderInfo.first->getID() : "", + leaderInfo.second); + } else { + return std::make_pair("", -1); + } +} + + +double +TraCI_Vehicle::getWaitingTime(const std::string& vehicleID) { + return getVehicle(vehicleID)->getWaitingSeconds(); +} + + +double +TraCI_Vehicle::getAdaptedTraveltime(const std::string& vehicleID, const std::string& edgeID, int time) { + MSVehicle* veh = getVehicle(vehicleID); + MSEdge* edge = TraCI::getEdge(edgeID); + double value = INVALID_DOUBLE_VALUE;; + veh->getWeightsStorage().retrieveExistingTravelTime(edge, time, value); + return value; +} + + +double +TraCI_Vehicle::getEffort(const std::string& vehicleID, const std::string& edgeID, int time) { + MSVehicle* veh = getVehicle(vehicleID); + MSEdge* edge = TraCI::getEdge(edgeID); + double value = INVALID_DOUBLE_VALUE;; + veh->getWeightsStorage().retrieveExistingEffort(edge, time, value); + return value; +} + + +bool +TraCI_Vehicle::isRouteValid(const std::string& vehicleID) { + std::string msg; + return getVehicle(vehicleID)->hasValidRoute(msg); +} + +std::vector +TraCI_Vehicle::getEdges(const std::string& vehicleID) { + std::vector result; + MSVehicle* veh = getVehicle(vehicleID); + const MSRoute& r = veh->getRoute(); + for (MSRouteIterator i = r.begin(); i != r.end(); ++i) { + result.push_back((*i)->getID()); + } + return result; +} + + +int +TraCI_Vehicle::getSignalStates(const std::string& vehicleID) { + return getVehicle(vehicleID)->getSignals(); +} + +std::vector +TraCI_Vehicle::getBestLanes(const std::string& vehicleID) { + std::vector result; + MSVehicle* veh = getVehicle(vehicleID); + if (veh->isOnRoad()) { + const std::vector& bestLanes = veh->getBestLanes(); + for (std::vector::const_iterator i = bestLanes.begin(); i != bestLanes.end(); ++i) { + BestLanesData bld; + const MSVehicle::LaneQ& lq = *i; + bld.laneID = lq.lane->getID(); + bld.length = lq.length; + bld.nextOccupation = lq.nextOccupation; + bld.bestLaneOffset = lq.bestLaneOffset; + bld.allowsContinuation = lq.allowsContinuation; + for (std::vector::const_iterator j = lq.bestContinuations.begin(); j != lq.bestContinuations.end(); ++j) { + if ((*j) != 0) { + bld.continuationLanes.push_back((*j)->getID()); + } + } + result.push_back(bld); + } + } + return result; +} + + +std::vector +TraCI_Vehicle::getNextTLS(const std::string& vehicleID) { + std::vector result; + MSVehicle* veh = getVehicle(vehicleID); + if (veh->isOnRoad()) { + const MSLane* lane = veh->getLane(); + const std::vector& bestLaneConts = veh->getBestLanesContinuation(lane); + double seen = veh->getLane()->getLength() - veh->getPositionOnLane(); + int view = 1; + MSLinkCont::const_iterator link = MSLane::succLinkSec(*veh, view, *lane, bestLaneConts); + while (!lane->isLinkEnd(link)) { + if (!lane->getEdge().isInternal()) { + if ((*link)->isTLSControlled()) { + NextTLSData ntd; + ntd.id = (*link)->getTLLogic()->getID(); + ntd.tlIndex = (*link)->getTLIndex(); + ntd.dist = seen; + ntd.state = (char)(*link)->getState(); + result.push_back(ntd); + } + } + lane = (*link)->getViaLaneOrLane(); + if (!lane->getEdge().isInternal()) { + view++; + } + seen += lane->getLength(); + link = MSLane::succLinkSec(*veh, view, *lane, bestLaneConts); + } + } + return result; +} + +int +TraCI_Vehicle::getStopState(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + int result = 0; + if (veh->isStopped()) { + const MSVehicle::Stop& stop = veh->getNextStop(); + result = (1 + (stop.parking ? 2 : 0) + + (stop.triggered ? 4 : 0) + + (stop.containerTriggered ? 8 : 0) + + (stop.busstop != 0 ? 16 : 0) + + (stop.containerstop != 0 ? 32 : 0) + + (stop.chargingStation != 0 ? 64 : 0) + + (stop.parkingarea != 0 ? 128 : 0)); + } + return result; +} + +double +TraCI_Vehicle::getDistance(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + if (veh->isOnRoad()) { + double distance = veh->getRoute().getDistanceBetween(veh->getDepartPos(), veh->getPositionOnLane(), veh->getRoute().getEdges()[0], &veh->getLane()->getEdge()); + if (distance == std::numeric_limits::max()) { + return INVALID_DOUBLE_VALUE; + } else { + return distance; + } + } else { + return INVALID_DOUBLE_VALUE; + } +} + + +double +TraCI_Vehicle::getDrivingDistance(const std::string& vehicleID, const std::string& edgeID, double position, int /* laneIndex */) { + MSVehicle* veh = getVehicle(vehicleID); + if (veh->isOnRoad()) { + double distance = veh->getRoute().getDistanceBetween(veh->getPositionOnLane(), position, + veh->getEdge(), TraCI::getEdge(edgeID)); + if (distance == std::numeric_limits::max()) { + return INVALID_DOUBLE_VALUE; + } + return distance; + } else { + return INVALID_DOUBLE_VALUE; + } +} + + +double +TraCI_Vehicle::getDrivingDistance2D(const std::string& vehicleID, double x, double y) { + MSVehicle* veh = getVehicle(vehicleID); + if (veh->isOnRoad()) { + std::pair roadPos = TraCI::convertCartesianToRoadMap(Position(x, y)); + double distance = veh->getRoute().getDistanceBetween(veh->getPositionOnLane(), roadPos.second, + veh->getEdge(), &roadPos.first->getEdge()); + if (distance == std::numeric_limits::max()) { + return INVALID_DOUBLE_VALUE; + } + return distance; + } else { + return INVALID_DOUBLE_VALUE; + } +} + + + +double +TraCI_Vehicle::getAllowedSpeed(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + if (veh->isOnRoad()) { + return veh->getLane()->getVehicleMaxSpeed(veh); + } else { + return INVALID_DOUBLE_VALUE; + } +} + +double +TraCI_Vehicle::getSpeedFactor(const std::string& vehicleID) { + return getVehicle(vehicleID)->getChosenSpeedFactor(); +} + + +int +TraCI_Vehicle::getSpeedMode(const std::string& vehicleID) { + return getVehicle(vehicleID)->getInfluencer().getSpeedMode(); +} + +std::string +TraCI_Vehicle::getLine(const std::string& vehicleID) { + return getVehicle(vehicleID)->getParameter().line; +} + +std::vector +TraCI_Vehicle::getVia(const std::string& vehicleID) { + return getVehicle(vehicleID)->getParameter().via; +} + + +std::pair +TraCI_Vehicle::getLaneChangeState(const std::string& vehicleID, int direction) { + MSVehicle* veh = getVehicle(vehicleID); + if (veh->isOnRoad()) { + return veh->getLaneChangeModel().getSavedState(direction); + } else { + return std::make_pair((int)LCA_UNKNOWN, (int)LCA_UNKNOWN); + } +} + + +std::string +TraCI_Vehicle::getParameter(const std::string& vehicleID, const std::string& key) { + MSVehicle* veh = getVehicle(vehicleID); + if (StringUtils::startsWith(key, "device.")) { + StringTokenizer tok(key, "."); + if (tok.size() < 3) { + throw TraCIException("Invalid device parameter '" + key + "' for vehicle '" + vehicleID + "'"); + } + try { + return veh->getDeviceParameter(tok.get(1), key.substr(tok.get(0).size() + tok.get(1).size() + 2)); + } catch (InvalidArgument& e) { + throw TraCIException("Vehicle '" + vehicleID + "' does not support device parameter '" + key + "' (" + e.what() + ")."); + } + } else if (StringUtils::startsWith(key, "laneChangeModel.")) { + const std::string attrName = key.substr(16); + try { + return veh->getLaneChangeModel().getParameter(attrName); + } catch (InvalidArgument& e) { + throw TraCIException("Vehicle '" + vehicleID + "' does not support laneChangeModel parameter '" + key + "' (" + e.what() + ")."); + } + } else if (StringUtils::startsWith(key, "has.") && StringUtils::endsWith(key, ".device")) { + StringTokenizer tok(key, "."); + if (tok.size() != 3) { + throw TraCIException("Invalid check for device. Expected format is 'has.DEVICENAME.device'"); + } + return veh->hasDevice(tok.get(1)) ? "true" : "false"; + } else { + return veh->getParameter().getParameter(key, ""); + } +} + + +const MSVehicleType& +TraCI_Vehicle::getVehicleType(const std::string& vehicleID) { + return getVehicle(vehicleID)->getVehicleType(); +} + + + +/* +std::string +TraCI_Vehicle::getEmissionClass(const std::string& vehicleID) { +} + +std::string +TraCI_Vehicle::getShapeClass(const std::string& vehicleID) { +} + + + +double +TraCI_Vehicle::getLength(const std::string& vehicleID) { +} + +double +TraCI_Vehicle::getAccel(const std::string& vehicleID) { +} + +double +TraCI_Vehicle::getDecel(const std::string& vehicleID) { +} + +double +TraCI_Vehicle::getTau(const std::string& vehicleID) { +} + +double +TraCI_Vehicle::getImperfection(const std::string& vehicleID) { +} + +double +TraCI_Vehicle::getSpeedDeviation(const std::string& vehicleID) { +} + +std::string +TraCI_Vehicle::getVClass(const std::string& vehicleID) { +} + +double +TraCI_Vehicle::getMinGap(const std::string& vehicleID) { +} + +double +TraCI_Vehicle::getMaxSpeed(const std::string& vehicleID) { +} + + +double +TraCI_Vehicle::getWidth(const std::string& vehicleID) { +} +*/ + + +void +TraCI_Vehicle::setStop(const std::string& vehicleID, + const std::string& edgeID, + double endPos, + int laneIndex, + SUMOTime duration, + int flags, + double startPos, + SUMOTime until) { + MSVehicle* veh = getVehicle(vehicleID); + // optional stop flags + bool parking = false; + bool triggered = false; + bool containerTriggered = false; + SumoXMLTag stoppingPlaceType = SUMO_TAG_NOTHING; + + parking = ((flags & 1) != 0); + triggered = ((flags & 2) != 0); + containerTriggered = ((flags & 4) != 0); + if ((flags & 8) != 0) { + stoppingPlaceType = SUMO_TAG_BUS_STOP; + } + if ((flags & 16) != 0) { + stoppingPlaceType = SUMO_TAG_BUS_STOP; + } + if ((flags & 32) != 0) { + stoppingPlaceType = SUMO_TAG_CHARGING_STATION; + } + if ((flags & 64) != 0) { + stoppingPlaceType = SUMO_TAG_PARKING_AREA; + } + + std::string error; + if (stoppingPlaceType != SUMO_TAG_NOTHING) { + // Forward command to vehicle + if (!veh->addTraciStopAtStoppingPlace(edgeID, duration, until, parking, triggered, containerTriggered, stoppingPlaceType, error)) { + throw TraCIException(error); + } + } else { + // check + if (startPos < 0) { + throw TraCIException("Position on lane must not be negative."); + } + if (endPos < startPos) { + throw TraCIException("End position on lane must be after start position."); + } + // get the actual lane that is referenced by laneIndex + MSEdge* road = MSEdge::dictionary(edgeID); + if (road == 0) { + throw TraCIException("Unable to retrieve road with given id."); + } + const std::vector& allLanes = road->getLanes(); + if ((laneIndex < 0) || laneIndex >= (int)(allLanes.size())) { + throw TraCIException("No lane with index '" + toString(laneIndex) + "' on road '" + edgeID + "'."); + } + // Forward command to vehicle + if (!veh->addTraciStop(allLanes[laneIndex], startPos, endPos, duration, until, parking, triggered, containerTriggered, error)) { + throw TraCIException(error); + } + } +} + + +void +TraCI_Vehicle::resume(const std::string& vehicleID) { + MSVehicle* veh = getVehicle(vehicleID); + if (!veh->hasStops()) { + throw TraCIException("Failed to resume vehicle '" + veh->getID() + "', it has no stops."); + } + if (!veh->resumeFromStopping()) { + MSVehicle::Stop& sto = veh->getNextStop(); + std::ostringstream strs; + strs << "reached: " << sto.reached; + strs << ", duration:" << sto.duration; + strs << ", edge:" << (*sto.edge)->getID(); + strs << ", startPos: " << sto.startPos; + std::string posStr = strs.str(); + throw TraCIException("Failed to resume from stoppingfor vehicle '" + veh->getID() + "', " + posStr); + } +} + + +void +TraCI_Vehicle::changeLane(const std::string& vehID, int laneIndex, SUMOTime duration) { +} + + +void +TraCI_Vehicle::add(const std::string& vehicleID, + const std::string& routeID, + const std::string& typeID, + std::string depart, + const std::string& departLane, + const std::string& departPos, + const std::string& departSpeed, + const std::string& arrivalLane, + const std::string& arrivalPos, + const std::string& arrivalSpeed, + const std::string& fromTaz, + const std::string& toTaz, + const std::string& line, + int personCapacity, + int personNumber) { + MSVehicle* veh = getVehicle(vehicleID); + if (veh != 0) { + throw TraCIException("The vehicle " + vehicleID + " to add already exists."); + } +} + +void +TraCI_Vehicle::moveTo(const std::string& vehicleID, const std::string& laneID, double position) { +} + +void +TraCI_Vehicle::moveToXY(const std::string& vehicleID, const std::string& edgeID, const int lane, const double x, const double y, const double angle, const int keepRoute) { +} + +void +TraCI_Vehicle::slowDown(const std::string& vehicleID, double speed, int duration) { +} + +void +TraCI_Vehicle::setSpeed(const std::string& vehicleID, double speed) { +} + +void +TraCI_Vehicle::setMaxSpeed(const std::string& vehicleID, double speed) { +} + +void +TraCI_Vehicle::remove(const std::string& vehicleID, char reason) { +} + +void +TraCI_Vehicle::setColor(const std::string& vehicleID, const TraCIColor& c) { +} + +void +TraCI_Vehicle::setLine(const std::string& vehicleID, const std::string& line) { +} + +void +TraCI_Vehicle::setVia(const std::string& vehicleID, const std::vector& via) { +} + +void +TraCI_Vehicle::setShapeClass(const std::string& vehicleID, const std::string& clazz) { +} + +void +TraCI_Vehicle::setEmissionClass(const std::string& vehicleID, const std::string& clazz) { +} + + +void +TraCI_Vehicle::setParameter(const std::string& vehicleID, const std::string& key, const std::string& value) { + MSVehicle* veh = getVehicle(vehicleID); + if (StringUtils::startsWith(key, "device.")) { + StringTokenizer tok(key, "."); + if (tok.size() < 3) { + throw TraCIException("Invalid device parameter '" + key + "' for vehicle '" + vehicleID + "'"); + } + try { + veh->setDeviceParameter(tok.get(1), key.substr(tok.get(0).size() + tok.get(1).size() + 2), value); + } catch (InvalidArgument& e) { + throw TraCIException("Vehicle '" + vehicleID + "' does not support device parameter '" + key + "' (" + e.what() + ")."); + } + } else if (StringUtils::startsWith(key, "laneChangeModel.")) { + const std::string attrName = key.substr(16); + try { + veh->getLaneChangeModel().setParameter(attrName, value); + } catch (InvalidArgument& e) { + throw TraCIException("Vehicle '" + vehicleID + "' does not support laneChangeModel parameter '" + key + "' (" + e.what() + ")."); + } + } else if (StringUtils::startsWith(key, "has.") && StringUtils::endsWith(key, ".device")) { + StringTokenizer tok(key, "."); + if (tok.size() != 3) { + throw TraCIException("Invalid request for device status change. Expected format is 'has.DEVICENAME.device'"); + } + const std::string deviceName = tok.get(1); + bool create; + try { + create = TplConvert::_2bool(value.c_str()); + } catch (BoolFormatException) { + throw TraCIException("Changing device status requires a 'true' or 'false'"); + } + if (!create) { + throw TraCIException("Device removal is not supported for device of type '" + deviceName + "'"); + } + try { + veh->createDevice(deviceName); + } catch (InvalidArgument& e) { + throw TraCIException("Cannot create vehicle device (" + std::string(e.what()) + ")."); + } + } else { + ((SUMOVehicleParameter&) veh->getParameter()).addParameter(key, value); + } +} + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Vehicle.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Vehicle.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_Vehicle.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_Vehicle.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,220 @@ +/****************************************************************************/ +/// @file TraCI_Vehicle.h +/// @author Michael Behrisch +/// @author Jakob Erdmann +/// @date 15.03.2017 +/// @version $Id: TraCI_Vehicle.h 24128 2017-05-01 17:39:47Z behrisch $ +/// +// C++ Vehicle API +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef TraCI_Vehicle_h +#define TraCI_Vehicle_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include + + +// =========================================================================== +// class declarations +// =========================================================================== +class MSVehicle; +class MSVehicleType; + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class TraCI_Vehicle + * @brief C++ TraCI client API implementation + */ +class TraCI_Vehicle { +public: + struct NextTLSData { + /* @brief Constructor */ + NextTLSData() {} + /// @brief The id of the next tls + std::string id; + /// @brief The tls index of the controlled link + int tlIndex; + /// @brief The distance to the tls + double dist; + /// @brief The current state of the tls + char state; + }; + + struct BestLanesData { + /* @brief Constructor */ + BestLanesData() {} + /// @brief The id of the lane + std::string laneID; + /// @brief The length than can be driven from that lane without lane change + double length; + /// @brief The traffic density along length + double nextOccupation; + /// @brief The offset of this lane from the best lane + int bestLaneOffset; + /// @brief Whether this lane allows continuing the route + bool allowsContinuation; + /// @brief The sequence of lanes that best allows continuing the route without lane change + std::vector continuationLanes; + }; + + + /// @name Value retrieval + /// @{ + static std::vector getIDList(); + static int getIDCount(); + static double getSpeed(const std::string& vehicleID); + static double getSpeedWithoutTraCI(const std::string& vehicleID); + static TraCIPosition getPosition(const std::string& vehicleID); + static TraCIPosition getPosition3D(const std::string& vehicleID); + static double getAngle(const std::string& vehicleID); + static double getSlope(const std::string& vehicleID); + static std::string getRoadID(const std::string& vehicleID); + static std::string getLaneID(const std::string& vehicleID); + static int getLaneIndex(const std::string& vehicleID); + static std::string getTypeID(const std::string& vehicleID); + static std::string getRouteID(const std::string& vehicleID); + static int getRouteIndex(const std::string& vehicleID); + static TraCIColor getColor(const std::string& vehicleID); + static double getLanePosition(const std::string& vehicleID); + static double getLateralLanePosition(const std::string& vehicleID); + static double getCO2Emission(const std::string& vehicleID); + static double getCOEmission(const std::string& vehicleID); + static double getHCEmission(const std::string& vehicleID); + static double getPMxEmission(const std::string& vehicleID); + static double getNOxEmission(const std::string& vehicleID); + static double getFuelConsumption(const std::string& vehicleID); + static double getNoiseEmission(const std::string& vehicleID); + static double getElectricityConsumption(const std::string& vehicleID); + static int getPersonNumber(const std::string& vehicleID); + static std::pair getLeader(const std::string& vehicleID, double dist); + static double getWaitingTime(const std::string& vehicleID); + static double getAdaptedTraveltime(const std::string& vehicleID, const std::string& edgeID, int time); + static double getEffort(const std::string& vehicleID, const std::string& edgeID, int time); + static bool isRouteValid(const std::string& vehicleID); + static std::vector getEdges(const std::string& vehicleID); + static int getSignalStates(const std::string& vehicleID); + static std::vector getBestLanes(const std::string& vehicleID); + static std::vector getNextTLS(const std::string& vehicleID); + static int getStopState(const std::string& vehicleID); + static double getDistance(const std::string& vehicleID); + static double getDrivingDistance(const std::string& vehicleID, const std::string& edgeID, double position, int laneIndex); + static double getDrivingDistance2D(const std::string& vehicleID, double x, double y); + static double getAllowedSpeed(const std::string& vehicleID); + static double getSpeedFactor(const std::string& vehicleID); + static int getSpeedMode(const std::string& vehicleID); + static std::string getLine(const std::string& vehicleID); + static std::vector getVia(const std::string& vehicleID); + static std::pair getLaneChangeState(const std::string& vehicleID, int direction); + static std::string getParameter(const std::string& vehicleID, const std::string& key); + + static const MSVehicleType& getVehicleType(const std::string& vehicleID); + /* Type requests not yet implemented + static std::string getEmissionClass(const std::string& vehicleID); + static std::string getShapeClass(const std::string& vehicleID); + static std::string getVClass(const std::string& vehicleID); + static double getLength(const std::string& vehicleID); + static double getAccel(const std::string& vehicleID); + static double getDecel(const std::string& vehicleID); + static double getTau(const std::string& vehicleID); + static double getImperfection(const std::string& vehicleID); + static double getSpeedDeviation(const std::string& vehicleID); + static double getMinGap(const std::string& vehicleID); + static double getMaxSpeed(const std::string& vehicleID); + static double getWidth(const std::string& vehicleID); + */ + /// @} + + /// @name State Changing + /// @{ + + static void setStop(const std::string& vehicleID, + const std::string& edgeID, + double endPos = 1., + int laneIndex = 0, + SUMOTime duration = 4294967295u, // 2^32-1 + int flags = STOP_DEFAULT, + double startPos = INVALID_DOUBLE_VALUE, + SUMOTime until = -1); + + static void resume(const std::string& vehicleID); + + static void add(const std::string& vehicleID, + const std::string& routeID, + const std::string& typeID = "DEFAULT_VEHTYPE", + std::string depart = "-1", + const std::string& departLane = "first", + const std::string& departPos = "base", + const std::string& departSpeed = "0", + const std::string& arrivalLane = "current", + const std::string& arrivalPos = "max", + const std::string& arrivalSpeed = "current", + const std::string& fromTaz = "", + const std::string& toTaz = "", + const std::string& line = "", + int personCapacity = 0, + int personNumber = 0); + + static void changeLane(const std::string& vehID, int laneIndex, SUMOTime duration); + + static void moveTo(const std::string& vehicleID, const std::string& laneID, double position); + static void moveToXY(const std::string& vehicleID, const std::string& edgeID, const int lane, const double x, const double y, const double angle, const int keepRoute); + static void slowDown(const std::string& vehicleID, double speed, int duration); + static void setSpeed(const std::string& vehicleID, double speed); + static void setMaxSpeed(const std::string& vehicleID, double speed); + static void remove(const std::string& vehicleID, char reason = REMOVE_VAPORIZED); + static void setColor(const std::string& vehicleID, const TraCIColor& c); + static void setLine(const std::string& vehicleID, const std::string& line); + static void setVia(const std::string& vehicleID, const std::vector& via); + static void setShapeClass(const std::string& vehicleID, const std::string& clazz); + static void setEmissionClass(const std::string& vehicleID, const std::string& clazz); + static void setParameter(const std::string& vehicleID, const std::string& key, const std::string& value); + /// @} + + +private: + static MSVehicle* getVehicle(const std::string& id); + + static bool isVisible(const MSVehicle* veh); + + static bool onInit(const std::string& vehicleID); + + /// @brief invalidated standard constructor + TraCI_Vehicle(); + + /// @brief invalidated copy constructor + TraCI_Vehicle(const TraCI_Vehicle& src); + + /// @brief invalidated assignment operator + TraCI_Vehicle& operator=(const TraCI_Vehicle& src); +}; + + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_VehicleType.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_VehicleType.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_VehicleType.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_VehicleType.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,195 @@ +/****************************************************************************/ +/// @file TraCI_VehicleType.cpp +/// @author Gregor Laemmel +/// @date 04.04.2017 +/// @version $Id: TraCI_VehicleType.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2017 - 2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +#include +#include +#include "TraCI_VehicleType.h" +#include "TraCI.h" +std::vector TraCI_VehicleType::getIDList() { + std::vector ids; + MSNet::getInstance()->getVehicleControl().insertVTypeIDs(ids); + return ids; +} +double TraCI_VehicleType::getLength(const std::string& typeID) { + MSVehicleType* v = getVType(typeID); + return v->getLength(); +} +double TraCI_VehicleType::getMaxSpeed(const std::string& typeID) { + MSVehicleType* v = getVType(typeID); + return v->getMaxSpeed(); +} +double TraCI_VehicleType::getSpeedFactor(const std::string& typeID) { + MSVehicleType* v = getVType(typeID); + return v->getSpeedFactor().getParameter()[0]; +} +double TraCI_VehicleType::getSpeedDeviation(const std::string& typeID) { + MSVehicleType* v = getVType(typeID); + return v->getSpeedFactor().getParameter()[1]; +} +double TraCI_VehicleType::getAccel(const std::string& typeID) { + MSVehicleType* v = getVType(typeID); + return v->getCarFollowModel().getMaxAccel(); +} +double TraCI_VehicleType::getDecel(const std::string& typeID) { + MSVehicleType* v = getVType(typeID); + return v->getCarFollowModel().getMaxDecel(); +} +double TraCI_VehicleType::getImperfection(const std::string& typeID) { + MSVehicleType* v = getVType(typeID); + return v->getCarFollowModel().getImperfection(); +} +double TraCI_VehicleType::getTau(const std::string& typeID) { + MSVehicleType* v = getVType(typeID); + return v->getCarFollowModel().getHeadwayTime(); +} +std::string TraCI_VehicleType::getVehicleClass(const std::string& typeID) { + MSVehicleType* v = getVType(typeID); + return toString(v->getVehicleClass()); +} +std::string TraCI_VehicleType::getEmissionClass(const std::string& typeID) { + MSVehicleType* v = getVType(typeID); + return PollutantsInterface::getName(v->getEmissionClass()); +} +std::string TraCI_VehicleType::getShapeClass(const std::string& typeID) { + MSVehicleType* v = getVType(typeID); + return getVehicleShapeName(v->getGuiShape()); +} +double TraCI_VehicleType::getMinGap(const std::string& typeID) { + MSVehicleType* v = getVType(typeID); + return v->getMinGap(); +} +double TraCI_VehicleType::getWidth(const std::string& typeID) { + MSVehicleType* v = getVType(typeID); + return v->getWidth(); +} +double TraCI_VehicleType::getHeight(const std::string& typeID) { + MSVehicleType* v = getVType(typeID); + return v->getHeight(); +} +TraCIColor TraCI_VehicleType::getColor(const std::string& typeID) { + MSVehicleType* v = getVType(typeID); + return TraCI::makeTraCIColor(v->getColor()); +} +double TraCI_VehicleType::getMinGapLat(const std::string& typeID) { + MSVehicleType* v = getVType(typeID); + return v->getMinGapLat(); +} +double TraCI_VehicleType::getMaxSpeedLat(const std::string& typeID) { + MSVehicleType* v = getVType(typeID); + return v->getMaxSpeedLat(); +} +std::string TraCI_VehicleType::getLateralAlignment(const std::string& typeID) { + MSVehicleType* v = getVType(typeID); + return toString(v->getPreferredLateralAlignment()); +} + + +std::string +TraCI_VehicleType::getParameter(const std::string& typeID, const std::string& key) { + MSVehicleType* v = getVType(typeID); + return v->getParameter().getParameter(key, ""); +} + + +void TraCI_VehicleType::setLength(const std::string& typeID, double length) { + MSVehicleType* v = getVType(typeID); + v->setLength(length); +} +void TraCI_VehicleType::setMaxSpeed(const std::string& typeID, double speed) { + MSVehicleType* v = getVType(typeID); + v->setMaxSpeed(speed); +} +void TraCI_VehicleType::setVehicleClass(const std::string& typeID, const std::string& clazz) { + MSVehicleType* v = getVType(typeID); + v->setVClass(getVehicleClassID(clazz)); +} +void TraCI_VehicleType::setSpeedFactor(const std::string& typeID, double factor) { + MSVehicleType* v = getVType(typeID); + v->setSpeedFactor(factor); +} +void TraCI_VehicleType::setSpeedDeviation(const std::string& typeID, double deviation) { + MSVehicleType* v = getVType(typeID); + v->setSpeedDeviation(deviation); +} +void TraCI_VehicleType::setEmissionClass(const std::string& typeID, const std::string& clazz) { + MSVehicleType* v = getVType(typeID); + v->setEmissionClass(PollutantsInterface::getClassByName(clazz)); +} +void TraCI_VehicleType::setShapeClass(const std::string& typeID, const std::string& shapeClass) { + MSVehicleType* v = getVType(typeID); + v->setShape(getVehicleShapeID(shapeClass)); +} +void TraCI_VehicleType::setWidth(const std::string& typeID, double width) { + MSVehicleType* v = getVType(typeID); + v->setWidth(width); +} +void TraCI_VehicleType::setHeight(const std::string& typeID, double height) { + MSVehicleType* v = getVType(typeID); + v->setHeight(height); +} +void TraCI_VehicleType::setMinGap(const std::string& typeID, double minGap) { + MSVehicleType* v = getVType(typeID); + v->setMinGap(minGap); +} +void TraCI_VehicleType::setAccel(const std::string& typeID, double accel) { + MSVehicleType* v = getVType(typeID); + v->getCarFollowModel().setMaxAccel(accel); +} +void TraCI_VehicleType::setDecel(const std::string& typeID, double decel) { + MSVehicleType* v = getVType(typeID); + v->getCarFollowModel().setMaxDecel(decel); +} +void TraCI_VehicleType::setImperfection(const std::string& typeID, double imperfection) { + MSVehicleType* v = getVType(typeID); + v->getCarFollowModel().setImperfection(imperfection); +} +void TraCI_VehicleType::setTau(const std::string& typeID, double tau) { + MSVehicleType* v = getVType(typeID); + v->getCarFollowModel().setHeadwayTime(tau); +} +void TraCI_VehicleType::setColor(const std::string& typeID, const TraCIColor& c) { + MSVehicleType* v = getVType(typeID); + v->setColor(TraCI::makeRGBColor(c)); + +} +void TraCI_VehicleType::setMinGapLat(const std::string& typeID, double minGapLat) { + MSVehicleType* v = getVType(typeID); + v->setMinGapLat(minGapLat); +} +void TraCI_VehicleType::setMaxSpeedLat(const std::string& typeID, double speed) { + MSVehicleType* v = getVType(typeID); + v->setMaxSpeedLat(speed); +} +void TraCI_VehicleType::setLateralAlignment(const std::string& typeID, const std::string& latAlignment) { + MSVehicleType* v = getVType(typeID); + v->setPreferredLateralAlignment(SUMOXMLDefinitions::LateralAlignments.get(latAlignment)); +} + +void TraCI_VehicleType::addParameter(const std::string& typeID, const std::string& name, const std::string& value) { + MSVehicleType* v = getVType(typeID); + ((SUMOVTypeParameter&) v->getParameter()).addParameter(name, value); +} +MSVehicleType* TraCI_VehicleType::getVType(std::string id) { + MSVehicleType* t = MSNet::getInstance()->getVehicleControl().getVType(id); + if (t == 0) { + throw TraCIException("Vehicle type '" + id + "' is not known"); + } + return t; +} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_VehicleType.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_VehicleType.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/lib/TraCI_VehicleType.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/lib/TraCI_VehicleType.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,88 @@ +/****************************************************************************/ +/// @file TraCI_VehicleType.h +/// @author Gregor Laemmel +/// @date 04.04.2017 +/// @version $Id: TraCI_VehicleType.h 23999 2017-04-21 09:04:47Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2017 - 2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + +#ifndef SUMO_TRACI_VEHICLETYPE_H +#define SUMO_TRACI_VEHICLETYPE_H + + +#include +#include +#include +class TraCI_VehicleType { + +public: + + static std::vector getIDList(); + static double getLength(const std::string& typeID); + static double getMaxSpeed(const std::string& typeID); + static double getSpeedFactor(const std::string& typeID); + static double getSpeedDeviation(const std::string& typeID); + static double getAccel(const std::string& typeID); + static double getDecel(const std::string& typeID); + static double getImperfection(const std::string& typeID); + static double getTau(const std::string& typeID); + static std::string getVehicleClass(const std::string& typeID); + static std::string getEmissionClass(const std::string& typeID); + static std::string getShapeClass(const std::string& typeID); + static double getMinGap(const std::string& typeID); + static double getWidth(const std::string& typeID); + static double getHeight(const std::string& typeID); + static TraCIColor getColor(const std::string& typeID); + static double getMinGapLat(const std::string& typeID); + static double getMaxSpeedLat(const std::string& typeID); + static std::string getLateralAlignment(const std::string& typeID); + static std::string getParameter(const std::string& typeID, const std::string& key); + + static void setLength(const std::string& typeID, double length); + static void setMaxSpeed(const std::string& typeID, double speed); + static void setVehicleClass(const std::string& typeID, const std::string& clazz); + static void setSpeedFactor(const std::string& typeID, double factor); + static void setSpeedDeviation(const std::string& typeID, double deviation); + static void setEmissionClass(const std::string& typeID, const std::string& clazz); + static void setShapeClass(const std::string& typeID, const std::string& shapeClass); + static void setWidth(const std::string& typeID, double width); + static void setHeight(const std::string& typeID, double height); + static void setMinGap(const std::string& typeID, double minGap); + static void setAccel(const std::string& typeID, double accel); + static void setDecel(const std::string& typeID, double decel); + static void setImperfection(const std::string& typeID, double imperfection); + static void setTau(const std::string& typeID, double tau); + static void setColor(const std::string& typeID, const TraCIColor& c); + static void setMinGapLat(const std::string& typeID, double minGapLat); + static void setMaxSpeedLat(const std::string& typeID, double speed); + static void setLateralAlignment(const std::string& typeID, const std::string& latAlignment); + + static MSVehicleType* getVType(std::string id); + + static void addParameter(const std::string& id, const std::string& name, const std::string& value); +private: + /// @brief invalidated standard constructor + TraCI_VehicleType(); + + /// @brief invalidated copy constructor + TraCI_VehicleType(const TraCI_VehicleType& src); + + /// @brief invalidated assignment operator + TraCI_VehicleType& operator=(const TraCI_VehicleType& src); + +}; + + +#endif //SUMO_TRACI_VEHICLETYPE_H diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -1,14 +1,14 @@ noinst_LIBRARIES = libtraciserver.a libtraciserver_a_SOURCES = TraCIConstants.h \ -TraCIException.h \ +TraCIDefs.h \ TraCIServer.h TraCIServer.cpp \ TraCIServerAPI_Edge.h TraCIServerAPI_Edge.cpp \ TraCIServerAPI_InductionLoop.h TraCIServerAPI_InductionLoop.cpp \ TraCIServerAPI_Junction.h TraCIServerAPI_Junction.cpp \ TraCIServerAPI_Lane.h TraCIServerAPI_Lane.cpp \ -TraCIServerAPI_MeMeDetector.h TraCIServerAPI_MeMeDetector.cpp \ -TraCIServerAPI_ArealDetector.h TraCIServerAPI_ArealDetector.cpp \ +TraCIServerAPI_MultiEntryExit.h TraCIServerAPI_MultiEntryExit.cpp \ +TraCIServerAPI_LaneArea.h TraCIServerAPI_LaneArea.cpp \ TraCIServerAPI_Person.h TraCIServerAPI_Person.cpp \ TraCIServerAPI_POI.h TraCIServerAPI_POI.cpp \ TraCIServerAPI_Polygon.h TraCIServerAPI_Polygon.cpp \ @@ -18,4 +18,5 @@ TraCIServerAPI_Vehicle.h TraCIServerAPI_Vehicle.cpp \ TraCIServerAPI_VehicleType.h TraCIServerAPI_VehicleType.cpp +SUBDIRS = lib diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -103,8 +103,8 @@ TraCIServerAPI_InductionLoop.$(OBJEXT) \ TraCIServerAPI_Junction.$(OBJEXT) \ TraCIServerAPI_Lane.$(OBJEXT) \ - TraCIServerAPI_MeMeDetector.$(OBJEXT) \ - TraCIServerAPI_ArealDetector.$(OBJEXT) \ + TraCIServerAPI_MultiEntryExit.$(OBJEXT) \ + TraCIServerAPI_LaneArea.$(OBJEXT) \ TraCIServerAPI_Person.$(OBJEXT) TraCIServerAPI_POI.$(OBJEXT) \ TraCIServerAPI_Polygon.$(OBJEXT) \ TraCIServerAPI_Route.$(OBJEXT) \ @@ -170,11 +170,27 @@ am__v_CCLD_1 = SOURCES = $(libtraciserver_a_SOURCES) DIST_SOURCES = $(libtraciserver_a_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is @@ -194,7 +210,33 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ @@ -340,14 +382,14 @@ top_srcdir = @top_srcdir@ noinst_LIBRARIES = libtraciserver.a libtraciserver_a_SOURCES = TraCIConstants.h \ -TraCIException.h \ +TraCIDefs.h \ TraCIServer.h TraCIServer.cpp \ TraCIServerAPI_Edge.h TraCIServerAPI_Edge.cpp \ TraCIServerAPI_InductionLoop.h TraCIServerAPI_InductionLoop.cpp \ TraCIServerAPI_Junction.h TraCIServerAPI_Junction.cpp \ TraCIServerAPI_Lane.h TraCIServerAPI_Lane.cpp \ -TraCIServerAPI_MeMeDetector.h TraCIServerAPI_MeMeDetector.cpp \ -TraCIServerAPI_ArealDetector.h TraCIServerAPI_ArealDetector.cpp \ +TraCIServerAPI_MultiEntryExit.h TraCIServerAPI_MultiEntryExit.cpp \ +TraCIServerAPI_LaneArea.h TraCIServerAPI_LaneArea.cpp \ TraCIServerAPI_Person.h TraCIServerAPI_Person.cpp \ TraCIServerAPI_POI.h TraCIServerAPI_POI.cpp \ TraCIServerAPI_Polygon.h TraCIServerAPI_Polygon.cpp \ @@ -357,7 +399,8 @@ TraCIServerAPI_Vehicle.h TraCIServerAPI_Vehicle.cpp \ TraCIServerAPI_VehicleType.h TraCIServerAPI_VehicleType.cpp -all: all-am +SUBDIRS = lib +all: all-recursive .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj @@ -407,12 +450,12 @@ -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCIServer.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCIServerAPI_ArealDetector.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCIServerAPI_Edge.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCIServerAPI_InductionLoop.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCIServerAPI_Junction.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCIServerAPI_Lane.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCIServerAPI_MeMeDetector.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCIServerAPI_LaneArea.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCIServerAPI_MultiEntryExit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCIServerAPI_POI.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCIServerAPI_Person.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TraCIServerAPI_Polygon.Po@am__quote@ @@ -449,14 +492,61 @@ clean-libtool: -rm -rf .libs _libs +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am +tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ @@ -469,7 +559,7 @@ $$unique; \ fi; \ fi -ctags: ctags-am +ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) @@ -482,7 +572,7 @@ here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am +cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ @@ -531,19 +621,45 @@ || exit 1; \ fi; \ done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done check-am: all-am -check: check-am +check: check-recursive all-am: Makefile $(LIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -installcheck: installcheck-am +installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ @@ -565,92 +681,93 @@ maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -clean: clean-am +clean: clean-recursive clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ mostlyclean-am -distclean: distclean-am +distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags -dvi: dvi-am +dvi: dvi-recursive dvi-am: -html: html-am +html: html-recursive html-am: -info: info-am +info: info-recursive info-am: install-data-am: -install-dvi: install-dvi-am +install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: -install-html: install-html-am +install-html: install-html-recursive install-html-am: -install-info: install-info-am +install-info: install-info-recursive install-info-am: install-man: -install-pdf: install-pdf-am +install-pdf: install-pdf-recursive install-pdf-am: -install-ps: install-ps-am +install-ps: install-ps-recursive install-ps-am: installcheck-am: -maintainer-clean: maintainer-clean-am +maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic -mostlyclean: mostlyclean-am +mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool -pdf: pdf-am +pdf: pdf-recursive pdf-am: -ps: ps-am +ps: ps-recursive ps-am: uninstall-am: -.MAKE: install-am install-strip +.MAKE: $(am__recursive_targets) install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLIBRARIES cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool \ + clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIConstants.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIConstants.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIConstants.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIConstants.h 2017-07-23 16:22:03.000000000 +0000 @@ -12,12 +12,12 @@ /// @author Jakob Erdmann /// @author Laura Bieker /// @date 2007/10/24 -/// @version $Id: TraCIConstants.h 21794 2016-10-26 08:24:54Z namdre $ +/// @version $Id: TraCIConstants.h 24087 2017-04-27 11:15:10Z behrisch $ /// /// holds codes used for TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -30,12 +30,10 @@ #ifndef TRACICONSTANTS_H #define TRACICONSTANTS_H - // **************************************** // VERSION // **************************************** -#define TRACI_VERSION 13 - +#define TRACI_VERSION 15 // **************************************** // COMMANDS @@ -43,8 +41,11 @@ // command: get version #define CMD_GETVERSION 0x00 +// command: load +#define CMD_LOAD 0x01 + // command: simulation step -#define CMD_SIMSTEP2 0x02 +#define CMD_SIMSTEP 0x02 // command: stop node #define CMD_STOP 0x12 @@ -82,17 +83,17 @@ #define RESPONSE_SUBSCRIBE_INDUCTIONLOOP_VARIABLE 0xe0 // command: subscribe multi-entry/multi-exit detector (e3) context -#define CMD_SUBSCRIBE_MULTI_ENTRY_EXIT_DETECTOR_CONTEXT 0x81 +#define CMD_SUBSCRIBE_MULTIENTRYEXIT_CONTEXT 0x81 // response: subscribe multi-entry/multi-exit detector (e3) context -#define RESPONSE_SUBSCRIBE_MULTI_ENTRY_EXIT_DETECTOR_CONTEXT 0x91 +#define RESPONSE_SUBSCRIBE_MULTIENTRYEXIT_CONTEXT 0x91 // command: get multi-entry/multi-exit detector (e3) variable -#define CMD_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE 0xa1 +#define CMD_GET_MULTIENTRYEXIT_VARIABLE 0xa1 // response: get multi-entry/multi-exit detector (e3) variable -#define RESPONSE_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE 0xb1 +#define RESPONSE_GET_MULTIENTRYEXIT_VARIABLE 0xb1 // command: subscribe multi-entry/multi-exit detector (e3) variable -#define CMD_SUBSCRIBE_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE 0xd1 +#define CMD_SUBSCRIBE_MULTIENTRYEXIT_VARIABLE 0xd1 // response: subscribe multi-entry/multi-exit detector (e3) variable -#define RESPONSE_SUBSCRIBE_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE 0xe1 +#define RESPONSE_SUBSCRIBE_MULTIENTRYEXIT_VARIABLE 0xe1 // command: subscribe traffic lights context #define CMD_SUBSCRIBE_TL_CONTEXT 0x82 @@ -260,17 +261,17 @@ #define RESPONSE_SUBSCRIBE_GUI_VARIABLE 0xec // command: subscribe areal detector (e2) context -#define CMD_SUBSCRIBE_AREAL_DETECTOR_CONTEXT 0x8d +#define CMD_SUBSCRIBE_LANEAREA_CONTEXT 0x8d // response: subscribe areal detector (e2) context -#define RESPONSE_SUBSCRIBE_AREAL_DETECTOR_CONTEXT 0x9d +#define RESPONSE_SUBSCRIBE_LANEAREA_CONTEXT 0x9d // command: get areal detector (e2) variable -#define CMD_GET_AREAL_DETECTOR_VARIABLE 0xad +#define CMD_GET_LANEAREA_VARIABLE 0xad // response: get areal detector (e2) variable -#define RESPONSE_GET_AREAL_DETECTOR_VARIABLE 0xbd +#define RESPONSE_GET_LANEAREA_VARIABLE 0xbd // command: subscribe areal detector (e2) variable -#define CMD_SUBSCRIBE_AREAL_DETECTOR_VARIABLE 0xdd +#define CMD_SUBSCRIBE_LANEAREA_VARIABLE 0xdd // response: subscribe areal detector (e2) variable -#define RESPONSE_SUBSCRIBE_AREAL_DETECTOR_VARIABLE 0xed +#define RESPONSE_SUBSCRIBE_LANEAREA_VARIABLE 0xed // command: subscribe person context #define CMD_SUBSCRIBE_PERSON_CONTEXT 0x8e @@ -389,13 +390,42 @@ // **************************************** // PERSON/CONTAINER STAGES // **************************************** +// person / container stopping +#define STAGE_WAITING_FOR_DEPART 0x00 +// person / container stopping +#define STAGE_WAITING 0x01 // person walking / container transhiping -#define STAGE_WALKING 0x00 +#define STAGE_WALKING 0x02 // person riding / container being transported -#define STAGE_DRIVING 0x01 -// person / container stopping -#define STAGE_WAITING 0x02 +#define STAGE_DRIVING 0x03 +// **************************************** +// Stop Flags +// **************************************** +#define STOP_DEFAULT 0x00 +#define STOP_PARKING 0x01 +#define STOP_TRIGGERED 0x02 +#define STOP_CONTAINER_TRIGGERED 0x04 +#define STOP_BUS_STOP 0x08 +#define STOP_CONTAINER_STOP 0x10 +#define STOP_CHARGING_STATION 0x20 +#define STOP_PARKING_AREA 0x40 + +// **************************************** +// Departure Flags +// **************************************** +#define DEPARTFLAG_TRIGGERED -0x01 +#define DEPARTFLAG_CONTAINER_TRIGGERED -0x02 +#define DEPARTFLAG_NOW -0x03 + +#define DEPARTFLAG_SPEED_RANDOM -0x02 +#define DEPARTFLAG_SPEED_MAX -0x03 + +#define DEPARTFLAG_LANE_RANDOM -0x02 +#define DEPARTFLAG_LANE_FREE -0x03 +#define DEPARTFLAG_LANE_ALLOWED_FREE -0x04 +#define DEPARTFLAG_LANE_BEST_FREE -0x05 +#define DEPARTFLAG_LANE_FIRST_ALLOWED -0x06 // **************************************** // VARIABLE TYPES (for CMD_GET_*_VARIABLE) @@ -489,7 +519,6 @@ #define TL_EXTERNAL_STATE 0x2e - // outgoing link number (get: lanes) #define LANE_LINK_NUMBER 0x30 @@ -608,7 +637,6 @@ #define VAR_SPEED_DEVIATION 0x5f - // speed without TraCI influence (get: vehicle) #define VAR_SPEED_WITHOUT_TRACI 0xb1 @@ -619,7 +647,7 @@ #define VAR_SPEEDSETMODE 0xb3 // move vehicle, VTD version (set: vehicle) -#define VAR_MOVE_TO_VTD 0xb4 +#define MOVE_TO_XY 0xb4 // is the vehicle stopped, and if so parked and/or triggered? // value = stopped + 2 * parking + 4 * triggered @@ -646,6 +674,12 @@ // get/set vehicle height (vehicle, vtypes) #define VAR_HEIGHT 0xbc +// get/set vehicle line +#define VAR_LINE 0xbd + +// get/set vehicle via +#define VAR_VIA 0xbe + // current CO2 emission of a node (get: vehicle, lane, edge) #define VAR_CO2EMISSION 0x60 @@ -679,7 +713,7 @@ // edge index in current route (get: vehicle) #define VAR_ROUTE_INDEX 0x69 -//current waiting time (get: vehicle, lane) +// current waiting time (get: vehicle, lane) #define VAR_WAITING_TIME 0x7a // upcoming traffic lights (get: vehicle) @@ -764,11 +798,10 @@ #define VAR_PARAMETER 0x7e - -// add an instance (poi, polygon, vehicle, route) +// add an instance (poi, polygon, vehicle, person, route) #define ADD 0x80 -// remove an instance (poi, polygon, vehicle) +// remove an instance (poi, polygon, vehicle, person) #define REMOVE 0x81 // convert coordinates @@ -777,7 +810,7 @@ // distance between points or vehicles #define DISTANCE_REQUEST 0x83 -//the current driving distance +// the current driving distance #define VAR_DISTANCE 0x84 // add a fully specified instance (vehicle) @@ -798,8 +831,17 @@ // retrieve information regarding the next edge including crossings and walkingAreas (pedestrians only) #define VAR_NEXT_EDGE 0xc1 -// retrieve the number of stages (person, container) -#define VAR_NUM_STAGES 0xc2 +// retrieve information regarding the number of remaining stages +#define VAR_STAGES_REMAINING 0xc2 + +// retrieve the current vehicle id for the driving stage (person, container) +#define VAR_VEHICLE 0xc3 + +// append a person stage (person) +#define APPEND_STAGE 0xc4 + +// append a person stage (person) +#define REMOVE_STAGE 0xc5 // zoom #define VAR_VIEW_ZOOM 0xa0 diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIDefs.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIDefs.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIDefs.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIDefs.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,183 @@ +/****************************************************************************/ +/// @file TraCIDefs.h +/// @author Daniel Krajzewicz +/// @author Mario Krumnow +/// @author Michael Behrisch +/// @author Robert Hilbrich +/// @date 30.05.2012 +/// @version $Id: TraCIDefs.h 24108 2017-04-27 18:43:30Z behrisch $ +/// +// C++ TraCI client API implementation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef TraCIDefs_h +#define TraCIDefs_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include + + +// =========================================================================== +// global definitions +// =========================================================================== +#define DEFAULT_VIEW "View #0" +#define PRECISION 2 + + +// =========================================================================== +// class and type definitions +// =========================================================================== +typedef long long int SUMOTime; // +#define SUMOTime_MAX std::numeric_limits::max() + +/** +* @class TraCIException +*/ +class TraCIException : public std::runtime_error { +public: + /** constructor */ + TraCIException(std::string what) + : std::runtime_error(what) {} +}; + +/// @name Structures definitions +/// @{ + +/** @struct TraCIPosition + * @brief A 3D-position + */ +struct TraCIPosition { + double x, y, z; +}; + +/** @struct TraCIPosition + * @brief A color + */ +struct TraCIColor { + unsigned char r, g, b, a; +}; + +/** @struct TraCIPositionVector + * @brief A list of positions + */ +typedef std::vector TraCIPositionVector; + +/** @struct TraCIBoundary + * @brief A 3D-bounding box + */ +struct TraCIBoundary { + double xMin, yMin, zMin; + double xMax, yMax, zMax; +}; + +struct TraCIValue { + union { + double scalar; + TraCIPosition position; + TraCIColor color; + }; + std::string string; + std::vector stringList; +}; + +class TraCIPhase { +public: + TraCIPhase(const SUMOTime _duration, const SUMOTime _duration1, const SUMOTime _duration2, const std::string& _phase) + : duration(_duration), duration1(_duration1), duration2(_duration2), phase(_phase) {} + ~TraCIPhase() {} + + SUMOTime duration, duration1, duration2; + std::string phase; +}; + + +class TraCILogic { +public: + TraCILogic(const std::string& _subID, int _type, const std::map& _subParameter, int _currentPhaseIndex, const std::vector& _phases) + : subID(_subID), type(_type), subParameter(_subParameter), currentPhaseIndex(_currentPhaseIndex), phases(_phases) {} + ~TraCILogic() {} + + std::string subID; + int type; + std::map subParameter; + int currentPhaseIndex; + std::vector phases; +}; + + +class TraCILink { +public: + TraCILink(const std::string& _from, const std::string& _via, const std::string& _to) + : from(_from), via(_via), to(_to) {} + ~TraCILink() {} + + std::string from; + std::string via; + std::string to; +}; + + +class TraCIConnection { +public: + TraCIConnection(const std::string& _approachedLane, const bool _hasPrio, const bool _isOpen, const bool _hasFoe, + const std::string _approachedInternal, const std::string _state, const std::string _direction, const double _length) + : approachedLane(_approachedLane), hasPrio(_hasPrio), isOpen(_isOpen), hasFoe(_hasFoe), + approachedInternal(_approachedInternal), state(_state), direction(_direction), length(_length) {} + ~TraCIConnection() {} + + std::string approachedLane; + bool hasPrio; + bool isOpen; + bool hasFoe; + std::string approachedInternal; + std::string state; + std::string direction; + double length; +}; + + +class TraCIVehicleData { +public: + /* @brief Constructor + (mirrors MSInductLoop::VehicleData) */ + TraCIVehicleData() {} + /// @brief The id of the vehicle + std::string id; + /// @brief Length of the vehicle + double length; + /// @brief Entry-time of the vehicle in [s] + double entryTime; + /// @brief Leave-time of the vehicle in [s] + double leaveTime; + /// @brief Type of the vehicle in + std::string typeID; +}; + +/// @} + + +#endif + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIException.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIException.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIException.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIException.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -/****************************************************************************/ -/// @file TraCIException.h -/// @author Axel Wegener -/// @author Friedemann Wesner -/// @author Christoph Sommer -/// @author Daniel Krajzewicz -/// @author Michael Behrisch -/// @date 2007/10/24 -/// @version $Id: TraCIException.h 20433 2016-04-13 08:00:14Z behrisch $ -/// -/// Exception thrown by TraCI -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ -#ifndef TRACIEXCEPTION_H -#define TRACIEXCEPTION_H -#ifndef NO_TRACI - - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include -#include - - -// =========================================================================== -// class definitions -// =========================================================================== -/** -* @class TraCIException -*/ -class TraCIException : public std::runtime_error { -public: - /** constructor */ - TraCIException(std::string what) - : std::runtime_error(what) {} -}; - -#endif - -#endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_ArealDetector.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_ArealDetector.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_ArealDetector.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_ArealDetector.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,151 +0,0 @@ -/****************************************************************************/ -/// @file TraCIServerAPI_AreaDetector.cpp -/// @author Mario Krumnow -/// @author Robbin Blokpoel -/// @author Daniel Krajzewicz -/// @author Michael Behrisch -/// @date 03.02.2014 -/// @version $Id: TraCIServerAPI_ArealDetector.cpp 20482 2016-04-18 20:49:42Z behrisch $ -/// -// APIs for getting/setting areal detector values via TraCI -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2014 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ - - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#ifndef NO_TRACI - -#include -#include "TraCIConstants.h" -#include "TraCIServer.h" -#include "TraCIServerAPI_ArealDetector.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - - -// =========================================================================== -// method definitions -// =========================================================================== -bool -TraCIServerAPI_ArealDetector::processGet(TraCIServer& server, tcpip::Storage& inputStorage, - tcpip::Storage& outputStorage) { - // variable & id - int variable = inputStorage.readUnsignedByte(); - std::string id = inputStorage.readString(); - // check variable - if (variable != ID_LIST - && variable != ID_COUNT - && variable != JAM_LENGTH_VEHICLE - && variable != JAM_LENGTH_METERS - && variable != LAST_STEP_VEHICLE_NUMBER - && variable != LAST_STEP_MEAN_SPEED - && variable != LAST_STEP_VEHICLE_ID_LIST - && variable != LAST_STEP_VEHICLE_HALTING_NUMBER - && variable != ID_COUNT - && variable != LAST_STEP_OCCUPANCY - && variable != VAR_POSITION - && variable != VAR_LANE_ID - && variable != VAR_LENGTH) { - return server.writeErrorStatusCmd(CMD_GET_AREAL_DETECTOR_VARIABLE, "Get Areal Detector Variable: unsupported variable " + toHex(variable, 2) + " specified", outputStorage); - } - - // begin response building - tcpip::Storage tempMsg; - // response-code, variableID, objectID - tempMsg.writeUnsignedByte(RESPONSE_GET_AREAL_DETECTOR_VARIABLE); - tempMsg.writeUnsignedByte(variable); - tempMsg.writeString(id); - if (variable == ID_LIST) { - std::vector ids; - MSNet::getInstance()->getDetectorControl().getTypedDetectors(SUMO_TAG_LANE_AREA_DETECTOR).insertIDs(ids); - tempMsg.writeUnsignedByte(TYPE_STRINGLIST); - tempMsg.writeStringList(ids); - } else if (variable == ID_COUNT) { - std::vector ids; - MSNet::getInstance()->getDetectorControl().getTypedDetectors(SUMO_TAG_LANE_AREA_DETECTOR).insertIDs(ids); - tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt((int) ids.size()); - } else { - MSE2Collector* e2 = dynamic_cast(MSNet::getInstance()->getDetectorControl().getTypedDetectors(SUMO_TAG_LANE_AREA_DETECTOR).get(id)); - if (e2 == 0) { - return server.writeErrorStatusCmd(CMD_GET_AREAL_DETECTOR_VARIABLE, "Areal detector '" + id + "' is not known", outputStorage); - } - std::vector ids; - switch (variable) { - case ID_LIST: - break; - case LAST_STEP_VEHICLE_NUMBER: - tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt((int) e2->getCurrentVehicleNumber()); - break; - case LAST_STEP_MEAN_SPEED: - tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(e2->getCurrentMeanSpeed()); - break; - case LAST_STEP_VEHICLE_ID_LIST: - tempMsg.writeUnsignedByte(TYPE_STRINGLIST); - ids = e2->getCurrentVehicleIDs(); - tempMsg.writeStringList(ids); - break; - case LAST_STEP_VEHICLE_HALTING_NUMBER: - tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt(e2->getCurrentHaltingNumber()); - break; - case JAM_LENGTH_VEHICLE: - tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt((int) e2->getCurrentJamLengthInVehicles()); - break; - case JAM_LENGTH_METERS: - tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(e2->getCurrentJamLengthInMeters()); - break; - case LAST_STEP_OCCUPANCY: - tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(e2->getCurrentOccupancy()); - break; - case VAR_POSITION: - tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(e2->getStartPos()); - break; - case VAR_LANE_ID: - tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(e2->getLane()->getID()); - break; - case VAR_LENGTH: - tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(e2->getEndPos() - e2->getStartPos()); - break; - default: - break; - } - } - server.writeStatusCmd(CMD_GET_AREAL_DETECTOR_VARIABLE, RTYPE_OK, "", outputStorage); - server.writeResponseWithLength(outputStorage, tempMsg); - return true; -} - -#endif - - -/****************************************************************************/ - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_ArealDetector.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_ArealDetector.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_ArealDetector.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_ArealDetector.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -/****************************************************************************/ -/// @file TraCIServerAPI_AreaDetector.h -/// @author Mario Krumnow -/// @author Michael Behrisch -/// @date 15.09.2013 -/// @version $Id: TraCIServerAPI_ArealDetector.h 20433 2016-04-13 08:00:14Z behrisch $ -/// -// APIs for getting/setting areal detector values via TraCI -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ -#ifndef TraCIServerAPI_ArealDetector_h -#define TraCIServerAPI_ArealDetector_h - - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#ifndef NO_TRACI - -#include - - -// =========================================================================== -// class declarations -// =========================================================================== -class TraCIServer; - - -// =========================================================================== -// class definitions -// =========================================================================== -/** - * @class TraCIServerAPI_AreaDetector - * @brief APIs for getting/setting multi-entry/multi-exit detector values via TraCI - */ -class TraCIServerAPI_ArealDetector { -public: - /** @brief Processes a get value command (Command 0xa1: Get AreaDetector Variable) - * - * @param[in] server The TraCI-server-instance which schedules this request - * @param[in] inputStorage The storage to read the command from - * @param[out] outputStorage The storage to write the result to - */ - static bool processGet(TraCIServer& server, tcpip::Storage& inputStorage, - tcpip::Storage& outputStorage); - - -private: - /// @brief invalidated copy constructor - TraCIServerAPI_ArealDetector(const TraCIServerAPI_ArealDetector& s); - - /// @brief invalidated assignment operator - TraCIServerAPI_ArealDetector& operator=(const TraCIServerAPI_ArealDetector& s); - - -}; - - -#endif - -#endif - -/****************************************************************************/ - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Edge.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Edge.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Edge.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Edge.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ /// @author Laura Bieker /// @author Mario Krumnow /// @date Sept 2002 -/// @version $Id: TraCIServerAPI_Edge.cpp 21514 2016-09-22 13:00:49Z namdre $ +/// @version $Id: TraCIServerAPI_Edge.cpp 23694 2017-03-28 20:07:13Z namdre $ /// // APIs for getting/setting edge values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,10 +47,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -102,7 +98,7 @@ return server.writeErrorStatusCmd(CMD_GET_EDGE_VARIABLE, "The message must contain the time definition.", outputStorage); } tempMsg.writeUnsignedByte(TYPE_DOUBLE); - SUMOReal value; + double value; if (!MSNet::getInstance()->getWeightsStorage().retrieveExistingTravelTime(e, time, value)) { tempMsg.writeDouble(-1); } else { @@ -117,7 +113,7 @@ return server.writeErrorStatusCmd(CMD_GET_EDGE_VARIABLE, "The message must contain the time definition.", outputStorage); } tempMsg.writeUnsignedByte(TYPE_DOUBLE); - SUMOReal value; + double value; if (!MSNet::getInstance()->getWeightsStorage().retrieveExistingEffort(e, time, value)) { tempMsg.writeDouble(-1); } else { @@ -130,7 +126,7 @@ tempMsg.writeDouble(e->getCurrentTravelTime()); break; case VAR_WAITING_TIME: { - SUMOReal wtime = 0; + double wtime = 0; const std::vector& lanes = e->getLanes(); for (std::vector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) { wtime += (*i)->getWaitingSeconds(); @@ -141,7 +137,7 @@ break; case LAST_STEP_PERSON_ID_LIST: { std::vector personIDs; - std::vector persons = e->getSortedPersons(MSNet::getInstance()->getCurrentTimeStep()); + std::vector persons = e->getSortedPersons(MSNet::getInstance()->getCurrentTimeStep(), true); for (std::vector::iterator it = persons.begin(); it != persons.end(); ++it) { personIDs.push_back((*it)->getID()); } @@ -164,7 +160,7 @@ } break; case VAR_CO2EMISSION: { - SUMOReal sum = 0; + double sum = 0; const std::vector& lanes = e->getLanes(); for (std::vector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) { sum += (*i)->getCO2Emissions(); @@ -174,7 +170,7 @@ } break; case VAR_COEMISSION: { - SUMOReal sum = 0; + double sum = 0; const std::vector& lanes = e->getLanes(); for (std::vector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) { sum += (*i)->getCOEmissions(); @@ -184,7 +180,7 @@ } break; case VAR_HCEMISSION: { - SUMOReal sum = 0; + double sum = 0; const std::vector& lanes = e->getLanes(); for (std::vector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) { sum += (*i)->getHCEmissions(); @@ -194,7 +190,7 @@ } break; case VAR_PMXEMISSION: { - SUMOReal sum = 0; + double sum = 0; const std::vector& lanes = e->getLanes(); for (std::vector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) { sum += (*i)->getPMxEmissions(); @@ -204,7 +200,7 @@ } break; case VAR_NOXEMISSION: { - SUMOReal sum = 0; + double sum = 0; const std::vector& lanes = e->getLanes(); for (std::vector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) { sum += (*i)->getNOxEmissions(); @@ -214,7 +210,7 @@ } break; case VAR_FUELCONSUMPTION: { - SUMOReal sum = 0; + double sum = 0; const std::vector& lanes = e->getLanes(); for (std::vector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) { sum += (*i)->getFuelConsumption(); @@ -224,10 +220,10 @@ } break; case VAR_NOISEEMISSION: { - SUMOReal sum = 0; + double sum = 0; const std::vector& lanes = e->getLanes(); for (std::vector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) { - sum += (SUMOReal) pow(10., ((*i)->getHarmonoise_NoiseEmissions() / 10.)); + sum += (double) pow(10., ((*i)->getHarmonoise_NoiseEmissions() / 10.)); } tempMsg.writeUnsignedByte(TYPE_DOUBLE); if (sum != 0) { @@ -238,7 +234,7 @@ } break; case VAR_ELECTRICITYCONSUMPTION: { - SUMOReal sum = 0; + double sum = 0; const std::vector& lanes = e->getLanes(); for (std::vector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) { sum += (*i)->getElectricityConsumption(); @@ -263,13 +259,13 @@ } break; case LAST_STEP_OCCUPANCY: { - SUMOReal sum = 0; + double sum = 0; const std::vector& lanes = e->getLanes(); for (std::vector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) { sum += (*i)->getNettoOccupancy(); } tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(sum / (SUMOReal) lanes.size()); + tempMsg.writeDouble(sum / (double) lanes.size()); } break; case LAST_STEP_VEHICLE_HALTING_NUMBER: { @@ -289,7 +285,7 @@ } break; case LAST_STEP_LENGTH: { - SUMOReal lengthSum = 0; + double lengthSum = 0; int noVehicles = 0; const std::vector& lanes = e->getLanes(); for (std::vector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) { @@ -304,7 +300,7 @@ if (noVehicles == 0) { tempMsg.writeDouble(0); } else { - tempMsg.writeDouble(lengthSum / (SUMOReal) noVehicles); + tempMsg.writeDouble(lengthSum / (double) noVehicles); } } break; @@ -398,7 +394,7 @@ if (!server.readTypeCheckingDouble(inputStorage, value)) { return server.writeErrorStatusCmd(CMD_SET_EDGE_VARIABLE, "The variable must be the value given as double", outputStorage); } - MSNet::getInstance()->getWeightsStorage().addTravelTime(e, SUMOReal(0), SUMOReal(SUMOTime_MAX), value); + MSNet::getInstance()->getWeightsStorage().addTravelTime(e, 0., double(SUMOTime_MAX), value); } else { return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time requires either begin time, end time, and value, or only value as parameter.", outputStorage); } @@ -430,7 +426,7 @@ if (!server.readTypeCheckingDouble(inputStorage, value)) { return server.writeErrorStatusCmd(CMD_SET_EDGE_VARIABLE, "The variable must be the value given as double", outputStorage); } - MSNet::getInstance()->getWeightsStorage().addEffort(e, SUMOReal(0), SUMOReal(SUMOTime_MAX), value); + MSNet::getInstance()->getWeightsStorage().addEffort(e, 0., double(SUMOTime_MAX), value); } else { return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort requires either begin time, end time, and value, or only value as parameter.", outputStorage); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Edge.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Edge.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Edge.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Edge.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_Edge.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: TraCIServerAPI_Edge.h 23410 2017-03-15 10:35:33Z namdre $ /// // APIs for getting/setting edge values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,7 +32,7 @@ #ifndef NO_TRACI -#include "TraCIException.h" +#include "TraCIDefs.h" #include "TraCIServer.h" #include diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_InductionLoop.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_InductionLoop.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_InductionLoop.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_InductionLoop.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_InductionLoop.cpp 21217 2016-07-22 10:57:44Z behrisch $ +/// @version $Id: TraCIServerAPI_InductionLoop.cpp 23801 2017-04-04 09:48:48Z behrisch $ /// // APIs for getting/setting induction loop values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,15 +33,13 @@ #ifndef NO_TRACI -#include "TraCIConstants.h" #include #include +#include "lib/TraCI_InductionLoop.h" +#include "TraCIConstants.h" +#include "TraCIDefs.h" #include "TraCIServerAPI_InductionLoop.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -67,52 +65,50 @@ tempMsg.writeUnsignedByte(variable); tempMsg.writeString(id); // process request - if (variable == ID_LIST) { - std::vector ids; - MSNet::getInstance()->getDetectorControl().getTypedDetectors(SUMO_TAG_INDUCTION_LOOP).insertIDs(ids); - tempMsg.writeUnsignedByte(TYPE_STRINGLIST); - tempMsg.writeStringList(ids); - } else if (variable == ID_COUNT) { - std::vector ids; - MSNet::getInstance()->getDetectorControl().getTypedDetectors(SUMO_TAG_INDUCTION_LOOP).insertIDs(ids); - tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt((int) ids.size()); - } else { - MSInductLoop* il = dynamic_cast(MSNet::getInstance()->getDetectorControl().getTypedDetectors(SUMO_TAG_INDUCTION_LOOP).get(id)); - if (il == 0) { - return server.writeErrorStatusCmd(CMD_GET_INDUCTIONLOOP_VARIABLE, "Induction loop '" + id + "' is not known", outputStorage); - } + try { switch (variable) { case ID_LIST: + tempMsg.writeUnsignedByte(TYPE_STRINGLIST); + tempMsg.writeStringList(TraCI_InductionLoop::getIDList()); + break; + case ID_COUNT: + tempMsg.writeUnsignedByte(TYPE_INTEGER); + tempMsg.writeInt(TraCI_InductionLoop::getIDCount()); + break; + case VAR_POSITION: + tempMsg.writeUnsignedByte(TYPE_DOUBLE); + tempMsg.writeDouble(TraCI_InductionLoop::getPosition(id)); + break; + case VAR_LANE_ID: + tempMsg.writeUnsignedByte(TYPE_STRING); + tempMsg.writeString(TraCI_InductionLoop::getLaneID(id)); break; case LAST_STEP_VEHICLE_NUMBER: tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt((int)(il->getCurrentPassedNumber())); + tempMsg.writeInt(TraCI_InductionLoop::getLastStepVehicleNumber(id)); break; case LAST_STEP_MEAN_SPEED: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(il->getCurrentSpeed()); + tempMsg.writeDouble(TraCI_InductionLoop::getLastStepMeanSpeed(id)); break; - case LAST_STEP_VEHICLE_ID_LIST: { + case LAST_STEP_VEHICLE_ID_LIST: tempMsg.writeUnsignedByte(TYPE_STRINGLIST); - std::vector ids = il->getCurrentVehicleIDs(); - tempMsg.writeStringList(ids); - } - break; + tempMsg.writeStringList(TraCI_InductionLoop::getLastStepVehicleIDs(id)); + break; case LAST_STEP_OCCUPANCY: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(il->getCurrentOccupancy()); + tempMsg.writeDouble(TraCI_InductionLoop::getLastStepOccupancy(id)); break; case LAST_STEP_LENGTH: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(il->getCurrentLength()); + tempMsg.writeDouble(TraCI_InductionLoop::getLastStepMeanLength(id)); break; case LAST_STEP_TIME_SINCE_DETECTION: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(il->getTimestepsSinceLastDetection()); + tempMsg.writeDouble(TraCI_InductionLoop::getTimeSinceDetection(id)); break; case LAST_STEP_VEHICLE_DATA: { - std::vector vd = il->collectVehiclesOnDet(MSNet::getInstance()->getCurrentTimeStep() - DELTA_T, true); + std::vector vd = TraCI_InductionLoop::getVehicleData(id); tempMsg.writeUnsignedByte(TYPE_COMPOUND); tcpip::Storage tempContent; int cnt = 0; @@ -120,21 +116,21 @@ tempContent.writeInt((int) vd.size()); ++cnt; for (int i = 0; i < (int)vd.size(); ++i) { - MSInductLoop::VehicleData& svd = vd[i]; + TraCIVehicleData& svd = vd[i]; tempContent.writeUnsignedByte(TYPE_STRING); - tempContent.writeString(svd.idM); + tempContent.writeString(svd.id); ++cnt; tempContent.writeUnsignedByte(TYPE_DOUBLE); - tempContent.writeDouble(svd.lengthM); + tempContent.writeDouble(svd.length); ++cnt; tempContent.writeUnsignedByte(TYPE_DOUBLE); - tempContent.writeDouble(svd.entryTimeM); + tempContent.writeDouble(svd.entryTime); ++cnt; tempContent.writeUnsignedByte(TYPE_DOUBLE); - tempContent.writeDouble(svd.leaveTimeM); + tempContent.writeDouble(svd.leaveTime); ++cnt; tempContent.writeUnsignedByte(TYPE_STRING); - tempContent.writeString(svd.typeIDM); + tempContent.writeString(svd.typeID); ++cnt; } @@ -142,17 +138,11 @@ tempMsg.writeStorage(tempContent); break; } - case VAR_POSITION: - tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(il->getPosition()); - break; - case VAR_LANE_ID: - tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(il->getLane()->getID()); - break; default: break; } + } catch (TraCIException& e) { + return server.writeErrorStatusCmd(CMD_GET_INDUCTIONLOOP_VARIABLE, e.what(), outputStorage); } server.writeStatusCmd(CMD_GET_INDUCTIONLOOP_VARIABLE, RTYPE_OK, "", outputStorage); server.writeResponseWithLength(outputStorage, tempMsg); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_InductionLoop.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_InductionLoop.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_InductionLoop.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_InductionLoop.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_InductionLoop.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: TraCIServerAPI_InductionLoop.h 23410 2017-03-15 10:35:33Z namdre $ /// // APIs for getting/setting induction loop values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,7 +33,7 @@ #ifndef NO_TRACI -#include "TraCIException.h" +#include "TraCIDefs.h" #include "TraCIServer.h" #include diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Junction.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Junction.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Junction.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Junction.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Mario Krumnow /// @author Jakob Erdmann /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_Junction.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: TraCIServerAPI_Junction.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // APIs for getting/setting junction values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,10 +40,7 @@ #include #include #include "TraCIServerAPI_Junction.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS +#include "lib/TraCI_Junction.h" // =========================================================================== @@ -65,50 +62,50 @@ tempMsg.writeUnsignedByte(RESPONSE_GET_JUNCTION_VARIABLE); tempMsg.writeUnsignedByte(variable); tempMsg.writeString(id); - if (variable == ID_LIST) { - std::vector ids; - MSNet::getInstance()->getJunctionControl().insertIDs(ids); - tempMsg.writeUnsignedByte(TYPE_STRINGLIST); - tempMsg.writeStringList(ids); - } else if (variable == ID_COUNT) { - std::vector ids; - MSNet::getInstance()->getJunctionControl().insertIDs(ids); - tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt((int) ids.size()); - } else { - MSJunction* j = MSNet::getInstance()->getJunctionControl().get(id); - if (j == 0) { - return server.writeErrorStatusCmd(CMD_GET_JUNCTION_VARIABLE, "Junction '" + id + "' is not known", outputStorage); - } + + try { switch (variable) { case ID_LIST: + tempMsg.writeUnsignedByte(TYPE_STRINGLIST); + tempMsg.writeStringList(TraCI_Junction::getIDList()); + break; + case ID_COUNT: + tempMsg.writeUnsignedByte(TYPE_INTEGER); + tempMsg.writeInt(TraCI_Junction::getIDCount()); break; - case VAR_POSITION: + case VAR_POSITION: { tempMsg.writeUnsignedByte(POSITION_2D); - tempMsg.writeDouble(j->getPosition().x()); - tempMsg.writeDouble(j->getPosition().y()); + TraCIPosition p = TraCI_Junction::getPosition(id); + tempMsg.writeDouble(p.x); + tempMsg.writeDouble(p.y); break; - case VAR_SHAPE: + } + case VAR_SHAPE: { tempMsg.writeUnsignedByte(TYPE_POLYGON); - tempMsg.writeUnsignedByte(MIN2(255, (int)j->getShape().size())); - for (int iPoint = 0; iPoint < MIN2(255, (int)j->getShape().size()); ++iPoint) { - tempMsg.writeDouble(j->getShape()[iPoint].x()); - tempMsg.writeDouble(j->getShape()[iPoint].y()); + const TraCIPositionVector shp = TraCI_Junction::getShape(id); + tempMsg.writeUnsignedByte(MIN2(255, (int) shp.size())); + for (int iPoint = 0; iPoint < MIN2(255, (int) shp.size()); ++iPoint) { + tempMsg.writeDouble(shp[iPoint].x); + tempMsg.writeDouble(shp[iPoint].y); } break; - + } default: break; + } + } catch (TraCIException& e) { + return server.writeErrorStatusCmd(CMD_GET_JUNCTION_VARIABLE, e.what(), outputStorage); } server.writeStatusCmd(CMD_GET_JUNCTION_VARIABLE, RTYPE_OK, "", outputStorage); server.writeResponseWithLength(outputStorage, tempMsg); + return true; } bool TraCIServerAPI_Junction::getPosition(const std::string& id, Position& p) { - MSJunction* j = MSNet::getInstance()->getJunctionControl().get(id); + MSJunction* j = TraCI_Junction::getJunction(id); if (j == 0) { return false; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Junction.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Junction.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Junction.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Junction.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_Junction.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: TraCIServerAPI_Junction.h 23410 2017-03-15 10:35:33Z namdre $ /// // APIs for getting/setting junction values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,7 +33,7 @@ #ifndef NO_TRACI -#include "TraCIException.h" +#include "TraCIDefs.h" #include "TraCIServer.h" #include diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_LaneArea.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_LaneArea.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_LaneArea.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_LaneArea.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,141 @@ +/****************************************************************************/ +/// @file TraCIServerAPI_AreaDetector.cpp +/// @author Mario Krumnow +/// @author Robbin Blokpoel +/// @author Daniel Krajzewicz +/// @author Michael Behrisch +/// @date 03.02.2014 +/// @version $Id: TraCIServerAPI_LaneArea.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +// APIs for getting/setting areal detector values via TraCI +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2014 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#ifndef NO_TRACI + +#include +#include "TraCIConstants.h" +#include "TraCIDefs.h" +#include "TraCIServer.h" +#include "lib/TraCI_LaneArea.h" +#include "TraCIServerAPI_LaneArea.h" + + +// =========================================================================== +// method definitions +// =========================================================================== +bool +TraCIServerAPI_LaneArea::processGet(TraCIServer& server, tcpip::Storage& inputStorage, + tcpip::Storage& outputStorage) { + // variable & id + int variable = inputStorage.readUnsignedByte(); + std::string id = inputStorage.readString(); + // check variable + if (variable != ID_LIST + && variable != ID_COUNT + && variable != JAM_LENGTH_VEHICLE + && variable != JAM_LENGTH_METERS + && variable != LAST_STEP_VEHICLE_NUMBER + && variable != LAST_STEP_MEAN_SPEED + && variable != LAST_STEP_VEHICLE_ID_LIST + && variable != LAST_STEP_VEHICLE_HALTING_NUMBER + && variable != ID_COUNT + && variable != LAST_STEP_OCCUPANCY + && variable != VAR_POSITION + && variable != VAR_LANE_ID + && variable != VAR_LENGTH) { + return server.writeErrorStatusCmd(CMD_GET_LANEAREA_VARIABLE, "Get Areal Detector Variable: unsupported variable " + toHex(variable, 2) + " specified", outputStorage); + } + + // begin response building + tcpip::Storage tempMsg; + // response-code, variableID, objectID + tempMsg.writeUnsignedByte(RESPONSE_GET_LANEAREA_VARIABLE); + tempMsg.writeUnsignedByte(variable); + tempMsg.writeString(id); + try { + switch (variable) { + case ID_LIST: + tempMsg.writeUnsignedByte(TYPE_STRINGLIST); + tempMsg.writeStringList(TraCI_LaneArea::getIDList()); + break; + case ID_COUNT: + tempMsg.writeUnsignedByte(TYPE_INTEGER); + tempMsg.writeInt(TraCI_LaneArea::getIDCount()); + break; + case LAST_STEP_VEHICLE_NUMBER: + tempMsg.writeUnsignedByte(TYPE_INTEGER); + tempMsg.writeInt(TraCI_LaneArea::getLastStepVehicleNumber(id)); + break; + case LAST_STEP_MEAN_SPEED: + tempMsg.writeUnsignedByte(TYPE_DOUBLE); + tempMsg.writeDouble(TraCI_LaneArea::getLastStepMeanSpeed(id)); + break; + case LAST_STEP_VEHICLE_ID_LIST: + tempMsg.writeUnsignedByte(TYPE_STRINGLIST); + tempMsg.writeStringList(TraCI_LaneArea::getLastStepVehicleIDs(id)); + break; + case LAST_STEP_VEHICLE_HALTING_NUMBER: + tempMsg.writeUnsignedByte(TYPE_INTEGER); + tempMsg.writeInt(TraCI_LaneArea::getLastStepHaltingNumber(id)); + break; + case JAM_LENGTH_VEHICLE: + tempMsg.writeUnsignedByte(TYPE_INTEGER); + tempMsg.writeInt(TraCI_LaneArea::getJamLengthVehicle(id)); + break; + case JAM_LENGTH_METERS: + tempMsg.writeUnsignedByte(TYPE_DOUBLE); + tempMsg.writeDouble(TraCI_LaneArea::getJamLengthMeters(id)); + break; + case LAST_STEP_OCCUPANCY: + tempMsg.writeUnsignedByte(TYPE_DOUBLE); + tempMsg.writeDouble(TraCI_LaneArea::getLastStepOccupancy(id)); + break; + case VAR_POSITION: + tempMsg.writeUnsignedByte(TYPE_DOUBLE); + tempMsg.writeDouble(TraCI_LaneArea::getPosition(id)); + break; + case VAR_LANE_ID: + tempMsg.writeUnsignedByte(TYPE_STRING); + tempMsg.writeString(TraCI_LaneArea::getLaneID(id)); + break; + case VAR_LENGTH: + tempMsg.writeUnsignedByte(TYPE_DOUBLE); + tempMsg.writeDouble(TraCI_LaneArea::getLength(id)); + break; + default: + break; + } + } catch (TraCIException& e) { + return server.writeErrorStatusCmd(CMD_GET_LANEAREA_VARIABLE, e.what(), outputStorage); + } + server.writeStatusCmd(CMD_GET_LANEAREA_VARIABLE, RTYPE_OK, "", outputStorage); + server.writeResponseWithLength(outputStorage, tempMsg); + return true; +} + +#endif + + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_LaneArea.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_LaneArea.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_LaneArea.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_LaneArea.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,80 @@ +/****************************************************************************/ +/// @file TraCIServerAPI_AreaDetector.h +/// @author Mario Krumnow +/// @author Michael Behrisch +/// @date 15.09.2013 +/// @version $Id: TraCIServerAPI_LaneArea.h 24028 2017-04-24 05:10:18Z behrisch $ +/// +// APIs for getting/setting areal detector values via TraCI +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef TraCIServerAPI_LaneArea_h +#define TraCIServerAPI_LaneArea_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#ifndef NO_TRACI + +#include + + +// =========================================================================== +// class declarations +// =========================================================================== +class TraCIServer; + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class TraCIServerAPI_AreaDetector + * @brief APIs for getting/setting multi-entry/multi-exit detector values via TraCI + */ +class TraCIServerAPI_LaneArea { +public: + /** @brief Processes a get value command (Command 0xa1: Get AreaDetector Variable) + * + * @param[in] server The TraCI-server-instance which schedules this request + * @param[in] inputStorage The storage to read the command from + * @param[out] outputStorage The storage to write the result to + */ + static bool processGet(TraCIServer& server, tcpip::Storage& inputStorage, + tcpip::Storage& outputStorage); + + +private: + /// @brief invalidated copy constructor + TraCIServerAPI_LaneArea(const TraCIServerAPI_LaneArea& s); + + /// @brief invalidated assignment operator + TraCIServerAPI_LaneArea& operator=(const TraCIServerAPI_LaneArea& s); + + +}; + + +#endif + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Lane.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Lane.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Lane.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Lane.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,13 +5,14 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @author Mario Krumnow +/// @author Leonhard Luecken /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_Lane.cpp 21514 2016-09-22 13:00:49Z namdre $ +/// @version $Id: TraCIServerAPI_Lane.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // APIs for getting/setting lane values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,10 +43,7 @@ #include "TraCIConstants.h" #include "TraCIServer.h" #include "TraCIServerAPI_Lane.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS +#include "lib/TraCI_Lane.h" // =========================================================================== @@ -78,15 +76,11 @@ tempMsg.writeUnsignedByte(variable); tempMsg.writeString(id); if (variable == ID_LIST) { - std::vector ids; - MSLane::insertIDs(ids); tempMsg.writeUnsignedByte(TYPE_STRINGLIST); - tempMsg.writeStringList(ids); + tempMsg.writeStringList(TraCI_Lane::getIDList()); } else if (variable == ID_COUNT) { - std::vector ids; - MSLane::insertIDs(ids); tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt((int) ids.size()); + tempMsg.writeInt(TraCI_Lane::getIDCount()); } else { MSLane* lane = MSLane::dictionary(id); if (lane == 0) { @@ -95,196 +89,158 @@ switch (variable) { case LANE_LINK_NUMBER: tempMsg.writeUnsignedByte(TYPE_UBYTE); - tempMsg.writeUnsignedByte((int) lane->getLinkCont().size()); + tempMsg.writeUnsignedByte(TraCI_Lane::getLinkNumber(id)); break; case LANE_EDGE_ID: tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(lane->getEdge().getID()); + tempMsg.writeString(TraCI_Lane::getEdgeID(id)); break; case VAR_LENGTH: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(lane->getLength()); + tempMsg.writeDouble(TraCI_Lane::getLength(id)); break; case VAR_MAXSPEED: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(lane->getSpeedLimit()); + tempMsg.writeDouble(TraCI_Lane::getMaxSpeed(id)); break; case LANE_LINKS: { tempMsg.writeUnsignedByte(TYPE_COMPOUND); + const std::vector links = TraCI_Lane::getLinks(id); tcpip::Storage tempContent; int cnt = 0; tempContent.writeUnsignedByte(TYPE_INTEGER); - const MSLinkCont& links = lane->getLinkCont(); tempContent.writeInt((int) links.size()); ++cnt; - const SUMOTime currTime = MSNet::getInstance()->getCurrentTimeStep(); - for (MSLinkCont::const_iterator i = links.begin(); i != links.end(); ++i) { - MSLink* link = (*i); + for (std::vector::const_iterator i = links.begin(); i != links.end(); ++i) { // approached non-internal lane (if any) tempContent.writeUnsignedByte(TYPE_STRING); - tempContent.writeString(link->getLane() != 0 ? link->getLane()->getID() : ""); + tempContent.writeString(i->approachedLane); ++cnt; // approached "via", internal lane (if any) tempContent.writeUnsignedByte(TYPE_STRING); -#ifdef HAVE_INTERNAL_LANES - tempContent.writeString(link->getViaLane() != 0 ? link->getViaLane()->getID() : ""); -#else - tempContent.writeString(""); -#endif + tempContent.writeString(i->approachedInternal); ++cnt; // priority tempContent.writeUnsignedByte(TYPE_UBYTE); - tempContent.writeUnsignedByte(link->havePriority() ? 1 : 0); + tempContent.writeUnsignedByte(i->hasPrio); ++cnt; // opened tempContent.writeUnsignedByte(TYPE_UBYTE); - const SUMOReal speed = MIN2(lane->getSpeedLimit(), link->getLane()->getSpeedLimit()); - tempContent.writeUnsignedByte(link->opened(currTime, speed, speed, SUMOVTypeParameter::getDefault().length, - SUMOVTypeParameter::getDefault().impatience, SUMOVTypeParameter::getDefaultDecel(), 0) ? 1 : 0); + tempContent.writeUnsignedByte(i->isOpen); ++cnt; // approaching foe tempContent.writeUnsignedByte(TYPE_UBYTE); - tempContent.writeUnsignedByte(link->hasApproachingFoe(currTime, currTime, 0, SUMOVTypeParameter::getDefaultDecel()) ? 1 : 0); + tempContent.writeUnsignedByte(i->hasFoe); ++cnt; // state (not implemented, yet) tempContent.writeUnsignedByte(TYPE_STRING); - tempContent.writeString(SUMOXMLDefinitions::LinkStates.getString(link->getState())); + tempContent.writeString(i->state); ++cnt; // direction tempContent.writeUnsignedByte(TYPE_STRING); - tempContent.writeString(SUMOXMLDefinitions::LinkDirections.getString(link->getDirection())); + tempContent.writeString(i->direction); ++cnt; // length tempContent.writeUnsignedByte(TYPE_DOUBLE); - tempContent.writeDouble(link->getLength()); + tempContent.writeDouble(i->length); ++cnt; } - tempMsg.writeInt((int) cnt); + tempMsg.writeInt(cnt); tempMsg.writeStorage(tempContent); } break; case LANE_ALLOWED: { tempMsg.writeUnsignedByte(TYPE_STRINGLIST); - SVCPermissions permissions = lane->getPermissions(); - if (permissions == SVCAll) { // special case: write nothing - permissions = 0; - } - tempMsg.writeStringList(getVehicleClassNamesList(permissions)); + tempMsg.writeStringList(TraCI_Lane::getAllowed(id)); } + break; case LANE_DISALLOWED: { tempMsg.writeUnsignedByte(TYPE_STRINGLIST); - tempMsg.writeStringList(getVehicleClassNamesList(~(lane->getPermissions()))); // negation yields disallowed + tempMsg.writeStringList(TraCI_Lane::getDisallowed(id)); } break; - case VAR_SHAPE: + case VAR_SHAPE: { tempMsg.writeUnsignedByte(TYPE_POLYGON); - tempMsg.writeUnsignedByte(MIN2(255, (int)lane->getShape().size())); - for (int iPoint = 0; iPoint < MIN2(255, (int)lane->getShape().size()); ++iPoint) { - tempMsg.writeDouble(lane->getShape()[iPoint].x()); - tempMsg.writeDouble(lane->getShape()[iPoint].y()); + TraCIPositionVector shp = TraCI_Lane::getShape(id); + tempMsg.writeUnsignedByte(MIN2(255, (int) shp.size())); + for (int iPoint = 0; iPoint < MIN2(255, (int) shp.size()); ++iPoint) { + tempMsg.writeDouble(shp[iPoint].x); + tempMsg.writeDouble(shp[iPoint].y); } - break; + } + break; case VAR_CO2EMISSION: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(lane->getCO2Emissions()); + tempMsg.writeDouble(TraCI_Lane::getCO2Emission(id)); break; case VAR_COEMISSION: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(lane->getCOEmissions()); + tempMsg.writeDouble(TraCI_Lane::getCOEmission(id)); break; case VAR_HCEMISSION: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(lane->getHCEmissions()); + tempMsg.writeDouble(TraCI_Lane::getHCEmission(id)); break; case VAR_PMXEMISSION: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(lane->getPMxEmissions()); + tempMsg.writeDouble(TraCI_Lane::getPMxEmission(id)); break; case VAR_NOXEMISSION: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(lane->getNOxEmissions()); + tempMsg.writeDouble(TraCI_Lane::getNOxEmission(id)); break; case VAR_FUELCONSUMPTION: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(lane->getFuelConsumption()); + tempMsg.writeDouble(TraCI_Lane::getFuelConsumption(id)); break; case VAR_NOISEEMISSION: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(lane->getHarmonoise_NoiseEmissions()); + tempMsg.writeDouble(TraCI_Lane::getNoiseEmission(id)); break; case VAR_ELECTRICITYCONSUMPTION: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(lane->getElectricityConsumption()); + tempMsg.writeDouble(TraCI_Lane::getElectricityConsumption(id)); break; case LAST_STEP_VEHICLE_NUMBER: tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt((int) lane->getVehicleNumber()); + tempMsg.writeInt(TraCI_Lane::getLastStepVehicleNumber(id)); break; case LAST_STEP_MEAN_SPEED: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(lane->getMeanSpeed()); + tempMsg.writeDouble(TraCI_Lane::getLastStepMeanSpeed(id)); break; case LAST_STEP_VEHICLE_ID_LIST: { - std::vector vehIDs; - const MSLane::VehCont& vehs = lane->getVehiclesSecure(); - for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) { - vehIDs.push_back((*j)->getID()); - } - lane->releaseVehicles(); tempMsg.writeUnsignedByte(TYPE_STRINGLIST); - tempMsg.writeStringList(vehIDs); + tempMsg.writeStringList(TraCI_Lane::getLastStepVehicleIDs(id)); } break; case LAST_STEP_OCCUPANCY: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(lane->getNettoOccupancy()); + tempMsg.writeDouble(TraCI_Lane::getLastStepOccupancy(id)); break; case LAST_STEP_VEHICLE_HALTING_NUMBER: { - int halting = 0; - const MSLane::VehCont& vehs = lane->getVehiclesSecure(); - for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) { - if ((*j)->getSpeed() < SUMO_const_haltingSpeed) { - ++halting; - } - } - lane->releaseVehicles(); tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt(halting); + tempMsg.writeInt(TraCI_Lane::getLastStepHaltingNumber(id)); } break; case LAST_STEP_LENGTH: { - SUMOReal lengthSum = 0; - const MSLane::VehCont& vehs = lane->getVehiclesSecure(); - for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) { - lengthSum += (*j)->getVehicleType().getLength(); - } tempMsg.writeUnsignedByte(TYPE_DOUBLE); - if (vehs.size() == 0) { - tempMsg.writeDouble(0); - } else { - tempMsg.writeDouble(lengthSum / (SUMOReal) vehs.size()); - } - lane->releaseVehicles(); + tempMsg.writeDouble(TraCI_Lane::getLastStepLength(id)); } break; case VAR_WAITING_TIME: { tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(lane->getWaitingSeconds()); + tempMsg.writeDouble(TraCI_Lane::getWaitingTime(id)); } break; case VAR_CURRENT_TRAVELTIME: { - SUMOReal meanSpeed = lane->getMeanSpeed(); tempMsg.writeUnsignedByte(TYPE_DOUBLE); - if (meanSpeed != 0) { - tempMsg.writeDouble(lane->getLength() / meanSpeed); - } else { - tempMsg.writeDouble(1000000.); - } + tempMsg.writeDouble(TraCI_Lane::getTraveltime(id)); } break; case VAR_WIDTH: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(lane->getWidth()); + tempMsg.writeDouble(TraCI_Lane::getWidth(id)); break; case VAR_PARAMETER: { std::string paramName = ""; @@ -292,7 +248,7 @@ return server.writeErrorStatusCmd(RESPONSE_GET_LANE_VARIABLE, "Retrieval of a parameter requires its name.", outputStorage); } tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(lane->getParameter(paramName, "")); + tempMsg.writeString(TraCI_Lane::getParameter(id, paramName)); } break; default: @@ -328,7 +284,7 @@ if (!server.readTypeCheckingDouble(inputStorage, value)) { return server.writeErrorStatusCmd(CMD_SET_LANE_VARIABLE, "The speed must be given as a double.", outputStorage); } - l->setMaxSpeed(value); + TraCI_Lane::setMaxSpeed(id, value); } break; case VAR_LENGTH: { @@ -336,7 +292,7 @@ if (!server.readTypeCheckingDouble(inputStorage, value)) { return server.writeErrorStatusCmd(CMD_SET_LANE_VARIABLE, "The length must be given as a double.", outputStorage); } - l->setLength(value); + TraCI_Lane::setLength(id, value); } break; case LANE_ALLOWED: { @@ -344,8 +300,7 @@ if (!server.readTypeCheckingStringList(inputStorage, classes)) { return server.writeErrorStatusCmd(CMD_SET_LANE_VARIABLE, "Allowed classes must be given as a list of strings.", outputStorage); } - l->setPermissions(parseVehicleClasses(classes), MSLane::CHANGE_PERMISSIONS_PERMANENT); - l->getEdge().rebuildAllowedLanes(); + TraCI_Lane::setAllowed(id, classes); } break; case LANE_DISALLOWED: { @@ -353,8 +308,7 @@ if (!server.readTypeCheckingStringList(inputStorage, classes)) { return server.writeErrorStatusCmd(CMD_SET_LANE_VARIABLE, "Not allowed classes must be given as a list of strings.", outputStorage); } - l->setPermissions(~parseVehicleClasses(classes), MSLane::CHANGE_PERMISSIONS_PERMANENT); // negation yields allowed - l->getEdge().rebuildAllowedLanes(); + TraCI_Lane::setDisallowed(id, classes); } break; case VAR_PARAMETER: { @@ -371,7 +325,7 @@ if (!server.readTypeCheckingString(inputStorage, value)) { return server.writeErrorStatusCmd(CMD_SET_LANE_VARIABLE, "The value of the parameter must be given as a string.", outputStorage); } - l->addParameter(name, value); + TraCI_Lane::setParameter(id, name, value); } break; default: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Lane.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Lane.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Lane.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Lane.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_Lane.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: TraCIServerAPI_Lane.h 23150 2017-02-27 12:08:30Z behrisch $ /// // APIs for getting/setting lane values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -88,7 +88,7 @@ public: /// @brief Constructor StoringVisitor(std::set& ids, const PositionVector& shape, - const SUMOReal range, const int domain) + const double range, const int domain) : myIDs(ids), myShape(shape), myRange(range), myDomain(domain) {} /// @brief Destructor @@ -100,7 +100,7 @@ /// @brief The container std::set& myIDs; const PositionVector& myShape; - const SUMOReal myRange; + const double myRange; const int myDomain; private: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_MeMeDetector.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_MeMeDetector.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_MeMeDetector.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_MeMeDetector.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,113 +0,0 @@ -/****************************************************************************/ -/// @file TraCIServerAPI_MeMeDetector.cpp -/// @author Daniel Krajzewicz -/// @author Michael Behrisch -/// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_MeMeDetector.cpp 20482 2016-04-18 20:49:42Z behrisch $ -/// -// APIs for getting/setting multi-entry/multi-exit detector values via TraCI -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ - - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#ifndef NO_TRACI - -#include "TraCIConstants.h" -#include -#include "TraCIServerAPI_MeMeDetector.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - - -// =========================================================================== -// method definitions -// =========================================================================== -bool -TraCIServerAPI_MeMeDetector::processGet(TraCIServer& server, tcpip::Storage& inputStorage, - tcpip::Storage& outputStorage) { - // variable & id - int variable = inputStorage.readUnsignedByte(); - std::string id = inputStorage.readString(); - // check variable - if (variable != ID_LIST && variable != LAST_STEP_VEHICLE_NUMBER && variable != LAST_STEP_MEAN_SPEED - && variable != LAST_STEP_VEHICLE_ID_LIST && variable != LAST_STEP_VEHICLE_HALTING_NUMBER - && variable != ID_COUNT) { - return server.writeErrorStatusCmd(CMD_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE, "Get MeMeDetector Variable: unsupported variable " + toHex(variable, 2) + " specified", outputStorage); - } - // begin response building - tcpip::Storage tempMsg; - // response-code, variableID, objectID - tempMsg.writeUnsignedByte(RESPONSE_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE); - tempMsg.writeUnsignedByte(variable); - tempMsg.writeString(id); - if (variable == ID_LIST) { - std::vector ids; - MSNet::getInstance()->getDetectorControl().getTypedDetectors(SUMO_TAG_ENTRY_EXIT_DETECTOR).insertIDs(ids); - tempMsg.writeUnsignedByte(TYPE_STRINGLIST); - tempMsg.writeStringList(ids); - } else if (variable == ID_COUNT) { - std::vector ids; - MSNet::getInstance()->getDetectorControl().getTypedDetectors(SUMO_TAG_ENTRY_EXIT_DETECTOR).insertIDs(ids); - tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt((int) ids.size()); - } else { - MSE3Collector* e3 = static_cast(MSNet::getInstance()->getDetectorControl().getTypedDetectors(SUMO_TAG_ENTRY_EXIT_DETECTOR).get(id)); - if (e3 == 0) { - return server.writeErrorStatusCmd(CMD_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE, "Areal detector '" + id + "' is not known", outputStorage); - } - switch (variable) { - case ID_LIST: - break; - case LAST_STEP_VEHICLE_NUMBER: - tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt(e3->getVehiclesWithin()); - break; - case LAST_STEP_MEAN_SPEED: - tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(e3->getCurrentMeanSpeed()); - break; - case LAST_STEP_VEHICLE_ID_LIST: { - tempMsg.writeUnsignedByte(TYPE_STRINGLIST); - std::vector ids = e3->getCurrentVehicleIDs(); - tempMsg.writeStringList(ids); - } - break; - case LAST_STEP_VEHICLE_HALTING_NUMBER: - tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt(e3->getCurrentHaltingNumber()); - break; - default: - break; - } - } - server.writeStatusCmd(CMD_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE, RTYPE_OK, "", outputStorage); - server.writeResponseWithLength(outputStorage, tempMsg); - return true; -} - -#endif - - -/****************************************************************************/ - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_MeMeDetector.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_MeMeDetector.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_MeMeDetector.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_MeMeDetector.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,76 +0,0 @@ -/****************************************************************************/ -/// @file TraCIServerAPI_MeMeDetector.h -/// @author Daniel Krajzewicz -/// @author Michael Behrisch -/// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_MeMeDetector.h 20433 2016-04-13 08:00:14Z behrisch $ -/// -// APIs for getting/setting multi-entry/multi-exit detector values via TraCI -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ -#ifndef TraCIServerAPI_MeMeDetector_h -#define TraCIServerAPI_MeMeDetector_h - - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#ifndef NO_TRACI - -#include "TraCIException.h" -#include "TraCIServer.h" -#include - - -// =========================================================================== -// class definitions -// =========================================================================== -/** - * @class TraCIServerAPI_MeMeDetector - * @brief APIs for getting/setting multi-entry/multi-exit detector values via TraCI - */ -class TraCIServerAPI_MeMeDetector { -public: - /** @brief Processes a get value command (Command 0xa1: Get MeMeDetector Variable) - * - * @param[in] server The TraCI-server-instance which schedules this request - * @param[in] inputStorage The storage to read the command from - * @param[out] outputStorage The storage to write the result to - */ - static bool processGet(TraCIServer& server, tcpip::Storage& inputStorage, - tcpip::Storage& outputStorage); - - -private: - /// @brief invalidated copy constructor - TraCIServerAPI_MeMeDetector(const TraCIServerAPI_MeMeDetector& s); - - /// @brief invalidated assignment operator - TraCIServerAPI_MeMeDetector& operator=(const TraCIServerAPI_MeMeDetector& s); - - -}; - - -#endif - -#endif - -/****************************************************************************/ - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_MultiEntryExit.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_MultiEntryExit.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_MultiEntryExit.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_MultiEntryExit.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,102 @@ +/****************************************************************************/ +/// @file TraCIServerAPI_MultiEntryExit.cpp +/// @author Daniel Krajzewicz +/// @author Michael Behrisch +/// @date 07.05.2009 +/// @version $Id: TraCIServerAPI_MultiEntryExit.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +// APIs for getting/setting multi-entry/multi-exit detector values via TraCI +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#ifndef NO_TRACI + +#include "TraCIConstants.h" +#include +#include "lib/TraCI_MultiEntryExit.h" +#include "TraCIServerAPI_MultiEntryExit.h" + + +// =========================================================================== +// method definitions +// =========================================================================== +bool +TraCIServerAPI_MultiEntryExit::processGet(TraCIServer& server, tcpip::Storage& inputStorage, + tcpip::Storage& outputStorage) { + // variable & id + int variable = inputStorage.readUnsignedByte(); + std::string id = inputStorage.readString(); + // check variable + if (variable != ID_LIST && variable != LAST_STEP_VEHICLE_NUMBER && variable != LAST_STEP_MEAN_SPEED + && variable != LAST_STEP_VEHICLE_ID_LIST && variable != LAST_STEP_VEHICLE_HALTING_NUMBER + && variable != ID_COUNT) { + return server.writeErrorStatusCmd(CMD_GET_MULTIENTRYEXIT_VARIABLE, "Get MeMeDetector Variable: unsupported variable " + toHex(variable, 2) + " specified", outputStorage); + } + // begin response building + tcpip::Storage tempMsg; + // response-code, variableID, objectID + tempMsg.writeUnsignedByte(RESPONSE_GET_MULTIENTRYEXIT_VARIABLE); + tempMsg.writeUnsignedByte(variable); + tempMsg.writeString(id); + try { + switch (variable) { + case ID_LIST: + tempMsg.writeUnsignedByte(TYPE_STRINGLIST); + tempMsg.writeStringList(TraCI_MultiEntryExit::getIDList()); + break; + case ID_COUNT: + tempMsg.writeUnsignedByte(TYPE_INTEGER); + tempMsg.writeInt(TraCI_MultiEntryExit::getIDCount()); + break; + case LAST_STEP_VEHICLE_NUMBER: + tempMsg.writeUnsignedByte(TYPE_INTEGER); + tempMsg.writeInt(TraCI_MultiEntryExit::getLastStepVehicleNumber(id)); + break; + case LAST_STEP_MEAN_SPEED: + tempMsg.writeUnsignedByte(TYPE_DOUBLE); + tempMsg.writeDouble(TraCI_MultiEntryExit::getLastStepMeanSpeed(id)); + break; + case LAST_STEP_VEHICLE_ID_LIST: + tempMsg.writeUnsignedByte(TYPE_STRINGLIST); + tempMsg.writeStringList(TraCI_MultiEntryExit::getLastStepVehicleIDs(id)); + break; + case LAST_STEP_VEHICLE_HALTING_NUMBER: + tempMsg.writeUnsignedByte(TYPE_INTEGER); + tempMsg.writeInt(TraCI_MultiEntryExit::getLastStepHaltingNumber(id)); + break; + default: + break; + } + } catch (TraCIException& e) { + return server.writeErrorStatusCmd(CMD_GET_MULTIENTRYEXIT_VARIABLE, e.what(), outputStorage); + } + server.writeStatusCmd(CMD_GET_MULTIENTRYEXIT_VARIABLE, RTYPE_OK, "", outputStorage); + server.writeResponseWithLength(outputStorage, tempMsg); + return true; +} + +#endif + + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_MultiEntryExit.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_MultiEntryExit.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_MultiEntryExit.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_MultiEntryExit.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,76 @@ +/****************************************************************************/ +/// @file TraCIServerAPI_MultiEntryExit.h +/// @author Daniel Krajzewicz +/// @author Michael Behrisch +/// @date 07.05.2009 +/// @version $Id: TraCIServerAPI_MultiEntryExit.h 24028 2017-04-24 05:10:18Z behrisch $ +/// +// APIs for getting/setting multi-entry/multi-exit detector values via TraCI +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef TraCIServerAPI_MultiEntryExit_h +#define TraCIServerAPI_MultiEntryExit_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#ifndef NO_TRACI + +#include "TraCIDefs.h" +#include "TraCIServer.h" +#include + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class TraCIServerAPI_MultiEntryExit + * @brief APIs for getting/setting multi-entry/multi-exit detector values via TraCI + */ +class TraCIServerAPI_MultiEntryExit { +public: + /** @brief Processes a get value command (Command 0xa1: Get MeMeDetector Variable) + * + * @param[in] server The TraCI-server-instance which schedules this request + * @param[in] inputStorage The storage to read the command from + * @param[out] outputStorage The storage to write the result to + */ + static bool processGet(TraCIServer& server, tcpip::Storage& inputStorage, + tcpip::Storage& outputStorage); + + +private: + /// @brief invalidated copy constructor + TraCIServerAPI_MultiEntryExit(const TraCIServerAPI_MultiEntryExit& s); + + /// @brief invalidated assignment operator + TraCIServerAPI_MultiEntryExit& operator=(const TraCIServerAPI_MultiEntryExit& s); + + +}; + + +#endif + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Person.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Person.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Person.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Person.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file TraCIServerAPI_Person.cpp /// @author Daniel Krajzewicz /// @date 26.05.2014 -/// @version $Id: TraCIServerAPI_Person.cpp 20768 2016-05-20 08:38:44Z behrisch $ +/// @version $Id: TraCIServerAPI_Person.cpp 23840 2017-04-06 08:45:47Z namdre $ /// // APIs for getting/setting person values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -30,6 +30,7 @@ #ifndef NO_TRACI +#include #include #include #include @@ -39,10 +40,6 @@ #include "TraCIServerAPI_Person.h" #include "TraCIServerAPI_VehicleType.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -61,6 +58,10 @@ && variable != VAR_TYPE && variable != VAR_SHAPECLASS && variable != VAR_COLOR && variable != VAR_WAITING_TIME && variable != VAR_PARAMETER && variable != VAR_NEXT_EDGE + && variable != VAR_EDGES + && variable != VAR_STAGE + && variable != VAR_STAGES_REMAINING + && variable != VAR_VEHICLE ) { return server.writeErrorStatusCmd(CMD_GET_PERSON_VARIABLE, "Get Person Variable: unsupported variable " + toHex(variable, 2) + " specified", outputStorage); } @@ -138,6 +139,50 @@ tempMsg.writeUnsignedByte(TYPE_STRING); tempMsg.writeString(dynamic_cast(p)->getNextEdge()); break; + case VAR_EDGES: { + int nextStageIndex = 0; + if (!server.readTypeCheckingInt(inputStorage, nextStageIndex)) { + return server.writeErrorStatusCmd(CMD_GET_PERSON_VARIABLE, "The message must contain the stage index.", outputStorage); + } + if (nextStageIndex >= p->getNumRemainingStages()) { + return server.writeErrorStatusCmd(CMD_GET_PERSON_VARIABLE, "The stage index must be lower than the number of remaining stages.", outputStorage); + } + if (nextStageIndex < (p->getNumRemainingStages() - p->getNumStages())) { + return server.writeErrorStatusCmd(CMD_GET_PERSON_VARIABLE, "The negative stage index must refer to a valid previous stage.", outputStorage); + } + ConstMSEdgeVector edges = p->getEdges(nextStageIndex); + tempMsg.writeUnsignedByte(TYPE_STRINGLIST); + tempMsg.writeInt((int)edges.size()); + for (ConstMSEdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) { + tempMsg.writeString((*i)->getID()); + } + break; + } + case VAR_STAGE: { + int nextStageIndex = 0; + if (!server.readTypeCheckingInt(inputStorage, nextStageIndex)) { + return server.writeErrorStatusCmd(CMD_GET_PERSON_VARIABLE, "The message must contain the stage index.", outputStorage); + } + if (nextStageIndex >= p->getNumRemainingStages()) { + return server.writeErrorStatusCmd(CMD_GET_PERSON_VARIABLE, "The stage index must be lower than the number of remaining stages.", outputStorage); + } + if (nextStageIndex < (p->getNumRemainingStages() - p->getNumStages())) { + return server.writeErrorStatusCmd(CMD_GET_PERSON_VARIABLE, "The negative stage index must refer to a valid previous stage.", outputStorage); + } + tempMsg.writeUnsignedByte(TYPE_INTEGER); + tempMsg.writeInt(p->getStageType(nextStageIndex)); + break; + } + case VAR_STAGES_REMAINING: + tempMsg.writeUnsignedByte(TYPE_INTEGER); + tempMsg.writeInt(p->getNumRemainingStages()); + break; + case VAR_VEHICLE: { + const SUMOVehicle* veh = p->getVehicle(); + tempMsg.writeUnsignedByte(TYPE_STRING); + tempMsg.writeString(veh == 0 ? "" : veh->getID()); + break; + } case VAR_PARAMETER: { std::string paramName = ""; if (!server.readTypeCheckingString(inputStorage, paramName)) { @@ -147,7 +192,7 @@ tempMsg.writeString(p->getParameter().getParameter(paramName, "")); } default: - TraCIServerAPI_VehicleType::getVariable(variable, p->getVehicleType(), tempMsg); + TraCIServerAPI_VehicleType::getVariable(variable, p->getVehicleType().getID(), tempMsg); break; } } @@ -164,18 +209,270 @@ // variable int variable = inputStorage.readUnsignedByte(); if (variable != VAR_PARAMETER + && variable != ADD + && variable != APPEND_STAGE + && variable != REMOVE_STAGE + && variable != VAR_SPEED + && variable != VAR_TYPE + && variable != VAR_LENGTH + && variable != VAR_WIDTH + && variable != VAR_HEIGHT + && variable != VAR_MINGAP + && variable != VAR_COLOR ) { return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Change Person State: unsupported variable " + toHex(variable, 2) + " specified", outputStorage); } // id MSTransportableControl& c = MSNet::getInstance()->getPersonControl(); std::string id = inputStorage.readString(); + const bool shouldExist = variable != ADD; MSTransportable* p = c.get(id); - if (p == 0) { + if (p == 0 && shouldExist) { return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Person '" + id + "' is not known", outputStorage); } // process switch (variable) { + case VAR_SPEED: { + double speed = 0; + if (!server.readTypeCheckingDouble(inputStorage, speed)) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Setting speed requires a double.", outputStorage); + } + // set the speed for all (walking) stages + p->setSpeed(speed); + // modify the vType so that stages added later are also affected + TraCIServerAPI_VehicleType::setVariable(CMD_SET_VEHICLE_VARIABLE, variable, getSingularType(p).getID(), server, inputStorage, outputStorage); + } + break; + case VAR_TYPE: { + std::string vTypeID; + if (!server.readTypeCheckingString(inputStorage, vTypeID)) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "The vehicle type id must be given as a string.", outputStorage); + } + MSVehicleType* vehicleType = MSNet::getInstance()->getVehicleControl().getVType(vTypeID); + if (vehicleType == 0) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The vehicle type '" + vTypeID + "' is not known.", outputStorage); + } + p->replaceVehicleType(vehicleType); + break; + } + case ADD: { + if (p != 0) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "The person " + id + " to add already exists.", outputStorage); + } + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Adding a person requires a compound object.", outputStorage); + } + if (inputStorage.readInt() != 4) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Adding a person needs four parameters.", outputStorage); + } + SUMOVehicleParameter vehicleParams; + vehicleParams.id = id; + + std::string vTypeID; + if (!server.readTypeCheckingString(inputStorage, vTypeID)) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "First parameter (type) requires a string.", outputStorage); + } + MSVehicleType* vehicleType = MSNet::getInstance()->getVehicleControl().getVType(vTypeID); + if (!vehicleType) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Invalid type '" + vTypeID + "' for person '" + id + "'", outputStorage); + } + + std::string edgeID; + if (!server.readTypeCheckingString(inputStorage, edgeID)) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Second parameter (edge) requires a string.", outputStorage); + } + const MSEdge* edge = MSEdge::dictionary(edgeID); + if (!edge) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Invalid edge '" + edgeID + "' for person: '" + id + "'", outputStorage); + } + int depart; + if (!server.readTypeCheckingInt(inputStorage, depart)) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Third parameter (depart) requires an integer.", outputStorage); + } + if (depart < 0) { + const int proc = -depart; + if (proc >= static_cast(DEPART_DEF_MAX)) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Invalid departure time.", outputStorage); + } + vehicleParams.departProcedure = (DepartDefinition)proc; + vehicleParams.depart = MSNet::getInstance()->getCurrentTimeStep(); + } else if (depart < MSNet::getInstance()->getCurrentTimeStep()) { + vehicleParams.depart = MSNet::getInstance()->getCurrentTimeStep(); + WRITE_WARNING("Departure time for person '" + id + "' is in the past; using current time instead."); + } else { + vehicleParams.depart = depart; + } + + double pos; + if (!server.readTypeCheckingDouble(inputStorage, pos)) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Fourth parameter (position) requires a double.", outputStorage); + } + vehicleParams.departPosProcedure = DEPART_POS_GIVEN; + if (fabs(pos) > edge->getLength()) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Invalid departure position.", outputStorage); + } + if (pos < 0) { + pos += edge->getLength(); + } + vehicleParams.departPos = pos; + + SUMOVehicleParameter* params = new SUMOVehicleParameter(vehicleParams); + MSTransportable::MSTransportablePlan* plan = new MSTransportable::MSTransportablePlan(); + plan->push_back(new MSTransportable::Stage_Waiting(*edge, 0, depart, pos, "awaiting departure", true)); + + try { + MSTransportable* person = MSNet::getInstance()->getPersonControl().buildPerson(params, vehicleType, plan); + MSNet::getInstance()->getPersonControl().add(person); + } catch (ProcessError& e) { + delete params; + delete plan; + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, e.what(), outputStorage); + } + } + break; + case APPEND_STAGE: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Adding a person stage requires a compound object.", outputStorage); + } + int numParameters = inputStorage.readInt(); + int stageType; + if (!server.readTypeCheckingInt(inputStorage, stageType)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The first parameter for adding a stage must be the stage type given as int.", outputStorage); + } + // append driving stage + if (stageType == MSTransportable::DRIVING) { + if (numParameters != 4) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Adding a driving stage needs four parameters.", outputStorage); + } + std::string edgeID; + if (!server.readTypeCheckingString(inputStorage, edgeID)) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Second parameter (edge) requires a string.", outputStorage); + } + const MSEdge* edge = MSEdge::dictionary(edgeID); + if (!edge) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Invalid edge '" + edgeID + "' for person: '" + id + "'", outputStorage); + } + std::string lines; + if (!server.readTypeCheckingString(inputStorage, lines)) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Third parameter (lines) requires a string.", outputStorage); + } + if (lines.size() == 0) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Empty lines parameter for person: '" + id + "'", outputStorage); + } + std::string stopID; + MSStoppingPlace* bs = 0; + if (!server.readTypeCheckingString(inputStorage, stopID)) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Fourth parameter (stopID) requires a string.", outputStorage); + } + if (stopID != "") { + bs = MSNet::getInstance()->getBusStop(stopID); + if (bs == 0) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Invalid stopping place id '" + stopID + "' for person: '" + id + "'", outputStorage); + } + } + p->appendStage(new MSPerson::MSPersonStage_Driving(*edge, bs, -NUMERICAL_EPS, StringTokenizer(lines).getVector())); + + // append waiting stage + } else if (stageType == MSTransportable::WAITING) { + if (numParameters != 4) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Adding a waiting stage needs four parameters.", outputStorage); + } + int duration; + if (!server.readTypeCheckingInt(inputStorage, duration)) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Second parameter (duration) requires an int.", outputStorage); + } + if (duration < 0) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Duration for person: '" + id + "' must not be negative", outputStorage); + } + std::string description; + if (!server.readTypeCheckingString(inputStorage, description)) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Third parameter (description) requires a string.", outputStorage); + } + std::string stopID; + MSStoppingPlace* bs = 0; + if (!server.readTypeCheckingString(inputStorage, stopID)) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Fourth parameter (stopID) requires a string.", outputStorage); + } + if (stopID != "") { + bs = MSNet::getInstance()->getBusStop(stopID); + if (bs == 0) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Invalid stopping place id '" + stopID + "' for person: '" + id + "'", outputStorage); + } + } + p->appendStage(new MSTransportable::Stage_Waiting(*p->getArrivalEdge(), duration, 0, p->getArrivalPos(), description, false)); + + // append walking stage + } else if (stageType == MSTransportable::MOVING_WITHOUT_VEHICLE) { + if (numParameters != 6) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Adding a walking stage needs six parameters.", outputStorage); + } + std::vector edgeIDs; + if (!server.readTypeCheckingStringList(inputStorage, edgeIDs)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Second parameter (edges) route must be defined as a list of edge ids.", outputStorage); + } + ConstMSEdgeVector edges; + try { + MSEdge::parseEdgesList(edgeIDs, edges, ""); + } catch (ProcessError& e) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, e.what(), outputStorage); + } + if (edges.empty()) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Empty edge list for walking stage of person '" + id + "'.", outputStorage); + } + double arrivalPos; + if (!server.readTypeCheckingDouble(inputStorage, arrivalPos)) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Third parameter (arrivalPos) requires a double.", outputStorage); + } + if (fabs(arrivalPos) > edges.back()->getLength()) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Invalid arrivalPos for walking stage of person '" + id + "'.", outputStorage); + } + if (arrivalPos < 0) { + arrivalPos += edges.back()->getLength(); + } + int duration; + if (!server.readTypeCheckingInt(inputStorage, duration)) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Fourth parameter (duration) requires an int.", outputStorage); + } + double speed; + if (!server.readTypeCheckingDouble(inputStorage, speed)) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Fifth parameter (speed) requires a double.", outputStorage); + } + if (speed < 0) { + speed = p->getVehicleType().getMaxSpeed(); + } + std::string stopID; + MSStoppingPlace* bs = 0; + if (!server.readTypeCheckingString(inputStorage, stopID)) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Fourth parameter (stopID) requires a string.", outputStorage); + } + if (stopID != "") { + bs = MSNet::getInstance()->getBusStop(stopID); + if (bs == 0) { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Invalid stopping place id '" + stopID + "' for person: '" + id + "'", outputStorage); + } + } + p->appendStage(new MSPerson::MSPersonStage_Walking(edges, bs, duration, speed, p->getArrivalPos(), arrivalPos, 0)); + + + } else { + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "Invalid stage type for person '" + id + "'", outputStorage); + } + } + break; + case REMOVE_STAGE: { + int nextStageIndex = 0; + if (!server.readTypeCheckingInt(inputStorage, nextStageIndex)) { + return server.writeErrorStatusCmd(CMD_GET_PERSON_VARIABLE, "The message must contain the stage index.", outputStorage); + } + if (nextStageIndex >= p->getNumRemainingStages()) { + return server.writeErrorStatusCmd(CMD_GET_PERSON_VARIABLE, "The stage index must be lower than the number of remaining stages.", outputStorage); + } + if (nextStageIndex < 0) { + return server.writeErrorStatusCmd(CMD_GET_PERSON_VARIABLE, "The stage index may not be negative.", outputStorage); + } + p->removeStage(nextStageIndex); + } + break; case VAR_PARAMETER: { if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, "A compound object is needed for setting a parameter.", outputStorage); @@ -194,15 +491,13 @@ } break; default: - /* try { - if (!TraCIServerAPI_VehicleType::setVariable(CMD_SET_PERSON_VARIABLE, variable, getSingularType(v), server, inputStorage, outputStorage)) { + if (!TraCIServerAPI_VehicleType::setVariable(CMD_SET_PERSON_VARIABLE, variable, getSingularType(p).getID(), server, inputStorage, outputStorage)) { return false; } } catch (ProcessError& e) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, e.what(), outputStorage); + return server.writeErrorStatusCmd(CMD_SET_PERSON_VARIABLE, e.what(), outputStorage); } - */ break; } server.writeStatusCmd(CMD_SET_PERSON_VARIABLE, RTYPE_OK, warning, outputStorage); @@ -221,16 +516,14 @@ } -/* MSVehicleType& -TraCIServerAPI_Person::getSingularType(MSPerson* const person) { - const MSVehicleType& oType = person->getVehicleType(); - std::string newID = oType.getID().find('@') == std::string::npos ? oType.getID() + "@" + person->getID() : oType.getID(); - MSVehicleType* type = MSVehicleType::build(newID, &oType); - person->replaceVehicleType(type); +TraCIServerAPI_Person::getSingularType(MSTransportable* const t) { + const MSVehicleType& oType = t->getVehicleType(); + std::string newID = oType.getID().find('@') == std::string::npos ? oType.getID() + "@" + t->getID() : oType.getID(); + MSVehicleType* type = MSVehicleType::buildSingularType(newID, &oType); + t->replaceVehicleType(type); return *type; } -*/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Person.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Person.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Person.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Person.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file TraCIServerAPI_Person.h /// @author Daniel Krajzewicz /// @date 26.05.2014 -/// @version $Id: TraCIServerAPI_Person.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: TraCIServerAPI_Person.h 22715 2017-01-26 14:55:39Z namdre $ /// // APIs for getting/setting person values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -78,7 +78,7 @@ static bool getPosition(const std::string& id, Position& p); private: - //static MSVehicleType& getSingularType(MSPerson* const person); + static MSVehicleType& getSingularType(MSTransportable* const t); private: /// @brief invalidated copy constructor diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_POI.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_POI.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_POI.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_POI.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,14 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @author Jakob Erdmann +/// @author Robert Hilbrich /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_POI.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: TraCIServerAPI_POI.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // APIs for getting/setting POI values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 20019-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2017-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,25 +38,27 @@ #include #include #include "TraCIConstants.h" +#include "lib/TraCI_POI.h" #include "TraCIServerAPI_POI.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - - // =========================================================================== // method definitions // =========================================================================== bool TraCIServerAPI_POI::processGet(TraCIServer& server, tcpip::Storage& inputStorage, tcpip::Storage& outputStorage) { + // variable & id int variable = inputStorage.readUnsignedByte(); std::string id = inputStorage.readString(); // check variable - if (variable != ID_LIST && variable != VAR_TYPE && variable != VAR_COLOR && variable != VAR_POSITION && variable != ID_COUNT - && variable != VAR_PARAMETER) { + if (variable != ID_LIST && + variable != VAR_TYPE && + variable != VAR_COLOR && + variable != VAR_POSITION && + variable != VAR_POSITION3D && + variable != ID_COUNT && + variable != VAR_PARAMETER) { return server.writeErrorStatusCmd(CMD_GET_POI_VARIABLE, "Get PoI Variable: unsupported variable " + toHex(variable, 2) + " specified", outputStorage); } // begin response building @@ -65,38 +68,37 @@ tempMsg.writeUnsignedByte(variable); tempMsg.writeString(id); // process request - if (variable == ID_LIST || variable == ID_COUNT) { - std::vector ids; - ShapeContainer& shapeCont = MSNet::getInstance()->getShapeContainer(); - shapeCont.getPOIs().insertIDs(ids); - if (variable == ID_LIST) { - tempMsg.writeUnsignedByte(TYPE_STRINGLIST); - tempMsg.writeStringList(ids); - } else { - tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt((int) ids.size()); - } - } else { - PointOfInterest* p = getPoI(id); - if (p == 0) { - return server.writeErrorStatusCmd(CMD_GET_POI_VARIABLE, "POI '" + id + "' is not known", outputStorage); - } + try { switch (variable) { + case ID_LIST: + tempMsg.writeUnsignedByte(TYPE_STRINGLIST); + tempMsg.writeStringList(TraCI_POI::getIDList()); + break; + case ID_COUNT: + tempMsg.writeUnsignedByte(TYPE_INTEGER); + tempMsg.writeInt((int) TraCI_POI::getIDCount()); + break; case VAR_TYPE: tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(p->getType()); + tempMsg.writeString(TraCI_POI::getType(id)); break; case VAR_COLOR: tempMsg.writeUnsignedByte(TYPE_COLOR); - tempMsg.writeUnsignedByte(p->getColor().red()); - tempMsg.writeUnsignedByte(p->getColor().green()); - tempMsg.writeUnsignedByte(p->getColor().blue()); - tempMsg.writeUnsignedByte(p->getColor().alpha()); + tempMsg.writeUnsignedByte(TraCI_POI::getColor(id).r); + tempMsg.writeUnsignedByte(TraCI_POI::getColor(id).g); + tempMsg.writeUnsignedByte(TraCI_POI::getColor(id).b); + tempMsg.writeUnsignedByte(TraCI_POI::getColor(id).a); break; case VAR_POSITION: tempMsg.writeUnsignedByte(POSITION_2D); - tempMsg.writeDouble(p->x()); - tempMsg.writeDouble(p->y()); + tempMsg.writeDouble(TraCI_POI::getPosition(id).x); + tempMsg.writeDouble(TraCI_POI::getPosition(id).y); + break; + case VAR_POSITION3D: + tempMsg.writeUnsignedByte(POSITION_3D); + tempMsg.writeDouble(TraCI_POI::getPosition(id).x); + tempMsg.writeDouble(TraCI_POI::getPosition(id).y); + tempMsg.writeDouble(TraCI_POI::getPosition(id).z); break; case VAR_PARAMETER: { std::string paramName = ""; @@ -104,15 +106,19 @@ return server.writeErrorStatusCmd(CMD_GET_POI_VARIABLE, "Retrieval of a parameter requires its name.", outputStorage); } tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(p->getParameter(paramName, "")); + tempMsg.writeString(TraCI_POI::getParameter(id, paramName)); + break; } - break; default: break; } + } catch (TraCIException& e) { + return server.writeErrorStatusCmd(CMD_GET_POI_VARIABLE, e.what(), outputStorage); } + server.writeStatusCmd(CMD_GET_POI_VARIABLE, RTYPE_OK, "", outputStorage); server.writeResponseWithLength(outputStorage, tempMsg); + return true; } @@ -121,108 +127,105 @@ TraCIServerAPI_POI::processSet(TraCIServer& server, tcpip::Storage& inputStorage, tcpip::Storage& outputStorage) { std::string warning = ""; // additional description for response - // variable + // variable & id int variable = inputStorage.readUnsignedByte(); - if (variable != VAR_TYPE && variable != VAR_COLOR && variable != VAR_POSITION - && variable != ADD && variable != REMOVE && variable != VAR_PARAMETER) { - return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "Change PoI State: unsupported variable " + toHex(variable, 2) + " specified", outputStorage); - } - // id std::string id = inputStorage.readString(); - PointOfInterest* p = 0; - ShapeContainer& shapeCont = MSNet::getInstance()->getShapeContainer(); - if (variable != ADD && variable != REMOVE) { - p = getPoI(id); - if (p == 0) { - return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "POI '" + id + "' is not known", outputStorage); - } + // check variable + if (variable != VAR_TYPE && + variable != VAR_COLOR && + variable != VAR_POSITION && + variable != ADD && + variable != REMOVE && + variable != VAR_PARAMETER) { + return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "Change PoI State: unsupported variable " + toHex(variable, 2) + " specified", outputStorage); } // process - switch (variable) { - case VAR_TYPE: { - std::string type; - if (!server.readTypeCheckingString(inputStorage, type)) { - return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The type must be given as a string.", outputStorage); - } - p->setType(type); - } - break; - case VAR_COLOR: { - RGBColor col; - if (!server.readTypeCheckingColor(inputStorage, col)) { - return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The color must be given using an according type.", outputStorage); + try { + switch (variable) { + case VAR_TYPE: { + std::string type; + if (!server.readTypeCheckingString(inputStorage, type)) { + return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The type must be given as a string.", outputStorage); + } + TraCI_POI::setType(id, type); } - p->setColor(col); - } - break; - case VAR_POSITION: { - Position pos; - if (!server.readTypeCheckingPosition2D(inputStorage, pos)) { - return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The position must be given using an accoring type.", outputStorage); + break; + case VAR_COLOR: { + TraCIColor col; + if (!server.readTypeCheckingColor(inputStorage, col)) { + return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The color must be given using an according type.", outputStorage); + } + TraCI_POI::setColor(id, col); } - shapeCont.movePOI(id, pos); - } - break; - case ADD: { - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "A compound object is needed for setting a new PoI.", outputStorage); - } - //read itemNo - inputStorage.readInt(); - std::string type; - if (!server.readTypeCheckingString(inputStorage, type)) { - return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The first PoI parameter must be the type encoded as a string.", outputStorage); - } - RGBColor col; - if (!server.readTypeCheckingColor(inputStorage, col)) { - return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The second PoI parameter must be the color.", outputStorage); - } - int layer = 0; - if (!server.readTypeCheckingInt(inputStorage, layer)) { - return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The third PoI parameter must be the layer encoded as int.", outputStorage); - } - Position pos; - if (!server.readTypeCheckingPosition2D(inputStorage, pos)) { - return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The fourth PoI parameter must be the position.", outputStorage); - } - // - if (!shapeCont.addPOI(id, type, col, (SUMOReal)layer, - Shape::DEFAULT_ANGLE, Shape::DEFAULT_IMG_FILE, pos, - Shape::DEFAULT_IMG_WIDTH, Shape::DEFAULT_IMG_HEIGHT)) { - delete p; - return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "Could not add PoI.", outputStorage); + break; + case VAR_POSITION: { + TraCIPosition pos; + if (!server.readTypeCheckingPosition2D(inputStorage, pos)) { + return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The position must be given using an accoring type.", outputStorage); + } + TraCI_POI::setPosition(id, pos); } - } - break; - case REMOVE: { - int layer = 0; // !!! layer not used yet (shouldn't the id be enough?) - if (!server.readTypeCheckingInt(inputStorage, layer)) { - return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The layer must be given using an int.", outputStorage); + break; + case ADD: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "A compound object is needed for setting a new PoI.", outputStorage); + } + //read itemNo + inputStorage.readInt(); + std::string type; + if (!server.readTypeCheckingString(inputStorage, type)) { + return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The first PoI parameter must be the type encoded as a string.", outputStorage); + } + TraCIColor col; + if (!server.readTypeCheckingColor(inputStorage, col)) { + return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The second PoI parameter must be the color.", outputStorage); + } + int layer = 0; + if (!server.readTypeCheckingInt(inputStorage, layer)) { + return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The third PoI parameter must be the layer encoded as int.", outputStorage); + } + TraCIPosition pos; + if (!server.readTypeCheckingPosition2D(inputStorage, pos)) { + return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The fourth PoI parameter must be the position.", outputStorage); + } + // + if (!TraCI_POI::add(id, pos, col, type, layer)) { + return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "Could not add PoI.", outputStorage); + } } - if (!shapeCont.removePOI(id)) { - return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "Could not remove PoI '" + id + "'", outputStorage); + break; + case REMOVE: { + int layer = 0; // !!! layer not used yet (shouldn't the id be enough?) + if (!server.readTypeCheckingInt(inputStorage, layer)) { + return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The layer must be given using an int.", outputStorage); + } + if (!TraCI_POI::remove(id, layer)) { + return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "Could not remove PoI '" + id + "'", outputStorage); + } } - } - break; - case VAR_PARAMETER: { - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "A compound object is needed for setting a parameter.", outputStorage); - } - //readt itemNo - inputStorage.readInt(); - std::string name; - if (!server.readTypeCheckingString(inputStorage, name)) { - return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The name of the parameter must be given as a string.", outputStorage); - } - std::string value; - if (!server.readTypeCheckingString(inputStorage, value)) { - return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The value of the parameter must be given as a string.", outputStorage); + break; + case VAR_PARAMETER: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "A compound object is needed for setting a parameter.", outputStorage); + } + //readt itemNo + inputStorage.readInt(); + std::string name; + if (!server.readTypeCheckingString(inputStorage, name)) { + return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The name of the parameter must be given as a string.", outputStorage); + } + std::string value; + if (!server.readTypeCheckingString(inputStorage, value)) { + return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, "The value of the parameter must be given as a string.", outputStorage); + } + TraCI_POI::addParameter(id, name, value); } - p->addParameter(name, value); - } - break; - default: break; + default: + break; + } + } catch (TraCIException& e) { + return server.writeErrorStatusCmd(CMD_SET_POI_VARIABLE, e.what(), outputStorage); } server.writeStatusCmd(CMD_SET_POI_VARIABLE, RTYPE_OK, warning, outputStorage); return true; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_POI.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_POI.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_POI.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_POI.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_POI.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: TraCIServerAPI_POI.h 23410 2017-03-15 10:35:33Z namdre $ /// // APIs for getting/setting POI values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,7 +33,7 @@ #ifndef NO_TRACI -#include "TraCIException.h" +#include "TraCIDefs.h" #include "TraCIServer.h" #include diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Polygon.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Polygon.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Polygon.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Polygon.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,13 +5,14 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @author Christoph Sommer +/// @author Gregor L\"ammel /// @date Sept 2002 -/// @version $Id: TraCIServerAPI_Polygon.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: TraCIServerAPI_Polygon.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // APIs for getting/setting polygon values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,14 +39,11 @@ #include #include #include +#include +#include #include "TraCIConstants.h" #include "TraCIServerAPI_Polygon.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - - // =========================================================================== // method definitions // =========================================================================== @@ -58,7 +56,8 @@ // check variable if (variable != ID_LIST && variable != VAR_TYPE && variable != VAR_COLOR && variable != VAR_SHAPE && variable != VAR_FILL && variable != ID_COUNT && variable != VAR_PARAMETER) { - return server.writeErrorStatusCmd(CMD_GET_POLYGON_VARIABLE, "Get Polygon Variable: unsupported variable " + toHex(variable, 2) + " specified", outputStorage); + return server.writeErrorStatusCmd(CMD_GET_POLYGON_VARIABLE, + "Get Polygon Variable: unsupported variable " + toHex(variable, 2) + " specified", outputStorage); } // begin response building tcpip::Storage tempMsg; @@ -68,9 +67,7 @@ tempMsg.writeString(id); // process request if (variable == ID_LIST || variable == ID_COUNT) { - std::vector ids; - ShapeContainer& shapeCont = MSNet::getInstance()->getShapeContainer(); - shapeCont.getPolygons().insertIDs(ids); + std::vector ids = TraCI_Polygon::getIDList(); if (variable == ID_LIST) { tempMsg.writeUnsignedByte(TYPE_STRINGLIST); tempMsg.writeStringList(ids); @@ -79,45 +76,49 @@ tempMsg.writeInt((int) ids.size()); } } else { - SUMO::Polygon* p = getPolygon(id); - if (p == 0) { - return server.writeErrorStatusCmd(CMD_GET_POLYGON_VARIABLE, "Polygon '" + id + "' is not known", outputStorage); - } - switch (variable) { - case VAR_TYPE: - tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(p->getType()); + try { + switch (variable) { + case VAR_TYPE: { + tempMsg.writeUnsignedByte(TYPE_STRING); + tempMsg.writeString(TraCI_Polygon::getType(id)); + } break; - case VAR_COLOR: - tempMsg.writeUnsignedByte(TYPE_COLOR); - tempMsg.writeUnsignedByte(p->getColor().red()); - tempMsg.writeUnsignedByte(p->getColor().green()); - tempMsg.writeUnsignedByte(p->getColor().blue()); - tempMsg.writeUnsignedByte(p->getColor().alpha()); + case VAR_COLOR: { + TraCIColor tc = TraCI_Polygon::getColor(id); + tempMsg.writeUnsignedByte(TYPE_COLOR); + tempMsg.writeUnsignedByte(tc.r); + tempMsg.writeUnsignedByte(tc.g); + tempMsg.writeUnsignedByte(tc.b); + tempMsg.writeUnsignedByte(tc.a); + } break; - case VAR_SHAPE: - tempMsg.writeUnsignedByte(TYPE_POLYGON); - tempMsg.writeUnsignedByte(MIN2(255, (int)p->getShape().size())); - for (int iPoint = 0; iPoint < MIN2(255, (int)p->getShape().size()); ++iPoint) { - tempMsg.writeDouble(p->getShape()[iPoint].x()); - tempMsg.writeDouble(p->getShape()[iPoint].y()); + case VAR_SHAPE: { + tempMsg.writeUnsignedByte(TYPE_POLYGON); + TraCIPositionVector tp = TraCI_Polygon::getShape(id); + tempMsg.writeUnsignedByte((int) tp.size()); + for (int iPoint = 0; iPoint < (int)tp.size(); ++iPoint) { + tempMsg.writeDouble(tp[iPoint].x); + tempMsg.writeDouble(tp[iPoint].y); + } } break; - case VAR_FILL: - tempMsg.writeUnsignedByte(TYPE_UBYTE); - tempMsg.writeUnsignedByte(p->getFill() ? 1 : 0); + case VAR_FILL: { + tempMsg.writeUnsignedByte(TYPE_UBYTE); + tempMsg.writeUnsignedByte(TraCI_Polygon::getFilled(id) ? 1 : 0); + } break; - case VAR_PARAMETER: { - std::string paramName = ""; - if (!server.readTypeCheckingString(inputStorage, paramName)) { - return server.writeErrorStatusCmd(CMD_GET_POLYGON_VARIABLE, "Retrieval of a parameter requires its name.", outputStorage); + case VAR_PARAMETER: { + std::string paramName = ""; + if (!server.readTypeCheckingString(inputStorage, paramName)) { + return server.writeErrorStatusCmd(CMD_GET_POLYGON_VARIABLE, "Retrieval of a parameter requires its name.", outputStorage); + } + tempMsg.writeUnsignedByte(TYPE_STRING); + tempMsg.writeString(TraCI_Polygon::getParameter(id, paramName)); } - tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(p->getParameter(paramName, "")); - } - break; - default: break; + } + } catch (TraCIException& e) { + return server.writeErrorStatusCmd(CMD_GET_POLYGON_VARIABLE, e.what(), outputStorage); } } server.writeStatusCmd(CMD_GET_POLYGON_VARIABLE, RTYPE_OK, "", outputStorage); @@ -125,7 +126,6 @@ return true; } - bool TraCIServerAPI_Polygon::processSet(TraCIServer& server, tcpip::Storage& inputStorage, tcpip::Storage& outputStorage) { @@ -134,122 +134,117 @@ int variable = inputStorage.readUnsignedByte(); if (variable != VAR_TYPE && variable != VAR_COLOR && variable != VAR_SHAPE && variable != VAR_FILL && variable != ADD && variable != REMOVE && variable != VAR_PARAMETER) { - return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "Change Polygon State: unsupported variable " + toHex(variable, 2) + " specified", outputStorage); + return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, + "Change Polygon State: unsupported variable " + toHex(variable, 2) + " specified", outputStorage); } // id std::string id = inputStorage.readString(); - SUMO::Polygon* p = 0; - ShapeContainer& shapeCont = MSNet::getInstance()->getShapeContainer(); - if (variable != ADD && variable != REMOVE) { - p = getPolygon(id); - if (p == 0) { - return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "Polygon '" + id + "' is not known", outputStorage); - } - } - // process - switch (variable) { - case VAR_TYPE: { - std::string type; - if (!server.readTypeCheckingString(inputStorage, type)) { - return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The type must be given as a string.", outputStorage); - } - p->setType(type); - } - break; - case VAR_COLOR: { - RGBColor col; - if (!server.readTypeCheckingColor(inputStorage, col)) { - return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The color must be given using an according type.", outputStorage); - } - p->setColor(col); - } - break; - case VAR_SHAPE: { - PositionVector shape; - if (!server.readTypeCheckingPolygon(inputStorage, shape)) { - return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The shape must be given using an accoring type.", outputStorage); - } - shapeCont.reshapePolygon(id, shape); - } - break; - case VAR_FILL: { - int value = 0; - if (!server.readTypeCheckingUnsignedByte(inputStorage, value)) { - return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "'fill' must be defined using an unsigned byte.", outputStorage); - } - p->setFill(value != 0); - } - break; - case ADD: { - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "A compound object is needed for setting a new polygon.", outputStorage); - } - //readt itemNo - inputStorage.readInt(); - std::string type; - if (!server.readTypeCheckingString(inputStorage, type)) { - return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The type must be given as a string.", outputStorage); - } - RGBColor col; - if (!server.readTypeCheckingColor(inputStorage, col)) { - return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The second polygon parameter must be the color.", outputStorage); - } - int value = 0; - if (!server.readTypeCheckingUnsignedByte(inputStorage, value)) { - return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The third polygon parameter must be 'fill' encoded as ubyte.", outputStorage); - } - bool fill = value != 0; - int layer = 0; - if (!server.readTypeCheckingInt(inputStorage, layer)) { - return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The fourth polygon parameter must be the layer encoded as int.", outputStorage); - } - PositionVector shape; - if (!server.readTypeCheckingPolygon(inputStorage, shape)) { - return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The fifth polygon parameter must be the shape.", outputStorage); + try { + // process + switch (variable) { + case VAR_TYPE: { + std::string type; + if (!server.readTypeCheckingString(inputStorage, type)) { + return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The type must be given as a string.", outputStorage); + } + TraCI_Polygon::setType(id, type); } - // - if (!shapeCont.addPolygon(id, type, col, (SUMOReal)layer, - Shape::DEFAULT_ANGLE, Shape::DEFAULT_IMG_FILE, shape, fill)) { - delete p; - return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "Could not add polygon.", outputStorage); + break; + case VAR_COLOR: { + TraCIColor col; + if (!server.readTypeCheckingColor(inputStorage, col)) { + return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The color must be given using an according type.", outputStorage); + } + TraCI_Polygon::setColor(id, col); } - } - break; - case REMOVE: { - int layer = 0; // !!! layer not used yet (shouldn't the id be enough?) - if (!server.readTypeCheckingInt(inputStorage, layer)) { - return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The layer must be given using an int.", outputStorage); + break; + case VAR_SHAPE: { + PositionVector shape; + if (!server.readTypeCheckingPolygon(inputStorage, shape)) { + return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The shape must be given using an accoring type.", outputStorage); + } + TraCI_Polygon::setShape(id, TraCI::makeTraCIPositionVector(shape)); } - if (!shapeCont.removePolygon(id)) { - return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "Could not remove polygon '" + id + "'", outputStorage); + break; + case VAR_FILL: { + int value = 0; + if (!server.readTypeCheckingUnsignedByte(inputStorage, value)) { + return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "'fill' must be defined using an unsigned byte.", outputStorage); + } + TraCI_Polygon::setFilled(id, value != 0); } - } - break; - case VAR_PARAMETER: { - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "A compound object is needed for setting a parameter.", outputStorage); + break; + case ADD: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "A compound object is needed for setting a new polygon.", outputStorage); + } + //readt itemNo + inputStorage.readInt(); + std::string type; + if (!server.readTypeCheckingString(inputStorage, type)) { + return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The type must be given as a string.", outputStorage); + } + TraCIColor col; + if (!server.readTypeCheckingColor(inputStorage, col)) { + return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The second polygon parameter must be the color.", outputStorage); + } + int value = 0; + if (!server.readTypeCheckingUnsignedByte(inputStorage, value)) { + return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The third polygon parameter must be 'fill' encoded as ubyte.", outputStorage); + } + bool fill = value != 0; + int layer = 0; + if (!server.readTypeCheckingInt(inputStorage, layer)) { + return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The fourth polygon parameter must be the layer encoded as int.", outputStorage); + } + PositionVector shape; + if (!server.readTypeCheckingPolygon(inputStorage, shape)) { + return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The fifth polygon parameter must be the shape.", outputStorage); + } + TraCIPositionVector tp = TraCI::makeTraCIPositionVector(shape); + + TraCI_Polygon::add(id, tp, col, fill, type, layer); + } - //readt itemNo - inputStorage.readInt(); - std::string name; - if (!server.readTypeCheckingString(inputStorage, name)) { - return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The name of the parameter must be given as a string.", outputStorage); + break; + case REMOVE: { + int layer = 0; // !!! layer not used yet (shouldn't the id be enough?) + if (!server.readTypeCheckingInt(inputStorage, layer)) { + return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The layer must be given using an int.", outputStorage); + } + + TraCI_Polygon::remove(id, layer); + } - std::string value; - if (!server.readTypeCheckingString(inputStorage, value)) { - return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The value of the parameter must be given as a string.", outputStorage); + break; + case VAR_PARAMETER: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "A compound object is needed for setting a parameter.", outputStorage); + } + //readt itemNo + inputStorage.readInt(); + std::string name; + if (!server.readTypeCheckingString(inputStorage, name)) { + return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The name of the parameter must be given as a string.", outputStorage); + } + std::string value; + if (!server.readTypeCheckingString(inputStorage, value)) { + return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, "The value of the parameter must be given as a string.", outputStorage); + } + TraCI_Polygon::setParameter(id, name, value); + } - p->addParameter(name, value); - } - break; - default: break; + default: + break; + } + } catch (TraCIException& e) { + return server.writeErrorStatusCmd(CMD_SET_POLYGON_VARIABLE, e.what(), outputStorage); } server.writeStatusCmd(CMD_SET_POLYGON_VARIABLE, RTYPE_OK, warning, outputStorage); return true; } - bool TraCIServerAPI_Polygon::getShape(const std::string& id, PositionVector& shape) { SUMO::Polygon* poly = getPolygon(id); @@ -260,13 +255,11 @@ return true; } - SUMO::Polygon* TraCIServerAPI_Polygon::getPolygon(const std::string& id) { return MSNet::getInstance()->getShapeContainer().getPolygons().get(id); } - NamedRTree* TraCIServerAPI_Polygon::getTree() { NamedRTree* t = new NamedRTree(); @@ -281,7 +274,6 @@ return t; } - #endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Polygon.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Polygon.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Polygon.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Polygon.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_Polygon.h 20801 2016-05-28 05:31:30Z behrisch $ +/// @version $Id: TraCIServerAPI_Polygon.h 23410 2017-03-15 10:35:33Z namdre $ /// // APIs for getting/setting polygon values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,7 +33,7 @@ #ifndef NO_TRACI -#include "TraCIException.h" +#include "TraCIDefs.h" #include "TraCIServer.h" #include diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Route.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Route.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Route.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Route.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_Route.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: TraCIServerAPI_Route.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // APIs for getting/setting route values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,12 +36,9 @@ #include #include #include "TraCIConstants.h" +#include "lib/TraCI_Route.h" #include "TraCIServerAPI_Route.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -63,28 +60,19 @@ tempMsg.writeUnsignedByte(variable); tempMsg.writeString(id); // process request - if (variable == ID_LIST) { - std::vector ids; - MSRoute::insertIDs(ids); - tempMsg.writeUnsignedByte(TYPE_STRINGLIST); - tempMsg.writeStringList(ids); - } else if (variable == ID_COUNT) { - std::vector ids; - MSRoute::insertIDs(ids); - tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt((int) ids.size()); - } else { - const MSRoute* r = MSRoute::dictionary(id); - if (r == 0) { - return server.writeErrorStatusCmd(CMD_GET_ROUTE_VARIABLE, "Route '" + id + "' is not known", outputStorage); - } + try { switch (variable) { + case ID_LIST: + tempMsg.writeUnsignedByte(TYPE_STRINGLIST); + tempMsg.writeStringList(TraCI_Route::getIDList()); + break; + case ID_COUNT: + tempMsg.writeUnsignedByte(TYPE_INTEGER); + tempMsg.writeInt(TraCI_Route::getIDCount()); + break; case VAR_EDGES: tempMsg.writeUnsignedByte(TYPE_STRINGLIST); - tempMsg.writeInt(r->size()); - for (MSRouteIterator i = r->begin(); i != r->end(); ++i) { - tempMsg.writeString((*i)->getID()); - } + tempMsg.writeStringList(TraCI_Route::getEdges(id)); break; case VAR_PARAMETER: { std::string paramName = ""; @@ -92,12 +80,14 @@ return server.writeErrorStatusCmd(CMD_GET_ROUTE_VARIABLE, "Retrieval of a parameter requires its name.", outputStorage); } tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(r->getParameter(paramName, "")); + tempMsg.writeString(TraCI_Route::getParameter(id, paramName)); + break; } - break; default: break; } + } catch (TraCIException& e) { + return server.writeErrorStatusCmd(CMD_GET_ROUTE_VARIABLE, e.what(), outputStorage); } server.writeStatusCmd(CMD_GET_ROUTE_VARIABLE, RTYPE_OK, "", outputStorage); server.writeResponseWithLength(outputStorage, tempMsg); @@ -116,54 +106,40 @@ } // id std::string id = inputStorage.readString(); - const MSRoute* r = 0; - if (variable != ADD) { - r = MSRoute::dictionary(id); - if (r == 0) { - return server.writeErrorStatusCmd(CMD_SET_ROUTE_VARIABLE, "Route '" + id + "' is not known", outputStorage); - } - } - // process - switch (variable) { - case ADD: { - std::vector edgeIDs; - if (!server.readTypeCheckingStringList(inputStorage, edgeIDs)) { - return server.writeErrorStatusCmd(CMD_SET_ROUTE_VARIABLE, "A string list is needed for adding a new route.", outputStorage); - } - //read itemNo - ConstMSEdgeVector edges; - for (std::vector::const_iterator i = edgeIDs.begin(); i != edgeIDs.end(); ++i) { - MSEdge* edge = MSEdge::dictionary(*i); - if (edge == 0) { - return server.writeErrorStatusCmd(CMD_SET_ROUTE_VARIABLE, "Unknown edge '" + *i + "' in route.", outputStorage); + + try { + // process + switch (variable) { + case ADD: { + std::vector edgeIDs; + if (!server.readTypeCheckingStringList(inputStorage, edgeIDs)) { + return server.writeErrorStatusCmd(CMD_SET_ROUTE_VARIABLE, "A string list is needed for adding a new route.", outputStorage); } - edges.push_back(edge); + TraCI_Route::add(id, edgeIDs); } - const std::vector stops; - if (!MSRoute::dictionary(id, new MSRoute(id, edges, true, 0, stops))) { - return server.writeErrorStatusCmd(CMD_SET_ROUTE_VARIABLE, "Could not add route.", outputStorage); - } - } - break; - case VAR_PARAMETER: { - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_SET_ROUTE_VARIABLE, "A compound object is needed for setting a parameter.", outputStorage); - } - //readt itemNo - inputStorage.readInt(); - std::string name; - if (!server.readTypeCheckingString(inputStorage, name)) { - return server.writeErrorStatusCmd(CMD_SET_ROUTE_VARIABLE, "The name of the parameter must be given as a string.", outputStorage); - } - std::string value; - if (!server.readTypeCheckingString(inputStorage, value)) { - return server.writeErrorStatusCmd(CMD_SET_ROUTE_VARIABLE, "The value of the parameter must be given as a string.", outputStorage); + break; + case VAR_PARAMETER: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_ROUTE_VARIABLE, "A compound object is needed for setting a parameter.", outputStorage); + } + //read itemNo + inputStorage.readInt(); + std::string name; + if (!server.readTypeCheckingString(inputStorage, name)) { + return server.writeErrorStatusCmd(CMD_SET_ROUTE_VARIABLE, "The name of the parameter must be given as a string.", outputStorage); + } + std::string value; + if (!server.readTypeCheckingString(inputStorage, value)) { + return server.writeErrorStatusCmd(CMD_SET_ROUTE_VARIABLE, "The value of the parameter must be given as a string.", outputStorage); + } + TraCI_Route::setParameter(id, name, value); } - ((MSRoute*) r)->addParameter(name, value); - } - break; - default: break; + default: + break; + } + } catch (TraCIException& e) { + return server.writeErrorStatusCmd(CMD_SET_ROUTE_VARIABLE, e.what(), outputStorage); } server.writeStatusCmd(CMD_SET_ROUTE_VARIABLE, RTYPE_OK, warning, outputStorage); return true; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Route.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Route.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Route.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Route.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_Route.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: TraCIServerAPI_Route.h 23410 2017-03-15 10:35:33Z namdre $ /// // APIs for getting/setting route values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,7 +33,7 @@ #ifndef NO_TRACI -#include "TraCIException.h" +#include "TraCIDefs.h" #include "TraCIServer.h" #include diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Simulation.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Simulation.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Simulation.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Simulation.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Sept 2002 -/// @version $Id: TraCIServerAPI_Simulation.cpp 20857 2016-06-03 06:26:52Z namdre $ +/// @version $Id: TraCIServerAPI_Simulation.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // APIs for getting/setting edge values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,13 +42,10 @@ #include #include #include +#include #include "TraCIConstants.h" #include "TraCIServerAPI_Simulation.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -264,17 +261,17 @@ } -std::pair +std::pair TraCIServerAPI_Simulation::convertCartesianToRoadMap(Position pos) { - std::pair result; + std::pair result; std::vector allEdgeIds; - SUMOReal minDistance = std::numeric_limits::max(); + double minDistance = std::numeric_limits::max(); allEdgeIds = MSNet::getInstance()->getEdgeControl().getEdgeNames(); for (std::vector::iterator itId = allEdgeIds.begin(); itId != allEdgeIds.end(); itId++) { const std::vector& allLanes = MSEdge::dictionary((*itId))->getLanes(); for (std::vector::const_iterator itLane = allLanes.begin(); itLane != allLanes.end(); itLane++) { - const SUMOReal newDistance = (*itLane)->getShape().distance2D(pos); + const double newDistance = (*itLane)->getShape().distance2D(pos); if (newDistance < minDistance) { minDistance = newDistance; result.first = (*itLane); @@ -287,30 +284,13 @@ } -const MSLane* -TraCIServerAPI_Simulation::getLaneChecking(std::string roadID, int laneIndex, SUMOReal pos) { - const MSEdge* edge = MSEdge::dictionary(roadID); - if (edge == 0) { - throw TraCIException("Unknown edge " + roadID); - } - if (laneIndex < 0 || laneIndex >= (int)edge->getLanes().size()) { - throw TraCIException("Invalid lane index for " + roadID); - } - const MSLane* lane = edge->getLanes()[laneIndex]; - if (pos < 0 || pos > lane->getLength()) { - throw TraCIException("Position on lane invalid"); - } - return lane; -} - - bool TraCIServerAPI_Simulation::commandPositionConversion(TraCIServer& server, tcpip::Storage& inputStorage, tcpip::Storage& outputStorage, int commandId) { - std::pair roadPos; + std::pair roadPos; Position cartesianPos; Position geoPos; - SUMOReal z = 0; + double z = 0; // actual position type that will be converted int srcPosType = inputStorage.readUnsignedByte(); @@ -320,8 +300,8 @@ case POSITION_3D: case POSITION_LON_LAT: case POSITION_LON_LAT_ALT: { - SUMOReal x = inputStorage.readDouble(); - SUMOReal y = inputStorage.readDouble(); + double x = inputStorage.readDouble(); + double y = inputStorage.readDouble(); if (srcPosType != POSITION_2D && srcPosType != POSITION_LON_LAT) { z = inputStorage.readDouble(); } @@ -336,11 +316,11 @@ break; case POSITION_ROADMAP: { std::string roadID = inputStorage.readString(); - SUMOReal pos = inputStorage.readDouble(); + double pos = inputStorage.readDouble(); int laneIdx = inputStorage.readUnsignedByte(); try { // convert edge,offset,laneIdx to cartesian position - cartesianPos = geoPos = getLaneChecking(roadID, laneIdx, pos)->getShape().positionAtOffset(pos); + cartesianPos = geoPos = TraCI::getLaneChecking(roadID, laneIdx, pos)->getShape().positionAtOffset(pos); z = cartesianPos.z(); GeoConvHelper::getFinal().cartesian2geo(geoPos); } catch (TraCIException& e) { @@ -402,8 +382,8 @@ tcpip::Storage& outputStorage, int commandId) { Position pos1; Position pos2; - std::pair roadPos1; - std::pair roadPos2; + std::pair roadPos1; + std::pair roadPos2; // read position 1 int posType = inputStorage.readUnsignedByte(); @@ -412,7 +392,7 @@ try { std::string roadID = inputStorage.readString(); roadPos1.second = inputStorage.readDouble(); - roadPos1.first = getLaneChecking(roadID, inputStorage.readUnsignedByte(), roadPos1.second); + roadPos1.first = TraCI::getLaneChecking(roadID, inputStorage.readUnsignedByte(), roadPos1.second); pos1 = roadPos1.first->getShape().positionAtOffset(roadPos1.second); } catch (TraCIException& e) { server.writeStatusCmd(commandId, RTYPE_ERR, e.what()); @@ -421,8 +401,8 @@ break; case POSITION_2D: case POSITION_3D: { - SUMOReal p1x = inputStorage.readDouble(); - SUMOReal p1y = inputStorage.readDouble(); + double p1x = inputStorage.readDouble(); + double p1y = inputStorage.readDouble(); pos1.set(p1x, p1y); } if (posType == POSITION_3D) { @@ -442,7 +422,7 @@ try { std::string roadID = inputStorage.readString(); roadPos2.second = inputStorage.readDouble(); - roadPos2.first = getLaneChecking(roadID, inputStorage.readUnsignedByte(), roadPos2.second); + roadPos2.first = TraCI::getLaneChecking(roadID, inputStorage.readUnsignedByte(), roadPos2.second); pos2 = roadPos2.first->getShape().positionAtOffset(roadPos2.second); } catch (TraCIException& e) { server.writeStatusCmd(commandId, RTYPE_ERR, e.what()); @@ -451,8 +431,8 @@ break; case POSITION_2D: case POSITION_3D: { - SUMOReal p2x = inputStorage.readDouble(); - SUMOReal p2y = inputStorage.readDouble(); + double p2x = inputStorage.readDouble(); + double p2y = inputStorage.readDouble(); pos2.set(p2x, p2y); } if (posType == POSITION_3D) { @@ -468,7 +448,7 @@ // read distance type int distType = inputStorage.readUnsignedByte(); - SUMOReal distance = 0.0; + double distance = 0.0; if (distType == REQUEST_DRIVINGDIST) { // compute driving distance if ((roadPos1.first == roadPos2.first) && (roadPos1.second <= roadPos2.second)) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Simulation.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Simulation.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Simulation.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Simulation.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_Simulation.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: TraCIServerAPI_Simulation.h 23474 2017-03-16 11:41:13Z namdre $ /// // APIs for getting/setting edge values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,7 +36,7 @@ #include #include #include -#include "TraCIException.h" +#include "TraCIDefs.h" #include "TraCIServer.h" #include @@ -75,7 +75,7 @@ * @param pos cartesian position that is to be converted * @return the closest road map position to the cartesian position */ - static std::pair convertCartesianToRoadMap(Position pos); + static std::pair convertCartesianToRoadMap(Position pos); /** * Converts a road map position to a cartesian position @@ -83,7 +83,6 @@ * @param pos road map position that is to be convertes * @return closest 2D position */ - static const MSLane* getLaneChecking(std::string roadID, int laneIndex, SUMOReal pos); static bool commandPositionConversion(TraCIServer& server, tcpip::Storage& inputStorage, tcpip::Storage& outputStorage, int commandId); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_TLS.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_TLS.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_TLS.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_TLS.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_TLS.cpp 21217 2016-07-22 10:57:44Z behrisch $ +/// @version $Id: TraCIServerAPI_TLS.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // APIs for getting/setting traffic light values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,10 +40,6 @@ #include #include "TraCIServerAPI_TLS.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -181,11 +177,7 @@ // approached non-internal lane (if any) def.push_back(link->getLane() != 0 ? link->getLane()->getID() : ""); // approached "via", internal lane (if any) -#ifdef HAVE_INTERNAL_LANES def.push_back(link->getViaLane() != 0 ? link->getViaLane()->getID() : ""); -#else - def.push_back(""); -#endif tempContent.writeUnsignedByte(TYPE_STRINGLIST); tempContent.writeStringList(def); ++cnt; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_TLS.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_TLS.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_TLS.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_TLS.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_TLS.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: TraCIServerAPI_TLS.h 23410 2017-03-15 10:35:33Z namdre $ /// // APIs for getting/setting traffic light values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,7 +33,7 @@ #ifndef NO_TRACI -#include "TraCIException.h" +#include "TraCIDefs.h" #include "TraCIServer.h" #include diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Vehicle.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Vehicle.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Vehicle.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Vehicle.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -7,13 +7,14 @@ /// @author Bjoern Hendriks /// @author Mario Krumnow /// @author Jakob Erdmann +/// @author Robert Hilbrich /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_Vehicle.cpp 21657 2016-10-10 14:50:05Z namdre $ +/// @version $Id: TraCIServerAPI_Vehicle.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // APIs for getting/setting vehicle values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -50,17 +50,14 @@ #include #include #include +#include #include "TraCIConstants.h" #include "TraCIServerAPI_Simulation.h" #include "TraCIServerAPI_Vehicle.h" #include "TraCIServerAPI_VehicleType.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - -//#define DEBUG_VTD 1 -//#define DEBUG_VTD_ANGLE 1 +//#define DEBUG_MOVEXY 1 +//#define DEBUG_MOVEXY_ANGLE 1 // =========================================================================== @@ -84,6 +81,7 @@ && variable != VAR_ROAD_ID && variable != VAR_LANE_ID && variable != VAR_LANE_INDEX && variable != VAR_TYPE && variable != VAR_ROUTE_ID && variable != VAR_COLOR && variable != VAR_LANEPOSITION + && variable != VAR_LANEPOSITION_LAT && variable != VAR_CO2EMISSION && variable != VAR_COEMISSION && variable != VAR_HCEMISSION && variable != VAR_PMXEMISSION && variable != VAR_NOXEMISSION && variable != VAR_FUELCONSUMPTION && variable != VAR_NOISEEMISSION @@ -97,6 +95,9 @@ && variable != VAR_WIDTH && variable != VAR_MINGAP && variable != VAR_SHAPECLASS && variable != VAR_ACCEL && variable != VAR_DECEL && variable != VAR_IMPERFECTION && variable != VAR_TAU && variable != VAR_BEST_LANES && variable != DISTANCE_REQUEST + && variable != VAR_LATALIGNMENT + && variable != VAR_MAXSPEED_LAT + && variable != VAR_MINGAP_LAT && variable != ID_COUNT && variable != VAR_STOPSTATE && variable != VAR_WAITING_TIME && variable != VAR_ROUTE_INDEX && variable != VAR_PARAMETER @@ -104,6 +105,9 @@ && variable != VAR_NEXT_TLS && variable != VAR_SLOPE && variable != VAR_HEIGHT + && variable != VAR_LINE + && variable != VAR_VIA + && variable != CMD_CHANGELANE ) { return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Get Vehicle Variable: unsupported variable " + toHex(variable, 2) + " specified", outputStorage); } @@ -114,164 +118,148 @@ tempMsg.writeUnsignedByte(variable); tempMsg.writeString(id); // process request - if (variable == ID_LIST || variable == ID_COUNT) { - std::vector ids; - MSVehicleControl& c = MSNet::getInstance()->getVehicleControl(); - for (MSVehicleControl::constVehIt i = c.loadedVehBegin(); i != c.loadedVehEnd(); ++i) { - if ((*i).second->isOnRoad() || (*i).second->isParking()) { - ids.push_back((*i).first); - } - } - if (variable == ID_LIST) { - tempMsg.writeUnsignedByte(TYPE_STRINGLIST); - tempMsg.writeStringList(ids); - } else { - tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt((int) ids.size()); - } - } else { - SUMOVehicle* sumoVehicle = MSNet::getInstance()->getVehicleControl().getVehicle(id); - if (sumoVehicle == 0) { - return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Vehicle '" + id + "' is not known", outputStorage); - } - MSVehicle* v = dynamic_cast(sumoVehicle); - if (v == 0) { - return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Vehicle '" + id + "' is not a micro-simulation vehicle", outputStorage); - } - const bool onRoad = v->isOnRoad(); - const bool visible = onRoad || v->isParking(); + try { switch (variable) { + case ID_LIST: + tempMsg.writeUnsignedByte(TYPE_STRINGLIST); + tempMsg.writeStringList(TraCI_Vehicle::getIDList()); + break; + case ID_COUNT: + tempMsg.writeUnsignedByte(TYPE_INTEGER); + tempMsg.writeInt(TraCI_Vehicle::getIDCount()); + break; case VAR_SPEED: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(visible ? v->getSpeed() : INVALID_DOUBLE_VALUE); + tempMsg.writeDouble(TraCI_Vehicle::getSpeed(id)); break; case VAR_SPEED_WITHOUT_TRACI: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(visible ? v->getSpeedWithoutTraciInfluence() : INVALID_DOUBLE_VALUE); + tempMsg.writeDouble(TraCI_Vehicle::getSpeedWithoutTraCI(id)); break; - case VAR_POSITION: + case VAR_POSITION: { tempMsg.writeUnsignedByte(POSITION_2D); - tempMsg.writeDouble(visible ? v->getPosition().x() : INVALID_DOUBLE_VALUE); - tempMsg.writeDouble(visible ? v->getPosition().y() : INVALID_DOUBLE_VALUE); + TraCIPosition pos = TraCI_Vehicle::getPosition(id); + tempMsg.writeDouble(pos.x); + tempMsg.writeDouble(pos.y); break; - case VAR_POSITION3D: + } + case VAR_POSITION3D: { tempMsg.writeUnsignedByte(POSITION_3D); - tempMsg.writeDouble(visible ? v->getPosition().x() : INVALID_DOUBLE_VALUE); - tempMsg.writeDouble(visible ? v->getPosition().y() : INVALID_DOUBLE_VALUE); - tempMsg.writeDouble(visible ? v->getPosition().z() : INVALID_DOUBLE_VALUE); + TraCIPosition pos = TraCI_Vehicle::getPosition(id); + tempMsg.writeDouble(pos.x); + tempMsg.writeDouble(pos.y); + tempMsg.writeDouble(pos.z); break; + } case VAR_ANGLE: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(visible ? GeomHelper::naviDegree(v->getAngle()) : INVALID_DOUBLE_VALUE); + tempMsg.writeDouble(TraCI_Vehicle::getAngle(id)); break; case VAR_SLOPE: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(onRoad ? v->getSlope() : INVALID_DOUBLE_VALUE); + tempMsg.writeDouble(TraCI_Vehicle::getSlope(id)); break; case VAR_ROAD_ID: tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(visible ? v->getLane()->getEdge().getID() : ""); + tempMsg.writeString(TraCI_Vehicle::getRoadID(id)); break; case VAR_LANE_ID: tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(onRoad ? v->getLane()->getID() : ""); + tempMsg.writeString(TraCI_Vehicle::getLaneID(id)); break; case VAR_LANE_INDEX: tempMsg.writeUnsignedByte(TYPE_INTEGER); - if (onRoad) { - const std::vector& lanes = v->getLane()->getEdge().getLanes(); - tempMsg.writeInt((int)std::distance(lanes.begin(), std::find(lanes.begin(), lanes.end(), v->getLane()))); - } else { - tempMsg.writeInt(INVALID_INT_VALUE); - } + tempMsg.writeInt(TraCI_Vehicle::getLaneIndex(id)); break; case VAR_TYPE: tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(v->getVehicleType().getID()); + tempMsg.writeString(TraCI_Vehicle::getTypeID(id)); break; case VAR_ROUTE_ID: tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(v->getRoute().getID()); + tempMsg.writeString(TraCI_Vehicle::getRouteID(id)); break; case VAR_ROUTE_INDEX: tempMsg.writeUnsignedByte(TYPE_INTEGER); - if (v->hasDeparted()) { - tempMsg.writeInt((int)v->getRoutePosition()); - } else { - tempMsg.writeInt(INVALID_INT_VALUE); - } + tempMsg.writeInt(TraCI_Vehicle::getRouteIndex(id)); break; - case VAR_COLOR: + case VAR_COLOR: { + TraCIColor color = TraCI_Vehicle::getColor(id); tempMsg.writeUnsignedByte(TYPE_COLOR); - tempMsg.writeUnsignedByte(v->getParameter().color.red()); - tempMsg.writeUnsignedByte(v->getParameter().color.green()); - tempMsg.writeUnsignedByte(v->getParameter().color.blue()); - tempMsg.writeUnsignedByte(v->getParameter().color.alpha()); + tempMsg.writeUnsignedByte(color.r); + tempMsg.writeUnsignedByte(color.g); + tempMsg.writeUnsignedByte(color.b); + tempMsg.writeUnsignedByte(color.a); break; + } case VAR_LANEPOSITION: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(onRoad ? v->getPositionOnLane() : INVALID_DOUBLE_VALUE); + tempMsg.writeDouble(TraCI_Vehicle::getLanePosition(id)); + break; + case VAR_LANEPOSITION_LAT: + tempMsg.writeUnsignedByte(TYPE_DOUBLE); + tempMsg.writeDouble(TraCI_Vehicle::getLateralLanePosition(id)); break; case VAR_CO2EMISSION: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(visible ? v->getCO2Emissions() : INVALID_DOUBLE_VALUE); + tempMsg.writeDouble(TraCI_Vehicle::getCO2Emission(id)); break; case VAR_COEMISSION: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(visible ? v->getCOEmissions() : INVALID_DOUBLE_VALUE); + tempMsg.writeDouble(TraCI_Vehicle::getCOEmission(id)); break; case VAR_HCEMISSION: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(visible ? v->getHCEmissions() : INVALID_DOUBLE_VALUE); + tempMsg.writeDouble(TraCI_Vehicle::getHCEmission(id)); break; case VAR_PMXEMISSION: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(visible ? v->getPMxEmissions() : INVALID_DOUBLE_VALUE); + tempMsg.writeDouble(TraCI_Vehicle::getPMxEmission(id)); break; case VAR_NOXEMISSION: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(visible ? v->getNOxEmissions() : INVALID_DOUBLE_VALUE); + tempMsg.writeDouble(TraCI_Vehicle::getNOxEmission(id)); break; case VAR_FUELCONSUMPTION: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(visible ? v->getFuelConsumption() : INVALID_DOUBLE_VALUE); + tempMsg.writeDouble(TraCI_Vehicle::getFuelConsumption(id)); break; case VAR_NOISEEMISSION: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(visible ? v->getHarmonoise_NoiseEmissions() : INVALID_DOUBLE_VALUE); + tempMsg.writeDouble(TraCI_Vehicle::getNoiseEmission(id)); break; case VAR_ELECTRICITYCONSUMPTION: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(visible ? v->getElectricityConsumption() : INVALID_DOUBLE_VALUE); + tempMsg.writeDouble(TraCI_Vehicle::getElectricityConsumption(id)); break; case VAR_PERSON_NUMBER: tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt(v->getPersonNumber()); + tempMsg.writeInt(TraCI_Vehicle::getPersonNumber(id)); break; case VAR_LEADER: { double dist = 0; if (!server.readTypeCheckingDouble(inputStorage, dist)) { return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Leader retrieval requires a double.", outputStorage); } - std::pair leaderInfo = v->getLeader(dist); + std::pair leaderInfo = TraCI_Vehicle::getLeader(id, dist); tempMsg.writeUnsignedByte(TYPE_COMPOUND); tempMsg.writeInt(2); tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(leaderInfo.first != 0 ? leaderInfo.first->getID() : ""); + tempMsg.writeString(leaderInfo.first); tempMsg.writeUnsignedByte(TYPE_DOUBLE); tempMsg.writeDouble(leaderInfo.second); } break; case VAR_WAITING_TIME: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(v->getWaitingSeconds()); + tempMsg.writeDouble(TraCI_Vehicle::getWaitingTime(id)); break; case VAR_EDGE_TRAVELTIME: { if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Retrieval of travel time requires a compound object.", outputStorage); } if (inputStorage.readInt() != 2) { - return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Retrieval of travel time requires time, and edge as parameter.", outputStorage); + return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Retrieval of travel time requires time and edge as parameter.", outputStorage); } // time int time = 0; @@ -283,27 +271,17 @@ if (!server.readTypeCheckingString(inputStorage, edgeID)) { return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Retrieval of travel time requires the referenced edge as second parameter.", outputStorage); } - MSEdge* edge = MSEdge::dictionary(edgeID); - if (edge == 0) { - return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Referenced edge '" + edgeID + "' is not known.", outputStorage); - } // retrieve tempMsg.writeUnsignedByte(TYPE_DOUBLE); - SUMOReal value; - if (!v->getWeightsStorage().retrieveExistingTravelTime(edge, time, value)) { - tempMsg.writeDouble(INVALID_DOUBLE_VALUE); - } else { - tempMsg.writeDouble(value); - } - + tempMsg.writeDouble(TraCI_Vehicle::getAdaptedTraveltime(id, edgeID, time)); } break; case VAR_EDGE_EFFORT: { if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Retrieval of travel time requires a compound object.", outputStorage); + return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Retrieval of effort requires a compound object.", outputStorage); } if (inputStorage.readInt() != 2) { - return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Retrieval of travel time requires time, and edge as parameter.", outputStorage); + return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Retrieval of effort requires time and edge as parameter.", outputStorage); } // time int time = 0; @@ -315,73 +293,51 @@ if (!server.readTypeCheckingString(inputStorage, edgeID)) { return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Retrieval of effort requires the referenced edge as second parameter.", outputStorage); } - MSEdge* edge = MSEdge::dictionary(edgeID); - if (edge == 0) { - return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Referenced edge '" + edgeID + "' is not known.", outputStorage); - } - // retrieve tempMsg.writeUnsignedByte(TYPE_DOUBLE); - SUMOReal value; - if (!v->getWeightsStorage().retrieveExistingEffort(edge, time, value)) { - tempMsg.writeDouble(INVALID_DOUBLE_VALUE); - } else { - tempMsg.writeDouble(value); - } - + tempMsg.writeDouble(TraCI_Vehicle::getEffort(id, edgeID, time)); } break; case VAR_ROUTE_VALID: { std::string msg; tempMsg.writeUnsignedByte(TYPE_UBYTE); - tempMsg.writeUnsignedByte(v->hasValidRoute(msg)); + tempMsg.writeUnsignedByte(TraCI_Vehicle::isRouteValid(id)); } break; - case VAR_EDGES: { - const MSRoute& r = v->getRoute(); + case VAR_EDGES: tempMsg.writeUnsignedByte(TYPE_STRINGLIST); - tempMsg.writeInt(r.size()); - for (MSRouteIterator i = r.begin(); i != r.end(); ++i) { - tempMsg.writeString((*i)->getID()); - } - } - break; + tempMsg.writeStringList(TraCI_Vehicle::getEdges(id)); + break; case VAR_SIGNALS: tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt(v->getSignals()); + tempMsg.writeInt(TraCI_Vehicle::getSignalStates(id)); break; case VAR_BEST_LANES: { tempMsg.writeUnsignedByte(TYPE_COMPOUND); tcpip::Storage tempContent; int cnt = 0; tempContent.writeUnsignedByte(TYPE_INTEGER); - const std::vector& bestLanes = onRoad ? v->getBestLanes() : std::vector(); + std::vector bestLanes = TraCI_Vehicle::getBestLanes(id); tempContent.writeInt((int) bestLanes.size()); ++cnt; - for (std::vector::const_iterator i = bestLanes.begin(); i != bestLanes.end(); ++i) { - const MSVehicle::LaneQ& lq = *i; + for (std::vector::const_iterator i = bestLanes.begin(); i != bestLanes.end(); ++i) { + const TraCI_Vehicle::BestLanesData& bld = *i; tempContent.writeUnsignedByte(TYPE_STRING); - tempContent.writeString(lq.lane->getID()); + tempContent.writeString(bld.laneID); ++cnt; tempContent.writeUnsignedByte(TYPE_DOUBLE); - tempContent.writeDouble(lq.length); + tempContent.writeDouble(bld.length); ++cnt; tempContent.writeUnsignedByte(TYPE_DOUBLE); - tempContent.writeDouble(lq.nextOccupation); + tempContent.writeDouble(bld.nextOccupation); ++cnt; tempContent.writeUnsignedByte(TYPE_BYTE); - tempContent.writeByte(lq.bestLaneOffset); + tempContent.writeByte(bld.bestLaneOffset); ++cnt; tempContent.writeUnsignedByte(TYPE_UBYTE); - lq.allowsContinuation ? tempContent.writeUnsignedByte(1) : tempContent.writeUnsignedByte(0); + bld.allowsContinuation ? tempContent.writeUnsignedByte(1) : tempContent.writeUnsignedByte(0); ++cnt; - std::vector bestContIDs; - for (std::vector::const_iterator j = lq.bestContinuations.begin(); j != lq.bestContinuations.end(); ++j) { - if ((*j) != 0) { - bestContIDs.push_back((*j)->getID()); - } - } tempContent.writeUnsignedByte(TYPE_STRINGLIST); - tempContent.writeStringList(bestContIDs); + tempContent.writeStringList(bld.continuationLanes); ++cnt; } tempMsg.writeInt((int) cnt); @@ -389,102 +345,128 @@ } break; case VAR_NEXT_TLS: { - int cnt = 0; // number of elements in compound message - int tlsLinks = 0; // number of tls links within bestlanes range - tcpip::Storage tempContent; - if (onRoad) { - const MSLane* lane = v->getLane(); - const std::vector& bestLaneConts = v->getBestLanesContinuation(lane); - SUMOReal seen = v->getLane()->getLength() - v->getPositionOnLane(); - int view = 1; - MSLinkCont::const_iterator link = MSLane::succLinkSec(*v, view, *lane, bestLaneConts); - while (!lane->isLinkEnd(link)) { - if (!lane->getEdge().isInternal()) { - if ((*link)->isTLSControlled()) { - tlsLinks++; - tempContent.writeUnsignedByte(TYPE_STRING); - tempContent.writeString((*link)->getTLLogic()->getID()); - ++cnt; - tempContent.writeUnsignedByte(TYPE_INTEGER); - tempContent.writeInt((*link)->getTLIndex()); - ++cnt; - tempContent.writeUnsignedByte(TYPE_DOUBLE); - tempContent.writeDouble(seen); - ++cnt; - tempContent.writeUnsignedByte(TYPE_BYTE); - tempContent.writeByte((*link)->getState()); - ++cnt; - } - } - lane = (*link)->getViaLaneOrLane(); - if (!lane->getEdge().isInternal()) { - view++; - } - seen += lane->getLength(); - link = MSLane::succLinkSec(*v, view, *lane, bestLaneConts); - } - } - ++cnt; // tlsLinks, everyting else was already included + std::vector nextTLS = TraCI_Vehicle::getNextTLS(id); tempMsg.writeUnsignedByte(TYPE_COMPOUND); - tempMsg.writeInt((int) cnt); + const int cnt = 1 + (int)nextTLS.size() * 4; + tempMsg.writeInt(cnt); tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt(tlsLinks); - tempMsg.writeStorage(tempContent); - } - break; - case VAR_STOPSTATE: { - char b = 0; - if (v->isStopped()) { - const MSVehicle::Stop& stop = v->getNextStop(); - b = 1 + (stop.parking ? 2 : 0) + - (stop.triggered ? 4 : 0) + - (stop.containerTriggered ? 8 : 0) + - (stop.busstop != 0 ? 16 : 0) + - (stop.containerstop != 0 ? 32 : 0); + tempMsg.writeInt((int)nextTLS.size()); + for (std::vector::iterator it = nextTLS.begin(); it != nextTLS.end(); ++it) { + tempMsg.writeUnsignedByte(TYPE_STRING); + tempMsg.writeString(it->id); + tempMsg.writeUnsignedByte(TYPE_INTEGER); + tempMsg.writeInt(it->tlIndex); + tempMsg.writeUnsignedByte(TYPE_DOUBLE); + tempMsg.writeDouble(it->dist); + tempMsg.writeUnsignedByte(TYPE_BYTE); + tempMsg.writeByte(it->state); } - tempMsg.writeUnsignedByte(TYPE_UBYTE); - tempMsg.writeUnsignedByte(b); } break; - case VAR_DISTANCE: { + case VAR_STOPSTATE: + tempMsg.writeUnsignedByte(TYPE_UBYTE); + tempMsg.writeUnsignedByte(TraCI_Vehicle::getStopState(id)); + break; + case VAR_DISTANCE: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - SUMOReal distance = onRoad ? v->getRoute().getDistanceBetween(v->getDepartPos(), v->getPositionOnLane(), v->getRoute().getEdges()[0], &v->getLane()->getEdge()) : INVALID_DOUBLE_VALUE; - if (distance == std::numeric_limits::max()) { - distance = INVALID_DOUBLE_VALUE; + tempMsg.writeDouble(TraCI_Vehicle::getDistance(id)); + break; + case DISTANCE_REQUEST: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Retrieval of distance requires a compound object.", outputStorage); } - tempMsg.writeDouble(distance); - } - break; - case DISTANCE_REQUEST: - if (!commandDistanceRequest(server, inputStorage, tempMsg, v)) { - return false; + if (inputStorage.readInt() != 2) { + return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Retrieval of distance requires position and distance type as parameter.", outputStorage); + } + + double edgePos; + std::string roadID; + int laneIndex; + // read position + int posType = inputStorage.readUnsignedByte(); + switch (posType) { + case POSITION_ROADMAP: + try { + std::string roadID = inputStorage.readString(); + edgePos = inputStorage.readDouble(); + laneIndex = inputStorage.readUnsignedByte(); + tempMsg.writeUnsignedByte(TYPE_DOUBLE); + tempMsg.writeDouble(TraCI_Vehicle::getDrivingDistance(id, roadID, edgePos, laneIndex)); + break; + } catch (TraCIException& e) { + return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, e.what(), outputStorage); + } + case POSITION_2D: + case POSITION_3D: { + const double p1x = inputStorage.readDouble(); + const double p1y = inputStorage.readDouble(); + if (posType == POSITION_3D) { + inputStorage.readDouble(); // z value is ignored + } + tempMsg.writeUnsignedByte(TYPE_DOUBLE); + tempMsg.writeDouble(TraCI_Vehicle::getDrivingDistance2D(id, p1x, p1y)); + } + break; + default: + return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Unknown position format used for distance request", outputStorage); + } + // read distance type + int distType = inputStorage.readUnsignedByte(); + if (distType != REQUEST_DRIVINGDIST) { + return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Only driving distance is supported for vehicles.", outputStorage); } break; + } case VAR_ALLOWED_SPEED: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(onRoad ? v->getLane()->getVehicleMaxSpeed(v) : INVALID_DOUBLE_VALUE); + tempMsg.writeDouble(TraCI_Vehicle::getAllowedSpeed(id)); break; case VAR_SPEED_FACTOR: tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(v->getChosenSpeedFactor()); + tempMsg.writeDouble(TraCI_Vehicle::getSpeedFactor(id)); break; case VAR_SPEEDSETMODE: tempMsg.writeUnsignedByte(TYPE_INTEGER); - tempMsg.writeInt(v->getInfluencer().getSpeedMode()); + tempMsg.writeInt(TraCI_Vehicle::getSpeedMode(id)); break; + case VAR_LINE: + tempMsg.writeUnsignedByte(TYPE_STRING); + tempMsg.writeString(TraCI_Vehicle::getLine(id)); + break; + case VAR_VIA: + tempMsg.writeUnsignedByte(TYPE_STRINGLIST); + tempMsg.writeStringList(TraCI_Vehicle::getVia(id)); + break; + case CMD_CHANGELANE: { + int direction = 0; + if (!server.readTypeCheckingInt(inputStorage, direction)) { + return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Retrieval of lane change state requires a direction as int.", outputStorage); + } + const std::pair state = TraCI_Vehicle::getLaneChangeState(id, direction); + tempMsg.writeUnsignedByte(TYPE_COMPOUND); + tempMsg.writeInt(2); + tempMsg.writeUnsignedByte(TYPE_INTEGER); + tempMsg.writeInt(state.first); + tempMsg.writeUnsignedByte(TYPE_INTEGER); + tempMsg.writeInt(state.second); + } + break; case VAR_PARAMETER: { std::string paramName = ""; if (!server.readTypeCheckingString(inputStorage, paramName)) { return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Retrieval of a parameter requires its name.", outputStorage); } tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(v->getParameter().getParameter(paramName, "")); + tempMsg.writeString(TraCI_Vehicle::getParameter(id, paramName)); } break; default: - TraCIServerAPI_VehicleType::getVariable(variable, v->getVehicleType(), tempMsg); + /// XXX replace by a TraCI_VehicleType function + TraCIServerAPI_VehicleType::getVariable(variable, TraCI_Vehicle::getVehicleType(id).getID(), tempMsg); break; } + } catch (TraCIException& e) { + return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, e.what(), outputStorage); } server.writeStatusCmd(CMD_GET_VEHICLE_VARIABLE, RTYPE_OK, "", outputStorage); server.writeResponseWithLength(outputStorage, tempMsg); @@ -499,6 +481,7 @@ // variable int variable = inputStorage.readUnsignedByte(); if (variable != CMD_STOP && variable != CMD_CHANGELANE + && variable != CMD_CHANGESUBLANE && variable != CMD_SLOWDOWN && variable != CMD_CHANGETARGET && variable != CMD_RESUME && variable != VAR_TYPE && variable != VAR_ROUTE_ID && variable != VAR_ROUTE && variable != VAR_EDGE_TRAVELTIME && variable != VAR_EDGE_EFFORT @@ -512,14 +495,19 @@ && variable != VAR_SPEED && variable != VAR_SPEEDSETMODE && variable != VAR_COLOR && variable != ADD && variable != ADD_FULL && variable != REMOVE && variable != VAR_HEIGHT - && variable != VAR_MOVE_TO_VTD && variable != VAR_PARAMETER/* && variable != VAR_SPEED_TIME_LINE && variable != VAR_LANE_TIME_LINE*/ + && variable != VAR_LATALIGNMENT + && variable != VAR_MAXSPEED_LAT + && variable != VAR_MINGAP_LAT + && variable != VAR_LINE + && variable != VAR_VIA + && variable != MOVE_TO_XY && variable != VAR_PARAMETER/* && variable != VAR_SPEED_TIME_LINE && variable != VAR_LANE_TIME_LINE*/ ) { return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Change Vehicle State: unsupported variable " + toHex(variable, 2) + " specified", outputStorage); } // id std::string id = inputStorage.readString(); -#ifdef DEBUG_VTD - WRITE_MESSAGE("Processing " + id); +#ifdef DEBUG_MOVEXY + std::cout << SIMTIME << " processSet veh=" << id << "\n"; #endif const bool shouldExist = variable != ADD && variable != ADD_FULL; SUMOVehicle* sumoVehicle = MSNet::getInstance()->getVehicleControl().getVehicle(id); @@ -532,169 +520,127 @@ if (v == 0 && shouldExist) { return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Vehicle '" + id + "' is not a micro-simulation vehicle", outputStorage); } - switch (variable) { - case CMD_STOP: { - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Stop needs a compound object description.", outputStorage); - } - int compoundSize = inputStorage.readInt(); - if (compoundSize < 4 || compoundSize > 7) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Stop needs a compound object description of four to seven items.", outputStorage); - } - // read road map position - std::string roadId; - if (!server.readTypeCheckingString(inputStorage, roadId)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The first stop parameter must be the edge id given as a string.", outputStorage); - } - double pos = 0; - if (!server.readTypeCheckingDouble(inputStorage, pos)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The second stop parameter must be the end position along the edge given as a double.", outputStorage); - } - int laneIndex = 0; - if (!server.readTypeCheckingByte(inputStorage, laneIndex)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The third stop parameter must be the lane index given as a byte.", outputStorage); - } - // waitTime - int waitTime = -1; - if (!server.readTypeCheckingInt(inputStorage, waitTime)) { - return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "The fourth stop parameter must be the waiting time given as an integer.", outputStorage); - } - // optional stop flags - bool parking = false; - bool triggered = false; - bool containerTriggered = false; - bool isBusStop = false; - bool isContainerStop = false; - if (compoundSize >= 5) { - int stopFlags; - if (!server.readTypeCheckingByte(inputStorage, stopFlags)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The fifth stop parameter must be a byte indicating its parking/triggered status.", outputStorage); - } - parking = ((stopFlags & 1) != 0); - triggered = ((stopFlags & 2) != 0); - containerTriggered = ((stopFlags & 4) != 0); - isBusStop = ((stopFlags & 8) != 0); - isContainerStop = ((stopFlags & 16) != 0); - } - double startPos = pos - POSITION_EPS; - if (compoundSize >= 6) { - double tmp; - if (!server.readTypeCheckingDouble(inputStorage, tmp)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The sixth stop parameter must be the start position along the edge given as a double.", outputStorage); - } - if (tmp != INVALID_DOUBLE_VALUE) { - startPos = tmp; - } - } - int until = -1; - if (compoundSize >= 7) { - if (!server.readTypeCheckingInt(inputStorage, until)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The seventh stop parameter must be the waiting end time given as integer.", outputStorage); + const bool onInit = v == 0 || v->getLane() == 0; + try { + switch (variable) { + case CMD_STOP: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Stop needs a compound object description.", outputStorage); } - } - std::string error; - if (isBusStop || isContainerStop) { - // Forward command to vehicle - if (!v->addTraciBusOrContainerStop(roadId, waitTime, until, parking, triggered, containerTriggered, isContainerStop, error)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, error, outputStorage); + int compoundSize = inputStorage.readInt(); + if (compoundSize < 4 || compoundSize > 7) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Stop needs a compound object description of four to seven items.", outputStorage); } - } else { - // check - if (startPos < 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Position on lane must not be negative.", outputStorage); - } - if (pos < startPos) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "End position on lane must be after start position.", outputStorage); - } - // get the actual lane that is referenced by laneIndex - MSEdge* road = MSEdge::dictionary(roadId); - if (road == 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Unable to retrieve road with given id.", outputStorage); - } - const std::vector& allLanes = road->getLanes(); - if ((laneIndex < 0) || laneIndex >= (int)(allLanes.size())) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "No lane with index '" + toString(laneIndex) + "' on road '" + roadId + "'.", outputStorage); + // read road map position + std::string edgeID; + if (!server.readTypeCheckingString(inputStorage, edgeID)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The first stop parameter must be the edge id given as a string.", outputStorage); } - // Forward command to vehicle - if (!v->addTraciStop(allLanes[laneIndex], startPos, pos, waitTime, until, parking, triggered, containerTriggered, error)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, error, outputStorage); + double pos = 0; + if (!server.readTypeCheckingDouble(inputStorage, pos)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The second stop parameter must be the end position along the edge given as a double.", outputStorage); + } + int laneIndex = 0; + if (!server.readTypeCheckingByte(inputStorage, laneIndex)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The third stop parameter must be the lane index given as a byte.", outputStorage); + } + // waitTime + int waitTime = -1; + if (!server.readTypeCheckingInt(inputStorage, waitTime)) { + return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "The fourth stop parameter must be the waiting time given as an integer.", outputStorage); + } + int stopFlags = 0; + if (compoundSize >= 5) { + if (!server.readTypeCheckingByte(inputStorage, stopFlags)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The fifth stop parameter must be a byte indicating its parking/triggered status.", outputStorage); + } } + double startPos = pos - POSITION_EPS; + if (compoundSize >= 6) { + double tmp; + if (!server.readTypeCheckingDouble(inputStorage, tmp)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The sixth stop parameter must be the start position along the edge given as a double.", outputStorage); + } + if (tmp != INVALID_DOUBLE_VALUE) { + startPos = tmp; + } + } + int until = -1; + if (compoundSize >= 7) { + if (!server.readTypeCheckingInt(inputStorage, until)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The seventh stop parameter must be the minimum departure time given as integer.", outputStorage); + } + } + TraCI_Vehicle::setStop(id, edgeID, pos, laneIndex, waitTime, stopFlags, startPos, until); } - } - break; - case CMD_RESUME: { - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - server.writeStatusCmd(CMD_SET_VEHICLE_VARIABLE, RTYPE_ERR, "Resuming requires a compound object.", outputStorage); - return false; - } - if (inputStorage.readInt() != 0) { - server.writeStatusCmd(CMD_SET_VEHICLE_VARIABLE, RTYPE_ERR, "Resuming should obtain an empty compound object.", outputStorage); - return false; - } - if (!static_cast(v)->hasStops()) { - server.writeStatusCmd(CMD_SET_VEHICLE_VARIABLE, RTYPE_ERR, "Failed to resume vehicle '" + v->getID() + "', it has no stops.", outputStorage); - return false; - } - if (!static_cast(v)->resumeFromStopping()) { - MSVehicle::Stop& sto = (static_cast(v))->getNextStop(); - std::ostringstream strs; - strs << "reached: " << sto.reached; - strs << ", duration:" << sto.duration; - strs << ", edge:" << (*sto.edge)->getID(); - strs << ", startPos: " << sto.startPos; - std::string posStr = strs.str(); - server.writeStatusCmd(CMD_SET_VEHICLE_VARIABLE, RTYPE_ERR, "Failed to resume a non parking vehicle '" + v->getID() + "', " + posStr, outputStorage); - return false; - } - } - break; - case CMD_CHANGELANE: { - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Lane change needs a compound object description.", outputStorage); - } - if (inputStorage.readInt() != 2) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Lane change needs a compound object description of two items.", outputStorage); - } - // Lane ID - int laneIndex = 0; - if (!server.readTypeCheckingByte(inputStorage, laneIndex)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The first lane change parameter must be the lane index given as a byte.", outputStorage); - } - // stickyTime - int stickyTime = 0; - if (!server.readTypeCheckingInt(inputStorage, stickyTime)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The second lane change parameter must be the duration given as an integer.", outputStorage); - } - if ((laneIndex < 0) || (laneIndex >= (int)(v->getEdge()->getLanes().size()))) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "No lane with index '" + toString(laneIndex) + "' on road '" + v->getEdge()->getID() + "'.", outputStorage); + break; + case CMD_RESUME: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + server.writeStatusCmd(CMD_SET_VEHICLE_VARIABLE, RTYPE_ERR, "Resuming requires a compound object.", outputStorage); + return false; + } + if (inputStorage.readInt() != 0) { + server.writeStatusCmd(CMD_SET_VEHICLE_VARIABLE, RTYPE_ERR, "Resuming should obtain an empty compound object.", outputStorage); + return false; + } + TraCI_Vehicle::resume(id); } - // Forward command to vehicle - std::vector > laneTimeLine; - laneTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep(), laneIndex)); - laneTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep() + stickyTime, laneIndex)); - v->getInfluencer().setLaneTimeLine(laneTimeLine); - } - break; - /* - case VAR_LANE_TIME_LINE: { - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Lane change needs a compound object description.", outputStorage); + break; + case CMD_CHANGELANE: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Lane change needs a compound object description.", outputStorage); + } + if (inputStorage.readInt() != 2) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Lane change needs a compound object description of two items.", outputStorage); + } + // Lane ID + int laneIndex = 0; + if (!server.readTypeCheckingByte(inputStorage, laneIndex)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The first lane change parameter must be the lane index given as a byte.", outputStorage); + } + // stickyTime + int stickyTime = 0; + if (!server.readTypeCheckingInt(inputStorage, stickyTime)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The second lane change parameter must be the duration given as an integer.", outputStorage); + } + if ((laneIndex < 0) || (laneIndex >= (int)(v->getEdge()->getLanes().size()))) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "No lane with index '" + toString(laneIndex) + "' on road '" + v->getEdge()->getID() + "'.", outputStorage); + } + // Forward command to vehicle + std::vector > laneTimeLine; + laneTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep(), laneIndex)); + laneTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep() + stickyTime, laneIndex)); + v->getInfluencer().setLaneTimeLine(laneTimeLine); } - if (inputStorage.readInt() != 2) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Lane change needs a compound object description of two items.", outputStorage); + break; + case CMD_CHANGESUBLANE: { + double latDist = 0; + if (!server.readTypeCheckingDouble(inputStorage, latDist)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Sublane-changing requires a double.", outputStorage); + } + v->getInfluencer().setSublaneChange(latDist); } + break; + /* + case VAR_LANE_TIME_LINE: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Lane change needs a compound object description.", outputStorage); + } + if (inputStorage.readInt() != 2) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Lane change needs a compound object description of two items.", outputStorage); + } // Lane ID int laneIndex = 0; if (!server.readTypeCheckingByte(inputStorage, laneIndex)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The first lane change parameter must be the lane index given as a byte.", outputStorage); + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The first lane change parameter must be the lane index given as a byte.", outputStorage); } // stickyTime SUMOTime stickyTime = 0; if (!server.readTypeCheckingInt(inputStorage, stickyTime)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The second lane change parameter must be the duration given as an integer.", outputStorage); + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The second lane change parameter must be the duration given as an integer.", outputStorage); } if ((laneIndex < 0) || (laneIndex >= (int)(v->getEdge()->getLanes().size()))) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "No lane existing with given id on the current road", outputStorage); + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "No lane existing with given id on the current road", outputStorage); } // Forward command to vehicle std::vector > laneTimeLine; @@ -702,761 +648,816 @@ laneTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep() + stickyTime, laneIndex)); v->getInfluencer().setLaneTimeLine(laneTimeLine); MSVehicle::ChangeRequest req = v->getInfluencer().checkForLaneChanges(MSNet::getInstance()->getCurrentTimeStep(), - *v->getEdge(), v->getLaneIndex()); - v->getLaneChangeModel().requestLaneChange(req); - } - break; - */ - case CMD_SLOWDOWN: { - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Slow down needs a compound object description.", outputStorage); - } - if (inputStorage.readInt() != 2) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Slow down needs a compound object description of two items.", outputStorage); - } - double newSpeed = 0; - if (!server.readTypeCheckingDouble(inputStorage, newSpeed)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The first slow down parameter must be the speed given as a double.", outputStorage); - } - if (newSpeed < 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Speed must not be negative", outputStorage); - } - int duration = 0; - if (!server.readTypeCheckingInt(inputStorage, duration)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The second slow down parameter must be the duration given as an integer.", outputStorage); - } - if (duration < 0 || STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()) + STEPS2TIME(duration) > STEPS2TIME(SUMOTime_MAX - DELTA_T)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Invalid time interval", outputStorage); - } - std::vector > speedTimeLine; - speedTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep(), v->getSpeed())); - speedTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep() + duration, newSpeed)); - v->getInfluencer().setSpeedTimeLine(speedTimeLine); - } - break; - case CMD_CHANGETARGET: { - std::string edgeID; - if (!server.readTypeCheckingString(inputStorage, edgeID)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Change target requires a string containing the id of the new destination edge as parameter.", outputStorage); - } - const MSEdge* destEdge = MSEdge::dictionary(edgeID); - if (destEdge == 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Can not retrieve road with ID " + edgeID, outputStorage); - } - // build a new route between the vehicle's current edge and destination edge - ConstMSEdgeVector newRoute; - const MSEdge* currentEdge = v->getRerouteOrigin(); - MSNet::getInstance()->getRouterTT().compute( - currentEdge, destEdge, (const MSVehicle * const) v, MSNet::getInstance()->getCurrentTimeStep(), newRoute); - // replace the vehicle's route by the new one - if (!v->replaceRouteEdges(newRoute, v->getLane() == 0)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Route replacement failed for " + v->getID(), outputStorage); - } - } - break; - case VAR_TYPE: { - std::string vTypeID; - if (!server.readTypeCheckingString(inputStorage, vTypeID)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The vehicle type id must be given as a string.", outputStorage); - } - MSVehicleType* vehicleType = MSNet::getInstance()->getVehicleControl().getVType(vTypeID); - if (vehicleType == 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The vehicle type '" + vTypeID + "' is not known.", outputStorage); - } - v->replaceVehicleType(vehicleType); - } - break; - case VAR_ROUTE_ID: { - std::string rid; - if (!server.readTypeCheckingString(inputStorage, rid)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The route id must be given as a string.", outputStorage); - } - const MSRoute* r = MSRoute::dictionary(rid); - if (r == 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The route '" + rid + "' is not known.", outputStorage); - } - std::string msg; - if (!v->hasValidRoute(msg, r)) { - WRITE_WARNING("Invalid route replacement for vehicle '" + v->getID() + "'. " + msg); - if (MSGlobals::gCheckRoutes) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Route replacement failed for " + v->getID(), outputStorage); + *v->getEdge(), v->getLaneIndex()); + v->getLaneChangeModel().requestLaneChange(req); + } + break; + */ + case CMD_SLOWDOWN: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Slow down needs a compound object description.", outputStorage); } - } - - if (!v->replaceRoute(r, v->getLane() == 0)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Route replacement failed for " + v->getID(), outputStorage); - } - } - break; - case VAR_ROUTE: { - std::vector edgeIDs; - if (!server.readTypeCheckingStringList(inputStorage, edgeIDs)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "A route must be defined as a list of edge ids.", outputStorage); - } - ConstMSEdgeVector edges; - MSEdge::parseEdgesList(edgeIDs, edges, ""); - if (!v->replaceRouteEdges(edges, v->getLane() == 0, true)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Route replacement failed for " + v->getID(), outputStorage); - } - } - break; - case VAR_EDGE_TRAVELTIME: { - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time requires a compound object.", outputStorage); - } - int parameterCount = inputStorage.readInt(); - if (parameterCount == 4) { - // begin time - int begTime = 0, endTime = 0; - if (!server.readTypeCheckingInt(inputStorage, begTime)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time using 4 parameters requires the begin time as first parameter.", outputStorage); - } - // begin time - if (!server.readTypeCheckingInt(inputStorage, endTime)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time using 4 parameters requires the end time as second parameter.", outputStorage); + if (inputStorage.readInt() != 2) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Slow down needs a compound object description of two items.", outputStorage); } - // edge + double newSpeed = 0; + if (!server.readTypeCheckingDouble(inputStorage, newSpeed)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The first slow down parameter must be the speed given as a double.", outputStorage); + } + if (newSpeed < 0) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Speed must not be negative", outputStorage); + } + int duration = 0; + if (!server.readTypeCheckingInt(inputStorage, duration)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The second slow down parameter must be the duration given as an integer.", outputStorage); + } + if (duration < 0 || STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()) + STEPS2TIME(duration) > STEPS2TIME(SUMOTime_MAX - DELTA_T)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Invalid time interval", outputStorage); + } + std::vector > speedTimeLine; + speedTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep(), v->getSpeed())); + speedTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep() + duration, newSpeed)); + v->getInfluencer().setSpeedTimeLine(speedTimeLine); + } + break; + case CMD_CHANGETARGET: { std::string edgeID; if (!server.readTypeCheckingString(inputStorage, edgeID)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time using 4 parameters requires the referenced edge as third parameter.", outputStorage); + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Change target requires a string containing the id of the new destination edge as parameter.", outputStorage); } - MSEdge* edge = MSEdge::dictionary(edgeID); - if (edge == 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Referenced edge '" + edgeID + "' is not known.", outputStorage); - } - // value - double value = 0; - if (!server.readTypeCheckingDouble(inputStorage, value)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time using 4 parameters requires the travel time as double as fourth parameter.", outputStorage); - } - // retrieve - v->getWeightsStorage().addTravelTime(edge, begTime, endTime, value); - } else if (parameterCount == 2) { - // edge - std::string edgeID; - if (!server.readTypeCheckingString(inputStorage, edgeID)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time using 2 parameters requires the referenced edge as first parameter.", outputStorage); + const MSEdge* destEdge = MSEdge::dictionary(edgeID); + if (destEdge == 0) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Can not retrieve road with ID " + edgeID, outputStorage); + } + // build a new route between the vehicle's current edge and destination edge + ConstMSEdgeVector newRoute; + const MSEdge* currentEdge = v->getRerouteOrigin(); + MSNet::getInstance()->getRouterTT().compute( + currentEdge, destEdge, (const MSVehicle * const) v, MSNet::getInstance()->getCurrentTimeStep(), newRoute); + // replace the vehicle's route by the new one + if (!v->replaceRouteEdges(newRoute, onInit)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Route replacement failed for " + v->getID(), outputStorage); } - MSEdge* edge = MSEdge::dictionary(edgeID); - if (edge == 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Referenced edge '" + edgeID + "' is not known.", outputStorage); - } - // value - double value = 0; - if (!server.readTypeCheckingDouble(inputStorage, value)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time using 2 parameters requires the travel time as second parameter.", outputStorage); + // route again to ensure usage of via/stops + try { + v->reroute(MSNet::getInstance()->getCurrentTimeStep(), MSNet::getInstance()->getRouterTT(), onInit); + } catch (ProcessError& e) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, e.what(), outputStorage); } - // retrieve - while (v->getWeightsStorage().knowsTravelTime(edge)) { - v->getWeightsStorage().removeTravelTime(edge); + } + break; + case VAR_TYPE: { + std::string vTypeID; + if (!server.readTypeCheckingString(inputStorage, vTypeID)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The vehicle type id must be given as a string.", outputStorage); + } + MSVehicleType* vehicleType = MSNet::getInstance()->getVehicleControl().getVType(vTypeID); + if (vehicleType == 0) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The vehicle type '" + vTypeID + "' is not known.", outputStorage); } - v->getWeightsStorage().addTravelTime(edge, SUMOReal(0), SUMOReal(SUMOTime_MAX), value); - } else if (parameterCount == 1) { - // edge - std::string edgeID; - if (!server.readTypeCheckingString(inputStorage, edgeID)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time using 1 parameter requires the referenced edge as first parameter.", outputStorage); + v->replaceVehicleType(vehicleType); + } + break; + case VAR_ROUTE_ID: { + std::string rid; + if (!server.readTypeCheckingString(inputStorage, rid)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The route id must be given as a string.", outputStorage); + } + const MSRoute* r = MSRoute::dictionary(rid); + if (r == 0) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The route '" + rid + "' is not known.", outputStorage); } - MSEdge* edge = MSEdge::dictionary(edgeID); - if (edge == 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Referenced edge '" + edgeID + "' is not known.", outputStorage); + std::string msg; + if (!v->hasValidRoute(msg, r)) { + WRITE_WARNING("Invalid route replacement for vehicle '" + v->getID() + "'. " + msg); + if (MSGlobals::gCheckRoutes) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Route replacement failed for " + v->getID(), outputStorage); + } } - // retrieve - while (v->getWeightsStorage().knowsTravelTime(edge)) { - v->getWeightsStorage().removeTravelTime(edge); + + if (!v->replaceRoute(r, v->getLane() == 0)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Route replacement failed for " + v->getID(), outputStorage); } - } else { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time requires 1, 2, or 4 parameters.", outputStorage); } - } - break; - case VAR_EDGE_EFFORT: { - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort requires a compound object.", outputStorage); - } - int parameterCount = inputStorage.readInt(); - if (parameterCount == 4) { - // begin time - int begTime = 0, endTime = 0; - if (!server.readTypeCheckingInt(inputStorage, begTime)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort using 4 parameters requires the begin time as first parameter.", outputStorage); - } - // begin time - if (!server.readTypeCheckingInt(inputStorage, endTime)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort using 4 parameters requires the end time as second parameter.", outputStorage); + break; + case VAR_ROUTE: { + std::vector edgeIDs; + if (!server.readTypeCheckingStringList(inputStorage, edgeIDs)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "A route must be defined as a list of edge ids.", outputStorage); + } + ConstMSEdgeVector edges; + MSEdge::parseEdgesList(edgeIDs, edges, ""); + if (!v->replaceRouteEdges(edges, v->getLane() == 0, true)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Route replacement failed for " + v->getID(), outputStorage); } - // edge - std::string edgeID; - if (!server.readTypeCheckingString(inputStorage, edgeID)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort using 4 parameters requires the referenced edge as third parameter.", outputStorage); + } + break; + case VAR_EDGE_TRAVELTIME: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time requires a compound object.", outputStorage); } - MSEdge* edge = MSEdge::dictionary(edgeID); - if (edge == 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Referenced edge '" + edgeID + "' is not known.", outputStorage); - } - // value - double value = 0; - if (!server.readTypeCheckingDouble(inputStorage, value)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort using 4 parameters requires the travel time as fourth parameter.", outputStorage); + int parameterCount = inputStorage.readInt(); + if (parameterCount == 4) { + // begin time + int begTime = 0, endTime = 0; + if (!server.readTypeCheckingInt(inputStorage, begTime)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time using 4 parameters requires the begin time as first parameter.", outputStorage); + } + // begin time + if (!server.readTypeCheckingInt(inputStorage, endTime)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time using 4 parameters requires the end time as second parameter.", outputStorage); + } + // edge + std::string edgeID; + if (!server.readTypeCheckingString(inputStorage, edgeID)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time using 4 parameters requires the referenced edge as third parameter.", outputStorage); + } + MSEdge* edge = MSEdge::dictionary(edgeID); + if (edge == 0) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Referenced edge '" + edgeID + "' is not known.", outputStorage); + } + // value + double value = 0; + if (!server.readTypeCheckingDouble(inputStorage, value)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time using 4 parameters requires the travel time as double as fourth parameter.", outputStorage); + } + // retrieve + v->getWeightsStorage().addTravelTime(edge, begTime, endTime, value); + } else if (parameterCount == 2) { + // edge + std::string edgeID; + if (!server.readTypeCheckingString(inputStorage, edgeID)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time using 2 parameters requires the referenced edge as first parameter.", outputStorage); + } + MSEdge* edge = MSEdge::dictionary(edgeID); + if (edge == 0) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Referenced edge '" + edgeID + "' is not known.", outputStorage); + } + // value + double value = 0; + if (!server.readTypeCheckingDouble(inputStorage, value)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time using 2 parameters requires the travel time as second parameter.", outputStorage); + } + // retrieve + while (v->getWeightsStorage().knowsTravelTime(edge)) { + v->getWeightsStorage().removeTravelTime(edge); + } + v->getWeightsStorage().addTravelTime(edge, 0., double(SUMOTime_MAX), value); + } else if (parameterCount == 1) { + // edge + std::string edgeID; + if (!server.readTypeCheckingString(inputStorage, edgeID)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time using 1 parameter requires the referenced edge as first parameter.", outputStorage); + } + MSEdge* edge = MSEdge::dictionary(edgeID); + if (edge == 0) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Referenced edge '" + edgeID + "' is not known.", outputStorage); + } + // retrieve + while (v->getWeightsStorage().knowsTravelTime(edge)) { + v->getWeightsStorage().removeTravelTime(edge); + } + } else { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time requires 1, 2, or 4 parameters.", outputStorage); } - // retrieve - v->getWeightsStorage().addEffort(edge, begTime, endTime, value); - } else if (parameterCount == 2) { - // edge - std::string edgeID; - if (!server.readTypeCheckingString(inputStorage, edgeID)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort using 2 parameters requires the referenced edge as first parameter.", outputStorage); + } + break; + case VAR_EDGE_EFFORT: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort requires a compound object.", outputStorage); } - MSEdge* edge = MSEdge::dictionary(edgeID); - if (edge == 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Referenced edge '" + edgeID + "' is not known.", outputStorage); - } - // value - double value = 0; - if (!server.readTypeCheckingDouble(inputStorage, value)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort using 2 parameters requires the travel time as second parameter.", outputStorage); + int parameterCount = inputStorage.readInt(); + if (parameterCount == 4) { + // begin time + int begTime = 0, endTime = 0; + if (!server.readTypeCheckingInt(inputStorage, begTime)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort using 4 parameters requires the begin time as first parameter.", outputStorage); + } + // begin time + if (!server.readTypeCheckingInt(inputStorage, endTime)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort using 4 parameters requires the end time as second parameter.", outputStorage); + } + // edge + std::string edgeID; + if (!server.readTypeCheckingString(inputStorage, edgeID)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort using 4 parameters requires the referenced edge as third parameter.", outputStorage); + } + MSEdge* edge = MSEdge::dictionary(edgeID); + if (edge == 0) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Referenced edge '" + edgeID + "' is not known.", outputStorage); + } + // value + double value = 0; + if (!server.readTypeCheckingDouble(inputStorage, value)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort using 4 parameters requires the travel time as fourth parameter.", outputStorage); + } + // retrieve + v->getWeightsStorage().addEffort(edge, begTime, endTime, value); + } else if (parameterCount == 2) { + // edge + std::string edgeID; + if (!server.readTypeCheckingString(inputStorage, edgeID)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort using 2 parameters requires the referenced edge as first parameter.", outputStorage); + } + MSEdge* edge = MSEdge::dictionary(edgeID); + if (edge == 0) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Referenced edge '" + edgeID + "' is not known.", outputStorage); + } + // value + double value = 0; + if (!server.readTypeCheckingDouble(inputStorage, value)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort using 2 parameters requires the travel time as second parameter.", outputStorage); + } + // retrieve + while (v->getWeightsStorage().knowsEffort(edge)) { + v->getWeightsStorage().removeEffort(edge); + } + v->getWeightsStorage().addEffort(edge, 0., double(SUMOTime_MAX), value); + } else if (parameterCount == 1) { + // edge + std::string edgeID; + if (!server.readTypeCheckingString(inputStorage, edgeID)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort using 1 parameter requires the referenced edge as first parameter.", outputStorage); + } + MSEdge* edge = MSEdge::dictionary(edgeID); + if (edge == 0) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Referenced edge '" + edgeID + "' is not known.", outputStorage); + } + // retrieve + while (v->getWeightsStorage().knowsEffort(edge)) { + v->getWeightsStorage().removeEffort(edge); + } + } else { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort requires 1, 2, or 4 parameters.", outputStorage); } - // retrieve - while (v->getWeightsStorage().knowsEffort(edge)) { - v->getWeightsStorage().removeEffort(edge); + } + break; + case CMD_REROUTE_TRAVELTIME: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Rerouting requires a compound object.", outputStorage); } - v->getWeightsStorage().addEffort(edge, SUMOReal(0), SUMOReal(SUMOTime_MAX), value); - } else if (parameterCount == 1) { - // edge - std::string edgeID; - if (!server.readTypeCheckingString(inputStorage, edgeID)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort using 1 parameter requires the referenced edge as first parameter.", outputStorage); + if (inputStorage.readInt() != 0) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Rerouting should obtain an empty compound object.", outputStorage); } - MSEdge* edge = MSEdge::dictionary(edgeID); - if (edge == 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Referenced edge '" + edgeID + "' is not known.", outputStorage); + v->reroute(MSNet::getInstance()->getCurrentTimeStep(), MSNet::getInstance()->getRouterTT(), onInit); + } + break; + case CMD_REROUTE_EFFORT: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Rerouting requires a compound object.", outputStorage); } - // retrieve - while (v->getWeightsStorage().knowsEffort(edge)) { - v->getWeightsStorage().removeEffort(edge); + if (inputStorage.readInt() != 0) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Rerouting should obtain an empty compound object.", outputStorage); } - } else { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort requires 1, 2, or 4 parameters.", outputStorage); + v->reroute(MSNet::getInstance()->getCurrentTimeStep(), MSNet::getInstance()->getRouterEffort(), onInit); } - } - break; - case CMD_REROUTE_TRAVELTIME: { - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Rerouting requires a compound object.", outputStorage); - } - if (inputStorage.readInt() != 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Rerouting should obtain an empty compound object.", outputStorage); - } - v->reroute(MSNet::getInstance()->getCurrentTimeStep(), MSNet::getInstance()->getRouterTT()); - } - break; - case CMD_REROUTE_EFFORT: { - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Rerouting requires a compound object.", outputStorage); - } - if (inputStorage.readInt() != 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Rerouting should obtain an empty compound object.", outputStorage); - } - v->reroute(MSNet::getInstance()->getCurrentTimeStep(), MSNet::getInstance()->getRouterEffort()); - } - break; - case VAR_SIGNALS: { - int signals = 0; - if (!server.readTypeCheckingInt(inputStorage, signals)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting signals requires an integer.", outputStorage); - } - v->switchOffSignal(0x0fffffff); - v->switchOnSignal(signals); - } - break; - case VAR_MOVE_TO: { - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting position requires a compound object.", outputStorage); - } - if (inputStorage.readInt() != 2) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting position should obtain the lane id and the position.", outputStorage); - } - // lane ID - std::string laneID; - if (!server.readTypeCheckingString(inputStorage, laneID)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The first parameter for setting a position must be the lane ID given as a string.", outputStorage); - } - // position on lane - double position = 0; - if (!server.readTypeCheckingDouble(inputStorage, position)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The second parameter for setting a position must be the position given as a double.", outputStorage); - } - // process - MSLane* l = MSLane::dictionary(laneID); - if (l == 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Unknown lane '" + laneID + "'.", outputStorage); - } - MSEdge& destinationEdge = l->getEdge(); - if (!v->willPass(&destinationEdge)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Vehicle '" + laneID + "' may be set onto an edge to pass only.", outputStorage); - } - v->onRemovalFromNet(MSMoveReminder::NOTIFICATION_TELEPORT); - if (v->getLane() != 0) { - v->getLane()->removeVehicle(v, MSMoveReminder::NOTIFICATION_TELEPORT); - } else { - v->setTentativeLaneAndPosition(l, position); - } - while (v->getEdge() != &destinationEdge) { - const MSEdge* nextEdge = v->succEdge(1); - // let the vehicle move to the next edge - if (v->enterLaneAtMove(nextEdge->getLanes()[0], true)) { - MSNet::getInstance()->getVehicleControl().scheduleVehicleRemoval(v); - continue; + break; + case VAR_SIGNALS: { + int signals = 0; + if (!server.readTypeCheckingInt(inputStorage, signals)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting signals requires an integer.", outputStorage); + } + // set influencer to make the change persistent + v->getInfluencer().setSignals(signals); + // set them now so that getSignals returns the correct value + v->switchOffSignal(0x0fffffff); + if (signals >= 0) { + v->switchOnSignal(signals); } - } - if (!v->isOnRoad()) { - MSNet::getInstance()->getInsertionControl().alreadyDeparted(v); } - l->forceVehicleInsertion(v, position, MSMoveReminder::NOTIFICATION_TELEPORT); - } - break; - case VAR_SPEED: { - double speed = 0; - if (!server.readTypeCheckingDouble(inputStorage, speed)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting speed requires a double.", outputStorage); - } - std::vector > speedTimeLine; - if (speed >= 0) { - speedTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep(), speed)); - speedTimeLine.push_back(std::make_pair(SUMOTime_MAX - DELTA_T, speed)); - } - v->getInfluencer().setSpeedTimeLine(speedTimeLine); - } - break; - case VAR_SPEEDSETMODE: { - int speedMode = 0; - if (!server.readTypeCheckingInt(inputStorage, speedMode)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting speed mode requires an integer.", outputStorage); - } - v->getInfluencer().setConsiderSafeVelocity((speedMode & 1) != 0); - v->getInfluencer().setConsiderMaxAcceleration((speedMode & 2) != 0); - v->getInfluencer().setConsiderMaxDeceleration((speedMode & 4) != 0); - v->getInfluencer().setRespectJunctionPriority((speedMode & 8) != 0); - v->getInfluencer().setEmergencyBrakeRedLight((speedMode & 16) != 0); - } - break; - case VAR_LANECHANGE_MODE: { - int laneChangeMode = 0; - if (!server.readTypeCheckingInt(inputStorage, laneChangeMode)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting lane change mode requires an integer.", outputStorage); + break; + case VAR_MOVE_TO: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting position requires a compound object.", outputStorage); + } + if (inputStorage.readInt() != 2) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting position should obtain the lane id and the position.", outputStorage); + } + // lane ID + std::string laneID; + if (!server.readTypeCheckingString(inputStorage, laneID)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The first parameter for setting a position must be the lane ID given as a string.", outputStorage); + } + // position on lane + double position = 0; + if (!server.readTypeCheckingDouble(inputStorage, position)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The second parameter for setting a position must be the position given as a double.", outputStorage); + } + // process + MSLane* l = MSLane::dictionary(laneID); + if (l == 0) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Unknown lane '" + laneID + "'.", outputStorage); + } + MSEdge& destinationEdge = l->getEdge(); + if (!v->willPass(&destinationEdge)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Vehicle '" + laneID + "' may be set onto an edge to pass only.", outputStorage); + } + v->onRemovalFromNet(MSMoveReminder::NOTIFICATION_TELEPORT); + if (v->getLane() != 0) { + v->getLane()->removeVehicle(v, MSMoveReminder::NOTIFICATION_TELEPORT); + } else { + v->setTentativeLaneAndPosition(l, position); + } + while (v->getEdge() != &destinationEdge) { + const MSEdge* nextEdge = v->succEdge(1); + // let the vehicle move to the next edge + if (v->enterLaneAtMove(nextEdge->getLanes()[0], true)) { + MSNet::getInstance()->getVehicleControl().scheduleVehicleRemoval(v); + continue; + } + } + if (!v->isOnRoad()) { + MSNet::getInstance()->getInsertionControl().alreadyDeparted(v); + + } + l->forceVehicleInsertion(v, position, MSMoveReminder::NOTIFICATION_TELEPORT); } - v->getInfluencer().setLaneChangeMode(laneChangeMode); - } - break; - case VAR_COLOR: { - RGBColor col; - if (!server.readTypeCheckingColor(inputStorage, col)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The color must be given using the according type.", outputStorage); + break; + case VAR_SPEED: { + double speed = 0; + if (!server.readTypeCheckingDouble(inputStorage, speed)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting speed requires a double.", outputStorage); + } + std::vector > speedTimeLine; + if (speed >= 0) { + speedTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep(), speed)); + speedTimeLine.push_back(std::make_pair(SUMOTime_MAX - DELTA_T, speed)); + } + v->getInfluencer().setSpeedTimeLine(speedTimeLine); } - v->getParameter().color.set(col.red(), col.green(), col.blue(), col.alpha()); - v->getParameter().setParameter |= VEHPARS_COLOR_SET; - } - break; - case ADD: { - if (v != 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The vehicle " + id + " to add already exists.", outputStorage); + break; + case VAR_SPEEDSETMODE: { + int speedMode = 0; + if (!server.readTypeCheckingInt(inputStorage, speedMode)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting speed mode requires an integer.", outputStorage); + } + v->getInfluencer().setSpeedMode(speedMode); } - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Adding a vehicle requires a compound object.", outputStorage); + break; + case VAR_LANECHANGE_MODE: { + int laneChangeMode = 0; + if (!server.readTypeCheckingInt(inputStorage, laneChangeMode)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting lane change mode requires an integer.", outputStorage); + } + v->getInfluencer().setLaneChangeMode(laneChangeMode); } - if (inputStorage.readInt() != 6) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Adding a vehicle needs six parameters.", outputStorage); + break; + case VAR_COLOR: { + TraCIColor col; + if (!server.readTypeCheckingColor(inputStorage, col)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The color must be given using the according type.", outputStorage); + } + v->getParameter().color.set(col.r, col.g, col.b, col.a); + v->getParameter().setParameter |= VEHPARS_COLOR_SET; } - SUMOVehicleParameter vehicleParams; - vehicleParams.id = id; + break; + case ADD: { + if (v != 0) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The vehicle " + id + " to add already exists.", outputStorage); + } + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Adding a vehicle requires a compound object.", outputStorage); + } + if (inputStorage.readInt() != 6) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Adding a vehicle needs six parameters.", outputStorage); + } + SUMOVehicleParameter vehicleParams; + vehicleParams.id = id; - std::string vTypeID; - if (!server.readTypeCheckingString(inputStorage, vTypeID)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "First parameter (type) requires a string.", outputStorage); - } - MSVehicleType* vehicleType = MSNet::getInstance()->getVehicleControl().getVType(vTypeID); - if (!vehicleType) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Invalid type '" + vTypeID + "' for vehicle '" + id + "'", outputStorage); - } + std::string vTypeID; + if (!server.readTypeCheckingString(inputStorage, vTypeID)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "First parameter (type) requires a string.", outputStorage); + } + MSVehicleType* vehicleType = MSNet::getInstance()->getVehicleControl().getVType(vTypeID); + if (!vehicleType) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Invalid type '" + vTypeID + "' for vehicle '" + id + "'", outputStorage); + } - std::string routeID; - if (!server.readTypeCheckingString(inputStorage, routeID)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Second parameter (route) requires a string.", outputStorage); - } - const MSRoute* route = MSRoute::dictionary(routeID); - if (!route) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Invalid route '" + routeID + "' for vehicle: '" + id + "'", outputStorage); - } - int depart; - if (!server.readTypeCheckingInt(inputStorage, depart)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Third parameter (depart) requires an integer.", outputStorage); - } - if (depart < 0) { - const int proc = -depart; - if (proc >= static_cast(DEPART_DEF_MAX)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Invalid departure time.", outputStorage); + std::string routeID; + if (!server.readTypeCheckingString(inputStorage, routeID)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Second parameter (route) requires a string.", outputStorage); + } + const MSRoute* route = MSRoute::dictionary(routeID); + if (!route) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Invalid route '" + routeID + "' for vehicle: '" + id + "'", outputStorage); + } + int depart; + if (!server.readTypeCheckingInt(inputStorage, depart)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Third parameter (depart) requires an integer.", outputStorage); + } + if (depart < 0) { + const int proc = -depart; + if (proc >= static_cast(DEPART_DEF_MAX)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Invalid departure time.", outputStorage); + } + vehicleParams.departProcedure = (DepartDefinition)proc; + vehicleParams.depart = MSNet::getInstance()->getCurrentTimeStep(); + } else if (depart < MSNet::getInstance()->getCurrentTimeStep()) { + vehicleParams.depart = MSNet::getInstance()->getCurrentTimeStep(); + WRITE_WARNING("Departure time for vehicle '" + id + "' is in the past; using current time instead."); + } else { + vehicleParams.depart = depart; } - vehicleParams.departProcedure = (DepartDefinition)proc; - vehicleParams.depart = MSNet::getInstance()->getCurrentTimeStep(); - } else if (depart < MSNet::getInstance()->getCurrentTimeStep()) { - vehicleParams.depart = MSNet::getInstance()->getCurrentTimeStep(); - WRITE_WARNING("Departure time for vehicle '" + id + "' is in the past; using current time instead."); - } else { - vehicleParams.depart = depart; - } - double pos; - if (!server.readTypeCheckingDouble(inputStorage, pos)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Fourth parameter (position) requires a double.", outputStorage); - } - vehicleParams.departPos = pos; - if (vehicleParams.departPos < 0) { - const int proc = static_cast(-vehicleParams.departPos); - if (fabs(proc + vehicleParams.departPos) > NUMERICAL_EPS || proc >= static_cast(DEPART_POS_DEF_MAX) || proc == static_cast(DEPART_POS_GIVEN)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Invalid departure position.", outputStorage); + double pos; + if (!server.readTypeCheckingDouble(inputStorage, pos)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Fourth parameter (position) requires a double.", outputStorage); + } + vehicleParams.departPos = pos; + if (vehicleParams.departPos < 0) { + const int proc = static_cast(-vehicleParams.departPos); + if (fabs(proc + vehicleParams.departPos) > NUMERICAL_EPS || proc >= static_cast(DEPART_POS_DEF_MAX) || proc == static_cast(DEPART_POS_GIVEN)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Invalid departure position.", outputStorage); + } + vehicleParams.departPosProcedure = (DepartPosDefinition)proc; + } else { + vehicleParams.departPosProcedure = DEPART_POS_GIVEN; } - vehicleParams.departPosProcedure = (DepartPosDefinition)proc; - } else { - vehicleParams.departPosProcedure = DEPART_POS_GIVEN; - } - double speed; - if (!server.readTypeCheckingDouble(inputStorage, speed)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Fifth parameter (speed) requires a double.", outputStorage); - } - vehicleParams.departSpeed = speed; - if (vehicleParams.departSpeed < 0) { - const int proc = static_cast(-vehicleParams.departSpeed); - if (proc >= static_cast(DEPART_SPEED_DEF_MAX)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Invalid departure speed.", outputStorage); + double speed; + if (!server.readTypeCheckingDouble(inputStorage, speed)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Fifth parameter (speed) requires a double.", outputStorage); + } + vehicleParams.departSpeed = speed; + if (vehicleParams.departSpeed < 0) { + const int proc = static_cast(-vehicleParams.departSpeed); + if (proc >= static_cast(DEPART_SPEED_DEF_MAX)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Invalid departure speed.", outputStorage); + } + vehicleParams.departSpeedProcedure = (DepartSpeedDefinition)proc; + } else { + vehicleParams.departSpeedProcedure = DEPART_SPEED_GIVEN; } - vehicleParams.departSpeedProcedure = (DepartSpeedDefinition)proc; - } else { - vehicleParams.departSpeedProcedure = DEPART_SPEED_GIVEN; - } - if (!server.readTypeCheckingByte(inputStorage, vehicleParams.departLane)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Sixth parameter (lane) requires a byte.", outputStorage); - } + if (!server.readTypeCheckingByte(inputStorage, vehicleParams.departLane)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Sixth parameter (lane) requires a byte.", outputStorage); + } - if (vehicleParams.departLane < 0) { - const int proc = static_cast(-vehicleParams.departLane); - if (proc >= static_cast(DEPART_LANE_DEF_MAX)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Invalid departure lane.", outputStorage); + if (vehicleParams.departLane < 0) { + const int proc = static_cast(-vehicleParams.departLane); + if (proc >= static_cast(DEPART_LANE_DEF_MAX)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Invalid departure lane.", outputStorage); + } + vehicleParams.departLaneProcedure = (DepartLaneDefinition)proc; + } else { + vehicleParams.departLaneProcedure = DEPART_LANE_GIVEN; } - vehicleParams.departLaneProcedure = (DepartLaneDefinition)proc; - } else { - vehicleParams.departLaneProcedure = DEPART_LANE_GIVEN; - } - SUMOVehicleParameter* params = new SUMOVehicleParameter(vehicleParams); - try { - SUMOVehicle* vehicle = MSNet::getInstance()->getVehicleControl().buildVehicle(params, route, vehicleType, true, false); - MSNet::getInstance()->getVehicleControl().addVehicle(vehicleParams.id, vehicle); - MSNet::getInstance()->getInsertionControl().add(vehicle); - } catch (ProcessError& e) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, e.what(), outputStorage); - } - } - break; - case ADD_FULL: { - if (v != 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The vehicle " + id + " to add already exists.", outputStorage); - } - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Adding a vehicle requires a compound object.", outputStorage); - } - if (inputStorage.readInt() != 14) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Adding a fully specified vehicle needs fourteen parameters.", outputStorage); + SUMOVehicleParameter* params = new SUMOVehicleParameter(vehicleParams); + try { + SUMOVehicle* vehicle = MSNet::getInstance()->getVehicleControl().buildVehicle(params, route, vehicleType, true, false); + MSNet::getInstance()->getVehicleControl().addVehicle(vehicleParams.id, vehicle); + MSNet::getInstance()->getInsertionControl().add(vehicle); + } catch (ProcessError& e) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, e.what(), outputStorage); + } } - SUMOVehicleParameter vehicleParams; - vehicleParams.id = id; + break; + case ADD_FULL: { + if (v != 0) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The vehicle " + id + " to add already exists.", outputStorage); + } + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Adding a vehicle requires a compound object.", outputStorage); + } + if (inputStorage.readInt() != 14) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Adding a fully specified vehicle needs fourteen parameters.", outputStorage); + } + SUMOVehicleParameter vehicleParams; + vehicleParams.id = id; - std::string routeID; - if (!server.readTypeCheckingString(inputStorage, routeID)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Second parameter (route) requires a string.", outputStorage); - } - const MSRoute* route = MSRoute::dictionary(routeID); - if (!route) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Invalid route '" + routeID + "' for vehicle: '" + id + "'", outputStorage); - } + std::string routeID; + if (!server.readTypeCheckingString(inputStorage, routeID)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Second parameter (route) requires a string.", outputStorage); + } + const MSRoute* route = MSRoute::dictionary(routeID); + if (!route) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Invalid route '" + routeID + "' for vehicle: '" + id + "'", outputStorage); + } - std::string vTypeID; - if (!server.readTypeCheckingString(inputStorage, vTypeID)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "First parameter (type) requires a string.", outputStorage); - } - MSVehicleType* vehicleType = MSNet::getInstance()->getVehicleControl().getVType(vTypeID); - if (!vehicleType) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Invalid type '" + vTypeID + "' for vehicle '" + id + "'", outputStorage); - } + std::string vTypeID; + if (!server.readTypeCheckingString(inputStorage, vTypeID)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "First parameter (type) requires a string.", outputStorage); + } + MSVehicleType* vehicleType = MSNet::getInstance()->getVehicleControl().getVType(vTypeID); + if (!vehicleType) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Invalid type '" + vTypeID + "' for vehicle '" + id + "'", outputStorage); + } - std::string helper; - std::string error; - if (!server.readTypeCheckingString(inputStorage, helper)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Third parameter (depart) requires an string.", outputStorage); - } - if (!SUMOVehicleParameter::parseDepart(helper, "vehicle", id, vehicleParams.depart, vehicleParams.departProcedure, error)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, error, outputStorage); - } - if (vehicleParams.departProcedure == DEPART_GIVEN && vehicleParams.depart < MSNet::getInstance()->getCurrentTimeStep()) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Departure time in the past.", outputStorage); - } + std::string helper; + std::string error; + if (!server.readTypeCheckingString(inputStorage, helper)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Third parameter (depart) requires an string.", outputStorage); + } + if (!SUMOVehicleParameter::parseDepart(helper, "vehicle", id, vehicleParams.depart, vehicleParams.departProcedure, error)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, error, outputStorage); + } + if (vehicleParams.departProcedure == DEPART_GIVEN && vehicleParams.depart < MSNet::getInstance()->getCurrentTimeStep()) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Departure time in the past.", outputStorage); + } - if (!server.readTypeCheckingString(inputStorage, helper)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Fourth parameter (depart lane) requires a string.", outputStorage); - } - if (!SUMOVehicleParameter::parseDepartLane(helper, "vehicle", id, vehicleParams.departLane, vehicleParams.departLaneProcedure, error)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, error, outputStorage); - } - if (!server.readTypeCheckingString(inputStorage, helper)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Fifth parameter (depart position) requires a string.", outputStorage); - } - if (!SUMOVehicleParameter::parseDepartPos(helper, "vehicle", id, vehicleParams.departPos, vehicleParams.departPosProcedure, error)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, error, outputStorage); - } - if (!server.readTypeCheckingString(inputStorage, helper)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Sixth parameter (depart speed) requires a string.", outputStorage); - } - if (!SUMOVehicleParameter::parseDepartSpeed(helper, "vehicle", id, vehicleParams.departSpeed, vehicleParams.departSpeedProcedure, error)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, error, outputStorage); - } + if (!server.readTypeCheckingString(inputStorage, helper)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Fourth parameter (depart lane) requires a string.", outputStorage); + } + if (!SUMOVehicleParameter::parseDepartLane(helper, "vehicle", id, vehicleParams.departLane, vehicleParams.departLaneProcedure, error)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, error, outputStorage); + } + if (!server.readTypeCheckingString(inputStorage, helper)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Fifth parameter (depart position) requires a string.", outputStorage); + } + if (!SUMOVehicleParameter::parseDepartPos(helper, "vehicle", id, vehicleParams.departPos, vehicleParams.departPosProcedure, error)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, error, outputStorage); + } + if (!server.readTypeCheckingString(inputStorage, helper)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Sixth parameter (depart speed) requires a string.", outputStorage); + } + if (!SUMOVehicleParameter::parseDepartSpeed(helper, "vehicle", id, vehicleParams.departSpeed, vehicleParams.departSpeedProcedure, error)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, error, outputStorage); + } - if (!server.readTypeCheckingString(inputStorage, helper)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Seventh parameter (arrival lane) requires a string.", outputStorage); - } - if (!SUMOVehicleParameter::parseArrivalLane(helper, "vehicle", id, vehicleParams.arrivalLane, vehicleParams.arrivalLaneProcedure, error)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, error, outputStorage); - } - if (!server.readTypeCheckingString(inputStorage, helper)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Eighth parameter (arrival position) requires a string.", outputStorage); - } - if (!SUMOVehicleParameter::parseArrivalPos(helper, "vehicle", id, vehicleParams.arrivalPos, vehicleParams.arrivalPosProcedure, error)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, error, outputStorage); - } - if (!server.readTypeCheckingString(inputStorage, helper)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Ninth parameter (arrival speed) requires a string.", outputStorage); - } - if (!SUMOVehicleParameter::parseArrivalSpeed(helper, "vehicle", id, vehicleParams.arrivalSpeed, vehicleParams.arrivalSpeedProcedure, error)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, error, outputStorage); - } + if (!server.readTypeCheckingString(inputStorage, helper)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Seventh parameter (arrival lane) requires a string.", outputStorage); + } + if (!SUMOVehicleParameter::parseArrivalLane(helper, "vehicle", id, vehicleParams.arrivalLane, vehicleParams.arrivalLaneProcedure, error)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, error, outputStorage); + } + if (!server.readTypeCheckingString(inputStorage, helper)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Eighth parameter (arrival position) requires a string.", outputStorage); + } + if (!SUMOVehicleParameter::parseArrivalPos(helper, "vehicle", id, vehicleParams.arrivalPos, vehicleParams.arrivalPosProcedure, error)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, error, outputStorage); + } + if (!server.readTypeCheckingString(inputStorage, helper)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Ninth parameter (arrival speed) requires a string.", outputStorage); + } + if (!SUMOVehicleParameter::parseArrivalSpeed(helper, "vehicle", id, vehicleParams.arrivalSpeed, vehicleParams.arrivalSpeedProcedure, error)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, error, outputStorage); + } - if (!server.readTypeCheckingString(inputStorage, vehicleParams.fromTaz)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Tenth parameter (from taz) requires a string.", outputStorage); - } - if (!server.readTypeCheckingString(inputStorage, vehicleParams.toTaz)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Eleventh parameter (to taz) requires a string.", outputStorage); - } - if (!server.readTypeCheckingString(inputStorage, vehicleParams.line)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Twelth parameter (line) requires a string.", outputStorage); - } + if (!server.readTypeCheckingString(inputStorage, vehicleParams.fromTaz)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Tenth parameter (from taz) requires a string.", outputStorage); + } + if (!server.readTypeCheckingString(inputStorage, vehicleParams.toTaz)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Eleventh parameter (to taz) requires a string.", outputStorage); + } + if (!server.readTypeCheckingString(inputStorage, vehicleParams.line)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Twelth parameter (line) requires a string.", outputStorage); + } - int num; - if (!server.readTypeCheckingInt(inputStorage, num)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "13th parameter (person capacity) requires an int.", outputStorage); - } - if (!server.readTypeCheckingInt(inputStorage, num)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "14th parameter (person number) requires an int.", outputStorage); - } - vehicleParams.personNumber = num; + int num; + if (!server.readTypeCheckingInt(inputStorage, num)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "13th parameter (person capacity) requires an int.", outputStorage); + } + if (!server.readTypeCheckingInt(inputStorage, num)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "14th parameter (person number) requires an int.", outputStorage); + } + vehicleParams.personNumber = num; - SUMOVehicleParameter* params = new SUMOVehicleParameter(vehicleParams); - try { - SUMOVehicle* vehicle = MSNet::getInstance()->getVehicleControl().buildVehicle(params, route, vehicleType, true, false); - MSNet::getInstance()->getVehicleControl().addVehicle(vehicleParams.id, vehicle); - MSNet::getInstance()->getInsertionControl().add(vehicle); - } catch (ProcessError& e) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, e.what(), outputStorage); - } - } - break; - case REMOVE: { - int why = 0; - if (!server.readTypeCheckingByte(inputStorage, why)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Removing a vehicle requires a byte.", outputStorage); - } - MSMoveReminder::Notification n = MSMoveReminder::NOTIFICATION_ARRIVED; - switch (why) { - case REMOVE_TELEPORT: - // XXX semantics unclear - // n = MSMoveReminder::NOTIFICATION_TELEPORT; - n = MSMoveReminder::NOTIFICATION_TELEPORT_ARRIVED; - break; - case REMOVE_PARKING: - // XXX semantics unclear - // n = MSMoveReminder::NOTIFICATION_PARKING; - n = MSMoveReminder::NOTIFICATION_ARRIVED; - break; - case REMOVE_ARRIVED: - n = MSMoveReminder::NOTIFICATION_ARRIVED; - break; - case REMOVE_VAPORIZED: - n = MSMoveReminder::NOTIFICATION_VAPORIZED; - break; - case REMOVE_TELEPORT_ARRIVED: - n = MSMoveReminder::NOTIFICATION_TELEPORT_ARRIVED; - break; - default: - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Unknown removal status.", outputStorage); + SUMOVehicleParameter* params = new SUMOVehicleParameter(vehicleParams); + try { + SUMOVehicle* vehicle = MSNet::getInstance()->getVehicleControl().buildVehicle(params, route, vehicleType, true, false); + MSNet::getInstance()->getVehicleControl().addVehicle(vehicleParams.id, vehicle); + MSNet::getInstance()->getInsertionControl().add(vehicle); + } catch (ProcessError& e) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, e.what(), outputStorage); + } } - if (v->hasDeparted()) { - v->onRemovalFromNet(n); - if (v->getLane() != 0) { - v->getLane()->removeVehicle(v, n); + break; + case REMOVE: { + int why = 0; + if (!server.readTypeCheckingByte(inputStorage, why)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Removing a vehicle requires a byte.", outputStorage); + } + MSMoveReminder::Notification n = MSMoveReminder::NOTIFICATION_ARRIVED; + switch (why) { + case REMOVE_TELEPORT: + // XXX semantics unclear + // n = MSMoveReminder::NOTIFICATION_TELEPORT; + n = MSMoveReminder::NOTIFICATION_TELEPORT_ARRIVED; + break; + case REMOVE_PARKING: + // XXX semantics unclear + // n = MSMoveReminder::NOTIFICATION_PARKING; + n = MSMoveReminder::NOTIFICATION_ARRIVED; + break; + case REMOVE_ARRIVED: + n = MSMoveReminder::NOTIFICATION_ARRIVED; + break; + case REMOVE_VAPORIZED: + n = MSMoveReminder::NOTIFICATION_VAPORIZED; + break; + case REMOVE_TELEPORT_ARRIVED: + n = MSMoveReminder::NOTIFICATION_TELEPORT_ARRIVED; + break; + default: + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Unknown removal status.", outputStorage); + } + if (v->hasDeparted()) { + v->onRemovalFromNet(n); + if (v->getLane() != 0) { + v->getLane()->removeVehicle(v, n); + } + MSNet::getInstance()->getVehicleControl().scheduleVehicleRemoval(v); + } else { + MSNet::getInstance()->getInsertionControl().alreadyDeparted(v); + MSNet::getInstance()->getVehicleControl().deleteVehicle(v, true); } - MSNet::getInstance()->getVehicleControl().scheduleVehicleRemoval(v); } - } - break; - case VAR_MOVE_TO_VTD: { - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting VTD vehicle requires a compound object.", outputStorage); - } - const int numArgs = inputStorage.readInt(); - if (numArgs != 5 && numArgs != 6) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting VTD vehicle should obtain: edgeID, lane, x, y, angle and optionally keepRouteFlag.", outputStorage); - } - // edge ID - std::string edgeID; - if (!server.readTypeCheckingString(inputStorage, edgeID)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The first parameter for setting a VTD vehicle must be the edge ID given as a string.", outputStorage); - } - // lane index - int laneNum = 0; - if (!server.readTypeCheckingInt(inputStorage, laneNum)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The second parameter for setting a VTD vehicle must be lane given as an int.", outputStorage); - } - // x - double x = 0; - double y = 0; - double origAngle = 0; - if (!server.readTypeCheckingDouble(inputStorage, x)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The third parameter for setting a VTD vehicle must be the x-position given as a double.", outputStorage); - } - // y - if (!server.readTypeCheckingDouble(inputStorage, y)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The fourth parameter for setting a VTD vehicle must be the y-position given as a double.", outputStorage); - } - // angle - if (!server.readTypeCheckingDouble(inputStorage, origAngle)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The fifth parameter for setting a VTD vehicle must be the angle given as a double.", outputStorage); - } - bool keepRoute = v->getID() != "VTD_EGO"; - bool mayLeaveNetwork = false; - if (numArgs == 6) { - int keepRouteFlag; - if (!server.readTypeCheckingByte(inputStorage, keepRouteFlag)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The sixth parameter for setting a VTD vehicle must be the keepRouteFlag given as a byte.", outputStorage); - } - keepRoute = (keepRouteFlag == 1); - mayLeaveNetwork = (keepRouteFlag == 2); - } - // process - std::string origID = edgeID + " " + toString(laneNum); - if (laneNum < 0) { - edgeID = '-' + edgeID; - laneNum = -laneNum; - } - Position pos(x, y); - SUMOReal angle = origAngle; - if (angle >= 180.) { - angle = -360. + angle; - } else if (angle <= -180.) { - angle = 360. + angle; - } - - Position vehPos = v->getPosition(); -#ifdef DEBUG_VTD - std::cout << std::endl << "begin vehicle " << v->getID() << " vehPos:" << vehPos << " lane:" << v->getLane()->getID() << std::endl; - std::cout << " want pos:" << pos << " edge:" << edgeID << " laneNum:" << laneNum << " origAngle:" << origAngle << " angle:" << angle << " keepRoute:" << keepRoute << std::endl; + break; + case MOVE_TO_XY: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "MoveToXY vehicle requires a compound object.", outputStorage); + } + const int numArgs = inputStorage.readInt(); + if (numArgs != 5 && numArgs != 6) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "MoveToXY vehicle should obtain: edgeID, lane, x, y, angle and optionally keepRouteFlag.", outputStorage); + } + // edge ID + std::string edgeID; + if (!server.readTypeCheckingString(inputStorage, edgeID)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The first parameter for moveToXY must be the edge ID given as a string.", outputStorage); + } + // lane index + int laneNum = 0; + if (!server.readTypeCheckingInt(inputStorage, laneNum)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The second parameter for moveToXY must be lane given as an int.", outputStorage); + } + // x + double x = 0; + double y = 0; + double origAngle = 0; + if (!server.readTypeCheckingDouble(inputStorage, x)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The third parameter for moveToXY must be the x-position given as a double.", outputStorage); + } + // y + if (!server.readTypeCheckingDouble(inputStorage, y)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The fourth parameter for moveToXY must be the y-position given as a double.", outputStorage); + } + // angle + if (!server.readTypeCheckingDouble(inputStorage, origAngle)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The fifth parameter for moveToXY must be the angle given as a double.", outputStorage); + } + bool keepRoute = v->getID() != "VTD_EGO"; + bool mayLeaveNetwork = false; + if (numArgs == 6) { + int keepRouteFlag; + if (!server.readTypeCheckingByte(inputStorage, keepRouteFlag)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The sixth parameter for moveToXY must be the keepRouteFlag given as a byte.", outputStorage); + } + keepRoute = (keepRouteFlag == 1); + mayLeaveNetwork = (keepRouteFlag == 2); + } + // process + const std::string origID = edgeID + "_" + toString(laneNum); + // @todo add an interpretation layer for OSM derived origID values (without lane index) + Position pos(x, y); + double angle = origAngle; + // angle must be in [0,360] because it will be compared against those returned by naviDegree() + // angle set to INVALID_DOUBLE_VALUE is ignored in the evaluated and later set to the angle of the matched lane + if (angle != INVALID_DOUBLE_VALUE) { + while (angle >= 360.) { + angle -= 360.; + } + while (angle < 0.) { + angle += 360.; + } + } + + Position vehPos = v->getPosition(); +#ifdef DEBUG_MOVEXY + std::cout << std::endl << "begin vehicle " << v->getID() << " vehPos:" << vehPos << " lane:" << Named::getIDSecure(v->getLane()) << std::endl; + std::cout << " want pos:" << pos << " origID:" << origID << " laneNum:" << laneNum << " origAngle:" << origAngle << " angle:" << angle << " keepRoute:" << keepRoute << std::endl; #endif - ConstMSEdgeVector edges; - MSLane* lane = 0; - SUMOReal lanePos; - SUMOReal lanePosLat = 0; - SUMOReal bestDistance = std::numeric_limits::max(); - int routeOffset = 0; - bool found; - SUMOReal maxRouteDistance = 100; - /* EGO vehicle is known to have a fixed route. @todo make this into a parameter of the TraCI call */ - if (keepRoute) { - // case a): vehicle is on its earlier route - // we additionally assume it is moving forward (SUMO-limit); - // note that the route ("edges") is not changed in this case - found = vtdMap_matchingRoutePosition(pos, origID, *v, bestDistance, &lane, lanePos, routeOffset, edges); - // @note silenty ignoring mapping failure - } else { - found = vtdMap(pos, maxRouteDistance, origID, angle, *v, server, bestDistance, &lane, lanePos, routeOffset, edges); - } - if ((found && bestDistance <= maxRouteDistance) || mayLeaveNetwork) { - // optionally compute lateral offset - if (found && (MSGlobals::gLateralResolution > 0 || mayLeaveNetwork)) { - const SUMOReal perpDist = lane->getShape().distance2D(pos, true); - if (perpDist != GeomHelper::INVALID_OFFSET) { - lanePosLat = perpDist; - if (!mayLeaveNetwork) { - lanePosLat = MIN2(lanePosLat, (SUMOReal)0.5 * (lane->getWidth() + v->getVehicleType().getWidth() - MSGlobals::gLateralResolution)); + ConstMSEdgeVector edges; + MSLane* lane = 0; + double lanePos; + double lanePosLat = 0; + double bestDistance = std::numeric_limits::max(); + int routeOffset = 0; + bool found; + double maxRouteDistance = 100; + /* EGO vehicle is known to have a fixed route. @todo make this into a parameter of the TraCI call */ + if (keepRoute) { + // case a): vehicle is on its earlier route + // we additionally assume it is moving forward (SUMO-limit); + // note that the route ("edges") is not changed in this case + found = vtdMap_matchingRoutePosition(pos, origID, *v, bestDistance, &lane, lanePos, routeOffset, edges); + // @note silenty ignoring mapping failure + } else { + found = vtdMap(pos, maxRouteDistance, origID, angle, *v, server, bestDistance, &lane, lanePos, routeOffset, edges); + } + if ((found && bestDistance <= maxRouteDistance) || mayLeaveNetwork) { + // optionally compute lateral offset + if (found && (MSGlobals::gLateralResolution > 0 || mayLeaveNetwork)) { + const double perpDist = lane->getShape().distance2D(pos, false); + if (perpDist != GeomHelper::INVALID_OFFSET) { + lanePosLat = perpDist; + if (!mayLeaveNetwork) { + lanePosLat = MIN2(lanePosLat, 0.5 * (lane->getWidth() + v->getVehicleType().getWidth() - MSGlobals::gLateralResolution)); + } + // figure out whether the offset is to the left or to the right + PositionVector tmp = lane->getShape(); + tmp.move2side(-lanePosLat); // moved to left + //std::cout << " lane=" << lane->getID() << " posLat=" << lanePosLat << " shape=" << lane->getShape() << " tmp=" << tmp << " tmpDist=" << tmp.distance2D(pos) << "\n"; + if (tmp.distance2D(pos) > perpDist) { + lanePosLat = -lanePosLat; + } } - // figure out whether the offset is to the left or to the right - PositionVector tmp = lane->getShape(); - tmp.move2side(-lanePosLat); // moved to left - //std::cout << " lane=" << lane->getID() << " posLat=" << lanePosLat << " shape=" << lane->getShape() << " tmp=" << tmp << " tmpDist=" << tmp.distance2D(pos) << "\n"; - if (tmp.distance2D(pos) > perpDist) { - lanePosLat = -lanePosLat; + } + assert((found && lane != 0) || (!found && lane == 0)); + if (angle == INVALID_DOUBLE_VALUE) { + if (lane != 0) { + angle = GeomHelper::naviDegree(lane->getShape().rotationAtOffset(lanePos)); + } else { + // compute angle outside road network from old and new position + angle = GeomHelper::naviDegree(v->getPosition().angleTo2D(pos)); } } - } - assert((found && lane != 0) || (!found && lane == 0)); - // use the best we have - server.setVTDControlled(v, pos, lane, lanePos, lanePosLat, angle, routeOffset, edges, MSNet::getInstance()->getCurrentTimeStep()); - if (!v->isOnRoad()) { - MSNet::getInstance()->getInsertionControl().alreadyDeparted(v); + // use the best we have + server.setVTDControlled(v, pos, lane, lanePos, lanePosLat, angle, routeOffset, edges, MSNet::getInstance()->getCurrentTimeStep()); + if (!v->isOnRoad()) { + MSNet::getInstance()->getInsertionControl().alreadyDeparted(v); - } - } else { - if (lane == 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Could not map vehicle '" + id + "' no road found within " + toString(maxRouteDistance) + "m.", outputStorage); + } } else { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Could not map vehicle '" + id + "' distance to road is " + toString(bestDistance) + ".", outputStorage); + if (lane == 0) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Could not map vehicle '" + id + "' no road found within " + toString(maxRouteDistance) + "m.", outputStorage); + } else { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Could not map vehicle '" + id + "' distance to road is " + toString(bestDistance) + ".", outputStorage); + } } } - } - break; - case VAR_SPEED_FACTOR: { - double factor = 0; - if (!server.readTypeCheckingDouble(inputStorage, factor)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting speed factor requires a double.", outputStorage); + break; + case VAR_SPEED_FACTOR: { + double factor = 0; + if (!server.readTypeCheckingDouble(inputStorage, factor)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting speed factor requires a double.", outputStorage); + } + v->setChosenSpeedFactor(factor); } - v->setChosenSpeedFactor(factor); - } - break; - case VAR_PARAMETER: { - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "A compound object is needed for setting a parameter.", outputStorage); - } - //readt itemNo - inputStorage.readInt(); - std::string name; - if (!server.readTypeCheckingString(inputStorage, name)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The name of the parameter must be given as a string.", outputStorage); - } - std::string value; - if (!server.readTypeCheckingString(inputStorage, value)) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The value of the parameter must be given as a string.", outputStorage); + break; + case VAR_LINE: { + std::string line; + if (!server.readTypeCheckingString(inputStorage, line)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The line must be given as a string.", outputStorage); + } + v->getParameter().line = line; } - ((SUMOVehicleParameter&) v->getParameter()).addParameter(name, value); - } - break; - default: - try { - if (!TraCIServerAPI_VehicleType::setVariable(CMD_SET_VEHICLE_VARIABLE, variable, getSingularType(v), server, inputStorage, outputStorage)) { - return false; + break; + case VAR_VIA: { + std::vector edgeIDs; + if (!server.readTypeCheckingStringList(inputStorage, edgeIDs)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Vias must be defined as a list of edge ids.", outputStorage); + } + try { + // ensure edges exist + ConstMSEdgeVector edges; + MSEdge::parseEdgesList(edgeIDs, edges, ""); + } catch (ProcessError& e) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, e.what(), outputStorage); } - } catch (ProcessError& e) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, e.what(), outputStorage); + v->getParameter().via = edgeIDs; } break; + case VAR_PARAMETER: { + if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "A compound object is needed for setting a parameter.", outputStorage); + } + //readt itemNo + inputStorage.readInt(); + std::string name; + if (!server.readTypeCheckingString(inputStorage, name)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The name of the parameter must be given as a string.", outputStorage); + } + std::string value; + if (!server.readTypeCheckingString(inputStorage, value)) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "The value of the parameter must be given as a string.", outputStorage); + } + try { + /// XXX but a big try/catch around all retrieval cases + TraCI_Vehicle::setParameter(id, name, value); + } catch (TraCIException& e) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, e.what(), outputStorage); + } + } + break; + default: + try { + const MSVehicleType& type = getSingularType(v); + if (!TraCIServerAPI_VehicleType::setVariable(CMD_SET_VEHICLE_VARIABLE, variable, type.getID(), server, inputStorage, outputStorage)) { + return false; + } + } catch (ProcessError& e) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, e.what(), outputStorage); + } catch (TraCIException& e) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, e.what(), outputStorage); + } + break; + } + } catch (TraCIException& e) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, e.what(), outputStorage); } server.writeStatusCmd(CMD_SET_VEHICLE_VARIABLE, RTYPE_OK, warning, outputStorage); return true; @@ -1464,15 +1465,15 @@ bool -TraCIServerAPI_Vehicle::vtdMap(const Position& pos, SUMOReal maxRouteDistance, const std::string& origID, const SUMOReal angle, MSVehicle& v, TraCIServer& server, - SUMOReal& bestDistance, MSLane** lane, SUMOReal& lanePos, int& routeOffset, ConstMSEdgeVector& edges) { +TraCIServerAPI_Vehicle::vtdMap(const Position& pos, double maxRouteDistance, const std::string& origID, const double angle, MSVehicle& v, TraCIServer& server, + double& bestDistance, MSLane** lane, double& lanePos, int& routeOffset, ConstMSEdgeVector& edges) { // collect edges around the vehicle - SUMOReal speed = pos.distanceTo2D(v.getPosition()); // !!!v.getSpeed(); + double speed = pos.distanceTo2D(v.getPosition()); // !!!v.getSpeed(); std::set into; PositionVector shape; shape.push_back(pos); server.collectObjectsInRange(CMD_GET_EDGE_VARIABLE, shape, maxRouteDistance, into); - SUMOReal maxDist = 0; + double maxDist = 0; std::map lane2utility; // compute utility for all candidate edges for (std::set::const_iterator j = into.begin(); j != into.end(); ++j) { @@ -1484,7 +1485,7 @@ // the next if/the clause sets "onRoute", "prevEdge", and "nextEdge", depending on // whether the currently seen edge is an internal one or a normal one if (ef != MSEdge::EDGEFUNCTION_INTERNAL) { -#ifdef DEBUG_VTD_ANGLE +#ifdef DEBUG_MOVEXY_ANGLE std::cout << "Ego on normal" << std::endl; #endif // a normal edge @@ -1505,7 +1506,7 @@ // save prior and next edges prevEdge = e; nextEdge = !onRoute || edgePos == ev.end() - 1 ? 0 : *(edgePos + 1); -#ifdef DEBUG_VTD_ANGLE +#ifdef DEBUG_MOVEXY_ANGLE std::cout << "normal:" << e->getID() << " prev:" << prevEdge->getID() << " next:"; if (nextEdge != 0) { std::cout << nextEdge->getID(); @@ -1513,7 +1514,7 @@ std::cout << std::endl; #endif } else { -#ifdef DEBUG_VTD_ANGLE +#ifdef DEBUG_MOVEXY_ANGLE std::cout << "Ego on internal" << std::endl; #endif // an internal edge @@ -1534,7 +1535,7 @@ if (prevEdgePos != ev.end() && (prevEdgePos + 1) != ev.end()) { onRoute = *(prevEdgePos + 1) == nextEdge; } -#ifdef DEBUG_VTD_ANGLE +#ifdef DEBUG_MOVEXY_ANGLE std::cout << "internal:" << e->getID() << " prev:" << prevEdge->getID() << " next:" << nextEdge->getID() << std::endl; #endif } @@ -1542,19 +1543,15 @@ // weight the lanes... const std::vector& lanes = e->getLanes(); + const bool perpendicular = false; for (std::vector::const_iterator k = lanes.begin(); k != lanes.end(); ++k) { MSLane* lane = *k; - SUMOReal off = lane->getShape().nearest_offset_to_point2D(pos); - SUMOReal langle = 180.; - SUMOReal dist = 1000.; - if (off >= 0) { - dist = lane->getShape().distance2D(pos); - if (dist > lane->getLength()) { // this is a workaround - // a SmartDB, running at :49_2 delivers off=~9.24 while dist>24.? - dist = 1000.; - } else { - langle = GeomHelper::naviDegree(lane->getShape().rotationDegreeAtOffset(off)); - } + double off = lane->getShape().nearest_offset_to_point2D(pos, perpendicular); + double langle = 180.; + double dist = 1000.; + if (off != GeomHelper::INVALID_OFFSET) { + dist = lane->getShape().distance2D(pos, perpendicular); + langle = GeomHelper::naviDegree(lane->getShape().rotationAtOffset(off)); } bool sameEdge = v.isOnRoad() && &lane->getEdge() == &v.getLane()->getEdge() && v.getEdge()->getLanes()[0]->getLength() > v.getPositionOnLane() + SPEED2DIST(speed); /* @@ -1564,38 +1561,40 @@ rNextEdge = next == 0 ? 0 : &next->getEdge(); } */ -#ifdef DEBUG_VTD_ANGLE - std::cout << lane->getID() << ": " << langle << " " << off << std::endl; + const double angleDiff = (angle == INVALID_DOUBLE_VALUE ? 0 : GeomHelper::getMinAngleDiff(angle, langle)); +#ifdef DEBUG_MOVEXY_ANGLE + std::cout << lane->getID() << " lAngle:" << langle << " lLength=" << lane->getLength() + << " angleDiff:" << angleDiff + << " off:" << off << " dist=" << dist << "\n"; + std::cout << lane->getID() << " param=" << lane->getParameter(SUMO_PARAM_ORIGID, lane->getID()) << " origID='" << origID << "\n"; #endif lane2utility[lane] = LaneUtility( - dist, GeomHelper::getMinAngleDiff(angle, langle), - lane->getParameter("origId", "") == origID, + dist, angleDiff, + lane->getParameter(SUMO_PARAM_ORIGID, lane->getID()) == origID, onRoute, sameEdge, prevEdge, nextEdge); // update scaling value - if (dist < 1000) { - maxDist = MAX2(maxDist, dist); - } + maxDist = MAX2(maxDist, MIN2(dist, SUMO_const_laneWidth)); } } // get the best lane given the previously computed values - SUMOReal bestValue = 0; + double bestValue = 0; MSLane* bestLane = 0; for (std::map::iterator i = lane2utility.begin(); i != lane2utility.end(); ++i) { MSLane* l = (*i).first; const LaneUtility& u = (*i).second; - SUMOReal distN = u.dist > 999 ? -10 : 1. - (u.dist / maxDist); - SUMOReal angleDiffN = 1. - (u.angleDiff / 180.); - SUMOReal idN = u.ID ? 1 : 0; - SUMOReal onRouteN = u.onRoute ? 1 : 0; - SUMOReal sameEdgeN = u.sameEdge ? MIN2(v.getEdge()->getLength() / speed, (SUMOReal)1.) : 0; - SUMOReal value = (distN * .35 - + angleDiffN * 0.35 /*.5 */ - + idN * .1 - + onRouteN * 0.1 - + sameEdgeN * 0.1); -#ifdef DEBUG_VTD + double distN = u.dist > 999 ? -10 : 1. - (u.dist / maxDist); + double angleDiffN = 1. - (u.angleDiff / 180.); + double idN = u.ID ? 1 : 0; + double onRouteN = u.onRoute ? 1 : 0; + double sameEdgeN = u.sameEdge ? MIN2(v.getEdge()->getLength() / speed, (double)1.) : 0; + double value = (distN * .5 // distance is more important than angle because the vehicle might be driving in the opposite direction + + angleDiffN * 0.35 /*.5 */ + + idN * 1 + + onRouteN * 0.1 + + sameEdgeN * 0.1); +#ifdef DEBUG_MOVEXY std::cout << " x; l:" << l->getID() << " d:" << u.dist << " dN:" << distN << " aD:" << angleDiffN << " ID:" << idN << " oRN:" << onRouteN << " sEN:" << sameEdgeN << " value:" << value << std::endl; #endif @@ -1611,7 +1610,7 @@ const LaneUtility& u = lane2utility.find(bestLane)->second; bestDistance = u.dist; *lane = bestLane; - lanePos = bestLane->getShape().nearest_offset_to_point2D(pos); + lanePos = bestLane->getShape().nearest_offset_to_point2D(pos, false); const MSEdge* prevEdge = u.prevEdge; if (u.onRoute) { const ConstMSEdgeVector& ev = v.getRoute().getEdges(); @@ -1629,16 +1628,8 @@ edges.push_back(u.nextEdge); } routeOffset = 0; -#ifdef DEBUG_VTD_ANGLE - std::cout << "internal2:" << " prev:"; - if (u.prevEdge != 0) { - std::cout << u.prevEdge->getID(); - } - std::cout << " next:"; - if (u.nextEdge != 0) { - std::cout << u.nextEdge->getID(); - } - std::cout << std::endl; +#ifdef DEBUG_MOVEXY_ANGLE + std::cout << "internal2: lane=" << bestLane->getID() << " prev=" << Named::getIDSecure(u.prevEdge) << " next=" << Named::getIDSecure(u.nextEdge) << "\n";; #endif } return true; @@ -1646,7 +1637,7 @@ bool -TraCIServerAPI_Vehicle::findCloserLane(const MSEdge* edge, const Position& pos, SUMOReal& bestDistance, MSLane** lane) { +TraCIServerAPI_Vehicle::findCloserLane(const MSEdge* edge, const Position& pos, double& bestDistance, MSLane** lane) { if (edge == 0) { return false; } @@ -1654,8 +1645,8 @@ bool newBest = false; for (std::vector::const_iterator k = lanes.begin(); k != lanes.end() && bestDistance > POSITION_EPS; ++k) { MSLane* candidateLane = *k; - const SUMOReal dist = candidateLane->getShape().distance2D(pos); // get distance -#ifdef DEBUG_VTD + const double dist = candidateLane->getShape().distance2D(pos); // get distance +#ifdef DEBUG_MOVEXY std::cout << " b at lane " << candidateLane->getID() << " dist:" << dist << " best:" << bestDistance << std::endl; #endif if (dist < bestDistance) { @@ -1670,7 +1661,7 @@ bool TraCIServerAPI_Vehicle::vtdMap_matchingRoutePosition(const Position& pos, const std::string& origID, MSVehicle& v, - SUMOReal& bestDistance, MSLane** lane, SUMOReal& lanePos, int& routeOffset, ConstMSEdgeVector& /*edges*/) { + double& bestDistance, MSLane** lane, double& lanePos, int& routeOffset, ConstMSEdgeVector& /*edges*/) { const ConstMSEdgeVector& edges = v.getRoute().getEdges(); routeOffset = 0; @@ -1681,14 +1672,12 @@ const MSEdge* prev = 0; UNUSED_PARAMETER(prev); // silence 'unused variable' warning when built without INTERNAL_LANES for (ConstMSEdgeVector::const_iterator i = v.getCurrentRouteEdge(); i != edges.end(); ++i) { -#ifdef HAVE_INTERNAL_LANES while (prev != 0) { // check internal edge(s) const MSEdge* internalCand = prev->getInternalFollowingEdge(*i); findCloserLane(internalCand, pos, bestDistance, lane); prev = internalCand; } -#endif if (findCloserLane(*i, pos, bestDistance, lane)) { routeOffset = (int)std::distance(edges.begin(), i); } @@ -1699,14 +1688,12 @@ UNUSED_PARAMETER(next); // silence 'unused variable' warning when built without INTERNAL_LANES for (ConstMSEdgeVector::const_iterator i = v.getCurrentRouteEdge(); i != edges.begin(); --i) { prev = *i; -#ifdef HAVE_INTERNAL_LANES while (prev != 0) { // check internal edge(s) const MSEdge* internalCand = prev->getInternalFollowingEdge(next); findCloserLane(internalCand, pos, bestDistance, lane); prev = internalCand; } -#endif if (findCloserLane(*i, pos, bestDistance, lane)) { routeOffset = (int)std::distance(edges.begin(), i); } @@ -1716,7 +1703,7 @@ assert(lane != 0); // quit if no solution was found, reporting a failure if (lane == 0) { -#ifdef DEBUG_VTD +#ifdef DEBUG_MOVEXY std::cout << " b failed - no best route lane" << std::endl; #endif return false; @@ -1724,90 +1711,28 @@ // position may be inaccurate; let's checkt the given index, too - // a) is enabled for non-internal lanes only, as otherwise the position information may ambiguous - // b) it's something one has to enable when building the nework - keepin the OSM IDs - is probably not always done + // @note: this is enabled for non-internal lanes only, as otherwise the position information may ambiguous if ((*lane)->getEdge().getPurpose() != MSEdge::EDGEFUNCTION_INTERNAL) { const std::vector& lanes = (*lane)->getEdge().getLanes(); for (std::vector::const_iterator i = lanes.begin(); i != lanes.end(); ++i) { - if ((*i)->getParameter("origId", "") == origID) { + if ((*i)->getParameter(SUMO_PARAM_ORIGID, (*i)->getID()) == origID) { *lane = *i; break; } } } // check position, stuff, we should have the best lane along the route - lanePos = MAX2(SUMOReal(0), MIN2(SUMOReal((*lane)->getLength() - POSITION_EPS), (*lane)->getShape().nearest_offset_to_point2D(pos, false))); + lanePos = MAX2(0., MIN2(double((*lane)->getLength() - POSITION_EPS), + (*lane)->interpolateGeometryPosToLanePos( + (*lane)->getShape().nearest_offset_to_point2D(pos, false)))); //std::cout << SIMTIME << " vtdMap_matchingRoutePosition vehicle=" << v.getID() << " currLane=" << v.getLane()->getID() << " routeOffset=" << routeOffset << " edges=" << toString(edges) << " lane=" << (*lane)->getID() << "\n"; -#ifdef DEBUG_VTD +#ifdef DEBUG_MOVEXY std::cout << " b ok lane " << (*lane)->getID() << " lanePos:" << lanePos << std::endl; #endif return true; } -bool -TraCIServerAPI_Vehicle::commandDistanceRequest(TraCIServer& server, tcpip::Storage& inputStorage, - tcpip::Storage& outputStorage, const MSVehicle* v) { - if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Retrieval of distance requires a compound object.", outputStorage); - } - if (inputStorage.readInt() != 2) { - return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Retrieval of distance requires position and distance type as parameter.", outputStorage); - } - - Position pos; - std::pair roadPos; - - // read position - int posType = inputStorage.readUnsignedByte(); - switch (posType) { - case POSITION_ROADMAP: - try { - std::string roadID = inputStorage.readString(); - roadPos.second = inputStorage.readDouble(); - roadPos.first = TraCIServerAPI_Simulation::getLaneChecking(roadID, inputStorage.readUnsignedByte(), roadPos.second); - pos = roadPos.first->getShape().positionAtOffset(roadPos.second); - } catch (TraCIException& e) { - return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, e.what(), outputStorage); - } - break; - case POSITION_2D: - case POSITION_3D: { - const double p1x = inputStorage.readDouble(); - const double p1y = inputStorage.readDouble(); - pos.set(p1x, p1y); - } - if (posType == POSITION_3D) { - inputStorage.readDouble(); // z value is ignored - } - roadPos = TraCIServerAPI_Simulation::convertCartesianToRoadMap(pos); - break; - default: - return server.writeErrorStatusCmd(CMD_GET_VEHICLE_VARIABLE, "Unknown position format used for distance request", outputStorage); - } - - // read distance type - int distType = inputStorage.readUnsignedByte(); - - SUMOReal distance = INVALID_DOUBLE_VALUE; - if (v->isOnRoad()) { - if (distType == REQUEST_DRIVINGDIST) { - distance = v->getRoute().getDistanceBetween(v->getPositionOnLane(), roadPos.second, - v->getEdge(), &roadPos.first->getEdge()); - if (distance == std::numeric_limits::max()) { - distance = INVALID_DOUBLE_VALUE; - } - } else { - // compute air distance (default) - distance = v->getPosition().distanceTo(pos); - } - } - // write response command - outputStorage.writeUnsignedByte(TYPE_DOUBLE); - outputStorage.writeDouble(distance); - return true; -} - // ------ helper functions ------ bool @@ -1825,38 +1750,12 @@ TraCIServerAPI_Vehicle::getSingularType(SUMOVehicle* const veh) { const MSVehicleType& oType = veh->getVehicleType(); std::string newID = oType.getID().find('@') == std::string::npos ? oType.getID() + "@" + veh->getID() : oType.getID(); - MSVehicleType* type = MSVehicleType::build(newID, &oType); + MSVehicleType* type = MSVehicleType::buildSingularType(newID, &oType); static_cast(veh)->replaceVehicleType(type); return *type; } -#include - -const std::map >& -TraCIServerAPI_Vehicle::getOrBuildVTDMap() { - if (gVTDMap.size() == 0) { - const MSEdgeVector& edges = MSNet::getInstance()->getEdgeControl().getEdges(); - for (MSEdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) { - const std::vector& lanes = (*i)->getLanes(); - for (std::vector::const_iterator j = lanes.begin(); j != lanes.end(); ++j) { - if ((*j)->knowsParameter("origId")) { - std::string origID = (*j)->getParameter("origId", ""); - if (gVTDMap.find(origID) == gVTDMap.end()) { - gVTDMap[origID] = std::vector(); - } - gVTDMap[origID].push_back(*j); - } - } - } - if (gVTDMap.size() == 0) { - gVTDMap["unknown"] = std::vector(); - } - } - return gVTDMap; -} - - #endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Vehicle.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Vehicle.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Vehicle.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_Vehicle.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_Vehicle.h 20969 2016-06-15 08:02:52Z namdre $ +/// @version $Id: TraCIServerAPI_Vehicle.h 23474 2017-03-16 11:41:13Z namdre $ /// // APIs for getting/setting vehicle values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,7 +33,7 @@ #ifndef NO_TRACI -#include "TraCIException.h" +#include "TraCIDefs.h" #include #include "TraCIServer.h" #include @@ -77,33 +77,29 @@ private: - static bool commandDistanceRequest(TraCIServer& server, tcpip::Storage& inputStorage, - tcpip::Storage& outputStorage, const MSVehicle* v); - static MSVehicleType& getSingularType(SUMOVehicle* const veh); - static const std::map >& getOrBuildVTDMap(); - static bool vtdMap(const Position& pos, SUMOReal maxRouteDistance, const std::string& origID, const SUMOReal angle, MSVehicle& v, TraCIServer& server, - SUMOReal& bestDistance, MSLane** lane, SUMOReal& lanePos, int& routeOffset, ConstMSEdgeVector& edges); + static bool vtdMap(const Position& pos, double maxRouteDistance, const std::string& origID, const double angle, MSVehicle& v, TraCIServer& server, + double& bestDistance, MSLane** lane, double& lanePos, int& routeOffset, ConstMSEdgeVector& edges); static bool vtdMap_matchingRoutePosition(const Position& pos, const std::string& origID, MSVehicle& v, - SUMOReal& bestDistance, MSLane** lane, SUMOReal& lanePos, int& routeOffset, ConstMSEdgeVector& edges); + double& bestDistance, MSLane** lane, double& lanePos, int& routeOffset, ConstMSEdgeVector& edges); - static bool findCloserLane(const MSEdge* edge, const Position& pos, SUMOReal& bestDistance, MSLane** lane); + static bool findCloserLane(const MSEdge* edge, const Position& pos, double& bestDistance, MSLane** lane); static std::map > gVTDMap; class LaneUtility { public: - LaneUtility(SUMOReal dist_, SUMOReal angleDiff_, bool ID_, bool onRoute_, bool sameEdge_, const MSEdge* prevEdge_, const MSEdge* nextEdge_) : + LaneUtility(double dist_, double angleDiff_, bool ID_, bool onRoute_, bool sameEdge_, const MSEdge* prevEdge_, const MSEdge* nextEdge_) : dist(dist_), angleDiff(angleDiff_), ID(ID_), onRoute(onRoute_), sameEdge(sameEdge_), prevEdge(prevEdge_), nextEdge(nextEdge_) {} LaneUtility() {} ~LaneUtility() {} - SUMOReal dist; - SUMOReal angleDiff; + double dist; + double angleDiff; bool ID; bool onRoute; bool sameEdge; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_VehicleType.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_VehicleType.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_VehicleType.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_VehicleType.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,15 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @author Laura Bieker +/// @author Robert Hilbrich +/// @author Gregor Laemmel /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_VehicleType.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: TraCIServerAPI_VehicleType.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // APIs for getting/setting vehicle type values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,12 +39,10 @@ #include #include #include +#include #include "TraCIConstants.h" #include "TraCIServerAPI_VehicleType.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS +#include "lib/TraCI.h" // =========================================================================== @@ -55,13 +55,20 @@ int variable = inputStorage.readUnsignedByte(); std::string id = inputStorage.readString(); // check variable - if (variable != ID_LIST && variable != VAR_LENGTH && variable != VAR_MAXSPEED && variable != VAR_ACCEL && variable != VAR_DECEL - && variable != VAR_TAU && variable != VAR_VEHICLECLASS && variable != VAR_EMISSIONCLASS && variable != VAR_SHAPECLASS + if (variable != ID_LIST && variable != VAR_LENGTH && variable != VAR_MAXSPEED && variable != VAR_ACCEL + && variable != VAR_DECEL + && variable != VAR_TAU && variable != VAR_VEHICLECLASS && variable != VAR_EMISSIONCLASS + && variable != VAR_SHAPECLASS && variable != VAR_SPEED_FACTOR && variable != VAR_SPEED_DEVIATION && variable != VAR_IMPERFECTION && variable != VAR_MINGAP && variable != VAR_WIDTH && variable != VAR_COLOR && variable != ID_COUNT && variable != VAR_HEIGHT + && variable != VAR_MINGAP_LAT + && variable != VAR_MAXSPEED_LAT + && variable != VAR_LATALIGNMENT && variable != VAR_PARAMETER) { - return server.writeErrorStatusCmd(CMD_GET_VEHICLETYPE_VARIABLE, "Get Vehicle Type Variable: unsupported variable " + toHex(variable, 2) + " specified", outputStorage); + return server.writeErrorStatusCmd(CMD_GET_VEHICLETYPE_VARIABLE, + "Get Vehicle Type Variable: unsupported variable " + toHex(variable, 2) + + " specified", outputStorage); } // begin response building tcpip::Storage tempMsg; @@ -71,33 +78,32 @@ tempMsg.writeString(id); // process request if (variable == ID_LIST) { - std::vector ids; - MSNet::getInstance()->getVehicleControl().insertVTypeIDs(ids); + std::vector ids = TraCI_VehicleType::getIDList(); tempMsg.writeUnsignedByte(TYPE_STRINGLIST); tempMsg.writeStringList(ids); } else if (variable == ID_COUNT) { - std::vector ids; - MSNet::getInstance()->getVehicleControl().insertVTypeIDs(ids); + std::vector ids = TraCI_VehicleType::getIDList(); tempMsg.writeUnsignedByte(TYPE_INTEGER); tempMsg.writeInt((int) ids.size()); } else { - MSVehicleType* v = MSNet::getInstance()->getVehicleControl().getVType(id); - if (v == 0) { - return server.writeErrorStatusCmd(CMD_GET_VEHICLETYPE_VARIABLE, "Vehicle type '" + id + "' is not known", outputStorage); - } - switch (variable) { - case VAR_PARAMETER: { - std::string paramName = ""; - if (!server.readTypeCheckingString(inputStorage, paramName)) { - return server.writeErrorStatusCmd(CMD_GET_VEHICLETYPE_VARIABLE, "Retrieval of a parameter requires its name.", outputStorage); + try { + switch (variable) { + case VAR_PARAMETER: { + std::string paramName = ""; + if (!server.readTypeCheckingString(inputStorage, paramName)) { + return server.writeErrorStatusCmd(CMD_GET_VEHICLETYPE_VARIABLE, + "Retrieval of a parameter requires its name.", outputStorage); + } + tempMsg.writeUnsignedByte(TYPE_STRING); + tempMsg.writeString(TraCI_VehicleType::getParameter(id, paramName)); } - tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(v->getParameter().getParameter(paramName, "")); - } - break; - default: - getVariable(variable, *v, tempMsg); break; + default: + getVariable(variable, id, tempMsg); + break; + } + } catch (TraCIException& e) { + return server.writeErrorStatusCmd(CMD_GET_VEHICLETYPE_VARIABLE, e.what(), outputStorage); } } server.writeStatusCmd(CMD_GET_VEHICLETYPE_VARIABLE, RTYPE_OK, "", outputStorage); @@ -106,71 +112,102 @@ } bool -TraCIServerAPI_VehicleType::getVariable(const int variable, const MSVehicleType& v, tcpip::Storage& tempMsg) { +TraCIServerAPI_VehicleType::getVariable(const int variable, const std::string& id, tcpip::Storage& tempMsg) { switch (variable) { - case VAR_LENGTH: + case VAR_LENGTH: { tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(v.getLength()); - break; - case VAR_HEIGHT: + tempMsg.writeDouble(TraCI_VehicleType::getLength(id)); + } + break; + case VAR_HEIGHT: { tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(v.getHeight()); - break; - case VAR_MINGAP: + tempMsg.writeDouble(TraCI_VehicleType::getHeight(id)); + } + break; + case VAR_MINGAP: { tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(v.getMinGap()); - break; - case VAR_MAXSPEED: + tempMsg.writeDouble(TraCI_VehicleType::getMinGap(id)); + } + break; + case VAR_MAXSPEED: { tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(v.getMaxSpeed()); - break; - case VAR_ACCEL: + tempMsg.writeDouble(TraCI_VehicleType::getMaxSpeed(id)); + } + break; + case VAR_ACCEL: { tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(v.getCarFollowModel().getMaxAccel()); - break; - case VAR_DECEL: + tempMsg.writeDouble(TraCI_VehicleType::getAccel(id)); + } + break; + case VAR_DECEL: { tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(v.getCarFollowModel().getMaxDecel()); - break; - case VAR_IMPERFECTION: + tempMsg.writeDouble(TraCI_VehicleType::getDecel(id)); + } + break; + case VAR_IMPERFECTION: { tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(v.getCarFollowModel().getImperfection()); - break; - case VAR_TAU: + tempMsg.writeDouble(TraCI_VehicleType::getImperfection(id)); + } + break; + case VAR_TAU: { tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(v.getCarFollowModel().getHeadwayTime()); - break; - case VAR_SPEED_FACTOR: + tempMsg.writeDouble(TraCI_VehicleType::getTau(id)); + } + break; + case VAR_SPEED_FACTOR: { tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(v.getSpeedFactor()); - break; - case VAR_SPEED_DEVIATION: + tempMsg.writeDouble(TraCI_VehicleType::getSpeedFactor(id)); + } + break; + case VAR_SPEED_DEVIATION: { tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(v.getSpeedDeviation()); - break; - case VAR_VEHICLECLASS: + tempMsg.writeDouble(TraCI_VehicleType::getSpeedDeviation(id)); + } + break; + case VAR_VEHICLECLASS: { tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(toString(v.getVehicleClass())); - break; - case VAR_EMISSIONCLASS: + tempMsg.writeString(TraCI_VehicleType::getVehicleClass(id)); + } + break; + case VAR_EMISSIONCLASS: { tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(PollutantsInterface::getName(v.getEmissionClass())); - break; - case VAR_SHAPECLASS: + tempMsg.writeString(TraCI_VehicleType::getEmissionClass(id)); + } + break; + case VAR_SHAPECLASS: { tempMsg.writeUnsignedByte(TYPE_STRING); - tempMsg.writeString(getVehicleShapeName(v.getGuiShape())); - break; - case VAR_WIDTH: + tempMsg.writeString(TraCI_VehicleType::getShapeClass(id)); + } + break; + case VAR_WIDTH: { tempMsg.writeUnsignedByte(TYPE_DOUBLE); - tempMsg.writeDouble(v.getWidth()); - break; - case VAR_COLOR: + tempMsg.writeDouble(TraCI_VehicleType::getWidth(id)); + } + break; + case VAR_COLOR: { tempMsg.writeUnsignedByte(TYPE_COLOR); - tempMsg.writeUnsignedByte(v.getColor().red()); - tempMsg.writeUnsignedByte(v.getColor().green()); - tempMsg.writeUnsignedByte(v.getColor().blue()); - tempMsg.writeUnsignedByte(v.getColor().alpha()); - break; + const TraCIColor& col = TraCI_VehicleType::getColor(id); + tempMsg.writeUnsignedByte(col.r); + tempMsg.writeUnsignedByte(col.g); + tempMsg.writeUnsignedByte(col.b); + tempMsg.writeUnsignedByte(col.a); + } + break; + case VAR_MINGAP_LAT: { + tempMsg.writeUnsignedByte(TYPE_DOUBLE); + tempMsg.writeDouble(TraCI_VehicleType::getMinGapLat(id)); + } + break; + case VAR_MAXSPEED_LAT: { + tempMsg.writeUnsignedByte(TYPE_DOUBLE); + tempMsg.writeDouble(TraCI_VehicleType::getMaxSpeedLat(id)); + } + break; + case VAR_LATALIGNMENT: { + tempMsg.writeUnsignedByte(TYPE_STRING); + tempMsg.writeString(TraCI_VehicleType::getLateralAlignment(id)); + } + break; default: break; } @@ -189,24 +226,32 @@ && variable != VAR_ACCEL && variable != VAR_DECEL && variable != VAR_IMPERFECTION && variable != VAR_TAU && variable != VAR_COLOR && variable != VAR_HEIGHT + && variable != VAR_MINGAP_LAT + && variable != VAR_MAXSPEED_LAT + && variable != VAR_LATALIGNMENT && variable != VAR_PARAMETER ) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLETYPE_VARIABLE, "Change Vehicle Type State: unsupported variable " + toHex(variable, 2) + " specified", outputStorage); + return server.writeErrorStatusCmd(CMD_SET_VEHICLETYPE_VARIABLE, + "Change Vehicle Type State: unsupported variable " + toHex(variable, 2) + + " specified", outputStorage); } // id std::string id = inputStorage.readString(); - MSVehicleType* v = MSNet::getInstance()->getVehicleControl().getVType(id); - if (v == 0) { - return server.writeErrorStatusCmd(CMD_SET_VEHICLETYPE_VARIABLE, "Vehicle type '" + id + "' is not known", outputStorage); - } +// MSVehicleType* v = TraCI_VehicleType::getVType(id); +// if (v == 0) { +// return server.writeErrorStatusCmd(CMD_SET_VEHICLETYPE_VARIABLE, "Vehicle type '" + id + "' is not known", +// outputStorage); +// } // process try { - if (setVariable(CMD_SET_VEHICLETYPE_VARIABLE, variable, *v, server, inputStorage, outputStorage)) { + if (setVariable(CMD_SET_VEHICLETYPE_VARIABLE, variable, id, server, inputStorage, outputStorage)) { server.writeStatusCmd(CMD_SET_VEHICLETYPE_VARIABLE, RTYPE_OK, warning, outputStorage); return true; } } catch (ProcessError& e) { return server.writeErrorStatusCmd(CMD_SET_VEHICLETYPE_VARIABLE, e.what(), outputStorage); + } catch (TraCIException& e) { + return server.writeErrorStatusCmd(CMD_SET_VEHICLETYPE_VARIABLE, e.what(), outputStorage); } return false; } @@ -214,7 +259,7 @@ bool TraCIServerAPI_VehicleType::setVariable(const int cmd, const int variable, - MSVehicleType& v, TraCIServer& server, + const std::string& id, TraCIServer& server, tcpip::Storage& inputStorage, tcpip::Storage& outputStorage) { switch (variable) { case VAR_LENGTH: { @@ -225,7 +270,7 @@ if (value <= 0.0 || fabs(value) == std::numeric_limits::infinity()) { return server.writeErrorStatusCmd(cmd, "Invalid length.", outputStorage); } - v.setLength(value); + TraCI_VehicleType::setLength(id, value); } break; case VAR_HEIGHT: { @@ -236,7 +281,7 @@ if (value <= 0.0 || fabs(value) == std::numeric_limits::infinity()) { return server.writeErrorStatusCmd(cmd, "Invalid height.", outputStorage); } - v.setHeight(value); + TraCI_VehicleType::setHeight(id, value); } break; case VAR_MAXSPEED: { @@ -247,7 +292,7 @@ if (value <= 0.0 || fabs(value) == std::numeric_limits::infinity()) { return server.writeErrorStatusCmd(cmd, "Invalid maximum speed.", outputStorage); } - v.setMaxSpeed(value); + TraCI_VehicleType::setMaxSpeed(id, value); } break; case VAR_VEHICLECLASS: { @@ -256,7 +301,7 @@ return server.writeErrorStatusCmd(cmd, "Setting vehicle class requires a string.", outputStorage); } try { - v.setVClass(getVehicleClassID(vclass)); + TraCI_VehicleType::setVehicleClass(id, vclass); } catch (InvalidArgument e) { return server.writeErrorStatusCmd(cmd, "Unknown vehicle class '" + vclass + "'.", outputStorage); } @@ -270,7 +315,7 @@ if (value <= 0.0 || fabs(value) == std::numeric_limits::infinity()) { return server.writeErrorStatusCmd(cmd, "Invalid speed factor.", outputStorage); } - v.setSpeedFactor(value); + TraCI_VehicleType::setSpeedFactor(id, value); } break; case VAR_SPEED_DEVIATION: { @@ -281,7 +326,7 @@ if (value < 0.0 || fabs(value) == std::numeric_limits::infinity()) { return server.writeErrorStatusCmd(cmd, "Invalid speed deviation.", outputStorage); } - v.setSpeedDeviation(value); + TraCI_VehicleType::setSpeedDeviation(id, value); } break; case VAR_EMISSIONCLASS: { @@ -290,7 +335,7 @@ return server.writeErrorStatusCmd(cmd, "Setting emission class requires a string.", outputStorage); } try { - v.setEmissionClass(PollutantsInterface::getClassByName(eclass)); + TraCI_VehicleType::setEmissionClass(id, eclass); } catch (InvalidArgument e) { return server.writeErrorStatusCmd(cmd, "Unknown emission class '" + eclass + "'.", outputStorage); } @@ -298,13 +343,13 @@ break; case VAR_WIDTH: { double value = 0; - if (!server.readTypeCheckingDouble(inputStorage, value)) { + if (!server.readTypeCheckingDouble(inputStorage, value)) { return server.writeErrorStatusCmd(cmd, "Setting width requires a double.", outputStorage); } if (value <= 0.0 || fabs(value) == std::numeric_limits::infinity()) { return server.writeErrorStatusCmd(cmd, "Invalid width.", outputStorage); } - v.setWidth(value); + TraCI_VehicleType::setWidth(id, value); } break; case VAR_MINGAP: { @@ -315,7 +360,42 @@ if (value < 0.0 || fabs(value) == std::numeric_limits::infinity()) { return server.writeErrorStatusCmd(cmd, "Invalid minimum gap.", outputStorage); } - v.setMinGap(value); + TraCI_VehicleType::setMinGap(id, value); + } + break; + case VAR_MINGAP_LAT: { + double value = 0; + if (!server.readTypeCheckingDouble(inputStorage, value)) { + return server.writeErrorStatusCmd(cmd, "Setting minimum lateral gap requires a double.", outputStorage); + } + if (value < 0.0 || fabs(value) == std::numeric_limits::infinity()) { + return server.writeErrorStatusCmd(cmd, "Invalid minimum lateral gap.", outputStorage); + } + TraCI_VehicleType::setMinGapLat(id, value); + } + break; + case VAR_MAXSPEED_LAT: { + double value = 0; + if (!server.readTypeCheckingDouble(inputStorage, value)) { + return server.writeErrorStatusCmd(cmd, "Setting maximum lateral speed requires a double.", outputStorage); + } + if (value < 0.0 || fabs(value) == std::numeric_limits::infinity()) { + return server.writeErrorStatusCmd(cmd, "Invalid maximum lateral speed.", outputStorage); + } + TraCI_VehicleType::setMaxSpeedLat(id, value); + } + break; + case VAR_LATALIGNMENT: { + std::string latAlign; + if (!server.readTypeCheckingString(inputStorage, latAlign)) { + return server.writeErrorStatusCmd(cmd, "Setting preferred lateral alignment requires a string.", + outputStorage); + } + if (SUMOXMLDefinitions::LateralAlignments.hasString(latAlign)) { + TraCI_VehicleType::setLateralAlignment(id, latAlign); + } else { + return server.writeErrorStatusCmd(cmd, "Unknown lateral alignment " + latAlign + "'.", outputStorage); + } } break; case VAR_SHAPECLASS: { @@ -324,7 +404,7 @@ return server.writeErrorStatusCmd(cmd, "Setting vehicle shape requires a string.", outputStorage); } try { - v.setShape(getVehicleShapeID(sclass)); + TraCI_VehicleType::setShapeClass(id, sclass); } catch (InvalidArgument e) { return server.writeErrorStatusCmd(cmd, "Unknown vehicle shape " + sclass + "'.", outputStorage); } @@ -338,7 +418,7 @@ if (value < 0.0 || fabs(value) == std::numeric_limits::infinity()) { return server.writeErrorStatusCmd(cmd, "Invalid acceleration.", outputStorage); } - v.getCarFollowModel().setMaxAccel(value); + TraCI_VehicleType::setAccel(id, value); } break; case VAR_DECEL: { @@ -349,7 +429,7 @@ if (value < 0.0 || fabs(value) == std::numeric_limits::infinity()) { return server.writeErrorStatusCmd(cmd, "Invalid deceleration.", outputStorage); } - v.getCarFollowModel().setMaxDecel(value); + TraCI_VehicleType::setDecel(id, value); } break; case VAR_IMPERFECTION: { @@ -360,7 +440,7 @@ if (value < 0.0 || fabs(value) == std::numeric_limits::infinity()) { return server.writeErrorStatusCmd(cmd, "Invalid driver imperfection.", outputStorage); } - v.getCarFollowModel().setImperfection(value); + TraCI_VehicleType::setImperfection(id, value); } break; case VAR_TAU: { @@ -371,32 +451,35 @@ if (value < 0.0 || fabs(value) == std::numeric_limits::infinity()) { return server.writeErrorStatusCmd(cmd, "Invalid headway time.", outputStorage); } - v.getCarFollowModel().setHeadwayTime(value); + TraCI_VehicleType::setTau(id, value); } break; case VAR_COLOR: { - RGBColor col; + TraCIColor col; if (!server.readTypeCheckingColor(inputStorage, col)) { return server.writeErrorStatusCmd(cmd, "The color must be given using the according type.", outputStorage); } - v.setColor(col); + TraCI_VehicleType::setColor(id, col); } break; case VAR_PARAMETER: { if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) { - return server.writeErrorStatusCmd(cmd, "A compound object is needed for setting a parameter.", outputStorage); + return server.writeErrorStatusCmd(cmd, "A compound object is needed for setting a parameter.", + outputStorage); } //readt itemNo inputStorage.readInt(); std::string name; if (!server.readTypeCheckingString(inputStorage, name)) { - return server.writeErrorStatusCmd(cmd, "The name of the parameter must be given as a string.", outputStorage); + return server.writeErrorStatusCmd(cmd, "The name of the parameter must be given as a string.", + outputStorage); } std::string value; if (!server.readTypeCheckingString(inputStorage, value)) { - return server.writeErrorStatusCmd(cmd, "The value of the parameter must be given as a string.", outputStorage); + return server.writeErrorStatusCmd(cmd, "The value of the parameter must be given as a string.", + outputStorage); } - ((SUMOVTypeParameter&) v.getParameter()).addParameter(name, value); + TraCI_VehicleType::addParameter(id, name, value); } break; default: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_VehicleType.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_VehicleType.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServerAPI_VehicleType.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServerAPI_VehicleType.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 07.05.2009 -/// @version $Id: TraCIServerAPI_VehicleType.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: TraCIServerAPI_VehicleType.h 24108 2017-04-27 18:43:30Z behrisch $ /// // APIs for getting/setting vehicle type values via TraCI /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,7 +33,7 @@ #ifndef NO_TRACI -#include "TraCIException.h" +#include "TraCIDefs.h" #include "TraCIServer.h" #include @@ -63,7 +63,7 @@ * @param[in] v The vehicle type to get the value from * @param[out] tempMsg The storage to write the result to */ - static bool getVariable(const int variable, const MSVehicleType& v, tcpip::Storage& tempMsg); + static bool getVariable(const int variable, const std::string& v, tcpip::Storage& tempMsg); /** @brief Processes a set value command (Command 0xc5: Change Vehicle Type State) @@ -79,7 +79,7 @@ /** @brief Processes a set value for the given type */ static bool setVariable(const int cmd, const int variable, - MSVehicleType& v, TraCIServer& server, + const std::string& id, TraCIServer& server, tcpip::Storage& inputStorage, tcpip::Storage& outputStorage); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServer.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServer.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServer.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServer.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -11,12 +11,12 @@ /// @author Michael Behrisch /// @author Mario Krumnow /// @date 2007/10/24 -/// @version $Id: TraCIServer.cpp 21813 2016-10-26 20:30:04Z behrisch $ +/// @version $Id: TraCIServer.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// /// TraCI server used to control sumo by a remote TraCI client (e.g., ns2) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -72,13 +72,14 @@ #include #include #include +#include "lib/TraCI.h" #include "TraCIConstants.h" #include "TraCIServer.h" #include "TraCIServerAPI_InductionLoop.h" #include "TraCIServerAPI_Junction.h" #include "TraCIServerAPI_Lane.h" -#include "TraCIServerAPI_MeMeDetector.h" -#include "TraCIServerAPI_ArealDetector.h" +#include "TraCIServerAPI_MultiEntryExit.h" +#include "TraCIServerAPI_LaneArea.h" #include "TraCIServerAPI_TLS.h" #include "TraCIServerAPI_Vehicle.h" #include "TraCIServerAPI_VehicleType.h" @@ -89,10 +90,6 @@ #include "TraCIServerAPI_Simulation.h" #include "TraCIServerAPI_Person.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions @@ -120,8 +117,8 @@ MSNet::getInstance()->addVehicleStateListener(this); myExecutors[CMD_GET_INDUCTIONLOOP_VARIABLE] = &TraCIServerAPI_InductionLoop::processGet; - myExecutors[CMD_GET_AREAL_DETECTOR_VARIABLE] = &TraCIServerAPI_ArealDetector::processGet; - myExecutors[CMD_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE] = &TraCIServerAPI_MeMeDetector::processGet; + myExecutors[CMD_GET_LANEAREA_VARIABLE] = &TraCIServerAPI_LaneArea::processGet; + myExecutors[CMD_GET_MULTIENTRYEXIT_VARIABLE] = &TraCIServerAPI_MultiEntryExit::processGet; myExecutors[CMD_GET_TL_VARIABLE] = &TraCIServerAPI_TLS::processGet; myExecutors[CMD_SET_TL_VARIABLE] = &TraCIServerAPI_TLS::processSet; @@ -170,15 +167,11 @@ TraCIServer::~TraCIServer() { - MSNet::getInstance()->removeVehicleStateListener(this); if (mySocket != NULL) { mySocket->close(); delete mySocket; } - for (std::map::const_iterator i = myObjects.begin(); i != myObjects.end(); ++i) { - delete(*i).second; - } - delete myLaneTree; + cleanup(); } @@ -220,7 +213,7 @@ void -TraCIServer::setVTDControlled(MSVehicle* v, Position xyPos, MSLane* l, SUMOReal pos, SUMOReal posLat, SUMOReal angle, +TraCIServer::setVTDControlled(MSVehicle* v, Position xyPos, MSLane* l, double pos, double posLat, double angle, int edgeOffset, ConstMSEdgeVector route, SUMOTime t) { myVTDControlledVehicles[v->getID()] = v; v->getInfluencer().setVTDControlled(xyPos, l, pos, posLat, angle, edgeOffset, route, t); @@ -263,7 +256,8 @@ // Simulation should run until // 1. end time reached or // 2. got CMD_CLOSE or - // 3. Client closes socket connection + // 3. got CMD_LOAD or + // 4. Client closes socket connection if (myInstance->myDoingSimStep) { myInstance->postProcessSimulationStep2(); myInstance->myDoingSimStep = false; @@ -282,13 +276,16 @@ while (myInstance->myInputStorage.valid_pos() && !myDoCloseConnection) { // dispatch each command int cmd = myInstance->dispatchCommand(); - if (cmd == CMD_SIMSTEP2) { + if (cmd == CMD_SIMSTEP) { myInstance->myDoingSimStep = true; for (std::map >::iterator i = myInstance->myVehicleStateChanges.begin(); i != myInstance->myVehicleStateChanges.end(); ++i) { (*i).second.clear(); } return; } + if (cmd == CMD_LOAD) { + return; + } } } if (myDoCloseConnection && myInstance->myOutputStorage.size() > 0) { @@ -308,6 +305,18 @@ } +void +TraCIServer::cleanup() { + mySubscriptions.clear(); + for (std::map::const_iterator i = myObjects.begin(); i != myObjects.end(); ++i) { + delete(*i).second; + } + myObjects.clear(); + delete myLaneTree; + myLaneTree = 0; + myTargetTime = string2time(OptionsCont::getOptions().getString("begin")); +} + #ifdef HAVE_PYTHON @@ -415,7 +424,21 @@ case CMD_GETVERSION: success = commandGetVersion(); break; - case CMD_SIMSTEP2: { + case CMD_LOAD: { + std::vector args; + if (!readTypeCheckingStringList(myInputStorage, args)) { + return writeErrorStatusCmd(CMD_LOAD, "A load command needs a list of string arguments.", myOutputStorage); + } + try { + TraCI::load(args); + success = true; + writeStatusCmd(CMD_LOAD, RTYPE_OK, ""); + } catch (TraCIException& e) { + return writeErrorStatusCmd(CMD_LOAD, e.what(), myOutputStorage); + } + break; + } + case CMD_SIMSTEP: { SUMOTime nextT = myInputStorage.readInt(); success = true; if (nextT != 0) { @@ -424,11 +447,13 @@ myTargetTime += DELTA_T; } if (myAmEmbedded) { - MSNet::getInstance()->simulationStep(); - postProcessSimulationStep2(); for (std::map >::iterator i = myInstance->myVehicleStateChanges.begin(); i != myInstance->myVehicleStateChanges.end(); ++i) { (*i).second.clear(); } + while (MSNet::getInstance()->getCurrentTimeStep() < myTargetTime) { + MSNet::getInstance()->simulationStep(); + } + postProcessSimulationStep2(); } return commandId; } @@ -437,8 +462,8 @@ success = true; break; case CMD_SUBSCRIBE_INDUCTIONLOOP_VARIABLE: - case CMD_SUBSCRIBE_AREAL_DETECTOR_VARIABLE: - case CMD_SUBSCRIBE_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE: + case CMD_SUBSCRIBE_LANEAREA_VARIABLE: + case CMD_SUBSCRIBE_MULTIENTRYEXIT_VARIABLE: case CMD_SUBSCRIBE_TL_VARIABLE: case CMD_SUBSCRIBE_LANE_VARIABLE: case CMD_SUBSCRIBE_VEHICLE_VARIABLE: @@ -454,8 +479,8 @@ success = addObjectVariableSubscription(commandId, false); break; case CMD_SUBSCRIBE_INDUCTIONLOOP_CONTEXT: - case CMD_SUBSCRIBE_AREAL_DETECTOR_CONTEXT: - case CMD_SUBSCRIBE_MULTI_ENTRY_EXIT_DETECTOR_CONTEXT: + case CMD_SUBSCRIBE_LANEAREA_CONTEXT: + case CMD_SUBSCRIBE_MULTIENTRYEXIT_CONTEXT: case CMD_SUBSCRIBE_TL_CONTEXT: case CMD_SUBSCRIBE_LANE_CONTEXT: case CMD_SUBSCRIBE_VEHICLE_CONTEXT: @@ -514,7 +539,7 @@ void TraCIServer::postProcessSimulationStep2() { SUMOTime t = MSNet::getInstance()->getCurrentTimeStep(); - writeStatusCmd(CMD_SIMSTEP2, RTYPE_OK, ""); + writeStatusCmd(CMD_SIMSTEP, RTYPE_OK, ""); int noActive = 0; for (std::vector::iterator i = mySubscriptions.begin(); i != mySubscriptions.end();) { const Subscription& s = *i; @@ -644,7 +669,7 @@ return true; } break; - case CMD_SUBSCRIBE_MULTI_ENTRY_EXIT_DETECTOR_CONTEXT: + case CMD_SUBSCRIBE_MULTIENTRYEXIT_CONTEXT: break; case CMD_SUBSCRIBE_TL_CONTEXT: break; @@ -702,7 +727,7 @@ } void -TraCIServer::collectObjectsInRange(int domain, const PositionVector& shape, SUMOReal range, std::set& into) { +TraCIServer::collectObjectsInRange(int domain, const PositionVector& shape, double range, std::set& into) { // build the look-up tree if not yet existing if (myObjects.find(domain) == myObjects.end()) { switch (domain) { @@ -858,7 +883,7 @@ const SUMOTime endTime = myInputStorage.readInt(); const std::string id = myInputStorage.readString(); const int domain = hasContext ? myInputStorage.readUnsignedByte() : 0; - const SUMOReal range = hasContext ? myInputStorage.readDouble() : 0.; + const double range = hasContext ? myInputStorage.readDouble() : 0.; const int num = myInputStorage.readUnsignedByte(); std::vector variables; std::vector > parameters; @@ -935,27 +960,26 @@ bool -TraCIServer::readTypeCheckingColor(tcpip::Storage& inputStorage, RGBColor& into) { +TraCIServer::readTypeCheckingColor(tcpip::Storage& inputStorage, TraCIColor& into) { if (inputStorage.readUnsignedByte() != TYPE_COLOR) { return false; } - unsigned char r = static_cast(inputStorage.readUnsignedByte()); - unsigned char g = static_cast(inputStorage.readUnsignedByte()); - unsigned char b = static_cast(inputStorage.readUnsignedByte()); - unsigned char a = static_cast(inputStorage.readUnsignedByte()); - into.set(r, g, b, a); + into.r = static_cast(inputStorage.readUnsignedByte()); + into.g = static_cast(inputStorage.readUnsignedByte()); + into.b = static_cast(inputStorage.readUnsignedByte()); + into.a = static_cast(inputStorage.readUnsignedByte()); return true; } bool -TraCIServer::readTypeCheckingPosition2D(tcpip::Storage& inputStorage, Position& into) { +TraCIServer::readTypeCheckingPosition2D(tcpip::Storage& inputStorage, TraCIPosition& into) { if (inputStorage.readUnsignedByte() != POSITION_2D) { return false; } - SUMOReal x = inputStorage.readDouble(); - SUMOReal y = inputStorage.readDouble(); - into.set(x, y, 0); + into.x = inputStorage.readDouble(); + into.y = inputStorage.readDouble(); + into.z = 0; return true; } @@ -965,10 +989,10 @@ if (inputStorage.readUnsignedByte() != TYPE_BOUNDINGBOX) { return false; } - const SUMOReal xmin = inputStorage.readDouble(); - const SUMOReal ymin = inputStorage.readDouble(); - const SUMOReal xmax = inputStorage.readDouble(); - const SUMOReal ymax = inputStorage.readDouble(); + const double xmin = inputStorage.readDouble(); + const double ymin = inputStorage.readDouble(); + const double xmax = inputStorage.readDouble(); + const double ymax = inputStorage.readDouble(); into.set(xmin, ymin, xmax, ymax); return true; } @@ -1003,8 +1027,8 @@ int noEntries = inputStorage.readUnsignedByte(); PositionVector shape; for (int i = 0; i < noEntries; ++i) { - SUMOReal x = inputStorage.readDouble(); - SUMOReal y = inputStorage.readDouble(); + double x = inputStorage.readDouble(); + double y = inputStorage.readDouble(); into.push_back(Position(x, y)); } return true; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServer.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServer.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci-server/TraCIServer.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci-server/TraCIServer.h 2017-07-23 16:22:03.000000000 +0000 @@ -9,12 +9,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date 2007/10/24 -/// @version $Id: TraCIServer.h 20969 2016-06-15 08:02:52Z namdre $ +/// @version $Id: TraCIServer.h 23965 2017-04-18 12:41:56Z namdre $ /// /// TraCI server used to control sumo by a remote TraCI client /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,6 +43,7 @@ #include #include +#include "TraCIDefs.h" #include "TraCIConstants.h" #define BUILD_TCPIP @@ -108,11 +109,13 @@ /// @brief process all commands until a simulation step is wanted static void processCommandsUntilSimStep(SUMOTime step); - void setVTDControlled(MSVehicle* v, Position xyPos, MSLane* l, SUMOReal pos, SUMOReal posLat, SUMOReal angle, + void setVTDControlled(MSVehicle* v, Position xyPos, MSLane* l, double pos, double posLat, double angle, int edgeOffset, ConstMSEdgeVector route, SUMOTime t); void postProcessVTD(); + /// @brief clean up subscriptions + void cleanup(); #ifdef HAVE_PYTHON @@ -161,7 +164,7 @@ void writeResponseWithLength(tcpip::Storage& outputStorage, tcpip::Storage& tempMsg); - void collectObjectsInRange(int domain, const PositionVector& shape, SUMOReal range, std::set& into); + void collectObjectsInRange(int domain, const PositionVector& shape, double range, std::set& into); /// @name Helpers for reading and checking values @@ -209,7 +212,7 @@ * @param[out] into Holder of the read value * @return Whether a color was given (by data type) */ - bool readTypeCheckingColor(tcpip::Storage& inputStorage, RGBColor& into); + bool readTypeCheckingColor(tcpip::Storage& inputStorage, TraCIColor& into); /** @brief Reads the value type and a 2D position, verifying the type @@ -218,7 +221,7 @@ * @param[out] into Holder of the read value * @return Whether a 2D position was given (by data type) */ - bool readTypeCheckingPosition2D(tcpip::Storage& inputStorage, Position& into); + bool readTypeCheckingPosition2D(tcpip::Storage& inputStorage, TraCIPosition& into); /** @brief Reads the value type and a 2D bounding box, verifying the type @@ -341,7 +344,7 @@ */ Subscription(int commandIdArg, const std::string& idArg, const std::vector& variablesArg, const std::vector >& paramsArg, - SUMOTime beginTimeArg, SUMOTime endTimeArg, bool contextVarsArg, int contextDomainArg, SUMOReal rangeArg) + SUMOTime beginTimeArg, SUMOTime endTimeArg, bool contextVarsArg, int contextDomainArg, double rangeArg) : commandId(commandIdArg), id(idArg), variables(variablesArg), parameters(paramsArg), beginTime(beginTimeArg), endTime(endTimeArg), contextVars(contextVarsArg), contextDomain(contextDomainArg), range(rangeArg) {} @@ -362,7 +365,7 @@ /// @brief The domain ID of the context int contextDomain; /// @brief The range of the context - SUMOReal range; + double range; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci_testclient/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci_testclient/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci_testclient/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci_testclient/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -1,13 +1,8 @@ -if CHECK_MEMORY_LEAKS -MEM_LIBS = ../foreign/nvwa/libnvwa.a -endif - if TRACI bin_PROGRAMS = TraCITestClient TraCITestClient_SOURCES = tracitestclient_main.cpp TraCITestClient.cpp TraCITestClient.h TraCITestClient_LDADD = ../utils/common/libcommon.a \ -../utils/traci/libtraci.a ../foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) +../utils/traci/libtraciclient.a ../foreign/tcpip/libtcpip.a endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci_testclient/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci_testclient/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci_testclient/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci_testclient/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -101,8 +101,8 @@ TraCITestClient_OBJECTS = $(am_TraCITestClient_OBJECTS) @TRACI_TRUE@TraCITestClient_DEPENDENCIES = \ @TRACI_TRUE@ ../utils/common/libcommon.a \ -@TRACI_TRUE@ ../utils/traci/libtraci.a \ -@TRACI_TRUE@ ../foreign/tcpip/libtcpip.a $(MEM_LIBS) +@TRACI_TRUE@ ../utils/traci/libtraciclient.a \ +@TRACI_TRUE@ ../foreign/tcpip/libtcpip.a AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -329,11 +329,9 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -@CHECK_MEMORY_LEAKS_TRUE@MEM_LIBS = ../foreign/nvwa/libnvwa.a @TRACI_TRUE@TraCITestClient_SOURCES = tracitestclient_main.cpp TraCITestClient.cpp TraCITestClient.h @TRACI_TRUE@TraCITestClient_LDADD = ../utils/common/libcommon.a \ -@TRACI_TRUE@../utils/traci/libtraci.a ../foreign/tcpip/libtcpip.a \ -@TRACI_TRUE@$(MEM_LIBS) +@TRACI_TRUE@../utils/traci/libtraciclient.a ../foreign/tcpip/libtcpip.a all: all-am diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci_testclient/TraCITestClient.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci_testclient/TraCITestClient.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci_testclient/TraCITestClient.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci_testclient/TraCITestClient.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 2008/04/07 -/// @version $Id: TraCITestClient.cpp 21671 2016-10-12 11:12:57Z namdre $ +/// @version $Id: TraCITestClient.cpp 24028 2017-04-24 05:10:18Z behrisch $ /// /// A test execution class /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,14 +44,11 @@ #include #include +#include #include #include #include "TraCITestClient.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -149,7 +146,7 @@ } else if (lineCommand.compare("subscribecontext") == 0) { // trigger command SubscribeXXXVariable int domID, varNo, domain; - SUMOReal range; + double range; std::string beginTime, endTime; std::string objID; defFile >> domID >> objID >> beginTime >> endTime >> domain >> range >> varNo; @@ -167,13 +164,13 @@ msg << "Error in definition file: " << lineCommand << " is not a valid command"; errorMsg(msg); commandClose(); - close(); + closeSocket(); return false; } } defFile.close(); commandClose(); - close(); + closeSocket(); return true; } @@ -186,7 +183,7 @@ tcpip::Storage inMsg; try { std::string acknowledgement; - check_resultState(inMsg, CMD_SIMSTEP2, false, &acknowledgement); + check_resultState(inMsg, CMD_SIMSTEP, false, &acknowledgement); answerLog << acknowledgement << std::endl; validateSimulationStep2(inMsg); } catch (tcpip::SocketException& e) { @@ -292,7 +289,7 @@ void TraCITestClient::commandSubscribeContextVariable(int domID, const std::string& objID, SUMOTime beginTime, SUMOTime endTime, - int domain, SUMOReal range, int varNo, std::ifstream& defFile) { + int domain, double range, int varNo, std::ifstream& defFile) { std::vector vars; for (int i = 0; i < varNo; ++i) { int var; @@ -579,10 +576,10 @@ double doublev = inMsg.readDouble(); answerLog << " Double value: " << doublev << std::endl; } else if (valueDataType == TYPE_BOUNDINGBOX) { - SUMOReal lowerLeftX = inMsg.readDouble(); - SUMOReal lowerLeftY = inMsg.readDouble(); - SUMOReal upperRightX = inMsg.readDouble(); - SUMOReal upperRightY = inMsg.readDouble(); + double lowerLeftX = inMsg.readDouble(); + double lowerLeftY = inMsg.readDouble(); + double upperRightX = inMsg.readDouble(); + double upperRightY = inMsg.readDouble(); answerLog << " BoundaryBoxValue: lowerLeft x=" << lowerLeftX << " y=" << lowerLeftY << " upperRight x=" << upperRightX << " y=" << upperRightY << std::endl; @@ -590,21 +587,21 @@ int length = inMsg.readUnsignedByte(); answerLog << " PolygonValue: "; for (int i = 0; i < length; i++) { - SUMOReal x = inMsg.readDouble(); - SUMOReal y = inMsg.readDouble(); + double x = inMsg.readDouble(); + double y = inMsg.readDouble(); answerLog << "(" << x << "," << y << ") "; } answerLog << std::endl; } else if (valueDataType == POSITION_3D) { - SUMOReal x = inMsg.readDouble(); - SUMOReal y = inMsg.readDouble(); - SUMOReal z = inMsg.readDouble(); + double x = inMsg.readDouble(); + double y = inMsg.readDouble(); + double z = inMsg.readDouble(); answerLog << " Position3DValue: " << std::endl; answerLog << " x: " << x << " y: " << y << " z: " << z << std::endl; } else if (valueDataType == POSITION_ROADMAP) { std::string roadId = inMsg.readString(); - SUMOReal pos = inMsg.readDouble(); + double pos = inMsg.readDouble(); int laneId = inMsg.readUnsignedByte(); answerLog << " RoadMapPositionValue: roadId=" << roadId << " pos=" << pos @@ -656,8 +653,8 @@ } answerLog << " ]" << std::endl; } else if (valueDataType == POSITION_2D) { - SUMOReal xv = inMsg.readDouble(); - SUMOReal yv = inMsg.readDouble(); + double xv = inMsg.readDouble(); + double yv = inMsg.readDouble(); answerLog << " position value: (" << xv << "," << yv << ")" << std::endl; } else if (valueDataType == TYPE_COLOR) { int r = inMsg.readUnsignedByte(); @@ -696,11 +693,28 @@ answerLog << " getWidth: " << vehicletype.getWidth("t1") << "\n"; vehicletype.setHeight("t1", 1.8); answerLog << " getHeight: " << vehicletype.getHeight("t1") << "\n"; + vehicletype.setMinGapLat("t1", 1.5); + answerLog << " setMinGapLat: " << vehicletype.getMinGapLat("t1") << "\n"; + vehicletype.setMaxSpeedLat("t1", 1.2); + answerLog << " setMaxSpeedLat: " << vehicletype.getMaxSpeedLat("t1") << "\n"; + vehicletype.setLateralAlignment("t1", "compact"); + answerLog << " getLateralAlignment: " << vehicletype.getLateralAlignment("t1") << "\n"; + answerLog << " vehicle:\n"; + vehicle.setLine("0", "S42"); + std::vector via; + via.push_back("e_shape1"); + vehicle.setVia("0", via); answerLog << " getRoadID: " << vehicle.getRoadID("0") << "\n"; answerLog << " getLaneID: " << vehicle.getLaneID("0") << "\n"; + answerLog << " getLanePosition: " << vehicle.getLanePosition("0") << "\n"; + answerLog << " getLateralLanePosition: " << vehicle.getLateralLanePosition("0") << "\n"; answerLog << " getSpeedMode: " << vehicle.getSpeedMode("0") << "\n"; answerLog << " getSlope: " << vehicle.getSlope("0") << "\n"; + answerLog << " getLine: " << vehicle.getLine("0") << "\n"; + answerLog << " getVia: " << joinToString(vehicle.getVia("0"), ",") << "\n"; + vehicle.setMaxSpeed("0", 30); + answerLog << " getMaxSpeed: " << vehicle.getMaxSpeed("0") << "\n"; TraCIColor col1; col1.r = 255; col1.g = 255; @@ -708,7 +722,7 @@ col1.a = 128; vehicle.setColor("0", col1); TraCIColor col2 = vehicle.getColor("0"); - answerLog << " getColor: " << col2.r << "r=" << col2.r << " g=" << col2.g << " b=" << col2.b << " a=" << col2.a << "\n"; + answerLog << " getColor: r=" << (int)col2.r << " g=" << (int)col2.g << " b=" << (int)col2.b << " a=" << (int)col2.a << "\n"; answerLog << " getNextTLS:\n"; std::vector result = vehicle.getNextTLS("0"); for (int i = 0; i < (int)result.size(); ++i) { @@ -720,11 +734,15 @@ simulationStep(); answerLog << " getRoadID: " << vehicle.getRoadID("0") << "\n"; answerLog << " getLaneID: " << vehicle.getLaneID("0") << "\n"; + vehicle.changeTarget("0", "e_o0"); + answerLog << " edges: " << joinToString(vehicle.getEdges("0"), " ") << "\n"; answerLog << " add:\n"; vehicle.add("1", "e_u1"); simulationStep(); answerLog << " getIDList: " << joinToString(vehicle.getIDList(), " ") << "\n"; answerLog << " getWaitingTime: " << vehicle.getWaitingTime("0") << "\n"; + vehicle.setShapeClass("0", "bicycle"); + answerLog << " getShapeClass: " << vehicle.getShapeClass("0") << "\n"; answerLog << " remove:\n"; vehicle.remove("0"); answerLog << " getIDCount: " << vehicle.getIDCount() << "\n"; @@ -732,9 +750,9 @@ answerLog << " inductionloop:\n"; answerLog << " getIDList: " << joinToString(inductionloop.getIDList(), " ") << "\n"; answerLog << " getVehicleData:\n"; - std::vector result2 = inductionloop.getVehicleData("det1"); + std::vector result2 = inductionloop.getVehicleData("det1"); for (int i = 0; i < (int)result2.size(); ++i) { - const InductionLoopScope::VehicleData& vd = result2[i]; + const TraCIVehicleData& vd = result2[i]; answerLog << " veh=" << vd.id << " length=" << vd.length << " entered=" << vd.entryTime << " left=" << vd.leaveTime << " type=" << vd.typeID << "\n"; } @@ -762,11 +780,63 @@ } answerLog << " person:\n"; + person.setWidth("p0", 1); + person.setMinGap("p0", 2); + person.setLength("p0", 3); + person.setHeight("p0", 4); + person.setColor("p0", col1); + person.setType("p0", "stilts"); answerLog << " getIDList: " << joinToString(person.getIDList(), " ") << "\n"; answerLog << " getRoadID: " << person.getRoadID("p0") << "\n"; answerLog << " getTypeID: " << person.getTypeID("p0") << "\n"; answerLog << " getWaitingTime: " << person.getWaitingTime("p0") << "\n"; answerLog << " getNextEdge: " << person.getNextEdge("p0") << "\n"; + answerLog << " getStage: " << person.getStage("p0") << "\n"; + answerLog << " getRemainingStages: " << person.getRemainingStages("p0") << "\n"; + answerLog << " getVehicle: " << person.getVehicle("p0") << "\n"; + answerLog << " getEdges: " << joinToString(person.getEdges("p0"), " ") << "\n"; + person.setSpeed("p0", 3); + simulationStep(); + answerLog << " getSpeed: " << person.getSpeed("p0") << "\n"; + person.add("p1", "e_u1", 10); + std::vector walkEdges; + walkEdges.push_back("e_u1"); + walkEdges.push_back("e_shape1"); + person.appendWalkingStage("p1", walkEdges, -20); + person.appendWaitingStage("p1", 5); + person.appendDrivingStage("p1", "e_vu2", "BusLine42"); + // expect 4 stages due to the initial waiting-for-departure stage + answerLog << " getRemainingStages: " << person.getRemainingStages("p1") << "\n"; + person.removeStage("p1", 3); + answerLog << " getRemainingStages: " << person.getRemainingStages("p1") << "\n"; + person.removeStages("p1"); + answerLog << " getRemainingStages: " << person.getRemainingStages("p1") << "\n"; + answerLog << " getStage: " << person.getStage("p1") << "\n"; + simulationStep(); + answerLog << " trafficlights:\n"; + answerLog << " getIDList: " << joinToString(trafficlights.getIDList(), " ") << "\n"; + answerLog << " state: " << trafficlights.getRedYellowGreenState("n_m4") << "\n"; + answerLog << " program: " << trafficlights.getProgram("n_m4") << "\n"; + answerLog << " phase: " << trafficlights.getPhase("n_m4") << "\n"; + answerLog << " nextSwitch: " << trafficlights.getNextSwitch("n_m4") << "\n"; + answerLog << " controlledLanes: " << joinToString(trafficlights.getControlledLanes("n_m4"), " ") << "\n"; + std::vector links = trafficlights.getControlledLinks("n_m4"); + answerLog << " controlledLinks:\n"; + for (int i = 0; i < (int)links.size(); ++i) { + answerLog << " index=" << i << " from=" << links[i].from << " via=" << links[i].via << " to=" << links[i].to << "\n"; + } + answerLog << " load:\n"; + std::vector args; + args.push_back("-n"); + args.push_back("net.net.xml"); + args.push_back("-r"); + args.push_back("input_routes.rou.xml"); + args.push_back("--no-step-log"); + load(args); + simulationStep(); + answerLog << " getCurrentTime: " << simulation.getCurrentTime() << "\n"; + simulation.subscribe(CMD_SUBSCRIBE_VEHICLE_VARIABLE, "0", 0, TIME2STEPS(100), vars); + simulation.subscribeContext(CMD_SUBSCRIBE_EDGE_CONTEXT, "e_u1", 0, TIME2STEPS(100), CMD_GET_VEHICLE_VARIABLE, 100, vars2); answerLog << " gui:\n"; try { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci_testclient/TraCITestClient.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci_testclient/TraCITestClient.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci_testclient/TraCITestClient.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci_testclient/TraCITestClient.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Axel Wegener /// @author Michael Behrisch /// @date 2008/04/07 -/// @version $Id: TraCITestClient.h 21204 2016-07-20 07:42:26Z behrisch $ +/// @version $Id: TraCITestClient.h 24028 2017-04-24 05:10:18Z behrisch $ /// /// A test execution class /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,7 +37,6 @@ #include #include -#include #include @@ -124,7 +123,7 @@ * @param[in] varNo The number of subscribed variables * @param[in] defFile The stream to read variable values from */ - void commandSubscribeContextVariable(int domID, const std::string& objID, SUMOTime beginTime, SUMOTime endTime, int domain, SUMOReal range, int varNo, std::ifstream& defFile); + void commandSubscribeContextVariable(int domID, const std::string& objID, SUMOTime beginTime, SUMOTime endTime, int domain, double range, int varNo, std::ifstream& defFile); /// @} @@ -149,7 +148,7 @@ /// @name Results validation methods /// @{ - /** @brief Validates whether the given message is a valid answer to CMD_SIMSTEP2 + /** @brief Validates whether the given message is a valid answer to CMD_SIMSTEP * @param[in] inMsg The storage contain the message to validate * @return Whether the message is valid */ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci_testclient/tracitestclient_main.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci_testclient/tracitestclient_main.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/traci_testclient/tracitestclient_main.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/traci_testclient/tracitestclient_main.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Daniel Krajzewicz /// @date 2008/04/07 -/// @version $Id: tracitestclient_main.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: tracitestclient_main.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// /// Main method for TraCITestClient /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/AbstractMutex.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/AbstractMutex.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/AbstractMutex.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/AbstractMutex.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2005-07-12 -/// @version $Id: AbstractMutex.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AbstractMutex.h 22608 2017-01-17 06:28:54Z behrisch $ /// // An abstract class for encapsulating mutex implementations /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/Command.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/Command.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/Command.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/Command.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Christian Roessel /// @author Daniel Krajzewicz /// @date Thu, 20 Dec 2001 -/// @version $Id: Command.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: Command.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Base (microsim) event class /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/FileHelpers.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/FileHelpers.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/FileHelpers.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/FileHelpers.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 17 Dec 2001 -/// @version $Id: FileHelpers.cpp 21201 2016-07-19 11:57:22Z behrisch $ +/// @version $Id: FileHelpers.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Functions for an easier usage of files /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,10 +43,6 @@ #include "StringTokenizer.h" #include "MsgHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -160,15 +156,8 @@ std::ostream& -FileHelpers::writeUInt(std::ostream& strm, int value) { - strm.write((char*) &value, sizeof(int)); - return strm; -} - - -std::ostream& -FileHelpers::writeFloat(std::ostream& strm, SUMOReal value) { - strm.write((char*) &value, sizeof(SUMOReal)); +FileHelpers::writeFloat(std::ostream& strm, double value) { + strm.write((char*) &value, sizeof(double)); return strm; } @@ -184,7 +173,7 @@ FileHelpers::writeString(std::ostream& strm, const std::string& value) { int size = (int)value.length(); const char* cstr = value.c_str(); - writeUInt(strm, (int) size); + writeInt(strm, size); strm.write((char*) cstr, (std::streamsize)(sizeof(char)*size)); return strm; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/FileHelpers.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/FileHelpers.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/FileHelpers.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/FileHelpers.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Mon, 17 Dec 2001 -/// @version $Id: FileHelpers.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: FileHelpers.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Functions for an easier usage of files /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -145,24 +145,15 @@ static std::ostream& writeInt(std::ostream& strm, int value); - /** @brief Writes an integer binary - * - * @param[in, out] strm The stream to write into - * @param[in] value The integer to write - * @return Reference to the stream - */ - static std::ostream& writeUInt(std::ostream& strm, int value); - - /** @brief Writes a float binary * - * This method behaves differently depending on the definition of SUMOReal at compile time. + * This method behaves differently depending on the definition of double at compile time. * * @param[in, out] strm The stream to write into * @param[in] value The float to write * @return Reference to the stream */ - static std::ostream& writeFloat(std::ostream& strm, SUMOReal value); + static std::ostream& writeFloat(std::ostream& strm, double value); /** @brief Writes a byte binary @@ -225,7 +216,7 @@ template std::ostream& FileHelpers::writeEdgeVector(std::ostream& os, const std::vector& edges) { - FileHelpers::writeUInt(os, (int)edges.size()); + FileHelpers::writeInt(os, (int)edges.size()); std::vector follow; int maxFollow = 0; E prev = edges.front(); @@ -257,14 +248,14 @@ const int bits = maxFollow > 3 ? 4 : 2; const int numFields = 8 * sizeof(int) / bits; FileHelpers::writeInt(os, -bits); - FileHelpers::writeUInt(os, edges.front()->getNumericalID()); + FileHelpers::writeInt(os, edges.front()->getNumericalID()); int data = 0; int field = 0; for (std::vector::const_iterator i = follow.begin(); i != follow.end(); ++i) { data |= *i; field++; if (field == numFields) { - FileHelpers::writeUInt(os, data); + FileHelpers::writeInt(os, data); data = 0; field = 0; } else { @@ -272,7 +263,7 @@ } } if (field > 0) { - FileHelpers::writeUInt(os, data << ((numFields - field - 1) * bits)); + FileHelpers::writeInt(os, data << ((numFields - field - 1) * bits)); } } return os; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/IDSupplier.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/IDSupplier.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/IDSupplier.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/IDSupplier.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: IDSupplier.cpp 21201 2016-07-19 11:57:22Z behrisch $ +/// @version $Id: IDSupplier.cpp 24022 2017-04-23 09:24:08Z behrisch $ /// // A class that generates enumerated and prefixed string-ids /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,15 +35,11 @@ #include "StdDefs.h" #include "IDSupplier.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== -IDSupplier::IDSupplier(const std::string& prefix, long begin) +IDSupplier::IDSupplier(const std::string& prefix, long long int begin) : myCurrent(begin), myPrefix(prefix) {} @@ -71,7 +67,7 @@ IDSupplier::avoid(const std::string& id) { // does it start with prefix? if (id.find(myPrefix) == 0) { - long number; + long long int number; std::istringstream buf(id.substr(myPrefix.size())); buf >> number; // does it continue with a number? diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/IDSupplier.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/IDSupplier.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/IDSupplier.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/IDSupplier.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: IDSupplier.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: IDSupplier.h 24022 2017-04-23 09:24:08Z behrisch $ /// // A class that generates enumerated and prefixed string-ids /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,7 +46,7 @@ class IDSupplier { public: /// Constructor - IDSupplier(const std::string& prefix = "", long begin = 0); + IDSupplier(const std::string& prefix = "", long long int begin = 0); /** @brief Constructor * @param[in] prefix The string to use as ID prefix @@ -66,7 +66,7 @@ private: /// The current index - long myCurrent; + long long int myCurrent; /// The prefix to use std::string myPrefix; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -8,7 +8,7 @@ MsgRetrievingFunction.h \ Named.h NamedObjectCont.h NamedRTree.h \ Parameterised.cpp Parameterised.h \ -RandHelper.h RandHelper.cpp RandomDistributor.h \ +RandHelper.h RandHelper.cpp \ RGBColor.cpp RGBColor.h \ StaticCommand.h StdDefs.h StdDefs.cpp \ StringBijection.h \ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -340,7 +340,7 @@ MsgRetrievingFunction.h \ Named.h NamedObjectCont.h NamedRTree.h \ Parameterised.cpp Parameterised.h \ -RandHelper.h RandHelper.cpp RandomDistributor.h \ +RandHelper.h RandHelper.cpp \ RGBColor.cpp RGBColor.h \ StaticCommand.h StdDefs.h StdDefs.cpp \ StringBijection.h \ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/MsgHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/MsgHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/MsgHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/MsgHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Tue, 17 Jun 2003 -/// @version $Id: MsgHandler.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MsgHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Retrieves messages about the process and gives them further to output /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,10 +40,6 @@ #include #include "AbstractMutex.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member variables diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/MsgHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/MsgHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/MsgHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/MsgHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Tue, 17 Jun 2003 -/// @version $Id: MsgHandler.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MsgHandler.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Retrieves messages about the process and gives them further to output /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2003-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2003-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/MsgRetrievingFunction.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/MsgRetrievingFunction.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/MsgRetrievingFunction.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/MsgRetrievingFunction.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 24 Oct 2003 -/// @version $Id: MsgRetrievingFunction.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MsgRetrievingFunction.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Encapsulates an object's method for using it as a message retriever /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/Named.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/Named.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/Named.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/Named.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: Named.h 20804 2016-05-30 07:26:54Z namdre $ +/// @version $Id: Named.h 23307 2017-03-10 07:52:34Z behrisch $ /// // Base class for objects which have an id. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -77,7 +77,7 @@ /// @brief Function-object for stable sorting in containers - // @note Numbers of different lenghts will not be ordered by alphanumerical sorting + // @note Numbers of different lengths will not be ordered by alphanumerical sorting struct ComparatorIdLess { bool operator()(Named* const a, Named* const b) const { return a->getID() < b->getID(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/NamedObjectCont.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/NamedObjectCont.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/NamedObjectCont.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/NamedObjectCont.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: NamedObjectCont.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NamedObjectCont.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A map of named object pointers /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/NamedRTree.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/NamedRTree.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/NamedRTree.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/NamedRTree.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 27.10.2008 -/// @version $Id: NamedRTree.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NamedRTree.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A RT-tree for efficient storing of SUMO's Named objects /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/Parameterised.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/Parameterised.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/Parameterised.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/Parameterised.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file Parameterised.cpp /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: Parameterised.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: Parameterised.cpp 23673 2017-03-27 13:02:44Z behrisch $ /// // A super class for objects with additional parameters /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -28,12 +28,10 @@ #include #endif +#include "utils/iodevices/OutputDevice.h" +#include "TplConvert.h" #include "Parameterised.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -87,11 +85,30 @@ } +double +Parameterised::getDouble(const std::string& key, const double defaultValue) const { + std::map::const_iterator i = myMap.find(key); + if (i != myMap.end()) { + return TplConvert::_2double(i->second.c_str()); + } + return defaultValue; +} + + void Parameterised::clearParameter() { myMap.clear(); } +void +Parameterised::writeParams(OutputDevice& out) const { + for (std::map::const_iterator j = myMap.begin(); j != myMap.end(); ++j) { + out.openTag(SUMO_TAG_PARAM); + out.writeAttr(SUMO_ATTR_KEY, (*j).first); + out.writeAttr(SUMO_ATTR_VALUE, (*j).second); + out.closeTag(); + } +} /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/Parameterised.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/Parameterised.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/Parameterised.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/Parameterised.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Melanie Knocke /// @date Sept 2002 -/// @version $Id: Parameterised.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: Parameterised.h 23673 2017-03-27 13:02:44Z behrisch $ /// // A super class for objects with additional parameters /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,6 +36,10 @@ #include #include +// =========================================================================== +// class declarations +// =========================================================================== +class OutputDevice; // =========================================================================== // class definitions @@ -96,6 +100,14 @@ const std::string& getParameter(const std::string& key, const std::string& defaultValue) const; + /** @brief Returns the value for a given key converted to a double + * @param[in] key The key to ask for + * @param[in] defaultValue The default value to return if no value is stored under the key + * @return The value stored under the key + */ + double getDouble(const std::string& key, const double defaultValue) const; + + /** @brief Clears the parameter map */ void clearParameter(); @@ -108,6 +120,8 @@ return myMap; } + void writeParams(OutputDevice& out) const; + private: /// @brief The key->value map diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/RandHelper.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/RandHelper.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/RandHelper.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/RandHelper.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Tue, 29.05.2005 -/// @version $Id: RandHelper.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: RandHelper.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member variables diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/RandHelper.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/RandHelper.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/RandHelper.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/RandHelper.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Fri, 29.04.2005 -/// @version $Id: RandHelper.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: RandHelper.h 23150 2017-02-27 12:08:30Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -59,17 +59,17 @@ static void initRandGlobal(MTRand* which = 0); /// @brief Returns a random real number in [0, 1) - static inline SUMOReal rand() { - return (SUMOReal) RandHelper::myRandomNumberGenerator.randExc(); + static inline double rand() { + return (double) RandHelper::myRandomNumberGenerator.randExc(); } /// @brief Returns a random real number in [0, maxV) - static inline SUMOReal rand(SUMOReal maxV) { + static inline double rand(double maxV) { return maxV * rand(); } /// @brief Returns a random real number in [minV, maxV) - static inline SUMOReal rand(SUMOReal minV, SUMOReal maxV) { + static inline double rand(double minV, double maxV) { return minV + (maxV - minV) * rand(); } @@ -94,7 +94,7 @@ } /// @brief Access to a random number from a normal distribution - static inline SUMOReal randNorm(SUMOReal mean, SUMOReal variance, MTRand* rng = 0) { + static inline double randNorm(double mean, double variance, MTRand* rng = 0) { if (rng == 0) { rng = &myRandomNumberGenerator; } @@ -105,7 +105,7 @@ const double v = rng->randExc(2.0) - 1; q = u * u + v * v; } while (q == 0.0 || q >= 1.0); - return (SUMOReal)(mean + variance * u * sqrt(-2 * log(q) / q)); + return (double)(mean + variance * u * sqrt(-2 * log(q) / q)); } /// @brief Returns a random element from the given vector diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/RandomDistributor.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/RandomDistributor.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/RandomDistributor.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/RandomDistributor.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,169 +0,0 @@ -/****************************************************************************/ -/// @file RandomDistributor.h -/// @author Daniel Krajzewicz -/// @author Michael Behrisch -/// @author Jakob Erdmann -/// @date 2005-09-15 -/// @version $Id: RandomDistributor.h 21206 2016-07-20 08:08:35Z behrisch $ -/// -// Represents a generic random distribution -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ -#ifndef RandomDistributor_h -#define RandomDistributor_h - - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include -#include -#include -#include - - -// =========================================================================== -// class definitions -// =========================================================================== -/** - * @class RandomDistributor - * @brief Represents a generic random distribution - * - * This class allows to create random distributions by assigning - * arbitrary (non-negative) probabilities to its elements. The - * random number generator used is specified in RandHelper. - * - * @see RandHelper - */ - -template -class RandomDistributor { -public: - /** @brief Constructor for an empty distribution - * @param[in] maximumSize The maximum size to maintain - * older entrys will be removed when adding more than the maximumSize - */ - RandomDistributor() : - myProb(0) { - } - - /// @brief Destructor - ~RandomDistributor() { } - - /** @brief Adds a value with an assigned probability to the distribution. - * - * If the value is already member of the distribution and checkDuplicates is - * true (the default) the given probability is added to the current. - * The probability has to be non-negative but values larger than one are - * allowed (and scaled accordingly when an element is drawn). - * - * @param[in] prob The probability assigned to the value - * @param[in] val The value to add to the distribution - * @return true if a new value was added, false if just the probability of an existing one was updated - */ - bool add(SUMOReal prob, T val, bool checkDuplicates = true) { - assert(prob >= 0); - myProb += prob; - if (checkDuplicates) { - for (int i = 0; i < (int)myVals.size(); i++) { - if (val == myVals[i]) { - myProbs[i] += prob; - return false; - } - } - } - myVals.push_back(val); - myProbs.push_back(prob); - return true; - } - - /** @brief Draw a sample of the distribution. - * - * A random sample is drawn according to the assigned probabilities. - * - * @param[in] which The random number generator to use; the static one will be used if 0 is passed - * @return the drawn member - */ - T get(MTRand* which = 0) const { - if (myProb == 0) { - throw OutOfBoundsException(); - } - SUMOReal prob = which == 0 ? RandHelper::rand(myProb) : which->rand(myProb); - for (int i = 0; i < (int)myVals.size(); i++) { - if (prob < myProbs[i]) { - return myVals[i]; - } - prob -= myProbs[i]; - } - return myVals.back(); - } - - /** @brief Return the sum of the probabilites assigned to the members. - * - * This should be zero if and only if the distribution is empty. - * - * @return the total probability - */ - SUMOReal getOverallProb() const { - return myProb; - } - - /// @brief Clears the distribution - void clear() { - myProb = 0; - myVals.clear(); - myProbs.clear(); - } - - /** @brief Returns the members of the distribution. - * - * See getProbs for the corresponding probabilities. - * - * @return the members of the distribution - * @see RandomDistributor::getProbs - */ - const std::vector& getVals() const { - return myVals; - } - - /** @brief Returns the probabilities assigned to the members of the distribution. - * - * See getVals for the corresponding members. - * - * @return the probabilities assigned to the distribution - * @see RandomDistributor::getVals - */ - const std::vector& getProbs() const { - return myProbs; - } - -private: - /// @brief the total probability - SUMOReal myProb; - /// @brief the members (acts as a ring buffer if myMaximumSize is reached) - std::vector myVals; - /// @brief the corresponding probabilities (acts as a ring buffer if myMaximumSize is reached) - std::vector myProbs; - -}; - - -#endif - -/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/RGBColor.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/RGBColor.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/RGBColor.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/RGBColor.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Sept 2002 -/// @version $Id: RGBColor.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RGBColor.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A RGB-color definition /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,10 +42,6 @@ #include #include "RGBColor.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions @@ -233,11 +229,11 @@ throw NumberFormatException(); } } catch (NumberFormatException&) { - r = static_cast(TplConvert::_2SUMOReal(st[0].c_str()) * 255. + 0.5); - g = static_cast(TplConvert::_2SUMOReal(st[1].c_str()) * 255. + 0.5); - b = static_cast(TplConvert::_2SUMOReal(st[2].c_str()) * 255. + 0.5); + r = static_cast(TplConvert::_2double(st[0].c_str()) * 255. + 0.5); + g = static_cast(TplConvert::_2double(st[1].c_str()) * 255. + 0.5); + b = static_cast(TplConvert::_2double(st[2].c_str()) * 255. + 0.5); if (st.size() == 4) { - a = static_cast(TplConvert::_2SUMOReal(st[3].c_str()) * 255. + 0.5); + a = static_cast(TplConvert::_2double(st[3].c_str()) * 255. + 0.5); } } } else { @@ -275,7 +271,7 @@ RGBColor -RGBColor::interpolate(const RGBColor& minColor, const RGBColor& maxColor, SUMOReal weight) { +RGBColor::interpolate(const RGBColor& minColor, const RGBColor& maxColor, double weight) { if (weight < 0) { weight = 0; } @@ -291,11 +287,11 @@ RGBColor -RGBColor::fromHSV(SUMOReal h, SUMOReal s, SUMOReal v) { +RGBColor::fromHSV(double h, double s, double v) { // H is given on [0, 6] or UNDEFINED. S and V are given on [0, 1]. // RGB are each returned on [0, 255]. //float h = HSV.H, s = HSV.S, v = HSV.V, - SUMOReal f; + double f; h /= 60.; int i; //if (h == UNDEFINED) RETURN_RGB(v, v, v); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/RGBColor.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/RGBColor.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/RGBColor.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/RGBColor.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: RGBColor.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RGBColor.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A RGB-color definition /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -133,7 +133,7 @@ /** @brief Parses a color information * * It is assumed that the color is stored as ",," - * and each color is represented as a SUMOReal. + * and each color is represented as a double. * Alternatively the color can be stored as ",,," * and each color is represented as an unsigned byte. * @param[in] coldef The color definition to parse @@ -147,7 +147,7 @@ /** @brief Parses a color information * * It is assumed that the color is stored as ",," - * and each color is represented as a SUMOReal. + * and each color is represented as a double. * Alternatively the color can be stored as ",,," * and each color is represented as an unsigned byte. * @param[in] coldef The color definition to parse @@ -173,7 +173,7 @@ * @param[in] weight The weight of the first color * @return The interpolated color */ - static RGBColor interpolate(const RGBColor& minColor, const RGBColor& maxColor, SUMOReal weight); + static RGBColor interpolate(const RGBColor& minColor, const RGBColor& maxColor, double weight); /** @brief Converts the given hsv-triplet to rgb @@ -183,7 +183,7 @@ * @return The color as RGB * @author Alvy Ray Smith (http://www.alvyray.com/default.htm) */ - static RGBColor fromHSV(SUMOReal h, SUMOReal s, SUMOReal v); + static RGBColor fromHSV(double h, double s, double v); static const RGBColor RED; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/StaticCommand.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/StaticCommand.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/StaticCommand.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/StaticCommand.h 2017-07-23 16:22:03.000000000 +0000 @@ -8,7 +8,7 @@ // A wrapper for a Command function /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/StdDefs.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/StdDefs.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/StdDefs.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/StdDefs.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,11 +4,11 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date 2014-01-07 -/// @version $Id: StdDefs.cpp 20550 2016-04-26 10:57:45Z namdre $ +/// @version $Id: StdDefs.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -23,70 +23,12 @@ // =========================================================================== // included modules // =========================================================================== -#include "RGBColor.h" #include "StdDefs.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - -/* ------------------------------------------------------------------------- - * color constants for link states - * ----------------------------------------------------------------------- */ -const RGBColor SUMO_color_TL_GREEN_MAJOR(0, 255, 0); -const RGBColor SUMO_color_TL_GREEN_MINOR(0, 179, 0); -const RGBColor SUMO_color_TL_RED(255, 0, 0); -const RGBColor SUMO_color_TL_REDYELLOW(255, 128, 0); -const RGBColor SUMO_color_TL_YELLOW_MAJOR(255, 255, 0); -const RGBColor SUMO_color_TL_YELLOW_MINOR(255, 255, 0); -const RGBColor SUMO_color_TL_OFF_BLINKING(128, 64, 0); -const RGBColor SUMO_color_TL_OFF_NOSIGNAL(0, 255, 255); -const RGBColor SUMO_color_MAJOR(255, 255, 255); -const RGBColor SUMO_color_MINOR(51, 51, 51); -const RGBColor SUMO_color_EQUAL(128, 128, 128); -const RGBColor SUMO_color_STOP(128, 0, 128); -const RGBColor SUMO_color_ALLWAY_STOP(0, 0, 192); -const RGBColor SUMO_color_ZIPPER(192, 128, 64); -const RGBColor SUMO_color_DEADEND(0, 0, 0); - -const RGBColor& getLinkColor(const LinkState& ls) { - switch (ls) { - case LINKSTATE_TL_GREEN_MAJOR: - return SUMO_color_TL_GREEN_MAJOR; - case LINKSTATE_TL_GREEN_MINOR: - return SUMO_color_TL_GREEN_MINOR; - case LINKSTATE_TL_RED: - return SUMO_color_TL_RED; - case LINKSTATE_TL_REDYELLOW: - return SUMO_color_TL_REDYELLOW; - case LINKSTATE_TL_YELLOW_MAJOR: - return SUMO_color_TL_YELLOW_MAJOR; - case LINKSTATE_TL_YELLOW_MINOR: - return SUMO_color_TL_YELLOW_MINOR; - case LINKSTATE_TL_OFF_BLINKING: - return SUMO_color_TL_OFF_BLINKING; - case LINKSTATE_TL_OFF_NOSIGNAL: - return SUMO_color_TL_OFF_NOSIGNAL; - case LINKSTATE_MAJOR: - return SUMO_color_MAJOR; - case LINKSTATE_MINOR: - return SUMO_color_MINOR; - case LINKSTATE_EQUAL: - return SUMO_color_EQUAL; - case LINKSTATE_STOP: - return SUMO_color_STOP; - case LINKSTATE_ALLWAY_STOP: - return SUMO_color_ALLWAY_STOP; - case LINKSTATE_ZIPPER: - return SUMO_color_ZIPPER; - case LINKSTATE_DEADEND: - return SUMO_color_DEADEND; - default: - throw ProcessError("No color defined for LinkState '" + std::string(ls, 1) + "'"); - } -} - +// set by option --precision (see SystemFrame.cpp) +int gPrecision = 2; +int gPrecisionGeo = 6; bool gDebugFlag1 = false; bool gDebugFlag2 = false; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/StdDefs.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/StdDefs.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/StdDefs.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/StdDefs.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Fri, 29.04.2005 -/// @version $Id: StdDefs.h 20550 2016-04-26 10:57:45Z namdre $ +/// @version $Id: StdDefs.h 23150 2017-02-27 12:08:30Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,8 +32,7 @@ #else #include #endif - -#include +#include /* avoiding compiler warning unreferenced parameter */ #define UNUSED_PARAMETER(x) ((void)(x)) @@ -46,19 +45,15 @@ /* ------------------------------------------------------------------------- * some constant defaults used by SUMO * ----------------------------------------------------------------------- */ -const SUMOReal SUMO_const_laneWidth = (SUMOReal) 3.2; -const SUMOReal SUMO_const_halfLaneWidth = (SUMOReal) 1.6; -const SUMOReal SUMO_const_quarterLaneWidth = (SUMOReal) 0.8; -const SUMOReal SUMO_const_laneOffset = (SUMOReal) .1; -const SUMOReal SUMO_const_laneWidthAndOffset = (SUMOReal) 3.3; -const SUMOReal SUMO_const_halfLaneAndOffset = (SUMOReal)(3.2 / 2. + .1); +const double SUMO_const_laneWidth = (double) 3.2; +const double SUMO_const_halfLaneWidth = (double) 1.6; +const double SUMO_const_quarterLaneWidth = (double) 0.8; +const double SUMO_const_laneOffset = (double) .1; +const double SUMO_const_laneWidthAndOffset = (double) 3.3; +const double SUMO_const_halfLaneAndOffset = (double)(3.2 / 2. + .1); /// @brief the speed threshold at which vehicles are considered as halting -const SUMOReal SUMO_const_haltingSpeed = (SUMOReal) 0.1; - -/* @brief map from LinkState to color constants (see above) - */ -const RGBColor& getLinkColor(const LinkState& ls); +const double SUMO_const_haltingSpeed = (double) 0.1; /* ------------------------------------------------------------------------- @@ -112,6 +107,12 @@ return d != d; } + +/// the precision for floating point outputs +extern int gPrecision; +extern int gPrecisionGeo; // for lon,lat + + /// @brief global utility flags for debugging extern bool gDebugFlag1; extern bool gDebugFlag2; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/StringBijection.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/StringBijection.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/StringBijection.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/StringBijection.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Mar 2011 -/// @version $Id: StringBijection.h 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: StringBijection.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Bidirectional map between string and something else /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/StringTokenizer.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/StringTokenizer.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/StringTokenizer.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/StringTokenizer.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date ? -/// @version $Id: StringTokenizer.cpp 21316 2016-08-22 13:08:50Z behrisch $ +/// @version $Id: StringTokenizer.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A java-style StringTokenizer for c++ (stl) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,10 +36,6 @@ #include "UtilExceptions.h" #include "StringTokenizer.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // variable definitions @@ -47,6 +43,7 @@ const int StringTokenizer::NEWLINE = -256; const int StringTokenizer::WHITECHARS = -257; const int StringTokenizer::SPACE = 32; +const int StringTokenizer::TAB = 9; // =========================================================================== @@ -70,6 +67,9 @@ case NEWLINE: prepare(tosplit, "\r\n", true); break; + case TAB: + prepare(tosplit, "\t", true); + break; case WHITECHARS: prepareWhitechar(tosplit); break; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/StringTokenizer.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/StringTokenizer.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/StringTokenizer.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/StringTokenizer.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date ? -/// @version $Id: StringTokenizer.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: StringTokenizer.h 22649 2017-01-20 10:08:30Z namdre $ /// // A java-style StringTokenizer for c++ (stl) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -79,6 +79,9 @@ /** the ascii index of the highest whitespace character */ static const int SPACE; + /** the ascii index of the tab character */ + static const int TAB; + public: /** default constructor */ StringTokenizer() { } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/StringUtils.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/StringUtils.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/StringUtils.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/StringUtils.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date unknown -/// @version $Id: StringUtils.cpp 21217 2016-07-22 10:57:44Z behrisch $ +/// @version $Id: StringUtils.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Some static methods for string processing /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,10 +38,6 @@ #include #include "StringUtils.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions @@ -164,11 +160,14 @@ std::string -StringUtils::escapeXML(const std::string& orig) { +StringUtils::escapeXML(const std::string& orig, const bool maskDoubleHyphen) { std::string result = replace(orig, "&", "&"); result = replace(result, ">", ">"); result = replace(result, "<", "<"); result = replace(result, "\"", """); + if (maskDoubleHyphen) { + result = replace(result, "--", "--"); + } for (char invalid = '\1'; invalid < ' '; invalid++) { result = replace(result, std::string(1, invalid).c_str(), ""); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/StringUtils.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/StringUtils.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/StringUtils.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/StringUtils.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date unknown -/// @version $Id: StringUtils.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: StringUtils.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Some static methods for string processing /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -76,9 +76,10 @@ * The strings &, <, >, ", and ' are replaced by &, <, >, ", and ' * * @param[in] orig The original string + * @param[in] maskDoubleHyphen Whether -- in input shall be converted to -- (semantically equivalent but allowed in XML comments) * @return the string with the escaped sequences */ - static std::string escapeXML(const std::string& orig); + static std::string escapeXML(const std::string& orig, const bool maskDoubleHyphen = false); /// An empty string static std::string emptyString; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/SUMOTime.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/SUMOTime.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/SUMOTime.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/SUMOTime.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Fri, 29.04.2005 -/// @version $Id: SUMOTime.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SUMOTime.cpp 22797 2017-01-31 14:53:07Z namdre $ /// // Variables, methods, and tools for internal time representation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,6 +31,7 @@ #include #include "SUMOTime.h" #include "TplConvert.h" +#include "StdDefs.h" // =========================================================================== @@ -60,7 +61,7 @@ // 123456 -> "12.34" std::ostringstream oss; oss.setf(oss.fixed); - oss.precision(OUTPUT_ACCURACY); + oss.precision(gPrecision); oss << STEPS2TIME(t); return oss.str(); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/SUMOTime.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/SUMOTime.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/SUMOTime.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/SUMOTime.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Fri, 29.04.2005 -/// @version $Id: SUMOTime.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SUMOTime.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Variables, methods, and tools for internal time representation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,8 +48,8 @@ // the step length in ms extern SUMOTime DELTA_T; -// the step length in seconds as SUMOReal -#define TS (static_cast(DELTA_T/1000.)) +// the step length in seconds as double +#define TS (static_cast(DELTA_T/1000.)) // x*deltaT #define SPEED2DIST(x) ((x)*TS) @@ -62,7 +62,7 @@ // x*deltaT #define SPEED2ACCEL(x) ((x)/TS) -#define STEPS2TIME(x) (static_cast((x)/1000.)) +#define STEPS2TIME(x) (static_cast((x)/1000.)) #define TIME2STEPS(x) (static_cast((x)*1000)) #define STEPFLOOR(x) (int(x/DELTA_T)*DELTA_T) #define STEPS2MS(x) (x) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/SUMOVehicleClass.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/SUMOVehicleClass.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/SUMOVehicleClass.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/SUMOVehicleClass.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Walter Bamberger /// @date 2006-01-24 -/// @version $Id: SUMOVehicleClass.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: SUMOVehicleClass.cpp 23559 2017-03-20 14:43:57Z bieker $ /// // Definitions of SUMO vehicle classes and helper functions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,14 +41,10 @@ #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - - // =========================================================================== // static members // =========================================================================== + StringBijection::Entry sumoVehicleClassStringInitializer[] = { {"ignoring", SVC_IGNORING}, {"private", SVC_PRIVATE}, @@ -90,6 +86,7 @@ StringBijection SumoVehicleClassStrings( sumoVehicleClassStringInitializer, SVC_CUSTOM2, false); + std::set deprecatedVehicleClassesSeen; @@ -127,6 +124,8 @@ {"ant", SVS_ANT}, {"ship", SVS_SHIP}, {"emergency", SVS_EMERGENCY}, + {"firebrigade", SVS_FIREBRIGADE}, + {"police", SVS_POLICE}, {"", SVS_UNKNOWN} }; @@ -150,8 +149,8 @@ // ------------ Conversion of SUMOVehicleClass std::string -getVehicleClassNames(SVCPermissions permissions) { - if (permissions == SVCAll) { +getVehicleClassNames(SVCPermissions permissions, bool expand) { + if (permissions == SVCAll && !expand) { return "all"; } return joinToString(getVehicleClassNamesList(permissions), ' '); @@ -306,6 +305,11 @@ } +bool canParseVehicleShape(const std::string& shape) { + return SumoVehicleShapeStrings.hasString(shape); +} + + std::string getVehicleShapeName(SUMOVehicleShape id) { return SumoVehicleShapeStrings.getString(id); @@ -330,11 +334,11 @@ const std::string DEFAULT_VTYPE_ID("DEFAULT_VEHTYPE"); const std::string DEFAULT_PEDTYPE_ID("DEFAULT_PEDTYPE"); -const SUMOReal DEFAULT_VEH_PROB(1.); +const double DEFAULT_VEH_PROB(1.); -const SUMOReal DEFAULT_PEDESTRIAN_SPEED(5. / 3.6); +const double DEFAULT_PEDESTRIAN_SPEED(5. / 3.6); -const SUMOReal DEFAULT_CONTAINER_TRANSHIP_SPEED(5. / 3.6); +const double DEFAULT_CONTAINER_TRANSHIP_SPEED(5. / 3.6); /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/SUMOVehicleClass.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/SUMOVehicleClass.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/SUMOVehicleClass.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/SUMOVehicleClass.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,14 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @author Walter Bamberger +/// @author Laura Bieker /// @date 2006-01-24 -/// @version $Id: SUMOVehicleClass.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SUMOVehicleClass.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Definitions of SUMO vehicle classes and helper functions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -104,7 +105,11 @@ /// @brief render as a arbitrary ship SVS_SHIP, /// @brief render as an emergency vehicle - SVS_EMERGENCY + SVS_EMERGENCY, + /// @brief render as a fire brigade + SVS_FIREBRIGADE, + /// @brief render as a police car + SVS_POLICE }; @@ -204,12 +209,14 @@ extern std::set deprecatedVehicleClassesSeen; extern StringBijection SumoVehicleShapeStrings; -/* @brief bitset where each bit declares whether a certain SVC may use this edge/lane - */ +/// @brief bitset where each bit declares whether a certain SVC may use this edge/lane typedef int SVCPermissions; -extern const SVCPermissions SVCAll; // everything allowed -extern const SVCPermissions SVC_UNSPECIFIED; // permissions not specified +/// @brief all VClasses are allowed +extern const SVCPermissions SVCAll; + +/// @brief permissions not specified +extern const SVCPermissions SVC_UNSPECIFIED; /** * @enum SUMOEmissionClass @@ -228,10 +235,10 @@ // --------------------------------------------------------------------------- /** @brief Returns the ids of the given classes, divided using a ' ' * @param[in] the permissions to encode + * @param[in] expand whether 'all' should be used * @return The string representation of these classes */ -extern std::string getVehicleClassNames(SVCPermissions permissions); - +extern std::string getVehicleClassNames(SVCPermissions permissions, bool expand = false); /** @brief Returns the ids of the given classes, divided using a ' ' * @param[in] the permissions to encode @@ -239,7 +246,6 @@ */ extern std::vector getVehicleClassNamesList(SVCPermissions permissions); - /** @brief Returns the class id of the abstract class given by its name * @param[in] name The name of the abstract vehicle class * @return The internal representation of this class. Name must not be a @@ -262,9 +268,7 @@ */ extern SVCPermissions parseVehicleClasses(const std::string& allowedS); - -/** @brief Checks whether the given string contains only known vehicle classes - */ +/// @brief Checks whether the given string contains only known vehicle classes extern bool canParseVehicleClasses(const std::string& classes); /** @brief Encodes the given vector of allowed and disallowed classes into a bitset @@ -273,14 +277,12 @@ */ extern SVCPermissions parseVehicleClasses(const std::string& allowedS, const std::string& disallowedS); - /** @brief Encodes the given vector of allowed classs into a bitset * Unlike the methods which parse a string it gives immediately a warning output on deprecated vehicle classes. * @param[in] classesS The names vector to parse */ extern SVCPermissions parseVehicleClasses(const std::vector& allowedS); - /// @brief writes allowed disallowed attributes if needed; extern void writePermissions(OutputDevice& into, SVCPermissions permissions); @@ -296,13 +298,14 @@ */ extern std::string getVehicleShapeName(SUMOVehicleShape id); - /** @brief Returns the class id of the shape class given by its name * @param[in] name The name of the shape class * @return The internal representation of this class */ extern SUMOVehicleShape getVehicleShapeID(const std::string& name); +/// @brief Checks whether the given string contains only known vehicle shape +extern bool canParseVehicleShape(const std::string& shape); /** @brief Returns whether an edge with the given permission is a railway edge * @param[in] permissions The permissions of the edge @@ -328,11 +331,11 @@ extern const std::string DEFAULT_VTYPE_ID; extern const std::string DEFAULT_PEDTYPE_ID; -extern const SUMOReal DEFAULT_VEH_PROB; // !!! does this belong here? +extern const double DEFAULT_VEH_PROB; // !!! does this belong here? -extern const SUMOReal DEFAULT_PEDESTRIAN_SPEED; +extern const double DEFAULT_PEDESTRIAN_SPEED; -extern const SUMOReal DEFAULT_CONTAINER_TRANSHIP_SPEED; +extern const double DEFAULT_CONTAINER_TRANSHIP_SPEED; #endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/SystemFrame.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/SystemFrame.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/SystemFrame.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/SystemFrame.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 23.06.2003 -/// @version $Id: SystemFrame.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SystemFrame.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A set of actions common to all applications /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,15 +33,12 @@ #include "SystemFrame.h" #include #include +#include #include #include #include #include "RandHelper.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -109,6 +106,21 @@ oc.doRegister("output-prefix", new Option_String()); oc.addDescription("output-prefix", "Output", "Prefix which is applied to all output files. The special string 'TIME' is replaced by the current time."); + + oc.doRegister("precision", new Option_Integer(2)); + oc.addDescription("precision", "Output", "Defines the number of digits after the comma for floating point output"); + + oc.doRegister("precision.geo", new Option_Integer(6)); + oc.addDescription("precision.geo", "Output", "Defines the number of digits after the comma for lon,lat output"); +} + + +bool +SystemFrame::checkOptions() { + OptionsCont& oc = OptionsCont::getOptions(); + gPrecision = oc.getInt("precision"); + gPrecisionGeo = oc.getInt("precision.geo"); + return true; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/SystemFrame.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/SystemFrame.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/SystemFrame.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/SystemFrame.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 23.06.2003 -/// @version $Id: SystemFrame.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SystemFrame.h 22797 2017-01-31 14:53:07Z namdre $ /// // A set of actions common to all applications /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -72,6 +72,8 @@ */ static void addReportOptions(OptionsCont& oc); + /// @brief checks shared options and sets StdDefs + static bool checkOptions(); /** @brief Closes all of an applications subsystems * diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/SysUtils.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/SysUtils.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/SysUtils.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/SysUtils.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Tue, 29.05.2005 -/// @version $Id: SysUtils.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SysUtils.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A few system-specific functions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,10 +38,6 @@ #undef NOMINMAX #endif -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/SysUtils.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/SysUtils.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/SysUtils.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/SysUtils.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file SysUtils.h /// @author Daniel Krajzewicz /// @date Fri, 29.04.2005 -/// @version $Id: SysUtils.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SysUtils.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A few system-specific functions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/ToString.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/ToString.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/ToString.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/ToString.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Wed, 23 Sep 2002 -/// @version $Id: ToString.h 20975 2016-06-15 13:02:40Z palcraft $ +/// @version $Id: ToString.h 24108 2017-04-27 18:43:30Z behrisch $ /// // ------------------- /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,6 +40,7 @@ #include #include #include +#include #include #include "StdDefs.h" @@ -52,7 +53,7 @@ * (when supplied by c++/the stl) */ template -inline std::string toString(const T& t, std::streamsize accuracy = OUTPUT_ACCURACY) { +inline std::string toString(const T& t, std::streamsize accuracy = gPrecision) { std::ostringstream oss; oss.setf(std::ios::fixed , std::ios::floatfield); oss << std::setprecision(accuracy); @@ -70,6 +71,14 @@ } +inline std::string toString(const Named* obj, std::streamsize accuracy) { + UNUSED_PARAMETER(accuracy); + if (obj == 0) { + return "NULL"; + } + return obj->getID(); +} + template <> inline std::string toString(const SumoXMLTag& tag, std::streamsize accuracy) { UNUSED_PARAMETER(accuracy); @@ -164,14 +173,25 @@ return oss.str(); } +template <> +inline std::string toString(const Position& pos, std::streamsize accuracy) { + UNUSED_PARAMETER(accuracy); + return toString(pos.x(), accuracy) + "," + toString(pos.y(), accuracy); +} + +template <> +inline std::string toString(const Distribution_Parameterized& dist, std::streamsize accuracy) { + return dist.toStr(accuracy); +} + template -inline std::string toString(const std::vector& v, std::streamsize accuracy = OUTPUT_ACCURACY) { +inline std::string toString(const std::vector& v, std::streamsize accuracy = gPrecision) { return toString(v.begin(), v.end(), accuracy); } template -inline std::string toString(const typename std::vector::const_iterator& b, const typename std::vector::const_iterator& e, std::streamsize accuracy = OUTPUT_ACCURACY) { +inline std::string toString(const typename std::vector::const_iterator& b, const typename std::vector::const_iterator& e, std::streamsize accuracy = gPrecision) { UNUSED_PARAMETER(accuracy); std::ostringstream oss; for (typename std::vector::const_iterator it = b; it != e; ++it) { @@ -184,8 +204,28 @@ } +//template +//inline std::string toString(const std::vector& v, std::streamsize accuracy = gPrecision) { +// return toString(v.begin(), v.end(), accuracy); +//} +// +// +//template +//inline std::string toString(const typename std::vector::const_iterator& b, const typename std::vector::const_iterator& e, std::streamsize accuracy = gPrecision) { +// UNUSED_PARAMETER(accuracy); +// std::ostringstream oss; +// for (typename std::vector::const_iterator it = b; it != e; ++it) { +// if (it != b) { +// oss << " "; +// } +// oss << Named::getIDSecure(*it); +// } +// return oss.str(); +//} + + template -inline std::string joinToString(const std::vector& v, const T_BETWEEN& between, std::streamsize accuracy = OUTPUT_ACCURACY) { +inline std::string joinToString(const std::vector& v, const T_BETWEEN& between, std::streamsize accuracy = gPrecision) { std::ostringstream oss; bool connect = false; for (typename std::vector::const_iterator it = v.begin(); it != v.end(); ++it) { @@ -201,7 +241,7 @@ template -inline std::string joinToStringSorting(const std::vector& v, const T_BETWEEN& between, std::streamsize accuracy = OUTPUT_ACCURACY) { +inline std::string joinToStringSorting(const std::vector& v, const T_BETWEEN& between, std::streamsize accuracy = gPrecision) { std::vector sorted(v); std::sort(sorted.begin(), sorted.end()); return joinToString(sorted, between, accuracy); @@ -209,7 +249,7 @@ template -inline std::string toString(const std::set& v, std::streamsize accuracy = OUTPUT_ACCURACY) { +inline std::string toString(const std::set& v, std::streamsize accuracy = gPrecision) { UNUSED_PARAMETER(accuracy); std::vector ids; for (typename std::set::const_iterator it = v.begin(); it != v.end(); ++it) { @@ -232,13 +272,13 @@ template <> -inline std::string toString(const std::vector& v, std::streamsize accuracy) { +inline std::string toString(const std::vector& v, std::streamsize accuracy) { return joinToString(v, " ", accuracy); } template -inline std::string joinToString(const std::set& s, const T_BETWEEN& between, std::streamsize accuracy = OUTPUT_ACCURACY) { +inline std::string joinToString(const std::set& s, const T_BETWEEN& between, std::streamsize accuracy = gPrecision) { std::ostringstream oss; bool connect = false; for (typename std::set::const_iterator it = s.begin(); it != s.end(); ++it) { @@ -254,13 +294,19 @@ template <> +inline std::string toString(const std::vector& v, std::streamsize) { + return joinToString(v, " "); +} + + +template <> inline std::string toString(const std::set& v, std::streamsize) { return joinToString(v, " "); } template -inline std::string joinToString(const std::map& s, const T_BETWEEN& between, const T_BETWEEN_KEYVAL& between_keyval, std::streamsize accuracy = OUTPUT_ACCURACY) { +inline std::string joinToString(const std::map& s, const T_BETWEEN& between, const T_BETWEEN_KEYVAL& between_keyval, std::streamsize accuracy = gPrecision) { std::ostringstream oss; bool connect = false; for (typename std::map::const_iterator it = s.begin(); it != s.end(); ++it) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/TplCheck.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/TplCheck.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/TplCheck.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/TplCheck.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file TplCheck.h /// @author Pablo Alvarez Lopez /// @date May 2016 -/// @version $Id: TplCheck.h 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: TplCheck.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Some methods for check type of dates /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -62,9 +62,9 @@ return true; } - /// @brief check if a String can be parsed into a SUMOReal + /// @brief check if a String can be parsed into a double /// @ToDo check overflows - static bool _str2SUMOReal(const std::string& data) { + static bool _str2double(const std::string& data) { bool dot = false; if (data.size() == 0) { return false; @@ -112,7 +112,6 @@ return false; } } else if (data.at(i) < '0' || data.at(i) > '9') { - std::cout << i << " " << data.at(i) << std::endl; return false; } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/TplConvert.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/TplConvert.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/TplConvert.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/TplConvert.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sun, 09 Jun 2002 -/// @version $Id: TplConvert.h 21201 2016-07-19 11:57:22Z behrisch $ +/// @version $Id: TplConvert.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Some conversion methods (from strings to other) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,7 +47,7 @@ /** * TplConvert * Some methods that convert 0-terminated char-arrays of any type into other values (numerical/boolean) or into std::strings - * Also convert strings into any type of values (SUMOReal, int, bool...) + * Also convert strings into any type of values (double, int, bool...) */ class TplConvert { public: @@ -60,8 +60,8 @@ return convert.str(); } - /// @brief convert SUMOReal to string - static inline std::string _2str(const SUMOReal var) { + /// @brief convert double to string + static inline std::string _2str(const double var) { std::ostringstream convert; convert << var; return convert.str(); @@ -191,7 +191,7 @@ } //@} - /// @name Conversion to basic type long + /// @name Conversion to basic type long integer (at least 64 bit) //@{ /// @brief converts a char-type array into the long value described by it /// @throw an EmptyData - exception if the given string is empty @@ -226,6 +226,13 @@ return ret * sgn; } + /// @brief converts a string into the long value described by it by calling the char-type converter, which + /// @throw an EmptyData - exception if the given string is empty + /// @throw NumberFormatException - exception when the string does not contain a long integer + static long long int _str2long(const std::string& sData) { + return _2long(sData.c_str()); + } + /// @brief converts a char-type array with a hex value into the long value described by it /// @throw an EmptyData - exception if the given string is empty /// @throw a NumberFormatException - exception when the string does not contain a long @@ -281,18 +288,18 @@ } //@} - /// @name Conversion to basic type SUMOReal (Double) + /// @name Conversion to basic type double (Double) //@{ - /// @brief converts a char-type array into the SUMOReal value described by it + /// @brief converts a char-type array into the double value described by it /// @throw an EmptyData - exception if the given string is empty - /// @throw a NumberFormatException - exception when the string does not contain a SUMOReal + /// @throw a NumberFormatException - exception when the string does not contain a double template - static SUMOReal _2SUMOReal(const E* const data) { + static double _2double(const E* const data) { if (data == 0 || data[0] == 0) { throw EmptyData(); } int i = 0; - SUMOReal sgn = 1; + double sgn = 1; if (data[0] == '+') { i++; } @@ -324,32 +331,32 @@ } // check what has happened - end of string or exponent if (data[i] == 0) { - return ret * sgn * (SUMOReal) pow(10.0, exponent); + return ret * sgn * (double) pow(10.0, exponent); } // now the exponent try { - return ret * sgn * (SUMOReal) pow(10.0, _2int(data + i + 1) + exponent); + return ret * sgn * (double) pow(10.0, _2int(data + i + 1) + exponent); } catch (EmptyData&) { // the exponent was empty throw NumberFormatException(); } } - /// @brief converts a string into the SUMOReal value described by it by calling the char-type converter + /// @brief converts a string into the double value described by it by calling the char-type converter /// @throw an EmptyData - exception if the given string is empty - /// @throw a NumberFormatException - exception when the string does not contain a SUMOReal - static SUMOReal _str2SUMOReal(const std::string& sData) { - return _2SUMOReal(sData.c_str()); + /// @throw a NumberFormatException - exception when the string does not contain a double + static double _str2double(const std::string& sData) { + return _2double(sData.c_str()); } - /// @brief converts a 0-terminated char-type array into the SUMOReal value described by it + /// @brief converts a 0-terminated char-type array into the double value described by it /// @return the default value if the data is empty template - static SUMOReal _2SUMORealSec(const E* const data, SUMOReal def) { + static double _2doubleSec(const E* const data, double def) { if (data == 0 || data[0] == 0) { return def; } - return _2SUMOReal(data); + return _2double(data); } //@} @@ -383,7 +390,7 @@ return _2bool(sData.c_str()); } - /// @brief converts a 0-terminated char-type array into the SUMOReal value described by it + /// @brief converts a 0-terminated char-type array into the double value described by it /// @return true if the data* is one of the following (case insensitive): '1', 'x', 'true', 'yes', 'on' /// @return false if the data* is one of the following (case insensitive): '0', '-', 'false', 'no', 'off' /// @return the default value if the data is empty */ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/UtilExceptions.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/UtilExceptions.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/UtilExceptions.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/UtilExceptions.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Felix Brack /// @date Mon, 17 Dec 2001 -/// @version $Id: UtilExceptions.h 21131 2016-07-08 07:59:22Z behrisch $ +/// @version $Id: UtilExceptions.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Exceptions for used by some utility classes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/ValueRetriever.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/ValueRetriever.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/ValueRetriever.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/ValueRetriever.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file ValueRetriever.h /// @author Daniel Krajzewicz /// @date Fri, 29.04.2005 -/// @version $Id: ValueRetriever.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ValueRetriever.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/ValueSource.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/ValueSource.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/ValueSource.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/ValueSource.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file ValueSource.h /// @author Daniel Krajzewicz /// @date Fri, 29.04.2005 -/// @version $Id: ValueSource.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ValueSource.h 23150 2017-02-27 12:08:30Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,7 +44,7 @@ virtual ~ValueSource() { } virtual T getValue() const = 0; virtual ValueSource* copy() const = 0; - virtual ValueSource* makeSUMORealReturningCopy() const = 0; + virtual ValueSource* makedoubleReturningCopy() const = 0; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/ValueTimeLine.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/ValueTimeLine.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/ValueTimeLine.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/ValueTimeLine.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: ValueTimeLine.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ValueTimeLine.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A list of time ranges with assigned values /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -66,7 +66,7 @@ * @param[in] end the end time of the time range (exclusive) * @param[in] value the value to store */ - void add(SUMOReal begin, SUMOReal end, T value) { + void add(double begin, double end, T value) { assert(begin >= 0); assert(begin < end); // inserting strictly before the first or after the last interval (includes empty case) @@ -100,7 +100,7 @@ * @param[in] the time for which the value should be retrieved * @return the value for the time */ - T getValue(SUMOReal time) const { + T getValue(double time) const { assert(myValues.size() != 0); typename TimedValueMap::const_iterator it = myValues.upper_bound(time); assert(it != myValues.begin()); @@ -118,7 +118,7 @@ * @param[in] the time for which the value should be retrieved * @return whether a valid value was set */ - bool describesTime(SUMOReal time) const { + bool describesTime(double time) const { typename TimedValueMap::const_iterator afterIt = myValues.upper_bound(time); if (afterIt == myValues.begin()) { return false; @@ -137,7 +137,7 @@ * @param[in] high the time in the second interval * @return the split point */ - SUMOReal getSplitTime(SUMOReal low, SUMOReal high) const { + double getSplitTime(double low, double high) const { typename TimedValueMap::const_iterator afterLow = myValues.upper_bound(low); typename TimedValueMap::const_iterator afterHigh = myValues.upper_bound(high); --afterHigh; @@ -173,7 +173,7 @@ typedef std::pair ValidValue; /// @brief Sorted map from start of intervals to values. - typedef std::map TimedValueMap; + typedef std::map TimedValueMap; /// @brief The list of time periods (with values) TimedValueMap myValues; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/VectorHelper.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/VectorHelper.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/VectorHelper.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/VectorHelper.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: VectorHelper.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: VectorHelper.h 23150 2017-02-27 12:08:30Z behrisch $ /// -// A simple vector of SUMOReals +// A simple vector of doubles /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/WrappingCommand.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/WrappingCommand.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/common/WrappingCommand.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/common/WrappingCommand.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Christian Roessel /// @author Daniel Krajzewicz /// @date Thu, 20 Dec 2001 -/// @version $Id: WrappingCommand.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: WrappingCommand.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A wrapper for a Command function /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/DistributionCont.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/DistributionCont.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/DistributionCont.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/DistributionCont.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file DistributionCont.cpp /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: DistributionCont.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: DistributionCont.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A container for distributions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -28,10 +28,6 @@ #include "DistributionCont.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static variable definitions @@ -77,6 +73,15 @@ } +void +DistributionCont::clear() { + for (TypedDistDict::iterator i = myDict.begin(); i != myDict.end(); i++) { + DistDict& dict = (*i).second; + for (DistDict::iterator j = dict.begin(); j != dict.end(); j++) { + delete(*j).second; + } + } +} -/****************************************************************************/ +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/DistributionCont.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/DistributionCont.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/DistributionCont.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/DistributionCont.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file DistributionCont.h /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: DistributionCont.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: DistributionCont.h 23341 2017-03-13 10:11:12Z behrisch $ /// // A container for distributions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -52,6 +52,9 @@ static Distribution* dictionary(const std::string& type, const std::string& id); + /// delete all stored distributions + static void clear(); + private: /// Definition of a map from distribution ids to distributions typedef std::map DistDict; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/Distribution.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/Distribution.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/Distribution.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/Distribution.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file Distribution.h /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: Distribution.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: Distribution.h 23362 2017-03-14 09:16:46Z behrisch $ /// // The base class for distribution descriptions. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,6 +34,12 @@ // =========================================================================== +// class declarations +// =========================================================================== +class MTRand; + + +// =========================================================================== // class definitions // =========================================================================== /** @@ -49,8 +55,20 @@ /// Destructor virtual ~Distribution() { } + /** @brief Draw a sample of the distribution. + * + * A random sample is drawn according to the assigned probabilities. + * + * @param[in] which The random number generator to use; the static one will be used if 0 is passed + * @return the drawn member + */ + virtual double sample(MTRand* which = 0) const = 0; + /// Returns the maximum value of this distribution - virtual SUMOReal getMax() const = 0; + virtual double getMax() const = 0; + + /// Returns the string representation of this distribution + virtual std::string toStr(std::streamsize accuracy) const = 0; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/Distribution_MeanDev.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/Distribution_MeanDev.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/Distribution_MeanDev.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/Distribution_MeanDev.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -/****************************************************************************/ -/// @file Distribution_MeanDev.cpp -/// @author Daniel Krajzewicz -/// @date Sept 2002 -/// @version $Id: Distribution_MeanDev.cpp 20433 2016-04-13 08:00:14Z behrisch $ -/// -// A distribution described by the mean value and std-dev amount -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ - - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include "Distribution.h" -#include "Distribution_MeanDev.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - - -// =========================================================================== -// method definitions -// =========================================================================== -Distribution_MeanDev::Distribution_MeanDev(const std::string& id, - SUMOReal mean, SUMOReal deviation) - : Distribution(id), myMeanValue(mean), myDeviation(deviation) {} - - -Distribution_MeanDev::~Distribution_MeanDev() {} - - -SUMOReal -Distribution_MeanDev::getMax() const { - return myMeanValue + myDeviation; -} - - - -/****************************************************************************/ - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/Distribution_MeanDev.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/Distribution_MeanDev.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/Distribution_MeanDev.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/Distribution_MeanDev.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -/****************************************************************************/ -/// @file Distribution_MeanDev.h -/// @author Daniel Krajzewicz -/// @date Sept 2002 -/// @version $Id: Distribution_MeanDev.h 20433 2016-04-13 08:00:14Z behrisch $ -/// -// A distribution described by the mean value and std-dev amount -/****************************************************************************/ -// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors -/****************************************************************************/ -// -// This file is part of SUMO. -// SUMO is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -/****************************************************************************/ -#ifndef Distribution_MeanDev_h -#define Distribution_MeanDev_h - - -// =========================================================================== -// included modules -// =========================================================================== -#ifdef _MSC_VER -#include -#else -#include -#endif - -#include "Distribution.h" - -// =========================================================================== -// class definitions -// =========================================================================== -/** - * @class Distribution_MeanDev - * A description of distribution by the distribution's mean value and a - * standard deviation. - * Incomplete and unused yet. This class should be overridden by derived - * classes - */ -class Distribution_MeanDev : - public Distribution { -public: - /// Constructor - Distribution_MeanDev(const std::string& id, SUMOReal mean, - SUMOReal deviation); - - /// Destructor - virtual ~Distribution_MeanDev(); - - /// Returns the maximum value of this distribution - SUMOReal getMax() const; - -private: - /// The distribution's mean - SUMOReal myMeanValue; - - /// The distribution's standard deviation - SUMOReal myDeviation; - -}; - - -#endif - -/****************************************************************************/ - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/Distribution_Parameterized.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/Distribution_Parameterized.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/Distribution_Parameterized.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/Distribution_Parameterized.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,113 @@ +/****************************************************************************/ +/// @file Distribution_Parameterized.cpp +/// @author Daniel Krajzewicz +/// @author Michael Behrisch +/// @date Sept 2002 +/// @version $Id: Distribution_Parameterized.cpp 24108 2017-04-27 18:43:30Z behrisch $ +/// +// A distribution described by parameters such as the mean value and std-dev +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include "Distribution_Parameterized.h" + + +// =========================================================================== +// method definitions +// =========================================================================== +Distribution_Parameterized::Distribution_Parameterized(const std::string& description) + : Distribution("") { + const std::string distName = description.substr(0, description.find('(')); + if (distName == "norm" || distName == "normc") { + std::vector params = StringTokenizer(description.substr(distName.size() + 1, description.size() - distName.size() - 2), ',').getVector(); + myParameter.resize(params.size()); + std::transform(params.begin(), params.end(), myParameter.begin(), TplConvert::_str2double); + setID(distName); + } else { + myParameter.push_back(TplConvert::_str2double(description)); + } + assert(!myParameter.empty()); + if (myParameter.size() == 1) { + myParameter.push_back(0.); + } +} + + +Distribution_Parameterized::Distribution_Parameterized(const std::string& id, + double mean, double deviation) + : Distribution(id) { + myParameter.push_back(mean); + myParameter.push_back(deviation); +} + + +Distribution_Parameterized::Distribution_Parameterized(const std::string& id, + double mean, double deviation, double min, double max) + : Distribution(id) { + myParameter.push_back(mean); + myParameter.push_back(deviation); + myParameter.push_back(min); + myParameter.push_back(max); +} + + +Distribution_Parameterized::~Distribution_Parameterized() {} + + +double +Distribution_Parameterized::sample(MTRand* which) const { + if (myParameter[1] == 0.) { + return myParameter[0]; + } + double val = which == 0 ? RandHelper::randNorm(myParameter[0], myParameter[1]) : which->randNorm(myParameter[0], myParameter[1]); + if (myParameter.size() > 2) { + const double min = myParameter[2]; + const double max = getMax(); + while (val < min || val > max) { + val = which == 0 ? RandHelper::randNorm(myParameter[0], myParameter[1]) : which->randNorm(myParameter[0], myParameter[1]); + } + } + return val; +} + + +double +Distribution_Parameterized::getMax() const { + if (myParameter[1] == 0.) { + return myParameter[0]; + } + return myParameter.size() > 3 ? myParameter[3] : std::numeric_limits::infinity(); +} + + +std::string +Distribution_Parameterized::toStr(std::streamsize accuracy) const { + return myParameter[1] == 0. ? toString(myParameter[0]) : myID + "(" + joinToString(myParameter, ",", accuracy) + ")"; +} + + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/Distribution_Parameterized.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/Distribution_Parameterized.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/Distribution_Parameterized.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/Distribution_Parameterized.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,101 @@ +/****************************************************************************/ +/// @file Distribution_Parameterized.h +/// @author Daniel Krajzewicz +/// @author Michael Behrisch +/// @date Sept 2002 +/// @version $Id: Distribution_Parameterized.h 24108 2017-04-27 18:43:30Z behrisch $ +/// +// A distribution described by parameters such as the mean value and std-dev +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef Distribution_MeanDev_h +#define Distribution_MeanDev_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include "Distribution.h" + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class Distribution_Parameterized + * A description of distribution by the distribution's mean value and a + * standard deviation. + * Incomplete and unused yet. This class should be overridden by derived + * classes + */ +class Distribution_Parameterized : + public Distribution { +public: + /// Constructor for parsable distribution description + Distribution_Parameterized(const std::string& description); + + /// Constructor for standard normal distribution + Distribution_Parameterized(const std::string& id, double mean, + double deviation); + + /// Constructor for normal distribution with cutoff + Distribution_Parameterized(const std::string& id, double mean, + double deviation, double min, double max); + + /// Destructor + virtual ~Distribution_Parameterized(); + + /** @brief Draw a sample of the distribution. + * + * A random sample is drawn according to the assigned probabilities. + * + * @param[in] which The random number generator to use; the static one will be used if 0 is passed + * @return the drawn member + */ + double sample(MTRand* which = 0) const; + + /// Returns the maximum value of this distribution + double getMax() const; + + /// Returns the parameters of this distribution + std::vector& getParameter() { + return myParameter; + } + + /// Returns the unmodifiable parameters of this distribution + const std::vector& getParameter() const { + return myParameter; + } + + /// Returns the string representation of this distribution + std::string toStr(std::streamsize accuracy) const; + +private: + /// The distribution's parameters + std::vector myParameter; + +}; + + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/Distribution_Points.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/Distribution_Points.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/Distribution_Points.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/Distribution_Points.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: Distribution_Points.cpp 21210 2016-07-21 10:02:38Z behrisch $ +/// @version $Id: Distribution_Points.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The description of a distribution by a curve /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -30,90 +30,42 @@ #endif #include -#include "Distribution.h" -#include -#include "Distribution_Points.h" +#include +#include #include - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS +#include "Distribution_Points.h" // =========================================================================== // method definitions // =========================================================================== -Distribution_Points::Distribution_Points(const std::string& id, - const PositionVector& points, - bool interpolating) - : Distribution(id), myPoints(points), myProbabilitiesAreComputed(false), - myInterpolateDist(interpolating) {} +Distribution_Points::Distribution_Points(const std::string& id) + : Distribution(id) {} Distribution_Points::~Distribution_Points() {} -SUMOReal +double Distribution_Points::getMax() const { - assert(myPoints.size() > 0); - const Position& p = myPoints[-1]; - return p.x(); -} - - -int -Distribution_Points::getAreaNo() const { - return (int)myPoints.size() - 1; + assert(getVals().size() > 0); + return getVals().back(); } -SUMOReal -Distribution_Points::getAreaBegin(int index) const { - return myPoints[index].x(); -} - - -SUMOReal -Distribution_Points::getAreaEnd(int index) const { - return myPoints[index + 1].x(); -} - - -SUMOReal -Distribution_Points::getAreaPerc(int index) const { - if (!myProbabilitiesAreComputed) { - SUMOReal sum = 0; - if (myInterpolateDist) { - for (int i = 0; i < (int)myPoints.size() - 1; i++) { - SUMOReal width = getAreaEnd(i) - getAreaBegin(i); - SUMOReal minval = MIN2(myPoints[i].y(), myPoints[i].y()); - SUMOReal maxval = MAX2(myPoints[i].y(), myPoints[i].y()); - SUMOReal amount = minval * width + (maxval - minval) * width / (SUMOReal) 2.; - myProbabilities.push_back(amount); - sum += amount; - } - } else { - for (int i = 0; i < (int)myPoints.size() - 1; i++) { - myProbabilities.push_back(myPoints[i].y()); - sum += myPoints[i].y(); - } +std::string +Distribution_Points::toStr(std::streamsize accuracy) const { + std::stringstream oss; + oss << std::setprecision(accuracy); + const std::vector vals = getVals(); + for (int i = 0; i < (int)vals.size(); i++) { + if (i > 0) { + oss << ","; } - // normalize - if (myInterpolateDist) { - for (int i = 0; i < (int)myPoints.size() - 1; i++) { - myProbabilities[i] = myProbabilities[i] / sum; - } - } else { - for (int i = 0; i < (int)myPoints.size() - 1; i++) { - myProbabilities[i] = myProbabilities[i] / sum; - } - } - myProbabilitiesAreComputed = true; + oss << vals[i] << ":" << getProbs()[i]; } - return myProbabilities[index]; + return "points(" + oss.str() + ")"; } - /****************************************************************************/ - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/Distribution_Points.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/Distribution_Points.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/Distribution_Points.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/Distribution_Points.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: Distribution_Points.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: Distribution_Points.h 23362 2017-03-14 09:16:46Z behrisch $ /// // The description of a distribution by a curve /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,8 +31,8 @@ #include #endif +#include "RandomDistributor.h" #include "Distribution.h" -#include // =========================================================================== @@ -41,38 +41,34 @@ /** * @class Distribution_Points * A description of a distribution that uses a set of points in a 2d-space - * to describe the values (each points x-value) and theri possibilities + * to describe the values (each points x-value) and their possibilities * (each points y-value) */ class Distribution_Points : - public Distribution { + public Distribution, public RandomDistributor { public: /// Constructor - Distribution_Points(const std::string& id, - const PositionVector& points, bool interpolating = false); + Distribution_Points(const std::string& id); /// Destructor virtual ~Distribution_Points(); - /// Returns the maximum value of this distribution - SUMOReal getMax() const; - - int getAreaNo() const; - SUMOReal getAreaBegin(int index) const; - SUMOReal getAreaEnd(int index) const; - SUMOReal getAreaPerc(int index) const; - - -protected: - /// The list of points that describe the distribution - PositionVector myPoints; + /** @brief Draw a sample of the distribution. + * + * A random sample is drawn according to the assigned probabilities. + * + * @param[in] which The random number generator to use; the static one will be used if 0 is passed + * @return the drawn member + */ + double sample(MTRand* which = 0) const { + return get(which); + } - mutable bool myProbabilitiesAreComputed; - - mutable std::vector myProbabilities; - - bool myInterpolateDist; + /// Returns the maximum value of this distribution + double getMax() const; + /// Returns the string representation of this distribution + std::string toStr(std::streamsize accuracy) const; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -1,9 +1,7 @@ noinst_LIBRARIES = libdistribution.a -libdistribution_a_SOURCES = DistributionCont.cpp \ -Distribution_MeanDev.cpp \ -Distribution_Points.cpp \ -DistributionCont.h \ -Distribution.h \ -Distribution_MeanDev.h \ -Distribution_Points.h +libdistribution_a_SOURCES = Distribution.h \ +Distribution_Parameterized.cpp Distribution_Parameterized.h \ +Distribution_Points.cpp Distribution_Points.h \ +DistributionCont.cpp DistributionCont.h \ +RandomDistributor.h diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -98,8 +98,8 @@ am__v_AR_1 = libdistribution_a_AR = $(AR) $(ARFLAGS) libdistribution_a_LIBADD = -am_libdistribution_a_OBJECTS = DistributionCont.$(OBJEXT) \ - Distribution_MeanDev.$(OBJEXT) Distribution_Points.$(OBJEXT) +am_libdistribution_a_OBJECTS = Distribution_Parameterized.$(OBJEXT) \ + Distribution_Points.$(OBJEXT) DistributionCont.$(OBJEXT) libdistribution_a_OBJECTS = $(am_libdistribution_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) @@ -328,13 +328,11 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LIBRARIES = libdistribution.a -libdistribution_a_SOURCES = DistributionCont.cpp \ -Distribution_MeanDev.cpp \ -Distribution_Points.cpp \ -DistributionCont.h \ -Distribution.h \ -Distribution_MeanDev.h \ -Distribution_Points.h +libdistribution_a_SOURCES = Distribution.h \ +Distribution_Parameterized.cpp Distribution_Parameterized.h \ +Distribution_Points.cpp Distribution_Points.h \ +DistributionCont.cpp DistributionCont.h \ +RandomDistributor.h all: all-am @@ -386,7 +384,7 @@ -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DistributionCont.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Distribution_MeanDev.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Distribution_Parameterized.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Distribution_Points.Po@am__quote@ .cpp.o: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/RandomDistributor.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/RandomDistributor.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/distribution/RandomDistributor.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/distribution/RandomDistributor.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,167 @@ +/****************************************************************************/ +/// @file RandomDistributor.h +/// @author Daniel Krajzewicz +/// @author Michael Behrisch +/// @author Jakob Erdmann +/// @date 2005-09-15 +/// @version $Id: RandomDistributor.h 23341 2017-03-13 10:11:12Z behrisch $ +/// +// Represents a generic random distribution +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef RandomDistributor_h +#define RandomDistributor_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class RandomDistributor + * @brief Represents a generic random distribution + * + * This class allows to create random distributions by assigning + * arbitrary (non-negative) probabilities to its elements. The + * random number generator used is specified in RandHelper. + * + * @see RandHelper + */ + +template +class RandomDistributor { +public: + /** @brief Constructor for an empty distribution + */ + RandomDistributor() : + myProb(0) { + } + + /// @brief Destructor + ~RandomDistributor() { } + + /** @brief Adds a value with an assigned probability to the distribution. + * + * If the value is already member of the distribution and checkDuplicates is + * true (the default) the given probability is added to the current. + * The probability has to be non-negative but values larger than one are + * allowed (and scaled accordingly when an element is drawn). + * + * @param[in] val The value to add to the distribution + * @param[in] prob The probability assigned to the value + * @return true if a new value was added, false if just the probability of an existing one was updated + */ + bool add(T val, double prob, bool checkDuplicates = true) { + assert(prob >= 0); + myProb += prob; + if (checkDuplicates) { + for (int i = 0; i < (int)myVals.size(); i++) { + if (val == myVals[i]) { + myProbs[i] += prob; + return false; + } + } + } + myVals.push_back(val); + myProbs.push_back(prob); + return true; + } + + /** @brief Draw a sample of the distribution. + * + * A random sample is drawn according to the assigned probabilities. + * + * @param[in] which The random number generator to use; the static one will be used if 0 is passed + * @return the drawn member + */ + T get(MTRand* which = 0) const { + if (myProb == 0) { + throw OutOfBoundsException(); + } + double prob = which == 0 ? RandHelper::rand(myProb) : which->rand(myProb); + for (int i = 0; i < (int)myVals.size(); i++) { + if (prob < myProbs[i]) { + return myVals[i]; + } + prob -= myProbs[i]; + } + return myVals.back(); + } + + /** @brief Return the sum of the probabilites assigned to the members. + * + * This should be zero if and only if the distribution is empty. + * + * @return the total probability + */ + double getOverallProb() const { + return myProb; + } + + /// @brief Clears the distribution + void clear() { + myProb = 0; + myVals.clear(); + myProbs.clear(); + } + + /** @brief Returns the members of the distribution. + * + * See getProbs for the corresponding probabilities. + * + * @return the members of the distribution + * @see RandomDistributor::getProbs + */ + const std::vector& getVals() const { + return myVals; + } + + /** @brief Returns the probabilities assigned to the members of the distribution. + * + * See getVals for the corresponding members. + * + * @return the probabilities assigned to the distribution + * @see RandomDistributor::getVals + */ + const std::vector& getProbs() const { + return myProbs; + } + +private: + /// @brief the total probability + double myProb; + /// @brief the members + std::vector myVals; + /// @brief the corresponding probabilities + std::vector myProbs; + +}; + + +#endif + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersEnergy.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersEnergy.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersEnergy.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersEnergy.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,130 @@ +/****************************************************************************/ +/// @file HelpersEnergy.cpp +/// @author Daniel Krajzewicz +/// @author Jakob Erdmann +/// @author Michael Behrisch +/// @date Mon, 10.05.2004 +/// @version $Id: HelpersEnergy.cpp 23673 2017-03-27 13:02:44Z behrisch $ +/// +// Helper methods for HBEFA-based emission computation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include "HelpersEnergy.h" + + +// =========================================================================== +// method definitions +// =========================================================================== +HelpersEnergy::HelpersEnergy() : PollutantsInterface::Helper("Energy") { + myEmissionClassStrings.insert("zero", PollutantsInterface::ZERO_EMISSIONS); + myEmissionClassStrings.insert("unknown", ENERGY_BASE); + myDefaultParameter[SUMO_ATTR_VEHICLEMASS] = 1000.; + myDefaultParameter[SUMO_ATTR_FRONTSURFACEAREA] = 2.; + myDefaultParameter[SUMO_ATTR_AIRDRAGCOEFFICIENT] = 0.4; + myDefaultParameter[SUMO_ATTR_INTERNALMOMENTOFINERTIA] = 10.; + myDefaultParameter[SUMO_ATTR_RADIALDRAGCOEFFICIENT] = 1.; + myDefaultParameter[SUMO_ATTR_ROLLDRAGCOEFFICIENT] = 0.5; + myDefaultParameter[SUMO_ATTR_CONSTANTPOWERINTAKE] = 10.; + myDefaultParameter[SUMO_ATTR_PROPULSIONEFFICIENCY] = 0.5; + myDefaultParameter[SUMO_ATTR_RECUPERATIONEFFICIENCY] = 0.; + myDefaultParameter[SUMO_ATTR_ANGLE] = 0.; +} + + +double +HelpersEnergy::compute(const SUMOEmissionClass /* c */, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const std::map* param) const { + if (e != PollutantsInterface::ELEC) { + return 0.; + } + if (param == 0) { + param = &myDefaultParameter; + } + //@ToDo: All formulas below work with the logic of the euler update (refs #860). + // Approximation order could be improved. Refs. #2592. + + const double lastV = v - ACCEL2SPEED(a); + const double mass = param->find(SUMO_ATTR_VEHICLEMASS)->second; + + // calculate potential energy difference + double energyDiff = mass * 9.81 * slope * SPEED2DIST(v); + + // kinetic energy difference of vehicle + energyDiff += 0.5 * mass * (v * v - lastV * lastV); + + // add rotational energy diff of internal rotating elements + energyDiff += param->find(SUMO_ATTR_INTERNALMOMENTOFINERTIA)->second * (v * v - lastV * lastV); + + // Energy loss through Air resistance [Ws] + // Calculate energy losses: + // EnergyLoss,Air = 1/2 * rho_air [kg/m^3] * myFrontSurfaceArea [m^2] * myAirDragCoefficient [-] * v_Veh^2 [m/s] * s [m] + // ... with rho_air [kg/m^3] = 1,2041 kg/m^3 (at T = 20C) + // ... with s [m] = v_Veh [m/s] * TS [s] + energyDiff += 0.5 * 1.2041 * param->find(SUMO_ATTR_FRONTSURFACEAREA)->second * param->find(SUMO_ATTR_AIRDRAGCOEFFICIENT)->second * v * v * SPEED2DIST(v); + + // Energy loss through Roll resistance [Ws] + // ... (fabs(veh.getSpeed())>=0.01) = 0, if vehicle isn't moving + // EnergyLoss,Tire = c_R [-] * F_N [N] * s [m] + // ... with c_R = ~0.012 (car tire on asphalt) + // ... with F_N [N] = myMass [kg] * g [m/s^2] + energyDiff += param->find(SUMO_ATTR_ROLLDRAGCOEFFICIENT)->second * 9.81 * mass * SPEED2DIST(v); + + // Energy loss through friction by radial force [Ws] + // If angle of vehicle was changed + const double angleDiff = param->find(SUMO_ATTR_ANGLE)->second; + if (angleDiff != 0.) { + // Compute new radio + double radius = SPEED2DIST(v) / fabs(angleDiff); + + // Check if radius is in the interval [0.0001 - 10000] (To avoid overflow and division by zero) + if (radius < 0.0001) { + radius = 0.0001; + } else if (radius > 10000) { + radius = 10000; + } + // EnergyLoss,internalFrictionRadialForce = c [m] * F_rad [N]; + // Energy loss through friction by radial force [Ws] + energyDiff += param->find(SUMO_ATTR_RADIALDRAGCOEFFICIENT)->second * mass * v * v / radius; + } + + // EnergyLoss,constantConsumers + // Energy loss through constant loads (e.g. A/C) [Ws] + energyDiff += param->find(SUMO_ATTR_CONSTANTPOWERINTAKE)->second; + + //E_Bat = E_kin_pot + EnergyLoss; + if (energyDiff > 0) { + // Assumption: Efficiency of myPropulsionEfficiency when accelerating + energyDiff /= param->find(SUMO_ATTR_PROPULSIONEFFICIENCY)->second; + } else { + // Assumption: Efficiency of myRecuperationEfficiency when recuperating + energyDiff *= param->find(SUMO_ATTR_RECUPERATIONEFFICIENCY)->second; + } + + // convert from [Ws] to [Wh] (3600s / 1h): + return energyDiff / 3600.; +} + + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersEnergy.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersEnergy.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersEnergy.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersEnergy.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,87 @@ +/****************************************************************************/ +/// @file HelpersEnergy.h +/// @author Daniel Krajzewicz +/// @author Michael Behrisch +/// @date Mon, 10.05.2004 +/// @version $Id: HelpersEnergy.h 23673 2017-03-27 13:02:44Z behrisch $ +/// +// Helper methods for HBEFA-based emission computation +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef HelpersEnergy_h +#define HelpersEnergy_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include "PollutantsInterface.h" + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class HelpersEnergy + * @brief Helper methods for energy-based electricity consumption computation based on the battery device + */ +class HelpersEnergy : public PollutantsInterface::Helper { +public: + static const int ENERGY_BASE = 3 << 16; + + /** @brief Constructor (initializes myEmissionClassStrings) + */ + HelpersEnergy(); + + + /** @brief Computes the emitted pollutant amount using the given speed and acceleration + * + * Returns only valid values for electricity all other types give 0. + * + * @param[in] c emission class for the function parameters to use + * @param[in] e the type of emission (CO, CO2, ...), only electricity gives valid results + * @param[in] v The vehicle's current velocity + * @param[in] a The vehicle's current acceleration + * @param[in] slope The road's slope at vehicle's position [deg] + * @return The amount emitted by the given emission class when moving with the given velocity and acceleration [mg/s or ml/s] + */ + double compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const std::map* param) const; + + double getDefaultParam(int paramKey) const { + return myDefaultParameter.find(paramKey)->second; + } + + +private: + /// @brief The default parameter + std::map myDefaultParameter; + +}; + + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersHarmonoise.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersHarmonoise.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersHarmonoise.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersHarmonoise.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 10.05.2004 -/// @version $Id: HelpersHarmonoise.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: HelpersHarmonoise.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Noise data collector for edges/lanes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static definitions @@ -104,7 +100,7 @@ // =========================================================================== // method definitions // =========================================================================== -SUMOReal +double HelpersHarmonoise::computeNoise(SUMOEmissionClass c, double v, double a) { double* alphaT, *betaT, *alphaR, *betaR; double ac = 0; @@ -142,7 +138,7 @@ } L_low = (10. * log10(L_low)); L_high = (10. * log10(L_high)); - SUMOReal v1 = (SUMOReal)(10. * log10(pow(10., L_low / 10.) + pow(10., L_high / 10.))); + double v1 = (double)(10. * log10(pow(10., L_low / 10.) + pow(10., L_high / 10.))); return v1; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersHarmonoise.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersHarmonoise.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersHarmonoise.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersHarmonoise.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 10.05.2004 -/// @version $Id: HelpersHarmonoise.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: HelpersHarmonoise.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Helper methods for Harmonoise-based noise emission computation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -57,7 +57,7 @@ * @param[in] a The vehicle's current acceleration * @return The noise produced by the vehicle of the given class running with v and a */ - static SUMOReal computeNoise(SUMOEmissionClass c, double v, double a); + static double computeNoise(SUMOEmissionClass c, double v, double a); /** @brief Computes the resulting noise @@ -65,8 +65,8 @@ * @param[in] val The sum of converted vehicle noises ( pow(10., (/10.)) ) * @return The resulting sum */ - inline static SUMOReal sum(SUMOReal val) { - return SUMOReal(10. * log10(val)); + inline static double sum(double val) { + return double(10. * log10(val)); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersHBEFA3.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersHBEFA3.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersHBEFA3.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersHBEFA3.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 10.05.2004 -/// @version $Id: HelpersHBEFA3.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: HelpersHBEFA3.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Helper methods for HBEFA3-based emission computation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include #include "HelpersHBEFA3.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static definitions @@ -474,7 +470,7 @@ for (int i = 0; i < 12; i++) { myEmissionClassStrings.insert(heavy[i], index | PollutantsInterface::HEAVY_BIT); std::transform(heavy[i].begin(), heavy[i].end(), heavy[i].begin(), tolower); - myEmissionClassStrings.addAlias(heavy[i], index); + myEmissionClassStrings.addAlias(heavy[i], index | PollutantsInterface::HEAVY_BIT); index++; } myEmissionClassStrings.addAlias("unknown", myEmissionClassStrings.get("PC_G_EU4")); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersHBEFA3.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersHBEFA3.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersHBEFA3.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersHBEFA3.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 10.05.2004 -/// @version $Id: HelpersHBEFA3.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: HelpersHBEFA3.h 23673 2017-03-27 13:02:44Z behrisch $ /// // Helper methods for HBEFA3-based emission computation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -105,13 +105,14 @@ * @param[in] slope The road's slope at vehicle's position [deg] * @return The amount emitted by the given emission class when moving with the given velocity and acceleration [mg/s or ml/s] */ - inline SUMOReal compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope) const { + inline double compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const std::map* param) const { UNUSED_PARAMETER(slope); + UNUSED_PARAMETER(param); if (c == HBEFA3_BASE || a < 0. || e == PollutantsInterface::ELEC) { return 0.; } const int index = (c & ~PollutantsInterface::HEAVY_BIT) - HBEFA3_BASE - 1; - SUMOReal scale = 3.6; + double scale = 3.6; if (e == PollutantsInterface::FUEL) { if (getFuel(c) == "Diesel") { scale *= 836.; @@ -120,7 +121,7 @@ } } const double* f = myFunctionParameter[index][e]; - return (SUMOReal) MAX2((f[0] + f[1] * a * v + f[2] * a * a * v + f[3] * v + f[4] * v * v + f[5] * v * v * v) / scale, 0.); + return (double) MAX2((f[0] + f[1] * a * v + f[2] * a * a * v + f[3] * v + f[4] * v * v + f[5] * v * v * v) / scale, 0.); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersHBEFA.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersHBEFA.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersHBEFA.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersHBEFA.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 10.05.2004 -/// @version $Id: HelpersHBEFA.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: HelpersHBEFA.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Helper methods for HBEFA-based emission computation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,10 +33,6 @@ #include #include "HelpersHBEFA.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static definitions @@ -152,7 +148,7 @@ for (int i = 0; i < 3; i++) { for (int j = 0; j < clusterSizesH[i]; j++) { myEmissionClassStrings.insert("HDV_" + toString(clusterSizesH[i]) + "_" + toString(j + 1), index | PollutantsInterface::HEAVY_BIT); - myEmissionClassStrings.addAlias("hdv_" + toString(clusterSizesH[i]) + "_" + toString(j + 1), index); + myEmissionClassStrings.addAlias("hdv_" + toString(clusterSizesH[i]) + "_" + toString(j + 1), index | PollutantsInterface::HEAVY_BIT); index++; } } @@ -166,7 +162,7 @@ for (int i = 0; i < 3; i++) { for (int j = 0; j < clusterSizesH[i]; j++) { myEmissionClassStrings.insert("HDV_A0_" + toString(clusterSizesH[i]) + "_" + toString(j + 1), index | PollutantsInterface::HEAVY_BIT); - myEmissionClassStrings.addAlias("hdv_a0_" + toString(clusterSizesH[i]) + "_" + toString(j + 1), index); + myEmissionClassStrings.addAlias("hdv_a0_" + toString(clusterSizesH[i]) + "_" + toString(j + 1), index | PollutantsInterface::HEAVY_BIT); index++; } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersHBEFA.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersHBEFA.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersHBEFA.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersHBEFA.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 10.05.2004 -/// @version $Id: HelpersHBEFA.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: HelpersHBEFA.h 23673 2017-03-27 13:02:44Z behrisch $ /// // Helper methods for HBEFA-based emission computation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -71,24 +71,25 @@ * @param[in] slope The road's slope at vehicle's position [deg] * @return The amount emitted by the given emission class when moving with the given velocity and acceleration [mg/s or ml/s] */ - inline SUMOReal compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope) const { + inline double compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const std::map* param) const { UNUSED_PARAMETER(slope); + UNUSED_PARAMETER(param); if (c == PollutantsInterface::ZERO_EMISSIONS || e == PollutantsInterface::ELEC) { return 0.; } const int index = (c & ~PollutantsInterface::HEAVY_BIT) - 1; - const SUMOReal kmh = v * 3.6; - const SUMOReal scale = (e == PollutantsInterface::FUEL) ? 3.6 * 790. : 3.6; + const double kmh = v * 3.6; + const double scale = (e == PollutantsInterface::FUEL) ? 3.6 * 790. : 3.6; if (index >= 42) { const double* f = myFunctionParameter[index - 42] + 6 * e; - return (SUMOReal) MAX2((f[0] + f[3] * kmh + f[4] * kmh * kmh + f[5] * kmh * kmh * kmh) / scale, 0.); + return (double) MAX2((f[0] + f[3] * kmh + f[4] * kmh * kmh + f[5] * kmh * kmh * kmh) / scale, 0.); } if (a < 0.) { return 0.; } const double* f = myFunctionParameter[index] + 6 * e; const double alpha = asin(a / 9.81) * 180. / M_PI; - return (SUMOReal) MAX2((f[0] + f[1] * alpha * kmh + f[2] * alpha * alpha * kmh + f[3] * kmh + f[4] * kmh * kmh + f[5] * kmh * kmh * kmh) / scale, 0.); + return (double) MAX2((f[0] + f[1] * alpha * kmh + f[2] * alpha * alpha * kmh + f[3] * kmh + f[4] * kmh * kmh + f[5] * kmh * kmh * kmh) / scale, 0.); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersPHEMlight.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersPHEMlight.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersPHEMlight.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersPHEMlight.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Nikolaus Furian /// @date Sat, 20.04.2013 -/// @version $Id: HelpersPHEMlight.cpp 21118 2016-07-05 13:46:32Z behrisch $ +/// @version $Id: HelpersPHEMlight.cpp 23673 2017-03-27 13:02:44Z behrisch $ /// // Helper methods for PHEMlight-based emission computation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,6 @@ #include #include "HelpersPHEMlight.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // idle speed is usually given in rpm (but may depend on electrical consumers). Actual speed depends on the gear so this number is only a rough estimate #define IDLE_SPEED (10 / 3.6) @@ -220,7 +216,7 @@ } -SUMOReal +double HelpersPHEMlight::getWeight(const SUMOEmissionClass c) const { const std::string name = myEmissionClassStrings.getString(c); if (name.find("LNF_") != std::string::npos) { @@ -243,7 +239,7 @@ } -SUMOReal +double HelpersPHEMlight::getEmission(const PHEMCEP* oldCep, PHEMlightdll::CEP* currCep, const std::string& e, const double p, const double v) const { if (oldCep != 0) { return oldCep->GetEmission(e, p, v); @@ -252,8 +248,8 @@ } -SUMOReal -HelpersPHEMlight::compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope) const { +double +HelpersPHEMlight::compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const std::map* /* param */) const { if (c == PHEMLIGHT_BASE) { // zero emission class return 0.; } @@ -320,4 +316,3 @@ /****************************************************************************/ - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersPHEMlight.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersPHEMlight.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/HelpersPHEMlight.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/HelpersPHEMlight.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,7 +3,7 @@ /// @author Daniel Krajzewicz /// @author Nikolaus Furian /// @date Sat, 20.04.2013 -/// @version $Id: HelpersPHEMlight.h 20279 2016-03-22 13:55:22Z behrisch $ +/// @version $Id: HelpersPHEMlight.h 23673 2017-03-27 13:02:44Z behrisch $ /// // Helper methods for PHEMlight-based emission computation /****************************************************************************/ @@ -103,7 +103,7 @@ * @param[in] c the emission class * @return a reference weight */ - SUMOReal getWeight(const SUMOEmissionClass c) const; + double getWeight(const SUMOEmissionClass c) const; /** @brief Returns the amount of emitted pollutant given the vehicle type and state (in mg/s or in ml/s for fuel) * @param[in] c The vehicle emission class @@ -112,7 +112,7 @@ * @param[in] slope The road's slope at vehicle's position [deg] * @return The amount of the pollutant emitted by the given emission class when moving with the given velocity and acceleration [mg/s or ml/s] */ - SUMOReal compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope) const; + double compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const std::map* param) const; private: /** @brief Returns the amount of emitted pollutant given the vehicle type and state (in mg/s or in ml/s for fuel) @@ -122,7 +122,7 @@ * @param[in] v The vehicle's current velocity * @return The amount of the pollutant emitted by the given emission class when moving with the given velocity and acceleration [mg/s or ml/s] */ - SUMOReal getEmission(const PHEMCEP* oldCep, PHEMlightdll::CEP* currCep, const std::string& e, const double p, const double v) const; + double getEmission(const PHEMCEP* oldCep, PHEMlightdll::CEP* currCep, const std::string& e, const double p, const double v) const; /// @brief the index of the next class int myIndex; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -1,6 +1,7 @@ noinst_LIBRARIES = libemissions.a -libemissions_a_SOURCES = HelpersHarmonoise.cpp HelpersHarmonoise.h \ +libemissions_a_SOURCES = HelpersEnergy.cpp HelpersEnergy.h \ +HelpersHarmonoise.cpp HelpersHarmonoise.h \ HelpersHBEFA.cpp HelpersHBEFA.h \ HelpersHBEFA3.cpp HelpersHBEFA3.h \ HelpersPHEMlight.cpp HelpersPHEMlight.h \ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -98,10 +98,11 @@ am__v_AR_1 = libemissions_a_AR = $(AR) $(ARFLAGS) libemissions_a_LIBADD = -am_libemissions_a_OBJECTS = HelpersHarmonoise.$(OBJEXT) \ - HelpersHBEFA.$(OBJEXT) HelpersHBEFA3.$(OBJEXT) \ - HelpersPHEMlight.$(OBJEXT) PHEMCEP.$(OBJEXT) \ - PHEMCEPHandler.$(OBJEXT) PollutantsInterface.$(OBJEXT) +am_libemissions_a_OBJECTS = HelpersEnergy.$(OBJEXT) \ + HelpersHarmonoise.$(OBJEXT) HelpersHBEFA.$(OBJEXT) \ + HelpersHBEFA3.$(OBJEXT) HelpersPHEMlight.$(OBJEXT) \ + PHEMCEP.$(OBJEXT) PHEMCEPHandler.$(OBJEXT) \ + PollutantsInterface.$(OBJEXT) libemissions_a_OBJECTS = $(am_libemissions_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) @@ -330,7 +331,8 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LIBRARIES = libemissions.a -libemissions_a_SOURCES = HelpersHarmonoise.cpp HelpersHarmonoise.h \ +libemissions_a_SOURCES = HelpersEnergy.cpp HelpersEnergy.h \ +HelpersHarmonoise.cpp HelpersHarmonoise.h \ HelpersHBEFA.cpp HelpersHBEFA.h \ HelpersHBEFA3.cpp HelpersHBEFA3.h \ HelpersPHEMlight.cpp HelpersPHEMlight.h \ @@ -386,6 +388,7 @@ distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HelpersEnergy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HelpersHBEFA.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HelpersHBEFA3.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HelpersHarmonoise.Po@am__quote@ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/PHEMCEP.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/PHEMCEP.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/PHEMCEP.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/PHEMCEP.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Marek Heinrich /// @date Thu, 13.06.2013 -/// @version $Id: PHEMCEP.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: PHEMCEP.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Helper class for PHEM Light, holds a specific CEP for a PHEM emission class /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,10 +38,6 @@ #include #include "PHEMCEP.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/PHEMCEP.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/PHEMCEP.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/PHEMCEP.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/PHEMCEP.h 2017-07-23 16:22:03.000000000 +0000 @@ -10,7 +10,7 @@ // Helper class for PHEM Light, holds a specific CEP for a PHEM emission class /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/PHEMCEPHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/PHEMCEPHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/PHEMCEPHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/PHEMCEPHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -10,7 +10,7 @@ // Helper class for PHEM Light, holds CEP data for emission computation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/PHEMCEPHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/PHEMCEPHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/PHEMCEPHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/PHEMCEPHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -10,7 +10,7 @@ // Helper singleton class for PHEM Light, holds CEP data for emission computation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/PHEMConstants.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/PHEMConstants.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/PHEMConstants.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/PHEMConstants.h 2017-07-23 16:22:03.000000000 +0000 @@ -8,7 +8,7 @@ // Holds constants and data version info for PHEM Light /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/PollutantsInterface.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/PollutantsInterface.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/PollutantsInterface.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/PollutantsInterface.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 19.08.2013 -/// @version $Id: PollutantsInterface.cpp 21201 2016-07-19 11:57:22Z behrisch $ +/// @version $Id: PollutantsInterface.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Interface to capsulate different emission models /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,14 +32,11 @@ #include #include #include -#include "PollutantsInterface.h" #include "HelpersHBEFA.h" #include "HelpersHBEFA3.h" #include "HelpersPHEMlight.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS +#include "HelpersEnergy.h" +#include "PollutantsInterface.h" // =========================================================================== @@ -48,7 +45,10 @@ HelpersHBEFA PollutantsInterface::myHBEFA2Helper; HelpersHBEFA3 PollutantsInterface::myHBEFA3Helper; HelpersPHEMlight PollutantsInterface::myPHEMlightHelper; -PollutantsInterface::Helper* PollutantsInterface::myHelpers[] = {&PollutantsInterface::myHBEFA2Helper, &PollutantsInterface::myHBEFA3Helper, &PollutantsInterface::myPHEMlightHelper}; +HelpersEnergy PollutantsInterface::myEnergyHelper; +PollutantsInterface::Helper* PollutantsInterface::myHelpers[] = { &PollutantsInterface::myHBEFA2Helper, &PollutantsInterface::myHBEFA3Helper, + &PollutantsInterface::myPHEMlightHelper, &PollutantsInterface::myEnergyHelper + }; // =========================================================================== @@ -60,7 +60,7 @@ if (sep != std::string::npos) { const std::string model = eClass.substr(0, sep); const std::string subClass = eClass.substr(sep + 1); - for (int i = 0; i < 3; i++) { + for (int i = 0; i < 4; i++) { if (myHelpers[i]->getName() == model) { return myHelpers[i]->getClassByName(subClass, vc); } @@ -126,31 +126,31 @@ } -SUMOReal +double PollutantsInterface::getWeight(const SUMOEmissionClass c) { return myHelpers[c >> 16]->getWeight(c); } -SUMOReal -PollutantsInterface::compute(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope) { - return myHelpers[c >> 16]->compute(c, e, v, a, slope); +double +PollutantsInterface::compute(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope, const std::map* param) { + return myHelpers[c >> 16]->compute(c, e, v, a, slope, param); } PollutantsInterface::Emissions -PollutantsInterface::computeAll(const SUMOEmissionClass c, const double v, const double a, const double slope) { +PollutantsInterface::computeAll(const SUMOEmissionClass c, const double v, const double a, const double slope, const std::map* param) { const Helper* const h = myHelpers[c >> 16]; - return Emissions(h->compute(c, CO2, v, a, slope), h->compute(c, CO, v, a, slope), h->compute(c, HC, v, a, slope), - h->compute(c, FUEL, v, a, slope), h->compute(c, NO_X, v, a, slope), h->compute(c, PM_X, v, a, slope), - h->compute(c, ELEC, v, a, slope)); + return Emissions(h->compute(c, CO2, v, a, slope, param), h->compute(c, CO, v, a, slope, param), h->compute(c, HC, v, a, slope, param), + h->compute(c, FUEL, v, a, slope, param), h->compute(c, NO_X, v, a, slope, param), h->compute(c, PM_X, v, a, slope, param), + h->compute(c, ELEC, v, a, slope, param)); } -SUMOReal -PollutantsInterface::computeDefault(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope, const SUMOReal tt) { +double +PollutantsInterface::computeDefault(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope, const double tt, const std::map* param) { const Helper* const h = myHelpers[c >> 16]; - return (h->compute(c, e, v, 0, slope) + h->compute(c, e, v - a, a, slope)) * tt / 2.; + return (h->compute(c, e, v, 0, slope, param) + h->compute(c, e, v - a, a, slope, param)) * tt / 2.; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/PollutantsInterface.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/PollutantsInterface.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/emissions/PollutantsInterface.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/emissions/PollutantsInterface.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 19.08.2013 -/// @version $Id: PollutantsInterface.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: PollutantsInterface.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Interface to capsulate different emission models /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,6 +46,7 @@ class HelpersHBEFA; class HelpersHBEFA3; class HelpersPHEMlight; +class HelpersEnergy; // =========================================================================== @@ -67,13 +68,13 @@ * @brief Storage for collected values of all emission types */ struct Emissions { - SUMOReal CO2; - SUMOReal CO; - SUMOReal HC; - SUMOReal fuel; - SUMOReal NOx; - SUMOReal PMx; - SUMOReal electricity; + double CO2; + double CO; + double HC; + double fuel; + double NOx; + double PMx; + double electricity; /** @brief Constructor, intializes all members * @param[in] co2 initial value for CO2, defaults to 0 @@ -84,7 +85,7 @@ * @param[in] pmx initial value for PMx, defaults to 0 * @param[in] elec initial value for electricity, defaults to 0 */ - Emissions(SUMOReal co2 = 0, SUMOReal co = 0, SUMOReal hc = 0, SUMOReal f = 0, SUMOReal nox = 0, SUMOReal pmx = 0, SUMOReal elec = 0) + Emissions(double co2 = 0, double co = 0, double hc = 0, double f = 0, double nox = 0, double pmx = 0, double elec = 0) : CO2(co2), CO(co), HC(hc), fuel(f), NOx(nox), PMx(pmx), electricity(elec) { } @@ -92,7 +93,7 @@ * @param[in] a the other emission valuess * @param[in] scale scaling factor, defaulting to 1 (no scaling) */ - void addScaled(const Emissions& a, const SUMOReal scale = 1.) { + void addScaled(const Emissions& a, const double scale = 1.) { CO2 += scale * a.CO2; CO += scale * a.CO; HC += scale * a.HC; @@ -216,7 +217,7 @@ * @param[in] c the emission class * @return a reference weight */ - virtual SUMOReal getWeight(const SUMOEmissionClass c) const { + virtual double getWeight(const SUMOEmissionClass c) const { UNUSED_PARAMETER(c); return -1.; } @@ -230,7 +231,7 @@ * @param[in] slope The road's slope at vehicle's position [deg] * @return The amount emitted by the given emission class when moving with the given velocity and acceleration [mg/s or ml/s] */ - virtual SUMOReal compute(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope) const = 0; + virtual double compute(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope, const std::map* param) const = 0; /** @brief Add all known emission classes of this model to the given container * @param[in] list the vector to add to @@ -254,9 +255,6 @@ }; - /// @brief the known model helpers - static Helper* myHelpers[]; - /// @brief the first class in each model representing a zero emission vehicle static const int ZERO_EMISSIONS = 0; @@ -335,7 +333,7 @@ * @param[in] c The vehicle emission class * @return the weight in kg if it matters, 0 otherwise */ - static SUMOReal getWeight(const SUMOEmissionClass c); + static double getWeight(const SUMOEmissionClass c); /** @brief Returns the amount of the emitted pollutant given the vehicle type and state (in mg/s or ml/s for fuel) @@ -346,7 +344,7 @@ * @param[in] slope The road's slope at vehicle's position [deg] * @return The amount emitted by the given vehicle class when moving with the given velocity and acceleration [mg/s] */ - static SUMOReal compute(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope); + static double compute(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope, const std::map* param = 0); /** @brief Returns the amount of all emitted pollutants given the vehicle type and state (in mg/s or ml/s for fuel) @@ -356,7 +354,7 @@ * @param[in] slope The road's slope at vehicle's position [deg] * @return The amount emitted by the given vehicle class when moving with the given velocity and acceleration [mg/s] */ - static Emissions computeAll(const SUMOEmissionClass c, const double v, const double a, const double slope); + static Emissions computeAll(const SUMOEmissionClass c, const double v, const double a, const double slope, const std::map* param = 0); /** @brief Returns the amount of emitted pollutant given the vehicle type and default values for the state (in mg) @@ -368,7 +366,11 @@ * @param{in] tt the time the vehicle travels * @return The amount emitted by the given vehicle class [mg] */ - static SUMOReal computeDefault(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope, const SUMOReal tt); + static double computeDefault(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope, const double tt, const std::map* param = 0); + + static const HelpersEnergy& getEnergyHelper() { + return myEnergyHelper; + } private: /// @brief Instance of HBEFA2Helper which gets cleaned up automatically @@ -377,6 +379,10 @@ static HelpersHBEFA3 myHBEFA3Helper; /// @brief Instance of PHEMlightHelper which gets cleaned up automatically static HelpersPHEMlight myPHEMlightHelper; + /// @brief Instance of EnergyHelper which gets cleaned up automatically + static HelpersEnergy myEnergyHelper; + /// @brief the known model helpers + static Helper* myHelpers[]; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXBaseObject.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXBaseObject.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXBaseObject.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXBaseObject.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004-03-19 -/// @version $Id: FXBaseObject.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: FXBaseObject.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2003-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2003-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -49,9 +49,6 @@ using namespace FX; #include "FXBaseObject.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS using namespace FXEX; namespace FXEX { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXBaseObject.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXBaseObject.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXBaseObject.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXBaseObject.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004-03-19 -/// @version $Id: FXBaseObject.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: FXBaseObject.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/fxexdefs.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/fxexdefs.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/fxexdefs.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/fxexdefs.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004-03-19 -/// @version $Id: fxexdefs.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: fxexdefs.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXLCDLabel.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXLCDLabel.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXLCDLabel.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXLCDLabel.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004-03-19 -/// @version $Id: FXLCDLabel.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: FXLCDLabel.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -52,9 +52,6 @@ #include "FXLCDLabel.h" #include "FXBaseObject.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS using namespace FXEX; namespace FXEX { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXLCDLabel.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXLCDLabel.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXLCDLabel.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXLCDLabel.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004-03-19 -/// @version $Id: FXLCDLabel.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: FXLCDLabel.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXLinkLabel.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXLinkLabel.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXLinkLabel.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXLinkLabel.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 2006-03-08 -/// @version $Id: FXLinkLabel.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: FXLinkLabel.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2006-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2006-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,16 +37,11 @@ #include "FXLinkLabel.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - FXint FXLinkLabel::fxexecute(FXString link) { #ifdef WIN32 - FXString quoted = FXPath::enquote(link); - return (int)ShellExecute(NULL, "open", quoted.text(), NULL, NULL, SW_SHOW) > 32; + return (int)ShellExecute(NULL, "open", link.text(), NULL, NULL, SW_SHOWNORMAL) > 32; #else FXString ext = FXPath::extension(link); FXString list; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXLinkLabel.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXLinkLabel.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXLinkLabel.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXLinkLabel.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2006-03-08 -/// @version $Id: FXLinkLabel.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: FXLinkLabel.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2006-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2006-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXRealSpinDial.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXRealSpinDial.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXRealSpinDial.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXRealSpinDial.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date 2004-03-19 -/// @version $Id: FXRealSpinDial.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: FXRealSpinDial.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,7 +42,7 @@ * License along with this library; if not, write to the Free Software * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * ********************************************************************************* -* $Id: FXRealSpinDial.cpp 20482 2016-04-18 20:49:42Z behrisch $ * +* $Id: FXRealSpinDial.cpp 23529 2017-03-18 10:22:36Z behrisch $ * ********************************************************************************/ /* ========================================================================= @@ -74,9 +74,6 @@ #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS /* Notes: - Based originally on Lyle's FXSpinner. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXRealSpinDial.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXRealSpinDial.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXRealSpinDial.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXRealSpinDial.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004-03-19 -/// @version $Id: FXRealSpinDial.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: FXRealSpinDial.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXSevenSegment.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXSevenSegment.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXSevenSegment.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXSevenSegment.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004-03-19 -/// @version $Id: FXSevenSegment.cpp 21824 2016-10-27 13:03:52Z behrisch $ +/// @version $Id: FXSevenSegment.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ @@ -48,9 +48,6 @@ using namespace FX; #include "FXSevenSegment.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS using namespace FXEX; namespace FXEX { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXSevenSegment.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXSevenSegment.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXSevenSegment.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXSevenSegment.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004-03-19 -/// @version $Id: FXSevenSegment.h 21824 2016-10-27 13:03:52Z behrisch $ +/// @version $Id: FXSevenSegment.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXSingleEventThread.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXSingleEventThread.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXSingleEventThread.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXSingleEventThread.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Laura Bieker /// @author Jakob Erdmann /// @date 2004-03-19 -/// @version $Id: FXSingleEventThread.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: FXSingleEventThread.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,10 +43,6 @@ #include #endif -#ifdef CHECK_MEMORY_LEAKS -#include -#endif - #ifndef WIN32 # define PIPE_READ 0 # define PIPE_WRITE 1 diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXSingleEventThread.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXSingleEventThread.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXSingleEventThread.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXSingleEventThread.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004-03-19 -/// @version $Id: FXSingleEventThread.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: FXSingleEventThread.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXThreadEvent.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXThreadEvent.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXThreadEvent.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXThreadEvent.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004-03-19 -/// @version $Id: FXThreadEvent.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: FXThreadEvent.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -53,12 +53,9 @@ #include "fxexdefs.h" #include "FXThreadEvent.h" -#ifdef CHECK_MEMORY_LEAKS -#include // =========================================================================== // used namespaces // =========================================================================== -#endif // _DEBUG using namespace FXEX; namespace FXEX { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXThreadEvent.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXThreadEvent.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXThreadEvent.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXThreadEvent.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004-03-19 -/// @version $Id: FXThreadEvent.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: FXThreadEvent.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXThreadMessageRetriever.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXThreadMessageRetriever.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXThreadMessageRetriever.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXThreadMessageRetriever.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file FXThreadMessageRetriever.h /// @author Daniel Krajzewicz /// @date 2004-03-19 -/// @version $Id: FXThreadMessageRetriever.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: FXThreadMessageRetriever.h 22608 2017-01-17 06:28:54Z behrisch $ /// // missing_desc /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXWorkerThread.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXWorkerThread.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/FXWorkerThread.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/FXWorkerThread.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file FXWorkerThread.h /// @author Michael Behrisch /// @date 2014-07-13 -/// @version $Id: FXWorkerThread.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: FXWorkerThread.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A thread class together with a pool and a task for parallelized computation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXAddEditTypedTable.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXAddEditTypedTable.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXAddEditTypedTable.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXAddEditTypedTable.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MFXAddEditTypedTable.cpp /// @author Daniel Krajzewicz /// @date 2004-07-02 -/// @version $Id: MFXAddEditTypedTable.cpp 21314 2016-08-22 10:37:46Z namdre $ +/// @version $Id: MFXAddEditTypedTable.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // missing_desc /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "MFXAddEditTypedTable.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // Map FXDEFMAP(MFXAddEditTypedTable) MFXAddEditTypedTableMap[] = { @@ -106,7 +102,7 @@ { try { myNumberEditor->setValue( - TplConvert::_2SUMOReal(it->getText().text())); + TplConvert::_2double(it->getText().text())); } catch (NumberFormatException &) { } catch (EmptyData &) { } @@ -256,7 +252,7 @@ } try { if (getCellType(c) == CT_REAL) { - field->setValue(TplConvert::_2SUMOReal(item->getText().text())); + field->setValue(TplConvert::_2double(item->getText().text())); } else { field->setValue(TplConvert::_2int(item->getText().text())); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXAddEditTypedTable.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXAddEditTypedTable.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXAddEditTypedTable.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXAddEditTypedTable.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MFXAddEditTypedTable.h /// @author Daniel Krajzewicz /// @date 2004-07-02 -/// @version $Id: MFXAddEditTypedTable.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: MFXAddEditTypedTable.h 22608 2017-01-17 06:28:54Z behrisch $ /// // missing_desc /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXCheckableButton.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXCheckableButton.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXCheckableButton.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXCheckableButton.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MFXCheckableButton.cpp /// @author Daniel Krajzewicz /// @date 2004-03-19 -/// @version $Id: MFXCheckableButton.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MFXCheckableButton.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // missing_desc /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -30,10 +30,6 @@ #include "MFXCheckableButton.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - FXDEFMAP(MFXCheckableButton) MFXCheckableButtonMap[] = { FXMAPFUNC(SEL_PAINT, 0, MFXCheckableButton::onPaint), diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXCheckableButton.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXCheckableButton.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXCheckableButton.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXCheckableButton.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MFXCheckableButton.h /// @author Daniel Krajzewicz /// @date 2004-03-19 -/// @version $Id: MFXCheckableButton.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MFXCheckableButton.h 22929 2017-02-13 14:38:39Z behrisch $ /// -// missing_desc +// Checkable button similar to a FXButton but mainntain the check /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,33 +32,62 @@ #include +/** + * @class MFXCheckableButton + */ class MFXCheckableButton : public FXButton { + /// @brief fox declaration FXDECLARE(MFXCheckableButton) + public: + /// @brief constructor (Very similar to the FXButton constructor) MFXCheckableButton(bool amChecked, FXComposite* p, const FXString& text, FXIcon* ic = NULL, FXObject* tgt = NULL, FXSelector sel = 0, FXuint opts = BUTTON_NORMAL, FXint x = 0, FXint y = 0, FXint w = 0, FXint h = 0, FXint pl = DEFAULT_PAD, FXint pr = DEFAULT_PAD, FXint pt = DEFAULT_PAD, FXint pb = DEFAULT_PAD); + + /// @brief destructor (Called automatically) ~MFXCheckableButton(); + + /// @brief check if this MFXCheckableButton is checked bool amChecked() const; + + /// @brief check or uncheck this MFXCheckableButton void setChecked(bool val); + + /// @name FOX callbacks + /// @{ + /// @brief called when this MFXCheckableButton is painted long onPaint(FXObject*, FXSelector, void*); + + /// @brief called when this MFXCheckableButton is updated long onUpdate(FXObject*, FXSelector, void*); + /// @} +protected: + /// @brief fox need this + MFXCheckableButton() {} private: + /// @brief build color of this MFXCheckableButton void buildColors(); + + /// @brief set colors of this MFXCheckableButton void setColors(); private: + /// @brief flag to indicate if this MFXCheckableButton is checked bool myAmChecked; - FXColor myBackColor, myDarkColor, myHiliteColor, myShadowColor; - bool myAmInitialised; + /// @brief colors of this MFXCheckableButton + FXColor myBackColor, + myDarkColor, + myHiliteColor, + myShadowColor; -protected: - MFXCheckableButton() { } + /// @brief check if this MFXCheckableButton is initialised + bool myAmInitialised; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXEditableTable.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXEditableTable.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXEditableTable.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXEditableTable.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MFXEditableTable.cpp /// @author Daniel Krajzewicz /// @date 2004-07-02 -/// @version $Id: MFXEditableTable.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: MFXEditableTable.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // missing_desc /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,10 +32,6 @@ #include #include "MFXEditableTable.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - FXDEFMAP(MFXEditableTable) MFXEditableTableMap[] = { FXMAPFUNC(SEL_LEFTBUTTONPRESS, 0, MFXEditableTable::onLeftBtnPress), FXMAPFUNC(SEL_LEFTBUTTONRELEASE, 0, MFXEditableTable::onLeftBtnRelease), diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXEditableTable.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXEditableTable.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXEditableTable.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXEditableTable.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MFXEditableTable.h /// @author Daniel Krajzewicz /// @date 2004-07-02 -/// @version $Id: MFXEditableTable.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MFXEditableTable.h 22608 2017-01-17 06:28:54Z behrisch $ /// // missing_desc /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXEventQue.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXEventQue.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXEventQue.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXEventQue.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,7 +2,7 @@ /// @file MFXEventQue.cpp /// @author Daniel Krajzewicz /// @date void *ret = *(myEvents.begin()); -/// @version $Id: MFXEventQue.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MFXEventQue.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // missing_desc /****************************************************************************/ @@ -28,10 +28,6 @@ #include #endif -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXEventQue.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXEventQue.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXEventQue.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXEventQue.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MFXEventQue.h /// @author Daniel Krajzewicz /// @date 2004-03-19 -/// @version $Id: MFXEventQue.h 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: MFXEventQue.h 22608 2017-01-17 06:28:54Z behrisch $ /// // missing_desc /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXImageHelper.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXImageHelper.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXImageHelper.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXImageHelper.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MFXImageHelper.cpp /// @author Daniel Krajzewicz /// @date 2005-05-04 -/// @version $Id: MFXImageHelper.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MFXImageHelper.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // missing_desc /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,16 +32,19 @@ #include #include #include +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4244) // do not warn about integer conversions +#endif #include +#ifdef _MSC_VER +#pragma warning(pop) +#endif #include #include "MFXImageHelper.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - void MFXImageHelper::checkSupported(FXString ext) { if (comparecase(ext, "png") == 0) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXImageHelper.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXImageHelper.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXImageHelper.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXImageHelper.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MFXImageHelper.h /// @author Daniel Krajzewicz /// @date 2005-05-04 -/// @version $Id: MFXImageHelper.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MFXImageHelper.h 22608 2017-01-17 06:28:54Z behrisch $ /// // static helpers for loading and saving images in various formats /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXInterThreadEventClient.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXInterThreadEventClient.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXInterThreadEventClient.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXInterThreadEventClient.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MFXInterThreadEventClient.h /// @author Daniel Krajzewicz /// @date 2004-03-19 -/// @version $Id: MFXInterThreadEventClient.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MFXInterThreadEventClient.h 22608 2017-01-17 06:28:54Z behrisch $ /// // missing_desc /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXMenuHeader.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXMenuHeader.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXMenuHeader.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXMenuHeader.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MFXMenuHeader.cpp /// @author Daniel Krajzewicz /// @date 2004-07-02 -/// @version $Id: MFXMenuHeader.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MFXMenuHeader.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// -// missing_desc +// Header for menu commands /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -30,15 +30,8 @@ #include "MFXMenuHeader.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - -MFXMenuHeader::MFXMenuHeader(FXComposite* p, FXFont* fnt, - const FXString& text, - FXIcon* ic, FXObject* tgt, - FXSelector sel, FXuint opts) - : FXMenuCommand(p, text, ic, tgt, sel, opts) { +MFXMenuHeader::MFXMenuHeader(FXComposite* p, FXFont* fnt, const FXString& text, FXIcon* ic, FXObject* tgt, FXSelector sel, FXuint opts) : + FXMenuCommand(p, text, ic, tgt, sel, opts) { setFont(fnt); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXMenuHeader.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXMenuHeader.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXMenuHeader.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXMenuHeader.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MFXMenuHeader.h /// @author Daniel Krajzewicz /// @date 2004-07-02 -/// @version $Id: MFXMenuHeader.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MFXMenuHeader.h 22608 2017-01-17 06:28:54Z behrisch $ /// -// missing_desc +// Header for menu commands /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,8 +34,11 @@ class MFXMenuHeader : public FXMenuCommand { public: + /// @brief constructor MFXMenuHeader(FXComposite* p, FXFont* fnt, const FXString& text, FXIcon* ic = NULL, FXObject* tgt = NULL, FXSelector sel = 0, FXuint opts = 0); + + /// @brief destructor ~MFXMenuHeader(); }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXMutex.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXMutex.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXMutex.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXMutex.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 2007-02-19 -/// @version $Id: MFXMutex.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MFXMutex.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,10 +42,6 @@ #include #endif -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // MFXMutex constructor MFXMutex::MFXMutex() : lock_(0) { #ifndef WIN32 diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXMutex.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXMutex.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXMutex.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXMutex.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2007-02-19 -/// @version $Id: MFXMutex.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MFXMutex.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXUtils.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXUtils.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXUtils.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXUtils.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MFXUtils.cpp /// @author Daniel Krajzewicz /// @date 2006-01-09 -/// @version $Id: MFXUtils.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MFXUtils.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Some helper functions for FOX /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2006-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2006-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,10 +31,6 @@ #include #include "MFXUtils.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXUtils.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXUtils.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/foxtools/MFXUtils.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/foxtools/MFXUtils.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file MFXUtils.h /// @author Daniel Krajzewicz /// @date 2006-01-09 -/// @version $Id: MFXUtils.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MFXUtils.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Some helper functions for FOX /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2006-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2006-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/AbstractPoly.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/AbstractPoly.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/AbstractPoly.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/AbstractPoly.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: AbstractPoly.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: AbstractPoly.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The base class for polygons /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,9 +45,9 @@ AbstractPoly() { } AbstractPoly(const AbstractPoly&) { } virtual ~AbstractPoly() { } - virtual bool around(const Position& p, SUMOReal offset = 0) const = 0; - virtual bool overlapsWith(const AbstractPoly& poly, SUMOReal offset = 0) const = 0; - virtual bool partialWithin(const AbstractPoly& poly, SUMOReal offset = 0) const = 0; + virtual bool around(const Position& p, double offset = 0) const = 0; + virtual bool overlapsWith(const AbstractPoly& poly, double offset = 0) const = 0; + virtual bool partialWithin(const AbstractPoly& poly, double offset = 0) const = 0; virtual bool crosses(const Position& p1, const Position& p2) const = 0; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/bezier.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/bezier.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/bezier.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/bezier.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2003-11-19 -/// @version $Id: bezier.cpp 21154 2016-07-12 14:23:01Z namdre $ +/// @version $Id: bezier.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // missing_desc /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2003-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2003-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -53,15 +53,11 @@ #include #include "PositionVector.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - /* function to calculate the factorial */ -SUMOReal factrl(int n) { +double factrl(int n) { static int ntop = 6; - static SUMOReal a[33] = { + static double a[33] = { 1.0, 1.0, 2.0, 6.0, 24.0, 120.0, 720.0 } ; /* fill in the first few values */ @@ -78,35 +74,35 @@ j1 = ntop++; a[ntop] = a[j1] * ntop; } - return a[n]; /* returns the value n! as a SUMOReal */ + return a[n]; /* returns the value n! as a double */ } /* function to calculate the factorial function for Bernstein basis */ -SUMOReal Ni(int n, int i) { +double Ni(int n, int i) { return factrl(n) / (factrl(i) * factrl(n - i)); } /* function to calculate the Bernstein basis */ -SUMOReal Basis(int n, int i, SUMOReal t) { +double Basis(int n, int i, double t) { /* handle the special cases to avoid domain problem with pow */ - const SUMOReal ti = (i == 0) ? 1.0 : pow(t, i); /* this is t^i */ - const SUMOReal tni = (n == i) ? 1.0 : pow(1 - t, n - i); /* this is (1-t)^(n-i) */ + const double ti = (i == 0) ? 1.0 : pow(t, i); /* this is t^i */ + const double tni = (n == i) ? 1.0 : pow(1 - t, n - i); /* this is (1-t)^(n-i) */ return Ni(n, i) * ti * tni; } /* Bezier curve subroutine */ void -bezier(int npts, SUMOReal b[], int cpts, SUMOReal p[]) { +bezier(int npts, double b[], int cpts, double p[]) { int i; int j; int i1; int icount; int jcount; - const SUMOReal step = (SUMOReal) 1.0 / (cpts - 1); - SUMOReal t; + const double step = (double) 1.0 / (cpts - 1); + double t; /* calculate the points on the Bezier curve */ @@ -137,20 +133,20 @@ PositionVector bezier(const PositionVector& init, int numPoints) { PositionVector ret; - SUMOReal* def = new SUMOReal[1 + (int)init.size() * 3]; + double* def = new double[1 + (int)init.size() * 3]; for (int i = 0; i < (int)init.size(); ++i) { // starts at index 1 def[i * 3 + 1] = init[i].x(); - def[i * 3 + 2] = 0; + def[i * 3 + 2] = init[i].z(); def[i * 3 + 3] = init[i].y(); } - SUMOReal* ret_buf = new SUMOReal[numPoints * 3 + 1]; + double* ret_buf = new double[numPoints * 3 + 1]; bezier((int)init.size(), def, numPoints, ret_buf); delete[] def; Position prev; for (int i = 0; i < (int)numPoints; i++) { - Position current(ret_buf[i * 3 + 1], ret_buf[i * 3 + 3], init[0].z()); - if (prev != current && !ISNAN(current.x()) && !ISNAN(current.y())) { + Position current(ret_buf[i * 3 + 1], ret_buf[i * 3 + 3], ret_buf[i * 3 + 2]); + if (prev != current && !ISNAN(current.x()) && !ISNAN(current.y()) && !ISNAN(current.z())) { ret.push_back(current); } prev = current; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/bezier.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/bezier.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/bezier.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/bezier.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2003-11-19 -/// @version $Id: bezier.h 21154 2016-07-12 14:23:01Z namdre $ +/// @version $Id: bezier.h 23150 2017-02-27 12:08:30Z behrisch $ /// // missing_desc /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2003-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2003-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,7 +35,7 @@ /* Bezier curve subroutine */ void -bezier(int npts, SUMOReal b[], int cpts, SUMOReal p[]); +bezier(int npts, double b[], int cpts, double p[]); PositionVector diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/Boundary.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/Boundary.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/Boundary.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/Boundary.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: Boundary.cpp 21489 2016-09-16 11:46:32Z namdre $ +/// @version $Id: Boundary.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A class that stores the 2D geometrical boundary /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,10 +36,6 @@ #include "PositionVector.h" #include "Position.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -51,7 +47,7 @@ myWasInitialised(false) {} -Boundary::Boundary(SUMOReal x1, SUMOReal y1, SUMOReal x2, SUMOReal y2) +Boundary::Boundary(double x1, double y1, double x2, double y2) : myXmin(10000000000.0), myXmax(-10000000000.0), myYmin(10000000000.0), myYmax(-10000000000.0), myZmin(10000000000.0), myZmax(-10000000000.0), @@ -61,7 +57,7 @@ } -Boundary::Boundary(SUMOReal x1, SUMOReal y1, SUMOReal z1, SUMOReal x2, SUMOReal y2, SUMOReal z2) +Boundary::Boundary(double x1, double y1, double z1, double x2, double y2, double z2) : myXmin(10000000000.0), myXmax(-10000000000.0), myYmin(10000000000.0), myYmax(-10000000000.0), myZmin(10000000000.0), myZmax(-10000000000.0), @@ -87,7 +83,7 @@ void -Boundary::add(SUMOReal x, SUMOReal y, SUMOReal z) { +Boundary::add(double x, double y, double z) { if (!myWasInitialised) { myYmin = y; myYmax = y; @@ -122,60 +118,66 @@ Position Boundary::getCenter() const { - return Position((myXmin + myXmax) / (SUMOReal) 2.0, (myYmin + myYmax) / (SUMOReal) 2.0, (myZmin + myZmax) / (SUMOReal) 2.0); + return Position((myXmin + myXmax) / (double) 2.0, (myYmin + myYmax) / (double) 2.0, (myZmin + myZmax) / (double) 2.0); } -SUMOReal +double Boundary::xmin() const { return myXmin; } -SUMOReal +double Boundary::xmax() const { return myXmax; } -SUMOReal +double Boundary::ymin() const { return myYmin; } -SUMOReal +double Boundary::ymax() const { return myYmax; } -SUMOReal +double Boundary::zmin() const { return myZmin; } -SUMOReal +double Boundary::zmax() const { return myZmax; } -SUMOReal +double Boundary::getWidth() const { return myXmax - myXmin; } -SUMOReal +double Boundary::getHeight() const { return myYmax - myYmin; } +double +Boundary::getZRange() const { + return myZmax - myZmin; +} + + bool -Boundary::around(const Position& p, SUMOReal offset) const { +Boundary::around(const Position& p, double offset) const { return (p.x() <= myXmax + offset && p.x() >= myXmin - offset) && (p.y() <= myYmax + offset && p.y() >= myYmin - offset) && @@ -184,7 +186,7 @@ bool -Boundary::overlapsWith(const AbstractPoly& p, SUMOReal offset) const { +Boundary::overlapsWith(const AbstractPoly& p, double offset) const { if ( // check whether one of my points lies within the given poly partialWithin(p, offset) || @@ -219,7 +221,7 @@ bool -Boundary::partialWithin(const AbstractPoly& poly, SUMOReal offset) const { +Boundary::partialWithin(const AbstractPoly& poly, double offset) const { return poly.around(Position(myXmax, myYmax), offset) || poly.around(Position(myXmin, myYmax), offset) || @@ -229,7 +231,7 @@ Boundary& -Boundary::grow(SUMOReal by) { +Boundary::grow(double by) { myXmax += by; myYmax += by; myXmin -= by; @@ -238,14 +240,14 @@ } void -Boundary::growWidth(SUMOReal by) { +Boundary::growWidth(double by) { myXmin -= by; myXmax += by; } void -Boundary::growHeight(SUMOReal by) { +Boundary::growHeight(double by) { myYmin -= by; myYmax += by; } @@ -254,7 +256,7 @@ Boundary::flipY() { myYmin *= -1.0; myYmax *= -1.0; - SUMOReal tmp = myYmin; + double tmp = myYmin; myYmin = myYmax; myYmax = tmp; } @@ -269,7 +271,7 @@ void -Boundary::set(SUMOReal xmin, SUMOReal ymin, SUMOReal xmax, SUMOReal ymax) { +Boundary::set(double xmin, double ymin, double xmax, double ymax) { myXmin = xmin; myYmin = ymin; myXmax = xmax; @@ -278,7 +280,7 @@ void -Boundary::moveby(SUMOReal x, SUMOReal y, SUMOReal z) { +Boundary::moveby(double x, double y, double z) { myXmin += x; myYmin += y; myZmin += z; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/Boundary.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/Boundary.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/Boundary.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/Boundary.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: Boundary.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: Boundary.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A class that stores a 2D geometrical boundary /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -52,9 +52,9 @@ Boundary(); /// Constructor - the boundary will be build using the given values - Boundary(SUMOReal x1, SUMOReal y1, SUMOReal x2, SUMOReal y2); + Boundary(double x1, double y1, double x2, double y2); - Boundary(SUMOReal x1, SUMOReal y1, SUMOReal z1, SUMOReal x2, SUMOReal y2, SUMOReal z2); + Boundary(double x1, double y1, double z1, double x2, double y2, double z2); /// Destructor ~Boundary(); @@ -63,7 +63,7 @@ void reset(); /// Makes the boundary include the given coordinate - void add(SUMOReal x, SUMOReal y, SUMOReal z = 0); + void add(double x, double y, double z = 0); /// Makes the boundary include the given coordinate void add(const Position& p); @@ -75,37 +75,40 @@ Position getCenter() const; /// Returns minimum x-coordinate - SUMOReal xmin() const; + double xmin() const; /// Returns maximum x-coordinate - SUMOReal xmax() const; + double xmax() const; /// Returns minimum y-coordinate - SUMOReal ymin() const; + double ymin() const; /// Returns maximum y-coordinate - SUMOReal ymax() const; + double ymax() const; /// Returns minimum z-coordinate - SUMOReal zmin() const; + double zmin() const; /// Returns maximum z-coordinate - SUMOReal zmax() const; + double zmax() const; /// Returns the width of the boudary (x-axis) - SUMOReal getWidth() const; + double getWidth() const; /// Returns the height of the boundary (y-axis) - SUMOReal getHeight() const; + double getHeight() const; + + /// Returns the elevation range of the boundary (z-axis) + double getZRange() const; /// Returns whether the boundary contains the given coordinate - bool around(const Position& p, SUMOReal offset = 0) const; + bool around(const Position& p, double offset = 0) const; /// Returns whether the boundary overlaps with the given polygon - bool overlapsWith(const AbstractPoly& poly, SUMOReal offset = 0) const; + bool overlapsWith(const AbstractPoly& poly, double offset = 0) const; /// Returns whether the boundary is partially within the given polygon - bool partialWithin(const AbstractPoly& poly, SUMOReal offset = 0) const; + bool partialWithin(const AbstractPoly& poly, double offset = 0) const; /// Returns whether the boundary crosses the given line bool crosses(const Position& p1, const Position& p2) const; @@ -114,29 +117,29 @@ /** @brief extends the boundary by the given amount * * The method returns a reference to the instance for further use */ - Boundary& grow(SUMOReal by); + Boundary& grow(double by); /// Increases the width of the boundary (x-axis) - void growWidth(SUMOReal by); + void growWidth(double by); /// Increases the height of the boundary (y-axis) - void growHeight(SUMOReal by); + void growHeight(double by); /// flips ymin and ymax void flipY(); /// Sets the boundary to the given values - void set(SUMOReal xmin, SUMOReal ymin, SUMOReal xmax, SUMOReal ymax); + void set(double xmin, double ymin, double xmax, double ymax); /// Moves the boundary by the given amount - void moveby(SUMOReal x, SUMOReal y, SUMOReal z = 0); + void moveby(double x, double y, double z = 0); /// Output operator friend std::ostream& operator<<(std::ostream& os, const Boundary& b); private: /// The boundaries - SUMOReal myXmin, myXmax, myYmin, myYmax, myZmin, myZmax; + double myXmin, myXmax, myYmin, myYmax, myZmin, myZmax; /// Information whether the boundary was initialised bool myWasInitialised; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/Bresenham.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/Bresenham.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/Bresenham.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/Bresenham.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Fri, 07 Jun 2002 -/// @version $Id: Bresenham.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: Bresenham.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A class to realise a uniform n:m - relationship using the /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,10 +33,6 @@ #include #include "Bresenham.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/Bresenham.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/Bresenham.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/Bresenham.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/Bresenham.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 17 Dec 2001 -/// @version $Id: Bresenham.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: Bresenham.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A class to realise a uniform n:m - relationship using the /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/GeoConvHelper.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/GeoConvHelper.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/GeoConvHelper.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/GeoConvHelper.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 2006-08-01 -/// @version $Id: GeoConvHelper.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GeoConvHelper.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // static methods for processing the coordinates conversion for the current net /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,10 +41,6 @@ #include #include "GeoConvHelper.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member variables @@ -251,7 +247,7 @@ //!!! check pj_errno p.u *= RAD_TO_DEG; p.v *= RAD_TO_DEG; - cartesian.set((SUMOReal) p.u, (SUMOReal) p.v); + cartesian.set((double) p.u, (double) p.v); #endif } @@ -311,7 +307,7 @@ if (pj_transform(myInverseProjection, myGeoProjection, 1, 1, &x, &y, NULL)) { WRITE_WARNING("Could not transform (" + toString(x) + "," + toString(y) + ")"); } - from.set(SUMOReal(x * RAD_TO_DEG), SUMOReal(y * RAD_TO_DEG)); + from.set(double(x * RAD_TO_DEG), double(y * RAD_TO_DEG)); } #endif // perform conversion @@ -357,7 +353,7 @@ double ys = y; x *= 111320. * cos(DEG2RAD(ys)); y *= 111136.; - from.set((SUMOReal)x, (SUMOReal)y); + from.set((double)x, (double)y); //!!! recheck whether the axes are mirrored from.add(myOffset); } @@ -367,7 +363,7 @@ return false; } if (myProjectionMethod != SIMPLE) { - from.set((SUMOReal)x, (SUMOReal)y); + from.set((double)x, (double)y); from.add(myOffset); } return true; @@ -375,7 +371,7 @@ void -GeoConvHelper::moveConvertedBy(SUMOReal x, SUMOReal y) { +GeoConvHelper::moveConvertedBy(double x, double y) { myOffset.add(x, y); myConvBoundary.moveby(x, y); } @@ -455,7 +451,7 @@ into.writeAttr(SUMO_ATTR_NET_OFFSET, myFinal.getOffsetBase()); into.writeAttr(SUMO_ATTR_CONV_BOUNDARY, myFinal.getConvBoundary()); if (myFinal.usingGeoProjection()) { - into.setPrecision(GEO_OUTPUT_ACCURACY); + into.setPrecision(gPrecisionGeo); } into.writeAttr(SUMO_ATTR_ORIG_BOUNDARY, myFinal.getOrigBoundary()); if (myFinal.usingGeoProjection()) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/GeoConvHelper.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/GeoConvHelper.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/GeoConvHelper.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/GeoConvHelper.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 2006-08-01 -/// @version $Id: GeoConvHelper.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GeoConvHelper.h 23150 2017-02-27 12:08:30Z behrisch $ /// // static methods for processing the coordinates conversion for the current net /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -147,7 +147,7 @@ bool usingInverseGeoProjection() const; /// Shifts the converted boundary by the given amounts - void moveConvertedBy(SUMOReal x, SUMOReal y); + void moveConvertedBy(double x, double y); /// Returns the original boundary const Boundary& getOrigBoundary() const; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/GeomConvHelper.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/GeomConvHelper.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/GeomConvHelper.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/GeomConvHelper.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2003 -/// @version $Id: GeomConvHelper.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GeomConvHelper.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Some helping functions for geometry parsing /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,10 +38,6 @@ #include #include "GeomConvHelper.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -66,12 +62,12 @@ return PositionVector(); } try { - SUMOReal x = TplConvert::_2SUMOReal(pos.next().c_str()); - SUMOReal y = TplConvert::_2SUMOReal(pos.next().c_str()); + double x = TplConvert::_2double(pos.next().c_str()); + double y = TplConvert::_2double(pos.next().c_str()); if (pos.size() == 2) { shape.push_back(Position(x, y)); } else { - SUMOReal z = TplConvert::_2SUMOReal(pos.next().c_str()); + double z = TplConvert::_2double(pos.next().c_str()); shape.push_back(Position(x, y, z)); } } catch (NumberFormatException&) { @@ -98,10 +94,10 @@ return Boundary(); } try { - SUMOReal xmin = TplConvert::_2SUMOReal(st.next().c_str()); - SUMOReal ymin = TplConvert::_2SUMOReal(st.next().c_str()); - SUMOReal xmax = TplConvert::_2SUMOReal(st.next().c_str()); - SUMOReal ymax = TplConvert::_2SUMOReal(st.next().c_str()); + double xmin = TplConvert::_2double(st.next().c_str()); + double ymin = TplConvert::_2double(st.next().c_str()); + double xmax = TplConvert::_2double(st.next().c_str()); + double ymax = TplConvert::_2double(st.next().c_str()); return Boundary(xmin, ymin, xmax, ymax); } catch (NumberFormatException&) { emitError(report, "Shape", objecttype, objectid, "not numeric entry"); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/GeomConvHelper.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/GeomConvHelper.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/GeomConvHelper.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/GeomConvHelper.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2003 -/// @version $Id: GeomConvHelper.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GeomConvHelper.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Some helping functions for geometry parsing /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,7 +48,7 @@ public: /** @brief Builds a PositionVector from a string representation, reporting occured errors * - * It is assumed, the vector is stored as "x,y[ x,y]*" where x and y are SUMOReals. + * It is assumed, the vector is stored as "x,y[ x,y]*" where x and y are doubles. * @param[in] shpdef The shape definition to parse * @param[in] objecttype The name of the parsed object type; used for error message generation * @param[in] objectid The name of the parsed object; used for error message generation @@ -63,7 +63,7 @@ /** @brief Builds a boundary from its string representation, reporting occured errors * - * It is assumed that the boundary is stored as a quadruple of SUMOReal, divided by ','. + * It is assumed that the boundary is stored as a quadruple of double, divided by ','. * @param[in] def The boundary definition to parse * @param[in] objecttype The name of the parsed object type; used for error message generation * @param[in] objectid The name of the parsed object; used for error message generation diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/GeomHelper.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/GeomHelper.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/GeomHelper.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/GeomHelper.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GeomHelper.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GeomHelper.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Some static methods performing geometrical operations /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,14 +40,10 @@ #include "Boundary.h" #include "GeomHelper.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members // =========================================================================== -const SUMOReal GeomHelper::INVALID_OFFSET = -1; +const double GeomHelper::INVALID_OFFSET = -1; // =========================================================================== @@ -55,34 +51,34 @@ // =========================================================================== void -GeomHelper::findLineCircleIntersections(const Position& c, SUMOReal radius, const Position& p1, const Position& p2, - std::vector& into) { - const SUMOReal dx = p2.x() - p1.x(); - const SUMOReal dy = p2.y() - p1.y(); - - const SUMOReal A = dx * dx + dy * dy; - const SUMOReal B = 2 * (dx * (p1.x() - c.x()) + dy * (p1.y() - c.y())); - const SUMOReal C = (p1.x() - c.x()) * (p1.x() - c.x()) + (p1.y() - c.y()) * (p1.y() - c.y()) - radius * radius; +GeomHelper::findLineCircleIntersections(const Position& c, double radius, const Position& p1, const Position& p2, + std::vector& into) { + const double dx = p2.x() - p1.x(); + const double dy = p2.y() - p1.y(); + + const double A = dx * dx + dy * dy; + const double B = 2 * (dx * (p1.x() - c.x()) + dy * (p1.y() - c.y())); + const double C = (p1.x() - c.x()) * (p1.x() - c.x()) + (p1.y() - c.y()) * (p1.y() - c.y()) - radius * radius; - const SUMOReal det = B * B - 4 * A * C; + const double det = B * B - 4 * A * C; if ((A <= 0.0000001) || (det < 0)) { // No real solutions. return; } if (det == 0) { // One solution. - const SUMOReal t = -B / (2 * A); + const double t = -B / (2 * A); if (t >= 0. && t <= 1.) { into.push_back(t); } } else { // Two solutions. - const SUMOReal t = (SUMOReal)((-B + sqrt(det)) / (2 * A)); + const double t = (double)((-B + sqrt(det)) / (2 * A)); Position intersection(p1.x() + t * dx, p1.y() + t * dy); if (t >= 0. && t <= 1.) { into.push_back(t); } - const SUMOReal t2 = (SUMOReal)((-B - sqrt(det)) / (2 * A)); + const double t2 = (double)((-B - sqrt(det)) / (2 * A)); if (t2 >= 0. && t2 <= 1.) { into.push_back(t2); } @@ -90,25 +86,25 @@ } -SUMOReal +double GeomHelper::angle2D(const Position& p1, const Position& p2) { return angleDiff(atan2(p1.y(), p1.x()), atan2(p2.y(), p2.x())); } -SUMOReal +double GeomHelper::nearest_offset_on_line_to_point2D(const Position& lineStart, const Position& lineEnd, const Position& p, bool perpendicular) { - const SUMOReal lineLength2D = lineStart.distanceTo2D(lineEnd); + const double lineLength2D = lineStart.distanceTo2D(lineEnd); if (lineLength2D == 0.0f) { return 0.0f; } else { // scalar product equals length of orthogonal projection times length of vector being projected onto // dividing the scalar product by the square of the distance gives the relative position - const SUMOReal u = (((p.x() - lineStart.x()) * (lineEnd.x() - lineStart.x())) + - ((p.y() - lineStart.y()) * (lineEnd.y() - lineStart.y())) - ) / (lineLength2D * lineLength2D); + const double u = (((p.x() - lineStart.x()) * (lineEnd.x() - lineStart.x())) + + ((p.y() - lineStart.y()) * (lineEnd.y() - lineStart.y())) + ) / (lineLength2D * lineLength2D); if (u < 0.0f || u > 1.0f) { // closest point does not fall within the line segment if (perpendicular) { return INVALID_OFFSET; @@ -148,9 +144,9 @@ throw 1; } -SUMOReal -GeomHelper::getCCWAngleDiff(SUMOReal angle1, SUMOReal angle2) { - SUMOReal v = angle2 - angle1; +double +GeomHelper::getCCWAngleDiff(double angle1, double angle2) { + double v = angle2 - angle1; if (v < 0) { v = 360 + v; } @@ -158,9 +154,9 @@ } -SUMOReal -GeomHelper::getCWAngleDiff(SUMOReal angle1, SUMOReal angle2) { - SUMOReal v = angle1 - angle2; +double +GeomHelper::getCWAngleDiff(double angle1, double angle2) { + double v = angle1 - angle2; if (v < 0) { v = 360 + v; } @@ -168,28 +164,28 @@ } -SUMOReal -GeomHelper::getMinAngleDiff(SUMOReal angle1, SUMOReal angle2) { +double +GeomHelper::getMinAngleDiff(double angle1, double angle2) { return MIN2(getCWAngleDiff(angle1, angle2), getCCWAngleDiff(angle1, angle2)); } -SUMOReal -GeomHelper::angleDiff(const SUMOReal angle1, const SUMOReal angle2) { - SUMOReal dtheta = angle2 - angle1; - while (dtheta > (SUMOReal) M_PI) { - dtheta -= (SUMOReal)(2.0 * M_PI); +double +GeomHelper::angleDiff(const double angle1, const double angle2) { + double dtheta = angle2 - angle1; + while (dtheta > (double) M_PI) { + dtheta -= (double)(2.0 * M_PI); } - while (dtheta < (SUMOReal) - M_PI) { - dtheta += (SUMOReal)(2.0 * M_PI); + while (dtheta < (double) - M_PI) { + dtheta += (double)(2.0 * M_PI); } return dtheta; } -SUMOReal -GeomHelper::naviDegree(const SUMOReal angle) { - SUMOReal degree = RAD2DEG(M_PI / 2. - angle); +double +GeomHelper::naviDegree(const double angle) { + double degree = RAD2DEG(M_PI / 2. - angle); while (degree >= 360.) { degree -= 360.; } @@ -200,9 +196,9 @@ } -SUMOReal -GeomHelper::legacyDegree(const SUMOReal angle, const bool positive) { - SUMOReal degree = -RAD2DEG(M_PI / 2. + angle); +double +GeomHelper::legacyDegree(const double angle, const bool positive) { + double degree = -RAD2DEG(M_PI / 2. + angle); if (positive) { while (degree >= 360.) { degree -= 360.; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/GeomHelper.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/GeomHelper.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/GeomHelper.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/GeomHelper.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GeomHelper.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GeomHelper.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Some static methods performing geometrical operations /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,8 +42,8 @@ #define M_PI 3.1415926535897932384626433832795 #endif -#define DEG2RAD(x) static_cast((x) * M_PI / 180.) -#define RAD2DEG(x) static_cast((x) * 180. / M_PI) +#define DEG2RAD(x) static_cast((x) * M_PI / 180.) +#define RAD2DEG(x) static_cast((x) * 180. / M_PI) // =========================================================================== @@ -56,7 +56,7 @@ public: /// @brief a value to signify offsets outside the range of [0, Line.length()] - static const SUMOReal INVALID_OFFSET; + static const double INVALID_OFFSET; /** @brief Returns the positions the given circle is crossed by the given line * @param[in] c The center position of the circle @@ -67,17 +67,17 @@ * @see http://blog.csharphelper.com/2010/03/28/determine-where-a-line-intersects-a-circle-in-c.aspx * @see http://gamedev.stackexchange.com/questions/18333/circle-line-collision-detection-problem (jazzdawg) */ - static void findLineCircleIntersections(const Position& c, SUMOReal radius, const Position& p1, const Position& p2, - std::vector& into); + static void findLineCircleIntersections(const Position& c, double radius, const Position& p1, const Position& p2, + std::vector& into); /** @brief Returns the angle between two vectors on a plane The angle is from vector 1 to vector 2, positive anticlockwise The result is between -pi and pi */ - static SUMOReal angle2D(const Position& p1, const Position& p2); + static double angle2D(const Position& p1, const Position& p2); - static SUMOReal nearest_offset_on_line_to_point2D( + static double nearest_offset_on_line_to_point2D( const Position& lineStart, const Position& lineEnd, const Position& p, bool perpendicular = true); @@ -89,7 +89,7 @@ * @param[in] angle2 The second angle * @return Angle (counter-clockwise) starting from first to second angle */ - static SUMOReal getCCWAngleDiff(SUMOReal angle1, SUMOReal angle2); + static double getCCWAngleDiff(double angle1, double angle2); /** @brief Returns the distance of second angle from first angle clockwise @@ -97,7 +97,7 @@ * @param[in] angle2 The second angle * @return Angle (clockwise) starting from first to second angle */ - static SUMOReal getCWAngleDiff(SUMOReal angle1, SUMOReal angle2); + static double getCWAngleDiff(double angle1, double angle2); /** @brief Returns the minimum distance (clockwise/counter-clockwise) between both angles @@ -105,7 +105,7 @@ * @param[in] angle2 The second angle * @return The minimum distance between both angles */ - static SUMOReal getMinAngleDiff(SUMOReal angle1, SUMOReal angle2); + static double getMinAngleDiff(double angle1, double angle2); /** @brief Returns the difference of the second angle to the first angle in radiants @@ -117,7 +117,7 @@ * @param[in] angle2 The second angle * @return angle starting from first to second angle */ - static SUMOReal angleDiff(const SUMOReal angle1, const SUMOReal angle2); + static double angleDiff(const double angle1, const double angle2); /** Converts an angle from mathematical radians where 0 is to the right and positive angles @@ -126,7 +126,7 @@ * @param[in] angle The angle in radians to convert * @return the angle in degrees */ - static SUMOReal naviDegree(const SUMOReal angle); + static double naviDegree(const double angle); /** Converts an angle from mathematical radians where 0 is to the right and positive angles * are counterclockwise to the legacy degrees used in sumo where 0 is down and positive means clockwise. @@ -134,7 +134,7 @@ * @param[in] angle The angle in radians to convert * @return the angle in degrees */ - static SUMOReal legacyDegree(const SUMOReal angle, const bool positive = false); + static double legacyDegree(const double angle, const bool positive = false); }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/Helper_ConvexHull.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/Helper_ConvexHull.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/Helper_ConvexHull.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/Helper_ConvexHull.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,7 +3,7 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004-11-23 -/// @version $Id: Helper_ConvexHull.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: Helper_ConvexHull.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Copyright 2002, softSurfer (www.softsurfer.com) // This code may be freely used and modified for any purpose @@ -13,7 +13,7 @@ // Users of this code must verify correctness for their application. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,13 +40,9 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // Assume that a class is already given for the object: -// Position with coordinates {SUMOReal x, y;} +// Position with coordinates {double x, y;} PositionVector simpleHull_2D(const PositionVector& V) { if (V.size() < 3) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/Helper_ConvexHull.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/Helper_ConvexHull.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/Helper_ConvexHull.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/Helper_ConvexHull.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Fri, 29.04.2005 -/// @version $Id: Helper_ConvexHull.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: Helper_ConvexHull.h 23150 2017-02-27 12:08:30Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,7 +46,7 @@ // Assume that a class is already given for the object: -// Position with coordinates {SUMOReal x, y;} +// Position with coordinates {double x, y;} //=================================================================== @@ -58,7 +58,7 @@ // See: the January 2001 Algorithm on Area of Triangles -inline SUMOReal +inline double isLeft(const Position& P0, const Position& P1, const Position& P2) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/Position.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/Position.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/Position.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/Position.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Axel Wegener /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: Position.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: Position.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A position in the 2D- or 3D-world /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,10 +33,6 @@ #include #include "Position.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/Position.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/Position.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/Position.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/Position.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Axel Wegener /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: Position.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: Position.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A position in the 2D- or 3D-world /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,158 +45,177 @@ */ class Position { public: - /// default constructor + /// @brief default constructor Position() : myX(0.0), myY(0.0), myZ(0.0) { } - /// parametrised constructor - Position(SUMOReal x, SUMOReal y) + /// @brief parametrised constructor + Position(double x, double y) : myX(x), myY(y), myZ(0) { } - /// parametrised constructor - Position(SUMOReal x, SUMOReal y, SUMOReal z) + /// @brief parametrised constructor + Position(double x, double y, double z) : myX(x), myY(y), myZ(z) { } - /// Destructor + /// @brief Destructor ~Position() { } - /// Returns the x-position - SUMOReal x() const { + /// @brief Returns the x-position + double x() const { return myX; } - /// Returns the y-position - SUMOReal y() const { + /// @brief Returns the y-position + double y() const { return myY; } - /// Returns the z-position - SUMOReal z() const { + /// @brief Returns the z-position + double z() const { return myZ; } - /// - void set(SUMOReal x, SUMOReal y) { + /// @brief set position x + void setx(double x) { + myX = x; + } + + /// @brief set position y + void sety(double y) { + myY = y; + } + + /// @brief set position z + void setz(double z) { + myZ = z; + } + + /// @brief set positions x and y + void set(double x, double y) { myX = x; myY = y; } - /// - void set(SUMOReal x, SUMOReal y, SUMOReal z) { + /// @brief set positions x, y and z + void set(double x, double y, double z) { myX = x; myY = y; myZ = z; } - /// + /// @brief set position with another position void set(const Position& pos) { myX = pos.myX; myY = pos.myY; myZ = pos.myZ; } - - /// Multiplies both positions with the given value - void mul(SUMOReal val) { + /// @brief Multiplies both positions with the given value + void mul(double val) { myX *= val; myY *= val; myZ *= val; } - /// Multiplies position with the given values - void mul(SUMOReal mx, SUMOReal my) { + /// @brief Multiplies position with the given values + void mul(double mx, double my) { myX *= mx; myY *= my; } - /// Multiplies position with the given values - void mul(SUMOReal mx, SUMOReal my, SUMOReal mz) { + /// @brief Multiplies position with the given values + void mul(double mx, double my, double mz) { myX *= mx; myY *= my; myZ *= mz; } - /// Adds the given position to this one + /// @brief Adds the given position to this one void add(const Position& pos) { myX += pos.myX; myY += pos.myY; myZ += pos.myZ; } - /// Adds the given position to this one - void add(SUMOReal dx, SUMOReal dy) { + /// @brief Adds the given position to this one + void add(double dx, double dy) { myX += dx; myY += dy; } - /// Adds the given position to this one - void add(SUMOReal dx, SUMOReal dy, SUMOReal dz) { + /// @brief Adds the given position to this one + void add(double dx, double dy, double dz) { myX += dx; myY += dy; myZ += dz; } - /// Substracts the given position from this one - void sub(SUMOReal dx, SUMOReal dy) { + /// @brief Substracts the given position from this one + void sub(double dx, double dy) { myX -= dx; myY -= dy; } - /// Substracts the given position from this one - void sub(SUMOReal dx, SUMOReal dy, SUMOReal dz) { + /// @brief Substracts the given position from this one + void sub(double dx, double dy, double dz) { myX -= dx; myY -= dy; myZ -= dz; } - /// Substracts the given position from this one + /// @brief Substracts the given position from this one void sub(const Position& pos) { myX -= pos.myX; myY -= pos.myY; myZ -= pos.myZ; } + /// @brief void norm2d() { - SUMOReal val = sqrt(myX * myX + myY * myY); + double val = sqrt(myX * myX + myY * myY); myX = myX / val; myY = myY / val; } - /// Prints to the output + /// @brief output operator friend std::ostream& operator<<(std::ostream& os, const Position& p) { os << p.x() << "," << p.y(); - if (p.z() != SUMOReal(0.0)) { + if (p.z() != double(0.0)) { os << "," << p.z(); } return os; } + /// @brief add operator Position operator+(const Position& p2) const { return Position(myX + p2.myX, myY + p2.myY, myZ + p2.myZ); } + /// @brief sub operator Position operator-(const Position& p2) const { return Position(myX - p2.myX, myY - p2.myY, myZ - p2.myZ); } /// @brief keep the direction but modify the length of the (location) vector to length * scalar - Position operator*(SUMOReal scalar) const { + Position operator*(double scalar) const { return Position(myX * scalar, myY * scalar, myZ * scalar); } /// @brief keep the direction but modify the length of the (location) vector to length + scalar - Position operator+(SUMOReal offset) const { - const SUMOReal length = distanceTo(Position(0, 0, 0)); + Position operator+(double offset) const { + const double length = distanceTo(Position(0, 0, 0)); if (length == 0) { return *this; } - const SUMOReal scalar = (length + offset) / length; + const double scalar = (length + offset) / length; return Position(myX * scalar, myY * scalar, myZ * scalar); } + /// @brief comparation operator bool operator==(const Position& p2) const { return myX == p2.myX && myY == p2.myY && myZ == p2.myZ; } + /// @brief difference operator bool operator!=(const Position& p2) const { return myX != p2.myX || myY != p2.myY || myZ != p2.myZ; } @@ -212,39 +231,36 @@ } } - bool almostSame(const Position& p2, SUMOReal maxDiv = POSITION_EPS) const { + /// @brief checki if two position is almost the sme as other + bool almostSame(const Position& p2, double maxDiv = POSITION_EPS) const { return distanceTo(p2) < maxDiv; } - /// @brief returns the euclidean distance in 3 dimension - inline SUMOReal distanceTo(const Position& p2) const { + inline double distanceTo(const Position& p2) const { return sqrt(distanceSquaredTo(p2)); } - - inline SUMOReal distanceSquaredTo(const Position& p2) const { + /// @brief returns the square of the distance to another position + inline double distanceSquaredTo(const Position& p2) const { return (myX - p2.myX) * (myX - p2.myX) + (myY - p2.myY) * (myY - p2.myY) + (myZ - p2.myZ) * (myZ - p2.myZ); } - /// @brief returns the euclidean distance in the x-y-plane - inline SUMOReal distanceTo2D(const Position& p2) const { + inline double distanceTo2D(const Position& p2) const { return sqrt(distanceSquaredTo2D(p2)); } - - inline SUMOReal distanceSquaredTo2D(const Position& p2) const { + /// @brief returns the square of the distance to another position (Only using x and y positions) + inline double distanceSquaredTo2D(const Position& p2) const { return (myX - p2.myX) * (myX - p2.myX) + (myY - p2.myY) * (myY - p2.myY); } - /// @brief returns the angle in the plane of the vector pointing from here to the other position - inline SUMOReal angleTo2D(const Position& other) const { + inline double angleTo2D(const Position& other) const { return atan2(other.myY - myY, other.myX - myX); } - /// @brief returns the cross product between this point and the second one Position crossProduct(const Position& pos) { return Position( @@ -254,22 +270,22 @@ } /// @brief returns the dot product (scalar product) between this point and the second one - inline SUMOReal dotProduct(const Position& pos) { + inline double dotProduct(const Position& pos) { return myX * pos.myX + myY * pos.myY + myZ * pos.myZ; } + /// @brief used to indicate that a position is valid static const Position INVALID; private: - /// The x-position - SUMOReal myX; - - /// The y-position - SUMOReal myY; + /// @brief The x-position + double myX; - /// The z-position - SUMOReal myZ; + /// @brief The y-position + double myY; + /// @brief The z-position + double myZ; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/PositionVector.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/PositionVector.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/PositionVector.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/PositionVector.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Walter Bamberger /// @date Sept 2002 -/// @version $Id: PositionVector.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: PositionVector.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A list of positions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,10 +48,6 @@ #include "Helper_ConvexHull.h" #include "Boundary.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== @@ -79,13 +75,13 @@ bool -PositionVector::around(const Position& p, SUMOReal offset) const { +PositionVector::around(const Position& p, double offset) const { if (offset != 0) { PositionVector tmp(*this); tmp.scaleAbsolute(offset); return tmp.around(p); } - SUMOReal angle = 0; + double angle = 0; for (const_iterator i = begin(); i != end() - 1; i++) { Position p1( (*i).x() - p.x(), @@ -107,7 +103,7 @@ bool -PositionVector::overlapsWith(const AbstractPoly& poly, SUMOReal offset) const { +PositionVector::overlapsWith(const AbstractPoly& poly, double offset) const { for (const_iterator i = begin(); i != end() - 1; i++) { if (poly.around(*i, offset)) { return true; @@ -117,6 +113,31 @@ } +double +PositionVector::getOverlapWith(const PositionVector& poly, double zThreshold) const { + double result = 0; + // this points within poly + for (const_iterator i = begin(); i != end() - 1; i++) { + if (poly.around(*i)) { + Position closest = poly.positionAtOffset2D(poly.nearest_offset_to_point2D(*i)); + if (fabs(closest.z() - (*i).z()) < zThreshold) { + result = MAX2(result, poly.distance2D(*i)); + } + } + } + // polys points within this + for (const_iterator i = poly.begin(); i != poly.end() - 1; i++) { + if (around(*i)) { + Position closest = positionAtOffset2D(nearest_offset_to_point2D(*i)); + if (fabs(closest.z() - (*i).z()) < zThreshold) { + result = MAX2(result, distance2D(*i)); + } + } + } + return result; +} + + bool PositionVector::intersects(const Position& p1, const Position& p2) const { if (size() < 2) { @@ -146,9 +167,9 @@ Position -PositionVector::intersectionPosition2D(const Position& p1, const Position& p2, const SUMOReal withinDist) const { +PositionVector::intersectionPosition2D(const Position& p1, const Position& p2, const double withinDist) const { for (const_iterator i = begin(); i != end() - 1; i++) { - SUMOReal x, y, m; + double x, y, m; if (intersects(*i, *(i + 1), p1, p2, withinDist, &x, &y, &m)) { return Position(x, y); } @@ -189,26 +210,31 @@ Position -PositionVector::positionAtOffset(SUMOReal pos, SUMOReal lateralOffset) const { +PositionVector::positionAtOffset(double pos, double lateralOffset) const { + assert(size() != 0); const_iterator i = begin(); - SUMOReal seenLength = 0; + double seenLength = 0; do { - const SUMOReal nextLength = (*i).distanceTo(*(i + 1)); + const double nextLength = (*i).distanceTo(*(i + 1)); if (seenLength + nextLength > pos) { return positionAtOffset(*i, *(i + 1), pos - seenLength, lateralOffset); } seenLength += nextLength; } while (++i != end() - 1); - return back(); + if (lateralOffset == 0 || size() < 2) { + return back(); + } else { + return positionAtOffset(*(end() - 2), *(end() - 1), (*(end() - 2)).distanceTo(*(end() - 1)), lateralOffset); + } } Position -PositionVector::positionAtOffset2D(SUMOReal pos, SUMOReal lateralOffset) const { +PositionVector::positionAtOffset2D(double pos, double lateralOffset) const { const_iterator i = begin(); - SUMOReal seenLength = 0; + double seenLength = 0; do { - const SUMOReal nextLength = (*i).distanceTo2D(*(i + 1)); + const double nextLength = (*i).distanceTo2D(*(i + 1)); if (seenLength + nextLength > pos) { return positionAtOffset2D(*i, *(i + 1), pos - seenLength, lateralOffset); } @@ -218,17 +244,17 @@ } -SUMOReal -PositionVector::rotationAtOffset(SUMOReal pos) const { +double +PositionVector::rotationAtOffset(double pos) const { if (pos < 0) { pos += length(); } const_iterator i = begin(); - SUMOReal seenLength = 0; + double seenLength = 0; do { const Position& p1 = *i; const Position& p2 = *(i + 1); - const SUMOReal nextLength = p1.distanceTo(p2); + const double nextLength = p1.distanceTo(p2); if (seenLength + nextLength > pos) { return p1.angleTo2D(p2); } @@ -240,20 +266,20 @@ } -SUMOReal -PositionVector::rotationDegreeAtOffset(SUMOReal pos) const { +double +PositionVector::rotationDegreeAtOffset(double pos) const { return GeomHelper::legacyDegree(rotationAtOffset(pos)); } -SUMOReal -PositionVector::slopeDegreeAtOffset(SUMOReal pos) const { +double +PositionVector::slopeDegreeAtOffset(double pos) const { const_iterator i = begin(); - SUMOReal seenLength = 0; + double seenLength = 0; do { const Position& p1 = *i; const Position& p2 = *(i + 1); - const SUMOReal nextLength = p1.distanceTo(p2); + const double nextLength = p1.distanceTo(p2); if (seenLength + nextLength > pos) { return RAD2DEG(atan2(p2.z() - p1.z(), p1.distanceTo2D(p2))); } @@ -266,8 +292,8 @@ Position -PositionVector::positionAtOffset(const Position& p1, const Position& p2, SUMOReal pos, SUMOReal lateralOffset) { - const SUMOReal dist = p1.distanceTo(p2); +PositionVector::positionAtOffset(const Position& p1, const Position& p2, double pos, double lateralOffset) { + const double dist = p1.distanceTo(p2); if (pos < 0 || dist < pos) { return Position::INVALID; } @@ -286,8 +312,8 @@ Position -PositionVector::positionAtOffset2D(const Position& p1, const Position& p2, SUMOReal pos, SUMOReal lateralOffset) { - const SUMOReal dist = p1.distanceTo2D(p2); +PositionVector::positionAtOffset2D(const Position& p1, const Position& p2, double pos, double lateralOffset) { + const double dist = p1.distanceTo2D(p2); if (pos < 0 || dist < pos) { return Position::INVALID; } @@ -317,15 +343,15 @@ Position PositionVector::getPolygonCenter() const { - SUMOReal x = 0; - SUMOReal y = 0; - SUMOReal z = 0; + double x = 0; + double y = 0; + double z = 0; for (const_iterator i = begin(); i != end(); i++) { x += (*i).x(); y += (*i).y(); z += (*i).z(); } - return Position(x / (SUMOReal) size(), y / (SUMOReal) size(), z / (SUMOReal)size()); + return Position(x / (double) size(), y / (double) size(), z / (double)size()); } @@ -336,13 +362,13 @@ tmp.push_back(tmp[0]); } const int endIndex = (int)tmp.size() - 1; - SUMOReal div = 0; // 6 * area including sign - SUMOReal x = 0; - SUMOReal y = 0; + double div = 0; // 6 * area including sign + double x = 0; + double y = 0; if (tmp.area() != 0) { // numerical instability ? // http://en.wikipedia.org/wiki/Polygon for (int i = 0; i < endIndex; i++) { - const SUMOReal z = tmp[i].x() * tmp[i + 1].y() - tmp[i + 1].x() * tmp[i].y(); + const double z = tmp[i].x() * tmp[i + 1].y() - tmp[i + 1].x() * tmp[i].y(); div += z; // area formula x += (tmp[i].x() + tmp[i + 1].x()) * z; y += (tmp[i].y() + tmp[i + 1].y()) * z; @@ -352,9 +378,9 @@ } else { // compute by decomposing into line segments // http://en.wikipedia.org/wiki/Centroid#By_geometric_decomposition - SUMOReal lengthSum = 0; + double lengthSum = 0; for (int i = 0; i < endIndex; i++) { - SUMOReal length = tmp[i].distanceTo(tmp[i + 1]); + double length = tmp[i].distanceTo(tmp[i + 1]); x += (tmp[i].x() + tmp[i + 1].x()) * length / 2; y += (tmp[i].y() + tmp[i + 1].y()) * length / 2; lengthSum += length; @@ -369,7 +395,7 @@ void -PositionVector::scaleRelative(SUMOReal factor) { +PositionVector::scaleRelative(double factor) { Position centroid = getCentroid(); for (int i = 0; i < static_cast(size()); i++) { (*this)[i] = centroid + (((*this)[i] - centroid) * factor); @@ -378,7 +404,7 @@ void -PositionVector::scaleAbsolute(SUMOReal offset) { +PositionVector::scaleAbsolute(double offset) { Position centroid = getCentroid(); for (int i = 0; i < static_cast(size()); i++) { (*this)[i] = centroid + (((*this)[i] - centroid) + offset); @@ -391,13 +417,13 @@ if (size() == 1) { return (*this)[0]; } - return positionAtOffset(SUMOReal((length() / 2.))); + return positionAtOffset(double((length() / 2.))); } -SUMOReal +double PositionVector::length() const { - SUMOReal len = 0; + double len = 0; for (const_iterator i = begin(); i != end() - 1; i++) { len += (*i).distanceTo(*(i + 1)); } @@ -405,9 +431,9 @@ } -SUMOReal +double PositionVector::length2D() const { - SUMOReal len = 0; + double len = 0; for (const_iterator i = begin(); i != end() - 1; i++) { len += (*i).distanceTo2D(*(i + 1)); } @@ -415,12 +441,12 @@ } -SUMOReal +double PositionVector::area() const { if (size() < 3) { return 0; } - SUMOReal area = 0; + double area = 0; PositionVector tmp = *this; if (!isClosed()) { // make sure its closed tmp.push_back(tmp[0]); @@ -438,7 +464,7 @@ bool -PositionVector::partialWithin(const AbstractPoly& poly, SUMOReal offset) const { +PositionVector::partialWithin(const AbstractPoly& poly, double offset) const { for (const_iterator i = begin(); i != end() - 1; i++) { if (poly.around(*i, offset)) { return true; @@ -455,7 +481,7 @@ std::pair -PositionVector::splitAt(SUMOReal where) const { +PositionVector::splitAt(double where) const { if (size() < 2) { throw InvalidArgument("Vector to short for splitting"); } @@ -464,9 +490,9 @@ } PositionVector first, second; first.push_back((*this)[0]); - SUMOReal seen = 0; + double seen = 0; const_iterator it = begin() + 1; - SUMOReal next = first.back().distanceTo(*it); + double next = first.back().distanceTo(*it); // see how many points we can add to first while (where >= seen + next + POSITION_EPS) { seen += next; @@ -514,7 +540,7 @@ void -PositionVector::add(SUMOReal xoff, SUMOReal yoff, SUMOReal zoff) { +PositionVector::add(double xoff, double yoff, double zoff) { for (int i = 0; i < static_cast(size()); i++) { (*this)[i].add(xoff, yoff, zoff); } @@ -563,7 +589,7 @@ } -SUMOReal +double PositionVector::isLeft(const Position& P0, const Position& P1, const Position& P2) const { return (P1.x() - P0.x()) * (P2.y() - P0.y()) - (P2.x() - P0.x()) * (P1.y() - P0.y()); } @@ -578,7 +604,7 @@ void -PositionVector::append(const PositionVector& v, SUMOReal sameThreshold) { +PositionVector::append(const PositionVector& v, double sameThreshold) { if (size() > 0 && v.size() > 0 && back().distanceTo(v[0]) < sameThreshold) { copy(v.begin() + 1, v.end(), back_inserter(*this)); } else { @@ -588,7 +614,7 @@ PositionVector -PositionVector::getSubpart(SUMOReal beginOffset, SUMOReal endOffset) const { +PositionVector::getSubpart(double beginOffset, double endOffset) const { PositionVector ret; Position begPos = front(); if (beginOffset > POSITION_EPS) { @@ -600,7 +626,7 @@ } ret.push_back(begPos); - SUMOReal seen = 0; + double seen = 0; const_iterator i = begin(); // skip previous segments while ((i + 1) != end() @@ -620,12 +646,15 @@ } // append end ret.push_back_noDoublePos(endPos); + if (ret.size() == 1) { + ret.push_back(endPos); + } return ret; } PositionVector -PositionVector::getSubpart2D(SUMOReal beginOffset, SUMOReal endOffset) const { +PositionVector::getSubpart2D(double beginOffset, double endOffset) const { PositionVector ret; Position begPos = front(); if (beginOffset > POSITION_EPS) { @@ -637,7 +666,7 @@ } ret.push_back(begPos); - SUMOReal seen = 0; + double seen = 0; const_iterator i = begin(); // skip previous segments while ((i + 1) != end() @@ -657,6 +686,9 @@ } // append end ret.push_back_noDoublePos(endPos); + if (ret.size() == 1) { + ret.push_back(endPos); + } return ret; } @@ -677,32 +709,32 @@ } -SUMOReal +double PositionVector::beginEndAngle() const { return front().angleTo2D(back()); } -SUMOReal +double PositionVector::nearest_offset_to_point2D(const Position& p, bool perpendicular) const { - SUMOReal minDist = std::numeric_limits::max(); - SUMOReal nearestPos = GeomHelper::INVALID_OFFSET; - SUMOReal seen = 0; + double minDist = std::numeric_limits::max(); + double nearestPos = GeomHelper::INVALID_OFFSET; + double seen = 0; for (const_iterator i = begin(); i != end() - 1; i++) { - const SUMOReal pos = + const double pos = GeomHelper::nearest_offset_on_line_to_point2D(*i, *(i + 1), p, perpendicular); - const SUMOReal dist = pos == GeomHelper::INVALID_OFFSET ? minDist : p.distanceTo2D(positionAtOffset2D(*i, *(i + 1), pos)); + const double dist = pos == GeomHelper::INVALID_OFFSET ? minDist : p.distanceTo2D(positionAtOffset2D(*i, *(i + 1), pos)); if (dist < minDist) { nearestPos = pos + seen; minDist = dist; } if (perpendicular && i != begin() && pos == GeomHelper::INVALID_OFFSET) { // even if perpendicular is set we still need to check the distance to the inner points - const SUMOReal cornerDist = p.distanceTo2D(*i); + const double cornerDist = p.distanceTo2D(*i); if (cornerDist < minDist) { - const SUMOReal pos1 = + const double pos1 = GeomHelper::nearest_offset_on_line_to_point2D(*(i - 1), *i, p, false); - const SUMOReal pos2 = + const double pos2 = GeomHelper::nearest_offset_on_line_to_point2D(*i, *(i + 1), p, false); if (pos1 == (*(i - 1)).distanceTo2D(*i) && pos2 == 0.) { nearestPos = seen; @@ -721,18 +753,18 @@ // @toDo this duplicates most of the code in nearest_offset_to_point2D. It should be refactored if (extend) { PositionVector extended = *this; - const SUMOReal dist = 2 * distance2D(p); + const double dist = 2 * distance2D(p); extended.extrapolate(dist); return extended.transformToVectorCoordinates(p) - Position(dist, 0); } - SUMOReal minDist = std::numeric_limits::max(); - SUMOReal nearestPos = -1; - SUMOReal seen = 0; + double minDist = std::numeric_limits::max(); + double nearestPos = -1; + double seen = 0; int sign = 1; for (const_iterator i = begin(); i != end() - 1; i++) { - const SUMOReal pos = + const double pos = GeomHelper::nearest_offset_on_line_to_point2D(*i, *(i + 1), p, true); - const SUMOReal dist = pos < 0 ? minDist : p.distanceTo2D(positionAtOffset(*i, *(i + 1), pos)); + const double dist = pos < 0 ? minDist : p.distanceTo2D(positionAtOffset(*i, *(i + 1), pos)); if (dist < minDist) { nearestPos = pos + seen; minDist = dist; @@ -740,11 +772,11 @@ } if (i != begin() && pos == GeomHelper::INVALID_OFFSET) { // even if perpendicular is set we still need to check the distance to the inner points - const SUMOReal cornerDist = p.distanceTo2D(*i); + const double cornerDist = p.distanceTo2D(*i); if (cornerDist < minDist) { - const SUMOReal pos1 = + const double pos1 = GeomHelper::nearest_offset_on_line_to_point2D(*(i - 1), *i, p, false); - const SUMOReal pos2 = + const double pos2 = GeomHelper::nearest_offset_on_line_to_point2D(*i, *(i + 1), p, false); if (pos1 == (*(i - 1)).distanceTo2D(*i) && pos2 == 0.) { nearestPos = seen; @@ -766,8 +798,8 @@ int PositionVector::indexOfClosest(const Position& p) const { assert(size() > 0); - SUMOReal minDist = std::numeric_limits::max(); - SUMOReal dist; + double minDist = std::numeric_limits::max(); + double dist; int closest = 0; for (int i = 0; i < (int)size(); i++) { dist = p.distanceTo((*this)[i]); @@ -782,12 +814,12 @@ int PositionVector::insertAtClosest(const Position& p) { - SUMOReal minDist = std::numeric_limits::max(); + double minDist = std::numeric_limits::max(); int insertionIndex = 1; for (int i = 0; i < (int)size() - 1; i++) { - const SUMOReal length = GeomHelper::nearest_offset_on_line_to_point2D((*this)[i], (*this)[i + 1], p, false); + const double length = GeomHelper::nearest_offset_on_line_to_point2D((*this)[i], (*this)[i + 1], p, false); const Position& outIntersection = PositionVector::positionAtOffset2D((*this)[i], (*this)[i + 1], length); - const SUMOReal dist = p.distanceTo2D(outIntersection); + const double dist = p.distanceTo2D(outIntersection); if (dist < minDist) { insertionIndex = i + 1; minDist = dist; @@ -803,10 +835,10 @@ if (size() == 0) { return -1; } - SUMOReal minDist = std::numeric_limits::max(); + double minDist = std::numeric_limits::max(); int removalIndex = 0; for (int i = 0; i < (int)size(); i++) { - const SUMOReal dist = p.distanceTo2D((*this)[i]); + const double dist = p.distanceTo2D((*this)[i]); if (dist < minDist) { removalIndex = i; minDist = dist; @@ -817,25 +849,25 @@ } -std::vector +std::vector PositionVector::intersectsAtLengths2D(const PositionVector& other) const { - std::vector ret; + std::vector ret; for (const_iterator i = other.begin(); i != other.end() - 1; i++) { - std::vector atSegment = intersectsAtLengths2D(*i, *(i + 1)); + std::vector atSegment = intersectsAtLengths2D(*i, *(i + 1)); copy(atSegment.begin(), atSegment.end(), back_inserter(ret)); } return ret; } -std::vector +std::vector PositionVector::intersectsAtLengths2D(const Position& lp1, const Position& lp2) const { - std::vector ret; - SUMOReal pos = 0; + std::vector ret; + double pos = 0; for (const_iterator i = begin(); i != end() - 1; i++) { const Position& p1 = *i; const Position& p2 = *(i + 1); - SUMOReal x, y, m; + double x, y, m; if (intersects(p1, p2, lp1, lp2, 0., &x, &y, &m)) { ret.push_back(Position(x, y).distanceTo2D(p1) + pos); } @@ -846,12 +878,14 @@ void -PositionVector::extrapolate(const SUMOReal val, const bool onlyFirst) { +PositionVector::extrapolate(const double val, const bool onlyFirst, const bool onlyLast) { assert(size() > 1); Position& p1 = (*this)[0]; Position& p2 = (*this)[1]; const Position offset = (p2 - p1) * (val / p1.distanceTo(p2)); - p1.sub(offset); + if (!onlyLast) { + p1.sub(offset); + } if (!onlyFirst) { if (size() == 2) { p2.add(offset); @@ -865,7 +899,7 @@ void -PositionVector::extrapolate2D(const SUMOReal val, const bool onlyFirst) { +PositionVector::extrapolate2D(const double val, const bool onlyFirst) { assert(size() > 1); Position& p1 = (*this)[0]; Position& p2 = (*this)[1]; @@ -894,14 +928,14 @@ Position -PositionVector::sideOffset(const Position& beg, const Position& end, const SUMOReal amount) { - const SUMOReal scale = amount / beg.distanceTo2D(end); +PositionVector::sideOffset(const Position& beg, const Position& end, const double amount) { + const double scale = amount / beg.distanceTo2D(end); return Position((beg.y() - end.y()) * scale, (end.x() - beg.x()) * scale); } void -PositionVector::move2side(SUMOReal amount) { +PositionVector::move2side(double amount) { if (size() < 2) { return; } @@ -924,7 +958,7 @@ const Position& to = (*this)[i + 1]; PositionVector fromMe(from, me); fromMe.extrapolate2D(me.distanceTo2D(to)); - const SUMOReal extrapolateDev = fromMe[1].distanceTo2D(to); + const double extrapolateDev = fromMe[1].distanceTo2D(to); if (fabs(extrapolateDev) < POSITION_EPS) { // parallel case, just shift the middle point shape.push_back(me - sideOffset(from, to, amount)); @@ -938,10 +972,12 @@ Position offsets2 = sideOffset(me, to, amount); PositionVector l1(from - offsets, me - offsets); PositionVector l2(me - offsets2, to - offsets2); - shape.push_back(l1.intersectionPosition2D(l2[0], l2[1], 100)); - if (shape.back() == Position::INVALID) { + Position meNew = l1.intersectionPosition2D(l2[0], l2[1], 100); + if (meNew == Position::INVALID) { throw InvalidArgument("no line intersection"); } + meNew = meNew + Position(0, 0, me.z()); + shape.push_back(meNew); } // copy original z value shape.back().set(shape.back().x(), shape.back().y(), me.z()); @@ -951,7 +987,7 @@ } -SUMOReal +double PositionVector::angleAt2D(int pos) const { assert((int)size() > pos + 1); return (*this)[pos].angleTo2D((*this)[pos + 1]); @@ -967,18 +1003,18 @@ } -std::vector +std::vector PositionVector::distances(const PositionVector& s, bool perpendicular) const { - std::vector ret; + std::vector ret; const_iterator i; for (i = begin(); i != end(); i++) { - const SUMOReal dist = s.distance2D(*i, perpendicular); + const double dist = s.distance2D(*i, perpendicular); if (dist != GeomHelper::INVALID_OFFSET) { ret.push_back(dist); } } for (i = s.begin(); i != s.end(); i++) { - const SUMOReal dist = distance2D(*i, perpendicular); + const double dist = distance2D(*i, perpendicular); if (dist != GeomHelper::INVALID_OFFSET) { ret.push_back(dist); } @@ -987,14 +1023,14 @@ } -SUMOReal +double PositionVector::distance2D(const Position& p, bool perpendicular) const { if (size() == 0) { return std::numeric_limits::max(); } else if (size() == 1) { return front().distanceTo(p); } - const SUMOReal nearestOffset = nearest_offset_to_point2D(p, perpendicular); + const double nearestOffset = nearest_offset_to_point2D(p, perpendicular); if (nearestOffset == GeomHelper::INVALID_OFFSET) { return GeomHelper::INVALID_OFFSET; } else { @@ -1026,7 +1062,7 @@ void -PositionVector::removeDoublePoints(SUMOReal minDist, bool assertLength) { +PositionVector::removeDoublePoints(double minDist, bool assertLength) { if (size() > 1) { iterator last = begin(); for (iterator i = begin() + 1; i != end() && (!assertLength || size() > 2);) { @@ -1071,18 +1107,18 @@ bool -PositionVector::intersects(const Position& p11, const Position& p12, const Position& p21, const Position& p22, const SUMOReal withinDist, SUMOReal* x, SUMOReal* y, SUMOReal* mu) { - const SUMOReal eps = std::numeric_limits::epsilon(); +PositionVector::intersects(const Position& p11, const Position& p12, const Position& p21, const Position& p22, const double withinDist, double* x, double* y, double* mu) { + const double eps = std::numeric_limits::epsilon(); const double denominator = (p22.y() - p21.y()) * (p12.x() - p11.x()) - (p22.x() - p21.x()) * (p12.y() - p11.y()); const double numera = (p22.x() - p21.x()) * (p11.y() - p21.y()) - (p22.y() - p21.y()) * (p11.x() - p21.x()); const double numerb = (p12.x() - p11.x()) * (p11.y() - p21.y()) - (p12.y() - p11.y()) * (p11.x() - p21.x()); /* Are the lines coincident? */ if (fabs(numera) < eps && fabs(numerb) < eps && fabs(denominator) < eps) { - SUMOReal a1; - SUMOReal a2; - SUMOReal a3; - SUMOReal a4; - SUMOReal a = -1e12; + double a1; + double a2; + double a3; + double a4; + double a = -1e12; if (p11.x() != p12.x()) { a1 = p11.x() < p12.x() ? p11.x() : p12.x(); a2 = p11.x() < p12.x() ? p12.x() : p11.x(); @@ -1155,15 +1191,15 @@ void -PositionVector::rotate2D(SUMOReal angle) { - const SUMOReal s = sin(angle); - const SUMOReal c = cos(angle); +PositionVector::rotate2D(double angle) { + const double s = sin(angle); + const double c = cos(angle); for (int i = 0; i < (int)size(); i++) { - const SUMOReal x = (*this)[i].x(); - const SUMOReal y = (*this)[i].y(); - const SUMOReal z = (*this)[i].z(); - const SUMOReal xnew = x * c - y * s; - const SUMOReal ynew = x * s + y * c; + const double x = (*this)[i].x(); + const double y = (*this)[i].y(); + const double z = (*this)[i].z(); + const double xnew = x * c - y * s; + const double ynew = x * s + y * c; (*this)[i].set(xnew, ynew, z); } } @@ -1181,8 +1217,8 @@ const int middleIndex = (i + 1) % result.size(); const Position& p0 = result[middleIndex]; // https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line#Line_defined_by_two_points - const SUMOReal triangleArea2 = fabs((p2.y() - p1.y()) * p0.x() - (p2.x() - p1.x()) * p0.y() + p2.x() * p1.y() - p2.y() * p1.x()); - const SUMOReal distIK = p1.distanceTo2D(p2); + const double triangleArea2 = fabs((p2.y() - p1.y()) * p0.x() - (p2.x() - p1.x()) * p0.y() + p2.x() * p1.y() - p2.y() * p1.x()); + const double distIK = p1.distanceTo2D(p2); if (distIK > NUMERICAL_EPS && triangleArea2 / distIK < NUMERICAL_EPS) { changed = true; result.erase(result.begin() + middleIndex); @@ -1195,20 +1231,93 @@ PositionVector -PositionVector::getOrthogonal(const Position& p, SUMOReal extend, SUMOReal& distToClosest) const { +PositionVector::getOrthogonal(const Position& p, double extend, bool before, double length) const { PositionVector result; PositionVector tmp = *this; tmp.extrapolate2D(extend); - const SUMOReal baseOffset = tmp.nearest_offset_to_point2D(p); - if (baseOffset == GeomHelper::INVALID_OFFSET) { + const double baseOffset = tmp.nearest_offset_to_point2D(p); + if (baseOffset == GeomHelper::INVALID_OFFSET || size() < 2) { // fail return result; } Position base = tmp.positionAtOffset2D(baseOffset); - distToClosest = tmp[tmp.indexOfClosest(base)].distanceTo2D(base); - if (p.distanceTo2D(base) > NUMERICAL_EPS) { - result.push_back(p); - result.push_back(base); + const int closestIndex = tmp.indexOfClosest(base); + result.push_back(base); + if (fabs(baseOffset - tmp.offsetAtIndex2D(closestIndex)) > NUMERICAL_EPS) { + result.push_back(tmp[closestIndex]); + } else if (before) { + // take the segment before closestIndex if possible + if (closestIndex > 0) { + result.push_back(tmp[closestIndex - 1]); + } else { + result.push_back(tmp[1]); + } + } else { + // take the segment after closestIndex if possible + if (closestIndex < (int)size() - 1) { + result.push_back(tmp[closestIndex + 1]); + } else { + result.push_back(tmp[-1]); + } + } + result = result.getSubpart2D(0, length); + // rotate around base + result.add(base * -1); + result.rotate2D(DEG2RAD(90)); + result.add(base); + return result; +} + + +PositionVector +PositionVector::smoothedZFront(double dist) const { + PositionVector result = *this; + const double z0 = (*this)[0].z(); + // the z-delta of the first segment + const double dz = (*this)[1].z() - z0; + // if the shape only has 2 points it is as smooth as possible already + if (size() > 2 && dz != 0) { + dist = MIN2(dist, length()); + // check wether we need to insert a new point at dist + Position pDist = positionAtOffset(dist); + int iLast = indexOfClosest(pDist); + // prevent close spacing to reduce impact of rounding errors in z-axis + if (pDist.distanceTo2D((*this)[iLast]) > POSITION_EPS * 20) { + iLast = result.insertAtClosest(pDist); + } + double dist2 = result.offsetAtIndex2D(iLast); + const double dz2 = result[iLast].z() - z0; + double seen = 0; + for (int i = 1; i < iLast; ++i) { + seen += result[i].distanceTo2D(result[i - 1]); + result[i].set(result[i].x(), result[i].y(), z0 + dz2 * seen / dist2); + } + } + return result; + +} + + +double +PositionVector::offsetAtIndex2D(int index) const { + if (index < 0 || index >= (int)size()) { + return GeomHelper::INVALID_OFFSET; + } + double seen = 0; + for (int i = 1; i <= index; ++i) { + seen += (*this)[i].distanceTo2D((*this)[i - 1]); + } + return seen; +} + + +double +PositionVector::getMaxGrade() const { + double result = 0; + for (int i = 1; i < (int)size(); ++i) { + const Position& p1 = (*this)[i - 1]; + const Position& p2 = (*this)[i]; + result = MAX2(result, (double)fabs((p1.z() - p2.z()) / p1.distanceTo2D(p2))); } return result; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/PositionVector.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/PositionVector.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/geom/PositionVector.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/geom/PositionVector.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: PositionVector.h 21575 2016-09-29 09:27:12Z namdre $ +/// @version $Id: PositionVector.h 23242 2017-03-07 12:07:08Z namdre $ /// // A list of positions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,6 +33,7 @@ #endif #include +#include #include "AbstractPoly.h" @@ -125,11 +126,14 @@ /// @brief Returns the information whether the position vector describes a polygon lying around the given point /// @note The optional offset is added to the polygon's boundaries - bool around(const Position& p, SUMOReal offset = 0) const; + bool around(const Position& p, double offset = 0) const; /// @brief Returns the information whether the given polygon overlaps with this /// @note Again a boundary may be specified - bool overlapsWith(const AbstractPoly& poly, SUMOReal offset = 0) const; + bool overlapsWith(const AbstractPoly& poly, double offset = 0) const; + + /// @brief Returns the maximum overlaps between this and the given polygon (when not separated by at least zThreshold) + double getOverlapWith(const PositionVector& poly, double zThreshold) const; /// @brief Returns the information whether this list of points interesects the given line bool intersects(const Position& p1, const Position& p2) const; @@ -138,13 +142,13 @@ bool intersects(const PositionVector& v1) const; /// @brief Returns the position of the intersection - Position intersectionPosition2D(const Position& p1, const Position& p2, const SUMOReal withinDist = 0.) const; + Position intersectionPosition2D(const Position& p1, const Position& p2, const double withinDist = 0.) const; /// @brief For all intersections between this vector and other, return the 2D-length of the subvector from this vectors start to the intersection - std::vector intersectsAtLengths2D(const PositionVector& other) const; + std::vector intersectsAtLengths2D(const PositionVector& other) const; /// @brief For all intersections between this vector and line, return the 2D-length of the subvector from this vectors start to the intersection - std::vector intersectsAtLengths2D(const Position& lp1, const Position& lp2) const; + std::vector intersectsAtLengths2D(const Position& lp1, const Position& lp2) const; /// @brief Returns the position of the intersection Position intersectionPosition2D(const PositionVector& v1) const; @@ -161,25 +165,25 @@ Position& operator[](int index); /// @brief Returns the position at the given length - Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset = 0) const; + Position positionAtOffset(double pos, double lateralOffset = 0) const; /// @brief Returns the position at the given length - Position positionAtOffset2D(SUMOReal pos, SUMOReal lateralOffset = 0) const; + Position positionAtOffset2D(double pos, double lateralOffset = 0) const; /// @brief Returns the rotation at the given length - SUMOReal rotationAtOffset(SUMOReal pos) const; + double rotationAtOffset(double pos) const; /// @brief Returns the rotation at the given length - SUMOReal rotationDegreeAtOffset(SUMOReal pos) const; + double rotationDegreeAtOffset(double pos) const; /// @brief Returns the slope at the given length - SUMOReal slopeDegreeAtOffset(SUMOReal pos) const; + double slopeDegreeAtOffset(double pos) const; /// @brief Returns the position between the two given point at the specified position - static Position positionAtOffset(const Position& p1, const Position& p2, SUMOReal pos, SUMOReal lateralOffset = 0.); + static Position positionAtOffset(const Position& p1, const Position& p2, double pos, double lateralOffset = 0.); /// Returns the position between the two given point at the specified position - static Position positionAtOffset2D(const Position& p1, const Position& p2, SUMOReal pos, SUMOReal lateralOffset = 0.); + static Position positionAtOffset2D(const Position& p1, const Position& p2, double pos, double lateralOffset = 0.); /// @brief Returns a boundary enclosing this list of lines Boundary getBoxBoundary() const; @@ -192,28 +196,28 @@ Position getCentroid() const; /// @brief enlarges/shrinks the polygon by a factor based at the centroid - void scaleRelative(SUMOReal factor); + void scaleRelative(double factor); /// @brief enlarges/shrinks the polygon by an absolute offset based at the centroid - void scaleAbsolute(SUMOReal offset); + void scaleAbsolute(double offset); /// @brief get line center Position getLineCenter() const; /// @brief Returns the length - SUMOReal length() const; + double length() const; /// @brief Returns the length - SUMOReal length2D() const; + double length2D() const; /// @brief Returns the area (0 for non-closed) - SUMOReal area() const; + double area() const; /// @brief Returns the information whether this polygon lies partially within the given polygon - bool partialWithin(const AbstractPoly& poly, SUMOReal offset = 0) const; + bool partialWithin(const AbstractPoly& poly, double offset = 0) const; /// @brief Returns the two lists made when this list vector is splitted at the given point - std::pair splitAt(SUMOReal where) const; + std::pair splitAt(double where) const; //// @brief Output operator friend std::ostream& operator<<(std::ostream& os, const PositionVector& geom); @@ -222,7 +226,7 @@ bool crosses(const Position& p1, const Position& p2) const; //// @brief add a position - void add(SUMOReal xoff, SUMOReal yoff, SUMOReal zoff); + void add(double xoff, double yoff, double zoff); //// @brief add a position void add(const Position& offset); @@ -231,19 +235,19 @@ void mirrorX(); //// @brief rotate all points around (0,0) in the plane by the given angle - void rotate2D(SUMOReal angle); + void rotate2D(double angle); //// @brief get a convex Hull of position vector PositionVector convexHull() const; //// @brief append the given vector to this one - void append(const PositionVector& v, SUMOReal sameThreshold = 2.0); + void append(const PositionVector& v, double sameThreshold = 2.0); /// @brief get subpart of a position vector - PositionVector getSubpart(SUMOReal beginOffset, SUMOReal endOffset) const; + PositionVector getSubpart(double beginOffset, double endOffset) const; /// @brief get subpart of a position vector in two dimensions (Z is ignored) - PositionVector getSubpart2D(SUMOReal beginOffset, SUMOReal endOffset) const; + PositionVector getSubpart2D(double beginOffset, double endOffset) const; /// @brief get subpart of a position vector using index and a cout PositionVector getSubpartByIndex(int beginIndex, int count) const; @@ -255,22 +259,22 @@ void sortByIncreasingXY(); /// @brief extrapolate position vector - void extrapolate(const SUMOReal val, const bool onlyFirst = false); + void extrapolate(const double val, const bool onlyFirst = false, const bool onlyLast = false); /// @brief extrapolate position vector in two dimensions (Z is ignored) - void extrapolate2D(const SUMOReal val, const bool onlyFirst = false); + void extrapolate2D(const double val, const bool onlyFirst = false); /// @brief reverse position vector PositionVector reverse() const; /// @brief get a side position of position vector using a offset - static Position sideOffset(const Position& beg, const Position& end, const SUMOReal amount); + static Position sideOffset(const Position& beg, const Position& end, const double amount); /// @brief move position vector to side using certain ammount - void move2side(SUMOReal amount); + void move2side(double amount); /// @brief get angle in certain position of position vector - SUMOReal angleAt2D(int pos) const; + double angleAt2D(int pos) const; /// @brief inserts p between the two closest positions and returns the insertion index int insertAtClosest(const Position& p); @@ -303,13 +307,13 @@ /// @brief get left /// @note previously marked with "!!!" - SUMOReal isLeft(const Position& P0, const Position& P1, const Position& P2) const; + double isLeft(const Position& P0, const Position& P1, const Position& P2) const; /// @brief returns the angle in radians of the line connecting the first and the last position - SUMOReal beginEndAngle() const; + double beginEndAngle() const; /// @brief return the nearest offest to point 2D - SUMOReal nearest_offset_to_point2D(const Position& p, bool perpendicular = true) const; + double nearest_offset_to_point2D(const Position& p, bool perpendicular = true) const; /** @brief return position p within the length-wise coordinate system * defined by this position vector. The x value is the same as that returned @@ -326,10 +330,10 @@ /// @brief distances of all my points to s and all of s points to myself /// @note if perpendicular is set to true, only the perpendicular distances are returned - std::vector distances(const PositionVector& s, bool perpendicular = false) const; + std::vector distances(const PositionVector& s, bool perpendicular = false) const; /// @brief closest 2D-distance to point p (or -1 if perpendicular is true and the point is beyond this vector) - SUMOReal distance2D(const Position& p, bool perpendicular = false) const; + double distance2D(const Position& p, bool perpendicular = false) const; /// @brief insert in back a non double position void push_back_noDoublePos(const Position& p); @@ -344,7 +348,7 @@ * @param[in] minDist The minimum accepted distance; default: POSITION_EPS * @param[in] assertLength Whether the result must at least contain two points (be a line); default: false, to ensure original behaviour */ - void removeDoublePoints(SUMOReal minDist = POSITION_EPS, bool assertLength = false); + void removeDoublePoints(double minDist = POSITION_EPS, bool assertLength = false); /// @brief return whether two positions differ in z-coordinate bool hasElevation() const; @@ -355,13 +359,24 @@ /** @brief return orthogonal through p (extending this vector if necessary) * @param[in] p The point through which to draw the orthogonal * @param[in] extend how long to extend this vector for finding an orthogonal - * @param[out] distToClosest Distance between the intersection point and the closest geometry point + * @param[in] front Whether to take the segment before or after the base point in case of ambiguity + * @param[in] length the length of the orthogonal */ - PositionVector getOrthogonal(const Position& p, SUMOReal extend, SUMOReal& distToClosest) const; + PositionVector getOrthogonal(const Position& p, double extend, bool before, double length = 1.0) const; + + + /// @brief returned vector that is smoothed at the front (within dist) + PositionVector smoothedZFront(double dist = std::numeric_limits::max()) const; + + /// @brief return the offset at the given index + double offsetAtIndex2D(int index) const; + + /// @brief return the maximum grade of all segments as a fraction of zRange/length2D + double getMaxGrade() const; private: /// @brief return whether the line segments defined by Line p11,p12 and Line p21,p22 intersect - static bool intersects(const Position& p11, const Position& p12, const Position& p21, const Position& p22, const SUMOReal withinDist = 0., SUMOReal* x = 0, SUMOReal* y = 0, SUMOReal* mu = 0); + static bool intersects(const Position& p11, const Position& p12, const Position& p21, const Position& p22, const double withinDist = 0., double* x = 0, double* y = 0, double* mu = 0); }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GLHelper.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GLHelper.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GLHelper.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GLHelper.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GLHelper.cpp 21316 2016-08-22 13:08:50Z behrisch $ +/// @version $Id: GLHelper.cpp 23564 2017-03-21 07:38:52Z namdre $ /// // Some methods which help to draw certain geometrical objects in openGL /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,17 +39,13 @@ #include #include "GLHelper.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - -#define CIRCLE_RESOLUTION (SUMOReal)10 // inverse in degrees +#define CIRCLE_RESOLUTION (double)10 // inverse in degrees // =========================================================================== // static member definitions // =========================================================================== -std::vector > GLHelper::myCircleCoords; +std::vector > GLHelper::myCircleCoords; void APIENTRY combCallback(GLdouble coords[3], @@ -127,8 +123,8 @@ void -GLHelper::drawBoxLine(const Position& beg, SUMOReal rot, SUMOReal visLength, - SUMOReal width, SUMOReal offset) { +GLHelper::drawBoxLine(const Position& beg, double rot, double visLength, + double width, double offset) { glPushMatrix(); glTranslated(beg.x(), beg.y(), 0); glRotated(rot, 0, 0, 1); @@ -144,8 +140,8 @@ void GLHelper::drawBoxLine(const Position& beg1, const Position& beg2, - SUMOReal rot, SUMOReal visLength, - SUMOReal width) { + double rot, double visLength, + double width) { glPushMatrix(); glTranslated((beg2.x() + beg1.x())*.5, (beg2.y() + beg1.y())*.5, 0); glRotated(rot, 0, 0, 1); @@ -160,8 +156,8 @@ bool -GLHelper::rightTurn(SUMOReal angle1, SUMOReal angle2) { - SUMOReal delta = angle2 - angle1; +GLHelper::rightTurn(double angle1, double angle2) { + double delta = angle2 - angle1; while (delta > 180) { delta -= 360; } @@ -174,9 +170,9 @@ void GLHelper::drawBoxLines(const PositionVector& geom, - const std::vector& rots, - const std::vector& lengths, - SUMOReal width, int cornerDetail, SUMOReal offset) { + const std::vector& rots, + const std::vector& lengths, + double width, int cornerDetail, double offset) { // draw the lane int e = (int) geom.size() - 1; for (int i = 0; i < e; i++) { @@ -192,8 +188,8 @@ drawFilledCircle(MIN2(lengths[i], width - offset), cornerDetail); } else { // outside corner, make sure to only draw a segment of the circle - SUMOReal angleBeg = -rots[i - 1]; - SUMOReal angleEnd = 180 - rots[i]; + double angleBeg = -rots[i - 1]; + double angleEnd = 180 - rots[i]; // avoid drawing more than 360 degrees if (angleEnd - angleBeg > 360) { angleBeg += 360; @@ -216,10 +212,10 @@ void GLHelper::drawBoxLines(const PositionVector& geom, - const std::vector& rots, - const std::vector& lengths, + const std::vector& rots, + const std::vector& lengths, const std::vector& cols, - SUMOReal width, int cornerDetail, SUMOReal offset) { + double width, int cornerDetail, double offset) { int e = (int) geom.size() - 1; for (int i = 0; i < e; i++) { setColor(cols[i]); @@ -241,9 +237,9 @@ void GLHelper::drawBoxLines(const PositionVector& geom1, const PositionVector& geom2, - const std::vector& rots, - const std::vector& lengths, - SUMOReal width) { + const std::vector& rots, + const std::vector& lengths, + double width) { int minS = (int) MIN4(rots.size(), lengths.size(), geom1.size(), geom2.size()); for (int i = 0; i < minS; i++) { GLHelper::drawBoxLine(geom1[i], geom2[i], rots[i], lengths[i], width); @@ -252,7 +248,7 @@ void -GLHelper::drawBoxLines(const PositionVector& geom, SUMOReal width) { +GLHelper::drawBoxLines(const PositionVector& geom, double width) { int e = (int) geom.size() - 1; for (int i = 0; i < e; i++) { const Position& f = geom[i]; @@ -266,7 +262,7 @@ void -GLHelper::drawLine(const Position& beg, SUMOReal rot, SUMOReal visLength) { +GLHelper::drawLine(const Position& beg, double rot, double visLength) { glPushMatrix(); glTranslated(beg.x(), beg.y(), 0); glRotated(rot, 0, 0, 1); @@ -280,7 +276,7 @@ void GLHelper::drawLine(const Position& beg1, const Position& beg2, - SUMOReal rot, SUMOReal visLength) { + double rot, double visLength) { glPushMatrix(); glTranslated((beg2.x() + beg1.x())*.5, (beg2.y() + beg1.y())*.5, 0); glRotated(rot, 0, 0, 1); @@ -329,7 +325,7 @@ int -GLHelper::angleLookup(SUMOReal angleDeg) { +GLHelper::angleLookup(double angleDeg) { const int numCoords = (int)myCircleCoords.size() - 1; int index = ((int)(floor(angleDeg * CIRCLE_RESOLUTION + 0.5))) % numCoords; if (index < 0) { @@ -341,26 +337,26 @@ void -GLHelper::drawFilledCircle(SUMOReal width, int steps) { +GLHelper::drawFilledCircle(double width, int steps) { drawFilledCircle(width, steps, 0, 360); } void -GLHelper::drawFilledCircle(SUMOReal width, int steps, SUMOReal beg, SUMOReal end) { +GLHelper::drawFilledCircle(double width, int steps, double beg, double end) { if (myCircleCoords.size() == 0) { for (int i = 0; i <= (int)(360 * CIRCLE_RESOLUTION); ++i) { - const SUMOReal x = (SUMOReal) sin(DEG2RAD(i / CIRCLE_RESOLUTION)); - const SUMOReal y = (SUMOReal) cos(DEG2RAD(i / CIRCLE_RESOLUTION)); - myCircleCoords.push_back(std::pair(x, y)); + const double x = (double) sin(DEG2RAD(i / CIRCLE_RESOLUTION)); + const double y = (double) cos(DEG2RAD(i / CIRCLE_RESOLUTION)); + myCircleCoords.push_back(std::pair(x, y)); } } - const SUMOReal inc = (end - beg) / (SUMOReal)steps; + const double inc = (end - beg) / (double)steps; glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - std::pair p1 = myCircleCoords[angleLookup(beg)]; + std::pair p1 = myCircleCoords[angleLookup(beg)]; for (int i = 0; i <= steps; ++i) { - const std::pair& p2 = myCircleCoords[angleLookup(beg + i * inc)]; + const std::pair& p2 = myCircleCoords[angleLookup(beg + i * inc)]; glBegin(GL_TRIANGLES); glVertex2d(p1.first * width, p1.second * width); glVertex2d(p2.first * width, p2.second * width); @@ -372,27 +368,27 @@ void -GLHelper::drawOutlineCircle(SUMOReal width, SUMOReal iwidth, int steps) { +GLHelper::drawOutlineCircle(double width, double iwidth, int steps) { drawOutlineCircle(width, iwidth, steps, 0, 360); } void -GLHelper::drawOutlineCircle(SUMOReal width, SUMOReal iwidth, int steps, - SUMOReal beg, SUMOReal end) { +GLHelper::drawOutlineCircle(double width, double iwidth, int steps, + double beg, double end) { if (myCircleCoords.size() == 0) { for (int i = 0; i < 360; i += 10) { - SUMOReal x = (SUMOReal) sin(DEG2RAD(i)); - SUMOReal y = (SUMOReal) cos(DEG2RAD(i)); - myCircleCoords.push_back(std::pair(x, y)); + double x = (double) sin(DEG2RAD(i)); + double y = (double) cos(DEG2RAD(i)); + myCircleCoords.push_back(std::pair(x, y)); } } glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - std::pair p1 = + std::pair p1 = beg == 0 ? myCircleCoords[0] : myCircleCoords[((int) beg / 10) % 36]; - for (int i = (int)(beg / 10); i < steps && (36.0 / (SUMOReal) steps * (SUMOReal) i) * 10 < end; i++) { - const std::pair& p2 = - myCircleCoords[(int)(36.0 / (SUMOReal) steps * (SUMOReal) i)]; + for (int i = (int)(beg / 10); i < steps && (36.0 / (double) steps * (double) i) * 10 < end; i++) { + const std::pair& p2 = + myCircleCoords[(int)(36.0 / (double) steps * (double) i)]; glBegin(GL_TRIANGLES); glVertex2d(p1.first * width, p1.second * width); glVertex2d(p2.first * width, p2.second * width); @@ -404,7 +400,7 @@ glEnd(); p1 = p2; } - const std::pair& p2 = + const std::pair& p2 = end == 360 ? myCircleCoords[0] : myCircleCoords[((int) end / 10) % 36]; glBegin(GL_TRIANGLES); glVertex2d(p1.first * width, p1.second * width); @@ -420,8 +416,8 @@ void GLHelper::drawTriangleAtEnd(const Position& p1, const Position& p2, - SUMOReal tLength, SUMOReal tWidth) { - const SUMOReal length = p1.distanceTo(p2); + double tLength, double tWidth) { + const double length = p1.distanceTo(p2); if (length < tLength) { tWidth *= length / tLength; tLength = length; @@ -458,15 +454,15 @@ void GLHelper::drawText(const std::string& text, const Position& pos, - const SUMOReal layer, const SUMOReal size, - const RGBColor& col, const SUMOReal angle) { + const double layer, const double size, + const RGBColor& col, const double angle) { glPushMatrix(); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); setColor(col); glTranslated(pos.x(), pos.y(), layer); pfSetPosition(0, 0); pfSetScale(size); - SUMOReal w = pfdkGetStringWidth(text.c_str()); + double w = pfdkGetStringWidth(text.c_str()); glRotated(180, 1, 0, 0); glRotated(angle, 0, 0, 1); glTranslated(-w / 2., size / 4, 0); @@ -476,18 +472,18 @@ void GLHelper::drawTextBox(const std::string& text, const Position& pos, - const SUMOReal layer, const SUMOReal size, + const double layer, const double size, const RGBColor& txtColor, const RGBColor& bgColor, const RGBColor& borderColor, - const SUMOReal angle) { - SUMOReal boxAngle = angle + 90; + const double angle) { + double boxAngle = angle + 90; if (boxAngle > 360) { boxAngle -= 360; } pfSetScale(size); - const SUMOReal stringWidth = pfdkGetStringWidth(text.c_str()); - const SUMOReal borderWidth = size / 20; - const SUMOReal boxHeight = size * 0.8; - const SUMOReal boxWidth = stringWidth + size / 2; + const double stringWidth = pfdkGetStringWidth(text.c_str()); + const double borderWidth = size / 20; + const double boxHeight = size * 0.8; + const double boxWidth = stringWidth + size / 2; glPushMatrix(); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glTranslated(0, 0, layer); @@ -515,7 +511,21 @@ void -GLHelper::debugVertices(const PositionVector& shape, SUMOReal size, SUMOReal layer) { +GLHelper::drawTextAtEnd(const std::string& text, const PositionVector& shape, double x, double size, RGBColor color) { + glPushMatrix(); + const Position& end = shape.back(); + const Position& f = shape[-2]; + const double rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y()))); + glTranslated(end.x(), end.y(), 0); + glRotated(rot, 0, 0, 1); + GLHelper::drawText(text, Position(x, 0.26), 0, .6 * size / 50, color, 180); + glPopMatrix(); +} + + + +void +GLHelper::debugVertices(const PositionVector& shape, double size, double layer) { RGBColor color = RGBColor::fromHSV(RandHelper::rand(360), 1, 1); for (int i = 0; i < (int)shape.size(); ++i) { GLHelper::drawText(toString(i), shape[i], layer, size, color, 0); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GLHelper.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GLHelper.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GLHelper.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GLHelper.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GLHelper.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: GLHelper.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Some methods which help to draw certain geometrical objects in openGL /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -78,8 +78,8 @@ * @param[in] width The width of the line * @param[in] offset The orthogonal offset */ - static void drawBoxLine(const Position& beg, SUMOReal rot, - SUMOReal visLength, SUMOReal width, SUMOReal offset = 0); + static void drawBoxLine(const Position& beg, double rot, + double visLength, double width, double offset = 0); /** @brief Draws a thick line using the mean of both given points as begin position @@ -93,7 +93,7 @@ * @param[in] width The width of the line */ static void drawBoxLine(const Position& beg1, const Position& beg2, - SUMOReal rot, SUMOReal visLength, SUMOReal width); + double rot, double visLength, double width); /** @brief Draws thick lines @@ -109,8 +109,8 @@ * @see drawBoxLine */ static void drawBoxLines(const PositionVector& geom, - const std::vector& rots, const std::vector& lengths, - SUMOReal width, int cornerDetail = 0, SUMOReal offset = 0); + const std::vector& rots, const std::vector& lengths, + double width, int cornerDetail = 0, double offset = 0); /** @brief Draws thick lines with varying color * @@ -126,9 +126,9 @@ * @see drawBoxLine */ static void drawBoxLines(const PositionVector& geom, - const std::vector& rots, const std::vector& lengths, + const std::vector& rots, const std::vector& lengths, const std::vector& cols, - SUMOReal width, int cornerDetail = 0, SUMOReal offset = 0); + double width, int cornerDetail = 0, double offset = 0); /** @brief Draws thick lines using the mean of the points given in the point lists as begin positions @@ -144,8 +144,8 @@ */ static void drawBoxLines(const PositionVector& geom1, const PositionVector& geom2, - const std::vector& rots, const std::vector& lengths, - SUMOReal width); + const std::vector& rots, const std::vector& lengths, + double width); /** @brief Draws thick lines @@ -157,7 +157,7 @@ * @param[in] width The width of the lines * @see drawBoxLine */ - static void drawBoxLines(const PositionVector& geom, SUMOReal width); + static void drawBoxLines(const PositionVector& geom, double width); /** @brief Draws a thin line @@ -168,8 +168,8 @@ * @param[in] rot The direction the line shall be drawn to (in radiants) * @param[in] visLength The length of the line */ - static void drawLine(const Position& beg, SUMOReal rot, - SUMOReal visLength); + static void drawLine(const Position& beg, double rot, + double visLength); /** @brief Draws a thin line using the mean of both given points as begin position @@ -182,7 +182,7 @@ * @param[in] visLength The length of the line */ static void drawLine(const Position& beg1, const Position& beg2, - SUMOReal rot, SUMOReal visLength); + double rot, double visLength); /** @brief Draws a thin line along the given position vector @@ -220,7 +220,7 @@ * @param[in] width The width of the circle * @param[in] steps The number of steps to divide the circle into */ - static void drawFilledCircle(SUMOReal width, int steps = 8); + static void drawFilledCircle(double width, int steps = 8); /** @brief Draws a filled circle around (0,0) @@ -232,8 +232,8 @@ * @param[in] beg The begin angle in degress * @param[in] end The end angle in degress */ - static void drawFilledCircle(SUMOReal width, int steps, - SUMOReal beg, SUMOReal end); + static void drawFilledCircle(double width, int steps, + double beg, double end); /** @brief Draws an unfilled circle around (0,0) @@ -244,7 +244,7 @@ * @param[in] iwidth The inner width of the circle * @param[in] steps The number of steps to divide the circle into */ - static void drawOutlineCircle(SUMOReal width, SUMOReal iwidth, + static void drawOutlineCircle(double width, double iwidth, int steps = 8); @@ -258,8 +258,8 @@ * @param[in] beg The begin angle in degress * @param[in] end The end angle in degress */ - static void drawOutlineCircle(SUMOReal width, SUMOReal iwidth, - int steps, SUMOReal beg, SUMOReal end); + static void drawOutlineCircle(double width, double iwidth, + int steps, double beg, double end); /** @brief Draws a triangle at the end of the given line @@ -270,7 +270,7 @@ * @param[in] tWidth The width of the triangle */ static void drawTriangleAtEnd(const Position& p1, const Position& p2, - SUMOReal tLength, SUMOReal tWidth); + double tLength, double tWidth); /// @brief Sets the gl-color to this value static void setColor(const RGBColor& c); @@ -280,30 +280,33 @@ /// @brief draw Text with given parameters static void drawText(const std::string& text, const Position& pos, - const SUMOReal layer, const SUMOReal size, - const RGBColor& col = RGBColor::BLACK, const SUMOReal angle = 0); + const double layer, const double size, + const RGBColor& col = RGBColor::BLACK, const double angle = 0); /// @brief draw Text box with given parameters static void drawTextBox(const std::string& text, const Position& pos, - const SUMOReal layer, const SUMOReal size, + const double layer, const double size, const RGBColor& txtColor = RGBColor::BLACK, const RGBColor& bgColor = RGBColor::WHITE, const RGBColor& borderColor = RGBColor::BLACK, - const SUMOReal angle = 0); + const double angle = 0); + + /// @brief draw text and the end of shape + static void drawTextAtEnd(const std::string& text, const PositionVector& shape, double x, double size, RGBColor color); /// @brief draw vertex numbers for the given shape (in a random color) - static void debugVertices(const PositionVector& shape, SUMOReal size, SUMOReal layer = 256); + static void debugVertices(const PositionVector& shape, double size, double layer = 256); private: /// @brief normalize angle for lookup in myCircleCoords - static int angleLookup(SUMOReal angleDeg); + static int angleLookup(double angleDeg); /// @brief whether the road makes a right turn (or goes straight) - static bool rightTurn(SUMOReal angle1, SUMOReal angle2); + static bool rightTurn(double angle1, double angle2); private: /// @brief Storage for precomputed sin/cos-values describing a circle - static std::vector > myCircleCoords; + static std::vector > myCircleCoords; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GLObjectValuePassConnector.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GLObjectValuePassConnector.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GLObjectValuePassConnector.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GLObjectValuePassConnector.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Fri, 29.04.2005 -/// @version $Id: GLObjectValuePassConnector.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GLObjectValuePassConnector.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Class passing values from a GUIGlObject to another object /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -58,7 +58,7 @@ * * A templated instance has some static member variables. They have to be defined * in a cpp file. They may be found in GUINet.cpp. Two instances are used: - * - one passing SUMOReal-values + * - one passing double-values * - one passing time tls phase definitions * * @see GUIGlObject diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIDesigns.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIDesigns.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIDesigns.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIDesigns.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,429 @@ +/****************************************************************************/ +/// @file GUIDesigns.h +/// @author Pablo Alvarez Lopez +/// @date Oct 2016 +/// @version $Id: GUIDesigns.h 24015 2017-04-22 14:12:17Z palcraft $ +/// +/// File with the definitions of standard style of FXObjects in SUMO +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef GUIDesigns_h +#define GUIDesigns_h + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include + +// =========================================================================== +// Definitions +// =========================================================================== + +/// @name FXTextFields +/// @{ +/// @brief text field extended over Frame with thick frame +#define GUIDesignTextField (FRAME_THICK | LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT), 0, 0, 0, 23, 2, 2, 2, 2 + +/// @brief text field extended over Frame with thick frame and limited to Integers +#define GUIDesignTextFieldInt (FRAME_THICK | LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT | TEXTFIELD_INTEGER), 0, 0, 0, 23, 2, 2, 2, 2 + +/// @brief text field extended over Frame with thick frame and limited to Doubles/doubles +#define GUIDesignTextFieldReal (FRAME_THICK | LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT | TEXTFIELD_REAL), 0, 0, 0, 23, 2, 2, 2, 2 + +/// @brief Num of column of text field +#define GUIDesignTextFieldNCol 1 +/// @} + + +/// @name FXButtons +/// @{ +/// @brief button extended over over Frame with thick and raise frame +#define GUIDesignButton (FRAME_THICK | FRAME_RAISED | ICON_BEFORE_TEXT | LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT), 0, 0, 0, 23, 2, 2, 2, 2 + +/// @brief button extended over over column with thick and raise frame +#define GUIDesignButtonAttribute (FRAME_THICK | FRAME_RAISED | ICON_BEFORE_TEXT | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT), 0, 0, 100, 23, 2, 2, 2, 2 + +/// @brief little button rectangular (46x23) used in frames (For example, in "help" buttons) +#define GUIDesignButtonRectangular (FRAME_THICK | FRAME_RAISED | ICON_BEFORE_TEXT | JUSTIFY_CENTER_X | JUSTIFY_CENTER_Y | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT), 0, 0, 46, 23, 2, 2, 2, 2 + +/// @brief button only with icon (23x23) +#define GUIDesignButtonIcon (FRAME_THICK | FRAME_RAISED | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT), 0, 0, 23, 23, 2, 2, 2, 2 + +/// @brief button only with icon (46x23) +#define GUIDesignButtonIconRectangular (FRAME_THICK | FRAME_RAISED | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT), 0, 0, 46, 23, 2, 2, 2, 2 + +/// @brief button used in breakpoint editor +#define GUIDesignButtonBreakpoint (ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED), 0, 0, 0, 0, 4, 4, 3, 3 +/// @} + + +/// @name FXButtons for toolbar +/// @{ +/// @brief little button with text placed in navigation toolbar +#define GUIDesignButtonToolbarText (BUTTON_TOOLBAR | ICON_BEFORE_TEXT | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_Y | LAYOUT_FIX_HEIGHT), 0, 0, 0, 23 + +/// @brief little button with icon placed in navigation toolbar +#define GUIDesignButtonToolbar (BUTTON_TOOLBAR | ICON_BEFORE_TEXT | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT), 0, 0, 23, 23 + +/// @brief little button with text and icon +#define GUIDesignButtonToolbarWithText (BUTTON_TOOLBAR | ICON_BEFORE_TEXT | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FIX_HEIGHT | JUSTIFY_LEFT), 0, 0, 0, 23 + +/// @brief little checkable button with icon placed in navigation toolbar used specify for Locator +#define GUIDesignButtonToolbarLocator (BUTTON_TOOLBAR | MENUBUTTON_RIGHT | LAYOUT_TOP | FRAME_RAISED | FRAME_THICK | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT), 0, 0, 23, 23 + +/// @brief little checkable button with icon placed in navigation toolbar +#define GUIDesignButtonToolbarCheckable (BUTTON_NORMAL | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT), 0, 0, 23, 23 +/// @} + + +/// @name FXButtons for dialogs +/// @{ +/// @brief OK Button +#define GUIDesignButtonOK (ICON_BEFORE_TEXT | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT | FRAME_THICK | FRAME_RAISED), 0, 0, 75, 23, 2, 2, 2, 2 + +/// @brief Accept Button +#define GUIDesignButtonAccept (ICON_BEFORE_TEXT | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT | FRAME_THICK | FRAME_RAISED), 0, 0, 75, 23, 2, 2, 2, 2 + +/// @brief Cancel Button +#define GUIDesignButtonCancel (ICON_BEFORE_TEXT | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT | FRAME_THICK | FRAME_RAISED), 0, 0, 75, 23, 2, 2, 2, 2 + +/// @brief Reset Button +#define GUIDesignButtonReset (ICON_BEFORE_TEXT | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT | FRAME_THICK | FRAME_RAISED), 0, 0, 75, 23, 2, 2, 2, 2 +/// @} + + +/// @name FXCheckButtons +/// @{ +/// @brief CheckButton for Frames without thick extended over the frame +#define GUIDesignCheckButton (CHECKBUTTON_NORMAL | LAYOUT_CENTER_Y) + +/// @brief checkButton without thick extended over the frame used for attributes +#define GUIDesignCheckButtonAttribute (CHECKBUTTON_NORMAL | JUSTIFY_CENTER_Y | LAYOUT_FIX_HEIGHT | JUSTIFY_LEFT), 0, 0, 0, 23, 2, 2, 2, 2 +/// @} + + +/// @name MDI Buttons +/// @{ +/// @brief MDIButton oriented to left +#define GUIDesignMDIButtonLeft (LAYOUT_LEFT) + +/// @brief MDIButton oriented to right +#define GUIDesignMDIButtonRight (FRAME_RAISED | LAYOUT_RIGHT) +/// @} + + +/// @name FXMenuChecks +/// @{ +/// @brief design for radio button +#define GUIDesignRadioButton (LAYOUT_LEFT | LAYOUT_FILL_X | ICON_BEFORE_TEXT | JUSTIFY_LEFT) + +/// @brief design for radio button with fixed height +#define GUIDesignRadioButtonAttribute (LAYOUT_LEFT | LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT | JUSTIFY_LEFT | JUSTIFY_CENTER_Y | ICON_BEFORE_TEXT), 0, 0, 0, 23, 2, 2, 2, 2 +/// @} + + +/// @name FXLabels +/// @{ +/// @brief label extended over frame without thick and with text justify to left +#define GUIDesignLabelLeft (JUSTIFY_LEFT | LAYOUT_FILL_X | ICON_BEFORE_TEXT), 0, 0, 0, 0, 2, 2, 2, 2 + +/// @brief label extended over frame without thick and with text justify to right +#define GUIDesignLabelRight (JUSTIFY_RIGHT | LAYOUT_FILL_X | ICON_BEFORE_TEXT), 0, 0, 0, 0, 2, 2, 2, 2 + +/// @brief label extended over frame without thickand with text justify to center +#define GUIDesignLabelCenter (JUSTIFY_NORMAL | LAYOUT_FILL_X | ICON_BEFORE_TEXT), 0, 0, 0, 0, 2, 2, 2, 2 + +/// @brief label extended over frame with thick and with text justify to left +#define GUIDesignLabelThick (FRAME_THICK | LAYOUT_FILL_X | ICON_BEFORE_TEXT), 0, 0, 0, 0, 2, 2, 2, 2 + +/// @brief label extended over frame with thick and with text justify to left +#define GUIDesignLabelLeftThick (FRAME_THICK | JUSTIFY_LEFT | LAYOUT_FILL_X | ICON_BEFORE_TEXT), 0, 0, 0, 0, 2, 2, 2, 2 + +/// @brief label extended over frame with thick and with text justify to right +#define GUIDesignLabelRightThick (FRAME_THICK | JUSTIFY_RIGHT | LAYOUT_FILL_X | ICON_BEFORE_TEXT), 0, 0, 0, 0, 2, 2, 2, 2 + +/// @brief label extended over frame with thick and with text justify to center +#define GUIDesignLabelCenterThick (FRAME_THICK | JUSTIFY_NORMAL | LAYOUT_FILL_X | ICON_BEFORE_TEXT), 0, 0, 0, 0, 2, 2, 2, 2 + +/// @brief label extended over the matrix column with thick frame +#define GUIDesignLabelAttribute (FRAME_THICK | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT | ICON_BEFORE_TEXT), 0, 0, 100, 23, 2, 2, 2, 2 + +/// @brief label extended over over frame without thickand with text justify to center and withouht vertical spaces +#define GUIDesignLabelAboutInfo (JUSTIFY_NORMAL | LAYOUT_FILL_X | ICON_BEFORE_TEXT), 0, 0, 0, 0, 2, 2, 0, 0 + +/// @brief label ticked filled only with an icon of 32x32 +#define GUIDesignLabelIcon32x32Thicked (FRAME_THICK | ICON_BEFORE_TEXT | LAYOUT_FIX_HEIGHT | LAYOUT_FIX_WIDTH), 0, 0, 24, 23, 2, 2, 2, 2 + +/// @brief label ticked filled used for VClasses. It uses icons of 64x32 pixels +#define GUIDesignLabelIcon64x32Thicked (FRAME_THICK | ICON_BEFORE_TEXT | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT), 0, 0, 94, 46, 2, 2, 2, 2 + +/// @brief design for label with icon of 64x64 px +#define GUIDesignLabelIcon64x64noSpacing (LAYOUT_CENTER_Y | LAYOUT_CENTER_X | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT ), 0, 0, 64, 64, 0, 0, 0, 0 + +/// @brief label ticked filled extended over frame used for VClasses. can be used by icons of 64x32 pixels +#define GUIDesignLabelIconExtendedx46Ticked (FRAME_THICK | ICON_BEFORE_TEXT | LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT), 0, 0, 0, 46, 2, 2, 2, 2 +/// @} + + +/// @name FXComboBox +/// @{ +/// @brief Combo box editable extended over the all frame +#define GUIDesignComboBox (FRAME_THICK | LAYOUT_FILL_X) + +/// @brief Combo box static (not editable) +#define GUIDesignComboBoxStatic (COMBOBOX_STATIC | FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | LAYOUT_FIX_HEIGHT), 0, 0, 0, 23, 2, 2, 2, 2 + +/// @brief Combo box static (cannot be edited) extended over the matrix column +#define GUIDesignComboBoxAttribute (COMBOBOX_NORMAL | FRAME_THICK | LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT), 0, 0, 0, 23, 2, 2, 2, 2 + + +/// @brief number of column of every combo box +#define GUIDesignComboBoxNCol 1 +/// @} + + +/// @name FXPackers +/// @{ +/// @brief Horizontal frame extended over frame parent +#define GUIDesignHorizontalFrame (LAYOUT_FILL_X) + +/// @brief Vertical frame extended over frame parent +#define GUIDesignVerticalFrame (LAYOUT_FILL_Y) + +/// @brief Horizontal frame used for pack icons +#define GUIDesignHorizontalFrameIcons (LAYOUT_FILL_X | FRAME_THICK), 0, 0, 0, 0, 0, 0, 0, 0, 2, 2 + +/// @brief Horizontal frame used in status bar +#define GUIDesignHorizontalFrameStatusBar (LAYOUT_FIX_WIDTH | LAYOUT_FILL_Y | LAYOUT_RIGHT | FRAME_SUNKEN), 0, 0, 20, 0, 0, 0, 0, 0, 0, 0 + +/// @brief Matrix design extended over Frame packed by columns +#define GUIDesignMatrix (LAYOUT_FILL_X | LAYOUT_FILL_Y | MATRIX_BY_COLUMNS | PACK_UNIFORM_WIDTH) + +/// @brief Group box design extended over frame +#define GUIDesignGroupBoxFrame (LAYOUT_FILL_X | FRAME_GROOVE | GROUPBOX_TITLE_CENTER) + +/// @brief FXMatrix used to pack values in Viewsettings +#define GUIDesignMatrixViewSettings (LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS), 0, 0, 0, 0, 10, 10, 10, 10, 5, 5 + +/// @brief Matrix design extended over Frame and used for represent attributes and their values (Deprecated) +#define GUIDesignMatrixAttributes (LAYOUT_FILL_X | MATRIX_BY_COLUMNS | PACK_UNIFORM_WIDTH) +/// @} + + +/// @name General design for netedit frames +/// @{ +/// @brief design for frames area +#define GUIDesignFrameArea (FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FIX_WIDTH | LAYOUT_FILL_Y) + +/// @brief design for viewn area +#define GUIDesignViewnArea (FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y), 0, 0, 0, 0, 0, 0, 0, 0 + +/// @brief design for the content frame of every frame +#define GUIDesignContentsScrollWindow (LAYOUT_FILL_X | LAYOUT_FILL_Y | HSCROLLER_NEVER), 0, 0, 0, 0 + +/// @brief design for auxiliar (Without borders) frames used to pack another frames extended in all directions +#define GUIDesignAuxiliarFrame (LAYOUT_FILL_X | LAYOUT_FILL_Y), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + +/// @brief design for auxiliar (Without borders) horizontal frame used to pack another frames +#define GUIDesignAuxiliarHorizontalFrame (LAYOUT_FILL_X), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + +/// @brief design for auxiliar (Without borders) horizontal frame used to pack another frames +#define GUIDesignAuxiliarVerticalFrame (LAYOUT_FILL_Y), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + +/// @brief design for horizontal frame used to pack another frames with a uniform width +#define GUIDesignUniformHorizontalFrame (LAYOUT_FILL_X | LAYOUT_FILL_Y | PACK_UNIFORM_WIDTH) + +/// @brief design for the main content frame of every frame/dialog +#define GUIDesignContentsFrame (LAYOUT_FILL_X | LAYOUT_FILL_Y) +/// @} + + +/// @name designs for toolbars +/// @{ +/// @brief design for all toolbars and menubars +#define GUIDesignBar (LAYOUT_SIDE_TOP | LAYOUT_FILL_X | FRAME_RAISED) + +/// @brief design used in status bar +#define GUIDesignStatusBar (LAYOUT_SIDE_BOTTOM | LAYOUT_FILL_X | FRAME_RAISED) + +/// @brief design for toolbar grip (used to change the position of toolbar with mouse) +#define GUIDesignToolBarGrip (TOOLBARGRIP_DOUBLE) + +/// @brief design for first toolbar shell positioned in the next position of dock +#define GUIDesignToolBarShell1 (LAYOUT_DOCK_NEXT | LAYOUT_SIDE_TOP | FRAME_RAISED) + +/// @brief design for first toolbar shell positioned in the same position of dock +#define GUIDesignToolBarShell2 (LAYOUT_DOCK_SAME | LAYOUT_SIDE_TOP | FRAME_RAISED) + +#define GUIDesignToolBarShell3 (FRAME_NORMAL) +/// @} + + +/// @name designs for separators +/// @{ +/// @brief horizontal separator +#define GUIDesignHorizontalSeparator (SEPARATOR_GROOVE | LAYOUT_FILL_X) + +/// @brief vertical separator +#define GUIDesignVerticalSeparator (SEPARATOR_GROOVE | LAYOUT_FILL_Y) +/// @} + + +/// @name designs for splitters +/// @{ +/// @brief general design for splitters +#define GUIDesignSplitter (LAYOUT_FILL_X | LAYOUT_FILL_Y | FRAME_RAISED | FRAME_THICK | SPLITTER_TRACKING) + +/// @brief MDI Splitter +#define GUIDesignSplitterMDI (LAYOUT_FILL_X | LAYOUT_FILL_Y | FRAME_SUNKEN | FRAME_THICK) +/// @} + + +/// @name designs for Spin dials +/// @{ +/// @brief desing for standard spin dial +#define GUIDesignSpinDial (FRAME_THICK | FRAME_SUNKEN | LAYOUT_TOP | LAYOUT_CENTER_Y) +/// @} + + +/// @name design for view settings dialog +/// @{ +/// @rbrief dialog +#define GUIDesignViewSettingsMainDialog (DECOR_TITLE | DECOR_BORDER | DECOR_RESIZE), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + +#define GUIDesignViewSettingsDialog (DECOR_TITLE | DECOR_BORDER) + +/// @brief vertical frames +#define GUIDesignViewSettingsVerticalFrame1 (LAYOUT_FILL_X | LAYOUT_SIDE_TOP | LAYOUT_FILL_Y), 0, 0, 0, 0, 0, 0, 0, 0, 2, 2 + +#define GUIDesignViewSettingsVerticalFrame2 (LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_Y), 0, 0, 0, 0, 0, 0, 0, 0, 2, 2 + +#define GUIDesignViewSettingsVerticalFrame3 (LAYOUT_FILL_Y), 0, 0, 0, 0, 10, 10, 10, 10, 5, 5 + +#define GUIDesignViewSettingsVerticalFrame4 (LAYOUT_FILL_X | LAYOUT_FILL_Y), 0, 0, 0, 0, 10, 10, 2, 8, 5, 2 + +#define GUIDesignViewSettingsVerticalFrame5 (LAYOUT_FILL_X | LAYOUT_FILL_Y), 0, 0, 0, 0, 10, 10, 10, 10, 10, 10 + +#define GUIDesignViewSettingsVerticalFrame6 (LAYOUT_FILL_X | LAYOUT_FILL_Y), 0, 0, 0, 0, 0, 0, 0, 0, 2, 2 + +/// @brief Horizontal frames +#define GUIDesignViewSettingsHorizontalFrame1 (FRAME_THICK), 0, 0, 0, 0, 0, 0, 0, 0, 2, 2 + +#define GUIDesignViewSettingsHorizontalFrame2 (LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | PACK_UNIFORM_WIDTH), 0, 0, 0, 0, 10, 10, 5, 5 + +#define GUIDesignViewSettingsHorizontalFrame3 (LAYOUT_FILL_X | PACK_UNIFORM_WIDTH), 0, 0, 0, 0, 0, 0, 0, 0 + +/// @brief Matrix +#define GUIDesignViewSettingsMatrix1 (LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS), 0, 0, 0, 0, 10, 10, 10, 10, 5, 5 + +#define GUIDesignViewSettingsMatrix2 (LAYOUT_FILL_X | LAYOUT_CENTER_Y | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS), 0, 0, 0, 0, 10, 10, 0, 0, 5, 5 + +#define GUIDesignViewSettingsMatrix3 (LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS), 0, 0, 0, 0, 10, 10, 10, 2, 5, 5 + +#define GUIDesignViewSettingsMatrix4 (LAYOUT_FILL_X | MATRIX_BY_COLUMNS), 0, 0, 0, 0, 10, 10, 0, 0, 5, 3 + +#define GUIDesignViewSettingsMatrix5 (LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS), 0, 0, 0, 0, 10, 10, 0, 0, 5, 5 + + +/// @brief Combo boxs +#define GUIDesignViewSettingsComboBox1 (COMBOBOX_INSERT_LAST | FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_CENTER_Y | COMBOBOX_STATIC) + +/// @brief ColorWell +#define GUIDesignViewSettingsColorWell (LAYOUT_FIX_WIDTH | LAYOUT_CENTER_Y | LAYOUT_SIDE_TOP | FRAME_SUNKEN | FRAME_THICK | ICON_AFTER_TEXT), 0, 0, 100, 0, 0, 0, 0, 0 + +#define GUIDesignViewSettingsSpinDial1 (LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK) + +#define GUIDesignViewSettingsSpinDial2 (LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK) + +/// @brief Tab books +#define GUIDesignViewSettingsTabBook1 (TABBOOK_LEFTTABS | PACK_UNIFORM_WIDTH | PACK_UNIFORM_HEIGHT | LAYOUT_FILL_X | LAYOUT_FILL_Y | LAYOUT_RIGHT), 0, 0, 0, 0, 0, 0, 0, 0 + +#define GUIDesignViewSettingsTabItemBook1 (TAB_LEFT_NORMAL), 0, 0, 0, 0, 4, 8, 4, 4 + +/// @brief Label +#define GUIDesignViewSettingsLabel1 (LAYOUT_CENTER_Y) + +#define GUIDesignViewSettingsLabel2 (LAYOUT_FILL_X | JUSTIFY_LEFT) + +/// @brief textFields +#define GUIDesignViewSettingsTextField1 (TEXTFIELD_ENTER_ONLY | FRAME_SUNKEN | FRAME_THICK | LAYOUT_FILL_X) + +/// @brief Buttons +#define GUIDesignViewSettingsButton1 (BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X), 0, 0, 0, 0, 20, 20, 4, 4 + +#define GUIDesignViewSettingsButton2 (BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X), 0, 0, 0, 0, 30, 30, 4, 4 + +#define GUIDesignViewSettingsButton3 (BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X), 0, 0, 0, 0, 30, 30, 4, 4 + +#define GUIDesignViewSettingsButton4 (BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_RIGHT) + +#define GUIDesignViewSettingsButton5 (BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_RIGHT), 0, 0, 0, 0, 20, 20 + +/// @brief Color wells +#define GUIDesignViewSettingsColorWell1 (LAYOUT_FIX_WIDTH | LAYOUT_CENTER_Y | FRAME_SUNKEN | FRAME_THICK | ICON_AFTER_TEXT), 0, 0, 100, 0, 0, 0, 0, 0 + +#define GUIDesignViewSettingsColorWell2 (LAYOUT_FIX_WIDTH | LAYOUT_CENTER_Y | LAYOUT_SIDE_TOP | FRAME_SUNKEN | FRAME_THICK | ICON_AFTER_TEXT), 0, 0, 100, 0, 0, 0, 0, 0 + +/// @brief MFX Add/Edit Typed Table +#define GUIDesignViewSettingsMFXTable (LAYOUT_FILL_Y | LAYOUT_FIX_WIDTH) /*|LAYOUT_FIX_HEIGHT*/, 0, 0, 470, 0 + +#define GUIDesignViewSettingsMFXTableJustify (JUSTIFY_CENTER_X | JUSTIFY_TOP) +/// @} + + +/// @name design for dialog boxs +/// @{ +/// @brief design for standard dialog box (for example, about dialog) +#define GUIDesignDialogBox (DECOR_CLOSE | DECOR_TITLE) + +/// @brief design for dialog box with specift width and height (for example, additional dialogs) +#define GUIDesignDialogBoxExplicit (DECOR_CLOSE | DECOR_TITLE | LAYOUT_EXPLICIT) +/// @} + + +/// @name design for FXTables and their cells +/// @{ +/// @brief design for table extended over frame +#define GUIDesignTable (LAYOUT_FILL_X | LAYOUT_FILL_Y) + +/// @brief design for table extended over frame but with limited Height +#define GUIDesignTableLimitedHeight (LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT) + +/// @brief design for tables used in additional dialogs +#define GUIDesignTableAdditionals (LAYOUT_FILL_X | LAYOUT_FILL_Y | VSCROLLER_ALWAYS | HSCROLLER_NEVER | TABLE_NO_ROWSELECT | TABLE_NO_COLSELECT), 0, 0, 0, 0, 2, 2, 2, 2 + +/// @brief width of cells that only contains an Icon +#define GUIDesignTableIconCellWidth 23 +/// @} + +/// @brief Tree list used in frames to represent childs of elements +#define GUIDesignTreeListFrame (TREELIST_SHOWS_LINES | TREELIST_SHOWS_BOXES | TREELIST_SINGLESELECT | FRAME_SUNKEN | FRAME_THICK | LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT), 0, 0, 0, 200 + +/// @brief design for FXLists +#define GUIDesignList (FRAME_NORMAL | LAYOUT_FILL_X | LAYOUT_FIX_HEIGHT | LIST_NORMAL) + +/// @brief design for FXLists +#define GUIDesignListExtended (LIST_NORMAL | FRAME_SUNKEN | FRAME_THICK | LAYOUT_FILL_X | LAYOUT_FILL_Y) + +/// @brief desgin for TabBooks +#define GUIDesignTabBook (TABBOOK_LEFTTABS | PACK_UNIFORM_WIDTH | PACK_UNIFORM_HEIGHT | LAYOUT_FILL_X | LAYOUT_FILL_Y | LAYOUT_RIGHT) + +#endif + +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIDialog_GLChosenEditor.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIDialog_GLChosenEditor.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIDialog_GLChosenEditor.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIDialog_GLChosenEditor.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Thu, 11.03.2004 -/// @version $Id: GUIDialog_GLChosenEditor.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIDialog_GLChosenEditor.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Editor for the list of chosen objects /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,13 +41,10 @@ #include #include #include +#include #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping @@ -90,7 +87,7 @@ ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 3, 3); - new FXHorizontalSeparator(layout, SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXHorizontalSeparator(layout, GUIDesignHorizontalSeparator); // "Deselect Chosen" new FXButton(layout, "Deselect Chosen\t\t", 0, this, MID_CHOOSEN_DESELECT, @@ -101,7 +98,7 @@ ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 3, 3); - new FXHorizontalSeparator(layout, SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXHorizontalSeparator(layout, GUIDesignHorizontalSeparator); // "Close" new FXButton(layout, "Close\t\t", 0, this, MID_CANCEL, diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIDialog_GLChosenEditor.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIDialog_GLChosenEditor.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIDialog_GLChosenEditor.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIDialog_GLChosenEditor.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Thu, 11.03.2004 -/// @version $Id: GUIDialog_GLChosenEditor.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIDialog_GLChosenEditor.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Editor for the list of chosen objects /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIGlobalSelection.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIGlobalSelection.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIGlobalSelection.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIGlobalSelection.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUIGlobalSelection.cpp /// @author Daniel Krajzewicz /// @date 2004 -/// @version $Id: GUIGlobalSelection.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIGlobalSelection.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A global holder of selected objects /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,10 +34,6 @@ #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // global variables definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIGlobalSelection.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIGlobalSelection.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIGlobalSelection.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIGlobalSelection.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUIGlobalSelection.h /// @author Daniel Krajzewicz /// @date Jun 2004 -/// @version $Id: GUIGlobalSelection.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIGlobalSelection.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A global holder of selected objects /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIIOGlobals.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIIOGlobals.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIIOGlobals.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIIOGlobals.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004-11-23 -/// @version $Id: GUIIOGlobals.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIIOGlobals.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The folder used as last /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,10 +31,6 @@ #include "GUIIOGlobals.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // global variable definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIIOGlobals.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIIOGlobals.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIIOGlobals.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIIOGlobals.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004-11-23 -/// @version $Id: GUIIOGlobals.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIIOGlobals.h 22608 2017-01-17 06:28:54Z behrisch $ /// // The folder used as last /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIMessageWindow.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIMessageWindow.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIMessageWindow.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIMessageWindow.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Tue, 25 Nov 2003 -/// @version $Id: GUIMessageWindow.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIMessageWindow.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A logging window for the gui /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2003-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2003-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include #include "GUIMessageWindow.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIMessageWindow.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIMessageWindow.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIMessageWindow.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIMessageWindow.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Tue, 25 Nov 2003 -/// @version $Id: GUIMessageWindow.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIMessageWindow.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A logging window for the gui /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2003-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2003-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIParameterTableItem.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIParameterTableItem.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIParameterTableItem.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIParameterTableItem.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date -/// @version $Id: GUIParameterTableItem.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIParameterTableItem.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A single line in a parameter window /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -82,11 +82,11 @@ virtual void update() = 0; - /** @brief Returns a SUMOReal-typed copy of the value-source + /** @brief Returns a double-typed copy of the value-source * - * @return A SUMOReal-typed copy of the value-source + * @return A double-typed copy of the value-source */ - virtual ValueSource* getSUMORealSourceCopy() const = 0; + virtual ValueSource* getdoubleSourceCopy() const = 0; /** @brief Returns the name of the value @@ -254,15 +254,15 @@ } - /** @brief Returns a SUMOReal-typed copy of the source if the value is dynamic + /** @brief Returns a double-typed copy of the source if the value is dynamic * - * @return A SUMOReal-typed copy of the value source + * @return A double-typed copy of the value source */ - ValueSource* getSUMORealSourceCopy() const { + ValueSource* getdoubleSourceCopy() const { if (mySource == 0) { return 0; } - return mySource->makeSUMORealReturningCopy(); + return mySource->makedoubleReturningCopy(); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIParameterTableWindow.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIParameterTableWindow.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIParameterTableWindow.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIParameterTableWindow.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: GUIParameterTableWindow.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: GUIParameterTableWindow.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The window that holds the table of an object's parameter /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,10 +42,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping @@ -69,12 +65,10 @@ // =========================================================================== // method definitions // =========================================================================== -GUIParameterTableWindow::GUIParameterTableWindow(GUIMainWindow& app, - GUIGlObject& o, int noRows) - : FXMainWindow(app.getApp(), (o.getFullName() + " Parameter").c_str(), - NULL, NULL, DECOR_ALL, 20, 20, 500, (FXint)(noRows * 20 + 60)), - myObject(&o), - myApplication(&app), myCurrentPos(0) { +GUIParameterTableWindow::GUIParameterTableWindow(GUIMainWindow& app, GUIGlObject& o, int noRows) : + FXMainWindow(app.getApp(), (o.getFullName() + " Parameter").c_str(), NULL, NULL, DECOR_ALL, 20, 20, 500, (FXint)(noRows * 20 + 60)), + myObject(&o), + myApplication(&app), myCurrentPos(0) { myTable = new FXTable(this, this, MID_TABLE, TABLE_COL_SIZABLE | TABLE_ROW_SIZABLE | LAYOUT_FILL_X | LAYOUT_FILL_Y); myTable->setVisibleRows((FXint)(noRows + 1)); myTable->setVisibleColumns(3); @@ -164,7 +158,7 @@ return 1; } - GUIParam_PopupMenuInterface* p = new GUIParam_PopupMenuInterface(*myApplication, *this, *myObject, i->getName(), i->getSUMORealSourceCopy()); + GUIParam_PopupMenuInterface* p = new GUIParam_PopupMenuInterface(*myApplication, *this, *myObject, i->getName(), i->getdoubleSourceCopy()); new FXMenuCommand(p, "Open in new Tracker", 0, p, MID_OPENTRACKER); // set geometry p->setX(static_cast(data)->root_x); @@ -195,8 +189,8 @@ void GUIParameterTableWindow::mkItem(const char* name, bool dynamic, - ValueSource* src) { - GUIParameterTableItemInterface* i = new GUIParameterTableItem(myTable, myCurrentPos++, name, dynamic, src); + ValueSource* src) { + GUIParameterTableItemInterface* i = new GUIParameterTableItem(myTable, myCurrentPos++, name, dynamic, src); myItems.push_back(i); } @@ -204,16 +198,16 @@ void GUIParameterTableWindow::mkItem(const char* name, bool dynamic, std::string value) { - // T = SUMOReal is only a dummy type here - GUIParameterTableItemInterface* i = new GUIParameterTableItem(myTable, myCurrentPos++, name, dynamic, value); + // T = double is only a dummy type here + GUIParameterTableItemInterface* i = new GUIParameterTableItem(myTable, myCurrentPos++, name, dynamic, value); myItems.push_back(i); } void GUIParameterTableWindow::mkItem(const char* name, bool dynamic, - SUMOReal value) { - GUIParameterTableItemInterface* i = new GUIParameterTableItem(myTable, myCurrentPos++, name, dynamic, value); + double value) { + GUIParameterTableItemInterface* i = new GUIParameterTableItem(myTable, myCurrentPos++, name, dynamic, value); myItems.push_back(i); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIParameterTableWindow.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIParameterTableWindow.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIParameterTableWindow.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIParameterTableWindow.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: GUIParameterTableWindow.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: GUIParameterTableWindow.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The window that holds the table of an object's parameter /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -122,13 +122,13 @@ void mkItem(const char* name, bool dynamic, ValueSource* src); - /** @brief Adds a row which obtains its value from an SUMOReal-ValueSource + /** @brief Adds a row which obtains its value from an double-ValueSource * * @param[in] name The name of the row entry * @param[in] dynamic Information whether the entry is dynamic * @param[in] src The value source to use */ - void mkItem(const char* name, bool dynamic, ValueSource* src); + void mkItem(const char* name, bool dynamic, ValueSource* src); /** @brief Adds a row which shows a string-value @@ -171,14 +171,14 @@ void mkItem(const char* name, bool dynamic, long long int value); - /** @brief Adds a row which shows a SUMOReal-value + /** @brief Adds a row which shows a double-value * * @param[in] name The name of the row entry * @param[in] dynamic Information whether the entry is dynamic * @param[in] value The value to show * @todo the dynamic-parameter is obsolete */ - void mkItem(const char* name, bool dynamic, SUMOReal value); + void mkItem(const char* name, bool dynamic, double value); /// @} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIParam_PopupMenu.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIParam_PopupMenu.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIParam_PopupMenu.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIParam_PopupMenu.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mai 2003 -/// @version $Id: GUIParam_PopupMenu.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIParam_PopupMenu.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A popup-menu for dynamic patameter table entries /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping @@ -60,7 +56,7 @@ // =========================================================================== GUIParam_PopupMenuInterface::GUIParam_PopupMenuInterface(GUIMainWindow& app, GUIParameterTableWindow& parentWindow, GUIGlObject& o, const std::string& varName, - ValueSource* src) + ValueSource* src) : FXMenuPane(&parentWindow), myObject(&o), myParentWindow(&parentWindow), myApplication(&app), myVarName(varName), mySource(src) { } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIParam_PopupMenu.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIParam_PopupMenu.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIParam_PopupMenu.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIParam_PopupMenu.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUIParam_PopupMenu.h /// @author Daniel Krajzewicz /// @date Mai 2003 -/// @version $Id: GUIParam_PopupMenu.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIParam_PopupMenu.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A popup-menu for dynamic patameter table entries /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -66,7 +66,7 @@ GUIParam_PopupMenuInterface(GUIMainWindow& app, GUIParameterTableWindow& parentWindow, GUIGlObject& o, const std::string& varName, - ValueSource* src); + ValueSource* src); /// @brief Destructor @@ -99,7 +99,7 @@ std::string myVarName; /// @brief The source of the value - ValueSource* mySource; + ValueSource* mySource; protected: /// @brief FOX needs this diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUISelectedStorage.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUISelectedStorage.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUISelectedStorage.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUISelectedStorage.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Jun 2004 -/// @version $Id: GUISelectedStorage.cpp 20975 2016-06-15 13:02:40Z palcraft $ +/// @version $Id: GUISelectedStorage.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Storage for "selected" objects /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,17 +38,15 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions // =========================================================================== + /* ------------------------------------------------------------------------- * for GUISelectedStorage::SingleTypeSelections * ----------------------------------------------------------------------- */ + GUISelectedStorage::SingleTypeSelections::SingleTypeSelections() {} @@ -90,11 +88,10 @@ return mySelected; } - - /* ------------------------------------------------------------------------- * for GUISelectedStorage * ----------------------------------------------------------------------- */ + GUISelectedStorage::GUISelectedStorage() {} @@ -285,4 +282,5 @@ } dev.close(); } + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUISelectedStorage.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUISelectedStorage.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUISelectedStorage.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUISelectedStorage.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Jun 2004 -/// @version $Id: GUISelectedStorage.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUISelectedStorage.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Storage for "selected" objects /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -77,9 +77,14 @@ class GUISelectedStorage { public: + /// @class update target class UpdateTarget { + public: + /// @brief virtual destructor virtual ~UpdateTarget() {}; + + /// @brief called when selection is updated virtual void selectionUpdated() = 0; }; @@ -87,11 +92,9 @@ /// @brief Constructor GUISelectedStorage(); - /// @brief Destructor ~GUISelectedStorage(); - /** @brief Returns the information whether the object with the given type and id is selected * * If the type is ==-1, it is determined, first. If it could not be obtained, @@ -110,7 +113,6 @@ */ bool isSelected(GUIGlObjectType type, GUIGlID id); - /** @brief Adds the object with the given id * * The id of the object is added to the sub-container that is @@ -128,7 +130,6 @@ */ void select(GUIGlID id, bool update = true); - /** @brief Deselects the object with the given id * * The id of the object is removed from the sub-container that is @@ -146,7 +147,6 @@ */ void deselect(GUIGlID id); - /** @brief Toggles selection of an object * * If the object can not be obtained a ProcessError is thrown. @@ -163,15 +163,9 @@ */ void toggleSelection(GUIGlID id); - - /** @brief Returns the list of ids of all selected objects - * - * - * @return The set of all selected objects (ids) - */ + /// @brief Returns the set of ids of all selected objects const std::set& getSelected() const; - /** @brief Returns the set of ids of all selected objects' of a certain type * * @param[in] type The type of the object @@ -180,7 +174,6 @@ */ const std::set& getSelected(GUIGlObjectType type); - /** @brief Clears the list of selected objects * * Clears the global container and all sub-containers via SingleTypeSelections::clear. @@ -189,7 +182,6 @@ */ void clear(); - /** @brief Loads a selection list (optionally with restricted type) * * @param[in] filename The name of the file to load the list of selected objects from @@ -198,7 +190,6 @@ */ std::string load(const std::string& filename, GUIGlObjectType type = GLO_MAX); - /** @brief Loads a selection list (optionally with restricted type) and * returns the ids of all active objects * @@ -210,7 +201,6 @@ */ std::set loadIDs(const std::string& filename, std::string& msgOut, GUIGlObjectType type = GLO_MAX, int maxErrors = 16); - /** @brief Saves a selection list * * @param[in] type The type of the objects to save @@ -224,23 +214,20 @@ */ void save(const std::string& filename) const; - /** @brief Adds a dialog to be updated * @param[in] updateTarget the callback for selection changes */ void add2Update(UpdateTarget* updateTarget); - - /** @brief Removes the dialog to be updated - */ + /// @brief @brief Removes the dialog to be updated void remove2Update(); - /** * @class SingleTypeSelections * @brief A container for ids of selected objects of a certain type. */ class SingleTypeSelections { + public: /// @brief Constructor SingleTypeSelections(); @@ -248,36 +235,30 @@ /// @brief Destructor ~SingleTypeSelections(); - /** @brief Returns the information whether the object with the given id is qithin the selection * @param[in] id The id of the object * @return Whether the object is selected */ bool isSelected(GUIGlID id); - /** @brief Adds the object with the given id to the list of selected objects * @param[in] id The id of the object */ void select(GUIGlID id); - /** @brief Deselects the object with the given id from the list of selected objects * @param[in] id The id of the object */ void deselect(GUIGlID id); - /// @brief Clears the list of selected objects void clear(); - /** @brief Saves the list of selected objects to a file named as given * @param[in] filename The name of the file to save the list into */ void save(const std::string& filename); - /** @brief Returns the list of selected ids * @return A list containing the ids of all selected objects */ @@ -288,10 +269,13 @@ std::set mySelected; }; + + /// @brief set SingleTypeSelections as friend class friend class SingleTypeSelections; private: + /// @brief map with the selections std::map mySelections; /// @brief List of selected objects @@ -300,14 +284,11 @@ /// @brief The dialog to be updated UpdateTarget* myUpdateTarget; - /* @brief load items into the given set, optionally restricting to type - */ + /// @brief load items into the given set, optionally restricting to type std::string load(GUIGlObjectType type, const std::string& filename, bool restrictType, std::set& into); - /// @brief saves items from the given set static void save(const std::string& filename, const std::set& ids); - }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIUserIO.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIUserIO.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIUserIO.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIUserIO.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2006-10-12 -/// @version $Id: GUIUserIO.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIUserIO.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Some OS-dependant functions to ease cliboard manipulation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,10 +31,6 @@ #include "GUIUserIO.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIUserIO.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIUserIO.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIUserIO.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIUserIO.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2006 -/// @version $Id: GUIUserIO.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIUserIO.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Some OS-dependant functions to ease cliboard manipulation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIVideoEncoder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIVideoEncoder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/GUIVideoEncoder.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/GUIVideoEncoder.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,7 +2,7 @@ /// @file GUIVideoEncoder.h /// @author Michael Behrisch /// @date Dec 2015 -/// @version $Id: GUIVideoEncoder.h 20851 2016-06-02 11:13:12Z rhilbrich $ +/// @version $Id: GUIVideoEncoder.h 24108 2017-04-27 18:43:30Z behrisch $ /// // A simple video encoder from RGBA pics to anything ffmpeg can handle. // Tested with h264 only. @@ -11,7 +11,7 @@ // https://github.com/codefromabove/FFmpegRGBAToYUV /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,6 +40,15 @@ #define __STDC_CONSTANT_MACROS +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4244) // do not warn about integer conversions +#endif +#if __GNUC__ > 3 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" +#pragma GCC diagnostic ignored "-Wvariadic-macros" +#endif extern "C" { #include @@ -48,6 +57,12 @@ #include #include } +#ifdef _MSC_VER +#pragma warning(pop) +#endif +#if __GNUC__ > 3 +#pragma GCC diagnostic pop +#endif class GUIVideoEncoder { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -10,4 +10,5 @@ GUISelectedStorage.cpp GUISelectedStorage.h \ GUIUserIO.cpp GUIUserIO.h GUIVideoEncoder.h \ GLHelper.cpp GLHelper.h \ +GUIDesigns.h \ GLObjectValuePassConnector.h diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/div/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/div/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -341,6 +341,7 @@ GUISelectedStorage.cpp GUISelectedStorage.h \ GUIUserIO.cpp GUIUserIO.h GUIVideoEncoder.h \ GLHelper.cpp GLHelper.h \ +GUIDesigns.h \ GLObjectValuePassConnector.h all: all-am diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/events/GUIEvent.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/events/GUIEvent.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/events/GUIEvent.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/events/GUIEvent.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUIEvent.h /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: GUIEvent.h 20995 2016-06-17 14:06:28Z behrisch $ +/// @version $Id: GUIEvent.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Definition of an own event class /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/events/GUIEvent_Message.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/events/GUIEvent_Message.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/events/GUIEvent_Message.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/events/GUIEvent_Message.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUIEvent_Message.h /// @author Daniel Krajzewicz /// @date Wed 18 Jun 2003 -/// @version $Id: GUIEvent_Message.h 20995 2016-06-17 14:06:28Z behrisch $ +/// @version $Id: GUIEvent_Message.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Event send when a message (message, warning, error) has to besubmitted /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/events/GUIEvent_SimulationStep.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/events/GUIEvent_SimulationStep.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/events/GUIEvent_SimulationStep.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/events/GUIEvent_SimulationStep.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUIEvent_SimulationStep.h /// @author Daniel Krajzewicz /// @date Sept 2002 -/// @version $Id: GUIEvent_SimulationStep.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIEvent_SimulationStep.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Event send when the a simulation step has been performed by GUIRunThread /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GLIncludes.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GLIncludes.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GLIncludes.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GLIncludes.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 2012 -/// @version $Id: GLIncludes.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GLIncludes.h 22608 2017-01-17 06:28:54Z behrisch $ /// // collection of includes for GL usage /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObject_AbstractAdd.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObject_AbstractAdd.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObject_AbstractAdd.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObject_AbstractAdd.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 2004 -/// @version $Id: GUIGlObject_AbstractAdd.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIGlObject_AbstractAdd.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Base class for additional objects (detectors etc.) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObject_AbstractAdd.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObject_AbstractAdd.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObject_AbstractAdd.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObject_AbstractAdd.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 2004 -/// @version $Id: GUIGlObject_AbstractAdd.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIGlObject_AbstractAdd.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Base class for additional objects (detectors etc.) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObject.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObject.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObject.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObject.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Sept 2002 -/// @version $Id: GUIGlObject.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUIGlObject.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Base class for all objects that may be displayed within the openGL-gui /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,10 +47,6 @@ #include "GUIGlObject.h" #include "GUIGlObjectStorage.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members // =========================================================================== @@ -285,7 +281,7 @@ void -GUIGlObject::drawName(const Position& pos, const SUMOReal scale, const GUIVisualizationTextSettings& settings, const SUMOReal angle) const { +GUIGlObject::drawName(const Position& pos, const double scale, const GUIVisualizationTextSettings& settings, const double angle) const { if (settings.show) { GLHelper::drawText(getMicrosimID(), pos, GLO_MAX, settings.size / scale, settings.color, angle); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObject.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObject.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObject.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObject.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Oct 2002 -/// @version $Id: GUIGlObject.h 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: GUIGlObject.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Base class for all objects that may be displayed within the openGL-gui /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -185,7 +185,7 @@ /// @} /// @brief draw name of item - void drawName(const Position& pos, const SUMOReal scale, const GUIVisualizationTextSettings& settings, const SUMOReal angle = 0) const; + void drawName(const Position& pos, const double scale, const GUIVisualizationTextSettings& settings, const double angle = 0) const; protected: /// @name helper methods for building popup-menus diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIGLObjectPopupMenu.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIGLObjectPopupMenu.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIGLObjectPopupMenu.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIGLObjectPopupMenu.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIGLObjectPopupMenu.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUIGLObjectPopupMenu.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The popup menu of a globject /****************************************************************************/ @@ -42,10 +42,6 @@ #include #include "GUIGLObjectPopupMenu.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - #define DEBUG_VEHICLE_GUI_SELECTION 1 // =========================================================================== @@ -147,7 +143,7 @@ Position pos = myNetworkPosition; GeoConvHelper::getFinal().cartesian2geo(pos); // formated for pasting into google maps - const std::string posString = toString(pos.y(), GEO_OUTPUT_ACCURACY) + ", " + toString(pos.x(), GEO_OUTPUT_ACCURACY); + const std::string posString = toString(pos.y(), gPrecisionGeo) + ", " + toString(pos.x(), gPrecisionGeo); GUIUserIO::copyToClipboard(*myParent->getApp(), posString); return 1; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIGLObjectPopupMenu.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIGLObjectPopupMenu.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIGLObjectPopupMenu.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIGLObjectPopupMenu.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIGLObjectPopupMenu.h 21640 2016-10-09 20:28:52Z palcraft $ +/// @version $Id: GUIGLObjectPopupMenu.h 22608 2017-01-17 06:28:54Z behrisch $ /// // The popup menu of a globject. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObjectStorage.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObjectStorage.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObjectStorage.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObjectStorage.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIGlObjectStorage.cpp 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: GUIGlObjectStorage.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A storage for displayed objects via their numerical id /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include "GUIGlObject.h" #include "GUIGlObjectStorage.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static variables (instances in this case) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObjectStorage.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObjectStorage.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObjectStorage.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObjectStorage.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Oct 2002 -/// @version $Id: GUIGlObjectStorage.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIGlObjectStorage.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A storage for displayed objects via their numerical id /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObjectTypes.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObjectTypes.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObjectTypes.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIGlObjectTypes.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,14 +4,14 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIGlObjectTypes.h 20975 2016-06-15 13:02:40Z palcraft $ +/// @version $Id: GUIGlObjectTypes.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A list of object types which may be displayed within the gui // each type has an associated string which will be prefefixed to an object id // when constructing the full name /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIPointOfInterest.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIPointOfInterest.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIPointOfInterest.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIPointOfInterest.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date June 2006 -/// @version $Id: GUIPointOfInterest.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: GUIPointOfInterest.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The GUI-version of a point of interest /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,18 +43,14 @@ #include #include "GUIPointOfInterest.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions // =========================================================================== GUIPointOfInterest::GUIPointOfInterest(const std::string& id, const std::string& type, const RGBColor& color, const Position& pos, - SUMOReal layer, SUMOReal angle, const std::string& imgFile, - SUMOReal width, SUMOReal height) : + double layer, double angle, const std::string& imgFile, + double width, double height) : PointOfInterest(id, type, color, pos, layer, angle, imgFile, width, height), GUIGlObject_AbstractAdd("poi", GLO_POI, id) { } @@ -103,7 +99,7 @@ void GUIPointOfInterest::drawGL(const GUIVisualizationSettings& s) const { - const SUMOReal exaggeration = s.poiSize.getExaggeration(s); + const double exaggeration = s.poiSize.getExaggeration(s); if (s.scale * (1.3 / 3.0) *exaggeration < s.poiSize.minSize) { return; } @@ -122,7 +118,7 @@ } } else { // fallback if no image is defined - GLHelper::drawFilledCircle((SUMOReal) 1.3 * exaggeration, 16); + GLHelper::drawFilledCircle((double) 1.3 * exaggeration, 16); } glPopMatrix(); const Position namePos = Position(x() + 1.32 * exaggeration, y() + 1.32 * exaggeration); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIPointOfInterest.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIPointOfInterest.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIPointOfInterest.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIPointOfInterest.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date June 2006 -/// @version $Id: GUIPointOfInterest.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIPointOfInterest.h 23150 2017-02-27 12:08:30Z behrisch $ /// // missing_desc /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -65,8 +65,8 @@ */ GUIPointOfInterest(const std::string& id, const std::string& type, const RGBColor& color, const Position& pos, - SUMOReal layer, SUMOReal angle, const std::string& imgFile, - SUMOReal width, SUMOReal height); + double layer, double angle, const std::string& imgFile, + double width, double height); /// @brief Destructor virtual ~GUIPointOfInterest(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIPolygon.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIPolygon.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIPolygon.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIPolygon.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date June 2006 -/// @version $Id: GUIPolygon.cpp 21316 2016-08-22 13:08:50Z behrisch $ +/// @version $Id: GUIPolygon.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The GUI-version of a polygon /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,10 +40,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - //#define GUIPolygon_DEBUG_DRAW_VERTICES // =========================================================================== @@ -51,7 +47,7 @@ // =========================================================================== GUIPolygon::GUIPolygon(const std::string& id, const std::string& type, const RGBColor& color, const PositionVector& shape, bool fill, - SUMOReal layer, SUMOReal angle, const std::string& imgFile): + double layer, double angle, const std::string& imgFile): Polygon(id, type, color, shape, fill, layer, angle, imgFile), GUIGlObject_AbstractAdd("poly", GLO_POLYGON, id), myDisplayList(0), @@ -228,7 +224,7 @@ void -GUIPolygon::performTesselation(SUMOReal lineWidth) const { +GUIPolygon::performTesselation(double lineWidth) const { if (getFill()) { // draw the tesselated shape double* points = new double[myShape.size() * 3]; @@ -262,7 +258,7 @@ void -GUIPolygon::storeTesselation(SUMOReal lineWidth) const { +GUIPolygon::storeTesselation(double lineWidth) const { if (myDisplayList > 0) { glDeleteLists(myDisplayList, 1); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIPolygon.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIPolygon.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIPolygon.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIPolygon.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date June 2006 -/// @version $Id: GUIPolygon.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIPolygon.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The GUI-version of a polygon /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -61,7 +61,7 @@ */ GUIPolygon(const std::string& id, const std::string& type, const RGBColor& color, const PositionVector& shape, bool fill, - SUMOReal layer = 0, SUMOReal angle = 0, const std::string& imgFile = ""); + double layer = 0, double angle = 0, const std::string& imgFile = ""); /// @brief Destructor ~GUIPolygon(); @@ -113,7 +113,7 @@ virtual void setShape(const PositionVector& shape); /// @brief set a new shape and update the tesselation - void setLineWidth(SUMOReal lineWidth) { + void setLineWidth(double lineWidth) { myLineWidth = lineWidth; } @@ -125,13 +125,13 @@ mutable GLuint myDisplayList; /// @brief the previous line width for deciding whether the display list must be refreshed - mutable SUMOReal myLineWidth; + mutable double myLineWidth; /// @brief store the drawing commands in a display list - void storeTesselation(SUMOReal lineWidth) const; + void storeTesselation(double lineWidth) const; // @brief perform the tesselation / drawing - void performTesselation(SUMOReal lineWidth) const; + void performTesselation(double lineWidth) const; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIShapeContainer.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIShapeContainer.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIShapeContainer.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIShapeContainer.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 08.10.2009 -/// @version $Id: GUIShapeContainer.cpp 21148 2016-07-12 08:47:10Z behrisch $ +/// @version $Id: GUIShapeContainer.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Storage for geometrical objects extended by mutexes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -54,8 +50,8 @@ bool GUIShapeContainer::addPOI(const std::string& id, const std::string& type, - const RGBColor& color, SUMOReal layer, SUMOReal angle, const std::string& imgFile, - const Position& pos, SUMOReal width, SUMOReal height, bool /* ignorePruning */) { + const RGBColor& color, double layer, double angle, const std::string& imgFile, + const Position& pos, double width, double height, bool /* ignorePruning */) { GUIPointOfInterest* p = new GUIPointOfInterest(id, type, color, pos, layer, angle, imgFile, width, height); AbstractMutex::ScopedLocker locker(myLock); if (!myPOIs.add(id, p)) { @@ -70,8 +66,8 @@ bool GUIShapeContainer::addPolygon(const std::string& id, const std::string& type, - const RGBColor& color, SUMOReal layer, - SUMOReal angle, const std::string& imgFile, + const RGBColor& color, double layer, + double angle, const std::string& imgFile, const PositionVector& shape, bool fill, bool /* ignorePruning */) { GUIPolygon* p = new GUIPolygon(id, type, color, shape, fill, layer, angle, imgFile); AbstractMutex::ScopedLocker locker(myLock); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIShapeContainer.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIShapeContainer.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/globjects/GUIShapeContainer.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/globjects/GUIShapeContainer.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 08.10.2009 -/// @version $Id: GUIShapeContainer.h 20801 2016-05-28 05:31:30Z behrisch $ +/// @version $Id: GUIShapeContainer.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Storage for geometrical objects extended by mutexes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -73,8 +73,8 @@ * @return whether the polygon could be added */ virtual bool addPolygon(const std::string& id, const std::string& type, - const RGBColor& color, SUMOReal layer, - SUMOReal angle, const std::string& imgFile, + const RGBColor& color, double layer, + double angle, const std::string& imgFile, const PositionVector& shape, bool fill, bool ignorePruning = false); @@ -91,8 +91,8 @@ * @return whether the poi could be added */ virtual bool addPOI(const std::string& id, const std::string& type, - const RGBColor& color, SUMOReal layer, SUMOReal angle, const std::string& imgFile, - const Position& pos, SUMOReal width, SUMOReal height, bool ignorePruning = false); + const RGBColor& color, double layer, double angle, const std::string& imgFile, + const Position& pos, double width, double height, bool ignorePruning = false); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/accept.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/accept.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/accept.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/accept.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,52 @@ +/* XPM */ +static const char *accept_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 30 1 ", +" c #26AD87", +". c #25AE87", +"X c #25AE88", +"o c #25AF89", +"O c #26AE88", +"+ c #28AF89", +"@ c #28AF8A", +"# c #2BB08B", +"$ c #2EB18D", +"% c #33B38F", +"& c #34B390", +"* c #35B491", +"= c #39B593", +"- c #3CB795", +"; c #40B896", +": c #44B999", +"> c #46BA9A", +", c #56C0A3", +"< c #63C5AA", +"1 c #69C7AD", +"2 c #80D0B9", +"3 c #86D2BD", +"4 c #8FD5C2", +"5 c #96D8C6", +"6 c #9DDAC9", +"7 c #AEE1D3", +"8 c #B6E4D7", +"9 c #B9E5D9", +"0 c #BEE7DC", +"q c None", +/* pixels */ +"qqqqqo. o qqqqq", +"qqqqXX.oo.XXqqqq", +"qqooXXXX XXX.oqq", +"qqo.XXXXXXXXooqq", +"qoo o XXo.o-&o.q", +".. oXXXX &0=.oq", +".o. XXXXo+9:o...", +"o.o+$XXXo7,o.o.o", +"o o-0:XX61XXXXXX", +" o o&8<32 oXXXX", +" .o oo54o o .oXq", +"qo o oXX o oo.oq", +"qqo.o oXo o.. qq", +"qqoo.o X o.oooqq", +"qqqqo.XXo o.qqqq", +"qqqqq . o..qqqqq" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/busstop.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/busstop.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/busstop.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/busstop.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,76 @@ +/* XPM */ +static const char *busstop_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 54 1 ", +" c #57AE2F", +". c #59AF2E", +"X c #5BAF2E", +"o c #4BA831", +"O c #4BA931", +"+ c #4BAA31", +"@ c #4BA932", +"# c #4BAA32", +"$ c #4CA931", +"% c #4CAA31", +"& c #4EAB31", +"* c #4FAB31", +"= c #4CA932", +"- c #4CAA32", +"; c #4DAA32", +": c #4DAB32", +"> c #52AC30", +", c #54AD30", +"< c #55AD30", +"1 c #65B32B", +"2 c #66B42B", +"3 c #76B926", +"4 c #7ABB25", +"5 c #7EBC24", +"6 c #83BE23", +"7 c #93C41E", +"8 c #97C51D", +"9 c #94C41E", +"0 c #95C41E", +"q c #9CC71C", +"w c #A1C91A", +"e c #A4CA19", +"r c #A5CA19", +"t c #A6CB19", +"y c #A7CB19", +"u c #A8CC18", +"i c #B5D015", +"p c #BDD312", +"a c #BCD313", +"s c #C8D70F", +"d c #C9D70F", +"f c #EDE405", +"g c #EEE505", +"h c #F4E703", +"j c #F0E604", +"k c #F2E604", +"l c #F6E802", +"z c #F8E802", +"x c #F8E902", +"c c #FDEA00", +"v c #FCEA01", +"b c #FDEA01", +"n c #FFEB00", +"m c None", +/* pixels */ +"mmmmm=O==Ommmmmm", +"mmm=O<6q05&&mmmm", +"mm==rknnnng0:Omm", +"mO>dnnnnnnnna&mm", +"m=ynnxxnnxxnn7Om", +"OXcnn53nn>5nnh&m", +"=0nnn53nn>5nnn5O", +"=unnn5 44#5nnnw&", +"&pnnn51ii&5nnnyO", +"O0nnn53nn>5nnn6#", +"O2nnn53nn<5ncz.#", +"mO7nnxnnnxcnnr-m", +"mm&annnnnnnns-=m", +"mm#O0gnnnngy--mm", +"mmmm&&50q6<==mmm", +"mmmmmm=O:O=mmmmm" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/calibrator.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/calibrator.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/calibrator.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/calibrator.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,278 @@ +/* XPM */ +static const char *calibrator_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 256 2 ", +" c #FFCC00", +". c #FFCC00", +"X c #FFCC00", +"o c #FFCC00", +"O c #FFCC00", +"+ c #FFCC00", +"@ c #FFCC00", +"# c #FFCC00", +"$ c #FFCC00", +"% c #FFCC00", +"& c #FFCC00", +"* c #FFCC00", +"= c #FFCC00", +"- c #FFCC00", +"; c #FFCC00", +": c #FFCC00", +"> c #FFCC00", +", c #FFCC00", +"< c #FFCC00", +"1 c #FFCC00", +"2 c #FFCC00", +"3 c #FFCC00", +"4 c #FFCC00", +"5 c #FFCC00", +"6 c #FFCC00", +"7 c #FFCC00", +"8 c #FFCC00", +"9 c #FFCC00", +"0 c #FFCC00", +"q c #FFCC00", +"w c #FFCC00", +"e c #FFCC00", +"r c #FFCC00", +"t c #FFCC00", +"y c #FFCC00", +"u c #FFCC00", +"i c #FFCC00", +"p c #FFCC00", +"a c #FFCC00", +"s c #F1C100", +"d c #DBAF00", +"f c #DBAF00", +"g c #E7B900", +"h c #FFCC00", +"j c #FFCC00", +"k c #FFCC00", +"l c #FFCC00", +"z c #FFCC00", +"x c #FFCC00", +"c c #FFCC00", +"v c #FFCC00", +"b c #FFCC00", +"n c #FFCC00", +"m c #E3B600", +"M c #564500", +"N c #030200", +"B c black", +"V c black", +"C c #010100", +"Z c #382D00", +"A c #E3B600", +"S c #FFCC00", +"D c #FFCC00", +"F c #FFCC00", +"G c #FFCC00", +"H c #FFCC00", +"J c #FFCC00", +"K c #FFCC00", +"L c #D5AA00", +"P c #100D00", +"I c black", +"U c #020200", +"Y c #332900", +"T c #5A4800", +"R c #2D2400", +"E c #030200", +"W c #CEA500", +"Q c #FFCC00", +"! c #FFCC00", +"~ c #FFCC00", +"^ c #FFCC00", +"/ c #FFCC00", +"( c #FFCC00", +") c #FFCC00", +"_ c #4B3C00", +"` c black", +"' c #030300", +"] c #C39C00", +"[ c #FFCC00", +"{ c #FFCC00", +"} c #FFCC00", +"| c #D4AA00", +" . c #E6B800", +".. c #FFCC00", +"X. c #FFCC00", +"o. c #FFCC00", +"O. c #FFCC00", +"+. c #FFCC00", +"@. c #FFCC00", +"#. c #DCB000", +"$. c black", +"%. c black", +"&. c #634F00", +"*. c #FFCC00", +"=. c #FFCC00", +"-. c #FFCC00", +";. c #FFCC00", +":. c #FFCC00", +">. c #FFCC00", +",. c #FFCC00", +"<. c #FFCC00", +"1. c #FFCC00", +"2. c #FFCC00", +"3. c #FFCC00", +"4. c #FFCC00", +"5. c #BC9600", +"6. c black", +"7. c black", +"8. c #A18100", +"9. c #FFCC00", +"0. c #FFCC00", +"q. c #FFCC00", +"w. c #FFCC00", +"e. c #FFCC00", +"r. c #FFCC00", +"t. c #FFCC00", +"y. c #FFCC00", +"u. c #FFCC00", +"i. c #FFCC00", +"p. c #FFCC00", +"a. c #FFCC00", +"s. c #B38F00", +"d. c black", +"f. c black", +"g. c #987A00", +"h. c #FFCC00", +"j. c #FFCC00", +"k. c #FFCC00", +"l. c #FFCC00", +"z. c #FFCC00", +"x. c #FFCC00", +"c. c #FFCC00", +"v. c #FFCC00", +"b. c #FFCC00", +"n. c #FFCC00", +"m. c #FFCC00", +"M. c #FFCC00", +"N. c #E6B800", +"B. c black", +"V. c black", +"C. c #614D00", +"Z. c #FFCC00", +"A. c #FFCC00", +"S. c #FFCC00", +"D. c #FFCC00", +"F. c #FFCC00", +"G. c #FFCC00", +"H. c #FFCC00", +"J. c #FFCC00", +"K. c #FFCC00", +"L. c #FFCC00", +"P. c #FFCC00", +"I. c #FFCC00", +"U. c #FFCC00", +"Y. c #453800", +"T. c black", +"R. c #020100", +"E. c #B79200", +"W. c #FFCC00", +"Q. c #FFCC00", +"!. c #FFCC00", +"~. c #B69200", +"^. c #E6B800", +"/. c #FFCC00", +"(. c #FFCC00", +"). c #FFCC00", +"_. c #FFCC00", +"`. c #FFCC00", +"'. c #FFCC00", +"]. c #FFCC00", +"[. c #D7AC00", +"{. c #151100", +"}. c black", +"|. c #010000", +" X c #271F00", +".X c #3D3100", +"XX c #292100", +"oX c black", +"OX c #CEA500", +"+X c #FFCC00", +"@X c #FFCC00", +"#X c #FFCC00", +"$X c #FFCC00", +"%X c #FFCC00", +"&X c #FFCC00", +"*X c #FFCC00", +"=X c #FFCC00", +"-X c #DAAE00", +";X c #5F4C00", +":X c #0D0A00", +">X c black", +",X c black", +" , < 1 2 3 4 5 6 7 8 9 0 q w e ", +"r t y u i p a s d f g h j k l z ", +"x c v b n m M N B V C Z A S D F ", +"G H J K L P I U Y T R E W Q ! ~ ", +"^ / ( ) _ ` ' ] [ { } | ...X.o.", +"O.+.@.#.$.%.&.*.=.-.;.:.>.,.<.1.", +"2.3.4.5.6.7.8.9.0.q.w.e.r.t.y.u.", +"i.p.a.s.d.f.g.h.j.k.l.z.x.c.v.b.", +"n.m.M.N.B.V.C.Z.A.S.D.F.G.H.J.K.", +"L.P.I.U.Y.T.R.E.W.Q.!.~.^./.(.).", +"_.`.'.].[.{.}.|. X.XXXoXOX+X@X#X", +"$X%X&X*X=X-X;X:X>X,X c #E1E636", +", c #E0E637", +"< c #BCDF77", +"1 c #BBDF7A", +"2 c #BCDF78", +"3 c #D4E34C", +"4 c #CEE258", +"5 c #D2E351", +"6 c #C6E167", +"7 c #C5E168", +"8 c #C4E069", +"9 c #C1E06F", +"0 c #C2E06E", +"q c #C0E070", +"w c #7FD4E4", +"e c #7ED4E6", +"r c #7ED4E7", +"t c #7DD4E8", +"y c #7CD4E9", +"u c #7DD4E9", +"i c #7AD3ED", +"p c #75D2F7", +"a c #78D3F0", +"s c #78D3F1", +"d c #78D3F2", +"f c #73D2F9", +"g c #71D1FA", +"h c #71D1FB", +"j c #72D1FB", +"k c #71D2FB", +"l c #73D2FA", +"z c #72D2FB", +"x c #73D2FB", +"c c #74D2F9", +"v c #72D1FC", +"b c #72D1FD", +"n c #71D2FC", +"m c #71D2FD", +"M c #71D3FD", +"N c #72D2FC", +"B c #72D2FD", +"V c #B6DE82", +"C c #B4DE86", +"Z c #B1DD8C", +"A c #ABDC96", +"S c #A8DC9B", +"D c #A4DBA3", +"F c #A2DAA7", +"G c #8DD7CC", +"H c #84D5DB", +"J c None", +/* pixels */ +"JJJJJxxvvxkJJJJJ", +"JJJvveZqqZevxJJJ", +"JJvp6 +7xxJJ", +"Jvs* *dxJ", +"Jv9 %,:o .9vJ", +"vr +SxidC ..yx", +"kA 4v1 +: Ax", +"M1 Zd+ 1v", +"v1 Vx& 1v", +"xF ,xD:;5 FM", +"vr$ 3GyH4 $yv", +"Jv1 2MJ", +"Jvd* *dMJ", +"JJkk7+ +7vMJJ", +"JJJMveZqqZrvvJJJ", +"JJJJJkxMvvxJJJJJ" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/cleanjunctions.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/cleanjunctions.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/cleanjunctions.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/cleanjunctions.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,107 @@ +/* XPM */ +static const char *cleanjunctions_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 85 1 ", +" c #870606", +". c #8F0100", +"X c #B60706", +"o c #C63734", +"O c #D13836", +"+ c #8E7404", +"@ c #8F7911", +"# c #A97116", +"$ c #A77018", +"% c #BB7B13", +"& c #AE4529", +"* c #B95C3B", +"= c #B66227", +"- c #A67424", +"; c #A97728", +": c #AB7A2C", +"> c #AE7C2E", +", c #B17C27", +"< c #BA7735", +"1 c #9B8213", +"2 c #B28110", +"3 c #BA8633", +"4 c #BF8F35", +"5 c #D6BC08", +"6 c #D9BE10", +"7 c #D8BE12", +"8 c #D7BD19", +"9 c #D6BC1F", +"0 c #C58827", +"q c #C68826", +"w c #C1A82D", +"e c #C3AA2F", +"r c #CFB127", +"t c #D0B220", +"y c #D2B528", +"u c #D3B529", +"i c #D8BF29", +"p c #C9B237", +"a c #D8BF31", +"s c #D3B938", +"d c #D4BB38", +"f c #D5BD3A", +"g c #D2BB3E", +"h c #DEC619", +"j c #E2C917", +"k c #E5CB1E", +"l c #DAC022", +"z c #DCC427", +"x c #DCC527", +"c c #DDC62D", +"v c #DDC72E", +"b c #DEC829", +"n c #DBC433", +"m c #DDC730", +"M c #DEC936", +"N c #D9C03A", +"B c #DBC13F", +"V c #DBC43D", +"C c #E1C620", +"Z c #E9CF22", +"A c #E0C72E", +"S c #EAD220", +"D c #EBD224", +"F c #E6D02C", +"G c #E0CB3B", +"H c #EED433", +"J c #E7D338", +"K c #E9D43E", +"L c #F5DC30", +"P c #F4DD32", +"I c #F5DE3E", +"U c #B58943", +"Y c #D8C049", +"T c #DAC34B", +"R c #DFCB50", +"E c #DFC852", +"W c #F6DF40", +"Q c #E0CB5C", +"! c #FAE440", +"~ c #FBE649", +"^ c #F7E257", +"/ c #E2C466", +"( c #EACF68", +") c #F6E56D", +"_ c None", +/* pixels */ +"-:______________", +">U3_____________", +";00_____________", +"_,%$____________", +"__#2EB__________", +"__r)/& _________", +"__u=Oo<_________", +"__.X*(!Ky_______", +"___4~^ISbd______", +"___NPIHZhvT_____", +"___tFDLC6znQ____", +"____Mjkvz5GnT___", +"____f6zJ9znp____", +"____1Vv8Rg+_____", +"_____wsw@_______", +"________________" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/computejunctions.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/computejunctions.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/computejunctions.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/computejunctions.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,96 @@ +/* XPM */ +static const char *computejunctions_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 74 1 ", +" c #D79300", +". c #DB9401", +"X c #DF9C00", +"o c #DC9E00", +"O c #DDA000", +"+ c #E0A301", +"@ c #E1A500", +"# c #E4AC00", +"$ c #E8AE00", +"% c #E8B100", +"& c #EAB500", +"* c #EEB700", +"= c #ECB900", +"- c #EEB800", +"; c #F0BE00", +": c #DBA220", +"> c #F1C200", +", c #F2C500", +"< c #F0C700", +"1 c #F3C900", +"2 c #F4CC00", +"3 c #F5CF00", +"4 c #F5D100", +"5 c #939292", +"6 c #979797", +"7 c #B4A391", +"8 c #B5A99F", +"9 c #A4A4A4", +"0 c #A5A5A5", +"q c #AFA7A2", +"w c #ADACAC", +"e c gray68", +"r c #AFADAD", +"t c #B3AFAD", +"y c #B2B1B1", +"u c #B2B1B2", +"i c #B4B3B3", +"p c #B4B4B5", +"a c #B7B6B6", +"s c #B7B7B7", +"d c gray72", +"f c #B9B9B9", +"g c #BAB9B9", +"h c gray73", +"j c #BCBBBB", +"k c gray74", +"l c #C0BFBF", +"z c #BFBFC0", +"x c #C2C1C1", +"c c gray76", +"v c #C3C3C3", +"b c #C4C3C3", +"n c #C5C5C7", +"m c #C6C5C6", +"M c #C6C6C6", +"N c gray78", +"B c #C9C8C8", +"V c #CDCDCE", +"C c #CECECE", +"Z c gray81", +"A c #D0CFCF", +"S c #D0D0D1", +"D c gray82", +"F c LightGray", +"G c #D3D3D4", +"H c #D4D4D5", +"J c #D5D4D5", +"K c gray84", +"L c #D9D9DA", +"P c gray86", +"I c #DEDDDE", +"U c #E2E1E2", +"Y c #E2E2E3", +"T c None", +/* pixels */ +"TTTTTTTTTTTTTTTT", +"T#3-TTTThVTTTVT", +"TT@<4%TTTeINdSkT", +"TTTT&2OTThAPYKTT", +"TTTTTX-+8MBeTTTT", +"TTTTTT.:tbTTTTTT", +"TTTTTT7qj6TTTTTT", +"TTTTTyvl5aTTTTTT", +"TT0SKVbTTTyTTTTT", +"TTShzKvTTTTeTTTT", +"TTKTT0STTTTTyMTT", +"TTTTThNTTTTTeYTT", +"TTTTTpTTTTTTTTTT", +"TTTTTTTTTTTTTTTT" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/connection.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/connection.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/connection.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/connection.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,278 @@ +/* XPM */ +static const char *connection_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 256 2 ", +" c black", +". c #2B2C7C", +"X c #2C2D7C", +"o c #2D2E7D", +"O c #2F307E", +"+ c #30317F", +"@ c #31327F", +"# c #323380", +"$ c #373783", +"% c #373883", +"& c #373884", +"* c #404189", +"= c #42438A", +"- c #44458B", +"; c #494A8D", +": c #4A4B8F", +"> c #4C4D90", +", c #515191", +"< c #515291", +"1 c #565797", +"2 c #595A96", +"3 c #595A99", +"4 c #5D5E9B", +"5 c #626398", +"6 c #636399", +"7 c #63639B", +"8 c #61619D", +"9 c #62639E", +"0 c #636499", +"q c #6869A2", +"w c #6B6CA4", +"e c #6C6CA4", +"r c #7778A5", +"t c #7879A6", +"y c #7B7BA7", +"u c #7878AB", +"i c #7F80AA", +"p c #7F80B0", +"a c #8788B5", +"s c #8A8BB7", +"d c #8D8EB9", +"f c #9090B4", +"g c #9191B5", +"h c #9494B7", +"j c #9A9BBB", +"k c #9D9DC2", +"l c #A0A0C4", +"z c #AAAAC4", +"x c #ADAECD", +"c c #B7B7CB", +"v c #BABACE", +"b c #B7B7D2", +"n c #B7B8D3", +"m c #BDBDD6", +"M c #BEBED7", +"N c #C1C1D2", +"B c #C2C2D3", +"V c #C7C7D5", +"C c #C0C1D8", +"Z c #C3C3DA", +"A c #C5C5DB", +"S c #C8C8D6", +"D c #C8C8D7", +"F c #CFCFDB", +"G c #D0D0DB", +"H c #CDCDE0", +"J c #DBDBE9", +"K c #DDDDEA", +"L c #DEDFEB", +"P c #EAEAF2", +"I c #EBEBF3", +"U c #ECECF3", +"Y c #F1F1F6", +"T c #F1F1F7", +"R c #F2F2F7", +"E c #F3F3F8", +"W c #F4F4F8", +"Q c #F5F5F9", +"! c gray100", +"~ c black", +"^ c black", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" W C 9 4 . . . . . . y ", +"r . . . . E m . . a b = . . . 6 ", +"t . . . . E M O = w ! Q d + . 0 ", +"h . . . . R I R ! ! ! ! ! L - i ", +"F . . . . R ! K k x ! ! J 8 . v ", +"UX7 . . . R U % . p W s O . < UX", +"UXG & . . T A . . 1 * . . @ B UX", +"UXUXc & . Y Z . . . . . # z UXUX", +"UXUXUXG 7 q 3 . . . . 2 S UXUXUX", +"UXUXUXUXUXF h t r g D UXUXUXUXUX" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/containerstop.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/containerstop.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/containerstop.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/containerstop.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,69 @@ +/* XPM */ +static const char *containerstop_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 47 1 ", +" c #5159AB", +". c #5258AA", +"X c #5258AB", +"o c #5358AB", +"O c #5359AB", +"+ c #5258AC", +"@ c #5358AC", +"# c #5259AC", +"$ c #5359AC", +"% c #5359AD", +"& c #545AAC", +"* c #555BAC", +"= c #565CAC", +"- c #575DAD", +"; c #585EAD", +": c #5A60AD", +"> c #666DAF", +", c #686FAF", +"< c #696FAF", +"1 c #6C72B0", +"2 c #6D73B0", +"3 c #6E74B0", +"4 c #6F75B0", +"5 c #6F76B0", +"6 c #7076B0", +"7 c #7077B0", +"8 c #7177B0", +"9 c #737AB1", +"0 c #767CB1", +"q c #767DB1", +"w c #7B82B2", +"e c #7C83B2", +"r c #7D84B2", +"t c #7E84B2", +"y c #8188B3", +"u c #8289B3", +"i c #8389B3", +"p c #838AB3", +"a c #8990B4", +"s c #8B92B4", +"d c #8D94B4", +"f c #8E95B4", +"g c #8F96B5", +"h c #9097B5", +"j c #9198B5", +"k c #9299B5", +"l c None", +/* pixels */ +"llllloooo olllll", +"lllo$&,55,=oolll", +"llo$5gkjhjg7$$ll", +"l$&ekkkjjjjjr=$l", +"l$9jjjjjgjkkj9$l", +"$=jjjjq===qkjh=$", +"$,jjkpo5hspjjj5X", +"+9jjk8=gjjjjjj9$", +"oqkjj7ofjjjjkkq$", +"$ c #414141", +", c #4C4C4C", +"< c gray30", +"1 c gray31", +"2 c #505050", +"3 c #515151", +"4 c gray32", +"5 c #5D5D5D", +"6 c #606060", +"7 c gray38", +"8 c gray39", +"9 c gray40", +"0 c #6F6F6F", +"q c blue", +"w c #0303FF", +"e c #0404FF", +"r c #0606FF", +"t c #0A0AFF", +"y c #0C0CFF", +"u c #1111FF", +"i c #1515FF", +"p c #1919FF", +"a c #1F1FFF", +"s c #2424FF", +"d c #2D2DFF", +"f c #3232FF", +"g c #3737FF", +"h c #4949FF", +"j c #4F4FFF", +"k c #5050FF", +"l c #5A5AFF", +"z c #6161FF", +"x c #6868FF", +"c c #7A7AFF", +"v c #808080", +"b c gray52", +"n c gray55", +"m c #8D8D8D", +"M c gray57", +"N c #929292", +"B c #939393", +"V c #979797", +"C c gray60", +"Z c #A0A0A0", +"A c gray63", +"S c gray65", +"D c #B4B4B4", +"F c #8080FF", +"G c #8787FF", +"H c #8B8BFF", +"J c #9999FF", +"K c #A3A3FF", +"L c #AAAAFF", +"P c #BCBCFF", +"I c #C3C3C3", +"U c gray78", +"Y c #CACACA", +"T c #D0D0D0", +"R c gray84", +"E c #D8D8D8", +"W c gray86", +"Q c #DDDDDD", +"! c gray87", +"~ c #C2C2FF", +"^ c #D2D2FF", +"/ c #D7D7FF", +"( c #E1E1E1", +") c #E4E4E4", +"_ c #E9E9E9", +"` c gray92", +"' c #EFEFEF", +"] c #E3E3FF", +"[ c #E7E7FF", +"{ c #EDEDFF", +"} c gray94", +"| c #F3F3F3", +" . c #F1F1FF", +".. c #F4F4FF", +"X. c #F7F7FF", +"o. c gray98", +"O. c #F9F9FF", +"+. c gray99", +"@. c #FCFCFE", +"#. c #FEFEFE", +"$. c #FEFEFF", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" $.^ w q q ", +"q q y [ $.$.I + 7 D #.$.$.z q q ", +"q q F $.$.o.@ Z U # ' $.$.] t q ", +"q p ..+.W S - | ! 0 9 Q ` $.c q ", +"q J $.v O : B n ( & ; $ } .i ", +"q { _ 4 m V | N 1 Y R T 1 A $.l ", +"q d k k k k k k k k k k k k h r ", +"q q q q q q q q q q q q q q q q " +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/dlr.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/dlr.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/dlr.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/dlr.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,327 @@ +/* XPM */ +static const char *dlr_xpm[] = { +/* width height num_colors chars_per_pixel */ +" 64 64 256 2", +/* colors */ +"`` c #231f20", +"`. c #242021", +"`# c #252122", +"`a c #262222", +"`b c #272324", +"`c c #282425", +"`d c #292526", +"`e c #292626", +"`f c #2a2627", +"`g c #2b2728", +"`h c #2b2829", +"`i c #2d2929", +"`j c #2e2a2b", +"`k c #2f2b2c", +"`l c #302d2d", +"`m c #312d2e", +"`n c #332e2f", +"`o c #332f30", +"`p c #383435", +"`q c #3c3739", +"`r c #3c393a", +"`s c #413d3e", +"`t c #423e3e", +"`u c #423e40", +"`v c #464242", +"`w c #464343", +"`x c #474344", +"`y c #484445", +"`z c #494747", +"`A c #4a4748", +"`B c #4b4949", +"`C c #4c4849", +"`D c #4d4a4a", +"`E c #4e4a4b", +"`F c #4f4b4d", +"`G c #4f4c4c", +"`H c #524d4f", +"`I c #504e4e", +"`J c #514f50", +"`K c #535050", +"`L c #575555", +"`M c #575456", +"`N c #595657", +"`O c #5b5858", +"`P c #5c595b", +"`Q c #5d5a5a", +"`R c #605c5e", +"`S c #636062", +"`T c #676365", +"`U c #686565", +"`V c #6c6a6a", +"`W c #6d6b6b", +"`X c #6e6a6c", +"`Y c #6e6c6c", +"`Z c #6f6d6d", +"`0 c #716e6e", +"`1 c #716f6f", +"`2 c #726e70", +"`3 c #747173", +"`4 c #747272", +"`5 c #757273", +"`6 c #777474", +"`7 c #777577", +"`8 c #787575", +".` c #7a7777", +".. c #7b7979", +".# c #7b787a", +".a c #7e7b7b", +".b c #807d7d", +".c c #818080", +".d c #828181", +".e c #848081", +".f c #848384", +".g c #878484", +".h c #868485", +".i c #8b8788", +".j c #8a8888", +".k c #8a8889", +".l c #8d8b8b", +".m c #8e8c8c", +".n c #918f8f", +".o c #918f90", +".p c #939192", +".q c #949292", +".r c #979696", +".s c #999697", +".t c #9a9899", +".u c #9a999a", +".v c #9d9a9a", +".w c #9d9c9c", +".x c #9d9d9d", +".y c #a4a3a3", +".z c #a4a4a4", +".A c #a7a5a6", +".B c #adabab", +".C c #adacad", +".D c #afacae", +".E c #b0afaf", +".F c #b1b1b1", +".G c #b6b4b5", +".H c #b7b6b6", +".I c #bbb9b9", +".J c #bcbbbb", +".K c #bdbbbd", +".L c #bebdbd", +".M c #c0bebe", +".N c #c1c0c0", +".O c #c2c2c2", +".P c #c4c3c4", +".Q c #c6c5c5", +".R c #c8c7c7", +".S c #c9c8c9", +".T c #cbcacb", +".U c #cccaca", +".V c #d1d0d1", +".W c #d3d2d2", +".X c #d9d8d9", +".Y c #dbdada", +".Z c #dfdedf", +".0 c #e0dfdf", +".1 c #e2e1e1", +".2 c #e5e5e5", +".3 c #e6e5e6", +".4 c #e8e6e6", +".5 c #e8e7e7", +".6 c #eaeaea", +".7 c #ececec", +".8 c #ededed", +"#` c #eeeeee", +"#. c #f0f0f0", +"## c #f1f1f1", +"#a c #f2f2f2", +"#b c #f3f3f3", +"#c c #f5f3f5", +"#d c #f5f4f4", +"#e c #f6f6f6", +"#f c #f8f8f8", +"#g c #fafafa", +"#h c #fbfbfb", +"#i c #fcfbfb", +"#j c #fcfcfc", +"#k c #fdfdfd", +"#l c #fefefe", +"#m c #ffffff", +"#n c #000000", +"#o c #000000", +"#p c #000000", +"#q c #000000", +"#r c #000000", +"#s c #000000", +"#t c #000000", +"#u c #000000", +"#v c #000000", +"#w c #000000", +"#x c #000000", +"#y c #000000", +"#z c #000000", +"#A c #000000", +"#B c #000000", +"#C c #000000", +"#D c #000000", +"#E c #000000", +"#F c #000000", +"#G c #000000", +"#H c #000000", +"#I c #000000", +"#J c #000000", +"#K c #000000", +"#L c #000000", +"#M c #000000", +"#N c #000000", +"#O c #000000", +"#P c #000000", +"#Q c #000000", +"#R c #000000", +"#S c #000000", +"#T c #000000", +"#U c #000000", +"#V c #000000", +"#W c #000000", +"#X c #000000", +"#Y c #000000", +"#Z c #000000", +"#0 c #000000", +"#1 c #000000", +"#2 c #000000", +"#3 c #000000", +"#4 c #000000", +"#5 c #000000", +"#6 c #000000", +"#7 c #000000", +"#8 c #000000", +"a` c #000000", +"a. c #000000", +"a# c #000000", +"aa c #000000", +"ab c #000000", +"ac c #000000", +"ad c #000000", +"ae c #000000", +"af c #000000", +"ag c #000000", +"ah c #000000", +"ai c #000000", +"aj c #000000", +"ak c #000000", +"al c #000000", +"am c #000000", +"an c #000000", +"ao c #000000", +"ap c #000000", +"aq c #000000", +"ar c #000000", +"as c #000000", +"at c #000000", +"au c #000000", +"av c #000000", +"aw c #000000", +"ax c #000000", +"ay c #000000", +"az c #000000", +"aA c #000000", +"aB c #000000", +"aC c #000000", +"aD c #000000", +"aE c #000000", +"aF c #000000", +"aG c #000000", +"aH c #000000", +"aI c #000000", +"aJ c #000000", +"aK c #000000", +"aL c #000000", +"aM c #000000", +"aN c #000000", +"aO c #000000", +"aP c #000000", +"aQ c #000000", +"aR c #000000", +"aS c #000000", +"aT c #000000", +"aU c #000000", +"aV c #000000", +"aW c #000000", +"aX c #000000", +"aY c #000000", +"aZ c #000000", +"a0 c #000000", +"a1 c #000000", +"a2 c #000000", +"a3 c #000000", +"a4 c #000000", +"a5 c #000000", +"a6 c #000000", +"a7 c #000000", +"a8 c #000000", +/* pixels */ +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m.4#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m.2`z#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m.3`s`i#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m.4`t```i#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m.6`w`````i#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m.7`x```````i#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m.7`y`````````i#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m.7`z```````````i#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#``A```````c`````i#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m##`G```````K.n`````i#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#a`I```````E#..t`````i#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#a`H```````E#`#m.t`````i#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#d`L```````D#`#m#m.t`````i#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#d`N```````B#`#m#m#m.t`````i#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#e`N```````B#`#m#m#m#m.t`````i#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#e`O```````C#`#m#m#m#m#m.t`````i#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#e`P```````C.8#m#m#m#m#m#m.t`````i#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m.5.r.r.r.r.r.r.r.r.r.r.r.r.r.r`N```````..g.r.r.r.r.r.r.r`S`````c.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.5#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m.6`x````````````````````````````````````````````````````````````````````````````````````````````.o#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m.7`y````````````````````````````````````````````````````````````````````````````````````````````.n#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m.6`x```````g`m`m`m`m`m`m`m`m`k`````````c`m`m`m`m`m`m`m`m`m`.```````.`m`m`m`m`m`m`m`m`m`b````````.l#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m.7`y```````D#`#m#m#m#m#m#m#m#h`T```````l.V#m#m#m#m#m#m#m#m.x```````#.E#m#m#m#m#m#m#m#m.O`f``````.g#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m.7`z```````B#`#m#m#m#m#m#m#m#h`U```````l.V#m#m#m#m#m#m#m#m.w```````#.D#m#m#m#m#m#m#m#m.S`h``````.h#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#.`F```````B#`#m#m#m#m#m#m#m#j`Y```````l.V#m#m#m#m#m#m#m#m.v```````#.D#m#m#m#m#m#m#m#m.S`i``````.f#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m##`F```````C#`#m#m#m#m#m#m#m#j`Y```````l.V#m#m#m#m#m#m#m#m.v```````..C#m#m#m#m#m#m#m#m.T`i``````.e#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m##`G```````A.8#m#m#m#m#m#m#m#j`Z```````m.V#m#m#m#m#m#m#m#m.t````````.z#m#m#m#m#m#m#m#m.T`i``````.e#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m##`I```````v.6#m#m#m#m#m#m#m#j`2```````m.V#m#m#m#m#m#m#m#m.u````````.z#m#m#m#m#m#m#m#m.U`j``````.d#l#m#m#m#m#m#m#m#m#m", +"#m#m#m#m##`G```````j.F.P.P.P.P.P.P.P.P`X```````..t.P.P.P.P.P.P.P.P.l`````````0.P.P.P.P.P.P.P.P.E`i``````.b#l#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#a`J````````````````````````````````````````````````````````````````````````````````````````````.`#l#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#a`J`````````````````````````````````````````````````````````````````````````````````````````````7#k#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#d`M`````````````````````````````````````````````````````````````````````````````````````````````8#k#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#b.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1`i````.j.1.1.1.1#`#.#..y````````.i.1.1.1.1.1.1.1.1.1.1.1.1.1.1#k#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m`k````.s#m#m#m#m#m#m.G`a``````.h#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m`k````.s#m#m#m#m#m.H`b``````.f#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m`k````.s#m#m#m#m.H`b``````.e#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m`k````.s#m#m#m.L`d``````.e#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m`k````.s#m#m.M`d``````.c#l#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m`k````.s#m.N`d``````.`#l#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m`k````.s.N`e``````.`#l#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m`k`````R`d``````.##l#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m`k`````````````8#k#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m`k```````````6#k#m#m#m#m#m#m#m#m.0.......g.x.X#m#m#m#m.A`1.Q#m#m#m#m#f......`3`6.w###m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m`k`````````5#k#m#m#m#m#m#m#m#m#m.U```#`m`#`````Z#f#m#m`4``.z#m#m#m#m#b`````````````q#`#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m`k```````3#k#m#m#m#m#m#m#m#m#m#m.U```B#m#e.D`m``.a#m#m`4``.z#m#m#m#m#b```##m#e.R`n``.z#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m`k`````X#i#m#m#m#m#m#m#m#m#m#m#m.U```B#m#m#m.I```c#a#m`4``.z#m#m#m#m#b```##m#m#m`X``.m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m`k```W#i#m#m#m#m#m#m#m#m#m#m#m#m.U```B#m#m#m#m`u``.R#m`4``.z#m#m#m#m#b```##m#m.Y`p``.I#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m`k`V#i#m#m#m#m#m#m#m#m#m#m#m#m#m.U```B#m#m#m#m`O``.I#m`4``.z#m#m#m#m#b`````m`i```..o#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m`8#i#m#m#m#m#m#m#m#m#m#m#m#m#m#m.U```B#m#m#m#l`r``.T#m`4``.z#m#m#m#m#b`````Q`N`h``.q#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#k#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m.U```B#m#m#m.z```h#e#m`4``.z#m#m#m#m#b```##m#m.K```j#`#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m.U```z#..W.h`b``.p#m#m`4``.k.W.W.W#a#b```##m#m#m`D``.p#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m.U```````````h.p#l#m#m`4``````````.J#b```##m#m#m.y```o#c#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m.4.r.r.t.B.P#d#m#m#m#m.L.r.r.r.r.r.0#g.r.s#m#m#m#b.r.r.Z#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m", +"#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m#m" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/e1.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/e1.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/e1.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/e1.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,278 @@ +/* XPM */ +static const char *e1_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 256 2 ", +" c black", +". c #101010", +"X c #202020", +"o c gray19", +"O c gray25", +"+ c gray44", +"@ c gray50", +"# c black", +"$ c black", +"% c black", +"& c black", +"* c black", +"= c black", +"- c black", +"; c black", +": c black", +"> c black", +", c black", +"< c black", +"1 c black", +"2 c black", +"3 c black", +"4 c black", +"5 c black", +"6 c black", +"7 c black", +"8 c black", +"9 c black", +"0 c black", +"q c black", +"w c black", +"e c black", +"r c black", +"t c black", +"y c black", +"u c black", +"i c black", +"p c black", +"a c black", +"s c black", +"d c black", +"f c black", +"g c black", +"h c black", +"j c black", +"k c black", +"l c black", +"z c black", +"x c black", +"c c black", +"v c black", +"b c black", +"n c black", +"m c black", +"M c black", +"N c black", +"B c black", +"V c black", +"C c black", +"Z c black", +"A c black", +"S c black", +"D c black", +"F c black", +"G c black", +"H c black", +"J c black", +"K c black", +"L c black", +"P c black", +"I c black", +"U c black", +"Y c black", +"T c black", +"R c black", +"E c black", +"W c black", +"Q c black", +"! c black", +"~ c black", +"^ c black", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" c black", +", c black", +"< c black", +"1 c black", +"2 c black", +"3 c black", +"4 c black", +"5 c black", +"6 c black", +"7 c black", +"8 c black", +"9 c black", +"0 c black", +"q c black", +"w c black", +"e c black", +"r c black", +"t c black", +"y c black", +"u c black", +"i c black", +"p c black", +"a c black", +"s c black", +"d c black", +"f c black", +"g c black", +"h c black", +"j c black", +"k c black", +"l c black", +"z c black", +"x c black", +"c c black", +"v c black", +"b c black", +"n c black", +"m c black", +"M c black", +"N c black", +"B c black", +"V c black", +"C c black", +"Z c black", +"A c black", +"S c black", +"D c black", +"F c black", +"G c black", +"H c black", +"J c black", +"K c black", +"L c black", +"P c black", +"I c black", +"U c black", +"Y c black", +"T c black", +"R c black", +"E c black", +"W c black", +"Q c black", +"! c black", +"~ c black", +"^ c black", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" c black", +", c black", +"< c black", +"1 c black", +"2 c black", +"3 c black", +"4 c black", +"5 c black", +"6 c black", +"7 c black", +"8 c black", +"9 c black", +"0 c black", +"q c black", +"w c black", +"e c black", +"r c black", +"t c black", +"y c black", +"u c black", +"i c black", +"p c black", +"a c black", +"s c black", +"d c black", +"f c black", +"g c black", +"h c black", +"j c black", +"k c black", +"l c black", +"z c black", +"x c black", +"c c black", +"v c black", +"b c black", +"n c black", +"m c black", +"M c black", +"N c black", +"B c black", +"V c black", +"C c black", +"Z c black", +"A c black", +"S c black", +"D c black", +"F c black", +"G c black", +"H c black", +"J c black", +"K c black", +"L c black", +"P c black", +"I c black", +"U c black", +"Y c black", +"T c black", +"R c black", +"E c black", +"W c black", +"Q c black", +"! c black", +"~ c black", +"^ c black", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" c black", +", c black", +"< c black", +"1 c black", +"2 c black", +"3 c black", +"4 c black", +"5 c black", +"6 c black", +"7 c black", +"8 c black", +"9 c black", +"0 c black", +"q c black", +"w c black", +"e c black", +"r c black", +"t c black", +"y c black", +"u c black", +"i c black", +"p c black", +"a c black", +"s c black", +"d c black", +"f c black", +"g c black", +"h c black", +"j c black", +"k c black", +"l c black", +"z c black", +"x c black", +"c c black", +"v c black", +"b c black", +"n c black", +"m c black", +"M c black", +"N c black", +"B c black", +"V c black", +"C c black", +"Z c black", +"A c black", +"S c black", +"D c black", +"F c black", +"G c black", +"H c black", +"J c black", +"K c black", +"L c black", +"P c black", +"I c black", +"U c black", +"Y c black", +"T c black", +"R c black", +"E c black", +"W c black", +"Q c black", +"! c black", +"~ c black", +"^ c black", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" c #8D8D8D", +", c #909090", +"< c gray58", +"1 c #979797", +"2 c gray62", +"3 c gray63", +"4 c #A2A2A2", +"5 c #A5A5A5", +"6 c #A9A9A9", +"7 c #ACACAC", +"8 c gray69", +"9 c gray70", +"0 c gray73", +"q c gray", +"w c #C1C1C1", +"e c #C5C5C5", +"r c gray80", +"t c gray81", +"y c LightGray", +"u c gray84", +"i c #DADADA", +"p c #E1E1E1", +"a c black", +"s c black", +"d c black", +"f c black", +"g c black", +"h c black", +"j c black", +"k c black", +"l c black", +"z c black", +"x c black", +"c c black", +"v c black", +"b c black", +"n c black", +"m c black", +"M c black", +"N c black", +"B c black", +"V c black", +"C c black", +"Z c black", +"A c black", +"S c black", +"D c black", +"F c black", +"G c black", +"H c black", +"J c black", +"K c black", +"L c black", +"P c black", +"I c black", +"U c black", +"Y c black", +"T c black", +"R c black", +"E c black", +"W c black", +"Q c black", +"! c black", +"~ c black", +"^ c black", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" . 6 q 2 q X p p p p p p p p 6 ", +"> + e i p u # p p p p p p p p 6 ", +"> . 6 y r > @ y p p p p p p p 6 ", +"> $ p p i p - 9 p p p p p p p 6 ", +"2 = > 7 4 : , p p p p p p p p 6 ", +"6 p p p p p p p p p p p p p p 6 ", +"6 p 1 i p p p p p p p p p p p 6 ", +"6 8 - @ 5 p p p p p p p r * p 6 ", +"6 $ ; < = & w p p p p r ; > p 6 ", +"6 # # % > , ; p p ; & o o & < ", +"6 $ $ * , < & p q - . O % : r 6 ", +"6 & : < & ; i p p p @ 4 0 t e 2 ", +"6 w * % e p p p p p q p > * < * ", +"3 6 % 6 6 6 6 6 6 6 6 6 6 6 6 3 " +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/edge.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/edge.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/edge.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/edge.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,278 @@ +/* XPM */ +static const char *edge_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 256 2 ", +" c black", +". c #010101", +"X c gray1", +"o c gray2", +"O c #070707", +"+ c #131313", +"@ c #161616", +"# c #191919", +"$ c #1D1D1D", +"% c #222222", +"& c gray14", +"* c #252525", +"= c #2A2A2A", +"- c gray17", +"; c #2D2D2D", +": c #434343", +"> c #484848", +", c #4B4B4B", +"< c #4E4E4E", +"1 c gray33", +"2 c #585858", +"3 c #5B5B5B", +"4 c gray38", +"5 c #646464", +"6 c #686868", +"7 c #6A6A6A", +"8 c black", +"9 c black", +"0 c black", +"q c black", +"w c black", +"e c black", +"r c black", +"t c black", +"y c black", +"u c black", +"i c black", +"p c black", +"a c black", +"s c black", +"d c black", +"f c black", +"g c black", +"h c black", +"j c black", +"k c black", +"l c black", +"z c black", +"x c black", +"c c black", +"v c black", +"b c black", +"n c black", +"m c black", +"M c black", +"N c black", +"B c black", +"V c black", +"C c black", +"Z c black", +"A c black", +"S c black", +"D c black", +"F c black", +"G c black", +"H c black", +"J c black", +"K c black", +"L c black", +"P c black", +"I c black", +"U c black", +"Y c black", +"T c black", +"R c black", +"E c black", +"W c black", +"Q c black", +"! c black", +"~ c black", +"^ c black", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" 5 2 ; ; 2 5 > UXUX", +"UXUXo UX# - - # UXo UXUX", +"UXUX UX UXUX UX UXUX", +"UX: % UX , , UX% : UX", +"UXX 4 3 . & & . 3 4 X UX", +"UX UX$ + UXUX+ $ UX UX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/empty.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/empty.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/empty.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/empty.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,278 @@ +/* XPM */ +static const char *empty_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 256 2 ", +" c black", +". c black", +"X c black", +"o c black", +"O c black", +"+ c black", +"@ c black", +"# c black", +"$ c black", +"% c black", +"& c black", +"* c black", +"= c black", +"- c black", +"; c black", +": c black", +"> c black", +", c black", +"< c black", +"1 c black", +"2 c black", +"3 c black", +"4 c black", +"5 c black", +"6 c black", +"7 c black", +"8 c black", +"9 c black", +"0 c black", +"q c black", +"w c black", +"e c black", +"r c black", +"t c black", +"y c black", +"u c black", +"i c black", +"p c black", +"a c black", +"s c black", +"d c black", +"f c black", +"g c black", +"h c black", +"j c black", +"k c black", +"l c black", +"z c black", +"x c black", +"c c black", +"v c black", +"b c black", +"n c black", +"m c black", +"M c black", +"N c black", +"B c black", +"V c black", +"C c black", +"Z c black", +"A c black", +"S c black", +"D c black", +"F c black", +"G c black", +"H c black", +"J c black", +"K c black", +"L c black", +"P c black", +"I c black", +"U c black", +"Y c black", +"T c black", +"R c black", +"E c black", +"W c black", +"Q c black", +"! c black", +"~ c black", +"^ c black", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" -#endif // CHECK_MEMORY_LEAKS +#include "modeadditional.xpm" +#include "modeconnection.xpm" +#include "modecreateedge.xpm" +#include "modecrossing.xpm" +#include "modedelete.xpm" +#include "modeinspect.xpm" +#include "modemove.xpm" +#include "modeselect.xpm" +#include "modetrafficlight.xpm" + +#include "computejunctions.xpm" +#include "cleanjunctions.xpm" +#include "joinjunctions.xpm" +#include "options.xpm" + +#include "junction.xpm" +#include "edge.xpm" +#include "lane.xpm" +#include "connection.xpm" +#include "prohibition.xpm" +#include "crossing.xpm" + +#include "busstop.xpm" +#include "chargingstation.xpm" +#include "containerstop.xpm" +#include "e1.xpm" +#include "e2.xpm" +#include "e3.xpm" +#include "e3entry.xpm" +#include "e3exit.xpm" +#include "rerouter.xpm" +#include "routeprobe.xpm" +#include "vaporizer.xpm" +#include "variablespeedsign.xpm" +#include "calibrator.xpm" + +#include "vclass_ignoring.xpm" +#include "vclass_private.xpm" +#include "vclass_emergency.xpm" +#include "vclass_authority.xpm" +#include "vclass_army.xpm" +#include "vclass_vip.xpm" +#include "vclass_passenger.xpm" +#include "vclass_hov.xpm" +#include "vclass_taxi.xpm" +#include "vclass_bus.xpm" +#include "vclass_coach.xpm" +#include "vclass_delivery.xpm" +#include "vclass_truck.xpm" +#include "vclass_trailer.xpm" +#include "vclass_tram.xpm" +#include "vclass_rail_urban.xpm" +#include "vclass_rail.xpm" +#include "vclass_rail_electric.xpm" +#include "vclass_motorcycle.xpm" +#include "vclass_moped.xpm" +#include "vclass_bicycle.xpm" +#include "vclass_pedestrian.xpm" +#include "vclass_evehicle.xpm" +#include "vclass_ship.xpm" +#include "vclass_custom1.xpm" +#include "vclass_custom2.xpm" + +#include "accept.xpm" +#include "cancel.xpm" +#include "correct.xpm" +#include "error.xpm" +#include "reset.xpm" +#include "warning.xpm" + +#include "grid1.xpm" +#include "grid2.xpm" +#include "grid3.xpm" // =========================================================================== @@ -156,6 +221,8 @@ GUIIconSubSys::GUIIconSubSys(FXApp* a) { // build icons myIcons[ICON_APP] = new FXXPMIcon(a, document_xpm); + myIcons[ICON_DLR] = new FXXPMIcon(a, dlr_xpm); + myIcons[ICON_SUMO] = new FXXPMIcon(a, sumo_xpm); myIcons[ICON_EMPTY] = new FXXPMIcon(a, empty_xpm); myIcons[ICON_OPEN_CONFIG] = new FXXPMIcon(a, fileopen_xpm); myIcons[ICON_OPEN_NET] = new FXXPMIcon(a, netopen_xpm); @@ -236,23 +303,97 @@ myIcons[ICON_RUBBER3X] = new FXXPMIcon(a, rubber3x_xpm); myIcons[ICON_RUBBER4X] = new FXXPMIcon(a, rubber4x_xpm); myIcons[ICON_RUBBER5X] = new FXXPMIcon(a, rubber5x_xpm); - myIcons[ICON_EDITGRAPH] = new FXXPMIcon(a, edit_graph_xpm); + myIcons[ICON_EDITGRAPH] = new FXXPMIcon(a, edit_graph_xpm); - myIcons[ICON_UNDO] = new FXXPMIcon(a, undo_xpm); - myIcons[ICON_REDO] = new FXXPMIcon(a, redo_xpm); + myIcons[ICON_UNDO] = new FXXPMIcon(a, undo_xpm); + myIcons[ICON_REDO] = new FXXPMIcon(a, redo_xpm); myIcons[ICON_NETEDIT] = new FXXPMIcon(a, netedit_xpm); - myIcons[ICON_LOCK] = new FXXPMIcon(a, lock_xpm); - myIcons[ICON_ADD] = new FXXPMIcon(a, add_xpm); - myIcons[ICON_REMOVE] = new FXXPMIcon(a, remove_xpm); - myIcons[ICON_NETEDITARROW] = new FXXPMIcon(a, netEditArrow_xmp); - - myIcons[ICON_LANEPEDESTRIAN] = new FXXPMIcon(a, lanepedestrian); - myIcons[ICON_LANEBUS] = new FXXPMIcon(a, lanebus); - myIcons[ICON_LANEBIKE] = new FXXPMIcon(a, lanebike); - - - myIcons[ICON_EXT] = new FXXPMIcon(a, ext_xpm); - myIcons[ICON_CUT_SWELL] = new FXXPMIcon(a, cut_xpm); + myIcons[ICON_LOCK] = new FXXPMIcon(a, lock_xpm); + myIcons[ICON_ADD] = new FXXPMIcon(a, add_xpm); + myIcons[ICON_REMOVE] = new FXXPMIcon(a, remove_xpm); + myIcons[ICON_NETEDITARROW] = new FXXPMIcon(a, netEditArrow_xmp); + + myIcons[ICON_LANEPEDESTRIAN] = new FXXPMIcon(a, lanepedestrian); + myIcons[ICON_LANEBUS] = new FXXPMIcon(a, lanebus); + myIcons[ICON_LANEBIKE] = new FXXPMIcon(a, lanebike); + + myIcons[ICON_EXT] = new FXXPMIcon(a, ext_xpm); + myIcons[ICON_CUT_SWELL] = new FXXPMIcon(a, cut_xpm); + + myIcons[ICON_MODEADDITIONAL] = new FXXPMIcon(a, modeadditional_xpm); + myIcons[ICON_MODECONNECTION] = new FXXPMIcon(a, modeconnection_xpm); + myIcons[ICON_MODECREATEEDGE] = new FXXPMIcon(a, modecreateedge_xpm); + myIcons[ICON_MODECROSSING] = new FXXPMIcon(a, modecrossing_xpm); + myIcons[ICON_MODEDELETE] = new FXXPMIcon(a, modedelete_xpm); + myIcons[ICON_MODEINSPECT] = new FXXPMIcon(a, modeinspect_xpm); + myIcons[ICON_MODEMOVE] = new FXXPMIcon(a, modemove_xpm); + myIcons[ICON_MODESELECT] = new FXXPMIcon(a, modeselect_xpm); + myIcons[ICON_MODETLS] = new FXXPMIcon(a, modetrafficlight_xpm); + + myIcons[ICON_CLEANJUNCTIONS] = new FXXPMIcon(a, cleanjunctions_xpm); + myIcons[ICON_COMPUTEJUNCTIONS] = new FXXPMIcon(a, computejunctions_xpm); + myIcons[ICON_JOINJUNCTIONS] = new FXXPMIcon(a, joinjunctions_xpm); + myIcons[ICON_OPTIONS] = new FXXPMIcon(a, options_xpm); + + myIcons[ICON_JUNCTION] = new FXXPMIcon(a, junction_xpm); + myIcons[ICON_EDGE] = new FXXPMIcon(a, edge_xpm); + myIcons[ICON_LANE] = new FXXPMIcon(a, lane_xpm); + myIcons[ICON_CONNECTION] = new FXXPMIcon(a, connection_xpm); + myIcons[ICON_PROHIBITION] = new FXXPMIcon(a, prohibition_xpm); + myIcons[ICON_CROSSING] = new FXXPMIcon(a, crossing_xpm); + + myIcons[ICON_BUSSTOP] = new FXXPMIcon(a, busstop_xpm); + myIcons[ICON_CONTAINERSTOP] = new FXXPMIcon(a, containerstop_xpm); + myIcons[ICON_CHARGINGSTATION] = new FXXPMIcon(a, chargingstation_xpm); + myIcons[ICON_E1] = new FXXPMIcon(a, e1_xpm); + myIcons[ICON_E2] = new FXXPMIcon(a, e2_xpm); + myIcons[ICON_E3] = new FXXPMIcon(a, e3_xpm); + myIcons[ICON_E3ENTRY] = new FXXPMIcon(a, e3entry_xpm); + myIcons[ICON_E3EXIT] = new FXXPMIcon(a, e3exit_xpm); + myIcons[ICON_REROUTER] = new FXXPMIcon(a, rerouter_xpm); + myIcons[ICON_ROUTEPROBE] = new FXXPMIcon(a, routeprobe_xpm); + myIcons[ICON_VAPORIZER] = new FXXPMIcon(a, vaporizer_xpm); + myIcons[ICON_VARIABLESPEEDSIGN] = new FXXPMIcon(a, variablespeedsign_xpm); + myIcons[ICON_CALIBRATOR] = new FXXPMIcon(a, calibrator_xpm); + + myIcons[ICON_VCLASS_IGNORING] = new FXXPMIcon(a, vclass_ignoring_xpm); + myIcons[ICON_VCLASS_PRIVATE] = new FXXPMIcon(a, vclass_private_xpm); + myIcons[ICON_VCLASS_EMERGENCY] = new FXXPMIcon(a, vclass_emergency_xpm); + myIcons[ICON_VCLASS_AUTHORITY] = new FXXPMIcon(a, vclass_authority_xpm); + myIcons[ICON_VCLASS_ARMY] = new FXXPMIcon(a, vclass_army_xpm); + myIcons[ICON_VCLASS_VIP] = new FXXPMIcon(a, vclass_vip_xpm); + myIcons[ICON_VCLASS_PASSENGER] = new FXXPMIcon(a, vclass_passenger_xpm); + myIcons[ICON_VCLASS_HOV] = new FXXPMIcon(a, vclass_hov_xpm); + myIcons[ICON_VCLASS_TAXI] = new FXXPMIcon(a, vclass_taxi_xpm); + myIcons[ICON_VCLASS_BUS] = new FXXPMIcon(a, vclass_bus_xpm); + myIcons[ICON_VCLASS_COACH] = new FXXPMIcon(a, vclass_coach_xpm); + myIcons[ICON_VCLASS_DELIVERY] = new FXXPMIcon(a, vclass_delivery_xpm); + myIcons[ICON_VCLASS_TRUCK] = new FXXPMIcon(a, vclass_truck_xpm); + myIcons[ICON_VCLASS_TRAILER] = new FXXPMIcon(a, vclass_trailer_xpm); + myIcons[ICON_VCLASS_TRAM] = new FXXPMIcon(a, vclass_tram_xpm); + myIcons[ICON_VCLASS_RAIL_URBAN] = new FXXPMIcon(a, vclass_rail_urban_xpm); + myIcons[ICON_VCLASS_RAIL] = new FXXPMIcon(a, vclass_rail_xpm); + myIcons[ICON_VCLASS_RAIL_ELECTRIC] = new FXXPMIcon(a, vclass_rail_electric_xpm); + myIcons[ICON_VCLASS_MOTORCYCLE] = new FXXPMIcon(a, vclass_motorcycle_xpm); + myIcons[ICON_VCLASS_MOPED] = new FXXPMIcon(a, vclass_moped_xpm); + myIcons[ICON_VCLASS_BICYCLE] = new FXXPMIcon(a, vclass_bicycle_xpm); + myIcons[ICON_VCLASS_PEDESTRIAN] = new FXXPMIcon(a, vclass_pedestrian_xpm); + myIcons[ICON_VCLASS_EVEHICLE] = new FXXPMIcon(a, vclass_evehicle_xpm); + myIcons[ICON_VCLASS_SHIP] = new FXXPMIcon(a, vclass_ship_xpm); + myIcons[ICON_VCLASS_CUSTOM1] = new FXXPMIcon(a, vclass_custom1_xpm); + myIcons[ICON_VCLASS_CUSTOM2] = new FXXPMIcon(a, vclass_custom2_xpm); + + myIcons[ICON_OK] = new FXXPMIcon(a, accept_xpm); // @todo create ok icon + myIcons[ICON_ACCEPT] = new FXXPMIcon(a, accept_xpm); + myIcons[ICON_CANCEL] = new FXXPMIcon(a, cancel_xpm); + myIcons[ICON_CORRECT] = new FXXPMIcon(a, correct_xpm); + myIcons[ICON_ERROR] = new FXXPMIcon(a, error_xpm); + myIcons[ICON_RESET] = new FXXPMIcon(a, reset_xpm); + myIcons[ICON_WARNING] = new FXXPMIcon(a, warning_xpm); + + myIcons[ICON_GRID1] = new FXXPMIcon(a, grid1_xpm); + myIcons[ICON_GRID2] = new FXXPMIcon(a, grid2_xpm); + myIcons[ICON_GRID3] = new FXXPMIcon(a, grid3_xpm); // ... and create them for (int i = 0; i < ICON_MAX; i++) { @@ -271,7 +412,7 @@ void -GUIIconSubSys::init(FXApp* a) { +GUIIconSubSys::initIcons(FXApp* a) { assert(myInstance == 0); myInstance = new GUIIconSubSys(a); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/GUIIconSubSys.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/GUIIconSubSys.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/GUIIconSubSys.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/GUIIconSubSys.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUIIconSubSys.h /// @author Daniel Krajzewicz /// @date Jul 2003 -/// @version $Id: GUIIconSubSys.h 21107 2016-07-04 12:57:59Z palcraft $ +/// @version $Id: GUIIconSubSys.h 22929 2017-02-13 14:38:39Z behrisch $ /// // A class to manage icons of SUMO /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,20 +39,21 @@ // =========================================================================== class GUIIconSubSys { public: - /// @brief Initiate GUIIconSubSys - /// @param[in] a FOX Toolkit APP - static void init(FXApp* a); - - /// @brief returns a icon previously defined in the enum GUIIcon - /// @param[in] a FOX Toolkit APP + /**@brief Initiate GUIIconSubSys + * @param[in] a FOX Toolkit APP + */ + static void initIcons(FXApp* a); + + /**@brief returns a icon previously defined in the enum GUIIcon + * @param[in] which GUIIcon enum + */ static FXIcon* getIcon(GUIIcon which); /// @brief close GUIIconSubSys static void close(); private: - /// @brief constructor - /// @note is private because is called by the static function init(FXApp* a) + /// @brief constructor is private because is called by the static function init(FXApp* a) GUIIconSubSys(FXApp* a); /// @brief destructor diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/GUITextures.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/GUITextures.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/GUITextures.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/GUITextures.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUITextures.h /// @author Pablo Alvarez Lopez /// @date Jul 2016 -/// @version $Id: GUITextures.h 21640 2016-10-09 20:28:52Z palcraft $ +/// @version $Id: GUITextures.h 22793 2017-01-31 13:33:09Z palcraft $ /// // An enumeration of gifs used by the gui applications /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -58,8 +58,8 @@ GNETEXTURE_TLS, GNETEXTURE_VAPORIZER, GNETEXTURE_VAPORIZERSELECTED, - GNETEXTURE_VARIABLESPEEDSIGNAL, - GNETEXTURE_VARIABLESPEEDSIGNALSELECTED, + GNETEXTURE_VARIABLESPEEDSIGN, + GNETEXTURE_VARIABLESPEEDSIGNSELECTED, GNETEXTURE_LANEBIKE, GNETEXTURE_LANEBUS, GNETEXTURE_LANEPEDESTRIAN, diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/GUITexturesHelper.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/GUITexturesHelper.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/GUITexturesHelper.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/GUITexturesHelper.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Mon, 08.03.2004 -/// @version $Id: GUITexturesHelper.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: GUITexturesHelper.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Global storage for textures; manages and draws them /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,7 +32,6 @@ #include #include -#include #include #include #include @@ -40,10 +39,6 @@ #include #include "GUITexturesHelper.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // definition of static variables @@ -81,15 +76,15 @@ void -GUITexturesHelper::drawTexturedBox(int which, SUMOReal size) { +GUITexturesHelper::drawTexturedBox(int which, double size) { drawTexturedBox(which, size, size, -size, -size); } void GUITexturesHelper::drawTexturedBox(int which, - SUMOReal sizeX1, SUMOReal sizeY1, - SUMOReal sizeX2, SUMOReal sizeY2) { + double sizeX1, double sizeY1, + double sizeX2, double sizeY2) { if (!myAllowTextures) { return; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/GUITexturesHelper.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/GUITexturesHelper.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/GUITexturesHelper.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/GUITexturesHelper.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2006 -/// @version $Id: GUITexturesHelper.h 21640 2016-10-09 20:28:52Z palcraft $ +/// @version $Id: GUITexturesHelper.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Global storage for textures; manages and draws them /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2006-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2006-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,17 +48,18 @@ /// @brief return maximum number of pixels in x and y direction static int getMaxTextureSize(); - /// Adds a texture to use + /// @brief Adds a texture to use static GUIGlID add(FXImage* i); - /// Draws a named texture as a box with the given size - static void drawTexturedBox(int which, SUMOReal size); + /// @brief Draws a named texture as a box with the given size + static void drawTexturedBox(int which, double size); - /// Draws a named texture as a rectangle with the given sizes - static void drawTexturedBox(int which, SUMOReal sizeX1, SUMOReal sizeY1, SUMOReal sizeX2, SUMOReal sizeY2); + /// @brief Draws a named texture as a rectangle with the given sizes + static void drawTexturedBox(int which, double sizeX1, double sizeY1, double sizeX2, double sizeY2); - /// @brief return texture id for the given filename (initialize on first use) - // @note return -1 on failure + /**@brief return texture id for the given filename (initialize on first use) + * @note return -1 on failure + */ static int getTextureID(const std::string& filename, const bool mirrorX = false); /// @brief clears loaded textures diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/GUITextureSubSys.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/GUITextureSubSys.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/GUITextureSubSys.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/GUITextureSubSys.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUITextureSubSys.cpp /// @author Pablo Alvarez Lopez /// @date Jul 2016 -/// @version $Id: GUITextureSubSys.cpp 21640 2016-10-09 20:28:52Z palcraft $ +/// @version $Id: GUITextureSubSys.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Helper for Gifs loading and usage /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -49,8 +49,8 @@ #include "GNETexture_RouteProbeSelected.cpp" #include "GNETexture_Vaporizer.cpp" #include "GNETexture_VaporizerSelected.cpp" -#include "GNETexture_VariableSpeedSignal.cpp" -#include "GNETexture_VariableSpeedSignalSelected.cpp" +#include "GNETexture_VariableSpeedSign.cpp" +#include "GNETexture_VariableSpeedSignSelected.cpp" #include "GNETexture_NotMoving.cpp" #include "GNETexture_NotMovingSelected.cpp" #include "GNETexture_LaneBus.cpp" @@ -58,10 +58,6 @@ #include "GNETexture_LaneBike.cpp" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member variable definitions @@ -95,8 +91,8 @@ myTextures[GNETEXTURE_TLS] = std::pair(false, 0); myTextures[GNETEXTURE_VAPORIZER] = std::pair(false, 0); myTextures[GNETEXTURE_VAPORIZERSELECTED] = std::pair(false, 0); - myTextures[GNETEXTURE_VARIABLESPEEDSIGNAL] = std::pair(false, 0); - myTextures[GNETEXTURE_VARIABLESPEEDSIGNALSELECTED] = std::pair(false, 0); + myTextures[GNETEXTURE_VARIABLESPEEDSIGN] = std::pair(false, 0); + myTextures[GNETEXTURE_VARIABLESPEEDSIGNSELECTED] = std::pair(false, 0); myTextures[GNETEXTURE_LANEBIKE] = std::pair(false, 0); myTextures[GNETEXTURE_LANEBUS] = std::pair(false, 0); myTextures[GNETEXTURE_LANEPEDESTRIAN] = std::pair(false, 0); @@ -108,18 +104,17 @@ void -GUITextureSubSys::init(FXApp* a) { +GUITextureSubSys::initTextures(FXApp* a) { assert(myInstance == 0); myInstance = new GUITextureSubSys(a); } GUIGlID -GUITextureSubSys::getGif(GUITexture which) { +GUITextureSubSys::getTexture(GUITexture which) { // Obtain GLID and boolean associated to this texture std::map >::iterator i = myInstance->myTextures.find(which); - - // If texture isn't loaded + // If texture isn't loaded, load it if (i->second.first == false) { switch (i->first) { case GNETEXTURE_E1 : @@ -179,11 +174,11 @@ case GNETEXTURE_VAPORIZERSELECTED : i->second.second = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_VaporizerSelected, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP)); break; - case GNETEXTURE_VARIABLESPEEDSIGNAL : - i->second.second = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_VariableSpeedSignal, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP)); + case GNETEXTURE_VARIABLESPEEDSIGN : + i->second.second = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_VariableSpeedSign, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP)); break; - case GNETEXTURE_VARIABLESPEEDSIGNALSELECTED : - i->second.second = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_VariableSpeedSignalSelected, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP)); + case GNETEXTURE_VARIABLESPEEDSIGNSELECTED : + i->second.second = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_VariableSpeedSignSelected, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP)); break; case GNETEXTURE_LANEBIKE : i->second.second = GUITexturesHelper::add(new FXGIFImage(myInstance->myApp, GNETexture_LaneBike, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP)); @@ -206,8 +201,9 @@ void -GUITextureSubSys::reset() { +GUITextureSubSys::resetTextures() { // Reset all textures + GUITexturesHelper::clearTextures(); for (std::map >::iterator i = myInstance->myTextures.begin(); i != myInstance->myTextures.end(); i++) { i->second.first = false; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/GUITextureSubSys.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/GUITextureSubSys.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/GUITextureSubSys.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/GUITextureSubSys.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file GUITextureSubSys.h /// @author Pablo Alvarez Lopez /// @date Jul 2016 -/// @version $Id: GUITextureSubSys.h 21120 2016-07-05 13:52:03Z behrisch $ +/// @version $Id: GUITextureSubSys.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A class to manage gifs of SUMO /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,24 +40,26 @@ class GUITextureSubSys { public: - /// @brief Initiate GUITextureSubSys for textures - /// @param[in] a FOX Toolkit APP - static void init(FXApp* a); - - /// @brief returns a texture Gif previously defined in the enum GUITexture - /// @param[in] GUITexture code of texture to use - static GUIGlID getGif(GUITexture which); - - /// @brief Reset textures - /// @note Necessary to avoid problems with textures (ej: white empty) - static void reset(); + /**@brief Initiate GUITextureSubSys for textures + * @param[in] a FOX Toolkit APP + */ + static void initTextures(FXApp* a); + + /**@brief returns a texture previously defined in the enum GUITexture + * @param[in] GUITexture code of texture to use + */ + static GUIGlID getTexture(GUITexture which); + + /**@brief Reset textures + * @note Necessary to avoid problems with textures (ej: white empty) + */ + static void resetTextures(); /// @brief close GUITextureSubSys static void close(); private: - /// @brief constructor - /// @note is private because is called by the static function init(FXApp* a) + /// @brief constructor private because is called by the static function init(FXApp* a GUITextureSubSys(FXApp* a); /// @brief destructor diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/joinjunctions.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/joinjunctions.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/joinjunctions.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/joinjunctions.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,62 @@ +/* XPM */ +static const char *joinjunctions_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 40 1 ", +" c black", +". c #0A0801", +"X c #0C0A01", +"o c #0D0B01", +"O c #110E02", +"+ c #131002", +"@ c #161202", +"# c #191502", +"$ c #201B03", +"% c #231D03", +"& c #362E05", +"* c #3B3206", +"= c #463B07", +"- c #5A4C08", +"; c #5F5009", +": c #605109", +"> c #836F0E", +", c #84700E", +"< c #8A750F", +"1 c #8F790D", +"2 c #957E0E", +"3 c #857110", +"4 c #8B7611", +"5 c #8C7712", +"6 c #A38A0F", +"7 c #A68D0F", +"8 c #B39811", +"9 c #CFAF13", +"0 c #D2B214", +"q c #D4B314", +"w c #D6B514", +"e c #E4C115", +"r c #E5C215", +"t c #E6C315", +"y c #E9C516", +"u c #F4CE17", +"i c #F5CF17", +"p c #F6D017", +"a c #F7D117", +"s c None", +/* pixels */ +"sssssss<5sssssss", +"ssssss,tt3ssssss", +"sssss,taat3sssss", +"ssss>ta12at>ssss", +"sss,ta0.oqpt3sss", +"ss,tau& *pat3ss", +"s,taa9:o+:qapt3s", +"s", +"ss3taaa#%-=pt>ss", +"sss3tap#%pyt>sss", +"ssss3tp67pt>ssss", +"sssss3tppe>sssss", +"ssssss3tt>ssssss", +"sssssss44sssssss" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/junction.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/junction.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/junction.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/junction.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,278 @@ +/* XPM */ +static const char *junction_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 256 2 ", +" c black", +". c #BE1919", +"X c #B92323", +"o c #BA2424", +"O c #B92626", +"+ c #BE2B2B", +"@ c #B83030", +"# c #BD5757", +"$ c #CE0707", +"% c #CF0808", +"& c #CC0909", +"* c #CE0A0A", +"= c #CC0B0B", +"- c #C21414", +"; c #C01515", +": c #C21717", +"> c #C51212", +", c #C51818", +"< c #C81212", +"1 c #D30505", +"2 c #D30606", +"3 c #D70404", +"4 c #D50505", +"5 c #D80303", +"6 c #D80404", +"7 c #DC0303", +"8 c #DE1C1C", +"9 c #DF1D1D", +"0 c #DC1E1E", +"q c #C33939", +"w c #C13D3D", +"e c #C93B3B", +"r c #C83C3C", +"t c #D52D2D", +"y c #D62F2F", +"u c #DC2121", +"i c #D92828", +"p c #E50101", +"a c #E40202", +"s c #E50F0F", +"d c #EA0101", +"f c #EC0101", +"g c #EF0505", +"h c #EC0606", +"j c #EA0808", +"k c #E90A0A", +"l c #E90C0C", +"z c #EC0808", +"x c #EC0909", +"c c #E31111", +"v c #E01414", +"b c #E01717", +"n c #E11818", +"m c #E21B1B", +"M c #E41919", +"N c #F00000", +"B c #F20303", +"V c #F20404", +"C c #F00505", +"Z c #F50000", +"A c #F70202", +"S c #F40404", +"D c #F90000", +"F c #F90101", +"G c #F80202", +"H c #FD0000", +"J c #FC0101", +"K c #C25858", +"L c #DB5050", +"P c #DA5454", +"I c #C16969", +"U c #C36E6E", +"Y c #C97575", +"T c #C87B7B", +"R c #DC6060", +"E c #DC6969", +"W c #D87878", +"Q c #DC7A7A", +"! c black", +"~ c black", +"^ c black", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" UX3 UXUX", +"UXP G H F y j h H S q f N a # UX", +"W H H b v H z UXUXg H 8 . D D Y ", +"u C i J H F m 9 8 M H H F r 6 o ", +"UXUXB k E UXUXUXUXUXUXR x B UXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/lanebike.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/lanebike.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/lanebike.xpm 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/lanebike.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -21,4 +21,4 @@ "................", "................", "................" -}; \ No newline at end of file +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/lanebus.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/lanebus.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/lanebus.xpm 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/lanebus.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -53,4 +53,4 @@ "tttttttttttttttt", "tttttttttttttttt", "tttttttttttttttt" -}; \ No newline at end of file +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/lanepedestrian.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/lanepedestrian.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/lanepedestrian.xpm 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/lanepedestrian.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -59,4 +59,4 @@ "ssss 2ssso5sssss", "sss2ossss--sssss", "sss>yssssy2sssss" -}; \ No newline at end of file +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/lane.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/lane.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/lane.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/lane.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,278 @@ +/* XPM */ +static const char *lane_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 256 2 ", +" c black", +". c #010101", +"X c gray1", +"o c gray2", +"O c #070707", +"+ c #131313", +"@ c #161616", +"# c #191919", +"$ c #1D1D1D", +"% c #222222", +"& c gray14", +"* c #252525", +"= c #2A2A2A", +"- c gray17", +"; c #2D2D2D", +": c #434343", +"> c #484848", +", c #4B4B4B", +"< c #4E4E4E", +"1 c gray33", +"2 c #585858", +"3 c #5B5B5B", +"4 c gray38", +"5 c #646464", +"6 c #686868", +"7 c #6A6A6A", +"8 c #0126FE", +"9 c #0026FF", +"0 c #1033FE", +"q c #1335FE", +"w c #1537FE", +"e c #1638FE", +"r c #193AFD", +"t c #2040FE", +"y c #2645FD", +"u c #2847FD", +"i c #2B4AFE", +"p c #4761FE", +"a c #516AFE", +"s c #556DFF", +"d c #5870FE", +"f c #677DFE", +"g c black", +"h c black", +"j c black", +"k c black", +"l c black", +"z c black", +"x c black", +"c c black", +"v c black", +"b c black", +"n c black", +"m c black", +"M c black", +"N c black", +"B c black", +"V c black", +"C c black", +"Z c black", +"A c black", +"S c black", +"D c black", +"F c black", +"G c black", +"H c black", +"J c black", +"K c black", +"L c black", +"P c black", +"I c black", +"U c black", +"Y c black", +"T c black", +"R c black", +"E c black", +"W c black", +"Q c black", +"! c black", +"~ c black", +"^ c black", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" 5 2 ; i 9 9 s 5 > UXUX", +"UXUXo UX# - u 9 9 e UXo UXUX", +"UXUX UX UXUX9 9 9 UX UXUX", +"UX: % UX , p 9 9 9 UX% : UX", +"UXX 4 3 . & t 8 9 9 d 4 X UX", +"UX UX$ + UXUX0 9 9 r UX UX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -1,6 +1,6 @@ noinst_LIBRARIES = libguiutilsimages.a -EXTRA_DIST = allow_rotation.xpm \ +EXTRA_DIST = dlr.xpm sumo.xpm allow_rotation.xpm empty.xpm \ app_breakpoints.xpm app_finder.xpm \ app_selector.xpm app_table.xpm app_tlstracker.xpm app_tracker.xpm \ camera.xpm close_gaps.xpm closing.xpm colorwheel.xpm \ @@ -29,10 +29,16 @@ windows_cascade.xpm windows_tile_horizontally.xpm windows_tile_vertically.xpm \ yellow_edge.xpm yellow_person.xpm yellow_vehicle.xpm \ yes.xpm lock.xpm add.xpm remove.xpm \ +accept.xpm cancel.xpm correct.xpm error.xpm reset.xpm warning.xpm \ +junction.xpm edge.xpm lane.xpm connection.xpm prohibition.xpm crossing.xpm \ lanebike.xpm lanebus.xpm lanepedestrian.xpm \ +cleanjunctions.xpm computejunctions.xpm joinjunctions.xpm options.xpm \ +busstop.xpm chargingstation.xpm containerstop.xpm e1.xpm \ +e2.xpm e3.xpm e3entry.xpm e3exit.xpm rerouter.xpm routeprobe.xpm \ +vaporizer.xpm variablespeedsign.xpm calibrator.xpm \ GNETexture_Rerouter.cpp GNETexture_RerouterSelected.cpp \ GNETexture_RouteProbe.cpp GNETexture_RouteProbeSelected.cpp \ -GNETexture_VariableSpeedSignal.cpp GNETexture_VariableSpeedSignalSelected.cpp \ +GNETexture_VariableSpeedSign.cpp GNETexture_VariableSpeedSignSelected.cpp \ GNETexture_Vaporizer.cpp GNETexture_VaporizerSelected.cpp \ GNETexture_E1.cpp GNETexture_E2.cpp \ GNETexture_E3.cpp GNETexture_E3Selected.cpp \ @@ -41,7 +47,17 @@ GNETexture_Empty.cpp GNETexture_EmptySelected.cpp \ GNETexture_NotMoving.cpp GNETexture_NotMovingSelected.cpp \ GNETexture_LaneBus.cpp GNETexture_LaneBike.cpp \ -GNETexture_LanePedestrian.cpp GNETexture_TLS.cpp +GNETexture_LanePedestrian.cpp GNETexture_TLS.cpp \ +grid1.xpm grid2.xpm grid3.xpm \ +modeadditional.xpm modeconnection.xpm modecreateedge.xpm modecrossing.xpm \ +modedelete.xpm modeinspect.xpm modemove.xpm modeselect.xpm modetrafficlight.xpm \ +vclass_ignoring.xpm vclass_private.xpm vclass_emergency.xpm vclass_authority.xpm \ +vclass_army.xpm vclass_vip.xpm vclass_passenger.xpm vclass_hov.xpm \ +vclass_taxi.xpm vclass_bus.xpm vclass_coach.xpm vclass_delivery.xpm \ +vclass_truck.xpm vclass_trailer.xpm vclass_tram.xpm vclass_rail_urban.xpm \ +vclass_rail.xpm vclass_rail_electric.xpm vclass_motorcycle.xpm vclass_moped.xpm \ +vclass_bicycle.xpm vclass_pedestrian.xpm vclass_evehicle.xpm vclass_ship.xpm \ +vclass_custom1.xpm vclass_custom2.xpm libguiutilsimages_a_SOURCES = GUIIconSubSys.cpp GUIIconSubSys.h \ GUITextureSubSys.cpp GUITextureSubSys.h \ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -328,7 +328,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LIBRARIES = libguiutilsimages.a -EXTRA_DIST = allow_rotation.xpm \ +EXTRA_DIST = dlr.xpm sumo.xpm allow_rotation.xpm empty.xpm \ app_breakpoints.xpm app_finder.xpm \ app_selector.xpm app_table.xpm app_tlstracker.xpm app_tracker.xpm \ camera.xpm close_gaps.xpm closing.xpm colorwheel.xpm \ @@ -357,10 +357,16 @@ windows_cascade.xpm windows_tile_horizontally.xpm windows_tile_vertically.xpm \ yellow_edge.xpm yellow_person.xpm yellow_vehicle.xpm \ yes.xpm lock.xpm add.xpm remove.xpm \ +accept.xpm cancel.xpm correct.xpm error.xpm reset.xpm warning.xpm \ +junction.xpm edge.xpm lane.xpm connection.xpm prohibition.xpm crossing.xpm \ lanebike.xpm lanebus.xpm lanepedestrian.xpm \ +cleanjunctions.xpm computejunctions.xpm joinjunctions.xpm options.xpm \ +busstop.xpm chargingstation.xpm containerstop.xpm e1.xpm \ +e2.xpm e3.xpm e3entry.xpm e3exit.xpm rerouter.xpm routeprobe.xpm \ +vaporizer.xpm variablespeedsign.xpm calibrator.xpm \ GNETexture_Rerouter.cpp GNETexture_RerouterSelected.cpp \ GNETexture_RouteProbe.cpp GNETexture_RouteProbeSelected.cpp \ -GNETexture_VariableSpeedSignal.cpp GNETexture_VariableSpeedSignalSelected.cpp \ +GNETexture_VariableSpeedSign.cpp GNETexture_VariableSpeedSignSelected.cpp \ GNETexture_Vaporizer.cpp GNETexture_VaporizerSelected.cpp \ GNETexture_E1.cpp GNETexture_E2.cpp \ GNETexture_E3.cpp GNETexture_E3Selected.cpp \ @@ -369,7 +375,17 @@ GNETexture_Empty.cpp GNETexture_EmptySelected.cpp \ GNETexture_NotMoving.cpp GNETexture_NotMovingSelected.cpp \ GNETexture_LaneBus.cpp GNETexture_LaneBike.cpp \ -GNETexture_LanePedestrian.cpp GNETexture_TLS.cpp +GNETexture_LanePedestrian.cpp GNETexture_TLS.cpp \ +grid1.xpm grid2.xpm grid3.xpm \ +modeadditional.xpm modeconnection.xpm modecreateedge.xpm modecrossing.xpm \ +modedelete.xpm modeinspect.xpm modemove.xpm modeselect.xpm modetrafficlight.xpm \ +vclass_ignoring.xpm vclass_private.xpm vclass_emergency.xpm vclass_authority.xpm \ +vclass_army.xpm vclass_vip.xpm vclass_passenger.xpm vclass_hov.xpm \ +vclass_taxi.xpm vclass_bus.xpm vclass_coach.xpm vclass_delivery.xpm \ +vclass_truck.xpm vclass_trailer.xpm vclass_tram.xpm vclass_rail_urban.xpm \ +vclass_rail.xpm vclass_rail_electric.xpm vclass_motorcycle.xpm vclass_moped.xpm \ +vclass_bicycle.xpm vclass_pedestrian.xpm vclass_evehicle.xpm vclass_ship.xpm \ +vclass_custom1.xpm vclass_custom2.xpm libguiutilsimages_a_SOURCES = GUIIconSubSys.cpp GUIIconSubSys.h \ GUITextureSubSys.cpp GUITextureSubSys.h \ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/manip.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/manip.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/manip.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/manip.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,13 +3,13 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004-11-23 -/// @version $Id: manip.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: manip.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // Generated by reswrap version 3.0.0 // created by reswrap from file manip.gif /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/modeadditional.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/modeadditional.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/modeadditional.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/modeadditional.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,31 @@ +/* XPM */ +static const char *modeadditional_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 9 1 ", +" c #4CAA32", +". c #65B02A", +"X c #6AB129", +"o c #C6C90F", +"O c #C9CA0E", +"+ c #F6D502", +"@ c #F9D601", +"# c #FFD800", +"$ c None", +/* pixels */ +"$$$$$$ $$$$$$", +"$$$$ $$$$", +"$$$ .o@@o. $$$", +"$$$ .+####+. $$$", +"$$ o# ## #o $$", +"$$ @# ## #@ $$", +"$$ @# #@ $$", +"$$ O# ## #O $$", +"$$$ X+ ## +X $$$", +"$$$ XO@@OX $$$", +" ", +" ", +" ", +" ", +" ", +" " +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/modeconnection.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/modeconnection.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/modeconnection.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/modeconnection.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,278 @@ +/* XPM */ +static const char *modeconnection_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 256 2 ", +" c black", +". c black", +"X c gray100", +"o c black", +"O c black", +"+ c black", +"@ c black", +"# c black", +"$ c black", +"% c black", +"& c red", +"* c black", +"= c black", +"- c gray100", +"; c black", +": c black", +"> c black", +", c black", +"< c gray100", +"1 c black", +"2 c black", +"3 c black", +"4 c black", +"5 c black", +"6 c black", +"7 c red", +"8 c red", +"9 c red", +"0 c black", +"q c gray100", +"w c black", +"e c black", +"r c gray100", +"t c gray100", +"y c gray100", +"u c black", +"i c black", +"p c black", +"a c black", +"s c black", +"d c red", +"f c red", +"g c red", +"h c red", +"j c red", +"k c gray100", +"l c gray100", +"z c gray100", +"x c black", +"c c black", +"v c black", +"b c black", +"n c black", +"m c black", +"M c black", +"N c black", +"B c black", +"V c black", +"C c red", +"Z c black", +"A c black", +"S c red", +"D c black", +"F c black", +"G c black", +"H c black", +"J c black", +"K c black", +"L c black", +"P c black", +"I c black", +"U c black", +"Y c black", +"T c black", +"R c red", +"E c black", +"W c black", +"Q c red", +"! c red", +"~ c black", +"^ c red", +"/ c red", +"( c red", +") c red", +"_ c red", +"` c red", +"' c red", +"] c red", +"[ c red", +"{ c red", +"} c red", +"| c red", +" . c red", +".. c red", +"X. c red", +"o. c red", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c red", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c red", +"<. c red", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c red", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c red", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c red", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c red", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c red", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c red", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c red", +";X c black", +":X c black", +">X c black", +",X c black", +" , < 1 2 3 4 5 6 7 8 9 0 q w e ", +"r t y u i p a s d f g h j k l z ", +"x c v b n m M N B V C Z A S D F ", +"G H J K L P I U Y T R E W Q ! ~ ", +"^ / ( ) _ ` ' ] [ { } | ...X.o.", +"O.+.@.#.$.%.&.*.=.-.;.:.>.,.<.1.", +"2.3.4.5.6.7.8.9.0.q.w.e.r.t.y.u.", +"i.p.a.s.d.f.g.h.j.k.l.z.x.c.v.b.", +"n.m.M.N.B.V.C.Z.A.S.D.F.G.H.J.K.", +"L.P.I.U.Y.T.R.E.W.Q.!.~.^./.(.).", +"_.`.'.].[.{.}.|. X.XXXoXOX+X@X#X", +"$X%X&X*X=X-X;X:X>X,X c gray100", +", c gray100", +"< c gray100", +"1 c gray100", +"2 c gray100", +"3 c gray100", +"4 c gray100", +"5 c gray100", +"6 c gray100", +"7 c gray100", +"8 c gray100", +"9 c gray100", +"0 c gray100", +"q c gray100", +"w c gray100", +"e c gray100", +"r c gray100", +"t c gray100", +"y c gray100", +"u c gray100", +"i c gray100", +"p c gray100", +"a c gray100", +"s c gray100", +"d c gray100", +"f c gray100", +"g c gray100", +"h c gray100", +"j c gray100", +"k c gray100", +"l c gray100", +"z c gray100", +"x c black", +"c c black", +"v c black", +"b c black", +"n c black", +"m c black", +"M c black", +"N c black", +"B c black", +"V c black", +"C c black", +"Z c black", +"A c black", +"S c black", +"D c black", +"F c black", +"G c black", +"H c black", +"J c black", +"K c black", +"L c black", +"P c black", +"I c black", +"U c black", +"Y c black", +"T c black", +"R c black", +"E c black", +"W c black", +"Q c black", +"! c black", +"~ c black", +"^ c gray100", +"/ c gray100", +"( c gray100", +") c gray100", +"_ c gray100", +"` c gray100", +"' c gray100", +"] c gray100", +"[ c gray100", +"{ c gray100", +"} c gray100", +"| c gray100", +" . c gray100", +".. c gray100", +"X. c gray100", +"o. c gray100", +"O. c gray100", +"+. c gray100", +"@. c gray100", +"#. c gray100", +"$. c gray100", +"%. c gray100", +"&. c gray100", +"*. c gray100", +"=. c gray100", +"-. c gray100", +";. c gray100", +":. c gray100", +">. c gray100", +",. c gray100", +"<. c gray100", +"1. c gray100", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c gray100", +"m. c gray100", +"M. c gray100", +"N. c gray100", +"B. c gray100", +"V. c gray100", +"C. c gray100", +"Z. c gray100", +"A. c gray100", +"S. c gray100", +"D. c gray100", +"F. c gray100", +"G. c gray100", +"H. c gray100", +"J. c gray100", +"K. c gray100", +"L. c gray100", +"P. c gray100", +"I. c gray100", +"U. c gray100", +"Y. c gray100", +"T. c gray100", +"R. c gray100", +"E. c gray100", +"W. c gray100", +"Q. c gray100", +"!. c gray100", +"~. c gray100", +"^. c gray100", +"/. c gray100", +"(. c gray100", +"). c gray100", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" , < 1 2 3 4 5 6 7 8 9 0 q w e ", +"r t y u i p a s d f g h j k l z ", +"x c v b n m M N B V C Z A S D F ", +"G H J K L P I U Y T R E W Q ! ~ ", +"^ / ( ) _ ` ' ] [ { } | ...X.o.", +"O.+.@.#.$.%.&.*.=.-.;.:.>.,.<.1.", +"2.3.4.5.6.7.8.9.0.q.w.e.r.t.y.u.", +"i.p.a.s.d.f.g.h.j.k.l.z.x.c.v.b.", +"n.m.M.N.B.V.C.Z.A.S.D.F.G.H.J.K.", +"L.P.I.U.Y.T.R.E.W.Q.!.~.^./.(.).", +"_.`.'.].[.{.}.|. X.XXXoXOX+X@X#X", +"$X%X&X*X=X-X;X:X>X,X c #A9A9A9", +", c #AFAFAF", +"< c #B1B1B1", +"1 c gray73", +"2 c #BCBCBC", +"3 c gray75", +"4 c #D68192", +"5 c #D88192", +"6 c #D88293", +"7 c #D88394", +"8 c #D98495", +"9 c #DA8495", +"0 c #DB8495", +"q c #DB8596", +"w c #DB8697", +"e c #DC8798", +"r c #E38E9F", +"t c #E792A3", +"y c #EA95A6", +"u c #ED98A9", +"i c #EE99AA", +"p c #E89DAE", +"a c #E99FB0", +"s c #E9A1B2", +"d c #EAA2B3", +"f c #EBA4B5", +"g c #ECA5B6", +"h c #ECA7B8", +"j c #E3BBC3", +"k c #E4BDC5", +"l c #E5BEC6", +"z c #E7BFC7", +"x c #F9B0C1", +"c c #FBB3C4", +"v c #FCB5C6", +"b c #FDB8C9", +"n c #FEB9CA", +"m c #C0C0C0", +"M c #C1C1C1", +"N c gray76", +"B c #C3C3C3", +"V c gray77", +"C c #C6C6C6", +"Z c #C8C8C8", +"A c #CACACA", +"S c #CBCBCB", +"D c gray80", +"F c #CDCDCD", +"G c #CECECE", +"H c gray81", +"J c #D0D0D0", +"K c gray82", +"L c #D2D2D2", +"P c gray83", +"I c gray84", +"U c #D8D8D8", +"Y c gray85", +"T c gainsboro", +"R c #DDDDDD", +"E c #DFDFDF", +"W c #EAC2CA", +"Q c #ECC4CC", +"! c #EDC6CE", +"~ c #EEC6CE", +"^ c #EEC7CF", +"/ c #EFC8D0", +"( c #E1E1E1", +") c gray89", +"_ c #E4E4E4", +"` c gray90", +"' c #E6E6E6", +"] c #E7E7E7", +"[ c #E9E9E9", +"{ c gray92", +"} c #ECECEC", +"| c gray93", +" . c #EEEEEE", +".. c #EFEFEF", +"X. c gray94", +"o. c #F1F1F1", +"O. c gray95", +"+. c #F3F3F3", +"@. c #F4F4F4", +"#. c gray96", +"$. c #F6F6F6", +"%. c #F8F8F8", +"&. c gray100", +"*. c None", +/* pixels */ +"*.*.*.*.*.*.*.*.*./ 9 9 ~ *.*.*.", +"*.*.*.*.*.*.*.*.~ 9 n n 7 ~ *.*.", +"*.*.*.*.*.*.*.~ 7 v g h n $ ~ *.", +"*.*.*.*.*.*.~ 5 c d f g h n + W ", +"*.*.*.*.*.[ J x a s d f g e i O ", +"*.*.*.*.[ G %.$.p a s d 9 9 i o ", +"*.*.*.' Z $.X.X.X.p a 4 7 y X z ", +"*.*.' Z $.X.X.X.....@ # t . z *.", +"*.' Z X.} } } } } G J r z *.*.", +"( C X.[ [ [ [ [ Z G T < j *.*.*.", +"m X.' ' ' ' ' C Z U > P *.*.*.*.", +"3 X.( ' ( ' m C P ; P *.*.*.*.*.", +"T < X.( ( m m J ; J *.*.*.*.*.*.", +"&.P : ( G G G & G *.*.*.*.*.*.*.", +"} U 1 = & & & m ( ' } X.*.*.*.*.", +"$.} ' ' [ [ [ } X.*.*.*.*.*.*.*." +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/modeinspect.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/modeinspect.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/modeinspect.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/modeinspect.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ +/* XPM */ +static const char *modeinspect_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 2 1 ", +" c #0026FF", +". c None", +/* pixels */ +"... ........", +".. .......", +". ... ......", +" ..... .....", +" ....... .....", +" ....... .....", +" ....... .....", +" ..... .....", +". ... .....", +".. ....", +"... ...", +"......... ..", +".......... .", +"........... ", +"............ ", +"............. ." +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/modemove.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/modemove.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/modemove.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/modemove.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,24 @@ +/* XPM */ +static const char *modemove_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 2 1 ", +" c red", +". c None", +/* pixels */ +"................", +"......... ......", +"......... .....", +"......... ....", +" ...", +" ..", +" .", +" ", +" ", +" .", +" ..", +" ...", +"......... ....", +"......... .....", +"......... ......", +"................" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/modeselect.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/modeselect.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/modeselect.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/modeselect.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,278 @@ +/* XPM */ +static const char *modeselect_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 256 2 ", +" c None", +". c gray100", +"X c gray100", +"o c gray100", +"O c gray100", +"+ c gray100", +"@ c gray100", +"# c gray100", +"$ c gray100", +"% c gray100", +"& c gray100", +"* c gray100", +"= c gray100", +"- c gray100", +"; c gray100", +": c gray100", +"> c #0000CC", +", c #0000CC", +"< c #0000CC", +"1 c #0000CC", +"2 c #0000CC", +"3 c #0000CC", +"4 c #0000CC", +"5 c #0000CC", +"6 c #0000CC", +"7 c #0000CC", +"8 c #0000CC", +"9 c #0000CC", +"0 c #0000CC", +"q c #0000CC", +"w c #0000CC", +"e c #0000CC", +"r c #0000CC", +"t c #0000CC", +"y c #0000CC", +"u c #0000CC", +"i c #0000CC", +"p c #0000CC", +"a c #0000CC", +"s c #0000CC", +"d c #0000CC", +"f c #0000CC", +"g c #0000CC", +"h c #0000CC", +"j c #0000CC", +"k c #0000CC", +"l c #0000CC", +"z c #0000CC", +"x c #0000CC", +"c c #0000CC", +"v c #0000CC", +"b c #0000CC", +"n c #0000CC", +"m c #0000CC", +"M c #0000CC", +"N c #0000CC", +"B c #0000CC", +"V c #0000CC", +"C c #0000CC", +"Z c #0000CC", +"A c #0000CC", +"S c #0000CC", +"D c #0000CC", +"F c #0000CC", +"G c #0000CC", +"H c gray100", +"J c gray100", +"K c gray100", +"L c #0000CC", +"P c #0000CC", +"I c #0000CC", +"U c gray100", +"Y c gray100", +"T c gray100", +"R c #0000CC", +"E c #0000CC", +"W c #0000CC", +"Q c gray100", +"! c gray100", +"~ c gray100", +"^ c #0000CC", +"/ c #0000CC", +"( c #0000CC", +") c #0000CC", +"_ c #0000CC", +"` c #0000CC", +"' c #0000CC", +"] c #0000CC", +"[ c #0000CC", +"{ c #0000CC", +"} c #0000CC", +"| c #0000CC", +" . c #0000CC", +".. c #0000CC", +"X. c #0000CC", +"o. c #0000CC", +"O. c #0000CC", +"+. c #0000CC", +"@. c #0000CC", +"#. c #0000CC", +"$. c #0000CC", +"%. c #0000CC", +"&. c #0000CC", +"*. c #0000CC", +"=. c #0000CC", +"-. c #0000CC", +";. c #0000CC", +":. c #0000CC", +">. c #0000CC", +",. c #0000CC", +"<. c #0000CC", +"1. c #0000CC", +"2. c #0000CC", +"3. c #0000CC", +"4. c #0000CC", +"5. c #0000CC", +"6. c #0000CC", +"7. c #0000CC", +"8. c #0000CC", +"9. c #0000CC", +"0. c #0000CC", +"q. c #0000CC", +"w. c #0000CC", +"e. c #0000CC", +"r. c #0000CC", +"t. c #0000CC", +"y. c #0000CC", +"u. c #0000CC", +"i. c navy", +"p. c navy", +"a. c navy", +"s. c navy", +"d. c navy", +"f. c navy", +"g. c navy", +"h. c navy", +"j. c navy", +"k. c navy", +"l. c navy", +"z. c navy", +"x. c navy", +"c. c navy", +"v. c navy", +"b. c navy", +"n. c navy", +"m. c navy", +"M. c navy", +"N. c navy", +"B. c navy", +"V. c navy", +"C. c navy", +"Z. c navy", +"A. c navy", +"S. c navy", +"D. c navy", +"F. c navy", +"G. c navy", +"H. c navy", +"J. c navy", +"K. c navy", +"L. c navy", +"P. c navy", +"I. c navy", +"U. c navy", +"Y. c navy", +"T. c navy", +"R. c navy", +"E. c navy", +"W. c navy", +"Q. c navy", +"!. c navy", +"~. c navy", +"^. c navy", +"/. c navy", +"(. c navy", +"). c navy", +"_. c black", +"`. c gray100", +"'. c gray100", +"]. c gray100", +"[. c black", +"{. c black", +"}. c black", +"|. c gray100", +" X c gray100", +".X c gray100", +"XX c black", +"oX c black", +"OX c black", +"+X c gray100", +"@X c gray100", +"#X c gray100", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" , < 1 2 3 4 5 6 7 8 9 0 q w e ", +"r t y u i p a s d f g h j k l z ", +"x c v b n m M N B V C Z A S D F ", +"G H J K L P I U Y T R E W Q ! ~ ", +"^ / ( ) _ ` ' ] [ { } | ...X.o.", +"O.+.@.#.$.%.&.*.=.-.;.:.>.,.<.1.", +"2.3.4.5.6.7.8.9.0.q.w.e.r.t.y.u.", +"i.p.a.s.d.f.g.h.j.k.l.z.x.c.v.b.", +"n.m.M.N.B.V.C.Z.A.S.D.F.G.H.J.K.", +"L.P.I.U.Y.T.R.E.W.Q.!.~.^./.(.).", +"_.`.'.].[.{.}.|. X.XXXoXOX+X@X#X", +"$X%X&X*X=X-X;X:X>X,X c gray100", +", c gray100", +"< c gray100", +"1 c gray100", +"2 c black", +"3 c black", +"4 c red", +"5 c red", +"6 c red", +"7 c red", +"8 c black", +"9 c black", +"0 c gray100", +"q c gray100", +"w c gray100", +"e c gray100", +"r c gray100", +"t c gray100", +"y c gray100", +"u c gray100", +"i c black", +"p c red", +"a c red", +"s c red", +"d c red", +"f c red", +"g c red", +"h c black", +"j c gray100", +"k c gray100", +"l c gray100", +"z c gray100", +"x c gray100", +"c c gray100", +"v c gray100", +"b c gray100", +"n c black", +"m c red", +"M c red", +"N c red", +"B c red", +"V c red", +"C c red", +"Z c black", +"A c gray100", +"S c gray100", +"D c gray100", +"F c gray100", +"G c gray100", +"H c gray100", +"J c gray100", +"K c gray100", +"L c black", +"P c black", +"I c red", +"U c red", +"Y c red", +"T c red", +"R c black", +"E c black", +"W c gray100", +"Q c gray100", +"! c gray100", +"~ c gray100", +"^ c gray100", +"/ c gray100", +"( c gray100", +") c gray100", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c gray100", +".. c gray100", +"X. c gray100", +"o. c gray100", +"O. c gray100", +"+. c gray100", +"@. c gray100", +"#. c gray100", +"$. c black", +"%. c black", +"&. c #FFD800", +"*. c #FFD800", +"=. c #FFD800", +"-. c #FFD800", +";. c black", +":. c black", +">. c gray100", +",. c gray100", +"<. c gray100", +"1. c gray100", +"2. c gray100", +"3. c gray100", +"4. c gray100", +"5. c gray100", +"6. c black", +"7. c #FFD800", +"8. c #FFD800", +"9. c #FFD800", +"0. c #FFD800", +"q. c #FFD800", +"w. c #FFD800", +"e. c black", +"r. c gray100", +"t. c gray100", +"y. c gray100", +"u. c gray100", +"i. c gray100", +"p. c gray100", +"a. c gray100", +"s. c gray100", +"d. c black", +"f. c #FFD800", +"g. c #FFD800", +"h. c #FFD800", +"j. c #FFD800", +"k. c #FFD800", +"l. c #FFD800", +"z. c black", +"x. c gray100", +"c. c gray100", +"v. c gray100", +"b. c gray100", +"n. c gray100", +"m. c gray100", +"M. c gray100", +"N. c gray100", +"B. c black", +"V. c black", +"C. c #FFD800", +"Z. c #FFD800", +"A. c #FFD800", +"S. c #FFD800", +"D. c black", +"F. c black", +"G. c gray100", +"H. c gray100", +"J. c gray100", +"K. c gray100", +"L. c gray100", +"P. c gray100", +"I. c gray100", +"U. c gray100", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c gray100", +"/. c gray100", +"(. c gray100", +"). c gray100", +"_. c gray100", +"`. c gray100", +"'. c gray100", +"]. c gray100", +"[. c black", +"{. c black", +"}. c #4CFF00", +"|. c #4CFF00", +" X c #4CFF00", +".X c #4CFF00", +"XX c black", +"oX c black", +"OX c gray100", +"+X c gray100", +"@X c gray100", +"#X c gray100", +"$X c gray100", +"%X c gray100", +"&X c gray100", +"*X c gray100", +"=X c black", +"-X c #4CFF00", +";X c #4CFF00", +":X c #4CFF00", +">X c #4CFF00", +",X c #4CFF00", +" , < 1 2 3 4 5 6 7 8 9 0 q w e ", +"r t y u i p a s d f g h j k l z ", +"x c v b n m M N B V C Z A S D F ", +"G H J K L P I U Y T R E W Q ! ~ ", +"^ / ( ) _ ` ' ] [ { } | ...X.o.", +"O.+.@.#.$.%.&.*.=.-.;.:.>.,.<.1.", +"2.3.4.5.6.7.8.9.0.q.w.e.r.t.y.u.", +"i.p.a.s.d.f.g.h.j.k.l.z.x.c.v.b.", +"n.m.M.N.B.V.C.Z.A.S.D.F.G.H.J.K.", +"L.P.I.U.Y.T.R.E.W.Q.!.~.^./.(.).", +"_.`.'.].[.{.}.|. X.XXXoXOX+X@X#X", +"$X%X&X*X=X-X;X:X>X,X c #6C6C6C", +", c #6D6D6D", +"< c gray43", +"1 c #6F6F6F", +"2 c gray44", +"3 c gray45", +"4 c gray46", +"5 c #767676", +"6 c gray47", +"7 c #797979", +"8 c gray48", +"9 c #7C7C7C", +"0 c #7E7E7E", +"q c #808080", +"w c #818181", +"e c #838383", +"r c #848484", +"t c #868686", +"y c gray53", +"u c #898989", +"i c #8B8B8B", +"p c gray55", +"a c #8D8D8D", +"s c #8E8E8E", +"d c gray56", +"f c #909090", +"g c gray57", +"h c #929292", +"j c #959595", +"k c #989898", +"l c #9B9B9B", +"z c gray61", +"x c #9D9D9D", +"c c #9F9F9F", +"v c #A2A2A2", +"b c #A4A4A4", +"n c #A5A5A5", +"m c #A7A7A7", +"M c gray66", +"N c gray67", +"B c gray68", +"V c #AEAEAE", +"C c #AFAFAF", +"Z c #B1B1B1", +"A c gray70", +"S c #B4B4B4", +"D c gray71", +"F c #B9B9B9", +"G c gray73", +"H c #BBBBBB", +"J c #BCBCBC", +"K c gray74", +"L c gray", +"P c gray75", +"I c #C5C5C5", +"U c gray78", +"Y c None", +/* pixels */ +"YYYYYYYY*vbYYYYY", +"YYYYsff8tbNVYYYY", +"YYY.3fjzbNZDYYYY", +"YY..3ff83tbJIHJY", +"YYq:sfY%=18zIIJY", +"Y+fssYYYY18tVIHY", +".#ssfYYYYY39tJHY", +".X%ssYYYYYY22DZY", +"Y..9sYYYYYY::VVb", +"Y.o8sYYYYYY%1bbb", +"Y.1sfsYYYYY$szul", +"Y.@sfssYYY$qlfYY", +"Y..%%=sssufssYYY", +"YYYY..1sfu8sfsYY", +"YYYY..2ss+.=YYYY", +"YYYYY..@YYYYYYYY" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/prohibition.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/prohibition.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/prohibition.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/prohibition.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,278 @@ +/* XPM */ +static const char *prohibition_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 256 2 ", +" c black", +". c #231F20", +"X c #331F20", +"o c #5F1E21", +"O c #413D3E", +"+ c #533C3E", +"@ c #4E4B4B", +"# c #4E4B4C", +"$ c #524A4B", +"% c #5D5A5B", +"& c #5E5B5C", +"* c #744A4D", +"= c #6C696A", +"- c #A11F25", +"; c #BC1C23", +": c #876264", +"> c #D21C24", +", c #D61B23", +"< c #D2353B", +"1 c #E31B24", +"2 c #EB1B24", +"3 c #EC1B24", +"4 c #ED1C25", +"5 c #ED1D26", +"6 c #EC1E27", +"7 c #EC242C", +"8 c #EE2831", +"9 c #EE2932", +"0 c #EF363E", +"q c #EE3B42", +"w c #EF3B43", +"e c #EF3C43", +"r c #EF3C44", +"t c #EF4148", +"y c #EF434A", +"u c #F0484F", +"i c #F04B52", +"p c #F04C52", +"a c #F04D54", +"s c #F04F56", +"d c #F15057", +"f c #F05158", +"g c #F1555B", +"h c #F2666C", +"j c #F2676D", +"k c #F2686D", +"l c #F36C72", +"z c #F36E74", +"x c #F37076", +"c c #F47176", +"v c #F37479", +"b c #F3747A", +"n c #F3767C", +"m c #F4747A", +"M c #F4777C", +"N c #8A8888", +"B c #969495", +"V c #AE8789", +"C c #B6B5B5", +"Z c #D5B8B9", +"A c #E28488", +"S c #F69095", +"D c #F69599", +"F c #F6989C", +"G c #F8B8BA", +"H c #DBC2C3", +"J c #E0DFDF", +"K c #FBDBDC", +"L c #FCDFE0", +"P c #EEEEEE", +"I c #EFEFEF", +"U c #F0EBEC", +"Y c #FCE1E2", +"T c #FCE4E5", +"R c #FCE5E6", +"E c #FDEAEB", +"W c #FDEEEE", +"Q c #FEF7F7", +"! c #FEF7F8", +"~ c #F9F9F9", +"^ c gray100", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" X P ^ ^ ^ ^ ^ j 3 UX", +"UXb 3 t 8 : . P ^ ^ ^ ^ S 3 b UX", +"UXUXf 3 s Z C ~ ^ ^ L h 3 f UXUX", +"UXUXUXv 3 4 u l l u 4 3 v UXUXUX", +"UXUXUXUXUXn q 6 6 r n UXUXUXUXUX" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/rerouter.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/rerouter.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/rerouter.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/rerouter.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,278 @@ +/* XPM */ +static const char *rerouter_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 256 2 ", +" c black", +". c #100D00", +"X c #241D00", +"o c #501F1F", +"O c #403300", +"+ c #483900", +"@ c #4C3D00", +"# c #582222", +"$ c #5C2424", +"% c #602626", +"& c #642727", +"* c #682929", +"= c #6C2A2A", +"- c #742D2D", +"; c #7C3030", +": c #5C4900", +"> c #803232", +", c #833434", +"< c #873535", +"1 c #8B3737", +"2 c #933A3A", +"3 c #973B3B", +"4 c #9B3D3D", +"5 c #9F3E3E", +"6 c #9B7C00", +"7 c #BF6334", +"8 c #BF7226", +"9 c #A74242", +"0 c #AB4343", +"q c #AF4545", +"w c #B34646", +"e c #B74848", +"r c #BB4949", +"t c #BF4B4B", +"y c #AF795D", +"u c #AF6B6B", +"i c #C34D4D", +"p c #D35353", +"a c #D75454", +"s c #DB5656", +"d c #DF5858", +"f c #E75B5B", +"g c #EB5C5C", +"h c #EF5E5E", +"j c #F35F5F", +"k c #F76161", +"l c #FF6464", +"z c #9F8000", +"x c #AF8C00", +"c c #BF9900", +"v c #C79F00", +"b c #DFB200", +"n c #FF8D3D", +"m c #E7B900", +"M c #FFA526", +"N c #F7C600", +"B c #FFCC00", +"V c black", +"C c black", +"Z c black", +"A c black", +"S c black", +"D c black", +"F c black", +"G c black", +"H c black", +"J c black", +"K c black", +"L c black", +"P c black", +"I c black", +"U c black", +"Y c black", +"T c black", +"R c black", +"E c black", +"W c black", +"Q c black", +"! c black", +"~ c black", +"^ c black", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" & - 0 > 1 # d l l l l l l l t ", +"> 1 9 4 > i - a l l l l l l l t ", +"> & # f > < $ l l l l l l l l t ", +"> 5 s ; > d 4 r l l l l l l l t ", +"q f l a d k k d l l l l l l l t ", +"t l l l l l l l l l l l l l l t ", +"7 M M M M M M n l l l l l l l t ", +"8 m X B B : x M l l l l f 1 l t ", +"8 b B B O z M l l l f 3 5 l t ", +"8 b B B O z M l 3 < * * < o 9 ", +"8 b B B O z M a 2 % = , 4 f t ", +"8 N . 6 v . v M l l - e p g d w ", +"8 B c @ + z B M l l a l 5 1 9 1 ", +"y 8 8 8 8 8 8 7 t t t t t t t u " +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/reset.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/reset.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/reset.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/reset.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,35 @@ +/* XPM */ +static const char *reset_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 13 1 ", +" c #3DB29D", +". c #3DB39D", +"X c #3CB29E", +"o c #3CB39E", +"O c #3DB39E", +"+ c #3DB29F", +"@ c #3CB39F", +"# c #3DB39F", +"$ c #3EB39E", +"% c #3DB49D", +"& c #3DB49E", +"* c #3DB49F", +"= c None", +/* pixels */ +"================", +"====oo$$$#======", +"===$$$$$$$$o====", +"==$$$====oo$o===", +"=$$o=======$o===", +"=$$========ooo==", +"$$o=========o$==", +"$o==========$o==", +"o$=========$o$o$", +"$o$========o$oo=", +"=oo=========o$==", +"=$$$============", +"==*oo====o$$====", +"===$$o$oo$oo====", +"====o$$o$$======", +"================" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/routeprobe.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/routeprobe.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/routeprobe.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/routeprobe.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,278 @@ +/* XPM */ +static const char *routeprobe_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 256 2 ", +" c #504400", +". c #605100", +"X c #685800", +"o c #6C5B00", +"O c #705E00", +"+ c #746200", +"@ c #786500", +"# c #20789F", +"$ c #24799B", +"% c #648A5C", +"& c #7C9044", +"* c #0094FF", +"= c #249EDB", +"- c #40A5BF", +"; c #64AF9B", +": c #68B097", +"> c #70B28F", +", c #78B487", +"< c #7CB583", +"1 c #806C00", +"2 c #836F00", +"3 c #877300", +"4 c #8B7600", +"5 c #8F7A00", +"6 c #937D00", +"7 c #978000", +"8 c #9B8400", +"9 c #9F8700", +"0 c #A38A00", +"q c #A78E00", +"w c #AB9100", +"e c #A39B1C", +"r c #B39800", +"t c #B79B00", +"y c #BFA200", +"u c #83B77C", +"i c #9FBE60", +"p c #AF9D40", +"a c #B3A140", +"s c #A3C05C", +"d c #A7C158", +"f c #B3C44C", +"g c #C7A900", +"h c #CBAC00", +"j c #CFB000", +"k c #D3B300", +"l c #D7B600", +"z c #DFBD00", +"x c #C3C83C", +"c c #CFCB30", +"v c #D3CC2C", +"b c #E3C000", +"n c #E7C400", +"m c #EBC700", +"M c #EFCA00", +"N c #E7D218", +"B c #EBD314", +"V c #F3CE00", +"C c #F3D50C", +"Z c #F7D608", +"A c #FFD800", +"S c #80B680", +"D c black", +"F c black", +"G c black", +"H c black", +"J c black", +"K c black", +"L c black", +"P c black", +"I c black", +"U c black", +"Y c black", +"T c black", +"R c black", +"E c black", +"W c black", +"Q c black", +"! c black", +"~ c black", +"^ c black", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" s < A 7 3 X X 3 q ", +"y A - * * = A A l 6 . o 2 8 n y ", +"y A - * * * A A A A + t k m z r ", +"y A : - - - Z A A A l A 9 4 q 4 ", +"a e & $ # # & y y y y y y y y p " +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/sumo.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/sumo.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/sumo.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/sumo.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,327 @@ +/* XPM */ +static const char *sumo_xpm[] = { +/* width height num_colors chars_per_pixel */ +" 64 64 256 2", +/* colors */ +"`` c #000000", +"`. c #050505", +"`# c #090909", +"`a c #141414", +"`b c #1a1a1a", +"`c c #242424", +"`d c #2b2b2b", +"`e c #333333", +"`f c #3a3a3a", +"`g c #434343", +"`h c #4c4c4c", +"`i c #535353", +"`j c #5b5b5a", +"`k c #666357", +"`l c #65625b", +"`m c #68695c", +"`n c #76765f", +"`o c #646464", +"`p c #6a6a6a", +"`q c #70706f", +"`r c #747474", +"`s c #787877", +"`t c #7b7b7a", +"`u c #01ff00", +"`v c #08ff00", +"`w c #10ff00", +"`x c #1cff00", +"`y c #23ff00", +"`z c #33ff00", +"`A c #3cff00", +"`B c #20ff20", +"`C c #2af525", +"`D c #2dfc2d", +"`E c #7a9564", +"`F c #73bd5d", +"`G c #5ad636", +"`H c #43ff00", +"`I c #55ff00", +"`J c #59ff00", +"`K c #6fff00", +"`L c #73ff00", +"`M c #71f808", +"`N c #7bff00", +"`O c #75d474", +"`P c #60ff60", +"`Q c #aa6d39", +"`R c #b07a39", +"`S c #906d43", +"`T c #99764b", +"`U c #806a60", +"`V c #847e72", +"`W c #807f7f", +"`X c #ff0000", +"`Y c #ff0b00", +"`Z c #fc0d0d", +"`0 c #ff1100", +"`1 c #ff1010", +"`2 c #eb241c", +"`3 c #ff3400", +"`4 c #ff3d00", +"`5 c #f12222", +"`6 c #ff2020", +"`7 c #f53535", +"`8 c #da432a", +".` c #d07c25", +".. c #ff4400", +".# c #ff4a00", +".a c #ff5200", +".b c #ff5f00", +".c c #ff6500", +".d c #ff6b00", +".e c #ff7401", +".f c #ff7e02", +".g c #c45453", +".h c #e15151", +".i c #ff4040", +".j c #ff5050", +".k c #ff6060", +".l c #a69435", +".m c #8c8448", +".n c #80807e", +".o c #81ae7c", +".p c #a78f47", +".q c #ad885c", +".r c #a59274", +".s c #ba9968", +".t c #a7ba47", +".u c #b7b77a", +".v c #93cc2e", +".w c #93ff00", +".x c #9cff00", +".y c #a3ff00", +".z c #abff01", +".A c #b3ff04", +".B c #b8ff06", +".C c #bcff08", +".D c #b9ed20", +".E c #d9be1c", +".F c #c3b134", +".G c #dca02c", +".H c #d1b021", +".I c #ff8303", +".J c #ff8900", +".K c #ff8a09", +".L c #ff8a10", +".M c #ff9300", +".N c #ff9b00", +".O c #ff9212", +".P c #ff971c", +".Q c #ff9c22", +".R c #ff9430", +".S c #e3bd14", +".T c #ffa300", +".U c #f9a50a", +".V c #ffaa00", +".W c #f1af11", +".X c #ffb300", +".Y c #ffba00", +".Z c #eca23c", +".0 c #ffa029", +".1 c #ffa433", +".2 c #c28f52", +".3 c #e59f44", +".4 c #ffac46", +".5 c #ffae4a", +".6 c #ffa350", +".7 c #ffb153", +".8 c #ecaf6c", +"#` c #ffb762", +"#. c #ffb967", +"## c #ffba6d", +"#a c #ffb570", +"#b c #ffbf7a", +"#c c #c8ff12", +"#d c #caff19", +"#e c #ccf628", +"#f c #daff2f", +"#g c #ddff33", +"#h c #ffc400", +"#i c #ffcc00", +"#j c #ffd300", +"#k c #ffdb02", +"#l c #ffde0a", +"#m c #e1cc33", +"#n c #ffe317", +"#o c #ffe41c", +"#p c #e0ff3b", +"#q c #ffe626", +"#r c #ffe62b", +"#s c #ffe730", +"#t c #ffe836", +"#u c #ffea3c", +"#v c #d6c74d", +"#w c #ffc07b", +"#x c #e5ff43", +"#y c #e7ff48", +"#z c #efff5d", +"#A c #ffeb43", +"#B c #ffee5a", +"#C c #ffef61", +"#D c #f5ff6d", +"#E c #fff063", +"#F c #fff16b", +"#G c #f8ff6f", +"#H c #fff272", +"#I c #fff478", +"#J c #f9ff74", +"#K c #838383", +"#L c #888787", +"#M c #898887", +"#N c #8c8c8b", +"#O c #958484", +"#P c #90908f", +"#Q c #939393", +"#R c #989897", +"#S c #9a9a9a", +"#T c #aa9998", +"#U c #b4a592", +"#V c #a4a3a3", +"#W c #abaaa7", +"#X c #ababab", +"#Y c #b1b0af", +"#Z c #b3b3b3", +"#0 c #b8b7b7", +"#1 c #b9b9b9", +"#2 c #bcbbbb", +"#3 c #bcbcbb", +"#4 c #bdbdbd", +"#5 c #84c282", +"#6 c #8fff8f", +"#7 c #a3e2a2", +"#8 c #b7f6b5", +"a` c #bfffbf", +"a. c #c2b2b2", +"a# c #c0bfbf", +"aa c #ff9f9f", +"ab c #ffbd80", +"ac c #efaead", +"ad c #f8a6a6", +"ae c #fdbdbc", +"af c #c0c0bf", +"ag c #c2e0bf", +"ah c #ffc282", +"ai c #ffc48c", +"aj c #ffc891", +"ak c #ffcb9b", +"al c #f3d2b1", +"am c #fedebe", +"an c #e7eb80", +"ao c #f2f585", +"ap c #fff582", +"aq c #feff86", +"ar c #fdfd89", +"as c #ffff98", +"at c #f5f5a5", +"au c #ffffa8", +"av c #ffffb3", +"aw c #ffffbb", +"ax c #c0c0c0", +"ay c #c5c4c3", +"az c #c4c4c4", +"aA c #c8c6c6", +"aB c #c9c9c9", +"aC c #cdcccb", +"aD c #cdcdcd", +"aE c #d0cfcf", +"aF c #d1d0ce", +"aG c #d9d0c7", +"aH c #d3d3d3", +"aI c #d8d8d7", +"aJ c #d9d9d9", +"aK c #dcdcdc", +"aL c #cfffcf", +"aM c #dfffdf", +"aN c #e0dfde", +"aO c #ffcfcf", +"aP c #ffdfdf", +"aQ c #e0e0df", +"aR c #ffeedf", +"aS c #ffffc5", +"aT c #ffffc8", +"aU c #ffffd2", +"aV c #ffffdb", +"aW c #e4e4e4", +"aX c #e9e9e7", +"aY c #e9e9e9", +"aZ c #edeceb", +"a0 c #eeeeee", +"a1 c #f2e8e0", +"a2 c #fbebeb", +"a3 c #fbf2eb", +"a4 c #f4f4f4", +"a5 c #f9f9f9", +"a6 c #fefefe", +"a7 c #000000", +"a8 c None", +/* pixels */ +"a8a6a0a0a0a0a0a0a0a0a0a0a0a0a0a0aZa8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8", +"a6aDaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaJazaxaxaxaxaxafa##4#4#4#4#4#4#2#1#1#1#1#0#Z#Z#Z#Z#Z#Z#Z#Z#X#X#X#X#X#V#V#V#V#S#S#S#S#Q#Q#Q#N#N", +"a0axaxaxaxaxax#V#V#V#1axaxaxaxaxaxaHaWaYaYaYaYaYaYaYaYaYaYaYaYaYaYaYaYaYaKaWaWaWaWaWaWaWaWaWaWaWaWaWaWaWaWaWaWaQaKaKaKaKaKaJaJ`p", +"a0axaxax#1`t`l`T`R`Q`U#N#ZaxaxaxaxaHa5a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6#SaWa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`p", +"a0axax#1`o.q####.7.P.c`8#O#ZaxaxaxaIaz#1aBa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`j#Xa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`p", +"a0axax`p.2ahakaj#b.4.K.#`2#T#4axaxaI#Q`r`r#Xa6a6a6a6a6a6a6a6a6a6a6a6a6a6`b`pa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`p", +"a0ax#S`S.7aiakaj#w.7.O.b`0.h#3axaxaH#Q`r`r`raWa6a6a6a6a6a6a6a6a6a6a6a6aJ```da6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`r", +"a0ax#K.`.5#wahah##.4.O.c`0`ZaFaxaxaH#Q`r`r`raKa6a6a6a6a6a6a6a6a6a6a6a6#Q````aWa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`r", +"a0ax`t.c.Q.7#.#`.5.0.I.a`Y`XacaxaxaH#Q`r`r`raKa6a6a6a6a6a6a6a6a6a6a6a6`j````#Xa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`r", +"a0ax#K`4.f.Q.1.1.Q.K.d`3`X`XaeaxaxaH#Q`r`r`raKa6a6a6a6a6a6a6a6a6a6a6a6`b`````oa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`r", +"a0ax#P`2.#.e.I.I.f.c..`0`X`Xa2axaxaH#P`r`r`raKa6a6a6a6a6a6a6a6a6a6a6aJ```````da6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`r", +"a0ax#X.g`Y`3.#.a.#`3`0`X`X.jaWaxaxaD#N`r`r`raKa6a6a6a6a6a6a6a6a6a6a6#Q````````aWa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`t", +"a0ax#4#V`5`X`Y`Y`Y`X`X`X`1aPaDaxaxaC#N`r`r`raKa6a6a6a6a6a6a6a6a6a6a6`j````````#Xa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`t", +"a0axax#3a.`7`X`X`X`X`X`6aOaJaxaxaxaB#N`r`r`raKa6a6a6a6a6a6a6a6a6a6a6`b`````````oa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`t", +"a0axaxaxaxaHad.k.i.jaaa2aHaxaxaxaxaB#N`g`p`raKa6a6a6a6a6a6a6a6a6a6aJ```````````da6a6a6a6a6a6a6a6a6a6a6a6a6#4#4a6a6a6a6a6a6a6a6`t", +"a0axaxaxaxaxaBaWaWaWaHaxaxaxaxaxaxaA#N`j`#`haKa6a6a6a6a6a6a6a6a6a6#Q````````````aWa6a6a6a6a6a6a6a6a6a6a4`o`ca5a6a6a6a6a6a6a6a6`t", +"aXaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaz#N`r`d```haWa6a6a6a6a6a6a6a6a6`j````````````#Xa6a6a6a6a6a6a6a6a6#1`b``#Xa6a6a6a6a6a6a6a6a6`t", +"aWaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxax#N`r`o`.```a#Sa6a6a6a6a6a6a6a6`b`````````````pa6a6a6a6a6a6a6a4`o`````ea6a6a6a6a6a6a6a6a6a6`t", +"aNaxaxaxaxax#X#N#N#N#Vaxaxaxaxaxaxax#N`r`r`e```````gaJa6a6a6a6a6aJ```````````````da6a6a6a6a6a6#X`b``````axa6a6a6a6a6a6a6a6a6a6`t", +"aJaxaxax#X`o.m.F.E.H.p`V#Xaxaxaxax#4#K`r`r`p`#```````##Na6a6a6a6az`j`j`j```b`j`j`oa4a6a6a6a0`j`````````ha6a6a6a6a6a6a6a6a6a6a6`t", +"aHaxax#X`k#v#E#E#A#l#i.W.r#Xaxaxax#4#K`r`r`r`o```````````faJa6a6a6a6a6a6```ha6a6a6a6a6a6#X`a`````````.aHa6a6a6a6a6a6a6a6a6a6a6`t", +"aEax#1`o#m#Farap#E#r#j.Y.U#U#4axax#1#K`r`r`raH`b```````````##Na5a6a6a6a6```ha6a6a6a6a0`j`````````````oa6a6a6a6a6a6a6a6a6a6a6a6`t", +"aDax#Q.l#s#Hap#I#C#r#k#h.V.Zafaxax#1#K`r`r`raK#S```````````````faHa6a6a6```ha6a6a6#V`a`````````````#aWa6a6a6a6a6a6a6a6a6a6a6a6`t", +"aAax`t.S#o#B#F#E#A#n#j#h.V.MaGaxax#0#K`r`r`raKa6`e```````````````.axa6a6```ha6a6`r`````````````````ta6a6a6a6a6a6a6a6a6a6a6a6a6`t", +"azax.n#h#k#q#u#t#o#k#j.Y.V.Malaxax#Z#K`r`r`raKa6#Z```````````````ra6a6a6```ha6a6a0`e`````````````aa4a6a6a6a6a6a6a6a6a6a6a6a6a6`t", +"a#ax#K.X#i#k#k#k#k#j#h.X.T.Jamaxax#Z#K`r`r`raKa6a6`h``````````#Qa6a6a6a6```ha6a6a6a4`h``````````#Sa6a6a6a6a6a6a6a6a6a6a6a6a6a6`t", +"#2ax#Q.G.Y#h#i#i#i#h.Y.V.M.La4axax#Z#K`r`r`raKa6a6aB`.`````````oa6a6a6a6```ha6a6a6aY`d`````````ca5a6a6a6a6a6a6a6a6a6a6a6a6a6a6`t", +"#1ax#X.s.T.X.Y.Y.Y.X.T.N.J#aaWaxax#Z`W`r`r`raKa6a6a6`o```##Z`g```pa6a6a6```ha6a6aY`d``#N`r````#Za6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`t", +"#Zaxax#W.3.N.T.T.T.N.M.J.Ra3azaxax#X`t`r`r`raKa6a6a6aK`a#1a6a4`g``#Ka6a6```ha6a4`f``#Na6a6`r`fa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`t", +"#Zaxax#4af.8.J.J.J.J.I.6a3aDaxaxax#X`t`r`r`raKa6a6a6a6a4a6a6a6a4`c``#Na6```ha4`h```pa6a6a6a6a4a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`t", +"#XaxaxaxaxaFa1akabaiaRaYaBaxaxaxax#X`t`r`r`raKa6a6a4#Z`p`e#Sa6a6aW`c``#V```h`j```oa6a6a6`i`g#Kaza6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`t", +"#XaxaxaxaxaxaxaHaHaHazaxaxaxaxaxax#X`t`r`r`r#S`t`f`.``````#Sa6a6a6aW`a`.```#```ha6a6a6a6`h```````a`h#QaBa6a6a6a6a6a6a6a6a6a6a6`t", +"#Vaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxax#X`o`f`b````````````````#Sa6a6a6a6aH`a`````ga4a6a6a6a6`h```````````````a`h#SaJa6a6a6a6a6a6a6`t", +"#Vaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxax#V`c`````````````````````e`j`j`j`j`j`e`````h`j`j`j`j`j`b```````````````````````b`j#SaHa6a6a6`t", +"#Vaxaxaxax#Z#N`r`r`t#N#Yaxaxaxaxax#V`c```````````````````````````````````````````````````````````````````````````````a`i#Va6a6`t", +"#Saxaxax#Q`l.uan#z#e.v`E#Saxaxaxax#V`e`.```````````````````t```oa4a4a4a4```ha4a4a4a4`a`e`g```````````````````b`i#QaHa6a6a6a6a6`t", +"#Raxax#Q`nataTaSau#D#d`N`F#Vaxaxax#V`t`r`j`f`f`#``````````#K```pa6a6a6a6```ha6a6a6a6`a`f`h```````````c`j#VaKa6a6a6a6a6a6a6a6a6`t", +"#Qax#Z`maoaSaVaUawar#p.y`H#5#1axax#V`t`r`r`raKa5aD#N`i`b``#K```pa6a6a6a6```ha6a6a6a6`a`f`h```d`p#VaKa6a6a6a6a6a6a6a6a6a6a6a6a6`t", +"#Qax#Q.taraSaUaSavaq#x.z`J`Cayaxax#S`r`r`r`raKa6a6a6a6a6aHax```pa6a6a6a6```ha6a6a6a6`a`fazaWa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`t", +"#Nax`s.D#Dauavavas#G#g.z`J`uagaxax#S`r`r`r`raKa6a6a6a6a6a6aW```pa6a6a6a6```ha6a6a6a6`a`fa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`s", +"#Kax#K.y#p#Jaraq#G#y#c.w`H`u#8axax#S`r`r`r`raKa6a6a6a6a6a6aW```pa6a6a6a6```ha6a6a6a6`a`fa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`r", +".nax#M`M.A#f#y#y#g#c.y`K`y`uaLaxax#S`r`r`r`raKa6a6a6a6a6a6aW```pa6a6a6a6```ha6a6a6a6`a`fa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`r", +"`tax#S`G`L.y.B.C.A.x`L`A`u`Ba4axax#Q`r`r`r`raKa6a6a6aB`i`i`h```c`i`i`ja6```haH`i`i`i`#`a`i`i`ia6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`r", +"`rax#Z.o`y`I`L`N`L`J`z`v`u#6aKaxax#Q`r`r`r`raKa6a6a6aK```````````````ha6```ha4`.`````````````ea6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`r", +"`raxax#Y`O`v`x`y`x`w`u`u`Pa4axaxax#Q`r`r`r`raKa6a6a6a6`b````````````#Qa6```ha6`g`````````````pa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`r", +"`paxaxaxax#7`D`u`u`u`B#6a4azaxaxax#N`p`r`r`raKa6a6a6a6`i````````````aDa6```ha6`t````````````#Xa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`r", +"`oaxaxaxaxaBaWaMa`aLa4aKaxaxaxaxax#N`p`r`r`raKa6a6a6a6#S```````````aa6a6```ha6ax````````````aYa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`r", +"`jaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxax#N`p`r`r`raKa6a6a6a6aH```````````ha6a6```ha6a4`#`````````ca6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`r", +"`jaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxax#L`p`r`r`raKa6a6a6a6a6`b````````#Sa6a6```ha6a6`h`````````pa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`q", +"`i#Zaxaxaxaxaxaxaxaxaxaxaxaxaxaxax`p`r`r`r`raKa6a6a6a6a6`h````````aHa6a6```ha6a6#K````````#Sa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`p", +"a8`h`t`t`t`t#K#K#K#K#K#K#K#K#K#K`o`o`r`r`r`raKa6a6a6a6a6#N```````ba6a6a6```ha6a6aD````````aKa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`p", +"a8a8a8a8`o`o`p`p`p`h`j`p`p`p`p`p`p`r`r`r`r`raKa6a6a6a6a6aD```````ja6a6a6```ha6a6a5`#`````ba6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`p", +"a8a8a8a8`r`r`r`r`r`h`o`r`r`r`r`r`r`r`r`r`r`raKa6a6a6a6a6a5`a````#Sa6a6a6```ha6a6a6`h`````ja6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`p", +"a8a8a8a8`r`r`r`r`r`h`o`r`r`r`r`r`r`r`r`r`r`raKa6a6a6a6a6a6`h````aKa6a6a6```ha6a6a6#N````#Sa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`p", +"a8a8a8a8a8`r`r`r`r`h`o`r`r`r`r`r`r`r`r`r`r#Na6a6a6a6a6a6a6`t```ca6a6a6a6```ha6a6a6aH````aHa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`p", +"a8a8a8a8a8a8a8a8a8`j#K#S#S#S#S#S#S#S#S#S#Xa4a6a6a6a6a6a6a6az```oa6a6a6a6```ha6a6a6a5`a`ba6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`p", +"a8a8a8a8a8a8a8a8a8#SaKa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a4`##Va6a6a6a6```ha6a6a6a6`i`ia6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`o", +"a8a8a8a8a8a8a8a8a8#SaKa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`gaWa6a6a6a6```ha6a6a6a6#Q#Qa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`o", +"a8a8a8a8a8a8a8a8a8#SaKa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6#Va6a6a6a6a6```ha6a6a6a6aHaDa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`o", +"a8a8a8a8a8a8a8a8a8#SaKa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a5a6a6a6a6a6```ha6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`o", +"a8a8a8a8a8a8a8a8a8#SaKa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6```ha6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`o", +"a8a8a8a8a8a8a8a8a8#QaKa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6```ga6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`o", +"a8a8a8a8a8a8a8a8a8#QaKa6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6```ga6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6a6`j", +"a8a8a8a8a8a8a8a8a8#Q`r`r`r`r`r`r`r`r`r`s`t`t`t`t`t`t`t`t`t`t`t`t`t`t`t`t`j`o`r`r`r`r`r`r`r`r`r`r`p`p`p`p`p`p`p`p`o`o`o`o`o`o`j`j" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vaporizer.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vaporizer.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vaporizer.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vaporizer.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,278 @@ +/* XPM */ +static const char *vaporizer_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 256 2 ", +" c #040700", +". c #091100", +"X c #0B1400", +"o c #0C1501", +"O c #0F1B00", +"+ c #152500", +"@ c #162800", +"# c #1C3300", +"$ c #1E3600", +"% c #223D00", +"& c #264400", +"* c #2A4B01", +"= c #2B4E00", +"- c #2D5100", +"; c #2F5400", +": c #315800", +"> c #335B00", +", c #366200", +"< c #386500", +"1 c #3A6900", +"2 c #3C6C00", +"3 c #3E6F00", +"4 c #407300", +"5 c #427600", +"6 c #447A00", +"7 c #457D00", +"8 c #478000", +"9 c #498400", +"0 c #4B8700", +"q c #4F8E00", +"w c #529400", +"e c #549800", +"r c #569B00", +"t c #589F00", +"y c #5AA200", +"u c #62B000", +"i c #63B300", +"p c #65B600", +"a c #67BA00", +"s c #69BD00", +"d c #739D40", +"f c #6BC000", +"g c #6DC400", +"h c #6FC700", +"j c #70CA00", +"k c #72CE00", +"l c #74D100", +"z c #76D500", +"x c #78D800", +"c c black", +"v c black", +"b c black", +"n c black", +"m c black", +"M c black", +"N c black", +"B c black", +"V c black", +"C c black", +"Z c black", +"A c black", +"S c black", +"D c black", +"F c black", +"G c black", +"H c black", +"J c black", +"K c black", +"L c black", +"P c black", +"I c black", +"U c black", +"Y c black", +"T c black", +"R c black", +"E c black", +"W c black", +"Q c black", +"! c black", +"~ c black", +"^ c black", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" x - k ; x x x x x x x y ", +"y > t w x @ 1 a x x x x x x x y ", +"y t # l x - x x x x x x x x x y ", +"y z u x x p x x x x x x x x x y ", +"y x x x x x x x x x x x x x x y ", +"9 0 + O O + 0 u x x x x x x x y ", +"> X O . o 7 x x x x g 5 x y ", +"y - 0 = 2 y O x x x x g 8 0 x y ", +"y - 0 - 2 y O x x 8 4 : : 4 & q ", +"y - 0 - 2 y O x p 7 - > 3 9 g y ", +"y - 0 - 2 y O x x x , r i h s e ", +"y - 4 % > 0 O x x x p x 0 5 q 5 ", +"d , $ $ $ $ * y y y y y y y y d " +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/variablespeedsign.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/variablespeedsign.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/variablespeedsign.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/variablespeedsign.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,278 @@ +/* XPM */ +static const char *variablespeedsign_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 256 2 ", +" c #505050", +". c #606060", +"X c #686868", +"o c #6C6C6C", +"O c #747474", +"+ c #BF6868", +"@ c #BF7070", +"# c #FF3838", +"$ c #FF4444", +"% c #FF4F4C", +"& c #FF5454", +"* c #FF5858", +"= c #FF6868", +"- c #FF766C", +"; c #FF7070", +": c #FF7878", +"> c #FFEB7C", +", c #838383", +"< c gray53", +"1 c #8B8B8B", +"2 c gray56", +"3 c #939393", +"4 c #979797", +"5 c #9B9B9B", +"6 c #9F9F9F", +"7 c #A7A7A7", +"8 c gray67", +"9 c #AFAFAF", +"0 c #BFA3A3", +"q c #BFA7A7", +"w c gray70", +"e c #B7B7B7", +"r c #BFB3B3", +"t c #BFB7B7", +"y c #BBBBBB", +"u c gray75", +"i c #FF8B8B", +"p c #FF9393", +"a c #FF9797", +"s c #FFABAB", +"d c #FFAFAF", +"f c #FFC080", +"g c #FFCA80", +"h c #FFDE93", +"j c #FFEE8F", +"k c #FFEF93", +"l c #FFEC9B", +"z c #FFF09B", +"x c #FFEEA7", +"c c #FFF4B7", +"v c #FFF5BB", +"b c gray81", +"n c LightGray", +"m c #D7D7D7", +"M c #DFDFDF", +"N c #FFC3C3", +"B c #FFCBCB", +"V c #FFCFCF", +"C c #FFD7D7", +"Z c #FFF8D3", +"A c #FFFADF", +"S c gray89", +"D c #E7E7E7", +"F c gray92", +"G c #EFEFEF", +"H c #FFFBE3", +"J c #FFFDEF", +"K c gray97", +"L c #FFFEF7", +"P c gray100", +"I c black", +"U c black", +"Y c black", +"T c black", +"R c black", +"E c black", +"W c black", +"Q c black", +"! c black", +"~ c black", +"^ c black", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" v z J g = P 4 < X X < 7 ", +"@ i L k j H f ; m 3 . o , 5 D u ", +"r # h Z A x % B P P O e n F M w ", +"u N # i a $ p P P P m P 6 1 7 1 ", +"9 u t @ + 0 u u u u u u u u u 9 " +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_army.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_army.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_army.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_army.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,294 @@ +/* XPM */ +static const char *vclass_army_xpm[] = { +/* columns rows colors chars-per-pixel */ +"64 32 256 2 ", +" c #2D3A34", +". c #2D3B35", +"X c #2F3C36", +"o c #313E38", +"O c #313F39", +"+ c #324039", +"@ c #33403A", +"# c #33413B", +"$ c #34413B", +"% c #34423B", +"& c #35423C", +"* c #37443E", +"= c #384640", +"- c #394741", +"; c #3B4942", +": c #3C4A44", +"> c #3D4B45", +", c #3F4D47", +"< c #3F4E47", +"1 c #414F49", +"2 c #415049", +"3 c #43524B", +"4 c #44514B", +"5 c #44534C", +"6 c #46554E", +"7 c #46554F", +"8 c #47564F", +"9 c #48574F", +"0 c #485750", +"q c #4B5651", +"w c #4B5752", +"e c #495850", +"r c #495851", +"t c #4A5953", +"y c #4A5A51", +"u c #4E5953", +"i c #4C5A53", +"p c #4C5B54", +"a c #4E5D56", +"s c #4E5D57", +"d c #4E5E57", +"f c #515C57", +"g c #4F6055", +"h c #506156", +"j c #506157", +"k c #516357", +"l c #506059", +"z c #51615A", +"x c #53635A", +"c c #53655A", +"v c #55635C", +"b c #57625D", +"n c #54645D", +"m c #57655E", +"M c #55675C", +"N c #56665F", +"B c #57685F", +"V c #58675E", +"C c #58695F", +"Z c #596B5F", +"A c #5A6D5F", +"S c #576760", +"D c #576860", +"F c #586760", +"G c #586860", +"H c #586861", +"J c #5A6862", +"K c #5A6B62", +"L c #5B6D63", +"P c #5B6F60", +"I c #5F6965", +"U c #5C6D63", +"Y c #5F6C66", +"T c #5C7061", +"R c #5D7062", +"E c #5F7264", +"W c #626C67", +"Q c #606F68", +"! c #646E69", +"~ c #607465", +"^ c #627666", +"/ c #627767", +"( c #63706A", +") c #627569", +"_ c #647969", +"` c #66796C", +"' c #667B6C", +"] c #677D6A", +"[ c #687D6A", +"{ c #697F6B", +"} c #697E6E", +"| c #687670", +" . c #6C7873", +".. c #6F7A75", +"X. c #6A806D", +"o. c #6B816E", +"O. c #6B826E", +"+. c #6E866E", +"@. c #6E866F", +"#. c #6E8571", +"$. c #6F8672", +"%. c #708773", +"&. c #718873", +"*. c #728A72", +"=. c #728974", +"-. c #728A75", +";. c #748C76", +":. c #768F76", +">. c #768F77", +",. c #79927C", +"<. c #7C957E", +"1. c #7D967E", +"2. c #7C8581", +"3. c #878F8B", +"4. c #809A81", +"5. c #819B82", +"6. c #829884", +"7. c #829C83", +"8. c #8A918E", +"9. c #8A938F", +"0. c #8D9491", +"q. c #8C9692", +"w. c #8D9793", +"e. c #919895", +"r. c #929996", +"t. c #8BA38C", +"y. c #9AA19E", +"u. c #9BA39F", +"i. c #9BAF9C", +"p. c #9CA3A0", +"a. c #9CA4A1", +"s. c #9EA7A3", +"d. c #A0A5A3", +"f. c #A0A8A5", +"g. c #A2ABA7", +"h. c #A5ABA8", +"j. c #A7ACAA", +"k. c #ABB2AE", +"l. c #AABCAB", +"z. c #ADB4B0", +"x. c #AEB5B2", +"c. c #AFB6B3", +"v. c #B0B7B4", +"b. c #B2B9B6", +"n. c #B6BCB9", +"m. c #B7BDBA", +"M. c #B0C0B0", +"N. c #B0C0B1", +"B. c #B6C5B7", +"V. c #BBC0BE", +"C. c #BCC1BF", +"Z. c #C3CFC4", +"A. c #C9CECC", +"S. c #C8D3C8", +"D. c #C9D4C9", +"F. c #D2D6D4", +"G. c #D4D7D5", +"H. c #D5DDD5", +"J. c #D7DFD7", +"K. c #D7DAD9", +"L. c #DBDEDD", +"P. c #D8E0D8", +"I. c #DDE0DF", +"U. c #DDE4DD", +"Y. c #DDE4DE", +"T. c #E3E5E4", +"R. c #E5EAE5", +"E. c #E8ECE8", +"W. c #EBECEC", +"Q. c #EFF2EF", +"!. c #EFF0F0", +"~. c #F2F3F2", +"^. c #F2F3F3", +"/. c #F3F5F3", +"(. c gray96", +"). c #F5F6F6", +"_. c #F6F7F7", +"`. c #F7F9F8", +"'. c #F8F9F8", +"]. c #F9FAF9", +"[. c gray98", +"{. c #FBFBFB", +"}. c #FBFCFB", +"|. c gray99", +" X c #FDFDFD", +".X c #FDFEFE", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" I..X.X.X.X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.XG. - 6 6 6 6 6 N H H H 6 : K..X.X.X.X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.XC. * 6 6 6 6 6 n H H N = : L..X.X.X.X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.Xh. $ 6 6 6 6 6 m.'.2.u q f 9.|..X.X.X.X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.Xr. o 6 6 6 6 6 k..X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.Xy. O 6 6 6 6 6 n..X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X_.a.0.8.1 1 1 1 1 1 1 1 1 1 2 t d l a.a.c.{..X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.XF.q.( J J J a a a a a a a a a a s z n n Q Q Q | w.F..X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X Xa., X # 2 6 6 6 6 8 a s. X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.Xx.% . < 6 6 6 6 6 r v..X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X).4 X 5 6 6 6 6 6 v )..X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.X.X.XV.m V x . ; 6 6 6 6 6 6 A..X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.X.X.X..e E A . & 6 6 6 6 6 6 b..X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.X.X.X .r Z k + o o o o o o o o o o o o o o o o o o o o o o * r r r r r r z.`.}..X.X.X.X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.X.XU.6.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.4.5.i.U..X.X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.XH.5.;.~ R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R ~ ;.5.H..X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X[.t.#.8 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 8 #.t.[..X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.XY.4.j 6 6 r %.T 6 6 _ X.8 6 M =.g 6 y &.P 6 6 ^ O.0 6 c =.h 6 e $.T 6 6 / o.9 6 6 j 4.Y..X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.XJ.4.G n n L >.[ n n ;.+.B n } *.E n U >.] n n &.@.G n ' *.~ n K :.{ n n -.@.G n n G 4.P..X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.XQ.5.` H H H B S H H B B H H S C F H H B S H H N C H H S C S H H B D H H B B H H H ` 7./..X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.XM.1.) H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H H ) 1.B..X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.X].l.4.<.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.<.4.N.}..X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.X.X.XR.S.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.D.E..X.X.X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X", +".X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_authority.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_authority.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_authority.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_authority.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,294 @@ +/* XPM */ +static const char *vclass_authority_xpm[] = { +/* columns rows colors chars-per-pixel */ +"64 32 256 2 ", +" c #070C12", +". c #13181D", +"X c #0D1A23", +"o c #101E2C", +"O c #12212E", +"+ c #122130", +"@ c #132534", +"# c #142332", +"$ c #142431", +"% c #172734", +"& c #152737", +"* c #172835", +"= c #172836", +"- c #172A37", +"; c #172A38", +": c #172C3B", +"> c #192734", +", c #182837", +"< c #192A38", +"1 c #192C3A", +"2 c #192F3F", +"3 c #262625", +"4 c #22282F", +"5 c #282828", +"6 c #252D32", +"7 c #292E32", +"8 c #38312E", +"9 c #343631", +"0 c #353C3F", +"q c #1A2F41", +"w c #1B3242", +"e c #1C3041", +"r c #1E3142", +"t c #1C3343", +"y c #1F3345", +"u c #1D3445", +"i c #203446", +"p c #223647", +"a c #263441", +"s c #253544", +"d c #203548", +"f c #203648", +"g c #21374A", +"h c #20384A", +"j c #21394C", +"k c #223A4D", +"l c #26394A", +"z c #2A3045", +"x c #283B4C", +"c c #2C3E4C", +"v c #384041", +"b c #304354", +"n c #374451", +"m c #354654", +"M c #394B57", +"N c #3A4C58", +"B c #3A4C5B", +"V c #3C4F5D", +"C c #3B5263", +"Z c #4C2543", +"A c #601C40", +"S c #6D1740", +"D c #652045", +"F c #45453D", +"G c #4C4538", +"H c #714F1C", +"J c #72551C", +"K c #40525F", +"L c #405161", +"P c #445564", +"I c #465765", +"U c #445B6B", +"Y c #465C6B", +"T c #4F5E66", +"R c #485E6B", +"E c #4D616D", +"W c #536270", +"Q c #526571", +"! c #546370", +"~ c #635F5C", +"^ c #626F73", +"/ c #606F7B", +"( c #657274", +") c #687477", +"_ c #6D7672", +"` c #6E7881", +"' c #6D7A86", +"] c #757E87", +"[ c #51859B", +"{ c #52869C", +"} c #56889C", +"| c #54889E", +" . c #598DA3", +".. c #5F93A8", +"X. c #73848E", +"o. c #798382", +"O. c #78848C", +"+. c #79858F", +"@. c #768690", +"#. c #7B8792", +"$. c #7A8A93", +"%. c #7C9396", +"&. c #6192A5", +"*. c #6094A9", +"=. c #6195AA", +"-. c #6993A2", +";. c #7097A4", +":. c #6FA3B7", +">. c #78A0AC", +",. c #70A4B8", +"<. c #73A7BB", +"1. c #75A9BD", +"2. c #7DB1C4", +"3. c #88103E", +"4. c #90093C", +"5. c #A9043C", +"6. c #AD0D42", +"7. c #A63E66", +"8. c #98492B", +"9. c #9F721E", +"0. c #9A6820", +"q. c #AE5E21", +"w. c #B1822D", +"e. c #FE9300", +"r. c #FEA200", +"t. c #F4B87D", +"y. c #848D89", +"u. c #848D8A", +"i. c #868F8A", +"p. c #8A938E", +"a. c #8D968E", +"s. c #829596", +"d. c #839797", +"f. c #83949E", +"g. c #859099", +"h. c #85909A", +"j. c #849798", +"k. c #8B939B", +"l. c #919993", +"z. c #959C95", +"x. c #9D9D9D", +"c. c #8596A0", +"v. c #8A9CA6", +"b. c #8E98A1", +"n. c #949EA6", +"m. c #99A098", +"M. c #8AA7AA", +"N. c #8BA8AA", +"B. c #8BA9AE", +"V. c #8CA8AB", +"C. c #8CA9AC", +"Z. c #8DAAAC", +"A. c #92A5A5", +"S. c #95A6A2", +"D. c #97A3AA", +"F. c #98A1A9", +"G. c #9AA3AB", +"H. c #9BA4AC", +"J. c #9EA6AE", +"K. c #9FA9AF", +"L. c #9CB2AF", +"P. c #97B5B8", +"I. c #9EB4B1", +"U. c #9FBDBF", +"Y. c #A0A69D", +"T. c #A4AA9F", +"R. c #A9AEA3", +"E. c #A0A9B0", +"W. c #ACB1A5", +"Q. c #ADB6AC", +"!. c #A5B7B1", +"~. c #B8B9A5", +"^. c #B0BEB4", +"/. c #BABBBC", +"(. c gray75", +"). c #80B4C7", +"_. c #87B6C6", +"`. c #81B5C8", +"'. c #8CB9C6", +"]. c #90BECE", +"[. c #99B7C3", +"{. c #9DBDC1", +"}. c #9DBEC3", +"|. c #A0BEC0", +" X c #AEBCC3", +".X c #B3BCC1", +"XX c #B2BEC3", +"oX c #BABFC3", +"OX c #B3C0B5", +"+X c #B2C0B6", +"@X c #B3C1B8", +"#X c #B6C5BC", +"$X c #B5C6BF", +"%X c #BCC0B0", +"&X c #BBC7BE", +"*X c #BDC5B8", +"=X c #B9C8BF", +"-X c #BFCABE", +";X c #99C3D2", +":X c #A2C0C2", +">X c #ABC4C2", +",X c #A2C7D4", +".,XPXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXzXl d.[ :.`.1.| <.`.`.)...rXrX,.).*.[ [ [ [ [ [ &.X'.`.].SXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXLXaXJ.g./ i Y.j.A.=X+X@X=X=X=X#X^.*XyXyXQ.s.S.^.^.^.^.^.#X=X-XqX=X=X&XO.#.F.2XBXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXIXG.b i i i i i T.u.p.W.W.W.W.W.W.W.W.W.W.W.m.u.z.W.W.W.W.W.W.W.W.W.W.W.W.M i i i i B +.pXIXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXn.i i i i i i i ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ^ i i i i i i i i I 3XUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUX9XD i i i i i i i y.i.i.i.i.i.i.i.i.i.i.i.i.i.i.i.i.i.i.i.i.i.i.i.i.i.i.i.( i i i i i i i i i i h.UXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUX7XS i i i i i g h m l.yXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyX( i f j f i i i i i i i E.UXUXUXUXUXUXUX", +"UXUXUXUXUXUXUX8X8.i i i h 1 = * 1 h o.yXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXN u ; % ; t i i 0 0.9.9.w.MXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXt.q.i i h - y h j i $ j R.yXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyX%Xu 1 i k d , w i G e.r.r.r.uXUXUXUXUXUXUX", +"UXUXUXUXUXUXUX~ 8 & & 2 r C XXXR + : _ ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.a.1 j f.1Xc.< O q 6 H J J J mXUXUXUXUXUXUX", +"UXUXUXUXUXUX(.. O i v.cXxXK.& + 9 F F F F F F F F F F F F F F F F F F F F F F F v 1 Y kXVX4XK o X /.UXUXUXUXUXUX", +"UXUXUXUXUXUXx.5 5 5 5 7 i v.hXgXD.@ 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 s U sXkX.XV > 5 5 5 5 5 5 x.UXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXPXL p X.@.c < NXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXH.e E $.Q + k.UXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXzXn + + a oXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXIX] # + + ` PXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXIXfXpXFXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXBXiXNXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_bicycle.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_bicycle.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_bicycle.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_bicycle.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,294 @@ +/* XPM */ +static const char *vclass_bicycle_xpm[] = { +/* columns rows colors chars-per-pixel */ +"64 32 256 2 ", +" c #504A5A", +". c #514B5B", +"X c #514C5B", +"o c #554F5F", +"O c #55505F", +"+ c #565060", +"@ c #5E5967", +"# c #5F5968", +"$ c #6A555C", +"% c #605A69", +"& c #615B6A", +"* c #615C6A", +"= c #625C6B", +"- c #645D6A", +"; c #66616E", +": c #66616F", +"> c #67626F", +", c #676270", +"< c #696472", +"1 c #6B6773", +"2 c #6C6774", +"3 c #6E6976", +"4 c #6E6977", +"5 c #6F6A77", +"6 c #706B78", +"7 c #716C79", +"8 c #726D7A", +"9 c #726E7A", +"0 c #746E7A", +"q c #746F7C", +"w c #77737F", +"e c #7C7178", +"r c #797581", +"t c #797681", +"y c #7B7682", +"u c #7C7884", +"i c #88615D", +"p c #8C6C6A", +"a c #827277", +"s c #81747C", +"d c #927C7E", +"f c #987774", +"g c #A07168", +"h c #AD7D71", +"j c #B67A68", +"k c #BF7760", +"l c #B87865", +"z c #837A82", +"x c #807B87", +"c c #847E87", +"v c #807C88", +"b c #837F8A", +"n c #C5836D", +"m c #DA8262", +"M c #DC8666", +"N c #EF8C64", +"B c #E29476", +"V c #F68E64", +"C c #F99166", +"Z c #FE9164", +"A c #FE9165", +"S c #FE9265", +"D c #FE9266", +"F c #FE9468", +"G c #FE9469", +"H c #FE956A", +"J c #FE966B", +"K c #FE976C", +"L c #FE976D", +"P c #FE986D", +"I c #FE996F", +"U c #FA9870", +"Y c #FE9A71", +"T c #FE9B72", +"R c #FEA079", +"E c #FEA17B", +"W c #FEA37D", +"Q c #84808B", +"! c #86828D", +"~ c #88858F", +"^ c #898590", +"/ c #8A8691", +"( c #8B8792", +") c #97888B", +"_ c #99888C", +"` c #938F99", +"' c #93909A", +"] c #95929B", +"[ c #98959E", +"{ c #99969F", +"} c #9E9BA3", +"| c #9E9BA4", +" . c #A18886", +".. c #A1989D", +"X. c #B99289", +"o. c #BDA09A", +"O. c #A6A3AB", +"+. c #A6A4AB", +"@. c #A8A6AD", +"#. c #ABA9B0", +"$. c #ADAAB1", +"%. c #AEACB3", +"&. c #AFADB4", +"*. c #B1AEB5", +"=. c #B1AFB6", +"-. c #BBAFB0", +";. c #B5B3BA", +":. c #B9B5BB", +">. c #B8B5BC", +",. c #B8B6BC", +"<. c #B9B7BD", +"1. c #BAB7BE", +"2. c #BDBBC1", +"3. c #BEBCC2", +"4. c #BFBDC3", +"5. c #D4A596", +"6. c #CFAFA7", +"7. c #C9B0AC", +"8. c #C3B8B9", +"9. c #C2BBBE", +"0. c #DBB7AB", +"q. c #D4BBB5", +"w. c #D0BFBC", +"e. c #FEA580", +"r. c #FEA681", +"t. c #FEA682", +"y. c #FEA884", +"u. c #FEA986", +"i. c #FAA988", +"p. c #FEAB89", +"a. c #FEAC8A", +"s. c #FEAF8F", +"d. c #FEB495", +"f. c #FEB597", +"g. c #FEB698", +"h. c #FEB89B", +"j. c #FEB89C", +"k. c #FEB99D", +"l. c #FEBA9E", +"z. c #FEBB9F", +"x. c #FEBCA1", +"c. c #C1BFC5", +"v. c #D4C2BF", +"b. c #FEC0A6", +"n. c #FEC0A7", +"m. c #FEC3AB", +"M. c #FEC4AC", +"N. c #FEC5AD", +"B. c #FEC6AE", +"V. c #FEC6AF", +"C. c #FEC7B0", +"Z. c #FEC8B1", +"A. c #FEC8B2", +"S. c #FEC9B4", +"D. c #FECBB6", +"F. c #FECCB7", +"G. c #FECDB8", +"H. c #FECDB9", +"J. c #FED1BF", +"K. c #C2C0C5", +"L. c #C2C0C6", +"P. c #C5C4C9", +"I. c #C7C5CA", +"U. c #C7C6CB", +"Y. c #C8C6CB", +"T. c #C9C7CC", +"R. c #C9C8CC", +"E. c #CBCACE", +"W. c #CDCCD0", +"Q. c #CFCDD2", +"!. c #D0CED2", +"~. c #D0CED3", +"^. c #D2D0D4", +"/. c #D3D2D5", +"(. c #D4D2D6", +"). c #D5D4D7", +"_. c #D6D5D8", +"`. c #D7D6D9", +"'. c #D8D7DA", +"]. c #D8D8DB", +"[. c #D9D9DC", +"{. c #DBDADD", +"}. c #DDDCDF", +"|. c #DFDEE1", +" X c #E9D1C9", +".X c #F3D0C2", +"XX c #F6D2C4", +"oX c #F4D5C9", +"OX c #FED3C1", +"+X c #FED3C2", +"@X c #FED4C3", +"#X c #FED6C5", +"$X c #FED7C7", +"%X c #FED8C8", +"&X c #FEDACB", +"*X c #FEDBCC", +"=X c #FEDBCD", +"-X c #FEDDCF", +";X c #FEDDD0", +":X c #FEDFD3", +">X c #E0DFE1", +",X c #E0DFE2", +"XK.,.L.,XPXUXUXUXOXZ sXUXUXUX=XZ b.IXg.S S.#XZ 6X,XL.,.K.>XPXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXGX*.: : =.GXUX4XZ B.UXUXhXP p.LXH.Z J.UXCXC l : *.GXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUX8X5 . v <.[.7X[.<.x . 6 XI Z R UXJXy.Y lXjXG h.UX9X6 k N :.[.7X[.<.v . 5 8XUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUX9X& & I.uXpXbXMXbXpXuXP.p V W H.Z 3Xf.D 2XUXj.K ZXqX= % 6.Z oXbXMXbXpXuXI.& & 9XUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXHX9 % [.iXDXUXUXUXUXUXDX.XF m s SXK H S +XUXfXD C.LXq # ].yXT j.UXUXUXUXDXiX[.% 9 HXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUX>. L.iXHXUXUXUXUXUXUX@XD i.9. 1.k.Z -XUXUXk.L AX1. c.iXHXn.J ZXUXUXUXUXHXiXL. >.UXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUX4 r uXVXUXUXUXUXUXUXG.A d.mXuXw 6 1XZ :XUXdXD V.UX6 w uXBXUXhXG z.UXUXUXUXUXVXuXr 4 UXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXeX *.iXUXUXUXUXUXGXN.Z l.LXUXiX%. tXB .' X.U AXyX %.iXUXUXUXZ.S 5XUXUXUXUXUXiX*. eXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXW. W.vXUXUXUXUX$.n Z e.&X*X*XXX0.i 7.w a f 0 ..UX~. W.vXUXUXUXJXR t.LXUXUXUXUXvXW. W.UXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXP. `.bXUXUXUXUXd Z Z Z Z Z Z Z Z Z h e M j o.9 pXY. ).bXUXUXUXUX;XZ aXUXUXUXUXbX`. P.UXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUX^. E.vXUXUXUXUXK.) v.fXfXfXfX | 4.Y.3.} : / MXUXUXUXUXUXUXUXUXUXUXUXUXMX/ : } 3.Y.4.| > ^ nXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXQ.b o O Q ~.UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX~.Q O o b Q.UXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXFX,X_.,XFXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXFX,X_.,XFXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_bus.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_bus.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_bus.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_bus.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,294 @@ +/* XPM */ +static const char *vclass_bus_xpm[] = { +/* columns rows colors chars-per-pixel */ +"64 32 256 2 ", +" c #504B5A", +". c #514C5B", +"X c #524D5C", +"o c #534E5C", +"O c #534E5D", +"+ c #554B5A", +"@ c #554C5A", +"# c #564E5C", +"$ c #544F5E", +"% c #584D5B", +"& c #594D5C", +"* c #5E4C5A", +"= c #55505E", +"- c #55505F", +"; c #565160", +": c #575260", +"> c #585361", +", c #585362", +"< c #595563", +"1 c #5A5564", +"2 c #5A5664", +"3 c #5B5665", +"4 c #5C5765", +"5 c #5C5866", +"6 c #5E5967", +"7 c #624C5A", +"8 c #644D5A", +"9 c #684D5A", +"0 c #6D4D5A", +"q c #7A515C", +"w c #615C6A", +"e c #625D6B", +"r c #635E6C", +"t c #645F6D", +"y c #6C5966", +"u c #745D69", +"i c #7B5D69", +"p c #66626F", +"a c #676270", +"s c #686370", +"d c #686371", +"f c #686471", +"g c #696572", +"h c #6F6B78", +"j c #706C78", +"k c #716C79", +"l c #726E7A", +"z c #736F7B", +"x c #74707C", +"c c #7C7884", +"v c #8A525C", +"b c #925F68", +"n c #A2515A", +"m c #AB525A", +"M c #B2535A", +"N c #B2575E", +"B c #B1595F", +"V c #BA535A", +"C c #B35960", +"Z c #C1545A", +"A c #C2575D", +"S c #C5545A", +"D c #C0585E", +"F c #C9585D", +"G c #D1555A", +"H c #D4565B", +"J c #C45C61", +"K c #CA5C61", +"L c #D65E62", +"P c #D65F64", +"I c #DD5F62", +"U c #CF6266", +"Y c #DF6062", +"T c #DE6265", +"R c #D86368", +"E c #D9696D", +"W c #D96A6E", +"Q c #D97276", +"! c #DA7377", +"~ c #DB7A7E", +"^ c #E25B5E", +"/ c #E56062", +"( c #FB6364", +") c #FD6464", +"_ c #FE7777", +"` c #DC7C80", +"' c #DE7D81", +"] c #85808A", +"[ c #85818C", +"{ c #8B8892", +"} c #8C8892", +"| c #8D8993", +" . c #908D96", +".. c #928F98", +"X. c #939099", +"o. c #A09EA6", +"O. c #A3A0A8", +"+. c #A5A0A8", +"@. c #ABA9B0", +"#. c #BAAAB0", +"$. c #B2B0B6", +"%. c #DF888B", +"&. c #E29295", +"*. c #E3999C", +"=. c #E59C9F", +"-. c #EF9D9E", +";. c #E5A1A4", +":. c #E6A2A5", +">. c #E8A8AA", +",. c #EAAEB0", +"<. c #EAB1B3", +"1. c #EDBCBE", +"2. c #FEA2A2", +"3. c #FEB7B7", +"4. c #C1BDC2", +"5. c #C1BFC4", +"6. c #CAC9CD", +"7. c #D3D1D4", +"8. c #D6D4D8", +"9. c #D9D8DC", +"0. c #DBDADD", +"q. c #DDDCDF", +"w. c #F0C7C9", +"e. c #F1CED0", +"r. c #F3D2D3", +"t. c #E7E6E8", +"y. c #EDE4E5", +"u. c #F2E1E2", +"i. c #F2EDEE", +"p. c #F6ECED", +"a. c #F7EFEF", +"s. c #FAE5E6", +"d. c #F9EFF0", +"f. c #F2F0F1", +"g. c #FBF0F0", +"h. c #FBF1F1", +"j. c #FEF4F4", +"k. c #FEF6F6", +"l. c #F8F8F8", +"z. c #FDF8F8", +"x. c #FEFBFB", +"c. c #FDFCFC", +"v. c #FEFEFE", +"b. c gray100", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" 2 w X ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ q O 5 @ D A - w : 4 w % ^ ^ -.b.b.b.b.b.b.", +"b.b.b.b.b.b.:.G G G G G G G G G G * { 0.$. V G G V . - X o - G G G G G G G G G G m . 5.9.c 0 M . - . O = @ G G *.b.b.b.b.b.b.", +"b.b.b.b.b.b.z.r.w.1.<.>.=.&.%.` ! # O.0.6. M G G S + 7 G G G G G G G G G G n - 8.0.X.8 Z + 9 G G ,.b.b.b.b.b.b.", +"b.b.b.b.b.b.v.v.v.v.v.v.v.v.v.v.v...< .g p p.g.g.g.a.i.i.i.i.d.g.g.g.g.g.g.g.g.g.g.y.3 k | - +.g.a.i.i.i.i.d.g.h.v.b.b.b.b.b.b.", +"b.b.b.b.b.b.v.v.v.v.v.v.v.v.v.v.v.l.o.z } t.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.q.[ x @.c.v.v.v.v.v.v.v.v.v.v.b.b.b.b.b.b.", +"b.b.b.b.b.b.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.b.b.b.b.b.b.", +"b.b.b.b.b.b.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.b.b.b.b.b.b.", +"b.b.b.b.b.b.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.b.b.b.b.b.b.", +"b.b.b.b.b.b.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.b.b.b.b.b.b.", +"b.b.b.b.b.b.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.b.b.b.b.b.b.", +"b.b.b.b.b.b.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.b.b.b.b.b.b.", +"b.b.b.b.b.b.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.v.b.b.b.b.b.b." +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_coach.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_coach.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_coach.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_coach.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,294 @@ +/* XPM */ +static const char *vclass_coach_xpm[] = { +/* columns rows colors chars-per-pixel */ +"64 32 256 2 ", +" c #15222E", +". c #132231", +"X c #182430", +"o c #192935", +"O c #1C2D3A", +"+ c #20272D", +"@ c #24292C", +"# c #252E36", +"$ c #27343F", +"% c #2B353D", +"& c #2C333A", +"* c #2C363E", +"= c #2E393C", +"- c #31302C", +"; c #38342D", +": c #333B3A", +"> c #1F3241", +", c #203140", +"< c #2A3A43", +"1 c #2C3A42", +"2 c #2D3A46", +"3 c #2E3C42", +"4 c #3D3F41", +"5 c #35414C", +"6 c #3E4041", +"7 c #354756", +"8 c #3C4D5A", +"9 c #43463C", +"0 c #4A4A3B", +"q c #524E36", +"w c #745B3B", +"e c #414141", +"r c #775F40", +"t c #7B6243", +"y c #7B6446", +"u c #66707A", +"i c #6D7780", +"p c #6F7982", +"a c #767F88", +"s c #72847E", +"d c #74857D", +"f c #51859B", +"g c #52869C", +"h c #55899F", +"j c #568AA0", +"k c #588CA1", +"l c #678487", +"z c #678588", +"x c #65878E", +"c c #66888F", +"v c #6E8481", +"b c #708581", +"n c #708887", +"m c #748884", +"M c #788A84", +"N c #759396", +"B c #709199", +"V c #79989C", +"C c #6094A9", +"Z c #669AAF", +"A c #6A9AAC", +"S c #679BB0", +"D c #699DB1", +"F c #719BA8", +"G c #7A9BA0", +"H c #6CA0B4", +"J c #72A6B9", +"K c #74A8BC", +"L c #78ACC0", +"P c #7CB0C3", +"I c #7EB2C5", +"U c #885C3D", +"Y c #925D39", +"T c #9B5F35", +"R c #9C6036", +"E c #A26134", +"W c #A86232", +"Q c #857348", +"! c #897546", +"~ c #8F7B4D", +"^ c #927D4D", +"/ c #977851", +"( c #9B7D56", +") c #9D7F6A", +"_ c #E76F1D", +"` c #EC6D16", +"' c #ED7F0F", +"] c #E97F14", +"[ c #FE6700", +"{ c #FA6804", +"} c #FC6803", +"| c #FE6C00", +" . c #F16B10", +".. c #F06C11", +"X. c #F77E06", +"o. c #F17F0B", +"O. c #F07F0C", +"+. c #F67F09", +"@. c #FE7500", +"#. c #FB7E03", +"$. c #F97F06", +"%. c #FE7A00", +"&. c #FD7D00", +"*. c #F57911", +"=. c #9E815B", +"-. c #87866F", +";. c #978C6D", +":. c #AF8147", +">. c #A9824D", +",. c #A08356", +"<. c #B88342", +"1. c #BD8846", +"2. c #B3915E", +"3. c #BA9058", +"4. c #A3826C", +"5. c #A6846C", +"6. c #B18160", +"7. c #B0A07D", +"8. c #B9A072", +"9. c #BBA578", +"0. c #BFA877", +"q. c #CA802E", +"w. c #CE802B", +"e. c #C78031", +"r. c #CC8231", +"t. c #CD8432", +"y. c #CE8635", +"u. c #D28027", +"i. c #D3832B", +"p. c #D78329", +"a. c #D6852D", +"s. c #DB852A", +"d. c #D48937", +"f. c #D28A39", +"g. c #D68E3D", +"h. c #D98831", +"j. c #DA8D37", +"k. c #DD8D34", +"l. c #D88E3C", +"z. c #DE9329", +"x. c #EB8118", +"c. c #EA861E", +"v. c #ED851B", +"b. c #EF9513", +"n. c #EE941D", +"m. c #EE991D", +"M. c #F78F09", +"N. c #F98007", +"B. c #FE8100", +"V. c #FE8004", +"C. c #FE8500", +"Z. c #F98008", +"A. c #FE8800", +"S. c #FE8D00", +"D. c #F28414", +"F. c #F18018", +"G. c #FE8916", +"H. c #F99604", +"J. c #FD9000", +"K. c #FD9600", +"L. c #E08225", +"P. c #E38929", +"I. c #E29423", +"U. c #FE9322", +"Y. c #FE9025", +"T. c #FEAC00", +"R. c #C38D4C", +"E. c #C88B43", +"W. c #C6904E", +"Q. c #C0975F", +"!. c #C4965A", +"~. c #C99350", +"^. c #CA9452", +"/. c #D89C57", +"(. c #C09861", +"). c #C1AC7E", +"_. c #FEA648", +"`. c #FEA54C", +"'. c #FEAA57", +"]. c #FEB266", +"[. c #FEB975", +"{. c #FEC000", +"}. c #81948E", +"|. c #879E9B", +" X c #8E969D", +".X c #8E9D92", +"XX c #919B8D", +"oX c #9B9C87", +"OX c gray61", +"+X c #8F99A2", +"@X c #8CA099", +"#X c #91A59E", +"$X c #9CA799", +"%X c #9CA89C", +"&X c #81A2A6", +"*X c #81A3A9", +"=X c #82A4A9", +"-X c #86A8AD", +";X c #89A4A3", +":X c #8FACAC", +">X c #8BADB2", +",X c #8EAFB2", +".&.XXb M #X}.,XG M @X,.B.J.J.S.J.J.J.B.1.:X*Xm ;Xn s d p.j.,X-Xx x E.s.>X&Xc *XB UXUXUXUXUXUXUX", +"UXUXUXUXUXUXZXC K H 0Xc.D.F f f d X.g k L Z I H j J h l A.K.K.J.K.K.K.C.$XK j J k f f Z (.Q.L j g K R.k.K h J k k UXUXUXUXUXUXUX", +"UXUXUXUXUXUXHXK H 9X2.&.;.f f k #XX.k L Z I H j J h f z A.K.K.J.K.K.K.C..Xh J k f f S qX(.3.j g K D W.a.h J k f k UXUXUXUXUXUXUX", +"UXUXUXUXUXUXAXH 9XN X.u.f f k P 3X+.L Z I H j J h f g &XA.K.K.J.K.K.K.C.-.J k f f D qXqX(.:.g K D I ^.i.J k f f H UXUXUXUXUXUXUX", +"UXUXUXUXUXUXKX9XC e.#.v f k P qX%XN.A I H j J h f g J ~ cXmXrXr X 5.6.6.6.6.6.6.zXUXUXUXUXUXUX", +"UXUXUXUXUXUXbX6X6X6X8 ! kXcXeXt 2 6X6X6X6X6X6X6X6X6X6X6XOXOXOXOXOXOXOXOX6X6X6X6X6X6X6X7 ^ kXcX7Xw 5 6X6X6X6X6X6X6XxXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUX2X= ( 5X( @ XUXUXUXUXUXUXUXUXUXUXJXCXCXCXCXCXCXCXCXUXUXUXUXUXUXUX+X: =.5X/ + 1XUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXp . . i IXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXIXu . . a UXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXCXtXCXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXnXtXCXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"UXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_custom1.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_custom1.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_custom1.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_custom1.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,294 @@ +/* XPM */ +static const char *vclass_custom1_xpm[] = { +/* columns rows colors chars-per-pixel */ +"64 32 256 2 ", +" c #D80027", +". c #D80128", +"X c #D80229", +"o c #D9052B", +"O c #D9072D", +"+ c #DA1034", +"@ c #DB1236", +"# c #DB1639", +"$ c #DC183B", +"% c #DC193C", +"& c #DC1C3E", +"* c #DD1E40", +"= c #DD1E41", +"- c #DD2042", +"; c #DD2143", +": c #DE2647", +"> c #DF2C4D", +", c #DF3150", +"< c #DF3151", +"1 c #E03251", +"2 c #E03655", +"3 c #E13958", +"4 c #E34B67", +"5 c #E44C68", +"6 c #E5556F", +"7 c #E65B74", +"8 c #E7637B", +"9 c #E8677E", +"0 c #E8677F", +"q c #E8687F", +"w c #E96D83", +"e c #E97288", +"r c #EA7489", +"t c #EA748A", +"y c #EA798D", +"u c #EB7E92", +"i c #EB7F93", +"p c #EB8093", +"a c #EC8295", +"s c #EC8396", +"d c #EC8497", +"f c #EE8E9F", +"g c #EF97A7", +"h c #EF98A7", +"j c #EF98A8", +"k c #EF9AA9", +"l c #F09EAD", +"z c #F09FAE", +"x c #F0A0AF", +"c c #F1A2B0", +"v c #F1A4B2", +"b c #F2ABB8", +"n c #F3AFBB", +"m c #F3B0BC", +"M c #F3B2BE", +"N c #F4B5C0", +"B c #F4B5C1", +"V c #F4B6C1", +"C c #F5C0CA", +"Z c #F6C2CB", +"A c #F6C4CD", +"S c #F6C5CE", +"D c #F6C7CF", +"F c #F7CAD2", +"G c #F7CED5", +"H c #F8CFD6", +"J c #F9DAE0", +"K c #FADCE2", +"L c #FADFE4", +"P c #FBE7EB", +"I c #FCEAED", +"U c #FDF3F5", +"Y c #FDF5F6", +"T c #FEF7F8", +"R c #FEF8F9", +"E c #FEFAFB", +"W c #FEFCFC", +"Q c #FFFDFD", +"! c #FFFDFE", +"~ c #FFFEFE", +"^ c gray100", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" K ^ ^ ^ ^ ^ l . v ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ", +"^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ e . i W ^ ^ ^ ^ ~ ^ ^ ^ ^ ^ W u . e ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ", +"^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ~ e , N ! ^ ^ ^ ^ ^ ^ ! N , e ~ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ", +"^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ v @ = 9 h n n g 9 * @ v ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ", +"^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ I r + + r I ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ", +"^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ T M r 5 3 3 5 r M T ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ", +"^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ", +"^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ", +"^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ " +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_custom2.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_custom2.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_custom2.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_custom2.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,294 @@ +/* XPM */ +static const char *vclass_custom2_xpm[] = { +/* columns rows colors chars-per-pixel */ +"64 32 256 2 ", +" c #006DF0", +". c #016EF0", +"X c #0670F0", +"o c #1176F1", +"O c #1679F1", +"+ c #187BF1", +"@ c #1C7DF2", +"# c #1E7EF2", +"$ c #2180F2", +"% c #2683F2", +"& c #2C86F3", +"* c #3189F3", +"= c #368CF3", +"- c #398EF3", +"; c #4B98F4", +": c #4C99F4", +"> c #559DF5", +", c #5BA1F5", +"< c #63A6F6", +"1 c #67A8F6", +"2 c #68A8F6", +"3 c #6DABF6", +"4 c #72AEF7", +"5 c #74AFF7", +"6 c #74B0F7", +"7 c #79B2F7", +"8 c #7EB5F7", +"9 c #7FB6F7", +"0 c #80B6F7", +"q c #82B7F8", +"w c #83B8F8", +"e c #84B9F8", +"r c #8EBEF8", +"t c #97C4F9", +"y c #98C4F9", +"u c #9EC7F9", +"i c #9EC8F9", +"p c #A0C9F9", +"a c #A2CAF9", +"s c #A4CBFA", +"d c #ABCFFA", +"f c #AFD1FA", +"g c #B0D1FA", +"h c #B1D2FA", +"j c #B5D4FB", +"k c #C0DBFB", +"l c #C2DCFB", +"z c #C4DDFB", +"x c #C4DDFC", +"c c #C5DEFC", +"v c #CAE0FC", +"b c #CEE3FC", +"n c #DAEAFD", +"m c #DCEBFD", +"M c #DFECFD", +"N c #E7F1FE", +"B c #EAF3FE", +"V c #F3F8FE", +"C c #F5F9FE", +"Z c #F7FAFE", +"A c #F8FBFF", +"S c #FAFCFF", +"D c #FCFDFF", +"F c #FEFEFF", +"G c black", +"H c black", +"J c black", +"K c black", +"L c black", +"P c black", +"I c black", +"U c black", +"Y c black", +"T c black", +"R c black", +"E c black", +"W c black", +"Q c black", +"! c black", +"~ c black", +"^ c black", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" @ @ v F F F F F F F F 1 6 F F F F F F F F F F F F F F F F F F F ", +"F F F F F F F F F F F F F F F F F F F h # F F F F F F F F F S F F F F F F F F F F # h F F F F F F F F F F F F F F F F F F F ", +"F F F F F F F F F F F F F F F F F F F Z o j F F F F F F F , . % n F F F F F F F j o Z F F F F F F F F F F F F F F F F F F F ", +"F F F F F F F F F F F F F F F F F F F F 5 * D F F F F F l 1 F F F F F F D * 5 F F F F F F F F F F F F F F F F F F F F ", +"F F F F F F F F F F F F F F F F F F F F B o 9 F F F F F z 2 F F F F F F 8 o B F F F F F F F F F F F F F F F F F F F F ", +"F F F F F F F F F F F F F F F F F F F F F s . i F F F F F < X & m F F F F F u . s F F F F F F F F F F F F F F F F F F F F F ", +"F F F F F F F F F F F F F F F F F F F F F F 4 . 9 D F F F F F F F F F F D 8 . 4 F F F F F F F F F F F F F F F F F F F F F F ", +"F F F F F F F F F F F F F F F F F F F F F F F 4 * j F F F F F F F F j * 4 F F F F F F F F F F F F F F F F F F F F F F F ", +"F F F F F F F F F F F F F F F F F F F F F F F F s o # 1 t f f t 1 # o s F F F F F F F F F F F F F F F F F F F F F F F F ", +"F F F F F F F F F F F F F F F F F F F F F F F F F B 6 o o 6 B F F F F F F F F F F F F F F F F F F F F F F F F F ", +"F F F F F F F F F F F F F F F F F F F F F F F F F F F Z h 6 : - - : 6 h Z F F F F F F F F F F F F F F F F F F F F F F F F F F F ", +"F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F ", +"F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F ", +"F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F " +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_delivery.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_delivery.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_delivery.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_delivery.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,294 @@ +/* XPM */ +static const char *vclass_delivery_xpm[] = { +/* columns rows colors chars-per-pixel */ +"64 32 256 2 ", +" c #3B637B", +". c #4E4E5E", +"X c #504B5A", +"o c #514C5B", +"O c #524D5C", +"+ c #534E5D", +"@ c #544F5E", +"# c #55505F", +"$ c #495365", +"% c #565160", +"& c #575261", +"* c #595462", +"= c #5A5564", +"- c #5C5765", +"; c #5C5866", +": c #5E5967", +"> c #5F5A68", +", c #605B69", +"< c #615C6A", +"1 c #615C6B", +"2 c #605D6C", +"3 c #66626F", +"4 c #616677", +"5 c #686471", +"6 c #6B6673", +"7 c #6B6674", +"8 c #6D6976", +"9 c #706C78", +"0 c #77737F", +"q c #356B86", +"w c #626F84", +"e c #627086", +"r c #62738A", +"t c #62758C", +"y c #627F9A", +"u c #797580", +"i c #7F7C87", +"p c #1896BF", +"a c #0B9CC9", +"s c #0A9DCA", +"d c #099ECC", +"f c #05A6D6", +"g c #03A7D8", +"h c #00A9DB", +"j c #519BB8", +"k c #62829E", +"l c #628AA9", +"z c #6398BC", +"x c #6399BD", +"c c #56BBED", +"v c #58B7E8", +"b c #5CBDED", +"n c #639DC4", +"m c #63A0C7", +"M c #63A9D4", +"N c #60ADDA", +"B c #63AFDC", +"V c #64ADD9", +"C c #66B0DC", +"Z c #64B0DD", +"A c #64B4E2", +"S c #64BAEA", +"D c #64BEF0", +"F c #6AC1F1", +"G c #71C3F1", +"H c #7AC6F0", +"J c #87848E", +"K c #898690", +"L c #8B8791", +"P c #908D96", +"I c #9E9BA3", +"U c #9F9DA5", +"Y c #A09DA6", +"T c #A09EA5", +"R c #A29FA7", +"E c #A5A2AA", +"W c #A6A4AB", +"Q c #A9A6AE", +"! c #ABA9B0", +"~ c #ACAAB1", +"^ c #AEABB2", +"/ c #AFACB4", +"( c #B0AEB4", +") c #B0AEB5", +"_ c #B2B0B6", +"` c #B3B1B8", +"' c #B4B3B9", +"] c #B6B4BA", +"[ c #BBB9BE", +"{ c #BBB9BF", +"} c #98B9C8", +"| c #8CD1E6", +" . c #92D1F4", +".. c #9DD6F5", +"X. c #A4D9F6", +"o. c #B5DFF7", +"O. c #B7E4F2", +"+. c #B6E6F4", +"@. c #BDE1F6", +"#. c #BFE4F8", +"$. c #C5C3C8", +"%. c #C6C4C9", +"&. c #C7C5CA", +"*. c #C7C6CA", +"=. c #C9C7CC", +"-. c #C9C8CC", +";. c #CBCACE", +":. c #CCCBCE", +">. c #CDCCCF", +",. c #CDCCD0", +"<. c #CECDD1", +"1. c #CFCED2", +"2. c #D0CFD3", +"3. c #D1D0D3", +"4. c #D2D1D4", +"5. c #D2D1D5", +"6. c #D3D2D6", +"7. c #D7D6D9", +"8. c #D8D7DA", +"9. c #DCDBDE", +"0. c #DDDCDE", +"q. c #DDDCDF", +"w. c #C0E3EE", +"e. c #CCE1EE", +"r. c #C1E5F8", +"t. c #C7E7F9", +"y. c #CCE9F9", +"u. c #CEEAFA", +"i. c #D8EEFB", +"p. c #E0DFE2", +"a. c #E0E0E2", +"s. c #E1E0E3", +"d. c #E2E1E4", +"f. c #E5E4E6", +"g. c #E5E4E7", +"h. c #E7E7E9", +"j. c #E8E7E9", +"k. c #E9E8EA", +"l. c #EAE9EB", +"z. c #EAEAEB", +"x. c #EBEAEC", +"c. c #ECECED", +"v. c #E6EDF2", +"b. c #E6F4FC", +"n. c #EEF0F2", +"m. c #EBF6FC", +"M. c #EEF7FD", +"N. c #F1F1F2", +"B. c #F3F3F4", +"V. c #F4F4F5", +"C. c #F5F5F6", +"Z. c #F7F7F8", +"A. c #F2F9FD", +"S. c #F6FAFD", +"D. c #F8F8F9", +"F. c #FAF9FA", +"G. c #FBFBFB", +"H. c #FBFDFE", +"J. c #FDFDFD", +"K. c #FDFEFE", +"L. c gray100", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +".>.>.>.>.>.*.[ %.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.1.9.&.< w V Z Z B N v c c c c c b c.n.K.L.L.L.L.L.L.", +"L.L.L.L.L.L.z.9.9.9.9.9.9.;.i @ X O u $.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.%.< < < : # X X . q d h h h h | w.K.L.L.L.L.L.L.", +"L.L.L.L.L.L.Z.k.k.=.) ) ! ; X 6 J 9 X & W ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ^ L < < : o X 9 J 6 X $ a h h h p j N.L.L.L.L.L.L.", +"L.L.L.L.L.L.K.K.K.8 < < @ X W c.c.c.' o + < < < < < < < < < < < < < < < < < < < < < < + o ' c.c.c.W X h h g 2 < E L.L.L.L.L.L.", +"L.L.L.L.L.L.K.K.K.5 < > X u c.s.9.a.c.K X ; < < < < < < < < < < < < < < < < < < < < ; X K c.a.9.s.c.u X s h f < < Y L.L.L.L.L.L.", +"L.L.L.L.L.L.K.K.K.0 < - X U k.9.9.9.j./ X = < < < < < < < < < < < < < < < < < < < < = X / j.9.9.9.k.U X } +.O.7 < / L.L.L.L.L.L.", +"L.L.L.L.L.L.K.K.K.C.g.%.X P x.q.9.0.z.T X ] g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.] X T z.0.9.q.x.P X 7.K.K.B.h.J.L.L.L.L.L.L.", +"L.L.L.L.L.L.K.K.K.K.K.G.> * 8.z.f.k.p.< % N.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.N.% < p.k.f.z.8.* > G.K.K.K.K.K.L.L.L.L.L.L.", +"L.L.L.L.L.L.K.K.K.K.K.K.{ X , ~ -._ 3 X Q K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.Q X 3 _ -.~ , X { K.K.K.K.K.K.L.L.L.L.L.L.", +"L.L.L.L.L.L.K.K.K.K.K.K.K.( # X X X O R J.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.J.R O X X X # ( K.K.K.K.K.K.K.L.L.L.L.L.L.", +"L.L.L.L.L.L.K.K.K.K.K.K.K.K.x.` I / g.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.g./ I ` x.K.K.K.K.K.K.K.K.L.L.L.L.L.L.", +"L.L.L.L.L.L.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.K.L.L.L.L.L.L." +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_emergency.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_emergency.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_emergency.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_emergency.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,294 @@ +/* XPM */ +static const char *vclass_emergency_xpm[] = { +/* columns rows colors chars-per-pixel */ +"64 32 256 2 ", +" c #0E1A25", +". c #161F27", +"X c #121E28", +"o c #15222E", +"O c #1A232A", +"+ c #1D262A", +"@ c #122130", +"# c #142332", +"$ c #152432", +"% c #162634", +"& c #1A2836", +"* c #1F2A32", +"= c #192A38", +"- c #1E2B38", +"; c #1E2D3B", +": c #1C2E3D", +"> c #202B32", +", c #252D31", +"< c #212F3D", +"1 c #26333F", +"2 c #29333A", +"3 c #1D3041", +"4 c #1F3344", +"5 c #1F3445", +"6 c #203547", +"7 c #233749", +"8 c #233849", +"9 c #263A4B", +"0 c #293641", +"q c #2C3A45", +"w c #2A3D4D", +"e c #313E49", +"r c #2E4150", +"t c #33404D", +"y c #3B464F", +"u c #304251", +"i c #334757", +"p c #364756", +"a c #364855", +"s c #3B4750", +"d c #3F4A53", +"f c #404C54", +"g c #475053", +"h c #46535D", +"j c #485254", +"k c #4E5A5D", +"l c #515B5B", +"z c #555F5F", +"x c #495A63", +"c c #4D5A63", +"v c #535D62", +"b c #535F69", +"n c #4F6069", +"m c #566162", +"M c #56616B", +"N c #57656F", +"B c #5C696B", +"V c #606B6B", +"C c #656F76", +"Z c #667278", +"A c #69757B", +"S c #6D7979", +"D c #6B7881", +"F c #6A7C80", +"G c #767E82", +"H c #767F87", +"J c #51859B", +"K c #52869C", +"L c #55889D", +"P c #588A9E", +"I c #5A8BA0", +"U c #798286", +"Y c #788585", +"T c #798389", +"R c #7E898E", +"E c #798D94", +"W c #7F8B95", +"Q c #6392A6", +"! c #6693A5", +"~ c #6A96A7", +"^ c #779FAE", +"/ c #70A4B8", +"( c #73A8BC", +") c #7AA2B2", +"_ c #7FA5B3", +"` c #78ADC0", +"' c #AA043C", +"] c #AA063D", +"[ c #BB043D", +"{ c #AC0B41", +"} c #AD0E43", +"| c #BC0940", +" . c #BC0F45", +".. c #BC1348", +"X. c #BD1449", +"o. c #BE1C4E", +"O. c #AA3660", +"+. c #AF4B70", +"@. c #B3597B", +"#. c #C02F5D", +"$. c #C0315E", +"%. c #C13E68", +"&. c #C24A70", +"*. c #C34E73", +"=. c #C56080", +"-. c #C67D98", +";. c #FCA923", +":. c #FEAA24", +">. c #FEAD2C", +",. c #E69E60", +"<. c #E3A36A", +"1. c #808C8C", +"2. c #8D8E8F", +"3. c #848C91", +"4. c #839090", +"5. c #8F9D9E", +"6. c #939696", +"7. c #8F99A2", +"8. c #969DA3", +"9. c #87A9B6", +"0. c #8BACB8", +"q. c #97A5A5", +"w. c #96A9AB", +"e. c #99A2A7", +"r. c #9CA6A9", +"t. c #9AA8A8", +"y. c #90B1BF", +"u. c #94B2BD", +"i. c #98B5BF", +"p. c #A1AAAF", +"a. c #A1ADAE", +"s. c #A6AFB4", +"d. c #ABB5BA", +"f. c #ACB5BB", +"g. c #ADB6BC", +"h. c #AAB8B9", +"j. c #ACBBBB", +"k. c #B2B7BC", +"l. c #B0B9BF", +"z. c #B0BFBF", +"x. c #81B6C9", +"c. c #9CB8C1", +"v. c #A5BDC5", +"b. c #B1BBC0", +"n. c #B3BCC0", +"m. c #B4BDC1", +"M. c #94C0D0", +"N. c #A5C0CA", +"B. c #A9C0C7", +"V. c #ACC3C3", +"C. c #ABC2C9", +"Z. c #ADC3C9", +"A. c #AEC4CA", +"S. c #ACC5CD", +"D. c #AECAD2", +"F. c #B1C5CB", +"G. c #B5CACA", +"H. c #B6C9CE", +"J. c #B9C0C0", +"K. c #BCC1C5", +"L. c #BAC4C8", +"P. c #BBCBCB", +"I. c #BCCACA", +"U. c #BDCCCC", +"Y. c #B2CDD4", +"T. c #B4CDD4", +"R. c #B9CBD0", +"E. c #BBCCD0", +"W. c #BECFD2", +"Q. c #C48198", +"!. c #C4849A", +"~. c #C88199", +"^. c #C9889E", +"/. c #C7B2BB", +"(. c #CEB4BF", +"). c #D5BDA3", +"_. c #CEB6C0", +"`. c #CEB9C2", +"'. c #CFBCC5", +"]. c #DEB3C2", +"[. c #E5BBC9", +"{. c #F5BDCB", +"}. c #DDC08B", +"|. c #C2C6CA", +" X c #C0CACF", +".X c #C1CFCF", +"XX c #C6CACD", +"oX c #C5CFCF", +"OX c #C8C5C9", +"+X c #CACCCE", +"@X c #C3CDD1", +"#X c #CBCFD2", +"$X c #C2D0D0", +"%X c #C3D4D7", +"&X c #C5D1D1", +"*X c #C5D1D4", +"=X c #C6D4D6", +"-X c #C8D2D2", +";X c #C9D3D7", +":X c #CAD4D4", +">X c #CAD4D8", +",X c #CDD7D8", +".IXIXIXIXIXIXIX", +"IXIXIXIXIXIX{.+X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X,.:.IXIXIXIXIXIXIX", +"IXIXIXIXIXIX{.+X-X-X-X-X-X&Xj.S l V t.&X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-XU.4.m z 1.I.-X-X-X-X-X,.:.IXIXIXIXIXIXIX", +"IXIXIXIXIXIX{.+X-X-X-X-X&XS . = 3 : X j I.-X-X 6 a e.r.n.h @ q.-XXr.1 @ B .X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.X.XU.2 6 N L.eXeXd.C @ * P..X.X.X$XGXIXIXIXIXIXIX", +"IXIXIXIXIXIX8XV.V.V.V.w.6 u r.iXvXwXp.y @ F V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.V.x 6 Z *XMXsXL.G @ q V.V.V.V.V.8XIXIXIXIXIXIX", +"IXIXIXIXIXIXaXG.G.G.G.G.i w m.;XwX Xg.e @ w.G.G.G.G.G.G.G.G.G.G.G.G.G.G.G.G.G.G.G.G.E 6 D >X c #5D5967", +", c #5F5A68", +"< c #5E6960", +"1 c #5F6A60", +"2 c #605C69", +"3 c #615D6A", +"4 c #625D6B", +"5 c #615E6A", +"6 c #62616A", +"7 c #63606C", +"8 c #64606C", +"9 c #65656B", +"0 c #606C60", +"q c #65686B", +"w c #676B6C", +"e c #676D6C", +"r c #68646F", +"t c #686A6B", +"y c #686D6C", +"u c #6A6F6C", +"i c #676370", +"p c #686471", +"a c #696572", +"s c #6D6975", +"d c #6E6B75", +"f c #6A746C", +"g c #6C736C", +"h c #687D64", +"j c #687E64", +"k c #6D7B66", +"l c #6C7C63", +"z c #6F786D", +"x c #706C78", +"c c #716D79", +"v c #726E7A", +"b c #717C6D", +"n c #74727A", +"m c #74717C", +"M c #76727D", +"N c #76727E", +"B c #797581", +"V c #698164", +"C c #698065", +"Z c #6B8566", +"A c #6E8C67", +"S c #73816D", +"D c #70826E", +"F c #708F68", +"G c #748B6F", +"H c #748D6F", +"J c #798D6E", +"K c #788478", +"L c #74986A", +"P c #769B6A", +"I c #7D936F", +"U c #7B9E71", +"Y c #77A06A", +"T c #7DAA6D", +"R c #7DAD6D", +"E c #7EAE6E", +"W c #7CA071", +"Q c #7FA772", +"! c #E97E68", +"~ c #FC6864", +"^ c #807E85", +"/ c #817E88", +"( c #809870", +") c #829C70", +"_ c #84A170", +"` c #87A571", +"' c #82AE73", +"] c #89AA71", +"[ c #8BAE72", +"{ c #85B673", +"} c #84BA70", +"| c #87BA74", +" . c #85BC71", +".. c #88BD74", +"X. c #88C372", +"o. c #8AC673", +"O. c #8BC575", +"+. c #8CC975", +"@. c #8DCA75", +"#. c #8CCD73", +"$. c #8ECC76", +"%. c #8ECF75", +"&. c #8DD074", +"*. c #8ED075", +"=. c #8FD375", +"-. c #97CA75", +";. c #9ACB75", +":. c #90D276", +">. c #90D575", +",. c #91D477", +"<. c #91D776", +"1. c #92D677", +"2. c #95D17E", +"3. c #92D876", +"4. c #93DA76", +"5. c #93DA77", +"6. c #94DB77", +"7. c #94DD77", +"8. c #95DC78", +"9. c #95DE78", +"0. c #9DD075", +"q. c #9FD475", +"w. c #9FD876", +"e. c #96E078", +"r. c #98E178", +"t. c #9BE378", +"y. c #9DE578", +"u. c #A7DE7A", +"i. c #A1E778", +"p. c #A5EA78", +"a. c #A9EC78", +"s. c #ABEE78", +"d. c #ACED78", +"f. c #ADED7A", +"g. c #ADEE78", +"h. c #AEF078", +"j. c #D69F6D", +"k. c #E88B6A", +"l. c #85828C", +"z. c #86828D", +"x. c #87848E", +"c. c #8A888E", +"v. c #94919A", +"b. c #95939B", +"n. c #96939C", +"m. c #99989D", +"M. c #9E9BA3", +"N. c #9E9BA4", +"B. c #90A78A", +"V. c #9AB691", +"C. c #A3A1A8", +"Z. c #A4A2A9", +"A. c #A6A4AB", +"S. c #A7A7A9", +"D. c #AEACB2", +"F. c #B0AEB4", +"G. c #B2B0B7", +"H. c #B8B8B9", +"J. c #BDBCC1", +"K. c #BFBEC3", +"L. c #99D082", +"P. c #99D681", +"I. c #A5D292", +"U. c #B6DFA5", +"Y. c #ACE395", +"T. c #ADE597", +"R. c #AFE699", +"E. c #B6EE8B", +"W. c #B5F184", +"Q. c #BAF28D", +"!. c #B7E0A7", +"~. c #BCE5AC", +"^. c #FB8783", +"/. c #C2EF9E", +"(. c #C0F396", +"). c #C1F398", +"_. c #C6F49F", +"`. c #C0ECAE", +"'. c #C5E6B9", +"]. c #C7EEB7", +"[. c #C8E7BC", +"{. c #CBF5A9", +"}. c #D2F6B5", +"|. c #C3C2C6", +" X c #C7C7C6", +".X c #C8C7CB", +"XX c #C9C7CC", +"oX c #C9C8CC", +"OX c #CDCCD0", +"+X c #D2D1D5", +"@X c #D4D5D5", +"#X c #D7D7D8", +"$X c #D8D8DA", +"%X c #DAD9DC", +"&X c #DBDADD", +"*X c #DCDBDE", +"=X c #DDDCDE", +"-X c #DDDCDF", +";X c #DFDFDF", +":X c #DEDEE0", +">X c #DFDFE1", +",X c #CEECC1", +" $ 3 3 3 3 3 3 3 5 ..1.e 3 m.PXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPX X3 3 3 5 ' e.e.y 3 3 3 3 3 3 3 , # 3 3 3 3 3 3 3 3 q :.O.6 3 H.PXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXcXu.q.0.;.w.p.p.p.-.[ ] ` _ ) ( I J l k S b z g u t 9 6 3 G e.' 5 7 @XPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPX^.~ k.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.g.g.h.h.d.a.f.W.Q.(._.{.}.3X7X0XbXAXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXnX! ! j.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.s.g.g.h.h.h.h.h.W.).8XPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPX].e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.r.t.y.i.p.E./.vXPXPXPXPXPXPXPX", +"PXPXPXPXPXPX`.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.5XjXMXPXPXPXPXPXPXPX", +"PXPXPXPXPXPX`.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.Y.~.,XPXPXPXPXPXPXPX", +"PXPXPXPXPXPX`.e.e.e.e.e.%.L j Z E 9.e.e.7.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.4.e.e.e. .A h F X.e.e.e.e.<.=.P.9XPXPXPXPXPXPX", +"PXPXPXPXPXPX`.e.e.e.e.T o < *.e.3.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.>.e.7.C . A 9.e.e.&.#.#.[.PXPXPXPXPXPX", +"PXPXPXPXPXPX~.&.=.3.} . - D.$XOXx. 1 9.e.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.e.e.A v |.%XJ.a P e.e.9.9.R.PXPXPXPXPXPXPX", +"PXPXPXPXPXPX1X2.#.#.0 X .XfXeXyXjXz. E 7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.7.*.. i yXiXwXsX4X> + 3.7.7.7.T.LXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXxXXgXA. G.PXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPX&X / jXqX=XwXjXc X jXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXF. B 4XjXjXK.# = mXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXKXM C.fXjXaXb. x.PXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXJXz. @ m a O XXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXtX3 2 N : a lXPXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXJXG.s X # l.*XPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXkXn.> 4 N.BXPXPXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXPXPXPXFXKXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXDXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPXPX" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_hov.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_hov.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_hov.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_hov.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,294 @@ +/* XPM */ +static const char *vclass_hov_xpm[] = { +/* columns rows colors chars-per-pixel */ +"64 32 256 2 ", +" c #504B5A", +". c #514C5A", +"X c #514C5B", +"o c #524D5C", +"O c #534E5C", +"+ c #54505E", +"@ c #5D5459", +"# c #5C555A", +"$ c #565160", +"% c #585462", +"& c #595463", +"* c #5D5866", +"= c #615759", +"- c #625A5A", +"; c #615C6A", +": c #625D6B", +"> c #625E6B", +", c #635F6C", +"< c #655F6B", +"1 c #6F6157", +"2 c #6B625A", +"3 c #6F655A", +"4 c #7C705A", +"5 c #65606E", +"6 c #69626A", +"7 c #696572", +"8 c #6C6875", +"9 c #6F6B77", +"0 c #736B69", +"q c #746B69", +"w c #786F69", +"e c #726D78", +"r c #7C7268", +"t c #74707B", +"y c #75717D", +"u c #76727E", +"i c #78747F", +"p c #7A7681", +"a c #7E7B86", +"s c #82745A", +"d c #87795A", +"f c #947C54", +"g c #877B67", +"h c #FF6464", +"j c #FF6F63", +"k c #807D87", +"l c #827F89", +"z c #98875A", +"x c #9B895A", +"c c #9D8D65", +"v c #9E8E64", +"b c #A88A52", +"n c #A3905A", +"m c #B99651", +"M c #BC9951", +"N c #AA9863", +"B c #BEA65A", +"V c #B5A062", +"C c #B8A362", +"Z c #CDA54F", +"A c #C8AF5A", +"S c #CCB35F", +"D c #CCB45F", +"F c #D7BA59", +"G c #C4AD60", +"H c #C5AE60", +"J c #E4B54D", +"K c #E4C559", +"L c #E4C75D", +"P c #E7C95C", +"I c #E5C85D", +"U c #EACC5A", +"Y c #F6C24C", +"T c #F8C34C", +"R c #FBC64B", +"E c #FEC34C", +"W c #FCC74B", +"Q c #FEC84B", +"! c #FECE54", +"~ c #F1D15A", +"^ c #F3D35B", +"/ c #F5D45A", +"( c #F7D65A", +") c #FED353", +"_ c #FED056", +"` c #FED454", +"' c #FED555", +"] c #FED656", +"[ c #FBD758", +"{ c #F8D75A", +"} c #F8D75B", +"| c #FED65A", +" . c #F9D85A", +".. c #F9D85B", +"X. c #FBDA5A", +"o. c #FBDA5E", +"O. c #FED958", +"+. c #FED85A", +"@. c #FDDA5A", +"#. c #FEDC5A", +"$. c #FEDF6A", +"%. c #FCDE6B", +"&. c #FBDF72", +"*. c #FEE37B", +"=. c #FEE37E", +"-. c #85818A", +";. c #86828D", +":. c #89868F", +">. c #8A8690", +",. c #8E8B94", +"<. c #968B82", +"1. c #908D96", +"2. c #928F98", +"3. c #95929B", +"4. c #99969F", +"5. c #9B98A0", +"6. c #9C99A1", +"7. c #9F9CA4", +"8. c #AA9E8D", +"9. c #A09DA2", +"0. c #ACA9B0", +"q. c #ACAAB1", +"w. c #AEACB2", +"e. c #B4B2B8", +"r. c #B6B4BA", +"t. c #BBB9BF", +"y. c #BEBCC1", +"u. c #BFBEC3", +"i. c #FF8F8D", +"p. c #C0BDC0", +"a. c #FEDE88", +"s. c #FEDE93", +"d. c #FEDF98", +"f. c #E6D3AD", +"g. c #FEE281", +"h. c #F8E18A", +"j. c #FEE688", +"k. c #FEE78F", +"l. c #FEE998", +"z. c #FEEA9C", +"x. c #F8E6A2", +"c. c #FEE3A4", +"v. c #FAE9AA", +"b. c #F9E5B7", +"n. c #FEEFB7", +"m. c #FEE9B8", +"M. c #FEE9BA", +"N. c #C1C0C5", +"B. c #C8C7CB", +"V. c #C9C8CC", +"C. c #CDCCCF", +"Z. c #D0CFD2", +"A. c #D1D0D3", +"S. c #D2D1D5", +"D. c #D4D2D6", +"F. c #DBD9DA", +"G. c #D9D9DB", +"H. c #DAD9DC", +"J. c #DCDBDE", +"K. c #DDDCDF", +"L. c #DEDDE0", +"P. c #DEDEE0", +"I. c #E0DFE1", +"U. c #E0DFE2", +"Y. c #EEEADD", +"T. c #FAEEC4", +"R. c #E0E0E2", +"E. c #E1E1E3", +"W. c #E2E1E4", +"Q. c #E3E2E4", +"!. c #E4E3E5", +"~. c #E5E4E6", +"^. c #E5E5E7", +"/. c #E7E6E8", +"(. c #E8E8E9", +"). c #E9E9EA", +"_. c #E9E9EB", +"`. c #EAEAEB", +"'. c #EBEBEC", +"]. c #ECECED", +"[. c #EDECEE", +"{. c #EEEEEE", +"}. c #FEF8E1", +"|. c #FEF9EE", +" X c #FEFAED", +".X c #F1F1F0", +"XX c #F4F3F2", +"oX c #F5F4F5", +"OX c #F9F9F9", +"+X c #F9F9FA", +"@X c #FAFAF9", +"#X c #FEFDF9", +"$X c #FDFCFA", +"%X c #FDFDFD", +"&X c #FEFEFC", +"*X c #FEFEFE", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" : : : : w P #.0 5 F.*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*Xj.#.^ : : : : : : : : : : % * : : : : : : : : : : g #.V : : : : : : r } G : e {.*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*Xj.#.^ : : : : : : : : : : % * : : : : : : : : : : g #.V : : : : : : : v #.c : -.@X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*Xj.#.^ : : : : : : : : : : % * : : : : : : : : : : g #.V : : : : : : : : H } r : 9.*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*Xj.#.^ : : : : : : : : : : % * : : : : : : : : : : g #.V : : : : : : : : 6 I L 6 : p.*X*X*X*X*X*X*X*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*Xj.#.^ : : : : : : : : : : % * : : : : : : : : : : g #.V : : : : : : : : : r } G : 5 F.*X*X*X*X*X*X*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*Xj.#. .q : : : : : : : : : % * : : : : : : : : : : v #.D > : : : : : : : : : C #.N < e {.*X*X*X*X*X*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*Xa.+.#.@. . . . . . . . . .{ / . . . . . . . . . . .#.#.#.X. . . . . . . . . .@.#.#.@. .%.n.#X*X*X*X*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*Xi.j @.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.$.n.#X*X*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*Xi.h _ ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ] #.#.&.x.$X*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*Xi.h E Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q ] #.Y.].XX*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*Xi.h ! ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ` #.#.Y.]..X*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*Xi.h | #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.&.h.v.*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*Xi.j @.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.j.*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*Xa.+.#.#.#.A s - 2 x U #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.~ n 3 - 4 B @.#.#.#.#.j.*X*X*X*X*X*X*X", +"*X*X*X*X*X*X&Xg.O.O.O.z ; % # F O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.K - $ > X d [ O.O.O.g.&X*X*X*X*X*X*X", +"*X*X*X*X*X*Xc.Q Q Q M 8 S.]._.q.O = Y Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q W 1 7./.].G.i b Q Q Q Q c.*X*X*X*X*X*X", +"*X*X*X*X*X*Xs.Q Q Q 1 + H.(.U.W.'.6. m Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Z >.].Q.I./.!.* @ R Q Q Q s.*X*X*X*X*X*X", +"*X*X*X*X*X*Xd.Q Q T u ].L.J.J.~.Z. f Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q b y./.J.J.J.'.:. J Q Q Q d.*X*X*X*X*X*X", +"*X*X*X*X*X*X|.M.m.b.X t ].P.J.J.^.C. <.m.m.m.m.m.m.m.m.m.m.m.m.m.m.m.m.m.m.m.m.m.m.m.8. t./.J.J.K.].;. f.m.m.M.|.*X*X*X*X*X*X", +"*X*X*X*X*X*X*X*X*X*Xy o S.).E.!.].2. u.*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*XD. k ].~.E.(.L.& : %X*X*X*X*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*X*X*X*XB. , N.`.R.5.. 7 +X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*Xp ,.J.'.V.8 e.*X*X*X*X*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*X*X*X*X*X0.X o 5 W.*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X[.9 o 4.%X*X*X*X*X*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*X*X*X*X*X*XH.3.u a w.oX*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*XOXr.l y 1.A.*X*X*X*X*X*X*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X", +"*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_ignoring.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_ignoring.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_ignoring.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_ignoring.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,294 @@ +/* XPM */ +static const char *vclass_ignoring_xpm[] = { +/* columns rows colors chars-per-pixel */ +"64 32 256 2 ", +" c #6AC259", +". c #6EC45D", +"X c #73C663", +"o c #74C665", +"O c #7FCA70", +"+ c #8BD07E", +"@ c #91D285", +"# c #93D386", +"$ c #97D48B", +"% c #9ED793", +"& c #A9DC9F", +"* c #A9DCA0", +"= c #ADDDA4", +"- c #AEDEA4", +"; c #AEDEA5", +": c #BAE3B2", +"> c #BBE3B3", +", c #CAE9C4", +"< c #CDEBC8", +"1 c #D2EDCD", +"2 c #D3EDCE", +"3 c #EEF8EC", +"4 c #F3FAF1", +"5 c #FAFDF9", +"6 c #FAFDFA", +"7 c #FDFEFD", +"8 c #FEFFFE", +"9 c gray100", +"0 c black", +"q c black", +"w c black", +"e c black", +"r c black", +"t c black", +"y c black", +"u c black", +"i c black", +"p c black", +"a c black", +"s c black", +"d c black", +"f c black", +"g c black", +"h c black", +"j c black", +"k c black", +"l c black", +"z c black", +"x c black", +"c c black", +"v c black", +"b c black", +"n c black", +"m c black", +"M c black", +"N c black", +"B c black", +"V c black", +"C c black", +"Z c black", +"A c black", +"S c black", +"D c black", +"F c black", +"G c black", +"H c black", +"J c black", +"K c black", +"L c black", +"P c black", +"I c black", +"U c black", +"Y c black", +"T c black", +"R c black", +"E c black", +"W c black", +"Q c black", +"! c black", +"~ c black", +"^ c black", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" 9 7 % O 3 9 9 2 . + 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ", +"9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 $ * 9 9 7 % O 3 9 9 2 . $ 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ", +"9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ; * 9 9 7 - 3 9 9 2 . ; 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ", +"9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 1 * 9 9 9 9 9 2 . 1 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ", +"9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 6 X * 8 9 9 2 . X 6 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ", +"9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ; & 8 2 . ; 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ", +"9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 4 o $ . o 4 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ", +"9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 , , 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ", +"9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 = = 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ", +"9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 8 = = 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ", +"9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 , o o , 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ", +"9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 4 ; X X ; 4 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ", +"9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 6 1 ; $ + + $ ; 1 6 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ", +"9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ", +"9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ", +"9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 " +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_moped.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_moped.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_moped.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_moped.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,294 @@ +/* XPM */ +static const char *vclass_moped_xpm[] = { +/* columns rows colors chars-per-pixel */ +"64 32 256 2 ", +" c #504B5A", +". c #514C5B", +"X c #524D5C", +"o c #534E5D", +"O c #544F5D", +"+ c #544F5E", +"@ c #515365", +"# c #5A5563", +"$ c #5B5664", +"% c #5C5765", +"& c #5E5967", +"* c #5F5B68", +"= c #5F5E6D", +"- c #596374", +"; c #605B69", +": c #615C6A", +"> c #615D6B", +", c #625E6C", +"< c #635F6D", +"1 c #65606E", +"2 c #66626F", +"3 c #6A6673", +"4 c #6F6B77", +"5 c #726E7A", +"6 c #356B86", +"7 c #4A6F86", +"8 c #417690", +"9 c #6E7484", +"0 c #787480", +"q c #7B7883", +"w c #7C7883", +"e c #7D7A85", +"r c #7F7C87", +"t c #787D8C", +"y c #1E93BA", +"u c #1C94BC", +"i c #0D9AC7", +"p c #00AADC", +"a c #04ABDD", +"s c #07ACDD", +"d c #08A3D2", +"f c #09ACDE", +"g c #0CACDE", +"h c #0FAFDE", +"j c #15A1CC", +"k c #11ADDF", +"l c #18A6D1", +"z c #19B2DF", +"x c #16AEE0", +"c c #1BB0E1", +"v c #24B2DC", +"b c #27B5DF", +"n c #20B0E2", +"m c #21B1E3", +"M c #26B2E4", +"N c #29B2E4", +"B c #2BB8E2", +"V c #2CB8E2", +"C c #34B4E6", +"Z c #36B5E7", +"A c #30BAE2", +"S c #32BAE3", +"D c #39B5E7", +"F c #3AB6E7", +"G c #3BB6E8", +"H c #3DB7E8", +"J c #3FB7E9", +"K c #39BDE4", +"L c #5A83A3", +"P c #5B8CAE", +"I c #768493", +"U c #6390B1", +"Y c #5F9EC7", +"T c #44BDE7", +"R c #47B8EA", +"E c #49B9EB", +"W c #4DB9EB", +"Q c #4EBAEC", +"! c #52BAEC", +"~ c #56BBED", +"^ c #5ABCEE", +"/ c #5EB8E9", +"( c #5CBAEB", +") c #5CBCEE", +"_ c #5FBDEF", +"` c #639CC1", +"' c #67A6CE", +"] c #63A9D3", +"[ c #72B2D9", +"{ c #62B4E2", +"} c #62B4E3", +"| c #63B9E9", +" . c #60BDEF", +".. c #6ABFEF", +"X. c #62BEF0", +"o. c #64BEF0", +"O. c #47C1E6", +"+. c #5DC0ED", +"@. c #5EC9E9", +"#. c #64CBE9", +"$. c #6CCBEC", +"%. c #6EC3F0", +"&. c #6DC2F1", +"*. c #70C1EE", +"=. c #79C3ED", +"-. c #73C4F1", +";. c #74C5F1", +":. c #77C6F2", +">. c #75D0EC", +",. c #807C88", +"<. c #83808A", +"1. c #88848F", +"2. c #8A8791", +"3. c #8E8B95", +"4. c #8F8C96", +"5. c #908D97", +"6. c #928F99", +"7. c #94919A", +"8. c #95939C", +"9. c #8895A5", +"0. c #9A97A0", +"q. c #9D9AA3", +"w. c #9F9DA5", +"e. c #A19EA6", +"r. c #A29FA7", +"t. c #A3A1A9", +"y. c #A4A1A9", +"u. c #A6A4AB", +"i. c #A7A4AC", +"p. c #A7A5AD", +"a. c #A8A5AD", +"s. c #ACAAB1", +"d. c #AEACB3", +"f. c #B4B1B8", +"g. c #BAB8BE", +"h. c #BDBBC0", +"j. c #BDBBC1", +"k. c #BEBCC1", +"l. c #BEBCC2", +"z. c #BFBDC3", +"x. c #83C3E9", +"c. c #82C4EA", +"v. c #84C4EA", +"b. c #86C6EC", +"n. c #87C8ED", +"m. c #81CAF3", +"M. c #86CFF1", +"N. c #8BCBF0", +"B. c #88CDF3", +"V. c #8ECFF3", +"C. c #8DCFF4", +"Z. c #81D5ED", +"A. c #8DD8EF", +"S. c #8ED0F4", +"D. c #93CEF0", +"F. c #91D1F4", +"G. c #95D2F4", +"H. c #97D3F5", +"J. c #97DCF0", +"K. c #99D1F0", +"L. c #98D4F5", +"P. c #9DD6F5", +"I. c #A9D3EB", +"U. c #A5D7F3", +"Y. c #A9DBF6", +"T. c #ABDCF6", +"R. c #ACDCF7", +"E. c #B1DEF7", +"W. c #A8E1F3", +"Q. c #B5E6F4", +"!. c #BBE5F6", +"~. c #BFE4F8", +"^. c #BBE8F5", +"/. c #BCE8F5", +"(. c #C1BFC5", +"). c #C3C1C6", +"_. c #C7C5CA", +"`. c #C8C6CB", +"'. c #C9C7CC", +"]. c #CAC8CD", +"[. c #CBC9CE", +"{. c #CBCACE", +"}. c #CECDD1", +"|. c #CFCED2", +" X c #D0CFD2", +".X c #D1D0D3", +"XX c #D2D1D5", +"oX c #D4D2D6", +"OX c #D4D3D7", +"+X c #D7D6D9", +"@X c #D8D8DB", +"#X c #DAD8DC", +"$X c #DAD8DD", +"%X c #DBDADD", +"&X c #DCDADE", +"*X c #DDDBDF", +"=X c #DDDCDF", +"-X c #CAD6E1", +";X c #DFDDE1", +":X c #C6E7F9", +">X c #C4EBF6", +",X c #CDE9F9", +" U o.=.&XbXLXLXLXLXLXLXLXLXLXLXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLX:X` ] o.=.&XnXLXLXLXLXLXLXLXLXLXLXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLX$.c T 3XmXLXLXLXLXLXLXLXLXLXLXLXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXJ.p f C.dXLXLXLXLXLXLXLXLXLXLXLXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLX2Xp m o.B.LXLXLXLXLXLXLXLXLXLXLXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXKXh g o.o.~.LXLXLXLXLXLXLXLXLXLXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXLXLXLXLXLXLXLXLXLXzX|.%XMXLXLXLXLXLXLXLXLXLXLXLXLXLXLXO.p ! o.&.jXLXLXLXLXLXLXLXLXLXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXLXLXLXLXLXGXsX>XW.I > > < r 0.t.y.y.y.p.}.LXLXLXLXLXLXZ.p C o.o.G.LXLXLXLXLXLXLXLXLXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXLXLXLXLX#.p p p p u - > > > > > > > > > > i.LXLXLXLXLX^.p x o.o.o.,XLXLXLXLXLXLXLXLXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXLXLXLXLXV p p p p p d 8 > > > > > > > > > , uXLXLXLXLXVXa p _ o.o.;.CXLXLXLXLXLXLXLXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXLXLXLXLX4Xz p p p p p p y 7 = > > > > > > > %XLXLXLXLXLXB p Q o.o.o.E.LXLXLXLXLXLXLXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXLXLXLXdXY.%.^ ^ ^ ^ ^ ^ ^ ^ ( } { { { { { I.LXLXLXLXLXLXK p E o.o.o.+.Z.1XLXLXLXLXLXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXLXBXP.o.o.o.o.o.o.o.o.o.o.~ G F F F F F F !.LXLXLXLXLXLXz p Q o.o.o.m p p S Q.LXLXLXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXgX:.o.o.o.o.o.o.o.o.o.o.X.f p p p p p p p 2XLXLXLXLXLXfXp p ) o.o.~ p p p p p >.LXLXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXm.o.o.o.o.o.o.o.o.o.o.o. .a p p p p p p s GXLXLXLXLXLX/.p g o.o.o.N p p p p p b LXLXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPX5Xo.o.o.o.o.o.o.o.o.o.o.o.o.J p p p p p p A LXLXLXLXLXLXA.p n o.o./ j v l i i i 6 y.LXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPX _.PXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXLX0 u.JXaXpXpX6X&X&X&X&X&X-XK.H.H.H.H.H.H.H.H.H.H.H.H.L.R.kX7. 2.LX{.j.g.wXnX+ OXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXLXi. * pXJXNXvXaX0.1.y.zXzXbXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLX). + =XFXwXpXLXe. $ ZXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXLXzX& 2 z.0X.X,. `.LXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXDX4 % f.8X+X6. s.PXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXLXLXOX# a.LXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXwX1 3.HXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXLXLXLXeX5.# o q }.LXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXxXq.; . 5 l.LXLXPXPXPXPXPXPXPXPXPXPXPX", +"PXPXPXPXPXPXPXPXPXPXPXLXLXLXLXLXJXcXSXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXLXbXZXLXLXLXLXPXPXPXPXPXPXPXPXPXPXPX" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_motorcycle.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_motorcycle.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_motorcycle.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_motorcycle.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,294 @@ +/* XPM */ +static const char *vclass_motorcycle_xpm[] = { +/* columns rows colors chars-per-pixel */ +"64 32 256 2 ", +" c #504B5A", +". c #504C5A", +"X c #514C5B", +"o c #524D5C", +"O c #524E5C", +"+ c #534E5D", +"@ c #544F5D", +"# c #544F5E", +"$ c #5F4D5B", +"% c #55505E", +"& c #55505F", +"* c #565160", +"= c #575260", +"- c #575261", +"; c #585361", +": c #585362", +"> c #595462", +", c #595463", +"< c #5A5564", +"1 c #5B5664", +"2 c #5B5765", +"3 c #5C5765", +"4 c #5D5866", +"5 c #5E5A68", +"6 c #6F4D5A", +"7 c #605B6A", +"8 c #615C6A", +"9 c #625D6B", +"0 c #625E6B", +"q c #635E6C", +"w c #645F6C", +"e c #645F6D", +"r c #685663", +"t c #7D5A66", +"y c #7F5E69", +"u c #64606D", +"i c #65606E", +"p c #66616F", +"a c #66626F", +"s c #676270", +"d c #686370", +"f c #686371", +"g c #686471", +"h c #696572", +"j c #6A6673", +"k c #6B6774", +"l c #6C6774", +"z c #6C6875", +"x c #6E6976", +"c c #6F6B77", +"v c #6F6B78", +"b c #706B78", +"n c #706C78", +"m c #716D79", +"M c #726E7A", +"N c #736F7B", +"B c #7D6C77", +"V c #74707C", +"C c #76727E", +"Z c #787480", +"A c #797581", +"S c #7B7883", +"D c #7C7883", +"F c #7C7884", +"G c #7D7985", +"H c #7E7A85", +"J c #7F7B86", +"K c #9F555E", +"L c #875E69", +"P c #886771", +"I c #A6575F", +"U c #A9585F", +"Y c #A35962", +"T c #B65A60", +"R c #B66067", +"E c #BE6167", +"W c #C0565D", +"Q c #C7565C", +"! c #C55A5F", +"~ c #C8575D", +"^ c #CE575C", +"/ c #D2555A", +"( c #D9575C", +") c #D56064", +"_ c #D56265", +"` c #E25A5E", +"' c #E75C5F", +"] c #E85C5F", +"[ c #EB5E60", +"{ c #F05F61", +"} c #ED6365", +"| c #F56162", +" . c #F76262", +".. c #F36F6F", +"X. c #FE6464", +"o. c #FE6767", +"O. c #FB7171", +"+. c #FB7B7B", +"@. c #FE7D7D", +"#. c #817D88", +"$. c #817E88", +"%. c #817E89", +"&. c #827F8A", +"*. c #84808B", +"=. c #85828C", +"-. c #85828D", +";. c #87838E", +":. c #898590", +">. c #898690", +",. c #8A8691", +"<. c #8B8892", +"1. c #8C8993", +"2. c #8D8A93", +"3. c #8E8A94", +"4. c #8E8B95", +"5. c #8F8C96", +"6. c #908D96", +"7. c #908D97", +"8. c #918E98", +"9. c #928F99", +"0. c #93909A", +"q. c #94909A", +"w. c #95929B", +"e. c #97949D", +"r. c #98959E", +"t. c #9A979F", +"y. c #9A97A0", +"u. c #9C99A2", +"i. c #9E9BA3", +"p. c #9E9BA4", +"a. c #9F9CA4", +"s. c #A09DA5", +"d. c #A09EA6", +"f. c #A19EA7", +"g. c #A3A0A8", +"h. c #A3A1A9", +"j. c #A4A2A9", +"k. c #A5A3AA", +"l. c #A5A3AB", +"z. c #A6A4AC", +"x. c #A7A5AD", +"c. c #A9A7AE", +"v. c #A9A7AF", +"b. c #AAA8AF", +"n. c #ABA9B0", +"m. c #ACA9B0", +"M. c #ACA9B1", +"N. c #ACAAB1", +"B. c #ADAAB2", +"V. c #B2AFB6", +"C. c #B3B1B7", +"Z. c #B3B2B9", +"A. c #B4B2B9", +"S. c #B5B3BA", +"D. c #B6B4BA", +"F. c #B8B6BC", +"G. c #B9B7BD", +"H. c #BAB8BE", +"J. c #BBB9BF", +"K. c #BCB9BF", +"L. c #BBBAC0", +"P. c #BDBBC0", +"I. c #DF868A", +"U. c #CBB2B7", +"Y. c #E08A8D", +"T. c #FE9494", +"R. c #F1A2A3", +"E. c #FEA4A4", +"W. c #FEACAC", +"Q. c #F8B8B9", +"!. c #C0BEC4", +"~. c #C0BFC5", +"^. c #EDBEC0", +"/. c #C2C0C5", +"(. c #C2C0C6", +"). c #C3C2C7", +"_. c #C5C3C8", +"`. c #C6C4C9", +"'. c #C6C5CA", +"]. c #C8C6CB", +"[. c #C8C7CC", +"{. c #CAC8CD", +"}. c #CBC9CE", +"|. c #CBCACE", +" X c #CECCD0", +".X c #CECDD1", +"XX c #D0CFD3", +"oX c #D3D2D6", +"OX c #D4D3D7", +"+X c #D5D4D7", +"@X c #D5D4D8", +"#X c #D7D5D9", +"$X c #D8D7DA", +"%X c #DAD8DC", +"&X c #DBDADD", +"*X c #DCDBDE", +"=X c #DCDCDF", +"-X c #DEDDE0", +";X c #DFDEE1", +":X c #E5CBCD", +">X c #EDC7C9", +",X c #FEC4C4", +"XZX`.8 B.ZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZX", +"ZXZXZXZXZXZXZXZXZXZXZX9XA.e.6.i.(.jXZXZXZXZXkX}.M M M z &.H a a p 3 3 3 3 3 K / / / / 1XZXkXs N i.6.e.A.9XZXZXZXZXZXZXZXZXZXZXZX", +"ZXZXZXZXZXZXZXZXZXyX4.o 1 B.BXZXZXZXCX2.M M =.z.z.D M M i 8 8 8 8 Q / / / I.ZXBXB.9 8 @ o 4.yXZXZXZXZXZXZXZXZXZX", +"ZXZXZXZXZXZXZXZX5X0 $.xXZXZXnXz.i j A d.u.V M M z 8 8 8 t / / / ) iXxX$. & 8 , 0 5XZXZXZXZXZXZXZXZX", +"ZXZXZXZXZXZXZXpXq c (.aXmX7Xm.1 <.kXG.N 8 8 j M M M M m M M b j a Y / / / ^.ZX<. 2 g x bXaX(.c q pXZXZXZXZXZXZXZX", +"ZXZXZXZXZXZXZX8. >.cXZXgXwXvXZX7Xa X > g 8 9 g n M M M l u 8 p l m M M ~ / / I.ZX]. a 7Xp.8 {.gXZXcX>. 8.ZXZXZXZXZXZXZX", +"ZXZXZXZXZXZXrX+ z cXcX(.z.z.v.@X8X3.7 8 7 h m M M M m : 1 8 8 8 d P / / ) iXZXZ o =XZXH.8 F z.(.cXcXz + rXZXZXZXZXZXZX", +"ZXZXZXZXZXZXJ. P.ZX).z.0.%.9.Z 9 8 8 - X c M M M M a O v h w 8 t / / ^.ZXaXX ;.ZX;Xl.f i 0.z.).ZXP. J.ZXZXZXZXZXZX", +"ZXZXZXZXZXZXa. 9XlXx.w.@ 4 8 8 V '.V.> % j M M M M s + M M M i 8 W Y.ZXZXOX C.ZXL.l.e 8 * w.x.lX9X a.ZXZXZXZXZXZX", +"ZXZXZXZXZXZXr. fXaXz.-.; 8 4 8.Z.ZX!.8 8 q h v M M m , X a M M M h 8 U.NXZXZX.X P.ZXA.d.+ 8 - -.z.aXfX r.ZXZXZXZXZXZX", +"ZXZXZXZXZXZXz. &XBXB.f.8 O C z.'.ZXk.# < p 8 8 i j n M x n M M M n q q tXZXZXZX=X k.ZX'.z.C O 8 f.B.BX&X z.ZXZXZXZXZXZX", +"ZXZXZXZXZXZX X s.ZX=Xz.z.h.z.B.dXVXk , gX'.<.9 8 8 9 9 9 9 9 9 8 8 n.ZXZXZXZXnX, k VXdXB.z.h.z.z.=XZXs. XZXZXZXZXZXZX", +"ZXZXZXZXZXZXnX0 * *XZX7X~.F.[.dXZXN. w.ZXZXZXeXD.7.J F F F F F ,.(.ZXZXZXZXZXZXw. N.ZXdX[.F.~.7XZX*X* 0 nXZXZXZXZXZXZX", +"ZXZXZXZXZXZXZXJ. 5 XXZXZXZXZXBXb.X : 9XZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZX9X: X b.BXZXZXZXZXXX5 J.ZXZXZXZXZXZXZX", +"ZXZXZXZXZXZXZXZX5. S c.A.a.s X ).ZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZX).X s a.A.c.S 5.ZXZXZXZXZXZXZXZX", +"ZXZXZXZXZXZXZXZXmXt. , _.ZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZX_., t.mXZXZXZXZXZXZXZXZX", +"ZXZXZXZXZXZXZXZXZXZX+X*.# 4 y.qXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXqXy.4 # *.+XZXZXZXZXZXZXZXZXZXZX", +"ZXZXZXZXZXZXZXZXZXZXZXZXlX-X#X6XVXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXVX6X#X-XlXZXZXZXZXZXZXZXZXZXZXZXZX", +"ZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZX", +"ZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZXZX" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_passenger.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_passenger.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_passenger.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_passenger.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,282 @@ +/* XPM */ +static const char *vclass_passenger_xpm[] = { +/* columns rows colors chars-per-pixel */ +"52 20 256 2 ", +" c #3D657D", +". c #504B5A", +"X c #514C5B", +"o c #514D5C", +"O c #504E5E", +"+ c #544F5E", +"@ c #56515F", +"# c #4C5364", +"$ c #515161", +"% c #515162", +"& c #515365", +"* c #525567", +"= c #565160", +"- c #575260", +"; c #575261", +": c #535B6F", +"> c #585362", +", c #595462", +"< c #5C5765", +"1 c #5C5866", +"2 c #5C5967", +"3 c #5E5968", +"4 c #5F5A68", +"5 c #535D71", +"6 c #535E73", +"7 c #47677F", +"8 c #55667D", +"9 c #55677F", +"0 c #596478", +"q c #5A6579", +"w c #5D687D", +"e c #5F6A7F", +"r c #605B69", +"t c #615D6A", +"y c #615D6B", +"u c #625E6B", +"i c #615E6C", +"p c #625F6D", +"a c #645F6D", +"s c #64606D", +"d c #65606E", +"f c #66626F", +"g c #616272", +"h c #616373", +"j c #676472", +"k c #616A7D", +"l c #64697A", +"z c #686370", +"x c #6A6673", +"c c #6D6975", +"v c #706C78", +"b c #706E7B", +"n c #257E9F", +"m c #386781", +"M c #3D7F9F", +"N c #566D86", +"B c #587794", +"V c #597E9D", +"C c #597F9E", +"Z c #616E82", +"A c #627085", +"S c #62748A", +"D c #62758C", +"F c #627B94", +"G c #787580", +"H c #7B7782", +"J c #0A9ECB", +"K c #00AADC", +"L c #08ACDD", +"P c #30A2CE", +"I c #23B1E3", +"U c #24B1E3", +"Y c #27B2E4", +"T c #29B2E4", +"R c #32B4E6", +"E c #34B4E6", +"W c #34B8E5", +"Q c #3CBAE6", +"! c #59809F", +"~ c #5B89AB", +"^ c #5D93B8", +"/ c #5D98BE", +"( c #62819C", +") c #62819D", +"_ c #69829A", +"` c #6284A1", +"' c #628AA9", +"] c #6B92AE", +"[ c #6391B3", +"{ c #6F96B2", +"} c #729BB7", +"| c #749DB9", +" . c #749EBA", +".. c #5E9AC1", +"X. c #5E9BC2", +"o. c #46B8EA", +"O. c #4BB9EB", +"+. c #4EBAEC", +"@. c #58BCEE", +"#. c #63A1C8", +"$. c #60A4CE", +"%. c #63A7D0", +"&. c #60A7D2", +"*. c #61AEDB", +"=. c #64ADD8", +"-. c #64AEDA", +";. c #62B0DE", +":. c #64B0DC", +">. c #75A2C0", +",. c #74A6C5", +"<. c #75A7C7", +"1. c #79ADCC", +"2. c #79B4D6", +"3. c #64B4E2", +"4. c #64B7E6", +"5. c #63BAEB", +"6. c #64BBEB", +"7. c #64BBEC", +"8. c #64BCED", +"9. c #63BEF0", +"0. c #64BEF0", +"q. c #78B8E4", +"w. c #4BC3E6", +"e. c #6FC4F2", +"r. c #6CC4F3", +"t. c #6DC4F4", +"y. c #70CEEB", +"u. c #7FC3E8", +"i. c #70C6F5", +"p. c #72C8F6", +"a. c #76C9F5", +"s. c #75CAF7", +"d. c #77CCF8", +"f. c #7BCEFA", +"g. c #7DD3ED", +"h. c #ED757A", +"j. c #FE6464", +"k. c #FD6C6C", +"l. c #817D88", +"z. c #827F89", +"x. c #83808A", +"c. c #85828C", +"v. c #88848E", +"b. c #8A8791", +"n. c #8B8892", +"m. c #8F8C96", +"M. c #918E97", +"N. c #928E98", +"B. c #99969E", +"V. c #9B99A1", +"C. c #9F9DA5", +"Z. c #9EA8B3", +"A. c #A8A6AD", +"S. c #AAA8AF", +"D. c #AAACB4", +"F. c #ADABB1", +"G. c #B5B4BA", +"H. c #B6B7BF", +"J. c #B8B6BC", +"K. c #BAB8BE", +"L. c #BBB9BF", +"P. c #89AAD0", +"I. c #8DB8D2", +"U. c #ADB1CC", +"Y. c #BEBCC2", +"T. c #8DCFF4", +"R. c #83D5EE", +"E. c #80D2FC", +"W. c #84D2F9", +"Q. c #86D6FE", +"!. c #8ED0F4", +"~. c #8DD8FE", +"^. c #90D0F4", +"/. c #96D3F5", +"(. c #95DBFE", +"). c #9AD6F4", +"_. c #9CD9FA", +"`. c #BACED7", +"'. c #A2D8F6", +"]. c #BBDCEE", +"[. c #AAE2FE", +"{. c #B5E6FE", +"}. c #C69AAC", +"|. c #C0BEC3", +" X c #E7BEC5", +".X c #C6C4C9", +"XX c #CAC8CD", +"oX c #CECDD0", +"OX c #CCCDD2", +"+X c #D3D2D6", +"@X c #D5D5D8", +"#X c #D6D6D9", +"$X c #D8D7DA", +"%X c #DBDBDD", +"&X c #DCDBDE", +"*X c #DCDCDE", +"=X c #DDDCDF", +"-X c #DEDDE0", +";X c #DFDEE1", +":X c #DDDEE2", +">X c #C5E2F2", +",X c #C1E5F9", +" y y y y y y 3 . ; y y y y y y D 8.[ y j :XDXDXDXDXDXDXDXDXDXDXDXDXDXDXDXDXDXDX", +"DXCX_.p.p.i.e._ l 2 . . 3 y y y y y y 3 . ; y y y y y y y ` 0.) y b lXDXDXDXDXDXDXDXDXDXDXDXDXDXDXDXDXDX", +"DX X}.U.Q.Q.Q.Q.Q.W.u.2.1.>. .| | | | } ] { | | | | | | | ,.s.a.<.| I.1X2X3X6XqXwXnXCXDXDXDXDXDXDXDXDXDX", +"ZXk.j.h.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.(.[.2XwXCXDXDXDXDX", +"4XP.P.q.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.t.t.t.t.i.p.s.d.f.E.Q.~.{.nXDXDX", +"'.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.r.>XvXBXDX", +"'.0.0.0.0./ 8 O $ N $.0.0.0.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.0.0.0.;.B * o 6 ~ 7.0.0.].7X9XDX", +"'.0.0.0.V . o c z . o ^ 0.O.K K K K K K K K K K K K K K K K K K K K K K E 0.&.& . r v = . 9 5.0.9.L K R.", +").o.@.... x @XxXxX.X< O *.@.Y I I I I I I I I I I I I I I I I I I I I U +.7.: X F.kXxXyXz.. C 0.0.R W c #212022", +", c #242325", +"< c #252425", +"1 c #282729", +"2 c #2B2A2B", +"3 c #2F2E30", +"4 c #302F31", +"5 c #343334", +"6 c #3C3C3D", +"7 c #3D3C3E", +"8 c #403F41", +"9 c #414142", +"0 c #424143", +"q c #434243", +"w c #4A494B", +"e c #4B4A4C", +"r c #4C4C4D", +"t c #4E4D4F", +"y c #515052", +"u c #5A595A", +"i c #5C5C5D", +"p c #5F5F60", +"a c #626263", +"s c #656465", +"d c #656466", +"f c #666667", +"g c #696869", +"h c #69696A", +"j c #6A6A6B", +"k c #6B6B6C", +"l c #707071", +"z c #727172", +"x c #747475", +"c c #757576", +"v c #777778", +"b c #787879", +"n c #8A8A8B", +"m c #8D8D8D", +"M c #8D8D8E", +"N c #8E8E8F", +"B c gray57", +"V c #939393", +"C c #939394", +"Z c #959495", +"A c #99999A", +"S c #9E9D9E", +"D c gray62", +"F c #9F9E9F", +"G c #A0A0A0", +"H c #A2A1A2", +"J c #A2A2A2", +"K c #A5A5A5", +"L c #AAA9AA", +"P c #AAAAAA", +"I c #ADACAD", +"U c #ADADAE", +"Y c #AEAEAE", +"T c #AEAEAF", +"R c #B0B0B1", +"E c #B2B2B3", +"W c #B4B3B4", +"Q c #B6B6B6", +"! c #B8B8B9", +"~ c #BCBBBC", +"^ c #BCBCBC", +"/ c #BEBEBF", +"( c gray76", +") c gray79", +"_ c gray80", +"` c #D5D5D5", +"' c #D5D5D6", +"] c gray84", +"[ c #D7D7D7", +"{ c #DDDDDD", +"} c #DFDFDF", +"| c #E9E9E9", +" . c #EFEFEF", +".. c gray94", +"X. c #F3F3F3", +"o. c #F4F4F4", +"O. c #F4F4F5", +"+. c #F6F6F6", +"@. c gray98", +"#. c gray99", +"$. c #FDFDFD", +"%. c gray100", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" %.%.%.%.%.", +"%.%.! a e ` %.%.%.%.", +"%.%.b M Z n %.%.%.%.", +"%.o.* # | } 8 %.%.%.%.", +"%.V d %.%.2 + .%.%.%.", +"#., . ' %.%.x L %.%.%.", +"Y w %.%.%./ p %.%.%.", +"c ~ %.%.%.@.& 3 %.%.%.", +"] 9 z %.%.%.%.%.G 6 R %.%.%." +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_private.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_private.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_private.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_private.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,284 @@ +/* XPM */ +static const char *vclass_private_xpm[] = { +/* columns rows colors chars-per-pixel */ +"52 22 256 2 ", +" c #504B5A", +". c #524C5A", +"X c #524D5B", +"o c #524D5C", +"O c #54505E", +"+ c #55505F", +"@ c #5F515B", +"# c #575260", +"$ c #585361", +"% c #585362", +"& c #595462", +"* c #5B5664", +"= c #5E5967", +"- c #63535B", +"; c #65535B", +": c #74595C", +"> c #615C69", +", c #625D6A", +"< c #635E6C", +"1 c #695F6A", +"2 c #65606D", +"3 c #6F6169", +"4 c #6C606A", +"5 c #6A6673", +"6 c #6B6774", +"7 c #74646C", +"8 c #786469", +"9 c #706C78", +"0 c #726E7A", +"q c #74707C", +"w c #78727D", +"e c #797581", +"r c #7D7984", +"t c #8B635D", +"y c #826869", +"u c #8A6A68", +"i c #9D7168", +"p c #A76C5E", +"a c #A76E5F", +"s c #AC655A", +"d c #AA7567", +"f c #B57460", +"g c #B37867", +"h c #B47867", +"j c #BC7660", +"k c #C47961", +"l c #CA7C61", +"z c #CC7D61", +"x c #CE7E61", +"c c #CD7E62", +"v c #F67B5A", +"b c #FA7C5A", +"n c #FE7D5A", +"m c #FE7F5B", +"M c #FF6464", +"N c #FF6664", +"B c #FF7864", +"V c #FE7E64", +"C c #837F8A", +"Z c #857F88", +"A c #CD8066", +"S c #D48366", +"D c #DE8665", +"F c #FE805B", +"G c #FE845D", +"H c #FE855E", +"J c #FE865F", +"K c #FE885F", +"L c #E18765", +"P c #E58763", +"I c #E58965", +"U c #E68B67", +"Y c #F38D64", +"T c #F68B62", +"R c #F48D63", +"E c #F78E64", +"W c #F48F66", +"Q c #FE8767", +"! c #F98E64", +"~ c #FE8860", +"^ c #FE8B61", +"/ c #FE8C62", +"( c #FE8E63", +") c #FE8F6D", +"_ c #FB9064", +"` c #FE9064", +"' c #FE9265", +"] c #FE9367", +"[ c #FE9567", +"{ c #FE9569", +"} c #FE9769", +"| c #FE996A", +" . c #FE9D6C", +".. c #FE9E6D", +"X. c #F7AE7A", +"o. c #FFA370", +"O. c #FFA472", +"+. c #FFA777", +"@. c #FFA478", +"#. c #FFA874", +"$. c #FFAC77", +"%. c #F8AE7B", +"&. c #FFAD78", +"*. c #FFAE78", +"=. c #FFAE79", +"-. c #FBB07B", +";. c #FBB17C", +":. c #FFB07A", +">. c #FDB17B", +",. c #FEB27B", +"<. c #FEB27C", +"1. c #87848E", +"2. c #8A8790", +"3. c #908D96", +"4. c #918E98", +"5. c #989199", +"6. c #98959E", +"7. c #9B98A1", +"8. c #A09EA5", +"9. c #A09EA6", +"0. c #AAA7AE", +"q. c #ADA7AD", +"w. c #B4B2B8", +"e. c #B9B8BD", +"r. c #BDBBC1", +"t. c #D3998D", +"y. c #D39A8F", +"u. c #D4A798", +"i. c #FAA886", +"p. c #FEA887", +"a. c #FEAB8A", +"s. c #FEAD8C", +"d. c #FEAC95", +"f. c #FEAC96", +"g. c #FEAD97", +"h. c #FEAE98", +"j. c #FFB682", +"k. c #FFB786", +"l. c #FFB884", +"z. c #FFBA88", +"x. c #FFBE8F", +"c. c #FEB191", +"v. c #FEB59E", +"b. c #FCBE92", +"n. c #FEBB9F", +"m. c #FEADA2", +"M. c #FFABAB", +"N. c #F6B9A0", +"B. c #FEBDA2", +"V. c #FEBEAC", +"C. c #C3BEC2", +"Z. c #C0BFC4", +"A. c #FFC398", +"S. c #FFC8A1", +"D. c #FFC9A3", +"F. c #FFCAA3", +"G. c #FEC1B0", +"H. c #FECAB4", +"J. c #F9CFBC", +"K. c #FFD1B1", +"L. c #FFD2B1", +"P. c #FFD3B3", +"I. c #C3C1C6", +"U. c #C9C8CC", +"Y. c #D5D4D7", +"T. c #D8D8DA", +"R. c #D8D8DB", +"E. c #DCDBDE", +"W. c #DDDCDF", +"Q. c #DEDDE0", +"!. c #DFDEE0", +"~. c #DFDEE1", +"^. c #FACDC1", +"/. c #FED2C7", +"(. c #FEDBC1", +"). c #FEDEC6", +"_. c #FED9CA", +"`. c #FEDFC8", +"'. c #EFE0DB", +"]. c #FEE0D7", +"[. c #FEE6D5", +"{. c #FEE4DC", +"}. c #F9E8DC", +"|. c #FEE8D8", +" X c #E1E0E2", +".X c #E3E2E5", +"XX c #E4E4E6", +"oX c #E5E5E7", +"OX c #E6E6E7", +"+X c #E7E6E8", +"@X c #EAEAEB", +"#X c #EBEBEC", +"$X c #ECECED", +"%X c #EEEDEF", +"&X c #EEEEEF", +"*X c #F1EFEF", +"=X c #FEEBE3", +"-X c #FEEBE4", +";X c #FEEBE6", +":X c #FEECE5", +">X c #FEEEE6", +",X c #F1EFF0", +"X=X=X=X=X=X=X=X=X=X=X=X:X6XrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrX", +"rXrXrXrXrXrXrXrXrXrXrXrX-Xc.] ` I S z c S S S S S D ` ` U u.*XrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrX", +"rXrXrXrXrXrXrXrXrXrXrX_.{ ` ` h , = + , , , , , , i ` d , w ,XrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrX", +"rXrXrXrXrXrXrXrXrXrXH.' ` ` g , , $ % , , , , , , , h _ u , Z 8XrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrX", +"rXrXrXrXrXrXrXrX0Xn.` ` ` g , , , o * , , , , , , , , A Y 8 , 5.wXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrX", +"rXrXrXrXrXrXrX4Xs.` ` ` I , , , = = , , , , , , , , 1 L I 4 , q.rXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrX", +"rXrX1X|.).P.S.k.#.o. .} W 8 , , $ > , , , , , , , , , y ` S 3 , C.rXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrX", +"rXK.<.<.<.<.<.<.<.<.<.<.<.<.-.-.%.X.X.-.-.-.-.-.-.-.-.-.-.>.,.,.,.-.;.j.l.z.x.A.D.L.(.[. c #575261", +", c #585361", +"< c #585362", +"1 c #595463", +"2 c #5B5664", +"3 c #5B5665", +"4 c #5C5765", +"5 c #5C5766", +"6 c #5D5866", +"7 c #5E5967", +"8 c #5F5A68", +"9 c #5F6B60", +"0 c #615C6A", +"q c #625D6B", +"w c #635E6C", +"e c #645F6C", +"r c #645F6D", +"t c #65616E", +"y c #66616F", +"u c #66626F", +"i c #676270", +"p c #657963", +"a c #706C78", +"s c #716D79", +"d c #726D7A", +"f c #726E7A", +"g c #75717D", +"h c #76727E", +"j c #78747F", +"k c #797581", +"l c #7E7B86", +"z c #6C8966", +"x c #769D6A", +"c c #7CAA6C", +"v c #7CAA6D", +"b c #7DAC6D", +"n c #7EAF6D", +"m c #827E89", +"M c #81B66F", +"N c #83B96F", +"B c #83BA6F", +"V c #83B970", +"C c #85BD71", +"Z c #86BF70", +"A c #85BE71", +"S c #89C573", +"D c #8CCD73", +"F c #8CCD74", +"G c #8FD275", +"H c #90D675", +"J c #90D676", +"K c #95DF78", +"L c #95E078", +"P c #84818B", +"I c #86828C", +"U c #87838D", +"Y c #88848E", +"T c #8B8791", +"R c #8B8892", +"E c #8F8C96", +"W c #908C96", +"Q c #939099", +"! c #95929B", +"~ c #96939C", +"^ c #98959D", +"/ c #9A9A9F", +"( c #9B98A0", +") c #9B98A1", +"_ c #9E9BA3", +"` c #A19EA6", +"' c #A29FA7", +"] c #A6A3AB", +"[ c #A6A4AC", +"{ c #A8A5AD", +"} c #AAA8AF", +"| c #AEABB2", +" . c #B0AEB5", +".. c #B4B2B8", +"X. c #B3BBB3", +"o. c #B9B7BD", +"O. c #BAB8BE", +"+. c #BFBEC3", +"@. c #97D281", +"#. c #9ED589", +"$. c #A5D891", +"%. c #ADDB9B", +"&. c #BAC2B9", +"*. c #B3DEA3", +"=. c #BAE1AB", +"-. c #BBE1AC", +";. c #BDE7AD", +":. c #BFECAE", +">. c #BEE3B0", +",. c #C0BEC3", +"<. c #C1BFC4", +"1. c #C2E4B5", +"2. c #C4E5B7", +"3. c #C8E7BC", +"4. c #C2C0C6", +"5. c #C5C4C9", +"6. c #CAC9CD", +"7. c #CCCACE", +"8. c #CCCACF", +"9. c #CECDD1", +"0. c #D1DCCE", +"q. c #D2D0D4", +"w. c #D2D1D5", +"e. c #D4D2D6", +"r. c #D5D4D7", +"t. c #D8D7DA", +"y. c #D9D8DB", +"u. c #DAD9DC", +"i. c #DCDBDE", +"p. c #DDDCDF", +"a. c #DEDDE0", +"s. c #DFDEE1", +"d. c #D0EAC6", +"f. c #D7EDCF", +"g. c #DEE5DC", +"h. c #E2E3E2", +"j. c #E2E1E4", +"k. c #E4E3E5", +"l. c #E3EAE1", +"z. c #E5EAE4", +"x. c #E8EFE5", +"c. c #E9E8EA", +"v. c #EAE9EB", +"b. c #EDECEE", +"n. c #EEEDEF", +"m. c #EFEFF0", +"M. c #E7F0E4", +"N. c #E8F0E6", +"B. c #EBF6E7", +"V. c #EDF7E9", +"C. c #F0F0F1", +"Z. c #F1F0F2", +"A. c #F4F3F4", +"S. c #F5F4F5", +"D. c #F5F5F6", +"F. c #F7FBF5", +"G. c #F8F7F8", +"H. c #F8F8F9", +"J. c #F9F9FA", +"K. c gray98", +"L. c gray99", +"P. c #FDFCFD", +"I. c #FDFEFD", +"U. c #FEFEFE", +"Y. c gray100", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" 4 0 O r f A.", +"v.i.g q f f f f f f d w f f f f f f s 7 & 0 < 2 0 O w f f f f f f s e f f f f f f a 6 : 0 > 4 0 O e f r.", +"v.i.l y i i i i i i i y i i i i i i u q & 0 < 2 0 O y i i i i i i u y i i i i i i u 0 : 0 > 4 0 O y i ..", +"l.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.&.& 0 < 2 0 O 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.X.: 0 > 4 0 > 0.0.l.", +":.L L L L L L L L L L L L L L L L L L S & 0 < 2 0 O L L L L L L L L L L L L L L L L A : 0 > 4 0 * L L :.", +":.L L L L L L L L L L L F v A L L L L S & 0 < 2 0 O L L L L L L L L L L L K V v G L A : 0 > 4 0 * L L :.", +";.J J J J J J J J J J b o & z J J J C & 0 < 2 0 O J J J J J J J J J J H p . $ * V M & 0 > 4 0 * J J ;.", +">.D D D D D D D D D D - P u.} N D D M X : O @ : D D D D D D D D D D c X O.t.h 9 n X : O # : % D D =.", +"F.f.d.3.1.-.*.%.$.#.@.+ [ i.9. b D D Z o = D D D D D D D D D D x & y.i.~ ; B . ; D D 2.", +"U.U.U.U.U.U.U.U.U.U.U.T 7 ( a 0 M.B.B.B.z.h.h.h.h.x.B.B.B.B.B.B.B.B.B.B.g., k ^ , / B.z.h.h.h.h.N.B.V.I.", +"U.U.U.U.U.U.U.U.U.U.U.A.Q t l s.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.e.j i _ J.U.U.U.U.U.U.U.U.U.U.", +"U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.", +"U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U.U." +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_rail_urban.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_rail_urban.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_rail_urban.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_rail_urban.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,284 @@ +/* XPM */ +static const char *vclass_rail_urban_xpm[] = { +/* columns rows colors chars-per-pixel */ +"64 22 256 2 ", +" c #504B5A", +". c #5D5867", +"X c #5E5968", +"o c #615C6A", +"O c #625D6B", +"+ c #65606D", +"@ c #65616E", +"# c #62697C", +"$ c #626A7D", +"% c #626B7E", +"& c #626C7F", +"* c #686370", +"= c #696472", +"- c #6C6774", +"; c #627085", +": c #62768E", +"> c #627C96", +", c #627D97", +"< c #797480", +"1 c #7A7682", +"2 c #62819C", +"3 c #62839F", +"4 c #6283A0", +"5 c #6286A4", +"6 c #638CAB", +"7 c #6392B3", +"8 c #6397BB", +"9 c #6398BC", +"0 c #6398BD", +"q c #6399BE", +"w c #63A4CC", +"e c #63A4CD", +"r c #63A5CE", +"t c #63A8D1", +"y c #63AAD5", +"u c #63ABD6", +"i c #64ADD9", +"p c #64B1DE", +"a c #64B2E0", +"s c #64B7E6", +"d c #64B9E9", +"f c #64BBEC", +"g c #64BDEE", +"h c #64BEF0", +"j c #69C0F0", +"k c #6DC1F0", +"l c #76C4F0", +"z c #7AC6F0", +"x c #7CC6F0", +"c c #817D89", +"v c #827E8A", +"b c #85828D", +"n c #918E97", +"m c #94909A", +"M c #98959E", +"N c #99969F", +"B c #9F9CA5", +"V c #AEABB3", +"C c #B0ADB4", +"Z c #B3B1B8", +"A c #84C9F0", +"S c #97CFEF", +"D c #A2D3EF", +"F c #ADD7EF", +"G c #B0D8EF", +"H c #C0BEC4", +"J c #C2C0C5", +"K c #C3C1C6", +"L c #C9C7CC", +"P c #CAC8CD", +"I c #CBCACE", +"U c #CCCACF", +"Y c #CFCDD2", +"T c #D0CFD3", +"R c #D2D1D5", +"E c #D6D5D8", +"W c #DCDBDE", +"Q c #DDDCDE", +"! c #DFDFE1", +"~ c #C9E0EE", +"^ c #D3E4EE", +"/ c #D8E5EE", +"( c #E0DFE2", +") c #E0E0E2", +"_ c #E1E0E3", +"` c #E2E1E4", +"' c #E2E2E4", +"] c #E2E2E5", +"[ c #E3E3E6", +"{ c #E4E3E6", +"} c #E4E4E6", +"| c #E4E4E7", +" . c #E6E5E8", +".. c #E6E6E8", +"X. c #E8E7EA", +"o. c #E8E8EA", +"O. c #E9E9EB", +"+. c #EAEAEC", +"@. c #EBEBED", +"#. c #EBECEE", +"$. c #ECECEE", +"%. c #EFEEF0", +"&. c #EFEFF1", +"*. c #F0EFF0", +"=. c #F0F0F1", +"-. c #F2F2F3", +";. c #F2F2F4", +":. c #F7F7F8", +">. c #F8F8F9", +",. c #F9F9FA", +"<. c #FAFAFB", +"1. c gray99", +"2. c #FCFCFD", +"3. c #FEFEFE", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" h y o o o o o o y h > o o o o o : h p o o o o o o w h 3 o o o o o ; h h h j G #.O.V = o o o o M >.3.3.3.3.", +"$.$.l h : o o o o o > h y o o o o o o y h > o o o o o : h p o o o o o o w h 3 o o o o o ; h h h h h A / $.( B * o o o v *.3.3.3.", +"$.$.l h : o o o o o , h u o o o o o o u h , o o o o o : h p o o o o o o e h 4 o o o o o ; h h h h h h j G #.$.{ Z b @ o 1 =.3.3.", +"$.$.x h t 8 8 8 8 8 y h f 0 8 8 8 8 0 f h y 8 8 8 8 8 t h g q 8 8 8 8 9 d h i 8 8 8 8 8 r h h h h h h h h S $.$.$.$.o.R H T 2.3.", +"$.$.^ F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F F ~ $.$.$.$.$.$.$.$.-.3.", +"$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.>.", +"$.$.+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...@.$.$.X. .+.", +"$.$.! W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W ' $.+.W W Q ", +"$.$. .) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) _ o.$.$.' ) ) ", +"$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.", +"$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.%.", +"@.@.@.@.@.@.@.@.@.@.@.| ] ] ] ` ` ` ] ] ] } @.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.} ] ] ] ` ` ` ] ] ] | @.@.@.@.@.@.@.@.@.&.<.", +"W W W W W W W W W W Y + o o X . o o O L W W W W W W W W W W W W W W W W W W L O o o . X o o + Y W W W W W W W W %.3.", +"] W W W W W W W W W P o o o X . o o o J W W W W W W W W W W W W W W W W W W J o o o . X o o o P W W W W W W W W _ 3.", +"3.1.1.1.1.1.1.1.1.1.2.N o = I -.-.-.R - o n <.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.<.n o - R -.-.-.I = o N 2.1.1.1.1.1.1.1.1.2.3.", +"3.3.3.3.3.3.3.3.3.3.3.3.=.>.3.3.3.3.3.,.%.3.3.3.3.3.3.3.3.3.3.3.3.3.3.3.3.3.3.3.3.3.3.%.,.3.3.3.3.3.>.=.3.3.3.3.3.3.3.3.3.3.3.3." +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_rail.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_rail.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_rail.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_rail.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,290 @@ +/* XPM */ +static const char *vclass_rail_xpm[] = { +/* columns rows colors chars-per-pixel */ +"43 28 256 2 ", +" c #273440", +". c #293642", +"X c #2A3843", +"o c #2A3844", +"O c #2D3A45", +"+ c #2F3D48", +"@ c #313E49", +"# c #31404B", +"$ c #36434D", +"% c #37444F", +"& c #334552", +"* c #354550", +"= c #344552", +"- c #344652", +"; c #364853", +": c #374954", +"> c #384551", +", c #3A4A55", +"< c #3A4C57", +"1 c #3C4C55", +"2 c #3B4E5C", +"3 c #3C4D58", +"4 c #414F57", +"5 c #40505A", +"6 c #46515A", +"7 c #47535D", +"8 c #46545E", +"9 c #4C585E", +"0 c #405260", +"q c #425562", +"w c #475560", +"e c #4A5961", +"r c #4F5C63", +"t c #4A5B68", +"y c #4D5D6A", +"u c #525E62", +"i c #525D67", +"p c #53636E", +"a c #566168", +"s c #556268", +"d c #56626A", +"f c #55646F", +"g c #586265", +"h c #596366", +"j c #5A6467", +"k c #5A6468", +"l c #59656E", +"z c #5C6669", +"x c #5D6A6E", +"c c #536470", +"v c #5E6C70", +"b c #666F76", +"n c #627277", +"m c #657077", +"M c #637378", +"N c #647378", +"B c #66737B", +"V c #647479", +"C c #65757A", +"Z c #65747E", +"A c #6A747D", +"S c #6C777A", +"D c #6E787D", +"F c #3F788D", +"G c #367D96", +"H c #397B93", +"J c #447687", +"K c #437788", +"L c #4E7F8F", +"P c #6A7884", +"I c #6C7A85", +"U c #727F88", +"Y c #0B81AF", +"T c #0B88B8", +"R c #0C88B8", +"E c #1E88AF", +"W c #138EBB", +"Q c #108FBE", +"! c #158CB8", +"~ c #158DBA", +"^ c #1B8AB2", +"/ c #198AB4", +"( c #188BB6", +") c #1D89B0", +"_ c #1C89B2", +"` c #1F8BB6", +"' c #1C8CB5", +"] c #1393BF", +"[ c #1394BF", +"{ c #2E819F", +"} c #338B98", +"| c #2784A6", +" . c #2585A8", +".. c #2B82A2", +"X. c #2983A4", +"o. c #2D81A0", +"O. c #2C82A1", +"+. c #0E90C0", +"@. c #0C91C2", +"#. c #0F92C1", +"$. c #0E92C2", +"%. c #0C93C5", +"&. c #0D94C5", +"*. c #0D9BCB", +"=. c #1293C0", +"-. c #1092C3", +";. c #1898C7", +":. c #0DA4D2", +">. c #15A7D3", +",. c #209BC0", +"<. c #269EC1", +"1. c #239CC9", +"2. c #289BC6", +"3. c #299EC3", +"4. c #2AA3C7", +"5. c #2EA2C7", +"6. c #2BA3C9", +"7. c #2CA3CA", +"8. c #2FA8CE", +"9. c #22ACD6", +"0. c #2FB1D8", +"q. c #33A3CD", +"w. c #30A7C8", +"e. c #32A7CB", +"r. c #32A8C8", +"t. c #32A8CC", +"y. c #34A8CB", +"u. c #38A6CA", +"i. c #3CA7CF", +"p. c #3CA8CA", +"a. c #3EAACB", +"s. c #31ABD3", +"d. c #32ACD4", +"f. c #37ADD1", +"g. c #37ACD2", +"h. c #36AFD6", +"j. c #39AED1", +"k. c #3AAFD5", +"l. c #32B2D9", +"z. c #38B0D6", +"x. c #3CB2D6", +"c. c #3CB5DB", +"v. c #3FB6DB", +"b. c #7A848B", +"n. c #79868E", +"m. c #7D8589", +"M. c #7A898D", +"N. c #6793A3", +"B. c #41ABCB", +"V. c #45A9C9", +"C. c #48A3C2", +"Z. c #4AACCB", +"A. c #4EADCB", +"S. c #41AFD2", +"D. c #44B2D4", +"F. c #43B5D8", +"G. c #42B8DC", +"H. c #49B6D7", +"J. c #49BADD", +"K. c #56AFCB", +"L. c #5FA6C1", +"P. c #55B7D6", +"I. c #56BFDF", +"U. c #69B1CE", +"Y. c #72AEC4", +"T. c #71AFC6", +"R. c #75BFDA", +"E. c #73C0DC", +"W. c #62C4E2", +"Q. c #6FC9E4", +"!. c #7CCEE6", +"~. c #DAB659", +"^. c #F8C360", +"/. c #858E92", +"(. c #888F97", +"). c #87929C", +"_. c #8B9295", +"`. c #8E9599", +"'. c #8C989E", +"]. c #969D9F", +"[. c #8E9AA1", +"{. c #929CA1", +"}. c #9CA2A4", +"|. c #9DA4A6", +" X c #9AA4AB", +".X c #A1A6A8", +"XX c #A3ABB2", +"oX c #A2ADB2", +"OX c #A4AEB3", +"+X c #A4AFB4", +"@X c #AAAFB2", +"#X c #ABB5BA", +"$X c #ADB8BC", +"%X c #B4B9BE", +"&X c #B7BCBD", +"*X c #84B8CC", +"=X c #8DB5C2", +"-X c #8EB8C6", +";X c #96BECD", +":X c #B3BEC3", +">X c #B4BDC2", +",X c #BBBFC0", +".9.0.c.J.I.W.Q.!.2X3XrXyXiXzXbXCXHXIXUXUXUXUXUXUXUXUXUXUXUXUXUXUXUX", +"*.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.%.&.;.1.i.1XGXUXUXUXUXUXUXUXUXUXUX", +"@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.q.GXUXUXUXUXUXUXUXUXUX", +"@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.@.E.UXUXUXUXUXUXUXUXUX", +"@.$.[ [ ] =.[ [ #.@.@.~ / / ( +./ / / / @./ / / / Q ! / / / Q ! / ' xXUXUXUXUXUXUXUXUX", +"@.,.r.r.w.4.r.r.<.@.E J J J F W J J J J Q K J J J _ G J J J O.X.J J N.PXUXUXUXUXUXUXUX", +"@.s.G.G.v.h.G.G.z.@...J J J F W J J J J Q K J J J _ G J J J F ! J J J 4XUXUXUXUXUXUXUX", +"@.d.G.G.v.h.G.G.z.@.| J J J F W J J J J Q K J J J _ G J J J J ^ H J J L AXUXUXUXUXUXUX", +"@.d.G.G.v.h.G.G.z.@.+.X.{ { ..Q { { { { +.o.{ { { ! .{ { { { E ) { { { T.UXUXUXUXUXUX", +"$.d.G.G.v.h.G.G.z.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.$.-.kXUXUXUXUXUX", +"*XP.G.G.v.h.G.G.H.*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*X*XXc 8Xw `. XZ 5X> @XU n.$Xo sXf [.oX. SXUXUXUXUX", +"P +X>X% JXy 6XOXi JX0 pX{.A MXt fXb.(.9XZ gXl %XXXn.dX8 jX).[.0X% VXI oX>X> PXUXUXUXUX", +"/.. . a .Xm o . D .Xd O m..X7 + _.|.# @ X }.].o @ $ .X_.o O 6 .Xm.X X k .X&XUXUXUX", +"aX7X,X7X7X7X7X7X7X7X7X,X7X7X7X7X7X7X7X7X7X,X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7XhXUXUXUX" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_ship.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_ship.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_ship.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_ship.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,282 @@ +/* XPM */ +static const char *vclass_ship_xpm[] = { +/* columns rows colors chars-per-pixel */ +"52 20 256 2 ", +" c #625D6B", +". c #6A6572", +"X c #6B6674", +"o c #706C78", +"O c #75717D", +"+ c #787480", +"@ c #797581", +"# c #807C87", +"$ c #898690", +"% c #8B8892", +"& c #8D8A94", +"* c #918D97", +"= c #95929B", +"- c #96939C", +"; c #9F9CA4", +": c #A3A0A8", +"> c #A4A1A9", +", c #ADAAB1", +"< c #B1AEB5", +"1 c #B3B1B8", +"2 c #B5B3B9", +"3 c #B8B6BC", +"4 c #BAB8BE", +"5 c #BBB9BF", +"6 c #BFBDC3", +"7 c #BFBEC3", +"8 c #C3C1C6", +"9 c #C4C2C7", +"0 c #C4C2C8", +"q c #C7C5CA", +"w c #CDCBCF", +"e c #CECCD1", +"r c #D1D0D4", +"t c #D6D5D8", +"y c #DAD8DC", +"u c #DBDADD", +"i c #DCDBDE", +"p c #DDDCDF", +"a c #DEDDE0", +"s c #DFDEE1", +"d c #E0DFE1", +"f c #E0DFE2", +"g c #E1E0E3", +"h c #E2E1E4", +"j c #E4E3E6", +"k c #E4E4E6", +"l c #E6E5E7", +"z c #E6E5E8", +"x c #E7E6E8", +"c c #E7E7E9", +"v c #E8E8EA", +"b c #E9E9EB", +"n c #EAE9EC", +"m c #EAEAEC", +"M c #ECECEE", +"N c #EDEDEF", +"B c #EEEEEF", +"V c #EFEFF0", +"C c #EFEFF1", +"Z c #F0F0F1", +"A c #F0F0F2", +"S c #F1F1F3", +"D c #F2F2F3", +"F c #F2F2F4", +"G c #F4F4F5", +"H c #F5F5F6", +"J c #F6F6F7", +"K c #F7F7F8", +"L c #F8F8F8", +"P c #F8F8F9", +"I c #F9F9FA", +"U c gray98", +"Y c #FAFAFB", +"T c #FBFBFC", +"R c gray99", +"E c #FCFCFD", +"W c #FEFEFE", +"Q c gray100", +"! c black", +"~ c black", +"^ c black", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +"0. c black", +"q. c black", +"w. c black", +"e. c black", +"r. c black", +"t. c black", +"y. c black", +"u. c black", +"i. c black", +"p. c black", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +" * & & : v W Q Q Q Q Q Q ", +"Q Q Q Q Q Q Q T K J J J H k j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j v H J J J J Y ", +"Q Q Q Q Q Y Z M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M P ", +"Q Q Q W F M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M L Q ", +"Q Q P B M m f s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s h M M M M M M M N U Q Q ", +"E A M M M n a p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p p f M M M M M M D E Q Q Q ", +"H M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M M S Y Q Q Q Q Q ", +"R D S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S F G P E Q Q Q Q Q Q Q " +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_taxi.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_taxi.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_taxi.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_taxi.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,294 @@ +/* XPM */ +static const char *vclass_taxi_xpm[] = { +/* columns rows colors chars-per-pixel */ +"52 32 256 2 ", +" c #11202E", +". c #1F262D", +"X c #122230", +"o c #182734", +"O c #1E2D3B", +"+ c #252B2E", +"@ c #2A2D2A", +"# c #252D34", +"$ c #23313F", +"% c #2D3337", +"& c #2C353D", +"* c #32342E", +"= c #3A3629", +"- c #323638", +"; c #1E3343", +": c #203545", +"> c #253844", +", c #283A43", +"< c #323D41", +"1 c #36423E", +"2 c #3A443D", +"3 c #334140", +"4 c #3D454B", +"5 c #443B28", +"6 c #46473A", +"7 c #454B39", +"8 c #4D4D37", +"9 c #4A4C38", +"0 c #4E5136", +"q c #505235", +"w c #5D5931", +"e c #655E2F", +"r c #6D552C", +"t c #625D30", +"y c #6A5E3C", +"u c #6A612D", +"i c #73662A", +"p c #7D6D26", +"a c #796A28", +"s c #4E5457", +"d c #4C575C", +"f c #554F45", +"g c #585144", +"h c #565F63", +"j c #615643", +"k c #6A737D", +"l c #737C85", +"z c #708E7C", +"x c #799075", +"c c #5D888F", +"v c #51859A", +"b c #55889D", +"n c #5C8890", +"m c #5C8D9E", +"M c #5A8EA4", +"N c #5C90A5", +"B c #76838D", +"V c #7D868E", +"C c #769382", +"Z c #7A9786", +"A c #7B9987", +"S c #7F9D8B", +"D c #769B95", +"F c #6094A9", +"G c #6398AC", +"H c #699DB2", +"J c #6DA2B6", +"K c #7DB2C5", +"L c #957B1F", +"P c #9A7D1D", +"I c #847124", +"U c #8A7422", +"Y c #927920", +"T c #8D7343", +"R c #9C7E4D", +"E c #CB2C2B", +"W c #C93535", +"Q c #E47E9B", +"! c #E87E9B", +"~ c #9D801C", +"^ c #9C833D", +"/ c #A0821B", +"( c #A98718", +") c #AE8A16", +"_ c #B48D14", +"` c #AF8139", +"' c #B48335", +"] c #BA8531", +"[ c #BDA433", +"{ c #998251", +"} c #9F8558", +"| c #91975D", +" . c #9C9A52", +".. c #A28D5B", +"X. c #A98C5B", +"o. c #A7915E", +"O. c #AC9055", +"+. c #AE955E", +"@. c #B1975F", +"#. c #A99165", +"$. c #AA946E", +"%. c #B09B68", +"&. c #AAA24F", +"*. c #ABAD6B", +"=. c #ACB378", +"-. c #C5980E", +";. c #CA9A0C", +":. c #C29610", +">. c #C4892D", +",. c #CB8D2A", +"<. c #C18931", +"1. c #D59836", +"2. c #D5A109", +"3. c #DDA506", +"4. c #D8A308", +"5. c #D7AB19", +"6. c #DCA71D", +"7. c #DBAB15", +"8. c #DDAA1A", +"9. c #DDB01C", +"0. c #C2A52D", +"q. c #DDB120", +"w. c #D4B232", +"e. c #EE9200", +"r. c #EC950D", +"t. c #EAAE02", +"y. c #E1AF14", +"u. c #E0A818", +"i. c #EBB107", +"p. c #EEB001", +"a. c #EEB204", +"s. c #E5B111", +"d. c #E2B118", +"f. c #EBB413", +"g. c #F1AA00", +"h. c #F0B200", +"j. c #F1B304", +"k. c #F1B406", +"l. c #F1B508", +"z. c #F2B60C", +"x. c #F0B810", +"c. c #F0B916", +"v. c #F0BD1F", +"b. c #EFBF26", +"n. c #F0BE26", +"m. c #F3BE2A", +"M. c #CAB243", +"N. c #D6A046", +"B. c #D3A557", +"V. c #DBB148", +"C. c #C3BA7F", +"Z. c #CABE7C", +"A. c #EEC83F", +"S. c #F1C336", +"D. c #F0C438", +"F. c #F3C43C", +"G. c #EEC945", +"H. c #E3C65D", +"J. c #EFD35F", +"K. c #F2C744", +"L. c #F4C746", +"P. c #F5CB52", +"I. c #F2CE58", +"U. c #F5CD5A", +"Y. c #F4D062", +"T. c #F6D167", +"R. c #F6D169", +"E. c #F6D26D", +"W. c #F6D46F", +"Q. c #F7D575", +"!. c #F3D87A", +"~. c #848F98", +"^. c #849494", +"/. c #86919A", +"(. c #8A9299", +"). c #949CA3", +"_. c #88A28A", +"`. c #88A592", +"'. c #94B29E", +"]. c #9BB498", +"[. c #89B1AF", +"{. c #8BB4B2", +"}. c #95B4A0", +"|. c #93B6AF", +" X c #A6B485", +".X c #A6AFB3", +"XX c #A7B0B5", +"oX c #A8B1B5", +"OX c #ADB5BA", +"+X c #B5B6A6", +"@X c #BBBBAA", +"#X c #B0B9BE", +"$X c #80B5C8", +"%X c #88B8C8", +"&X c #B6C0C4", +"*X c #BBC4C6", +"=X c #BECDCE", +"-X c #C4B68E", +";X c #C3B793", +":X c #C3B995", +">X c #EB809C", +",X c #D6C59E", +" 3.: ;.3 ;.2 -.2 _ 0 ) q P e P u L u I p p I p I u P e P q ) 0 _ 9 _ 2 ;.3 ;.: 3.> 4., C.J.vX", +"zXr.g.g.g.g.g.g.8.^ y y ^ 8.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.g.u.^ y y ^ 6.g.g.g.g.g.V.H.nX", +">XE e.e.e.e.e.' % o ; ; X - ' e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.] - X ; ; o % ` e.e.e.e.e.;XkX", +"! E e.e.e.e.>.# : : 8 9 : ; + ,.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.,.# ; : 9 8 : ; . <.e.e.e.e.-XkX", +"Q W r.r.e.e.g ; 2 +.@X@XO.+ j e.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.r.e.j ; < O.1X+X@.* f e.e.r.r.:XcX", +"gXyXyXyXtX1.& : ..*XjXaX.XT X & B.yXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXN.< : { *XfXaXoXR X # 1.tXyXyXyXVX", +"fX=X=X=X=X c #625E6B", +", c #675E6A", +"< c #6C5F69", +"1 c #65616E", +"2 c #66626F", +"3 c #676370", +"4 c #696572", +"5 c #6A6672", +"6 c #6A6673", +"7 c #6B6774", +"8 c #6C6774", +"9 c #6C6875", +"0 c #6E6976", +"q c #6E6A76", +"w c #74707C", +"e c #75717D", +"r c #76727E", +"t c #7B7883", +"y c #7C7884", +"u c #7F7C87", +"i c #8A6566", +"p c #A26E66", +"a c #A86E60", +"s c #B27C6E", +"d c #BA7A66", +"f c #C96E5A", +"g c #DC7D5F", +"h c #C97F66", +"j c #FE7D5A", +"k c #FE7E5B", +"l c #FE7F5C", +"z c #807C87", +"x c #A6806E", +"c c #A7826F", +"v c #A88270", +"b c #AA8572", +"n c #AF8A76", +"m c #B38E7A", +"M c #CB866F", +"N c #D78264", +"B c #DD8665", +"V c #FE815E", +"C c #FE865E", +"Z c #FE865F", +"A c #FE8A60", +"S c #FE8A61", +"D c #FE8F63", +"F c #FB9064", +"G c #FE9064", +"H c #FE9265", +"J c #FE9A6B", +"K c #FE9C6C", +"L c #FFA471", +"P c #FFAE78", +"I c #FFB07A", +"U c #FFB47D", +"Y c #83808A", +"T c #86838D", +"R c #8A8791", +"E c #8C8993", +"W c #8D8A94", +"Q c #8E8B95", +"! c #908D96", +"~ c #918E97", +"^ c #928F99", +"/ c #93919A", +"( c #96939C", +") c #97959D", +"_ c #98959E", +"` c #9E9BA3", +"' c #BB9682", +"] c #BE9985", +"[ c #A09DA5", +"{ c #A09DA6", +"} c #A09EA6", +"| c #A29FA7", +" . c #A3A0A8", +".. c #A3A1A9", +"X. c #A6A3AB", +"o. c #A6A4AB", +"O. c #A8A5AD", +"+. c #ADABB2", +"@. c #AFADB4", +"#. c #B0AEB4", +"$. c #B0AEB5", +"%. c #B4B2B8", +"&. c #B7B5BB", +"*. c #B8B6BC", +"=. c #BCB6BB", +"-. c #BCBAC0", +";. c #C5A08B", +":. c #CAA58F", +">. c #CBA690", +",. c #CEA993", +"<. c #D7A391", +"1. c #D0AC95", +"2. c #DAA694", +"3. c #D8B49D", +"4. c #DBB69F", +"5. c #C7AAA7", +"6. c #CFB4AE", +"7. c #DBB6A0", +"8. c #DCB9A2", +"9. c #FE9E84", +"0. c #FEB090", +"q. c #FEB19C", +"w. c #FEB79F", +"e. c #E1BDA6", +"r. c #FEBDA2", +"t. c #FEBFA5", +"y. c #DAC0B0", +"u. c #FFCCA6", +"i. c #FFCCA7", +"p. c #FEC9BB", +"a. c #FFD2B1", +"s. c #FFD3B3", +"d. c #FFD6B8", +"f. c #C2C0C6", +"g. c #C4C2C7", +"h. c #C4C3C8", +"j. c #CFCACD", +"k. c #CCCBCF", +"l. c #CECDD1", +"z. c #DDCCCA", +"x. c #D1CFD3", +"c. c #D3D1D5", +"v. c #D5D4D8", +"b. c #D7D6D9", +"n. c #D9D4D6", +"m. c #D8D7DB", +"M. c #DBDADD", +"N. c #FED2C6", +"B. c #FEDAC0", +"V. c #FEDBC1", +"C. c #E2DEE0", +"Z. c #FFEDDF", +"A. c #E2E1E4", +"S. c #E3E2E4", +"D. c #E9E8EA", +"F. c #ECEBED", +"G. c #ECECED", +"H. c #EEEEEF", +"J. c #FEEBE5", +"K. c #F0EFF1", +"L. c #FEF0E9", +"P. c #FEF0EA", +"I. c #FEF0EB", +"U. c #FEF2ED", +"Y. c #FEF3EF", +"T. c seashell", +"R. c #F3F3F4", +"E. c #F6F3F3", +"W. c #F6F6F7", +"Q. c #FEF3F0", +"!. c #FEF6F2", +"~. c #F9F8F9", +"^. c #FAF9FA", +"/. c gray98", +"(. c #FEFDFC", +"). c #FEFDFD", +"_. c #FEFEFE", +"`. c gray100", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +".c ' 4.7.;.v m 3.7.y.n.2.2.<.s a g Z Z w.", +"_.g.o.o.o.o.[ - ; : @ ) 2 # 3 X R o.o.o.o.o.o.o.o.*.S._._._...X 6 o z ( X 3 # 7 &.*.*.*.&.4 $ 2 . f j q.", +"_./.G.^ ^ ^ r ; c.m.9 ; f.M.T 0 F.F.F.F.F.F.G.R._._._._.~.+ .M.X.o : T M.f. { *.*.*.` X h.M.Y < 5.z.", +"_._._.O./ / e : m.M.w * k.M.~ q _._._._._._._._._._._._.W.o +.M.#.X ; ~ M.k. } -.-.-.` X l.M.W 1 -.b.", +"_._._._._._.D.= 8 w O x.9 : y o %._._._._._._._._._._._._._.! % u & E %.o y : 9 /._._._.~.5 > t X *._._.", +"_._._._._._._.A._ ^ v._.K.| W f._._._._._._._._._._._._._._./.$.E @.^._.f.W | K._._._._._.H.} Q h._._._.", +"_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.", +"_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.", +"_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.", +"_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.", +"_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.", +"_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.", +"_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._." +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_tram.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_tram.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_tram.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_tram.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,288 @@ +/* XPM */ +static const char *vclass_tram_xpm[] = { +/* columns rows colors chars-per-pixel */ +"52 26 256 2 ", +" c #60575C", +". c #675E63", +"X c #625D6A", +"o c #635E6A", +"O c #645E6A", +"+ c #6C6468", +"@ c #6F6769", +"# c #6F6869", +"$ c #6B6673", +"% c #6E6A76", +"& c #756C68", +"* c #786C66", +"= c #7B6E65", +"- c #716D79", +"; c #74707B", +": c #76727E", +"> c #7F7A83", +", c #8A7862", +"< c #8D7B61", +"1 c #8F7C61", +"2 c #917D61", +"3 c #927E60", +"4 c #927E61", +"5 c #FF6464", +"6 c #FF7A78", +"7 c #877F80", +"8 c #8F8165", +"9 c #8E8166", +"0 c #9D8D64", +"q c #A68B5D", +"w c #A68C5D", +"e c #A98E5C", +"r c #BB9A58", +"t c #BE9C58", +"y c #A59363", +"u c #A69463", +"i c #B29E62", +"p c #D2AA54", +"a c #D5AC53", +"s c #FF9760", +"d c #E4B54D", +"f c #FEA554", +"g c #FEA95E", +"h c #F3B94F", +"j c #F1BF4C", +"k c #F8BC4E", +"l c #FBBF4D", +"z c #F9BE4E", +"x c #FEBC56", +"c c #DEC25D", +"v c #E3C65D", +"b c #E7C95C", +"n c #E7CA5C", +"m c #E8CA5C", +"M c #ECCD5C", +"N c #EDCE5C", +"B c #F3C24E", +"V c #F8C54D", +"C c #F9C64D", +"Z c #FDC04D", +"A c #FEC84B", +"S c #FDC84C", +"D c #FECA4C", +"F c #FECA4D", +"G c #F1C350", +"H c #F2C752", +"J c #F2CE57", +"K c #FEC557", +"L c #FECC52", +"P c #FECE50", +"I c #F1D15B", +"U c #F3D259", +"Y c #F3D35A", +"T c #F4D35A", +"R c #FED051", +"E c #FED152", +"W c #FED154", +"Q c #FED454", +"! c #FDD958", +"~ c #FDDB5A", +"^ c #FCDB5C", +"/ c #FEDC5A", +"( c #EBD06C", +") c #ECD06C", +"_ c #FED169", +"` c #FED67A", +"' c #FED67B", +"] c #FED77C", +"[ c #FEE277", +"{ c #8D8991", +"} c #928F98", +"| c #94909A", +" . c #9C98A1", +".. c #A19EA6", +"X. c #A6A3A8", +"o. c #A5A2AA", +"O. c #A7A4AC", +"+. c #AAA7AC", +"@. c #B4B2B8", +"#. c #BFBDC2", +"$. c #C2B194", +"%. c #CCBC9D", +"&. c #E0C385", +"*. c #E6D69B", +"=. c #FEC598", +"-. c #F7D89C", +";. c #FEDE96", +":. c #FEE895", +">. c #FEEABB", +",. c #CCCACC", +"<. c #CDCBCD", +"1. c #D3D1D5", +"2. c #DEDDE0", +"3. c #FEC7C5", +"4. c #F9E9C3", +"5. c #FEEBC0", +"6. c #FEF1C0", +"7. c #FEF1D5", +"8. c #FEF2D5", +"9. c #E3E2E4", +"0. c #EDEDEE", +"q. c #FEEEEC", +"w. c #FEF8EA", +"e. c #FEF9EC", +"r. c #F3F2F1", +"t. c #F5F5F6", +"y. c #FEFBF4", +"u. c #FBFBFB", +"i. c #FEFDFB", +"p. c #FEFEFE", +"a. c black", +"s. c black", +"d. c black", +"f. c black", +"g. c black", +"h. c black", +"j. c black", +"k. c black", +"l. c black", +"z. c black", +"x. c black", +"c. c black", +"v. c black", +"b. c black", +"n. c black", +"m. c black", +"M. c black", +"N. c black", +"B. c black", +"V. c black", +"C. c black", +"Z. c black", +"A. c black", +"S. c black", +"D. c black", +"F. c black", +"G. c black", +"H. c black", +"J. c black", +"K. c black", +"L. c black", +"P. c black", +"I. c black", +"U. c black", +"Y. c black", +"T. c black", +"R. c black", +"E. c black", +"W. c black", +"Q. c black", +"!. c black", +"~. c black", +"^. c black", +"/. c black", +"(. c black", +"). c black", +"_. c black", +"`. c black", +"'. c black", +"]. c black", +"[. c black", +"{. c black", +"}. c black", +"|. c black", +" X c black", +".X c black", +"XX c black", +"oX c black", +"OX c black", +"+X c black", +"@X c black", +"#X c black", +"$X c black", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +".i.p.p.i.>._ ;.w.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.", +"p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.y.;._ >.i.p.p.p.p.p.p.i.>._ ;.y.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.", +"p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.e.' ` 8.p.p.p.p.p.p.p.p.8.` ' e.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.", +"p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.7.' ] 8.p.p.p.p.8.] ' 7.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.", +"p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.7.' &.,.,.&.' 7.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.", +"p.p.p.t.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.{ - - { 1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.t.p.p.p.", +"p.6.:.*.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O. .| | .O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.*.:.6.p.", +"p.[ / ^ ) ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ) ^ / [ p.", +"p.4.B C S F F F F F S C B B V S B B B B B C S D F F F F D S C B B C S B B B B B C S F F F F F S C B 4.p.", +"p.X.X 2 P I c ~ v M E e X X = a X X X X X 4 A ! c I I c ! A 4 X X 3 t X X X X X e E M v ~ c I P 2 X X.p.", +"p.> X < R u X n O 8 Q w X X * p X X X X X < A m X u u X m A < X X 1 r X X X X X q Q 8 O n X u R < X > p.", +"r.o X < R u X b o 9 Q w X X * p X X X X X < A m X y y X m A < X X 1 r X X X X X q Q 9 o b X u R < X o r.", +"<.X X < R u X b o 9 Q w X X * p X X X X X < A m X y y X m A < X X 1 r X X X X X q Q 9 o b X u R < X X <.", +"+.X X 2 R u X b o 9 Q e X X = a X X X X X 4 A m X y y X m A 3 X X 3 t X X X X X e Q 9 o b X u R 2 X X +.", +"-.h h z L i @ N & 0 W l h h k Z h h h h h z Z N # i i # N Z z h h z Z h h h h h l W 0 & N @ i L z h h -.", +"3.5 5 5 s / / / / / g 5 5 5 5 5 5 5 5 5 5 5 5 / / / / / / 5 5 5 5 5 5 5 5 5 5 5 5 g / / / / / s 5 5 5 3.", +"q.5 5 5 s / / / / / g 5 5 5 5 5 5 5 5 5 5 5 5 / / / / / / 5 5 5 5 5 5 5 5 5 5 5 5 g / / / / / s 5 5 5 q.", +"p.6 5 5 s / / / / / g 5 5 5 5 5 5 5 5 5 5 5 5 / / / / / / 5 5 5 5 5 5 5 5 5 5 5 5 g / / / / / s 5 5 6 p.", +"p.=.f f x / / / / / K f f f f f f f f f f f f / / / / / / f f f f f f f f f f f f K / / / / / x f f =.p.", +"p.5.A A R / / / / / Q A A A A A A A A A A A A / / / / / / A A A A A A A A A A A A Q / / / / / R A A 5.p.", +"p.7 d j G U T T T Y H , + + . + + a j j J T T T T J j j a + + . + + , H Y T T T U G j d 7 p.", +"p.} : : : : : : : : : X X $ : : : ; X X % : : : : : : : : : : % X X ; : : : $ X X : : : : : : : : : } p.", +"p.p.p.p.p.p.p.p.p.p.p.#...9.p.p.p.u.@.o.0.p.p.p.p.p.p.p.p.p.p.0.o.@.u.p.p.p.9...#.p.p.p.p.p.p.p.p.p.p.p." +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_truck.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_truck.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_truck.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_truck.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,294 @@ +/* XPM */ +static const char *vclass_truck_xpm[] = { +/* columns rows colors chars-per-pixel */ +"52 32 256 2 ", +" c #504B5A", +". c #504C5A", +"X c #514C5B", +"o c #524D5C", +"O c #534E5D", +"+ c #544F5D", +"@ c #495365", +"# c #565160", +"$ c #575362", +"% c #525D6F", +"& c #585361", +"* c #5A5563", +"= c #5D5866", +"- c #5E5967", +"; c #5E5A67", +": c #5F5A68", +"> c #526A7E", +", c #625D6B", +"< c #635E6B", +"1 c #625E6C", +"2 c #645F6C", +"3 c #645F6D", +"4 c #65606E", +"5 c #66616F", +"6 c #66626F", +"7 c #676270", +"8 c #686370", +"9 c #686471", +"0 c #696572", +"q c #6A6673", +"w c #6B6774", +"e c #686775", +"r c #6C6874", +"t c #6C6875", +"y c #6D6976", +"u c #6E6A76", +"i c #6F6B77", +"p c #706B78", +"a c #706C78", +"s c #716D7A", +"d c #726E7A", +"f c #736F7B", +"g c #75717C", +"h c #267D9F", +"j c #2D7493", +"k c #2C7594", +"l c #3E7994", +"z c #4F6C81", +"x c #43758F", +"c c #597386", +"v c #5E798B", +"b c #6A7D8D", +"n c #747481", +"m c #787480", +"M c #797581", +"N c #7A7681", +"B c #7A7682", +"V c #7B7783", +"C c #7C7884", +"Z c #7E7B85", +"A c #7F7C87", +"S c #188EB5", +"D c #1B95BC", +"F c #2F85A5", +"G c #2A89AB", +"H c #288BAE", +"J c #268CB0", +"K c #0B9DCA", +"L c #129CC7", +"P c #07A1D0", +"I c #00AADC", +"U c #1FB0E2", +"Y c #52AFCE", +"T c #57ABD7", +"R c #41B7E9", +"E c #47B7E9", +"W c #46B8EA", +"Q c #4EB2E1", +"! c #5FB5E5", +"~ c #5EB6E6", +"^ c #5ABAEB", +"/ c #58BCEE", +"( c #63A1C8", +") c #61A3CB", +"_ c #62B2E0", +"` c #6AB9E6", +"' c #62BEF0", +"] c #64BEF0", +"[ c #47C1E6", +"{ c #4AC2E6", +"} c #65C4ED", +"| c #6BC1F1", +" . c #6CC1F1", +".. c #7EC9F2", +"X. c #807C87", +"o. c #83808A", +"O. c #84808B", +"+. c #86838D", +"@. c #88848F", +"#. c #8B8791", +"$. c #8B8891", +"%. c #8B8892", +"&. c #8D8A93", +"*. c #8D8A94", +"=. c #8F8C95", +"-. c #918E97", +";. c #918E98", +":. c #939099", +">. c #93909A", +",. c #91919C", +"<. c #94909A", +"1. c #95929A", +"2. c #95929B", +"3. c #96929C", +"4. c #97949D", +"5. c #98959E", +"6. c #99969F", +"7. c #9A97A0", +"8. c #9B98A1", +"9. c #9C9AA2", +"0. c #9D9AA3", +"q. c #9F9DA5", +"w. c #9CA9B8", +"e. c #A09EA5", +"r. c #A19EA6", +"t. c #A3A0A8", +"y. c #A3A1A9", +"u. c #A2A3AC", +"i. c #A5A2AA", +"p. c #A7A4AC", +"a. c #A8A5AD", +"s. c #A9A6AE", +"d. c #A4A6B0", +"f. c #ABA9B0", +"g. c #ACA9B0", +"h. c #ACAAB1", +"j. c #AEABB2", +"k. c #AFACB3", +"l. c #AFADB4", +"z. c #ADAEB6", +"x. c #AEAFB7", +"c. c #A2B0BE", +"v. c #B1AFB6", +"b. c #B2B0B6", +"n. c #B5B3B9", +"m. c #B5B3BA", +"M. c #B6B4BA", +"N. c #B7B5BB", +"B. c #B8B6BC", +"V. c #BAB8BD", +"C. c #BCBABF", +"Z. c #9BB5C2", +"A. c #9EB7CA", +"S. c #9FB8CB", +"D. c #ABB8C5", +"F. c #ACB8C5", +"G. c #BCBAC0", +"H. c #BEBCC2", +"J. c #BFBDC3", +"K. c #89CDF3", +"L. c #8ECFF4", +"P. c #95DBF0", +"I. c #9FD6F5", +"U. c #B5E0F7", +"Y. c #C0BEC3", +"T. c #C2C0C5", +"R. c #C4C3C8", +"E. c #C6C5CA", +"W. c #C8C6CB", +"Q. c #C9C8CC", +"!. c #CAC8CD", +"~. c #CBC9CE", +"^. c #CDCBCF", +"/. c #CDCBD0", +"(. c #CFCDD1", +"). c #D2D1D5", +"_. c #D6D5D8", +"`. c #D7D5D9", +"'. c #D7DADE", +"]. c #DAD9DC", +"[. c #DAD9DD", +"{. c #DBDADD", +"}. c #DCDBDE", +"|. c #C0D7E5", +" X c #DFDFE1", +".X c #CFE3ED", +"XX c #CBE9F9", +"oX c #E3E2E4", +"OX c #E4E3E5", +"+X c #E4E4E6", +"@X c #E5E5E7", +"#X c #E6E6E8", +"$X c #E9E8EA", +"%X c #EAEAEB", +"&X c #ECECED", +"*X c #EEEDEF", +"=X c #EEEEEF", +"-X c #E1F2FB", +";X c #EEF7FD", +":X c #F5F5F6", +">X c gray97", +",X c #F1F9FD", +" L 1 z.7X7X7X7X7X7X7X7X", +"7X6.d 1 , 7 d 0 , , , d u , , , y d 1 , , 9 ;.~.M , 3 d t , , y d n.D./ ^ _ _ _ ~ / ! ` K.I.U.XX-X6X7X7X", +"7X6.d 1 , 4 a 8 , , , p r , , , w a , , , 3.W.f , , 1 a q , , y d n.F.] ] ] ] ] ] ] ] ] ] ] ] ] ] L.7X7X", +"2X-.d 7 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 t.J.y 5 5 5 5 5 5 5 5 i d n.F.] ] ] ] ] ] ] ] ] ] ] ] ] ] ..7X7X", +"n.d d d d d d d d d d d d d d d d d d i.M.g d d d d d d d d d d d n.F.] ] ] ] ] ] ' W R R R R R R } 7X7X", +"$X4.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.*.%.#.#.#.#.#.#.#.#.#.#.#.;.k.c.] ] ] ] ] ] U I I I I I I I I P.7X", +"7XJ.p.p.p.p.>.m V 7.p.p.p.3.M B 5.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.w.] ] ] ] ] ] I I I I S k h P I { 7X", +"7XE.p.p.p.o. 0 < O ;.p.@.X 7 4 o *.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.p.d.A.S.S.S.S.S.Y I I j X u = @ K [ 7X", +"7X3Xr.-.=.+ 2.}.[.C - -.# *.}.{.O.* -.-.-.-.-.-.t.^.&X=X=X=X=X=X=X=X+XB.B.B.B.B.B.x.v c g.}._.q % b Y.", +"7X7XV.:.@. R.}.}.s.o &. G.}.}.b. -.:.1.e.C.+X7X7X7X7X7X7X7X7X7X7X1XT.G.G.G.G.G.u.n e X ].}.}.:.$ n m.", +"7X7X7X7X>X& 3.}.{.C d 4X; *.}.}.O.7 7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7XoX. h.}.`.q *.7X7X", +"7X7X7X7X7XM.X q 2 # ).7XY.o 9 6 + !.7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X8.X i - : @X7X7X", +"7X7X7X7X7X7X_.q.i.OX7X7X7X[.r.t. X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7XQ.9.f.*X7X7X7X", +"7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X", +"7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X", +"7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X", +"7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X", +"7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X7X" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_vip.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_vip.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/vclass_vip.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/vclass_vip.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,294 @@ +/* XPM */ +static const char *vclass_vip_xpm[] = { +/* columns rows colors chars-per-pixel */ +"52 32 256 2 ", +" c black", +". c gray1", +"X c #020305", +"o c #040505", +"O c #0D0F0F", +"+ c #131413", +"@ c #121414", +"# c #151818", +"$ c #191C1C", +"% c #1B1E1E", +"& c #101C27", +"* c #111E2A", +"= c #1C2020", +"- c #132332", +"; c #142332", +": c #152533", +"> c #192835", +", c #1A2936", +"< c #1C2A36", +"1 c #182939", +"2 c #1B2A39", +"3 c #1D2C38", +"4 c #1C2C3A", +"5 c #1F2E3A", +"6 c #1C2D3D", +"7 c #1F2F3D", +"8 c #221A07", +"9 c #252929", +"0 c #292E2E", +"q c #2C2D2E", +"w c #2C383F", +"e c #303737", +"r c #333939", +"t c #303A3F", +"y c #313D3D", +"u c #343E3C", +"i c #373E3E", +"p c #383F3F", +"a c #172F44", +"s c #1D2E45", +"d c #183045", +"f c #183146", +"g c #193247", +"h c #1E3142", +"j c #1F3243", +"k c #1F3345", +"l c #1A3348", +"z c #1B3349", +"x c #1C364B", +"c c #1D374C", +"v c #1E384D", +"b c #1E394E", +"n c #1F3B50", +"m c #203446", +"M c #223547", +"N c #253442", +"B c #2B3944", +"V c #2E3E4B", +"C c #253D50", +"Z c #263E51", +"A c #263E52", +"S c #383F40", +"D c #2E404F", +"F c #244258", +"G c #27475C", +"H c #284155", +"J c #32414D", +"K c #33444F", +"L c #3A4141", +"P c #3B4242", +"I c #3C4444", +"U c #304251", +"Y c #394956", +"T c #3F4B53", +"R c #2A4B61", +"E c #2C4E63", +"W c #2C4E64", +"Q c #384F60", +"! c #31556A", +"~ c #31556B", +"^ c #32566C", +"/ c #33586D", +"( c #395161", +") c #404848", +"_ c #414B4C", +"` c #414F5A", +"' c #46525C", +"] c #4D5758", +"[ c #455665", +"{ c #485560", +"} c #4C5860", +"| c #4C5B67", +" . c #514D64", +".. c #505E62", +"X. c #4B6779", +"o. c #486B7F", +"O. c #4D6A7C", +"+. c #546163", +"@. c #54676F", +"#. c #5B6A6D", +"$. c #64717A", +"%. c #66757F", +"&. c #6B757B", +"*. c #706A6E", +"=. c #406B81", +"-. c #416D83", +";. c #46748A", +":. c #47758B", +">. c #48778C", +",. c #4D7E94", +"<. c #4E7F95", +"1. c #51849A", +"2. c #79838C", +"3. c #7B878E", +"4. c #7D868F", +"5. c #7E888D", +"6. c #7E898F", +"7. c #7F8C98", +"8. c #6691A4", +"9. c #AD768C", +"0. c #E07DA2", +"q. c #B4A36B", +"w. c #FEAA00", +"e. c #838E93", +"r. c #848F95", +"t. c #879095", +"y. c #8E9A9D", +"u. c #90999E", +"i. c #8C98A3", +"p. c #939DA2", +"a. c #929DA7", +"s. c #959EA3", +"d. c #92A09B", +"f. c #90A09E", +"g. c #93A4A2", +"h. c #90A4A4", +"j. c #9BA4A9", +"k. c #9DA6AB", +"l. c #9DA7B0", +"z. c #9FB4B3", +"x. c #9CB1BC", +"c. c #AEA282", +"v. c #ACA886", +"b. c #A2A8AE", +"n. c #A0A9B2", +"m. c #A7AEB3", +"M. c #A4B8B7", +"N. c #A4B9B8", +"B. c #ACB6B7", +"V. c #AEB4B9", +"C. c #B4B9BE", +"Z. c #B6BFC4", +"A. c #B7C1C6", +"S. c #B1C5CF", +"D. c #BAC4C3", +"F. c #BBC5C4", +"G. c #BEC2C6", +"H. c #BFC4CA", +"J. c #BFC9CE", +"K. c #BACED6", +"L. c #C4CACF", +"P. c #C6CCD1", +"I. c #C4CED2", +"U. c #C6D1D0", +"Y. c #C2D3DA", +"T. c #CED7D6", +"R. c #CED8DC", +"E. c #CED8DD", +"W. c #D0D4D7", +"Q. c #D3DDE1", +"!. c #D8E2E6", +"~. c #DFE8EC", +"^. c #F7D5E1", +"/. c #FEEDCB", +"(. c #FEEECF", +"). c #E7E8E9", +"_. c #E7E9EA", +"`. c #E7EAEA", +"'. c #E8EBEB", +"]. c #E9ECEB", +"[. c #EAEDEC", +"{. c #EDF0EF", +"}. c #F0F1F2", +"|. c #F1F2F3", +" X c #F2F4F5", +".X c #F4F6F6", +"XX c #F5F6F7", +"oX c #F8FAFA", +"OX c #FBFCFC", +"+X c gray99", +"@X c #FEFEFD", +"#X c #FEFEFE", +"$X c gray100", +"%X c black", +"&X c black", +"*X c black", +"=X c black", +"-X c black", +";X c black", +":X c black", +">X c black", +",X c black", +".v f -.1.1.1.1.1.1.1.1.1.1.,.c z E 1.1./ x.#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X", +"#X#X#X#X#X#X#X#X#X#XOX8.1.1.1.<.l d :.1.1.1.1.1.1.1.1.1.1.1.c f ^ 1.1.=.o.oX#X#X#X#X#X#X#X#X#X#X#X#X#X#X", +"#X#X#X#X#X#X#X#X#X#XY.1.1.1.1.,.a a ;.1.1.1.1.1.1.1.1.1.1.1.l a ^ 1.1.,.W K.#X#X#X#X#X#X#X#X#X#X#X#X#X#X", +"#X#X Xi.7.7.7.7.7.7.X.~ ~ ~ ~ G a a F ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ R a a b ! ~ ~ n O.a.a.a.a.a.a.a.a.a.a.n.XX#X#X", +"#X#Xa.a a a a a a a a a a a a a a a a Q ( d a a a a a a a a a a a a a a a a a a a a a a a a a a a c.@X#X", +"#X^. .a a a a a a a a a a a a a a a a C Z a a a a a a a a a a a a a a a a a a a a a a a a a a a y w.(.#X", +"#X0.s a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a u w./.#X", +"#X9.X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X 8 w.v.{.", +"#X*. e I p r . O ) L i = + q.d.[.", +"#Xq ] B h j < _ o $ ..4 k 6 w 0 @ f.f.[.", +").# # # # # P K D 3.6.V * S # # # # # # # # # # # # # # # # # # # # # # +.h | e.$.1 t % # # # # 9 g.g.].", +"U.M.M.M.M.M.h.k r.R.E.t.; #.M.M.M.M.M.M.M.M.M.M.M.M.M.M.M.M.M.M.M.M.M.N.@.U Z.!.A.' & z.M.M.M.M.M.M.M.T.", +"'.F.D.D.D.D.B.m p.!.Q.u.: y.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.%.Y I.~.J.} J D.D.D.D.D.D.D.F.`.", +"#X#X#X#X#X#X#X[ ` s.j.T 7 |.#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#XH.M &.k.5.5 4.#X#X#X#X#X#X#X#X#X", +"#X#X#X#X#X#X#XW.N > , 2 C.#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X2.- 3 : { |.#X#X#X#X#X#X#X#X#X", +"#X#X#X#X#X#X#X#X}.V.m._.#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#XW.b.G.+X#X#X#X#X#X#X#X#X#X#X", +"#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X", +"#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X", +"#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X", +"#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X", +"#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X", +"#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X", +"#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X#X" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/warning.xpm sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/warning.xpm --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/images/warning.xpm 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/images/warning.xpm 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,31 @@ +/* XPM */ +static const char *warning_xpm[] = { +/* columns rows colors chars-per-pixel */ +"16 16 9 1 ", +" c #E1574C", +". c #E2574C", +"X c #E3574C", +"o c #E2564D", +"O c #E2574D", +"+ c #E3574D", +"@ c #E2584B", +"# c #E1584C", +"$ c None", +/* pixels */ +"$$$$$@X+oX@$$$$$", +"$$$$ @ ++oX $$$$", +"$$ +$$$$$$@ $$", +"$$ $$$$$$$$$$ $$", +"$ +$$$$ o$$$$+@$", +"@X$$$$$X@$$$$$ $", +"X $$$$$ $$$$$+X", +" X$$$$$@X$$$$$+o", +"o+$$$$$+o$$$$$+o", +"@+$$$$$$$$$$$$++", +"+@$$$$$$$$$$$$@$", +"$o@$$$$oo$$$$@ $", +"$$@$$$$$$$$$$X$$", +"$$@o@$$$$$$@ $$", +"$$$$@o+++oo@$$$$", +"$$$$$+@oo+@$$$$$" +}; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/settings/GUICompleteSchemeStorage.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/settings/GUICompleteSchemeStorage.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/settings/GUICompleteSchemeStorage.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/settings/GUICompleteSchemeStorage.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date 2006-01-09 -/// @version $Id: GUICompleteSchemeStorage.cpp 21538 2016-09-26 10:52:35Z namdre $ +/// @version $Id: GUICompleteSchemeStorage.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Storage for available visualization settings /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static variable definitions @@ -209,7 +205,7 @@ void -GUICompleteSchemeStorage::saveViewport(const SUMOReal x, const SUMOReal y, const SUMOReal z) { +GUICompleteSchemeStorage::saveViewport(const double x, const double y, const double z) { myLookFrom.set(x, y, z); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/settings/GUICompleteSchemeStorage.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/settings/GUICompleteSchemeStorage.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/settings/GUICompleteSchemeStorage.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/settings/GUICompleteSchemeStorage.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date :find(mySortedSchemeNames.begin(), mySortedSchemeNames.end(), name)==mySortedSchemeNames.end()) { -/// @version $Id: GUICompleteSchemeStorage.h 21186 2016-07-18 12:04:16Z namdre $ +/// @version $Id: GUICompleteSchemeStorage.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Storage for available visualization settings /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -122,7 +122,7 @@ * @param[in] y The y-offset * @param[in] z The camera height */ - void saveViewport(const SUMOReal x, const SUMOReal y, const SUMOReal z); + void saveViewport(const double x, const double y, const double z); /** @brief Sets the default viewport diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/settings/GUIPropertyScheme.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/settings/GUIPropertyScheme.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/settings/GUIPropertyScheme.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/settings/GUIPropertyScheme.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Mon, 20.07.2009 -/// @version $Id: GUIPropertyScheme.h 21316 2016-08-22 13:08:50Z behrisch $ +/// @version $Id: GUIPropertyScheme.h 23150 2017-02-27 12:08:30Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -53,14 +53,14 @@ public: /// Constructor GUIPropertyScheme(const std::string& name, const T& baseColor, - const std::string& colName = "", const bool isFixed = false, SUMOReal baseValue = 0) : + const std::string& colName = "", const bool isFixed = false, double baseValue = 0) : myName(name), myIsInterpolated(!isFixed), myIsFixed(isFixed), myAllowNegativeValues(false) { addColor(baseColor, baseValue, colName); } - void setThreshold(const int pos, const SUMOReal threshold) { + void setThreshold(const int pos, const double threshold) { myThresholds[pos] = threshold; } @@ -80,9 +80,9 @@ return false; } - int addColor(const T& color, const SUMOReal threshold, const std::string& name = "") { + int addColor(const T& color, const double threshold, const std::string& name = "") { typename std::vector::iterator colIt = myColors.begin(); - std::vector::iterator threshIt = myThresholds.begin(); + std::vector::iterator threshIt = myThresholds.begin(); std::vector::iterator nameIt = myNames.begin(); int pos = 0; while (threshIt != myThresholds.end() && (*threshIt) < threshold) { @@ -110,12 +110,12 @@ myNames.clear(); } - const T getColor(const SUMOReal value) const { + const T getColor(const double value) const { if (myColors.size() == 1 || value < myThresholds.front()) { return myColors.front(); } typename std::vector::const_iterator colIt = myColors.begin() + 1; - std::vector::const_iterator threshIt = myThresholds.begin() + 1; + std::vector::const_iterator threshIt = myThresholds.begin() + 1; while (threshIt != myThresholds.end() && (*threshIt) <= value) { ++threshIt; ++colIt; @@ -126,11 +126,11 @@ if (!myIsInterpolated) { return *(colIt - 1); } - SUMOReal lowVal = *(threshIt - 1); + double lowVal = *(threshIt - 1); return interpolate(*(colIt - 1), *colIt, (value - lowVal) / ((*threshIt) - lowVal)); } - void setInterpolated(const bool interpolate, SUMOReal interpolationStart = 0.f) { + void setInterpolated(const bool interpolate, double interpolationStart = 0.f) { myIsInterpolated = interpolate; if (interpolate) { myThresholds[0] = interpolationStart; @@ -145,7 +145,7 @@ return myColors; } - const std::vector& getThresholds() const { + const std::vector& getThresholds() const { return myThresholds; } @@ -178,7 +178,7 @@ dev.writeAttr(SUMO_ATTR_INTERPOLATED, myIsInterpolated); } typename std::vector::const_iterator colIt = myColors.begin(); - std::vector::const_iterator threshIt = myThresholds.begin(); + std::vector::const_iterator threshIt = myThresholds.begin(); std::vector::const_iterator nameIt = myNames.begin(); while (threshIt != myThresholds.end()) { dev.openTag(SUMO_TAG_ENTRY); @@ -203,7 +203,7 @@ /// @brief specializations for GUIColorScheme - RGBColor interpolate(const RGBColor& min, const RGBColor& max, SUMOReal weight) const { + RGBColor interpolate(const RGBColor& min, const RGBColor& max, double weight) const { return RGBColor::interpolate(min, max, weight); } @@ -213,11 +213,11 @@ /// @brief specializations for GUIScaleScheme - SUMOReal interpolate(const SUMOReal& min, const SUMOReal& max, SUMOReal weight) const { + double interpolate(const double& min, const double& max, double weight) const { return min + (max - min) * weight; } - std::string getTagName(std::vector) const { + std::string getTagName(std::vector) const { return toString(SUMO_TAG_SCALINGSCHEME); } @@ -225,7 +225,7 @@ private: std::string myName; std::vector myColors; - std::vector myThresholds; + std::vector myThresholds; bool myIsInterpolated; std::vector myNames; bool myIsFixed; @@ -234,7 +234,7 @@ }; typedef GUIPropertyScheme GUIColorScheme; -typedef GUIPropertyScheme GUIScaleScheme; +typedef GUIPropertyScheme GUIScaleScheme; #endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/settings/GUIPropertySchemeStorage.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/settings/GUIPropertySchemeStorage.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/settings/GUIPropertySchemeStorage.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/settings/GUIPropertySchemeStorage.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Laura Bieker /// @date Mon, 20.07.2009 -/// @version $Id: GUIPropertySchemeStorage.h 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: GUIPropertySchemeStorage.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/settings/GUISettingsHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/settings/GUISettingsHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/settings/GUISettingsHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/settings/GUISettingsHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Laura Bieker /// @date Fri, 24. Apr 2009 -/// @version $Id: GUISettingsHandler.cpp 21625 2016-10-06 12:18:47Z namdre $ +/// @version $Id: GUISettingsHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The dialog to change the view (gui) settings. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,10 +45,6 @@ #include #include "GUISettingsHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -86,16 +82,16 @@ std::transform(myViewType.begin(), myViewType.end(), myViewType.begin(), tolower); break; case SUMO_TAG_DELAY: - myDelay = attrs.getOpt(SUMO_ATTR_VALUE, 0, ok, myDelay); + myDelay = attrs.getOpt(SUMO_ATTR_VALUE, 0, ok, myDelay); break; case SUMO_TAG_VIEWPORT: { - const SUMOReal x = attrs.getOpt(SUMO_ATTR_X, 0, ok, myLookFrom.x()); - const SUMOReal y = attrs.getOpt(SUMO_ATTR_Y, 0, ok, myLookFrom.y()); - const SUMOReal z = attrs.getOpt(SUMO_ATTR_ZOOM, 0, ok, myLookFrom.z()); + const double x = attrs.getOpt(SUMO_ATTR_X, 0, ok, myLookFrom.x()); + const double y = attrs.getOpt(SUMO_ATTR_Y, 0, ok, myLookFrom.y()); + const double z = attrs.getOpt(SUMO_ATTR_ZOOM, 0, ok, myLookFrom.z()); myLookFrom.set(x, y, z); - const SUMOReal cx = attrs.getOpt(SUMO_ATTR_CENTER_X, 0, ok, myLookAt.x()); - const SUMOReal cy = attrs.getOpt(SUMO_ATTR_CENTER_Y, 0, ok, myLookAt.y()); - const SUMOReal cz = attrs.getOpt(SUMO_ATTR_CENTER_Z, 0, ok, myLookAt.z()); + const double cx = attrs.getOpt(SUMO_ATTR_CENTER_X, 0, ok, myLookAt.x()); + const double cy = attrs.getOpt(SUMO_ATTR_CENTER_Y, 0, ok, myLookAt.y()); + const double cz = attrs.getOpt(SUMO_ATTR_CENTER_Z, 0, ok, myLookAt.z()); myLookAt.set(cx, cy, cz); break; } @@ -124,8 +120,8 @@ bool ok = true; mySettings.backgroundColor = RGBColor::parseColorReporting(attrs.getStringSecure("backgroundColor", toString(mySettings.backgroundColor)), "background", 0, true, ok); mySettings.showGrid = TplConvert::_2bool(attrs.getStringSecure("showGrid", toString(mySettings.showGrid)).c_str()); - mySettings.gridXSize = TplConvert::_2SUMOReal(attrs.getStringSecure("gridXSize", toString(mySettings.gridXSize)).c_str()); - mySettings.gridYSize = TplConvert::_2SUMOReal(attrs.getStringSecure("gridYSize", toString(mySettings.gridYSize)).c_str()); + mySettings.gridXSize = TplConvert::_2double(attrs.getStringSecure("gridXSize", toString(mySettings.gridXSize)).c_str()); + mySettings.gridYSize = TplConvert::_2double(attrs.getStringSecure("gridYSize", toString(mySettings.gridYSize)).c_str()); } break; case SUMO_TAG_VIEWSETTINGS_EDGES: { @@ -140,8 +136,8 @@ mySettings.cwaEdgeName = parseTextSettings("cwaEdgeName", attrs, mySettings.cwaEdgeName); mySettings.streetName = parseTextSettings("streetName", attrs, mySettings.streetName); mySettings.hideConnectors = TplConvert::_2bool(attrs.getStringSecure("hideConnectors", toString(mySettings.hideConnectors)).c_str()); - mySettings.laneWidthExaggeration = TplConvert::_2SUMOReal(attrs.getStringSecure("widthExaggeration", toString(mySettings.laneWidthExaggeration)).c_str()); - mySettings.laneMinSize = TplConvert::_2SUMOReal(attrs.getStringSecure("minSize", toString(mySettings.laneWidthExaggeration)).c_str()); + mySettings.laneWidthExaggeration = TplConvert::_2double(attrs.getStringSecure("widthExaggeration", toString(mySettings.laneWidthExaggeration)).c_str()); + mySettings.laneMinSize = TplConvert::_2double(attrs.getStringSecure("minSize", toString(mySettings.laneWidthExaggeration)).c_str()); mySettings.showLaneDirection = TplConvert::_2bool(attrs.getStringSecure("showDirection", toString(mySettings.showLaneDirection)).c_str()); mySettings.showSublanes = TplConvert::_2bool(attrs.getStringSecure("showSublanes", toString(mySettings.showSublanes)).c_str()); myCurrentColorer = element; @@ -198,15 +194,15 @@ if (myCurrentScheme->isFixed()) { myCurrentScheme->setColor(attrs.getStringSecure(SUMO_ATTR_NAME, ""), color); } else { - myCurrentScheme->addColor(color, attrs.getOpt(SUMO_ATTR_THRESHOLD, 0, ok, 0)); + myCurrentScheme->addColor(color, attrs.getOpt(SUMO_ATTR_THRESHOLD, 0, ok, 0)); } } else if (myCurrentScaleScheme != 0) { bool ok = true; - SUMOReal scale = attrs.get(SUMO_ATTR_COLOR, 0, ok); + double scale = attrs.get(SUMO_ATTR_COLOR, 0, ok); if (myCurrentScaleScheme->isFixed()) { myCurrentScaleScheme->setColor(attrs.getStringSecure(SUMO_ATTR_NAME, ""), scale); } else { - myCurrentScaleScheme->addColor(scale, attrs.getOpt(SUMO_ATTR_THRESHOLD, 0, ok, 0)); + myCurrentScaleScheme->addColor(scale, attrs.getOpt(SUMO_ATTR_THRESHOLD, 0, ok, 0)); } } break; @@ -267,16 +263,16 @@ if (d.filename != "" && !FileHelpers::isAbsolute(d.filename)) { d.filename = FileHelpers::getConfigurationRelative(getFileName(), d.filename); } - d.centerX = attrs.getOpt(SUMO_ATTR_CENTER_X, 0, ok, d.centerX); - d.centerY = attrs.getOpt(SUMO_ATTR_CENTER_Y, 0, ok, d.centerY); - d.centerZ = attrs.getOpt(SUMO_ATTR_CENTER_Z, 0, ok, d.centerZ); - d.width = attrs.getOpt(SUMO_ATTR_WIDTH, 0, ok, d.width); - d.height = attrs.getOpt(SUMO_ATTR_HEIGHT, 0, ok, d.height); - d.altitude = TplConvert::_2SUMOReal(attrs.getStringSecure("altitude", toString(d.height)).c_str()); - d.rot = TplConvert::_2SUMOReal(attrs.getStringSecure("rotation", toString(d.rot)).c_str()); - d.tilt = TplConvert::_2SUMOReal(attrs.getStringSecure("tilt", toString(d.tilt)).c_str()); - d.roll = TplConvert::_2SUMOReal(attrs.getStringSecure("roll", toString(d.roll)).c_str()); - d.layer = attrs.getOpt(SUMO_ATTR_LAYER, 0, ok, d.layer); + d.centerX = attrs.getOpt(SUMO_ATTR_CENTER_X, 0, ok, d.centerX); + d.centerY = attrs.getOpt(SUMO_ATTR_CENTER_Y, 0, ok, d.centerY); + d.centerZ = attrs.getOpt(SUMO_ATTR_CENTER_Z, 0, ok, d.centerZ); + d.width = attrs.getOpt(SUMO_ATTR_WIDTH, 0, ok, d.width); + d.height = attrs.getOpt(SUMO_ATTR_HEIGHT, 0, ok, d.height); + d.altitude = TplConvert::_2double(attrs.getStringSecure("altitude", toString(d.height)).c_str()); + d.rot = TplConvert::_2double(attrs.getStringSecure("rotation", toString(d.rot)).c_str()); + d.tilt = TplConvert::_2double(attrs.getStringSecure("tilt", toString(d.tilt)).c_str()); + d.roll = TplConvert::_2double(attrs.getStringSecure("roll", toString(d.roll)).c_str()); + d.layer = attrs.getOpt(SUMO_ATTR_LAYER, 0, ok, d.layer); d.screenRelative = TplConvert::_2bool(attrs.getStringSecure("screenRelative", toString(d.screenRelative)).c_str()); d.initialised = false; myDecals.push_back(d); @@ -285,16 +281,16 @@ case SUMO_TAG_VIEWSETTINGS_LIGHT: { GUISUMOAbstractView::Decal d; d.filename = "light" + attrs.getOpt(SUMO_ATTR_INDEX, 0, ok, "0"); - d.centerX = attrs.getOpt(SUMO_ATTR_CENTER_X, 0, ok, d.centerX); - d.centerY = attrs.getOpt(SUMO_ATTR_CENTER_Y, 0, ok, d.centerY); - d.centerZ = attrs.getOpt(SUMO_ATTR_CENTER_Z, 0, ok, d.centerZ); - d.width = attrs.getOpt(SUMO_ATTR_WIDTH, 0, ok, d.width); - d.height = attrs.getOpt(SUMO_ATTR_HEIGHT, 0, ok, d.height); - d.altitude = TplConvert::_2SUMOReal(attrs.getStringSecure("altitude", toString(d.height)).c_str()); - d.rot = TplConvert::_2SUMOReal(attrs.getStringSecure("rotation", toString(d.rot)).c_str()); - d.tilt = TplConvert::_2SUMOReal(attrs.getStringSecure("tilt", toString(d.tilt)).c_str()); - d.roll = TplConvert::_2SUMOReal(attrs.getStringSecure("roll", toString(d.roll)).c_str()); - d.layer = attrs.getOpt(SUMO_ATTR_LAYER, 0, ok, d.layer); + d.centerX = attrs.getOpt(SUMO_ATTR_CENTER_X, 0, ok, d.centerX); + d.centerY = attrs.getOpt(SUMO_ATTR_CENTER_Y, 0, ok, d.centerY); + d.centerZ = attrs.getOpt(SUMO_ATTR_CENTER_Z, 0, ok, d.centerZ); + d.width = attrs.getOpt(SUMO_ATTR_WIDTH, 0, ok, d.width); + d.height = attrs.getOpt(SUMO_ATTR_HEIGHT, 0, ok, d.height); + d.altitude = TplConvert::_2double(attrs.getStringSecure("altitude", toString(d.height)).c_str()); + d.rot = TplConvert::_2double(attrs.getStringSecure("rotation", toString(d.rot)).c_str()); + d.tilt = TplConvert::_2double(attrs.getStringSecure("tilt", toString(d.tilt)).c_str()); + d.roll = TplConvert::_2double(attrs.getStringSecure("roll", toString(d.roll)).c_str()); + d.layer = attrs.getOpt(SUMO_ATTR_LAYER, 0, ok, d.layer); d.initialised = false; myDecals.push_back(d); } @@ -302,12 +298,12 @@ case SUMO_TAG_VIEWSETTINGS_EVENT: { const std::string id = attrs.get(SUMO_ATTR_ID, 0, ok); const std::string cmd = attrs.get(SUMO_ATTR_COMMAND, 0, ok); - const SUMOReal prob = attrs.get(SUMO_ATTR_PROB, id.c_str(), ok); - myEventDistributions[id].add(prob, cmd); + const double prob = attrs.get(SUMO_ATTR_PROB, id.c_str(), ok); + myEventDistributions[id].add(cmd, prob); } break; case SUMO_TAG_VIEWSETTINGS_EVENT_JAM_TIME: - myJamSoundTime = attrs.get(SUMO_ATTR_VALUE, 0, ok); + myJamSoundTime = attrs.get(SUMO_ATTR_VALUE, 0, ok); break; default: break; @@ -322,7 +318,7 @@ bool ok = true; return GUIVisualizationTextSettings( TplConvert::_2bool(attrs.getStringSecure(prefix + "_show", toString(defaults.show)).c_str()), - TplConvert::_2SUMOReal(attrs.getStringSecure(prefix + "_size", toString(defaults.size)).c_str()), + TplConvert::_2double(attrs.getStringSecure(prefix + "_size", toString(defaults.size)).c_str()), RGBColor::parseColorReporting(attrs.getStringSecure(prefix + "_color", toString(defaults.color)), "edges", 0, true, ok)); } @@ -332,8 +328,8 @@ const std::string& prefix, const SUMOSAXAttributes& attrs, GUIVisualizationSizeSettings defaults) { return GUIVisualizationSizeSettings( - TplConvert::_2SUMOReal(attrs.getStringSecure(prefix + "_minSize", toString(defaults.minSize)).c_str()), - TplConvert::_2SUMOReal(attrs.getStringSecure(prefix + "_exaggeration", toString(defaults.exaggeration)).c_str()), + TplConvert::_2double(attrs.getStringSecure(prefix + "_minSize", toString(defaults.minSize)).c_str()), + TplConvert::_2double(attrs.getStringSecure(prefix + "_exaggeration", toString(defaults.exaggeration)).c_str()), TplConvert::_2bool(attrs.getStringSecure(prefix + "_constantSize", toString(defaults.constantSize)).c_str())); } @@ -382,7 +378,7 @@ } -SUMOReal +double GUISettingsHandler::getDelay() const { return myDelay; } @@ -416,7 +412,7 @@ RandomDistributor result = myEventDistributions[id]; if (result.getOverallProb() > 0 && result.getOverallProb() < 1) { // unscaled probabilities are assumed, fill up with dummy event - result.add(1 - result.getOverallProb(), ""); + result.add("", 1. - result.getOverallProb()); } return result; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/settings/GUISettingsHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/settings/GUISettingsHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/settings/GUISettingsHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/settings/GUISettingsHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Fri, 24. Apr 2009 -/// @version $Id: GUISettingsHandler.h 21186 2016-07-18 12:04:16Z namdre $ +/// @version $Id: GUISettingsHandler.h 23341 2017-03-13 10:11:12Z behrisch $ /// // The handler for parsing gui settings from xml. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,7 +33,7 @@ #endif #include -#include +#include // =========================================================================== @@ -110,7 +110,7 @@ /** @brief Returns the parsed delay * @return the parsed delay */ - SUMOReal getDelay() const; + double getDelay() const; /** @brief Returns the parsed breakpoints @@ -133,7 +133,7 @@ } RandomDistributor getEventDistribution(const std::string& id); - SUMOReal getJamSoundTime() { + double getJamSoundTime() { return myJamSoundTime; } @@ -145,7 +145,7 @@ std::string myViewType; /// @brief The delay loaded - SUMOReal myDelay; + double myDelay; /// @brief The viewport loaded, zoom is stored in z coordinate Position myLookFrom; @@ -173,7 +173,7 @@ /// @brief The parsed event distributions std::map > myEventDistributions; - SUMOReal myJamSoundTime; + double myJamSoundTime; private: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/settings/GUIVisualizationSettings.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/settings/GUIVisualizationSettings.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/settings/GUIVisualizationSettings.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/settings/GUIVisualizationSettings.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIVisualizationSettings.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUIVisualizationSettings.cpp 23860 2017-04-07 08:28:45Z namdre $ /// // Stores the information about how to visualize structures /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,15 +35,31 @@ #include "GUIVisualizationSettings.h" #include "GUIPropertyScheme.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members // =========================================================================== bool GUIVisualizationSettings::UseMesoSim = false; +/* ------------------------------------------------------------------------- + * color constants for link states + * ----------------------------------------------------------------------- */ +const RGBColor SUMO_color_TL_GREEN_MAJOR(0, 255, 0); +const RGBColor SUMO_color_TL_GREEN_MINOR(0, 179, 0); +const RGBColor SUMO_color_TL_RED(255, 0, 0); +const RGBColor SUMO_color_TL_REDYELLOW(255, 128, 0); +const RGBColor SUMO_color_TL_YELLOW_MAJOR(255, 255, 0); +const RGBColor SUMO_color_TL_YELLOW_MINOR(255, 255, 0); +const RGBColor SUMO_color_TL_OFF_BLINKING(128, 64, 0); +const RGBColor SUMO_color_TL_OFF_NOSIGNAL(0, 255, 255); +const RGBColor SUMO_color_MAJOR(255, 255, 255); +const RGBColor SUMO_color_MINOR(51, 51, 51); +const RGBColor SUMO_color_EQUAL(128, 128, 128); +const RGBColor SUMO_color_STOP(128, 0, 128); +const RGBColor SUMO_color_ALLWAY_STOP(0, 0, 192); +const RGBColor SUMO_color_ZIPPER(192, 128, 64); +const RGBColor SUMO_color_DEADEND(0, 0, 0); + + // =========================================================================== // member method definitions // =========================================================================== @@ -104,146 +120,146 @@ scheme.addColor(RGBColor(0, 80, 180, 255), 1, "selected"); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by permission code", RGBColor(240, 240, 240), "nobody"); - scheme.addColor(RGBColor(10, 10, 10), (SUMOReal)SVC_PASSENGER, "passenger"); - scheme.addColor(RGBColor(128, 128, 128), (SUMOReal)SVC_PEDESTRIAN, "pedestrian"); - scheme.addColor(RGBColor(80, 80, 80), (SUMOReal)(SVC_PEDESTRIAN | SVC_DELIVERY), "pedestrian_delivery"); - scheme.addColor(RGBColor(192, 66, 44), (SUMOReal)SVC_BICYCLE, "bicycle"); - scheme.addColor(RGBColor(40, 100, 40), (SUMOReal)SVC_BUS, "bus"); - scheme.addColor(RGBColor(166, 147, 26), (SUMOReal)SVC_TAXI, "taxi"); - scheme.addColor(RGBColor::BLACK, (SUMOReal)(SVCAll & ~SVC_NON_ROAD), "normal_road"); - scheme.addColor(RGBColor::BLACK, (SUMOReal)(SVCAll & ~(SVC_PEDESTRIAN | SVC_NON_ROAD)), "disallow_pedestrian"); - scheme.addColor(RGBColor(255, 206, 0), (SUMOReal)(SVCAll & ~(SVC_PEDESTRIAN | SVC_BICYCLE | SVC_MOPED | SVC_NON_ROAD)), "motorway"); - scheme.addColor(RGBColor(150, 200, 200), (SUMOReal)SVC_SHIP, "waterway"); - scheme.addColor(RGBColor::GREEN, (SUMOReal)SVCAll, "all"); + scheme.addColor(RGBColor(10, 10, 10), (double)SVC_PASSENGER, "passenger"); + scheme.addColor(RGBColor(128, 128, 128), (double)SVC_PEDESTRIAN, "pedestrian"); + scheme.addColor(RGBColor(80, 80, 80), (double)(SVC_PEDESTRIAN | SVC_DELIVERY), "pedestrian_delivery"); + scheme.addColor(RGBColor(192, 66, 44), (double)SVC_BICYCLE, "bicycle"); + scheme.addColor(RGBColor(40, 100, 40), (double)SVC_BUS, "bus"); + scheme.addColor(RGBColor(166, 147, 26), (double)SVC_TAXI, "taxi"); + scheme.addColor(RGBColor::BLACK, (double)(SVCAll & ~SVC_NON_ROAD), "normal_road"); + scheme.addColor(RGBColor::BLACK, (double)(SVCAll & ~(SVC_PEDESTRIAN | SVC_NON_ROAD)), "disallow_pedestrian"); + scheme.addColor(RGBColor(255, 206, 0), (double)(SVCAll & ~(SVC_PEDESTRIAN | SVC_BICYCLE | SVC_MOPED | SVC_NON_ROAD)), "motorway"); + scheme.addColor(RGBColor(150, 200, 200), (double)SVC_SHIP, "waterway"); + scheme.addColor(RGBColor::GREEN, (double)SVCAll, "all"); laneColorer.addScheme(scheme); // ... traffic states ... scheme = GUIColorScheme("by allowed speed (lanewise)", RGBColor::RED); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)(30 / 3.6)); - scheme.addColor(RGBColor::GREEN, (SUMOReal)(55 / 3.6)); - scheme.addColor(RGBColor::CYAN, (SUMOReal)(80 / 3.6)); - scheme.addColor(RGBColor::BLUE, (SUMOReal)(120 / 3.6)); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)(150 / 3.6)); + scheme.addColor(RGBColor::YELLOW, (double)(30 / 3.6)); + scheme.addColor(RGBColor::GREEN, (double)(55 / 3.6)); + scheme.addColor(RGBColor::CYAN, (double)(80 / 3.6)); + scheme.addColor(RGBColor::BLUE, (double)(120 / 3.6)); + scheme.addColor(RGBColor::MAGENTA, (double)(150 / 3.6)); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by current occupancy (lanewise, brutto)", RGBColor::BLUE); - scheme.addColor(RGBColor::RED, (SUMOReal)0.95); + scheme.addColor(RGBColor::RED, 0.95); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by current occupancy (lanewise, netto)", RGBColor::BLUE); - scheme.addColor(RGBColor::RED, (SUMOReal)0.95); + scheme.addColor(RGBColor::RED, 0.95); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by first vehicle waiting time (lanewise)", RGBColor::BLUE); - scheme.addColor(RGBColor::CYAN, (SUMOReal)30); - scheme.addColor(RGBColor::GREEN, (SUMOReal)100); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)200); - scheme.addColor(RGBColor::RED, (SUMOReal)300); + scheme.addColor(RGBColor::CYAN, (double)30); + scheme.addColor(RGBColor::GREEN, (double)100); + scheme.addColor(RGBColor::YELLOW, (double)200); + scheme.addColor(RGBColor::RED, (double)300); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by lane number (streetwise)", RGBColor::RED); - scheme.addColor(RGBColor::BLUE, (SUMOReal)5); + scheme.addColor(RGBColor::BLUE, (double)5); laneColorer.addScheme(scheme); // ... emissions ... scheme = GUIColorScheme("by CO2 emissions", RGBColor::GREEN); - scheme.addColor(RGBColor::RED, (SUMOReal)(10. / 7.5 / 5.)); + scheme.addColor(RGBColor::RED, (double)(10. / 7.5 / 5.)); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by CO emissions", RGBColor::GREEN); - scheme.addColor(RGBColor::RED, (SUMOReal)(0.05 / 7.5 / 2.)); + scheme.addColor(RGBColor::RED, (double)(0.05 / 7.5 / 2.)); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by PMx emissions", RGBColor::GREEN); - scheme.addColor(RGBColor::RED, (SUMOReal)(.005 / 7.5 / 5.)); + scheme.addColor(RGBColor::RED, (double)(.005 / 7.5 / 5.)); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by NOx emissions", RGBColor::GREEN); - scheme.addColor(RGBColor::RED, (SUMOReal)(.125 / 7.5 / 5.)); + scheme.addColor(RGBColor::RED, (double)(.125 / 7.5 / 5.)); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by HC emissions", RGBColor::GREEN); - scheme.addColor(RGBColor::RED, (SUMOReal)(.02 / 7.5 / 4.)); + scheme.addColor(RGBColor::RED, (double)(.02 / 7.5 / 4.)); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by fuel consumption", RGBColor::GREEN); - scheme.addColor(RGBColor::RED, (SUMOReal)(.005 / 7.5 * 100.)); + scheme.addColor(RGBColor::RED, (double)(.005 / 7.5 * 100.)); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by noise emissions (Harmonoise)", RGBColor::GREEN); - scheme.addColor(RGBColor::RED, (SUMOReal)100); + scheme.addColor(RGBColor::RED, (double)100); laneColorer.addScheme(scheme); // ... weights (experimental) ... scheme = GUIColorScheme("by global travel time", RGBColor::GREEN); - scheme.addColor(RGBColor::RED, (SUMOReal)100); + scheme.addColor(RGBColor::RED, (double)100); scheme.setAllowsNegativeValues(true); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by global speed percentage", RGBColor::RED); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)50); - scheme.addColor(RGBColor::GREEN, (SUMOReal)100); + scheme.addColor(RGBColor::YELLOW, (double)50); + scheme.addColor(RGBColor::GREEN, (double)100); scheme.setAllowsNegativeValues(true); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by given length/geometrical length", RGBColor::BLACK); - scheme.addColor(RGBColor::RED, (SUMOReal)0.25); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)0.5); - scheme.addColor(RGBColor(179, 179, 179, 255), (SUMOReal)1.0); - scheme.addColor(RGBColor::GREEN, (SUMOReal)2.0); - scheme.addColor(RGBColor::BLUE, (SUMOReal)4.0); + scheme.addColor(RGBColor::RED, 0.25); + scheme.addColor(RGBColor::YELLOW, 0.5); + scheme.addColor(RGBColor(179, 179, 179, 255), (double)1.0); + scheme.addColor(RGBColor::GREEN, (double)2.0); + scheme.addColor(RGBColor::BLUE, (double)4.0); laneColorer.addScheme(scheme); laneColorer.addScheme(GUIColorScheme("by angle", RGBColor::YELLOW, "", true)); scheme = GUIColorScheme("by loaded weight", RGBColor::GREEN); - scheme.addColor(RGBColor::RED, (SUMOReal)100); + scheme.addColor(RGBColor::RED, (double)100); scheme.setAllowsNegativeValues(true); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by priority", RGBColor::YELLOW); - scheme.addColor(RGBColor::RED, (SUMOReal) - 20); - scheme.addColor(RGBColor::GREEN, (SUMOReal)20); + scheme.addColor(RGBColor::RED, (double) - 20); + scheme.addColor(RGBColor::GREEN, (double)20); scheme.setAllowsNegativeValues(true); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by height at start", RGBColor::RED); - scheme.addColor(RGBColor::BLUE, (SUMOReal) - 10); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)50); - scheme.addColor(RGBColor::GREEN, (SUMOReal)100); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)200); + scheme.addColor(RGBColor::BLUE, (double) - 10); + scheme.addColor(RGBColor::YELLOW, (double)50); + scheme.addColor(RGBColor::GREEN, (double)100); + scheme.addColor(RGBColor::MAGENTA, (double)200); scheme.setAllowsNegativeValues(true); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by height at geometry-segment start", RGBColor::RED); - scheme.addColor(RGBColor::BLUE, (SUMOReal) - 10); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)50); - scheme.addColor(RGBColor::GREEN, (SUMOReal)100); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)200); + scheme.addColor(RGBColor::BLUE, (double) - 10); + scheme.addColor(RGBColor::YELLOW, (double)50); + scheme.addColor(RGBColor::GREEN, (double)100); + scheme.addColor(RGBColor::MAGENTA, (double)200); scheme.setAllowsNegativeValues(true); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by inclination", RGBColor::GREY); - scheme.addColor(RGBColor::YELLOW, (SUMOReal) .1); - scheme.addColor(RGBColor::RED, (SUMOReal) .3); - scheme.addColor(RGBColor::GREEN, (SUMOReal) - .1); - scheme.addColor(RGBColor::BLUE, (SUMOReal) - .3); + scheme.addColor(RGBColor::YELLOW, (double) .1); + scheme.addColor(RGBColor::RED, (double) .3); + scheme.addColor(RGBColor::GREEN, (double) - .1); + scheme.addColor(RGBColor::BLUE, (double) - .3); scheme.setAllowsNegativeValues(true); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by geometry-segment inclination", RGBColor::GREY); - scheme.addColor(RGBColor::YELLOW, (SUMOReal) .1); - scheme.addColor(RGBColor::RED, (SUMOReal) .3); - scheme.addColor(RGBColor::GREEN, (SUMOReal) - .1); - scheme.addColor(RGBColor::BLUE, (SUMOReal) - .3); + scheme.addColor(RGBColor::YELLOW, (double) .1); + scheme.addColor(RGBColor::RED, (double) .3); + scheme.addColor(RGBColor::GREEN, (double) - .1); + scheme.addColor(RGBColor::BLUE, (double) - .3); scheme.setAllowsNegativeValues(true); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by average speed", RGBColor::RED); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)(30 / 3.6)); - scheme.addColor(RGBColor::GREEN, (SUMOReal)(55 / 3.6)); - scheme.addColor(RGBColor::CYAN, (SUMOReal)(80 / 3.6)); - scheme.addColor(RGBColor::BLUE, (SUMOReal)(120 / 3.6)); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)(150 / 3.6)); + scheme.addColor(RGBColor::YELLOW, (double)(30 / 3.6)); + scheme.addColor(RGBColor::GREEN, (double)(55 / 3.6)); + scheme.addColor(RGBColor::CYAN, (double)(80 / 3.6)); + scheme.addColor(RGBColor::BLUE, (double)(120 / 3.6)); + scheme.addColor(RGBColor::MAGENTA, (double)(150 / 3.6)); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by average relative speed ", RGBColor::RED); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)(0.25)); - scheme.addColor(RGBColor::GREEN, (SUMOReal)(0.5)); - scheme.addColor(RGBColor::CYAN, (SUMOReal)(0.75)); - scheme.addColor(RGBColor::BLUE, (SUMOReal)(1)); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)(1.25)); + scheme.addColor(RGBColor::YELLOW, (double)(0.25)); + scheme.addColor(RGBColor::GREEN, (double)(0.5)); + scheme.addColor(RGBColor::CYAN, (double)(0.75)); + scheme.addColor(RGBColor::BLUE, (double)(1)); + scheme.addColor(RGBColor::MAGENTA, (double)(1.25)); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by routing device assumed speed ", RGBColor::RED); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)(30 / 3.6)); - scheme.addColor(RGBColor::GREEN, (SUMOReal)(55 / 3.6)); - scheme.addColor(RGBColor::CYAN, (SUMOReal)(80 / 3.6)); - scheme.addColor(RGBColor::BLUE, (SUMOReal)(120 / 3.6)); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)(150 / 3.6)); + scheme.addColor(RGBColor::YELLOW, (double)(30 / 3.6)); + scheme.addColor(RGBColor::GREEN, (double)(55 / 3.6)); + scheme.addColor(RGBColor::CYAN, (double)(80 / 3.6)); + scheme.addColor(RGBColor::BLUE, (double)(120 / 3.6)); + scheme.addColor(RGBColor::MAGENTA, (double)(150 / 3.6)); laneColorer.addScheme(scheme); scheme = GUIColorScheme("by electricity consumption", RGBColor::GREEN); - scheme.addColor(RGBColor::RED, (SUMOReal)(1 / 7.5 / 5.)); + scheme.addColor(RGBColor::RED, (double)(1 / 7.5 / 5.)); laneColorer.addScheme(scheme); - scheme = GUIColorScheme("by insertion-backlog (streetwise)", RGBColor::GREY); - scheme.addColor(RGBColor::GREEN, (SUMOReal)1); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)10); - scheme.addColor(RGBColor::RED, (SUMOReal)100); + scheme = GUIColorScheme("by insertion-backlog (streetwise)", RGBColor(204, 204, 204)); + scheme.addColor(RGBColor::GREEN, (double)1); + scheme.addColor(RGBColor::YELLOW, (double)10); + scheme.addColor(RGBColor::RED, (double)100); laneColorer.addScheme(scheme); @@ -257,23 +273,23 @@ vehicleColorer.addScheme(GUIColorScheme("arrival position as HSV", RGBColor::YELLOW, "", true)); vehicleColorer.addScheme(GUIColorScheme("direction/distance as HSV", RGBColor::YELLOW, "", true)); scheme = GUIColorScheme("by speed", RGBColor::RED); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)(30 / 3.6)); - scheme.addColor(RGBColor::GREEN, (SUMOReal)(55 / 3.6)); - scheme.addColor(RGBColor::CYAN, (SUMOReal)(80 / 3.6)); - scheme.addColor(RGBColor::BLUE, (SUMOReal)(120 / 3.6)); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)(150 / 3.6)); + scheme.addColor(RGBColor::YELLOW, (double)(30 / 3.6)); + scheme.addColor(RGBColor::GREEN, (double)(55 / 3.6)); + scheme.addColor(RGBColor::CYAN, (double)(80 / 3.6)); + scheme.addColor(RGBColor::BLUE, (double)(120 / 3.6)); + scheme.addColor(RGBColor::MAGENTA, (double)(150 / 3.6)); vehicleColorer.addScheme(scheme); scheme = GUIColorScheme("by waiting time", RGBColor::BLUE); - scheme.addColor(RGBColor::CYAN, (SUMOReal)30); - scheme.addColor(RGBColor::GREEN, (SUMOReal)100); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)200); - scheme.addColor(RGBColor::RED, (SUMOReal)300); + scheme.addColor(RGBColor::CYAN, (double)30); + scheme.addColor(RGBColor::GREEN, (double)100); + scheme.addColor(RGBColor::YELLOW, (double)200); + scheme.addColor(RGBColor::RED, (double)300); vehicleColorer.addScheme(scheme); scheme = GUIColorScheme("by accumulated waiting time", RGBColor::BLUE); - scheme.addColor(RGBColor::CYAN, (SUMOReal)25); - scheme.addColor(RGBColor::GREEN, (SUMOReal)50); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)75); - scheme.addColor(RGBColor::RED, (SUMOReal)100); + scheme.addColor(RGBColor::CYAN, (double)25); + scheme.addColor(RGBColor::GREEN, (double)50); + scheme.addColor(RGBColor::YELLOW, (double)75); + scheme.addColor(RGBColor::RED, (double)100); vehicleColorer.addScheme(scheme); scheme = GUIColorScheme("by time since lane change", RGBColor(179, 179, 179, 255), "0"); scheme.addColor(RGBColor(189, 189, 179, 255), -180); @@ -285,37 +301,37 @@ scheme.setAllowsNegativeValues(true); vehicleColorer.addScheme(scheme); scheme = GUIColorScheme("by max speed", RGBColor::RED); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)(30 / 3.6)); - scheme.addColor(RGBColor::GREEN, (SUMOReal)(55 / 3.6)); - scheme.addColor(RGBColor::CYAN, (SUMOReal)(80 / 3.6)); - scheme.addColor(RGBColor::BLUE, (SUMOReal)(120 / 3.6)); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)(150 / 3.6)); + scheme.addColor(RGBColor::YELLOW, (double)(30 / 3.6)); + scheme.addColor(RGBColor::GREEN, (double)(55 / 3.6)); + scheme.addColor(RGBColor::CYAN, (double)(80 / 3.6)); + scheme.addColor(RGBColor::BLUE, (double)(120 / 3.6)); + scheme.addColor(RGBColor::MAGENTA, (double)(150 / 3.6)); vehicleColorer.addScheme(scheme); // ... emissions ... scheme = GUIColorScheme("by CO2 emissions", RGBColor::GREEN); - scheme.addColor(RGBColor::RED, (SUMOReal)5.); + scheme.addColor(RGBColor::RED, (double)5.); vehicleColorer.addScheme(scheme); scheme = GUIColorScheme("by CO emissions", RGBColor::GREEN); - scheme.addColor(RGBColor::RED, (SUMOReal)0.05); + scheme.addColor(RGBColor::RED, 0.05); vehicleColorer.addScheme(scheme); scheme = GUIColorScheme("by PMx emissions", RGBColor::GREEN); - scheme.addColor(RGBColor::RED, (SUMOReal).005); + scheme.addColor(RGBColor::RED, (double).005); vehicleColorer.addScheme(scheme); scheme = GUIColorScheme("by NOx emissions", RGBColor::GREEN); - scheme.addColor(RGBColor::RED, (SUMOReal).125); + scheme.addColor(RGBColor::RED, (double).125); vehicleColorer.addScheme(scheme); scheme = GUIColorScheme("by HC emissions", RGBColor::GREEN); - scheme.addColor(RGBColor::RED, (SUMOReal).02); + scheme.addColor(RGBColor::RED, (double).02); vehicleColorer.addScheme(scheme); scheme = GUIColorScheme("by fuel consumption", RGBColor::GREEN); - scheme.addColor(RGBColor::RED, (SUMOReal).005); + scheme.addColor(RGBColor::RED, (double).005); vehicleColorer.addScheme(scheme); scheme = GUIColorScheme("by noise emissions (Harmonoise)", RGBColor::GREEN); - scheme.addColor(RGBColor::RED, (SUMOReal)100.); + scheme.addColor(RGBColor::RED, (double)100.); vehicleColorer.addScheme(scheme); scheme = GUIColorScheme("by reroute number", RGBColor::RED); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)1.); - scheme.addColor(RGBColor::WHITE, (SUMOReal)10.); + scheme.addColor(RGBColor::YELLOW, (double)1.); + scheme.addColor(RGBColor::WHITE, (double)10.); vehicleColorer.addScheme(scheme); scheme = GUIColorScheme("by selection", RGBColor(179, 179, 179, 255), "unselected", true); scheme.addColor(RGBColor(0, 102, 204, 255), 1, "selected"); @@ -328,26 +344,34 @@ scheme.setAllowsNegativeValues(true); vehicleColorer.addScheme(scheme); scheme = GUIColorScheme("by acceleration", RGBColor(179, 179, 179, 255), "0"); + scheme.addColor(RGBColor(64, 0, 0, 255), -9.0); scheme.addColor(RGBColor(255, 0, 0, 255), -4.5 /* -SUMOVTypeParameter::getDefaultDecel() */); scheme.addColor(RGBColor(255, 255, 0, 255), -0.1); scheme.addColor(RGBColor(0, 255, 255, 255), 0.1); scheme.addColor(RGBColor(0, 0, 255, 255), 2.6 /* SUMOVTypeParameter::getDefaultAccel() */); + scheme.addColor(RGBColor(255, 0, 255, 255), 5.2); scheme.setAllowsNegativeValues(true); vehicleColorer.addScheme(scheme); - scheme = GUIColorScheme("by time gap", RGBColor(255, 255, 0, 255), "0"); + scheme = GUIColorScheme("by time gap on lane", RGBColor(255, 255, 0, 255), "0"); scheme.addColor(RGBColor(179, 179, 179, 255), -1); scheme.addColor(RGBColor(0, 255, 255, 255), 1); scheme.addColor(RGBColor(0, 0, 255, 255), 2); scheme.setAllowsNegativeValues(true); vehicleColorer.addScheme(scheme); scheme = GUIColorScheme("by depart delay", RGBColor::BLUE); - scheme.addColor(RGBColor::CYAN, (SUMOReal)30); - scheme.addColor(RGBColor::GREEN, (SUMOReal)100); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)200); - scheme.addColor(RGBColor::RED, (SUMOReal)300); + scheme.addColor(RGBColor::CYAN, (double)30); + scheme.addColor(RGBColor::GREEN, (double)100); + scheme.addColor(RGBColor::YELLOW, (double)200); + scheme.addColor(RGBColor::RED, (double)300); vehicleColorer.addScheme(scheme); scheme = GUIColorScheme("by electricity consumption", RGBColor::GREEN); - scheme.addColor(RGBColor::RED, (SUMOReal)5); + scheme.addColor(RGBColor::RED, (double)5); + vehicleColorer.addScheme(scheme); + scheme = GUIColorScheme("by time loss", RGBColor::BLUE); + scheme.addColor(RGBColor::CYAN, (double)10); + scheme.addColor(RGBColor::GREEN, (double)60); + scheme.addColor(RGBColor::YELLOW, (double)180); + scheme.addColor(RGBColor::RED, (double)900); vehicleColorer.addScheme(scheme); vehicleColorer.addScheme(GUIColorScheme("random", RGBColor::YELLOW, "", true)); @@ -357,20 +381,20 @@ personColorer.addScheme(GUIColorScheme("given/assigned person color", RGBColor::YELLOW, "", true)); personColorer.addScheme(GUIColorScheme("given/assigned type color", RGBColor::YELLOW, "", true)); scheme = GUIColorScheme("by speed", RGBColor::RED); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)(2.5 / 3.6)); - scheme.addColor(RGBColor::GREEN, (SUMOReal)(5 / 3.6)); - scheme.addColor(RGBColor::BLUE, (SUMOReal)(10 / 3.6)); + scheme.addColor(RGBColor::YELLOW, (double)(2.5 / 3.6)); + scheme.addColor(RGBColor::GREEN, (double)(5 / 3.6)); + scheme.addColor(RGBColor::BLUE, (double)(10 / 3.6)); personColorer.addScheme(scheme); scheme = GUIColorScheme("by mode", RGBColor::YELLOW); // walking - scheme.addColor(RGBColor::BLUE, (SUMOReal)(1)); // riding - scheme.addColor(RGBColor::RED, (SUMOReal)(2)); // stopped - scheme.addColor(RGBColor::GREEN, (SUMOReal)(3)); // waiting for ride + scheme.addColor(RGBColor::BLUE, (double)(1)); // riding + scheme.addColor(RGBColor::RED, (double)(2)); // stopped + scheme.addColor(RGBColor::GREEN, (double)(3)); // waiting for ride personColorer.addScheme(scheme); scheme = GUIColorScheme("by waiting time", RGBColor::BLUE); - scheme.addColor(RGBColor::CYAN, (SUMOReal)30); - scheme.addColor(RGBColor::GREEN, (SUMOReal)100); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)200); - scheme.addColor(RGBColor::RED, (SUMOReal)300); + scheme.addColor(RGBColor::CYAN, (double)30); + scheme.addColor(RGBColor::GREEN, (double)100); + scheme.addColor(RGBColor::YELLOW, (double)200); + scheme.addColor(RGBColor::RED, (double)300); personColorer.addScheme(scheme); scheme = GUIColorScheme("by selection", RGBColor(179, 179, 179, 255), "unselected", true); scheme.addColor(RGBColor(0, 102, 204, 255), 1, "selected"); @@ -384,20 +408,20 @@ containerColorer.addScheme(GUIColorScheme("given/assigned container color", RGBColor::YELLOW, "", true)); containerColorer.addScheme(GUIColorScheme("given/assigned type color", RGBColor::YELLOW, "", true)); scheme = GUIColorScheme("by speed", RGBColor::RED); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)(2.5 / 3.6)); - scheme.addColor(RGBColor::GREEN, (SUMOReal)(5 / 3.6)); - scheme.addColor(RGBColor::BLUE, (SUMOReal)(10 / 3.6)); + scheme.addColor(RGBColor::YELLOW, (double)(2.5 / 3.6)); + scheme.addColor(RGBColor::GREEN, (double)(5 / 3.6)); + scheme.addColor(RGBColor::BLUE, (double)(10 / 3.6)); containerColorer.addScheme(scheme); scheme = GUIColorScheme("by mode", RGBColor::YELLOW); // walking - scheme.addColor(RGBColor::BLUE, (SUMOReal)(1)); // riding - scheme.addColor(RGBColor::RED, (SUMOReal)(2)); // stopped - scheme.addColor(RGBColor::GREEN, (SUMOReal)(3)); // waiting for ride + scheme.addColor(RGBColor::BLUE, (double)(1)); // riding + scheme.addColor(RGBColor::RED, (double)(2)); // stopped + scheme.addColor(RGBColor::GREEN, (double)(3)); // waiting for ride containerColorer.addScheme(scheme); scheme = GUIColorScheme("by waiting time", RGBColor::BLUE); - scheme.addColor(RGBColor::CYAN, (SUMOReal)30); - scheme.addColor(RGBColor::GREEN, (SUMOReal)100); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)200); - scheme.addColor(RGBColor::RED, (SUMOReal)300); + scheme.addColor(RGBColor::CYAN, (double)30); + scheme.addColor(RGBColor::GREEN, (double)100); + scheme.addColor(RGBColor::YELLOW, (double)200); + scheme.addColor(RGBColor::RED, (double)300); containerColorer.addScheme(scheme); scheme = GUIColorScheme("by selection", RGBColor(179, 179, 179, 255), "unselected", true); scheme.addColor(RGBColor(0, 102, 204, 255), 1, "selected"); @@ -436,79 +460,79 @@ laneScaler.addScheme(scheme); // ... traffic states ... scheme = GUIScaleScheme("by allowed speed (lanewise)", 0); - scheme.addColor(10, (SUMOReal)(150.0 / 3.6)); + scheme.addColor(10, (double)(150.0 / 3.6)); laneScaler.addScheme(scheme); scheme = GUIScaleScheme("by current occupancy (lanewise, brutto)", 0); - scheme.addColor(10, (SUMOReal)0.95); + scheme.addColor(10, 0.95); laneScaler.addScheme(scheme); scheme = GUIScaleScheme("by current occupancy (lanewise, netto)", 0); - scheme.addColor(10, (SUMOReal)0.95); + scheme.addColor(10, 0.95); laneScaler.addScheme(scheme); scheme = GUIScaleScheme("by first vehicle waiting time (lanewise)", 0); - scheme.addColor(10, (SUMOReal)300); + scheme.addColor(10, (double)300); laneScaler.addScheme(scheme); scheme = GUIScaleScheme("by lane number (streetwise)", 1); - scheme.addColor(10, (SUMOReal)5); + scheme.addColor(10, (double)5); laneScaler.addScheme(scheme); // ... emissions ... scheme = GUIScaleScheme("by CO2 emissions", 0); - scheme.addColor(10, (SUMOReal)(10. / 7.5 / 5.)); + scheme.addColor(10, (double)(10. / 7.5 / 5.)); laneScaler.addScheme(scheme); scheme = GUIScaleScheme("by CO emissions", 0); - scheme.addColor(10, (SUMOReal)(0.05 / 7.5 / 2.)); + scheme.addColor(10, (double)(0.05 / 7.5 / 2.)); laneScaler.addScheme(scheme); scheme = GUIScaleScheme("by PMx emissions", 0); - scheme.addColor(10, (SUMOReal)(.005 / 7.5 / 5.)); + scheme.addColor(10, (double)(.005 / 7.5 / 5.)); laneScaler.addScheme(scheme); scheme = GUIScaleScheme("by NOx emissions", 0); - scheme.addColor(10, (SUMOReal)(.125 / 7.5 / 5.)); + scheme.addColor(10, (double)(.125 / 7.5 / 5.)); laneScaler.addScheme(scheme); scheme = GUIScaleScheme("by HC emissions", 0); - scheme.addColor(10, (SUMOReal)(.02 / 7.5 / 4.)); + scheme.addColor(10, (double)(.02 / 7.5 / 4.)); laneScaler.addScheme(scheme); scheme = GUIScaleScheme("by fuel consumption", 0); - scheme.addColor(10, (SUMOReal)(.005 / 7.5 * 100.)); + scheme.addColor(10, (double)(.005 / 7.5 * 100.)); laneScaler.addScheme(scheme); scheme = GUIScaleScheme("by noise emissions (Harmonoise)", 0); - scheme.addColor(10, (SUMOReal)100); + scheme.addColor(10, (double)100); laneScaler.addScheme(scheme); // ... weights (experimental) ... scheme = GUIScaleScheme("by global travel time", 0); - scheme.addColor(10, (SUMOReal)100); + scheme.addColor(10, (double)100); scheme.setAllowsNegativeValues(true); laneScaler.addScheme(scheme); scheme = GUIScaleScheme("by global speed percentage", 0); - scheme.addColor(10, (SUMOReal)100); + scheme.addColor(10, (double)100); scheme.setAllowsNegativeValues(true); laneScaler.addScheme(scheme); scheme = GUIScaleScheme("by given length/geometrical length", 0); - scheme.addColor(10, (SUMOReal)10.0); + scheme.addColor(10, (double)10.0); laneScaler.addScheme(scheme); scheme = GUIScaleScheme("by loaded weight", 0); - scheme.addColor(-1000, (SUMOReal) - 1000); - scheme.addColor(1000, (SUMOReal)1000); + scheme.addColor(-1000, (double) - 1000); + scheme.addColor(1000, (double)1000); scheme.setAllowsNegativeValues(true); laneScaler.addScheme(scheme); scheme = GUIScaleScheme("by priority", 1); - scheme.addColor(0.5, (SUMOReal) - 20); - scheme.addColor(5, (SUMOReal)20); + scheme.addColor(0.5, (double) - 20); + scheme.addColor(5, (double)20); scheme.setAllowsNegativeValues(true); laneScaler.addScheme(scheme); scheme = GUIScaleScheme("by average speed", 0); - scheme.addColor(10, (SUMOReal)(150.0 / 3.6)); + scheme.addColor(10, (double)(150.0 / 3.6)); laneScaler.addScheme(scheme); scheme = GUIScaleScheme("by average relative speed", 0); - scheme.addColor(0.5, (SUMOReal)(0.5)); - scheme.addColor(2, (SUMOReal)(1)); - scheme.addColor(10, (SUMOReal)(2)); + scheme.addColor(0.5, (double)(0.5)); + scheme.addColor(2, (double)(1)); + scheme.addColor(10, (double)(2)); laneScaler.addScheme(scheme); scheme = GUIScaleScheme("by electricity consumption", 0); - scheme.addColor(10, (SUMOReal)(1 / 7.5 / 5.)); + scheme.addColor(10, (double)(1 / 7.5 / 5.)); laneScaler.addScheme(scheme); scheme = GUIScaleScheme("by insertion-backlog (streetwise)", 0); - scheme.addColor(1, (SUMOReal)1); - scheme.addColor(10, (SUMOReal)10); - scheme.addColor(50, (SUMOReal)100); + scheme.addColor(1, (double)1); + scheme.addColor(10, (double)10); + scheme.addColor(50, (double)100); laneScaler.addScheme(scheme); } @@ -523,38 +547,38 @@ scheme.addColor(RGBColor::BLUE, 2, "internal"); // see MSEdge::EdgeBasicFunction::EDGEFUNCTION_INTERNAL edgeColorer.addScheme(scheme); scheme = GUIColorScheme("by allowed speed (streetwise)", RGBColor::RED); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)(30 / 3.6)); - scheme.addColor(RGBColor::GREEN, (SUMOReal)(55 / 3.6)); - scheme.addColor(RGBColor::CYAN, (SUMOReal)(80 / 3.6)); - scheme.addColor(RGBColor::BLUE, (SUMOReal)(120 / 3.6)); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)(150 / 3.6)); + scheme.addColor(RGBColor::YELLOW, (double)(30 / 3.6)); + scheme.addColor(RGBColor::GREEN, (double)(55 / 3.6)); + scheme.addColor(RGBColor::CYAN, (double)(80 / 3.6)); + scheme.addColor(RGBColor::BLUE, (double)(120 / 3.6)); + scheme.addColor(RGBColor::MAGENTA, (double)(150 / 3.6)); edgeColorer.addScheme(scheme); scheme = GUIColorScheme("by current occupancy (streetwise, brutto)", RGBColor::BLUE); - scheme.addColor(RGBColor::RED, (SUMOReal)0.95); + scheme.addColor(RGBColor::RED, 0.95); edgeColorer.addScheme(scheme); scheme = GUIColorScheme("by current speed (streetwise)", RGBColor::RED); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)(30 / 3.6)); - scheme.addColor(RGBColor::GREEN, (SUMOReal)(55 / 3.6)); - scheme.addColor(RGBColor::CYAN, (SUMOReal)(80 / 3.6)); - scheme.addColor(RGBColor::BLUE, (SUMOReal)(120 / 3.6)); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)(150 / 3.6)); + scheme.addColor(RGBColor::YELLOW, (double)(30 / 3.6)); + scheme.addColor(RGBColor::GREEN, (double)(55 / 3.6)); + scheme.addColor(RGBColor::CYAN, (double)(80 / 3.6)); + scheme.addColor(RGBColor::BLUE, (double)(120 / 3.6)); + scheme.addColor(RGBColor::MAGENTA, (double)(150 / 3.6)); edgeColorer.addScheme(scheme); scheme = GUIColorScheme("by current flow (streetwise)", RGBColor::BLUE); - scheme.addColor(RGBColor::RED, (SUMOReal)5000); + scheme.addColor(RGBColor::RED, (double)5000); edgeColorer.addScheme(scheme); scheme = GUIColorScheme("by relative speed (streetwise)", RGBColor::RED); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)(0.25)); - scheme.addColor(RGBColor::GREEN, (SUMOReal)(0.5)); - scheme.addColor(RGBColor::CYAN, (SUMOReal)(0.75)); - scheme.addColor(RGBColor::BLUE, (SUMOReal)(1)); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)(1.25)); + scheme.addColor(RGBColor::YELLOW, (double)(0.25)); + scheme.addColor(RGBColor::GREEN, (double)(0.5)); + scheme.addColor(RGBColor::CYAN, (double)(0.75)); + scheme.addColor(RGBColor::BLUE, (double)(1)); + scheme.addColor(RGBColor::MAGENTA, (double)(1.25)); edgeColorer.addScheme(scheme); scheme = GUIColorScheme("by routing device assumed speed", RGBColor::RED); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)(30 / 3.6)); - scheme.addColor(RGBColor::GREEN, (SUMOReal)(55 / 3.6)); - scheme.addColor(RGBColor::CYAN, (SUMOReal)(80 / 3.6)); - scheme.addColor(RGBColor::BLUE, (SUMOReal)(120 / 3.6)); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)(150 / 3.6)); + scheme.addColor(RGBColor::YELLOW, (double)(30 / 3.6)); + scheme.addColor(RGBColor::GREEN, (double)(55 / 3.6)); + scheme.addColor(RGBColor::CYAN, (double)(80 / 3.6)); + scheme.addColor(RGBColor::BLUE, (double)(120 / 3.6)); + scheme.addColor(RGBColor::MAGENTA, (double)(150 / 3.6)); edgeColorer.addScheme(scheme); edgeColorer.addScheme(GUIColorScheme("by angle", RGBColor::YELLOW, "", true)); scheme = GUIColorScheme("by segments (alternating)", RGBColor::BLUE, "odd", true); @@ -564,29 +588,29 @@ scheme.addColor(RGBColor::RED, 1, "jammed"); edgeColorer.addScheme(scheme); scheme = GUIColorScheme("by current occupancy (segmentwise, brutto)", RGBColor::BLUE); - scheme.addColor(RGBColor::RED, (SUMOReal)0.95); + scheme.addColor(RGBColor::RED, 0.95); edgeColorer.addScheme(scheme); scheme = GUIColorScheme("by current speed (segmentwise)", RGBColor::RED); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)(30 / 3.6)); - scheme.addColor(RGBColor::GREEN, (SUMOReal)(55 / 3.6)); - scheme.addColor(RGBColor::CYAN, (SUMOReal)(80 / 3.6)); - scheme.addColor(RGBColor::BLUE, (SUMOReal)(120 / 3.6)); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)(150 / 3.6)); + scheme.addColor(RGBColor::YELLOW, (double)(30 / 3.6)); + scheme.addColor(RGBColor::GREEN, (double)(55 / 3.6)); + scheme.addColor(RGBColor::CYAN, (double)(80 / 3.6)); + scheme.addColor(RGBColor::BLUE, (double)(120 / 3.6)); + scheme.addColor(RGBColor::MAGENTA, (double)(150 / 3.6)); edgeColorer.addScheme(scheme); scheme = GUIColorScheme("by current flow (segmentwise)", RGBColor::BLUE); - scheme.addColor(RGBColor::RED, (SUMOReal)5000); + scheme.addColor(RGBColor::RED, (double)5000); edgeColorer.addScheme(scheme); scheme = GUIColorScheme("by relative speed (segmentwise)", RGBColor::RED); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)(0.25)); - scheme.addColor(RGBColor::GREEN, (SUMOReal)(0.5)); - scheme.addColor(RGBColor::CYAN, (SUMOReal)(0.75)); - scheme.addColor(RGBColor::BLUE, (SUMOReal)(1)); - scheme.addColor(RGBColor::MAGENTA, (SUMOReal)(1.25)); + scheme.addColor(RGBColor::YELLOW, (double)(0.25)); + scheme.addColor(RGBColor::GREEN, (double)(0.5)); + scheme.addColor(RGBColor::CYAN, (double)(0.75)); + scheme.addColor(RGBColor::BLUE, (double)(1)); + scheme.addColor(RGBColor::MAGENTA, (double)(1.25)); edgeColorer.addScheme(scheme); scheme = GUIColorScheme("by insertion-backlog (streetwise)", RGBColor::GREY); - scheme.addColor(RGBColor::GREEN, (SUMOReal)1); - scheme.addColor(RGBColor::YELLOW, (SUMOReal)10); - scheme.addColor(RGBColor::RED, (SUMOReal)100); + scheme.addColor(RGBColor::GREEN, (double)1); + scheme.addColor(RGBColor::YELLOW, (double)10); + scheme.addColor(RGBColor::RED, (double)100); edgeColorer.addScheme(scheme); @@ -597,24 +621,24 @@ scheme.addColor(5, 1, "selected"); edgeScaler.addScheme(scheme); scheme = GUIScaleScheme("by allowed speed (streetwise)", 0); - scheme.addColor(10, (SUMOReal)(150.0 / 3.6)); + scheme.addColor(10, (double)(150.0 / 3.6)); edgeScaler.addScheme(scheme); scheme = GUIScaleScheme("by current occupancy (streetwise, brutto)", 0); - scheme.addColor(10, (SUMOReal)0.95); + scheme.addColor(10, 0.95); edgeScaler.addScheme(scheme); scheme = GUIScaleScheme("by current speed (streetwise)", 0); - scheme.addColor(10, (SUMOReal)(150.0 / 3.6)); + scheme.addColor(10, (double)(150.0 / 3.6)); edgeScaler.addScheme(scheme); scheme = GUIScaleScheme("by current flow (streetwise)", 0); - scheme.addColor(20, (SUMOReal)5000); + scheme.addColor(20, (double)5000); edgeScaler.addScheme(scheme); scheme = GUIScaleScheme("by relative speed (streetwise)", 0); - scheme.addColor(20, (SUMOReal)1); + scheme.addColor(20, (double)1); edgeScaler.addScheme(scheme); scheme = GUIScaleScheme("by insertion-backlog (streetwise)", 0); - scheme.addColor(1, (SUMOReal)1); - scheme.addColor(10, (SUMOReal)10); - scheme.addColor(50, (SUMOReal)100); + scheme.addColor(1, (double)1); + scheme.addColor(10, (double)10); + scheme.addColor(50, (double)100); edgeScaler.addScheme(scheme); } @@ -968,10 +992,49 @@ } -SUMOReal -GUIVisualizationSizeSettings::getExaggeration(const GUIVisualizationSettings& s, SUMOReal factor) const { +double +GUIVisualizationSizeSettings::getExaggeration(const GUIVisualizationSettings& s, double factor) const { /// @note should look normal-sized at zoom 1000 - return (constantSize && !s.drawForSelecting) ? MAX2((SUMOReal)exaggeration, exaggeration * factor / s.scale) : exaggeration; + return (constantSize && !s.drawForSelecting) ? MAX2((double)exaggeration, exaggeration * factor / s.scale) : exaggeration; +} + + +const RGBColor& +GUIVisualizationSettings::getLinkColor(const LinkState& ls) { + switch (ls) { + case LINKSTATE_TL_GREEN_MAJOR: + return SUMO_color_TL_GREEN_MAJOR; + case LINKSTATE_TL_GREEN_MINOR: + return SUMO_color_TL_GREEN_MINOR; + case LINKSTATE_TL_RED: + return SUMO_color_TL_RED; + case LINKSTATE_TL_REDYELLOW: + return SUMO_color_TL_REDYELLOW; + case LINKSTATE_TL_YELLOW_MAJOR: + return SUMO_color_TL_YELLOW_MAJOR; + case LINKSTATE_TL_YELLOW_MINOR: + return SUMO_color_TL_YELLOW_MINOR; + case LINKSTATE_TL_OFF_BLINKING: + return SUMO_color_TL_OFF_BLINKING; + case LINKSTATE_TL_OFF_NOSIGNAL: + return SUMO_color_TL_OFF_NOSIGNAL; + case LINKSTATE_MAJOR: + return SUMO_color_MAJOR; + case LINKSTATE_MINOR: + return SUMO_color_MINOR; + case LINKSTATE_EQUAL: + return SUMO_color_EQUAL; + case LINKSTATE_STOP: + return SUMO_color_STOP; + case LINKSTATE_ALLWAY_STOP: + return SUMO_color_ALLWAY_STOP; + case LINKSTATE_ZIPPER: + return SUMO_color_ZIPPER; + case LINKSTATE_DEADEND: + return SUMO_color_DEADEND; + default: + throw ProcessError("No color defined for LinkState '" + std::string(ls, 1) + "'"); + } } /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/settings/GUIVisualizationSettings.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/settings/GUIVisualizationSettings.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/settings/GUIVisualizationSettings.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/settings/GUIVisualizationSettings.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIVisualizationSettings.h 21824 2016-10-27 13:03:52Z behrisch $ +/// @version $Id: GUIVisualizationSettings.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Stores the information about how to visualize structures /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -55,11 +55,11 @@ // cannot declare this as inner class because it needs to be used in forward // declaration (@todo fix inclusion order by removing references to guisim!) struct GUIVisualizationTextSettings { - GUIVisualizationTextSettings(bool _show, SUMOReal _size, RGBColor _color) : + GUIVisualizationTextSettings(bool _show, double _size, RGBColor _color) : show(_show), size(_size), color(_color) {} bool show; - SUMOReal size; + double size; RGBColor color; bool operator==(const GUIVisualizationTextSettings& other) { @@ -80,13 +80,13 @@ struct GUIVisualizationSizeSettings { - GUIVisualizationSizeSettings(SUMOReal _minSize, SUMOReal _exaggeration = 1.0, bool _constantSize = false) : + GUIVisualizationSizeSettings(double _minSize, double _exaggeration = 1.0, bool _constantSize = false) : minSize(_minSize), exaggeration(_exaggeration), constantSize(_constantSize) {} /// @brief The minimum size to draw this object - SUMOReal minSize; + double minSize; /// @brief The size exaggeration (upscale) - SUMOReal exaggeration; + double exaggeration; // @brief whether the object shall be drawn with constant size regardless of zoom bool constantSize; @@ -106,7 +106,7 @@ } /// @brief return the drawing size including exaggeration and constantSize values - SUMOReal getExaggeration(const GUIVisualizationSettings& s, SUMOReal factor = 20) const; + double getExaggeration(const GUIVisualizationSettings& s, double factor = 20) const; }; @@ -136,7 +136,7 @@ /// @brief Information whether a grid shall be shown bool showGrid; /// @brief Information about the grid spacings - SUMOReal gridXSize, gridYSize; + double gridXSize, gridYSize; //@} @@ -167,9 +167,9 @@ bool hideConnectors; /// @brief The lane exaggeration (upscale thickness) - SUMOReal laneWidthExaggeration; + double laneWidthExaggeration; /// @brief The minimum visual lane width for drawing - SUMOReal laneMinSize; + double laneMinSize; /// @brief Whether to show direction indicators for lanes bool showLaneDirection; /// @brief Whether to show sublane boundaries @@ -280,7 +280,7 @@ bool showSizeLegend; /// @brief information about a lane's width (temporary, used for a single view) - SUMOReal scale; + double scale; /// @brief whether the application is in gaming mode or not bool gaming; @@ -292,7 +292,7 @@ int editAdditionalMode; /// @brief the current selection scaling in NETEDIT (temporary) - SUMOReal selectionScale; + double selectionScale; /// @brief whether drawing is performed for the purpose of selecting objects bool drawForSelecting; @@ -324,6 +324,12 @@ /** @brief Comparison operator */ bool operator==(const GUIVisualizationSettings& vs2); + + + /* @brief map from LinkState to color constants */ + static const RGBColor& getLinkColor(const LinkState& ls); + + }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/tracker/GUIParameterTracker.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/tracker/GUIParameterTracker.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/tracker/GUIParameterTracker.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/tracker/GUIParameterTracker.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIParameterTracker.cpp 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: GUIParameterTracker.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A window which displays the time line of one (or more) value(s) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,16 +40,13 @@ #include #include #include +#include #include #include #include #include "GUIParameterTracker.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping @@ -89,7 +86,7 @@ delete(*i1); } // deleted by GUINet - for (std::vector*>::iterator i2 = myValuePassers.begin(); i2 != myValuePassers.end(); i2++) { + for (std::vector*>::iterator i2 = myValuePassers.begin(); i2 != myValuePassers.end(); i2++) { delete(*i2); } delete myToolBarDrag; @@ -106,17 +103,16 @@ void GUIParameterTracker::buildToolBar() { - myToolBarDrag = new FXToolBarShell(this, FRAME_NORMAL); + myToolBarDrag = new FXToolBarShell(this, GUIDesignToolBarShell3); myToolBar = new FXToolBar(this, myToolBarDrag, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | FRAME_RAISED); - new FXToolBarGrip(myToolBar, myToolBar, FXToolBar::ID_TOOLBARGRIP, TOOLBARGRIP_DOUBLE); + new FXToolBarGrip(myToolBar, myToolBar, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip); // save button new FXButton(myToolBar, "\t\tSave the data...", - GUIIconSubSys::getIcon(ICON_SAVE), this, GUIParameterTracker::MID_SAVE, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); + GUIIconSubSys::getIcon(ICON_SAVE), this, GUIParameterTracker::MID_SAVE, GUIDesignButtonToolbar); // aggregation interval combo myAggregationInterval = new FXComboBox(myToolBar, 8, this, MID_AGGREGATIONINTERVAL, - FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC); + GUIDesignComboBoxStatic); myAggregationInterval->appendItem("1s"); myAggregationInterval->appendItem("1min"); myAggregationInterval->appendItem("5min"); @@ -128,11 +124,11 @@ void -GUIParameterTracker::addTracked(GUIGlObject& o, ValueSource* src, +GUIParameterTracker::addTracked(GUIGlObject& o, ValueSource* src, TrackerValueDesc* newTracked) { myTracked.push_back(newTracked); // build connection (is automatically set into an execution map) - myValuePassers.push_back(new GLObjectValuePassConnector(o, src, newTracked)); + myValuePassers.push_back(new GLObjectValuePassConnector(o, src, newTracked)); } @@ -266,8 +262,8 @@ void GUIParameterTracker::GUIParameterTrackerPanel::drawValues() { - pfSetScale((SUMOReal) 0.1); - pfSetScaleXY((SUMOReal)(.1 * 300. / myWidthInPixels), (SUMOReal)(.1 * 300. / (SUMOReal) myHeightInPixels)); + pfSetScale((double) 0.1); + pfSetScaleXY((double)(.1 * 300. / myWidthInPixels), (double)(.1 * 300. / (double) myHeightInPixels)); // glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -278,7 +274,7 @@ for (std::vector::iterator i = myParent->myTracked.begin(); i != myParent->myTracked.end(); i++) { TrackerValueDesc* desc = *i; drawValue(*desc, - (SUMOReal) myWidthInPixels / (SUMOReal) myParent->myTracked.size() * (SUMOReal) run); + (double) myWidthInPixels / (double) myParent->myTracked.size() * (double) run); run++; } } @@ -286,14 +282,14 @@ void GUIParameterTracker::GUIParameterTrackerPanel::drawValue(TrackerValueDesc& desc, - SUMOReal /*namePos*/) { + double /*namePos*/) { // apply scaling glPushMatrix(); // apply the positiopn offset of the display glScaled(0.8, 0.8, 1); // apply value range scaling - SUMOReal ys = (SUMOReal) 2.0 / (SUMOReal) desc.getRange(); + double ys = (double) 2.0 / (double) desc.getRange(); glScaled(1.0, ys, 1.0); glTranslated(-1.0, -desc.getYCenter(), 0); @@ -313,14 +309,14 @@ glEnd(); glColor4ub(red, green, blue, 77); for (int a = 1; a < 6; a++) { - SUMOReal ypos = (desc.getRange()) / (SUMOReal) 6.0 * (SUMOReal) a + desc.getMin(); + double ypos = (desc.getRange()) / (double) 6.0 * (double) a + desc.getMin(); glBegin(GL_LINES); glVertex2d(0, ypos); glVertex2d(2.0, ypos); glEnd(); } - const std::vector& values = desc.getAggregatedValues(); - SUMOReal latest = 0; + const std::vector& values = desc.getAggregatedValues(); + double latest = 0; if (values.size() < 2) { glPopMatrix(); desc.unlockValues(); @@ -328,15 +324,15 @@ } else { latest = values.back(); // init values - SUMOReal xStep = (SUMOReal) 2.0 / (SUMOReal) values.size(); - std::vector::const_iterator i = values.begin(); - SUMOReal yp = (*i); - SUMOReal xp = 0; + double xStep = (double) 2.0 / (double) values.size(); + std::vector::const_iterator i = values.begin(); + double yp = (*i); + double xp = 0; i++; glColor4ub(red, green, blue, 255); for (; i != values.end(); i++) { - SUMOReal yn = (*i); - SUMOReal xn = xp + xStep; + double yn = (*i); + double xn = xp + xStep; glBegin(GL_LINES); glVertex2d(xp, yp); glVertex2d(xn, yn); @@ -354,7 +350,7 @@ // draw min time SUMOTime beginStep = desc.getRecordingBegin(); std::string begStr = time2string(beginStep); - SUMOReal w = pfdkGetStringWidth(begStr.c_str()); + double w = pfdkGetStringWidth(begStr.c_str()); glRotated(180, 1, 0, 0); pfSetPosition(0, 0); glTranslated(-0.8 - w / 2., 0.88, 0); @@ -389,8 +385,8 @@ // draw current value glRotated(180, 1, 0, 0); pfSetPosition(0, 0); - SUMOReal p = (SUMOReal) 0.8 - - ((SUMOReal) 1.6 / (desc.getMax() - desc.getMin()) * (latest - desc.getMin())); + double p = (double) 0.8 - + ((double) 1.6 / (desc.getMax() - desc.getMin()) * (latest - desc.getMin())); glTranslated(-0.98, p + .02, 0); pfDrawString(toString(latest).c_str()); glTranslated(0.98, -(p + .02), 0); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/tracker/GUIParameterTracker.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/tracker/GUIParameterTracker.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/tracker/GUIParameterTracker.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/tracker/GUIParameterTracker.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIParameterTracker.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIParameterTracker.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A window which displays the time line of one (or more) value(s) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,7 +34,14 @@ #include #include +// fx3d includes windows.h so we need to guard against macro pollution +#ifdef WIN32 +#define NOMINMAX +#endif #include +#ifdef WIN32 +#undef NOMINMAX +#endif #include #include #include "TrackerValueDesc.h" @@ -80,7 +87,7 @@ * @param[in] src The value source of the object * @param[in] newTracked The description of the tracked value */ - void addTracked(GUIGlObject& o, ValueSource* src, + void addTracked(GUIGlObject& o, ValueSource* src, TrackerValueDesc* newTracked); @@ -152,7 +159,7 @@ * @param[in] desc The tracked values to draw * @param[in] namePos Position to display the name at (currently unused) */ - void drawValue(TrackerValueDesc& desc, SUMOReal namePos); + void drawValue(TrackerValueDesc& desc, double namePos); private: @@ -190,7 +197,7 @@ GUIParameterTrackerPanel* myPanel; /// @brief The value sources - std::vector*> myValuePassers; + std::vector*> myValuePassers; /// @brief for some menu detaching fun FXToolBarShell* myToolBarDrag; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/tracker/TrackerValueDesc.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/tracker/TrackerValueDesc.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/tracker/TrackerValueDesc.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/tracker/TrackerValueDesc.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Sept 2002 -/// @version $Id: TrackerValueDesc.cpp 21824 2016-10-27 13:03:52Z behrisch $ +/// @version $Id: TrackerValueDesc.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Storage for a tracked value /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include #include "TrackerValueDesc.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -61,7 +57,7 @@ void -TrackerValueDesc::addValue(SUMOReal value) { +TrackerValueDesc::addValue(double value) { if (myValues.size() == 0) { myMin = value; myMax = value; @@ -75,7 +71,7 @@ myTmpLastAggValue += value; myValidNo++; } - const SUMOReal avg = myValidNo == 0 ? static_cast(0) : myTmpLastAggValue / static_cast(myValidNo); + const double avg = myValidNo == 0 ? static_cast(0) : myTmpLastAggValue / static_cast(myValidNo); if (myAggregationInterval == 1 || myValues.size() % myAggregationInterval == 1) { myAggregatedValues.push_back(avg); } else { @@ -88,25 +84,25 @@ } -SUMOReal +double TrackerValueDesc::getRange() const { return myMax - myMin; } -SUMOReal +double TrackerValueDesc::getMin() const { return myMin; } -SUMOReal +double TrackerValueDesc::getMax() const { return myMax; } -SUMOReal +double TrackerValueDesc::getYCenter() const { return (myMin + myMax) / 2.0f; } @@ -118,14 +114,14 @@ } -const std::vector& +const std::vector& TrackerValueDesc::getValues() { myLock.lock(); return myValues; } -const std::vector& +const std::vector& TrackerValueDesc::getAggregatedValues() { myLock.lock(); return myAggregatedValues; @@ -151,7 +147,7 @@ // ok, the aggregation has changed, // let's recompute the list of aggregated values myAggregatedValues.clear(); - std::vector::const_iterator i = myValues.begin(); + std::vector::const_iterator i = myValues.begin(); while (i != myValues.end()) { myTmpLastAggValue = 0; myValidNo = 0; @@ -164,7 +160,7 @@ if (myValidNo == 0) { myAggregatedValues.push_back(0); } else { - myAggregatedValues.push_back(myTmpLastAggValue / static_cast(myValidNo)); + myAggregatedValues.push_back(myTmpLastAggValue / static_cast(myValidNo)); } } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/tracker/TrackerValueDesc.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/tracker/TrackerValueDesc.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/tracker/TrackerValueDesc.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/tracker/TrackerValueDesc.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: TrackerValueDesc.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: TrackerValueDesc.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Representation of a timeline of floats with their names and moments /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,7 +48,7 @@ * This class contains the information needed to display a time line of * float values. */ -class TrackerValueDesc : public ValueRetriever { +class TrackerValueDesc : public ValueRetriever { public: /// Constructor TrackerValueDesc(const std::string& name, const RGBColor& col, @@ -58,16 +58,16 @@ ~TrackerValueDesc(); /// returns the maximum value range - SUMOReal getRange() const; + double getRange() const; /// Returns the values minimum - SUMOReal getMin() const; + double getMin() const; /// Returns the values maximum - SUMOReal getMax() const; + double getMax() const; /// Returns the center of the value - SUMOReal getYCenter() const; + double getYCenter() const; /// Returns the color to use to display the value const RGBColor& getColor() const; @@ -75,18 +75,18 @@ /** @brief returns the vector of collected values The values will be locked - no further addition will be perfomed until the method "unlockValues" will be called */ - const std::vector& getValues(); + const std::vector& getValues(); /** @brief returns the vector of aggregated values The values will be locked - no further addition will be perfomed until the method "unlockValues" will be called */ - const std::vector& getAggregatedValues(); + const std::vector& getAggregatedValues(); /// Returns the name of the value const std::string& getName() const; /// Adds a new value to the list - void addValue(SUMOReal value); + void addValue(double value); /// Releases the locking after the values have been drawn void unlockValues(); @@ -112,13 +112,13 @@ RGBColor myInactiveCol; /// Values collected - std::vector myValues; + std::vector myValues; /// Collected values in their aggregated form - std::vector myAggregatedValues; + std::vector myAggregatedValues; /// The minimum and the maximum of the value - SUMOReal myMin, myMax; + double myMin, myMax; // Mutex to avoid parallel drawing and insertion of new items MFXMutex myLock; @@ -127,7 +127,7 @@ int myAggregationInterval; /// Values like this shall not be counted on aggregation - SUMOReal myInvalidValue; + double myInvalidValue; /// Counter for valid numbers within the current aggregation interval int myValidNo; @@ -136,7 +136,7 @@ SUMOTime myRecordingBegin; /// Temporary storage for the last aggregation interval - SUMOReal myTmpLastAggValue; + double myTmpLastAggValue; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIAppEnum.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIAppEnum.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIAppEnum.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIAppEnum.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Andreas Gaubatz /// @date Mon, 08.03.2004 -/// @version $Id: GUIAppEnum.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUIAppEnum.h 23961 2017-04-18 10:32:08Z palcraft $ /// // Message and object IDs used by the FOX-version of the gui /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,427 +43,485 @@ * @brief Message and object IDs used by the FOX-version of the gui */ enum { - /// Show about - dialog + /// @brief Show about - dialog ID_ABOUT = FXMainWindow::ID_LAST, /// @name application specific - //@{ + /// @{ - /// Main window-ID + /// @brief Main window-ID MID_WINDOW, - /// Main window closes + /// @brief Main window closes MID_QUIT, - //@} + /// @} /// @name for common buttons - //@{ + /// @{ - /// Ok-button pressed + /// @brief Ok-button pressed MID_OK, - /// Cancel-button pressed + /// @brief Cancel-button pressed MID_CANCEL, - //@} + /// @} /// @name Main Window File Menu - IDs - //@{ + /// @{ - /// Open configuration - ID + /// @brief Open configuration - ID MID_OPEN_CONFIG, - /// Open network - ID + /// @brief Open network - ID MID_OPEN_NETWORK, - /// Load additional file with poi and polygons + /// @brief Load additional file with poi and polygons MID_OPEN_SHAPES, - /// Load additional file with additional elements + /// @brief Load additional file with additional elements MID_OPEN_ADDITIONALS, - /// Reload the previously loaded simulation + /// @brief Reload the previously loaded simulation MID_RELOAD, - /// Loads a file previously loaded + /// @brief Loads a file previously loaded MID_RECENTFILE, - /// Close simulation - ID + /// @brief Close simulation - ID MID_CLOSE, - /// About SUMO - ID + /// @brief About SUMO - ID MID_ABOUT, - //@} + /// @} /// @name Main Window Simulation Control - IDs - //@{ + /// @{ - /// Start the simulation + /// @brief Start the simulation MID_START, - /// Stop the simulation + /// @brief Stop the simulation MID_STOP, - /// Perform a single simulation step + /// @brief Perform a single simulation step MID_STEP, - //@} + /// @} /// @name Main window windows control - IDs - //@{ + /// @{ - /// Open a new microscopic view + /// @brief Open a new microscopic view MID_NEW_MICROVIEW, - /// Open a new microscopic 3D view + /// @brief Open a new microscopic 3D view MID_NEW_OSGVIEW, - //@} + /// @} /// @name SubThread - IDs - //@{ + /// @{ - /// The loading thread + /// @brief The loading thread ID_LOADTHREAD_EVENT, - /// The Simulation execution thread + /// @brief The Simulation execution thread ID_RUNTHREAD_EVENT, - /// ID for message passing between threads + /// @brief ID for message passing between threads ID_THREAD_EVENT, - //@} + /// @} /// @name Edit Menu Item - IDs - //@{ + /// @{ - /// Open editor for selections + /// @brief Open editor for selections MID_EDITCHOSEN, - /// Edit simulation breakpoints + /// @brief Edit simulation breakpoints MID_EDIT_BREAKPOINTS, - /// Open in netedit + /// @brief Open in netedit MID_NETEDIT, - //@} + /// @} /// @name Settings Menu Item - IDs - //@{ + /// @{ - /// Application settings - menu entry + /// @brief Application settings - menu entry MID_APPSETTINGS, - /// Gaming mode - menu entry + /// @brief Gaming mode - menu entry MID_GAMING, - /// Fullscreen mode - menu entry + /// @brief Fullscreen mode - menu entry MID_FULLSCREEN, - /// Locator configuration - menu entry + /// @brief Locator configuration - menu entry MID_LISTINTERNAL, - /// The Simulation delay control + MID_LISTPARKING, + MID_LISTTELEPORTING, + /// @brief The Simulation delay control MID_SIMDELAY, - //@} + /// @} - /// Clear simulation output + /// @brief Clear simulation output MID_CLEARMESSAGEWINDOW, - /// Show network statistics + /// @brief Show network statistics MID_SHOWNETSTATS, - /// Show vehicle statistics + /// @brief Show vehicle statistics MID_SHOWVEHSTATS, - /// Show person statistics + /// @brief Show person statistics MID_SHOWPERSONSTATS, /// @name Common View Settings - IDs - //@{ + /// @{ - /// Recenter view - button + /// @brief Recenter view - button MID_RECENTERVIEW, - /// Allow rotation - button + /// @brief Allow rotation - button MID_ALLOWROTATION, - /// Locate junction - button + /// @brief Locate junction - button MID_LOCATEJUNCTION, - /// Locate edge - button + /// @brief Locate edge - button MID_LOCATEEDGE, - /// Locate vehicle - button + /// @brief Locate vehicle - button MID_LOCATEVEHICLE, - /// Locate person - button + /// @brief Locate person - button MID_LOCATEPERSON, - /// Locate TLS - button + /// @brief Locate TLS - button MID_LOCATETLS, - /// Locate BusStop - button + /// @brief Locate BusStop - button MID_LOCATEADDITIONAL_BUSSTOP, - /// Locate ChargingStation - button + /// @brief Locate ChargingStation - button MID_LOCATEADDITIONAL_CHARGINGSTATION, - /// Locate addtional structure - button + /// @brief Locate addtional structure - button MID_LOCATEADD, - /// Locate poi - button + /// @brief Locate poi - button MID_LOCATEPOI, - /// Locate polygons - button + /// @brief Locate polygons - button MID_LOCATEPOLY, - /// Open viewport editor - button + /// @brief Open viewport editor - button MID_EDITVIEWPORT, - /// Open view editor - button + /// @brief Open view editor - button MID_EDITVIEWSCHEME, - /// Show tool tips - button + /// @brief Show tool tips - button MID_SHOWTOOLTIPS, - /// Make snapshot - button + /// @brief Make snapshot - button MID_MAKESNAPSHOT, - /// toogle zooming style + /// @brief toogle zooming style MID_ZOOM_STYLE, - /// toogle time display mode + /// @brief toogle time display mode MID_TIME_TOOGLE, - /// toogle delay between alternative value + /// @brief toogle delay between alternative value MID_DELAY_TOOGLE, - //@} + /// @} /// @name Common view IDs - //@{ + /// @{ - /// GLCanvas - ID + /// @brief GLCanvas - ID MID_GLCANVAS, - /// chore + /// @brief chore MID_CHORE, - //@} + /// @} /// @name View settings - IDs - //@{ + /// @{ - /// Change coloring scheme - combo + /// @brief Change coloring scheme - combo MID_COLOURSCHEMECHANGE, - //@} + /// @} /// @name Object PopUp Entries - IDs - //@{ + /// @{ - /// Center view to object - popup entry + /// @brief Center view to object - popup entry MID_CENTER, - /// Copy object name - popup entry + /// @brief Copy object name - popup entry MID_COPY_NAME, - /// Copy typed object name - popup entry + /// @brief Copy typed object name - popup entry MID_COPY_TYPED_NAME, - /// Copy edge name (for lanes only) + /// @brief Copy edge name (for lanes only) MID_COPY_EDGE_NAME, - /// Copy cursor position - popup entry + /// @brief Copy cursor position - popup entry MID_COPY_CURSOR_POSITION, - /// Copy cursor geo-coordinate position - popup entry + /// @brief Copy cursor geo-coordinate position - popup entry MID_COPY_CURSOR_GEOPOSITION, - /// Show object parameter - popup entry + /// @brief Show object parameter - popup entry MID_SHOWPARS, - /// Show object type parameter - popup entry + /// @brief Show object type parameter - popup entry MID_SHOWTYPEPARS, - /// Show TLS phases - popup entry + /// @brief Show TLS phases - popup entry MID_SWITCH_OFF, MID_SWITCH, MID_SHOWPHASES = MID_SWITCH + 20, - /// Begin to track phases - menu entry + /// @brief Begin to track phases - menu entry MID_TRACKPHASES, - /// Add to selected items - menu entry + /// @brief Add to selected items - menu entry MID_ADDSELECT, - /// Remove from selected items - Menu Etry + /// @brief Remove from selected items - Menu Etry MID_REMOVESELECT, - /// Open the object's manipulator + /// @brief Open the object's manipulator MID_MANIP, - /// Draw a vehicle's route + /// @brief Draw a vehicle's route MID_DRAWROUTE, - /// Show vehicle's current route + /// @brief Show vehicle's current route MID_SHOW_CURRENTROUTE, - /// Hide vehicle's current route + /// @brief Hide vehicle's current route MID_HIDE_CURRENTROUTE, - /// Show vehicle's best lanes + /// @brief Show vehicle's best lanes MID_SHOW_BEST_LANES, - /// Hide vehicle's best lanes + /// @brief Hide vehicle's best lanes MID_HIDE_BEST_LANES, - /// Show all vehicle's routes + /// @brief Show all vehicle's routes MID_SHOW_ALLROUTES, - /// Hide all vehicle's routes + /// @brief Hide all vehicle's routes MID_HIDE_ALLROUTES, - /// Start to track a vehicle + /// @brief Start to track a vehicle MID_START_TRACK, - /// Stop to track a vehicle + /// @brief Stop to track a vehicle MID_STOP_TRACK, - /// select foes of a vehicle + /// @brief select foes of a vehicle MID_SHOW_FOES, MID_SHOW_LFLINKITEMS, MID_HIDE_LFLINKITEMS, - /// Show persons's path on walkingarea + /// @brief Show persons's path on walkingarea MID_SHOW_WALKINGAREA_PATH, - /// Hide persons's path on walkingarea + /// @brief Hide persons's path on walkingarea MID_HIDE_WALKINGAREA_PATH, - //@} + /// @} /// @name IDs used by Trackers - //@{ + /// @{ - /// The Table + /// @brief The Table MID_TABLE, - /// A Simulation step was performed + /// @brief A Simulation step was performed MID_SIMSTEP, - /// A Tracker shall be opened + /// @brief A Tracker shall be opened MID_OPENTRACKER, - //@} + /// @} /// @name General Setting Dialogs - IDs - //@{ + /// @{ - /// Ok-button was pushed + /// @brief Ok-button was pushed MID_SETTINGS_OK, - /// Cancel-button was pushed + /// @brief Cancel-button was pushed MID_SETTINGS_CANCEL, - //@} + /// @} /// @name Application Settings - Dialog IDs - //@{ + /// @{ - /// Close simulation at end - Option + /// @brief Close simulation at end - Option MID_QUITONSIMEND, - /// Start simulation when loaded - Option + /// @brief Start simulation when loaded - Option MID_AUTOSTART, - /// Demo mode - Option + /// @brief Demo mode - Option MID_DEMO, - /// Allow textures - Option + /// @brief Allow textures - Option MID_ALLOWTEXTURES, - /// Locate links in messages - Option + /// @brief Locate links in messages - Option MID_LOCATELINKS, - //@} + /// @} /// @name GLObjChooser - Dialog IDs - //@{ + /// @{ - /// Center object + /// @brief Center object MID_CHOOSER_CENTER, - /// Text entry + /// @brief Text entry MID_CHOOSER_TEXT, - /// Object list + /// @brief Object list MID_CHOOSER_LIST, - /// Filter selected + /// @brief Filter selected MID_CHOOSER_FILTER, - //@} + /// @} /// @name GLChosenEditor - Dialog IDs - //@{ + /// @{ - /// set subset of elements + /// @brief set type of selection + MID_CHOOSEN_OPERATION, + /// @brief set subset of elements MID_CHOOSEN_ELEMENTS, - /// Load set + /// @brief Load set MID_CHOOSEN_LOAD, - /// Save set + /// @brief Save set MID_CHOOSEN_SAVE, - /// Clear set + /// @brief Clear set MID_CHOOSEN_CLEAR, - /// Reset set + /// @brief Reset set MID_CHOOSEN_RESET, - /// Deselect selected items + /// @brief Deselect selected items MID_CHOOSEN_DESELECT, - /// Deselect selected items + /// @brief Deselect selected items MID_CHOOSEN_INVERT, - //@} + /// @} + + /// @name childs of elements in netedit + /// @{ + + /// @brief tree list with the childs + MID_GNE_CHILDS, + /// @brief In GNEDeleteFrame, center element + MID_GNE_DELETEFRAME_CENTER, + /// @brief In GNEDeleteFrame, inspect element + MID_GNE_DELETEFRAME_INSPECT, + /// @brief In GNEDeleteFrame, delete element + MID_GNE_DELETEFRAME_DELETE, + /// @brief In GNEInspectFrame, center element + MID_GNE_INSPECTFRAME_CENTER, + /// @brief In GNEInspectFrame, inspect element + MID_GNE_INSPECTFRAME_INSPECT, + /// @brief In GNEInspectFrame, delete element + MID_GNE_INSPECTFRAME_DELETE, + /// @brief automatically delete additional childs + MID_GNE_AUTOMATICALLYDELETEADDITIONALS, + /// @} /// @name IDs for visualization settings - Dialog - //@{ + /// @{ - /// Informs the dialog about a value's change + /// @brief Informs the dialog about a value's change MID_SIMPLE_VIEW_COLORCHANGE, - /// Informs the dialog about switching to another scheme + /// @brief Informs the dialog about switching to another scheme MID_SIMPLE_VIEW_NAMECHANGE, - /// For the save-to-db - button + /// @brief For the save-to-db - button MID_SIMPLE_VIEW_SAVE, - /// For the delete - button + /// @brief For the delete - button MID_SIMPLE_VIEW_DELETE, - /// For the export-to-file - button + /// @brief For the export-to-file - button MID_SIMPLE_VIEW_EXPORT, - /// For the import-from-file - button + /// @brief For the import-from-file - button MID_SIMPLE_VIEW_IMPORT, - /// For the load-decals - button + /// @brief For the load-decals - button MID_SIMPLE_VIEW_LOAD_DECALS, - /// For the save-decals - button + /// @brief For the save-decals - button MID_SIMPLE_VIEW_SAVE_DECALS, - //@} + /// @} - /** help button */ + ///@brief help button MID_HELP, /// @name dynamic interaction with the simulation via SUMO-GUI - //@{ + /// @{ + MID_CLOSE_LANE, MID_CLOSE_EDGE, MID_ADD_REROUTER, - //@} + /// @} /// @name NETEDIT Message IDs - //@{ - /** abort current edit operation */ + /// @{ + + /// @brief abort current edit operation MID_GNE_ABORT, - /** hot key */ + /// @brief focus upper element of current frame + MID_GNE_FOCUS_FRAME, + /// @brief hot key MID_GNE_HOTKEY_DEL, - /** hot key */ + /// @brief hot key MID_GNE_HOTKEY_ENTER, + /// @} - /** mode has changed */ - MID_GNE_MODE_CHANGE, + /// @name NETEDIT edit modes + /// @{ - /** mode has changed */ + /// @brief mode has changed + MID_GNE_MODE_CHANGE, + /// @brief mode has changed MID_GNE_MODEADDITIONAL_CHANGE, - - /** mode for adding edges */ + /// @brief mode for adding edges MID_GNE_MODE_CREATE_EDGE, - /** mode for moving things */ + /// @brief mode for moving things MID_GNE_MODE_MOVE, - /** mode for deleting things */ + /// @brief mode for deleting things MID_GNE_MODE_DELETE, - /** mode for inspecting object attributes */ + /// @brief mode for inspecting object attributes MID_GNE_MODE_INSPECT, - /** mode for selecting objects */ + /// @brief mode for selecting objects MID_GNE_MODE_SELECT, - /** mode for connecting lanes */ + /// @brief mode for connecting lanes MID_GNE_MODE_CONNECT, - /** mode for editing tls */ + /// @brief mode for editing tls MID_GNE_MODE_TLS, - /** mode for editing additional */ + /// @brief mode for editing additional MID_GNE_MODE_ADDITIONAL, + /// @brief mode for editing crossing + MID_GNE_MODE_CROSSING, + /// @} - /// selector match box messages + + /// @brief selector match box messages MID_GNE_SELMB_TAG, + MID_GME_SELMB_ATTRIBUTE, MID_GNE_SELMB_STRING, - /// additional match box messages + /// @brief additional match box messages MID_GNE_MODE_ADDITIONAL_ITEM, MID_GNE_MODE_ADDITIONAL_REFERENCEPOINT, MID_GNE_MODE_ADDITIONAL_FORCEPOSITION, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_TEXT, + MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_DIAL, MID_GNE_MODE_ADDITIONAL_CHANGEPARAMETER_BOOL, - /// Inspector attribute dialog + /// @brief Inspector attribute dialog MID_GNE_MODE_INSPECT_ACCEPT, MID_GNE_MODE_INSPECT_CANCEL, MID_GNE_MODE_INSPECT_RESET, - /// Variable Speed Signal dialog - MID_GNE_VARIABLESPEEDSIGNAL_ADDROW, - MID_GNE_VARIABLESPEEDSIGNAL_REMOVEROW, - MID_GNE_VARIABLESPEEDSIGNAL_CHANGEVALUE, - - /// Rerouter dialog - MID_GNE_REROUTER_ADDROW, - MID_GNE_REROUTER_REMOVEROW, - MID_GNE_REROUTER_CHANGEVALUE, - - /// Calibrator dialog - MID_GNE_CALIBRATOR_ADDROW, - MID_GNE_CALIBRATOR_REMOVEROW, - MID_GNE_CALIBRATOR_CHANGEVALUE, - - /// Additional dialogs + /// @brief Additional dialogs MID_GNE_MODE_ADDITIONALDIALOG_ACCEPT, MID_GNE_MODE_ADDITIONALDIALOG_CANCEL, MID_GNE_MODE_ADDITIONALDIALOG_RESET, - /// processing menu messages + /// @brief Variable Speed Signal dialog + MID_GNE_VARIABLESPEEDSIGN_ADDROW, + MID_GNE_VARIABLESPEEDSIGN_REMOVEROW, + MID_GNE_VARIABLESPEEDSIGN_CHANGEVALUE, + + /// @brief Rerouter dialog + MID_GNE_REROUTEDIALOG_TABLE_INTERVAL, + MID_GNE_REROUTEDIALOG_TABLE_CLOSINGLANEREROUTE, + MID_GNE_REROUTEDIALOG_TABLE_CLOSINGREROUTE, + MID_GNE_REROUTEDIALOG_TABLE_DESTPROBREROUTE, + MID_GNE_REROUTEDIALOG_TABLE_ROUTEPROBREROUTE, + MID_GNE_REROUTEDIALOG_ADD_INTERVAL, + MID_GNE_REROUTEDIALOG_ADD_CLOSINGLANEREROUTE, + MID_GNE_REROUTEDIALOG_ADD_CLOSINGREROUTE, + MID_GNE_REROUTEDIALOG_ADD_DESTPROBREROUTE, + MID_GNE_REROUTEDIALOG_ADD_ROUTEPROBREROUTE, + MID_GNE_REROUTEDIALOG_EDIT_INTERVAL, + + /// @brief Calibrator dialog + MID_GNE_CALIBRATORDIALOG_TABLE_ROUTE, + MID_GNE_CALIBRATORDIALOG_ADD_ROUTE, + MID_GNE_CALIBRATORDIALOG_TABLE_FLOW, + MID_GNE_CALIBRATORDIALOG_ADD_FLOW, + MID_GNE_CALIBRATORDIALOG_TABLE_VEHICLETYPE, + MID_GNE_CALIBRATORDIALOG_ADD_VEHICLETYPE, + MID_GNE_CALIBRATORDIALOG_SET_VARIABLE, + MID_GNE_CALIBRATORDIALOG_SET_FLOWTYPE, + + /// @brief allowDisallow dialog + MID_GNE_ALLOWDISALLOW_CHANGE, + MID_GNE_ALLOWDISALLOW_SELECTALL, + MID_GNE_ALLOWDISALLOW_UNSELECTALL, + MID_GNE_ALLOWDISALLOW_SELECTONLYNONROAD, + + /// @brief processing menu messages MID_GNE_COMPUTE_JUNCTIONS, MID_GNE_CLEAN_JUNCTIONS, MID_GNE_JOIN_JUNCTIONS, MID_GNE_OPTIONS, - /// tls mode messages - /** replace program with a newly guessed program */ + /// @name tls mode messages + /// @{ + + /// @brief replace program with a newly guessed program MID_GNE_GUESS_PROGRAM, - /** definition related controls */ + /// @brief definition related controls MID_GNE_DEF_OFFSET, MID_GNE_DEF_SWITCH, MID_GNE_DEF_CREATE, @@ -471,138 +529,154 @@ MID_GNE_DEF_RENAME, MID_GNE_DEF_SUBRENAME, MID_GNE_DEF_ADDOFF, - /** phase related controls */ + /// @} + + /// @name phase related controls + /// @{ + /// @brief select phase thable MID_GNE_PHASE_TABLE, + /// @brief create phase thable MID_GNE_PHASE_CREATE, + /// @brief delete phase thable MID_GNE_PHASE_DELETE, + /// @} - /// misc messages + /// @brief misc messages MID_GNE_NEW_NETWORK, MID_GNE_OPEN_FOREIGN, MID_GNE_VIS_HEIGHT, MID_GNE_LOAD_POIS, // MID_GNE_WIZARD, - /** save network*/ + /// @brief save network MID_GNE_SAVE_NETWORK, MID_GNE_SAVE_AS_NETWORK, MID_GNE_SAVE_PLAIN_XML, MID_GNE_SAVE_JOINED, MID_GNE_SAVE_POIS, - /** Save additionals **/ + /// @brief Save additionals MID_GNE_SAVE_ADDITIONALS, MID_GNE_SAVE_ADDITIONALS_AS, - /** insert contents of another network */ + /// @brief insert contents of another network MID_GNE_INSERT_NETWORK, - /** show connections **/ + /// @brief show connections MID_GNE_SHOW_CONNECTIONS, - /** show junctions as bubbles **/ + /// @brief select edges + MID_GNE_SELECT_EDGES, + /// @brief show junctions as bubbles MID_GNE_SHOW_BUBBLES, - /** attribute edited */ + /// @brief show grid + MID_GNE_SHOW_GRID, + /// @brief attribute edited MID_GNE_SET_ATTRIBUTE, - /** netEdit attribute blocking */ + /// @brief attribute blocking MID_GNE_SET_BLOCKING, - /** netEdit show connection */ + /// @brief show connection MID_GNE_SHOW_CONNECTION, - /** netEdit inspect connection */ + /// @brief inspect connection MID_GNE_INSPECT_CONNECTION, - /** netEdit go back to the previous element */ + /// @brief go back to the previous element MID_GNE_INSPECT_GOBACK, - /** netEdit add row */ + /// @brief add row MID_GNE_ADDROW, - /** netEdit remove row */ + /// @brief remove row MID_GNE_REMOVEROW, - /** netEdit add set */ + /// @brief add set MID_GNE_ADDSET, - /** netEdit remove set */ + /// @brief remove set MID_GNE_REMOVESET, - /** netEdit search additionalSet */ - MID_GNE_SEARCHADDITIONALSET, - /** netEdit select additionalSet */ - MID_GNE_SELECTADDITIONALSET, - /** netEdit search edge */ + /// @brief search additional parent + MID_GNE_SEARCHADDITIONALPARENT, + /// @brief select additional parent + MID_GNE_SELECTADDITIONALPARENT, + /// @brief search edge MID_GNE_SEARCHEDGE, - /** netEdit use selected edge */ - MID_GNE_USESELECTEDEDGES, - /** netEdit select edge */ + /// @brief show only selected edge in a list + MID_GNE_SHOWONLYSELECTEDEDGES, + /// @brief use selected edges only + MID_GNE_USEONLYSELECTEDEDGES, + /// @brief select edge MID_GNE_SELECTEDGE, - /** netEdit clear selection of edges */ + /// @brief clear selection of edges MID_GNE_CLEAREDGESELECTION, - /** netEdit invert selection of edges */ + /// @brief invert selection of edges MID_GNE_INVERTEDGESELECTION, - /** netEdit search lane */ + /// @brief search lane MID_GNE_SEARCHLANE, - /** netEdit use selected lanes */ + /// @brief use selected lanes MID_GNE_USESELECTEDLANES, - /** netEdit select lane */ + /// @brief select lane MID_GNE_SELECTLANE, - /** netEdit clear selection of lanes */ + /// @brief clear selection of lanes MID_GNE_CLEARLANESELECTION, - /** netEdit invert selection of lanes */ + /// @brief invert selection of lanes MID_GNE_INVERTLANESELECTION, - /** open edit dialog */ + /// @brief open edit dialog MID_GNE_OPEN_ATTRIBUTE_EDITOR, - /** split an edge */ + /// @brief split an edge MID_GNE_SPLIT_EDGE, - /** split an edge */ + /// @brief split an edge MID_GNE_SPLIT_EDGE_BIDI, - /** reverse an edge */ + /// @brief reverse an edge MID_GNE_REVERSE_EDGE, - /** add reverse edge */ + /// @brief add reverse edge MID_GNE_ADD_REVERSE_EDGE, - /** edit junction shape */ + /// @brief edit junction shape MID_GNE_NODE_SHAPE, - /** turn junction into geometry node */ + /// @brief turn junction into geometry node MID_GNE_NODE_REPLACE, - /** set non-default geometry endpoint */ + /// @brief set non-default geometry endpoint MID_GNE_SET_EDGE_ENDPOINT, - /** restore geometry endpoint to node position */ + /// @brief restore geometry endpoint to node position MID_GNE_RESET_EDGE_ENDPOINT, - /** remove inner geometry */ + /// @brief remove inner geometry MID_GNE_STRAIGHTEN, - /** simplify polygon geometry */ + /// @brief simplify polygon geometry MID_GNE_SIMPLIFY_SHAPE, - /** delete geometry point */ + /// @brief delete geometry point MID_GNE_DELETE_GEOMETRY, - /** duplicate a lane */ + /// @brief duplicate a lane MID_GNE_DUPLICATE_LANE, - /** transform lane to sidewalk */ + /// @brief transform lane to sidewalk MID_GNE_TRANSFORM_LANE_SIDEWALK, - /** transform lane to bikelane */ + /// @brief transform lane to bikelane MID_GNE_TRANSFORM_LANE_BIKE, - /** transform lane to busLane */ + /// @brief transform lane to busLane MID_GNE_TRANSFORM_LANE_BUS, - /** revert transformation */ + /// @brief revert transformation MID_GNE_REVERT_TRANSFORMATION, - /** add sidewalk */ + /// @brief add sidewalk MID_GNE_ADD_LANE_SIDEWALK, - /** add bikelane */ + /// @brief add bikelane MID_GNE_ADD_LANE_BIKE, - /** add busLane */ + /// @brief add busLane MID_GNE_ADD_LANE_BUS, - /** remove sidewalk */ + /// @brief remove sidewalk MID_GNE_REMOVE_LANE_SIDEWALK, - /** remove bikelane */ + /// @brief remove bikelane MID_GNE_REMOVE_LANE_BIKE, - /** remove busLane */ + /// @brief remove busLane MID_GNE_REMOVE_LANE_BUS, - /** set object as template*/ + /// @brief set object as template MID_GNE_SET_TEMPLATE, - /** copy template*/ + /// @brief copy template MID_GNE_COPY_TEMPLATE, - /** remove template*/ + /// @brief remove template MID_GNE_REMOVE_TEMPLATE, - /** select dead end lanes */ + /// @brief select dead end lanes MID_GNE_SELECT_DEAD_ENDS, - /** select lanes that have no connection leading to it */ + /// @brief select lanes that have no connection leading to it MID_GNE_SELECT_DEAD_STARTS, - /** select lanes that are connected from concurrent lanes */ + /// @brief select lanes that are connected from concurrent lanes MID_GNE_SELECT_CONFLICTS, - /** select lanes with connections that have the pass attribute set to 'true' */ + /// @brief select lanes with connections that have the pass attribute set to 'true' MID_GNE_SELECT_PASS, - /** changes the visual scaling of selected items */ + /// @brief changes the visual scaling of selected items MID_GNE_SELECT_SCALE, - - //@} + /// @brief Create crossing + MID_GNE_CREATE_CROSSING, + /// @brief Size of frame area updated + MID_GNE_SIZEOF_FRAMEAREAWIDTH_UPDATED, + /// @} MID_LAST }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIDanielPerspectiveChanger.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIDanielPerspectiveChanger.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIDanielPerspectiveChanger.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIDanielPerspectiveChanger.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIDanielPerspectiveChanger.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUIDanielPerspectiveChanger.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A class that allows to steer the visual output in dependence to /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include "GUIPerspectiveChanger.h" #include "GUIDanielPerspectiveChanger.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -69,7 +65,7 @@ void -GUIDanielPerspectiveChanger::zoom(SUMOReal factor) { +GUIDanielPerspectiveChanger::zoom(double factor) { if (myCallback.getApp()->reg().readIntEntry("gui", "zoomAtCenter", 1)) { myZoomBase = myViewPort.getCenter(); } @@ -88,57 +84,57 @@ GUIDanielPerspectiveChanger::rotate(int /* diff */) { /* if (myCallback.allowRotation()) { - myRotation += (SUMOReal) diff / (SUMOReal) 10.0; + myRotation += (double) diff / (double) 10.0; myCallback.update(); } */ } -SUMOReal +double GUIDanielPerspectiveChanger::getRotation() const { return myRotation; } -SUMOReal +double GUIDanielPerspectiveChanger::getXPos() const { return myViewPort.getCenter().x(); } -SUMOReal +double GUIDanielPerspectiveChanger::getYPos() const { return myViewPort.getCenter().y(); } -SUMOReal +double GUIDanielPerspectiveChanger::getZoom() const { return myOrigWidth / myViewPort.getWidth() * 100; } -SUMOReal +double GUIDanielPerspectiveChanger::getZPos() const { return myViewPort.getWidth(); } -SUMOReal -GUIDanielPerspectiveChanger::zoom2ZPos(SUMOReal zoom) const { +double +GUIDanielPerspectiveChanger::zoom2ZPos(double zoom) const { return myOrigWidth / (zoom / 100); } -SUMOReal -GUIDanielPerspectiveChanger::zPos2Zoom(SUMOReal zPos) const { +double +GUIDanielPerspectiveChanger::zPos2Zoom(double zPos) const { return (myOrigWidth / zPos) * 100; } void -GUIDanielPerspectiveChanger::centerTo(const Position& pos, SUMOReal radius, +GUIDanielPerspectiveChanger::centerTo(const Position& pos, double radius, bool applyZoom) { if (applyZoom) { myViewPort = Boundary(); @@ -198,17 +194,26 @@ void GUIDanielPerspectiveChanger::onMouseWheel(void* data) { FXEvent* e = (FXEvent*) data; - SUMOReal diff = 0.1; - if ((e->state & CONTROLMASK) != 0) { - diff /= 2; - } else if ((e->state & SHIFTMASK) != 0) { - diff *= 2; + // catch empty ghost events after scroll (seem to occur only on Ubuntu) + if (e->code == 0) { + return; } + // zoom scale relative delta and its inverse; is optimized (all literals) + const double zScale_rDelta_norm = 0.1; + const double zScale_rDelta_inv = -zScale_rDelta_norm / (1. + zScale_rDelta_norm); + double zScale_rDelta = zScale_rDelta_norm ; if (e->code < 0) { - diff = -diff; + // for inverse zooming direction + zScale_rDelta = zScale_rDelta_inv; + } + // keyboard modifier: slow, fast mouse-zoom + if ((e->state & CONTROLMASK) != 0) { + zScale_rDelta /= 4; + } else if ((e->state & SHIFTMASK) != 0) { + zScale_rDelta *= 4; } myZoomBase = myCallback.getPositionInformation(); - zoom(1.0 + diff); + zoom(1.0 + zScale_rDelta); myCallback.updateToolTip(); } @@ -251,9 +256,9 @@ void -GUIDanielPerspectiveChanger::setViewport(SUMOReal zoom, - SUMOReal xPos, SUMOReal yPos) { - const SUMOReal zoomFactor = zoom / 50; // /100 to normalize, *2 because growth is added on both sides +GUIDanielPerspectiveChanger::setViewport(double zoom, + double xPos, double yPos) { + const double zoomFactor = zoom / 50; // /100 to normalize, *2 because growth is added on both sides myViewPort = Boundary(); myViewPort.add(Position(xPos, yPos)); myViewPort.growHeight(myOrigHeight / zoomFactor); @@ -263,13 +268,13 @@ void -GUIDanielPerspectiveChanger::setViewportFrom(SUMOReal xPos, SUMOReal yPos, SUMOReal zPos) { +GUIDanielPerspectiveChanger::setViewportFrom(double xPos, double yPos, double zPos) { setViewport(zPos2Zoom(zPos), xPos, yPos); } void -GUIDanielPerspectiveChanger::changeCanvassLeft(int change) { +GUIDanielPerspectiveChanger::changeCanvasSizeLeft(int change) { myViewPort = Boundary( myViewPort.xmin() - myCallback.p2m(change), myViewPort.ymin(), @@ -280,11 +285,15 @@ long GUIDanielPerspectiveChanger::onKeyPress(void* data) { + // ignore key events in gaming mode + if (gSchemeStorage.getDefault().gaming) { + return 0; + } FXEvent* e = (FXEvent*) data; - SUMOReal zoomDiff = 0.1; - SUMOReal moveX = 0; - SUMOReal moveY = 0; - SUMOReal moveFactor = 1; + double zoomDiff = 0.1; + double moveX = 0; + double moveY = 0; + double moveFactor = 1; bool pageVertical = true; bool ctrl = false; if (e->state & CONTROLMASK) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIDanielPerspectiveChanger.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIDanielPerspectiveChanger.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIDanielPerspectiveChanger.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIDanielPerspectiveChanger.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIDanielPerspectiveChanger.h 21824 2016-10-27 13:03:52Z behrisch $ +/// @version $Id: GUIDanielPerspectiveChanger.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A class that allows to steer the visual output in dependence to /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -74,34 +74,34 @@ long onKeyPress(void* data); /// Returns the rotation of the canvas stored in this changer - virtual SUMOReal getRotation() const; + virtual double getRotation() const; /// Returns the x-offset of the field to show stored in this changer - virtual SUMOReal getXPos() const; + virtual double getXPos() const; /// Returns the y-offset of the field to show stored in this changer - virtual SUMOReal getYPos() const; + virtual double getYPos() const; /// Returns the zoom factor computed stored in this changer - virtual SUMOReal getZoom() const; + virtual double getZoom() const; /// @brief Returns the camera height corresponding to the current zoom factor - virtual SUMOReal getZPos() const; + virtual double getZPos() const; /// @brief Returns the camera height at which the given zoom level is reached - virtual SUMOReal zoom2ZPos(SUMOReal zoom) const; + virtual double zoom2ZPos(double zoom) const; /// @brief Returns the zoom level that is achieved at a given camera height - virtual SUMOReal zPos2Zoom(SUMOReal zPos) const; + virtual double zPos2Zoom(double zPos) const; /// Centers the view to the given position, setting it to a size that covers the radius - void centerTo(const Position& pos, SUMOReal radius, bool applyZoom = true); + void centerTo(const Position& pos, double radius, bool applyZoom = true); /** @brief Sets the viewport */ - void setViewport(SUMOReal zoom, SUMOReal xPos, SUMOReal yPos); + void setViewport(double zoom, double xPos, double yPos); /// @brief Alternative method for setting the viewport - void setViewportFrom(SUMOReal xPos, SUMOReal yPos, SUMOReal zPos); + void setViewportFrom(double xPos, double yPos, double zPos); /* @brief Adapts the viewport so that a change in canvass size keeps most of the * view intact (by showing more / less instead of zooming) @@ -109,7 +109,7 @@ * * @param[in] change The horizontal change in canvas size in pixels */ - void changeCanvassLeft(int change); + void changeCanvasSizeLeft(int change); /* @brief avoid unwanted flicker * @param[in] delay The minimum time delay in nanoseconds after @@ -127,17 +127,17 @@ void move(int xdiff, int ydiff); /// Performs the zooming of the view - void zoom(SUMOReal factor); + void zoom(double factor); /// Performs the rotation of the view void rotate(int diff); private: /// the original viewport dimensions in m which serve as the reference point for 100% zoom - SUMOReal myOrigWidth, myOrigHeight; + double myOrigWidth, myOrigHeight; /// the current rotation - SUMOReal myRotation; + double myRotation; /// the current mouse state int myMouseButtonState; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_EditViewport.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_EditViewport.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_EditViewport.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_EditViewport.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date Mon, 25.04.2005 -/// @version $Id: GUIDialog_EditViewport.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUIDialog_EditViewport.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // A dialog to change the viewport /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,13 +38,10 @@ #include #include "GUISUMOAbstractView.h" #include +#include #include #include "GUIDialog_EditViewport.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping @@ -65,58 +62,71 @@ // =========================================================================== // method definitions // =========================================================================== -GUIDialog_EditViewport::GUIDialog_EditViewport(GUISUMOAbstractView* parent, - const char* name, int x, int y) - : FXDialogBox(parent, name, DECOR_TITLE | DECOR_BORDER, x, y, 0, 0), - myParent(parent) { - FXVerticalFrame* f1 = new FXVerticalFrame(this, LAYOUT_TOP | FRAME_NONE | LAYOUT_FILL_X, 0, 0, 0, 0, 0, 0, 1, 1); - { - FXHorizontalFrame* frame0 = - new FXHorizontalFrame(f1, FRAME_THICK, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2); - new FXButton(frame0, "\t\tLoad viewport from file", - GUIIconSubSys::getIcon(ICON_OPEN_CONFIG), this, GUIDialog_EditViewport::MID_LOAD, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); - new FXButton(frame0, "\t\tSave viewport to file", - GUIIconSubSys::getIcon(ICON_SAVE), this, GUIDialog_EditViewport::MID_SAVE, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); - } - FXMatrix* m1 = new FXMatrix(f1, 2, MATRIX_BY_COLUMNS); - new FXLabel(m1, "Zoom:", 0, LAYOUT_CENTER_Y); - myZoom = new FXRealSpinDial(m1, 16, this, MID_CHANGED, LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK); +GUIDialog_EditViewport::GUIDialog_EditViewport(GUISUMOAbstractView* parent, const char* name, int x, int y) : + FXDialogBox(parent, name, GUIDesignDialogBox, x, y, 0, 0, 0, 0, 0, 0), + myParent(parent) { + // create contents frame + FXVerticalFrame* contentsFrame = new FXVerticalFrame(this, GUIDesignContentsFrame); + // create frame for file icons + FXHorizontalFrame* frameFiles = new FXHorizontalFrame(contentsFrame, GUIDesignHorizontalFrameIcons); + new FXButton(frameFiles, "Load\t\tLoad viewport from file", + GUIIconSubSys::getIcon(ICON_OPEN_CONFIG), this, GUIDialog_EditViewport::MID_LOAD, GUIDesignButtonToolbarWithText); + new FXButton(frameFiles, "Save\t\tSave viewport to file", + GUIIconSubSys::getIcon(ICON_SAVE), this, GUIDialog_EditViewport::MID_SAVE, GUIDesignButtonToolbarWithText); + // create zoom elements + FXHorizontalFrame* zoomFrame = new FXHorizontalFrame(contentsFrame, GUIDesignAuxiliarHorizontalFrame); + new FXLabel(zoomFrame, "Zoom:", 0, GUIDesignLabelLeftThick); + myZoom = new FXRealSpinDial(zoomFrame, 16, this, MID_CHANGED, GUIDesignSpinDial); myZoom->setRange(0.0001, 100000); myZoom->setNumberFormat(4); - new FXLabel(m1, "X:", 0, LAYOUT_CENTER_Y); - myXOff = new FXRealSpinDial(m1, 16, this, MID_CHANGED, LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | SPINDIAL_NOMIN | SPINDIAL_NOMAX); - new FXLabel(m1, "Y:", 0, LAYOUT_CENTER_Y); - myYOff = new FXRealSpinDial(m1, 16, this, MID_CHANGED, LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | SPINDIAL_NOMIN | SPINDIAL_NOMAX); - new FXLabel(m1, "Z:", 0, LAYOUT_CENTER_Y); - myZOff = new FXRealSpinDial(m1, 16, this, MID_CHANGED, LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | SPINDIAL_NOMIN | SPINDIAL_NOMAX); + // create X elements + FXHorizontalFrame* XFrame = new FXHorizontalFrame(contentsFrame, GUIDesignAuxiliarHorizontalFrame); + new FXLabel(XFrame, "X:", 0, GUIDesignLabelLeftThick); + myXOff = new FXRealSpinDial(XFrame, 16, this, MID_CHANGED, GUIDesignSpinDial | SPINDIAL_NOMIN | SPINDIAL_NOMAX); + // create Y elements + FXHorizontalFrame* YFrame = new FXHorizontalFrame(contentsFrame, GUIDesignAuxiliarHorizontalFrame); + new FXLabel(YFrame, "Y:", 0, GUIDesignLabelLeftThick); + myYOff = new FXRealSpinDial(YFrame, 16, this, MID_CHANGED, GUIDesignSpinDial | SPINDIAL_NOMIN | SPINDIAL_NOMAX); + // create Z elements + FXHorizontalFrame* ZFrame = new FXHorizontalFrame(contentsFrame, GUIDesignAuxiliarHorizontalFrame); + new FXLabel(ZFrame, "Z:", 0, GUIDesignLabelLeftThick); + myZOff = new FXRealSpinDial(ZFrame, 16, this, MID_CHANGED, GUIDesignSpinDial | SPINDIAL_NOMIN | SPINDIAL_NOMAX); #ifdef HAVE_OSG - new FXLabel(m1, "LookAtX:", 0, LAYOUT_CENTER_Y); - myLookAtX = new FXRealSpinDial(m1, 16, this, MID_CHANGED, LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | SPINDIAL_NOMIN | SPINDIAL_NOMAX); - new FXLabel(m1, "LookAtY:", 0, LAYOUT_CENTER_Y); - myLookAtY = new FXRealSpinDial(m1, 16, this, MID_CHANGED, LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | SPINDIAL_NOMIN | SPINDIAL_NOMAX); - new FXLabel(m1, "LookAtZ:", 0, LAYOUT_CENTER_Y); - myLookAtZ = new FXRealSpinDial(m1, 16, this, MID_CHANGED, LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | SPINDIAL_NOMIN | SPINDIAL_NOMAX); + FXHorizontalFrame* lookAtXFrame = new FXHorizontalFrame(contentsFrame, GUIDesignAuxiliarHorizontalFrame); + new FXLabel(lookAtXFrame, "LookAtX:", 0, GUIDesignLabelLeftThick); + myLookAtX = new FXRealSpinDial(lookAtXFrame, 16, this, MID_CHANGED, GUIDesignSpinDial | SPINDIAL_NOMIN | SPINDIAL_NOMAX); + FXHorizontalFrame* lookAtYFrame = new FXHorizontalFrame(contentsFrame, GUIDesignAuxiliarHorizontalFrame); + new FXLabel(lookAtYFrame, "LookAtY:", 0, GUIDesignLabelLeftThick); + myLookAtY = new FXRealSpinDial(lookAtYFrame, 16, this, MID_CHANGED, GUIDesignSpinDial | SPINDIAL_NOMIN | SPINDIAL_NOMAX); + FXHorizontalFrame* lookAtZFrame = new FXHorizontalFrame(contentsFrame, GUIDesignAuxiliarHorizontalFrame); + new FXLabel(lookAtZFrame, "LookAtZ:", 0, GUIDesignLabelLeftThick); + myLookAtZ = new FXRealSpinDial(lookAtZFrame, 16, this, MID_CHANGED, GUIDesignSpinDial | SPINDIAL_NOMIN | SPINDIAL_NOMAX); + // update width of dialog for the new elements + setHeight(257); #endif - // ok/cancel - new FXHorizontalSeparator(f1, SEPARATOR_GROOVE | LAYOUT_FILL_X); - FXHorizontalFrame* f6 = new FXHorizontalFrame(f1, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 10, 10, 5, 0); - FXButton* initial = - new FXButton(f6, "&OK", NULL, this, GUIDialog_EditViewport::MID_OK, - BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, - 0, 0, 0, 0, 4, 4, 3, 3); - new FXButton(f6, "&Cancel", NULL, this, GUIDialog_EditViewport::MID_CANCEL, - FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, - 0, 0, 0, 0, 4, 4, 3, 3); - initial->setFocus(); - setIcon(GUIIconSubSys::getIcon(ICON_EMPTY)); + // create buttons ok/cancel + new FXHorizontalSeparator(contentsFrame, GUIDesignHorizontalSeparator); + FXHorizontalFrame* frameButtons = new FXHorizontalFrame(contentsFrame, GUIDesignAuxiliarHorizontalFrame); + new FXHorizontalFrame(frameButtons, GUIDesignAuxiliarHorizontalFrame); + buttonOk = new FXButton(frameButtons, "&OK\t\taccept", GUIIconSubSys::getIcon(ICON_ACCEPT), this, GUIDialog_EditViewport::MID_OK, GUIDesignButtonOK); + new FXButton(frameButtons, "&Cancel\t\tclose", GUIIconSubSys::getIcon(ICON_CANCEL), this, GUIDialog_EditViewport::MID_CANCEL, GUIDesignButtonCancel); + new FXHorizontalFrame(frameButtons, GUIDesignAuxiliarHorizontalFrame); + // set dialog icon + setIcon(GUIIconSubSys::getIcon(ICON_EDITVIEWPORT)); } GUIDialog_EditViewport::~GUIDialog_EditViewport() {} +void +GUIDialog_EditViewport::show() { + // set focus in OK button before opening + buttonOk->setFocus(); + FXDialogBox::show(); +} + + long GUIDialog_EditViewport::onCmdOk(FXObject*, FXSelector, void*) { myParent->setViewportFromTo(Position(myXOff->getValue(), myYOff->getValue(), myZOff->getValue()), @@ -158,7 +168,7 @@ long -GUIDialog_EditViewport::onCmdLoad(FXObject*, FXSelector, void* /*data*/) { +GUIDialog_EditViewport::onCmdLoad(FXObject*, FXSelector, void*) { FXFileDialog opendialog(this, "Load Viewport"); opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY)); opendialog.setSelectMode(SELECTFILE_ANY); @@ -177,7 +187,7 @@ long -GUIDialog_EditViewport::onCmdSave(FXObject*, FXSelector, void* /*data*/) { +GUIDialog_EditViewport::onCmdSave(FXObject*, FXSelector, void*) { FXString file = MFXUtils::getFilename2Write(this, "Save Viewport", ".xml", GUIIconSubSys::getIcon(ICON_EMPTY), gCurrentFolder); if (file == "") { return 1; @@ -210,7 +220,7 @@ } void -GUIDialog_EditViewport::setValues(SUMOReal zoom, SUMOReal xoff, SUMOReal yoff) { +GUIDialog_EditViewport::setValues(double zoom, double xoff, double yoff) { myZoom->setValue(zoom); myXOff->setValue(xoff); myYOff->setValue(yoff); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_EditViewport.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_EditViewport.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_EditViewport.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_EditViewport.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2005-05-04 -/// @version $Id: GUIDialog_EditViewport.h 21186 2016-07-18 12:04:16Z namdre $ +/// @version $Id: GUIDialog_EditViewport.h 24093 2017-04-27 12:40:06Z palcraft $ /// // A dialog to change the viewport /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,7 +34,6 @@ #include #include - // =========================================================================== // class declarations // =========================================================================== @@ -69,14 +68,13 @@ * @param[in] x x-position to show the dialog at * @param[in] y y-position to show the dialog at */ - GUIDialog_EditViewport(GUISUMOAbstractView* parent, const char* name, - int x, int y); - + GUIDialog_EditViewport(GUISUMOAbstractView* parent, const char* name, int x, int y); /// @brief Destructor ~GUIDialog_EditViewport(); - + /// @brief overload show function to focus always in OK Button + void show(); /// @name FOX-callbacks /// @{ @@ -105,8 +103,7 @@ * @param[in] xoff Current view's x-offset * @param[in] yoff Current view's y-offset */ - void setValues(SUMOReal zoom, SUMOReal xoff, SUMOReal yoff); - + void setValues(double zoom, double xoff, double yoff); /** @brief Sets the given values into the dialog * @param[in] lookFrom Current viewport's from @@ -114,14 +111,12 @@ */ void setValues(const Position& lookFrom, const Position& lookAt); - /** @brief Resets old values * @param[in] lookFrom Current viewport's from * @param[in] lookAt Current viewport's at */ void setOldValues(const Position& lookFrom, const Position& lookAt); - /** @brief Returns the information whether one of the spin dialers is grabbed * @return Whether the spin dialers are currently used */ @@ -138,6 +133,9 @@ /// @brief The spin dialers used to change the view FXRealSpinDial* myZoom, *myXOff, *myYOff, *myZOff; + /// @brief OK button + FXButton* buttonOk; + #ifdef HAVE_OSG /// @brief The spin dialers used to change the view at (osg only) FXRealSpinDial* myLookAtX, *myLookAtY, *myLookAtZ; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_GLObjChooser.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_GLObjChooser.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_GLObjChooser.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_GLObjChooser.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIDialog_GLObjChooser.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIDialog_GLObjChooser.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Class for the window that allows to choose a street, junction or vehicle /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,13 +40,10 @@ #include #include #include +#include #include #include "GUIDialog_GLObjChooser.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping @@ -58,6 +55,7 @@ FXMAPFUNC(SEL_COMMAND, MID_CHOOSER_TEXT, GUIDialog_GLObjChooser::onCmdText), FXMAPFUNC(SEL_KEYPRESS, MID_CHOOSER_LIST, GUIDialog_GLObjChooser::onListKeyPress), FXMAPFUNC(SEL_COMMAND, MID_CHOOSER_FILTER, GUIDialog_GLObjChooser::onCmdFilter), + FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_INVERT, GUIDialog_GLObjChooser::onCmdToggleSelection), }; FXIMPLEMENT(GUIDialog_GLObjChooser, FXMainWindow, GUIDialog_GLObjChooserMap, ARRAYNUMBER(GUIDialog_GLObjChooserMap)) @@ -97,11 +95,14 @@ myCenterButton = new FXButton(layout, "Center\t\t", GUIIconSubSys::getIcon(ICON_RECENTERVIEW), this, MID_CHOOSER_CENTER, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 4, 4); - new FXHorizontalSeparator(layout, SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXHorizontalSeparator(layout, GUIDesignHorizontalSeparator); new FXButton(layout, "&Hide Unselected\t\t", GUIIconSubSys::getIcon(ICON_FLAG), this, MID_CHOOSER_FILTER, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 4, 4); - new FXHorizontalSeparator(layout, SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXButton(layout, "&Select/deselect\tSelect/deselect current object\t", GUIIconSubSys::getIcon(ICON_FLAG), + this, MID_CHOOSEN_INVERT, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, + 0, 0, 0, 0, 4, 4, 4, 4); + new FXHorizontalSeparator(layout, GUIDesignHorizontalSeparator); new FXButton(layout, "&Close\t\t", GUIIconSubSys::getIcon(ICON_NO), this, MID_CANCEL, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED, 0, 0, 0, 0, 4, 4, 4, 4); @@ -205,6 +206,24 @@ return 1; } +long +GUIDialog_GLObjChooser::onCmdToggleSelection(FXObject*, FXSelector, void*) { + FXIcon* flag = GUIIconSubSys::getIcon(ICON_FLAG); + int i = myList->getCurrentItem(); + if (i >= 0) { + GUIGlID* glID = static_cast(myList->getItemData(i)); + gSelected.toggleSelection(*glID); + if (myList->getItemIcon(i) == flag) { + myList->setItemIcon(i, 0); + } else { + myList->setItemIcon(i, flag); + } + } + myList->update(); + myParent->getView()->update(); + return 1; +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_GLObjChooser.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_GLObjChooser.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_GLObjChooser.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_GLObjChooser.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIDialog_GLObjChooser.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIDialog_GLObjChooser.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Class for the window that allows to choose a street, junction or vehicle /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -105,6 +105,9 @@ /// @brief Callback: Hides unselected items if pressed long onCmdFilter(FXObject*, FXSelector, void*); + + /// @brief Callback: Toggle selection status of current object + long onCmdToggleSelection(FXObject*, FXSelector, void*); /// @} /// @brief sets the focus after the window is created to work-around bug in libfox diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_ViewSettings.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_ViewSettings.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_ViewSettings.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_ViewSettings.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Wed, 21. Dec 2005 -/// @version $Id: GUIDialog_ViewSettings.cpp 21625 2016-10-06 12:18:47Z namdre $ +/// @version $Id: GUIDialog_ViewSettings.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The dialog to change the view (gui) settings. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,36 +43,33 @@ #include #include #include +#include #include #include #include #include "GUIDialog_EditViewport.h" #include "GUIDialog_ViewSettings.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping // =========================================================================== FXDEFMAP(GUIDialog_ViewSettings) GUIDialog_ViewSettingsMap[] = { - FXMAPFUNC(SEL_CHANGED, MID_SIMPLE_VIEW_COLORCHANGE, GUIDialog_ViewSettings::onCmdColorChange), - FXMAPFUNC(SEL_COMMAND, MID_SIMPLE_VIEW_COLORCHANGE, GUIDialog_ViewSettings::onCmdColorChange), - FXMAPFUNC(SEL_COMMAND, MID_SIMPLE_VIEW_NAMECHANGE, GUIDialog_ViewSettings::onCmdNameChange), - FXMAPFUNC(SEL_COMMAND, MID_SETTINGS_OK, GUIDialog_ViewSettings::onCmdOk), - FXMAPFUNC(SEL_COMMAND, MID_SETTINGS_CANCEL, GUIDialog_ViewSettings::onCmdCancel), + FXMAPFUNC(SEL_CHANGED, MID_SIMPLE_VIEW_COLORCHANGE, GUIDialog_ViewSettings::onCmdColorChange), + FXMAPFUNC(SEL_COMMAND, MID_SIMPLE_VIEW_COLORCHANGE, GUIDialog_ViewSettings::onCmdColorChange), + FXMAPFUNC(SEL_COMMAND, MID_SIMPLE_VIEW_NAMECHANGE, GUIDialog_ViewSettings::onCmdNameChange), + FXMAPFUNC(SEL_COMMAND, MID_SETTINGS_OK, GUIDialog_ViewSettings::onCmdOk), + FXMAPFUNC(SEL_COMMAND, MID_SETTINGS_CANCEL, GUIDialog_ViewSettings::onCmdCancel), FXMAPFUNC(SEL_CHANGED, MFXAddEditTypedTable::ID_TEXT_CHANGED, GUIDialog_ViewSettings::onCmdEditTable), - FXMAPFUNC(SEL_COMMAND, MID_SIMPLE_VIEW_SAVE, GUIDialog_ViewSettings::onCmdSaveSetting), - FXMAPFUNC(SEL_UPDATE, MID_SIMPLE_VIEW_SAVE, GUIDialog_ViewSettings::onUpdSaveSetting), - FXMAPFUNC(SEL_COMMAND, MID_SIMPLE_VIEW_DELETE, GUIDialog_ViewSettings::onCmdDeleteSetting), - FXMAPFUNC(SEL_UPDATE, MID_SIMPLE_VIEW_DELETE, GUIDialog_ViewSettings::onUpdDeleteSetting), - FXMAPFUNC(SEL_COMMAND, MID_SIMPLE_VIEW_EXPORT, GUIDialog_ViewSettings::onCmdExportSetting), - FXMAPFUNC(SEL_UPDATE, MID_SIMPLE_VIEW_EXPORT, GUIDialog_ViewSettings::onUpdExportSetting), - FXMAPFUNC(SEL_COMMAND, MID_SIMPLE_VIEW_IMPORT, GUIDialog_ViewSettings::onCmdImportSetting), - FXMAPFUNC(SEL_UPDATE, MID_SIMPLE_VIEW_IMPORT, GUIDialog_ViewSettings::onUpdImportSetting), + FXMAPFUNC(SEL_COMMAND, MID_SIMPLE_VIEW_SAVE, GUIDialog_ViewSettings::onCmdSaveSetting), + FXMAPFUNC(SEL_UPDATE, MID_SIMPLE_VIEW_SAVE, GUIDialog_ViewSettings::onUpdSaveSetting), + FXMAPFUNC(SEL_COMMAND, MID_SIMPLE_VIEW_DELETE, GUIDialog_ViewSettings::onCmdDeleteSetting), + FXMAPFUNC(SEL_UPDATE, MID_SIMPLE_VIEW_DELETE, GUIDialog_ViewSettings::onUpdDeleteSetting), + FXMAPFUNC(SEL_COMMAND, MID_SIMPLE_VIEW_EXPORT, GUIDialog_ViewSettings::onCmdExportSetting), + FXMAPFUNC(SEL_UPDATE, MID_SIMPLE_VIEW_EXPORT, GUIDialog_ViewSettings::onUpdExportSetting), + FXMAPFUNC(SEL_COMMAND, MID_SIMPLE_VIEW_IMPORT, GUIDialog_ViewSettings::onCmdImportSetting), + FXMAPFUNC(SEL_UPDATE, MID_SIMPLE_VIEW_IMPORT, GUIDialog_ViewSettings::onUpdImportSetting), FXMAPFUNC(SEL_COMMAND, MID_SIMPLE_VIEW_LOAD_DECALS, GUIDialog_ViewSettings::onCmdLoadDecals), FXMAPFUNC(SEL_COMMAND, MID_SIMPLE_VIEW_SAVE_DECALS, GUIDialog_ViewSettings::onCmdSaveDecals), @@ -86,24 +83,18 @@ // =========================================================================== // method definitions // =========================================================================== -GUIDialog_ViewSettings::GUIDialog_ViewSettings(GUISUMOAbstractView* parent, - GUIVisualizationSettings* settings, - std::vector* decals, - MFXMutex* decalsLock) : - FXDialogBox(parent, "View Settings", DECOR_TITLE | DECOR_BORDER | DECOR_RESIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), +GUIDialog_ViewSettings::GUIDialog_ViewSettings(GUISUMOAbstractView* parent, GUIVisualizationSettings* settings, std::vector* decals, MFXMutex* decalsLock) : + FXDialogBox(parent, "View Settings", GUIDesignViewSettingsMainDialog), myParent(parent), mySettings(settings), myDecals(decals), myDecalsLock(decalsLock), myDecalsTable(0) { myBackup = (*mySettings); - FXVerticalFrame* contentFrame = - new FXVerticalFrame(this, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, - 0, 0, 0, 0, 0, 0, 0, 0, 2, 2); + FXVerticalFrame* contentFrame = new FXVerticalFrame(this, GUIDesignViewSettingsVerticalFrame1); // { - FXHorizontalFrame* frame0 = - new FXHorizontalFrame(contentFrame, FRAME_THICK, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2); - mySchemeName = new FXComboBox(frame0, 20, this, MID_SIMPLE_VIEW_NAMECHANGE, COMBOBOX_INSERT_LAST | FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_CENTER_Y | COMBOBOX_STATIC); + FXHorizontalFrame* frame0 = new FXHorizontalFrame(contentFrame, GUIDesignViewSettingsHorizontalFrame1); + mySchemeName = new FXComboBox(frame0, 20, this, MID_SIMPLE_VIEW_NAMECHANGE, GUIDesignViewSettingsComboBox1); const std::vector& names = gSchemeStorage.getNames(); for (std::vector::const_iterator i = names.begin(); i != names.end(); ++i) { int index = mySchemeName->appendItem((*i).c_str()); @@ -113,112 +104,77 @@ } mySchemeName->setNumVisible(5); - new FXButton(frame0, "\t\tSave the setting to registry", - GUIIconSubSys::getIcon(ICON_SAVEDB), this, MID_SIMPLE_VIEW_SAVE, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); - new FXButton(frame0, "\t\tRemove the setting from registry", - GUIIconSubSys::getIcon(ICON_REMOVEDB), this, MID_SIMPLE_VIEW_DELETE, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); - new FXButton(frame0, "\t\tExport setting to file", - GUIIconSubSys::getIcon(ICON_SAVE), this, MID_SIMPLE_VIEW_EXPORT, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); - new FXButton(frame0, "\t\tLoad setting from file", - GUIIconSubSys::getIcon(ICON_OPEN_CONFIG), this, MID_SIMPLE_VIEW_IMPORT, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); + new FXButton(frame0, "\t\tSave the setting to registry", GUIIconSubSys::getIcon(ICON_SAVEDB), this, MID_SIMPLE_VIEW_SAVE, GUIDesignButtonToolbar); + new FXButton(frame0, "\t\tRemove the setting from registry", GUIIconSubSys::getIcon(ICON_REMOVEDB), this, MID_SIMPLE_VIEW_DELETE, GUIDesignButtonToolbar); + new FXButton(frame0, "\t\tExport setting to file", GUIIconSubSys::getIcon(ICON_SAVE), this, MID_SIMPLE_VIEW_EXPORT, GUIDesignButtonToolbar); + new FXButton(frame0, "\t\tLoad setting from file", GUIIconSubSys::getIcon(ICON_OPEN_CONFIG), this, MID_SIMPLE_VIEW_IMPORT, GUIDesignButtonToolbar); new FXVerticalSeparator(frame0); - new FXLabel(frame0, "Export includes:", 0, LAYOUT_CENTER_Y); + new FXLabel(frame0, "Export includes:", 0, GUIDesignViewSettingsLabel1); mySaveViewPort = new FXCheckButton(frame0, "Viewport"); mySaveDelay = new FXCheckButton(frame0, "Delay"); mySaveDecals = new FXCheckButton(frame0, "Decals"); } // - FXTabBook* tabbook = - new FXTabBook(contentFrame, 0, 0, TABBOOK_LEFTTABS | PACK_UNIFORM_WIDTH | PACK_UNIFORM_HEIGHT | LAYOUT_FILL_X | LAYOUT_FILL_Y | LAYOUT_RIGHT, - 0, 0, 0, 0, 0, 0, 0, 0); + FXTabBook* tabbook = new FXTabBook(contentFrame, 0, 0, GUIDesignViewSettingsTabBook1); { // tab for the background - new FXTabItem(tabbook, "Background", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4); + new FXTabItem(tabbook, "Background", NULL, GUIDesignViewSettingsTabItemBook1); FXScrollWindow* genScroll = new FXScrollWindow(tabbook); - FXVerticalFrame* frame1 = - new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2); + FXVerticalFrame* frame1 = new FXVerticalFrame(genScroll, GUIDesignViewSettingsVerticalFrame2); - FXMatrix* m11 = - new FXMatrix(frame1, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); - new FXLabel(m11, "Color", 0, LAYOUT_CENTER_Y); - myBackgroundColor = new FXColorWell(m11, MFXUtils::getFXColor(settings->backgroundColor), - this, MID_SIMPLE_VIEW_COLORCHANGE, - LAYOUT_FIX_WIDTH | LAYOUT_CENTER_Y | LAYOUT_SIDE_TOP | FRAME_SUNKEN | FRAME_THICK | ICON_AFTER_TEXT, - 0, 0, 100, 0, 0, 0, 0, 0); + FXMatrix* m11 = new FXMatrix(frame1, 2, GUIDesignMatrixViewSettings); + new FXLabel(m11, "Color", 0, GUIDesignViewSettingsLabel1); + myBackgroundColor = new FXColorWell(m11, MFXUtils::getFXColor(settings->backgroundColor), this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignViewSettingsColorWell); - new FXHorizontalSeparator(frame1, SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXHorizontalSeparator(frame1, GUIDesignHorizontalSeparator); - FXVerticalFrame* frame11 = - new FXVerticalFrame(frame1, LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); + FXVerticalFrame* frame11 = new FXVerticalFrame(frame1, GUIDesignViewSettingsVerticalFrame3); new FXLabel(frame11, "Decals:"); myDecalsFrame = new FXVerticalFrame(frame11); - FXHorizontalFrame* frame111 = new FXHorizontalFrame(frame11, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 10, 10, 5, 5); - new FXButton(frame111, "&Load Decals", NULL, this, MID_SIMPLE_VIEW_LOAD_DECALS, BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 20, 20, 4, 4); - new FXButton(frame111, "&Save Decals", NULL, this, MID_SIMPLE_VIEW_SAVE_DECALS, BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 20, 20, 4, 4); - - new FXHorizontalSeparator(frame1, SEPARATOR_GROOVE | LAYOUT_FILL_X); - - FXMatrix* m12 = - new FXMatrix(frame1, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); - myShowGrid = - new FXCheckButton(m12, "Show grid", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL); + FXHorizontalFrame* frame111 = new FXHorizontalFrame(frame11, GUIDesignViewSettingsHorizontalFrame2); + new FXButton(frame111, "&Load Decals", NULL, this, MID_SIMPLE_VIEW_LOAD_DECALS, GUIDesignViewSettingsButton1); + new FXButton(frame111, "&Save Decals", NULL, this, MID_SIMPLE_VIEW_SAVE_DECALS, GUIDesignViewSettingsButton1); + + new FXHorizontalSeparator(frame1, GUIDesignHorizontalSeparator); + + FXMatrix* m12 = new FXMatrix(frame1, 2, GUIDesignViewSettingsMatrix1); + myShowGrid = new FXCheckButton(m12, "Show grid", this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignCheckButton); myShowGrid->setCheck(mySettings->showGrid); new FXLabel(m12, ""); - FXMatrix* m121 = - new FXMatrix(m12, 2, LAYOUT_CENTER_Y | LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 0, 0, 5, 5); - new FXLabel(m121, "x-spacing", 0, LAYOUT_CENTER_Y); - myGridXSizeDialer = - new FXRealSpinDial(m121, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, - LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK); + FXMatrix* m121 = new FXMatrix(m12, 2, GUIDesignViewSettingsMatrix2); + new FXLabel(m121, "x-spacing", 0, GUIDesignViewSettingsLabel1); + myGridXSizeDialer = new FXRealSpinDial(m121, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignViewSettingsSpinDial1); myGridXSizeDialer->setRange(1, 10000); myGridXSizeDialer->setValue(mySettings->gridXSize); - FXMatrix* m122 = - new FXMatrix(m12, 2, LAYOUT_CENTER_Y | LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 0, 0, 5, 5); - new FXLabel(m122, "y-spacing", 0, LAYOUT_CENTER_Y); - myGridYSizeDialer = - new FXRealSpinDial(m122, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, - LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK); + FXMatrix* m122 = new FXMatrix(m12, 2, GUIDesignViewSettingsMatrix2); + new FXLabel(m122, "y-spacing", 0, GUIDesignViewSettingsLabel1); + myGridYSizeDialer = new FXRealSpinDial(m122, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignViewSettingsSpinDial1); myGridYSizeDialer->setRange(1, 10000); myGridYSizeDialer->setValue(mySettings->gridXSize); } { // tab for the streets - new FXTabItem(tabbook, "Streets", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4); + new FXTabItem(tabbook, "Streets", NULL, GUIDesignViewSettingsTabItemBook1); FXScrollWindow* genScroll = new FXScrollWindow(tabbook); - FXVerticalFrame* frame2 = - new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2); + FXVerticalFrame* frame2 = new FXVerticalFrame(genScroll, GUIDesignViewSettingsVerticalFrame2); // ... color settings - FXVerticalFrame* frame22 = - new FXVerticalFrame(frame2, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2); - FXMatrix* m21 = - new FXMatrix(frame22, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 2, 5, 5); - new FXLabel(m21, "Color", 0, LAYOUT_CENTER_Y); - myLaneEdgeColorMode = new FXComboBox(m21, 30, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC); - myLaneColorInterpolation = new FXCheckButton(m21, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL); - myLaneColorSettingFrame = new FXVerticalFrame(frame22, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2); + FXVerticalFrame* frame22 = new FXVerticalFrame(frame2, GUIDesignViewSettingsVerticalFrame6); + FXMatrix* m21 = new FXMatrix(frame22, 3, GUIDesignViewSettingsMatrix3); + new FXLabel(m21, "Color", 0, GUIDesignViewSettingsLabel1); + myLaneEdgeColorMode = new FXComboBox(m21, 30, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignComboBoxStatic); + myLaneColorInterpolation = new FXCheckButton(m21, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignCheckButton); + myLaneColorSettingFrame = new FXVerticalFrame(frame22, GUIDesignViewSettingsVerticalFrame4); - new FXHorizontalSeparator(frame2, SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXHorizontalSeparator(frame2, GUIDesignHorizontalSeparator); // ... scale settings - FXVerticalFrame* frame23 = - new FXVerticalFrame(frame2, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2); - FXMatrix* m23 = - new FXMatrix(frame23, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 2, 5, 5); - new FXLabel(m23, "Scale width", 0, LAYOUT_CENTER_Y); - myLaneEdgeScaleMode = new FXComboBox(m23, 30, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC); - myLaneScaleInterpolation = new FXCheckButton(m23, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL); - myLaneScaleSettingFrame = new FXVerticalFrame(frame23, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2); + FXVerticalFrame* frame23 = new FXVerticalFrame(frame2, GUIDesignViewSettingsVerticalFrame6); + FXMatrix* m23 = new FXMatrix(frame23, 3, GUIDesignViewSettingsMatrix3); + new FXLabel(m23, "Scale width", 0, GUIDesignViewSettingsLabel1); + myLaneEdgeScaleMode = new FXComboBox(m23, 30, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignComboBoxStatic); + myLaneScaleInterpolation = new FXCheckButton(m23, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignCheckButton); + myLaneScaleSettingFrame = new FXVerticalFrame(frame23, GUIDesignViewSettingsVerticalFrame4); if (GUIVisualizationSettings::UseMesoSim) { mySettings->edgeColorer.fill(*myLaneEdgeColorMode); @@ -232,42 +188,36 @@ myLaneEdgeScaleMode->setNumVisible((int)mySettings->laneScaler.size()); } - new FXHorizontalSeparator(frame2, SEPARATOR_GROOVE | LAYOUT_FILL_X); - FXMatrix* m22 = - new FXMatrix(frame2, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); + new FXHorizontalSeparator(frame2, GUIDesignHorizontalSeparator); + FXMatrix* m22 = new FXMatrix(frame2, 2, GUIDesignViewSettingsMatrix1); myShowLaneBorders = new FXCheckButton(m22, "Show lane borders", this, MID_SIMPLE_VIEW_COLORCHANGE); myShowLaneBorders->setCheck(mySettings->laneShowBorders); - new FXLabel(m22, " ", 0, LAYOUT_CENTER_Y); + new FXLabel(m22, " ", 0, GUIDesignViewSettingsLabel1); myShowLaneDecals = new FXCheckButton(m22, "Show turning arrows", this, MID_SIMPLE_VIEW_COLORCHANGE); myShowLaneDecals->setCheck(mySettings->showLinkDecals); - new FXLabel(m22, " ", 0, LAYOUT_CENTER_Y); + new FXLabel(m22, " ", 0, GUIDesignViewSettingsLabel1); myShowLinkRules = new FXCheckButton(m22, "Show right-of-way rules", this, MID_SIMPLE_VIEW_COLORCHANGE); myShowLinkRules->setCheck(mySettings->showLinkRules); - new FXLabel(m22, " ", 0, LAYOUT_CENTER_Y); + new FXLabel(m22, " ", 0, GUIDesignViewSettingsLabel1); myShowRails = new FXCheckButton(m22, "Show rails", this, MID_SIMPLE_VIEW_COLORCHANGE); myShowRails->setCheck(mySettings->showRails); - new FXLabel(m22, " ", 0, LAYOUT_CENTER_Y); + new FXLabel(m22, " ", 0, GUIDesignViewSettingsLabel1); myHideMacroConnectors = new FXCheckButton(m22, "Hide macro connectors", this, MID_SIMPLE_VIEW_COLORCHANGE); myHideMacroConnectors->setCheck(mySettings->hideConnectors); - new FXLabel(m22, " ", 0, LAYOUT_CENTER_Y); + new FXLabel(m22, " ", 0, GUIDesignViewSettingsLabel1); myShowLaneDirection = new FXCheckButton(m22, "Show lane direction", this, MID_SIMPLE_VIEW_COLORCHANGE); myShowLaneDirection->setCheck(mySettings->showLaneDirection); - new FXLabel(m22, " ", 0, LAYOUT_CENTER_Y); + new FXLabel(m22, " ", 0, GUIDesignViewSettingsLabel1); myShowSublanes = new FXCheckButton(m22, "Show sublanes", this, MID_SIMPLE_VIEW_COLORCHANGE); myShowSublanes->setCheck(mySettings->showSublanes); - new FXLabel(m22, " ", 0, LAYOUT_CENTER_Y); - new FXLabel(m22, "Exaggerate width by", 0, LAYOUT_CENTER_Y); - myLaneWidthUpscaleDialer = - new FXRealSpinDial(m22, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, - LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK); + new FXLabel(m22, " ", 0, GUIDesignViewSettingsLabel1); + new FXLabel(m22, "Exaggerate width by", 0, GUIDesignViewSettingsLabel1); + myLaneWidthUpscaleDialer = new FXRealSpinDial(m22, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignViewSettingsSpinDial2); myLaneWidthUpscaleDialer->setRange(0, 10000); myLaneWidthUpscaleDialer->setValue(mySettings->laneWidthExaggeration); - new FXLabel(m22, "Minimum size", 0, LAYOUT_CENTER_Y); - myLaneMinWidthDialer = - new FXRealSpinDial(m22, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, - LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK); + new FXLabel(m22, "Minimum size", 0, GUIDesignViewSettingsLabel1); + myLaneMinWidthDialer = new FXRealSpinDial(m22, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignViewSettingsSpinDial2); myLaneMinWidthDialer->setRange(0, 10000); myLaneMinWidthDialer->setValue(mySettings->laneMinSize); @@ -277,16 +227,13 @@ } { // vehicles - new FXTabItem(tabbook, "Vehicles", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4); + new FXTabItem(tabbook, "Vehicles", NULL, GUIDesignViewSettingsTabItemBook1); FXScrollWindow* genScroll = new FXScrollWindow(tabbook); - FXVerticalFrame* frame3 = - new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2); + FXVerticalFrame* frame3 = new FXVerticalFrame(genScroll, GUIDesignViewSettingsVerticalFrame2); - FXMatrix* m31 = - new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 2, 5, 5); - new FXLabel(m31, "Show As", 0, LAYOUT_CENTER_Y); - myVehicleShapeDetail = new FXComboBox(m31, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC); + FXMatrix* m31 = new FXMatrix(frame3, 2, GUIDesignViewSettingsMatrix3); + new FXLabel(m31, "Show As", 0, GUIDesignViewSettingsLabel1); + myVehicleShapeDetail = new FXComboBox(m31, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignComboBoxStatic); myVehicleShapeDetail->appendItem("'triangles'"); myVehicleShapeDetail->appendItem("'boxes'"); myVehicleShapeDetail->appendItem("'simple shapes'"); @@ -294,38 +241,33 @@ myVehicleShapeDetail->setNumVisible(4); myVehicleShapeDetail->setCurrentItem(settings->vehicleQuality); - new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXHorizontalSeparator(frame3, GUIDesignHorizontalSeparator); - FXMatrix* m32 = - new FXMatrix(frame3, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 2, 5, 5); - new FXLabel(m32, "Color", 0, LAYOUT_CENTER_Y); - myVehicleColorMode = new FXComboBox(m32, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC); + FXMatrix* m32 = new FXMatrix(frame3, 3, GUIDesignViewSettingsMatrix3); + new FXLabel(m32, "Color", 0, GUIDesignViewSettingsLabel1); + myVehicleColorMode = new FXComboBox(m32, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignComboBoxStatic); mySettings->vehicleColorer.fill(*myVehicleColorMode); myVehicleColorMode->setNumVisible((int)mySettings->vehicleColorer.size()); - myVehicleColorInterpolation = new FXCheckButton(m32, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL); + myVehicleColorInterpolation = new FXCheckButton(m32, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignCheckButton); - myVehicleColorSettingFrame = - new FXVerticalFrame(frame3, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2); + myVehicleColorSettingFrame = new FXVerticalFrame(frame3, GUIDesignViewSettingsVerticalFrame4); - new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXHorizontalSeparator(frame3, GUIDesignHorizontalSeparator); - FXMatrix* m33 = - new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); + FXMatrix* m33 = new FXMatrix(frame3, 2, GUIDesignMatrixViewSettings); myShowBlinker = new FXCheckButton(m33, "Show blinker / brake lights", this, MID_SIMPLE_VIEW_COLORCHANGE); myShowBlinker->setCheck(mySettings->showBlinker); - new FXLabel(m33, " ", 0, LAYOUT_CENTER_Y); + new FXLabel(m33, " ", 0, GUIDesignViewSettingsLabel1); myShowMinGap = new FXCheckButton(m33, "Show minimum gap", this, MID_SIMPLE_VIEW_COLORCHANGE); myShowMinGap->setCheck(mySettings->drawMinGap); - new FXLabel(m33, " ", 0, LAYOUT_CENTER_Y); + new FXLabel(m33, " ", 0, GUIDesignViewSettingsLabel1); myShowBTRange = new FXCheckButton(m33, "Show Bluetooth range", this, MID_SIMPLE_VIEW_COLORCHANGE); myShowBTRange->setCheck(mySettings->showBTRange); - new FXLabel(m33, " ", 0, LAYOUT_CENTER_Y); + new FXLabel(m33, " ", 0, GUIDesignViewSettingsLabel1); /* myShowLaneChangePreference = new FXCheckButton(m33, "Show lane change preference", this, MID_SIMPLE_VIEW_COLORCHANGE); myShowLaneChangePreference->setCheck(mySettings->drawLaneChangePreference); - new FXLabel(m33, " ", 0, LAYOUT_CENTER_Y); + new FXLabel(m33, " ", 0, GUIDesignViewSettingsLabel1); */ myVehicleNamePanel = new NamePanel(m33, this, "Show vehicle name", mySettings->vehicleName); /* @@ -335,26 +277,20 @@ tmpc->disable(); */ - new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXHorizontalSeparator(frame3, GUIDesignHorizontalSeparator); - FXMatrix* m34 = - new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); + FXMatrix* m34 = new FXMatrix(frame3, 2, GUIDesignViewSettingsMatrix1); myVehicleSizePanel = new SizePanel(m34, this, mySettings->vehicleSize); } - { // persons - new FXTabItem(tabbook, "Persons", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4); + new FXTabItem(tabbook, "Persons", NULL, GUIDesignViewSettingsTabItemBook1); FXScrollWindow* genScroll = new FXScrollWindow(tabbook); - FXVerticalFrame* frame3 = - new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2); + FXVerticalFrame* frame3 = new FXVerticalFrame(genScroll, GUIDesignViewSettingsVerticalFrame2); - FXMatrix* m101 = - new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 2, 5, 5); - new FXLabel(m101, "Show As", 0, LAYOUT_CENTER_Y); - myPersonShapeDetail = new FXComboBox(m101, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC); + FXMatrix* m101 = new FXMatrix(frame3, 2, GUIDesignViewSettingsMatrix3); + new FXLabel(m101, "Show As", 0, GUIDesignViewSettingsLabel1); + myPersonShapeDetail = new FXComboBox(m101, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignComboBoxStatic); myPersonShapeDetail->appendItem("'triangles'"); myPersonShapeDetail->appendItem("'boxes'"); myPersonShapeDetail->appendItem("'simple shapes'"); @@ -362,47 +298,36 @@ myPersonShapeDetail->setNumVisible(4); myPersonShapeDetail->setCurrentItem(settings->personQuality); - new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXHorizontalSeparator(frame3, GUIDesignHorizontalSeparator); - FXMatrix* m102 = - new FXMatrix(frame3, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 2, 5, 5); - new FXLabel(m102, "Color", 0, LAYOUT_CENTER_Y); - myPersonColorMode = new FXComboBox(m102, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC); + FXMatrix* m102 = new FXMatrix(frame3, 3, GUIDesignViewSettingsMatrix3); + new FXLabel(m102, "Color", 0, GUIDesignViewSettingsLabel1); + myPersonColorMode = new FXComboBox(m102, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignComboBoxStatic); mySettings->personColorer.fill(*myPersonColorMode); myPersonColorMode->setNumVisible(10); - myPersonColorInterpolation = new FXCheckButton(m102, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL); + myPersonColorInterpolation = new FXCheckButton(m102, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignCheckButton); - myPersonColorSettingFrame = - new FXVerticalFrame(frame3, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2); + myPersonColorSettingFrame = new FXVerticalFrame(frame3, GUIDesignViewSettingsVerticalFrame4); - new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXHorizontalSeparator(frame3, GUIDesignHorizontalSeparator); - FXMatrix* m103 = - new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); + FXMatrix* m103 = new FXMatrix(frame3, 2, GUIDesignMatrixViewSettings); myPersonNamePanel = new NamePanel(m103, this, "Show person name", mySettings->personName); - new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXHorizontalSeparator(frame3, GUIDesignHorizontalSeparator); - FXMatrix* m104 = - new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); + FXMatrix* m104 = new FXMatrix(frame3, 2, GUIDesignViewSettingsMatrix1); myPersonSizePanel = new SizePanel(m104, this, mySettings->personSize); } - { // containers - new FXTabItem(tabbook, "Containers", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4); + new FXTabItem(tabbook, "Containers", NULL, GUIDesignViewSettingsTabItemBook1); FXScrollWindow* genScroll = new FXScrollWindow(tabbook); - FXVerticalFrame* frame3 = - new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2); + FXVerticalFrame* frame3 = new FXVerticalFrame(genScroll, GUIDesignViewSettingsVerticalFrame2); - FXMatrix* m101 = - new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 2, 5, 5); - new FXLabel(m101, "Show As", 0, LAYOUT_CENTER_Y); - myContainerShapeDetail = new FXComboBox(m101, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC); + FXMatrix* m101 = new FXMatrix(frame3, 2, GUIDesignViewSettingsMatrix3); + new FXLabel(m101, "Show As", 0, GUIDesignViewSettingsLabel1); + myContainerShapeDetail = new FXComboBox(m101, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignComboBoxStatic); myContainerShapeDetail->appendItem("'triangles'"); myContainerShapeDetail->appendItem("'boxes'"); myContainerShapeDetail->appendItem("'simple shapes'"); @@ -410,61 +335,48 @@ myContainerShapeDetail->setNumVisible(4); myContainerShapeDetail->setCurrentItem(settings->containerQuality); - new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXHorizontalSeparator(frame3, GUIDesignHorizontalSeparator); - FXMatrix* m102 = - new FXMatrix(frame3, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 2, 5, 5); - new FXLabel(m102, "Color", 0, LAYOUT_CENTER_Y); - myContainerColorMode = new FXComboBox(m102, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC); + FXMatrix* m102 = new FXMatrix(frame3, 3, GUIDesignViewSettingsMatrix3); + new FXLabel(m102, "Color", 0, GUIDesignViewSettingsLabel1); + myContainerColorMode = new FXComboBox(m102, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignComboBoxStatic); mySettings->containerColorer.fill(*myContainerColorMode); myContainerColorMode->setNumVisible(9); - myContainerColorInterpolation = new FXCheckButton(m102, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL); + myContainerColorInterpolation = new FXCheckButton(m102, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignCheckButton); - myContainerColorSettingFrame = - new FXVerticalFrame(frame3, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2); + myContainerColorSettingFrame = new FXVerticalFrame(frame3, GUIDesignViewSettingsVerticalFrame4); - new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXHorizontalSeparator(frame3, GUIDesignHorizontalSeparator); - FXMatrix* m103 = - new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); + FXMatrix* m103 = new FXMatrix(frame3, 2, GUIDesignMatrixViewSettings); myContainerNamePanel = new NamePanel(m103, this, "Show container name", mySettings->containerName); - new FXHorizontalSeparator(frame3, SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXHorizontalSeparator(frame3, GUIDesignHorizontalSeparator); - FXMatrix* m104 = - new FXMatrix(frame3, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); + FXMatrix* m104 = new FXMatrix(frame3, 2, GUIDesignViewSettingsMatrix1); myContainerSizePanel = new SizePanel(m104, this, mySettings->containerSize); } { // nodes - new FXTabItem(tabbook, "Junctions", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4); + new FXTabItem(tabbook, "Junctions", NULL, GUIDesignViewSettingsTabItemBook1); FXScrollWindow* genScroll = new FXScrollWindow(tabbook); - FXVerticalFrame* frame4 = - new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2); - FXMatrix* m41 = - new FXMatrix(frame4, 3, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 2, 5, 5); - new FXLabel(m41, "Color", 0, LAYOUT_CENTER_Y); - myJunctionColorMode = new FXComboBox(m41, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC); + FXVerticalFrame* frame4 = new FXVerticalFrame(genScroll, GUIDesignViewSettingsVerticalFrame2); + FXMatrix* m41 = new FXMatrix(frame4, 3, GUIDesignViewSettingsMatrix3); + new FXLabel(m41, "Color", 0, GUIDesignViewSettingsLabel1); + myJunctionColorMode = new FXComboBox(m41, 20, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignComboBoxStatic); mySettings->junctionColorer.fill(*myJunctionColorMode); myJunctionColorMode->setNumVisible(3); - myJunctionColorInterpolation = new FXCheckButton(m41, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL); + myJunctionColorInterpolation = new FXCheckButton(m41, "Interpolate", this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignCheckButton); - myJunctionColorSettingFrame = - new FXVerticalFrame(frame4, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 2, 8, 5, 2); + myJunctionColorSettingFrame = new FXVerticalFrame(frame4, GUIDesignViewSettingsVerticalFrame4); - new FXHorizontalSeparator(frame4, SEPARATOR_GROOVE | LAYOUT_FILL_X); - FXMatrix* m42 = - new FXMatrix(frame4, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); + new FXHorizontalSeparator(frame4, GUIDesignHorizontalSeparator); + FXMatrix* m42 = new FXMatrix(frame4, 2, GUIDesignMatrixViewSettings); myTLIndexPanel = new NamePanel(m42, this, "Show link tls index", mySettings->drawLinkTLIndex); myJunctionIndexPanel = new NamePanel(m42, this, "Show link junction index", mySettings->drawLinkJunctionIndex); myShowLane2Lane = new FXCheckButton(m42, "Show lane to lane connections", this, MID_SIMPLE_VIEW_COLORCHANGE); myShowLane2Lane->setCheck(mySettings->showLane2Lane); - new FXLabel(m42, " ", 0, LAYOUT_CENTER_Y); + new FXLabel(m42, " ", 0, GUIDesignViewSettingsLabel1); myJunctionNamePanel = new NamePanel(m42, this, "Show junction name", mySettings->junctionName); myInternalJunctionNamePanel = new NamePanel(m42, this, "Show internal junction name", mySettings->internalJunctionName); myInternalEdgeNamePanel = new NamePanel(m42, this, "Show internal edge name", mySettings->internalEdgeName); @@ -474,103 +386,83 @@ myDrawCrossingsAndWalkingAreas = new FXCheckButton(m42, "Draw crossings/walkingareas", this, MID_SIMPLE_VIEW_COLORCHANGE); myDrawCrossingsAndWalkingAreas->setCheck(mySettings->drawCrossingsAndWalkingareas); - new FXHorizontalSeparator(frame4, SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXHorizontalSeparator(frame4, GUIDesignHorizontalSeparator); - FXMatrix* m43 = - new FXMatrix(frame4, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); + FXMatrix* m43 = new FXMatrix(frame4, 2, GUIDesignViewSettingsMatrix1); myJunctionSizePanel = new SizePanel(m43, this, mySettings->junctionSize); - } { + } + { // detectors / triggers - new FXTabItem(tabbook, "Detectors/Trigger", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4); + new FXTabItem(tabbook, "Detectors/Trigger", NULL, GUIDesignViewSettingsTabItemBook1); FXScrollWindow* genScroll = new FXScrollWindow(tabbook); - FXVerticalFrame* frame5 = - new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2); + FXVerticalFrame* frame5 = new FXVerticalFrame(genScroll, GUIDesignViewSettingsVerticalFrame2); - FXMatrix* m51 = - new FXMatrix(frame5, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); + FXMatrix* m51 = new FXMatrix(frame5, 2, GUIDesignMatrixViewSettings); myAddNamePanel = new NamePanel(m51, this, "Show detector name", mySettings->addName); - new FXHorizontalSeparator(frame5 , SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXHorizontalSeparator(frame5 , GUIDesignHorizontalSeparator); - FXMatrix* m52 = - new FXMatrix(frame5, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); + FXMatrix* m52 = new FXMatrix(frame5, 2, GUIDesignMatrixViewSettings); myAddSizePanel = new SizePanel(m52, this, mySettings->addSize); /* - new FXLabel(m522, "Color", 0, LAYOUT_CENTER_Y); - myDetectorNameColor = new FXColorWell(m522, MFXUtils::getFXColor(settings->addNameColor), - this, MID_SIMPLE_VIEW_COLORCHANGE, - LAYOUT_FIX_WIDTH|LAYOUT_CENTER_Y|LAYOUT_SIDE_TOP|FRAME_SUNKEN|FRAME_THICK|ICON_AFTER_TEXT, - 0, 0, 100, 0, 0, 0, 0, 0); - */ - } { + new FXLabel(m522, "Color", 0, GUIDesignViewSettingsLabel1); + myDetectorNameColor = new FXColorWell(m522, MFXUtils::getFXColor(settings->addNameColor), this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignViewSettingsColorWell3); + */ + } + { // POIs - new FXTabItem(tabbook, "POIs", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4); + new FXTabItem(tabbook, "POIs", NULL, GUIDesignViewSettingsTabItemBook1); FXScrollWindow* genScroll = new FXScrollWindow(tabbook); - FXVerticalFrame* frame6 = - new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2); + FXVerticalFrame* frame6 = new FXVerticalFrame(genScroll, GUIDesignViewSettingsVerticalFrame2); - FXMatrix* m61 = - new FXMatrix(frame6, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); + FXMatrix* m61 = new FXMatrix(frame6, 2, GUIDesignMatrixViewSettings); myPOINamePanel = new NamePanel(m61, this, "Show poi names", mySettings->poiName); myPOITypePanel = new NamePanel(m61, this, "Show poi types", mySettings->poiType); - new FXHorizontalSeparator(frame6 , SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXHorizontalSeparator(frame6 , GUIDesignHorizontalSeparator); - FXMatrix* m62 = - new FXMatrix(frame6, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); + FXMatrix* m62 = new FXMatrix(frame6, 2, GUIDesignMatrixViewSettings); myPOISizePanel = new SizePanel(m62, this, mySettings->poiSize); - } { + } + { // Polygons - new FXTabItem(tabbook, "Polygons", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4); + new FXTabItem(tabbook, "Polygons", NULL, GUIDesignViewSettingsTabItemBook1); FXScrollWindow* genScroll = new FXScrollWindow(tabbook); - FXVerticalFrame* frame9 = - new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2); + FXVerticalFrame* frame9 = new FXVerticalFrame(genScroll, GUIDesignViewSettingsVerticalFrame2); - FXMatrix* m91 = - new FXMatrix(frame9, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); + FXMatrix* m91 = new FXMatrix(frame9, 2, GUIDesignMatrixViewSettings); myPolyNamePanel = new NamePanel(m91, this, "Show polygon names", mySettings->polyName); myPolyTypePanel = new NamePanel(m91, this, "Show polygon types", mySettings->polyType); - new FXHorizontalSeparator(frame9 , SEPARATOR_GROOVE | LAYOUT_FILL_X); + new FXHorizontalSeparator(frame9 , GUIDesignHorizontalSeparator); myPolySizePanel = new SizePanel(m91, this, mySettings->polySize); - - }{ + } + { // Legend - new FXTabItem(tabbook, "Legend", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4); + new FXTabItem(tabbook, "Legend", NULL, GUIDesignViewSettingsTabItemBook1); FXScrollWindow* genScroll = new FXScrollWindow(tabbook); - FXVerticalFrame* frame7 = - new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2); + FXVerticalFrame* frame7 = new FXVerticalFrame(genScroll, GUIDesignViewSettingsVerticalFrame2); - FXMatrix* m72 = - new FXMatrix(frame7, 2, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); + FXMatrix* m72 = new FXMatrix(frame7, 2, GUIDesignMatrixViewSettings); myShowSizeLegend = new FXCheckButton(m72, "Show Size Legend", this, MID_SIMPLE_VIEW_COLORCHANGE); myShowSizeLegend->setCheck(mySettings->showSizeLegend); new FXLabel(m72, ""); - } { + } + { // openGL - new FXTabItem(tabbook, "openGL", NULL, TAB_LEFT_NORMAL, 0, 0, 0, 0, 4, 8, 4, 4); + new FXTabItem(tabbook, "openGL", NULL, GUIDesignViewSettingsTabItemBook1); FXScrollWindow* genScroll = new FXScrollWindow(tabbook); - FXVerticalFrame* frame8 = - new FXVerticalFrame(genScroll, FRAME_THICK | FRAME_RAISED | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2); + FXVerticalFrame* frame8 = new FXVerticalFrame(genScroll, GUIDesignViewSettingsVerticalFrame2); - FXMatrix* m82 = - new FXMatrix(frame8, 1, LAYOUT_FILL_X | LAYOUT_TOP | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 10, 10, 5, 5); + FXMatrix* m82 = new FXMatrix(frame8, 1, GUIDesignMatrixViewSettings); myAntialiase = new FXCheckButton(m82, "Antialiase", this, MID_SIMPLE_VIEW_COLORCHANGE); myAntialiase->setCheck(mySettings->antialiase); myDither = new FXCheckButton(m82, "Dither", this, MID_SIMPLE_VIEW_COLORCHANGE); myDither->setCheck(mySettings->dither); } - FXHorizontalFrame* f2 = new FXHorizontalFrame(contentFrame, LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 10, 10, 5, 5); - FXButton* initial = new FXButton(f2, "&OK", NULL, this, MID_SETTINGS_OK, BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 30, 30, 4, 4); - new FXButton(f2, "&Cancel", NULL, this, MID_SETTINGS_CANCEL, BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 30, 30, 4, 4); + FXHorizontalFrame* f2 = new FXHorizontalFrame(contentFrame, GUIDesignViewSettingsHorizontalFrame2); + FXButton* initial = new FXButton(f2, "&OK", NULL, this, MID_SETTINGS_OK, GUIDesignViewSettingsButton2); + new FXButton(f2, "&Cancel", NULL, this, MID_SETTINGS_CANCEL, GUIDesignViewSettingsButton3); initial->setFocus(); rebuildColorMatrices(false); @@ -612,6 +504,14 @@ void +GUIDialog_ViewSettings::show() { + // update buttons that can be changed externally + myShowGrid->setCheck(mySettings->showGrid); + FXDialogBox::show(); +} + + +void GUIDialog_ViewSettings::setCurrent(GUIVisualizationSettings* settings) { mySettings = settings; myBackup = (*settings); @@ -739,7 +639,7 @@ } } else { if (sender == *threshIt) { - const SUMOReal val = (*threshIt)->getValue(); + const double val = (*threshIt)->getValue(); double lo, hi; if (pos != 0) { threshIt--; @@ -792,7 +692,7 @@ } } else { if (sender == *threshIt) { - const SUMOReal val = (*threshIt)->getValue(); + const double val = (*threshIt)->getValue(); double lo, hi; if (pos != 0) { threshIt--; @@ -844,8 +744,8 @@ tmpSettings.name = mySettings->name; tmpSettings.backgroundColor = MFXUtils::getRGBColor(myBackgroundColor->getRGBA()); tmpSettings.showGrid = (myShowGrid->getCheck() != FALSE); - tmpSettings.gridXSize = (SUMOReal) myGridXSizeDialer->getValue(); - tmpSettings.gridYSize = (SUMOReal) myGridYSizeDialer->getValue(); + tmpSettings.gridXSize = (double) myGridXSizeDialer->getValue(); + tmpSettings.gridYSize = (double) myGridYSizeDialer->getValue(); if (GUIVisualizationSettings::UseMesoSim) { tmpSettings.edgeColorer.setActive(myLaneEdgeColorMode->getCurrentItem()); @@ -865,8 +765,8 @@ tmpSettings.hideConnectors = (myHideMacroConnectors->getCheck() != FALSE); tmpSettings.showLaneDirection = (myShowLaneDirection->getCheck() != FALSE); tmpSettings.showSublanes = (myShowSublanes->getCheck() != FALSE); - tmpSettings.laneWidthExaggeration = (SUMOReal) myLaneWidthUpscaleDialer->getValue(); - tmpSettings.laneMinSize = (SUMOReal) myLaneMinWidthDialer->getValue(); + tmpSettings.laneWidthExaggeration = (double) myLaneWidthUpscaleDialer->getValue(); + tmpSettings.laneMinSize = (double) myLaneMinWidthDialer->getValue(); tmpSettings.vehicleColorer.setActive(myVehicleColorMode->getCurrentItem()); tmpSettings.vehicleQuality = myVehicleShapeDetail->getCurrentItem(); @@ -1104,14 +1004,14 @@ // get the name std::string name = ""; while (name.length() == 0) { - FXDialogBox dialog(this, "Enter a name", DECOR_TITLE | DECOR_BORDER); - FXVerticalFrame* content = new FXVerticalFrame(&dialog, LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10); - new FXLabel(content, "Please enter an alphanumeric name: ", NULL, LAYOUT_FILL_X | JUSTIFY_LEFT); - FXTextField* text = new FXTextField(content, 40, &dialog, FXDialogBox::ID_ACCEPT, TEXTFIELD_ENTER_ONLY | FRAME_SUNKEN | FRAME_THICK | LAYOUT_FILL_X); - new FXHorizontalSeparator(content, SEPARATOR_GROOVE | LAYOUT_FILL_X); - FXHorizontalFrame* buttons = new FXHorizontalFrame(content, LAYOUT_FILL_X | PACK_UNIFORM_WIDTH, 0, 0, 0, 0, 0, 0, 0, 0); - new FXButton(buttons, "&OK", NULL, &dialog, FXDialogBox::ID_ACCEPT, BUTTON_INITIAL | BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_RIGHT); - new FXButton(buttons, "&Cancel", NULL, &dialog, FXDialogBox::ID_CANCEL, BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_RIGHT, 0, 0, 0, 0, 20, 20); + FXDialogBox dialog(this, "Enter a name", GUIDesignViewSettingsDialog); + FXVerticalFrame* content = new FXVerticalFrame(&dialog, GUIDesignViewSettingsVerticalFrame5); + new FXLabel(content, "Please enter an alphanumeric name: ", NULL, GUIDesignViewSettingsLabel2); + FXTextField* text = new FXTextField(content, 40, &dialog, FXDialogBox::ID_ACCEPT, GUIDesignViewSettingsTextField1); + new FXHorizontalSeparator(content, GUIDesignHorizontalSeparator); + FXHorizontalFrame* buttons = new FXHorizontalFrame(content, GUIDesignViewSettingsHorizontalFrame3); + new FXButton(buttons, "&OK", NULL, &dialog, FXDialogBox::ID_ACCEPT, GUIDesignViewSettingsButton4); + new FXButton(buttons, "&Cancel", NULL, &dialog, FXDialogBox::ID_CANCEL, GUIDesignViewSettingsButton5); dialog.create(); text->setFocus(); if (!dialog.execute()) { @@ -1296,7 +1196,7 @@ header->setHeight(getApp()->getNormalFont()->getFontHeight() + getApp()->getNormalFont()->getFontAscent()); int k; for (k = 0; k < cols; k++) { - header->setItemJustify(k, JUSTIFY_CENTER_X | JUSTIFY_TOP); + header->setItemJustify(k, GUIDesignViewSettingsMFXTableJustify); header->setItemSize(k, 60); } header->setItemSize(0, 150); @@ -1306,13 +1206,13 @@ for (j = myDecals->begin(); j != myDecals->end(); ++j) { GUISUMOAbstractView::Decal& d = *j; myDecalsTable->setItemText(row, 0, d.filename.c_str()); - myDecalsTable->setItemText(row, 1, toString(d.centerX).c_str()); - myDecalsTable->setItemText(row, 2, toString(d.centerY).c_str()); - myDecalsTable->setItemText(row, 3, toString(d.width).c_str()); - myDecalsTable->setItemText(row, 4, toString(d.height).c_str()); - myDecalsTable->setItemText(row, 5, toString(d.rot).c_str()); - myDecalsTable->setItemText(row, 6, toString(d.layer).c_str()); - myDecalsTable->setItemText(row, 7, toString(d.screenRelative).c_str()); + myDecalsTable->setItemText(row, 1, toString(d.centerX).c_str()); + myDecalsTable->setItemText(row, 2, toString(d.centerY).c_str()); + myDecalsTable->setItemText(row, 3, toString(d.width).c_str()); + myDecalsTable->setItemText(row, 4, toString(d.height).c_str()); + myDecalsTable->setItemText(row, 5, toString(d.rot).c_str()); + myDecalsTable->setItemText(row, 6, toString(d.layer).c_str()); + myDecalsTable->setItemText(row, 7, toString(d.screenRelative).c_str()); row++; } // insert dummy last field @@ -1330,31 +1230,26 @@ FXCheckButton* interpolation, GUIColorScheme& scheme) { MFXUtils::deleteChildren(frame); - FXMatrix* m = new FXMatrix(frame, 3, - LAYOUT_FILL_X | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 0, 0, 5, 3); + FXMatrix* m = new FXMatrix(frame, 3, GUIDesignViewSettingsMatrix4); colors.clear(); thresholds.clear(); buttons.clear(); const bool fixed = scheme.isFixed(); std::vector::const_iterator colIt = scheme.getColors().begin(); - std::vector::const_iterator threshIt = scheme.getThresholds().begin(); + std::vector::const_iterator threshIt = scheme.getThresholds().begin(); std::vector::const_iterator nameIt = scheme.getNames().begin(); FX::FXString buttonText = "Add"; while (colIt != scheme.getColors().end()) { - colors.push_back(new FXColorWell(m , MFXUtils::getFXColor(*colIt), - this, MID_SIMPLE_VIEW_COLORCHANGE, - LAYOUT_FIX_WIDTH | LAYOUT_CENTER_Y | FRAME_SUNKEN | FRAME_THICK | ICON_AFTER_TEXT, - 0, 0, 100, 0, 0, 0, 0, 0)); + colors.push_back(new FXColorWell(m , MFXUtils::getFXColor(*colIt), this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignViewSettingsColorWell1)); if (fixed) { new FXLabel(m, nameIt->c_str()); new FXLabel(m, ""); } else { const int dialerOptions = scheme.allowsNegativeValues() ? SPINDIAL_NOMIN : 0; - FXRealSpinDial* threshDialer = new FXRealSpinDial(m, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | SPINDIAL_NOMAX | dialerOptions); + FXRealSpinDial* threshDialer = new FXRealSpinDial(m, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignSpinDial | SPINDIAL_NOMAX | dialerOptions); threshDialer->setValue(*threshIt); thresholds.push_back(threshDialer); - buttons.push_back(new FXButton(m, buttonText, NULL, this, MID_SIMPLE_VIEW_COLORCHANGE, BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 20, 20, 4, 4)); + buttons.push_back(new FXButton(m, buttonText, NULL, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignViewSettingsButton1)); buttonText = "Remove"; } colIt++; @@ -1389,19 +1284,17 @@ FXCheckButton* interpolation, GUIScaleScheme& scheme) { MFXUtils::deleteChildren(frame); - FXMatrix* m = new FXMatrix(frame, 3, - LAYOUT_FILL_X | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 0, 0, 5, 3); + FXMatrix* m = new FXMatrix(frame, 3, GUIDesignViewSettingsMatrix4); scales.clear(); thresholds.clear(); buttons.clear(); const bool fixed = scheme.isFixed(); - std::vector::const_iterator scaleIt = scheme.getColors().begin(); - std::vector::const_iterator threshIt = scheme.getThresholds().begin(); + std::vector::const_iterator scaleIt = scheme.getColors().begin(); + std::vector::const_iterator threshIt = scheme.getThresholds().begin(); std::vector::const_iterator nameIt = scheme.getNames().begin(); FX::FXString buttonText = "Add"; while (scaleIt != scheme.getColors().end()) { - FXRealSpinDial* scaleDialer = new FXRealSpinDial(m, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | SPINDIAL_NOMAX); + FXRealSpinDial* scaleDialer = new FXRealSpinDial(m, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignSpinDial | SPINDIAL_NOMAX); scaleDialer->setValue(*scaleIt); scales.push_back(scaleDialer); if (fixed) { @@ -1409,10 +1302,10 @@ new FXLabel(m, ""); } else { const int dialerOptions = scheme.allowsNegativeValues() ? SPINDIAL_NOMIN : 0; - FXRealSpinDial* threshDialer = new FXRealSpinDial(m, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | SPINDIAL_NOMAX | dialerOptions); + FXRealSpinDial* threshDialer = new FXRealSpinDial(m, 10, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignSpinDial | SPINDIAL_NOMAX | dialerOptions); threshDialer->setValue(*threshIt); thresholds.push_back(threshDialer); - buttons.push_back(new FXButton(m, buttonText, NULL, this, MID_SIMPLE_VIEW_COLORCHANGE, BUTTON_DEFAULT | FRAME_RAISED | FRAME_THICK | LAYOUT_TOP | LAYOUT_LEFT | LAYOUT_CENTER_X, 0, 0, 0, 0, 20, 20, 4, 4)); + buttons.push_back(new FXButton(m, buttonText, NULL, this, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignViewSettingsButton1)); buttonText = "Remove"; } scaleIt++; @@ -1443,8 +1336,7 @@ GUIDialog_ViewSettings::rebuildColorMatrices(bool doCreate) { // decals delete myDecalsTable; - myDecalsTable = new MFXAddEditTypedTable(myDecalsFrame, this, MID_TABLE, - LAYOUT_FILL_Y | LAYOUT_FIX_WIDTH/*|LAYOUT_FIX_HEIGHT*/, 0, 0, 470, 0); + myDecalsTable = new MFXAddEditTypedTable(myDecalsFrame, this, MID_TABLE, GUIDesignViewSettingsMFXTable); myDecalsTable->setVisibleRows(5); myDecalsTable->setVisibleColumns(7); myDecalsTable->setTableSize(5, 7); @@ -1510,8 +1402,8 @@ // check whether we add a new entry or edit an existing entry if (row == static_cast(myDecals->size())) { d.filename = ""; - d.centerX = SUMOReal(myParent->getGridWidth() / 2.); - d.centerY = SUMOReal(myParent->getGridHeight() / 2.); + d.centerX = double(myParent->getGridWidth() / 2.); + d.centerY = double(myParent->getGridHeight() / 2.); d.width = 0.; d.height = 0.; d.initialised = false; @@ -1537,7 +1429,7 @@ break; case 1: try { - d.centerX = TplConvert::_2SUMOReal(value.c_str()); + d.centerX = TplConvert::_2double(value.c_str()); } catch (NumberFormatException&) { std::string msg = "The value must be a float, is:" + value; FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str()); @@ -1545,7 +1437,7 @@ break; case 2: try { - d.centerY = TplConvert::_2SUMOReal(value.c_str()); + d.centerY = TplConvert::_2double(value.c_str()); } catch (NumberFormatException&) { std::string msg = "The value must be a float, is:" + value; FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str()); @@ -1553,7 +1445,7 @@ break; case 3: try { - d.width = TplConvert::_2SUMOReal(value.c_str()); + d.width = TplConvert::_2double(value.c_str()); } catch (NumberFormatException&) { std::string msg = "The value must be a float, is:" + value; FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str()); @@ -1561,7 +1453,7 @@ break; case 4: try { - d.height = TplConvert::_2SUMOReal(value.c_str()); + d.height = TplConvert::_2double(value.c_str()); } catch (NumberFormatException&) { std::string msg = "The value must be a float, is:" + value; FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str()); @@ -1569,7 +1461,7 @@ break; case 5: try { - d.rot = TplConvert::_2SUMOReal(value.c_str()); + d.rot = TplConvert::_2double(value.c_str()); } catch (NumberFormatException&) { std::string msg = "The value must be a float, is:" + value; FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str()); @@ -1577,7 +1469,7 @@ break; case 6: try { - d.layer = TplConvert::_2SUMOReal(value.c_str()); + d.layer = TplConvert::_2double(value.c_str()); } catch (NumberFormatException&) { std::string msg = "The value must be a float, is:" + value; FXMessageBox::error(this, MBOX_OK, "Number format error", "%s", msg.c_str()); @@ -1628,30 +1520,23 @@ GUIDialog_ViewSettings* target, const std::string& title, const GUIVisualizationTextSettings& settings) { - myCheck = new FXCheckButton(parent, title.c_str(), target, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL); + myCheck = new FXCheckButton(parent, title.c_str(), target, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignCheckButton); myCheck->setCheck(settings.show); new FXLabel(parent, ""); - FXMatrix* m1 = new FXMatrix(parent, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 0, 0, 5, 5); - new FXLabel(m1, "Size", 0, LAYOUT_CENTER_Y); - mySizeDial = new FXRealSpinDial(m1, 10, target, MID_SIMPLE_VIEW_COLORCHANGE, - LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK); + FXMatrix* m1 = new FXMatrix(parent, 2, GUIDesignViewSettingsMatrix5); + new FXLabel(m1, "Size", 0, GUIDesignViewSettingsLabel1); + mySizeDial = new FXRealSpinDial(m1, 10, target, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignViewSettingsSpinDial1); mySizeDial->setRange(10, 1000); mySizeDial->setValue(settings.size); - FXMatrix* m2 = new FXMatrix(parent, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 0, 0, 5, 5); - new FXLabel(m2, "Color", 0, LAYOUT_CENTER_Y); - myColorWell = new FXColorWell(m2, MFXUtils::getFXColor(settings.color), - target, MID_SIMPLE_VIEW_COLORCHANGE, - LAYOUT_FIX_WIDTH | LAYOUT_CENTER_Y | LAYOUT_SIDE_TOP | FRAME_SUNKEN | FRAME_THICK | ICON_AFTER_TEXT, - 0, 0, 100, 0, 0, 0, 0, 0); + FXMatrix* m2 = new FXMatrix(parent, 2, GUIDesignViewSettingsMatrix5); + new FXLabel(m2, "Color", 0, GUIDesignViewSettingsLabel1); + myColorWell = new FXColorWell(m2, MFXUtils::getFXColor(settings.color), target, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignViewSettingsColorWell2); } GUIVisualizationTextSettings GUIDialog_ViewSettings::NamePanel::getSettings() { - return GUIVisualizationTextSettings(myCheck->getCheck() != FALSE, - mySizeDial->getValue(), MFXUtils::getRGBColor(myColorWell->getRGBA())); + return GUIVisualizationTextSettings(myCheck->getCheck() != FALSE, mySizeDial->getValue(), MFXUtils::getRGBColor(myColorWell->getRGBA())); } @@ -1667,20 +1552,16 @@ FXMatrix* parent, GUIDialog_ViewSettings* target, const GUIVisualizationSizeSettings& settings) { - myCheck = new FXCheckButton(parent, "Draw with constant size when zoomed out", target, MID_SIMPLE_VIEW_COLORCHANGE, LAYOUT_CENTER_Y | CHECKBUTTON_NORMAL); + myCheck = new FXCheckButton(parent, "Draw with constant size when zoomed out", target, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignCheckButton); myCheck->setCheck(settings.constantSize); new FXLabel(parent, ""); - FXMatrix* m1 = new FXMatrix(parent, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 0, 0, 5, 5); - new FXLabel(m1, "Minimum Size", 0, LAYOUT_CENTER_Y); - myMinSizeDial = new FXRealSpinDial(m1, 10, target, MID_SIMPLE_VIEW_COLORCHANGE, - LAYOUT_CENTER_Y | LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK); + FXMatrix* m1 = new FXMatrix(parent, 2, GUIDesignViewSettingsMatrix5); + new FXLabel(m1, "Minimum Size", 0, GUIDesignViewSettingsLabel1); + myMinSizeDial = new FXRealSpinDial(m1, 10, target, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignViewSettingsSpinDial1); myMinSizeDial->setValue(settings.minSize); - FXMatrix* m2 = new FXMatrix(parent, 2, LAYOUT_FILL_X | LAYOUT_BOTTOM | LAYOUT_LEFT | MATRIX_BY_COLUMNS, - 0, 0, 0, 0, 10, 10, 0, 0, 5, 5); - new FXLabel(m2, "Exaggerate by", 0, LAYOUT_CENTER_Y); - myExaggerateDial = new FXRealSpinDial(m2, 10, target, MID_SIMPLE_VIEW_COLORCHANGE, - LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK); + FXMatrix* m2 = new FXMatrix(parent, 2, GUIDesignViewSettingsMatrix5); + new FXLabel(m2, "Exaggerate by", 0, GUIDesignViewSettingsLabel1); + myExaggerateDial = new FXRealSpinDial(m2, 10, target, MID_SIMPLE_VIEW_COLORCHANGE, GUIDesignViewSettingsSpinDial2); myExaggerateDial->setRange(0, 10000); myExaggerateDial->setValue(settings.exaggeration); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_ViewSettings.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_ViewSettings.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_ViewSettings.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIDialog_ViewSettings.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Wed, 21. Dec 2005 -/// @version $Id: GUIDialog_ViewSettings.h 21539 2016-09-26 10:59:27Z namdre $ +/// @version $Id: GUIDialog_ViewSettings.h 23383 2017-03-14 13:42:54Z palcraft $ /// // The dialog to change the view (gui) settings. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -102,6 +102,8 @@ /// @brief Destructor ~GUIDialog_ViewSettings(); + /// @brief show view settings dialog + void show(); /** @brief Sets current settings (called if reopened) * @param[in, out] settings The current settings that can be changed diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIGlChildWindow.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIGlChildWindow.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIGlChildWindow.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIGlChildWindow.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 29.05.2005 -/// @version $Id: GUIGlChildWindow.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: GUIGlChildWindow.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -34,12 +34,9 @@ #include #include #include +#include #include "GUIGlChildWindow.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // FOX callback mapping @@ -70,10 +67,7 @@ myParent(parentWindow) { // Make MDI Window Menu setTracking(); - myContentFrame = - new FXVerticalFrame(this, - FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, - 0, 0, 0, 0, 0, 0, 0, 0); + myContentFrame = new FXVerticalFrame(this, GUIDesignFrameArea); // build the tool bar buildNavigationToolBar(); // always there (recenter) buildColoringToolBar(); // always there (coloring) @@ -98,72 +92,60 @@ void GUIGlChildWindow::buildNavigationToolBar() { - myNavigationToolBar = new FXToolBar(myContentFrame, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | FRAME_RAISED); + // Build navigation toolbar + myNavigationToolBar = new FXToolBar(myContentFrame, GUIDesignBar); + // build the view settings // recenter view new FXButton(myNavigationToolBar, "\tRecenter View\tRecenter view to the simulated area.", - GUIIconSubSys::getIcon(ICON_RECENTERVIEW), this, MID_RECENTERVIEW, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); + GUIIconSubSys::getIcon(ICON_RECENTERVIEW), this, MID_RECENTERVIEW, GUIDesignButtonToolbar); // add viewport button new FXButton(myNavigationToolBar, "\tEdit Viewport...\tOpens a menu which lets you edit the viewport.", - GUIIconSubSys::getIcon(ICON_EDITVIEWPORT), this, MID_EDITVIEWPORT, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); + GUIIconSubSys::getIcon(ICON_EDITVIEWPORT), this, MID_EDITVIEWPORT, GUIDesignButtonToolbar); // toggle button for zooming style MFXCheckableButton* zoomBut = new MFXCheckableButton(false, myNavigationToolBar, "\tToggles Zooming Style\tToggles whether zooming is based at cursor position or at the center of the view.", - GUIIconSubSys::getIcon(ICON_ZOOMSTYLE), this, MID_ZOOM_STYLE, - BUTTON_NORMAL | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT, - 0, 0, 23, 23); + GUIIconSubSys::getIcon(ICON_ZOOMSTYLE), this, MID_ZOOM_STYLE, GUIDesignButtonToolbarCheckable); zoomBut->setChecked(getApp()->reg().readIntEntry("gui", "zoomAtCenter", 1) != 1); // build the locator popup myLocatorPopup = new FXPopup(myNavigationToolBar, POPUP_VERTICAL); myLocatorButton = new FXMenuButton(myNavigationToolBar, "\tLocate Structures\tLocate structures within the network.", GUIIconSubSys::getIcon(ICON_LOCATE), myLocatorPopup, - MENUBUTTON_RIGHT | LAYOUT_TOP | BUTTON_TOOLBAR | FRAME_RAISED | FRAME_THICK); + GUIDesignButtonToolbarLocator); // add toggle button for tool-tips on/off new MFXCheckableButton(false, myNavigationToolBar, "\tToggles Tool Tips\tToggles whether tool tips shall be shown.", - GUIIconSubSys::getIcon(ICON_SHOWTOOLTIPS), this, MID_SHOWTOOLTIPS, - BUTTON_NORMAL | LAYOUT_FIX_WIDTH | LAYOUT_FIX_HEIGHT, - 0, 0, 23, 23); + GUIIconSubSys::getIcon(ICON_SHOWTOOLTIPS), this, MID_SHOWTOOLTIPS, GUIDesignButtonToolbarCheckable); } void GUIGlChildWindow::buildColoringToolBar() { - // in fact, we currently are not able to build another bar - // we just add somthing to the navigation bar -// myColoringToolBar = new FXToolBar(myContentFrame,LAYOUT_DOCK_SAME|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|FRAME_RAISED); - new FXToolBarGrip(myNavigationToolBar, NULL, 0, TOOLBARGRIP_SINGLE | FRAME_SUNKEN); + // Create Vertical separator + new FXVerticalSeparator(myNavigationToolBar, GUIDesignVerticalSeparator); // build coloring tools // combo - myColoringSchemes = - new FXComboBox(myNavigationToolBar, 12, this, MID_COLOURSCHEMECHANGE, - FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC | LAYOUT_CENTER_Y); + myColoringSchemes = new FXComboBox(myNavigationToolBar, GUIDesignComboBoxNCol, this, MID_COLOURSCHEMECHANGE, GUIDesignComboBoxStatic); // editor new FXButton(myNavigationToolBar, "\tEdit Coloring Schemes...\tOpens a menu which lets you edit the coloring schemes.", - GUIIconSubSys::getIcon(ICON_COLORWHEEL), this, MID_EDITVIEWSCHEME, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); + GUIIconSubSys::getIcon(ICON_COLORWHEEL), this, MID_EDITVIEWSCHEME, GUIDesignButtonToolbar); } void GUIGlChildWindow::buildScreenshotToolBar() { - // in fact, we currently are not able to build another bar - // we just add somthing to the navigation bar -// myScreenshotToolBar = new FXToolBar(myContentFrame,LAYOUT_DOCK_SAME|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|FRAME_RAISED); - new FXToolBarGrip(myNavigationToolBar, NULL, 0, TOOLBARGRIP_SINGLE | FRAME_SUNKEN); + // Create Vertical separator + new FXVerticalSeparator(myNavigationToolBar, GUIDesignVerticalSeparator); // snapshot new MFXCheckableButton(false, myNavigationToolBar, "\tMake Snapshot\tMakes a snapshot of the view.", - GUIIconSubSys::getIcon(ICON_CAMERA), this, MID_MAKESNAPSHOT, - ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT); + GUIIconSubSys::getIcon(ICON_CAMERA), this, MID_MAKESNAPSHOT, GUIDesignButtonToolbar); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIGlChildWindow.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIGlChildWindow.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIGlChildWindow.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIGlChildWindow.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Fri, 29.04.2005 -/// @version $Id: GUIGlChildWindow.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GUIGlChildWindow.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,7 +35,6 @@ #endif #include -#include #include "GUISUMOAbstractView.h" @@ -69,9 +68,9 @@ long onCmdZoomStyle(FXObject* sender, FXSelector, void*); long onCmdChangeColorScheme(FXObject*, FXSelector sel, void*); - virtual void buildNavigationToolBar(); - virtual void buildColoringToolBar(); - virtual void buildScreenshotToolBar(); + void buildNavigationToolBar(); + void buildColoringToolBar(); + void buildScreenshotToolBar(); FXToolBar& getNavigationToolBar(GUISUMOAbstractView& v); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIMainWindow.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIMainWindow.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIMainWindow.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIMainWindow.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 29.05.2005 -/// @version $Id: GUIMainWindow.cpp 21217 2016-07-22 10:57:44Z behrisch $ +/// @version $Id: GUIMainWindow.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,19 +33,25 @@ #include #include #include +// fx3d includes windows.h so we need to guard against macro pollution +#ifdef WIN32 +#define NOMINMAX +#endif #include -#include -#include +#ifdef WIN32 +#undef NOMINMAX +#endif #include #include +#include +#include +#include +#include +#include #include "GUIAppEnum.h" #include "GUIMainWindow.h" #include "GUIGlChildWindow.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions @@ -55,10 +61,13 @@ // =========================================================================== // member method definitions // =========================================================================== -GUIMainWindow::GUIMainWindow(FXApp* a) - : FXMainWindow(a, "SUMO-gui main window", NULL, NULL, DECOR_ALL, 20, 20, 600, 400), - myGLVisual(new FXGLVisual(a, VISUAL_DOUBLEBUFFER)), - myAmGaming(false), myListInternal(false) { +GUIMainWindow::GUIMainWindow(FXApp* a) : + FXMainWindow(a, "SUMO-gui main window", NULL, NULL, DECOR_ALL, 20, 20, 600, 400), + myGLVisual(new FXGLVisual(a, VISUAL_DOUBLEBUFFER)), + myAmGaming(false), + myListInternal(false), + myListParking(true), + myListTeleporting(false) { FXFontDesc fdesc; getApp()->getNormalFont()->getFontDesc(fdesc); @@ -195,5 +204,44 @@ return 0; } +void +GUIMainWindow::setWindowSizeAndPos() { + int windowWidth = getApp()->reg().readIntEntry("SETTINGS", "width", 600); + int windowHeight = getApp()->reg().readIntEntry("SETTINGS", "height", 400); + const OptionsCont& oc = OptionsCont::getOptions(); + if (oc.isSet("window-size")) { + std::vector windowSize = oc.getStringVector("window-size"); + if (windowSize.size() != 2 + || !TplCheck::_str2int(windowSize[0]) + || !TplCheck::_str2int(windowSize[1])) { + WRITE_ERROR("option window-size requires INT,INT"); + } else { + windowWidth = TplConvert::_str2int(windowSize[0]); + windowHeight = TplConvert::_str2int(windowSize[1]); + } + } + if (oc.isSet("window-size") || getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 0 || oc.isSet("window-pos")) { + // when restoring previous pos, make sure the window fits fully onto the current screen + int x = MAX2(0, MIN2(getApp()->reg().readIntEntry("SETTINGS", "x", 150), getApp()->getRootWindow()->getWidth() - windowWidth)); + int y = MAX2(0, MIN2(getApp()->reg().readIntEntry("SETTINGS", "y", 150), getApp()->getRootWindow()->getHeight() - windowHeight)); + if (oc.isSet("window-pos")) { + std::vector windowPos = oc.getStringVector("window-pos"); + if (windowPos.size() != 2 + || !TplCheck::_str2int(windowPos[0]) + || !TplCheck::_str2int(windowPos[1]) + ) { + WRITE_ERROR("option window-pos requires INT,INT"); + } else { + x = TplConvert::_str2int(windowPos[0]); + y = TplConvert::_str2int(windowPos[1]); + } + } + setX(x); + setY(y); + setWidth(windowWidth); + setHeight(windowHeight); + } +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIMainWindow.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIMainWindow.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIMainWindow.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIMainWindow.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Fri, 29.04.2005 -/// @version $Id: GUIMainWindow.h 20907 2016-06-07 14:06:01Z namdre $ +/// @version $Id: GUIMainWindow.h 23150 2017-02-27 12:08:30Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -91,18 +91,28 @@ return myListInternal; } + /// @brief return whether to list parking vehicles + bool listParking() const { + return myListParking; + } + + /// @brief return whether to list teleporting vehicles + bool listTeleporting() const { + return myListTeleporting; + } + static GUIMainWindow* getInstance(); /** @brief Returns the delay (should be overwritten by subclasses if applicable) * @return parsed delay in milliseconds */ - virtual SUMOReal getDelay() const { + virtual double getDelay() const { return 0; } /** @brief Sets the delay of the parent application */ - virtual void setDelay(SUMOReal) {} + virtual void setDelay(double) {} /** @brief Sends an event from the application thread to the GUI and waits until it is handled * @param event the event to send @@ -144,12 +154,22 @@ /// information whether the locator should list internal structures bool myListInternal; + /// information whether the locator should list parking vehicles + bool myListParking; + + /// information whether the locator should list teleporting vehicles + bool myListTeleporting; + /// the singleton window instance static GUIMainWindow* myInstance; protected: GUIMainWindow() { } + /// @brief perform initial window positioning and sizing according to user options / previous call + void setWindowSizeAndPos(); + + }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIPerspectiveChanger.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIPerspectiveChanger.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIPerspectiveChanger.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIPerspectiveChanger.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GUIPerspectiveChanger.cpp 21148 2016-07-12 08:47:10Z behrisch $ +/// @version $Id: GUIPerspectiveChanger.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A class that allows to steer the visual output in dependence to user /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,10 +33,6 @@ #include "GUISUMOAbstractView.h" #include "GUIPerspectiveChanger.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -137,8 +133,8 @@ return myViewPort; } Boundary result = myViewPort; - SUMOReal canvasRatio = (SUMOReal)myCallback.getWidth() / myCallback.getHeight(); - SUMOReal ratio = result.getWidth() / result.getHeight(); + double canvasRatio = (double)myCallback.getWidth() / myCallback.getHeight(); + double ratio = result.getWidth() / result.getHeight(); if (ratio < canvasRatio) { result.growWidth(result.getWidth() * (canvasRatio / ratio - 1) / 2); } else { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIPerspectiveChanger.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIPerspectiveChanger.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUIPerspectiveChanger.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUIPerspectiveChanger.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @brief @author Jakob Erdmann /// @brief @author Michael Behrisch /// @brief @date Sept 2002 -/// @brief @version $Id: GUIPerspectiveChanger.h 21186 2016-07-18 12:04:16Z namdre $ +/// @brief @version $Id: GUIPerspectiveChanger.h 23150 2017-02-27 12:08:30Z behrisch $ /// @brief // A virtual class that allows to steer the visual output in dependence to /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -104,34 +104,34 @@ //@} /// @brief Returns the rotation of the canvas stored in this changer - virtual SUMOReal getRotation() const = 0; + virtual double getRotation() const = 0; /// @brief Returns the x-offset of the field to show stored in this changer - virtual SUMOReal getXPos() const = 0; + virtual double getXPos() const = 0; /// @brief Returns the y-offset of the field to show stored in this changer - virtual SUMOReal getYPos() const = 0; + virtual double getYPos() const = 0; /// @brief Returns the zoom factor computed stored in this changer - virtual SUMOReal getZoom() const = 0; + virtual double getZoom() const = 0; /// @brief Returns the camera height corresponding to the current zoom factor - virtual SUMOReal getZPos() const = 0; + virtual double getZPos() const = 0; /// @brief Returns the camera height at which the given zoom level is reached - virtual SUMOReal zoom2ZPos(SUMOReal zoom) const = 0; + virtual double zoom2ZPos(double zoom) const = 0; /// @brief Returns the zoom level that is achieved at a given camera height - virtual SUMOReal zPos2Zoom(SUMOReal zPos) const = 0; + virtual double zPos2Zoom(double zPos) const = 0; /// @brief Centers the view to the given position, setting it to a size that covers the radius. Used for: Centering of vehicles and junctions */ - virtual void centerTo(const Position& pos, SUMOReal radius, bool applyZoom = true) = 0; + virtual void centerTo(const Position& pos, double radius, bool applyZoom = true) = 0; /// @brief Sets the viewport Used for: Adapting a new viewport - virtual void setViewport(SUMOReal zoom, SUMOReal xPos, SUMOReal yPos) = 0; + virtual void setViewport(double zoom, double xPos, double yPos) = 0; /// @brief Alternative method for setting the viewport - virtual void setViewportFrom(SUMOReal xPos, SUMOReal yPos, SUMOReal zPos) = 0; + virtual void setViewportFrom(double xPos, double yPos, double zPos) = 0; /// @brief Returns the last mouse x-position an event occured at FXint getMouseXPosition() const; @@ -145,7 +145,7 @@ * * @param[in] change The horizontal change in canvas size in pixels */ - virtual void changeCanvassLeft(int change) = 0; + virtual void changeCanvasSizeLeft(int change) = 0; /// @brief get viewport Boundary getViewport(bool fixRatio = true); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUISUMOAbstractView.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUISUMOAbstractView.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUISUMOAbstractView.cpp 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUISUMOAbstractView.cpp 2017-07-23 16:22:07.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Laura Bieker /// @author Andreas Gaubatz /// @date Sept 2002 -/// @version $Id: GUISUMOAbstractView.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: GUISUMOAbstractView.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // The base class for a view /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -61,6 +61,7 @@ #include #include #include +#include #include "GUISUMOAbstractView.h" #include "GUIMainWindow.h" @@ -69,12 +70,15 @@ #include "GUIDialog_EditViewport.h" #ifdef HAVE_GDAL +#if __GNUC__ > 3 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" +#endif #include +#if __GNUC__ > 3 +#pragma GCC diagnostic pop +#endif #endif - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS // =========================================================================== @@ -109,8 +113,7 @@ * GUISUMOAbstractView - methods * ----------------------------------------------------------------------- */ GUISUMOAbstractView::GUISUMOAbstractView(FXComposite* p, GUIMainWindow& app, GUIGlChildWindow* parent, const SUMORTree& grid, FXGLVisual* glVis, FXGLCanvas* share) : - FXGLCanvas(p, glVis, share, p, MID_GLCANVAS, - LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0), + FXGLCanvas(p, glVis, share, p, MID_GLCANVAS, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0), myApp(&app), myParent(parent), myGrid(&((SUMORTree&)grid)), @@ -178,11 +181,24 @@ Position +GUISUMOAbstractView::snapToActiveGrid(const Position& pos) const { + Position result = pos; + if (myVisualizationSettings->showGrid) { + const double xRest = std::fmod(pos.x(), myVisualizationSettings->gridXSize) + (pos.x() < 0 ? myVisualizationSettings->gridXSize : 0); + const double yRest = std::fmod(pos.y(), myVisualizationSettings->gridYSize) + (pos.y() < 0 ? myVisualizationSettings->gridYSize : 0); + result.setx(pos.x() - xRest + (xRest < myVisualizationSettings->gridXSize * 0.5 ? 0 : myVisualizationSettings->gridXSize)); + result.sety(pos.y() - yRest + (yRest < myVisualizationSettings->gridYSize * 0.5 ? 0 : myVisualizationSettings->gridYSize)); + } + return result; +} + + +Position GUISUMOAbstractView::screenPos2NetPos(int x, int y) const { Boundary bound = myChanger->getViewport(); - SUMOReal xNet = bound.xmin() + bound.getWidth() * x / getWidth(); + double xNet = bound.xmin() + bound.getWidth() * x / getWidth(); // cursor origin is in the top-left corner - SUMOReal yNet = bound.ymin() + bound.getHeight() * (getHeight() - y) / getHeight(); + double yNet = bound.ymin() + bound.getHeight() * (getHeight() - y) / getHeight(); return Position(xNet, yNet); } @@ -206,7 +222,7 @@ myApp->getCartesianLabel().setText(text.c_str()); GeoConvHelper::getFinal().cartesian2geo(pos); if (GeoConvHelper::getFinal().usingGeoProjection()) { - text = "lat:" + toString(pos.y(), GEO_OUTPUT_ACCURACY) + ", lon:" + toString(pos.x(), GEO_OUTPUT_ACCURACY); + text = "lat:" + toString(pos.y(), gPrecisionGeo) + ", lon:" + toString(pos.x(), gPrecisionGeo); } else { text = "x:" + toString(pos.x()) + ", y:" + toString(pos.y()); } @@ -292,14 +308,14 @@ GUIGlID GUISUMOAbstractView::getObjectAtPosition(Position pos) { - const SUMOReal SENSITIVITY = 0.1; // meters + const double SENSITIVITY = 0.1; // meters Boundary selection; selection.add(pos); selection.grow(SENSITIVITY); const std::vector ids = getObjectsInBoundary(selection); // Interpret results int idMax = 0; - SUMOReal maxLayer = -std::numeric_limits::max(); + double maxLayer = -std::numeric_limits::max(); for (std::vector::const_iterator it = ids.begin(); it != ids.end(); it++) { GUIGlID id = *it; GUIGlObject* o = GUIGlObjectStorage::gIDStorage.getObjectBlocking(id); @@ -312,7 +328,7 @@ //std::cout << "point selection hit " << o->getMicrosimID() << "\n"; GUIGlObjectType type = o->getType(); if (type != 0) { - SUMOReal layer = (SUMOReal)type; + double layer = (double)type; // determine an "abstract" layer for shapes // this "layer" resembles the layer of the shape // taking into account the stac of other objects @@ -336,7 +352,7 @@ std::vector -GUISUMOAbstractView::getObjectsAtPosition(Position pos, SUMOReal radius) { +GUISUMOAbstractView::getObjectsAtPosition(Position pos, double radius) { Boundary selection; selection.add(pos); selection.grow(radius); @@ -418,33 +434,43 @@ void GUISUMOAbstractView::paintGLGrid() { - glEnable(GL_DEPTH_TEST); - glLineWidth(1); - - SUMOReal xmin = myGrid->xmin(); - SUMOReal ymin = myGrid->ymin(); - SUMOReal ypos = ymin; - SUMOReal xpos = xmin; - SUMOReal xend = myGrid->xmax(); - SUMOReal yend = myGrid->ymax(); - - glTranslated(0, 0, .55); - glColor3d(0.5, 0.5, 0.5); - // draw horizontal lines - glBegin(GL_LINES); - for (; ypos < yend;) { - glVertex2d(xmin, ypos); - glVertex2d(xend, ypos); - ypos += myVisualizationSettings->gridYSize; - } - // draw vertical lines - for (; xpos < xend;) { - glVertex2d(xpos, ymin); - glVertex2d(xpos, yend); - xpos += myVisualizationSettings->gridXSize; + // obtain minimum grid + double minimumSizeGrid = (myVisualizationSettings->gridXSize < myVisualizationSettings->gridYSize) ? myVisualizationSettings->gridXSize : myVisualizationSettings->gridYSize; + // Check if the distance is enought to draw grid + if (myVisualizationSettings->scale * myVisualizationSettings->addSize.getExaggeration(*myVisualizationSettings) >= (25 / minimumSizeGrid)) { + glEnable(GL_DEPTH_TEST); + glLineWidth(1); + // get multiplication values (2 is the marging) + int multXmin = (int)(myChanger->getViewport().xmin() / myVisualizationSettings->gridXSize) - 2; + int multYmin = (int)(myChanger->getViewport().ymin() / myVisualizationSettings->gridYSize) - 2; + int multXmax = (int)(myChanger->getViewport().xmax() / myVisualizationSettings->gridXSize) + 2; + int multYmax = (int)(myChanger->getViewport().ymax() / myVisualizationSettings->gridYSize) + 2; + // obtain references + double xmin = myVisualizationSettings->gridXSize * multXmin; + double ymin = myVisualizationSettings->gridYSize * multYmin; + double xmax = myVisualizationSettings->gridXSize * multXmax; + double ymax = myVisualizationSettings->gridYSize * multYmax; + double xpos = xmin; + double ypos = ymin; + // move drawing matrix + glTranslated(0, 0, .55); + glColor3d(0.5, 0.5, 0.5); + // draw horizontal lines + glBegin(GL_LINES); + while (ypos <= ymax) { + glVertex2d(xmin, ypos); + glVertex2d(xmax, ypos); + ypos += myVisualizationSettings->gridYSize; + } + // draw vertical lines + while (xpos <= xmax) { + glVertex2d(xpos, ymin); + glVertex2d(xpos, ymax); + xpos += myVisualizationSettings->gridXSize; + } + glEnd(); + glTranslated(0, 0, -.55); } - glEnd(); - glTranslated(0, 0, -.55); } @@ -454,14 +480,14 @@ int length = 1; const std::string text("10000000000"); int noDigits = 1; - int pixelSize = (int) m2p((SUMOReal) length); + int pixelSize = (int) m2p((double) length); while (pixelSize <= 20) { length *= 10; noDigits++; if (noDigits > (int)text.length()) { return; } - pixelSize = (int) m2p((SUMOReal) length); + pixelSize = (int) m2p((double) length); } glLineWidth(1.0); @@ -478,7 +504,7 @@ glDisable(GL_BLEND); glEnable(GL_DEPTH_TEST); - SUMOReal len = (SUMOReal) pixelSize / (SUMOReal)(getWidth() - 1) * (SUMOReal) 2.0; + double len = (double) pixelSize / (double)(getWidth() - 1) * (double) 2.0; glColor3d(0, 0, 0); double o = double(15) / double(getHeight()); double o2 = o + o; @@ -495,15 +521,15 @@ glVertex2d(-.98 + len, -1. + o2); glEnd(); - SUMOReal w = SUMOReal(35) / SUMOReal(getWidth()); - SUMOReal h = SUMOReal(35) / SUMOReal(getHeight()); - pfSetPosition(SUMOReal(-0.99), SUMOReal(1. - o2 - oo)); + double w = double(35) / double(getWidth()); + double h = double(35) / double(getHeight()); + pfSetPosition(double(-0.99), double(1. - o2 - oo)); pfSetScaleXY(w, h); glRotated(180, 1, 0, 0); pfDrawString("0m"); glRotated(-180, 1, 0, 0); - pfSetPosition(SUMOReal(-.99 + len), SUMOReal(1. - o2 - oo)); + pfSetPosition(double(-.99 + len), double(1. - o2 - oo)); glRotated(180, 1, 0, 0); pfDrawString((text.substr(0, noDigits) + "m").c_str()); glRotated(-180, 1, 0, 0); @@ -516,14 +542,14 @@ } -SUMOReal -GUISUMOAbstractView::m2p(SUMOReal meter) const { +double +GUISUMOAbstractView::m2p(double meter) const { return meter * getWidth() / myChanger->getViewport().getWidth(); } -SUMOReal -GUISUMOAbstractView::p2m(SUMOReal pixel) const { +double +GUISUMOAbstractView::p2m(double pixel) const { return pixel * myChanger->getViewport().getWidth() / getWidth(); } @@ -535,7 +561,7 @@ void -GUISUMOAbstractView::centerTo(GUIGlID id, bool applyZoom, SUMOReal zoomDist) { +GUISUMOAbstractView::centerTo(GUIGlID id, bool applyZoom, double zoomDist) { GUIGlObject* o = GUIGlObjectStorage::gIDStorage.getObjectBlocking(id); if (o != 0 && dynamic_cast(o) != 0) { if (applyZoom && zoomDist < 0) { @@ -975,8 +1001,7 @@ GUIDialog_EditViewport* GUISUMOAbstractView::getViewportEditor() { if (myViewportChooser == 0) { - myViewportChooser = - new GUIDialog_EditViewport(this, "Edit Viewport...", 0, 0); + myViewportChooser = new GUIDialog_EditViewport(this, "Edit Viewport", 0, 0); myViewportChooser->create(); } myViewportChooser->setValues(myChanger->getZoom(), myChanger->getXPos(), myChanger->getYPos()); @@ -1038,13 +1063,13 @@ } -SUMOReal +double GUISUMOAbstractView::getGridWidth() const { return myGrid->getWidth(); } -SUMOReal +double GUISUMOAbstractView::getGridHeight() const { return myGrid->getHeight(); } @@ -1189,8 +1214,8 @@ } glRotated(d.rot, 0, 0, 1); glColor3d(1, 1, 1); - SUMOReal halfWidth = d.width / 2.; - SUMOReal halfHeight = d.height / 2.; + double halfWidth = d.width / 2.; + double halfHeight = d.height / 2.; if (d.screenRelative) { halfWidth = p2m(halfWidth); halfHeight = p2m(halfHeight); @@ -1218,9 +1243,6 @@ bool GUISUMOAbstractView::removeAdditionalGLVisualisation(const GUIGlObject* const which) { - if (getTrackedID() == which->getGlID()) { - stopTrack(); - } if (myAdditionallyDrawn.find(which) == myAdditionallyDrawn.end()) { return false; } @@ -1256,21 +1278,21 @@ glOrtho(0, getWidth(), 0, getHeight(), -GLO_MAX - 1, GLO_MAX + 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - SUMOReal scaleX = (SUMOReal)getWidth() / bound.getWidth(); - SUMOReal scaleY = (SUMOReal)getHeight() / bound.getHeight(); + double scaleX = (double)getWidth() / bound.getWidth(); + double scaleY = (double)getHeight() / bound.getHeight(); glScaled(scaleX, scaleY, 1); glTranslated(-bound.xmin(), -bound.ymin(), 0); } -SUMOReal +double GUISUMOAbstractView::getDelay() const { return myApp->getDelay(); } void -GUISUMOAbstractView::setDelay(SUMOReal delay) { +GUISUMOAbstractView::setDelay(double delay) { myApp->setDelay(delay); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUISUMOAbstractView.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUISUMOAbstractView.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/gui/windows/GUISUMOAbstractView.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/gui/windows/GUISUMOAbstractView.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ ///@brief @author Michael Behrisch ///@brief @author Andreas Gaubatz ///@brief @date Sept 2002 -///@brief @version $Id: GUISUMOAbstractView.h 21625 2016-10-06 12:18:47Z namdre $ +///@brief @version $Id: GUISUMOAbstractView.h 23722 2017-03-29 18:26:40Z namdre $ /// // The base class for a view /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -100,7 +100,7 @@ * @param[in] zoomDist The distance in m to use for the zoom, values < 0 means: use the centeringBoundary * @note caller is responsible for calling update */ - virtual void centerTo(GUIGlID id, bool applyZoom, SUMOReal zoomDist = 20); + virtual void centerTo(GUIGlID id, bool applyZoom, double zoomDist = 20); ///@brief centers to the chosen artifact void centerTo(const Boundary& bound); @@ -112,10 +112,10 @@ virtual void copyViewportTo(GUISUMOAbstractView* view); ///@brief meter-to-pixels conversion method - SUMOReal m2p(SUMOReal meter) const; + double m2p(double meter) const; ///@brief pixels-to-meters conversion method - SUMOReal p2m(SUMOReal pixel) const; + double p2m(double pixel) const; ///@brief Returns the information whether rotation is allowd ///@note disabled @@ -219,11 +219,11 @@ ///@brief get grid width // @todo: check why this is here - SUMOReal getGridWidth() const; + double getGridWidth() const; ///@brief get grid Height // @todo: check why this is here - SUMOReal getGridHeight() const; + double getGridHeight() const; ///@brief star track virtual void startTrack(int /*id*/); @@ -273,25 +273,25 @@ ///@brief The path to the file the image is located at std::string filename; ///@brief The center of the image in x-direction (net coordinates, in m) - SUMOReal centerX; + double centerX; ///@brief The center of the image in y-direction (net coordinates, in m) - SUMOReal centerY; + double centerY; ///@brief The center of the image in z-direction (net coordinates, in m) - SUMOReal centerZ; + double centerZ; ///@brief The width of the image (net coordinates in x-direction, in m) - SUMOReal width; + double width; ///@brief The height of the image (net coordinates in y-direction, in m) - SUMOReal height; + double height; ///@brief The altitude of the image (net coordinates in z-direction, in m) - SUMOReal altitude; + double altitude; ///@brief The rotation of the image in the ground plane (in degrees) - SUMOReal rot; + double rot; ///@brief The tilt of the image to the ground plane (in degrees) - SUMOReal tilt; + double tilt; ///@brief The roll of the image to the ground plane (in degrees) - SUMOReal roll; + double roll; ///@brief The layer of the image - SUMOReal layer; + double layer; ///@brief Whether this image was initialised (inserted as a texture) bool initialised; ///@brief Whether this image should be skipped in 2D-views @@ -311,6 +311,9 @@ ///@brief Returns the cursor's x/y position within the network Position getPositionInformation() const; + ///@brief Returns a position that is mapped to the closest grid point if the grid is active + Position snapToActiveGrid(const Position& pos) const; + ///@brief Translate screen position to network position Position screenPos2NetPos(int x, int y) const; @@ -321,10 +324,10 @@ GUIVisualizationSettings* getVisualisationSettings(); ///@brief Returns the delay of the parent application - SUMOReal getDelay() const; + double getDelay() const; /// @brief Sets the delay of the parent application - void setDelay(SUMOReal delay); + void setDelay(double delay); protected: ///@brief performs the painting of the simulation @@ -352,7 +355,7 @@ GUIGlID getObjectAtPosition(Position pos); ///@brief returns the ids of the object at position within the given (rectangular) radius using GL_SELECT - std::vector getObjectsAtPosition(Position pos, SUMOReal radius); + std::vector getObjectsAtPosition(Position pos, double radius); ///@brief returns the ids of all objects in the given boundary std::vector getObjectsInBoundary(const Boundary& bound); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/importio/LineHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/importio/LineHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/importio/LineHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/importio/LineHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Fri, 19 Jul 2002 -/// @version $Id: LineHandler.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: LineHandler.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Interface definition for a class which retrieves lines from a LineHandler /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/importio/LineReader.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/importio/LineReader.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/importio/LineReader.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/importio/LineReader.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date Fri, 19 Jul 2002 -/// @version $Id: LineReader.cpp 21201 2016-07-19 11:57:22Z behrisch $ +/// @version $Id: LineReader.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Retrieves a file linewise and reports the lines to a handler. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,6 @@ #include "LineHandler.h" #include "LineReader.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/importio/LineReader.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/importio/LineReader.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/importio/LineReader.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/importio/LineReader.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Fri, 19 Jul 2002 -/// @version $Id: LineReader.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: LineReader.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Retrieves a file linewise and reports the lines to a handler. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/importio/NamedColumnsParser.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/importio/NamedColumnsParser.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/importio/NamedColumnsParser.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/importio/NamedColumnsParser.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Fri, 19 Jul 2002 -/// @version $Id: NamedColumnsParser.cpp 21316 2016-08-22 13:08:50Z behrisch $ +/// @version $Id: NamedColumnsParser.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A parser to retrieve information from a table with known column /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include #include "NamedColumnsParser.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/importio/NamedColumnsParser.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/importio/NamedColumnsParser.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/importio/NamedColumnsParser.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/importio/NamedColumnsParser.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Fri, 19 Jul 2002 -/// @version $Id: NamedColumnsParser.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: NamedColumnsParser.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A parser to retrieve information from a table with known columns /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/BinaryFormatter.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/BinaryFormatter.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/BinaryFormatter.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/BinaryFormatter.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 2012 -/// @version $Id: BinaryFormatter.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: BinaryFormatter.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Static storage of an output device and its base (abstract) implementation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,10 +42,6 @@ #include #include "BinaryFormatter.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions @@ -57,7 +53,7 @@ void BinaryFormatter::writeStaticHeader(std::ostream& into) { FileHelpers::writeByte(into, BF_BYTE); - FileHelpers::writeByte(into, 1); + FileHelpers::writeByte(into, 2); FileHelpers::writeByte(into, BF_STRING); FileHelpers::writeString(into, VERSION_STRING); writeStringList(into, SUMOXMLDefinitions::Tags.getStrings()); @@ -81,22 +77,16 @@ bool BinaryFormatter::writeXMLHeader(std::ostream& into, const std::string& rootElement, - const std::string& /* attrs */, - const std::string& /* comment */) { + const std::map& attrs) { if (myXMLStack.empty()) { - FileHelpers::writeByte(into, BF_BYTE); - FileHelpers::writeByte(into, 1); - FileHelpers::writeByte(into, BF_STRING); - FileHelpers::writeString(into, VERSION_STRING); - writeStringList(into, SUMOXMLDefinitions::Tags.getStrings()); - writeStringList(into, SUMOXMLDefinitions::Attrs.getStrings()); - writeStringList(into, SUMOXMLDefinitions::NodeTypes.getStrings()); - writeStringList(into, SUMOXMLDefinitions::EdgeFunctions.getStrings()); + writeStaticHeader(into); writeStringList(into, std::vector()); writeStringList(into, std::vector()); - if (SUMOXMLDefinitions::Tags.hasString(rootElement)) { openTag(into, rootElement); + for (std::map::const_iterator it = attrs.begin(); it != attrs.end(); ++it) { + writeAttr(into, it->first, it->second); + } return true; } } @@ -116,7 +106,9 @@ BinaryFormatter::openTag(std::ostream& into, const SumoXMLTag& xmlElement) { myXMLStack.push_back(xmlElement); FileHelpers::writeByte(into, BF_XML_TAG_START); - FileHelpers::writeByte(into, static_cast(xmlElement)); + const int tagNum = (int)xmlElement; + FileHelpers::writeByte(into, static_cast(tagNum % 256)); + FileHelpers::writeByte(into, static_cast(tagNum / 256)); } @@ -124,7 +116,6 @@ BinaryFormatter::closeTag(std::ostream& into) { if (!myXMLStack.empty()) { FileHelpers::writeByte(into, BF_XML_TAG_END); - FileHelpers::writeByte(into, static_cast(myXMLStack.back())); myXMLStack.pop_back(); return true; } @@ -140,7 +131,7 @@ template<> -void BinaryFormatter::writeAttr(std::ostream& into, const SumoXMLAttr attr, const SUMOReal& val) { +void BinaryFormatter::writeAttr(std::ostream& into, const SumoXMLAttr attr, const double& val) { if (into.precision() == 2 && val < 2e7 && val > -2e7) { // 2e7 is roughly INT_MAX/100 BinaryFormatter::writeAttrHeader(into, attr, BF_SCALED2INT); FileHelpers::writeInt(into, int(val * 100. + .5)); @@ -203,8 +194,7 @@ template<> void BinaryFormatter::writeAttr(std::ostream& into, const SumoXMLAttr attr, const Position& val) { - FileHelpers::writeByte(into, BF_XML_ATTRIBUTE); - FileHelpers::writeByte(into, static_cast(attr)); + BinaryFormatter::writeAttrHeader(into, attr); writePosition(into, val); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/BinaryFormatter.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/BinaryFormatter.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/BinaryFormatter.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/BinaryFormatter.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 2012 -/// @version $Id: BinaryFormatter.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: BinaryFormatter.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Output formatter for plain XML output /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -102,7 +102,9 @@ /// @brief BF_SCALED2INT_POSITION_2D, /// @brief - BF_SCALED2INT_POSITION_3D + BF_SCALED2INT_POSITION_3D, + /// @brief + BF_INVALID }; /// @brief Constructor @@ -121,13 +123,10 @@ * @param[in] into The output stream to use * @param[in] rootElement The root element to use * @param[in] attrs Additional attributes to save within the rootElement - * @param[in] comment Additional comment (saved in front the rootElement) - * @todo Check which parameter is used herein * @todo Describe what is saved */ bool writeXMLHeader(std::ostream& into, const std::string& rootElement, - const std::string& attrs = "", - const std::string& comment = ""); + const std::map& attrs); /** @brief Writes a header with optional edge list and connections. @@ -220,10 +219,14 @@ * @param[in] attr The attribute (name) * @param[in] type The attribute type */ - static inline void writeAttrHeader(std::ostream& into, const SumoXMLAttr attr, const DataType type) { + static inline void writeAttrHeader(std::ostream& into, const SumoXMLAttr attr, const DataType type = BF_INVALID) { FileHelpers::writeByte(into, static_cast(BF_XML_ATTRIBUTE)); - FileHelpers::writeByte(into, static_cast(attr)); - FileHelpers::writeByte(into, static_cast(type)); + const int attrNum = (int)attr; + FileHelpers::writeByte(into, static_cast(attrNum % 256)); + FileHelpers::writeByte(into, static_cast(attrNum / 256)); + if (type != BF_INVALID) { + FileHelpers::writeByte(into, static_cast(type)); + } } @@ -304,7 +307,7 @@ } template<> void BinaryFormatter::writeAttr(std::ostream& into, const SumoXMLAttr attr, const bool& val); -template<> void BinaryFormatter::writeAttr(std::ostream& into, const SumoXMLAttr attr, const SUMOReal& val); +template<> void BinaryFormatter::writeAttr(std::ostream& into, const SumoXMLAttr attr, const double& val); template<> void BinaryFormatter::writeAttr(std::ostream& into, const SumoXMLAttr attr, const int& val); template<> void BinaryFormatter::writeAttr(std::ostream& into, const SumoXMLAttr attr, const SumoXMLNodeType& val); template<> void BinaryFormatter::writeAttr(std::ostream& into, const SumoXMLAttr attr, const SumoXMLEdgeFunc& val); @@ -313,7 +316,7 @@ template<> void BinaryFormatter::writeAttr(std::ostream& into, const SumoXMLAttr attr, const Boundary& val); template<> void BinaryFormatter::writeAttr(std::ostream& into, const SumoXMLAttr attr, const RGBColor& val); template<> void BinaryFormatter::writeAttr(std::ostream& into, const SumoXMLAttr attr, const std::vector& val); -//template<> void BinaryFormatter::writeAttr(std::ostream& into, const SumoXMLAttr attr, const std::vector& val); +//template<> void BinaryFormatter::writeAttr(std::ostream& into, const SumoXMLAttr attr, const std::vector& val); template diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/BinaryInputDevice.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/BinaryInputDevice.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/BinaryInputDevice.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/BinaryInputDevice.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2005-09-15 -/// @version $Id: BinaryInputDevice.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: BinaryInputDevice.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Encapsulates binary reading operations on a file /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -35,10 +35,6 @@ #include "BinaryFormatter.h" #include "BinaryInputDevice.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // constants definitions // =========================================================================== @@ -121,14 +117,14 @@ BinaryInputDevice& -operator>>(BinaryInputDevice& os, SUMOReal& f) { +operator>>(BinaryInputDevice& os, double& f) { int t = os.checkType(BinaryFormatter::BF_FLOAT); if (t == BinaryFormatter::BF_SCALED2INT) { int v; os.myStream.read((char*) &v, sizeof(int)); f = v / 100.; } else { - os.myStream.read((char*) &f, sizeof(SUMOReal)); + os.myStream.read((char*) &f, sizeof(double)); } return os; } @@ -208,7 +204,7 @@ BinaryInputDevice& operator>>(BinaryInputDevice& os, Position& p) { int t = os.checkType(BinaryFormatter::BF_POSITION_2D); - SUMOReal x, y, z = 0; + double x, y, z = 0; if (t == BinaryFormatter::BF_SCALED2INT_POSITION_2D || t == BinaryFormatter::BF_SCALED2INT_POSITION_2D) { int v; os.myStream.read((char*) &v, sizeof(int)); @@ -220,10 +216,10 @@ z = v / 100.; } } else { - os.myStream.read((char*) &x, sizeof(SUMOReal)); - os.myStream.read((char*) &y, sizeof(SUMOReal)); + os.myStream.read((char*) &x, sizeof(double)); + os.myStream.read((char*) &y, sizeof(double)); if (t == BinaryFormatter::BF_POSITION_3D) { - os.myStream.read((char*) &z, sizeof(SUMOReal)); + os.myStream.read((char*) &z, sizeof(double)); } } p.set(x, y, z); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/BinaryInputDevice.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/BinaryInputDevice.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/BinaryInputDevice.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/BinaryInputDevice.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 2005-09-15 -/// @version $Id: BinaryInputDevice.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: BinaryInputDevice.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Encapsulates binary reading operations on a file /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -75,7 +75,7 @@ ~BinaryInputDevice(); - /** @brief Returns whether the file can be used (is good()) + /** @brief Returns whether the underlying file stream can be used (is good()) * * @return Whether the file is good */ @@ -89,16 +89,17 @@ int peek(); - /** @brief Returns the next character to be read by an actual parse. + /** @brief Reads the defined number of bytes and returns them as a string. * - * @return the next character which will be returned + * @param[in] numBytes The number of bytes to read + * @return the string read */ std::string read(int numBytes); - /** @brief Returns the next character to be read by an actual parse. + /** @brief Pushes a character back into the stream to be read by the next actual parse. * - * @return the next character which will be returned + * @param[in] c The char to store in the stream */ void putback(char c); @@ -130,13 +131,13 @@ friend BinaryInputDevice& operator>>(BinaryInputDevice& os, int& i); - /** @brief Reads a SUMOReal from the file (input operator) + /** @brief Reads a double from the file (input operator) * - * @param[in, out] os The BinaryInputDevice to read the SUMOReal from - * @param[in] i The SUMOReal to store the read value into + * @param[in, out] os The BinaryInputDevice to read the double from + * @param[in] i The double to store the read value into * @return The used BinaryInputDevice for further processing */ - friend BinaryInputDevice& operator>>(BinaryInputDevice& os, SUMOReal& f); + friend BinaryInputDevice& operator>>(BinaryInputDevice& os, double& f); /** @brief Reads a bool from the file (input operator) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_CERR.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_CERR.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_CERR.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_CERR.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,7 +3,7 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004 -/// @version $Id: OutputDevice_CERR.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: OutputDevice_CERR.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // An output device that encapsulates cout /****************************************************************************/ @@ -32,10 +32,6 @@ #include #include "OutputDevice_CERR.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_CERR.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_CERR.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_CERR.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_CERR.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004 -/// @version $Id: OutputDevice_CERR.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: OutputDevice_CERR.h 22608 2017-01-17 06:28:54Z behrisch $ /// // An output device that encapsulates cerr /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_COUT.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_COUT.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_COUT.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_COUT.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004 -/// @version $Id: OutputDevice_COUT.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: OutputDevice_COUT.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // An output device that encapsulates cout /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,10 +32,6 @@ #include #include "OutputDevice_COUT.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_COUT.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_COUT.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_COUT.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_COUT.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004 -/// @version $Id: OutputDevice_COUT.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: OutputDevice_COUT.h 22608 2017-01-17 06:28:54Z behrisch $ /// // An output device that encapsulates cout /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 2004 -/// @version $Id: OutputDevice.cpp 21201 2016-07-19 11:57:22Z behrisch $ +/// @version $Id: OutputDevice.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Static storage of an output device and its base (abstract) implementation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,10 +48,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions @@ -94,7 +90,8 @@ time_t rawtime; char buffer [80]; time(&rawtime); - strftime(buffer, 80, "%F-%H-%M-%S", localtime(&rawtime)); + struct tm* timeinfo = localtime(&rawtime); + strftime(buffer, 80, "%Y-%m-%d-%H-%M-%S", timeinfo); prefix.replace(metaTimeIndex, 4, std::string(buffer)); } name2 = FileHelpers::prependToLastPathComponent(prefix, name); @@ -117,11 +114,7 @@ } OutputDevice& dev = OutputDevice::getDevice(OptionsCont::getOptions().getString(optionName)); if (rootElement != "") { - if (schemaFile != "") { - dev.writeXMLHeader(rootElement, "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/" + schemaFile + "\""); - } else { - dev.writeXMLHeader(rootElement); - } + dev.writeXMLHeader(rootElement, schemaFile); } return true; } @@ -168,7 +161,7 @@ std::string -OutputDevice::realString(const SUMOReal v, const int precision) { +OutputDevice::realString(const double v, const int precision) { std::ostringstream oss; if (v == 0) { return "0"; @@ -230,8 +223,13 @@ bool OutputDevice::writeXMLHeader(const std::string& rootElement, - const std::string& attrs, const std::string& comment) { - return myFormatter->writeXMLHeader(getOStream(), rootElement, attrs, comment); + const std::string& schemaFile, + std::map attrs) { + if (schemaFile != "") { + attrs[SUMO_ATTR_XMLNS] = "http://www.w3.org/2001/XMLSchema-instance"; + attrs[SUMO_ATTR_SCHEMA_LOCATION] = "http://sumo.dlr.de/xsd/" + schemaFile; + } + return myFormatter->writeXMLHeader(getOStream(), rootElement, attrs); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_File.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_File.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_File.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_File.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 2004 -/// @version $Id: OutputDevice_File.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: OutputDevice_File.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // An output device that encapsulates an ofstream /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,10 +36,6 @@ #include #include "OutputDevice_File.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_File.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_File.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_File.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_File.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2004 -/// @version $Id: OutputDevice_File.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: OutputDevice_File.h 22608 2017-01-17 06:28:54Z behrisch $ /// // An output device that encapsulates an ofstream /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Mario Krumnow /// @date 2004 -/// @version $Id: OutputDevice.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: OutputDevice.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Static storage of an output device and its base (abstract) implementation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -136,7 +136,7 @@ * @param[in] precision the precision to achieve * @return The formatted string */ - static std::string realString(const SUMOReal v, const int precision = OUTPUT_ACCURACY); + static std::string realString(const double v, const int precision = gPrecision); public: @@ -165,7 +165,7 @@ /** @brief Sets the precison or resets it to default * @param[in] precision The accuracy (number of digits behind '.') to set */ - void setPrecision(int precision = OUTPUT_ACCURACY); + void setPrecision(int precision = gPrecision); /** @brief Writes an XML header with optional configuration @@ -174,15 +174,14 @@ * is written and false returned. * * @param[in] rootElement The root element to use + * @param[in] schemaFile The basename of the schema file to use * @param[in] attrs Additional attributes to save within the rootElement - * @param[in] comment Additional comment (saved in front the rootElement) * @return Whether the header could be written (stack was empty) - * @todo Check which parameter is used herein * @todo Describe what is saved */ bool writeXMLHeader(const std::string& rootElement, - const std::string& attrs = "", - const std::string& comment = ""); + const std::string& schemaFile, + std::map attrs = std::map()); template diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_Network.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_Network.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_Network.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_Network.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Felix Brack /// @date 2006 -/// @version $Id: OutputDevice_Network.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: OutputDevice_Network.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // An output device for TCP/IP Network connections /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2006-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2006-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,10 +40,6 @@ #include "foreign/tcpip/socket.h" #include "utils/common/ToString.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // #ifdef CHECK_MEMORY_LEAKS - // ========================================================================== // method definitions @@ -51,7 +47,14 @@ OutputDevice_Network::OutputDevice_Network(const std::string& host, const int port) { mySocket = new tcpip::Socket(host, port); +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable: 4127) // do not warn about constant conditional expression +#endif for (int wait = 1000; true; wait += 1000) { +#ifdef _MSC_VER +#pragma warning(pop) +#endif try { mySocket->connect(); break; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_Network.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_Network.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_Network.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_Network.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Felix Brack /// @date 2006 -/// @version $Id: OutputDevice_Network.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: OutputDevice_Network.h 22608 2017-01-17 06:28:54Z behrisch $ /// // An output device for TCP/IP Network connections /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2006-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2006-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_String.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_String.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_String.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_String.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file OutputDevice_String.cpp /// @author Michael Behrisch /// @date 2009 -/// @version $Id: OutputDevice_String.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: OutputDevice_String.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // An output device that encapsulates a stringstream /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,10 +32,6 @@ #include #include "OutputDevice_String.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_String.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_String.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputDevice_String.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputDevice_String.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file OutputDevice_String.h /// @author Michael Behrisch /// @date 2009 -/// @version $Id: OutputDevice_String.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: OutputDevice_String.h 22608 2017-01-17 06:28:54Z behrisch $ /// // An output device that encapsulates a stringstream /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputFormatter.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputFormatter.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/OutputFormatter.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/OutputFormatter.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2012 -/// @version $Id: OutputFormatter.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: OutputFormatter.h 22929 2017-02-13 14:38:39Z behrisch $ /// // Abstract base class for output formatters /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -70,13 +70,11 @@ * @param[in] into The output stream to use * @param[in] rootElement The root element to use * @param[in] attrs Additional attributes to save within the rootElement - * @param[in] comment Additional comment (saved in front the rootElement) * @todo Check which parameter is used herein * @todo Describe what is saved */ virtual bool writeXMLHeader(std::ostream& into, const std::string& rootElement, - const std::string& attrs = "", - const std::string& comment = "") = 0; + const std::map& attrs) = 0; /** @brief Opens an XML tag diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/PlainXMLFormatter.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/PlainXMLFormatter.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/PlainXMLFormatter.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/PlainXMLFormatter.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2012 -/// @version $Id: PlainXMLFormatter.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: PlainXMLFormatter.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Static storage of an output device and its base (abstract) implementation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,10 +33,6 @@ #include #include "PlainXMLFormatter.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions @@ -59,15 +55,12 @@ bool PlainXMLFormatter::writeXMLHeader(std::ostream& into, const std::string& rootElement, - const std::string& attrs, const std::string& comment) { + const std::map& attrs) { if (myXMLStack.empty()) { OptionsCont::getOptions().writeXMLHeader(into); - if (comment != "") { - into << comment << "\n"; - } openTag(into, rootElement); - if (attrs != "") { - into << " " << attrs; + for (std::map::const_iterator it = attrs.begin(); it != attrs.end(); ++it) { + writeAttr(into, it->first, it->second); } into << ">\n"; myHavePendingOpener = false; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/PlainXMLFormatter.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/PlainXMLFormatter.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/iodevices/PlainXMLFormatter.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/iodevices/PlainXMLFormatter.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date 2012 -/// @version $Id: PlainXMLFormatter.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: PlainXMLFormatter.h 22929 2017-02-13 14:38:39Z behrisch $ /// // Output formatter for plain XML output /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -61,13 +61,10 @@ * @param[in] into The output stream to use * @param[in] rootElement The root element to use * @param[in] attrs Additional attributes to save within the rootElement - * @param[in] comment Additional comment (saved in front the rootElement) - * @todo Check which parameter is used herein * @todo Describe what is saved */ bool writeXMLHeader(std::ostream& into, const std::string& rootElement, - const std::string& attrs = "", - const std::string& comment = ""); + const std::map& attrs); /** @brief Writes an XML header with optional configuration diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/Option.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/Option.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/Option.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/Option.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 17 Dec 2001 -/// @version $Id: Option.cpp 21474 2016-09-14 09:05:31Z behrisch $ +/// @version $Id: Option.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A class representing a single program option /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,10 +41,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -82,9 +78,9 @@ } -SUMOReal +double Option::getFloat() const { - throw InvalidArgument("This is not a SUMOReal-option"); + throw InvalidArgument("This is not a double-option"); } @@ -299,7 +295,7 @@ /* ------------------------------------------------------------------------- * Option_Float - methods * ----------------------------------------------------------------------- */ -Option_Float::Option_Float(SUMOReal value) +Option_Float::Option_Float(double value) : Option(true), myValue(value) { myTypeName = "FLOAT"; } @@ -325,7 +321,7 @@ } -SUMOReal +double Option_Float::getFloat() const { return myValue; } @@ -334,7 +330,7 @@ bool Option_Float::set(const std::string& v) { try { - myValue = TplConvert::_2SUMOReal(v.c_str()); + myValue = TplConvert::_2double(v.c_str()); return markSet(); } catch (...) { throw ProcessError("'" + v + "' is not a valid float."); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/Option.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/Option.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/Option.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/Option.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Mon, 17 Dec 2001 -/// @version $Id: Option.h 21474 2016-09-14 09:05:31Z behrisch $ +/// @version $Id: Option.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Classes representing a single program option (with different types) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -93,7 +93,7 @@ void unSet(); - /** @brief Returns the stored SUMOReal value + /** @brief Returns the stored double value * * Option_Float returns the stored real number in this method's reimplementation. * All other option classes do not override this method which throws an InvalidArgument-exception. @@ -101,7 +101,7 @@ * @return Returns the stored real number if being an instance of Option_Float * @exception InvalidArgument If the class is not an instance of Option_Float */ - virtual SUMOReal getFloat() const; + virtual double getFloat() const; /** @brief Returns the stored integer value @@ -457,7 +457,7 @@ * * @param[in] value This option's default value */ - Option_Float(SUMOReal value); + Option_Float(double value); /** @brief Copy constructor */ @@ -472,27 +472,27 @@ Option_Float& operator=(const Option_Float& s); - /** @brief Returns the stored SUMOReal value - * @see SUMOReal Option::getFloat() + /** @brief Returns the stored double value + * @see double Option::getFloat() * @return Returns the stored real number */ - SUMOReal getFloat() const; + double getFloat() const; - /** @brief Stores the given value after parsing it into a SUMOReal + /** @brief Stores the given value after parsing it into a double * - * The value is converted into a SUMOReal and stored in "myValue". + * The value is converted into a double and stored in "myValue". * Then, "markSet" is called in order to know that a value has been set. * * The method returns whether the value could be set (the return value from * "markSet"). * - * If the string could not be converted into a SUMOReal, an InvalidArgument + * If the string could not be converted into a double, an InvalidArgument * is thrown. * * @see bool Option::set(std::string v) * @return Whether the new value could be set - * @exception InvalidArgument If the value could not be converted into a SUMOReal + * @exception InvalidArgument If the value could not be converted into a double */ bool set(const std::string& v); @@ -509,7 +509,7 @@ private: /** the value, valid only when the base-classes "myAmSet"-member is true */ - SUMOReal myValue; + double myValue; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/OptionsCont.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/OptionsCont.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/OptionsCont.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/OptionsCont.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Walter Bamberger /// @date Mon, 17 Dec 2001 -/// @version $Id: OptionsCont.cpp 21217 2016-07-22 10:57:44Z behrisch $ +/// @version $Id: OptionsCont.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A storage for options (typed value containers) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -51,10 +51,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions @@ -73,7 +69,7 @@ OptionsCont::OptionsCont() : myAddresses(), myValues(), myDeprecatedSynonymes(), myHaveInformedAboutDeprecatedDivider(false) { - myCopyrightNotices.push_back("Copyright (C) 2001-2016 DLR and contributors; http://sumo.dlr.de"); + myCopyrightNotices.push_back("Copyright (C) 2001-2017 DLR and contributors; http://sumo.dlr.de"); } @@ -216,7 +212,7 @@ } -SUMOReal +double OptionsCont::getFloat(const std::string& name) const { Option* o = getSecure(name); return o->getFloat(); @@ -339,13 +335,18 @@ StringTokenizer st((*i)->getString(), ";, ", true); std::string conv; while (st.hasNext()) { - if (conv.length() != 0) { - conv += ','; - } std::string tmp = st.next(); + // Test whether this is a whitespace string and disregard item if so. + // This may stem, e.g., from separating filenames by ', ' in the configuration file + if (tmp.find_first_not_of("\t ") == std::string::npos) { + continue; + } if (!FileHelpers::isAbsolute(tmp)) { tmp = FileHelpers::getConfigurationRelative(configuration, tmp); } + if (conv.length() != 0) { + conv += ','; + } conv += StringUtils::urlDecode(tmp); } if (conv != (*i)->getString()) { @@ -757,10 +758,19 @@ void -OptionsCont::writeConfiguration(std::ostream& os, bool filled, - bool complete, bool addComments) const { +OptionsCont::writeConfiguration(std::ostream& os, const bool filled, + const bool complete, const bool addComments, + const bool maskDoubleHyphen) const { os << "\n\n"; - os << "" << std::endl << std::endl; + os << "" << std::endl << std::endl; for (std::vector::const_iterator i = mySubTopics.begin(); i != mySubTopics.end(); ++i) { std::string subtopic = *i; if (subtopic == "Configuration" && !complete) { @@ -781,12 +791,12 @@ } // add the comment if wished if (addComments) { - os << " " << std::endl; + os << " " << std::endl; } // write the option and the value (if given) os << " <" << *j << " value=\""; if (o->isSet() && (filled || o->isDefault())) { - os << o->getValueString(); + os << StringUtils::escapeXML(o->getValueString(), maskDoubleHyphen); } if (complete) { std::vector synonymes = getSynonymes(*j); @@ -873,7 +883,7 @@ time(&rawtime); strftime(buffer, 80, "\n\n"; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/OptionsCont.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/OptionsCont.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/OptionsCont.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/OptionsCont.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Walter Bamberger /// @date Mon, 17 Dec 2001 -/// @version $Id: OptionsCont.h 21204 2016-07-20 07:42:26Z behrisch $ +/// @version $Id: OptionsCont.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A storage for options (typed value containers) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -183,9 +183,11 @@ * @param[in] filled Whether only set (and not default) options shall be written * @param[in] complete Whether all options shall be written * @param[in] addComments Whether comments (option descriptions) shall be written + * @param[in] maskDoubleHyphen Whether -- in input shall be converted to -- (semantically equivalent but allowed in XML comments) */ - void writeConfiguration(std::ostream& os, bool filled, - bool complete, bool addComments) const; + void writeConfiguration(std::ostream& os, const bool filled, + const bool complete, const bool addComments, + const bool maskDoubleHyphen = false) const; /** @brief Writes the xml schema for the configuration @@ -433,17 +435,17 @@ std::string getString(const std::string& name) const; - /** @brief Returns the SUMOReal-value of the named option (only for Option_Float) + /** @brief Returns the double-value of the named option (only for Option_Float) * - * This method returns the SUMOReal-value of an existing SUMOReal-option. - * If the named option does not exist or is not a SUMOReal-option, an + * This method returns the double-value of an existing double-option. + * If the named option does not exist or is not a double-option, an * InvalidArgument is thrown. * - * @param[in] name The name of the option to return the SUMOReal-value of - * @return The SUMOReal-value of the named, existing SUMOReal-option - * @exception InvalidArgument If the option does not exist or is not a SUMOReal-option + * @param[in] name The name of the option to return the double-value of + * @return The double-value of the named, existing double-option + * @exception InvalidArgument If the option does not exist or is not a double-option */ - SUMOReal getFloat(const std::string& name) const; + double getFloat(const std::string& name) const; /** @brief Returns the int-value of the named option (only for Option_Integer) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/OptionsIO.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/OptionsIO.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/OptionsIO.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/OptionsIO.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 17 Dec 2001 -/// @version $Id: OptionsIO.cpp 21172 2016-07-15 08:34:36Z behrisch $ +/// @version $Id: OptionsIO.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Helper for parsing command line arguments and reading configuration files /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,6 +31,8 @@ #include #include +#include +#include #include #include #include @@ -38,7 +40,6 @@ #include #include #include -#include #include "OptionsIO.h" #include "OptionsCont.h" #include "OptionsLoader.h" @@ -47,10 +48,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions // =========================================================================== @@ -67,6 +64,19 @@ myArgV = argv; } + +void +OptionsIO::setArgs(const std::vector& args) { + myArgC = (int)args.size() + 1; + char** argv = new char* [myArgC]; + argv[0] = myArgV[0]; + for (int i = 1; i < myArgC; i++) { + argv[i] = new char[args[i - 1].size() + 1]; + std::strcpy(argv[i], args[i - 1].c_str()); + } + myArgV = argv; +} + void OptionsIO::getOptions(const bool commandLineOnly) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/OptionsIO.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/OptionsIO.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/OptionsIO.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/OptionsIO.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 17 Dec 2001 -/// @version $Id: OptionsIO.h 21172 2016-07-15 08:34:36Z behrisch $ +/// @version $Id: OptionsIO.h 23645 2017-03-24 09:23:31Z behrisch $ /// // Helper for parsing command line arguments and reading configuration files /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,6 +31,8 @@ #include #endif +#include +#include #include @@ -60,6 +62,18 @@ */ static void setArgs(int argc, char** argv); + /** @brief Stores faked command line arguments for later parsing + * + * @param[in] args arguments given as substitute for the command line + */ + static void setArgs(const std::vector& args); + + /** @brief Return the number of command line arguments + */ + static int getArgC() { + return myArgC; + } + /** @brief Parses the command line arguments and loads the configuration * diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/OptionsLoader.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/OptionsLoader.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/OptionsLoader.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/OptionsLoader.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 17 Dec 2001 -/// @version $Id: OptionsLoader.cpp 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: OptionsLoader.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // A SAX-Handler for loading options /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/OptionsLoader.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/OptionsLoader.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/OptionsLoader.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/OptionsLoader.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 17 Dec 2001 -/// @version $Id: OptionsLoader.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: OptionsLoader.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A SAX-Handler for loading options /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/OptionsParser.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/OptionsParser.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/OptionsParser.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/OptionsParser.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 17 Dec 2001 -/// @version $Id: OptionsParser.cpp 21201 2016-07-19 11:57:22Z behrisch $ +/// @version $Id: OptionsParser.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Parses the command line arguments /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -38,10 +38,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/OptionsParser.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/OptionsParser.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/options/OptionsParser.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/options/OptionsParser.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 17 Dec 2001 -/// @version $Id: OptionsParser.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: OptionsParser.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Parses command line arguments /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/shapes/PointOfInterest.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/shapes/PointOfInterest.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/shapes/PointOfInterest.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/shapes/PointOfInterest.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,7 @@ /// @author Michael Behrisch /// @author Melanie Knocke /// @date 2005-09-15 -/// @version $Id: PointOfInterest.h 20801 2016-05-28 05:31:30Z behrisch $ +/// @version $Id: PointOfInterest.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A point-of-interest (2D) /****************************************************************************/ @@ -63,11 +63,11 @@ */ PointOfInterest(const std::string& id, const std::string& type, const RGBColor& color, const Position& pos, - SUMOReal layer = DEFAULT_LAYER, - SUMOReal angle = DEFAULT_ANGLE, + double layer = DEFAULT_LAYER, + double angle = DEFAULT_ANGLE, const std::string& imgFile = DEFAULT_IMG_FILE, - SUMOReal width = DEFAULT_IMG_WIDTH, - SUMOReal height = DEFAULT_IMG_HEIGHT) : + double width = DEFAULT_IMG_WIDTH, + double height = DEFAULT_IMG_HEIGHT) : Shape(id, type, color, layer, angle, imgFile), Position(pos), myHalfImgWidth(width / 2.0), @@ -84,12 +84,12 @@ /// @{ /// @brief Returns the image width of the POI - inline SUMOReal getWidth() const { + inline double getWidth() const { return myHalfImgWidth * 2.0; } /// @brief Returns the image height of the POI - inline SUMOReal getHeight() const { + inline double getHeight() const { return myHalfImgHeight * 2.0; } /// @} @@ -100,12 +100,12 @@ /// @{ /// @brief set the image width of the POI - inline void setWidth(SUMOReal width) { + inline void setWidth(double width) { myHalfImgWidth = width / 2.0; } /// @brief set the image height of the POI - inline void setHeight(SUMOReal height) { + inline void setHeight(double height) { myHalfImgHeight = height / 2.0; } /// @} @@ -114,7 +114,7 @@ /* @brief POI definition to the given device * @param[in] geo Whether to write the output in geo-coordinates */ - void writeXML(OutputDevice& out, const bool geo = false, const SUMOReal zOffset = 0., const std::string laneID = "", const SUMOReal pos = 0.) { + void writeXML(OutputDevice& out, const bool geo = false, const double zOffset = 0., const std::string laneID = "", const double pos = 0.) { out.openTag(SUMO_TAG_POI); out.writeAttr(SUMO_ATTR_ID, StringUtils::escapeXML(getID())); out.writeAttr(SUMO_ATTR_TYPE, StringUtils::escapeXML(getType())); @@ -158,10 +158,10 @@ protected: ///@brief The half width of the image when rendering this POI - SUMOReal myHalfImgWidth; + double myHalfImgWidth; ///@brief The half height of the image when rendering this POI - SUMOReal myHalfImgHeight; + double myHalfImgHeight; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/shapes/Polygon.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/shapes/Polygon.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/shapes/Polygon.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/shapes/Polygon.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Jun 2004 -/// @version $Id: Polygon.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: Polygon.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A 2D-polygon /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,17 +36,13 @@ #include "Polygon.h" using namespace SUMO; -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member definitions // =========================================================================== Polygon::Polygon(const std::string& id, const std::string& type, const RGBColor& color, const PositionVector& shape, bool fill, - SUMOReal layer, SUMOReal angle, const std::string& imgFile) : + double layer, double angle, const std::string& imgFile) : Shape(id, type, color, layer, angle, imgFile), myShape(shape), myFill(fill) { @@ -78,12 +74,7 @@ if (getImgFile() != Shape::DEFAULT_IMG_FILE) { out.writeAttr(SUMO_ATTR_IMGFILE, getImgFile()); } - for (std::map::const_iterator j = getMap().begin(); j != getMap().end(); ++j) { - out.openTag(SUMO_TAG_PARAM); - out.writeAttr(SUMO_ATTR_KEY, (*j).first); - out.writeAttr(SUMO_ATTR_VALUE, (*j).second); - out.closeTag(); - } + writeParams(out); out.closeTag(); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/shapes/Polygon.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/shapes/Polygon.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/shapes/Polygon.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/shapes/Polygon.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Melanie Knocke /// @date Jun 2004 -/// @version $Id: Polygon.h 20801 2016-05-28 05:31:30Z behrisch $ +/// @version $Id: Polygon.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A 2D- or 3D-polygon /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2004-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -68,8 +68,8 @@ */ Polygon(const std::string& id, const std::string& type, const RGBColor& color, const PositionVector& shape, bool fill, - SUMOReal layer = DEFAULT_LAYER, - SUMOReal angle = DEFAULT_ANGLE, + double layer = DEFAULT_LAYER, + double angle = DEFAULT_ANGLE, const std::string& imgFile = DEFAULT_IMG_FILE); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/shapes/ShapeContainer.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/shapes/ShapeContainer.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/shapes/ShapeContainer.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/shapes/ShapeContainer.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: ShapeContainer.cpp 20801 2016-05-28 05:31:30Z behrisch $ +/// @version $Id: ShapeContainer.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Storage for geometrical objects, sorted by the layers they are in /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,10 +46,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -60,8 +56,8 @@ bool ShapeContainer::addPolygon(const std::string& id, const std::string& type, - const RGBColor& color, SUMOReal layer, - SUMOReal angle, const std::string& imgFile, + const RGBColor& color, double layer, + double angle, const std::string& imgFile, const PositionVector& shape, bool fill, bool ignorePruning) { return add(new SUMO::Polygon(id, type, color, shape, fill, layer, angle, imgFile), ignorePruning); } @@ -69,8 +65,8 @@ bool ShapeContainer::addPOI(const std::string& id, const std::string& type, - const RGBColor& color, SUMOReal layer, SUMOReal angle, const std::string& imgFile, - const Position& pos, SUMOReal width, SUMOReal height, bool ignorePruning) { + const RGBColor& color, double layer, double angle, const std::string& imgFile, + const Position& pos, double width, double height, bool ignorePruning) { return add(new PointOfInterest(id, type, color, pos, layer, angle, imgFile, width, height), ignorePruning); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/shapes/ShapeContainer.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/shapes/ShapeContainer.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/shapes/ShapeContainer.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/shapes/ShapeContainer.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 2005-09-15 -/// @version $Id: ShapeContainer.h 20801 2016-05-28 05:31:30Z behrisch $ +/// @version $Id: ShapeContainer.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Storage for geometrical objects, sorted by the layers they are in /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2005-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2005-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -69,8 +69,8 @@ * @return whether the polygon could be added */ virtual bool addPolygon(const std::string& id, const std::string& type, - const RGBColor& color, SUMOReal layer, - SUMOReal angle, const std::string& imgFile, + const RGBColor& color, double layer, + double angle, const std::string& imgFile, const PositionVector& shape, bool fill, bool ignorePruning = false); @@ -88,8 +88,8 @@ * @return whether the poi could be added */ virtual bool addPOI(const std::string& id, const std::string& type, - const RGBColor& color, SUMOReal layer, SUMOReal angle, const std::string& imgFile, - const Position& pos, SUMOReal width, SUMOReal height, bool ignorePruning = false); + const RGBColor& color, double layer, double angle, const std::string& imgFile, + const Position& pos, double width, double height, bool ignorePruning = false); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/shapes/Shape.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/shapes/Shape.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/shapes/Shape.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/shapes/Shape.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Oct 2012 -/// @version $Id: Shape.cpp 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: Shape.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A 2D- or 3D-Shape /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -31,26 +31,22 @@ #include "Shape.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member definitions // =========================================================================== const std::string Shape::DEFAULT_TYPE = ""; -const SUMOReal Shape::DEFAULT_LAYER = 128; -const SUMOReal Shape::DEFAULT_ANGLE = 0; +const double Shape::DEFAULT_LAYER = 128; +const double Shape::DEFAULT_ANGLE = 0; const std::string Shape::DEFAULT_IMG_FILE = ""; -const SUMOReal Shape::DEFAULT_IMG_WIDTH = 1; -const SUMOReal Shape::DEFAULT_IMG_HEIGHT = 1; +const double Shape::DEFAULT_IMG_WIDTH = 1; +const double Shape::DEFAULT_IMG_HEIGHT = 1; // =========================================================================== // member definitions // =========================================================================== Shape::Shape(const std::string& id, const std::string& type, - const RGBColor& color, SUMOReal layer, - SUMOReal angle, const std::string& imgFile) : + const RGBColor& color, double layer, + double angle, const std::string& imgFile) : Named(id), myType(type), myColor(color), diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/shapes/Shape.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/shapes/Shape.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/shapes/Shape.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/shapes/Shape.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Oct 2012 -/// @version $Id: Shape.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: Shape.h 23150 2017-02-27 12:08:30Z behrisch $ /// // A 2D- or 3D-Shape /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -54,8 +54,8 @@ * @param[in] imgFile The raster image of the shape */ Shape(const std::string& id, const std::string& type, - const RGBColor& color, SUMOReal layer, - SUMOReal angle, const std::string& imgFile); + const RGBColor& color, double layer, + double angle, const std::string& imgFile); /// @brief Destructor @@ -84,14 +84,14 @@ /** @brief Returns the layer of the Shape * @return The Shape's layer */ - inline SUMOReal getLayer() const { + inline double getLayer() const { return myLayer; } /** @brief Returns the angle of the Shape in navigational degrees * @return The Shape's rotation angle */ - inline SUMOReal getNaviDegree() const { + inline double getNaviDegree() const { return myNaviDegreeAngle; } @@ -126,7 +126,7 @@ /** @brief Sets a new layer * @param[in] layer The new layer to use */ - inline void setLayer(const SUMOReal layer) { + inline void setLayer(const double layer) { myLayer = layer; } @@ -134,7 +134,7 @@ /** @brief Sets a new angle in navigational degrees * @param[in] layer The new angle to use */ - inline void setNaviDegree(const SUMOReal angle) { + inline void setNaviDegree(const double angle) { myNaviDegreeAngle = angle; } @@ -147,11 +147,11 @@ /// @} static const std::string DEFAULT_TYPE; - static const SUMOReal DEFAULT_LAYER; - static const SUMOReal DEFAULT_ANGLE; + static const double DEFAULT_LAYER; + static const double DEFAULT_ANGLE; static const std::string DEFAULT_IMG_FILE; - static const SUMOReal DEFAULT_IMG_WIDTH; - static const SUMOReal DEFAULT_IMG_HEIGHT; + static const double DEFAULT_IMG_WIDTH; + static const double DEFAULT_IMG_HEIGHT; protected: /// @brief The type of the Shape @@ -161,10 +161,10 @@ RGBColor myColor; /// @brief The layer of the Shape - SUMOReal myLayer; + double myLayer; /// @brief The angle of the Shape - SUMOReal myNaviDegreeAngle; + double myNaviDegreeAngle; /// @brief The angle of the Shape std::string myImgFile; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/shapes/ShapeHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/shapes/ShapeHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/shapes/ShapeHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/shapes/ShapeHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @file ShapeHandler.cpp /// @author Jakob Erdmann /// @date Feb 2015 -/// @version $Id: ShapeHandler.cpp 20801 2016-05-28 05:31:30Z behrisch $ +/// @version $Id: ShapeHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // The XML-Handler for network loading /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -44,10 +44,6 @@ #include "ShapeContainer.h" #include "ShapeHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -70,7 +66,7 @@ addPoly(attrs, false, false); break; case SUMO_TAG_POI: - myDefaultLayer = (SUMOReal)GLO_POI; + myDefaultLayer = (double)GLO_POI; addPOI(attrs, false, false); break; default: @@ -86,24 +82,24 @@ void ShapeHandler::addPOI(const SUMOSAXAttributes& attrs, const bool ignorePruning, const bool useProcessing) { bool ok = true; - const SUMOReal INVALID_POSITION(-1000000); + const double INVALID_POSITION(-1000000); const std::string id = myPrefix + attrs.get(SUMO_ATTR_ID, 0, ok); - SUMOReal x = attrs.getOpt(SUMO_ATTR_X, id.c_str(), ok, INVALID_POSITION); - const SUMOReal y = attrs.getOpt(SUMO_ATTR_Y, id.c_str(), ok, INVALID_POSITION); - SUMOReal lon = attrs.getOpt(SUMO_ATTR_LON, id.c_str(), ok, INVALID_POSITION); - SUMOReal lat = attrs.getOpt(SUMO_ATTR_LAT, id.c_str(), ok, INVALID_POSITION); - const SUMOReal lanePos = attrs.getOpt(SUMO_ATTR_POSITION, id.c_str(), ok, INVALID_POSITION); - const SUMOReal layer = attrs.getOpt(SUMO_ATTR_LAYER, id.c_str(), ok, myDefaultLayer); + double x = attrs.getOpt(SUMO_ATTR_X, id.c_str(), ok, INVALID_POSITION); + const double y = attrs.getOpt(SUMO_ATTR_Y, id.c_str(), ok, INVALID_POSITION); + double lon = attrs.getOpt(SUMO_ATTR_LON, id.c_str(), ok, INVALID_POSITION); + double lat = attrs.getOpt(SUMO_ATTR_LAT, id.c_str(), ok, INVALID_POSITION); + const double lanePos = attrs.getOpt(SUMO_ATTR_POSITION, id.c_str(), ok, INVALID_POSITION); + const double layer = attrs.getOpt(SUMO_ATTR_LAYER, id.c_str(), ok, myDefaultLayer); const std::string type = attrs.getOpt(SUMO_ATTR_TYPE, id.c_str(), ok, ""); const std::string laneID = attrs.getOpt(SUMO_ATTR_LANE, id.c_str(), ok, ""); const RGBColor color = attrs.hasAttribute(SUMO_ATTR_COLOR) ? attrs.get(SUMO_ATTR_COLOR, id.c_str(), ok) : myDefaultColor; - const SUMOReal angle = attrs.getOpt(SUMO_ATTR_ANGLE, id.c_str(), ok, Shape::DEFAULT_ANGLE); + const double angle = attrs.getOpt(SUMO_ATTR_ANGLE, id.c_str(), ok, Shape::DEFAULT_ANGLE); std::string imgFile = attrs.getOpt(SUMO_ATTR_IMGFILE, id.c_str(), ok, Shape::DEFAULT_IMG_FILE); if (imgFile != "" && !FileHelpers::isAbsolute(imgFile)) { imgFile = FileHelpers::getConfigurationRelative(getFileName(), imgFile); } - const SUMOReal width = attrs.getOpt(SUMO_ATTR_WIDTH, id.c_str(), ok, Shape::DEFAULT_IMG_WIDTH); - const SUMOReal height = attrs.getOpt(SUMO_ATTR_HEIGHT, id.c_str(), ok, Shape::DEFAULT_IMG_HEIGHT); + const double width = attrs.getOpt(SUMO_ATTR_WIDTH, id.c_str(), ok, Shape::DEFAULT_IMG_WIDTH); + const double height = attrs.getOpt(SUMO_ATTR_HEIGHT, id.c_str(), ok, Shape::DEFAULT_IMG_HEIGHT); if (!ok) { return; } @@ -156,7 +152,7 @@ if (!ok) { return; } - const SUMOReal layer = attrs.getOpt(SUMO_ATTR_LAYER, id.c_str(), ok, myDefaultLayer); + const double layer = attrs.getOpt(SUMO_ATTR_LAYER, id.c_str(), ok, myDefaultLayer); const bool fill = attrs.getOpt(SUMO_ATTR_FILL, id.c_str(), ok, myDefaultFill); const std::string type = attrs.getOpt(SUMO_ATTR_TYPE, id.c_str(), ok, Shape::DEFAULT_TYPE); const RGBColor color = attrs.hasAttribute(SUMO_ATTR_COLOR) ? attrs.get(SUMO_ATTR_COLOR, id.c_str(), ok) : myDefaultColor; @@ -175,7 +171,7 @@ return; } } - const SUMOReal angle = attrs.getOpt(SUMO_ATTR_ANGLE, id.c_str(), ok, Shape::DEFAULT_ANGLE); + const double angle = attrs.getOpt(SUMO_ATTR_ANGLE, id.c_str(), ok, Shape::DEFAULT_ANGLE); std::string imgFile = attrs.getOpt(SUMO_ATTR_IMGFILE, id.c_str(), ok, Shape::DEFAULT_IMG_FILE); if (imgFile != "" && !FileHelpers::isAbsolute(imgFile)) { imgFile = FileHelpers::getConfigurationRelative(getFileName(), imgFile); @@ -200,7 +196,7 @@ void -ShapeHandler::setDefaults(const std::string& prefix, const RGBColor& color, const SUMOReal layer, const bool fill) { +ShapeHandler::setDefaults(const std::string& prefix, const RGBColor& color, const double layer, const bool fill) { myPrefix = prefix; myDefaultColor = color; myDefaultLayer = layer; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/shapes/ShapeHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/shapes/ShapeHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/shapes/ShapeHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/shapes/ShapeHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @file ShapeHandler.h /// @author Jakob Erdmann /// @date Feb 2015 -/// @version $Id: ShapeHandler.h 20801 2016-05-28 05:31:30Z behrisch $ +/// @version $Id: ShapeHandler.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The XML-Handler for network loading /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -95,10 +95,10 @@ /// @brief get position for a given laneID - virtual Position getLanePos(const std::string& poiID, const std::string& laneID, SUMOReal lanePos) = 0; + virtual Position getLanePos(const std::string& poiID, const std::string& laneID, double lanePos) = 0; protected: - void setDefaults(const std::string& prefix, const RGBColor& color, const SUMOReal layer, const bool fill = false); + void setDefaults(const std::string& prefix, const RGBColor& color, const double layer, const bool fill = false); /// adds a POI void addPOI(const SUMOSAXAttributes& attrs, const bool ignorePruning, const bool useProcessing); @@ -115,7 +115,7 @@ /// @brief The default color to use RGBColor myDefaultColor; /// @brief The default layer to use - SUMOReal myDefaultLayer; + double myDefaultLayer; /// @brief Information whether polygons should be filled bool myDefaultFill; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/traci/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/traci/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/traci/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/traci/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -1,3 +1,3 @@ -noinst_LIBRARIES = libtraci.a +noinst_LIBRARIES = libtraciclient.a -libtraci_a_SOURCES = TraCIAPI.cpp TraCIAPI.h +libtraciclient_a_SOURCES = TraCIAPI.cpp TraCIAPI.h diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/traci/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/traci/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/traci/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/traci/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -96,10 +96,10 @@ am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = -libtraci_a_AR = $(AR) $(ARFLAGS) -libtraci_a_LIBADD = -am_libtraci_a_OBJECTS = TraCIAPI.$(OBJEXT) -libtraci_a_OBJECTS = $(am_libtraci_a_OBJECTS) +libtraciclient_a_AR = $(AR) $(ARFLAGS) +libtraciclient_a_LIBADD = +am_libtraciclient_a_OBJECTS = TraCIAPI.$(OBJEXT) +libtraciclient_a_OBJECTS = $(am_libtraciclient_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -156,8 +156,8 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(libtraci_a_SOURCES) -DIST_SOURCES = $(libtraci_a_SOURCES) +SOURCES = $(libtraciclient_a_SOURCES) +DIST_SOURCES = $(libtraciclient_a_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -326,8 +326,8 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -noinst_LIBRARIES = libtraci.a -libtraci_a_SOURCES = TraCIAPI.cpp TraCIAPI.h +noinst_LIBRARIES = libtraciclient.a +libtraciclient_a_SOURCES = TraCIAPI.cpp TraCIAPI.h all: all-am .SUFFIXES: @@ -366,10 +366,10 @@ clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libtraci.a: $(libtraci_a_OBJECTS) $(libtraci_a_DEPENDENCIES) $(EXTRA_libtraci_a_DEPENDENCIES) - $(AM_V_at)-rm -f libtraci.a - $(AM_V_AR)$(libtraci_a_AR) libtraci.a $(libtraci_a_OBJECTS) $(libtraci_a_LIBADD) - $(AM_V_at)$(RANLIB) libtraci.a +libtraciclient.a: $(libtraciclient_a_OBJECTS) $(libtraciclient_a_DEPENDENCIES) $(EXTRA_libtraciclient_a_DEPENDENCIES) + $(AM_V_at)-rm -f libtraciclient.a + $(AM_V_AR)$(libtraciclient_a_AR) libtraciclient.a $(libtraciclient_a_OBJECTS) $(libtraciclient_a_LIBADD) + $(AM_V_at)$(RANLIB) libtraciclient.a mostlyclean-compile: -rm -f *.$(OBJEXT) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/traci/TraCIAPI.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/traci/TraCIAPI.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/traci/TraCIAPI.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/traci/TraCIAPI.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 30.05.2012 -/// @version $Id: TraCIAPI.cpp 21692 2016-10-15 14:38:47Z behrisch $ +/// @version $Id: TraCIAPI.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // C++ TraCI client API implementation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,28 +33,27 @@ #include "TraCIAPI.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member definitions // =========================================================================== + // --------------------------------------------------------------------------- // TraCIAPI-methods // --------------------------------------------------------------------------- #ifdef _MSC_VER +#pragma warning(push) #pragma warning(disable: 4355) #endif TraCIAPI::TraCIAPI() : edge(*this), gui(*this), inductionloop(*this), - junction(*this), lane(*this), multientryexit(*this), poi(*this), - polygon(*this), route(*this), simulation(*this), trafficlights(*this), - vehicletype(*this), vehicle(*this), person(*this), + junction(*this), lane(*this), lanearea(*this), multientryexit(*this), + person(*this), poi(*this), polygon(*this), route(*this), + simulation(*this), trafficlights(*this), + vehicle(*this), vehicletype(*this), mySocket(0) {} #ifdef _MSC_VER -#pragma warning(default: 4355) +#pragma warning(pop) #endif @@ -78,6 +77,16 @@ void TraCIAPI::close() { + send_commandClose(); + tcpip::Storage inMsg; + std::string acknowledgement; + check_resultState(inMsg, CMD_CLOSE, false, &acknowledgement); + closeSocket(); +} + + +void +TraCIAPI::closeSocket() { if (mySocket == 0) { return; } @@ -93,7 +102,7 @@ // command length outMsg.writeUnsignedByte(1 + 1 + 4); // command id - outMsg.writeUnsignedByte(CMD_SIMSTEP2); + outMsg.writeUnsignedByte(CMD_SIMSTEP); outMsg.writeInt((int)time); // send request message mySocket->sendExact(outMsg); @@ -189,7 +198,7 @@ void TraCIAPI::send_commandSubscribeObjectContext(int domID, const std::string& objID, SUMOTime beginTime, SUMOTime endTime, - int domain, SUMOReal range, const std::vector& vars) const { + int domain, double range, const std::vector& vars) const { if (mySocket == 0) { throw tcpip::SocketException("Socket is not initialised"); } @@ -218,7 +227,7 @@ } void -TraCIAPI::send_commandMoveToXY(const std::string& vehicleID, const std::string& edgeID, const int lane, const SUMOReal x, const SUMOReal y, const SUMOReal angle, const int keepRoute) const { +TraCIAPI::send_commandMoveToXY(const std::string& vehicleID, const std::string& edgeID, const int lane, const double x, const double y, const double angle, const int keepRoute) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_COMPOUND); content.writeInt(6); @@ -234,7 +243,7 @@ content.writeDouble(angle); content.writeUnsignedByte(TYPE_BYTE); content.writeByte(keepRoute); - send_commandSetValue(CMD_SET_VEHICLE_VARIABLE, VAR_MOVE_TO_VTD, vehicleID, content); + send_commandSetValue(CMD_SET_VEHICLE_VARIABLE, MOVE_TO_XY, vehicleID, content); } void @@ -345,7 +354,7 @@ } -SUMOReal +double TraCIAPI::getFloat(int cmd, int var, const std::string& id, tcpip::Storage* add) { tcpip::Storage inMsg; send_commandGetVariable(cmd, var, id, add); @@ -354,7 +363,7 @@ } -SUMOReal +double TraCIAPI::getDouble(int cmd, int var, const std::string& id, tcpip::Storage* add) { tcpip::Storage inMsg; send_commandGetVariable(cmd, var, id, add); @@ -363,7 +372,7 @@ } -TraCIAPI::TraCIBoundary +TraCIBoundary TraCIAPI::getBoundingBox(int cmd, int var, const std::string& id, tcpip::Storage* add) { tcpip::Storage inMsg; send_commandGetVariable(cmd, var, id, add); @@ -379,7 +388,7 @@ } -TraCIAPI::TraCIPositionVector +TraCIPositionVector TraCIAPI::getPolygon(int cmd, int var, const std::string& id, tcpip::Storage* add) { tcpip::Storage inMsg; send_commandGetVariable(cmd, var, id, add); @@ -397,7 +406,7 @@ } -TraCIAPI::TraCIPosition +TraCIPosition TraCIAPI::getPosition(int cmd, int var, const std::string& id, tcpip::Storage* add) { tcpip::Storage inMsg; send_commandGetVariable(cmd, var, id, add); @@ -433,16 +442,16 @@ } -TraCIAPI::TraCIColor +TraCIColor TraCIAPI::getColor(int cmd, int var, const std::string& id, tcpip::Storage* add) { tcpip::Storage inMsg; send_commandGetVariable(cmd, var, id, add); processGET(inMsg, cmd, TYPE_COLOR); TraCIColor c; - c.r = inMsg.readUnsignedByte(); - c.g = inMsg.readUnsignedByte(); - c.b = inMsg.readUnsignedByte(); - c.a = inMsg.readUnsignedByte(); + c.r = (unsigned char)inMsg.readUnsignedByte(); + c.g = (unsigned char)inMsg.readUnsignedByte(); + c.b = (unsigned char)inMsg.readUnsignedByte(); + c.a = (unsigned char)inMsg.readUnsignedByte(); return c; } @@ -465,20 +474,32 @@ case TYPE_STRING: v.string = inMsg.readString(); break; + case POSITION_2D: + v.position.x = inMsg.readDouble(); + v.position.y = inMsg.readDouble(); + v.position.z = 0; + break; case POSITION_3D: v.position.x = inMsg.readDouble(); v.position.y = inMsg.readDouble(); v.position.z = inMsg.readDouble(); break; case TYPE_COLOR: - v.color.r = inMsg.readUnsignedByte(); - v.color.g = inMsg.readUnsignedByte(); - v.color.b = inMsg.readUnsignedByte(); - v.color.a = inMsg.readUnsignedByte(); + v.color.r = (unsigned char)inMsg.readUnsignedByte(); + v.color.g = (unsigned char)inMsg.readUnsignedByte(); + v.color.b = (unsigned char)inMsg.readUnsignedByte(); + v.color.a = (unsigned char)inMsg.readUnsignedByte(); break; case TYPE_INTEGER: v.scalar = inMsg.readInt(); break; + case TYPE_STRINGLIST: { + int n = inMsg.readInt(); + for (int i = 0; i < n; ++i) { + v.stringList.push_back(inMsg.readString()); + } + } + break; // TODO Other data types @@ -520,7 +541,7 @@ TraCIAPI::simulationStep(SUMOTime time) { send_commandSimulationStep(time); tcpip::Storage inMsg; - check_resultState(inMsg, CMD_SIMSTEP2); + check_resultState(inMsg, CMD_SIMSTEP); mySubscribedValues.clear(); mySubscribedContextValues.clear(); @@ -537,6 +558,23 @@ } +void +TraCIAPI::load(const std::vector& args) { + int numChars = 0; + for (int i = 0; i < (int)args.size(); ++i) { + numChars += (int)args[i].size(); + } + tcpip::Storage content; + content.writeUnsignedByte(1 + 1 + 1 + 4 + numChars + 4 * (int)args.size()); + content.writeUnsignedByte(CMD_LOAD); + content.writeUnsignedByte(TYPE_STRINGLIST); + content.writeStringList(args); + mySocket->sendExact(content); + tcpip::Storage inMsg; + check_resultState(inMsg, CMD_LOAD); +} + + // --------------------------------------------------------------------------- // TraCIAPI::EdgeScope-methods // --------------------------------------------------------------------------- @@ -550,15 +588,15 @@ return myParent.getInt(CMD_GET_EDGE_VARIABLE, ID_COUNT, ""); } -SUMOReal -TraCIAPI::EdgeScope::getAdaptedTraveltime(const std::string& edgeID, SUMOTime time) const { +double +TraCIAPI::EdgeScope::getAdaptedTraveltime(const std::string& edgeID, double time) const { tcpip::Storage content; content.writeByte(TYPE_INTEGER); content.writeInt((int)time); return myParent.getDouble(CMD_GET_EDGE_VARIABLE, VAR_EDGE_TRAVELTIME, edgeID, &content); } -SUMOReal +double TraCIAPI::EdgeScope::getEffort(const std::string& edgeID, SUMOTime time) const { tcpip::Storage content; content.writeByte(TYPE_INTEGER); @@ -566,63 +604,63 @@ return myParent.getDouble(CMD_GET_EDGE_VARIABLE, VAR_EDGE_EFFORT, edgeID, &content); } -SUMOReal +double TraCIAPI::EdgeScope::getCO2Emission(const std::string& edgeID) const { return myParent.getDouble(CMD_GET_EDGE_VARIABLE, VAR_CO2EMISSION, edgeID); } -SUMOReal +double TraCIAPI::EdgeScope::getCOEmission(const std::string& edgeID) const { return myParent.getDouble(CMD_GET_EDGE_VARIABLE, VAR_COEMISSION, edgeID); } -SUMOReal +double TraCIAPI::EdgeScope::getHCEmission(const std::string& edgeID) const { return myParent.getDouble(CMD_GET_EDGE_VARIABLE, VAR_HCEMISSION, edgeID); } -SUMOReal +double TraCIAPI::EdgeScope::getPMxEmission(const std::string& edgeID) const { return myParent.getDouble(CMD_GET_EDGE_VARIABLE, VAR_PMXEMISSION, edgeID); } -SUMOReal +double TraCIAPI::EdgeScope::getNOxEmission(const std::string& edgeID) const { return myParent.getDouble(CMD_GET_EDGE_VARIABLE, VAR_NOXEMISSION, edgeID); } -SUMOReal +double TraCIAPI::EdgeScope::getFuelConsumption(const std::string& edgeID) const { return myParent.getDouble(CMD_GET_EDGE_VARIABLE, VAR_FUELCONSUMPTION, edgeID); } -SUMOReal +double TraCIAPI::EdgeScope::getNoiseEmission(const std::string& edgeID) const { return myParent.getDouble(CMD_GET_EDGE_VARIABLE, VAR_NOISEEMISSION, edgeID); } -SUMOReal +double TraCIAPI::EdgeScope::getElectricityConsumption(const std::string& edgeID) const { return myParent.getDouble(CMD_GET_EDGE_VARIABLE, VAR_ELECTRICITYCONSUMPTION, edgeID); } -SUMOReal +double TraCIAPI::EdgeScope::getLastStepMeanSpeed(const std::string& edgeID) const { return myParent.getDouble(CMD_GET_EDGE_VARIABLE, LAST_STEP_MEAN_SPEED, edgeID); } -SUMOReal +double TraCIAPI::EdgeScope::getLastStepOccupancy(const std::string& edgeID) const { return myParent.getDouble(CMD_GET_EDGE_VARIABLE, LAST_STEP_OCCUPANCY, edgeID); } -SUMOReal +double TraCIAPI::EdgeScope::getLastStepLength(const std::string& edgeID) const { return myParent.getDouble(CMD_GET_EDGE_VARIABLE, LAST_STEP_LENGTH, edgeID); } -SUMOReal +double TraCIAPI::EdgeScope::getTraveltime(const std::string& edgeID) const { return myParent.getDouble(CMD_GET_EDGE_VARIABLE, VAR_CURRENT_TRAVELTIME, edgeID); } @@ -632,7 +670,7 @@ return myParent.getInt(CMD_GET_EDGE_VARIABLE, LAST_STEP_VEHICLE_NUMBER, edgeID); } -SUMOReal +double TraCIAPI::EdgeScope::getLastStepHaltingNumber(const std::string& edgeID) const { return myParent.getInt(CMD_GET_EDGE_VARIABLE, LAST_STEP_VEHICLE_HALTING_NUMBER, edgeID); } @@ -645,7 +683,7 @@ void -TraCIAPI::EdgeScope::adaptTraveltime(const std::string& edgeID, SUMOReal time, SUMOTime begin, SUMOTime end) const { +TraCIAPI::EdgeScope::adaptTraveltime(const std::string& edgeID, double time, double begin, double end) const { tcpip::Storage content; content.writeByte(TYPE_COMPOUND); content.writeInt(3); @@ -661,7 +699,7 @@ } void -TraCIAPI::EdgeScope::setEffort(const std::string& edgeID, SUMOReal effort, SUMOTime begin, SUMOTime end) const { +TraCIAPI::EdgeScope::setEffort(const std::string& edgeID, double effort, SUMOTime begin, SUMOTime end) const { tcpip::Storage content; content.writeByte(TYPE_COMPOUND); content.writeInt(3); @@ -677,7 +715,7 @@ } void -TraCIAPI::EdgeScope::setMaxSpeed(const std::string& edgeID, SUMOReal speed) const { +TraCIAPI::EdgeScope::setMaxSpeed(const std::string& edgeID, double speed) const { tcpip::Storage content; content.writeDouble(speed); myParent.send_commandSetValue(CMD_SET_EDGE_VARIABLE, VAR_MAXSPEED, edgeID, content); @@ -696,12 +734,12 @@ return myParent.getStringVector(CMD_GET_GUI_VARIABLE, ID_LIST, ""); } -SUMOReal +double TraCIAPI::GUIScope::getZoom(const std::string& viewID) const { return myParent.getDouble(CMD_GET_GUI_VARIABLE, VAR_VIEW_ZOOM, viewID); } -TraCIAPI::TraCIPosition +TraCIPosition TraCIAPI::GUIScope::getOffset(const std::string& viewID) const { return myParent.getPosition(CMD_GET_GUI_VARIABLE, VAR_VIEW_OFFSET, viewID); } @@ -711,14 +749,14 @@ return myParent.getString(CMD_GET_GUI_VARIABLE, VAR_VIEW_SCHEMA, viewID); } -TraCIAPI::TraCIBoundary +TraCIBoundary TraCIAPI::GUIScope::getBoundary(const std::string& viewID) const { return myParent.getBoundingBox(CMD_GET_GUI_VARIABLE, VAR_VIEW_BOUNDARY, viewID); } void -TraCIAPI::GUIScope::setZoom(const std::string& viewID, SUMOReal zoom) const { +TraCIAPI::GUIScope::setZoom(const std::string& viewID, double zoom) const { tcpip::Storage content; content.writeDouble(zoom); myParent.send_commandSetValue(CMD_SET_GUI_VARIABLE, VAR_VIEW_ZOOM, viewID, content); @@ -727,7 +765,7 @@ } void -TraCIAPI::GUIScope::setOffset(const std::string& viewID, SUMOReal x, SUMOReal y) const { +TraCIAPI::GUIScope::setOffset(const std::string& viewID, double x, double y) const { tcpip::Storage content; content.writeUnsignedByte(POSITION_2D); content.writeDouble(x); @@ -748,7 +786,7 @@ } void -TraCIAPI::GUIScope::setBoundary(const std::string& viewID, SUMOReal xmin, SUMOReal ymin, SUMOReal xmax, SUMOReal ymax) const { +TraCIAPI::GUIScope::setBoundary(const std::string& viewID, double xmin, double ymin, double xmax, double ymax) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_BOUNDINGBOX); content.writeDouble(xmin); @@ -791,7 +829,7 @@ return myParent.getStringVector(CMD_GET_INDUCTIONLOOP_VARIABLE, ID_LIST, ""); } -SUMOReal +double TraCIAPI::InductionLoopScope::getPosition(const std::string& loopID) const { return myParent.getDouble(CMD_GET_INDUCTIONLOOP_VARIABLE, VAR_POSITION, loopID); } @@ -806,7 +844,7 @@ return myParent.getInt(CMD_GET_INDUCTIONLOOP_VARIABLE, LAST_STEP_VEHICLE_NUMBER, loopID); } -SUMOReal +double TraCIAPI::InductionLoopScope::getLastStepMeanSpeed(const std::string& loopID) const { return myParent.getDouble(CMD_GET_INDUCTIONLOOP_VARIABLE, LAST_STEP_MEAN_SPEED, loopID); } @@ -816,33 +854,33 @@ return myParent.getStringVector(CMD_GET_INDUCTIONLOOP_VARIABLE, LAST_STEP_VEHICLE_ID_LIST, loopID); } -SUMOReal +double TraCIAPI::InductionLoopScope::getLastStepOccupancy(const std::string& loopID) const { return myParent.getDouble(CMD_GET_INDUCTIONLOOP_VARIABLE, LAST_STEP_OCCUPANCY, loopID); } -SUMOReal +double TraCIAPI::InductionLoopScope::getLastStepMeanLength(const std::string& loopID) const { return myParent.getDouble(CMD_GET_INDUCTIONLOOP_VARIABLE, LAST_STEP_LENGTH, loopID); } -SUMOReal +double TraCIAPI::InductionLoopScope::getTimeSinceDetection(const std::string& loopID) const { return myParent.getDouble(CMD_GET_INDUCTIONLOOP_VARIABLE, LAST_STEP_TIME_SINCE_DETECTION, loopID); } -std::vector +std::vector TraCIAPI::InductionLoopScope::getVehicleData(const std::string& loopID) const { tcpip::Storage inMsg; myParent.send_commandGetVariable(CMD_GET_INDUCTIONLOOP_VARIABLE, LAST_STEP_VEHICLE_DATA, loopID); myParent.processGET(inMsg, CMD_GET_INDUCTIONLOOP_VARIABLE, TYPE_COMPOUND); - std::vector result; + std::vector result; inMsg.readInt(); // components // number of items inMsg.readUnsignedByte(); const int n = inMsg.readInt(); for (int i = 0; i < n; ++i) { - VehicleData vd; + TraCIVehicleData vd; inMsg.readUnsignedByte(); vd.id = inMsg.readString(); @@ -875,7 +913,7 @@ return myParent.getStringVector(CMD_GET_JUNCTION_VARIABLE, ID_LIST, ""); } -TraCIAPI::TraCIPosition +TraCIPosition TraCIAPI::JunctionScope::getPosition(const std::string& junctionID) const { return myParent.getPosition(CMD_GET_JUNCTION_VARIABLE, VAR_POSITION, junctionID); } @@ -891,17 +929,17 @@ return myParent.getStringVector(CMD_GET_LANE_VARIABLE, ID_LIST, ""); } -SUMOReal +double TraCIAPI::LaneScope::getLength(const std::string& laneID) const { return myParent.getDouble(CMD_GET_LANE_VARIABLE, VAR_LENGTH, laneID); } -SUMOReal +double TraCIAPI::LaneScope::getMaxSpeed(const std::string& laneID) const { return myParent.getDouble(CMD_GET_LANE_VARIABLE, VAR_MAXSPEED, laneID); } -SUMOReal +double TraCIAPI::LaneScope::getWidth(const std::string& laneID) const { return myParent.getDouble(CMD_GET_LANE_VARIABLE, VAR_WIDTH, laneID); } @@ -921,7 +959,7 @@ throw tcpip::SocketException("Not implemented!"); } -TraCIAPI::TraCIPositionVector +TraCIPositionVector TraCIAPI::LaneScope::getShape(const std::string& laneID) const { return myParent.getPolygon(CMD_GET_LANE_VARIABLE, VAR_SHAPE, laneID); } @@ -931,62 +969,62 @@ return myParent.getString(CMD_GET_LANE_VARIABLE, LANE_EDGE_ID, laneID); } -SUMOReal +double TraCIAPI::LaneScope::getCO2Emission(const std::string& laneID) const { return myParent.getDouble(CMD_GET_LANE_VARIABLE, VAR_CO2EMISSION, laneID); } -SUMOReal +double TraCIAPI::LaneScope::getCOEmission(const std::string& laneID) const { return myParent.getDouble(CMD_GET_LANE_VARIABLE, VAR_COEMISSION, laneID); } -SUMOReal +double TraCIAPI::LaneScope::getHCEmission(const std::string& laneID) const { return myParent.getDouble(CMD_GET_LANE_VARIABLE, VAR_HCEMISSION, laneID); } -SUMOReal +double TraCIAPI::LaneScope::getPMxEmission(const std::string& laneID) const { return myParent.getDouble(CMD_GET_LANE_VARIABLE, VAR_PMXEMISSION, laneID); } -SUMOReal +double TraCIAPI::LaneScope::getNOxEmission(const std::string& laneID) const { return myParent.getDouble(CMD_GET_LANE_VARIABLE, VAR_NOXEMISSION, laneID); } -SUMOReal +double TraCIAPI::LaneScope::getFuelConsumption(const std::string& laneID) const { return myParent.getDouble(CMD_GET_LANE_VARIABLE, VAR_FUELCONSUMPTION, laneID); } -SUMOReal +double TraCIAPI::LaneScope::getNoiseEmission(const std::string& laneID) const { return myParent.getDouble(CMD_GET_LANE_VARIABLE, VAR_NOISEEMISSION, laneID); } -SUMOReal +double TraCIAPI::LaneScope::getElectricityConsumption(const std::string& laneID) const { return myParent.getDouble(CMD_GET_LANE_VARIABLE, VAR_ELECTRICITYCONSUMPTION, laneID); } -SUMOReal +double TraCIAPI::LaneScope::getLastStepMeanSpeed(const std::string& laneID) const { return myParent.getDouble(CMD_GET_LANE_VARIABLE, LAST_STEP_MEAN_SPEED, laneID); } -SUMOReal +double TraCIAPI::LaneScope::getLastStepOccupancy(const std::string& laneID) const { return myParent.getDouble(CMD_GET_LANE_VARIABLE, LAST_STEP_OCCUPANCY, laneID); } -SUMOReal +double TraCIAPI::LaneScope::getLastStepLength(const std::string& laneID) const { return myParent.getDouble(CMD_GET_LANE_VARIABLE, LAST_STEP_LENGTH, laneID); } -SUMOReal +double TraCIAPI::LaneScope::getTraveltime(const std::string& laneID) const { return myParent.getDouble(CMD_GET_LANE_VARIABLE, VAR_CURRENT_TRAVELTIME, laneID); } @@ -1034,7 +1072,7 @@ } void -TraCIAPI::LaneScope::setMaxSpeed(const std::string& laneID, SUMOReal speed) const { +TraCIAPI::LaneScope::setMaxSpeed(const std::string& laneID, double speed) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_DOUBLE); content.writeDouble(speed); @@ -1044,7 +1082,7 @@ } void -TraCIAPI::LaneScope::setLength(const std::string& laneID, SUMOReal length) const { +TraCIAPI::LaneScope::setLength(const std::string& laneID, double length) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_DOUBLE); content.writeDouble(length); @@ -1055,11 +1093,11 @@ // --------------------------------------------------------------------------- -// TraCIAPI::AreaDetector-methods +// TraCIAPI::LaneAreaDetector-methods // --------------------------------------------------------------------------- std::vector -TraCIAPI::AreaScope::getIDList() const { - return myParent.getStringVector(CMD_GET_AREAL_DETECTOR_VARIABLE, ID_LIST, ""); +TraCIAPI::LaneAreaScope::getIDList() const { + return myParent.getStringVector(CMD_GET_LANEAREA_VARIABLE, ID_LIST, ""); } @@ -1070,27 +1108,27 @@ // --------------------------------------------------------------------------- std::vector TraCIAPI::MeMeScope::getIDList() const { - return myParent.getStringVector(CMD_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE, ID_LIST, ""); + return myParent.getStringVector(CMD_GET_MULTIENTRYEXIT_VARIABLE, ID_LIST, ""); } int TraCIAPI::MeMeScope::getLastStepVehicleNumber(const std::string& detID) const { - return myParent.getInt(CMD_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE, LAST_STEP_VEHICLE_NUMBER, detID); + return myParent.getInt(CMD_GET_MULTIENTRYEXIT_VARIABLE, LAST_STEP_VEHICLE_NUMBER, detID); } -SUMOReal +double TraCIAPI::MeMeScope::getLastStepMeanSpeed(const std::string& detID) const { - return myParent.getInt(CMD_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE, LAST_STEP_MEAN_SPEED, detID); + return myParent.getInt(CMD_GET_MULTIENTRYEXIT_VARIABLE, LAST_STEP_MEAN_SPEED, detID); } std::vector TraCIAPI::MeMeScope::getLastStepVehicleIDs(const std::string& detID) const { - return myParent.getStringVector(CMD_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE, LAST_STEP_VEHICLE_ID_LIST, detID); + return myParent.getStringVector(CMD_GET_MULTIENTRYEXIT_VARIABLE, LAST_STEP_VEHICLE_ID_LIST, detID); } int TraCIAPI::MeMeScope::getLastStepHaltingNumber(const std::string& detID) const { - return myParent.getInt(CMD_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE, LAST_STEP_VEHICLE_HALTING_NUMBER, detID); + return myParent.getInt(CMD_GET_MULTIENTRYEXIT_VARIABLE, LAST_STEP_VEHICLE_HALTING_NUMBER, detID); } @@ -1108,12 +1146,12 @@ return myParent.getString(CMD_GET_POI_VARIABLE, VAR_TYPE, poiID); } -TraCIAPI::TraCIPosition +TraCIPosition TraCIAPI::POIScope::getPosition(const std::string& poiID) const { return myParent.getPosition(CMD_GET_POI_VARIABLE, VAR_POSITION, poiID); } -TraCIAPI::TraCIColor +TraCIColor TraCIAPI::POIScope::getColor(const std::string& poiID) const { return myParent.getColor(CMD_GET_POI_VARIABLE, VAR_COLOR, poiID); } @@ -1130,7 +1168,7 @@ } void -TraCIAPI::POIScope::setPosition(const std::string& poiID, SUMOReal x, SUMOReal y) const { +TraCIAPI::POIScope::setPosition(const std::string& poiID, double x, double y) const { tcpip::Storage content; content.writeUnsignedByte(POSITION_2D); content.writeDouble(x); @@ -1154,7 +1192,7 @@ } void -TraCIAPI::POIScope::add(const std::string& poiID, SUMOReal x, SUMOReal y, const TraCIColor& c, const std::string& type, int layer) const { +TraCIAPI::POIScope::add(const std::string& poiID, double x, double y, const TraCIColor& c, const std::string& type, int layer) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_COMPOUND); content.writeInt(4); @@ -1200,12 +1238,12 @@ return myParent.getString(CMD_GET_POLYGON_VARIABLE, VAR_TYPE, polygonID); } -TraCIAPI::TraCIPositionVector +TraCIPositionVector TraCIAPI::PolygonScope::getShape(const std::string& polygonID) const { return myParent.getPolygon(CMD_GET_POLYGON_VARIABLE, VAR_SHAPE, polygonID); } -TraCIAPI::TraCIColor +TraCIColor TraCIAPI::PolygonScope::getColor(const std::string& polygonID) const { return myParent.getColor(CMD_GET_POLYGON_VARIABLE, VAR_COLOR, polygonID); } @@ -1222,7 +1260,7 @@ } void -TraCIAPI::PolygonScope::setShape(const std::string& polygonID, const TraCIAPI::TraCIPositionVector& shape) const { +TraCIAPI::PolygonScope::setShape(const std::string& polygonID, const TraCIPositionVector& shape) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_POLYGON); content.writeInt((int)shape.size()); @@ -1249,7 +1287,7 @@ } void -TraCIAPI::PolygonScope::add(const std::string& polygonID, const TraCIAPI::TraCIPositionVector& shape, const TraCIColor& c, bool fill, const std::string& type, int layer) const { +TraCIAPI::PolygonScope::add(const std::string& polygonID, const TraCIPositionVector& shape, const TraCIColor& c, bool fill, const std::string& type, int layer) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_COMPOUND); content.writeInt(5); @@ -1379,7 +1417,7 @@ return myParent.getSUMOTime(CMD_GET_SIM_VARIABLE, VAR_DELTA_T, ""); } -TraCIAPI::TraCIBoundary +TraCIBoundary TraCIAPI::SimulationScope::getNetBoundary() const { return myParent.getBoundingBox(CMD_GET_SIM_VARIABLE, VAR_NET_BOUNDING_BOX, ""); } @@ -1394,12 +1432,14 @@ myParent.send_commandSubscribeObjectVariable(domID, objID, beginTime, endTime, vars); tcpip::Storage inMsg; myParent.check_resultState(inMsg, domID); - myParent.check_commandGetResult(inMsg, domID); - myParent.readVariableSubscription(inMsg); + if (vars.size() > 0) { + myParent.check_commandGetResult(inMsg, domID); + myParent.readVariableSubscription(inMsg); + } } void -TraCIAPI::SimulationScope::subscribeContext(int domID, const std::string& objID, SUMOTime beginTime, SUMOTime endTime, int domain, SUMOReal range, const std::vector& vars) const { +TraCIAPI::SimulationScope::subscribeContext(int domID, const std::string& objID, SUMOTime beginTime, SUMOTime endTime, int domain, double range, const std::vector& vars) const { myParent.send_commandSubscribeObjectContext(domID, objID, beginTime, endTime, domain, range, vars); tcpip::Storage inMsg; @@ -1408,14 +1448,14 @@ myParent.readContextSubscription(inMsg); } -TraCIAPI::SubscribedValues -TraCIAPI::SimulationScope::getSubscriptionResults() { +const TraCIAPI::SubscribedValues& +TraCIAPI::SimulationScope::getSubscriptionResults() const { return myParent.mySubscribedValues; } -TraCIAPI::TraCIValues -TraCIAPI::SimulationScope::getSubscriptionResults(const std::string& objID) { +const TraCIAPI::TraCIValues& +TraCIAPI::SimulationScope::getSubscriptionResults(const std::string& objID) const { if (myParent.mySubscribedValues.find(objID) != myParent.mySubscribedValues.end()) { return myParent.mySubscribedValues[objID]; } else { @@ -1424,14 +1464,14 @@ } -TraCIAPI::SubscribedContextValues -TraCIAPI::SimulationScope::getContextSubscriptionResults() { +const TraCIAPI::SubscribedContextValues& +TraCIAPI::SimulationScope::getContextSubscriptionResults() const { return myParent.mySubscribedContextValues; } -TraCIAPI::SubscribedValues -TraCIAPI::SimulationScope::getContextSubscriptionResults(const std::string& objID) { +const TraCIAPI::SubscribedValues& +TraCIAPI::SimulationScope::getContextSubscriptionResults(const std::string& objID) const { if (myParent.mySubscribedContextValues.find(objID) != myParent.mySubscribedContextValues.end()) { return myParent.mySubscribedContextValues[objID]; } else { @@ -1453,12 +1493,16 @@ return myParent.getString(CMD_GET_TL_VARIABLE, TL_RED_YELLOW_GREEN_STATE, tlsID); } -std::vector +std::vector TraCIAPI::TrafficLightScope::getCompleteRedYellowGreenDefinition(const std::string& tlsID) const { tcpip::Storage inMsg; myParent.send_commandGetVariable(CMD_GET_TL_VARIABLE, TL_COMPLETE_DEFINITION_RYG, tlsID); myParent.processGET(inMsg, CMD_GET_TL_VARIABLE, TYPE_COMPOUND); - std::vector ret; + std::vector ret; + + inMsg.readUnsignedByte(); + inMsg.readInt(); + int logicNo = inMsg.readInt(); for (int i = 0; i < logicNo; ++i) { inMsg.readUnsignedByte(); @@ -1471,7 +1515,7 @@ int phaseIndex = inMsg.readInt(); inMsg.readUnsignedByte(); int phaseNumber = inMsg.readInt(); - std::vector phases; + std::vector phases; for (int j = 0; j < phaseNumber; ++j) { inMsg.readUnsignedByte(); int duration = inMsg.readInt(); @@ -1481,9 +1525,9 @@ int duration2 = inMsg.readInt(); inMsg.readUnsignedByte(); std::string phase = inMsg.readString(); - phases.push_back(TraCIAPI::TraCIPhase(duration, duration1, duration2, phase)); + phases.push_back(TraCIPhase(duration, duration1, duration2, phase)); } - ret.push_back(TraCIAPI::TraCILogic(subID, type, std::map(), phaseIndex, phases)); + ret.push_back(TraCILogic(subID, type, std::map(), phaseIndex, phases)); } return ret; } @@ -1493,21 +1537,30 @@ return myParent.getStringVector(CMD_GET_TL_VARIABLE, TL_CONTROLLED_LANES, tlsID); } -std::vector +std::vector TraCIAPI::TrafficLightScope::getControlledLinks(const std::string& tlsID) const { tcpip::Storage inMsg; myParent.send_commandGetVariable(CMD_GET_TL_VARIABLE, TL_CONTROLLED_LINKS, tlsID); myParent.processGET(inMsg, CMD_GET_TL_VARIABLE, TYPE_COMPOUND); - std::vector ret; + std::vector ret; + + inMsg.readUnsignedByte(); + inMsg.readInt(); + int linkNo = inMsg.readInt(); for (int i = 0; i < linkNo; ++i) { inMsg.readUnsignedByte(); - std::string from = inMsg.readString(); - inMsg.readUnsignedByte(); - std::string via = inMsg.readString(); - inMsg.readUnsignedByte(); - std::string to = inMsg.readString(); - ret.push_back(TraCIAPI::TraCILink(from, via, to)); + int no = inMsg.readInt(); + + for (int i1 = 0; i1 < no; ++i1) { + inMsg.readUnsignedByte(); + inMsg.readInt(); + std::string from = inMsg.readString(); + std::string to = inMsg.readString(); + std::string via = inMsg.readString(); + ret.push_back(TraCILink(from, via, to)); + } + } return ret; } @@ -1569,7 +1622,7 @@ } void -TraCIAPI::TrafficLightScope::setCompleteRedYellowGreenDefinition(const std::string& tlsID, const TraCIAPI::TraCILogic& logic) const { +TraCIAPI::TrafficLightScope::setCompleteRedYellowGreenDefinition(const std::string& tlsID, const TraCILogic& logic) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_COMPOUND); content.writeInt(5 + 4 * (int)logic.phases.size()); @@ -1610,42 +1663,42 @@ return myParent.getStringVector(CMD_GET_VEHICLETYPE_VARIABLE, ID_LIST, ""); } -SUMOReal +double TraCIAPI::VehicleTypeScope::getLength(const std::string& typeID) const { return myParent.getDouble(CMD_GET_VEHICLETYPE_VARIABLE, VAR_LENGTH, typeID); } -SUMOReal +double TraCIAPI::VehicleTypeScope::getMaxSpeed(const std::string& typeID) const { return myParent.getDouble(CMD_GET_VEHICLETYPE_VARIABLE, VAR_MAXSPEED, typeID); } -SUMOReal +double TraCIAPI::VehicleTypeScope::getSpeedFactor(const std::string& typeID) const { return myParent.getDouble(CMD_GET_VEHICLETYPE_VARIABLE, VAR_SPEED_FACTOR, typeID); } -SUMOReal +double TraCIAPI::VehicleTypeScope::getSpeedDeviation(const std::string& typeID) const { return myParent.getDouble(CMD_GET_VEHICLETYPE_VARIABLE, VAR_SPEED_DEVIATION, typeID); } -SUMOReal +double TraCIAPI::VehicleTypeScope::getAccel(const std::string& typeID) const { return myParent.getDouble(CMD_GET_VEHICLETYPE_VARIABLE, VAR_ACCEL, typeID); } -SUMOReal +double TraCIAPI::VehicleTypeScope::getDecel(const std::string& typeID) const { return myParent.getDouble(CMD_GET_VEHICLETYPE_VARIABLE, VAR_DECEL, typeID); } -SUMOReal +double TraCIAPI::VehicleTypeScope::getImperfection(const std::string& typeID) const { return myParent.getDouble(CMD_GET_VEHICLETYPE_VARIABLE, VAR_IMPERFECTION, typeID); } -SUMOReal +double TraCIAPI::VehicleTypeScope::getTau(const std::string& typeID) const { return myParent.getDouble(CMD_GET_VEHICLETYPE_VARIABLE, VAR_TAU, typeID); } @@ -1665,22 +1718,37 @@ return myParent.getString(CMD_GET_VEHICLETYPE_VARIABLE, VAR_SHAPECLASS, typeID); } -SUMOReal +double TraCIAPI::VehicleTypeScope::getMinGap(const std::string& typeID) const { return myParent.getDouble(CMD_GET_VEHICLETYPE_VARIABLE, VAR_MINGAP, typeID); } -SUMOReal +double +TraCIAPI::VehicleTypeScope::getMinGapLat(const std::string& typeID) const { + return myParent.getDouble(CMD_GET_VEHICLETYPE_VARIABLE, VAR_MINGAP_LAT, typeID); +} + +double +TraCIAPI::VehicleTypeScope::getMaxSpeedLat(const std::string& typeID) const { + return myParent.getDouble(CMD_GET_VEHICLETYPE_VARIABLE, VAR_MAXSPEED_LAT, typeID); +} + +std::string +TraCIAPI::VehicleTypeScope::getLateralAlignment(const std::string& typeID) const { + return myParent.getString(CMD_GET_VEHICLETYPE_VARIABLE, VAR_LATALIGNMENT, typeID); +} + +double TraCIAPI::VehicleTypeScope::getWidth(const std::string& typeID) const { return myParent.getDouble(CMD_GET_VEHICLETYPE_VARIABLE, VAR_WIDTH, typeID); } -SUMOReal +double TraCIAPI::VehicleTypeScope::getHeight(const std::string& typeID) const { return myParent.getDouble(CMD_GET_VEHICLETYPE_VARIABLE, VAR_HEIGHT, typeID); } -TraCIAPI::TraCIColor +TraCIColor TraCIAPI::VehicleTypeScope::getColor(const std::string& typeID) const { return myParent.getColor(CMD_GET_VEHICLETYPE_VARIABLE, VAR_COLOR, typeID); } @@ -1688,7 +1756,7 @@ void -TraCIAPI::VehicleTypeScope::setLength(const std::string& typeID, SUMOReal length) const { +TraCIAPI::VehicleTypeScope::setLength(const std::string& typeID, double length) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_DOUBLE); content.writeDouble(length); @@ -1698,7 +1766,7 @@ } void -TraCIAPI::VehicleTypeScope::setMaxSpeed(const std::string& typeID, SUMOReal speed) const { +TraCIAPI::VehicleTypeScope::setMaxSpeed(const std::string& typeID, double speed) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_DOUBLE); content.writeDouble(speed); @@ -1718,7 +1786,7 @@ } void -TraCIAPI::VehicleTypeScope::setSpeedFactor(const std::string& typeID, SUMOReal factor) const { +TraCIAPI::VehicleTypeScope::setSpeedFactor(const std::string& typeID, double factor) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_DOUBLE); content.writeDouble(factor); @@ -1728,7 +1796,7 @@ } void -TraCIAPI::VehicleTypeScope::setSpeedDeviation(const std::string& typeID, SUMOReal deviation) const { +TraCIAPI::VehicleTypeScope::setSpeedDeviation(const std::string& typeID, double deviation) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_DOUBLE); content.writeDouble(deviation); @@ -1737,6 +1805,7 @@ myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE); } + void TraCIAPI::VehicleTypeScope::setEmissionClass(const std::string& typeID, const std::string& clazz) const { tcpip::Storage content; @@ -1748,7 +1817,7 @@ } void -TraCIAPI::VehicleTypeScope::setWidth(const std::string& typeID, SUMOReal width) const { +TraCIAPI::VehicleTypeScope::setWidth(const std::string& typeID, double width) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_DOUBLE); content.writeDouble(width); @@ -1758,7 +1827,7 @@ } void -TraCIAPI::VehicleTypeScope::setHeight(const std::string& typeID, SUMOReal height) const { +TraCIAPI::VehicleTypeScope::setHeight(const std::string& typeID, double height) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_DOUBLE); content.writeDouble(height); @@ -1768,7 +1837,7 @@ } void -TraCIAPI::VehicleTypeScope::setMinGap(const std::string& typeID, SUMOReal minGap) const { +TraCIAPI::VehicleTypeScope::setMinGap(const std::string& typeID, double minGap) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_DOUBLE); content.writeDouble(minGap); @@ -1777,6 +1846,38 @@ myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE); } + +void +TraCIAPI::VehicleTypeScope::setMinGapLat(const std::string& typeID, double minGapLat) const { + tcpip::Storage content; + content.writeUnsignedByte(TYPE_DOUBLE); + content.writeDouble(minGapLat); + myParent.send_commandSetValue(CMD_SET_VEHICLETYPE_VARIABLE, VAR_MINGAP_LAT, typeID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE); +} + +void +TraCIAPI::VehicleTypeScope::setMaxSpeedLat(const std::string& typeID, double speed) const { + tcpip::Storage content; + content.writeUnsignedByte(TYPE_DOUBLE); + content.writeDouble(speed); + myParent.send_commandSetValue(CMD_SET_VEHICLETYPE_VARIABLE, VAR_MAXSPEED_LAT, typeID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE); +} + +void +TraCIAPI::VehicleTypeScope::setLateralAlignment(const std::string& typeID, const std::string& latAlignment) const { + tcpip::Storage content; + content.writeUnsignedByte(TYPE_STRING); + content.writeString(latAlignment); + myParent.send_commandSetValue(CMD_SET_VEHICLETYPE_VARIABLE, VAR_LATALIGNMENT, typeID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE); +} + + void TraCIAPI::VehicleTypeScope::setShapeClass(const std::string& typeID, const std::string& clazz) const { tcpip::Storage content; @@ -1788,7 +1889,7 @@ } void -TraCIAPI::VehicleTypeScope::setAccel(const std::string& typeID, SUMOReal accel) const { +TraCIAPI::VehicleTypeScope::setAccel(const std::string& typeID, double accel) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_DOUBLE); content.writeDouble(accel); @@ -1798,7 +1899,7 @@ } void -TraCIAPI::VehicleTypeScope::setDecel(const std::string& typeID, SUMOReal decel) const { +TraCIAPI::VehicleTypeScope::setDecel(const std::string& typeID, double decel) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_DOUBLE); content.writeDouble(decel); @@ -1808,7 +1909,7 @@ } void -TraCIAPI::VehicleTypeScope::setImperfection(const std::string& typeID, SUMOReal imperfection) const { +TraCIAPI::VehicleTypeScope::setImperfection(const std::string& typeID, double imperfection) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_DOUBLE); content.writeDouble(imperfection); @@ -1818,7 +1919,7 @@ } void -TraCIAPI::VehicleTypeScope::setTau(const std::string& typeID, SUMOReal tau) const { +TraCIAPI::VehicleTypeScope::setTau(const std::string& typeID, double tau) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_DOUBLE); content.writeDouble(tau); @@ -1857,17 +1958,22 @@ return myParent.getInt(CMD_GET_VEHICLE_VARIABLE, ID_COUNT, ""); } -SUMOReal +double TraCIAPI::VehicleScope::getSpeed(const std::string& vehicleID) const { return myParent.getDouble(CMD_GET_VEHICLE_VARIABLE, VAR_SPEED, vehicleID); } -TraCIAPI::TraCIPosition +double +TraCIAPI::VehicleScope::getMaxSpeed(const std::string& vehicleID) const { + return myParent.getDouble(CMD_GET_VEHICLE_VARIABLE, VAR_MAXSPEED, vehicleID); +} + +TraCIPosition TraCIAPI::VehicleScope::getPosition(const std::string& vehicleID) const { return myParent.getPosition(CMD_GET_VEHICLE_VARIABLE, VAR_POSITION, vehicleID); } -SUMOReal +double TraCIAPI::VehicleScope::getAngle(const std::string& vehicleID) const { return myParent.getDouble(CMD_GET_VEHICLE_VARIABLE, VAR_ANGLE, vehicleID); } @@ -1907,57 +2013,62 @@ return myParent.getStringVector(CMD_GET_VEHICLE_VARIABLE, VAR_EDGES, vehicleID); } -TraCIAPI::TraCIColor +TraCIColor TraCIAPI::VehicleScope::getColor(const std::string& vehicleID) const { return myParent.getColor(CMD_GET_VEHICLE_VARIABLE, VAR_COLOR, vehicleID); } -SUMOReal +double TraCIAPI::VehicleScope::getLanePosition(const std::string& vehicleID) const { return myParent.getDouble(CMD_GET_VEHICLE_VARIABLE, VAR_LANEPOSITION, vehicleID); } -SUMOReal +double +TraCIAPI::VehicleScope::getLateralLanePosition(const std::string& vehicleID) const { + return myParent.getDouble(CMD_GET_VEHICLE_VARIABLE, VAR_LANEPOSITION_LAT, vehicleID); +} + +double TraCIAPI::VehicleScope::getCO2Emission(const std::string& vehicleID) const { return myParent.getDouble(CMD_GET_VEHICLE_VARIABLE, VAR_CO2EMISSION, vehicleID); } -SUMOReal +double TraCIAPI::VehicleScope::getCOEmission(const std::string& vehicleID) const { return myParent.getDouble(CMD_GET_VEHICLE_VARIABLE, VAR_COEMISSION, vehicleID); } -SUMOReal +double TraCIAPI::VehicleScope::getHCEmission(const std::string& vehicleID) const { return myParent.getDouble(CMD_GET_VEHICLE_VARIABLE, VAR_HCEMISSION, vehicleID); } -SUMOReal +double TraCIAPI::VehicleScope::getPMxEmission(const std::string& vehicleID) const { return myParent.getDouble(CMD_GET_VEHICLE_VARIABLE, VAR_PMXEMISSION, vehicleID); } -SUMOReal +double TraCIAPI::VehicleScope::getNOxEmission(const std::string& vehicleID) const { return myParent.getDouble(CMD_GET_VEHICLE_VARIABLE, VAR_NOXEMISSION, vehicleID); } -SUMOReal +double TraCIAPI::VehicleScope::getFuelConsumption(const std::string& vehicleID) const { return myParent.getDouble(CMD_GET_VEHICLE_VARIABLE, VAR_FUELCONSUMPTION, vehicleID); } -SUMOReal +double TraCIAPI::VehicleScope::getNoiseEmission(const std::string& vehicleID) const { return myParent.getDouble(CMD_GET_VEHICLE_VARIABLE, VAR_NOISEEMISSION, vehicleID); } -SUMOReal +double TraCIAPI::VehicleScope::getElectricityConsumption(const std::string& vehicleID) const { return myParent.getDouble(CMD_GET_VEHICLE_VARIABLE, VAR_ELECTRICITYCONSUMPTION, vehicleID); } -SUMOReal +double TraCIAPI::VehicleScope::getWaitingTime(const std::string& vehID) const { return myParent.getDouble(CMD_GET_VEHICLE_VARIABLE, VAR_WAITING_TIME, vehID); } @@ -1969,12 +2080,32 @@ } -SUMOReal +double TraCIAPI::VehicleScope::getSlope(const std::string& vehID) const { return myParent.getDouble(CMD_GET_VEHICLE_VARIABLE, VAR_SLOPE, vehID); } +std::string +TraCIAPI::VehicleScope::getLine(const std::string& typeID) const { + return myParent.getString(CMD_GET_VEHICLE_VARIABLE, VAR_LINE, typeID); +} + +std::vector +TraCIAPI::VehicleScope::getVia(const std::string& vehicleID) const { + return myParent.getStringVector(CMD_GET_VEHICLE_VARIABLE, VAR_VIA, vehicleID); +} + +std::string +TraCIAPI::VehicleScope::getEmissionClass(const std::string& vehicleID) const { + return myParent.getString(CMD_GET_VEHICLE_VARIABLE, VAR_EMISSIONCLASS, vehicleID); +} + +std::string +TraCIAPI::VehicleScope::getShapeClass(const std::string& vehicleID) const { + return myParent.getString(CMD_GET_VEHICLE_VARIABLE, VAR_SHAPECLASS, vehicleID); +} + std::vector TraCIAPI::VehicleScope::getNextTLS(const std::string& vehID) const { tcpip::Storage inMsg; @@ -2077,9 +2208,18 @@ } +void +TraCIAPI::VehicleScope::changeTarget(const std::string& vehicleID, const std::string& edgeID) const { + tcpip::Storage content; + content.writeUnsignedByte(TYPE_STRING); + content.writeString(edgeID); + myParent.send_commandSetValue(CMD_SET_VEHICLE_VARIABLE, CMD_CHANGETARGET, vehicleID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_VEHICLE_VARIABLE); +} void -TraCIAPI::VehicleScope::moveTo(const std::string& vehicleID, const std::string& laneID, SUMOReal position) const { +TraCIAPI::VehicleScope::moveTo(const std::string& vehicleID, const std::string& laneID, double position) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_COMPOUND); content.writeInt(2); @@ -2093,7 +2233,7 @@ } void -TraCIAPI::VehicleScope::moveToXY(const std::string& vehicleID, const std::string& edgeID, const int lane, const SUMOReal x, const SUMOReal y, const SUMOReal angle, const int keepRoute) const { +TraCIAPI::VehicleScope::moveToXY(const std::string& vehicleID, const std::string& edgeID, const int lane, const double x, const double y, const double angle, const int keepRoute) const { myParent.send_commandMoveToXY(vehicleID, edgeID, lane, x, y, angle, keepRoute); tcpip::Storage inMsg; myParent.check_resultState(inMsg, CMD_SET_VEHICLE_VARIABLE); @@ -2101,7 +2241,7 @@ void -TraCIAPI::VehicleScope::slowDown(const std::string& vehicleID, SUMOReal speed, int duration) const { +TraCIAPI::VehicleScope::slowDown(const std::string& vehicleID, double speed, int duration) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_COMPOUND); content.writeInt(2); @@ -2115,7 +2255,7 @@ } void -TraCIAPI::VehicleScope::setSpeed(const std::string& vehicleID, SUMOReal speed) const { +TraCIAPI::VehicleScope::setSpeed(const std::string& vehicleID, double speed) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_DOUBLE); content.writeDouble(speed); @@ -2125,6 +2265,16 @@ } void +TraCIAPI::VehicleScope::setMaxSpeed(const std::string& vehicleID, double speed) const { + tcpip::Storage content; + content.writeUnsignedByte(TYPE_DOUBLE); + content.writeDouble(speed); + myParent.send_commandSetValue(CMD_SET_VEHICLE_VARIABLE, VAR_MAXSPEED, vehicleID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_VEHICLE_VARIABLE); +} + +void TraCIAPI::VehicleScope::setColor(const std::string& vehicleID, const TraCIColor& c) const { tcpip::Storage content; content.writeUnsignedByte(TYPE_COLOR); @@ -2137,6 +2287,51 @@ myParent.check_resultState(inMsg, CMD_SET_VEHICLE_VARIABLE); } +void +TraCIAPI::VehicleScope::setLine(const std::string& vehicleID, const std::string& line) const { + tcpip::Storage content; + content.writeUnsignedByte(TYPE_STRING); + content.writeString(line); + myParent.send_commandSetValue(CMD_SET_VEHICLE_VARIABLE, VAR_LINE, vehicleID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_VEHICLE_VARIABLE); +} + +void +TraCIAPI::VehicleScope::setVia(const std::string& vehicleID, const std::vector& via) const { + tcpip::Storage content; + content.writeUnsignedByte(TYPE_STRINGLIST); + content.writeInt((int)via.size()); + for (int i = 0; i < (int)via.size(); ++i) { + content.writeString(via[i]); + } + myParent.send_commandSetValue(CMD_SET_VEHICLE_VARIABLE, VAR_VIA, vehicleID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_VEHICLE_VARIABLE); +} + + +void +TraCIAPI::VehicleScope::setShapeClass(const std::string& vehicleID, const std::string& clazz) const { + tcpip::Storage content; + content.writeUnsignedByte(TYPE_STRING); + content.writeString(clazz); + myParent.send_commandSetValue(CMD_SET_VEHICLE_VARIABLE, VAR_SHAPECLASS, vehicleID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_VEHICLE_VARIABLE); +} + + +void +TraCIAPI::VehicleScope::setEmissionClass(const std::string& vehicleID, const std::string& clazz) const { + tcpip::Storage content; + content.writeUnsignedByte(TYPE_STRING); + content.writeString(clazz); + myParent.send_commandSetValue(CMD_SET_VEHICLE_VARIABLE, VAR_EMISSIONCLASS, vehicleID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_VEHICLE_VARIABLE); +} + // --------------------------------------------------------------------------- // // TraCIAPI::PersonScope-methods @@ -2152,34 +2347,240 @@ return myParent.getInt(CMD_GET_PERSON_VARIABLE, ID_COUNT, ""); } -SUMOReal -TraCIAPI::PersonScope::getSpeed(const std::string& typeID) const { - return myParent.getDouble(CMD_GET_PERSON_VARIABLE, VAR_SPEED, typeID); +double +TraCIAPI::PersonScope::getSpeed(const std::string& personID) const { + return myParent.getDouble(CMD_GET_PERSON_VARIABLE, VAR_SPEED, personID); } -TraCIAPI::TraCIPosition -TraCIAPI::PersonScope::getPosition(const std::string& typeID) const { - return myParent.getPosition(CMD_GET_PERSON_VARIABLE, VAR_POSITION, typeID); +TraCIPosition +TraCIAPI::PersonScope::getPosition(const std::string& personID) const { + return myParent.getPosition(CMD_GET_PERSON_VARIABLE, VAR_POSITION, personID); } std::string -TraCIAPI::PersonScope::getRoadID(const std::string& typeID) const { - return myParent.getString(CMD_GET_PERSON_VARIABLE, VAR_ROAD_ID, typeID); +TraCIAPI::PersonScope::getRoadID(const std::string& personID) const { + return myParent.getString(CMD_GET_PERSON_VARIABLE, VAR_ROAD_ID, personID); } std::string -TraCIAPI::PersonScope::getTypeID(const std::string& typeID) const { - return myParent.getString(CMD_GET_PERSON_VARIABLE, VAR_TYPE, typeID); +TraCIAPI::PersonScope::getTypeID(const std::string& personID) const { + return myParent.getString(CMD_GET_PERSON_VARIABLE, VAR_TYPE, personID); +} + +double +TraCIAPI::PersonScope::getWaitingTime(const std::string& personID) const { + return myParent.getDouble(CMD_GET_PERSON_VARIABLE, VAR_WAITING_TIME, personID); } -SUMOReal -TraCIAPI::PersonScope::getWaitingTime(const std::string& typeID) const { - return myParent.getDouble(CMD_GET_PERSON_VARIABLE, VAR_WAITING_TIME, typeID); +std::string +TraCIAPI::PersonScope::getNextEdge(const std::string& personID) const { + return myParent.getString(CMD_GET_PERSON_VARIABLE, VAR_NEXT_EDGE, personID); } + std::string -TraCIAPI::PersonScope::getNextEdge(const std::string& typeID) const { - return myParent.getString(CMD_GET_PERSON_VARIABLE, VAR_NEXT_EDGE, typeID); +TraCIAPI::PersonScope::getVehicle(const std::string& personID) const { + return myParent.getString(CMD_GET_PERSON_VARIABLE, VAR_VEHICLE, personID); +} + +int +TraCIAPI::PersonScope::getRemainingStages(const std::string& personID) const { + return myParent.getInt(CMD_GET_PERSON_VARIABLE, VAR_STAGES_REMAINING, personID); +} + +int +TraCIAPI::PersonScope::getStage(const std::string& personID, int nextStageIndex) const { + tcpip::Storage content; + content.writeByte(TYPE_INTEGER); + content.writeInt(nextStageIndex); + return myParent.getInt(CMD_GET_PERSON_VARIABLE, VAR_STAGE, personID, &content); +} + +std::vector +TraCIAPI::PersonScope::getEdges(const std::string& personID, int nextStageIndex) const { + tcpip::Storage content; + content.writeByte(TYPE_INTEGER); + content.writeInt(nextStageIndex); + return myParent.getStringVector(CMD_GET_PERSON_VARIABLE, VAR_EDGES, personID, &content); +} + +void +TraCIAPI::PersonScope::removeStages(const std::string& personID) const { + // remove all stages after the current and then abort the current stage + while (getRemainingStages(personID) > 1) { + removeStage(personID, 1); + } + removeStage(personID, 0); +} + +void +TraCIAPI::PersonScope::add(const std::string& personID, const std::string& edgeID, double pos, double depart, const std::string typeID) { + if (depart > 0) { + depart *= 1000; + } + tcpip::Storage content; + content.writeUnsignedByte(TYPE_COMPOUND); + content.writeInt(4); + content.writeUnsignedByte(TYPE_STRING); + content.writeString(typeID); + content.writeUnsignedByte(TYPE_STRING); + content.writeString(edgeID); + content.writeUnsignedByte(TYPE_INTEGER); + content.writeInt((int)depart); + content.writeUnsignedByte(TYPE_DOUBLE); + content.writeDouble(pos); + myParent.send_commandSetValue(CMD_SET_PERSON_VARIABLE, ADD, personID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_PERSON_VARIABLE); +} + +void +TraCIAPI::PersonScope::appendWaitingStage(const std::string& personID, double duration, const std::string& description, const std::string& stopID) { + duration *= 1000; + tcpip::Storage content; + content.writeUnsignedByte(TYPE_COMPOUND); + content.writeInt(4); + content.writeUnsignedByte(TYPE_INTEGER); + content.writeInt(STAGE_WAITING); + content.writeUnsignedByte(TYPE_INTEGER); + content.writeInt((int)duration); + content.writeUnsignedByte(TYPE_STRING); + content.writeString(description); + content.writeUnsignedByte(TYPE_STRING); + content.writeString(stopID); + myParent.send_commandSetValue(CMD_SET_PERSON_VARIABLE, APPEND_STAGE, personID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_PERSON_VARIABLE); +} + +void +TraCIAPI::PersonScope::appendWalkingStage(const std::string& personID, const std::vector& edges, double arrivalPos, double duration, double speed, const std::string& stopID) { + if (duration > 0) { + duration *= 1000; + } + tcpip::Storage content; + content.writeUnsignedByte(TYPE_COMPOUND); + content.writeInt(6); + content.writeUnsignedByte(TYPE_INTEGER); + content.writeInt(STAGE_WALKING); + content.writeUnsignedByte(TYPE_STRINGLIST); + content.writeStringList(edges); + content.writeUnsignedByte(TYPE_DOUBLE); + content.writeDouble(arrivalPos); + content.writeUnsignedByte(TYPE_INTEGER); + content.writeInt((int)duration); + content.writeUnsignedByte(TYPE_DOUBLE); + content.writeDouble(speed); + content.writeUnsignedByte(TYPE_STRING); + content.writeString(stopID); + myParent.send_commandSetValue(CMD_SET_PERSON_VARIABLE, APPEND_STAGE, personID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_PERSON_VARIABLE); +} + +void +TraCIAPI::PersonScope::appendDrivingStage(const std::string& personID, const std::string& toEdge, const std::string& lines, const std::string& stopID) { + tcpip::Storage content; + content.writeUnsignedByte(TYPE_COMPOUND); + content.writeInt(4); + content.writeUnsignedByte(TYPE_INTEGER); + content.writeInt(STAGE_DRIVING); + content.writeUnsignedByte(TYPE_STRING); + content.writeString(toEdge); + content.writeUnsignedByte(TYPE_STRING); + content.writeString(lines); + content.writeUnsignedByte(TYPE_STRING); + content.writeString(stopID); + myParent.send_commandSetValue(CMD_SET_PERSON_VARIABLE, APPEND_STAGE, personID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_PERSON_VARIABLE); +} + +void +TraCIAPI::PersonScope::removeStage(const std::string& personID, int nextStageIndex) const { + tcpip::Storage content; + content.writeByte(TYPE_INTEGER); + content.writeInt(nextStageIndex); + myParent.send_commandSetValue(CMD_SET_PERSON_VARIABLE, REMOVE_STAGE, personID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_PERSON_VARIABLE); +} + + +void +TraCIAPI::PersonScope::setSpeed(const std::string& personID, double speed) const { + tcpip::Storage content; + content.writeUnsignedByte(TYPE_DOUBLE); + content.writeDouble(speed); + myParent.send_commandSetValue(CMD_SET_PERSON_VARIABLE, VAR_SPEED, personID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_PERSON_VARIABLE); +} + + +void +TraCIAPI::PersonScope::setType(const std::string& personID, const std::string& typeID) const { + tcpip::Storage content; + content.writeUnsignedByte(TYPE_STRING); + content.writeString(typeID); + myParent.send_commandSetValue(CMD_SET_PERSON_VARIABLE, VAR_TYPE, personID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_PERSON_VARIABLE); +} + +void +TraCIAPI::PersonScope::setLength(const std::string& personID, double length) const { + tcpip::Storage content; + content.writeUnsignedByte(TYPE_DOUBLE); + content.writeDouble(length); + myParent.send_commandSetValue(CMD_SET_PERSON_VARIABLE, VAR_LENGTH, personID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_PERSON_VARIABLE); +} + + +void +TraCIAPI::PersonScope::setWidth(const std::string& personID, double width) const { + tcpip::Storage content; + content.writeUnsignedByte(TYPE_DOUBLE); + content.writeDouble(width); + myParent.send_commandSetValue(CMD_SET_PERSON_VARIABLE, VAR_WIDTH, personID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_PERSON_VARIABLE); +} + +void +TraCIAPI::PersonScope::setHeight(const std::string& personID, double height) const { + tcpip::Storage content; + content.writeUnsignedByte(TYPE_DOUBLE); + content.writeDouble(height); + myParent.send_commandSetValue(CMD_SET_PERSON_VARIABLE, VAR_HEIGHT, personID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_PERSON_VARIABLE); +} + +void +TraCIAPI::PersonScope::setMinGap(const std::string& personID, double minGap) const { + tcpip::Storage content; + content.writeUnsignedByte(TYPE_DOUBLE); + content.writeDouble(minGap); + myParent.send_commandSetValue(CMD_SET_PERSON_VARIABLE, VAR_MINGAP, personID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_PERSON_VARIABLE); +} + + +void +TraCIAPI::PersonScope::setColor(const std::string& personID, const TraCIColor& c) const { + tcpip::Storage content; + content.writeUnsignedByte(TYPE_COLOR); + content.writeUnsignedByte(c.r); + content.writeUnsignedByte(c.g); + content.writeUnsignedByte(c.b); + content.writeUnsignedByte(c.a); + myParent.send_commandSetValue(CMD_SET_PERSON_VARIABLE, VAR_COLOR, personID, content); + tcpip::Storage inMsg; + myParent.check_resultState(inMsg, CMD_SET_PERSON_VARIABLE); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/traci/TraCIAPI.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/traci/TraCIAPI.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/traci/TraCIAPI.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/traci/TraCIAPI.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Mario Krumnow /// @author Michael Behrisch /// @date 30.05.2012 -/// @version $Id: TraCIAPI.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: TraCIAPI.h 23965 2017-04-18 12:41:56Z namdre $ /// // C++ TraCI client API implementation /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,13 +39,13 @@ #include #include #include - +#include // =========================================================================== // global definitions // =========================================================================== #define DEFAULT_VIEW "View #0" - +#define PRECISION 2 // =========================================================================== // class definitions @@ -62,84 +62,6 @@ class TraCIAPI { public: - /// @name Structures definitions - /// @{ - - /** @struct TraCIPosition - * @brief A 3D-position - */ - struct TraCIPosition { - double x, y, z; - }; - - /** @struct TraCIPosition - * @brief A color - */ - struct TraCIColor { - int r, g, b, a; - }; - - /** @struct TraCIPositionVector - * @brief A list of positions - */ - typedef std::vector TraCIPositionVector; - - /** @struct TraCIBoundary - * @brief A 3D-bounding box - */ - struct TraCIBoundary { - double xMin, yMin, zMin; - double xMax, yMax, zMax; - }; - - struct TraCIValue { - union { - double scalar; - TraCIPosition position; - TraCIColor color; - }; - std::string string; - }; - - class TraCIPhase { - public: - TraCIPhase(const SUMOTime _duration, const SUMOTime _duration1, const SUMOTime _duration2, const std::string& _phase) - : duration(_duration), duration1(_duration1), duration2(_duration2), phase(_phase) {} - ~TraCIPhase() {} - - SUMOTime duration, duration1, duration2; - std::string phase; - }; - - - class TraCILogic { - public: - TraCILogic(const std::string& _subID, int _type, const std::map& _subParameter, int _currentPhaseIndex, const std::vector& _phases) - : subID(_subID), type(_type), subParameter(_subParameter), currentPhaseIndex(_currentPhaseIndex), phases(_phases) {} - ~TraCILogic() {} - - std::string subID; - int type; - std::map subParameter; - int currentPhaseIndex; - std::vector phases; - }; - - class TraCILink { - public: - TraCILink(const std::string& _from, const std::string& _via, const std::string& _to) - : from(_from), via(_via), to(_to) {} - ~TraCILink() {} - - std::string from; - std::string via; - std::string to; - }; - - /// @} - - - /** @brief Constructor */ TraCIAPI(); @@ -160,13 +82,15 @@ void connect(const std::string& host, int port); - /// @brief Closes the connection + /// @brief ends the simulation and closes the connection void close(); /// @} /// @brief Advances by one step (or up to the given time) void simulationStep(SUMOTime time = 0); + /// @brief Let sumo load a simulation using the given command line like options. + void load(const std::vector& args); /// @name Atomar getter /// @{ @@ -175,8 +99,8 @@ int getUnsignedByte(int cmd, int var, const std::string& id, tcpip::Storage* add = 0); int getByte(int cmd, int var, const std::string& id, tcpip::Storage* add = 0); int getInt(int cmd, int var, const std::string& id, tcpip::Storage* add = 0); - SUMOReal getFloat(int cmd, int var, const std::string& id, tcpip::Storage* add = 0); - SUMOReal getDouble(int cmd, int var, const std::string& id, tcpip::Storage* add = 0); + double getFloat(int cmd, int var, const std::string& id, tcpip::Storage* add = 0); + double getDouble(int cmd, int var, const std::string& id, tcpip::Storage* add = 0); TraCIBoundary getBoundingBox(int cmd, int var, const std::string& id, tcpip::Storage* add = 0); TraCIPositionVector getPolygon(int cmd, int var, const std::string& id, tcpip::Storage* add = 0); TraCIPosition getPosition(int cmd, int var, const std::string& id, tcpip::Storage* add = 0); @@ -186,7 +110,6 @@ /// @} - /** @class TraCIScopeWrapper * @brief An abstract interface for accessing type-dependent values * @@ -231,27 +154,27 @@ std::vector getIDList() const; int getIDCount() const; - SUMOReal getAdaptedTraveltime(const std::string& edgeID, SUMOTime time) const; - SUMOReal getEffort(const std::string& edgeID, SUMOTime time) const; - SUMOReal getCO2Emission(const std::string& edgeID) const; - SUMOReal getCOEmission(const std::string& edgeID) const; - SUMOReal getHCEmission(const std::string& edgeID) const; - SUMOReal getPMxEmission(const std::string& edgeID) const; - SUMOReal getNOxEmission(const std::string& edgeID) const; - SUMOReal getFuelConsumption(const std::string& edgeID) const; - SUMOReal getNoiseEmission(const std::string& edgeID) const; - SUMOReal getElectricityConsumption(const std::string& edgeID) const; - SUMOReal getLastStepMeanSpeed(const std::string& edgeID) const; - SUMOReal getLastStepOccupancy(const std::string& edgeID) const; - SUMOReal getLastStepLength(const std::string& edgeID) const; - SUMOReal getTraveltime(const std::string& edgeID) const; + double getAdaptedTraveltime(const std::string& edgeID, double time) const; + double getEffort(const std::string& edgeID, SUMOTime time) const; + double getCO2Emission(const std::string& edgeID) const; + double getCOEmission(const std::string& edgeID) const; + double getHCEmission(const std::string& edgeID) const; + double getPMxEmission(const std::string& edgeID) const; + double getNOxEmission(const std::string& edgeID) const; + double getFuelConsumption(const std::string& edgeID) const; + double getNoiseEmission(const std::string& edgeID) const; + double getElectricityConsumption(const std::string& edgeID) const; + double getLastStepMeanSpeed(const std::string& edgeID) const; + double getLastStepOccupancy(const std::string& edgeID) const; + double getLastStepLength(const std::string& edgeID) const; + double getTraveltime(const std::string& edgeID) const; int getLastStepVehicleNumber(const std::string& edgeID) const; - SUMOReal getLastStepHaltingNumber(const std::string& edgeID) const; + double getLastStepHaltingNumber(const std::string& edgeID) const; std::vector getLastStepVehicleIDs(const std::string& edgeID) const; - void adaptTraveltime(const std::string& edgeID, SUMOReal time, SUMOTime begin = 0, SUMOTime end = SUMOTime_MAX) const; - void setEffort(const std::string& edgeID, SUMOReal effort, SUMOTime begin = 0, SUMOTime end = SUMOTime_MAX) const; - void setMaxSpeed(const std::string& edgeID, SUMOReal speed) const; + void adaptTraveltime(const std::string& edgeID, double time, double begin = 0, double end = SUMOTime_MAX / 1000.0) const; + void setEffort(const std::string& edgeID, double effort, SUMOTime begin = 0, SUMOTime end = SUMOTime_MAX) const; + void setMaxSpeed(const std::string& edgeID, double speed) const; private: /// @brief invalidated copy constructor @@ -275,14 +198,14 @@ virtual ~GUIScope() {} std::vector getIDList() const; - SUMOReal getZoom(const std::string& viewID = DEFAULT_VIEW) const; + double getZoom(const std::string& viewID = DEFAULT_VIEW) const; TraCIPosition getOffset(const std::string& viewID = DEFAULT_VIEW) const; std::string getSchema(const std::string& viewID = DEFAULT_VIEW) const; TraCIBoundary getBoundary(const std::string& viewID = DEFAULT_VIEW) const; - void setZoom(const std::string& viewID, SUMOReal zoom) const; - void setOffset(const std::string& viewID, SUMOReal x, SUMOReal y) const; + void setZoom(const std::string& viewID, double zoom) const; + void setOffset(const std::string& viewID, double x, double y) const; void setSchema(const std::string& viewID, const std::string& schemeName) const; - void setBoundary(const std::string& viewID, SUMOReal xmin, SUMOReal ymin, SUMOReal xmax, SUMOReal ymax) const; + void setBoundary(const std::string& viewID, double xmin, double ymin, double xmax, double ymax) const; void screenshot(const std::string& viewID, const std::string& filename) const; void trackVehicle(const std::string& viewID, const std::string& vehID) const; @@ -307,32 +230,16 @@ InductionLoopScope(TraCIAPI& parent) : TraCIScopeWrapper(parent) {} virtual ~InductionLoopScope() {} - struct VehicleData { - /* @brief Constructor - (mirrors MSInductLoop::VehicleData) */ - VehicleData() {} - /// @brief The id of the vehicle - std::string id; - /// @brief Length of the vehicle - SUMOReal length; - /// @brief Entry-time of the vehicle in [s] - SUMOReal entryTime; - /// @brief Leave-time of the vehicle in [s] - SUMOReal leaveTime; - /// @brief Type of the vehicle in - std::string typeID; - }; - std::vector getIDList() const; - SUMOReal getPosition(const std::string& loopID) const; + double getPosition(const std::string& loopID) const; std::string getLaneID(const std::string& loopID) const; int getLastStepVehicleNumber(const std::string& loopID) const; - SUMOReal getLastStepMeanSpeed(const std::string& loopID) const; + double getLastStepMeanSpeed(const std::string& loopID) const; std::vector getLastStepVehicleIDs(const std::string& loopID) const; - SUMOReal getLastStepOccupancy(const std::string& loopID) const; - SUMOReal getLastStepMeanLength(const std::string& loopID) const; - SUMOReal getTimeSinceDetection(const std::string& loopID) const; - std::vector getVehicleData(const std::string& loopID) const; + double getLastStepOccupancy(const std::string& loopID) const; + double getLastStepMeanLength(const std::string& loopID) const; + double getTimeSinceDetection(const std::string& loopID) const; + std::vector getVehicleData(const std::string& loopID) const; private: @@ -381,34 +288,34 @@ virtual ~LaneScope() {} std::vector getIDList() const; - SUMOReal getLength(const std::string& laneID) const; - SUMOReal getMaxSpeed(const std::string& laneID) const; - SUMOReal getWidth(const std::string& laneID) const; + double getLength(const std::string& laneID) const; + double getMaxSpeed(const std::string& laneID) const; + double getWidth(const std::string& laneID) const; std::vector getAllowed(const std::string& laneID) const; std::vector getDisallowed(const std::string& laneID) const; int getLinkNumber(const std::string& laneID) const; TraCIPositionVector getShape(const std::string& laneID) const; std::string getEdgeID(const std::string& laneID) const; - SUMOReal getCO2Emission(const std::string& laneID) const; - SUMOReal getCOEmission(const std::string& laneID) const; - SUMOReal getHCEmission(const std::string& laneID) const; - SUMOReal getPMxEmission(const std::string& laneID) const; - SUMOReal getNOxEmission(const std::string& laneID) const; - SUMOReal getFuelConsumption(const std::string& laneID) const; - SUMOReal getNoiseEmission(const std::string& laneID) const; - SUMOReal getElectricityConsumption(const std::string& laneID) const; - SUMOReal getLastStepMeanSpeed(const std::string& laneID) const; - SUMOReal getLastStepOccupancy(const std::string& laneID) const; - SUMOReal getLastStepLength(const std::string& laneID) const; - SUMOReal getTraveltime(const std::string& laneID) const; + double getCO2Emission(const std::string& laneID) const; + double getCOEmission(const std::string& laneID) const; + double getHCEmission(const std::string& laneID) const; + double getPMxEmission(const std::string& laneID) const; + double getNOxEmission(const std::string& laneID) const; + double getFuelConsumption(const std::string& laneID) const; + double getNoiseEmission(const std::string& laneID) const; + double getElectricityConsumption(const std::string& laneID) const; + double getLastStepMeanSpeed(const std::string& laneID) const; + double getLastStepOccupancy(const std::string& laneID) const; + double getLastStepLength(const std::string& laneID) const; + double getTraveltime(const std::string& laneID) const; int getLastStepVehicleNumber(const std::string& laneID) const; int getLastStepHaltingNumber(const std::string& laneID) const; std::vector getLastStepVehicleIDs(const std::string& laneID) const; void setAllowed(const std::string& laneID, const std::vector& allowedClasses) const; void setDisallowed(const std::string& laneID, const std::vector& disallowedClasses) const; - void setMaxSpeed(const std::string& laneID, SUMOReal speed) const; - void setLength(const std::string& laneID, SUMOReal length) const; + void setMaxSpeed(const std::string& laneID, double speed) const; + void setLength(const std::string& laneID, double length) const; private: /// @brief invalidated copy constructor @@ -420,24 +327,22 @@ }; - /** @class AreaScope - * @brief Scope for interaction with areal detectors + /** @class LaneAreaScope + * @brief Scope for interaction with lane area detectors */ - class AreaScope : public TraCIScopeWrapper { + class LaneAreaScope : public TraCIScopeWrapper { public: - AreaScope(TraCIAPI& parent) : TraCIScopeWrapper(parent) {} - virtual ~AreaScope() {} + LaneAreaScope(TraCIAPI& parent) : TraCIScopeWrapper(parent) {} + virtual ~LaneAreaScope() {} std::vector getIDList() const; - int getJamLengthVehicle(const std::string& laneID) const; - SUMOReal getJamLengthMeters(const std::string& laneID) const; private: /// @brief invalidated copy constructor - AreaScope(const AreaScope& src); + LaneAreaScope(const LaneAreaScope& src); /// @brief invalidated assignment operator - AreaScope& operator=(const AreaScope& src); + LaneAreaScope& operator=(const LaneAreaScope& src); }; @@ -452,7 +357,7 @@ std::vector getIDList() const; int getLastStepVehicleNumber(const std::string& detID) const; - SUMOReal getLastStepMeanSpeed(const std::string& detID) const; + double getLastStepMeanSpeed(const std::string& detID) const; std::vector getLastStepVehicleIDs(const std::string& detID) const; int getLastStepHaltingNumber(const std::string& detID) const; @@ -483,9 +388,9 @@ TraCIColor getColor(const std::string& poiID) const; void setType(const std::string& poiID, const std::string& setType) const; - void setPosition(const std::string& poiID, SUMOReal x, SUMOReal y) const; + void setPosition(const std::string& poiID, double x, double y) const; void setColor(const std::string& poiID, const TraCIColor& c) const; - void add(const std::string& poiID, SUMOReal x, SUMOReal y, const TraCIColor& c, const std::string& type, int layer) const; + void add(const std::string& poiID, double x, double y, const TraCIColor& c, const std::string& type, int layer) const; void remove(const std::string& poiID, int layer = 0) const; private: @@ -586,13 +491,13 @@ int getMinExpectedNumber() const; void subscribe(int domID, const std::string& objID, SUMOTime beginTime, SUMOTime endTime, const std::vector& vars) const; - void subscribeContext(int domID, const std::string& objID, SUMOTime beginTime, SUMOTime endTime, int domain, SUMOReal range, const std::vector& vars) const; + void subscribeContext(int domID, const std::string& objID, SUMOTime beginTime, SUMOTime endTime, int domain, double range, const std::vector& vars) const; - SubscribedValues getSubscriptionResults(); - TraCIValues getSubscriptionResults(const std::string& objID); + const SubscribedValues& getSubscriptionResults() const; + const TraCIValues& getSubscriptionResults(const std::string& objID) const; - SubscribedContextValues getContextSubscriptionResults(); - SubscribedValues getContextSubscriptionResults(const std::string& objID); + const SubscribedContextValues& getContextSubscriptionResults() const; + const SubscribedValues& getContextSubscriptionResults(const std::string& objID) const; private: /// @brief invalidated copy constructor @@ -617,9 +522,9 @@ std::vector getIDList() const; std::string getRedYellowGreenState(const std::string& tlsID) const; - std::vector getCompleteRedYellowGreenDefinition(const std::string& tlsID) const; + std::vector getCompleteRedYellowGreenDefinition(const std::string& tlsID) const; std::vector getControlledLanes(const std::string& tlsID) const; - std::vector getControlledLinks(const std::string& tlsID) const; + std::vector getControlledLinks(const std::string& tlsID) const; std::string getProgram(const std::string& tlsID) const; int getPhase(const std::string& tlsID) const; int getNextSwitch(const std::string& tlsID) const; @@ -628,7 +533,7 @@ void setPhase(const std::string& tlsID, int index) const; void setProgram(const std::string& tlsID, const std::string& programID) const; void setPhaseDuration(const std::string& tlsID, int phaseDuration) const; - void setCompleteRedYellowGreenDefinition(const std::string& tlsID, const TraCIAPI::TraCILogic& logic) const; + void setCompleteRedYellowGreenDefinition(const std::string& tlsID, const TraCILogic& logic) const; private: /// @brief invalidated copy constructor @@ -652,37 +557,43 @@ virtual ~VehicleTypeScope() {} std::vector getIDList() const; - SUMOReal getLength(const std::string& typeID) const; - SUMOReal getMaxSpeed(const std::string& typeID) const; - SUMOReal getSpeedFactor(const std::string& typeID) const; - SUMOReal getSpeedDeviation(const std::string& typeID) const; - SUMOReal getAccel(const std::string& typeID) const; - SUMOReal getDecel(const std::string& typeID) const; - SUMOReal getImperfection(const std::string& typeID) const; - SUMOReal getTau(const std::string& typeID) const; + double getLength(const std::string& typeID) const; + double getMaxSpeed(const std::string& typeID) const; + double getSpeedFactor(const std::string& typeID) const; + double getSpeedDeviation(const std::string& typeID) const; + double getAccel(const std::string& typeID) const; + double getDecel(const std::string& typeID) const; + double getImperfection(const std::string& typeID) const; + double getTau(const std::string& typeID) const; std::string getVehicleClass(const std::string& typeID) const; std::string getEmissionClass(const std::string& typeID) const; std::string getShapeClass(const std::string& typeID) const; - SUMOReal getMinGap(const std::string& typeID) const; - SUMOReal getWidth(const std::string& typeID) const; - SUMOReal getHeight(const std::string& typeID) const; + double getMinGap(const std::string& typeID) const; + double getWidth(const std::string& typeID) const; + double getHeight(const std::string& typeID) const; TraCIColor getColor(const std::string& typeID) const; + double getMinGapLat(const std::string& typeID) const; + double getMaxSpeedLat(const std::string& typeID) const; + std::string getLateralAlignment(const std::string& typeID) const; - void setLength(const std::string& typeID, SUMOReal length) const; - void setMaxSpeed(const std::string& typeID, SUMOReal speed) const; + void setLength(const std::string& typeID, double length) const; + void setMaxSpeed(const std::string& typeID, double speed) const; void setVehicleClass(const std::string& typeID, const std::string& clazz) const; - void setSpeedFactor(const std::string& typeID, SUMOReal factor) const; - void setSpeedDeviation(const std::string& typeID, SUMOReal deviation) const; + void setSpeedFactor(const std::string& typeID, double factor) const; + void setSpeedDeviation(const std::string& typeID, double deviation) const; void setEmissionClass(const std::string& typeID, const std::string& clazz) const; - void setWidth(const std::string& typeID, SUMOReal width) const; - void setHeight(const std::string& typeID, SUMOReal height) const; - void setMinGap(const std::string& typeID, SUMOReal minGap) const; - void setShapeClass(const std::string& typeID, const std::string& clazz) const; - void setAccel(const std::string& typeID, SUMOReal accel) const; - void setDecel(const std::string& typeID, SUMOReal decel) const; - void setImperfection(const std::string& typeID, SUMOReal imperfection) const; - void setTau(const std::string& typeID, SUMOReal tau) const; + void setShapeClass(const std::string& typeID, const std::string& shapeClass) const; + void setWidth(const std::string& typeID, double width) const; + void setHeight(const std::string& typeID, double height) const; + void setMinGap(const std::string& typeID, double minGap) const; + void setAccel(const std::string& typeID, double accel) const; + void setDecel(const std::string& typeID, double decel) const; + void setImperfection(const std::string& typeID, double imperfection) const; + void setTau(const std::string& typeID, double tau) const; void setColor(const std::string& typeID, const TraCIColor& c) const; + void setMinGapLat(const std::string& typeID, double minGapLat) const; + void setMaxSpeedLat(const std::string& typeID, double speed) const; + void setLateralAlignment(const std::string& typeID, const std::string& latAlignment) const; private: /// @brief invalidated copy constructor @@ -714,7 +625,7 @@ /// @brief The tls index of the controlled link int tlIndex; /// @brief The distance to the tls - SUMOReal dist; + double dist; /// @brief The current state of the tls char state; }; @@ -722,9 +633,10 @@ std::vector getIDList() const; int getIDCount() const; - SUMOReal getSpeed(const std::string& vehicleID) const; + double getSpeed(const std::string& vehicleID) const; + double getMaxSpeed(const std::string& vehicleID) const; TraCIPosition getPosition(const std::string& vehicleID) const; - SUMOReal getAngle(const std::string& vehicleID) const; + double getAngle(const std::string& vehicleID) const; std::string getRoadID(const std::string& vehicleID) const; std::string getLaneID(const std::string& vehicleID) const; int getLaneIndex(const std::string& vehicleID) const; @@ -733,44 +645,39 @@ int getRouteIndex(const std::string& vehicleID) const; std::vector getEdges(const std::string& vehicleID) const; TraCIColor getColor(const std::string& vehicleID) const; - SUMOReal getLanePosition(const std::string& vehicleID) const; - SUMOReal getCO2Emission(const std::string& vehicleID) const; - SUMOReal getCOEmission(const std::string& vehicleID) const; - SUMOReal getHCEmission(const std::string& vehicleID) const; - SUMOReal getPMxEmission(const std::string& vehicleID) const; - SUMOReal getNOxEmission(const std::string& vehicleID) const; - SUMOReal getFuelConsumption(const std::string& vehicleID) const; - SUMOReal getNoiseEmission(const std::string& vehicleID) const; - SUMOReal getElectricityConsumption(const std::string& vehicleID) const; + double getLanePosition(const std::string& vehicleID) const; + double getLateralLanePosition(const std::string& vehicleID) const; + double getCO2Emission(const std::string& vehicleID) const; + double getCOEmission(const std::string& vehicleID) const; + double getHCEmission(const std::string& vehicleID) const; + double getPMxEmission(const std::string& vehicleID) const; + double getNOxEmission(const std::string& vehicleID) const; + double getFuelConsumption(const std::string& vehicleID) const; + double getNoiseEmission(const std::string& vehicleID) const; + double getElectricityConsumption(const std::string& vehicleID) const; int getSignalStates(const std::string& vehicleID) const; - SUMOReal getWaitingTime(const std::string& vehicleID) const; + double getWaitingTime(const std::string& vehicleID) const; std::vector getNextTLS(const std::string& vehID) const; int getSpeedMode(const std::string& vehicleID) const; - SUMOReal getSlope(const std::string& vehicleID) const; + double getSlope(const std::string& vehicleID) const; + std::string getLine(const std::string& vehicleID) const; + std::vector getVia(const std::string& vehicleID) const; + std::string getEmissionClass(const std::string& vehicleID) const; + std::string getShapeClass(const std::string& vehicleID) const; /* /// not yet implemented - SUMOReal getCO2Emissions(const std::string& vehicleID) const; - SUMOReal getCOEmissions(const std::string& vehicleID) const; - SUMOReal getHCEmissions(const std::string& vehicleID) const; - SUMOReal getPMxEmissions(const std::string& vehicleID) const; - SUMOReal getNOxEmissions(const std::string& vehicleID) const; - SUMOReal getFuelConsumption(const std::string& vehicleID) const; - SUMOReal getNoiseEmission(const std::string& vehicleID) const; int getBestLanes(const std::string& vehicleID) const; int getStopState(const std::string& vehicleID) const; - SUMOReal getLength(const std::string& vehicleID) const; - SUMOReal getMaxSpeed(const std::string& vehicleID) const; - SUMOReal getAccel(const std::string& vehicleID) const; - SUMOReal getDecel(const std::string& vehicleID) const; - SUMOReal getTau(const std::string& vehicleID) const; - SUMOReal getImperfection(const std::string& vehicleID) const; - SUMOReal getSpeedFactor(const std::string& vehicleID) const; - SUMOReal getSpeedDeviation(const std::string& vehicleID) const; + double getLength(const std::string& vehicleID) const; + double getAccel(const std::string& vehicleID) const; + double getDecel(const std::string& vehicleID) const; + double getTau(const std::string& vehicleID) const; + double getImperfection(const std::string& vehicleID) const; + double getSpeedFactor(const std::string& vehicleID) const; + double getSpeedDeviation(const std::string& vehicleID) const; std::string getVClass(const std::string& vehicleID) const; - std::string getEmissionClass(const std::string& vehicleID) const; - std::string getShapeClass(const std::string& vehicleID) const; - SUMOReal getMinGap(const std::string& vehicleID) const; - SUMOReal getWidth(const std::string& vehicleID) const; + double getMinGap(const std::string& vehicleID) const; + double getWidth(const std::string& vehicleID) const; */ void add(const std::string& vehicleID, @@ -789,12 +696,18 @@ int personCapacity = 0, int personNumber = 0) const; - void moveTo(const std::string& vehicleID, const std::string& laneID, SUMOReal position) const; - void moveToXY(const std::string& vehicleID, const std::string& edgeID, const int lane, const SUMOReal x, const SUMOReal y, const SUMOReal angle, const int keepRoute) const; - void slowDown(const std::string& vehicleID, SUMOReal speed, int duration) const; - void setSpeed(const std::string& vehicleID, SUMOReal speed) const; + void changeTarget(const std::string& vehicleID, const std::string& edgeID) const; + void moveTo(const std::string& vehicleID, const std::string& laneID, double position) const; + void moveToXY(const std::string& vehicleID, const std::string& edgeID, const int lane, const double x, const double y, const double angle, const int keepRoute) const; + void slowDown(const std::string& vehicleID, double speed, int duration) const; + void setSpeed(const std::string& vehicleID, double speed) const; + void setMaxSpeed(const std::string& vehicleID, double speed) const; void remove(const std::string& vehicleID, char reason = REMOVE_VAPORIZED) const; void setColor(const std::string& vehicleID, const TraCIColor& c) const; + void setLine(const std::string& vehicleID, const std::string& line) const; + void setVia(const std::string& vehicleID, const std::vector& via) const; + void setShapeClass(const std::string& vehicleID, const std::string& clazz) const; + void setEmissionClass(const std::string& vehicleID, const std::string& clazz) const; private: /// @brief invalidated copy constructor @@ -815,12 +728,30 @@ std::vector getIDList() const; int getIDCount() const; - SUMOReal getSpeed(const std::string& typeID) const; - TraCIPosition getPosition(const std::string& typeID) const; - std::string getRoadID(const std::string& typeID) const; - std::string getTypeID(const std::string& typeID) const; - SUMOReal getWaitingTime(const std::string& typeID) const; - std::string getNextEdge(const std::string& typeID) const; + double getSpeed(const std::string& personID) const; + TraCIPosition getPosition(const std::string& personID) const; + std::string getRoadID(const std::string& personID) const; + std::string getTypeID(const std::string& personID) const; + double getWaitingTime(const std::string& personID) const; + std::string getNextEdge(const std::string& personID) const; + std::string getVehicle(const std::string& personID) const; + int getRemainingStages(const std::string& personID) const; + int getStage(const std::string& personID, int nextStageIndex = 0) const; + std::vector getEdges(const std::string& personID, int nextStageIndex = 0) const; + + void removeStages(const std::string& personID) const; + void add(const std::string& personID, const std::string& edgeID, double pos, double depart = DEPARTFLAG_NOW, const std::string typeID = "DEFAULT_PEDTYPE"); + void appendWaitingStage(const std::string& personID, double duration, const std::string& description = "waiting", const std::string& stopID = ""); + void appendWalkingStage(const std::string& personID, const std::vector& edges, double arrivalPos, double duration = -1, double speed = -1, const std::string& stopID = ""); + void appendDrivingStage(const std::string& personID, const std::string& toEdge, const std::string& lines, const std::string& stopID = ""); + void removeStage(const std::string& personID, int nextStageIndex) const; + void setSpeed(const std::string& personID, double speed) const; + void setType(const std::string& personID, const std::string& typeID) const; + void setLength(const std::string& personID, double length) const; + void setWidth(const std::string& personID, double width) const; + void setHeight(const std::string& personID, double height) const; + void setMinGap(const std::string& personID, double minGap) const; + void setColor(const std::string& personID, const TraCIColor& c) const; private: /// @brief invalidated copy constructor @@ -843,8 +774,12 @@ JunctionScope junction; /// @brief Scope for interaction with lanes LaneScope lane; + /// @brief Scope for interaction with lanes + LaneAreaScope lanearea; /// @brief Scope for interaction with multi-entry/-exit detectors MeMeScope multientryexit; + /// @brief Scope for interaction with persons + PersonScope person; /// @brief Scope for interaction with POIs POIScope poi; /// @brief Scope for interaction with polygons @@ -855,12 +790,10 @@ SimulationScope simulation; /// @brief Scope for interaction with traffic lights TrafficLightScope trafficlights; - /// @brief Scope for interaction with vehicle types - VehicleTypeScope vehicletype; /// @brief Scope for interaction with vehicles VehicleScope vehicle; - /// @brief Scope for interaction with persons - PersonScope person; + /// @brief Scope for interaction with vehicle types + VehicleTypeScope vehicletype; protected: @@ -915,12 +848,12 @@ * @param[in] vars The variables to subscribe */ void send_commandSubscribeObjectContext(int domID, const std::string& objID, SUMOTime beginTime, SUMOTime endTime, - int domain, SUMOReal range, const std::vector& vars) const; + int domain, double range, const std::vector& vars) const; /// @} void send_commandMoveToXY(const std::string& vehicleID, const std::string& edgeID, const int lane, - const SUMOReal x, const SUMOReal y, const SUMOReal angle, const int keepRoute) const; + const double x, const double y, const double angle, const int keepRoute) const; /// @name Command sending methods @@ -947,7 +880,7 @@ void readVariables(tcpip::Storage& inMsg, const std::string& objectID, int variableCount, SubscribedValues& into); template - static inline std::string toString(const T& t, std::streamsize accuracy = OUTPUT_ACCURACY) { + static inline std::string toString(const T& t, std::streamsize accuracy = PRECISION) { std::ostringstream oss; oss.setf(std::ios::fixed , std::ios::floatfield); oss << std::setprecision(accuracy); @@ -955,6 +888,9 @@ return oss.str(); } + /// @brief Closes the connection + void closeSocket(); + protected: /// @brief The socket tcpip::Socket* mySocket; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/AStarRouter.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/AStarRouter.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/AStarRouter.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/AStarRouter.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,13 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date January 2012 -/// @version $Id: AStarRouter.h 21808 2016-10-26 13:13:07Z behrisch $ +/// @version $Id: AStarRouter.h 24124 2017-04-28 13:16:32Z namdre $ /// // A* Algorithm using euclidean distance heuristic. // Based on DijkstraRouterTT. For routing by effort a novel heuristic would be needed. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -48,6 +48,9 @@ #include #include "SUMOAbstractRouter.h" +//#define ASTAR_DEBUG_QUERY +//#define ASTAR_DEBUG_QUERY_PERF +//#define ASTAR_DEBUG_VISITED // =========================================================================== // class definitions @@ -71,8 +74,8 @@ class AStarRouter : public SUMOAbstractRouter, public PF { public: - typedef SUMOReal(* Operation)(const E* const, const V* const, SUMOReal); - typedef std::vector > LookupTable; + typedef double(* Operation)(const E* const, const V* const, double); + typedef std::vector > LookupTable; /** * @struct EdgeInfo @@ -84,8 +87,8 @@ /// Constructor EdgeInfo(const E* e) : edge(e), - traveltime(std::numeric_limits::max()), - heuristicTime(std::numeric_limits::max()), + traveltime(std::numeric_limits::max()), + heuristicTime(std::numeric_limits::max()), prev(0), visited(false) { } @@ -94,10 +97,10 @@ const E* edge; /// Effort to reach the edge - SUMOReal traveltime; + double traveltime; /// Estimated time to reach the edge (traveltime + lower bound on remaining time) - SUMOReal heuristicTime; + double heuristicTime; /// The previous edge EdgeInfo* prev; @@ -107,7 +110,7 @@ inline void reset() { // heuristicTime is set before adding to the frontier, thus no reset is needed - traveltime = std::numeric_limits::max(); + traveltime = std::numeric_limits::max(); visited = false; } @@ -132,18 +135,22 @@ AStarRouter(const std::vector& edges, bool unbuildIsWarning, Operation operation, const LookupTable* const lookup = 0): SUMOAbstractRouter(operation, "AStarRouter"), myErrorMsgHandler(unbuildIsWarning ? MsgHandler::getWarningInstance() : MsgHandler::getErrorInstance()), - myLookupTable(lookup) { + myLookupTable(lookup), + myMaxSpeed(NUMERICAL_EPS) { for (typename std::vector::const_iterator i = edges.begin(); i != edges.end(); ++i) { myEdgeInfos.push_back(EdgeInfo(*i)); + myMaxSpeed = MAX2(myMaxSpeed, (*i)->getSpeedLimit() * MAX2(1.0, (*i)->getLengthGeometryFactor())); } } AStarRouter(const std::vector& edgeInfos, bool unbuildIsWarning, Operation operation, const LookupTable* const lookup = 0): SUMOAbstractRouter(operation, "AStarRouter"), myErrorMsgHandler(unbuildIsWarning ? MsgHandler::getWarningInstance() : MsgHandler::getErrorInstance()), - myLookupTable(lookup) { + myLookupTable(lookup), + myMaxSpeed(NUMERICAL_EPS) { for (typename std::vector::const_iterator i = edgeInfos.begin(); i != edgeInfos.end(); ++i) { - myEdgeInfos.push_back(*i); + myEdgeInfos.push_back(EdgeInfo(i->edge)); + myMaxSpeed = MAX2(myMaxSpeed, i->edge->getSpeedLimit() * i->edge->getLengthGeometryFactor()); } } @@ -159,7 +166,7 @@ BinaryInputDevice dev(filename); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { - SUMOReal val; + double val; dev >> val; (*result)[i].push_back(val); } @@ -194,8 +201,11 @@ return false; } this->startQuery(); +#ifdef ASTAR_DEBUG_QUERY + std::cout << "DEBUG: starting search for '" << vehicle->getID() << "' speed: " << MIN2(vehicle->getMaxSpeed(), myMaxSpeed * vehicle->getChosenSpeedFactor()) << " time: " << STEPS2TIME(msTime) << "\n"; +#endif const SUMOVehicleClass vClass = vehicle == 0 ? SVC_IGNORING : vehicle->getVClass(); - const SUMOReal time = STEPS2TIME(msTime); + const double time = STEPS2TIME(msTime); if (this->myBulkMode) { const EdgeInfo& toInfo = myEdgeInfos[to->getNumericalID()]; if (toInfo.visited) { @@ -213,6 +223,7 @@ } // loop int num_visited = 0; + const double speed = MIN2(vehicle->getMaxSpeed(), myMaxSpeed * vehicle->getChosenSpeedFactor()); while (!myFrontierList.empty()) { num_visited += 1; // use the node with the minimal length @@ -222,15 +233,36 @@ if (minEdge == to) { buildPathFrom(minimumInfo, into); this->endQuery(num_visited); +#ifdef ASTAR_DEBUG_QUERY_PERF + std::cout << "visited " + toString(num_visited) + " edges (final path length=" + toString(into.size()) + + " time=" + toString(recomputeCosts(into, vehicle, msTime)) + + " edges=" + toString(into) + ")\n"; +#endif +#ifdef ASTAR_DEBUG_VISITED + OutputDevice& dev = OutputDevice::getDevice(vehicle->getID() + "_" + time2string(msTime) + "_" + from->getID() + "_" + to->getID()); + for (typename std::vector::const_iterator i = myEdgeInfos.begin(); i != myEdgeInfos.end(); ++i) { + if (i->visited) { + dev << "edge:" << i->edge->getID() << "\n"; + } + } + dev.close(); +#endif return true; } pop_heap(myFrontierList.begin(), myFrontierList.end(), myComparator); myFrontierList.pop_back(); myFound.push_back(minimumInfo); minimumInfo->visited = true; - const SUMOReal traveltime = minimumInfo->traveltime + this->getEffort(minEdge, vehicle, time + minimumInfo->traveltime); +#ifdef ASTAR_DEBUG_QUERY + std::cout << "DEBUG: hit '" << minEdge->getID() << "' TT: " << minimumInfo->traveltime << " E: " << this->getEffort(minEdge, vehicle, time + minimumInfo->traveltime) << " Q: "; + for (typename std::vector::iterator it = myFrontierList.begin(); it != myFrontierList.end(); it++) { + std::cout << (*it)->traveltime << "," << (*it)->edge->getID() << " "; + } + std::cout << "\n"; +#endif + const double traveltime = minimumInfo->traveltime + this->getEffort(minEdge, vehicle, time + minimumInfo->traveltime); // admissible A* heuristic: straight line distance at maximum speed - const SUMOReal heuristic_remaining = myLookupTable == 0 ? minEdge->getDistanceTo(to) / vehicle->getMaxSpeed() : (*myLookupTable)[minEdge->getNumericalID()][to->getNumericalID()] / vehicle->getChosenSpeedFactor(); + const double heuristic_remaining = myLookupTable == 0 ? minEdge->getDistanceTo(to) / speed : (*myLookupTable)[minEdge->getNumericalID()][to->getNumericalID()] / vehicle->getChosenSpeedFactor(); // check all ways from the node with the minimal length const std::vector& successors = minEdge->getSuccessors(vClass); for (typename std::vector::const_iterator it = successors.begin(); it != successors.end(); ++it) { @@ -240,7 +272,7 @@ if (PF::operator()(follower, vehicle)) { continue; } - const SUMOReal oldEffort = followerInfo->traveltime; + const double oldEffort = followerInfo->traveltime; if (!followerInfo->visited && traveltime < oldEffort) { followerInfo->traveltime = traveltime; followerInfo->heuristicTime = traveltime + heuristic_remaining; @@ -250,13 +282,16 @@ if (follower != to) { if (myLookupTable == 0) { // admissible A* heuristic: straight line distance at maximum speed - followerInfo->heuristicTime += this->getEffort(follower, vehicle, time + traveltime) + follower->getDistanceTo(to) / vehicle->getMaxSpeed(); + followerInfo->heuristicTime += this->getEffort(follower, vehicle, time + traveltime) + follower->getDistanceTo(to) / speed; } else { followerInfo->heuristicTime += this->getEffort(follower, vehicle, time + traveltime) + (*myLookupTable)[follower->getNumericalID()][to->getNumericalID()] / vehicle->getChosenSpeedFactor(); } }*/ +#ifdef ASTAR_DEBUG_QUERY + //std::cout << " follower=" << followerInfo->edge->getID() << " oldEffort=" << oldEffort << " rem=" << heuristic_remaining << " tt=" << traveltime << " ht=" << followerInfo->heuristicTime << "\n"; +#endif followerInfo->prev = minimumInfo; - if (oldEffort == std::numeric_limits::max()) { + if (oldEffort == std::numeric_limits::max()) { myFrontierList.push_back(followerInfo); push_heap(myFrontierList.begin(), myFrontierList.end(), myComparator); } else { @@ -268,14 +303,17 @@ } } this->endQuery(num_visited); +#ifdef ASTAR_DEBUG_QUERY_PERF + std::cout << "visited " + toString(num_visited) + " edges (unsuccesful path length: " + toString(into.size()) + ")\n"; +#endif myErrorMsgHandler->inform("No connection between edge '" + from->getID() + "' and edge '" + to->getID() + "' found."); return false; } - SUMOReal recomputeCosts(const std::vector& edges, const V* const v, SUMOTime msTime) const { - const SUMOReal time = STEPS2TIME(msTime); - SUMOReal costs = 0; + double recomputeCosts(const std::vector& edges, const V* const v, SUMOTime msTime) const { + const double time = STEPS2TIME(msTime); + double costs = 0; for (typename std::vector::const_iterator i = edges.begin(); i != edges.end(); ++i) { if (PF::operator()(*i, v)) { return -1; @@ -312,6 +350,9 @@ /// @brief the lookup table for travel time heuristics const LookupTable* const myLookupTable; + + /// @brief maximum speed in the network + double myMaxSpeed; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/CarEdge.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/CarEdge.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/CarEdge.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/CarEdge.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file CarEdge.h /// @author Michael Behrisch /// @date Mon, 03 March 2014 -/// @version $Id: CarEdge.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: CarEdge.h 24108 2017-04-27 18:43:30Z behrisch $ /// // The CarEdge is a special intermodal edge representing the SUMO network edge /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,7 +46,7 @@ typedef IntermodalEdge _IntermodalEdge; public: - CarEdge(int numericalID, const E* edge, const SUMOReal pos = -1.) : + CarEdge(int numericalID, const E* edge, const double pos = -1.) : _IntermodalEdge(edge->getID() + "_car" + toString(pos), numericalID, edge, "!car"), myStartPos(pos >= 0 ? pos : 0.) { } @@ -83,9 +83,9 @@ return trip->vehicle == 0 || this->getEdge()->prohibits(trip->vehicle); } - SUMOReal getTravelTime(const IntermodalTrip* const trip, SUMOReal time) const { - const SUMOReal travelTime = E::getTravelTimeStatic(this->getEdge(), trip->vehicle, time); - SUMOReal distTravelled = this->getLength(); + double getTravelTime(const IntermodalTrip* const trip, double time) const { + const double travelTime = E::getTravelTimeStatic(this->getEdge(), trip->vehicle, time); + double distTravelled = this->getLength(); // checking arrivalPos first to have it correct for identical depart and arrival edge if (this->getEdge() == trip->to) { distTravelled = trip->arrivalPos - myStartPos; @@ -98,7 +98,7 @@ private: /// @brief the starting position for split edges - const SUMOReal myStartPos; + const double myStartPos; /// @brief The successors available for a given vClass mutable std::map > myClassesSuccessorMap; @@ -132,12 +132,12 @@ class PublicTransportEdge : public IntermodalEdge { private: struct Schedule { - Schedule(const SUMOTime _begin, const SUMOTime _end, const SUMOTime _period, const SUMOReal _travelTimeSec) + Schedule(const SUMOTime _begin, const SUMOTime _end, const SUMOTime _period, const double _travelTimeSec) : begin(_begin), end(_end), period(_period), travelTimeSec(_travelTimeSec) {} const SUMOTime begin; const SUMOTime end; const SUMOTime period; - const SUMOReal travelTimeSec; + const double travelTimeSec; private: /// @brief Invalidated assignment operator Schedule& operator=(const Schedule& src); @@ -155,33 +155,40 @@ return myEntryStop; } - void addSchedule(const SUMOTime begin, const SUMOTime end, const SUMOTime period, const SUMOReal travelTimeSec) { + void addSchedule(const SUMOTime begin, const SUMOTime end, const SUMOTime period, const double travelTimeSec) { + //std::cout << " edge=" << myEntryStop->getID() << "->" << this->getID() << " beg=" << STEPS2TIME(begin) << " end=" << STEPS2TIME(end) + // << " period=" << STEPS2TIME(period) + // << " travelTime=" << travelTimeSec << "\n"; mySchedules.insert(std::make_pair(STEPS2TIME(begin), Schedule(begin, end, period, travelTimeSec))); } - SUMOReal getTravelTime(const IntermodalTrip* const /* trip */, SUMOReal time) const { - SUMOReal minArrivalSec = std::numeric_limits::max(); - for (typename std::multimap::const_iterator it = mySchedules.begin(); it != mySchedules.end(); ++it) { + double getTravelTime(const IntermodalTrip* const /* trip */, double time) const { + double minArrivalSec = std::numeric_limits::max(); + for (typename std::multimap::const_iterator it = mySchedules.begin(); it != mySchedules.end(); ++it) { if (it->first > minArrivalSec) { break; } - if (time < STEPS2TIME(it->second.end)) { - const long long int running = MAX2((SUMOTime)0, TIME2STEPS(time) - it->second.begin) / it->second.period; + if (time >= STEPS2TIME(it->second.begin) && time < STEPS2TIME(it->second.end)) { + const int running = MAX2(0, (int)ceil((time - STEPS2TIME(it->second.begin)) / STEPS2TIME(it->second.period))); const SUMOTime nextDepart = it->second.begin + running * it->second.period; minArrivalSec = MIN2(STEPS2TIME(nextDepart) + it->second.travelTimeSec, minArrivalSec); + //std::cout << " edge=" << myEntryStop->getID() << "->" << this->getID() << " beg=" << STEPS2TIME(it->second.begin) << " end=" << STEPS2TIME(it->second.end) + // << " atTime=" << time + // << " running=" << running << " nextDepart=" << nextDepart + // << " minASec=" << minArrivalSec << " travelTime=" << minArrivalSec - time << "\n"; } } return minArrivalSec - time; } private: - std::multimap mySchedules; + std::multimap mySchedules; const IntermodalEdge* const myEntryStop; }; -/// @brief the access edge connecting diferent modes that is given to the internal router (SUMOAbstractRouter) +/// @brief the access edge connecting different modes that is given to the internal router (SUMOAbstractRouter) template class AccessEdge : public IntermodalEdge { private: @@ -189,16 +196,16 @@ public: AccessEdge(int numericalID, const _IntermodalEdge* inEdge, const _IntermodalEdge* outEdge, - const SUMOReal transferTime = NUMERICAL_EPS) : + const double transferTime = NUMERICAL_EPS) : _IntermodalEdge(inEdge->getID() + ":" + outEdge->getID(), numericalID, outEdge->getEdge(), "!access"), myTransferTime(transferTime) { } - SUMOReal getTravelTime(const IntermodalTrip* const /* trip */, SUMOReal /* time */) const { + double getTravelTime(const IntermodalTrip* const /* trip */, double /* time */) const { return myTransferTime; } private: - const SUMOReal myTransferTime; + const double myTransferTime; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/CHBuilder.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/CHBuilder.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/CHBuilder.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/CHBuilder.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,528 @@ +/****************************************************************************/ +/// @file CHBuilder.h +/// @author Jakob Erdmann +/// @author Laura Bieker +/// @author Michael Behrisch +/// @date February 2012 +/// @version $Id: CHBuilder.h 23150 2017-02-27 12:08:30Z behrisch $ +/// +// Contraction Hierarchy Builder for the shortest path search +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef CHBuilder_h +#define CHBuilder_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "SPTree.h" + +//#define CHRouter_DEBUG_CONTRACTION +//#define CHRouter_DEBUG_CONTRACTION_WITNESSES +//#define CHRouter_DEBUG_CONTRACTION_QUEUE +//#define CHRouter_DEBUG_CONTRACTION_DEGREE +//#define CHRouter_DEBUG_WEIGHTS + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class CHRouter + * @brief Computes the shortest path through a contracted network + * + * The template parameters are: + * @param E The edge class to use (MSEdge/ROEdge) + * @param V The vehicle class to use (MSVehicle/ROVehicle) + * @param PF The prohibition function to use (prohibited_withPermissions/noProhibitions) + * + * The router is edge-based. It must know the number of edges for internal reasons + * and whether a missing connection between two given edges (unbuild route) shall + * be reported as an error or as a warning. + * + */ +template +class CHBuilder { + +public: + /// @brief Forward/backward connection with associated forward/backward cost + // forward connections are used only in forward search + // backward connections are used only in backwards search + class Connection { + public: + Connection(int t, double c, SVCPermissions p): target(t), cost(c), permissions(p) {} + int target; + double cost; + SVCPermissions permissions; + }; + + typedef std::pair ConstEdgePair; + typedef std::map ShortcutVia; + struct Hierarchy { + ShortcutVia shortcuts; + std::vector > forwardUplinks; + std::vector > backwardUplinks; + }; + + /** @brief Constructor + * @param[in] validatePermissions Whether a multi-permission hierarchy shall be built + * If set to false, the net is pruned in synchronize() and the + * hierarchy is tailored to the svc + */ + CHBuilder(const std::vector& edges, bool unbuildIsWarning, + const SUMOVehicleClass svc, + bool validatePermissions): + myEdges(edges), + myErrorMsgHandler(unbuildIsWarning ? MsgHandler::getWarningInstance() : MsgHandler::getErrorInstance()), + mySPTree(new SPTree(4, validatePermissions)), + mySVC(svc), + myUpdateCount(0) { + for (typename std::vector::const_iterator i = edges.begin(); i != edges.end(); ++i) { + myCHInfos.push_back(CHInfo(*i)); + } + } + + /// Destructor + virtual ~CHBuilder() { + delete mySPTree; + } + + + const Hierarchy* buildContractionHierarchy(SUMOTime time, const V* const vehicle, const SUMOAbstractRouter* effortProvider) { + Hierarchy* result = new Hierarchy(); + const int numEdges = (int)myCHInfos.size(); + const std::string vClass = (mySPTree->validatePermissions() ? + "all vehicle classes " : "vClass='" + SumoVehicleClassStrings.getString(mySVC) + "' "); + PROGRESS_BEGIN_MESSAGE("Building Contraction Hierarchy for " + vClass + + "and time=" + time2string(time) + " (" + toString(numEdges) + " edges)\n"); + const long startMillis = SysUtils::getCurrentMillis(); + // init queue + std::vector queue; // max heap: edge to be contracted is front + // reset previous connections etc + for (int i = 0; i < numEdges; i++) { + myCHInfos[i].resetContractionState(); + result->forwardUplinks.push_back(std::vector()); + result->backwardUplinks.push_back(std::vector()); + } + // copy connections from the original net + const double time_seconds = STEPS2TIME(time); // timelines store seconds! + for (int i = 0; i < numEdges; i++) { + synchronize(myCHInfos[i], time_seconds, vehicle, effortProvider); + } + // synchronization is finished. now we can compute priorities for the first time + for (int i = 0; i < numEdges; i++) { + myCHInfos[i].updatePriority(mySPTree); + queue.push_back(&(myCHInfos[i])); + } + make_heap(queue.begin(), queue.end(), myCmp); + int contractionRank = 0; + // contraction loop + while (!queue.empty()) { + while (tryUpdateFront(queue)) {} + CHInfo* max = queue.front(); + max->rank = contractionRank; +#ifdef CHRouter_DEBUG_CONTRACTION + std::cout << "contracting '" << max->edge->getID() << "' with prio: " << max->priority << " (rank " << contractionRank << ")\n"; +#endif + const E* const edge = max->edge; + // add outgoing connections to the forward search + const int edgeID = edge->getNumericalID(); + for (typename CHConnections::const_iterator it = max->followers.begin(); it != max->followers.end(); it++) { + const CHConnection& con = *it; + result->forwardUplinks[edgeID].push_back(Connection(con.target->edge->getNumericalID(), con.cost, con.permissions)); + disconnect(con.target->approaching, max); + con.target->updatePriority(0); + } + // add incoming connections to the backward search + for (typename CHConnections::const_iterator it = max->approaching.begin(); it != max->approaching.end(); it++) { + const CHConnection& con = *it; + result->backwardUplinks[edgeID].push_back(Connection(con.target->edge->getNumericalID(), con.cost, con.permissions)); + disconnect(con.target->followers, max); + con.target->updatePriority(0); + } + // add shortcuts to the net + for (typename std::vector::const_iterator it = max->shortcuts.begin(); it != max->shortcuts.end(); it++) { + const ConstEdgePair& edgePair = it->edgePair; + result->shortcuts[edgePair] = edge; + CHInfo* from = getCHInfo(edgePair.first); + CHInfo* to = getCHInfo(edgePair.second); + from->followers.push_back(CHConnection(to, it->cost, it->permissions, it->underlying)); + to->approaching.push_back(CHConnection(from, it->cost, it->permissions, it->underlying)); + } + // if you need to debug the chrouter with MSVC uncomment the following line, hierarchy building will get slower and the hierarchy may change though + //make_heap(queue.begin(), queue.end(), myCmp); + // remove from queue + pop_heap(queue.begin(), queue.end(), myCmp); + queue.pop_back(); + /* + if (contractionRank % 10000 == 0) { + // update all and rebuild queue + for (typename std::vector::iterator it = queue.begin(); it != queue.end(); ++it) { + (*it)->updatePriority(mySPTree); + } + make_heap(queue.begin(), queue.end(), myCmp); + } + */ + contractionRank++; + } + // reporting + const long duration = SysUtils::getCurrentMillis() - startMillis; + WRITE_MESSAGE("Created " + toString(result->shortcuts.size()) + " shortcuts."); + WRITE_MESSAGE("Recomputed priority " + toString(myUpdateCount) + " times."); + MsgHandler::getMessageInstance()->endProcessMsg("done (" + toString(duration) + "ms)."); + PROGRESS_DONE_MESSAGE(); + myUpdateCount = 0; + return result; + } + +private: + struct Shortcut { + Shortcut(ConstEdgePair e, double c, int u, SVCPermissions p): + edgePair(e), cost(c), underlying(u), permissions(p) {} + ConstEdgePair edgePair; + double cost; + int underlying; + SVCPermissions permissions; + }; + + + class CHInfo; + + /// @brief Forward/backward connection with associated FORWARD cost + class CHConnection { + public: + CHConnection(CHInfo* t, double c, SVCPermissions p, int u): + target(t), cost(c), permissions(p), underlying(u) {} + CHInfo* target; + double cost; + SVCPermissions permissions; + /// the number of connections underlying this connection + int underlying; + }; + + typedef std::vector CHConnections; + typedef std::pair CHConnectionPair; + typedef std::vector CHConnectionPairs; + + /* @brief container class to use when building the contraction hierarchy. + * instances are reused every time the hierarchy is rebuilt (new time slice) + * but they must be synchronized first */ + class CHInfo { + public: + /// @brief Constructor + CHInfo(const E* e) : + edge(e), + contractedNeighbors(0), + rank(-1), + level(0), + underlyingTotal(0), + visited(false), + traveltime(std::numeric_limits::max()) { + } + + /// @brief recompute the contraction priority and report whether it changed + bool updatePriority(SPTree* spTree) { + if (spTree != 0) { + updateShortcuts(spTree); + updateLevel(); + } else { + contractedNeighbors += 1; // called when a connected edge was contracted + } + const double oldPriority = priority; + // priority term as used by abraham [] + const int edge_difference = (int)followers.size() + (int)approaching.size() - 2 * (int)shortcuts.size(); + priority = (double)(2 * edge_difference - contractedNeighbors - underlyingTotal - 5 * level); + return priority != oldPriority; + } + + /// compute needed shortcuts when contracting this edge + void updateShortcuts(SPTree* spTree) { + const bool validatePermissions = spTree->validatePermissions(); +#ifdef CHRouter_DEBUG_CONTRACTION_DEGREE + const int degree = (int)approaching.size() + (int)followers.size(); + std::cout << "computing shortcuts for '" + edge->getID() + "' with degree " + toString(degree) + "\n"; +#endif + shortcuts.clear(); + underlyingTotal = 0; + for (typename CHConnections::iterator it_a = approaching.begin(); it_a != approaching.end(); it_a++) { + CHConnection& aInfo = *it_a; + // build shortest path tree in a fixed neighborhood + spTree->rebuildFrom(aInfo.target, this); + for (typename CHConnections::iterator it_f = followers.begin(); it_f != followers.end(); it_f++) { + CHConnection& fInfo = *it_f; + const double viaCost = aInfo.cost + fInfo.cost; + const SVCPermissions viaPermissions = (aInfo.permissions & fInfo.permissions); + if (fInfo.target->traveltime > viaCost) { + // found no faster path -> we need a shortcut via edge +#ifdef CHRouter_DEBUG_CONTRACTION_WITNESSES + debugNoWitness(aInfo, fInfo); +#endif + const int underlying = aInfo.underlying + fInfo.underlying; + underlyingTotal += underlying; + shortcuts.push_back(Shortcut(ConstEdgePair(aInfo.target->edge, fInfo.target->edge), + viaCost, underlying, viaPermissions)); + + } else if (validatePermissions) { + if ((fInfo.target->permissions & viaPermissions) != viaPermissions) { + // witness has weaker restrictions. try to find another witness + spTree->registerForValidation(&aInfo, &fInfo); + } else { +#ifdef CHRouter_DEBUG_CONTRACTION_WITNESSES + debugNoWitness(aInfo, fInfo); +#endif + } + } else { +#ifdef CHRouter_DEBUG_CONTRACTION_WITNESSES + debugNoWitness(aInfo, fInfo); +#endif + } + } + } + // insert shortcuts needed due to unmet permissions + if (validatePermissions) { + const CHConnectionPairs& pairs = spTree->getNeededShortcuts(this); + for (typename CHConnectionPairs::const_iterator it = pairs.begin(); it != pairs.end(); ++it) { + const CHConnection* aInfo = it->first; + const CHConnection* fInfo = it->second; + const double viaCost = aInfo->cost + fInfo->cost; + const SVCPermissions viaPermissions = (aInfo->permissions & fInfo->permissions); + const int underlying = aInfo->underlying + fInfo->underlying; + underlyingTotal += underlying; + shortcuts.push_back(Shortcut(ConstEdgePair(aInfo->target->edge, fInfo->target->edge), + viaCost, underlying, viaPermissions)); + } + } + } + + + // update level as defined by Abraham + void updateLevel() { + int maxLower = std::numeric_limits::min(); + int otherRank; + for (typename CHConnections::iterator it = approaching.begin(); it != approaching.end(); it++) { + otherRank = it->target->rank; + if (otherRank < rank) { + maxLower = MAX2(rank, maxLower); + } + } + for (typename CHConnections::iterator it = followers.begin(); it != followers.end(); it++) { + otherRank = it->target->rank; + if (otherRank < rank) { + maxLower = MAX2(rank, maxLower); + } + } + if (maxLower == std::numeric_limits::min()) { + level = 0; + } else { + level = maxLower + 1; + } + } + + // resets state before rebuilding the hierarchy + void resetContractionState() { + contractedNeighbors = 0; + rank = -1; + level = 0; + underlyingTotal = 0; + shortcuts.clear(); + followers.clear(); + approaching.clear(); + } + + + /// @brief The current edge - not const since it may receive shortcut edges + const E* edge; + /// @brief The contraction priority + double priority; + /// @brief The needed shortcuts + std::vector shortcuts; + /// @brief priority subterms + int contractedNeighbors; + int rank; + int level; + int underlyingTotal; + + /// @brief connections (only valid after synchronization) + CHConnections followers; + CHConnections approaching; + + + /// members used in SPTree + bool visited; + /// Effort to reach the edge + double traveltime; + /// number of edges from start + int depth; + /// the permissions when reaching this edge on the fastest path + // @note: we may miss some witness paths by making traveltime the only + // criteria durinng search + SVCPermissions permissions; + + inline void reset() { + traveltime = std::numeric_limits::max(); + visited = false; + } + + + /// debugging methods + inline void debugNoWitness(const CHConnection& aInfo, const CHConnection& fInfo) { + std::cout << "adding shortcut between " << aInfo.target->edge->getID() << ", " << fInfo.target->edge->getID() << " via " << edge->getID() << "\n"; + } + + inline void debugWitness(const CHConnection& aInfo, const CHConnection& fInfo) { + const double viaCost = aInfo.cost + fInfo.cost; + std::cout << "found witness with lenght " << fInfo.target->traveltime << " against via " << edge->getID() << " (length " << viaCost << ") for " << aInfo.target->edge->getID() << ", " << fInfo.target->edge->getID() << "\n"; + } + + }; + + + /** + * @class EdgeInfoByRankComparator + * Class to compare (and so sort) nodes by their contraction priority + */ + class CHInfoComparator { + public: + /// Comparing method + bool operator()(const CHInfo* a, const CHInfo* b) const { + if (a->priority == b->priority) { + return a->edge->getNumericalID() > b->edge->getNumericalID(); + } else { + return a->priority < b->priority; + }; + } + }; + + + inline CHInfo* getCHInfo(const E* const edge) { + return &(myCHInfos[edge->getNumericalID()]); + } + + + /// @brief copy connections from the original net (modified destructively during contraction) + void synchronize(CHInfo& info, double time, const V* const vehicle, const SUMOAbstractRouter* effortProvider) { + // forward and backward connections are used only in forward search, + // thus approaching costs are those of the approaching edge and not of the edge itself + const bool prune = !mySPTree->validatePermissions(); + const E* const edge = info.edge; + if (prune && ((edge->getPermissions() & mySVC) != mySVC)) { + return; + } + const double cost = effortProvider->getEffort(edge, vehicle, time); + + const std::vector& successors = edge->getSuccessors(mySVC); + for (typename std::vector::const_iterator it = successors.begin(); it != successors.end(); ++it) { + const E* fEdge = *it; + if (prune && ((fEdge->getPermissions() & mySVC) != mySVC)) { + continue; + } + CHInfo* follower = getCHInfo(fEdge); + SVCPermissions permissions = (edge->getPermissions() & follower->edge->getPermissions()); + info.followers.push_back(CHConnection(follower, cost, permissions, 1)); + follower->approaching.push_back(CHConnection(&info, cost, permissions, 1)); + } +#ifdef CHRouter_DEBUG_WEIGHTS + std::cout << time << ": " << edge->getID() << " cost: " << cost << "\n"; +#endif + // @todo: check whether we even need to save approaching in ROEdge; + } + + + /// @brief remove all connections to/from the given edge (assume it exists only once) + void disconnect(CHConnections& connections, CHInfo* other) { + for (typename CHConnections::iterator it = connections.begin(); it != connections.end(); it++) { + if (it->target == other) { + connections.erase(it); + return; + } + } + assert(false); + } + + /** @brief tries to update the priority of the first edge + * @return wether updating changed the first edge + */ + bool tryUpdateFront(std::vector& queue) { + myUpdateCount++; + CHInfo* max = queue.front(); +#ifdef CHRouter_DEBUG_CONTRACTION_QUEUE + std::cout << "updating '" << max->edge->getID() << "'\n"; + debugPrintQueue(queue); +#endif + if (max->updatePriority(mySPTree)) { + pop_heap(queue.begin(), queue.end(), myCmp); + push_heap(queue.begin(), queue.end(), myCmp); + return true; + } else { + return false; + } + } + + // helper method for debugging + void debugPrintQueue(std::vector& queue) { + for (typename std::vector::iterator it = queue.begin(); it != queue.end(); it++) { + CHInfo* chInfo = *it; + std::cout << "(" << chInfo->edge->getID() << "," << chInfo->priority << ") "; + } + std::cout << "\n"; + } + +private: + /// @brief all edges with numerical ids + const std::vector& myEdges; + + /// @brief the handler for routing errors + MsgHandler* const myErrorMsgHandler; + + /// @brief static vector for lookup + std::vector myCHInfos; + + /// @brief Comparator for contraction priority + CHInfoComparator myCmp; + + /// @brief the shortest path tree to use when searching for shortcuts + SPTree* mySPTree; + + /// @brief the permissions for which the hierarchy was constructed + const SUMOVehicleClass mySVC; + + /// @brief counters for performance logging + int myUpdateCount; + +private: + /// @brief Invalidated assignment operator + CHBuilder& operator=(const CHBuilder& s); +}; + + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/CHRouter.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/CHRouter.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/CHRouter.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/CHRouter.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date February 2012 -/// @version $Id: CHRouter.h 21201 2016-07-19 11:57:22Z behrisch $ +/// @version $Id: CHRouter.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Shortest Path search using a Contraction Hierarchy /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,15 +43,10 @@ #include #include #include -#include "SPTree.h" +#include "CHBuilder.h" //#define CHRouter_DEBUG_QUERY //#define CHRouter_DEBUG_QUERY_PERF -//#define CHRouter_DEBUG_CONTRACTION -//#define CHRouter_DEBUG_CONTRACTION_WITNESSES -//#define CHRouter_DEBUG_CONTRACTION_QUEUE -//#define CHRouter_DEBUG_CONTRACTION_DEGREE -//#define CHRouter_DEBUG_WEIGHTS // =========================================================================== // class definitions @@ -74,30 +69,8 @@ class CHRouter: public SUMOAbstractRouter, public PF { public: - class EdgeInfo; - /// Type of the function that is used to retrieve the edge effort. - typedef SUMOReal(* Operation)(const E* const, const V* const, SUMOReal); - - /// A meeting point of the two search scopes - typedef std::pair Meeting; - - /// A set of (found) Edges - typedef std::set EdgeSet; - - /// The found route (used as output parameter) - typedef std::vector Result; - - /// @brief Forward/backward connection with associated forward/backward cost - // forward connections are used only in forward search - // backward connections are used only in backwards search - class Connection { - public: - Connection(EdgeInfo* t, SUMOReal c, SVCPermissions p): target(t), cost(c), permissions(p) {} - EdgeInfo* target; - SUMOReal cost; - SVCPermissions permissions; - }; + typedef double(* Operation)(const E* const, const V* const, double); /** * @struct EdgeInfo @@ -109,7 +82,7 @@ /// Constructor EdgeInfo(const E* e) : edge(e), - traveltime(std::numeric_limits::max()), + traveltime(std::numeric_limits::max()), prev(0), visited(false) { } @@ -118,7 +91,7 @@ const E* edge; /// Effort to reach the edge - SUMOReal traveltime; + double traveltime; /// The previous edge EdgeInfo* prev; @@ -126,19 +99,16 @@ /// Whether the shortest path to this edge is already found bool visited; - /// Connections to higher ranked nodes - std::vector upward; - - /// the contraction rank (higher means more important) - int rank; - inline void reset() { - traveltime = std::numeric_limits::max(); + traveltime = std::numeric_limits::max(); visited = false; } }; + /// A meeting point of the two search scopes + typedef std::pair Meeting; + /** * @class Unidirectional * class for searching in one direction @@ -189,7 +159,7 @@ (*i)->reset(); } myFrontier.clear(); - for (typename EdgeSet::iterator i = myFound.begin(); i != myFound.end(); i++) { + for (typename std::set::const_iterator i = myFound.begin(); i != myFound.end(); i++) { getEdgeInfo(*i)->reset(); } myFound.clear(); @@ -201,11 +171,12 @@ } + typedef std::vector::Connection> ConnectionVector; /** @brief explore on element from the frontier,update minTTSeen and meeting * if an EdgeInfo found by the otherSearch is encountered * returns whether stepping should continue */ - bool step(const Unidirectional& otherSearch, SUMOReal& minTTSeen, Meeting& meeting) { + bool step(const std::vector& uplinks, const Unidirectional& otherSearch, double& minTTSeen, Meeting& meeting) { // pop the node with the minimal length EdgeInfo* const minimumInfo = myFrontier.front(); pop_heap(myFrontier.begin(), myFrontier.end(), myComparator); @@ -221,7 +192,7 @@ #endif if (otherSearch.found(minEdge)) { const EdgeInfo* const otherInfo = otherSearch.getEdgeInfo(minEdge); - const SUMOReal ttSeen = minimumInfo->traveltime + otherInfo->traveltime; + const double ttSeen = minimumInfo->traveltime + otherInfo->traveltime; #ifdef CHRouter_DEBUG_QUERY std::cout << "DEBUG: " << (myAmForward ? "Forward" : "Backward") << "-Search hit other search at '" << minEdge->getID() << "', tt: " << ttSeen << " \n"; #endif @@ -240,19 +211,20 @@ minimumInfo->visited = true; // XXX we only need to keep found elements if they have a higher rank than the lowest rank in the other search queue myFound.insert(minimumInfo->edge); - for (typename std::vector::iterator it = minimumInfo->upward.begin(); it != minimumInfo->upward.end(); it++) { - EdgeInfo* upwardInfo = it->target; - const SUMOReal traveltime = minimumInfo->traveltime + it->cost; + const ConnectionVector& upward = uplinks[minEdge->getNumericalID()]; + for (typename ConnectionVector::const_iterator it = upward.begin(); it != upward.end(); it++) { + EdgeInfo* upwardInfo = &myEdgeInfos[it->target]; + const double traveltime = minimumInfo->traveltime + it->cost; const SUMOVehicleClass svc = myVehicle->getVClass(); // check whether it can be used if ((it->permissions & svc) != svc) { continue; } - const SUMOReal oldTraveltime = upwardInfo->traveltime; + const double oldTraveltime = upwardInfo->traveltime; if (!upwardInfo->visited && traveltime < oldTraveltime) { upwardInfo->traveltime = traveltime; upwardInfo->prev = minimumInfo; - if (oldTraveltime == std::numeric_limits::max()) { + if (oldTraveltime == std::numeric_limits::max()) { myFrontier.push_back(upwardInfo); push_heap(myFrontier.begin(), myFrontier.end(), myComparator); } else { @@ -270,21 +242,13 @@ return !myFrontier.empty() && myFrontier.front()->traveltime < minTTSeen; } - - // reset state before rebuilding the contraction hierarchy - void reset() { - for (typename std::vector::iterator it = myEdgeInfos.begin(); it != myEdgeInfos.end(); ++it) { - it->upward.clear(); - } - } - private: /// @brief the role of this search bool myAmForward; /// @brief the min edge heap std::vector myFrontier; /// @brief the set of visited (settled) Edges - EdgeSet myFound; + std::set myFound; /// @brief The container of edge information std::vector myEdgeInfos; @@ -294,29 +258,10 @@ }; - class CHInfo; - - /// @brief Forward/backward connection with associated FORWARD cost - class CHConnection { - public: - CHConnection(CHInfo* t, SUMOReal c, SVCPermissions p, int u): - target(t), cost(c), permissions(p), underlying(u) {} - CHInfo* target; - SUMOReal cost; - SVCPermissions permissions; - /// the number of connections underlying this connection - int underlying; - }; - - typedef std::vector CHConnections; - typedef std::pair CHConnectionPair; - typedef std::vector CHConnectionPairs; - /** @brief Constructor * @param[in] validatePermissions Whether a multi-permission hierarchy shall be built * If set to false, the net is pruned in synchronize() and the - * hierarchy is tailored to the vClass of the defaultVehicle - * @note: defaultVehicle is not transient and must be kept after constructor finishes + * hierarchy is tailored to the svc */ CHRouter(const std::vector& edges, bool unbuildIsWarning, Operation operation, const SUMOVehicleClass svc, @@ -327,25 +272,46 @@ myErrorMsgHandler(unbuildIsWarning ? MsgHandler::getWarningInstance() : MsgHandler::getErrorInstance()), myForwardSearch(edges, true), myBackwardSearch(edges, false), - mySPTree(new SPTree(4, validatePermissions)), + myHierarchyBuilder(new CHBuilder(edges, unbuildIsWarning, svc, validatePermissions)), + myHierarchy(0), myWeightPeriod(weightPeriod), myValidUntil(0), - mySVC(svc), - myUpdateCount(0) { - for (typename std::vector::const_iterator i = edges.begin(); i != edges.end(); ++i) { - myCHInfos.push_back(CHInfo(*i)); - } + mySVC(svc) { + } + + /** @brief Cloning constructor + */ + CHRouter(const std::vector& edges, bool unbuildIsWarning, Operation operation, + const SUMOVehicleClass svc, + SUMOTime weightPeriod, + const typename CHBuilder::Hierarchy* hierarchy) : + SUMOAbstractRouter(operation, "CHRouter"), + myEdges(edges), + myErrorMsgHandler(unbuildIsWarning ? MsgHandler::getWarningInstance() : MsgHandler::getErrorInstance()), + myForwardSearch(edges, true), + myBackwardSearch(edges, false), + myHierarchyBuilder(0), + myHierarchy(hierarchy), + myWeightPeriod(weightPeriod), + myValidUntil(0), + mySVC(svc) { } /// Destructor virtual ~CHRouter() { - delete mySPTree; + if (myHierarchyBuilder != 0) { + delete myHierarchy; + delete myHierarchyBuilder; + } } virtual SUMOAbstractRouter* clone() { - return new CHRouter(myEdges, myErrorMsgHandler == MsgHandler::getWarningInstance(), this->myOperation, - mySVC, myWeightPeriod, mySPTree->validatePermissions()); + WRITE_MESSAGE("Cloning Contraction Hierarchy for " + SumoVehicleClassStrings.getString(mySVC) + " and time " + time2string(myValidUntil) + "."); + CHRouter* clone = new CHRouter(myEdges, myErrorMsgHandler == MsgHandler::getWarningInstance(), this->myOperation, + mySVC, myWeightPeriod, myHierarchy); + clone->myValidUntil = myValidUntil; + return clone; } /** @brief Builds the route between the given edges using the minimum traveltime in the contracted graph @@ -353,9 +319,9 @@ * the computed routes only approximated shortest paths in the real graph * */ virtual bool compute(const E* from, const E* to, const V* const vehicle, - SUMOTime msTime, Result& into) { + SUMOTime msTime, std::vector& into) { assert(from != 0 && to != 0); - assert(mySPTree->validatePermissions() || vehicle->getVClass() == mySVC || mySVC == SVC_IGNORING); + // assert(myHierarchyBuilder.mySPTree->validatePermissions() || vehicle->getVClass() == mySVC || mySVC == SVC_IGNORING); // do we need to rebuild the hierarchy? if (msTime >= myValidUntil) { while (msTime >= myValidUntil) { @@ -367,7 +333,7 @@ this->startQuery(); myForwardSearch.init(from, vehicle); myBackwardSearch.init(to, vehicle); - SUMOReal minTTSeen = std::numeric_limits::max(); + double minTTSeen = std::numeric_limits::max(); Meeting meeting(static_cast(0), static_cast(0)); bool continueForward = true; bool continueBackward = true; @@ -376,15 +342,15 @@ bool result = true; while (continueForward || continueBackward) { if (continueForward) { - continueForward = myForwardSearch.step(myBackwardSearch, minTTSeen, meeting); + continueForward = myForwardSearch.step(myHierarchy->forwardUplinks, myBackwardSearch, minTTSeen, meeting); num_visited_fw += 1; } if (continueBackward) { - continueBackward = myBackwardSearch.step(myForwardSearch, minTTSeen, meeting); + continueBackward = myBackwardSearch.step(myHierarchy->backwardUplinks, myForwardSearch, minTTSeen, meeting); num_visited_bw += 1; } } - if (minTTSeen < std::numeric_limits::max()) { + if (minTTSeen < std::numeric_limits::max()) { buildPathFromMeeting(meeting, into); } else { myErrorMsgHandler->inform("No connection between edge '" + from->getID() + "' and edge '" + to->getID() + "' found."); @@ -398,9 +364,9 @@ } - SUMOReal recomputeCosts(const std::vector& edges, const V* const v, SUMOTime msTime) const { - const SUMOReal time = STEPS2TIME(msTime); - SUMOReal costs = 0; + double recomputeCosts(const std::vector& edges, const V* const v, SUMOTime msTime) const { + const double time = STEPS2TIME(msTime); + double costs = 0; for (typename std::vector::const_iterator i = edges.begin(); i != edges.end(); ++i) { if (PF::operator()(*i, v)) { return -1; @@ -413,7 +379,7 @@ /// normal routing methods /// Builds the path from marked edges - void buildPathFromMeeting(Meeting meeting, Result& into) { + void buildPathFromMeeting(Meeting meeting, std::vector& into) const { std::deque tmp; const EdgeInfo* backtrack = meeting.first; while (backtrack != 0) { @@ -446,359 +412,25 @@ } } - /// contraction related members - typedef std::pair ConstEdgePair; - typedef std::pair EdgePair; - - struct Shortcut { - Shortcut(EdgePair e, SUMOReal c, int u, SVCPermissions p): - edgePair(e), cost(c), underlying(u), permissions(p) {} - EdgePair edgePair; - SUMOReal cost; - int underlying; - SVCPermissions permissions; - }; - - typedef std::vector Shortcuts; - typedef std::map ShortcutVia; - - /* @brief container class to use when building the contraction hierarchy. - * instances are reused every time the hierarchy is rebuilt (new time slice) - * but they must be synchronized first */ - class CHInfo { - public: - /// @brief Constructor - CHInfo(E* e) : - edge(e), - contractedNeighbors(0), - rank(-1), - level(0), - underlyingTotal(0), - visited(false), - traveltime(std::numeric_limits::max()) { - } - - /// @brief recompute the contraction priority and report whether it changed - bool updatePriority(SPTree* spTree) { - if (spTree != 0) { - updateShortcuts(spTree); - updateLevel(); - } else { - contractedNeighbors += 1; // called when a connected edge was contracted - } - const SUMOReal oldPriority = priority; - // priority term as used by abraham [] - const int edge_difference = (int)followers.size() + (int)approaching.size() - 2 * (int)shortcuts.size(); - priority = (SUMOReal)(2 * edge_difference - contractedNeighbors - underlyingTotal - 5 * level); - return priority != oldPriority; - } - - /// compute needed shortcuts when contracting this edge - void updateShortcuts(SPTree* spTree) { - const bool validatePermissions = spTree->validatePermissions(); -#ifdef CHRouter_DEBUG_CONTRACTION_DEGREE - const int degree = approaching.size() + followers.size(); - std::cout << "computing shortcuts for '" + edge->getID() + "' with degree " + toString(degree) + "\n"; -#endif - shortcuts.clear(); - underlyingTotal = 0; - for (typename CHConnections::iterator it_a = approaching.begin(); it_a != approaching.end(); it_a++) { - CHConnection& aInfo = *it_a; - // build shortest path tree in a fixed neighborhood - spTree->rebuildFrom(aInfo.target, this); - for (typename CHConnections::iterator it_f = followers.begin(); it_f != followers.end(); it_f++) { - CHConnection& fInfo = *it_f; - const SUMOReal viaCost = aInfo.cost + fInfo.cost; - const SVCPermissions viaPermissions = (aInfo.permissions & fInfo.permissions); - if (fInfo.target->traveltime > viaCost) { - // found no faster path -> we need a shortcut via edge -#ifdef CHRouter_DEBUG_CONTRACTION_WITNESSES - debugNoWitness(aInfo, fInfo); -#endif - const int underlying = aInfo.underlying + fInfo.underlying; - underlyingTotal += underlying; - shortcuts.push_back(Shortcut(EdgePair(aInfo.target->edge, fInfo.target->edge), - viaCost, underlying, viaPermissions)); - - } else if (validatePermissions) { - if ((fInfo.target->permissions & viaPermissions) != viaPermissions) { - // witness has weaker restrictions. try to find another witness - spTree->registerForValidation(&aInfo, &fInfo); - } else { -#ifdef CHRouter_DEBUG_CONTRACTION_WITNESSES - debugNoWitness(aInfo, fInfo); -#endif - } - } else { -#ifdef CHRouter_DEBUG_CONTRACTION_WITNESSES - debugNoWitness(aInfo, fInfo); -#endif - } - } - } - // insert shortcuts needed due to unmet permissions - if (validatePermissions) { - const CHConnectionPairs& pairs = spTree->getNeededShortcuts(this); - for (typename CHConnectionPairs::const_iterator it = pairs.begin(); it != pairs.end(); ++it) { - const CHConnection* aInfo = it->first; - const CHConnection* fInfo = it->second; - const SUMOReal viaCost = aInfo->cost + fInfo->cost; - const SVCPermissions viaPermissions = (aInfo->permissions & fInfo->permissions); - const int underlying = aInfo->underlying + fInfo->underlying; - underlyingTotal += underlying; - shortcuts.push_back(Shortcut(EdgePair(aInfo->target->edge, fInfo->target->edge), - viaCost, underlying, viaPermissions)); - } - } - } - - - // update level as defined by Abraham - void updateLevel() { - int maxLower = std::numeric_limits::min(); - int otherRank; - for (typename CHConnections::iterator it = approaching.begin(); it != approaching.end(); it++) { - otherRank = it->target->rank; - if (otherRank < rank) { - maxLower = MAX2(rank, maxLower); - } - } - for (typename CHConnections::iterator it = followers.begin(); it != followers.end(); it++) { - otherRank = it->target->rank; - if (otherRank < rank) { - maxLower = MAX2(rank, maxLower); - } - } - if (maxLower == std::numeric_limits::min()) { - level = 0; - } else { - level = maxLower + 1; - } - } - - // resets state before rebuilding the hierarchy - void resetContractionState() { - contractedNeighbors = 0; - rank = -1; - level = 0; - underlyingTotal = 0; - shortcuts.clear(); - followers.clear(); - approaching.clear(); - } - - - /// @brief The current edge - not const since it may receive shortcut edges - E* edge; - /// @brief The contraction priority - SUMOReal priority; - /// @brief The needed shortcuts - Shortcuts shortcuts; - /// @brief priority subterms - int contractedNeighbors; - int rank; - int level; - int underlyingTotal; - - /// @brief connections (only valid after synchronization) - CHConnections followers; - CHConnections approaching; - - - /// members used in SPTree - bool visited; - /// Effort to reach the edge - SUMOReal traveltime; - /// number of edges from start - int depth; - /// the permissions when reaching this edge on the fastest path - // @note: we may miss some witness paths by making traveltime the only - // criteria durinng search - SVCPermissions permissions; - - inline void reset() { - traveltime = std::numeric_limits::max(); - visited = false; - } - - - /// debugging methods - inline void debugNoWitness(const CHConnection& aInfo, const CHConnection& fInfo) { - std::cout << "adding shortcut between " << aInfo.target->edge->getID() << ", " << fInfo.target->edge->getID() << " via " << edge->getID() << "\n"; - } - - inline void debugWitness(const CHConnection& aInfo, const CHConnection& fInfo) { - const SUMOReal viaCost = aInfo.cost + fInfo.cost; - std::cout << "found witness with lenght " << fInfo.target->traveltime << " against via " << edge->getID() << " (length " << viaCost << ") for " << aInfo.target->edge->getID() << ", " << fInfo.target->edge->getID() << "\n"; - } - - }; - -private: - - /** - * @class EdgeInfoByRankComparator - * Class to compare (and so sort) nodes by their contraction priority - */ - class CHInfoComparator { - public: - /// Comparing method - bool operator()(const CHInfo* a, const CHInfo* b) const { - if (a->priority == b->priority) { - return a->edge->getNumericalID() > b->edge->getNumericalID(); - } else { - return a->priority < b->priority; - }; - } - }; - - - inline CHInfo* getCHInfo(const E* const edge) { - return &(myCHInfos[edge->getNumericalID()]); - } - - - /// @brief copy connections from the original net (modified destructively during contraction) - void synchronize(CHInfo& info, SUMOReal time, const V* const vehicle) { - // forward and backward connections are used only in forward search, - // thus approaching costs are those of the approaching edge and not of the edge itself - const bool prune = !mySPTree->validatePermissions(); - const E* const edge = info.edge; - if (prune && ((edge->getPermissions() & mySVC) != mySVC)) { - return; - } - const SUMOReal cost = this->getEffort(edge, vehicle, time); - - const std::vector& successors = edge->getSuccessors(mySVC); - for (typename std::vector::const_iterator it = successors.begin(); it != successors.end(); ++it) { - const E* fEdge = *it; - if (prune && ((fEdge->getPermissions() & mySVC) != mySVC)) { - continue; - } - CHInfo* follower = getCHInfo(fEdge); - SVCPermissions permissions = (edge->getPermissions() & follower->edge->getPermissions()); - info.followers.push_back(CHConnection(follower, cost, permissions, 1)); - follower->approaching.push_back(CHConnection(&info, cost, permissions, 1)); - } -#ifdef CHRouter_DEBUG_WEIGHTS - std::cout << time << ": " << edge->getID() << " cost: " << cost << "\n"; -#endif - // @todo: check whether we even need to save approaching in ROEdge; - } - - - /// @brief remove all connections to/from the given edge (assume it exists only once) - void disconnect(CHConnections& connections, CHInfo* other) { - for (typename CHConnections::iterator it = connections.begin(); it != connections.end(); it++) { - if (it->target == other) { - connections.erase(it); - return; - } - } - assert(false); - } - - void buildContractionHierarchy(SUMOTime time, const V* const vehicle) { - const int numEdges = (int)myCHInfos.size(); - const std::string vClass = (mySPTree->validatePermissions() ? - "all vehicle classes " : "vClass='" + SumoVehicleClassStrings.getString(mySVC) + "' "); - PROGRESS_BEGIN_MESSAGE("Building Contraction Hierarchy for " + vClass - + "and time=" + time2string(time) + " (" + toString(numEdges) + " edges)\n"); - const long startMillis = SysUtils::getCurrentMillis(); - // init queue - std::vector queue; // max heap: edge to be contracted is front - myShortcuts.clear(); - // reset previous connections etc - myForwardSearch.reset(); - myBackwardSearch.reset(); - for (int i = 0; i < numEdges; i++) { - myCHInfos[i].resetContractionState(); - } - // copy connections from the original net - const SUMOReal time_seconds = STEPS2TIME(time); // timelines store seconds! - for (int i = 0; i < numEdges; i++) { - synchronize(myCHInfos[i], time_seconds, vehicle); - } - // synchronization is finished. now we can compute priorities for the first time - for (int i = 0; i < numEdges; i++) { - myCHInfos[i].updatePriority(mySPTree); - queue.push_back(&(myCHInfos[i])); - } - make_heap(queue.begin(), queue.end(), myCmp); - int contractionRank = 0; - // contraction loop - while (!queue.empty()) { - while (tryUpdateFront(queue)) {} - CHInfo* max = queue.front(); - max->rank = contractionRank; -#ifdef CHRouter_DEBUG_CONTRACTION - std::cout << "contracting '" << max->edge->getID() << "' with prio: " << max->priority << " (rank " << contractionRank << ")\n"; -#endif - E* edge = max->edge; - // add outgoing connections to the forward search - EdgeInfo* edgeInfoFW = myForwardSearch.getEdgeInfo(edge); - edgeInfoFW->rank = contractionRank; - for (typename CHConnections::iterator it = max->followers.begin(); it != max->followers.end(); it++) { - CHConnection& con = *it; - EdgeInfo* followerInfoFW = myForwardSearch.getEdgeInfo(con.target->edge); - edgeInfoFW->upward.push_back(Connection(followerInfoFW, con.cost, con.permissions)); - disconnect(con.target->approaching, max); - con.target->updatePriority(0); - } - // add incoming connections to the backward search - EdgeInfo* edgeInfoBW = myBackwardSearch.getEdgeInfo(edge); - edgeInfoBW->rank = contractionRank; - for (typename CHConnections::iterator it = max->approaching.begin(); it != max->approaching.end(); it++) { - CHConnection& con = *it; - EdgeInfo* approachingInfoBW = myBackwardSearch.getEdgeInfo(con.target->edge); - edgeInfoBW->upward.push_back(Connection(approachingInfoBW, con.cost, con.permissions)); - disconnect(con.target->followers, max); - con.target->updatePriority(0); - } - // add shortcuts to the net - for (typename Shortcuts::iterator it = max->shortcuts.begin(); it != max->shortcuts.end(); it++) { - EdgePair& edgePair = it->edgePair; - myShortcuts[edgePair] = edge; - CHInfo* from = getCHInfo(edgePair.first); - CHInfo* to = getCHInfo(edgePair.second); - from->followers.push_back(CHConnection(to, it->cost, it->permissions, it->underlying)); - to->approaching.push_back(CHConnection(from, it->cost, it->permissions, it->underlying)); - } - // remove from queue - pop_heap(queue.begin(), queue.end(), myCmp); - queue.pop_back(); - /* - if (contractionRank % 10000 == 0) { - // update all and rebuild queue - for (typename std::vector::iterator it = queue.begin(); it != queue.end(); ++it) { - (*it)->updatePriority(mySPTree); - } - make_heap(queue.begin(), queue.end(), myCmp); - } - */ - contractionRank++; + if (myHierarchyBuilder != 0) { + delete myHierarchy; + myHierarchy = myHierarchyBuilder->buildContractionHierarchy(time, vehicle, this); } - // reporting - const long duration = SysUtils::getCurrentMillis() - startMillis; - WRITE_MESSAGE("Created " + toString(myShortcuts.size()) + " shortcuts."); - WRITE_MESSAGE("Recomputed priority " + toString(myUpdateCount) + " times."); - MsgHandler::getMessageInstance()->endProcessMsg("done (" + toString(duration) + "ms)."); - PROGRESS_DONE_MESSAGE(); // declare new validUntil (prevent overflow) if (myWeightPeriod < std::numeric_limits::max()) { myValidUntil = time + myWeightPeriod; } else { myValidUntil = myWeightPeriod; } - myUpdateCount = 0; } +private: // retrieve the via edge for a shortcut - const E* getVia(const E* forwardFrom, const E* forwardTo) { - ConstEdgePair forward(forwardFrom, forwardTo); - typename ShortcutVia::iterator it = myShortcuts.find(forward); - if (it != myShortcuts.end()) { + const E* getVia(const E* forwardFrom, const E* forwardTo) const { + typename CHBuilder::ConstEdgePair forward(forwardFrom, forwardTo); + typename CHBuilder::ShortcutVia::const_iterator it = myHierarchy->shortcuts.find(forward); + if (it != myHierarchy->shortcuts.end()) { return it->second; } else { return 0; @@ -806,34 +438,6 @@ } - /** @brief tries to update the priority of the first edge - * @return wether updating changed the first edge - */ - bool tryUpdateFront(std::vector& queue) { - myUpdateCount++; - CHInfo* max = queue.front(); -#ifdef CHRouter_DEBUG_CONTRACTION_QUEUE - std::cout << "updating '" << max->edge->getID() << "'\n"; - debugPrintQueue(queue); -#endif - if (max->updatePriority(mySPTree)) { - pop_heap(queue.begin(), queue.end(), myCmp); - push_heap(queue.begin(), queue.end(), myCmp); - return true; - } else { - return false; - } - } - - // helper method for debugging - void debugPrintQueue(std::vector& queue) { - for (typename std::vector::iterator it = queue.begin(); it != queue.end(); it++) { - CHInfo* chInfo = *it; - std::cout << "(" << chInfo->edge->getID() << "," << chInfo->priority << ") "; - } - std::cout << "\n"; - } - private: /// @brief all edges with numerical ids const std::vector& myEdges; @@ -845,17 +449,8 @@ Unidirectional myForwardSearch; Unidirectional myBackwardSearch; - /// @brief map from (forward) shortcut to via-Edge - ShortcutVia myShortcuts; - - /// @brief static vector for lookup - std::vector myCHInfos; - - /// @brief Comparator for contraction priority - CHInfoComparator myCmp; - - /// @brief the shortest path tree to use when searching for shortcuts - SPTree* mySPTree; + CHBuilder* myHierarchyBuilder; + const typename CHBuilder::Hierarchy* myHierarchy; /// @brief the validity duration of one weight interval const SUMOTime myWeightPeriod; @@ -864,10 +459,7 @@ SUMOTime myValidUntil; /// @brief the permissions for which the hierarchy was constructed - SUMOVehicleClass mySVC; - - /// @brief counters for performance logging - int myUpdateCount; + const SUMOVehicleClass mySVC; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/CHRouterWrapper.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/CHRouterWrapper.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/CHRouterWrapper.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/CHRouterWrapper.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date March 2012 -/// @version $Id: CHRouterWrapper.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: CHRouterWrapper.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Wraps multiple CHRouters for different vehicle types /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -46,6 +46,10 @@ #include #include "CHRouter.h" +#ifdef HAVE_FOX +#include +#endif + // =========================================================================== // class definitions @@ -69,46 +73,86 @@ public: /// Type of the function that is used to retrieve the edge effort. - typedef SUMOReal(* Operation)(const E* const, const V* const, SUMOReal); + typedef double(* Operation)(const E* const, const V* const, double); /** @brief Constructor */ - CHRouterWrapper(const std::vector& edges, bool ignoreErrors, Operation operation, SUMOTime begin, SUMOTime weightPeriod): + CHRouterWrapper(const std::vector& edges, const bool ignoreErrors, Operation operation, + const SUMOTime begin, const SUMOTime end, const SUMOTime weightPeriod, const int numThreads) : SUMOAbstractRouter(operation, "CHRouterWrapper"), myEdges(edges), myIgnoreErrors(ignoreErrors), myBegin(begin), - myWeightPeriod(weightPeriod) { + myEnd(end), + myWeightPeriod(weightPeriod), + myMaxNumInstances(numThreads) { } ~CHRouterWrapper() { for (typename RouterMap::iterator i = myRouters.begin(); i != myRouters.end(); ++i) { - delete(*i).second; + for (typename std::vector::iterator j = i->second.begin(); j != i->second.end(); ++j) { + delete *j; + } } } virtual SUMOAbstractRouter* clone() { - return new CHRouterWrapper(myEdges, myIgnoreErrors, this->myOperation, myBegin, myWeightPeriod); + CHRouterWrapper* clone = new CHRouterWrapper(myEdges, myIgnoreErrors, this->myOperation, myBegin, myEnd, myWeightPeriod, myMaxNumInstances); + for (typename RouterMap::iterator i = myRouters.begin(); i != myRouters.end(); ++i) { + for (typename std::vector::iterator j = i->second.begin(); j != i->second.end(); ++j) { + clone->myRouters[i->first].push_back(static_cast((*j)->clone())); + } + } + return clone; } + bool compute(const E* from, const E* to, const V* const vehicle, SUMOTime msTime, std::vector& into) { - const std::pair svc = std::make_pair(vehicle->getVClass(), vehicle->getMaxSpeed()); + const std::pair svc = std::make_pair(vehicle->getVClass(), vehicle->getMaxSpeed()); + int index = 0; + int numIntervals = 1; +#ifdef HAVE_FOX + if (myMaxNumInstances >= 2 && myEnd < std::numeric_limits::max()) { + index = (int)((msTime - myBegin) / myWeightPeriod); + numIntervals = (int)((myEnd - myBegin) / myWeightPeriod); + if (numIntervals > 0) { + while ((int)myThreadPool.size() < myMaxNumInstances) { + new FXWorkerThread(myThreadPool); + } + } else { + // this covers the cases of negative (unset) end time and unset weight period (no weight file) + numIntervals = 1; + } + } +#endif if (myRouters.count(svc) == 0) { // create new router for the given permissions and maximum speed // XXX a new router may also be needed if vehicles differ in speed factor - myRouters[svc] = new CHRouterType( - myEdges, myIgnoreErrors, &E::getTravelTimeStatic, svc.first, myWeightPeriod, false); + for (int i = 0; i < numIntervals; i++) { + myRouters[svc].push_back(new CHRouterType( + myEdges, myIgnoreErrors, &E::getTravelTimeStatic, svc.first, myWeightPeriod, false)); +#ifdef HAVE_FOX + if (myThreadPool.size() > 0) { + myThreadPool.add(new ComputeHierarchyTask(myRouters[svc].back(), vehicle, myBegin + i * myWeightPeriod)); + } +#endif + } +#ifdef HAVE_FOX + if (myThreadPool.size() > 0) { + myThreadPool.waitAll(); + } +#endif } - return myRouters[svc]->compute(from, to, vehicle, msTime, into); + return myRouters[svc][index]->compute(from, to, vehicle, msTime, into); } - SUMOReal recomputeCosts(const std::vector& edges, - const V* const v, SUMOTime msTime) const { - const SUMOReal time = STEPS2TIME(msTime); - SUMOReal costs = 0; + double recomputeCosts(const std::vector& edges, + const V* const v, SUMOTime msTime) const { + const double time = STEPS2TIME(msTime); + double costs = 0; for (typename std::vector::const_iterator i = edges.begin(); i != edges.end(); ++i) { if (PF::operator()(*i, v)) { WRITE_WARNING("Vehicle '" + v->getID() + "' is restricted from using its assigned route."); @@ -122,17 +166,45 @@ private: typedef CHRouter > CHRouterType; - typedef std::map, CHRouterType*> RouterMap; + +#ifdef HAVE_FOX +private: + class ComputeHierarchyTask : public FXWorkerThread::Task { + public: + ComputeHierarchyTask(CHRouterType* router, const V* const vehicle, const SUMOTime msTime) + : myRouter(router), myVehicle(vehicle), myStartTime(msTime) {} + void run(FXWorkerThread* /* context */) { + myRouter->buildContractionHierarchy(myStartTime, myVehicle); + } + private: + CHRouterType* myRouter; + const V* const myVehicle; + const SUMOTime myStartTime; + private: + /// @brief Invalidated assignment operator. + ComputeHierarchyTask& operator=(const ComputeHierarchyTask&); + }; + + +private: + /// @brief for multi threaded routing + FXWorkerThread::Pool myThreadPool; +#endif + +private: + typedef std::map, std::vector > RouterMap; RouterMap myRouters; /// @brief all edges with numerical ids const std::vector& myEdges; - bool myIgnoreErrors; + const bool myIgnoreErrors; - SUMOTime myBegin; - SUMOTime myWeightPeriod; + const SUMOTime myBegin; + const SUMOTime myEnd; + const SUMOTime myWeightPeriod; + const int myMaxNumInstances; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/DijkstraRouterEffort.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/DijkstraRouterEffort.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/DijkstraRouterEffort.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/DijkstraRouterEffort.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 25 July 2005 -/// @version $Id: DijkstraRouterEffort.h 21808 2016-10-26 13:13:07Z behrisch $ +/// @version $Id: DijkstraRouterEffort.h 23581 2017-03-21 13:22:47Z behrisch $ /// // Dijkstra shortest path algorithm using other values /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -66,7 +66,7 @@ class DijkstraRouterEffort : public SUMOAbstractRouter, public PF { public: - typedef SUMOReal(* Operation)(const E* const, const V* const, SUMOReal); + typedef double(* Operation)(const E* const, const V* const, double); /** * @struct EdgeInfo @@ -77,16 +77,16 @@ public: /// Constructor EdgeInfo(const E* e) - : edge(e), effort(std::numeric_limits::max()), leaveTime(0), prev(0), visited(false) {} + : edge(e), effort(std::numeric_limits::max()), leaveTime(0), prev(0), visited(false) {} /// The current edge const E* edge; /// Effort to reach the edge - SUMOReal effort; + double effort; /// The time the vehicle leaves the edge - SUMOReal leaveTime; + double leaveTime; /// The previous edge EdgeInfo* prev; @@ -95,7 +95,7 @@ bool visited; inline void reset() { - effort = std::numeric_limits::max(); + effort = std::numeric_limits::max(); visited = false; } }; @@ -129,7 +129,7 @@ SUMOAbstractRouter(effortOperation, "DijkstraRouterEffort"), myTTOperation(ttOperation), myErrorMsgHandler(unbuildIsWarning ? MsgHandler::getWarningInstance() : MsgHandler::getErrorInstance()) { for (typename std::vector::const_iterator i = edgeInfos.begin(); i != edgeInfos.end(); ++i) { - myEdgeInfos.push_back(*i); + myEdgeInfos.push_back(EdgeInfo(i->edge)); } } @@ -140,7 +140,7 @@ return new DijkstraRouterEffort(myEdgeInfos, myErrorMsgHandler == MsgHandler::getWarningInstance(), this->myOperation, myTTOperation); } - inline SUMOReal getTravelTime(const E* const e, const V* const v, SUMOReal t) const { + inline double getTravelTime(const E* const e, const V* const v, double t) const { return (*myTTOperation)(e, v, t); } @@ -206,8 +206,8 @@ return true; } minimumInfo->visited = true; - const SUMOReal effort = minimumInfo->effort + this->getEffort(minEdge, vehicle, minimumInfo->leaveTime); - const SUMOReal leaveTime = minimumInfo->leaveTime + getTravelTime(minEdge, vehicle, minimumInfo->leaveTime); + const double effort = minimumInfo->effort + this->getEffort(minEdge, vehicle, minimumInfo->leaveTime); + const double leaveTime = minimumInfo->leaveTime + getTravelTime(minEdge, vehicle, minimumInfo->leaveTime); // check all ways from the node with the minimal length const std::vector& successors = minEdge->getSuccessors(vClass); for (typename std::vector::const_iterator it = successors.begin(); it != successors.end(); ++it) { @@ -217,12 +217,12 @@ if (PF::operator()(follower, vehicle)) { continue; } - const SUMOReal oldEffort = followerInfo->effort; + const double oldEffort = followerInfo->effort; if (!followerInfo->visited && effort < oldEffort) { followerInfo->effort = effort; followerInfo->leaveTime = leaveTime; followerInfo->prev = minimumInfo; - if (oldEffort == std::numeric_limits::max()) { + if (oldEffort == std::numeric_limits::max()) { myFrontierList.push_back(followerInfo); push_heap(myFrontierList.begin(), myFrontierList.end(), myComparator); } else { @@ -239,9 +239,9 @@ } - SUMOReal recomputeCosts(const std::vector& edges, const V* const v, SUMOTime msTime) const { - SUMOReal costs = 0; - SUMOReal t = STEPS2TIME(msTime); + double recomputeCosts(const std::vector& edges, const V* const v, SUMOTime msTime) const { + double costs = 0; + double t = STEPS2TIME(msTime); for (typename std::vector::const_iterator i = edges.begin(); i != edges.end(); ++i) { if (PF::operator()(*i, v)) { return -1; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/DijkstraRouterTT.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/DijkstraRouterTT.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/DijkstraRouterTT.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/DijkstraRouterTT.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 25 July 2005 -/// @version $Id: DijkstraRouterTT.h 21808 2016-10-26 13:13:07Z behrisch $ +/// @version $Id: DijkstraRouterTT.h 23581 2017-03-21 13:22:47Z behrisch $ /// // Dijkstra shortest path algorithm using travel time /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -71,7 +71,7 @@ class DijkstraRouterTT : public SUMOAbstractRouter, public PF { public: - typedef SUMOReal(* Operation)(const E* const, const V* const, SUMOReal); + typedef double(* Operation)(const E* const, const V* const, double); /** * @struct EdgeInfo @@ -82,13 +82,13 @@ public: /// Constructor EdgeInfo(const E* e) - : edge(e), traveltime(std::numeric_limits::max()), prev(0), visited(false) {} + : edge(e), traveltime(std::numeric_limits::max()), prev(0), visited(false) {} /// The current edge const E* edge; /// Effort to reach the edge - SUMOReal traveltime; + double traveltime; /// The previous edge EdgeInfo* prev; @@ -97,7 +97,7 @@ bool visited; inline void reset() { - traveltime = std::numeric_limits::max(); + traveltime = std::numeric_limits::max(); visited = false; } }; @@ -130,7 +130,7 @@ SUMOAbstractRouter(operation, "DijkstraRouterTT"), myErrorMsgHandler(unbuildIsWarning ? MsgHandler::getWarningInstance() : MsgHandler::getErrorInstance()) { for (typename std::vector::const_iterator i = edgeInfos.begin(); i != edgeInfos.end(); ++i) { - myEdgeInfos.push_back(*i); + myEdgeInfos.push_back(EdgeInfo(i->edge)); } } @@ -169,8 +169,11 @@ return false; } this->startQuery(); +#ifdef DijkstraRouterTT_DEBUG_QUERY + std::cout << "DEBUG: starting search for '" << vehicle->getID() << "' time: " << STEPS2TIME(msTime) << "\n"; +#endif const SUMOVehicleClass vClass = vehicle == 0 ? SVC_IGNORING : vehicle->getVClass(); - const SUMOReal time = STEPS2TIME(msTime); + const double time = STEPS2TIME(msTime); if (this->myBulkMode) { const EdgeInfo& toInfo = myEdgeInfos[to->getNumericalID()]; if (toInfo.visited) { @@ -198,7 +201,7 @@ buildPathFrom(minimumInfo, into); this->endQuery(num_visited); #ifdef DijkstraRouterTT_DEBUG_QUERY_PERF - std::cout << "visited " + toString(num_visited) + " edges (final path length: " + toString(into.size()) + ")\n"; + std::cout << "visited " + toString(num_visited) + " edges (final path length=" + toString(into.size()) + " edges=" + toString(into) + ")\n"; #endif return true; } @@ -213,7 +216,7 @@ } std::cout << "\n"; #endif - const SUMOReal traveltime = minimumInfo->traveltime + this->getEffort(minEdge, vehicle, time + minimumInfo->traveltime); + const double traveltime = minimumInfo->traveltime + this->getEffort(minEdge, vehicle, time + minimumInfo->traveltime); // check all ways from the node with the minimal length const std::vector& successors = minEdge->getSuccessors(vClass); for (typename std::vector::const_iterator it = successors.begin(); it != successors.end(); ++it) { @@ -223,11 +226,11 @@ if (PF::operator()(follower, vehicle)) { continue; } - const SUMOReal oldEffort = followerInfo->traveltime; + const double oldEffort = followerInfo->traveltime; if (!followerInfo->visited && traveltime < oldEffort) { followerInfo->traveltime = traveltime; followerInfo->prev = minimumInfo; - if (oldEffort == std::numeric_limits::max()) { + if (oldEffort == std::numeric_limits::max()) { myFrontierList.push_back(followerInfo); push_heap(myFrontierList.begin(), myFrontierList.end(), myComparator); } else { @@ -240,7 +243,7 @@ } this->endQuery(num_visited); #ifdef DijkstraRouterTT_DEBUG_QUERY_PERF - std::cout << "visited " + toString(num_visited) + " edges (final path length: " + toString(into.size()) + ")\n"; + std::cout << "visited " + toString(num_visited) + " edges (unsuccesful path length: " + toString(into.size()) + ")\n"; #endif if (to != 0) { myErrorMsgHandler->inform("No connection between edge '" + from->getID() + "' and edge '" + to->getID() + "' found."); @@ -249,9 +252,9 @@ } - SUMOReal recomputeCosts(const std::vector& edges, const V* const v, SUMOTime msTime) const { - const SUMOReal time = STEPS2TIME(msTime); - SUMOReal costs = 0; + double recomputeCosts(const std::vector& edges, const V* const v, SUMOTime msTime) const { + const double time = STEPS2TIME(msTime); + double costs = 0; for (typename std::vector::const_iterator i = edges.begin(); i != edges.end(); ++i) { if (PF::operator()(*i, v)) { return -1; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/GawronCalculator.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/GawronCalculator.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/GawronCalculator.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/GawronCalculator.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: GawronCalculator.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GawronCalculator.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Calculators for route costs and probabilities /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,16 +47,16 @@ class GawronCalculator : public RouteCostCalculator { public: /// Constructor - GawronCalculator(const SUMOReal beta, const SUMOReal a) : myBeta(beta), myA(a) {} + GawronCalculator(const double beta, const double a) : myBeta(beta), myA(a) {} /// Destructor virtual ~GawronCalculator() {} - void setCosts(R* route, const SUMOReal costs, const bool isActive = false) const { + void setCosts(R* route, const double costs, const bool isActive = false) const { if (isActive) { route->setCosts(costs); } else { - route->setCosts(myBeta * costs + ((SUMOReal) 1.0 - myBeta) * route->getCosts()); + route->setCosts(myBeta * costs + ((double) 1.0 - myBeta) * route->getCosts()); } } @@ -67,20 +67,20 @@ for (typename std::vector::iterator j = i + 1; j != alternatives.end(); j++) { R* pS = *j; // see [Gawron, 1998] (4.2) - const SUMOReal delta = + const double delta = (pS->getCosts() - pR->getCosts()) / (pS->getCosts() + pR->getCosts()); // see [Gawron, 1998] (4.3a, 4.3b) - SUMOReal newPR = gawronF(pR->getProbability(), pS->getProbability(), delta); - SUMOReal newPS = pR->getProbability() + pS->getProbability() - newPR; + double newPR = gawronF(pR->getProbability(), pS->getProbability(), delta); + double newPS = pR->getProbability() + pS->getProbability() - newPR; if (ISNAN(newPR) || ISNAN(newPS)) { newPR = pS->getCosts() > pR->getCosts() - ? (SUMOReal) 1. : 0; + ? (double) 1. : 0; newPS = pS->getCosts() > pR->getCosts() - ? 0 : (SUMOReal) 1.; + ? 0 : (double) 1.; } - newPR = MIN2((SUMOReal) MAX2(newPR, (SUMOReal) 0), (SUMOReal) 1); - newPS = MIN2((SUMOReal) MAX2(newPS, (SUMOReal) 0), (SUMOReal) 1); + newPR = MIN2((double) MAX2(newPR, (double) 0), (double) 1); + newPS = MIN2((double) MAX2(newPS, (double) 0), (double) 1); pR->setProbability(newPR); pS->setProbability(newPS); } @@ -90,9 +90,9 @@ private: /** @brief Performs the gawron - f() function From "Dynamic User Equilibria..." */ - SUMOReal gawronF(const SUMOReal pdr, const SUMOReal pds, const SUMOReal x) const { + double gawronF(const double pdr, const double pds, const double x) const { if (pdr * gawronG(myA, x) + pds == 0) { - return std::numeric_limits::max(); + return std::numeric_limits::max(); } return (pdr * (pdr + pds) * gawronG(myA, x)) / (pdr * gawronG(myA, x) + pds); @@ -100,19 +100,19 @@ /** @brief Performs the gawron - g() function From "Dynamic User Equilibria..." */ - SUMOReal gawronG(const SUMOReal a, const SUMOReal x) const { + double gawronG(const double a, const double x) const { if (((1.0 - (x * x)) == 0)) { - return std::numeric_limits::max(); + return std::numeric_limits::max(); } - return (SUMOReal) exp((a * x) / (1.0 - (x * x))); + return (double) exp((a * x) / (1.0 - (x * x))); } private: /// @brief gawron beta - value - const SUMOReal myBeta; + const double myBeta; /// @brief gawron a - value - const SUMOReal myA; + const double myA; private: /** @brief invalidated assignment operator */ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/IntermodalEdge.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/IntermodalEdge.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/IntermodalEdge.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/IntermodalEdge.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Robert Hilbrich /// @date Mon, 03 March 2014 -/// @version $Id: IntermodalEdge.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: IntermodalEdge.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The Edge definition for the Intermodal Router /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -68,8 +68,8 @@ template struct IntermodalTrip { - IntermodalTrip(const E* _from, const E* _to, SUMOReal _departPos, SUMOReal _arrivalPos, - SUMOReal _speed, SUMOTime _departTime, const N* _node, + IntermodalTrip(const E* _from, const E* _to, double _departPos, double _arrivalPos, + double _speed, SUMOTime _departTime, const N* _node, const V* _vehicle = 0, const SVCPermissions _modeSet = SVC_PEDESTRIAN) : from(_from), to(_to), @@ -94,9 +94,9 @@ const E* const from; const E* const to; - const SUMOReal departPos; - const SUMOReal arrivalPos; - const SUMOReal speed; + const double departPos; + const double arrivalPos; + const double speed; const SUMOTime departTime; const N* const node; // indicates whether only routing across this node shall be performed const V* const vehicle; // indicates which vehicle may be used @@ -161,19 +161,19 @@ return false; } - virtual SUMOReal getTravelTime(const IntermodalTrip* const /* trip */, SUMOReal /* time */) const { + virtual double getTravelTime(const IntermodalTrip* const /* trip */, double /* time */) const { return 0; } - static SUMOReal getTravelTimeStatic(const IntermodalEdge* const edge, const IntermodalTrip* const trip, SUMOReal time) { + static double getTravelTimeStatic(const IntermodalEdge* const edge, const IntermodalTrip* const trip, double time) { return edge->getTravelTime(trip, time); } - inline SUMOReal getLength() const { + inline double getLength() const { return myLength; } - inline void setLength(const SUMOReal length) { + inline void setLength(const double length) { myLength = length; } @@ -192,7 +192,7 @@ const std::string myLine; /// @brief adaptable length (for splitted edges) - SUMOReal myLength; + double myLength; private: /// @brief Invalidated copy constructor @@ -208,7 +208,7 @@ template class PedestrianEdge : public IntermodalEdge { public: - PedestrianEdge(int numericalID, const E* edge, const L* lane, bool forward, const SUMOReal pos = -1.) : + PedestrianEdge(int numericalID, const E* edge, const L* lane, bool forward, const double pos = -1.) : IntermodalEdge(edge->getID() + (edge->isWalkingArea() ? "" : (forward ? "_fwd" : "_bwd")) + toString(pos), numericalID, edge, "!ped"), myLane(lane), myForward(forward), @@ -229,8 +229,8 @@ } } - virtual SUMOReal getTravelTime(const IntermodalTrip* const trip, SUMOReal time) const { - SUMOReal length = this->getLength(); + virtual double getTravelTime(const IntermodalTrip* const trip, double time) const { + double length = this->getLength(); if (this->getEdge() == trip->from && !myForward) { length = trip->departPos - myStartPos; } @@ -245,11 +245,11 @@ } // ensure that 'normal' edges always have a higher weight than connector edges length = MAX2(length, POSITION_EPS); - SUMOReal tlsDelay = 0; + double tlsDelay = 0; // @note pedestrian traffic lights should never have LINKSTATE_TL_REDYELLOW if (this->getEdge()->isCrossing() && myLane->getIncomingLinkState() == LINKSTATE_TL_RED) { // red traffic lights occurring later in the route may be green by the time we arive - tlsDelay += MAX2(SUMOReal(0), TL_RED_PENALTY - (time - STEPS2TIME(trip->departTime))); + tlsDelay += MAX2(double(0), TL_RED_PENALTY - (time - STEPS2TIME(trip->departTime))); } #ifdef IntermodalRouter_DEBUG_EFFORTS std::cout << " effort for " << trip->getID() << " at " << time << " edge=" << edge->getID() << " effort=" << length / trip->speed + tlsDelay << " l=" << length << " s=" << trip->speed << " tlsDelay=" << tlsDelay << "\n"; @@ -265,7 +265,7 @@ const bool myForward; /// @brief the starting position for split edges - const SUMOReal myStartPos; + const double myStartPos; }; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/IntermodalNetwork.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/IntermodalNetwork.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/IntermodalNetwork.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/IntermodalNetwork.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Robert Hilbrich /// @date Mon, 03 March 2014 -/// @version $Id: IntermodalNetwork.h 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: IntermodalNetwork.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The Edge definition for the Intermodal Router /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -245,14 +245,14 @@ } /// @brief Returns the departing Intermodal edge - _IntermodalEdge* getDepartEdge(const E* e, const SUMOReal pos = -1.) { + _IntermodalEdge* getDepartEdge(const E* e, const double pos = -1.) { typename std::map >::const_iterator it = myDepartLookup.find(e); if (it == myDepartLookup.end()) { throw ProcessError("Depart edge '" + e->getID() + "' not found in pedestrian network."); } const std::vector<_IntermodalEdge*>& splitList = it->second; typename std::vector<_IntermodalEdge*>::const_iterator splitIt = splitList.begin(); - SUMOReal totalLength = 0.; + double totalLength = 0.; while (splitIt != splitList.end() && totalLength + (*splitIt)->getLength() + POSITION_EPS < pos) { totalLength += (*splitIt)->getLength(); ++splitIt; @@ -261,14 +261,14 @@ } /// @brief Returns the arriving Intermodal edge - _IntermodalEdge* getArrivalEdge(const E* e, const SUMOReal pos = -1.) { + _IntermodalEdge* getArrivalEdge(const E* e, const double pos = -1.) { typename std::map >::const_iterator it = myArrivalLookup.find(e); if (it == myArrivalLookup.end()) { throw ProcessError("Arrival edge '" + e->getID() + "' not found in pedestrian network."); } const std::vector<_IntermodalEdge*>& splitList = it->second; typename std::vector<_IntermodalEdge*>::const_iterator splitIt = splitList.begin(); - SUMOReal totalLength = 0.; + double totalLength = 0.; while (splitIt != splitList.end() && totalLength + (*splitIt)->getLength() + POSITION_EPS < pos) { totalLength += (*splitIt)->getLength(); ++splitIt; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/IntermodalRouter.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/IntermodalRouter.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/IntermodalRouter.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/IntermodalRouter.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file IntermodalRouter.h /// @author Jakob Erdmann /// @date Mon, 03 March 2014 -/// @version $Id: IntermodalRouter.h 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: IntermodalRouter.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The Pedestrian Router build a special network and (delegegates to a SUMOAbstractRouter) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -90,55 +90,7 @@ return new IntermodalRouter(myIntermodalNet); } - int splitEdge(_IntermodalEdge* const toSplit, _IntermodalEdge* afterSplit, const SUMOReal pos, - _IntermodalEdge* const fwdConn, _IntermodalEdge* const backConn = 0) { - int splitIndex = 1; - std::vector<_IntermodalEdge*>& splitList = myAccessSplits[toSplit]; - if (splitList.empty()) { - splitList.push_back(toSplit); - } - typename std::vector<_IntermodalEdge*>::iterator splitIt = splitList.begin(); - SUMOReal totalLength = 0.; - while (splitIt != splitList.end() && totalLength + (*splitIt)->getLength() + POSITION_EPS < pos) { - totalLength += (*splitIt)->getLength(); - ++splitIt; - splitIndex++; - } - assert(splitIt != splitList.end()); - _IntermodalEdge* const beforeSplit = *splitIt; - if (fabs(totalLength - pos) < POSITION_EPS && splitIt + 1 != splitList.end()) { - // don't split, use the present split edges - splitIndex = -1; - afterSplit = *(splitIt + 1); - } else { - myIntermodalNet->addEdge(afterSplit); - afterSplit->setSuccessors(beforeSplit->getSuccessors(SVC_IGNORING)); - beforeSplit->clearSuccessors(); - beforeSplit->addSuccessor(afterSplit); - afterSplit->setLength(totalLength - pos); - beforeSplit->setLength(beforeSplit->getLength() - afterSplit->getLength()); - splitList.insert(splitIt + 1, afterSplit); - } - // add access to / from edge - _AccessEdge* access = new _AccessEdge(myNumericalID++, beforeSplit, fwdConn); - myIntermodalNet->addEdge(access); - beforeSplit->addSuccessor(access); - access->addSuccessor(fwdConn); - if (backConn == 0) { - _AccessEdge* exit = new _AccessEdge(myNumericalID++, fwdConn, afterSplit); - myIntermodalNet->addEdge(exit); - fwdConn->addSuccessor(exit); - exit->addSuccessor(afterSplit); - } else { - _AccessEdge* backward = new _AccessEdge(myNumericalID++, beforeSplit, backConn); - myIntermodalNet->addEdge(backward); - beforeSplit->addSuccessor(backward); - backward->addSuccessor(backConn); - } - return splitIndex; - } - - void addAccess(const std::string& stopId, const E* stopEdge, const SUMOReal pos) { + void addAccess(const std::string& stopId, const E* stopEdge, const double pos) { assert(stopEdge != 0); if (myStopConnections.count(stopId) == 0) { myStopConnections[stopId] = new StopEdge(stopId, myNumericalID++, stopEdge); @@ -165,8 +117,10 @@ _IntermodalEdge* const depConn = new _IntermodalEdge(stopEdge->getID() + "_depart_connector" + toString(pos), myNumericalID++, stopEdge, "!connector"); depConn->addSuccessor(fwdSplit); depConn->addSuccessor(backBeforeSplit); + depConn->setLength(fwdSplit->getLength()); prevDep->removeSuccessor(backBeforeSplit); prevDep->addSuccessor(backSplit); + prevDep->setLength(backSplit->getLength()); if (carSplit != 0) { depConn->addSuccessor(carSplit); } @@ -182,10 +136,27 @@ } } - void addSchedule(const SUMOVehicleParameter& pars) { + void addSchedule(const SUMOVehicleParameter& pars, const std::vector* addStops = 0) { SUMOTime lastUntil = 0; std::vector validStops; + if (addStops != 0) { + // stops are part of a stand-alone route. until times are offsets from vehicle departure + for (std::vector::const_iterator s = addStops->begin(); s != addStops->end(); ++s) { + if (myStopConnections.count(s->busstop) > 0) { + // compute stop times for the first vehicle + SUMOVehicleParameter::Stop stop = *s; + stop.until += pars.depart; + if (stop.until >= lastUntil) { + validStops.push_back(stop); + lastUntil = stop.until; + } else { + WRITE_WARNING("Ignoring unordered stop at '" + stop.busstop + "' at " + time2string(stop.until) + " for vehicle '" + pars.id + "'."); + } + } + } + } for (std::vector::const_iterator s = pars.stops.begin(); s != pars.stops.end(); ++s) { + // stops are part of the vehicle until times are absolute times for the first vehicle if (myStopConnections.count(s->busstop) > 0 && s->until >= lastUntil) { validStops.push_back(*s); lastUntil = s->until; @@ -205,7 +176,7 @@ if (lastStop != 0) { _PTEdge* const newEdge = new _PTEdge(s->busstop, myNumericalID++, lastStop, currStop->getEdge(), pars.line); myIntermodalNet->addEdge(newEdge); - newEdge->addSchedule(lastTime, pars.repetitionEnd + lastTime - pars.depart, pars.repetitionOffset, STEPS2TIME(s->until - lastTime)); + newEdge->addSchedule(lastTime, lastTime + pars.repetitionOffset * (pars.repetitionNumber - 1), pars.repetitionOffset, STEPS2TIME(s->until - lastTime)); lastStop->addSuccessor(newEdge); newEdge->addSuccessor(currStop); lineEdges.push_back(newEdge); @@ -232,7 +203,7 @@ } SUMOTime lastTime = validStops.front().until; for (lineEdge = lineEdges.begin(), s = validStops.begin() + 1; lineEdge != lineEdges.end(); ++lineEdge, ++s) { - (*lineEdge)->addSchedule(lastTime, pars.repetitionEnd + lastTime - pars.depart, pars.repetitionOffset, STEPS2TIME(s->until - lastTime)); + (*lineEdge)->addSchedule(lastTime, lastTime + pars.repetitionOffset * (pars.repetitionNumber - 1), pars.repetitionOffset, STEPS2TIME(s->until - lastTime)); lastTime = s->until; } } @@ -240,7 +211,7 @@ /** @brief Builds the route between the given edges using the minimum effort at the given time The definition of the effort depends on the wished routing scheme */ - bool compute(const E* from, const E* to, SUMOReal departPos, SUMOReal arrivalPos, SUMOReal speed, + bool compute(const E* from, const E* to, double departPos, double arrivalPos, double speed, const V* const vehicle, const SVCPermissions modeSet, SUMOTime msTime, std::vector& into) { createNet(); @@ -274,7 +245,7 @@ } } #ifdef IntermodalRouter_DEBUG_ROUTES - SUMOReal time = STEPS2TIME(msTime); + double time = STEPS2TIME(msTime); for (int i = 0; i < intoPed.size(); ++i) { time += myInternalRouter->getEffort(intoPed[i], &trip, time); } @@ -296,7 +267,7 @@ throw ProcessError("Do not use this method"); } - SUMOReal recomputeCosts(const std::vector&, const _IntermodalTrip* const, SUMOTime) const { + double recomputeCosts(const std::vector&, const _IntermodalTrip* const, SUMOTime) const { throw ProcessError("Do not use this method"); } @@ -316,6 +287,54 @@ myInternalRouter(new INTERNALROUTER(net->getAllEdges(), true, &_IntermodalEdge::getTravelTimeStatic)), myIntermodalNet(net), myNumericalID((int)net->getAllEdges().size()) {} + int splitEdge(_IntermodalEdge* const toSplit, _IntermodalEdge* afterSplit, const double pos, + _IntermodalEdge* const fwdConn, _IntermodalEdge* const backConn = 0) { + int splitIndex = 1; + std::vector<_IntermodalEdge*>& splitList = myAccessSplits[toSplit]; + if (splitList.empty()) { + splitList.push_back(toSplit); + } + typename std::vector<_IntermodalEdge*>::iterator splitIt = splitList.begin(); + double relPos = pos; + while (splitIt != splitList.end() && relPos > (*splitIt)->getLength() + POSITION_EPS) { + relPos -= (*splitIt)->getLength(); + ++splitIt; + splitIndex++; + } + assert(splitIt != splitList.end()); + _IntermodalEdge* const beforeSplit = *splitIt; + if (fabs(relPos - beforeSplit->getLength()) < POSITION_EPS && splitIt + 1 != splitList.end()) { + // don't split, use the present split edges + splitIndex = -1; + afterSplit = *(splitIt + 1); + } else { + myIntermodalNet->addEdge(afterSplit); + afterSplit->setSuccessors(beforeSplit->getSuccessors(SVC_IGNORING)); + beforeSplit->clearSuccessors(); + beforeSplit->addSuccessor(afterSplit); + afterSplit->setLength(beforeSplit->getLength() - relPos); + beforeSplit->setLength(relPos); + splitList.insert(splitIt + 1, afterSplit); + } + // add access to / from edge + _AccessEdge* access = new _AccessEdge(myNumericalID++, beforeSplit, fwdConn); + myIntermodalNet->addEdge(access); + beforeSplit->addSuccessor(access); + access->addSuccessor(fwdConn); + if (backConn == 0) { + _AccessEdge* exit = new _AccessEdge(myNumericalID++, fwdConn, afterSplit); + myIntermodalNet->addEdge(exit); + fwdConn->addSuccessor(exit); + exit->addSuccessor(afterSplit); + } else { + _AccessEdge* backward = new _AccessEdge(myNumericalID++, beforeSplit, backConn); + myIntermodalNet->addEdge(backward); + beforeSplit->addSuccessor(backward); + backward->addSuccessor(backConn); + } + return splitIndex; + } + void addCarEdges(const std::vector& edges) { for (typename std::vector::const_iterator i = edges.begin(); i != edges.end(); ++i) { const E* const edge = *i; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/LogitCalculator.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/LogitCalculator.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/LogitCalculator.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/LogitCalculator.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: LogitCalculator.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: LogitCalculator.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Calculators for route costs and probabilities /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,35 +47,35 @@ class LogitCalculator : public RouteCostCalculator { public: /// Constructor - LogitCalculator(const SUMOReal beta, const SUMOReal gamma, - const SUMOReal theta) : myBeta(beta), myGamma(gamma), myTheta(theta) {} + LogitCalculator(const double beta, const double gamma, + const double theta) : myBeta(beta), myGamma(gamma), myTheta(theta) {} /// Destructor virtual ~LogitCalculator() {} - void setCosts(R* route, const SUMOReal costs, const bool /* isActive */) const { + void setCosts(R* route, const double costs, const bool /* isActive */) const { route->setCosts(costs); } /** @brief calculate the probabilities in the logit model */ void calculateProbabilities(std::vector alternatives, const V* const veh, const SUMOTime time) { - const SUMOReal theta = myTheta >= 0 ? myTheta : getThetaForCLogit(alternatives); - const SUMOReal beta = myBeta >= 0 ? myBeta : getBetaForCLogit(alternatives); + const double theta = myTheta >= 0 ? myTheta : getThetaForCLogit(alternatives); + const double beta = myBeta >= 0 ? myBeta : getBetaForCLogit(alternatives); if (beta > 0) { // calculate commonalities for (typename std::vector::const_iterator i = alternatives.begin(); i != alternatives.end(); i++) { const R* pR = *i; - SUMOReal lengthR = 0; + double lengthR = 0; const std::vector& edgesR = pR->getEdgeVector(); for (typename std::vector::const_iterator edge = edgesR.begin(); edge != edgesR.end(); ++edge) { //@todo we should use costs here lengthR += (*edge)->getTravelTime(veh, STEPS2TIME(time)); } - SUMOReal overlapSum = 0; + double overlapSum = 0; for (typename std::vector::const_iterator j = alternatives.begin(); j != alternatives.end(); j++) { const R* pS = *j; - SUMOReal overlapLength = 0.; - SUMOReal lengthS = 0; + double overlapLength = 0.; + double lengthS = 0; const std::vector& edgesS = pS->getEdgeVector(); for (typename std::vector::const_iterator edge = edgesS.begin(); edge != edgesS.end(); ++edge) { lengthS += (*edge)->getTravelTime(veh, STEPS2TIME(time)); @@ -90,7 +90,7 @@ } for (typename std::vector::iterator i = alternatives.begin(); i != alternatives.end(); i++) { R* pR = *i; - SUMOReal weightedSum = 0; + double weightedSum = 0; for (typename std::vector::iterator j = alternatives.begin(); j != alternatives.end(); j++) { R* pS = *j; weightedSum += exp(theta * (pR->getCosts() - pS->getCosts() + myCommonalities[pR] - myCommonalities[pS])); @@ -102,10 +102,10 @@ private: /** @brief calculate the scaling factor in the logit model */ - SUMOReal getBetaForCLogit(const std::vector alternatives) const { - SUMOReal min = std::numeric_limits::max(); + double getBetaForCLogit(const std::vector alternatives) const { + double min = std::numeric_limits::max(); for (typename std::vector::const_iterator i = alternatives.begin(); i != alternatives.end(); i++) { - const SUMOReal cost = (*i)->getCosts() / 3600.; + const double cost = (*i)->getCosts() / 3600.; if (cost < min) { min = cost; } @@ -114,23 +114,23 @@ } /** @brief calculate the scaling factor in the logit model */ - SUMOReal getThetaForCLogit(const std::vector alternatives) const { + double getThetaForCLogit(const std::vector alternatives) const { // @todo this calculation works for travel times only - SUMOReal sum = 0.; - SUMOReal diff = 0.; - SUMOReal min = std::numeric_limits::max(); + double sum = 0.; + double diff = 0.; + double min = std::numeric_limits::max(); for (typename std::vector::const_iterator i = alternatives.begin(); i != alternatives.end(); i++) { - const SUMOReal cost = (*i)->getCosts() / 3600.; + const double cost = (*i)->getCosts() / 3600.; sum += cost; if (cost < min) { min = cost; } } - const SUMOReal meanCost = sum / SUMOReal(alternatives.size()); + const double meanCost = sum / double(alternatives.size()); for (typename std::vector::const_iterator i = alternatives.begin(); i != alternatives.end(); i++) { diff += pow((*i)->getCosts() / 3600. - meanCost, 2); } - const SUMOReal cvCost = sqrt(diff / SUMOReal(alternatives.size())) / meanCost; + const double cvCost = sqrt(diff / double(alternatives.size())) / meanCost; // @todo re-evaluate function // if (cvCost > 0.04) { // Magic numbers from Lohse book return 3.1415926535897932384626433832795 / (sqrt(6.) * cvCost * (min + 1.1)) / 3600.; @@ -141,16 +141,16 @@ private: /// @brief logit beta - value - const SUMOReal myBeta; + const double myBeta; /// @brief logit gamma - value - const SUMOReal myGamma; + const double myGamma; /// @brief logit theta - value - const SUMOReal myTheta; + const double myTheta; /// @brief The route commonality factors for c-logit - std::map myCommonalities; + std::map myCommonalities; private: /** @brief invalidated assignment operator */ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -2,7 +2,7 @@ libvehicle_a_SOURCES = AStarRouter.h \ CarEdge.h \ -CHRouter.h CHRouterWrapper.h \ +CHBuilder.h CHRouter.h CHRouterWrapper.h \ DijkstraRouterTT.h DijkstraRouterEffort.h \ IntermodalEdge.h IntermodalNetwork.h IntermodalRouter.h \ GawronCalculator.h LogitCalculator.h RouteCostCalculator.h \ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -330,7 +330,7 @@ noinst_LIBRARIES = libvehicle.a libvehicle_a_SOURCES = AStarRouter.h \ CarEdge.h \ -CHRouter.h CHRouterWrapper.h \ +CHBuilder.h CHRouter.h CHRouterWrapper.h \ DijkstraRouterTT.h DijkstraRouterEffort.h \ IntermodalEdge.h IntermodalNetwork.h IntermodalRouter.h \ GawronCalculator.h LogitCalculator.h RouteCostCalculator.h \ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/PedestrianRouter.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/PedestrianRouter.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/PedestrianRouter.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/PedestrianRouter.h 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file PedestrianRouter.h /// @author Jakob Erdmann /// @date Mon, 03 March 2014 -/// @version $Id: PedestrianRouter.h 21206 2016-07-20 08:08:35Z behrisch $ +/// @version $Id: PedestrianRouter.h 23150 2017-02-27 12:08:30Z behrisch $ /// // The Pedestrian Router builds a special network and delegates to a SUMOAbstractRouter. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -86,7 +86,7 @@ /** @brief Builds the route between the given edges using the minimum effort at the given time The definition of the effort depends on the wished routing scheme */ - bool compute(const E* from, const E* to, SUMOReal departPos, SUMOReal arrivalPos, SUMOReal speed, + bool compute(const E* from, const E* to, double departPos, double arrivalPos, double speed, SUMOTime msTime, const N* onlyNode, std::vector& into, bool allEdges = false) { //startQuery(); if (getSidewalk(from) == 0) { @@ -110,7 +110,7 @@ } } #ifdef PedestrianRouter_DEBUG_ROUTES - SUMOReal time = msTime; + double time = msTime; for (int i = 0; i < intoPed.size(); ++i) { time += myInternalRouter->getEffort(intoPed[i], &trip, time); } @@ -134,7 +134,7 @@ throw ProcessError("Do not use this method"); } - SUMOReal recomputeCosts(const std::vector&, const _IntermodalTrip* const, SUMOTime) const { + double recomputeCosts(const std::vector&, const _IntermodalTrip* const, SUMOTime) const { throw ProcessError("Do not use this method"); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/RouteCostCalculator.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/RouteCostCalculator.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/RouteCostCalculator.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/RouteCostCalculator.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 -/// @version $Id: RouteCostCalculator.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: RouteCostCalculator.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Calculators for route costs and probabilities /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -57,7 +57,7 @@ myInstance = 0; } - virtual void setCosts(R* route, const SUMOReal costs, const bool isActive = false) const = 0; + virtual void setCosts(R* route, const double costs, const bool isActive = false) const = 0; /** @brief calculate the probabilities in the logit model */ virtual void calculateProbabilities(std::vector alternatives, const V* const veh, const SUMOTime time) = 0; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/SPTree.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/SPTree.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/SPTree.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/SPTree.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date February 2012 -/// @version $Id: SPTree.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: SPTree.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Shortest Path tree of limited depth using Dijkstras algorithm /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -112,13 +112,13 @@ if (follower == excluded) { continue; } - const SUMOReal traveltime = min->traveltime + con.cost; - const SUMOReal oldTraveltime = follower->traveltime; + const double traveltime = min->traveltime + con.cost; + const double oldTraveltime = follower->traveltime; if (!follower->visited && traveltime < oldTraveltime) { follower->traveltime = traveltime; follower->depth = min->depth + 1; follower->permissions = (min->permissions & con.permissions); - if (oldTraveltime == std::numeric_limits::max()) { + if (oldTraveltime == std::numeric_limits::max()) { myFrontier.push_back(follower); push_heap(myFrontier.begin(), myFrontier.end(), myCmp); } else { @@ -153,9 +153,9 @@ for (typename CHConnectionPairs::iterator it = myShortcutsToValidate.begin(); it != myShortcutsToValidate.end(); ++it) { const C* const aInfo = it->first; const C* const fInfo = it->second; - const SUMOReal bestWitness = dijkstraTT( - aInfo->target, fInfo->target, excluded, (aInfo->permissions & fInfo->permissions)); - const SUMOReal viaCost = aInfo->cost + fInfo->cost; + const double bestWitness = dijkstraTT( + aInfo->target, fInfo->target, excluded, (aInfo->permissions & fInfo->permissions)); + const double viaCost = aInfo->cost + fInfo->cost; if (viaCost < bestWitness) { myNeededShortcuts.push_back(*it); } @@ -167,7 +167,7 @@ private: // perform dijkstra search under permission constraints - SUMOReal dijkstraTT(E* start, E* dest, const E* excluded, SVCPermissions permissions) { + double dijkstraTT(E* start, E* dest, const E* excluded, SVCPermissions permissions) { init(); start->traveltime = 0; start->depth = 0; @@ -192,13 +192,13 @@ if ((con.permissions & permissions) != permissions) { continue; } - const SUMOReal traveltime = min->traveltime + con.cost; - const SUMOReal oldTraveltime = follower->traveltime; + const double traveltime = min->traveltime + con.cost; + const double oldTraveltime = follower->traveltime; if (!follower->visited && traveltime < oldTraveltime) { follower->traveltime = traveltime; follower->depth = min->depth + 1; follower->permissions = (min->permissions & con.permissions); - if (oldTraveltime == std::numeric_limits::max()) { + if (oldTraveltime == std::numeric_limits::max()) { myFrontier.push_back(follower); push_heap(myFrontier.begin(), myFrontier.end(), myCmp); } else { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/SUMOAbstractRouter.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/SUMOAbstractRouter.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/SUMOAbstractRouter.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/SUMOAbstractRouter.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 25.Jan 2006 -/// @version $Id: SUMOAbstractRouter.h 20482 2016-04-18 20:49:42Z behrisch $ +/// @version $Id: SUMOAbstractRouter.h 24108 2017-04-27 18:43:30Z behrisch $ /// // An abstract router base class /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2006-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2006-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -53,7 +53,7 @@ class SUMOAbstractRouter { public: /// Type of the function that is used to retrieve the edge effort. - typedef SUMOReal(* Operation)(const E* const, const V* const, SUMOReal); + typedef double(* Operation)(const E* const, const V* const, double); /// Constructor SUMOAbstractRouter(Operation operation, const std::string& type): @@ -81,10 +81,10 @@ virtual bool compute(const E* from, const E* to, const V* const vehicle, SUMOTime msTime, std::vector& into) = 0; - virtual SUMOReal recomputeCosts(const std::vector& edges, - const V* const v, SUMOTime msTime) const = 0; + virtual double recomputeCosts(const std::vector& edges, + const V* const v, SUMOTime msTime) const = 0; - inline SUMOReal getEffort(const E* const e, const V* const v, SUMOReal t) const { + inline double getEffort(const E* const e, const V* const v, double t) const { return (*myOperation)(e, v, t); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/SUMOVehicle.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/SUMOVehicle.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/SUMOVehicle.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/SUMOVehicle.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Daniel Krajzewicz /// @author Jakob Erdmann /// @date Tue, 17 Feb 2009 -/// @version $Id: SUMOVehicle.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: SUMOVehicle.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Abstract base class for vehicle representations /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -51,6 +51,7 @@ class MSDevice; class MSPerson; class MSTransportable; +class MSParkingArea; class SUMOSAXAttributes; typedef std::vector ConstMSEdgeVector; @@ -73,7 +74,7 @@ /** @brief Returns the vehicle's previous speed * @return The vehicle's speed */ - virtual SUMOReal getPreviousSpeed() const = 0; + virtual double getPreviousSpeed() const = 0; typedef Named::NamedLikeComparatorIdLess ComparatorIdLess; @@ -89,23 +90,23 @@ /** @brief Get the vehicle's position along the lane * @return The position of the vehicle (in m from the lane's begin) */ - virtual SUMOReal getPositionOnLane() const = 0; + virtual double getPositionOnLane() const = 0; /** @brief Get the vehicle's back position along the given lane * @return The position of the vehicle (in m from the given lane's begin) */ - virtual SUMOReal getBackPositionOnLane(const MSLane* lane) const = 0; + virtual double getBackPositionOnLane(const MSLane* lane) const = 0; /** @brief Get the vehicle's lateral position on the lane * @return The lateral position of the vehicle (in m relative to the * centerline of the lane) */ - virtual SUMOReal getLateralPositionOnLane() const = 0; + virtual double getLateralPositionOnLane() const = 0; /** @brief Get the vehicle's angle * @return The angle of the vehicle (in degree) */ - virtual SUMOReal getAngle() const = 0; + virtual double getAngle() const = 0; /** @brief Return current position (x/y, cartesian) * @@ -114,17 +115,17 @@ * @return The current position (in cartesian coordinates) * @see myLane */ - virtual Position getPosition(const SUMOReal offset = 0) const = 0; + virtual Position getPosition(const double offset = 0) const = 0; /** @brief Returns the vehicle's maximum speed * @return The vehicle's maximum speed */ - virtual SUMOReal getMaxSpeed() const = 0; + virtual double getMaxSpeed() const = 0; /** @brief Returns the vehicle's current speed * @return The vehicle's speed */ - virtual SUMOReal getSpeed() const = 0; + virtual double getSpeed() const = 0; /** @brief Returns the lane the vehicle is on * @return The vehicle's current lane @@ -164,10 +165,10 @@ * @param[in] check Whether the route should be checked for validity * @return Whether the new route was accepted */ - virtual bool replaceRouteEdges(ConstMSEdgeVector& edges, bool onInit = false, bool check = false) = 0; + virtual bool replaceRouteEdges(ConstMSEdgeVector& edges, bool onInit = false, bool check = false, bool addStops = true) = 0; /// Replaces the current route by the given one - virtual bool replaceRoute(const MSRoute* route, bool onInit = false, int offset = 0) = 0; + virtual bool replaceRoute(const MSRoute* route, bool onInit = false, int offset = 0, bool addStops = true) = 0; /** @brief Performs a rerouting using the given router * @@ -196,12 +197,12 @@ /** @brief Returns the vehicle's acceleration * @return The acceleration */ - virtual SUMOReal getAcceleration() const = 0; + virtual double getAcceleration() const = 0; /** @brief Returns the slope of the road at vehicle's position * @return The slope */ - virtual SUMOReal getSlope() const = 0; + virtual double getSlope() const = 0; /** @brief Returns the edge the vehicle is currently at * @@ -251,17 +252,17 @@ /** @brief Returns this vehicle's real departure position * @return This vehicle's real departure position */ - virtual SUMOReal getDepartPos() const = 0; + virtual double getDepartPos() const = 0; /** @brief Returns this vehicle's desired arrivalPos for its current route * (may change on reroute) * @return This vehicle's real arrivalPos */ - virtual SUMOReal getArrivalPos() const = 0; + virtual double getArrivalPos() const = 0; /** @brief Sets this vehicle's desired arrivalPos for its current route */ - virtual void setArrivalPos(SUMOReal arrivalPos) = 0; + virtual void setArrivalPos(double arrivalPos) = 0; /** @brief Returns whether this vehicle has departed */ @@ -303,7 +304,22 @@ * @param[in] stop The stop to add * @return Whether the stop could be added */ - virtual bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0) = 0; + virtual bool addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& errorMsg, SUMOTime untilOffset = 0, bool collision = false) = 0; + + + /** + * returns the next imminent stop in the stop queue + * @return the upcoming stop + */ + virtual MSParkingArea* getNextParkingArea() = 0; + + /** @brief Replaces a stop + * + * The stop replace the next stop into the sorted list. + * @param[in] stop The stop to add + * @return Whether the stop could be added + */ + virtual bool replaceParkingArea(MSParkingArea* parkingArea, std::string& errorMsg) = 0; /** @brief Returns whether the vehicle is at a stop * @return Whether the has stopped @@ -319,16 +335,16 @@ virtual MSDevice* getDevice(const std::type_info& type) const = 0; - virtual SUMOReal getChosenSpeedFactor() const = 0; + virtual double getChosenSpeedFactor() const = 0; - virtual void setChosenSpeedFactor(const SUMOReal factor) = 0; + virtual void setChosenSpeedFactor(const double factor) = 0; virtual SUMOTime getWaitingTime() const = 0; virtual SUMOTime getDepartDelay() const = 0; /// @brief Returns this vehicles impatience - virtual SUMOReal getImpatience() const = 0; + virtual double getImpatience() const = 0; /// @name state io //@{ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/SUMOVehicleParameter.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/SUMOVehicleParameter.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/SUMOVehicleParameter.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/SUMOVehicleParameter.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Tue, 31.03.2009 -/// @version $Id: SUMOVehicleParameter.cpp 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: SUMOVehicleParameter.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Structure representing possible vehicle parameter /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // member method definitions @@ -60,18 +56,24 @@ line(), fromTaz(), toTaz(), personNumber(0), containerNumber(0), setParameter(0) { } +SUMOVehicleParameter::~SUMOVehicleParameter() { +} bool SUMOVehicleParameter::defaultOptionOverrides(const OptionsCont& oc, const std::string& optionName) const { - return oc.isSet(optionName) && oc.getBool("defaults-override"); + return oc.exists(optionName) && oc.isSet(optionName) && oc.getBool("defaults-override"); } void -SUMOVehicleParameter::write(OutputDevice& dev, const OptionsCont& oc, const SumoXMLTag tag) const { +SUMOVehicleParameter::write(OutputDevice& dev, const OptionsCont& oc, const SumoXMLTag tag, const std::string& typeID) const { dev.openTag(tag).writeAttr(SUMO_ATTR_ID, id); - if (wasSet(VEHPARS_VTYPE_SET)) { - dev.writeAttr(SUMO_ATTR_TYPE, vtypeid); + if (typeID == "") { + if (wasSet(VEHPARS_VTYPE_SET)) { + dev.writeAttr(SUMO_ATTR_TYPE, vtypeid); + } + } else { + dev.writeAttr(SUMO_ATTR_TYPE, typeID); } if (departProcedure == DEPART_TRIGGERED) { dev.writeAttr(SUMO_ATTR_DEPART, "triggered"); @@ -109,7 +111,7 @@ break; } dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTLANE, val); - } else if (oc.isSet("departlane")) { + } else if (oc.exists("departlane") && oc.isSet("departlane")) { dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTLANE, oc.getString("departlane")); } // departpos @@ -139,7 +141,7 @@ break; } dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTPOS, val); - } else if (oc.isSet("departpos")) { + } else if (oc.exists("departpos") && oc.isSet("departpos")) { dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTPOS, oc.getString("departpos")); } // departPosLat @@ -191,7 +193,7 @@ break; } dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTSPEED, val); - } else if (oc.isSet("departspeed")) { + } else if (oc.exists("departspeed") && oc.isSet("departspeed")) { dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTSPEED, oc.getString("departspeed")); } @@ -210,7 +212,7 @@ break; } dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALLANE, val); - } else if (oc.isSet("arrivallane")) { + } else if (oc.exists("arrivallane") && oc.isSet("arrivallane")) { dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALLANE, oc.getString("arrivallane")); } // arrivalpos @@ -231,7 +233,7 @@ break; } dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALPOS, val); - } else if (oc.isSet("arrivalpos")) { + } else if (oc.exists("arrivalpos") && oc.isSet("arrivalpos")) { dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALPOS, oc.getString("arrivalpos")); } // arrivalPosLat @@ -271,7 +273,7 @@ break; } dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALSPEED, val); - } else if (oc.isSet("arrivalspeed")) { + } else if (oc.exists("arrivalspeed") && oc.isSet("arrivalspeed")) { dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALSPEED, oc.getString("arrivalspeed")); } @@ -306,7 +308,10 @@ if (containerstop != "") { dev.writeAttr(SUMO_ATTR_CONTAINER_STOP, containerstop); } - if (busstop == "" && containerstop == "") { + if (parkingarea != "") { + dev.writeAttr(SUMO_ATTR_PARKING_AREA, parkingarea); + } + if (busstop == "" && containerstop == "" && parkingarea == "") { dev.writeAttr(SUMO_ATTR_LANE, lane); if ((setParameter & STOP_START_SET) != 0) { dev.writeAttr(SUMO_ATTR_STARTPOS, startPos); @@ -404,7 +409,7 @@ bool SUMOVehicleParameter::parseDepartPos(const std::string& val, const std::string& element, const std::string& id, - SUMOReal& pos, DepartPosDefinition& dpd, std::string& error) { + double& pos, DepartPosDefinition& dpd, std::string& error) { bool ok = true; if (val == "random") { dpd = DEPART_POS_RANDOM; @@ -418,7 +423,7 @@ dpd = DEPART_POS_LAST; } else { try { - pos = TplConvert::_2SUMOReal(val.c_str()); + pos = TplConvert::_2double(val.c_str()); dpd = DEPART_POS_GIVEN; } catch (...) { ok = false; @@ -433,7 +438,7 @@ bool SUMOVehicleParameter::parseDepartPosLat(const std::string& val, const std::string& element, const std::string& id, - SUMOReal& pos, DepartPosLatDefinition& dpd, std::string& error) { + double& pos, DepartPosLatDefinition& dpd, std::string& error) { bool ok = true; if (val == "random") { dpd = DEPART_POSLAT_RANDOM; @@ -449,7 +454,7 @@ dpd = DEPART_POSLAT_LEFT; } else { try { - pos = TplConvert::_2SUMOReal(val.c_str()); + pos = TplConvert::_2double(val.c_str()); dpd = DEPART_POSLAT_GIVEN; } catch (...) { ok = false; @@ -464,7 +469,7 @@ bool SUMOVehicleParameter::parseDepartSpeed(const std::string& val, const std::string& element, const std::string& id, - SUMOReal& speed, DepartSpeedDefinition& dsd, std::string& error) { + double& speed, DepartSpeedDefinition& dsd, std::string& error) { bool ok = true; if (val == "random") { dsd = DEPART_SPEED_RANDOM; @@ -472,7 +477,7 @@ dsd = DEPART_SPEED_MAX; } else { try { - speed = TplConvert::_2SUMOReal(val.c_str()); + speed = TplConvert::_2double(val.c_str()); dsd = DEPART_SPEED_GIVEN; if (speed < 0) { ok = false; @@ -514,7 +519,7 @@ bool SUMOVehicleParameter::parseArrivalPos(const std::string& val, const std::string& element, const std::string& id, - SUMOReal& pos, ArrivalPosDefinition& apd, std::string& error) { + double& pos, ArrivalPosDefinition& apd, std::string& error) { bool ok = true; if (val == "random") { apd = ARRIVAL_POS_RANDOM; @@ -522,7 +527,7 @@ apd = ARRIVAL_POS_MAX; } else { try { - pos = TplConvert::_2SUMOReal(val.c_str()); + pos = TplConvert::_2double(val.c_str()); apd = ARRIVAL_POS_GIVEN; } catch (...) { ok = false; @@ -537,7 +542,7 @@ bool SUMOVehicleParameter::parseArrivalPosLat(const std::string& val, const std::string& element, const std::string& id, - SUMOReal& pos, ArrivalPosLatDefinition& apd, std::string& error) { + double& pos, ArrivalPosLatDefinition& apd, std::string& error) { bool ok = true; if (val == "right") { apd = ARRIVAL_POSLAT_RIGHT; @@ -547,7 +552,7 @@ apd = ARRIVAL_POSLAT_LEFT; } else { try { - pos = TplConvert::_2SUMOReal(val.c_str()); + pos = TplConvert::_2double(val.c_str()); apd = ARRIVAL_POSLAT_GIVEN; } catch (...) { ok = false; @@ -562,13 +567,13 @@ bool SUMOVehicleParameter::parseArrivalSpeed(const std::string& val, const std::string& element, const std::string& id, - SUMOReal& speed, ArrivalSpeedDefinition& asd, std::string& error) { + double& speed, ArrivalSpeedDefinition& asd, std::string& error) { bool ok = true; if (val == "current") { asd = ARRIVAL_SPEED_CURRENT; } else { try { - speed = TplConvert::_2SUMOReal(val.c_str()); + speed = TplConvert::_2double(val.c_str()); if (speed < 0) { ok = false; } @@ -584,8 +589,8 @@ } -SUMOReal -SUMOVehicleParameter::interpretEdgePos(SUMOReal pos, SUMOReal maximumValue, SumoXMLAttr attr, const std::string& id) { +double +SUMOVehicleParameter::interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string& id) { if (pos < 0) { pos = maximumValue + pos; } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/SUMOVehicleParameter.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/SUMOVehicleParameter.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/SUMOVehicleParameter.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/SUMOVehicleParameter.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Axel Wegener /// @author Michael Behrisch /// @date 2006-01-24 -/// @version $Id: SUMOVehicleParameter.h 21851 2016-10-31 12:20:12Z behrisch $ +/// @version $Id: SUMOVehicleParameter.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Structure representing possible vehicle parameter /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -273,6 +273,8 @@ * @class SUMOVehicleParameter * @brief Structure representing possible vehicle parameter * + * When used within a vehicle, parameter are usually const except for selected items + * adaptable via TraCI which are flagged as mutable below * The fields yielding with "Procedure" describe whether the according value * shall be used or another procedure is used to choose the value. * @see DepartLaneDefinition @@ -287,6 +289,8 @@ */ SUMOVehicleParameter(); + /// @brief Destructor + ~SUMOVehicleParameter(); /** @brief Returns whether the given parameter was set * @param[in] what The parameter which one asks for @@ -302,9 +306,10 @@ * @param[in, out] dev The device to write into * @param[in] oc The options to get defaults from * @param[in] tag The "root" tag to write (defaults to vehicle) + * @param[in] tag The typeID to write (defaults to member vtypeid) * @exception IOError not yet implemented */ - void write(OutputDevice& dev, const OptionsCont& oc, const SumoXMLTag tag = SUMO_TAG_VEHICLE) const; + void write(OutputDevice& dev, const OptionsCont& oc, const SumoXMLTag tag = SUMO_TAG_VEHICLE, const std::string& typeID = "") const; /** @brief Returns whether the defaults shall be used @@ -355,7 +360,7 @@ * @return Whether the given value is a valid departPos definition */ static bool parseDepartPos(const std::string& val, const std::string& element, const std::string& id, - SUMOReal& pos, DepartPosDefinition& dpd, std::string& error); + double& pos, DepartPosDefinition& dpd, std::string& error); /** @brief Validates a given departPosLat value @@ -368,7 +373,7 @@ * @return Whether the given value is a valid departPos definition */ static bool parseDepartPosLat(const std::string& val, const std::string& element, const std::string& id, - SUMOReal& pos, DepartPosLatDefinition& dpd, std::string& error); + double& pos, DepartPosLatDefinition& dpd, std::string& error); /** @brief Validates a given departSpeed value @@ -381,7 +386,7 @@ * @return Whether the given value is a valid departSpeed definition */ static bool parseDepartSpeed(const std::string& val, const std::string& element, const std::string& id, - SUMOReal& speed, DepartSpeedDefinition& dsd, std::string& error); + double& speed, DepartSpeedDefinition& dsd, std::string& error); /** @brief Validates a given arrivalLane value @@ -407,7 +412,7 @@ * @return Whether the given value is a valid arrivalPos definition */ static bool parseArrivalPos(const std::string& val, const std::string& element, const std::string& id, - SUMOReal& pos, ArrivalPosDefinition& apd, std::string& error); + double& pos, ArrivalPosDefinition& apd, std::string& error); /** @brief Validates a given arrivalPosLat value @@ -420,7 +425,7 @@ * @return Whether the given value is a valid arrivalPos definition */ static bool parseArrivalPosLat(const std::string& val, const std::string& element, const std::string& id, - SUMOReal& pos, ArrivalPosLatDefinition& apd, std::string& error); + double& pos, ArrivalPosLatDefinition& apd, std::string& error); /** @brief Validates a given arrivalSpeed value @@ -433,7 +438,7 @@ * @return Whether the given value is a valid arrivalSpeed definition */ static bool parseArrivalSpeed(const std::string& val, const std::string& element, const std::string& id, - SUMOReal& speed, ArrivalSpeedDefinition& asd, std::string& error); + double& speed, ArrivalSpeedDefinition& asd, std::string& error); /// @} @@ -444,7 +449,7 @@ * @param[in] id The id of the object to which this attribute belongs * @return Whether the interpreted position */ - static SUMOReal interpretEdgePos(SUMOReal pos, SUMOReal maximumValue, SumoXMLAttr attr, const std::string& id); + static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string& id); /// @brief The vehicle's id std::string id; @@ -453,7 +458,7 @@ std::string routeid; /// @brief The vehicle's type id std::string vtypeid; - /// @brief The vehicle's color + /// @brief The vehicle's color, TraCI may change this mutable RGBColor color; @@ -469,15 +474,15 @@ /// @brief Information how the vehicle shall choose the lane to depart from DepartLaneDefinition departLaneProcedure; /// @brief (optional) The position the vehicle shall depart from - SUMOReal departPos; + double departPos; /// @brief Information how the vehicle shall choose the departure position DepartPosDefinition departPosProcedure; /// @brief (optional) The lateral position the vehicle shall depart from - SUMOReal departPosLat; + double departPosLat; /// @brief Information how the vehicle shall choose the lateral departure position DepartPosLatDefinition departPosLatProcedure; /// @brief (optional) The initial speed of the vehicle - SUMOReal departSpeed; + double departSpeed; /// @brief Information how the vehicle's initial speed shall be chosen DepartSpeedDefinition departSpeedProcedure; /// @} @@ -491,15 +496,15 @@ /// @brief Information how the vehicle shall choose the lane to arrive on ArrivalLaneDefinition arrivalLaneProcedure; /// @brief (optional) The position the vehicle shall arrive on - SUMOReal arrivalPos; + double arrivalPos; /// @brief Information how the vehicle shall choose the arrival position ArrivalPosDefinition arrivalPosProcedure; /// @brief (optional) The lateral position the vehicle shall arrive on - SUMOReal arrivalPosLat; + double arrivalPosLat; /// @brief Information how the vehicle shall choose the lateral arrival position ArrivalPosLatDefinition arrivalPosLatProcedure; /// @brief (optional) The final speed of the vehicle (not used yet) - SUMOReal arrivalSpeed; + double arrivalSpeed; /// @brief Information how the vehicle's end speed shall be chosen ArrivalSpeedDefinition arrivalSpeedProcedure; /// @} @@ -515,14 +520,14 @@ /// @brief The time offset between vehicle reinsertions SUMOTime repetitionOffset; /// @brief The probability for emitting a vehicle per second - SUMOReal repetitionProbability; + double repetitionProbability; /// @brief The time at which the flow ends (only needed when using repetitionProbability) SUMOTime repetitionEnd; /// @} /// @brief The vehicle's line (mainly for public transport) - std::string line; + mutable std::string line; /// @brief The vehicle's origin zone (district) std::string fromTaz; @@ -540,12 +545,14 @@ std::string busstop; /// @brief (Optional) container stop if one is assigned to the stop std::string containerstop; + /// @brief (Optional) parking area if one is assigned to the stop + std::string parkingarea; /// @brief (Optional) charging station if one is assigned to the stop std::string chargingStation; /// @brief The stopping position start - SUMOReal startPos; + double startPos; /// @brief The stopping position end - SUMOReal endPos; + double endPos; /// @brief The stopping duration SUMOTime duration; /// @brief The time at which the vehicle may continue its journey @@ -561,7 +568,7 @@ /// @brief IDs of containers the vehicle has to wait for until departing std::set awaitedContainers; /// @brief lanes and positions connected to this stop - std::multimap accessPos; + std::multimap accessPos; /// @brief at which position in the stops list int index; /// @brief Information for the output which parameter were set @@ -575,11 +582,11 @@ void write(OutputDevice& dev) const; }; - /// @brief List of the stops the vehicle will make - std::vector stops; + /// @brief List of the stops the vehicle will make, TraCI may add entries here + mutable std::vector stops; /// @brief List of the via-edges the vehicle must visit - std::vector via; + mutable std::vector via; /// @brief The static number of persons in the vehicle when it departs (not including boarding persons) int personNumber; @@ -587,7 +594,7 @@ /// @brief The static number of containers in the vehicle when it departs int containerNumber; - /// @brief Information for the router which parameter were set + /// @brief Information for the router which parameter were set, TraCI may modify this (whe changing color) mutable int setParameter; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/SUMOVTypeParameter.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/SUMOVTypeParameter.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/SUMOVTypeParameter.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/SUMOVTypeParameter.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 10.09.2009 -/// @version $Id: SUMOVTypeParameter.cpp 20823 2016-05-31 09:07:16Z behrisch $ +/// @version $Id: SUMOVTypeParameter.cpp 23699 2017-03-29 07:16:27Z namdre $ /// // Structure representing possible vehicle parameter /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,9 +40,7 @@ #include #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS +#define EMPREFIX std::string("HBEFA3/") // =========================================================================== @@ -51,12 +49,12 @@ SUMOVTypeParameter::SUMOVTypeParameter(const std::string& vtid, const SUMOVehicleClass vclass) : id(vtid), length(5./*4.3*/), minGap(2.5), maxSpeed(200. / 3.6), defaultProbability(DEFAULT_VEH_PROB), - speedFactor(1.0), speedDev(0.0), - emissionClass(PollutantsInterface::getClassByName("unknown", vclass)), color(RGBColor::DEFAULT_COLOR), + speedFactor("normc", 1.0, 0.0, 0.2, 2.0), + emissionClass(PollutantsInterface::getClassByName(EMPREFIX + "PC_G_EU4", vclass)), color(RGBColor::DEFAULT_COLOR), vehicleClass(vclass), impatience(0.0), personCapacity(4), containerCapacity(0), boardingDuration(500), loadingDuration(90000), width(1.8), height(1.5), shape(SVS_UNKNOWN), osgFile("car-normal-citrus.obj"), cfModel(SUMO_TAG_CF_KRAUSS), lcModel(LCM_DEFAULT), - maxSpeedLat(1.0), latAlignment(LATALIGN_CENTER), minGapLat(0.12), + maxSpeedLat(1.0), latAlignment(LATALIGN_CENTER), minGapLat(1.00), setParameter(0), saved(false), onlyReferenced(false) { switch (vclass) { case SVC_PEDESTRIAN: @@ -66,6 +64,7 @@ width = 0.478; height = 1.719; shape = SVS_PEDESTRIAN; + emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "zero", vclass); break; case SVC_BICYCLE: length = 1.6; @@ -75,6 +74,7 @@ height = 1.7; shape = SVS_BICYCLE; personCapacity = 1; + emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "zero", vclass); break; case SVC_MOPED: length = 2.1; @@ -83,6 +83,7 @@ height = 1.7; shape = SVS_MOPED; personCapacity = 1; + emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "LDV_G_EU6", vclass); break; case SVC_MOTORCYCLE: length = 2.2; @@ -90,6 +91,7 @@ height = 1.5; shape = SVS_MOTORCYCLE; personCapacity = 1; + emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "LDV_G_EU6", vclass); break; case SVC_TRUCK: length = 7.1; @@ -100,6 +102,7 @@ osgFile = "car-microcargo-citrus.obj"; personCapacity = 2; containerCapacity = 1; + emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "HDV", vclass); break; case SVC_TRAILER: length = 16.5; @@ -110,6 +113,7 @@ osgFile = "car-microcargo-citrus.obj"; personCapacity = 2; containerCapacity = 2; + emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "HDV", vclass); break; case SVC_BUS: length = 12.; @@ -119,6 +123,7 @@ shape = SVS_BUS; osgFile = "car-minibus-citrus.obj"; personCapacity = 85; + emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "Bus", vclass); break; case SVC_COACH: length = 14.; @@ -128,6 +133,7 @@ shape = SVS_BUS_COACH; osgFile = "car-minibus-citrus.obj"; personCapacity = 70; + emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "Coach", vclass); break; case SVC_TRAM: length = 22.; @@ -136,6 +142,7 @@ height = 3.2; shape = SVS_RAIL_CAR; personCapacity = 120; + emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "zero", vclass); break; case SVC_RAIL_URBAN: length = 36.5 * 3; @@ -144,14 +151,17 @@ height = 3.6; shape = SVS_RAIL_CAR; personCapacity = 300; + emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "zero", vclass); break; case SVC_RAIL: length = 67.5 * 2; - maxSpeed = 160. / 3.6; + maxSpeed = 1600. / 3.6; width = 2.84; height = 3.75; shape = SVS_RAIL; personCapacity = 434; + // slight understatement (-: + emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "HDV_D_EU0", vclass); break; case SVC_RAIL_ELECTRIC: length = 25. * 8; @@ -160,6 +170,7 @@ height = 3.89; shape = SVS_RAIL; personCapacity = 425; + emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "zero", vclass); break; case SVC_DELIVERY: length = 6.5; @@ -167,6 +178,7 @@ height = 2.86; shape = SVS_DELIVERY; personCapacity = 2; + emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "LDV", vclass); break; case SVC_EMERGENCY: length = 6.5; @@ -174,12 +186,14 @@ height = 2.86; shape = SVS_DELIVERY; personCapacity = 2; + emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "LDV", vclass); break; case SVC_PASSENGER: shape = SVS_PASSENGER; break; case SVC_E_VEHICLE: shape = SVS_E_VEHICLE; + emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "zero", vclass); break; case SVC_SHIP: length = 17; @@ -187,6 +201,8 @@ maxSpeed = 8 / 1.94; // 8 knots height = 4; shape = SVS_SHIP; + // slight understatement (-: + emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "HDV_D_EU0", vclass); break; default: break; @@ -216,9 +232,6 @@ if (wasSet(VTYPEPARS_SPEEDFACTOR_SET)) { dev.writeAttr(SUMO_ATTR_SPEEDFACTOR, speedFactor); } - if (wasSet(VTYPEPARS_SPEEDDEVIATION_SET)) { - dev.writeAttr(SUMO_ATTR_SPEEDDEV, speedDev); - } if (wasSet(VTYPEPARS_VEHICLECLASS_SET)) { dev.writeAttr(SUMO_ATTR_VCLASS, toString(vehicleClass)); } @@ -226,7 +239,7 @@ dev.writeAttr(SUMO_ATTR_EMISSIONCLASS, PollutantsInterface::getName(emissionClass)); } if (wasSet(VTYPEPARS_IMPATIENCE_SET)) { - if (impatience == -std::numeric_limits::max()) { + if (impatience == -std::numeric_limits::max()) { dev.writeAttr(SUMO_ATTR_IMPATIENCE, "off"); } else { dev.writeAttr(SUMO_ATTR_IMPATIENCE, impatience); @@ -294,18 +307,23 @@ } dev.closeTag(); } - for (std::map::const_iterator j = getMap().begin(); j != getMap().end(); ++j) { - dev.openTag(SUMO_TAG_PARAM); - dev.writeAttr(SUMO_ATTR_KEY, (*j).first); - dev.writeAttr(SUMO_ATTR_VALUE, (*j).second); - dev.closeTag(); - } + writeParams(dev); dev.closeTag(); } -SUMOReal -SUMOVTypeParameter::getCFParam(const SumoXMLAttr attr, const SUMOReal defaultValue) const { +double +SUMOVTypeParameter::getCFParam(const SumoXMLAttr attr, const double defaultValue) const { + if (cfParameter.count(attr)) { + return TplConvert::_str2double(cfParameter.find(attr)->second); + } else { + return defaultValue; + } +} + + +std::string +SUMOVTypeParameter::getCFParamString(const SumoXMLAttr attr, const std::string defaultValue) const { if (cfParameter.count(attr)) { return cfParameter.find(attr)->second; } else { @@ -313,10 +331,10 @@ } } -SUMOReal -SUMOVTypeParameter::getLCParam(const SumoXMLAttr attr, const SUMOReal defaultValue) const { +double +SUMOVTypeParameter::getLCParam(const SumoXMLAttr attr, const double defaultValue) const { if (lcParameter.count(attr)) { - return lcParameter.find(attr)->second; + return TplConvert::_str2double(lcParameter.find(attr)->second); } else { return defaultValue; } @@ -324,7 +342,7 @@ -SUMOReal +double SUMOVTypeParameter::getDefaultAccel(const SUMOVehicleClass vc) { switch (vc) { case SVC_PEDESTRIAN: @@ -359,7 +377,7 @@ } -SUMOReal +double SUMOVTypeParameter::getDefaultDecel(const SUMOVehicleClass vc) { switch (vc) { case SVC_PEDESTRIAN: @@ -394,7 +412,43 @@ } -SUMOReal +double +SUMOVTypeParameter::getDefaultEmergencyDecel(const SUMOVehicleClass vc) { + switch (vc) { + case SVC_PEDESTRIAN: + return 3.; + case SVC_BICYCLE: + return 5.; + case SVC_MOPED: + return 8.; + case SVC_MOTORCYCLE: + return 10.; + case SVC_TRUCK: + return 7.; + case SVC_TRAILER: + return 7.; + case SVC_BUS: + return 7.; + case SVC_COACH: + return 7.; + case SVC_TRAM: + return 5.; + case SVC_RAIL_URBAN: + return 5.; + case SVC_RAIL: + return 4; + case SVC_RAIL_ELECTRIC: + return 4; + case SVC_SHIP: + return 1; + default: + return 9;//7.5; + } +} + + + +double SUMOVTypeParameter::getDefaultImperfection(const SUMOVehicleClass vc) { switch (vc) { case SVC_TRAM: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/SUMOVTypeParameter.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/SUMOVTypeParameter.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/vehicle/SUMOVTypeParameter.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/vehicle/SUMOVTypeParameter.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 10.09.2009 -/// @version $Id: SUMOVTypeParameter.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: SUMOVTypeParameter.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Structure representing possible vehicle parameter /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -29,7 +29,9 @@ #ifdef _MSC_VER #include #else + #include + #endif #include @@ -38,11 +40,13 @@ #include #include #include +#include // =========================================================================== // class declarations // =========================================================================== class OutputDevice; + class OptionsCont; @@ -50,29 +54,28 @@ // value definitions // =========================================================================== const int VTYPEPARS_LENGTH_SET = 1; -const int VTYPEPARS_MINGAP_SET = 2; -const int VTYPEPARS_MAXSPEED_SET = 2 << 2; -const int VTYPEPARS_PROBABILITY_SET = 2 << 3; -const int VTYPEPARS_SPEEDFACTOR_SET = 2 << 4; -const int VTYPEPARS_SPEEDDEVIATION_SET = 2 << 5; -const int VTYPEPARS_EMISSIONCLASS_SET = 2 << 6; -const int VTYPEPARS_COLOR_SET = 2 << 7; -const int VTYPEPARS_VEHICLECLASS_SET = 2 << 8; -const int VTYPEPARS_WIDTH_SET = 2 << 9; -const int VTYPEPARS_HEIGHT_SET = 2 << 10; -const int VTYPEPARS_SHAPE_SET = 2 << 11; -const int VTYPEPARS_OSGFILE_SET = 2 << 12; -const int VTYPEPARS_IMGFILE_SET = 2 << 13; -const int VTYPEPARS_IMPATIENCE_SET = 2 << 14; -const int VTYPEPARS_LANE_CHANGE_MODEL_SET = 2 << 15; -const int VTYPEPARS_PERSON_CAPACITY = 2 << 16; -const int VTYPEPARS_BOARDING_DURATION = 2 << 17; -const int VTYPEPARS_CONTAINER_CAPACITY = 2 << 18; -const int VTYPEPARS_LOADING_DURATION = 2 << 19; -const int VTYPEPARS_CAR_FOLLOW_MODEL = 2 << 20; -const int VTYPEPARS_MAXSPEED_LAT_SET = 2 << 21; -const int VTYPEPARS_LATALIGNMENT_SET = 2 << 22; -const int VTYPEPARS_MINGAP_LAT_SET = 2 << 23; +const int VTYPEPARS_MINGAP_SET = 1 << 1; +const int VTYPEPARS_MAXSPEED_SET = 1 << 2; +const int VTYPEPARS_PROBABILITY_SET = 1 << 3; +const int VTYPEPARS_SPEEDFACTOR_SET = 1 << 4; +const int VTYPEPARS_EMISSIONCLASS_SET = 1 << 5; +const int VTYPEPARS_COLOR_SET = 1 << 6; +const int VTYPEPARS_VEHICLECLASS_SET = 1 << 7; +const int VTYPEPARS_WIDTH_SET = 1 << 8; +const int VTYPEPARS_HEIGHT_SET = 1 << 9; +const int VTYPEPARS_SHAPE_SET = 1 << 10; +const int VTYPEPARS_OSGFILE_SET = 1 << 11; +const int VTYPEPARS_IMGFILE_SET = 1 << 12; +const int VTYPEPARS_IMPATIENCE_SET = 1 << 13; +const int VTYPEPARS_LANE_CHANGE_MODEL_SET = 1 << 14; +const int VTYPEPARS_PERSON_CAPACITY = 1 << 15; +const int VTYPEPARS_BOARDING_DURATION = 1 << 16; +const int VTYPEPARS_CONTAINER_CAPACITY = 1 << 17; +const int VTYPEPARS_LOADING_DURATION = 1 << 18; +const int VTYPEPARS_CAR_FOLLOW_MODEL = 1 << 19; +const int VTYPEPARS_MAXSPEED_LAT_SET = 1 << 20; +const int VTYPEPARS_LATALIGNMENT_SET = 1 << 21; +const int VTYPEPARS_MINGAP_LAT_SET = 1 << 22; // =========================================================================== @@ -117,31 +120,36 @@ * @param[in] defaultValue The value to return if the given map does not contain the named variable * @return The named value from the map or the default if it does not exist there */ - SUMOReal getCFParam(const SumoXMLAttr attr, const SUMOReal defaultValue) const; + double getCFParam(const SumoXMLAttr attr, const double defaultValue) const; + + /** @brief Returns the named value from the map, or the default if it is not contained there + * @param[in] attr The corresponding xml attribute + * @param[in] defaultValue The value to return if the given map does not contain the named variable + * @return The named value from the map or the default if it does not exist there + */ + std::string getCFParamString(const SumoXMLAttr attr, const std::string defaultValue) const; /** @brief Returns the named value from the map, or the default if it is not contained there * @param[in] attr The corresponding xml attribute * @param[in] defaultValue The value to return if the given map does not contain the named variable * @return The named value from the map or the default if it does not exist there */ - SUMOReal getLCParam(const SumoXMLAttr attr, const SUMOReal defaultValue) const; + double getLCParam(const SumoXMLAttr attr, const double defaultValue) const; /// @brief The vehicle type's id std::string id; /// @brief The physical vehicle length - SUMOReal length; + double length; /// @brief This class' free space in front of the vehicle itself - SUMOReal minGap; + double minGap; /// @brief The vehicle type's maximum speed [m/s] - SUMOReal maxSpeed; + double maxSpeed; /// @brief The probability when being added to a distribution without an explicit probability - SUMOReal defaultProbability; + double defaultProbability; /// @brief The factor by which the maximum speed may deviate from the allowed max speed on the street - SUMOReal speedFactor; - /// @brief The standard deviation for speed variations - SUMOReal speedDev; + Distribution_Parameterized speedFactor; /// @brief The emission class of this vehicle SUMOEmissionClass emissionClass; /// @brief The color @@ -149,7 +157,7 @@ /// @brief The vehicle's class SUMOVehicleClass vehicleClass; /// @brief The vehicle's impatience (willingness to obstruct others) - SUMOReal impatience; + double impatience; /// @brief The person capacity of the vehicle int personCapacity; /// @brief The container capacity of the vehicle @@ -163,10 +171,10 @@ /// @{ /// @brief This class' width - SUMOReal width; + double width; /// @brief This class' height - SUMOReal height; + double height; /// @brief This class' shape SUMOVehicleShape shape; @@ -183,7 +191,7 @@ SumoXMLTag cfModel; /// @brief sub-model parameters - typedef std::map SubParams; + typedef std::map SubParams; /// @brief Car-following parameter SubParams cfParameter; /// @brief Lane-changing parameter @@ -193,11 +201,11 @@ LaneChangeModel lcModel; /// @brief The vehicle type's maximum lateral speed [m/s] - SUMOReal maxSpeedLat; + double maxSpeedLat; /// @brief The vehicles desired lateral alignment LateralAlignment latAlignment; /// @brief The vehicle type's minimum lateral gap [m] - SUMOReal minGapLat; + double minGapLat; /// @brief Information for the router which parameter were set int setParameter; @@ -214,21 +222,28 @@ * @param[in] vc the vehicle class * @return the acceleration in m/s^2 */ - static SUMOReal getDefaultAccel(const SUMOVehicleClass vc = SVC_IGNORING); + static double getDefaultAccel(const SUMOVehicleClass vc = SVC_IGNORING); /** @brief Returns the default deceleration for the given vehicle class * This needs to be a function because the actual value is stored in the car following model * @param[in] vc the vehicle class * @return the deceleration in m/s^2 */ - static SUMOReal getDefaultDecel(const SUMOVehicleClass vc = SVC_IGNORING); + static double getDefaultDecel(const SUMOVehicleClass vc = SVC_IGNORING); + + /** @brief Returns the default emergency deceleration for the given vehicle class + * This needs to be a function because the actual value is stored in the car following model + * @param[in] vc the vehicle class + * @return the deceleration in m/s^2 + */ + static double getDefaultEmergencyDecel(const SUMOVehicleClass vc = SVC_IGNORING); /** @brief Returns the default driver's imperfection (sigma or epsilon in Krauss' model) for the given vehicle class * This needs to be a function because the actual value is stored in the car following model * @param[in] vc the vehicle class * @return the imperfection as a value between 0 and 1 */ - static SUMOReal getDefaultImperfection(const SUMOVehicleClass vc = SVC_IGNORING); + static double getDefaultImperfection(const SUMOVehicleClass vc = SVC_IGNORING); /// @brief return the default parameters, this is a function due to the http://www.parashift.com/c++-faq/static-init-order.html static const SUMOVTypeParameter& getDefault(); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/GenericSAXHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/GenericSAXHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/GenericSAXHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/GenericSAXHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Sept 2002 -/// @version $Id: GenericSAXHandler.cpp 21202 2016-07-19 13:40:35Z behrisch $ +/// @version $Id: GenericSAXHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A handler which converts occuring elements and attributes into enums /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,10 +41,6 @@ #include "SUMOSAXAttributesImpl_Xerces.h" #include "XMLSubSys.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // class definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/GenericSAXHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/GenericSAXHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/GenericSAXHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/GenericSAXHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: GenericSAXHandler.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GenericSAXHandler.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A handler which converts occuring elements and attributes into enums /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -4,6 +4,7 @@ SUMOSAXAttributes.cpp SUMOSAXAttributes.h \ SUMOSAXAttributesImpl_Binary.cpp SUMOSAXAttributesImpl_Binary.h \ SUMOSAXAttributesImpl_Xerces.cpp SUMOSAXAttributesImpl_Xerces.h \ +SUMOSAXAttributesImpl_Cached.cpp SUMOSAXAttributesImpl_Cached.h \ SUMORouteHandler.cpp SUMORouteHandler.h \ SUMORouteLoader.cpp SUMORouteLoader.h \ SUMORouteLoaderControl.cpp SUMORouteLoaderControl.h \ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -102,6 +102,7 @@ SUMOSAXAttributes.$(OBJEXT) \ SUMOSAXAttributesImpl_Binary.$(OBJEXT) \ SUMOSAXAttributesImpl_Xerces.$(OBJEXT) \ + SUMOSAXAttributesImpl_Cached.$(OBJEXT) \ SUMORouteHandler.$(OBJEXT) SUMORouteLoader.$(OBJEXT) \ SUMORouteLoaderControl.$(OBJEXT) SUMOSAXHandler.$(OBJEXT) \ SUMOSAXReader.$(OBJEXT) SUMOVehicleParserHelper.$(OBJEXT) \ @@ -339,6 +340,7 @@ SUMOSAXAttributes.cpp SUMOSAXAttributes.h \ SUMOSAXAttributesImpl_Binary.cpp SUMOSAXAttributesImpl_Binary.h \ SUMOSAXAttributesImpl_Xerces.cpp SUMOSAXAttributesImpl_Xerces.h \ +SUMOSAXAttributesImpl_Cached.cpp SUMOSAXAttributesImpl_Cached.h \ SUMORouteHandler.cpp SUMORouteHandler.h \ SUMORouteLoader.cpp SUMORouteLoader.h \ SUMORouteLoaderControl.cpp SUMORouteLoaderControl.h \ @@ -405,6 +407,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SUMORouteLoaderControl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SUMOSAXAttributes.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SUMOSAXAttributesImpl_Binary.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SUMOSAXAttributesImpl_Cached.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SUMOSAXAttributesImpl_Xerces.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SUMOSAXHandler.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SUMOSAXReader.Po@am__quote@ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SAXWeightsHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SAXWeightsHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SAXWeightsHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SAXWeightsHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Fri, 30 Mar 2007 -/// @version $Id: SAXWeightsHandler.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SAXWeightsHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // An XML-handler for network weights /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,6 @@ #include #include "SAXWeightsHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -90,8 +86,8 @@ switch (element) { case SUMO_TAG_INTERVAL: { bool ok = true; - myCurrentTimeBeg = attrs.get(SUMO_ATTR_BEGIN, 0, ok); - myCurrentTimeEnd = attrs.get(SUMO_ATTR_END, 0, ok); + myCurrentTimeBeg = attrs.get(SUMO_ATTR_BEGIN, 0, ok); + myCurrentTimeEnd = attrs.get(SUMO_ATTR_END, 0, ok); } break; case SUMO_TAG_EDGE: { @@ -156,7 +152,7 @@ for (i = myDefinitions.begin(); i != myDefinitions.end(); ++i) { if ((*i)->myHadAttribute) { (*i)->myDestination.addEdgeWeight(myCurrentEdgeID, - (*i)->myAggValue / (SUMOReal)(*i)->myNoLanes, + (*i)->myAggValue / (double)(*i)->myNoLanes, myCurrentTimeBeg, myCurrentTimeEnd); } } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SAXWeightsHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SAXWeightsHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SAXWeightsHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SAXWeightsHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Fri, 30 Mar 2007 -/// @version $Id: SAXWeightsHandler.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: SAXWeightsHandler.h 23150 2017-02-27 12:08:30Z behrisch $ /// // An XML-handler for network weights /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -95,7 +95,7 @@ * @param[in] end The end of the interval the weight is valid for */ virtual void addEdgeWeight(const std::string& id, - SUMOReal val, SUMOReal beg, SUMOReal end) const = 0; + double val, double beg, double end) const = 0; private: EdgeFloatTimeLineRetriever& operator=(const EdgeFloatTimeLineRetriever&); // just to avoid a compiler warning @@ -125,7 +125,7 @@ EdgeFloatTimeLineRetriever& myDestination; /// aggregated value over the lanes read within the current edge - SUMOReal myAggValue; + double myAggValue; /// The number of lanes read for the current edge int myNoLanes; @@ -200,10 +200,10 @@ std::vector myDefinitions; /// the begin of the time period that is currently processed - SUMOReal myCurrentTimeBeg; + double myCurrentTimeBeg; /// the end of the time period that is currently processed - SUMOReal myCurrentTimeEnd; + double myCurrentTimeEnd; /// the edge which is currently being processed std::string myCurrentEdgeID; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMORouteHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMORouteHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMORouteHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMORouteHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Sascha Krieg /// @author Michael Behrisch /// @date Mon, 9 Jul 2001 -/// @version $Id: SUMORouteHandler.cpp 20596 2016-04-29 08:47:23Z palcraft $ +/// @version $Id: SUMORouteHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Parser for routes during their loading /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -43,10 +43,6 @@ #include #include "SUMORouteHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -208,8 +204,8 @@ bool -SUMORouteHandler::checkStopPos(SUMOReal& startPos, SUMOReal& endPos, const SUMOReal laneLength, - const SUMOReal minLength, const bool friendlyPos) { +SUMORouteHandler::checkStopPos(double& startPos, double& endPos, const double laneLength, + const double minLength, const bool friendlyPos) { if (minLength > laneLength) { return false; } @@ -287,12 +283,15 @@ stop.busstop = attrs.getOpt(SUMO_ATTR_BUS_STOP, 0, ok, ""); stop.chargingStation = attrs.getOpt(SUMO_ATTR_CHARGING_STATION, 0, ok, ""); stop.containerstop = attrs.getOpt(SUMO_ATTR_CONTAINER_STOP, 0, ok, ""); + stop.parkingarea = attrs.getOpt(SUMO_ATTR_PARKING_AREA, 0, ok, ""); if (stop.busstop != "") { errorSuffix = " at '" + stop.busstop + "'" + errorSuffix; } else if (stop.chargingStation != "") { errorSuffix = " at '" + stop.chargingStation + "'" + errorSuffix; } else if (stop.containerstop != "") { errorSuffix = " at '" + stop.containerstop + "'" + errorSuffix; + } else if (stop.parkingarea != "") { + errorSuffix = " at '" + stop.parkingarea + "'" + errorSuffix; } else { errorSuffix = " on lane '" + stop.lane + "'" + errorSuffix; } @@ -317,7 +316,10 @@ stop.triggered = attrs.getOpt(SUMO_ATTR_TRIGGERED, 0, ok, false); stop.containerTriggered = attrs.getOpt(SUMO_ATTR_CONTAINER_TRIGGERED, 0, ok, false); } - stop.parking = attrs.getOpt(SUMO_ATTR_PARKING, 0, ok, stop.triggered || stop.containerTriggered); + stop.parking = attrs.getOpt(SUMO_ATTR_PARKING, 0, ok, stop.triggered || stop.containerTriggered || stop.parkingarea != ""); + if (stop.parkingarea != "" && !stop.parking) { + ok = false; + } if (!ok) { errorOutput->inform("Invalid bool for 'triggered', 'containerTriggered' or 'parking' for stop" + errorSuffix); return false; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMORouteHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMORouteHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMORouteHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMORouteHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 9 Jul 2001 -/// @version $Id: SUMORouteHandler.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SUMORouteHandler.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Parser for routes during their loading /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -67,8 +67,8 @@ SUMOTime getLastDepart() const; /// check start and end position of a stop - static bool checkStopPos(SUMOReal& startPos, SUMOReal& endPos, const SUMOReal laneLength, - const SUMOReal minLength, const bool friendlyPos); + static bool checkStopPos(double& startPos, double& endPos, const double laneLength, + const double minLength, const bool friendlyPos); /// @brief returns the first departure time that was ever read SUMOTime getFirstDepart() const { @@ -163,13 +163,13 @@ std::string myActiveRouteRefID; /// @brief The probability of the current route - SUMOReal myActiveRouteProbability; + double myActiveRouteProbability; /// @brief The currently parsed route's color const RGBColor* myActiveRouteColor; /// @brief The currently parsed route costs - SUMOReal myCurrentCosts; + double myCurrentCosts; /// @brief List of the stops on the parsed route std::vector myActiveRouteStops; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMORouteLoaderControl.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMORouteLoaderControl.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMORouteLoaderControl.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMORouteLoaderControl.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Wed, 06 Nov 2002 -/// @version $Id: SUMORouteLoaderControl.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SUMORouteLoaderControl.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Class responsible for loading of routes from some files /****************************************************************************/ @@ -35,10 +35,6 @@ #include "SUMORouteLoader.h" #include "SUMORouteLoaderControl.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMORouteLoaderControl.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMORouteLoaderControl.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMORouteLoaderControl.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMORouteLoaderControl.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Wed, 06 Nov 2002 -/// @version $Id: SUMORouteLoaderControl.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SUMORouteLoaderControl.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Class responsible for loading of routes from some files /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMORouteLoader.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMORouteLoader.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMORouteLoader.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMORouteLoader.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 6 Nov 2002 -/// @version $Id: SUMORouteLoader.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SUMORouteLoader.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // A class that performs the loading of routes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -33,10 +33,6 @@ #include #include "SUMORouteLoader.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMORouteLoader.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMORouteLoader.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMORouteLoader.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMORouteLoader.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Wed, 6 Nov 2002 -/// @version $Id: SUMORouteLoader.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SUMORouteLoader.h 22608 2017-01-17 06:28:54Z behrisch $ /// // A class that performs the loading of routes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributes.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributes.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributes.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributes.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Fri, 30 Mar 2007 -/// @version $Id: SUMOSAXAttributes.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SUMOSAXAttributes.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Encapsulated SAX-Attributes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,10 +40,6 @@ #include #include "SUMOSAXAttributes.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members @@ -198,10 +194,10 @@ } -template<> const SUMOReal invalid_return::value = -1; -template<> const std::string invalid_return::type = "float"; +template<> const double invalid_return::value = -1; +template<> const std::string invalid_return::type = "float"; template<> -SUMOReal SUMOSAXAttributes::getInternal(const int attr) const { +double SUMOSAXAttributes::getInternal(const int attr) const { return getFloat(attr); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributes.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributes.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributes.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributes.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Fri, 30 Mar 2007 -/// @version $Id: SUMOSAXAttributes.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SUMOSAXAttributes.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Encapsulated SAX-Attributes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -116,7 +116,7 @@ * * Otherwise, "ok" is not changed. * - * In dependence to the used time representation, either get or get + * In dependence to the used time representation, either get or get * is used. * * @param[in] attr The id of the attribute to read @@ -138,7 +138,7 @@ * * Otherwise, "ok" is not changed. * - * In dependence to the used time representation, either get or get + * In dependence to the used time representation, either get or get * is used. * * @param[in] attr The id of the attribute to read @@ -257,39 +257,39 @@ /** - * @brief Returns the SUMOReal-value of the named (by its enum-value) attribute + * @brief Returns the double-value of the named (by its enum-value) attribute * * Tries to retrieve the attribute from the the attribute list. The retrieved - * attribute (which may be 0) is then parsed using TplConvert::_2SUMOReal. - * If the attribute is empty or ==0, TplConvert::_2SUMOReal throws an + * attribute (which may be 0) is then parsed using TplConvert::_2double. + * If the attribute is empty or ==0, TplConvert::_2double throws an * EmptyData-exception which is passed. - * If the value can not be parsed to a SUMOReal, TplConvert::_2SUMOReal throws a + * If the value can not be parsed to a double, TplConvert::_2double throws a * NumberFormatException-exception which is passed. * * @param[in] id The id of the attribute to return the value of * @return The attribute's value as a float, if it could be read and parsed * @exception EmptyData If the attribute is not known or the attribute value is an empty string - * @exception NumberFormatException If the attribute value can not be parsed to an SUMOReal + * @exception NumberFormatException If the attribute value can not be parsed to an double */ - virtual SUMOReal getFloat(int id) const = 0; + virtual double getFloat(int id) const = 0; /** - * @brief Returns the SUMOReal-value of the named attribute + * @brief Returns the double-value of the named attribute * * Tries to retrieve the attribute from the the attribute list. The retrieved - * attribute (which may be 0) is then parsed using TplConvert::_2SUMOReal. - * If the attribute is empty or ==0, TplConvert::_2SUMOReal throws an + * attribute (which may be 0) is then parsed using TplConvert::_2double. + * If the attribute is empty or ==0, TplConvert::_2double throws an * EmptyData-exception which is passed. - * If the value can not be parsed to a SUMOReal, TplConvert::_2SUMOReal throws a + * If the value can not be parsed to a double, TplConvert::_2double throws a * NumberFormatException-exception which is passed. * * @param[in] id The name of the attribute to return the value of * @return The attribute's value as a float, if it could be read and parsed * @exception EmptyData If the attribute is not known or the attribute value is an empty string - * @exception NumberFormatException If the attribute value can not be parsed to an SUMOReal + * @exception NumberFormatException If the attribute value can not be parsed to an double */ - virtual SUMOReal getFloat(const std::string& id) const = 0; + virtual double getFloat(const std::string& id) const = 0; /** @@ -378,6 +378,9 @@ friend std::ostream& operator<<(std::ostream& os, const SUMOSAXAttributes& src); + /// @brief return a new deep-copy attributes object + virtual SUMOSAXAttributes* clone() const = 0; + /** @brief The encoding of parsed strings */ static const std::string ENCODING; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Binary.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Binary.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Binary.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Binary.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: SUMOSAXAttributesImpl_Binary.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SUMOSAXAttributesImpl_Binary.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// -// Encapsulated Xerces-SAX-attributes +// Encapsulated xml-attributes that are retrieved from the sumo-binary-xml format (already typed) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -39,10 +39,7 @@ #include #include #include "SUMOSAXAttributesImpl_Binary.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS +#include "SUMOSAXAttributesImpl_Cached.h" // =========================================================================== @@ -51,10 +48,17 @@ SUMOSAXAttributesImpl_Binary::SUMOSAXAttributesImpl_Binary( const std::map& predefinedTagsMML, const std::string& objectType, - BinaryInputDevice* in) : SUMOSAXAttributes(objectType), myAttrIds(predefinedTagsMML) { + BinaryInputDevice* in, const char version) : SUMOSAXAttributes(objectType), myAttrIds(predefinedTagsMML) { while (in->peek() == BinaryFormatter::BF_XML_ATTRIBUTE) { - unsigned char attr; - *in >> attr; + int attr; + unsigned char attrByte; + *in >> attrByte; + attr = attrByte; + if (version > 1) { + in->putback(BinaryFormatter::BF_BYTE); + *in >> attrByte; + attr += 256 * attrByte; + } int type = in->peek(); switch (type) { case BinaryFormatter::BF_BYTE: @@ -148,7 +152,7 @@ break; } default: - throw ProcessError("Invalid binary file"); + throw ProcessError("Binary file is invalid, attribute type is unknown."); } myAttrs.insert(attr); } @@ -212,17 +216,17 @@ } -SUMOReal +double SUMOSAXAttributesImpl_Binary::getFloat(int id) const { - const std::map::const_iterator i = myFloatValues.find(id); + const std::map::const_iterator i = myFloatValues.find(id); if (i == myFloatValues.end()) { - return TplConvert::_2SUMOReal(getString(id).c_str()); + return TplConvert::_2double(getString(id).c_str()); } return i->second; } -SUMOReal +double SUMOSAXAttributesImpl_Binary::getFloat(const std::string& /* id */) const { throw ProcessError("not implemented for binary data"); } @@ -330,5 +334,31 @@ } +SUMOSAXAttributes* +SUMOSAXAttributesImpl_Binary::clone() const { + std::map attrs; + for (std::map::const_iterator it = myCharValues.begin(); it != myCharValues.end(); ++it) { + const std::string attrName = myAttrIds.find(it->first)->second; + attrs[attrName] = toString(it->second); + } + for (std::map::const_iterator it = myIntValues.begin(); it != myIntValues.end(); ++it) { + const std::string attrName = myAttrIds.find(it->first)->second; + attrs[attrName] = toString(it->second); + } + for (std::map::const_iterator it = myFloatValues.begin(); it != myFloatValues.end(); ++it) { + const std::string attrName = myAttrIds.find(it->first)->second; + attrs[attrName] = toString(it->second); + } + for (std::map::const_iterator it = myStringValues.begin(); it != myStringValues.end(); ++it) { + const std::string attrName = myAttrIds.find(it->first)->second; + attrs[attrName] = it->second; + } + for (std::map::const_iterator it = myPositionVectors.begin(); it != myPositionVectors.end(); ++it) { + const std::string attrName = myAttrIds.find(it->first)->second; + attrs[attrName] = toString(it->second); + } + return new SUMOSAXAttributesImpl_Cached(attrs, myAttrIds, getObjectType()); +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Binary.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Binary.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Binary.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Binary.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Fri, 30 Mar 2007 -/// @version $Id: SUMOSAXAttributesImpl_Binary.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SUMOSAXAttributesImpl_Binary.h 23150 2017-02-27 12:08:30Z behrisch $ /// -// Encapsulated Xerces-SAX-attributes +// Encapsulated xml-attributes that are retrieved from the sumo-binary-xml format (already typed) /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -62,8 +62,7 @@ */ SUMOSAXAttributesImpl_Binary(const std::map& predefinedTagsMML, const std::string& objectType, - BinaryInputDevice* in); - + BinaryInputDevice* in, const char version); /// @brief Destructor virtual ~SUMOSAXAttributesImpl_Binary(); @@ -167,21 +166,21 @@ /** - * @brief Returns the SUMOReal-value of the named (by its enum-value) attribute + * @brief Returns the double-value of the named (by its enum-value) attribute * * Tries to retrieve the attribute from the the attribute list. The retrieved - * attribute (which may be 0) is then parsed using TplConvert::_2SUMOReal. - * If the attribute is empty or ==0, TplConvert::_2SUMOReal throws an + * attribute (which may be 0) is then parsed using TplConvert::_2double. + * If the attribute is empty or ==0, TplConvert::_2double throws an * EmptyData-exception which is passed. - * If the value can not be parsed to a SUMOReal, TplConvert::_2SUMOReal throws a + * If the value can not be parsed to a double, TplConvert::_2double throws a * NumberFormatException-exception which is passed. * * @param[in] id The id of the attribute to return the value of * @return The attribute's value as a float, if it could be read and parsed * @exception EmptyData If the attribute is not known or the attribute value is an empty string - * @exception NumberFormatException If the attribute value can not be parsed to an SUMOReal + * @exception NumberFormatException If the attribute value can not be parsed to an double */ - SUMOReal getFloat(int id) const; + double getFloat(int id) const; /** @@ -191,21 +190,21 @@ /** - * @brief Returns the SUMOReal-value of the named attribute + * @brief Returns the double-value of the named attribute * * Tries to retrieve the attribute from the the attribute list. The retrieved - * attribute (which may be 0) is then parsed using TplConvert::_2SUMOReal. - * If the attribute is empty or ==0, TplConvert::_2SUMOReal throws an + * attribute (which may be 0) is then parsed using TplConvert::_2double. + * If the attribute is empty or ==0, TplConvert::_2double throws an * EmptyData-exception which is passed. - * If the value can not be parsed to a SUMOReal, TplConvert::_2SUMOReal throws a + * If the value can not be parsed to a double, TplConvert::_2double throws a * NumberFormatException-exception which is passed. * * @param[in] id The name of the attribute to return the value of * @return The attribute's value as a float, if it could be read and parsed * @exception EmptyData If the attribute is not known or the attribute value is an empty string - * @exception NumberFormatException If the attribute value can not be parsed to an SUMOReal + * @exception NumberFormatException If the attribute value can not be parsed to an double */ - SUMOReal getFloat(const std::string& id) const; + double getFloat(const std::string& id) const; /** @@ -288,6 +287,8 @@ */ void serialize(std::ostream& os) const; + /// @brief return a new deep-copy attributes object + SUMOSAXAttributes* clone() const; private: /// @brief Map of attribute ids to names @@ -303,7 +304,7 @@ std::map myIntValues; /// @brief Map of attribute ids to floats - std::map myFloatValues; + std::map myFloatValues; /// @brief Map of attribute ids to string std::map myStringValues; diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Cached.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Cached.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Cached.cpp 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Cached.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,245 @@ +/****************************************************************************/ +/// @file SUMOSAXAttributesImpl_Cached.cpp +/// @author Jakob Erdmann +/// @date Dec 2016 +/// @version $Id: SUMOSAXAttributesImpl_Cached.cpp 23529 2017-03-18 10:22:36Z behrisch $ +/// +// Encapsulated xml-attributes that use a map from string-attr-names to string-attr-values as backend +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "SUMOSAXAttributesImpl_Cached.h" +#include "SUMOSAXAttributesImpl_Cached.h" + + +// =========================================================================== +// class definitions +// =========================================================================== +SUMOSAXAttributesImpl_Cached::SUMOSAXAttributesImpl_Cached( + const std::map& attrs, + const std::map& predefinedTagsMML, + const std::string& objectType) : + SUMOSAXAttributes(objectType), + myAttrs(attrs), + myPredefinedTagsMML(predefinedTagsMML) { } + + +SUMOSAXAttributesImpl_Cached::~SUMOSAXAttributesImpl_Cached() { +} + + +bool +SUMOSAXAttributesImpl_Cached::hasAttribute(int id) const { + std::map::const_iterator i = myPredefinedTagsMML.find(id); + if (i == myPredefinedTagsMML.end()) { + return false; + } + return myAttrs.find((*i).second) != myAttrs.end(); +} + + +bool +SUMOSAXAttributesImpl_Cached::getBool(int id) const { + return TplConvert::_2bool(getAttributeValueSecure(id)); +} + + +int +SUMOSAXAttributesImpl_Cached::getInt(int id) const { + return TplConvert::_2int(getAttributeValueSecure(id)); +} + + +long long int +SUMOSAXAttributesImpl_Cached::getLong(int id) const { + return TplConvert::_2long(getAttributeValueSecure(id)); +} + + +std::string +SUMOSAXAttributesImpl_Cached::getString(int id) const { + return getAttributeValueSecure(id); +} + + +std::string +SUMOSAXAttributesImpl_Cached::getStringSecure(int id, + const std::string& str) const { + std::string result = getAttributeValueSecure(id); + return result.size() == 0 ? str : result; +} + + +double +SUMOSAXAttributesImpl_Cached::getFloat(int id) const { + return TplConvert::_2double(getAttributeValueSecure(id)); +} + + +const char* +SUMOSAXAttributesImpl_Cached::getAttributeValueSecure(int id) const { + std::map::const_iterator i = myPredefinedTagsMML.find(id); + assert(i != myPredefinedTagsMML.end()); + return myAttrs.find((*i).second)->second.c_str(); +} + + +double +SUMOSAXAttributesImpl_Cached::getFloat(const std::string& id) const { + return TplConvert::_2double(myAttrs.find(id)->second.c_str()); +} + + +bool +SUMOSAXAttributesImpl_Cached::hasAttribute(const std::string& id) const { + return myAttrs.find(id) != myAttrs.end(); +} + + +std::string +SUMOSAXAttributesImpl_Cached::getStringSecure(const std::string& id, + const std::string& str) const { + std::map::const_iterator it = myAttrs.find(id); + if (it != myAttrs.end() && it->second != "") { + return it->second; + } else { + return str; + } +} + + +SumoXMLEdgeFunc +SUMOSAXAttributesImpl_Cached::getEdgeFunc(bool& ok) const { + if (hasAttribute(SUMO_ATTR_FUNCTION)) { + std::string funcString = getString(SUMO_ATTR_FUNCTION); + if (SUMOXMLDefinitions::EdgeFunctions.hasString(funcString)) { + return SUMOXMLDefinitions::EdgeFunctions.get(funcString); + } + ok = false; + } + return EDGEFUNC_NORMAL; +} + + +SumoXMLNodeType +SUMOSAXAttributesImpl_Cached::getNodeType(bool& ok) const { + if (hasAttribute(SUMO_ATTR_TYPE)) { + std::string typeString = getString(SUMO_ATTR_TYPE); + if (SUMOXMLDefinitions::NodeTypes.hasString(typeString)) { + return SUMOXMLDefinitions::NodeTypes.get(typeString); + } + ok = false; + } + return NODETYPE_UNKNOWN; +} + + +RGBColor +SUMOSAXAttributesImpl_Cached::getColor() const { + return RGBColor::parseColor(getString(SUMO_ATTR_COLOR)); +} + + +PositionVector +SUMOSAXAttributesImpl_Cached::getShape(int attr) const { + StringTokenizer st(getString(attr)); + PositionVector shape; + while (st.hasNext()) { + StringTokenizer pos(st.next(), ","); + if (pos.size() != 2 && pos.size() != 3) { + throw FormatException("shape format"); + } + double x = TplConvert::_2double(pos.next().c_str()); + double y = TplConvert::_2double(pos.next().c_str()); + if (pos.size() == 2) { + shape.push_back(Position(x, y)); + } else { + double z = TplConvert::_2double(pos.next().c_str()); + shape.push_back(Position(x, y, z)); + } + } + return shape; +} + + +Boundary +SUMOSAXAttributesImpl_Cached::getBoundary(int attr) const { + std::string def = getString(attr); + StringTokenizer st(def, ","); + if (st.size() != 4) { + throw FormatException("boundary format"); + } + const double xmin = TplConvert::_2double(st.next().c_str()); + const double ymin = TplConvert::_2double(st.next().c_str()); + const double xmax = TplConvert::_2double(st.next().c_str()); + const double ymax = TplConvert::_2double(st.next().c_str()); + return Boundary(xmin, ymin, xmax, ymax); +} + + +std::vector +SUMOSAXAttributesImpl_Cached::getStringVector(int attr) const { + std::string def = getString(attr); + std::vector ret; + parseStringVector(def, ret); + return ret; +} + + +std::string +SUMOSAXAttributesImpl_Cached::getName(int attr) const { + if (myPredefinedTagsMML.find(attr) == myPredefinedTagsMML.end()) { + return "?"; + } + return myPredefinedTagsMML.find(attr)->second; +} + + +void +SUMOSAXAttributesImpl_Cached::serialize(std::ostream& os) const { + for (std::map::const_iterator it = myAttrs.begin(); it != myAttrs.end(); ++it) { + os << " " << it->first; + os << "=\"" << it->second << "\""; + } +} + + +SUMOSAXAttributes* +SUMOSAXAttributesImpl_Cached::clone() const { + return new SUMOSAXAttributesImpl_Cached(myAttrs, myPredefinedTagsMML, getObjectType()); +} + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Cached.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Cached.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Cached.h 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Cached.h 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,321 @@ +/****************************************************************************/ +/// @file SUMOSAXAttributesImpl_Cached.cpp +/// @author Jakob Erdmann +/// @date Dec 2016 +/// @version $Id: SUMOSAXAttributesImpl_Cached.h 23150 2017-02-27 12:08:30Z behrisch $ +/// +// Encapsulated xml-attributes that use a map from string-attr-names to string-attr-values as backend +/****************************************************************************/ +// SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +// Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors +/****************************************************************************/ +// +// This file is part of SUMO. +// SUMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +/****************************************************************************/ +#ifndef SUMOSAXAttributesImpl_Cached_h +#define SUMOSAXAttributesImpl_Cached_h + + +// =========================================================================== +// included modules +// =========================================================================== +#ifdef _MSC_VER +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include "SUMOSAXAttributes.h" + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class SUMOSAXAttributesImpl_Cached + * @brief Encapsulated Xerces-SAX-attributes + * + * @see SUMOSAXAttributes + */ +class SUMOSAXAttributesImpl_Cached : public SUMOSAXAttributes { +public: + /** @brief Constructor + * + * @param[in] attrs The encapsulated xerces-attributes + * @param[in] predefinedTags Map of attribute ids to their xerces-representation + * @param[in] predefinedTagsMML Map of attribute ids to their (readable) string-representation + */ + SUMOSAXAttributesImpl_Cached(const std::map& attrs, + const std::map& predefinedTagsMML, + const std::string& objectType); + + + /// @brief Destructor + virtual ~SUMOSAXAttributesImpl_Cached(); + + + + + /// @name methods for retrieving attribute values + /// @{ + + /** @brief Returns the information whether the named (by its enum-value) attribute is within the current list + * + * @param[in] id The id of the searched attribute + * @return Whether the attribute is within the attributes + */ + bool hasAttribute(int id) const; + + + /** + * @brief Returns the bool-value of the named (by its enum-value) attribute + * + * Tries to retrieve the attribute from the the attribute list. The retrieved + * attribute (which may be 0) is then parsed using TplConvert::_2bool. + * If the attribute is empty or ==0, TplConvert::_2bool throws an + * EmptyData-exception which is passed. + * If the value can not be parsed to a bool, TplConvert::_2bool throws a + * BoolFormatException-exception which is passed. + * + * @param[in] id The id of the attribute to return the value of + * @return The attribute's value as a bool, if it could be read and parsed + * @exception EmptyData If the attribute is not known or the attribute value is an empty string + * @exception BoolFormatException If the attribute value can not be parsed to a bool + */ + bool getBool(int id) const; + + + /** + * @brief Returns the int-value of the named (by its enum-value) attribute + * + * Tries to retrieve the attribute from the the attribute list. The retrieved + * attribute (which may be 0) is then parsed using TplConvert::_2int. + * If the attribute is empty or ==0, TplConvert::_2int throws an + * EmptyData-exception which is passed. + * If the value can not be parsed to an int, TplConvert::_2int throws a + * NumberFormatException-exception which is passed. + * + * @param[in] id The id of the attribute to return the value of + * @return The attribute's value as an int, if it could be read and parsed + * @exception EmptyData If the attribute is not known or the attribute value is an empty string + * @exception NumberFormatException If the attribute value can not be parsed to an int + */ + int getInt(int id) const; + + + /** + * @brief Returns the long-value of the named (by its enum-value) attribute + * + * Tries to retrieve the attribute from the the attribute list. The retrieved + * attribute (which may be 0) is then parsed using TplConvert::_2long. + * If the attribute is empty or ==0, TplConvert::_2long throws an + * EmptyData-exception which is passed. + * If the value can not be parsed to a long, TplConvert::_2long throws a + * NumberFormatException-exception which is passed. + * + * @param[in] id The id of the attribute to return the value of + * @return The attribute's value as an int, if it could be read and parsed + * @exception EmptyData If the attribute is not known or the attribute value is an empty string + * @exception NumberFormatException If the attribute value can not be parsed to an int + */ + long long int getLong(int id) const; + + + /** + * @brief Returns the string-value of the named (by its enum-value) attribute + * + * Tries to retrieve the attribute from the the attribute list. The retrieved + * attribute (which may be 0) is then parsed using TplConvert::_2str. + * If the attribute is ==0, TplConvert::_2str throws an + * EmptyData-exception which is passed. + * + * @param[in] id The id of the attribute to return the value of + * @return The attribute's value as a string, if it could be read and parsed + * @exception EmptyData If the attribute is not known or the attribute value is an empty string + */ + std::string getString(int id) const; + + /** + * @brief Returns the string-value of the named (by its enum-value) attribute + * + * Tries to retrieve the attribute from the the attribute list. The retrieved + * attribute (which may be 0) is then parsed using TplConvert::_2strSec. + * If the attribute is ==0, TplConvert::_2strSec returns the default value. + * + * @param[in] id The id of the attribute to return the value of + * @param[in] def The default value to return if the attribute is not in attributes + * @return The attribute's value as a string, if it could be read and parsed + * @exception EmptyData If the attribute is not known or the attribute value is an empty string + */ + std::string getStringSecure(int id, + const std::string& def) const; + + + /** + * @brief Returns the double-value of the named (by its enum-value) attribute + * + * Tries to retrieve the attribute from the the attribute list. The retrieved + * attribute (which may be 0) is then parsed using TplConvert::_2double. + * If the attribute is empty or ==0, TplConvert::_2double throws an + * EmptyData-exception which is passed. + * If the value can not be parsed to a double, TplConvert::_2double throws a + * NumberFormatException-exception which is passed. + * + * @param[in] id The id of the attribute to return the value of + * @return The attribute's value as a float, if it could be read and parsed + * @exception EmptyData If the attribute is not known or the attribute value is an empty string + * @exception NumberFormatException If the attribute value can not be parsed to an double + */ + double getFloat(int id) const; + + + /** + * @brief Returns the information whether the named attribute is within the current list + */ + bool hasAttribute(const std::string& id) const; + + + /** + * @brief Returns the double-value of the named attribute + * + * Tries to retrieve the attribute from the the attribute list. The retrieved + * attribute (which may be 0) is then parsed using TplConvert::_2double. + * If the attribute is empty or ==0, TplConvert::_2double throws an + * EmptyData-exception which is passed. + * If the value can not be parsed to a double, TplConvert::_2double throws a + * NumberFormatException-exception which is passed. + * + * @param[in] id The name of the attribute to return the value of + * @return The attribute's value as a float, if it could be read and parsed + * @exception EmptyData If the attribute is not known or the attribute value is an empty string + * @exception NumberFormatException If the attribute value can not be parsed to an double + */ + double getFloat(const std::string& id) const; + + + /** + * @brief Returns the string-value of the named (by its enum-value) attribute + * + * Tries to retrieve the attribute from the the attribute list. + * If the attribute is ==0, TplConvert::_2strSec returns the default value. + * @param[in] id The name of the attribute to return the value of + * @param[in] def The default value to return if the attribute is not in attributes + * @return The attribute's value as a string, if it could be read and parsed + */ + std::string getStringSecure(const std::string& id, + const std::string& def) const; + //} + + + /** + * @brief Returns the value of the named attribute + * + * Tries to retrieve the attribute from the the attribute list. + * @return The attribute's value as a SumoXMLEdgeFunc, if it could be read and parsed + */ + SumoXMLEdgeFunc getEdgeFunc(bool& ok) const; + + + /** + * @brief Returns the value of the named attribute + * + * Tries to retrieve the attribute from the the attribute list. + * @return The attribute's value as a SumoXMLNodeType, if it could be read and parsed + */ + SumoXMLNodeType getNodeType(bool& ok) const; + + + /** + * @brief Returns the value of the named attribute + * + * Tries to retrieve the attribute from the the attribute list. + * @return The attribute's value as a RGBColor, if it could be read and parsed + */ + RGBColor getColor() const; + + + /** @brief Tries to read given attribute assuming it is a PositionVector + * + * @param[in] attr The id of the attribute to read + * @return The read value if given and not empty; "" if an error occured + */ + PositionVector getShape(int attr) const; + + + /** @brief Tries to read given attribute assuming it is a Boundary + * + * @param[in] attr The id of the attribute to read + * @return The read value if given and not empty; "" if an error occured + */ + Boundary getBoundary(int attr) const; + + /** @brief Tries to read given attribute assuming it is a string vector + * + * @param[in] attr The id of the attribute to read + * @return The read value if given and not empty; empty vector if an error occured + */ + std::vector getStringVector(int attr) const; + + /** @brief Converts the given attribute id into a man readable string + * + * Returns a "?" if the attribute is not known. + * + * @param[in] attr The id of the attribute to return the name of + * @return The name of the described attribute + */ + std::string getName(int attr) const; + + + /** @brief Prints all attribute names and values into the given stream + * + * @param[in] os The stream to use + */ + void serialize(std::ostream& os) const; + + /// @brief return a new deep-copy attributes object + SUMOSAXAttributes* clone() const; + +private: + /** @brief Returns Xerces-value of the named attribute + * + * It is assumed that this attribute is within the stored attributes. + * @param[in] id The id of the attribute to retrieve the vale of + * @return The xerces-value of the attribute + */ + const char* getAttributeValueSecure(int id) const; + + +private: + /// @brief The encapsulated attributes + std::map myAttrs; + + /// @brief Map of attribute ids to their (readable) string-representation + const std::map& myPredefinedTagsMML; + + +private: + /// @brief Invalidated copy constructor. + SUMOSAXAttributesImpl_Cached(const SUMOSAXAttributesImpl_Cached& src); + + /// @brief Invalidated assignment operator. + SUMOSAXAttributesImpl_Cached& operator=(const SUMOSAXAttributesImpl_Cached& src); + + +}; + + +#endif + +/****************************************************************************/ + diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Xerces.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Xerces.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Xerces.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Xerces.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: SUMOSAXAttributesImpl_Xerces.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SUMOSAXAttributesImpl_Xerces.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Encapsulated Xerces-SAX-attributes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -42,10 +42,7 @@ #include #include #include "SUMOSAXAttributesImpl_Xerces.h" - -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS +#include "SUMOSAXAttributesImpl_Cached.h" // =========================================================================== @@ -142,9 +139,9 @@ } -SUMOReal +double SUMOSAXAttributesImpl_Xerces::getFloat(int id) const { - return TplConvert::_2SUMOReal(getAttributeValueSecure(id)); + return TplConvert::_2double(getAttributeValueSecure(id)); } @@ -156,10 +153,10 @@ } -SUMOReal +double SUMOSAXAttributesImpl_Xerces::getFloat(const std::string& id) const { XMLCh* t = XERCES_CPP_NAMESPACE::XMLString::transcode(id.c_str()); - SUMOReal result = TplConvert::_2SUMOReal(myAttrs.getValue(t)); + double result = TplConvert::_2double(myAttrs.getValue(t)); XERCES_CPP_NAMESPACE::XMLString::release(&t); return result; } @@ -225,12 +222,12 @@ if (pos.size() != 2 && pos.size() != 3) { throw FormatException("shape format"); } - SUMOReal x = TplConvert::_2SUMOReal(pos.next().c_str()); - SUMOReal y = TplConvert::_2SUMOReal(pos.next().c_str()); + double x = TplConvert::_2double(pos.next().c_str()); + double y = TplConvert::_2double(pos.next().c_str()); if (pos.size() == 2) { shape.push_back(Position(x, y)); } else { - SUMOReal z = TplConvert::_2SUMOReal(pos.next().c_str()); + double z = TplConvert::_2double(pos.next().c_str()); shape.push_back(Position(x, y, z)); } } @@ -245,10 +242,10 @@ if (st.size() != 4) { throw FormatException("boundary format"); } - const SUMOReal xmin = TplConvert::_2SUMOReal(st.next().c_str()); - const SUMOReal ymin = TplConvert::_2SUMOReal(st.next().c_str()); - const SUMOReal xmax = TplConvert::_2SUMOReal(st.next().c_str()); - const SUMOReal ymax = TplConvert::_2SUMOReal(st.next().c_str()); + const double xmin = TplConvert::_2double(st.next().c_str()); + const double ymin = TplConvert::_2double(st.next().c_str()); + const double xmax = TplConvert::_2double(st.next().c_str()); + const double ymax = TplConvert::_2double(st.next().c_str()); return Boundary(xmin, ymin, xmax, ymax); } @@ -280,5 +277,14 @@ } +SUMOSAXAttributes* +SUMOSAXAttributesImpl_Xerces::clone() const { + std::map attrs; + for (int i = 0; i < (int)myAttrs.getLength(); ++i) { + attrs[TplConvert::_2str(myAttrs.getLocalName(i))] = TplConvert::_2str(myAttrs.getValue(i)); + } + return new SUMOSAXAttributesImpl_Cached(attrs, myPredefinedTagsMML, getObjectType()); +} + /****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Xerces.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Xerces.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Xerces.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXAttributesImpl_Xerces.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Fri, 30 Mar 2007 -/// @version $Id: SUMOSAXAttributesImpl_Xerces.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SUMOSAXAttributesImpl_Xerces.h 23150 2017-02-27 12:08:30Z behrisch $ /// // Encapsulated Xerces-SAX-attributes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -166,21 +166,21 @@ /** - * @brief Returns the SUMOReal-value of the named (by its enum-value) attribute + * @brief Returns the double-value of the named (by its enum-value) attribute * * Tries to retrieve the attribute from the the attribute list. The retrieved - * attribute (which may be 0) is then parsed using TplConvert::_2SUMOReal. - * If the attribute is empty or ==0, TplConvert::_2SUMOReal throws an + * attribute (which may be 0) is then parsed using TplConvert::_2double. + * If the attribute is empty or ==0, TplConvert::_2double throws an * EmptyData-exception which is passed. - * If the value can not be parsed to a SUMOReal, TplConvert::_2SUMOReal throws a + * If the value can not be parsed to a double, TplConvert::_2double throws a * NumberFormatException-exception which is passed. * * @param[in] id The id of the attribute to return the value of * @return The attribute's value as a float, if it could be read and parsed * @exception EmptyData If the attribute is not known or the attribute value is an empty string - * @exception NumberFormatException If the attribute value can not be parsed to an SUMOReal + * @exception NumberFormatException If the attribute value can not be parsed to an double */ - SUMOReal getFloat(int id) const; + double getFloat(int id) const; /** @@ -190,21 +190,21 @@ /** - * @brief Returns the SUMOReal-value of the named attribute + * @brief Returns the double-value of the named attribute * * Tries to retrieve the attribute from the the attribute list. The retrieved - * attribute (which may be 0) is then parsed using TplConvert::_2SUMOReal. - * If the attribute is empty or ==0, TplConvert::_2SUMOReal throws an + * attribute (which may be 0) is then parsed using TplConvert::_2double. + * If the attribute is empty or ==0, TplConvert::_2double throws an * EmptyData-exception which is passed. - * If the value can not be parsed to a SUMOReal, TplConvert::_2SUMOReal throws a + * If the value can not be parsed to a double, TplConvert::_2double throws a * NumberFormatException-exception which is passed. * * @param[in] id The name of the attribute to return the value of * @return The attribute's value as a float, if it could be read and parsed * @exception EmptyData If the attribute is not known or the attribute value is an empty string - * @exception NumberFormatException If the attribute value can not be parsed to an SUMOReal + * @exception NumberFormatException If the attribute value can not be parsed to an double */ - SUMOReal getFloat(const std::string& id) const; + double getFloat(const std::string& id) const; /** @@ -286,6 +286,8 @@ */ void serialize(std::ostream& os) const; + /// @brief return a new deep-copy attributes object + SUMOSAXAttributes* clone() const; private: /** @brief Returns Xerces-value of the named attribute diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXHandler.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXHandler.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXHandler.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXHandler.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: SUMOSAXHandler.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SUMOSAXHandler.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // SAX-handler base for SUMO-files /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -36,10 +36,6 @@ #include "SUMOXMLDefinitions.h" #include "SUMOSAXHandler.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXHandler.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXHandler.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXHandler.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXHandler.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Sept 2002 -/// @version $Id: SUMOSAXHandler.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SUMOSAXHandler.h 22608 2017-01-17 06:28:54Z behrisch $ /// // SAX-handler base for SUMO-files /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXReader.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXReader.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXReader.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXReader.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Nov 2012 -/// @version $Id: SUMOSAXReader.cpp 21201 2016-07-19 11:57:22Z behrisch $ +/// @version $Id: SUMOSAXReader.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // SAX-reader encapsulation containing binary reader /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -45,10 +45,6 @@ #include "GenericSAXHandler.h" #include "SUMOSAXReader.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // method definitions @@ -121,9 +117,8 @@ SUMOSAXReader::parseFirst(std::string systemID) { if (systemID.substr(systemID.length() - 4) == ".sbx") { myBinaryInput = new BinaryInputDevice(systemID, true, myValidationScheme == XERCES_CPP_NAMESPACE::SAX2XMLReader::Val_Always); - char sbxVer; - *myBinaryInput >> sbxVer; - if (sbxVer != 1) { + *myBinaryInput >> mySbxVersion; + if (mySbxVersion < 1 || mySbxVersion > 2) { throw ProcessError("Unknown sbx version"); } std::string sumoVer; @@ -167,20 +162,31 @@ myBinaryInput = 0; return false; case BinaryFormatter::BF_XML_TAG_START: { - char t; - *myBinaryInput >> t; - SUMOSAXAttributesImpl_Binary attrs(myHandler->myPredefinedTagsMML, toString((SumoXMLTag)t), myBinaryInput); - myHandler->myStartElement(t, attrs); + int tag; + unsigned char tagByte; + *myBinaryInput >> tagByte; + tag = tagByte; + if (mySbxVersion > 1) { + myBinaryInput->putback(BinaryFormatter::BF_BYTE); + *myBinaryInput >> tagByte; + tag += 256 * tagByte; + } + myXMLStack.push_back((SumoXMLTag)tag); + SUMOSAXAttributesImpl_Binary attrs(myHandler->myPredefinedTagsMML, toString((SumoXMLTag)tag), myBinaryInput, mySbxVersion); + myHandler->myStartElement(tag, attrs); break; } case BinaryFormatter::BF_XML_TAG_END: { - char t; - *myBinaryInput >> t; - myHandler->myEndElement(t); + if (myXMLStack.empty()) { + throw ProcessError("Binary file is invalid, unexpected tag end."); + } + myHandler->myEndElement(myXMLStack.back()); + myXMLStack.pop_back(); + myBinaryInput->read(mySbxVersion > 1 ? 1 : 2); break; } default: - throw ProcessError("Invalid binary file"); + throw ProcessError("Binary file is invalid, expected tag start or tag end."); } return true; } else { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXReader.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXReader.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOSAXReader.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOSAXReader.h 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Nov 2012 -/// @version $Id: SUMOSAXReader.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: SUMOSAXReader.h 22623 2017-01-18 09:53:08Z behrisch $ /// // SAX-reader encapsulation containing binary reader /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -116,6 +116,11 @@ BinaryInputDevice* myBinaryInput; + char mySbxVersion; + + /// @brief The stack of begun xml elements + std::vector myXMLStack; + LocalSchemaResolver mySchemaResolver; private: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOVehicleParserHelper.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOVehicleParserHelper.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOVehicleParserHelper.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOVehicleParserHelper.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Mon, 07.04.2008 -/// @version $Id: SUMOVehicleParserHelper.cpp 21802 2016-10-26 11:11:13Z namdre $ +/// @version $Id: SUMOVehicleParserHelper.cpp 23709 2017-03-29 12:44:12Z namdre $ /// // Helper methods for parsing vehicle attributes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -41,10 +41,6 @@ #include #include "SUMOVehicleParserHelper.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static members @@ -109,7 +105,7 @@ } if (attrs.hasAttribute(SUMO_ATTR_VEHSPERHOUR)) { ret->setParameter |= VEHPARS_PERIODFREQ_SET; - const SUMOReal vph = attrs.get(SUMO_ATTR_VEHSPERHOUR, id.c_str(), ok); + const double vph = attrs.get(SUMO_ATTR_VEHSPERHOUR, id.c_str(), ok); if (ok && vph <= 0) { delete ret; throw ProcessError("Invalid repetition rate in the definition of flow '" + id + "'."); @@ -119,7 +115,7 @@ } } if (attrs.hasAttribute(SUMO_ATTR_PROB)) { - ret->repetitionProbability = attrs.get(SUMO_ATTR_PROB, id.c_str(), ok); + ret->repetitionProbability = attrs.get(SUMO_ATTR_PROB, id.c_str(), ok); if (ok && (ret->repetitionProbability <= 0 || ret->repetitionProbability > 1)) { delete ret; throw ProcessError("Invalid repetition probability in the definition of flow '" + id + "'."); @@ -172,7 +168,8 @@ if (ret->repetitionEnd == SUMOTime_MAX) { ret->repetitionNumber = std::numeric_limits::max(); } else { - ret->repetitionNumber = MAX2(1, (int)(((SUMOReal)(ret->repetitionEnd - ret->depart)) / ret->repetitionOffset + 0.5)); + const double repLength = (double)(ret->repetitionEnd - ret->depart); + ret->repetitionNumber = (int)ceil(repLength / ret->repetitionOffset); } } } @@ -349,24 +346,24 @@ vtype->setParameter |= VTYPEPARS_VEHICLECLASS_SET; } if (attrs.hasAttribute(SUMO_ATTR_LENGTH)) { - vtype->length = attrs.get(SUMO_ATTR_LENGTH, vtype->id.c_str(), ok); + vtype->length = attrs.get(SUMO_ATTR_LENGTH, vtype->id.c_str(), ok); vtype->setParameter |= VTYPEPARS_LENGTH_SET; } if (attrs.hasAttribute(SUMO_ATTR_MINGAP)) { - vtype->minGap = attrs.get(SUMO_ATTR_MINGAP, vtype->id.c_str(), ok); + vtype->minGap = attrs.get(SUMO_ATTR_MINGAP, vtype->id.c_str(), ok); vtype->setParameter |= VTYPEPARS_MINGAP_SET; } if (attrs.hasAttribute(SUMO_ATTR_MAXSPEED)) { - vtype->maxSpeed = attrs.get(SUMO_ATTR_MAXSPEED, vtype->id.c_str(), ok); + vtype->maxSpeed = attrs.get(SUMO_ATTR_MAXSPEED, vtype->id.c_str(), ok); vtype->setParameter |= VTYPEPARS_MAXSPEED_SET; } if (attrs.hasAttribute(SUMO_ATTR_SPEEDFACTOR)) { - vtype->speedFactor = attrs.get(SUMO_ATTR_SPEEDFACTOR, vtype->id.c_str(), ok); + vtype->speedFactor = Distribution_Parameterized(attrs.get(SUMO_ATTR_SPEEDFACTOR, vtype->id.c_str(), ok)); vtype->setParameter |= VTYPEPARS_SPEEDFACTOR_SET; } if (attrs.hasAttribute(SUMO_ATTR_SPEEDDEV)) { - vtype->speedDev = attrs.get(SUMO_ATTR_SPEEDDEV, vtype->id.c_str(), ok); - vtype->setParameter |= VTYPEPARS_SPEEDDEVIATION_SET; + vtype->speedFactor.getParameter()[1] = attrs.get(SUMO_ATTR_SPEEDDEV, vtype->id.c_str(), ok); + vtype->setParameter |= VTYPEPARS_SPEEDFACTOR_SET; } if (attrs.hasAttribute(SUMO_ATTR_EMISSIONCLASS)) { vtype->emissionClass = parseEmissionClass(attrs, vtype->id); @@ -374,18 +371,18 @@ } if (attrs.hasAttribute(SUMO_ATTR_IMPATIENCE)) { if (attrs.get(SUMO_ATTR_IMPATIENCE, vtype->id.c_str(), ok) == "off") { - vtype->impatience = -std::numeric_limits::max(); + vtype->impatience = -std::numeric_limits::max(); } else { - vtype->impatience = attrs.get(SUMO_ATTR_IMPATIENCE, vtype->id.c_str(), ok); + vtype->impatience = attrs.get(SUMO_ATTR_IMPATIENCE, vtype->id.c_str(), ok); } vtype->setParameter |= VTYPEPARS_IMPATIENCE_SET; } if (attrs.hasAttribute(SUMO_ATTR_WIDTH)) { - vtype->width = attrs.get(SUMO_ATTR_WIDTH, vtype->id.c_str(), ok); + vtype->width = attrs.get(SUMO_ATTR_WIDTH, vtype->id.c_str(), ok); vtype->setParameter |= VTYPEPARS_WIDTH_SET; } if (attrs.hasAttribute(SUMO_ATTR_HEIGHT)) { - vtype->height = attrs.get(SUMO_ATTR_HEIGHT, vtype->id.c_str(), ok); + vtype->height = attrs.get(SUMO_ATTR_HEIGHT, vtype->id.c_str(), ok); vtype->setParameter |= VTYPEPARS_HEIGHT_SET; } if (attrs.hasAttribute(SUMO_ATTR_GUISHAPE)) { @@ -410,17 +407,18 @@ vtype->color = RGBColor::YELLOW; } if (attrs.hasAttribute(SUMO_ATTR_PROB)) { - vtype->defaultProbability = attrs.get(SUMO_ATTR_PROB, vtype->id.c_str(), ok); + vtype->defaultProbability = attrs.get(SUMO_ATTR_PROB, vtype->id.c_str(), ok); vtype->setParameter |= VTYPEPARS_PROBABILITY_SET; } if (attrs.hasAttribute(SUMO_ATTR_LANE_CHANGE_MODEL)) { + vtype->setParameter |= VTYPEPARS_LANE_CHANGE_MODEL_SET; std::string lcmS = attrs.get(SUMO_ATTR_LANE_CHANGE_MODEL, vtype->id.c_str(), ok); if (lcmS == "JE2013") { WRITE_WARNING("Lane change model 'JE2013' is deprecated. Using default model instead."); lcmS = "default"; } if (SUMOXMLDefinitions::LaneChangeModels.hasString(lcmS)) { - vtype->lcModel = SUMOXMLDefinitions::LaneChangeModels.get("default"); + vtype->lcModel = SUMOXMLDefinitions::LaneChangeModels.get(lcmS); } else { WRITE_ERROR("Unknown lane change model '" + lcmS + "' when parsing vtype '" + vtype->id + "'"); throw ProcessError(); @@ -453,11 +451,11 @@ vtype->setParameter |= VTYPEPARS_LOADING_DURATION; } if (attrs.hasAttribute(SUMO_ATTR_MAXSPEED_LAT)) { - vtype->maxSpeedLat = attrs.get(SUMO_ATTR_MAXSPEED_LAT, vtype->id.c_str(), ok); + vtype->maxSpeedLat = attrs.get(SUMO_ATTR_MAXSPEED_LAT, vtype->id.c_str(), ok); vtype->setParameter |= VTYPEPARS_MAXSPEED_LAT_SET; } if (attrs.hasAttribute(SUMO_ATTR_MINGAP_LAT)) { - vtype->minGapLat = attrs.get(SUMO_ATTR_MINGAP_LAT, vtype->id.c_str(), ok); + vtype->minGapLat = attrs.get(SUMO_ATTR_MINGAP_LAT, vtype->id.c_str(), ok); vtype->setParameter |= VTYPEPARS_MINGAP_LAT_SET; } if (attrs.hasAttribute(SUMO_ATTR_LATALIGNMENT)) { @@ -507,8 +505,8 @@ bool ok = true; for (std::set::const_iterator it = cf_it->second.begin(); it != cf_it->second.end(); it++) { if (attrs.hasAttribute(*it)) { - into.cfParameter[*it] = attrs.get(*it, into.id.c_str(), ok); - if (*it == SUMO_ATTR_TAU && TIME2STEPS(into.cfParameter[*it]) < DELTA_T) { + into.cfParameter[*it] = attrs.get(*it, into.id.c_str(), ok); + if (*it == SUMO_ATTR_TAU && string2time(into.cfParameter[*it]) < DELTA_T) { WRITE_WARNING("Value of tau=" + toString(into.cfParameter[*it]) + " in car following model '" + toString(into.cfModel) + "' lower than simulation step size may cause collisions"); } @@ -527,15 +525,25 @@ std::set krausParams; krausParams.insert(SUMO_ATTR_ACCEL); krausParams.insert(SUMO_ATTR_DECEL); + krausParams.insert(SUMO_ATTR_APPARENTDECEL); + krausParams.insert(SUMO_ATTR_EMERGENCYDECEL); krausParams.insert(SUMO_ATTR_SIGMA); krausParams.insert(SUMO_ATTR_TAU); allowedCFModelAttrs[SUMO_TAG_CF_KRAUSS] = krausParams; allowedCFModelAttrs[SUMO_TAG_CF_KRAUSS_ORIG1] = krausParams; allowedCFModelAttrs[SUMO_TAG_CF_KRAUSS_PLUS_SLOPE] = krausParams; + allowedCFModelAttrs[SUMO_TAG_CF_KRAUSSX] = krausParams; + allowedCFModelAttrs[SUMO_TAG_CF_KRAUSSX].insert(SUMO_ATTR_TMP1); + allowedCFModelAttrs[SUMO_TAG_CF_KRAUSSX].insert(SUMO_ATTR_TMP2); + allowedCFModelAttrs[SUMO_TAG_CF_KRAUSSX].insert(SUMO_ATTR_TMP3); + allowedCFModelAttrs[SUMO_TAG_CF_KRAUSSX].insert(SUMO_ATTR_TMP4); + allowedCFModelAttrs[SUMO_TAG_CF_KRAUSSX].insert(SUMO_ATTR_TMP5); + std::set smartSKParams; smartSKParams.insert(SUMO_ATTR_ACCEL); smartSKParams.insert(SUMO_ATTR_DECEL); + smartSKParams.insert(SUMO_ATTR_EMERGENCYDECEL); smartSKParams.insert(SUMO_ATTR_SIGMA); smartSKParams.insert(SUMO_ATTR_TAU); smartSKParams.insert(SUMO_ATTR_TMP1); @@ -548,6 +556,7 @@ std::set daniel1Params; daniel1Params.insert(SUMO_ATTR_ACCEL); daniel1Params.insert(SUMO_ATTR_DECEL); + daniel1Params.insert(SUMO_ATTR_EMERGENCYDECEL); daniel1Params.insert(SUMO_ATTR_SIGMA); daniel1Params.insert(SUMO_ATTR_TAU); daniel1Params.insert(SUMO_ATTR_TMP1); @@ -560,6 +569,7 @@ std::set pwagParams; pwagParams.insert(SUMO_ATTR_ACCEL); pwagParams.insert(SUMO_ATTR_DECEL); + pwagParams.insert(SUMO_ATTR_EMERGENCYDECEL); pwagParams.insert(SUMO_ATTR_SIGMA); pwagParams.insert(SUMO_ATTR_TAU); pwagParams.insert(SUMO_ATTR_CF_PWAGNER2009_TAULAST); @@ -569,6 +579,7 @@ std::set idmParams; idmParams.insert(SUMO_ATTR_ACCEL); idmParams.insert(SUMO_ATTR_DECEL); + idmParams.insert(SUMO_ATTR_EMERGENCYDECEL); idmParams.insert(SUMO_ATTR_TAU); idmParams.insert(SUMO_ATTR_CF_IDM_DELTA); idmParams.insert(SUMO_ATTR_CF_IDM_STEPPING); @@ -577,6 +588,7 @@ std::set idmmParams; idmmParams.insert(SUMO_ATTR_ACCEL); idmmParams.insert(SUMO_ATTR_DECEL); + idmmParams.insert(SUMO_ATTR_EMERGENCYDECEL); idmmParams.insert(SUMO_ATTR_TAU); idmmParams.insert(SUMO_ATTR_CF_IDMM_ADAPT_FACTOR); idmmParams.insert(SUMO_ATTR_CF_IDMM_ADAPT_TIME); @@ -586,6 +598,7 @@ std::set bkernerParams; bkernerParams.insert(SUMO_ATTR_ACCEL); bkernerParams.insert(SUMO_ATTR_DECEL); + bkernerParams.insert(SUMO_ATTR_EMERGENCYDECEL); bkernerParams.insert(SUMO_ATTR_TAU); bkernerParams.insert(SUMO_ATTR_K); bkernerParams.insert(SUMO_ATTR_CF_KERNER_PHI); @@ -594,9 +607,14 @@ std::set wiedemannParams; wiedemannParams.insert(SUMO_ATTR_ACCEL); wiedemannParams.insert(SUMO_ATTR_DECEL); + wiedemannParams.insert(SUMO_ATTR_EMERGENCYDECEL); wiedemannParams.insert(SUMO_ATTR_CF_WIEDEMANN_SECURITY); wiedemannParams.insert(SUMO_ATTR_CF_WIEDEMANN_ESTIMATION); allowedCFModelAttrs[SUMO_TAG_CF_WIEDEMANN] = wiedemannParams; + + std::set railParamms; + railParamms.insert(SUMO_ATTR_TRAIN_TYPE); + allowedCFModelAttrs[SUMO_TAG_CF_RAIL] = railParamms; } return allowedCFModelAttrs; } @@ -611,6 +629,7 @@ lc2013Params.insert(SUMO_ATTR_LCA_COOPERATIVE_PARAM); lc2013Params.insert(SUMO_ATTR_LCA_SPEEDGAIN_PARAM); lc2013Params.insert(SUMO_ATTR_LCA_KEEPRIGHT_PARAM); + lc2013Params.insert(SUMO_ATTR_LCA_EXPERIMENTAL1); allowedLCModelAttrs[LCM_LC2013] = lc2013Params; std::set sl2015Params = lc2013Params; @@ -630,7 +649,7 @@ std::set allowed = allowedLCModelAttrs[model]; for (std::set::const_iterator it = allowed.begin(); it != allowed.end(); it++) { if (attrs.hasAttribute(*it)) { - into.lcParameter[*it] = attrs.get(*it, into.id.c_str(), ok); + into.lcParameter[*it] = attrs.get(*it, into.id.c_str(), ok); } } if (!ok) { diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOVehicleParserHelper.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOVehicleParserHelper.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOVehicleParserHelper.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOVehicleParserHelper.h 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ /// @author Michael Behrisch /// @author Laura Bieker /// @date Mon, 07.04.2008 -/// @version $Id: SUMOVehicleParserHelper.h 20687 2016-05-10 11:27:00Z behrisch $ +/// @version $Id: SUMOVehicleParserHelper.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Helper methods for parsing vehicle attributes /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOXMLDefinitions.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOXMLDefinitions.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOXMLDefinitions.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOXMLDefinitions.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ /// @author Michael Behrisch /// @author Walter Bamberger /// @date Sept 2002 -/// @version $Id: SUMOXMLDefinitions.cpp 21802 2016-10-26 11:11:13Z namdre $ +/// @version $Id: SUMOXMLDefinitions.cpp 24108 2017-04-27 18:43:30Z behrisch $ /// // Definitions of elements and attributes known by SUMO /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include "SUMOXMLDefinitions.h" #include -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // definitions @@ -75,6 +71,8 @@ { "trainStop", SUMO_TAG_TRAIN_STOP }, { "access", SUMO_TAG_ACCESS }, { "containerStop", SUMO_TAG_CONTAINER_STOP }, + { "parkingArea", SUMO_TAG_PARKING_AREA }, + { "space", SUMO_TAG_PARKING_SPACE }, { "chargingStation", SUMO_TAG_CHARGING_STATION }, { "vTypeProbe", SUMO_TAG_VTYPEPROBE }, { "routeProbe", SUMO_TAG_ROUTEPROBE }, @@ -87,6 +85,7 @@ { "taz", SUMO_TAG_TAZ }, { "tazSource", SUMO_TAG_TAZSOURCE }, { "tazSink", SUMO_TAG_TAZSINK }, + { "trafficLight", SUMO_TAG_TRAFFIC_LIGHT }, { "tlLogic", SUMO_TAG_TLLOGIC }, { "phase", SUMO_TAG_PHASE }, { "trip", SUMO_TAG_TRIP }, @@ -108,6 +107,7 @@ { "closingReroute", SUMO_TAG_CLOSING_REROUTE }, { "closingLaneReroute", SUMO_TAG_CLOSING_LANE_REROUTE }, { "routeProbReroute", SUMO_TAG_ROUTE_PROB_REROUTE }, + { "parkingAreaReroute", SUMO_TAG_PARKING_ZONE_REROUTE }, { "polygonType", SUMO_TAG_POLYTYPE }, { "connection", SUMO_TAG_CONNECTION }, { "prohibition", SUMO_TAG_PROHIBITION }, @@ -156,17 +156,21 @@ { "colorScheme", SUMO_TAG_COLORSCHEME }, { "scalingScheme", SUMO_TAG_SCALINGSCHEME }, { "entry", SUMO_TAG_ENTRY }, + { "vehicleTransfer", SUMO_TAG_VEHICLETRANSFER }, + { "device", SUMO_TAG_DEVICE }, // Cars { "carFollowing-IDM", SUMO_TAG_CF_IDM }, { "carFollowing-IDMM", SUMO_TAG_CF_IDMM }, { "carFollowing-Krauss", SUMO_TAG_CF_KRAUSS }, { "carFollowing-KraussPS", SUMO_TAG_CF_KRAUSS_PLUS_SLOPE }, { "carFollowing-KraussOrig1", SUMO_TAG_CF_KRAUSS_ORIG1 }, + { "carFollowing-KraussX", SUMO_TAG_CF_KRAUSSX }, { "carFollowing-SmartSK", SUMO_TAG_CF_SMART_SK }, { "carFollowing-Daniel1", SUMO_TAG_CF_DANIEL1 }, { "carFollowing-PWagner2009", SUMO_TAG_CF_PWAGNER2009 }, { "carFollowing-BKerner", SUMO_TAG_CF_BKERNER }, { "carFollowing-Wiedemann", SUMO_TAG_CF_WIEDEMANN }, + { "carFollowing-Rail", SUMO_TAG_CF_RAIL }, // Person { "person", SUMO_TAG_PERSON }, { "personTrip", SUMO_TAG_PERSONTRIP }, @@ -221,8 +225,10 @@ { "sidewalkWidth", SUMO_ATTR_SIDEWALKWIDTH }, { "bikeLaneWidth", SUMO_ATTR_BIKELANEWIDTH }, { "remove", SUMO_ATTR_REMOVE }, - // Lenght { "length", SUMO_ATTR_LENGTH }, + // Split + { "idBefore", SUMO_ATTR_ID_BEFORE }, + { "idAfter", SUMO_ATTR_ID_AFTER }, // Positions { "x", SUMO_ATTR_X }, { "y", SUMO_ATTR_Y }, @@ -262,6 +268,8 @@ { "minGapLat", SUMO_ATTR_MINGAP_LAT }, { "accel", SUMO_ATTR_ACCEL }, { "decel", SUMO_ATTR_DECEL }, + { "emergencyDecel", SUMO_ATTR_EMERGENCYDECEL }, + { "apparentDecel", SUMO_ATTR_APPARENTDECEL }, { "vClass", SUMO_ATTR_VCLASS }, { "repno", SUMO_ATTR_REPNUMBER }, { "speedFactor", SUMO_ATTR_SPEEDFACTOR }, @@ -276,6 +284,36 @@ { "efficiency", SUMO_ATTR_EFFICIENCY }, { "chargeInTransit", SUMO_ATTR_CHARGEINTRANSIT }, { "chargeDelay", SUMO_ATTR_CHARGEDELAY}, + // MSDevice_Battery + { "actualBatteryCapacity", SUMO_ATTR_ACTUALBATTERYCAPACITY }, + { "maximumBatteryCapacity", SUMO_ATTR_MAXIMUMBATTERYCAPACITY }, + { "maximumPower", SUMO_ATTR_MAXIMUMPOWER }, + { "vehicleMass", SUMO_ATTR_VEHICLEMASS }, + { "frontSurfaceArea", SUMO_ATTR_FRONTSURFACEAREA }, + { "airDragCoefficient", SUMO_ATTR_AIRDRAGCOEFFICIENT }, + { "internalMomentOfInertia", SUMO_ATTR_INTERNALMOMENTOFINERTIA }, + { "radialDragCoefficient", SUMO_ATTR_RADIALDRAGCOEFFICIENT }, + { "rollDragCoefficient", SUMO_ATTR_ROLLDRAGCOEFFICIENT }, + { "constantPowerIntake", SUMO_ATTR_CONSTANTPOWERINTAKE }, + { "propulsionEfficiency", SUMO_ATTR_PROPULSIONEFFICIENCY }, + { "recuperationEfficiency", SUMO_ATTR_RECUPERATIONEFFICIENCY }, + { "stoppingTreshold", SUMO_ATTR_STOPPINGTRESHOLD }, + // MSBatteryExport + { "energyConsumed", SUMO_ATTR_ENERGYCONSUMED }, + { "chargingStationId", SUMO_ATTR_CHARGINGSTATIONID }, + { "energyCharged", SUMO_ATTR_ENERGYCHARGED }, + { "energyChargedInTransit", SUMO_ATTR_ENERGYCHARGEDINTRANSIT }, + { "energyChargedStopped", SUMO_ATTR_ENERGYCHARGEDSTOPPED }, + { "posOnLane", SUMO_ATTR_POSONLANE }, + { "timeStopped", SUMO_ATTR_TIMESTOPPED }, + // ChargingStation output + { "chargingStatus", SUMO_ATTR_CHARGING_STATUS }, + { "totalEnergyCharged", SUMO_ATTR_TOTALENERGYCHARGED }, + { "chargingSteps", SUMO_ATTR_CHARGINGSTEPS }, + { "totalEnergyChargedIntoVehicle", SUMO_ATTR_TOTALENERGYCHARGED_VEHICLE }, + { "chargingBegin", SUMO_ATTR_CHARGINGBEGIN }, + { "chargingEnd", SUMO_ATTR_CHARGINGEND }, + { "partialCharge", SUMO_ATTR_PARTIALCHARGE }, { "sigma", SUMO_ATTR_SIGMA }, { "tau", SUMO_ATTR_TAU }, @@ -285,6 +323,8 @@ { "tmp4", SUMO_ATTR_TMP4 }, { "tmp5", SUMO_ATTR_TMP5 }, + { "trainType", SUMO_ATTR_TRAIN_TYPE }, + { "lcStrategic", SUMO_ATTR_LCA_STRATEGIC_PARAM }, { "lcCooperative", SUMO_ATTR_LCA_COOPERATIVE_PARAM }, { "lcSpeedGain", SUMO_ATTR_LCA_SPEEDGAIN_PARAM }, @@ -292,6 +332,7 @@ { "lcSublane", SUMO_ATTR_LCA_SUBLANE_PARAM }, { "lcPushy", SUMO_ATTR_LCA_PUSHY }, { "lcAssertive", SUMO_ATTR_LCA_ASSERTIVE }, + { "lcExperimental1", SUMO_ATTR_LCA_EXPERIMENTAL1 }, { "last", SUMO_ATTR_LAST }, { "cost", SUMO_ATTR_COST }, @@ -313,6 +354,7 @@ { "personNumber", SUMO_ATTR_PERSON_NUMBER }, { "containerNumber", SUMO_ATTR_CONTAINER_NUMBER }, { "modes", SUMO_ATTR_MODES }, + { "walkFactor", SUMO_ATTR_WALKFACTOR }, { "function", SUMO_ATTR_FUNCTION }, { "pos", SUMO_ATTR_POSITION }, @@ -377,6 +419,8 @@ { "pass", SUMO_ATTR_PASS }, { "busStop", SUMO_ATTR_BUS_STOP }, { "containerStop", SUMO_ATTR_CONTAINER_STOP }, + { "parkingArea", SUMO_ATTR_PARKING_AREA }, + { "roadsideCapacity", SUMO_ATTR_ROADSIDE_CAPACITY }, { "chargingStation", SUMO_ATTR_CHARGING_STATION}, { "line", SUMO_ATTR_LINE }, { "lines", SUMO_ATTR_LINES }, @@ -445,6 +489,7 @@ { "version", SUMO_ATTR_VERSION }, { "junctionCornerDetail", SUMO_ATTR_CORNERDETAIL }, { "junctionLinkDetail", SUMO_ATTR_LINKDETAIL }, + { "rectangularLaneCut", SUMO_ATTR_RECTANGULAR_LANE_CUT }, { "lefthand", SUMO_ATTR_LEFTHAND }, { "actorConfig", SUMO_ATTR_ACTORCONFIG }, @@ -493,21 +538,27 @@ { "uniformRandomTraffic", AGEN_ATTR_UNI_RAND_TRAFFIC }, { "departureVariation", AGEN_ATTR_DEP_VARIATION }, - { "targetLanes", SUMO_ATTR_TARGETLANE }, - { "crossing", SUMO_ATTR_CROSSING }, - // netEdit { "modificationStatusNotForPrinting", GNE_ATTR_MODIFICATION_STATUS }, - { "shapeStartNotForPrinting", GNE_ATTR_SHAPE_START }, - { "shapeEndNotForPrinting", GNE_ATTR_SHAPE_END }, + { "shapeStart", GNE_ATTR_SHAPE_START }, + { "shapeEnd", GNE_ATTR_SHAPE_END }, { "blockMovement", GNE_ATTR_BLOCK_MOVEMENT }, { "parentOfAdditional", GNE_ATTR_PARENT }, + { "targetLanes", SUMO_ATTR_TARGETLANE }, + { "crossing", SUMO_ATTR_CROSSING }, + + { "xmlns:xsi", SUMO_ATTR_XMLNS }, + { "xsi:noNamespaceSchemaLocation", SUMO_ATTR_SCHEMA_LOCATION }, + // Other { "", SUMO_ATTR_NOTHING } //< must be the last one }; +const std::string SUMO_PARAM_ORIGID("origId"); + + StringBijection::Entry SUMOXMLDefinitions::sumoNodeTypeValues[] = { {"traffic_light", NODETYPE_TRAFFIC_LIGHT}, {"traffic_light_unregulated", NODETYPE_TRAFFIC_LIGHT_NOJUNCTION}, @@ -577,11 +628,11 @@ }; -StringBijection::Entry SUMOXMLDefinitions::trafficLightTypesVales[] = { +StringBijection::Entry SUMOXMLDefinitions::trafficLightTypesValues[] = { { "static", TLTYPE_STATIC }, { "rail", TLTYPE_RAIL }, { "actuated", TLTYPE_ACTUATED }, - { "delayBased", TLTYPE_DELAYBASED }, + { "delay_based", TLTYPE_DELAYBASED }, { "sotl_phase", TLTYPE_SOTL_PHASE }, { "sotl_platoon", TLTYPE_SOTL_PLATOON }, { "sotl_request", TLTYPE_SOTL_REQUEST }, @@ -606,10 +657,12 @@ { "Krauss", SUMO_TAG_CF_KRAUSS }, { "KraussPS", SUMO_TAG_CF_KRAUSS_PLUS_SLOPE }, { "KraussOrig1", SUMO_TAG_CF_KRAUSS_ORIG1 }, + { "KraussX", SUMO_TAG_CF_KRAUSSX }, // experimental extensions to the Krauss model { "SmartSK", SUMO_TAG_CF_SMART_SK }, { "Daniel1", SUMO_TAG_CF_DANIEL1 }, { "PWagner2009", SUMO_TAG_CF_PWAGNER2009 }, { "BKerner", SUMO_TAG_CF_BKERNER }, + { "Rail", SUMO_TAG_CF_RAIL }, { "Wiedemann", SUMO_TAG_CF_WIEDEMANN } //< must be the last one }; @@ -658,7 +711,7 @@ SUMOXMLDefinitions::linkDirectionValues, LINKDIR_NODIR); StringBijection SUMOXMLDefinitions::TrafficLightTypes( - SUMOXMLDefinitions::trafficLightTypesVales, TLTYPE_INVALID); + SUMOXMLDefinitions::trafficLightTypesValues, TLTYPE_INVALID); StringBijection SUMOXMLDefinitions::LaneChangeModels( SUMOXMLDefinitions::laneChangeModelValues, LCM_DEFAULT); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOXMLDefinitions.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOXMLDefinitions.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/SUMOXMLDefinitions.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/SUMOXMLDefinitions.h 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ /// @author Michael Behrisch /// @author Walter Bamberger /// @date Sept 2002 -/// @version $Id: SUMOXMLDefinitions.h 21802 2016-10-26 11:11:13Z namdre $ +/// @version $Id: SUMOXMLDefinitions.h 24108 2017-04-27 18:43:30Z behrisch $ /// // Definitions of elements and attributes known by SUMO /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -47,130 +47,162 @@ * @see SUMOSAXHandler */ enum SumoXMLTag { - /** invalid tag */ + /// @brief invalid tag SUMO_TAG_NOTHING, - /** root element of a network file */ + /// @brief root element of a network file SUMO_TAG_NET, - /** begin/end of the description of an edge */ + /// @brief begin/end of the description of an edge SUMO_TAG_EDGE, - /** begin/end of the description of a single lane */ + /// @brief begin/end of the description of a single lane SUMO_TAG_LANE, - /** begin/end of the description of a neighboring lane */ + /// @brief begin/end of the description of a neighboring lane SUMO_TAG_NEIGH, - /** begin/end of the description of a polygon */ + /// @brief begin/end of the description of a polygon SUMO_TAG_POI, - /** begin/end of the description of a polygon */ + /// @brief begin/end of the description of a polygon SUMO_TAG_POLY, - /** begin/end of the description of a junction */ + /// @brief begin/end of the description of a junction SUMO_TAG_JUNCTION, - /** begin/end of the description of an edge restriction */ + /// @brief begin/end of the description of an edge restriction SUMO_TAG_RESTRICTION, - /** an e1 detector */ + /// @brief an e1 detector SUMO_TAG_E1DETECTOR, + /// @brief alternative tag for e1 detector SUMO_TAG_INDUCTION_LOOP, - /** an e2 detector */ + /// @brief an e2 detector SUMO_TAG_E2DETECTOR, + /// @brief alternative tag for e2 detector SUMO_TAG_LANE_AREA_DETECTOR, - /** an e3 detector */ + /// @brief an e3 detector SUMO_TAG_E3DETECTOR, + /// @brief alternative tag for e3 detector SUMO_TAG_ENTRY_EXIT_DETECTOR, - /** an edge based mean data detector */ + /// @brief an edge based mean data detector SUMO_TAG_MEANDATA_EDGE, - /** a lane based mean data detector */ + /// @brief a lane based mean data detector SUMO_TAG_MEANDATA_LANE, - /** an e3 entry point*/ + /// @brief an e3 entry point SUMO_TAG_DET_ENTRY, - /** an e3 exit point */ + /// @brief an e3 exit point SUMO_TAG_DET_EXIT, - /// @brief An edge-following detector + /// @brief An edge-following detector SUMO_TAG_EDGEFOLLOWDETECTOR, - /// @brief An instantenous induction loop + /// @brief An instantenous induction loop SUMO_TAG_INSTANT_INDUCTION_LOOP, - /// @brief A variable speed sign + /// @brief A variable speed sign SUMO_TAG_VSS, - /// @brief A variable speed sign over lane - SUMO_TAG_VSSLANE, - /// @brief A calibrator + /// @brief A calibrator SUMO_TAG_CALIBRATOR, - /// @brief A rerouter + /// @brief A rerouter SUMO_TAG_REROUTER, - /// @brief A bus stop + /// @brief A bus stop SUMO_TAG_BUS_STOP, - /// @brief A train stop (alias for bus stop) + /// @brief A train stop (alias for bus stop) SUMO_TAG_TRAIN_STOP, - /// @brief An access point for a train stop + /// @brief An access point for a train stop SUMO_TAG_ACCESS, - /// @brief A container stop + /// @brief A container stop SUMO_TAG_CONTAINER_STOP, - /// @brief A Charging Station + /// @brief A parking area + SUMO_TAG_PARKING_AREA, + /// @brief A parking space for a single vehicle within a parking area + SUMO_TAG_PARKING_SPACE, + /// @brief A Charging Station SUMO_TAG_CHARGING_STATION, - /** a vtypeprobe detector */ + /// @brief a vtypeprobe detector SUMO_TAG_VTYPEPROBE, - /** a routeprobe detector */ + /// @brief a routeprobe detector SUMO_TAG_ROUTEPROBE, - /** root element of a route file */ + /// @brief root element of a route file SUMO_TAG_ROUTES, - /** description of a vehicle */ + /// @brief description of a vehicle SUMO_TAG_VEHICLE, - /** description of a vehicle type */ + /// @brief description of a vehicle type SUMO_TAG_VTYPE, - /** begin/end of the description of a route */ + /// @brief begin/end of the description of a route SUMO_TAG_ROUTE, - /** description of a logic request within the junction */ + /// @brief description of a logic request within the junction SUMO_TAG_REQUEST, - /** a source */ + /// @brief a source SUMO_TAG_SOURCE, - /** a traffic assignment zone */ + /// @brief a traffic assignment zone SUMO_TAG_TAZ, - /** a source within a district (connection road) */ + /// @brief a source within a district (connection road) SUMO_TAG_TAZSOURCE, - /** a sink within a district (connection road) */ + /// @brief a sink within a district (connection road) SUMO_TAG_TAZSINK, - /** a traffic light logic */ + /// @brief a traffic light + SUMO_TAG_TRAFFIC_LIGHT, + /// @brief a traffic light logic SUMO_TAG_TLLOGIC, - /** a single phase description */ + /// @brief a single phase description SUMO_TAG_PHASE, - /** a single trip definition (used by router) */ + /// @brief a single trip definition (used by router) SUMO_TAG_TRIP, - /** a flow definition (used by router) */ + /// @brief a flow definition (used by router) SUMO_TAG_FLOW, - /** trigger: a step description */ + /// @brief trigger: a step description SUMO_TAG_STEP, - /** an aggreagated-output interval */ + /// @brief an aggreagated-output interval SUMO_TAG_INTERVAL, - /// The definition of a periodic event + /// @brief The definition of a periodic event SUMO_TAG_TIMEDEVENT, - /// Incoming edge specification (jtrrouter) + /// @brief Incoming edge specification (jtrrouter) SUMO_TAG_FROMEDGE, - /// Outgoing edge specification (jtrrouter) + /// @brief Outgoing edge specification (jtrrouter) SUMO_TAG_TOEDGE, - /// Sink(s) specification + /// @brief Sink(s) specification SUMO_TAG_SINK, + /// @brief parameter associated to a certain key SUMO_TAG_PARAM, SUMO_TAG_WAUT, SUMO_TAG_WAUT_SWITCH, SUMO_TAG_WAUT_JUNCTION, + /// @brief segment of a lane SUMO_TAG_SEGMENT, + /// @brief delete certain element SUMO_TAG_DELETE, + /// @brief stop for vehicles SUMO_TAG_STOP, + /// @brief probability of destiny of a reroute SUMO_TAG_DEST_PROB_REROUTE, + /// @brief reroute of type closing SUMO_TAG_CLOSING_REROUTE, + /// @brief lane of a reroute of type closing SUMO_TAG_CLOSING_LANE_REROUTE, + /// @brief probability of route of a reroute SUMO_TAG_ROUTE_PROB_REROUTE, + /// @brief entry for an alternative parking zone + SUMO_TAG_PARKING_ZONE_REROUTE, + /// @brief type of poligon SUMO_TAG_POLYTYPE, + /// @brief connectio between two lanes SUMO_TAG_CONNECTION, + /// @brief prohibition of circulation between two edges SUMO_TAG_PROHIBITION, + /// @brief split something SUMO_TAG_SPLIT, + /// @brief alternative definition for junction SUMO_TAG_NODE, + /// @brief type SUMO_TAG_TYPE, + /// @brief definition of a detector SUMO_TAG_DETECTOR_DEFINITION, + /// @brief distribution of a route SUMO_TAG_ROUTE_DISTRIBUTION, + /// @brief distribution of a vehicle type SUMO_TAG_VTYPE_DISTRIBUTION, + /// @brief vaporizer of vehicles SUMO_TAG_VAPORIZER, + /// @brief roundabout defined in junction SUMO_TAG_ROUNDABOUT, + /// @brief Join operation SUMO_TAG_JOIN, + /// @brief join exlude operation SUMO_TAG_JOINEXCLUDE, + /// @brief crossing between edges for pedestrians SUMO_TAG_CROSSING, + /// @brief Custom shape for an element SUMO_TAG_CUSTOMSHAPE, SUMO_TAG_WAY, @@ -179,6 +211,8 @@ SUMO_TAG_RELATION, SUMO_TAG_MEMBER, + /// @name parameters associated to view settings + /// @{ SUMO_TAG_VIEWSETTINGS, SUMO_TAG_VIEWSETTINGS_DECAL, SUMO_TAG_VIEWSETTINGS_LIGHT, @@ -205,10 +239,17 @@ SUMO_TAG_COLORSCHEME, SUMO_TAG_SCALINGSCHEME, SUMO_TAG_ENTRY, + /// @} + + SUMO_TAG_VEHICLETRANSFER, + SUMO_TAG_DEVICE, + /// @name Car-Following models + /// @{ SUMO_TAG_CF_KRAUSS, SUMO_TAG_CF_KRAUSS_PLUS_SLOPE, SUMO_TAG_CF_KRAUSS_ORIG1, + SUMO_TAG_CF_KRAUSSX, SUMO_TAG_CF_SMART_SK, SUMO_TAG_CF_DANIEL1, SUMO_TAG_CF_IDM, @@ -216,11 +257,16 @@ SUMO_TAG_CF_PWAGNER2009, SUMO_TAG_CF_BKERNER, SUMO_TAG_CF_WIEDEMANN, + SUMO_TAG_CF_RAIL, + /// @} + /// @name Pedestrians + /// @{ SUMO_TAG_PERSON, SUMO_TAG_PERSONTRIP, SUMO_TAG_RIDE, SUMO_TAG_WALK, + /// @} SUMO_TAG_CONTAINER, SUMO_TAG_TRANSPORT, @@ -232,42 +278,43 @@ SUMO_TAG_MOTIONSTATE, SUMO_TAG_OD_PAIR, - /** - * ActivityGen Tags - **/ + /// @brief ActivityGen Tags AGEN_TAG_GENERAL, - /* streets object */ + /// @brief streets object AGEN_TAG_STREET, - - /* workingHours object */ + /// @brief workingHours object AGEN_TAG_WORKHOURS, + /// @brief opening for workingHours object AGEN_TAG_OPENING, + /// @brief closing for workingHours object AGEN_TAG_CLOSING, - - /* school object */ + /// @brief school object AGEN_TAG_SCHOOLS, + /// @brief schools object AGEN_TAG_SCHOOL, - - /* busStation and bus objects */ + /// @brief busStation and bus objects AGEN_TAG_BUSSTATION, + /// @brief bus line AGEN_TAG_BUSLINE, + /// @brief stations for certain vehicles AGEN_TAG_STATIONS, + /// @brief rev stations for certain vehicles AGEN_TAG_REV_STATIONS, + /// @brief station for a certain vehicle AGEN_TAG_STATION, + /// @brief frequency of a object AGEN_TAG_FREQUENCY, - - /* population and children accompaniment brackets */ + /// @brief population and children accompaniment brackets AGEN_TAG_POPULATION, + /// @brief alternative definition for Population AGEN_TAG_BRACKET, //AGEN_TAG_CHILD_ACOMP, - - /* city entrances */ + /// @brief city entrances AGEN_TAG_CITYGATES, + /// @brief alternative definition for city entrances AGEN_TAG_ENTRANCE, - - /* parameters */ + /// @brief parameters AGEN_TAG_PARAM - }; @@ -278,9 +325,11 @@ * @see SUMOSAXHandler */ enum SumoXMLAttr { - /** invalid attribute */ + /// @brief invalid attribute SUMO_ATTR_NOTHING, - /* common attributes */ + + /// @name common attributes + /// @{ SUMO_ATTR_ID, SUMO_ATTR_REFID, SUMO_ATTR_NAME, @@ -294,13 +343,18 @@ SUMO_ATTR_BIKELANEWIDTH, SUMO_ATTR_REMOVE, SUMO_ATTR_LENGTH, + SUMO_ATTR_ID_BEFORE, + SUMO_ATTR_ID_AFTER, SUMO_ATTR_X, SUMO_ATTR_Y, SUMO_ATTR_Z, SUMO_ATTR_CENTER_X, SUMO_ATTR_CENTER_Y, SUMO_ATTR_CENTER_Z, - /* sumo-junction attributes */ + /// @} + + /// @name sumo-junction attributes + /// @{ SUMO_ATTR_KEY, SUMO_ATTR_REQUESTSIZE, SUMO_ATTR_REQUEST, @@ -310,13 +364,20 @@ SUMO_ATTR_ENDOFFSET, SUMO_ATTR_INCLANES, SUMO_ATTR_INTLANES, - /// the weight of a district's source or sink + /// @} + + /// @name the weight of a district's source or sink + /// @{ SUMO_ATTR_WEIGHT, SUMO_ATTR_NODE, SUMO_ATTR_EDGE, - /// the edges of a route + /// @} + + /// @brief the edges of a route SUMO_ATTR_EDGES, - /* vehicle attributes */ + + /// @name vehicle attributes + /// @{ SUMO_ATTR_DEPART, SUMO_ATTR_DEPARTLANE, SUMO_ATTR_DEPARTPOS, @@ -333,6 +394,8 @@ SUMO_ATTR_MINGAP_LAT, SUMO_ATTR_ACCEL, SUMO_ATTR_DECEL, + SUMO_ATTR_EMERGENCYDECEL, + SUMO_ATTR_APPARENTDECEL, SUMO_ATTR_VCLASS, SUMO_ATTR_REPNUMBER, SUMO_ATTR_SPEEDFACTOR, @@ -342,12 +405,88 @@ SUMO_ATTR_MINGAP, SUMO_ATTR_BOARDING_DURATION, SUMO_ATTR_LOADING_DURATION, - /* Charging Station */ - SUMO_ATTR_CHARGINGPOWER, // charge in W of the Charging Stations - SUMO_ATTR_EFFICIENCY, // Eficiency of the charge inCharging Stations - SUMO_ATTR_CHARGEINTRANSIT, // Allow/disallow charge in transit in Charging Stations - SUMO_ATTR_CHARGEDELAY, // Delay in the charge of charging stations - /* Car following model attributes */ + /// @} + + /// @name charging stations attributes + /// @{ + /// @brief charge in W/s of the Charging Stations + SUMO_ATTR_CHARGINGPOWER, + /// @brief Eficiency of the charge in Charging Stations + SUMO_ATTR_EFFICIENCY, + /// @brief Allow/disallow charge in transit in Charging Stations + SUMO_ATTR_CHARGEINTRANSIT, + /// @brief Delay in the charge of charging stations + SUMO_ATTR_CHARGEDELAY, + /// @} + + /// @name battery device parameters + /// @{ + /// @brief Actual battery capacity + SUMO_ATTR_ACTUALBATTERYCAPACITY, + /// @brief Maxium battery capacity + SUMO_ATTR_MAXIMUMBATTERYCAPACITY, + /// @brief Maximum Power + SUMO_ATTR_MAXIMUMPOWER, + /// @brief Vehicle mass + SUMO_ATTR_VEHICLEMASS, + /// @brief Front surface area + SUMO_ATTR_FRONTSURFACEAREA, + /// @brief Air drag coefficient + SUMO_ATTR_AIRDRAGCOEFFICIENT, + /// @brief Internal moment of inertia + SUMO_ATTR_INTERNALMOMENTOFINERTIA, + /// @brief Radial drag coefficient + SUMO_ATTR_RADIALDRAGCOEFFICIENT, + /// @brief Roll Drag coefficient + SUMO_ATTR_ROLLDRAGCOEFFICIENT, + /// @brief Constant Power Intake + SUMO_ATTR_CONSTANTPOWERINTAKE, + /// @brief Propulsion efficiency + SUMO_ATTR_PROPULSIONEFFICIENCY, + /// @brief Recuperation efficiency + SUMO_ATTR_RECUPERATIONEFFICIENCY, + /// @brief Stopping treshold + SUMO_ATTR_STOPPINGTRESHOLD, + /// @} + + /// @name battery export parameters + /// @{ + /// @brief charging status + SUMO_ATTR_CHARGING_STATUS, + /// @brief Energy consumed + SUMO_ATTR_ENERGYCONSUMED, + /// @brief Charging Station ID + SUMO_ATTR_CHARGINGSTATIONID, + /// @brief tgotal of Energy charged + SUMO_ATTR_ENERGYCHARGED, + /// @brief Energy charged in transit + SUMO_ATTR_ENERGYCHARGEDINTRANSIT, + /// @brief Energy charged stopped + SUMO_ATTR_ENERGYCHARGEDSTOPPED, + /// @brief Position on lane + SUMO_ATTR_POSONLANE, + /// @brief Time stopped + SUMO_ATTR_TIMESTOPPED, + /// @} + + /// @name chargingStations export parameters + /// @{ + /// @brief total energy charged by charging station + SUMO_ATTR_TOTALENERGYCHARGED, + /// @brief number of steps that a vehicle is charging + SUMO_ATTR_CHARGINGSTEPS, + /// @brief total energy charged into a single vehicle + SUMO_ATTR_TOTALENERGYCHARGED_VEHICLE, + /// @brief timestep in which charging begins + SUMO_ATTR_CHARGINGBEGIN, + /// @brief timesteps in which charging ends + SUMO_ATTR_CHARGINGEND, + /// @brief energy provied by charging station at certain timestep + SUMO_ATTR_PARTIALCHARGE, + /// @} + + /// @name Car following model attributes + /// @{ SUMO_ATTR_SIGMA, // used by: Krauss SUMO_ATTR_TAU, // Krauss SUMO_ATTR_TMP1, @@ -355,7 +494,15 @@ SUMO_ATTR_TMP3, SUMO_ATTR_TMP4, SUMO_ATTR_TMP5, - /* Lane changing model attributes */ + /// @} + + /// @name Train model attributes + /// @{ + SUMO_ATTR_TRAIN_TYPE, //used by: Rail + /// @} + + /// @name Lane changing model attributes + /// @{ SUMO_ATTR_LCA_STRATEGIC_PARAM, SUMO_ATTR_LCA_COOPERATIVE_PARAM, SUMO_ATTR_LCA_SPEEDGAIN_PARAM, @@ -363,14 +510,21 @@ SUMO_ATTR_LCA_SUBLANE_PARAM, SUMO_ATTR_LCA_PUSHY, SUMO_ATTR_LCA_ASSERTIVE, - /* route alternatives / distribution attributes */ + SUMO_ATTR_LCA_EXPERIMENTAL1, + /// @} + + /// @name route alternatives / distribution attributes + /// @{ SUMO_ATTR_LAST, SUMO_ATTR_COST, SUMO_ATTR_PROB, SUMO_ATTR_PROBS, SUMO_ATTR_ROUTES, SUMO_ATTR_VTYPES, - /* trip definition attributes */ + /// @} + + /// @name trip definition attributes + /// @{ SUMO_ATTR_LANE, SUMO_ATTR_LANES, SUMO_ATTR_FROM, @@ -384,7 +538,11 @@ SUMO_ATTR_PERSON_NUMBER, SUMO_ATTR_CONTAINER_NUMBER, SUMO_ATTR_MODES, - /* source definitions */ + SUMO_ATTR_WALKFACTOR, + /// @} + + /// @name source definitions + /// @{ SUMO_ATTR_FUNCTION, SUMO_ATTR_POSITION, SUMO_ATTR_POSITION_LAT, @@ -396,41 +554,43 @@ SUMO_ATTR_DURATION, SUMO_ATTR_UNTIL, SUMO_ATTR_ROUTEPROBE, - /* the edges crossed by a pedestrian crossing */ + /// @} + + /// @brief the edges crossed by a pedestrian crossing SUMO_ATTR_CROSSING_EDGES, - /** trigger: the time of the step */ + /// @brief trigger: the time of the step SUMO_ATTR_TIME, - /** weights: time range begin */ + /// @brief weights: time range begin SUMO_ATTR_BEGIN, - /** weights: time range end */ + /// @brief weights: time range end SUMO_ATTR_END, - /** link,node: the traffic light id responsible for this link */ + /// @brief link,node: the traffic light id responsible for this link SUMO_ATTR_TLID, - /** node: the type of traffic light */ + /// @brief node: the type of traffic light SUMO_ATTR_TLTYPE, - /** link: the index of the link within the traffic light */ + /// @brief link: the index of the link within the traffic light SUMO_ATTR_TLLINKINDEX, - /** edge: the shape in xml-definition */ + /// @brief edge: the shape in xml-definition SUMO_ATTR_SHAPE, - /// The information about how to spread the lanes from the given position + /// @brief The information about how to spread the lanes from the given position SUMO_ATTR_SPREADTYPE, - /// The turning radius at an intersection in m + /// @brief The turning radius at an intersection in m SUMO_ATTR_RADIUS, - /// Whether vehicles must keep the junction clear + /// @brief Whether vehicles must keep the junction clear SUMO_ATTR_KEEP_CLEAR, - /// whether a given shape is user-defined + /// @brief whether a given shape is user-defined SUMO_ATTR_CUSTOMSHAPE, - /// A color information + /// @brief A color information SUMO_ATTR_COLOR, - /// The abstract direction of a link + /// @brief The abstract direction of a link SUMO_ATTR_DIR, - /// The state of a link + /// @brief The state of a link SUMO_ATTR_STATE, - /// foe visibility distance of a link + /// @brief foe visibility distance of a link SUMO_ATTR_VISIBILITY_DISTANCE, - /// A layer number + /// @brief A layer number SUMO_ATTR_LAYER, - /// Fill the polygon + /// @brief Fill the polygon SUMO_ATTR_FILL, SUMO_ATTR_PREFIX, SUMO_ATTR_DISCARD, @@ -440,23 +600,32 @@ SUMO_ATTR_DEST, SUMO_ATTR_SOURCE, SUMO_ATTR_VIA, - /// a list of node ids, used for controlling joining + /// @brief a list of node ids, used for controlling joining SUMO_ATTR_NODES, - // Attributes for actuated traffic lights: - /// minimum duration of a phase + + /// @name Attributes for actuated traffic lights: + /// @{ + /// @brief minimum duration of a phase SUMO_ATTR_MINDURATION, - /// maximum duration of a phase + /// @brief maximum duration of a phase SUMO_ATTR_MAXDURATION, - // Attributes for junction-internal lanes - /// Information within the junction logic which internal lanes block external + /// @} + + /// @name Attributes for junction-internal lanes + /// @{ + /// @brief Information within the junction logic which internal lanes block external SUMO_ATTR_FOES, - // Attributes for detectors - /// Information whether the detector shall be continued on the folowing lanes + /// @} + + /// @name Attributes for detectors + /// @{ + /// @brief Information whether the detector shall be continued on the folowing lanes SUMO_ATTR_CONT, SUMO_ATTR_CONTPOS, SUMO_ATTR_HALTING_TIME_THRESHOLD, SUMO_ATTR_HALTING_SPEED_THRESHOLD, SUMO_ATTR_JAM_DIST_THRESHOLD, + /// @} SUMO_ATTR_WAUT_ID, SUMO_ATTR_JUNCTION_ID, @@ -472,6 +641,8 @@ SUMO_ATTR_PASS, SUMO_ATTR_BUS_STOP, SUMO_ATTR_CONTAINER_STOP, + SUMO_ATTR_PARKING_AREA, + SUMO_ATTR_ROADSIDE_CAPACITY, SUMO_ATTR_CHARGING_STATION, SUMO_ATTR_LINE, SUMO_ATTR_LINES, @@ -523,6 +694,8 @@ SUMO_ATTR_ORIG_BOUNDARY, SUMO_ATTR_ORIG_PROJ, + /// @name car-following model attributes + /// @{ SUMO_ATTR_CF_PWAGNER2009_TAULAST, SUMO_ATTR_CF_PWAGNER2009_APPROB, SUMO_ATTR_CF_IDM_DELTA, @@ -532,6 +705,7 @@ SUMO_ATTR_CF_KERNER_PHI, SUMO_ATTR_CF_WIEDEMANN_SECURITY, SUMO_ATTR_CF_WIEDEMANN_ESTIMATION, + /// @} SUMO_ATTR_GENERATE_WALKS, SUMO_ATTR_ACTTYPE, @@ -539,6 +713,7 @@ SUMO_ATTR_VERSION, SUMO_ATTR_CORNERDETAIL, SUMO_ATTR_LINKDETAIL, + SUMO_ATTR_RECTANGULAR_LANE_CUT, SUMO_ATTR_LEFTHAND, SUMO_ATTR_COMMAND, @@ -553,10 +728,11 @@ SUMO_ATTR_DESTINATION, - /** - * ActivityGen Tags - **/ - /* general object */ + /// @name ActivityGen Tags + /// @{ + + /// @name general object + /// @{ AGEN_ATTR_INHABITANTS, AGEN_ATTR_HOUSEHOLDS, AGEN_ATTR_CHILDREN, @@ -566,70 +742,93 @@ AGEN_ATTR_MAX_FOOT_DIST, AGEN_ATTR_IN_TRAFFIC, AGEN_ATTR_OUT_TRAFFIC, + /// @} - /* streets object */ + /// @name streets object + /// @{ //SUMO_ATTR_EDGE already defined AGEN_ATTR_POPULATION, AGEN_ATTR_OUT_WORKPOSITION, + /// @} - /* workHours object */ + /// @name workHours object + /// @{ AGEN_ATTR_HOUR, AGEN_ATTR_PROP, + /// @} - /* school object */ + /// @name school object + /// @{ //SUMO_ATTR_EDGE, SUMO_ATTR_POSITION, SUMO_ATTR_TYPE already defined AGEN_ATTR_CAPACITY, AGEN_ATTR_OPENING, AGEN_ATTR_CLOSING, + /// @} - /* busStation and Bus objects */ + /// @name busStation and Bus objects + /// @{ // ID, EDGE, POSITION, REFID, BEGIN and END are already defined AGEN_ATTR_MAX_TRIP_DURATION, //AGEN_ATTR_ORDER, AGEN_ATTR_RATE, + /// @} - /* population and children accompaniment brackets */ + /// @name population and children accompaniment brackets + /// @{ AGEN_ATTR_BEGINAGE, AGEN_ATTR_ENDAGE, AGEN_ATTR_PEOPLENBR, + /// @} - /* parameters */ + /// @name parameters + /// @{ AGEN_ATTR_CARPREF, AGEN_ATTR_CITYSPEED, AGEN_ATTR_FREETIMERATE, AGEN_ATTR_UNI_RAND_TRAFFIC, AGEN_ATTR_DEP_VARIATION, + /// @} - /* city gates */ + /// @name city gates + /// @{ AGEN_ATTR_INCOMING, AGEN_ATTR_OUTGOING, + /// @} + /// @} //@name Netedit Attributes (used as virtual property holders, must be in SumoXMLAttr) - // //@{ - /* whether a feature has been loaded,guessed,modified or approved */ + /// @brief whether a feature has been loaded,guessed,modified or approved GNE_ATTR_MODIFICATION_STATUS, - /* first coordinate of edge shape */ + /// @brief first coordinate of edge shape GNE_ATTR_SHAPE_START, - /* last coordinate of edge shape */ + /// @brief last coordinate of edge shape GNE_ATTR_SHAPE_END, - /* block movement of a graphic element*/ + /// @brief block movement of a graphic element GNE_ATTR_BLOCK_MOVEMENT, - /* parent of an additional element*/ + /// @brief parent of an additional element GNE_ATTR_PARENT, - //@} + // @} SUMO_ATTR_TARGETLANE, - SUMO_ATTR_CROSSING + SUMO_ATTR_CROSSING, + SUMO_ATTR_XMLNS, + SUMO_ATTR_SCHEMA_LOCATION }; /* - * definitions of special SumoXML-attribute values. + * @brief definitions of special SumoXML-attribute values. * Since these enums shall be used in switch statements we keep them separated * @{ */ /** + * SumoXMLParam Key Constants. Since all usage contexts needs strings rather + * than enum values we do not bother with a StringBijection + */ +extern const std::string SUMO_PARAM_ORIGID; + +/** * @enum SumoXMLNodeType * @brief Numbers representing special SUMO-XML-attribute values * for representing node- (junction-) types used in netbuild/netimport and netload @@ -737,28 +936,26 @@ * used in netbuild (formerly NBMMLDirection) and MSLink */ enum LinkDirection { - /// The link is a straight direction + /// @brief The link is a straight direction LINKDIR_STRAIGHT = 0, - /// The link is a 180 degree turn + /// @brief The link is a 180 degree turn LINKDIR_TURN, - /// The link is a 180 degree turn (left-hand network) + /// @brief The link is a 180 degree turn (left-hand network) LINKDIR_TURN_LEFTHAND, - /// The link is a (hard) left direction + /// @brief The link is a (hard) left direction LINKDIR_LEFT, - /// The link is a (hard) right direction + /// @brief The link is a (hard) right direction LINKDIR_RIGHT, - /// The link is a partial left direction + /// @brief The link is a partial left direction LINKDIR_PARTLEFT, - /// The link is a partial right direction + /// @brief The link is a partial right direction LINKDIR_PARTRIGHT, - /// The link has no direction (is a dead end link) + /// @brief The link has no direction (is a dead end link) LINKDIR_NODIR }; -/** - * @enum TrafficLightType - */ +/// @enum TrafficLightType enum TrafficLightType { TLTYPE_STATIC, TLTYPE_RAIL, @@ -774,13 +971,13 @@ TLTYPE_INVALID //< must be the last one }; + /** @enum LaneChangeAction * @brief The state of a vehicle's lane-change behavior */ enum LaneChangeAction { /// @name currently wanted lane-change action /// @{ - /// @brief No action desired LCA_NONE = 0, /// @brief Needs to stay on the current lane @@ -789,7 +986,6 @@ LCA_LEFT = 1 << 1, /// @brief Wants go to the right LCA_RIGHT = 1 << 2, - /// @brief The action is needed to follow the route (navigational lc) LCA_STRATEGIC = 1 << 3, /// @brief The action is done to help someone else @@ -800,59 +996,51 @@ LCA_KEEPRIGHT = 1 << 6, /// @brief The action is due to a TraCI request LCA_TRACI = 1 << 7, - /// @brief The action is urgent (to be defined by lc-model) LCA_URGENT = 1 << 8, - + /// @brief The action has not been determined + LCA_UNKNOWN = 1 << 30, /// @} /// @name External state /// @{ - /// @brief The vehicle is blocked by left leader LCA_BLOCKED_BY_LEFT_LEADER = 1 << 9, /// @brief The vehicle is blocked by left follower LCA_BLOCKED_BY_LEFT_FOLLOWER = 1 << 10, - /// @brief The vehicle is blocked by right leader LCA_BLOCKED_BY_RIGHT_LEADER = 1 << 11, /// @brief The vehicle is blocked by right follower LCA_BLOCKED_BY_RIGHT_FOLLOWER = 1 << 12, - - // The vehicle is blocked being overlapping - LCA_OVERLAPPING = 1 << 13, - - // The vehicle does not have enough space to complete a continuous lane - // change before the next turning movement - LCA_INSUFFICIENT_SPACE = 1 << 14, - - // used by the sublane model + /// @brief The vehicle is blocked being overlapping + LCA_OVERLAPPING = 1 << 13, + /// @brief The vehicle does not have enough space to complete a continuous lane and change before the next turning movement + LCA_INSUFFICIENT_SPACE = 1 << 14, + /// @brief used by the sublane model LCA_SUBLANE = 1 << 15, - + /// @brief lane can change LCA_WANTS_LANECHANGE = LCA_LEFT | LCA_RIGHT, + /// @brief lane can change or stay LCA_WANTS_LANECHANGE_OR_STAY = LCA_WANTS_LANECHANGE | LCA_STAY, - + /// @brief blocked left LCA_BLOCKED_LEFT = LCA_BLOCKED_BY_LEFT_LEADER | LCA_BLOCKED_BY_LEFT_FOLLOWER, + /// @brief blocked right LCA_BLOCKED_RIGHT = LCA_BLOCKED_BY_RIGHT_LEADER | LCA_BLOCKED_BY_RIGHT_FOLLOWER, + /// @brief blocked by leader LCA_BLOCKED_BY_LEADER = LCA_BLOCKED_BY_LEFT_LEADER | LCA_BLOCKED_BY_RIGHT_LEADER, + /// @brief blocker by follower LCA_BLOCKED_BY_FOLLOWER = LCA_BLOCKED_BY_LEFT_FOLLOWER | LCA_BLOCKED_BY_RIGHT_FOLLOWER, + /// @brief blocked in all directions LCA_BLOCKED = LCA_BLOCKED_LEFT | LCA_BLOCKED_RIGHT | LCA_INSUFFICIENT_SPACE, - + /// @brief reasons of lane change LCA_CHANGE_REASONS = (LCA_STRATEGIC | LCA_COOPERATIVE | LCA_SPEEDGAIN | LCA_KEEPRIGHT | LCA_SUBLANE) - // LCA_BLOCKED_BY_CURRENT_LEADER = 1 << 28 // LCA_BLOCKED_BY_CURRENT_FOLLOWER = 1 << 29 /// @} - }; - - - -/** - * @enum LaneChangeModel - */ +/// @enum LaneChangeModel enum LaneChangeModel { LCM_DK2008, LCM_LC2013, @@ -860,102 +1048,127 @@ LCM_DEFAULT }; - -//@} -// /** * @enum LateralAlignment * @brief Numbers representing special SUMO-XML-attribute values * Information how vehicles align themselves within their lane by default */ enum LateralAlignment { - LATALIGN_RIGHT, // drive on the right side - LATALIGN_CENTER, // drive in the middle - LATALIGN_ARBITRARY, // maintain the current alignment - LATALIGN_NICE, // align with the closest sublane border - LATALIGN_COMPACT, // align with the rightmost sublane that allows keeping the current speed - LATALIGN_LEFT // drive on the left side + /// @brief drive on the right side + LATALIGN_RIGHT, + /// @brief drive in the middle + LATALIGN_CENTER, + /// @brief maintain the current alignment + LATALIGN_ARBITRARY, + /// @brief align with the closest sublane border + LATALIGN_NICE, + /// @brief align with the rightmost sublane that allows keeping the current speed + LATALIGN_COMPACT, + /// @brief drive on the left side + LATALIGN_LEFT }; +// @} + /** * @class SUMOXMLDefinitions * @brief class for maintaining associations between enums and xml-strings */ - class SUMOXMLDefinitions { public: - /// The names of SUMO-XML elements (for passing to GenericSAXHandler) + /// @brief The names of SUMO-XML elements (for passing to GenericSAXHandler) static StringBijection::Entry tags[]; - /// The names of SUMO-XML attributes (for passing to GenericSAXHandler) + /// @brief The names of SUMO-XML attributes (for passing to GenericSAXHandler) static StringBijection::Entry attrs[]; - /// The names of SUMO-XML elements for use in netbuild + /// @brief The names of SUMO-XML elements for use in netbuild static StringBijection Tags; - /// The names of SUMO-XML attributes for use in netbuild + /// @brief The names of SUMO-XML attributes for use in netbuild static StringBijection Attrs; /// @name Special values of SUMO-XML attributes - //@{ + /// @{ + + /// @brief node types static StringBijection NodeTypes; + /// @brief edge functions static StringBijection EdgeFunctions; + /// @brief lane spread functions static StringBijection LaneSpreadFunctions; + /// @brief link states static StringBijection LinkStates; + /// @brief link directions static StringBijection LinkDirections; + /// @brief traffic light types static StringBijection TrafficLightTypes; + /// @brief lane change models static StringBijection LaneChangeModels; + /// @brief car following models static StringBijection CarFollowModels; + /// @brief lateral alignments static StringBijection LateralAlignments; + /// @brief lane change actions static StringBijection LaneChangeActions; - //@} + /// @} /// @name Helper functions for ID-string manipulations - //@{ - + /// @{ /// @brief return the junction id when given an edge of type internal, crossing or WalkingArea static std::string getJunctionIDFromInternalEdge(const std::string internalEdge); /// @brief return edge id when given the lane ID static std::string getEdgeIDFromLane(const std::string laneID); - - //@} + /// @} private: + /// @brief containers for the different SUMOXMLDefinitions + /// @{ + /// @brief node type values static StringBijection::Entry sumoNodeTypeValues[]; + /// @brief edge function values static StringBijection::Entry sumoEdgeFuncValues[]; + /// @brief lane spread function values static StringBijection::Entry laneSpreadFunctionValues[]; + /// @brief link state values static StringBijection::Entry linkStateValues[]; + /// @brief link direction values static StringBijection::Entry linkDirectionValues[]; - static StringBijection::Entry trafficLightTypesVales[]; + /// @brief traffic light types values + static StringBijection::Entry trafficLightTypesValues[]; + /// @brief lane change model values static StringBijection::Entry laneChangeModelValues[]; + /// @brief car follwing model values static StringBijection::Entry carFollowModelValues[]; + /// @brief lanteral alignment values static StringBijection::Entry lateralAlignmentValues[]; + /// @brief lane change action values static StringBijection::Entry laneChangeActionValues[]; - + /// @} }; #endif -/****************************************************************************/ +/****************************************************************************/ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/XMLSubSys.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/XMLSubSys.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/XMLSubSys.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/XMLSubSys.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date Mon, 1 Jul 2002 -/// @version $Id: XMLSubSys.cpp 21316 2016-08-22 13:08:50Z behrisch $ +/// @version $Id: XMLSubSys.cpp 23529 2017-03-18 10:22:36Z behrisch $ /// // Utility methods for initialising, closing and using the XML-subsystem /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -37,10 +37,6 @@ #include "SUMOSAXReader.h" #include "XMLSubSys.h" -#ifdef CHECK_MEMORY_LEAKS -#include -#endif // CHECK_MEMORY_LEAKS - // =========================================================================== // static member variables diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/XMLSubSys.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/XMLSubSys.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/utils/xml/XMLSubSys.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/utils/xml/XMLSubSys.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date Mon, 1 Jul 2002 -/// @version $Id: XMLSubSys.h 21182 2016-07-18 06:46:01Z behrisch $ +/// @version $Id: XMLSubSys.h 22608 2017-01-17 06:28:54Z behrisch $ /// // Utility methods for initialising, closing and using the XML-subsystem /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2002-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/version.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/version.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/version.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/version.h 2017-07-23 16:22:03.000000000 +0000 @@ -1 +1 @@ -#define VERSION_STRING "dev-SVN-r21853" +#define VERSION_STRING "dev-SVN-r24130" diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/windows_config.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/windows_config.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/src/windows_config.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/src/windows_config.h 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ /// @author Felix Brack /// @author Jakob Erdmann /// @date Mon, 17 Dec 2001 -/// @version $Id: windows_config.h 21852 2016-10-31 12:26:19Z behrisch $ +/// @version $Id: windows_config.h 24130 2017-05-01 19:45:53Z behrisch $ /// // The general windows configuration file /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -29,6 +29,8 @@ #error This file is for MSVC compilation only. GCC should use configure generated config.h. #endif +/* Disable "decorated name length exceeded, name was truncated" warnings. */ +#pragma warning(disable: 4503) /* Disable "identifier truncated in debug info" warnings. */ #pragma warning(disable: 4786) /* Disable "C++ Exception Specification ignored" warnings */ @@ -48,40 +50,22 @@ /* Define for dynamic Fox linkage */ #define FOXDLL 1 -/* defines the precision of floats */ -#define SUMOReal double - /* defines the epsilon to use on position comparison */ -#define POSITION_EPS (SUMOReal)0.1 +#define POSITION_EPS 0.1 /* defines the epsilon to use on general floating point comparison */ -#define NUMERICAL_EPS (SUMOReal)0.001 - -/* defines the number of digits after the comma in output */ -#define OUTPUT_ACCURACY 2 - -/* defines the number of digits after the comma in output of geo-coordinates */ -#define GEO_OUTPUT_ACCURACY 6 +#define NUMERICAL_EPS 0.001 /* Define if auto-generated version.h should be used. */ //#define HAVE_VERSION_H 1 /* Version number of package */ #ifndef HAVE_VERSION_H -#define VERSION_STRING "0.28.0" +#define VERSION_STRING "0.30.0" #endif -/* Define if junction internal lanes should be used. */ -#define HAVE_INTERNAL_LANES 1 - /* Definition for the character function of Xerces */ #define XERCES3_SIZE_t XMLSize_t //Xerces >= 3.0 //#define XERCES3_SIZE_t unsigned int //Xerces < 3.0 -/* define to use nvwa for memory leak checking */ -//#define CHECK_MEMORY_LEAKS 1 - -/* work around missing snprintf function (WARNING: return value semantics differ) */ -#define snprintf _snprintf - #endif diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/Assignment.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/Assignment.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/Assignment.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/Assignment.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,7 @@ @author Yun-Pang Floetteroed @author Michael Behrisch @date 2008-03-28 -@version $Id: Assignment.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: Assignment.py 22608 2017-01-17 06:28:54Z behrisch $ This script is for executing the traffic assignment. Three assignment models are available: @@ -16,7 +16,7 @@ The c-logit model are set as default. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -157,7 +157,7 @@ else: foutroute = open('routes.rou.xml', 'w') print(""" - + """ % starttime, file=foutroute) # for counter in range (0, len(matrices)): diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/assign.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/assign.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/assign.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/assign.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,13 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2007-11-25 -@version $Id: assign.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: assign.py 22608 2017-01-17 06:28:54Z behrisch $ This script is for executing traffic assignment according to the required assignment model. The incremental assignment model, the C-Logit assignment model and the Lohse assignment model are included in this script. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/cadytsIterate.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/cadytsIterate.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/cadytsIterate.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/cadytsIterate.py 2017-07-23 16:22:03.000000000 +0000 @@ -7,13 +7,13 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2010-09-15 -@version $Id: cadytsIterate.py 21851 2016-10-31 12:20:12Z behrisch $ +@version $Id: cadytsIterate.py 22608 2017-01-17 06:28:54Z behrisch $ Run cadyts to calibrate the simulation with given routes and traffic measurements. Respective traffic zones information has to exist in the given route files. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/costFunctionChecker.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/costFunctionChecker.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/costFunctionChecker.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/costFunctionChecker.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ @author Daniel Krajzewicz @author Jakob Erdmann @date 2009-08-31 -@version $Id: costFunctionChecker.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: costFunctionChecker.py 22608 2017-01-17 06:28:54Z behrisch $ Run duarouter repeatedly and simulate weight changes via a cost function. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/costMemory.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/costMemory.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/costMemory.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/costMemory.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Jakob Erdmann @author Michael Behrisch @date 2012-03-14 -@version $Id: costMemory.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: costMemory.py 22608 2017-01-17 06:28:54Z behrisch $ Perform smoothing of edge costs across successive iterations of duaIterate SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/dijkstra.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/dijkstra.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/dijkstra.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/dijkstra.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,7 @@ @author Michael Behrisch @author Jakob Erdmann @date 2007-10-25 -@version $Id: dijkstra.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: dijkstra.py 22608 2017-01-17 06:28:54Z behrisch $ This script is based on the script from David Eppstein, UC Irvine. This script is to find the shortest path from the given origin 'start' to the other nodes in the investigated network. @@ -14,7 +14,7 @@ will be stored in the lists P and D respectively. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/duaIterate_analysis.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/duaIterate_analysis.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/duaIterate_analysis.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/duaIterate_analysis.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ @author Jakob Erdmann @author Michael Behrisch @date 2012-09-06 -@version $Id: duaIterate_analysis.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: duaIterate_analysis.py 22608 2017-01-17 06:28:54Z behrisch $ Extract statistics from the outputs of a duaIterate run for plotting. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/duaIterate.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/duaIterate.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/duaIterate.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/duaIterate.py 2017-07-23 16:22:03.000000000 +0000 @@ -7,13 +7,13 @@ @author Jakob Erdmann @author Yun-Pang Floetteroed @date 2008-02-13 -@version $Id: duaIterate.py 21768 2016-10-24 15:30:08Z behrisch $ +@version $Id: duaIterate.py 23850 2017-04-06 20:54:29Z behrisch $ Run duarouter and sumo alternating to perform a dynamic user assignment. Based on the Perl script dua_iterate.pl. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -29,8 +29,8 @@ import types import shutil import glob +import argparse from datetime import datetime -from argparse import ArgumentParser from costMemory import CostMemory sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) @@ -47,13 +47,13 @@ argParser.add_argument("-+", "--additional", dest="additional", default="", help="Additional files") argParser.add_argument("-b", "--begin", - type=int, default=0, help="Set simulation/routing begin [default: %default]") + type=int, default=0, help="Set simulation/routing begin") argParser.add_argument("-e", "--end", - type=int, help="Set simulation/routing end [default: %default]") + type=int, help="Set simulation/routing end") argParser.add_argument("-R", "--route-steps", dest="routeSteps", - type=int, default=200, help="Set simulation route steps [default: %default]") + type=int, default=200, help="Set simulation route steps") argParser.add_argument("-a", "--aggregation", - type=int, default=900, help="Set main weights aggregation period [default: %default]") + type=int, default=900, help="Set main weights aggregation period") argParser.add_argument("-m", "--mesosim", action="store_true", default=False, help="Whether mesosim shall be used") argParser.add_argument("-p", "--path", help="Path to binaries") @@ -85,10 +85,10 @@ def initOptions(): - argParser = ArgumentParser( + argParser = argparse.ArgumentParser( description=""" Any options of the form sumo--long-option-name will be passed to sumo. These must be given after all the other options -example: sumo--step-length 0.5 will add the option --step-length 0.5 to sumo.""") +example: sumo--step-length 0.5 will add the option --step-length 0.5 to sumo.""", formatter_class=argparse.ArgumentDefaultsHelpFormatter) addGenericOptions(argParser) argParser.add_argument("-C", "--continue-on-unbuild", action="store_true", dest="continueOnUnbuild", @@ -100,9 +100,9 @@ argParser.add_argument("-F", "--flows", help="flows in step 0 (either trips, flows, or routes have to be supplied)", metavar="FILE") argParser.add_argument("-A", "--gA", - type=float, default=.5, help="Sets Gawron's Alpha [default: %default]") + type=float, default=.5, help="Sets Gawron's Alpha") argParser.add_argument("-B", "--gBeta", - type=float, default=.9, help="Sets Gawron's Beta [default: %default]") + type=float, default=.9, help="Sets Gawron's Beta") argParser.add_argument("-E", "--disable-summary", "--disable-emissions", action="store_true", dest="noSummary", default=False, help="No summaries are written by the simulation") argParser.add_argument("-T", "--disable-tripinfos", action="store_true", dest="noTripinfo", @@ -120,13 +120,13 @@ argParser.add_argument("--time-inc", dest="timeInc", type=int, default=0, help="Give the time incrementation") argParser.add_argument("-f", "--first-step", dest="firstStep", - type=int, default=0, help="First DUA step [default: %default]") + type=int, default=0, help="First DUA step") argParser.add_argument("-l", "--last-step", dest="lastStep", - type=int, default=50, help="Last DUA step [default: %default]") + type=int, default=50, help="Last DUA step") argParser.add_argument("--convergence-iterations", dest="convIt", - type=int, default=10, help="Number of iterations to use for convergence calculation [default: %default]") + type=int, default=10, help="Number of iterations to use for convergence calculation") argParser.add_argument("--max-convergence-deviation", dest="convDev", - type=float, help="Maximum relative standard deviation in travel times [default: %default]") + type=float, help="Maximum relative standard deviation in travel times") argParser.add_argument( "-D", "--districts", help="use districts as sources and targets", metavar="FILE") argParser.add_argument("-x", "--vehroute-file", dest="routefile", @@ -608,9 +608,9 @@ costmemory.write_costs(get_weightfilename(options, step, "dump")) print(">>> Updated %s edges" % costmemory.loaded()) print(">>> Decayed %s unseen edges" % costmemory.decayed()) - print(">>> Error avg:%s mean:%s" % + print(">>> Error avg:%.12g mean:%.12g" % (costmemory.avg_error(), costmemory.mean_error())) - print(">>> Absolute Error avg:%s mean:%s" % + print(">>> Absolute Error avg:%.12g mean:%.12g" % (costmemory.avg_abs_error(), costmemory.mean_abs_error())) if options.costmodifier != 'None': diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/elements.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/elements.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/elements.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/elements.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2007-10-25 -@version $Id: elements.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: elements.py 22608 2017-01-17 06:28:54Z behrisch $ This script is to define the classes and functions for - reading network geometric, @@ -13,7 +13,7 @@ - conducting statistic tests. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/inputs.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/inputs.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/inputs.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/inputs.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,13 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2007-10-25 -@version $Id: inputs.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: inputs.py 22608 2017-01-17 06:28:54Z behrisch $ This script is to retrieve the assignment parameters, the OD districts and the matrix from the input files. Moreover, the link travel time for district connectors will be estimated. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/matrixDailyToHourly.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/matrixDailyToHourly.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/matrixDailyToHourly.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/matrixDailyToHourly.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,13 +5,13 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-08-20 -@version $Id: matrixDailyToHourly.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: matrixDailyToHourly.py 22608 2017-01-17 06:28:54Z behrisch $ This script is to generate hourly matrices from a VISUM daily matrix. The taffic demand of the traffic zones, which have the same connection links, will be integrated. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/network.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/network.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/network.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/network.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,13 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2007-12-25 -@version $Id: network.py 20685 2016-05-10 10:08:20Z luecken $ +@version $Id: network.py 22608 2017-01-17 06:28:54Z behrisch $ This script is to retrive the network data, the district data and the vehicle data, generated by SUMO, from the respective XML files. Besides, the class 'Net' is also definded here. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -253,7 +253,7 @@ if verbose: foutkpath = open('kpaths.xml', 'w') print(""" - + """ % datetime.datetime.now(), file=foutkpath) for start, startVertex in enumerate(startVertices): for vertex in self.getNodes(): diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/networkStatistics.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/networkStatistics.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/networkStatistics.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/networkStatistics.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ @author Yun-Pang Floetteroed @author Michael Behrisch @date 2007-02-27 -@version $Id: networkStatistics.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: networkStatistics.py 22608 2017-01-17 06:28:54Z behrisch $ This script is to calculate the global performance indices according to the SUMO-based simulation results. Besides, this script is also to execute the significance test for evaluating the results from different assignment methods. @@ -18,7 +18,7 @@ - stop time SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/one-shot.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/one-shot.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/one-shot.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/one-shot.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Yun-Pang Floetteroed @author Michael Behrisch @date 2008-03-10 -@version $Id: one-shot.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: one-shot.py 22608 2017-01-17 06:28:54Z behrisch $ This script does multiple sumo runs with different rerouting intervals. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/outputs.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/outputs.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/outputs.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/outputs.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2007-12-25 -@version $Id: outputs.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: outputs.py 22608 2017-01-17 06:28:54Z behrisch $ This script is for generating the outputs from the choosed traffic assignment. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -158,7 +158,7 @@ def linkChoicesOutput(net, startVertices, endVertices, matrixPshort, linkChoiceMap, odPairsMap, outputdir, starttime): foutchoice = open(os.path.join(outputdir, "linkchoices.xml"), 'w') print(""" - + """ % starttime, file=foutchoice) for e in net._detectedEdges: if len(linkChoiceMap[e.detected]) > 0: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/routeChoices.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/routeChoices.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/routeChoices.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/routeChoices.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ @author Yun-Pang Floetteroed @author Michael Behrisch @date 2007-02-27 -@version $Id: routeChoices.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: routeChoices.py 22608 2017-01-17 06:28:54Z behrisch $ This script is to calculate the route choice probabilities based on different methods. - Gawron @@ -12,7 +12,7 @@ - ...... SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/run.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/run.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/run.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/run.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ @author Daniel Krajzewicz @author Yun-Pang Floetteroed @date 2008-03-10 -@version $Id: run.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: run.py 22608 2017-01-17 06:28:54Z behrisch $ Runs the assignment tests. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/statisticsElements.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/statisticsElements.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/statisticsElements.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/statisticsElements.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-07-10 -@version $Id: statisticsElements.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: statisticsElements.py 22608 2017-01-17 06:28:54Z behrisch $ This script is to define classes, functions, parse-reader and output files/format for - calculating network performances @@ -12,7 +12,7 @@ - writing results into files. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/tables.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/tables.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/assign/tables.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/assign/tables.py 2017-07-23 16:22:03.000000000 +0000 @@ -13,7 +13,7 @@ - conduct significance tests SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/apply_astyle.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/apply_astyle.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/apply_astyle.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/apply_astyle.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,14 +4,14 @@ @author Michael Behrisch @author Daniel Krajzewicz @date 2007 -@version $Id: apply_astyle.py 21665 2016-10-12 08:26:16Z behrisch $ +@version $Id: apply_astyle.py 24000 2017-04-21 09:06:04Z behrisch $ Applies astyle with the proper settings used in SUMO on all files in src (except for foreign) and autopep8 on all .py files. Also calls sed to fix missing eol at the end of files. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -23,11 +23,6 @@ import os import subprocess -try: - import autopep8 - autopep = True -except: - autopep = False srcRoot = os.path.join(os.path.dirname(__file__), "../../src/") for root, dirs, files in os.walk(srcRoot): @@ -40,14 +35,3 @@ for ignoreDir in ['.svn', 'foreign']: if ignoreDir in dirs: dirs.remove(ignoreDir) - -if autopep: - sumoRoot = os.path.join(os.path.dirname(__file__), "../../") - for root, dirs, files in os.walk(sumoRoot): - for name in files: - if name.endswith(".py"): - subprocess.call( - "autopep8 --in-place".split() + [os.path.join(root, name)]) - for ignoreDir in ['.svn', 'foreign']: - if ignoreDir in dirs: - dirs.remove(ignoreDir) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/buildHTMLDocs.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/buildHTMLDocs.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/buildHTMLDocs.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/buildHTMLDocs.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2011-10-20 -@version $Id: buildHTMLDocs.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: buildHTMLDocs.py 23834 2017-04-06 05:35:33Z behrisch $ Converts wiki-documentation into HTML pages. @@ -15,24 +15,24 @@ For each of the pages to convert, the HTML-representation of the page is downloaded and stripped from wiki-header/footer, first. -Then, the image-links are extracted from the HTML page and stored +Then, the image-links are extracted from the HTML page and stored temporarily, the links themselves are patched to point to local pages/images (if the page behind the link exists). -The page is saved into options.mirror/. +The page is saved into options.mirror/. -After parsing all pages, the images are downloaded and stored into +After parsing all pages, the images are downloaded and stored into options.mirror/images. After downloading all data, the title page is extracted and the content included in this page is extracted. This content is embedded into "index.html" -between the / markers. +between the / markers. All pages downloaded earlier are loaded, and embedded into the index.html between the / markers. Then, the page is saved into options.output/. All images are copied from options.mirror/images to options.output/images. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -42,7 +42,10 @@ """ from __future__ import absolute_import from __future__ import print_function -import urllib +try: + from urllib import urlopen +except ImportError: + from urllib.request import urlopen import os import sys import shutil @@ -178,23 +181,23 @@ for i in pi: images.add(i) name = name + ".html" - fd = open(os.path.join(options.mirror, name), "w") - fd.write(c) + fd = open(os.path.join(options.mirror, name), "wb") + fd.write(c.encode("utf8")) fd.close() imageFiles = [] for i in images: print("Fetching image %s" % i) if i.find(":") >= 0: - f = urllib.urlopen("http://sumo.dlr.de%s" % i) + f = urlopen("http://sumo.dlr.de%s" % i) c = f.read() b = c.find("
") b = c.find("href=", b) + 6 e = c.find("\"", b + 1) - f = urllib.urlopen("http://sumo.dlr.de/%s" % c[b:e]) + f = urlopen("http://sumo.dlr.de/%s" % c[b:e]) i = i[i.find(":") + 1:] else: - f = urllib.urlopen("http://sumo.dlr.de/%s" % i) + f = urlopen("http://sumo.dlr.de/%s" % i) i = i[i.rfind("/") + 1:] if i.find("px-") >= 0: i = i[:i.find('-') + 1] @@ -281,8 +284,8 @@ datetime.datetime.now(), name, name) name = name + ".html" t = os.path.join(options.output, name) - fd = open(os.path.join(options.mirror, name)) - c = fd.read() + fd = open(os.path.join(options.mirror, name), 'rb') + c = fd.read().decode("utf8") if options.version: fromStr += " for SUMO %s" % options.version c = c.replace( @@ -316,8 +319,8 @@ os.makedirs(os.path.split(t)[0]) except: pass - fd = open(t, "w") - fd.write(cc) + fd = open(t, "wb") + fd.write(cc.encode("utf8")) fd.close() for i in imageFiles: shutil.copy( diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/checkAuthors.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/checkAuthors.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/checkAuthors.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/checkAuthors.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Michael Behrisch @author Daniel Krajzewicz @date 2011-11-07 -@version $Id: checkAuthors.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: checkAuthors.py 22608 2017-01-17 06:28:54Z behrisch $ Checks authors for all files. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/checkImages.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/checkImages.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/checkImages.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/checkImages.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,13 +3,13 @@ @file checkImages.py @author Michael Behrisch @date 2016 -@version $Id: checkImages.py 21805 2016-10-26 12:33:50Z behrisch $ +@version $Id: checkImages.py 22608 2017-01-17 06:28:54Z behrisch $ Checks whether all images in src/utils/gui/images are properly inserted into the Makefile SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2016-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2016-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/checkStyle.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/checkStyle.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/checkStyle.py 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/checkStyle.py 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,191 @@ +#!/usr/bin/env python +""" +@file checkSvnProps.py +@author Michael Behrisch +@date 2010-08-29 +@version $Id: checkStyle.py 23999 2017-04-21 09:04:47Z behrisch $ + +Checks svn property settings for all files. + +SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors + +This file is part of SUMO. +SUMO is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. +""" +from __future__ import absolute_import +from __future__ import print_function + +import os +import subprocess +import sys +import xml.sax +import codecs +from optparse import OptionParser +try: + import flake8 + HAVE_FLAKE = True +except ImportError: + HAVE_FLAKE = False +try: + import autopep8 + HAVE_AUTOPEP = True +except ImportError: + HAVE_AUTOPEP = False + +_SOURCE_EXT = [".h", ".cpp", ".py", ".pl", ".java", ".am"] +_TESTDATA_EXT = [".xml", ".prog", ".csv", + ".complex", ".dfrouter", ".duarouter", ".jtrrouter", ".marouter", + ".astar", ".chrouter", ".internal", ".tcl", ".txt", + ".netconvert", ".netedit", ".netgen", + ".od2trips", ".polyconvert", ".sumo", + ".meso", ".tools", ".traci", ".activitygen", + ".scenario", ".tapasVEU", + ".sumocfg", ".netccfg", ".netgcfg"] +_VS_EXT = [".vsprops", ".sln", ".vcproj", + ".bat", ".props", ".vcxproj", ".filters"] +_IGNORE = set(["binstate.sumo", "binstate.sumo.meso", "image.tools"]) +_KEYWORDS = "HeadURL Id LastChangedBy LastChangedDate LastChangedRevision" + + +class PropertyReader(xml.sax.handler.ContentHandler): + + """Reads the svn properties of files as written by svn pl -v --xml""" + + def __init__(self, doFix): + self._fix = doFix + self._file = "" + self._property = None + self._value = "" + self._hadEOL = False + self._hadKeywords = False + + def startElement(self, name, attrs): + if name == 'target': + self._file = attrs['path'] + seen.add(os.path.join(svnRoot, self._file)) + if name == 'property': + self._property = attrs['name'] + + def characters(self, content): + if self._property: + self._value += content + + def endElement(self, name): + ext = os.path.splitext(self._file)[1] + if name == 'property' and self._property == "svn:eol-style": + self._hadEOL = True + if name == 'property' and self._property == "svn:keywords": + self._hadKeywords = True + if os.path.basename(self._file) not in _IGNORE: + if ext in _SOURCE_EXT or ext in _TESTDATA_EXT or ext in _VS_EXT: + if name == 'property' and self._property == "svn:executable" and ext not in [".py", ".pl", ".bat"]: + print(self._file, self._property, self._value) + if self._fix: + subprocess.call( + ["svn", "pd", "svn:executable", self._file]) + if name == 'property' and self._property == "svn:mime-type": + print(self._file, self._property, self._value) + if self._fix: + subprocess.call( + ["svn", "pd", "svn:mime-type", self._file]) + if ext in _SOURCE_EXT or ext in _TESTDATA_EXT: + if name == 'property' and self._property == "svn:eol-style" and self._value != "LF"\ + or name == "target" and not self._hadEOL: + print(self._file, "svn:eol-style", self._value) + if self._fix: + if os.name == "posix": + subprocess.call( + ["sed", "-i", r's/\r$//', self._file]) + subprocess.call( + ["sed", "-i", r's/\r/\n/g', self._file]) + subprocess.call( + ["svn", "ps", "svn:eol-style", "LF", self._file]) + if ext in _SOURCE_EXT: + if name == 'property' and self._property == "svn:keywords" and self._value != _KEYWORDS\ + or name == "target" and not self._hadKeywords: + print(self._file, "svn:keywords", self._value) + if self._fix: + subprocess.call( + ["svn", "ps", "svn:keywords", _KEYWORDS, self._file]) + if name == 'target': + try: + codecs.open(self._file, 'r', 'utf8').read() + except UnicodeDecodeError as e: + print(self._file, e) + if ext in _VS_EXT: + if name == 'property' and self._property == "svn:eol-style" and self._value != "CRLF"\ + or name == "target" and not self._hadEOL: + print(self._file, "svn:eol-style", self._value) + if self._fix: + subprocess.call( + ["svn", "ps", "svn:eol-style", "CRLF", self._file]) + if name == 'target' and ext == ".py": + if HAVE_FLAKE and os.path.getsize(self._file) < 1000000: # flake hangs on very large files + subprocess.call(["flake8", "--max-line-length", "120", self._file]) + if HAVE_AUTOPEP and self._fix: + subprocess.call(["autopep8", "--max-line-length", "120", "--in-place", self._file]) + if name == 'property': + self._value = "" + self._property = None + if name == 'target': + self._hadEOL = False + self._hadKeywords = False + + +sumoRoot = os.path.dirname( + os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +svnRoots = [sumoRoot] +optParser = OptionParser() +optParser.add_option("-v", "--verbose", action="store_true", + default=False, help="tell me what you are doing") +optParser.add_option("-f", "--fix", action="store_true", + default=False, help="fix invalid svn properties") +optParser.add_option("-r", "--recheck", + default=sumoRoot, help="fully recheck all files in given dir") +(options, args) = optParser.parse_args() +seen = set() +if len(args) > 0: + svnRoots = [os.path.abspath(a) for a in args] +else: + upDir = os.path.dirname(sumoRoot) + for l in subprocess.Popen(["svn", "pg", "svn:externals", upDir], stdout=subprocess.PIPE, stderr=open(os.devnull, 'w')).communicate()[0].splitlines(): + if l[:5] == "sumo/": + svnRoots.append(os.path.join(upDir, l.split()[0])) +for svnRoot in svnRoots: + if options.verbose: + print("checking", svnRoot) + output = subprocess.check_output(["svn", "pl", "-v", "-R", "--xml", svnRoot]) + xml.sax.parseString(output, PropertyReader(options.fix)) + +if options.verbose: + print("re-checking tree at", options.recheck) +for root, dirs, files in os.walk(options.recheck): + for name in files: + ext = os.path.splitext(name)[1] + if name not in _IGNORE: + if ext in _SOURCE_EXT or ext in _TESTDATA_EXT or ext in _VS_EXT: + fullName = os.path.join(root, name) + if fullName in seen or subprocess.call(["svn", "ls", fullName], stdout=open(os.devnull, 'w'), stderr=subprocess.STDOUT): + continue + print(fullName, "svn:eol-style") + if options.fix: + if ext in _VS_EXT: + subprocess.call( + ["svn", "ps", "svn:eol-style", "CRLF", fullName]) + else: + if os.name == "posix": + subprocess.call(["sed", "-i", 's/\r$//', fullName]) + subprocess.call( + ["svn", "ps", "svn:eol-style", "LF", fullName]) + if ext in _SOURCE_EXT: + print(fullName, "svn:keywords") + if options.fix: + subprocess.call( + ["svn", "ps", "svn:keywords", _KEYWORDS, fullName]) + for ignoreDir in ['.svn', 'foreign', 'contributed', 'texttesttmp']: + if ignoreDir in dirs: + dirs.remove(ignoreDir) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/checkSvnProps.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/checkSvnProps.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/checkSvnProps.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/checkSvnProps.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,170 +0,0 @@ -#!/usr/bin/env python -""" -@file checkSvnProps.py -@author Michael Behrisch -@date 2010-08-29 -@version $Id: checkSvnProps.py 20433 2016-04-13 08:00:14Z behrisch $ - -Checks svn property settings for all files. - -SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors - -This file is part of SUMO. -SUMO is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3 of the License, or -(at your option) any later version. -""" -from __future__ import absolute_import -from __future__ import print_function - -import os -import subprocess -import sys -import xml.sax -from optparse import OptionParser - -_SOURCE_EXT = [".h", ".cpp", ".py", ".pl", ".java", ".am"] -_TESTDATA_EXT = [".xml", ".prog", ".csv", - ".complex", ".dfrouter", ".duarouter", ".jtrrouter", ".marouter", - ".astar", ".chrouter", ".internal", ".tcl", ".txt", - ".netconvert", ".netgen", ".od2trips", ".polyconvert", ".sumo", - ".meso", ".tools", ".traci", ".activitygen", - ".scenario", ".tapasVEU", - ".sumocfg", ".netccfg", ".netgcfg"] -_VS_EXT = [".vsprops", ".sln", ".vcproj", - ".bat", ".props", ".vcxproj", ".filters"] -_IGNORE = set(["binstate.sumo", "binstate.sumo.meso", "image.tools"]) -_KEYWORDS = "HeadURL Id LastChangedBy LastChangedDate LastChangedRevision" - - -class PropertyReader(xml.sax.handler.ContentHandler): - - """Reads the svn properties of files as written by svn pl -v --xml""" - - def __init__(self, doFix): - self._fix = doFix - self._file = "" - self._property = None - self._value = "" - self._hadEOL = False - self._hadKeywords = False - - def startElement(self, name, attrs): - if name == 'target': - self._file = attrs['path'] - seen.add(os.path.join(svnRoot, self._file)) - if name == 'property': - self._property = attrs['name'] - - def characters(self, content): - if self._property: - self._value += content - - def endElement(self, name): - ext = os.path.splitext(self._file)[1] - if name == 'property' and self._property == "svn:eol-style": - self._hadEOL = True - if name == 'property' and self._property == "svn:keywords": - self._hadKeywords = True - if os.path.basename(self._file) not in _IGNORE: - if ext in _SOURCE_EXT or ext in _TESTDATA_EXT or ext in _VS_EXT: - if name == 'property' and self._property == "svn:executable" and ext not in [".py", ".pl", ".bat"]: - print(self._file, self._property, self._value) - if self._fix: - subprocess.call( - ["svn", "pd", "svn:executable", self._file]) - if name == 'property' and self._property == "svn:mime-type": - print(self._file, self._property, self._value) - if self._fix: - subprocess.call( - ["svn", "pd", "svn:mime-type", self._file]) - if ext in _SOURCE_EXT or ext in _TESTDATA_EXT: - if name == 'property' and self._property == "svn:eol-style" and self._value != "LF"\ - or name == "target" and not self._hadEOL: - print(self._file, "svn:eol-style", self._value) - if self._fix: - if os.name == "posix": - subprocess.call( - ["sed", "-i", r's/\r$//', self._file]) - subprocess.call( - ["sed", "-i", r's/\r/\n/g', self._file]) - subprocess.call( - ["svn", "ps", "svn:eol-style", "LF", self._file]) - if ext in _SOURCE_EXT: - if name == 'property' and self._property == "svn:keywords" and self._value != _KEYWORDS\ - or name == "target" and not self._hadKeywords: - print(self._file, "svn:keywords", self._value) - if self._fix: - subprocess.call( - ["svn", "ps", "svn:keywords", _KEYWORDS, self._file]) - if ext in _VS_EXT: - if name == 'property' and self._property == "svn:eol-style" and self._value != "CRLF"\ - or name == "target" and not self._hadEOL: - print(self._file, "svn:eol-style", self._value) - if self._fix: - subprocess.call( - ["svn", "ps", "svn:eol-style", "CRLF", self._file]) - if name == 'property': - self._value = "" - self._property = None - if name == 'target': - self._hadEOL = False - self._hadKeywords = False - - -sumoRoot = os.path.dirname( - os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -svnRoots = [sumoRoot] -optParser = OptionParser() -optParser.add_option("-v", "--verbose", action="store_true", - default=False, help="tell me what you are doing") -optParser.add_option("-f", "--fix", action="store_true", - default=False, help="fix invalid svn properties") -optParser.add_option("-r", "--recheck", - default=sumoRoot, help="fully recheck all files in given dir") -(options, args) = optParser.parse_args() -seen = set() -if len(args) > 0: - svnRoots = [os.path.abspath(a) for a in args] -else: - upDir = os.path.dirname(sumoRoot) - for l in subprocess.Popen(["svn", "pg", "svn:externals", upDir], stdout=subprocess.PIPE, stderr=open(os.devnull, 'w')).communicate()[0].splitlines(): - if l[:5] == "sumo/": - svnRoots.append(os.path.join(upDir, l.split()[0])) -for svnRoot in svnRoots: - if options.verbose: - print("checking", svnRoot) - output = subprocess.Popen( - ["svn", "pl", "-v", "-R", "--xml", svnRoot], stdout=subprocess.PIPE).communicate()[0] - xml.sax.parseString(output, PropertyReader(options.fix)) - -if options.verbose: - print("re-checking tree at", options.recheck) -for root, dirs, files in os.walk(options.recheck): - for name in files: - fullName = os.path.join(root, name) - if fullName in seen or subprocess.call(["svn", "ls", fullName], stdout=open(os.devnull, 'w'), stderr=subprocess.STDOUT): - continue - ext = os.path.splitext(name)[1] - if name not in _IGNORE: - if ext in _SOURCE_EXT or ext in _TESTDATA_EXT or ext in _VS_EXT: - print(fullName, "svn:eol-style") - if options.fix: - if ext in _VS_EXT: - subprocess.call( - ["svn", "ps", "svn:eol-style", "CRLF", fullName]) - else: - if os.name == "posix": - subprocess.call(["sed", "-i", 's/\r$//', fullName]) - subprocess.call( - ["svn", "ps", "svn:eol-style", "LF", fullName]) - if ext in _SOURCE_EXT: - print(fullName, "svn:keywords") - if options.fix: - subprocess.call( - ["svn", "ps", "svn:keywords", _KEYWORDS, fullName]) - for ignoreDir in ['.svn', 'foreign', 'contributed', 'texttesttmp']: - if ignoreDir in dirs: - dirs.remove(ignoreDir) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/configTemplateToWiki.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/configTemplateToWiki.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/configTemplateToWiki.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/configTemplateToWiki.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file configTemplateToWiki.py @author Michael Behrisch @date 2012-01-26 -@version $Id: configTemplateToWiki.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: configTemplateToWiki.py 22608 2017-01-17 06:28:54Z behrisch $ Generate Wiki table from configuration template. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/dailyBuildMSVC.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/dailyBuildMSVC.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/dailyBuildMSVC.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/dailyBuildMSVC.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,7 @@ @author Jakob Erdmann @author Laura Bieker @date 2008 -@version $Id: dailyBuildMSVC.py 21687 2016-10-14 10:09:57Z behrisch $ +@version $Id: dailyBuildMSVC.py 23562 2017-03-20 18:54:52Z behrisch $ Does the nightly svn update on the windows server and the visual studio build. The script is also used for the meso build. @@ -13,7 +13,7 @@ hard coded into this script. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -35,6 +35,7 @@ import datetime import sys +import runSikulixServer import status import wix @@ -106,6 +107,9 @@ stdout=log, stderr=subprocess.STDOUT, shell=True) subprocess.call([ttBin, "-a", "sumo.gui"] + fullOpt, env=env, stdout=log, stderr=subprocess.STDOUT, shell=True) + # Check if sikulixServer is already opened + # if runSikulixServer.checkStatus() == False : + # runSikulixServer.startSikulixServer() subprocess.call([ttBin, "-a", "netedit.gui"] + fullOpt, env=env, stdout=log, stderr=subprocess.STDOUT, shell=True) subprocess.call([ttBin, "-b", env["FILEPREFIX"], "-coll"], env=env, @@ -240,6 +244,32 @@ if options.addSln: subprocess.call(compiler + " /rebuild Debug|%s %s\\%s /out %s" % (platform, options.rootDir, options.addSln, makeAllLog)) + if sumoAllZip: + try: + debugZip = sumoAllZip.replace("-all-", "Debug-%s-" % env["FILEPREFIX"]) + zipf = zipfile.ZipFile(debugZip, 'w', zipfile.ZIP_DEFLATED) + debugDllPath = os.path.join(options.rootDir, "..", "debugDll") + if platform == "x64": + debugDllPath += "64" + for dllPath in (os.path.join(options.rootDir, dllDir), debugDllPath): + for f in glob.glob(os.path.join(dllPath, "*.dll")) + glob.glob(os.path.join(dllPath, "*", "*.dll")): + zipf.write(f, os.path.join(binDir, f[len(dllPath) + 1:])) + buildDir = os.path.dirname(os.path.join(options.rootDir, options.project)) + for f in glob.glob(os.path.join(options.rootDir, options.binDir, "*D.exe")): + exe = os.path.basename(f) + pdb = exe[:-3] + "pdb" + zipf.write(f, os.path.join(binDir, exe)) + if platform == "x64": + pdbPath = os.path.join(buildDir, exe[:-5], "x64", "Debug", pdb) + else: + pdbPath = os.path.join(buildDir, exe[:-5], "Debug", pdb) + if os.path.exists(pdbPath): + zipf.write(pdbPath, os.path.join(binDir, pdb)) + zipf.close() + except IOError as ziperr: + (errno, strerror) = ziperr.args + print("Warning: Could not zip to %s!" % binaryZip, file=log) + print("I/O error(%s): %s" % (errno, strerror), file=log) runTests(options, env, svnrev) log = open(statusLog, 'w') status.printStatus(makeLog, makeAllLog, env["SMTP_SERVER"], log) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/dailyUpdateMakeGCC.sh sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/dailyUpdateMakeGCC.sh --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/dailyUpdateMakeGCC.sh 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/dailyUpdateMakeGCC.sh 2017-07-23 16:22:03.000000000 +0000 @@ -25,14 +25,10 @@ basename $MAKELOG >> $STATUSLOG svn up &> $MAKELOG || (echo "svn up failed" | tee -a $STATUSLOG; tail -10 $MAKELOG) SVNREV=`grep -io 'revision [0-9]*' $MAKELOG | cut -d ' ' -f 2 | tail -1` -if test -d "$NIGHTDIR"; then - tools/build/checkSvnProps.py -fi make -f Makefile.cvs >> $MAKELOG 2>&1 || (echo "autoreconf failed" | tee -a $STATUSLOG; tail -10 $MAKELOG) ./configure --prefix=$PREFIX/sumo $CONFIGURE_OPT >> $MAKELOG 2>&1 || (echo "configure failed" | tee -a $STATUSLOG; tail -10 $MAKELOG) if make >> $MAKELOG 2>&1; then $PREFIX/sumo/unittest/src/sumo-unittest >> $MAKELOG 2>&1 || (echo "unit tests failed" | tee -a $STATUSLOG; tail -10 $MAKELOG) - $PREFIX/sumo/unittest/testSuiteTools.py >> $MAKELOG 2>&1 || (echo "python unit tests failed" | tee -a $STATUSLOG; tail -10 $MAKELOG) if make install >> $MAKELOG 2>&1; then if test -d "$NIGHTDIR"; then make distcheck >> $MAKELOG 2>&1 || (echo "make distcheck failed" | tee -a $STATUSLOG; tail -10 $MAKELOG) @@ -88,8 +84,7 @@ basename $MAKEALLLOG >> $STATUSLOG export CXXFLAGS="$CXXFLAGS -Wall -W -pedantic -Wno-long-long -Wformat -Wformat-security" ./configure --prefix=$PREFIX/sumo --program-suffix=A --with-python \ - --disable-double-precision --disable-internal-lanes \ - --enable-memcheck $CONFIGURE_OPT &> $MAKEALLLOG || (echo "configure with all options failed" | tee -a $STATUSLOG; tail -10 $MAKEALLLOG) + $CONFIGURE_OPT &> $MAKEALLLOG || (echo "configure with all options failed" | tee -a $STATUSLOG; tail -10 $MAKEALLLOG) if make >> $MAKEALLLOG 2>&1; then make install >> $MAKEALLLOG 2>&1 || (echo "make install with all options failed" | tee -a $STATUSLOG; tail -10 $MAKEALLLOG) else diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/history.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/history.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/history.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/history.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,13 +3,13 @@ @file history.py @author Michael Behrisch @date 2014-06-21 -@version $Id: history.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: history.py 23254 2017-03-07 14:06:25Z behrisch $ This script builds all sumo versions in a certain revision range and tries to eliminate duplicates afterwards. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -23,6 +23,8 @@ import optparse import shutil import os +import sys +import traceback optParser = optparse.OptionParser() optParser.add_option("-b", "--begin", type="int", @@ -33,25 +35,35 @@ default=1, help="increment") options, args = optParser.parse_args() -if not options.end: - for line in subprocess.check_output('svn info http://svn.code.sf.net/p/sumo/code/trunk/sumo', shell=True).splitlines(): - l = line.split() - if len(l) == 2 and l[0] == "Revision:": - options.end = int(l[1]) -for rev in range(options.begin, options.end + 1, options.step): - if not os.path.exists('bin%s' % rev): - ret = subprocess.call( - 'svn up --ignore-externals -r %s sumo' % rev, shell=True) - if ret != 0: - break - subprocess.call('cd sumo; make clean; make -j 16; cd ..', shell=True) - shutil.copytree('sumo/bin', 'bin%s' % rev, - ignore=shutil.ignore_patterns('Makefile*', '*.bat', '*.jar')) - subprocess.call('strip -R .note.gnu.build-id bin%s/*' % - rev, shell=True) - subprocess.call( - "sed -i 's/dev-SVN-r%s/dev-SVN-r00000/' bin%s/*" % (rev, rev), shell=True) -for line in subprocess.check_output('fdupes -1 -q bin*', shell=True).splitlines(): - dups = line.split() - for d in dups[1:]: - subprocess.call('ln -sf ../%s %s' % (dups[0], d), shell=True) +LOCK = "history.lock" +if os.path.exists(LOCK): + sys.exit("History building is still locked!") +open(LOCK, 'w').close() +try: + if not options.end: + for line in subprocess.check_output( + 'svn info http://svn.code.sf.net/p/sumo/code/trunk/sumo', shell=True).splitlines(): + l = line.split() + if len(l) == 2 and l[0] == "Revision:": + options.end = int(l[1]) + for rev in range(options.begin, options.end + 1, options.step): + if not os.path.exists('bin%s' % rev): + ret = subprocess.call( + 'svn up --ignore-externals -r %s sumo' % rev, shell=True) + if ret != 0: + break + subprocess.call( + 'cd sumo; make clean; make -j 16; cd ..', shell=True) + shutil.copytree('sumo/bin', 'bin%s' % rev, + ignore=shutil.ignore_patterns('Makefile*', '*.bat', '*.jar')) + subprocess.call('strip -R .note.gnu.build-id bin%s/*' % + rev, shell=True) + subprocess.call( + "sed -i 's/dev-SVN-r%s/dev-SVN-r00000/' bin%s/*" % (rev, rev), shell=True) + for line in subprocess.check_output('fdupes -1 -q bin*', shell=True).splitlines(): + dups = line.split() + for d in dups[1:]: + subprocess.call('ln -sf ../%s %s' % (dups[0], d), shell=True) +except: + traceback.print_exc() +os.remove(LOCK) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/mirrorWiki.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/mirrorWiki.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/mirrorWiki.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/mirrorWiki.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2011-10-20 -@version $Id: mirrorWiki.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: mirrorWiki.py 23834 2017-04-06 05:35:33Z behrisch $ Mirrors wiki-documentation. @@ -15,15 +15,15 @@ For each of the pages to mirror, the page is downloaded as for being edited and is stripped from wiki-header/footer, first. -Then, the image-links are extracted from the HTML page and stored +Then, the image-links are extracted from the HTML page and stored temporarily. -The page is saved into MIRROR_FOLDER/. +The page is saved into MIRROR_FOLDER/. -After mirroring all pages, the images are downloaded and stored into +After mirroring all pages, the images are downloaded and stored into MIRROR_FOLDER/images. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -33,7 +33,10 @@ """ from __future__ import absolute_import from __future__ import print_function -import urllib +try: + from urllib import urlopen +except ImportError: + from urllib.request import urlopen import os import sys import shutil @@ -41,8 +44,8 @@ def readParsePage(page): - f = urllib.urlopen("http://sumo.dlr.de/wiki/%s" % page) - c = f.read() + f = urlopen("http://sumo.dlr.de/wiki/%s" % page) + c = f.read().decode('utf8') b = c.find("This page was last modified on") e = c.find("<", b) lastMod = c[b:e] @@ -56,9 +59,9 @@ def readParseEditPage(page): - f = urllib.urlopen( + f = urlopen( "http://sumo.dlr.de/w/index.php?title=%s&action=edit" % page) - c = f.read() + c = f.read().decode('utf8') b = c.find("wpTextbox1") b = c.find('>', b) + 1 e = c.find("") @@ -113,21 +116,21 @@ images.update(getImages(c)) name = name + ".txt" fd = open(os.path.join(options.output, name), "w") - fd.write(c) + fd.write(c.encode("utf8")) fd.close() for i in images: print("Fetching image %s" % i) if i.find(":") >= 0: - f = urllib.urlopen("http://sumo.dlr.de/wiki/%s" % i) + f = urlopen("http://sumo.dlr.de/wiki/%s" % i) c = f.read() b = c.find("
") b = c.find("href=", b) + 6 e = c.find("\"", b + 1) - f = urllib.urlopen("http://sourceforge.net/%s" % c[b:e]) + f = urlopen("http://sourceforge.net/%s" % c[b:e]) i = i[i.find(":") + 1:] else: - f = urllib.urlopen("http://sourceforge.net/%s" % i) + f = urlopen("http://sourceforge.net/%s" % i) i = i[i.rfind("/") + 1:] if i.find("px-") >= 0: i = i[:i.find('-') + 1] diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/pythonPropsMSVC.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/pythonPropsMSVC.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/pythonPropsMSVC.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/pythonPropsMSVC.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,13 +5,13 @@ @author Daniel Krajzewicz @author Jakob Erdmann @date 2011 -@version $Id: pythonPropsMSVC.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: pythonPropsMSVC.py 22608 2017-01-17 06:28:54Z behrisch $ This script rebuilds "../../build/msvc/python.props", the file which gives information about the python includes and library. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/runSikulixServer.pyw sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/runSikulixServer.pyw --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/runSikulixServer.pyw 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/runSikulixServer.pyw 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,152 @@ +#!/usr/bin/env python +""" +@file runSikulixServer.py +@date 2016-08-31 +@author Pablo Alvarez Lopez +@version $Id: runSikulixServer.pyw 22252 2016-12-09 22:13:00Z behrisch $ + +Wrapper script for running sikulix server + +SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors + +This file is part of SUMO. +SUMO is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. +""" +import gtk +import os +import subprocess +import sys +import socket +import platform + +# Define global variables for Server +TRAY_TOOLTIP = 'Sikulix server' +TRAY_ICON = os.environ.get('SUMO_HOME', '.') + "/tests/sikulixicon.png" + +# Open message dialog to User +def messageDialog(data=None): + msg = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, data) + msg.run() + msg.destroy() + + +# Get status of sikulixServer +def checkStatus(): + # Create socket + statusSocket = socket.socket() + # Try to connect to localhost trought Port 50001 + try: + # Connect status socket + statusSocket.connect(("localhost", 50001)) + # Send get status code + statusSocket.send("GET / HTTP/1.1\n\n") + # Receive status of SikulixServer + statusReceived = statusSocket.recv(1024) + # Close status socket + statusSocket.close() + # If status of server contains "200 OK", return true. False in other case + if "200 OK" in statusReceived: + return True + else: + return False + except: + # Cannot connect to SikulixServer, then return false + return False + + +# start Sikulix Server +def startSikulixServer(): + # Call a subprocess of this Python Script to run Sikulix Server depending of operating system + subprocess.Popen([os.environ.get('RUN_SIKULIX', 'runsikulix'), "-s"], + env=os.environ, stdout=None, stderr=None, shell=(platform.system() != 'Linux')) + #return status of sikulixServer + return checkStatus() + + +# close Sikulix server +def closeSikulixServer(): + # Create socket + stopSocket = socket.socket() + # Try to connect to localhost trought Port 50001 + try: + # Connect status socket + stopSocket.connect(("localhost", 50001)) + # send stop code to sikulixServer + stopSocket.send("GET /STOP HTTP/1.1\n\n") + # Receive stop information of SikulixServer + statusStop = stopSocket.recv(1024) + # Close stop socket + stopSocket.close() + # If status of server contains "stopping server", return true. False in other case + if "stopping server" in statusStop: + return True + else: + return False + except: + # Cannot connect to SikulixServer, then return false + return False + + +# Show status of sikulix server +def showStatus(data=None): + # Show a message dialog with the status of server + if checkStatus(): + messageDialog("Sikulix server is running") + else: + messageDialog("Sikulix server is stopped") + + +# Close SikulixServer +def closeApp(data=None): + # Show message dialog if there are problems closing sikulix server + if closeSikulixServer() == False: + messageDialog("Error stopping Sikulix Server") + # Quit GTK + gtk.main_quit() + + +# Make menu +def makeMenu(event_button, event_time, data=None): + # Create gtk menu + menu = gtk.Menu() + # Create menu items + checkStatusItem = gtk.MenuItem("Check Status") + closeServerItem = gtk.MenuItem("Close Sikulix server") + #Append the menu items + menu.append(checkStatusItem) + menu.append(closeServerItem) + #add callbacks + checkStatusItem.connect_object("activate", showStatus, "Check status") + closeServerItem.connect_object("activate", closeApp, "Close Sikulix Server") + #Show the menu items + checkStatusItem.show() + closeServerItem.show() + #Popup the menu + menu.popup(None, None, None, event_button, event_time) + + +# Called when user do a right click over status icon +def onRightClickOverTrayIcon(data, event_button, event_time): + makeMenu(event_button, event_time) + + +def buildTrayIcon(): + # Set Tray icon + sikulixIcon = gtk.status_icon_new_from_file(TRAY_ICON) + # Connect popup menu with right click over tray icon + sikulixIcon.connect('popup-menu', onRightClickOverTrayIcon) + # start gtk + gtk.main() + + +# Main function of RunSikulixServer +if __name__ == '__main__': + # Check if sikulixServer is already opened + if checkStatus() == False : + # Start Sikulix Server + startSikulixServer() + buildTrayIcon() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/setup-sumolib.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/setup-sumolib.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/setup-sumolib.py 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/setup-sumolib.py 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,65 @@ +#!/usr/bin/env python +""" +@file runSikulixServer.py +@date 2017-01-26 +@author Dominik Buse +@author Michael Behrisch +@version $Id: setup-sumolib.py 23254 2017-03-07 14:06:25Z behrisch $ + +setuptool based setup module for SUMO's python helper library + +SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +Copyright (C) 2017-2017 DLR (http://www.dlr.de/) and contributors + +This file is part of SUMO. +SUMO is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. +""" + +from setuptools import setup, find_packages + +import os + +setup( + name='sumolib', + + version='0.29.1', + + url='http://sumo.dlr.de/wiki/Tools/Sumolib', + author='DLR and contributors', + author_email='sumo@dlr.de', + + license='GNU GPL v3', + + classifiers=[ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: Science/Research', + 'LICENSE :: OSI Approved :: GNU General Public License v3 (GPLv3)', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + ], + + keywords='traffic simulation traci sumo', + + # automatically find packages + packages=find_packages(include=["sumolib", "sumolib.*"]), + + script_name='./build/setup-sumolib.py', + data_files=['./build/setup-sumolib.py'], + + # TODO: check requirements + install_requires=[''], + + # TODO: add extra dependencies for testing + extras_require={ + 'visualization': ['matplotlib'], + } +) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/setup-traci.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/setup-traci.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/setup-traci.py 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/setup-traci.py 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,65 @@ +#!/usr/bin/env python +""" +@file setup-traci.py +@date 2017-01-26 +@author Dominik Buse +@author Michael Behrisch +@version $Id: setup-traci.py 23254 2017-03-07 14:06:25Z behrisch $ + +setuptool based setup module for SUMO's TraCI python client library + +SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +Copyright (C) 2017-2017 DLR (http://www.dlr.de/) and contributors + +This file is part of SUMO. +SUMO is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. +""" + +from setuptools import setup, find_packages + +import os + +VERSION = '0.29.1' + +setup( + name='traci', + + version=VERSION, + + url='http://sumo.dlr.de/wiki/TraCI/Interfacing_TraCI_from_Python', + author='DLR and contributors', + author_email='sumo@dlr.de', + + license='GNU GPL v3', + + classifiers=[ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: Science/Research', + 'LICENSE :: OSI Approved :: GNU General Public License v3 (GPLv3)', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + ], + + keywords='traffic simulation traci sumo', + + # automatically find packages + packages=find_packages(include=["traci", "traci.*"]), + + script_name='./build/setup-traci.py', + data_files=['./build/setup-traci.py'], + + # TODO: check requirements + install_requires=['sumolib>=%s' % VERSION], + + # TODO: add extra dependencies for testing + extras_require={} +) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/status.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/status.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/status.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/status.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,11 +4,11 @@ @author Michael Behrisch @author Laura Bieker @date 2007-03-13 -@version $Id: status.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: status.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/typemap.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/typemap.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/typemap.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/typemap.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,14 +3,14 @@ @file typemap.py @author Michael Behrisch @date 2015-07-06 -@version $Id: typemap.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: typemap.py 23899 2017-04-10 11:17:14Z behrisch $ -This script rebuilds "../../src/netimport/typemap.h", the file +This script rebuilds "../../src/netimport/typemap.h", the file representing the default typemaps. It does this by parsing the data from the sumo data dir. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2015-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2015-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -27,7 +27,7 @@ def writeTypeMap(typemapFile, typemap): with open(typemapFile, 'w') as f: - for format, mapFile in sorted(typemap.iteritems()): + for format, mapFile in sorted(typemap.items()): print("const std::string %sTypemap =" % format, file=f) for line in open(mapFile): print('"%s"' % diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/version.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/version.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/version.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/version.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,7 @@ @author Daniel Krajzewicz @author Jakob Erdmann @date 2007 -@version $Id: version.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: version.py 23066 2017-02-22 12:26:17Z behrisch $ This script rebuilds "../../src/version.h", the file which lets the applications know the version of their build. @@ -15,7 +15,7 @@ determined any exisitng vershion.h is kept SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -28,7 +28,7 @@ import sys import re -from subprocess import Popen, PIPE +import subprocess from os.path import dirname, exists, getmtime, join, isdir UNKNOWN_REVISION = "UNKNOWN" @@ -111,23 +111,22 @@ svnDir = sys.argv[2] else: svnDir = find_svnDir(sumoSrc) - if svnDir == None or not exists(svnDir): + if svnDir is None or not exists(svnDir): print("unknown revision - svn dir '%s' not found" % svnDir) if not exists(versionFile): create_version_file(versionFile, UNKNOWN_REVISION, "") else: # determine svn file svnFile = find_svnFile(svnDir) - if svnFile == None: + if svnFile is None: print("unknown revision - no svn file found in %s" % svnDir) if not exists(versionFile): create_version_file(versionFile, UNKNOWN_REVISION, "") if not exists(versionFile) or getmtime(versionFile) < getmtime(svnFile): # svnFile is newer. lets update the revision number try: - svnRevision = int(re.search( - 'Revision: (\d*)\n', - Popen(['svn', 'info', sumoSrc], stdout=PIPE).communicate()[0]).group(1)) + svnInfo = subprocess.check_output(['svn', 'info', sumoSrc]) + svnRevision = int(re.search('Revision: (\d*)', svnInfo).group(1)) except: svnRevision = parseRevision(svnFile) create_version_file(versionFile, svnRevision, svnFile) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/wix.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/wix.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/build/wix.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/build/wix.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Michael Behrisch @author Jakob Erdmann @date 2011 -@version $Id: wix.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: wix.py 22608 2017-01-17 06:28:54Z behrisch $ Builds the installer based on the nightly zip. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,2 +1 @@ __version__ = "0.0" - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/arrayman.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/arrayman.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/arrayman.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/arrayman.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,18 +1,21 @@ from classman import * import numpy as np + + class ArrayConfMixin: - def __init__(self, attrname, default, dtype=None, is_index= False, **attrs): - self._is_index = is_index - self._dtype = dtype + + def __init__(self, attrname, default, dtype=None, is_index=False, **attrs): + self._is_index = is_index + self._dtype = dtype AttrConf.__init__(self, attrname, default, - struct = 'array', - **attrs) - + struct='array', + **attrs) + if is_index: self._init_indexing() - + # use original one from AttrConfig - #def _write_xml_value(self,val,fd): + # def _write_xml_value(self,val,fd): # #print 'write_xml',self.xmltag,type(val),hasattr(val, '__iter__') # if hasattr(val, '__iter__'): # if len(val)>0: @@ -32,42 +35,43 @@ # else: # # scalar number or string # fd.write(xm.num(self.xmltag,val)) - + def get_dtype(self): - return self._dtype - + return self._dtype + def convert_type(self, array): - return np.array(array, dtype = self._dtype) - + return np.array(array, dtype=self._dtype) + def get_defaults(self, ids): # create a list, should work for all types and dimensions # default can be scalar or an array of any dimension - #print '\n\nget_defaults',self._name,ids + # print '\n\nget_defaults',self._name,ids default = self.get_default() - + if hasattr(default, '__iter__'): default = np.asarray(default) - if self._dtype!=None: + if self._dtype != None: dtype = self._dtype else: dtype = type(default.flatten()[0]) - #print ' default=',default,len(default) - if len(ids)>0: - defaults = np.array( len(ids)*[default], dtype ) - #print ' size,type',len(ids)*[default], type(default.flatten()[0]) + # print ' default=',default,len(default) + if len(ids) > 0: + defaults = np.array(len(ids) * [default], dtype) + # print ' size,type',len(ids)*[default], + # type(default.flatten()[0]) else: #defaults = np.zeros( (0,len(default)),type(default.flatten()[0]) ) - defaults = np.zeros( (0,)+default.shape, dtype ) - #print ' return',defaults,defaults.shape,defaults.dtype + defaults = np.zeros((0,) + default.shape, dtype) + # print ' return',defaults,defaults.shape,defaults.dtype return defaults else: - if self._dtype!=None: + if self._dtype != None: dtype = self._dtype else: - dtype = type(default) - #defaults= np.array( len(ids)*[default], dtype ) - #print ' return 1D',defaults,defaults.shape,defaults.dtype - return np.array( len(ids)*[default], dtype ) + dtype = type(default) + #defaults= np.array( len(ids)*[default], dtype ) + # print ' return 1D',defaults,defaults.shape,defaults.dtype + return np.array(len(ids) * [default], dtype) def get_init(self): """ @@ -76,8 +80,8 @@ Overridden by table configuration classes """ ids = self._manager.get_ids() - - #print '\n\nget_init',self.attrname,ids,self._is_localvalue + + # print '\n\nget_init',self.attrname,ids,self._is_localvalue values = self.get_defaults(ids) # store locally if required @@ -86,157 +90,154 @@ # pass on to calling instance # in this cas the data is stored under self._obj return values - - + def get_ids_sorted(self): inds = self._manager.get_inds() - return self._manager.get_ids(inds[ np.argsort(self.get_value()[inds]) ] ) - + return self._manager.get_ids(inds[np.argsort(self.get_value()[inds])]) + #sortarray = np.concatenate((self.get_value()[inds],inds)) - + def delete_ind(self, i): # called from del_rows if self._is_index: _id = self._manager._ids[i] self.del_index(_id) - arr = self.get_value() - self.set_value(np.concatenate( (arr[:i], arr[i+1:]) ) ) - - def __delitem__(self, ids): - #print ' before=\n',self.__dict__[attr] + arr = self.get_value() + self.set_value(np.concatenate((arr[:i], arr[i + 1:]))) + + def __delitem__(self, ids): + # print ' before=\n',self.__dict__[attr] #attr = self.attrconf.get_attr() if hasattr(ids, '__iter__'): for i in self._manager._inds[ids]: self.delete_ind[i] else: self.delete_ind(self._manager._inds[ids]) - - + def __getitem__(self, ids): - #print '__getitem__',key - return self.get_value()[self._manager._inds[ids]] - + # print '__getitem__',key + return self.get_value()[self._manager._inds[ids]] + def __setitem__(self, ids, values): - #print '__setitem__',ids,values,type(self.get_value()),self.get_value().dtype - - + # print + # '__setitem__',ids,values,type(self.get_value()),self.get_value().dtype + if self._is_index: if hasattr(ids, '__iter__'): self.set_indices(ids, values) - + else: self.set_index(ids, values) - - self.get_value()[self._manager._inds[ids]]=values - - - + + self.get_value()[self._manager._inds[ids]] = values + def set(self, ids, values): - if values == None: return - + if values == None: + return + if not hasattr(ids, '__iter__'): _ids = [ids] - _values = np.array([values],self._dtype) - + _values = np.array([values], self._dtype) else: _ids = ids - _values = np.array(values,self._dtype) - #print 'set', _ids ,_values + _values = np.array(values, self._dtype) + # print 'set', _ids ,_values self[_ids] = _values if self._is_index: self.set_indices(_ids, _values) - self._is_modified = True - + self._is_modified = True + def set_plugin(self, ids, values): if not hasattr(ids, '__iter__'): _ids = [ids] - _values = np.array([values],self._dtype) - + _values = np.array([values], self._dtype) else: _ids = ids - _values = np.array(values,self._dtype) - + _values = np.array(values, self._dtype) + self[ids] = _values if self._is_index: self.set_indices(_ids, _values) - self._is_modified = True + self._is_modified = True self.plugin.exec_events_ids(EVTSETITEM, _ids) - - def add(self, ids, values = None): + + def add(self, ids, values=None): if not hasattr(ids, '__iter__'): _ids = [ids] if values != None: - _values = np.array([values],self._dtype) + _values = np.array([values], self._dtype) else: _values = self.get_defaults(_ids) else: - #if values==None: + # if values==None: # print 'WARNING:',self.attrname, ids,self._dtype _ids = ids if values != None: - _values = np.array(values,self._dtype) + _values = np.array(values, self._dtype) else: _values = self.get_defaults(_ids) - #if values == None: + # if values == None: # _values = self.get_defaults(_ids) - - #print 'add ids',self.attrname,ids,_ids,self._is_modified - #print ' values',values - #print ' _values',_values - #print ' self.get_value()',self.get_value() - #print ' type(_values),type(self.get_value())',type(_values),type(self.get_value()) - #print ' _values.shape,self.get_value().shape',_values.shape,self.get_value().shape - - #newvalue = np.concatenate((self.get_value(),_values)) - #print ' ', type(newvalue),newvalue.dtype - self.set_value(np.concatenate((self.get_value(),_values)) ) - #print ' done:',self.attrname,self.get_value() + + # print 'add ids',self.attrname,ids,_ids,self._is_modified + # print ' values',values + # print ' _values',_values + # print ' self.get_value()',self.get_value() + # print ' type(_values),type(self.get_value())',type(_values),type(self.get_value()) + # print ' + # _values.shape,self.get_value().shape',_values.shape,self.get_value().shape + + #newvalue = np.concatenate((self.get_value(),_values)) + # print ' ', type(newvalue),newvalue.dtype + self.set_value(np.concatenate((self.get_value(), _values))) + # print ' done:',self.attrname,self.get_value() if self._is_index: self.add_indices(_ids, _values) - self._is_modified = True - - def add_plugin(self, ids, values = None): - #print 'add_plugin',self.attrname + self._is_modified = True + + def add_plugin(self, ids, values=None): + # print 'add_plugin',self.attrname if not hasattr(ids, '__iter__'): _ids = [ids] if values != None: - _values = np.array([values],self._dtype) + _values = np.array([values], self._dtype) else: _ids = ids if values != None: - _values = np.array(values,self._dtype) - + _values = np.array(values, self._dtype) + if values == None: - _values = self.get_defaults(_ids) - self._is_modified = True - #print 'add ids',self.attrname,ids,_ids,self._is_modified - #print ' values',values - #print ' _values',_values - #print ' self.get_value()',self.get_value() - #print ' type(_values),type(self.get_value())',type(_values),type(self.get_value()) - #print ' _values.shape,self.get_value().shape',_values.shape,self.get_value().shape - - #newvalue = np.concatenate((self.get_value(),_values)) - #print ' ', type(newvalue),newvalue.dtype - self.set_value(np.concatenate((self.get_value(),_values)) ) - #print ' done:',self.attrname,self.get_value() - + _values = self.get_defaults(_ids) + self._is_modified = True + # print 'add ids',self.attrname,ids,_ids,self._is_modified + # print ' values',values + # print ' _values',_values + # print ' self.get_value()',self.get_value() + # print ' type(_values),type(self.get_value())',type(_values),type(self.get_value()) + # print ' + # _values.shape,self.get_value().shape',_values.shape,self.get_value().shape + + #newvalue = np.concatenate((self.get_value(),_values)) + # print ' ', type(newvalue),newvalue.dtype + self.set_value(np.concatenate((self.get_value(), _values))) + # print ' done:',self.attrname,self.get_value() + if self._is_index: self.add_indices(_ids, _values) - + self.plugin.exec_events_ids(EVTADDITEM, _ids) - - def format_value(self,_id, show_unit = False, show_parentesis=False): + + def format_value(self, _id, show_unit=False, show_parentesis=False): if show_unit: - unit = ' '+self.format_unit(show_parentesis) + unit = ' ' + self.format_unit(show_parentesis) else: unit = '' - #return repr(self[_id])+unit - + # return repr(self[_id])+unit + #self.min = minval #self.max = maxval #self.digits_integer = digits_integer @@ -244,231 +245,226 @@ val = self[_id] tt = type(val) - if tt in (np.int,np.int32,np.float64): - return str(val)+unit - - elif tt in (np.float,np.float32,np.float64): - if hasattr(attrconf,'digits_fraction'): + if tt in (np.int, np.int32, np.float64): + return str(val) + unit + + elif tt in (np.float, np.float32, np.float64): + if hasattr(attrconf, 'digits_fraction'): digits_fraction = self.digits_fraction else: digits_fraction = 3 - return "%."+str(digits_fraction)+"f"%(val)+unit - + return "%." + str(digits_fraction) + "f" % (val) + unit + else: - return str(val)+unit - - -class ArrayConf(ArrayConfMixin,ColConf): + return str(val) + unit + + +class ArrayConf(ArrayConfMixin, ColConf): + """ Column made of numeric array. - + """ pass -class ListArrayConf(ArrayConfMixin,ColConf): + +class ListArrayConf(ArrayConfMixin, ColConf): + """ Column made of an array of lists. - + """ + def __init__(self, attrname, dtype=None, **attrs): - ArrayConfMixin.__init__(self, attrname, None, dtype=np.object, **attrs) - - def add(self, ids, values = None): + ArrayConfMixin.__init__(self, attrname, None, + dtype=np.object, **attrs) + + def add(self, ids, values=None): if not hasattr(ids, '__iter__'): _ids = [ids] if values != None: - _values = np.zeros(1,self._dtype) + _values = np.zeros(1, self._dtype) _values[0] = values - + else: - + _ids = ids if values != None: - _values = np.zeros(len(ids),self._dtype) + _values = np.zeros(len(ids), self._dtype) _values[:] = values - + if values == None: - _values = self.get_defaults(_ids) + _values = self.get_defaults(_ids) + + # print 'add ids, _values',self.attrname,ids + # print ' values',values + # print ' _values',_values + # print ' self.get_value()',self.get_value() + # print ' type(_values),type(self.get_value())',type(_values),type(self.get_value()) + # print ' + # _values.shape,self.get_value().shape',_values.shape,self.get_value().shape + + newvalue = np.concatenate((self.get_value(), _values)) + # print ' ', type(newvalue),newvalue.dtype + self.set_value(np.concatenate((self.get_value(), _values))) - - - #print 'add ids, _values',self.attrname,ids - #print ' values',values - #print ' _values',_values - #print ' self.get_value()',self.get_value() - #print ' type(_values),type(self.get_value())',type(_values),type(self.get_value()) - #print ' _values.shape,self.get_value().shape',_values.shape,self.get_value().shape - - newvalue = np.concatenate((self.get_value(),_values)) - #print ' ', type(newvalue),newvalue.dtype - self.set_value(np.concatenate((self.get_value(),_values)) ) - if self._is_index: self.add_indices(_ids, _values) - - def add_plugin(self, ids, values = None): - #print 'add_plugin',self.attrname + + def add_plugin(self, ids, values=None): + # print 'add_plugin',self.attrname if not hasattr(ids, '__iter__'): _ids = [ids] if values != None: - _values = np.zeros(1,self._dtype) + _values = np.zeros(1, self._dtype) _values[0] = values - + else: - + _ids = ids if values != None: - _values = np.zeros(len(ids),self._dtype) + _values = np.zeros(len(ids), self._dtype) _values[:] = values - + if values == None: - _values = self.get_defaults(_ids) + _values = self.get_defaults(_ids) + + # print 'add ids, _values',self.attrname,ids + # print ' values',values + # print ' _values',_values + # print ' self.get_value()',self.get_value() + # print ' type(_values),type(self.get_value())',type(_values),type(self.get_value()) + # print ' + # _values.shape,self.get_value().shape',_values.shape,self.get_value().shape + + newvalue = np.concatenate((self.get_value(), _values)) + # print ' ', type(newvalue),newvalue.dtype + self.set_value(np.concatenate((self.get_value(), _values))) - - - #print 'add ids, _values',self.attrname,ids - #print ' values',values - #print ' _values',_values - #print ' self.get_value()',self.get_value() - #print ' type(_values),type(self.get_value())',type(_values),type(self.get_value()) - #print ' _values.shape,self.get_value().shape',_values.shape,self.get_value().shape - - newvalue = np.concatenate((self.get_value(),_values)) - #print ' ', type(newvalue),newvalue.dtype - self.set_value(np.concatenate((self.get_value(),_values)) ) - if self._is_index: self.add_indices(_ids, _values) - + if self.plugin: self.plugin.exec_events_ids(EVTADDITEM, _ids) - - -class NumArrayConf(ArrayConfMixin,ColConf): +class NumArrayConf(ArrayConfMixin, ColConf): + """ Column made of numeric array. - + """ - #def __init__(self, **attrs): + # def __init__(self, **attrs): # print 'ColConf',attrs - def __init__(self, attrname, default, - digits_integer = None, digits_fraction=None , - minval = None, maxval = None, - **attrs): - + + def __init__(self, attrname, default, + digits_integer=None, digits_fraction=None, + minval=None, maxval=None, + **attrs): + self.min = minval self.max = maxval self.digits_integer = digits_integer self.digits_fraction = digits_fraction - - ArrayConfMixin.__init__(self, attrname, default, metatype = 'number',**attrs) - - - -class IdsArrayConf(ArrayConfMixin,ColConf): + + ArrayConfMixin.__init__(self, attrname, default, + metatype='number', **attrs) + + +class IdsArrayConf(ArrayConfMixin, ColConf): + """ Column, where each entry is the id of a single Table. """ - - def __init__(self,attrname, tab, is_index = False, id_default = -1,**kwargs): + + def __init__(self, attrname, tab, is_index=False, id_default=-1, **kwargs): self._tab = tab - ArrayConfMixin.__init__(self, attrname, - id_default, # default id - dtype = int, - metatype = 'id', - perm = 'r', - is_index = is_index, + ArrayConfMixin.__init__(self, attrname, + id_default, # default id + dtype=int, + metatype='id', + perm='r', + is_index=is_index, **kwargs ) self.init_xml() - #print 'IdsConf.__init__',attrname - #print ' ',self._tab.xmltag,self._attrconfig_id_tab - - - - + # print 'IdsConf.__init__',attrname + # print ' ',self._tab.xmltag,self._attrconfig_id_tab + def get_defaults(self, ids): # create a list, should work for all types and dimensions # default can be scalar or an array of any dimension - #print '\n\nget_defaults',self.attrname,ids,self.get_default() - return -np.ones(len(ids),dtype = self._dtype) + # print '\n\nget_defaults',self.attrname,ids,self.get_default() + return -np.ones(len(ids), dtype=self._dtype) - - - -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------- # copied from IdsConf!!! def set_linktab(self, tab): self._tab = tab - + def get_linktab(self): - return self._tab - + return self._tab + def init_xml(self): - #print 'init_xml',self.attrname - if self._tab.xmltag!=None: + # print 'init_xml',self.attrname + if self._tab.xmltag != None: xmltag_tab, xmltag_item_tab, attrname_id_tab = self._tab.xmltag - if (attrname_id_tab is None)|(attrname_id_tab is ''): + if (attrname_id_tab is None) | (attrname_id_tab is ''): self._attrconfig_id_tab = None else: - self._attrconfig_id_tab = getattr(self._tab, attrname_id_tab)# tab = tabman ! - - if not hasattr(self,'is_xml_include_tab'): + self._attrconfig_id_tab = getattr( + self._tab, attrname_id_tab) # tab = tabman ! + + if not hasattr(self, 'is_xml_include_tab'): # this means that entire table rows will be included self.is_xml_include_tab = False - #print ' xmltag_tab, xmltag_item_tab, attrname_id_tab',xmltag_tab, xmltag_item_tab, attrname_id_tab,self.is_xml_include_tab - + # print ' xmltag_tab, xmltag_item_tab, + # attrname_id_tab',xmltag_tab, xmltag_item_tab, + # attrname_id_tab,self.is_xml_include_tab + else: self._attrconfig_id_tab = None - self.is_xml_include_tab = False - - - def write_xml(self, fd, _id, indent = 0): - #print 'write_xml',self.attrname - if (self.xmltag is not None)&(np.all(self[_id]>=0)): - #print 'write_xml',self.attrname, _id,'value',self[_id] - if self._attrconfig_id_tab==None: - self._write_xml_value(self[_id],fd) + self.is_xml_include_tab = False + + def write_xml(self, fd, _id, indent=0): + # print 'write_xml',self.attrname + if (self.xmltag is not None) & (np.all(self[_id] >= 0)): + # print 'write_xml',self.attrname, _id,'value',self[_id] + if self._attrconfig_id_tab == None: + self._write_xml_value(self[_id], fd) elif self.is_xml_include_tab: - #print ' write table row(s)',self[_id] - self._tab.write_xml(fd, indent, ids = self[_id], - is_print_begin_end = False) + # print ' write table row(s)',self[_id] + self._tab.write_xml(fd, indent, ids=self[_id], + is_print_begin_end=False) else: - #print ' write id(s)',self[_id] - self._write_xml_value(self._attrconfig_id_tab[self[_id]],fd) - - - - def _write_xml_value(self,val,fd): - #print 'write_xml',self.xmltag,hasattr(val, '__iter__') + # print ' write id(s)',self[_id] + self._write_xml_value(self._attrconfig_id_tab[self[_id]], fd) + + def _write_xml_value(self, val, fd): + # print 'write_xml',self.xmltag,hasattr(val, '__iter__') if hasattr(val, '__iter__'): - if len(val)>0: + if len(val) > 0: if hasattr(val[0], '__iter__'): # matrix - fd.write(xm.mat(self.xmltag,val)) + fd.write(xm.mat(self.xmltag, val)) else: # list - fd.write(xm.arr(self.xmltag,val,self.xmlsep)) + fd.write(xm.arr(self.xmltag, val, self.xmlsep)) else: # empty list - #fd.write(xm.arr(self.xmltag,val)) + # fd.write(xm.arr(self.xmltag,val)) # don't even write empty lists pass - - - - elif type(self._default) in (types.UnicodeType ,types.StringType ): - if len(val)>0: - fd.write(xm.num(self.xmltag,val)) - - + + elif type(self._default) in (types.UnicodeType, types.StringType): + if len(val) > 0: + fd.write(xm.num(self.xmltag, val)) + else: # scalar number or string - fd.write(xm.num(self.xmltag,val)) - + fd.write(xm.num(self.xmltag, val)) + def _getstate_specific(self, state): """ Called by __getstate__ to add/change specific states, @@ -476,187 +472,185 @@ To be overridden. """ if self._is_save: - #if self._is_child: + # if self._is_child: # # OK self.value already set in # pass - #else: + # else: # # remove table reference and create ident - state['_tab']= None + state['_tab'] = None state['_ident_tab'] = self._tab.get_ident_abs() - + def init_postload_internal(self, man, obj): - #print 'IdsConf.init_postload_internal',self.attrname,hasattr(self,'value'),self._is_save,self._is_localvalue,'obj:',obj.ident - + # print + # 'IdsConf.init_postload_internal',self.attrname,hasattr(self,'value'),self._is_save,self._is_localvalue,'obj:',obj.ident + AttrConf.init_postload_internal(self, man, obj) - - #if self._is_child: + + # if self._is_child: # print ' make sure children get initialized' # print ' call init_postload_internal of',self._tab.ident # self._tab.init_postload_internal(obj) - + def init_postload_external(self): - #if self._is_child: + # if self._is_child: # # restore normally # AttrConf.init_postload_external(self) # self._tab.init_postload_external() - #else: - + # else: + # Substitute absolute ident with link object. # Called from init_postload_external of attrsman during load_obj - # + # ident_abs = self._ident_tab - #print 'reset_linkobj',self.attrname,ident_abs + # print 'reset_linkobj',self.attrname,ident_abs obj = self.get_obj() rootobj = obj.get_root() - #print ' rootobj',rootobj.ident + # print ' rootobj',rootobj.ident linkobj = rootobj.get_obj_from_ident(ident_abs) - #print ' linkobj',linkobj.ident - self._tab = linkobj + # print ' linkobj',linkobj.ident + self._tab = linkobj self.init_xml() + def is_modified(self): return False - - def set_modified(self,is_modified): + + def set_modified(self, is_modified): pass - + + class IdlistsArrayConf(IdsArrayConf): + """ Column, where each entry is a list of ids of a single Table. """ - - def __init__(self,attrname, tab, metatype = None,**kwargs): + + def __init__(self, attrname, tab, metatype=None, **kwargs): self._is_index = False self._tab = tab - ArrayConfMixin.__init__(self, attrname, - None, # default, will be substituted by id list - dtype = 'object', - metatype = 'ids', - perm = 'r', + ArrayConfMixin.__init__(self, attrname, + # default, will be substituted by id list + None, + dtype='object', + metatype='ids', + perm='r', **kwargs ) self.init_xml() - def get_defaults(self, ids): # here we initialize with None for reach element - return np.array( len(ids)*[None,], self._dtype ) - - def add(self, ids, values = None): + return np.array(len(ids) * [None, ], self._dtype) + + def add(self, ids, values=None): if not hasattr(ids, '__iter__'): _ids = [ids] if values != None: - _values = np.zeros(1,self._dtype) + _values = np.zeros(1, self._dtype) _values[0] = values - + else: - + _ids = ids - _values = np.zeros(len(ids),self._dtype) + _values = np.zeros(len(ids), self._dtype) _values[:] = values - + if values == None: - _values = self.get_defaults(_ids) + _values = self.get_defaults(_ids) + + # print 'add ids, _values',self.attrname,ids + # print ' values',values + # print ' _values',_values + # print ' self.get_value()',self.get_value() + # print ' type(_values),type(self.get_value())',type(_values),type(self.get_value()) + # print ' + # _values.shape,self.get_value().shape',_values.shape,self.get_value().shape + + newvalue = np.concatenate((self.get_value(), _values)) + # print ' ', type(newvalue),newvalue.dtype + self.set_value(np.concatenate((self.get_value(), _values))) - - - #print 'add ids, _values',self.attrname,ids - #print ' values',values - #print ' _values',_values - #print ' self.get_value()',self.get_value() - #print ' type(_values),type(self.get_value())',type(_values),type(self.get_value()) - #print ' _values.shape,self.get_value().shape',_values.shape,self.get_value().shape - - newvalue = np.concatenate((self.get_value(),_values)) - #print ' ', type(newvalue),newvalue.dtype - self.set_value(np.concatenate((self.get_value(),_values)) ) - if self._is_index: self.add_indices(_ids, _values) - - -class TabIdListArrayConf(ArrayConfMixin,ColConf): + + +class TabIdListArrayConf(ArrayConfMixin, ColConf): + """ Column made of an array of lists with (table,id) tupels. The tables are linked, and will not be saved. """ + def __init__(self, attrname, dtype=None, **attrs): - ArrayConfMixin.__init__(self, attrname, None, # default, will be substituted by (table,id) list - dtype = 'object', - metatype = 'tabidlist', - perm = 'r',**attrs) - - - - def add(self, ids, values = None): + ArrayConfMixin.__init__(self, attrname, None, # default, will be substituted by (table,id) list + dtype='object', + metatype='tabidlist', + perm='r', **attrs) + + def add(self, ids, values=None): if not hasattr(ids, '__iter__'): _ids = [ids] if values != None: - _values = np.zeros(1,self._dtype) + _values = np.zeros(1, self._dtype) _values[0] = values - + else: - + _ids = ids - _values = np.zeros(len(ids),self._dtype) + _values = np.zeros(len(ids), self._dtype) _values[:] = values - + if values == None: - _values = self.get_defaults(_ids) + _values = self.get_defaults(_ids) + + # print 'add ids, _values',self.attrname,ids + # print ' values',values + # print ' _values',_values + # print ' self.get_value()',self.get_value() + # print ' type(_values),type(self.get_value())',type(_values),type(self.get_value()) + # print ' + # _values.shape,self.get_value().shape',_values.shape,self.get_value().shape + + newvalue = np.concatenate((self.get_value(), _values)) + # print ' ', type(newvalue),newvalue.dtype + self.set_value(np.concatenate((self.get_value(), _values))) - - - #print 'add ids, _values',self.attrname,ids - #print ' values',values - #print ' _values',_values - #print ' self.get_value()',self.get_value() - #print ' type(_values),type(self.get_value())',type(_values),type(self.get_value()) - #print ' _values.shape,self.get_value().shape',_values.shape,self.get_value().shape - - newvalue = np.concatenate((self.get_value(),_values)) - #print ' ', type(newvalue),newvalue.dtype - self.set_value(np.concatenate((self.get_value(),_values)) ) - if self._is_index: self.add_indices(_ids, _values) - - def add_plugin(self, ids, values = None): + + def add_plugin(self, ids, values=None): if not hasattr(ids, '__iter__'): _ids = [ids] if values != None: - _values = np.zeros(1,self._dtype) + _values = np.zeros(1, self._dtype) _values[0] = values - + else: - + _ids = ids - _values = np.zeros(len(ids),self._dtype) + _values = np.zeros(len(ids), self._dtype) _values[:] = values - + if values == None: - _values = self.get_defaults(_ids) - + _values = self.get_defaults(_ids) + ### - - - def format_value(self,_id, show_unit = False, show_parentesis=False): + def format_value(self, _id, show_unit=False, show_parentesis=False): s = '' rowlist = self[_id] if rowlist == None: return s - elif len(rowlist)==0: + elif len(rowlist) == 0: return s - elif len(rowlist)==1: - tab,ids = rowlist[0] - return str(tab)+'['+str(ids)+']' - elif len(rowlist)>1: - tab,ids = rowlist[0] - s =str(tab)+'['+str(ids)+']' - for tab,ids in rowlist[1:]: - s+=','+str(tab)+'['+str(ids)+']' + elif len(rowlist) == 1: + tab, ids = rowlist[0] + return str(tab) + '[' + str(ids) + ']' + elif len(rowlist) > 1: + tab, ids = rowlist[0] + s = str(tab) + '[' + str(ids) + ']' + for tab, ids in rowlist[1:]: + s += ',' + str(tab) + '[' + str(ids) + ']' return s - - def _getstate_specific(self, state): """ @@ -664,102 +658,89 @@ before returning states. To be overridden. """ - #print '_getstate_specific',self.attrname, self._is_save,len(self.get_value()) + # print '_getstate_specific',self.attrname, + # self._is_save,len(self.get_value()) if self._is_save: n = len(state['value']) - state['value']= None - _tabidlists_save = n*[None] + state['value'] = None + _tabidlists_save = n * [None] i = 0 for rowlist in self.get_value(): rowlist_save = [] for tab, ids in rowlist: rowlist_save.append([tab.get_ident_abs(), ids]) - #print ' append',[tab.get_ident_abs(), ids] + # print ' append',[tab.get_ident_abs(), ids] _tabidlists_save[i] = rowlist_save - #print ' ',i,rowlist_save + # print ' ',i,rowlist_save i += 1 state['_tabidlists_save'] = _tabidlists_save - - + def init_postload_external(self): # Substitute absolute ident with link object. # Called from init_postload_external of attrsman during load_obj - # - #print 'init_postload_external',self.attrname, len(self._tabidlists_save) + # + # print 'init_postload_external',self.attrname, len(self._tabidlists_save) #obj = self.get_obj() #rootobj = obj.get_root() - #print ' rootobj',rootobj.ident + # print ' rootobj',rootobj.ident #linkobj = rootobj.get_obj_from_ident(ident_abs) - #print ' linkobj',linkobj.ident + # print ' linkobj',linkobj.ident #self._tab = linkobj - + # Substitute absolute ident with link object. # Called from init_postload_external of attrsman during load_obj - # + # _tabidlists_save = self._tabidlists_save #ident_abs = self._ident_value - #print 'init_postload_external',self.attrname,_tabids_save + # print 'init_postload_external',self.attrname,_tabids_save obj = self.get_obj() rootobj = obj.get_root() - #print ' rootobj',rootobj.ident - tabidlists = np.zeros(len(_tabidlists_save) , dtype= self._dtype) + # print ' rootobj',rootobj.ident + tabidlists = np.zeros(len(_tabidlists_save), dtype=self._dtype) i = 0 for rowlist_save in _tabidlists_save: rowlist = [] - #print ' rowlist_save',rowlist_save + # print ' rowlist_save',rowlist_save for tabident, ids in rowlist_save: tab = rootobj.get_obj_from_ident(tabident) - #print ' ',tab.get_ident_abs(), ids - rowlist.append([tab,ids]) + # print ' ',tab.get_ident_abs(), ids + rowlist.append([tab, ids]) tabidlists[i] = rowlist i += 1 - #print ' tabidlists', tabidlists + # print ' tabidlists', tabidlists self.set_value(tabidlists) + def is_modified(self): return False - - def set_modified(self,is_modified): + + def set_modified(self, is_modified): pass -class TabIdsArrayConf(ArrayConfMixin,ColConf): + +class TabIdsArrayConf(ArrayConfMixin, ColConf): + """ Column, where each entry contains a tuple with table object and id. The tables are linked, and will not be saved. """ - - def __init__(self,attrname, is_index = False, **kwargs): + + def __init__(self, attrname, is_index=False, **kwargs): self._is_index = is_index - ArrayConfMixin.__init__(self, attrname, - (None, -1), # default id - dtype = [('ob', object), ('id', np.int)], - metatype = 'tabid', - perm = 'r', + ArrayConfMixin.__init__(self, attrname, + (None, -1), # default id + dtype=[('ob', object), ('id', np.int)], + metatype='tabid', + perm='r', **kwargs ) - - - - - - + def get_defaults(self, ids): # create a list, should work for all types and dimensions # default can be scalar or an array of any dimension - #print '\n\nget_defaults',self.attrname,ids,self.get_default() - return np.zeros(len(ids),dtype = self._dtype) - - - - + # print '\n\nget_defaults',self.attrname,ids,self.get_default() + return np.zeros(len(ids), dtype=self._dtype) - - - - - - - def _getstate_specific(self, state): """ Called by __getstate__ to add/change specific states, @@ -768,393 +749,379 @@ """ if self._is_save: n = len(state['value']) - state['value']= None - _tabids_save = n*[None] + state['value'] = None + _tabids_save = n * [None] i = 0 for tab, ids in self.get_value(): _tabids_save[i] = [tab.get_ident_abs(), ids] i += 1 state['_tabids_save'] = _tabids_save - - + def init_postload_external(self): - #if self._is_child: + # if self._is_child: # # restore normally # AttrConf.init_postload_external(self) # self._tab.init_postload_external() - #else: - + # else: + # Substitute absolute ident with link object. # Called from init_postload_external of attrsman during load_obj - # + # #ident_abs = self._ident_tab - #print 'reset_linkobj',self.attrname,ident_abs + # print 'reset_linkobj',self.attrname,ident_abs #obj = self.get_obj() #rootobj = obj.get_root() - #print ' rootobj',rootobj.ident + # print ' rootobj',rootobj.ident #linkobj = rootobj.get_obj_from_ident(ident_abs) - #print ' linkobj',linkobj.ident + # print ' linkobj',linkobj.ident #self._tab = linkobj - + # Substitute absolute ident with link object. # Called from init_postload_external of attrsman during load_obj - # + # _tabids_save = self._tabids_save #ident_abs = self._ident_value - #print 'init_postload_external',self.attrname,_tabids_save + # print 'init_postload_external',self.attrname,_tabids_save obj = self.get_obj() rootobj = obj.get_root() - #print ' rootobj',rootobj.ident - tabids = np.zeros(len(self._tabids_save) , dtype= self._dtype) + # print ' rootobj',rootobj.ident + tabids = np.zeros(len(self._tabids_save), dtype=self._dtype) i = 0 for tabident, ids in self._tabids_save: tab = rootobj.get_obj_from_ident(tabident) - #print ' ',tab.get_ident_abs(), ids + # print ' ',tab.get_ident_abs(), ids tabids[i] = (tab, ids) i += 1 - + self.set_value(tabids) + def is_modified(self): return False - - def set_modified(self,is_modified): - pass - + + def set_modified(self, is_modified): + pass + + class Arrayman(Tabman): + """ Manages all table attributes of an object. - + if argument obj is specified with an instance then column attributes are stored under this instance. The values of attrname is then directly accessible with - + obj.attrname - + If nothing is specified, then column attribute will be stored under the respective config instance of this tab man (self). The values of attrname is then directly accessible with - + self.attrname.value - + """ + def __init__(self, obj=None, **kwargs): - + Attrsman.__init__(self, obj, **kwargs) - self._colconfigs = [] - self._inds = np.zeros((0,),int) - self._ids = np.zeros((0,),int) - - def get_inds(self,ids=None): - if ids!=None: + self._colconfigs = [] + self._inds = np.zeros((0,), int) + self._ids = np.zeros((0,), int) + + def get_inds(self, ids=None): + if ids != None: return self._inds[ids] else: return self._inds[self._ids] - - def get_ids(self, inds = None): + + def get_ids(self, inds=None): if inds != None: return self._ids[inds] else: return self._ids - - return - - def get_ind(self,id): + + return + + def get_ind(self, id): return self._inds[id] - - def select_ids(self,mask): - #print 'select_ids' - #print ' mask\n=',mask - #print ' self._ids\n=',self._ids - #if len(self)>0: + + def select_ids(self, mask): + # print 'select_ids' + # print ' mask\n=',mask + # print ' self._ids\n=',self._ids + # if len(self)>0: return np.take(self._ids, np.flatnonzero(mask)) - #else: + # else: # return np.zeros(0,int) - - def suggest_id(self,is_zeroid=False): + + def suggest_id(self, is_zeroid=False): """ Returns a an availlable id. - + Options: is_zeroid=True allows id to be zero. - + """ - return self.suggest_ids(1,is_zeroid)[0] - - def suggest_ids(self,n,is_zeroid=False): + return self.suggest_ids(1, is_zeroid)[0] + + def suggest_ids(self, n, is_zeroid=False): """ Returns a list of n availlable ids. It returns even a list for n=1. - + Options: is_zeroid=True allows id to be zero. """ # TODO: does always return 1 if is_index is True ????? - #print 'suggest_ids',n,is_zeroid,self._inds,len(self._inds),self._inds.dtype - ids_unused_orig = np.flatnonzero(np.less(self._inds,0)) - - if not is_zeroid: - if len(self._inds)==0: - ids_unused=np.zeros(0,dtype = np.int32) + # print + # 'suggest_ids',n,is_zeroid,self._inds,len(self._inds),self._inds.dtype + ids_unused_orig = np.flatnonzero(np.less(self._inds, 0)) + + if not is_zeroid: + if len(self._inds) == 0: + ids_unused = np.zeros(0, dtype=np.int32) else: # avoid 0 as id: - #ids_unused=take(ids_unused,flatnonzero(greater(ids_unused,0))) - #print ' ids_unused_orig',ids_unused_orig,type(ids_unused_orig) - #print ' len(ids_unused_orig)',len(ids_unused_orig),ids_unused_orig.shape - #print ' greater(ids_unused_orig,0)',greater(ids_unused_orig,0) - #print ' len(greater(ids_unused_orig,0))',len(greater(ids_unused_orig,0)) - #print ' flatnonzero(greater(ids_unused_orig,0))',flatnonzero(greater(ids_unused_orig,0)) - #print ' len(flatnonzero(greater(ids_unused_orig,0)))=',len(flatnonzero(greater(ids_unused_orig,0)) ) - ids_unused=ids_unused_orig[np.flatnonzero(np.greater(ids_unused_orig,0))] - zid=1 + # ids_unused=take(ids_unused,flatnonzero(greater(ids_unused,0))) + # print ' ids_unused_orig',ids_unused_orig,type(ids_unused_orig) + # print ' len(ids_unused_orig)',len(ids_unused_orig),ids_unused_orig.shape + # print ' greater(ids_unused_orig,0)',greater(ids_unused_orig,0) + # print ' len(greater(ids_unused_orig,0))',len(greater(ids_unused_orig,0)) + # print ' flatnonzero(greater(ids_unused_orig,0))',flatnonzero(greater(ids_unused_orig,0)) + # print ' + # len(flatnonzero(greater(ids_unused_orig,0)))=',len(flatnonzero(greater(ids_unused_orig,0)) + # ) + ids_unused = ids_unused_orig[ + np.flatnonzero(np.greater(ids_unused_orig, 0))] + zid = 1 else: - if len(self._inds)==0: - ids_unused=np.zeros(0,dtype = np.int32) + if len(self._inds) == 0: + ids_unused = np.zeros(0, dtype=np.int32) else: - ids_unused=ids_unused_orig.copy() - - zid=0 - - n_unused=len(ids_unused) - n_max=len(self._inds)-1 - #print ' ids_unused',ids_unused - #print ' ids_unused.shape',ids_unused.shape - #print ' len(ids_unused)',len(ids_unused) - #print ' n_unused,n_max,zid=',n_unused,n_max,zid - - - - if n_max id_max_old: - #print 'ext',-1*ones(id_max-id_max_old) - self._inds = np.concatenate((self._inds, -1*np.ones(id_max-id_max_old,int))) - + # print 'ext',-1*ones(id_max-id_max_old) + self._inds = np.concatenate( + (self._inds, -1 * np.ones(id_max - id_max_old, int))) + # assign n new indexes to new ids - ind_new = np.arange(n_array_old,n_array_old+n) - - #print 'ind_new',ind_new - np.put(self._inds,ids,ind_new) - - #print ' concat ids..',self._ids,ids - self._ids = np.concatenate((self._ids,ids)) - - + ind_new = np.arange(n_array_old, n_array_old + n) + + # print 'ind_new',ind_new + np.put(self._inds, ids, ind_new) + + # print ' concat ids..',self._ids,ids + self._ids = np.concatenate((self._ids, ids)) + + def add_rows(self, n=None, ids=[], **attrs): - def add_rows(self, n=None, ids = [], **attrs): - if n != None: ids = self.suggest_ids(n) - elif (len(ids)==0)&(len(attrs)>0): + elif (len(ids) == 0) & (len(attrs) > 0): # get number of rows from any valye vector provided ids = self.suggest_ids(len(attrs.values()[0])) - elif (n==None) &(len(ids)==0)&(len(attrs)>0): + elif (n == None) & (len(ids) == 0) & (len(attrs) > 0): # nothing given really-> do nothing - return np.zeros((0),np.int) - + return np.zeros((0), np.int) + else: # ids already given , no ids to create pass - - #print 'add_rows ids', ids, type(ids) + + # print 'add_rows ids', ids, type(ids) self._add_ids(ids) - - - + for colconfig in self._colconfigs: - colconfig.add(ids, values = attrs.get(colconfig.attrname, None )) + colconfig.add(ids, values=attrs.get(colconfig.attrname, None)) if self.plugin: - self.plugin.exec_events_ids(EVTADDITEM,ids) + self.plugin.exec_events_ids(EVTADDITEM, ids) return ids - - def set_rows(self, ids , **attrs): - - + def set_rows(self, ids, **attrs): + for colconfig in self._colconfigs: - colconfig.set(ids, values = attrs.get(colconfig.attrname, None )) + colconfig.set(ids, values=attrs.get(colconfig.attrname, None)) if self.plugin: - self.plugin.exec_events_ids(EVTSETITEM,ids) - - - def add_row(self, _id = None, **attrs): + self.plugin.exec_events_ids(EVTSETITEM, ids) + + def add_row(self, _id=None, **attrs): if _id == None: _id = self.suggest_id() - + self._add_ids([_id]) #ids = self.add_rows(1, **attrs) for colconfig in self._colconfigs: - #print ' add_row',colconfig.attrname,attrs.get(colconfig.attrname, None ) - colconfig.add(_id, values = attrs.get(colconfig.attrname, None )) - + # print ' + # add_row',colconfig.attrname,attrs.get(colconfig.attrname, None ) + colconfig.add(_id, values=attrs.get(colconfig.attrname, None)) + if self.plugin: - self.plugin.exec_events_ids(EVTADDITEM,[id]) + self.plugin.exec_events_ids(EVTADDITEM, [id]) return _id - + def set_row(self, _id, **attrs): - #if _id == None: - #print ' set_row ',self.get_ident(),attrs - for colconfig in self._colconfigs:# TODO: run through keys!!!! - #print ' add_row',_id,colconfig.attrname,attrs.get(colconfig.attrname, None ) - #if attrs.has_key(colconfig.attrname): + # if _id == None: + # print ' set_row ',self.get_ident(),attrs + for colconfig in self._colconfigs: # TODO: run through keys!!!! + # print ' add_row',_id,colconfig.attrname,attrs.get(colconfig.attrname, None ) + # if attrs.has_key(colconfig.attrname): #colconfig.set(_id, values = attrs[colconfig.attrname]) - colconfig.set(_id, values = attrs.get(colconfig.attrname, None )) - - + colconfig.set(_id, values=attrs.get(colconfig.attrname, None)) + if self.plugin: - self.plugin.exec_events_ids(EVTSETITEM,[id]) - - + self.plugin.exec_events_ids(EVTSETITEM, [id]) + def del_row(self, _id): - #print 'del_row',id + # print 'del_row',id self.del_rows([_id]) - + def del_rows(self, ids): - #print 'del_rows',ids + # print 'del_rows',ids # TODO: this could be done in with array methods - - for _id in ids: - i=self._inds[_id] - + + for _id in ids: + i = self._inds[_id] + for colconfig in self._colconfigs: - #print ' colconfig',colconfig.attrname,i - #colconfig.delete_ind(i) - del colconfig[_id] # this is universal, also for cm.ColConfigs - - - #print ' del from id lookup' - self._ids=np.concatenate((self._ids[:i],self._ids[i+1:])) - - #print ' free index',id - if _id == len(self._inds)-1: + # print ' colconfig',colconfig.attrname,i + # colconfig.delete_ind(i) + del colconfig[_id] # this is universal, also for cm.ColConfigs + + # print ' del from id lookup' + self._ids = np.concatenate((self._ids[:i], self._ids[i + 1:])) + + # print ' free index',id + if _id == len(self._inds) - 1: # id is highest, let's shrink index array by 1 - self._inds=self._inds[:-1] + self._inds = self._inds[:-1] else: - self._inds[_id]=-1 - + self._inds[_id] = -1 + # get ids of all indexes which are above i - ids_above=np.flatnonzero(self._inds>i) - + ids_above = np.flatnonzero(self._inds > i) + # decrease index from those wich are above the deleted one #put(self._inds, ids_above,take(self._inds,ids_above)-1) - self._inds[ids_above]-=1 - - #print ' self._inds',self._inds - + self._inds[ids_above] -= 1 + + # print ' self._inds',self._inds + if self.plugin: - self.plugin.exec_events_ids(EVTDELITEM,ids) - - - #print ' del',ids,' done.' - + self.plugin.exec_events_ids(EVTDELITEM, ids) + + # print ' del',ids,' done.' + def clear_rows(self): - print 'clear_rows',self.ident - + print 'clear_rows', self.ident + if self.plugin: - self.plugin.exec_events_ids(EVTDELITEM,self.get_ids()) + self.plugin.exec_events_ids(EVTDELITEM, self.get_ids()) self._ids = [] - self._inds = np.zeros((0,),int) - self._ids = np.zeros((0,),int) - + self._inds = np.zeros((0,), int) + self._ids = np.zeros((0,), int) + for colconfig in self._colconfigs: - print 'clear_rows',colconfig.attrname,len(colconfig.get_value()) + print 'clear_rows', colconfig.attrname, len(colconfig.get_value()) colconfig.clear() - print ' done',len(colconfig.get_value()) - - - - - + print ' done', len(colconfig.get_value()) - - class ArrayObjman(Arrayman, TableMixin): + """ Array Object management manages objects with numeric Python arrays based columns. Can also handle list and dict based columns. """ - def __init__(self,ident, **kwargs): - self._init_objman( ident, **kwargs) - - - def _init_objman(self, ident,is_plugin = False, **kwargs): - BaseObjman._init_objman(self, ident, managertype = 'table', **kwargs) + + def __init__(self, ident, **kwargs): + self._init_objman(ident, **kwargs) + + def _init_objman(self, ident, is_plugin=False, **kwargs): + BaseObjman._init_objman(self, ident, managertype='table', **kwargs) Arrayman.__init__(self, is_plugin=is_plugin) self.set_attrsman(self) - + def init_postload_internal(self, parent): """ Called after set state. Link internal states. """ TableMixin.init_postload_internal(self, parent) - - def init_postload_external(self): + + def init_postload_external(self): """ Called after set state. Link internal states. - """ + """ TableMixin.init_postload_external(self) self._init_attributes() self._init_constants() def clear_rows(self): if self.plugin: - self.plugin.exec_events_ids(EVTDELITEM,self.get_ids()) - self._inds = np.zeros((0,),int) - self._ids = np.zeros((0,),int) + self.plugin.exec_events_ids(EVTDELITEM, self.get_ids()) + self._inds = np.zeros((0,), int) + self._ids = np.zeros((0,), int) for colconfig in self.get_attrsman()._colconfigs: - #print 'ArrayObjman.clear_rows',colconfig.attrname,len(colconfig.get_value()) + # print + # 'ArrayObjman.clear_rows',colconfig.attrname,len(colconfig.get_value()) colconfig.clear() - #print ' done',len(colconfig.get_value()) - + # print ' done',len(colconfig.get_value()) + def clear(self): - #print 'ArrayObjman.clear',self.ident + # print 'ArrayObjman.clear',self.ident # clear/reset scalars - for attrconfig in self.get_attrsman().get_configs( structs = STRUCTS_SCALAR): + for attrconfig in self.get_attrsman().get_configs(structs=STRUCTS_SCALAR): attrconfig.clear() self.clear_rows() self.set_modified() - - - - \ No newline at end of file diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/base.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/base.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/base.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/base.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,3726 +1,3664 @@ -""" -This package contains the base classes of al relevant classes. - -TODO: Following issues must be resolved in the following version - -- child - parent - ident - named - childs of named parents should have the name in the ident...and local ident - create 2 ident entries for arrayobj: attr+id - use a list for ident elements instead of a string wityh string conversion - on the fly or permanently. - May be of advantaqge (= fast) to store instances that are on the path of the - ident elements - - in particular: distiguish between an instance on the tree that is created with parent - and an already initialized instance that is set and usd as a link. - idea in this case get all confuguration info from instance itself - or better link to it! -- ident should be a sequence or list of strings -- separate classes for array type objects -- classes for metatypes -- try to reduce type recognition during init ?? -- MIXIN for named operation just as for plugin -- make plugin faster by overwriting get/set attribute -- print attribute must also go in classes - - -- make common initialization priciples in particular for classes based on mixins - who sets the name: the parent! name is option with default -- simplify configurationwith key setting...should appear only once - try to catch it from within the object with __name__ -- try to remove stored type identification...careful problems are nd scalars - -""" -from numpy import * -#from numpy.oldnumeric.user_array import numpy.oldnumeric.user_array as UserArray -from copy import copy,deepcopy - -from sys import exit -import types,string,pickle -#import networkx as nx - -try: - flatnonzero -except: - def flatnonzero(x): - return nonzero(x.ravel()) - -CONFIG_TEMPLATE={ - 'info':'', - 'doc':'', - 'metatype':'', - 'type':'', - 'group':[], - 'save':True, - 'copy':False, - 'struct':'scalar', - 'perm':'w', - 'unit':'', - 'do_init_arrayobj':False, - } - -ARRAYTYPES=[types.TupleType,ndarray,types.ListType,types.XRangeType] - -TYPES={ -'BooleanType':{'dtype':'?', 'perm':'w',}, -'BufferType':{'dtype':'O', 'perm':'r',}, -'BuiltinFunctionType':{'dtype':'O','perm':'r',}, -'BuiltinMethodType':{'dtype':'O','perm':'r',}, -'ClassType':{'dtype':'O','perm':'r',}, -'CodeType':{'dtype':'O','perm':'r',}, -'ComplexType':{'dtype':'D','perm':'w',}, -'DictProxyType':{'dtype':'O','perm':'r',}, -'DictType':{'dtype':'O','perm':'r',}, -'DictionaryType':{'dtype':'O','perm':'r',}, -'EllipsisType':{'dtype':'O','perm':'r',}, -'FileType':{'dtype':'O','perm':'w',}, -'FloatType':{'dtype':'d','perm':'w',}, -'FrameType':{'dtype':'O','perm':'r',}, -'FunctionType':{'dtype':'O','perm':'r',}, -'GeneratorType':{'dtype':'O','perm':'r',}, -'InstanceType':{'dtype':'O','perm':'r',}, -'IntType':{'dtype':'i','perm':'w',}, -'LambdaType':{'dtype':'O','perm':'r',}, -'ListType':{'dtype':'O','perm':'r',}, -'LongType':{'dtype':'g','perm':'w',}, -'MethodType':{'dtype':'O','perm':'r',}, -'ModuleType':{'dtype':'O','perm':'r',}, -'NoneType':{'dtype':'O','perm':'r',}, -'NotImplementedType':{'dtype':'O','perm':'r',}, -'ObjectType':{'dtype':'O','perm':'r',}, -'SliceType':{'dtype':'O','perm':'r',}, -'StringType':{'dtype':'S','perm':'w',}, -'StringTypes':{'dtype':'O','perm':'w',}, -'TracebackType':{'dtype':'O','perm':'r',}, -'TupleType':{'dtype':'O','perm':'r',}, -'TypeType':{'dtype':'O','perm':'r',}, -'UnboundMethodType':{'dtype':'O','perm':'r',}, -'UnicodeType':{'dtype':'U','perm':'w',}, -'XRangeType':{'dtype':'O','perm':'r',}, -'__builtins__':{'dtype':'O','perm':'r',}, -'__doc__':{'dtype':'O','perm':'r',}, -'__file__':{'dtype':'O','perm':'r',}, -'__name__':{'dtype':'O','perm':'r',}, -} - -IDENTSEP='.' - -def make_arrays(**attrs): - """ - Makes an array of same type from all attributes in attrs dictionary - A bit slow! Avoid using this function! - """ - for attr in attrs.keys(): - obj=attrs[attr] - if type(attrs[attr])==ndarray: - attrs[attr]=attrs[attr].reshape((1,)+obj.shape) - elif type(obj) in (types.FloatType,types.LongType): - attrs[attr]=array([obj],float) - elif type(obj) == types.IntType: - attrs[attr]=array([obj],int) - elif type(obj) == types.BooleanType: - attrs[attr]=array([obj],bool) - else: - # another strange type - dt='O' - for typename in dir(types): - if type(obj)==types.__dict__[typename]: - dt=get_dtype(typename) - break - attrs[attr]=array([obj],dtype=dt) - return attrs - -def is_integer(n): - """ - Returns True if n is an integer type of any kind - """ - return type(n) in (types.IntType,int32, int64,int0,int16,int8,types.LongType) - - - -def get_type(obj,typelist=[]): - """ - Returns a flat list of type-string(s) which correspond to the - (nested) type(s) of the object obj. - - The returned type(s) are keys of the global TYPES dictionary. - """ - - typelist=copy(typelist) - if type(obj)==ndarray: - typelist.append(('ArrayType',obj.shape)) - #return typelist # let's assume homogenious array types - if len(obj.ravel())>0: - return get_type(obj.flat[0],typelist) - else: - return typelist - - elif hasattr(obj,'dtype'): # obj is an array element - # attention this is not a string but maybe this should - # also be changed for all other types - typelist.append(obj.dtype.str) - return typelist - - elif type(obj) in (types.ListType,types.TupleType): - typelist.append('ListType') - if obj: - return get_type(obj[0],typelist) - else: - return typelist - - elif type(obj) in (types.DictType,types.DictionaryType): - - if obj: - key=obj.keys()[0] - keytype=get_type(key) - if len(keytype)>0: - typelist.append( ('DictType', keytype[0]) ) - else: - typelist.append( ('DictType','')) - - return get_type(obj[key],typelist) - else: - typelist.append(('DictType','')) - return typelist - - - - else: - for typename in dir(types): - if type(obj)==types.__dict__[typename]: - typelist.append(typename) - return typelist - break - typelist.append('') - return typelist - -def get_dtype(type): - """ - Returns dtype as used in Nummeric package. - The argument is a string defining the python objecy type - and is a key of the TYPES dictionary. - If type is not found in the dictionary, dtype 'O' is - returned, which means a generic object. - """ - if TYPES.has_key(type): - return TYPES[type]['dtype'] - else: - return 'O' - -def save_obj(obj,filename): - """ - Saves python object to a file with filename. - Filename may also include absolute or relative path. - If operation fails a False is returned and True otherwise. - """ - try: - file=open(filename,'wb') - except: - print 'WARNING in save: could not open',simname - return False - - #try: - pickle.dump(obj, file, protocol=2) - file.close() - return True - #except: - # file.close() - # print 'WARNING in save: could not pickle object' - # return False - -def load_obj(filename,parent=None): - """ - Reads python object from a file with filename and returns object. - Filename may also include absolute or relative path. - If operation fails a None object is returned. - """ - print 'load_obj',filename - try: - file=open(filename,'rb') - except: - print 'WARNING in load_obj: could not open',filename - return None - - #try: - #print ' pickle.load...' - obj=pickle.load(file) - file.close() - #print ' obj._link2' - - # _init2_ is to restore INTERNAL states from INTERNAL states - obj._init2_config() - - # _init3_ is to restore INTERNAL states from EXTERNAL states - # such as linking - obj._init3_config() - - # _init4_ is to do misc stuff when everything is set - obj._init4_config() - - return obj - - #except: - # print 'WARNING in load: could not load object' - # return None - -def is_objconfigured(obj): - return hasattr(obj,'init_config') - -class ArrayObj: - """ - Mixin for Classes or Instance which are used as array-element - within the framework of the ArrayObjConfigurator. - - Its main function is init_arrayobj where an id gets assigned - which corresponds to the id of the element in the parent array. - - Also __getitem__ and __setitem__ functions are implemented through which - array elements with the same id of other attributes of the parent object - can be read and changed. - """ - def init_arrayobj(self,id,parent,ident,**args): - """ - Initialize by defining parent instance where all the - attributes of this instance are stored in array form. - Also define the id of the array coresponding to this instance. - - Function will be called automatically from ArrayObjConfigurator - when id is assigned. - - """ - self.parent=parent - #if ident=='': - # ident=parent.ident+IDENTSEP+str(id) - #else: - self.ident=ident - self.id=id - self.config_with_id() - #print 'init_arrayobj',self.ident,id#,parent - - - - - def config_with_id(self): - """ - Here the instance can be inizialized.. - Function called AFTER self.id and self.parent have been assigned. - """ - pass - - def copy_attrs(self,targetobj,attrs=None): - """ - Copies given list of attributes of this object - to given target object. - - If no attributes are given then all attributes of this object - are considered for copying. - - Clearly, the array attributes corresponding to the id of this - object are copied to the array attributes of the arrays - with the id of the target object. - - To copy an attribute, the foolowing conditions must be satisfied: - - the attribute must be configured with key copy=True - - the attribute must be configured in targetobject - - """ - self.parent.copy_attrs(targetobj, self.id, targetobj.id, attrs=attrs) - - def __getitem__(self,key): - return self.getparent(key) - - def __setitem__(self,key,value): - self.setparent(key,value) - - - def setparent(self,key,value): - """ - Sets entry with id of this instance of the attribute 'key' of parent object. - - Usage: - self['attributename']=value - - - """ - # print key,value - self.parent[key,self.id]=value - - def getparent(self,key): - """ - Gets entry with id of this instance of the attribute in parent object. - - Usage: - self['attributename'] - """ - #print 'ArrayObject.__getitem__',key - return self.parent[key,self.id] - - def get_groupattrs_obj(self,name): - """ - Returns a dictionary with all attributes of a group with given name. - Key is attribute name and value is attribute value for the given id. - """ - #print 'get_groupattrs_obj',name,self.id - return self.parent.get_groupattrs(name,self.id) - -class PlugoutMixin: - """ - Mixin to provide methods to plug callback functions into other objects. - """ - def init_plugout(self): - """ - Initialize basic plugout variables - """ - # dictionary with pluginobj as key and list with plugids - # provided by obj as value - self._plugoutobjs={} - - def add_plugout(self,obj, plugtype, function,attr='_all'): - """ - Make a plugin to object and retain plugin id for later unplugg. - - Standard plug types are automatically set bu the system: - plugtype plugcode - 'del' 0 - 'set' 1 - 'get' 2 - 'add' 3 - - 'del_items' 20 - 'set_items' 21 - 'get_items' 22 - 'add_items' 23 - - - - """ - if not self._plugoutobjs.has_key(obj): - self._plugoutobjs[obj]=[] - # make plugin to object - plugid=obj.add_plugin(obj,plugtype,function,attr) - - # add plugginid of obj to list - self._plugoutobjs[obj].append(plugid) - - return plugid - - def del_plugout(self,obj,plugid=-1): - """ - Plug out from specified object. - If plugid is specified, only this plug is pulled, - otherwise all plugs to this object are pulled at once. - """ - if self._plugoutobjs.has_key[obj]: - if plugid<0: - if self._plugoutobjs[obj].count(plugid)>0: - obj.del_plugin(plugid) - self._plugoutobjs[obj].remove(plugid) - else: - for plugids in self._plugoutobjs[obj]: - obj.del_plugin(plugid) - del self._plugoutobjs[obj] - else: - print 'WARNING: no plugout ids for object',obj - plugids=[] - - def unplugout(self): - """ - Unplug all plugs on other objects - """ - for obj in self._plugoutobjs.keys(): - self.del_plugout(obj) - -class PluginMixin: - """ - Mixin to provide methods to plug in callback functions - from other objects. - """ - def init_plugin(self): - """ - Initialize basic plugin variables - """ - #self._plugins={} # compulsory in configurator! - self._counter_plugid=0 - - self._plugcode={'test':-1} - #print 'init_plugin',self.ident,self._plugcode - - # dictionary with obj as key and dict with plugid,plugtype,attr as value - self._pluginobjs={} - - # add basic plugincodes - # for scalars - self.add_plugcodes([('del',0),('set',1),('get',2),('add',3)]) - - if hasattr(self,'get_ids'): - #print ' add_plugcodes arrays for ',self.ident - self.add_plugcodes([ ('del_items',20), - ('set_items',21), - ('get_items',22), - ('add_items',23),]) - self.enable_plugins() - - def execute_plugin(self,plugtype): - """ - Execute all callbacks for the plugin of the given type - """ - self._execute_plugins(self._plugcode[plugtype],attr='_all') - - def add_plugcodes(self,plugcodes): - """ - Plugcodes integers that correspond to a plugtype. - These integers are used as keys for faster access. - - Argument plugcodes is a list with tuples - each tuple containing plugtype and plugcode. - - Standard plug types are automatically set bu the system: - plugtype plugcode - 'del' 0 - 'set' 1 - 'get' 2 - 'add' 3 - - 'del_items' 20 - 'set_items' 21 - 'get_items' 22 - 'add_items' 23 - - """ - #print 'add_plugcodes',plugcodes - for plug,plugcode in plugcodes: - if not self._plugcode.has_key(plug): - self._plugcode[plug]=plugcode - #self._plugins[plugcode]={'_all':{}} - #print ' added self._plugcode[plug]',plug,self._plugcode[plug] - else: - print 'WARNING:_add_plugcodes: already existant code',\ - plug,self._plugcode[plug] - print ' Refused to insert.' - - def add_plugin(self,obj,plug,callbackfunction,attr='_all'): - #print 'add_plugin',plug,callbackfunction,attr - self._counter_plugid+=1 - plugid=self._counter_plugid - plugcode=self._plugcode[plug] - - if not self._plugins.has_key(plugcode): - self._plugins[plugcode]={} - - if not self._plugins[plugcode].has_key(attr): - self._plugins[plugcode][attr]={plugid:callbackfunction} - else: - self._plugins[plugcode][attr][plugid]=callbackfunction - - if not self._pluginobjs.has_key(obj): - self._pluginobjs[obj]={} - - self._pluginobjs[obj][plugid]=(plugcode,attr) - return plugid - - def disable_plugins(self): - """ - Prevents plugins from execution - """ - self._enable_plugins=False - - def enable_plugins(self): - """ - Enable plugins for execution - """ - self._enable_plugins=True - - def del_plugin(self,obj,plugid=-1): - """ - Remove plugin with pluginid - """ - - if plugid>=0: - plugids=[plugid] - else: - plugids=self._pluginobjs[obj].keys() - - if self._pluginobjs.has_key(obj): - # there exist ids associated with this object - for pid in plugids: - if self._pluginobjs[obj].has_key(pid): - # remove plugin with pid - plugcode,attr=self._pluginobjs[obj][pid] - del self._plugins[plugcode][attr][pid] - del self._pluginobjs[obj][pid] - - if len(self._plugins[plugcode][attr])==0: - # no more plugins for this attribute...remove it - del self._plugins[plugcode][attr] - if len(self._plugins[plugcode])==0: - # np more plugins for this plugintype...remove it - del self._plugins[plugcode] - - - - if len(self._pluginobjs[obj])==0: - # no more plugin ids associated with this object - del self._pluginobjs[obj] - - - -class ObjConfigurator: - """ - Base mixin class for general scalar object configuration. - - Usage: - - During initialization of class call - - self.init_config('myclass_ident_string',name='my human readable class') - - or if there is a parent object availlable: - - self.init_config('myclass_ident_string',parent) - - In this case the ident of the parent obj is prependet - - - - """ - def init_config(self,ident='',parent=None,name='noname',**args): - #print '---init_config ident',ident,hasattr(self,'init_plugin') - #print ' parent',parent - #print ' name',name,len(name) - - if hasattr(self,'ident'): - ident=self.ident - - if (name=='noname') & (len(ident)>0): - self.name=ident - elif (name=='noname') & (len(ident)==0): - if self.__dict__.has_key('__name__'): - ident=self.__name__ # use class name as identifier - self.name=ident - - elif (len(name)>0) & (len(ident)==0): - if self.__dict__.has_key('__name__'): - ident=self.__name__ # use class name as identifier - self.name=name - else: - self.name=name - - - self.ident=ident - self.parent=parent - if parent != None: - - #print 'init_config',ident,parent.ident - # present object is a child of a parent - # => prepend parent identifier string - if hasattr(parent,'ident'): - self.ident=parent.ident+IDENTSEP+ident - - self._config={} - self._groups={} - self._functions=[] - - # define a list with attribute strings that need to be saved - # apart from the cofigured attributes - # this list may be extended by successive initializations - self._attrs_save=[ #'parent', - 'name','ident','_config','_groups', - '_functions', - ] - - # conditional plugin import - self._init_plugging() - - #print 'Created configuration for',self.ident - - - - return self.ident - - def reset_parent(self,parent): - """ - Resets previously assigned parent. - This method is not used during initialization. - """ - ident = self.get_ident(is_local=True) - self.parent=parent - if parent != None: - #print 'init_config',ident,parent.ident - # present object is a child of a parent - # => prepend parent identifier string - if hasattr(parent,'ident'): - self.ident=parent.ident+IDENTSEP+ident - - - def get_ident(self, is_local=False): - """ - Returns identity string. - By default it returns the entire identity string - unless is_local==True. In this case only the local, the last - element of the global identity is returned. - """ - if is_local: - return string.split(self.ident,IDENTSEP)[-1] - else: - return self.ident - - def _link(self,parent=None): - """ - Called after load process to link with other instances - in the environment. - """ - - #self.parent=parent - #for attr in self._config.keys(): - # obj=getattr(self,attr) - # if is_objconfigured(): - # obj._link(self) - pass - - def _init2_config(self): - """ - Called after load and link process to do make initializations - of constants, dependent INTERNAL attributes such as hash tables, - NO LINKS OR DEPENDENCIES TO EXTERNAL INSTANCES ALLOWED - - Here only the configurator internal attributes are restored. - All object specific in _init2() in - """ - print '\n _init2_config',self.ident - - - print ' restore unsaved attributes',self.ident - self._functions=[] - for attr in self._config.keys(): - - # check - #if hasattr(self,attr): - # value=getattr(self,attr) - #print ' attr',attr, - #if type(value)==ndarray: - # print value.dtype,value.shape - #else: - # print value - - config=self._config[attr] - if config['is_function']: - #print ' resore function',attr - self._functions.append(attr) - elif not config['save']: - #print ' resore attr',attr - self.reset(attr) - # check - #value=getattr(self,attr) - #print ' after: attr',attr, - #if type(value)==ndarray: - # print value.dtype,value.shape - #else: - # print value - - # conditional plugin import - self._init_plugging() - - print ' call _init2',self.ident - - self._init2() - - print ' restore children',self.ident - for attr in self._config.keys(): - config=self._config[attr] - if (config['save'])&(not config['is_function']): - if config['struct']=='scalar': - obj=getattr(self,attr) - if is_objconfigured(obj): - print ' call _init2_config of',obj.ident - obj._init2_config() - else: - # attribute is an array so init here for arrays as well - # TODO: should go as special in arrayconfigurator - for id in self.get_ids(): - obj=self[attr,id] - if is_objconfigured(obj): - print ' call _init2_config of',obj.ident - obj._init2_config() - - - - - def _init2(self): - """ - Called after load process to do make initializations - of constants, dependent INTERNAL attributes such as hash tables, - NO LINKS OR DEPENDENCIES TO EXTERNAL INSTANCES ALLOWED - - To be overridden. - """ - pass - - def _init3_config(self): - """ - Called after load and link process to do make initializations - of constants, dependent attributes such as hash tables, - links to external instances etc. - - """ - print '\n_init3_config',self.ident - # link with other, now already initialized objects - # Those attributes which have NOT been saved, but have - # an ident in they configuration can no be recovered - # though their ident - for attr in self._config.keys(): - config=self._config[attr] - - if config.has_key('link'): - # try to recover object with ident - - if config['link']: - - if config['struct'] in ('array','dict','marray'): - print ' detected link array ',attr - # here we want to recover links to objects - # using a dictionary with - # id as key and ident as value - for id in self.get_ids(): - self[attr,id] = self.get_obj_instance(config['ident'][id]) - - else: - print ' detected link ',attr - setattr(self, attr, self.get_obj_instance(config['ident']) ) - - # make specific settings - self._init3() - - #print ' restore children',self.ident - for attr in self._config.keys(): - config=self._config[attr] - if (config['save'])&(not config['is_function']): - if config['struct']=='scalar': - obj=getattr(self,attr) - if is_objconfigured(obj): - #print ' call _init3_config of',obj.ident - obj._init3_config() - else: - # attribute is an array so init here for arrays as well - # TODO: should go as special in arrayconfigurator - for id in self.get_ids(): - obj=self[attr,id] - if is_objconfigured(obj): - #print ' call _init3_config of',obj.ident - obj._init3_config() - - def _init3(self): - """ - Called after load and internal link process to do make initializations - of constants, dependent attributes such as hash tables, - links to external instances etc. - - To be overridden. - """ - pass - - def _init4_config(self): - """ - Called after load and link process to do make initializations - any other initializations. - - """ - print '\n_init4_config',self.ident - - - # make specific settings - self._init4() - - #print ' restore children',self.ident - for attr in self._config.keys(): - config=self._config[attr] - if (config['save'])&(not config['is_function']): - if config['struct']=='scalar': - obj=getattr(self,attr) - if is_objconfigured(obj): - #print ' call _init4_config of',obj.ident - obj._init4_config() - else: - # attribute is an array so init here for arrays as well - # TODO: should go as special in arrayconfigurator - for id in self.get_ids(): - obj=self[attr,id] - if is_objconfigured(obj): - #print ' call _init4_config of',obj.ident - obj._init4_config() - - def _init4(self): - """ - Called after load and link process to do make initializations - any other initializations. - - To be overridden. - """ - pass - - def _init_plugging(self): - """ - Initializes plugin and plugout related variables. - This function is called during initialization - and after load, before reinitializeing other attrubutes. - """ - #print '_init_plugging',self.ident,self - #if make_plugins: - # from PluginMixin import * - if hasattr(self,'init_plugin'): - #print ' ini_plugin',self.ident,self - self.init_plugin() - - - if hasattr(self,'init_plugout'): - #print ' ini_plugout',self.ident - self.init_plugout() - # this plugin dictionary is always required and remains - # empty if no plugins are made - self._plugins={} - - def _execute_plugins(self,plugcode,attr='_all',**args): - """ - This method executes all callbackfunctions associated with the - given plugcode. - This funcion is a core part because used in various - methods. All other methods regarding plugins in PluginMixin. - """ - # it has been checked that self._plugins has all keys - print '_execute_plugins',plugcode,' for',self.ident,attr - #print ' self._plugins=',self._plugins - #print ' self._plugins[plugcode]=',self._plugins[plugcode] - - if self._enable_plugins: - args['attr']=attr - if self._plugins[plugcode].has_key('_all'): - for func in self._plugins[plugcode]['_all'].values(): - #print ' => execute function',func - #print ' with args',args - func(**args) - elif self._plugins[plugcode].has_key(attr): - # selective plugin for specific attribute - for func in self._plugins[plugcode][attr].values(): - func(**args) - #else: - # print ' no plugin functions for plugcode',plugcode - - def get_name(): - """ - Returns formatted name string of object. - """ - return self.name - - def print_config(self): - - #print 'inds=',self._inds - print '====================================================================' - print ' Config of',self.name,' with ident:',self.ident - print '====================================================================' - for attr in self._config.keys(): self.print_attr(attr) - - #for name in self.get_groupnames(): - # if self.get_group(name): - # print 'Group: ',name - # for attr in self.get_group(name): - # self.print_attr(attr) - - # print all attributes which are not in a group - #print '--' - #for attr in self._config.keys(): - # if len(self._config[attr]['group'])==0: - # self.print_attr(attr) - - - def print_attr(self,attr): - #config=self.get_config(attr) - #print ' ', attr,'=',self.__dict__[attr],config['unit'] - print ' '+attr+' = '+self.get_string_attr_value(attr,self[attr]) - - - def print_attrattrs(self,attrs=None,attrattrs=['info','group','struct'],filename=None,sep='\t'): - """ - Prints attributes of attributes. - If - """ - #print 'print_attrattrs' - lines = [] - if attrs==None: - attrs = self._config.keys() - attrs.sort() - line = u'attr' - for attrattr in attrattrs: - line+=sep+attrattr - lines.append(line) - - for attr in attrs: - #print ' attr',attr - line = u''+attr - for attrsattr in attrattrs: - if self._config[attr].has_key(attrsattr): - line+=sep+str(self._config[attr][attrsattr]) - else: - line+=sep+'' - lines.append(line) - - if filename!=None: - file=open(filename,'w') - for line in lines: - #print line - file.write(line+'\n') - file.close() - else: - for line in lines: - print line - - return lines - - def get_string_attr_value(self,attr,value): - """ - Returns a string with correctly formatted value of attribute. - """ - #print '\n\nget_string_attr_value',attr,value,type(value) - #print self.get_printformat(attr)+self.get_unit(attr) - #print (self.get_printformat(attr)+self.get_unit(attr))%(value) - config=self.get_config(attr) - tt=config['type'][0] - unit=self.get_unit(attr,show_parentesis=True) - if tt in ('BooleanType',): - if value: - s='True' - else: - s='False' - return s+self.get_unit(attr,show_parentesis=True) - - elif type(value) in ARRAYTYPES: - # value is an array=> print signe items - s='[' - for v in value: - s+=self.get_string_attr_value(attr,v)+',' - s+=']' - return s - - else: - try: - return (self.get_printformat(attr)\ - + ' ' + self.get_unit(attr,show_parentesis=True))%value - except: - print '\n WARNING could not print',attr,'=',value - return 'Error' - def get_printformat(self,attr): - """ - Returnes the standad fortran stringformat for attribute. - """ - config=self.get_config(attr) - tt=config['type'][0] - if tt in ('IntType', 'LongType'): - return '%'+str(config['digits_integer'])+'d' - - elif tt in ('FloatType','ComplexType'): - return '%'+str(config['digits_integer'])+'.'\ - +str(config['digits_fraction'])+'f' - - else: - # its a string - return '%s' - - return printformat - - def get_numformat(self,attr,confog=None): - """ - Returns a dictionary with all formatting infos on attribute. - It is tried to detect the numerical datatype and define - formatting info, if not already defined. - """ - # determine format of numeric value - - config=self.get_config(attr) - - # take top level type - tt=config['type'][0] - numformat={} - if tt in ('IntType', 'LongType'): - numformat['digits_integer']=config.get('digits_integer',13) - numformat['digits_fraction']=config.get('digits_fraction',0) - else: - numformat['digits_integer']=config.get('digits_integer',9) - numformat['digits_fraction']=config.get('digits_fraction',8) - - numformat['min']=config.get('min',None) - numformat['max']=config.get('max',None) - - - #print 'get_numformat',attr,numformat - return numformat - - - def config(self,attr,default=None,**args): - """ - Configure attribute for Object. - """ - #print '\n\n\n'+70*'*' - #print 'config',attr,default,args - - # configure attribute with template and parameters from args - self._config[attr]=deepcopy(CONFIG_TEMPLATE) #CONFIG_TEMPLATE.copy() - - #print ' after template configured attr:',attr,self._config[attr] - - # try to guess type...as default only - t=get_type(default) - self._config[attr]['type']=t - #print ' get_type(default)=',get_type(default) - - # guess read/write permissions according to toplevel type - if TYPES.has_key(t[0]): - self._config[attr]['perm']=TYPES[t[0]]['perm'] - - - - # default name - self._config[attr]['name']=attr - - if args.has_key('metatype'): - # TODO: fetch here metatype info from metatype module - pass - else: - self._config[attr]['metatype']='' # default - - - # overwrite all defaults with arguments - self._config[attr].update(args) - - #print ' after update configured attr:',attr,self._config[attr] - - if type(self._config[attr]['type'])!=types.ListType: - self._config[attr]['type']=[self._config[attr]['type']] - - # complete with numerical format info - self._config[attr].update(self.get_numformat(attr)) - - - # store default value here, - # in case of an array this is the value of a single entry - self._config[attr]['default']=default - - - # check if attribute is an existing function and if yes register - # as such in config - self._config[attr]['is_function']=False - if hasattr(self,attr): - if type(getattr(self,attr))==types.MethodType: - #print ' ',attr,'is a function' - self._config[attr]['is_function']=True - #self._config[attr]['perm']='r' # read only - - if self._config[attr]['is_function']: - # register attribute in function list - self._functions.append(attr) - else: - self.reset(attr) - - #print ' configured attr:',attr,self._config[attr] - - # this turnes group argument in a list when given a signle string - # TODO: would be better to introduce groups as a list with all group names - groupnames=self._config[attr]['group'] - if type(groupnames) == types.StringType: - self._config[attr]['group']=[groupnames,] - - if (self._config[attr]['metatype']=='id'): - # explictly declared as id - # make sure of array structure - self._config[attr]['struct'] = 'array' - # TODO: better identify object as arrayobjconfiguaror - - # put attribute into id_ref or obj ref group - # if no reference is made then put in id group - if self._config[attr].has_key('ident_ref'): - if self._config[attr]['struct']=='array': - - if 'id_ref' not in self._config[attr]['group']: - #print ' ident_ref detected id_ref for',attr - self._config[attr]['group'].append('id_ref') - self._config[attr]['metatype']='id' - #print ' check template',CONFIG_TEMPLATE.copy() - else: - #print ' ident_ref detected obj_ref for',attr - if 'obj_ref' not in self._config[attr]['group']: - self._config[attr]['group'].append('obj_ref') - self._config[attr]['metatype']='obj' - - elif (self._config[attr]['metatype']=='id'): - # and add it to id group - if 'id' not in self._config[attr]['group']: - self._config[attr]['group'].append('id') - - - for groupname in self._config[attr]['group']: - self.config_group(groupname,attr) - - # this is a treatment fo linked objects, which are - # not a parent or a child of this objects - # they ill not be saved, but recovered bu their ident during _init3 - if self._config[attr].has_key('link'): - if self._config[attr]['link']: - # try to recover object with ident - # however, ident itself will only be stored during saving - self._config[attr]['save'] = False - self._config[attr]['perm'] = 'r' - - - def reset(self,attr): - """ - Reset atttribute attr to default values - """ - # create attribute and if there are already arrays with entries, - # create the same number of entries with default value - #default=self._config[attr]['default'] - #struct=self._config[attr]['struct'] - - - - #if self._config[attr]['is_function']: - # # register attribute in function list - # #self._functions.append(attr) - # # already done in config - # pass - #else: - # attr is a scalar , simply assign default - if not self._config[attr]['is_function']: - self.__dict__[attr]=self._get_default(attr) - - def set_default(self,attr, value): - """ - Sets a default value for this attribute. - """ - self._config[attr]['default']=value - - def _get_default(self,attr): - """ - Returns default value for attribute with name attr_name - - Usage: - Return a scalar default - self._get_default('attr_name') - - - """ - default=self._config[attr]['default'] - #struct=self._config[attr]['struct'] - - if type(default)==ndarray: - obj=default#.tolist() - - elif (type(default)==types.ClassType): - if self._config[attr]['init']: - # Default is a class, needs to be initialized - # TODO: initialization and global id needs to be reviewed - obj=default(self) - - - else: - # otherwise just copy default value - obj=default - - #print '_get_default',obj - return obj - - - - - - - def set(self,attr,val=None): - """ - Sets value to attribute. - - Usage: - - Set scalar variable var with value val - self.set('var',val) - - - """ - - if self._config['attr']['struct']=='scalar': # exclude functions - self.__dict__[attr]=val - - if self._plugins.has_key(1): - self._execute_plugins(1,key) - - def is_config(self,attr): - """ - Returns true if attribute with name attr is configured. - """ - return self._config.has_key(attr) - - def copy_attrs(self,targetobj): - """ - Copies given list of scalar attributes of this object - to given target object. - - If no attributes are given then all attributes of this object - are considered for copying. - - copy an attribute, the foolowing conditions must be satisfied: - - the attribute must be configured with key copy=True - - the attribute must be configured in targetobject - - the structure of the attribute must be scalar - (arrays done by copy method of ArrayObjConfigurator) - """ - if attrs==None: - # get all attributes - attrs=self._config.keys() - - for attr in attrs: - config=self._config[attr] - if config['struct']=='scalar': - if config['copy']: - if targetobj.is_config(attr): - targetobj[attr]=self[attr] - - def get_attrs(self,crits_atleastone=[],crits_all=[]): - """ - Returns list of configured attribute names. - - crits_atleastone and crits_all are lists defining one or several - criteria that the attribute configuration must satify. - for example: [('struct','array'),('struct','dict'),('struct','marray')] - """ - attrs=[] - if len(crits_atleastone)>0: - # get attribute names for attributes where at least one criteria - # is satisfied - for attr in self._config.keys(): - for criteria in crits_atleastone: - #print 'get_attrs:',attr,criteria - if self._config[attr][criteria[0]]==criteria[1]: - attrs.append(attr) - break - return attrs - - elif len(crits_all)>0: - # get attribute names for attributes where all criteria - # are satisfied - for attr in self._config.keys(): - satisfied=True - for criteria in crits_all: - #print 'get_attrs:',attr,criteria - satisfied &= (self._config[attr][criteria[0]]==criteria[1]) - if satisfied: - attrs.append(attr) - - return attrs - - else: - # no criteria spacified, return all attribute names - return self._config.keys() - - - - def get_config(self,attr=''): - #print '_get_config:',attr - if attr: - return self._config.get(attr,{}) - else: - return self._config - - def get_root_instance(self): - """ - Returns instance of root obj of the tree. - """ - obj=self - while obj.parent != None: - obj=obj.parent - - return obj - - - def get_obj_instance(self,ident): - """ - Returns the instance of the object of the given identity string ident. - - The researched object must reside within the object tree where also - the self object is a part. - """ - if ident == '': - return None - - elif ident[0] == '.': - # ident starts with a . means that it is a relative link - # starting with this object - obj=self - idents=string.split(self.get_ident(is_local=True)+ident,IDENTSEP) - - else: - obj = self.get_root_instance() - idents=string.split(ident,IDENTSEP) - - print 'get_obj_instance ',idents - print ' root_instance=',obj - if len(idents)==1: - # just one element identification, means this is root - return obj - - elif idents[1] == '': - return obj - - else: - oldobj = obj - oldident = ident - for ident in idents[1:]: - - print ' get attr',ident,'from obj',obj - if ident.isdigit(): # it's an id so get arrayobject - - print ' get it through object[attr,id]',oldobj,oldident,string.atoi(ident) - obj = oldobj[oldident,string.atoi(ident)] - oldobj = obj - oldident = ident - - elif ident == '': - oldobj = obj - # obj=obj # do not dive - - - else: - oldobj = obj - oldident = ident - obj=getattr(obj, ident) - - - return obj - - - - - def create_group(self,name,attr_list=[]): - #print 'create_group',name,attr_list - if type(attr_list) == types.ListType: - #print ' groups before=',self._groups.keys() - self._groups[name]=attr_list - #print ' groups after =',self._groups.keys() - else: - print 'WARNING: attr_list must be list type' - - def config_group(self,name,attr,**args): - """ - Add or append attribute to given name. - """ - #print 'config_group',self._groups,type(self._groups) - #print ' name,attr',name,attr - - if self._groups.has_key(name): - if attr not in self._groups[name]: - #print ' before append',self._groups[name] - self._groups[name].append(attr) - #print ' after append',self._groups[name] - - else: - self.create_group(name,[attr]) - - def get_groupnames(self):return self._groups.keys() - - def get_group(self,name): - """ - Returns a list with attribute names that belong to that group name. - """ - #print 'get_group self._groups=\n',self._groups - return self._groups.get(name,[]) - - def get_groupattrs(self,name): - """ - Returns a dictionary with all attributes of a group. - Key is attribute name and value is attribute value. - """ - attrs={} - for attr in self._groups[name]: - attrs[attr]=self['attr'] - return attrs - - def get_perm(self,attr): - """ - Returns current permission of attribute - """ - return self._config[attr]['perm'] - - def get_unit(self,attr,show_parentesis=True): - """ - Returns unit of attribute - """ - - if self._config[attr].has_key('unit'): - unit = self._config[attr]['unit'] - else: - unit = '' - - if show_parentesis: - if len(unit)>0: - unit='['+unit+']' - - return unit - - def __getitem__(self,attr): - #print '__getitem__',key - - # plugin execution - if self._plugins.has_key(0): - self._execute_plugins(0,attr) - return self.__dict__[attr] - - - def __setitem__(self,attr,value): - """ - Sets a value to an attribute - - - """ - - #print 'setitem',key,'to',value - - self.__dict__[attr]=value - - # plugin execution - if self._plugins.has_key(1): - self._execute_plugins(1,attr) - - def __getstate__(self): - #print '__getstate__',self.ident - #print ' self.__dict__=\n',self.__dict__.keys() - - state={} - if hasattr(self,'_config'): - - - # store ident for linked objects prior to saving - # will be recovered in _init3 - for attr in self._config.keys(): - config = self._config[attr] - - if config.has_key('link'): - # try to recover object with ident - if config['link']: - if config['struct'] in ('array','dict','marray'): - # here we want to retain the idents of all objects - # in this array, using a dictionary with - # id as key and ident as value - config['ident'] = {} - for id in self.get_ids(): - config['ident'][id] = self[attr,id].get_ident() - else: - config['ident'] = getattr(self,attr).get_ident() - - - - #print ' self._config.keys()',self._config.keys() - for attr in self._attrs_save: - state[attr]=getattr(self,attr) #self.__dict__[attr] - #print ' saved state:',attr,state[attr] - - # decide whether to save parent: - # the root object does not save parent because outside the tree - if len(string.split(self.ident,IDENTSEP))>1: - #print ' save parent for',string.split(self.ident,IDENTSEP) - state['parent']=self.parent - else: - state['parent']=None - - - if hasattr(self,'init_arrayobj'): - # it is actually an array-object, save also id - if hasattr(self,'id'): - #print ' saved attr id',self.id - state['id']=self.id - - # save which attributes to save - state['_attrs_save']=self._attrs_save - - - # now save attributes which have been configured to save - for attr in self._config.keys(): - #print ' ',self._config[attr]['save'],attr - if self._config[attr]['save']\ - & (not self._config[attr]['is_function'])\ - & (not (type(getattr(self,attr))==types.MethodType)): - #print ' save attr:',attr - state[attr]=getattr(self,attr) - - - self._getstate(state) - - return state - - - - def _getstate(self,state): - """ - Complete state dict with state variables which are not - contained in the config scheme. All attributes which are - configured and the save option is not explicitely set - to False are automatically inserted in the state dictionay. - """ - pass - - - def __setstate__(self,state): - #print '__setstate__',self - - # this is always required, but will not be saved - self._plugins={} - - for key in state.keys(): - #print ' set state',key - self.__dict__[key]=state[key] - - # done in init2_config... - # set default values for all states tha have not been saved - #for attr in self._config.keys(): - # if (not self._config[attr]['save']) & (not hasattr(self,attr)): - # print ' config attr',attr - # self.config(attr,**self._config[attr]) - - # set other states - self._setstate(state) - - - - - def _setstate(self,state): - """ - Complete state settings of state variables which are not - contained in the config scheme. All attributes which are - configured and the save option is not explicitely set - to False are automatically set. - """ - pass - - def close(self): - """ - Should be called before desroying the object. - Does remove pugs is existent. - """ - if hasattr(self,unplugout): - self.unplugout() - -class ArrayObjConfigurator(ObjConfigurator): - """ - Base class for general scalar object configuration. - - For usage see demo classes below. - """ - def init_config(self,ident='',parent=None,name='noname',named=False, - **args): - """ - Fore named objects use: - self.add_id_named('name_of_id') - """ - #print 'init_config array',ident,hasattr(self,'init_plugin') - ObjConfigurator.init_config(self,ident,parent,name,**args) - - - - - #else: - #print 'no array plugins for ',self.ident - - #print 'check config'#,self.ident,self._config - self._arrayconfig={} - self._dictconfig={} - self._inds=zeros((0,),int) - self._ids=zeros((0,),int) - self._marrayconfig={} - self._named=named - if self._named: - self._id_names={} - self.config('_name_ids','',struct='dict', - info='Dictionary with id as key and name as value') - else: - self._id_names=None - - # save these attributes, apart from configured ones - self._attrs_save+=[ '_arrayconfig','_dictconfig','_inds','_ids', - '_marrayconfig','_named','_id_names'] - def is_named(self): - """ - Returns true if array has named rows - """ - return self._named - - def get_id_from_name(self,name): - """ - Returns id that corresponds to name. - """ - return self._id_names.get(name,-1) - - def get_name_from_id(self,id): - """ - Returns name that corresponds to id. - """ - return self._name_ids.get(id,'') - - def get_names(self): - """ - Returns list of all named ids. - """ - #print 'get_names',self.ident,self._id_names.keys() - return self._id_names.keys() - - def get_named(self,attr,name): - """ - Returns value corresponding to named id - """ - return self[attr,self.get_id_from_name(name)] - - - def get_ids(self,inds=[],ordered=False): - """ - Return all ids corrisponding to array indexes inds. - Options: - if no inds are given, all ids are returnd - - if ordered is true, ids will be sorted before they are returned. - - """ - if (len(inds)>0)&(not ordered): - return take(self._ids,inds) - - elif len(inds)>0: - ids=take(self._ids,inds) - - else: - ids=self._ids.copy() - if ordered: - return sort(ids) - else: - return ids - - def get_id(self,ind): - """ - Returns scalar id corresponding to index ind - """ - #print 'get_id',ind,self._ids - return self._ids[ind] - - def is_scalarid(self,id): - """ - Returns True if id is a zero positive scalar interger - """ - if is_integer(id): - if id >=0: - return True - else: - return False - else: - return False - - def is_idarray(self,ids): - """ - Fast, formal chack whether ids is either a valid array with ids. - """ - if type(ids) in (types.ListType,ndarray): - # it is an array - if len(ids)>0: - # it contains at least one id - # return True if this id is a zaro positive integer - return self.is_scalar_id(ids[0]) - else: - return False - else: - return False - - def is_ids(self,ids): - """ - Formal check whether ids contains either an array with ids - or is a scalar zero positive interger. - """ - return self.is_idarray(ids) | self.is_scalarid(ids) - - def select_ids(self,mask): - """ - Returns an array of ids, corresponding to the True - of the mask array. - - Usage: - Select all ids for which array of attribute x is greater than zero. - ids=obj.select_ids( obj.x>0 ) - """ - #print 'select_ids',mask,flatnonzero(mask) - #print ' self._ids=',self._ids - - return take(self._ids,flatnonzero(mask)) - - #def select(self,mask,ordered=False): - # """ - # Returns an array of ids, corresponding to the True - # of the mask array. - # - # Usage: - # Get all elements of attribute y for which array of attribute x is greater than zero. - # values=obj.select(obj.y, obj.x>0 ) - # """ - # - # - # return self.get_ids(flatnonzero(mask),ordered=ordered) - - def get_ids_marray(self,attr,inds_marray=[]): - """ - Return all ids and relative indexes corresponding to m-array - indexes in list inds_marray. - - The relative index is the index within the array corresponding - to an id. - - Examples: - obj.get_ids_marray('attrname',[2,3,4]) - - returns an array of the following shape: - [[11,0], - [11,1], - [12,0],] - - here marray index 2 and 3 correspond to id=11 with relative index - 0 and 1 respectively, while marray index 3 corresponds to - element with id=12 and relative index 0 - (means first item in element with id=12) - - """ - #print 'get_ids_marray',inds_marray - if len(inds_marray)>0: - # case more complex because need to check with block pointers - - # get block pointers for this attribute - bp=self._marrayconfig[attr]['bp'] - inds=zeros((len(inds_marray)),int) - - i=0 - for ind_marray in inds_marray: - #print ' bp, ind_marray',bp,ind_marray - inds[i]=flatnonzero( (bp[:,0]<=ind_marray)&(bp[:,1]>ind_marray))[0] - i+=1 - inds_delta=inds_marray-take(bp[:,0],inds) - - ids=take(self._ids,inds) - else: - ids=[] - inds_delta=[] - - return concatenate(( transpose([ids]),transpose([inds_delta])),(1) ) - #return reshape( concatenate((ids, inds_delta)) ,(-1,2) ) - - - def get_inds(self,ids=None): - if ids!=None: - return self._inds[ids] - else: - return self._inds[self._ids] - - def get_ind(self,id): - return self._inds[id] - - - - def get_inds_marray(self,attr,ids): - """ - Returns a flat array with all array indexes of - marray with attribute attr that have an id contained in list ids. - """ - # get block pointers for this attribute - bp=self._marrayconfig[attr]['bp'] - inds=[] - #print 'get_inds_marray: ids=',ids - #print 'get_inds_marray: self._inds= ',self._inds - #print 'get_inds_marray: self._inds[ids,:]= ',self._inds[ids,:] - # Numeric - #for i,j in take(bp, take(self._inds,ids) ): - for i,j in bp[self._inds[ids],:]: - # print ' i,j=',i,j - inds+=range(i,j) - - #print ' inds=', array(inds,int) - return array(inds,int) - - def suggest_id(self,zeroid=False): - """ - Returns a an availlable id. - - Options: - zeroid=True allows id to be zero. - - """ - return self.suggest_ids(1,zeroid)[0] - - def suggest_ids(self,n,zeroid=False): - """ - Returns a list of n availlable ids. - It returns even a list for n=1. - - Options: - zeroid=True allows id to be zero. - """ - #print 'suggest_ids',n,zeroid,self._inds,len(self._inds),self._inds.dtype - ids_unused_orig=flatnonzero(less(self._inds,0)) - - if not zeroid: - if len(self._inds)==0: - ids_unused=zeros(0,int) - else: - # avoid 0 as id: - #ids_unused=take(ids_unused,flatnonzero(greater(ids_unused,0))) - #print ' ids_unused_orig',ids_unused_orig,type(ids_unused_orig) - #print ' len(ids_unused_orig)',len(ids_unused_orig),ids_unused_orig.shape - #print ' greater(ids_unused_orig,0)',greater(ids_unused_orig,0) - #print ' len(greater(ids_unused_orig,0))',len(greater(ids_unused_orig,0)) - #print ' flatnonzero(greater(ids_unused_orig,0))',flatnonzero(greater(ids_unused_orig,0)) - #print ' len(flatnonzero(greater(ids_unused_orig,0)))=',len(flatnonzero(greater(ids_unused_orig,0)) ) - ids_unused=ids_unused_orig[flatnonzero(greater(ids_unused_orig,0))] - zid=1 - else: - if len(self._inds)==0: - ids_unused=zeros(0,int) - else: - ids_unused=ids_unused_orig.copy() - - zid=0 - - n_unused=len(ids_unused) - n_max=len(self._inds)-1 - #print ' ids_unused',ids_unused - #print ' ids_unused.shape',ids_unused.shape - #print ' len(ids_unused)',len(ids_unused) - #print ' n_unused,n_max,zid=',n_unused,n_max,zid - - - - if n_max 0: - if n_unused >= n: - ids=ids_unused[:n] - else: - #print ' ids_unused',ids_unused - #print ' from to',n_max+1,n_max+1+n-n_unused - #print ' arange=',arange(n_max+1,n_max+1+n-n_unused) - #print ' type(ids_unused)',type(ids_unused) - #print ' dtype(ids_unused)',ids_unused.dtype - ids=concatenate((ids_unused,arange(n_max+1,n_max+1+n-n_unused))) - - else: - ids=arange(n_max+1,n_max+1+n) - - return ids #.tolist() - - def add_id_named(self,name,id=-1,**args): - """ - Creates array entries for id with given name. - - """ - if id<0: - id=self.suggest_id() - #self._name_ids[name]=id - #print 'add_id_named',self.ident,name,'with id',id - self.create_ids(id,_name_ids=name,**args) - return id - - def create_ids(self,ids,**args): - """ - Creates for each id in ids list an entry for each attribute with - array or marray structure. - - If ids is a scalar integer, entries will be generated just for - this id. - - For named objects the list _name_ids_ is necessary - with a name correisponding to each id. - """ - #print 'create_ids',ids,args - # this is a short dirty way to allow also scalars for ids and arguments - if type(ids) not in ARRAYTYPES: - # turn scalar ids in list-vector... - ids=[ids] - for key in args.keys(): - args[key]=[args[key]] - - #print ' create_ids',ids,args - - # no ids to create - if len(ids)==0: return True - - n=len(ids) - id_max=max(ids) - id_max_old=len(self._inds)-1 - n_array_old=len(self) - - ids_existing=take( ids,flatnonzero( less(ids,id_max_old) ) ) - #print ' ids',ids,'id_max_old',id_max_old,'ids_existing',ids_existing - - # check here if ids are still available - if sometrue( not_equal( take(self._inds, ids_existing), -1) ): - print 'WARNING in create_ids: some ids already in use',ids_existing - return False - - - - # extend index map with -1 as necessary - if id_max>id_max_old: - #print 'ext',-1*ones(id_max-id_max_old) - self._inds=concatenate((self._inds, -1*ones(id_max-id_max_old,int))) - - # assign n new indexes to new ids - ind_new=arange(n_array_old,n_array_old+n) - - #print 'ind_new',ind_new - put(self._inds,ids,ind_new) - - #print ' concat ids..',self._ids,ids - self._ids=concatenate((self._ids,ids)) - - # if each id is supposed to have a _name_ids - # arguments must provide a list with names for each id - if self._named: - i=0 - names=args['_name_ids'] - for id in ids: - #print ' id,names[i]',id,names[i] - self._id_names[names[i]]=id - i+=1 - - # Extend all arrays with n values from args or default - for attr in self._arrayconfig.keys(): - #print ' attr',attr - if args.has_key(attr): - value=args[attr] - if self._config[attr]['do_init_arrayobj']: - # newly assigned instances need to be array initialized - for i in range(len(ids)): - value[i].init_arrayobj( ids[i],self, - self.make_item_ident(attr,ids[i])) - else: - value=self._get_default(attr,ids=ids) - - #print ' ',attr,'self.__dict__[attr]',self.__dict__[attr],'value',value - if len(self.__dict__[attr])>0: - #print ' concat item..',value - self.__dict__[attr]=concatenate((self.__dict__[attr],value)) - else: - #tc=self._config[attr]['dtype'] - #print ' first item with tc',tc,'and value',value - #print ' ', array(value,dtype=tc)[0] - #self.__dict__[attr]=array(value,dtype=tc) - - #print ' let NumPy, Numeric or whatever guess the first arrayelement' - self.__dict__[attr]=array(value) - - # Extend all marrays with n values from args or default - for attr in self._marrayconfig.keys(): - - # generate a scalar/list of copies of defaults - items=args.get(attr,self._get_default(attr,ids=ids)) - self._append_items_marray(attr,ids,items) - - - - - # assign defaults to all dicts - for attr in self._dictconfig.keys(): - i=0 - for id in ids: - if args.has_key(attr): - value=args[attr][i] - if self._config[attr]['do_init_arrayobj']: - #print 'initialize',attr,value - value.init_arrayobj(id,self,self.make_item_ident(attr,id)) - else: - value=self._get_default(attr,ids=id) - - - #print ' dict attr=',attr,value - self.__dict__[attr][id]=value - - i+=1 - - if self._plugins.has_key(23): - self._execute_plugins(23,ids=ids) - - return True - - - def print_attr(self,attr): - - config=self.get_config(attr) - if config: - - - if config['struct']=='array': - #print ' ', attr,'=' - for id in self.get_ids(): - if config['is_function']: - val=self.__getitem__((attr,id)) - else: - val=self.__getitem__((attr,id)) - - print self.get_string_arrayattr(attr,id,val) - - elif config['struct']=='marray': - #print ' ', attr,'=' - for id in self.get_ids(): - if config['is_function']: - val=self.__getitem__((attr,id)) - else: - val=self.__getitem__((attr,id)) - - print self.get_string_arrayattr(attr,id,val) - - #print ' ',id,self._inds[id],\ - # val,config['unit'] - - - elif config['struct']=='dict': - print ' ', attr,'=' - for id in self.get_ids(): - val=self.__dict__[attr][id] - print self.get_string_arrayattr(attr,id,val) - - #print ' ',id,self._inds[id],\ - # self.__dict__[attr][id],config['unit'] - - else: - ObjConfigurator.print_attr(self,attr) - - def get_string_arrayattr(self,attr,id,value): - """ - Returns a formatted string for array type attributes - with struct array, marray, dict - """ - #print 'get_string_arrayattr',attr,id,value - return ' '+attr+'['+str(id)+'] = '+\ - self.get_string_attr_value(attr,value) - - - - - def reset(self,attr): - """ - Reset attribute attr to default values - """ - # create attribute and if there are already arrays with entries, - # create the same number of entries with default value - #print 'reset',attr,len(self) - default=self._config[attr]['default'] - struct=self._config[attr]['struct'] - #declaredtype=self._config[attr]['type'][0] - - - # configure if objects or instances need init_arrayobj with id - #self._config[attr]['do_init_arrayobj']=False # moved to default - if struct in ('array','marray','dict'): - # try to detect from defaults - if type(default) in [types.InstanceType,types.ClassType]: - if hasattr(default,'init_arrayobj'): - #print ' detected init_arrayobj!!' - self._config[attr]['do_init_arrayobj']=True - - # done in config - #elif type(default) == types.ClassType: - # if not self._config[attr].has_key('init'): - # # by default do not initialize classes - # # i they are nor arrayconfiguratored - # self._config[attr]['init']=False - - # check if instance or class type have been declared - #if self._config[attr]['type'] in ['InstanceType','ClassType']: - # self._config[attr]['do_init_arrayobj']=True - - # do reset now - if struct=='array': - # generate a scalar/list of copies of defaults - defaults=self._get_default(attr,ids=self.get_ids()) - #print 'len:',self.__len__(),len(self) - - # register attribute in array database - self._arrayconfig[attr]={}#currently no particular info, just key - - #print 'reset',attr - - # all this not very clean, but works - default=self._config[attr]['default'] # the array element - if type(default)==ndarray: - # use dtype given by default element which is an array - tc=default.dtype.str - else: - # guess dtype from scalar types - tc=get_dtype(self._config[attr]['type'][-1]) - - self._config[attr]['dtype']=tc - - #print ' tc=',tc,'type[-1]=',self._config[attr]['type'][-1] - # this print causes a strange error: - # 'FloatCanvas' object has no attribute 'this' - - self.__dict__[attr]=array(defaults,dtype=tc) - - #print ' created type',self.__dict__[attr].dtype,self.__dict__[attr].shape - - #self.__dict__[attr]=array(\ - # self._get_default(attr,ids=self.get_ids()), dtype=tc ) - - - - - #print 'new array',self.__dict__[attr] - - elif struct=='marray': - - # register attribute in array database - self._marrayconfig[attr]={'bp':zeros((0,2),int)} - - tc=get_dtype(self._config[attr]['type'][-1]) - self._config[attr]['dtype']=tc - - # create new attribute with empty array - # will be determined with first append - self.__dict__[attr]=zeros((0),dtype=tc) - - - # generate a scalar/list of copies of defaults - ids=self.get_ids() - defaults=self._get_default(attr,ids=ids) - - #print 'dtype',tc,default,'type =',self._config[attr]['type'] - if len(self._inds)>0: - self._append_items_marray(attr,ids,defaults) - - #print 'reset: new marray',self.__dict__[attr] - - elif struct=='dict': - # new attribute is a dictionary - ids=self.get_ids() - defaults=self._get_default(attr,ids=self.get_ids()) - - self._dictconfig[attr]={} # currently no particolar info, just key - self.__dict__[attr]={} - # assign default value for each already existing id - for i in range(len(ids)): - id=ids[i] - self.__dict__[attr][id]=defaults[i] - - #print 'reset: new dict',attr,'=',self.__dict__[attr] - - else: - # handle other (scalar) attribute types with base configurator - ObjConfigurator.reset(self,attr) - - def copy_attrs(self,targetobj,ids=None,targetids=None,attrs=None): - """ - Copies given list of attributes of this object to given target object. - - If no attributes are given then all attributes of this object - are considered for copying. - - To copy an attribute, the foolowing conditions must be satisfied: - - the attribute must be configured with key copy=True - - the attribute must be configured in targetobject - """ - if attrs==None: - # get all attributes - attrs=self._config.keys() - - if ids==None: - # first copy all scalars - ObjConfigurator.copy(targetobj) - ids=self.get_ids() - - - for attr in attrs: - config=self._config[attr] - if config['struct']!='scalar': - if config['copy']: - if targetobj.is_config(attr): - targetobj[attr,targetids]=self[attr,ids] - - def add_items(self,n=0,**args): - """ - Add new items into array structure. - The ids for each newly created item are returned in an array. - Usage: - - Add 3 new items: - ids=obj.add_items(3) - - Add 3 new items and setting attributes: - ids=obj.add_items(x=[11,22,33],v=[66,777,8888]) - - Add a single new item and set values - ids=obj.add_items(x=9,v=999) - - Add a single multi array element composed of 2 scalar integers: - ids=obj.add_items(s=[[111,2222]]) - - """ - - # determine number of items to be assigned - if n==0: - if args: - key=args.keys()[0] - val=args[key] - if type(val) not in ARRAYTYPES: - # turn scalar val in list-vector... - args[key]=[val] - n=1 - else: - n=len(val) - else: - # add by default one item only - n=1 - else: - pass # use n from args - - #print 'base.add_items',n - - # determine new id - ids=self.suggest_ids(n) - - #print ' create new ids',ids - self.create_ids(ids,**args) - - # set values to attributes in arguments -## for attr in args.keys(): -## if attr in self._config.keys(): -## #print attr,' before =' #,self.__dict__[attr] -## if self._config[attr]['struct']=='array': -## #print ' insert in array',args[attr][0] -## #print self._inds,ids,self._inds[ids] -## put(self.__dict__[attr],take(self._inds,ids),args[attr]) -## #print attr,' after =',self.__dict__[attr] -## elif self._config[attr]['struct']=='marray': -## for i in range(n): -## self._insert_item_marray(attr,ids[i],args[attr][i]) -## -## -## elif self._config[attr]['struct']=='dict': -## for i in range(n): -## self.__dict__[attr][ids[i]]=args[attr][i] -## # print ' dict',attr,self.__dict__[attr][ids[i]] -## -## else: -## print 'WARNING in add_items: unknown attribute:',attr - - - - return ids - - def __contains__(self,id): - if (id=0): - return self._inds[id]>-1 - else: - return False - - def contains_name(self,name): - return self._id_names.has_key(name) - - - def __len__(self): - """ - Determine current array length (same for all arrays) - """ - - return len(self._ids) - - - #def get_index(self,ids): - # """ - # returns index array from ids array - # Attetion thyis opration caused a crash during call from __del__ - # """ - # #print 'index',self._inds.dtype,type(ids),array(ids,int).dtype,len(ids) - # - # return self._inds[array(ids,int)] - # #if type(ids) in ARRAYTYPES: - # # #return take(self._inds,ids) - # # return self._inds[array(ids,int)] - # #else: - # # return self._inds[ids] - - - def get_attr_named(self,attr,name): - """ - Returns value of array element of attribute attr - wich corresponds to id the given name. - - """ - if self._id_names.has_key(name): - return self[attr,self._id_names[name]] - else: - return None - - def set_attr_named(self,attr,name,value): - """ - Returns value of array element of attribute attr - wich corresponds to id the given name. - - """ - self[attr,self._id_names[name]]=value - - - def __getitem__(self,key): - #print '__getitem__',key - - if type(key) != types.TupleType: - # return entire contents of attribure for all ids - attr=key - struct=self._config[attr]['struct'] - if struct == 'scalar': - if self._plugins.has_key(2): - self._execute_plugins(2,attr) - - if self._config[attr]['is_function']: - return getattr(self,attr)() - else: - return self.__dict__[attr] - - else: - # attribute is a kind of array - # take all ids in ascending order - ids=self.get_ids(ordered=True) - else: - # argument specify also id or ids to be returned - attr,ids=key - struct=self._config[attr]['struct'] - - - if type(ids) in ARRAYTYPES: - # return array or list corresponding to ids - #print 'get array types',attr,ids,struct - #print ' self._inds=',self._inds - #ids=array(ids,int) - #print ' type (attr),type(ids)',type(self.__dict__[attr]),type(ids) - #print ' ids.dtype 1=',ids.dtype - #ids=array(ids,int) - #print ' ids.dtype 2=',ids.dtype - #print ' self._inds[ids]=',self._inds[ids] - #print ' array(ids,int).dtype=',array(ids,int).dtype - # executes plugins before values are returned to calling instance!! - if self._plugins.has_key(22): - self._execute_plugins(22,attr=attr,ids=ids) - - # this avoids problems with zero dimension arrays, - # (bizzar but possible) - - #if ids.shape==(): ids=array([ids]) - #print ' get array type ids=',ids,struct - - if struct=='array': - if self._config[attr]['is_function']: - #print 'inds=',take(self._inds,ids) - return take(getattr(self,attr)(),take(self._inds,ids)) - else: - #print 'inds=',take(self._inds,ids) - #print take(self.__dict__[attr],take(self._inds,ids)) - #return take(self.__dict__[attr],take(self._inds,ids)) - return self.__dict__[attr][self._inds[array(ids,'i')],:] - - elif struct=='marray': - # here an array is returned with all elements of the - # those blocks that corresponds to the ids - # Note that this is a homogenious array , - # arrays with single blocks can be obtained by passing - # a single array. - if self._config[attr]['is_function']: - return getattr(self,attr)()[self.get_inds_marray(attr,ids),:] - # Numeric: - #return take(getattr(self,attr)(), - # self.get_inds_marray(attr,ids)) - else: - - #print ' inds_marray=',self.get_inds_marray(attr,ids) - #print ' self.__dict__[attr]=\n',self.__dict__[attr] - #print ' return=\n',self.__dict__[attr][self.get_inds_marray(attr,ids),:] - return self.__dict__[attr][self.get_inds_marray(attr,ids),:] - # Numeric: - #return take(self.__dict__[attr], - # self.get_inds_marray(attr,ids)) - - elif struct=='dict': - items=[] - for id in ids: - #print ' ',id,self.__dict__[attr][id] - items.append(self.__dict__[attr][id]) - return items - - # this will never be executed!!!!!!!!!!! - #if self._plugins.has_key(22): - # self._execute_plugins(22,ids=ids) - - else: - #print 'return one array element, ids is a single id' - if self._plugins.has_key(22): - self._execute_plugins(22,attr,ids=array([ids],int)) - - if struct=='array': - #print 'inds=',take(self._inds,[ids]),attr,getattr(self,attr) - - if self._config[attr]['is_function']: - return getattr(self,attr)()[self._inds[ids]] - else: - #try: - return self.__dict__[attr][self._inds[ids]] - #except: - # print 'ERROR in __getitem__', attr,ids - # print ' inds=',self._inds[ids] - # print ' attr=',self.__dict__[attr] - - - elif struct=='marray': - # here an array is returned with all elements of the - # block that corresponds to this id - if self._config[attr]['is_function']: - return getattr(self,attr)()[self.get_inds_marray(attr,[ids])] - # Numeric - #return take(getattr(self,attr)(), - # self.get_inds_marray(attr,[ids])) - else: - #print 'ids=',ids - #print 'self.get_inds_marray(attr,[ids]))=',self.get_inds_marray(attr,[ids]) - return getattr(self,attr)[self.get_inds_marray(attr,[ids])] - # Numeric: - #return take(self.__dict__[attr], - # self.get_inds_marray(attr,[ids])) - - elif struct=='dict': - #print 'attr=',attr,ids - return self.__dict__[attr][ids] - - - - def __setitem__(self,key,value): - """ - Sets a value to an attribute - or to one or several elements of an attribute if - a list with ids is passed. - - Usage: - Scalar assignment - obj['attrname']=0.0 - - Single element asignment - obj['attrname',3]=33 - - Assign 11,22,33 to elements with ids 1,2,3 of attribite attrname - obj['attrname',[1,2,3]]=[11,22,33] - - Assign 3 elements of different size to marray - obj['attrname',[1,2,3]]=[[11,12,13],[21,22],[31]] - Note that the assigned value must be a python list of elements - and not a Numpy array - - """ - - #print 'setitem',key,'to',value - - if type(key) != types.TupleType: - self.__dict__[key]=value - if self._plugins.has_key(1): - self._execute_plugins(1,key) - return - - else: - attr,ids=key - if type(ids) not in ARRAYTYPES: - # ids is a scalar->make a list - ids=array([ids],int) - value=[value] - - struct=self._config[attr]['struct'] - #print 'inds=',self.get_index(ids) - if struct=='array': - shape=self.__dict__[attr].shape - if len(shape)==1: - #print 'put value',value,type(value) - #print ' attr,type(attr)',attr,type(self.__dict__[attr]) - #print ' dtype(attr)',self.__dict__[attr].dtype - #print ' self.get_index(ids)=',self.get_index(ids),type(self.get_index(ids)),self.get_index(ids).dtype - - self.__dict__[attr][self._inds[array(ids,'i')]]=value - #put(self.__dict__[attr],self.get_index(ids),value) - - if self._config[attr]['do_init_arrayobj']: - # newly assigned instances need to be array initialized - for i in range(len(ids)): - value[i].init_arrayobj(ids[i],self, - self.make_item_ident(attr,ids[i])) - - else: - # this is an array of matrix or tensors or higher order - # the array must be flattened and the indexes must be - # calculated accordingly - - #m=product(shape[1:]) - #print 'put marray',m, - #inds=ones( (len(ids),1),int )*arange(m)\ - # +transpose([take(self._inds,ids)])*m - #print inds - - #print 'put value matrix',value,type(value) - #print ' attr,type(attr)',attr,type(self.__dict__[attr]) - #print ' dtype(attr)',self.__dict__[attr].dtype - #print ' inds=\n',self._inds[ids] - - if type(value)!=ndarray: - #print 'value',value - value=array(value,dtype=self._config[attr]['dtype']) - #print 'value',value - - self.__dict__[attr][self._inds[ids],:]=value - # Numeric - #put(self.__dict__[attr],inds.ravel(), value.ravel()) - - - if struct=='marray': - for i in range(len(ids)): - self._insert_item_marray(attr,ids[i],value[i]) - - elif struct=='dict': - for i in range(len(ids)): - self.__dict__[attr][ids[i]]=value[i] - if self._config[attr]['do_init_arrayobj']: - # newly assigned instances need to be array initialized - #self.print_config() - value.init_arrayobj(id,self,self.make_item_ident(attr,id)) - #self.print_config() - - #print 'set_item:check plugins...',self.ident,self._plugins.keys() - if self._plugins.has_key(21): - self._execute_plugins(21,attr=attr,ids=ids) - - return - - def del_item_named(self,name): - """ - Deletes id with given name from all attributes - """ - del self[self._id_names[name]] - - def __delitem__(self,key): - # print 'ArrayObjConfigurator.__delitem__',self.ident,'key=',key - if key in self._config.keys(): - # delete attribute and its configuration - if self._plugins.has_key(0): - self._execute_plugins(0,key) - - if self._config[key]['struct']=='array': - del self._arrayconfig[key] - elif self._config[key]['struct']=='dict': - del self._dictconfig[key][id] - elif self._config[key]['is_function']: - self._functions.remove(key) - - for groupname in self._config[key]['group']: - self._groups[groupname].remove(key) - - del self._config[key] - del self.__dict__[key] - - - - else: - # key is one or multiple ids to be deleted from arrays - if type(key) not in ARRAYTYPES: - # ids is a scalar->make a list - ids=[key] - else: - ids=key - - # TODO: here it is not verified whether ids exist - # => verify and delete element by element - - # plugin execution BEFORE entry is deleted - if self._plugins.has_key(20): - self._execute_plugins(20,ids=ids) - - self._del_ids(ids) - - ############################################################################ - # private methods - - - def _append_items_marray(self,attr,ids,items): - """ - Appends a list of items to multiary with attribute attr. - The block pointers are created automatically but - the indexes and ids must already exist in self._inds - - ids cannot be empty! - """ - #print 'append_items_marray',attr - #print ' ids=',ids - #print ' items=',items - marray=self.__dict__[attr] - #print 'marray=\n',marray - bp=self._marrayconfig[attr]['bp'] - len_bp=len(bp) - - # make sure that the bp vecor has enough index - - ind_max=max(self._inds) - - bpext=-1*ones( (ind_max-len_bp+1,2) ,int) - - if len_bp==0: - bp=bpext - else: - bp=concatenate( ( bp, bpext) ) - #print ' after extension bp=',bp - - # set block pointers for each id according to length of each item - i=len(marray) - n_elems=0 # gives the total number of elements inside all items - for ii in range(len(ids)): - id=ids[ii] - ind=self._inds[id] - - # assume that id corresponds to a list with at least one item - # thus, calculate new block pointers - n=len(items[ii]) - j=i+n - n_elems+=n - #print ' id,ind,i,j,len(items[ii])=',id,ind,i,j,len(items[ii]) - - bp[ind]=[i,j] - - i=j - - #print ' after asssignment bp=',bp - self._marrayconfig[attr]['bp']=bp - - # put items in an array with coherent dimentions - shape_elem=array(items[0],int).shape[1:] - shape_array=[n_elems]+list(shape_elem) - #print ' shape_elem=',shape_elem - #print ' shape_array=',shape_array - # extend current marray by the corrct number of new elements - marrayext=zeros(shape_array,dtype=self._config[attr]['dtype']) - if len(marray)>0: - #print ' concat extention to marray=\n',marrayext - marray=concatenate((marray,marrayext)) - else: - #print ' first marray_extension=\n',marrayext - marray=marrayext - - # now copy items into array is faster than concatenating each item - for ii in range(len(ids)): - id=ids[ii] - ind=self._inds[id] - i,j=bp[ind] - #print ' add item items[ii]',items[ii] - marray[i:j]=items[ii] - - - self.__dict__[attr]=marray - - - - - def _insert_item_marray(self,attr,id,item): - #print 'insert_item_marray',attr,id,item - #print ' attr=', self.__dict__[attr] - - # get block pointers for this attribute - bp=self._marrayconfig[attr]['bp'] - - # index of block pointers - ind=self._inds[id] - - # get from to index of m array for this id - [i,j]=bp[ind] - - # decide whether to overwrite existing - if j-i!=len(item): - # first cut current data out of marray and adjust - # block pointers - self._del_item_marray(attr,id) - - # append data - self._append_items_marray(attr,[id],[item]) - else: - self.__dict__[attr][i:j]=item - - #print ' attr=', self.__dict__[attr] - - - - - - def _del_item_marray(self,attr,id): - - - # get block pointers for this attribute - bp=self._marrayconfig[attr]['bp'] - - # index of block pointers - ind=self._inds[id] - - # get from to index of m array for this id - [i,j]=bp[ind] - - #print 'del_item_marray',attr,id,'from',i,'to',j - - # cut this piece out of the marray - #print ' before:',self.__dict__[attr] - self.__dict__[attr]=concatenate(\ - (self.__dict__[attr][:i], self.__dict__[attr][j:])) - - #print ' after:',self.__dict__[attr] - - # indicate that block pointer does no more point to anywhere - # calling method must take care of eliminating it or not - bp[ind]=[-1,-1] - # cut out index from blockpointers - #bp=concatenate( (bp[:ind], bp[ind+1:]) ) - - # now subtract j-i from all "to" index higher equal than j - subtract(bp, (j-i)*(bp >= j) , bp) - - self._marrayconfig[attr]['bp']=bp - - #def _get_bp_marray(self,attr): - # """May be useful, just not used """ - # return self._marrayconfig[attr]['bp'] - - - def make_item_ident(self,attr,id): - """ - Generates the ident of attribute attr withy id. - """ - return self.ident+IDENTSEP+attr+IDENTSEP+str(id) - - def get_groupattrs(self,name,id=-1): - """ - Returns a dictionary with all attributes of a group. - Key is attribute name and value is attribute value for the given id. - """ - #print 'get_groupattrs of',name,'from',self.ident,self._groups.keys() - #print ' id=',id - attrs={} - - if (name in self._groups.keys()) & self.is_ids(id): - for attr in self._groups[name]: - #attrs[attr]=self['attr'] - struct=self._config[attr]['struct'] - if (struct in ('dict','array','marray')): - default=self[attr,id] - # if default is an initialized class or an instance - # and has also a dict or array structure, - # then try to configure array object with id - - if type(default)==types.InstanceType: - # default is instance so just make a copy - obj = copy(default) - # now configure array object - # in this case class must have ArrayObj capabilities (mixin) - #if self._config[attr]['do_init_arrayobj']: - # obj.init_arrayobj(id,self,self.make_item_ident(attr,id)) - - elif (type(default)==types.ClassType) & \ - self._config[attr]['do_init_arrayobj']: - # default is a class that needs to be initialized first - obj = copy(default) - #obj.init_arrayobj(id,self,self.make_item_ident(attr,id)) - - - elif type(default)==types.FunctionType: - # use base function to get other default types - obj=default - - else: - # use base function to get other default types - obj=copy(default) - - else: - # use base function to get other default types - obj=self.__dict__[attr] #attr() copy(default) - - attrs[attr]=obj - #else: - # print ' no attr found',self._groups.keys() - #print ' attrs=',attrs - return attrs - - def _get_default(self,attr,n=1,ids=None): - """ - Returns n default values for attribute with name attr_name - By default a scalar is returned. - If n>1 a list with n defaults is returned. - - Usage: - Return a scalar default - self._get_default('attr_name') - - Return list with 5 defaults - self._get_default('attr_name',5) - - Return list with 5 defaults, assigned with ids=[1,2,3,4,5]. - This usage makes only sense with Classes or instances - with ArrayObj mixin. - self._get_default('attr_name',ids=[1,2,3,4,5]) - - """ - #print '_get_default',self.ident,attr - - default=self._config[attr]['default'] - struct=self._config[attr]['struct'] - defaults=[] - - if ids==None: - # create dummy ids - ids=range(n) - returnlist=False - - elif type(ids) not in ARRAYTYPES: - ids=[ids] # just a single id, do return a simple value, not a list - returnlist=False - else: - returnlist=True - - for id in ids: - if struct in ('dict','array','marray'): - # if default is an initialized class or an instance - # and has also a dict or array structure, - # then try to configure array object with id - - if type(default)==types.InstanceType: - # default is instance so just make a copy - obj = copy(default) - # now configure array object - # in this case class must have ArrayObj capabilities (mixin) - if self._config[attr]['do_init_arrayobj']: - obj.init_arrayobj(id,self,self.make_item_ident(attr,id)) - - elif (type(default)==types.ClassType) & \ - self._config[attr]['do_init_arrayobj']: - # default is a class that needs to be initialized first - obj = default() - obj.init_arrayobj(id,self,self.make_item_ident(attr,id)) - - - elif type(default)==types.FunctionType: - # use base function to get other default types - obj=default - - else: - # use base function to get other default types - obj=copy(default) - - else: - # use base function to get other default types - obj=ObjConfigurator._get_default(self,attr) - - - # append to default list - defaults.append(obj) - - - #print '_get_default array',defaults - if (n>1) | returnlist: - - return defaults - else: - return defaults[0] - - - def _del_ids(self,ids): - """ - Deletes id from all array - tpe attributes - """ - - #print 'ArrayConfigurator._del_ids',ids,'from',self.ident - - - # delete ids from list , one by one - for id in ids: - #print ' start deleting id',id - - #print ' self._ids',self._ids - #print ' self._inds',self._inds - - #i=self.get_index(id) - i=self._inds[id] - - #print ' ind=',i - #print ' del rows from array-types...' - for attr in self._arrayconfig.keys(): - #print ' del',attr,id,i - - - #print ' before=\n',self.__dict__[attr] - self.__dict__[attr]=concatenate(\ - (self.__dict__[attr][:i], self.__dict__[attr][i+1:])) - #print ' after=\n',self.__dict__[attr] - - #print ' del from id lookup' - self._ids=concatenate((self._ids[:i],self._ids[i+1:])) - - #print ' del from dicts' - for attr in self._dictconfig.keys(): - #print ' del',attr,id - del self.__dict__[attr][id] - - #print ' del from marrays' - for attr in self._marrayconfig.keys(): - self._del_item_marray(attr,id) - - # what's left is to cut out the db pointer with index i - bp=self._marrayconfig[attr]['bp'] - - #print ' del',attr,id,bp - - bp=concatenate((bp[:i], bp[i+1:])) - self._marrayconfig[attr]['bp']=bp - - #print ' free index',id - if id == len(self._inds)-1: - # id is highest, let's shrink index array by 1 - self._inds=self._inds[:-1] - else: - self._inds[id]=-1 - - # get ids of all indexes which are above i - ids_above=flatnonzero(self._inds>i) - - # decrease index from those wich are above the deleted one - #put(self._inds, ids_above,take(self._inds,ids_above)-1) - self._inds[ids_above]-=1 - - #print ' self._inds',self._inds - - if self._named: - #print ' Remove named' - for id in ids: - name=self._name_ids[id] - del self._id_names[name] - #print ' removed',name,id - - - #print ' del',ids,' done.' - - def __setstate__test(self,state): - """ - This is setstate for array config only - and overrides the scalar version. - - The main purpose is to correct a conversion error in numpy - """ - print '__setstate__',self - - # this is alays required, but ill not be saved - self._plugins={} - - for key in state.keys(): - value=state[key] - - #print ' set state',key - #print ' attr',key,type(value), - #if type(value)==ndarray: - # print value.dtype,value.shape - #else: - # print value - - if type(value)==ndarray: - if value.dtype==dtype('|O4'): - value=array(value,' -1]) - - return ids_items - - - def remove_items(self, ids_item, ids_queue = None): - """ - Remove integers in array ids_item from queues in array ids_queue - If no ids_queue is given, it will be recovered from the integer items - database. This may only be a disadvantage in terms of time. - """ - #print 'remove_items' - #print ' ids_item',ids_item - #print ' ids_queue',ids_queue - - if ids_queue == None: - ids_queue = self.items['ids_queue', ids_item] - - inds_queue = self.get_inds(ids_queue) - inds_item = self.items.get_inds(ids_item) - - # identify single - inds_single = (self.ids_last[inds_queue] == ids_item) & \ - (self.ids_first[inds_queue] == ids_item) - - if any(inds_single): - # remove single item in queues - inds_queue_single = inds_queue[inds_single] - self.ids_last[inds_queue_single] = -1 - self.ids_first[inds_queue_single] = -1 - - - # identify last - inds_last = (self.ids_last[inds_queue] == ids_item) &\ - logical_not(inds_single) - - - if any(inds_last): - # remove last items in queues - inds_queue_last = inds_queue[inds_last] - inds_item_last = inds_item[inds_last] - - ids_item_new_last = self.items.ids_prev[inds_item_last] - self.items['ids_next', ids_item_new_last] = -1 - self.ids_last[inds_queue_last] = ids_item_new_last - - # identify first - inds_first = (self.ids_first[inds_queue] == ids_item) &\ - logical_not(inds_single) - - - if any(inds_first): - # remove first items in queues - inds_queue_first = inds_queue[inds_first] - inds_item_first = inds_item[inds_first] - - ids_item_new_first = self.items.ids_next[inds_item_first] - self.items['ids_prev', ids_item_new_first] = -1 - self.ids_first[inds_queue_first] = ids_item_new_first - - # identify middle - inds_middle = logical_not(inds_single) &\ - logical_not(inds_last) & logical_not(inds_first) - - - if any(inds_middle): - # remove first items in queues - inds_queue_middle = inds_queue[inds_middle] - inds_item_middle = inds_item[inds_middle] - - # cutting items out of chains - ids_item_new_next = self.items.ids_next[inds_item_middle] - ids_item_new_prev = self.items.ids_prev[inds_item_middle] - - self.items['ids_next', ids_item_new_prev] = ids_item_new_next - self.items['ids_prev', ids_item_new_next] = ids_item_new_prev - - - # finally remove pointer from items to queues - self.items.ids_queue[inds_item] = -1 - self.items.ids_next[inds_item] = -1 - self.items.ids_prev[inds_item] = -1 - - - - def insert_items_behind(self, ids_item, ids_item_beh, ids_queue): - """ - Insert integers in array ids_item into queues in array ids_queue - behind integers in array ids_item_beh - """ - #print 'insert_items_beh' - #print ' ids_item',ids_item - #print ' ids_queue',ids_queue - #print ' ids_item_beh',ids_item_beh - - # identify prepend - inds_prepend = ids_item_beh == -1 - if any(inds_prepend): - self.prepend_items( ids_item[inds_prepend], - ids_queue[inds_prepend]) - - # identify append - inds_append = (self['ids_last',ids_queue] == ids_item_beh) \ - & logical_not(inds_prepend) - if any(inds_append): - self.append_items( ids_item[inds_append], - ids_queue[inds_append]) - - - - # select rest - inds = logical_not(inds_prepend) & logical_not(inds_append) - - if any(inds): - # insert items where insertion somewhere in the middle - # of the buffer where first and last item is not effected - - # this task can therefore be handeled by item instance - self.items.insert_items_behind( ids_item[inds], - ids_item_beh[inds], - ids_queue[inds], - ) - - - def append_items(self, ids_item, ids_queue): - """ - Append integers in array ids_items to queues in array ids_queue - """ - #print 'append_items' - #print ' ids_item',ids_item - #print ' ids_queue',ids_queue - - # different treatmet of empty and not empty queues - inds_empty = self.is_empty(ids_queue) - inds_not_empty = logical_not(inds_empty) - - # treat first empty queues - if len(inds_empty)>0: - # print ' inds_empty',inds_empty - self['ids_first',ids_queue[inds_empty]] = ids_item[inds_empty] - self['ids_last',ids_queue[inds_empty]] = ids_item[inds_empty] - - - if any(inds_not_empty): - - # treat queues with at least one item - ids_not_empty = ids_queue[inds_not_empty] - ids_item_not_empty = ids_item[inds_not_empty] - - # fix new first and last item - ids_item_prev = self['ids_last',ids_not_empty] - self['ids_last',ids_not_empty] = ids_item_not_empty - - # backward chaining - self.items['ids_prev',ids_item_not_empty] = ids_item_prev - - # forward chaining - self.items['ids_next',ids_item_prev] = ids_item_not_empty - - # assign queue id - self.items['ids_queue',ids_item] = ids_queue - - def prepend_items(self, ids_item, ids_queue): - """ - Prepend integers in array ids_items to queues in array ids_queue - """ - #print 'prepend_items' - #print ' ids_item',ids_item - #print ' ids_queue',ids_queue - - # different treatmet of empty and not empty queues - inds_empty = self.is_empty(ids_queue) - inds_not_empty = logical_not(inds_empty) - - # treat first empty queues - if len(inds_empty)>0: - # print ' inds_empty',inds_empty - self['ids_first',ids_queue[inds_empty]] = ids_item[inds_empty] - self['ids_last',ids_queue[inds_empty]] = ids_item[inds_empty] - - - if any(inds_not_empty): - - # treat queues with at least one item - ids_not_empty = ids_queue[inds_not_empty] - ids_item_not_empty = ids_item[inds_not_empty] - - # fix new first and last item - ids_item_next = self['ids_first',ids_not_empty] - self['ids_first',ids_not_empty] = ids_item_not_empty - #self['ids_last',ids_not_empty] = ids_items_next # not changed - - # forward chaining - self.items['ids_next',ids_item_not_empty] = ids_item_next - - # backward chaining - self.items['ids_prev',ids_item_next] = ids_item_not_empty - - # assign queue id - self.items['ids_queue',ids_item] = ids_queue - - def print_info(self): - """ - Print all usueful info - """ - self.print_config() - self.items.print_config() - - -class IntegerItems(ArrayObjConfigurator): - """ - Class cotaining integer items (the ids) of the integer queue. - - This class can be used as mixin in order to add customized attributes to - each item. - - """ - - def __init__( self, parent, key='items', name='Integer items'): - """ - Main init used for stand alone. - """ - self.init_config(key,parent,name) - - self._init_items() - - def _init_items(self): - """ - Here the item specific states are initialized. - - queue_data is an optional database with additional information - on the queues where each id correspnds to a queue - - """ - - self.config('ids_queue',-1, - name='queue id', - info='ID of queue', - metatype = 'id', - ident_ref = self.parent.ident, - struct='array', - ) - - self.config('ids_next',-1, - name='next id', - info='ID of next', - metatype = 'id', - ident_ref='.', - struct='array', - ) - - self.config('ids_prev',-1, - name='previous id', - info='ID of previous', - metatype = 'id', - ident_ref='.', - struct='array', - ) - - - def insert_items_behind(self, ids_item, ids_item_beh, ids_queue): - """ - UNUSED!! see integerqueue!! - - Insert integers in array ids_item into queues in array ids_queue - behind integers in array ids_item_beh. - - Please use insert_behind of the governing queue class! - - Attention this method is called by insert_behind of the - governing queue class, which selected already the cases where - this insertion is in the middle of the queue and does not effect - first or last item. - """ - #print 'IntegerItems.insert_items_beh' - #print ' ids_item',ids_item - #print ' ids_queue',ids_queue - #print ' ids_item_beh',ids_item_beh - - inds_item = self.get_inds(ids_item) - inds_item_beh = self.get_inds(ids_item_beh) - - # forward chaining - ids_item_next = self.ids_next[inds_item_beh] - self.ids_next[inds_item] = ids_item_next - self.ids_next[inds_item_beh] = ids_item - - # backward chaining - self.ids_prev[inds_item] = ids_item_beh - self['ids_prev', ids_item_next] = ids_item - - # assign queue id to inserted elements - self.ids_queue[inds_item] = ids_queue - - - - - -class MetaList(ArrayObjConfigurator): - """ - Empty class with ArrayObjConfigurator properties. - Can be freely configured to contain any kind of database like, - ordered list structures. - - Usage: - l=MetaList() - l.config('m',0.0,struct='marray') - l.create_ids([1,2,3,4]) - l.print_config() - """ - def __init__(self,**args): - self.init_config('metalist') - - -class TestNamed(ArrayObjConfigurator): - def __init__(self,**args): - self.init_config('test',named=True) - self.config('s',zeros((0,),float),struct='marray', - type=[ 'IntType']) - - self.config('v',0,struct='array') - self.add_id_named('one') - self.add_id_named('two') - - - -class TestMod(ObjConfigurator,ArrayObj): - """ - test - """ - - def __init__(self,**args): - """ - Mod specific Initialization. - self.id an parent is yet unknown - """ - pass - #print 'initialized TestMod' - - def config_with_id(self): - """ - Mod specific Initialization. - Now id and parent is known. - """ - self.init_config() - #print 'config_with_id',self.ident - self.config('y',0.0,group=['state'],perm='w',digits_fraction=2) - self.config('z','text',group=['state'],perm='w') - self.config('cabins',Cabs(self)) - #self.print_config() - -class Car(ArrayObj): - """ - test - """ - - def __init__(self,**args): - """ - Mod specific Initialization. - self.id an parent is yet unknown - """ - print 'initialized CarMod' - - def config_with_id(self): - """ - Mod specific Initialization. - Now id and parent is known. - """ - pass - - -class CarTest(ArrayObjConfigurator): - """ - test - """ - - def __init__(self,**args): - """Variable - """ - self.init_config('carstest') - self.config('a',0.0, struct='array', group=['state','costs'],unit='m/s^2') - #self.config('mods',TestMod,struct='dict') - #self.config('m',[0.0, 0.0, 0.0],struct='array') - self.config('g',zeros((3,4)),struct='array',unit='earth accel') - newids=self.suggest_ids(3) - self.create_ids(newids) - -class Cars(ArrayObjConfigurator): - """ - test - """ - - def __init__(self,**args): - """Variable - """ - self.init_config('cars') - self.config('x',0.456685,group=['state'],perm='w',digits_fraction=2) - - self.config('color',[0.2,0.8,0.2],metatype='color', struct='array',group=['parameter'],perm='w') - self.config('load','user',struct='dict',perm='r') - self.config('n',0, struct='array', info='number',perm='w', - group=['state','parameters'], - min=0,max=5) - self.config('b',False, struct='array', perm='w',info='bool...',group=['state','costs']) - self.config('a',0.0, struct='array', info='acceleration',group=['state','costs'],digits_fraction=2) - self.config('v',0.0, struct='array', info='velocity', group=['state'],unit='m/s',digits_fraction=2) - self.config('d',0.0,unit='m', struct='array', info='this is \nthe distance',digits_fraction=2) - self.config('j',0.0,struct='array',perm='r',digits_fraction=2) - self.add_items(v=[8.7,5.5,34.1,2],a=[-8,-5,-34,-2]) - - self.config('mods',TestMod,struct='dict') - self.config('m',[0.0, 0.0, 0.0],struct='array') - self.config('g',zeros((3,4)),struct='array') - self.config('coords',array([0.0,0.0,0.0],float), - #type=['FloatType'], - struct='array', - name='coordinates', - info='Array with xyz coordinates of each node') - newids=self.suggest_ids(3) - self.create_ids(newids,v=[5,6,7]) - #print 'config=\n',self.get_config() - - -class ObjConfiguratorTest(ObjConfigurator): - """ - test - """ - - def __init__(self,parent=None,**args): - """Variable - """ - self.init_config('ObjConfiguratorTest',parent) - self.config('d',[[1,2]],type=[('ArrayType', (1, 2)), 'IntType']) - - -class Cabs(ArrayObjConfigurator): - """ - test - """ - - def __init__(self,parent=None,**args): - """Variable - """ - self.init_config('cabs',parent) - self.config('d',[[1,2]],type=[('ArrayType', (1, 2)), 'IntType'],struct='dict') - self.create_ids([1,2,3,4]) - self.config('a',0.0, struct='array', group=['state','costs'],unit='m/s^2') - self.config('n',-1, struct='array') - self.config('g',zeros((3,4)),struct='array',perm='r') - #self.config('v',0.0, struct='array', group=['state']) - #self.config('d',0.0,unit='m') - #self.config('j',0.0,struct='array') - #self.add_items(v=[8.7,5.5,34.1,2],a=[-8,-5,-34,-2]) - #self.config('coords',array([0.0,0.0,0.0]), - # struct='array', - # name='coordinates', - # info='Array with xyz coordinates of each node') - - -class MarrayTest(ArrayObjConfigurator): - """ - test - from base import *;t=MarrayTest();t['s',1]=[11,22,33,44];t['s',3]=[-33,-44] - t.get_ids_marray('s',[1,]) - t['s',2]=[22,222,2222,22222] - t['s',[1,2]]=[[3,33,333],[55,555,5555,5555]] - t.get_ids_marray('s',[1,2,3]) - t.get_ids_marray('s',[1,]) - - """ - def __init__(self,**args): - self.init_config('test') - self.config('s',zeros((0,)),struct='marray', - type=[ 'IntType']) - - self.config('v',0,struct='array') - - self.config('x',[[-1,-1]], - name='forward star', - info='Dict with node id as key and forward nodes as values', - doc='A dictionary with node id as key and \n'+\ - 'a dictionary with follower nodes as value. \n'+\ - 'Each follower node is a dictionary with \n'+\ - 'predecessor node id as key and arc id as value', - type=[('ArrayType', (1, 2)), 'IntType'], - struct='marray', - ) - - self.config('f',zeros((0,),dtype='i'), - name='forward nodes', - info='Dict with node id as key and forward nodes as values', - doc='A dictionary with node id as key and \n'+\ - 'a dictionary with follower nodes as value. \n'+\ - 'Each follower node is a dictionary with \n'+\ - 'predecessor node id as key and arc id as value', - type=[('ArrayType', (1,)), 'IntType'], - struct='marray', - ) - - self.config('m',[[0.0, 0.0, 0.0],[10.0, 10.0, 0.0]],struct='marray') - self.create_ids([1,2,3,4]) - #self.config('s',[-1],struct='marray') - self.print_config() - -def test_queue(): - q = IntegerQueues(None) - q.create_ids([1,2,3,4]) - q.add_items(arange(0,20,2,int)) - - q.print_info() - - #q.prepend_items(array([2,1],int),array([4,3],int)) - #q.prepend_items(array([2,],int),array([3,],int)) - q.insert_items_behind(array([2,],int), array([-1,],int), array([2,],int)) - - q.print_info() - - q.insert_items_behind(array([16,],int), array([2,],int), array([2,],int)) - - q.print_info() - - - - q.prepend_items(array([4,8],int),array([3,2],int)) - - q.print_info() - - q.append_items(array([6,],int),array([1,],int)) - - q.print_info() - - q.append_items(array([10,12],int),array([1,3],int)) - - q.print_info() - - q.insert_items_behind(array([18,],int), array([2,],int), array([2,],int)) - - q.print_info() - - q.remove_items(array([18,],int)) - - q.print_info() - - q.remove_items(array([16,],int)) - - q.print_info() - - q.remove_items(array([8,],int)) - - q.print_info() - - q.remove_items(array([2,],int)) - - q.print_info() - - print '\npop all',q.pop_items(q.get_ids()) - print '\npop all',q.pop_items(q.get_ids()) - print '\npop all',q.pop_items(q.get_ids()) - -############################################################################### -if __name__ == '__main__': - """ - Test - """ - - - test_queue() - - exit(0) - - #a=array([[1,2,3],[4,5,6],[7,8,9],[11,22,33]]) - #b=array([[1,0,1],[1,1,1],[1,0,0],[0,0,0]]) - - # cd C:\Documents and Settings\joerg\Documenti\projects\its - #import sys; sys.path[:0] = ['C:\Users\joerg\projects\sim\its'] - #from lib.base import * - cabs=Cabs() - cabs.print_config() - - #t=MarrayTest();t['s',1]=[11,22,33,44];t['s',3]=[-33,-44] - #t.get_ids_marray('s',[1,]) - #t['s',2]=[22,222,2222,22222] - #t['s',[1,2]]=[[3,33,333],[55,555,5555,5555]] - #t.get_ids_marray('s',[1,2,3]) - #t.get_ids_marray('s',[1,]) - - t=ObjConfiguratorTest(); - t.print_config() - - save_obj (t,'test.txt') - t=load_obj('test.txt') - - \ No newline at end of file +""" +This package contains the base classes of al relevant classes. + +TODO: Following issues must be resolved in the following version + +- child - parent - ident - named + childs of named parents should have the name in the ident...and local ident + create 2 ident entries for arrayobj: attr+id + use a list for ident elements instead of a string wityh string conversion + on the fly or permanently. + May be of advantaqge (= fast) to store instances that are on the path of the + ident elements + + in particular: distiguish between an instance on the tree that is created with parent + and an already initialized instance that is set and usd as a link. + idea in this case get all confuguration info from instance itself + or better link to it! +- ident should be a sequence or list of strings +- separate classes for array type objects +- classes for metatypes +- try to reduce type recognition during init ?? +- MIXIN for named operation just as for plugin +- make plugin faster by overwriting get/set attribute +- print attribute must also go in classes + + +- make common initialization priciples in particular for classes based on mixins + who sets the name: the parent! name is option with default +- simplify configurationwith key setting...should appear only once + try to catch it from within the object with __name__ +- try to remove stored type identification...careful problems are nd scalars + +""" +from numpy import * +# from numpy.oldnumeric.user_array import numpy.oldnumeric.user_array as +# UserArray +from copy import copy, deepcopy + +from sys import exit +import types +import string +import pickle +#import networkx as nx + +try: + flatnonzero +except: + def flatnonzero(x): + return nonzero(x.ravel()) + +CONFIG_TEMPLATE = { + 'info': '', + 'doc': '', + 'metatype': '', + 'type': '', + 'group': [], + 'save': True, + 'copy': False, + 'struct': 'scalar', + 'perm': 'w', + 'unit': '', + 'do_init_arrayobj': False, +} + +ARRAYTYPES = [types.TupleType, ndarray, types.ListType, types.XRangeType] + +TYPES = { + 'BooleanType': {'dtype': '?', 'perm': 'w', }, + 'BufferType': {'dtype': 'O', 'perm': 'r', }, + 'BuiltinFunctionType': {'dtype': 'O', 'perm': 'r', }, + 'BuiltinMethodType': {'dtype': 'O', 'perm': 'r', }, + 'ClassType': {'dtype': 'O', 'perm': 'r', }, + 'CodeType': {'dtype': 'O', 'perm': 'r', }, + 'ComplexType': {'dtype': 'D', 'perm': 'w', }, + 'DictProxyType': {'dtype': 'O', 'perm': 'r', }, + 'DictType': {'dtype': 'O', 'perm': 'r', }, + 'DictionaryType': {'dtype': 'O', 'perm': 'r', }, + 'EllipsisType': {'dtype': 'O', 'perm': 'r', }, + 'FileType': {'dtype': 'O', 'perm': 'w', }, + 'FloatType': {'dtype': 'd', 'perm': 'w', }, + 'FrameType': {'dtype': 'O', 'perm': 'r', }, + 'FunctionType': {'dtype': 'O', 'perm': 'r', }, + 'GeneratorType': {'dtype': 'O', 'perm': 'r', }, + 'InstanceType': {'dtype': 'O', 'perm': 'r', }, + 'IntType': {'dtype': 'i', 'perm': 'w', }, + 'LambdaType': {'dtype': 'O', 'perm': 'r', }, + 'ListType': {'dtype': 'O', 'perm': 'r', }, + 'LongType': {'dtype': 'g', 'perm': 'w', }, + 'MethodType': {'dtype': 'O', 'perm': 'r', }, + 'ModuleType': {'dtype': 'O', 'perm': 'r', }, + 'NoneType': {'dtype': 'O', 'perm': 'r', }, + 'NotImplementedType': {'dtype': 'O', 'perm': 'r', }, + 'ObjectType': {'dtype': 'O', 'perm': 'r', }, + 'SliceType': {'dtype': 'O', 'perm': 'r', }, + 'StringType': {'dtype': 'S', 'perm': 'w', }, + 'StringTypes': {'dtype': 'O', 'perm': 'w', }, + 'TracebackType': {'dtype': 'O', 'perm': 'r', }, + 'TupleType': {'dtype': 'O', 'perm': 'r', }, + 'TypeType': {'dtype': 'O', 'perm': 'r', }, + 'UnboundMethodType': {'dtype': 'O', 'perm': 'r', }, + 'UnicodeType': {'dtype': 'U', 'perm': 'w', }, + 'XRangeType': {'dtype': 'O', 'perm': 'r', }, + '__builtins__': {'dtype': 'O', 'perm': 'r', }, + '__doc__': {'dtype': 'O', 'perm': 'r', }, + '__file__': {'dtype': 'O', 'perm': 'r', }, + '__name__': {'dtype': 'O', 'perm': 'r', }, +} + +IDENTSEP = '.' + + +def make_arrays(**attrs): + """ + Makes an array of same type from all attributes in attrs dictionary + A bit slow! Avoid using this function! + """ + for attr in attrs.keys(): + obj = attrs[attr] + if type(attrs[attr]) == ndarray: + attrs[attr] = attrs[attr].reshape((1,) + obj.shape) + elif type(obj) in (types.FloatType, types.LongType): + attrs[attr] = array([obj], float) + elif type(obj) == types.IntType: + attrs[attr] = array([obj], int) + elif type(obj) == types.BooleanType: + attrs[attr] = array([obj], bool) + else: + # another strange type + dt = 'O' + for typename in dir(types): + if type(obj) == types.__dict__[typename]: + dt = get_dtype(typename) + break + attrs[attr] = array([obj], dtype=dt) + return attrs + + +def is_integer(n): + """ + Returns True if n is an integer type of any kind + """ + return type(n) in (types.IntType, int32, int64, int0, int16, int8, types.LongType) + + +def get_type(obj, typelist=[]): + """ + Returns a flat list of type-string(s) which correspond to the + (nested) type(s) of the object obj. + + The returned type(s) are keys of the global TYPES dictionary. + """ + + typelist = copy(typelist) + if type(obj) == ndarray: + typelist.append(('ArrayType', obj.shape)) + # return typelist # let's assume homogenious array types + if len(obj.ravel()) > 0: + return get_type(obj.flat[0], typelist) + else: + return typelist + + elif hasattr(obj, 'dtype'): # obj is an array element + # attention this is not a string but maybe this should + # also be changed for all other types + typelist.append(obj.dtype.str) + return typelist + + elif type(obj) in (types.ListType, types.TupleType): + typelist.append('ListType') + if obj: + return get_type(obj[0], typelist) + else: + return typelist + + elif type(obj) in (types.DictType, types.DictionaryType): + + if obj: + key = obj.keys()[0] + keytype = get_type(key) + if len(keytype) > 0: + typelist.append(('DictType', keytype[0])) + else: + typelist.append(('DictType', '')) + + return get_type(obj[key], typelist) + else: + typelist.append(('DictType', '')) + return typelist + + else: + for typename in dir(types): + if type(obj) == types.__dict__[typename]: + typelist.append(typename) + return typelist + break + typelist.append('') + return typelist + + +def get_dtype(type): + """ + Returns dtype as used in Nummeric package. + The argument is a string defining the python objecy type + and is a key of the TYPES dictionary. + If type is not found in the dictionary, dtype 'O' is + returned, which means a generic object. + """ + if TYPES.has_key(type): + return TYPES[type]['dtype'] + else: + return 'O' + + +def save_obj(obj, filename): + """ + Saves python object to a file with filename. + Filename may also include absolute or relative path. + If operation fails a False is returned and True otherwise. + """ + try: + file = open(filename, 'wb') + except: + print 'WARNING in save: could not open', simname + return False + + # try: + pickle.dump(obj, file, protocol=2) + file.close() + return True + # except: + # file.close() + # print 'WARNING in save: could not pickle object' + # return False + + +def load_obj(filename, parent=None): + """ + Reads python object from a file with filename and returns object. + Filename may also include absolute or relative path. + If operation fails a None object is returned. + """ + print 'load_obj', filename + try: + file = open(filename, 'rb') + except: + print 'WARNING in load_obj: could not open', filename + return None + + # try: + # print ' pickle.load...' + obj = pickle.load(file) + file.close() + # print ' obj._link2' + + # _init2_ is to restore INTERNAL states from INTERNAL states + obj._init2_config() + + # _init3_ is to restore INTERNAL states from EXTERNAL states + # such as linking + obj._init3_config() + + # _init4_ is to do misc stuff when everything is set + obj._init4_config() + + return obj + + # except: + # print 'WARNING in load: could not load object' + # return None + + +def is_objconfigured(obj): + return hasattr(obj, 'init_config') + + +class ArrayObj: + + """ + Mixin for Classes or Instance which are used as array-element + within the framework of the ArrayObjConfigurator. + + Its main function is init_arrayobj where an id gets assigned + which corresponds to the id of the element in the parent array. + + Also __getitem__ and __setitem__ functions are implemented through which + array elements with the same id of other attributes of the parent object + can be read and changed. + """ + + def init_arrayobj(self, id, parent, ident, **args): + """ + Initialize by defining parent instance where all the + attributes of this instance are stored in array form. + Also define the id of the array coresponding to this instance. + + Function will be called automatically from ArrayObjConfigurator + when id is assigned. + + """ + self.parent = parent + # if ident=='': + # ident=parent.ident+IDENTSEP+str(id) + # else: + self.ident = ident + self.id = id + self.config_with_id() + # print 'init_arrayobj',self.ident,id#,parent + + def config_with_id(self): + """ + Here the instance can be inizialized.. + Function called AFTER self.id and self.parent have been assigned. + """ + pass + + def copy_attrs(self, targetobj, attrs=None): + """ + Copies given list of attributes of this object + to given target object. + + If no attributes are given then all attributes of this object + are considered for copying. + + Clearly, the array attributes corresponding to the id of this + object are copied to the array attributes of the arrays + with the id of the target object. + + To copy an attribute, the foolowing conditions must be satisfied: + - the attribute must be configured with key copy=True + - the attribute must be configured in targetobject + + """ + self.parent.copy_attrs(targetobj, self.id, targetobj.id, attrs=attrs) + + def __getitem__(self, key): + return self.getparent(key) + + def __setitem__(self, key, value): + self.setparent(key, value) + + def setparent(self, key, value): + """ + Sets entry with id of this instance of the attribute 'key' of parent object. + + Usage: + self['attributename']=value + + + """ + # print key,value + self.parent[key, self.id] = value + + def getparent(self, key): + """ + Gets entry with id of this instance of the attribute in parent object. + + Usage: + self['attributename'] + """ + # print 'ArrayObject.__getitem__',key + return self.parent[key, self.id] + + def get_groupattrs_obj(self, name): + """ + Returns a dictionary with all attributes of a group with given name. + Key is attribute name and value is attribute value for the given id. + """ + # print 'get_groupattrs_obj',name,self.id + return self.parent.get_groupattrs(name, self.id) + + +class PlugoutMixin: + + """ + Mixin to provide methods to plug callback functions into other objects. + """ + + def init_plugout(self): + """ + Initialize basic plugout variables + """ + # dictionary with pluginobj as key and list with plugids + # provided by obj as value + self._plugoutobjs = {} + + def add_plugout(self, obj, plugtype, function, attr='_all'): + """ + Make a plugin to object and retain plugin id for later unplugg. + + Standard plug types are automatically set bu the system: + plugtype plugcode + 'del' 0 + 'set' 1 + 'get' 2 + 'add' 3 + + 'del_items' 20 + 'set_items' 21 + 'get_items' 22 + 'add_items' 23 + + + + """ + if not self._plugoutobjs.has_key(obj): + self._plugoutobjs[obj] = [] + # make plugin to object + plugid = obj.add_plugin(obj, plugtype, function, attr) + + # add plugginid of obj to list + self._plugoutobjs[obj].append(plugid) + + return plugid + + def del_plugout(self, obj, plugid=-1): + """ + Plug out from specified object. + If plugid is specified, only this plug is pulled, + otherwise all plugs to this object are pulled at once. + """ + if self._plugoutobjs.has_key[obj]: + if plugid < 0: + if self._plugoutobjs[obj].count(plugid) > 0: + obj.del_plugin(plugid) + self._plugoutobjs[obj].remove(plugid) + else: + for plugids in self._plugoutobjs[obj]: + obj.del_plugin(plugid) + del self._plugoutobjs[obj] + else: + print 'WARNING: no plugout ids for object', obj + plugids = [] + + def unplugout(self): + """ + Unplug all plugs on other objects + """ + for obj in self._plugoutobjs.keys(): + self.del_plugout(obj) + + +class PluginMixin: + + """ + Mixin to provide methods to plug in callback functions + from other objects. + """ + + def init_plugin(self): + """ + Initialize basic plugin variables + """ + # self._plugins={} # compulsory in configurator! + self._counter_plugid = 0 + + self._plugcode = {'test': -1} + # print 'init_plugin',self.ident,self._plugcode + + # dictionary with obj as key and dict with plugid,plugtype,attr as + # value + self._pluginobjs = {} + + # add basic plugincodes + # for scalars + self.add_plugcodes([('del', 0), ('set', 1), ('get', 2), ('add', 3)]) + + if hasattr(self, 'get_ids'): + # print ' add_plugcodes arrays for ',self.ident + self.add_plugcodes([('del_items', 20), + ('set_items', 21), + ('get_items', 22), + ('add_items', 23), ]) + self.enable_plugins() + + def execute_plugin(self, plugtype): + """ + Execute all callbacks for the plugin of the given type + """ + self._execute_plugins(self._plugcode[plugtype], attr='_all') + + def add_plugcodes(self, plugcodes): + """ + Plugcodes integers that correspond to a plugtype. + These integers are used as keys for faster access. + + Argument plugcodes is a list with tuples + each tuple containing plugtype and plugcode. + + Standard plug types are automatically set bu the system: + plugtype plugcode + 'del' 0 + 'set' 1 + 'get' 2 + 'add' 3 + + 'del_items' 20 + 'set_items' 21 + 'get_items' 22 + 'add_items' 23 + + """ + # print 'add_plugcodes',plugcodes + for plug, plugcode in plugcodes: + if not self._plugcode.has_key(plug): + self._plugcode[plug] = plugcode + # self._plugins[plugcode]={'_all':{}} + # print ' added + # self._plugcode[plug]',plug,self._plugcode[plug] + else: + print 'WARNING:_add_plugcodes: already existant code',\ + plug, self._plugcode[plug] + print ' Refused to insert.' + + def add_plugin(self, obj, plug, callbackfunction, attr='_all'): + # print 'add_plugin',plug,callbackfunction,attr + self._counter_plugid += 1 + plugid = self._counter_plugid + plugcode = self._plugcode[plug] + + if not self._plugins.has_key(plugcode): + self._plugins[plugcode] = {} + + if not self._plugins[plugcode].has_key(attr): + self._plugins[plugcode][attr] = {plugid: callbackfunction} + else: + self._plugins[plugcode][attr][plugid] = callbackfunction + + if not self._pluginobjs.has_key(obj): + self._pluginobjs[obj] = {} + + self._pluginobjs[obj][plugid] = (plugcode, attr) + return plugid + + def disable_plugins(self): + """ + Prevents plugins from execution + """ + self._enable_plugins = False + + def enable_plugins(self): + """ + Enable plugins for execution + """ + self._enable_plugins = True + + def del_plugin(self, obj, plugid=-1): + """ + Remove plugin with pluginid + """ + + if plugid >= 0: + plugids = [plugid] + else: + plugids = self._pluginobjs[obj].keys() + + if self._pluginobjs.has_key(obj): + # there exist ids associated with this object + for pid in plugids: + if self._pluginobjs[obj].has_key(pid): + # remove plugin with pid + plugcode, attr = self._pluginobjs[obj][pid] + del self._plugins[plugcode][attr][pid] + del self._pluginobjs[obj][pid] + + if len(self._plugins[plugcode][attr]) == 0: + # no more plugins for this attribute...remove it + del self._plugins[plugcode][attr] + if len(self._plugins[plugcode]) == 0: + # np more plugins for this plugintype...remove it + del self._plugins[plugcode] + + if len(self._pluginobjs[obj]) == 0: + # no more plugin ids associated with this object + del self._pluginobjs[obj] + + +class ObjConfigurator: + + """ + Base mixin class for general scalar object configuration. + + Usage: + + During initialization of class call + + self.init_config('myclass_ident_string',name='my human readable class') + + or if there is a parent object availlable: + + self.init_config('myclass_ident_string',parent) + + In this case the ident of the parent obj is prependet + + + + """ + + def init_config(self, ident='', parent=None, name='noname', **args): + # print '---init_config ident',ident,hasattr(self,'init_plugin') + # print ' parent',parent + # print ' name',name,len(name) + + if hasattr(self, 'ident'): + ident = self.ident + + if (name == 'noname') & (len(ident) > 0): + self.name = ident + elif (name == 'noname') & (len(ident) == 0): + if self.__dict__.has_key('__name__'): + ident = self.__name__ # use class name as identifier + self.name = ident + + elif (len(name) > 0) & (len(ident) == 0): + if self.__dict__.has_key('__name__'): + ident = self.__name__ # use class name as identifier + self.name = name + else: + self.name = name + + self.ident = ident + self.parent = parent + if parent != None: + + # print 'init_config',ident,parent.ident + # present object is a child of a parent + # => prepend parent identifier string + if hasattr(parent, 'ident'): + self.ident = parent.ident + IDENTSEP + ident + + self._config = {} + self._groups = {} + self._functions = [] + + # define a list with attribute strings that need to be saved + # apart from the cofigured attributes + # this list may be extended by successive initializations + self._attrs_save = [ # 'parent', + 'name', 'ident', '_config', '_groups', + '_functions', + ] + + # conditional plugin import + self._init_plugging() + + # print 'Created configuration for',self.ident + + return self.ident + + def reset_parent(self, parent): + """ + Resets previously assigned parent. + This method is not used during initialization. + """ + ident = self.get_ident(is_local=True) + self.parent = parent + if parent != None: + # print 'init_config',ident,parent.ident + # present object is a child of a parent + # => prepend parent identifier string + if hasattr(parent, 'ident'): + self.ident = parent.ident + IDENTSEP + ident + + def get_ident(self, is_local=False): + """ + Returns identity string. + By default it returns the entire identity string + unless is_local==True. In this case only the local, the last + element of the global identity is returned. + """ + if is_local: + return string.split(self.ident, IDENTSEP)[-1] + else: + return self.ident + + def _link(self, parent=None): + """ + Called after load process to link with other instances + in the environment. + """ + + # self.parent=parent + # for attr in self._config.keys(): + # obj=getattr(self,attr) + # if is_objconfigured(): + # obj._link(self) + pass + + def _init2_config(self): + """ + Called after load and link process to do make initializations + of constants, dependent INTERNAL attributes such as hash tables, + NO LINKS OR DEPENDENCIES TO EXTERNAL INSTANCES ALLOWED + + Here only the configurator internal attributes are restored. + All object specific in _init2() in + """ + print '\n _init2_config', self.ident + + print ' restore unsaved attributes', self.ident + self._functions = [] + for attr in self._config.keys(): + + # check + # if hasattr(self,attr): + # value=getattr(self,attr) + # print ' attr',attr, + # if type(value)==ndarray: + # print value.dtype,value.shape + # else: + # print value + + config = self._config[attr] + if config['is_function']: + # print ' resore function',attr + self._functions.append(attr) + elif not config['save']: + # print ' resore attr',attr + self.reset(attr) + # check + # value=getattr(self,attr) + # print ' after: attr',attr, + # if type(value)==ndarray: + # print value.dtype,value.shape + # else: + # print value + + # conditional plugin import + self._init_plugging() + + print ' call _init2', self.ident + + self._init2() + + print ' restore children', self.ident + for attr in self._config.keys(): + config = self._config[attr] + if (config['save']) & (not config['is_function']): + if config['struct'] == 'scalar': + obj = getattr(self, attr) + if is_objconfigured(obj): + print ' call _init2_config of', obj.ident + obj._init2_config() + else: + # attribute is an array so init here for arrays as well + # TODO: should go as special in arrayconfigurator + for id in self.get_ids(): + obj = self[attr, id] + if is_objconfigured(obj): + print ' call _init2_config of', obj.ident + obj._init2_config() + + def _init2(self): + """ + Called after load process to do make initializations + of constants, dependent INTERNAL attributes such as hash tables, + NO LINKS OR DEPENDENCIES TO EXTERNAL INSTANCES ALLOWED + + To be overridden. + """ + pass + + def _init3_config(self): + """ + Called after load and link process to do make initializations + of constants, dependent attributes such as hash tables, + links to external instances etc. + + """ + print '\n_init3_config', self.ident + # link with other, now already initialized objects + # Those attributes which have NOT been saved, but have + # an ident in they configuration can no be recovered + # though their ident + for attr in self._config.keys(): + config = self._config[attr] + + if config.has_key('link'): + # try to recover object with ident + + if config['link']: + + if config['struct'] in ('array', 'dict', 'marray'): + print ' detected link array ', attr + # here we want to recover links to objects + # using a dictionary with + # id as key and ident as value + for id in self.get_ids(): + self[attr, id] = self.get_obj_instance( + config['ident'][id]) + + else: + print ' detected link ', attr + setattr(self, attr, self.get_obj_instance( + config['ident'])) + + # make specific settings + self._init3() + + # print ' restore children',self.ident + for attr in self._config.keys(): + config = self._config[attr] + if (config['save']) & (not config['is_function']): + if config['struct'] == 'scalar': + obj = getattr(self, attr) + if is_objconfigured(obj): + # print ' call _init3_config of',obj.ident + obj._init3_config() + else: + # attribute is an array so init here for arrays as well + # TODO: should go as special in arrayconfigurator + for id in self.get_ids(): + obj = self[attr, id] + if is_objconfigured(obj): + # print ' call _init3_config of',obj.ident + obj._init3_config() + + def _init3(self): + """ + Called after load and internal link process to do make initializations + of constants, dependent attributes such as hash tables, + links to external instances etc. + + To be overridden. + """ + pass + + def _init4_config(self): + """ + Called after load and link process to do make initializations + any other initializations. + + """ + print '\n_init4_config', self.ident + + # make specific settings + self._init4() + + # print ' restore children',self.ident + for attr in self._config.keys(): + config = self._config[attr] + if (config['save']) & (not config['is_function']): + if config['struct'] == 'scalar': + obj = getattr(self, attr) + if is_objconfigured(obj): + # print ' call _init4_config of',obj.ident + obj._init4_config() + else: + # attribute is an array so init here for arrays as well + # TODO: should go as special in arrayconfigurator + for id in self.get_ids(): + obj = self[attr, id] + if is_objconfigured(obj): + # print ' call _init4_config of',obj.ident + obj._init4_config() + + def _init4(self): + """ + Called after load and link process to do make initializations + any other initializations. + + To be overridden. + """ + pass + + def _init_plugging(self): + """ + Initializes plugin and plugout related variables. + This function is called during initialization + and after load, before reinitializeing other attrubutes. + """ + # print '_init_plugging',self.ident,self + # if make_plugins: + # from PluginMixin import * + if hasattr(self, 'init_plugin'): + # print ' ini_plugin',self.ident,self + self.init_plugin() + + if hasattr(self, 'init_plugout'): + # print ' ini_plugout',self.ident + self.init_plugout() + # this plugin dictionary is always required and remains + # empty if no plugins are made + self._plugins = {} + + def _execute_plugins(self, plugcode, attr='_all', **args): + """ + This method executes all callbackfunctions associated with the + given plugcode. + This funcion is a core part because used in various + methods. All other methods regarding plugins in PluginMixin. + """ + # it has been checked that self._plugins has all keys + print '_execute_plugins', plugcode, ' for', self.ident, attr + # print ' self._plugins=',self._plugins + # print ' self._plugins[plugcode]=',self._plugins[plugcode] + + if self._enable_plugins: + args['attr'] = attr + if self._plugins[plugcode].has_key('_all'): + for func in self._plugins[plugcode]['_all'].values(): + # print ' => execute function',func + # print ' with args',args + func(**args) + elif self._plugins[plugcode].has_key(attr): + # selective plugin for specific attribute + for func in self._plugins[plugcode][attr].values(): + func(**args) + # else: + # print ' no plugin functions for plugcode',plugcode + + def get_name(): + """ + Returns formatted name string of object. + """ + return self.name + + def print_config(self): + + # print 'inds=',self._inds + print '====================================================================' + print ' Config of', self.name, ' with ident:', self.ident + print '====================================================================' + for attr in self._config.keys(): + self.print_attr(attr) + + # for name in self.get_groupnames(): + # if self.get_group(name): + # print 'Group: ',name + # for attr in self.get_group(name): + # self.print_attr(attr) + + # print all attributes which are not in a group + # print '--' + # for attr in self._config.keys(): + # if len(self._config[attr]['group'])==0: + # self.print_attr(attr) + + def print_attr(self, attr): + # config=self.get_config(attr) + # print ' ', attr,'=',self.__dict__[attr],config['unit'] + print ' ' + attr + ' = ' + self.get_string_attr_value(attr, self[attr]) + + def print_attrattrs(self, attrs=None, attrattrs=['info', 'group', 'struct'], filename=None, sep='\t'): + """ + Prints attributes of attributes. + If + """ + # print 'print_attrattrs' + lines = [] + if attrs == None: + attrs = self._config.keys() + attrs.sort() + line = u'attr' + for attrattr in attrattrs: + line += sep + attrattr + lines.append(line) + + for attr in attrs: + # print ' attr',attr + line = u'' + attr + for attrsattr in attrattrs: + if self._config[attr].has_key(attrsattr): + line += sep + str(self._config[attr][attrsattr]) + else: + line += sep + '' + lines.append(line) + + if filename != None: + file = open(filename, 'w') + for line in lines: + # print line + file.write(line + '\n') + file.close() + else: + for line in lines: + print line + + return lines + + def get_string_attr_value(self, attr, value): + """ + Returns a string with correctly formatted value of attribute. + """ + # print '\n\nget_string_attr_value',attr,value,type(value) + # print self.get_printformat(attr)+self.get_unit(attr) + #print (self.get_printformat(attr)+self.get_unit(attr))%(value) + config = self.get_config(attr) + tt = config['type'][0] + unit = self.get_unit(attr, show_parentesis=True) + if tt in ('BooleanType',): + if value: + s = 'True' + else: + s = 'False' + return s + self.get_unit(attr, show_parentesis=True) + + elif type(value) in ARRAYTYPES: + # value is an array=> print signe items + s = '[' + for v in value: + s += self.get_string_attr_value(attr, v) + ',' + s += ']' + return s + + else: + try: + return (self.get_printformat(attr) + + ' ' + self.get_unit(attr, show_parentesis=True)) % value + except: + print '\n WARNING could not print', attr, '=', value + return 'Error' + + def get_printformat(self, attr): + """ + Returnes the standad fortran stringformat for attribute. + """ + config = self.get_config(attr) + tt = config['type'][0] + if tt in ('IntType', 'LongType'): + return '%' + str(config['digits_integer']) + 'd' + + elif tt in ('FloatType', 'ComplexType'): + return '%' + str(config['digits_integer']) + '.'\ + + str(config['digits_fraction']) + 'f' + + else: + # its a string + return '%s' + + return printformat + + def get_numformat(self, attr, confog=None): + """ + Returns a dictionary with all formatting infos on attribute. + It is tried to detect the numerical datatype and define + formatting info, if not already defined. + """ + # determine format of numeric value + + config = self.get_config(attr) + + # take top level type + tt = config['type'][0] + numformat = {} + if tt in ('IntType', 'LongType'): + numformat['digits_integer'] = config.get('digits_integer', 13) + numformat['digits_fraction'] = config.get('digits_fraction', 0) + else: + numformat['digits_integer'] = config.get('digits_integer', 9) + numformat['digits_fraction'] = config.get('digits_fraction', 8) + + numformat['min'] = config.get('min', None) + numformat['max'] = config.get('max', None) + + # print 'get_numformat',attr,numformat + return numformat + + def config(self, attr, default=None, **args): + """ + Configure attribute for Object. + """ + # print '\n\n\n'+70*'*' + # print 'config',attr,default,args + + # configure attribute with template and parameters from args + self._config[attr] = deepcopy( + CONFIG_TEMPLATE) # CONFIG_TEMPLATE.copy() + + # print ' after template configured attr:',attr,self._config[attr] + + # try to guess type...as default only + t = get_type(default) + self._config[attr]['type'] = t + # print ' get_type(default)=',get_type(default) + + # guess read/write permissions according to toplevel type + if TYPES.has_key(t[0]): + self._config[attr]['perm'] = TYPES[t[0]]['perm'] + + # default name + self._config[attr]['name'] = attr + + if args.has_key('metatype'): + # TODO: fetch here metatype info from metatype module + pass + else: + self._config[attr]['metatype'] = '' # default + + # overwrite all defaults with arguments + self._config[attr].update(args) + + # print ' after update configured attr:',attr,self._config[attr] + + if type(self._config[attr]['type']) != types.ListType: + self._config[attr]['type'] = [self._config[attr]['type']] + + # complete with numerical format info + self._config[attr].update(self.get_numformat(attr)) + + # store default value here, + # in case of an array this is the value of a single entry + self._config[attr]['default'] = default + + # check if attribute is an existing function and if yes register + # as such in config + self._config[attr]['is_function'] = False + if hasattr(self, attr): + if type(getattr(self, attr)) == types.MethodType: + # print ' ',attr,'is a function' + self._config[attr]['is_function'] = True + # self._config[attr]['perm']='r' # read only + + if self._config[attr]['is_function']: + # register attribute in function list + self._functions.append(attr) + else: + self.reset(attr) + + # print ' configured attr:',attr,self._config[attr] + + # this turnes group argument in a list when given a signle string + # TODO: would be better to introduce groups as a list with all group + # names + groupnames = self._config[attr]['group'] + if type(groupnames) == types.StringType: + self._config[attr]['group'] = [groupnames, ] + + if (self._config[attr]['metatype'] == 'id'): + # explictly declared as id + # make sure of array structure + self._config[attr]['struct'] = 'array' + # TODO: better identify object as arrayobjconfiguaror + + # put attribute into id_ref or obj ref group + # if no reference is made then put in id group + if self._config[attr].has_key('ident_ref'): + if self._config[attr]['struct'] == 'array': + + if 'id_ref' not in self._config[attr]['group']: + # print ' ident_ref detected id_ref for',attr + self._config[attr]['group'].append('id_ref') + self._config[attr]['metatype'] = 'id' + # print ' check template',CONFIG_TEMPLATE.copy() + else: + # print ' ident_ref detected obj_ref for',attr + if 'obj_ref' not in self._config[attr]['group']: + self._config[attr]['group'].append('obj_ref') + self._config[attr]['metatype'] = 'obj' + + elif (self._config[attr]['metatype'] == 'id'): + # and add it to id group + if 'id' not in self._config[attr]['group']: + self._config[attr]['group'].append('id') + + for groupname in self._config[attr]['group']: + self.config_group(groupname, attr) + + # this is a treatment fo linked objects, which are + # not a parent or a child of this objects + # they ill not be saved, but recovered bu their ident during _init3 + if self._config[attr].has_key('link'): + if self._config[attr]['link']: + # try to recover object with ident + # however, ident itself will only be stored during saving + self._config[attr]['save'] = False + self._config[attr]['perm'] = 'r' + + def reset(self, attr): + """ + Reset atttribute attr to default values + """ + # create attribute and if there are already arrays with entries, + # create the same number of entries with default value + # default=self._config[attr]['default'] + # struct=self._config[attr]['struct'] + + # if self._config[attr]['is_function']: + # # register attribute in function list + # #self._functions.append(attr) + # # already done in config + # pass + # else: + # attr is a scalar , simply assign default + if not self._config[attr]['is_function']: + self.__dict__[attr] = self._get_default(attr) + + def set_default(self, attr, value): + """ + Sets a default value for this attribute. + """ + self._config[attr]['default'] = value + + def _get_default(self, attr): + """ + Returns default value for attribute with name attr_name + + Usage: + Return a scalar default + self._get_default('attr_name') + + + """ + default = self._config[attr]['default'] + # struct=self._config[attr]['struct'] + + if type(default) == ndarray: + obj = default # .tolist() + + elif (type(default) == types.ClassType): + if self._config[attr]['init']: + # Default is a class, needs to be initialized + # TODO: initialization and global id needs to be reviewed + obj = default(self) + + else: + # otherwise just copy default value + obj = default + + # print '_get_default',obj + return obj + + def set(self, attr, val=None): + """ + Sets value to attribute. + + Usage: + + Set scalar variable var with value val + self.set('var',val) + + + """ + + if self._config['attr']['struct'] == 'scalar': # exclude functions + self.__dict__[attr] = val + + if self._plugins.has_key(1): + self._execute_plugins(1, key) + + def is_config(self, attr): + """ + Returns true if attribute with name attr is configured. + """ + return self._config.has_key(attr) + + def copy_attrs(self, targetobj): + """ + Copies given list of scalar attributes of this object + to given target object. + + If no attributes are given then all attributes of this object + are considered for copying. + + copy an attribute, the foolowing conditions must be satisfied: + - the attribute must be configured with key copy=True + - the attribute must be configured in targetobject + - the structure of the attribute must be scalar + (arrays done by copy method of ArrayObjConfigurator) + """ + if attrs == None: + # get all attributes + attrs = self._config.keys() + + for attr in attrs: + config = self._config[attr] + if config['struct'] == 'scalar': + if config['copy']: + if targetobj.is_config(attr): + targetobj[attr] = self[attr] + + def get_attrs(self, crits_atleastone=[], crits_all=[]): + """ + Returns list of configured attribute names. + + crits_atleastone and crits_all are lists defining one or several + criteria that the attribute configuration must satify. + for example: [('struct','array'),('struct','dict'),('struct','marray')] + """ + attrs = [] + if len(crits_atleastone) > 0: + # get attribute names for attributes where at least one criteria + # is satisfied + for attr in self._config.keys(): + for criteria in crits_atleastone: + # print 'get_attrs:',attr,criteria + if self._config[attr][criteria[0]] == criteria[1]: + attrs.append(attr) + break + return attrs + + elif len(crits_all) > 0: + # get attribute names for attributes where all criteria + # are satisfied + for attr in self._config.keys(): + satisfied = True + for criteria in crits_all: + # print 'get_attrs:',attr,criteria + satisfied &= (self._config[attr][ + criteria[0]] == criteria[1]) + if satisfied: + attrs.append(attr) + + return attrs + + else: + # no criteria spacified, return all attribute names + return self._config.keys() + + def get_config(self, attr=''): + # print '_get_config:',attr + if attr: + return self._config.get(attr, {}) + else: + return self._config + + def get_root_instance(self): + """ + Returns instance of root obj of the tree. + """ + obj = self + while obj.parent != None: + obj = obj.parent + + return obj + + def get_obj_instance(self, ident): + """ + Returns the instance of the object of the given identity string ident. + + The researched object must reside within the object tree where also + the self object is a part. + """ + if ident == '': + return None + + elif ident[0] == '.': + # ident starts with a . means that it is a relative link + # starting with this object + obj = self + idents = string.split(self.get_ident( + is_local=True) + ident, IDENTSEP) + + else: + obj = self.get_root_instance() + idents = string.split(ident, IDENTSEP) + + print 'get_obj_instance ', idents + print ' root_instance=', obj + if len(idents) == 1: + # just one element identification, means this is root + return obj + + elif idents[1] == '': + return obj + + else: + oldobj = obj + oldident = ident + for ident in idents[1:]: + + print ' get attr', ident, 'from obj', obj + if ident.isdigit(): # it's an id so get arrayobject + + print ' get it through object[attr,id]', oldobj, oldident, string.atoi(ident) + obj = oldobj[oldident, string.atoi(ident)] + oldobj = obj + oldident = ident + + elif ident == '': + oldobj = obj + # obj=obj # do not dive + + else: + oldobj = obj + oldident = ident + obj = getattr(obj, ident) + + return obj + + def create_group(self, name, attr_list=[]): + # print 'create_group',name,attr_list + if type(attr_list) == types.ListType: + # print ' groups before=',self._groups.keys() + self._groups[name] = attr_list + # print ' groups after =',self._groups.keys() + else: + print 'WARNING: attr_list must be list type' + + def config_group(self, name, attr, **args): + """ + Add or append attribute to given name. + """ + # print 'config_group',self._groups,type(self._groups) + # print ' name,attr',name,attr + + if self._groups.has_key(name): + if attr not in self._groups[name]: + # print ' before append',self._groups[name] + self._groups[name].append(attr) + # print ' after append',self._groups[name] + + else: + self.create_group(name, [attr]) + + def get_groupnames(self): return self._groups.keys() + + def get_group(self, name): + """ + Returns a list with attribute names that belong to that group name. + """ + # print 'get_group self._groups=\n',self._groups + return self._groups.get(name, []) + + def get_groupattrs(self, name): + """ + Returns a dictionary with all attributes of a group. + Key is attribute name and value is attribute value. + """ + attrs = {} + for attr in self._groups[name]: + attrs[attr] = self['attr'] + return attrs + + def get_perm(self, attr): + """ + Returns current permission of attribute + """ + return self._config[attr]['perm'] + + def get_unit(self, attr, show_parentesis=True): + """ + Returns unit of attribute + """ + + if self._config[attr].has_key('unit'): + unit = self._config[attr]['unit'] + else: + unit = '' + + if show_parentesis: + if len(unit) > 0: + unit = '[' + unit + ']' + + return unit + + def __getitem__(self, attr): + # print '__getitem__',key + + # plugin execution + if self._plugins.has_key(0): + self._execute_plugins(0, attr) + return self.__dict__[attr] + + def __setitem__(self, attr, value): + """ + Sets a value to an attribute + + + """ + + # print 'setitem',key,'to',value + + self.__dict__[attr] = value + + # plugin execution + if self._plugins.has_key(1): + self._execute_plugins(1, attr) + + def __getstate__(self): + # print '__getstate__',self.ident + # print ' self.__dict__=\n',self.__dict__.keys() + + state = {} + if hasattr(self, '_config'): + + # store ident for linked objects prior to saving + # will be recovered in _init3 + for attr in self._config.keys(): + config = self._config[attr] + + if config.has_key('link'): + # try to recover object with ident + if config['link']: + if config['struct'] in ('array', 'dict', 'marray'): + # here we want to retain the idents of all objects + # in this array, using a dictionary with + # id as key and ident as value + config['ident'] = {} + for id in self.get_ids(): + config['ident'][id] = self[ + attr, id].get_ident() + else: + config['ident'] = getattr(self, attr).get_ident() + + # print ' self._config.keys()',self._config.keys() + for attr in self._attrs_save: + state[attr] = getattr(self, attr) # self.__dict__[attr] + # print ' saved state:',attr,state[attr] + + # decide whether to save parent: + # the root object does not save parent because outside the tree + if len(string.split(self.ident, IDENTSEP)) > 1: + # print ' save parent for',string.split(self.ident,IDENTSEP) + state['parent'] = self.parent + else: + state['parent'] = None + + if hasattr(self, 'init_arrayobj'): + # it is actually an array-object, save also id + if hasattr(self, 'id'): + # print ' saved attr id',self.id + state['id'] = self.id + + # save which attributes to save + state['_attrs_save'] = self._attrs_save + + # now save attributes which have been configured to save + for attr in self._config.keys(): + # print ' ',self._config[attr]['save'],attr + if self._config[attr]['save']\ + & (not self._config[attr]['is_function'])\ + & (not (type(getattr(self, attr)) == types.MethodType)): + # print ' save attr:',attr + state[attr] = getattr(self, attr) + + self._getstate(state) + + return state + + def _getstate(self, state): + """ + Complete state dict with state variables which are not + contained in the config scheme. All attributes which are + configured and the save option is not explicitely set + to False are automatically inserted in the state dictionay. + """ + pass + + def __setstate__(self, state): + # print '__setstate__',self + + # this is always required, but will not be saved + self._plugins = {} + + for key in state.keys(): + # print ' set state',key + self.__dict__[key] = state[key] + + # done in init2_config... + # set default values for all states tha have not been saved + # for attr in self._config.keys(): + # if (not self._config[attr]['save']) & (not hasattr(self,attr)): + # print ' config attr',attr + # self.config(attr,**self._config[attr]) + + # set other states + self._setstate(state) + + def _setstate(self, state): + """ + Complete state settings of state variables which are not + contained in the config scheme. All attributes which are + configured and the save option is not explicitely set + to False are automatically set. + """ + pass + + def close(self): + """ + Should be called before desroying the object. + Does remove pugs is existent. + """ + if hasattr(self, unplugout): + self.unplugout() + + +class ArrayObjConfigurator(ObjConfigurator): + + """ + Base class for general scalar object configuration. + + For usage see demo classes below. + """ + + def init_config(self, ident='', parent=None, name='noname', named=False, + **args): + """ + Fore named objects use: + self.add_id_named('name_of_id') + """ + # print 'init_config array',ident,hasattr(self,'init_plugin') + ObjConfigurator.init_config(self, ident, parent, name, **args) + + # else: + # print 'no array plugins for ',self.ident + + # print 'check config'#,self.ident,self._config + self._arrayconfig = {} + self._dictconfig = {} + self._inds = zeros((0,), int) + self._ids = zeros((0,), int) + self._marrayconfig = {} + self._named = named + if self._named: + self._id_names = {} + self.config('_name_ids', '', struct='dict', + info='Dictionary with id as key and name as value') + else: + self._id_names = None + + # save these attributes, apart from configured ones + self._attrs_save += ['_arrayconfig', '_dictconfig', '_inds', '_ids', + '_marrayconfig', '_named', '_id_names'] + + def is_named(self): + """ + Returns true if array has named rows + """ + return self._named + + def get_id_from_name(self, name): + """ + Returns id that corresponds to name. + """ + return self._id_names.get(name, -1) + + def get_name_from_id(self, id): + """ + Returns name that corresponds to id. + """ + return self._name_ids.get(id, '') + + def get_names(self): + """ + Returns list of all named ids. + """ + # print 'get_names',self.ident,self._id_names.keys() + return self._id_names.keys() + + def get_named(self, attr, name): + """ + Returns value corresponding to named id + """ + return self[attr, self.get_id_from_name(name)] + + def get_ids(self, inds=[], ordered=False): + """ + Return all ids corrisponding to array indexes inds. + Options: + if no inds are given, all ids are returnd + + if ordered is true, ids will be sorted before they are returned. + + """ + if (len(inds) > 0) & (not ordered): + return take(self._ids, inds) + + elif len(inds) > 0: + ids = take(self._ids, inds) + + else: + ids = self._ids.copy() + if ordered: + return sort(ids) + else: + return ids + + def get_id(self, ind): + """ + Returns scalar id corresponding to index ind + """ + # print 'get_id',ind,self._ids + return self._ids[ind] + + def is_scalarid(self, id): + """ + Returns True if id is a zero positive scalar interger + """ + if is_integer(id): + if id >= 0: + return True + else: + return False + else: + return False + + def is_idarray(self, ids): + """ + Fast, formal chack whether ids is either a valid array with ids. + """ + if type(ids) in (types.ListType, ndarray): + # it is an array + if len(ids) > 0: + # it contains at least one id + # return True if this id is a zaro positive integer + return self.is_scalar_id(ids[0]) + else: + return False + else: + return False + + def is_ids(self, ids): + """ + Formal check whether ids contains either an array with ids + or is a scalar zero positive interger. + """ + return self.is_idarray(ids) | self.is_scalarid(ids) + + def select_ids(self, mask): + """ + Returns an array of ids, corresponding to the True + of the mask array. + + Usage: + Select all ids for which array of attribute x is greater than zero. + ids=obj.select_ids( obj.x>0 ) + """ + # print 'select_ids',mask,flatnonzero(mask) + # print ' self._ids=',self._ids + + return take(self._ids, flatnonzero(mask)) + + # def select(self,mask,ordered=False): + # """ + # Returns an array of ids, corresponding to the True + # of the mask array. + # + # Usage: + # Get all elements of attribute y for which array of attribute x is greater than zero. + # values=obj.select(obj.y, obj.x>0 ) + # """ + # + # + # return self.get_ids(flatnonzero(mask),ordered=ordered) + + def get_ids_marray(self, attr, inds_marray=[]): + """ + Return all ids and relative indexes corresponding to m-array + indexes in list inds_marray. + + The relative index is the index within the array corresponding + to an id. + + Examples: + obj.get_ids_marray('attrname',[2,3,4]) + + returns an array of the following shape: + [[11,0], + [11,1], + [12,0],] + + here marray index 2 and 3 correspond to id=11 with relative index + 0 and 1 respectively, while marray index 3 corresponds to + element with id=12 and relative index 0 + (means first item in element with id=12) + + """ + # print 'get_ids_marray',inds_marray + if len(inds_marray) > 0: + # case more complex because need to check with block pointers + + # get block pointers for this attribute + bp = self._marrayconfig[attr]['bp'] + inds = zeros((len(inds_marray)), int) + + i = 0 + for ind_marray in inds_marray: + # print ' bp, ind_marray',bp,ind_marray + inds[i] = flatnonzero( + (bp[:, 0] <= ind_marray) & (bp[:, 1] > ind_marray))[0] + i += 1 + inds_delta = inds_marray - take(bp[:, 0], inds) + + ids = take(self._ids, inds) + else: + ids = [] + inds_delta = [] + + return concatenate((transpose([ids]), transpose([inds_delta])), (1)) + # return reshape( concatenate((ids, inds_delta)) ,(-1,2) ) + + def get_inds(self, ids=None): + if ids != None: + return self._inds[ids] + else: + return self._inds[self._ids] + + def get_ind(self, id): + return self._inds[id] + + def get_inds_marray(self, attr, ids): + """ + Returns a flat array with all array indexes of + marray with attribute attr that have an id contained in list ids. + """ + # get block pointers for this attribute + bp = self._marrayconfig[attr]['bp'] + inds = [] + # print 'get_inds_marray: ids=',ids + # print 'get_inds_marray: self._inds= ',self._inds + # print 'get_inds_marray: self._inds[ids,:]= ',self._inds[ids,:] + # Numeric + # for i,j in take(bp, take(self._inds,ids) ): + for i, j in bp[self._inds[ids], :]: + # print ' i,j=',i,j + inds += range(i, j) + + # print ' inds=', array(inds,int) + return array(inds, int) + + def suggest_id(self, zeroid=False): + """ + Returns a an availlable id. + + Options: + zeroid=True allows id to be zero. + + """ + return self.suggest_ids(1, zeroid)[0] + + def suggest_ids(self, n, zeroid=False): + """ + Returns a list of n availlable ids. + It returns even a list for n=1. + + Options: + zeroid=True allows id to be zero. + """ + # print + # 'suggest_ids',n,zeroid,self._inds,len(self._inds),self._inds.dtype + ids_unused_orig = flatnonzero(less(self._inds, 0)) + + if not zeroid: + if len(self._inds) == 0: + ids_unused = zeros(0, int) + else: + # avoid 0 as id: + # ids_unused=take(ids_unused,flatnonzero(greater(ids_unused,0))) + # print ' ids_unused_orig',ids_unused_orig,type(ids_unused_orig) + # print ' len(ids_unused_orig)',len(ids_unused_orig),ids_unused_orig.shape + # print ' greater(ids_unused_orig,0)',greater(ids_unused_orig,0) + # print ' len(greater(ids_unused_orig,0))',len(greater(ids_unused_orig,0)) + # print ' flatnonzero(greater(ids_unused_orig,0))',flatnonzero(greater(ids_unused_orig,0)) + # print ' + # len(flatnonzero(greater(ids_unused_orig,0)))=',len(flatnonzero(greater(ids_unused_orig,0)) + # ) + ids_unused = ids_unused_orig[ + flatnonzero(greater(ids_unused_orig, 0))] + zid = 1 + else: + if len(self._inds) == 0: + ids_unused = zeros(0, int) + else: + ids_unused = ids_unused_orig.copy() + + zid = 0 + + n_unused = len(ids_unused) + n_max = len(self._inds) - 1 + # print ' ids_unused',ids_unused + # print ' ids_unused.shape',ids_unused.shape + # print ' len(ids_unused)',len(ids_unused) + # print ' n_unused,n_max,zid=',n_unused,n_max,zid + + if n_max < zid: + # first id generation + ids = arange(zid, n + zid) + + elif n_unused > 0: + if n_unused >= n: + ids = ids_unused[:n] + else: + # print ' ids_unused',ids_unused + # print ' from to',n_max+1,n_max+1+n-n_unused + # print ' arange=',arange(n_max+1,n_max+1+n-n_unused) + # print ' type(ids_unused)',type(ids_unused) + # print ' dtype(ids_unused)',ids_unused.dtype + ids = concatenate( + (ids_unused, arange(n_max + 1, n_max + 1 + n - n_unused))) + + else: + ids = arange(n_max + 1, n_max + 1 + n) + + return ids # .tolist() + + def add_id_named(self, name, id=-1, **args): + """ + Creates array entries for id with given name. + + """ + if id < 0: + id = self.suggest_id() + # self._name_ids[name]=id + # print 'add_id_named',self.ident,name,'with id',id + self.create_ids(id, _name_ids=name, **args) + return id + + def create_ids(self, ids, **args): + """ + Creates for each id in ids list an entry for each attribute with + array or marray structure. + + If ids is a scalar integer, entries will be generated just for + this id. + + For named objects the list _name_ids_ is necessary + with a name correisponding to each id. + """ + # print 'create_ids',ids,args + # this is a short dirty way to allow also scalars for ids and arguments + if type(ids) not in ARRAYTYPES: + # turn scalar ids in list-vector... + ids = [ids] + for key in args.keys(): + args[key] = [args[key]] + + # print ' create_ids',ids,args + + # no ids to create + if len(ids) == 0: + return True + + n = len(ids) + id_max = max(ids) + id_max_old = len(self._inds) - 1 + n_array_old = len(self) + + ids_existing = take(ids, flatnonzero(less(ids, id_max_old))) + # print ' ids',ids,'id_max_old',id_max_old,'ids_existing',ids_existing + + # check here if ids are still available + if sometrue(not_equal(take(self._inds, ids_existing), -1)): + print 'WARNING in create_ids: some ids already in use', ids_existing + return False + + # extend index map with -1 as necessary + if id_max > id_max_old: + # print 'ext',-1*ones(id_max-id_max_old) + self._inds = concatenate( + (self._inds, -1 * ones(id_max - id_max_old, int))) + + # assign n new indexes to new ids + ind_new = arange(n_array_old, n_array_old + n) + + # print 'ind_new',ind_new + put(self._inds, ids, ind_new) + + # print ' concat ids..',self._ids,ids + self._ids = concatenate((self._ids, ids)) + + # if each id is supposed to have a _name_ids + # arguments must provide a list with names for each id + if self._named: + i = 0 + names = args['_name_ids'] + for id in ids: + # print ' id,names[i]',id,names[i] + self._id_names[names[i]] = id + i += 1 + + # Extend all arrays with n values from args or default + for attr in self._arrayconfig.keys(): + # print ' attr',attr + if args.has_key(attr): + value = args[attr] + if self._config[attr]['do_init_arrayobj']: + # newly assigned instances need to be array initialized + for i in range(len(ids)): + value[i].init_arrayobj(ids[i], self, + self.make_item_ident(attr, ids[i])) + else: + value = self._get_default(attr, ids=ids) + + # print ' + # ',attr,'self.__dict__[attr]',self.__dict__[attr],'value',value + if len(self.__dict__[attr]) > 0: + # print ' concat item..',value + self.__dict__[attr] = concatenate((self.__dict__[attr], value)) + else: + # tc=self._config[attr]['dtype'] + # print ' first item with tc',tc,'and value',value + # print ' ', array(value,dtype=tc)[0] + # self.__dict__[attr]=array(value,dtype=tc) + + # print ' let NumPy, Numeric or whatever guess the first + # arrayelement' + self.__dict__[attr] = array(value) + + # Extend all marrays with n values from args or default + for attr in self._marrayconfig.keys(): + + # generate a scalar/list of copies of defaults + items = args.get(attr, self._get_default(attr, ids=ids)) + self._append_items_marray(attr, ids, items) + + # assign defaults to all dicts + for attr in self._dictconfig.keys(): + i = 0 + for id in ids: + if args.has_key(attr): + value = args[attr][i] + if self._config[attr]['do_init_arrayobj']: + # print 'initialize',attr,value + value.init_arrayobj( + id, self, self.make_item_ident(attr, id)) + else: + value = self._get_default(attr, ids=id) + + # print ' dict attr=',attr,value + self.__dict__[attr][id] = value + + i += 1 + + if self._plugins.has_key(23): + self._execute_plugins(23, ids=ids) + + return True + + def print_attr(self, attr): + + config = self.get_config(attr) + if config: + + if config['struct'] == 'array': + # print ' ', attr,'=' + for id in self.get_ids(): + if config['is_function']: + val = self.__getitem__((attr, id)) + else: + val = self.__getitem__((attr, id)) + + print self.get_string_arrayattr(attr, id, val) + + elif config['struct'] == 'marray': + # print ' ', attr,'=' + for id in self.get_ids(): + if config['is_function']: + val = self.__getitem__((attr, id)) + else: + val = self.__getitem__((attr, id)) + + print self.get_string_arrayattr(attr, id, val) + + # print ' ',id,self._inds[id],\ + # val,config['unit'] + + elif config['struct'] == 'dict': + print ' ', attr, '=' + for id in self.get_ids(): + val = self.__dict__[attr][id] + print self.get_string_arrayattr(attr, id, val) + + # print ' ',id,self._inds[id],\ + # self.__dict__[attr][id],config['unit'] + + else: + ObjConfigurator.print_attr(self, attr) + + def get_string_arrayattr(self, attr, id, value): + """ + Returns a formatted string for array type attributes + with struct array, marray, dict + """ + # print 'get_string_arrayattr',attr,id,value + return ' ' + attr + '[' + str(id) + '] = ' +\ + self.get_string_attr_value(attr, value) + + def reset(self, attr): + """ + Reset attribute attr to default values + """ + # create attribute and if there are already arrays with entries, + # create the same number of entries with default value + # print 'reset',attr,len(self) + default = self._config[attr]['default'] + struct = self._config[attr]['struct'] + # declaredtype=self._config[attr]['type'][0] + + # configure if objects or instances need init_arrayobj with id + # self._config[attr]['do_init_arrayobj']=False # moved to default + if struct in ('array', 'marray', 'dict'): + # try to detect from defaults + if type(default) in [types.InstanceType, types.ClassType]: + if hasattr(default, 'init_arrayobj'): + # print ' detected init_arrayobj!!' + self._config[attr]['do_init_arrayobj'] = True + + # done in config + # elif type(default) == types.ClassType: + # if not self._config[attr].has_key('init'): + # # by default do not initialize classes + # # i they are nor arrayconfiguratored + # self._config[attr]['init']=False + + # check if instance or class type have been declared + # if self._config[attr]['type'] in ['InstanceType','ClassType']: + # self._config[attr]['do_init_arrayobj']=True + + # do reset now + if struct == 'array': + # generate a scalar/list of copies of defaults + defaults = self._get_default(attr, ids=self.get_ids()) + # print 'len:',self.__len__(),len(self) + + # register attribute in array database + # currently no particular info, just key + self._arrayconfig[attr] = {} + + # print 'reset',attr + + # all this not very clean, but works + default = self._config[attr]['default'] # the array element + if type(default) == ndarray: + # use dtype given by default element which is an array + tc = default.dtype.str + else: + # guess dtype from scalar types + tc = get_dtype(self._config[attr]['type'][-1]) + + self._config[attr]['dtype'] = tc + + # print ' tc=',tc,'type[-1]=',self._config[attr]['type'][-1] + # this print causes a strange error: + # 'FloatCanvas' object has no attribute 'this' + + self.__dict__[attr] = array(defaults, dtype=tc) + + # print ' created + # type',self.__dict__[attr].dtype,self.__dict__[attr].shape + + # self.__dict__[attr]=array(\ + # self._get_default(attr,ids=self.get_ids()), dtype=tc ) + + # print 'new array',self.__dict__[attr] + + elif struct == 'marray': + + # register attribute in array database + self._marrayconfig[attr] = {'bp': zeros((0, 2), int)} + + tc = get_dtype(self._config[attr]['type'][-1]) + self._config[attr]['dtype'] = tc + + # create new attribute with empty array + # will be determined with first append + self.__dict__[attr] = zeros((0), dtype=tc) + + # generate a scalar/list of copies of defaults + ids = self.get_ids() + defaults = self._get_default(attr, ids=ids) + + # print 'dtype',tc,default,'type =',self._config[attr]['type'] + if len(self._inds) > 0: + self._append_items_marray(attr, ids, defaults) + + # print 'reset: new marray',self.__dict__[attr] + + elif struct == 'dict': + # new attribute is a dictionary + ids = self.get_ids() + defaults = self._get_default(attr, ids=self.get_ids()) + + # currently no particolar info, just key + self._dictconfig[attr] = {} + self.__dict__[attr] = {} + # assign default value for each already existing id + for i in range(len(ids)): + id = ids[i] + self.__dict__[attr][id] = defaults[i] + + # print 'reset: new dict',attr,'=',self.__dict__[attr] + + else: + # handle other (scalar) attribute types with base configurator + ObjConfigurator.reset(self, attr) + + def copy_attrs(self, targetobj, ids=None, targetids=None, attrs=None): + """ + Copies given list of attributes of this object to given target object. + + If no attributes are given then all attributes of this object + are considered for copying. + + To copy an attribute, the foolowing conditions must be satisfied: + - the attribute must be configured with key copy=True + - the attribute must be configured in targetobject + """ + if attrs == None: + # get all attributes + attrs = self._config.keys() + + if ids == None: + # first copy all scalars + ObjConfigurator.copy(targetobj) + ids = self.get_ids() + + for attr in attrs: + config = self._config[attr] + if config['struct'] != 'scalar': + if config['copy']: + if targetobj.is_config(attr): + targetobj[attr, targetids] = self[attr, ids] + + def add_items(self, n=0, **args): + """ + Add new items into array structure. + The ids for each newly created item are returned in an array. + Usage: + + Add 3 new items: + ids=obj.add_items(3) + + Add 3 new items and setting attributes: + ids=obj.add_items(x=[11,22,33],v=[66,777,8888]) + + Add a single new item and set values + ids=obj.add_items(x=9,v=999) + + Add a single multi array element composed of 2 scalar integers: + ids=obj.add_items(s=[[111,2222]]) + + """ + + # determine number of items to be assigned + if n == 0: + if args: + key = args.keys()[0] + val = args[key] + if type(val) not in ARRAYTYPES: + # turn scalar val in list-vector... + args[key] = [val] + n = 1 + else: + n = len(val) + else: + # add by default one item only + n = 1 + else: + pass # use n from args + + # print 'base.add_items',n + + # determine new id + ids = self.suggest_ids(n) + + # print ' create new ids',ids + self.create_ids(ids, **args) + + # set values to attributes in arguments +# for attr in args.keys(): +# if attr in self._config.keys(): +# print attr,' before =' #,self.__dict__[attr] +# if self._config[attr]['struct']=='array': +# print ' insert in array',args[attr][0] +# print self._inds,ids,self._inds[ids] +# put(self.__dict__[attr],take(self._inds,ids),args[attr]) +# print attr,' after =',self.__dict__[attr] +# elif self._config[attr]['struct']=='marray': +# for i in range(n): +# self._insert_item_marray(attr,ids[i],args[attr][i]) +## +## +# elif self._config[attr]['struct']=='dict': +# for i in range(n): +# self.__dict__[attr][ids[i]]=args[attr][i] +# print ' dict',attr,self.__dict__[attr][ids[i]] +## +# else: +# print 'WARNING in add_items: unknown attribute:',attr + + return ids + + def __contains__(self, id): + if (id < len(self._inds)) & (id >= 0): + return self._inds[id] > -1 + else: + return False + + def contains_name(self, name): + return self._id_names.has_key(name) + + def __len__(self): + """ + Determine current array length (same for all arrays) + """ + + return len(self._ids) + + # def get_index(self,ids): + # """ + # returns index array from ids array + # Attetion thyis opration caused a crash during call from __del__ + # """ + # #print 'index',self._inds.dtype,type(ids),array(ids,int).dtype,len(ids) + # + # return self._inds[array(ids,int)] + # #if type(ids) in ARRAYTYPES: + # # #return take(self._inds,ids) + # # return self._inds[array(ids,int)] + # #else: + # # return self._inds[ids] + + def get_attr_named(self, attr, name): + """ + Returns value of array element of attribute attr + wich corresponds to id the given name. + + """ + if self._id_names.has_key(name): + return self[attr, self._id_names[name]] + else: + return None + + def set_attr_named(self, attr, name, value): + """ + Returns value of array element of attribute attr + wich corresponds to id the given name. + + """ + self[attr, self._id_names[name]] = value + + def __getitem__(self, key): + # print '__getitem__',key + + if type(key) != types.TupleType: + # return entire contents of attribure for all ids + attr = key + struct = self._config[attr]['struct'] + if struct == 'scalar': + if self._plugins.has_key(2): + self._execute_plugins(2, attr) + + if self._config[attr]['is_function']: + return getattr(self, attr)() + else: + return self.__dict__[attr] + + else: + # attribute is a kind of array + # take all ids in ascending order + ids = self.get_ids(ordered=True) + else: + # argument specify also id or ids to be returned + attr, ids = key + struct = self._config[attr]['struct'] + + if type(ids) in ARRAYTYPES: + # return array or list corresponding to ids + # print 'get array types',attr,ids,struct + # print ' self._inds=',self._inds + # ids=array(ids,int) + # print ' type (attr),type(ids)',type(self.__dict__[attr]),type(ids) + # print ' ids.dtype 1=',ids.dtype + # ids=array(ids,int) + # print ' ids.dtype 2=',ids.dtype + # print ' self._inds[ids]=',self._inds[ids] + # print ' array(ids,int).dtype=',array(ids,int).dtype + # executes plugins before values are returned to calling instance!! + if self._plugins.has_key(22): + self._execute_plugins(22, attr=attr, ids=ids) + + # this avoids problems with zero dimension arrays, + # (bizzar but possible) + + #if ids.shape==(): ids=array([ids]) + # print ' get array type ids=',ids,struct + + if struct == 'array': + if self._config[attr]['is_function']: + # print 'inds=',take(self._inds,ids) + return take(getattr(self, attr)(), take(self._inds, ids)) + else: + # print 'inds=',take(self._inds,ids) + # print take(self.__dict__[attr],take(self._inds,ids)) + # return take(self.__dict__[attr],take(self._inds,ids)) + return self.__dict__[attr][self._inds[array(ids, 'i')], :] + + elif struct == 'marray': + # here an array is returned with all elements of the + # those blocks that corresponds to the ids + # Note that this is a homogenious array , + # arrays with single blocks can be obtained by passing + # a single array. + if self._config[attr]['is_function']: + return getattr(self, attr)()[self.get_inds_marray(attr, ids), :] + # Numeric: + # return take(getattr(self,attr)(), + # self.get_inds_marray(attr,ids)) + else: + + # print ' inds_marray=',self.get_inds_marray(attr,ids) + # print ' self.__dict__[attr]=\n',self.__dict__[attr] + # print ' + # return=\n',self.__dict__[attr][self.get_inds_marray(attr,ids),:] + return self.__dict__[attr][self.get_inds_marray(attr, ids), :] + # Numeric: + # return take(self.__dict__[attr], + # self.get_inds_marray(attr,ids)) + + elif struct == 'dict': + items = [] + for id in ids: + # print ' ',id,self.__dict__[attr][id] + items.append(self.__dict__[attr][id]) + return items + + # this will never be executed!!!!!!!!!!! + # if self._plugins.has_key(22): + # self._execute_plugins(22,ids=ids) + + else: + # print 'return one array element, ids is a single id' + if self._plugins.has_key(22): + self._execute_plugins(22, attr, ids=array([ids], int)) + + if struct == 'array': + # print 'inds=',take(self._inds,[ids]),attr,getattr(self,attr) + + if self._config[attr]['is_function']: + return getattr(self, attr)()[self._inds[ids]] + else: + # try: + return self.__dict__[attr][self._inds[ids]] + # except: + # print 'ERROR in __getitem__', attr,ids + # print ' inds=',self._inds[ids] + # print ' attr=',self.__dict__[attr] + + elif struct == 'marray': + # here an array is returned with all elements of the + # block that corresponds to this id + if self._config[attr]['is_function']: + return getattr(self, attr)()[self.get_inds_marray(attr, [ids])] + # Numeric + # return take(getattr(self,attr)(), + # self.get_inds_marray(attr,[ids])) + else: + # print 'ids=',ids + # print + # 'self.get_inds_marray(attr,[ids]))=',self.get_inds_marray(attr,[ids]) + return getattr(self, attr)[self.get_inds_marray(attr, [ids])] + # Numeric: + # return take(self.__dict__[attr], + # self.get_inds_marray(attr,[ids])) + + elif struct == 'dict': + # print 'attr=',attr,ids + return self.__dict__[attr][ids] + + def __setitem__(self, key, value): + """ + Sets a value to an attribute + or to one or several elements of an attribute if + a list with ids is passed. + + Usage: + Scalar assignment + obj['attrname']=0.0 + + Single element asignment + obj['attrname',3]=33 + + Assign 11,22,33 to elements with ids 1,2,3 of attribite attrname + obj['attrname',[1,2,3]]=[11,22,33] + + Assign 3 elements of different size to marray + obj['attrname',[1,2,3]]=[[11,12,13],[21,22],[31]] + Note that the assigned value must be a python list of elements + and not a Numpy array + + """ + + # print 'setitem',key,'to',value + + if type(key) != types.TupleType: + self.__dict__[key] = value + if self._plugins.has_key(1): + self._execute_plugins(1, key) + return + + else: + attr, ids = key + if type(ids) not in ARRAYTYPES: + # ids is a scalar->make a list + ids = array([ids], int) + value = [value] + + struct = self._config[attr]['struct'] + # print 'inds=',self.get_index(ids) + if struct == 'array': + shape = self.__dict__[attr].shape + if len(shape) == 1: + # print 'put value',value,type(value) + # print ' attr,type(attr)',attr,type(self.__dict__[attr]) + # print ' dtype(attr)',self.__dict__[attr].dtype + # print ' + # self.get_index(ids)=',self.get_index(ids),type(self.get_index(ids)),self.get_index(ids).dtype + + self.__dict__[attr][self._inds[array(ids, 'i')]] = value + # put(self.__dict__[attr],self.get_index(ids),value) + + if self._config[attr]['do_init_arrayobj']: + # newly assigned instances need to be array initialized + for i in range(len(ids)): + value[i].init_arrayobj(ids[i], self, + self.make_item_ident(attr, ids[i])) + + else: + # this is an array of matrix or tensors or higher order + # the array must be flattened and the indexes must be + # calculated accordingly + + # m=product(shape[1:]) + # print 'put marray',m, + #inds=ones( (len(ids),1),int )*arange(m)\ + # +transpose([take(self._inds,ids)])*m + # print inds + + # print 'put value matrix',value,type(value) + # print ' attr,type(attr)',attr,type(self.__dict__[attr]) + # print ' dtype(attr)',self.__dict__[attr].dtype + # print ' inds=\n',self._inds[ids] + + if type(value) != ndarray: + # print 'value',value + value = array(value, dtype=self._config[attr]['dtype']) + # print 'value',value + + self.__dict__[attr][self._inds[ids], :] = value + # Numeric + #put(self.__dict__[attr],inds.ravel(), value.ravel()) + + if struct == 'marray': + for i in range(len(ids)): + self._insert_item_marray(attr, ids[i], value[i]) + + elif struct == 'dict': + for i in range(len(ids)): + self.__dict__[attr][ids[i]] = value[i] + if self._config[attr]['do_init_arrayobj']: + # newly assigned instances need to be array initialized + # self.print_config() + value.init_arrayobj( + id, self, self.make_item_ident(attr, id)) + # self.print_config() + + # print 'set_item:check plugins...',self.ident,self._plugins.keys() + if self._plugins.has_key(21): + self._execute_plugins(21, attr=attr, ids=ids) + + return + + def del_item_named(self, name): + """ + Deletes id with given name from all attributes + """ + del self[self._id_names[name]] + + def __delitem__(self, key): + # print 'ArrayObjConfigurator.__delitem__',self.ident,'key=',key + if key in self._config.keys(): + # delete attribute and its configuration + if self._plugins.has_key(0): + self._execute_plugins(0, key) + + if self._config[key]['struct'] == 'array': + del self._arrayconfig[key] + elif self._config[key]['struct'] == 'dict': + del self._dictconfig[key][id] + elif self._config[key]['is_function']: + self._functions.remove(key) + + for groupname in self._config[key]['group']: + self._groups[groupname].remove(key) + + del self._config[key] + del self.__dict__[key] + + else: + # key is one or multiple ids to be deleted from arrays + if type(key) not in ARRAYTYPES: + # ids is a scalar->make a list + ids = [key] + else: + ids = key + + # TODO: here it is not verified whether ids exist + # => verify and delete element by element + + # plugin execution BEFORE entry is deleted + if self._plugins.has_key(20): + self._execute_plugins(20, ids=ids) + + self._del_ids(ids) + + ########################################################################## + # private methods + + def _append_items_marray(self, attr, ids, items): + """ + Appends a list of items to multiary with attribute attr. + The block pointers are created automatically but + the indexes and ids must already exist in self._inds + + ids cannot be empty! + """ + # print 'append_items_marray',attr + # print ' ids=',ids + # print ' items=',items + marray = self.__dict__[attr] + # print 'marray=\n',marray + bp = self._marrayconfig[attr]['bp'] + len_bp = len(bp) + + # make sure that the bp vecor has enough index + + ind_max = max(self._inds) + + bpext = -1 * ones((ind_max - len_bp + 1, 2), int) + + if len_bp == 0: + bp = bpext + else: + bp = concatenate((bp, bpext)) + # print ' after extension bp=',bp + + # set block pointers for each id according to length of each item + i = len(marray) + n_elems = 0 # gives the total number of elements inside all items + for ii in range(len(ids)): + id = ids[ii] + ind = self._inds[id] + + # assume that id corresponds to a list with at least one item + # thus, calculate new block pointers + n = len(items[ii]) + j = i + n + n_elems += n + # print ' id,ind,i,j,len(items[ii])=',id,ind,i,j,len(items[ii]) + + bp[ind] = [i, j] + + i = j + + # print ' after asssignment bp=',bp + self._marrayconfig[attr]['bp'] = bp + + # put items in an array with coherent dimentions + shape_elem = array(items[0], int).shape[1:] + shape_array = [n_elems] + list(shape_elem) + # print ' shape_elem=',shape_elem + # print ' shape_array=',shape_array + # extend current marray by the corrct number of new elements + marrayext = zeros(shape_array, dtype=self._config[attr]['dtype']) + if len(marray) > 0: + # print ' concat extention to marray=\n',marrayext + marray = concatenate((marray, marrayext)) + else: + # print ' first marray_extension=\n',marrayext + marray = marrayext + + # now copy items into array is faster than concatenating each item + for ii in range(len(ids)): + id = ids[ii] + ind = self._inds[id] + i, j = bp[ind] + # print ' add item items[ii]',items[ii] + marray[i:j] = items[ii] + + self.__dict__[attr] = marray + + def _insert_item_marray(self, attr, id, item): + # print 'insert_item_marray',attr,id,item + # print ' attr=', self.__dict__[attr] + + # get block pointers for this attribute + bp = self._marrayconfig[attr]['bp'] + + # index of block pointers + ind = self._inds[id] + + # get from to index of m array for this id + [i, j] = bp[ind] + + # decide whether to overwrite existing + if j - i != len(item): + # first cut current data out of marray and adjust + # block pointers + self._del_item_marray(attr, id) + + # append data + self._append_items_marray(attr, [id], [item]) + else: + self.__dict__[attr][i:j] = item + + # print ' attr=', self.__dict__[attr] + + def _del_item_marray(self, attr, id): + + # get block pointers for this attribute + bp = self._marrayconfig[attr]['bp'] + + # index of block pointers + ind = self._inds[id] + + # get from to index of m array for this id + [i, j] = bp[ind] + + # print 'del_item_marray',attr,id,'from',i,'to',j + + # cut this piece out of the marray + # print ' before:',self.__dict__[attr] + self.__dict__[attr] = concatenate( + (self.__dict__[attr][:i], self.__dict__[attr][j:])) + + # print ' after:',self.__dict__[attr] + + # indicate that block pointer does no more point to anywhere + # calling method must take care of eliminating it or not + bp[ind] = [-1, -1] + # cut out index from blockpointers + #bp=concatenate( (bp[:ind], bp[ind+1:]) ) + + # now subtract j-i from all "to" index higher equal than j + subtract(bp, (j - i) * (bp >= j), bp) + + self._marrayconfig[attr]['bp'] = bp + + # def _get_bp_marray(self,attr): + # """May be useful, just not used """ + # return self._marrayconfig[attr]['bp'] + + def make_item_ident(self, attr, id): + """ + Generates the ident of attribute attr withy id. + """ + return self.ident + IDENTSEP + attr + IDENTSEP + str(id) + + def get_groupattrs(self, name, id=-1): + """ + Returns a dictionary with all attributes of a group. + Key is attribute name and value is attribute value for the given id. + """ + # print 'get_groupattrs of',name,'from',self.ident,self._groups.keys() + # print ' id=',id + attrs = {} + + if (name in self._groups.keys()) & self.is_ids(id): + for attr in self._groups[name]: + # attrs[attr]=self['attr'] + struct = self._config[attr]['struct'] + if (struct in ('dict', 'array', 'marray')): + default = self[attr, id] + # if default is an initialized class or an instance + # and has also a dict or array structure, + # then try to configure array object with id + + if type(default) == types.InstanceType: + # default is instance so just make a copy + obj = copy(default) + # now configure array object + # in this case class must have ArrayObj capabilities (mixin) + # if self._config[attr]['do_init_arrayobj']: + # obj.init_arrayobj(id,self,self.make_item_ident(attr,id)) + + elif (type(default) == types.ClassType) & \ + self._config[attr]['do_init_arrayobj']: + # default is a class that needs to be initialized first + obj = copy(default) + # obj.init_arrayobj(id,self,self.make_item_ident(attr,id)) + + elif type(default) == types.FunctionType: + # use base function to get other default types + obj = default + + else: + # use base function to get other default types + obj = copy(default) + + else: + # use base function to get other default types + obj = self.__dict__[attr] # attr() copy(default) + + attrs[attr] = obj + # else: + # print ' no attr found',self._groups.keys() + # print ' attrs=',attrs + return attrs + + def _get_default(self, attr, n=1, ids=None): + """ + Returns n default values for attribute with name attr_name + By default a scalar is returned. + If n>1 a list with n defaults is returned. + + Usage: + Return a scalar default + self._get_default('attr_name') + + Return list with 5 defaults + self._get_default('attr_name',5) + + Return list with 5 defaults, assigned with ids=[1,2,3,4,5]. + This usage makes only sense with Classes or instances + with ArrayObj mixin. + self._get_default('attr_name',ids=[1,2,3,4,5]) + + """ + # print '_get_default',self.ident,attr + + default = self._config[attr]['default'] + struct = self._config[attr]['struct'] + defaults = [] + + if ids == None: + # create dummy ids + ids = range(n) + returnlist = False + + elif type(ids) not in ARRAYTYPES: + # just a single id, do return a simple value, not a list + ids = [ids] + returnlist = False + else: + returnlist = True + + for id in ids: + if struct in ('dict', 'array', 'marray'): + # if default is an initialized class or an instance + # and has also a dict or array structure, + # then try to configure array object with id + + if type(default) == types.InstanceType: + # default is instance so just make a copy + obj = copy(default) + # now configure array object + # in this case class must have ArrayObj capabilities + # (mixin) + if self._config[attr]['do_init_arrayobj']: + obj.init_arrayobj( + id, self, self.make_item_ident(attr, id)) + + elif (type(default) == types.ClassType) & \ + self._config[attr]['do_init_arrayobj']: + # default is a class that needs to be initialized first + obj = default() + obj.init_arrayobj(id, self, self.make_item_ident(attr, id)) + + elif type(default) == types.FunctionType: + # use base function to get other default types + obj = default + + else: + # use base function to get other default types + obj = copy(default) + + else: + # use base function to get other default types + obj = ObjConfigurator._get_default(self, attr) + + # append to default list + defaults.append(obj) + + # print '_get_default array',defaults + if (n > 1) | returnlist: + + return defaults + else: + return defaults[0] + + def _del_ids(self, ids): + """ + Deletes id from all array - tpe attributes + """ + + # print 'ArrayConfigurator._del_ids',ids,'from',self.ident + + # delete ids from list , one by one + for id in ids: + # print ' start deleting id',id + + # print ' self._ids',self._ids + # print ' self._inds',self._inds + + # i=self.get_index(id) + i = self._inds[id] + + # print ' ind=',i + # print ' del rows from array-types...' + for attr in self._arrayconfig.keys(): + # print ' del',attr,id,i + + # print ' before=\n',self.__dict__[attr] + self.__dict__[attr] = concatenate( + (self.__dict__[attr][:i], self.__dict__[attr][i + 1:])) + # print ' after=\n',self.__dict__[attr] + + # print ' del from id lookup' + self._ids = concatenate((self._ids[:i], self._ids[i + 1:])) + + # print ' del from dicts' + for attr in self._dictconfig.keys(): + # print ' del',attr,id + del self.__dict__[attr][id] + + # print ' del from marrays' + for attr in self._marrayconfig.keys(): + self._del_item_marray(attr, id) + + # what's left is to cut out the db pointer with index i + bp = self._marrayconfig[attr]['bp'] + + # print ' del',attr,id,bp + + bp = concatenate((bp[:i], bp[i + 1:])) + self._marrayconfig[attr]['bp'] = bp + + # print ' free index',id + if id == len(self._inds) - 1: + # id is highest, let's shrink index array by 1 + self._inds = self._inds[:-1] + else: + self._inds[id] = -1 + + # get ids of all indexes which are above i + ids_above = flatnonzero(self._inds > i) + + # decrease index from those wich are above the deleted one + #put(self._inds, ids_above,take(self._inds,ids_above)-1) + self._inds[ids_above] -= 1 + + # print ' self._inds',self._inds + + if self._named: + # print ' Remove named' + for id in ids: + name = self._name_ids[id] + del self._id_names[name] + # print ' removed',name,id + + # print ' del',ids,' done.' + + def __setstate__test(self, state): + """ + This is setstate for array config only + and overrides the scalar version. + + The main purpose is to correct a conversion error in numpy + """ + print '__setstate__', self + + # this is alays required, but ill not be saved + self._plugins = {} + + for key in state.keys(): + value = state[key] + + # print ' set state',key + # print ' attr',key,type(value), + # if type(value)==ndarray: + # print value.dtype,value.shape + # else: + # print value + + if type(value) == ndarray: + if value.dtype == dtype('|O4'): + value = array(value, ' -1]) + + return ids_items + + def remove_items(self, ids_item, ids_queue=None): + """ + Remove integers in array ids_item from queues in array ids_queue + If no ids_queue is given, it will be recovered from the integer items + database. This may only be a disadvantage in terms of time. + """ + # print 'remove_items' + # print ' ids_item',ids_item + # print ' ids_queue',ids_queue + + if ids_queue == None: + ids_queue = self.items['ids_queue', ids_item] + + inds_queue = self.get_inds(ids_queue) + inds_item = self.items.get_inds(ids_item) + + # identify single + inds_single = (self.ids_last[inds_queue] == ids_item) & \ + (self.ids_first[inds_queue] == ids_item) + + if any(inds_single): + # remove single item in queues + inds_queue_single = inds_queue[inds_single] + self.ids_last[inds_queue_single] = -1 + self.ids_first[inds_queue_single] = -1 + + # identify last + inds_last = (self.ids_last[inds_queue] == ids_item) &\ + logical_not(inds_single) + + if any(inds_last): + # remove last items in queues + inds_queue_last = inds_queue[inds_last] + inds_item_last = inds_item[inds_last] + + ids_item_new_last = self.items.ids_prev[inds_item_last] + self.items['ids_next', ids_item_new_last] = -1 + self.ids_last[inds_queue_last] = ids_item_new_last + + # identify first + inds_first = (self.ids_first[inds_queue] == ids_item) &\ + logical_not(inds_single) + + if any(inds_first): + # remove first items in queues + inds_queue_first = inds_queue[inds_first] + inds_item_first = inds_item[inds_first] + + ids_item_new_first = self.items.ids_next[inds_item_first] + self.items['ids_prev', ids_item_new_first] = -1 + self.ids_first[inds_queue_first] = ids_item_new_first + + # identify middle + inds_middle = logical_not(inds_single) &\ + logical_not(inds_last) & logical_not(inds_first) + + if any(inds_middle): + # remove first items in queues + inds_queue_middle = inds_queue[inds_middle] + inds_item_middle = inds_item[inds_middle] + + # cutting items out of chains + ids_item_new_next = self.items.ids_next[inds_item_middle] + ids_item_new_prev = self.items.ids_prev[inds_item_middle] + + self.items['ids_next', ids_item_new_prev] = ids_item_new_next + self.items['ids_prev', ids_item_new_next] = ids_item_new_prev + + # finally remove pointer from items to queues + self.items.ids_queue[inds_item] = -1 + self.items.ids_next[inds_item] = -1 + self.items.ids_prev[inds_item] = -1 + + def insert_items_behind(self, ids_item, ids_item_beh, ids_queue): + """ + Insert integers in array ids_item into queues in array ids_queue + behind integers in array ids_item_beh + """ + # print 'insert_items_beh' + # print ' ids_item',ids_item + # print ' ids_queue',ids_queue + # print ' ids_item_beh',ids_item_beh + + # identify prepend + inds_prepend = ids_item_beh == -1 + if any(inds_prepend): + self.prepend_items(ids_item[inds_prepend], + ids_queue[inds_prepend]) + + # identify append + inds_append = (self['ids_last', ids_queue] == ids_item_beh) \ + & logical_not(inds_prepend) + if any(inds_append): + self.append_items(ids_item[inds_append], + ids_queue[inds_append]) + + # select rest + inds = logical_not(inds_prepend) & logical_not(inds_append) + + if any(inds): + # insert items where insertion somewhere in the middle + # of the buffer where first and last item is not effected + + # this task can therefore be handeled by item instance + self.items.insert_items_behind(ids_item[inds], + ids_item_beh[inds], + ids_queue[inds], + ) + + def append_items(self, ids_item, ids_queue): + """ + Append integers in array ids_items to queues in array ids_queue + """ + # print 'append_items' + # print ' ids_item',ids_item + # print ' ids_queue',ids_queue + + # different treatmet of empty and not empty queues + inds_empty = self.is_empty(ids_queue) + inds_not_empty = logical_not(inds_empty) + + # treat first empty queues + if len(inds_empty) > 0: + # print ' inds_empty',inds_empty + self['ids_first', ids_queue[inds_empty]] = ids_item[inds_empty] + self['ids_last', ids_queue[inds_empty]] = ids_item[inds_empty] + + if any(inds_not_empty): + + # treat queues with at least one item + ids_not_empty = ids_queue[inds_not_empty] + ids_item_not_empty = ids_item[inds_not_empty] + + # fix new first and last item + ids_item_prev = self['ids_last', ids_not_empty] + self['ids_last', ids_not_empty] = ids_item_not_empty + + # backward chaining + self.items['ids_prev', ids_item_not_empty] = ids_item_prev + + # forward chaining + self.items['ids_next', ids_item_prev] = ids_item_not_empty + + # assign queue id + self.items['ids_queue', ids_item] = ids_queue + + def prepend_items(self, ids_item, ids_queue): + """ + Prepend integers in array ids_items to queues in array ids_queue + """ + # print 'prepend_items' + # print ' ids_item',ids_item + # print ' ids_queue',ids_queue + + # different treatmet of empty and not empty queues + inds_empty = self.is_empty(ids_queue) + inds_not_empty = logical_not(inds_empty) + + # treat first empty queues + if len(inds_empty) > 0: + # print ' inds_empty',inds_empty + self['ids_first', ids_queue[inds_empty]] = ids_item[inds_empty] + self['ids_last', ids_queue[inds_empty]] = ids_item[inds_empty] + + if any(inds_not_empty): + + # treat queues with at least one item + ids_not_empty = ids_queue[inds_not_empty] + ids_item_not_empty = ids_item[inds_not_empty] + + # fix new first and last item + ids_item_next = self['ids_first', ids_not_empty] + self['ids_first', ids_not_empty] = ids_item_not_empty + # self['ids_last',ids_not_empty] = ids_items_next # not changed + + # forward chaining + self.items['ids_next', ids_item_not_empty] = ids_item_next + + # backward chaining + self.items['ids_prev', ids_item_next] = ids_item_not_empty + + # assign queue id + self.items['ids_queue', ids_item] = ids_queue + + def print_info(self): + """ + Print all usueful info + """ + self.print_config() + self.items.print_config() + + +class IntegerItems(ArrayObjConfigurator): + + """ + Class cotaining integer items (the ids) of the integer queue. + + This class can be used as mixin in order to add customized attributes to + each item. + + """ + + def __init__(self, parent, key='items', name='Integer items'): + """ + Main init used for stand alone. + """ + self.init_config(key, parent, name) + + self._init_items() + + def _init_items(self): + """ + Here the item specific states are initialized. + + queue_data is an optional database with additional information + on the queues where each id correspnds to a queue + + """ + + self.config('ids_queue', -1, + name='queue id', + info='ID of queue', + metatype='id', + ident_ref=self.parent.ident, + struct='array', + ) + + self.config('ids_next', -1, + name='next id', + info='ID of next', + metatype='id', + ident_ref='.', + struct='array', + ) + + self.config('ids_prev', -1, + name='previous id', + info='ID of previous', + metatype='id', + ident_ref='.', + struct='array', + ) + + def insert_items_behind(self, ids_item, ids_item_beh, ids_queue): + """ + UNUSED!! see integerqueue!! + + Insert integers in array ids_item into queues in array ids_queue + behind integers in array ids_item_beh. + + Please use insert_behind of the governing queue class! + + Attention this method is called by insert_behind of the + governing queue class, which selected already the cases where + this insertion is in the middle of the queue and does not effect + first or last item. + """ + # print 'IntegerItems.insert_items_beh' + # print ' ids_item',ids_item + # print ' ids_queue',ids_queue + # print ' ids_item_beh',ids_item_beh + + inds_item = self.get_inds(ids_item) + inds_item_beh = self.get_inds(ids_item_beh) + + # forward chaining + ids_item_next = self.ids_next[inds_item_beh] + self.ids_next[inds_item] = ids_item_next + self.ids_next[inds_item_beh] = ids_item + + # backward chaining + self.ids_prev[inds_item] = ids_item_beh + self['ids_prev', ids_item_next] = ids_item + + # assign queue id to inserted elements + self.ids_queue[inds_item] = ids_queue + + +class MetaList(ArrayObjConfigurator): + + """ + Empty class with ArrayObjConfigurator properties. + Can be freely configured to contain any kind of database like, + ordered list structures. + + Usage: + l=MetaList() + l.config('m',0.0,struct='marray') + l.create_ids([1,2,3,4]) + l.print_config() + """ + + def __init__(self, **args): + self.init_config('metalist') + + +class TestNamed(ArrayObjConfigurator): + + def __init__(self, **args): + self.init_config('test', named=True) + self.config('s', zeros((0,), float), struct='marray', + type=['IntType']) + + self.config('v', 0, struct='array') + self.add_id_named('one') + self.add_id_named('two') + + +class TestMod(ObjConfigurator, ArrayObj): + + """ + test + """ + + def __init__(self, **args): + """ + Mod specific Initialization. + self.id an parent is yet unknown + """ + pass + # print 'initialized TestMod' + + def config_with_id(self): + """ + Mod specific Initialization. + Now id and parent is known. + """ + self.init_config() + # print 'config_with_id',self.ident + self.config('y', 0.0, group=['state'], perm='w', digits_fraction=2) + self.config('z', 'text', group=['state'], perm='w') + self.config('cabins', Cabs(self)) + # self.print_config() + + +class Car(ArrayObj): + + """ + test + """ + + def __init__(self, **args): + """ + Mod specific Initialization. + self.id an parent is yet unknown + """ + print 'initialized CarMod' + + def config_with_id(self): + """ + Mod specific Initialization. + Now id and parent is known. + """ + pass + + +class CarTest(ArrayObjConfigurator): + + """ + test + """ + + def __init__(self, **args): + """Variable + """ + self.init_config('carstest') + self.config('a', 0.0, struct='array', group=[ + 'state', 'costs'], unit='m/s^2') + # self.config('mods',TestMod,struct='dict') + #self.config('m',[0.0, 0.0, 0.0],struct='array') + self.config('g', zeros((3, 4)), struct='array', unit='earth accel') + newids = self.suggest_ids(3) + self.create_ids(newids) + + +class Cars(ArrayObjConfigurator): + + """ + test + """ + + def __init__(self, **args): + """Variable + """ + self.init_config('cars') + self.config('x', 0.456685, group=[ + 'state'], perm='w', digits_fraction=2) + + self.config('color', [0.2, 0.8, 0.2], metatype='color', + struct='array', group=['parameter'], perm='w') + self.config('load', 'user', struct='dict', perm='r') + self.config('n', 0, struct='array', info='number', perm='w', + group=['state', 'parameters'], + min=0, max=5) + self.config('b', False, struct='array', perm='w', + info='bool...', group=['state', 'costs']) + self.config('a', 0.0, struct='array', info='acceleration', + group=['state', 'costs'], digits_fraction=2) + self.config('v', 0.0, struct='array', info='velocity', + group=['state'], unit='m/s', digits_fraction=2) + self.config('d', 0.0, unit='m', struct='array', + info='this is \nthe distance', digits_fraction=2) + self.config('j', 0.0, struct='array', perm='r', digits_fraction=2) + self.add_items(v=[8.7, 5.5, 34.1, 2], a=[-8, -5, -34, -2]) + + self.config('mods', TestMod, struct='dict') + self.config('m', [0.0, 0.0, 0.0], struct='array') + self.config('g', zeros((3, 4)), struct='array') + self.config('coords', array([0.0, 0.0, 0.0], float), + # type=['FloatType'], + struct='array', + name='coordinates', + info='Array with xyz coordinates of each node') + newids = self.suggest_ids(3) + self.create_ids(newids, v=[5, 6, 7]) + # print 'config=\n',self.get_config() + + +class ObjConfiguratorTest(ObjConfigurator): + + """ + test + """ + + def __init__(self, parent=None, **args): + """Variable + """ + self.init_config('ObjConfiguratorTest', parent) + self.config('d', [[1, 2]], type=[('ArrayType', (1, 2)), 'IntType']) + + +class Cabs(ArrayObjConfigurator): + + """ + test + """ + + def __init__(self, parent=None, **args): + """Variable + """ + self.init_config('cabs', parent) + self.config('d', [[1, 2]], type=[ + ('ArrayType', (1, 2)), 'IntType'], struct='dict') + self.create_ids([1, 2, 3, 4]) + self.config('a', 0.0, struct='array', group=[ + 'state', 'costs'], unit='m/s^2') + self.config('n', -1, struct='array') + self.config('g', zeros((3, 4)), struct='array', perm='r') + #self.config('v',0.0, struct='array', group=['state']) + # self.config('d',0.0,unit='m') + # self.config('j',0.0,struct='array') + # self.add_items(v=[8.7,5.5,34.1,2],a=[-8,-5,-34,-2]) + # self.config('coords',array([0.0,0.0,0.0]), + # struct='array', + # name='coordinates', + # info='Array with xyz coordinates of each node') + + +class MarrayTest(ArrayObjConfigurator): + + """ + test + from base import *;t=MarrayTest();t['s',1]=[11,22,33,44];t['s',3]=[-33,-44] + t.get_ids_marray('s',[1,]) + t['s',2]=[22,222,2222,22222] + t['s',[1,2]]=[[3,33,333],[55,555,5555,5555]] + t.get_ids_marray('s',[1,2,3]) + t.get_ids_marray('s',[1,]) + + """ + + def __init__(self, **args): + self.init_config('test') + self.config('s', zeros((0,)), struct='marray', + type=['IntType']) + + self.config('v', 0, struct='array') + + self.config('x', [[-1, -1]], + name='forward star', + info='Dict with node id as key and forward nodes as values', + doc='A dictionary with node id as key and \n' + + 'a dictionary with follower nodes as value. \n' + + 'Each follower node is a dictionary with \n' + + 'predecessor node id as key and arc id as value', + type=[('ArrayType', (1, 2)), 'IntType'], + struct='marray', + ) + + self.config('f', zeros((0,), dtype='i'), + name='forward nodes', + info='Dict with node id as key and forward nodes as values', + doc='A dictionary with node id as key and \n' + + 'a dictionary with follower nodes as value. \n' + + 'Each follower node is a dictionary with \n' + + 'predecessor node id as key and arc id as value', + type=[('ArrayType', (1,)), 'IntType'], + struct='marray', + ) + + self.config('m', [[0.0, 0.0, 0.0], [10.0, 10.0, 0.0]], struct='marray') + self.create_ids([1, 2, 3, 4]) + # self.config('s',[-1],struct='marray') + self.print_config() + + +def test_queue(): + q = IntegerQueues(None) + q.create_ids([1, 2, 3, 4]) + q.add_items(arange(0, 20, 2, int)) + + q.print_info() + + # q.prepend_items(array([2,1],int),array([4,3],int)) + # q.prepend_items(array([2,],int),array([3,],int)) + q.insert_items_behind(array([2, ], int), array( + [-1, ], int), array([2, ], int)) + + q.print_info() + + q.insert_items_behind(array([16, ], int), array( + [2, ], int), array([2, ], int)) + + q.print_info() + + q.prepend_items(array([4, 8], int), array([3, 2], int)) + + q.print_info() + + q.append_items(array([6, ], int), array([1, ], int)) + + q.print_info() + + q.append_items(array([10, 12], int), array([1, 3], int)) + + q.print_info() + + q.insert_items_behind(array([18, ], int), array( + [2, ], int), array([2, ], int)) + + q.print_info() + + q.remove_items(array([18, ], int)) + + q.print_info() + + q.remove_items(array([16, ], int)) + + q.print_info() + + q.remove_items(array([8, ], int)) + + q.print_info() + + q.remove_items(array([2, ], int)) + + q.print_info() + + print '\npop all', q.pop_items(q.get_ids()) + print '\npop all', q.pop_items(q.get_ids()) + print '\npop all', q.pop_items(q.get_ids()) + +############################################################################### +if __name__ == '__main__': + """ + Test + """ + + test_queue() + + exit(0) + + # a=array([[1,2,3],[4,5,6],[7,8,9],[11,22,33]]) + # b=array([[1,0,1],[1,1,1],[1,0,0],[0,0,0]]) + + # cd C:\Documents and Settings\joerg\Documenti\projects\its + # import sys; sys.path[:0] = ['C:\Users\joerg\projects\sim\its'] + #from lib.base import * + cabs = Cabs() + cabs.print_config() + + # t=MarrayTest();t['s',1]=[11,22,33,44];t['s',3]=[-33,-44] + # t.get_ids_marray('s',[1,]) + # t['s',2]=[22,222,2222,22222] + # t['s',[1,2]]=[[3,33,333],[55,555,5555,5555]] + # t.get_ids_marray('s',[1,2,3]) + # t.get_ids_marray('s',[1,]) + + t = ObjConfiguratorTest() + t.print_config() + + save_obj(t, 'test.txt') + t = load_obj('test.txt') diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/classman.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/classman.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/classman.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/classman.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,2979 +1,2832 @@ - -# python classman.py - -# TODO: -# - store old values in attrcons and recover with undo - - -## To be or not to be. -- Shakespeare -## To do is to be. -- Nietzsche -## To be is to do. -- Sartre -## Do be do be do. -- Sinatra - -# save with is saved flag -# xml mixin -# different attrconfig classe (numbers, strings, lists, colors,...) - -import types, os, pickle, sys, string -from collections import OrderedDict -from datetime import datetime -#import numpy as np -import xmlman as xm -from logger import Logger - - -########## - - - -# event triggers -# plugtype plugcode -EVTDEL = 0 # delete attribute -EVTSET = 1 # set attribute -EVTGET = 2 # get attribute -EVTADD = 3 # add/create attribute - -EVTDELITEM = 20 # delete attribute -EVTSETITEM = 21 # set attribute -EVTGETITEM = 22 # get attribute -EVTADDITEM = 23 # add/create attribute - - - -ATTRS_NOSAVE = ('value','plugin','_obj','_manager','get','set','add','del','delete','childs','parent','_attrconfig_id_tab') -ATTRS_SAVE = ('ident','_name','managertype','_info','xmltag') -ATTRS_SAVE_TABLE = ('_is_localvalue','attrname','_colconfigs','_ids','_inds','_attrconfigs','_groups','plugin','_is_indexing', '_index_to_id','_id_to_index') - -STRUCTS_COL = ('odict','array') -STRUCTS_SCALAR = ('scalar','list','matrix','scalar.func') - - - -def save_obj(obj,filename, is_not_save_parent=False): - """ - Saves python object to a file with filename. - Filename may also include absolute or relative path. - If operation fails a False is returned and True otherwise. - """ - #print 'save_obj',is_not_save_parent,filename,obj.parent - try: - file=open(filename,'wb') - except: - print 'WARNING in save: could not open',filename - return False - - if is_not_save_parent: - parent = obj.parent - obj.parent = None - #print ' before',is_not_save_parent,parent,obj.parent - pickle.dump(obj, file, protocol=2) - file.close() - # set all objects and attrubutes to unsaved again - # obj.set_unsaved() - # no, decided to eliminate _is_saved restriction - #print ' after',is_not_save_parent,parent,obj.parent - if is_not_save_parent: - obj.parent=parent - return True - -def load_obj(filename,parent=None): - """ - Reads python object from a file with filename and returns object. - Filename may also include absolute or relative path. - If operation fails a None object is returned. - """ - print 'load_obj',filename - try: - file=open(filename,'rb') - except: - print 'WARNING in load_obj: could not open',filename - return None - - #try: - #print ' pickle.load...' - obj=pickle.load(file) - file.close() - #print ' obj._link2' - - # init_postload_internal is to restore INTERNAL states from INTERNAL states - #print 'load_obj->init_postload_internal',obj.ident - obj.init_postload_internal(parent) - - # init_postload_external is to restore INTERNAL states from EXTERNAL states - # such as linking - obj.init_postload_external() - - # _init4_ is to do misc stuff when everything is set - #obj._init4_config() - - return obj - -#class ObjXmlMixin: - - - -#class AttrXmlMixin: - - - - -class Plugin: - - def __init__(self,obj, is_enabled = True): - self._obj = obj # this can be either attrconf or main object - self._events = {} - self._has_events = False - self._is_enabled = is_enabled - - def add_event(self,trigger,function): - """ - Standard plug types are automatically set but the system: - - """ - if not self._events.has_key(trigger): - self._events[trigger] = [] - self._events[trigger].append(function) - self._has_events = True - - def del_event(self,trigger): - del self._events[trigger] - if len(self._events)==0: - self._has_events = False - - def enable(self, is_enabled=True): - self._is_enabled = is_enabled - - def exec_events(self,trigger): - if self._has_events & self._is_enabled: - #print '**PuginMixin.exec_events',trigger,(EVTGETITEM,EVTGET) - #if trigger!=EVTGET: - # print ' call set_modified',self._obj - # self._obj.set_modified(True) - - for function in self._events.get(trigger,[]): - function(self._obj) - - def exec_events_attr(self,trigger, attrconfig): - if self._has_events & self._is_enabled: - #print '**PuginMixin.exec_events',trigger,(EVTGETITEM,EVTGET) - #if trigger!=EVTGET: - # print ' call set_modified',self._obj - # self._obj.set_modified(True) - - for function in self._events.get(trigger,[]): - function(self._obj,attrconfig) - - def exec_events_ids(self,trigger, ids): - """ - Executes all functions assigned for this trigger for multiple ids. - """ - if self._has_events & self._is_enabled: - #print '**ArrayConf._execute_events_keys',self.attrname,trigger,(EVTGETITEM,EVTGET) - #if trigger!=EVTGETITEM: - # #print ' call set_modified',self._manager - # self._manager.set_modified(True) - - for function in self._events.get(trigger,[]): - function(self._obj, ids) - - -class AttrConf: - """ - Contains additional information on the object's attribute. - """ - def __init__(self, attrname, default, - groupnames = [], perm='rw', - is_save = True, - #is_link = False, # define link class - is_copy = True, - name = '', info = '', - unit = '', - xmltag = None, - is_plugin = False, - struct = 'scalar', # - metatype = '', # - **attrs): - #if struct == 'None': - # if hasattr(default, '__iter__'): - # struct = 'scalar' - # else: - # struct = 'list' - - # these states will be saved and reloaded - self.attrname = attrname - self.groupnames = groupnames - self.metatype = metatype - self.struct = struct - - self._default = default - - - self._is_save = is_save - self._is_copy = is_copy - self._is_localvalue = True # value stored locally, set in set_manager - self._unit = unit - self._info = info - self._name = name - self._perm = perm - - # states below need to be resored after load - self._manager = None # set later by attrsman , necessary? - self._obj = None # parent object, set later by attrsman - - self._is_modified = False - self._is_saved = False - - self.init_plugin(is_plugin) - #self._init_xml(xmltag) - self.xmltag = xmltag - self.xmlsep = attrs.get('xmlsep',' ') - - # set rest of attributes passed as keyword args - # no matter what they are used for - for attr, value in attrs.iteritems(): - setattr(self,attr,value) - - - def is_save(self): - return self._is_save - - def has_group(self, groupname): - return groupname in self.groupnames - - def enable_plugin(self, is_enabled=True): - if is_plugin: - self.plugin.enable(is_enabled) - - def get_metatype(self): - return self.metatype - - def init_plugin(self, is_plugin): - if is_plugin: - self.plugin = Plugin(self) - self.set = self.set_plugin - self.get = self.get_plugin - else: - self.plugin = None - - #def _init_xml(self,xmltag=None): - # if xmltag != None: - # self.xmltag = xmltag - # else: - # self.xmltag = self.attrname - - - def write_xml(self, fd): - if self.xmltag!= None: - self._write_xml_value(self.get_value(),fd) - - - def _write_xml_value(self,val,fd): - #print 'write_xml',self.xmltag,hasattr(val, '__iter__') - if self.metatype == 'color': - fd.write(xm.color(self.xmltag,val)) - - elif hasattr(val, '__iter__'): - if len(val)>0: - if hasattr(val[0], '__iter__'): - # matrix - fd.write(xm.mat(self.xmltag,val)) - else: - # list - fd.write(xm.arr(self.xmltag,val,self.xmlsep)) - else: - # empty list - #fd.write(xm.arr(self.xmltag,val)) - # don't even write empty lists - pass - - elif hasattr(self,'xmlmap'): - if self.xmlmap.has_key(val): - fd.write(xm.num(self.xmltag,self.xmlmap[val])) - else: - fd.write(xm.num(self.xmltag,val)) - - elif hasattr(self,'choices'): - if type(self.choices) == types.ListType: - fd.write(xm.num(self.xmltag,val)) - else: - #print '_write_xml_value',self.attrname - #print ' val,self.choices.values()',val,self.choices.values() - i = self.choices.values().index(val) - fd.write(xm.num(self.xmltag,self.choices.keys()[i])) - - - - - elif type(self._default) == types.BooleanType:# use default and hope it is no a numpy bool!!! - if val: - fd.write(xm.num(self.xmltag,1)) - else: - fd.write(xm.num(self.xmltag,0)) - - elif type(self._default) in (types.UnicodeType ,types.StringType ): - if len(val)>0: - fd.write(xm.num(self.xmltag,val)) - - - else: - # scalar number or string - fd.write(xm.num(self.xmltag,val)) - - def get_name(self): - return self._name - - def is_modified(self): - #print 'is_modified', self.attrname, self._is_modified - return self._is_modified - - def set_modified(self, is_modified): - self._is_modified = is_modified - - def set_manager(self, manager): - """ - Method to set manager to attribute configuration object. - This is either attribute manager or table manager. - Used by add method of AttrManager - """ - self._manager = manager - self._is_localvalue = manager.is_localvalue() - - - def get_manager(self): - """ - Method to get manager to attribute configuration object. - """ - return self._manager - - def set_obj(self, obj): - """ - Method to set instance of managed object. - Used by add method of AttrManager - """ - self._obj = obj - - def get_obj(self): - return self._obj - - - def get(self): - # return attribute, overridden with indexing for array and dict struct - return self.get_value() - - def set(self, value): - # set attribute, overridden with indexing for array and dict struct - if value != self.get_value(): - self.set_value(value) - self._is_modified = True - return value - - - - def get_plugin(self): - """ - Default get method with plugin for scalar attrs - """ - # return attribute, overridden with indexing for array and dict struct - self.plugin.exec_events(EVTGET) - - return self.get_value() - - def set_plugin(self, value): - """ - Default set method with plugin for scalar attrs - """ - # set attribute, overridden with indexing for array and dict struct - if value != self.get_value(): - self.set_value(value) - self._is_modified = True - self.plugin.exec_events(EVTSET) - - return value - - - def get_default(self): - return self._default - - def get_init(self): - """ - Returns initialization of attribute. - Usually same as get_default for scalars. - Overridden by table configuration classes - """ - value = self.get_default() - # store locally if required - if self._is_localvalue: - self.value = value - return value - - - - def reset(self): - if self._is_localvalue: - self.value = self.get_default() - else: - setattr(self._obj,self.attrname,self.get_default()) - - def clear(self): - self.reset() - - #def is_tableattr(self): - # return self.struct in ('dict','array','list') - - def set_perm(self, perm): - self._perm = perm - - def get_perm(self): - return self._perm - - def is_readonly(self): - return 'w' not in self._perm - - def is_writable(self): - return 'w' in self._perm - - def is_editable(self): - """Can attribute be edited """ - return 'e' in self._perm - - - def has_unit(self): - return self._unit != '' - - - - def has_info(self): - return self.get_info() != None - - def is_colattr(self): - return hasattr(self, '__getitem__') - - def get_info(self): - if self._info == None: - return self.__doc__ - else: - return self._info - - def format_unit(self, show_parentesis=False): - if self._unit in ('',None): - return '' - if show_parentesis: - return '[%s]'%self._unit - else: - return '%s'%self._unit - - - def format_value(self, show_unit = False, show_parentesis=False): - if show_unit: - unit = ' '+self.format_unit(show_parentesis) - else: - unit = '' - #return repr(self.get_value())+unit - return str(self.get_value())+unit - - def format_symbol(self): - if hasattr(self,'symbol'): - symbol = self.symbol - else: - symbol = self._name - - return symbol+' '+self.format_unit(show_parentesis=True) - - - #### - def get_value(self): - # always return attribute, no indexing, no plugin - if self._is_localvalue: - return self.value - else: - return getattr(self._obj, self.attrname) - - - def set_value(self, value): - #set entire attribute, no indexing, no plugin - #print 'AttrConf.set_value',self.attrname, self._is_localvalue, value, type(value) - if self._is_localvalue: - self.value = value - else: - return setattr(self._obj, self.attrname, value) - - - - - - - - - def predelete(self): - """ - Cleanup operations before deleting - """ - if self._is_localvalue: - del self.value # delete value - else: - del self._obj.__dict__[self.attrname] # delete value - - - #def init_presave_internal(self, man, obj): - # pass - # not a good idea to delete links, plugins here - - #def save_value(self, state): - # """ - # Save attribute value of managed object to state dict. - # - # move this into __getstate__ - # - # restore value in _obj during postllad_external - # - # make _getstate_ for speecific save - # """ - # #print 'save_value',self.attrname,self._is_save, self._is_localvalue, - # # - # # Attention can be called fron __getstate__ of obj if _is_localvalue=False - # # or from __getstate__ of attribute config if _is_localvalue=True - - - def _getstate_specific(self, state): - """ - Called by __getstate__ to add/change specific states, - before returning states. - To be overridden. - """ - pass - - def __getstate__(self): - #print '__getstate__',self.ident - #print ' self.__dict__=\n',self.__dict__.keys() - if self._is_saved: - # this message indicates a loop!! - print 'WARNING in __getstate__: Attribute already saved:',self.get_obj().format_ident_abs(),self.attrname - state={} - for attr in self.__dict__.keys(): - - if attr =='plugin': - plugin = self.__dict__[attr] - if plugin!=None: - state[attr] = True - else: - state[attr] = False - - elif attr not in ATTRS_NOSAVE: - state[attr] = self.__dict__[attr] - - if self._is_save: - self._is_modified = False - state['value']= self.get_value() - - self._getstate_specific(state) - return state - - - def __setstate__(self,state): - #print '__setstate__',self - - # this is always required, but will not be saved - self.plugins={} - - for attr in state.keys(): - #print ' set state',key - - #done in init_postload_internal... - #if attr=='plugin': - # if state[attr]==True: - # self.__dict__[attr] = Plugin(self) - # else: - # self.__dict__[attr]= None - #else: - self.__dict__[attr]=state[attr] - - def init_postload_internal(self, man, obj): - #print 'AttrConf.init_postload_internal',self.attrname,hasattr(self,'value'),self._is_save,self._is_localvalue,'obj:',obj.ident - self.set_manager(man) - self.set_obj(obj) - self.init_plugin(self.plugin) - - # set initial values for unsafed attributes - if not self._is_save: - self.set_value(self.get_init()) - else: - if self._is_localvalue: - # OK self.value already set in __setstate__ - pass - else: - setattr(self._obj, self.attrname, self.value) # TODO: could be made nicer with method - del self.value # no longer needed - - #print ' check',hasattr(self,'value') - self._is_saved = False - - - def init_postload_external(self): - pass - -class NumConf(AttrConf): - """ - Contains additional information on the object's attribute. - Here specific number related attributes are defined. - """ - def __init__(self, attrname, default, - digits_integer = None, digits_fraction=None , - minval = None, maxval = None, - **kwargs): - self.min = minval - self.max = maxval - self.digits_integer = digits_integer - self.digits_fraction = digits_fraction - - AttrConf.__init__(self, attrname, default, metatype = 'number', - **kwargs - ) - -class ObjConf(AttrConf): - """ - Contains additional information on the object's attribute. - Configures Pointer to another object . - This other object must have an ident. - it can be either a child (then it will be saved) - or a link (then only the id will saved) - If it is a child the is_child = True (default value) - """ - - def __init__(self, valueobj, is_child = True, **kwargs): - attrname = valueobj.get_ident() - self._is_child = is_child - AttrConf.__init__(self, attrname, valueobj, - struct = 'scalar', - metatype = 'obj', - perm = 'r', - **kwargs - ) - - - - - def set_obj(self, obj): - """ - Method to set instance of managed object. - Used by add method of AttrManager - """ - #print 'ObjConf.set_obj',self.attrname,obj.ident - AttrConf.set_obj(self, obj) - - if self._is_child: - # tricky: during first initialization - # child instance is stored in default - obj.set_child(self) - - def predelete(self): - AttrConf.predelete(self) - if self._is_child: - self.get_obj().del_child(self.attrname) - - - def reset(self): - if self._is_child: - self.get_value().reset() - - def clear(self): - if self._is_child: - self.get_value().clear() - - - def is_child(self): - return self._is_child - - - - - def _getstate_specific(self, state): - """ - Called by __getstate__ to add/change specific states, - before returning states. - To be overridden. - """ - if self._is_save: - if self._is_child: - # OK self.value already set in - pass - else: - # remove object reference from value and create ident - state['value']= None - state['_ident_value'] = self.get_value().get_ident_abs() - - def is_modified(self): - #if self._is_child - #is_modified = self.get_value().is_modified() - #print 'is_modified', self.attrname, is_modified - return self.get_value().is_modified() - - def set_modified(self, is_modified): - if self._is_child: - self.get_value().set_modified(is_modified) - - - def write_xml(self, fd): - """ - Objects are not written here, but in write_xml of the parent obj. - """ - pass - - def init_postload_internal(self, man, obj): - #print 'ObjConf.init_postload_internal',self.attrname,hasattr(self,'value'),self._is_save,self._is_localvalue,'parent obj:',obj.ident - - AttrConf.init_postload_internal(self, man, obj) - if self._is_child: - #print ' make sure children get initialized' - #self.get_value().init_postload_internal(obj) - #print ' call init_postload_internal of',self.get_value().ident,self.get_value(),self.get_value().__class__,self.get_value().init_postload_internal - self.get_value().init_postload_internal(obj) - - - def init_postload_external(self): - if self._is_child: - # restore normally - AttrConf.init_postload_external(self) - self.get_value().init_postload_external() - else: - # Substitute absolute ident with link object. - # Called from init_postload_external of attrsman during load_obj - # - ident_abs = self._ident_value - #print 'reset_linkobj',self.attrname,ident_abs - obj = self.get_obj() - rootobj = obj.get_root() - #print ' rootobj',rootobj.ident - linkobj = rootobj.get_obj_from_ident(ident_abs) - #print ' linkobj',linkobj.ident - self.set_value(linkobj) - - - - #def get_valueobj(self): - # """ - # This is called by get_childobj to retrive the child instance. - # """ - # return self.get_value() - - def get_name(self): - return self.get_value().get_name() - - def get_info(self): - return self.get_value().__doc__ - - def format_value(self, show_unit = False, show_parentesis=False): - return repr(self.get_value()) - - - - - -class FuncConf(AttrConf): - """ - Configures a function. - The function with name funcname must be a method of the object. - Default value is used to specify the type of output. - """ - - def __init__(self, attrname, funcname, exampleoutput,struct = 'scalar.func', **kwargs): - self.funcname = funcname - - - AttrConf.__init__(self, attrname, exampleoutput, - struct = struct, - perm = 'r', - is_save = False, - **kwargs - ) - - - - - def set_obj(self, obj): - AttrConf.set_obj(self, obj) - if self._info == '': - self._info = getattr(self._obj, self.funcname).__doc__ - - - def get_value(self): - # always return attribute, no indexing, no plugin - return getattr(self._obj, self.funcname)() - #if self._is_localvalue: - # return self.value - #else: - # return getattr(self._obj, self.attrname) - - def get_function(self): - return getattr(self._obj, self.funcname) - - def set_value(self, value): - #set entire attribute, no indexing, no plugin - #print 'AttrConf.set_value',self.attrname, self._is_localvalue, value, type(value) - return None - - - def is_modified(self): - return False - - def reset(self): - pass - - def clear(self): - pass - - - - - - - - - - - - - - -class Indexing: - """ - Mixing to allow any column attribute to be used as index. - """ - def _init_indexing(self): - """ - Init Indexing management attributes. - """ - - self._index_to_id = {}#OrderedDict() - - # this updates index if values already exist - if hasattr(self,'value'): - ids = self.get_obj().get_ids() - self.add_indices(ids, self[ids]) - - def reset_index(self): - self._init_indexing() - - def get_indexmap(self): - return self._index_to_id - - def get_id_from_index(self, index): - return self._index_to_id[index] - - def has_index(self, index): - return self._index_to_id.has_key(index) - - def get_ids_from_indices(self, indices): - ids = len(indices)*[0] - for i in range(len(indices)): - #if not self._index_to_id.has_key(indices[i]): - # print 'WARNING from get_ids_from_indices: no index',indices[i] - # print self._index_to_id - ids[i]=self._index_to_id[indices[i]] - return ids - - def get_ids_from_indices_save(self, indices): - ids = len(indices)*[0] - for i in range(len(indices)): - if not self._index_to_id.has_key(indices[i]): - ids[i]= -1 - else: - ids[i]=self._index_to_id[indices[i]] - return ids - - - - # use set instead of add - def add_indices(self, ids, indices): - for _id, index in zip(ids,indices): - self.add_index(_id, index) - - def add_index(self,_id, index): - self._index_to_id[index] = _id - - def del_indices(self, ids): - for _id in ids: - self.del_index(_id) - - def set_index(self,_id, index): - #print 'set_index',self._index_to_id - self.del_index(_id) - self.add_index(_id, index) - - def set_indices(self,ids, indices): - self.del_indices(ids) - self.add_indices(ids, indices) - - - - - def del_index(self,_id): - index = self[_id] - # when index is added (with set) no previous index value exists - if self._index_to_id.has_key(index): - del self._index_to_id[index] - - def get_ids_sorted(self): - #print 'get_ids_sorted',self.value - #print ' _index_to_id',self._index_to_id - #print ' sorted',sorted(self._index_to_id.iteritems()) - return OrderedDict(sorted(self._index_to_id.iteritems())).values() - - -class ColConf(Indexing, AttrConf): - """ - Basic column configuration. - Here an ordered dictionary is used to represent the data. - #>>> from collections import OrderedDict - #>>> spam = OrderedDict([('s',(1,2)),('p',(3,4)),('a',(5,6)),('m',(7,8))]) - >>> spam.values() - - """ - #def __init__(self, **attrs): - # print 'ColConf',attrs - - def __init__(self, attrname, default, is_index=False, **attrs): - #print 'ColConf',attrs - self._is_index = is_index - AttrConf.__init__(self, attrname, default, - struct = 'odict', - **attrs) - - if is_index: - self._init_indexing() - - - def is_index(self): - return self._is_index - - def get_defaults(self, ids): - # create a list, should work for all types and dimensions - # default can be scalar or an array of any dimension - #print '\n\nget_defaults',self.attrname,ids,self.get_default() - values = [] - for _id in ids: - values.append(self.get_default()) - #len(ids)*self.get_default() # makes links, not copies - return values - - def get_init(self): - """ - Returns initialization of attribute. - Usually same as get_default for scalars. - Overridden by table configuration classes - """ - ids = self._manager.get_ids() - - #print '\n\nget_init',self.attrname,ids - values = self.get_defaults(ids) - i = 0 - odict = OrderedDict() - for _id in ids: - odict[_id] = values[i] - i +=1 - # store locally if required - if self._is_localvalue: - self.value = odict - # pass on to calling instance - # in this cas the data is stored under self._obj - return odict - - def reset(self): - # this reset works also for np arrays! - odict = self.get_init() - if not self._is_localvalue: - setattr(self._obj, self.attrname, odict) - if self._is_index: - self.reset_index() - - - def init_plugin(self, is_plugin): - if is_plugin: - self.plugin = Plugin(self) - self.set = self.set_plugin - self.get = self.get_plugin - self.add = self.add_plugin - self.delete = self.delete_plugin - else: - self.plugin = None - - - def write_xml(self, fd, _id): - if self.xmltag!= None: - self._write_xml_value(self[_id],fd) - - - def __delitem__(self, ids): - #print ' before=\n',self.__dict__[attr] - #attr = self.attrconf.get_attr() - if hasattr(ids, '__iter__'): - if self._is_index: - self.del_indices(ids) - - array = self.get_value() - for _id in ids: - del array[_id] - - else: - if self._is_index: - self.del_index(ids) - - del self.get_value()[ids] - - - def delete_item(self, _id): - #print ' before=\n',self.__dict__[attr] - #attr = self.attrconf.get_attr() - del self.get_value()[_id] - - def __getitem__(self, ids): - #print '__getitem__',key - if hasattr(ids, '__iter__'): - items = len(ids)*[None] - i = 0 - array = self.get_value() - for _id in ids: - items[i] = array[_id] - i+=1 - return items - else: - return self.get_value()[ids] - - def __setitem__(self, ids, values): - #print '__setitem__',ids,values,type(self.get_value()) - if hasattr(ids, '__iter__'): - if self._is_index: - self.set_indices(ids, values)# must be set before setting new value - i = 0 - array = self.get_value() - for _id in ids: - array[_id] = values[i] - i+=1 - #if self._is_index: - # self.add_indices(ids, values) - else: - - if self._is_index: - self.set_index(ids,values)# must be set before setting new value - self.get_value()[ids]=values - - - #if self._is_index: - # self.add_index(ids, values) - - - - def add(self, ids, values = None): - if not hasattr(ids, '__iter__'): - _ids = [ids] - if values != None: - _values = [values] - else: - _ids = ids - _values = values - - if values == None: - _values = self.get_defaults(_ids) - - #print 'add ids, _values',ids, _values - # trick to prevent updating index before value is added - if self._is_index: - is_index_backup = True - self._is_index = False - else: - is_index_backup = False - - self[_ids] = _values - - - if is_index_backup: - self._is_index = True - self.add_indices(_ids, _values) - - self._is_modified = True - - - def add_plugin(self, ids, values = None): - if not hasattr(ids, '__iter__'): - _ids = [ids] - if values != None: - _values = [values] - else: - _ids = ids - _values = values - - #print 'add ids, _values',ids, _values - if values == None: - _values = self.get_defaults(_ids) - # trick to prevent updating index before value is added - if self._is_index: - is_index_backup = True - self._is_index = False - else: - is_index_backup = False - - self[_ids] = _values - - - if is_index_backup: - self._is_index = True - self.add_indices(_ids, _values) - - self._is_modified = True - - if self.plugin: - self.plugin.exec_events_ids(EVTADDITEM, _ids) - - - def get(self,ids): - """ - Central function to get the attribute value associated with ids. - should be overridden by specific array configuration classes - """ - return self[ids] - - def get_plugin(self,ids): - """ - Central function to get the attribute value associated with ids. - should be overridden by specific array configuration classes - """ - if self._plugin: - if not hasattr(ids, '__iter__'): - self.plugin.exec_events_ids(EVTGETITEM, [ids]) - else: - self.plugin.exec_events_ids(EVTGETITEM, ids) - return self[ids] - - def set(self, ids, values): - """ - Returns value of array element for all ids. - """ - - self[ids] = values - self._is_modified = True - #print 'set',self.attrname - if self._is_index: - self.set_indices(ids, values) - - - def set_plugin(self, ids, values): - """ - Returns value of array element for all ids. - """ - self[ids] = values - self._is_modified = True - #print 'set',self.attrname - - if self.plugin: - if not hasattr(ids, '__iter__'): - self.plugin.exec_events_ids(EVTSETITEM, [ids]) - else: - self.plugin.exec_events_ids(EVTSETITEM, ids) - if self._is_index: - self.set_indices(ids, values) - - - def delete(self,ids): - """ - removes key from array structure - To be overridden - """ - del self[ids] - self._is_modified = True - - def delete_plugin(self,ids): - """ - removes key from array structure - To be overridden - """ - if self.plugin: - if not hasattr(ids, '__iter__'): - self.plugin.exec_events_ids(EVTGETITEM, [ids]) - else: - self.plugin.exec_events_ids(EVTGETITEM, ids) - - del self[ids] - self._is_modified = True - - - def format_value(self,_id, show_unit = False, show_parentesis=False): - if show_unit: - unit = ' '+self.format_unit(show_parentesis) - else: - unit = '' - #return repr(self[_id])+unit - - #self.min = minval - #self.max = maxval - #self.digits_integer = digits_integer - #self.digits_fraction = digits_fraction - val = self[_id] - tt = type(val) - - if tt in (types.LongType,types.IntType): - return str(val)+unit - - elif tt in (types.FloatType,types.ComplexType): - if hasattr(attrconf,'digits_fraction'): - digits_fraction = self.digits_fraction - else: - digits_fraction = 3 - return "%."+str(digits_fraction)+"f"%(val)+unit - - else: - return str(val)+unit - - #return str(self[_id])+unit - - def format(self, ids = None): - # TODO: incredibly slow when calling format_value for each value - text = '' - - if ids == None: - ids = self._manager.get_ids() - if not hasattr(ids, '__iter__'): - ids = [ids] - - #unit = self.format_unit() - attrname = self.attrname - for id in ids: - text += '%s[%d] = %s\n'%(attrname, id, self.format_value(id, show_unit = True)) - - return text[:-1] #remove last newline - - - -class NumcolConf(ColConf): - def __init__( self, attrname, default, - digits_integer = None, digits_fraction=None , - minval = None, maxval = None, - **attrs): - self.min = minval - self.max = maxval - self.digits_integer = digits_integer - self.digits_fraction = digits_fraction - - ColConf.__init__(self,attrname, default,**attrs) - -class IdsConf(ColConf): - """ - Column, where each entry is the id of a single Table. - """ - - def __init__(self,attrname, tab, is_index = False, perm = 'r', **kwargs): - self._is_index = is_index - self._tab = tab - - - - - AttrConf.__init__(self, attrname, - -1, # default id - struct = 'odict', - metatype = 'id', - perm = perm, - **kwargs - ) - self.init_xml() - #print 'IdsConf.__init__',attrname - #print ' ',self._tab.xmltag,self._attrconfig_id_tab - - - def set_linktab(self, tab): - self._tab = tab - - - - def get_linktab(self): - return self._tab - - def init_xml(self): - #print 'init_xml',self.attrname - if self._tab.xmltag!=None: - - # necessary?? see ObjMan.write_xml - xmltag_tab, xmltag_item_tab, attrname_id_tab = self._tab.xmltag - if (attrname_id_tab is None)|(attrname_id_tab is ''): - self._attrconfig_id_tab = None - else: - self._attrconfig_id_tab = getattr(self._tab, attrname_id_tab)# tab = tabman ! - - if not hasattr(self,'is_xml_include_tab'): - # this means that entire table rows will be included - self.is_xml_include_tab = False - #print ' xmltag_tab, xmltag_item_tab, attrname_id_tab',xmltag_tab, xmltag_item_tab, attrname_id_tab,self.is_xml_include_tab - - else: - self._attrconfig_id_tab = None - self.is_xml_include_tab = False - - - - def write_xml(self, fd, _id, indent = 0): - if (self.xmltag is not None)&(self[_id]>=0): - if self._attrconfig_id_tab==None: - self._write_xml_value(self[_id],fd) - elif self.is_xml_include_tab: - # this means that entire table rows will be included - self._tab.write_xml(fd, indent, ids = self[_id],is_print_begin_end = False) - else: - self._write_xml_value(self._attrconfig_id_tab[self[_id]],fd) - - def _write_xml_value(self,val,fd): - #print 'write_xml',self.xmltag,hasattr(val, '__iter__') - if hasattr(val, '__iter__'): - if len(val)>0: - if hasattr(val[0], '__iter__'): - # matrix - fd.write(xm.mat(self.xmltag,val)) - else: - # list - fd.write(xm.arr(self.xmltag,val,self.xmlsep)) - else: - # empty list - #fd.write(xm.arr(self.xmltag,val)) - # don't even write empty lists - pass - - - - elif type(self._default) in (types.UnicodeType ,types.StringType ): - if len(val)>0: - fd.write(xm.num(self.xmltag,val)) - - - else: - # scalar number or string - fd.write(xm.num(self.xmltag,val)) - - def get_defaults(self, ids): - # create a list, should work for all types and dimensions - # default can be scalar or an array of any dimension - #print '\n\nget_defaults',self.attrname,ids,self.get_default() - return len(ids)*[-1] - - - - - - - - - def _getstate_specific(self, state): - """ - Called by __getstate__ to add/change specific states, - before returning states. - To be overridden. - """ - if self._is_save: - #if self._is_child: - # # OK self.value already set in - # pass - #else: - # # remove table reference and create ident - state['_tab']= None - state['_ident_tab'] = self._tab.get_ident_abs() - - def init_postload_internal(self, man, obj): - #print 'IdsConf.init_postload_internal',self.attrname,hasattr(self,'value'),self._is_save,self._is_localvalue,'obj:',obj.ident - - AttrConf.init_postload_internal(self, man, obj) - #if self._is_child: - # print ' make sure children get initialized' - # print ' call init_postload_internal of',self._tab.ident - # self._tab.init_postload_internal(obj) - - def init_postload_external(self): - #if self._is_child: - # # restore normally - # AttrConf.init_postload_external(self) - # self._tab.init_postload_external() - #else: - - # Substitute absolute ident with link object. - # Called from init_postload_external of attrsman during load_obj - # - ident_abs = self._ident_tab - #print 'reset_linkobj',self.attrname,ident_abs - obj = self.get_obj() - rootobj = obj.get_root() - #print ' rootobj',rootobj.ident - linkobj = rootobj.get_obj_from_ident(ident_abs) - #print ' linkobj',linkobj.ident - self._tab = linkobj - self.init_xml() - - def is_modified(self): - return False - -class TabIdsConf(ColConf): - """ - Column, where each entry contains a tuple with table object and id. - """ - - def __init__(self,attrname, is_index = False, **kwargs): - self._is_index = is_index - AttrConf.__init__(self, attrname, - -1, # default id - struct = 'odict', - metatype = 'tabids', - **kwargs - ) - - - def get_defaults(self, ids): - # create a list, should work for all types and dimensions - # default can be scalar or an array of any dimension - #print '\n\nget_defaults',self.attrname,ids,self.get_default() - return len(ids)*[(None,-1)] - - - def reset(self): - # TODO: this will reset all the tables - # instead should reset only the specified ids - if self._is_child: - for tab, ids in self.get_value(): - tab.reset() - - def clear(self): - self.reset() - # necessary? because tbles have been cleared from manager - #if self._is_child: - # for tab, ids in self.get_value(): - # tab.clear() - - - - def _getstate_specific(self, state): - """ - Called by __getstate__ to add/change specific states, - before returning states. - To be overridden. - """ - if self._is_save: - n = len(state['value']) - state['value']= None - _tabids_save = n*[None] - i = 0 - for tab, ids in self.get_value(): - _tabids_save[i] = [tab.get_ident_abs(), ids] - i += 1 - state['_tabids_save'] = _tabids_save - - - - def init_postload_internal(self, man, obj): - #print 'IdsConf.init_postload_internal',self.attrname,hasattr(self,'value'),self._is_save,self._is_localvalue,'obj:',obj.ident - - AttrConf.init_postload_internal(self, man, obj) - #if self._is_child: - # print ' make sure children get initialized' - # print ' call init_postload_internal of',self._tab.ident - # self._tab.init_postload_internal(obj) - - def init_postload_external(self): - #if self._is_child: - # # restore normally - # AttrConf.init_postload_external(self) - # self._tab.init_postload_external() - #else: - - # Substitute absolute ident with link object. - # Called from init_postload_external of attrsman during load_obj - # - #ident_abs = self._ident_tab - #print 'reset_linkobj',self.attrname,ident_abs - #obj = self.get_obj() - #rootobj = obj.get_root() - #print ' rootobj',rootobj.ident - #linkobj = rootobj.get_obj_from_ident(ident_abs) - #print ' linkobj',linkobj.ident - #self._tab = linkobj - - # Substitute absolute ident with link object. - # Called from init_postload_external of attrsman during load_obj - # - _tabids_save = self._tabids_save - #ident_abs = self._ident_value - # print 'init_postload_external',self.attrname,_tabids_save - obj = self.get_obj() - rootobj = obj.get_root() - # print ' rootobj',rootobj.ident - tabids = len(self._tabids_save)*[None] - i = 0 - for tabident, ids in self._tabids_save: - tab = rootobj.get_obj_from_ident(tabident) - #print ' ',tab.get_ident_abs(), ids - tabids[i] = [tab, ids] - i += 1 - - self.set_value(tabids) - - def is_modified(self): - return False - -class ObjsConf(ColConf): - """ - Column, where each entry is an object of class objclass with - ident= (attrname, id). - """ - - def __init__(self,attrname, is_index = False, **kwargs): - self._is_index = is_index - self._is_child = True# at the moment no links possible - AttrConf.__init__(self, attrname, - BaseObjman('empty'), # default id - struct = 'odict', - metatype = 'obj', - perm = 'r', - **kwargs - ) - - - - - - - - def set_obj(self, obj): - """ - Method to set instance of managed object. - Used by add method of AttrManager - """ - #print 'set_obj',self.attrname,obj.ident - AttrConf.set_obj(self, obj) - - #if self._is_child: - obj.set_child(self) - - #def get_valueobj(self, id = None): - # """ - # This is called by get_childobj to retrive the child instance. - # Here this is just the table. - # """ - # return self._tab - - def predelete(self): - AttrConf.predelete(self) - #if self._is_child: - self.get_obj().del_child(self.attrname) - - - - #def _getstate_specific(self, state): - # """ - # Called by __getstate__ to add/change specific states, - # before returning states. - # To be overridden. - # """ - # if self._is_save: - # if self._is_child: - # # OK self.value already set in - # pass - # else: - # # remove column reference and create column with idents - # state['value']= None - # idents_obj = OrderedDict() - # linkobjs = self.get_value() - # for _id in self.get_ids(): - # idents_obj[_id] = linkobjs[_id].get_ident_abs() - # state['_idents_obj'] = idents_obj - - - def init_postload_internal(self, man, obj): - #print 'ObjsConf.init_postload_internal',self.attrname,hasattr(self,'value'),self._is_save,self._is_localvalue,'obj:',obj.ident - - AttrConf.init_postload_internal(self, man, obj) - #if self._is_child: - - # make sure all children in column get initialized - #print ' make sure childrenS get initialized' - childobjs = self.get_value() - - obj = self.get_obj() - #print 'init_postload_internal',self.attrname,obj,obj.ident - for _id in obj.get_ids(): - #print ' call init_postload_internal of',childobjs[_id].ident - childobjs[_id].init_postload_internal(obj)# attention obj is the parent object! - - def reset(self): - #print 'ObjsConf.reset',self.get_value(),len(self.get_obj().get_ids()) - #obj = self.get_obj() - #print 'init_postload_internal',self.attrname,obj,obj.ident - for _id in self.get_obj().get_ids(): - #print ' call reset of',childobjs[_id].ident,_id - childobjs[_id].reset() - - def clear(self): - odict = self.get_init() - if not self._is_localvalue: - setattr(self._obj, self.attrname, odict) - if self._is_index: - self.reset_index() - - def is_modified(self): - #if self._is_child - #is_modified = self.get_value().is_modified() - #print 'is_modified', self.attrname, is_modified - - childobjs = self.get_value() - - #obj = self.get_obj() - #print 'init_postload_internal',self.attrname,obj,obj.ident - for _id in self.get_obj().get_ids(): - #print ' call init_postload_internal of',childobjs[_id].ident - if childobjs[_id].is_modified(): - return True - - def set_modified(self, is_modified): - childobjs = self.get_value() - - obj = self.get_obj() - #print 'init_postload_internal',self.attrname,obj,obj.ident - for _id in self.get_obj().get_ids(): - #print ' call init_postload_internal of',childobjs[_id].ident - childobjs[_id].set_modified(is_modified) - - - def init_postload_external(self): - #if self._is_child: - # restore normally - AttrConf.init_postload_external(self) - childobjs = self.get_value() - - for _id in self.get_obj().get_ids(): - childobjs[_id].init_postload_external() - - - #def get_name(self): - # return self.'Table ID for '+self._tab.get_name() - # - #def get_info(self): - # return 'ID for Table:\n'+self._tab.get_info() - - - -class Attrsman: - """ - Manages all attributes of an object - - if argument obj is specified with an instance - then attributes are stored under this instance. - The values of attrname is then directly accessible with - - obj.attrname - - If nothing is specified, then column attribute will be stored under - the respective config instance of this attrsman (self). - The values of attrname is then directly accessible with - - self.attrname.value - """ - def __init__(self, obj, attrname = 'attrsman', is_plugin = False): - - - - if obj==None: - # this means that column data will be stored - # in value attribute of attrconfigs - obj = self - self._is_localvalue = True - else: - # this means that column data will be stored under obj - self._is_localvalue = False - - self._obj = obj # managed object - self._attrconfigs = [] # managed attribute config instances - self.attrname = attrname # the manager's attribute name in the obj instance - - # groupes of attributes - # key=groupname, value = list of attribute config instances - self._groups = {} - - self.init_plugin(is_plugin) - - - def init_plugin(self, is_plugin): - if is_plugin: - self.plugin = Plugin(self) - else: - self.plugin = None - - def is_localvalue(self): - return self._is_localvalue - - - - - - def has_attrname(self,attrname): - # attention this is a trick, exploiting the fact that the - # attribute object with all the attr info is an attribute - # of the attr manager (=self) - return hasattr(self,attrname) - - def is_modified(self): - for attrconf in self._attrconfigs: - if attrconf.is_modified(): return True - return False - - def set_modified(self, is_modified = True): - for attrconf in self._attrconfigs: - attrconf.set_modified(is_modified) - - def get_modified(self): - # returns a list of modified attributes - modified = [] - for attrconf in self._attrconfigs: - if attrconf.is_modified(): - modified.append(attrconf) - return modified - - def get_config(self, attrname): - return getattr(self,attrname)# a bit risky - - def get_configs(self, is_all = False, structs = None, filtergroupnames = None): - #print 'get_configs',self,self._obj.ident,structs,filtergroupnames,len(self._attrconfigs) - if is_all: - return self._attrconfigs - else: - attrconfigs = [] - for attrconf in self._attrconfigs: - #print ' found',attrconf.attrname,attrconf.struct - is_check = True - if (structs != None): - if (attrconf.struct not in structs): - is_check = False - - if is_check: - #print ' **is_check',is_check - if len(attrconf.groupnames)>0: - if '_private' not in attrconf.groupnames: - #print ' not private' - if filtergroupnames != None: - #print ' apply filtergroupnames',filtergroupnames,attrconf.groupnames - if not set(filtergroupnames).isdisjoint(attrconf.groupnames): - #print ' append',attrconf.attrname - attrconfigs.append(attrconf) - else: - #print ' no filtergroupnames' - attrconfigs.append(attrconf) - else: - if filtergroupnames == None: - attrconfigs.append(attrconf) - - return attrconfigs - - #def get_colconfigs(self, is_all = False): - # return [] - - def get_obj(self): - return self._obj - - def add(self, attrconf): - """ - Add a one or several new attributes to be managed. - kwargs has attribute name as key and Attribute configuration object - as value. - """ - - - attrname = attrconf.attrname - #print 'Attrsman.add',self.get_obj().ident,'add',attrname,self.has_attrname(attrname) - if not self.has_attrname(attrname): - attrconf.set_obj(self._obj) - attrconf.set_manager(self) - - # set configuration object as attribute of AttrManager - setattr(self, attrname, attrconf) - - # append also to the list of managed objects - self._attrconfigs.append(attrconf) - - # insert in groups - if len(attrconf.groupnames) > 0: - for groupname in attrconf.groupnames: - - if not self._groups.has_key(groupname): - self._groups[groupname]=[] - - self._groups[groupname].append(attrconf) - - if self.plugin: - self.plugin.exec_events_attr(EVTADD, attrconf) - - # return default value as attribute of managed object - if attrconf.struct in STRUCTS_SCALAR:#== 'scalar': - return attrconf.get_init() - else: - return None # table configs do their own init - - else: - #print ' attribute with this name already exists',attrname,type(attrconf) - del attrconf - attrconf = getattr(self,attrname) - #print ' existing',attrconf,type(attrconf) - if attrconf.struct in STRUCTS_SCALAR:#== 'scalar': - return attrconf.get_value() - else: - return None # table configs do their own init - - - def get_groups(self): - return self._groups - - def get_groupnames(self): - return self._groups.keys() - - def has_group(self, groupname): - return self._groups.has_key(groupname) - - def get_group(self,name): - """ - Returns a list with attributes that belong to that group name. - """ - #print 'get_group self._groups=\n',self._groups.keys() - return self._groups.get(name,[]) - - def get_group_attrs(self,name): - """ - Returns a dictionary with all attributes of a group. - Key is attribute name and value is attribute value. - """ - #print 'get_group_attrs', self._groups - attrs={} - for attrconf in self._groups[name]: - attrs[attrconf.attrname]=getattr(self._obj, attrconf.attrname) - return attrs - - def print_attrs(self, show_unit = True, show_parentesis=False, attrconfigs = None): - print 'Attributes of',self._obj._name,'ident_abs=',self._obj.get_ident_abs() - if attrconfigs== None: - attrconfigs = self.get_configs() - - for attrconf in attrconfigs: - print ' %s =\t %s'%(attrconf.attrname, attrconf.format_value(show_unit=True)) - - - def save_values(self, state): - """ - Called by the managed object during save to save the - attribute values. - """ - for attrconfig in self.get_configs(): - attrconfig.save_value(state) - - def delete(self, attrname): - """ - Delete attibite with respective name - """ - #print '.__delitem__','attrname=',attrname - - #if hasattr(self,attrname): - attrconf = getattr(self,attrname) - - - if attrconf in self._attrconfigs: - if self.plugin: - self.plugin.exec_events_attr(EVTDEL,attrconf) - - for groupname in attrconf.groupnames: - self._groups[groupname].remove(attrconf) - - self._attrconfigs.remove(attrconf) - attrconf.predelete() # this will remove also the value attribute - - #attrname = attrconf.attrname - del self.__dict__[attrname] # delete config - return True - - return False # attribute not managed - #return False # attribute not existant - - - def __getstate__(self): - #print '__getstate__',self.attrname - #print ' self.__dict__=\n',self.__dict__.keys() - - state={} - for attr in self.__dict__.keys(): - #print ' attr',attr,self.__dict__[attr] - # TODO: optimize and put this at the end - if attr =='plugin': - plugin = self.__dict__[attr] - if plugin!=None: - state[attr] = True - else: - state[attr] = False - - elif attr not in ATTRS_NOSAVE: - state[attr] = self.__dict__[attr] - #print ' state=', state - return state - - def __setstate__(self,state): - #print '__setstate__',self - - # this is always required, but will not be saved - #self.plugins={} - - for attr in state.keys(): - #print ' set state',attr - # plugin set in init_postload_internal - #if attr=='plugin': - # if state[attr]==True: - # self.__dict__[attr] = Plugin(self) - # else: - # self.__dict__[attr]= None - #else: - self.__dict__[attr]=state[attr] - - def init_postload_internal(self, obj): - """ - Called after set state. - Link internal states. - """ - #print 'Attrsman.init_postload_internal of obj:',obj.ident - - self._obj = obj - self.init_plugin(self.plugin) - for attrconfig in self.get_configs(is_all = True): - #print ' call init_postload_internal of',attrconfig.attrname - attrconfig.init_postload_internal(self, obj) - - def init_postload_external(self): - """ - Called after set state. - Link external states. - """ - #print 'init_postload_external',self._obj.get_ident() - - - for attrconfig in self.get_configs(is_all = True): - #print ' **',attrconfig.attrname,attrconfig.metatype - attrconfig.init_postload_external() - - - - - -class Tabman(Attrsman): - """ - Manages all table attributes of an object. - - if argument obj is specified with an instance - then column attributes are stored under this instance. - The values of attrname is then directly accessible with - - obj.attrname - - If nothing is specified, then column attribute will be stored under - the respective config instance of this tab man (self). - The values of attrname is then directly accessible with - - self.attrname.value - - """ - def __init__(self, obj=None, **kwargs): - Attrsman.__init__(self, obj, **kwargs) - self._colconfigs = [] - self._ids = [] - - - - - - def add_col(self,attrconf): - #print 'add_col',attrconf.attrname,attrconf.is_index() - attrname = attrconf.attrname - if not self.has_attrname(attrname): - Attrsman.add(self, attrconf) # insert in common attrs database - self._colconfigs.append(attrconf) - # returns initial array and also create local array if self._is_localvalue == True - return attrconf.get_init() - else: - return getattr(self,attrname).get_value() - - def delete(self, attrname): - """ - Delete attribute with respective name - """ - #print '.__delitem__','attrname=',attrname - - if hasattr(self,attrname): - attrconf = getattr(self,attrname) - if self.plugin: - self.plugin.exec_events_attr(EVTDEL,attrconf) - if Attrsman.delete(self,attrname): - if attrconf in self._colconfigs: - self._colconfigs.remove(attrconf) - - - - def get_colconfigs(self, is_all = False, filtergroupnames = None): - if is_all: - return self._colconfigs - else: - colconfigs = [] - for colconfig in self._colconfigs: - if len(colconfig.groupnames)>0: - if colconfig.groupnames[0]!='_private': - if filtergroupnames != None: - if not set(filtergroupnames).isdisjoint(colconfig.groupnames): - colconfigs.append(colconfig) - else: - colconfigs.append(colconfig) - - else: - if filtergroupnames == None: - colconfigs.append(colconfig) - - return colconfigs - - def get_ids(self): - return self._ids - - def __len__(self): - """ - Determine current array length (same for all arrays) - """ - - return len(self._ids) - - def __contains__(self, _id): - return _id in self._ids - - def select_ids(self,mask): - - ids_mask = [] - i= 0 - for _id in self.get_ids(): - if mask[i]: - ids_mask.append(_id) - i+=1 - - return ids_mask - - def suggest_id(self,is_zeroid=False): - """ - Returns a an availlable id. - - Options: - is_zeroid=True allows id to be zero. - - """ - if is_zeroid: - id0=0 - else: - id0=1 - - id_set = set(self.get_ids()) - if len(id_set)==0: - id_max = 0 - else: - id_max = max(id_set) - #print 'suggest_id',id0, - return list(id_set.symmetric_difference(xrange(id0,id_max+id0+1)))[0] - - - def suggest_ids(self,n,is_zeroid=False): - """ - Returns a list of n availlable ids. - It returns even a list for n=1. - - Options: - is_zeroid=True allows id to be zero. - """ - if is_zeroid: - id0=0 - else: - id0=1 - id_set = set(self.get_ids()) - if len(id_set)==0: - id_max = 0 - else: - id_max = max(id_set) - - return list(id_set.symmetric_difference(xrange(id0,id_max+id0+n)))[:n] - - def add_rows(self, n=None, ids = [], **attrs): - if n != None: - ids = self.suggest_ids(n) - elif len(ids)==0: - # get number of rows from any valye vector provided - ids = self.suggest_ids(len(attrs.values()[0])) - else: - # ids already given , no ids to create - pass - - - self._ids += ids - #print 'add_rows ids', ids - for colconfig in self._colconfigs: - colconfig.add(ids, values = attrs.get(colconfig.attrname, None )) - if self.plugin: - self.plugin.exec_events_ids(EVTADDITEM,ids) - return ids - - def add_row(self, _id = None, **attrs): - if _id==None: - _id = self.suggest_id() - self._ids += [_id,] - for colconfig in self._colconfigs: - colconfig.add(_id, values = attrs.get(colconfig.attrname, None )) - if self.plugin: - self.plugin.exec_events_ids(EVTADDITEM,[_id]) - return _id - - def set_row(self, _id, **attrs): - for colconfig in self._colconfigs: - colconfig.set(_id, values = attrs.get(colconfig.attrname, None )) - if self.plugin: - self.plugin.exec_events_ids(EVTSETITEM,[_id]) - - - def set_rows(self, ids , **attrs): - - #print 'add_rows ids', ids - for colconfig in self._colconfigs: - colconfig.set(ids, values = attrs.get(colconfig.attrname, None )) - if self.plugin: - self.plugin.exec_events_ids(SETSETITEM,ids) - - - def get_row(self,_id): - attrvalues = {} - if self.plugin: - self.plugin.exec_events_ids(EVTGETITEM,[_id]) - for attrconfig in self._colconfigs: - attrvalues[attrconfig.attrname] = attrconfig[_id] - - - return attrvalues - - - - def del_rows(self, ids): - if self.plugin: - self.plugin.exec_events_ids(EVTDELITEM,ids) - for colconfig in self._colconfigs: - del colconfig[ids] - - for _id in ids: - self._ids.remove(_id) - - - def del_row(self, _id): - if self.plugin: - self.plugin.exec_events_ids(EVTDELITEM,[_id]) - for colconfig in self._colconfigs: - del colconfig[_id] - self._ids.remove(_id) - - - def __delitem__(self,ids): - """ - remove rows correspondent to the given ids from all array and dict - attributes - """ - if hasattr(ids, '__iter__'): - self.del_rows(ids) - else: - self.del_row(ids) - - def print_attrs(self, **kwargs): - #print 'Attributes of',self._obj._name,'(ident=%s)'%self._obj.ident - Attrsman.print_attrs(self, attrconfigs = self.get_configs(structs = ['scalar']),**kwargs) - #print ' ids=',self._ids - for _id in self.get_ids(): - for attrconf in self.get_configs(structs = STRUCTS_COL): - print ' %s[%d] =\t %s'%(attrconf.attrname, _id, attrconf.format_value(_id,show_unit=True)) - - -class BaseObjman: - """ - Object management base methods to be inherited by all object managers. - """ - def __init__(self, ident, is_plugin = False, **kwargs): - #print 'BaseObjman.__init__',kwargs - self._init_objman(ident, **kwargs) - self.set_attrsman(Attrsman(self, is_plugin = is_plugin )) - #print 'BaseObjman.__init__',self.format_ident(),'parent=',self.parent - self._init_attributes() - self._init_constants() - - def set_attrsman(self, attrsman): - self._attrsman = attrsman - return attrsman - - - - def _init_objman(self, ident='no_ident', parent=None, name= None, - managertype = 'basic', info = None, logger = None, - xmltag = None, version = 0.0): - #print 'BaseObjman._init_objman',ident,logger - self.managertype = managertype - self.ident = ident - self.set_version(version) - self.set_logger(logger) - - self.parent = parent - self.childs = {}# dict with attrname as key and child instance as value - - self._info = info - - self._is_saved = False - - if name == None: - self._name = self.format_ident() - else: - self._name = name - #self._init_xml(xmltag) - self.xmltag = xmltag - - # must be called explicitely during __init__ - #self._init_attributes() - #self._init_constants() - - def _init_attributes(self): - """ - This is the place to add all attributes. - This method will be called to initialize - and after loading a saved object. - Use this method also to update a version. - """ - pass - - - def _init_constants(self): - """ - This is the place to init any costants that are outside the management. - Constants are not saved. - This method will be called to initialize and after loading a saved object. - """ - pass - - def set_version(self,version): - self._version = version - - def get_version(self): - return self._version - - #def _upgrade_version(self): - # pass - - - #def _init_xml(self,xmltag=None): - # if xmltag != None: - # self.xmltag = xmltag - # else: - # self.xmltag = self.get_ident() - - def reset(self): - """ - Resets all attributes to default values - """ - for attrconfig in self.get_attrsman().get_configs(is_all = True): - attrconfig.reset() - - def clear(self): - """ - Clear tables and reset scalars. - """ - for attrconfig in self.get_attrsman().get_configs(is_all = True): - attrconfig.clear() - - def write_xml(self, fd, ident): - if self.xmltag!=None: - # figure out scalar attributes and child objects - attrconfigs = [] - objconfigs = [] - for attrconfig in self.get_attrsman().get_configs( structs = STRUCTS_SCALAR): - if (attrconfig.metatype == 'obj'): # better use self.childs - if (attrconfig.get_value().xmltag != None) & attrconfig.is_child() : - objconfigs.append(attrconfig) - elif attrconfig.xmltag != None: - attrconfigs.append(attrconfig) - - # start writing - if len(attrconfigs)>0: - # there are scalar attributes - fd.write(xm.start(self.xmltag, ident)) - for attrconfig in attrconfigs: - attrconfig.write_xml(fd) - - # are there child objects to write - if len(objconfigs)>0: - fd.write(xm.stop()) - for attrconfig in objconfigs: - attrconfig.get_value().write_xml(fd,ident+2) - fd.write(xm.end(self.xmltag,ident)) - else: - fd.write(xm.stopit()) - else: - # no scalars - fd.write(xm.begin(self.xmltag, ident)) - if len(objconfigs)>0: - for attrconfig in objconfigs: - attrconfig.get_value().write_xml(fd,ident+2) - fd.write(xm.end(self.xmltag,ident)) - - - - - - - def get_logger(self): - #print 'get_logger',self.ident,self._logger,self.parent - if self._logger!= None: - return self._logger - else: - return self.parent.get_logger() - - def set_logger(self, logger): - #print 'set_logger',self.ident,logger - self._logger = logger - - def __repr__(self): - #return '|'+self._name+'|' - return self.format_ident() - - def is_modified(self): - return self._attrsman.is_modified() - - def set_modified(self, is_modified = True): - self._attrsman.set_modified(is_modified) - - def get_name(self): - return self._name - - def get_info(self): - if self._info == None: - return self.__doc__ - else: - return self._info - - def get_ident(self): - return self.ident - - def _format_ident(self, ident): - if hasattr(ident,'__iter__'): - return str(ident[0])+'#'+str(ident[1]) - else: - return str(ident) - - def format_ident(self): - return self._format_ident(self.ident) - - - - def format_ident_abs(self): - s = '' - #print 'format_ident_abs',self.get_ident_abs() - for ident in self.get_ident_abs(): - s += self._format_ident(ident)+'.' - return s[:-1] - - - - def get_root(self): - if self.parent != None: - return self.parent.get_root() - else: - return self - - def get_ident_abs(self): - """ - Returns absolute identity. - This is the ident of this object in the global tree of objects. - If there is a parent objecty it must also be managed by the - object manager. - """ - #print 'obj.get_ident_abs',self.ident,self.parent, type(self.parent) - if self.parent != None: - return self.parent.get_ident_abs()+[self.ident] - else: - return [self.get_ident()] - - def get_obj_from_ident(self,ident_abs): - #print 'get_obj_from_ident',self.ident,ident_abs - if len(ident_abs)==1: - # arrived at the last element - # check if it corresponds to the present object - if ident_abs[0] == self.ident: - return self - else: - return None # could throw an error - else: - return self.get_childobj(ident_abs[1]).get_obj_from_ident(ident_abs[1:]) - - def get_childobj(self,attrname): - """ - Return child instance - """ - config = self.childs[attrname] - return config.get_value() - - - - - def set_child(self,childconfig): - """ - Set child childconfig - """ - self.childs[childconfig.attrname] = childconfig - - def del_child(self,attrname): - """ - Return child instance - """ - del self.childs[attrname] - - - - - def get_parent(self): - return self.parent - - #def reset_parent(self, parent): - # self.parent=parent - - - #def set_attrsman(self, attrsman): - # # for quicker acces and because it is only on - # # the attribute management is public and also directly accessible - # #setattr(self, attrname,Attrsman(self))# attribute management - # self._attrsman = attrsman - # #return attrsman - - def get_attrsman(self): - return self._attrsman - - def _getstate_specific(self, state): - """ - Called by __getstate__ to add/change specific states, - before returning states. - To be overridden. - """ - pass - - def __getstate__(self): - #print '__getstate__',self.ident,self._is_saved - #print ' self.__dict__=\n',self.__dict__.keys() - state={} - #if not self._is_saved: - - #if self._is_saved: - # # this message indicates a loop!! - # print 'WARNING in __getstate__: object already saved',self.format_ident_abs() - - #print ' save standart values' - for attr in ATTRS_SAVE: - if hasattr(self,attr): - state[attr]=getattr(self,attr) - - #print ' save all scalar stuctured attributes' - # attrsman knows which and how - ## self._attrsman.save_values(state) - # - # values of configured attributes are not saved here - # values are now ALWAYS stored in the value attribute of the - # attrconfig and reset in main obj - - #print ' save also attrsman' - state['_attrsman'] = self._attrsman - self._getstate_specific(state) - - - self._is_saved = True - - - #else: - # print 'WARNING in __getstate__: object %s already saved'%self.ident - return state - - def __setstate__(self,state): - #print '__setstate__',self - - # this is always required, but will not be saved - #self.plugins={} - - for key in state.keys(): - #print ' set state',key - self.__dict__[key]=state[key] - - self._is_saved = False - # done in init2_config... - # set default values for all states tha have not been saved - #for attr in self._config.keys(): - # if (not self._config[attr]['save']) & (not hasattr(self,attr)): - # print ' config attr',attr - # self.config(attr,**self._config[attr]) - - # set other states - #self._setstate(state) - - def init_postload_internal(self, parent): - """ - Called after set state. - Link internal states and call constant settings. - """ - #print 'BaseObjman.init_postload_internal',self.ident,'parent:', - #if parent != None: - # print parent.ident - #else: - # print 'ROOT' - self.parent = parent - self.childs = {} - self._attrsman.init_postload_internal(self) - - - - - - - def init_postload_external(self): - """ - Called after set state. - Link internal states. - """ - # set default logger - self.set_logger(Logger(self)) - #for child in self.childs.values(): - # child.reset_parent(self) - self._attrsman.init_postload_external() - self._init_attributes() - self._init_constants() - -class TableMixin(BaseObjman): - - def format_ident_row(self, _id): - #print 'format_ident_row',_id - return self.format_ident()+'['+str(_id)+']' - - def format_ident_row_abs(self, _id): - return self.format_ident_abs()+'['+str(_id)+']' - - def get_obj_from_ident(self,ident_abs): - #print 'get_obj_from_ident',self.ident,ident_abs,type(ident_abs) - if len(ident_abs)==1: - # arrived at the last element - # check if it corresponds to the present object - ident_check = ident_abs[0] - - # now 2 things can happen: - # 1.) the ident is a simple string identical to ident of the object - # in this case, return the whole object - # 2.) ident is a tuple with string and id - # in this case return object and ID - #if hasattr(ident_check, '__iter__'): - # #if (ident_check[0] == self.ident)&(ident_check[1] in self._ids): - # if ident_check[1] in self._ids: - # return (self, ident_check[1]) - # else: - # return None # could throw an error - #else: - if ident_check == self.ident: - return self - else: - childobj = self.get_childobj(ident_abs[1]) - return childobj.get_obj_from_ident(ident_abs[1:]) - - def get_childobj(self,ident): - """ - Return child instance. - This is any object with ident - """ - if hasattr(ident, '__iter__'): - # access of ObjsConf configured child - # get object from column attrname - attrname , _id = ident - config = self.childs[attrname] - return config[_id] #config.get_valueobj(_id) - else: - # access of ObjConf configured child - # get object from attrname - config = self.childs[ident] - return config.get_value() - - - - - - - - def __getstate__(self): - #print '__getstate__',self.ident,self._is_saved - #print ' self.__dict__=\n',self.__dict__.keys() - state={} - if 1:#not self._is_saved: - - #print ' save standart values' - for attr in ATTRS_SAVE+ATTRS_SAVE_TABLE: - if attr =='plugin': - plugin = self.__dict__[attr] - if plugin!=None: - state[attr] = True - else: - state[attr] = False - - elif hasattr(self,attr): - state[attr]=getattr(self,attr) - - # save managed attributes !!! - for attrconfig in self.get_configs(is_all = True): - state[attrconfig.attrname]=attrconfig - - #print ' save all scalar stuctured attributes' - # attrsman knows which and how - #self.save_values(state) - - #print ' save also attrsman' - #state['attrsman'] = self._attrsman - self._is_saved = True - - else: - print 'WARNING in __getstate__: object %s already saved'%self.ident - return state - - - - - def __setstate__(self,state): - #print '__setstate__',self.ident - - # this is always required, but will not be saved - self.plugins={} - - for attr in state.keys(): - #print ' set state',key - if attr=='plugin': - if state[attr]==True: - self.__dict__[attr] = Plugin(self) - else: - self.__dict__[attr]= None - else: - self.__dict__[attr]=state[attr] - - self._is_saved = False - # done in init2_config... - # set default values for all states tha have not been saved - #for attr in self._config.keys(): - # if (not self._config[attr]['save']) & (not hasattr(self,attr)): - # print ' config attr',attr - # self.config(attr,**self._config[attr]) - - # set other states - #self._setstate(state) - - - - - - def init_postload_internal(self, parent): - """ - Called after set state. - Link internal states. - """ - #print 'TableObjman.init_postload_internal',self.ident,'parent:', - #if parent != None: - # print parent.ident - #else: - # print 'ROOT' - - self.parent = parent - self.childs = {} - self.set_attrsman(self) - Attrsman.init_postload_internal(self, self) - - self._is_saved = False - - - def init_postload_external(self): - """ - Called after set state. - Link internal states. - """ - Attrsman.init_postload_external(self) - # no: BaseObjman.init_postload_external(self) - self._init_attributes() - self._init_constants() - - def export_csv(self, filepath, sep=',', name_id='ID', - file=None, attrconfigs = None, ids = None, groupname = None, - is_header = True, is_ident = False, is_timestamp = True): - - #print 'export_csv',filepath,"*"+sep+"*" - fd=open(filepath,'w') - - if ids == None: - ids = self.get_ids() - - if groupname !=None: - attrconfigs = self.get_group(groupname) - is_exportall = False - - if attrconfigs == None: - attrconfigs = self.get_colconfigs(is_all = True) - is_exportall = False - else: - is_exportall = True - - # header - if is_header: - - row = self._clean_csv(self.get_name(),sep) - if is_ident: - row+= sep+'(ident=%s)'%self.format_ident_abs() - fd.write(row+'\n') - if is_timestamp: - now = datetime.now() - fd.write(self._clean_csv(now.isoformat(),sep)+'\n') - fd.write('\n\n') - - # first table row - row = name_id - for attrconf in attrconfigs: - #print ' write first row',attrconf.attrname - is_private = attrconf.has_group('_private') - if ((not is_private)&(attrconf.is_save()))|is_exportall: - row +=sep+self._clean_csv(attrconf.format_symbol(),sep) - fd.write(row+'\n') - - # rest - for _id in ids: - #if self._is_keyindex: - # row = str(self.get_key_from_id(id))#.__repr__() - #else: - row = str(_id) - row = self._clean_csv(row,sep) - for attrconf in attrconfigs: - is_private = attrconf.has_group('_private') - if ((not is_private)&(attrconf.is_save()))|is_exportall: - row+= sep+self._clean_csv('%s'%(attrconf.format_value(_id,show_unit=False)),sep) - - # make sure there is no CR in the row!! - #print row - fd.write(row+'\n') - - if filepath!=None: - fd.close() - - def _clean_csv(self,row,sep): - row=row.replace('\n',' ') - #row=row.replace('\b',' ') - row=row.replace('\r',' ') - #row=row.replace('\f',' ') - #row=row.replace('\newline',' ') - row=row.replace(sep,' ') - return row - - - def clear_rows(self): - if self.plugin: - self.plugin.exec_events_ids(EVTDELITEM,self.get_ids()) - self._ids = [] - for colconfig in self.get_attrsman()._colconfigs: - #print 'ArrayObjman.clear_rows',colconfig.attrname,len(colconfig.get_value()) - colconfig.clear() - #print ' done',len(colconfig.get_value()) - - def clear(self): - #print 'ArrayObjman.clear',self.ident - # clear/reset scalars - for attrconfig in self.get_attrsman().get_configs( structs = STRUCTS_SCALAR): - attrconfig.clear() - self.clear_rows() - self.set_modified() - - - - def _write_xml_body(self, fd, indent, objconfigs, idcolconfig_include_tab, colconfigs, - objcolconfigs, xmltag_item, attrconfig_id, xmltag_id, ids, ids_xml): - - #print '_write_xml_body ident,ids',self.ident,ids - if ids is None: - ids = self.get_ids() - - if ids_xml is None: - ids_xml = ids - - for attrconfig in objconfigs: - attrconfig.get_value().write_xml(fd,indent+2) - - # check if columns contain objects - #objcolconfigs = [] - scalarcolconfigs = colconfigs - #for attrconfig in colconfigs: - # if attrconfig.metatype == 'obj': - # objcolconfigs.append(attrconfig) - # else: - # scalarcolconfigs.append(attrconfig) - - for _id, id_xml in zip(ids,ids_xml): - fd.write(xm.start(xmltag_item,indent+2)) - - #print ' make tag and id',_id - if xmltag_id == '': - # no id tag will be written - pass - elif (attrconfig_id is None)&(xmltag_id is not None): - # use specified id tag and and specified id values - fd.write(xm.num(xmltag_id, id_xml)) - - elif (attrconfig_id is not None): - # use id tag and values of attrconfig_id - attrconfig_id.write_xml(fd,_id) - - #print ' write columns',len(scalarcolconfigs)>0,len(idcolconfig_include_tab)>0,len(objcolconfigs)>0 - for attrconfig in scalarcolconfigs: - #print ' scalarcolconfig',attrconfig.attrname - attrconfig.write_xml(fd,_id) - - if (len(idcolconfig_include_tab)>0)|(len(objcolconfigs)>0): - fd.write(xm.stop()) - - for attrconfig in idcolconfig_include_tab: - #print ' include_tab',attrconfig.attrname - attrconfig.write_xml(fd,_id,indent+4) - - for attrconfig in objcolconfigs: - #print ' objcolconfig',attrconfig.attrname - attrconfig[_id].write_xml(fd, indent+4) - fd.write(xm.end(xmltag_item,indent+2)) - else: - fd.write(xm.stopit()) - - #print ' _write_xml_body: done' - - def write_xml(self, fd, indent, xmltag_id = 'id', ids = None, ids_xml = None, - is_print_begin_end = True, attrconfigs_excluded = []): - #print 'write_xml',self.ident#,ids - if self.xmltag!=None: - xmltag, xmltag_item, attrname_id = self.xmltag - - if xmltag == '': # no begin end statements - is_print_begin_end = False - - if ids != None: - if not hasattr(ids, '__iter__'): - ids = [ids] - - - - if attrname_id == '': # no id info will be written - attrconfig_id = None - xmltag_id = '' - - elif attrname_id != None: # an attrconf for id has been defined - attrconfig_id = getattr(self.get_attrsman(), attrname_id) - xmltag_id = None# this will define the id tag - else: - attrconfig_id = None # native id will be written using xmltag_id from args - - #print ' attrname_id,attrconfig_id',attrname_id,attrconfig_id - #if attrconfig_id is not None: - # print ' attrconfig_id',attrconfig_id.attrname - - # figure out scalar attributes and child objects - attrconfigs = [] - objconfigs = [] - colconfigs = [] - objcolconfigs = [] - idcolconfig_include_tab = [] - for attrconfig in self.get_attrsman().get_configs(is_all=True): - #print ' check',attrconfig.attrname,attrconfig.xmltag!= None,attrconfig.is_colattr(),attrconfig.metatype - if attrconfig == attrconfig_id: - pass - elif attrconfig in attrconfigs_excluded: - pass - elif attrconfig.is_colattr() & (attrconfig.metatype == 'obj'): - objcolconfigs.append(attrconfig) - elif (attrconfig.is_colattr()) &(attrconfig.metatype in ('ids', 'id')) & (attrconfig.xmltag != None): - if hasattr(attrconfig, "is_xml_include_tab"): - if attrconfig.is_xml_include_tab: - idcolconfig_include_tab.append(attrconfig) - else: - colconfigs.append(attrconfig) - else: - colconfigs.append(attrconfig) - elif attrconfig.is_colattr() & (attrconfig.xmltag != None): - colconfigs.append(attrconfig) - elif (attrconfig.metatype == 'obj'): # better use self.childs - if (attrconfig.get_value().xmltag != None) & attrconfig.is_child() : - objconfigs.append(attrconfig) - elif attrconfig.xmltag != None: - attrconfigs.append(attrconfig) - - - #print ' attrconfigs',attrconfigs - #print ' objconfigs',objconfigs - #print ' idcolconfig_include_tab',idcolconfig_include_tab - #print ' colconfigs',colconfigs - # start writing - if len(attrconfigs)>0: - #print ' there are scalar attributes' - if is_print_begin_end: - fd.write(xm.start(xmltag, indent)) - for attrconfig in attrconfigs: - attrconfig.write_xml(fd) - - # are there child objects to write - if (len(objconfigs)>0)|(len(colconfigs)>0)|(len(idcolconfig_include_tab)>0): - fd.write(xm.stop()) - self._write_xml_body(fd,indent, objconfigs, idcolconfig_include_tab, - colconfigs, - objcolconfigs, - xmltag_item, attrconfig_id, - xmltag_id,ids,ids_xml) - fd.write(xm.end(xmltag,indent)) - - else: - fd.write(xm.stopit()) - else: - #print ' no scalars' - if is_print_begin_end: - fd.write(xm.begin(xmltag, indent)) - self._write_xml_body(fd,indent, objconfigs, idcolconfig_include_tab, - colconfigs, - objcolconfigs, - xmltag_item,attrconfig_id, - xmltag_id,ids,ids_xml) - - if is_print_begin_end: - fd.write(xm.end(xmltag,indent)) - -class TableObjman(Tabman, TableMixin): - """ - Table Object management manages objects with list and dict based columns. - For faster operation use ArrayObjman in arrayman package, which requires numpy. - """ - def __init__(self,ident, **kwargs): - self._init_objman( ident, **kwargs) - self._init_attributes() - self._init_constants() - - def _init_objman(self, ident,is_plugin = False,**kwargs): - BaseObjman._init_objman(self, ident, managertype = 'table', **kwargs) - Tabman.__init__(self,is_plugin = is_plugin) - #self.set_attrsman(self) - self.set_attrsman(self) - - - - - - - - - - -############################################################################### -if __name__ == '__main__': - """ - Test - """ - - pass - - - \ No newline at end of file + +# python classman.py + +# TODO: +# - store old values in attrcons and recover with undo + + +# To be or not to be. -- Shakespeare +# To do is to be. -- Nietzsche +# To be is to do. -- Sartre +# Do be do be do. -- Sinatra + +# save with is saved flag +# xml mixin +# different attrconfig classe (numbers, strings, lists, colors,...) + +import types +import os +import pickle +import sys +import string +from collections import OrderedDict +from datetime import datetime +#import numpy as np +import xmlman as xm +from logger import Logger + + +########## + + +# event triggers +# plugtype plugcode +EVTDEL = 0 # delete attribute +EVTSET = 1 # set attribute +EVTGET = 2 # get attribute +EVTADD = 3 # add/create attribute + +EVTDELITEM = 20 # delete attribute +EVTSETITEM = 21 # set attribute +EVTGETITEM = 22 # get attribute +EVTADDITEM = 23 # add/create attribute + + +ATTRS_NOSAVE = ('value', 'plugin', '_obj', '_manager', 'get', 'set', + 'add', 'del', 'delete', 'childs', 'parent', '_attrconfig_id_tab') +ATTRS_SAVE = ('ident', '_name', 'managertype', '_info', 'xmltag') +ATTRS_SAVE_TABLE = ('_is_localvalue', 'attrname', '_colconfigs', '_ids', '_inds', + '_attrconfigs', '_groups', 'plugin', '_is_indexing', '_index_to_id', '_id_to_index') + +STRUCTS_COL = ('odict', 'array') +STRUCTS_SCALAR = ('scalar', 'list', 'matrix', 'scalar.func') + + +def save_obj(obj, filename, is_not_save_parent=False): + """ + Saves python object to a file with filename. + Filename may also include absolute or relative path. + If operation fails a False is returned and True otherwise. + """ + # print 'save_obj',is_not_save_parent,filename,obj.parent + try: + file = open(filename, 'wb') + except: + print 'WARNING in save: could not open', filename + return False + + if is_not_save_parent: + parent = obj.parent + obj.parent = None + # print ' before',is_not_save_parent,parent,obj.parent + pickle.dump(obj, file, protocol=2) + file.close() + # set all objects and attrubutes to unsaved again + # obj.set_unsaved() + # no, decided to eliminate _is_saved restriction + # print ' after',is_not_save_parent,parent,obj.parent + if is_not_save_parent: + obj.parent = parent + return True + + +def load_obj(filename, parent=None): + """ + Reads python object from a file with filename and returns object. + Filename may also include absolute or relative path. + If operation fails a None object is returned. + """ + print 'load_obj', filename + try: + file = open(filename, 'rb') + except: + print 'WARNING in load_obj: could not open', filename + return None + + # try: + # print ' pickle.load...' + obj = pickle.load(file) + file.close() + # print ' obj._link2' + + # init_postload_internal is to restore INTERNAL states from INTERNAL states + # print 'load_obj->init_postload_internal',obj.ident + obj.init_postload_internal(parent) + + # init_postload_external is to restore INTERNAL states from EXTERNAL states + # such as linking + obj.init_postload_external() + + # _init4_ is to do misc stuff when everything is set + # obj._init4_config() + + return obj + +# class ObjXmlMixin: + + +# class AttrXmlMixin: + + +class Plugin: + + def __init__(self, obj, is_enabled=True): + self._obj = obj # this can be either attrconf or main object + self._events = {} + self._has_events = False + self._is_enabled = is_enabled + + def add_event(self, trigger, function): + """ + Standard plug types are automatically set but the system: + + """ + if not self._events.has_key(trigger): + self._events[trigger] = [] + self._events[trigger].append(function) + self._has_events = True + + def del_event(self, trigger): + del self._events[trigger] + if len(self._events) == 0: + self._has_events = False + + def enable(self, is_enabled=True): + self._is_enabled = is_enabled + + def exec_events(self, trigger): + if self._has_events & self._is_enabled: + # print '**PuginMixin.exec_events',trigger,(EVTGETITEM,EVTGET) + # if trigger!=EVTGET: + # print ' call set_modified',self._obj + # self._obj.set_modified(True) + + for function in self._events.get(trigger, []): + function(self._obj) + + def exec_events_attr(self, trigger, attrconfig): + if self._has_events & self._is_enabled: + # print '**PuginMixin.exec_events',trigger,(EVTGETITEM,EVTGET) + # if trigger!=EVTGET: + # print ' call set_modified',self._obj + # self._obj.set_modified(True) + + for function in self._events.get(trigger, []): + function(self._obj, attrconfig) + + def exec_events_ids(self, trigger, ids): + """ + Executes all functions assigned for this trigger for multiple ids. + """ + if self._has_events & self._is_enabled: + # print '**ArrayConf._execute_events_keys',self.attrname,trigger,(EVTGETITEM,EVTGET) + # if trigger!=EVTGETITEM: + # #print ' call set_modified',self._manager + # self._manager.set_modified(True) + + for function in self._events.get(trigger, []): + function(self._obj, ids) + + +class AttrConf: + + """ + Contains additional information on the object's attribute. + """ + + def __init__(self, attrname, default, + groupnames=[], perm='rw', + is_save=True, + # is_link = False, # define link class + is_copy=True, + name='', info='', + unit='', + xmltag=None, + is_plugin=False, + struct='scalar', + metatype='', + **attrs): + # if struct == 'None': + # if hasattr(default, '__iter__'): + # struct = 'scalar' + # else: + # struct = 'list' + + # these states will be saved and reloaded + self.attrname = attrname + self.groupnames = groupnames + self.metatype = metatype + self.struct = struct + + self._default = default + + self._is_save = is_save + self._is_copy = is_copy + self._is_localvalue = True # value stored locally, set in set_manager + self._unit = unit + self._info = info + self._name = name + self._perm = perm + + # states below need to be resored after load + self._manager = None # set later by attrsman , necessary? + self._obj = None # parent object, set later by attrsman + + self._is_modified = False + self._is_saved = False + + self.init_plugin(is_plugin) + # self._init_xml(xmltag) + self.xmltag = xmltag + self.xmlsep = attrs.get('xmlsep', ' ') + + # set rest of attributes passed as keyword args + # no matter what they are used for + for attr, value in attrs.iteritems(): + setattr(self, attr, value) + + def is_save(self): + return self._is_save + + def has_group(self, groupname): + return groupname in self.groupnames + + def enable_plugin(self, is_enabled=True): + if is_plugin: + self.plugin.enable(is_enabled) + + def get_metatype(self): + return self.metatype + + def init_plugin(self, is_plugin): + if is_plugin: + self.plugin = Plugin(self) + self.set = self.set_plugin + self.get = self.get_plugin + else: + self.plugin = None + + # def _init_xml(self,xmltag=None): + # if xmltag != None: + # self.xmltag = xmltag + # else: + # self.xmltag = self.attrname + + def write_xml(self, fd): + if self.xmltag != None: + self._write_xml_value(self.get_value(), fd) + + def _write_xml_value(self, val, fd): + # print 'write_xml',self.xmltag,hasattr(val, '__iter__') + if self.metatype == 'color': + fd.write(xm.color(self.xmltag, val)) + + elif hasattr(val, '__iter__'): + if len(val) > 0: + if hasattr(val[0], '__iter__'): + # matrix + fd.write(xm.mat(self.xmltag, val)) + else: + # list + fd.write(xm.arr(self.xmltag, val, self.xmlsep)) + else: + # empty list + # fd.write(xm.arr(self.xmltag,val)) + # don't even write empty lists + pass + + elif hasattr(self, 'xmlmap'): + if self.xmlmap.has_key(val): + fd.write(xm.num(self.xmltag, self.xmlmap[val])) + else: + fd.write(xm.num(self.xmltag, val)) + + elif hasattr(self, 'choices'): + if type(self.choices) == types.ListType: + fd.write(xm.num(self.xmltag, val)) + else: + # print '_write_xml_value',self.attrname + # print ' val,self.choices.values()',val,self.choices.values() + i = self.choices.values().index(val) + fd.write(xm.num(self.xmltag, self.choices.keys()[i])) + + # use default and hope it is no a numpy bool!!! + elif type(self._default) == types.BooleanType: + if val: + fd.write(xm.num(self.xmltag, 1)) + else: + fd.write(xm.num(self.xmltag, 0)) + + elif type(self._default) in (types.UnicodeType, types.StringType): + if len(val) > 0: + fd.write(xm.num(self.xmltag, val)) + + else: + # scalar number or string + fd.write(xm.num(self.xmltag, val)) + + def get_name(self): + return self._name + + def is_modified(self): + # print 'is_modified', self.attrname, self._is_modified + return self._is_modified + + def set_modified(self, is_modified): + self._is_modified = is_modified + + def set_manager(self, manager): + """ + Method to set manager to attribute configuration object. + This is either attribute manager or table manager. + Used by add method of AttrManager + """ + self._manager = manager + self._is_localvalue = manager.is_localvalue() + + def get_manager(self): + """ + Method to get manager to attribute configuration object. + """ + return self._manager + + def set_obj(self, obj): + """ + Method to set instance of managed object. + Used by add method of AttrManager + """ + self._obj = obj + + def get_obj(self): + return self._obj + + def get(self): + # return attribute, overridden with indexing for array and dict struct + return self.get_value() + + def set(self, value): + # set attribute, overridden with indexing for array and dict struct + if value != self.get_value(): + self.set_value(value) + self._is_modified = True + return value + + def get_plugin(self): + """ + Default get method with plugin for scalar attrs + """ + # return attribute, overridden with indexing for array and dict struct + self.plugin.exec_events(EVTGET) + + return self.get_value() + + def set_plugin(self, value): + """ + Default set method with plugin for scalar attrs + """ + # set attribute, overridden with indexing for array and dict struct + if value != self.get_value(): + self.set_value(value) + self._is_modified = True + self.plugin.exec_events(EVTSET) + + return value + + def get_default(self): + return self._default + + def get_init(self): + """ + Returns initialization of attribute. + Usually same as get_default for scalars. + Overridden by table configuration classes + """ + value = self.get_default() + # store locally if required + if self._is_localvalue: + self.value = value + return value + + def reset(self): + if self._is_localvalue: + self.value = self.get_default() + else: + setattr(self._obj, self.attrname, self.get_default()) + + def clear(self): + self.reset() + + # def is_tableattr(self): + # return self.struct in ('dict','array','list') + + def set_perm(self, perm): + self._perm = perm + + def get_perm(self): + return self._perm + + def is_readonly(self): + return 'w' not in self._perm + + def is_writable(self): + return 'w' in self._perm + + def is_editable(self): + """Can attribute be edited """ + return 'e' in self._perm + + def has_unit(self): + return self._unit != '' + + def has_info(self): + return self.get_info() != None + + def is_colattr(self): + return hasattr(self, '__getitem__') + + def get_info(self): + if self._info == None: + return self.__doc__ + else: + return self._info + + def format_unit(self, show_parentesis=False): + if self._unit in ('', None): + return '' + if show_parentesis: + return '[%s]' % self._unit + else: + return '%s' % self._unit + + def format_value(self, show_unit=False, show_parentesis=False): + if show_unit: + unit = ' ' + self.format_unit(show_parentesis) + else: + unit = '' + # return repr(self.get_value())+unit + return str(self.get_value()) + unit + + def format_symbol(self): + if hasattr(self, 'symbol'): + symbol = self.symbol + else: + symbol = self._name + + return symbol + ' ' + self.format_unit(show_parentesis=True) + + #### + def get_value(self): + # always return attribute, no indexing, no plugin + if self._is_localvalue: + return self.value + else: + return getattr(self._obj, self.attrname) + + def set_value(self, value): + # set entire attribute, no indexing, no plugin + # print 'AttrConf.set_value',self.attrname, self._is_localvalue, value, + # type(value) + if self._is_localvalue: + self.value = value + else: + return setattr(self._obj, self.attrname, value) + + def predelete(self): + """ + Cleanup operations before deleting + """ + if self._is_localvalue: + del self.value # delete value + else: + del self._obj.__dict__[self.attrname] # delete value + + # def init_presave_internal(self, man, obj): + # pass + # not a good idea to delete links, plugins here + + # def save_value(self, state): + # """ + # Save attribute value of managed object to state dict. + # + # move this into __getstate__ + # + # restore value in _obj during postllad_external + # + # make _getstate_ for speecific save + # """ + # #print 'save_value',self.attrname,self._is_save, self._is_localvalue, + # # + # # Attention can be called fron __getstate__ of obj if _is_localvalue=False + # # or from __getstate__ of attribute config if _is_localvalue=True + + def _getstate_specific(self, state): + """ + Called by __getstate__ to add/change specific states, + before returning states. + To be overridden. + """ + pass + + def __getstate__(self): + # print '__getstate__',self.ident + # print ' self.__dict__=\n',self.__dict__.keys() + if self._is_saved: + # this message indicates a loop!! + print 'WARNING in __getstate__: Attribute already saved:', self.get_obj().format_ident_abs(), self.attrname + state = {} + for attr in self.__dict__.keys(): + + if attr == 'plugin': + plugin = self.__dict__[attr] + if plugin != None: + state[attr] = True + else: + state[attr] = False + + elif attr not in ATTRS_NOSAVE: + state[attr] = self.__dict__[attr] + + if self._is_save: + self._is_modified = False + state['value'] = self.get_value() + + self._getstate_specific(state) + return state + + def __setstate__(self, state): + # print '__setstate__',self + + # this is always required, but will not be saved + self.plugins = {} + + for attr in state.keys(): + # print ' set state',key + + # done in init_postload_internal... + # if attr=='plugin': + # if state[attr]==True: + # self.__dict__[attr] = Plugin(self) + # else: + # self.__dict__[attr]= None + # else: + self.__dict__[attr] = state[attr] + + def init_postload_internal(self, man, obj): + # print + # 'AttrConf.init_postload_internal',self.attrname,hasattr(self,'value'),self._is_save,self._is_localvalue,'obj:',obj.ident + self.set_manager(man) + self.set_obj(obj) + self.init_plugin(self.plugin) + + # set initial values for unsafed attributes + if not self._is_save: + self.set_value(self.get_init()) + else: + if self._is_localvalue: + # OK self.value already set in __setstate__ + pass + else: + # TODO: could be made nicer with method + setattr(self._obj, self.attrname, self.value) + del self.value # no longer needed + + # print ' check',hasattr(self,'value') + self._is_saved = False + + def init_postload_external(self): + pass + + +class NumConf(AttrConf): + + """ + Contains additional information on the object's attribute. + Here specific number related attributes are defined. + """ + + def __init__(self, attrname, default, + digits_integer=None, digits_fraction=None, + minval=None, maxval=None, + **kwargs): + self.min = minval + self.max = maxval + self.digits_integer = digits_integer + self.digits_fraction = digits_fraction + + AttrConf.__init__(self, attrname, default, metatype='number', + **kwargs + ) + + +class ObjConf(AttrConf): + + """ + Contains additional information on the object's attribute. + Configures Pointer to another object . + This other object must have an ident. + it can be either a child (then it will be saved) + or a link (then only the id will saved) + If it is a child the is_child = True (default value) + """ + + def __init__(self, valueobj, is_child=True, **kwargs): + attrname = valueobj.get_ident() + self._is_child = is_child + AttrConf.__init__(self, attrname, valueobj, + struct='scalar', + metatype='obj', + perm='r', + **kwargs + ) + + def set_obj(self, obj): + """ + Method to set instance of managed object. + Used by add method of AttrManager + """ + # print 'ObjConf.set_obj',self.attrname,obj.ident + AttrConf.set_obj(self, obj) + + if self._is_child: + # tricky: during first initialization + # child instance is stored in default + obj.set_child(self) + + def predelete(self): + AttrConf.predelete(self) + if self._is_child: + self.get_obj().del_child(self.attrname) + + def reset(self): + if self._is_child: + self.get_value().reset() + + def clear(self): + if self._is_child: + self.get_value().clear() + + def is_child(self): + return self._is_child + + def _getstate_specific(self, state): + """ + Called by __getstate__ to add/change specific states, + before returning states. + To be overridden. + """ + if self._is_save: + if self._is_child: + # OK self.value already set in + pass + else: + # remove object reference from value and create ident + state['value'] = None + state['_ident_value'] = self.get_value().get_ident_abs() + + def is_modified(self): + # if self._is_child + #is_modified = self.get_value().is_modified() + # print 'is_modified', self.attrname, is_modified + return self.get_value().is_modified() + + def set_modified(self, is_modified): + if self._is_child: + self.get_value().set_modified(is_modified) + + def write_xml(self, fd): + """ + Objects are not written here, but in write_xml of the parent obj. + """ + pass + + def init_postload_internal(self, man, obj): + # print + # 'ObjConf.init_postload_internal',self.attrname,hasattr(self,'value'),self._is_save,self._is_localvalue,'parent + # obj:',obj.ident + + AttrConf.init_postload_internal(self, man, obj) + if self._is_child: + # print ' make sure children get initialized' + # self.get_value().init_postload_internal(obj) + # print ' call init_postload_internal + # of',self.get_value().ident,self.get_value(),self.get_value().__class__,self.get_value().init_postload_internal + self.get_value().init_postload_internal(obj) + + def init_postload_external(self): + if self._is_child: + # restore normally + AttrConf.init_postload_external(self) + self.get_value().init_postload_external() + else: + # Substitute absolute ident with link object. + # Called from init_postload_external of attrsman during load_obj + # + ident_abs = self._ident_value + # print 'reset_linkobj',self.attrname,ident_abs + obj = self.get_obj() + rootobj = obj.get_root() + # print ' rootobj',rootobj.ident + linkobj = rootobj.get_obj_from_ident(ident_abs) + # print ' linkobj',linkobj.ident + self.set_value(linkobj) + + # def get_valueobj(self): + # """ + # This is called by get_childobj to retrive the child instance. + # """ + # return self.get_value() + + def get_name(self): + return self.get_value().get_name() + + def get_info(self): + return self.get_value().__doc__ + + def format_value(self, show_unit=False, show_parentesis=False): + return repr(self.get_value()) + + +class FuncConf(AttrConf): + + """ + Configures a function. + The function with name funcname must be a method of the object. + Default value is used to specify the type of output. + """ + + def __init__(self, attrname, funcname, exampleoutput, struct='scalar.func', **kwargs): + self.funcname = funcname + + AttrConf.__init__(self, attrname, exampleoutput, + struct=struct, + perm='r', + is_save=False, + **kwargs + ) + + def set_obj(self, obj): + AttrConf.set_obj(self, obj) + if self._info == '': + self._info = getattr(self._obj, self.funcname).__doc__ + + def get_value(self): + # always return attribute, no indexing, no plugin + return getattr(self._obj, self.funcname)() + # if self._is_localvalue: + # return self.value + # else: + # return getattr(self._obj, self.attrname) + + def get_function(self): + return getattr(self._obj, self.funcname) + + def set_value(self, value): + # set entire attribute, no indexing, no plugin + # print 'AttrConf.set_value',self.attrname, self._is_localvalue, value, + # type(value) + return None + + def is_modified(self): + return False + + def reset(self): + pass + + def clear(self): + pass + + +class Indexing: + + """ + Mixing to allow any column attribute to be used as index. + """ + + def _init_indexing(self): + """ + Init Indexing management attributes. + """ + + self._index_to_id = {} # OrderedDict() + + # this updates index if values already exist + if hasattr(self, 'value'): + ids = self.get_obj().get_ids() + self.add_indices(ids, self[ids]) + + def reset_index(self): + self._init_indexing() + + def get_indexmap(self): + return self._index_to_id + + def get_id_from_index(self, index): + return self._index_to_id[index] + + def has_index(self, index): + return self._index_to_id.has_key(index) + + def get_ids_from_indices(self, indices): + ids = len(indices) * [0] + for i in range(len(indices)): + # if not self._index_to_id.has_key(indices[i]): + # print 'WARNING from get_ids_from_indices: no index',indices[i] + # print self._index_to_id + ids[i] = self._index_to_id[indices[i]] + return ids + + def get_ids_from_indices_save(self, indices): + ids = len(indices) * [0] + for i in range(len(indices)): + if not self._index_to_id.has_key(indices[i]): + ids[i] = -1 + else: + ids[i] = self._index_to_id[indices[i]] + return ids + + # use set instead of add + def add_indices(self, ids, indices): + for _id, index in zip(ids, indices): + self.add_index(_id, index) + + def add_index(self, _id, index): + self._index_to_id[index] = _id + + def del_indices(self, ids): + for _id in ids: + self.del_index(_id) + + def set_index(self, _id, index): + # print 'set_index',self._index_to_id + self.del_index(_id) + self.add_index(_id, index) + + def set_indices(self, ids, indices): + self.del_indices(ids) + self.add_indices(ids, indices) + + def del_index(self, _id): + index = self[_id] + # when index is added (with set) no previous index value exists + if self._index_to_id.has_key(index): + del self._index_to_id[index] + + def get_ids_sorted(self): + # print 'get_ids_sorted',self.value + # print ' _index_to_id',self._index_to_id + # print ' sorted',sorted(self._index_to_id.iteritems()) + return OrderedDict(sorted(self._index_to_id.iteritems())).values() + + +class ColConf(Indexing, AttrConf): + + """ + Basic column configuration. + Here an ordered dictionary is used to represent the data. + #>>> from collections import OrderedDict + #>>> spam = OrderedDict([('s',(1,2)),('p',(3,4)),('a',(5,6)),('m',(7,8))]) + >>> spam.values() + + """ + # def __init__(self, **attrs): + # print 'ColConf',attrs + + def __init__(self, attrname, default, is_index=False, **attrs): + # print 'ColConf',attrs + self._is_index = is_index + AttrConf.__init__(self, attrname, default, + struct='odict', + **attrs) + + if is_index: + self._init_indexing() + + def is_index(self): + return self._is_index + + def get_defaults(self, ids): + # create a list, should work for all types and dimensions + # default can be scalar or an array of any dimension + # print '\n\nget_defaults',self.attrname,ids,self.get_default() + values = [] + for _id in ids: + values.append(self.get_default()) + # len(ids)*self.get_default() # makes links, not copies + return values + + def get_init(self): + """ + Returns initialization of attribute. + Usually same as get_default for scalars. + Overridden by table configuration classes + """ + ids = self._manager.get_ids() + + # print '\n\nget_init',self.attrname,ids + values = self.get_defaults(ids) + i = 0 + odict = OrderedDict() + for _id in ids: + odict[_id] = values[i] + i += 1 + # store locally if required + if self._is_localvalue: + self.value = odict + # pass on to calling instance + # in this cas the data is stored under self._obj + return odict + + def reset(self): + # this reset works also for np arrays! + odict = self.get_init() + if not self._is_localvalue: + setattr(self._obj, self.attrname, odict) + if self._is_index: + self.reset_index() + + def init_plugin(self, is_plugin): + if is_plugin: + self.plugin = Plugin(self) + self.set = self.set_plugin + self.get = self.get_plugin + self.add = self.add_plugin + self.delete = self.delete_plugin + else: + self.plugin = None + + def write_xml(self, fd, _id): + if self.xmltag != None: + self._write_xml_value(self[_id], fd) + + def __delitem__(self, ids): + # print ' before=\n',self.__dict__[attr] + #attr = self.attrconf.get_attr() + if hasattr(ids, '__iter__'): + if self._is_index: + self.del_indices(ids) + + array = self.get_value() + for _id in ids: + del array[_id] + + else: + if self._is_index: + self.del_index(ids) + + del self.get_value()[ids] + + def delete_item(self, _id): + # print ' before=\n',self.__dict__[attr] + #attr = self.attrconf.get_attr() + del self.get_value()[_id] + + def __getitem__(self, ids): + # print '__getitem__',key + if hasattr(ids, '__iter__'): + items = len(ids) * [None] + i = 0 + array = self.get_value() + for _id in ids: + items[i] = array[_id] + i += 1 + return items + else: + return self.get_value()[ids] + + def __setitem__(self, ids, values): + # print '__setitem__',ids,values,type(self.get_value()) + if hasattr(ids, '__iter__'): + if self._is_index: + # must be set before setting new value + self.set_indices(ids, values) + i = 0 + array = self.get_value() + for _id in ids: + array[_id] = values[i] + i += 1 + # if self._is_index: + # self.add_indices(ids, values) + else: + + if self._is_index: + # must be set before setting new value + self.set_index(ids, values) + self.get_value()[ids] = values + + # if self._is_index: + # self.add_index(ids, values) + + def add(self, ids, values=None): + if not hasattr(ids, '__iter__'): + _ids = [ids] + if values != None: + _values = [values] + else: + _ids = ids + _values = values + + if values == None: + _values = self.get_defaults(_ids) + + # print 'add ids, _values',ids, _values + # trick to prevent updating index before value is added + if self._is_index: + is_index_backup = True + self._is_index = False + else: + is_index_backup = False + + self[_ids] = _values + + if is_index_backup: + self._is_index = True + self.add_indices(_ids, _values) + + self._is_modified = True + + def add_plugin(self, ids, values=None): + if not hasattr(ids, '__iter__'): + _ids = [ids] + if values != None: + _values = [values] + else: + _ids = ids + _values = values + + # print 'add ids, _values',ids, _values + if values == None: + _values = self.get_defaults(_ids) + # trick to prevent updating index before value is added + if self._is_index: + is_index_backup = True + self._is_index = False + else: + is_index_backup = False + + self[_ids] = _values + + if is_index_backup: + self._is_index = True + self.add_indices(_ids, _values) + + self._is_modified = True + + if self.plugin: + self.plugin.exec_events_ids(EVTADDITEM, _ids) + + def get(self, ids): + """ + Central function to get the attribute value associated with ids. + should be overridden by specific array configuration classes + """ + return self[ids] + + def get_plugin(self, ids): + """ + Central function to get the attribute value associated with ids. + should be overridden by specific array configuration classes + """ + if self._plugin: + if not hasattr(ids, '__iter__'): + self.plugin.exec_events_ids(EVTGETITEM, [ids]) + else: + self.plugin.exec_events_ids(EVTGETITEM, ids) + return self[ids] + + def set(self, ids, values): + """ + Returns value of array element for all ids. + """ + + self[ids] = values + self._is_modified = True + # print 'set',self.attrname + if self._is_index: + self.set_indices(ids, values) + + def set_plugin(self, ids, values): + """ + Returns value of array element for all ids. + """ + self[ids] = values + self._is_modified = True + # print 'set',self.attrname + + if self.plugin: + if not hasattr(ids, '__iter__'): + self.plugin.exec_events_ids(EVTSETITEM, [ids]) + else: + self.plugin.exec_events_ids(EVTSETITEM, ids) + if self._is_index: + self.set_indices(ids, values) + + def delete(self, ids): + """ + removes key from array structure + To be overridden + """ + del self[ids] + self._is_modified = True + + def delete_plugin(self, ids): + """ + removes key from array structure + To be overridden + """ + if self.plugin: + if not hasattr(ids, '__iter__'): + self.plugin.exec_events_ids(EVTGETITEM, [ids]) + else: + self.plugin.exec_events_ids(EVTGETITEM, ids) + + del self[ids] + self._is_modified = True + + def format_value(self, _id, show_unit=False, show_parentesis=False): + if show_unit: + unit = ' ' + self.format_unit(show_parentesis) + else: + unit = '' + # return repr(self[_id])+unit + + #self.min = minval + #self.max = maxval + #self.digits_integer = digits_integer + #self.digits_fraction = digits_fraction + val = self[_id] + tt = type(val) + + if tt in (types.LongType, types.IntType): + return str(val) + unit + + elif tt in (types.FloatType, types.ComplexType): + if hasattr(attrconf, 'digits_fraction'): + digits_fraction = self.digits_fraction + else: + digits_fraction = 3 + return "%." + str(digits_fraction) + "f" % (val) + unit + + else: + return str(val) + unit + + # return str(self[_id])+unit + + def format(self, ids=None): + # TODO: incredibly slow when calling format_value for each value + text = '' + + if ids == None: + ids = self._manager.get_ids() + if not hasattr(ids, '__iter__'): + ids = [ids] + + #unit = self.format_unit() + attrname = self.attrname + for id in ids: + text += '%s[%d] = %s\n' % (attrname, id, + self.format_value(id, show_unit=True)) + + return text[:-1] # remove last newline + + +class NumcolConf(ColConf): + + def __init__(self, attrname, default, + digits_integer=None, digits_fraction=None, + minval=None, maxval=None, + **attrs): + self.min = minval + self.max = maxval + self.digits_integer = digits_integer + self.digits_fraction = digits_fraction + + ColConf.__init__(self, attrname, default, **attrs) + + +class IdsConf(ColConf): + + """ + Column, where each entry is the id of a single Table. + """ + + def __init__(self, attrname, tab, is_index=False, perm='r', **kwargs): + self._is_index = is_index + self._tab = tab + + AttrConf.__init__(self, attrname, + -1, # default id + struct='odict', + metatype='id', + perm=perm, + **kwargs + ) + self.init_xml() + # print 'IdsConf.__init__',attrname + # print ' ',self._tab.xmltag,self._attrconfig_id_tab + + def set_linktab(self, tab): + self._tab = tab + + def get_linktab(self): + return self._tab + + def init_xml(self): + # print 'init_xml',self.attrname + if self._tab.xmltag != None: + + # necessary?? see ObjMan.write_xml + xmltag_tab, xmltag_item_tab, attrname_id_tab = self._tab.xmltag + if (attrname_id_tab is None) | (attrname_id_tab is ''): + self._attrconfig_id_tab = None + else: + self._attrconfig_id_tab = getattr( + self._tab, attrname_id_tab) # tab = tabman ! + + if not hasattr(self, 'is_xml_include_tab'): + # this means that entire table rows will be included + self.is_xml_include_tab = False + # print ' xmltag_tab, xmltag_item_tab, + # attrname_id_tab',xmltag_tab, xmltag_item_tab, + # attrname_id_tab,self.is_xml_include_tab + + else: + self._attrconfig_id_tab = None + self.is_xml_include_tab = False + + def write_xml(self, fd, _id, indent=0): + if (self.xmltag is not None) & (self[_id] >= 0): + if self._attrconfig_id_tab == None: + self._write_xml_value(self[_id], fd) + elif self.is_xml_include_tab: + # this means that entire table rows will be included + self._tab.write_xml(fd, indent, ids=self[ + _id], is_print_begin_end=False) + else: + self._write_xml_value(self._attrconfig_id_tab[self[_id]], fd) + + def _write_xml_value(self, val, fd): + # print 'write_xml',self.xmltag,hasattr(val, '__iter__') + if hasattr(val, '__iter__'): + if len(val) > 0: + if hasattr(val[0], '__iter__'): + # matrix + fd.write(xm.mat(self.xmltag, val)) + else: + # list + fd.write(xm.arr(self.xmltag, val, self.xmlsep)) + else: + # empty list + # fd.write(xm.arr(self.xmltag,val)) + # don't even write empty lists + pass + + elif type(self._default) in (types.UnicodeType, types.StringType): + if len(val) > 0: + fd.write(xm.num(self.xmltag, val)) + + else: + # scalar number or string + fd.write(xm.num(self.xmltag, val)) + + def get_defaults(self, ids): + # create a list, should work for all types and dimensions + # default can be scalar or an array of any dimension + # print '\n\nget_defaults',self.attrname,ids,self.get_default() + return len(ids) * [-1] + + def _getstate_specific(self, state): + """ + Called by __getstate__ to add/change specific states, + before returning states. + To be overridden. + """ + if self._is_save: + # if self._is_child: + # # OK self.value already set in + # pass + # else: + # # remove table reference and create ident + state['_tab'] = None + state['_ident_tab'] = self._tab.get_ident_abs() + + def init_postload_internal(self, man, obj): + # print + # 'IdsConf.init_postload_internal',self.attrname,hasattr(self,'value'),self._is_save,self._is_localvalue,'obj:',obj.ident + + AttrConf.init_postload_internal(self, man, obj) + # if self._is_child: + # print ' make sure children get initialized' + # print ' call init_postload_internal of',self._tab.ident + # self._tab.init_postload_internal(obj) + + def init_postload_external(self): + # if self._is_child: + # # restore normally + # AttrConf.init_postload_external(self) + # self._tab.init_postload_external() + # else: + + # Substitute absolute ident with link object. + # Called from init_postload_external of attrsman during load_obj + # + ident_abs = self._ident_tab + # print 'reset_linkobj',self.attrname,ident_abs + obj = self.get_obj() + rootobj = obj.get_root() + # print ' rootobj',rootobj.ident + linkobj = rootobj.get_obj_from_ident(ident_abs) + # print ' linkobj',linkobj.ident + self._tab = linkobj + self.init_xml() + + def is_modified(self): + return False + + +class TabIdsConf(ColConf): + + """ + Column, where each entry contains a tuple with table object and id. + """ + + def __init__(self, attrname, is_index=False, **kwargs): + self._is_index = is_index + AttrConf.__init__(self, attrname, + -1, # default id + struct='odict', + metatype='tabids', + **kwargs + ) + + def get_defaults(self, ids): + # create a list, should work for all types and dimensions + # default can be scalar or an array of any dimension + # print '\n\nget_defaults',self.attrname,ids,self.get_default() + return len(ids) * [(None, -1)] + + def reset(self): + # TODO: this will reset all the tables + # instead should reset only the specified ids + if self._is_child: + for tab, ids in self.get_value(): + tab.reset() + + def clear(self): + self.reset() + # necessary? because tbles have been cleared from manager + # if self._is_child: + # for tab, ids in self.get_value(): + # tab.clear() + + def _getstate_specific(self, state): + """ + Called by __getstate__ to add/change specific states, + before returning states. + To be overridden. + """ + if self._is_save: + n = len(state['value']) + state['value'] = None + _tabids_save = n * [None] + i = 0 + for tab, ids in self.get_value(): + _tabids_save[i] = [tab.get_ident_abs(), ids] + i += 1 + state['_tabids_save'] = _tabids_save + + def init_postload_internal(self, man, obj): + # print + # 'IdsConf.init_postload_internal',self.attrname,hasattr(self,'value'),self._is_save,self._is_localvalue,'obj:',obj.ident + + AttrConf.init_postload_internal(self, man, obj) + # if self._is_child: + # print ' make sure children get initialized' + # print ' call init_postload_internal of',self._tab.ident + # self._tab.init_postload_internal(obj) + + def init_postload_external(self): + # if self._is_child: + # # restore normally + # AttrConf.init_postload_external(self) + # self._tab.init_postload_external() + # else: + + # Substitute absolute ident with link object. + # Called from init_postload_external of attrsman during load_obj + # + #ident_abs = self._ident_tab + # print 'reset_linkobj',self.attrname,ident_abs + #obj = self.get_obj() + #rootobj = obj.get_root() + # print ' rootobj',rootobj.ident + #linkobj = rootobj.get_obj_from_ident(ident_abs) + # print ' linkobj',linkobj.ident + #self._tab = linkobj + + # Substitute absolute ident with link object. + # Called from init_postload_external of attrsman during load_obj + # + _tabids_save = self._tabids_save + #ident_abs = self._ident_value + # print 'init_postload_external',self.attrname,_tabids_save + obj = self.get_obj() + rootobj = obj.get_root() + # print ' rootobj',rootobj.ident + tabids = len(self._tabids_save) * [None] + i = 0 + for tabident, ids in self._tabids_save: + tab = rootobj.get_obj_from_ident(tabident) + # print ' ',tab.get_ident_abs(), ids + tabids[i] = [tab, ids] + i += 1 + + self.set_value(tabids) + + def is_modified(self): + return False + + +class ObjsConf(ColConf): + + """ + Column, where each entry is an object of class objclass with + ident= (attrname, id). + """ + + def __init__(self, attrname, is_index=False, **kwargs): + self._is_index = is_index + self._is_child = True # at the moment no links possible + AttrConf.__init__(self, attrname, + BaseObjman('empty'), # default id + struct='odict', + metatype='obj', + perm='r', + **kwargs + ) + + def set_obj(self, obj): + """ + Method to set instance of managed object. + Used by add method of AttrManager + """ + # print 'set_obj',self.attrname,obj.ident + AttrConf.set_obj(self, obj) + + # if self._is_child: + obj.set_child(self) + + # def get_valueobj(self, id = None): + # """ + # This is called by get_childobj to retrive the child instance. + # Here this is just the table. + # """ + # return self._tab + + def predelete(self): + AttrConf.predelete(self) + # if self._is_child: + self.get_obj().del_child(self.attrname) + + # def _getstate_specific(self, state): + # """ + # Called by __getstate__ to add/change specific states, + # before returning states. + # To be overridden. + # """ + # if self._is_save: + # if self._is_child: + # # OK self.value already set in + # pass + # else: + # # remove column reference and create column with idents + # state['value']= None + # idents_obj = OrderedDict() + # linkobjs = self.get_value() + # for _id in self.get_ids(): + # idents_obj[_id] = linkobjs[_id].get_ident_abs() + # state['_idents_obj'] = idents_obj + + def init_postload_internal(self, man, obj): + # print + # 'ObjsConf.init_postload_internal',self.attrname,hasattr(self,'value'),self._is_save,self._is_localvalue,'obj:',obj.ident + + AttrConf.init_postload_internal(self, man, obj) + # if self._is_child: + + # make sure all children in column get initialized + # print ' make sure childrenS get initialized' + childobjs = self.get_value() + + obj = self.get_obj() + # print 'init_postload_internal',self.attrname,obj,obj.ident + for _id in obj.get_ids(): + # print ' call init_postload_internal of',childobjs[_id].ident + # attention obj is the parent object! + childobjs[_id].init_postload_internal(obj) + + def reset(self): + # print 'ObjsConf.reset',self.get_value(),len(self.get_obj().get_ids()) + #obj = self.get_obj() + # print 'init_postload_internal',self.attrname,obj,obj.ident + for _id in self.get_obj().get_ids(): + # print ' call reset of',childobjs[_id].ident,_id + childobjs[_id].reset() + + def clear(self): + odict = self.get_init() + if not self._is_localvalue: + setattr(self._obj, self.attrname, odict) + if self._is_index: + self.reset_index() + + def is_modified(self): + # if self._is_child + #is_modified = self.get_value().is_modified() + # print 'is_modified', self.attrname, is_modified + + childobjs = self.get_value() + + #obj = self.get_obj() + # print 'init_postload_internal',self.attrname,obj,obj.ident + for _id in self.get_obj().get_ids(): + # print ' call init_postload_internal of',childobjs[_id].ident + if childobjs[_id].is_modified(): + return True + + def set_modified(self, is_modified): + childobjs = self.get_value() + + obj = self.get_obj() + # print 'init_postload_internal',self.attrname,obj,obj.ident + for _id in self.get_obj().get_ids(): + # print ' call init_postload_internal of',childobjs[_id].ident + childobjs[_id].set_modified(is_modified) + + def init_postload_external(self): + # if self._is_child: + # restore normally + AttrConf.init_postload_external(self) + childobjs = self.get_value() + + for _id in self.get_obj().get_ids(): + childobjs[_id].init_postload_external() + + # def get_name(self): + # return self.'Table ID for '+self._tab.get_name() + # + # def get_info(self): + # return 'ID for Table:\n'+self._tab.get_info() + + +class Attrsman: + + """ + Manages all attributes of an object + + if argument obj is specified with an instance + then attributes are stored under this instance. + The values of attrname is then directly accessible with + + obj.attrname + + If nothing is specified, then column attribute will be stored under + the respective config instance of this attrsman (self). + The values of attrname is then directly accessible with + + self.attrname.value + """ + + def __init__(self, obj, attrname='attrsman', is_plugin=False): + + if obj == None: + # this means that column data will be stored + # in value attribute of attrconfigs + obj = self + self._is_localvalue = True + else: + # this means that column data will be stored under obj + self._is_localvalue = False + + self._obj = obj # managed object + self._attrconfigs = [] # managed attribute config instances + # the manager's attribute name in the obj instance + self.attrname = attrname + + # groupes of attributes + # key=groupname, value = list of attribute config instances + self._groups = {} + + self.init_plugin(is_plugin) + + def init_plugin(self, is_plugin): + if is_plugin: + self.plugin = Plugin(self) + else: + self.plugin = None + + def is_localvalue(self): + return self._is_localvalue + + def has_attrname(self, attrname): + # attention this is a trick, exploiting the fact that the + # attribute object with all the attr info is an attribute + # of the attr manager (=self) + return hasattr(self, attrname) + + def is_modified(self): + for attrconf in self._attrconfigs: + if attrconf.is_modified(): + return True + return False + + def set_modified(self, is_modified=True): + for attrconf in self._attrconfigs: + attrconf.set_modified(is_modified) + + def get_modified(self): + # returns a list of modified attributes + modified = [] + for attrconf in self._attrconfigs: + if attrconf.is_modified(): + modified.append(attrconf) + return modified + + def get_config(self, attrname): + return getattr(self, attrname) # a bit risky + + def get_configs(self, is_all=False, structs=None, filtergroupnames=None): + # print + # 'get_configs',self,self._obj.ident,structs,filtergroupnames,len(self._attrconfigs) + if is_all: + return self._attrconfigs + else: + attrconfigs = [] + for attrconf in self._attrconfigs: + # print ' found',attrconf.attrname,attrconf.struct + is_check = True + if (structs != None): + if (attrconf.struct not in structs): + is_check = False + + if is_check: + # print ' **is_check',is_check + if len(attrconf.groupnames) > 0: + if '_private' not in attrconf.groupnames: + # print ' not private' + if filtergroupnames != None: + # print ' apply + # filtergroupnames',filtergroupnames,attrconf.groupnames + if not set(filtergroupnames).isdisjoint(attrconf.groupnames): + # print ' append',attrconf.attrname + attrconfigs.append(attrconf) + else: + # print ' no filtergroupnames' + attrconfigs.append(attrconf) + else: + if filtergroupnames == None: + attrconfigs.append(attrconf) + + return attrconfigs + + # def get_colconfigs(self, is_all = False): + # return [] + + def get_obj(self): + return self._obj + + def add(self, attrconf): + """ + Add a one or several new attributes to be managed. + kwargs has attribute name as key and Attribute configuration object + as value. + """ + + attrname = attrconf.attrname + # print + # 'Attrsman.add',self.get_obj().ident,'add',attrname,self.has_attrname(attrname) + if not self.has_attrname(attrname): + attrconf.set_obj(self._obj) + attrconf.set_manager(self) + + # set configuration object as attribute of AttrManager + setattr(self, attrname, attrconf) + + # append also to the list of managed objects + self._attrconfigs.append(attrconf) + + # insert in groups + if len(attrconf.groupnames) > 0: + for groupname in attrconf.groupnames: + + if not self._groups.has_key(groupname): + self._groups[groupname] = [] + + self._groups[groupname].append(attrconf) + + if self.plugin: + self.plugin.exec_events_attr(EVTADD, attrconf) + + # return default value as attribute of managed object + if attrconf.struct in STRUCTS_SCALAR: # == 'scalar': + return attrconf.get_init() + else: + return None # table configs do their own init + + else: + # print ' attribute with this name already + # exists',attrname,type(attrconf) + del attrconf + attrconf = getattr(self, attrname) + # print ' existing',attrconf,type(attrconf) + if attrconf.struct in STRUCTS_SCALAR: # == 'scalar': + return attrconf.get_value() + else: + return None # table configs do their own init + + def get_groups(self): + return self._groups + + def get_groupnames(self): + return self._groups.keys() + + def has_group(self, groupname): + return self._groups.has_key(groupname) + + def get_group(self, name): + """ + Returns a list with attributes that belong to that group name. + """ + # print 'get_group self._groups=\n',self._groups.keys() + return self._groups.get(name, []) + + def get_group_attrs(self, name): + """ + Returns a dictionary with all attributes of a group. + Key is attribute name and value is attribute value. + """ + # print 'get_group_attrs', self._groups + attrs = {} + for attrconf in self._groups[name]: + attrs[attrconf.attrname] = getattr(self._obj, attrconf.attrname) + return attrs + + def print_attrs(self, show_unit=True, show_parentesis=False, attrconfigs=None): + print 'Attributes of', self._obj._name, 'ident_abs=', self._obj.get_ident_abs() + if attrconfigs == None: + attrconfigs = self.get_configs() + + for attrconf in attrconfigs: + print ' %s =\t %s' % (attrconf.attrname, attrconf.format_value(show_unit=True)) + + def save_values(self, state): + """ + Called by the managed object during save to save the + attribute values. + """ + for attrconfig in self.get_configs(): + attrconfig.save_value(state) + + def delete(self, attrname): + """ + Delete attibite with respective name + """ + # print '.__delitem__','attrname=',attrname + + # if hasattr(self,attrname): + attrconf = getattr(self, attrname) + + if attrconf in self._attrconfigs: + if self.plugin: + self.plugin.exec_events_attr(EVTDEL, attrconf) + + for groupname in attrconf.groupnames: + self._groups[groupname].remove(attrconf) + + self._attrconfigs.remove(attrconf) + attrconf.predelete() # this will remove also the value attribute + + #attrname = attrconf.attrname + del self.__dict__[attrname] # delete config + return True + + return False # attribute not managed + # return False # attribute not existant + + def __getstate__(self): + # print '__getstate__',self.attrname + # print ' self.__dict__=\n',self.__dict__.keys() + + state = {} + for attr in self.__dict__.keys(): + # print ' attr',attr,self.__dict__[attr] + # TODO: optimize and put this at the end + if attr == 'plugin': + plugin = self.__dict__[attr] + if plugin != None: + state[attr] = True + else: + state[attr] = False + + elif attr not in ATTRS_NOSAVE: + state[attr] = self.__dict__[attr] + # print ' state=', state + return state + + def __setstate__(self, state): + # print '__setstate__',self + + # this is always required, but will not be saved + # self.plugins={} + + for attr in state.keys(): + # print ' set state',attr + # plugin set in init_postload_internal + # if attr=='plugin': + # if state[attr]==True: + # self.__dict__[attr] = Plugin(self) + # else: + # self.__dict__[attr]= None + # else: + self.__dict__[attr] = state[attr] + + def init_postload_internal(self, obj): + """ + Called after set state. + Link internal states. + """ + # print 'Attrsman.init_postload_internal of obj:',obj.ident + + self._obj = obj + self.init_plugin(self.plugin) + for attrconfig in self.get_configs(is_all=True): + # print ' call init_postload_internal of',attrconfig.attrname + attrconfig.init_postload_internal(self, obj) + + def init_postload_external(self): + """ + Called after set state. + Link external states. + """ + # print 'init_postload_external',self._obj.get_ident() + + for attrconfig in self.get_configs(is_all=True): + # print ' **',attrconfig.attrname,attrconfig.metatype + attrconfig.init_postload_external() + + +class Tabman(Attrsman): + + """ + Manages all table attributes of an object. + + if argument obj is specified with an instance + then column attributes are stored under this instance. + The values of attrname is then directly accessible with + + obj.attrname + + If nothing is specified, then column attribute will be stored under + the respective config instance of this tab man (self). + The values of attrname is then directly accessible with + + self.attrname.value + + """ + + def __init__(self, obj=None, **kwargs): + Attrsman.__init__(self, obj, **kwargs) + self._colconfigs = [] + self._ids = [] + + def add_col(self, attrconf): + # print 'add_col',attrconf.attrname,attrconf.is_index() + attrname = attrconf.attrname + if not self.has_attrname(attrname): + Attrsman.add(self, attrconf) # insert in common attrs database + self._colconfigs.append(attrconf) + # returns initial array and also create local array if + # self._is_localvalue == True + return attrconf.get_init() + else: + return getattr(self, attrname).get_value() + + def delete(self, attrname): + """ + Delete attribute with respective name + """ + # print '.__delitem__','attrname=',attrname + + if hasattr(self, attrname): + attrconf = getattr(self, attrname) + if self.plugin: + self.plugin.exec_events_attr(EVTDEL, attrconf) + if Attrsman.delete(self, attrname): + if attrconf in self._colconfigs: + self._colconfigs.remove(attrconf) + + def get_colconfigs(self, is_all=False, filtergroupnames=None): + if is_all: + return self._colconfigs + else: + colconfigs = [] + for colconfig in self._colconfigs: + if len(colconfig.groupnames) > 0: + if colconfig.groupnames[0] != '_private': + if filtergroupnames != None: + if not set(filtergroupnames).isdisjoint(colconfig.groupnames): + colconfigs.append(colconfig) + else: + colconfigs.append(colconfig) + + else: + if filtergroupnames == None: + colconfigs.append(colconfig) + + return colconfigs + + def get_ids(self): + return self._ids + + def __len__(self): + """ + Determine current array length (same for all arrays) + """ + + return len(self._ids) + + def __contains__(self, _id): + return _id in self._ids + + def select_ids(self, mask): + + ids_mask = [] + i = 0 + for _id in self.get_ids(): + if mask[i]: + ids_mask.append(_id) + i += 1 + + return ids_mask + + def suggest_id(self, is_zeroid=False): + """ + Returns a an availlable id. + + Options: + is_zeroid=True allows id to be zero. + + """ + if is_zeroid: + id0 = 0 + else: + id0 = 1 + + id_set = set(self.get_ids()) + if len(id_set) == 0: + id_max = 0 + else: + id_max = max(id_set) + # print 'suggest_id',id0, + return list(id_set.symmetric_difference(xrange(id0, id_max + id0 + 1)))[0] + + def suggest_ids(self, n, is_zeroid=False): + """ + Returns a list of n availlable ids. + It returns even a list for n=1. + + Options: + is_zeroid=True allows id to be zero. + """ + if is_zeroid: + id0 = 0 + else: + id0 = 1 + id_set = set(self.get_ids()) + if len(id_set) == 0: + id_max = 0 + else: + id_max = max(id_set) + + return list(id_set.symmetric_difference(xrange(id0, id_max + id0 + n)))[:n] + + def add_rows(self, n=None, ids=[], **attrs): + if n != None: + ids = self.suggest_ids(n) + elif len(ids) == 0: + # get number of rows from any valye vector provided + ids = self.suggest_ids(len(attrs.values()[0])) + else: + # ids already given , no ids to create + pass + + self._ids += ids + # print 'add_rows ids', ids + for colconfig in self._colconfigs: + colconfig.add(ids, values=attrs.get(colconfig.attrname, None)) + if self.plugin: + self.plugin.exec_events_ids(EVTADDITEM, ids) + return ids + + def add_row(self, _id=None, **attrs): + if _id == None: + _id = self.suggest_id() + self._ids += [_id, ] + for colconfig in self._colconfigs: + colconfig.add(_id, values=attrs.get(colconfig.attrname, None)) + if self.plugin: + self.plugin.exec_events_ids(EVTADDITEM, [_id]) + return _id + + def set_row(self, _id, **attrs): + for colconfig in self._colconfigs: + colconfig.set(_id, values=attrs.get(colconfig.attrname, None)) + if self.plugin: + self.plugin.exec_events_ids(EVTSETITEM, [_id]) + + def set_rows(self, ids, **attrs): + + # print 'add_rows ids', ids + for colconfig in self._colconfigs: + colconfig.set(ids, values=attrs.get(colconfig.attrname, None)) + if self.plugin: + self.plugin.exec_events_ids(SETSETITEM, ids) + + def get_row(self, _id): + attrvalues = {} + if self.plugin: + self.plugin.exec_events_ids(EVTGETITEM, [_id]) + for attrconfig in self._colconfigs: + attrvalues[attrconfig.attrname] = attrconfig[_id] + + return attrvalues + + def del_rows(self, ids): + if self.plugin: + self.plugin.exec_events_ids(EVTDELITEM, ids) + for colconfig in self._colconfigs: + del colconfig[ids] + + for _id in ids: + self._ids.remove(_id) + + def del_row(self, _id): + if self.plugin: + self.plugin.exec_events_ids(EVTDELITEM, [_id]) + for colconfig in self._colconfigs: + del colconfig[_id] + self._ids.remove(_id) + + def __delitem__(self, ids): + """ + remove rows correspondent to the given ids from all array and dict + attributes + """ + if hasattr(ids, '__iter__'): + self.del_rows(ids) + else: + self.del_row(ids) + + def print_attrs(self, **kwargs): + # print 'Attributes of',self._obj._name,'(ident=%s)'%self._obj.ident + Attrsman.print_attrs(self, attrconfigs=self.get_configs( + structs=['scalar']), **kwargs) + # print ' ids=',self._ids + for _id in self.get_ids(): + for attrconf in self.get_configs(structs=STRUCTS_COL): + print ' %s[%d] =\t %s' % (attrconf.attrname, _id, attrconf.format_value(_id, show_unit=True)) + + +class BaseObjman: + + """ + Object management base methods to be inherited by all object managers. + """ + + def __init__(self, ident, is_plugin=False, **kwargs): + # print 'BaseObjman.__init__',kwargs + self._init_objman(ident, **kwargs) + self.set_attrsman(Attrsman(self, is_plugin=is_plugin)) + # print 'BaseObjman.__init__',self.format_ident(),'parent=',self.parent + self._init_attributes() + self._init_constants() + + def set_attrsman(self, attrsman): + self._attrsman = attrsman + return attrsman + + def _init_objman(self, ident='no_ident', parent=None, name=None, + managertype='basic', info=None, logger=None, + xmltag=None, version=0.0): + # print 'BaseObjman._init_objman',ident,logger + self.managertype = managertype + self.ident = ident + self.set_version(version) + self.set_logger(logger) + + self.parent = parent + # dict with attrname as key and child instance as value + self.childs = {} + + self._info = info + + self._is_saved = False + + if name == None: + self._name = self.format_ident() + else: + self._name = name + # self._init_xml(xmltag) + self.xmltag = xmltag + + # must be called explicitely during __init__ + # self._init_attributes() + # self._init_constants() + + def _init_attributes(self): + """ + This is the place to add all attributes. + This method will be called to initialize + and after loading a saved object. + Use this method also to update a version. + """ + pass + + def _init_constants(self): + """ + This is the place to init any costants that are outside the management. + Constants are not saved. + This method will be called to initialize and after loading a saved object. + """ + pass + + def set_version(self, version): + self._version = version + + def get_version(self): + return self._version + + # def _upgrade_version(self): + # pass + + # def _init_xml(self,xmltag=None): + # if xmltag != None: + # self.xmltag = xmltag + # else: + # self.xmltag = self.get_ident() + + def reset(self): + """ + Resets all attributes to default values + """ + for attrconfig in self.get_attrsman().get_configs(is_all=True): + attrconfig.reset() + + def clear(self): + """ + Clear tables and reset scalars. + """ + for attrconfig in self.get_attrsman().get_configs(is_all=True): + attrconfig.clear() + + def write_xml(self, fd, ident): + if self.xmltag != None: + # figure out scalar attributes and child objects + attrconfigs = [] + objconfigs = [] + for attrconfig in self.get_attrsman().get_configs(structs=STRUCTS_SCALAR): + if (attrconfig.metatype == 'obj'): # better use self.childs + if (attrconfig.get_value().xmltag != None) & attrconfig.is_child(): + objconfigs.append(attrconfig) + elif attrconfig.xmltag != None: + attrconfigs.append(attrconfig) + + # start writing + if len(attrconfigs) > 0: + # there are scalar attributes + fd.write(xm.start(self.xmltag, ident)) + for attrconfig in attrconfigs: + attrconfig.write_xml(fd) + + # are there child objects to write + if len(objconfigs) > 0: + fd.write(xm.stop()) + for attrconfig in objconfigs: + attrconfig.get_value().write_xml(fd, ident + 2) + fd.write(xm.end(self.xmltag, ident)) + else: + fd.write(xm.stopit()) + else: + # no scalars + fd.write(xm.begin(self.xmltag, ident)) + if len(objconfigs) > 0: + for attrconfig in objconfigs: + attrconfig.get_value().write_xml(fd, ident + 2) + fd.write(xm.end(self.xmltag, ident)) + + def get_logger(self): + # print 'get_logger',self.ident,self._logger,self.parent + if self._logger != None: + return self._logger + else: + return self.parent.get_logger() + + def set_logger(self, logger): + # print 'set_logger',self.ident,logger + self._logger = logger + + def __repr__(self): + # return '|'+self._name+'|' + return self.format_ident() + + def is_modified(self): + return self._attrsman.is_modified() + + def set_modified(self, is_modified=True): + self._attrsman.set_modified(is_modified) + + def get_name(self): + return self._name + + def get_info(self): + if self._info == None: + return self.__doc__ + else: + return self._info + + def get_ident(self): + return self.ident + + def _format_ident(self, ident): + if hasattr(ident, '__iter__'): + return str(ident[0]) + '#' + str(ident[1]) + else: + return str(ident) + + def format_ident(self): + return self._format_ident(self.ident) + + def format_ident_abs(self): + s = '' + # print 'format_ident_abs',self.get_ident_abs() + for ident in self.get_ident_abs(): + s += self._format_ident(ident) + '.' + return s[:-1] + + def get_root(self): + if self.parent != None: + return self.parent.get_root() + else: + return self + + def get_ident_abs(self): + """ + Returns absolute identity. + This is the ident of this object in the global tree of objects. + If there is a parent objecty it must also be managed by the + object manager. + """ + # print 'obj.get_ident_abs',self.ident,self.parent, type(self.parent) + if self.parent != None: + return self.parent.get_ident_abs() + [self.ident] + else: + return [self.get_ident()] + + def get_obj_from_ident(self, ident_abs): + # print 'get_obj_from_ident',self.ident,ident_abs + if len(ident_abs) == 1: + # arrived at the last element + # check if it corresponds to the present object + if ident_abs[0] == self.ident: + return self + else: + return None # could throw an error + else: + return self.get_childobj(ident_abs[1]).get_obj_from_ident(ident_abs[1:]) + + def get_childobj(self, attrname): + """ + Return child instance + """ + config = self.childs[attrname] + return config.get_value() + + def set_child(self, childconfig): + """ + Set child childconfig + """ + self.childs[childconfig.attrname] = childconfig + + def del_child(self, attrname): + """ + Return child instance + """ + del self.childs[attrname] + + def get_parent(self): + return self.parent + + # def reset_parent(self, parent): + # self.parent=parent + + # def set_attrsman(self, attrsman): + # # for quicker acces and because it is only on + # # the attribute management is public and also directly accessible + # #setattr(self, attrname,Attrsman(self))# attribute management + # self._attrsman = attrsman + # #return attrsman + + def get_attrsman(self): + return self._attrsman + + def _getstate_specific(self, state): + """ + Called by __getstate__ to add/change specific states, + before returning states. + To be overridden. + """ + pass + + def __getstate__(self): + # print '__getstate__',self.ident,self._is_saved + # print ' self.__dict__=\n',self.__dict__.keys() + state = {} + # if not self._is_saved: + + # if self._is_saved: + # # this message indicates a loop!! + # print 'WARNING in __getstate__: object already + # saved',self.format_ident_abs() + + # print ' save standart values' + for attr in ATTRS_SAVE: + if hasattr(self, attr): + state[attr] = getattr(self, attr) + + # print ' save all scalar stuctured attributes' + # attrsman knows which and how + # self._attrsman.save_values(state) + # + # values of configured attributes are not saved here + # values are now ALWAYS stored in the value attribute of the + # attrconfig and reset in main obj + + # print ' save also attrsman' + state['_attrsman'] = self._attrsman + self._getstate_specific(state) + + self._is_saved = True + + # else: + # print 'WARNING in __getstate__: object %s already saved'%self.ident + return state + + def __setstate__(self, state): + # print '__setstate__',self + + # this is always required, but will not be saved + # self.plugins={} + + for key in state.keys(): + # print ' set state',key + self.__dict__[key] = state[key] + + self._is_saved = False + # done in init2_config... + # set default values for all states tha have not been saved + # for attr in self._config.keys(): + # if (not self._config[attr]['save']) & (not hasattr(self,attr)): + # print ' config attr',attr + # self.config(attr,**self._config[attr]) + + # set other states + # self._setstate(state) + + def init_postload_internal(self, parent): + """ + Called after set state. + Link internal states and call constant settings. + """ + # print 'BaseObjman.init_postload_internal',self.ident,'parent:', + # if parent != None: + # print parent.ident + # else: + # print 'ROOT' + self.parent = parent + self.childs = {} + self._attrsman.init_postload_internal(self) + + def init_postload_external(self): + """ + Called after set state. + Link internal states. + """ + # set default logger + self.set_logger(Logger(self)) + # for child in self.childs.values(): + # child.reset_parent(self) + self._attrsman.init_postload_external() + self._init_attributes() + self._init_constants() + + +class TableMixin(BaseObjman): + + def format_ident_row(self, _id): + # print 'format_ident_row',_id + return self.format_ident() + '[' + str(_id) + ']' + + def format_ident_row_abs(self, _id): + return self.format_ident_abs() + '[' + str(_id) + ']' + + def get_obj_from_ident(self, ident_abs): + # print 'get_obj_from_ident',self.ident,ident_abs,type(ident_abs) + if len(ident_abs) == 1: + # arrived at the last element + # check if it corresponds to the present object + ident_check = ident_abs[0] + + # now 2 things can happen: + # 1.) the ident is a simple string identical to ident of the object + # in this case, return the whole object + # 2.) ident is a tuple with string and id + # in this case return object and ID + # if hasattr(ident_check, '__iter__'): + # #if (ident_check[0] == self.ident)&(ident_check[1] in self._ids): + # if ident_check[1] in self._ids: + # return (self, ident_check[1]) + # else: + # return None # could throw an error + # else: + if ident_check == self.ident: + return self + else: + childobj = self.get_childobj(ident_abs[1]) + return childobj.get_obj_from_ident(ident_abs[1:]) + + def get_childobj(self, ident): + """ + Return child instance. + This is any object with ident + """ + if hasattr(ident, '__iter__'): + # access of ObjsConf configured child + # get object from column attrname + attrname, _id = ident + config = self.childs[attrname] + return config[_id] # config.get_valueobj(_id) + else: + # access of ObjConf configured child + # get object from attrname + config = self.childs[ident] + return config.get_value() + + def __getstate__(self): + # print '__getstate__',self.ident,self._is_saved + # print ' self.__dict__=\n',self.__dict__.keys() + state = {} + if 1: # not self._is_saved: + + # print ' save standart values' + for attr in ATTRS_SAVE + ATTRS_SAVE_TABLE: + if attr == 'plugin': + plugin = self.__dict__[attr] + if plugin != None: + state[attr] = True + else: + state[attr] = False + + elif hasattr(self, attr): + state[attr] = getattr(self, attr) + + # save managed attributes !!! + for attrconfig in self.get_configs(is_all=True): + state[attrconfig.attrname] = attrconfig + + # print ' save all scalar stuctured attributes' + # attrsman knows which and how + # self.save_values(state) + + # print ' save also attrsman' + #state['attrsman'] = self._attrsman + self._is_saved = True + + else: + print 'WARNING in __getstate__: object %s already saved' % self.ident + return state + + def __setstate__(self, state): + # print '__setstate__',self.ident + + # this is always required, but will not be saved + self.plugins = {} + + for attr in state.keys(): + # print ' set state',key + if attr == 'plugin': + if state[attr] == True: + self.__dict__[attr] = Plugin(self) + else: + self.__dict__[attr] = None + else: + self.__dict__[attr] = state[attr] + + self._is_saved = False + # done in init2_config... + # set default values for all states tha have not been saved + # for attr in self._config.keys(): + # if (not self._config[attr]['save']) & (not hasattr(self,attr)): + # print ' config attr',attr + # self.config(attr,**self._config[attr]) + + # set other states + # self._setstate(state) + + def init_postload_internal(self, parent): + """ + Called after set state. + Link internal states. + """ + # print 'TableObjman.init_postload_internal',self.ident,'parent:', + # if parent != None: + # print parent.ident + # else: + # print 'ROOT' + + self.parent = parent + self.childs = {} + self.set_attrsman(self) + Attrsman.init_postload_internal(self, self) + + self._is_saved = False + + def init_postload_external(self): + """ + Called after set state. + Link internal states. + """ + Attrsman.init_postload_external(self) + # no: BaseObjman.init_postload_external(self) + self._init_attributes() + self._init_constants() + + def export_csv(self, filepath, sep=',', name_id='ID', + file=None, attrconfigs=None, ids=None, groupname=None, + is_header=True, is_ident=False, is_timestamp=True): + + # print 'export_csv',filepath,"*"+sep+"*" + fd = open(filepath, 'w') + + if ids == None: + ids = self.get_ids() + + if groupname != None: + attrconfigs = self.get_group(groupname) + is_exportall = False + + if attrconfigs == None: + attrconfigs = self.get_colconfigs(is_all=True) + is_exportall = False + else: + is_exportall = True + + # header + if is_header: + + row = self._clean_csv(self.get_name(), sep) + if is_ident: + row += sep + '(ident=%s)' % self.format_ident_abs() + fd.write(row + '\n') + if is_timestamp: + now = datetime.now() + fd.write(self._clean_csv(now.isoformat(), sep) + '\n') + fd.write('\n\n') + + # first table row + row = name_id + for attrconf in attrconfigs: + # print ' write first row',attrconf.attrname + is_private = attrconf.has_group('_private') + if ((not is_private) & (attrconf.is_save())) | is_exportall: + row += sep + self._clean_csv(attrconf.format_symbol(), sep) + fd.write(row + '\n') + + # rest + for _id in ids: + # if self._is_keyindex: + # row = str(self.get_key_from_id(id))#.__repr__() + # else: + row = str(_id) + row = self._clean_csv(row, sep) + for attrconf in attrconfigs: + is_private = attrconf.has_group('_private') + if ((not is_private) & (attrconf.is_save())) | is_exportall: + row += sep + \ + self._clean_csv( + '%s' % (attrconf.format_value(_id, show_unit=False)), sep) + + # make sure there is no CR in the row!! + # print row + fd.write(row + '\n') + + if filepath != None: + fd.close() + + def _clean_csv(self, row, sep): + row = row.replace('\n', ' ') + #row=row.replace('\b',' ') + row = row.replace('\r', ' ') + #row=row.replace('\f',' ') + #row=row.replace('\newline',' ') + row = row.replace(sep, ' ') + return row + + def clear_rows(self): + if self.plugin: + self.plugin.exec_events_ids(EVTDELITEM, self.get_ids()) + self._ids = [] + for colconfig in self.get_attrsman()._colconfigs: + # print + # 'ArrayObjman.clear_rows',colconfig.attrname,len(colconfig.get_value()) + colconfig.clear() + # print ' done',len(colconfig.get_value()) + + def clear(self): + # print 'ArrayObjman.clear',self.ident + # clear/reset scalars + for attrconfig in self.get_attrsman().get_configs(structs=STRUCTS_SCALAR): + attrconfig.clear() + self.clear_rows() + self.set_modified() + + def _write_xml_body(self, fd, indent, objconfigs, idcolconfig_include_tab, colconfigs, + objcolconfigs, xmltag_item, attrconfig_id, xmltag_id, ids, ids_xml): + + # print '_write_xml_body ident,ids',self.ident,ids + if ids is None: + ids = self.get_ids() + + if ids_xml is None: + ids_xml = ids + + for attrconfig in objconfigs: + attrconfig.get_value().write_xml(fd, indent + 2) + + # check if columns contain objects + #objcolconfigs = [] + scalarcolconfigs = colconfigs + # for attrconfig in colconfigs: + # if attrconfig.metatype == 'obj': + # objcolconfigs.append(attrconfig) + # else: + # scalarcolconfigs.append(attrconfig) + + for _id, id_xml in zip(ids, ids_xml): + fd.write(xm.start(xmltag_item, indent + 2)) + + # print ' make tag and id',_id + if xmltag_id == '': + # no id tag will be written + pass + elif (attrconfig_id is None) & (xmltag_id is not None): + # use specified id tag and and specified id values + fd.write(xm.num(xmltag_id, id_xml)) + + elif (attrconfig_id is not None): + # use id tag and values of attrconfig_id + attrconfig_id.write_xml(fd, _id) + + # print ' write + # columns',len(scalarcolconfigs)>0,len(idcolconfig_include_tab)>0,len(objcolconfigs)>0 + for attrconfig in scalarcolconfigs: + # print ' scalarcolconfig',attrconfig.attrname + attrconfig.write_xml(fd, _id) + + if (len(idcolconfig_include_tab) > 0) | (len(objcolconfigs) > 0): + fd.write(xm.stop()) + + for attrconfig in idcolconfig_include_tab: + # print ' include_tab',attrconfig.attrname + attrconfig.write_xml(fd, _id, indent + 4) + + for attrconfig in objcolconfigs: + # print ' objcolconfig',attrconfig.attrname + attrconfig[_id].write_xml(fd, indent + 4) + fd.write(xm.end(xmltag_item, indent + 2)) + else: + fd.write(xm.stopit()) + + # print ' _write_xml_body: done' + + def write_xml(self, fd, indent, xmltag_id='id', ids=None, ids_xml=None, + is_print_begin_end=True, attrconfigs_excluded=[]): + # print 'write_xml',self.ident#,ids + if self.xmltag != None: + xmltag, xmltag_item, attrname_id = self.xmltag + + if xmltag == '': # no begin end statements + is_print_begin_end = False + + if ids != None: + if not hasattr(ids, '__iter__'): + ids = [ids] + + if attrname_id == '': # no id info will be written + attrconfig_id = None + xmltag_id = '' + + elif attrname_id != None: # an attrconf for id has been defined + attrconfig_id = getattr(self.get_attrsman(), attrname_id) + xmltag_id = None # this will define the id tag + else: + # native id will be written using xmltag_id from args + attrconfig_id = None + + # print ' attrname_id,attrconfig_id',attrname_id,attrconfig_id + # if attrconfig_id is not None: + # print ' attrconfig_id',attrconfig_id.attrname + + # figure out scalar attributes and child objects + attrconfigs = [] + objconfigs = [] + colconfigs = [] + objcolconfigs = [] + idcolconfig_include_tab = [] + for attrconfig in self.get_attrsman().get_configs(is_all=True): + # print ' check',attrconfig.attrname,attrconfig.xmltag!= + # None,attrconfig.is_colattr(),attrconfig.metatype + if attrconfig == attrconfig_id: + pass + elif attrconfig in attrconfigs_excluded: + pass + elif attrconfig.is_colattr() & (attrconfig.metatype == 'obj'): + objcolconfigs.append(attrconfig) + elif (attrconfig.is_colattr()) & (attrconfig.metatype in ('ids', 'id')) & (attrconfig.xmltag != None): + if hasattr(attrconfig, "is_xml_include_tab"): + if attrconfig.is_xml_include_tab: + idcolconfig_include_tab.append(attrconfig) + else: + colconfigs.append(attrconfig) + else: + colconfigs.append(attrconfig) + elif attrconfig.is_colattr() & (attrconfig.xmltag != None): + colconfigs.append(attrconfig) + elif (attrconfig.metatype == 'obj'): # better use self.childs + if (attrconfig.get_value().xmltag != None) & attrconfig.is_child(): + objconfigs.append(attrconfig) + elif attrconfig.xmltag != None: + attrconfigs.append(attrconfig) + + # print ' attrconfigs',attrconfigs + # print ' objconfigs',objconfigs + # print ' idcolconfig_include_tab',idcolconfig_include_tab + # print ' colconfigs',colconfigs + # start writing + if len(attrconfigs) > 0: + # print ' there are scalar attributes' + if is_print_begin_end: + fd.write(xm.start(xmltag, indent)) + for attrconfig in attrconfigs: + attrconfig.write_xml(fd) + + # are there child objects to write + if (len(objconfigs) > 0) | (len(colconfigs) > 0) | (len(idcolconfig_include_tab) > 0): + fd.write(xm.stop()) + self._write_xml_body(fd, indent, objconfigs, idcolconfig_include_tab, + colconfigs, + objcolconfigs, + xmltag_item, attrconfig_id, + xmltag_id, ids, ids_xml) + fd.write(xm.end(xmltag, indent)) + + else: + fd.write(xm.stopit()) + else: + # print ' no scalars' + if is_print_begin_end: + fd.write(xm.begin(xmltag, indent)) + self._write_xml_body(fd, indent, objconfigs, idcolconfig_include_tab, + colconfigs, + objcolconfigs, + xmltag_item, attrconfig_id, + xmltag_id, ids, ids_xml) + + if is_print_begin_end: + fd.write(xm.end(xmltag, indent)) + + +class TableObjman(Tabman, TableMixin): + + """ + Table Object management manages objects with list and dict based columns. + For faster operation use ArrayObjman in arrayman package, which requires numpy. + """ + + def __init__(self, ident, **kwargs): + self._init_objman(ident, **kwargs) + self._init_attributes() + self._init_constants() + + def _init_objman(self, ident, is_plugin=False, **kwargs): + BaseObjman._init_objman(self, ident, managertype='table', **kwargs) + Tabman.__init__(self, is_plugin=is_plugin) + # self.set_attrsman(self) + self.set_attrsman(self) + + +############################################################################### +if __name__ == '__main__': + """ + Test + """ + + pass diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/geometry.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/geometry.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/geometry.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/geometry.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,38 +1,43 @@ import numpy as np + def get_norm_2d(vertex3d): - #print 'get_norm_2d',vertex3d.shape - return np.sqrt(np.sum(vertex3d[:,:2]**2,1)) - #print ' r',r.shape - #return r + # print 'get_norm_2d',vertex3d.shape + return np.sqrt(np.sum(vertex3d[:, :2]**2, 1)) + # print ' r',r.shape + # return r + def get_length_polylines(polylines): - #print 'get_length_polylines' + # print 'get_length_polylines' # v = np.array([[[0.0,0.0,0.0],[1,0.0,0.0]],[[1,0.0,0.0],[1,2,0.0]],[[1,2.0,0.0],[1,2,3.0]] ]) lengths = np.zeros(len(polylines), np.float) i = 0 for v in polylines: - #print ' v=\n',v,v.shape - #print ' v[:,0,:]\n',v[:,0,:] - #print ' v[:,1,:]\n',v[:,1,:] - lengths[i] = np.sum( np.sqrt(np.sum((v[:,1,:]-v[:,0,:])**2,1)) ) + # print ' v=\n',v,v.shape + # print ' v[:,0,:]\n',v[:,0,:] + # print ' v[:,1,:]\n',v[:,1,:] + lengths[i] = np.sum(np.sqrt(np.sum((v[:, 1, :] - v[:, 0, :])**2, 1))) i += 1 return lengths + def get_length_polypoints(polylines): - #print 'get_length_polypoints' + # print 'get_length_polypoints' # v = np.array([[[0.0,0.0,0.0],[1,0.0,0.0]],[[1,0.0,0.0],[1,2,0.0]],[[1,2.0,0.0],[1,2,3.0]] ]) lengths = np.zeros(len(polylines), np.float) i = 0 for v in polylines: - #print ' v=\n',v,v.shape - a = np.array(v,np.float32) - lengths[i] = np.sum( np.sqrt(np.sum((a[1:,:]-a[:-1,:])**2,1)) ) + # print ' v=\n',v,v.shape + a = np.array(v, np.float32) + lengths[i] = np.sum(np.sqrt(np.sum((a[1:, :] - a[:-1, :])**2, 1))) i += 1 return lengths + def polypoints_to_polylines(polypoints): - linevertices = np.array([None]*len(polypoints),np.object)#np.zeros((0,2,3),np.float32) + # np.zeros((0,2,3),np.float32) + linevertices = np.array([None] * len(polypoints), np.object) #polyinds = [] #lineinds = [] @@ -40,141 +45,139 @@ ind_line = 0 for polyline in polypoints: # Important type conversion!! - v = np.zeros( ( 2*len(polyline)-2,3),np.float32) - v[0]=polyline[0] - v[-1]=polyline[-1] - if len(v)>2: - v[1:-1] = np.repeat(polyline[1:-1],2,0) + v = np.zeros((2 * len(polyline) - 2, 3), np.float32) + v[0] = polyline[0] + v[-1] = polyline[-1] + if len(v) > 2: + v[1:-1] = np.repeat(polyline[1:-1], 2, 0) #n_lines = len(v)/2 #polyinds += n_lines*[ind] - #lineinds.append(np.arange(ind_line,ind_line+n_lines)) + # lineinds.append(np.arange(ind_line,ind_line+n_lines)) #ind_line += n_lines - linevertices[ind] = v.reshape((-1,2,3)) + linevertices[ind] = v.reshape((-1, 2, 3)) #linevertices = np.concatenate((linevertices, v.reshape((-1,2,3)))) - ind +=1 - - return linevertices#, lineinds, polyinds + ind += 1 + return linevertices # , lineinds, polyinds -def get_vec_on_polyline_from_pos(polyline, pos, length, angle = 0.0): + +def get_vec_on_polyline_from_pos(polyline, pos, length, angle=0.0): """ Returns a vector ((x1,y1,z1),(x2,y2,z2)) where first coordinate is the point on the polyline at position pos and the second coordinate is length meters ahead with an angle with respect to the direction of the polyline. - + TODO: Attention angle not yet implemented """ pos_edge = 0.0 pos_edge_pre = 0.0 - x1,y1,z1 = polyline[0] - - for j in xrange(1,len(polyline)): - x2,y2,z2 = polyline[j] - seglength = np.linalg.norm([x2-x1,y2-y1]) + x1, y1, z1 = polyline[0] + + for j in xrange(1, len(polyline)): + x2, y2, z2 = polyline[j] + seglength = np.linalg.norm([x2 - x1, y2 - y1]) pos_edge += seglength - - - if (pos>=pos_edge_pre)&(pos<=pos_edge): - - dxn = (x2-x1)/seglength - dyn = (y2-y1)/seglength - u1=(pos-pos_edge_pre) - - u2 = (pos+length-pos_edge_pre) - return [[x1 + u1 * dxn,y1 + u1 * dyn ,z2],[x1 + u2 * dxn,y1 + u2 * dyn ,z2]] - - x1,y1 = x2,y2 + + if (pos >= pos_edge_pre) & (pos <= pos_edge): + + dxn = (x2 - x1) / seglength + dyn = (y2 - y1) / seglength + u1 = (pos - pos_edge_pre) + + u2 = (pos + length - pos_edge_pre) + return [[x1 + u1 * dxn, y1 + u1 * dyn, z2], [x1 + u2 * dxn, y1 + u2 * dyn, z2]] + + x1, y1 = x2, y2 pos_edge_pre = pos_edge - - x1,y1,z1 = polyline[-1] - dxn = (x2-x1)/seglength - dyn = (y2-y1)/seglength - u1=(pos-pos_edge_pre) - u2 = (pos+length-pos_edge_pre) - return [[x2 ,y2,z2],[x2 + u2 * dxn,y1 + u2 * dyn ,z2]] - + + x1, y1, z1 = polyline[-1] + dxn = (x2 - x1) / seglength + dyn = (y2 - y1) / seglength + u1 = (pos - pos_edge_pre) + u2 = (pos + length - pos_edge_pre) + return [[x2, y2, z2], [x2 + u2 * dxn, y1 + u2 * dyn, z2]] def get_coord_on_polyline_from_pos(polyline, pos): pos_edge = 0.0 pos_edge_pre = 0.0 - x1,y1,z1 = polyline[0] - - for j in xrange(1,len(polyline)): - x2,y2,z2 = polyline[j] - length = np.linalg.norm([x2-x1,y2-y1]) + x1, y1, z1 = polyline[0] + + for j in xrange(1, len(polyline)): + x2, y2, z2 = polyline[j] + length = np.linalg.norm([x2 - x1, y2 - y1]) pos_edge += length - - - if (pos>=pos_edge_pre)&(pos<=pos_edge): - u=(pos-pos_edge_pre)/length - x = x1 + u * (x2-x1) - y = y1 + u * (y2-y1) - return x,y,z2 - - x1,y1 = x2,y2 + + if (pos >= pos_edge_pre) & (pos <= pos_edge): + u = (pos - pos_edge_pre) / length + x = x1 + u * (x2 - x1) + y = y1 + u * (y2 - y1) + return x, y, z2 + + x1, y1 = x2, y2 pos_edge_pre = pos_edge - - return x2,y2,z2 + + return x2, y2, z2 + def get_pos_on_polyline_from_coord(polyline, coord): - xc,yx,zc = coord + xc, yx, zc = coord n_segs = len(polyline) - - - d_min=10.0**8 + + d_min = 10.0**8 x_min = 0.0 y_min = 0.0 j_min = 0 p_min = 0.0 pos = 0.0 - x1,y1,z1 = shape[0] - for j in xrange(1,n_segs): - x2,y2,z2 = polyline[j] - d, xp, yp = shortest_dist(x1,y1, x2,y2, xc,yc) - #print ' x1,y1=(%d,%d)'%(x1,y1),',x2,y2=(%d,%d)'%(x2,y2),',xc,yc=(%d,%d)'%(xc,yc) - #print ' d,x,y=(%d,%d,%d)'%shortest_dist(x1,y1, x2,y2, xc,yc) - if d x2,y2). Returns distance and projected point on line. """ - - px = x2-x1 - py = y2-y1 - something = px*px + py*py + px = x2 - x1 + py = y2 - y1 + + something = px * px + py * py if something > 0: - u = ((x3 - x1) * px + (y3 - y1) * py) / float(something) + u = ((x3 - x1) * px + (y3 - y1) * py) / float(something) else: u = 0 - + # clip and return infinite distance if not on the line if u > 1: u = 1 - #return 10.0**8,x1 + px,y1 + py - + # return 10.0**8,x1 + px,y1 + py + elif u < 0: u = 0 - #return 10.0**8,x1 ,y1 + # return 10.0**8,x1 ,y1 x = x1 + u * px y = y1 + u * py @@ -188,149 +191,151 @@ # can just return the squared distance instead # (i.e. remove the sqrt) to gain a little performance - dist = np.sqrt(dx*dx + dy*dy) + dist = np.sqrt(dx * dx + dy * dy) - return dist, x,y - -def get_dist_point_to_segs(p,y1,x1,y2,x2, is_ending=True): + return dist, x, y + + +def get_dist_point_to_segs(p, y1, x1, y2, x2, is_ending=True): """ Minimum Distance between a Point p = (x,y) and a Line segments , where vectors x1, y1 are the first points and x2,y2 are the second points of the line segments. Written by Paul Bourke, October 1988 http://astronomy.swin.edu.au/~pbourke/geometry/pointline/ - + Rewritten in vectorial form by Joerg Schweizer """ - - y3,x3 = p - + + y3, x3 = p + d = np.zeros(len(y1), dtype=np.float32) - - dx21 = (x2-x1) - dy21 = (y2-y1) - - lensq21 = dx21*dx21 + dy21*dy21 - + + dx21 = (x2 - x1) + dy21 = (y2 - y1) + + lensq21 = dx21 * dx21 + dy21 * dy21 + # indexvector for all zero length lines - iz = (lensq21 == 0) - - dy = y3-y1[iz] - dx = x3-x1[iz] - - d[iz] = dx*dx + dy*dy - - - lensq21[iz] = 1.0 # replace zeros with 1.0 to avoid div by zero error - - u = (x3-x1)*dx21 + (y3-y1)*dy21 - u = u / lensq21 + iz = (lensq21 == 0) + + dy = y3 - y1[iz] + dx = x3 - x1[iz] + d[iz] = dx * dx + dy * dy - x = x1+ u * dx21 - y = y1+ u * dy21 + lensq21[iz] = 1.0 # replace zeros with 1.0 to avoid div by zero error + + u = (x3 - x1) * dx21 + (y3 - y1) * dy21 + u = u / lensq21 + + x = x1 + u * dx21 + y = y1 + u * dy21 if is_ending: - ie = u < 0 - x[ie] = x1[ie] - y[ie] = y1[ie] - ie = u > 1 - x[ie] = x2[ie] - y[ie] = y2[ie] - - dx30 = x3-x - dy30 = y3-y - d[~iz] = (dx30*dx30 + dy30*dy30)[~iz] + ie = u < 0 + x[ie] = x1[ie] + y[ie] = y1[ie] + ie = u > 1 + x[ie] = x2[ie] + y[ie] = y2[ie] + + dx30 = x3 - x + dy30 = y3 - y + d[~iz] = (dx30 * dx30 + dy30 * dy30)[~iz] return d - -def is_inside_triangles(p,x1,y1,x2,y2,x3,y3): +def is_inside_triangles(p, x1, y1, x2, y2, x3, y3): """ Returns a binary vector with True if point p is inside a triangle. x1,y1,x2,y2,x3,y3 are vectors with the 3 coordiantes of the triangles. """ - alpha = ((y2 - y3)*(p[0] - x3) + (x3 - x2)*(p[1] - y3)) \ - /((y2 - y3)*(x1 - x3) + (x3 - x2)*(y1 - y3)) - - beta = ((y3 - y1)*(p[0] - x3) + (x1 - x3)*(p[1] - y3)) \ - /((y2 - y3)*(x1 - x3) + (x3 - x2)*(y1 - y3)) - - gamma = 1.0 - alpha - beta; - return (alpha>0)&(beta>0)&(gamma>0) + alpha = ((y2 - y3) * (p[0] - x3) + (x3 - x2) * (p[1] - y3)) \ + / ((y2 - y3) * (x1 - x3) + (x3 - x2) * (y1 - y3)) + + beta = ((y3 - y1) * (p[0] - x3) + (x1 - x3) * (p[1] - y3)) \ + / ((y2 - y3) * (x1 - x3) + (x3 - x2) * (y1 - y3)) + + gamma = 1.0 - alpha - beta + return (alpha > 0) & (beta > 0) & (gamma > 0) # from http://www.arachnoid.com/area_irregular_polygon/index.html + + def find_area_perim(array): """ Scalar! """ a = 0 p = 0 - ox,oy = array[0] - for x,y in array[1:]: - a += (x*oy-y*ox) - p += abs((x-ox)+(y-oy)*1j) - ox,oy = x,y - return a/2,p + ox, oy = array[0] + for x, y in array[1:]: + a += (x * oy - y * ox) + p += abs((x - ox) + (y - oy) * 1j) + ox, oy = x, y + return a / 2, p + def find_area(array): """ Single polygon with 2D coordinates. """ # TODO: check, there are negative A!!!! - #print 'find_area',array + # print 'find_area',array a = 0 - ox,oy = array[0] - for x,y in array[1:]: - a += (x*oy-y*ox) - ox,oy = x,y - - #print ' =',np.abs(a/2) - return np.abs(a/2) + ox, oy = array[0] + for x, y in array[1:]: + a += (x * oy - y * ox) + ox, oy = x, y + + # print ' =',np.abs(a/2) + return np.abs(a / 2) -def is_point_in_polygon(point,poly): +def is_point_in_polygon(point, poly): """ Scalar! """ - is_3d = len(point)==3 - + is_3d = len(point) == 3 + if is_3d: - x,y,z = point - p1x,p1y,p1z = poly[0] + x, y, z = point + p1x, p1y, p1z = poly[0] else: - x,y = point - p1x,p1y = poly[0] + x, y = point + p1x, p1y = poly[0] n = len(poly) inside = False - - for i in range(n+1): + for i in range(n + 1): if is_3d: - p2x,p2y,p2z = poly[i % n] + p2x, p2y, p2z = poly[i % n] else: - p2x,p2y = poly[i % n] - if y > min(p1y,p2y): - if y <= max(p1y,p2y): - if x <= max(p1x,p2x): + p2x, p2y = poly[i % n] + if y > min(p1y, p2y): + if y <= max(p1y, p2y): + if x <= max(p1x, p2x): if p1y != p2y: - xints = (y-p1y)*(p2x-p1x)/(p2y-p1y)+p1x + xints = (y - p1y) * (p2x - p1x) / (p2y - p1y) + p1x if p1x == p2x or x <= xints: inside = not inside - p1x,p1y = p2x,p2y + p1x, p1y = p2x, p2y return inside -def is_polyline_intersect_polygon(polyline,polygon): + +def is_polyline_intersect_polygon(polyline, polygon): for p in polyline: - if is_point_in_polygon(p,polygon): + if is_point_in_polygon(p, polygon): return True return False -def is_polyline_in_polygon(polyline,polygon): + +def is_polyline_in_polygon(polyline, polygon): for p in polyline: - if not is_point_in_polygon(p,polygon): + if not is_point_in_polygon(p, polygon): return False return True @@ -342,60 +347,61 @@ dxn = np.cos(angles_perb) dyn = np.sin(angles_perb) """ - + n_vert = len(shape) - #print 'get_laneshapes',_id,n_lanes,n_vert - + # print 'get_laneshapes',_id,n_lanes,n_vert + #width = self.widths_lanes_default[_id] - #print ' shape', shape ,len( shape) - v_ext_begin = (shape[0]-(shape[1]-shape[0])).reshape(1,3) - v_ext_end = (shape[-1]+(shape[-1]-shape[-2])).reshape(1,3) - - exshape = np.concatenate((v_ext_begin ,shape,v_ext_end))[:,0:2] - #print ' exshape', exshape,len( exshape) - vertex_delta_x = exshape[1:,0]-exshape[0:-1,0] - vertex_delta_y = exshape[1:,1]-exshape[0:-1,1] - - angles = np.arctan2(vertex_delta_y,vertex_delta_x) + # print ' shape', shape ,len( shape) + v_ext_begin = (shape[0] - (shape[1] - shape[0])).reshape(1, 3) + v_ext_end = (shape[-1] + (shape[-1] - shape[-2])).reshape(1, 3) + + exshape = np.concatenate((v_ext_begin, shape, v_ext_end))[:, 0:2] + # print ' exshape', exshape,len( exshape) + vertex_delta_x = exshape[1:, 0] - exshape[0:-1, 0] + vertex_delta_y = exshape[1:, 1] - exshape[0:-1, 1] + + angles = np.arctan2(vertex_delta_y, vertex_delta_x) #angles = np.mod(np.arctan2(vertex_delta_y,vertex_delta_x)+2*np.pi,2*np.pi) #angles_perb = 0.5 *(angles[1:]+angles[0:-1])-np.pi/2 - + angles1 = angles[1:] angles2 = angles[0:-1] - ind_discont = (angles1<-0.5*np.pi)&((angles2>0.5*np.pi)) | (angles2<-0.5*np.pi)&((angles1>0.5*np.pi)) - angle_sum = angles1+angles2 - angle_sum[ind_discont] += 2*np.pi - + ind_discont = (angles1 < -0.5 * np.pi) & ((angles2 > 0.5 * np.pi) + ) | (angles2 < -0.5 * np.pi) & ((angles1 > 0.5 * np.pi)) + angle_sum = angles1 + angles2 + angle_sum[ind_discont] += 2 * np.pi + #angles = np.mod(np.arctan2(vertex_delta_y,vertex_delta_x)+2*np.pi,2*np.pi) #angle_sum = angles[1:]+angles[0:-1] #ind_discont = angle_sum>2*np.pi #angle_sum[ind_discont] = angle_sum[ind_discont]-2*np.pi - return 0.5*angle_sum-np.pi/2 - - + return 0.5 * angle_sum - np.pi / 2 + + ################################################################ -## old +# old def angle2D(p1, p2): - theta1 = math.atan2(p1[1], p1[0]); - theta2 = math.atan2(p2[1], p2[0]); - dtheta = theta2 - theta1; + theta1 = math.atan2(p1[1], p1[0]) + theta2 = math.atan2(p2[1], p2[0]) + dtheta = theta2 - theta1 while dtheta > 3.1415926535897932384626433832795: - dtheta -= 2.0*3.1415926535897932384626433832795 + dtheta -= 2.0 * 3.1415926535897932384626433832795 while dtheta < -3.1415926535897932384626433832795: - dtheta += 2.0*3.1415926535897932384626433832795 + dtheta += 2.0 * 3.1415926535897932384626433832795 return dtheta - + def is_point_within_polygon(pos, shape): - angle = 0. - pos = np.array(pos, float) - shape = np.array(shape, float) - for i in range(0, len(shape)-1): - p1 = ( (shape[i][0] - pos[0]), (shape[i][1] - pos[1]) ) - p2 = ( (shape[i+1][0] - pos[0]), (shape[i+1][1] - pos[1]) ) - angle = angle + angle2D(p1, p2) - i = len(shape)-1 - p1 = ( (shape[i][0] - pos[0]), (shape[i][1] - pos[1]) ) - p2 = ( (shape[0][0] - pos[0]), (shape[0][1] - pos[1]) ) - angle = angle + angle2D(p1, p2) - return math.fabs(angle)>=3.1415926535897932384626433832795 + angle = 0. + pos = np.array(pos, float) + shape = np.array(shape, float) + for i in range(0, len(shape) - 1): + p1 = ((shape[i][0] - pos[0]), (shape[i][1] - pos[1])) + p2 = ((shape[i + 1][0] - pos[0]), (shape[i + 1][1] - pos[1])) + angle = angle + angle2D(p1, p2) + i = len(shape) - 1 + p1 = ((shape[i][0] - pos[0]), (shape[i][1] - pos[1])) + p2 = ((shape[0][0] - pos[0]), (shape[0][1] - pos[1])) + angle = angle + angle2D(p1, p2) + return math.fabs(angle) >= 3.1415926535897932384626433832795 diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,2 +1 @@ __version__ = "0.0" - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/logger.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/logger.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/logger.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/logger.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,42 +1,45 @@ import types + + class Logger: - def __init__(self, filepath = None, is_stdout = True): + + def __init__(self, filepath=None, is_stdout=True): self._filepath = filepath self._logfile = None self._callbacks = {} self._is_stdout = is_stdout + def start(self, text=''): - if self._filepath !=None: - self._logfile = open(self._filepath,'w') - self._logfile.write(text+'\n') + if self._filepath != None: + self._logfile = open(self._filepath, 'w') + self._logfile.write(text + '\n') else: self._logfile = None print text - + def add_callback(self, function, key='message'): self._callbacks[key] = function - - def progress(self,percent): + + def progress(self, percent): pass - - def w(self, data, key='message',**kwargs): - #print 'w:',data,self._callbacks - if self._logfile!= None: - self._logfile.write(str(data)+'\n') - elif self._callbacks.has_key(key): - kwargs['key']=key - self._callbacks[key](data,**kwargs) - #elif type(data)==types.StringType: - # print data - if self._is_stdout: - print str(data) - + + def w(self, data, key='message', **kwargs): + # print 'w:',data,self._callbacks + if self._logfile != None: + self._logfile.write(str(data) + '\n') + elif self._callbacks.has_key(key): + kwargs['key'] = key + self._callbacks[key](data, **kwargs) + # elif type(data)==types.StringType: + # print data + if self._is_stdout: + print str(data) + def stop(self, text=''): - if self._logfile!= None: - self._logfile.write(text+'\n') - self._logfile.close() - self._logfile = None - + if self._logfile != None: + self._logfile.write(text + '\n') + self._logfile.close() + self._logfile = None + else: - print text - \ No newline at end of file + print text diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/misc.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/misc.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/misc.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/misc.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,28 +1,31 @@ # oh my god....: -import platform,types +import platform +import types global IS_WIN -if platform.system()=='Windows': +if platform.system() == 'Windows': IS_WIN = True else: IS_WIN = False import numpy as np - + + def get_inversemap(map): return {v: k for k, v in map.items()} + def random_choice_dist(n, b): """ Returns the absolute distribution of a random choice sample of size n having the choice between len(b) options where each option has the probability represented in vector b. """ - if np.__version__>='1.7.0': + if np.__version__ >= '1.7.0': return np.bincount(np.random.choice(b.size, n, p=b.flat), - minlength=b.size).reshape(b.shape) + minlength=b.size).reshape(b.shape) else: - return np.bincount(np.searchsorted(np.cumsum(b), np.random.random(n)),minlength=b.size).reshape(b.shape) + return np.bincount(np.searchsorted(np.cumsum(b), np.random.random(n)), minlength=b.size).reshape(b.shape) def random_choice(n, b): @@ -31,42 +34,39 @@ having the choice between len(b) options where each option has the probability represented in vector b. """ - if np.__version__>='1.7.0': + if np.__version__ >= '1.7.0': return np.random.choice(b.size, n, p=b.flat) else: return np.searchsorted(np.cumsum(b), np.random.random(n)) - - -def filepathlist_to_filepathstring(filepathlist, sep=',',is_primed = False): + + +def filepathlist_to_filepathstring(filepathlist, sep=',', is_primed=False): if IS_WIN & is_primed: p = '"' else: - p='' - #print 'filepathlist_to_filepathstring',IS_WIN,p,filepathlist - if type(filepathlist)==types.ListType: + p = '' + # print 'filepathlist_to_filepathstring',IS_WIN,p,filepathlist + if type(filepathlist) == types.ListType: if len(filepathlist) == 0: return '' else: filepathstring = '' for filepath in filepathlist[:-1]: - fp = filepath.replace('"','') - filepathstring += p+fp+p+sep - filepathstring += p+filepathlist[-1]+p + fp = filepath.replace('"', '') + filepathstring += p + fp + p + sep + filepathstring += p + filepathlist[-1] + p return filepathstring else: - fp = filepathlist.replace('"','') - return p+filepathlist+p + fp = filepathlist.replace('"', '') + return p + filepathlist + p + -def filepathstring_to_filepathlist(filepathstring, sep=',', is_primed = False): +def filepathstring_to_filepathlist(filepathstring, sep=',', is_primed=False): if IS_WIN & is_primed: - p='"' + p = '"' else: - p='' - filepaths=[] + p = '' + filepaths = [] for filepath in filepathstring.split(sep): - filepaths.append(p+filepath.strip().replace('"','')+p) + filepaths.append(p + filepath.strip().replace('"', '') + p) return filepaths - - - - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/processes.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/processes.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/processes.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/processes.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,8 +1,9 @@ - - -import subprocess, os, sys, types +import subprocess +import os +import sys +import types #SUMOPYDIR = os.path.join(os.path.dirname(__file__),"..") @@ -16,78 +17,80 @@ import platform global P -if platform.system()=='Windows': +if platform.system() == 'Windows': P = '"' else: - P='' + P = '' + +# p = psutil.Process(the_pid_you_want) !! +# print p.status +# if p.status == psutil.STATUS_ZOMBIE: -#p = psutil.Process(the_pid_you_want) !! -#print p.status -#if p.status == psutil.STATUS_ZOMBIE: - ##processlist = psutil.get_process_list() ## -##for p in processlist: -## if psutil.pid_exists(p.pid): -## print ' pid = ',p.pid -## print ' name =',p.name -## print ' running =',p.is_running() -## print ' path =',p.path -## print ' cmdline',p.cmdline -## -## +# for p in processlist: +# if psutil.pid_exists(p.pid): +# print ' pid = ',p.pid +# print ' name =',p.name +# print ' running =',p.is_running() +# print ' path =',p.path +# print ' cmdline',p.cmdline +## +## ##cmd = 'nohup sumo --no-step-log --no-duration-log --no-warnings --step-length %.3f -c %s'%(time_simstep, filepath_netconfig) -## -##print '\n Starting command:',cmd +## +# print '\n Starting command:',cmd ##p = subprocess.Popen(cmd, shell=True) -##print "p.pid",p.pid, "p.poll=",p.poll() -##p.wait() -##print '\n\nreturncode',p.poll(),p.returncode -##print 'p.stdout=\n', p.stdout -###call(cmd) +# print "p.pid",p.pid, "p.poll=",p.poll() +# p.wait() +# print '\n\nreturncode',p.poll(),p.returncode +# print 'p.stdout=\n', p.stdout +# call(cmd) -## in windows : start command3 +# in windows : start command3 def format_filepath(filepath): return ff(filepath) + def ff(filepath): - return P+filepath+P - + return P + filepath + P + + def call(cmd): """ Calls a sytem commend lime. Returns 1 if executed successfully. """ # ensure unix compatibility print(cmd) - #if isinstance(cmd, str): + # if isinstance(cmd, str): # cmd = filter(lambda a: a!='', cmd.split(' ')) - #subprocess.call(cmd) - p=subprocess.Popen(cmd, shell=True) + # subprocess.call(cmd) + p = subprocess.Popen(cmd, shell=True) p.wait() - return p.returncode == 0 - + return p.returncode == 0 + + class Process(cm.BaseObjman): + def __init__(self, ident, **kwargs): self._init_common(ident, **kwargs) - - - - def _init_common(self, ident, parent=None, name = None, **kwargs): - self._init_objman(ident= ident, parent=parent, name = name, **kwargs) + + def _init_common(self, ident, parent=None, name=None, **kwargs): + self._init_objman(ident=ident, parent=parent, name=name, **kwargs) attrsman = self.set_attrsman(cm.Attrsman(self)) #self.net = attrsman.add( cm.ObjConf( network.Network(self) ) ) - self.status = attrsman.add(cm.AttrConf( - 'status', 'preparation', - groupnames = ['_private','parameters'], - perm='r', - name = 'Status', - info = 'Process status: preparation-> running -> success|error.' - )) + self.status = attrsman.add(cm.AttrConf( + 'status', 'preparation', + groupnames=['_private', 'parameters'], + perm='r', + name='Status', + info='Process status: preparation-> running -> success|error.' + )) self._logger.w(self.get_name(), key='action') self._logger.w('Prepare', key='message') - + def run(self): if self.is_ready(): logger = self.get_logger() @@ -96,15 +99,15 @@ # self.do() # - self.status = 'success' # self.status = 'error' + self.status = 'success' # self.status = 'error' logger.w('success', key='message') return True else: return False - + def do(self): pass - + def update_params(self): """ Make all parameters consistent. @@ -112,34 +115,36 @@ from process dialog """ pass - + def is_ready(self): """ Returns True if process is ready to run. - + """ return True - + class Options: + """ Dummy option class to fake option parsing """ - def __init__(self,**kwargs): + + def __init__(self, **kwargs): self._optionattrs = [] self._transdir = {} self._filepathattrs = [] - for attr,value in kwargs.iteritems(): + for attr, value in kwargs.iteritems(): self.add_option(attr, value) - - def add_option(self, attr = '', value = '', cml = None, is_filepath = False): + + def add_option(self, attr='', value='', cml=None, is_filepath=False): setattr(self, attr, value) self._optionattrs.append(attr) - if cml != None: - self._transdir[attr]= cml + if cml != None: + self._transdir[attr] = cml if is_filepath: self._filepathattrs.append(attr) - + def set_transdir(self, **transdir): """ Sets a dictionary to translate python compatible @@ -149,381 +154,368 @@ command line options contain '.' or '-'). Format of transdir is python attribute as key and command line option (as string, WITH preceeding'--') as value. - - """ - self._transdir = transdir - - def get_optionstring(self, is_primed = True): - #print 'get_optionstring' + + """ + self._transdir = transdir + + def get_optionstring(self, is_primed=True): + # print 'get_optionstring' s = '' for attr in self._optionattrs: value = getattr(self, attr) cmlattr = self._transdir.get(attr, attr) - #print ' option',attr,cmlattr,attr in self._filepathattrs,type(value) + # print ' option',attr,cmlattr,attr in + # self._filepathattrs,type(value) if attr in self._filepathattrs: - s += ' '+cmlattr+' %s'%filepathlist_to_filepathstring(value.split(','), is_primed = is_primed) + s += ' ' + cmlattr + \ + ' %s' % filepathlist_to_filepathstring( + value.split(','), is_primed=is_primed) elif type(value) == types.BooleanType: if value: - s += ' '+cmlattr - elif type(value) in [types.StringTypes, types.UnicodeType] : - s += ' '+cmlattr+" '%s'"%value + s += ' ' + cmlattr + elif type(value) in [types.StringTypes, types.UnicodeType]: + s += ' ' + cmlattr + " '%s'" % value else: - s += ' '+cmlattr+' %s'%value - return s - + s += ' ' + cmlattr + ' %s' % value + return s + + class CmlMixin: - def init_cml(self, command, is_run_background = False, is_nohup = False): + + def init_cml(self, command, is_run_background=False, is_nohup=False): self.optiongroupname = 'cml-options' attrsman = self.get_attrsman() - self.pathmetatypes = ['filepath','dirpath','filepaths','dirpaths'] - self._command = attrsman.add(cm.AttrConf( - '_command', command, - groupnames = ['_private'], - perm='r', - name = 'command', - info = 'Command to be executed.' - )) - self.pid = attrsman.add(cm.AttrConf( - 'pid', -1, - groupnames = ['_private'], - perm='r', - name = 'Process ID', - info = "The system's Process ID", - )) - - self.is_run_background = attrsman.add(cm.AttrConf( - 'is_run_background', is_run_background, - groupnames = ['parameters', 'advanced'], - perm='rw', - name = 'Run in background', - info = 'If set, process will run in background.', - )) - - self.is_nohup = attrsman.add(cm.AttrConf( - 'is_nohup', is_nohup, - groupnames = ['parameters', 'advanced'], - perm='rw', - name = 'No hangup', - info = """If set, process will run in the background and will continue to run after logout. (Currently on UNIX platforms only.) """, - )) - - - - def add_option(self, option, value, **kwargs ): - kwargs0 = { 'cml':None, - 'groupnames': [], - 'perm':'rw', - 'is_save' : True, - 'name' : None, - 'info' : '',} - + self.pathmetatypes = ['filepath', 'dirpath', 'filepaths', 'dirpaths'] + self._command = attrsman.add(cm.AttrConf( + '_command', command, + groupnames=['_private'], + perm='r', + name='command', + info='Command to be executed.' + )) + self.pid = attrsman.add(cm.AttrConf( + 'pid', -1, + groupnames=['_private'], + perm='r', + name='Process ID', + info="The system's Process ID", + )) + + self.is_run_background = attrsman.add(cm.AttrConf( + 'is_run_background', is_run_background, + groupnames=['parameters', 'advanced'], + perm='rw', + name='Run in background', + info='If set, process will run in background.', + )) + + self.is_nohup = attrsman.add(cm.AttrConf( + 'is_nohup', is_nohup, + groupnames=['parameters', 'advanced'], + perm='rw', + name='No hangup', + info="""If set, process will run in the background and will continue to run after logout. (Currently on UNIX platforms only.) """, + )) + + def add_option(self, option, value, **kwargs): + kwargs0 = {'cml': None, + 'groupnames': [], + 'perm': 'rw', + 'is_save': True, + 'name': None, + 'info': '', } + kwargs0.update(kwargs) - if not (self.optiongroupname in kwargs0['groupnames'] ): - kwargs0['groupnames']+=[self.optiongroupname] - - default = self.get_attrsman().add(cm.AttrConf( option, value,**kwargs0)) - - setattr(self,option,default) - + if not (self.optiongroupname in kwargs0['groupnames']): + kwargs0['groupnames'] += [self.optiongroupname] + + default = self.get_attrsman().add( + cm.AttrConf(option, value, **kwargs0)) + + setattr(self, option, default) + def get_options(self): print 'get_options' options = Options() - for attrconfig in self.get_attrsman().get_configs(filtergroupnames = [self.optiongroupname]): - print ' option',attrconfig.attrname,attrconfig.groupnames,attrconfig.get_metatype() in self.pathmetatypes + for attrconfig in self.get_attrsman().get_configs(filtergroupnames=[self.optiongroupname]): + print ' option', attrconfig.attrname, attrconfig.groupnames, attrconfig.get_metatype() in self.pathmetatypes is_enabled = True if hasattr(attrconfig, 'is_enabled'): - print ' is_enabled=',attrconfig.is_enabled(self), attrconfig.get_value() + print ' is_enabled=', attrconfig.is_enabled(self), attrconfig.get_value() is_enabled = attrconfig.is_enabled(self) - if is_enabled: # disabeled options are simply not added + if is_enabled: # disabeled options are simply not added is_filepath = attrconfig.get_metatype() in self.pathmetatypes - options.add_option(attrconfig.attrname,attrconfig.get_value(),attrconfig.cml, is_filepath = is_filepath) - - + options.add_option(attrconfig.attrname, attrconfig.get_value( + ), attrconfig.cml, is_filepath=is_filepath) + return options - + def print_options(self): - print 'Options of process ident:',self.ident + print 'Options of process ident:', self.ident print ' Keywordoptions:' - for attrconfig in self.get_attrsman().get_configs(filtergroupnames = [self.optiongroupname]): - print ' ',attrconfig.attrname,'=',attrconfig.get_value() - - - - - def get_cml(self, is_changecwd = False): + for attrconfig in self.get_attrsman().get_configs(filtergroupnames=[self.optiongroupname]): + print ' ', attrconfig.attrname, '=', attrconfig.get_value() + + def get_cml(self, is_changecwd=False): """ Returns commandline with all options. To be overridden by costum class. """ options = self.get_options() - + if is_changecwd: - if self.get_workdirpath()==None: + if self.get_workdirpath() == None: cwd = '' else: - cwd = 'cd '+self.get_workdirpath()+' ;' + cwd = 'cd ' + self.get_workdirpath() + ' ;' else: cwd = '' - return cwd+self._command + options.get_optionstring() - - def run_cml(self, cml = None): + return cwd + self._command + options.get_optionstring() + + def run_cml(self, cml=None): if cml == None: cml = self.get_cml() - attrsman = self.get_attrsman() + attrsman = self.get_attrsman() self._subprocess = subprocess.Popen(cml, shell=True) attrsman.pid.set(self._subprocess.pid) attrsman.status.set('running') - print 'run_cml cml=',cml - print ' pid = ',self.pid + print 'run_cml cml=', cml + print ' pid = ', self.pid if not self.is_run_background: self._subprocess.wait() - + if self._subprocess.returncode == 0: attrsman.status.set('success') return True - + else: attrsman.status.set('error') return False - - - + + class ProcessOld(cm.BaseObjman): - def __init__( self, ident, command = None, parent = None, name = None, - is_inputfilelist = True, is_outputfilelist = True, - is_force= False, is_run_background = False, is_nohup = False, - workdirpath = None): - self._init_objman(ident, parent = parent, name = name) - self.attrs = self.set_attrman(cm.AttrsManager(self,'attrs')) - - if command==None: - command_default='' + + def __init__(self, ident, command=None, parent=None, name=None, + is_inputfilelist=True, is_outputfilelist=True, + is_force=False, is_run_background=False, is_nohup=False, + workdirpath=None): + self._init_objman(ident, parent=parent, name=name) + self.attrs = self.set_attrman(cm.AttrsManager(self, 'attrs')) + + if command == None: + command_default = '' else: - command_default=command - + command_default = command + self.set_workdirpath(workdirpath) - - self.status = self.attrs.add(cm.AttrConf( - 'status', 'preparation', - groupnames = ['parameters'], - perm='r', - metatype = 'internal', - name = 'Status', - info = 'Process status: preparation-> running -> success|error.' - )) - - self._command = self.attrs.add(cm.AttrConf( - '_command', command_default, - groupnames = ['parameters','_private', 'advanced'], - perm='r', - metatype = 'internal', - name = 'command', - info = 'Command to be executed.' - )) - - self.progress = self.attrs.add(cm.AttrConf( - 'progress', 0.0, - groupnames = ['parameters'], - perm='r', - metatype = 'progress', - unit = '%', - name = 'Progress', - info = 'Indicates the percentage of completion of the process.' - )) - - - - self.pid = self.attrs.add(cm.AttrConf( - 'pid', -1, - groupnames = ['parameters', 'advanced'], - perm='r', - name = 'Process ID', - info = "The system's Process ID", - )) - - self.is_force = self.attrs.add(cm.AttrConf( - 'is_force', is_force, - groupnames = ['parameters', 'advanced'], - perm='rw', - name = 'is_force', - info = 'If set, process will be executed even if output files exist.', - )) - - self.is_run_background = self.attrs.add(cm.AttrConf( - 'is_run_background', is_run_background, - groupnames = ['parameters', 'advanced'], - perm='rw', - name = 'Run in background', - info = 'If set, process will run in background.', - )) - - self.is_nohup = self.attrs.add(cm.AttrConf( - 'is_nohup', is_nohup, - groupnames = ['parameters', 'advanced'], - perm='rw', - name = 'No hangup', - info = """If set, process will run in the background and will continue to run after logout. (Currently on UNIX platforms only.) """, - )) - - - - if is_inputfilelist: - self.files_input = self.add_tableman(cm.TableManager( ident='files_input', - parent = self, - name = 'Input files', - is_keyindex = True ), - ) - - - - self.files_input.add(cm.DictConf( 'filename', '', - groupnames = ['input'], - perm='rw', - name = 'Name', - info = 'File name of input file', - )) - - - self.files_input.add(cm.DictConf( 'is_existent', False, - groupnames = ['output'], - perm='r', - name = 'Exists?', - info = 'If set, this input file is exists.', - )) - - self.files_input.add(cm.DictConf( 'is_required', True, - groupnames = ['output'], - perm='r', - name = 'Required?', - info = 'If set, this input file is required.', - )) - - - self.files_input.add(cm.DictConf( 'filepath', '', - groupnames = ['input'], - perm='rw', - metatype = 'filepath', - name = 'Path', - info = 'Filepath of input file', - )) - - - - self.files_input.add(cm.DictConf( 'fileoption', '', - groupnames = ['input','advanced'], - perm='r', - name = 'Option', - info = 'Command line option', - )) - - - self.files_input.add(cm.DictConf( 'fileinfo', '', - groupnames = ['input','advanced'], - perm='rw', - name = 'Info', - info = 'File info of input file', - )) - self.files_input.add(cm.DictConf( 'wildcards', '', - groupnames = ['input','advanced'], - perm='rw', - name = 'wildcards', - info = 'Wildcards for file filtering', - )) - - if is_outputfilelist: - self.files_output = self.add_tableman(cm.TableManager( - ident='files_output', - parent = self, - name = 'Output files', - is_keyindex = True ), - ) - - self.files_output.add(cm.DictConf( 'filename', '', - groupnames = ['output'], - perm='rw', - name = 'Name', - info = 'File name of output file', - )) - - - - self.files_output.add(cm.DictConf( 'filepath', '', - groupnames = ['output'], - perm='rw', - metatype = 'filepath', - name = 'Path', - info = 'Filepath of output file', - )) - - self.files_output.add(cm.DictConf( 'fileoption', '', - groupnames = ['advanced'], - perm='r', - name = 'Option', - info = 'Command line option', - )) - - - self.files_output.add(cm.DictConf( 'fileinfo', '', - groupnames = ['output','advanced'], - perm='r', - is_save = True, - name = 'Info', - info = 'File info of output file', - )) - - self.files_output.add(cm.DictConf( 'wildcards', '', - groupnames = ['output','advanced'], - perm='rw', - is_save = True, - name = 'wildcards', - info = 'Wildcards for file filtering', - )) - - - def add_option(self, option, value, **kwargs ): + + self.status = self.attrs.add(cm.AttrConf( + 'status', 'preparation', + groupnames=['parameters'], + perm='r', + metatype='internal', + name='Status', + info='Process status: preparation-> running -> success|error.' + )) + + self._command = self.attrs.add(cm.AttrConf( + '_command', command_default, + groupnames=['parameters', '_private', 'advanced'], + perm='r', + metatype='internal', + name='command', + info='Command to be executed.' + )) + + self.progress = self.attrs.add(cm.AttrConf( + 'progress', 0.0, + groupnames=['parameters'], + perm='r', + metatype='progress', + unit='%', + name='Progress', + info='Indicates the percentage of completion of the process.' + )) + + self.pid = self.attrs.add(cm.AttrConf( + 'pid', -1, + groupnames=['parameters', 'advanced'], + perm='r', + name='Process ID', + info="The system's Process ID", + )) + + self.is_force = self.attrs.add(cm.AttrConf( + 'is_force', is_force, + groupnames=['parameters', 'advanced'], + perm='rw', + name='is_force', + info='If set, process will be executed even if output files exist.', + )) + + self.is_run_background = self.attrs.add(cm.AttrConf( + 'is_run_background', is_run_background, + groupnames=['parameters', 'advanced'], + perm='rw', + name='Run in background', + info='If set, process will run in background.', + )) + + self.is_nohup = self.attrs.add(cm.AttrConf( + 'is_nohup', is_nohup, + groupnames=['parameters', 'advanced'], + perm='rw', + name='No hangup', + info="""If set, process will run in the background and will continue to run after logout. (Currently on UNIX platforms only.) """, + )) + + if is_inputfilelist: + self.files_input = self.add_tableman(cm.TableManager(ident='files_input', + parent=self, + name='Input files', + is_keyindex=True), + ) + + self.files_input.add(cm.DictConf('filename', '', + groupnames=['input'], + perm='rw', + name='Name', + info='File name of input file', + )) + + self.files_input.add(cm.DictConf('is_existent', False, + groupnames=['output'], + perm='r', + name='Exists?', + info='If set, this input file is exists.', + )) + + self.files_input.add(cm.DictConf('is_required', True, + groupnames=['output'], + perm='r', + name='Required?', + info='If set, this input file is required.', + )) + + self.files_input.add(cm.DictConf('filepath', '', + groupnames=['input'], + perm='rw', + metatype='filepath', + name='Path', + info='Filepath of input file', + )) + + self.files_input.add(cm.DictConf('fileoption', '', + groupnames=['input', 'advanced'], + perm='r', + name='Option', + info='Command line option', + )) + + self.files_input.add(cm.DictConf('fileinfo', '', + groupnames=['input', 'advanced'], + perm='rw', + name='Info', + info='File info of input file', + )) + self.files_input.add(cm.DictConf('wildcards', '', + groupnames=['input', 'advanced'], + perm='rw', + name='wildcards', + info='Wildcards for file filtering', + )) + + if is_outputfilelist: + self.files_output = self.add_tableman(cm.TableManager( + ident='files_output', + parent=self, + name='Output files', + is_keyindex=True), + ) + + self.files_output.add(cm.DictConf('filename', '', + groupnames=['output'], + perm='rw', + name='Name', + info='File name of output file', + )) + + self.files_output.add(cm.DictConf('filepath', '', + groupnames=['output'], + perm='rw', + metatype='filepath', + name='Path', + info='Filepath of output file', + )) + + self.files_output.add(cm.DictConf('fileoption', '', + groupnames=['advanced'], + perm='r', + name='Option', + info='Command line option', + )) + + self.files_output.add(cm.DictConf('fileinfo', '', + groupnames=[ + 'output', 'advanced'], + perm='r', + is_save=True, + name='Info', + info='File info of output file', + )) + + self.files_output.add(cm.DictConf('wildcards', '', + groupnames=[ + 'output', 'advanced'], + perm='rw', + is_save=True, + name='wildcards', + info='Wildcards for file filtering', + )) + + def add_option(self, option, value, **kwargs): """ option = string with option value = value of option name = human readable name info = help info cml = string to be specified if command line string different from option - """ - kwargs0 = { 'cml':None, - 'groupnames': [], - 'perm':'rw', - 'is_save' : True, - 'name' : None, - 'info' : '',} - + """ + kwargs0 = {'cml': None, + 'groupnames': [], + 'perm': 'rw', + 'is_save': True, + 'name': None, + 'info': '', } + kwargs0.update(kwargs) - if not ('options' in kwargs0['groupnames'] ): - kwargs0['groupnames']+=['options'] - - default = self.attrs.add(cm.AttrConf( option, value,**kwargs0)) - - setattr(self,option,default) - - def add_inputfile( self, filekey, filepath, is_required = True, - cml = None, name = None, info = '', wildcards=''): - self.files_input.add_row(key = filekey) - self.files_input.filepath.set(filekey,filepath ) - self.files_input.is_existent.set(filekey,self.is_inputfile(filekey)) - self.files_input.is_required.set(filekey,is_required ) - self.files_input.fileoption.set(filekey,cml) - self.files_input.filename.set(filekey,name ) - self.files_input.fileinfo.set(filekey,info ) - self.files_input.wildcards.set(filekey,wildcards ) - - def add_outputfile( self, filekey, filepath, - cml = None, name = None, info = '', wildcards=''): - self.files_output.add_row(key = filekey) - self.files_output.filepath.set(filekey,filepath ) - self.files_output.fileoption.set(filekey,cml) - self.files_output.filename.set(filekey,name ) - self.files_output.fileinfo.set(filekey,info ) - self.files_output.wildcards.set(filekey,wildcards ) - - + if not ('options' in kwargs0['groupnames']): + kwargs0['groupnames'] += ['options'] + + default = self.attrs.add(cm.AttrConf(option, value, **kwargs0)) + + setattr(self, option, default) + + def add_inputfile(self, filekey, filepath, is_required=True, + cml=None, name=None, info='', wildcards=''): + self.files_input.add_row(key=filekey) + self.files_input.filepath.set(filekey, filepath) + self.files_input.is_existent.set(filekey, self.is_inputfile(filekey)) + self.files_input.is_required.set(filekey, is_required) + self.files_input.fileoption.set(filekey, cml) + self.files_input.filename.set(filekey, name) + self.files_input.fileinfo.set(filekey, info) + self.files_input.wildcards.set(filekey, wildcards) + + def add_outputfile(self, filekey, filepath, + cml=None, name=None, info='', wildcards=''): + self.files_output.add_row(key=filekey) + self.files_output.filepath.set(filekey, filepath) + self.files_output.fileoption.set(filekey, cml) + self.files_output.filename.set(filekey, name) + self.files_output.fileinfo.set(filekey, info) + self.files_output.wildcards.set(filekey, wildcards) + def set_workdirpath(self, workdirpath): """ Set working directory for process. @@ -532,126 +524,121 @@ will end in this directory. Moreover, all filenames withot explicit path (absolue or relative) are supposed to be in this directory. - """ + """ self._workdirpath = workdirpath - + def get_workdirpath(self): return self._workdirpath - + def set_path_inputfile(self, filekey, filepaths): - self.files_input.filepath.set(filekey,filepaths ) - self.files_input.is_existent.set(filekey,self.is_inputfile(filekey)) - + self.files_input.filepath.set(filekey, filepaths) + self.files_input.is_existent.set(filekey, self.is_inputfile(filekey)) + def set_path_outputfile(self, filekey, filepaths): - self.files_output.filepath.set(filekey,filepaths ) - - + self.files_output.filepath.set(filekey, filepaths) + def get_path_inputfile(self, filekey): return self.files_input.filepath.get(filekey) - - - + def get_path_outputfile(self, filekey): return self.files_output.filepath.get(filekey) - - + def get_name_inputfile(self, filekey): - return os.path.basename(self.files_input.filepath.get(filekey)) - + return os.path.basename(self.files_input.filepath.get(filekey)) + def get_name_outputfile(self, filekey): return os.path.basename(self.files_output.filepath.get(filekey)) - + def set_existents_inputfiles(self): for filekey in self.files_input.get_keys(): - self.files_input.is_existent.set(filekey,self.is_inputfile(filekey)) + self.files_input.is_existent.set( + filekey, self.is_inputfile(filekey)) + def get_inputfiles_missing(self): """ Returns list with paths of all input files that are required but not existent in filesystem - """ + """ files_missing = [] if hasattr(self, 'files_input'): for filekey in self.files_input.get_keys(): - if (not self.is_inputfile(filekey))&(self.files_input.is_required.get(filekey)): - files_missing.append(self.files_input.filepath.get(filekey)) - - return files_missing - + if (not self.is_inputfile(filekey)) & (self.files_input.is_required.get(filekey)): + files_missing.append( + self.files_input.filepath.get(filekey)) + + return files_missing + def get_outputfiles_missing(self): """ Returns list with paths of all output files that are expected to be produced and are currently not existent in filesystem - """ - #print '\n\nget_outputfiles_missing' + """ + # print '\n\nget_outputfiles_missing' files_missing = [] if hasattr(self, 'files_output'): for filekey in self.files_output.get_keys(): if not self.is_outputfile(filekey): - files_missing.append(self.files_output.filepath.get(filekey)) - + files_missing.append( + self.files_output.filepath.get(filekey)) + return files_missing - + def is_inputfile(self, filekey): - print 'is_inputfile',filekey - + print 'is_inputfile', filekey + filepaths = self.files_input.filepath.get(filekey) - #print ' filepaths =',filepaths,type(filepaths) + # print ' filepaths =',filepaths,type(filepaths) if type(filepaths) in types.StringTypes: - #print ' call filepathstring_to_filepathlist' + # print ' call filepathstring_to_filepathlist' filepaths = filepathstring_to_filepathlist(filepaths) - - - #print ' filepaths list',filepaths - if len(filepaths)>0: + + # print ' filepaths list',filepaths + if len(filepaths) > 0: ans = True for filepath in filepaths: dirpath = os.path.dirname(filepath) # this is to make sure that check always works # either with filename or with filepath - if (self._workdirpath!= None)&(dirpath==''): - filepath = os.path.join(self._workdirpath,filepath) - print ' check is_inputfile: >>%s<< exists = %d'%(filepath,os.path.isfile(filepath)) + if (self._workdirpath != None) & (dirpath == ''): + filepath = os.path.join(self._workdirpath, filepath) + print ' check is_inputfile: >>%s<< exists = %d' % (filepath, os.path.isfile(filepath)) ans = ans & os.path.isfile(filepath) - #print ' is_inputfile=',ans + # print ' is_inputfile=',ans return ans else: - return False # no path given - + return False # no path given + def is_outputfile(self, filekey): ans = True filepaths = self.files_output.filepath.get(filekey) - #print '\nis_outputfile filepaths = >%s<'%filepaths,type(filepaths) + # print '\nis_outputfile filepaths = >%s<'%filepaths,type(filepaths) if type(filepaths) in types.StringTypes: - #print ' call filepathstring_to_filepathlist' + # print ' call filepathstring_to_filepathlist' filepaths = filepathstring_to_filepathlist(filepaths) - - - #print ' filepaths list',filepaths + + # print ' filepaths list',filepaths for filepath in filepaths: dirpath = os.path.dirname(filepath) # this is to make sure that check always works # either with filename or with filepath - if (self._workdirpath!= None)&(dirpath==''): - filepath = os.path.join(self._workdirpath,filepath) - #print ' check is_outputfile: >>%s<< exists = %d'%(filepath,os.path.isfile(filepath)) + if (self._workdirpath != None) & (dirpath == ''): + filepath = os.path.join(self._workdirpath, filepath) + # print ' check is_outputfile: >>%s<< exists = + # %d'%(filepath,os.path.isfile(filepath)) ans = ans & os.path.isfile(filepath) - #print ' is_outputfile=',ans + # print ' is_outputfile=',ans return ans - - + #ans = True #filepaths = self.files_output.filepath.get(filekey) - #for filepath in cm.filepathstring_to_filepathlist(filepaths): + # for filepath in cm.filepathstring_to_filepathlist(filepaths): # dirpath = os.path.dirname(filepath) # if (self._workdirpath!= None)&(dirpath==''): # filepath = os.path.join(self._workdirpath,filepath) # #print ' check is_outputfile:',filepath,os.path.isfile(filepath) # ans = ans & os.path.isfile(filepath) - #return ans - - - - + # return ans + def update_params(self): """ Make all parameters consistent. @@ -659,90 +646,85 @@ from process dialog """ pass - - - + def is_ready(self): """ Returns True if process is ready to run. - + """ - if (self._command!= None)&(self._command!= ''): + if (self._command != None) & (self._command != ''): # check if all input files exist return len(self.get_inputfiles_missing()) == 0 - + else: print 'WARNING: command has not been set' return False - - + def is_done(self): """ Returns True if process produced all output files. """ - return len(self.get_outputfiles_missing())==0 - + return len(self.get_outputfiles_missing()) == 0 + def get_options(self): options = Options() for attrconfig in self.attrs.get_configs(): if 'cml-options' in attrconfig.groupnames: - options.add_option(attrconfig.attrname,attrconfig.get_attr(),attrconfig.cml, is_filepath = False) - + options.add_option(attrconfig.attrname, attrconfig.get_attr( + ), attrconfig.cml, is_filepath=False) + if hasattr(self, 'files_input'): for filekey in self.files_input.get_keys(): filepath = self.files_input.filepath.get(filekey) - + cml = self.files_input.fileoption.get(filekey) - options.add_option(filekey, filepath.replace(',',' '), cml, is_filepath = True) - + options.add_option(filekey, filepath.replace( + ',', ' '), cml, is_filepath=True) + if hasattr(self, 'files_output'): for filekey in self.files_output.get_keys(): filepath = self.files_output.filepath.get(filekey) cml = self.files_output.fileoption.get(filekey) - options.add_option(filekey, filepath.replace(',',' '), cml, is_filepath = True) - + options.add_option(filekey, filepath.replace( + ',', ' '), cml, is_filepath=True) + return options - + def print_options(self): - print 'Options of process ident:',self.ident + print 'Options of process ident:', self.ident print ' Keywordoptions:' for attrconfig in self.attrs.get_configs(): if 'options' in attrconfig.groupnames: - print ' ',attrconfig.attrname,'=',attrconfig.get_attr() - - print ' Input files:' + print ' ', attrconfig.attrname, '=', attrconfig.get_attr() + + print ' Input files:' if hasattr(self, 'files_input'): for filekey in self.files_input.get_keys(): filepath = self.files_input.filepath.get(filekey) - print ' ',filekey,'=',filepath - - - print ' Output files:' + print ' ', filekey, '=', filepath + + print ' Output files:' if hasattr(self, 'files_output'): for filekey in self.files_output.get_keys(): filepath = self.files_input.filepath.get(filekey) - print ' ',filekey,'=',filepath - - - def get_cml(self, is_changecwd = False): + print ' ', filekey, '=', filepath + + def get_cml(self, is_changecwd=False): """ Returns commandline with all options. To be overridden by costum class. """ options = self.get_options() - + if is_changecwd: - if self.get_workdirpath()==None: + if self.get_workdirpath() == None: cwd = '' else: - cwd = 'cd '+self.get_workdirpath()+' ;' + cwd = 'cd ' + self.get_workdirpath() + ' ;' else: cwd = '' - return cwd+self._command + options.get_optionstring() - - - - + return cwd + self._command + options.get_optionstring() + def run(self): if self.is_ready(): if (not self.is_done()) | self.is_force: @@ -750,15 +732,15 @@ self._subprocess = subprocess.Popen(cml, shell=True) self.attrs.pid.set(self._subprocess.pid) self.attrs.status.set('running') - print 'run cml=',cml - print ' pid = ',self.pid + print 'run cml=', cml + print ' pid = ', self.pid if not self.is_run_background: self._subprocess.wait() - + if self._subprocess.returncode == 0: self.attrs.status.set('success') return True - + else: self.attrs.status.set('error') return False @@ -767,18 +749,18 @@ else: print 'WARNING: process not ready to run.' return False - + def kill(self): pass - - -##print '\n Starting command:',cmd + + +# print '\n Starting command:',cmd ##p = subprocess.Popen(cmd, shell=True) -##print "p.pid",p.pid, "p.poll=",p.poll() -##p.wait() -##print '\n\nreturncode',p.poll(),p.returncode -##print 'p.stdout=\n', p.stdout -###call(cmd) +# print "p.pid",p.pid, "p.poll=",p.poll() +# p.wait() +# print '\n\nreturncode',p.poll(),p.returncode +# print 'p.stdout=\n', p.stdout +# call(cmd) ############################################################################### @@ -786,8 +768,6 @@ """ Test """ - + # for testing only to get the object browser... - sys.path.append(os.path.join(APPDIR,"lib_meta_wx")) - - \ No newline at end of file + sys.path.append(os.path.join(APPDIR, "lib_meta_wx")) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/test_classman_classes.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/test_classman_classes.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/test_classman_classes.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/test_classman_classes.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,101 +6,104 @@ from classman import * from arrayman import * import xmlman as xm + + def on_event_delattr(attrconfig): - print 'EVENT: Attribute',attrconfig.attrname,'will be deleted!!' - + print 'EVENT: Attribute', attrconfig.attrname, 'will be deleted!!' + + def on_event_setattr(attrconfig): - print 'EVENT: Attribute',attrconfig.attrname,'has been set to a new value',attrconfig.format_value() + print 'EVENT: Attribute', attrconfig.attrname, 'has been set to a new value', attrconfig.format_value() + def on_event_getattr(attrconfig): - print 'EVENT: Attribute',attrconfig.attrname,'has been retrieved the value',attrconfig.format_value() + print 'EVENT: Attribute', attrconfig.attrname, 'has been retrieved the value', attrconfig.format_value() + -def on_event_additem(attrconfig,keys): - print 'EVENT: Attribute',attrconfig.attrname,':added keys:',keys +def on_event_additem(attrconfig, keys): + print 'EVENT: Attribute', attrconfig.attrname, ':added keys:', keys -def on_event_delitem(attrconfig,keys): - print 'EVENT: Attribute',attrconfig.attrname,':delete keys:',keys -def on_event_setitem(attrconfig,keys): - print 'EVENT: Attribute',attrconfig.attrname,':set keys:',keys +def on_event_delitem(attrconfig, keys): + print 'EVENT: Attribute', attrconfig.attrname, ':delete keys:', keys -def on_event_getitem(attrconfig,keys): - print 'EVENT: Attribute',attrconfig.attrname,':get keys:',keys +def on_event_setitem(attrconfig, keys): + print 'EVENT: Attribute', attrconfig.attrname, ':set keys:', keys - +def on_event_getitem(attrconfig, keys): + print 'EVENT: Attribute', attrconfig.attrname, ':get keys:', keys class Segments(ArrayObjman): - - def __init__(self, ident = 'segments', parent=None, **kwargs): - - self._init_objman(ident,parent=parent,xmltag = ('segments','segment','ids_ref'), **kwargs) - - - - self.add_col(ArrayConf( 'ids_ref', '', - dtype = 'object', - perm='r', - is_index = True, - name = 'ID Ref', - info = 'Ref ID', - xmltag = 'id_ref', - )) - - - self.add_col(ArrayConf( 'vertices', np.zeros((2,3), float), - groupnames = ['internal'], - perm='rw', - name = 'Vertex', - is_save = True, - info = 'Vertex coordinate vectors of points. with format [[[x11,y11,z11],[x12,y12,z12]],[[x21,y21,z21],[x22,y22,z122]],...]', - xmltag = 'vertex', - )) - - self.add_col(IdsArrayConf( 'ids_parent', parent, - groupnames = ['state'], - is_save = True, - name = 'ID '+parent.get_ident(), - info = 'ID of '+parent.get_name()+' object.', - xmltag = 'id_poly', - )) - - -class Polylines (ArrayObjman): - def __init__( self,ident='polyline', parent=None, name = 'Polyline', - info = 'Polyline [ segid11, segid12,...]',**kwargs): - self._init_objman(ident,parent=parent,xmltag = ('polylines','polyline','ids_osm'), **kwargs) - #print '__init__',self.get_name(),self.format_ident() - - self.add_col(ArrayConf( 'ids_osm', '', - dtype = 'object', - perm='r', - is_index = True, - name = 'ID OSM', - info = 'Edge ID of OSM', - xmltag = 'id_osm', - )) - - #initialize line segments + + def __init__(self, ident='segments', parent=None, **kwargs): + + self._init_objman(ident, parent=parent, xmltag=( + 'segments', 'segment', 'ids_ref'), **kwargs) + + self.add_col(ArrayConf('ids_ref', '', + dtype='object', + perm='r', + is_index=True, + name='ID Ref', + info='Ref ID', + xmltag='id_ref', + )) + + self.add_col(ArrayConf('vertices', np.zeros((2, 3), float), + groupnames=['internal'], + perm='rw', + name='Vertex', + is_save=True, + info='Vertex coordinate vectors of points. with format [[[x11,y11,z11],[x12,y12,z12]],[[x21,y21,z21],[x22,y22,z122]],...]', + xmltag='vertex', + )) + + self.add_col(IdsArrayConf('ids_parent', parent, + groupnames=['state'], + is_save=True, + name='ID ' + parent.get_ident(), + info='ID of ' + + parent.get_name() + ' object.', + xmltag='id_poly', + )) + + +class Polylines (ArrayObjman): + + def __init__(self, ident='polyline', parent=None, name='Polyline', + info='Polyline [ segid11, segid12,...]', **kwargs): + self._init_objman(ident, parent=parent, xmltag=( + 'polylines', 'polyline', 'ids_osm'), **kwargs) + # print '__init__',self.get_name(),self.format_ident() + + self.add_col(ArrayConf('ids_osm', '', + dtype='object', + perm='r', + is_index=True, + name='ID OSM', + info='Edge ID of OSM', + xmltag='id_osm', + )) + + # initialize line segments segments = Segments(parent=self) - self.add(ObjConf( segments, groupnames = ['drawobjects']) ) - - - - #print ' segments',segments - #print ' self.segments',self.segments,type(self.segments) - # create table with id lists to segments - self.add_col(IdlistsArrayConf( 'ids_segments', segments, - groupnames = ['elements'], - is_save = True, - name = 'IDs Segs', - info = 'List with IDs to Line segments.', - xmltag = 'segments', - )) - - def draw(self,pointvertices, id_osm): + self.add(ObjConf(segments, groupnames=['drawobjects'])) + + # print ' segments',segments + # print ' self.segments',self.segments,type(self.segments) + # create table with id lists to segments + self.add_col(IdlistsArrayConf('ids_segments', segments, + groupnames=['elements'], + is_save=True, + name='IDs Segs', + info='List with IDs to Line segments.', + xmltag='segments', + )) + + def draw(self, pointvertices, id_osm): """ pointvertices = [ [0.0,0.0,0.0], @@ -108,597 +111,609 @@ ] """ vertices = [] - print 'draw',self.ident - for i in xrange(1,len(pointvertices)): - vertices.append([pointvertices[i-1], pointvertices[i]]) - n_vert = len(vertices) - _id = self.add_row(ids_osm = id_osm) + print 'draw', self.ident + for i in xrange(1, len(pointvertices)): + vertices.append([pointvertices[i - 1], pointvertices[i]]) + n_vert = len(vertices) + _id = self.add_row(ids_osm=id_osm) cod = [] #import string - clist = np.array(['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p'],np.object) - print ' ',len(vertices),clist[:len(vertices)] + clist = np.array(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', + 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'], np.object) + print ' ', len(vertices), clist[:len(vertices)] ids = self.segments.value.suggest_ids(len(vertices)) - ids_segs = self.segments.value.add_rows(ids = ids, vertices = vertices, ids_parent = n_vert*[_id],ids_ref = clist[ids] ) - self.ids_segments[_id] = list(ids_segs) # put here list, otherwise numpy thinks it is a numeric array - return _id - - - + ids_segs = self.segments.value.add_rows( + ids=ids, vertices=vertices, ids_parent=n_vert * [_id], ids_ref=clist[ids]) + # put here list, otherwise numpy thinks it is a numeric array + self.ids_segments[_id] = list(ids_segs) + return _id + + class Lines(ArrayObjman): - - def __init__(self,ident, parent=None, **kwargs): - - self._init_objman(ident,parent=parent, **kwargs) - - - self.add_col(ArrayConf( 'vertices', np.zeros((2,3), float), - groupnames = ['internal'], - perm='rw', - name = 'Vertex', - is_save = True, - info = 'Vertex coordinate vectors of points. with format [[[x11,y11,z11],[x12,y12,z12]],[[x21,y21,z21],[x22,y22,z122]],...]', - )) - - self.add_col(ArrayConf( 'ids_sumo', '', - dtype = 'object', - perm='r', - is_index = True, - name = 'ID SUMO', - info = 'Edge ID of SUMO network', - )) - - - - + + def __init__(self, ident, parent=None, **kwargs): + + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(ArrayConf('vertices', np.zeros((2, 3), float), + groupnames=['internal'], + perm='rw', + name='Vertex', + is_save=True, + info='Vertex coordinate vectors of points. with format [[[x11,y11,z11],[x12,y12,z12]],[[x21,y21,z21],[x22,y22,z122]],...]', + )) + + self.add_col(ArrayConf('ids_sumo', '', + dtype='object', + perm='r', + is_index=True, + name='ID SUMO', + info='Edge ID of SUMO network', + )) + + class Selection(ArrayObjman): - def __init__(self,ident, parent=None, **kwargs): - self._init_objman(ident,parent=parent, **kwargs) - self.add_col(TabIdsArrayConf( 'obj_ids', - name = 'Object[id]', - info = 'Draw obj and ids', - )) - + + def __init__(self, ident, parent=None, **kwargs): + self._init_objman(ident, parent=parent, **kwargs) + self.add_col(TabIdsArrayConf('obj_ids', + name='Object[id]', + info='Draw obj and ids', + )) + + class Collection(ArrayObjman): - def __init__(self,ident, parent=None, **kwargs): - self._init_objman(ident,parent=parent, **kwargs) - self.add_col(TabIdListArrayConf( 'tab_id_lists', - name = '[Tab1[id1],Tab2[id1],...]', - info = 'Collection of different items from different tables.', - )) -class TestClass(BaseObjman): - def __init__(self, ident = 'testobj', parent=None, name = 'Test Object'): - self._init_objman(ident, parent=parent, name = name, xmltag = ident) - attrsman = self.set_attrsman(Attrsman(self)) - - - - self.netfilepath = attrsman.add(AttrConf( 'netfilepath','pathtofile', - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Network file', - metatype = 'filepath', - info = 'Network file path', - xmltag = 'netfilepath', - )) - - self.workdirpath = attrsman.add(AttrConf( 'workdirpath','pathtodir', - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Workdir', - metatype = 'dirpath', - info = 'Working directory.', - xmltag = 'workdirpath', - )) - - self.access = attrsman.add(AttrConf( 'access', ['bus','bike','tram'], - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Access list', - info = 'List with vehicle classes that have access', - xmltag = 'access', - )) - - - - self.allowed = attrsman.add(AttrConf( 'allowed', 0, choices ={'bus':0,'bike':1,'tram':2}, - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Access list', - info = 'List with vehicle classes that have access', - xmltag = 'allowed', - )) - - self.emissiontype = attrsman.add(AttrConf( 'emissiontype', 'Euro 0', - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Emission type', - info = 'Emission type of vehicle', - xmltag = 'emissiontype', - )) - - self.x = attrsman.add(NumConf( 'x', 1.0, - digits_integer = None, digits_fraction=4, - minval = 0.0, maxval = None, - groupnames = ['state'], - perm='rw', - is_save = True, - unit = 'm', - is_plugin = True, - name = 'position', - info = 'Test object x position', - xmltag = 'x', - )) - - self.x_thresh = attrsman.add(NumConf( 'x_thresh', 0.0, - digits_integer = None, digits_fraction=4, - minval = 0.0, maxval = None, - groupnames = ['state'], - perm='rw', - is_save = True, - unit = 'm', - is_plugin = True, - name = 'position threshold', - info = 'Test object x position threshold', - xmltag = 'x_thesh', - )) - - self.is_pos_ok = attrsman.add(FuncConf( 'is_pos_ok','on_is_pos_ok', False, - groupnames = ['state'], - name = 'Pos OK', - info = 'True if position greater than thhreshold.', + + def __init__(self, ident, parent=None, **kwargs): + self._init_objman(ident, parent=parent, **kwargs) + self.add_col(TabIdListArrayConf('tab_id_lists', + name='[Tab1[id1],Tab2[id1],...]', + info='Collection of different items from different tables.', )) - - attrsman.print_attrs() - def on_is_pos_ok(self): - """ - True if position greater than thhreshold. - """ - print 'on_is_pos_ok',self.x> self.x_thresh - return self.x> self.x_thresh - - - - -class TestClass3(BaseObjman): - def __init__(self,ident = 'testobj3', parent=None, name = 'Test Object3'): - self._init_objman(ident = ident, parent=parent, name = name, xmltag = 'testobj3') - attrsman = self.set_attrsman(Attrsman(self)) - - self.child1 = attrsman.add( ObjConf(parent.child1, is_child = False)) - - self.y = attrsman.add( AttrConf( 'y', 0.0, - groupnames = ['state'], - perm='r', - is_save = True, - unit = 'm', - metatype = 'length', - is_plugin = True, - name = 'position', - info = 'Test object y position', +class TestClass(BaseObjman): + + def __init__(self, ident='testobj', parent=None, name='Test Object'): + self._init_objman(ident, parent=parent, name=name, xmltag=ident) + attrsman = self.set_attrsman(Attrsman(self)) + + self.netfilepath = attrsman.add(AttrConf('netfilepath', 'pathtofile', + groupnames=['state'], + perm='rw', + is_save=True, + name='Network file', + metatype='filepath', + info='Network file path', + xmltag='netfilepath', + )) + + self.workdirpath = attrsman.add(AttrConf('workdirpath', 'pathtodir', + groupnames=['state'], + perm='rw', + is_save=True, + name='Workdir', + metatype='dirpath', + info='Working directory.', + xmltag='workdirpath', + )) + + self.access = attrsman.add(AttrConf('access', ['bus', 'bike', 'tram'], + groupnames=['state'], + perm='rw', + is_save=True, + name='Access list', + info='List with vehicle classes that have access', + xmltag='access', )) - - + + self.allowed = attrsman.add(AttrConf('allowed', 0, choices={'bus': 0, 'bike': 1, 'tram': 2}, + groupnames=['state'], + perm='rw', + is_save=True, + name='Access list', + info='List with vehicle classes that have access', + xmltag='allowed', + )) + + self.emissiontype = attrsman.add(AttrConf('emissiontype', 'Euro 0', + groupnames=['state'], + perm='rw', + is_save=True, + name='Emission type', + info='Emission type of vehicle', + xmltag='emissiontype', + )) + + self.x = attrsman.add(NumConf('x', 1.0, + digits_integer=None, digits_fraction=4, + minval=0.0, maxval=None, + groupnames=['state'], + perm='rw', + is_save=True, + unit='m', + is_plugin=True, + name='position', + info='Test object x position', + xmltag='x', + )) + + self.x_thresh = attrsman.add(NumConf('x_thresh', 0.0, + digits_integer=None, digits_fraction=4, + minval=0.0, maxval=None, + groupnames=['state'], + perm='rw', + is_save=True, + unit='m', + is_plugin=True, + name='position threshold', + info='Test object x position threshold', + xmltag='x_thesh', + )) + + self.is_pos_ok = attrsman.add(FuncConf('is_pos_ok', 'on_is_pos_ok', False, + groupnames=['state'], + name='Pos OK', + info='True if position greater than thhreshold.', + )) + + attrsman.print_attrs() + + def on_is_pos_ok(self): + """ + True if position greater than thhreshold. + """ + print 'on_is_pos_ok', self.x > self.x_thresh + return self.x > self.x_thresh + + +class TestClass3(BaseObjman): + + def __init__(self, ident='testobj3', parent=None, name='Test Object3'): + self._init_objman(ident=ident, parent=parent, + name=name, xmltag='testobj3') + attrsman = self.set_attrsman(Attrsman(self)) + + self.child1 = attrsman.add(ObjConf(parent.child1, is_child=False)) + + self.y = attrsman.add(AttrConf('y', 0.0, + groupnames=['state'], + perm='r', + is_save=True, + unit='m', + metatype='length', + is_plugin=True, + name='position', + info='Test object y position', + )) + class TestClass2(BaseObjman): - def __init__(self,ident = 'testobj2', parent=None, name = 'Test Object2',xmltag='testobj2'): - self._init_objman(ident,parent=parent, name = name,xmltag=xmltag) - attrsman = self.set_attrsman(Attrsman(self)) - - self.child1 = attrsman.add( ObjConf( TestClass('child1',self) ) - ) - - print 'TestClass2.child1', self.child1 - - self.child3 = attrsman.add( ObjConf( TestClass3('child3',self) ) - ) + + def __init__(self, ident='testobj2', parent=None, name='Test Object2', xmltag='testobj2'): + self._init_objman(ident, parent=parent, name=name, xmltag=xmltag) + attrsman = self.set_attrsman(Attrsman(self)) + + self.child1 = attrsman.add(ObjConf(TestClass('child1', self)) + ) + + print 'TestClass2.child1', self.child1 + + self.child3 = attrsman.add(ObjConf(TestClass3('child3', self)) + ) + class TestTabman(BaseObjman): - def __init__(self,ident = 'test_tabman', parent=None, name = 'Test Table manage'): - self._init_objman(ident,parent=parent, name = name) - tm = Tabman(obj = self) - self.set_attrsman(tm) - self.surname = attrsman.add_col(ColConf( 'surname', 'xx', - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Family name', - info = 'Name of Family', - )) - - self.streetname = attrsman.add_col(ColConf( 'streetname', 'via della...', - groupnames = ['state'], - perm='rw', - is_save = False, - name = 'Street name', - info = 'Name of the street', - )) - - - - #_id = attrsman.suggest_id() - #print '_id =',_id - #self.attrman.add(_id) - - #print 'self.streetname',self.streetname,type(self.streetname) - #self.streetname[1]='yyy' - #print 'self.streetname',self.streetname,type(self.streetname) - attrsman.add_rows(5) - attrsman.streetname[3]='ssss' - attrsman.streetname[[1,2]]=['aa',55] - print 'test get',attrsman.streetname[[1,2]] - #self.streetname[1]+='zzz' - attrsman.del_rows([1,3]) - attrsman.del_row(5) - #attrsman.delete('streetname') - + + def __init__(self, ident='test_tabman', parent=None, name='Test Table manage'): + self._init_objman(ident, parent=parent, name=name) + tm = Tabman(obj=self) + self.set_attrsman(tm) + self.surname = attrsman.add_col(ColConf('surname', 'xx', + groupnames=['state'], + perm='rw', + is_save=True, + name='Family name', + info='Name of Family', + )) + + self.streetname = attrsman.add_col(ColConf('streetname', 'via della...', + groupnames=['state'], + perm='rw', + is_save=False, + name='Street name', + info='Name of the street', + )) + + #_id = attrsman.suggest_id() + # print '_id =',_id + # self.attrman.add(_id) + + # print 'self.streetname',self.streetname,type(self.streetname) + # self.streetname[1]='yyy' + # print 'self.streetname',self.streetname,type(self.streetname) + attrsman.add_rows(5) + attrsman.streetname[3] = 'ssss' + attrsman.streetname[[1, 2]] = ['aa', 55] + print 'test get', attrsman.streetname[[1, 2]] + # self.streetname[1]+='zzz' + attrsman.del_rows([1, 3]) + attrsman.del_row(5) + # attrsman.delete('streetname') + + class TestTableObjMan(TableObjman): - def __init__(self,ident = 'test_tableobjman_simple', parent=None, name = 'Test Table Object Manager'): - self._init_objman(ident,parent=parent, name = name, xmltag = ('testtab','row',None)) - - # ATTENTION!! - # do not use x = self.add(...) or self.add_col(...) - # This would overwrite the configuration with the value - # because the attribute is the configuration, which is set by Attrman - # While the add method is returning the value - self.add(AttrConf( 'x', 0.0, - groupnames = ['state'], - perm='r', - is_save = True, - unit = 'm', - metatype = 'length', - is_plugin = False, - name = 'position', - info = 'Test object x position', - xmltag = 'pos', - )) - - self.add(AttrConf( 'is_pos_ok', False, - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Pos OK', - info = 'True if position is OK', - xmltag = 'pos_ok', - )) - - self.add_col(ColConf( 'surname', 'xx', - groupnames = ['state'], - perm='r', - is_save = True, - name = 'Family name', - info = 'Name of Family', - xmltag = 'surname', - )) - - self.add_col(ColConf( 'streetname', 'via della...', - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Street name', - info = 'Name of the street', - xmltag = 'streetname', - )) - - fruits = ['allpes', 'bananas', 'oranges'] - self.add_col(ColConf( 'fruits', fruits[0], - groupnames = ['state'], - choices = fruits, - perm='rw', - is_save = False, - name = 'Fruits', - info = 'Choose a fruit.', - )) - - self.add_col(NumcolConf( 'distances', 0.0, - digits_integer = None, digits_fraction=4, - minval = 0.0, maxval = None, - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Distance', - unit = 'm', - info = 'Distance of the street', - xmltag = 'distances', - )) - - self.add(FuncConf( 'new_row','on_new_row', None, - groupnames = ['rowfunctions','_private'], - name = 'New row', - info = 'Add a new row.', + + def __init__(self, ident='test_tableobjman_simple', parent=None, name='Test Table Object Manager'): + self._init_objman(ident, parent=parent, name=name, + xmltag=('testtab', 'row', None)) + + # ATTENTION!! + # do not use x = self.add(...) or self.add_col(...) + # This would overwrite the configuration with the value + # because the attribute is the configuration, which is set by Attrman + # While the add method is returning the value + self.add(AttrConf('x', 0.0, + groupnames=['state'], + perm='r', + is_save=True, + unit='m', + metatype='length', + is_plugin=False, + name='position', + info='Test object x position', + xmltag='pos', + )) + + self.add(AttrConf('is_pos_ok', False, + groupnames=['state'], + perm='rw', + is_save=True, + name='Pos OK', + info='True if position is OK', + xmltag='pos_ok', + )) + + self.add_col(ColConf('surname', 'xx', + groupnames=['state'], + perm='r', + is_save=True, + name='Family name', + info='Name of Family', + xmltag='surname', + )) + + self.add_col(ColConf('streetname', 'via della...', + groupnames=['state'], + perm='rw', + is_save=True, + name='Street name', + info='Name of the street', + xmltag='streetname', + )) + + fruits = ['allpes', 'bananas', 'oranges'] + self.add_col(ColConf('fruits', fruits[0], + groupnames=['state'], + choices=fruits, + perm='rw', + is_save=False, + name='Fruits', + info='Choose a fruit.', + )) + + self.add_col(NumcolConf('distances', 0.0, + digits_integer=None, digits_fraction=4, + minval=0.0, maxval=None, + groupnames=['state'], + perm='rw', + is_save=True, + name='Distance', + unit='m', + info='Distance of the street', + xmltag='distances', )) - self.add(FuncConf( 'delete_row','on_del_row', None, - groupnames = ['rowfunctions','_private'], - name = 'Del row', - #info = 'Delete a row.', - )) - - - - #_id = attrsman.suggest_id() - #print '_id =',_id - #self.attrman.add(_id) - - #print 'self.streetname',self.streetname,type(self.streetname) - #self.streetname[1]='yyy' - #print 'self.streetname',self.streetname,type(self.streetname) - self.add_rows(5) - self.streetname[3]='ssss' - self.surname[[1,2,3,4]]=['a','bb','ccc','dddd'] - self.streetname[[1,2]]=['vv','dd'] - #print '\n\ntest get',self.streetname[[1,2,3]] - #self.streetname[1]+='zzz' - #self.del_rows([1,3]) - #self.del_row(5) - #self.delete('streetname') - #self.delete('is_pos_ok') - #print 'dir',dir(self) - + + self.add(FuncConf('new_row', 'on_new_row', None, + groupnames=['rowfunctions', '_private'], + name='New row', + info='Add a new row.', + )) + self.add(FuncConf('delete_row', 'on_del_row', None, + groupnames=['rowfunctions', '_private'], + name='Del row', + #info = 'Delete a row.', + )) + + #_id = attrsman.suggest_id() + # print '_id =',_id + # self.attrman.add(_id) + + # print 'self.streetname',self.streetname,type(self.streetname) + # self.streetname[1]='yyy' + # print 'self.streetname',self.streetname,type(self.streetname) + self.add_rows(5) + self.streetname[3] = 'ssss' + self.surname[[1, 2, 3, 4]] = ['a', 'bb', 'ccc', 'dddd'] + self.streetname[[1, 2]] = ['vv', 'dd'] + # print '\n\ntest get',self.streetname[[1,2,3]] + # self.streetname[1]+='zzz' + # self.del_rows([1,3]) + # self.del_row(5) + # self.delete('streetname') + # self.delete('is_pos_ok') + # print 'dir',dir(self) + def on_new_row(self, ids): - """ - True if position greater than thhreshold. - """ - self.add_row() + """ + True if position greater than thhreshold. + """ + self.add_row() + def on_del_row(self, id_row): - """ - True if position greater than thhreshold. - """ - print 'on_del_row', id_row - self.del_row(id_row) - print ' ids after del',self.get_ids() - + """ + True if position greater than thhreshold. + """ + print 'on_del_row', id_row + self.del_row(id_row) + print ' ids after del', self.get_ids() + + class TestTableObjManNocols(TableObjman): + """ Table manager without columns...for test purposes """ - def __init__(self,ident = 'test_tableobjman_simple_nocols', parent=None, name = 'Test Table Object Manager'): - self._init_objman(ident,parent=parent, name = name) - - # ATTENTION!! - # do not use x = self.add(...) or c=self.add_col(...) - # This would overwrite the configuration with the value - # because the attribute is the configuration, which is set by Attrman - # While the add method is returning the value - self.add(AttrConf( 'x', 0.0, - groupnames = ['state'], - perm='r', - is_save = True, - unit = 'm', - metatype = 'length', - is_plugin = False, - name = 'position', - info = 'Test object x position', - )) - - self.add(AttrConf( 'is_pos_ok', False, - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Pos OK', - info = 'True if position is OK', - )) - - - + + def __init__(self, ident='test_tableobjman_simple_nocols', parent=None, name='Test Table Object Manager'): + self._init_objman(ident, parent=parent, name=name) + + # ATTENTION!! + # do not use x = self.add(...) or c=self.add_col(...) + # This would overwrite the configuration with the value + # because the attribute is the configuration, which is set by Attrman + # While the add method is returning the value + self.add(AttrConf('x', 0.0, + groupnames=['state'], + perm='r', + is_save=True, + unit='m', + metatype='length', + is_plugin=False, + name='position', + info='Test object x position', + )) + + self.add(AttrConf('is_pos_ok', False, + groupnames=['state'], + perm='rw', + is_save=True, + name='Pos OK', + info='True if position is OK', + )) + + class ZonesTab(ArrayObjman): - def __init__(self,ident, parent=None, **kwargs): - self._init_objman(ident,parent=parent, **kwargs) - - self.add_col(ColConf( 'zonetypes', 0, - choices = {\ - "priority":0, - "traffic_light":1, - "right_before_left":2, - "unregulated":3, - "priority_stop":4, - "traffic_light_unregulated":5, - "allway_stop":6, - "rail_signal":7, - "zipper":8, - "traffic_light_right_on_red":9, - "rail_crossing":10, - }, - is_plugin = True, - #dtype = np.int32, - perm='rw', - #is_index = True, - name = 'Type', - info = 'Zone type.', + + def __init__(self, ident, parent=None, **kwargs): + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(ColConf('zonetypes', 0, + choices={ + "priority": 0, + "traffic_light": 1, + "right_before_left": 2, + "unregulated": 3, + "priority_stop": 4, + "traffic_light_unregulated": 5, + "allway_stop": 6, + "rail_signal": 7, + "zipper": 8, + "traffic_light_right_on_red": 9, + "rail_crossing": 10, + }, + is_plugin=True, + #dtype = np.int32, + perm='rw', + #is_index = True, + name='Type', + info='Zone type.', + )) + + self.add_col(NumcolConf('shapes', [], + groupnames=['state'], + perm='rw', + is_plugin=True, + is_save=True, + name='Shape', + info='Shape of zone which is a list of (x,y) coordinates', )) - - self.add_col(NumcolConf( 'shapes', [], - groupnames = ['state'], - perm='rw', - is_plugin = True, - is_save = True, - name = 'Shape', - info = 'Shape of zone which is a list of (x,y) coordinates', - )) - - - + + class OdTripsTab(ArrayObjman): - def __init__(self,ident, parent, zones, **kwargs): - self._init_objman(ident, parent=parent, **kwargs) - - self.add_col(IdsArrayConf( 'ids_orig', zones, - groupnames = ['state'], - is_save = True, - name = 'ID Orig', - info = 'ID of traffic assignment zone of origin of trip.', - )) - - - self.add_col(IdsConf( 'ids_dest', zones, - groupnames = ['state'], - is_save = True, - name = 'ID Dest', - info = 'ID of traffic assignment zone of destination of trip.', - )) - - self.add_col(NumArrayConf( 'tripnumbers', 0, - groupnames = ['state'], - perm = 'rw', - is_save = True, - name = 'Trip number', - info = 'Number of trips from zone with ID Orig to zone with ID Dest.', - )) - + + def __init__(self, ident, parent, zones, **kwargs): + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(IdsArrayConf('ids_orig', zones, + groupnames=['state'], + is_save=True, + name='ID Orig', + info='ID of traffic assignment zone of origin of trip.', + )) + + self.add_col(IdsConf('ids_dest', zones, + groupnames=['state'], + is_save=True, + name='ID Dest', + info='ID of traffic assignment zone of destination of trip.', + )) + + self.add_col(NumArrayConf('tripnumbers', 0, + groupnames=['state'], + perm='rw', + is_save=True, + name='Trip number', + info='Number of trips from zone with ID Orig to zone with ID Dest.', + )) + + class OdModesTab(ArrayObjman): - def __init__(self,ident, parent=None, **kwargs): - self._init_objman(ident,parent=parent, **kwargs) - - - self.add_col(ObjsConf( 'odtrips', - groupnames = ['state'], - is_save = True, - name = 'OD matrix', - info = 'Matrix with trips from origin to destintion', - )) - + + def __init__(self, ident, parent=None, **kwargs): + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(ObjsConf('odtrips', + groupnames=['state'], + is_save=True, + name='OD matrix', + info='Matrix with trips from origin to destintion', + )) + + class OdIntervalsTab(ArrayObjman): - def __init__(self,ident, parent=None, **kwargs): - self._init_objman(ident,parent=parent, **kwargs) - - self.add_col(NumArrayConf( 't_start', 0.0, - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Start time', - unit = 's', - info = 'Start time of interval', - )) - - self.add_col(NumArrayConf( 't_end', 3600.0, - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'End time', - unit = 's', - info = 'End time of interval', - )) - - self.add_col(ObjsConf( 'odmodes', - groupnames = ['state'], - is_save = True, - name = 'Modes', - info = 'Transport mode', - )) - + + def __init__(self, ident, parent=None, **kwargs): + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(NumArrayConf('t_start', 0.0, + groupnames=['state'], + perm='rw', + is_save=True, + name='Start time', + unit='s', + info='Start time of interval', + )) + + self.add_col(NumArrayConf('t_end', 3600.0, + groupnames=['state'], + perm='rw', + is_save=True, + name='End time', + unit='s', + info='End time of interval', + )) + + self.add_col(ObjsConf('odmodes', + groupnames=['state'], + is_save=True, + name='Modes', + info='Transport mode', + )) + ########################################################################### -## Instance creation - +# Instance creation + demand = BaseObjman('demand') -zones = ZonesTab('zones', parent = demand ) -demand.zones = demand.get_attrsman().add( ObjConf( zones) ) -EVTDELITEM = 20 # delete attribute -EVTSETITEM = 21 # set attribute -EVTGETITEM = 22 # get attribute -EVTADDITEM = 23 # add/create attribute -zones.shapes.plugin.add_event(EVTADDITEM,on_event_additem) -shapes = [ [(0.0,10.0),(10.0,10.0),(10.0,0.0)], - [(10.0,20.0),(20.0,20.0),(20.0,10.0)], - [(20.0,30.0),(30.0,20.0),(30.0,20.0)], - ] +zones = ZonesTab('zones', parent=demand) +demand.zones = demand.get_attrsman().add(ObjConf(zones)) +EVTDELITEM = 20 # delete attribute +EVTSETITEM = 21 # set attribute +EVTGETITEM = 22 # get attribute +EVTADDITEM = 23 # add/create attribute +zones.shapes.plugin.add_event(EVTADDITEM, on_event_additem) +shapes = [[(0.0, 10.0), (10.0, 10.0), (10.0, 0.0)], + [(10.0, 20.0), (20.0, 20.0), (20.0, 10.0)], + [(20.0, 30.0), (30.0, 20.0), (30.0, 20.0)], + ] zones.add_rows(3, shapes=shapes) -odintervals = OdIntervalsTab('odintervals', parent = demand, info = 'OD data for different time intervals') -demand.odintervals = demand.get_attrsman().add( ObjConf(odintervals)) -odintervals.add_rows(2, t_start=[0,3600], t_end=[3600, 7200]) +odintervals = OdIntervalsTab( + 'odintervals', parent=demand, info='OD data for different time intervals') +demand.odintervals = demand.get_attrsman().add(ObjConf(odintervals)) +odintervals.add_rows(2, t_start=[0, 3600], t_end=[3600, 7200]) for id_odmodes in odintervals.get_ids(): - odmodes = OdModesTab( (odintervals.odmodes.attrname, id_odmodes), parent = odintervals) + odmodes = OdModesTab((odintervals.odmodes.attrname, + id_odmodes), parent=odintervals) odintervals.odmodes[id_odmodes] = odmodes - + odmodes.add_rows(2) for id_odtrips in odmodes.get_ids(): - odtrips = OdTripsTab( (odmodes.odtrips.attrname, id_odtrips) , odmodes, zones ) - odtrips.add_rows(3, ids_orig=[3,2,1],ids_dest=[3,3,3], tripnumbers = [10,200,555]) + odtrips = OdTripsTab( + (odmodes.odtrips.attrname, id_odtrips), odmodes, zones) + odtrips.add_rows(3, ids_orig=[3, 2, 1], ids_dest=[ + 3, 3, 3], tripnumbers=[10, 200, 555]) odmodes.odtrips[id_odtrips] = odtrips - -#demand.attrsman.print_attrs() -#odintervals.print_attrs() -#------------------------------------------------------------------------------- +# demand.attrsman.print_attrs() +# odintervals.print_attrs() + +#------------------------------------------------------------------------- -#vertices = [ [0.0,10.0,10.0,10.0,10.0,0.0], +# vertices = [ [0.0,10.0,10.0,10.0,10.0,0.0], # [10.0,20.0,20.0,20.0,20.0,10.0], # [20.0,30.0,30.0,20.0,30.0,20.0], # ] - -#vertices = [ [(0.0,10.0),(10.0,10.0)], + +# vertices = [ [(0.0,10.0),(10.0,10.0)], # [(10.0,20.0),(20.0,20.0)], # [(20.0,30.0),(30.0,20.0)], # ] vertices = [ - [[0.0,0.0,0.0],[0.2,0.0,0.0]],# 0 - [[0.3,0.0,0.0],[0.9,0.0,0.0]],# 1 - [[0.5,0.0,0.1],[1.9,0.0,0.0]],# 2 - ] + [[0.0, 0.0, 0.0], [0.2, 0.0, 0.0]], # 0 + [[0.3, 0.0, 0.0], [0.9, 0.0, 0.0]], # 1 + [[0.5, 0.0, 0.1], [1.9, 0.0, 0.0]], # 2 +] polygons = [ - np.array([[0.0,0.0,0.0],[0.2,0.0,0.0],[0.2,0.0,0.1],[0.3,0.3,0.3]]),# 0 - np.array([[0.3,0.0,0.0],[0.9,0.0,0.0]]),# 1 - np.array([[0.5,0.0,0.1],[1.9,0.0,0.0],[0.2,0.2,0.2]]),# 2 - ] -ids_sumo=['aa10','bb22','cc333'] -#lines.add_rows(3) + np.array([[0.0, 0.0, 0.0], [0.2, 0.0, 0.0], [ + 0.2, 0.0, 0.1], [0.3, 0.3, 0.3]]), # 0 + np.array([[0.3, 0.0, 0.0], [0.9, 0.0, 0.0]]), # 1 + np.array([[0.5, 0.0, 0.1], [1.9, 0.0, 0.0], [0.2, 0.2, 0.2]]), # 2 +] +ids_sumo = ['aa10', 'bb22', 'cc333'] +# lines.add_rows(3) drawing = BaseObjman('drawing') - -lines = Lines('lines', parent = drawing) -drawing.lines = drawing.get_attrsman().add( ObjConf( lines) ) + +lines = Lines('lines', parent=drawing) +drawing.lines = drawing.get_attrsman().add(ObjConf(lines)) lines.add_rows(3, vertices=vertices, polygons=polygons, ids_sumo=ids_sumo) - -triangles = Lines('triangles', parent = drawing) -drawing.triangles = drawing.get_attrsman().add( ObjConf( triangles) ) -triangles.add_rows(3, vertices=2*vertices, polygons=polygons, ids_sumo=['xxx10','xx22','xx333']) - -selection = Selection('selection',parent = drawing) -drawing.selection = drawing.get_attrsman().add( ObjConf( selection) ) -selection.add_rows(2,obj_ids = [(lines,2),(triangles,1)]) - -collections = Collection('collections',parent = drawing) -drawing.collections = drawing.get_attrsman().add( ObjConf( collections) ) -collections.add_rows(2,tab_id_lists = [ [(lines,2),(triangles,1)], - [(lines,2),(triangles,1),(lines,1)] ] - ) -#------------------------------------------------------------------------------- +triangles = Lines('triangles', parent=drawing) +drawing.triangles = drawing.get_attrsman().add(ObjConf(triangles)) +triangles.add_rows(3, vertices=2 * vertices, polygons=polygons, + ids_sumo=['xxx10', 'xx22', 'xx333']) + +selection = Selection('selection', parent=drawing) +drawing.selection = drawing.get_attrsman().add(ObjConf(selection)) +selection.add_rows(2, obj_ids=[(lines, 2), (triangles, 1)]) + +collections = Collection('collections', parent=drawing) +drawing.collections = drawing.get_attrsman().add(ObjConf(collections)) +collections.add_rows(2, tab_id_lists=[[(lines, 2), (triangles, 1)], + [(lines, 2), (triangles, 1), (lines, 1)]] + ) + +#------------------------------------------------------------------------- pointvertices = [ - [0.0,0.0,0.0], - [0.2,0.0,0.0], - [0.3,0.5,0.0], - [0.2,0.5,0.0], - [0.0,0.5,0.1], - [-1.5,-0.5,0.0], - ] - + [0.0, 0.0, 0.0], + [0.2, 0.0, 0.0], + [0.3, 0.5, 0.0], + [0.2, 0.5, 0.0], + [0.0, 0.5, 0.1], + [-1.5, -0.5, 0.0], +] + pointvertices2 = [ - [0.0,0.3,0.0], - [0.2,0.3,0.0], - [0.3,0.8,0.0], - [0.2,0.8,0.0], - [0.0,0.8,0.1], - [-1.5,-0.8,0.0], - ] + [0.0, 0.3, 0.0], + [0.2, 0.3, 0.0], + [0.3, 0.8, 0.0], + [0.2, 0.8, 0.0], + [0.0, 0.8, 0.1], + [-1.5, -0.8, 0.0], +] pointvertices3 = [ - [0.5,0.3,0.0], - [-1.5,-0.8,0.0], - ] - + [0.5, 0.3, 0.0], + [-1.5, -0.8, 0.0], +] + polylines = Polylines() polylines.draw(pointvertices, 'aa10&1') -polylines.draw(pointvertices2,'bb2210&1') -polylines.draw(pointvertices3,'5b2310&1') +polylines.draw(pointvertices2, 'bb2210&1') +polylines.draw(pointvertices3, '5b2310&1') polylines.print_attrs() xm.write_obj_to_xml(polylines, 'test_polylines.xml') - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/test_classman_misc.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/test_classman_misc.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/test_classman_misc.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/test_classman_misc.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,9 +1,9 @@ - + from classman import * c = ColConf('streetname', 'xxx', - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Street name', - info = 'Name of the street', - ) \ No newline at end of file + groupnames=['state'], + perm='rw', + is_save=True, + name='Street name', + info='Name of the street', + ) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/test_classman_save.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/test_classman_save.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/test_classman_save.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/test_classman_save.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,5 +1,5 @@ #from classman import * - + from test_classman_classes import * from arrayman import * import xmlman as xm @@ -7,749 +7,744 @@ is_all = 0 -if 0|is_all: +if 0 | is_all: class Lines(ArrayObjman): - - def __init__(self,ident, parent=None, xmltag = ('lines','line','ids_sumo'), **kwargs): - - self._init_objman(ident,parent=parent, is_plugin = True, xmltag = xmltag, **kwargs) - - self.add(AttrConf( 'offset', 0.0, - groupnames = ['state'], - perm='r', - is_save = True, - unit = 'm', - metatype = 'length', - is_plugin = False, - name = 'offset', - info = 'Test offset position', - #xmltag = 'offset', - )) - - self.add_col(ArrayConf( 'vertices', np.zeros((2,3), float), - groupnames = ['internal'], - perm='rw', - name = 'Vertex', - is_save = True, - is_plugin = True, - info = 'Vertex coordinate vectors of points. with format [[[x11,y11,z11],[x12,y12,z12]],[[x21,y21,z21],[x22,y22,z122]],...]', - xmltag = 'vertices', - )) - - self.add_col(ArrayConf( 'polygons', None, - dtype = 'object', - groupnames = ['landuse'], - perm='rw', - name = 'Polygon', - info = 'Polygons [[ (x11,y11,z11), (x12,y12,z13), (x13, y13,z13),...],[...]]', - xmltag = 'shapes', - )) - - self.add_col(ArrayConf( 'ids_sumo', None, - dtype = 'object', - is_index = True, - perm='rw', - name = 'Polygon', - info = 'Polygons [[ (x11,y11,z11), (x12,y12,z13), (x13, y13,z13),...],[...]]', - xmltag = 'id_geom', - )) - - - + + def __init__(self, ident, parent=None, xmltag=('lines', 'line', 'ids_sumo'), **kwargs): + + self._init_objman(ident, parent=parent, + is_plugin=True, xmltag=xmltag, **kwargs) + + self.add(AttrConf('offset', 0.0, + groupnames=['state'], + perm='r', + is_save=True, + unit='m', + metatype='length', + is_plugin=False, + name='offset', + info='Test offset position', + #xmltag = 'offset', + )) + + self.add_col(ArrayConf('vertices', np.zeros((2, 3), float), + groupnames=['internal'], + perm='rw', + name='Vertex', + is_save=True, + is_plugin=True, + info='Vertex coordinate vectors of points. with format [[[x11,y11,z11],[x12,y12,z12]],[[x21,y21,z21],[x22,y22,z122]],...]', + xmltag='vertices', + )) + + self.add_col(ArrayConf('polygons', None, + dtype='object', + groupnames=['landuse'], + perm='rw', + name='Polygon', + info='Polygons [[ (x11,y11,z11), (x12,y12,z13), (x13, y13,z13),...],[...]]', + xmltag='shapes', + )) + + self.add_col(ArrayConf('ids_sumo', None, + dtype='object', + is_index=True, + perm='rw', + name='Polygon', + info='Polygons [[ (x11,y11,z11), (x12,y12,z13), (x13, y13,z13),...],[...]]', + xmltag='id_geom', + )) + ########################################################################### - ## Instance creation - + # Instance creation + lines = Lines('lines') - #vertices = [ [0.0,10.0,10.0,10.0,10.0,0.0], + # vertices = [ [0.0,10.0,10.0,10.0,10.0,0.0], # [10.0,20.0,20.0,20.0,20.0,10.0], # [20.0,30.0,30.0,20.0,30.0,20.0], # ] - - #vertices = [ [(0.0,10.0),(10.0,10.0)], + + # vertices = [ [(0.0,10.0),(10.0,10.0)], # [(10.0,20.0),(20.0,20.0)], # [(20.0,30.0),(30.0,20.0)], # ] vertices = [ - [[0.0,0.0,0.0],[0.2,0.0,0.0]],# 0 - [[0.3,0.0,0.0],[0.9,0.0,0.0]],# 1 - [[0.5,0.0,0.1],[1.9,0.0,0.0]],# 2 - ] + [[0.0, 0.0, 0.0], [0.2, 0.0, 0.0]], # 0 + [[0.3, 0.0, 0.0], [0.9, 0.0, 0.0]], # 1 + [[0.5, 0.0, 0.1], [1.9, 0.0, 0.0]], # 2 + ] polygons = [ - np.array([[0.0,0.0,0.0],[0.2,0.0,0.0],[0.2,0.0,0.1],[0.3,0.3,0.3]]),# 0 - np.array([[0.3,0.0,0.0],[0.9,0.0,0.0]]),# 1 - np.array([[0.5,0.0,0.1],[1.9,0.0,0.0],[0.2,0.2,0.2]]),# 2 - ] - ids_sumo=['aa10','bb22','cc333'] - #lines.add_rows(3) + np.array([[0.0, 0.0, 0.0], [0.2, 0.0, 0.0], [ + 0.2, 0.0, 0.1], [0.3, 0.3, 0.3]]), # 0 + np.array([[0.3, 0.0, 0.0], [0.9, 0.0, 0.0]]), # 1 + np.array([[0.5, 0.0, 0.1], [1.9, 0.0, 0.0], [0.2, 0.2, 0.2]]), # 2 + ] + ids_sumo = ['aa10', 'bb22', 'cc333'] + # lines.add_rows(3) lines.add_rows(3, vertices=vertices, polygons=polygons, ids_sumo=ids_sumo) lines.print_attrs() - + xm.write_obj_to_xml(lines, 'test_lines.xml') - - ## save/load - save_obj(lines,'test_lines.obj') + + # save/load + save_obj(lines, 'test_lines.obj') del lines - print '\nreload'+60*'.' + print '\nreload' + 60 * '.' lines = load_obj('test_lines.obj') lines.print_attrs() - print 'direct access vertex=\n', lines.vertices.value + print 'direct access vertex=\n', lines.vertices.value print 'direct access polygons=\n', lines.polygons.value - print 'id for index bb22=',lines.ids_sumo.get_id_from_index('bb22') - print 'ids for index bb22,cc333=',lines.ids_sumo.get_ids_from_indices(['bb22','cc333']) + print 'id for index bb22=', lines.ids_sumo.get_id_from_index('bb22') + print 'ids for index bb22,cc333=', lines.ids_sumo.get_ids_from_indices(['bb22', 'cc333']) lines.del_row(2) lines.print_attrs() - print 'id for index bb22=',lines.ids_sumo.get_id_from_index('cc333') - -if 0|is_all: + print 'id for index bb22=', lines.ids_sumo.get_id_from_index('cc333') + +if 0 | is_all: class Lines(ArrayObjman): - - def __init__(self,ident, parent=None, **kwargs): - - self._init_objman(ident,parent=parent, **kwargs) - - - self.add_col(ArrayConf( 'vertices', np.zeros((2,3), float), - groupnames = ['internal'], - perm='rw', - name = 'Vertex', - is_save = True, - info = 'Vertex coordinate vectors of points. with format [[[x11,y11,z11],[x12,y12,z12]],[[x21,y21,z21],[x22,y22,z122]],...]', - )) - - self.add_col(ArrayConf( 'polygons', None, - dtype = 'object', - groupnames = ['landuse'], - perm='rw', - name = 'Polygon', - info = 'Polygons [[ (x11,y11,z11), (x12,y12,z13), (x13, y13,z13),...],[...]]', - )) - - - - - + + def __init__(self, ident, parent=None, **kwargs): + + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(ArrayConf('vertices', np.zeros((2, 3), float), + groupnames=['internal'], + perm='rw', + name='Vertex', + is_save=True, + info='Vertex coordinate vectors of points. with format [[[x11,y11,z11],[x12,y12,z12]],[[x21,y21,z21],[x22,y22,z122]],...]', + )) + + self.add_col(ArrayConf('polygons', None, + dtype='object', + groupnames=['landuse'], + perm='rw', + name='Polygon', + info='Polygons [[ (x11,y11,z11), (x12,y12,z13), (x13, y13,z13),...],[...]]', + )) + ########################################################################### - ## Instance creation - + # Instance creation + lines = Lines('lines') - #vertices = [ [0.0,10.0,10.0,10.0,10.0,0.0], + # vertices = [ [0.0,10.0,10.0,10.0,10.0,0.0], # [10.0,20.0,20.0,20.0,20.0,10.0], # [20.0,30.0,30.0,20.0,30.0,20.0], # ] - - #vertices = [ [(0.0,10.0),(10.0,10.0)], + + # vertices = [ [(0.0,10.0),(10.0,10.0)], # [(10.0,20.0),(20.0,20.0)], # [(20.0,30.0),(30.0,20.0)], # ] vertices = [ - [[0.0,0.0,0.0],[0.2,0.0,0.0]],# 0 - [[0.3,0.0,0.0],[0.9,0.0,0.0]],# 1 - [[0.5,0.0,0.1],[1.9,0.0,0.0]],# 2 - ] + [[0.0, 0.0, 0.0], [0.2, 0.0, 0.0]], # 0 + [[0.3, 0.0, 0.0], [0.9, 0.0, 0.0]], # 1 + [[0.5, 0.0, 0.1], [1.9, 0.0, 0.0]], # 2 + ] polygons = [ - np.array([[0.0,0.0,0.0],[0.2,0.0,0.0],[0.2,0.0,0.1],[0.3,0.3,0.3]]),# 0 - np.array([[0.3,0.0,0.0],[0.9,0.0,0.0]]),# 1 - np.array([[0.5,0.0,0.1],[1.9,0.0,0.0],[0.2,0.2,0.2]]),# 2 - ] - #lines.add_rows(3) + np.array([[0.0, 0.0, 0.0], [0.2, 0.0, 0.0], [ + 0.2, 0.0, 0.1], [0.3, 0.3, 0.3]]), # 0 + np.array([[0.3, 0.0, 0.0], [0.9, 0.0, 0.0]]), # 1 + np.array([[0.5, 0.0, 0.1], [1.9, 0.0, 0.0], [0.2, 0.2, 0.2]]), # 2 + ] + # lines.add_rows(3) lines.add_rows(3, vertices=vertices, polygons=polygons) lines.print_attrs() - print 'direct access vertex=\n', lines.vertices.value - print 'direct access polygons=\n', lines.polygons.value - - ## save/load - save_obj(lines,'test_lines.obj') + print 'direct access vertex=\n', lines.vertices.value + print 'direct access polygons=\n', lines.polygons.value + + # save/load + save_obj(lines, 'test_lines.obj') del lines - print '\nreload'+60*'.' + print '\nreload' + 60 * '.' lines = load_obj('test_lines.obj') - - ## print + + # print lines.print_attrs() - print 'direct access vertex=\n', lines.vertices.value - print 'direct access polygons=\n', lines.polygons.value - + print 'direct access vertex=\n', lines.vertices.value + print 'direct access polygons=\n', lines.polygons.value + vertices2 = [ - [[0.0,0.0,0.0],[0.2,0.0,0.0]],# 0 - [[0.3,0.0,0.0],[0.9,0.0,0.0]],# 1 - [[0.5,0.0,0.1],[1.9,0.0,0.0]],# 2 - ] + [[0.0, 0.0, 0.0], [0.2, 0.0, 0.0]], # 0 + [[0.3, 0.0, 0.0], [0.9, 0.0, 0.0]], # 1 + [[0.5, 0.0, 0.1], [1.9, 0.0, 0.0]], # 2 + ] polygons2 = [ - np.array([[0.0,0.0,0.0],[0.2,0.0,0.0],[0.2,0.0,0.1],[0.3,0.3,0.3]]),# 0 - np.array([[0.3,0.0,0.0],[0.9,0.0,0.0]]),# 1 - np.array([[0.5,0.0,0.1],[1.9,0.0,0.0],[0.2,0.2,0.2]]),# 2 - ] - lines.add_rows(3, vertices=vertices2, polygons=polygons2) + np.array([[0.0, 0.0, 0.0], [0.2, 0.0, 0.0], [ + 0.2, 0.0, 0.1], [0.3, 0.3, 0.3]]), # 0 + np.array([[0.3, 0.0, 0.0], [0.9, 0.0, 0.0]]), # 1 + np.array([[0.5, 0.0, 0.1], [1.9, 0.0, 0.0], [0.2, 0.2, 0.2]]), # 2 + ] + lines.add_rows(3, vertices=vertices2, polygons=polygons2) lines.print_attrs() - -if 0|is_all: + +if 0 | is_all: class ZonesTab(ArrayObjman): - def __init__(self,ident, parent=None, **kwargs): - self._init_objman(ident, parent=parent, xmltag = ('taz','district','zonenames'), **kwargs) - - self.add_col(ArrayConf( 'zonenames', None, - dtype = 'object', - is_index = True, - perm='rw', - name = 'Zone names', - info = 'Name of zone', - xmltag = 'zone', - )) - - self.add_col(ColConf( 'shapes', [], - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Shape', - info = 'Shape of zone which is a list of (x,y) coordinates', - xmltag = 'shape' - )) - - - + + def __init__(self, ident, parent=None, **kwargs): + self._init_objman(ident, parent=parent, xmltag=( + 'taz', 'district', 'zonenames'), **kwargs) + + self.add_col(ArrayConf('zonenames', None, + dtype='object', + is_index=True, + perm='rw', + name='Zone names', + info='Name of zone', + xmltag='zone', + )) + + self.add_col(ColConf('shapes', [], + groupnames=['state'], + perm='rw', + is_save=True, + name='Shape', + info='Shape of zone which is a list of (x,y) coordinates', + xmltag='shape' + )) + class OdTripsTab(ArrayObjman): - def __init__(self,ident, parent, zones, **kwargs): - self._init_objman(ident, parent=parent,xmltag = ('odtrips','odtrip',None), **kwargs) - - self.add_col(IdsConf( 'ids_orig', zones, is_child = False, - groupnames = ['state'], - is_save = True, - name = 'ID Orig', - info = 'ID of traffic assignment zone of origin of trip.', - xmltag = 'id_orig', - )) - - - self.add_col(IdsConf( 'ids_dest', zones, is_child = False, - groupnames = ['state'], - is_save = True, - name = 'ID Dest', - info = 'ID of traffic assignment zone of destination of trip.', - xmltag = 'id_dest', - )) - - self.add_col(ColConf( 'tripnumbers', 0, - groupnames = ['state'], - perm = 'rw', - is_save = True, - name = 'Trip number', - info = 'Number of trips from zone with ID Orig to zone with ID Dest.', - xmltag = 'tripnumber', - )) - + + def __init__(self, ident, parent, zones, **kwargs): + self._init_objman(ident, parent=parent, xmltag=( + 'odtrips', 'odtrip', None), **kwargs) + + self.add_col(IdsConf('ids_orig', zones, is_child=False, + groupnames=['state'], + is_save=True, + name='ID Orig', + info='ID of traffic assignment zone of origin of trip.', + xmltag='id_orig', + )) + + self.add_col(IdsConf('ids_dest', zones, is_child=False, + groupnames=['state'], + is_save=True, + name='ID Dest', + info='ID of traffic assignment zone of destination of trip.', + xmltag='id_dest', + )) + + self.add_col(ColConf('tripnumbers', 0, + groupnames=['state'], + perm='rw', + is_save=True, + name='Trip number', + info='Number of trips from zone with ID Orig to zone with ID Dest.', + xmltag='tripnumber', + )) + class OdModesTab(ArrayObjman): - def __init__(self,ident, parent=None, **kwargs): - self._init_objman(ident,parent=parent,xmltag = ('odmodes','odmode','modes'), **kwargs) - - self.add_col(ArrayConf( 'modes', None, - dtype = 'object', - is_index = True, - perm='rw', - name = 'Mode', - info = 'Mode of transport', - xmltag = 'mode', - )) - self.add_col(ObjsConf( 'odtrips', - groupnames = ['state'], - is_save = True, - name = 'OD matrix', - info = 'Matrix with trips from origin to destintion', - )) - - + + def __init__(self, ident, parent=None, **kwargs): + self._init_objman(ident, parent=parent, xmltag=( + 'odmodes', 'odmode', 'modes'), **kwargs) + + self.add_col(ArrayConf('modes', None, + dtype='object', + is_index=True, + perm='rw', + name='Mode', + info='Mode of transport', + xmltag='mode', + )) + self.add_col(ObjsConf('odtrips', + groupnames=['state'], + is_save=True, + name='OD matrix', + info='Matrix with trips from origin to destintion', + )) + class OdIntervalsTab(ArrayObjman): - def __init__(self,ident, parent=None, **kwargs): - self._init_objman(ident,parent=parent,xmltag = ('odintervals','odinteval',None), **kwargs) - - self.add_col(ColConf( 't_start', 0.0, - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Start time', - unit = 's', - info = 'Start time of interval', - xmltag = 't_start', - )) - - self.add_col(ColConf( 't_end', 3600.0, - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'End time', - unit = 's', - info = 'End time of interval', - xmltag = 't_end', - )) - - self.add_col(ObjsConf( 'odmodes', - groupnames = ['state'], - is_save = True, - name = 'Modes', - info = 'Transport mode', - )) - + + def __init__(self, ident, parent=None, **kwargs): + self._init_objman(ident, parent=parent, xmltag=( + 'odintervals', 'odinteval', None), **kwargs) + + self.add_col(ColConf('t_start', 0.0, + groupnames=['state'], + perm='rw', + is_save=True, + name='Start time', + unit='s', + info='Start time of interval', + xmltag='t_start', + )) + + self.add_col(ColConf('t_end', 3600.0, + groupnames=['state'], + perm='rw', + is_save=True, + name='End time', + unit='s', + info='End time of interval', + xmltag='t_end', + )) + + self.add_col(ObjsConf('odmodes', + groupnames=['state'], + is_save=True, + name='Modes', + info='Transport mode', + )) + ########################################################################### - ## Instance creation - - demand = BaseObjman('demand', xmltag = 'demand') - - zones = ZonesTab('zones', parent = demand ) - demand.zones = demand.get_attrsman().add( ObjConf(zones) ) - shapes = [ [(0.0,10.0),(10.0,10.0),(10.0,0.0)], - [(10.0,20.0),(20.0,20.0),(20.0,10.0)], - [(20.0,30.0),(30.0,20.0),(30.0,20.0)], - ] - zones.add_rows(3, shapes=shapes, zonenames = ['center','periphery','residential']) - - odintervals = OdIntervalsTab('odintervals', parent = demand, info = 'OD data for different time intervals') - demand.odintervals = demand.get_attrsman().add( ObjConf(odintervals)) - odintervals.add_rows(2, t_start=[0,3601], t_end=[3600, 7200]) + # Instance creation + + demand = BaseObjman('demand', xmltag='demand') + + zones = ZonesTab('zones', parent=demand) + demand.zones = demand.get_attrsman().add(ObjConf(zones)) + shapes = [[(0.0, 10.0), (10.0, 10.0), (10.0, 0.0)], + [(10.0, 20.0), (20.0, 20.0), (20.0, 10.0)], + [(20.0, 30.0), (30.0, 20.0), (30.0, 20.0)], + ] + zones.add_rows(3, shapes=shapes, zonenames=[ + 'center', 'periphery', 'residential']) + + odintervals = OdIntervalsTab( + 'odintervals', parent=demand, info='OD data for different time intervals') + demand.odintervals = demand.get_attrsman().add(ObjConf(odintervals)) + odintervals.add_rows(2, t_start=[0, 3601], t_end=[3600, 7200]) for id_odmodes in odintervals.get_ids(): - odmodes = OdModesTab( (odintervals.odmodes.attrname, id_odmodes), parent = odintervals) + odmodes = OdModesTab( + (odintervals.odmodes.attrname, id_odmodes), parent=odintervals) odintervals.odmodes[id_odmodes] = odmodes - - odmodes.add_rows(2,modes = ['bus','train']) + + odmodes.add_rows(2, modes=['bus', 'train']) for id_odtrips in odmodes.get_ids(): - odtrips = OdTripsTab( (odmodes.odtrips.attrname, id_odtrips) , odmodes, zones ) - odtrips.add_rows(3, ids_orig=[3,2,1],ids_dest=[3,3,3], tripnumbers = [10,200,555]) + odtrips = OdTripsTab( + (odmodes.odtrips.attrname, id_odtrips), odmodes, zones) + odtrips.add_rows(3, ids_orig=[3, 2, 1], ids_dest=[ + 3, 3, 3], tripnumbers=[10, 200, 555]) odmodes.odtrips[id_odtrips] = odtrips - - ## print - demand.get_attrsman().print_attrs() - odintervals.print_attrs() - for id_odmodes in odintervals.get_ids(): + + # print + demand.get_attrsman().print_attrs() + odintervals.print_attrs() + for id_odmodes in odintervals.get_ids(): print '\nMODE:' odintervals.odmodes[id_odmodes].print_attrs() print '\nTRIPS:' for id_odtrips in odmodes.get_ids(): odmodes.odtrips[id_odtrips].print_attrs() - + xm.write_obj_to_xml(demand, 'test_demand.xml') - ## save/load - save_obj(demand,'test_demand_array.obj') + # save/load + save_obj(demand, 'test_demand_array.obj') del demand - print '\nreload'+60*'.' + print '\nreload' + 60 * '.' demand = load_obj('test_demand_array.obj') - - ## print - demand.get_attrsman().print_attrs() - odintervals.print_attrs() - for id_odmodes in odintervals.get_ids(): + + # print + demand.get_attrsman().print_attrs() + odintervals.print_attrs() + for id_odmodes in odintervals.get_ids(): print '\nMODE:' odintervals.odmodes[id_odmodes].print_attrs() print '\nTRIPS:' for id_odtrips in odmodes.get_ids(): odmodes.odtrips[id_odtrips].print_attrs() - -if 0|is_all: # OLD BROKEN??!! + +if 0 | is_all: # OLD BROKEN??!! class ZonesTab(TableObjman): - def __init__(self,ident, parent=None, **kwargs): - self._init_objman(ident,parent=parent, **kwargs) - - - self.add_col(ColConf( 'shapes', [], - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Shape', - info = 'Shape of zone which is a list of (x,y) coordinates', - )) - - - + + def __init__(self, ident, parent=None, **kwargs): + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(ColConf('shapes', [], + groupnames=['state'], + perm='rw', + is_save=True, + name='Shape', + info='Shape of zone which is a list of (x,y) coordinates', + )) + class OdTripsTab(TableObjman): - def __init__(self,ident, parent, zones, **kwargs): - self._init_objman(ident, parent=parent, **kwargs) - - self.add_col(IdsConf( 'ids_orig', zones, is_child = False, - groupnames = ['state'], - is_save = True, - name = 'ID Orig', - info = 'ID of traffic assignment zone of origin of trip.', - )) - - - self.add_col(IdsConf( 'ids_dest', zones, is_child = False, - groupnames = ['state'], - is_save = True, - name = 'ID Dest', - info = 'ID of traffic assignment zone of destination of trip.', - )) - - self.add_col(ColConf( 'tripnumbers', 0, - groupnames = ['state'], - perm = 'rw', - is_save = True, - name = 'Trip number', - info = 'Number of trips from zone with ID Orig to zone with ID Dest.', - )) - + + def __init__(self, ident, parent, zones, **kwargs): + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(IdsConf('ids_orig', zones, is_child=False, + groupnames=['state'], + is_save=True, + name='ID Orig', + info='ID of traffic assignment zone of origin of trip.', + )) + + self.add_col(IdsConf('ids_dest', zones, is_child=False, + groupnames=['state'], + is_save=True, + name='ID Dest', + info='ID of traffic assignment zone of destination of trip.', + )) + + self.add_col(ColConf('tripnumbers', 0, + groupnames=['state'], + perm='rw', + is_save=True, + name='Trip number', + info='Number of trips from zone with ID Orig to zone with ID Dest.', + )) + class OdModesTab(TableObjman): - def __init__(self,ident, parent=None, **kwargs): - self._init_objman(ident,parent=parent, **kwargs) - - - self.add_col(ObjsConf( 'odtrips', - groupnames = ['state'], - is_save = True, - name = 'OD matrix', - info = 'Matrix with trips from origin to destintion', - )) - - + + def __init__(self, ident, parent=None, **kwargs): + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(ObjsConf('odtrips', + groupnames=['state'], + is_save=True, + name='OD matrix', + info='Matrix with trips from origin to destintion', + )) + class OdIntervalsTab(TableObjman): - def __init__(self,ident, parent=None, **kwargs): - self._init_objman(ident,parent=parent, **kwargs) - - self.add_col(ColConf( 't_start', 0.0, - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Start time', - unit = 's', - info = 'Start time of interval', - )) - - self.add_col(ColConf( 't_end', 3600.0, - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'End time', - unit = 's', - info = 'End time of interval', - )) - - self.add_col(ObjsConf( 'odmodes', - groupnames = ['state'], - is_save = True, - name = 'Modes', - info = 'Transport mode', - )) - + + def __init__(self, ident, parent=None, **kwargs): + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(ColConf('t_start', 0.0, + groupnames=['state'], + perm='rw', + is_save=True, + name='Start time', + unit='s', + info='Start time of interval', + )) + + self.add_col(ColConf('t_end', 3600.0, + groupnames=['state'], + perm='rw', + is_save=True, + name='End time', + unit='s', + info='End time of interval', + )) + + self.add_col(ObjsConf('odmodes', + groupnames=['state'], + is_save=True, + name='Modes', + info='Transport mode', + )) + ########################################################################### - ## Instance creation - + # Instance creation + demand = BaseObjman('demand') - - zones = ZonesTab('zones', parent = demand ) - demand.zones = demand.get_attrsman().add( ObjConf( zones) ) - shapes = [ [(0.0,10.0),(10.0,10.0),(10.0,0.0)], - [(10.0,20.0),(20.0,20.0),(20.0,10.0)], - [(20.0,30.0),(30.0,20.0),(30.0,20.0)], - ] + + zones = ZonesTab('zones', parent=demand) + demand.zones = demand.get_attrsman().add(ObjConf(zones)) + shapes = [[(0.0, 10.0), (10.0, 10.0), (10.0, 0.0)], + [(10.0, 20.0), (20.0, 20.0), (20.0, 10.0)], + [(20.0, 30.0), (30.0, 20.0), (30.0, 20.0)], + ] zones.add_rows(3, shapes=shapes) - - odintervals = OdIntervalsTab('odintervals', parent = demand, info = 'OD data for different time intervals') - demand.odintervals = demand.get_attrsman().add( ObjConf(odintervals, is_child = True)) - odintervals.add_rows(2, t_start=[0,3600], t_end=[3600, 7200]) + + odintervals = OdIntervalsTab( + 'odintervals', parent=demand, info='OD data for different time intervals') + demand.odintervals = demand.get_attrsman().add( + ObjConf(odintervals, is_child=True)) + odintervals.add_rows(2, t_start=[0, 3600], t_end=[3600, 7200]) for id_odmodes in odintervals.get_ids(): - odmodes = OdModesTab( (odintervals.odmodes.attrname, id_odmodes), parent = odintervals) + odmodes = OdModesTab( + (odintervals.odmodes.attrname, id_odmodes), parent=odintervals) odintervals.odmodes[id_odmodes] = odmodes - + odmodes.add_rows(2) for id_odtrips in odmodes.get_ids(): - odtrips = OdTripsTab( (odmodes.odtrips.attrname, id_odtrips) , odmodes, zones ) - odtrips.add_rows(3, ids_orig=[3,2,1],ids_dest=[3,3,3], tripnumbers = [10,200,555]) + odtrips = OdTripsTab( + (odmodes.odtrips.attrname, id_odtrips), odmodes, zones) + odtrips.add_rows(3, ids_orig=[3, 2, 1], ids_dest=[ + 3, 3, 3], tripnumbers=[10, 200, 555]) odmodes.odtrips[id_odtrips] = odtrips - - ## print - demand.get_attrsman().print_attrs() - odintervals.print_attrs() - for id_odmodes in odintervals.get_ids(): + + # print + demand.get_attrsman().print_attrs() + odintervals.print_attrs() + for id_odmodes in odintervals.get_ids(): print '\nMODE:' odintervals.odmodes[id_odmodes].print_attrs() print '\nTRIPS:' for id_odtrips in odmodes.get_ids(): odmodes.odtrips[id_odtrips].print_attrs() - - - - ## save/load - save_obj(demand,'test_demand.obj') + + # save/load + save_obj(demand, 'test_demand.obj') del demand - print '\nreload'+60*'.' + print '\nreload' + 60 * '.' demand = load_obj('test_demand.obj') - - ## print - demand.get_attrsman().print_attrs() - odintervals.print_attrs() - for id_odmodes in odintervals.get_ids(): + + # print + demand.get_attrsman().print_attrs() + odintervals.print_attrs() + for id_odmodes in odintervals.get_ids(): print '\nMODE:' odintervals.odmodes[id_odmodes].print_attrs() print '\nTRIPS:' for id_odtrips in odmodes.get_ids(): odmodes.odtrips[id_odtrips].print_attrs() - -if 0|is_all: # OK + +if 0 | is_all: # OK net = BaseObjman('net') - + # TODO: could be put in 2 statements - edges = TableObjman('edges', parent = net, info = 'Network edges') - nodes = TableObjman('nodes', parent = net, info = 'Network nodes') - - net.edges = net.get_attrsman().add( ObjConf(edges, is_child = True)) - net.nodes = net.get_attrsman().add( ObjConf(nodes, is_child = True)) - - - net.edges.add(AttrConf( 'status', 'idle', - groupnames = ['state'], - is_save = True, - is_plugin = True, - name = 'Status', - info = 'System Status', - )) - - net.edges.add_col(IdsConf( 'ids_node_from', net.nodes, is_child = False, - groupnames = ['state'], - is_save = True, - #is_plugin = True, - name = 'ID from nodes', - info = 'ID from nodes', - )) - - - net.edges.add_col(IdsConf( 'ids_node_to', net.nodes, is_child = False, - groupnames = ['state'], - is_save = True, - name = 'ID to nodes', - info = 'ID to nodes', - )) - - - net.nodes.add_col(ColConf( 'coords', (0.0,0.0), - groupnames = ['state'], - perm='rw', - is_save = True, - is_plugin = True, - name = 'Coords', - info = 'Coordinates', - )) - - - net.nodes.add_rows( 4, - # 1 2 3 4 - coords = [(0.0,0.0),(1.0,0.0),(1.0,1.0),(0.0,1.0)], - ) - + edges = TableObjman('edges', parent=net, info='Network edges') + nodes = TableObjman('nodes', parent=net, info='Network nodes') + + net.edges = net.get_attrsman().add(ObjConf(edges, is_child=True)) + net.nodes = net.get_attrsman().add(ObjConf(nodes, is_child=True)) + + net.edges.add(AttrConf('status', 'idle', + groupnames=['state'], + is_save=True, + is_plugin=True, + name='Status', + info='System Status', + )) + + net.edges.add_col(IdsConf('ids_node_from', net.nodes, is_child=False, + groupnames=['state'], + is_save=True, + #is_plugin = True, + name='ID from nodes', + info='ID from nodes', + )) + + net.edges.add_col(IdsConf('ids_node_to', net.nodes, is_child=False, + groupnames=['state'], + is_save=True, + name='ID to nodes', + info='ID to nodes', + )) + + net.nodes.add_col(ColConf('coords', (0.0, 0.0), + groupnames=['state'], + perm='rw', + is_save=True, + is_plugin=True, + name='Coords', + info='Coordinates', + )) + + net.nodes.add_rows(4, + # 1 2 3 4 + coords=[(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 1.0)], + ) + net.edges.add_rows(2) - net.edges.ids_node_from[[1,2]]=[1,4] - net.edges.ids_node_to[[1,2]]=[3,2] + net.edges.ids_node_from[[1, 2]] = [1, 4] + net.edges.ids_node_to[[1, 2]] = [3, 2] net.get_attrsman().print_attrs() net.edges.print_attrs() net.nodes.print_attrs() - save_obj(net,'test_net.obj') + save_obj(net, 'test_net.obj') del net - print '\nreload'+60*'.' + print '\nreload' + 60 * '.' net_new = load_obj('test_net.obj') net_new.get_attrsman().print_attrs() net_new.edges.print_attrs() net_new.nodes.print_attrs() - -if 0|is_all: + +if 0 | is_all: tab1 = TableObjman('simple_table') - - - tab1.add_col(ColConf( 'surname', 'xx', - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Family name', - info = 'Name of Family', - )) - - tab1.add_col(ColConf( 'streetname', 'via della...', - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Street name', - info = 'Name of the street', - )) - tab1.add_rows( 4, - surname = ['walt','greg','bob','duck'], - streetname=['a','bb','ccc','dddd'], - ) - - - - print 'direct access: tab1.surname.value',tab1.surname.value - print 'direct access: tab1.streetname.value',tab1.streetname.value + tab1.add_col(ColConf('surname', 'xx', + groupnames=['state'], + perm='rw', + is_save=True, + name='Family name', + info='Name of Family', + )) + + tab1.add_col(ColConf('streetname', 'via della...', + groupnames=['state'], + perm='rw', + is_save=True, + name='Street name', + info='Name of the street', + )) + tab1.add_rows(4, + surname=['walt', 'greg', 'bob', 'duck'], + streetname=['a', 'bb', 'ccc', 'dddd'], + ) + + print 'direct access: tab1.surname.value', tab1.surname.value + print 'direct access: tab1.streetname.value', tab1.streetname.value tab1.print_attrs() - - save_obj(tab1,'test_tab.obj') + + save_obj(tab1, 'test_tab.obj') del tab1 - print '\nreload'+60*'.' + print '\nreload' + 60 * '.' tab1_new = load_obj('test_tab.obj') tab1_new.print_attrs() - print 'direct access: tab1_new.surname.value',tab1_new.surname.value - print 'direct access: tab1_new.streetname.value',tab1_new.streetname.value -if 0|is_all: + print 'direct access: tab1_new.surname.value', tab1_new.surname.value + print 'direct access: tab1_new.streetname.value', tab1_new.streetname.value +if 0 | is_all: tab1 = TableObjman('tab1') - print '\ntab1.ident',tab1.ident - - tab2 = TableObjman('tab2', parent = tab1) - print '\ntab2.ident',tab2.ident - - + print '\ntab1.ident', tab1.ident + + tab2 = TableObjman('tab2', parent=tab1) + print '\ntab2.ident', tab2.ident + # TODO: seperate attrname from linked obj ident because restrictive and makes problems with multiple tab destinations # this should be possible ...following the path of attrnames of absident # - - tab1.add_col(IdsConf( tab2) ) - - tab2.add_col(IdsConf( tab1, is_child = False) ) - - tab2.add_col(ColConf( 'surname', 'xx', - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Family name', - info = 'Name of Family', - )) - - tab2.add_col(ColConf( 'streetname', 'via della...', - groupnames = ['state'], - perm='rw', - is_save = False, - name = 'Street name', - info = 'Name of the street', - )) - tab2.add_rows( 4, - surname = ['walt','greg','bob','duck'], - streetname=['a','bb','ccc','dddd'], - tab1 = [2,1,3,1,], - ) - - - + tab1.add_col(IdsConf(tab2)) + + tab2.add_col(IdsConf(tab1, is_child=False)) + + tab2.add_col(ColConf('surname', 'xx', + groupnames=['state'], + perm='rw', + is_save=True, + name='Family name', + info='Name of Family', + )) + + tab2.add_col(ColConf('streetname', 'via della...', + groupnames=['state'], + perm='rw', + is_save=False, + name='Street name', + info='Name of the street', + )) + tab2.add_rows(4, + surname=['walt', 'greg', 'bob', 'duck'], + streetname=['a', 'bb', 'ccc', 'dddd'], + tab1=[2, 1, 3, 1, ], + ) + tab2.print_attrs() - - tab1.add_rows( 3, - tab2 = [3,1,2], - ) - + + tab1.add_rows(3, + tab2=[3, 1, 2], + ) + tab1.print_attrs() - - save_obj(tab1,'test_tab.obj') + + save_obj(tab1, 'test_tab.obj') del tab1 - print '\nreload'+60*'.' + print '\nreload' + 60 * '.' tab1_new = load_obj('test_tab.obj') - + tab1_new.print_attrs() tab2_new = tab1_new.tab2.get_valueobj() tab2_new.print_attrs() print tab2_new.get_ident_abs() - -if False|is_all:#False:#True: + +if False | is_all: # False:#True: obj = TestTabman() - - print 'obj.ident',obj.ident - + + print 'obj.ident', obj.ident + obj.attrsman.print_attrs() - save_obj(obj,'test_obj.obj') + save_obj(obj, 'test_obj.obj') del obj - print '\nreload'+60*'.' + print '\nreload' + 60 * '.' obj_new = load_obj('test_obj.obj') obj_new.attrsman.print_attrs() - #streetname - #print 'This is the value of the attribute: obj.streetname=',obj.streetname - #print 'This is the configuration instance of the attribute x',obj.attrsman.x + # streetname + # print 'This is the value of the attribute: obj.streetname=',obj.streetname + # print 'This is the configuration instance of the attribute x',obj.attrsman.x # -if 0|is_all:#False:#True: ###!!!!!!!!!!!!!!!!check this : failed to reload!! +# False:#True: ###!!!!!!!!!!!!!!!!check this : failed to reload!! +if 0 | is_all: obj = TestTableObjMan() - - print 'obj.ident',obj.ident - - obj.x.set(1.0/3) - #obj.is_pos_ok.set(True) - + + print 'obj.ident', obj.ident + + obj.x.set(1.0 / 3) + # obj.is_pos_ok.set(True) + obj.print_attrs() - save_obj(obj,'test_obj.obj') + save_obj(obj, 'test_obj.obj') del obj - print '\nreload'+60*'.' + print '\nreload' + 60 * '.' obj_new = load_obj('test_obj.obj') - obj_new.x.set(2.0/3) + obj_new.x.set(2.0 / 3) obj_new.print_attrs() - - #streetname - #print 'This is the value of the attribute: obj.streetname=',obj.streetname - #print 'This is the configuration instance of the attribute x',obj.attrsman.x - # - -if 0|is_all: + + # streetname + # print 'This is the value of the attribute: obj.streetname=',obj.streetname + # print 'This is the configuration instance of the attribute x',obj.attrsman.x + # + +if 0 | is_all: print 'TestTableObjMan export' obj = TestTableObjMan() obj.get_attrsman().print_attrs() xm.write_obj_to_xml(obj, 'test_obj.xml') del obj - print '\nreload'+60*'.' + print '\nreload' + 60 * '.' obj_new = load_obj('test_obj.obj') obj_new.get_attrsman().print_attrs() - #sys.exit() - -if 0|is_all: + # sys.exit() + +if 0 | is_all: obj2 = TestClass2() - - + obj2.child1.get_attrsman().x.set(1.99) - + #obj3 = TestClass3(ident = 'testobj3', parent=obj2, name = 'Test Object3') obj2.get_attrsman().print_attrs() obj2.child1.get_attrsman().print_attrs() obj2.child3.get_attrsman().print_attrs() - save_obj(obj2,'test_obj2.obj') + save_obj(obj2, 'test_obj2.obj') xm.write_obj_to_xml(obj2, 'test_obj2.xml') del obj2 - print '\nreload'+60*'.' + print '\nreload' + 60 * '.' obj2_new = load_obj('test_obj2.obj') obj2_new.get_attrsman().print_attrs() - + obj2_new.child1.get_attrsman().print_attrs() obj2_new.child3.get_attrsman().print_attrs() - #sys.exit() + # sys.exit() -if 0|is_all:#False:#True: +if 0 | is_all: # False:#True: obj = TestClass() - print 'obj.ident',obj.ident - - print 'This is the value of the attribute: obj.x=',obj.x - #print 'This is the configuration instance of the attribute x',obj.attrsman.x + print 'obj.ident', obj.ident + + print 'This is the value of the attribute: obj.x=', obj.x + # print 'This is the configuration instance of the attribute + # x',obj.attrsman.x obj.get_attrsman().print_attrs() - #obj.get_attrsman().x.plugin.add_event(EVTSET,on_event_setattr) - #obj.get_attrsman().x.add_event(EVTGET,on_event_getattr) - #print 'obj.get_attrsman().get_groups()',obj.attrsman.get_groups() - #print 'obj.tab.get_groups()',obj.tab.get_groups() - - #print 'Test func...',obj.attrsman.testfunc.get() - #obj.get_attrsman().testfunc.add_event(EVTGET,on_event_getattr) - #obj.get_attrsman().testfunc.get() - print 'obj.get_attrsman().x.get()',obj.get_attrsman().x.get(),'is_modified',obj.is_modified() + # obj.get_attrsman().x.plugin.add_event(EVTSET,on_event_setattr) + # obj.get_attrsman().x.add_event(EVTGET,on_event_getattr) + # print 'obj.get_attrsman().get_groups()',obj.attrsman.get_groups() + # print 'obj.tab.get_groups()',obj.tab.get_groups() + + # print 'Test func...',obj.attrsman.testfunc.get() + # obj.get_attrsman().testfunc.add_event(EVTGET,on_event_getattr) + # obj.get_attrsman().testfunc.get() + print 'obj.get_attrsman().x.get()', obj.get_attrsman().x.get(), 'is_modified', obj.is_modified() obj.get_attrsman().x.set(1.0) - print 'obj.get_attrsman().x.get()',obj.get_attrsman().x.get(),'is_modified',obj.is_modified() - - #obj.attrsman.delete('x') + print 'obj.get_attrsman().x.get()', obj.get_attrsman().x.get(), 'is_modified', obj.is_modified() + + # obj.attrsman.delete('x') obj.get_attrsman().print_attrs() - save_obj(obj,'test_obj.obj') + save_obj(obj, 'test_obj.obj') xm.write_obj_to_xml(obj, 'test_obj.xml') del obj - print '\nreload'+60*'.' + print '\nreload' + 60 * '.' obj_new = load_obj('test_obj.obj') obj_new.get_attrsman().print_attrs() - #print 'obj.get_attrsman().x.get_formatted()=',obj.get_attrsman().x.get_formatted() - #print 'obj.x',obj.x + # print 'obj.get_attrsman().x.get_formatted()=',obj.get_attrsman().x.get_formatted() + # print 'obj.x',obj.x -if 1|is_all: - save_obj(drawing,'test_drawing.obj') - print '\nreload'+60*'.' +if 1 | is_all: + save_obj(drawing, 'test_drawing.obj') + print '\nreload' + 60 * '.' obj_new = load_obj('test_drawing.obj') obj_new.get_attrsman().print_attrs() - + obj_new.collections.print_attrs() - + tab_check, ids_check = obj_new.collections.tab_id_lists[1][1] print ' check tab, ids=', tab_check, ids_check tab_check.print_attrs() - - \ No newline at end of file diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/test_classman_tables.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/test_classman_tables.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/test_classman_tables.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/test_classman_tables.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,568 +1,557 @@ #from classman import * - + from test_classman_classes import * from classman import * from arrayman import * is_all = 0 -if 1|is_all: +if 1 | is_all: pass -if 1|is_all: +if 1 | is_all: print 'Lines, Poly example' - + ########################################################################### - ## Instance creation - + # Instance creation + lines = Lines('lines') - #vertices = [ [0.0,10.0,10.0,10.0,10.0,0.0], + # vertices = [ [0.0,10.0,10.0,10.0,10.0,0.0], # [10.0,20.0,20.0,20.0,20.0,10.0], # [20.0,30.0,30.0,20.0,30.0,20.0], # ] - - #vertices = [ [(0.0,10.0),(10.0,10.0)], + + # vertices = [ [(0.0,10.0),(10.0,10.0)], # [(10.0,20.0),(20.0,20.0)], # [(20.0,30.0),(30.0,20.0)], # ] vertices = [ - [[0.0,0.0,0.0],[0.2,0.0,0.0]],# 0 - [[0.3,0.0,0.0],[0.9,0.0,0.0]],# 1 - [[0.5,0.0,0.1],[1.9,0.0,0.0]],# 2 - ] + [[0.0, 0.0, 0.0], [0.2, 0.0, 0.0]], # 0 + [[0.3, 0.0, 0.0], [0.9, 0.0, 0.0]], # 1 + [[0.5, 0.0, 0.1], [1.9, 0.0, 0.0]], # 2 + ] polygons = [ - np.array([[0.0,0.0,0.0],[0.2,0.0,0.0],[0.2,0.0,0.1],[0.3,0.3,0.3]]),# 0 - np.array([[0.3,0.0,0.0],[0.9,0.0,0.0]]),# 1 - np.array([[0.5,0.0,0.1],[1.9,0.0,0.0],[0.2,0.2,0.2]]),# 2 - ] - ids_sumo=['aa10','bb22','cc333'] - #lines.add_rows(3) + np.array([[0.0, 0.0, 0.0], [0.2, 0.0, 0.0], [ + 0.2, 0.0, 0.1], [0.3, 0.3, 0.3]]), # 0 + np.array([[0.3, 0.0, 0.0], [0.9, 0.0, 0.0]]), # 1 + np.array([[0.5, 0.0, 0.1], [1.9, 0.0, 0.0], [0.2, 0.2, 0.2]]), # 2 + ] + ids_sumo = ['aa10', 'bb22', 'cc333'] + # lines.add_rows(3) lines.add_rows(3, vertices=vertices, polygons=polygons, ids_sumo=ids_sumo) lines.print_attrs() - print '\n indexmap',lines.ids_sumo.get_indexmap() - print 'direct access vertex=\n', lines.vertices.value - print 'id for index bb22=',lines.ids_sumo.get_id_from_index('bb22') - print 'ids for index bb22,cc333=',lines.ids_sumo.get_ids_from_indices(['bb22','cc333']) - #lines.del_row(2) + print '\n indexmap', lines.ids_sumo.get_indexmap() + print 'direct access vertex=\n', lines.vertices.value + print 'id for index bb22=', lines.ids_sumo.get_id_from_index('bb22') + print 'ids for index bb22,cc333=', lines.ids_sumo.get_ids_from_indices(['bb22', 'cc333']) + # lines.del_row(2) lines.print_attrs() - print 'id for index bb22=',lines.ids_sumo.get_id_from_index('cc333') - + print 'id for index bb22=', lines.ids_sumo.get_id_from_index('cc333') + lines.ids_sumo[2] = 'xy' - - print '\n indexmap',lines.ids_sumo.get_indexmap() + + print '\n indexmap', lines.ids_sumo.get_indexmap() lines.print_attrs() -if 0|is_all: +if 0 | is_all: class Lines(TableObjman): - - def __init__(self,ident, parent=None, **kwargs): - - self._init_objman(ident,parent=parent, **kwargs) - - - self.add_col(ColConf( 'vertices', np.zeros((2,3), float), - groupnames = ['internal'], - perm='rw', - name = 'Vertex', - is_save = True, - info = 'Vertex coordinate vectors of points. with format [[[x11,y11,z11],[x12,y12,z12]],[[x21,y21,z21],[x22,y22,z122]],...]', - )) - - self.add_col(ColConf( 'polygons', None, - dtype = 'object', - groupnames = ['landuse'], - perm='rw', - name = 'Polygon', - info = 'Polygons [[ (x11,y11,z11), (x12,y12,z13), (x13, y13,z13),...],[...]]', - )) - - self.add_col(ColConf( 'ids_sumo', None, - dtype = 'object', - is_index = True, - perm='rw', - name = 'Polygon', - info = 'Polygons [[ (x11,y11,z11), (x12,y12,z13), (x13, y13,z13),...],[...]]', - )) - - - + + def __init__(self, ident, parent=None, **kwargs): + + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(ColConf('vertices', np.zeros((2, 3), float), + groupnames=['internal'], + perm='rw', + name='Vertex', + is_save=True, + info='Vertex coordinate vectors of points. with format [[[x11,y11,z11],[x12,y12,z12]],[[x21,y21,z21],[x22,y22,z122]],...]', + )) + + self.add_col(ColConf('polygons', None, + dtype='object', + groupnames=['landuse'], + perm='rw', + name='Polygon', + info='Polygons [[ (x11,y11,z11), (x12,y12,z13), (x13, y13,z13),...],[...]]', + )) + + self.add_col(ColConf('ids_sumo', None, + dtype='object', + is_index=True, + perm='rw', + name='Polygon', + info='Polygons [[ (x11,y11,z11), (x12,y12,z13), (x13, y13,z13),...],[...]]', + )) + ########################################################################### - ## Instance creation - + # Instance creation + lines = Lines('lines') - #vertices = [ [0.0,10.0,10.0,10.0,10.0,0.0], + # vertices = [ [0.0,10.0,10.0,10.0,10.0,0.0], # [10.0,20.0,20.0,20.0,20.0,10.0], # [20.0,30.0,30.0,20.0,30.0,20.0], # ] - - #vertices = [ [(0.0,10.0),(10.0,10.0)], + + # vertices = [ [(0.0,10.0),(10.0,10.0)], # [(10.0,20.0),(20.0,20.0)], # [(20.0,30.0),(30.0,20.0)], # ] vertices = [ - [[0.0,0.0,0.0],[0.2,0.0,0.0]],# 0 - [[0.3,0.0,0.0],[0.9,0.0,0.0]],# 1 - [[0.5,0.0,0.1],[1.9,0.0,0.0]],# 2 - ] + [[0.0, 0.0, 0.0], [0.2, 0.0, 0.0]], # 0 + [[0.3, 0.0, 0.0], [0.9, 0.0, 0.0]], # 1 + [[0.5, 0.0, 0.1], [1.9, 0.0, 0.0]], # 2 + ] polygons = [ - np.array([[0.0,0.0,0.0],[0.2,0.0,0.0],[0.2,0.0,0.1],[0.3,0.3,0.3]]),# 0 - np.array([[0.3,0.0,0.0],[0.9,0.0,0.0]]),# 1 - np.array([[0.5,0.0,0.1],[1.9,0.0,0.0],[0.2,0.2,0.2]]),# 2 - ] - ids_sumo=['aa10','bb22','cc333'] - #lines.add_rows(3) + np.array([[0.0, 0.0, 0.0], [0.2, 0.0, 0.0], [ + 0.2, 0.0, 0.1], [0.3, 0.3, 0.3]]), # 0 + np.array([[0.3, 0.0, 0.0], [0.9, 0.0, 0.0]]), # 1 + np.array([[0.5, 0.0, 0.1], [1.9, 0.0, 0.0], [0.2, 0.2, 0.2]]), # 2 + ] + ids_sumo = ['aa10', 'bb22', 'cc333'] + # lines.add_rows(3) lines.add_rows(3, vertices=vertices, polygons=polygons, ids_sumo=ids_sumo) lines.print_attrs() - print 'direct access vertex=\n', lines.vertices.value + print 'direct access vertex=\n', lines.vertices.value print 'direct access polygons=\n', lines.polygons.value - print 'id for index bb22=',lines.ids_sumo.get_id_from_index('bb22') - print 'ids for index bb22,cc333=',lines.ids_sumo.get_ids_from_indices(['bb22','cc333']) + print 'id for index bb22=', lines.ids_sumo.get_id_from_index('bb22') + print 'ids for index bb22,cc333=', lines.ids_sumo.get_ids_from_indices(['bb22', 'cc333']) lines.del_row(2) lines.print_attrs() - print 'id for index bb22=',lines.ids_sumo.get_id_from_index('cc333') -if 0|is_all: + print 'id for index bb22=', lines.ids_sumo.get_id_from_index('cc333') +if 0 | is_all: class Lines(ArrayObjman): - - def __init__(self,ident, parent=None, **kwargs): - - self._init_objman(ident,parent=parent, **kwargs) - - - self.add_col(ArrayConf( 'vertices', np.zeros((2,3), float), - groupnames = ['internal'], - perm='rw', - name = 'Vertex', - is_save = True, - info = 'Vertex coordinate vectors of points. with format [[[x11,y11,z11],[x12,y12,z12]],[[x21,y21,z21],[x22,y22,z122]],...]', - )) - - self.add_col(ArrayConf( 'polygons', None, - dtype = 'object', - groupnames = ['landuse'], - perm='rw', - name = 'Polygon', - info = 'Polygons [[ (x11,y11,z11), (x12,y12,z13), (x13, y13,z13),...],[...]]', - )) - - - - - + + def __init__(self, ident, parent=None, **kwargs): + + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(ArrayConf('vertices', np.zeros((2, 3), float), + groupnames=['internal'], + perm='rw', + name='Vertex', + is_save=True, + info='Vertex coordinate vectors of points. with format [[[x11,y11,z11],[x12,y12,z12]],[[x21,y21,z21],[x22,y22,z122]],...]', + )) + + self.add_col(ArrayConf('polygons', None, + dtype='object', + groupnames=['landuse'], + perm='rw', + name='Polygon', + info='Polygons [[ (x11,y11,z11), (x12,y12,z13), (x13, y13,z13),...],[...]]', + )) + ########################################################################### - ## Instance creation - + # Instance creation + lines = Lines('lines') - #vertices = [ [0.0,10.0,10.0,10.0,10.0,0.0], + # vertices = [ [0.0,10.0,10.0,10.0,10.0,0.0], # [10.0,20.0,20.0,20.0,20.0,10.0], # [20.0,30.0,30.0,20.0,30.0,20.0], # ] - - #vertices = [ [(0.0,10.0),(10.0,10.0)], + + # vertices = [ [(0.0,10.0),(10.0,10.0)], # [(10.0,20.0),(20.0,20.0)], # [(20.0,30.0),(30.0,20.0)], # ] vertices = [ - [[0.0,0.0,0.0],[0.2,0.0,0.0]],# 0 - [[0.3,0.0,0.0],[0.9,0.0,0.0]],# 1 - [[0.5,0.0,0.1],[1.9,0.0,0.0]],# 2 - ] + [[0.0, 0.0, 0.0], [0.2, 0.0, 0.0]], # 0 + [[0.3, 0.0, 0.0], [0.9, 0.0, 0.0]], # 1 + [[0.5, 0.0, 0.1], [1.9, 0.0, 0.0]], # 2 + ] polygons = [ - np.array([[0.0,0.0,0.0],[0.2,0.0,0.0],[0.2,0.0,0.1],[0.3,0.3,0.3]]),# 0 - np.array([[0.3,0.0,0.0],[0.9,0.0,0.0]]),# 1 - np.array([[0.5,0.0,0.1],[1.9,0.0,0.0],[0.2,0.2,0.2]]),# 2 - ] - #lines.add_rows(3) + np.array([[0.0, 0.0, 0.0], [0.2, 0.0, 0.0], [ + 0.2, 0.0, 0.1], [0.3, 0.3, 0.3]]), # 0 + np.array([[0.3, 0.0, 0.0], [0.9, 0.0, 0.0]]), # 1 + np.array([[0.5, 0.0, 0.1], [1.9, 0.0, 0.0], [0.2, 0.2, 0.2]]), # 2 + ] + # lines.add_rows(3) lines.add_rows(3, vertices=vertices, polygons=polygons) lines.print_attrs() - print 'direct access vertex=\n', lines.vertices.value - print 'direct access polygons=\n', lines.polygons.value - -if 0|is_all: + print 'direct access vertex=\n', lines.vertices.value + print 'direct access polygons=\n', lines.polygons.value + +if 0 | is_all: class ZonesTab(ArrayObjman): - def __init__(self,ident, parent=None, **kwargs): - self._init_objman(ident,parent=parent, **kwargs) - - - self.add_col(ColConf( 'shapes', [], - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Shape', - info = 'Shape of zone which is a list of (x,y) coordinates', - )) - - - + + def __init__(self, ident, parent=None, **kwargs): + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(ColConf('shapes', [], + groupnames=['state'], + perm='rw', + is_save=True, + name='Shape', + info='Shape of zone which is a list of (x,y) coordinates', + )) + class OdTripsTab(ArrayObjman): - def __init__(self,ident, parent, zones, **kwargs): - self._init_objman(ident, parent=parent, **kwargs) - - self.add_col(IdsConf( 'ids_orig', zones, is_child = False, - groupnames = ['state'], - is_save = True, - name = 'ID Orig', - info = 'ID of traffic assignment zone of origin of trip.', - )) - - - self.add_col(IdsConf( 'ids_dest', zones, is_child = False, - groupnames = ['state'], - is_save = True, - name = 'ID Dest', - info = 'ID of traffic assignment zone of destination of trip.', - )) - - self.add_col(ColConf( 'tripnumbers', 0, - groupnames = ['state'], - perm = 'rw', - is_save = True, - name = 'Trip number', - info = 'Number of trips from zone with ID Orig to zone with ID Dest.', - )) - + + def __init__(self, ident, parent, zones, **kwargs): + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(IdsConf('ids_orig', zones, is_child=False, + groupnames=['state'], + is_save=True, + name='ID Orig', + info='ID of traffic assignment zone of origin of trip.', + )) + + self.add_col(IdsConf('ids_dest', zones, is_child=False, + groupnames=['state'], + is_save=True, + name='ID Dest', + info='ID of traffic assignment zone of destination of trip.', + )) + + self.add_col(ColConf('tripnumbers', 0, + groupnames=['state'], + perm='rw', + is_save=True, + name='Trip number', + info='Number of trips from zone with ID Orig to zone with ID Dest.', + )) + class OdModesTab(ArrayObjman): - def __init__(self,ident, parent=None, **kwargs): - self._init_objman(ident,parent=parent, **kwargs) - - - self.add_col(ObjsConf( 'odtrips', - groupnames = ['state'], - is_save = True, - name = 'OD matrix', - info = 'Matrix with trips from origin to destintion', - )) - - + + def __init__(self, ident, parent=None, **kwargs): + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(ObjsConf('odtrips', + groupnames=['state'], + is_save=True, + name='OD matrix', + info='Matrix with trips from origin to destintion', + )) + class OdIntervalsTab(ArrayObjman): - def __init__(self,ident, parent=None, **kwargs): - self._init_objman(ident,parent=parent, **kwargs) - - self.add_col(ColConf( 't_start', 0.0, - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Start time', - unit = 's', - info = 'Start time of interval', - )) - - self.add_col(ColConf( 't_end', 3600.0, - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'End time', - unit = 's', - info = 'End time of interval', - )) - - self.add_col(ObjsConf( 'odmodes', - groupnames = ['state'], - is_save = True, - name = 'Modes', - info = 'Transport mode', - )) - + + def __init__(self, ident, parent=None, **kwargs): + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(ColConf('t_start', 0.0, + groupnames=['state'], + perm='rw', + is_save=True, + name='Start time', + unit='s', + info='Start time of interval', + )) + + self.add_col(ColConf('t_end', 3600.0, + groupnames=['state'], + perm='rw', + is_save=True, + name='End time', + unit='s', + info='End time of interval', + )) + + self.add_col(ObjsConf('odmodes', + groupnames=['state'], + is_save=True, + name='Modes', + info='Transport mode', + )) + ########################################################################### - ## Instance creation - + # Instance creation + demand = BaseObjman('demand') - - zones = ZonesTab('zones', parent = demand ) - demand.zones = demand.attrsman.add( ObjConf( zones) ) - shapes = [ [(0.0,10.0),(10.0,10.0),(10.0,0.0)], - [(10.0,20.0),(20.0,20.0),(20.0,10.0)], - [(20.0,30.0),(30.0,20.0),(30.0,20.0)], - ] + + zones = ZonesTab('zones', parent=demand) + demand.zones = demand.attrsman.add(ObjConf(zones)) + shapes = [[(0.0, 10.0), (10.0, 10.0), (10.0, 0.0)], + [(10.0, 20.0), (20.0, 20.0), (20.0, 10.0)], + [(20.0, 30.0), (30.0, 20.0), (30.0, 20.0)], + ] zones.add_rows(3, shapes=shapes) - - odintervals = OdIntervalsTab('odintervals', parent = demand, info = 'OD data for different time intervals') - demand.odintervals = demand.attrsman.add( ObjConf(odintervals)) - odintervals.add_rows(2, t_start=[0,3600], t_end=[3600, 7200]) + + odintervals = OdIntervalsTab( + 'odintervals', parent=demand, info='OD data for different time intervals') + demand.odintervals = demand.attrsman.add(ObjConf(odintervals)) + odintervals.add_rows(2, t_start=[0, 3600], t_end=[3600, 7200]) for id_odmodes in odintervals.get_ids(): - odmodes = OdModesTab( (odintervals.odmodes.attrname, id_odmodes), parent = odintervals) + odmodes = OdModesTab( + (odintervals.odmodes.attrname, id_odmodes), parent=odintervals) odintervals.odmodes[id_odmodes] = odmodes - + odmodes.add_rows(2) for id_odtrips in odmodes.get_ids(): - odtrips = OdTripsTab( (odmodes.odtrips.attrname, id_odtrips) , odmodes, zones ) - odtrips.add_rows(3, ids_orig=[3,2,1],ids_dest=[3,3,3], tripnumbers = [10,200,555]) + odtrips = OdTripsTab( + (odmodes.odtrips.attrname, id_odtrips), odmodes, zones) + odtrips.add_rows(3, ids_orig=[3, 2, 1], ids_dest=[ + 3, 3, 3], tripnumbers=[10, 200, 555]) odmodes.odtrips[id_odtrips] = odtrips - - demand.attrsman.print_attrs() - odintervals.print_attrs() - - for id_odmodes in odintervals.get_ids(): + + demand.attrsman.print_attrs() + odintervals.print_attrs() + + for id_odmodes in odintervals.get_ids(): print '\nMODE:' odintervals.odmodes[id_odmodes].print_attrs() print '\nTRIPS:' for id_odtrips in odmodes.get_ids(): odmodes.odtrips[id_odtrips].print_attrs() - - -if 0|is_all: + + +if 0 | is_all: class ZonesTab(TableObjman): - def __init__(self,ident, parent=None, **kwargs): - self._init_objman(ident,parent=parent, **kwargs) - - - self.add_col(ColConf( 'shapes', [], - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Shape', - info = 'Shape of zone which is a list of (x,y) coordinates', - )) - - - + + def __init__(self, ident, parent=None, **kwargs): + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(ColConf('shapes', [], + groupnames=['state'], + perm='rw', + is_save=True, + name='Shape', + info='Shape of zone which is a list of (x,y) coordinates', + )) + class OdTripsTab(TableObjman): - def __init__(self,ident, parent, zones, **kwargs): - self._init_objman(ident, parent=parent, **kwargs) - - self.add_col(IdsConf( 'ids_orig', zones, is_child = False, - groupnames = ['state'], - is_save = True, - name = 'ID Orig', - info = 'ID of traffic assignment zone of origin of trip.', - )) - - - self.add_col(IdsConf( 'ids_dest', zones, is_child = False, - groupnames = ['state'], - is_save = True, - name = 'ID Dest', - info = 'ID of traffic assignment zone of destination of trip.', - )) - - self.add_col(ColConf( 'tripnumbers', 0, - groupnames = ['state'], - perm = 'rw', - is_save = True, - name = 'Trip number', - info = 'Number of trips from zone with ID Orig to zone with ID Dest.', - )) - + + def __init__(self, ident, parent, zones, **kwargs): + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(IdsConf('ids_orig', zones, is_child=False, + groupnames=['state'], + is_save=True, + name='ID Orig', + info='ID of traffic assignment zone of origin of trip.', + )) + + self.add_col(IdsConf('ids_dest', zones, is_child=False, + groupnames=['state'], + is_save=True, + name='ID Dest', + info='ID of traffic assignment zone of destination of trip.', + )) + + self.add_col(ColConf('tripnumbers', 0, + groupnames=['state'], + perm='rw', + is_save=True, + name='Trip number', + info='Number of trips from zone with ID Orig to zone with ID Dest.', + )) + class OdModesTab(TableObjman): - def __init__(self,ident, parent=None, **kwargs): - self._init_objman(ident,parent=parent, **kwargs) - - - self.add_col(ObjsConf( 'odtrips', - groupnames = ['state'], - is_save = True, - name = 'OD matrix', - info = 'Matrix with trips from origin to destintion', - )) - - + + def __init__(self, ident, parent=None, **kwargs): + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(ObjsConf('odtrips', + groupnames=['state'], + is_save=True, + name='OD matrix', + info='Matrix with trips from origin to destintion', + )) + class OdIntervalsTab(TableObjman): - def __init__(self,ident, parent=None, **kwargs): - self._init_objman(ident,parent=parent, **kwargs) - - self.add_col(ColConf( 't_start', 0.0, - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Start time', - unit = 's', - info = 'Start time of interval', - )) - - self.add_col(ColConf( 't_end', 3600.0, - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'End time', - unit = 's', - info = 'End time of interval', - )) - - self.add_col(ObjsConf( 'odmodes', - groupnames = ['state'], - is_save = True, - name = 'Modes', - info = 'Transport mode', - )) - + + def __init__(self, ident, parent=None, **kwargs): + self._init_objman(ident, parent=parent, **kwargs) + + self.add_col(ColConf('t_start', 0.0, + groupnames=['state'], + perm='rw', + is_save=True, + name='Start time', + unit='s', + info='Start time of interval', + )) + + self.add_col(ColConf('t_end', 3600.0, + groupnames=['state'], + perm='rw', + is_save=True, + name='End time', + unit='s', + info='End time of interval', + )) + + self.add_col(ObjsConf('odmodes', + groupnames=['state'], + is_save=True, + name='Modes', + info='Transport mode', + )) + ########################################################################### - ## Instance creation - + # Instance creation + demand = BaseObjman('demand') - - zones = ZonesTab('zones', parent = demand ) - demand.zones = demand.attrsman.add( ObjConf( zones) ) - shapes = [ [(0.0,10.0),(10.0,10.0),(10.0,0.0)], - [(10.0,20.0),(20.0,20.0),(20.0,10.0)], - [(20.0,30.0),(30.0,20.0),(30.0,20.0)], - ] + + zones = ZonesTab('zones', parent=demand) + demand.zones = demand.attrsman.add(ObjConf(zones)) + shapes = [[(0.0, 10.0), (10.0, 10.0), (10.0, 0.0)], + [(10.0, 20.0), (20.0, 20.0), (20.0, 10.0)], + [(20.0, 30.0), (30.0, 20.0), (30.0, 20.0)], + ] zones.add_rows(3, shapes=shapes) - - odintervals = OdIntervalsTab('odintervals', parent = demand, info = 'OD data for different time intervals') - demand.odintervals = demand.attrsman.add( ObjConf(odintervals, is_child = True)) - odintervals.add_rows(2, t_start=[0,3600], t_end=[3600, 7200]) + + odintervals = OdIntervalsTab( + 'odintervals', parent=demand, info='OD data for different time intervals') + demand.odintervals = demand.attrsman.add( + ObjConf(odintervals, is_child=True)) + odintervals.add_rows(2, t_start=[0, 3600], t_end=[3600, 7200]) for id_odmodes in odintervals.get_ids(): - odmodes = OdModesTab( (odintervals.odmodes.attrname, id_odmodes), parent = odintervals) + odmodes = OdModesTab( + (odintervals.odmodes.attrname, id_odmodes), parent=odintervals) odintervals.odmodes[id_odmodes] = odmodes - + odmodes.add_rows(2) for id_odtrips in odmodes.get_ids(): - odtrips = OdTripsTab( (odmodes.odtrips.attrname, id_odtrips) , odmodes, zones ) - odtrips.add_rows(3, ids_orig=[3,2,1],ids_dest=[3,3,3], tripnumbers = [10,200,555]) + odtrips = OdTripsTab( + (odmodes.odtrips.attrname, id_odtrips), odmodes, zones) + odtrips.add_rows(3, ids_orig=[3, 2, 1], ids_dest=[ + 3, 3, 3], tripnumbers=[10, 200, 555]) odmodes.odtrips[id_odtrips] = odtrips - - demand.attrsman.print_attrs() - odintervals.print_attrs() - - for id_odmodes in odintervals.get_ids(): + + demand.attrsman.print_attrs() + odintervals.print_attrs() + + for id_odmodes in odintervals.get_ids(): print '\nMODE:' odintervals.odmodes[id_odmodes].print_attrs() print '\nTRIPS:' for id_odtrips in odmodes.get_ids(): odmodes.odtrips[id_odtrips].print_attrs() - - -if 0|is_all: - + + +if 0 | is_all: + net = BaseObjman('net') - + # TODO: could be put in 2 statements - edges = TableObjman('edges', parent = net, info = 'Network edges') - nodes = TableObjman('nodes', parent = net, info = 'Network nodes') - - net.edges = net.get_attrsman().add( ObjConf(edges, is_child = True)) - net.nodes = net.get_attrsman().add( ObjConf(nodes, is_child = True)) - - - - - net.edges.add_col(IdsConf( 'ids_node_from', net.nodes, - groupnames = ['state'], - is_save = True, - name = 'ID from nodes', - info = 'ID from nodes', - )) - - - net.edges.add_col(IdsConf( 'ids_node_to', net.nodes, - groupnames = ['state'], - is_save = True, - name = 'ID to nodes', - info = 'ID to nodes', - )) - - - net.nodes.add_col(ColConf( 'coords', (0.0,0.0), - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Coords', - info = 'Coordinates', - )) - - - net.nodes.add_rows( 4, - # 1 2 3 4 - coords = [(0.0,0.0),(1.0,0.0),(1.0,1.0),(0.0,1.0)], - ) - + edges = TableObjman('edges', parent=net, info='Network edges') + nodes = TableObjman('nodes', parent=net, info='Network nodes') + + net.edges = net.get_attrsman().add(ObjConf(edges, is_child=True)) + net.nodes = net.get_attrsman().add(ObjConf(nodes, is_child=True)) + + net.edges.add_col(IdsConf('ids_node_from', net.nodes, + groupnames=['state'], + is_save=True, + name='ID from nodes', + info='ID from nodes', + )) + + net.edges.add_col(IdsConf('ids_node_to', net.nodes, + groupnames=['state'], + is_save=True, + name='ID to nodes', + info='ID to nodes', + )) + + net.nodes.add_col(ColConf('coords', (0.0, 0.0), + groupnames=['state'], + perm='rw', + is_save=True, + name='Coords', + info='Coordinates', + )) + + net.nodes.add_rows(4, + # 1 2 3 4 + coords=[(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 1.0)], + ) + net.edges.add_rows(2) - net.edges.ids_node_from[[1,2]]=[1,4] - net.edges.ids_node_to[[1,2]]=[3,2] + net.edges.ids_node_from[[1, 2]] = [1, 4] + net.edges.ids_node_to[[1, 2]] = [3, 2] net.get_attrsman().print_attrs() net.edges.print_attrs() net.nodes.print_attrs() - -if 0|is_all: + +if 0 | is_all: tab1 = TableObjman('simple_table') - - - tab1.add_col(ColConf( 'surname', 'xx', - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Family name', - info = 'Name of Family', - )) - - tab1.add_col(ColConf( 'streetname', 'via della...', - groupnames = ['state'], - perm='rw', - is_save = False, - name = 'Street name', - info = 'Name of the street', - )) - tab1.add_rows( 4, - surname = ['walt','greg','bob','duck'], - streetname=['a','bb','ccc','dddd'], - ) - - print 'direct access: tab1.surname.value',tab1.surname.value + tab1.add_col(ColConf('surname', 'xx', + groupnames=['state'], + perm='rw', + is_save=True, + name='Family name', + info='Name of Family', + )) + + tab1.add_col(ColConf('streetname', 'via della...', + groupnames=['state'], + perm='rw', + is_save=False, + name='Street name', + info='Name of the street', + )) + tab1.add_rows(4, + surname=['walt', 'greg', 'bob', 'duck'], + streetname=['a', 'bb', 'ccc', 'dddd'], + ) + + print 'direct access: tab1.surname.value', tab1.surname.value tab1.print_attrs() - -if 0|is_all: - + +if 0 | is_all: + tab1 = TableObjman('tab1') - print '\ntab1.ident',tab1.ident - - tab2 = TableObjman('tab2', parent = tab1) - print '\ntab2.ident',tab2.ident - - + print '\ntab1.ident', tab1.ident + + tab2 = TableObjman('tab2', parent=tab1) + print '\ntab2.ident', tab2.ident + # TODO: seperate attrname from linked obj ident because restrictive and makes problems with multiple tab destinations # this should be possible ...following the path of attrnames of absident # - - tab1.add_col(IdsConf('tab1', tab2) ) - - tab2.add_col(IdsConf('tab2', tab1, is_child = False) ) - - tab2.add_col(ColConf( 'surname', 'xx', - groupnames = ['state'], - perm='rw', - is_save = True, - name = 'Family name', - info = 'Name of Family', - )) - - tab2.add_col(ColConf( 'streetname', 'via della...', - groupnames = ['state'], - perm='rw', - is_save = False, - name = 'Street name', - info = 'Name of the street', - )) - tab2.add_rows( 4, - surname = ['walt','greg','bob','duck'], - streetname=['a','bb','ccc','dddd'], - tab1 = [2,1,3,1,], - ) - - - + tab1.add_col(IdsConf('tab1', tab2)) + + tab2.add_col(IdsConf('tab2', tab1, is_child=False)) + + tab2.add_col(ColConf('surname', 'xx', + groupnames=['state'], + perm='rw', + is_save=True, + name='Family name', + info='Name of Family', + )) + + tab2.add_col(ColConf('streetname', 'via della...', + groupnames=['state'], + perm='rw', + is_save=False, + name='Street name', + info='Name of the street', + )) + tab2.add_rows(4, + surname=['walt', 'greg', 'bob', 'duck'], + streetname=['a', 'bb', 'ccc', 'dddd'], + tab1=[2, 1, 3, 1, ], + ) + tab2.print_attrs() - - tab1.add_rows( 3, - tab2 = [3,1,2], - ) - + + tab1.add_rows(3, + tab2=[3, 1, 2], + ) + tab1.print_attrs() - - - -if 0|is_all: + + +if 0 | is_all: obj = TestTabman() - - print '\nobj.ident',obj.ident - - #streetname - #print 'This is the value of the attribute: obj.streetname=',obj.streetname - #print 'This is the configuration instance of the attribute x',obj.attrsman.x + + print '\nobj.ident', obj.ident + + # streetname + # print 'This is the value of the attribute: obj.streetname=',obj.streetname + # print 'This is the configuration instance of the attribute + # x',obj.attrsman.x obj.attrsman.print_attrs() -if 0|is_all: +if 0 | is_all: obj = TestTableObjMan() - - print '\nobj.ident',obj.ident - - #streetname - #print 'This is the value of the attribute: obj.streetname=',obj.streetname - #print 'This is the configuration instance of the attribute x',obj.attrsman.x - obj.print_attrs() + print '\nobj.ident', obj.ident + + # streetname + # print 'This is the value of the attribute: obj.streetname=',obj.streetname + # print 'This is the configuration instance of the attribute + # x',obj.attrsman.x + obj.print_attrs() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/xmlman.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/xmlman.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/xmlman.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_base/xmlman.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,88 +1,91 @@ #import classman as cm #XMLTAG = 'xmltag' import numpy as np -def write_obj_to_xml( obj, filepath, attrname_id = None, - encoding = 'UTF-8',#'iso-8859-1' - ): + + +def write_obj_to_xml(obj, filepath, attrname_id=None, + encoding='UTF-8', # 'iso-8859-1' + ): """ Universal xml writer for objects """ try: - fd=open(filepath,'w') + fd = open(filepath, 'w') except: - print 'WARNING in write_obj_to_xml: could not open',filepath + print 'WARNING in write_obj_to_xml: could not open', filepath return False - fd.write('\n'%encoding) - indent=0 - obj.write_xml(fd,indent) + fd.write('\n' % encoding) + indent = 0 + obj.write_xml(fd, indent) fd.close() - - +def begin(attr, indent=0): + return indent * ' ' + '<%s>\n' % attr + + +def end(attr, indent=0): + return indent * ' ' + '\n' % attr + -def begin(attr,indent=0): - return indent*' '+'<%s>\n'%attr +def start(attr, indent=0): + return indent * ' ' + '<%s ' % attr -def end(attr,indent=0): - return indent*' '+'\n'%attr - -def start(attr,indent=0): - return indent*' '+'<%s '%attr def stop(): return '>\n' - + def stopit(): return '/>\n' - -def num(attr,x): - return ' %s="%s"'%(attr,x) +def num(attr, x): + return ' %s="%s"' % (attr, x) + + +def arr(attr, a, sep=' '): + s = ' ' -def arr(attr,a,sep=' '): - s=' ' - - if len(a)>0: - s+='%s="'%attr + if len(a) > 0: + s += '%s="' % attr for i in xrange(len(a)): - s+='%s'%a[i]+sep - return s[:-1]+'"' + s += '%s' % a[i] + sep + return s[:-1] + '"' else: - #return s+'%s="<>"'%attr # NO!! - return s+'%s=""'%attr + # return s+'%s="<>"'%attr # NO!! + return s + '%s=""' % attr + + +def color(attr, val, sep=','): + return arr(attr, np.array(val[0:3] * 255 + 0.5, np.int32), sep) -def color(attr, val,sep=','): - return arr(attr, np.array(val[0:3]*255+0.5,np.int32),sep) -def mat(attr,m): - s=' ' - if len(m)>0: - s+='%s="'%attr +def mat(attr, m): + s = ' ' + if len(m) > 0: + s += '%s="' % attr for i in xrange(len(m)): - r=m[i] - for j in xrange(len(r)-1): - s+='%s,'%r[j] - s+='%s '%r[-1] - return s[:-1]+'"' + r = m[i] + for j in xrange(len(r) - 1): + s += '%s,' % r[j] + s += '%s ' % r[-1] + return s[:-1] + '"' else: - #return s+'%s="<>"'%attr# NO!! - return s+'%s=""'%attr - + # return s+'%s="<>"'%attr# NO!! + return s + '%s=""' % attr + - def parse_color(s): - #print 'parseColor',s - arr = s.split(',') - ret = [] - for a in arr: - ret.append(float(a)) + # print 'parseColor',s + arr = s.split(',') + ret = [] + for a in arr: + ret.append(float(a)) - return tuple(ret) + return tuple(ret) -#def process_shape(s, offset = [0.0,0.0], is_flatarray=False): +# def process_shape(s, offset = [0.0,0.0], is_flatarray=False): # cshape = [] # #print 'process_shape',type(s),s # es = s.rstrip().split(" ") @@ -95,55 +98,60 @@ # cshape.append((float(p[0])-offset[0], float(p[1]) - offset[1])) # return cshape -def process_shape(shapeString, offset = [0.0,0.0]): - cshape = [] - es = shapeString.rstrip().split(" ") - for e in es: - p = e.split(",") - if len(p) == 2: + +def process_shape(shapeString, offset=[0.0, 0.0]): + cshape = [] + es = shapeString.rstrip().split(" ") + for e in es: + p = e.split(",") + if len(p) == 2: # 2D coordinates with elevetion = 0 - cshape.append(np.array([float(p[0])-offset[0], float(p[1]) - offset[1], 0.0], np.float32)) - elif len(p) == 3: - # 3D coordinates - cshape.append(np.array([ float(p[0])-offset[0], float(p[1]) - offset[1], float(p[2]) ], np.float32) ) - else: - #print 'WARNING: illshaped shape',e - #cshape.append(np.array([0,0,0],np.float)) - return []#np.zeros((0,2),np.float32)#None - - # np.array(cshape,np.float32) - return cshape# keep list of vertex arrays + cshape.append( + np.array([float(p[0]) - offset[0], float(p[1]) - offset[1], 0.0], np.float32)) + elif len(p) == 3: + # 3D coordinates + cshape.append(np.array( + [float(p[0]) - offset[0], float(p[1]) - offset[1], float(p[2])], np.float32)) + else: + # print 'WARNING: illshaped shape',e + # cshape.append(np.array([0,0,0],np.float)) + return [] # np.zeros((0,2),np.float32)#None + + # np.array(cshape,np.float32) + return cshape # keep list of vertex arrays - def conver_val(s): - """ - Convert attribute s from a string to a number, if this is possible. - """ - #if - + """ + Convert attribute s from a string to a number, if this is possible. + """ + # if + # helper function for parsing comment line in xml file -def read_keyvalue(line,key): + + +def read_keyvalue(line, key): data = line.split(' ') for element in data: - if (element.find(key)>=0): - k,v =element.split('=') - value=v.replace('"','').replace('<','').replace('/>','').strip() + if (element.find(key) >= 0): + k, v = element.split('=') + value = v.replace('"', '').replace( + '<', '').replace('/>', '').strip() break - return value - -##def getShapeXml(shape): + return value + +# def getShapeXml(shape): ## s = " shape=\"" -## for i,c in enumerate(shape): -## if i!=0: +# for i,c in enumerate(shape): +# if i!=0: ## s+=(" ") ## s+=(str(c[0]) + "," + str(c[1])) -## s+=("\"") -## return s +# s+=("\"") +# return s ## -##def getListXml(l): +# def getListXml(l): ## s = " shape=\"" -## for item in l: +# for item in l: ## s+= str(item) + " " -## s+=("\"") -## return s \ No newline at end of file +# s+=("\"") +# return s diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,2 +1 @@ __version__ = "0.0" - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/mainframe.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/mainframe.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/mainframe.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/mainframe.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,417 +1,403 @@ - -import wx -import wx.py as py # pyshell -import sys,os, string,time -from collections import OrderedDict - -#import metacanvas_editor,metanet_editor,surveymask_editor#, metanet_editor_standalone -from wxmisc import KEYMAP,AgileMenuMixin,AgileToolbarFrameMixin,AgileStatusbar,AgileMenubar - - -from os.path import * -from os import getcwd - -import objpanel -from agilepy.lib_base.logger import Logger - -# We first have to set an application-wide help provider. Normally you -# would do this in your app's OnInit or in other startup code... -provider = wx.SimpleHelpProvider() -wx.HelpProvider_Set(provider) - - - -def make_moduleguis(dirlist): - moduleguilist = [] - for modulesdir in dirlist: - make_moduleguilist(moduleguilist, modulesdir) - #print 'make_moduleguis: moduleguilist=\n',moduleguilist - - moduleguilist.sort() - moduleguis = OrderedDict() - for initpriority, wxgui in moduleguilist: - moduleguis[wxgui.get_ident()] = wxgui - return moduleguis - -def make_moduleguilist(moduleguilist, modulesdir): - #print 'make_moduleguilist modulesdir',modulesdir,os.listdir(modulesdir) - #for modulename in os.listdir(modulesdir): - # is_noimport = (modulename in ['__init__.py',]) | (modulename.split('.')[-1] == 'pyc') - # is_dir = os.path.isdir(os.path.join(modulesdir, modulename)) - # if (not is_noimport)& (not is_dir): - # mn = modulename.split('.')[0] - # for n in modulename.split('.')[1:-1]: - # mn += '.'+n - # - # lib = __import__(modulesdir + '.' + mn ) - # #module = getattr(lib,mn) - # #print ' imported',mn,modulesdir+'.' + mn - - for modulename in os.listdir(modulesdir):# use walk module to get recursive - #if os.path.isdir(os.path.join(os.getcwd(), pluginname)): # is never a dir??? - - is_noimport = (modulename in ['__init__.py',]) | (modulename.split('.')[-1] == 'pyc') - is_dir = os.path.isdir(os.path.join(modulesdir, modulename)) - - #print ' modulename',modulename,is_noimport,is_dir - if (not is_noimport)& is_dir: - - lib = __import__(modulesdir+'.'+modulename) - module = getattr(lib,modulename) - #print ' imported modulename',modulename,module,hasattr(module,'get_wxgui') - # has module gui support specified in __init__.py - if hasattr(module,'get_wxgui'): - wxgui = module.get_wxgui() - #print ' wxgui',wxgui - if wxgui!= None: - #print ' append',(wxgui.get_initpriority(), wxgui) - moduleguilist.append((wxgui.get_initpriority(), wxgui)) - - -class MainSplitter(wx.SplitterWindow): - def __init__(self, parent, ID=wx.ID_ANY): - wx.SplitterWindow.__init__(self, parent, ID, - style = wx.SP_LIVE_UPDATE - ) - - - - self.SetMinimumPaneSize(20) - - #sty = wx.BORDER_SUNKEN - - #emptyobj = cm.BaseObjman('empty') - self._objbrowser = objpanel.NaviPanel(self, - None, - #show_title = False - #size = w.DefaultSize, - #style = wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.RESIZE_BORDER, - #choose_id=False,choose_attr=False, - #func_choose_id=None, - #func_change_obj=None, - #panelstyle = 'default', - immediate_apply = True, - buttons = [], - standartbuttons = ['apply','restore'], - #defaultbutton = defaultbutton, - ) - - #p1 = wx.Window(splitter, style=sty) - #p1.SetBackgroundColour("pink") - #wx.StaticText(p1, -1, "Object", (50,50)) - - #self.canvas = wx.Window(splitter, style=sty) - #self.canvas.SetBackgroundColour("green") - #wx.StaticText(self.canvas, -1, "Panel two", (50,50)) - #self.canvas = WxGLTest2(splitter) - #self.canvas = WxGLTest_orig(splitter) - - #self._viewtabs = wx.Notebook(self,wx.ID_ANY, style=wx.CLIP_CHILDREN) - self._viewtabs = wx.Notebook(self, -1, size=(21,21), style=wx.BK_DEFAULT - #wx.BK_TOP - #wx.BK_BOTTOM - #wx.BK_LEFT - #wx.BK_RIGHT - # | wx.NB_MULTILINE - ) - - #nbpanel = wx.Panel(splitter) - #self._viewtabs = wx.Notebook(nbpanel,wx.ID_ANY, style=wx.CLIP_CHILDREN) - #sizer = wx.BoxSizer(wx.VERTICAL) - #sizer.Add(self._viewtabs, 1, wx.ALL|wx.EXPAND, 5) - #nbpanel.SetSizer(sizer) - #self.Layout() - - # finally, put the notebook in a sizer for the panel to manage - # the layout - #sizer = wx.BoxSizer() - #sizer.Add(self._viewtabs, 1, wx.EXPAND) - #self.SetSizer(sizer) - - - #splitter.SplitVertically(self._objbrowser,self.canvas , -100) - self.SplitVertically(self._objbrowser, self._viewtabs, -100) - #self.SetSashGravity(0.2) # notebook too small - self.SetSashPosition(400, True) - self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.OnSashChanged) - self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGING, self.OnSashChanging) - - def add_view(self, name, ViewClass, **args): - """ - Add a new view to the notebook. - """ - #print 'context.add_view',ViewClass - #print ' args',args - view=ViewClass( self._viewtabs, - mainframe = self.GetParent(), - **args - ) - - # Add network tab with editor - p=self._viewtabs.AddPage( view, name.title() ) - #self._views[name] = view - #self._viewtabs.SetSelection(p) - #self._viewtabs.Show(True) - return view - - def select_view(self, ind = 0): - self._viewtabs.ChangeSelection(ind) - - def browse_obj(self, obj, **kwargs): - self._objbrowser.change_obj(obj, **kwargs) - - def OnSashChanged(self, evt): - #print("sash changed to %s\n" % str(evt.GetSashPosition())) - pass - - def OnSashChanging(self, evt): - #print("sash changing to %s\n" % str(evt.GetSashPosition())) - # uncomment this to not allow the change - #evt.SetSashPosition(-1) - #self.canvas.OnSize() - pass - -class AgileMainframe(AgileToolbarFrameMixin, wx.Frame): - """ - Simple wx frame with some special features. - """ - - - def __init__(self, parent=None, title ='mainframe', - moduledirs = [], args = [], - is_maximize = False, is_centerscreen = True, - pos=wx.DefaultPosition, size=wx.DefaultSize, - style=wx.DEFAULT_FRAME_STYLE, - name='theframe', size_toolbaricons = (24,24)): - - self._args = args - - - # Forcing a specific style on the window. - # Should this include styles passed? - - wx.Frame.__init__( self, parent, wx.ID_ANY, title, - pos, size = size, style = style, name = name) - #super(GLFrame, self).__init__(parent, id, title, pos, size, style, name) - self._splitter = MainSplitter(self) - self._views = {} - #wx.EVT_SIZE (self, self.on_size) - #sizer=wx.BoxSizer(wx.VERTICAL) - #sizer.Add(p1,0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4)# from NaviPanelTest - #sizer.Add(self.canvas,1,wx.GROW)# from NaviPanelTest - - # finish panel setup - #self.SetSizer(sizer) - #sizer.Fit(self) - #self.Show() - - # this is needed to initialize GL projections for unproject - #wx.CallAfter(self.on_size) - - #width,height = self.GetSize() - #self._splitter.SetSashPosition(300, True) - #maximize the frame - if is_maximize: - self.Maximize() - if is_centerscreen: - self.CenterOnScreen() - - ################################################################# - # create statusbar - #self.statusbar = AgileStatusbar(self) - self.statusbar = AgileStatusbar(self) - self.SetStatusBar(self.statusbar) - #self.count=0.0 - - ################################################################# - # create toolbar - - self.init_toolbar(size=size_toolbaricons) - # - #new_bmp = wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_TOOLBAR, tsize) - #open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, tsize) - #save_bmp= wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE, wx.ART_TOOLBAR, tsize) - #cut_bmp = wx.ArtProvider.GetBitmap(wx.ART_CUT, wx.ART_TOOLBAR, tsize) - #copy_bmp = wx.ArtProvider.GetBitmap(wx.ART_COPY, wx.ART_TOOLBAR, tsize) - #paste_bmp= wx.ArtProvider.GetBitmap(wx.ART_PASTE, wx.ART_TOOLBAR, tsize) - - - - #self.add_tool('new',self.on_open,new_bmp,'create new doc') - #self.add_tool('open',self.on_open,open_bmp,'Open doc') - #self.add_tool('save',self.on_save,save_bmp,'Save doc') - #self.toolbar.AddSeparator() - #self.add_tool('cut',self.on_open,cut_bmp,'Cut') - #self.add_tool('copy',self.on_open,copy_bmp,'Copy') - #self.add_tool('paste',self.on_open,paste_bmp,'Paste') - - - - #self.SetToolBar(self.toolbar) - - - - ################################################################# - #create the menu bar - - self.menubar=AgileMenubar(self) - #self.make_menu() - #self.menubar.append_menu('tools') - self.SetMenuBar(self.menubar) - #self.Show(True) #NO!! - - ################################################################# - # init logger - self._logger = Logger() - self._logger.add_callback(self.write_message, 'message') - self._logger.add_callback(self.write_action, 'action') - - ################################################################# - self._moduleguis = make_moduleguis(moduledirs) - - for modulename, modulegui in self._moduleguis.iteritems(): - #print ' init gui of module',modulename - modulegui.init_widgets(self) - ################################################################# - ## event section: specify in App - - #wx.EVT_BUTTON(self, 1003, self.on_close) - # wx.EVT_CLOSE(self, self.on_close) - #wx.EVT_IDLE(self, self.on_idle) - - - def refresh_moduleguis(self): - #print 'refresh_moduleguis',len(self._moduleguis) - self.browse_obj(None) - for modulename, modulegui in self._moduleguis.iteritems(): - #print ' refresh gui of module',modulename - modulegui.refresh_widgets() - - def get_modulegui(self, modulename): - return self._moduleguis[modulename] - - def write_message(self, text, **kwargs): - self.statusbar.write_message(text) - - def write_action(self, text, **kwargs): - self.statusbar.write_action(text) - self.statusbar.write_message('') - - - - def get_logger(self): - return self._logger - - def set_logger(self, logger): - self._logger = logger - - def get_args(self): - return self._args - - def browse_obj(self,obj,**kwargs): - self._splitter.browse_obj(obj, **kwargs) - - def make_menu(self): - """ - Creates manu. To be overridden. - """ - self.menubar.append_menu('file') - self.menubar.append_menu('file/doc') - - - self.menubar.append_item('file/doc/open',self.on_open,\ - shortkey='Ctrl+o',info='open it out') - - self.menubar.append_item('file/doc/save',self.on_save,\ - shortkey='Ctrl+s',info='save it out') - - - - #self.menubar.append_menu('edit') - #self.menubar.append_item('edit/cut',self.cut,\ - # shortkey='Ctrl+c',info='cut it out') - - #self.menubar.append_item('edit/toggle',self.toggle_tools,\ - # shortkey='Ctrl+t',info='toggle tools') - - def add_view(self, name, ViewClass, **args): - """ - Add a new view to the notebook. - """ - #print 'context.add_view',ViewClass - #print ' args',args - - view=self._splitter.add_view(name, ViewClass, **args) - self._views[name] = view - #self._viewtabs.SetSelection(p) - #self._splitter._viewtabs.Show(True) - return view - - - def select_view(self, ind = 0): - self._splitter.select_view(ind=ind) - - def on_size(self,event=None): - print 'Mainframe.on_size' - #self.tc.SetSize(self.GetSize()) - #self.tc.SetSize(self.GetSize()) - #self._viewtabs.SetSize(self.GetSize()) - #pass - #wx.LayoutAlgorithm().LayoutWindow(self, self.p1) - #wx.LayoutAlgorithm().LayoutWindow(self, self.p1) - - # important: - #wx.LayoutAlgorithm().LayoutWindow(self, self._viewtabs) - wx.LayoutAlgorithm().LayoutWindow(self, self._splitter) - if event: - event.Skip() - - def on_save(self,event): - print 'save it!!' - - - - def on_open(self, event): - """Open a document""" - #wildcards = CreateWildCards() + "All files (*.*)|*.*" - print 'open it!!' - - - def destroy(self): - """Destroy this object""" - ##self.theDocManager.theDestructor() - #imgPreferences.saveXml(self.GetStartDirectory() + "/" + imgINI_FILE_NAME) - ##del self.thePrint - self.Destroy() - - - def on_close(self, event): - #self.Close(True) - print 'Mainframe.on_close' - #pass - self.destroy() - - def on_exit(self, event): - """Called when the application is to be finished""" - self.destroy() - - - - def on_idle(self,event): - pass - #self.count = self.count + 1 - #if self.count >= 100: - # self.count = 0 - - #self.statusbar.set_progress(self.count) - - def on_about(self, event): - """Display the information about this application""" - #dlg = imgDlgAbout(self, -1, "") - #dlg.ShowModal() - #dlg.Destroy() - pass - - def write_to_statusbar(self, data, key='message'): - self.statusbar[key] = str(data) - \ No newline at end of file + +import wx +import wx.py as py # pyshell +import sys +import os +import string +import time +from collections import OrderedDict + +from wxmisc import KEYMAP, AgileMenuMixin, AgileToolbarFrameMixin, AgileStatusbar, AgileMenubar + + +from os.path import * +from os import getcwd + +import objpanel +from agilepy.lib_base.logger import Logger + +# We first have to set an application-wide help provider. Normally you +# would do this in your app's OnInit or in other startup code... +provider = wx.SimpleHelpProvider() +wx.HelpProvider_Set(provider) + + +def make_moduleguis(appdir, dirlist): + moduleguilist = [] + for modulesdir in dirlist: + make_moduleguilist(appdir, moduleguilist, modulesdir) + # print 'make_moduleguis: moduleguilist=\n',moduleguilist + + moduleguilist.sort() + moduleguis = OrderedDict() + for initpriority, wxgui in moduleguilist: + moduleguis[wxgui.get_ident()] = wxgui + return moduleguis + + +def make_moduleguilist(appdir, moduleguilist, modulesdir): + # print 'make_moduleguilist appdir,modulesdir',appdir,modulesdir + # print ' check dir',os.path.join(appdir, modulesdir) + # for modulename in os.listdir(modulesdir): + # is_noimport = (modulename in ['__init__.py',]) | (modulename.split('.')[-1] == 'pyc') + # is_dir = os.path.isdir(os.path.join(modulesdir, modulename)) + # if (not is_noimport)& (not is_dir): + # mn = modulename.split('.')[0] + # for n in modulename.split('.')[1:-1]: + # mn += '.'+n + # + # lib = __import__(modulesdir + '.' + mn ) + # #module = getattr(lib,mn) + # #print ' imported',mn,modulesdir+'.' + mn + + # use walk module to get recursive + for modulename in os.listdir(os.path.join(appdir, modulesdir)): + # if os.path.isdir(os.path.join(os.getcwd(), pluginname)): # is never a + # dir??? + + is_noimport = (modulename in ['__init__.py', ]) | ( + modulename.split('.')[-1] == 'pyc') + is_dir = os.path.isdir(os.path.join(appdir, modulesdir, modulename)) + + # print ' modulename',modulename,is_noimport,is_dir + if (not is_noimport) & is_dir: + + lib = __import__(modulesdir + '.' + modulename) + module = getattr(lib, modulename) + # print ' imported modulename',modulename,module,hasattr(module,'get_wxgui') + # has module gui support specified in __init__.py + if hasattr(module, 'get_wxgui'): + wxgui = module.get_wxgui() + # print ' wxgui',wxgui + if wxgui != None: + # print ' append',(wxgui.get_initpriority(), wxgui) + moduleguilist.append((wxgui.get_initpriority(), wxgui)) + + +class MainSplitter(wx.SplitterWindow): + + def __init__(self, parent, ID=wx.ID_ANY): + wx.SplitterWindow.__init__(self, parent, ID, + style=wx.SP_LIVE_UPDATE + ) + + self.SetMinimumPaneSize(20) + + #sty = wx.BORDER_SUNKEN + + #emptyobj = cm.BaseObjman('empty') + self._objbrowser = objpanel.NaviPanel(self, + None, + #show_title = False + #size = w.DefaultSize, + #style = wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.RESIZE_BORDER, + # choose_id=False,choose_attr=False, + # func_choose_id=None, + # func_change_obj=None, + #panelstyle = 'default', + immediate_apply=True, + buttons=[], + standartbuttons=[ + 'apply', 'restore'], + #defaultbutton = defaultbutton, + ) + + #p1 = wx.Window(splitter, style=sty) + # p1.SetBackgroundColour("pink") + #wx.StaticText(p1, -1, "Object", (50,50)) + + #self.canvas = wx.Window(splitter, style=sty) + # self.canvas.SetBackgroundColour("green") + #wx.StaticText(self.canvas, -1, "Panel two", (50,50)) + #self.canvas = WxGLTest2(splitter) + #self.canvas = WxGLTest_orig(splitter) + + #self._viewtabs = wx.Notebook(self,wx.ID_ANY, style=wx.CLIP_CHILDREN) + self._viewtabs = wx.Notebook(self, -1, size=(21, 21), style=wx.BK_DEFAULT + # wx.BK_TOP + # wx.BK_BOTTOM + # wx.BK_LEFT + # wx.BK_RIGHT + # | wx.NB_MULTILINE + ) + + #nbpanel = wx.Panel(splitter) + #self._viewtabs = wx.Notebook(nbpanel,wx.ID_ANY, style=wx.CLIP_CHILDREN) + #sizer = wx.BoxSizer(wx.VERTICAL) + #sizer.Add(self._viewtabs, 1, wx.ALL|wx.EXPAND, 5) + # nbpanel.SetSizer(sizer) + # self.Layout() + + # finally, put the notebook in a sizer for the panel to manage + # the layout + #sizer = wx.BoxSizer() + #sizer.Add(self._viewtabs, 1, wx.EXPAND) + # self.SetSizer(sizer) + + #splitter.SplitVertically(self._objbrowser,self.canvas , -100) + self.SplitVertically(self._objbrowser, self._viewtabs, -100) + # self.SetSashGravity(0.2) # notebook too small + self.SetSashPosition(400, True) + self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.OnSashChanged) + self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGING, self.OnSashChanging) + + def add_view(self, name, ViewClass, **args): + """ + Add a new view to the notebook. + """ + # print 'context.add_view',ViewClass + # print ' args',args + view = ViewClass(self._viewtabs, + mainframe=self.GetParent(), + **args + ) + + # Add network tab with editor + p = self._viewtabs.AddPage(view, name.title()) + #self._views[name] = view + # self._viewtabs.SetSelection(p) + # self._viewtabs.Show(True) + return view + + def select_view(self, ind=0): + self._viewtabs.ChangeSelection(ind) + + def browse_obj(self, obj, **kwargs): + self._objbrowser.change_obj(obj, **kwargs) + + def OnSashChanged(self, evt): + #print("sash changed to %s\n" % str(evt.GetSashPosition())) + pass + + def OnSashChanging(self, evt): + #print("sash changing to %s\n" % str(evt.GetSashPosition())) + # uncomment this to not allow the change + # evt.SetSashPosition(-1) + # self.canvas.OnSize() + pass + + +class AgileMainframe(AgileToolbarFrameMixin, wx.Frame): + + """ + Simple wx frame with some special features. + """ + + def __init__(self, parent=None, title='mainframe', + moduledirs=[], args=[], appdir='', + is_maximize=False, is_centerscreen=True, + pos=wx.DefaultPosition, size=wx.DefaultSize, + style=wx.DEFAULT_FRAME_STYLE, + name='theframe', size_toolbaricons=(24, 24)): + + self._args = args + # print 'AgileMainframe.__init__',title,appdir + + # Forcing a specific style on the window. + # Should this include styles passed? + + wx.Frame.__init__(self, parent, wx.ID_ANY, title, + pos, size=size, style=style, name=name) + #super(GLFrame, self).__init__(parent, id, title, pos, size, style, name) + self._splitter = MainSplitter(self) + self._views = {} + #wx.EVT_SIZE (self, self.on_size) + # sizer=wx.BoxSizer(wx.VERTICAL) + # sizer.Add(p1,0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4)# from NaviPanelTest + # sizer.Add(self.canvas,1,wx.GROW)# from NaviPanelTest + + # finish panel setup + # self.SetSizer(sizer) + # sizer.Fit(self) + # self.Show() + + # this is needed to initialize GL projections for unproject + # wx.CallAfter(self.on_size) + + #width,height = self.GetSize() + #self._splitter.SetSashPosition(300, True) + # maximize the frame + if is_maximize: + self.Maximize() + if is_centerscreen: + self.CenterOnScreen() + + ################################################################# + # create statusbar + #self.statusbar = AgileStatusbar(self) + self.statusbar = AgileStatusbar(self) + self.SetStatusBar(self.statusbar) + # self.count=0.0 + + ################################################################# + # create toolbar + + self.init_toolbar(size=size_toolbaricons) + # + #new_bmp = wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_TOOLBAR, tsize) + #open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, tsize) + #save_bmp= wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE, wx.ART_TOOLBAR, tsize) + #cut_bmp = wx.ArtProvider.GetBitmap(wx.ART_CUT, wx.ART_TOOLBAR, tsize) + #copy_bmp = wx.ArtProvider.GetBitmap(wx.ART_COPY, wx.ART_TOOLBAR, tsize) + #paste_bmp= wx.ArtProvider.GetBitmap(wx.ART_PASTE, wx.ART_TOOLBAR, tsize) + + #self.add_tool('new',self.on_open,new_bmp,'create new doc') + #self.add_tool('open',self.on_open,open_bmp,'Open doc') + #self.add_tool('save',self.on_save,save_bmp,'Save doc') + # self.toolbar.AddSeparator() + # self.add_tool('cut',self.on_open,cut_bmp,'Cut') + # self.add_tool('copy',self.on_open,copy_bmp,'Copy') + # self.add_tool('paste',self.on_open,paste_bmp,'Paste') + + # self.SetToolBar(self.toolbar) + + ################################################################# + # create the menu bar + + self.menubar = AgileMenubar(self) + # self.make_menu() + # self.menubar.append_menu('tools') + self.SetMenuBar(self.menubar) + # self.Show(True) #NO!! + + ################################################################# + # init logger + self._logger = Logger() + self._logger.add_callback(self.write_message, 'message') + self._logger.add_callback(self.write_action, 'action') + + ################################################################# + self._moduleguis = make_moduleguis(appdir, moduledirs) + + for modulename, modulegui in self._moduleguis.iteritems(): + # print ' init gui of module',modulename + modulegui.init_widgets(self) + ################################################################# + # event section: specify in App + + #wx.EVT_BUTTON(self, 1003, self.on_close) + # wx.EVT_CLOSE(self, self.on_close) + #wx.EVT_IDLE(self, self.on_idle) + + def refresh_moduleguis(self): + # print 'refresh_moduleguis',len(self._moduleguis) + self.browse_obj(None) + for modulename, modulegui in self._moduleguis.iteritems(): + # print ' refresh gui of module',modulename + modulegui.refresh_widgets() + + def get_modulegui(self, modulename): + return self._moduleguis[modulename] + + def write_message(self, text, **kwargs): + self.statusbar.write_message(text) + + def write_action(self, text, **kwargs): + self.statusbar.write_action(text) + self.statusbar.write_message('') + + def get_logger(self): + return self._logger + + def set_logger(self, logger): + self._logger = logger + + def get_args(self): + return self._args + + def browse_obj(self, obj, **kwargs): + self._splitter.browse_obj(obj, **kwargs) + + def make_menu(self): + """ + Creates manu. To be overridden. + """ + self.menubar.append_menu('file') + self.menubar.append_menu('file/doc') + + self.menubar.append_item('file/doc/open', self.on_open, + shortkey='Ctrl+o', info='open it out') + + self.menubar.append_item('file/doc/save', self.on_save, + shortkey='Ctrl+s', info='save it out') + + # self.menubar.append_menu('edit') + # self.menubar.append_item('edit/cut',self.cut,\ + # shortkey='Ctrl+c',info='cut it out') + + # self.menubar.append_item('edit/toggle',self.toggle_tools,\ + # shortkey='Ctrl+t',info='toggle tools') + + def add_view(self, name, ViewClass, **args): + """ + Add a new view to the notebook. + """ + # print 'context.add_view',ViewClass + # print ' args',args + + view = self._splitter.add_view(name, ViewClass, **args) + self._views[name] = view + # self._viewtabs.SetSelection(p) + # self._splitter._viewtabs.Show(True) + return view + + def select_view(self, ind=0): + self._splitter.select_view(ind=ind) + + def on_size(self, event=None): + print 'Mainframe.on_size' + # self.tc.SetSize(self.GetSize()) + # self.tc.SetSize(self.GetSize()) + # self._viewtabs.SetSize(self.GetSize()) + # pass + #wx.LayoutAlgorithm().LayoutWindow(self, self.p1) + #wx.LayoutAlgorithm().LayoutWindow(self, self.p1) + + # important: + #wx.LayoutAlgorithm().LayoutWindow(self, self._viewtabs) + wx.LayoutAlgorithm().LayoutWindow(self, self._splitter) + if event: + event.Skip() + + def on_save(self, event): + print 'save it!!' + + def on_open(self, event): + """Open a document""" + #wildcards = CreateWildCards() + "All files (*.*)|*.*" + print 'open it!!' + + def destroy(self): + """Destroy this object""" + # self.theDocManager.theDestructor() + #imgPreferences.saveXml(self.GetStartDirectory() + "/" + imgINI_FILE_NAME) + ##del self.thePrint + self.Destroy() + + def on_close(self, event): + # self.Close(True) + print 'Mainframe.on_close' + # pass + self.destroy() + + def on_exit(self, event): + """Called when the application is to be finished""" + self.destroy() + + def on_idle(self, event): + pass + #self.count = self.count + 1 + # if self.count >= 100: + # self.count = 0 + + # self.statusbar.set_progress(self.count) + + def on_about(self, event): + """Display the information about this application""" + #dlg = imgDlgAbout(self, -1, "") + # dlg.ShowModal() + # dlg.Destroy() + pass + + def write_to_statusbar(self, data, key='message'): + self.statusbar[key] = str(data) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/modulegui.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/modulegui.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/modulegui.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/modulegui.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,56 +3,56 @@ import agilepy.lib_base.classman as cm + class ModuleGui: + """Manages all GUIs to interact between the widgets from mainframe and the specific functions of the module. """ - def __init__(self, ident): - - - self._init_common( ident, - module = cm.BaseObjman('empty'), - priority = 9999999, - icondirpath = os.path.join(os.path.dirname(__file__), 'images') - ) - - + + self._init_common(ident, + module=cm.BaseObjman('empty'), + priority=9999999, + icondirpath=os.path.join( + os.path.dirname(__file__), 'images') + ) + def get_initpriority(self): return self._initpriority - - def _init_common(self, ident, module = None, priority = 9999999, icondirpath=''): + + def _init_common(self, ident, module=None, priority=9999999, icondirpath=''): """ ident: any string to identify this gui module: the module which interacts with this gui priority: specifies priority with wich this gui initialized in mainframe Initialization of widgets in init_widgets """ - + self._ident = ident self._set_module(module) self._initpriority = priority self._icondirpath = icondirpath - + def get_icon(self, name): return wx.Bitmap(os.path.join(self._icondirpath, name)) - - def _set_module(self,module): + + def _set_module(self, module): self._module = module - + def get_module(self): return self._module - + def get_ident(self): return self._ident - + def get_logger(self): return self._mainframe.get_logger() - - #def set_logger(self, logger): + + # def set_logger(self, logger): # self._logger = logger - + def init_widgets(self, mainframe): """ Set mainframe and initialize widgets to various places. @@ -60,7 +60,7 @@ self._mainframe = mainframe self.make_menu() self.make_toolbar() - + def refresh_widgets(self): """ Check through mainframe what the state of the application is @@ -68,153 +68,146 @@ dependent on the availability of data. """ pass - + def make_toolbar(self): pass - + def make_menu(self): pass -## print 'make_menu' +# print 'make_menu' ## menubar = self._mainframe.menubar ## menubar.append_menu('plugins/traces', bitmap=wx.Bitmap(os.path.join(ICONDIR,'icon_gps.png'))) -## -## menubar.append_item('plugins/traces/browse traces', -## self.on_renew_objectbrowser, +## +# menubar.append_item('plugins/traces/browse traces', +# self.on_renew_objectbrowser, ## info='Browse traces in object browser.', -## bitmap=wx.Bitmap(os.path.join(ICONDIR_APP,'icon_control_panel16x16.png')),) -## -## menubar.append_item('plugins/traces/open matched routes...', +# bitmap=wx.Bitmap(os.path.join(ICONDIR_APP,'icon_control_panel16x16.png')),) +## +# menubar.append_item('plugins/traces/open matched routes...', ## self.on_import_routes, info='Open matched routes and GPS points from xml.', -## bitmap = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_MENU)) -## -## menubar.append_item('plugins/traces/save matched routes...', +# bitmap = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_MENU)) +## +# menubar.append_item('plugins/traces/save matched routes...', ## self.on_export_routes_to_xml, info='Save matched routes and GPS points in xml.', -## bitmap = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_MENU)) -## -## -## # imports -## -## menubar.append_item('plugins/traces/import gps traces from gpx...', +# bitmap = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_MENU)) +## +## +# imports +## +# menubar.append_item('plugins/traces/import gps traces from gpx...', ## self.on_import_gpx, info='Import tracews from gpx file, the format of Endomondo and othe GPS tracker applications.', -## bitmap = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_MENU)) -## -## -## menubar.append_item('plugins/traces/import gps traces from csv...', +# bitmap = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_MENU)) +## +## +# menubar.append_item('plugins/traces/import gps traces from csv...', ## self.on_import_traces, info='Import gps traces from a CSV file.', -## bitmap = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_MENU)) -## -## -## #menubar.append_item('plugins/traces/import routes...', -## # self.on_import_routes, info='Import routes from sumo xml file. Choose one or more files to import.', -## # bitmap = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_MENU)) -## -## # exports -## -## menubar.append_item('plugins/traces/export routes to shapefile...', +# bitmap = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_MENU)) +## +## +# menubar.append_item('plugins/traces/import routes...', +# self.on_import_routes, info='Import routes from sumo xml file. Choose one or more files to import.', +# bitmap = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_MENU)) +## +# exports +## +# menubar.append_item('plugins/traces/export routes to shapefile...', ## self.on_export_routes_to_shape, info='Export routes to shape file.', -## bitmap = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_MENU)) -## -## -## menubar.append_item('plugins/traces/export shortest routes to shapefile...', +# bitmap = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_MENU)) +## +## +# menubar.append_item('plugins/traces/export shortest routes to shapefile...', ## self.on_export_routes_mindist_to_shape, info='Export shortest routes to shape file.', -## bitmap = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_MENU)) -## -## menubar.append_item('plugins/traces/export points to shapefile...', +# bitmap = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_MENU)) +## +# menubar.append_item('plugins/traces/export points to shapefile...', ## self.on_export_points_to_shape, info='Export GPS points to shape file.', -## bitmap = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_MENU)) -## -## menubar.append_item('plugins/traces/export to demand...', +# bitmap = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_MENU)) +## +# menubar.append_item('plugins/traces/export to demand...', ## self.on_make_demand, info='Generate demand with matched routes for microsimulation with SUMO.', -## bitmap = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_MENU)) -## -## -## # basic operations +# bitmap = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE,wx.ART_MENU)) +## +## +# basic operations ## menubar.append_item('plugins/traces/clean traces', self.on_clean_traces, info='Remove invalid traces and split traces, if necessary.') -## #menubar.append_item('plugins/traces/calculate edge boundaries', self.on_calc_edge_boundaries, info='Calculate boundaries of edges for all traces.') -## #menubar.append_item('plugins/traces/calculate edge weights', self.on_calc_edge_weights, info='Calculate weight of edges for all traces.') +# menubar.append_item('plugins/traces/calculate edge boundaries', self.on_calc_edge_boundaries, info='Calculate boundaries of edges for all traces.') +# menubar.append_item('plugins/traces/calculate edge weights', self.on_calc_edge_weights, info='Calculate weight of edges for all traces.') ## menubar.append_item('plugins/traces/match traces', self.on_match, info='match traces to network.') -## +## ## menubar.append_item('plugins/traces/filter OD traces', self.on_filter_traces_between_zones, info='Filter traces with origin and destination in predefined zones. Remove all other traces.') -## -## -## -## # all data graphics -## -## -## (self._menuitem_draw_pointsets, id_item,) = menubar.append_item( -## 'plugins/traces/show all datapoints in network', -## self.on_draw_pointsets, -## info='Choose to show all GPS data points on network map', check=True) -## self._menuitem_draw_pointsets.Check(False) -## -## menubar.append_item( -## 'plugins/traces/add plot all datapoints', -## self.on_plot_pointsets, -## info='Choose to add all GPS data points in traces graphics') -## -## +## +## +## +# all data graphics +## +## +# (self._menuitem_draw_pointsets, id_item,) = menubar.append_item( +## 'plugins/traces/show all datapoints in network', +# self.on_draw_pointsets, +# info='Choose to show all GPS data points on network map', check=True) +# self._menuitem_draw_pointsets.Check(False) +## +# menubar.append_item( +## 'plugins/traces/add plot all datapoints', +# self.on_plot_pointsets, +# info='Choose to add all GPS data points in traces graphics') +## +## ## menubar.append_item('plugins/traces/add plot all edge boundaries', self.on_plot_boundaries, info='Add plot of all edge boundaries on Trace tab.') ## ## menubar.append_item('plugins/traces/add plot all routes in traces graphics', self.on_plot_routes, info='Add plot of all routes in Trace tab.') -## -## -## # single trace graphics -## (self._menuitem_draw_pointset, id_item,) = menubar.append_item( -## 'plugins/traces/show selected datapoints in Network', -## self.on_renew_objectbrowser, -## info='Enable visualization of datasets in network. Double-click on trace in table', -## check=True) -## self._menuitem_draw_pointset.Check(False) -## -## (self._menuitem_plot_pointset, id_item,) = menubar.append_item( -## 'plugins/traces/add plot selected datapoints', -## self.on_renew_objectbrowser, -## info='Enable adding of datasets to graphics in trace tab. Double-click on trace in table.', -## check=True) -## self._menuitem_plot_pointset.Check(False) -## -## (self._menuitem_plot_weight, id_item,) = menubar.append_item( -## 'plugins/traces/plot selected edge weights', -## self.on_renew_objectbrowser, +## +## +# single trace graphics +# (self._menuitem_draw_pointset, id_item,) = menubar.append_item( +## 'plugins/traces/show selected datapoints in Network', +# self.on_renew_objectbrowser, +## info='Enable visualization of datasets in network. Double-click on trace in table', +# check=True) +# self._menuitem_draw_pointset.Check(False) +## +# (self._menuitem_plot_pointset, id_item,) = menubar.append_item( +## 'plugins/traces/add plot selected datapoints', +# self.on_renew_objectbrowser, +## info='Enable adding of datasets to graphics in trace tab. Double-click on trace in table.', +# check=True) +# self._menuitem_plot_pointset.Check(False) +## +# (self._menuitem_plot_weight, id_item,) = menubar.append_item( +## 'plugins/traces/plot selected edge weights', +# self.on_renew_objectbrowser, ## info='Enable adding of edge weights to graphics in trace tab. Double-click on trace in table.', -## check=True) -## self._menuitem_plot_weight.Check(False) -## -## (self._menuitem_draw_route, id_item,) = menubar.append_item( -## 'plugins/traces/draw selected route in network', -## self.on_renew_objectbrowser, +# check=True) +# self._menuitem_plot_weight.Check(False) +## +# (self._menuitem_draw_route, id_item,) = menubar.append_item( +## 'plugins/traces/draw selected route in network', +# self.on_renew_objectbrowser, ## info='Enable visualization of routes in network tab. Double-click on trace in table.', -## check=True) -## self._menuitem_draw_route.Check(False) -## -## (self._menuitem_plot_route, id_item,) = menubar.append_item( -## 'plugins/traces/add plot selected route', -## self.on_renew_objectbrowser, +# check=True) +# self._menuitem_draw_route.Check(False) +## +# (self._menuitem_plot_route, id_item,) = menubar.append_item( +## 'plugins/traces/add plot selected route', +# self.on_renew_objectbrowser, ## info='Enable adding of routes to graphics in trace tab. Double-click on trace in table.', -## check=True) -## self._menuitem_plot_route.Check(False) -## -## -## -## -## -## -## -## -## +# check=True) +# self._menuitem_plot_route.Check(False) +## +## +## +## +## +## +## +## +## ## menubar.append_item('plugins/traces/clear all plots and graphics', self.on_clear_plots, info='Clear plots in trace and network tab.') -## +## ## menubar.append_item('plugins/traces/delete all', self.on_delete_all, info='Delete all traces and intermediate results.') -## - - - - +## + def on_browse_obj(self, event=None): self._mainframe.browse_obj(self._module) #self._mainframe.change_obj(self._module, func_choose_id = self.on_select_trace) #self.write_to_statusbar('%d traces in GPS trace table.'%len(self._traces),'message') - - - - \ No newline at end of file diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/objpanel.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/objpanel.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/objpanel.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/objpanel.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,17 +1,21 @@ # cd /home/joerg/projects/sumopy/tools/sumopy/wxpython # python objpanel.py -import sys, os, types +import sys +import os +import types -import time, random, string +import time +import random +import string import numpy as np import wx import wx.lib as wxlib -import wx.grid as gridlib +import wx.grid as gridlib from wx.lib import scrolledpanel, hyperlink, colourdb, masked -import wx.lib.editor as editor -import wx.lib.colourselect as coloursel +import wx.lib.editor as editor +import wx.lib.colourselect as coloursel from collections import OrderedDict havePopupWindow = 1 if wx.Platform == '__WXMAC__': @@ -19,37 +23,38 @@ wx.PopupWindow = wx.PopupTransientWindow = wx.Window - if __name__ == '__main__': - APPDIR = os.path.join(os.path.dirname(__file__),"..","..") + APPDIR = os.path.join(os.path.dirname(__file__), "..", "..") sys.path.append(APPDIR) -IMAGEDIR = os.path.join(os.path.dirname(__file__),'images') - -from wxmisc import KEYMAP, AgilePopupMenu, AgileToolbarMixin,get_tablecolors +IMAGEDIR = os.path.join(os.path.dirname(__file__), 'images') + +from wxmisc import KEYMAP, AgilePopupMenu, AgileToolbarMixin, get_tablecolors # used for demo: -import wx.py as py # pyshell +import wx.py as py # pyshell wildcards_all = "All files (*.*)|*.*" provider = wx.SimpleHelpProvider() wx.HelpProvider_Set(provider) import agilepy.lib_base.classman as cm -from agilepy.lib_base.misc import filepathlist_to_filepathstring,filepathstring_to_filepathlist +from agilepy.lib_base.misc import filepathlist_to_filepathstring, filepathstring_to_filepathlist -METATYPES_LINKSTYLE = ('obj','id','tabid','ids') +METATYPES_LINKSTYLE = ('obj', 'id', 'tabid', 'ids') -def list_to_str(l,lb='',rb=''): - #print 'list_to_str',l,len(l) - if len(l)==0: - return lb+rb + +def list_to_str(l, lb='', rb=''): + # print 'list_to_str',l,len(l) + if len(l) == 0: + return lb + rb else: - s=lb + s = lb for e in l[:-1]: - s+=unicode(e)+',' - #print ' returns',s+unicode(l[-1])+rb - return s+unicode(l[-1])+rb + s += unicode(e) + ',' + # print ' returns',s+unicode(l[-1])+rb + return s + unicode(l[-1]) + rb + def is_list_flat(l): is_flat = True @@ -59,7 +64,8 @@ break return is_flat -def str_to_list(s,lb='[',rb=']'): + +def str_to_list(s, lb='[', rb=']'): """ Tries to convert a string to a flat list. Attention, this conversion is extremely tolerant. @@ -69,42 +75,41 @@ trying to convert numbers in integers or floats """ s = s.strip() - if len(s)>=2: - if (s[0]==lb)&(s[-1]==rb): # are there braces + if len(s) >= 2: + if (s[0] == lb) & (s[-1] == rb): # are there braces sl = s[1:-1].split(',') else: - sl = s.split(',')# no braces, but could still be a list + sl = s.split(',') # no braces, but could still be a list else: sl = s.split(',') - - if (len(sl)==1)&(sl[0]==''): + + if (len(sl) == 1) & (sl[0] == ''): return [] - + l = [] for e in sl: l.append(str_to_obj(e)) - #print 'str_to_list',s,l + # print 'str_to_list',s,l return l - - + def str_to_tuple(s): - return str_to_list(s,lb='(',rb=')') + return str_to_list(s, lb='(', rb=')') def str_to_obj(s): """ Only for flat objects at the moment """ - #print 'str_to_obj',type(s),s - s=s.strip() - if len(s)==0: + # print 'str_to_obj',type(s),s + s = s.strip() + if len(s) == 0: return '' - - if s[0]==s[-1]: - if s[0] in("'",'"'): + + if s[0] == s[-1]: + if s[0] in("'", '"'): s = s[1:-1] - #print 'str_to_obj',s,len(s),type(s),s.isdigit(),s.isalnum() + # print 'str_to_obj',s,len(s),type(s),s.isdigit(),s.isalnum() if s.isdigit(): return string.atoi(s) else: @@ -113,18 +118,19 @@ except: return s + def str_to_obj_nested(s): """ NOT WORKING, NOT IN USE Only for flat objects at the moment """ - #print 'str_to_obj',s + # print 'str_to_obj',s x = str_to_list(s) # print ' ',x if x == None: x = str_to_tuple(s) if x == None: - #if type(s) == types.StringType: + # if type(s) == types.StringType: if s.isdigit(): return string.atoi(s) elif s.isalnum(): @@ -136,93 +142,94 @@ return s else: return x - + else: return x - + + class AttrBase: + """ Mixin class that provides methods to support text representation of attributes """ - - - def num_to_text(self,value,attr,obj): + + def num_to_text(self, value, attr, obj): """ Returns string of a numeric value taking account of formating info for this defined in obj. """ pass - - - def color_to_ffffff(self,color): + + def color_to_ffffff(self, color): """ Returns a 3- tuple with values for rgb between 0 and 255. Takes an array or list with rgb values between 0.0 and 1.0. """ - #print 'color_to_ffffff',color - return (color[0],color[1],color[2]) - - def ffffff_to_color(self,ffffff): + # print 'color_to_ffffff',color + return (color[0], color[1], color[2]) + + def ffffff_to_color(self, ffffff): """ Returns an array with rgb values between 0.0 and 1.0. Returns a 3- tople with values for rgb between 0 and 255. - + """ - #print 'ffffff_to_color',ffffff,type(ffffff),type(array(ffffff,float)/255.0) - return np.array(ffffff,float)/255.0 - #return np.array(ffffff,int) - + # print + # 'ffffff_to_color',ffffff,type(ffffff),type(array(ffffff,float)/255.0) + return np.array(ffffff, float) / 255.0 + # return np.array(ffffff,int) + + class WidgetContainer: + """ Contains one or several widgets representing a scalar attribute. Should be overwritten to accomodate various interactive datatypes. Default is simple text. - + """ - + def __init__(self, parent, attrconf, mainframe=None, color_bg=None, - panelstyle = 'default', immediate_apply = False, - equalchar = ':'): + panelstyle='default', immediate_apply=False, + equalchar=':'): """ Parent is the ScalarPanel panel, attr is the attribute name in parent.obj """ self.parent = parent - self.panelstyle = panelstyle - self.immediate_apply = immediate_apply - self._attrconf = attrconf + self.panelstyle = panelstyle + self.immediate_apply = immediate_apply + self._attrconf = attrconf self.equalchar = equalchar - + self.mainframe = mainframe - + if color_bg == None: self.color_bg = wx.NamedColour('grey85') else: self.color_bg = color_bg - - #self.widgets=[] - #self.untitwidget=None - #self.valuewidget=None - #self.bitmapwidget=None - + + # self.widgets=[] + # self.untitwidget=None + # self.valuewidget=None + # self.bitmapwidget=None + self.create_widgets(self.define_widgetset()) - - - -#------------------------------------------------------------------------------- - # the following methods are usually overwritten to create - # attribute specific widgets - + + +#------------------------------------------------------------------------- + # the following methods are usually overwritten to create + # attribute specific widgets + def define_widgetset(self): """ Generates the widgets representing this attribute. To be overwritten. """ - return [ ('name', self.create_namewidget(), wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL), - ('value', self.create_valuewidget(), wx.EXPAND),] - - + return [('name', self.create_namewidget(), wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL), + ('value', self.create_valuewidget(), wx.EXPAND), ] + def get_valuewidget_write(self): """ Returns instance of editable widget @@ -231,7 +238,7 @@ # if non is returned attribute is not editable # even though permission is set to write return None - + def get_valuewidget_read(self): """ Returns instance of non-editable widget @@ -239,67 +246,68 @@ """ #text = '%s%s'%(self._attrconf.format_value(),self._attrconf.format_unit()) - text = self.format_value_obj(show_unit = True, show_parentesis=False) + text = self.format_value_obj(show_unit=True, show_parentesis=False) # if not editable, no unitwidgetcontainer will be created so we need unit - #if len(text)>40: + # if len(text)>40: # text=text[:10]+'...'+text[-10:] #widget=wx.StaticText(self.parent, -1, text,style=wx.ALIGN_RIGHT) #,style= wx.ALIGN_RIGHT #widget=wx.StaticText(self.parent, -1,'TEST!',style=wx.ALIGN_RIGHT) - #print ' value,widget',string_value,widget - - #no, showed only first character + # print ' value,widget',string_value,widget + + # no, showed only first character #widget = editor.Editor(self.parent, -1, style=wx.SUNKEN_BORDER) - #widget.SetText(text) - #print 'get_valuewidget_read',self._attrconf.attrname - #print ' text RET',text.find('n'),':\n',text - if text.find('n')>0: - widget = wx.TextCtrl( self.parent, -1, str(text),style= wx.ALIGN_LEFT|wx.TE_MULTILINE|wx.TE_READONLY) - else: - widget = wx.TextCtrl( self.parent, -1, str(text),style= wx.ALIGN_LEFT|wx.TE_READONLY) - #self.set_textevents(widget) - - + # widget.SetText(text) + # print 'get_valuewidget_read',self._attrconf.attrname + # print ' text RET',text.find('n'),':\n',text + if text.find('n') > 0: + widget = wx.TextCtrl( + self.parent, -1, str(text), style=wx.ALIGN_LEFT | wx.TE_MULTILINE | wx.TE_READONLY) + else: + widget = wx.TextCtrl(self.parent, -1, str(text), + style=wx.ALIGN_LEFT | wx.TE_READONLY) + # self.set_textevents(widget) + widget.Enable(False) - + return widget - + def get_widgetvalue(self): """ Returnes current value from valuewidget. Depends on attribute type and hence widgettype. To be overwritten. - """ - return None #self.widgets['value'][0].GetLabel() - - def set_widgetvalue(self,value): + """ + return None # self.widgets['value'][0].GetLabel() + + def set_widgetvalue(self, value): """ Sets value for valuewidget. Depends on attribute type and hence widgettype. To be overwritten. - """ + """ text = str(value) - #if len(text)>40: + # if len(text)>40: # text=text[:10]+'...'+text[-10:] - if hasattr(self.widgets['value'][0],'SetValue'): - self.widgets['value'][0].SetValue(text) - - #OR? - #if self._attrconf.is_writable(): + if hasattr(self.widgets['value'][0], 'SetValue'): + self.widgets['value'][0].SetValue(text) + + # OR? + # if self._attrconf.is_writable(): # self.widgets['value'][0].SetValue(value) - #else: - + # else: + # OR? - #if hasattr(self.widgets['value'][0],'SetValue'): - # self.widgets['value'][0].SetValue(str(value)) - #elif hasattr(self.widgets['value'][0],'SetText'): + # if hasattr(self.widgets['value'][0],'SetValue'): + # self.widgets['value'][0].SetValue(str(value)) + # elif hasattr(self.widgets['value'][0],'SetText'): # print 'set_widgetvalue mixin',type(value),value - # self.widgets['value'][0].SetText(str(value)) - #self.valuewidget.SetLabel(str(value)) - -#------------------------------------------------------------------------------- + # self.widgets['value'][0].SetText(str(value)) + # self.valuewidget.SetLabel(str(value)) + +#------------------------------------------------------------------------- # these methods are normally not overwritten - + def create_valuewidget(self): """ Returns widget representing the value of attribute. @@ -307,80 +315,82 @@ get_valuewidget_write or get_valuewidget_read will be called to generate the widget. """ - #print 'create_valuewidget for',self._attrconf.attrname,'is_writable=',self._attrconf.is_writable() - + # print 'create_valuewidget + # for',self._attrconf.attrname,'is_writable=',self._attrconf.is_writable() + if self._attrconf.is_writable(): # in write mode unit widget should be created separately - widget=self.get_valuewidget_write() - if widget==None: - #print ' editable valuewidget not available' - widget=self.get_valuewidget_read() + widget = self.get_valuewidget_write() + if widget == None: + # print ' editable valuewidget not available' + widget = self.get_valuewidget_read() else: - widget=self.get_valuewidget_read() - + widget = self.get_valuewidget_read() + self.set_tooltip(widget) self.extend_widgetsize(widget) - self.valuewidget=widget + self.valuewidget = widget return widget - - + def create_namewidget(self): - #if self._attrconf.get_obj().ident =='vehicles': - #print 'create_namewidget',self._attrconf.get_obj().ident,self._attrconf.attrname - widget=wx.StaticText( self.parent, -1, - self._attrconf.get_name().title()+self.equalchar, - style= wx.ALIGN_RIGHT #|wx.SIMPLE_BORDER #wx.STATIC_BORDER # - ) - widget.SetBackgroundColour(self.color_bg) + # if self._attrconf.get_obj().ident =='vehicles': + # print + # 'create_namewidget',self._attrconf.get_obj().ident,self._attrconf.attrname + widget = wx.StaticText(self.parent, -1, + self._attrconf.get_name().title() + + self.equalchar, + # |wx.SIMPLE_BORDER #wx.STATIC_BORDER # + style=wx.ALIGN_RIGHT + ) + widget.SetBackgroundColour(self.color_bg) self.extend_widgetsize(widget) - #widget.SetMinSize((-1,20)) - + # widget.SetMinSize((-1,20)) + # - + self.set_tooltip(widget) - - return widget - - + + return widget + def create_unitwidget(self): if self._attrconf.has_unit(): - widget=wx.StaticText( self.parent, -1, - self._attrconf.format_unit(), - style= wx.ALIGN_LEFT# |wx.SIMPLE_BORDER #wx.STATIC_BORDER #| # - ) + widget = wx.StaticText(self.parent, -1, + self._attrconf.format_unit(), + # |wx.SIMPLE_BORDER #wx.STATIC_BORDER #| # + style=wx.ALIGN_LEFT + ) widget.SetBackgroundColour(self.color_bg) self.extend_widgetsize(widget) - #print 'create_unitwidget', self.config_attr['unit'] + # print 'create_unitwidget', self.config_attr['unit'] return widget - + else: - return (0,0) - - def extend_widgetsize(self,widget,xborder=3,yborder=3): + return (0, 0) + + def extend_widgetsize(self, widget, xborder=3, yborder=3): """ Extends the widget by incresing its minimum size by border in pixels. """ - s=widget.GetSize() - widget.SetMinSize((s[0]+xborder,s[1]+yborder)) - - def create_widgets(self,widgetdata): + s = widget.GetSize() + widget.SetMinSize((s[0] + xborder, s[1] + yborder)) + + def create_widgets(self, widgetdata): """ Generates the widgets representing this attribute. """ - self.widgets={} - self.widgetnames=[] - for name,widget,align in widgetdata: - self.widgets[name]=(widget,align) + self.widgets = {} + self.widgetnames = [] + for name, widget, align in widgetdata: + self.widgets[name] = (widget, align) self.widgetnames.append(name) - - + def get_widgetnames(self): """ Returns a list with names of widgets, representing this attribute. - """ + """ return self.widgetnames - - def get_widgetsinfo(self,widgetnames=[]): + + def get_widgetsinfo(self, widgetnames=[]): """ Returns a list of widget infos representing this attribute according to the widgetnames. @@ -389,29 +399,26 @@ If widgetnames is empty then all widgets are returned in the order defined in get_widgetnames. """ - - if len(widgetnames)==0: - widgetnames=self.get_widgetnames() - - widgetsinfo=[] + + if len(widgetnames) == 0: + widgetnames = self.get_widgetnames() + + widgetsinfo = [] for name in widgetnames: - widgetsinfo.append(self.widgets.get(name,((0,0),0))) - + widgetsinfo.append(self.widgets.get(name, ((0, 0), 0))) + return widgetsinfo - - - - + def apply_obj_to_valuewidget(self): """ Value of obj is read and applied to value widget. To be overwritten. """ - value=self.get_value_obj() - #print 'apply_obj_to_valuewidget',value,self.parent.obj.ident,self.attr + value = self.get_value_obj() + # print + # 'apply_obj_to_valuewidget',value,self.parent.obj.ident,self.attr self.set_widgetvalue(value) - - + def get_value_obj(self): """ Reads current value from object. @@ -420,157 +427,155 @@ return self._attrconf[self.parent.id] else: return self._attrconf.get_value() - - + def set_value_obj(self, value): """ Sets given value to object. """ - #print 'set_value_obj',self._attrconf.attrname,self.parent.id, self._attrconf.is_colattr() - if self._attrconf.is_colattr(): # parent is holding the row id + # print 'set_value_obj',self._attrconf.attrname,self.parent.id, + # self._attrconf.is_colattr() + if self._attrconf.is_colattr(): # parent is holding the row id self._attrconf[self.parent.id] = value else: self._attrconf.set_value(value) - - - def format_value_obj(self, show_unit = False, show_parentesis=False): + + def format_value_obj(self, show_unit=False, show_parentesis=False): """ Return formatted value of object. """ - - if self._attrconf.is_colattr(): # parent is holding the row id - return self._attrconf.format_value( self.parent.id, - show_unit = show_unit, - show_parentesis=show_parentesis) - else: - #print 'format_value_obj',self._attrconf.attrname, self._attrconf.format_value( ) - return self._attrconf.format_value( show_unit = show_unit, - show_parentesis=show_parentesis) - - def apply_valuewidget_to_obj(self,value=None): + + if self._attrconf.is_colattr(): # parent is holding the row id + return self._attrconf.format_value(self.parent.id, + show_unit=show_unit, + show_parentesis=show_parentesis) + else: + # print 'format_value_obj',self._attrconf.attrname, + # self._attrconf.format_value( ) + return self._attrconf.format_value(show_unit=show_unit, + show_parentesis=show_parentesis) + + def apply_valuewidget_to_obj(self, value=None): """ Applies current value widget to object attribute. - + Makes no sense for static text. If no value argument is given then the get_widgetvalue method is called to recover widget value. - """ - #pass - # in general values maust be transferred from widget to + """ + # pass + # in general values maust be transferred from widget to # attribute of objet in the correct way. - + # self._attrconf.get_value() if self._attrconf.is_writable(): - if value==None: # value not given - value=self.get_widgetvalue() - + if value == None: # value not given + value = self.get_widgetvalue() + if value != None: # value returned by widget is valid - # print 'apply_valuewidget_to_obj',value,self.parent.obj.ident,self.attr + # print + # 'apply_valuewidget_to_obj',value,self.parent.obj.ident,self.attr self.set_value_obj(value) - + def set_textevents(self, widget): """ Sets events to text input widhets """ - #print 'set_textevents',widget - #print ' immediate_apply',self.immediate_apply + # print 'set_textevents',widget + # print ' immediate_apply',self.immediate_apply if self.immediate_apply: widget.Bind(wx.EVT_KILL_FOCUS, self.on_apply_immediate) #widget.Bind(wx.EVT_CHAR, self.on_apply_immediate) - + def on_apply_immediate(self, event): """ A key has been pressed in valuewidget and it is requested to apply it immediately to the object - """ - #print 'on_apply_immediate' + """ + # print 'on_apply_immediate' self.apply_valuewidget_to_obj() - + def get_obj(self): """ Returns object to be displayed on panel. """ return self._attrconf.get_obj() - - #def get_pentable(self): + + # def get_pentable(self): # """ # Returns pentable instance # """ # return self.parent.get_pentable() - - def get_objvalue(self): + + def get_objvalue(self): """ Read current value from object and convert into string. Depends on attribute type and hence widgettype. To be overwritten. - """ + """ if self._attrconf.is_colattr(): - value = self._attrconf[self.parent.id] - + value = self._attrconf[self.parent.id] + else: - #print 'get_objvalue',self.attr,self.parent.obj + # print 'get_objvalue',self.attr,self.parent.obj value = self._attrconf.get_value() - - #print ' value=',value + + # print ' value=',value return value - - def set_tooltip(self,widget=None): - + + def set_tooltip(self, widget=None): + # TODO : check for global tooltip on/off if self._attrconf.has_info(): - #print 'set_tooltip',self.attr,self.config_attr['info'] + # print 'set_tooltip',self.attr,self.config_attr['info'] widget.SetToolTipString(self._attrconf.get_info()) widget.SetHelpText(self._attrconf.get_info()) +class NumericWidgetContainer(AttrBase, WidgetContainer): -class NumericWidgetContainer(AttrBase,WidgetContainer): """ Contains one or several widgets representing a scalar numeric attribute. - + """ - - - + def define_widgetset(self): """ Generates the widgets representing this attribute. """ - if self._attrconf.has_unit(): - #print 'define_widgetset num +unit',self._attrconf.attrname - return [ ('name', self.create_namewidget(), wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL), - ('value', self.create_valuewidget(), wx.EXPAND), - ('unit', self.create_unitwidget(), wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL),] - else: - #print 'define_widgetset num ',self._attrconf.attrname - return [ ('name', self.create_namewidget(), wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL), - ('value', self.create_valuewidget(), wx.EXPAND)] - - + if self._attrconf.has_unit(): + # print 'define_widgetset num +unit',self._attrconf.attrname + return [('name', self.create_namewidget(), wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL), + ('value', self.create_valuewidget(), wx.EXPAND), + ('unit', self.create_unitwidget(), wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL), ] + else: + # print 'define_widgetset num ',self._attrconf.attrname + return [('name', self.create_namewidget(), wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL), + ('value', self.create_valuewidget(), wx.EXPAND)] + def get_valuewidget_read(self): """ Returns instance of non-editable widget To be overwritten. """ - widget=self.get_valuewidget_write() + widget = self.get_valuewidget_write() widget.Enable(False) - # Here just the plain static text widget is returned - - #printformat=self.get_printformat_fortran(self.attr,self.parent.obj,main=self.mainframe) - + # Here just the plain static text widget is returned + + # printformat=self.get_printformat_fortran(self.attr,self.parent.obj,main=self.mainframe) + #value = printformat%value - + # add unit if exist - #print 'get_valuewidget_read with unit:',self.parent.obj.get_unit(self.attr) - #if self.parent.obj.get_unit(self.attr)!='': + # print 'get_valuewidget_read with unit:',self.parent.obj.get_unit(self.attr) + # if self.parent.obj.get_unit(self.attr)!='': # value+=' '+self.parent.obj.get_unit(self.attr) - - #print 'create_valuewidget: '+value,self.attr + + # print 'create_valuewidget: '+value,self.attr #widget=wx.StaticText(self.parent, wx.ID_ANY, self.format_value_obj(),style=wx.ALIGN_RIGHT) - + return widget - + def get_valuewidget_write(self): """ Return widget to edit numeric value of attribute @@ -579,70 +584,68 @@ value = self.get_value_obj() # strange way to convert numpy type numbers into native python numbers if type(value) not in (types.IntType, types.LongType, types.FloatType, types.ComplexType): - value=value.tolist() - #print 'NumericWidgetContainer.get_valuewidget_write ',value,type(value),self._attrconf.digits_fraction - - #if self._attrconf.digits_fraction == None: + value = value.tolist() + # print 'NumericWidgetContainer.get_valuewidget_write + # ',value,type(value),self._attrconf.digits_fraction + + # if self._attrconf.digits_fraction == None: # self._attrconf.digits_fraction = 3 - - - #print ' panelstyle=',self.panelstyle - #print ' value=',value + + # print ' panelstyle=',self.panelstyle + # print ' value=',value # numpy returns dtype... even for scalars # make sure to convert value in a native python scalar - #if value == None: - #value=NaN - #elif type(value) not in (types.IntType, types.LongType, types.FloatType): + # if value == None: + # value=NaN + # elif type(value) not in (types.IntType, types.LongType, types.FloatType): # value=value.tolist() - - #if self.config_attr['min']==None: + + # if self.config_attr['min']==None: allow_negative = True - #else: + # else: # allow_negative = self.config_attr['min'] < 0.0 - + #min = self.config_attr['min'] #max = self.config_attr['max'] - - - - #if min == None: + + # if min == None: # if value<0: # min = -5*value # else: # min = 0 - # - #if max == None: + # + # if max == None: # max = 5*abs(value) - + if np.isinf(value): - widget=wx.StaticText( self.parent, -1, - value.__repr__(), - style= wx.ALIGN_LEFT# |wx.SIMPLE_BORDER #wx.STATIC_BORDER #| # - ) - #widget.SetBackgroundColour(self.color_bg) + widget = wx.StaticText(self.parent, -1, + value.__repr__(), + # |wx.SIMPLE_BORDER #wx.STATIC_BORDER #| # + style=wx.ALIGN_LEFT + ) + # widget.SetBackgroundColour(self.color_bg) self.extend_widgetsize(widget) - #print 'create_unitwidget', self.config_attr['unit'] + # print 'create_unitwidget', self.config_attr['unit'] return widget - - - #if self.panelstyle == 'fancy': #'instrumental': + + # if self.panelstyle == 'fancy': #'instrumental': # print 'NumericWidgetContainer.get_valuewidget_write fancy mode' # print 'TODO: no bindings yet for immediate apply' # slider = wx.Slider(self.parent, wx.ID_ANY, - # value, - # min, max, - # style=wx.SL_HORIZONTAL| wx.SL_AUTOTICKS - # #style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS + # value, + # min, max, + # style=wx.SL_HORIZONTAL| wx.SL_AUTOTICKS + # #style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS # ) - # + # # slider.SetTickFreq(5, 1) # return slider - - #else: - - widget = wx.TextCtrl( self.parent, -1, str(value),style= wx.ALIGN_RIGHT) + + # else: + + widget = wx.TextCtrl(self.parent, -1, str(value), style=wx.ALIGN_RIGHT) # standard numerical widget - #widget = masked.Ctrl(self.parent, id = -1, + # widget = masked.Ctrl(self.parent, id = -1, # value = value, # #integerWidth=None, # fractionWidth = self._attrconf.digits_fraction, @@ -650,7 +653,7 @@ # controlType=masked.controlTypes.NUMBER, # style= wx.ALIGN_RIGHT # ) - #widget = masked.NumCtrl( + # widget = masked.NumCtrl( # self.parent, id = -1, # value = value, # pos = wx.DefaultPosition, @@ -680,124 +683,125 @@ # ) self.set_textevents(widget) return widget - - + def get_widgetvalue(self): """ Returnes current value from valuewidget. Depends on attribute type and hence widgettype. To be overwritten. - """ + """ return float(self.valuewidget.GetValue()) - - def set_widgetvalue(self,value): + + def set_widgetvalue(self, value): """ Sets value for valuewidget. Depends on attribute type and hence widgettype. To be overwritten. - """ - if 1:#self._attrconf.is_writable(): + """ + if 1: # self._attrconf.is_writable(): # set value to label # numpy returns dtype... even for scalars # make sure to convert value in a native python scalar if type(value) not in (types.IntType, types.LongType, types.FloatType): - value=value.tolist() + value = value.tolist() self.valuewidget.SetValue(str(value)) class IntegerWidgetContainer(NumericWidgetContainer): + """ Contains one or several widgets representing a scalar numeric attribute. - + """ + def get_valuewidget_write(self): """ Return widget to edit numeric value of attribute This is effectively the parametrisation of the masked.NumCtrl widget. """ - #if self.panelstyle == 'instrumental': + # if self.panelstyle == 'instrumental': # # return a spin control in instrumental style # sc = wx.SpinCtrl(self.parent, wx.ID_ANY, "", (30, 50)) # sc.SetRange(self.config_attr['min'],self.config_attr['max']) # sc.SetValue(value) # return sc - #else: + # else: # use standard numerical masked text otherwise return NumericWidgetContainer.get_valuewidget_write(self) - + def get_widgetvalue(self): """ Returnes current value from valuewidget. Depends on attribute type and hence widgettype. To be overwritten. - """ - return int(self.valuewidget.GetValue()) - -class BooleanWidgetContainer(AttrBase,WidgetContainer): + """ + return int(self.valuewidget.GetValue()) + + +class BooleanWidgetContainer(AttrBase, WidgetContainer): + """ Contains one or several widgets representing a boolean attribute. - + """ - - - + def define_widgetset(self): """ Generates the widgets representing this attribute. """ - return [ ('name', self.create_namewidget(), wx.ALIGN_RIGHT), - ('value', self.create_valuewidget(), wx.EXPAND), - ('unit', self.create_unitwidget(), wx.ALIGN_LEFT),] - + return [('name', self.create_namewidget(), wx.ALIGN_RIGHT), + ('value', self.create_valuewidget(), wx.EXPAND), + ('unit', self.create_unitwidget(), wx.ALIGN_LEFT), ] + def get_valuewidget_read(self): """ Returns instance of non-editable widget To be overwritten. """ - widget=self.get_valuewidget_write() + widget = self.get_valuewidget_write() widget.Enable(False) - + return widget - + def get_valuewidget_write(self): """ Return widget to edit numeric value of attribute This is effectively the parametrisation of the masked.NumCtrl widget. """ - #print 'get_numeditwidget',value - - widget= wx.CheckBox(self.parent,-1) + # print 'get_numeditwidget',value + + widget = wx.CheckBox(self.parent, -1) if self.immediate_apply: self.parent.Bind(wx.EVT_CHECKBOX, self.on_apply_immediate, widget) value = self.get_value_obj() widget.SetValue(value) - return widget - - - + return widget + def get_widgetvalue(self): """ Returnes current value from valuewidget. Depends on attribute type and hence widgettype. To be overwritten. - """ + """ return self.valuewidget.GetValue() - - def set_widgetvalue(self,value): + + def set_widgetvalue(self, value): """ Sets value for valuewidget. Depends on attribute type and hence widgettype. To be overwritten. - """ - #if self._attrconf.is_writable(): + """ + # if self._attrconf.is_writable(): self.valuewidget.SetValue(value) - + + class ChoiceWidgetContainer(WidgetContainer): + """ Contains one or several widgets representing a text attribute. - + """ - + def define_widgetset(self): """ Generates the widgets representing this attribute. @@ -807,298 +811,288 @@ self._choicenames = self._attrconf.choices.keys() else: self._choicevalues = list(self._attrconf.choices) - self._choicenames = list(self._attrconf.choices) - #if type(self._attrconf.choices) in [types.ListType,types.TupleType,numpy.ndarray]: - - - - - if self._attrconf.has_unit() & self._attrconf.is_writable(): - return [ ('name', self.create_namewidget(), wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL), - ('value', self.create_valuewidget(), wx.EXPAND), - ('unit', self.create_unitwidget(), wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL),] - else: - return [ ('name', self.create_namewidget(), wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL), - ('value', self.create_valuewidget(), wx.EXPAND)] - + self._choicenames = list(self._attrconf.choices) + # if type(self._attrconf.choices) in + # [types.ListType,types.TupleType,numpy.ndarray]: + + if self._attrconf.has_unit() & self._attrconf.is_writable(): + return [('name', self.create_namewidget(), wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL), + ('value', self.create_valuewidget(), wx.EXPAND), + ('unit', self.create_unitwidget(), wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL), ] + else: + return [('name', self.create_namewidget(), wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL), + ('value', self.create_valuewidget(), wx.EXPAND)] + def get_valuewidget_read(self): """ Return widget to read only numeric value of attribute This is effectively the parametrisation of the masked.NumCtrl widget. """ value = self.get_value_obj() - #print 'ChoiceWidgetContainer.get_valuewidget_read',value,type(value) - #print ' choices',self._attrconf.choices - + # print 'ChoiceWidgetContainer.get_valuewidget_read',value,type(value) + # print ' choices',self._attrconf.choices + if type(self._attrconf.choices) in (OrderedDict, types.DictionaryType): #value = self._attrconf.choices[value] - value =self._choicenames[self._choicevalues.index(value)] - #print ' value =',value - widget = wx.TextCtrl( self.parent, -1, value,style= wx.ALIGN_RIGHT) + value = self._choicenames[self._choicevalues.index(value)] + # print ' value =',value + widget = wx.TextCtrl(self.parent, -1, value, style=wx.ALIGN_RIGHT) widget.Enable(False) return widget - - - - - + def get_valuewidget_write(self): """ Return widget to edit numeric value of attribute This is effectively the parametrisation of the masked.NumCtrl widget. """ - + value = self.get_value_obj() - #print 'ChoiceWidgetContainer.get_valuewidget_read',self._attrconf.attrname, value,type(value) - #print ' choices',self._attrconf.choices - #print ' self._choicenames',self._choicenames - #print ' self._choicevalues',self._choicevalues - widget = wx.Choice(self.parent, -1, (100, 50), choices = self._choicenames) + # print 'ChoiceWidgetContainer.get_valuewidget_read',self._attrconf.attrname, value,type(value) + # print ' choices',self._attrconf.choices + # print ' self._choicenames',self._choicenames + # print ' self._choicevalues',self._choicevalues + widget = wx.Choice(self.parent, -1, (100, 50), + choices=self._choicenames) if self.immediate_apply: self.parent.Bind(wx.EVT_CHOICE, self.on_apply_immediate, widget) ind = self._choicevalues.index(value) widget.SetSelection(ind) - + return widget - - def get_widgetvalue(self): """ Returnes current value from valuewidget. Depends on attribute type and hence widgettype. To be overwritten. - """ + """ val = self.valuewidget.GetSelection() - #if self._choicevalues.count(val)>0: + # if self._choicevalues.count(val)>0: return self._choicevalues[val] - #else: + # else: # return val - - def set_widgetvalue(self,val): + + def set_widgetvalue(self, val): """ Sets value for valuewidget. Depends on attribute type and hence widgettype. To be overwritten. - """ - #print 'set_widgetvalue',val,self._choicevalues - #if self._choicevalues.count(val)>0: + """ + # print 'set_widgetvalue',val,self._choicevalues + # if self._choicevalues.count(val)>0: #ind = self._choicevalues.index(val) - #self.valuewidget.SetSelection(ind) - #else: - #self.valuewidget.SetValue(val) - + # self.valuewidget.SetSelection(ind) + # else: + # self.valuewidget.SetValue(val) + try: #ind = self._choicenames.index(value) ind = self._choicevalues.index(val) except: - print 'WARNING ChoiceWidgetContainer.set_widgetvalue: value "%s" not in choice list'%val + print 'WARNING ChoiceWidgetContainer.set_widgetvalue: value "%s" not in choice list' % val return - ##print 'set_widgetvalue',self._attrconf.attrname,value,ind + # print 'set_widgetvalue',self._attrconf.attrname,value,ind self.valuewidget.SetSelection(ind) - class TextWidgetContainer(WidgetContainer): + """ Contains one or several widgets representing a text attribute. - + """ - + def define_widgetset(self): """ Generates the widgets representing this attribute. """ - if self._attrconf.has_unit() & self._attrconf.is_writable(): - return [ ('name', self.create_namewidget(), wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL), - ('value', self.create_valuewidget(), wx.EXPAND), - ('unit', self.create_unitwidget(), wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL),] - else: - return [ ('name', self.create_namewidget(), wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL), - ('value', self.create_valuewidget(), wx.EXPAND)] - + if self._attrconf.has_unit() & self._attrconf.is_writable(): + return [('name', self.create_namewidget(), wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL), + ('value', self.create_valuewidget(), wx.EXPAND), + ('unit', self.create_unitwidget(), wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL), ] + else: + return [('name', self.create_namewidget(), wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL), + ('value', self.create_valuewidget(), wx.EXPAND)] + def get_valuewidget_read(self): """ Return widget to read only numeric value of attribute This is effectively the parametrisation of the masked.NumCtrl widget. """ - #print 'TextWidgetContainer.get_valuewidget_read' - #widget=self.get_valuewidget_write() + # print 'TextWidgetContainer.get_valuewidget_read' + # widget=self.get_valuewidget_write() value = self.get_value_obj() - widget = wx.TextCtrl( self.parent, -1, value,style= wx.ALIGN_RIGHT|wx.TE_READONLY) + widget = wx.TextCtrl(self.parent, -1, value, + style=wx.ALIGN_RIGHT | wx.TE_READONLY) widget.Enable(False) - - - + return widget - + def get_valuewidget_write(self): """ Return widget to edit numeric value of attribute This is effectively the parametrisation of the masked.NumCtrl widget. """ - + value = self.get_value_obj() - #print 'get_editwidget text',value,type(value) + # print 'get_editwidget text',value,type(value) - widget = wx.TextCtrl( self.parent, -1, value,style= wx.ALIGN_RIGHT) + widget = wx.TextCtrl(self.parent, -1, value, style=wx.ALIGN_RIGHT) self.set_textevents(widget) return widget #self.MultiLine = wx.TextCtrl(parent = panel, id = -1, pos = (38, 70), size = (410, 90), style = wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_AUTO_URL) - - def get_widgetvalue(self): """ Returnes current value from valuewidget. Depends on attribute type and hence widgettype. To be overwritten. - """ + """ return self.widgets['value'][0].GetValue() - - def set_widgetvalue(self,value): + + def set_widgetvalue(self, value): """ Sets value for valuewidget. Depends on attribute type and hence widgettype. To be overwritten. - """ - #print 'set_widgetvalue',dir(self.widgets['value'][0]) + """ + # print 'set_widgetvalue',dir(self.widgets['value'][0]) self.widgets['value'][0].SetValue(value) - class ListWidgetContainer(WidgetContainer): + """ Contains one or several widgets representing a text attribute. - + """ - + def define_widgetset(self): """ Generates the widgets representing this attribute. """ - if self._attrconf.has_unit() & self._attrconf.is_writable(): - return [ ('name', self.create_namewidget(), wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL), - ('value', self.create_valuewidget(), wx.EXPAND), - ('unit', self.create_unitwidget(), wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL),] - else: - return [ ('name', self.create_namewidget(), wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL), - ('value', self.create_valuewidget(), wx.EXPAND)] - - #def get_valuewidget_read(self): + if self._attrconf.has_unit() & self._attrconf.is_writable(): + return [('name', self.create_namewidget(), wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL), + ('value', self.create_valuewidget(), wx.EXPAND), + ('unit', self.create_unitwidget(), wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL), ] + else: + return [('name', self.create_namewidget(), wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL), + ('value', self.create_valuewidget(), wx.EXPAND)] + + # def get_valuewidget_read(self): # """ # Return widget to read only numeric value of attribute # This is effectively the parametrisation of the masked.NumCtrl widget. # """ # value = self.get_value_obj() # #print 'ListWidgetContainer',value - # + # # widget = wx.TextCtrl( self.parent, -1, list_to_str(list(value)),style= wx.ALIGN_RIGHT|wx.TE_MULTILINE|wx.TE_READONLY) # self.set_textevents(widget) # widget.Enable(False) # return widget - + def get_valuewidget_write(self): """ Return widget to edit numeric value of attribute This is effectively the parametrisation of the masked.NumCtrl widget. """ - + value = list_to_str(self.get_value_obj()) if is_list_flat(value): - widget = wx.TextCtrl( self.parent, -1, value,style= wx.ALIGN_LEFT|wx.TE_MULTILINE) - else:# only flat lists can be edited :( - widget = wx.TextCtrl( self.parent, -1, value,style= wx.ALIGN_RIGHT|wx.TE_MULTILINE) + widget = wx.TextCtrl(self.parent, -1, value, + style=wx.ALIGN_LEFT | wx.TE_MULTILINE) + else: # only flat lists can be edited :( + widget = wx.TextCtrl(self.parent, -1, value, + style=wx.ALIGN_RIGHT | wx.TE_MULTILINE) widget.Enable(False) - + self.set_textevents(widget) return widget - - def get_widgetvalue(self): """ Returnes current value from valuewidget. Depends on attribute type and hence widgettype. To be overwritten. - """ - #print 'get_widgetvalue', self.widgets['value'][0].GetValue() - #print ' returns', str_to_list(self.widgets['value'][0].GetValue()) + """ + # print 'get_widgetvalue', self.widgets['value'][0].GetValue() + # print ' returns', str_to_list(self.widgets['value'][0].GetValue()) return str_to_list(self.widgets['value'][0].GetValue()) - - def set_widgetvalue(self,value): + + def set_widgetvalue(self, value): """ Sets value for valuewidget. Depends on attribute type and hence widgettype. To be overwritten. - """ - #print 'set_widgetvalue',value,is_list_flat(value) - if is_list_flat(value):#&self._attrconf.is_editable(): + """ + # print 'set_widgetvalue',value,is_list_flat(value) + if is_list_flat(value): # &self._attrconf.is_editable(): self.widgets['value'][0].SetValue(list_to_str(value)) - else:# only flat lists can be edited :( + else: # only flat lists can be edited :( self.widgets['value'][0].SetValue(repr(value)) -class ObjWidgetContainer(AttrBase,WidgetContainer): +class ObjWidgetContainer(AttrBase, WidgetContainer): + """ Contains one or several widgets representing an obj attribute. - + """ + def define_widgetset(self): """ Generates the widgets representing this attribute. """ - return [ ('name', self.create_namewidget(), wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL), - ('value', self.create_valuewidget(), wx.EXPAND), - ] - - - - + return [('name', self.create_namewidget(), wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL), + ('value', self.create_valuewidget(), wx.EXPAND), + ] + def get_valuewidget_read(self): """ Returns instance of non-editable widget To be overwritten. """ - #print 'get_numeditwidget',value - # Here just the plain static text widget is returned + # print 'get_numeditwidget',value + # Here just the plain static text widget is returned #obj = self._attrconf.get_value() obj = value = self.get_value_obj() - if hasattr(obj,'ident'): - text=str(obj.format_ident()) + if hasattr(obj, 'ident'): + text = str(obj.format_ident()) else: text = str(obj) - - #print 'create_valuewidget: '+value,self.attr + + # print 'create_valuewidget: '+value,self.attr #widget=wx.StaticText(self.parent, -1,text,style=wx.ALIGN_RIGHT) - widget=hyperlink.HyperLinkCtrl(self.parent, wx.ID_ANY,text,URL=text) + widget = hyperlink.HyperLinkCtrl( + self.parent, wx.ID_ANY, text, URL=text) widget.AutoBrowse(False) - + widget.Bind(hyperlink.EVT_HYPERLINK_LEFT, self.on_objlink) - + return widget - + def get_valuewidget_write_choice(self): """ Return widget to edit numeric value of attribute """ return self.get_valuewidget_read() - - #def get_valuewidget_write_choice(self): + + # def get_valuewidget_write_choice(self): # """ # Return widget to edit numeric value of attribute # """ # objdata = self.get_value_obj() # print 'ObjWidgetContainer.get_valuewidget_write',obj.name - # # Here just the plain static text widget is returned + # # Here just the plain static text widget is returned # #self.config_attr - # + # # if hasattr(objdata, '__iter__'): # obj, _id = objdata # text = obj.format_ident_row(_id) # else: # text = obj.format_ident() - # + # # print ' text',text # if type(self._attrconf.choices) in (OrderedDict, types.DictionaryType): # self._choices = self._attrconf.choices.keys() @@ -1107,515 +1101,497 @@ # widget.SetSelection(ind) # else: # self._choices = self._attrconf.choices - # widget = wx.Choice(self.parent, -1, (100, 50), choices = self._attrconf.choices) - # - # if self._choices.count(text)>0: + # widget = wx.Choice(self.parent, -1, (100, 50), choices = self._attrconf.choices) + # + # if self._choices.count(text)>0: # ind = self._choices.index(text) # widget.SetSelection(ind) # if self.immediate_apply: # self.parent.Bind(wx.EVT_CHOICE, self.on_apply_immediate, widget) - - - - #print 'create_valuewidget: '+value,self.attr - + + # print 'create_valuewidget: '+value,self.attr + return widget - - - - - - - def on_objlink(self,event): - #print 'on_objlink:',self.get_objvalue().ident - - + + def on_objlink(self, event): + # print 'on_objlink:',self.get_objvalue().ident + value = self.get_objvalue() mt = self._attrconf.get_metatype() - - + if self.parent.func_change_obj: if mt == 'obj': - if type(value)==types.InstanceType: - #print ' ident?',hasattr(value,'ident') - if hasattr(value,'ident'): - navitimer = wx.FutureCall(1, self.parent.func_change_obj, value) - + if type(value) == types.InstanceType: + # print ' ident?',hasattr(value,'ident') + if hasattr(value, 'ident'): + navitimer = wx.FutureCall( + 1, self.parent.func_change_obj, value) + elif mt == 'id': linktab = self._attrconf.get_linktab() - navitimer = wx.FutureCall(1, self.parent.func_change_obj, linktab, value)# here value is id - + navitimer = wx.FutureCall( + 1, self.parent.func_change_obj, linktab, value) # here value is id + elif mt == 'ids': linktab = self._attrconf.get_linktab() - navitimer = wx.FutureCall(1, self.parent.func_change_obj, linktab, None, value)# here value is list with ids - - elif mt =='tabid': + # here value is list with ids + navitimer = wx.FutureCall( + 1, self.parent.func_change_obj, linktab, None, value) + + elif mt == 'tabid': linktab, id = value - navitimer = wx.FutureCall(1, self.parent.func_change_obj, linktab, id)# - - - - #if self._attrconf.is_colattr(): # parent is holding the row id + navitimer = wx.FutureCall( + 1, self.parent.func_change_obj, linktab, id) + + # if self._attrconf.is_colattr(): # parent is holding the row id #self._attrconf[self.parent.id] = value else: #navitimer = wx.FutureCall(1, self.parent.func_change_obj,self.get_objvalue()) pass - + event.Skip() -class ColorWidgetContainer(AttrBase,TextWidgetContainer): + +class ColorWidgetContainer(AttrBase, TextWidgetContainer): + def define_widgetset(self): """ Generates the widgets representing this attribute. """ - return [ ('name', self.create_namewidget(), wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL), - ('value', self.create_valuewidget(), wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL),#wx.EXPAND - #('unit', self.create_unitwidget(), wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL), - ] - - - + return [('name', self.create_namewidget(), wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL), + ('value', self.create_valuewidget(), wx.ALIGN_LEFT | + wx.ALIGN_CENTER_VERTICAL), # wx.EXPAND + #('unit', self.create_unitwidget(), wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL), + ] + def get_valuewidget_write(self): """ Return widget to edit numeric value of attribute """ - + value = self.get_value_obj() - #print 'ColorWidgetContainer.get_valuewidget_write',self._attrconf.attrname,value,type(value) + # print + # 'ColorWidgetContainer.get_valuewidget_write',self._attrconf.attrname,value,type(value) #widget = wx.TextCtrl( self.parent, -1, str(value),style= wx.ALIGN_RIGHT) - cint = np.array(np.array(value)*255,np.int32) - #wx.Colour(cint[0],cint[1],cint[2],cint[3]) - widget = coloursel.ColourSelect(self.parent, -1, "", wx.Colour(cint[0],cint[1],cint[2],cint[3]), size = wx.DefaultSize) - #self.set_textevents(widget) - #widget.Enable(True) + cint = np.array(np.array(value) * 255, np.int32) + # wx.Colour(cint[0],cint[1],cint[2],cint[3]) + widget = coloursel.ColourSelect( + self.parent, -1, "", wx.Colour(cint[0], cint[1], cint[2], cint[3]), size=wx.DefaultSize) + # self.set_textevents(widget) + # widget.Enable(True) if self.immediate_apply: widget.Bind(coloursel.EVT_COLOURSELECT, self.on_colorselect) return widget - - def on_colorselect(self,event): + + def on_colorselect(self, event): self.apply_valuewidget_to_obj() - + def get_valuewidget_read(self): """ Return widget to edit numeric value of attribute """ - + value = self.get_value_obj() - #print 'get_editwidget text',value,type(value) + # print 'get_editwidget text',value,type(value) #widget = wx.TextCtrl( self.parent, -1, str(value),style= wx.ALIGN_RIGHT) - cint = np.array(np.array(value)*255,np.int32) - widget = coloursel.ColourSelect(self.parent, -1, "", wx.Colour(cint[0],cint[1],cint[2],cint[3]), size = wx.DefaultSize) - #self.set_textevents(widget) + cint = np.array(np.array(value) * 255, np.int32) + widget = coloursel.ColourSelect( + self.parent, -1, "", wx.Colour(cint[0], cint[1], cint[2], cint[3]), size=wx.DefaultSize) + # self.set_textevents(widget) widget.Enable(False) return widget - + def get_widgetvalue(self): """ Returnes current value from valuewidget. Depends on attribute type and hence widgettype. To be overwritten. - """ - - c = self.widgets['value'][0].GetColour() - #print 'ColorWidgetContainer.get_widgetvalue',self._attrconf.attrname, c, type(c),type(c) == types.InstanceType#types.ClassType + """ + + c = self.widgets['value'][0].GetColour() + # print 'ColorWidgetContainer.get_widgetvalue',self._attrconf.attrname, c, type(c),type(c) == types.InstanceType#types.ClassType #color = np.array([c.Red(),c.Green(),c.Blue(),c.Alpha()],np.float32)/255.0 - return np.array([c.Red(),c.Green(),c.Blue(),c.Alpha()],np.float32)/255.0 - - def set_widgetvalue(self,value): + return np.array([c.Red(), c.Green(), c.Blue(), c.Alpha()], np.float32) / 255.0 + + def set_widgetvalue(self, value): """ Sets value for valuewidget. Depends on attribute type and hence widgettype. To be overwritten. - """ - cint = np.array(np.array(value)*255,np.int32) - self.widgets['value'][0].SetValue(wx.Colour(cint[0],cint[1],cint[2],cint[3])) - - - - - - -class FilepathWidgetContainer(AttrBase,TextWidgetContainer): + """ + cint = np.array(np.array(value) * 255, np.int32) + self.widgets['value'][0].SetValue( + wx.Colour(cint[0], cint[1], cint[2], cint[3])) + + +class FilepathWidgetContainer(AttrBase, TextWidgetContainer): + def define_widgetset(self): """ Generates the widgets representing this attribute. """ - return [ ('name', self.create_namewidget(), wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL), - ('value', self.create_valuewidget(), wx.EXPAND), - ('unit', self.create_unitwidget(), wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL),] - - + return [('name', self.create_namewidget(), wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL), + ('value', self.create_valuewidget(), wx.EXPAND), + ('unit', self.create_unitwidget(), wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL), ] + def get_valuewidget_read(self): """ Return widget to read only numeric value of attribute This is effectively the parametrisation of the masked.NumCtrl widget. """ - #print 'TextWidgetContainer.get_valuewidget_read' - #widget=self.get_valuewidget_write() + # print 'TextWidgetContainer.get_valuewidget_read' + # widget=self.get_valuewidget_write() value = self.get_value_obj() - widget = wx.TextCtrl( self.parent, -1, value,style= wx.ALIGN_LEFT|wx.TE_READONLY) + widget = wx.TextCtrl(self.parent, -1, value, + style=wx.ALIGN_LEFT | wx.TE_READONLY) widget.Enable(False) - - - + return widget - + def get_valuewidget_write(self): """ Return widget to edit numeric value of attribute This is effectively the parametrisation of the masked.NumCtrl widget. """ - + value = self.get_value_obj() - #print 'get_editwidget text',value,type(value) + # print 'get_editwidget text',value,type(value) - widget = wx.TextCtrl( self.parent, -1, value,style= wx.ALIGN_LEFT) + widget = wx.TextCtrl(self.parent, -1, value, style=wx.ALIGN_LEFT) self.set_textevents(widget) return widget #self.MultiLine = wx.TextCtrl(parent = panel, id = -1, pos = (38, 70), size = (410, 90), style = wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_AUTO_URL) - def create_unitwidget(self): #widget = wx.Button(self.parent, wx.ID_OPEN) - bitmap = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN,wx.ART_TOOLBAR) + bitmap = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR) widget = wx.BitmapButton(self.parent, -1, bitmap, (12, 12), - (bitmap.GetWidth()+6, bitmap.GetHeight()+6)) + (bitmap.GetWidth() + 6, bitmap.GetHeight() + 6)) widget.Bind(wx.EVT_BUTTON, self.on_fileopen) - #print 'create_unitwidget',self._attrconf.attrname,widget + # print 'create_unitwidget',self._attrconf.attrname,widget return widget - - def on_fileopen(self,event): - #print 'on_fileopen',self._attrconf.attrname - #if type(self._attrconf.get_default())==types.StringType: + + def on_fileopen(self, event): + # print 'on_fileopen',self._attrconf.attrname + # if type(self._attrconf.get_default())==types.StringType: # defaultname = self._attrconf.get_default() - #else: + # else: # defaultname = os.getcwd() wildcards_all = "All files (*.*)|*.*" - if hasattr(self._attrconf,'wildcards'): - wildcards = self._attrconf.wildcards+"|"+wildcards_all + if hasattr(self._attrconf, 'wildcards'): + wildcards = self._attrconf.wildcards + "|" + wildcards_all else: wildcards = wildcards_all - + # guess default value filepath = self.get_objvalue() - if type(filepath) not in (types.StringType,types.UnicodeType): + if type(filepath) not in (types.StringType, types.UnicodeType): filepath = "" dirpath = os.getcwd() else: dirpath = os.path.dirname(filepath) - - - + dlg = wx.FileDialog(self.parent, message="Open file", - defaultDir = dirpath, - defaultFile= filepath, - wildcard = wildcards, + defaultDir=dirpath, + defaultFile=filepath, + wildcard=wildcards, style=wx.OPEN | wx.CHANGE_DIR ) - # Show the dialog and retrieve the user response. If it is the OK response, + # Show the dialog and retrieve the user response. If it is the OK response, # process the data. if dlg.ShowModal() == wx.ID_OK: filepath = dlg.GetPath() - - #print 'on_fileopen set filepath',filepath + + # print 'on_fileopen set filepath',filepath self.set_widgetvalue(filepath) if self.immediate_apply: self.apply_valuewidget_to_obj() - #print ' self.get_widgetvalue()',self.get_widgetvalue() + # print ' self.get_widgetvalue()',self.get_widgetvalue() dlg.Destroy() + class FilepathsWidgetContainer(FilepathWidgetContainer): - - def on_fileopen(self,event): - #print 'FilepathsWidgetContainer.on_fileopen',self._attrconf.attrname - #if type(self._attrconf.get_default())==types.StringType: + + def on_fileopen(self, event): + # print 'FilepathsWidgetContainer.on_fileopen',self._attrconf.attrname + # if type(self._attrconf.get_default())==types.StringType: # defaultname = self._attrconf.get_default() - #else: + # else: # defaultname = os.getcwd() - + wildcards_all = "All files (*.*)|*.*" - if hasattr(self._attrconf,'wildcards'): - wildcards = self._attrconf.wildcards+"|"+wildcards_all + if hasattr(self._attrconf, 'wildcards'): + wildcards = self._attrconf.wildcards + "|" + wildcards_all else: wildcards = wildcards_all - + # guess default value filepath = self.get_objvalue() - #print ' filepath',filepath,type(filepath) - if type(filepath) not in (types.StringType,types.UnicodeType): + # print ' filepath',filepath,type(filepath) + if type(filepath) not in (types.StringType, types.UnicodeType): filepath = "" dirpath = os.getcwd() else: - dirpath = os.path.dirname(filepath.split(',')[0] ) - - #print ' dirpath',dirpath - #print ' filepath',filepath + dirpath = os.path.dirname(filepath.split(',')[0]) + + # print ' dirpath',dirpath + # print ' filepath',filepath dlg = wx.FileDialog(self.parent, message="Open file", - defaultDir = dirpath, - defaultFile= filepath, - wildcard = wildcards, + defaultDir=dirpath, + defaultFile=filepath, + wildcard=wildcards, style=wx.OPEN | wx.MULTIPLE | wx.CHANGE_DIR ) - # Show the dialog and retrieve the user response. If it is the OK response, + # Show the dialog and retrieve the user response. If it is the OK response, # process the data. if dlg.ShowModal() == wx.ID_OK: # This returns a Python list of files that were selected. filepaths = dlg.GetPaths() - #print 'You selected %d files:' % len(paths) - - #print 'on_fileopen set filepath',filepath - #self.set_widgetvalue(filepathlist_to_filepathstring(filepaths)) - + # print 'You selected %d files:' % len(paths) + + # print 'on_fileopen set filepath',filepath + # self.set_widgetvalue(filepathlist_to_filepathstring(filepaths)) + # save path as comma separated string, but not with special primes self.set_widgetvalue(','.join(filepaths)) if self.immediate_apply: self.apply_valuewidget_to_obj() - #print ' self.get_widgetvalue()',self.get_widgetvalue() + # print ' self.get_widgetvalue()',self.get_widgetvalue() dlg.Destroy() - -class DirpathWidgetContainer(AttrBase,TextWidgetContainer): + + +class DirpathWidgetContainer(AttrBase, TextWidgetContainer): + def define_widgetset(self): """ Generates the widgets representing this attribute. """ - return [ ('name', self.create_namewidget(), wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL), - ('value', self.create_valuewidget(), wx.EXPAND), - ('unit', self.create_unitwidget(), wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL),] - - + return [('name', self.create_namewidget(), wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL), + ('value', self.create_valuewidget(), wx.EXPAND), + ('unit', self.create_unitwidget(), wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL), ] + def create_unitwidget(self): if self._attrconf.is_writable(): #widget = wx.Button(self.parent, wx.ID_OPEN) - bitmap = wx.ArtProvider.GetBitmap(wx.ART_FOLDER_OPEN,wx.ART_TOOLBAR) + bitmap = wx.ArtProvider.GetBitmap( + wx.ART_FOLDER_OPEN, wx.ART_TOOLBAR) widget = wx.BitmapButton(self.parent, -1, bitmap, (12, 12), - (bitmap.GetWidth()+6, bitmap.GetHeight()+6)) + (bitmap.GetWidth() + 6, bitmap.GetHeight() + 6)) widget.Bind(wx.EVT_BUTTON, self.on_diropen) - #print 'create_unitwidget',self._attrconf.attrname,widget + # print 'create_unitwidget',self._attrconf.attrname,widget return widget else: - return (0,0) - - def on_diropen(self,event): + return (0, 0) + + def on_diropen(self, event): dlg = wx.DirDialog(self.parent, message="Open directory", - #style=wx.DD_DEFAULT_STYLE| wx.DD_DIR_MUST_EXIST| wx.DD_CHANGE_DIR - style=wx.DEFAULT_DIALOG_STYLE| wx.RESIZE_BORDER|wx.DD_CHANGE_DIR - ) + #style=wx.DD_DEFAULT_STYLE| wx.DD_DIR_MUST_EXIST| wx.DD_CHANGE_DIR + style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.DD_CHANGE_DIR + ) if dlg.ShowModal() == wx.ID_OK: dirpath = dlg.GetPath() self.set_widgetvalue(dirpath) if self.immediate_apply: self.apply_valuewidget_to_obj() - #print ' self.get_widgetvalue()',self.get_widgetvalue() + # print ' self.get_widgetvalue()',self.get_widgetvalue() dlg.Destroy() - - + + class ScalarPanel(wx.Panel): + """ Interactively displays scalar attributes of object on a parent panel. """ - - def __init__(self, parent, attrconfigs=[], id = None, - func_change_obj=None, - mainframe=None, panelstyle = 'default', immediate_apply = None): - #wx.Panel.__init__(self,parent,-1,style=wx.WANTS_CHARS) - wx.Panel.__init__(self,parent,-1, size = (-1,300)) + + def __init__(self, parent, attrconfigs=[], id=None, + func_change_obj=None, + mainframe=None, panelstyle='default', immediate_apply=None): + # wx.Panel.__init__(self,parent,-1,style=wx.WANTS_CHARS) + wx.Panel.__init__(self, parent, -1, size=(-1, 300)) #wx.scrolledpanel.ScrolledPanel.__init__(self, parent,wx.ID_ANY) #self.maxWidth = 1000 #self.maxHeight = 1000 #self.SetVirtualSize((self.maxWidth, self.maxHeight)) - #self.SetScrollRate(10,10) - + # self.SetScrollRate(10,10) + # parent must be panel, scrolled panel or similar self.parent = parent - + self.id = id - + # target obj #self.obj = obj - - self.func_change_obj=func_change_obj - self.mainframe=mainframe + + self.func_change_obj = func_change_obj + self.mainframe = mainframe #self.panelstyle = panelstyle #self.immediate_apply = immediate_apply - + # background colors for lines shading: - self.tablecolors=get_tablecolors() - - #print 'ScalarPanel.__init__ id=',self.id#,parent,self.obj - #print ' immediate_apply=',immediate_apply - - self.widgetcontainers=[] - - - self.create_attrs(attrconfigs, immediate_apply=immediate_apply, panelstyle=panelstyle) + self.tablecolors = get_tablecolors() + + # print 'ScalarPanel.__init__ id=',self.id#,parent,self.obj + # print ' immediate_apply=',immediate_apply + + self.widgetcontainers = [] + + self.create_attrs( + attrconfigs, immediate_apply=immediate_apply, panelstyle=panelstyle) self.SetAutoLayout(True) self.Refresh() - - #def get_pentable(self): + + # def get_pentable(self): # """ # Returns pentable used for this panel # """ - # return self.parent.get_pentable() - + # return self.parent.get_pentable() + def create_attrs(self, attrconfigs, immediate_apply=False, panelstyle='default'): """ Go through list with attribute names and create widgets and put them in a grid sizer. """ - #print '\n\ncreate_attrs',len(attrconfigs) - #print ' mt=',self.obj.get_config(attrs[0])['metatype'] - - #self.add_id_named(name,id,colors=color) - #get widgets - #id=1 - i=0 + # print '\n\ncreate_attrs',len(attrconfigs) + # print ' mt=',self.obj.get_config(attrs[0])['metatype'] + + # self.add_id_named(name,id,colors=color) + # get widgets + # id=1 + i = 0 for attrconfig in attrconfigs: - - + # generates alternating colors (currently not in use) - color_bg=self.tablecolors[divmod(i,len(self.tablecolors))[1]] - container=self.get_widgetcontainer( attrconfig, color_bg=color_bg, - immediate_apply=immediate_apply, - panelstyle=panelstyle) + color_bg = self.tablecolors[divmod(i, len(self.tablecolors))[1]] + container = self.get_widgetcontainer(attrconfig, color_bg=color_bg, + immediate_apply=immediate_apply, + panelstyle=panelstyle) self.widgetcontainers.append(container) - #self.add_id_named(attr,widgetcontainers=container) - #self.create_ids(id,widgetcontainers=container) - i+=1 - + # self.add_id_named(attr,widgetcontainers=container) + # self.create_ids(id,widgetcontainers=container) + i += 1 + # now ask for widget names and try to align them - widgetnames=[] + widgetnames = [] for container in self.widgetcontainers: - names=container.get_widgetnames() - - if len(widgetnames)==0: - widgetnames=names + names = container.get_widgetnames() + + if len(widgetnames) == 0: + widgetnames = names else: - widgetnames=self._align(widgetnames,names) - - #print ' result of alignment:',attr,names,widgetnames + widgetnames = self._align(widgetnames, names) + + # print ' result of alignment:',attr,names,widgetnames # widgetnames.index... - + # now dimensions of grid are known, so configure sizer - #print 'grid size=',len(attrs), len(widgetnames) - sizer = wx.FlexGridSizer( len(attrconfigs), len(widgetnames), vgap=2, hgap=0) + # print 'grid size=',len(attrs), len(widgetnames) + sizer = wx.FlexGridSizer( + len(attrconfigs), len(widgetnames), vgap=2, hgap=0) sizer.AddGrowableCol(1) - #print 'widgetnames',widgetnames + # print 'widgetnames',widgetnames # throw widgets into sizer for container in self.widgetcontainers: - #print 'build grid for attr',container._attrconf.attrname - #container=self.get_value_named('widgetcontainers',attr) - #print 'attr',attr,widgetnames - widgetsinfo=container.get_widgetsinfo(widgetnames) - #print ' widgetsinfo=',widgetsinfo - for widget,align in widgetsinfo: - #print ' add widget align=',widget,align - sizer.Add(widget,0, align) - + # print 'build grid for attr',container._attrconf.attrname + # container=self.get_value_named('widgetcontainers',attr) + # print 'attr',attr,widgetnames + widgetsinfo = container.get_widgetsinfo(widgetnames) + # print ' widgetsinfo=',widgetsinfo + for widget, align in widgetsinfo: + # print ' add widget align=',widget,align + sizer.Add(widget, 0, align) + # works on panel... #parent.SetHelpText('The Agile Panel') - self.SetAutoLayout( True ) + self.SetAutoLayout(True) self.SetSizer(sizer) sizer.Fit(self) - - def get_widgetcontainer(self,attrconf,**args): + + def get_widgetcontainer(self, attrconf, **args): """ Figures out what widget container, containing a set of widgets, would be the most aprobriate to represent this attribute. """ - #print '\n\nScalarPanel.get_widgetcontainer',attrconf.attrname - - #config=self.obj.get_config(attr) + # print '\n\nScalarPanel.get_widgetcontainer',attrconf.attrname + + # config=self.obj.get_config(attr) # get type list (full depth) - #t=attrconfig.get_default() - + # t=attrconfig.get_default() + # take top level type - #tt=t[0] + # tt=t[0] tt = type(attrconf.get_default()) - + # get metatype mt = attrconf.get_metatype() - - - - #print ' default,mt,tt',attrconf.get_default(),mt,tt - - #if config.has_key('choices'): + + # print ' default,mt,tt',attrconf.get_default(),mt,tt + + # if config.has_key('choices'): # # pop up with a choices list # return ChoiceWidgetContainer(self,attr,**args) - + # check if this is an id within a referenced object - #if mt=='id': + # if mt=='id': # return IdWidgetContainer(self,attr,**args) - # + # # check if widgets for metatypes are availlable - #elif mt=='color': + # elif mt=='color': # #print ' ->WidgetContainer' # return ColorWidgetContainer(self,attr,**args) - - - #elif mt=='pentype': + + # elif mt=='pentype': # return PentypeContainer(self,attr,**args) - - - + if mt in METATYPES_LINKSTYLE: - return ObjWidgetContainer(self,attrconf,**args) - - elif mt =='color': - return ColorWidgetContainer(self,attrconf,**args) - - elif hasattr(attrconf,'choices'): - return ChoiceWidgetContainer(self,attrconf,**args) - - elif mt == 'filepath': - return FilepathWidgetContainer(self,attrconf,**args) - + return ObjWidgetContainer(self, attrconf, **args) + + elif mt == 'color': + return ColorWidgetContainer(self, attrconf, **args) + + elif hasattr(attrconf, 'choices'): + return ChoiceWidgetContainer(self, attrconf, **args) + + elif mt == 'filepath': + return FilepathWidgetContainer(self, attrconf, **args) + elif mt == 'filepaths': - return FilepathsWidgetContainer(self,attrconf,**args) - + return FilepathsWidgetContainer(self, attrconf, **args) + elif mt == 'dirpath': - return DirpathWidgetContainer(self,attrconf,**args) - - #elif mt == 'number': + return DirpathWidgetContainer(self, attrconf, **args) + + # elif mt == 'number': if tt in (types.IntType, types.LongType): - return IntegerWidgetContainer(self,attrconf,**args) + return IntegerWidgetContainer(self, attrconf, **args) elif tt in (types.FloatType, types.ComplexType): - return NumericWidgetContainer(self,attrconf,**args) - - - - - + return NumericWidgetContainer(self, attrconf, **args) + # check now native types - elif tt in (types.BooleanType,): - return BooleanWidgetContainer(self,attrconf,**args) - - elif tt in (types.UnicodeType ,types.StringType ): - return TextWidgetContainer(self,attrconf,**args) - - - - #elif tt in (types.InstanceType,types.ClassType): + elif tt in (types.BooleanType,): + return BooleanWidgetContainer(self, attrconf, **args) + + elif tt in (types.UnicodeType, types.StringType): + return TextWidgetContainer(self, attrconf, **args) + + # elif tt in (types.InstanceType,types.ClassType): # return ObjWidgetContainer(self,attrconf,**args) - - elif tt in (types.ListType,types.TupleType): - return ListWidgetContainer(self,attrconf,**args) - - else: + + elif tt in (types.ListType, types.TupleType): + return ListWidgetContainer(self, attrconf, **args) + + else: # else means use a the base class that can display anything - return WidgetContainer(self,attrconf,**args) - #else: + return WidgetContainer(self, attrconf, **args) + # else: # # else means use a the base class that can display anything # return WidgetContainer(self,attr,self,**args) - - - + def apply(self): """ Widget values are copied to object @@ -1623,116 +1599,115 @@ for widgetcontainer in self.widgetcontainers: widgetcontainer.apply_valuewidget_to_obj() # this is to update widgets of function values - #self.restore() - - + # self.restore() + def restore(self): """ Object values are copied into widgets. """ for widgetcontainer in self.widgetcontainers: widgetcontainer.apply_obj_to_valuewidget() - - - def _align(self,widgetnames,names): + + def _align(self, widgetnames, names): """ tries to align widgetnames with a new list of names """ - #print '_align' - names_prepend=[] - i=0 - - while (len(names_prepend)==0) & (i 0: - names_prepend=names[:i] - i+=1 - - #print ' names_prepend',names_prepend - newnames=widgetnames + names_prepend = names[:i] + i += 1 + + # print ' names_prepend',names_prepend + newnames = widgetnames for name in names_prepend: - self._prepend_name(newnames,name) - + self._prepend_name(newnames, name) + for name in names: - self._append_name(newnames,name) - + self._append_name(newnames, name) + return newnames - - - - - def _append_name(self,names,name): + + def _append_name(self, names, name): """ Appends name if not in list """ if names.count(name) == 0: names.append(name) - - def _prepend_name(self,names,name): + + def _prepend_name(self, names, name): """ Predends name if not in list """ if names.count(name) == 0: - names.insert(name,0) + names.insert(name, 0) class ScalarPanelScrolled(wxlib.scrolledpanel.ScrolledPanel, ScalarPanel): + """ Interactively displays scalar attributes of object on a parent panel. """ - - def __init__(self, parent, attrconfigs=[], id = None, - func_change_obj=None, - mainframe=None, is_modal = False, - panelstyle = 'default', immediate_apply = None): - #wx.Panel.__init__(self,parent,-1,style=wx.WANTS_CHARS) - #wx.Panel.__init__(self,parent,-1) + + def __init__(self, parent, attrconfigs=[], id=None, + func_change_obj=None, + mainframe=None, is_modal=False, + panelstyle='default', immediate_apply=None): + # wx.Panel.__init__(self,parent,-1,style=wx.WANTS_CHARS) + # wx.Panel.__init__(self,parent,-1) if is_modal: - wxlib.scrolledpanel.ScrolledPanel.__init__(self, parent,wx.ID_ANY,size = (600,400)) + wxlib.scrolledpanel.ScrolledPanel.__init__( + self, parent, wx.ID_ANY, size=(600, 400)) else: - wxlib.scrolledpanel.ScrolledPanel.__init__(self, parent,wx.ID_ANY,size = wx.DefaultSize) + wxlib.scrolledpanel.ScrolledPanel.__init__( + self, parent, wx.ID_ANY, size=wx.DefaultSize) #self.maxWidth = 2000 #self.maxHeight = 300 #self.SetVirtualSize((self.maxWidth, self.maxHeight)) - self.SetScrollRate(10,10) - + self.SetScrollRate(10, 10) + # parent must be panel, scrolled panel or similar self.parent = parent - + self.id = id - + # target obj #self.obj = obj - - self.func_change_obj=func_change_obj - self.mainframe=mainframe + + self.func_change_obj = func_change_obj + self.mainframe = mainframe #self.panelstyle = panelstyle #self.immediate_apply = immediate_apply - + # background colors for lines shading: - self.tablecolors=get_tablecolors() - - #print 'ScalarPanel.__init__'#,parent,self.obj - #print ' immediate_apply=',immediate_apply - - self.widgetcontainers=[] - - - self.create_attrs(attrconfigs, immediate_apply=immediate_apply, panelstyle=panelstyle) - #self.SetAutoLayout(True) - #self.AutoLayout() - #self.Refresh() - #self.SetAutoLayout(1) - #self.SetupScrolling() - + self.tablecolors = get_tablecolors() + + # print 'ScalarPanel.__init__'#,parent,self.obj + # print ' immediate_apply=',immediate_apply + + self.widgetcontainers = [] + + self.create_attrs( + attrconfigs, immediate_apply=immediate_apply, panelstyle=panelstyle) + # self.SetAutoLayout(True) + # self.AutoLayout() + # self.Refresh() + # self.SetAutoLayout(1) + # self.SetupScrolling() + self.Refresh() - #self.Layout() - - #self.SetupScrolling() + # self.Layout() + + # self.SetupScrolling() - #self.Refresh() - #self.Layout() + # self.Refresh() + # self.Layout() -class TableGrid(AttrBase,gridlib.PyGridTableBase): + +class TableGrid(AttrBase, gridlib.PyGridTableBase): """ This is all it takes to make a custom data table to plug into a @@ -1741,270 +1716,266 @@ provides strings containing the row and column values. """ - def __init__(self,parent, tab, attrconfigs, ids, show_ids=False, **args): + def __init__(self, parent, tab, attrconfigs, ids, show_ids=False, **args): gridlib.PyGridTableBase.__init__(self) - - self.odd=gridlib.GridCellAttr() + + self.odd = gridlib.GridCellAttr() self.odd.SetBackgroundColour("sky blue") - self.even=gridlib.GridCellAttr() + self.even = gridlib.GridCellAttr() self.even.SetBackgroundColour("sea green") - + # target obj self.tab = tab self.parent = parent - - - #print 'gridlib.PyGridTableBase\n'#,dir(gridlib.PyGridTableBase) - self.ids=ids + + # print 'gridlib.PyGridTableBase\n'#,dir(gridlib.PyGridTableBase) + self.ids = ids self.show_ids = show_ids self.attrconfigs = attrconfigs - - - - #print 'TableGrid: attrs,ids=',len(self.attrconfigs),'X',len(self.ids) - - - col=0 - self.colnames=[] - self.celltypes=[] - #self.cellattrs=[] - #print ' make header' + + # print 'TableGrid: attrs,ids=',len(self.attrconfigs),'X',len(self.ids) + + col = 0 + self.colnames = [] + self.celltypes = [] + # self.cellattrs=[] + # print ' make header' for attrconf in attrconfigs: - if hasattr(attrconf,'symbol'): + if hasattr(attrconf, 'symbol'): symbol = attrconf.symbol else: symbol = attrconf.get_name() - unit=attrconf.format_unit(show_parentesis=True) - if len(unit)>0: - if len(symbol)>7: - symbol+='\n'+unit + unit = attrconf.format_unit(show_parentesis=True) + if len(unit) > 0: + if len(symbol) > 7: + symbol += '\n' + unit else: - symbol+=' '+unit - #print ' symbol',symbol + symbol += ' ' + unit + # print ' symbol',symbol self.colnames.append(symbol) self.celltypes.append(self.get_celltype(attrconf)) - col+=1 - #print ' done: header' - - - def get_celltype(self,attrconf): + col += 1 + # print ' done: header' + + def get_celltype(self, attrconf): """ Returns type code string of a wx cell. http://permalink.gmane.org/gmane.comp.python.wxpython/102660 """ - #config=self.obj.get_config(attr) - #tt=config['type'][0] + # config=self.obj.get_config(attr) + # tt=config['type'][0] # check fist if widgets for metatypes are availlable - #if mt=='color': + # if mt=='color': # #print ' ->WidgetContainer' # return 'color' # #return WidgetContainer(self,attr,parent,**args) - - #if config.has_key('choices'): - # choicestring=wxGRID_VALUE_CHOICE+':' + + # if config.has_key('choices'): + # choicestring=wxGRID_VALUE_CHOICE+':' # for c in config['choices']: # choicestring+=c+',' # choicestring=choicestring[:-1] # return choicestring - + # check now native types - #if len(config['type'])==1: + # if len(config['type'])==1: mt = attrconf.metatype - tt = type(attrconf.get_default()) - #print 'get_celltype',attrconf.attrname,mt,tt,hasattr(attrconf,'choices'),attrconf.is_writable() - - - - if mt =='objs': + tt = type(attrconf.get_default()) + # print + # 'get_celltype',attrconf.attrname,mt,tt,hasattr(attrconf,'choices'),attrconf.is_writable() + + if mt == 'objs': return gridlib.GRID_VALUE_STRING - - elif mt =='id': - if hasattr(attrconf,'choices'): + + elif mt == 'id': + if hasattr(attrconf, 'choices'): if attrconf.is_writable(): - if len(attrconf.choices)<200: - #print ' choices=',attrconf.choices - if type(attrconf.choices) in (OrderedDict, types.DictionaryType):#(types.ListType, types.TupleType): - #print ' GridCellChoiceEditor',attrconf.choices,':'+','.join(attrconf.choices.keys()) - return gridlib.GRID_VALUE_CHOICE+':'+','.join(attrconf.choices.keys()) + if len(attrconf.choices) < 200: + # print ' choices=',attrconf.choices + # (types.ListType, types.TupleType): + if type(attrconf.choices) in (OrderedDict, types.DictionaryType): + # print ' + # GridCellChoiceEditor',attrconf.choices,':'+','.join(attrconf.choices.keys()) + return gridlib.GRID_VALUE_CHOICE + ':' + ','.join(attrconf.choices.keys()) else: - #print ' GridCellChoiceEditor',attrconf.choices,':'+','.join(attrconf.choices) - return gridlib.GRID_VALUE_CHOICE+':'+','.join(attrconf.choices) - + # print ' + # GridCellChoiceEditor',attrconf.choices,':'+','.join(attrconf.choices) + return gridlib.GRID_VALUE_CHOICE + ':' + ','.join(attrconf.choices) + #gridlib.GridCellChoiceEditor(['what','ever'], allowOthers=True) else: - return gridlib.GRID_VALUE_STRING # still display a string with choice + # still display a string with choice + return gridlib.GRID_VALUE_STRING else: return gridlib.GRID_VALUE_STRING return gridlib.GRID_VALUE_NUMBER - - elif mt =='tabid': + + elif mt == 'tabid': return gridlib.GRID_VALUE_STRING - + elif mt == 'ids': return gridlib.GRID_VALUE_STRING - - elif hasattr(attrconf,'choices'): + + elif hasattr(attrconf, 'choices'): if attrconf.is_writable(): - if len(attrconf.choices)<200: - #print ' dir(gridlib)',dir(gridlib) - if type(attrconf.choices) in (OrderedDict, types.DictionaryType):#(types.ListType, types.TupleType): - #print ' GridCellChoiceEditor',attrconf.choices,':'+','.join(attrconf.choices.keys()) - return gridlib.GRID_VALUE_CHOICE+':'+','.join(attrconf.choices.keys()) + if len(attrconf.choices) < 200: + # print ' dir(gridlib)',dir(gridlib) + # (types.ListType, types.TupleType): + if type(attrconf.choices) in (OrderedDict, types.DictionaryType): + # print ' + # GridCellChoiceEditor',attrconf.choices,':'+','.join(attrconf.choices.keys()) + return gridlib.GRID_VALUE_CHOICE + ':' + ','.join(attrconf.choices.keys()) else: - #print ' GridCellChoiceEditor',attrconf.choices,':'+','.join(attrconf.choices) - return gridlib.GRID_VALUE_CHOICE+':'+','.join(attrconf.choices) - + # print ' + # GridCellChoiceEditor',attrconf.choices,':'+','.join(attrconf.choices) + return gridlib.GRID_VALUE_CHOICE + ':' + ','.join(attrconf.choices) + #gridlib.GridCellChoiceEditor(['what','ever'], allowOthers=True) else: return gridlib.GRID_VALUE_STRING else: return gridlib.GRID_VALUE_STRING - - elif tt in (types.LongType,types.IntType): - if (hasattr(attrconf,'min') & hasattr(attrconf,'max')): - return gridlib.GRID_VALUE_NUMBER+':'\ - +str(attrconf.min)+','+str(attrconf.max) + + elif tt in (types.LongType, types.IntType): + if (hasattr(attrconf, 'min') & hasattr(attrconf, 'max')): + return gridlib.GRID_VALUE_NUMBER + ':'\ + + str(attrconf.min) + ',' + str(attrconf.max) else: return gridlib.GRID_VALUE_NUMBER - - elif tt in (types.FloatType,types.ComplexType): - if (hasattr(attrconf,'digits_integer') & hasattr(attrconf,'digits_fraction')): - return gridlib.GRID_VALUE_FLOAT+':'\ - +str(attrconf.digits_integer)+','\ - +str(attrconf.digits_fraction) + + elif tt in (types.FloatType, types.ComplexType): + if (hasattr(attrconf, 'digits_integer') & hasattr(attrconf, 'digits_fraction')): + return gridlib.GRID_VALUE_FLOAT + ':'\ + + str(attrconf.digits_integer) + ','\ + + str(attrconf.digits_fraction) else: return gridlib.GRID_VALUE_FLOAT - - - elif tt in (types.UnicodeType,types.StringType): + + elif tt in (types.UnicodeType, types.StringType): return gridlib.GRID_VALUE_STRING - - elif tt in (types.BooleanType,): + + elif tt in (types.BooleanType,): return gridlib.GRID_VALUE_BOOL - - else: + + else: # else means use a the base class that can display anything return gridlib.GRID_VALUE_STRING - - - - + def GetNumberRows(self): return len(self.ids) def GetNumberCols(self): return len(self.attrconfigs) - def IsEmptyCell(self, row, col): - return (row>len(self.ids)) | (col > len(self.attrconfigs)) + return (row > len(self.ids)) | (col > len(self.attrconfigs)) def GetValue(self, row, col): """ Returns object value to be displayed in the cell. """ - ###### TODO: this should be all handled by format_value of the attrconf !!!! + # TODO: this should be all handled by format_value of the attrconf !!!! try: - rowid, attrconf = self.get_id_attrconf(row,col) - if (rowid ==None) | (attrconf == None): + rowid, attrconf = self.get_id_attrconf(row, col) + if (rowid == None) | (attrconf == None): return 'Err' - #attrconf=self.attrconfigs[col] - val=self.get_objvalue(row,col) + # attrconf=self.attrconfigs[col] + val = self.get_objvalue(row, col) mt = attrconf.metatype - - - - #print 'GetValue',self.ids[row],attrconf.attrname,val,mt,hasattr(attrconf,'choices'),attrconf.is_writable() - - - if mt =='objs': + + # print + # 'GetValue',self.ids[row],attrconf.attrname,val,mt,hasattr(attrconf,'choices'),attrconf.is_writable() + + if mt == 'objs': return val.format_ident() - - elif mt =='id': - #print ' =>',val - if hasattr(attrconf,'choices'): - if type(attrconf.choices) in (OrderedDict, types.DictionaryType):#(types.ListType, types.TupleType): - if attrconf.choices.values().count(val)>0: + + elif mt == 'id': + # print ' =>',val + if hasattr(attrconf, 'choices'): + # (types.ListType, types.TupleType): + if type(attrconf.choices) in (OrderedDict, types.DictionaryType): + if attrconf.choices.values().count(val) > 0: ind = attrconf.choices.values().index(val) - #print ' return',attrconf.choices.keys()[ind] + # print ' return',attrconf.choices.keys()[ind] return attrconf.choices.keys()[ind] else: return val else: - #print ' GridCellChoiceEditor',attrconf.choices,':'+','.join(attrconf.choices) + # print ' + # GridCellChoiceEditor',attrconf.choices,':'+','.join(attrconf.choices) return val - + else: - return val - - elif mt =='ids': - #print ' =>',val + return val + + elif mt == 'ids': + # print ' =>',val return str(val) - - elif mt =='tabid': - obj,_id = val + + elif mt == 'tabid': + obj, _id = val return obj.format_ident_row(_id) - - elif mt =='tabidlist': - return attrconf.format_value(rowid) # <<<<<<<< should work for all types !!! - - elif hasattr(attrconf,'choices'): - #print ' attrconf.choices',attrconf.choices - if type(attrconf.choices) in (OrderedDict, types.DictionaryType):#(types.ListType, types.TupleType): - if attrconf.choices.values().count(val)>0: + + elif mt == 'tabidlist': + # <<<<<<<< should work for all types !!! + return attrconf.format_value(rowid) + + elif hasattr(attrconf, 'choices'): + # print ' attrconf.choices',attrconf.choices + # (types.ListType, types.TupleType): + if type(attrconf.choices) in (OrderedDict, types.DictionaryType): + if attrconf.choices.values().count(val) > 0: ind = attrconf.choices.values().index(val) - #print ' return',attrconf.choices.keys()[ind] + # print ' return',attrconf.choices.keys()[ind] return attrconf.choices.keys()[ind] else: return val else: - if attrconf.choices.count(val)>0: + if attrconf.choices.count(val) > 0: ind = attrconf.choices.index(val) - #print ' return',attrconf.choices[ind] + # print ' return',attrconf.choices[ind] return attrconf.choices[ind] else: return val - - elif mt == 'color': # special config for colors + + elif mt == 'color': # special config for colors # done by cell backgroundcolor return '' - - #elif config.has_key('do_init_arrayobj'): + + # elif config.has_key('do_init_arrayobj'): # if config['do_init_arrayobj']: # return val.ident # else: # return val - + else: return val - - - + except IndexError: return 'Err' - - def get_objvalue(self,row,col): + + def get_objvalue(self, row, col): """ Returns value of referred object according to row and col of grid """ return self.attrconfigs[col][self.ids[row]] - + def get_valueconfigs(self): return self.attrconfigs - - def get_id_attrconf(self,row,col): - if (col >= 0) & ( col < len(self.attrconfigs) ) : - if (row >= 0) & ( row < len(self.ids) ) : + + def get_id_attrconf(self, row, col): + if (col >= 0) & (col < len(self.attrconfigs)): + if (row >= 0) & (row < len(self.ids)): return self.ids[row], self.attrconfigs[col] else: return None, self.attrconfigs[col] else: - if (row >= 0) & ( row < len(self.ids) ) : + if (row >= 0) & (row < len(self.ids)): return self.ids[row], None else: return None, None - - #def get_perm(self, attrconf,id): + + # def get_perm(self, attrconf,id): # """ # Return read write permission # """ @@ -2012,65 +1983,68 @@ # #print 'get_perm',id, attr # return attrconf.get_perm() - def SetValue(self, row, col, value): """ Transfer of cell value to object. """ - id, attrconf = self.get_id_attrconf( row, col ) + id, attrconf = self.get_id_attrconf(row, col) if attrconf != None: if attrconf.is_writable(): - #print 'SetValue(%d, %d, "%s").\n' % (row, col, value) - - #print ' attrconf',id,attrconf.attrname, attrconf.is_writable(),hasattr(attrconf,'choices') + # print 'SetValue(%d, %d, "%s").\n' % (row, col, value) + + # print ' attrconf',id,attrconf.attrname, attrconf.is_writable(),hasattr(attrconf,'choices') # attr=self.attrs[col] tt = type(attrconf.get_default()) - if hasattr(attrconf,'choices'): - #print ' type(attrconf.choices)',type(attrconf.choices),type(attrconf.choices) in (OrderedDict, types.DictionaryType) - if type(attrconf.choices) in (OrderedDict, types.DictionaryType):#(types.ListType, types.TupleType): - #print ' set choices[value]',attrconf.choices[value] + if hasattr(attrconf, 'choices'): + # print ' + # type(attrconf.choices)',type(attrconf.choices),type(attrconf.choices) + # in (OrderedDict, types.DictionaryType) + # (types.ListType, types.TupleType): + if type(attrconf.choices) in (OrderedDict, types.DictionaryType): + # print ' set choices[value]',attrconf.choices[value] if attrconf.choices.has_key(value): attrconf[id] = attrconf.choices[value] else: attrconf[id] = value - - + else: - #print ' set value',value + # print ' set value',value attrconf[id] = value - - if (tt in (types.BooleanType,types.FloatType,types.IntType,types.LongType,types.StringType,types.UnicodeType,types.ComplexType)): + + if (tt in (types.BooleanType, types.FloatType, types.IntType, types.LongType, types.StringType, types.UnicodeType, types.ComplexType)): # set only values of types that are allowed for the grid # TODO: this grid types data must be organized more central attrconf[id] = value else: - # TODO: for other types, like color or arrays, this must be done beforehand - print 'WARNING in SetValue: cannot write to this type:',tt + # TODO: for other types, like color or arrays, this must be + # done beforehand + print 'WARNING in SetValue: cannot write to this type:', tt else: # readonly pass - #print 'SetValue(%d, %d, "%s") read only.\n' % (row, col, value) + # print 'SetValue(%d, %d, "%s") read only.\n' % (row, col, + # value) #-------------------------------------------------- # Some optional methods # Called when the grid needs to display labels def GetColLabelValue(self, col): - if (col>-1)&(col -1) & (col < len(self.colnames)): return self.colnames[col] else: return '-' def GetRowLabelValue(self, col): - return self.FormatRowLabel(self.tab,self.ids[col]) - + return self.FormatRowLabel(self.tab, self.ids[col]) + def FormatRowLabel(self, tab, id): - #if tab.is_keyindex(): + # if tab.is_keyindex(): # label = str(tab.get_key_from_id(id)) - #else: - label= str(id) + # else: + label = str(id) return label - + # if size==None: # return label # else: @@ -2078,8 +2052,8 @@ # return (size*' '+label)[-size:] # else: # return label - - #def ComputeRowLabelSize(self): + + # def ComputeRowLabelSize(self): # size = 0 # tab = self.tab # for id in self.ids: @@ -2087,81 +2061,78 @@ # if l>size: # size=l # print 'ComputeRowLabelSize',size*16 - # return size*16# TODO here should be the font size as multiplier - + # return size*16# TODO here should be the font size as multiplier + def ComputeColLabelSize(self): """ Compute the maximum number of lines required for column labelling """ - #print 'ComputeColLabelSize',self.colnames + # print 'ComputeColLabelSize',self.colnames lines = 0 for name in self.colnames: l = name.count('\n') - if l>lines: - lines=l - size = (lines+1)*32 - #print ' size=',size - return size# TODO here should be the font size as multiplier - - - + if l > lines: + lines = l + size = (lines + 1) * 32 + # print ' size=',size + return size # TODO here should be the font size as multiplier + def CanHaveAttributes(self): - # TODO: if the story with returning the attribute + # TODO: if the story with returning the attribute # for each cell is getting too slow we might want to restrict this - # to cases when we actually need to modify the attribute + # to cases when we actually need to modify the attribute # as for example with colors return True - - def GetAttr(self,row,col,flag=0): - #print 'GetAttr row,col,flag',row,col,flag - attrconf=self.attrconfigs[col] - #print ' self.ids',self.ids - id=self.ids[row] - #config=self.obj.get_config(attr) + + def GetAttr(self, row, col, flag=0): + # print 'GetAttr row,col,flag',row,col,flag + attrconf = self.attrconfigs[col] + # print ' self.ids',self.ids + id = self.ids[row] + # config=self.obj.get_config(attr) tt = type(attrconf.get_default()) mt = attrconf.metatype - val=attrconf[id] - #print 'GetAttr',attr,val,config['type'][-1] + val = attrconf[id] + # print 'GetAttr',attr,val,config['type'][-1] # define cell attribute for this column cellattr = gridlib.GridCellAttr() - + if attrconf.is_readonly(): cellattr.SetReadOnly(True) - - if mt=='color': # special config for colors - #ffffff = self.color_to_ffffff(val) - #print ' set bgcolor',ffffff - #cellattr.SetBackgroundColour(ffffff) - - cint = np.array(np.array(val)*255,np.int32) - - cellattr.SetBackgroundColour(wx.Colour(cint[0],cint[1],cint[2],cint[3])) - - - #elif config['metatype']=='penstyle': + + if mt == 'color': # special config for colors + #ffffff = self.color_to_ffffff(val) + # print ' set bgcolor',ffffff + # cellattr.SetBackgroundColour(ffffff) + + cint = np.array(np.array(val) * 255, np.int32) + + cellattr.SetBackgroundColour( + wx.Colour(cint[0], cint[1], cint[2], cint[3])) + + # elif config['metatype']=='penstyle': # cellattr.SetRenderer(PenstyleRenderer(self.obj.get_pentable())) - + # check whether to make a hyperlink in blue to an instance - #if len(config['type'])==1: - #if (tt in (types.InstanceType,types.ClassType)): + # if len(config['type'])==1: + # if (tt in (types.InstanceType,types.ClassType)): # if hasattr(val,'ident'): - #print ' is configurator object',val.ident + # print ' is configurator object',val.ident if mt in METATYPES_LINKSTYLE: - cellattr.SetTextColour('blue') - # no!!cellattr.SetFlags (wx.TEXT_ATTR_FONT_UNDERLINE) - cellattr.SetReadOnly(False) - + cellattr.SetTextColour('blue') + # no!!cellattr.SetFlags (wx.TEXT_ATTR_FONT_UNDERLINE) + cellattr.SetReadOnly(False) + return cellattr - - + # Called to determine the kind of editor/renderer to use by # default, doesn't necessarily have to be the same type used # natively by the editor/renderer if they know how to convert. def GetTypeName(self, row, col): - if (col>-1)&(col -1) & (col < len(self.celltypes)): return self.celltypes[col] else: - return wx._mainframe # this can do anything + return wx._mainframe # this can do anything # Called to determine how the data can be fetched and stored by the # editor and renderer. This allows you to enforce some type-safety @@ -2177,116 +2148,118 @@ def CanSetValueAs(self, row, col, typeName): #id, attr = self.get_id_attrconf( row, col ) - #print 'CanSetValueAs',id, attr + # print 'CanSetValueAs',id, attr return self.CanGetValueAs(row, col, typeName) - - - + + #--------------------------------------------------------------------------- -#class TablePanel(wx.Panel): +# class TablePanel(wx.Panel): # def __init__(self, parent, tab, **args): # wx.Panel.__init__(self, parent, -1) # grid = TableFrame(self,tab, **args) # self.Sizer = wx.BoxSizer() # self.Sizer.Add(grid, 1, wx.EXPAND) -# +# # #grid.SetReadOnly(5,5, True) # def restore(self): # pass # #self.grid.restore() - -class TabPanel(AttrBase,gridlib.Grid): - def __init__(self, parent, tab, objpanel = None, attrconfigs=None, ids=None, show_ids=True, - func_change_obj = None, - func_choose_id = None, - func_choose_attr = None, - func_apply = None, - mainframe = None,**args): + +class TabPanel(AttrBase, gridlib.Grid): + + def __init__(self, parent, tab, objpanel=None, attrconfigs=None, ids=None, show_ids=True, + func_change_obj=None, + func_choose_id=None, + func_choose_attr=None, + func_apply=None, + mainframe=None, **args): """ parent: parent widget, containing the grid tab: table containing the actual data of an object """ - # TODO: Attention: parent is always the main object panel - - #print ' gridlib.Grid',dir(gridlib.Grid) - gridlib.Grid.__init__(self, parent, -1)#, style =wx.EXPAND| wx.ALL)#wx.EAST | wx.WEST) ) - + # TODO: Attention: parent is always the main object panel + + # print ' gridlib.Grid',dir(gridlib.Grid) + # , style =wx.EXPAND| wx.ALL)#wx.EAST | wx.WEST) ) + gridlib.Grid.__init__(self, parent, -1) + # parent must be panel, scrolled panel or similar self.parent = parent self.tab = tab self._objpanel = objpanel - self.func_change_obj=func_change_obj - self.func_choose_id=func_choose_id - self.func_choose_attr=func_choose_attr + self.func_change_obj = func_change_obj + self.func_choose_id = func_choose_id + self.func_choose_attr = func_choose_attr self.func_apply = func_apply - self.mainframe=mainframe - - if ids==None: + self.mainframe = mainframe + + if ids == None: # show all ids - ids=tab.get_ids()# ordered=True - - - if attrconfigs==None: + ids = tab.get_ids() # ordered=True + + if attrconfigs == None: # show all array type attributes - attrconfigs=tab.get_colconfigs() - - #print 'init TablePanel',tab.get_ident(),ids - #print ' start init TableGrid',len(ids),len(attrconfigs) - # this table contains the gui functionalily of the grid - table = TableGrid(self,tab, attrconfigs = attrconfigs, ids=ids, - show_ids=show_ids, **args) - #print ' end init TableGrid' + attrconfigs = tab.get_colconfigs() + + # print 'init TablePanel',tab.get_ident(),ids + # print ' start init TableGrid',len(ids),len(attrconfigs) + # this table contains the gui functionalily of the grid + table = TableGrid(self, tab, attrconfigs=attrconfigs, ids=ids, + show_ids=show_ids, **args) + # print ' end init TableGrid' # The second parameter means that the grid is to take ownership of the # table and will destroy it when done. Otherwise you would need to keep # a reference to it and call it's Destroy method later. self.SetTable(table, True) - #print ' done SetTable' - #self.SetRowLabelSize(16) - #self.SetColLabelSize(16) - #self.SetRowLabelSize(table.ComputeRowLabelSize()) + # print ' done SetTable' + # self.SetRowLabelSize(16) + # self.SetColLabelSize(16) + # self.SetRowLabelSize(table.ComputeRowLabelSize()) self.SetColLabelSize(table.ComputeColLabelSize()) - #print ' done SetColLabelSize' + # print ' done SetColLabelSize' #self.AutoSize () - - #for col in xrange(len(attrconfigs)): + + # for col in xrange(len(attrconfigs)): # self.AutoSizeColLabelSize (col) - + # these operations are nice but slow for huge tables!! - if len(ids)<100: + if len(ids) < 100: self.AutoSizeColumns(True) - #print ' done AutoSizeColumns' - if len(ids)<100: + # print ' done AutoSizeColumns' + if len(ids) < 100: self.AutoSizeRows(True) - #print ' done AutoSizeRows' - - #self.Bind(gridlib.EVT_GRID_CELL_CHANGE, self.on_cell_change) #works, but not used - - #EVT_GRID_CELL_RIGHT_CLICK(self, self.OnRightDown) #added - gridlib.EVT_GRID_CELL_RIGHT_CLICK(self, self.on_contextmenu) #added - self.Bind(gridlib.EVT_GRID_LABEL_RIGHT_CLICK, self.on_contextmenu_label) - + # print ' done AutoSizeRows' + + # self.Bind(gridlib.EVT_GRID_CELL_CHANGE, self.on_cell_change) #works, + # but not used + + # EVT_GRID_CELL_RIGHT_CLICK(self, self.OnRightDown) #added + gridlib.EVT_GRID_CELL_RIGHT_CLICK(self, self.on_contextmenu) # added + self.Bind(gridlib.EVT_GRID_LABEL_RIGHT_CLICK, + self.on_contextmenu_label) + # does not seem to work - gridlib.EVT_GRID_CELL_LEFT_DCLICK(self, self.on_edit_cell) - gridlib.EVT_GRID_CELL_LEFT_CLICK(self, self.on_click_cell) - + gridlib.EVT_GRID_CELL_LEFT_DCLICK(self, self.on_edit_cell) + gridlib.EVT_GRID_CELL_LEFT_CLICK(self, self.on_click_cell) + gridlib.EVT_GRID_LABEL_LEFT_DCLICK(self, self.OnLabelLeftDoubleClick) #??gridlib.EVT_GRID_LABEL_LEFT_CLICK(self, self.OnLabelLeftClick) #EVT_CONTEXT_MENU(self, self.on_contextmenu) - #self.Bind(wx.EVT_CONTEXT_MENU, self.on_contextmenu) - #print ' done init TabPanel' - #def on_contextmenu(self, event): + #self.Bind(wx.EVT_CONTEXT_MENU, self.on_contextmenu) + # print ' done init TabPanel' + # def on_contextmenu(self, event): # print '\non_contextmenu!!!' - + def Reset(self): """reset the view based on the data in the table. Call this when rows are added or destroyed""" - #self._table.ResetView(self) + # self._table.ResetView(self) self.AdjustScrollbars() self.ForceRefresh() - - def logw(self,s): + + def logw(self, s): """ Write to logger if existent print otherwise """ @@ -2295,126 +2268,128 @@ def on_cell_change(self, event): Row = event.GetRow() Col = event.GetCol() - - #All cells have a value, regardless of the editor. - #print 'Changed cell: (%u, %u)' % (Row, Col) - #print 'value: %s' % self.grid1.GetCellValue(Row, Col) - + + # All cells have a value, regardless of the editor. + # print 'Changed cell: (%u, %u)' % (Row, Col) + # print 'value: %s' % self.grid1.GetCellValue(Row, Col) + def get_obj(self): """ Returns object wich is represented by this table. """ return self.tab.get_obj() - + def on_contextmenu(self, event): - #print "on_contextmenu (%d,%d) %s\n" %\ + # print "on_contextmenu (%d,%d) %s\n" %\ # (event.GetRow(), event.GetCol(), event.GetPosition()) - menu=AgilePopupMenu(self.parent) - + menu = AgilePopupMenu(self.parent) + # tell popup menue in which cell it has been called # in this way a later event can retrieve cell coordinates menu.set_row(event.GetRow()) menu.set_col(event.GetCol()) - menu.append_item( 'edit...',self.on_edit_cell_from_popupmenu, - info='Edit data of this cell') - + menu.append_item('edit...', self.on_edit_cell_from_popupmenu, + info='Edit data of this cell') + # Popup the menu. If an item is selected then its handler # will be called before PopupMenu returns. self.parent.PopupMenu(menu) menu.Destroy() - - - + def on_edit_cell_from_popupmenu(self, event): """Start cell editor""" popupmenu = event.GetEventObject() - + table = self.GetTable() - id, attrconf = table.get_id_attrconf(popupmenu.get_row(), popupmenu.get_col()) - #print 'on_edit_cell EventObject=',id, attrconf.attrname#popupmenu - if (id>=0)&(attrconf!=None): - - #dlg = ObjPanelDialog(self,self.tab.get_obj(),table = self.tab,id,attrconfigs=[attrconf,], size=(350, 200), + id, attrconf = table.get_id_attrconf( + popupmenu.get_row(), popupmenu.get_col()) + # print 'on_edit_cell EventObject=',id, attrconf.attrname#popupmenu + if (id >= 0) & (attrconf != None): + + # dlg = ObjPanelDialog(self,self.tab.get_obj(),table = self.tab,id,attrconfigs=[attrconf,], size=(350, 200), # #style = wxCAPTION | wxSYSTEM_MENU | wxTHICK_FRAME # style = wx.DEFAULT_DIALOG_STYLE # ) - - dlg = ObjPanelDialog(self, - self.tab.get_obj(), - attrconfigs=[attrconf,], - #tables = None, - table = self.tab, id=id, ids=None, - #groupnames = None, - #title = '', size = wx.DefaultSize, pos = wx.DefaultPosition,\ - style = wx.DEFAULT_DIALOG_STYLE, - #choose_id=False, choose_attr=False, - #func_choose_id=None,func_change_obj=None, - func_apply = self.func_apply, - #panelstyle = 'default', - #immediate_apply = False - ) - + + dlg = ObjPanelDialog(self, + self.tab.get_obj(), + attrconfigs=[attrconf, ], + #tables = None, + table=self.tab, id=id, ids=None, + #groupnames = None, + # title = '', size = wx.DefaultSize, pos = + # wx.DefaultPosition,\ + style=wx.DEFAULT_DIALOG_STYLE, + # choose_id=False, choose_attr=False, + # func_choose_id=None,func_change_obj=None, + func_apply=self.func_apply, + #panelstyle = 'default', + #immediate_apply = False + ) + dlg.CenterOnScreen() - + # this does not return until the dialog is closed. val = dlg.ShowModal() - + if val == wx.ID_OK: # apply current widget values dlg.apply() else: - #print ">>>>>>>>>You pressed Cancel\n" + # print ">>>>>>>>>You pressed Cancel\n" pass - + dlg.Destroy() - + event.Skip() self.ForceRefresh() #sz = miniframe.GetBestSize() #miniframe.SetSize( (sz.width+20, sz.height+20) ) - + def on_contextmenu_label(self, event): - #print "on_contextmenu_label (%d,%d) %s\n" %\ + # print "on_contextmenu_label (%d,%d) %s\n" %\ # (event.GetRow(), event.GetCol(), event.GetPosition()) - menu=AgilePopupMenu(self.parent) - + menu = AgilePopupMenu(self.parent) + # tell popup menue in which cell it has been called # in this way a later event can retrieve cell coordinates col = event.GetCol() row = event.GetRow() menu.set_row(row) menu.set_col(col) - if col<0: - + if col < 0: + # popup row options menu self._contextfunctions = {} - #print ' configs',self.tab.get_configs(is_all=True) + # print ' configs',self.tab.get_configs(is_all=True) for config in self.tab.get_configs(is_all=True): - #print ' ',config.attrname,config.groupnames,'rowfunctions' in config.groupnames + # print ' ',config.attrname,config.groupnames,'rowfunctions' + # in config.groupnames if 'rowfunctions' in config.groupnames: - item,id = menu.append_item( config.get_name(),self.on_select_rowfunction, info=config.get_info()) + item, id = menu.append_item( + config.get_name(), self.on_select_rowfunction, info=config.get_info()) #item,id = menu.append_item( config.name,config.get_function(), info=config.info) - self._contextfunctions[id]=config.get_function() - #print ' append ',config.name,id + self._contextfunctions[id] = config.get_function() + # print ' append ',config.name,id #menu.append_item( config.name,self.on_select_contextmenu, info=config.info) - - #default - menu.append_item( 'Export to CSV...',self.on_export_csv, - info='Export entire table in CSV format.') - - # Menu on_highlight events + + # default + menu.append_item('Export to CSV...', self.on_export_csv, + info='Export entire table in CSV format.') + + # Menu on_highlight events #self.parent.Bind(wx.EVT_MENU_HIGHLIGHT_ALL, self.on_) - + # Popup the menu. If an item is selected then its handler # will be called before PopupMenu returns. - + self.parent.PopupMenu(menu) menu.Destroy() - + def on_dummy(self, event): - #event.Skip() + # event.Skip() pass - + def on_select_rowfunction(self, event): popupmenu = event.GetEventObject() # Show how to get menu item info from this event handler @@ -2423,74 +2398,66 @@ col = popupmenu.get_col() id, attrconf = table.get_id_attrconf(row, col) id_menu = event.GetId() - #print 'on_select_contextmenu id_menu,id, attrconf',id_menu,id, attrconf - #print ' GetSelection',event.GetSelection() - #print ' GetString',event.GetString() - - #print ' GetId',id_menu,event.Id - #print ' GetClientObject',event.GetClientObject() - + # print 'on_select_contextmenu id_menu,id, attrconf',id_menu,id, attrconf + # print ' GetSelection',event.GetSelection() + # print ' GetString',event.GetString() + + # print ' GetId',id_menu,event.Id + # print ' GetClientObject',event.GetClientObject() + # call selected row function with row id self._contextfunctions[id_menu](id) - - #item = popupmenu.get_menuitem_from_id(event.GetId())# OK but not neede - #if self._rowfunctions.has_keid_menu: + + # item = popupmenu.get_menuitem_from_id(event.GetId())# OK but not neede + # if self._rowfunctions.has_keid_menu: # funcname = item.GetText() - # #help = item.GetHelp() + # #help = item.GetHelp() # #??? menu id->name->function?????????? # print 'on_select_contextmenu: found function:',funcname#,getattr(table,funcname) # self._rowfunctions[id] - #else: + # else: # print 'on_select_contextmenu: No function found' - + event.Skip() - #self.ForceRefresh() - #self.grid.AutoSizeColumn(col) + # self.ForceRefresh() + # self.grid.AutoSizeColumn(col) self.Reset() self.Refresh() - self.ForceRefresh() - + self.ForceRefresh() + #del table - newtable = TableGrid(self,self.tab, attrconfigs = self.tab.get_colconfigs(), ids=self.tab.get_ids(), show_ids=table.show_ids) + newtable = TableGrid(self, self.tab, attrconfigs=self.tab.get_colconfigs( + ), ids=self.tab.get_ids(), show_ids=table.show_ids) del table # The second parameter means that the grid is to take ownership of the # table and will destroy it when done. Otherwise you would need to keep # a reference to it and call it's Destroy method later. self.SetTable(newtable, True) - + return None - - - - - - + def on_export_csv(self, event): wildcards_all = "CSV file (*.csv,*.txt)|*.csv;*.CSV;*.txt;*.TXT|All files (*.*)|*.*" - #if hasattr(attrconf,'wildcards'): + # if hasattr(attrconf,'wildcards'): # wildcards = attrconf.wildcards+"|"+wildcards_all - #else: + # else: # wildcards = wildcards_all - dlg = wx.FileDialog(self.parent, message="Export table %s to CSV"%self.tab.get_name(), - #defaultDir=os.getcwd(), + dlg = wx.FileDialog(self.parent, message="Export table %s to CSV" % self.tab.get_name(), + # defaultDir=os.getcwd(), defaultFile="", - wildcard = wildcards_all, - style=wx.SAVE| wx.CHANGE_DIR + wildcard=wildcards_all, + style=wx.SAVE | wx.CHANGE_DIR ) - + if dlg.ShowModal() == wx.ID_OK: # This returns a Python list of files that were selected. path = dlg.GetPath() - #print 'You selected %d files:' % len(paths) - if type(path) in (types.StringType,types.UnicodeType): - self.tab.export_csv(path, sep=',', name_id='ID', - file=None, attrconfigs = self.GetTable().get_valueconfigs(), - groupname = None, is_header = True) - - - - - + # print 'You selected %d files:' % len(paths) + if type(path) in (types.StringType, types.UnicodeType): + self.tab.export_csv(path, sep=',', name_id='ID', + file=None, attrconfigs=self.GetTable().get_valueconfigs(), + groupname=None, is_header=True) + def on_click_cell(self, event): """ Action for first click on cell. @@ -2498,57 +2465,58 @@ # check if there is something to navigate if self.CanEnableCellControl(): table = self.GetTable() - id, attrconf = table.get_id_attrconf(event.GetRow(), event.GetCol()) + id, attrconf = table.get_id_attrconf( + event.GetRow(), event.GetCol()) mt = attrconf.metatype - #config=table.obj.get_config(attr) - #print 'on_click_cell ,id,attrconf',id, attrconf.get_name(),mt - #print ' func_change_obj=',self.func_change_obj - #if hasattr(attrconf,'attrname'): + # config=table.obj.get_config(attr) + # print 'on_click_cell ,id,attrconf',id, attrconf.get_name(),mt + # print ' func_change_obj=',self.func_change_obj + # if hasattr(attrconf,'attrname'): # print ' attrconf.attrname=',attrconf.attrname - + # navigate! - value = attrconf[id] - #print ' value ' , value, type(value) - if mt =='obj': - if type(value)==types.InstanceType: - #print ' ident?',hasattr(value,'ident') - if hasattr(value,'ident'): - navitimer = wx.FutureCall(1, self.func_change_obj, value) - + value = attrconf[id] + # print ' value ' , value, type(value) + if mt == 'obj': + if type(value) == types.InstanceType: + # print ' ident?',hasattr(value,'ident') + if hasattr(value, 'ident'): + navitimer = wx.FutureCall( + 1, self.func_change_obj, value) + else: event.Skip() else: event.Skip() - - elif mt =='id': - + + elif mt == 'id': + linktab = attrconf.get_linktab() - #print ' FutureCall',linktab, value - navitimer = wx.FutureCall(1, self.func_change_obj, linktab, value)# here value is id - - elif mt =='tabid': + # print ' FutureCall',linktab, value + navitimer = wx.FutureCall( + 1, self.func_change_obj, linktab, value) # here value is id + + elif mt == 'tabid': linktab, id = value - navitimer = wx.FutureCall(1, self.func_change_obj, linktab, id)# here value is id - - elif mt =='ids': + navitimer = wx.FutureCall( + 1, self.func_change_obj, linktab, id) # here value is id + + elif mt == 'ids': linktab = attrconf.get_linktab() - navitimer = wx.FutureCall(1, self.func_change_obj, linktab,None, value)# here value is ids list + # here value is ids list + navitimer = wx.FutureCall( + 1, self.func_change_obj, linktab, None, value) else: - event.Skip() - #elif config.has_key('do_init_arrayobj'): + event.Skip() + # elif config.has_key('do_init_arrayobj'): # if config['do_init_arrayobj']: # navitimer = wx.FutureCall(1, self.func_change_obj,table.obj[attr,id]) # else: # event.Skip() - + else: event.Skip() - - - - - - + def on_edit_cell(self, event): """ Decide how to to edit the cell. Possibilities are: @@ -2557,276 +2525,271 @@ """ table = self.GetTable() id, attrconf = table.get_id_attrconf(event.GetRow(), event.GetCol()) - - # check first if there are callback functions - if self.func_choose_id!=None: + + # check first if there are callback functions + if self.func_choose_id != None: # call self.func_choose_id # - wx.FutureCall(1,self.func_choose_id,id,attrconf) - #event.Skip() + wx.FutureCall(1, self.func_choose_id, id, attrconf) + # event.Skip() return - - elif self.func_choose_attr!=None: + + elif self.func_choose_attr != None: # call self.func_choose_id - wx.FutureCall(1,self.func_choose_attr,attrconf) - #event.Skip() + wx.FutureCall(1, self.func_choose_attr, attrconf) + # event.Skip() return - + if self.CanEnableCellControl(): - + #self.logw(' func_choose_id id=%d,attr=%s,ident=%s='%(id, attr,table.obj.ident)) - #print 'on_edit_cell',attrconf.attrname - #print ' obj=',table.obj - - #print ' config=',config - + # print 'on_edit_cell',attrconf.attrname + # print ' obj=',table.obj + + # print ' config=',config + metatype = attrconf.metatype - - if metatype == 'color': # special config for colors + + if metatype == 'color': # special config for colors dlg = wx.ColourDialog(self.parent) - - # Ensure the full colour dialog is displayed, + + # Ensure the full colour dialog is displayed, # not the abbreviated version. dlg.GetColourData().SetChooseFull(True) - + if dlg.ShowModal() == wx.ID_OK: # If the user selected OK, then the dialog's wx.ColourData will # contain valid information. Fetch the data ... c = dlg.GetColourData().GetColour() - - - #print 'on_edit_cell:' - #print ' wxc=',[wxc.Red(),wxc.Green(),wxc.Blue()] - #print ' table.obj[attr, id]=',table.obj[attr, id],type(table.obj[attr, id]) - #print ' ffffff_to_color=',self.ffffff_to_color( [wxc.Red(),wxc.Green(),wxc.Blue()] ),type(self.ffffff_to_color( [wxc.Red(),wxc.Green(),wxc.Blue()] )) - - attrconf[id]=np.array([c.Red(),c.Green(),c.Blue(),c.Alpha()],np.float32)/255.0#self.ffffff_to_color([wxc.Red(),wxc.Green(),wxc.Blue()] ) - self.SetCellBackgroundColour(event.GetRow(), event.GetCol(),c) + + # print 'on_edit_cell:' + # print ' wxc=',[wxc.Red(),wxc.Green(),wxc.Blue()] + # print ' table.obj[attr, id]=',table.obj[attr, id],type(table.obj[attr, id]) + # print ' ffffff_to_color=',self.ffffff_to_color( + # [wxc.Red(),wxc.Green(),wxc.Blue()] + # ),type(self.ffffff_to_color( + # [wxc.Red(),wxc.Green(),wxc.Blue()] )) + + # self.ffffff_to_color([wxc.Red(),wxc.Green(),wxc.Blue()] ) + attrconf[id] = np.array( + [c.Red(), c.Green(), c.Blue(), c.Alpha()], np.float32) / 255.0 + self.SetCellBackgroundColour( + event.GetRow(), event.GetCol(), c) self.ForceRefresh() - if self.func_apply!=None: - wx.FutureCall(1,self.func_apply, table, id, None) - + if self.func_apply != None: + wx.FutureCall(1, self.func_apply, table, id, None) + # Once the dialog is destroyed, Mr. wx.ColourData is no longer your # friend. Don't use it again! dlg.Destroy() - #event.Skip() - #cellattr.SetBackgroundColour(obj[]) - + # event.Skip() + # cellattr.SetBackgroundColour(obj[]) + elif metatype == 'filepath': filepath = self.on_fileopen(attrconf) if filepath != None: attrconf[id] = filepath - self.ForceRefresh() - if self.func_apply!=None: - wx.FutureCall(1,self.func_apply, table, id, None) - + self.ForceRefresh() + if self.func_apply != None: + wx.FutureCall(1, self.func_apply, table, id, None) + elif metatype == 'dirpath': dirpath = self.on_diropen(attrconf) if dirpath != None: attrconf[id] = dirpath - self.ForceRefresh() - if self.func_apply!=None: - wx.FutureCall(1,self.func_apply, table, id, None) - #elif metatype == 'penstyle': - # #Penstyles(table.obj.get_pentable()) + self.ForceRefresh() + if self.func_apply != None: + wx.FutureCall(1, self.func_apply, table, id, None) + # elif metatype == 'penstyle': + # #Penstyles(table.obj.get_pentable()) # #penstyles=Penstyles(table.obj.get_pentable()) - # + # # dlg = PenstyleDialog(self.parent, # table.obj.get_pentable(), # size = (300,400), # #choose_id=True, # #func_change_obj=self.on_edit_linestyle - # ) - # + # ) + # # if dlg.ShowModal() == wx.ID_OK: # attr_current,idc_current=dlg.get_current_attrconf_id() # table.obj[attr, id]=idc_current - # + # # self.ForceRefresh() # dlg.Destroy() # event.Skip() - + else: self.EnableCellEditControl() # try this ... - #if self.func_apply!=None: + # if self.func_apply!=None: # wx.FutureCall(1,self.func_apply, table, id, None) #...put this in apply method - - def on_fileopen(self,attrconf): - #print 'on_fileopen',self._attrconf.attrname - #if type(self._attrconf.get_default())==types.StringType: + + def on_fileopen(self, attrconf): + # print 'on_fileopen',self._attrconf.attrname + # if type(self._attrconf.get_default())==types.StringType: # defaultname = self._attrconf.get_default() - #else: + # else: # defaultname = os.getcwd() wildcards_all = "All files (*.*)|*.*" - if hasattr(attrconf,'wildcards'): - wildcards = attrconf.wildcards+"|"+wildcards_all + if hasattr(attrconf, 'wildcards'): + wildcards = attrconf.wildcards + "|" + wildcards_all else: wildcards = wildcards_all dlg = wx.FileDialog(self.parent, message="Open file", - #defaultDir=os.getcwd(), + # defaultDir=os.getcwd(), defaultFile="", - wildcard = wildcards, + wildcard=wildcards, style=wx.OPEN | wx.MULTIPLE | wx.CHANGE_DIR ) - + if dlg.ShowModal() == wx.ID_OK: # This returns a Python list of files that were selected. paths = dlg.GetPaths() - #print 'You selected %d files:' % len(paths) - if len(paths)==1: + # print 'You selected %d files:' % len(paths) + if len(paths) == 1: return paths[0] - elif len(paths)>1: + elif len(paths) > 1: return paths else: return None else: return None - - def on_diropen(self,attrconf): + + def on_diropen(self, attrconf): dlg = wx.DirDialog(self.parent, message="Open directory", - style=wx.DD_DEFAULT_STYLE| wx.DD_DIR_MUST_EXIST| wx.DD_CHANGE_DIR - ) + style=wx.DD_DEFAULT_STYLE | wx.DD_DIR_MUST_EXIST | wx.DD_CHANGE_DIR + ) if dlg.ShowModal() == wx.ID_OK: return dlg.GetPath() else: return None - - + def on_edit_cell_miniframe(self, event): """Start miniframe cell editor""" EventObject = event.GetEventObject() - + table = self.GetTable() id, attrconf = table.get_id_attrconf(event.GetRow(), event.GetCol()) #miniframe=DataMiniFrame( self, table.obj, id =id, attrs = [attr]) - print 'on_edit_cell_miniframe EventObject=',id, attrconf - dlg = ObjPanelDialog(self,table.obj,id,attrconfigs=[attrconf], size=(350, 200), - #style = wxCAPTION | wxSYSTEM_MENU | wxTHICK_FRAME - func_apply = self.func_apply, - style = wx.DEFAULT_DIALOG_STYLE - ) + print 'on_edit_cell_miniframe EventObject=', id, attrconf + dlg = ObjPanelDialog(self, table.obj, id, attrconfigs=[attrconf], size=(350, 200), + #style = wxCAPTION | wxSYSTEM_MENU | wxTHICK_FRAME + func_apply=self.func_apply, + style=wx.DEFAULT_DIALOG_STYLE + ) dlg.CenterOnScreen() - + # this does not return until the dialog is closed. val = dlg.ShowModal() - + if val == wx.ID_OK: # apply current widget values dlg.apply() else: - #print ">>>>>>>>>You pressed Cancel\n" + # print ">>>>>>>>>You pressed Cancel\n" pass - + dlg.Destroy() - + evt.Skip() self.ForceRefresh() #sz = miniframe.GetBestSize() #miniframe.SetSize( (sz.width+20, sz.height+20) ) - #self.Refresh()#no - - + # self.Refresh()#no def OnLabelLeftDoubleClick(self, evt): - #print "OnLabelLeftDoubleClick: (%d,%d) %s\n" %\ + # print "OnLabelLeftDoubleClick: (%d,%d) %s\n" %\ # (evt.GetRow(), evt.GetCol(), evt.GetPosition()) - if evt.GetRow()>=0: - table=self.GetTable() + if evt.GetRow() >= 0: + table = self.GetTable() # click has been on row labels = ids - id=table.ids[evt.GetRow()] - - if self.func_choose_id==None: - - #print ' call ScalarPanel editor for ID=',id - - dlg = ObjPanelDialog( self,self.tab.get_obj(),id = id,#table = self.tab, - #title = '', - #size=(350, 200), - #style = wx.DEFAULT_DIALOG_STYLE - func_apply = self.func_apply, - ) - - + id = table.ids[evt.GetRow()] + + if self.func_choose_id == None: + + # print ' call ScalarPanel editor for ID=',id + + dlg = ObjPanelDialog(self, self.tab.get_obj(), id=id, # table = self.tab, + #title = '', + #size=(350, 200), + #style = wx.DEFAULT_DIALOG_STYLE + func_apply=self.func_apply, + ) + dlg.CenterOnScreen() - + # this does not return until the dialog is closed. val = dlg.ShowModal() - + if val == wx.ID_OK: # apply current widget values dlg.apply() if self._objpanel: - self._objpanel.restore()# thi will also update scalars on objpanel + # thi will also update scalars on objpanel + self._objpanel.restore() self.ForceRefresh() else: - #print ">>>>>>>>>You pressed Cancel\n" + # print ">>>>>>>>>You pressed Cancel\n" pass - + dlg.Destroy() - + else: # call self.func_choose_id - wx.FutureCall(1,self.func_choose_id,id,'') - + wx.FutureCall(1, self.func_choose_id, id, '') + evt.Skip() - - - - - - def OnRightDown(self, event): + def OnRightDown(self, event): print "hello", self.GetSelectedRows() def apply(self): """ Widget values are copied to object """ - + # grid always updated - # but there may be callback functions + # but there may be callback functions # which expects a return with current selection pass - #self.ForceRefresh() - - col=self.GetGridCursorCol() - row=self.GetGridCursorRow() + # self.ForceRefresh() + + col = self.GetGridCursorCol() + row = self.GetGridCursorRow() table = self.GetTable() - id, attrconf = table.get_id_attrconf(row,col) - - if self.func_apply!=None: - wx.FutureCall(1,self.func_apply, table, id, None) - + id, attrconf = table.get_id_attrconf(row, col) + + if self.func_apply != None: + wx.FutureCall(1, self.func_apply, table, id, None) + #self.logw('grid.apply row%d col %d'%(row,col)) - if self.func_choose_id!=None: + if self.func_choose_id != None: # call self.func_choose_id - wx.FutureCall(1,self.func_choose_id,id,attrconf) + wx.FutureCall(1, self.func_choose_id, id, attrconf) return - - elif self.func_choose_attr!=None: + + elif self.func_choose_attr != None: # call self.func_choose_id - wx.FutureCall(1,self.func_choose_attr, attrconf) + wx.FutureCall(1, self.func_choose_attr, attrconf) return - - - + def get_current_attrconf_id(self): """ Return current attribute and id """ - col=self.GetGridCursorCol() - row=self.GetGridCursorRow() + col = self.GetGridCursorCol() + row = self.GetGridCursorRow() table = self.GetTable() id, attrconf = table.get_id_attrconf(row, col) - + return attrconf, id - + def restore(self): """ Object values are copied into widgets. @@ -2836,43 +2799,33 @@ # self.ForceRefresh() - - - - - - - - - class ObjPanelMixin: + """ Common methods for panels - """ - def init_panel( self,parent,mainframe=None): - + """ + + def init_panel(self, parent, mainframe=None): """ Initialization of general panel, independent by which type of widow the panel is actually represented - + parent = parent widget """ - - self.parent=parent - self.mainframe=mainframe - self.widgets=None - - + + self.parent = parent + self.mainframe = mainframe + self.widgets = None + # list with widgets containing data # these widgets must have an apply and restore method # which is calle when the respective buttons are pressed. - self.datawidgets=[] - - #self.pentable=pentable - - - #def get_pentable(self): + self.datawidgets = [] + + # self.pentable=pentable + + # def get_pentable(self): # """ # Returns pentable used for this panel # """ @@ -2880,59 +2833,58 @@ # return self.obj.get_pentable() # else: # return self.pentable - + def get_obj(self): return self.obj - + def get_id(self): return self.id - + def clear(self): for widget in self.datawidgets: widget.Destroy() - - - - def recreate_panel( self, obj, id = None, ids = None, groupnames = None, **kwargs): - #print '\nrecreate_panel:',obj.format_ident(), id , ids, groupnames - - #print ' args =',kwargs + + def recreate_panel(self, obj, id=None, ids=None, groupnames=None, **kwargs): + # print '\nrecreate_panel:',obj.format_ident(), id , ids, groupnames + + # print ' args =',kwargs self.obj = obj self.id = id self.ids = ids - - #print ' n_colconfigs =',len(obj.get_colconfigs(filtergroupnames = groupnames)) - #print ' n_configs =',len(obj.get_configs(filtergroupnames = groupnames)) - if (id == None)&(ids == None): - - if obj.managertype=='table': - #print ' managertype',obj.managertype,obj.get_attrsman() - if len(obj.get_colconfigs(filtergroupnames = groupnames))>0: - self.recreate_panel_table(groupnames = groupnames, **kwargs) + + # print ' n_colconfigs =',len(obj.get_colconfigs(filtergroupnames = groupnames)) + # print ' n_configs =',len(obj.get_configs(filtergroupnames = + # groupnames)) + if (id == None) & (ids == None): + + if obj.managertype == 'table': + # print ' managertype',obj.managertype,obj.get_attrsman() + if len(obj.get_colconfigs(filtergroupnames=groupnames)) > 0: + self.recreate_panel_table(groupnames=groupnames, **kwargs) else: - self.recreate_panel_scalar(groupnames = groupnames,**kwargs) + self.recreate_panel_scalar(groupnames=groupnames, **kwargs) else: - self.recreate_panel_scalar(groupnames = groupnames,**kwargs) + self.recreate_panel_scalar(groupnames=groupnames, **kwargs) else: if ids != None: # table with specific ids - self.recreate_panel_table(groupnames = groupnames,**kwargs) + self.recreate_panel_table(groupnames=groupnames, **kwargs) else: # scalar panel for single id - self.recreate_panel_scalar(groupnames = groupnames,**kwargs) - + self.recreate_panel_scalar(groupnames=groupnames, **kwargs) + def recreate_panel_table(self, attrconfigs=None, - groupnames = None, show_groupnames=False, - show_title=True, - is_modal=False, - immediate_apply=False, - panelstyle = 'default', - func_change_obj = None, - func_choose_id = None, - func_choose_attr = None, - func_apply = None, - is_scrolled = True, - **buttonargs): + groupnames=None, show_groupnames=False, + show_title=True, + is_modal=False, + immediate_apply=False, + panelstyle='default', + func_change_obj=None, + func_choose_id=None, + func_choose_attr=None, + func_apply=None, + is_scrolled=True, + **buttonargs): """ Recreates panel and destroys previous contents: attr = a list ith attribute names to be shown @@ -2956,61 +2908,60 @@ have been applied. Arguments are: obj, id, ids """ # - #print 'recreate_panel_table:',self.obj.ident,immediate_apply, func_apply,groupnames - + # print 'recreate_panel_table:',self.obj.ident,immediate_apply, + # func_apply,groupnames - - self.func_change_obj = func_change_obj self.func_choose_id = func_choose_id self.func_choose_attr = func_choose_attr self.func_apply = func_apply self._show_title = show_title - - - - #if is_scrolled == None: - # is_scrolled = not is_modal #for dialog windows use non crolled panels by default - - attrsman = self.obj.get_attrsman() - attrconfigs_scalar = attrsman.get_configs( structs = cm.STRUCTS_SCALAR, filtergroupnames = groupnames) - #print ' attrconfigs_scalar',attrconfigs_scalar - #if obj.managertype=='table': # obj is a single table - #print ' is_scalar_panel & is_singletab:' + + # if is_scrolled == None: + # is_scrolled = not is_modal #for dialog windows use non crolled panels + # by default + + attrsman = self.obj.get_attrsman() + attrconfigs_scalar = attrsman.get_configs( + structs=cm.STRUCTS_SCALAR, filtergroupnames=groupnames) + # print ' attrconfigs_scalar',attrconfigs_scalar + # if obj.managertype=='table': # obj is a single table + # print ' is_scalar_panel & is_singletab:' table = self.obj - + #attrconfigs_scalar = attrsman.get_configs( structs = cm.STRUCTS_SCALAR) - - if len(attrconfigs_scalar)>0: - #print ' create a panel with scalars and a table below' - self.make_scalartablepanel( self,attrconfigs_scalar, table, objpanel =self, - attrconfigs=None, - immediate_apply=immediate_apply, panelstyle=panelstyle, - is_modal = is_modal, show_title=show_title, - is_scrolled=is_scrolled, **buttonargs) - - else: - #print ' create only a table, without scalars'#,attrsman.get_colconfigs(filtergroupnames = groupnames) - self.make_tablepanel( self, table, objpanel = self, attrconfigs=None, groupnames=groupnames, - immediate_apply=immediate_apply, panelstyle=panelstyle, - is_modal = is_modal, show_title=show_title, - is_scrolled=is_scrolled, **buttonargs) + + if len(attrconfigs_scalar) > 0: + # print ' create a panel with scalars and a table below' + self.make_scalartablepanel(self, attrconfigs_scalar, table, objpanel=self, + attrconfigs=None, + immediate_apply=immediate_apply, panelstyle=panelstyle, + is_modal=is_modal, show_title=show_title, + is_scrolled=is_scrolled, **buttonargs) + + else: + # print ' create only a table, without + # scalars'#,attrsman.get_colconfigs(filtergroupnames = groupnames) + self.make_tablepanel(self, table, objpanel=self, attrconfigs=None, groupnames=groupnames, + immediate_apply=immediate_apply, panelstyle=panelstyle, + is_modal=is_modal, show_title=show_title, + is_scrolled=is_scrolled, **buttonargs) self.restore() - return True - - def recreate_panel_scalar( self, attrconfigs=None, - groupnames = None, show_groupnames=False, - show_title=True, - is_modal=False, - immediate_apply=False, - panelstyle='default', - func_change_obj = None, - func_choose_id = None, - func_choose_attr = None, - func_apply = None, - is_scrolled = True, - **buttonargs): + return True + + def recreate_panel_scalar(self, attrconfigs=None, + groupnames=None, show_groupnames=False, + show_title=True, + is_modal=False, + immediate_apply=False, + panelstyle='default', + func_change_obj=None, + func_choose_id=None, + func_choose_attr=None, + func_apply=None, + is_scrolled=True, + **buttonargs): """ Recreates panel and destroys previous contents: attr = a list ith attribute names to be shown @@ -3034,737 +2985,711 @@ have been applied. Arguments are: obj, id, ids """ # - #print 'recreate_panel_scalar:',self.obj.ident, func_apply,groupnames - + # print 'recreate_panel_scalar:',self.obj.ident, func_apply,groupnames + self.func_change_obj = func_change_obj self.func_choose_id = func_choose_id self.func_choose_attr = func_choose_attr self.func_apply = func_apply self._show_title = show_title - - #print ' ',self.obj.managertype,self.obj.get_attrsman() - - #if is_scrolled == None: - # is_scrolled = not is_modal #for dialog windows use non crolled panels by default - - attrsman = self.obj.get_attrsman() - attrconfigs_scalar = attrsman.get_configs(structs = cm.STRUCTS_SCALAR, filtergroupnames = groupnames) + + # print ' ',self.obj.managertype,self.obj.get_attrsman() + + # if is_scrolled == None: + # is_scrolled = not is_modal #for dialog windows use non crolled panels + # by default + + attrsman = self.obj.get_attrsman() + attrconfigs_scalar = attrsman.get_configs( + structs=cm.STRUCTS_SCALAR, filtergroupnames=groupnames) if self.id != None: attrconfigs_scalar += attrsman.get_colconfigs() - #print ' just one scalar obj panel',buttonargs.keys() - #print ' groupnames', groupnames + # print ' just one scalar obj panel',buttonargs.keys() + # print ' groupnames', groupnames # create vertical main sizer - #print ' attrconfigs_scalar',attrconfigs_scalar - #print ' cm.STRUCTS_SCALAR',cm.STRUCTS_SCALAR - self.make_scalarpanel(self, attrconfigs_scalar, id = self.id,# groupnames=groupnames, - immediate_apply=immediate_apply, panelstyle=panelstyle, - is_modal = is_modal, show_title=show_title, - is_scrolled=is_scrolled,**buttonargs) - - - - - #self.restore() - return True - - - - - - - def add_scalarpage(self,attrconfigs=None, groupnames=None, - id=None, immediate_apply=False, panelstyle='default', - is_modal = False,show_title=False, - show_buttons=True,is_scrolled=True, **buttonargs): + # print ' attrconfigs_scalar',attrconfigs_scalar + # print ' cm.STRUCTS_SCALAR',cm.STRUCTS_SCALAR + self.make_scalarpanel(self, attrconfigs_scalar, id=self.id, # groupnames=groupnames, + immediate_apply=immediate_apply, panelstyle=panelstyle, + is_modal=is_modal, show_title=show_title, + is_scrolled=is_scrolled, **buttonargs) + + # self.restore() + return True + + def add_scalarpage(self, attrconfigs=None, groupnames=None, + id=None, immediate_apply=False, panelstyle='default', + is_modal=False, show_title=False, + show_buttons=True, is_scrolled=True, **buttonargs): """ Add a new page to the notebook. - """ - #print 'add_scalarpage',groupnames,attrconfigs - #print ' args',args - pan = wx.Panel(self.nb,-1) + """ + # print 'add_scalarpage',groupnames,attrconfigs + # print ' args',args + pan = wx.Panel(self.nb, -1) #pan = wx.Window(self, -1) - widget = self.make_scalarpanel(pan, attrconfigs,# groupnames=groupnames, - id=id, immediate_apply=immediate_apply, panelstyle=panelstyle, - is_modal = is_modal, show_title=show_title, - show_buttons=show_buttons,is_scrolled=is_scrolled,**buttonargs) - - # Add network tab with editor - p=self.nb.AddPage( pan, 'General') + widget = self.make_scalarpanel(pan, attrconfigs, # groupnames=groupnames, + id=id, immediate_apply=immediate_apply, panelstyle=panelstyle, + is_modal=is_modal, show_title=show_title, + show_buttons=show_buttons, is_scrolled=is_scrolled, **buttonargs) + + # Add network tab with editor + p = self.nb.AddPage(pan, 'General') self.pages[self.obj.get_ident()] = pan - #self.nb.SetSelection(p) - + # self.nb.SetSelection(p) + return pan - + def add_tablepage(self, table, groupnames=None): """ Add a new page to the notebook. - """ - #print 'context.add_view',ViewClass - #print ' args',args - widget= self.add_table(self.nb, table, objpanel = self, groupnames=groupnames, show_title=False) - self.tablewidgets.append(widget)# need that later for refresh - # Add network tab with editor - #print '\nadd_tablepage name',type(table.get_name()),table.get_name(),table - #try: + """ + # print 'context.add_view',ViewClass + # print ' args',args + widget = self.add_table( + self.nb, table, objpanel=self, groupnames=groupnames, show_title=False) + self.tablewidgets.append(widget) # need that later for refresh + # Add network tab with editor + # print '\nadd_tablepage name',type(table.get_name()),table.get_name(),table + # try: # print ' try:',table.name.attrname - #except: + # except: # print ' ok' - - p=self.nb.AddPage( widget, table.get_name()) + + p = self.nb.AddPage(widget, table.get_name()) self.pages[table.format_ident()] = widget - #self.nb.SetSelection(p) - + # self.nb.SetSelection(p) + return widget - - def make_scalartablepanel( self,parent, attrconfigs_scalar, table, objpanel =None, attrconfigs=None, groupnames=None, - id=None, immediate_apply=False, panelstyle='default', - is_modal = False,show_title=False, - show_buttons=True,is_scrolled=True, **buttonargs): - #print 'make_scalarpanellll',attrconfigs_scalar + + def make_scalartablepanel(self, parent, attrconfigs_scalar, table, objpanel=None, attrconfigs=None, groupnames=None, + id=None, immediate_apply=False, panelstyle='default', + is_modal=False, show_title=False, + show_buttons=True, is_scrolled=True, **buttonargs): + # print 'make_scalarpanellll',attrconfigs_scalar sizer = wx.BoxSizer(wx.VERTICAL) if show_title: self.add_title(sizer, id=id) - - - splitter = wx.SplitterWindow(parent, -1,style = wx.SP_LIVE_UPDATE|wx.SP_BORDER|wx.SP_3DBORDER, size = wx.DefaultSize) + + splitter = wx.SplitterWindow( + parent, -1, style=wx.SP_LIVE_UPDATE | wx.SP_BORDER | wx.SP_3DBORDER, size=wx.DefaultSize) splitter.SetMinimumPaneSize(10) - - scalarpanel = self.add_scalars(splitter,attrconfigs_scalar,# groupnames = groupnames, - id=id, immediate_apply=immediate_apply, - panelstyle=panelstyle, is_modal = False, is_scrolled=is_scrolled) - - - #if datawidget!= None: + + scalarpanel = self.add_scalars(splitter, attrconfigs_scalar, # groupnames = groupnames, + id=id, immediate_apply=immediate_apply, + panelstyle=panelstyle, is_modal=False, is_scrolled=is_scrolled) + + # if datawidget!= None: #sizer.Add(datawidget, 1, wx.EXPAND|wx.TOP|wx.LEFT,5) #sizer.Add(datawidget, 1,0) - #datawidget.Layout() - - - tablepanel = self.add_table(splitter, table, objpanel = objpanel, ids = self.ids, attrconfigs = attrconfigs, groupnames = groupnames) - #if datawidget!= None: + # datawidget.Layout() + + tablepanel = self.add_table(splitter, table, objpanel=objpanel, + ids=self.ids, attrconfigs=attrconfigs, groupnames=groupnames) + # if datawidget!= None: #sizer.Add(datawidget, 1, wx.EXPAND|wx.ALL, 5) #sizer.Add(datawidget, 0, wx.EXPAND) #sizer.Add(datawidget, 2,0,0) - #datawidget.Layout() - - + # datawidget.Layout() + splitter.SplitHorizontally(scalarpanel, tablepanel, -100) - splitter.SetSashPosition(100, True) - sizer.Add(splitter,1, wx.GROW,5) - + splitter.SetSashPosition(100, True) + sizer.Add(splitter, 1, wx.GROW, 5) + if show_buttons: - self.add_buttons(parent,sizer,is_modal=is_modal,**buttonargs) - #sizer.SetSizeHints(self) + self.add_buttons(parent, sizer, is_modal=is_modal, **buttonargs) + # sizer.SetSizeHints(self) parent.SetSizer(sizer) - sizer.Fit(parent) - - - def make_tablepanel( self,parent, tab,objpanel =None, attrconfigs=None, groupnames=None, - id=None, immediate_apply=False, panelstyle='default', - is_modal = False,show_title=False, - show_buttons=True,is_scrolled=True, **buttonargs): - #print 'make_tablepanel',groupnames + sizer.Fit(parent) + + def make_tablepanel(self, parent, tab, objpanel=None, attrconfigs=None, groupnames=None, + id=None, immediate_apply=False, panelstyle='default', + is_modal=False, show_title=False, + show_buttons=True, is_scrolled=True, **buttonargs): + # print 'make_tablepanel',groupnames sizer = wx.BoxSizer(wx.VERTICAL) if show_title: self.add_title(sizer, id=id) - - datawidget = self.add_table(parent, tab, ids = self.ids,objpanel =objpanel, attrconfigs = attrconfigs, groupnames = groupnames) - - if datawidget!= None: - sizer.Add(datawidget, 1, wx.EXPAND|wx.ALL, 5) - + + datawidget = self.add_table( + parent, tab, ids=self.ids, objpanel=objpanel, attrconfigs=attrconfigs, groupnames=groupnames) + + if datawidget != None: + sizer.Add(datawidget, 1, wx.EXPAND | wx.ALL, 5) + if show_buttons: - self.add_buttons(parent,sizer,is_modal=is_modal,**buttonargs) + self.add_buttons(parent, sizer, is_modal=is_modal, **buttonargs) parent.SetSizer(sizer) - sizer.Fit(parent) - - - - def make_scalarpanel( self,parent, attrconfigs=None, - id=None, immediate_apply=False, panelstyle='default', - is_modal = False,show_title=False, - show_buttons=True,is_scrolled=True, **buttonargs): - + sizer.Fit(parent) + + def make_scalarpanel(self, parent, attrconfigs=None, + id=None, immediate_apply=False, panelstyle='default', + is_modal=False, show_title=False, + show_buttons=True, is_scrolled=True, **buttonargs): + # TODO: Attention: parent is always self - #print 'make_scalarpanellll', attrconfigs + # print 'make_scalarpanellll', attrconfigs sizer = wx.BoxSizer(wx.VERTICAL) if show_title: self.add_title(sizer, id=id) - - datawidget = self.add_scalars(parent,attrconfigs, - id=id, immediate_apply=immediate_apply, - panelstyle=panelstyle, is_modal = is_modal, is_scrolled=is_scrolled) - - if datawidget!= None: - sizer.Add(datawidget, 1, wx.EXPAND|wx.ALL, 5) - + + datawidget = self.add_scalars(parent, attrconfigs, + id=id, immediate_apply=immediate_apply, + panelstyle=panelstyle, is_modal=is_modal, is_scrolled=is_scrolled) + + if datawidget != None: + sizer.Add(datawidget, 1, wx.EXPAND | wx.ALL, 5) + if show_buttons: - self.add_buttons(parent,sizer,is_modal=is_modal,**buttonargs) + self.add_buttons(parent, sizer, is_modal=is_modal, **buttonargs) parent.SetSizer(sizer) - sizer.Fit(parent) - - #self.SetAutoLayout(True) - #self.AutoLayout() - #self.Refresh() + sizer.Fit(parent) + + # self.SetAutoLayout(True) + # self.AutoLayout() + # self.Refresh() self.SetAutoLayout(1) - + self.Refresh() - self.Layout() - - def add_scalars(self,parent, attrconfigs, - id=None, immediate_apply=False, panelstyle='default', - is_modal = False, is_scrolled=True): + self.Layout() + + def add_scalars(self, parent, attrconfigs, + id=None, immediate_apply=False, panelstyle='default', + is_modal=False, is_scrolled=True): """ Add all scalar attributes to panel. """ - - #print 'add_scalars for attrconfigs',attrconfigs,is_scrolled - - - - if attrconfigs!=None: + # print 'add_scalars for attrconfigs',attrconfigs,is_scrolled + + if attrconfigs != None: if (not is_scrolled): - datawidget=ScalarPanel(parent,attrconfigs, id = id, - func_change_obj=self.func_change_obj, - immediate_apply=immediate_apply, - panelstyle=panelstyle, - mainframe=self.mainframe) + datawidget = ScalarPanel(parent, attrconfigs, id=id, + func_change_obj=self.func_change_obj, + immediate_apply=immediate_apply, + panelstyle=panelstyle, + mainframe=self.mainframe) else: - datawidget=ScalarPanelScrolled(parent,attrconfigs, id = id, - func_change_obj=self.func_change_obj, - immediate_apply=immediate_apply, - panelstyle=panelstyle, - is_modal = is_modal, - mainframe=self.mainframe) - self.datawidgets.append(datawidget) # used for apply and resore - + datawidget = ScalarPanelScrolled(parent, attrconfigs, id=id, + func_change_obj=self.func_change_obj, + immediate_apply=immediate_apply, + panelstyle=panelstyle, + is_modal=is_modal, + mainframe=self.mainframe) + self.datawidgets.append(datawidget) # used for apply and resore + return datawidget - - - - - - def add_tables(self, sizer, tables, groupnames,show_title=False ): - + + def add_tables(self, sizer, tables, groupnames, show_title=False): + for table in tables: self.add_hline(sizer) - self.add_table(sizer, table, groupnames=groupnames, show_title=show_title) - - - def add_table(self, parent, tab, ids = None,objpanel =None, attrconfigs = None, groupnames = None): + self.add_table(sizer, table, groupnames=groupnames, + show_title=show_title) + + def add_table(self, parent, tab, ids=None, objpanel=None, attrconfigs=None, groupnames=None): """ Add all array-type attributes to panel. """ # TODO: group selection # TODO: Attention: parent is always self - - if attrconfigs==None: + + if attrconfigs == None: # This could be done way earlier!!! - attrconfigs = tab.get_colconfigs( filtergroupnames = groupnames) - - - #print 'add_table=',tab.get_name(),len(tab.get_colconfigs()) - - # check if there are attributes - if (attrconfigs!=None)&(attrconfigs!=[]): + attrconfigs = tab.get_colconfigs(filtergroupnames=groupnames) + + # print 'add_table=',tab.get_name(),len(tab.get_colconfigs()) + + # check if there are attributes + if (attrconfigs != None) & (attrconfigs != []): #panel=wx.Panel(self.parent, -1,wx.DefaultPosition,wx.DefaultSize,wx.SUNKEN_BORDER|wx.WANTS_CHARS) - #panel.SetAutoLayout(True) - datawidget=TabPanel(parent,tab,attrconfigs=attrconfigs,ids=ids,objpanel =objpanel, - func_change_obj=self.func_change_obj, - func_choose_id=self.func_choose_id, - func_choose_attr=self.func_choose_attr, - func_apply = self.func_apply, - mainframe=self.mainframe) - #panel.Refresh() - #datawidget=ScalarPanel(self,attrs) - #self.datawidgets.append(datawidget) - - self.datawidgets.append(datawidget) # used for apply and resore + # panel.SetAutoLayout(True) + datawidget = TabPanel(parent, tab, attrconfigs=attrconfigs, ids=ids, objpanel=objpanel, + func_change_obj=self.func_change_obj, + func_choose_id=self.func_choose_id, + func_choose_attr=self.func_choose_attr, + func_apply=self.func_apply, + mainframe=self.mainframe) + # panel.Refresh() + # datawidget=ScalarPanel(self,attrs) + # self.datawidgets.append(datawidget) + + self.datawidgets.append(datawidget) # used for apply and resore return datawidget - - def add_buttons(self,parent, sizer, - is_modal=False, - standartbuttons=['apply','restore','cancel'], - buttons=[], - defaultbutton='apply', - ): + + def add_buttons(self, parent, sizer, + is_modal=False, + standartbuttons=['apply', 'restore', 'cancel'], + buttons=[], + defaultbutton='apply', + ): """ Add a button row to sizer - """ - - #print '\nadd_buttons is_modal',is_modal - #print ' standartbuttons',standartbuttons - #print ' buttons',buttons + """ + + # print '\nadd_buttons is_modal',is_modal + # print ' standartbuttons',standartbuttons + # print ' buttons',buttons if parent == None: parent = self - #print 'add_buttons' - #print ' buttons=',buttons - self.data_standartbuttons={ \ + # print 'add_buttons' + # print ' buttons=',buttons + self.data_standartbuttons = { 'apply': ('Apply', self.on_apply, 'Apply current values'), 'restore': ('Restore', self.on_restore, 'Restore previous values'), 'ok': ('OK', self.on_ok, 'Apply and close window'), - 'cancel':('Cancel', self.on_cancel, 'Cancel and close window') - } - + 'cancel': ('Cancel', self.on_cancel, 'Cancel and close window') + } + # compose button row on bottom of panel - allbuttons=[] - + allbuttons = [] + # add custom buttons - allbuttons+=buttons - #print '\n allbuttons',allbuttons - #print ' buttons',buttons,len(buttons),is_modal&(len(buttons)==0) - if is_modal&(len(buttons)==0): + allbuttons += buttons + # print '\n allbuttons',allbuttons + # print ' buttons',buttons,len(buttons),is_modal&(len(buttons)==0) + if is_modal & (len(buttons) == 0): # if in dialog mode use only OK and cancel by default - standartbuttons=[] - + standartbuttons = [] + # add standart buttons - #print ' standartbuttons=',standartbuttons + # print ' standartbuttons=',standartbuttons for key in standartbuttons: - #print ' append:',key + # print ' append:',key allbuttons.append(self.data_standartbuttons[key]) - - if (len(allbuttons)>0) | is_modal: + + if (len(allbuttons) > 0) | is_modal: self.add_hline(sizer) - + # Init the context help button. # And even include help text about the help button :-) - - if is_modal&(len(buttons)==0): - #standartbuttons=[] - #print 'add_buttons modal buttons',buttons + + if is_modal & (len(buttons) == 0): + # standartbuttons=[] + # print 'add_buttons modal buttons',buttons btnsizer = wx.StdDialogButtonSizer() - #standartbuttons=[] + # standartbuttons=[] #helpbutton = wx.ContextHelpButton(self.parent) #helpbutton.SetHelpText(' Click to put application\n into context sensitive help mode.') #btnsizer.AddButton(helpbutton ) - + else: - if defaultbutton=='': - defaultbutton='Apply' - #print 'add_buttons ',allbuttons + if defaultbutton == '': + defaultbutton = 'Apply' + # print 'add_buttons ',allbuttons btnsizer = wx.BoxSizer(wx.HORIZONTAL) - + # add help button - - #print ' allbuttons',allbuttons - #create button widgets + + # print ' allbuttons',allbuttons + # create button widgets for (name, function, info) in allbuttons: - - b = wx.Button(parent, -1, name, (2,2)) - self.Bind(wx.EVT_BUTTON, function, b) + + b = wx.Button(parent, -1, name, (2, 2)) + self.Bind(wx.EVT_BUTTON, function, b) b.SetHelpText(info) - if defaultbutton==name: + if defaultbutton == name: b.SetDefault() - if is_modal&(len(buttons)==0): - #print ' create button modal',name,is_modal + if is_modal & (len(buttons) == 0): + # print ' create button modal',name,is_modal btnsizer.AddButton(b) else: - #print ' create button',name,is_modal + # print ' create button',name,is_modal btnsizer.Add(b) - - if is_modal&(len(buttons)==0): - #print ' Add OK and CANCEL' + + if is_modal & (len(buttons) == 0): + # print ' Add OK and CANCEL' # add OK and CANCEL if panel appears in separate window b = wx.Button(parent, wx.ID_OK) b.SetHelpText('Apply values and close window') - #self.Bind(wx.EVT_BUTTON, self.on_ok_modal, b) - if defaultbutton=='': + #self.Bind(wx.EVT_BUTTON, self.on_ok_modal, b) + if defaultbutton == '': # set apply button default if there is no other default b.SetDefault() btnsizer.AddButton(b) - #print 'Add OK',b - + # print 'Add OK',b + # add cancel b = wx.Button(parent, wx.ID_CANCEL) b.SetHelpText('Ignore modifications and close window') btnsizer.AddButton(b) - #print 'Add cancel',b - + # print 'Add cancel',b + btnsizer.Realize() - #else: + # else: # btnsizer.Realize() - #if wx.Platform != "__WXMSW__": + # if wx.Platform != "__WXMSW__": # btn = wx.ContextHelpButton(self) # btnsizer.AddButton(btn) - - #btnsizer.Realize() - + + # btnsizer.Realize() + #b = csel.ColourSelect(self.parent, -1, 'test', (255,0,0), size = wx.DefaultSize) - #sizer.Add(b) + # sizer.Add(b) # add buttomrow to main #sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) #widget=wx.StaticText(self.parent, -1,'That is it!!') - #sizer.Add(widget) - - ### TEST + # sizer.Add(widget) + + # TEST #btnsizer = wx.StdDialogButtonSizer() - - #if wx.Platform != "__WXMSW__": + + # if wx.Platform != "__WXMSW__": # btn = wx.ContextHelpButton(self) # btnsizer.AddButton(btn) - + ## btn = wx.Button(self, wx.ID_OK) ## btn.SetHelpText("The OK button completes the dialog") -## btn.SetDefault() -## btnsizer.AddButton(btn) -## +# btn.SetDefault() +# btnsizer.AddButton(btn) +## ## btn = wx.Button(self, wx.ID_CANCEL) ## btn.SetHelpText("The Cancel button cnacels the dialog. (Cool, huh?)") -## btnsizer.AddButton(btn) -## btnsizer.Realize() +# btnsizer.AddButton(btn) +# btnsizer.Realize() ### - - sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) - - def add_hline(self,sizer,hspace=5): + + sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) + + def add_hline(self, sizer, hspace=5): """ Add a horizontal line to sizer """ - line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL) - sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.CENTER, hspace) - - def add_title(self,sizer,title=None,id=None, fontsize = 12): + line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL) + sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | + wx.RIGHT | wx.CENTER, hspace) + + def add_title(self, sizer, title=None, id=None, fontsize=12): """ Add a title to the option panel. If no title is given, the titel will be derived from the object name and id if given. """ - #print 'add_title',self.obj.get_name() - if title==None: + # print 'add_title',self.obj.get_name() + if title == None: fontsize = 14 - if id==None: - title=self.obj.get_name().title() + if id == None: + title = self.obj.get_name().title() else: - title=self.obj.get_name().title()+' ['+str(id)+']' - + title = self.obj.get_name().title() + ' [' + str(id) + ']' + #p=wx.Panel( self, wx.NewId(), wx.DefaultPosition,style=wx.SUNKEN_BORDER) - titlewidget = wx.StaticText(self, wx.NewId(),title) + titlewidget = wx.StaticText(self, wx.NewId(), title) font = wx.Font(fontsize, wx.SWISS, wx.NORMAL, wx.NORMAL) titlewidget.SetFont(font) - #sizer.Add((5,5)) - #sizer.Add((5,5)) - #self.add_hline(sizer) - #sizer.Add((20,20)) - sizer.Add(titlewidget,0, wx.ALIGN_CENTER|wx.ALIGN_CENTER_VERTICAL, 10) - #sizer.Add((10,10)) - self.add_hline(sizer,15) - - def add_group(self,sizer,groupname): + # sizer.Add((5,5)) + # sizer.Add((5,5)) + # self.add_hline(sizer) + # sizer.Add((20,20)) + sizer.Add(titlewidget, 0, wx.ALIGN_CENTER | + wx.ALIGN_CENTER_VERTICAL, 10) + # sizer.Add((10,10)) + self.add_hline(sizer, 15) + + def add_group(self, sizer, groupname): """ Add a group to the option panel. - + This method does diaplay the entire group in a group widget. """ pass - - def on_apply(self,event): + + def on_apply(self, event): """ Apply widget contents to object """ self.apply() - - - def on_restore(self,event): + + def on_restore(self, event): """ Copy object values to widget contents """ self.restore() - - #def on_ok_modal(self,event): + + # def on_ok_modal(self,event): # """ NO! valueas are rtead out from calling function # Apply values, and continues withy modal windoe event handling # """ # self.apply() # event.Skip() - - - - - def on_ok(self,event): + + def on_ok(self, event): """ Apply values, destroy itself and parent """ - #print 'on_ok...' - + # print 'on_ok...' + # check if we must execute some callbacks if ids or attributes # have been selected - #for widget in self.datawidgets: + # for widget in self.datawidgets: # if hasattr(widget,'on_ok') - #else: + # else: self.apply() - + self.Close() - #self.parent.Destroy() - #self.Destroy() - - def on_cancel(self,event): + # self.parent.Destroy() + # self.Destroy() + + def on_cancel(self, event): """ Apply values, destroy itself and parent """ self.Close() - - + def apply(self): """ Widget values are copied to object """ - #print 'apply',self.obj.ident,self.datawidgets,self.func_apply + # print 'apply',self.obj.ident,self.datawidgets,self.func_apply for widget in self.datawidgets: - #print ' widget',widget + # print ' widget',widget widget.apply() widget.restore() - - if self.func_apply!=None: - #print ' call self.func_choose_id',self.obj, self.id, self.ids - # + + if self.func_apply != None: + # print ' call self.func_choose_id',self.obj, self.id, self.ids + # #wx.FutureCall(1,self.func_apply, self.obj, self.id, self.ids) wx.CallAfter(self.func_apply, self.obj, self.id, self.ids) - #event.Skip() + # event.Skip() return - - - + def restore(self): """ Object values are copied into widgets. """ for widget in self.datawidgets: widget.restore() - - - - #def OnSetFocus(self, evt): + + # def OnSetFocus(self, evt): # print "OnSetFocus" # evt.Skip() - #def OnKillFocus(self, evt): + # def OnKillFocus(self, evt): # print "OnKillFocus" # evt.Skip() - #def OnWindowDestroy(self, evt): + # def OnWindowDestroy(self, evt): # print "OnWindowDestroy" # evt.Skip() - - -class ObjPanelDialog(ObjPanelMixin,wx.Dialog): - def __init__(self, parent, - obj, id=None, ids=None, - attrconfigs=None, - #tables = None, - table = None, - groupnames = None, show_groupnames = False, - title = '', size = wx.DefaultSize, pos = wx.DefaultPosition,\ - style = wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.RESIZE_BORDER, - choose_id=False,choose_attr=False, - func_choose_id = None, func_change_obj = None, func_apply = None, - panelstyle = 'default', - immediate_apply = False, - **buttonargs): - - #print 'ObjPanelDialog.__init__',choose_id,choose_attr,table - - #print ' buttonargs,groupnames',buttonargs,groupnames - #print ' size=',size +class ObjPanelDialog(ObjPanelMixin, wx.Dialog): + + def __init__(self, parent, + obj, id=None, ids=None, + attrconfigs=None, + #tables = None, + table=None, + groupnames=None, show_groupnames=False, + title='', size=wx.DefaultSize, pos=wx.DefaultPosition,\ + style=wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.RESIZE_BORDER, + choose_id=False, choose_attr=False, + func_choose_id=None, func_change_obj=None, func_apply=None, + panelstyle='default', + immediate_apply=False, + **buttonargs): + + # print 'ObjPanelDialog.__init__',choose_id,choose_attr,table + + # print ' buttonargs,groupnames',buttonargs,groupnames + # print ' size=',size # Instead of calling wx.Dialog.__init__ we precreate the dialog # so we can set an extra style that must be set before # creation, and then we create the GUI dialog using the Create # method. pre = wx.PreDialog() pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP) - - if title=='': - title='Dialog for: '+obj.get_name() - pre.Create(parent, -1,title , pos, size=size, style=style) + + if title == '': + title = 'Dialog for: ' + obj.get_name() + pre.Create(parent, -1, title, pos, size=size, style=style) # This next step is the most important, it turns this Python # object into the real wrapper of the dialog (instead of pre) # as far as the wxPython extension is concerned. self.PostCreate(pre) self.init_panel(parent) - - + if choose_id: self.recreate_panel(obj, - id=id, ids=ids, - attrconfigs = attrconfigs, - #tables = tables, - #table =table, - groupnames = groupnames, show_groupnames = show_groupnames, - show_title = False, is_modal = True, - immediate_apply = immediate_apply, - panelstyle= panelstyle, - func_choose_id=self.on_choose_id,func_apply = func_apply, - func_change_obj=func_change_obj, - **buttonargs - ) - - - + id=id, ids=ids, + attrconfigs=attrconfigs, + #tables = tables, + #table =table, + groupnames=groupnames, show_groupnames=show_groupnames, + show_title=False, is_modal=True, + immediate_apply=immediate_apply, + panelstyle=panelstyle, + func_choose_id=self.on_choose_id, func_apply=func_apply, + func_change_obj=func_change_obj, + **buttonargs + ) + elif choose_attr: - self.recreate_panel(obj,id=id, ids=ids, - attrconfigs = attrconfigs, - #tables = tables, - #table =table, - groupnames = groupnames, show_groupnames = show_groupnames, - show_title = False, is_modal = True, - immediate_apply = immediate_apply, - panelstyle= panelstyle, - func_choose_attr=self.on_choose_attr,func_apply = func_apply, - func_change_obj=func_change_obj, - **buttonargs - ) - + self.recreate_panel(obj, id=id, ids=ids, + attrconfigs=attrconfigs, + #tables = tables, + #table =table, + groupnames=groupnames, show_groupnames=show_groupnames, + show_title=False, is_modal=True, + immediate_apply=immediate_apply, + panelstyle=panelstyle, + func_choose_attr=self.on_choose_attr, func_apply=func_apply, + func_change_obj=func_change_obj, + **buttonargs + ) + else: - #print ' normal mode without special callbacks',self.recreate_panel - self.recreate_panel(obj,id=id, ids=ids, - attrconfigs = attrconfigs, - #tables = tables, - #table =table, - groupnames = groupnames, show_groupnames = show_groupnames, - show_title = False, is_modal = True, - immediate_apply = immediate_apply, - panelstyle= panelstyle, - func_choose_id=func_choose_id, - func_change_obj=func_change_obj,func_apply = func_apply, - **buttonargs - ) - - - self.id_chosen=-1 - self.attrconf_chosen= None - - - - #self.recreate_panel(attrconfigs=attrconfigs,groups=groups,is_modal=True, - # immediate_apply=immediate_apply, panelstyle=panelstyle) - - #self.SetSize(self.GetSize()) - #self.SetSize(wx.DefaultSize) - #self.SetSize(size) + # print ' normal mode without special + # callbacks',self.recreate_panel + self.recreate_panel(obj, id=id, ids=ids, + attrconfigs=attrconfigs, + #tables = tables, + #table =table, + groupnames=groupnames, show_groupnames=show_groupnames, + show_title=False, is_modal=True, + immediate_apply=immediate_apply, + panelstyle=panelstyle, + func_choose_id=func_choose_id, + func_change_obj=func_change_obj, func_apply=func_apply, + **buttonargs + ) + + self.id_chosen = -1 + self.attrconf_chosen = None + + # self.recreate_panel(attrconfigs=attrconfigs,groups=groups,is_modal=True, + # immediate_apply=immediate_apply, panelstyle=panelstyle) + + # self.SetSize(self.GetSize()) + # self.SetSize(wx.DefaultSize) + # self.SetSize(size) self.SetAutoLayout(1) self.Refresh() - - def on_choose_id(self,id,attrconf = None): - self.id_chosen=id - self.attrconf_chosen=attrconf + + def on_choose_id(self, id, attrconf=None): + self.id_chosen = id + self.attrconf_chosen = attrconf self.EndModal(wx.ID_OK) - - + def get_current_attrconf_id(self): """ Returns selected or current attribute and id - """ - #print 'get_current_attrconf_id',self.attrconf_chosen,self.id_chosen - if (self.id_chosen==-1)&(self.attrconf_chosen==''): + """ + # print 'get_current_attrconf_id',self.attrconf_chosen,self.id_chosen + if (self.id_chosen == -1) & (self.attrconf_chosen == ''): # on_choose_id has not yet determined id - # do though datawidgets and + # do though datawidgets and for widget in self.datawidgets: - #print ' widget',widget - if hasattr(widget,'get_current_attrconf_id'): + # print ' widget',widget + if hasattr(widget, 'get_current_attrconf_id'): return widget.get_current_attrconf_id() - - return self.attrconf_chosen,self.id_chosen - + + return self.attrconf_chosen, self.id_chosen + else: return self.attrconf_chosen, self.id_chosen - - #def get_valueconf_chosen(self): + + # def get_valueconf_chosen(self): # return self.attrconf_chosen - -#class ObjPanel(ObjPanelMixin,wxlib.scrolledpanel.ScrolledPanel): -class ObjPanel(ObjPanelMixin,wx.Panel): + +# class ObjPanel(ObjPanelMixin,wxlib.scrolledpanel.ScrolledPanel): + + +class ObjPanel(ObjPanelMixin, wx.Panel): + """ Interactively displays attributes of object on a panel. - """ - def __init__(self, parent, obj = None, - id=None, ids=None, - attrconfigs=None, - #tables = None, - #table = None, - groupnames = None, - func_change_obj=None, func_apply = None, - show_groupnames=False, show_title=True, is_modal=False, - mainframe=None, - pos=wx.DefaultPosition, size=wx.DefaultSize, style = wx.MAXIMIZE_BOX|wx.RESIZE_BORDER, - immediate_apply=False, panelstyle='default', **buttonargs): - - wx.Panel.__init__(self,parent,-1,pos,size,wx.SUNKEN_BORDER|wx.WANTS_CHARS) - if obj==None: - obj=cm.BaseObjman('empty') + """ + + def __init__(self, parent, obj=None, + id=None, ids=None, + attrconfigs=None, + #tables = None, + #table = None, + groupnames=None, + func_change_obj=None, func_apply=None, + show_groupnames=False, show_title=True, is_modal=False, + mainframe=None, + pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.MAXIMIZE_BOX | wx.RESIZE_BORDER, + immediate_apply=False, panelstyle='default', **buttonargs): + + wx.Panel.__init__(self, parent, -1, pos, size, + wx.SUNKEN_BORDER | wx.WANTS_CHARS) + if obj == None: + obj = cm.BaseObjman('empty') #wxlib.scrolledpanel.ScrolledPanel.__init__(self, parent,wx.ID_ANY,size=size) #self.maxWidth = 100 #self.maxHeight = 100 - #self.SetVirtualSize((300,-1)) - #self.SetScrollRate(20,20) - + # self.SetVirtualSize((300,-1)) + # self.SetScrollRate(20,20) + self.init_panel(parent, mainframe=mainframe) # (re)create panel widgets - #print 'ObjPanel.__init__',obj.ident,id,func_apply,groupnames + # print 'ObjPanel.__init__',obj.ident,id,func_apply,groupnames self.recreate_panel(obj, id=id, ids=ids, - attrconfigs = attrconfigs, - groupnames = groupnames, show_groupnames = show_groupnames, - show_title = show_title, is_modal = is_modal, - immediate_apply = immediate_apply, - panelstyle= panelstyle, + attrconfigs=attrconfigs, + groupnames=groupnames, show_groupnames=show_groupnames, + show_title=show_title, is_modal=is_modal, + immediate_apply=immediate_apply, + panelstyle=panelstyle, func_change_obj=func_change_obj, - func_apply = func_apply, + func_apply=func_apply, **buttonargs) - - #optionpanel.GetSize() - - #self.SetAutoLayout(1) - + + # optionpanel.GetSize() + + # self.SetAutoLayout(1) + + class TablePanel(ObjPanelMixin, wx.Panel): + """ Common methods for panels - """ - def __init__(self, parent, table, - attrconfigs=None, - id=None, ids=None, - groupnames = None, - func_change_obj=None, func_apply = None, - show_groupnames=False, show_title=True, is_modal=False, - mainframe=None, pos=wx.DefaultPosition, size=wx.DefaultSize, - immediate_apply=False, panelstyle='default', **buttonargs): - - wx.Panel.__init__(self,parent,-1,pos,size,wx.SUNKEN_BORDER) - - + """ + + def __init__(self, parent, table, + attrconfigs=None, + id=None, ids=None, + groupnames=None, + func_change_obj=None, func_apply=None, + show_groupnames=False, show_title=True, is_modal=False, + mainframe=None, pos=wx.DefaultPosition, size=wx.DefaultSize, + immediate_apply=False, panelstyle='default', **buttonargs): + + wx.Panel.__init__(self, parent, -1, pos, size, wx.SUNKEN_BORDER) + self.init_panel(parent, mainframe=mainframe) # (re)create panel widgets - #print 'TablePanel. __init__',table.get_name() + # print 'TablePanel. __init__',table.get_name() self.recreate_panel(table, - attrconfigs = attrconfigs, - #ids=ids, - groupnames = groupnames, show_groupnames = show_groupnames, - show_title = show_title, is_modal = is_modal, - immediate_apply = immediate_apply, func_apply = func_apply, - panelstyle= panelstyle, + attrconfigs=attrconfigs, + # ids=ids, + groupnames=groupnames, show_groupnames=show_groupnames, + show_title=show_title, is_modal=is_modal, + immediate_apply=immediate_apply, func_apply=func_apply, + panelstyle=panelstyle, func_change_obj=func_change_obj, **buttonargs) - - #optionpanel.GetSize() - + + # optionpanel.GetSize() + self.SetAutoLayout(1) - def recreate_panel( self, obj, # obj is table - attrconfigs=None, - #ids=None, - groupnames = None, show_groupnames=False, - show_title=True, - is_modal=False, - immediate_apply=False, - panelstyle='default', - func_change_obj = None, - func_choose_id = None, - func_choose_attr = None, - func_apply = None, - **buttonargs): - - + def recreate_panel(self, obj, # obj is table + attrconfigs=None, + # ids=None, + groupnames=None, show_groupnames=False, + show_title=True, + is_modal=False, + immediate_apply=False, + panelstyle='default', + func_change_obj=None, + func_choose_id=None, + func_choose_attr=None, + func_apply=None, + **buttonargs): """ Recreates panel and destroys previous contents: attr = a list ith attribute names to be shown @@ -3794,443 +3719,439 @@ self.func_choose_id = func_choose_id self.func_choose_attr = func_choose_attr self.func_apply = func_apply - - #print '\n\nrecreate_panel name for id,ids=',obj.get_name(),ids - #print ' attrs,groups=',attrs,groups - #print ' immediate_apply',immediate_apply + + # print '\n\nrecreate_panel name for id,ids=',obj.get_name(),ids + # print ' attrs,groups=',attrs,groups + # print ' immediate_apply',immediate_apply # this will be looked up by widgets to decide how to react to an input #self.immediate_apply = immediate_apply - + # remove previous contents - #ids_widgetcontainers=self.get_ids() - #self.parent.DestroyChildren() + # ids_widgetcontainers=self.get_ids() + # self.parent.DestroyChildren() #del self[ids_widgetcontainers] - + # create vertical main sizer sizer = wx.BoxSizer(wx.VERTICAL) if show_title: self.add_title(sizer) - - - # show table with one or several ids - self.add_table(sizer, obj, attrconfigs = attrconfigs, - ids = ids, groupnames = groupnames,show_title=False) + # show table with one or several ids + self.add_table(sizer, obj, attrconfigs=attrconfigs, + ids=ids, groupnames=groupnames, show_title=False) - - self.SetSizer(sizer) sizer.Fit(self) - + # some widgets like color need this to expand into their maximum space - self.restore() - - + self.restore() + class NaviPanelMixin: - def add_hist(self,obj,id=None,ids = None,kwargs={}): + + def add_hist(self, obj, id=None, ids=None, kwargs={}): """ Add a new obj to history list. The forward history will be eliminated. """ - #print 'add_hist',self.hist,self.ind_hist - + # print 'add_hist',self.hist,self.ind_hist + n_hist = len(self.hist) if n_hist == 0: - # first entry - self.ind_hist=0 - - else: - self.hist=self.hist[:self.ind_hist+1] - #print ' hist[:self.ind_hist+1]',self.hist[:self.ind_hist+1] - - self.hist.append((obj,id,ids,kwargs)) - self.ind_hist=len(self.hist)-1 - #print ' hist,self.ind_hist',self.hist,self.ind_hist - - def get_hist(self,ind_delta=-1): + # first entry + self.ind_hist = 0 + + else: + self.hist = self.hist[:self.ind_hist + 1] + # print ' hist[:self.ind_hist+1]',self.hist[:self.ind_hist+1] + + self.hist.append((obj, id, ids, kwargs)) + self.ind_hist = len(self.hist) - 1 + # print ' hist,self.ind_hist',self.hist,self.ind_hist + + def get_hist(self, ind_delta=-1): """ Getting hist with changing pointer """ - ind = self.ind_hist + ind_delta - #print 'get_hist ind_hist,ind_delta,ind,len(self.hist),ok',self.ind_hist,ind_delta,ind,len(self.hist),(ind < len(self.hist)) & (ind >= 0) - + ind = self.ind_hist + ind_delta + # print 'get_hist + # ind_hist,ind_delta,ind,len(self.hist),ok',self.ind_hist,ind_delta,ind,len(self.hist),(ind + # < len(self.hist)) & (ind >= 0) + if (ind < len(self.hist)) & (ind >= 0): - self.ind_hist=ind - #print ' OK self.ind_hist',self.ind_hist,self.hist[ind] + self.ind_hist = ind + # print ' OK self.ind_hist',self.ind_hist,self.hist[ind] return self.hist[ind] else: - #print ' Fail self.ind_hist',self.ind_hist - return None,None,None,None - - def get_history(self,ind_delta=-1): + # print ' Fail self.ind_hist',self.ind_hist + return None, None, None, None + + def get_history(self, ind_delta=-1): """ Getting hist without changing pointer """ - ind = self.ind_hist + ind_delta - #print 'get_history',self.ind_hist,ind_delta,(ind < len(self.hist)) & (ind >= 0) - + ind = self.ind_hist + ind_delta + # print 'get_history',self.ind_hist,ind_delta,(ind < len(self.hist)) & + # (ind >= 0) + if (ind < len(self.hist)) & (ind >= 0): - #self.ind_hist=ind + # self.ind_hist=ind return self.hist[ind] else: - return None,None,None,None - - def on_change_obj(self,event): - #print 'Navicanvas.on_change_obj' - obj=event.GetObj() + return None, None, None, None + + def on_change_obj(self, event): + # print 'Navicanvas.on_change_obj' + obj = event.GetObj() self.refresh_panel(obj) event.Skip() - - def change_obj(self,obj,id=None, ids=None,**kwargs): - - - if len(kwargs)==0: + + def change_obj(self, obj, id=None, ids=None, **kwargs): + + if len(kwargs) == 0: # this is to recover kw arguments i.e. callbacks - obj_last,id_last,ids_last,kwargs_last=self.get_history(0) - if kwargs_last!= None: - kwargs=kwargs_last - + obj_last, id_last, ids_last, kwargs_last = self.get_history(0) + if kwargs_last != None: + kwargs = kwargs_last + if self.func_apply != None: kwargs['func_apply'] = self.func_apply - - #print 'Navipanel.change_obj',obj.format_ident(),id,ids,kwargs.keys() - - if hasattr(obj,'get_ident'): - self.refresh_panel(obj,id = id, ids = ids, **kwargs) - self.add_hist(obj,id,ids,kwargs) - + + # print 'Navipanel.change_obj',obj.format_ident(),id,ids,kwargs.keys() + + if hasattr(obj, 'get_ident'): + self.refresh_panel(obj, id=id, ids=ids, **kwargs) + self.add_hist(obj, id, ids, kwargs) + def get_obj(self): """ Returns currently displayed object - """ + """ return self.objpanel.obj - - def refresh_panel(self,obj=None,id=None,ids=None,**kwargs): + + def refresh_panel(self, obj=None, id=None, ids=None, **kwargs): """ Deletes previous conents Builds panel for obj Updates path window and history """ - - if obj==None: - if self.get_obj()==self._defaultobj: - return None # no changes + + if obj == None: + if self.get_obj() == self._defaultobj: + return None # no changes else: - obj=self._defaultobj - - #print 'Navicanvas.refresh_panel with',obj.ident,kwargs - - - if id != None: + obj = self._defaultobj + + # print 'Navicanvas.refresh_panel with',obj.ident,kwargs + + if id != None: self.path.SetValue(obj.format_ident_row_abs(id)) - - elif ids != None: + + elif ids != None: # no id provided, just show identification string self.path.SetValue(obj.format_ident_abs()) - - else:# object and id provided: compose string with id + + else: # object and id provided: compose string with id self.path.SetValue(obj.format_ident_abs()) - - #self.path.SetSize((len(self.path.GetValue())*10,-1)) - #self.path.SetSize((-1,-1)) + + # self.path.SetSize((len(self.path.GetValue())*10,-1)) + # self.path.SetSize((-1,-1)) # remove previous obj panel - sizer=self.GetSizer() + sizer = self.GetSizer() sizer.Remove(1) self.objpanel.Destroy() #del self.objpanel - + # build new obj panel - #self.objpanel=ObjPanel(self,obj,id=id,attrs=self.attrs,groups=self.groups, + # self.objpanel=ObjPanel(self,obj,id=id,attrs=self.attrs,groups=self.groups, # func_change_obj=self.change_obj, # is_modal=self.is_modal, # mainframe=self.mainframe, # immediate_apply=self.immediate_apply, - # **self.buttonargs) - attrconfigs=obj.get_attrsman().get_configs() - #for attrconfig in obj.get_configs()#attrconfigs: + # **self.buttonargs) + attrconfigs = obj.get_attrsman().get_configs() + # for attrconfig in obj.get_configs()#attrconfigs: # if '_private' not in attrconfig.groups: # attrconfigs.append(attrconfig) - - args ={ 'attrconfigs':attrconfigs, - #'tables' : None, - #'table' : None, - 'id':id, 'ids':ids, - 'groupnames' : self.groupnames, - 'func_change_obj':self.change_obj, - 'show_groupnames':False, 'show_title':True, 'is_modal':self.is_modal, - 'mainframe':self.mainframe, 'pos':wx.DefaultPosition, 'size':wx.DefaultSize, - 'immediate_apply':self.immediate_apply, 'panelstyle':'default' - } - - args.update(self.buttonargs) - args.update(kwargs) - - #print ' make ObjPanel\n args =',args - - self.objpanel=ObjPanel(self, obj = obj, **args) - #if id!=None: + + args = {'attrconfigs': attrconfigs, + #'tables' : None, + #'table' : None, + 'id': id, 'ids': ids, + 'groupnames': self.groupnames, + 'func_change_obj': self.change_obj, + 'show_groupnames': False, 'show_title': True, 'is_modal': self.is_modal, + 'mainframe': self.mainframe, 'pos': wx.DefaultPosition, 'size': wx.DefaultSize, + 'immediate_apply': self.immediate_apply, 'panelstyle': 'default' + } + + args.update(self.buttonargs) + args.update(kwargs) + + # print ' make ObjPanel\n args =',args + + self.objpanel = ObjPanel(self, obj=obj, **args) + # if id!=None: # self.objpanel=ObjPanel(self,obj,id=id,func_change_obj=self.change_obj) - #else: + # else: # self.objpanel=ObjPanel(self,obj,func_change_obj=self.change_obj) - sizer.Add(self.objpanel,1,wx.GROW) - + sizer.Add(self.objpanel, 1, wx.GROW) + self.Refresh() - #sizer.Fit(self) + # sizer.Fit(self) sizer.Layout() # add to history return None - - def on_change_path(self,event): + def on_change_path(self, event): """ Key stroke on path field. Change object when return is pressed. """ keycode = event.GetKeyCode() - if keycode==wx.WXK_RETURN: - #print 'change path to',self.path.GetValue() - #self.refresh_panel(obj) + if keycode == wx.WXK_RETURN: + # print 'change path to',self.path.GetValue() + # self.refresh_panel(obj) pass else: - event.Skip() - - - - #def recreate_panel(self,obj): + event.Skip() + + # def recreate_panel(self,obj): # """ - # Removes previous contents and displays attributes on panel. + # Removes previous contents and displays attributes on panel. # """ # pass - - def on_go_back(self,event): - #print 'on_go_back' - #print ' hist=',self.hist - obj,id,ids,kwargs=self.get_hist(-1) - #if obj!=None: + + def on_go_back(self, event): + # print 'on_go_back' + # print ' hist=',self.hist + obj, id, ids, kwargs = self.get_hist(-1) + # if obj!=None: # print ' done: obj, hist, ind_hist',obj.ident,self.hist,self.ind_hist - #else: + # else: # print ' failed: hist, ind_hist',self.hist,self.ind_hist - - if obj!=None: - #print ' refresh_panel with',obj.ident - self.refresh_panel(obj,id,ids,**kwargs) + + if obj != None: + # print ' refresh_panel with',obj.ident + self.refresh_panel(obj, id, ids, **kwargs) event.Skip() - - def on_go_forward(self,event): - obj,id,ids,kwargs=self.get_hist(+1) - #print 'on_go_forward to obj',obj - - #if obj!=None: + + def on_go_forward(self, event): + obj, id, ids, kwargs = self.get_hist(+1) + # print 'on_go_forward to obj',obj + + # if obj!=None: # print ' Done:obj.ident,self.hist,self.ind_hist',obj.ident,self.hist,self.ind_hist - #else: + # else: # print ' Failed:self.hist,self.ind_hist',self.hist,self.ind_hist - - if obj!=None: - #print ' refresh_panel with',obj.ident - self.refresh_panel(obj,id,ids,**kwargs) + + if obj != None: + # print ' refresh_panel with',obj.ident + self.refresh_panel(obj, id, ids, **kwargs) event.Skip() - - def on_go_up(self,event): - + + def on_go_up(self, event): + obj = self.objpanel.get_obj() _id = self.objpanel.get_id() - + # this is to recover kw arguments i.e. callbacks - obj_last,id_last,ids_last,kwargs_last=self.get_history(0) - if kwargs_last!= None: - kwargs=kwargs_last + obj_last, id_last, ids_last, kwargs_last = self.get_history(0) + if kwargs_last != None: + kwargs = kwargs_last else: - kwargs={} - + kwargs = {} + parent = obj.get_parent() - #print 'on_go_up',obj,id,parent + # print 'on_go_up',obj,id,parent if _id == None: # show parent object - if type(parent)==types.InstanceType: - if hasattr(parent,'ident'): - self.refresh_panel(parent,None,None,**kwargs) - self.add_hist(parent,None,None,kwargs) + if type(parent) == types.InstanceType: + if hasattr(parent, 'ident'): + self.refresh_panel(parent, None, None, **kwargs) + self.add_hist(parent, None, None, kwargs) else: # show table object if table row id has been previously - self.refresh_panel(obj,None,None,**kwargs) - self.add_hist(obj,None,None,kwargs) - - event.Skip() - - - def on_go_home(self,event): + self.refresh_panel(obj, None, None, **kwargs) + self.add_hist(obj, None, None, kwargs) + + event.Skip() + + def on_go_home(self, event): obj = self.objpanel.get_obj() root = obj.get_root() - if type(root)==types.InstanceType: - if hasattr(root,'ident'): + if type(root) == types.InstanceType: + if hasattr(root, 'ident'): self.refresh_panel(root) - event.Skip() - #print 'on_go_home' - + event.Skip() + # print 'on_go_home' + def on_enter_window(self, evt): - #print 'on_enter_window' + # print 'on_enter_window' self.SetFocus() - - def init_navbar(self,obj, _id=None): + + def init_navbar(self, obj, _id=None): """ Initialize toolbar which consist of navigation buttons """ - bottonsize = (32,32) + bottonsize = (32, 32) bottonborder = 10 toolbarborder = 1 - + # toolbar self.toolbar = wx.BoxSizer(wx.HORIZONTAL) - - #self.init_toolbar() + + # self.init_toolbar() #bottons = [] - bitmap = wx.ArtProvider_GetBitmap(wx.ART_GO_BACK,wx.ART_TOOLBAR) + bitmap = wx.ArtProvider_GetBitmap(wx.ART_GO_BACK, wx.ART_TOOLBAR) b = wx.BitmapButton(self, -1, bitmap, bottonsize, - (bitmap.GetWidth()+bottonborder, bitmap.GetHeight()+bottonborder)) + (bitmap.GetWidth() + bottonborder, bitmap.GetHeight() + bottonborder)) b.SetToolTipString("Go back in browser history.") self.Bind(wx.EVT_BUTTON, self.on_go_back, b) self.toolbar.Add(b, flag=wx.ALL, border=toolbarborder) - #bottons.append(b) + # bottons.append(b) #self.toolbar.Add(b, flag=wx.ALL, border=toolbarborder) - - bitmap = wx.ArtProvider_GetBitmap(wx.ART_GO_FORWARD,wx.ART_TOOLBAR) + + bitmap = wx.ArtProvider_GetBitmap(wx.ART_GO_FORWARD, wx.ART_TOOLBAR) b = wx.BitmapButton(self, -1, bitmap, bottonsize, - (bitmap.GetWidth()+bottonborder, bitmap.GetHeight()+bottonborder)) + (bitmap.GetWidth() + bottonborder, bitmap.GetHeight() + bottonborder)) b.SetToolTipString("Go forward in browser history.") self.Bind(wx.EVT_BUTTON, self.on_go_forward, b) - self.toolbar.Add(b,0, wx.EXPAND, border=toolbarborder) - #bottons.append(b) - - bitmap = wx.ArtProvider_GetBitmap(wx.ART_GO_UP,wx.ART_TOOLBAR) + self.toolbar.Add(b, 0, wx.EXPAND, border=toolbarborder) + # bottons.append(b) + + bitmap = wx.ArtProvider_GetBitmap(wx.ART_GO_UP, wx.ART_TOOLBAR) b = wx.BitmapButton(self, -1, bitmap, bottonsize, - (bitmap.GetWidth()+bottonborder, bitmap.GetHeight()+bottonborder)) + (bitmap.GetWidth() + bottonborder, bitmap.GetHeight() + bottonborder)) b.SetToolTipString("Go up to parent object.") self.Bind(wx.EVT_BUTTON, self.on_go_up, b) - self.toolbar.Add(b,0, wx.EXPAND, border=toolbarborder) - - #self.add_tool( + self.toolbar.Add(b, 0, wx.EXPAND, border=toolbarborder) + + # self.add_tool( # 'up',self.on_go_up, # wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_TOOLBAR, tsize), - # 'show panel of parent instance') - - bitmap = wx.ArtProvider_GetBitmap(wx.ART_GO_HOME,wx.ART_TOOLBAR) + # 'show panel of parent instance') + + bitmap = wx.ArtProvider_GetBitmap(wx.ART_GO_HOME, wx.ART_TOOLBAR) b = wx.BitmapButton(self, -1, bitmap, bottonsize, - (bitmap.GetWidth()+bottonborder, bitmap.GetHeight()+bottonborder)) + (bitmap.GetWidth() + bottonborder, bitmap.GetHeight() + bottonborder)) b.SetToolTipString("Go to main object, the mother of all objects.") self.Bind(wx.EVT_BUTTON, self.on_go_home, b) - self.toolbar.Add(b,0, wx.EXPAND, border=toolbarborder) - - #self.add_tool( + self.toolbar.Add(b, 0, wx.EXPAND, border=toolbarborder) + + # self.add_tool( # 'home',self.on_go_home, # wx.ArtProvider.GetBitmap(wx.ART_GO_HOME, wx.ART_TOOLBAR, tsize), - # 'show panel of root instance') - - - self.path=wx.TextCtrl(self, -1, self.get_ident_abs(obj, _id), style=wx.TE_RIGHT)#size=(-1, -1))#,size=(300, -1)) + # 'show panel of root instance') + + # size=(-1, -1))#,size=(300, -1)) + self.path = wx.TextCtrl( + self, -1, self.get_ident_abs(obj, _id), style=wx.TE_RIGHT) #self.path=wx.TextCtrl(self.toolbar, -1, obj.format_ident_abs(), style=wx.TE_RIGHT) - #wx.EVT_ENTER_WINDOW(self.path,self.on_enter_window) - #self.add_tool('path',widget=self.path) + # wx.EVT_ENTER_WINDOW(self.path,self.on_enter_window) + # self.add_tool('path',widget=self.path) self.path.Bind(wx.EVT_CHAR, self.on_change_path) #self.toolbar.Add(self.path, flag=wx.ALL, border=toolbarborder) - self.toolbar.Add(self.path,1, wx.EXPAND, border=toolbarborder) + self.toolbar.Add(self.path, 1, wx.EXPAND, border=toolbarborder) #self.toolbar.AddControl(wx.TextCtrl(self.toolbar, -1, "Toolbar controls!!", size=(150, -1))) - - #self.toolbar.AddSeparator() - - #panel.SetAutoLayout(True) - #panel.SetSizer(buttons) - + + # self.toolbar.AddSeparator() + + # panel.SetAutoLayout(True) + # panel.SetSizer(buttons) + self.toolbar.Fit(self) - + # only for frames - #self.SetToolBar(self.toolbar) - + # self.SetToolBar(self.toolbar) + def get_ident_abs(self, obj, _id): - if _id!=None: + if _id != None: return obj.format_ident_row_abs(_id) - + else: return obj.format_ident_abs() - - - def init_objpanel(self,obj,id=None,ids=None,attrconfigs=None,groupnames=None, - is_modal=True,mainframe=None, func_apply=None, - immediate_apply=False, panelstyle='default',**buttonargs): + + def init_objpanel(self, obj, id=None, ids=None, attrconfigs=None, groupnames=None, + is_modal=True, mainframe=None, func_apply=None, + immediate_apply=False, panelstyle='default', **buttonargs): """ Initializes object panel, bu also stores parameters such as mode, groups etc """ - self.attrconfigs=attrconfigs - self.groupnames=groupnames - self.is_modal=is_modal - self.mainframe=mainframe - self.immediate_apply=immediate_apply; - self.panelstyle=panelstyle - self.buttonargs=buttonargs - #self.objpanel=ObjPanel(self,obj,id=id,ids=ids,attrs=attrs,groups=groups, + self.attrconfigs = attrconfigs + self.groupnames = groupnames + self.is_modal = is_modal + self.mainframe = mainframe + self.immediate_apply = immediate_apply + self.panelstyle = panelstyle + self.buttonargs = buttonargs + # self.objpanel=ObjPanel(self,obj,id=id,ids=ids,attrs=attrs,groups=groups, # func_change_obj=self.change_obj, # is_modal=is_modal, # mainframe=mainframe, # immediate_apply=immediate_apply, panelstyle=panelstyle, - # **buttonargs) - self.objpanel=ObjPanel(self, obj = obj, - attrconfigs=self.attrconfigs, - #tables = None, - #table = None, - id=id, ids=ids, - groupnames = groupnames, - func_change_obj=self.change_obj, - show_groupnames=False, show_title=True, is_modal=self.is_modal, - mainframe=self.mainframe, pos=wx.DefaultPosition, size=wx.DefaultSize, - func_apply = func_apply, - immediate_apply=self.immediate_apply, panelstyle='default', - **self.buttonargs) - + # **buttonargs) + self.objpanel = ObjPanel(self, obj=obj, + attrconfigs=self.attrconfigs, + #tables = None, + #table = None, + id=id, ids=ids, + groupnames=groupnames, + func_change_obj=self.change_obj, + show_groupnames=False, show_title=True, is_modal=self.is_modal, + mainframe=self.mainframe, pos=wx.DefaultPosition, size=wx.DefaultSize, + func_apply=func_apply, + immediate_apply=self.immediate_apply, panelstyle='default', + **self.buttonargs) + def init_hist(self): """ Initialize history variables """ - self.hist=[] - self.ind_hist=-1 - + self.hist = [] + self.ind_hist = -1 + + class NaviPanel(NaviPanelMixin, wx.Panel): + """ - + Interactively navigates through objects and displays attributes on a panel. """ - def __init__(self, parent, obj, id = None, mainframe=None, func_apply = None, **args): - if obj==None: - obj=cm.BaseObjman('empty') - wx.Panel.__init__(self,parent,-1,wx.DefaultPosition,wx.DefaultSize) - #print 'NaviPanel',obj.ident,id,func_apply,args - sizer=wx.BoxSizer(wx.VERTICAL) + + def __init__(self, parent, obj, id=None, mainframe=None, func_apply=None, **args): + if obj == None: + obj = cm.BaseObjman('empty') + wx.Panel.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize) + # print 'NaviPanel',obj.ident,id,func_apply,args + sizer = wx.BoxSizer(wx.VERTICAL) # define a default object which is shown when # refresh is called without arguments - self._defaultobj = obj - self.func_apply =func_apply + self._defaultobj = obj + self.func_apply = func_apply # initialize history self.init_hist() - + # make navigation toolbar self.init_navbar(obj, id) - + # create initial panel - self.init_objpanel(obj, id=id, mainframe=mainframe,is_modal=False,func_apply=func_apply,**args) - - sizer.Add(self.toolbar,0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4)# from NaviPanelTest - sizer.Add(self.objpanel,1,wx.GROW)# from NaviPanelTest - + self.init_objpanel(obj, id=id, mainframe=mainframe, + is_modal=False, func_apply=func_apply, **args) + + sizer.Add(self.toolbar, 0, wx.ALL | wx.ALIGN_LEFT | + wx.GROW, 4) # from NaviPanelTest + sizer.Add(self.objpanel, 1, wx.GROW) # from NaviPanelTest + # finish panel setup self.SetSizer(sizer) sizer.Fit(self) # add to history - #self.add_hist(obj,id,None,args) - #self.SetSize(parent.GetSize()) - - - - + # self.add_hist(obj,id,None,args) + # self.SetSize(parent.GetSize()) + + class ObjBrowserMainframe(wx.Frame): """ @@ -4238,24 +4159,22 @@ """ - - def __init__(self,parent, wxid,title,position,size, obj=None, _id=None, table = None): - wx.Frame.__init__(self,parent,wxid,title,position, size) - #print 'ObjBrowserMainframe',obj.ident,_id - ## Set up the MenuBar + def __init__(self, parent, wxid, title, position, size, obj=None, _id=None, table=None): + wx.Frame.__init__(self, parent, wxid, title, position, size) + # print 'ObjBrowserMainframe',obj.ident,_id + # Set up the MenuBar MenuBar = wx.MenuBar() file_menu = wx.Menu() - item = file_menu.Append(-1, "&Open...","Open an object from file.") + item = file_menu.Append(-1, "&Open...", "Open an object from file.") self.Bind(wx.EVT_MENU, self.OnLoad, item) - item = file_menu.Append(-1, "&Save as","Save an object under file.") + item = file_menu.Append(-1, "&Save as", "Save an object under file.") self.Bind(wx.EVT_MENU, self.OnSave, item) - item = file_menu.Append(-1, "&Close","Close this frame") + item = file_menu.Append(-1, "&Close", "Close this frame") self.Bind(wx.EVT_MENU, self.OnQuit, item) MenuBar.Append(file_menu, "&File") - help_menu = wx.Menu() item = help_menu.Append(-1, "&About", "More information About this program") @@ -4266,35 +4185,33 @@ self.CreateStatusBar() - # Create Browser widget here #browser = wx.Panel(self, -1, wx.DefaultPosition, size = wx.DefaultSize) #browser = ObjPanel(self,obj, id=10) - if obj!= None: - #print ' init ObjPanel' + if obj != None: + # print ' init ObjPanel' #self.browser = ObjPanel(self, obj) self.browser = NaviPanel(self, obj, _id) else: - #print ' init TablePanel' + # print ' init TablePanel' self.browser = TablePanel(self, table) #browser = TablePanel(self,obj) - #self.MsgWindow = wx.TextCtrl(self, wx.ID_ANY, + # self.MsgWindow = wx.TextCtrl(self, wx.ID_ANY, # "Look Here for output from events\n", # style = (wx.TE_MULTILINE | # wx.TE_READONLY | # wx.SUNKEN_BORDER) # ) - - + # TODO:INTERESTING: - #wxTextCtrl *control = new wxTextCtrl(...); - #wxStreamToTextRedirector redirect(control); + # wxTextCtrl *control = new wxTextCtrl(...); + # wxStreamToTextRedirector redirect(control); #// all output to cout goes into the text control until the exit from # // current scope - + #self.MsgWindow = py.crust.Crust(self, intro='Check it out!') - self.MsgWindow = py.shell.Shell(self) - ##Create a sizer to manage the Canvas and message window + self.MsgWindow = py.shell.Shell(self) + # Create a sizer to manage the Canvas and message window MainSizer = wx.BoxSizer(wx.VERTICAL) MainSizer.Add(self.browser, 4, wx.EXPAND) MainSizer.Add(self.MsgWindow, 1, wx.EXPAND | wx.ALL, 5) @@ -4304,13 +4221,12 @@ self.EventsAreBound = False - ## getting all the colors for random objects + # getting all the colors for random objects wxlib.colourdb.updateColourDB() self.colors = wxlib.colourdb.getColourList() - return None - + def OnAbout(self, event): dlg = wx.MessageDialog(self, "This is a small program to demonstrate\n" @@ -4320,181 +4236,167 @@ dlg.ShowModal() dlg.Destroy() - def OnLoad(self,event): - + def OnLoad(self, event): + dlg = wx.FileDialog(self, message="Open object", - defaultDir=os.getcwd(), + defaultDir=os.getcwd(), defaultFile="", - wildcard = wildcards_all, + wildcard=wildcards_all, style=wx.OPEN | wx.MULTIPLE | wx.CHANGE_DIR ) - # Show the dialog and retrieve the user response. If it is the OK response, + # Show the dialog and retrieve the user response. If it is the OK response, # process the data. if dlg.ShowModal() == wx.ID_OK: # This returns a Python list of files that were selected. paths = dlg.GetPaths() - #print 'You selected %d files:' % len(paths) - if len(paths)>0: + # print 'You selected %d files:' % len(paths) + if len(paths) > 0: filepath = paths[0] obj = cm.load_obj(filepath) - - - MainSizer=self.GetSizer() + + MainSizer = self.GetSizer() MainSizer.Remove(0) MainSizer.Remove(1) - + self.browser.Destroy() self.MsgWindow.Destroy() - + # build new obj panel - self.browser=ObjPanel(self,obj) - #sizer.Add(self.objpanel,0,wx.GROW) - + self.browser = ObjPanel(self, obj) + # sizer.Add(self.objpanel,0,wx.GROW) + #self.browser = wx.Panel(self, -1) #button = wx.Button(self.browser, 1003, "Close Me") #button.SetPosition((15, 15)) - - #sizer.Add(panel,1,wx.GROW) - - self.MsgWindow = py.shell.Shell(self) - ##Create a sizer to manage the Canvas and message window + + # sizer.Add(panel,1,wx.GROW) + + self.MsgWindow = py.shell.Shell(self) + # Create a sizer to manage the Canvas and message window MainSizer.Add(self.browser, 4, wx.EXPAND) MainSizer.Add(self.MsgWindow, 1, wx.EXPAND | wx.ALL, 5) - - + self.Refresh() MainSizer.Layout() - - - def OnSave(self,event): - dlg = wx.FileDialog(\ - self, message="Save file as ...", defaultDir=os.getcwd(), + def OnSave(self, event): + dlg = wx.FileDialog( + self, message="Save file as ...", defaultDir=os.getcwd(), defaultFile="", wildcard=wildcards_all, style=wx.SAVE - ) + ) # This sets the default filter that the user will initially see. Otherwise, # the first filter in the list will be used by default. dlg.SetFilterIndex(0) - # Show the dialog and retrieve the user response. If it is the OK response, + # Show the dialog and retrieve the user response. If it is the OK response, # process the data. if dlg.ShowModal() == wx.ID_OK: filepath = dlg.GetPath() - cm.save_obj(self.browser.get_obj(),filepath) + cm.save_obj(self.browser.get_obj(), filepath) - - def OnQuit(self,event): + def OnQuit(self, event): self.Close(True) def OnCloseWindow(self, event): self.Destroy() + class ObjBrowserApp(wx.App): + """ - + """ - def __init__(self, obj,_id =None,output = False, **kwargs): + def __init__(self, obj, _id=None, output=False, **kwargs): self._obj = obj self._id = _id - #print 'ObjBrowserApp.__init__',obj.ident, _id - + # print 'ObjBrowserApp.__init__',obj.ident, _id + wx.App.__init__(self, output, **kwargs) - - def OnInit(self): - wx.InitAllImageHandlers() - #DrawFrame = BuildDrawFrame() - frame = ObjBrowserMainframe(None, -1, "Object browser",wx.DefaultPosition,(700,700),obj=self._obj, _id = self._id) - - self.SetTopWindow(frame) - frame.Show() - - return True + wx.InitAllImageHandlers() + #DrawFrame = BuildDrawFrame() + frame = ObjBrowserMainframe( + None, -1, "Object browser", wx.DefaultPosition, (700, 700), obj=self._obj, _id=self._id) + + self.SetTopWindow(frame) + frame.Show() + + return True + class TableBrowserApp(wx.App): + """ - + """ def __init__(self, tab, **kwargs): self._tab = tab - #print 'ViewerApp.__init__',self._net - + # print 'ViewerApp.__init__',self._net + wx.App.__init__(self, **kwargs) - - def OnInit(self): - wx.InitAllImageHandlers() - #DrawFrame = BuildDrawFrame() - frame = ObjBrowserMainframe(None, -1, "Table browser",wx.DefaultPosition,(700,700),table=self._tab) - - self.SetTopWindow(frame) - frame.Show() - - return True - -def objbrowser(obj, _id = None): - app = ObjBrowserApp(obj, _id =_id, output = False)# put in True if you want output to go to it's own window. - #print 'call MainLoop' - app.MainLoop() + wx.InitAllImageHandlers() + #DrawFrame = BuildDrawFrame() + frame = ObjBrowserMainframe( + None, -1, "Table browser", wx.DefaultPosition, (700, 700), table=self._tab) + + self.SetTopWindow(frame) + frame.Show() + + return True + + +def objbrowser(obj, _id=None): + # put in True if you want output to go to it's own window. + app = ObjBrowserApp(obj, _id=_id, output=False) + # print 'call MainLoop' + app.MainLoop() ############################################################################### if __name__ == '__main__': - + from agilepy.lib_base.test_classman_classes import * # no from agilepy.lib_base.classman import * - from agilepy.lib_base.classman import load_obj,save_obj + from agilepy.lib_base.classman import load_obj, save_obj ############ # make up a test class - n_test = -5 #<<<<<<<<<<<<<<<<<< + n_test = -5 # <<<<<<<<<<<<<<<<<< ############ _id = None - + if n_test == 0: # simple scalar parameters, no table obj = TestClass() - print 'obj.ident',obj.ident - - - - elif n_test == 1: + print 'obj.ident', obj.ident + + elif n_test == 1: obj = TestTableObjMan() - - elif n_test == -1: + + elif n_test == -1: obj = TestTableObjManNocols() - - - elif n_test == 2: + + elif n_test == 2: obj = demand - - elif n_test == 3: + + elif n_test == 3: obj = lines - - elif n_test == 4: + + elif n_test == 4: _id = 1 obj = TestTableObjMan() elif n_test == 5: obj = drawing elif n_test == -5: - save_obj(drawing,'test_drawing.obj') - print '\nreload'+60*'.' + save_obj(drawing, 'test_drawing.obj') + print '\nreload' + 60 * '.' obj = load_obj('test_drawing.obj') obj.get_attrsman().print_attrs() - + elif n_test == 6: - obj = polylines + obj = polylines objbrowser(obj, _id=_id) - - - - - - - - - - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/ogleditor.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/ogleditor.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/ogleditor.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/ogleditor.py 2017-07-23 16:22:07.000000000 +0000 @@ -1,12 +1,12 @@ -#!/usr/bin/env python; +#!/usr/bin/env python """OpenGL editor""" -if __name__ == '__main__': - __version__="0.1a" +if __name__ == '__main__': + __version__ = "0.1a" __licence__ = """licensed under the GPL.""" - __copyright__ = "(c) 2012-2016 University of Bologna - DICAM" + __copyright__ = "(c) 2012-2017 University of Bologna - DICAM" __author__ = "Joerg Schweizer" - - __usage__="""USAGE: + + __usage__ = """USAGE: from command line: python ogleditor.py python ogleditor.py @@ -17,10 +17,10 @@ print __copyright__ ############################################################################### -## IMPORTS +# IMPORTS #import wxversion -#wxversion.select("2.8") +# wxversion.select("2.8") import wx from collections import OrderedDict @@ -28,27 +28,29 @@ from wx.lib.buttons import GenBitmapTextButton, GenBitmapButton try: from OpenGL.GL import * - from OpenGL.GLU import * # project , unproject , tess + from OpenGL.GLU import * # project , unproject , tess from OpenGL.GLUT import * from OpenGL.raw.GL.ARB.vertex_array_object import glGenVertexArrays, \ - glBindVertexArray - + glBindVertexArray + from OpenGL.arrays import vbo import numpy as np - + except ImportError: raise ImportError, "Required dependencies numpy or OpenGL not present" -import sys, os, types -if __name__ == '__main__': +import sys +import os +import types +if __name__ == '__main__': try: FILEDIR = os.path.dirname(os.path.abspath(__file__)) except: FILEDIR = os.path.dirname(os.path.abspath(sys.argv[0])) - sys.path.append(os.path.join(FILEDIR,"..","..")) + sys.path.append(os.path.join(FILEDIR, "..", "..")) #IMAGEDIR = os.path.join(APPDIR,"lib_base","images") - -IMAGEDIR = os.path.join(os.path.dirname(__file__),"images") + +IMAGEDIR = os.path.join(os.path.dirname(__file__), "images") import agilepy.lib_base.classman as cm import agilepy.lib_base.arrayman as am @@ -56,725 +58,693 @@ from agilepy.lib_base.geometry import * # wx gui stuff -from wxmisc import * -from toolbox import * - +from wxmisc import * +from toolbox import * -FLATHEAD = 0 +FLATHEAD = 0 BEVELHEAD = 1 -TRIANGLEHEAD = 2 -ARROWHEAD = 3 -LEFTTRIANGLEHEAD = 4 -RIGHTTRIANGLEHEAD = 5 - -LINEHEADS = { #'flat':0,# not a style - 'bevel':BEVELHEAD, - 'triangle':TRIANGLEHEAD, - 'arrow':ARROWHEAD, - 'lefttriangle':LEFTTRIANGLEHEAD, - 'righttriangle':RIGHTTRIANGLEHEAD, - } - +TRIANGLEHEAD = 2 +ARROWHEAD = 3 +LEFTTRIANGLEHEAD = 4 +RIGHTTRIANGLEHEAD = 5 + +LINEHEADS = { # 'flat':0,# not a style + 'bevel': BEVELHEAD, + 'triangle': TRIANGLEHEAD, + 'arrow': ARROWHEAD, + 'lefttriangle': LEFTTRIANGLEHEAD, + 'righttriangle': RIGHTTRIANGLEHEAD, +} + # to be deleted #import test_glcanvas as testogl -##class TestVbo(Vbo): -## def draw(self, resolution): -## -## -## -## print 'draw',self.get_ident(),self -## glEnableClientState(GL_VERTEX_ARRAY) -## glEnableClientState(GL_COLOR_ARRAY) -## -## self._colorvbo.bind() +# class TestVbo(Vbo): +# def draw(self, resolution): +## +## +## +# print 'draw',self.get_ident(),self +# glEnableClientState(GL_VERTEX_ARRAY) +# glEnableClientState(GL_COLOR_ARRAY) +## +# self._colorvbo.bind() ## glColorPointer(4, GL_FLOAT, 0, None) -## -## self._vertexvbo.bind() -## self._indexvbo.bind() +## +# self._vertexvbo.bind() +# self._indexvbo.bind() ## glVertexPointer(3, GL_FLOAT, 0, None) -## -## print ' self._n_vpo *(self._n_vpo-1)*self._n_drawobjs',self._n_vpo *(self._n_vpo-1)*self._n_drawobjs -## print ' len(self._vertexvbo)',len(self._vertexvbo) -## print ' len(self._colorvbo)',len(self._colorvbo) -## #n_vpo = len(self._vertexvbo)/self._n_vpe/self._n_drawobjs+1 -## #glDrawElements(self._glelement, self._n_vpo *(self._n_vpo-1)*self._n_drawobjs, GL_UNSIGNED_INT, None) +## +# print ' self._n_vpo *(self._n_vpo-1)*self._n_drawobjs',self._n_vpo *(self._n_vpo-1)*self._n_drawobjs +# print ' len(self._vertexvbo)',len(self._vertexvbo) +# print ' len(self._colorvbo)',len(self._colorvbo) +# n_vpo = len(self._vertexvbo)/self._n_vpe/self._n_drawobjs+1 +# glDrawElements(self._glelement, self._n_vpo *(self._n_vpo-1)*self._n_drawobjs, GL_UNSIGNED_INT, None) ## glDrawElements(self._glelement, len(self._vertexvbo), GL_UNSIGNED_INT, None) -## -## glDisableClientState(GL_VERTEX_ARRAY) -## glDisableClientState(GL_COLOR_ARRAY) -## -## self._vertexvbo.unbind() -## self._indexvbo.unbind() -## self._colorvbo.unbind() - - +## +# glDisableClientState(GL_VERTEX_ARRAY) +# glDisableClientState(GL_COLOR_ARRAY) +## +# self._vertexvbo.unbind() +# self._indexvbo.unbind() +# self._colorvbo.unbind() + + class Vbo: + def __init__(self, ident, glelement, n_vpe, objtype=''): self._ident = ident self._glelement = glelement self._n_vpe = n_vpe self._objtype = objtype self.reset() - + def reset(self): self._vertexvbo = None - self._indexvbo = None + self._indexvbo = None self._colorvbo = None self._inds = None - + def get_objtype(self): return self._objtype - + def is_fill(self): return self._objtype == 'fill' - + def get_ident(self): return self._ident - + def get_vpe(self): return self._n_vpe - - def update_vertices(self, vertices, n=None, inds = None): + + def update_vertices(self, vertices, n=None, inds=None): """ - + n = number of draw objects """ self._inds = inds - #print 'update_vertices',self.get_ident(),n + # print 'update_vertices',self.get_ident(),n self._n_drawobjs = n - # + # #vertices = np.zeros((self._n_elem_fill, self._n_vpe_fill * 3),dtype=np.float32) - # len(vertices) = n_elem = (n_vpo-1)*n + # len(vertices) = n_elem = (n_vpo-1)*n #n_elem = len(vertices)/n_drawobjs+self._noncyclic - - #n_vpo = vertex per draw object - # n_elem = (n_vpo-1)*n_drawobjs - #n_vpo = vertex per draw object + + # n_vpo = vertex per draw object + # n_elem = (n_vpo-1)*n_drawobjs + # n_vpo = vertex per draw object #self._n_vpo = n_elem/n_drawobjs+1 #n_vert = len(self._vertexvbo_fill)/self._n_vpe_fill/len(self)+1 - #n_elem_fill = (n_vert-1)*n - # len(_vertexvbo_fill) = self._n_vpe * self._n_elem_fill = self._n_vpe * (n_vert-1)*n - #print ' len(vertices),n_vpo,n_elem',len(vertices),self._n_vpo,n_elem - + #n_elem_fill = (n_vert-1)*n + # len(_vertexvbo_fill) = self._n_vpe * self._n_elem_fill = self._n_vpe * (n_vert-1)*n + # print ' len(vertices),n_vpo,n_elem',len(vertices),self._n_vpo,n_elem + #glDrawElements(GL_TRIANGLES, self._n_vert*self._n_elem_fill, GL_UNSIGNED_INT, None) # self._n_vert*self._n_elem_fill = n_vert * (n_vert-1)*n - #repeat for each of the n objects: self._n_vpe_fill*(n_vert-1) - #print ' vertices=\n',vertices - #print ' vertices.reshape((-1,3))=\n',vertices.reshape((-1,3)) - self._vertexvbo = vbo.VBO(vertices.reshape((-1,3))) - self._indexvbo = vbo.VBO(np.arange(len(self._vertexvbo), dtype=np.int32), target=GL_ELEMENT_ARRAY_BUFFER) + # repeat for each of the n objects: self._n_vpe_fill*(n_vert-1) + # print ' vertices=\n',vertices + # print ' vertices.reshape((-1,3))=\n',vertices.reshape((-1,3)) + self._vertexvbo = vbo.VBO(vertices.reshape((-1, 3))) + self._indexvbo = vbo.VBO(np.arange( + len(self._vertexvbo), dtype=np.int32), target=GL_ELEMENT_ARRAY_BUFFER) #self._indexvbo = vbo.VBO(np.arange(len(vertices.reshape((-1,3)) ), dtype=np.int32), target=GL_ELEMENT_ARRAY_BUFFER) - + def destroy(self): del self._vertexvbo del self._indexvbo del self._colorvbo self.reset() - - + def update_colors(self, colors): - - if self._vertexvbo == None: return - #print 'update_colors',self._n_drawobjs,len(colors) - if len(colors) == 0: return + + if self._vertexvbo == None: + return + # print 'update_colors',self._n_drawobjs,len(colors) + if len(colors) == 0: + return if self._n_drawobjs == None: - n_repreat = len(self._vertexvbo)/len(self._inds)# self._n_drawobjs - self._colorvbo = vbo.VBO( np.repeat(colors[self._inds],n_repreat,0)) + n_repreat = len(self._vertexvbo) / \ + len(self._inds) # self._n_drawobjs + self._colorvbo = vbo.VBO( + np.repeat(colors[self._inds], n_repreat, 0)) else: - n_repreat = len(self._vertexvbo)/self._n_drawobjs - self._colorvbo = vbo.VBO( np.repeat(colors,n_repreat,0)) + n_repreat = len(self._vertexvbo) / self._n_drawobjs + self._colorvbo = vbo.VBO(np.repeat(colors, n_repreat, 0)) - def draw(self, resolution): - - #glEnableClientState(GL_VERTEX_ARRAY) - #glEnableClientState(GL_COLOR_ARRAY) - if self._vertexvbo == None: return - #print 'Vbo.draw',self.get_ident(),self._n_drawobjs,len(self._vertexvbo) - #if self._n_drawobjs in (0,None): return - if self._n_drawobjs == 0: return + + # glEnableClientState(GL_VERTEX_ARRAY) + # glEnableClientState(GL_COLOR_ARRAY) + if self._vertexvbo == None: + return + # print 'Vbo.draw',self.get_ident(),self._n_drawobjs,len(self._vertexvbo) + # if self._n_drawobjs in (0,None): return + if self._n_drawobjs == 0: + return self._colorvbo.bind() glColorPointer(4, GL_FLOAT, 0, None) - + self._vertexvbo.bind() self._indexvbo.bind() glVertexPointer(3, GL_FLOAT, 0, None) - - #print ' self._n_vpo *(self._n_vpo-1)*self._n_drawobjs',self._n_vpo *(self._n_vpo-1)*self._n_drawobjs - #print ' len(self._vertexvbo)',len(self._vertexvbo) - #print ' len(self._indexvbo)',len(self._indexvbo) - #print ' len(self._colorvbo)',len(self._colorvbo) + + # print ' self._n_vpo *(self._n_vpo-1)*self._n_drawobjs',self._n_vpo *(self._n_vpo-1)*self._n_drawobjs + # print ' len(self._vertexvbo)',len(self._vertexvbo) + # print ' len(self._indexvbo)',len(self._indexvbo) + # print ' len(self._colorvbo)',len(self._colorvbo) #n_vpo = len(self._vertexvbo)/self._n_vpe/self._n_drawobjs+1 #glDrawElements(self._glelement, self._n_vpo *(self._n_vpo-1)*self._n_drawobjs, GL_UNSIGNED_INT, None) - glDrawElements(self._glelement, len(self._vertexvbo), GL_UNSIGNED_INT, None) - - #glDisableClientState(GL_VERTEX_ARRAY) - #glDisableClientState(GL_COLOR_ARRAY) - + glDrawElements(self._glelement, len( + self._vertexvbo), GL_UNSIGNED_INT, None) + + # glDisableClientState(GL_VERTEX_ARRAY) + # glDisableClientState(GL_COLOR_ARRAY) + self._vertexvbo.unbind() self._indexvbo.unbind() self._colorvbo.unbind() - - - - - class SelectToolMixin(BaseTool): + """ Mixin for Selection tools for OGL canvas. - """ - - def _init_select(self, is_show_selected = False, detectwidth = 0.1, detectpix = 5): + """ + + def _init_select(self, is_show_selected=False, detectwidth=0.1, detectpix=5): """ Define selection specific attributes. """ self.detectpix = detectpix - self.detectwidth = detectwidth # in meter + self.detectwidth = detectwidth # in meter self.is_show_selected = is_show_selected - + if is_show_selected: groupnames = ['options'] else: groupnames = ['_private_'] - self.add_col(am.TabIdsArrayConf( 'drawobjects', - groupnames = groupnames, - name = 'Object', - info = 'Selected Draw objects with id', - )) - - - def activate_select(self,canvas = None): + self.add_col(am.TabIdsArrayConf('drawobjects', + groupnames=groupnames, + name='Object', + info='Selected Draw objects with id', + )) + + def activate_select(self, canvas=None): """ This call by metacanvas signals that the tool has been activated and can now interact with metacanvas. """ BaseTool.activate(self, canvas) self._idcounter = 0 - - - - + def deactivate_select(self): """ This call by metacanvas signals that the tool has been deactivated and can now interact with metacanvas. """ - drawing= self._canvas.get_drawing() - - if len(self)>0: + drawing = self._canvas.get_drawing() + + if len(self) > 0: # ungighlight selected objects is_draw = False - for drawobj, _id in self.drawobjects.value:# drawing.get_drawobjs(): - is_draw |= drawobj.unhighlight([_id], is_update = True) + # drawing.get_drawobjs(): + for drawobj, _id in self.drawobjects.value: + is_draw |= drawobj.unhighlight([_id], is_update=True) if is_draw: self._canvas.draw() - - # remove selected objects + + # remove selected objects self.del_rows(self.get_ids()) - - BaseTool.deactivate(self) - - - + BaseTool.deactivate(self) + def iterate_selection(self): self.unhighlight_current() - self._idcounter +=1 + self._idcounter += 1 if self._idcounter == len(self): self._idcounter = 0 self.highlight_current() - + def on_left_down_select(self, event): - #print 'on_left_down_select' - is_draw = False - - if len(self)>0: + # print 'on_left_down_select' + is_draw = False + + if len(self) > 0: if event.ShiftDown(): - + self.iterate_selection() self.on_change_selection(event) is_draw = True else: - #print ' on_execute_selection 1' + # print ' on_execute_selection 1' is_draw |= self.on_execute_selection(event) is_draw |= self.unselect_all() if self.is_show_selected: self.parent.refresh_optionspanel(self) - + else: is_draw |= self.pick_all(event) self.highlight_current() - + if not event.ShiftDown(): if self.is_preselected(): - self.coord_last = self._canvas.unproject(event.GetPosition()) - #print ' on_execute_selection 2' + self.coord_last = self._canvas.unproject( + event.GetPosition()) + # print ' on_execute_selection 2' is_draw |= self.on_execute_selection(event) - + else: - self.coord_last = self._canvas.unproject(event.GetPosition()) - + self.coord_last = self._canvas.unproject(event.GetPosition()) + if self.is_show_selected: self.parent.refresh_optionspanel(self) return is_draw - + def is_preselected(self): """ Check if there are preselected drawobjects in the list. """ - return len(self)>0 - - def on_execute_selection(self,event): + return len(self) > 0 + + def on_execute_selection(self, event): """ Definively execute operation on currently selected drawobjects. """ self.set_objbrowser() return False - - def on_change_selection(self,event): + + def on_change_selection(self, event): """ Called after selection has been changed with SHIFT-click Do operation on currently selected drawobjects. """ - self.set_objbrowser() + self.set_objbrowser() return False - + def set_objbrowser(self): pass - + def aboard_select(self, event): - #print 'aboard',self.ident + # print 'aboard',self.ident is_draw = self.unselect_all() return is_draw - + def get_current_selection(self): - if len(self)>0: - (drawobj, _id) = self.drawobjects[self.get_ids()[self._idcounter]] + if len(self) > 0: + (drawobj, _id) = self.drawobjects[self.get_ids()[self._idcounter]] return drawobj, _id else: return None, -1 - + def is_tool_allowed_on_selection(self): drawobj, _id = self.get_current_selection() - if drawobj!=None: - return drawobj.is_tool_allowed(self, _id) + if drawobj != None: + return drawobj.is_tool_allowed(self, _id) else: False - - - + def pick_all(self, event): """ Pick all objets with id, that are near the pointer coordinates. """ - + p = self._canvas.unproject_event(event) - + if self.detectpix > 0: # detect pixel sensitivity is given # calculate detectwidth based on current resolution - self.detectwidth = self._canvas.get_resolution()*self.detectpix - - #print 'pick_all',self.detectwidth,self.detectpix,self._canvas.get_resolution() - + self.detectwidth = self._canvas.get_resolution() * self.detectpix + + # print + # 'pick_all',self.detectwidth,self.detectpix,self._canvas.get_resolution() + self._idcounter = 0 is_draw = False drawing = self._canvas.get_drawing() - #print ' ',drawing.get_drawobjs() - for drawobj in drawing.get_drawobjs(): + # print ' ',drawing.get_drawobjs() + for drawobj in drawing.get_drawobjs(): if drawobj.is_visible(): - ids_pick = drawobj.pick(p, detectwidth = self.detectwidth) - #print ' pick',drawobj.get_ident(),ids_pick - if len(ids_pick)>0: - for id_pick in ids_pick: - is_draw |= self.add_selection(drawobj,id_pick, event) + ids_pick = drawobj.pick(p, detectwidth=self.detectwidth) + # print ' pick',drawobj.get_ident(),ids_pick + if len(ids_pick) > 0: + for id_pick in ids_pick: + is_draw |= self.add_selection(drawobj, id_pick, event) return is_draw - + def unhighlight_current(self): - #print 'unhighlight_current',len(self),self._idcounter - if len(self)>0: - (drawobj, _id) = self.drawobjects[self.get_ids()[self._idcounter]] + # print 'unhighlight_current',len(self),self._idcounter + if len(self) > 0: + (drawobj, _id) = self.drawobjects[self.get_ids()[self._idcounter]] drawobj.unhighlight([_id]) - + def highlight_current(self): - #print 'highlight_current',len(self),self._idcounter - if len(self)>0: - (drawobj, _id) = self.drawobjects[self.get_ids()[self._idcounter]] - drawobj.highlight([_id]) - + # print 'highlight_current',len(self),self._idcounter + if len(self) > 0: + (drawobj, _id) = self.drawobjects[self.get_ids()[self._idcounter]] + drawobj.highlight([_id]) + def unselect_all(self): - #print 'unselect_all',len(self) + # print 'unselect_all',len(self) self._idcounter = 0 - if len(self)>0: + if len(self) > 0: is_draw = True for drawobj, _id in self.drawobjects.value: if _id in drawobj: drawobj.unhighlight([_id]) - + self.del_rows(self.get_ids()) else: is_draw = False - + if is_draw: self.parent.refresh_optionspanel(self) - #print ' len should be 0:',len(self),is_draw + # print ' len should be 0:',len(self),is_draw return is_draw - def add_selection(self, drawobj, id_pick, event): is_draw = False - drawobjid = self.drawobjects.convert_type(( drawobj, id_pick)) - ids_match = self.select_ids(self.drawobjects.value == drawobjid) - if len(ids_match)==0: - self.add_rows(1,drawobjects = [( drawobj, id_pick)]) + drawobjid = self.drawobjects.convert_type((drawobj, id_pick)) + ids_match = self.select_ids(self.drawobjects.value == drawobjid) + if len(ids_match) == 0: + self.add_rows(1, drawobjects=[(drawobj, id_pick)]) is_draw = True return is_draw - class AddLineTool(BaseTool): + """ Mixin for Selection tools for OGL canvas. - """ - def __init__(self,parent, mainframe=None): - self.init_common( 'add_line',parent,'Add line tool', - info = 'Click on canvas to add a line. Double click to finish, right click to aboard.', - is_textbutton = False, - ) + """ + + def __init__(self, parent, mainframe=None): + self.init_common('add_line', parent, 'Add line tool', + info='Click on canvas to add a line. Double click to finish, right click to aboard.', + is_textbutton=False, + ) self.init_options() - - + def init_options(self): - self.add(cm.AttrConf( 'width', 0.2, - groupnames = ['options'], - perm='rw', - name = 'Width', - is_save = True, - info = 'Line width', - )) - - self.add(cm.AttrConf( 'color', np.array([1.0,0.0,0.0,0.8], dtype=np.float32), - groupnames = ['options'], - perm='rw', - metatype = 'color', - name = 'Fill color', - is_save = True, - info = 'Line color with format [r,g,b,a]', - )) - - #self.add(cm.AttrConf( 'color_fill', np.array([1.0,0.0,0.0,0.8], dtype=np.float32), - # groupnames = ['options'], - # perm='rw', + self.add(cm.AttrConf('width', 0.2, + groupnames=['options'], + perm='rw', + name='Width', + is_save=True, + info='Line width', + )) + + self.add(cm.AttrConf('color', np.array([1.0, 0.0, 0.0, 0.8], dtype=np.float32), + groupnames=['options'], + perm='rw', + metatype='color', + name='Fill color', + is_save=True, + info='Line color with format [r,g,b,a]', + )) + + # self.add(cm.AttrConf( 'color_fill', np.array([1.0,0.0,0.0,0.8], dtype=np.float32), + # groupnames = ['options'], + # perm='rw', # metatype = 'color', # name = 'Fill color', # is_save = True, # info = 'Object fill color with format [r,g,b,a]', # )) - - - - def set_button_info(self,bsize=(32,32)): - #print 'set_button_info select tool' - self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'line_24px.png'),wx.BITMAP_TYPE_PNG) - self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'line_24px.png'),wx.BITMAP_TYPE_PNG) - + + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'line_24px.png'), wx.BITMAP_TYPE_PNG) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'line_24px.png'), wx.BITMAP_TYPE_PNG) def set_cursor(self): # http://www.wxpython.org/docs/api/wx.Cursor-class.html if self._canvas != None: - self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) - - def activate(self,canvas = None): + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) + + def activate(self, canvas=None): """ This call by metacanvas??TooldsPallet signals that the tool has been activated and can now interact with metacanvas. """ - #print 'activate',self.ident + # print 'activate',self.ident self._is_active = True self._canvas = canvas - #self._canvas.del_handles() + # self._canvas.del_handles() canvas.activate_tool(self) self.set_cursor() self.is_animated = False - - def deactivate(self): """ This call by metacanvas??? ToolePallet signals that the tool has been deactivated and can now interact with metacanvas. """ - - + is_draw = self.aboard() self._canvas.deactivate_tool() self._canvas = None self._is_active = False return is_draw - - - - - def on_left_down(self, event): if not self.is_animated: return self.begin_animation(event) - + def on_left_dclick(self, event): if self.is_animated: - return self.end_animation(event) - - + return self.end_animation(event) + def on_motion(self, event): if self.is_animated: return self.animate(event) else: return False - def begin_animation(self, event): - #print 'AddLineTool' + # print 'AddLineTool' #self.drawobj_anim, _id, self.ind_vert = self.get_current_vertexselection() - self.drawobj_anim = self._canvas.get_drawing().get_drawobj_by_ident('fancylines') + self.drawobj_anim = self._canvas.get_drawing().get_drawobj_by_ident( + 'fancylines') self.coord_last = self._canvas.unproject(event.GetPosition()) - vert = np.concatenate((self.coord_last,self.coord_last),1).reshape((2,3)) - #print ' vert ',vert#,self.width.get_value(),self.color.get_value(), - _id = self.drawobj_anim.add_drawobj( vert, - self.width.get_value(),# width + vert = np.concatenate( + (self.coord_last, self.coord_last), 1).reshape((2, 3)) + # print ' vert ',vert#,self.width.get_value(),self.color.get_value(), + _id = self.drawobj_anim.add_drawobj(vert, + self.width.get_value(), # width self.color.get_value(), - beginstyle = TRIANGLEHEAD, - endstyle = TRIANGLEHEAD, + beginstyle=TRIANGLEHEAD, + endstyle=TRIANGLEHEAD, ) - self.ind_vert = 1 + self.ind_vert = 1 self.drawobj_anim.begin_animation(_id) - - + # http://www.wxpython.org/docs/api/wx.Cursor-class.html self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_CROSS)) self.is_animated = True - + self.parent.refresh_optionspanel(self) - return True # True for redrawing - - + return True # True for redrawing - def end_animation(self, event): - self.drawobj_anim.end_animation(is_del_last_vert = False) + self.drawobj_anim.end_animation(is_del_last_vert=False) # http://www.wxpython.org/docs/api/wx.Cursor-class.html self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) - - + del self.drawobj_anim #del self.id_anim self.is_animated = False self.parent.refresh_optionspanel(self) - return True # True for redrawing - - - - def animate(self,event): - #print 'animate' + return True # True for redrawing + + def animate(self, event): + # print 'animate' is_draw = False coords = self._canvas.unproject(event.GetPosition()) - vertex_delta = coords-self.coord_last - if np.any(np.abs(vertex_delta)>0): - is_draw = self.drawobj_anim.stretch_animation(coords, vertex_delta, self.ind_vert) + vertex_delta = coords - self.coord_last + if np.any(np.abs(vertex_delta) > 0): + is_draw = self.drawobj_anim.stretch_animation( + coords, vertex_delta, self.ind_vert) if is_draw: self.coord_last = coords return is_draw - - - - def aboard(self, event = None): - #print 'aboard',self.ident - + + def aboard(self, event=None): + # print 'aboard',self.ident + is_draw = False if self.is_animated: #id_admin = self.drawobj_anim.get_id_admin() - self.drawobj_anim.del_animation(is_del_main = True) + self.drawobj_anim.del_animation(is_del_main=True) del self.drawobj_anim self.is_animated = False is_draw = True self.parent.refresh_optionspanel(self) - return is_draw # True for redrawing - - #def set_objbrowser(self): + return is_draw # True for redrawing + + # def set_objbrowser(self): # pass - - def get_optionspanel(self, parent,size=(200,-1)): + + def get_optionspanel(self, parent, size=(200, -1)): """ Return tool option widgets on given parent """ if self.is_animated: - # show option of currently selected drawobj - self._optionspanel = ObjPanel(parent, obj = self.drawobj_anim, - id = self.drawobj_anim.get_id_anim(), - attrconfigs=None, - #tables = None, - #table = None, id=None, ids=None, - groupnames = ['options'], - func_change_obj=None, - show_groupnames=False, show_title=True, is_modal=False, - mainframe=self.parent.get_mainframe(), - pos=wx.DefaultPosition, size=size, style = wx.MAXIMIZE_BOX|wx.RESIZE_BORDER, - func_apply = self.on_apply_option, - immediate_apply=False, panelstyle='default',#'instrumental' - standartbuttons=['apply','restore']) + # show option of currently selected drawobj + self._optionspanel = ObjPanel(parent, obj=self.drawobj_anim, + id=self.drawobj_anim.get_id_anim(), + attrconfigs=None, + #tables = None, + # table = None, id=None, ids=None, + groupnames=['options'], + func_change_obj=None, + show_groupnames=False, show_title=True, is_modal=False, + mainframe=self.parent.get_mainframe(), + pos=wx.DefaultPosition, size=size, style=wx.MAXIMIZE_BOX | wx.RESIZE_BORDER, + func_apply=self.on_apply_option, + # 'instrumental' + immediate_apply=False, panelstyle='default', + standartbuttons=['apply', 'restore']) else: - - self._optionspanel = ObjPanel(parent, obj = self, - id = None, - attrconfigs=None, - #tables = None, - #table = None, id=None, ids=None, - groupnames = ['options'], - func_change_obj=None, - show_groupnames=False, show_title=True, is_modal=False, - mainframe=self.parent.get_mainframe(), - pos=wx.DefaultPosition, size=size, style = wx.MAXIMIZE_BOX|wx.RESIZE_BORDER, - func_apply = self.on_apply_option, - immediate_apply=False, panelstyle='default',#'instrumental' - standartbuttons=['apply','restore']) - + + self._optionspanel = ObjPanel(parent, obj=self, + id=None, + attrconfigs=None, + #tables = None, + # table = None, id=None, ids=None, + groupnames=['options'], + func_change_obj=None, + show_groupnames=False, show_title=True, is_modal=False, + mainframe=self.parent.get_mainframe(), + pos=wx.DefaultPosition, size=size, style=wx.MAXIMIZE_BOX | wx.RESIZE_BORDER, + func_apply=self.on_apply_option, + # 'instrumental' + immediate_apply=False, panelstyle='default', + standartbuttons=['apply', 'restore']) + return self._optionspanel def on_apply_option(self, drawobj, id, ids): - #print '\n\n\non_apply_option drawobj, id, ids',drawobj, id, ids + # print '\n\n\non_apply_option drawobj, id, ids',drawobj, id, ids if self.is_animated: - if drawobj ==self.drawobj_anim: + if drawobj == self.drawobj_anim: drawobj._update_colorvbo() drawobj._update_vertexvbo() - - self._canvas.draw() + + self._canvas.draw() + class AddCircleTool(AddLineTool): + """ Mixin for Selection tools for OGL canvas. - """ - def __init__(self,parent, mainframe=None): - self.init_common( 'add_circle',parent,'Add circle tool', - info = 'Click on canvas to add a circle. Double click to finish, right click to aboard.', - is_textbutton = False, - ) + """ + + def __init__(self, parent, mainframe=None): + self.init_common('add_circle', parent, 'Add circle tool', + info='Click on canvas to add a circle. Double click to finish, right click to aboard.', + is_textbutton=False, + ) self.init_options() - - + def init_options(self): - - - self.add(cm.AttrConf( 'color', np.array([1.0,0.0,0.0,0.8], dtype=np.float32), - groupnames = ['options'], - perm='rw', - metatype = 'color', - name = 'Color', - is_save = True, - info = 'Line color with format [r,g,b,a]', - )) - - self.add(cm.AttrConf( 'color_fill', np.array([1.0,0.0,0.0,0.8], dtype=np.float32), - groupnames = ['options'], - perm='rw', - metatype = 'color', - name = 'Fill color', - is_save = True, - info = 'Circle fill color with format [r,g,b,a]', - )) - - - - def set_button_info(self,bsize=(32,32)): - #print 'set_button_info select tool' - self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'circle_empty_24px.png'),wx.BITMAP_TYPE_PNG) - self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'circle_empty_24px.png'),wx.BITMAP_TYPE_PNG) - + self.add(cm.AttrConf('color', np.array([1.0, 0.0, 0.0, 0.8], dtype=np.float32), + groupnames=['options'], + perm='rw', + metatype='color', + name='Color', + is_save=True, + info='Line color with format [r,g,b,a]', + )) + + self.add(cm.AttrConf('color_fill', np.array([1.0, 0.0, 0.0, 0.8], dtype=np.float32), + groupnames=['options'], + perm='rw', + metatype='color', + name='Fill color', + is_save=True, + info='Circle fill color with format [r,g,b,a]', + )) + + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'circle_empty_24px.png'), wx.BITMAP_TYPE_PNG) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'circle_empty_24px.png'), wx.BITMAP_TYPE_PNG) def begin_animation(self, event): - #print 'AddLineTool' + # print 'AddLineTool' #self.drawobj_anim, _id, self.ind_vert = self.get_current_vertexselection() - self.drawobj_anim = self._canvas.get_drawing().get_drawobj_by_ident('circles') + self.drawobj_anim = self._canvas.get_drawing().get_drawobj_by_ident( + 'circles') self.coord_last = self._canvas.unproject(event.GetPosition()) #vert = np.concatenate((self.coord_last,self.coord_last),1).reshape((2,3)) - #print ' vert ',vert#,self.width.get_value(),self.color.get_value(), - - _id = self.drawobj_anim.add_drawobj(1.0*self.coord_last, - 0.0, + # print ' vert ',vert#,self.width.get_value(),self.color.get_value(), + + _id = self.drawobj_anim.add_drawobj(1.0 * self.coord_last, + 0.0, self.color.get_value(), self.color_fill.get_value(), ) - + self.drawobj_anim.begin_animation(_id) - - + # http://www.wxpython.org/docs/api/wx.Cursor-class.html self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_CROSS)) self.is_animated = True - + self.parent.refresh_optionspanel(self) - return True # True for redrawing - - + return True # True for redrawing - def end_animation(self, event): - self.drawobj_anim.end_animation(is_del_last_vert = False) + self.drawobj_anim.end_animation(is_del_last_vert=False) # http://www.wxpython.org/docs/api/wx.Cursor-class.html self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) - - + del self.drawobj_anim #del self.id_anim self.is_animated = False self.parent.refresh_optionspanel(self) - return True # True for redrawing - - - - def animate(self,event): - #print 'animate' + return True # True for redrawing + + def animate(self, event): + # print 'animate' is_draw = False coords = self._canvas.unproject(event.GetPosition()) - vertex_delta = coords-self.coord_last - if np.any(np.abs(vertex_delta)>0): - is_draw = self.drawobj_anim.stretch_animation(coords, vertex_delta, 1) + vertex_delta = coords - self.coord_last + if np.any(np.abs(vertex_delta) > 0): + is_draw = self.drawobj_anim.stretch_animation( + coords, vertex_delta, 1) if is_draw: self.coord_last = coords return is_draw - - - - + + class AddPolylineTool(AddLineTool): + """ Mixin for Selection tools for OGL canvas. - """ - def __init__(self,parent, mainframe=None): - self.init_common( 'add_polyline',parent,'Add polyline tool', - info = 'Click on canvas to add a poly line. Add a vertex with a single click, double click to finish, right click to aboard.', - is_textbutton = False, - ) - self.init_options() - - - - - - - def set_button_info(self,bsize=(32,32)): - #print 'set_button_info select tool' - self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'polyline_24px.png'),wx.BITMAP_TYPE_PNG) - self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'polyline_24px.png'),wx.BITMAP_TYPE_PNG) - + """ + def __init__(self, parent, mainframe=None): + self.init_common('add_polyline', parent, 'Add polyline tool', + info='Click on canvas to add a poly line. Add a vertex with a single click, double click to finish, right click to aboard.', + is_textbutton=False, + ) + self.init_options() + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'polyline_24px.png'), wx.BITMAP_TYPE_PNG) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'polyline_24px.png'), wx.BITMAP_TYPE_PNG) def on_left_down(self, event): if not self.is_animated: @@ -782,152 +752,152 @@ else: # add vertex return self.append_vert_to_anim(event) - - def begin_animation(self, event): - #print 'AddLineTool.begin_animation' + # print 'AddLineTool.begin_animation' #self.drawobj_anim, _id, self.ind_vert = self.get_current_vertexselection() - self.drawobj_anim = self._canvas.get_drawing().get_drawobj_by_ident('polylines') + self.drawobj_anim = self._canvas.get_drawing().get_drawobj_by_ident( + 'polylines') self.coord_last = self._canvas.unproject(event.GetPosition()) #vertices = [list(self.coord_last),list(self.coord_last) ] - vertices = [ 1.0*self.coord_last, 1.0*self.coord_last ]# attention, we need copies here!! - #print ' vertices ',vertices#,self.width.get_value(),self.color.get_value(), - + # attention, we need copies here!! + vertices = [1.0 * self.coord_last, 1.0 * self.coord_last] + # print ' vertices + # ',vertices#,self.width.get_value(),self.color.get_value(), + _id = self.drawobj_anim.add_drawobj(vertices, - self.width.get_value(),# width + self.width.get_value(), # width self.color.get_value(), - beginstyle = TRIANGLEHEAD, - endstyle = TRIANGLEHEAD, + beginstyle=TRIANGLEHEAD, + endstyle=TRIANGLEHEAD, ) - self.ind_vert = 1 + self.ind_vert = 1 self.drawobj_anim.begin_animation(_id) - - + # http://www.wxpython.org/docs/api/wx.Cursor-class.html self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_CROSS)) self.is_animated = True - + self.parent.refresh_optionspanel(self) - return True # True for redrawing - + return True # True for redrawing + def end_animation(self, event): - self.drawobj_anim.end_animation(is_del_last_vert = True) + self.drawobj_anim.end_animation(is_del_last_vert=True) # http://www.wxpython.org/docs/api/wx.Cursor-class.html self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) - - + del self.drawobj_anim #del self.id_anim self.is_animated = False self.parent.refresh_optionspanel(self) - return True # True for redrawing - + return True # True for redrawing + def append_vert_to_anim(self, event): self.coord_last = self._canvas.unproject(event.GetPosition()) - - self.ind_vert = self.drawobj_anim.append_vert_to_animation(self.coord_last) - + + self.ind_vert = self.drawobj_anim.append_vert_to_animation( + self.coord_last) + return True - + + class AddPolygonTool(AddPolylineTool): + """ Mixin for Selection tools for OGL canvas. - """ - def __init__(self,parent, mainframe=None): - self.init_common( 'add_polygon',parent,'Add polygon tool', - info = 'Click on canvas to add a polygon. Add a vertex with a single click, double click to finish, right click to aboard.', - is_textbutton = False, - ) + """ + + def __init__(self, parent, mainframe=None): + self.init_common('add_polygon', parent, 'Add polygon tool', + info='Click on canvas to add a polygon. Add a vertex with a single click, double click to finish, right click to aboard.', + is_textbutton=False, + ) self.init_options() - + def init_options(self): - self.add(cm.AttrConf( 'color', np.array([1.0,0.0,0.0,0.8], dtype=np.float32), - groupnames = ['options'], - perm='rw', - metatype = 'color', - name = 'Fill color', - is_save = True, - info = 'Line color with format [r,g,b,a]', - )) - - #self.add(cm.AttrConf( 'color_fill', np.array([1.0,0.0,0.0,0.8], dtype=np.float32), - # groupnames = ['options'], - # perm='rw', + self.add(cm.AttrConf('color', np.array([1.0, 0.0, 0.0, 0.8], dtype=np.float32), + groupnames=['options'], + perm='rw', + metatype='color', + name='Fill color', + is_save=True, + info='Line color with format [r,g,b,a]', + )) + + # self.add(cm.AttrConf( 'color_fill', np.array([1.0,0.0,0.0,0.8], dtype=np.float32), + # groupnames = ['options'], + # perm='rw', # metatype = 'color', # name = 'Fill color', # is_save = True, # info = 'Object fill color with format [r,g,b,a]', - # )) - - def set_button_info(self,bsize=(32,32)): - #print 'set_button_info select tool' - self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'polygon2_24px.png'),wx.BITMAP_TYPE_PNG) - self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'polygon2_24px.png'),wx.BITMAP_TYPE_PNG) - - + # )) + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'polygon2_24px.png'), wx.BITMAP_TYPE_PNG) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'polygon2_24px.png'), wx.BITMAP_TYPE_PNG) def begin_animation(self, event): - #print 'AddLineTool.begin_animation' + # print 'AddLineTool.begin_animation' #self.drawobj_anim, _id, self.ind_vert = self.get_current_vertexselection() - self.drawobj_anim = self._canvas.get_drawing().get_drawobj_by_ident('polygons') + self.drawobj_anim = self._canvas.get_drawing().get_drawobj_by_ident( + 'polygons') self.coord_last = self._canvas.unproject(event.GetPosition()) #vertices = [list(self.coord_last),list(self.coord_last) ] - vertices = [ 1.0*self.coord_last, 1.0*self.coord_last, ]# attention, we need copies here!! - #print ' vertices ',vertices#,self.width.get_value(),self.color.get_value(), - + # attention, we need copies here!! + vertices = [1.0 * self.coord_last, 1.0 * self.coord_last, ] + # print ' vertices + # ',vertices#,self.width.get_value(),self.color.get_value(), + _id = self.drawobj_anim.add_drawobj(vertices, - color = self.color.get_value(), + color=self.color.get_value(), ) - self.ind_vert = 1 + self.ind_vert = 1 self.drawobj_anim.begin_animation(_id) - - + # http://www.wxpython.org/docs/api/wx.Cursor-class.html self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_CROSS)) self.is_animated = True - + self.parent.refresh_optionspanel(self) - return True # True for redrawing - - + return True # True for redrawing - - - - class SelectTool(SelectToolMixin): + """ Selection tool for OGL canvas. - """ - - def __init__(self,parent, detectwidth = 0.1, detectpix = 5, mainframe=None): + """ + + def __init__(self, parent, detectwidth=0.1, detectpix=5, mainframe=None): """ To be overridden by specific tool. """ - self.init_common( 'select',parent,'Selection tool', - info = 'Select objects in cancvas', - is_textbutton = False, - ) - self._init_select(is_show_selected = True, detectwidth=detectwidth, detectpix = detectpix) - - - def set_button_info(self,bsize=(32,32)): - #print 'set_button_info select tool' Select_32px - + self.init_common('select', parent, 'Selection tool', + info='Select objects in cancvas', + is_textbutton=False, + ) + self._init_select(is_show_selected=True, + detectwidth=detectwidth, detectpix=detectpix) + + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' Select_32px + # wx.ART_INFORMATION - self._bitmap = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION,wx.ART_TOOLBAR) - self._bitmap_sel=wx.ArtProvider.GetBitmap(wx.ART_INFORMATION,wx.ART_TOOLBAR) - + self._bitmap = wx.ArtProvider.GetBitmap( + wx.ART_INFORMATION, wx.ART_TOOLBAR) + self._bitmap_sel = wx.ArtProvider.GetBitmap( + wx.ART_INFORMATION, wx.ART_TOOLBAR) + #self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'Cursor-Click-icon_24px.png'),wx.BITMAP_TYPE_PNG) - #self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'Cursor-Click-icon_24px.png'),wx.BITMAP_TYPE_PNG) - + # self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'Cursor-Click-icon_24px.png'),wx.BITMAP_TYPE_PNG) + #self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'selectIcon.bmp'),wx.BITMAP_TYPE_BMP) - #self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'selectIconSel.bmp'),wx.BITMAP_TYPE_BMP) - - + # self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'selectIconSel.bmp'),wx.BITMAP_TYPE_BMP) + def set_cursor(self): # http://www.wxpython.org/docs/api/wx.Cursor-class.html if self._canvas != None: @@ -938,58 +908,59 @@ This call by metacanvas signals that the tool has been deactivated and can now interact with metacanvas. """ - self.deactivate_select() + self.deactivate_select() self._is_active = False - - def activate(self,canvas = None): + + def activate(self, canvas=None): """ This call by metacanvas signals that the tool has been activated and can now interact with metacanvas. """ - self.activate_select(canvas) # calls also set_cursor + self.activate_select(canvas) # calls also set_cursor self._is_active = True def on_left_down(self, event): return self.on_left_down_select(event) - - + def aboard(self, event): - #print 'aboard',self.ident + # print 'aboard',self.ident return self.aboard_select(event) - + class ConfigureTool(SelectToolMixin): + """ Selection tool for OGL canvas. - """ - - def __init__(self,parent, detectwidth= 0.1, detectpix = 5, mainframe=None): + """ + + def __init__(self, parent, detectwidth=0.1, detectpix=5, mainframe=None): """ To be overridden by specific tool. """ - self.init_common( 'configure',parent,'Configure tool', - info = 'Drawing options.', - is_textbutton = False, - ) - - self._init_select(is_show_selected = False, detectwidth=detectwidth - ,detectpix = detectpix) - - #self.drawing = + self.init_common('configure', parent, 'Configure tool', + info='Drawing options.', + is_textbutton=False, + ) + + self._init_select(is_show_selected=False, + detectwidth=detectwidth, detectpix=detectpix) + + # self.drawing = #attrsman.add( cm.ObjConf( Nodes(self) ) ) - - #self.add_col(am.TabIdsArrayConf( 'drawobjects', - # groupnames = ['options'], + + # self.add_col(am.TabIdsArrayConf( 'drawobjects', + # groupnames = ['options'], # name = 'Object', # info = 'Selected Draw objects with id', # )) - - def set_button_info(self,bsize=(32,32)): - #print 'set_button_info select tool' - self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'gtk_configure_24px.png'),wx.BITMAP_TYPE_PNG) - self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'gtk_configure_24px.png'),wx.BITMAP_TYPE_PNG) - - + + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'gtk_configure_24px.png'), wx.BITMAP_TYPE_PNG) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'gtk_configure_24px.png'), wx.BITMAP_TYPE_PNG) + def set_cursor(self): # http://www.wxpython.org/docs/api/wx.Cursor-class.html if self._canvas != None: @@ -1000,212 +971,210 @@ This call by metacanvas signals that the tool has been deactivated and can now interact with metacanvas. """ - self.deactivate_select() + self.deactivate_select() self._is_active = False - - def activate(self,canvas = None): + + def activate(self, canvas=None): """ This call by metacanvas signals that the tool has been activated and can now interact with metacanvas. """ - self.activate_select(canvas) # calls also set_cursor + self.activate_select(canvas) # calls also set_cursor self._is_active = True def on_left_down(self, event): return self.on_left_down_select(event) - - + def aboard(self, event): - #print 'aboard',self.ident + # print 'aboard',self.ident return self.aboard_select(event) - + def set_objbrowser(self): self.parent.refresh_optionspanel(self) - + def get_optionspanel(self, parent): """ Return tool option widgets on given parent """ drawobj, _id = self.get_current_selection() - if drawobj==None: - # no current selection-> show options of whole drawing - size=(200,-1) - self._optionspanel = NaviPanel(parent, obj = self._canvas.get_drawing(), - attrconfigs=None, - #tables = None, - #table = None, id=None, ids=None, - groupnames = ['options'], - mainframe=self.parent.get_mainframe(), - #pos=wx.DefaultPosition, size=size, style = wx.MAXIMIZE_BOX|wx.RESIZE_BORDER, - func_apply = self.on_apply_option, - immediate_apply=False, panelstyle='default',#'instrumental' - standartbuttons=['apply','restore']) + if drawobj == None: + # no current selection-> show options of whole drawing + size = (200, -1) + self._optionspanel = NaviPanel(parent, obj=self._canvas.get_drawing(), + attrconfigs=None, + #tables = None, + # table = None, id=None, ids=None, + groupnames=['options'], + mainframe=self.parent.get_mainframe(), + #pos=wx.DefaultPosition, size=size, style = wx.MAXIMIZE_BOX|wx.RESIZE_BORDER, + func_apply=self.on_apply_option, + # 'instrumental' + immediate_apply=False, panelstyle='default', + standartbuttons=['apply', 'restore']) else: - # show option of currently selected drawobj - size=(200,-1) - self._optionspanel = ObjPanel(parent, obj = drawobj, - id = _id, - attrconfigs=None, - #tables = None, - #table = None, id=None, ids=None, - groupnames = ['options'], - func_change_obj=None, - show_groupnames=False, show_title=True, is_modal=False, - mainframe=self.parent.get_mainframe(), - pos=wx.DefaultPosition, size=size, style = wx.MAXIMIZE_BOX|wx.RESIZE_BORDER, - func_apply = self.on_apply_option, - immediate_apply=False, panelstyle='default',#'instrumental' - standartbuttons=['apply','restore']) - + # show option of currently selected drawobj + size = (200, -1) + self._optionspanel = ObjPanel(parent, obj=drawobj, + id=_id, + attrconfigs=None, + #tables = None, + # table = None, id=None, ids=None, + groupnames=['options'], + func_change_obj=None, + show_groupnames=False, show_title=True, is_modal=False, + mainframe=self.parent.get_mainframe(), + pos=wx.DefaultPosition, size=size, style=wx.MAXIMIZE_BOX | wx.RESIZE_BORDER, + func_apply=self.on_apply_option, + # 'instrumental' + immediate_apply=False, panelstyle='default', + standartbuttons=['apply', 'restore']) + return self._optionspanel def on_apply_option(self, drawobj, id, ids): - #print '\n\n\non_apply_option drawobj, id, ids',drawobj, id, ids + # print '\n\n\non_apply_option drawobj, id, ids',drawobj, id, ids drawing = self._canvas.get_drawing() - drawobjs = drawing.get_drawobjs(is_anim = True) - + drawobjs = drawing.get_drawobjs(is_anim=True) + if drawobj in drawobjs: drawobj._update_colorvbo() drawobj._update_vertexvbo() - + self._canvas.draw() - + + class HandleTool(SelectTool): + """ General tool to help select handles. - """ - - def __init__(self,parent, detectwidth=0.1, detectpix = 5, mainframe=None): + """ + + def __init__(self, parent, detectwidth=0.1, detectpix=5, mainframe=None): """ To be overridden by specific tool. """ - self.init_common( 'select_handles',parent,'Handle selection', - info = 'Select handles on cancvas', - is_textbutton = False, - ) - - self._init_select(detectwidth=detectwidth, detectpix = detectpix) - - - - - def _init_select(self, is_show_selected = True, detectwidth = 0.1, detectpix = 5): - - SelectTool._init_select(self,is_show_selected, detectwidth = detectwidth, detectpix = detectpix) - self.add_col(am.ArrayConf( 'inds_vertex',-1, - groupnames = ['options'],#['_private_'], #'options', - name = 'Vertex index', - info = 'Vertex index.', - )) - - def set_button_info(self,bsize=(32,32)): - #print 'set_button_info select tool' Select_32px - + self.init_common('select_handles', parent, 'Handle selection', + info='Select handles on cancvas', + is_textbutton=False, + ) + + self._init_select(detectwidth=detectwidth, detectpix=detectpix) + + def _init_select(self, is_show_selected=True, detectwidth=0.1, detectpix=5): + + SelectTool._init_select(self, is_show_selected, + detectwidth=detectwidth, detectpix=detectpix) + self.add_col(am.ArrayConf('inds_vertex', -1, + # ['_private_'], #'options', + groupnames=['options'], + name='Vertex index', + info='Vertex index.', + )) + + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' Select_32px + # wx.ART_INFORMATION - self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'Cursor-Click-icon_24px.png'),wx.BITMAP_TYPE_PNG) - self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'Cursor-Click-icon_24px.png'),wx.BITMAP_TYPE_PNG) - + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'Cursor-Click-icon_24px.png'), wx.BITMAP_TYPE_PNG) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'Cursor-Click-icon_24px.png'), wx.BITMAP_TYPE_PNG) + #self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'selectIcon.bmp'),wx.BITMAP_TYPE_BMP) - #self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'selectIconSel.bmp'),wx.BITMAP_TYPE_BMP) - + # self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'selectIconSel.bmp'),wx.BITMAP_TYPE_BMP) + def set_cursor(self): # http://www.wxpython.org/docs/api/wx.Cursor-class.html if self._canvas != None: self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_RIGHT_ARROW)) - - def get_current_vertexselection(self): - if len(self)>0: + if len(self) > 0: id_selected = self.get_ids()[self._idcounter] - (drawobj, _id) = self.drawobjects[id_selected] - ind_vertex = self.inds_vertex[id_selected] - return drawobj, _id, ind_vertex + (drawobj, _id) = self.drawobjects[id_selected] + ind_vertex = self.inds_vertex[id_selected] + return drawobj, _id, ind_vertex else: return None, -1, -1 - - def pick_all(self, event): """ Pick all objets with id and vertex index, that are near the pointer coordinates. """ - #print 'pick_all' - p = self._canvas.unproject_event(event) - + # print 'pick_all' + p = self._canvas.unproject_event(event) + if self.detectpix > 0: # detect pixel sensitivity is given # calculate detectwidth based on current resolution - self.detectwidth = self._canvas.get_resolution()*self.detectpix - + self.detectwidth = self._canvas.get_resolution() * self.detectpix + self._idcounter = 0 is_draw = False drawing = self._canvas.get_drawing() - #print ' ',drawing.get_drawobjs() - for drawobj in drawing.get_drawobjs(): - #print ' ',drawobj,drawobj.get_ident() + # print ' ',drawing.get_drawobjs() + for drawobj in drawing.get_drawobjs(): + # print ' ',drawobj,drawobj.get_ident() # experiment if drawobj.is_visible(): - handles = drawobj.pick_handle(p, detectwidth = self.detectwidth) - if len(handles)>0: - #print ' handles',drawobj.get_ident(),handles - for id_handle, ind_vertex in handles: - is_draw |= self.add_selection(drawobj,id_handle,ind_vertex, event) + handles = drawobj.pick_handle(p, detectwidth=self.detectwidth) + if len(handles) > 0: + # print ' handles',drawobj.get_ident(),handles + for id_handle, ind_vertex in handles: + is_draw |= self.add_selection( + drawobj, id_handle, ind_vertex, event) #is_draw |= self.select(drawobj,id_pick, event) - #break + # break return is_draw - - - - def add_selection(self,drawobj,id_handle,ind_vertex, event): + + def add_selection(self, drawobj, id_handle, ind_vertex, event): is_draw = False - drawobjid = self.drawobjects.convert_type(( drawobj, id_handle)) - ids_match = self.select_ids(self.drawobjects.value == drawobjid) - if len(ids_match)==0: - self.add_rows(1,drawobjects = [( drawobj, id_handle)], inds_vertex =[ind_vertex]) + drawobjid = self.drawobjects.convert_type((drawobj, id_handle)) + ids_match = self.select_ids(self.drawobjects.value == drawobjid) + if len(ids_match) == 0: + self.add_rows(1, drawobjects=[ + (drawobj, id_handle)], inds_vertex=[ind_vertex]) is_draw = True return is_draw - - - - - + + class DeleteTool(SelectTool): + """ Delete tool for OGL canvas. - """ - - def __init__(self,parent, detectwidth=0.1, detectpix = 5, mainframe=None): + """ + + def __init__(self, parent, detectwidth=0.1, detectpix=5, mainframe=None): """ To be overridden by specific tool. """ - self.init_common( 'delete',parent,'Delete tool', - info = 'Select and delete objects in canvas.', - is_textbutton = False, - ) - self._init_select(is_show_selected = True, detectwidth=detectwidth, detectpix=detectpix) - - - def set_button_info(self,bsize=(32,32)): - self._bitmap = wx.ArtProvider.GetBitmap(wx.ART_DELETE,wx.ART_TOOLBAR) - self._bitmap_sel=wx.ArtProvider.GetBitmap(wx.ART_DELETE,wx.ART_TOOLBAR) + self.init_common('delete', parent, 'Delete tool', + info='Select and delete objects in canvas.', + is_textbutton=False, + ) + self._init_select(is_show_selected=True, + detectwidth=detectwidth, detectpix=detectpix) + + def set_button_info(self, bsize=(32, 32)): + self._bitmap = wx.ArtProvider.GetBitmap(wx.ART_DELETE, wx.ART_TOOLBAR) + self._bitmap_sel = wx.ArtProvider.GetBitmap( + wx.ART_DELETE, wx.ART_TOOLBAR) - def set_cursor(self): # http://www.wxpython.org/docs/api/wx.Cursor-class.html if self._canvas != None: - #self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_RIGHT_ARROW)) + # self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_RIGHT_ARROW)) pass - - def on_execute_selection(self,event): + + def on_execute_selection(self, event): """ Definively execute operation on currently selected drawobjects. """ if self.is_tool_allowed_on_selection(): - drawobj, _id = self.get_current_selection() - - if drawobj!= None: + drawobj, _id = self.get_current_selection() + + if drawobj != None: drawobj.del_drawobj(_id) self.unselect_all() is_draw = True @@ -1214,40 +1183,41 @@ return is_draw else: return False - - def on_change_selection(self,event): + + def on_change_selection(self, event): """ Called after selection has been changed with SHIFT-click Do operation on currently selected drawobjects. """ return False - - + + class MoveTool(SelectTool): + """ Move tool for OGL canvas. - """ - - def __init__(self,parent, detectwidth=0.1, detectpix = 5, mainframe=None): + """ + + def __init__(self, parent, detectwidth=0.1, detectpix=5, mainframe=None): """ To be overridden by specific tool. """ self.drawobj_anim, self.id_anim = (None, -1) - - self.init_common( 'move',parent,'Move tool', - info = 'Select and drag objects in cancvas.', - is_textbutton = False, - ) - self._init_select(is_show_selected = True, detectwidth=detectwidth, detectpix = detectpix) - - - - - def set_button_info(self,bsize=(32,32)): - self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'arrow_cursor_drag_24px.png'),wx.BITMAP_TYPE_PNG) - self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'arrow_cursor_drag_24px.png'),wx.BITMAP_TYPE_PNG) - def activate(self,canvas = None): + self.init_common('move', parent, 'Move tool', + info='Select and drag objects in cancvas.', + is_textbutton=False, + ) + self._init_select(is_show_selected=True, + detectwidth=detectwidth, detectpix=detectpix) + + def set_button_info(self, bsize=(32, 32)): + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'arrow_cursor_drag_24px.png'), wx.BITMAP_TYPE_PNG) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'arrow_cursor_drag_24px.png'), wx.BITMAP_TYPE_PNG) + + def activate(self, canvas=None): """ This call by metacanvas signals that the tool has been activated and can now interact with metacanvas. @@ -1255,19 +1225,18 @@ self.activate_select(canvas) self.is_animated = False self._is_active = True - + def set_cursor(self): # http://www.wxpython.org/docs/api/wx.Cursor-class.html if self._canvas != None: - self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) - + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) def deactivate(self): """ This call by metacanvas signals that the tool has been deactivated and can now interact with metacanvas. """ - #self.deactivate_select() + # self.deactivate_select() #self.is_animated = False is_draw = self.aboard() self._canvas.deactivate_tool() @@ -1277,19 +1246,17 @@ def on_left_down(self, event): if self.is_animated: - return self.end_animation(event) + return self.end_animation(event) else: return self.on_left_down_select(event) - - - + def on_motion(self, event): if self.is_animated: return self.animate(event) else: return False - - def on_execute_selection(self,event): + + def on_execute_selection(self, event): """ Definively execute operation on currently selected drawobjects. """ @@ -1298,109 +1265,105 @@ return self.begin_animation(event) else: return self.end_animation(event) - + else: - return False - - - - def on_change_selection(self,event): + return False + + def on_change_selection(self, event): """ Called after selection has been changed with SHIFT-click Do operation on currently selected drawobjects. """ return False - + def begin_animation(self, event): - self.drawobj_anim, _id = self.get_current_selection() + self.drawobj_anim, _id = self.get_current_selection() #self.drawobj_anim, self.id_anim = drawobj.get_anim(_id) self.drawobj_anim.begin_animation(_id) - + # done in select method #self.coord_last = self._canvas.unproject(event.GetPosition()) - + # http://www.wxpython.org/docs/api/wx.Cursor-class.html self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_CROSS)) self.is_animated = True - return True # True for redrawing - + return True # True for redrawing + def end_animation(self, event): #drawobj, _id = self.get_current_selection() #drawobj.set_anim(_id, (self.drawobj_anim, self.id_anim)) self.drawobj_anim.end_animation() # http://www.wxpython.org/docs/api/wx.Cursor-class.html self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) - - + del self.drawobj_anim #del self.id_anim self.is_animated = False - + self.unselect_all() - return True # True for redrawing - - - - def animate(self,event): + return True # True for redrawing + + def animate(self, event): is_draw = False coords = self._canvas.unproject(event.GetPosition()) - vertex_delta = coords-self.coord_last - if np.any(np.abs(vertex_delta)>0): - is_draw = self.drawobj_anim.move_animation(coords, vertex_delta) + vertex_delta = coords - self.coord_last + if np.any(np.abs(vertex_delta) > 0): + is_draw = self.drawobj_anim.move_animation(coords, vertex_delta) if is_draw: self.coord_last = coords return is_draw - - def aboard(self, event = None): - #print 'aboard',self.ident - + + def aboard(self, event=None): + # print 'aboard',self.ident + is_draw = False if self.is_animated: self.drawobj_anim.del_animation() del self.drawobj_anim self.is_animated = False is_draw = True - + is_draw |= self.aboard_select(event) - return is_draw # True for redrawing - - + return is_draw # True for redrawing + + class StretchTool(HandleTool): + """ Stretch tool for OGL canvas. - """ - - def __init__(self,parent, detectwidth = 0.1, detectpix = 5, mainframe=None): + """ + + def __init__(self, parent, detectwidth=0.1, detectpix=5, mainframe=None): """ To be overridden by specific tool. """ self.drawobj_anim, self.id_anim = (None, -1) - - self.init_common( 'stretch',parent,'Stretch tool', - info = 'Select vertex and stretch objetc in cancvas.', - is_textbutton = False, - ) - - - self._init_select(is_show_selected = True, detectwidth = detectwidth, detectpix = detectpix) - - - - - def set_button_info(self,bsize=(32,32)): - #print 'set_button_info select tool' Select_32px - - self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'move_vertex_24px.png'),wx.BITMAP_TYPE_PNG) - self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'move_vertex_24px.png'),wx.BITMAP_TYPE_PNG) - + + self.init_common('stretch', parent, 'Stretch tool', + info='Select vertex and stretch objetc in cancvas.', + is_textbutton=False, + ) + + self._init_select(is_show_selected=True, + detectwidth=detectwidth, detectpix=detectpix) + + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' Select_32px + + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'move_vertex_24px.png'), wx.BITMAP_TYPE_PNG) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'move_vertex_24px.png'), wx.BITMAP_TYPE_PNG) + # self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'Cursor-Click-icon_24px.png'),wx.BITMAP_TYPE_PNG) # self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'Cursor-Click-icon_24px.png'),wx.BITMAP_TYPE_PNG) def set_cursor(self): # http://www.wxpython.org/docs/api/wx.Cursor-class.html if self._canvas != None: - self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) - def activate(self,canvas = None): + self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) + + def activate(self, canvas=None): """ This call by metacanvas signals that the tool has been activated and can now interact with metacanvas. @@ -1408,7 +1371,6 @@ self.activate_select(canvas) self.is_animated = False self._is_active = True - def deactivate(self): """ @@ -1420,27 +1382,25 @@ self._canvas = None self._is_active = False return is_draw - #self.deactivate_select() + # self.deactivate_select() #self.is_animated = False def on_left_down(self, event): if self.is_animated: - return self.end_animation(event) + return self.end_animation(event) else: # this call will set self.last_coord # and call self.on_execute_selection # in case a suitable object has been selected return self.on_left_down_select(event) - - - + def on_motion(self, event): if self.is_animated: return self.animate(event) else: return False - - def on_execute_selection(self,event): + + def on_execute_selection(self, event): """ Definively execute operation on currently selected drawobjects. """ @@ -1450,483 +1410,466 @@ else: return self.end_animation(event) else: - return False - - - - - def on_change_selection(self,event): + return False + + def on_change_selection(self, event): """ Called after selection has been changed with SHIFT-click Do operation on currently selected drawobjects. """ return False - def begin_animation(self, event): - #print 'Stretchtool.begin_animation' - self.drawobj_anim, _id, self.ind_vert = self.get_current_vertexselection() - - #print ' self.drawobj_anim, _id, self.ind_vert=',self.drawobj_anim, _id, self.ind_vert + # print 'Stretchtool.begin_animation' + self.drawobj_anim, _id, self.ind_vert = self.get_current_vertexselection() + + # print ' self.drawobj_anim, _id, self.ind_vert=',self.drawobj_anim, _id, self.ind_vert #self.drawobj_anim, self.id_anim = drawobj.get_anim(_id) self.drawobj_anim.begin_animation(_id) self.coord_last = self._canvas.unproject(event.GetPosition()) - + # http://www.wxpython.org/docs/api/wx.Cursor-class.html self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_CROSS)) self.is_animated = True - return True # True for redrawing - - + return True # True for redrawing + def end_animation(self, event): #drawobj, _id = self.get_current_selection() #drawobj.set_anim(_id, (self.drawobj_anim, self.id_anim)) self.drawobj_anim.end_animation() # http://www.wxpython.org/docs/api/wx.Cursor-class.html self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) - - + del self.drawobj_anim #del self.id_anim self.is_animated = False - + self.unselect_all() - return True # True for redrawing - - - - def animate(self,event): - #print 'animate' + return True # True for redrawing + + def animate(self, event): + # print 'animate' is_draw = False coords = self._canvas.unproject(event.GetPosition()) - vertex_delta = coords-self.coord_last - if np.any(np.abs(vertex_delta)>0): - is_draw = self.drawobj_anim.stretch_animation(coords, vertex_delta, self.ind_vert) + vertex_delta = coords - self.coord_last + if np.any(np.abs(vertex_delta) > 0): + is_draw = self.drawobj_anim.stretch_animation( + coords, vertex_delta, self.ind_vert) if is_draw: self.coord_last = coords return is_draw - - - - def aboard(self, event = None): - #print 'aboard',self.ident - + + def aboard(self, event=None): + # print 'aboard',self.ident + is_draw = False if self.is_animated: self.drawobj_anim.del_animation() del self.drawobj_anim self.is_animated = False is_draw = True - + is_draw |= self.aboard_select(event) - return is_draw # True for redrawing + return is_draw # True for redrawing + - class DrawobjMixin(am.ArrayObjman): - def init_common(self,ident,parent=None, name = None, - linewidth = 1, - is_parentobj = False, - is_outline = True, # show outline - is_fill = False, - is_fillable = True, - n_vert = 2, # number of vertex per draw object - c_highl=0.3,**kwargs): - - self._init_objman(ident, parent=parent, name = name,**kwargs) - + + def init_common(self, ident, parent=None, name=None, + linewidth=1, + is_parentobj=False, + is_outline=True, # show outline + is_fill=False, + is_fillable=True, + n_vert=2, # number of vertex per draw object + c_highl=0.3, **kwargs): + + self._init_objman(ident, parent=parent, name=name, **kwargs) + self._vbos = OrderedDict() - + self._n_vert = n_vert - + # ident of drawobject used for animations self._ident_drawobj_anim = 'anim_lines' - - self.add(am.AttrConf( 'color_anim', np.array([0.9,0.9,0.9,0.5], dtype=np.float32), - groupnames = ['_private_'], - perm='rw', - metatype = 'color', - name = 'Anim. color', - is_save = True, - info = 'Color of animated object(s) in [r,g,b,a]', - )) - + + self.add(am.AttrConf('color_anim', np.array([0.9, 0.9, 0.9, 0.5], dtype=np.float32), + groupnames=['_private_'], + perm='rw', + metatype='color', + name='Anim. color', + is_save=True, + info='Color of animated object(s) in [r,g,b,a]', + )) + # TODO: these 2 could be eliminated and replaced by function - #self._n_elem = 0# will be adjusted in update_vertexvbo + # self._n_elem = 0# will be adjusted in update_vertexvbo #self._n_elem_fill = 0# - - - self.add(cm.AttrConf( '_is_visible', True, - groupnames = ['options'], - perm='wr', - is_save = True, - is_plugin = False, - name = 'Visible?', - info = 'If True, object are visible, otherwise it is not drwan.', - )) - - + + self.add(cm.AttrConf('_is_visible', True, + groupnames=['options'], + perm='wr', + is_save=True, + is_plugin=False, + name='Visible?', + info='If True, object are visible, otherwise it is not drwan.', + )) + if is_fillable > 0: # objects can potentially be filled - self.add(cm.AttrConf( '_is_fill', is_fill, - groupnames = ['_private'], - perm='wr', - is_save = True, - is_plugin = False, - name = 'Fill', - info = 'If True, object are filled.', - )) - self.add(cm.AttrConf( '_is_outline', is_outline, - groupnames = ['_private'], - perm='rw', - is_save = True, - is_plugin = False, - name = 'Outline', - info = 'If True, outline of object is shown.', - )) - - self.add_col(am.ArrayConf( 'colors_fill', np.zeros(4, dtype=np.float32), - dtype=np.float32, - groupnames = ['options'], - perm='rw', - metatype = 'color', - name = 'Fill color', - is_save = True, - info = 'Object fill color with format [r,g,b,a]', - )) - - self.add_col(am.ArrayConf( 'colors_fill_highl', np.zeros(4, dtype=np.float32), - dtype=np.float32, - groupnames = ['_private'], - perm='rw', - metatype = 'color', - name = 'Fill color highl', - is_save = False, - info = 'Object fill color when highlighting with format [r,g,b,a]', - )) - + self.add(cm.AttrConf('_is_fill', is_fill, + groupnames=['_private'], + perm='wr', + is_save=True, + is_plugin=False, + name='Fill', + info='If True, object are filled.', + )) + self.add(cm.AttrConf('_is_outline', is_outline, + groupnames=['_private'], + perm='rw', + is_save=True, + is_plugin=False, + name='Outline', + info='If True, outline of object is shown.', + )) + + self.add_col(am.ArrayConf('colors_fill', np.zeros(4, dtype=np.float32), + dtype=np.float32, + groupnames=['options'], + perm='rw', + metatype='color', + name='Fill color', + is_save=True, + info='Object fill color with format [r,g,b,a]', + )) + + self.add_col(am.ArrayConf('colors_fill_highl', np.zeros(4, dtype=np.float32), + dtype=np.float32, + groupnames=['_private'], + perm='rw', + metatype='color', + name='Fill color highl', + is_save=False, + info='Object fill color when highlighting with format [r,g,b,a]', + )) + else: # no filling foreseen - self.add(cm.AttrConf( '_is_fill', False, - groupnames = ['_private'], - perm='r', - is_save = True, - is_plugin = False, - name = 'Filled', - info = 'If True, object is filled.', - )) - - self.add(cm.AttrConf( '_is_outline', True, - groupnames = ['_private'], - perm='r', - is_save = True, - is_plugin = False, - name = 'Outline', - info = 'If True, outline of object is shown.', - )) + self.add(cm.AttrConf('_is_fill', False, + groupnames=['_private'], + perm='r', + is_save=True, + is_plugin=False, + name='Filled', + info='If True, object is filled.', + )) + + self.add(cm.AttrConf('_is_outline', True, + groupnames=['_private'], + perm='r', + is_save=True, + is_plugin=False, + name='Outline', + info='If True, outline of object is shown.', + )) if is_outline: - self.add_col(am.ArrayConf( 'colors', np.zeros(4, dtype=np.float32), - dtype=np.float32, - groupnames = ['options'], - perm='rw', - metatype = 'color', - name = 'Color', - is_save = True, - info = 'Object Vertex color with format [r,g,b,a]', - )) - - self.add_col(am.ArrayConf( 'colors_highl', np.zeros(4, dtype=np.float32), - dtype=np.float32, - groupnames = ['_private'], - perm='rw', - metatype = 'color', - name = 'Color highl', - is_save = False, - info = 'Added object color when highlighting with format [r,g,b,a]', - )) - - self.add(cm.AttrConf( 'linewidth', linewidth, - groupnames = ['options'], - perm='wr', - is_save = True, - is_plugin = False, - name = 'Line width', - info = 'Line width in pixel', - )) - - #print 'init_common',self.format_ident(),self._is_fill.value,self._is_outline.value - - self.add(cm.AttrConf( 'c_highl', c_highl, - groupnames = ['_private'], - perm='wr', - is_save = True, - is_plugin = False, - name = 'Highl. const.', - info = 'Highlight constant takes values beteewn 0 and 1 and is the amount of brightness added for highlighting', - )) - - - - self.add_col(am.ArrayConf( 'are_highlighted', False, - dtype=np.bool, - groupnames = ['options'], - perm='rw', - name = 'highlighted', - is_save = False, - info = 'If true, object is highlighted', - )) - #self.add_col(am.ArrayConf( 'have_handles', False, + self.add_col(am.ArrayConf('colors', np.zeros(4, dtype=np.float32), + dtype=np.float32, + groupnames=['options'], + perm='rw', + metatype='color', + name='Color', + is_save=True, + info='Object Vertex color with format [r,g,b,a]', + )) + + self.add_col(am.ArrayConf('colors_highl', np.zeros(4, dtype=np.float32), + dtype=np.float32, + groupnames=['_private'], + perm='rw', + metatype='color', + name='Color highl', + is_save=False, + info='Added object color when highlighting with format [r,g,b,a]', + )) + + self.add(cm.AttrConf('linewidth', linewidth, + groupnames=['options'], + perm='wr', + is_save=True, + is_plugin=False, + name='Line width', + info='Line width in pixel', + )) + + # print + # 'init_common',self.format_ident(),self._is_fill.value,self._is_outline.value + + self.add(cm.AttrConf('c_highl', c_highl, + groupnames=['_private'], + perm='wr', + is_save=True, + is_plugin=False, + name='Highl. const.', + info='Highlight constant takes values beteewn 0 and 1 and is the amount of brightness added for highlighting', + )) + + self.add_col(am.ArrayConf('are_highlighted', False, + dtype=np.bool, + groupnames=['options'], + perm='rw', + name='highlighted', + is_save=False, + info='If true, object is highlighted', + )) + # self.add_col(am.ArrayConf( 'have_handles', False, # dtype=np.bool, - # groupnames = ['options'], - # perm='rw', + # groupnames = ['options'], + # perm='rw', # name = 'has handles', # is_save = False, # info = 'If true, object has handles', # )) - - - - if is_parentobj: - self.add_col(am.IdsArrayConf( 'ids_parent', parent, - is_save = True, - name = parent.format_ident()+'[ID]', - info = 'ID of '+parent.get_name()+' object.', - )) - - + + if is_parentobj: + self.add_col(am.IdsArrayConf('ids_parent', parent, + is_save=True, + name=parent.format_ident() + '[ID]', + info='ID of ' + + parent.get_name() + ' object.', + )) + def get_vertices_array(self): return self.vertices.value - - - + def get_vertices(self, ids): return self.vertices[ids] - - def set_vertices(self, ids, vertices, is_update = True): + + def set_vertices(self, ids, vertices, is_update=True): self.vertices[ids] = vertices if is_update: self._update_vertexvbo() - - def is_tool_allowed(self, tool, id_drawobj = -1): + + def is_tool_allowed(self, tool, id_drawobj=-1): """ Returns True if this tool can be applied to this drawobj. Optionally a particular drawobj can be specified with id_drawobj. """ # basic tools: - #tool.ident in 'configure','select_handles','delete','move','stretch' + #tool.ident in 'configure','select_handles','delete','move','stretch' return True - + def is_outline(self): - return self.is_outline.get_value() - + return self.is_outline.get_value() + def is_fill(self): return self._is_fill.get_value() - + def is_visible(self): return self._is_visible.value - + def set_visible(self, is_visible): self._is_visible.set_value(is_visible) - #print 'set_visible',self._is_visible.value - + # print 'set_visible',self._is_visible.value + def del_drawobj(self, _id, is_update=True): self.del_row(_id) if is_update: self._update_vertexvbo() self._update_colorvbo() - - + def begin_animation(self, id_target): - #print 'begin_animation',id_target - #print ' self.vertices.value',self.vertices.value - #print ' ids',self.get_ids() + # print 'begin_animation',id_target + # print ' self.vertices.value',self.vertices.value + # print ' ids',self.get_ids() self._id_target = id_target - self._drawobj_anim = self.parent.get_drawobj_by_ident(self._ident_drawobj_anim) - self.id_anim = self._drawobj_anim.add_drawobj( np.array(self.vertices[id_target]), - self.color_anim.value, - ) - #print 'begin_animation',self.ident,_id,self._drawobj_anim + self._drawobj_anim = self.parent.get_drawobj_by_ident( + self._ident_drawobj_anim) + self.id_anim = self._drawobj_anim.add_drawobj(np.array(self.vertices[id_target]), + self.color_anim.value, + ) + # print 'begin_animation',self.ident,_id,self._drawobj_anim return True - - def end_animation(self, is_del_last_vert = False): - #print 'end_animation',self.ident,self._id_target - #print ' verices =',self._drawobj_anim.vertices[self.id_anim] - self.set_vertices(self._id_target,self._drawobj_anim.get_vertices(self.id_anim))#.copy() + + def end_animation(self, is_del_last_vert=False): + # print 'end_animation',self.ident,self._id_target + # print ' verices =',self._drawobj_anim.vertices[self.id_anim] + self.set_vertices(self._id_target, self._drawobj_anim.get_vertices( + self.id_anim)) # .copy() self.del_animation() - #self._drawobj_anim.del_drawobj(self.id_anim) + # self._drawobj_anim.del_drawobj(self.id_anim) self._update_vertexvbo() self._update_colorvbo() return True - - def del_animation(self, is_del_main = False): - #print 'end_animation',self.ident,_id,self._drawobj_anim + + def del_animation(self, is_del_main=False): + # print 'end_animation',self.ident,_id,self._drawobj_anim self._drawobj_anim.del_drawobj(self.id_anim) self._drawobj_anim = None - + if is_del_main: self.del_drawobj(self._id_target) - + self.id_anim = -1 return True - + def move_animation(self, vertex, vertex_delta): - - - #if self.ident == 'polylines': + + # if self.ident == 'polylines': # print 'move_animation',self.ident,self._id_target, vertex_delta # print ' before self._drawobj_anim.vertices[self.id_anim]',self._drawobj_anim.vertices[self.id_anim] # ans = self._drawobj_anim.move(self.id_anim, vertex, vertex_delta) # print ' after self._drawobj_anim.vertices[self.id_anim]',self._drawobj_anim.vertices[self.id_anim] # return ans - #else: + # else: return self._drawobj_anim.move(self.id_anim, vertex, vertex_delta) - + def get_id_anim(self): - return self._id_target - + return self._id_target + def stretch_animation(self, vertex, vertex_delta, ind_vertex): - #print 'stretch',self.ident,_id - #print ' ',vertex,vertex_delta,ind_vertex - #if self.ident == 'polylines': + # print 'stretch',self.ident,_id + # print ' ',vertex,vertex_delta,ind_vertex + # if self.ident == 'polylines': # print 'stretch_animation',self.ident,self._id_target, ind_vertex, vertex_delta # print ' before self._drawobj_anim.vertices[self.id_anim]',self._drawobj_anim.vertices[self.id_anim] # ans = self._drawobj_anim.stretch(self.id_anim,vertex, vertex_delta, ind_vertex) # print ' after self._drawobj_anim.vertices[self.id_anim]',self._drawobj_anim.vertices[self.id_anim] # return ans - #else: - return self._drawobj_anim.stretch(self.id_anim,vertex, vertex_delta, ind_vertex) - + # else: + return self._drawobj_anim.stretch(self.id_anim, vertex, vertex_delta, ind_vertex) - - - def get_anim(self,_id): + def get_anim(self, _id): drawobj_anim = self.parent.get_drawobj_by_ident('anim_lines') - - id_anim = drawobj_anim.add_drawobj( np.array(self.vertices[_id]), - [0.9,0.9,0.9,0.5] - ) + + id_anim = drawobj_anim.add_drawobj(np.array(self.vertices[_id]), + [0.9, 0.9, 0.9, 0.5] + ) # print 'get_anim',self.ident,_id,self.vertices[_id] return drawobj_anim, id_anim - - - - + def set_anim(self, _id, drawobjelem_anim): - #print 'set_anim',self.ident,_id,drawobjelem_anim + # print 'set_anim',self.ident,_id,drawobjelem_anim (drawobj_anim, id_anim) = drawobjelem_anim - #print ' self.vertices[_id]=',self.vertices[_id] - #print ' drawobj_anim.vertices[id_anim]=',drawobj_anim.vertices[id_anim] - self.vertices[_id] = drawobj_anim.vertices[id_anim]#.copy() + # print ' self.vertices[_id]=',self.vertices[_id] + # print ' + # drawobj_anim.vertices[id_anim]=',drawobj_anim.vertices[id_anim] + self.vertices[_id] = drawobj_anim.vertices[id_anim] # .copy() drawobj_anim.del_drawobj(id_anim) self._update_vertexvbo() return True - + def move(self, _id, vertex, vertex_delta): - #print 'move',self.ident,_id, vertex_delta + # print 'move',self.ident,_id, vertex_delta self.vertices[_id] += vertex_delta - #print ' vertices[id_anim]=',self.vertices[_id] + # print ' vertices[id_anim]=',self.vertices[_id] self._update_vertexvbo() return True - - + def stretch(self, _id, vertex, vertex_delta, ind_vertex): - #print 'stretch',self.ident,_id,ind_vertex - #print ' vertex_delta',vertex_delta - #print ' before vertices[_id]=',self.vertices[_id] + # print 'stretch',self.ident,_id,ind_vertex + # print ' vertex_delta',vertex_delta + # print ' before vertices[_id]=',self.vertices[_id] self.vertices[_id][ind_vertex] += vertex_delta - #print ' after vertices[_id]=',self.vertices[_id] + # print ' after vertices[_id]=',self.vertices[_id] self._update_vertexvbo() return True - - def add_vbo(self,vbo): + + def add_vbo(self, vbo): self._vbos[vbo.get_ident()] = vbo - - def get_vbo(self,ident): + + def get_vbo(self, ident): return self._vbos[ident] - + def get_vbos(self): return self._vbos.values() - - def del_vbo (self,key): + + def del_vbo(self, key): del self._vbos[key] - + def get_n_vert(self): return self._n_vert - - + def _get_colors_highl(self, colors): - return np.clip(colors+self.c_highl.value*np.ones(colors.shape,float),0,1)-colors - - - def set_colors(self, ids, colors, colors_highl=None, is_update = True): + return np.clip(colors + self.c_highl.value * np.ones(colors.shape, float), 0, 1) - colors + + def set_colors(self, ids, colors, colors_highl=None, is_update=True): self.colors[ids] = colors - if colors_highl==None: - self.colors_highl[ids]=self._get_colors_highl(colors) + if colors_highl == None: + self.colors_highl[ids] = self._get_colors_highl(colors) else: - self.colors_highl[ids]=colors_highl + self.colors_highl[ids] = colors_highl if is_update: - self._update_colorvbo() - + self._update_colorvbo() + def _update_colorvbo(self): - n=len(self) + n = len(self) if n == 0: for _vbo in self.get_vbos(): _vbo.destroy() #n_vert = self.get_n_vert() - #print '_update_colorvbo fancyline' - + # print '_update_colorvbo fancyline' + if self._is_outline.value: - colors = self.colors.value + self.are_highlighted.value.reshape(n,1)*self.colors_highl.value + colors = self.colors.value + \ + self.are_highlighted.value.reshape( + n, 1) * self.colors_highl.value for _vbo in self.get_vbos(): if not _vbo.is_fill(): _vbo.update_colors(colors) - + if self._is_fill.value: - colors = self.colors_fill.value + self.are_highlighted.value.reshape(n,1)*self.colors_fill_highl.value + colors = self.colors_fill.value + \ + self.are_highlighted.value.reshape( + n, 1) * self.colors_fill_highl.value for _vbo in self.get_vbos(): if _vbo.is_fill(): _vbo.update_colors(colors) - + def draw(self, resolution=1.0): - #print 'draw n=',id(self),self.ident,len(self),self._is_visible.value - if len(self)==0: return + # print 'draw n=',id(self),self.ident,len(self),self._is_visible.value + if len(self) == 0: + return if self._is_visible.value: glLineWidth(self.linewidth.value) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glEnable(GL_BLEND) - + # main drawing glEnableClientState(GL_VERTEX_ARRAY) glEnableClientState(GL_COLOR_ARRAY) - - #print 'draw',self.format_ident(), self._is_fill.value, self._is_outline.value - + + # print 'draw',self.format_ident(), self._is_fill.value, + # self._is_outline.value + for _vbo in self.get_vbos(): _vbo.draw(resolution) - - + # draw handles glDisableClientState(GL_VERTEX_ARRAY) glDisableClientState(GL_COLOR_ARRAY) - - def highlight(self, ids, is_update = True): - #print 'highlight=',self._inds[ids] - if len(ids)>0: + + def highlight(self, ids, is_update=True): + # print 'highlight=',self._inds[ids] + if len(ids) > 0: self.are_highlighted.value[self._inds[ids]] = True is_draw = True else: - is_draw = False - + is_draw = False + if is_update: - self._update_colorvbo() - + self._update_colorvbo() + return is_draw - - def unhighlight(self, ids=None, is_update = True): - + + def unhighlight(self, ids=None, is_update=True): + if ids == None: if np.any(self.are_highlighted.value): - inds_highl = self._inds# np.flatnonzero(self.are_highlighted.value) - self.are_highlighted.value[:]= False + # np.flatnonzero(self.are_highlighted.value) + inds_highl = self._inds + self.are_highlighted.value[:] = False is_draw = True else: is_draw = False @@ -1937,193 +1880,181 @@ is_draw = True else: is_draw = False - - #print 'unhighlight' , inds_highl - #print ' self.are_highlighted.value',self.are_highlighted.value - + + # print 'unhighlight' , inds_highl + # print ' self.are_highlighted.value',self.are_highlighted.value + if is_update: self._update_colorvbo() return is_draw - + def pick_handle(self, coord): """ Retuns list [ id, ind_vert] when handle is near coord, otherwise [] - + """ return [] - - - + class Lines(DrawobjMixin): - def __init__(self,ident, parent, name = 'Lines', - is_parentobj = False, - n_vert =2, # 2 verts for line draw obj - c_highl=0.3, - linewidth=3, - **kwargs): - - self.init_common( ident,parent=parent, name = name, - linewidth = linewidth, - is_parentobj=is_parentobj, - n_vert = n_vert, - c_highl=c_highl, - is_fillable = False, - **kwargs) - + + def __init__(self, ident, parent, name='Lines', + is_parentobj=False, + n_vert=2, # 2 verts for line draw obj + c_highl=0.3, + linewidth=3, + **kwargs): + + self.init_common(ident, parent=parent, name=name, + linewidth=linewidth, + is_parentobj=is_parentobj, + n_vert=n_vert, + c_highl=c_highl, + is_fillable=False, + **kwargs) + # ident of drawobject used for animations # must be defined AFTER init_common self._ident_drawobj_anim = 'anim_lines' - - - - self.add_vbo(Vbo('line', GL_LINES, 2, objtype='outline'))# 2 verts for OGL line element - - self.add_col(am.ArrayConf( 'vertices', np.zeros((n_vert,3), dtype=np.float32), - dtype=np.float32, - groupnames = ['_private'], - perm='rw', - name = 'Vertex', - unit = 'm', - is_save = True, - info = 'Vertex coordinate vectors of points. Example with 2 vertex: [[[x11,y11,z11],[x12,y12,z12]],[[x21,y21,z21],[x22,y22,z122]],...]', - )) - - - + + # 2 verts for OGL line element + self.add_vbo(Vbo('line', GL_LINES, 2, objtype='outline')) + + self.add_col(am.ArrayConf('vertices', np.zeros((n_vert, 3), dtype=np.float32), + dtype=np.float32, + groupnames=['_private'], + perm='rw', + name='Vertex', + unit='m', + is_save=True, + info='Vertex coordinate vectors of points. Example with 2 vertex: [[[x11,y11,z11],[x12,y12,z12]],[[x21,y21,z21],[x22,y22,z122]],...]', + )) + def get_boundingbox(self): - if len(self)==0: + if len(self) == 0: return None - vv = self.get_vertices_array()#self.get_vertices.value + vv = self.get_vertices_array() # self.get_vertices.value # TODOD: can be done faster - return np.array([ [np.min(vv[:,:,0]),np.min(vv[:,:,1]),np.min(vv[:,:,2])], - [np.max(vv[:,:,0]),np.max(vv[:,:,1]),np.max(vv[:,:,2])] - ],float) - - def add_drawobj(self, vertices, color, color_highl = None, is_update = True): + return np.array([[np.min(vv[:, :, 0]), np.min(vv[:, :, 1]), np.min(vv[:, :, 2])], + [np.max(vv[:, :, 0]), np.max( + vv[:, :, 1]), np.max(vv[:, :, 2])] + ], float) + + def add_drawobj(self, vertices, color, color_highl=None, is_update=True): if color_highl == None: - colors_highl=self._get_colors_highl(np.array([color])) - - _id = self.add_row( vertices=vertices, - colors=color, - colors_highl = colors_highl[0], - ) + colors_highl = self._get_colors_highl(np.array([color])) + + _id = self.add_row(vertices=vertices, + colors=color, + colors_highl=colors_highl[0], + ) if is_update: self._update_vertexvbo() self._update_colorvbo() return _id - - - def add_drawobjs(self, vertices, colors, colors_highl = None, is_update = True): + + def add_drawobjs(self, vertices, colors, colors_highl=None, is_update=True): if colors_highl == None: - colors_highl=self._get_colors_highl(colors) - - ids = self.add_rows(len(vertices), - vertices=vertices, + colors_highl = self._get_colors_highl(colors) + + ids = self.add_rows(len(vertices), + vertices=vertices, colors=colors, - colors_highl = colors_highl, + colors_highl=colors_highl, ) if is_update: self._update_vertexvbo() self._update_colorvbo() return ids - - - + def _update_vertexvbo(self): - self.get_vbo('line').update_vertices(self.get_vertices_array().reshape((-1,6)),len(self)) - + self.get_vbo('line').update_vertices( + self.get_vertices_array().reshape((-1, 6)), len(self)) - def _make_handlevbo(self,x, y, resolution): - #print '_get_handlevbo' - #print ' x =\n',x - #print ' y =\n',y - dx = resolution* 5.0 - dy = resolution* 5.0 - z = np.zeros(x.shape,dtype=np.float32) - n= len(z) - hvertices = np.concatenate((x-dx,y-dy,z, x+dx,y-dy,z, x+dx,y+dy,z, x-dx,y+dy,z, ),1).reshape(-1,4,3) - #print ' hvertices =\n',hvertices - self._vertexvbo_handles = vbo.VBO(hvertices.reshape((-1,3))) - self._indexvbo_handles = vbo.VBO(np.arange(4*n,dtype=np.int32), target=GL_ELEMENT_ARRAY_BUFFER) - - colors = np.repeat(np.array([[0.9,0.8,0.7,0.5]],dtype=np.float32),n,0) - self._colorvbo_handles = vbo.VBO(colors[np.array(np.arange(0,n,1.0/4),int)]) - - - - def pick(self,p, detectwidth = 0.1): + def _make_handlevbo(self, x, y, resolution): + # print '_get_handlevbo' + # print ' x =\n',x + # print ' y =\n',y + dx = resolution * 5.0 + dy = resolution * 5.0 + z = np.zeros(x.shape, dtype=np.float32) + n = len(z) + hvertices = np.concatenate((x - dx, y - dy, z, x + dx, y - dy, z, + x + dx, y + dy, z, x - dx, y + dy, z, ), 1).reshape(-1, 4, 3) + # print ' hvertices =\n',hvertices + self._vertexvbo_handles = vbo.VBO(hvertices.reshape((-1, 3))) + self._indexvbo_handles = vbo.VBO( + np.arange(4 * n, dtype=np.int32), target=GL_ELEMENT_ARRAY_BUFFER) + + colors = np.repeat( + np.array([[0.9, 0.8, 0.7, 0.5]], dtype=np.float32), n, 0) + self._colorvbo_handles = vbo.VBO( + colors[np.array(np.arange(0, n, 1.0 / 4), int)]) + + def pick(self, p, detectwidth=0.1): """ Returns a binary vector which is True values for lines that have been selected by point p. - + In particular, an element of this vector is True if the minimum distance between the respective line to point p is less than detectwidth """ - #print 'pick',self.get_ident(),len(self) - if len(self)==0: - return np.array([],np.int) - + # print 'pick',self.get_ident(),len(self) + if len(self) == 0: + return np.array([], np.int) + vertices = self.get_vertices_array() - #print ' vertices',vertices - x1 = vertices[:,0,0] - y1 = vertices[:,0,1] - - x2 = vertices[:,1,0] - y2 = vertices[:,1,1] - - - return self._ids[get_dist_point_to_segs(p,x1,y1,x2,y2, is_ending=True) < detectwidth**2] + # print ' vertices',vertices + x1 = vertices[:, 0, 0] + y1 = vertices[:, 0, 1] - - def pick_handle(self, coord, detectwidth = 0.1): + x2 = vertices[:, 1, 0] + y2 = vertices[:, 1, 1] + + return self._ids[get_dist_point_to_segs(p, x1, y1, x2, y2, is_ending=True) < detectwidth**2] + + def pick_handle(self, coord, detectwidth=0.1): """ Retuns list [ id, ind_vert] when handle is near coord, otherwise [] - + """ - #print 'pick_handle',self.get_ident(),len(self) + # print 'pick_handle',self.get_ident(),len(self) dw = detectwidth**2 - - if len(self)==0: - return np.zeros((0,2),np.int) - - if self.ident not in [ 'lines','fancylines']: - return np.zeros((0,2),np.int) - - + + if len(self) == 0: + return np.zeros((0, 2), np.int) + + if self.ident not in ['lines', 'fancylines']: + return np.zeros((0, 2), np.int) + vertices = self.get_vertices_array() handles = [] - #print ' vertices',vertices - #print ' vertices.shape',vertices.shape - dx = vertices[:,0,0]-coord[0] - dy = vertices[:,0,1]-coord[1] - - ids = self._ids[dx*dx+dy*dy1: + # print ' polyline\n',polyline + + if n_seg > 1: polyvinds = range(n_seg) - #print ' polyvinds\n',polyvinds - vi = np.zeros( ( 2*n_seg-2),np.int32) - vi[0]=polyvinds[0] - vi[-1]=polyvinds[-1] - + # print ' polyvinds\n',polyvinds + vi = np.zeros((2 * n_seg - 2), np.int32) + vi[0] = polyvinds[0] + vi[-1] = polyvinds[-1] + # Important type conversion!! - v = np.zeros( ( 2*n_seg-2,3),np.float32) - v[0]=polyline[0] - v[-1]=polyline[-1] - if len(v)>2: - v[1:-1] = np.repeat(polyline[1:-1],2,0) - vi[1:-1] = np.repeat(polyvinds[1:-1],2) - - n_lines = len(v)/2 - #print ' v\n',v - inds_polyline = range(ind_line,ind_line+n_lines) - + v = np.zeros((2 * n_seg - 2, 3), np.float32) + v[0] = polyline[0] + v[-1] = polyline[-1] + if len(v) > 2: + v[1:-1] = np.repeat(polyline[1:-1], 2, 0) + vi[1:-1] = np.repeat(polyvinds[1:-1], 2) + + n_lines = len(v) / 2 + # print ' v\n',v + inds_polyline = range(ind_line, ind_line + n_lines) + polyinds[inds_polyline] = ind - + linebeginstyles[inds_polyline] = joinstyle linebeginstyles[inds_polyline[0]] = beginstyles[ind] - + lineendstyles[inds_polyline] = joinstyle lineendstyles[inds_polyline[-1]] = endstyles[ind] - - linevertices[inds_polyline] = v.reshape((-1,2,3)) - vertexinds[inds_polyline] = vi.reshape((-1,2)) - + + linevertices[inds_polyline] = v.reshape((-1, 2, 3)) + vertexinds[inds_polyline] = vi.reshape((-1, 2)) + ind_line += n_lines else: # empty polygon treatment pass - - - #print ' linevertex\n',linevertices - ind +=1 - + + # print ' linevertex\n',linevertices + ind += 1 + self._linevertices = linevertices self._polyinds = polyinds self._vertexinds = vertexinds - self._linebeginstyles = linebeginstyles + self._linebeginstyles = linebeginstyles self._lineendstyles = lineendstyles - - - - + def _update_vertexvbo(self): - #print '_update_vertexvbo',self.ident + # print '_update_vertexvbo',self.ident self._make_lines() vertices = self._linevertices - x1 = vertices[:,0,0] - y1 = vertices[:,0,1] - z1 = vertices[:,0,2] - - x2 = vertices[:,1,0] - y2 = vertices[:,1,1] - z2 = vertices[:,1,2] - dx = x2-x1 - dy = y2-y1 - alpha_xy=np.arctan2(dy,dx) - length_xy = np.sqrt(dx*dx + dy*dy) - halfwidth = 0.5*self.get_widths_array()[self._polyinds] - #if self.ident =='lanedraws': + x1 = vertices[:, 0, 0] + y1 = vertices[:, 0, 1] + z1 = vertices[:, 0, 2] + + x2 = vertices[:, 1, 0] + y2 = vertices[:, 1, 1] + z2 = vertices[:, 1, 2] + dx = x2 - x1 + dy = y2 - y1 + alpha_xy = np.arctan2(dy, dx) + length_xy = np.sqrt(dx * dx + dy * dy) + halfwidth = 0.5 * self.get_widths_array()[self._polyinds] + # if self.ident =='lanedraws': # print '_update_vertexvbo',self.ident # print ' halfwidth',halfwidth # print ' x1',x1 # print ' y1',y1 - + x1_new = x1.copy() y1_new = y1.copy() x2_new = x2.copy() y2_new = y2.copy() - #print ' origvert' - #print ' x1_new=',x1_new,x1_new.dtype - #print ' x2_new=',x2_new,x2_new.dtype + # print ' origvert' + # print ' x1_new=',x1_new,x1_new.dtype + # print ' x2_new=',x2_new,x2_new.dtype if self._is_fill.value: for style, id_style in LINEHEADS.iteritems(): - + # begin inds_style = np.flatnonzero(self._linebeginstyles == id_style) - - if len(inds_style)>0: - - #print ' style',style,len(inds_style) - #print ' x1_new=',x1_new,x1_new.dtype - #print ' x2_new=',x2_new,x2_new.dtype - self._update_vertexvbo_begin_fill(style, inds_style, x1_new, y1_new,z1,x2,y2,z2,length_xy, alpha_xy, halfwidth) - + + if len(inds_style) > 0: + + # print ' style',style,len(inds_style) + # print ' x1_new=',x1_new,x1_new.dtype + # print ' x2_new=',x2_new,x2_new.dtype + self._update_vertexvbo_begin_fill( + style, inds_style, x1_new, y1_new, z1, x2, y2, z2, length_xy, alpha_xy, halfwidth) + # end inds_style = np.flatnonzero(self._lineendstyles == id_style) - if len(inds_style)>0: - self._update_vertexvbo_end_fill(style,inds_style,x1,y1,z1,x2_new,y2_new,z2,length_xy, alpha_xy,halfwidth) + if len(inds_style) > 0: + self._update_vertexvbo_end_fill( + style, inds_style, x1, y1, z1, x2_new, y2_new, z2, length_xy, alpha_xy, halfwidth) + + self._update_vertexvbo_line_fill( + x1_new, y1_new, z1, x2_new, y2_new, z2, length_xy, alpha_xy, halfwidth, len(vertices)) - - self._update_vertexvbo_line_fill(x1_new,y1_new,z1,x2_new,y2_new,z2,length_xy, alpha_xy,halfwidth,len(vertices)) - def _update_colorvbo(self): n = len(self._polyinds) #n_vert = self.get_n_vert() - #print '_update_colorvbo fancyline' + # print '_update_colorvbo fancyline' #self._linecolors = np.array(linecolors, np.float32) #self._linecolors_highl = np.array(linecolors_highl, np.float32) if self._is_outline.value: - colors = self.colors.value[self._polyinds] + self.are_highlighted.value[self._polyinds].reshape(n,1)*self.colors_highl.value[self._polyinds] + colors = self.colors.value[self._polyinds] + self.are_highlighted.value[ + self._polyinds].reshape(n, 1) * self.colors_highl.value[self._polyinds] for _vbo in self.get_vbos(): if not _vbo.is_fill(): _vbo.update_colors(colors) - + if self._is_fill.value: - colors = self.colors_fill.value[self._polyinds] + self.are_highlighted.value[self._polyinds].reshape(n,1)*self.colors_fill_highl.value[self._polyinds] + colors = self.colors_fill.value[self._polyinds] + self.are_highlighted.value[ + self._polyinds].reshape(n, 1) * self.colors_fill_highl.value[self._polyinds] for _vbo in self.get_vbos(): if _vbo.is_fill(): _vbo.update_colors(colors) - - def pick(self,p, detectwidth = 0.1): + + def pick(self, p, detectwidth=0.1): """ Returns a binary vector which is True values for lines that have been selected by point p. - + In particular, an element of this vector is True if the minimum distance between the respective line to point p is less than detectwidth """ - #print 'pick' - if len(self)==0: - return np.array([],np.int) - + # print 'pick' + if len(self) == 0: + return np.array([], np.int) + vertices = self._linevertices - x1 = vertices[:,0,0] - y1 = vertices[:,0,1] - - x2 = vertices[:,1,0] - y2 = vertices[:,1,1] - - #print ' x1', x1 - #print ' x2', x2 - halfwidths = 0.5*(self.get_widths_array()[self._polyinds]+detectwidth) - return self._ids[self._polyinds[get_dist_point_to_segs(p,x1,y1,x2,y2, is_ending=True) < halfwidths*halfwidths]] - - - - def pick_handle(self, coord, detectwidth = 0.1): + x1 = vertices[:, 0, 0] + y1 = vertices[:, 0, 1] + + x2 = vertices[:, 1, 0] + y2 = vertices[:, 1, 1] + + # print ' x1', x1 + # print ' x2', x2 + halfwidths = 0.5 * (self.get_widths_array() + [self._polyinds] + detectwidth) + return self._ids[self._polyinds[get_dist_point_to_segs(p, x1, y1, x2, y2, is_ending=True) < halfwidths * halfwidths]] + + def pick_handle(self, coord, detectwidth=0.1): """ Retuns list [ id, ind_vert] when handle is near coord, otherwise [] - + """ - #print 'pick_handle',self.get_ident(),len(self) + # print 'pick_handle',self.get_ident(),len(self) dw = detectwidth**2 - - if len(self)==0: - return np.zeros((0,2),np.int) - - #if self.ident not in [ 'lines','fancylines','polylines']: + + if len(self) == 0: + return np.zeros((0, 2), np.int) + + # if self.ident not in [ 'lines','fancylines','polylines']: # return np.zeros((0,2),np.int) - - - vertices = self._linevertices#self.get_vertices_array() + + vertices = self._linevertices # self.get_vertices_array() handles = [] - #print ' vertices',vertices - #print ' vertices.shape',vertices.shape - dx = vertices[:,0,0]-coord[0] - dy = vertices[:,0,1]-coord[1] - inds = np.flatnonzero(dx*dx+dy*dy radii*radii-dw)&(r < radii*radii+dw) ] + dx = centers[:, 0] - coord[0] + dy = centers[:, 1] - coord[1] + r = dx * dx + dy * dy + ids = self._ids[(r > radii * radii - dw) & (r < radii * radii + dw)] #handles = np.concatenate(( ids.reshape((len(ids),1)), np.zeros((len(ids),1),np.int)),1) - - #print ' ids',ids - #print ' handles',handles - return np.concatenate(( ids.reshape((len(ids),1)), np.zeros((len(ids),1),np.int)),1) - - + # print ' ids',ids + # print ' handles',handles + return np.concatenate((ids.reshape((len(ids), 1)), np.zeros((len(ids), 1), np.int)), 1) + + class Polygons(DrawobjMixin): - def __init__(self,ident, parent, name = 'Polygons', **kwargs): - self.init_common( ident, parent = parent, name = name, - is_fill = False, - is_outline = True, # - **kwargs) + + def __init__(self, ident, parent, name='Polygons', **kwargs): + self.init_common(ident, parent=parent, name=name, + is_fill=False, + is_outline=True, + **kwargs) # ident of drawobject used for animations # must be defined AFTER init_common self._ident_drawobj_anim = 'anim_polygons' - + if self._is_outline: - self.add_vbo(Vbo('outline',GL_LINES,2,objtype='outline')) + self.add_vbo(Vbo('outline', GL_LINES, 2, objtype='outline')) if self._is_fill: - self.add_vbo(Vbo('fill',GL_TRIANGLES,3,objtype='fill')) - + self.add_vbo(Vbo('fill', GL_TRIANGLES, 3, objtype='fill')) - - self.delete('vertices') - self.add_col(am.ListArrayConf( 'vertices', - #None, - #dtype=np.object, - groupnames = ['_private'], - perm='rw', - name = 'Vertex', - unit = 'm', - is_save = True, - info = '3D coordinate list of Polygon Points.', - )) - + self.add_col(am.ListArrayConf('vertices', + # None, + # dtype=np.object, + groupnames=['_private'], + perm='rw', + name='Vertex', + unit='m', + is_save=True, + info='3D coordinate list of Polygon Points.', + )) + def add_drawobj(self, vertex, - color, color_fill = None, - color_highl = None, color_fill_highl = None, - is_update = True): - + color, color_fill=None, + color_highl=None, color_fill_highl=None, + is_update=True): + if color_fill == None: color_fill = color - + if color_highl == None: - color_highl=self._get_colors_highl(np.array([color]))[0] - + color_highl = self._get_colors_highl(np.array([color]))[0] + if color_fill_highl == None: - color_fill_highl=self._get_colors_highl(np.array([color_fill]))[0] - - _id = self.add_row( vertices = vertex, - colors=color, - colors_highl = color_highl, - colors_fill = color_fill, - colors_fill_highl = color_fill_highl, - ) + color_fill_highl = self._get_colors_highl( + np.array([color_fill]))[0] + + _id = self.add_row(vertices=vertex, + colors=color, + colors_highl=color_highl, + colors_fill=color_fill, + colors_fill_highl=color_fill_highl, + ) if is_update: self._update_vertexvbo() self._update_colorvbo() return _id - - - def add_drawobjs( self, vertices, - colors, colors_fill = None, - colors_highl = None, colors_fill_highl = None, - is_update = True): - + + def add_drawobjs(self, vertices, + colors, colors_fill=None, + colors_highl=None, colors_fill_highl=None, + is_update=True): + if colors_fill == None: colors_fill = colors - + if colors_highl == None: colors_highl = self._get_colors_highl(colors) - + if colors_fill_highl == None: colors_fill_highl = self._get_colors_highl(colors_fill) - - - ids = self.add_rows(len(vertices), - vertices = vertices, + ids = self.add_rows(len(vertices), + vertices=vertices, colors=colors, - colors_highl = colors_highl, - colors_fill = colors_fill, - colors_fill_highl = colors_fill_highl, + colors_highl=colors_highl, + colors_fill=colors_fill, + colors_fill_highl=colors_fill_highl, ) if is_update: self._update_vertexvbo() self._update_colorvbo() return ids - - + def begin_animation(self, id_target): - + self._id_target = id_target - self._drawobj_anim = self.parent.get_drawobj_by_ident(self._ident_drawobj_anim) - self.id_anim = self._drawobj_anim.add_drawobj( self.get_vertices(id_target), - self.color_anim.value, - ) - #print 'begin_animation',self.ident,_id,self._drawobj_anim + self._drawobj_anim = self.parent.get_drawobj_by_ident( + self._ident_drawobj_anim) + self.id_anim = self._drawobj_anim.add_drawobj(self.get_vertices(id_target), + self.color_anim.value, + ) + # print 'begin_animation',self.ident,_id,self._drawobj_anim return True - + def append_vert_to_animation(self, vert): - #print 'append_vert_to_animation',vert, type(vert) - #for _id in self.get_ids(): + # print 'append_vert_to_animation',vert, type(vert) + # for _id in self.get_ids(): # print ' main.vertices',_id,self.vertices[_id], type(self.vertices[_id]) - #for _id in self._drawobj_anim.get_ids(): - # print ' anim.vertices',_id,self._drawobj_anim.vertices[_id], type(self._drawobj_anim.vertices[_id]) - + # for _id in self._drawobj_anim.get_ids(): + # print ' anim.vertices',_id,self._drawobj_anim.vertices[_id], + # type(self._drawobj_anim.vertices[_id]) + self._drawobj_anim.get_vertices(self.id_anim).append(vert) - #print ' vertices',self._drawobj_anim.vertices[self.id_anim],type(self._drawobj_anim.vertices[self.id_anim]) + # print ' vertices',self._drawobj_anim.vertices[self.id_anim],type(self._drawobj_anim.vertices[self.id_anim]) #vertices = self._drawobj_anim.vertices[self.id_anim] - #vertices.append(vert) - #self._drawobj_anim.vertices[self.id_anim]= vertices#list(np.array(vertices,np.float32)) - - - #print ' vertices',vertices,type(vertices) - #print ' self._drawobj_anim.vertices[self.id_anim]',self._drawobj_anim.vertices[self.id_anim],type(self._drawobj_anim.vertices[self.id_anim]) + # vertices.append(vert) + # self._drawobj_anim.vertices[self.id_anim]= + # vertices#list(np.array(vertices,np.float32)) + + # print ' vertices',vertices,type(vertices) + # print ' + # self._drawobj_anim.vertices[self.id_anim]',self._drawobj_anim.vertices[self.id_anim],type(self._drawobj_anim.vertices[self.id_anim]) self._drawobj_anim._update_vertexvbo() self._drawobj_anim._update_colorvbo() - return len(self._drawobj_anim.get_vertices(self.id_anim))-1# vertex ind of next - - #def get_vertices_array(self): + # vertex ind of next + return len(self._drawobj_anim.get_vertices(self.id_anim)) - 1 + + # def get_vertices_array(self): # return self.vertices.value - + def _make_lines(self): n_lines_tot = 0 for polyline in self.get_vertices_array(): n_lines_tot += len(polyline) - - linevertices = np.zeros((n_lines_tot,2,3),np.float32) - vertexinds = np.zeros((n_lines_tot,2),np.int32) - - polyinds = np.zeros(n_lines_tot,np.int32) - linebeginstyles = np.zeros(n_lines_tot,np.int32) - lineendstyles = np.zeros(n_lines_tot,np.int32) - + + linevertices = np.zeros((n_lines_tot, 2, 3), np.float32) + vertexinds = np.zeros((n_lines_tot, 2), np.int32) + + polyinds = np.zeros(n_lines_tot, np.int32) + linebeginstyles = np.zeros(n_lines_tot, np.int32) + lineendstyles = np.zeros(n_lines_tot, np.int32) + ind = 0 ind_line = 0 - - - for polyline in self.get_vertices_array():#self.vertices.value: - #print ' =======' - - #print ' polyline\n',polyline + + for polyline in self.get_vertices_array(): # self.vertices.value: + # print ' =======' + + # print ' polyline\n',polyline polyvinds = range(len(polyline)) - #print ' polyvinds\n',polyvinds - vi = np.zeros( ( 2*len(polyline)),np.int32) - vi[0]=polyvinds[0] - vi[-2]=polyvinds[-2] - vi[-1]=polyvinds[-1] - #print ' vi\n',vi - + # print ' polyvinds\n',polyvinds + vi = np.zeros((2 * len(polyline)), np.int32) + vi[0] = polyvinds[0] + vi[-2] = polyvinds[-2] + vi[-1] = polyvinds[-1] + # print ' vi\n',vi + # Important type conversion!! - v = np.zeros( ( 2*len(polyline),3),np.float32) - v[0]=polyline[0] - v[-2]=polyline[-1] - v[-1]=polyline[0] - #print ' v\n',v - if len(v)>3: - v[1:-1] = np.repeat(polyline[1:],2,0) - vi[1:-1] = np.repeat(polyvinds[1:],2) - n_lines = len(v)/2 - #print ' v\n',v - inds_polyline = range(ind_line,ind_line+n_lines) - + v = np.zeros((2 * len(polyline), 3), np.float32) + v[0] = polyline[0] + v[-2] = polyline[-1] + v[-1] = polyline[0] + # print ' v\n',v + if len(v) > 3: + v[1:-1] = np.repeat(polyline[1:], 2, 0) + vi[1:-1] = np.repeat(polyvinds[1:], 2) + n_lines = len(v) / 2 + # print ' v\n',v + inds_polyline = range(ind_line, ind_line + n_lines) + polyinds[inds_polyline] = ind - linevertices[inds_polyline] = v.reshape((-1,2,3)) - vertexinds[inds_polyline] = vi.reshape((-1,2)) + linevertices[inds_polyline] = v.reshape((-1, 2, 3)) + vertexinds[inds_polyline] = vi.reshape((-1, 2)) ind_line += n_lines - ind +=1 - + ind += 1 + self._linevertices = linevertices self._vertexinds = vertexinds self._polyinds = polyinds - - - + def _update_vertexvbo(self): - #print '_update_vertexvbo',self.format_ident() + # print '_update_vertexvbo',self.format_ident() self._make_lines() if self._is_outline.value: - #print ' linevertices.reshape((-1,6))',self._linevertices.reshape((-1,6)),len(self._linevertices) - self.get_vbo('outline').update_vertices(self._linevertices.reshape((-1,6)),len(self._linevertices)) + # print ' + # linevertices.reshape((-1,6))',self._linevertices.reshape((-1,6)),len(self._linevertices) + self.get_vbo('outline').update_vertices( + self._linevertices.reshape((-1, 6)), len(self._linevertices)) #self._update_vertexvbo_line_fill(x1_new,y1_new,z1,x2_new,y2_new,z2,length_xy, alpha_xy,halfwidth,len(vertices)) - - #if self._is_fill.value: + + # if self._is_fill.value: # self._update_vertexvbo_line_fill(x1_new,y1_new,z1,x2_new,y2_new,z2,length_xy, alpha_xy,halfwidth,len(vertices)) - + def _update_colorvbo(self): n = len(self._polyinds) #n_vert = self.get_n_vert() - #print 'Polygons._update_colorvbo',self.ident,n - #print ' colors',self.colors.value - #print ' are_highlighted',self.are_highlighted.value + # print 'Polygons._update_colorvbo',self.ident,n + # print ' colors',self.colors.value + # print ' are_highlighted',self.are_highlighted.value #self._linecolors = np.array(linecolors, np.float32) #self._linecolors_highl = np.array(linecolors_highl, np.float32) - if (self._is_outline.value)&(n>0): - colors = self.colors.value[self._polyinds] + self.are_highlighted.value[self._polyinds].reshape(n,1)*self.colors_highl.value[self._polyinds] + if (self._is_outline.value) & (n > 0): + colors = self.colors.value[self._polyinds] + self.are_highlighted.value[ + self._polyinds].reshape(n, 1) * self.colors_highl.value[self._polyinds] self.get_vbo('outline').update_colors(colors) - - #if self._is_fill.value: + + # if self._is_fill.value: # colors = self.colors_fill.value[self._polyinds] + self.are_highlighted.value[self._polyinds].reshape(n,1)*self.colors_fill_highl.value[self._polyinds] # self.get_vbo('fill').update_colors(colors) - - def pick(self,p, detectwidth = 0.1): + + def pick(self, p, detectwidth=0.1): """ Returns a binary vector which is True values for lines that have been selected by point p. - + In particular, an element of this vector is True if the minimum distance between the respective line to point p is less than detectwidth """ - if len(self)==0: - return np.array([],np.int) - + if len(self) == 0: + return np.array([], np.int) + vertices = self._linevertices - x1 = vertices[:,0,0] - y1 = vertices[:,0,1] - - x2 = vertices[:,1,0] - y2 = vertices[:,1,1] - - - return self._ids[self._polyinds[get_dist_point_to_segs(p,x1,y1,x2,y2, is_ending=True) < detectwidth*detectwidth]] - - def pick_handle(self, coord, detectwidth = 0.1): + x1 = vertices[:, 0, 0] + y1 = vertices[:, 0, 1] + + x2 = vertices[:, 1, 0] + y2 = vertices[:, 1, 1] + + return self._ids[self._polyinds[get_dist_point_to_segs(p, x1, y1, x2, y2, is_ending=True) < detectwidth * detectwidth]] + + def pick_handle(self, coord, detectwidth=0.1): """ Retuns list [ id, ind_vert] when handle is near coord, otherwise [] - + """ - #print 'pick_handle',self.get_ident(),len(self),detectwidth - dw = detectwidth **2#np.sqrt(detectwidth) - - if len(self)==0: - return np.zeros((0,2),np.int) - - #if self.ident not in [ 'lines','fancylines','polylines']: + # print 'pick_handle',self.get_ident(),len(self),detectwidth + dw = detectwidth ** 2 # np.sqrt(detectwidth) + + if len(self) == 0: + return np.zeros((0, 2), np.int) + + # if self.ident not in [ 'lines','fancylines','polylines']: # return np.zeros((0,2),np.int) - - - vertices = self._linevertices#self.get_vertices_array() + + vertices = self._linevertices # self.get_vertices_array() handles = [] - #print ' vertices',vertices - #print ' vertices.shape',vertices.shape - dx = vertices[:,0,0]-coord[0] - dy = vertices[:,0,1]-coord[1] - inds = np.flatnonzero(dx*dx+dy*dy dy: - return dx/self.g_Width + return dx / self.g_Width else: - return dy/self.g_Height - - def zoom_tofit(self, event = None, is_draw = True): - #print 'zoom_tofit',is_draw - #p = self._canvas.unproject_event(event) + return dy / self.g_Height + + def zoom_tofit(self, event=None, is_draw=True): + # print 'zoom_tofit',is_draw + #p = self._canvas.unproject_event(event) #vetrex = np.array([p[0], p[1], 0.0, 1.0],float) #p_screen = self._canvas.project(vetrex) - #print 'SelectTool.on_left_down (px,py)=',p - #print ' (x,y)=',event.GetPosition(),p_screen + # print 'SelectTool.on_left_down (px,py)=',p + # print ' (x,y)=',event.GetPosition(),p_screen self.resetView() - + vv_min, vv_max = self.get_boundingbox() - dv = vv_max- vv_min - - #print 'vv_min',vv_min - #print 'vv_max',vv_max - + dv = vv_max - vv_min + + # print 'vv_min',vv_min + # print 'vv_max',vv_max + p_min = self.project(vv_min) p_max = self.project(vv_max) - - #print 'p_min',p_min - #print 'p_max',p_max - - dp = np.abs(np.array(p_max-p_min, float)) - - #print ' dp',dp,dp==np.nan,np.nan + + # print 'p_min',p_min + # print 'p_max',p_max + + dp = np.abs(np.array(p_max - p_min, float)) + + # print ' dp',dp,dp==np.nan,np.nan if np.isnan(np.sum(dp)): return - + window = np.array([self.g_Width, self.g_Height], float) - zoomfactor = 0.8*np.min(window/dp[:2]) - - #print ' zoomfactor,zoom',zoomfactor,self.zoom - + zoomfactor = 0.8 * np.min(window / dp[:2]) + + # print ' zoomfactor,zoom',zoomfactor,self.zoom + self.zoom /= zoomfactor - #print ' zoomfactor',zoomfactor,self.zoom - + # print ' zoomfactor',zoomfactor,self.zoom + self.draw() #vv_min, vv_max = self.get_boundingbox() - + # lowerleft corner - vv_target = self.unproject((0.0, self.g_Height)) - - #print ' vv_min',vv_min - #print ' vv_target',vv_target - #print ' trans',self.trans - dv = 0.9*vv_target-vv_min - - #print ' dv',dv + vv_target = self.unproject((0.0, self.g_Height)) + + # print ' vv_min',vv_min + # print ' vv_target',vv_target + # print ' trans',self.trans + dv = 0.9 * vv_target - vv_min + + # print ' dv',dv newtrans = np.array(self.trans) + dv[:2] self.trans = tuple(newtrans) - #print ' trans',self.trans + # print ' trans',self.trans self.draw() - - def get_boundingbox(self): + + def get_boundingbox(self): drawing = self.get_drawing() - vv_min = np.inf * np.ones((1,3),float) - vv_max = -np.inf * np.ones((1,3),float) + vv_min = np.inf * np.ones((1, 3), float) + vv_max = -np.inf * np.ones((1, 3), float) if drawing: - for drawobj in drawing.get_drawobjs(): + for drawobj in drawing.get_drawobjs(): bb = drawobj.get_boundingbox() if bb != None: - v_min, v_max= bb - #print ' v_min',v_min - #print ' v_max',v_max - vv_min = np.concatenate((vv_min,v_min.reshape(1,3)),0) - vv_max = np.concatenate((vv_max,v_max.reshape(1,3)),0) - #print ' vv_min',vv_min - #print ' vv_max',vv_max - vv_min = np.min(vv_min,0) - vv_max = np.max(vv_max,0) + v_min, v_max = bb + # print ' v_min',v_min + # print ' v_max',v_max + vv_min = np.concatenate((vv_min, v_min.reshape(1, 3)), 0) + vv_max = np.concatenate((vv_max, v_max.reshape(1, 3)), 0) + # print ' vv_min',vv_min + # print ' vv_max',vv_max + vv_min = np.min(vv_min, 0) + vv_max = np.max(vv_max, 0) return vv_min, vv_max - - def zoom_in(self, event = None, is_draw = True): + + def zoom_in(self, event=None, is_draw=True): self.zoom *= 0.9 if is_draw: self.draw() - - def zoom_out(self, event = None, is_draw = True): + + def zoom_out(self, event=None, is_draw=True): self.zoom *= 1.1 if is_draw: self.draw() - - def OnLeftDown(self, event, is_draw = False): - if (event.ControlDown()&event.ShiftDown())&(self.action == ''): - self.action = 'drag' - self.BeginGrap(event) - event.Skip() - + + def OnLeftDown(self, event, is_draw=False): + if (event.ControlDown() & event.ShiftDown()) & (self.action == ''): + self.action = 'drag' + self.BeginGrap(event) + event.Skip() + elif self._tool != None: is_draw = self._tool.on_left_down(event) - - if is_draw: + + if is_draw: self.draw() - event.Skip() - - def OnLeftDclick(self, event, is_draw = False): + event.Skip() + + def OnLeftDclick(self, event, is_draw=False): if self._tool != None: is_draw = self._tool.on_left_dclick(event) - - if is_draw: + + if is_draw: self.draw() - event.Skip() - - def OnLeftUp(self, event, is_draw = False): - - if self.action=='drag': - self.EndGrap(event) - self.action=='' - event.Skip() - + event.Skip() + + def OnLeftUp(self, event, is_draw=False): + + if self.action == 'drag': + self.EndGrap(event) + self.action == '' + event.Skip() + elif self._tool != None: is_draw = self._tool.on_left_up(event) - - if is_draw: + + if is_draw: self.draw() event.Skip() - - def OnRightDown(self, event, is_draw = False): + + def OnRightDown(self, event, is_draw=False): if self._tool != None: is_draw = self._tool.on_right_down(event) - - if is_draw: + + if is_draw: self.draw() - event.Skip() - - def OnRightUp(self, event, is_draw = False): - + event.Skip() + + def OnRightUp(self, event, is_draw=False): + if self._tool != None: is_draw = self._tool.on_right_up(event) - - if is_draw: + + if is_draw: self.draw() event.Skip() - + def OnMotion(self, event, is_draw=False): - #print 'OnMotion',event.GetPosition() + # print 'OnMotion',event.GetPosition() self.GetParent().display_coords(self.unproject_event(event)) - - if (event.ControlDown()&event.ShiftDown()&(self.action=='drag')): - self.MoveGrap(event) - is_draw |= True - event.Skip() - - elif (self.action=='drag'): - self.EndGrap(event) - is_draw |= True - self.action=='' - event.Skip() - + + if (event.ControlDown() & event.ShiftDown() & (self.action == 'drag')): + self.MoveGrap(event) + is_draw |= True + event.Skip() + + elif (self.action == 'drag'): + self.EndGrap(event) + is_draw |= True + self.action == '' + event.Skip() + elif self._tool != None: is_draw |= self._tool.on_motion(event) - + if is_draw: self.draw() - - - def BeginGrap(self,event): + def BeginGrap(self, event): # http://www.wxpython.org/docs/api/wx.Cursor-class.html self._cursor_last = self.GetCursor() self.SetCursor(wx.StockCursor(wx.CURSOR_HAND)) - self.pos_start = event.GetPosition() + self.pos_start = event.GetPosition() self.trans_start = self.trans - #print 'BeginGrap',self.trans - - def MoveGrap(self,event): - + # print 'BeginGrap',self.trans + + def MoveGrap(self, event): + x, y = self.unproject(event.GetPosition())[0:2] - x0,y0 = self.unproject(self.pos_start)[0:2] - - self.trans = (self.trans_start[0] + (x-x0), self.trans_start[1] + (y-y0)) - #print 'MoveGrap',self.trans, x,y + x0, y0 = self.unproject(self.pos_start)[0:2] + + self.trans = (self.trans_start[0] + (x - x0), + self.trans_start[1] + (y - y0)) + # print 'MoveGrap',self.trans, x,y - - def EndGrap(self, event): - #print 'EndGrap' + # print 'EndGrap' self.SetCursor(self._cursor_last) - self.action='' - - - + self.action = '' # # wxPython Window Handlers def processEraseBackgroundEvent(self, event): """Process the erase background event.""" - pass # Do nothing, to avoid flashing on MSWin + pass # Do nothing, to avoid flashing on MSWin - def OnSize(self, event = None, win = None): + def OnSize(self, event=None, win=None): """Process the resize event.""" if self.GetContext(): # Make sure the frame is shown before calling SetCurrent. @@ -4322,7 +4184,8 @@ size = self.GetClientSize() self.OnReshape(size.width, size.height) self.Refresh(False) - if event:event.Skip() + if event: + event.Skip() def processPaintEvent(self, event): """Process the drawing event.""" @@ -4342,12 +4205,11 @@ def OnInitGL(self): """Initialize OpenGL for use in the window.""" glClearColor(0, 0, 0, 1) - - + def set_color_background(self, color): glClearColor(color[0], color[1], color[2], color[3]) self.draw() - + def OnReshape(self, width, height): """Reshape the OpenGL viewport based on the dimensions of the window.""" #global g_Width, g_Height @@ -4357,94 +4219,95 @@ def draw(self, *args, **kwargs): """Draw the window.""" - #print 'OGLCanvas.draw id(self._drawing)',id(self._drawing) + # print 'OGLCanvas.draw id(self._drawing)',id(self._drawing) # Clear frame buffer and depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # Set up viewing transformation, looking down -Z axis glLoadIdentity() - gluLookAt(self.eyex, self.eyey, self.eyez, self.centerx,self.centery, self.centerz, self.upx, self.upy, self.upz) #-.1,0,0 - + gluLookAt(self.eyex, self.eyey, self.eyez, self.centerx, self.centery, + self.centerz, self.upx, self.upy, self.upz) # -.1,0,0 # Set perspective (also zoom) glMatrixMode(GL_PROJECTION) glLoadIdentity() # the window corner OpenGL coordinates are (-+1, -+1) glOrtho(-1, 1, 1, -1, -1, 1) - - aspect = float(self.g_Width)/float(self.g_Height) + + aspect = float(self.g_Width) / float(self.g_Height) gluPerspective(self.zoom, aspect, self.g_nearPlane, self.g_farPlane) glMatrixMode(GL_MODELVIEW) self.polarView() - + # resolution in GL unit per scren pixel resolution = self.get_resolution() - #print ' get_resolution',resolution - + # print ' get_resolution',resolution + # draw actual scene if self._drawing: - #self._drawing.print_attrs() - for drawobj in self._drawing.get_drawobjs(is_anim = True): + # self._drawing.print_attrs() + for drawobj in self._drawing.get_drawobjs(is_anim=True): #checkobj = self._drawing.get_drawobj_by_ident(drawobj.ident) - #if checkobj!= None: + # if checkobj!= None: # print '\n draw.drawobj',drawobj.ident, checkobj.ident - #else: - # print '\n draw.drawobj',drawobj.ident, checkobj,self._drawing.has_drawobj_with_ident(drawobj.ident) + # else: + # print '\n draw.drawobj',drawobj.ident, + # checkobj,self._drawing.has_drawobj_with_ident(drawobj.ident) drawobj.draw(resolution) - self.SwapBuffers() - + def polarView(self): - glTranslatef( self.trans[1], 0.0, 0.0 ) - glTranslatef( 0.0, -self.trans[0], 0.0) - - glRotatef( -self.zRotate, 0.0, 0.0, 1.0) - glRotatef( -self.xRotate, 1.0, 0.0, 0.0) - glRotatef( -self.yRotate, 0.0, 1.0, 0.0) - + glTranslatef(self.trans[1], 0.0, 0.0) + glTranslatef(0.0, -self.trans[0], 0.0) + + glRotatef(-self.zRotate, 0.0, 0.0, 1.0) + glRotatef(-self.xRotate, 1.0, 0.0, 0.0) + glRotatef(-self.yRotate, 0.0, 1.0, 0.0) + def get_intersection(self, v_near, v_far): - # 150918 + # 150918 # idea from http://www.bfilipek.com/2012/06/select-mouse-opengl.html # https://en.wikipedia.org/wiki/Line%E2%80%93plane_intersection d = -v_near + v_far - - t = -v_near[2]/d[2] - v_inter = v_near+t*d - + + t = -v_near[2] / d[2] + v_inter = v_near + t * d + return v_inter - - def unproject_event(self, event): + + def unproject_event(self, event): return self.unproject(event.GetPosition())[0:2] - + def unproject(self, pos_display): """Get the world coordinates for viewCoordinate for the event """ - + x = pos_display[0] - y = self.g_Height-pos_display[1] - + y = self.g_Height - pos_display[1] + modelviewmatrix = glGetDoublev(GL_MODELVIEW_MATRIX) projectionmatrix = glGetDoublev(GL_PROJECTION_MATRIX) viewport = glGetInteger(GL_VIEWPORT) - + z = 0.0 worldCoordinate_near = np.array(gluUnProject( - x,y,z, + x, y, z, modelviewmatrix, projectionmatrix, - viewport,),dtype=np.float32) - - z=1.0 + viewport,), dtype=np.float32) + + z = 1.0 worldCoordinate_far = np.array(gluUnProject( - x,y,z, + x, y, z, modelviewmatrix, projectionmatrix, - viewport,),dtype=np.float32) - - v_inter = self.get_intersection(worldCoordinate_near,worldCoordinate_far) + viewport,), dtype=np.float32) + + v_inter = self.get_intersection( + worldCoordinate_near, worldCoordinate_far) return v_inter - + def project(self, vertex): """ http://stackoverflow.com/questions/3792481/how-to-get-screen-coordinates-from-a-3d-point-opengl @@ -4452,408 +4315,401 @@ modelviewmatrix = glGetDoublev(GL_MODELVIEW_MATRIX) projectionmatrix = glGetDoublev(GL_PROJECTION_MATRIX) viewport = glGetInteger(GL_VIEWPORT) - - coords = np.array(gluProject( vertex[0], vertex[1], vertex[2], - modelviewmatrix, projectionmatrix, - viewport)) - - coords[1]= self.g_Height - coords[1] - #print 'project',coords - - return coords - + + coords = np.array(gluProject(vertex[0], vertex[1], vertex[2], + modelviewmatrix, projectionmatrix, + viewport)) + + coords[1] = self.g_Height - coords[1] + # print 'project',coords + + return coords + + class OGLcanvasTools(ToolsPanel): + """ Shows a toolpallet with different tools and an options panel. Here tools are added which """ + def __init__(self, parent): - ToolsPanel.__init__(self, parent, n_buttoncolumns = 3, size =wx.DefaultSize ) - + ToolsPanel.__init__(self, parent, n_buttoncolumns=3, + size=wx.DefaultSize) + # add ainitial tool self.add_initial_tool(SelectTool(self)) - - - #self.add_tool(HandleTool(self)) - self.add_tool(StretchTool(self)) + + # self.add_tool(HandleTool(self)) + self.add_tool(StretchTool(self)) self.add_tool(MoveTool(self)) - + self.add_tool(AddLineTool(self)) self.add_tool(AddCircleTool(self)) self.add_tool(AddPolylineTool(self)) self.add_tool(AddPolygonTool(self)) - + self.add_tool(DeleteTool(self)) - - self.add_tool(ConfigureTool(self)) + + self.add_tool(ConfigureTool(self)) # more tools can be added later... - - + class OGleditor(wx.Panel): - - def __init__(self,parent, - mainframe = None, - size = wx.DefaultSize, - is_menu=False, # create menu items - Debug = 0, - ): - + + def __init__(self, parent, + mainframe=None, + size=wx.DefaultSize, + is_menu=False, # create menu items + Debug=0, + ): + self._drawing = None - + # if drawing!= None:.... - self.prefix_anim = 'anim_' + self.prefix_anim = 'anim_' self.layer_anim = 1000.0 - - - wx.Panel.__init__(self, parent, wx.ID_ANY,size = size) - sizer=wx.BoxSizer(wx.HORIZONTAL) - - - self._mainframe=mainframe - + + wx.Panel.__init__(self, parent, wx.ID_ANY, size=size) + sizer = wx.BoxSizer(wx.HORIZONTAL) + + self._mainframe = mainframe + # initialize GL canvas navcanvas = OGLnavcanvas(self, mainframe) #self._canvas = OGLcanvas(self) - self._canvas = navcanvas.get_canvas() - + self._canvas = navcanvas.get_canvas() + # compose tool pallet here - self._toolspanel = OGLcanvasTools(self) - - - + self._toolspanel = OGLcanvasTools(self) + # compose editor window - + # works but toolpanel changes size!!! - #sizer.Add(self._toolspanel,0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4)# from NaviPanelTest - #sizer.Add(navcanvas,1,wx.GROW) - - sizer.Add(self._toolspanel,0,wx.EXPAND) - sizer.Add(navcanvas,1,wx.EXPAND) - + # sizer.Add(self._toolspanel,0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4)# from NaviPanelTest + # sizer.Add(navcanvas,1,wx.GROW) + + sizer.Add(self._toolspanel, 0, wx.EXPAND) + sizer.Add(navcanvas, 1, wx.EXPAND) + # navbar - #sizer.Add(self._canvas,1,wx.GROW)# - #sizer.Add(self._navbar,0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4)# from NaviPanelTest - + #sizer.Add(self._canvas,1,wx.GROW)# + # sizer.Add(self._navbar,0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4)# from + # NaviPanelTest - # finish panel setup self.SetSizer(sizer) - #sizer.Fit(self) - #self.Layout() - + # sizer.Fit(self) + # self.Layout() + # no use: #wx.EVT_SIZE(self, self.on_size) - + def get_canvas(self): # DEPRICATED: canvas should not be needed outside netwdit # this is used mainly by the tools to know on which canvas to operate on # if multiple canvas, use the one with focus return self._canvas - + def draw(self): - + self._canvas.draw() # in the future there can be the same drawing on multiple canvases - - + def get_toolbox(self): return self._toolspanel - + def set_drawing(self, drawing): - #self._toolspanel.reset_initial_tool() + # self._toolspanel.reset_initial_tool() # here ad some additional drawing objects for animation - #self.add_drawobjs_anim(drawing) + # self.add_drawobjs_anim(drawing) self._drawing = drawing self._canvas.set_drawing(drawing) self._toolspanel.reset_initial_tool() - - #wx.CallAfter(self._canvas.zoom_tofit) - + + # wx.CallAfter(self._canvas.zoom_tofit) + def get_drawing(self): - return self._drawing#self._canvas.get_drawing() - - def add_drawobjs_anim(self,drawing = None): - - if drawing==None: + return self._drawing # self._canvas.get_drawing() + + def add_drawobjs_anim(self, drawing=None): + + if drawing == None: drawing = self._drawing - drawobjs_anim = [ Lines(self.prefix_anim+'lines', drawing, - linewidth = 1), - - Fancylines( self.prefix_anim+'fancylines', drawing, - is_lefthalf = True, - is_righthalf = True, - linewidth = 1, - ), - - Lines(self.prefix_anim+'lines', drawing, - linewidth = 1), - - Polylines( self.prefix_anim+'polylines', drawing, - joinstyle = FLATHEAD, - is_lefthalf = True, - is_righthalf = True, - linewidth = 1, - ), - - Polygons(self.prefix_anim+'polygons', drawing, - linewidth = 1), - - Circles(self.prefix_anim+'circles', drawing, - is_fill = False, # Fill objects, - is_outline = True, # show outlines - linewidth = 1, - ), - ] - + drawobjs_anim = [Lines(self.prefix_anim + 'lines', drawing, + linewidth=1), + + Fancylines(self.prefix_anim + 'fancylines', drawing, + is_lefthalf=True, + is_righthalf=True, + linewidth=1, + ), + + Lines(self.prefix_anim + 'lines', drawing, + linewidth=1), + + Polylines(self.prefix_anim + 'polylines', drawing, + joinstyle=FLATHEAD, + is_lefthalf=True, + is_righthalf=True, + linewidth=1, + ), + + Polygons(self.prefix_anim + 'polygons', drawing, + linewidth=1), + + Circles(self.prefix_anim + 'circles', drawing, + is_fill=False, # Fill objects, + is_outline=True, # show outlines + linewidth=1, + ), + ] + for drawobj in drawobjs_anim: - drawing.add_drawobj(drawobj, layer = self.layer_anim) - + drawing.add_drawobj(drawobj, layer=self.layer_anim) + def get_mainframe(self): - # this is used mainly by the tools to know on which mainframe to operate on + # this is used mainly by the tools to know on which mainframe to + # operate on return self._mainframe - - def on_size(self,event=None): - #print 'on_size',self._toolspanel.GetSize() - #self._toolspanel.SetSize((300,-1)) - #self.tc.SetSize(self.GetSize()) - #self.tc.SetSize(self.GetSize()) - #self._viewtabs.SetSize(self.GetSize()) - #pass + + def on_size(self, event=None): + # print 'on_size',self._toolspanel.GetSize() + # self._toolspanel.SetSize((300,-1)) + # self.tc.SetSize(self.GetSize()) + # self.tc.SetSize(self.GetSize()) + # self._viewtabs.SetSize(self.GetSize()) + # pass #wx.LayoutAlgorithm().LayoutWindow(self, self.p1) #wx.LayoutAlgorithm().LayoutWindow(self, self.p1) - + # important: #wx.LayoutAlgorithm().LayoutWindow(self, self._toolspanel) - + if event: event.Skip() - -if __name__ == '__main__': - ############################################################################### - ## MAIN FRAME - from mainframe import AgileToolbarFrameMixin +if __name__ == '__main__': + ########################################################################## + # MAIN FRAME + + from mainframe import AgileToolbarFrameMixin + class OGLeditorMainframe(AgileToolbarFrameMixin, wx.Frame): + """ Simple wx frame with some special features. """ - - + def __init__(self, title, pos=wx.DefaultPosition, - size=(1000,500), style=wx.DEFAULT_FRAME_STYLE, + size=(1000, 500), style=wx.DEFAULT_FRAME_STYLE, name='frame'): - - + # Forcing a specific style on the window. # Should this include styles passed? style = wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE - wx.Frame.__init__(self, None, wx.NewId(), title, pos, size = size, style = style, name = name) + wx.Frame.__init__(self, None, wx.NewId(), title, + pos, size=size, style=style, name=name) self.gleditor = OGleditor(self) - - self.Show()# must be here , before putting stuff on canvas - + + self.Show() # must be here , before putting stuff on canvas + ################################################################# - #create the menu bar - - self.menubar=AgileMenubar(self) + # create the menu bar + + self.menubar = AgileMenubar(self) self.make_menu() - #self.menubar.append_menu('tools') + # self.menubar.append_menu('tools') self.SetMenuBar(self.menubar) self.on_test() - - def make_menu(self, event = None): + + def make_menu(self, event=None): self.menubar.append_menu('file') - #self.menubar.append_item('file/test',self.on_test,\ + # self.menubar.append_item('file/test',self.on_test,\ # shortkey='Ctrl+t',info='Draw test objects') - - - - - def on_test(self,event=None): + def on_test(self, event=None): print '\non_test' vertices = np.array([ - [[0.0,0.0,0.0],[0.2,0.0,0.0]],# 0 green - [[0.0,0.0,0.0],[0.0,0.9,0.0]],# 1 red - ]) - - - colors =np.array( [ - [0.0,0.9,0.0,0.9], # 0 - [0.9,0.0,0.0,0.9], # 1 - ]) - - colors2 =np.array( [ - [0.5,0.9,0.5,0.5], # 0 - [0.9,0.5,0.9,0.5], # 1 - ]) - colors2o =np.array( [ - [0.8,0.9,0.8,0.9], # 0 - [0.9,0.8,0.9,0.9], # 1 - ]) - - - + [[0.0, 0.0, 0.0], [0.2, 0.0, 0.0]], # 0 green + [[0.0, 0.0, 0.0], [0.0, 0.9, 0.0]], # 1 red + ]) + + colors = np.array([ + [0.0, 0.9, 0.0, 0.9], # 0 + [0.9, 0.0, 0.0, 0.9], # 1 + ]) + + colors2 = np.array([ + [0.5, 0.9, 0.5, 0.5], # 0 + [0.9, 0.5, 0.9, 0.5], # 1 + ]) + colors2o = np.array([ + [0.8, 0.9, 0.8, 0.9], # 0 + [0.9, 0.8, 0.9, 0.9], # 1 + ]) + drawing = OGLdrawing() -#------------------------------------------------------------------------------- - +#------------------------------------------------------------------------- + if 1: lines = Lines('lines', drawing) - lines.add_drawobjs(vertices,colors) + lines.add_drawobjs(vertices, colors) drawing.add_drawobj(lines) -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------- if 1: - fancylines = Fancylines( 'fancylines', drawing, - arrowstretch = 1.0, - is_lefthalf = True, - is_righthalf = True - ) - - colors_fancy =np.array( [ - [0.0,0.9,0.0,0.9], # 0 + fancylines = Fancylines('fancylines', drawing, + arrowstretch=1.0, + is_lefthalf=True, + is_righthalf=True + ) + + colors_fancy = np.array([ + [0.0, 0.9, 0.0, 0.9], # 0 #[0.9,0.0,0.0,0.9], # 1 - ]) + ]) vertices_fancy = np.array([ - [[0.0,-1.0,0.0],[2,-1.0,0.0]],# 0 green + [[0.0, -1.0, 0.0], [2, -1.0, 0.0]], # 0 green #[[0.0,-1.0,0.0],[0.0,-5.0,0.0]],# 1 red - ]) - - widths = [ 0.5, - #0.3, - ] - #print ' vertices_fancy\n',vertices_fancy + ]) + + widths = [0.5, + # 0.3, + ] + # print ' vertices_fancy\n',vertices_fancy # FLATHEAD = 0 #BEVELHEAD = 1 - #TRIANGLEHEAD = 2 - #ARROWHEAD = 3 - fancylines.add_drawobjs( vertices_fancy, - widths,# width - colors_fancy, - beginstyles = [TRIANGLEHEAD,], - endstyles = [TRIANGLEHEAD,], - ) - drawing.add_drawobj(fancylines, layer = 10) -#------------------------------------------------------------------------------- - if 1: - polylines = Polylines( 'polylines', drawing, - joinstyle = FLATHEAD, - arrowstretch = 1.0, - is_lefthalf = True, - is_righthalf = True + #TRIANGLEHEAD = 2 + #ARROWHEAD = 3 + fancylines.add_drawobjs(vertices_fancy, + widths, # width + colors_fancy, + beginstyles=[TRIANGLEHEAD, ], + endstyles=[TRIANGLEHEAD, ], ) - colors_poly =np.array( [ - [0.0,0.8,0.5,0.9], # 0 - [0.8,0.0,0.5,0.9], # 1 - ]) - + drawing.add_drawobj(fancylines, layer=10) +#------------------------------------------------------------------------- + if 1: + polylines = Polylines('polylines', drawing, + joinstyle=FLATHEAD, + arrowstretch=1.0, + is_lefthalf=True, + is_righthalf=True + ) + colors_poly = np.array([ + [0.0, 0.8, 0.5, 0.9], # 0 + [0.8, 0.0, 0.5, 0.9], # 1 + ]) + vertices_poly = np.array([ - [[0.0,2.0,0.0],[5.0,2.0,0.0],[5.0,7.0,0.0],[10.0,7.0,0.0]],# 0 green - [[0.0,-2.0,0.0],[-2.0,-2.0,0.0]],# 1 red - ], np.object) - - widths = [ 0.5, - 0.3, - ] - #print ' vertices_poly\n',vertices_poly - polylines.add_drawobjs( vertices_poly, - widths,# width - colors_poly, - beginstyles = [TRIANGLEHEAD,TRIANGLEHEAD], - endstyles = [TRIANGLEHEAD,TRIANGLEHEAD]) - drawing.add_drawobj(polylines, layer = -2) - -#------------------------------------------------------------------------------- + [[0.0, 2.0, 0.0], [5.0, 2.0, 0.0], [ + 5.0, 7.0, 0.0], [10.0, 7.0, 0.0]], # 0 green + [[0.0, -2.0, 0.0], [-2.0, -2.0, 0.0]], # 1 red + ], np.object) + + widths = [0.5, + 0.3, + ] + # print ' vertices_poly\n',vertices_poly + polylines.add_drawobjs(vertices_poly, + widths, # width + colors_poly, + beginstyles=[ + TRIANGLEHEAD, TRIANGLEHEAD], + endstyles=[TRIANGLEHEAD, TRIANGLEHEAD]) + drawing.add_drawobj(polylines, layer=-2) + +#------------------------------------------------------------------------- if 1: - polygons = Polygons('polygons', drawing,linewidth = 5) - colors_poly =np.array( [ - [0.0,0.9,0.9,0.9], # 0 - [0.8,0.2,0.2,0.9], # 1 - ]) - + polygons = Polygons('polygons', drawing, linewidth=5) + colors_poly = np.array([ + [0.0, 0.9, 0.9, 0.9], # 0 + [0.8, 0.2, 0.2, 0.9], # 1 + ]) + vertices_poly = [ - [[0.0,2.0,0.0],[5.0,2.0,0.0],[5.0,7.0,0.0],],# 0 green - [[0.0,-2.0,0.0],[-2.0,-2.0,0.0],[-2.0,0.0,0.0]],# 1 red - ] - - print ' vertices_polygon\n',vertices_poly - polygons.add_drawobjs( vertices_poly, - colors_poly) - polygons.add_drawobj( [[5.0,-2.0,0.0],[3.0,-2.0,0.0],[3.0,0.0,0.0]], - [0.8,0.2,0.8,0.9]) + [[0.0, 2.0, 0.0], [5.0, 2.0, 0.0], + [5.0, 7.0, 0.0], ], # 0 green + [[0.0, -2.0, 0.0], [-2.0, -2.0, 0.0], + [-2.0, 0.0, 0.0]], # 1 red + ] + + print ' vertices_polygon\n', vertices_poly + polygons.add_drawobjs(vertices_poly, + colors_poly) + polygons.add_drawobj([[5.0, -2.0, 0.0], [3.0, -2.0, 0.0], [3.0, 0.0, 0.0]], + [0.8, 0.2, 0.8, 0.9]) drawing.add_drawobj(polygons) - - -#------------------------------------------------------------------------------- - + + +#------------------------------------------------------------------------- + if 1: - circles = Circles('circles', drawing, - is_fill = False, # Fill objects, - is_outline = True, # show outlines - ) - circles.add_drawobjs([[0.0,0.0,0.0],[1.0,0.5,0.0]],[0.5, 0.25],colors2o, colors2) + circles = Circles('circles', drawing, + is_fill=False, # Fill objects, + is_outline=True, # show outlines + ) + circles.add_drawobjs([[0.0, 0.0, 0.0], [1.0, 0.5, 0.0]], [ + 0.5, 0.25], colors2o, colors2) drawing.add_drawobj(circles) - - - #drawing.add_drawobj(testogl.triangles) - #drawing.add_drawobj(testogl.rectangles) -#------------------------------------------------------------------------------- - + + # drawing.add_drawobj(testogl.triangles) + # drawing.add_drawobj(testogl.rectangles) +#------------------------------------------------------------------------- + #canvas = self.gleditor.get_canvas() - #canvas.set_drawing(drawing) - - + # canvas.set_drawing(drawing) + #lines.add_drawobj([[0.0,0.0,0.0],[-0.2,-0.8,0.0]], [0.0,0.9,0.9,0.9]) #circles.add_drawobj([1.5,0.0,0.0],0.6,colors2o[0], colors2[0]) - - - #canvas.zoom_tofit() - #wx.CallAfter(canvas.zoom_tofit) + + # canvas.zoom_tofit() + # wx.CallAfter(canvas.zoom_tofit) self.gleditor.add_drawobjs_anim(drawing) self.gleditor.set_drawing(drawing) if event: - event.Skip() - + event.Skip() + def get_objbrowser(self): return self._objbrowser - + class OGLeditorApp(wx.App): + def OnInit(self): # wx.InitAllImageHandlers() self.mainframe = OGLeditorMainframe("OGLeditor") #sumopyicon = wx.Icon(os.path.join(IMAGEDIR,'icon_sumopy.png'),wx.BITMAP_TYPE_PNG, 16,16) - #wx.Frame.SetIcon(self.mainframe,sumopyicon) - #self.mainframe.SetIcon(sumopyicon) - + # wx.Frame.SetIcon(self.mainframe,sumopyicon) + # self.mainframe.SetIcon(sumopyicon) - #if True: #len(sys.argv)>=2: + # if True: #len(sys.argv)>=2: # from lib.net import readNet # filepath = '/home/joerg/projects/sumopy/bologna/bologna4.net.xml'#sys.argv[1] # _net = readNet(filepath) - #else: + # else: # _net = None - - + self.SetTopWindow(self.mainframe) return True - + ########################################################################### # MAINLOOP - - if len(sys.argv)==3: + + if len(sys.argv) == 3: ident = sys.argv[1] dirpath = sys.argv[2] else: - ident = None + ident = None dirpath = None app = OGLeditorApp(0) - - if 0:#len(noplugins)>0: - _msg = """The following plugins could not be plugged in:\n\n """+ noplugins[:-2]+\ - """\n\nIf you like to use these plugins, please check messages on console for Import errors and install the required packages. - """ - dlg = wx.MessageDialog(None, _msg, "Warning from Plugins", wx.OK | wx.ICON_WARNING) + + if 0: # len(noplugins)>0: + _msg = """The following plugins could not be plugged in:\n\n """ + noplugins[:-2] +\ + """\n\nIf you like to use these plugins, please check messages on console for Import errors and install the required packages. + """ + dlg = wx.MessageDialog( + None, _msg, "Warning from Plugins", wx.OK | wx.ICON_WARNING) dlg.ShowModal() dlg.Destroy() - + app.MainLoop() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/processdialog.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/processdialog.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/processdialog.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/processdialog.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,85 +1,86 @@ import wx import objpanel + + class ProcessDialog(objpanel.ObjPanelDialog): - def __init__(self, parent, - process, - attrconfigs=None, - tables = None, - table = None, id=None, ids=None, - groupnames = None, show_groupnames = False, - title = None, size = wx.DefaultSize, pos = wx.DefaultPosition,\ - style = wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.RESIZE_BORDER, - choose_id=False,choose_attr=False, - func_choose_id=None,func_change_obj=None,panelstyle = 'default', - immediate_apply = True): - + + def __init__(self, parent, + process, + attrconfigs=None, + tables=None, + table=None, id=None, ids=None, + groupnames=None, show_groupnames=False, + title=None, size=wx.DefaultSize, pos=wx.DefaultPosition, + style=wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.RESIZE_BORDER, + choose_id=False, choose_attr=False, + func_choose_id=None, func_change_obj=None, panelstyle='default', + immediate_apply=True): + self.process = process if title == None: title = process.get_name() - + buttons, defaultbutton, standartbuttons = self._get_buttons() - - - objpanel.ObjPanelDialog.__init__( self, parent, process, - attrconfigs=None, - id=None, ids=None, - groupnames = ['options','inputparameters'], - show_groupnames = False, - title = title, size = (800,400), pos = wx.DefaultPosition,\ - style = wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.RESIZE_BORDER, - choose_id=False,choose_attr=False, - func_choose_id=None, - func_change_obj=None, - panelstyle = 'default', - immediate_apply = immediate_apply, - buttons = buttons, - standartbuttons = standartbuttons, - defaultbutton = defaultbutton, - ) + + objpanel.ObjPanelDialog.__init__(self, parent, process, + attrconfigs=None, + id=None, ids=None, + groupnames=['options', + 'inputparameters'], + show_groupnames=False, + title=title, size=(800, 400), pos=wx.DefaultPosition, + style=wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.RESIZE_BORDER, + choose_id=False, choose_attr=False, + func_choose_id=None, + func_change_obj=None, + panelstyle='default', + immediate_apply=immediate_apply, + buttons=buttons, + standartbuttons=standartbuttons, + defaultbutton=defaultbutton, + ) + def _get_buttons(self): - buttons=[ ('Run', self.on_run, 'Start the process!'), - #('Kill', self.on_kill, 'Kill process in background.'), - ('Apply', self.on_apply, 'Apply current values, complete them and make them consistent, but do not run.'), - ] - defaultbutton='Run' - standartbuttons=['cancel',] - + buttons = [('Run', self.on_run, 'Start the process!'), + #('Kill', self.on_kill, 'Kill process in background.'), + ('Apply', self.on_apply, + 'Apply current values, complete them and make them consistent, but do not run.'), + ] + defaultbutton = 'Run' + standartbuttons = ['cancel', ] + return buttons, defaultbutton, standartbuttons - - - def on_run(self, event = None): + + def on_run(self, event=None): self.on_apply() self.process.run() - if self.process.status=='success': + if self.process.status == 'success': self.Destroy() - - def on_kill(self, event = None): + + def on_kill(self, event=None): self.process.kill() - - def on_apply(self,event = None ): + + def on_apply(self, event=None): self.process.update_params() self.restore() - + def get_status(self): return self.process.status - - - def recreate_panel_proc( self, obj = None, - attrconfigs=None, - tables = None, - table =None, id=None, ids=None, - groupnames = None, show_groupnames=False, - show_title=True, - is_modal=False, - immediate_apply=False, - panelstyle='default', - func_change_obj = None, - func_choose_id = None, - func_choose_attr = None, - **buttonargs): - - + + def recreate_panel_proc(self, obj=None, + attrconfigs=None, + tables=None, + table=None, id=None, ids=None, + groupnames=None, show_groupnames=False, + show_title=True, + is_modal=False, + immediate_apply=False, + panelstyle='default', + func_change_obj=None, + func_choose_id=None, + func_choose_attr=None, + **buttonargs): """ Recreates panel and destroys previous contents: attr = a list ith attribute names to be shown @@ -102,8 +103,8 @@ names of scalars turn into buttons. Array attributes are selected by clicking on the column name. """ - #print 'ProcessDialog.recreate_panel',groupnames - #for attrconfig in obj.get_attrman().get_configs(): + # print 'ProcessDialog.recreate_panel',groupnames + # for attrconfig in obj.get_attrman().get_configs(): # print ' attrconfig.attrname',attrconfig.attrname #self.id = id #self.ids = ids @@ -112,47 +113,46 @@ self.func_choose_id = func_choose_id self.func_choose_attr = func_choose_attr self._show_title = show_title - - - - if (attrconfigs == None)&(tables in (None,[]))&(table==None): - attrconfigs= obj.get_attrman().get_configs() + + if (attrconfigs == None) & (tables in (None, [])) & (table == None): + attrconfigs = obj.get_attrman().get_configs() if not self._show_title: # titels of groupname are not shown so just # select attributes at this stage attrconfig_new = [] for attrconfig in attrconfigs: - #print ' attrconfig.attrname',attrconfig.attrname + # print ' attrconfig.attrname',attrconfig.attrname is_shown = False - for groupname in attrconfig.groupnames: - #print ' comp:',attrconfig.attrname,groupname,groupname in groupnames + for groupname in attrconfig.groupnames: + # print ' + # comp:',attrconfig.attrname,groupname,groupname in + # groupnames if groupname in groupnames: is_shown = True break - + if is_shown: attrconfig_new.append(attrconfig) attrconfigs = attrconfig_new - - tables = None #obj.get_tablemans() - - #print 'is_scalar_panel & is_multitab' - + + tables = None # obj.get_tablemans() + + # print 'is_scalar_panel & is_multitab' + sizer = self.init_notebook() - self.add_scalarpage(attrconfigs=attrconfigs, groupnames=groupnames, - id=id, immediate_apply=immediate_apply, panelstyle=panelstyle, - is_modal = is_modal, show_title=show_title, - show_buttons=False, **buttonargs) - + self.add_scalarpage(attrconfigs=attrconfigs, groupnames=groupnames, + id=id, immediate_apply=immediate_apply, panelstyle=panelstyle, + is_modal=is_modal, show_title=show_title, + show_buttons=False, **buttonargs) + for table in tables: - self.add_tablepage(table, groupnames = groupnames) - + self.add_tablepage(table, groupnames=groupnames) + self.show_notebook() sizer = self.GetSizer() - self.add_buttons( self, sizer, - is_modal=is_modal, - **buttonargs) + self.add_buttons(self, sizer, + is_modal=is_modal, + **buttonargs) # some widgets like color need this to expand into their maximum space self.restore() - return True - + return True diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/test_app.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/test_app.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/test_app.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/test_app.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,27 +1,25 @@ -import os, sys - +import os +import sys + import wx from wx.lib.wordwrap import wordwrap - - - - -if __name__ == '__main__': +if __name__ == '__main__': try: APPDIR = os.path.dirname(os.path.abspath(__file__)) except: APPDIR = os.path.dirname(os.path.abspath(sys.argv[0])) - AGILEDIR = os.path.join(APPDIR,'..') - print 'APPDIR,AGILEDIR',APPDIR,AGILEDIR + AGILEDIR = os.path.join(APPDIR, '..') + print 'APPDIR,AGILEDIR', APPDIR, AGILEDIR sys.path.append(AGILEDIR) - libpaths = [AGILEDIR, os.path.join(AGILEDIR,"lib_base"), os.path.join(AGILEDIR,"lib_wx"),] + libpaths = [AGILEDIR, os.path.join( + AGILEDIR, "lib_base"), os.path.join(AGILEDIR, "lib_wx"), ] for libpath in libpaths: - print ' libpath=',libpath + print ' libpath=', libpath lp = os.path.abspath(libpath) if not lp in sys.path: - #print ' append',lp + # print ' append',lp sys.path.append(lp) from mainframe import * @@ -33,201 +31,189 @@ ##import wx ## -##try: +# try: ## dirName = os.path.dirname(os.path.abspath(__file__)) -##except: +# except: ## dirName = os.path.dirname(os.path.abspath(sys.argv[0])) ## -##sys.path.append(os.path.split(dirName)[0]) +# sys.path.append(os.path.split(dirName)[0]) - -IMAGEDIR = os.path.join(os.path.dirname(__file__),"images") -ICONPATH = os.path.join(IMAGEDIR,'icon_color_small.png')# None +IMAGEDIR = os.path.join(os.path.dirname(__file__), "images") +ICONPATH = os.path.join(IMAGEDIR, 'icon_color_small.png') # None + class MyApp(wx.App): + def __init__(self, redirect=False, filename=None): wx.App.__init__(self, redirect, filename) #self.frame = wx.Frame(None, wx.ID_ANY, title='My Title') - self.mainframe = AgileMainframe(title='MyApp', size_toolbaricons = (32,32)) + self.mainframe = AgileMainframe( + title='MyApp', size_toolbaricons=(32, 32)) if ICONPATH != None: - icon = wx.Icon(ICONPATH,wx.BITMAP_TYPE_PNG, 16,16) - self.mainframe.SetIcon(icon) + icon = wx.Icon(ICONPATH, wx.BITMAP_TYPE_PNG, 16, 16) + self.mainframe.SetIcon(icon) self.gleditor = self.mainframe.add_view("OGleditor", OGleditor) - self.mainframe.Show() self.on_test() self.make_menu() self.make_toolbar() #canvas = gleditor.get_canvas() - #canvas.add_element(lines) - #canvas.add_element(triangles) - #canvas.add_element(rectangles) - + # canvas.add_element(lines) + # canvas.add_element(triangles) + # canvas.add_element(rectangles) + def make_toolbar(self): tsize = self.mainframe.get_size_toolbaricons() - new_bmp = wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_TOOLBAR, tsize) - open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, tsize) - save_bmp= wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE, wx.ART_TOOLBAR, tsize) + new_bmp = wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_TOOLBAR, tsize) + open_bmp = wx.ArtProvider.GetBitmap( + wx.ART_FILE_OPEN, wx.ART_TOOLBAR, tsize) + save_bmp = wx.ArtProvider.GetBitmap( + wx.ART_FILE_SAVE, wx.ART_TOOLBAR, tsize) #cut_bmp = wx.ArtProvider.GetBitmap(wx.ART_CUT, wx.ART_TOOLBAR, tsize) #copy_bmp = wx.ArtProvider.GetBitmap(wx.ART_COPY, wx.ART_TOOLBAR, tsize) #paste_bmp= wx.ArtProvider.GetBitmap(wx.ART_PASTE, wx.ART_TOOLBAR, tsize) - - - - self.mainframe.add_tool('new',self.on_open,new_bmp,'create new doc') - self.mainframe.add_tool('open',self.on_open,open_bmp,'Open doc') - self.mainframe.add_tool('save',self.on_save,save_bmp,'Save doc') - #self.toolbar.AddSeparator() - #self.add_tool('cut',self.on_open,cut_bmp,'Cut') - #self.add_tool('copy',self.on_open,copy_bmp,'Copy') - #self.add_tool('paste',self.on_open,paste_bmp,'Paste') + + self.mainframe.add_tool('new', self.on_open, new_bmp, 'create new doc') + self.mainframe.add_tool('open', self.on_open, open_bmp, 'Open doc') + self.mainframe.add_tool('save', self.on_save, save_bmp, 'Save doc') + # self.toolbar.AddSeparator() + # self.add_tool('cut',self.on_open,cut_bmp,'Cut') + # self.add_tool('copy',self.on_open,copy_bmp,'Copy') + # self.add_tool('paste',self.on_open,paste_bmp,'Paste') + def make_menu(self): self.mainframe.menubar.append_menu('file') self.mainframe.menubar.append_menu('file/doc') - - self.mainframe.menubar.append_item('file/doc/open',self.on_open,\ - shortkey='Ctrl+o',info='open it out') - - self.mainframe.menubar.append_item('file/doc/save',self.on_save,\ - shortkey='Ctrl+s',info='save it out') - - def on_save(self,event): - print 'save it!!' - - + self.mainframe.menubar.append_item('file/doc/open', self.on_open, + shortkey='Ctrl+o', info='open it out') + + self.mainframe.menubar.append_item('file/doc/save', self.on_save, + shortkey='Ctrl+s', info='save it out') + + def on_save(self, event): + print 'save it!!' def on_open(self, event): """Open a document""" #wildcards = CreateWildCards() + "All files (*.*)|*.*" print 'open it!!' - - def on_test(self,event=None): - print '\non_test' - vertices = np.array([ - [[0.0,0.0,0.0],[0.2,0.0,0.0]],# 0 green - [[0.0,0.0,0.0],[0.0,0.9,0.0]],# 1 red - ]) - - - colors =np.array( [ - [0.0,0.9,0.0,0.9], # 0 - [0.9,0.0,0.0,0.9], # 1 - ]) - - colors2 =np.array( [ - [0.5,0.9,0.5,0.5], # 0 - [0.9,0.5,0.9,0.5], # 1 - ]) - colors2o =np.array( [ - [0.8,0.9,0.8,0.9], # 0 - [0.9,0.8,0.9,0.9], # 1 - ]) - - - - drawing = OGLdrawing() -#------------------------------------------------------------------------------- - - if 0: - lines = Lines('lines', drawing) - lines.add_drawobjs(vertices,colors) - drawing.add_drawobj(lines) -#------------------------------------------------------------------------------- - if 0: - fancylines = Fancylines('fancylines', drawing) - vertices_fancy = np.array([ - [[0.0,-1.0,0.0],[2,-1.0,0.0]],# 0 green - [[0.0,-1.0,0.0],[0.0,-5.0,0.0]],# 1 red - ]) - - widths = [ 0.5, - 0.3, - ] - #print ' vertices_fancy\n',vertices_fancy - # FLATHEAD = 0 - #BEVELHEAD = 1 - #TRIANGLEHEAD = 2 - #ARROWHEAD = 3 - fancylines.add_drawobjs( vertices_fancy, - widths,# width - colors, - beginstyles = [TRIANGLEHEAD,TRIANGLEHEAD], - endstyles = [ARROWHEAD,ARROWHEAD]) - drawing.add_drawobj(fancylines) -#------------------------------------------------------------------------------- - if 0: - polylines = Polylines('polylines', drawing, joinstyle = BEVELHEAD) - colors_poly =np.array( [ - [0.0,0.8,0.5,0.9], # 0 - [0.8,0.0,0.5,0.9], # 1 - ]) - - vertices_poly = np.array([ - [[0.0,2.0,0.0],[5.0,2.0,0.0],[5.0,7.0,0.0],[0.0,7.0,0.0]],# 0 green - [[0.0,-2.0,0.0],[-2.0,-2.0,0.0]],# 1 red - ], np.object) - - widths = [ 0.5, - 0.3, - ] - #print ' vertices_poly\n',vertices_poly - polylines.add_drawobjs( vertices_poly, - widths,# width - colors_poly, - beginstyles = [ARROWHEAD,ARROWHEAD], - endstyles = [ARROWHEAD,ARROWHEAD]) - drawing.add_drawobj(polylines) - -#------------------------------------------------------------------------------- - if 1: - polygons = Polygons('polygons', drawing,linewidth = 5) - colors_poly =np.array( [ - [0.0,0.9,0.9,0.9], # 0 - [0.8,0.2,0.2,0.9], # 1 - ]) - - vertices_poly = np.array([ - [[0.0,2.0,0.0],[5.0,2.0,0.0],[5.0,7.0,0.0],[0.0,7.0,0.0]],# 0 green - [[0.0,-2.0,0.0],[-2.0,-2.0,0.0],[-2.0,0.0,0.0]],# 1 red - ], np.object) - - print ' vertices_polygon\n',vertices_poly - polygons.add_drawobjs( vertices_poly, - colors_poly) - drawing.add_drawobj(polygons) - - canvas = self.gleditor.get_canvas() - canvas.set_drawing(drawing) - - - #lines.add_drawobj([[0.0,0.0,0.0],[-0.2,-0.8,0.0]], [0.0,0.9,0.9,0.9]) - #circles.add_drawobj([1.5,0.0,0.0],0.6,colors2o[0], colors2[0]) - - - #canvas.zoom_tofit() - wx.CallAfter(canvas.zoom_tofit) - - - + def on_test(self, event=None): + print '\non_test' + vertices = np.array([ + [[0.0, 0.0, 0.0], [0.2, 0.0, 0.0]], # 0 green + [[0.0, 0.0, 0.0], [0.0, 0.9, 0.0]], # 1 red + ]) + + colors = np.array([ + [0.0, 0.9, 0.0, 0.9], # 0 + [0.9, 0.0, 0.0, 0.9], # 1 + ]) + + colors2 = np.array([ + [0.5, 0.9, 0.5, 0.5], # 0 + [0.9, 0.5, 0.9, 0.5], # 1 + ]) + colors2o = np.array([ + [0.8, 0.9, 0.8, 0.9], # 0 + [0.9, 0.8, 0.9, 0.9], # 1 + ]) + + drawing = OGLdrawing() +#------------------------------------------------------------------------- + + if 0: + lines = Lines('lines', drawing) + lines.add_drawobjs(vertices, colors) + drawing.add_drawobj(lines) +#------------------------------------------------------------------------- + if 0: + fancylines = Fancylines('fancylines', drawing) + vertices_fancy = np.array([ + [[0.0, -1.0, 0.0], [2, -1.0, 0.0]], # 0 green + [[0.0, -1.0, 0.0], [0.0, -5.0, 0.0]], # 1 red + ]) + + widths = [0.5, + 0.3, + ] + # print ' vertices_fancy\n',vertices_fancy + # FLATHEAD = 0 + #BEVELHEAD = 1 + #TRIANGLEHEAD = 2 + #ARROWHEAD = 3 + fancylines.add_drawobjs(vertices_fancy, + widths, # width + colors, + beginstyles=[TRIANGLEHEAD, TRIANGLEHEAD], + endstyles=[ARROWHEAD, ARROWHEAD]) + drawing.add_drawobj(fancylines) +#------------------------------------------------------------------------- + if 0: + polylines = Polylines('polylines', drawing, joinstyle=BEVELHEAD) + colors_poly = np.array([ + [0.0, 0.8, 0.5, 0.9], # 0 + [0.8, 0.0, 0.5, 0.9], # 1 + ]) + + vertices_poly = np.array([ + [[0.0, 2.0, 0.0], [5.0, 2.0, 0.0], [ + 5.0, 7.0, 0.0], [0.0, 7.0, 0.0]], # 0 green + [[0.0, -2.0, 0.0], [-2.0, -2.0, 0.0]], # 1 red + ], np.object) + + widths = [0.5, + 0.3, + ] + # print ' vertices_poly\n',vertices_poly + polylines.add_drawobjs(vertices_poly, + widths, # width + colors_poly, + beginstyles=[ARROWHEAD, ARROWHEAD], + endstyles=[ARROWHEAD, ARROWHEAD]) + drawing.add_drawobj(polylines) + +#------------------------------------------------------------------------- + if 1: + polygons = Polygons('polygons', drawing, linewidth=5) + colors_poly = np.array([ + [0.0, 0.9, 0.9, 0.9], # 0 + [0.8, 0.2, 0.2, 0.9], # 1 + ]) + + vertices_poly = np.array([ + [[0.0, 2.0, 0.0], [5.0, 2.0, 0.0], [ + 5.0, 7.0, 0.0], [0.0, 7.0, 0.0]], # 0 green + [[0.0, -2.0, 0.0], [-2.0, -2.0, 0.0], + [-2.0, 0.0, 0.0]], # 1 red + ], np.object) + + print ' vertices_polygon\n', vertices_poly + polygons.add_drawobjs(vertices_poly, + colors_poly) + drawing.add_drawobj(polygons) + canvas = self.gleditor.get_canvas() + canvas.set_drawing(drawing) + #lines.add_drawobj([[0.0,0.0,0.0],[-0.2,-0.8,0.0]], [0.0,0.9,0.9,0.9]) + #circles.add_drawobj([1.5,0.0,0.0],0.6,colors2o[0], colors2[0]) + # canvas.zoom_tofit() + wx.CallAfter(canvas.zoom_tofit) if __name__ == '__main__': - #if len(sys.argv)==3: + # if len(sys.argv)==3: # ident = sys.argv[1] # dirpath = sys.argv[2] - #else: + # else: # ident = None # dirpath = None myapp = MyApp(0) - - + myapp.MainLoop() - \ No newline at end of file diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/test_glcanvas.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/test_glcanvas.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/test_glcanvas.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/test_glcanvas.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,11 +3,12 @@ @license: Public Domain ''' -#Uncomment if you have multiple wxWidgets versions +# Uncomment if you have multiple wxWidgets versions #import wxversion -#wxversion.select('2.8') +# wxversion.select('2.8') -import math, wx +import math +import wx from wx import glcanvas from wx.lib.buttons import GenBitmapTextButton, GenBitmapButton @@ -16,24 +17,27 @@ from OpenGL.GLU import * from OpenGL.GLUT import * from OpenGL.raw.GL.ARB.vertex_array_object import glGenVertexArrays, \ - glBindVertexArray - + glBindVertexArray + from OpenGL.arrays import vbo import numpy as np - + except ImportError: raise ImportError, "Required dependency OpenGL not present" -import sys, os, types -APPDIR = os.path.join(os.path.dirname(__file__),"..") -sys.path.append(os.path.join(APPDIR,"lib_base")) -IMAGEDIR = os.path.join(os.path.dirname(__file__),"images") +import sys +import os +import types +APPDIR = os.path.join(os.path.dirname(__file__), "..") +sys.path.append(os.path.join(APPDIR, "lib_base")) +IMAGEDIR = os.path.join(os.path.dirname(__file__), "images") import classman as cm # wx gui stuff -from wxmisc import * - -import objpanel, wxmisc +from wxmisc import * + +import objpanel +import wxmisc stockIDs = [ wx.ID_ABOUT, @@ -91,177 +95,173 @@ wx.ID_ZOOM_IN, wx.ID_ZOOM_OUT, - ] +] class BaseTool(cm.BaseObjman): + """ This is a base tool class for Agilecanvas. It must handle all mouse or keyboard events, must create and draw helplines and finally modify the state of client which are grafically represented on the canvas. - """ - - def __init__(self,parent,mainframe=None): + """ + + def __init__(self, parent, mainframe=None): """ To be overridden by specific tool. """ - self.init_common('select',parent,'Selection tool',mainframe, info = 'Select objects in cancvas') - - def set_button_info(self,bsize=(32,32)): - #print 'set_button_info select tool' - self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'selectIcon.bmp'),wx.BITMAP_TYPE_BMP) - self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'selectIconSel.bmp'),wx.BITMAP_TYPE_BMP) - - def get_button(self, parent, bottonsize = (32,32), bottonborder=10): - + self.init_common('select', parent, 'Selection tool', + mainframe, info='Select objects in cancvas') + + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'selectIcon.bmp'), wx.BITMAP_TYPE_BMP) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'selectIconSel.bmp'), wx.BITMAP_TYPE_BMP) + + def get_button(self, parent, bottonsize=(32, 32), bottonborder=10): + # simple stockbuttons #b=wx.Button(parent, wx.ID_DELETE) - - id=wx.NewId() + + id = wx.NewId() bitmap = self._bitmap - + #b=GenBitmapTextToggleButton(parent, id, bitmap,tool.name,name = self.get_name()) - b=GenBitmapToggleButton(parent, id, bitmap,(bitmap.GetWidth()+bottonborder, bitmap.GetHeight()+bottonborder), name = self.get_name()) + b = GenBitmapToggleButton(parent, id, bitmap, (bitmap.GetWidth( + ) + bottonborder, bitmap.GetHeight() + bottonborder), name=self.get_name()) #b=GenBitmapToggleButton(self, wx.ID_DELETE) #b = GenBitmapTextToggleButton(self, id, None, tool.get('name',''), size = (200, 45)) - - if bitmap!=None: + + if bitmap != None: #mask = wx.Mask(bitmap, wx.BLUE) - #bitmap.SetMask(mask) + # bitmap.SetMask(mask) b.SetBitmapLabel(bitmap) - #bmp=wx.NullBitmap - - bitmap_sel = self._bitmap_sel - if bitmap_sel!=None: + # bmp=wx.NullBitmap + + bitmap_sel = self._bitmap_sel + if bitmap_sel != None: #mask = wx.Mask(bmp, wx.BLUE) - #bmp.SetMask(mask) + # bmp.SetMask(mask) b.SetBitmapSelected(bitmap_sel) - + b.SetUseFocusIndicator(False) - + b.SetUseFocusIndicator(False) - #b.SetSize((36,140)) - #b.SetBestSize() - tt=wx.ToolTip(self.get_info()) - b.SetToolTip(tt)#.SetTip(tool.tooltip) + # b.SetSize((36,140)) + # b.SetBestSize() + tt = wx.ToolTip(self.get_info()) + b.SetToolTip(tt) # .SetTip(tool.tooltip) return b - - def init_common(self,ident,parent,name,mainframe=None,info = None): - #print 'Agiletool.__init__',ident,name + + def init_common(self, ident, parent, name, mainframe=None, info=None): + # print 'Agiletool.__init__',ident,name self.name = name - self.metacanvas=None - #FSMnamed.__init__(self,ident,parent,name) - self._init_objman(ident, parent=parent, name = name.title(), info = info) + self.metacanvas = None + # FSMnamed.__init__(self,ident,parent,name) + self._init_objman(ident, parent=parent, name=name.title(), info=info) attrsman = self.set_attrsman(cm.Attrsman(self)) - - - - - self.access = attrsman.add(cm.AttrConf( 'access', ['bus','bike','tram'], - groupnames = ['options'], - perm='rw', - is_save = True, - name = 'Access list', - info = 'List with vehicle classes that have access', - )) - - self.emissiontype = attrsman.add(cm.AttrConf( 'emissiontype', 'Euro 0', - groupnames = ['options'], - perm='rw', - is_save = True, - name = 'Emission type', - info = 'Emission type of vehicle', - )) - # dictionary of drawobjects that will be created during + + self.access = attrsman.add(cm.AttrConf('access', ['bus', 'bike', 'tram'], + groupnames=['options'], + perm='rw', + is_save=True, + name='Access list', + info='List with vehicle classes that have access', + )) + + self.emissiontype = attrsman.add(cm.AttrConf('emissiontype', 'Euro 0', + groupnames=['options'], + perm='rw', + is_save=True, + name='Emission type', + info='Emission type of vehicle', + )) + # dictionary of drawobjects that will be created during # the application of the tool. # ident is the number in chronological order of creation, - # starting with one. Value is the ad hoc instance of a drawing + # starting with one. Value is the ad hoc instance of a drawing # object. - self.drawobjs={} - self.helpobjs={} - - self.mainframe=mainframe - #print ' call set_button',self.ident + self.drawobjs = {} + self.helpobjs = {} + + self.mainframe = mainframe + # print ' call set_button',self.ident self.set_button_info() - self.targetsets={} - #self.optionspanel=None - - - - def append_drawobj(self,drawobj): + self.targetsets = {} + # self.optionspanel=None + + def append_drawobj(self, drawobj): """ Append new drawobject - """ - n=len(self.drawobjs)+1 - self.drawobjs[n]=drawobj - - - - + """ + n = len(self.drawobjs) + 1 + self.drawobjs[n] = drawobj + def pop_drawobj(self): """ Returns most recent drawobject, removing it from the list. If there are no more drwobjects in the list None is returned. """ - - n=len(self.drawobjs) + + n = len(self.drawobjs) if n > 0: - drawobj=self.drawobjs[n] + drawobj = self.drawobjs[n] del self.drawobjs[n] return drawobj else: return None - + def get_last_drawobj(self): """ Returns most recent drawobject, without changing the list. If there are no more drwobjects in the list None is returned. """ - n=len(self.drawobjs) + n = len(self.drawobjs) if n > 0: - drawobj=self.drawobjs[n] + drawobj = self.drawobjs[n] return drawobj else: return None - + def clear_drawobjs(self): """ Clear list of drawobjects, while maintaining them on metacanvas. """ - self.drawobjs={} - + self.drawobjs = {} + def del_drawobjs(self): """ Remove all drawobjects from metacanvas. """ - while len(self.drawobjs)>0: - drawobj=self.pop_drawobj() + while len(self.drawobjs) > 0: + drawobj = self.pop_drawobj() self.metacanvas.del_obj(drawobj) - - - - def make_targetsets(self,setnames=None,layer=None): + + def make_targetsets(self, setnames=None, layer=None): """ Returns a dictionary with instances of targetsets as values and setnames as key. This allows the tool to select a list of sets from the a specific layer to which it can directly communicate. - + If no setnames are given then all sets of the specific layer are returned. - + Can be used for example to change handle settings """ - if setnames!=None: - objsets={} + if setnames != None: + objsets = {} for name in setnames: - objsets[name]=self.metacanvas.get_objset_from_layer(layer,name) - self.targetsets = objsets + objsets[name] = self.metacanvas.get_objset_from_layer( + layer, name) + self.targetsets = objsets else: self.targetsets = self.metacanvas.get_objset_from_layer(layer) - + def set_handles(self): """ Set handles to selected object sets which can be connected. @@ -269,271 +269,270 @@ # put handles on all section objects for name_set in self.targetsets.keys(): self.metacanvas.set_handles(name_set=name_set) - - - - def get_bitmap_from_file(self,name_bitmap): - #print 'get_bitmap_from_file :'+"gui/bitmaps/" + name_bitmap + ".bmp" - return wx.Bitmap("gui/bitmaps/" + name_bitmap + ".bmp", - wx.BITMAP_TYPE_BMP) - - #def make_optionpanel(self,panel): - - def get_optionpanel(self,parent): + + def get_bitmap_from_file(self, name_bitmap): + # print 'get_bitmap_from_file :'+"gui/bitmaps/" + name_bitmap + ".bmp" + return wx.Bitmap("gui/bitmaps/" + name_bitmap + ".bmp", + wx.BITMAP_TYPE_BMP) + + # def make_optionpanel(self,panel): + + def get_optionpanel(self, parent): """ Return tool option widgets on given parent """ - #print 'get_optionpanel',self - #button = wx.Button(parent, wx.NewId(), self.name+' Options') + # print 'get_optionpanel',self + #button = wx.Button(parent, wx.NewId(), self.name+' Options') #button.Bind(wx.EVT_BUTTON, self.set_options) - #return button - - self.optionspanel=ObjPanel(parent,self,groups=['options'], - standartbuttons=[], - immediate_apply=True, - panelstyle='instrumental') + # return button + + self.optionspanel = ObjPanel(parent, self, groups=['options'], + standartbuttons=[], + immediate_apply=True, + panelstyle='instrumental') return self.optionspanel - - - - def set_options(self,event): + + def set_options(self, event): """ Called from options panel. """ - print 'set_options',self.ident - print ' event=',event + print 'set_options', self.ident + print ' event=', event pass - - def set_statusbar(self,key,info): + + def set_statusbar(self, key, info): pass - - - def activate_metacanvas(self,metacanvas): + + def activate_metacanvas(self, metacanvas): """ This call by metacanvas signals that the tool has been activated and can now interact with metacanvas. """ - #print 'activate_metacanvas',self.ident - self.metacanvas=metacanvas + # print 'activate_metacanvas',self.ident + self.metacanvas = metacanvas self.metacanvas.del_handles() self.activate() - + def get_metacanvas(self): return self.metacanvas - - #def get_pentable(self): + + # def get_pentable(self): # if self.metacanvas: # return self.metacanvas.get_pentable() - + def deactivate_metacanvas(self): """ This call by metacanvas signals that the tool has been deactivated and can now interact with metacanvas. """ - + self.deactivate() - self.optionspanel=None - self.metacanvas=None + self.optionspanel = None + self.metacanvas = None class DelTool(BaseTool): - def __init__(self,parent,mainframe=None): + + def __init__(self, parent, mainframe=None): """ To be overridden by specific tool. """ - self.init_common('delete',parent,'Delete',mainframe, info = 'Delete objects in cancvas') - - def set_button_info(self,bsize=(32,32)): - #print 'set_button_info select tool' + self.init_common('delete', parent, 'Delete', mainframe, + info='Delete objects in cancvas') + + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' self._bitmap = None self._bitmap_sel = None - - def get_button(self, parent, bottonsize = (32,32), bottonborder=10): - + + def get_button(self, parent, bottonsize=(32, 32), bottonborder=10): + # simple stockbuttons - b=wx.Button(parent, wx.ID_DELETE,name = self.get_name()) - + b = wx.Button(parent, wx.ID_DELETE, name=self.get_name()) + b.SetSize(bottonsize) - #b.SetBestSize() - tt=wx.ToolTip(self.get_info()) - b.SetToolTip(tt)#.SetTip(tool.tooltip) - #print 'DelTool.get_button',dir(b) + # b.SetBestSize() + tt = wx.ToolTip(self.get_info()) + b.SetToolTip(tt) # .SetTip(tool.tooltip) + # print 'DelTool.get_button',dir(b) return b - - + + class ToolPalett(wx.Panel): + """ This is a panel where tools are represented by images and/or text. The tools are selected in a radio-button-fashion. - + Each tool has a string as key. Each time the status changes, a callback function is called with new and old tool key as argument. """ - def __init__(self,parent,tools=[],callback=None, n_buttoncolumns=4): + + def __init__(self, parent, tools=[], callback=None, n_buttoncolumns=4): """ callback is a function that is called when a tool has been selected. The function is called as: callback(tool) - + """ - #the metacanvas object with which the pallet should apply th tools - self._callback=callback - - #wx.Window.__init__(self,parent,wx.ID_ANY,wx.DefaultPosition,wx.DefaultSize,wx.SUNKEN_BORDER|wx.WANTS_CHARS) - #wx.Panel.__init__(self,parent,wx.ID_ANY,wx.DefaultPosition,size,wx.RAISED_BORDER|wx.WANTS_CHARS) - wx.Panel.__init__(self,parent,-1,wx.DefaultPosition,wx.DefaultSize) - #wx.Panel.__init__(self,parent,wx.ID_ANY,wx.DefaultPosition,(300,600),wx.RAISED_BORDER|wx.WANTS_CHARS) + # the metacanvas object with which the pallet should apply th tools + self._callback = callback + + # wx.Window.__init__(self,parent,wx.ID_ANY,wx.DefaultPosition,wx.DefaultSize,wx.SUNKEN_BORDER|wx.WANTS_CHARS) + # wx.Panel.__init__(self,parent,wx.ID_ANY,wx.DefaultPosition,size,wx.RAISED_BORDER|wx.WANTS_CHARS) + wx.Panel.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize) + # wx.Panel.__init__(self,parent,wx.ID_ANY,wx.DefaultPosition,(300,600),wx.RAISED_BORDER|wx.WANTS_CHARS) self.sizer = wx.GridSizer(0, n_buttoncolumns, 5, 5) self.SetSizer(self.sizer) - self._id_to_tool={} - self._id=-1 - + self._id_to_tool = {} + self._id = -1 + for tool in tools: self.add_tool(tool) - + self.sizer.Fit(self) - #self.SetMaxSize((300,300)) - - def add_tool(self,tool): + # self.SetMaxSize((300,300)) + + def add_tool(self, tool): """ Add a tool to the pallet. """ - bottonsize = (32,32) + bottonsize = (32, 32) bottonborder = 10 toolbarborder = 1 - - if tool==None: + + if tool == None: self.sizer.Add() return None else: - b= tool.get_button(self, bottonsize = bottonsize, bottonborder=bottonborder) + b = tool.get_button(self, bottonsize=bottonsize, + bottonborder=bottonborder) self.Bind(wx.EVT_BUTTON, self.on_select, b) - - - self._id_to_tool[b.GetId()]=(tool,b) - + + self._id_to_tool[b.GetId()] = (tool, b) + #self.sizer.Add(b, 0, wx.GROW) - self.sizer.Add(b,0, wx.EXPAND, border=toolbarborder) - #self.sizer.Add(b) - + self.sizer.Add(b, 0, wx.EXPAND, border=toolbarborder) + # self.sizer.Add(b) + return id - - def add_tool_old(self,tool): + + def add_tool_old(self, tool): """ Add a tool to the pallet. """ - bottonsize = (32,32) + bottonsize = (32, 32) bottonborder = 10 toolbarborder = 1 - - if tool==None: + + if tool == None: self.sizer.Add() return None else: - id=wx.NewId() + id = wx.NewId() bitmap = tool.get_buttonbitmap() - - #print '\n add_tool',key,bitmap - #print 'toolpallet.add_tool: key,name:',tool.key,tool.name + + # print '\n add_tool',key,bitmap + # print 'toolpallet.add_tool: key,name:',tool.key,tool.name #b=GenBitmapTextToggleButton(self, id, bitmap,tool.name,name = tool.name) - b=GenBitmapToggleButton(self, id, bitmap,(bitmap.GetWidth()+bottonborder, bitmap.GetHeight()+bottonborder)) + b = GenBitmapToggleButton(self, id, bitmap, (bitmap.GetWidth( + ) + bottonborder, bitmap.GetHeight() + bottonborder)) #b=GenBitmapToggleButton(self, wx.ID_DELETE) #b = GenBitmapTextToggleButton(self, id, None, tool.get('name',''), size = (200, 45)) self.Bind(wx.EVT_BUTTON, self.on_select, b) - + if bitmap: #mask = wx.Mask(bitmap, wx.BLUE) - #bitmap.SetMask(mask) + # bitmap.SetMask(mask) b.SetBitmapLabel(bitmap) - #bmp=wx.NullBitmap - - bitmap_sel = tool.get_buttonbitmap_sel() + # bmp=wx.NullBitmap + + bitmap_sel = tool.get_buttonbitmap_sel() if bitmap_sel: #mask = wx.Mask(bmp, wx.BLUE) - #bmp.SetMask(mask) + # bmp.SetMask(mask) b.SetBitmapSelected(bitmap_sel) - + b.SetUseFocusIndicator(False) - #b.SetSize((36,140)) - #b.SetBestSize() - tt=wx.ToolTip(tool.get_info()) - b.SetToolTip(tt)#.SetTip(tool.tooltip) - - self._id_to_tool[id]=(tool,b) - + # b.SetSize((36,140)) + # b.SetBestSize() + tt = wx.ToolTip(tool.get_info()) + b.SetToolTip(tt) # .SetTip(tool.tooltip) + + self._id_to_tool[id] = (tool, b) + #self.sizer.Add(b, 0, wx.GROW) - - self.sizer.Add(b,0, wx.EXPAND, border=toolbarborder) - #self.sizer.Add(b) - + + self.sizer.Add(b, 0, wx.EXPAND, border=toolbarborder) + # self.sizer.Add(b) + return id - + def get_tools(self): """ Returns lins with all toll instances """ - tools=[] - for (tool,b) in self._id_to_tool.values(): + tools = [] + for (tool, b) in self._id_to_tool.values(): tools.append(tool) return tools - + def refresh(self): """ Reorganizes toolpallet after adding/removing tools. Attention is not automatically called. """ self.sizer.Layout() - - def on_select(self,event): - - _id=event.GetEventObject().GetId() - print '\n on_select',_id,self._id#,self._id_to_tool[_id] - if _id!=self._id: + + def on_select(self, event): + + _id = event.GetEventObject().GetId() + print '\n on_select', _id, self._id # ,self._id_to_tool[_id] + if _id != self._id: if self._id_to_tool.has_key(_id): - - (tool,button)=self._id_to_tool[_id] - print ' new tool',tool.get_name() + + (tool, button) = self._id_to_tool[_id] + print ' new tool', tool.get_name() self.unselect() - self._id=_id + self._id = _id self.GetParent().set_options(tool) - if self._callback!=None: + if self._callback != None: self._callback(tool) - - - + def unselect(self): """ Unselect currently selected tool. """ if self._id_to_tool.has_key(self._id): - (tool,button)=self._id_to_tool[self._id] - if hasattr(button,'SetToggle'): + (tool, button) = self._id_to_tool[self._id] + if hasattr(button, 'SetToggle'): button.SetToggle(False) else: - #button.SetFocus() - #print 'button.SetFocus',button.SetFocus.__doc__ + # button.SetFocus() + # print 'button.SetFocus',button.SetFocus.__doc__ pass - - def select(self,id): + + def select(self, id): """ Select explicitelt a tool. """ - print '\n select',id,self._id,self._id_to_tool - - if id!=self._id: + print '\n select', id, self._id, self._id_to_tool + + if id != self._id: if self._id_to_tool.has_key(id): # unselect previous self.unselect() - + # select and activate new tool - (tool,button)=self._id_to_tool[id] + (tool, button) = self._id_to_tool[id] button.SetToggle(True) - self._id=id - if self._callback!=None: + self._id = id + if self._callback != None: self._callback(tool) - + class __ToggleMixin: + def SetToggle(self, flag): self.up = not flag self.Refresh() @@ -547,7 +546,7 @@ if not self.IsEnabled(): return self.saveUp = self.up - self.up = False #not self.up + self.up = False # not self.up self.CaptureMouse() self.SetFocus() self.Refresh() @@ -564,163 +563,163 @@ def OnKeyDown(self, event): event.Skip() - - + class GenBitmapTextToggleButton(__ToggleMixin, GenBitmapTextButton): + """A generic toggle bitmap button with text label""" pass + class GenBitmapToggleButton(__ToggleMixin, GenBitmapButton): + """A generic toggle bitmap button with text label""" pass + class ToolsPanel(wx.Panel): + """ - + Interactively navigates through objects and displays attributes on a panel. """ + def __init__(self, parent): - wx.Panel.__init__(self,parent,-1,wx.DefaultPosition,wx.DefaultSize) - - sizer=wx.BoxSizer(wx.VERTICAL) - - self._toolspalett = ToolPalett(self) - - #self._toolspalett.add_tool(BaseTool(self)) - + wx.Panel.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize) + + sizer = wx.BoxSizer(wx.VERTICAL) + + self._toolspalett = ToolPalett(self) + + # self._toolspalett.add_tool(BaseTool(self)) + # create initial option panel self._optionspanel = wx.Window(self) self._optionspanel.SetBackgroundColour("pink") - wx.StaticText(self._optionspanel, -1, "Tool Options", (300,-1)) - - - - - - sizer.Add(self._toolspalett,0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4) - sizer.Add(self._optionspanel,1,wx.GROW)# - + wx.StaticText(self._optionspanel, -1, "Tool Options", (300, -1)) + + sizer.Add(self._toolspalett, 0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4) + sizer.Add(self._optionspanel, 1, wx.GROW) + # finish panel setup self.SetSizer(sizer) sizer.Fit(self) - - #self.SetSize(parent.GetSize()) - + + # self.SetSize(parent.GetSize()) + def add_tool(self, tool): self._toolspalett.add_tool(tool) - + def set_options(self, tool): #self._optionspanel.change_obj(tool,groupnames = ['options']) - #self._optionspanel.change_obj(tool) - sizer=self.GetSizer() + # self._optionspanel.change_obj(tool) + sizer = self.GetSizer() sizer.Remove(1) self._optionspanel.Destroy() - - self._optionspanel=objpanel.ObjPanel(self, obj = tool, - attrconfigs=None, - #tables = None, - #table = None, id=None, ids=None, - groupnames = None, - func_change_obj=None, - show_groupnames=False, show_title=True, is_modal=False, - mainframe=None, - pos=wx.DefaultPosition, size=wx.DefaultSize, style = wx.MAXIMIZE_BOX|wx.RESIZE_BORDER, - immediate_apply=False, panelstyle='default', - standartbuttons=['apply','restore']) - #if id!=None: + + self._optionspanel = objpanel.ObjPanel(self, obj=tool, + attrconfigs=None, + #tables = None, + # table = None, id=None, + # ids=None, + groupnames=None, + func_change_obj=None, + show_groupnames=False, show_title=True, is_modal=False, + mainframe=None, + pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.MAXIMIZE_BOX | wx.RESIZE_BORDER, + immediate_apply=False, panelstyle='default', + standartbuttons=['apply', 'restore']) + # if id!=None: # self.objpanel=ObjPanel(self,obj,id=id,func_change_obj=self.change_obj) - #else: + # else: # self.objpanel=ObjPanel(self,obj,func_change_obj=self.change_obj) - sizer.Add(self._optionspanel,1,wx.GROW) - + sizer.Add(self._optionspanel, 1, wx.GROW) + self.Refresh() - #sizer.Fit(self) + # sizer.Fit(self) sizer.Layout() - - -def get_dist_point_to_segs(p,y1,x1,y2,x2, is_ending=True): + + +def get_dist_point_to_segs(p, y1, x1, y2, x2, is_ending=True): """ Minimum Distance between a Point p = (x,y) and a Line segments , where vectors x1, y1 are the first points and x2,y2 are the second points of the line segments. Written by Paul Bourke, October 1988 http://astronomy.swin.edu.au/~pbourke/geometry/pointline/ - + Rewritten in vectorial form by Joerg Schweizer """ - - y3,x3 = p - + + y3, x3 = p + d = np.zeros(len(y1), dtype=np.float32) - - dx21 = (x2-x1) - dy21 = (y2-y1) - - lensq21 = dx21*dx21 + dy21*dy21 - + + dx21 = (x2 - x1) + dy21 = (y2 - y1) + + lensq21 = dx21 * dx21 + dy21 * dy21 + # indexvector for all zero length lines - iz = (lensq21 == 0) - - dy = y3-y1[iz] - dx = x3-x1[iz] - - d[iz] = dx*dx + dy*dy - - - lensq21[iz] = 1.0 # replace zeros with 1.0 to avoid div by zero error - - u = (x3-x1)*dx21 + (y3-y1)*dy21 - u = u / lensq21 + iz = (lensq21 == 0) + + dy = y3 - y1[iz] + dx = x3 - x1[iz] + d[iz] = dx * dx + dy * dy + + lensq21[iz] = 1.0 # replace zeros with 1.0 to avoid div by zero error + + u = (x3 - x1) * dx21 + (y3 - y1) * dy21 + u = u / lensq21 - x = x1+ u * dx21 - y = y1+ u * dy21 + x = x1 + u * dx21 + y = y1 + u * dy21 if is_ending: - ie = u < 0 - x[ie] = x1[ie] - y[ie] = y1[ie] - ie = u > 1 - x[ie] = x2[ie] - y[ie] = y2[ie] - - dx30 = x3-x - dy30 = y3-y - d[~iz] = (dx30*dx30 + dy30*dy30)[~iz] + ie = u < 0 + x[ie] = x1[ie] + y[ie] = y1[ie] + ie = u > 1 + x[ie] = x2[ie] + y[ie] = y2[ie] + + dx30 = x3 - x + dy30 = y3 - y + d[~iz] = (dx30 * dx30 + dy30 * dy30)[~iz] return d - -def is_inside_triangles(p,x1,y1,x2,y2,x3,y3): +def is_inside_triangles(p, x1, y1, x2, y2, x3, y3): """ Returns a binary vector with True if point p is inside a triangle. x1,y1,x2,y2,x3,y3 are vectors with the 3 coordiantes of the triangles. """ - alpha = ((y2 - y3)*(p[0] - x3) + (x3 - x2)*(p[1] - y3)) \ - /((y2 - y3)*(x1 - x3) + (x3 - x2)*(y1 - y3)) - - beta = ((y3 - y1)*(p[0] - x3) + (x1 - x3)*(p[1] - y3)) \ - /((y2 - y3)*(x1 - x3) + (x3 - x2)*(y1 - y3)) - - gamma = 1.0 - alpha - beta; - return (alpha>0)&(beta>0)&(gamma>0) + alpha = ((y2 - y3) * (p[0] - x3) + (x3 - x2) * (p[1] - y3)) \ + / ((y2 - y3) * (x1 - x3) + (x3 - x2) * (y1 - y3)) + beta = ((y3 - y1) * (p[0] - x3) + (x1 - x3) * (p[1] - y3)) \ + / ((y2 - y3) * (x1 - x3) + (x3 - x2) * (y1 - y3)) + + gamma = 1.0 - alpha - beta + return (alpha > 0) & (beta > 0) & (gamma > 0) class WxGLTest_orig(glcanvas.GLCanvas): + def __init__(self, parent): - - glcanvas.GLCanvas.__init__(self, parent,-1, attribList=[glcanvas.WX_GL_DOUBLEBUFFER]) + + glcanvas.GLCanvas.__init__( + self, parent, -1, attribList=[glcanvas.WX_GL_DOUBLEBUFFER]) wx.EVT_PAINT(self, self.OnDraw) wx.EVT_SIZE(self, self.OnSize) wx.EVT_MOTION(self, self.OnMouseMotion) wx.EVT_WINDOW_DESTROY(self, self.OnDestroy) - + self.init = True - def OnDraw(self,event): + def OnDraw(self, event): self.SetCurrent() if not self.init: @@ -729,46 +728,46 @@ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glLoadIdentity() - + # Draw the spiral in 'immediate mode' # WARNING: You should not be doing the spiral calculation inside the loop # even if you are using glBegin/glEnd, sin/cos are fairly expensive functions # I've left it here as is to make the code simpler. radius = 1.0 - x = radius*math.sin(0) - y = radius*math.cos(0) + x = radius * math.sin(0) + y = radius * math.cos(0) glColor(0.0, 1.0, 0.0) glBegin(GL_LINE_STRIP) for deg in xrange(1000): glVertex(x, y, 0.0) rad = math.radians(deg) radius -= 0.001 - x = radius*math.sin(rad) - y = radius*math.cos(rad) + x = radius * math.sin(rad) + y = radius * math.cos(rad) glEnd() - + glEnableClientState(GL_VERTEX_ARRAY) - + spiral_array = [] - + # Second Spiral using "array immediate mode" (i.e. Vertex Arrays) radius = 0.8 - x = radius*math.sin(0) - y = radius*math.cos(0) + x = radius * math.sin(0) + y = radius * math.cos(0) glColor(1.0, 0.0, 0.0) for deg in xrange(820): - spiral_array.append([x,y]) + spiral_array.append([x, y]) rad = math.radians(deg) radius -= 0.001 - x = radius*math.sin(rad) - y = radius*math.cos(rad) + x = radius * math.sin(rad) + y = radius * math.cos(rad) glVertexPointerf(spiral_array) glDrawArrays(GL_LINE_STRIP, 0, len(spiral_array)) glFlush() self.SwapBuffers() return - + def InitGL(self): ''' Initialize GL @@ -795,71 +794,70 @@ except: width = event.GetSize().width height = event.GetSize().height - + self.Refresh() self.Update() def OnMouseMotion(self, event): x = event.GetX() y = event.GetY() - + def OnDestroy(self, event): print "Destroying Window" - class Lines: + """Lines class.""" - def __init__(self, linewidth=3, vertices = None, colors = None): + def __init__(self, linewidth=3, vertices=None, colors=None): self.name = 'Lines' self.n_vert_per_elem = 2 self.linewidth = linewidth self.c_highl = 0.3 - self.detectwidth = 0.1 #m + self.detectwidth = 0.1 # m self.set_attrs(vertices, colors) - + def set_attrs(self, vertices, colors): - + self.vertices = np.array(vertices, dtype=np.float32) self._update_vertexvbo() - + self.colors = np.array(colors, dtype=np.float32) - self.colors_highl = np.zeros((len(colors),4), dtype=np.float32) + self.colors_highl = np.zeros((len(colors), 4), dtype=np.float32) self._update_colorvbo() - + def _update_vertexvbo(self): - self._vertexvbo = vbo.VBO(self.vertices.reshape((-1,3))) - self._indexvbo = vbo.VBO(np.arange(self.n_vert_per_elem*len(self.vertices),dtype=np.int32), target=GL_ELEMENT_ARRAY_BUFFER) + self._vertexvbo = vbo.VBO(self.vertices.reshape((-1, 3))) + self._indexvbo = vbo.VBO(np.arange( + self.n_vert_per_elem * len(self.vertices), dtype=np.int32), target=GL_ELEMENT_ARRAY_BUFFER) def _update_colorvbo(self): #self._colorvbo = vbo.VBO( np.resize( np.repeat(np.clip((self.colors+self.c_highl*self.colors_highl) ,0.0,1.0), self.n_vert_per_elem),(len(self.colors),4)) ) - self._colorvbo = vbo.VBO(np.clip((self.colors+self.colors_highl)[np.array(np.arange(0,len(self.colors),1.0/self.n_vert_per_elem),int)],0.0,1.0)) - - - def pick(self,p): + self._colorvbo = vbo.VBO(np.clip((self.colors + self.colors_highl)[np.array( + np.arange(0, len(self.colors), 1.0 / self.n_vert_per_elem), int)], 0.0, 1.0)) + + def pick(self, p): """ Returns a binary vector which is True values for lines that have been selected by point p. - + In particular, an element of this vector is True if the minimum distance between the respective line to point p is less than self.detectwidth """ - x1 = self.vertices[:,0,0] - y1 = self.vertices[:,0,1] - - x2 = self.vertices[:,1,0] - y2 = self.vertices[:,1,1] - - - return get_dist_point_to_segs(p,x1,y1,x2,y2, is_ending=True) < self.detectwidth**2 + x1 = self.vertices[:, 0, 0] + y1 = self.vertices[:, 0, 1] + + x2 = self.vertices[:, 1, 0] + y2 = self.vertices[:, 1, 1] + + return get_dist_point_to_segs(p, x1, y1, x2, y2, is_ending=True) < self.detectwidth**2 - def highlight(self, inds_highl): - self.colors_highl = np.repeat(self.c_highl*np.array(inds_highl,dtype = np.float32),4).reshape(-1,4) + self.colors_highl = np.repeat( + self.c_highl * np.array(inds_highl, dtype=np.float32), 4).reshape(-1, 4) self._update_colorvbo() - - + def draw(self): glLineWidth(self.linewidth) @@ -868,18 +866,17 @@ glEnableClientState(GL_VERTEX_ARRAY) glEnableClientState(GL_COLOR_ARRAY) - - + self._colorvbo.bind() glColorPointer(4, GL_FLOAT, 0, None) - + self._vertexvbo.bind() self._indexvbo.bind() glVertexPointer(3, GL_FLOAT, 0, None) - - glDrawElements(GL_LINES, self.n_vert_per_elem*len(self.vertices), GL_UNSIGNED_INT, None) - + glDrawElements(GL_LINES, self.n_vert_per_elem * + len(self.vertices), GL_UNSIGNED_INT, None) + glDisableClientState(GL_VERTEX_ARRAY) glDisableClientState(GL_COLOR_ARRAY) self._vertexvbo.unbind() @@ -888,36 +885,32 @@ class Rectangles(Lines): - - def __init__(self, linewidth=3, vertices = None, colors = None): + + def __init__(self, linewidth=3, vertices=None, colors=None): self.name = 'Rectangles' self.n_vert_per_elem = 4 - self.c_highl= 0.3 - self.detectwidth = 0.1 #m + self.c_highl = 0.3 + self.detectwidth = 0.1 # m self.linewidth = linewidth - + self.set_attrs(vertices, colors) - - - - def pick(self,p): - - x1 = self.vertices[:,0,0] - y1 = self.vertices[:,0,1] - - x2 = self.vertices[:,1,0] - y2 = self.vertices[:,1,1] - - x3 = self.vertices[:,2,0] - y3 = self.vertices[:,2,1] - - x4 = self.vertices[:,3,0] - y4 = self.vertices[:,3,1] - - return is_inside_triangles(p,x1,y1,x2,y2,x3,y3) | is_inside_triangles(p,x1,y1,x3,y3,x4,y4) - - + def pick(self, p): + + x1 = self.vertices[:, 0, 0] + y1 = self.vertices[:, 0, 1] + + x2 = self.vertices[:, 1, 0] + y2 = self.vertices[:, 1, 1] + + x3 = self.vertices[:, 2, 0] + y3 = self.vertices[:, 2, 1] + + x4 = self.vertices[:, 3, 0] + y4 = self.vertices[:, 3, 1] + + return is_inside_triangles(p, x1, y1, x2, y2, x3, y3) | is_inside_triangles(p, x1, y1, x3, y3, x4, y4) + def draw(self): glLineWidth(self.linewidth) @@ -926,44 +919,40 @@ glEnableClientState(GL_VERTEX_ARRAY) glEnableClientState(GL_COLOR_ARRAY) - - + self._colorvbo.bind() glColorPointer(4, GL_FLOAT, 0, None) - + self._vertexvbo.bind() self._indexvbo.bind() glVertexPointer(3, GL_FLOAT, 0, None) - - glDrawElements(GL_QUADS, self.n_vert_per_elem*len(self.vertices), GL_UNSIGNED_INT, None) - + + glDrawElements(GL_QUADS, self.n_vert_per_elem * + len(self.vertices), GL_UNSIGNED_INT, None) + glDisableClientState(GL_VERTEX_ARRAY) glDisableClientState(GL_COLOR_ARRAY) self._vertexvbo.unbind() self._indexvbo.unbind() self._colorvbo.unbind() + class Triangles(Lines): + """Triangles class.""" - def __init__(self, linewidth=3, vertices = None, colors = None): - self.name = 'Triangles'#,self.__name__ + def __init__(self, linewidth=3, vertices=None, colors=None): + self.name = 'Triangles' # ,self.__name__ self.n_vert_per_elem = 3 - self.c_highl= 0.3 - self.detectwidth = 0.1 #m + self.c_highl = 0.3 + self.detectwidth = 0.1 # m self.linewidth = linewidth - + self.set_attrs(vertices, colors) - - - - def pick(self,p): - return is_inside_triangles(p,self.vertices[:,0,0],self.vertices[:,0,1], self.vertices[:,1,0],self.vertices[:,1,1],self.vertices[:,2,0],self.vertices[:,2,1]) - - - - + def pick(self, p): + return is_inside_triangles(p, self.vertices[:, 0, 0], self.vertices[:, 0, 1], self.vertices[:, 1, 0], self.vertices[:, 1, 1], self.vertices[:, 2, 0], self.vertices[:, 2, 1]) + def draw(self): glLineWidth(self.linewidth) @@ -972,16 +961,16 @@ glEnableClientState(GL_VERTEX_ARRAY) glEnableClientState(GL_COLOR_ARRAY) - - + self._colorvbo.bind() glColorPointer(4, GL_FLOAT, 0, None) - + self._vertexvbo.bind() self._indexvbo.bind() glVertexPointer(3, GL_FLOAT, 0, None) - - glDrawElements(GL_TRIANGLES, self.n_vert_per_elem*len(self.vertices), GL_UNSIGNED_INT, None) + + glDrawElements(GL_TRIANGLES, self.n_vert_per_elem * + len(self.vertices), GL_UNSIGNED_INT, None) glDisableClientState(GL_VERTEX_ARRAY) glDisableClientState(GL_COLOR_ARRAY) @@ -989,50 +978,36 @@ self._indexvbo.unbind() self._colorvbo.unbind() - - - - - - - - - - - - - - class GLFrame(wx.Frame): + """A simple class for using OpenGL with wxPython.""" def __init__(self, parent, id=-1, title='', pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, - name='frame',mainframe = None): - + name='frame', mainframe=None): + print '\n\nGLFrame!!' if mainframe == None: self._mainframe = parent else: self._mainframe = mainframe - + self._elements = [] self.elements_selected = [] - + self.eyex = 0.0 self.eyey = 0.0 self.eyez = -9.0 - - + self.centerx = 0.0 self.centery = 0.0 self.centerz = 0.0 - + self.upx = -1.0 self.upy = 0.0 self.upz = 0.0 - + self.g_Width = 600 self.g_Height = 600 @@ -1056,13 +1031,14 @@ # Should this include styles passed? style = wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE - super(GLFrame, self).__init__(parent, id, title, pos, size, style, name) + super(GLFrame, self).__init__( + parent, id, title, pos, size, style, name) #wx.Frame.__init__(self, parent, id, title, pos, size, style, name) - + self.GLinitialized = False - attribList = (glcanvas.WX_GL_RGBA, # RGBA - glcanvas.WX_GL_DOUBLEBUFFER, # Double Buffered - glcanvas.WX_GL_DEPTH_SIZE, 24) # 24 bit + attribList = (glcanvas.WX_GL_RGBA, # RGBA + glcanvas.WX_GL_DOUBLEBUFFER, # Double Buffered + glcanvas.WX_GL_DEPTH_SIZE, 24) # 24 bit # # Create the canvas @@ -1070,26 +1046,24 @@ # # Set the event handlers. - self.canvas.Bind(wx.EVT_ERASE_BACKGROUND, self.processEraseBackgroundEvent) + self.canvas.Bind(wx.EVT_ERASE_BACKGROUND, + self.processEraseBackgroundEvent) self.canvas.Bind(wx.EVT_SIZE, self.processSizeEvent) self.canvas.Bind(wx.EVT_PAINT, self.processPaintEvent) - + self.canvas.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) self.canvas.Bind(wx.EVT_LEFT_UP, self.OnLeftUp) self.canvas.Bind(wx.EVT_MOTION, self.OnMotion) self.canvas.Bind(wx.EVT_MOUSEWHEEL, self.OnWheel) - + self.Show() # this is needed to initialize GL projections for unproject wx.CallAfter(self.processSizeEvent) - - - - def add_element(self,element): + def add_element(self, element): self._elements.append(element) self.OnDraw() - + def resetView(): self.zoom = 65. self.xRotate = 0. @@ -1098,48 +1072,44 @@ self.xTrans = 0. self.yTrans = 0. self.OnDraw() - - - + def OnWheel(self, event): #EventType = FloatCanvas.EVT_FC_MOUSEWHEEL - # + # Rot = event.GetWheelRotation() - #print 'OnWheel!!',Rot,event.ControlDown(),event.ShiftDown() - if event.ControlDown():#event.ControlDown(): # zoom + # print 'OnWheel!!',Rot,event.ControlDown(),event.ShiftDown() + if event.ControlDown(): # event.ControlDown(): # zoom if Rot < 0: self.zoom *= 0.9 else: self.zoom *= 1.1 self.OnDraw() event.Skip() - + def OnLeftDown(self, event): ## - if (event.ControlDown()&event.ShiftDown())&(self.action == ''): - self.action = 'drag' - self.BeginGrap(event) - event.Skip() - + if (event.ControlDown() & event.ShiftDown()) & (self.action == ''): + self.action = 'drag' + self.BeginGrap(event) + event.Skip() + def OnLeftUp(self, event): - if self.action=='drag': - self.EndGrap(event) - self.action=='' - event.Skip() - + if self.action == 'drag': + self.EndGrap(event) + self.action == '' + event.Skip() + def get_intersection(self, v_near, v_far): - # 150918 + # 150918 # idea from http://www.bfilipek.com/2012/06/select-mouse-opengl.html # https://en.wikipedia.org/wiki/Line%E2%80%93plane_intersection d = -v_near + v_far - - t = -v_near[2]/d[2] - v_inter = v_near+t*d - + + t = -v_near[2] / d[2] + v_inter = v_near + t * d + return v_inter - - - + def OnMotion(self, event): p = self.unproject(event)[0:2] @@ -1148,69 +1118,62 @@ element.highlight(inds_pick) self.OnDraw() - - if (event.ControlDown()&event.ShiftDown()&(self.action=='drag')): - self.MoveGrap(event) - self.OnDraw() - event.Skip() - - elif (self.action=='drag'): - self.EndGrap(event) - self.action=='' - event.Skip() - - - + + if (event.ControlDown() & event.ShiftDown() & (self.action == 'drag')): + self.MoveGrap(event) + self.OnDraw() + event.Skip() + + elif (self.action == 'drag'): + self.EndGrap(event) + self.action == '' + event.Skip() + def unproject(self, event): """Get the world coordinates for viewCoordinate for the event """ - mousex,mousey = event.GetPosition() + mousex, mousey = event.GetPosition() x = mousex - y = self.g_Height-mousey - + y = self.g_Height - mousey + modelviewmatrix = glGetDoublev(GL_MODELVIEW_MATRIX) projectionmatrix = glGetDoublev(GL_PROJECTION_MATRIX) viewport = glGetInteger(GL_VIEWPORT) - z=0.0 + z = 0.0 worldCoordinate_near = np.array(gluUnProject( - x,y,z, + x, y, z, modelviewmatrix, projectionmatrix, - viewport,),dtype=np.float32) - z=1.0 + viewport,), dtype=np.float32) + z = 1.0 worldCoordinate_far = np.array(gluUnProject( - x,y,z, + x, y, z, modelviewmatrix, projectionmatrix, - viewport,),dtype=np.float32) - - v_inter = self.get_intersection(worldCoordinate_near,worldCoordinate_far) + viewport,), dtype=np.float32) + + v_inter = self.get_intersection( + worldCoordinate_near, worldCoordinate_far) return v_inter - - - - - def BeginGrap(self,event): - - self.xStart,self.yStart = event.GetPosition() - #print 'BeginGrap',self.xStart,self.yStart - - def MoveGrap(self,event): - x,y = event.GetPosition() - - self.xTrans += x-self.xStart - self.yTrans += y-self.yStart - #print 'MoveGrap',self.xTrans,self.yTrans - self.xStart,self.yStart = x,y - - - + def BeginGrap(self, event): + + self.xStart, self.yStart = event.GetPosition() + # print 'BeginGrap',self.xStart,self.yStart + + def MoveGrap(self, event): + x, y = event.GetPosition() + + self.xTrans += x - self.xStart + self.yTrans += y - self.yStart + # print 'MoveGrap',self.xTrans,self.yTrans + self.xStart, self.yStart = x, y + def EndGrap(self, event): - #print 'EndGrap' + # print 'EndGrap' self.canvas.SetCursor(wx.NullCursor) - self.action='' - + self.action = '' + # # Canvas Proxy Methods @@ -1227,7 +1190,7 @@ def processEraseBackgroundEvent(self, event): """Process the erase background event.""" - pass # Do nothing, to avoid flashing on MSWin + pass # Do nothing, to avoid flashing on MSWin def processSizeEvent(self, event=None): """Process the resize event.""" @@ -1239,7 +1202,8 @@ size = self.GetGLExtents() self.OnReshape(size.width, size.height) self.canvas.Refresh(False) - if event:event.Skip() + if event: + event.Skip() def processPaintEvent(self, event): """Process the drawing event.""" @@ -1259,7 +1223,6 @@ def OnInitGL(self): """Initialize OpenGL for use in the window.""" glClearColor(0, 0, 0, 1) - def OnReshape(self, width, height): """Reshape the OpenGL viewport based on the dimensions of the window.""" @@ -1274,16 +1237,16 @@ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # Set up viewing transformation, looking down -Z axis glLoadIdentity() - gluLookAt(self.eyex, self.eyey, self.eyez, self.centerx,self.centery, self.centerz, self.upx, self.upy, self.upz) #-.1,0,0 - + gluLookAt(self.eyex, self.eyey, self.eyez, self.centerx, self.centery, + self.centerz, self.upx, self.upy, self.upz) # -.1,0,0 # Set perspective (also zoom) glMatrixMode(GL_PROJECTION) glLoadIdentity() # the window corner OpenGL coordinates are (-+1, -+1) glOrtho(-1, 1, 1, -1, -1, 1) - - aspect = float(self.g_Width)/float(self.g_Height) + + aspect = float(self.g_Width) / float(self.g_Height) gluPerspective(self.zoom, aspect, self.g_nearPlane, self.g_farPlane) glMatrixMode(GL_MODELVIEW) @@ -1291,42 +1254,41 @@ # draw actual scene for element in self._elements: - element.draw() - + element.draw() self.SwapBuffers() - + def polarView(self): - glTranslatef( self.yTrans/100., 0.0, 0.0 ) - glTranslatef( 0.0, -self.xTrans/100., 0.0) - glRotatef( -self.zRotate, 0.0, 0.0, 1.0) - glRotatef( -self.xRotate, 1.0, 0.0, 0.0) - glRotatef( -self.yRotate, .0, 1.0, 0.0) + glTranslatef(self.yTrans / 100., 0.0, 0.0) + glTranslatef(0.0, -self.xTrans / 100., 0.0) + glRotatef(-self.zRotate, 0.0, 0.0, 1.0) + glRotatef(-self.xRotate, 1.0, 0.0, 0.0) + glRotatef(-self.yRotate, .0, 1.0, 0.0) class WxGLTest2(glcanvas.GLCanvas): - def __init__(self, parent, mainframe = None): + + def __init__(self, parent, mainframe=None): if mainframe == None: self._mainframe = parent else: self._mainframe = mainframe - + self._elements = [] self.elements_selected = [] - + self.eyex = 0.0 self.eyey = 0.0 self.eyez = -9.0 - - + self.centerx = 0.0 self.centery = 0.0 self.centerz = 0.0 - + self.upx = -1.0 self.upy = 0.0 self.upz = 0.0 - + self.g_Width = 600 self.g_Height = 600 @@ -1350,18 +1312,15 @@ # Should this include styles passed? style = wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE - attribList = (glcanvas.WX_GL_RGBA, # RGBA - glcanvas.WX_GL_DOUBLEBUFFER, # Double Buffered - glcanvas.WX_GL_DEPTH_SIZE, 24) # 24 bit - + attribList = (glcanvas.WX_GL_RGBA, # RGBA + glcanvas.WX_GL_DOUBLEBUFFER, # Double Buffered + glcanvas.WX_GL_DEPTH_SIZE, 24) # 24 bit - glcanvas.GLCanvas.__init__(self, parent,-1, attribList=attribList) + glcanvas.GLCanvas.__init__(self, parent, -1, attribList=attribList) #super(WxGLTest2, self).__init__(parent,-1, attribList=attribList) - + self.GLinitialized = False - - - + ### # Forcing a specific style on the window. # Should this include styles passed? @@ -1369,28 +1328,25 @@ #super(GLFrame, self).__init__(parent, id, title, pos, size, style, name) #wx.Frame.__init__(self, parent, id, title, pos, size, style, name) - - + # # Set the event handlers. self.Bind(wx.EVT_ERASE_BACKGROUND, self.processEraseBackgroundEvent) self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_PAINT, self.processPaintEvent) - + self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp) self.Bind(wx.EVT_MOTION, self.OnMotion) self.Bind(wx.EVT_MOUSEWHEEL, self.OnWheel) - - + # this is needed to initialize GL projections for unproject wx.CallAfter(self.OnSize) - - def add_element(self,element): + def add_element(self, element): self._elements.append(element) self.OnDraw() - + def resetView(): self.zoom = 65. self.xRotate = 0. @@ -1399,48 +1355,44 @@ self.xTrans = 0. self.yTrans = 0. self.OnDraw() - - - + def OnWheel(self, event): #EventType = FloatCanvas.EVT_FC_MOUSEWHEEL - # + # Rot = event.GetWheelRotation() - #print 'OnWheel!!',Rot,event.ControlDown(),event.ShiftDown() - if event.ControlDown():#event.ControlDown(): # zoom + # print 'OnWheel!!',Rot,event.ControlDown(),event.ShiftDown() + if event.ControlDown(): # event.ControlDown(): # zoom if Rot < 0: self.zoom *= 0.9 else: self.zoom *= 1.1 self.OnDraw() event.Skip() - + def OnLeftDown(self, event): ## - if (event.ControlDown()&event.ShiftDown())&(self.action == ''): - self.action = 'drag' - self.BeginGrap(event) - event.Skip() - + if (event.ControlDown() & event.ShiftDown()) & (self.action == ''): + self.action = 'drag' + self.BeginGrap(event) + event.Skip() + def OnLeftUp(self, event): - if self.action=='drag': - self.EndGrap(event) - self.action=='' - event.Skip() - + if self.action == 'drag': + self.EndGrap(event) + self.action == '' + event.Skip() + def get_intersection(self, v_near, v_far): - # 150918 + # 150918 # idea from http://www.bfilipek.com/2012/06/select-mouse-opengl.html # https://en.wikipedia.org/wiki/Line%E2%80%93plane_intersection d = -v_near + v_far - - t = -v_near[2]/d[2] - v_inter = v_near+t*d - + + t = -v_near[2] / d[2] + v_inter = v_near + t * d + return v_inter - - - + def OnMotion(self, event): p = self.unproject(event)[0:2] @@ -1449,69 +1401,62 @@ element.highlight(inds_pick) self.OnDraw() - - if (event.ControlDown()&event.ShiftDown()&(self.action=='drag')): - self.MoveGrap(event) - self.OnDraw() - event.Skip() - - elif (self.action=='drag'): - self.EndGrap(event) - self.action=='' - event.Skip() - - - + + if (event.ControlDown() & event.ShiftDown() & (self.action == 'drag')): + self.MoveGrap(event) + self.OnDraw() + event.Skip() + + elif (self.action == 'drag'): + self.EndGrap(event) + self.action == '' + event.Skip() + def unproject(self, event): """Get the world coordinates for viewCoordinate for the event """ - mousex,mousey = event.GetPosition() + mousex, mousey = event.GetPosition() x = mousex - y = self.g_Height-mousey - + y = self.g_Height - mousey + modelviewmatrix = glGetDoublev(GL_MODELVIEW_MATRIX) projectionmatrix = glGetDoublev(GL_PROJECTION_MATRIX) viewport = glGetInteger(GL_VIEWPORT) - z=0.0 + z = 0.0 worldCoordinate_near = np.array(gluUnProject( - x,y,z, + x, y, z, modelviewmatrix, projectionmatrix, - viewport,),dtype=np.float32) - z=1.0 + viewport,), dtype=np.float32) + z = 1.0 worldCoordinate_far = np.array(gluUnProject( - x,y,z, + x, y, z, modelviewmatrix, projectionmatrix, - viewport,),dtype=np.float32) - - v_inter = self.get_intersection(worldCoordinate_near,worldCoordinate_far) + viewport,), dtype=np.float32) + + v_inter = self.get_intersection( + worldCoordinate_near, worldCoordinate_far) return v_inter - - - - - def BeginGrap(self,event): - - self.xStart,self.yStart = event.GetPosition() - #print 'BeginGrap',self.xStart,self.yStart - - def MoveGrap(self,event): - x,y = event.GetPosition() - - self.xTrans += x-self.xStart - self.yTrans += y-self.yStart - #print 'MoveGrap',self.xTrans,self.yTrans - self.xStart,self.yStart = x,y - - - + def BeginGrap(self, event): + + self.xStart, self.yStart = event.GetPosition() + # print 'BeginGrap',self.xStart,self.yStart + + def MoveGrap(self, event): + x, y = event.GetPosition() + + self.xTrans += x - self.xStart + self.yTrans += y - self.yStart + # print 'MoveGrap',self.xTrans,self.yTrans + self.xStart, self.yStart = x, y + def EndGrap(self, event): - #print 'EndGrap' + # print 'EndGrap' self.SetCursor(wx.NullCursor) - self.action='' - + self.action = '' + # # Canvas Proxy Methods @@ -1519,7 +1464,7 @@ """Get the extents of the OpenGL canvas.""" return self.GetClientSize() - #def SwapBuffers(self): + # def SwapBuffers(self): # """Swap the OpenGL buffers.""" # self.SwapBuffers() @@ -1528,9 +1473,9 @@ def processEraseBackgroundEvent(self, event): """Process the erase background event.""" - pass # Do nothing, to avoid flashing on MSWin + pass # Do nothing, to avoid flashing on MSWin - def OnSize(self, event = None, win = None): + def OnSize(self, event=None, win=None): """Process the resize event.""" if self.GetContext(): # Make sure the frame is shown before calling SetCurrent. @@ -1540,7 +1485,8 @@ size = self.GetGLExtents() self.OnReshape(size.width, size.height) self.Refresh(False) - if event:event.Skip() + if event: + event.Skip() def processPaintEvent(self, event): """Process the drawing event.""" @@ -1560,7 +1506,6 @@ def OnInitGL(self): """Initialize OpenGL for use in the window.""" glClearColor(0, 0, 0, 1) - def OnReshape(self, width, height): """Reshape the OpenGL viewport based on the dimensions of the window.""" @@ -1575,16 +1520,16 @@ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # Set up viewing transformation, looking down -Z axis glLoadIdentity() - gluLookAt(self.eyex, self.eyey, self.eyez, self.centerx,self.centery, self.centerz, self.upx, self.upy, self.upz) #-.1,0,0 - + gluLookAt(self.eyex, self.eyey, self.eyez, self.centerx, self.centery, + self.centerz, self.upx, self.upy, self.upz) # -.1,0,0 # Set perspective (also zoom) glMatrixMode(GL_PROJECTION) glLoadIdentity() # the window corner OpenGL coordinates are (-+1, -+1) glOrtho(-1, 1, 1, -1, -1, 1) - - aspect = float(self.g_Width)/float(self.g_Height) + + aspect = float(self.g_Width) / float(self.g_Height) gluPerspective(self.zoom, aspect, self.g_nearPlane, self.g_farPlane) glMatrixMode(GL_MODELVIEW) @@ -1592,507 +1537,477 @@ # draw actual scene for element in self._elements: - element.draw() - # causes bad things :AttributeError: 'Implementation' object has no attribute 'glGenBuffers' - - + element.draw() + # causes bad things :AttributeError: 'Implementation' object has no + # attribute 'glGenBuffers' self.SwapBuffers() - + def polarView(self): - glTranslatef( self.yTrans/100., 0.0, 0.0 ) - glTranslatef( 0.0, -self.xTrans/100., 0.0) - glRotatef( -self.zRotate, 0.0, 0.0, 1.0) - glRotatef( -self.xRotate, 1.0, 0.0, 0.0) - glRotatef( -self.yRotate, .0, 1.0, 0.0) - + glTranslatef(self.yTrans / 100., 0.0, 0.0) + glTranslatef(0.0, -self.xTrans / 100., 0.0) + glRotatef(-self.zRotate, 0.0, 0.0, 1.0) + glRotatef(-self.xRotate, 1.0, 0.0, 0.0) + glRotatef(-self.yRotate, .0, 1.0, 0.0) + class GlEditorSash(wx.SplitterWindow): - - def __init__(self,parent, - mainframe = None, - size = wx.DefaultSize, - is_menu=False, # create menu items - Debug = 0, - ): - - - - + + def __init__(self, parent, + mainframe=None, + size=wx.DefaultSize, + is_menu=False, # create menu items + Debug=0, + ): + wx.SplitterWindow.__init__(self, parent, wx.ID_ANY, - style = wx.SP_LIVE_UPDATE, - size = size) + style=wx.SP_LIVE_UPDATE, + size=size) self.log = log - + self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.OnSashChanged) self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGING, self.OnSashChanging) - #id=wx.ID_ANY - #pixel_snap=10 # radius in pixels in which a point is selected - #n_test=5 - #wx.Window.__init__(self,parent,id,wx.DefaultPosition,wx.DefaultSize,wx.SUNKEN_BORDER|wx.WANTS_CHARS) - #wx.Panel.__init__(self,parent,id,wx.DefaultPosition,size,wx.SUNKEN_BORDER|wx.WANTS_CHARS) - #self.parent=parent - self._mainframe=mainframe# mainframe + # id=wx.ID_ANY + # pixel_snap=10 # radius in pixels in which a point is selected + # n_test=5 + # wx.Window.__init__(self,parent,id,wx.DefaultPosition,wx.DefaultSize,wx.SUNKEN_BORDER|wx.WANTS_CHARS) + # wx.Panel.__init__(self,parent,id,wx.DefaultPosition,size,wx.SUNKEN_BORDER|wx.WANTS_CHARS) + # self.parent=parent + self._mainframe = mainframe # mainframe #splitter = Splitter(self) - - - self._toolspanel = ToolPalett(self) - self._toolspanel.add_tool(BaseTool(self)) - #sty = wx.BORDER_SUNKEN + + self._toolspanel = ToolPalett(self) + self._toolspanel.add_tool(BaseTool(self)) + #sty = wx.BORDER_SUNKEN #self._toolspanel = wx.Window(self, style=sty) - #self._toolspanel.SetBackgroundColour("pink") + # self._toolspanel.SetBackgroundColour("pink") #wx.StaticText(self._toolspanel, -1, "Object", (50,50)) - + self._canvas = WxGLTest2(self) #p2 = wx.Window(self, style=sty) - #p2.SetBackgroundColour("blue") + # p2.SetBackgroundColour("blue") #wx.StaticText(p2, -1, "GLeditor", (50,50)) - + #self.canvas = wx.Window(splitter, style=sty) - #self.canvas.SetBackgroundColour("green") + # self.canvas.SetBackgroundColour("green") #wx.StaticText(self.canvas, -1, "Panel two", (50,50)) - + #self.canvas = WxGLTest2(splitter) #self.canvas = WxGLTest_orig(splitter) - - + #nbpanel = wx.Panel(splitter) #self._viewtabs = wx.Notebook(nbpanel,wx.ID_ANY, style=wx.CLIP_CHILDREN) #sizer = wx.BoxSizer(wx.VERTICAL) #sizer.Add(self._viewtabs, 1, wx.ALL|wx.EXPAND, 5) - #nbpanel.SetSizer(sizer) - #self.Layout() - + # nbpanel.SetSizer(sizer) + # self.Layout() + # finally, put the notebook in a sizer for the panel to manage # the layout #sizer = wx.BoxSizer() #sizer.Add(self._viewtabs, 1, wx.EXPAND) - #self.SetSizer(sizer) - + # self.SetSizer(sizer) + self.SetMinimumPaneSize(20) #splitter.SplitVertically(p1, self.canvas, -100) self.SplitVertically(self._toolspanel, self._canvas, -100) - + #wx.EVT_SIZE (self, self.on_size) self.SetSashPosition(500, True) - #sizer=wx.BoxSizer(wx.VERTICAL) - #sizer.Add(p1,0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4)# from NaviPanelTest - #sizer.Add(self.canvas,1,wx.GROW)# from NaviPanelTest - + # sizer=wx.BoxSizer(wx.VERTICAL) + # sizer.Add(p1,0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4)# from NaviPanelTest + # sizer.Add(self.canvas,1,wx.GROW)# from NaviPanelTest + # finish panel setup - #self.SetSizer(sizer) - #sizer.Fit(self) - #self.on_size() - #self.Show() - - + # self.SetSizer(sizer) + # sizer.Fit(self) + # self.on_size() + # self.Show() + def get_canvas(self): return self._canvas - + def OnSashChanged(self, evt): #print("sash changed to %s\n" % str(evt.GetSashPosition())) pass - + def OnSashChanging(self, evt): print("sash changing to %s\n" % str(evt.GetSashPosition())) # uncomment this to not allow the change - #evt.SetSashPosition(-1) - #evt.SetSashPosition(210) - #self.canvas.OnSize() + # evt.SetSashPosition(-1) + # evt.SetSashPosition(210) + # self.canvas.OnSize() pass - - def on_size(self,event=None): - #self.tc.SetSize(self.GetSize()) - #self.tc.SetSize(self.GetSize()) - #self._viewtabs.SetSize(self.GetSize()) - #pass + + def on_size(self, event=None): + # self.tc.SetSize(self.GetSize()) + # self.tc.SetSize(self.GetSize()) + # self._viewtabs.SetSize(self.GetSize()) + # pass #wx.LayoutAlgorithm().LayoutWindow(self, self.p1) #wx.LayoutAlgorithm().LayoutWindow(self, self.p1) - + # important: #wx.LayoutAlgorithm().LayoutWindow(self, self._viewtabs) - + if event: event.Skip() - - - + + class GlEditor(wx.Panel): - - def __init__(self,parent, - mainframe = None, - size = wx.DefaultSize, - is_menu=False, # create menu items - Debug = 0, - ): - - - - - wx.Panel.__init__(self, parent, wx.ID_ANY,size = size) - sizer=wx.BoxSizer(wx.HORIZONTAL) - - - self._mainframe=mainframe - self._toolspanel = ToolsPanel(self) + def __init__(self, parent, + mainframe=None, + size=wx.DefaultSize, + is_menu=False, # create menu items + Debug=0, + ): + + wx.Panel.__init__(self, parent, wx.ID_ANY, size=size) + sizer = wx.BoxSizer(wx.HORIZONTAL) + + self._mainframe = mainframe + + self._toolspanel = ToolsPanel(self) for i in range(5): self._toolspanel.add_tool(BaseTool(self)) - self._toolspanel.add_tool(DelTool(self)) - #sty = wx.BORDER_SUNKEN + self._toolspanel.add_tool(DelTool(self)) + #sty = wx.BORDER_SUNKEN #self._toolspanel = wx.Window(self, style=sty) - #self._toolspanel.SetBackgroundColour("pink") + # self._toolspanel.SetBackgroundColour("pink") #wx.StaticText(self._toolspanel, -1, "Object", (50,50)) - + self._canvas = WxGLTest2(self) #p2 = wx.Window(self, style=sty) - #p2.SetBackgroundColour("blue") + # p2.SetBackgroundColour("blue") #wx.StaticText(p2, -1, "GLeditor", (50,50)) - - - - sizer.Add(self._toolspanel,0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4)# from NaviPanelTest - sizer.Add(self._canvas,1,wx.GROW)# from NaviPanelTest - + + sizer.Add(self._toolspanel, 0, wx.ALL | wx.ALIGN_LEFT | + wx.GROW, 4) # from NaviPanelTest + sizer.Add(self._canvas, 1, wx.GROW) # from NaviPanelTest + # finish panel setup self.SetSizer(sizer) sizer.Fit(self) - + def get_canvas(self): return self._canvas - - - def on_size(self,event=None): - #self.tc.SetSize(self.GetSize()) - #self.tc.SetSize(self.GetSize()) - #self._viewtabs.SetSize(self.GetSize()) - #pass + + def on_size(self, event=None): + # self.tc.SetSize(self.GetSize()) + # self.tc.SetSize(self.GetSize()) + # self._viewtabs.SetSize(self.GetSize()) + # pass #wx.LayoutAlgorithm().LayoutWindow(self, self.p1) #wx.LayoutAlgorithm().LayoutWindow(self, self.p1) - + # important: #wx.LayoutAlgorithm().LayoutWindow(self, self._viewtabs) - + if event: event.Skip() - + + class MainSplitter(wx.SplitterWindow): + def __init__(self, parent, ID=-1): wx.SplitterWindow.__init__(self, parent, ID, - style = wx.SP_LIVE_UPDATE + style=wx.SP_LIVE_UPDATE ) - - - + self.SetMinimumPaneSize(20) - + #sty = wx.BORDER_SUNKEN - + emptyobj = cm.BaseObjman('empty') - self._objbrowser = objpanel.NaviPanel(self, - emptyobj, - #show_title = False - #size = w.DefaultSize, - #style = wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.RESIZE_BORDER, - #choose_id=False,choose_attr=False, - #func_choose_id=None, - #func_change_obj=None, - #panelstyle = 'default', - immediate_apply = False, - buttons = [], - standartbuttons = [], - #defaultbutton = defaultbutton, - ) - + self._objbrowser = objpanel.NaviPanel(self, + emptyobj, + #show_title = False + #size = w.DefaultSize, + #style = wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.RESIZE_BORDER, + # choose_id=False,choose_attr=False, + # func_choose_id=None, + # func_change_obj=None, + #panelstyle = 'default', + immediate_apply=False, + buttons=[], + standartbuttons=[], + #defaultbutton = defaultbutton, + ) + #p1 = wx.Window(splitter, style=sty) - #p1.SetBackgroundColour("pink") + # p1.SetBackgroundColour("pink") #wx.StaticText(p1, -1, "Object", (50,50)) - + #self.canvas = wx.Window(splitter, style=sty) - #self.canvas.SetBackgroundColour("green") + # self.canvas.SetBackgroundColour("green") #wx.StaticText(self.canvas, -1, "Panel two", (50,50)) #self.canvas = WxGLTest2(splitter) #self.canvas = WxGLTest_orig(splitter) - + #self._viewtabs = wx.Notebook(self,wx.ID_ANY, style=wx.CLIP_CHILDREN) - self._viewtabs = wx.Notebook(self, -1, size=(21,21), style=wx.BK_DEFAULT - #wx.BK_TOP - #wx.BK_BOTTOM - #wx.BK_LEFT - #wx.BK_RIGHT - # | wx.NB_MULTILINE - ) - + self._viewtabs = wx.Notebook(self, -1, size=(21, 21), style=wx.BK_DEFAULT + # wx.BK_TOP + # wx.BK_BOTTOM + # wx.BK_LEFT + # wx.BK_RIGHT + # | wx.NB_MULTILINE + ) + #nbpanel = wx.Panel(splitter) #self._viewtabs = wx.Notebook(nbpanel,wx.ID_ANY, style=wx.CLIP_CHILDREN) #sizer = wx.BoxSizer(wx.VERTICAL) #sizer.Add(self._viewtabs, 1, wx.ALL|wx.EXPAND, 5) - #nbpanel.SetSizer(sizer) - #self.Layout() - + # nbpanel.SetSizer(sizer) + # self.Layout() + # finally, put the notebook in a sizer for the panel to manage # the layout #sizer = wx.BoxSizer() #sizer.Add(self._viewtabs, 1, wx.EXPAND) - #self.SetSizer(sizer) - - + # self.SetSizer(sizer) + #splitter.SplitVertically(self._objbrowser,self.canvas , -100) self.SplitVertically(self._objbrowser, self._viewtabs, -100) - + self.SetSashPosition(500, True) self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.OnSashChanged) self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGING, self.OnSashChanging) - + def add_view(self, name, ViewClass, **args): """ Add a new view to the notebook. - """ - #print 'context.add_view',ViewClass - #print ' args',args - view=ViewClass(self._viewtabs, - mainframe = self.GetParent(), - **args - ) - - # Add network tab with editor - p=self._viewtabs.AddPage( view, name.title() ) + """ + # print 'context.add_view',ViewClass + # print ' args',args + view = ViewClass(self._viewtabs, + mainframe=self.GetParent(), + **args + ) + + # Add network tab with editor + p = self._viewtabs.AddPage(view, name.title()) #self._views[name] = view - #self._viewtabs.SetSelection(p) - #self._viewtabs.Show(True) + # self._viewtabs.SetSelection(p) + # self._viewtabs.Show(True) return view - - - + def OnSashChanged(self, evt): #print("sash changed to %s\n" % str(evt.GetSashPosition())) pass - + def OnSashChanging(self, evt): #print("sash changing to %s\n" % str(evt.GetSashPosition())) # uncomment this to not allow the change - #evt.SetSashPosition(-1) - #self.canvas.OnSize() + # evt.SetSashPosition(-1) + # self.canvas.OnSize() pass - + + class TestMainframe(AgileToolbarFrameMixin, wx.Frame): + """ Simple wx frame with some special features. """ - - def __init__(self, parent=None, id=-1, title ='mainframe', pos=wx.DefaultPosition, + def __init__(self, parent=None, id=-1, title='mainframe', pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, name='frame'): - - + # Forcing a specific style on the window. # Should this include styles passed? style = wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE - wx.Frame.__init__(self, parent, id, title, pos, size = size, style = style, name = name) + wx.Frame.__init__(self, parent, id, title, pos, + size=size, style=style, name=name) #super(GLFrame, self).__init__(parent, id, title, pos, size, style, name) self._splitter = MainSplitter(self) self._views = {} #wx.EVT_SIZE (self, self.on_size) - #sizer=wx.BoxSizer(wx.VERTICAL) - #sizer.Add(p1,0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4)# from NaviPanelTest - #sizer.Add(self.canvas,1,wx.GROW)# from NaviPanelTest - + # sizer=wx.BoxSizer(wx.VERTICAL) + # sizer.Add(p1,0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4)# from NaviPanelTest + # sizer.Add(self.canvas,1,wx.GROW)# from NaviPanelTest + # finish panel setup - #self.SetSizer(sizer) - #sizer.Fit(self) - #self.Show() - + # self.SetSizer(sizer) + # sizer.Fit(self) + # self.Show() + # this is needed to initialize GL projections for unproject - #wx.CallAfter(self.on_size) - + # wx.CallAfter(self.on_size) + #width,height = self.GetSize() #self._splitter.SetSashPosition(300, True) - #maximize the frame + # maximize the frame self.Maximize() - #self.CenterOnScreen() + # self.CenterOnScreen() ################################################################# # create statusbar #self.statusbar = AgileStatusbar(self) - self.statusbar =AgileStatusbar(self) + self.statusbar = AgileStatusbar(self) self.SetStatusBar(self.statusbar) - #self.count=0.0 + # self.count=0.0 + + ################################################################# + # create toolbar - ################################################################# - # create toolbar - - tsize = (16,16) - self.init_toolbar(size=tsize) - - #new_bmp = wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_TOOLBAR, tsize) + tsize = (16, 16) + self.init_toolbar(size=tsize) + + #new_bmp = wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_TOOLBAR, tsize) #open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, tsize) #save_bmp= wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE, wx.ART_TOOLBAR, tsize) #cut_bmp = wx.ArtProvider.GetBitmap(wx.ART_CUT, wx.ART_TOOLBAR, tsize) #copy_bmp = wx.ArtProvider.GetBitmap(wx.ART_COPY, wx.ART_TOOLBAR, tsize) #paste_bmp= wx.ArtProvider.GetBitmap(wx.ART_PASTE, wx.ART_TOOLBAR, tsize) - - - - #self.add_tool('new',self.on_open,new_bmp,'create new doc') - #self.add_tool('open',self.on_open,open_bmp,'Open doc') + + #self.add_tool('new',self.on_open,new_bmp,'create new doc') + #self.add_tool('open',self.on_open,open_bmp,'Open doc') #self.add_tool('save',self.on_save,save_bmp,'Save doc') - #self.toolbar.AddSeparator() - #self.add_tool('cut',self.on_open,cut_bmp,'Cut') - #self.add_tool('copy',self.on_open,copy_bmp,'Copy') - #self.add_tool('paste',self.on_open,paste_bmp,'Paste') - - - - #self.SetToolBar(self.toolbar) - + # self.toolbar.AddSeparator() + # self.add_tool('cut',self.on_open,cut_bmp,'Cut') + # self.add_tool('copy',self.on_open,copy_bmp,'Copy') + # self.add_tool('paste',self.on_open,paste_bmp,'Paste') + + # self.SetToolBar(self.toolbar) + ################################################################# - #create the menu bar - - self.menubar=AgileMenubar(self) + # create the menu bar + + self.menubar = AgileMenubar(self) self.menubar.append_menu('file') self.menubar.append_menu('file/doc') - - self.menubar.append_item('file/doc/open',self.on_open,\ - shortkey='Ctrl+o',info='open it out') - - self.menubar.append_item('file/doc/save',self.on_save,\ - shortkey='Ctrl+s',info='save it out') - - - - #self.menubar.append_menu('edit') - #self.menubar.append_item('edit/cut',self.cut,\ + self.menubar.append_item('file/doc/open', self.on_open, + shortkey='Ctrl+o', info='open it out') + + self.menubar.append_item('file/doc/save', self.on_save, + shortkey='Ctrl+s', info='save it out') + + # self.menubar.append_menu('edit') + # self.menubar.append_item('edit/cut',self.cut,\ # shortkey='Ctrl+c',info='cut it out') - - #self.menubar.append_item('edit/toggle',self.toggle_tools,\ + + # self.menubar.append_item('edit/toggle',self.toggle_tools,\ # shortkey='Ctrl+t',info='toggle tools') - #self.menubar.append_menu('tools') + # self.menubar.append_menu('tools') self.SetMenuBar(self.menubar) - #self.Show(True) #NO!! - + # self.Show(True) #NO!! + def add_view(self, name, ViewClass, **args): """ Add a new view to the notebook. - """ - #print 'context.add_view',ViewClass - #print ' args',args - - view=self._splitter.add_view(name, ViewClass, **args) + """ + # print 'context.add_view',ViewClass + # print ' args',args + + view = self._splitter.add_view(name, ViewClass, **args) self._views[name] = view - #self._viewtabs.SetSelection(p) - #self._splitter._viewtabs.Show(True) + # self._viewtabs.SetSelection(p) + # self._splitter._viewtabs.Show(True) return view - - - - - def on_size(self,event=None): + + def on_size(self, event=None): print 'Mainframe.on_size' - #self.tc.SetSize(self.GetSize()) - #self.tc.SetSize(self.GetSize()) - #self._viewtabs.SetSize(self.GetSize()) - #pass + # self.tc.SetSize(self.GetSize()) + # self.tc.SetSize(self.GetSize()) + # self._viewtabs.SetSize(self.GetSize()) + # pass #wx.LayoutAlgorithm().LayoutWindow(self, self.p1) #wx.LayoutAlgorithm().LayoutWindow(self, self.p1) - + # important: #wx.LayoutAlgorithm().LayoutWindow(self, self._viewtabs) wx.LayoutAlgorithm().LayoutWindow(self, self._splitter) if event: event.Skip() - def on_save(self,event): - print 'save it!!' - - + + def on_save(self, event): + print 'save it!!' def on_open(self, event): """Open a document""" #wildcards = CreateWildCards() + "All files (*.*)|*.*" - print 'open it!!' - + print 'open it!!' def destroy(self): """Destroy this object""" - ##self.theDocManager.theDestructor() + # self.theDocManager.theDestructor() #imgPreferences.saveXml(self.GetStartDirectory() + "/" + imgINI_FILE_NAME) ##del self.thePrint self.Destroy() - - + def on_close(self, event): - #self.Close(True) - #pass + # self.Close(True) + # pass self.destroy() - + def on_exit(self, event): """Called when the application is to be finished""" self.destroy() - - - def on_idle(self,event): + def on_idle(self, event): pass #self.count = self.count + 1 - #if self.count >= 100: + # if self.count >= 100: # self.count = 0 - - #self.statusbar.set_progress(self.count) - + + # self.statusbar.set_progress(self.count) + def on_about(self, event): """Display the information about this application""" #dlg = imgDlgAbout(self, -1, "") - #dlg.ShowModal() - #dlg.Destroy() + # dlg.ShowModal() + # dlg.Destroy() pass - - + + linewidth = 3 vertices = [ - [[0.0,0.0,0.0],[0.2,0.0,0.0]],# 0 green - [[0.0,0.0,0.0],[0.0,0.9,0.0]],# 1 red - ] + [[0.0, 0.0, 0.0], [0.2, 0.0, 0.0]], # 0 green + [[0.0, 0.0, 0.0], [0.0, 0.9, 0.0]], # 1 red +] colors = [ - [0.0,0.9,0.0,0.9], # 0 - [0.9,0.0,0.0,0.9], # 1 - ] -lines = Lines(linewidth=linewidth, vertices = vertices, colors = colors) + [0.0, 0.9, 0.0, 0.9], # 0 + [0.9, 0.0, 0.0, 0.9], # 1 +] +lines = Lines(linewidth=linewidth, vertices=vertices, colors=colors) linewidth2 = 3 vertices2 = [ - [[0.5,0.5,0.0],[0.7,0.5,0.0],[0.7,1.0,0.0]],# 0 green - [[0.8,0.5,0.0],[0.9,0.8,0.0],[0.8,0.2,0.0]],# 1 orange - ] + [[0.5, 0.5, 0.0], [0.7, 0.5, 0.0], [0.7, 1.0, 0.0]], # 0 green + [[0.8, 0.5, 0.0], [0.9, 0.8, 0.0], [0.8, 0.2, 0.0]], # 1 orange +] colors2 = [ - [0.0,0.9,0.3,0.9], # 0 - [0.9,0.3,0.0,0.9], # 1 - ] -triangles = Triangles(linewidth=linewidth2, vertices = vertices2, colors = colors2) + [0.0, 0.9, 0.3, 0.9], # 0 + [0.9, 0.3, 0.0, 0.9], # 1 +] +triangles = Triangles(linewidth=linewidth2, vertices=vertices2, colors=colors2) linewidth3 = 3 vertices3 = [ - [[0.5,0.0,0.0],[0.7,0.0,0.0],[0.7,0.3,0.0],[0.5,0.3,0.0],],# 0 - [[0.1,0.0,0.0],[0.3,0.0,0.0],[0.3,0.2,0.0],[0.1,0.2,0.0],],# 1 - ] + [[0.5, 0.0, 0.0], [0.7, 0.0, 0.0], + [0.7, 0.3, 0.0], [0.5, 0.3, 0.0], ], # 0 + [[0.1, 0.0, 0.0], [0.3, 0.0, 0.0], + [0.3, 0.2, 0.0], [0.1, 0.2, 0.0], ], # 1 +] colors3 = [ - [0.8,0.0,0.8,0.9], # 0 - [0.0,0.6,0.6,0.9], # 1 - ] -rectangles = Rectangles(linewidth=linewidth3, vertices = vertices3, colors = colors3) - + [0.8, 0.0, 0.8, 0.9], # 0 + [0.0, 0.6, 0.6, 0.9], # 1 +] +rectangles = Rectangles(linewidth=linewidth3, + vertices=vertices3, colors=colors3) + if __name__ == '__main__': - - app = wx.PySimpleApp() - + if 1: - + frame = TestMainframe() - gleditor = frame.add_view('GL Editor',GlEditor) + gleditor = frame.add_view('GL Editor', GlEditor) #gleditor = frame._splitter.add_view('GL Editor',GlEditor) frame.Show() frame.on_size() @@ -2100,8 +2015,8 @@ canvas.add_element(lines) canvas.add_element(triangles) canvas.add_element(rectangles) - + app.SetTopWindow(frame) app.MainLoop() - - app.Destroy() \ No newline at end of file + + app.Destroy() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/test_notebook.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/test_notebook.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/test_notebook.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/test_notebook.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,91 +1,97 @@ - + #import images import wx + class PanelOne(wx.Panel): + """ This will be the first notebook tab """ #---------------------------------------------------------------------- + def __init__(self, parent): """""" - + wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY) - + sizer = wx.BoxSizer(wx.VERTICAL) txtOne = wx.TextCtrl(self, wx.ID_ANY, "") txtTwo = wx.TextCtrl(self, wx.ID_ANY, "") - + sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(txtOne, 0, wx.ALL, 5) sizer.Add(txtTwo, 0, wx.ALL, 5) - + self.SetSizer(sizer) + class NestedPanel(wx.Panel): + """ This will be the first notebook tab """ #---------------------------------------------------------------------- + def __init__(self, parent): """""" - + wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY) - + sizer = wx.BoxSizer(wx.VERTICAL) - + # Create some nested tabs on the first tab nestedNotebook = wx.Notebook(self, wx.ID_ANY) nestedTabOne = PanelOne(nestedNotebook) nestedTabTwo = PanelOne(nestedNotebook) nestedNotebook.AddPage(nestedTabOne, "NestedTabOne") nestedNotebook.AddPage(nestedTabTwo, "NestedTabTwo") - + sizer = wx.BoxSizer(wx.VERTICAL) - sizer.Add(nestedNotebook, 1, wx.ALL|wx.EXPAND, 5) - + sizer.Add(nestedNotebook, 1, wx.ALL | wx.EXPAND, 5) + self.SetSizer(sizer) ######################################################################## class NestedNotebookDemo(wx.Notebook): + """ Notebook class """ - + #---------------------------------------------------------------------- def __init__(self, parent): - wx.Notebook.__init__(self, parent, id=wx.ID_ANY, style= - wx.BK_DEFAULT - #wx.BK_TOP - #wx.BK_BOTTOM - #wx.BK_LEFT - #wx.BK_RIGHT + wx.Notebook.__init__(self, parent, id=wx.ID_ANY, style=wx.BK_DEFAULT + # wx.BK_TOP + # wx.BK_BOTTOM + # wx.BK_LEFT + # wx.BK_RIGHT ) - + # Create the first tab and add it to the notebook tabOne = NestedPanel(self) self.AddPage(tabOne, "TabOne") - + # Show how to put an image on one of the notebook tabs, # first make the image list: il = wx.ImageList(16, 16) idx1 = il.Add(images.Smiles.GetBitmap()) self.AssignImageList(il) - + # now put an image on the first tab we just created: self.SetPageImage(0, idx1) - + # Create and add the second tab tabTwo = PanelOne(self) self.AddPage(tabTwo, "TabTwo") - + # Create and add the third tab self.AddPage(PanelOne(self), "TabThree") - + self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnPageChanged) self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnPageChanging) - + def OnPageChanged(self, event): old = event.GetOldSelection() new = event.GetSelection() @@ -100,32 +106,33 @@ print 'OnPageChanging, old:%d, new:%d, sel:%d\n' % (old, new, sel) event.Skip() - + ######################################################################## class DemoFrame(wx.Frame): + """ Frame that holds all other widgets """ #---------------------------------------------------------------------- def __init__(self): - """Constructor""" - wx.Frame.__init__(self, None, wx.ID_ANY, + """Constructor""" + wx.Frame.__init__(self, None, wx.ID_ANY, "Notebook Tutorial", - size=(600,400) + size=(600, 400) ) panel = wx.Panel(self) - + notebook = NestedNotebookDemo(panel) sizer = wx.BoxSizer(wx.VERTICAL) - sizer.Add(notebook, 1, wx.ALL|wx.EXPAND, 5) + sizer.Add(notebook, 1, wx.ALL | wx.EXPAND, 5) panel.SetSizer(sizer) self.Layout() - + self.Show() - + #---------------------------------------------------------------------- if __name__ == "__main__": app = wx.PySimpleApp() frame = DemoFrame() - app.MainLoop() \ No newline at end of file + app.MainLoop() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/toolbox.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/toolbox.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/toolbox.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/toolbox.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,137 +1,144 @@ -import sys,os, string,time -if __name__ == '__main__': +import sys +import os +import string +import time +if __name__ == '__main__': try: FILEDIR = os.path.dirname(os.path.abspath(__file__)) except: FILEDIR = os.path.dirname(os.path.abspath(sys.argv[0])) - sys.path.append(os.path.join(FILEDIR,"..","..")) + sys.path.append(os.path.join(FILEDIR, "..", "..")) -IMAGEDIR = os.path.join(os.path.dirname(__file__),"images") - -import wx +IMAGEDIR = os.path.join(os.path.dirname(__file__), "images") + +import wx from wx.lib.buttons import GenBitmapTextButton, GenBitmapButton from objpanel import ObjPanel, NaviPanel import agilepy.lib_base.classman as cm import agilepy.lib_base.arrayman as am + + class BaseTool(am.ArrayObjman): + """ This is a base tool class for Agilecanvas. It must handle all mouse or keyboard events, must create and draw helplines and finally modify the state of client which are grafically represented on the canvas. - """ - - def __init__(self,parent): + """ + + def __init__(self, parent): """ To be overridden by specific tool. """ - self.init_common( 'select',parent,'Selection tool', - info = 'Select objects in cancvas', - is_textbutton = True, - ) - - def set_button_info(self,bsize=(32,32)): - #print 'set_button_info select tool' - self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'selectIcon.bmp'),wx.BITMAP_TYPE_BMP) - self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'selectIconSel.bmp'),wx.BITMAP_TYPE_BMP) - + self.init_common('select', parent, 'Selection tool', + info='Select objects in cancvas', + is_textbutton=True, + ) + + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'selectIcon.bmp'), wx.BITMAP_TYPE_BMP) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'selectIconSel.bmp'), wx.BITMAP_TYPE_BMP) + def set_cursor(self): # http://www.wxpython.org/docs/api/wx.Cursor-class.html if self._canvas != None: - #self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_QUESTION_ARROW)) + # self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_QUESTION_ARROW)) pass - - def get_button(self, parent, bottonsize = (32,32), bottonborder=10): + + def get_button(self, parent, bottonsize=(32, 32), bottonborder=10): """ Returns button widget. Called when toolbar is created. """ # simple stockbuttons #b=wx.Button(parent, wx.ID_DELETE) - - id=wx.NewId() + + id = wx.NewId() bitmap = self._bitmap - + if self._is_textbutton: - b=GenBitmapTextToggleButton(parent, id, bitmap,self.ident.title(),name = self.get_name()) + b = GenBitmapTextToggleButton( + parent, id, bitmap, self.ident.title(), name=self.get_name()) else: - b=GenBitmapToggleButton(parent, id, bitmap, - (bitmap.GetWidth()+bottonborder, bitmap.GetHeight()+bottonborder), - name = self.get_name()) + b = GenBitmapToggleButton(parent, id, bitmap, + (bitmap.GetWidth() + bottonborder, + bitmap.GetHeight() + bottonborder), + name=self.get_name()) #b=GenBitmapToggleButton(self, wx.ID_DELETE) #b = GenBitmapTextToggleButton(self, id, None, tool.get('name',''), size = (200, 45)) - - if bitmap!=None: + + if bitmap != None: #mask = wx.Mask(bitmap, wx.BLUE) - #bitmap.SetMask(mask) + # bitmap.SetMask(mask) b.SetBitmapLabel(bitmap) - #bmp=wx.NullBitmap - - bitmap_sel = self._bitmap_sel - if bitmap_sel!=None: + # bmp=wx.NullBitmap + + bitmap_sel = self._bitmap_sel + if bitmap_sel != None: #mask = wx.Mask(bmp, wx.BLUE) - #bmp.SetMask(mask) + # bmp.SetMask(mask) b.SetBitmapSelected(bitmap_sel) - + b.SetUseFocusIndicator(False) - + b.SetUseFocusIndicator(False) - #b.SetSize((36,140)) - #b.SetBestSize() - tt=wx.ToolTip(self.get_info()) - b.SetToolTip(tt)#.SetTip(tool.tooltip) + # b.SetSize((36,140)) + # b.SetBestSize() + tt = wx.ToolTip(self.get_info()) + b.SetToolTip(tt) # .SetTip(tool.tooltip) return b - - def init_common(self,ident,parent,name,info = None, is_textbutton = False): - #print 'Agiletool.__init__',ident,name + + def init_common(self, ident, parent, name, info=None, is_textbutton=False): + # print 'Agiletool.__init__',ident,name #self.name = name self._is_textbutton = is_textbutton - self._canvas=None - self._init_objman(ident, parent=parent, name = name.title(), info = info) + self._canvas = None + self._init_objman(ident, parent=parent, name=name.title(), info=info) #attrsman = self.set_attrsman(cm.Attrsman(self)) self._is_active = False - - - #print ' call set_button',self.ident + + # print ' call set_button',self.ident self.set_button_info() self._optionspanel = None - - def get_optionspanel(self, parent, size = wx.DefaultSize): + + def get_optionspanel(self, parent, size=wx.DefaultSize): """ Return tool option widgets on given parent """ - size=(200,-1) - self._optionspanel = ObjPanel(parent, obj = self, - attrconfigs=None, - #tables = None, - #table = None, id=None, ids=None, - groupnames = ['options'], - func_change_obj=None, - show_groupnames=False, show_title=True, is_modal=False, - mainframe=self.parent.get_mainframe(), - pos=wx.DefaultPosition, size=size, style = wx.MAXIMIZE_BOX|wx.RESIZE_BORDER, - immediate_apply=False, panelstyle='default',#'instrumental' - standartbuttons=['apply','restore']) - + size = (200, -1) + self._optionspanel = ObjPanel(parent, obj=self, + attrconfigs=None, + #tables = None, + # table = None, id=None, ids=None, + groupnames=['options'], + func_change_obj=None, + show_groupnames=False, show_title=True, is_modal=False, + mainframe=self.parent.get_mainframe(), + pos=wx.DefaultPosition, size=size, style=wx.MAXIMIZE_BOX | wx.RESIZE_BORDER, + # 'instrumental' + immediate_apply=False, panelstyle='default', + standartbuttons=['apply', 'restore']) + return self._optionspanel - - - - def activate(self,canvas = None): + + def activate(self, canvas=None): """ This call by metacanvas??TooldsPallet signals that the tool has been activated and can now interact with metacanvas. """ - #print 'activate',self.ident + # print 'activate',self.ident self._is_active = True self._canvas = canvas - #self._canvas.del_handles() + # self._canvas.del_handles() canvas.activate_tool(self) self.set_cursor() - def deactivate(self): """ @@ -141,249 +148,237 @@ self._canvas.deactivate_tool() self._canvas = None self._is_active = False - + def is_active(self): - return self._is_active - + return self._is_active + def force_deactivation(self): """ Explicit call to deactivate this tool in the tools panel. """ self.parent.unselect_tool() - + def on_left_down(self, event): return False - + def on_left_up(self, event): return False - + def on_left_dclick(self, event): return False - + def on_right_down(self, event): return False - + def on_right_up(self, event): return self.aboard(event) - + def aboard(self): return False - + def on_wheel(self, event): return False - - def on_motion(self, event): - return False # return True if something moved - - + def on_motion(self, event): + return False # return True if something moved class DelTool(BaseTool): - def __init__(self,parent): + + def __init__(self, parent): """ To be overridden by specific tool. """ - self.init_common('delete',parent,'Delete', info = 'Delete objects in cancvas') - - def set_button_info(self,bsize=(32,32)): - #print 'set_button_info select tool' + self.init_common('delete', parent, 'Delete', + info='Delete objects in cancvas') + + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' self._bitmap = None self._bitmap_sel = None - - def get_button(self, parent, bottonsize = (32,32), bottonborder=10): - + + def get_button(self, parent, bottonsize=(32, 32), bottonborder=10): + # simple stockbuttons - b=wx.Button(parent, wx.ID_DELETE,name = self.get_name()) - + b = wx.Button(parent, wx.ID_DELETE, name=self.get_name()) + b.SetSize(bottonsize) - #b.SetBestSize() - tt=wx.ToolTip(self.get_info()) - b.SetToolTip(tt)#.SetTip(tool.tooltip) - #print 'DelTool.get_button',dir(b) + # b.SetBestSize() + tt = wx.ToolTip(self.get_info()) + b.SetToolTip(tt) # .SetTip(tool.tooltip) + # print 'DelTool.get_button',dir(b) return b - - + + class ToolPalett(wx.Panel): + """ This is a panel where tools are represented by images and/or text. The tools are selected in a radio-button-fashion. - + Each tool has a string as key. Each time the status changes, a callback function is called with new and old tool key as argument. """ - def __init__(self,parent,tools=[],callback=None, n_buttoncolumns=3): + + def __init__(self, parent, tools=[], callback=None, n_buttoncolumns=3): """ callback is a function that is called when a tool has been selected. The function is called as: callback(tool) - + """ - #the metacanvas object with which the pallet should apply th tools - + # the metacanvas object with which the pallet should apply th tools + # callback when a new tool gets selected (NOT in USE) - self._callback=callback - - #wx.Window.__init__(self,parent,wx.ID_ANY,wx.DefaultPosition,wx.DefaultSize,wx.SUNKEN_BORDER|wx.WANTS_CHARS) - #wx.Panel.__init__(self,parent,wx.ID_ANY,wx.DefaultPosition,size,wx.RAISED_BORDER|wx.WANTS_CHARS) - wx.Panel.__init__(self,parent,-1,wx.DefaultPosition,wx.DefaultSize) - #wx.Panel.__init__(self,parent,wx.ID_ANY,wx.DefaultPosition,(300,600),wx.RAISED_BORDER|wx.WANTS_CHARS) + self._callback = callback + + # wx.Window.__init__(self,parent,wx.ID_ANY,wx.DefaultPosition,wx.DefaultSize,wx.SUNKEN_BORDER|wx.WANTS_CHARS) + # wx.Panel.__init__(self,parent,wx.ID_ANY,wx.DefaultPosition,size,wx.RAISED_BORDER|wx.WANTS_CHARS) + wx.Panel.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize) + # wx.Panel.__init__(self,parent,wx.ID_ANY,wx.DefaultPosition,(300,600),wx.RAISED_BORDER|wx.WANTS_CHARS) self.sizer = wx.GridSizer(0, n_buttoncolumns, 5, 5) self.SetSizer(self.sizer) - self._id_to_tool={} - self._id=-1 - + self._id_to_tool = {} + self._id = -1 + for tool in tools: self.add_tool(tool) - - #self.sizer.Fit(self) - #self.SetMaxSize((300,-1)) - + + # self.sizer.Fit(self) + # self.SetMaxSize((300,-1)) + def has_tool(self, newtool): - for tool,b in self._id_to_tool.values(): - if tool.get_ident()==newtool.get_ident(): + for tool, b in self._id_to_tool.values(): + if tool.get_ident() == newtool.get_ident(): return True return False - + def get_tool_by_ident(self, ident): - #print 'get_tool_by_ident',ident - for tool,b in self._id_to_tool.values(): - #print ' tool',tool.get_ident() + # print 'get_tool_by_ident',ident + for tool, b in self._id_to_tool.values(): + # print ' tool',tool.get_ident() if tool.get_ident() == ident: return tool - + return None - - def add_tool(self,tool): + + def add_tool(self, tool): """ Add a tool to the pallet. """ if not self.has_tool(tool): - #print 'add_tool',tool - bottonsize = (32,32) + # print 'add_tool',tool + bottonsize = (32, 32) bottonborder = 10 toolbarborder = 1 - - - b= tool.get_button(self, bottonsize = bottonsize, bottonborder=bottonborder) + + b = tool.get_button(self, bottonsize=bottonsize, + bottonborder=bottonborder) self.Bind(wx.EVT_BUTTON, self.on_select, b) - + _id = b.GetId() - self._id_to_tool[_id]=(tool,b) - + self._id_to_tool[_id] = (tool, b) + #self.sizer.Add(b, 0, wx.GROW) - self.sizer.Add(b,0, wx.EXPAND, border=toolbarborder) - #self.sizer.Add(b) - #print ' _id =',_id + self.sizer.Add(b, 0, wx.EXPAND, border=toolbarborder) + # self.sizer.Add(b) + # print ' _id =',_id return _id else: return -1 - - - - + def get_tools(self): """ Returns lins with all toll instances """ - tools=[] - for (tool,b) in self._id_to_tool.values(): + tools = [] + for (tool, b) in self._id_to_tool.values(): tools.append(tool) return tools - + def refresh(self): """ Reorganizes toolpallet after adding/removing tools. Attention is not automatically called. """ self.sizer.Layout() - - def on_select(self,event): + + def on_select(self, event): """ Called from a pressed button """ - _id=event.GetEventObject().GetId() - #print '\n on_select',_id,self._id#,self._id_to_tool[_id] - - - if _id!=self._id: + _id = event.GetEventObject().GetId() + # print '\n on_select',_id,self._id#,self._id_to_tool[_id] + + if _id != self._id: if self._id_to_tool.has_key(_id): - - (tool,button)=self._id_to_tool[_id] - #print ' new tool',tool.get_name() + + (tool, button) = self._id_to_tool[_id] + # print ' new tool',tool.get_name() self.unselect() - self._id=_id - + self._id = _id + # this will cause the main OGL editor to activate the # tool with the current canvas self.GetParent().set_tool(tool) - #if self._callback!=None: + # if self._callback!=None: # self._callback(tool) event.Skip() return tool - + return None - - - - - def select(self,_id): + + def select(self, _id): """ Select explicitelt a tool with _id. """ - #print '\nselect',_id,self._id,self._id_to_tool - - if _id!=self._id: + # print '\nselect',_id,self._id,self._id_to_tool + + if _id != self._id: if self._id_to_tool.has_key(_id): - - (tool,button)=self._id_to_tool[_id] - - #print ' explicitly press button' - if hasattr(button,'SetToggle'): + + (tool, button) = self._id_to_tool[_id] + + # print ' explicitly press button' + if hasattr(button, 'SetToggle'): button.SetToggle(True) else: button.SetFocus() - #print 'button.SetFocus',button.SetFocus.__doc__ - #pass - - #print ' new tool',tool.get_name() - #self.unselect() - self._id=_id - - + # print 'button.SetFocus',button.SetFocus.__doc__ + # pass + + # print ' new tool',tool.get_name() + # self.unselect() + self._id = _id + self.GetParent().set_tool(tool) - #if self._callback!=None: + # if self._callback!=None: # self._callback(tool) return tool - + return None - - - + def unselect(self): """ Unselect currently selected tool. """ if self._id_to_tool.has_key(self._id): - (tool,button)=self._id_to_tool[self._id] - + (tool, button) = self._id_to_tool[self._id] + if tool.is_active() == True: # Disactivate current tool tool.deactivate() - - if hasattr(button,'SetToggle'): + + if hasattr(button, 'SetToggle'): button.SetToggle(False) else: - #button.SetFocus() - #print 'button.SetFocus',button.SetFocus.__doc__ + # button.SetFocus() + # print 'button.SetFocus',button.SetFocus.__doc__ pass - - - - class __ToggleMixin: + def SetToggle(self, flag): self.up = not flag self.Refresh() @@ -397,7 +392,7 @@ if not self.IsEnabled(): return self.saveUp = self.up - self.up = False #not self.up + self.up = False # not self.up self.CaptureMouse() self.SetFocus() self.Refresh() @@ -414,82 +409,86 @@ def OnKeyDown(self, event): event.Skip() - - + class GenBitmapTextToggleButton(__ToggleMixin, GenBitmapTextButton): + """A generic toggle bitmap button with text label""" pass + class GenBitmapToggleButton(__ToggleMixin, GenBitmapButton): + """A generic toggle bitmap button with text label""" pass + class ToolsPanel(wx.Panel): + """ Shows a toolpallet with different tools and an options panel. """ - def __init__(self, parent, size = wx.DefaultSize, size_title = 150, **kwargs): - + + def __init__(self, parent, size=wx.DefaultSize, size_title=150, **kwargs): + #size = wx.DefaultSize #size = (300,-1) - wx.Panel.__init__(self,parent,wx.NewId(),wx.DefaultPosition,size) - #wx.DefaultSize - #sizer=wx.BoxSizer(wx.VERTICAL) - sizer=wx.StaticBoxSizer(wx.StaticBox( parent, wx.NewId(), "test" ), wx.VERTICAL ) - - - - self._toolspalett = ToolPalett(self,**kwargs) - - #self._toolspalett.add_tool(BaseTool(self)) - + wx.Panel.__init__(self, parent, wx.NewId(), wx.DefaultPosition, size) + # wx.DefaultSize + # sizer=wx.BoxSizer(wx.VERTICAL) + sizer = wx.StaticBoxSizer(wx.StaticBox( + parent, wx.NewId(), "test"), wx.VERTICAL) + + self._toolspalett = ToolPalett(self, **kwargs) + + # self._toolspalett.add_tool(BaseTool(self)) + # create initial option panel self._optionspanel = wx.Window(self) self._optionspanel.SetBackgroundColour("pink") - wx.StaticText(self._optionspanel, -1, "Tool Options", (size_title,-1)) - + wx.StaticText(self._optionspanel, -1, "Tool Options", (size_title, -1)) + # OK, but toolspane changes size with optionpanel #sizer.Add(self._toolspalett,0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4) - #sizer.Add(self._optionspanel,1,wx.GROW)# wx.EXPAND - - sizer.Add(self._toolspalett,0, wx.EXPAND) - sizer.Add(self._optionspanel,1, wx.EXPAND) - + # sizer.Add(self._optionspanel,1,wx.GROW)# wx.EXPAND + + sizer.Add(self._toolspalett, 0, wx.EXPAND) + sizer.Add(self._optionspanel, 1, wx.EXPAND) + # finish panel setup self.SetSizer(sizer) sizer.Fit(self) - - #self.SetSize(parent.GetSize()) - #self.SetMaxSize((300,-1)) - + + # self.SetSize(parent.GetSize()) + # self.SetMaxSize((300,-1)) + def get_canvas(self): - # ask the OGL editor for the currently active canvas in focus + # ask the OGL editor for the currently active canvas in focus return self.GetParent().get_canvas() - + def get_mainframe(self): return self.GetParent().get_mainframe() - + def add_tool(self, tool): return self._toolspalett.add_tool(tool) - + def add_toolclass(self, ToolClass): # init and add return self._toolspalett.add_tool(ToolClass(self)) - + def add_initial_tool(self, tool): self._id_initialtool = self.add_tool(tool) - + def reset_initial_tool(self): self.set_tool_with_id(self._id_initialtool) - + def set_tool_with_id(self, _id): """ Explicitely set a tool from tool pallet using its id. Used to set initial tool. """ - #print 'set_tool_with_id',_id + # print 'set_tool_with_id',_id return self._toolspalett.select(_id) - + def set_tool(self, tool): """ Called by toolpallet after new tool has been selected. @@ -497,38 +496,38 @@ # Activate current tool # then tool wil set itself to canvas tool.activate(self.get_canvas()) - + # set options of current tool self.refresh_optionspanel(tool) - + def get_tool_by_ident(self, ident): return self._toolspalett.get_tool_by_ident(ident) - + def refresh_optionspanel(self, tool): - sizer=self.GetSizer() + sizer = self.GetSizer() sizer.Remove(1) self._optionspanel.Destroy() - - self._optionspanel = tool.get_optionspanel(self)#, size = self.GetSize()) - #self._optionspanel.SetSize((100,0)) - #if id!=None: + + self._optionspanel = tool.get_optionspanel( + self) # , size = self.GetSize()) + # self._optionspanel.SetSize((100,0)) + # if id!=None: # self.objpanel=ObjPanel(self,obj,id=id,func_change_obj=self.change_obj) - #else: + # else: # self.objpanel=ObjPanel(self,obj,func_change_obj=self.change_obj) - + # ok, but chanes sice of whole palle - #sizer.Add(self._optionspanel,1,wx.GROW) - - sizer.Add(self._optionspanel,1,wx.EXPAND) - - #self.Refresh() - #sizer.Fit(self) + # sizer.Add(self._optionspanel,1,wx.GROW) + + sizer.Add(self._optionspanel, 1, wx.EXPAND) + + # self.Refresh() + # sizer.Fit(self) sizer.Layout() - #self.GetParent().Layout() - + # self.GetParent().Layout() + def unselect_tool(self): """ Unselect currently selected tool. - """ + """ self._toolspalett.unselect() - \ No newline at end of file diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/wxmisc.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/wxmisc.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/wxmisc.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/agilepy/lib_wx/wxmisc.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,928 +1,906 @@ - - -import sys, os, types -#AGILEDIR = os.path.join(os.path.dirname(__file__),"..") -#sys.path.append(os.path.join(AGILEDIR,"lib_base")) -#IMAGEDIR = os.path.join(os.path.dirname(__file__),"images") - - -import wx - -import time,string - -##def OnOpen(self,e): -## """ Open a file""" -## self.dirname = '' -## dlg = wx.FileDialog(self, "Choose a file", self.dirname, "", "*.*", wx.OPEN) -## if dlg.ShowModal() == wx.ID_OK: -## self.filename = dlg.GetFilename() -## self.dirname = dlg.GetDirectory() -## f = open(os.path.join(self.dirname, self.filename), 'r') -## self.control.SetValue(f.read()) -## f.close() -## dlg.Destroy() - -# alternating colors in tables "light blue" 'WHEAT' -#TABLECOLORS=[wx.NamedColour('grey85'),wx.NamedColour("light blue")] - -def get_tablecolors(): - cs= [wx.NamedColour('grey85'),wx.NamedColour("light blue")] - #cs = [wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW ) ,\ - # wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNHIGHLIGHT)] - #print 'resources.get_tablecolors',cs - return cs - - - - - - - -class AgileToolbarMixin: - """ - Easy to use toolbar where strings can be used to identify tools. - Mixin for frames. - """ - def init_toolbar(self,orientation='horizontal',size=(16,16),separation=5): - """ - This initialization works for panels and windows. - For frames use the AgileToolbar frames mixin class - """ - if orientation=='horizontal': - self.toolbar = wx.ToolBar( self,-1,style=wx.TB_HORIZONTAL|wx.TB_NODIVIDER \ - | wx.NO_BORDER - | wx.TB_FLAT - | wx.TB_TEXT - ) - else: - self.toolbar = wx.ToolBar( self,-1,style=wx.TB_VERTICAL|wx.TB_NODIVIDER \ - | wx.NO_BORDER - | wx.TB_FLAT - | wx.TB_TEXT - ) - - - - self.toolbar.SetToolBitmapSize(size) - self.toolbar.SetToolSeparation(separation) - - self._tools={} - self.toolbar.Realize() - S = self.toolbar.GetSize() - self.toolbar.SetSizeHints(S[0],S[1]) - - def get_size_toolbaricons(self): - """ - Returns tuple with width and height of toolbar icons. - This is required to create them. - """ - return self.toolbar.GetToolBitmapSize() - - def disable_tools(self): - pass - #GetToolEnabled - - def restore_tools(self): - pass - #GetToolEnabled - - - def add_tool(self,key,func=None,bitmap=None,info='',widget=None,**args): - """ - Add a tool to the tool bar - """ - #print 'add_tool',self,key,func - - id=wx.NewId() - if not args.has_key('name'): - name=string.capitalize(key) - else: - name=args['name'] - - if widget!=None: - # tool is a widget - self.toolbar.AddControl(widget) - else: - # tools is a simple button - if not bitmap: - bitmap=wx.NullBitmap - - #print 'bitmap=',name,bitmap - self.toolbar.AddSimpleTool(id, bitmap,name, info) - #self.toolbar.AddTool(id,name, bitmap, shortHelpString=info) - - wx.EVT_TOOL(self, id, func) - #if args.has_key('func_rclick'): - # wx.EVT_TOOL_RCLICKED(self.parent, id, args['func_rclick']) - - self._tools[key]=id - # Final thing to do for a toolbar is call the Realize() method. This - # causes it to render (more or less, that is). - self.toolbar.Realize() - S = self.toolbar.GetSize() - self.toolbar.SetSizeHints(S[0],S[1]) - return id - - def enable_tool(self,key,enable=True): - if self._tools.has_key(key): - #self._tools[key].Show(False) - self.toolbar.EnableTool(self._tools[key],enable) - - else: - print 'enable_tool: no tool named:',key - - def del_tool(self,key): - if self._tools.has_key(key): - #self._tools[key].Show(False) - self.toolbar.RemoveTool(self._tools[key]) - del self._tools[key] - - # Final thing to do for a toolbar is call the Realize() method. This - # causes it to render (more or less, that is). - self.toolbar.Realize() - else: - print 'del_tool: no tool named:',key - -class AgileToolbarFrameMixin(AgileToolbarMixin): - """ - Easy to use toolbar where strings can be used to identify tools. - Mixin for frames only. - """ - def init_toolbar(self,orientation='horizontal',size=(16,16),separation=5): - """ - Only this initialization is specific to frames. - """ - # Use the wxFrame internals to create the toolbar and associate it all - # in one tidy method call. - if orientation=='horizontal': - self.toolbar = self.CreateToolBar( wx.TB_HORIZONTAL - | wx.NO_BORDER - | wx.TB_FLAT - | wx.TB_TEXT - ) - else: - self.toolbar = self.CreateToolBar( wx.TB_VERTICAL - | wx.NO_BORDER - | wx.TB_FLAT - | wx.TB_TEXT - ) - - - - self.toolbar.SetToolBitmapSize(size) - self.toolbar.SetToolSeparation(separation) - - self._tools={} - -class AgileMenuMixin: - """ - Easy to use menue mixin for main menu and popup - """ - def init_menu(self,parent): - """ - Initialize internal variables. - """ - self.parent=parent - self.__tree={} - - def get_menu(self,path): - items=self.__tree - val=(None,None,-1) - #print 'get_menu',path - for key in path: - #print ' ',key,items - if items.has_key(key): - val=items[key] - #print val - if len(val)==3: - items=val[1] - else: - return None,None,-1 - else: - print 'WARNING in get_menu: invalid menu key',key,'in path' - return None, None,-1 - - return val[0],val[1],val[2] - - def get_menuitem(self,path): - menupath=string.split(path,'/')[:-1] - key=string.split(path,'/')[-1] - - #print '\nget_menuitem',self.__tree - if len(menupath)==0: - #print " *create toplevel menu",key - menuitem,id=self.__tree[key] - - else: - #print " *create submenu",key - menu,tree,id=self.get_menu(menupath) - menuitem,id = tree[key] - - #print ' menuitem,id',menuitem,id - return menuitem - - - def append_menu(self,path,**args): - """ - """ - #print 'append_menu',path,args - if path == '.': - #print " use '.' as root for popups" - # create an entry for database but do not append a menue - - key='.' - # create special menu as direct root - id=wx.NewId() - self.__tree[key]=(self,{},id) - #print ' ROOTMENU ATTRS: self,dir(self)',self,dir(self) - - else: - #print " normal menu" - menupath=string.split(path,'/')[:-1] - key=string.split(path,'/')[-1] - - if len(menupath)==0: - #print " *create toplevel menu",key - menu,id=self._create_menu(self,key,**args) - self.__tree[key]=(menu,{},id) - - else: - #print " *create submenu",key - parentmenu,parentmenu_dict,parentid=self.get_menu(menupath) - #print ' PARENTMENU ATTRS: self,dir(parentmenu)',parentmenu,dir(parentmenu) - #print ' parentmenu,key,parentmenu_dict,parentid',parentmenu,key,parentmenu_dict,parentid - menu,id=self._create_menu(parentmenu,key,**args) - parentmenu_dict[key]=(menu,{},id) - - def _create_menu(self,parentmenu,key,menu=None,**args): - #print '\n\n_create_menu key',key - # default menu/submenu item - data={'alt':True} - #print ' PARENTMENU ATTRS: self,dir(parentmenu)',parentmenu,dir(parentmenu) - # overwrite with args - data.update(args) - - if not data.has_key('name'): - data['name']=string.capitalize(key) - - - - if data['alt']: - alt='&' - else: - alt='' - - id=wx.NewId() - if menu==None: - menu=wx.Menu() - - if parentmenu==self: - id=-1 - if data.get('popup',False): - - # !! this is the way to append a menue to toplevel - # popup menu which is a menu itself - self.AppendMenu(id, data['name'],menu) - - else: - # !! this is the way to append a menue to toplevel - # which is a menubar !! - self.Append(menu, alt+data['name']) - - - else: - # attach menu to a submenu - #print ' make submenu' - - item, id = self._create_item(key,parentmenu,function=None,**args) - item.SetSubMenu(menu) - parentmenu.AppendItem(item) - #parentmenu.AppendMenu(id,alt+data['name'],menu) - - return menu,id - - - - def append_item(self,path,function,**args): - - #print 'append_item',path,function - menupath=string.split(path,'/')[:-1] - key=string.split(path,'/')[-1] - - menu,menu_dict,menuid=self.get_menu(menupath) - - - #print ' key=',key - - if menu: - # create item and append to menu instance - item,id=self._create_item(key,menu,function,**args) - - # append item - #print ' menu',menu,type(menu),dir(menu) - menu.AppendItem(item) - if args.has_key('check'): - menu.Check(item.GetId(), args['check']) - #if (args.has_key('check'))&(args.has_key('checked')): - # menu.Check(item.GetId(), args['checked']) - - menu_dict[key]=(item,id) - return item,id - else: - print 'WARNING: in append_item: invalid menu path',menupath - return None, None - - - def _create_item(self,key,menu,function=None,**args): - # default item - data={ 'alt':True, - 'shortkey':'', - 'info':'', - } - - - - # overwrite with args - data.update(args) - - if not data.has_key('name'): - data['name']=string.capitalize(key) - - #print '_create_item',data - - # create item - id=wx.NewId() - if data['alt']: - alt='&' - else: - alt='' - itemtext=alt+data['name'] - if data['shortkey']!='': - itemtext+='\t'+data['shortkey'] - - if data.has_key('radio'): - - item = wx.MenuItem(menu,id,itemtext,data['info'],wx.ITEM_RADIO) - #print ' radio item' - - elif data.has_key('check'): - item = wx.MenuItem(menu,id,itemtext,data['info'],wx.ITEM_CHECK) - # check boxes AFTER append - - else: - item = wx.MenuItem(menu,id,itemtext,data['info'],wx.ITEM_NORMAL) - #print ' normal item' - - if data.has_key('bitmap'): - #print '_create_item bitmap',data['bitmap'] - #TODO: allow more image formats in menuitem - #item.SetBitmap(images.getSmilesBitmap()) - item.SetBitmap(data['bitmap']) - - - - # define callback function - if function!= None:# None for submenueitem - #wx.EVT_MENU(self.parent,id,function) - self.parent.Bind(wx.EVT_MENU, function, id = id) - - return item,id - - def del_item(self,path): - menupath=string.split(path,'/')[:-1] - key=string.split(path,'/')[-1] - - menu,menu_dict,menuid=self.get_menu(menupath) - if menu: - if menu_dict.has_key(key): - menu.RemoveItem(menu_dict[key][0]) - #menu_dict[key][0].Remove() - del menu_dict[key] - - def del_menu(self,path): - menupath=string.split(path,'/')[:-1] - key=string.split(path,'/')[-1] - allpath=string.split(path,'/') - parentmenu,parentmenu_dict,parentmenuid=self.get_menu(menupath) - menu,menu_dict,menuid=self.get_menu(allpath) - - - if menu: - if menuid>-1: - parentmenu.Remove(menuid) # works - del parentmenu_dict[key] - else: - self.Remove(menu) - del parentmenu_dict[key] - - def __setitem__(self,menupath,**data): - #print 'set menue',menupath,'to',data - - if type(name) != types.TupleType: - # create main menue entry, if necessary - if not self.menus.has_key(name): - newmenue=wx.Menu() - self.Append(newmenue,'&'+name) - self.menus[name]=(-1,{}) - - elif len(name)==2: - # create submenu entry, if necessary - name1,name2=name - if not self.menus.has_key(name1): - newmenue=wx.Menu() - self.Append(newmenue,'&'+name1) - self.menus[name]=(-1,{}) - - menuid,submenus=self.menus[name1] - - if not submenus.has_key(name2): - id=wx.NewId() - get_menu_item() - newmenue=wx.Menu() - self.Append(newmenue,'&'+name1) - self.menus[name]={} - - - submenu=self.menus - parentmenu=None - for m in menu: - if not submenu.has_key(m): - newmenue=wx.Menu() - - def get_menu_item(self,id): - item=self.FindItemById(id) - menu=item.GetMenu() - return menu,item - - def get_menuitem_from_id(self, id): - menu,item = self.get_menu_item(id) - return item - -class AgilePopupMenu(wx.Menu,AgileMenuMixin): - """ - Easy to use popup - """ - def __init__(self,parent): - wx.Menu.__init__(self) - self.init_menu(parent) - - # append special root menu - AgileMenuMixin.append_menu(self,'.') - - def append_menu(self,path,**args): - AgileMenuMixin.append_menu(self,'./'+path,popup=True,**args) - - def append_item(self,path,function,**args): - return AgileMenuMixin.append_item(self,'./'+path,function,**args) - - def get_menuitem(self,path): - return AgileMenuMixin.get_menuitem(self,'./'+path) - -#------------------------------------------------------------------------------- - # the folling methods are used with contect\xd5\xd3\ -\xc3\x15:P)l!\n\x91\xc2\x1a\xd6`)\xec\xb1\x00\x92\xc2\x11?\xb8e\x88\x8fSt\ -\x19=\x00\x82\x16[\xf7' )) - -def GetPlusBitmap(): - return wx.BitmapFromXPMData(GetPlusData()) - -#---------------------------------------------------------------------- -def GetMinusData(): - return cPickle.loads(zlib.decompress( -'x\xda\xd3\xc8)0\xe4\nV72T\x00!\x05Cu\xae\xc4`u=\x85d\x05\xa7\x9c\xc4\xe4l0O\ -\x01\xc8S\xb6t\x06A(\x1f\x0b RF\x0f\x08\xb0\xc9@D\xe1r\x08\x19\xb8j=\xa2e\ -\x10\x16@\x99\xc82zz\x10\'\x90"\x83\xc34r\xdc\x86\xf0\xa9\x9e\x1e\xae\xd0\ -\x81Ja\x0bQ\x88\x14\xd6\xb0\x06Ka\x8f\x05\x90\x14\x8e\xf8\xc1-C|\x9c\xa2\xcb\ -\xe8\x01\x00\xed\x0f[\x87' )) - -def GetMinusBitmap(): - return wx.BitmapFromXPMData(GetMinusData()) - - - - \ No newline at end of file + + +import sys +import os +import types +#AGILEDIR = os.path.join(os.path.dirname(__file__),"..") +# sys.path.append(os.path.join(AGILEDIR,"lib_base")) +#IMAGEDIR = os.path.join(os.path.dirname(__file__),"images") + + +import wx + +import time +import string + +# def OnOpen(self,e): +## """ Open a file""" +## self.dirname = '' +## dlg = wx.FileDialog(self, "Choose a file", self.dirname, "", "*.*", wx.OPEN) +# if dlg.ShowModal() == wx.ID_OK: +## self.filename = dlg.GetFilename() +## self.dirname = dlg.GetDirectory() +## f = open(os.path.join(self.dirname, self.filename), 'r') +# self.control.SetValue(f.read()) +# f.close() +# dlg.Destroy() + +# alternating colors in tables "light blue" 'WHEAT' +#TABLECOLORS=[wx.NamedColour('grey85'),wx.NamedColour("light blue")] + + +def get_tablecolors(): + cs = [wx.NamedColour('grey85'), wx.NamedColour("light blue")] + # cs = [wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW ) ,\ + # wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNHIGHLIGHT)] + # print 'resources.get_tablecolors',cs + return cs + + +class AgileToolbarMixin: + + """ + Easy to use toolbar where strings can be used to identify tools. + Mixin for frames. + """ + + def init_toolbar(self, orientation='horizontal', size=(16, 16), separation=5): + """ + This initialization works for panels and windows. + For frames use the AgileToolbar frames mixin class + """ + if orientation == 'horizontal': + self.toolbar = wx.ToolBar(self, -1, style=wx.TB_HORIZONTAL | wx.TB_NODIVIDER + | wx.NO_BORDER + | wx.TB_FLAT + | wx.TB_TEXT + ) + else: + self.toolbar = wx.ToolBar(self, -1, style=wx.TB_VERTICAL | wx.TB_NODIVIDER + | wx.NO_BORDER + | wx.TB_FLAT + | wx.TB_TEXT + ) + + self.toolbar.SetToolBitmapSize(size) + self.toolbar.SetToolSeparation(separation) + + self._tools = {} + self.toolbar.Realize() + S = self.toolbar.GetSize() + self.toolbar.SetSizeHints(S[0], S[1]) + + def get_size_toolbaricons(self): + """ + Returns tuple with width and height of toolbar icons. + This is required to create them. + """ + return self.toolbar.GetToolBitmapSize() + + def disable_tools(self): + pass + # GetToolEnabled + + def restore_tools(self): + pass + # GetToolEnabled + + def add_tool(self, key, func=None, bitmap=None, info='', widget=None, **args): + """ + Add a tool to the tool bar + """ + # print 'add_tool',self,key,func + + id = wx.NewId() + if not args.has_key('name'): + name = string.capitalize(key) + else: + name = args['name'] + + if widget != None: + # tool is a widget + self.toolbar.AddControl(widget) + else: + # tools is a simple button + if not bitmap: + bitmap = wx.NullBitmap + + # print 'bitmap=',name,bitmap + self.toolbar.AddSimpleTool(id, bitmap, name, info) + #self.toolbar.AddTool(id,name, bitmap, shortHelpString=info) + + wx.EVT_TOOL(self, id, func) + # if args.has_key('func_rclick'): + # wx.EVT_TOOL_RCLICKED(self.parent, id, args['func_rclick']) + + self._tools[key] = id + # Final thing to do for a toolbar is call the Realize() method. This + # causes it to render (more or less, that is). + self.toolbar.Realize() + S = self.toolbar.GetSize() + self.toolbar.SetSizeHints(S[0], S[1]) + return id + + def enable_tool(self, key, enable=True): + if self._tools.has_key(key): + # self._tools[key].Show(False) + self.toolbar.EnableTool(self._tools[key], enable) + + else: + print 'enable_tool: no tool named:', key + + def del_tool(self, key): + if self._tools.has_key(key): + # self._tools[key].Show(False) + self.toolbar.RemoveTool(self._tools[key]) + del self._tools[key] + + # Final thing to do for a toolbar is call the Realize() method. This + # causes it to render (more or less, that is). + self.toolbar.Realize() + else: + print 'del_tool: no tool named:', key + + +class AgileToolbarFrameMixin(AgileToolbarMixin): + + """ + Easy to use toolbar where strings can be used to identify tools. + Mixin for frames only. + """ + + def init_toolbar(self, orientation='horizontal', size=(16, 16), separation=5): + """ + Only this initialization is specific to frames. + """ + # Use the wxFrame internals to create the toolbar and associate it all + # in one tidy method call. + if orientation == 'horizontal': + self.toolbar = self.CreateToolBar(wx.TB_HORIZONTAL + | wx.NO_BORDER + | wx.TB_FLAT + | wx.TB_TEXT + ) + else: + self.toolbar = self.CreateToolBar(wx.TB_VERTICAL + | wx.NO_BORDER + | wx.TB_FLAT + | wx.TB_TEXT + ) + + self.toolbar.SetToolBitmapSize(size) + self.toolbar.SetToolSeparation(separation) + + self._tools = {} + + +class AgileMenuMixin: + + """ + Easy to use menue mixin for main menu and popup + """ + + def init_menu(self, parent): + """ + Initialize internal variables. + """ + self.parent = parent + self.__tree = {} + + def get_menu(self, path): + items = self.__tree + val = (None, None, -1) + # print 'get_menu',path + for key in path: + # print ' ',key,items + if items.has_key(key): + val = items[key] + # print val + if len(val) == 3: + items = val[1] + else: + return None, None, -1 + else: + print 'WARNING in get_menu: invalid menu key', key, 'in path' + return None, None, -1 + + return val[0], val[1], val[2] + + def get_menuitem(self, path): + menupath = string.split(path, '/')[:-1] + key = string.split(path, '/')[-1] + + # print '\nget_menuitem',self.__tree + if len(menupath) == 0: + # print " *create toplevel menu",key + menuitem, id = self.__tree[key] + + else: + # print " *create submenu",key + menu, tree, id = self.get_menu(menupath) + menuitem, id = tree[key] + + # print ' menuitem,id',menuitem,id + return menuitem + + def append_menu(self, path, **args): + """ + """ + # print 'append_menu',path,args + if path == '.': + # print " use '.' as root for popups" + # create an entry for database but do not append a menue + + key = '.' + # create special menu as direct root + id = wx.NewId() + self.__tree[key] = (self, {}, id) + # print ' ROOTMENU ATTRS: self,dir(self)',self,dir(self) + + else: + # print " normal menu" + menupath = string.split(path, '/')[:-1] + key = string.split(path, '/')[-1] + + if len(menupath) == 0: + # print " *create toplevel menu",key + menu, id = self._create_menu(self, key, **args) + self.__tree[key] = (menu, {}, id) + + else: + # print " *create submenu",key + parentmenu, parentmenu_dict, parentid = self.get_menu(menupath) + # print ' PARENTMENU ATTRS: self,dir(parentmenu)',parentmenu,dir(parentmenu) + # print ' + # parentmenu,key,parentmenu_dict,parentid',parentmenu,key,parentmenu_dict,parentid + menu, id = self._create_menu(parentmenu, key, **args) + parentmenu_dict[key] = (menu, {}, id) + + def _create_menu(self, parentmenu, key, menu=None, **args): + # print '\n\n_create_menu key',key + # default menu/submenu item + data = {'alt': True} + # print ' PARENTMENU ATTRS: self,dir(parentmenu)',parentmenu,dir(parentmenu) + # overwrite with args + data.update(args) + + if not data.has_key('name'): + data['name'] = string.capitalize(key) + + if data['alt']: + alt = '&' + else: + alt = '' + + id = wx.NewId() + if menu == None: + menu = wx.Menu() + + if parentmenu == self: + id = -1 + if data.get('popup', False): + + # !! this is the way to append a menue to toplevel + # popup menu which is a menu itself + self.AppendMenu(id, data['name'], menu) + + else: + # !! this is the way to append a menue to toplevel + # which is a menubar !! + self.Append(menu, alt + data['name']) + + else: + # attach menu to a submenu + # print ' make submenu' + + item, id = self._create_item( + key, parentmenu, function=None, **args) + item.SetSubMenu(menu) + parentmenu.AppendItem(item) + # parentmenu.AppendMenu(id,alt+data['name'],menu) + + return menu, id + + def append_item(self, path, function, **args): + + # print 'append_item',path,function + menupath = string.split(path, '/')[:-1] + key = string.split(path, '/')[-1] + + menu, menu_dict, menuid = self.get_menu(menupath) + + # print ' key=',key + + if menu: + # create item and append to menu instance + item, id = self._create_item(key, menu, function, **args) + + # append item + # print ' menu',menu,type(menu),dir(menu) + menu.AppendItem(item) + if args.has_key('check'): + menu.Check(item.GetId(), args['check']) + # if (args.has_key('check'))&(args.has_key('checked')): + # menu.Check(item.GetId(), args['checked']) + + menu_dict[key] = (item, id) + return item, id + else: + print 'WARNING: in append_item: invalid menu path', menupath + return None, None + + def _create_item(self, key, menu, function=None, **args): + # default item + data = {'alt': True, + 'shortkey': '', + 'info': '', + } + + # overwrite with args + data.update(args) + + if not data.has_key('name'): + data['name'] = string.capitalize(key) + + # print '_create_item',data + + # create item + id = wx.NewId() + if data['alt']: + alt = '&' + else: + alt = '' + itemtext = alt + data['name'] + if data['shortkey'] != '': + itemtext += '\t' + data['shortkey'] + + if data.has_key('radio'): + + item = wx.MenuItem(menu, id, itemtext, data['info'], wx.ITEM_RADIO) + # print ' radio item' + + elif data.has_key('check'): + item = wx.MenuItem(menu, id, itemtext, data['info'], wx.ITEM_CHECK) + # check boxes AFTER append + + else: + item = wx.MenuItem(menu, id, itemtext, data[ + 'info'], wx.ITEM_NORMAL) + # print ' normal item' + + if data.has_key('bitmap'): + # print '_create_item bitmap',data['bitmap'] + # TODO: allow more image formats in menuitem + # item.SetBitmap(images.getSmilesBitmap()) + item.SetBitmap(data['bitmap']) + + # define callback function + if function != None: # None for submenueitem + # wx.EVT_MENU(self.parent,id,function) + self.parent.Bind(wx.EVT_MENU, function, id=id) + + return item, id + + def del_item(self, path): + menupath = string.split(path, '/')[:-1] + key = string.split(path, '/')[-1] + + menu, menu_dict, menuid = self.get_menu(menupath) + if menu: + if menu_dict.has_key(key): + menu.RemoveItem(menu_dict[key][0]) + # menu_dict[key][0].Remove() + del menu_dict[key] + + def del_menu(self, path): + menupath = string.split(path, '/')[:-1] + key = string.split(path, '/')[-1] + allpath = string.split(path, '/') + parentmenu, parentmenu_dict, parentmenuid = self.get_menu(menupath) + menu, menu_dict, menuid = self.get_menu(allpath) + + if menu: + if menuid > -1: + parentmenu.Remove(menuid) # works + del parentmenu_dict[key] + else: + self.Remove(menu) + del parentmenu_dict[key] + + def __setitem__(self, menupath, **data): + # print 'set menue',menupath,'to',data + + if type(name) != types.TupleType: + # create main menue entry, if necessary + if not self.menus.has_key(name): + newmenue = wx.Menu() + self.Append(newmenue, '&' + name) + self.menus[name] = (-1, {}) + + elif len(name) == 2: + # create submenu entry, if necessary + name1, name2 = name + if not self.menus.has_key(name1): + newmenue = wx.Menu() + self.Append(newmenue, '&' + name1) + self.menus[name] = (-1, {}) + + menuid, submenus = self.menus[name1] + + if not submenus.has_key(name2): + id = wx.NewId() + get_menu_item() + newmenue = wx.Menu() + self.Append(newmenue, '&' + name1) + self.menus[name] = {} + + submenu = self.menus + parentmenu = None + for m in menu: + if not submenu.has_key(m): + newmenue = wx.Menu() + + def get_menu_item(self, id): + item = self.FindItemById(id) + menu = item.GetMenu() + return menu, item + + def get_menuitem_from_id(self, id): + menu, item = self.get_menu_item(id) + return item + + +class AgilePopupMenu(wx.Menu, AgileMenuMixin): + + """ + Easy to use popup + """ + + def __init__(self, parent): + wx.Menu.__init__(self) + self.init_menu(parent) + + # append special root menu + AgileMenuMixin.append_menu(self, '.') + + def append_menu(self, path, **args): + AgileMenuMixin.append_menu(self, './' + path, popup=True, **args) + + def append_item(self, path, function, **args): + return AgileMenuMixin.append_item(self, './' + path, function, **args) + + def get_menuitem(self, path): + return AgileMenuMixin.get_menuitem(self, './' + path) + +#------------------------------------------------------------------------- + # the folling methods are used with contect\xd5\xd3\ +\xc3\x15:P)l!\n\x91\xc2\x1a\xd6`)\xec\xb1\x00\x92\xc2\x11?\xb8e\x88\x8fSt\ +\x19=\x00\x82\x16[\xf7')) + + +def GetPlusBitmap(): + return wx.BitmapFromXPMData(GetPlusData()) + +#---------------------------------------------------------------------- + + +def GetMinusData(): + return cPickle.loads(zlib.decompress( + 'x\xda\xd3\xc8)0\xe4\nV72T\x00!\x05Cu\xae\xc4`u=\x85d\x05\xa7\x9c\xc4\xe4l0O\ +\x01\xc8S\xb6t\x06A(\x1f\x0b RF\x0f\x08\xb0\xc9@D\xe1r\x08\x19\xb8j=\xa2e\ +\x10\x16@\x99\xc82zz\x10\'\x90"\x83\xc34r\xdc\x86\xf0\xa9\x9e\x1e\xae\xd0\ +\x81Ja\x0bQ\x88\x14\xd6\xb0\x06Ka\x8f\x05\x90\x14\x8e\xf8\xc1-C|\x9c\xa2\xcb\ +\xe8\x01\x00\xed\x0f[\x87')) + + +def GetMinusBitmap(): + return wx.BitmapFromXPMData(GetMinusData()) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/demand.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/demand.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/demand.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/demand.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,91 +1,100 @@ -import os, sys +import os +import sys from xml.sax import saxutils, parse, handler -if __name__ == '__main__': +if __name__ == '__main__': try: APPDIR = os.path.dirname(os.path.abspath(__file__)) except: APPDIR = os.path.dirname(os.path.abspath(sys.argv[0])) - SUMOPYDIR = os.path.join(APPDIR,'..','..') + SUMOPYDIR = os.path.join(APPDIR, '..', '..') sys.path.append(SUMOPYDIR) # Trip depart and arrival options, see # http://www.sumo.dlr.de/userdoc/Definition_of_Vehicles,_Vehicle_Types,_and_Routes.html#A_Vehicle.27s_depart_and_arrival_parameter -OPTIONMAP_POS_DEPARTURE = { "random":-1,"free":-2,"random_free":-3,"base":-4,"last":-5,"first":-6} -OPTIONMAP_POS_ARRIVAL = { "random":-1,"max":-2} -OPTIONMAP_SPEED_DEPARTURE = {"random":-1,"max":-2} -OPTIONMAP_SPEED_ARRIVAL = {"current":-1} -OPTIONMAP_LANE_DEPART = {"random":-1,"free":-2,"allowed":-3,"best":-4,"first":-5} -OPTIONMAP_LANE_ARRIVAL = {"current":-1} +OPTIONMAP_POS_DEPARTURE = {"random": -1, "free": -2, + "random_free": -3, "base": -4, "last": -5, "first": -6} +OPTIONMAP_POS_ARRIVAL = {"random": -1, "max": -2} +OPTIONMAP_SPEED_DEPARTURE = {"random": -1, "max": -2} +OPTIONMAP_SPEED_ARRIVAL = {"current": -1} +OPTIONMAP_LANE_DEPART = {"random": -1, "free": - + 2, "allowed": -3, "best": -4, "first": -5} +OPTIONMAP_LANE_ARRIVAL = {"current": -1} from coremodules.modules_common import * -import numpy as np +import numpy as np import agilepy.lib_base.classman as cm import agilepy.lib_base.arrayman as am import agilepy.lib_base.xmlman as xm from agilepy.lib_base.misc import get_inversemap #from agilepy.lib_base.geometry import find_area -from agilepy.lib_base.processes import Process,CmlMixin,ff,call -from coremodules.network.network import SumoIdsConf,MODES +from agilepy.lib_base.processes import Process, CmlMixin, ff, call +from coremodules.network.network import SumoIdsConf, MODES -import vehicles,origin_to_destination,virtualpop,turnflows - +import vehicles +import origin_to_destination +import virtualpop +import turnflows + + +def route(tripfilepath, netfilepath, routefilepath, options='-v --ignore-errors'): + # do not use options: --repair --remove-loops + cmd = 'duarouter ' + options + ' --trip-files %s --net-file %s --output-file %s'\ + % (ff(tripfilepath), ff(netfilepath), ff(routefilepath)) + return call(cmd) -def route(tripfilepath, netfilepath, routefilepath, options = '-v --ignore-errors'): - # do not use options: --repair --remove-loops - cmd = 'duarouter '+options+' --trip-files %s --net-file %s --output-file %s'\ - %( ff(tripfilepath), ff(netfilepath),ff(routefilepath)) - return call(cmd) class Router(Process): + """ Not in use !! """ - def __init__(self, trips, net, logger = None,**kwargs): - - self._init_common( 'router', name = 'Router', - logger = logger, - info ='Generates routes from trips.', - ) + + def __init__(self, trips, net, logger=None, **kwargs): + + self._init_common('router', name='Router', + logger=logger, + info='Generates routes from trips.', + ) self._trips = trips self._net = net - + attrsman = self.get_attrsman() - self.add_option('netfilepath',netfilepath, - groupnames = ['options'],# this will make it show up in the dialog - cml = '--sumo-net-file', - perm='rw', - name = 'Net file', - wildcards = 'Net XML files (*.net.xml)|*.net.xml', - metatype = 'filepath', - info = 'SUMO Net file in XML format.', + self.add_option('netfilepath', netfilepath, + # this will make it show up in the dialog + groupnames=['options'], + cml='--sumo-net-file', + perm='rw', + name='Net file', + wildcards='Net XML files (*.net.xml)|*.net.xml', + metatype='filepath', + info='SUMO Net file in XML format.', ) - - self.workdirpath = attrsman.add(cm.AttrConf( 'workdirpath',rootdirpath, - groupnames = ['_private'],#['options'],#['_private'], - perm='r', - name = 'Workdir', - metatype = 'dirpath', - info = 'Working directory for this scenario.', - )) - - self.rootname = attrsman.add(cm.AttrConf( 'rootname',rootname, - groupnames = ['_private'], - perm='r', - name = 'Scenario shortname', - info = 'Scenario shortname is also rootname of converted files.', - )) - - - self.is_clean_nodes = attrsman.add(cm.AttrConf( 'is_clean_nodes',is_clean_nodes, - groupnames = ['options'], - perm='rw', - name = 'Clean Nodes', - info = 'If set, then shapes around nodes are cleaned up.', - )) - - + + self.workdirpath = attrsman.add(cm.AttrConf('workdirpath', rootdirpath, + # ['options'],#['_private'], + groupnames=['_private'], + perm='r', + name='Workdir', + metatype='dirpath', + info='Working directory for this scenario.', + )) + + self.rootname = attrsman.add(cm.AttrConf('rootname', rootname, + groupnames=['_private'], + perm='r', + name='Scenario shortname', + info='Scenario shortname is also rootname of converted files.', + )) + + self.is_clean_nodes = attrsman.add(cm.AttrConf('is_clean_nodes', is_clean_nodes, + groupnames=['options'], + perm='rw', + name='Clean Nodes', + info='If set, then shapes around nodes are cleaned up.', + )) + def update_params(self): """ Make all parameters consistent. @@ -95,682 +104,686 @@ pass #self.workdirpath = os.path.dirname(self.netfilepath) #bn = os.path.basename(self.netfilepath).split('.') - #if len(bn)>0: + # if len(bn)>0: # self.rootname = bn[0] - + def do(self): self.update_params() - cml = self.get_cml()+' --plain-output-prefix '+filepathlist_to_filepathstring(os.path.join(self.workdirpath, self.rootname)) - #print 'SumonetImporter.do',cml + cml = self.get_cml() + ' --plain-output-prefix ' + \ + filepathlist_to_filepathstring( + os.path.join(self.workdirpath, self.rootname)) + # print 'SumonetImporter.do',cml #import_xml(self, rootname, dirname, is_clean_nodes = True) self.run_cml(cml) if self.status == 'success': - self._net.import_xml(self.rootname, self.workdirpath, is_clean_nodes = self.is_clean_nodes) - - #print 'do',self.rootname - #self._scenario = Scenario( self.rootname, - # parent = None, + self._net.import_xml( + self.rootname, self.workdirpath, is_clean_nodes=self.is_clean_nodes) + + # print 'do',self.rootname + # self._scenario = Scenario( self.rootname, + # parent = None, # workdirpath = self.workdirpath, # logger = self.get_logger(), # ) def get_net(self): return self._net - + + class Demand(cm.BaseObjman): - def __init__(self, scenario=None, net = None, zones = None, name = 'Demand', info ='Transport demand', **kwargs): - #print 'Network.__init__',name,kwargs - - # we need a network from somewhere - if net == None: - net = scenario.net - zones = scenario.landuse.zones - - self._init_objman(ident= 'demand', parent=scenario, name = name, info = info, **kwargs) - attrsman = self.set_attrsman(cm.Attrsman(self)) - - self.vtypes = attrsman.add( cm.ObjConf( vehicles.VehicleTypes(self, net) ) ) - self.trips = attrsman.add( cm.ObjConf( Trips(self,net)) ) - - - self.odintervals = attrsman.add( cm.ObjConf(origin_to_destination.OdIntervals('odintervals',self, net, zones) )) - self.turnflows = attrsman.add( cm.ObjConf(turnflows.Turnflows('turnflows',self, net) )) - if scenario != None: - self.virtualpop = attrsman.add( cm.ObjConf(virtualpop.Virtualpolulation(self) )) - #print 'Demand',self.odintervals#,self.odintervals.times_start - #print ' ',dir(self.odintervals) - - def get_scenario(self): - return self.parent - - def get_net(self): - return self.parent.net - - def update_netoffset(self, deltaoffset): - """ - Called when network offset has changed. - Children may need to adjust theur coordinates. - """ - #self.odintervals.update_netoffset(deltaoffset) - pass - - def import_xml(self, rootname, dirname=''): - """ - Import whatever is available. - """ - - filepath = os.path.join(dirname,rootname+'.trip.xml') + + def __init__(self, scenario=None, net=None, zones=None, name='Demand', info='Transport demand', **kwargs): + # print 'Network.__init__',name,kwargs + + # we need a network from somewhere + if net == None: + net = scenario.net + zones = scenario.landuse.zones + + self._init_objman(ident='demand', parent=scenario, + name=name, info=info, **kwargs) + attrsman = self.set_attrsman(cm.Attrsman(self)) + + self.vtypes = attrsman.add(cm.ObjConf( + vehicles.VehicleTypes(self, net))) + self.trips = attrsman.add(cm.ObjConf(Trips(self, net))) + + self.odintervals = attrsman.add(cm.ObjConf( + origin_to_destination.OdIntervals('odintervals', self, net, zones))) + self.turnflows = attrsman.add(cm.ObjConf( + turnflows.Turnflows('turnflows', self, net))) + if scenario != None: + self.virtualpop = attrsman.add( + cm.ObjConf(virtualpop.Virtualpolulation(self))) + # print 'Demand',self.odintervals#,self.odintervals.times_start + # print ' ',dir(self.odintervals) + + def get_scenario(self): + return self.parent + + def get_net(self): + return self.parent.net + + def update_netoffset(self, deltaoffset): + """ + Called when network offset has changed. + Children may need to adjust theur coordinates. + """ + # self.odintervals.update_netoffset(deltaoffset) + pass + + def import_xml(self, rootname, dirname=''): + """ + Import whatever is available. + """ + + filepath = os.path.join(dirname, rootname + '.trip.xml') + if os.path.isfile(filepath): + # import trips + self.trips.import_trips_xml(filepath, is_generate_ids=False) + + # now try to add routes to existing trips + filepath = os.path.join(dirname, rootname + '.rou.xml') if os.path.isfile(filepath): - # import trips - self.trips.import_trips_xml(filepath, is_generate_ids = False) - - # now try to add routes to existing trips - filepath = os.path.join(dirname,rootname+'.rou.xml') - if os.path.isfile(filepath): - self.trips.import_routes_xml(filepath, is_generate_ids = False, is_add = True) - - else: - self.get_logger().w('import_xml: files not found:'+filepath, key='message') - - + self.trips.import_routes_xml( + filepath, is_generate_ids=False, is_add=True) + else: - self.get_logger().w('import_xml: files not found:'+filepath, key='message') - - - # no trip file exists, but maybe just a route file with trips - filepath = os.path.join(dirname,rootname+'.rou.xml') - if os.path.isfile(filepath): - self.trips.import_routes_xml(filepath, is_generate_ids = False, is_add = False) - - else: - self.get_logger().w('import_xml: files not found:'+filepath, key='message') - - - - + self.get_logger().w( + 'import_xml: files not found:' + filepath, key='message') + + else: + self.get_logger().w( + 'import_xml: files not found:' + filepath, key='message') + + # no trip file exists, but maybe just a route file with trips + filepath = os.path.join(dirname, rootname + '.rou.xml') + if os.path.isfile(filepath): + self.trips.import_routes_xml( + filepath, is_generate_ids=False, is_add=False) + + else: + self.get_logger().w( + 'import_xml: files not found:' + filepath, key='message') + + class Routes(am.ArrayObjman): + def __init__(self, ident, trips, net, **kwargs): - - self._init_objman( ident = ident, - parent = trips, - name = 'Routes', - info = 'Table with route info.', - xmltag = ('routes','route',None), - **kwargs) - + + self._init_objman(ident=ident, + parent=trips, + name='Routes', + info='Table with route info.', + xmltag=('routes', 'route', None), + **kwargs) + #self.add_col(SumoIdsConf('Route', xmltag = 'id')) - - - self.add_col(am.IdsArrayConf( 'ids_trip', trips, - groupnames = ['state'], - name = 'Trip ID', - info = 'Route for this trip ID.', - )) - - - self.add_col(am.IdlistsArrayConf( 'ids_edges', net.edges, - name = 'Edge IDs', - info = 'List of edge IDs constituting the route.', - xmltag = 'edges', - )) - - - self.add_col(am.ArrayConf( 'costs', 0.0, - dtype=np.float32, - perm='r', - name = 'Costs', - info = "Route costs.", - xmltag = 'cost', - )) - - self.add_col(am.ArrayConf( 'probabilities', 1.0, - dtype=np.float32, - perm='r', - name = 'Probab.', - info = "Route route choice probability.", - xmltag = 'probability', - )) - - self.add_col(am.ArrayConf( 'colors', np.ones(4,np.float32), - dtype=np.float32, - metatype = 'color', - perm = 'rw', - name = 'Color', - info = "Route color. Color as RGBA tuple with values from 0.0 to 1.0", - xmltag = 'color', - )) - - + + self.add_col(am.IdsArrayConf('ids_trip', trips, + groupnames=['state'], + name='Trip ID', + info='Route for this trip ID.', + )) + + self.add_col(am.IdlistsArrayConf('ids_edges', net.edges, + name='Edge IDs', + info='List of edge IDs constituting the route.', + xmltag='edges', + )) + + self.add_col(am.ArrayConf('costs', 0.0, + dtype=np.float32, + perm='r', + name='Costs', + info="Route costs.", + xmltag='cost', + )) + + self.add_col(am.ArrayConf('probabilities', 1.0, + dtype=np.float32, + perm='r', + name='Probab.', + info="Route route choice probability.", + xmltag='probability', + )) + + self.add_col(am.ArrayConf('colors', np.ones(4, np.float32), + dtype=np.float32, + metatype='color', + perm='rw', + name='Color', + info="Route color. Color as RGBA tuple with values from 0.0 to 1.0", + xmltag='color', + )) + def clear_routes(self): - self.clear() - + self.clear() + + class Trips(am.ArrayObjman): + def __init__(self, demand, net, **kwargs): - #print 'Trips.__init__' - self._init_objman( ident='trips', - parent = demand, - name = 'Trips', - info = 'Table with trip and route info.', - xmltag = ('trips','trip','ids_sumo'), - **kwargs) - - - - - self.add_col(SumoIdsConf('Trip', xmltag = 'id')) - - - self.add_col(am.IdsArrayConf( 'ids_vtype', demand.vtypes, - groupnames = ['state'], - name = 'Type', - info = 'Vehicle type.', - xmltag = 'type', - )) - - self.add_col(am.ArrayConf( 'times_depart', 0, - dtype=np.int32, - perm='rw', - name = 'Depart time', - info = "Departure time of vehicle in seconds. Must be an integer!", - xmltag = 'depart', - )) - - - self.add_col(am.IdsArrayConf( 'ids_edge_depart', net.edges, - groupnames = ['state'], - name = 'ID from-edge', - info = 'ID of network edge where trip starts.', - xmltag = 'from', - )) - - self.add_col(am.IdsArrayConf( 'ids_edge_arrival', net.edges, - groupnames = ['state'], - name = 'ID to-edge', - info = 'ID of network edge where trip ends.', - xmltag = 'to', - )) - - - self.add_col(am.ArrayConf( 'inds_lane_depart', OPTIONMAP_LANE_DEPART["free"], - dtype=np.int32, - #choices = OPTIONMAP_LANE_DEPART, - perm='r', - name = 'Depart lane', - info = "Departure lane index. 0 is rightmost lane or sidewalk, if existant.", - xmltag = 'departLane', - xmlmap = get_inversemap(OPTIONMAP_LANE_DEPART), - )) - - - self.add_col(am.ArrayConf( 'positions_depart', OPTIONMAP_POS_DEPARTURE["random_free"], - dtype=np.float32, - #choices = OPTIONMAP_POS_DEPARTURE, - perm='r', - name = 'Depart pos', - unit = 'm', - info = "Position on edge at the moment of departure.", - xmltag = 'departPos', - xmlmap = get_inversemap(OPTIONMAP_POS_DEPARTURE), - )) - - self.add_col(am.ArrayConf( 'speeds_depart', 0.0, - dtype=np.float32, - #choices = OPTIONMAP_SPEED_DEPARTURE, - perm='r', - name = 'Depart speed', - unit = 'm/s', - info = "Speed at the moment of departure.", - xmltag = 'departSpeed', - xmlmap = get_inversemap(OPTIONMAP_SPEED_DEPARTURE), - )) - self.add_col(am.ArrayConf( 'inds_lane_arrival', OPTIONMAP_LANE_ARRIVAL["current"], - dtype=np.int32, - #choices = OPTIONMAP_LANE_ARRIVAL, - perm='r', - name = 'Arrival lane', - info = "Arrival lane index. 0 is rightmost lane or sidewalk, if existant.", - xmltag = 'arrivalLane', - xmlmap = get_inversemap(OPTIONMAP_LANE_ARRIVAL), - )) - - self.add_col(am.ArrayConf( 'positions_arrival', OPTIONMAP_POS_ARRIVAL["random"], - dtype=np.float32, - #choices = OPTIONMAP_POS_ARRIVAL, - perm='r', - name = 'Arrival pos', - unit = 'm', - info = "Position on edge at the moment of arrival.", - xmltag = 'arrivalPos', - xmlmap = get_inversemap(OPTIONMAP_POS_ARRIVAL), - )) - - self.add_col(am.ArrayConf( 'speeds_arrival', 0.0, - dtype=np.float32, - #choices = OPTIONMAP_SPEED_ARRIVAL, - perm='r', - name = 'Arrival speed', - unit = 'm/s', - info = "Arrival at the moment of departure.", - xmltag = 'arrivalSpeed', - xmlmap = get_inversemap(OPTIONMAP_SPEED_ARRIVAL), - )) - - self.add( cm.ObjConf( Routes('routes', self, net))) - - #print ' self.routes.get_value()',self.routes.get_value() - self.add_col(am.IdlistsArrayConf( 'ids_routes', self.routes.get_value(), - name = 'Route IDs', - info = 'List of edge IDs constituting the route.', - )) - - + # print 'Trips.__init__' + self._init_objman(ident='trips', + parent=demand, + name='Trips', + info='Table with trip and route info.', + xmltag=('trips', 'trip', 'ids_sumo'), + **kwargs) + + self.add_col(SumoIdsConf('Trip', xmltag='id')) + + self.add_col(am.IdsArrayConf('ids_vtype', demand.vtypes, + groupnames=['state'], + name='Type', + info='Vehicle type.', + xmltag='type', + )) + + self.add_col(am.ArrayConf('times_depart', 0, + dtype=np.int32, + perm='rw', + name='Depart time', + info="Departure time of vehicle in seconds. Must be an integer!", + xmltag='depart', + )) + + self.add_col(am.IdsArrayConf('ids_edge_depart', net.edges, + groupnames=['state'], + name='ID from-edge', + info='ID of network edge where trip starts.', + xmltag='from', + )) + + self.add_col(am.IdsArrayConf('ids_edge_arrival', net.edges, + groupnames=['state'], + name='ID to-edge', + info='ID of network edge where trip ends.', + xmltag='to', + )) + + self.add_col(am.ArrayConf('inds_lane_depart', OPTIONMAP_LANE_DEPART["free"], + dtype=np.int32, + #choices = OPTIONMAP_LANE_DEPART, + perm='r', + name='Depart lane', + info="Departure lane index. 0 is rightmost lane or sidewalk, if existant.", + xmltag='departLane', + xmlmap=get_inversemap(OPTIONMAP_LANE_DEPART), + )) + + self.add_col(am.ArrayConf('positions_depart', OPTIONMAP_POS_DEPARTURE["random_free"], + dtype=np.float32, + #choices = OPTIONMAP_POS_DEPARTURE, + perm='r', + name='Depart pos', + unit='m', + info="Position on edge at the moment of departure.", + xmltag='departPos', + xmlmap=get_inversemap( + OPTIONMAP_POS_DEPARTURE), + )) + + self.add_col(am.ArrayConf('speeds_depart', 0.0, + dtype=np.float32, + #choices = OPTIONMAP_SPEED_DEPARTURE, + perm='r', + name='Depart speed', + unit='m/s', + info="Speed at the moment of departure.", + xmltag='departSpeed', + xmlmap=get_inversemap( + OPTIONMAP_SPEED_DEPARTURE), + )) + self.add_col(am.ArrayConf('inds_lane_arrival', OPTIONMAP_LANE_ARRIVAL["current"], + dtype=np.int32, + #choices = OPTIONMAP_LANE_ARRIVAL, + perm='r', + name='Arrival lane', + info="Arrival lane index. 0 is rightmost lane or sidewalk, if existant.", + xmltag='arrivalLane', + xmlmap=get_inversemap( + OPTIONMAP_LANE_ARRIVAL), + )) + + self.add_col(am.ArrayConf('positions_arrival', OPTIONMAP_POS_ARRIVAL["random"], + dtype=np.float32, + #choices = OPTIONMAP_POS_ARRIVAL, + perm='r', + name='Arrival pos', + unit='m', + info="Position on edge at the moment of arrival.", + xmltag='arrivalPos', + xmlmap=get_inversemap(OPTIONMAP_POS_ARRIVAL), + )) + + self.add_col(am.ArrayConf('speeds_arrival', 0.0, + dtype=np.float32, + #choices = OPTIONMAP_SPEED_ARRIVAL, + perm='r', + name='Arrival speed', + unit='m/s', + info="Arrival at the moment of departure.", + xmltag='arrivalSpeed', + xmlmap=get_inversemap( + OPTIONMAP_SPEED_ARRIVAL), + )) + + self.add(cm.ObjConf(Routes('routes', self, net))) + + # print ' self.routes.get_value()',self.routes.get_value() + self.add_col(am.IdlistsArrayConf('ids_routes', self.routes.get_value(), + name='Route IDs', + info='List of edge IDs constituting the route.', + )) - def clear_trips(self): self.routes.get_value().clear_routes() self.clear() - + def clear_routes(self): self.routes.get_value().clear_routes() self.ids_routes.reset() - + def get_net(self): return self.parent.get_scenario().net - + def get_scenario(self): return self.parent.get_scenario() - + def get_time_depart_first(self): - if len(self)>0: + if len(self) > 0: return float(np.min(self.times_depart.get_value())) else: return 0.0 - + def get_time_depart_last(self): - if len(self)>0: + if len(self) > 0: return float(np.max(self.times_depart.get_value())) else: return 0.0 - + def get_tripfilepath(self): - return self.get_scenario().get_rootfilepath()+'.trip.xml' + return self.get_scenario().get_rootfilepath() + '.trip.xml' #dirname = self.get_scenario().get_workdirpath() #ident = self.get_scenario().get_ident() - #return os.path.join(dirname,ident+'.trip.xml') - - + # return os.path.join(dirname,ident+'.trip.xml') + def get_routefilepath(self): - return self.get_scenario().get_rootfilepath()+'.rou.xml' + return self.get_scenario().get_rootfilepath() + '.rou.xml' #dirname = self.get_scenario().get_workdirpath() #ident = self.get_scenario().get_ident() - #return os.path.join(dirname,ident+'.rou.xml') - - - - def route(self, is_export_net = False, is_export_trips = True, - routefilepath = None, **kwargs): - - + # return os.path.join(dirname,ident+'.rou.xml') + + def route(self, is_export_net=False, is_export_trips=True, + routefilepath=None, **kwargs): + #routesattrname = self.get_routesattrname(routesindex) - vtypes = self.parent.vtypes - if (not os.path.isfile(self.get_tripfilepath()))|is_export_trips: - ids_vtype_pedestrian = vtypes.select_by_mode(mode = 'pedestrian', is_sumoid = False) - self.export_trips_xml(ids_vtype_exclude = ids_vtype_pedestrian) - - if (not os.path.isfile(self.get_net().get_filepath()))|is_export_net: - self.get_net().export_netxml() - - - if routefilepath is None: - routefilepath = self.get_routefilepath() - - if route( self.get_tripfilepath(), self.get_net().get_filepath(), - routefilepath, **kwargs): - - self.import_routes_xml(routefilepath, is_clear_trips = False, - is_generate_ids = False, - is_add = True) - return routefilepath - - else: - return None - - def make_trip(self, is_generate_ids = True, **kwargs): - id_trip = self.add_row( ids_vtype = kwargs.get('id_vtype',None), - times_depart = kwargs.get('time_depart',None), - ids_edge_depart = kwargs.get('id_edge_depart',None), - ids_edge_arrival = kwargs.get('id_edge_arrival',None), - inds_lane_depart = kwargs.get('ind_lane_depart',None), - positions_depart = kwargs.get('position_depart',None), - speeds_depart = kwargs.get('speed_depart',None), - inds_lane_arrival = kwargs.get('ind_lane_arrival',None), - positions_arrival = kwargs.get('position_arrival',None), - speeds_arrival = kwargs.get('speed_arrival',None), - ids_routes = [], - ) + vtypes = self.parent.vtypes + if (not os.path.isfile(self.get_tripfilepath())) | is_export_trips: + ids_vtype_pedestrian = vtypes.select_by_mode( + mode='pedestrian', is_sumoid=False) + self.export_trips_xml(ids_vtype_exclude=ids_vtype_pedestrian) + + if (not os.path.isfile(self.get_net().get_filepath())) | is_export_net: + self.get_net().export_netxml() + + if routefilepath is None: + routefilepath = self.get_routefilepath() + + if route(self.get_tripfilepath(), self.get_net().get_filepath(), + routefilepath, **kwargs): + + self.import_routes_xml(routefilepath, is_clear_trips=False, + is_generate_ids=False, + is_add=True) + return routefilepath + + else: + return None + + def make_trip(self, is_generate_ids=True, **kwargs): + id_trip = self.add_row(ids_vtype=kwargs.get('id_vtype', None), + times_depart=kwargs.get('time_depart', None), + ids_edge_depart=kwargs.get( + 'id_edge_depart', None), + ids_edge_arrival=kwargs.get( + 'id_edge_arrival', None), + inds_lane_depart=kwargs.get( + 'ind_lane_depart', None), + positions_depart=kwargs.get( + 'position_depart', None), + speeds_depart=kwargs.get('speed_depart', None), + inds_lane_arrival=kwargs.get( + 'ind_lane_arrival', None), + positions_arrival=kwargs.get( + 'position_arrival', None), + speeds_arrival=kwargs.get( + 'speed_arrival', None), + ids_routes=[], + ) if is_generate_ids: self.ids_sumo[id_trip] = str(id_trip) else: - self.ids_sumo[id_trip] = kwargs.get('id_sumo',str(id_trip)) # id - + self.ids_sumo[id_trip] = kwargs.get('id_sumo', str(id_trip)) # id + if kwargs.has_key('route'): - id_route = self.routes.get_value().add_row( ids_trip = id_trip, - ids_edges = kwargs['route'] - ) - self.ids_routes[id_trip]= [id_route] - + id_route = self.routes.get_value().add_row(ids_trip=id_trip, + ids_edges=kwargs[ + 'route'] + ) + self.ids_routes[id_trip] = [id_route] + return id_trip - - def make_trips(self, ids_vtype, is_generate_ids = True, **kwargs): - #print 'make_trips ids_vtype =',ids_vtype - #print ' kwargs=',kwargs - ids_trip = self.add_rows(\ - ids_vtype = ids_vtype, - times_depart = kwargs.get('times_depart',None), - ids_edge_depart = kwargs.get('ids_edge_depart',None), - ids_edge_arrival = kwargs.get('ids_edge_arrival',None), - inds_lane_depart = kwargs.get('inds_lane_depart',None), - positions_depart = kwargs.get('positions_depart',None), - speeds_depart = kwargs.get('speeds_depart',None), - inds_lane_arrival = kwargs.get('inds_lane_arrival',None), - positions_arrival = kwargs.get('positions_arrival',None), - speeds_arrival = kwargs.get('speeds_arrival',None), - #ids_routes = len(ids_vtype)*[[]], - ) - + + def make_trips(self, ids_vtype, is_generate_ids=True, **kwargs): + # print 'make_trips ids_vtype =',ids_vtype + # print ' kwargs=',kwargs + ids_trip = self.add_rows( + ids_vtype=ids_vtype, + times_depart=kwargs.get('times_depart', None), + ids_edge_depart=kwargs.get('ids_edge_depart', None), + ids_edge_arrival=kwargs.get('ids_edge_arrival', None), + inds_lane_depart=kwargs.get('inds_lane_depart', None), + positions_depart=kwargs.get('positions_depart', None), + speeds_depart=kwargs.get('speeds_depart', None), + inds_lane_arrival=kwargs.get('inds_lane_arrival', None), + positions_arrival=kwargs.get('positions_arrival', None), + speeds_arrival=kwargs.get('speeds_arrival', None), + #ids_routes = len(ids_vtype)*[[]], + ) + if is_generate_ids: self.ids_sumo[ids_trip] = np.array(ids_trip, np.str) else: - self.ids_sumo[ids_trip] = kwargs.get('ids_sumo',np.array(ids_trip,np.str)) + self.ids_sumo[ids_trip] = kwargs.get( + 'ids_sumo', np.array(ids_trip, np.str)) return ids_trip - - def make_routes(self, ids_vtype, is_generate_ids = True, routes = None, ids_trip=None, **kwargs): - #print 'make_routes',is_generate_ids - - if ids_trip is None: #is_generate_ids = is_generate_ids, - #print ' generate new trips' - ids_trip=self.make_trips(ids_vtype, is_generate_ids =is_generate_ids, **kwargs) - - #print ' ids_trip =',ids_trip - ids_routes = self.routes.get_value().add_rows( ids_trip = ids_trip, - ids_edges = routes, - ) - - for id_trip, id_route in zip(ids_trip,ids_routes): + + def make_routes(self, ids_vtype, is_generate_ids=True, routes=None, ids_trip=None, **kwargs): + # print 'make_routes',is_generate_ids + + if ids_trip is None: # is_generate_ids = is_generate_ids, + # print ' generate new trips' + ids_trip = self.make_trips( + ids_vtype, is_generate_ids=is_generate_ids, **kwargs) + + # print ' ids_trip =',ids_trip + ids_routes = self.routes.get_value().add_rows(ids_trip=ids_trip, + ids_edges=routes, + ) + + for id_trip, id_route in zip(ids_trip, ids_routes): # no!: self.ids_routes[id_trip].append(id_route) - #print ' self.ids_routes[id_trip]',self.ids_routes[id_trip],id_route + # print ' + # self.ids_routes[id_trip]',self.ids_routes[id_trip],id_route if self.ids_routes[id_trip] is None: - self.ids_routes[id_trip] = [id_route] # this works! + self.ids_routes[id_trip] = [id_route] # this works! else: self.ids_routes[id_trip].append(id_route) - - #no!:self.ids_routes[ids_trip] = ids_routes.reshape((-1,1)).tolist()# this makes an array of lists - #print ' self.ids_routes.get_value()',self.ids_routes[ids_trip] - #print ' ids_routes.reshape((-1,1)).tolist()',ids_routes.reshape((-1,1)).tolist() - #print ' make_routes DONE' - return ids_routes,ids_trip - - def export_trips_xml(self, filepath=None, encoding = 'UTF-8', - ids_vtype_exclude = []): + + # no!:self.ids_routes[ids_trip] = ids_routes.reshape((-1,1)).tolist()# this makes an array of lists + # print ' self.ids_routes.get_value()',self.ids_routes[ids_trip] + # print ' ids_routes.reshape((-1,1)).tolist()',ids_routes.reshape((-1,1)).tolist() + # print ' make_routes DONE' + return ids_routes, ids_trip + + def export_trips_xml(self, filepath=None, encoding='UTF-8', + ids_vtype_exclude=[]): """ Export trips to SUMO xml file. Method takes care of sorting trips by departure time. """ if filepath == None: filepath = self.get_tripfilepath() - print 'export_trips_xml',filepath + print 'export_trips_xml', filepath try: - fd=open(filepath,'w') + fd = open(filepath, 'w') except: - print 'WARNING in write_obj_to_xml: could not open',filepath + print 'WARNING in write_obj_to_xml: could not open', filepath return False - + xmltag, xmltag_item, attrname_id = self.xmltag - fd.write('\n'%encoding) + fd.write('\n' % encoding) fd.write(xm.begin(xmltag)) indent = 2 - + ids_trip = self.times_depart.get_ids_sorted() ids_vtype = self.ids_vtype[ids_trip] #ids_vtypes_exclude = self.ids_vtype.get_ids_from_indices(vtypes_exclude) - + inds_selected = np.ones(len(ids_vtype), np.bool) for id_vtype in ids_vtype_exclude: inds_selected[ids_vtype == id_vtype] = False ids_trip_selected = ids_trip[inds_selected] - ids_vtype_selected = set(ids_vtype[inds_selected]) + ids_vtype_selected = set(ids_vtype[inds_selected]) #ids_vtypes_selected = set(ids_vtypes).difference(ids_vtypes_exclude) - - self.parent.vtypes.write_xml( fd, indent=indent, - ids = ids_vtype_selected, - is_print_begin_end = False) - - - self.write_xml( fd, indent=indent, - ids = ids_trip_selected, - attrconfigs_excluded = [self.routes, self.ids_routes], - is_print_begin_end = False) - + + self.parent.vtypes.write_xml(fd, indent=indent, + ids=ids_vtype_selected, + is_print_begin_end=False) + + self.write_xml(fd, indent=indent, + ids=ids_trip_selected, + attrconfigs_excluded=[self.routes, self.ids_routes], + is_print_begin_end=False) + fd.write(xm.end(xmltag)) fd.close() return filepath - - def export_routes_xml(self, filepath=None, method_routechoice = None, encoding = 'UTF-8'): + + def export_routes_xml(self, filepath=None, method_routechoice=None, encoding='UTF-8'): """ Export routes to SUMO xml file. Method takes care of sorting trips by departure time. """ if method_routechoice == None: method_routechoice = self.get_route_first - + if filepath == None: filepath = self.get_routefilepath() - print 'export_routes_xml',filepath + print 'export_routes_xml', filepath try: - fd=open(filepath,'w') + fd = open(filepath, 'w') except: - print 'WARNING in write_obj_to_xml: could not open',filepath + print 'WARNING in write_obj_to_xml: could not open', filepath return False - - xmltag_routes, xmltag_veh, attrname_id = ("routes","vehicle","ids_sumo") + + xmltag_routes, xmltag_veh, attrname_id = ( + "routes", "vehicle", "ids_sumo") xmltag_trip = "trip" xmltag_rou = "route" - - fd.write('\n'%encoding) + + fd.write('\n' % encoding) fd.write(xm.begin(xmltag_routes)) indent = 2 - + #ids_modes_used = set(self.parent.vtypes.ids_mode[self.ids_vtype.get_value()]) - self.parent.vtypes.write_xml( fd, indent=indent, - ids = set(self.ids_vtype.get_value()), - is_print_begin_end = False - ) - - + self.parent.vtypes.write_xml(fd, indent=indent, + ids=set(self.ids_vtype.get_value()), + is_print_begin_end=False + ) + ids_mode = self.parent.vtypes.ids_mode id_pedestrian = MODES['pedestrian'] routes = self.routes.get_value() - + # here we could write the route info # but we do write it inside each trip so that it can be parsed # in the same way as duarouter output - # routes.write_xml( fd, indent=indent, + # routes.write_xml( fd, indent=indent, # attrconfigs_excluded = [routes.costs, routes.probabilities], # is_print_begin_end = False) - - # let's write trip info manually - tripconfigs = [ self.ids_vtype, - self.times_depart, - self.ids_edge_depart, - self.ids_edge_arrival, - self.inds_lane_depart, - self.positions_depart, - self.speeds_depart, - self.inds_lane_arrival, - self.positions_arrival, - self.speeds_arrival, - ] - + + # let's write trip info manually + tripconfigs = [self.ids_vtype, + self.times_depart, + self.ids_edge_depart, + self.ids_edge_arrival, + self.inds_lane_depart, + self.positions_depart, + self.speeds_depart, + self.inds_lane_arrival, + self.positions_arrival, + self.speeds_arrival, + ] + routeconfigs = [routes.ids_edges, routes.colors, ] - - + attrconfig_id = getattr(self.get_attrsman(), attrname_id) xmltag_id = attrconfig_id.xmltag - + for id_trip in self.times_depart.get_ids_sorted(): - - + if ids_mode[self.ids_vtype[id_trip]] == id_pedestrian: - self.write_persontrip_xml(fd, id_trip, - method_routechoice = method_routechoice, - indent = indent+2) - - else: - id_route = method_routechoice(id_trip)# - if id_route>=0:# a valid route has been found + self.write_persontrip_xml(fd, id_trip, + method_routechoice=method_routechoice, + indent=indent + 2) + + else: + id_route = method_routechoice(id_trip) + if id_route >= 0: # a valid route has been found # init vehicle route only if valid route exists - fd.write(xm.start(xmltag_veh,indent+2)) + fd.write(xm.start(xmltag_veh, indent + 2)) else: # init trip instead of route - fd.write(xm.start(xmltag_trip,indent+2)) - - #print ' make tag and id',_id - fd.write(xm.num(xmltag_id,attrconfig_id[id_trip])) - - #print ' write columns',len(scalarcolconfigs)>0,len(idcolconfig_include_tab)>0,len(objcolconfigs)>0 + fd.write(xm.start(xmltag_trip, indent + 2)) + + # print ' make tag and id',_id + fd.write(xm.num(xmltag_id, attrconfig_id[id_trip])) + + # print ' write + # columns',len(scalarcolconfigs)>0,len(idcolconfig_include_tab)>0,len(objcolconfigs)>0 for attrconfig in tripconfigs: - #print ' attrconfig',attrconfig.attrname - attrconfig.write_xml(fd,id_trip) - - if id_route>=0:# a valid route has been found + # print ' attrconfig',attrconfig.attrname + attrconfig.write_xml(fd, id_trip) + + if id_route >= 0: # a valid route has been found # write route id #fd.write(xm.num('route', id_route )) - + # instead of route id we write entire route here fd.write(xm.stop()) - fd.write(xm.start(xmltag_rou,indent+4)) + fd.write(xm.start(xmltag_rou, indent + 4)) for attrconfig in routeconfigs: - #print ' attrconfig',attrconfig.attrname - attrconfig.write_xml(fd,id_route) - - # end route and vehicle + # print ' attrconfig',attrconfig.attrname + attrconfig.write_xml(fd, id_route) + + # end route and vehicle fd.write(xm.stopit()) - fd.write(xm.end(xmltag_veh,indent+2)) - + fd.write(xm.end(xmltag_veh, indent + 2)) + else: # end trip without route fd.write(xm.stopit()) - - - - + fd.write(xm.end(xmltag_routes)) fd.close() return filepath - - def write_persontrip_xml(self, fd, id_trip, indent = 2, method_routechoice = None): + + def write_persontrip_xml(self, fd, id_trip, indent=2, method_routechoice=None): # currently no routes are exported, only origin and destination edges - #if method_routechoice == None: + # if method_routechoice == None: # method_routechoice = self.get_route_first xmltag_person = 'person' - id_route = method_routechoice(id_trip)# - + id_route = method_routechoice(id_trip) + fd.write(xm.start(xmltag_person, indent)) - - self.ids_sumo.write_xml(fd,id_trip) - self.times_depart.write_xml(fd,id_trip) - self.ids_vtype.write_xml(fd,id_trip) + + self.ids_sumo.write_xml(fd, id_trip) + self.times_depart.write_xml(fd, id_trip) + self.ids_vtype.write_xml(fd, id_trip) fd.write(xm.stop()) - - fd.write(xm.start('walk',indent=indent+2)) - #print 'write walk',id_trip,self.positions_depart[id_trip],self.positions_arrival[id_trip] - self.ids_edge_depart.write_xml(fd,id_trip) - if self.positions_depart[id_trip]>0: - self.positions_depart.write_xml(fd,id_trip) - - self.ids_edge_arrival.write_xml(fd,id_trip) - if self.positions_arrival[id_trip]>0: - self.positions_arrival.write_xml(fd,id_trip) - - fd.write(xm.stopit())# ends walk - fd.write(xm.end(xmltag_person, indent=indent)) - + + fd.write(xm.start('walk', indent=indent + 2)) + # print 'write + # walk',id_trip,self.positions_depart[id_trip],self.positions_arrival[id_trip] + self.ids_edge_depart.write_xml(fd, id_trip) + if self.positions_depart[id_trip] > 0: + self.positions_depart.write_xml(fd, id_trip) + + self.ids_edge_arrival.write_xml(fd, id_trip) + if self.positions_arrival[id_trip] > 0: + self.positions_arrival.write_xml(fd, id_trip) + + fd.write(xm.stopit()) # ends walk + fd.write(xm.end(xmltag_person, indent=indent)) + def get_route_first(self, id_trip): ids_route = self.ids_routes[id_trip] if ids_route is None: return -1 - elif len(ids_route)>0: + elif len(ids_route) > 0: return ids_route[0] else: - return -1 # no route found - - - - def import_routes_xml(self, filepath, is_clear_trips = False, - is_generate_ids = True, is_add = False): - print 'import_routes_xml from %s generate own trip '%(filepath) + return -1 # no route found + + def import_routes_xml(self, filepath, is_clear_trips=False, + is_generate_ids=True, is_add=False): + print 'import_routes_xml from %s generate own trip ' % (filepath) if is_clear_trips: self.clear_trips() - + counter = RouteCounter() parse(filepath, counter) reader = RouteReader(self, counter) try: parse(filepath, reader) - #print ' call make_routes',is_generate_ids,is_add - reader.insert_routes(is_generate_ids = is_generate_ids, - is_add=is_add) + # print ' call make_routes',is_generate_ids,is_add + reader.insert_routes(is_generate_ids=is_generate_ids, + is_add=is_add) except KeyError: print >> sys.stderr, "Error: Problems with reading routes!" raise - - def import_trips_xml(self, filepath, is_clear_trips = False, is_generate_ids = True): - print 'import_trips_xml from %s generate own trip '%(filepath) + + def import_trips_xml(self, filepath, is_clear_trips=False, is_generate_ids=True): + print 'import_trips_xml from %s generate own trip ' % (filepath) if is_clear_trips: self.clear_trips() - + counter = TripCounter() parse(filepath, counter) reader = TripReader(self, counter.n_trip) - print ' n_trip=',counter.n_trip - + print ' n_trip=', counter.n_trip + try: parse(filepath, reader) - reader.insert_trips(is_generate_ids = is_generate_ids) + reader.insert_trips(is_generate_ids=is_generate_ids) except KeyError: print >> sys.stderr, "Error: Problems with reading trips!" raise - - + + class TripCounter(handler.ContentHandler): + """Parses a SUMO route XML file and counts trips.""" def __init__(self): self.n_trip = 0 - - + def startElement(self, name, attrs): - #print 'startElement',name,self.n_trip - if name == 'trip': + # print 'startElement',name,self.n_trip + if name == 'trip': self.n_trip += 1 - - + class TripReader(handler.ContentHandler): + """Reads trips from trip or route file into trip table""" def __init__(self, trips, n_trip): - #print 'RouteReader.__init__',demand.ident + # print 'RouteReader.__init__',demand.ident self._trips = trips demand = trips.parent - + net = demand.get_scenario().net - + self._ids_vtype_sumo = demand.vtypes.ids_sumo self._ids_edge_sumo = net.edges.ids_sumo - + self.ids_sumo = np.zeros(n_trip, np.object) self.ids_vtype = np.zeros(n_trip, np.int32) self.times_depart = np.zeros(n_trip, np.int32) @@ -783,9 +796,9 @@ self.positions_arrival = np.zeros(n_trip, np.float32) self.speeds_arrival = np.zeros(n_trip, np.float32) self.routes = np.zeros(n_trip, np.object) - - self._ind_trip = -1 - + + self._ind_trip = -1 + self._has_routes = False self._ids_sumoedge_current = [] self._id_sumoveh_current = None @@ -793,123 +806,129 @@ #self._attrs = {} #self._is_generate_ids = is_generate_ids self._intervals_current = '' - + def startElement(self, name, attrs): # # # - #print 'startElement',name + # print 'startElement',name if name == 'trip': - #print ' startElement',attrs['id'],attrs['depart'] + # print ' startElement',attrs['id'],attrs['depart'] self._ind_trip += 1 - + self._id_sumoveh_current = attrs['id'] self.ids_sumo[self._ind_trip] = self._id_sumoveh_current - print 'startElement ids_vtype',attrs['type'], self._ids_vtype_sumo.get_id_from_index(str(attrs['type'])) - self.ids_vtype[self._ind_trip] = self._ids_vtype_sumo.get_id_from_index(str(attrs['type'])) + print 'startElement ids_vtype', attrs['type'], self._ids_vtype_sumo.get_id_from_index(str(attrs['type'])) + self.ids_vtype[self._ind_trip] = self._ids_vtype_sumo.get_id_from_index( + str(attrs['type'])) self.times_depart[self._ind_trip] = int(float(attrs['depart'])) - + if attrs.has_key('from'): - self.ids_edge_depart[self._ind_trip] = self._ids_edge_sumo.get_id_from_index(str(attrs['from'])) + self.ids_edge_depart[self._ind_trip] = self._ids_edge_sumo.get_id_from_index( + str(attrs['from'])) if attrs.has_key('to'): - self.ids_edge_arrival[self._ind_trip] = self._ids_edge_sumo.get_id_from_index(str(attrs['to'])) - - + self.ids_edge_arrival[ + self._ind_trip] = self._ids_edge_sumo.get_id_from_index(str(attrs['to'])) + ind_lane_depart_raw = attrs.get('departLane', 'free') if OPTIONMAP_LANE_DEPART.has_key(ind_lane_depart_raw): - self.inds_lane_depart[self._ind_trip] = OPTIONMAP_LANE_DEPART[ind_lane_depart_raw] + self.inds_lane_depart[self._ind_trip] = OPTIONMAP_LANE_DEPART[ + ind_lane_depart_raw] else: - self.inds_lane_depart[self._ind_trip] = int(ind_lane_depart_raw) - + self.inds_lane_depart[self._ind_trip] = int( + ind_lane_depart_raw) + positions_depart_raw = attrs.get('departPos', 'base') if OPTIONMAP_POS_DEPARTURE.has_key(positions_depart_raw): - self.positions_depart[self._ind_trip] = OPTIONMAP_POS_DEPARTURE[positions_depart_raw] + self.positions_depart[self._ind_trip] = OPTIONMAP_POS_DEPARTURE[ + positions_depart_raw] else: - self.positions_depart[self._ind_trip] = float(positions_depart_raw) - + self.positions_depart[self._ind_trip] = float( + positions_depart_raw) + self.speeds_depart[self._ind_trip] = attrs.get('departSpeed', 0.0) - - + ind_lane_arrival_raw = attrs.get('arrivalLane', 'current') if OPTIONMAP_LANE_ARRIVAL.has_key(ind_lane_arrival_raw): - self.inds_lane_arrival[self._ind_trip] = OPTIONMAP_LANE_ARRIVAL[ind_lane_arrival_raw] + self.inds_lane_arrival[self._ind_trip] = OPTIONMAP_LANE_ARRIVAL[ + ind_lane_arrival_raw] else: - self.inds_lane_arrival[self._ind_trip] = int(ind_lane_arrival_raw) - + self.inds_lane_arrival[self._ind_trip] = int( + ind_lane_arrival_raw) + positions_arrival_raw = attrs.get('arrivalPos', 'max') if OPTIONMAP_POS_ARRIVAL.has_key(positions_arrival_raw): - self.positions_arrival[self._ind_trip] = OPTIONMAP_POS_ARRIVAL[positions_arrival_raw] + self.positions_arrival[self._ind_trip] = OPTIONMAP_POS_ARRIVAL[ + positions_arrival_raw] else: - self.positions_arrival[self._ind_trip] = float(positions_arrival_raw) - - - self.speeds_arrival[self._ind_trip] = attrs.get('arrivalSpeed', 0.0) - + self.positions_arrival[self._ind_trip] = float( + positions_arrival_raw) + self.speeds_arrival[self._ind_trip] = attrs.get( + 'arrivalSpeed', 0.0) - def _get_kwargs(self): - return {'ids_sumo' : self.ids_sumo, - 'times_depart' : self.times_depart, - 'ids_edge_depart' : self.ids_edge_depart, - 'ids_edge_arrival' : self.ids_edge_arrival, - 'inds_lane_depart' : self.inds_lane_depart, - 'positions_depart' : self.positions_depart, - 'speeds_depart' : self.speeds_depart, - 'inds_lane_arrival' : self.inds_lane_arrival, - 'positions_arrival' : self.positions_arrival, - 'speeds_arrival' : self.speeds_arrival, + return {'ids_sumo': self.ids_sumo, + 'times_depart': self.times_depart, + 'ids_edge_depart': self.ids_edge_depart, + 'ids_edge_arrival': self.ids_edge_arrival, + 'inds_lane_depart': self.inds_lane_depart, + 'positions_depart': self.positions_depart, + 'speeds_depart': self.speeds_depart, + 'inds_lane_arrival': self.inds_lane_arrival, + 'positions_arrival': self.positions_arrival, + 'speeds_arrival': self.speeds_arrival, } - - - - def insert_trips(self, is_generate_ids = True): - - #print 'TripReader.insert_trips self.ids_vtype',self.ids_vtype + + def insert_trips(self, is_generate_ids=True): + + # print 'TripReader.insert_trips self.ids_vtype',self.ids_vtype kwargs = self._get_kwargs() - ids_trips = self._trips.make_trips( self.ids_vtype, - is_generate_ids = is_generate_ids, - **kwargs) - - + ids_trips = self._trips.make_trips(self.ids_vtype, + is_generate_ids=is_generate_ids, + **kwargs) + return ids_trips - + + class RouteCounter(handler.ContentHandler): + """Parses a SUMO route XML file and counts trips.""" def __init__(self): self.n_veh = 0 self.n_pers = 0 #self.n_rou = 0 - + def startElement(self, name, attrs): - #print 'startElement',name,self.n_trip - if name == 'vehicle': + # print 'startElement',name,self.n_trip + if name == 'vehicle': self.n_veh += 1 - elif name == 'person': + elif name == 'person': self.n_pers += 1 - #elif name == 'route': + # elif name == 'route': # if attrs.has_key('id'): # self.n_rou += 1 - - + + class RouteReader(TripReader): + """Reads trips from trip or route file into trip table""" def __init__(self, trips, counter): - #print 'RouteReader.__init__',demand.ident + # print 'RouteReader.__init__',demand.ident self._trips = trips n_veh = counter.n_veh n_per = counter.n_pers #n_rou = counter.n_rou - n_trip = n_veh+n_per + n_trip = n_veh + n_per demand = trips.parent - + net = demand.get_scenario().net - + self._ids_vtype_sumo = demand.vtypes.ids_sumo self._ids_edge_sumo = net.edges.ids_sumo - + self.ids_sumo = np.zeros(n_trip, np.object) self.ids_vtype = np.zeros(n_trip, np.int32) self.times_depart = np.zeros(n_trip, np.int32) @@ -922,9 +941,9 @@ self.positions_arrival = np.zeros(n_trip, np.float32) self.speeds_arrival = np.zeros(n_trip, np.float32) self.routes = np.zeros(n_trip, np.object) - - self._ind_trip = -1 - + + self._ind_trip = -1 + self._has_routes = False self._ids_sumoedge_current = [] self._id_sumoveh_current = None @@ -932,92 +951,103 @@ #self._attrs = {} #self._is_generate_ids = is_generate_ids self._intervals_current = '' - + def startElement(self, name, attrs): # # # - #print 'startElement',name + # print 'startElement',name if name == 'vehicle': - #print ' startElement',attrs['id'],attrs['depart'] + # print ' startElement',attrs['id'],attrs['depart'] self._ind_trip += 1 - + self._id_sumoveh_current = attrs['id'] self.ids_sumo[self._ind_trip] = self._id_sumoveh_current - #print 'startElement ids_vtype',attrs['type'], self._ids_vtype_sumo.get_id_from_index(str(attrs['type'])) - self.ids_vtype[self._ind_trip] = self._ids_vtype_sumo.get_id_from_index(str(attrs['type'])) + # print 'startElement ids_vtype',attrs['type'], + # self._ids_vtype_sumo.get_id_from_index(str(attrs['type'])) + self.ids_vtype[self._ind_trip] = self._ids_vtype_sumo.get_id_from_index( + str(attrs['type'])) self.times_depart[self._ind_trip] = int(float(attrs['depart'])) - + if attrs.has_key('from'): - self.ids_edge_depart[self._ind_trip] = self._ids_edge_sumo.get_id_from_index(str(attrs['from'])) + self.ids_edge_depart[self._ind_trip] = self._ids_edge_sumo.get_id_from_index( + str(attrs['from'])) if attrs.has_key('to'): - self.ids_edge_arrival[self._ind_trip] = self._ids_edge_sumo.get_id_from_index(str(attrs['to'])) - - + self.ids_edge_arrival[ + self._ind_trip] = self._ids_edge_sumo.get_id_from_index(str(attrs['to'])) + ind_lane_depart_raw = attrs.get('departLane', 'free') if OPTIONMAP_LANE_DEPART.has_key(ind_lane_depart_raw): - self.inds_lane_depart[self._ind_trip] = OPTIONMAP_LANE_DEPART[ind_lane_depart_raw] + self.inds_lane_depart[self._ind_trip] = OPTIONMAP_LANE_DEPART[ + ind_lane_depart_raw] else: - self.inds_lane_depart[self._ind_trip] = int(ind_lane_depart_raw) - + self.inds_lane_depart[self._ind_trip] = int( + ind_lane_depart_raw) + positions_depart_raw = attrs.get('departPos', 'base') if OPTIONMAP_POS_DEPARTURE.has_key(positions_depart_raw): - self.positions_depart[self._ind_trip] = OPTIONMAP_POS_DEPARTURE[positions_depart_raw] + self.positions_depart[self._ind_trip] = OPTIONMAP_POS_DEPARTURE[ + positions_depart_raw] else: - self.positions_depart[self._ind_trip] = float(positions_depart_raw) - + self.positions_depart[self._ind_trip] = float( + positions_depart_raw) + self.speeds_depart[self._ind_trip] = attrs.get('departSpeed', 0.0) - - + ind_lane_arrival_raw = attrs.get('arrivalLane', 'current') if OPTIONMAP_LANE_ARRIVAL.has_key(ind_lane_arrival_raw): - self.inds_lane_arrival[self._ind_trip] = OPTIONMAP_LANE_ARRIVAL[ind_lane_arrival_raw] + self.inds_lane_arrival[self._ind_trip] = OPTIONMAP_LANE_ARRIVAL[ + ind_lane_arrival_raw] else: - self.inds_lane_arrival[self._ind_trip] = int(ind_lane_arrival_raw) - + self.inds_lane_arrival[self._ind_trip] = int( + ind_lane_arrival_raw) + positions_arrival_raw = attrs.get('arrivalPos', 'max') if OPTIONMAP_POS_ARRIVAL.has_key(positions_arrival_raw): - self.positions_arrival[self._ind_trip] = OPTIONMAP_POS_ARRIVAL[positions_arrival_raw] + self.positions_arrival[self._ind_trip] = OPTIONMAP_POS_ARRIVAL[ + positions_arrival_raw] else: - self.positions_arrival[self._ind_trip] = float(positions_arrival_raw) - - - self.speeds_arrival[self._ind_trip] = attrs.get('arrivalSpeed', 0.0) - + self.positions_arrival[self._ind_trip] = float( + positions_arrival_raw) + + self.speeds_arrival[self._ind_trip] = attrs.get( + 'arrivalSpeed', 0.0) if name == 'route': self._has_routes = True - #print ' ',attrs.get('edges', '') + # print ' ',attrs.get('edges', '') self._ids_sumoedge_current = attrs.get('edges', '') self._intervals_current = attrs.get('intervals', '') - - #def characters(self, content): + + # def characters(self, content): # if (len(self._route_current)>0)&(self._intervals_current!=''): # self._intervals_current = self._intervals_current + content - + def endElement(self, name): - + if name == 'vehicle': - #print 'endElement',name,self._id_current,len(self._intervals_current) - if (self._id_sumoveh_current!=None): + # print + # 'endElement',name,self._id_current,len(self._intervals_current) + if (self._id_sumoveh_current != None): ids_edge = [] for id_sumoedge in self._ids_sumoedge_current.split(' '): - if not id_sumoedge in ('',' ',','): + if not id_sumoedge in ('', ' ', ','): if self._ids_edge_sumo.has_index(id_sumoedge): - ids_edge.append(self._ids_edge_sumo.get_id_from_index(id_sumoedge.strip()) ) + ids_edge.append( + self._ids_edge_sumo.get_id_from_index(id_sumoedge.strip())) self.routes[self._ind_trip] = ids_edge - - if len(ids_edge)>=1: + + if len(ids_edge) >= 1: self.ids_edge_depart[self._ind_trip] = ids_edge[0] self.ids_edge_arrival[self._ind_trip] = ids_edge[-1] - + self._id_sumoveh_current = None #self._attrs = {} self._ids_sumoedge_current = [] - - #elif name in ['routes','trips']: + + # elif name in ['routes','trips']: # self.make_trips() - + def process_intervals(self): interval = [] es = self._intervals_current.rstrip().split(" ") @@ -1026,57 +1056,54 @@ interval.append((float(p[0]), float(p[1]))) self._intervals_current = '' return interval - + def _get_kwargs(self): - return {'ids_sumo' : self.ids_sumo, - 'times_depart' : self.times_depart, - 'ids_edge_depart' : self.ids_edge_depart, - 'ids_edge_arrival' : self.ids_edge_arrival, - 'inds_lane_depart' : self.inds_lane_depart, - 'positions_depart' : self.positions_depart, - 'speeds_depart' : self.speeds_depart, - 'inds_lane_arrival' : self.inds_lane_arrival, - 'positions_arrival' : self.positions_arrival, - 'speeds_arrival' : self.speeds_arrival, + return {'ids_sumo': self.ids_sumo, + 'times_depart': self.times_depart, + 'ids_edge_depart': self.ids_edge_depart, + 'ids_edge_arrival': self.ids_edge_arrival, + 'inds_lane_depart': self.inds_lane_depart, + 'positions_depart': self.positions_depart, + 'speeds_depart': self.speeds_depart, + 'inds_lane_arrival': self.inds_lane_arrival, + 'positions_arrival': self.positions_arrival, + 'speeds_arrival': self.speeds_arrival, } - - def insert_routes(self, is_generate_ids = True, is_add = False): - #print 'TripReader.make_routes',is_generate_ids, is_add + + def insert_routes(self, is_generate_ids=True, is_add=False): + # print 'TripReader.make_routes',is_generate_ids, is_add ids_trip = None if is_add: is_generate_ids = False - # get trip ids from xml file - ids_trip = self._trips.ids_sumo.get_ids_from_indices(self.ids_sumo) - - #print ' ids_trip',ids_trip - ids_routes, ids_trips = self._trips.make_routes( self.ids_vtype, - is_generate_ids = is_generate_ids, - routes = self.routes, - ids_trip = ids_trip, - **self._get_kwargs()) - + # get trip ids from xml file + ids_trip = self._trips.ids_sumo.get_ids_from_indices(self.ids_sumo) + + # print ' ids_trip',ids_trip + ids_routes, ids_trips = self._trips.make_routes(self.ids_vtype, + is_generate_ids=is_generate_ids, + routes=self.routes, + ids_trip=ids_trip, + **self._get_kwargs()) + return ids_routes, ids_trips - - - -if __name__ == '__main__': - ############################################################################### - #print 'sys.path',sys.path + + +if __name__ == '__main__': + ########################################################################## + # print 'sys.path',sys.path from agilepy.lib_wx.objpanel import objbrowser from agilepy.lib_base.logger import Logger #from coremodules.scenario import scenario from coremodules.network import network logger = Logger() - NETPATH = os.path.join(SUMOPYDIR,'coremodules','network','testnet') - net = network.Network(logger = logger) + NETPATH = os.path.join(SUMOPYDIR, 'coremodules', 'network', 'testnet') + net = network.Network(logger=logger) rootname = 'facsp2' net.import_xml(rootname, NETPATH) - #net.read_sumonodes(os.path.join(NETPATH,'facsp2.nod.xml')) - #net.read_sumoedges(os.path.join(NETPATH,'facsp2.edg.xml')) - demand = Demand( net = net, logger = logger) - #demand.set_net(net) - #landuse.facilities.import_poly(os.path.join(NETPATH,'facsp2.poly.xml')) + # net.read_sumonodes(os.path.join(NETPATH,'facsp2.nod.xml')) + # net.read_sumoedges(os.path.join(NETPATH,'facsp2.edg.xml')) + demand = Demand(net=net, logger=logger) + # demand.set_net(net) + # landuse.facilities.import_poly(os.path.join(NETPATH,'facsp2.poly.xml')) #landuse.import_xml(rootname, NETPATH) objbrowser(demand) - - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,15 +1,11 @@ __version__ = "0.0" -print 'init',__name__ +print 'init', __name__ -def get_wxgui(): - #try: - from wxgui import WxGui - return WxGui(__name__) - #except: - # return None - - - - +def get_wxgui(): + # try: + from wxgui import WxGui + return WxGui(__name__) + # except: + # return None diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/origin_to_destination.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/origin_to_destination.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/origin_to_destination.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/origin_to_destination.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,67 +1,70 @@ -import numpy as np -from numpy import random +import numpy as np +from numpy import random import agilepy.lib_base.classman as cm import agilepy.lib_base.arrayman as am import agilepy.lib_base.xmlman as xm #from coremodules.modules_common import * from coremodules.network.network import SumoIdsConf, MODES -from agilepy.lib_base.processes import Process,CmlMixin -#import coremodules.demand.demand as dm +from agilepy.lib_base.processes import Process, CmlMixin +#import coremodules.demand.demand as dm import demand as dm -#print 'dir(dm)',dir(dm) +# print 'dir(dm)',dir(dm) #from demand import OPTIONMAP_POS_DEPARTURE -#OPTIONMAP_POS_ARRIVAL -#OPTIONMAP_SPEED_DEPARTURE -#OPTIONMAP_SPEED_ARRIVAL -#OPTIONMAP_LANE_DEPART -#OPTIONMAP_LANE_ARRIVAL +# OPTIONMAP_POS_ARRIVAL +# OPTIONMAP_SPEED_DEPARTURE +# OPTIONMAP_SPEED_ARRIVAL +# OPTIONMAP_LANE_DEPART +# OPTIONMAP_LANE_ARRIVAL + + class OdTripgenerator(Process): - def __init__(self, odintervals, trips, logger = None,**kwargs): + + def __init__(self, odintervals, trips, logger=None, **kwargs): """ CURRENTLY NOT IN USE!! """ - self._init_common( 'odtripgenerator', name = 'OD tripgenerator', - logger = logger, - info ='Generates trips from OD demand .', - ) + self._init_common('odtripgenerator', name='OD tripgenerator', + logger=logger, + info='Generates trips from OD demand .', + ) self._odintervals = odintervals - + attrsman = self.get_attrsman() - self.add_option('netfilepath',netfilepath, - groupnames = ['options'],# this will make it show up in the dialog - cml = '--sumo-net-file', - perm='rw', - name = 'Net file', - wildcards = 'Net XML files (*.net.xml)|*.net.xml', - metatype = 'filepath', - info = 'SUMO Net file in XML format.', + self.add_option('netfilepath', netfilepath, + # this will make it show up in the dialog + groupnames=['options'], + cml='--sumo-net-file', + perm='rw', + name='Net file', + wildcards='Net XML files (*.net.xml)|*.net.xml', + metatype='filepath', + info='SUMO Net file in XML format.', ) - - self.workdirpath = attrsman.add(cm.AttrConf( 'workdirpath', rootdirpath, - groupnames = ['_private'],#['options'],#['_private'], - perm='r', - name = 'Workdir', - metatype = 'dirpath', - info = 'Working directory for this scenario.', - )) - - self.rootname = attrsman.add(cm.AttrConf( 'rootname', rootname, - groupnames = ['_private'], - perm='r', - name = 'Scenario shortname', - info = 'Scenario shortname is also rootname of converted files.', - )) - - - self.is_clean_nodes = attrsman.add(cm.AttrConf( 'is_clean_nodes',is_clean_nodes, - groupnames = ['options'], - perm='rw', - name = 'Clean Nodes', - info = 'If set, then shapes around nodes are cleaned up.', - )) - - + + self.workdirpath = attrsman.add(cm.AttrConf('workdirpath', rootdirpath, + # ['options'],#['_private'], + groupnames=['_private'], + perm='r', + name='Workdir', + metatype='dirpath', + info='Working directory for this scenario.', + )) + + self.rootname = attrsman.add(cm.AttrConf('rootname', rootname, + groupnames=['_private'], + perm='r', + name='Scenario shortname', + info='Scenario shortname is also rootname of converted files.', + )) + + self.is_clean_nodes = attrsman.add(cm.AttrConf('is_clean_nodes', is_clean_nodes, + groupnames=['options'], + perm='rw', + name='Clean Nodes', + info='If set, then shapes around nodes are cleaned up.', + )) + def update_params(self): """ Make all parameters consistent. @@ -71,181 +74,189 @@ pass #self.workdirpath = os.path.dirname(self.netfilepath) #bn = os.path.basename(self.netfilepath).split('.') - #if len(bn)>0: + # if len(bn)>0: # self.rootname = bn[0] - + def do(self): self.update_params() - cml = self.get_cml()+' --plain-output-prefix '+filepathlist_to_filepathstring(os.path.join(self.workdirpath, self.rootname)) - #print 'SumonetImporter.do',cml + cml = self.get_cml() + ' --plain-output-prefix ' + \ + filepathlist_to_filepathstring( + os.path.join(self.workdirpath, self.rootname)) + # print 'SumonetImporter.do',cml #import_xml(self, rootname, dirname, is_clean_nodes = True) self.run_cml(cml) if self.status == 'success': - self._net.import_xml(self.rootname, self.workdirpath, is_clean_nodes = self.is_clean_nodes) - - #print 'do',self.newident - #self._scenario = Scenario( self.newident, - # parent = None, + self._net.import_xml( + self.rootname, self.workdirpath, is_clean_nodes=self.is_clean_nodes) + + # print 'do',self.newident + # self._scenario = Scenario( self.newident, + # parent = None, # workdirpath = self.workdirpath, # logger = self.get_logger(), # ) def get_net(self): return self._net - + + class OdFlowTable(am.ArrayObjman): + def __init__(self, parent, modes, zones, **kwargs): - self._init_objman( ident='odflowtab', parent=parent, - name = 'OD flows', - info = 'Table with intervals, modes, OD and respective number of trips.', - #xmltag = ('odtrips','odtrip',None), - **kwargs) - - self.add_col(am.ArrayConf( 'times_start', 0, - groupnames = ['state'], - perm='rw', - name = 'Start time', - unit = 's', - info = 'Start time of interval in seconds (no fractional seconds).', - xmltag = 't_start', - )) - - self.add_col(am.ArrayConf('times_end', 3600, - groupnames = ['state'], - perm='rw', - name = 'End time', - unit = 's', - info = 'End time of interval in seconds (no fractional seconds).', - xmltag = 't_end', - )) - - self.add_col(am.IdsArrayConf( 'ids_mode', modes, - groupnames = ['state'], - choices = MODES, - name = 'ID mode', - xmltag = 'vClass', - info = 'ID of transport mode.', - )) - - self.add_col(am.IdsArrayConf( 'ids_orig', zones, - groupnames = ['state'], - name = 'Orig.', - choices = zones.ids_sumo.get_indexmap(), - info = 'traffic assignment zone of origin of trip.', - xmltag = 'id_orig', - )) - - - self.add_col(am.IdsArrayConf( 'ids_dest', zones, - groupnames = ['state'], - name = 'Dest.', - choices = zones.ids_sumo.get_indexmap(), - info = 'ID of traffic assignment zone of destination of trip.', - xmltag = 'id_dest', - )) - - self.add_col(am.ArrayConf( 'tripnumbers', 0, - groupnames = ['state'], - perm = 'rw', - name = 'Trips', - info = 'Number of trips from zone with ID Orig to zone with ID Dest.', - xmltag = 'tripnumber', - )) - - #self.add( cm.ObjConf( zones, is_child = False,groups = ['_private'])) - + self._init_objman(ident='odflowtab', parent=parent, + name='OD flows', + info='Table with intervals, modes, OD and respective number of trips.', + #xmltag = ('odtrips','odtrip',None), + **kwargs) + + self.add_col(am.ArrayConf('times_start', 0, + groupnames=['state'], + perm='rw', + name='Start time', + unit='s', + info='Start time of interval in seconds (no fractional seconds).', + xmltag='t_start', + )) + + self.add_col(am.ArrayConf('times_end', 3600, + groupnames=['state'], + perm='rw', + name='End time', + unit='s', + info='End time of interval in seconds (no fractional seconds).', + xmltag='t_end', + )) + + self.add_col(am.IdsArrayConf('ids_mode', modes, + groupnames=['state'], + choices=MODES, + name='ID mode', + xmltag='vClass', + info='ID of transport mode.', + )) + + self.add_col(am.IdsArrayConf('ids_orig', zones, + groupnames=['state'], + name='Orig.', + choices=zones.ids_sumo.get_indexmap(), + info='traffic assignment zone of origin of trip.', + xmltag='id_orig', + )) + + self.add_col(am.IdsArrayConf('ids_dest', zones, + groupnames=['state'], + name='Dest.', + choices=zones.ids_sumo.get_indexmap(), + info='ID of traffic assignment zone of destination of trip.', + xmltag='id_dest', + )) + + self.add_col(am.ArrayConf('tripnumbers', 0, + groupnames=['state'], + perm='rw', + name='Trips', + info='Number of trips from zone with ID Orig to zone with ID Dest.', + xmltag='tripnumber', + )) + + #self.add( cm.ObjConf( zones, is_child = False,groups = ['_private'])) + def add_flows(self, time_start, - time_end, - id_mode , - ids_orig, - ids_dest, - tripnumbers, - ): + time_end, + id_mode, + ids_orig, + ids_dest, + tripnumbers, + ): n = len(tripnumbers) - self.add_rows( n = n, - times_start = time_start*np.ones(n), - times_end = time_end*np.ones(n), - ids_mode = id_mode*np.ones(n), - ids_orig = ids_orig, - ids_dest = ids_dest, - tripnumbers = tripnumbers, - ) - + self.add_rows(n=n, + times_start=time_start * np.ones(n), + times_end=time_end * np.ones(n), + ids_mode=id_mode * np.ones(n), + ids_orig=ids_orig, + ids_dest=ids_dest, + tripnumbers=tripnumbers, + ) + + class OdTrips(am.ArrayObjman): - def __init__(self,ident, parent, zones, **kwargs): - self._init_objman( ident, parent=parent, - name = 'OD trips', - info = 'Contains the number of trips between an origin and a destination zone.', - xmltag = ('odtrips','odtrip',None), **kwargs) - - self.add_col(am.IdsArrayConf( 'ids_orig', zones, - groupnames = ['state'], - name = 'Orig.', - choices = zones.ids_sumo.get_indexmap(), - info = 'traffic assignment zone of origin of trip.', - xmltag = 'id_orig', - )) - - - self.add_col(am.IdsArrayConf( 'ids_dest', zones, - groupnames = ['state'], - name = 'Dest.', - choices = zones.ids_sumo.get_indexmap(), - info = 'ID of traffic assignment zone of destination of trip.', - xmltag = 'id_dest', - )) - - self.add_col(am.ArrayConf( 'tripnumbers', 0, - groupnames = ['state'], - perm = 'rw', - name = 'Trips', - info = 'Number of trips from zone with ID Orig to zone with ID Dest.', - xmltag = 'tripnumber', - )) - - self.add( cm.ObjConf( zones, is_child = False,groups = ['_private'])) - + + def __init__(self, ident, parent, zones, **kwargs): + self._init_objman(ident, parent=parent, + name='OD trips', + info='Contains the number of trips between an origin and a destination zone.', + xmltag=('odtrips', 'odtrip', None), **kwargs) + + self.add_col(am.IdsArrayConf('ids_orig', zones, + groupnames=['state'], + name='Orig.', + choices=zones.ids_sumo.get_indexmap(), + info='traffic assignment zone of origin of trip.', + xmltag='id_orig', + )) + + self.add_col(am.IdsArrayConf('ids_dest', zones, + groupnames=['state'], + name='Dest.', + choices=zones.ids_sumo.get_indexmap(), + info='ID of traffic assignment zone of destination of trip.', + xmltag='id_dest', + )) + + self.add_col(am.ArrayConf('tripnumbers', 0, + groupnames=['state'], + perm='rw', + name='Trips', + info='Number of trips from zone with ID Orig to zone with ID Dest.', + xmltag='tripnumber', + )) + + self.add(cm.ObjConf(zones, is_child=False, groups=['_private'])) + def _init_constants(self): #self.edgeweights_orig = None #self.edgeweights_dest = None pass - - def generate_odflows(self, odflowtab, time_start, time_end, id_mode,**kwargs): + + def generate_odflows(self, odflowtab, time_start, time_end, id_mode, **kwargs): """ Insert all od flows in odflowtab. """ - #for id_od in self.get_ids(): - odflowtab.add_flows( time_start, - time_end, - id_mode, - self.ids_orig.get_value(), - self.ids_dest.get_value(), - self.tripnumbers.get_value() - ) - - def generate_trips(self, demand, time_start, time_end, id_mode, - pos_depart_default = dm.OPTIONMAP_POS_DEPARTURE['random_free'], - pos_arrival_default = dm.OPTIONMAP_POS_ARRIVAL['max'], - speed_depart_default = 0.0, - speed_arrival_default = 0.0, - ind_lane_depart_default = dm.OPTIONMAP_LANE_DEPART['allowed'], # pedestrians always depart on lane 0 - ind_lane_arrival_default = dm.OPTIONMAP_LANE_ARRIVAL['current'],# pedestrians always arrive on lane 0 - ): + # for id_od in self.get_ids(): + odflowtab.add_flows(time_start, + time_end, + id_mode, + self.ids_orig.get_value(), + self.ids_dest.get_value(), + self.tripnumbers.get_value() + ) + + def generate_trips(self, demand, time_start, time_end, id_mode, + pos_depart_default=dm.OPTIONMAP_POS_DEPARTURE[ + 'random_free'], + pos_arrival_default=dm.OPTIONMAP_POS_ARRIVAL['max'], + speed_depart_default=0.0, + speed_arrival_default=0.0, + ind_lane_depart_default=dm.OPTIONMAP_LANE_DEPART[ + 'allowed'], # pedestrians always depart on lane 0 + ind_lane_arrival_default=dm.OPTIONMAP_LANE_ARRIVAL[ + 'current'], # pedestrians always arrive on lane 0 + ): """ Generates trips in demand.trip table. """ - print 'generate_trips',time_start, time_end, id_mode + print 'generate_trips', time_start, time_end, id_mode id_mode_ped = MODES['pedestrian'] - #OPTIONMAP_POS_DEPARTURE = { -1:"random",-2:"free",-3:"random_free",-4:"base"} - #OPTIONMAP_POS_ARRIVAL = { -1:"random",-2:"max"} - #OPTIONMAP_SPEED_DEPARTURE = { -1:"random",-2:"max"} + #OPTIONMAP_POS_DEPARTURE = { -1:"random",-2:"free",-3:"random_free",-4:"base"} + #OPTIONMAP_POS_ARRIVAL = { -1:"random",-2:"max"} + #OPTIONMAP_SPEED_DEPARTURE = { -1:"random",-2:"max"} #OPTIONMAP_SPEED_ARRIVAL = { -1:"current"} #OPTIONMAP_LANE_DEPART = {-1:"random",-2:"free",-3:"departlane"} #OPTIONMAP_LANE_ARRIVAL = { -1:"current"} - + trips = demand.trips ids_vtypes_mode = demand.vtypes.select_by_mode(id_mode) - #print ' ids_vtypes_mode', ids_vtypes_mode + # print ' ids_vtypes_mode', ids_vtypes_mode n_vtypes = len(ids_vtypes_mode) zones = self.zones.get_value() edges = zones.ids_edges_orig.get_linktab() @@ -253,244 +264,250 @@ n_trips_generated = 0 n_trips_failed = 0 - + for id_od in self.get_ids(): - id_orig = self.ids_orig[id_od] - id_dest = self.ids_dest[id_od] + id_orig = self.ids_orig[id_od] + id_dest = self.ids_dest[id_od] tripnumber = self.tripnumbers[id_od] - - ids_edges_orig_raw = zones.ids_edges_orig[id_orig] - ids_edges_dest_raw = zones.ids_edges_dest[id_dest] - - prob_edges_orig_raw = zones.probs_edges_orig[id_orig] - prob_edges_dest_raw = zones.probs_edges_dest[id_dest] - + + ids_edges_orig_raw = zones.ids_edges_orig[id_orig] + ids_edges_dest_raw = zones.ids_edges_dest[id_dest] + + prob_edges_orig_raw = zones.probs_edges_orig[id_orig] + prob_edges_dest_raw = zones.probs_edges_dest[id_dest] + # check accessibility of origin edges ids_edges_orig = [] - prob_edges_orig=[] + prob_edges_orig = [] inds_lane_orig = [] for i in xrange(len(ids_edges_orig_raw)): id_edge = ids_edges_orig_raw[i] - # if check accessibility... + # if check accessibility... ind_lane_depart = edges.get_laneindex_allowed(id_edge, id_mode) - #print ' get_laneindex_allowed',id_mode,id_edge,edges.ids_sumo[id_edge],ind_lane_depart - if ind_lane_depart >=0: - ids_edges_orig.append(id_edge) - prob_edges_orig.append(prob_edges_orig_raw[i]) + # print ' + # get_laneindex_allowed',id_mode,id_edge,edges.ids_sumo[id_edge],ind_lane_depart + if ind_lane_depart >= 0: + ids_edges_orig.append(id_edge) + prob_edges_orig.append(prob_edges_orig_raw[i]) inds_lane_orig.append(ind_lane_depart) - + #orig = net.getEdge(id) - #if id_mode == MODES['pedestrian']: + # if id_mode == MODES['pedestrian']: # # pedestrians start on footpath # ind_lane_depart = 0 - #else: - # # get lane index for non-pedestrians + # else: + # # get lane index for non-pedestrians # ind_lane_depart = ind_lane_depart_default - # + # # here we can serach better solutions... # for ind_lane_depart_default == -4 we could choose the first allowed lane - #idLane=len(orig.getLanes())-1 - #print ' isAllowed orig',id,orig.isAllowed(mode, idLane = idLane) - #if orig.isAllowed(mode, idLane = idLane): - # origids.append(id) + # idLane=len(orig.getLanes())-1 + # print ' isAllowed orig',id,orig.isAllowed(mode, idLane = idLane) + # if orig.isAllowed(mode, idLane = idLane): + # origids.append(id) # origweights.append(ids_edges_orig[id]) - - + # check accessibility of destination edges ids_edges_dest = [] - prob_edges_dest = [] - inds_lane_dest = [] + prob_edges_dest = [] + inds_lane_dest = [] for i in xrange(len(ids_edges_dest_raw)): id_edge = ids_edges_dest_raw[i] - # if check accessibility... - ind_lane_arrival = edges.get_laneindex_allowed(id_edge, id_mode) - if ind_lane_arrival >=0: - ids_edges_dest.append(id_edge) + # if check accessibility... + ind_lane_arrival = edges.get_laneindex_allowed( + id_edge, id_mode) + if ind_lane_arrival >= 0: + ids_edges_dest.append(id_edge) prob_edges_dest.append(prob_edges_dest_raw[i]) inds_lane_dest.append(ind_lane_arrival) - - #if id_mode == MODES['pedestrian']: + + # if id_mode == MODES['pedestrian']: # # pedestrians start on footpath # ind_lane_arrival = 0 - #else: - # # get lane index for non-pedestrians + # else: + # # get lane index for non-pedestrians # ind_lane_arrival = ind_lane_arrival_default - - - - + n_edges_orig = len(ids_edges_orig) n_edges_dest = len(ids_edges_dest) - - if (n_edges_orig>0) & (n_edges_dest>0) & (tripnumber>0): + + if (n_edges_orig > 0) & (n_edges_dest > 0) & (tripnumber > 0): # renormalize weights prob_edges_orig = np.array(prob_edges_orig, np.float) - prob_edges_orig = prob_edges_orig/np.sum(prob_edges_orig) + prob_edges_orig = prob_edges_orig / np.sum(prob_edges_orig) prob_edges_dest = np.array(prob_edges_dest, np.float) - prob_edges_dest = prob_edges_dest/np.sum(prob_edges_dest) - - for d in xrange(int(tripnumber+0.5)): + prob_edges_dest = prob_edges_dest / np.sum(prob_edges_dest) + + for d in xrange(int(tripnumber + 0.5)): time_depart = random.uniform(time_start, time_end) - - i_orig = np.argmax(random.rand(n_edges_orig)*prob_edges_orig) + + i_orig = np.argmax(random.rand( + n_edges_orig) * prob_edges_orig) id_edge_orig = ids_edges_orig[i_orig] ind_lane_orig = inds_lane_orig[i_orig] - - - i_dest = np.argmax(random.rand(n_edges_dest)*prob_edges_dest) + + i_dest = np.argmax(random.rand( + n_edges_dest) * prob_edges_dest) id_edge_dest = ids_edges_dest[i_dest] ind_lane_dest = inds_lane_dest[i_dest] - + pos_depart = pos_depart_default pos_arrival = pos_arrival_default - #print ' bef:pos_depart,pos_arrival,id_mode,id_mode_ped', pos_depart,pos_arrival,id_mode,id_mode_ped + # print ' bef:pos_depart,pos_arrival,id_mode,id_mode_ped', + # pos_depart,pos_arrival,id_mode,id_mode_ped if id_mode_ped == id_mode: # persons do not understand "random", "max" etc # so produce a random number here - - #{ -1:"random",-2:"free",-3:"random_free",-4:"base"} + + #{ -1:"random",-2:"free",-3:"random_free",-4:"base"} edgelength = edgelengths[id_edge_orig] - if pos_depart in (-1,-2,-3): - pos_depart = random.uniform(0.1*edgelength,0.9*edgelength,1)[0] + if pos_depart in (-1, -2, -3): + pos_depart = random.uniform( + 0.1 * edgelength, 0.9 * edgelength, 1)[0] else: - pos_depart = 0.1*edgelength - - # { -1:"random",-2:"max"} + pos_depart = 0.1 * edgelength + + # { -1:"random",-2:"max"} edgelength = edgelengths[id_edge_dest] if pos_arrival == -1: - pos_arrival = random.uniform(0.1*edgelength,0.9*edgelength,1)[0] + pos_arrival = random.uniform( + 0.1 * edgelength, 0.9 * edgelength, 1)[0] else: - pos_arrival = 0.9*edgelength - #print ' af:pos_depart,pos_arrival,id_mode,id_mode_ped', pos_depart,pos_arrival,id_mode,id_mode_ped - #print ' n_vtypes',n_vtypes - #print ' random.randint(n_vtypes)',random.randint(n_vtypes) - id_vtype = ids_vtypes_mode[random.randint(n_vtypes)] - + pos_arrival = 0.9 * edgelength + # print ' af:pos_depart,pos_arrival,id_mode,id_mode_ped', pos_depart,pos_arrival,id_mode,id_mode_ped + # print ' n_vtypes',n_vtypes + # print ' + # random.randint(n_vtypes)',random.randint(n_vtypes) + id_vtype = ids_vtypes_mode[random.randint(n_vtypes)] + id_trip = trips.make_trip(id_vtype=id_vtype, - time_depart = time_depart, - id_edge_depart = id_edge_orig, - id_edge_arrival = id_edge_dest, - ind_lane_depart = ind_lane_orig, - ind_lane_arrival = ind_lane_dest, - position_depart = pos_depart, - position_arrival = pos_arrival, - speed_depart = speed_depart_default, - speed_arrival = speed_arrival_default, - ) - #print ' ',id_trip,id_edge_orig,edges.ids_sumo[id_edge_orig],ind_lane_depart - #print ' ',id_trip,self.position_depart[id_trip], - n_trips_generated +=1 - + time_depart=time_depart, + id_edge_depart=id_edge_orig, + id_edge_arrival=id_edge_dest, + ind_lane_depart=ind_lane_orig, + ind_lane_arrival=ind_lane_dest, + position_depart=pos_depart, + position_arrival=pos_arrival, + speed_depart=speed_depart_default, + speed_arrival=speed_arrival_default, + ) + # print ' ',id_trip,id_edge_orig,edges.ids_sumo[id_edge_orig],ind_lane_depart + # print ' ',id_trip,self.position_depart[id_trip], + n_trips_generated += 1 + else: n_trips_failed += tripnumber - - print ' n_trips_generated',n_trips_generated - print ' n_trips_failed',n_trips_failed - - + + print ' n_trips_generated', n_trips_generated + print ' n_trips_failed', n_trips_failed + def add_od_trips(self, scale, names_orig, names_dest, tripnumbers): print 'OdTrips.add_od_trips' - #print ' scale, names_orig, names_dest, tripnumbers',scale, names_orig, names_dest, tripnumbers,len(tripnumbers) + # print ' scale, names_orig, names_dest, tripnumbers',scale, + # names_orig, names_dest, tripnumbers,len(tripnumbers) zones = self.get_zones() - print ' ids_sumo',zones.ids_sumo.get_value() - print ' ids_sumo._index_to_id',zones.ids_sumo._index_to_id - for name_orig, name_dest, tripnumber in zip( names_orig, names_dest, tripnumbers): - print ' check',name_orig, name_dest, tripnumbers,zones.ids_sumo.has_index(name_orig),zones.ids_sumo.has_index(name_dest) - if (zones.ids_sumo.has_index(name_orig))&(zones.ids_sumo.has_index(name_dest)): - print ' add',zones.ids_sumo.get_id_from_index(name_orig),zones.ids_sumo.get_id_from_index(name_dest) - self.add_row( ids_orig = zones.ids_sumo.get_id_from_index(name_orig), - ids_dest = zones.ids_sumo.get_id_from_index(name_dest), - tripnumbers = scale* tripnumber) - + print ' ids_sumo', zones.ids_sumo.get_value() + print ' ids_sumo._index_to_id', zones.ids_sumo._index_to_id + for name_orig, name_dest, tripnumber in zip(names_orig, names_dest, tripnumbers): + print ' check', name_orig, name_dest, tripnumbers, zones.ids_sumo.has_index(name_orig), zones.ids_sumo.has_index(name_dest) + if (zones.ids_sumo.has_index(name_orig)) & (zones.ids_sumo.has_index(name_dest)): + print ' add', zones.ids_sumo.get_id_from_index(name_orig), zones.ids_sumo.get_id_from_index(name_dest) + self.add_row(ids_orig=zones.ids_sumo.get_id_from_index(name_orig), + ids_dest=zones.ids_sumo.get_id_from_index( + name_dest), + tripnumbers=scale * tripnumber) + def get_zones(self): - return self.ids_dest.get_linktab() - + return self.ids_dest.get_linktab() + + class OdModes(am.ArrayObjman): - def __init__(self,ident,parent, modes, zones, **kwargs): - self._init_objman( ident,parent=parent, - name = 'Mode OD tables', - info = 'Contains for each transport mode an OD trip table.', - xmltag = ('modesods','modeods','ids_mode'), **kwargs) - - self.add_col(am.IdsArrayConf( 'ids_mode', modes, - groupnames = ['state'], - choices = MODES, - name = 'ID mode', - xmltag = 'vClass', - info = 'ID of transport mode.', - )) - - self.add_col(cm.ObjsConf( 'odtrips', - groupnames = ['state'], - is_save = True, - name = 'OD matrix', - info = 'Matrix with trips from origin to destintion for a specific mode.', - )) - self.add( cm.ObjConf( zones, is_child = False,groups = ['_private'])) - - def generate_trips(self, demand, time_start, time_end,**kwargs): + + def __init__(self, ident, parent, modes, zones, **kwargs): + self._init_objman(ident, parent=parent, + name='Mode OD tables', + info='Contains for each transport mode an OD trip table.', + xmltag=('modesods', 'modeods', 'ids_mode'), **kwargs) + + self.add_col(am.IdsArrayConf('ids_mode', modes, + groupnames=['state'], + choices=MODES, + name='ID mode', + xmltag='vClass', + info='ID of transport mode.', + )) + + self.add_col(cm.ObjsConf('odtrips', + groupnames=['state'], + is_save=True, + name='OD matrix', + info='Matrix with trips from origin to destintion for a specific mode.', + )) + self.add(cm.ObjConf(zones, is_child=False, groups=['_private'])) + + def generate_trips(self, demand, time_start, time_end, **kwargs): for id_od_mode in self.get_ids(): - self.odtrips[id_od_mode].generate_trips( demand, time_start, time_end, self.ids_mode[id_od_mode],**kwargs) - - - - def generate_odflows(self, odflowtab, time_start, time_end,**kwargs): + self.odtrips[id_od_mode].generate_trips( + demand, time_start, time_end, self.ids_mode[id_od_mode], **kwargs) + + def generate_odflows(self, odflowtab, time_start, time_end, **kwargs): for id_od_mode in self.get_ids(): - self.odtrips[id_od_mode].generate_odflows( odflowtab, time_start, time_end, self.ids_mode[id_od_mode],**kwargs) - - - def add_od_trips(self,id_mode, scale, names_orig, names_dest, tripnumbers): - print 'OdModes.add_od_trips',id_mode, scale, names_orig, names_dest, tripnumbers + self.odtrips[id_od_mode].generate_odflows( + odflowtab, time_start, time_end, self.ids_mode[id_od_mode], **kwargs) + + def add_od_trips(self, id_mode, scale, names_orig, names_dest, tripnumbers): + print 'OdModes.add_od_trips', id_mode, scale, names_orig, names_dest, tripnumbers ids_mode = self.select_ids(self.ids_mode.get_value() == id_mode) - if len(ids_mode)==0: - id_od_modes = self.add_row(ids_mode = id_mode) - print ' create',id_od_modes - odtrips = OdTrips( (self.odtrips.attrname, id_od_modes), self, self.zones.get_value() ) + if len(ids_mode) == 0: + id_od_modes = self.add_row(ids_mode=id_mode) + print ' create', id_od_modes + odtrips = OdTrips((self.odtrips.attrname, id_od_modes), + self, self.zones.get_value()) self.odtrips[id_od_modes] = odtrips - odtrips.add_od_trips( scale, names_orig, names_dest, tripnumbers) + odtrips.add_od_trips(scale, names_orig, names_dest, tripnumbers) else: - id_od_modes = ids_mode[0]# modes are unique - print ' use',id_od_modes - self.odtrips[id_od_modes].add_od_trips( scale, names_orig, names_dest, tripnumbers) - - + id_od_modes = ids_mode[0] # modes are unique + print ' use', id_od_modes + self.odtrips[id_od_modes].add_od_trips( + scale, names_orig, names_dest, tripnumbers) + + class OdIntervals(am.ArrayObjman): - def __init__(self,ident = 'odintervals', parent=None, net=None, zones = None, **kwargs): - self._init_objman( ident,parent=parent,# = demand - name = 'OD Demand', - info = 'Contains origin-to-destination zone transport demand for different time intervals.', - xmltag = ('odintervals','odinteval',None), **kwargs) - - - - self.add_col(am.ArrayConf( 'times_start', 0, - groupnames = ['state'], - perm='rw', - name = 'Start time', - unit = 's', - info = 'Start time of interval in seconds (no fractional seconds).', - xmltag = 't_start', - )) - - self.add_col(am.ArrayConf('times_end', 3600, - groupnames = ['state'], - perm='rw', - name = 'End time', - unit = 's', - info = 'End time of interval in seconds (no fractional seconds).', - xmltag = 't_end', - )) - - self.add_col(cm.ObjsConf( 'odmodes', - groupnames = ['state'], - is_save = True, - name = 'OD modes', - info = 'OD transport demand for all transport modes within the respective time interval.', - )) - self.add( cm.ObjConf( net, is_child = False,groups = ['_private'])) - self.add( cm.ObjConf( zones, is_child = False,groups = ['_private'])) - - def generate_trips(self,**kwargs): + + def __init__(self, ident='odintervals', parent=None, net=None, zones=None, **kwargs): + self._init_objman(ident, parent=parent, # = demand + name='OD Demand', + info='Contains origin-to-destination zone transport demand for different time intervals.', + xmltag=('odintervals', 'odinteval', None), **kwargs) + + self.add_col(am.ArrayConf('times_start', 0, + groupnames=['state'], + perm='rw', + name='Start time', + unit='s', + info='Start time of interval in seconds (no fractional seconds).', + xmltag='t_start', + )) + + self.add_col(am.ArrayConf('times_end', 3600, + groupnames=['state'], + perm='rw', + name='End time', + unit='s', + info='End time of interval in seconds (no fractional seconds).', + xmltag='t_end', + )) + + self.add_col(cm.ObjsConf('odmodes', + groupnames=['state'], + is_save=True, + name='OD modes', + info='OD transport demand for all transport modes within the respective time interval.', + )) + self.add(cm.ObjConf(net, is_child=False, groups=['_private'])) + self.add(cm.ObjConf(zones, is_child=False, groups=['_private'])) + + def generate_trips(self, **kwargs): """ Generates trips in trip table. """ @@ -499,51 +516,54 @@ demand = self.parent for id_inter in self.get_ids(): self.odmodes[id_inter].generate_trips(demand, self.times_start[id_inter], - self.times_end[id_inter], - **kwargs) - - def generate_odflows(self,**kwargs): - odflowtab = OdFlowTable( self, self.get_modes(), self.get_zones()) + self.times_end[id_inter], + **kwargs) + + def generate_odflows(self, **kwargs): + odflowtab = OdFlowTable(self, self.get_modes(), self.get_zones()) for id_inter in self.get_ids(): self.odmodes[id_inter].generate_odflows(odflowtab, self.times_start[id_inter], - self.times_end[id_inter], - **kwargs) + self.times_end[id_inter], + **kwargs) return odflowtab - + def clear_od_trips(self): self.clear() - - def add_od_trips(self, t_start, t_end, id_mode, scale, - names_orig,names_dest,tripnumbers): - - print 'OdIntervals.add_od_trips',t_start, t_end, id_mode, scale, names_orig,names_dest,tripnumbers - ids_inter = self.select_ids((self.times_start.get_value()==t_start)&(self.times_end.get_value()==t_end)) - if len(ids_inter)==0: - - id_inter = self.add_row(times_start = t_start, times_end=t_end, ) - print ' create new',id_inter + + def add_od_trips(self, t_start, t_end, id_mode, scale, + names_orig, names_dest, tripnumbers): + + print 'OdIntervals.add_od_trips', t_start, t_end, id_mode, scale, names_orig, names_dest, tripnumbers + ids_inter = self.select_ids((self.times_start.get_value() == t_start) & ( + self.times_end.get_value() == t_end)) + if len(ids_inter) == 0: + + id_inter = self.add_row(times_start=t_start, times_end=t_end,) + print ' create new', id_inter #odintervals.add_rows(2, t_start=[0,3600], t_end=[3600, 7200]) - odmodes = OdModes( (self.odmodes.attrname, id_inter), parent = self, modes = self.get_net().modes, zones = self.get_zones()) - #NO!! odmodes = OdModes( ('ODMs for modes', id_inter), parent = self, modes = self.get_net().modes, zones = self.get_zones()) + odmodes = OdModes((self.odmodes.attrname, id_inter), parent=self, + modes=self.get_net().modes, zones=self.get_zones()) + # NO!! odmodes = OdModes( ('ODMs for modes', id_inter), parent = + # self, modes = self.get_net().modes, zones = self.get_zones()) self.odmodes[id_inter] = odmodes - - odmodes.add_od_trips(id_mode, scale, names_orig,names_dest,tripnumbers) - + + odmodes.add_od_trips(id_mode, scale, names_orig, + names_dest, tripnumbers) + else: - - # there should be only one demand table found for a certain interval + + # there should be only one demand table found for a certain + # interval id_inter = ids_inter[0] - print ' use',id_inter - self.odmodes[id_inter].add_od_trips(id_mode, scale, names_orig,names_dest,tripnumbers) - - - - + print ' use', id_inter + self.odmodes[id_inter].add_od_trips( + id_mode, scale, names_orig, names_dest, tripnumbers) + def get_net(self): return self.net.get_value() - + def get_zones(self): return self.zones.get_value() - + def get_modes(self): - return self.net.get_value().modes \ No newline at end of file + return self.net.get_value().modes diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/origin_to_destination_wxgui.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/origin_to_destination_wxgui.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/origin_to_destination_wxgui.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/origin_to_destination_wxgui.py 2017-07-23 16:22:03.000000000 +0000 @@ -7,114 +7,106 @@ from agilepy.lib_wx.objpanel import ObjPanel from coremodules.network.network import SumoIdsConf, MODES -#def make_menu(menubar): - +# def make_menu(menubar): + class AddOdWizzard(am.ArrayObjman): + """Contains information and methods to add an od matrix for a certain mode and for a certain time interval to the scenario. """ # j.s + def __init__(self, odintervals): - #print 'AddOdWizzard',odintervals#,odintervals.times_start - #print ' ',dir(odintervals) + # print 'AddOdWizzard',odintervals#,odintervals.times_start + # print ' ',dir(odintervals) zones = odintervals.get_zones() - - self._init_objman( 'odm_adder', parent =odintervals, - name = 'ODM Wizzard', - info = 'Wizzard to add origin zone to destination zone demand informations.', - ) - - self.add(am.AttrConf( 't_start', 0, - groupnames = ['state'], - perm='rw', - name = 'Start time', - unit = 's', - info = 'Start time of interval', - )) - + + self._init_objman('odm_adder', parent=odintervals, + name='ODM Wizzard', + info='Wizzard to add origin zone to destination zone demand informations.', + ) + + self.add(am.AttrConf('t_start', 0, + groupnames=['state'], + perm='rw', + name='Start time', + unit='s', + info='Start time of interval', + )) + self.add(am.AttrConf('t_end', 3600, - groupnames = ['state'], - perm='rw', - name = 'End time', - unit = 's', - info = 'End time of interval', - )) - - - - - - + groupnames=['state'], + perm='rw', + name='End time', + unit='s', + info='End time of interval', + )) + # here we ged classes not vehicle type - # specific vehicle type within a class will be generated later - self.add(am.AttrConf('id_mode', MODES['passenger'], - groupnames = ['state'], - choices = odintervals.parent.vtypes.get_modechoices(), - name = 'ID mode', - info = 'ID of transport mode.', - )) + # specific vehicle type within a class will be generated later + self.add(am.AttrConf('id_mode', MODES['passenger'], + groupnames=['state'], + choices=odintervals.parent.vtypes.get_modechoices(), + name='ID mode', + info='ID of transport mode.', + )) self.add(cm.AttrConf('scale', 1.0, - groupnames = ['options'], - perm='rw', - name = 'Scale', - info = 'Scale demand by this factor before adding. Value od 1.0 means no scaling.' - )) - - - - - self.add_col(am.ArrayConf( 'names_orig', '', - dtype = 'object', - groupnames = ['state'], - choices = list(zones.ids_sumo.get_value()), - name = 'Orig zone', - info = 'Name of traffic assignment zone of origin of trip.', - )) - - - self.add_col(am.ArrayConf( 'names_dest', '', - dtype = 'object', - groupnames = ['state'], - choices = list(zones.ids_sumo.get_value()), - name = 'Dest zone', - info = 'Name of traffic assignment zone of destination of trip.', - )) - - self.add_col(am.ArrayConf( 'tripnumbers', 0, - groupnames = ['state'], - perm = 'rw', - name = 'Trips', - info = 'Number of trips from zone with ID Orig to zone with ID Dest.', - xmltag = 'tripnumber', - )) - - self.add(cm.FuncConf( 'func_make_row','on_add_row', None, - groupnames = ['rowfunctions','_private'], - name = 'New row', - info = 'Add a new row.', - )) - - self.add(cm.FuncConf( 'func_delete_row','on_del_row', None, - groupnames = ['rowfunctions','_private'], - name = 'Del row', - info = 'Delete a row.', - )) - - - #self.attrs.print_attrs() - + groupnames=['options'], + perm='rw', + name='Scale', + info='Scale demand by this factor before adding. Value od 1.0 means no scaling.' + )) + + self.add_col(am.ArrayConf('names_orig', '', + dtype='object', + groupnames=['state'], + choices=list(zones.ids_sumo.get_value()), + name='Orig zone', + info='Name of traffic assignment zone of origin of trip.', + )) + + self.add_col(am.ArrayConf('names_dest', '', + dtype='object', + groupnames=['state'], + choices=list(zones.ids_sumo.get_value()), + name='Dest zone', + info='Name of traffic assignment zone of destination of trip.', + )) + + self.add_col(am.ArrayConf('tripnumbers', 0, + groupnames=['state'], + perm='rw', + name='Trips', + info='Number of trips from zone with ID Orig to zone with ID Dest.', + xmltag='tripnumber', + )) + + self.add(cm.FuncConf('func_make_row', 'on_add_row', None, + groupnames=['rowfunctions', '_private'], + name='New row', + info='Add a new row.', + )) + + self.add(cm.FuncConf('func_delete_row', 'on_del_row', None, + groupnames=['rowfunctions', '_private'], + name='Del row', + info='Delete a row.', + )) + + # self.attrs.print_attrs() + def on_del_row(self, id_row): """ True if position greater than thhreshold. """ - #print 'on_del_row', id_row - if id_row!=None: - self.del_row(id_row) - + # print 'on_del_row', id_row + if id_row != None: + self.del_row(id_row) + def on_add_row(self, id=None): - if len(self)>0: + if len(self) > 0: # copy previous od_last = self.get_row(self.get_ids()[-1]) #id_orig = self.odtab.ids_orig.get(id_last) @@ -124,58 +116,53 @@ else: # create empty self.add_row() - - - + def add_demand(self): """ Add demand to scenario. """ - #print 'AddOdm.add_demand' + # print 'AddOdm.add_demand' odintervals = self.parent #demand = self._scenario.demand - #odm={} # create a temporary dict with (o,d) as key and trips as value + # odm={} # create a temporary dict with (o,d) as key and trips as value ids = self.get_ids() - self.parent.add_od_trips( self.t_start.value, self.t_end.value, - self.id_mode.value, self.scale.value, - self.names_orig[ids],self.names_dest[ids],self.tripnumbers[ids] - ) - + self.parent.add_od_trips(self.t_start.value, self.t_end.value, + self.id_mode.value, self.scale.value, + self.names_orig[ids], self.names_dest[ + ids], self.tripnumbers[ids] + ) - - def import_csv(self, filepath, sep = ",", n_firstline = 1): + def import_csv(self, filepath, sep=",", n_firstline=1): names_zone = self.parent.get_zones().ids_sumo - f=open(filepath,'r') - #print ' open',filepath + f = open(filepath, 'r') + # print ' open',filepath i_line = n_firstline for line in f.readlines(): - #print ' ',line, + # print ' ',line, cols = line.split(sep) - if len(cols)==3: - name_orig,name_dest,tripnumbers_str=cols - + if len(cols) == 3: + name_orig, name_dest, tripnumbers_str = cols + name_orig = name_orig.strip() - name_dest= name_dest.strip() + name_dest = name_dest.strip() if names_zone.has_index(name_orig) & names_zone.has_index(name_dest): id_new = self.suggest_id() - self.add_row( id_new, - names_orig = name_orig, - names_dest = name_dest, - tripnumbers = int(tripnumbers_str) - ) + self.add_row(id_new, + names_orig=name_orig, + names_dest=name_dest, + tripnumbers=int(tripnumbers_str) + ) else: - print 'WARNING: unknown zonename in line %d of file %s'%(i_line, filepath) - + print 'WARNING: unknown zonename in line %d of file %s' % (i_line, filepath) + else: if len(cols) != 0: - print 'WARNING: inconsistent o,d,trips info in line %d of file %s'%(i_line, filepath) - i_line +=1 - #self.odtab.print_rows() + print 'WARNING: inconsistent o,d,trips info in line %d of file %s' % (i_line, filepath) + i_line += 1 + # self.odtab.print_rows() f.close() - - class AddOdDialog(wx.Frame): """ @@ -183,41 +170,43 @@ """ - - def __init__(self,parent, odintervals): - wx.Frame.__init__(self,parent, -1,title='Add OD flow Wizzard',pos=wx.DefaultPosition, size=wx.DefaultSize) + def __init__(self, parent, odintervals): + wx.Frame.__init__(self, parent, -1, title='Add OD flow Wizzard', + pos=wx.DefaultPosition, size=wx.DefaultSize) self.wizzard = AddOdWizzard(odintervals) self.parent = parent - ## Set up the MenuBar + # Set up the MenuBar MenuBar = wx.MenuBar() file_menu = wx.Menu() - item = file_menu.Append(-1, "&Import CSV...","Import OD data from a CSV text file with format , ,") + item = file_menu.Append(-1, "&Import CSV...", + "Import OD data from a CSV text file with format , ,") self.Bind(wx.EVT_MENU, self.on_import_csv, item) #item = file_menu.Append(-1, "&Import Exel...","Import OD data from an Exel file.") #self.Bind(wx.EVT_MENU, self.on_import_exel, item) - - item = file_menu.Append(-1, "&Save flows and close","Add OD flows to scenario and close wizzard") + + item = file_menu.Append(-1, "&Save flows and close", + "Add OD flows to scenario and close wizzard") self.Bind(wx.EVT_MENU, self.on_add, item) - - item = file_menu.Append(-1, "&Close","Close wizzard withot saving") + + item = file_menu.Append(-1, "&Close", "Close wizzard withot saving") self.Bind(wx.EVT_MENU, self.on_close, item) MenuBar.Append(file_menu, "&File") - + edit_menu = wx.Menu() - item = edit_menu.Append(-1, "&Add OD flow to table","Add a new flow by defining zones of origin, destination and number of trips in table") + item = edit_menu.Append(-1, "&Add OD flow to table", + "Add a new flow by defining zones of origin, destination and number of trips in table") self.Bind(wx.EVT_MENU, self.on_add_new, item) MenuBar.Append(edit_menu, "&Edit") - - + if odintervals.get_net().parent != None: self.dirpath = odintervals.get_net().parent.get_workdirpath() else: self.dirpath = os.getcwd() #help_menu = wx.Menu() - #item = help_menu.Append(-1, "&About", + # item = help_menu.Append(-1, "&About", # "More information About this program") #self.Bind(wx.EVT_MENU, self.on_menu, item) #MenuBar.Append(help_menu, "&Help") @@ -226,77 +215,73 @@ self.CreateStatusBar() - - - self.browser = self.make_browser() - - ##Create a sizer to manage the Canvas and message window + + # Create a sizer to manage the Canvas and message window MainSizer = wx.BoxSizer(wx.VERTICAL) MainSizer.Add(self.browser, 4, wx.EXPAND) - self.SetSizer(MainSizer) self.Bind(wx.EVT_CLOSE, self.on_close) self.EventsAreBound = False - ## getting all the colors for random objects - #wxlib.colourdb.updateColourDB() + # getting all the colors for random objects + # wxlib.colourdb.updateColourDB() #self.colors = wxlib.colourdb.getColourList() - return None - + def make_browser(self): # Create Browser widget here - buttons=[#('Add new OD flow', self.on_add_new, 'Add a new flow by defining zones of origin, destination and number of trips in table.'), - ('Save flows', self.on_add, 'Save OD flows to current demand.'), - ('Cancel', self.on_close, 'Close wizzard without adding flows.'), - ] - defaultbuttontext='Save flows' - #standartbuttons=['cancel','apply','ok']# apply does not show - standartbuttons=['apply'] - + buttons = [ # ('Add new OD flow', self.on_add_new, 'Add a new flow by defining zones of origin, destination and number of trips in table.'), + ('Save flows', self.on_add, 'Save OD flows to current demand.'), + ('Cancel', self.on_close, 'Close wizzard without adding flows.'), + ] + defaultbuttontext = 'Save flows' + # standartbuttons=['cancel','apply','ok']# apply does not show + standartbuttons = ['apply'] + browser = ObjPanel(self, self.wizzard, - attrconfigs=None, - id=None, ids=None, - groupnames = None, - func_change_obj=None, - show_groupnames=False, show_title=False, - is_modal=True, - mainframe=None, - pos=wx.DefaultPosition, - size=wx.DefaultSize, - style = wx.MAXIMIZE_BOX|wx.RESIZE_BORDER, - immediate_apply=False,#True, - panelstyle='default', - buttons = buttons, - standartbuttons = standartbuttons, - defaultbutton = defaultbuttontext, - ) + attrconfigs=None, + id=None, ids=None, + groupnames=None, + func_change_obj=None, + show_groupnames=False, show_title=False, + is_modal=True, + mainframe=None, + pos=wx.DefaultPosition, + size=wx.DefaultSize, + style=wx.MAXIMIZE_BOX | wx.RESIZE_BORDER, + immediate_apply=False, # True, + panelstyle='default', + buttons=buttons, + standartbuttons=standartbuttons, + defaultbutton=defaultbuttontext, + ) return browser - + def on_import_csv(self, event=None): - #print 'on_import_csv' + # print 'on_import_csv' self.browser.apply() - wizzard = self.browser.obj - - wildcards_all = "CSV files (*.csv)|*.csv|CSV files (*.txt)|*.txt|All files (*.*)|*.*"#+"|"+otherwildcards + wizzard = self.browser.obj + + # +"|"+otherwildcards + wildcards_all = "CSV files (*.csv)|*.csv|CSV files (*.txt)|*.txt|All files (*.*)|*.*" dlg = wx.FileDialog(self.parent, message="Import CSV file", - defaultDir = self.dirpath, + defaultDir=self.dirpath, defaultFile="", - wildcard = wildcards_all, + wildcard=wildcards_all, style=wx.OPEN | wx.MULTIPLE | wx.CHANGE_DIR ) - - # Show the dialog and retrieve the user response. If it is the OK response, + + # Show the dialog and retrieve the user response. If it is the OK response, # process the data. if dlg.ShowModal() == wx.ID_OK: # This returns a Python list of files that were selected. paths = dlg.GetPaths() - #print 'You selected %d files:' % len(paths) - if len(paths)>0: + # print 'You selected %d files:' % len(paths) + if len(paths) > 0: filepath = paths[0] else: filepath = '' @@ -306,59 +291,56 @@ ### wizzard.import_csv(filepath) ## - + self.refresh_browser() - #event.Skip() + # event.Skip() self.Raise() - #self.SetFocus() - #self.MakeModal(False) - #self.MakeModal(True) - #self.browser.restore() - - def on_add_new(self,event = None ): - #print 'on_add,AddOdm',self.browser.obj - self.browser.apply()# important to transfer widget values to obj! - wizzard = self.browser.obj + # self.SetFocus() + # self.MakeModal(False) + # self.MakeModal(True) + # self.browser.restore() + + def on_add_new(self, event=None): + # print 'on_add,AddOdm',self.browser.obj + self.browser.apply() # important to transfer widget values to obj! + wizzard = self.browser.obj wizzard.on_add_row() self.refresh_browser() - - def on_add(self,event = None ): - #print 'on_add,AddOdm',self.browser.obj - self.browser.apply()# important to transfer widget values to obj! - wizzard = self.browser.obj + + def on_add(self, event=None): + # print 'on_add,AddOdm',self.browser.obj + self.browser.apply() # important to transfer widget values to obj! + wizzard = self.browser.obj wizzard.add_demand() - + self.on_close(event) - + def on_close(self, event=None): self.MakeModal(False) self.Destroy() pass - - def on_add_close(self,event = None ): + + def on_add_close(self, event=None): self.on_add() self.on_close() - - - + def refresh_browser(self): """ Deletes previous conents Builds panel for obj Updates path window and history """ - #print 'Wizzard.refresh_panel with',obj.ident + # print 'Wizzard.refresh_panel with',obj.ident # remove previous obj panel - sizer=self.GetSizer() + sizer = self.GetSizer() sizer.Remove(0) self.browser.Destroy() #del self.browser self.browser = self.make_browser() - - sizer.Add(self.browser,1,wx.GROW) - + + sizer.Add(self.browser, 1, wx.GROW) + self.Refresh() - #sizer.Fit(self) + # sizer.Fit(self) sizer.Layout() # add to history - \ No newline at end of file diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/turnflows.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/turnflows.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/turnflows.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/turnflows.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,303 +1,295 @@ -import os, string -import numpy as np -from numpy import random +import os +import string +import numpy as np +from numpy import random import agilepy.lib_base.classman as cm import agilepy.lib_base.arrayman as am import agilepy.lib_base.xmlman as xm -from agilepy.lib_base.geometry import * +from agilepy.lib_base.geometry import * #from coremodules.modules_common import * from coremodules.network.network import SumoIdsConf, MODES -from agilepy.lib_base.processes import Process,P,call#,CmlMixin +from agilepy.lib_base.processes import Process, P, call # ,CmlMixin + - - - - - - class Flows(am.ArrayObjman): - def __init__(self,ident, parent, edges, **kwargs): - self._init_objman( ident, parent=parent, - name = 'Flows', - info = 'Contains the number of vehicles which start on the given edge during a certain time interval.', - xmltag = ('flows','flow',None), **kwargs) - - self.add_col(am.IdsArrayConf( 'ids_edge', edges, - groupnames = ['state'], - name = 'Edge ID', - info = 'Edge ID of flow.', - xmltag = 'from', - )) - - - self.add_col(am.ArrayConf( 'flows', 0, - groupnames = ['state'], - perm = 'rw', - name = 'Flow', - info = 'Absolute number of vehicles which start on the given edge during a certain time interval.', - xmltag = 'number', - )) - + + def __init__(self, ident, parent, edges, **kwargs): + self._init_objman(ident, parent=parent, + name='Flows', + info='Contains the number of vehicles which start on the given edge during a certain time interval.', + xmltag=('flows', 'flow', None), **kwargs) + + self.add_col(am.IdsArrayConf('ids_edge', edges, + groupnames=['state'], + name='Edge ID', + info='Edge ID of flow.', + xmltag='from', + )) + + self.add_col(am.ArrayConf('flows', 0, + groupnames=['state'], + perm='rw', + name='Flow', + info='Absolute number of vehicles which start on the given edge during a certain time interval.', + xmltag='number', + )) def _init_constants(self): #self.edgeweights_orig = None #self.edgeweights_dest = None pass - - + def add_flow(self, id_edge, flow): print 'Flows.add_flows' - return self.add_row( ids_edge = id_edge, - flows = flow) - - + return self.add_row(ids_edge=id_edge, + flows=flow) + def get_edges(self): - return self.ids_edge.get_linktab() - + return self.ids_edge.get_linktab() + def get_demand(self): return self.parent.parent.parent - + def export_xml(self, fd, vtype, id_flow, indent=2): - """ Generates a line for each edge with a flow. - + id_flow is the flow count and is used to generate a unique flow id TODO: better handling of mode and vtypes, distributions - + """ - + # - ids_eges =[] + ids_eges = [] ids_sumoeges = self.get_edges().ids_sumo i = 0 - #print 'Flows.export_xml vtypes,id_flow,len(self)',vtype,id_flow,len(self) - for id_edge,flow in zip(self.ids_edge.get_value(), self.flows.get_value()): - #print ' id_edge,flow',id_edge,flow + # print 'Flows.export_xml + # vtypes,id_flow,len(self)',vtype,id_flow,len(self) + for id_edge, flow in zip(self.ids_edge.get_value(), self.flows.get_value()): + # print ' id_edge,flow',id_edge,flow ids_eges.append(id_edge) id_flow += 1 - fd.write(xm.start('flow'+xm.num('id',id_flow), indent)) - fd.write(xm.num('from',ids_sumoeges[id_edge])) - fd.write(xm.num('type',vtype)) - fd.write(xm.num('number',int(flow)) ) + fd.write(xm.start('flow' + xm.num('id', id_flow), indent)) + fd.write(xm.num('from', ids_sumoeges[id_edge])) + fd.write(xm.num('type', vtype)) + fd.write(xm.num('number', int(flow))) fd.write(xm.stopit()) i += 1 - #print ' return ids_eges, id_flow',ids_eges, id_flow + # print ' return ids_eges, id_flow',ids_eges, id_flow return ids_eges, id_flow + class Turns(am.ArrayObjman): - def __init__(self,ident, parent, edges, **kwargs): - self._init_objman( ident, parent=parent, - name = 'Truns', - info = 'The table contains turn probabilities between two edges during a given time interval.', - xmltag = ('odtrips','odtrip',None), **kwargs) - - self.add_col(am.IdsArrayConf( 'ids_fromedge', edges, - groupnames = ['state'], - name = 'Edge ID from', - info = 'Edge ID where turn starts.', - xmltag = 'fromEdge', - )) - - self.add_col(am.IdsArrayConf( 'ids_toedge', edges, - groupnames = ['state'], - name = 'Edge ID to', - info = 'Edge ID where turn ends.', - xmltag = 'toEdge', - )) - - self.add_col(am.ArrayConf( 'probabilities', 0.0, - groupnames = ['state'], - perm = 'rw', - name = 'Probab.', - info = 'Probability to make a turn from start edge to end edge.', - xmltag = 'number', - )) - + + def __init__(self, ident, parent, edges, **kwargs): + self._init_objman(ident, parent=parent, + name='Truns', + info='The table contains turn probabilities between two edges during a given time interval.', + xmltag=('odtrips', 'odtrip', None), **kwargs) + + self.add_col(am.IdsArrayConf('ids_fromedge', edges, + groupnames=['state'], + name='Edge ID from', + info='Edge ID where turn starts.', + xmltag='fromEdge', + )) + + self.add_col(am.IdsArrayConf('ids_toedge', edges, + groupnames=['state'], + name='Edge ID to', + info='Edge ID where turn ends.', + xmltag='toEdge', + )) + + self.add_col(am.ArrayConf('probabilities', 0.0, + groupnames=['state'], + perm='rw', + name='Probab.', + info='Probability to make a turn from start edge to end edge.', + xmltag='number', + )) def _init_constants(self): #self.edgeweights_orig = None #self.edgeweights_dest = None pass - - + def normalize_turnprobabilities(self): """ Makes sure that sum of turn probabilities from an edge equals 1. """ - # TODO: there is a quicker way with picking a set and then select + # TODO: there is a quicker way with picking a set and then select # and sum with vectors #ids_source = set(self.ids_fromedge.get_values()) - + prop_totals = {} for _id in self.get_ids(): id_fromedge = self.ids_fromedge[_id] if not prop_totals.has_key(id_fromedge): prop_totals[id_fromedge] = 0.0 prop_totals[id_fromedge] += self.probabilities[_id] - + for _id in self.get_ids(): - if prop_totals[self.ids_fromedge[_id]]>0: + if prop_totals[self.ids_fromedge[_id]] > 0: self.probabilities[_id] /= prop_totals[self.ids_fromedge[_id]] - - - def add_turn(self, id_fromedge,id_toedge, probability): + + def add_turn(self, id_fromedge, id_toedge, probability): print 'Turns.add_turn' - return self.add_row( ids_fromedge = id_fromedge, - ids_toedge = id_toedge, - probabilities = probability, - ) - - + return self.add_row(ids_fromedge=id_fromedge, + ids_toedge=id_toedge, + probabilities=probability, + ) + def get_edges(self): - return self.ids_fromedge.get_linktab() - - def export_xml(self,fd,indent=0): + return self.ids_fromedge.get_linktab() + + def export_xml(self, fd, indent=0): # # # # # - + fromedge_to_turnprobs = {} for _id in self.get_ids(): id_fromedge = self.ids_fromedge[_id] if not fromedge_to_turnprobs.has_key(id_fromedge): fromedge_to_turnprobs[id_fromedge] = [] - fromedge_to_turnprobs[id_fromedge].append((self.ids_toedge[_id], self.probabilities[_id])) - + fromedge_to_turnprobs[id_fromedge].append( + (self.ids_toedge[_id], self.probabilities[_id])) + ids_sumoeges = self.get_edges().ids_sumo - + for id_fromedge in fromedge_to_turnprobs.keys(): - fd.write(xm.begin('fromEdge'+xm.num('id',ids_sumoeges[id_fromedge]),indent)) + fd.write(xm.begin('fromEdge' + xm.num('id', + ids_sumoeges[id_fromedge]), indent)) for id_toedge, turnprob in fromedge_to_turnprobs[id_fromedge]: - fd.write(xm.start('toEdge',indent+2)) - fd.write(xm.num('id',ids_sumoeges[id_toedge])+xm.num('probability',turnprob)) + fd.write(xm.start('toEdge', indent + 2)) + fd.write(xm.num('id', ids_sumoeges[ + id_toedge]) + xm.num('probability', turnprob)) fd.write(xm.stopit()) - fd.write(xm.end('fromEdge',indent)) - + fd.write(xm.end('fromEdge', indent)) + + class TurnflowModes(am.ArrayObjman): - def __init__(self,ident,parent, modes, edges, **kwargs): - self._init_objman( ident,parent=parent, - name = 'Mode OD tables', - info = 'Contains for each transport mode an OD trip table.', - xmltag = ('modesods','modeods','ids_mode'), **kwargs) - - print 'TurnflowModes.__init__',modes - self.add_col(am.IdsArrayConf( 'ids_mode', modes, - groupnames = ['state'], - choices = MODES, - name = 'ID mode', - is_index = True, - #xmltag = 'vClass', - info = 'ID of transport mode.', - )) - print ' self.ids_mode.is_index',self.ids_mode.is_index() - - self.add_col(cm.ObjsConf( 'flowtables', - groupnames = ['state'], - name = 'Flows', - info = 'Flow generation per edge for a specific mode.', - )) - - self.add_col(cm.ObjsConf( 'turntables', - groupnames = ['state'], - name = 'Turns', - info = 'Turn probabilities between edges for a specific mode.', - )) - - self.add( cm.ObjConf( edges, is_child = False,groups = ['_private'])) - - #def generate_trips(self, demand, time_start, time_end,**kwargs): + + def __init__(self, ident, parent, modes, edges, **kwargs): + self._init_objman(ident, parent=parent, + name='Mode OD tables', + info='Contains for each transport mode an OD trip table.', + xmltag=('modesods', 'modeods', 'ids_mode'), **kwargs) + + print 'TurnflowModes.__init__', modes + self.add_col(am.IdsArrayConf('ids_mode', modes, + groupnames=['state'], + choices=MODES, + name='ID mode', + is_index=True, + #xmltag = 'vClass', + info='ID of transport mode.', + )) + print ' self.ids_mode.is_index', self.ids_mode.is_index() + + self.add_col(cm.ObjsConf('flowtables', + groupnames=['state'], + name='Flows', + info='Flow generation per edge for a specific mode.', + )) + + self.add_col(cm.ObjsConf('turntables', + groupnames=['state'], + name='Turns', + info='Turn probabilities between edges for a specific mode.', + )) + + self.add(cm.ObjConf(edges, is_child=False, groups=['_private'])) + + # def generate_trips(self, demand, time_start, time_end,**kwargs): # for id_od_mode in self.get_ids(): # self.odtrips[id_od_mode].generate_trips( demand, time_start, time_end, self.ids_mode[id_od_mode],**kwargs) - - - - #def generate_odflows(self, odflowtab, time_start, time_end,**kwargs): + + # def generate_odflows(self, odflowtab, time_start, time_end,**kwargs): # for id_od_mode in self.get_ids(): # self.odtrips[id_od_mode].generate_odflows( odflowtab, time_start, time_end, self.ids_mode[id_od_mode],**kwargs) - + def get_demand(self): return self.parent.parent - + def normalize_turnprobabilities(self): """ Makes sure that sum of turn probabilities from an edge equals 1. """ for _id in self.get_ids(): self.turntables[_id].normalize_turnprobabilities() - - + def add_mode(self, id_mode): - id_tf_modes = self.add_row(ids_mode = id_mode) - print ' add_mode',id_mode,id_tf_modes - - - flows = Flows( (self.flowtables.attrname, id_tf_modes), self, self.edges.get_value() ) + id_tf_modes = self.add_row(ids_mode=id_mode) + print ' add_mode', id_mode, id_tf_modes + + flows = Flows((self.flowtables.attrname, id_tf_modes), + self, self.edges.get_value()) self.flowtables[id_tf_modes] = flows - - turns = Turns( (self.turntables.attrname, id_tf_modes), self, self.edges.get_value() ) + + turns = Turns((self.turntables.attrname, id_tf_modes), + self, self.edges.get_value()) self.turntables[id_tf_modes] = turns - + return id_tf_modes - + def add_flow(self, id_mode, id_edge, flow): """ Sets a demand flows between from-Edge and toEdge pairs for mode where flows is a dictionary with (fromEdgeID,toEdgeID) pair as key and number of trips as values. """ - print 'TurnflowModes.add_turnflows',id_mode#,flows,kwargs - print ' self.ids_mode.is_index()',self.ids_mode.is_index() + print 'TurnflowModes.add_turnflows', id_mode # ,flows,kwargs + print ' self.ids_mode.is_index()', self.ids_mode.is_index() if self.ids_mode.has_index(id_mode): id_tf_modes = self.ids_mode.get_id_from_index(id_mode) else: id_tf_modes = self.add_mode(id_mode) self.flowtables[id_tf_modes].add_flow(id_edge, flow) - - - - - - def add_turn(self,id_mode, id_fromedge, id_toedge, turnprob): + + def add_turn(self, id_mode, id_fromedge, id_toedge, turnprob): """ Sets turn probability between from-edge and to-edge. """ - print 'TurnflowModes.add_turn',id_mode#,flows,kwargs - #if scale!=1.0: + print 'TurnflowModes.add_turn', id_mode # ,flows,kwargs + # if scale!=1.0: # for od in odm.iterkeys(): # odm[od] *= scale - #if not self.contains_key(mode): + # if not self.contains_key(mode): # self._initTurnflowsMode(mode) if self.ids_mode.has_index(id_mode): id_tf_modes = self.ids_mode.get_id_from_index(id_mode) else: id_tf_modes = self.add_mode(id_mode) - + self.turntables[id_tf_modes].add_turn(id_fromedge, id_toedge, turnprob) - - def export_flows_xml(self, fd, id_mode, id_flow = 0, indent=0): + + def export_flows_xml(self, fd, id_mode, id_flow=0, indent=0): """ Export flow data of desired mode to xml file. Returns list with edge IDs with non zero flows and a flow ID counter. """ - print 'TurnflowModes.export_flows_xml mode, flowID',id_mode, id_flow + print 'TurnflowModes.export_flows_xml mode, flowID', id_mode, id_flow + + ids_sourceedge = [] - ids_sourceedge=[] - # get vtypes for specified mode - vtypes = self.get_demand().vtypes.select_by_mode(id_mode, is_sumoid = True) - - if len(vtypes) > 0:# any vehicles found for this mode? + vtypes = self.get_demand().vtypes.select_by_mode( + id_mode, is_sumoid=True) + + if len(vtypes) > 0: # any vehicles found for this mode? # TODO: can we put some distributen here? vtype = vtypes[0] - + if self.ids_mode.has_index(id_mode): id_tf_modes = self.ids_mode.get_id_from_index(id_mode) - ids_sourceedge, id_flow = self.flowtables[id_tf_modes].export_xml(fd, vtype, id_flow, indent = indent) - print ' return ids_sourceedge, id_flow',ids_sourceedge, id_flow + ids_sourceedge, id_flow = self.flowtables[ + id_tf_modes].export_xml(fd, vtype, id_flow, indent=indent) + print ' return ids_sourceedge, id_flow', ids_sourceedge, id_flow return ids_sourceedge, id_flow - + def export_turns_xml(self, fd, id_mode, indent=0): """ Export flow data of desired mode to xml file. @@ -307,348 +299,340 @@ if self.ids_mode.has_index(id_mode): id_tf_modes = self.ids_mode.get_id_from_index(id_mode) - self.turntables[id_tf_modes].export_xml(fd, indent = indent) - + self.turntables[id_tf_modes].export_xml(fd, indent=indent) + - - - class Turnflows(am.ArrayObjman): + def __init__(self, ident, demand, net, **kwargs): - self._init_objman( ident,parent = demand,# = demand - name = 'Turnflow Demand', - info = 'Contains flows and turn probailities for different modes and time intervals. Here demand data is ordered by time intervals.', - xmltag = ('turnflows','interval',None), **kwargs) - - - - self.add_col(am.ArrayConf( 'times_start', 0, - groupnames = ['state'], - perm='rw', - name = 'Start time', - unit = 's', - info = 'Start time of interval in seconds (no fractional seconds).', - xmltag = 't_start', - )) - - self.add_col(am.ArrayConf('times_end', 3600, - groupnames = ['state'], - perm='rw', - name = 'End time', - unit = 's', - info = 'End time of interval in seconds (no fractional seconds).', - xmltag = 't_end', - )) - - self.add_col(cm.ObjsConf( 'turnflowmodes', - groupnames = ['state'], - is_save = True, - name = 'Turnflows by modes', - info = 'Turnflow transport demand for all transport modes within the respective time interval.', - )) - #self.add( cm.ObjConf( Sinkzones('sinkzones', self, demand.get_scenario().net.edges) )) - + self._init_objman(ident, parent=demand, # = demand + name='Turnflow Demand', + info='Contains flows and turn probailities for different modes and time intervals. Here demand data is ordered by time intervals.', + xmltag=('turnflows', 'interval', None), **kwargs) + + self.add_col(am.ArrayConf('times_start', 0, + groupnames=['state'], + perm='rw', + name='Start time', + unit='s', + info='Start time of interval in seconds (no fractional seconds).', + xmltag='t_start', + )) + + self.add_col(am.ArrayConf('times_end', 3600, + groupnames=['state'], + perm='rw', + name='End time', + unit='s', + info='End time of interval in seconds (no fractional seconds).', + xmltag='t_end', + )) + + self.add_col(cm.ObjsConf('turnflowmodes', + groupnames=['state'], + is_save=True, + name='Turnflows by modes', + info='Turnflow transport demand for all transport modes within the respective time interval.', + )) + #self.add( cm.ObjConf( Sinkzones('sinkzones', self, demand.get_scenario().net.edges) )) + def get_demand(self): return self.parent - + def normalize_turnprobabilities(self): """ Makes sure that sum of turn probabilities from an edge equals 1. """ print 'Turnflows.normalize_turnprobabilities' - #for turnflowmode in self.turnflowmodes.get_value(): + # for turnflowmode in self.turnflowmodes.get_value(): # turnflowmode.normalize_turnprobabilities() # no! it's a dict!! - #print ' ',self.turnflowmodes.get_value() + # print ' ',self.turnflowmodes.get_value() for _id in self.get_ids(): self.turnflowmodes[_id].normalize_turnprobabilities() - - + def clear_turnflows(self): self.clear() - - + def add_flow(self, t_start, t_end, id_mode, id_edge, flow): - - #print 'turnflows.add_flow', t_start, t_end, id_mode, id_edge, flow - ids_inter = self.select_ids((self.times_start.get_value()==t_start)&(self.times_end.get_value()==t_end)) - if len(ids_inter)==0: - - id_inter = self.add_row(times_start = t_start, times_end=t_end, ) - #print ' create new',id_inter - tfmodes = TurnflowModes( (self.turnflowmodes.attrname, id_inter), - self, self.get_net().modes, self.get_net().edges) - - #NO!! odmodes = OdModes( ('ODMs for modes', id_inter), parent = self, modes = self.get_net().modes, zones = self.get_zones()) + + # print 'turnflows.add_flow', t_start, t_end, id_mode, id_edge, flow + ids_inter = self.select_ids((self.times_start.get_value() == t_start) & ( + self.times_end.get_value() == t_end)) + if len(ids_inter) == 0: + + id_inter = self.add_row(times_start=t_start, times_end=t_end,) + # print ' create new',id_inter + tfmodes = TurnflowModes((self.turnflowmodes.attrname, id_inter), + self, self.get_net().modes, self.get_net().edges) + + # NO!! odmodes = OdModes( ('ODMs for modes', id_inter), parent = + # self, modes = self.get_net().modes, zones = self.get_zones()) self.turnflowmodes[id_inter] = tfmodes - + tfmodes.add_flow(id_mode, id_edge, flow) - + else: - - # there should be only one demand table found for a certain interval + + # there should be only one demand table found for a certain + # interval id_inter = ids_inter[0] - #print ' use',id_inter - self.turnflowmodes[id_inter].add_flow(id_mode,id_edge, flow) - - - def add_turn(self, t_start, t_end,id_mode,id_fromedge, id_toedge, turnprob): - - #print 'turnflows.add_turnflows',t_start, t_end,id_mode,id_fromedge, id_toedge, turnprob - ids_inter = self.select_ids((self.times_start.get_value()==t_start)&(self.times_end.get_value()==t_end)) - if len(ids_inter)==0: - - id_inter = self.add_row(times_start = t_start, times_end=t_end, ) - #print ' create new',id_inter - tfmodes = TurnflowModes( ( self.turnflowmodes.attrname, id_inter), - self, self.get_net().modes, self.get_net().edges) - - #NO!! odmodes = OdModes( ('ODMs for modes', id_inter), parent = self, modes = self.get_net().modes, zones = self.get_zones()) + # print ' use',id_inter + self.turnflowmodes[id_inter].add_flow(id_mode, id_edge, flow) + + def add_turn(self, t_start, t_end, id_mode, id_fromedge, id_toedge, turnprob): + + # print 'turnflows.add_turnflows',t_start, t_end,id_mode,id_fromedge, + # id_toedge, turnprob + ids_inter = self.select_ids((self.times_start.get_value() == t_start) & ( + self.times_end.get_value() == t_end)) + if len(ids_inter) == 0: + + id_inter = self.add_row(times_start=t_start, times_end=t_end,) + # print ' create new',id_inter + tfmodes = TurnflowModes((self.turnflowmodes.attrname, id_inter), + self, self.get_net().modes, self.get_net().edges) + + # NO!! odmodes = OdModes( ('ODMs for modes', id_inter), parent = + # self, modes = self.get_net().modes, zones = self.get_zones()) self.turnflowmodes[id_inter] = tfmodes - - tfmodes.add_turn(id_mode,id_fromedge, id_toedge, turnprob) - + + tfmodes.add_turn(id_mode, id_fromedge, id_toedge, turnprob) + else: - - # there should be only one demand table found for a certain interval + + # there should be only one demand table found for a certain + # interval id_inter = ids_inter[0] - #print ' use',id_inter - self.turnflowmodes[id_inter].add_turn(id_mode,id_fromedge, id_toedge, turnprob) - - - - + # print ' use',id_inter + self.turnflowmodes[id_inter].add_turn( + id_mode, id_fromedge, id_toedge, turnprob) + def get_net(self): return self.parent.get_scenario().net - + def get_edges(self): return self.get_net().edges - + def get_modes(self): ids_mode = set() for id_inter in self.get_ids(): ids_mode.update(self.turnflowmodes[id_inter].ids_mode.value) - return list(ids_mode)# self.get_net().modes - - + return list(ids_mode) # self.get_net().modes + def get_sinkedges(self): zones = self.parent.get_scenario().landuse.zones ids_sinkedges = set() for ids_edge in zones.ids_edges_orig.get_value(): ids_sinkedges.update(ids_edge) #sinkedges = zones.ids_edges_orig.get_value().tolist() - #print 'get_sinkedges',sinkedges - #print ' sinkedges',np.array(sinkedges,np.object) + # print 'get_sinkedges',sinkedges + # print ' sinkedges',np.array(sinkedges,np.object) return ids_sinkedges - + def export_flows_and_turns(self, flowfilepath, turnsfilepath, id_mode, indent=0): """ Create the flow file and turn ratios file for a specific mode. In the SUMOpy tunflow data structure, each mode has its own flow and turnratio data. """ - print '\n\n'+79*'_' - print 'export_flows_and_turns id_mode=',id_mode,'ids_vtype=',self.parent.vtypes.select_by_mode(id_mode) - print ' write flows',flowfilepath + print '\n\n' + 79 * '_' + print 'export_flows_and_turns id_mode=', id_mode, 'ids_vtype=', self.parent.vtypes.select_by_mode(id_mode) + print ' write flows', flowfilepath fd = open(flowfilepath, 'w') - fd.write(xm.begin('flows',indent)) - + fd.write(xm.begin('flows', indent)) + # write all possible vtypes for this mode - self.parent.vtypes.write_xml( fd, indent=indent, - ids = self.parent.vtypes.select_by_mode(id_mode), - is_print_begin_end = False) - + self.parent.vtypes.write_xml(fd, indent=indent, + ids=self.parent.vtypes.select_by_mode( + id_mode), + is_print_begin_end=False) + id_flow = 0 ids_allsourceedges = [] time_start_min = +np.inf - time_end_max = -np.inf + time_end_max = -np.inf for id_inter in self.get_ids(): time_start = self.times_start[id_inter] time_end = self.times_end[id_inter] - fd.write(xm.begin('interval'+xm.num('begin',time_start)+xm.num('end',time_end),indent+2)) - ids_sourceedge, id_flow = self.turnflowmodes[id_inter].export_flows_xml(fd, id_mode, id_flow, indent+4) - #print ' got ids_sourceedge, id_flow',ids_sourceedge, id_flow + fd.write(xm.begin('interval' + xm.num('begin', time_start) + + xm.num('end', time_end), indent + 2)) + ids_sourceedge, id_flow = self.turnflowmodes[ + id_inter].export_flows_xml(fd, id_mode, id_flow, indent + 4) + # print ' got ids_sourceedge, id_flow',ids_sourceedge, id_flow ids_allsourceedges += ids_sourceedge - - if len(ids_sourceedge)>0: - #print ' extend total time interval only for intervals with flow' - if time_start 0: + # print ' extend total time interval only for intervals with + # flow' + if time_start < time_start_min: time_start_min = time_start - - if time_end>time_end_max: + + if time_end > time_end_max: time_end_max = time_end - - fd.write(xm.end('interval',indent+2)) - - fd.write(xm.end('flows',indent)) + + fd.write(xm.end('interval', indent + 2)) + + fd.write(xm.end('flows', indent)) fd.close() - - #print ' write turndefs', turnsfilepath + + # print ' write turndefs', turnsfilepath fd = open(turnsfilepath, 'w') - fd.write(xm.begin('turns',indent)) - - - + fd.write(xm.begin('turns', indent)) + for id_inter in self.get_ids(): time_start = self.times_start[id_inter] time_end = self.times_end[id_inter] - fd.write(xm.begin('interval'+xm.num('begin',time_start)+xm.num('end',time_end),indent+2)) - self.turnflowmodes[id_inter].export_turns_xml(fd, id_mode, indent+4) - fd.write(xm.end('interval',indent+2)) - - - # take sink edges from sink zones - ids_sinkedge = self.get_sinkedges()# it's a set + fd.write(xm.begin('interval' + xm.num('begin', time_start) + + xm.num('end', time_end), indent + 2)) + self.turnflowmodes[id_inter].export_turns_xml( + fd, id_mode, indent + 4) + fd.write(xm.end('interval', indent + 2)) + + # take sink edges from sink zones + ids_sinkedge = self.get_sinkedges() # it's a set # ...and remove source edges, otherwise vehicle will be inserted and # immediately removed - #print ' ids_sinkedge',ids_sinkedge - #print ' ids_allsourceedges',ids_allsourceedges + # print ' ids_sinkedge',ids_sinkedge + # print ' ids_allsourceedges',ids_allsourceedges ids_sinkedge = ids_sinkedge.difference(ids_allsourceedges) - + ids_sumoedge = self.get_edges().ids_sumo - #print ' determined sink edges',list(ids_sinkedge) - if len(ids_sinkedge)>0: + # print ' determined sink edges',list(ids_sinkedge) + if len(ids_sinkedge) > 0: fd.write(xm.start('sink')) - fd.write(xm.arr('edges',ids_sumoedge[list(ids_sinkedge)])) + fd.write(xm.arr('edges', ids_sumoedge[list(ids_sinkedge)])) fd.write(xm.stopit()) - - fd.write(xm.end('turns',indent)) + + fd.write(xm.end('turns', indent)) fd.close() - if len(ids_allsourceedges)==0: + if len(ids_allsourceedges) == 0: time_start_min = 0 time_end_max = 0 - + return time_start_min, time_end_max - - - - - - - def turnflows_to_routes(self, is_clear_trips = True, is_export_network = True): - # jtrrouter --flow-files= + + def turnflows_to_routes(self, is_clear_trips=True, is_export_network=True): + # jtrrouter --flow-files= # --turn-ratio-files= --net-file= \ # --output-file=MySUMORoutes.rou.xml --begin --end scenario = self.parent.get_scenario() cmloptions = '-v --max-edges-factor 1 --seed 23423 --repair --ignore-vclasses false --ignore-errors --turn-defaults 5,90,5' - + trips = scenario.demand.trips if is_clear_trips: # clear all current trips = routes trips.clear_trips() - - - + rootfilepath = scenario.get_rootfilepath() - netfilepath = rootfilepath+'.net.xml' - flowfilepath = rootfilepath+'.flow.xml' - turnfilepath = rootfilepath+'.turn.xml' - + netfilepath = rootfilepath + '.net.xml' + flowfilepath = rootfilepath + '.flow.xml' + turnfilepath = rootfilepath + '.turn.xml' + routefilepath = trips.get_routefilepath() - + if is_export_network: # first generate xml for net scenario.net.export_netxml() - + ids_mode = self.get_modes() - print 'turnflows_to_routes', ids_mode#scenario.net.modes.get_ids() - - # route for all modes and read in routes - for id_mode in ids_mode: + print 'turnflows_to_routes', ids_mode # scenario.net.modes.get_ids() + + # route for all modes and read in routes + for id_mode in ids_mode: # write flow and turns xml file for this mode - time_start, time_end = self.export_flows_and_turns(flowfilepath, turnfilepath, id_mode) - print ' time_start, time_end =',time_start, time_end - if time_end>time_start:# means there exist some flows for this mode + time_start, time_end = self.export_flows_and_turns( + flowfilepath, turnfilepath, id_mode) + print ' time_start, time_end =', time_start, time_end + # means there exist some flows for this mode + if time_end > time_start: cmd = 'jtrrouter --flow-files=%s --turn-ratio-files=%s --net-file=%s --output-file=%s --begin %s --end %s %s'\ - %( P+flowfilepath+P, - P+turnfilepath+P, - P+netfilepath+P, - P+routefilepath+P, - time_start, - time_end, - cmloptions, - ) - #print '\n Starting command:',cmd + % (P + flowfilepath + P, + P + turnfilepath + P, + P + netfilepath + P, + P + routefilepath + P, + time_start, + time_end, + cmloptions, + ) + # print '\n Starting command:',cmd if call(cmd): - if os.path.isfile(routefilepath): - trips.import_routes_xml(routefilepath, is_generate_ids = True) + if os.path.isfile(routefilepath): + trips.import_routes_xml( + routefilepath, is_generate_ids=True) os.remove(routefilepath) - + else: - print 'jtrroute: no flows generated for id_mode',id_mode - - - #self.simfiles.set_modified_data('rou',True) - #self.simfiles.set_modified_data('trip',True) + print 'jtrroute: no flows generated for id_mode', id_mode + + # self.simfiles.set_modified_data('rou',True) + # self.simfiles.set_modified_data('trip',True) # trips and routes are not yet saved!! - + + class TurnflowImporter(Process): - def __init__(self, turnflows, rootname = None, rootdirpath = None, tffilepath = None, - logger = None,**kwargs): - - self._init_common( 'turnflowimporter', name = 'Turnflow Importer', - parent = turnflows, - logger = logger, - info ='Reads and imports turnflow data from different file formates.', - ) - + + def __init__(self, turnflows, rootname=None, rootdirpath=None, tffilepath=None, + logger=None, **kwargs): + + self._init_common('turnflowimporter', name='Turnflow Importer', + parent=turnflows, + logger=logger, + info='Reads and imports turnflow data from different file formates.', + ) + self._edges = turnflows.get_edges() self._net = self._edges.get_parent() - - + if rootname == None: rootname = self._net.parent.get_rootfilename() - - + if rootdirpath == None: if self._net.parent != None: rootdirpath = self._net.parent.get_workdirpath() else: rootdirpath = os.getcwd() - + if tffilepath == None: - tffilepath =os.path.join(rootdirpath,rootname+'.net.xml') - - + tffilepath = os.path.join(rootdirpath, rootname + '.net.xml') + attrsman = self.get_attrsman() - - self.t_start = attrsman.add(am.AttrConf( 't_start', 0, - groupnames = ['options'], - perm='rw', - name = 'Start time', - unit = 's', - info = 'Start time of interval', - )) - + + self.t_start = attrsman.add(am.AttrConf('t_start', 0, + groupnames=['options'], + perm='rw', + name='Start time', + unit='s', + info='Start time of interval', + )) + self.t_end = attrsman.add(am.AttrConf('t_end', 3600, - groupnames = ['options'], - perm='rw', - name = 'End time', - unit = 's', - info = 'End time of interval', - )) - + groupnames=['options'], + perm='rw', + name='End time', + unit='s', + info='End time of interval', + )) + # here we get currently available vehicle classes not vehicle type - # specific vehicle type within a class will be generated later - self.id_mode = attrsman.add(am.AttrConf('id_mode', MODES['passenger'], - groupnames = ['options'], - choices = turnflows.parent.vtypes.get_modechoices(), - name = 'ID mode', - info = 'ID of transport mode.', - )) - - - self.tffilepath = attrsman.add(am.AttrConf('tffilepath',tffilepath, - groupnames = ['options'],# this will make it show up in the dialog - perm='rw', - name = 'Turnflow file', - wildcards = "Turnflows CSV files (*.csv)|*.csv|CSV files (*.txt)|*.txt|All files (*.*)|*.*", - metatype = 'filepath', - info = 'CSV file with turnflow information for the specific mode and time interval.', - )) - - - - + # specific vehicle type within a class will be generated later + self.id_mode = attrsman.add(am.AttrConf('id_mode', MODES['passenger'], + groupnames=['options'], + choices=turnflows.parent.vtypes.get_modechoices(), + name='ID mode', + info='ID of transport mode.', + )) + + self.tffilepath = attrsman.add(am.AttrConf('tffilepath', tffilepath, + # this will make it show up + # in the dialog + groupnames=['options'], + perm='rw', + name='Turnflow file', + wildcards="Turnflows CSV files (*.csv)|*.csv|CSV files (*.txt)|*.txt|All files (*.*)|*.*", + metatype='filepath', + info='CSV file with turnflow information for the specific mode and time interval.', + )) + def update_params(self): """ Make all parameters consistent. @@ -658,71 +642,73 @@ pass #self.workdirpath = os.path.dirname(self.netfilepath) #bn = os.path.basename(self.netfilepath).split('.') - #if len(bn)>0: + # if len(bn)>0: # self.rootname = bn[0] - + def do(self): - #self.update_params() + # self.update_params() if os.path.isfile(self.tffilepath): self.import_pat_csv() - - def import_pat_csv(self, sep = ","): - - f=open(self.tffilepath,'r') - #self.attrs.print_attrs() + + def import_pat_csv(self, sep=","): + + f = open(self.tffilepath, 'r') + # self.attrs.print_attrs() turnflows = self.parent edges = turnflows.get_edges() ids_edge_sumo = edges.ids_sumo - + ids_sumoedge_notexist = [] pairs_sumoedge_unconnected = [] - - print 'import_pat_csv',self.tffilepath + + print 'import_pat_csv', self.tffilepath i_line = 1 for line in f.readlines(): cols = line.split(sep) - #print ' cols=',cols - if len(cols)>=2: + # print ' cols=',cols + if len(cols) >= 2: id_fromedge_sumo = cols[0].strip() if not ids_edge_sumo.has_index(id_fromedge_sumo): ids_sumoedge_notexist.append(id_fromedge_sumo) else: - id_fromedge = ids_edge_sumo.get_id_from_index(id_fromedge_sumo) - - if cols[1].strip()!='': + id_fromedge = ids_edge_sumo.get_id_from_index( + id_fromedge_sumo) + + if cols[1].strip() != '': flow = int(string.atof(cols[1].strip())) - #print ' id_fromedge,flow',id_fromedge,flow - if flow>0: - turnflows.add_flow(self.t_start, self.t_end, self.id_mode, id_fromedge, flow) - - - if len(cols)>=4: - for i in range(2,len(cols),2): + # print ' id_fromedge,flow',id_fromedge,flow + if flow > 0: + turnflows.add_flow( + self.t_start, self.t_end, self.id_mode, id_fromedge, flow) + + if len(cols) >= 4: + for i in range(2, len(cols), 2): id_toedge_sumo = cols[i].strip() if not ids_edge_sumo.has_index(id_toedge_sumo): - ids_sumoedge_notexist.append(id_toedge_sumo) + ids_sumoedge_notexist.append( + id_toedge_sumo) else: - id_toedge = ids_edge_sumo.get_id_from_index(id_toedge_sumo) + id_toedge = ids_edge_sumo.get_id_from_index( + id_toedge_sumo) if not (id_toedge in edges.get_outgoing(id_fromedge)): - pairs_sumoedge_unconnected.append((id_fromedge_sumo,id_toedge_sumo)) + pairs_sumoedge_unconnected.append( + (id_fromedge_sumo, id_toedge_sumo)) else: - if cols[i+1].strip()!='': - turnflow = int(string.atof(cols[i+1].strip())) - turnflows.add_turn(self.t_start, self.t_end, self.id_mode,id_fromedge, id_toedge, turnflow) - - - + if cols[i + 1].strip() != '': + turnflow = int( + string.atof(cols[i + 1].strip())) + turnflows.add_turn( + self.t_start, self.t_end, self.id_mode, id_fromedge, id_toedge, turnflow) + else: - print 'WARNING: inconsistent row in line %d, file %s'%(i_line,self.tffilepath) - i_line +=1 + print 'WARNING: inconsistent row in line %d, file %s' % (i_line, self.tffilepath) + i_line += 1 f.close() - if len(ids_sumoedge_notexist)>0: - print 'WARNING: inexistant edge IDs:',ids_sumoedge_notexist - if len(pairs_sumoedge_unconnected)>0: - print 'WARNING: unconnected edge pairs:',pairs_sumoedge_unconnected - return ids_sumoedge_notexist,pairs_sumoedge_unconnected - - - - #def get_net(self): - # return self._net \ No newline at end of file + if len(ids_sumoedge_notexist) > 0: + print 'WARNING: inexistant edge IDs:', ids_sumoedge_notexist + if len(pairs_sumoedge_unconnected) > 0: + print 'WARNING: unconnected edge pairs:', pairs_sumoedge_unconnected + return ids_sumoedge_notexist, pairs_sumoedge_unconnected + + # def get_net(self): + # return self._net diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/turnflows_wxgui.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/turnflows_wxgui.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/turnflows_wxgui.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/turnflows_wxgui.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,50 +6,49 @@ from agilepy.lib_wx.objpanel import ObjPanel from coremodules.network.network import SumoIdsConf, MODES -#def make_menu(menubar): +# def make_menu(menubar): class TurnflowImporter(cm.BaseObjman): + """Contains information and methods to import. """ - + def __init__(self, turnflowintervals): - #print 'AddOdWizzard',odintervals#,odintervals.times_start - #print ' ',dir(odintervals) + # print 'AddOdWizzard',odintervals#,odintervals.times_start + # print ' ',dir(odintervals) edges = turnflowintervals.get_edges() - self._init_objman( 'turnflowimporter', parent =turnflowintervals, - name = 'Turnflow Wizzard', - info = 'Wizzard to add origin zone to destination zone demand informations.', - ) + self._init_objman('turnflowimporter', parent=turnflowintervals, + name='Turnflow Wizzard', + info='Wizzard to add origin zone to destination zone demand informations.', + ) attrsman = self.set_attrsman(cm.Attrsman(self)) - - attrsman.add(am.AttrConf( 't_start', 0, - groupnames = ['state'], - perm='rw', - name = 'Start time', - unit = 's', - info = 'Start time of interval', - )) - + + attrsman.add(am.AttrConf('t_start', 0, + groupnames=['state'], + perm='rw', + name='Start time', + unit='s', + info='Start time of interval', + )) + attrsman.add(am.AttrConf('t_end', 3600, - groupnames = ['state'], - perm='rw', - name = 'End time', - unit = 's', - info = 'End time of interval', - )) - + groupnames=['state'], + perm='rw', + name='End time', + unit='s', + info='End time of interval', + )) + # here we ged classes not vehicle type - # specific vehicle type within a class will be generated later - attrsman.add(am.AttrConf('id_mode', MODES['private'], - groupnames = ['state'], - choices = MODES, - name = 'ID mode', - info = 'ID of transport mode.', - )) + # specific vehicle type within a class will be generated later + attrsman.add(am.AttrConf('id_mode', MODES['private'], + groupnames=['state'], + choices=MODES, + name='ID mode', + info='ID of transport mode.', + )) - - def add_demand(self): """ Add demand to scenario. @@ -57,18 +56,13 @@ print 'AddOdm.add_demand' odintervals = self.parent #demand = self._scenario.demand - #odm={} # create a temporary dict with (o,d) as key and trips as value + # odm={} # create a temporary dict with (o,d) as key and trips as value ids = self.get_ids() - self.parent.add_od_trips( self.t_start.value, self.t_end.value, - self.id_mode.value, self.scale.value, - self.names_orig[ids],self.names_dest[ids],self.tripnumbers[ids] - ) - - - - - - + self.parent.add_od_trips(self.t_start.value, self.t_end.value, + self.id_mode.value, self.scale.value, + self.names_orig[ids], self.names_dest[ + ids], self.tripnumbers[ids] + ) class AddTurnflowDialog(wx.Frame): @@ -78,35 +72,37 @@ """ - - def __init__(self,parent, odintervals): - wx.Frame.__init__(self,parent, -1,title='Add OD Wizzard',pos=wx.DefaultPosition, size=wx.DefaultSize) + def __init__(self, parent, odintervals): + wx.Frame.__init__(self, parent, -1, title='Add OD Wizzard', + pos=wx.DefaultPosition, size=wx.DefaultSize) self.wizzard = AddOdWizzard(odintervals) self.parent = parent - ## Set up the MenuBar + # Set up the MenuBar MenuBar = wx.MenuBar() file_menu = wx.Menu() - item = file_menu.Append(-1, "&Import CSV...","Import OD data from a CSV text file with format , ,") + item = file_menu.Append(-1, "&Import CSV...", + "Import OD data from a CSV text file with format , ,") self.Bind(wx.EVT_MENU, self.on_import_csv, item) #item = file_menu.Append(-1, "&Import Exel...","Import OD data from an Exel file.") #self.Bind(wx.EVT_MENU, self.on_import_exel, item) - - item = file_menu.Append(-1, "&Add and Close","Add demand to scenario and close wizzard") + + item = file_menu.Append(-1, "&Add and Close", + "Add demand to scenario and close wizzard") self.Bind(wx.EVT_MENU, self.on_add, item) - - item = file_menu.Append(-1, "&Close","Close wizzard") + + item = file_menu.Append(-1, "&Close", "Close wizzard") self.Bind(wx.EVT_MENU, self.on_close, item) MenuBar.Append(file_menu, "&File") - + if odintervals.get_net().parent != None: self.dirpath = odintervals.get_net().parent.workdirpath else: self.dirpath = os.getcwd() #help_menu = wx.Menu() - #item = help_menu.Append(-1, "&About", + # item = help_menu.Append(-1, "&About", # "More information About this program") #self.Bind(wx.EVT_MENU, self.on_menu, item) #MenuBar.Append(help_menu, "&Help") @@ -115,76 +111,73 @@ self.CreateStatusBar() - - - self.browser = self.make_browser() - - ##Create a sizer to manage the Canvas and message window + + # Create a sizer to manage the Canvas and message window MainSizer = wx.BoxSizer(wx.VERTICAL) MainSizer.Add(self.browser, 4, wx.EXPAND) - self.SetSizer(MainSizer) self.Bind(wx.EVT_CLOSE, self.on_close) self.EventsAreBound = False - ## getting all the colors for random objects - #wxlib.colourdb.updateColourDB() + # getting all the colors for random objects + # wxlib.colourdb.updateColourDB() #self.colors = wxlib.colourdb.getColourList() - return None - + def make_browser(self): # Create Browser widget here - buttons=[('Add ODM', self.on_add, 'Add ODM data to current scenario.'), - ('Cancel', self.on_close, 'Close wizzard without adding ODM.'), - #('OK', self.on_add_close, 'Add ODM data to current scenario and close wizzard.'), - ] - defaultbuttontext='Add ODM' - #standartbuttons=['cancel','apply','ok']# apply does not show - standartbuttons=['apply'] - + buttons = [('Add ODM', self.on_add, 'Add ODM data to current scenario.'), + ('Cancel', self.on_close, + 'Close wizzard without adding ODM.'), + #('OK', self.on_add_close, 'Add ODM data to current scenario and close wizzard.'), + ] + defaultbuttontext = 'Add ODM' + # standartbuttons=['cancel','apply','ok']# apply does not show + standartbuttons = ['apply'] + browser = ObjPanel(self, self.wizzard, - attrconfigs=None, - id=None, ids=None, - groupnames = None, - func_change_obj=None, - show_groupnames=False, show_title=False, - is_modal=True, - mainframe=None, - pos=wx.DefaultPosition, - size=wx.DefaultSize, - style = wx.MAXIMIZE_BOX|wx.RESIZE_BORDER, - immediate_apply=False,#True, - panelstyle='default', - buttons = buttons, - standartbuttons = standartbuttons, - defaultbutton = defaultbuttontext, - ) + attrconfigs=None, + id=None, ids=None, + groupnames=None, + func_change_obj=None, + show_groupnames=False, show_title=False, + is_modal=True, + mainframe=None, + pos=wx.DefaultPosition, + size=wx.DefaultSize, + style=wx.MAXIMIZE_BOX | wx.RESIZE_BORDER, + immediate_apply=False, # True, + panelstyle='default', + buttons=buttons, + standartbuttons=standartbuttons, + defaultbutton=defaultbuttontext, + ) return browser - + def on_import_csv(self, event=None): - #print 'on_import_csv' - wizzard = self.browser.obj - - wildcards_all = "All files (*.*)|*.*|CSV files (*.csv)|*.csv"#+"|"+otherwildcards + # print 'on_import_csv' + wizzard = self.browser.obj + + # +"|"+otherwildcards + wildcards_all = "All files (*.*)|*.*|CSV files (*.csv)|*.csv" dlg = wx.FileDialog(self.parent, message="Import CSV file", - defaultDir = self.dirpath, + defaultDir=self.dirpath, defaultFile="", - wildcard = wildcards_all, + wildcard=wildcards_all, style=wx.OPEN | wx.MULTIPLE | wx.CHANGE_DIR ) - - # Show the dialog and retrieve the user response. If it is the OK response, + + # Show the dialog and retrieve the user response. If it is the OK response, # process the data. if dlg.ShowModal() == wx.ID_OK: # This returns a Python list of files that were selected. paths = dlg.GetPaths() - #print 'You selected %d files:' % len(paths) - if len(paths)>0: + # print 'You selected %d files:' % len(paths) + if len(paths) > 0: filepath = paths[0] else: filepath = '' @@ -194,52 +187,49 @@ ### wizzard.import_csv(filepath) ## - + self.refresh_browser() event.Skip() self.Raise() - #self.SetFocus() - #self.MakeModal(False) - #self.MakeModal(True) - #self.browser.restore() - - def on_add(self,event = None ): - #print 'on_add,AddOdm',self.browser.obj - self.browser.apply()# important to transfer widget values to obj! - wizzard = self.browser.obj + # self.SetFocus() + # self.MakeModal(False) + # self.MakeModal(True) + # self.browser.restore() + + def on_add(self, event=None): + # print 'on_add,AddOdm',self.browser.obj + self.browser.apply() # important to transfer widget values to obj! + wizzard = self.browser.obj wizzard.add_demand() - + self.on_close(event) - + def on_close(self, event=None): self.MakeModal(False) self.Destroy() pass - - def on_add_close(self,event = None ): + + def on_add_close(self, event=None): self.on_add() self.on_close() - - - + def refresh_browser(self): """ Deletes previous conents Builds panel for obj Updates path window and history """ - #print 'Wizzard.refresh_panel with',obj.ident + # print 'Wizzard.refresh_panel with',obj.ident # remove previous obj panel - sizer=self.GetSizer() + sizer = self.GetSizer() sizer.Remove(0) self.browser.Destroy() #del self.browser self.browser = self.make_browser() - - sizer.Add(self.browser,1,wx.GROW) - + + sizer.Add(self.browser, 1, wx.GROW) + self.Refresh() - #sizer.Fit(self) + # sizer.Fit(self) sizer.Layout() # add to history - \ No newline at end of file diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/vehicles.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/vehicles.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/vehicles.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/vehicles.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,6 +1,8 @@ -import os, sys, string +import os +import sys +import string from collections import OrderedDict -import numpy as np +import numpy as np import agilepy.lib_base.classman as cm import agilepy.lib_base.arrayman as am import agilepy.lib_base.xmlman as xm @@ -8,823 +10,813 @@ from coremodules.network.network import SumoIdsConf, MODES -LANECHANGEMODELS = ['LC2013','JE2013','DK2008','SL2015'] +LANECHANGEMODELS = ['LC2013', 'JE2013', 'DK2008', 'SL2015'] # http://sumo.dlr.de/wiki/Models/Emissions/HBEFA3-based EMISSIONCLASSES = { - 'HBEFA3/Bus':'average urban bus (all fuel types)', - 'HBEFA3/Coach':'average long distance bus (all fuel types)', - 'HBEFA3/HDV':'average heavy duty vehicle (all fuel types)', - 'HBEFA3/HDV_G':'average gasoline driven heavy duty vehicle', - 'HBEFA3/HDV_D_EU0':'diesel driven heavy duty vehicle Euro norm 0', - 'HBEFA3/HDV_D_EU1':'diesel driven heavy duty vehicle Euro norm 1', - 'HBEFA3/HDV_D_EU2':'diesel driven heavy duty vehicle Euro norm 2', - 'HBEFA3/HDV_D_EU3':'diesel driven heavy duty vehicle Euro norm 3', - 'HBEFA3/HDV_D_EU4':'diesel driven heavy duty vehicle Euro norm 4', - 'HBEFA3/HDV_D_EU5':'diesel driven heavy duty vehicle Euro norm 5', - 'HBEFA3/HDV_D_EU6':'diesel driven heavy duty vehicle Euro norm 6', - 'HBEFA3/HDV_D_East':'Eastern norm heavy duty', - 'HBEFA3/zero':'zero emission vehicle', - 'HBEFA3/LDV':'average light duty vehicles (all fuel types)', - 'HBEFA3/LDV_G_EU0':'gasoline driven light duty vehicle Euro norm 0', - 'HBEFA3/LDV_G_EU1':'gasoline driven light duty vehicle Euro norm 1', - 'HBEFA3/LDV_G_EU2':'gasoline driven light duty vehicle Euro norm 2', - 'HBEFA3/LDV_G_EU3':'gasoline driven light duty vehicle Euro norm 3', - 'HBEFA3/LDV_G_EU4':'gasoline driven light duty vehicle Euro norm 4', - 'HBEFA3/LDV_G_EU5':'gasoline driven light duty vehicle Euro norm 5', - 'HBEFA3/LDV_G_EU6':'gasoline driven light duty vehicle Euro norm 6', - 'HBEFA3/LDV_G_East':'Eastern norm light duty gasoline', - 'HBEFA3/LDV_D_EU0':'diesel driven light duty vehicle Euro norm 0', - 'HBEFA3/LDV_D_EU1':'diesel driven light duty vehicle Euro norm 1', - 'HBEFA3/LDV_D_EU2':'diesel driven light duty vehicle Euro norm 2', - 'HBEFA3/LDV_D_EU3':'diesel driven light duty vehicle Euro norm 3', - 'HBEFA3/LDV_D_EU4':'diesel driven light duty vehicle Euro norm 4', - 'HBEFA3/LDV_D_EU5':' diesel driven light duty vehicle Euro norm 5', - 'HBEFA3/LDV_D_EU6':'diesel driven light duty vehicle Euro norm 6', - 'HBEFA3/PC':'average passenger car (all fuel types)', - 'HBEFA3/PC_Alternative':'passenger car with alternative fuel technology', - 'HBEFA3/PC_G_EU0':'gasoline driven passenger car Euro norm 0', - 'HBEFA3/PC_G_EU1':'gasoline driven passenger car Euro norm 1', - 'HBEFA3/PC_G_EU2':'gasoline driven passenger car Euro norm 2', - 'HBEFA3/PC_G_EU3':'gasoline driven passenger car Euro norm 3', - 'HBEFA3/PC_G_EU4':'gasoline driven passenger car Euro norm 4', - 'HBEFA3/PC_G_EU5':'gasoline driven passenger car Euro norm 5', - 'HBEFA3/PC_G_EU6':'gasoline driven passenger car Euro norm 6', - 'HBEFA3/PC_G_East':'Eastern norm gasoline passenger car', - 'HBEFA3/PC_D_EU0':'diesel driven passenger car Euro norm 0', - 'HBEFA3/PC_D_EU1':'diesel driven passenger car Euro norm 1', - 'HBEFA3/PC_D_EU2':'diesel driven passenger car Euro norm 2', - 'HBEFA3/PC_D_EU3':'diesel driven passenger car Euro norm 3', - 'HBEFA3/PC_D_EU4':'diesel driven passenger car Euro norm 4', - 'HBEFA3/PC_D_EU5':'diesel driven passenger car Euro norm 5', - 'HBEFA3/PC_D_EU6':'diesel driven passenger car Euro norm 6 ', - } - -GUISHAPES = [ "pedestrian", - "bicycle", - "motorcycle", - "passenger", - "passenger/sedan", - "passenger/hatchback", - "passenger/wagon", - "passenger/van", - "delivery", - "transport", - "transport/semitrailer", - "transport/trailer", - "bus", - "bus/city", - "bus/flexible", - "bus/overland", - "rail", - "rail/light" - "rail/railcar", - "rail/city", - "rail/slow", - "rail/fast", - "rail/cargo", - "evehicle", - ] - -ALIGNMMENTS_LAT = ['center','left', 'right', 'compact', 'nice', 'arbitrary'] - + 'HBEFA3/Bus': 'average urban bus (all fuel types)', + 'HBEFA3/Coach': 'average long distance bus (all fuel types)', + 'HBEFA3/HDV': 'average heavy duty vehicle (all fuel types)', + 'HBEFA3/HDV_G': 'average gasoline driven heavy duty vehicle', + 'HBEFA3/HDV_D_EU0': 'diesel driven heavy duty vehicle Euro norm 0', + 'HBEFA3/HDV_D_EU1': 'diesel driven heavy duty vehicle Euro norm 1', + 'HBEFA3/HDV_D_EU2': 'diesel driven heavy duty vehicle Euro norm 2', + 'HBEFA3/HDV_D_EU3': 'diesel driven heavy duty vehicle Euro norm 3', + 'HBEFA3/HDV_D_EU4': 'diesel driven heavy duty vehicle Euro norm 4', + 'HBEFA3/HDV_D_EU5': 'diesel driven heavy duty vehicle Euro norm 5', + 'HBEFA3/HDV_D_EU6': 'diesel driven heavy duty vehicle Euro norm 6', + 'HBEFA3/HDV_D_East': 'Eastern norm heavy duty', + 'HBEFA3/zero': 'zero emission vehicle', + 'HBEFA3/LDV': 'average light duty vehicles (all fuel types)', + 'HBEFA3/LDV_G_EU0': 'gasoline driven light duty vehicle Euro norm 0', + 'HBEFA3/LDV_G_EU1': 'gasoline driven light duty vehicle Euro norm 1', + 'HBEFA3/LDV_G_EU2': 'gasoline driven light duty vehicle Euro norm 2', + 'HBEFA3/LDV_G_EU3': 'gasoline driven light duty vehicle Euro norm 3', + 'HBEFA3/LDV_G_EU4': 'gasoline driven light duty vehicle Euro norm 4', + 'HBEFA3/LDV_G_EU5': 'gasoline driven light duty vehicle Euro norm 5', + 'HBEFA3/LDV_G_EU6': 'gasoline driven light duty vehicle Euro norm 6', + 'HBEFA3/LDV_G_East': 'Eastern norm light duty gasoline', + 'HBEFA3/LDV_D_EU0': 'diesel driven light duty vehicle Euro norm 0', + 'HBEFA3/LDV_D_EU1': 'diesel driven light duty vehicle Euro norm 1', + 'HBEFA3/LDV_D_EU2': 'diesel driven light duty vehicle Euro norm 2', + 'HBEFA3/LDV_D_EU3': 'diesel driven light duty vehicle Euro norm 3', + 'HBEFA3/LDV_D_EU4': 'diesel driven light duty vehicle Euro norm 4', + 'HBEFA3/LDV_D_EU5': ' diesel driven light duty vehicle Euro norm 5', + 'HBEFA3/LDV_D_EU6': 'diesel driven light duty vehicle Euro norm 6', + 'HBEFA3/PC': 'average passenger car (all fuel types)', + 'HBEFA3/PC_Alternative': 'passenger car with alternative fuel technology', + 'HBEFA3/PC_G_EU0': 'gasoline driven passenger car Euro norm 0', + 'HBEFA3/PC_G_EU1': 'gasoline driven passenger car Euro norm 1', + 'HBEFA3/PC_G_EU2': 'gasoline driven passenger car Euro norm 2', + 'HBEFA3/PC_G_EU3': 'gasoline driven passenger car Euro norm 3', + 'HBEFA3/PC_G_EU4': 'gasoline driven passenger car Euro norm 4', + 'HBEFA3/PC_G_EU5': 'gasoline driven passenger car Euro norm 5', + 'HBEFA3/PC_G_EU6': 'gasoline driven passenger car Euro norm 6', + 'HBEFA3/PC_G_East': 'Eastern norm gasoline passenger car', + 'HBEFA3/PC_D_EU0': 'diesel driven passenger car Euro norm 0', + 'HBEFA3/PC_D_EU1': 'diesel driven passenger car Euro norm 1', + 'HBEFA3/PC_D_EU2': 'diesel driven passenger car Euro norm 2', + 'HBEFA3/PC_D_EU3': 'diesel driven passenger car Euro norm 3', + 'HBEFA3/PC_D_EU4': 'diesel driven passenger car Euro norm 4', + 'HBEFA3/PC_D_EU5': 'diesel driven passenger car Euro norm 5', + 'HBEFA3/PC_D_EU6': 'diesel driven passenger car Euro norm 6 ', +} + +GUISHAPES = ["pedestrian", + "bicycle", + "motorcycle", + "passenger", + "passenger/sedan", + "passenger/hatchback", + "passenger/wagon", + "passenger/van", + "delivery", + "transport", + "transport/semitrailer", + "transport/trailer", + "bus", + "bus/city", + "bus/flexible", + "bus/overland", + "rail", + "rail/light" + "rail/railcar", + "rail/city", + "rail/slow", + "rail/fast", + "rail/cargo", + "evehicle", + ] + +ALIGNMMENTS_LAT = ['center', 'left', 'right', 'compact', 'nice', 'arbitrary'] + + class VehicleTypes(am.ArrayObjman): + def __init__(self, parent, net, is_add_default=True, **kwargs): - - self._init_objman( ident='vtypes', - parent=parent, - name = 'Vehicle Types', - info = 'Table of all available vehicle types, each with specific physical characteristics. Each vehicle can be used multiple times in the simulation', - xmltag = ('vTypes','vType','ids_sumo'), - version = 0.1, - **kwargs) + + self._init_objman(ident='vtypes', + parent=parent, + name='Vehicle Types', + info='Table of all available vehicle types, each with specific physical characteristics. Each vehicle can be used multiple times in the simulation', + xmltag=('vTypes', 'vType', 'ids_sumo'), + version=0.1, + **kwargs) self._init_attributes() if is_add_default: self.add_vtypes_default() - + def _init_attributes(self): net = self.parent.get_net() - - # lanechange model is now centralized: all vehicle types have the same + + # lanechange model is now centralized: all vehicle types have the same # lanechange model. if self.get_version() < 0.1: - self.delete('lanechangemodels') + self.delete('lanechangemodels') self.delete('alignments_lat') self.delete('speeds_max_lat') self.delete('gaps_min_lat') - - - - - self.add(cm.AttrConf( 'lanechangemodel', LANECHANGEMODELS[0], - groupnames = ['parameters'], - choices = LANECHANGEMODELS, - name = 'Lanechange model', - info = "Lanechange model. The choice of the lanechange model will also determine the choice of lanechange parameters. With model SL2015, sublanes will be simulated.", - #xmltag = 'laneChangeModel', - )) - - - - - self.add_col(SumoIdsConf('vtype', name ='Type name', perm = 'rw')) - - - - self.add_col(am.ArrayConf( 'lengths', 5.0, - groupnames = ['parameters'], - name = 'Length', - unit = 'm', - info = "The vehicle's netto-length", - xmltag = 'length', - )) - - self.add_col(am.ArrayConf( 'widths', 2.0, - groupnames = ['parameters'], - name = 'Width', - unit = 'm', - info = "The vehicle's width.", - xmltag = 'width', - )) - - self.add_col(am.ArrayConf( 'heights', 1.5, - groupnames = ['parameters'], - name = 'Height', - unit = 'm', - info = "The vehicle's height.", - xmltag = 'height', - )) - - self.add_col(am.ArrayConf( 'numbers_persons_initial', 1, - groupnames = ['parameters'], - name = 'Passengers', - info = "Initial number of persons in the vehicle.", - xmltag = 'personNumber', - )) - - self.add_col(am.ArrayConf( 'capacities_persons', 1, - groupnames = ['parameters'], - name = 'Capacity', - info = "Maximum number of persons that fit in a vehicle.", - xmltag = 'personCapacity', - )) - - self.add_col(am.ArrayConf( 'numbers_container', 0, - groupnames = ['parameters'], - name = 'Containers', - info = "Initial number of containers on the vehicle.", - xmltag = 'containerNumber', - )) - - self.add_col(am.ArrayConf( 'speeds_max', 70.0, - groupnames = ['parameters'], - name = 'Max. speed', - unit = 'm/s', - info = "The vehicle's maximum velocity", - xmltag = 'maxSpeed', - )) - - self.add_col(am.ArrayConf( 'accels', 0.8, - groupnames = ['parameters'], - name = 'Max. accel.', - unit = 'm/s^2', - info = 'The acceleration ability of vehicles of this type', - xmltag = 'accel', - )) - - self.add_col(am.ArrayConf( 'decels', 4.5, - groupnames = ['parameters'], - name = 'Max. decel.', - unit = 'm/s^2', - info = 'The acceleration ability of vehicles of this type', - xmltag = 'decel', - )) - - - self.add_col(am.ArrayConf( 'taus', 1.0, - groupnames = ['parameters'], - name = 'Reaction', - unit = 's', - info = "The driver's reaction time in s (actually the minimum time gap)", - xmltag = 'tau', - )) - - self.add_col(am.ArrayConf( 'sigmas', 0.5, - groupnames = ['parameters'], - name = 'Driver', - info = 'The driver imperfection (between 0 and 1). Used only in follower models SUMOKrauss, SKOrig', - xmltag = 'sigma', - )) - - - - - self.add_col(am.ArrayConf( 'dists_min', 2.5, - groupnames = ['parameters'], - name = 'Min. gap', - unit = 'm', - info = "Minimum empty space after leader.", - xmltag = 'minGap', - )) - - - self.add_col(am.ArrayConf( 'times_boarding', 0.5, - groupnames = ['parameters'], - name = 'boarding time', - unit = 's', - info = "The time required by a person to board the vehicle.", - xmltag = 'boardingDuration', - )) - - self.add_col(am.ArrayConf( 'times_loading', 90.0, - groupnames = ['parameters'], - name = 'loading time', - unit = 's', - info = "The time required by a person to board the vehicle.", - xmltag = 'loadingDuration', - )) - - self.add_col(am.IdsArrayConf( 'ids_mode', net.modes, - groupnames = ['state'], - choices = MODES, - name = 'Mode', - info = 'ID of transport mode.', - xmltag = 'vClass', - )) - + + self.add(cm.AttrConf('lanechangemodel', LANECHANGEMODELS[0], + groupnames=['parameters'], + choices=LANECHANGEMODELS, + name='Lanechange model', + info="Lanechange model. The choice of the lanechange model will also determine the choice of lanechange parameters. With model SL2015, sublanes will be simulated.", + #xmltag = 'laneChangeModel', + )) + + self.add_col(SumoIdsConf('vtype', name='Type name', perm='rw')) + + self.add_col(am.ArrayConf('lengths', 5.0, + groupnames=['parameters'], + name='Length', + unit='m', + info="The vehicle's netto-length", + xmltag='length', + )) + + self.add_col(am.ArrayConf('widths', 2.0, + groupnames=['parameters'], + name='Width', + unit='m', + info="The vehicle's width.", + xmltag='width', + )) + + self.add_col(am.ArrayConf('heights', 1.5, + groupnames=['parameters'], + name='Height', + unit='m', + info="The vehicle's height.", + xmltag='height', + )) + + self.add_col(am.ArrayConf('numbers_persons_initial', 1, + groupnames=['parameters'], + name='Passengers', + info="Initial number of persons in the vehicle.", + xmltag='personNumber', + )) + + self.add_col(am.ArrayConf('capacities_persons', 1, + groupnames=['parameters'], + name='Capacity', + info="Maximum number of persons that fit in a vehicle.", + xmltag='personCapacity', + )) + + self.add_col(am.ArrayConf('numbers_container', 0, + groupnames=['parameters'], + name='Containers', + info="Initial number of containers on the vehicle.", + xmltag='containerNumber', + )) + + self.add_col(am.ArrayConf('speeds_max', 70.0, + groupnames=['parameters'], + name='Max. speed', + unit='m/s', + info="The vehicle's maximum velocity", + xmltag='maxSpeed', + )) + + self.add_col(am.ArrayConf('accels', 0.8, + groupnames=['parameters'], + name='Max. accel.', + unit='m/s^2', + info='The acceleration ability of vehicles of this type', + xmltag='accel', + )) + + self.add_col(am.ArrayConf('decels', 4.5, + groupnames=['parameters'], + name='Max. decel.', + unit='m/s^2', + info='The acceleration ability of vehicles of this type', + xmltag='decel', + )) + + self.add_col(am.ArrayConf('taus', 1.0, + groupnames=['parameters'], + name='Reaction', + unit='s', + info="The driver's reaction time in s (actually the minimum time gap)", + xmltag='tau', + )) + + self.add_col(am.ArrayConf('sigmas', 0.5, + groupnames=['parameters'], + name='Driver', + info='The driver imperfection (between 0 and 1). Used only in follower models SUMOKrauss, SKOrig', + xmltag='sigma', + )) + + self.add_col(am.ArrayConf('dists_min', 2.5, + groupnames=['parameters'], + name='Min. gap', + unit='m', + info="Minimum empty space after leader.", + xmltag='minGap', + )) + + self.add_col(am.ArrayConf('times_boarding', 0.5, + groupnames=['parameters'], + name='boarding time', + unit='s', + info="The time required by a person to board the vehicle.", + xmltag='boardingDuration', + )) + + self.add_col(am.ArrayConf('times_loading', 90.0, + groupnames=['parameters'], + name='loading time', + unit='s', + info="The time required by a person to board the vehicle.", + xmltag='loadingDuration', + )) + + self.add_col(am.IdsArrayConf('ids_mode', net.modes, + groupnames=['state'], + choices=MODES, + name='Mode', + info='ID of transport mode.', + xmltag='vClass', + )) + emissionclasses_xml = {} for key in EMISSIONCLASSES.keys(): - emissionclasses_xml[key]=key# yes, map onto itself, otherwise choice values are taken - - self.add_col(am.ArrayConf( 'emissionclasses', 'HBEFA3/HDV_D_EU4', - dtype = 'object',# - groupnames = ['parameters'], - choices = get_inversemap(EMISSIONCLASSES), - name = 'Emission', - info = "HBEFA3 emission class, see sourceforge.net/apps/mediawiki/sumo/index.php?title=Simulation/Models/Emissions/HBEFA-based", - xmltag = 'emissionClass', - xmlmap = emissionclasses_xml, - )) - - self.add_col(am.ArrayConf( 'impatiences', -1000.0, - groupnames = ['parameters'], - name = 'Impatience', - info = "Impatience offset between -1000.0 and 1.0 (-100 or less equals off). Impatience grows at 1/teleport. If 1.0 is reached driver will disrigard priorities.", - xmltag = 'impatience', - )) - - - self.add_col(am.ArrayConf( 'shapes_gui', "passenger", - dtype = 'object',# - groupnames = ['parameters'], - name = 'GUI shape', - choices = GUISHAPES, - info = "How this vehicle is rendered.", - xmltag = 'guiShape', - )) - - self.add_col(am.ArrayConf( 'colors', np.array((1.0,1.0,1.0,1.0),np.float32), - metatype = 'color', - groupnames = ['parameters'], - name = 'Color', - info = "This vehicle type's color as RGBA tuple with values from 0 to 1.0", - xmltag = 'color', - )) - - - - self.add_col(am.ArrayConf( 'lanechange_strategies', 1.0, - groupnames = ['parameters'], - name = 'Lane strategy', - info = "Lanechange model strategy factor. The eagerness for performing strategic lane changing. Higher values result in earlier lane-changing. default: 1.0, range [0-inf]", - xmltag = 'lcStrategic', - )) - self.add_col(am.ArrayConf( 'lanechange_coops', 1.0, - groupnames = ['parameters'], - name = 'Lane coop', - info = "Lanechange model cooperative factor.The willingness for performing cooperative lane changing. Lower values result in reduced cooperation. default: 1.0, range [0-1]", - xmltag = 'lcCooperative', - )) - - self.add_col(am.ArrayConf( 'lanechange_gains', 1.0, - groupnames = ['parameters'], - name = 'Lane gain', - info = "Lanechange model gain factor.The eagerness for performing lane changing to gain speed. Higher values result in more lane-changing. default: 1.0, range [0-inf]", - xmltag = 'lcSpeedGain', - )) - - self.add_col(am.ArrayConf( 'lanechange_rightkeepings', 1.0, - groupnames = ['parameters'], - name = 'Lane right', - info = "Lanechange model keep right factor.The eagerness for following the obligation to keep right. Higher values result in earlier lane-changing. default: 1.0, range [0-inf]", - xmltag = 'lcKeepRight', - )) - - - self.add_col(am.ArrayConf( 'sublane_alignments_lat', ALIGNMMENTS_LAT[0], - dtype = 'object',# - groupnames = ['parameters'], - choices = ALIGNMMENTS_LAT, - name = 'sublane alignment', - info = 'Lateral alignment within a lane. For sublane model only.', - xmltag = 'latAlignment', - )) - - self.add_col(am.ArrayConf( 'sublane_speeds_max_lat', 1.0, - groupnames = ['parameters'], - name = 'Sublane max. speed', - unit = 'm/s', - info = "The vehicle's maximum velocity in lateral direction. For sublane model only.", - xmltag = 'maxSpeedLat', - )) - - self.add_col(am.ArrayConf( 'sublane_gaps_min_lat', 0.12, - groupnames = ['parameters'], - name = 'Sublane min. gap', - unit = 'm', - info = "The vehicle's minimum distance to other vehicles in lateral direction. For sublane model only.", - xmltag = 'minGapLat', - )) - - self.add_col(am.ArrayConf( 'sublane_alignments_eager', 1.0, - groupnames = ['parameters'], - name = 'Sublane eager', - info = "The eagerness using the configured lateral alignment within the lane. Higher values result in increased willingness to sacrifice speed for alignment. default: 1.0, range [0-inf]. For sublane model only.", - xmltag = 'lcSublane', - )) - - self.add_col(am.ArrayConf( 'sublane_pushyfactors', 0.0, - groupnames = ['parameters'], - name = 'Sublane pushy', - info = "Willingness to encroach laterally on other drivers. default: 0.0, range 0 or 1. For sublane model only.", - xmltag = 'lcPushy', - )) - - + # yes, map onto itself, otherwise choice values are taken + emissionclasses_xml[key] = key + + self.add_col(am.ArrayConf('emissionclasses', 'HBEFA3/HDV_D_EU4', + dtype='object', + groupnames=['parameters'], + choices=get_inversemap(EMISSIONCLASSES), + name='Emission', + info="HBEFA3 emission class, see sourceforge.net/apps/mediawiki/sumo/index.php?title=Simulation/Models/Emissions/HBEFA-based", + xmltag='emissionClass', + xmlmap=emissionclasses_xml, + )) + + self.add_col(am.ArrayConf('impatiences', -1000.0, + groupnames=['parameters'], + name='Impatience', + info="Impatience offset between -1000.0 and 1.0 (-100 or less equals off). Impatience grows at 1/teleport. If 1.0 is reached driver will disrigard priorities.", + xmltag='impatience', + )) + + self.add_col(am.ArrayConf('shapes_gui', "passenger", + dtype='object', + groupnames=['parameters'], + name='GUI shape', + choices=GUISHAPES, + info="How this vehicle is rendered.", + xmltag='guiShape', + )) + + self.add_col(am.ArrayConf('colors', np.array((1.0, 1.0, 1.0, 1.0), np.float32), + metatype='color', + groupnames=['parameters'], + name='Color', + info="This vehicle type's color as RGBA tuple with values from 0 to 1.0", + xmltag='color', + )) + + self.add_col(am.ArrayConf('lanechange_strategies', 1.0, + groupnames=['parameters'], + name='Lane strategy', + info="Lanechange model strategy factor. The eagerness for performing strategic lane changing. Higher values result in earlier lane-changing. default: 1.0, range [0-inf]", + xmltag='lcStrategic', + )) + self.add_col(am.ArrayConf('lanechange_coops', 1.0, + groupnames=['parameters'], + name='Lane coop', + info="Lanechange model cooperative factor.The willingness for performing cooperative lane changing. Lower values result in reduced cooperation. default: 1.0, range [0-1]", + xmltag='lcCooperative', + )) + + self.add_col(am.ArrayConf('lanechange_gains', 1.0, + groupnames=['parameters'], + name='Lane gain', + info="Lanechange model gain factor.The eagerness for performing lane changing to gain speed. Higher values result in more lane-changing. default: 1.0, range [0-inf]", + xmltag='lcSpeedGain', + )) + + self.add_col(am.ArrayConf('lanechange_rightkeepings', 1.0, + groupnames=['parameters'], + name='Lane right', + info="Lanechange model keep right factor.The eagerness for following the obligation to keep right. Higher values result in earlier lane-changing. default: 1.0, range [0-inf]", + xmltag='lcKeepRight', + )) + + self.add_col(am.ArrayConf('sublane_alignments_lat', ALIGNMMENTS_LAT[0], + dtype='object', + groupnames=['parameters'], + choices=ALIGNMMENTS_LAT, + name='sublane alignment', + info='Lateral alignment within a lane. For sublane model only.', + xmltag='latAlignment', + )) + + self.add_col(am.ArrayConf('sublane_speeds_max_lat', 1.0, + groupnames=['parameters'], + name='Sublane max. speed', + unit='m/s', + info="The vehicle's maximum velocity in lateral direction. For sublane model only.", + xmltag='maxSpeedLat', + )) + + self.add_col(am.ArrayConf('sublane_gaps_min_lat', 0.12, + groupnames=['parameters'], + name='Sublane min. gap', + unit='m', + info="The vehicle's minimum distance to other vehicles in lateral direction. For sublane model only.", + xmltag='minGapLat', + )) + + self.add_col(am.ArrayConf('sublane_alignments_eager', 1.0, + groupnames=['parameters'], + name='Sublane eager', + info="The eagerness using the configured lateral alignment within the lane. Higher values result in increased willingness to sacrifice speed for alignment. default: 1.0, range [0-inf]. For sublane model only.", + xmltag='lcSublane', + )) + + self.add_col(am.ArrayConf('sublane_pushyfactors', 0.0, + groupnames=['parameters'], + name='Sublane pushy', + info="Willingness to encroach laterally on other drivers. default: 0.0, range 0 or 1. For sublane model only.", + xmltag='lcPushy', + )) + def clear_vtypes(self): self.clear() - + def add_vtype(self, vtype, **kwargs): - #print 'add_vtype',vtype + # print 'add_vtype',vtype if kwargs.has_key('mode'): - id_mode = MODES.get(kwargs['mode'],1) + id_mode = MODES.get(kwargs['mode'], 1) del kwargs['mode'] else: id_mode = 1 - + #_id = self.add_row( ids_sumo = vtype, ids_mode = id_mode,**kwargs) - - _id = self.add_row( ids_sumo = vtype, - accels = kwargs.get("accel",2.9), - decels = kwargs.get("decel",7.5), - taus = kwargs.get("tau",None), - sigmas = kwargs.get("sigma",0.5), - lengths = kwargs.get("length",4.3), - widths = kwargs.get("width",1.8), - heights = kwargs.get("height",1.50), - dists_min = kwargs.get("dist_min",1.0), - speeds_max = kwargs.get("speed_max",180.0/3.6), - ids_mode = id_mode, # specifies mode for demand - colors = kwargs.get("color",np.array((185,85,255,255),np.float32)/255.0), - impatiences= kwargs.get("impatience",-1000), - shapes_gui = kwargs.get("shape_gui",'passenger'), - numbers_persons = kwargs.get("number_persons",None), - capacities_persons = kwargs.get("capacity_persons",None), - emissionclasses = kwargs.get("emissionclass",None), - lanechanges = kwargs.get("lanechange",None), - lanechange_strategies= kwargs.get("lanechange_strategy",None), - lanechange_coops= kwargs.get("lanechange_coop",None), - lanechange_gains= kwargs.get("lanechange_gain",None), - lanechange_rightkeepings= kwargs.get("lanechange_rightkeeping",None), - sublane_alignments_lat= kwargs.get("sublane_alignment_lat",None), - sublane_speeds_max_lat= kwargs.get("sublane_speed_max_lat",None), - sublane_gaps_min_lat= kwargs.get("sublane_gap_min_lat",None), - sublane_alignments_eager= kwargs.get("sublane_alignment_eager",None), - sublane_pushyfactors= kwargs.get("sublane_pushyfactor",None), - ) - - return _id - + + _id = self.add_row(ids_sumo=vtype, + accels=kwargs.get("accel", 2.9), + decels=kwargs.get("decel", 7.5), + taus=kwargs.get("tau", None), + sigmas=kwargs.get("sigma", 0.5), + lengths=kwargs.get("length", 4.3), + widths=kwargs.get("width", 1.8), + heights=kwargs.get("height", 1.50), + dists_min=kwargs.get("dist_min", 1.0), + speeds_max=kwargs.get("speed_max", 180.0 / 3.6), + ids_mode=id_mode, # specifies mode for demand + colors=kwargs.get("color", np.array( + (185, 85, 255, 255), np.float32) / 255.0), + impatiences=kwargs.get("impatience", -1000), + shapes_gui=kwargs.get("shape_gui", 'passenger'), + numbers_persons=kwargs.get("number_persons", None), + capacities_persons=kwargs.get( + "capacity_persons", None), + emissionclasses=kwargs.get("emissionclass", None), + lanechanges=kwargs.get("lanechange", None), + lanechange_strategies=kwargs.get( + "lanechange_strategy", None), + lanechange_coops=kwargs.get( + "lanechange_coop", None), + lanechange_gains=kwargs.get( + "lanechange_gain", None), + lanechange_rightkeepings=kwargs.get( + "lanechange_rightkeeping", None), + sublane_alignments_lat=kwargs.get( + "sublane_alignment_lat", None), + sublane_speeds_max_lat=kwargs.get( + "sublane_speed_max_lat", None), + sublane_gaps_min_lat=kwargs.get( + "sublane_gap_min_lat", None), + sublane_alignments_eager=kwargs.get( + "sublane_alignment_eager", None), + sublane_pushyfactors=kwargs.get( + "sublane_pushyfactor", None), + ) + + return _id + def add_vtypes_default(self): - #self.del_rows(self.get_ids()) - self.add_vtype('pedestrian', - accel = 1.5, - decel = 2.0, - sigma = 0.5, - length = 0.6, - width = 0.8, - height = 1.719, - number_persons = 1, - capacity_persons = 1, - dist_min = 0.5, - speed_max = 5.4/3.6, - mode = 'pedestrian', # specifies mode for demand - color = np.array((210,128,0,255),np.float32)/255.0, - shape_gui = 'pedestrian', - impatience = 1.0, - emissionclass= 'HBEFA3/zero', - times_boarding = 0.0, - times_loading = 0.0, - sublane_alignment_lat = 'nice', - sublane_speed_max_lat = 0.5, - sublane_gap_min_lat = 0.5, - sublane_alignment_eager= 0.5, - sublane_pushyfactor= 0.5, - ) - - self.add_vtype('passenger1', - accel = 2.9, - decel = 7.5, - sigma = 0.5, - length = 4.3, - height = 1.50, - width = 1.8, - number_persons = 1, - capacity_persons = 4, - dist_min = 1.0, - speed_max = 180.0/3.6, - mode = 'passenger', # specifies mode for demand - color = np.array((185,85,255,255),np.float32)/255.0, - shape_gui = 'passenger', - impatience = 1.0, - emissionclass= 'HBEFA3/PC', - times_boarding = 0.5, - times_loading = 90.0, - sublane_alignment_lat = 'center', - sublane_speed_max_lat = 1.0, - sublane_gap_min_lat = 0.12, - ) - - self.add_vtype('bicycle', - accel = 1.2, - decel = 3.0, - sigma = 0.7, - length = 1.6, - width = 0.9, - height = 1.7, - number_persons = 1, - capacity_persons = 1, - dist_min = 0.5, - speed_max = 18.0/3.6, - mode = 'bicycle', # specifies mode for demand - impatience = 1.0, - emissionclass= 'HBEFA3/zero', - color = np.array((94,203,57,255),np.float32)/255.0, - shape_gui = 'bicycle', - lanechange_strategy = 1.0, - lanechange_coop = 1.0, - lanechange_gain = 1.0, - lanechange_rightkeeping = 1.0, - times_boarding = 20.0, - times_loading = 0.0, - sublane_alignment_lat = 'right', - sublane_speed_max_lat = 0.8, - sublane_gap_min_lat = 0.12, - sublane_alignment_eager= 1.0, - sublane_pushyfactor= 0.0, - ) - - - self.add_vtype('vespa', - accel = 4.5, - decel = 7.5, - sigma = 0.7, - length = 1.5, - height = 1.7, - width = 0.95, - number_persons = 1, - capacity_persons = 1, - dist_min = 0.5, - speed_max = 60.0/3.6, - mode = 'moped', # specifies mode for demand - impatience = 1.0, - emissionclass= 'HBEFA3/LDV_G_EU3', - color = np.array((205,92,0,255),np.float32)/255.0, - shape_gui = 'motorcycle', - times_boarding = 20.0, - times_loading = 90.0, - sublane_alignment_lat = 'left', - sublane_speed_max_lat = 1.0, - sublane_gap_min_lat = 0.12, - sublane_alignment_eager= 0.9, - sublane_pushyfactor= 0.8, - ) - - self.add_vtype('motorcycle', - accel = 4.5, - decel = 7.5, - sigma = 0.7, - length = 1.5, - height = 1.7, - width = 0.95, - number_persons = 1, - capacity_persons = 1, - dist_min = 0.5, - speed_max = 180.0/3.6, - mode = 'motorcycle', # specifies mode for demand - impatience = 1.0, - emissionclass= 'HBEFA3/LDV_G_EU3', - color = np.array((205,92,0,255),np.float32)/255.0, - shape_gui = 'motorcycle', - times_boarding = 20.0, - times_loading = 90.0, - sublane_alignment_lat = 'left', - sublane_speed_max_lat = 1.0, - sublane_gap_min_lat = 0.12, - sublane_alignment_eager= 0.9, - sublane_pushyfactor= 0.8, - ) - - - - self.add_vtype('taxi1', - accel = 1.9, - decel = 3.5, - sigma = 0.5, - length = 5.0, - height = 1.80, - width = 1.8, - number_persons = 1, - capacity_persons = 4, - dist_min = 1.0, - speed_max = 180.0/3.6, - mode = 'taxi', # specifies mode for demand - color = np.array((185,185,255,255),np.float32)/255.0, - shape_gui = 'passenger/sedan', - impatience = 1.0, - emissionclass= 'HBEFA3/PC', - times_boarding = 30.0, - times_loading = 90.0, - sublane_alignment_lat = 'center', - sublane_speed_max_lat = 0.8, - sublane_gap_min_lat = 0.12, - ) - - self.add_vtype('bus', - accel = 1.2, - decel = 4.0, - sigma = 0.9, - length = 12.0, - height = 3.4, - width = 2.5, - number_persons = 20, - capacity_persons = 85, - dist_min = 0.5, - speed_max = 80.0/3.6, - mode = 'bus', # specifies mode for demand - impatience = 1.0, - emissionclass= 'HBEFA3/Bus', - color = np.array((255,192,0,255),np.float32)/255.0, - shape_gui = 'bus', - times_boarding = 2.0, - times_loading = 90.0, - sublane_alignment_lat = 'center', - sublane_speed_max_lat = 0.5, - sublane_gap_min_lat = 0.24, - sublane_alignment_eager = 10.0, - ) - - self.add_vtype('bus_flexible', - accel = 1.2, - decel = 4.0, - sigma = 0.9, - length = 17.9, - width = 2.5, - height = 3.0, - number_persons = 40, - capacity_persons = 140, - dist_min = 0.5, - speed_max = 80.0/3.6, - mode = 'bus', # specifies mode for demand - impatience = 1.0, - emissionclass= 'HBEFA3/Bus', - color = np.array((255,192,255,255),np.float32)/255.0, - shape_gui = 'bus/flexible', - times_boarding = 2.0, - times_loading = 90.0, - sublane_alignment_lat = 'center', - sublane_speed_max_lat = 0.5, - sublane_gap_min_lat = 0.24, - sublane_alignment_eager = 100.0, - ) - - - - self.add_vtype('tram1', - accel = 1.0, - decel = 3.0, - sigma = 0.9, - length = 22.0, - width = 2.4, - height = 3.2, - number_persons = 50, - capacity_persons = 120, - dist_min = 0.5, - speed_max = 80.0/3.6, - mode = 'tram', # specifies mode for demand - impatience = 1.0, - emissionclass= 'HBEFA3/zero', - color = np.array((255,192,255,255),np.float32)/255.0, - shape_gui = 'rail/railcar', - times_boarding = 1.5, - times_loading = 90.0, - sublane_alignment_lat = 'center', - sublane_speed_max_lat = 0.5, - sublane_gap_min_lat = 0.24, - sublane_alignment_eager = 1000000.0, - ) - - self.add_vtype('rail_urban1', - accel = 1.0, - decel = 3.0, - sigma = 0.9, - length = 36.0, - width = 3.0, - height = 3.6, - number_persons = 200, - capacity_persons = 300, - dist_min = 0.5, - speed_max = 100.0/3.6, - mode = 'rail_urban', # specifies mode for demand - emissionclass= 'HBEFA3/zero', - color = np.array((255,192,255,255),np.float32)/255.0, - shape_gui = 'rail/railcar', - times_boarding = 1.5, - times_loading = 90.0, - sublane_alignment_lat = 'center', - sublane_speed_max_lat = 0.5, - sublane_gap_min_lat = 0.24, - sublane_alignment_eager = 1000000.0, - ) - - self.add_vtype('van1', - accel = 1.9, - decel = 3.5, - sigma = 0.5, - length = 5.0, - height = 2.50, - width = 1.9, - number_persons = 1, - capacity_persons = 2, - dist_min = 1.0, - speed_max = 100.0/3.6, - mode = 'delivery', # specifies mode for demand - color = np.array((185,185,255,255),np.float32)/255.0, - shape_gui = 'passenger/van', - impatience = 1.0, - emissionclass= 'HBEFA3/LDV_D_EU3', - times_boarding = 5.0, - times_loading = 90.0, - sublane_alignment_lat = 'center', - sublane_speed_max_lat = 1.0, - sublane_gap_min_lat = 0.12, - ) - - self.add_vtype('truck', - accel = 1.5, - decel = 2.5, - sigma = 0.5, - length = 8.0, - height = 3.50, - width = 2.0, - number_persons = 1, - capacity_persons = 2, - dist_min = 1.0, - speed_max = 90.0/3.6, - mode = 'truck', # specifies mode for demand - color = np.array((185,185,255,255),np.float32)/255.0, - shape_gui = 'truck', - impatience = 1.0, - emissionclass= 'HBEFA3/HDV_D_EU2', - times_boarding = 5.0, - times_loading = 180.0, - sublane_alignment_lat = 'center', - sublane_speed_max_lat = 1.0, - sublane_gap_min_lat = 0.12, - ) - - self.add_vtype('truck_semitrailer', - accel = 1.0, - decel = 2.0, - sigma = 0.5, - length = 10.0, - height = 4.50, - width = 2.0, - number_persons = 1, - capacity_persons = 2, - dist_min = 1.0, - speed_max = 90.0/3.6, - mode = 'truck', # specifies mode for demand - color = np.array((185,185,255,255),np.float32)/255.0, - shape_gui = 'truck/semitrailer', - impatience = 1.0, - emissionclass= 'HBEFA3/HDV_D_EU2', - times_boarding = 5.0, - times_loading = 300.0, - sublane_alignment_lat = 'center', - sublane_speed_max_lat = 1.0, - sublane_gap_min_lat = 0.12, - ) - - self.add_vtype('truck_trailer', - accel = 1.0, - decel = 2.0, - sigma = 0.5, - length = 12.0, - height = 3.50, - width = 2.0, - number_persons = 1, - capacity_persons = 2, - dist_min = 1.0, - speed_max = 90.0/3.6, - mode = 'truck', # specifies mode for demand - color = np.array((185,185,255,255),np.float32)/255.0, - shape_gui = 'truck/trailer', - impatience = 1.0, - emissionclass= 'HBEFA3/HDV_D_EU2', - times_boarding = 5.0, - times_loading = 600.0, - sublane_alignment_lat = 'center', - sublane_speed_max_lat = 1.0, - sublane_gap_min_lat = 0.12, - ) - - self.add_vtype('evehicle1', - accel = 2.5, - decel = 2.5, - sigma = 1.0, - length = 3.5, - width = 1.6, - height = 1.7, - number_persons = 1, - capacity_persons = 4, - dist_min = 0.5, - speed_max = 10.0, - emissionclass= 'HBEFA3/zero', - mode = 'evehicle', # specifies mode for demand - color = np.array((255,240,0,255),np.float32)/255.0, - shape_gui = 'evehicle', - times_boarding = 1.5, - times_loading = 20.0, - sublane_alignment_lat = 'center', - sublane_speed_max_lat = 0.5, - sublane_gap_min_lat = 0.24, - sublane_alignment_eager = 1000000.0, - ) - - self.add_vtype('PRT', - accel = 2.5, - decel = 2.5, - sigma = 1.0, - length = 3.5, - width = 1.6, - height = 1.7, - number_persons = 1, - capacity_persons = 4, - dist_min = 0.5, - speed_max = 10.0, - emissionclass= 'HBEFA3/zero', - mode = 'custom1', # specifies mode for demand - color = np.array((255,240,0,255),np.float32)/255.0, - shape_gui = 'evehicle', - times_boarding = 1.5, - times_loading = 20.0, - sublane_alignment_lat = 'center', - sublane_speed_max_lat = 0.5, - sublane_gap_min_lat = 0.24, - sublane_alignment_eager = 1000000.0, - ) - - - - - - def select_by_mode(self, id_mode=None, mode=None, is_sumoid = False): - if id_mode==None: + # self.del_rows(self.get_ids()) + self.add_vtype('pedestrian', + accel=1.5, + decel=2.0, + sigma=0.5, + length=0.6, + width=0.8, + height=1.719, + number_persons=1, + capacity_persons=1, + dist_min=0.5, + speed_max=5.4 / 3.6, + mode='pedestrian', # specifies mode for demand + color=np.array((210, 128, 0, 255), np.float32) / 255.0, + shape_gui='pedestrian', + impatience=1.0, + emissionclass='HBEFA3/zero', + times_boarding=0.0, + times_loading=0.0, + sublane_alignment_lat='nice', + sublane_speed_max_lat=0.5, + sublane_gap_min_lat=0.5, + sublane_alignment_eager=0.5, + sublane_pushyfactor=0.5, + ) + + self.add_vtype('passenger1', + accel=2.9, + decel=7.5, + sigma=0.5, + length=4.3, + height=1.50, + width=1.8, + number_persons=1, + capacity_persons=4, + dist_min=1.0, + speed_max=180.0 / 3.6, + mode='passenger', # specifies mode for demand + color=np.array((185, 85, 255, 255), np.float32) / 255.0, + shape_gui='passenger', + impatience=1.0, + emissionclass='HBEFA3/PC', + times_boarding=0.5, + times_loading=90.0, + sublane_alignment_lat='center', + sublane_speed_max_lat=1.0, + sublane_gap_min_lat=0.12, + ) + + self.add_vtype('bicycle', + accel=1.2, + decel=3.0, + sigma=0.7, + length=1.6, + width=0.9, + height=1.7, + number_persons=1, + capacity_persons=1, + dist_min=0.5, + speed_max=18.0 / 3.6, + mode='bicycle', # specifies mode for demand + impatience=1.0, + emissionclass='HBEFA3/zero', + color=np.array((94, 203, 57, 255), np.float32) / 255.0, + shape_gui='bicycle', + lanechange_strategy=1.0, + lanechange_coop=1.0, + lanechange_gain=1.0, + lanechange_rightkeeping=1.0, + times_boarding=20.0, + times_loading=0.0, + sublane_alignment_lat='right', + sublane_speed_max_lat=0.8, + sublane_gap_min_lat=0.12, + sublane_alignment_eager=1.0, + sublane_pushyfactor=0.0, + ) + + self.add_vtype('vespa', + accel=4.5, + decel=7.5, + sigma=0.7, + length=1.5, + height=1.7, + width=0.95, + number_persons=1, + capacity_persons=1, + dist_min=0.5, + speed_max=60.0 / 3.6, + mode='moped', # specifies mode for demand + impatience=1.0, + emissionclass='HBEFA3/LDV_G_EU3', + color=np.array((205, 92, 0, 255), np.float32) / 255.0, + shape_gui='motorcycle', + times_boarding=20.0, + times_loading=90.0, + sublane_alignment_lat='left', + sublane_speed_max_lat=1.0, + sublane_gap_min_lat=0.12, + sublane_alignment_eager=0.9, + sublane_pushyfactor=0.8, + ) + + self.add_vtype('motorcycle', + accel=4.5, + decel=7.5, + sigma=0.7, + length=1.5, + height=1.7, + width=0.95, + number_persons=1, + capacity_persons=1, + dist_min=0.5, + speed_max=180.0 / 3.6, + mode='motorcycle', # specifies mode for demand + impatience=1.0, + emissionclass='HBEFA3/LDV_G_EU3', + color=np.array((205, 92, 0, 255), np.float32) / 255.0, + shape_gui='motorcycle', + times_boarding=20.0, + times_loading=90.0, + sublane_alignment_lat='left', + sublane_speed_max_lat=1.0, + sublane_gap_min_lat=0.12, + sublane_alignment_eager=0.9, + sublane_pushyfactor=0.8, + ) + + self.add_vtype('taxi1', + accel=1.9, + decel=3.5, + sigma=0.5, + length=5.0, + height=1.80, + width=1.8, + number_persons=1, + capacity_persons=4, + dist_min=1.0, + speed_max=180.0 / 3.6, + mode='taxi', # specifies mode for demand + color=np.array((185, 185, 255, 255), + np.float32) / 255.0, + shape_gui='passenger/sedan', + impatience=1.0, + emissionclass='HBEFA3/PC', + times_boarding=30.0, + times_loading=90.0, + sublane_alignment_lat='center', + sublane_speed_max_lat=0.8, + sublane_gap_min_lat=0.12, + ) + + self.add_vtype('bus', + accel=1.2, + decel=4.0, + sigma=0.9, + length=12.0, + height=3.4, + width=2.5, + number_persons=20, + capacity_persons=85, + dist_min=0.5, + speed_max=80.0 / 3.6, + mode='bus', # specifies mode for demand + impatience=1.0, + emissionclass='HBEFA3/Bus', + color=np.array((255, 192, 0, 255), np.float32) / 255.0, + shape_gui='bus', + times_boarding=2.0, + times_loading=90.0, + sublane_alignment_lat='center', + sublane_speed_max_lat=0.5, + sublane_gap_min_lat=0.24, + sublane_alignment_eager=10.0, + ) + + self.add_vtype('bus_flexible', + accel=1.2, + decel=4.0, + sigma=0.9, + length=17.9, + width=2.5, + height=3.0, + number_persons=40, + capacity_persons=140, + dist_min=0.5, + speed_max=80.0 / 3.6, + mode='bus', # specifies mode for demand + impatience=1.0, + emissionclass='HBEFA3/Bus', + color=np.array((255, 192, 255, 255), + np.float32) / 255.0, + shape_gui='bus/flexible', + times_boarding=2.0, + times_loading=90.0, + sublane_alignment_lat='center', + sublane_speed_max_lat=0.5, + sublane_gap_min_lat=0.24, + sublane_alignment_eager=100.0, + ) + + self.add_vtype('tram1', + accel=1.0, + decel=3.0, + sigma=0.9, + length=22.0, + width=2.4, + height=3.2, + number_persons=50, + capacity_persons=120, + dist_min=0.5, + speed_max=80.0 / 3.6, + mode='tram', # specifies mode for demand + impatience=1.0, + emissionclass='HBEFA3/zero', + color=np.array((255, 192, 255, 255), + np.float32) / 255.0, + shape_gui='rail/railcar', + times_boarding=1.5, + times_loading=90.0, + sublane_alignment_lat='center', + sublane_speed_max_lat=0.5, + sublane_gap_min_lat=0.24, + sublane_alignment_eager=1000000.0, + ) + + self.add_vtype('rail_urban1', + accel=1.0, + decel=3.0, + sigma=0.9, + length=36.0, + width=3.0, + height=3.6, + number_persons=200, + capacity_persons=300, + dist_min=0.5, + speed_max=100.0 / 3.6, + mode='rail_urban', # specifies mode for demand + emissionclass='HBEFA3/zero', + color=np.array((255, 192, 255, 255), + np.float32) / 255.0, + shape_gui='rail/railcar', + times_boarding=1.5, + times_loading=90.0, + sublane_alignment_lat='center', + sublane_speed_max_lat=0.5, + sublane_gap_min_lat=0.24, + sublane_alignment_eager=1000000.0, + ) + + self.add_vtype('van1', + accel=1.9, + decel=3.5, + sigma=0.5, + length=5.0, + height=2.50, + width=1.9, + number_persons=1, + capacity_persons=2, + dist_min=1.0, + speed_max=100.0 / 3.6, + mode='delivery', # specifies mode for demand + color=np.array((185, 185, 255, 255), + np.float32) / 255.0, + shape_gui='passenger/van', + impatience=1.0, + emissionclass='HBEFA3/LDV_D_EU3', + times_boarding=5.0, + times_loading=90.0, + sublane_alignment_lat='center', + sublane_speed_max_lat=1.0, + sublane_gap_min_lat=0.12, + ) + + self.add_vtype('truck', + accel=1.5, + decel=2.5, + sigma=0.5, + length=8.0, + height=3.50, + width=2.0, + number_persons=1, + capacity_persons=2, + dist_min=1.0, + speed_max=90.0 / 3.6, + mode='truck', # specifies mode for demand + color=np.array((185, 185, 255, 255), + np.float32) / 255.0, + shape_gui='truck', + impatience=1.0, + emissionclass='HBEFA3/HDV_D_EU2', + times_boarding=5.0, + times_loading=180.0, + sublane_alignment_lat='center', + sublane_speed_max_lat=1.0, + sublane_gap_min_lat=0.12, + ) + + self.add_vtype('truck_semitrailer', + accel=1.0, + decel=2.0, + sigma=0.5, + length=10.0, + height=4.50, + width=2.0, + number_persons=1, + capacity_persons=2, + dist_min=1.0, + speed_max=90.0 / 3.6, + mode='truck', # specifies mode for demand + color=np.array((185, 185, 255, 255), + np.float32) / 255.0, + shape_gui='truck/semitrailer', + impatience=1.0, + emissionclass='HBEFA3/HDV_D_EU2', + times_boarding=5.0, + times_loading=300.0, + sublane_alignment_lat='center', + sublane_speed_max_lat=1.0, + sublane_gap_min_lat=0.12, + ) + + self.add_vtype('truck_trailer', + accel=1.0, + decel=2.0, + sigma=0.5, + length=12.0, + height=3.50, + width=2.0, + number_persons=1, + capacity_persons=2, + dist_min=1.0, + speed_max=90.0 / 3.6, + mode='truck', # specifies mode for demand + color=np.array((185, 185, 255, 255), + np.float32) / 255.0, + shape_gui='truck/trailer', + impatience=1.0, + emissionclass='HBEFA3/HDV_D_EU2', + times_boarding=5.0, + times_loading=600.0, + sublane_alignment_lat='center', + sublane_speed_max_lat=1.0, + sublane_gap_min_lat=0.12, + ) + + self.add_vtype('evehicle1', + accel=2.5, + decel=2.5, + sigma=1.0, + length=3.5, + width=1.6, + height=1.7, + number_persons=1, + capacity_persons=4, + dist_min=0.5, + speed_max=10.0, + emissionclass='HBEFA3/zero', + mode='evehicle', # specifies mode for demand + color=np.array((255, 240, 0, 255), np.float32) / 255.0, + shape_gui='evehicle', + times_boarding=1.5, + times_loading=20.0, + sublane_alignment_lat='center', + sublane_speed_max_lat=0.5, + sublane_gap_min_lat=0.24, + sublane_alignment_eager=1000000.0, + ) + + self.add_vtype('PRT', + accel=2.5, + decel=2.5, + sigma=1.0, + length=3.5, + width=1.6, + height=1.7, + number_persons=1, + capacity_persons=4, + dist_min=0.5, + speed_max=10.0, + emissionclass='HBEFA3/zero', + mode='custom1', # specifies mode for demand + color=np.array((255, 240, 0, 255), np.float32) / 255.0, + shape_gui='evehicle', + times_boarding=1.5, + times_loading=20.0, + sublane_alignment_lat='center', + sublane_speed_max_lat=0.5, + sublane_gap_min_lat=0.24, + sublane_alignment_eager=1000000.0, + ) + + def select_by_mode(self, id_mode=None, mode=None, is_sumoid=False): + if id_mode == None: id_mode = MODES[mode] - ids =self.select_ids(self.ids_mode.get_value()==id_mode) + ids = self.select_ids(self.ids_mode.get_value() == id_mode) #print 'select_by_mode',id_mode,self.ids_sumo[ids]# if is_sumoid: return self.ids_sumo[ids] else: return ids - - - - - - #def get_vtypes_by_mode(self,mode): + # def get_vtypes_by_mode(self,mode): # return self.select_ids(self.modes.value == mode) - + def get_modes(self): """ Returns a list of mode ids for which there are currently vehicles in the database. """ - #print 'getClasses',self._types + # print 'getClasses',self._types return list(set(self.ids_mode.value)) - + def get_modechoices(self): """ Returns a dictionary of modes for which there are @@ -836,87 +828,87 @@ for mode, id_mode in MODES.iteritems(): if id_mode in mode_vtypes: mode_choice[mode] = id_mode - return mode_choice - - def _write_xml_body(self, fd, indent, objconfigs, idcolconfig_include_tab,colconfigs, + return mode_choice + + def _write_xml_body(self, fd, indent, objconfigs, idcolconfig_include_tab, colconfigs, objcolconfigs, - xmltag_item, attrconfig_id, xmltag_id, ids,ids_xml): - print '_write_xml_body ident,ids',self.ident,ids - print ' xmltag_item,xmltag_id,attrconfig_id' , xmltag_item,xmltag_id ,attrconfig_id - + xmltag_item, attrconfig_id, xmltag_id, ids, ids_xml): + print '_write_xml_body ident,ids', self.ident, ids + print ' xmltag_item,xmltag_id,attrconfig_id', xmltag_item, xmltag_id, attrconfig_id + # ids_xml not used here!! if ids == None: ids = self.get_ids() for attrconfig in objconfigs: - attrconfig.get_value().write_xml(fd,indent+2) - + attrconfig.get_value().write_xml(fd, indent + 2) + # check if columns contain objects #objcolconfigs = [] scalarcolconfigs = colconfigs - #for attrconfig in colconfigs: + # for attrconfig in colconfigs: # if attrconfig.metatype == 'obj': # objcolconfigs.append(attrconfig) # else: # scalarcolconfigs.append(attrconfig) - + for _id in ids: - fd.write(xm.start(xmltag_item,indent+2)) - - #print ' make tag and id',_id + fd.write(xm.start(xmltag_item, indent + 2)) + + # print ' make tag and id',_id if xmltag_id == '': # no id tag will be written pass - elif (attrconfig_id is None)&(xmltag_id is not None): + elif (attrconfig_id is None) & (xmltag_id is not None): # use specified id tag and and specified id values fd.write(xm.num(xmltag_id, id_xml)) - + elif (attrconfig_id is not None): # use id tag and values of attrconfig_id - attrconfig_id.write_xml(fd,_id) - - #print ' write columns',len(scalarcolconfigs)>0,len(idcolconfig_include_tab)>0,len(objcolconfigs)>0 + attrconfig_id.write_xml(fd, _id) + + # print ' write + # columns',len(scalarcolconfigs)>0,len(idcolconfig_include_tab)>0,len(objcolconfigs)>0 for attrconfig in scalarcolconfigs: - #print ' scalarcolconfig',attrconfig.attrname - attrconfig.write_xml(fd,_id) - + # print ' scalarcolconfig',attrconfig.attrname + attrconfig.write_xml(fd, _id) + # insert lanechange model here: - fd.write(xm.num('laneChangeModel', self.lanechangemodel.get_value())) - - if (len(idcolconfig_include_tab)>0)|(len(objcolconfigs)>0): + fd.write( + xm.num('laneChangeModel', self.lanechangemodel.get_value())) + + if (len(idcolconfig_include_tab) > 0) | (len(objcolconfigs) > 0): fd.write(xm.stop()) - + for attrconfig in idcolconfig_include_tab: - #print ' include_tab',attrconfig.attrname - attrconfig.write_xml(fd,_id,indent+4) - + # print ' include_tab',attrconfig.attrname + attrconfig.write_xml(fd, _id, indent + 4) + for attrconfig in objcolconfigs: - #print ' objcolconfig',attrconfig.attrname - attrconfig[_id].write_xml(fd, indent+4) - fd.write(xm.end(xmltag_item,indent+4)) + # print ' objcolconfig',attrconfig.attrname + attrconfig[_id].write_xml(fd, indent + 4) + fd.write(xm.end(xmltag_item, indent + 4)) else: fd.write(xm.stopit()) - - - #print ' _write_xml_body: done' - - #def write_xml(self, fd, indent, xmltag_id = 'id', ids = None, + + # print ' _write_xml_body: done' + + # def write_xml(self, fd, indent, xmltag_id = 'id', ids = None, # is_print_begin_end = True, attrconfigs_excluded = []): - # + # # attrconfigs_excluded.append('lanechangemodel') - - + def parseColor(s): - #print 'parseColor',s - arr = s.split(',') - ret = [] - for a in arr: - # adapt for old color information: - if a.find('.')>=0: - # color in range 0.0...1.0 - ret.append(float(a)*255) - else: - # color in range 0...255 - ret.append(int(a)) + # print 'parseColor',s + arr = s.split(',') + ret = [] + for a in arr: + # adapt for old color information: + if a.find('.') >= 0: + # color in range 0.0...1.0 + ret.append(float(a) * 255) + else: + # color in range 0...255 + ret.append(int(a)) - return tuple(ret) \ No newline at end of file + return tuple(ret) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/virtualpop.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/virtualpop.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/virtualpop.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/virtualpop.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,681 +1,650 @@ -import numpy as np -from numpy import random +import numpy as np +from numpy import random import agilepy.lib_base.classman as cm import agilepy.lib_base.arrayman as am import agilepy.lib_base.xmlman as xm #from coremodules.modules_common import * from coremodules.network.network import SumoIdsConf, MODES -from coremodules.network import routing +from coremodules.network import routing from agilepy.lib_base.misc import random_choice class Plans(am.ArrayObjman): - def __init__(self,polulation, **kwargs): + + def __init__(self, polulation, **kwargs): """Plans database.""" - self._init_objman( ident='plans', - parent = polulation, - name = 'Plans', - info = 'Mobility plan for virtual polulation.', - #xmltag = ('plans','plan',None), - **kwargs) - - - self.add_col(am.IdsArrayConf( 'ids_person', polulation, - groupnames = ['state'], - name = 'Person ID', - info = 'Person ID to who this plan belongs to.', - )) - - - - self.add_col(am.ArrayConf( 'probabilities', 1.0, - name = 'Probability', - info = 'Plan execution probability.', - )) - - - self.add_col(am.ArrayConf( 'times_est', 0.0, - name = 'Estim. time', - info = 'Estimated time to execute plan.', - unit = 's', - )) - - self.add_col(am.ArrayConf( 'times_exec', 0.0, - name = 'Exec time', - info = 'Last plan execution time from simulation run.', - unit = 's', - )) - - - - self.add_col(am.TabIdListArrayConf( 'stagelists', - name = 'Stages', - info = 'Sequence of stages of this plan.', - )) - - - + self._init_objman(ident='plans', + parent=polulation, + name='Plans', + info='Mobility plan for virtual polulation.', + #xmltag = ('plans','plan',None), + **kwargs) + + self.add_col(am.IdsArrayConf('ids_person', polulation, + groupnames=['state'], + name='Person ID', + info='Person ID to who this plan belongs to.', + )) + + self.add_col(am.ArrayConf('probabilities', 1.0, + name='Probability', + info='Plan execution probability.', + )) + + self.add_col(am.ArrayConf('times_est', 0.0, + name='Estim. time', + info='Estimated time to execute plan.', + unit='s', + )) + + self.add_col(am.ArrayConf('times_exec', 0.0, + name='Exec time', + info='Last plan execution time from simulation run.', + unit='s', + )) + + self.add_col(am.TabIdListArrayConf('stagelists', + name='Stages', + info='Sequence of stages of this plan.', + )) + def append_stage(self, id_plan, stage, id_stage): # test: stage = cm.TableEntry(stagetype, id_plan) - #print 'Plans.append_stage',id_plan, stage, id_stage - - - if self.stagelists[id_plan]==None: - self.stagelists[id_plan]=[(stage, id_stage)] + # print 'Plans.append_stage',id_plan, stage, id_stage + + if self.stagelists[id_plan] == None: + self.stagelists[id_plan] = [(stage, id_stage)] else: - self.stagelists[id_plan].append((stage, id_stage)) - #print ' after append stagelists[id_plan]',type(self.stagelists[id_plan]),self.stagelists[id_plan] - def get_timing_laststage(self,id_plan): + self.stagelists[id_plan].append((stage, id_stage)) + # print ' after append + # stagelists[id_plan]',type(self.stagelists[id_plan]),self.stagelists[id_plan] + + def get_timing_laststage(self, id_plan): """ Return time_start and duration of last stage of plan id_plan """ - stages_current = self.stagelists[id_plan] - - if stages_current!=None: + stages_current = self.stagelists[id_plan] + + if stages_current != None: stage_last, id_stage_last = stages_current[-1] - return stage_last.get_timing(id_stage_last) + return stage_last.get_timing(id_stage_last) else: return -1, -1 - - - + def get_stages(self, id_plan): stages = self.stagelists[id_plan] - if stages==None: + if stages == None: return [] else: return stages + class IndividualVehicles(am.ArrayObjman): - - def __init__(self,ident, polulation, vtypes, edges, parking, **kwargs): - print 'IndividualVehicles vtype id_default',vtypes.ids_sumo.get_id_from_index('passenger1') - self._init_objman( ident=ident, - parent = polulation, - name = 'Indiv. Veh.', - info = 'Individual vehicle database. These are privately owned vehicles.', - **kwargs) - - - - self.add_col(am.IdsArrayConf( 'ids_vtype', vtypes, - id_default = vtypes.ids_sumo.get_id_from_index('passenger1'), - groupnames = ['state'], - name = 'Veh. type', - info = 'Vehicle type.', - #xmltag = 'type', - )) - - self.add_col(am.IdsArrayConf( 'ids_person', polulation, - groupnames = ['state'], - name = 'ID person', - info = 'ID of person who ownes the vehicle.', - )) - - self.add_col(am.IdlistsArrayConf( 'routes', edges, - groupnames = ['_private'], - name = 'Route', - info = "The vehicle's route as a sequence of edge ids.", - )) - - self.add_col(am.IdlistsArrayConf( 'ids_parkings', parking, - groupnames = ['state'], - name = 'Parking', - info = 'Sequence of parking IDs, this will cause the vehicle to stop successively at these parkings.', - )) - - self.add_col(am.ArrayConf( 'times_exec', 0.0, - name = 'Exec time', - info = 'Total route execution time from simulation run of last plan.', - unit = 's', - )) - + + def __init__(self, ident, polulation, vtypes, edges, parking, **kwargs): + print 'IndividualVehicles vtype id_default', vtypes.ids_sumo.get_id_from_index('passenger1') + self._init_objman(ident=ident, + parent=polulation, + name='Indiv. Veh.', + info='Individual vehicle database. These are privately owned vehicles.', + **kwargs) + + self.add_col(am.IdsArrayConf('ids_vtype', vtypes, + id_default=vtypes.ids_sumo.get_id_from_index( + 'passenger1'), + groupnames=['state'], + name='Veh. type', + info='Vehicle type.', + #xmltag = 'type', + )) + + self.add_col(am.IdsArrayConf('ids_person', polulation, + groupnames=['state'], + name='ID person', + info='ID of person who ownes the vehicle.', + )) + + self.add_col(am.IdlistsArrayConf('routes', edges, + groupnames=['_private'], + name='Route', + info="The vehicle's route as a sequence of edge ids.", + )) + + self.add_col(am.IdlistsArrayConf('ids_parkings', parking, + groupnames=['state'], + name='Parking', + info='Sequence of parking IDs, this will cause the vehicle to stop successively at these parkings.', + )) + + self.add_col(am.ArrayConf('times_exec', 0.0, + name='Exec time', + info='Total route execution time from simulation run of last plan.', + unit='s', + )) + parking.link_vehiclefleet(self) - - - + def get_vtypes(self): """ Returns a set with all used vehicle types. """ - #print 'Vehicles_individual.get_vtypes',self.cols.vtype + # print 'Vehicles_individual.get_vtypes',self.cols.vtype return set(self.ids_vtype.get_value()) - - - - + def route_between_parking(self, id_veh, id_parking_from, id_parking_to): """ Sets/adds route and distance of ride with id_veh between id_parking_from and id_parking_to Returns approximate duration. """ - #print 'route_between_parking', id_veh, id_parking_from, id_parking_to + # print 'route_between_parking', id_veh, id_parking_from, id_parking_to ind = self.get_ind(id_veh) - - vtype = ids_vtype[id_veh]#self.cols.vtype[ind] + + vtype = ids_vtype[id_veh] # self.cols.vtype[ind] #v_max = self.parent.get_demand().getVehicles().maxSpeed.get(vtype) - #edges, dist = self.get_route_bet ween_parking(vtype, id_parking_from, id_parking_to) + # edges, dist = self.get_route_bet ween_parking(vtype, id_parking_from, id_parking_to) #ids_edge, duration_approx = minimum_costtree.get_ids_edge_duration_from_route(vtype, edges, v_max) - ids_edge, dist, duration_approx = self.parent.get_route_between_parking(id_parking_from, id_parking_to, vtype) - #print ' ids_edge',ids_edge - + ids_edge, dist, duration_approx = self.parent.get_route_between_parking( + id_parking_from, id_parking_to, vtype) + # print ' ids_edge',ids_edge + if not self._update_parking(id_veh, id_parking_from, id_parking_to): return -1 - + self._update_route(ids_edge) - - - #print ' routes',self.routes[id_veh] + # print ' routes',self.routes[id_veh] return duration_approx - - - - def set_route(self, id_veh, route, id_parking_from, id_parking_to): + + def set_route(self, id_veh, route, id_parking_from, id_parking_to): """ This sets directly a route. The first and last edge of the route are assumed to be parking spaces. """ - #print 'set_route id_veh',id_veh,route + # print 'set_route id_veh',id_veh,route #ind_veh = self.get_ind(id_veh) if not self._update_parking(id_veh, id_parking_from, id_parking_to): return -1 self._update_route(id_veh, route) - - def _update_parking(self, id_veh, id_parking_from, id_parking_to): - #print '_update_route',id_veh,id_parking_from, id_parking_to + # print '_update_route',id_veh,id_parking_from, id_parking_to ids_parking = self.ids_parkings[id_veh] - if ids_parking==None: - #print ' new parking' - self.ids_parkings[id_veh]=[id_parking_from, id_parking_to] - - + if ids_parking == None: + # print ' new parking' + self.ids_parkings[id_veh] = [id_parking_from, id_parking_to] + elif ids_parking[-1] == id_parking_from: - #print ' append parking' + # print ' append parking' ids_parking.append(id_parking_to) - #ids_edge.pop(0)???? - - + # ids_edge.pop(0)???? + else: - print 'WARNING in route_between_parking veh %d not on parking %d but on parking %d'%(id_veh,id_parking_from,ids_parking[-1]) + print 'WARNING in route_between_parking veh %d not on parking %d but on parking %d' % (id_veh, id_parking_from, ids_parking[-1]) #route_edges_bridge = self.get_route(vtype, parking[-1], id_parking_from) - # this should generate an untriggered parking at parking[-1] + # this should generate an untriggered parking at parking[-1] # and link parkings with route_edges_bridge return False - + return True - - def _update_route(self,id_veh, route): - #print '_update_route',id_veh,route + + def _update_route(self, id_veh, route): + # print '_update_route',id_veh,route route_current = self.routes[id_veh] - - if route_current==None: + + if route_current == None: self.routes[id_veh] = route else: route_current += route - + + class StageTypeMixin(am.ArrayObjman): - def init_stagetype(self,ident, polulation, name = '', info = "Stage of Plan"): - - self._init_objman( ident=ident, parent = polulation, name = name, - info = info, - ) - - - self.add_col(am.IdsArrayConf( 'ids_plan', polulation.get_plans(), - groupnames = ['state'], - name = 'ID plan', - info = 'ID of plan.', - xmltag = 'type', - )) - - - - self.add_col(am.ArrayConf( 'times_start', -1.0, - name = 'Start time', - unit = 's', - info = 'Planned or estimated time when this stage starts. Value -1 means unknown.', - )) - - self.add_col(am.ArrayConf( 'durations', -1.0, - name = 'Duration', - unit = 's', - info = 'Planned or estimated Duration for this stage starts. Value -1 means unknown.', - )) - - def append_stage( self, id_plan, time_start, **kwargs): - + + def init_stagetype(self, ident, polulation, name='', info="Stage of Plan"): + + self._init_objman(ident=ident, parent=polulation, name=name, + info=info, + ) + + self.add_col(am.IdsArrayConf('ids_plan', polulation.get_plans(), + groupnames=['state'], + name='ID plan', + info='ID of plan.', + xmltag='type', + )) + + self.add_col(am.ArrayConf('times_start', -1.0, + name='Start time', + unit='s', + info='Planned or estimated time when this stage starts. Value -1 means unknown.', + )) + + self.add_col(am.ArrayConf('durations', -1.0, + name='Duration', + unit='s', + info='Planned or estimated Duration for this stage starts. Value -1 means unknown.', + )) + + def append_stage(self, id_plan, time_start, **kwargs): + # try to fix timing - #if time_start<0: + # if time_start<0: # time_start_prev, duration_prev = self.parent.plans.get_timing_laststage(id_plan) # if (duration_prev>=0)&(time_start_prev>=0): # time_start = time_start_prev+duration_prev - - - - - id_stage = self.add_row(ids_plan = id_plan, times_start = time_start, **kwargs) - #print 'STAGE.appended stage %s id_plan=%d, id_stage=%d, t=%d'%(self.get_name(),id_plan,id_stage,time_start) - #for key in kwargs.keys(): + + id_stage = self.add_row( + ids_plan=id_plan, times_start=time_start, **kwargs) + # print 'STAGE.appended stage %s id_plan=%d, id_stage=%d, t=%d'%(self.get_name(),id_plan,id_stage,time_start) + # for key in kwargs.keys(): # print ' %s=%s'%(key,kwargs[key]) - #print ' --id_plan, self, id_stage',id_plan, self, id_stage#,self.ids_plan.get_linktab() + # print ' --id_plan, self, id_stage',id_plan, self, + # id_stage#,self.ids_plan.get_linktab() self.ids_plan.get_linktab().append_stage(id_plan, self, id_stage) - #print ' plan appended',id_plan, self, id_stage + # print ' plan appended',id_plan, self, id_stage + + return id_stage, time_start + self.durations[id_stage] - return id_stage, time_start+self.durations[id_stage] - def get_timing(self, id_stage): #ind = self.get_ind(id_stage) - return self.times_start[id_stage], self.durations[id_stage] - - def to_xml(self, id_stage, fd, indent = 0): + return self.times_start[id_stage], self.durations[id_stage] + + def to_xml(self, id_stage, fd, indent=0): """ To be overridden by specific stage class. """ pass - - + + class Transits(StageTypeMixin): - def __init__(self, ident,population, publictransport,name='Ride on PT',info = 'Ride on a single public transport line (no transfers).'): - self.init_stagetype(ident, population, name=name, info = info) - - self.add_col(am.IdsArrayConf( 'ids_line', publictransport.ptlines, - groupnames = ['state'], - name = 'ID line', - info = 'ID of public transport line.', - )) - - self.add_col(am.IdsArrayConf( 'ids_line', publictransport.stops, - groupnames = ['state'], - name = 'ID line', - info = 'ID of public transport line.', - )) - - self.add_col(am.IdsArrayConf( 'ids_stop_from', publictransport.stops, - groupnames = ['state'], - name = 'Dep. station', - info = 'ID of departure station or bus stop.', - )) - - self.add_col(am.IdsArrayConf( 'ids_stop_to', stops, - groupnames = ['state'], - name = 'Arr. station', - info = 'ID of arrival station or bus stop.', - )) - - - - - - - - - - - def to_xml(self, id_stage, fd, indent = 0): + def __init__(self, ident, population, publictransport, name='Ride on PT', info='Ride on a single public transport line (no transfers).'): + self.init_stagetype(ident, population, name=name, info=info) + + self.add_col(am.IdsArrayConf('ids_line', publictransport.ptlines, + groupnames=['state'], + name='ID line', + info='ID of public transport line.', + )) + + self.add_col(am.IdsArrayConf('ids_line', publictransport.stops, + groupnames=['state'], + name='ID line', + info='ID of public transport line.', + )) + + self.add_col(am.IdsArrayConf('ids_stop_from', publictransport.stops, + groupnames=['state'], + name='Dep. station', + info='ID of departure station or bus stop.', + )) + + self.add_col(am.IdsArrayConf('ids_stop_to', stops, + groupnames=['state'], + name='Arr. station', + info='ID of arrival station or bus stop.', + )) + + def to_xml(self, id_stage, fd, indent=0): # - ind = self.get_ind(id_stage) - fd.write(xm.start('ride',indent=indent)) - - # generate string with all vehicles of this line during entire simulation + ind = self.get_ind(id_stage) + fd.write(xm.start('ride', indent=indent)) + + # generate string with all vehicles of this line during entire + # simulation ptlines = self.parent.get_ptlines() - + id_line = self.cols.id_line[ind] ids_veh = ptlines.get_ids_veh(id_line) - + #landuse = self.parent.get_landuse() # #edge_from, pos_from = landuse.get_edge_pos_parking(self.cols.id_parking_from[ind]) #edge_to, pos_to = landuse.get_edge_pos_parking(self.cols.id_parking_to[ind]) ptstops = self.parent.get_ptstops() - - - fd.write(xm.num('from', ptstops.get_id_edge(self.cols.id_stop_from[ind]) )) - fd.write(xm.num('to', ptstops.get_id_edge(self.cols.id_stop_to[ind]) )) + + fd.write(xm.num('from', ptstops.get_id_edge( + self.cols.id_stop_from[ind]))) + fd.write(xm.num('to', ptstops.get_id_edge(self.cols.id_stop_to[ind]))) fd.write(xm.arr('lines', ids_veh)) - #if self.cols.pos_edge_from[ind]>0: + # if self.cols.pos_edge_from[ind]>0: # fd.write(xm.num('departPos', self.cols.pos_edge_from[ind])) - #if self.cols.pos_edge_to[ind]>0: + # if self.cols.pos_edge_to[ind]>0: # fd.write(xm.num('arrivalPos', self.cols.pos_edge_to[ind])) - - fd.write(xm.stopit())# ends stage + + fd.write(xm.stopit()) # ends stage + class Rides(StageTypeMixin): - def __init__(self,ident,population, parking,name='Auto rides',info = 'Rides with privately owned vehicle.'): - self.init_stagetype(ident, population, name=name, info = info) - + + def __init__(self, ident, population, parking, name='Auto rides', info='Rides with privately owned vehicle.'): + self.init_stagetype(ident, population, name=name, info=info) + # TODO: this structure needs review: the private vehicle is part of a person, not a stage - # street parking at home and work could be in stage. Private garage is part of person... - self.add_col(am.IdsArrayConf( 'ids_veh', population.get_individualvehicles(), - groupnames = ['state'], - name = 'ID vehicle', - info = 'ID of private vehicle.', - )) - - - + # street parking at home and work could be in stage. Private garage is + # part of person... + self.add_col(am.IdsArrayConf('ids_veh', population.get_individualvehicles(), + groupnames=['state'], + name='ID vehicle', + info='ID of private vehicle.', + )) + #self._vehicles_individual = vehicles_individual - self.add_col(am.IdsArrayConf( 'ids_parking_from', parking, - groupnames = ['state'], - name = 'ID dep. parking', - info = 'Parking ID at the departure of the ride starts.', - )) - self.add_col(am.IdsArrayConf( 'ids_parking_to', parking, - groupnames = ['state'], - name = 'ID arr. parking', - info = 'Parking ID at the arrival of the ride.', - )) - #self._init_constants() - - #def _init_constants(self): - # self.vehicles = self.ids_veh.get_linktab() - + self.add_col(am.IdsArrayConf('ids_parking_from', parking, + groupnames=['state'], + name='ID dep. parking', + info='Parking ID at the departure of the ride starts.', + )) + self.add_col(am.IdsArrayConf('ids_parking_to', parking, + groupnames=['state'], + name='ID arr. parking', + info='Parking ID at the arrival of the ride.', + )) + # self._init_constants() + + # def _init_constants(self): + # self.vehicles = self.ids_veh.get_linktab() + def get_individualvehicles(self): return self.parent.get_individualvehicles()() - - def append_stage( self, id_plan, time_start=-1.0, - ids_edge = [], duration = None, + + def append_stage(self, id_plan, time_start=-1.0, + ids_edge=[], duration=None, **kwargs): - - id_stage, time_end = StageTypeMixin.append_stage(self, id_plan,time_start) - #print 'Rides.append_stage',id_stage - #print ' kwargs',kwargs - self.set_row( id_stage, - ids_veh = kwargs['id_veh'], - ids_parking_from = kwargs['id_parking_from'], - ids_parking_to = kwargs['id_parking_to'], - ) - + + id_stage, time_end = StageTypeMixin.append_stage( + self, id_plan, time_start) + # print 'Rides.append_stage',id_stage + # print ' kwargs',kwargs + self.set_row(id_stage, + ids_veh=kwargs['id_veh'], + ids_parking_from=kwargs['id_parking_from'], + ids_parking_to=kwargs['id_parking_to'], + ) + # attention: here time_end is not valid because duration is not yet set ind = self.get_ind(id_stage) - #print ' duration,ids_parking_from,ids_parking_to',duration,self.ids_parking_from[id_stage],self.ids_parking_to[id_stage],ids_edge - - if duration==None: + # print ' + # duration,ids_parking_from,ids_parking_to',duration,self.ids_parking_from[id_stage],self.ids_parking_to[id_stage],ids_edge + + if duration == None: # this will route and compute duration - duration = self.parent.get_individualvehicles().route_between_parking(self.ids_veh.value[ind],self.ids_parking_from.value[ind], self.ids_parking_to.value[ind]) + duration = self.parent.get_individualvehicles().route_between_parking( + self.ids_veh.value[ind], self.ids_parking_from.value[ind], self.ids_parking_to.value[ind]) else: # case wehn route has been already determined - self.parent.get_individualvehicles().set_route(self.ids_veh.value[ind],ids_edge,self.ids_parking_from.value[ind], self.ids_parking_to.value[ind]) + self.parent.get_individualvehicles().set_route(self.ids_veh.value[ + ind], ids_edge, self.ids_parking_from.value[ind], self.ids_parking_to.value[ind]) self.durations[id_stage] = duration - return id_stage, time_start+duration - - - - def to_xml(self, id_stage, fd, indent = 0): + return id_stage, time_start + duration + + def to_xml(self, id_stage, fd, indent=0): #lanes = self.parent.get_scenario().net.lanes scenario = self.parent.get_scenario() - - - edgeindex = scenario.net.edges.ids_sumo + + edgeindex = scenario.net.edges.ids_sumo parking = scenario.landuse.parking - - ind = self.get_ind(id_stage) - fd.write(xm.start('ride',indent=indent)) - - - id_edge_from, pos_from = parking.get_edge_pos_parking(self.ids_parking_from.value[ind]) - id_edge_to, pos_to = parking.get_edge_pos_parking(self.ids_parking_to.value[ind]) - - - #edgeindex.get_index_from_id(self.ids_edge_to.value[ind]) - fd.write(xm.num('from', edgeindex[id_edge_from] )) - fd.write(xm.num('to', edgeindex[id_edge_to] )) + + ind = self.get_ind(id_stage) + fd.write(xm.start('ride', indent=indent)) + + id_edge_from, pos_from = parking.get_edge_pos_parking( + self.ids_parking_from.value[ind]) + id_edge_to, pos_to = parking.get_edge_pos_parking( + self.ids_parking_to.value[ind]) + + # edgeindex.get_index_from_id(self.ids_edge_to.value[ind]) + fd.write(xm.num('from', edgeindex[id_edge_from])) + fd.write(xm.num('to', edgeindex[id_edge_to])) fd.write(xm.num('lines', self.ids_veh.value[ind])) - #if self.cols.pos_edge_from[ind]>0: + # if self.cols.pos_edge_from[ind]>0: # fd.write(xm.num('departPos', self.cols.pos_edge_from[ind])) - #if self.cols.pos_edge_to[ind]>0: + # if self.cols.pos_edge_to[ind]>0: # fd.write(xm.num('arrivalPos', self.cols.pos_edge_to[ind])) - - fd.write(xm.stopit())# ends stage - + + fd.write(xm.stopit()) # ends stage + + class Walks(StageTypeMixin): - def __init__(self, ident,population, edges, name='Walks', info= 'walk from a position on a lane to another position of another lane.'): - self.init_stagetype(ident, population, name=name, info = info) - + + def __init__(self, ident, population, edges, name='Walks', info='walk from a position on a lane to another position of another lane.'): + self.init_stagetype(ident, population, name=name, info=info) + # TODO: this structure needs review: the private vehicle is part of a person, not a stage - # street parking at home and work could be in stage. Private garage is part of person... - self.add_col(am.IdsArrayConf( 'ids_edge_from', edges, - groupnames = ['state'], - name = 'ID Dep. edge', - info = 'Edge ID at departure of walk.', - )) - - self.add_col(am.IdsArrayConf( 'ids_edge_to', edges, - groupnames = ['state'], - name = 'ID Arr. edge', - info = 'Edge ID where walk finishes.', - )) - - self.add_col(am.ArrayConf( 'positions_from', 0.0, - dtype=np.float32, - #choices = OPTIONMAP_POS_DEPARTURE, - perm='r', - name = 'Depart pos', - unit = 'm', - info = "Position on edge at the moment of departure.", - xmltag = 'departPos', - #xmlmap = get_inversemap(OPTIONMAP_POS_ARRIVAL), - )) - - self.add_col(am.ArrayConf( 'positions_to', 0.0, - dtype=np.float32, - #choices = OPTIONMAP_POS_ARRIVAL, - perm='r', - name = 'Arrival pos', - unit = 'm', - info = "Position on edge at the moment of arrival.", - xmltag = 'arrivalPos', - #xmlmap = get_inversemap(OPTIONMAP_POS_ARRIVAL), - )) - - - - - - self.add_col(am.ArrayConf( 'speeds', 0.8, - dtype=np.float32, - #choices = OPTIONMAP_SPEED_ARRIVAL, - perm='r', - name = 'Walk speed', - unit = 'm/s', - info = 'Average walking speed.', - xmltag = 'speed', - #xmlmap = get_inversemap(OPTIONMAP_SPEED_ARRIVAL), - )) - - - def append_stage( self, id_plan, time_start=-1.0, - ids_edge = [], duration = None, + # street parking at home and work could be in stage. Private garage is + # part of person... + self.add_col(am.IdsArrayConf('ids_edge_from', edges, + groupnames=['state'], + name='ID Dep. edge', + info='Edge ID at departure of walk.', + )) + + self.add_col(am.IdsArrayConf('ids_edge_to', edges, + groupnames=['state'], + name='ID Arr. edge', + info='Edge ID where walk finishes.', + )) + + self.add_col(am.ArrayConf('positions_from', 0.0, + dtype=np.float32, + #choices = OPTIONMAP_POS_DEPARTURE, + perm='r', + name='Depart pos', + unit='m', + info="Position on edge at the moment of departure.", + xmltag='departPos', + #xmlmap = get_inversemap(OPTIONMAP_POS_ARRIVAL), + )) + + self.add_col(am.ArrayConf('positions_to', 0.0, + dtype=np.float32, + #choices = OPTIONMAP_POS_ARRIVAL, + perm='r', + name='Arrival pos', + unit='m', + info="Position on edge at the moment of arrival.", + xmltag='arrivalPos', + #xmlmap = get_inversemap(OPTIONMAP_POS_ARRIVAL), + )) + + self.add_col(am.ArrayConf('speeds', 0.8, + dtype=np.float32, + #choices = OPTIONMAP_SPEED_ARRIVAL, + perm='r', + name='Walk speed', + unit='m/s', + info='Average walking speed.', + xmltag='speed', + #xmlmap = get_inversemap(OPTIONMAP_SPEED_ARRIVAL), + )) + + def append_stage(self, id_plan, time_start=-1.0, + ids_edge=[], duration=None, **kwargs): - - id_stage, time_end = StageTypeMixin.append_stage(self, id_plan,time_start) - #print 'Walks.append_stage',id_stage - #print ' kwargs',kwargs - self.set_row( id_stage, - ids_edge_from = kwargs['id_edge_from'], - ids_edge_to = kwargs['id_edge_to'], - positions_from = kwargs['position_edge_from'], - positions_to = kwargs['position_edge_to'], - speeds = kwargs.get('speed', 0.8), - ) - - + + id_stage, time_end = StageTypeMixin.append_stage( + self, id_plan, time_start) + # print 'Walks.append_stage',id_stage + # print ' kwargs',kwargs + self.set_row(id_stage, + ids_edge_from=kwargs['id_edge_from'], + ids_edge_to=kwargs['id_edge_to'], + positions_from=kwargs['position_edge_from'], + positions_to=kwargs['position_edge_to'], + speeds=kwargs.get('speed', 0.8), + ) + return id_stage, time_end - - def to_xml(self, id_stage, fd, indent = 0): + + def to_xml(self, id_stage, fd, indent=0): #scenario = self.parent.get_scenario() #edges = scenario.net.edges - edgeindex = self.ids_edge_from.get_linktab().ids_sumo - ind = self.get_ind(id_stage) - fd.write(xm.start('walk',indent=indent)) - fd.write(xm.num('from', edgeindex[self.ids_edge_from.value[ind]] )) - fd.write(xm.num('to', edgeindex[self.ids_edge_to.value[ind]] )) - if self.positions_from.value[ind]>0: + edgeindex = self.ids_edge_from.get_linktab().ids_sumo + ind = self.get_ind(id_stage) + fd.write(xm.start('walk', indent=indent)) + fd.write(xm.num('from', edgeindex[self.ids_edge_from.value[ind]])) + fd.write(xm.num('to', edgeindex[self.ids_edge_to.value[ind]])) + if self.positions_from.value[ind] > 0: fd.write(xm.num('departPos', self.positions_from.value[ind])) - if self.positions_to[ind]>0: - fd.write(xm.num('arrivalPos', self.positions_to.value[ind] )) - - fd.write(xm.stopit())# ends walk + if self.positions_to[ind] > 0: + fd.write(xm.num('arrivalPos', self.positions_to.value[ind])) + + fd.write(xm.stopit()) # ends walk + class Activities(StageTypeMixin): - def __init__(self,ident,population, lanes,name='Activities'): - self.init_stagetype(ident, population, name = name, info = 'Do some activity at a position of a lane.') - + + def __init__(self, ident, population, lanes, name='Activities'): + self.init_stagetype(ident, population, name=name, + info='Do some activity at a position of a lane.') + # TODO: this structure needs review: the private vehicle is part of a person, not a stage - # street parking at home and work could be in stage. Private garage is part of person... - self.add_col(am.IdsArrayConf( 'id_lane', lanes, - groupnames = ['state'], - name = 'ID lane', - info = 'Lane ID at which activity takes place.', - )) - self.add_col(am.ArrayConf( 'pos_lane', 0.0, - name = 'Lane pos.', - - unit = 'm', - info = 'Position on Lane on where activity takes place.', - xml = 'pos_start', - )) - - - - self.add_col(am.ArrayConf( 'activity', '', - dtype = np.object, - name = 'Activity', - info = 'Type of activity performed during the stop.', - )) - - def to_xml(self, id_stage, fd, indent = 0): - + # street parking at home and work could be in stage. Private garage is + # part of person... + self.add_col(am.IdsArrayConf('id_lane', lanes, + groupnames=['state'], + name='ID lane', + info='Lane ID at which activity takes place.', + )) + self.add_col(am.ArrayConf('pos_lane', 0.0, + name='Lane pos.', + + unit='m', + info='Position on Lane on where activity takes place.', + xml='pos_start', + )) + + self.add_col(am.ArrayConf('activity', '', + dtype=np.object, + name='Activity', + info='Type of activity performed during the stop.', + )) + + def to_xml(self, id_stage, fd, indent=0): + # - - ind = self.get_ind(id_stage) - fd.write(xm.start('stop',indent=indent)) + + ind = self.get_ind(id_stage) + fd.write(xm.start('stop', indent=indent)) fd.write(xm.num('lane', self.cols.id_lane[ind])) fd.write(xm.num('startPos', self.cols.pos_lane[ind])) fd.write(xm.num('duration', self.cols.duration[ind])) fd.write(xm.num('actType', self.cols.activity[ind])) - - fd.write(xm.stopit())# ends activity + + fd.write(xm.stopit()) # ends activity class Virtualpolulation(am.ArrayObjman): + def __init__(self, demand, **kwargs): - self._init_objman( ident='virtualpop', - parent = demand, - name = 'Virtual polulation', - info = 'Contains information of each individual of the virtual population.', - #xmltag = ('plans','plan',None), - **kwargs) - + self._init_objman(ident='virtualpop', + parent=demand, + name='Virtual polulation', + info='Contains information of each individual of the virtual population.', + #xmltag = ('plans','plan',None), + **kwargs) + scenario = demand.get_scenario() - #-------------------------------------------------------------------- - # plans table - self.add(cm.ObjConf(Plans(self)) ) - #-------------------------------------------------------------------- - # individual vehicles table - self.add(cm.ObjConf(IndividualVehicles('individualvehicles',self, demand.vtypes, scenario.net.edges, scenario.landuse.parking)) ) - - - #-------------------------------------------------------------------- - # walks table + #-------------------------------------------------------------------- + # plans table + self.add(cm.ObjConf(Plans(self))) + #-------------------------------------------------------------------- + # individual vehicles table + self.add(cm.ObjConf(IndividualVehicles('individualvehicles', self, + demand.vtypes, scenario.net.edges, scenario.landuse.parking))) + + #-------------------------------------------------------------------- + # walks table #self.walks = self.add_tableman(Walks(self)) - self.add(cm.ObjConf(Walks('walks',self, scenario.net.edges)) ) - - - - #-------------------------------------------------------------------- - # rides table - self.add(cm.ObjConf(Rides('rides',self, scenario.landuse.parking)) ) - - - #-------------------------------------------------------------------- - # pt rides table - # self.add(cm.ObjConf(Transits(self, publictransport)) ) - - #-------------------------------------------------------------------- - # Activities table - self.add(cm.ObjConf(Activities('activities',self, scenario.net.lanes)) ) - - #-------------------------------------------------------------------- + self.add(cm.ObjConf(Walks('walks', self, scenario.net.edges))) + + #-------------------------------------------------------------------- + # rides table + self.add(cm.ObjConf(Rides('rides', self, scenario.landuse.parking))) + + #-------------------------------------------------------------------- + # pt rides table + # self.add(cm.ObjConf(Transits(self, publictransport)) ) + + #-------------------------------------------------------------------- + # Activities table + self.add( + cm.ObjConf(Activities('activities', self, scenario.net.lanes))) + + #-------------------------------------------------------------------- # misc params - # this is option for intermodal routing process - #self.add(AttrConf( 'dist_max_wait', kwargs.get('dist_max_wait',20.0), - # groupnames = ['options'], - # perm='wr', + # this is option for intermodal routing process + # self.add(AttrConf( 'dist_max_wait', kwargs.get('dist_max_wait',20.0), + # groupnames = ['options'], + # perm='wr', # unit = 'm', - # name = 'Max dist. Wait', + # name = 'Max dist. Wait', # info = 'The maximum distance between two stops or platforms, when a person during transfer is not walking, but just waiting for the next bus/train to come.' , # #xmltag = 'pos', # )) - #-------------------------------------------------------------------- + #-------------------------------------------------------------------- # columns - - self.add_col(am.ArrayConf( 'identification ', '', - dtype = np.object, - name = 'Name', - info = 'Identification or name of person.', - )) - - self.add_col(am.IdsArrayConf( 'ids_fac_home', scenario.landuse.facilities, - groupnames = ['state'], - name = 'ID home fac.', - info = 'Facility ID of home.', - )) - - - self.add_col(am.IdsArrayConf( 'ids_fac_activity', scenario.landuse.facilities, - groupnames = ['state'], - name = 'ID activity fac.', - info = 'Facility ID of location of main activity (work, study).', - )) - - self.add_col(am.IdsArrayConf( 'ids_mode_preferred', scenario.net.modes, - name = 'ID preferred mode', - info = 'ID of preferred transport mode of person.', - )) - - - - - self.add_col(am.ArrayConf( 'times_start', 0, - name = 'Start time', - unit = 's', - info = 'Time when person leaves home facility for doing some activity.', - )) - + + self.add_col(am.ArrayConf('identification ', '', + dtype=np.object, + name='Name', + info='Identification or name of person.', + )) + + self.add_col(am.IdsArrayConf('ids_fac_home', scenario.landuse.facilities, + groupnames=['state'], + name='ID home fac.', + info='Facility ID of home.', + )) + + self.add_col(am.IdsArrayConf('ids_fac_activity', scenario.landuse.facilities, + groupnames=['state'], + name='ID activity fac.', + info='Facility ID of location of main activity (work, study).', + )) + + self.add_col(am.IdsArrayConf('ids_mode_preferred', scenario.net.modes, + name='ID preferred mode', + info='ID of preferred transport mode of person.', + )) + + self.add_col(am.ArrayConf('times_start', 0, + name='Start time', + unit='s', + info='Time when person leaves home facility for doing some activity.', + )) + # this could be extended to a list with more plans - self.add_col(am.IdsArrayConf( 'ids_plan', self.get_plans(), - name = 'ID Plan', - info = 'Currently best mobility plan ID of person.', - )) - - self.add_col(am.IdlistsArrayConf( 'lists_ids_plan', self.get_plans(), - name = 'IDs Plans', - info = 'List with the IDs of feasible mobility plans.', - )) - + self.add_col(am.IdsArrayConf('ids_plan', self.get_plans(), + name='ID Plan', + info='Currently best mobility plan ID of person.', + )) + + self.add_col(am.IdlistsArrayConf('lists_ids_plan', self.get_plans(), + name='IDs Plans', + info='List with the IDs of feasible mobility plans.', + )) + def get_plans(self): return self.plans.get_value() - + def get_individualvehicles(self): return self.individualvehicles.get_value() - + def get_landuse(self): return self.parent.get_scenario().landuse + def get_scenario(self): return self.parent.get_scenario() - def disaggregate_odflow(self, time_start, time_end, id_mode, - id_zone_orig, id_zone_dest,tripnumber, - probs_fac, ids_fac, - id_landusetype_orig, - id_landusetype_dest,): - print 'disaggregate_odflow',time_start, time_end, id_mode, id_zone_orig, id_zone_dest,tripnumber + + def disaggregate_odflow(self, time_start, time_end, id_mode, + id_zone_orig, id_zone_dest, tripnumber, + probs_fac, ids_fac, + id_landusetype_orig, + id_landusetype_dest,): + print 'disaggregate_odflow', time_start, time_end, id_mode, id_zone_orig, id_zone_dest, tripnumber """ Disaggregation of demand dem from taz id_zone_orig to id_zone_dest with id_mode during time interval time_start,time_end, and creation of persons @@ -693,364 +662,383 @@ probs_fac, ids_fac = landuse.get_departure_probabilities() """ - print 'disaggregate_odm',tripnumber, id_mode,id_zone_orig,id_zone_dest + print 'disaggregate_odm', tripnumber, id_mode, id_zone_orig, id_zone_dest probs_orig = probs_fac[id_zone_orig][id_landusetype_orig] probs_dest = probs_fac[id_zone_dest][id_landusetype_dest] - - print ' probs_orig',sum(probs_orig)#,'\n',probs_orig - print ' probs_dest',sum(probs_dest)#,'\n',probs_dest - + + print ' probs_orig', sum(probs_orig) # ,'\n',probs_orig + print ' probs_dest', sum(probs_dest) # ,'\n',probs_dest + # is there a chance to find facilities to locate persons in # origin and destination zone - #print ' ',self.times_start.value.dtype,np.random.randint(time_start,time_end,tripnumber) - #print ' ',self.ids_mode_preferred.value.dtype,id_mode * np.ones(tripnumber, np.int32), - if (np.sum(probs_orig) > 0)&(np.sum(probs_dest) > 0): - return self.add_rows( n=tripnumber, - ids_fac_home = ids_fac[random_choice(tripnumber, probs_orig)], - ids_fac_activity = ids_fac[random_choice(tripnumber, probs_dest)], - ids_mode_preferred = id_mode * np.ones(tripnumber, dtype=np.int32), - times_start = np.random.randint(time_start,time_end,tripnumber) - ) + # print ' ',self.times_start.value.dtype,np.random.randint(time_start,time_end,tripnumber) + # print ' ',self.ids_mode_preferred.value.dtype,id_mode * + # np.ones(tripnumber, np.int32), + if (np.sum(probs_orig) > 0) & (np.sum(probs_dest) > 0): + return self.add_rows(n=tripnumber, + ids_fac_home=ids_fac[ + random_choice(tripnumber, probs_orig)], + ids_fac_activity=ids_fac[ + random_choice(tripnumber, probs_dest)], + ids_mode_preferred=id_mode * + np.ones(tripnumber, dtype=np.int32), + times_start=np.random.randint( + time_start, time_end, tripnumber) + ) else: return [] - - - def create_pop_from_ods(self, landusetype_orig = 'residential',landusetype_dest='industrial'): + + def create_pop_from_ods(self, landusetype_orig='residential', landusetype_dest='industrial'): print 'create_pop_from_ods' demand = self.parent odflowtab = demand.odintervals.generate_odflows() - - probs_fac, ids_fac = self.get_landuse().facilities.get_departure_probabilities() + + probs_fac, ids_fac = self.get_landuse( + ).facilities.get_departure_probabilities() landusetypes = self.get_landuse().landusetypes - + for id_flow in odflowtab.get_ids(): - self.disaggregate_odflow( odflowtab.times_start[id_flow], - odflowtab.times_end[id_flow], - odflowtab.ids_mode[id_flow], - odflowtab.ids_orig[id_flow], - odflowtab.ids_dest[id_flow], - odflowtab.tripnumbers[id_flow], - probs_fac, ids_fac, - landusetypes.typekeys.get_id_from_index(landusetype_orig), - landusetypes.typekeys.get_id_from_index(landusetype_dest), - #landusetype_orig = 'residential', - #landusetype_dest = 'industrial', - #od_factypes=('residential','industrial','commercial','leisure')# no!! - #od_factypes=('residential','industrial') - ) - #return odflowtab - + self.disaggregate_odflow(odflowtab.times_start[id_flow], + odflowtab.times_end[id_flow], + odflowtab.ids_mode[id_flow], + odflowtab.ids_orig[id_flow], + odflowtab.ids_dest[id_flow], + odflowtab.tripnumbers[id_flow], + probs_fac, ids_fac, + landusetypes.typekeys.get_id_from_index( + landusetype_orig), + landusetypes.typekeys.get_id_from_index( + landusetype_dest), + #landusetype_orig = 'residential', + #landusetype_dest = 'industrial', + # od_factypes=('residential','industrial','commercial','leisure')# no!! + # od_factypes=('residential','industrial') + ) + # return odflowtab + def get_route_between_parking(self, id_parking_from, id_parking_to, id_veh=-1): - """ - Return route and distance of ride with vehicle type vtype - between id_parking_from and id_parking_to - - """ - #print 'get_route_between_parking',id_parking_from, id_parking_to - scenario = self.parent.get_scenario() - edges = scenario.net.edges - lanes = scenario.net.lanes - #print self.get_demand().getVehicles().cols.maxSpeed - #v_max = self.get_demand().getVehicles().maxSpeed.get(vtype) - parking = scenario.landuse.parking - - ids_lanes = parking.ids_lane[[id_parking_from, id_parking_to]] - id_edge_from, id_edge_to = lanes.ids_edge[ids_lanes] - pos_from, pos_to = parking.positions[[id_parking_from, id_parking_to]] - - - #print ' id_edge_from, id_edge_to=',id_edge_from, id_edge_to - costs, tree = routing.edgedijkstra(id_edge_from,scenario.net.nodes, scenario.net.edges, set([id_edge_to,])) - dist, route = routing.get_mincostroute_edge2edge(id_edge_from,id_edge_to, costs, tree) - - - - # here is a big problem: starting with the successive node of edge_from - # may result that the first edge of the route is not connected with edge_from - # And arriving at the preceding node of edge_to may result that from - # the last edge in route the edge_to is not connected. - - - - #route = [edge_from]+route+[edge_to] - dist = dist - pos_from - ( edges.lengths[id_edge_to] - pos_to) - #print 'get_route_between_parking', dist,type(route),route#[-1].getLength() - #print ' pos_from ,pos_to ', pos_from ,pos_to v=s/t - - # TODO: this should be a method of edges, icluding position and id_mode - duration_approx = np.sum(edges.lengths[route] /edges.speeds_max[route]) - - return route, dist, duration_approx - - - def get_route(self, id_edge_from, id_edge_to,pos_from, pos_to, id_mode = -1): - print 'get_route',id_edge_from, id_edge_to + """ + Return route and distance of ride with vehicle type vtype + between id_parking_from and id_parking_to + + """ + # print 'get_route_between_parking',id_parking_from, id_parking_to + scenario = self.parent.get_scenario() + edges = scenario.net.edges + lanes = scenario.net.lanes + # print self.get_demand().getVehicles().cols.maxSpeed + #v_max = self.get_demand().getVehicles().maxSpeed.get(vtype) + parking = scenario.landuse.parking + + ids_lanes = parking.ids_lane[[id_parking_from, id_parking_to]] + id_edge_from, id_edge_to = lanes.ids_edge[ids_lanes] + pos_from, pos_to = parking.positions[[id_parking_from, id_parking_to]] + + # print ' id_edge_from, id_edge_to=',id_edge_from, id_edge_to + costs, tree = routing.edgedijkstra( + id_edge_from, scenario.net.nodes, scenario.net.edges, set([id_edge_to, ])) + dist, route = routing.get_mincostroute_edge2edge( + id_edge_from, id_edge_to, costs, tree) + + # here is a big problem: starting with the successive node of edge_from + # may result that the first edge of the route is not connected with edge_from + # And arriving at the preceding node of edge_to may result that from + # the last edge in route the edge_to is not connected. + + #route = [edge_from]+route+[edge_to] + dist = dist - pos_from - (edges.lengths[id_edge_to] - pos_to) + # print 'get_route_between_parking', dist,type(route),route#[-1].getLength() + # print ' pos_from ,pos_to ', pos_from ,pos_to v=s/t + + # TODO: this should be a method of edges, icluding position and id_mode + duration_approx = np.sum( + edges.lengths[route] / edges.speeds_max[route]) + + return route, dist, duration_approx + + def get_route(self, id_edge_from, id_edge_to, pos_from, pos_to, id_mode=-1): + print 'get_route', id_edge_from, id_edge_to scenario = self.parent.get_scenario() edges = scenario.net.edges #lanes = scenario.net.lanes - costs, tree = routing.edgedijkstra(id_edge_from,scenario.net.nodes, edges, set([id_edge_to,])) - dist, route = routing.get_mincostroute_edge2edge(id_edge_from,id_edge_to, costs, tree) + costs, tree = routing.edgedijkstra( + id_edge_from, scenario.net.nodes, edges, set([id_edge_to, ])) + dist, route = routing.get_mincostroute_edge2edge( + id_edge_from, id_edge_to, costs, tree) dists = edges.lengths[route] - + # TODO: this should be a method of edges, icluding position and id_mode - durations_approx = dists/edges.speeds_max[route] + durations_approx = dists / edges.speeds_max[route] return route, dists, durations_approx - + def add_plans(self, ids_person): - ids_plan = self.plans.value.add_rows(n = len(ids_person),ids_person = ids_person) - self.ids_plan[ids_person] = 1*ids_plan - for id_person, id_plan in zip(ids_person,ids_plan): + ids_plan = self.plans.value.add_rows( + n=len(ids_person), ids_person=ids_person) + self.ids_plan[ids_person] = 1 * ids_plan + for id_person, id_plan in zip(ids_person, ids_plan): if self.lists_ids_plan[id_person] == None: self.lists_ids_plan[id_person] = [id_plan] else: self.lists_ids_plan[id_person].append(id_plan) return ids_plan - - def make_plans_private(self, ids_person = None): - - + + def make_plans_private(self, ids_person=None): + if ids_person == None: - #print ' ids_mode_preferred',self.ids_mode_preferred.value - #print ' private',MODES['private'] - #print ' ',self.ids_mode_preferred == MODES['private'] - - ids_person = self.select_ids(self.ids_mode_preferred.value == MODES['private']) - + # print ' ids_mode_preferred',self.ids_mode_preferred.value + # print ' private',MODES['private'] + # print ' ',self.ids_mode_preferred == MODES['private'] + + ids_person = self.select_ids( + self.ids_mode_preferred.value == MODES['private']) + ids_plan = self.add_plans(ids_person) - + n_plans = len(ids_plan) - - - - print 'make_plans_private n_plans=',n_plans + + print 'make_plans_private n_plans=', n_plans landuse = self.get_landuse() facilities = landuse.facilities parking = landuse.parking - + scenario = self.parent.get_scenario() #edges = scenario.net.edges lanes = scenario.net.lanes # experimental: give all persons a car - #print ' self.plans.cols.id_person',self.plans.cols.id_person - #print ' self.plans.cols.probab',self.plans.cols.probab - #print ' self.plans.cols.stages',self.plans.cols.stages + # print ' self.plans.cols.id_person',self.plans.cols.id_person + # print ' self.plans.cols.probab',self.plans.cols.probab + # print ' self.plans.cols.stages',self.plans.cols.stages # create an individual vehicle for each person - # here vehicle is created for id_pers, type variations dependent on person can be made - #print ' ids_vtype',self.parent.vtypes.ids_sumo.get_id_from_index('passenger1') - ids_veh = self.individualvehicles.value.add_rows(n = n_plans, - ids_person = ids_person, - ids_vtype = self.parent.vtypes.ids_sumo.get_id_from_index('passenger1')*np.ones(n_plans), - ) - + # here vehicle is created for id_pers, type variations dependent on person can be made + # print ' + # ids_vtype',self.parent.vtypes.ids_sumo.get_id_from_index('passenger1') + ids_veh = self.individualvehicles.value.add_rows(n=n_plans, + ids_person=ids_person, + ids_vtype=self.parent.vtypes.ids_sumo.get_id_from_index( + 'passenger1') * np.ones(n_plans), + ) + inds_pers = self.get_inds(ids_person) - #self.persons.cols.mode_preferred[inds_pers]='private' - + # self.persons.cols.mode_preferred[inds_pers]='private' + times_start = self.times_start.value[inds_pers] inds_fac_home = facilities.get_inds(self.ids_fac_home.value[inds_pers]) - inds_fac_activity = facilities.get_inds(self.ids_fac_activity.value[inds_pers]) - + inds_fac_activity = facilities.get_inds( + self.ids_fac_activity.value[inds_pers]) + centroids_home = facilities.centroids.value[inds_fac_home] centroids_activity = facilities.centroids.value[inds_fac_activity] - + ids_edge_home = facilities.ids_roadedge_closest.value[inds_fac_home] - poss_edge_home = facilities.positions_roadedge_closest.value[inds_fac_home] - + poss_edge_home = facilities.positions_roadedge_closest.value[ + inds_fac_home] + # this method will find and occupy parking space - ids_parking_home, inds_parking_home = parking.assign_parking(ids_veh, centroids_home) - ids_parking_activity, inds_parking_activity = parking.assign_parking(ids_veh, centroids_activity) - - + ids_parking_home, inds_parking_home = parking.assign_parking( + ids_veh, centroids_home) + ids_parking_activity, inds_parking_activity = parking.assign_parking( + ids_veh, centroids_activity) + ids_lane_parking_home = parking.ids_lane.value[inds_parking_home] ids_edge_parking_home = lanes.ids_edge[ids_lane_parking_home] poss_edge_parking_home = parking.positions.value[inds_parking_home] - - ids_lane_parking_activity = parking.ids_lane.value[inds_parking_activity] + + ids_lane_parking_activity = parking.ids_lane.value[ + inds_parking_activity] ids_edge_parking_activity = lanes.ids_edge[ids_lane_parking_activity] - poss_edge_parking_activity = parking.positions.value[inds_parking_activity] - - ids_edge_activity = facilities.ids_roadedge_closest.value[inds_fac_activity] - poss_edge_activity = facilities.positions_roadedge_closest.value[inds_fac_activity] - - i=0 - for id_person, id_plan, time_start, id_veh, id_edge_home, pos_edge_home, id_edge_parking_home, pos_edge_parking_home, id_parking_home, id_parking_activity, id_edge_parking_activity,pos_edge_parking_activity, id_edge_activity, pos_edge_activity\ - in zip(ids_person, ids_plan, times_start, ids_veh, ids_edge_home, poss_edge_home, ids_edge_parking_home, poss_edge_parking_home, ids_parking_home, ids_parking_activity, ids_edge_parking_activity, poss_edge_parking_activity, ids_edge_activity, poss_edge_activity): - self.plans.value.set_row(id_plan, ids_person = id_person) - + poss_edge_parking_activity = parking.positions.value[ + inds_parking_activity] + + ids_edge_activity = facilities.ids_roadedge_closest.value[ + inds_fac_activity] + poss_edge_activity = facilities.positions_roadedge_closest.value[ + inds_fac_activity] + + i = 0 + for id_person, id_plan, time_start, id_veh, id_edge_home, pos_edge_home, id_edge_parking_home, pos_edge_parking_home, id_parking_home, id_parking_activity, id_edge_parking_activity, pos_edge_parking_activity, id_edge_activity, pos_edge_activity\ + in zip(ids_person, ids_plan, times_start, ids_veh, ids_edge_home, poss_edge_home, ids_edge_parking_home, poss_edge_parking_home, ids_parking_home, ids_parking_activity, ids_edge_parking_activity, poss_edge_parking_activity, ids_edge_activity, poss_edge_activity): + self.plans.value.set_row(id_plan, ids_person=id_person) + time = time_start # prerouting car trip to see whether work place is accessible or whether it is worth while taking the car # TODO...we have already identified parking edges!! - ids_edge_car, dists_car, duration_approx_car = self.get_route_between_parking(id_parking_home, id_parking_activity, id_veh) - print 79*'_' - print ' id_plan=%d, id_person=%d, ids_veh=%d, n_edges=%d'%(id_plan, id_person, id_veh,len(ids_edge_car)) - if len(ids_edge_car)>0: # simple check for reachibility of destination - #print ' found route between parling duration_approx_car',duration_approx_car + ids_edge_car, dists_car, duration_approx_car = self.get_route_between_parking( + id_parking_home, id_parking_activity, id_veh) + print 79 * '_' + print ' id_plan=%d, id_person=%d, ids_veh=%d, n_edges=%d' % (id_plan, id_person, id_veh, len(ids_edge_car)) + # simple check for reachibility of destination + if len(ids_edge_car) > 0: + # print ' found route between parling duration_approx_car',duration_approx_car # preroute walking - ids_edge_walk, dists_walk, durations_walk = self.get_route(id_edge_parking_activity, id_edge_activity,pos_edge_home, pos_edge_activity,id_mode = MODES['pedestrian']) - + ids_edge_walk, dists_walk, durations_walk = self.get_route( + id_edge_parking_activity, id_edge_activity, pos_edge_home, pos_edge_activity, id_mode=MODES['pedestrian']) + # walk from nearest street at home facility to car parking - ids_edge_walk, dists_walk, durations_walk = self.get_route(id_edge_home, id_edge_parking_home,pos_edge_home, pos_edge_parking_home,id_mode = MODES['pedestrian']) - id_stage,time = self.walks.value.append_stage( id_plan, time, duration = sum( durations_walk), - id_edge_from = id_edge_home, position_edge_from = pos_edge_home, - id_edge_to = id_edge_parking_home, position_edge_to = pos_edge_parking_home-7.0, - ) - - #self.append_stage( id_plan, self.walks, - # id_edge_from = id_edge_home, pos_edge_from = pos_edge_home, - # id_edge_to = id_edge_parking, pos_edge_to = pos_parking, + ids_edge_walk, dists_walk, durations_walk = self.get_route( + id_edge_home, id_edge_parking_home, pos_edge_home, pos_edge_parking_home, id_mode=MODES['pedestrian']) + id_stage, time = self.walks.value.append_stage(id_plan, time, duration=sum(durations_walk), + id_edge_from=id_edge_home, position_edge_from=pos_edge_home, + id_edge_to=id_edge_parking_home, position_edge_to=pos_edge_parking_home - + 7.0, + ) + + # self.append_stage( id_plan, self.walks, + # id_edge_from = id_edge_home, pos_edge_from = pos_edge_home, + # id_edge_to = id_edge_parking, pos_edge_to = pos_parking, # speed = self.speed_walking) - + # ride from car parking to road edge near activity - id_stage,time =self.rides.value.append_stage( id_plan, time, - id_veh = id_veh, - ids_edge = ids_edge_car, - duration = duration_approx_car, - id_parking_from = id_parking_home, - id_parking_to =id_parking_activity, - ) - # walk from car parking to activity facility - ids_edge_walk, dists_walk, durations_walk = self.get_route(id_edge_parking_activity, id_edge_activity,pos_edge_home, pos_edge_activity,id_mode = MODES['pedestrian']) - - id_stage,time =self.walks.value.append_stage( id_plan, time, duration = sum( durations_walk), - id_edge_from = id_edge_parking_activity, position_edge_from = pos_edge_parking_activity-7.0, - id_edge_to = id_edge_activity, position_edge_to = pos_edge_activity, - ) + id_stage, time = self.rides.value.append_stage(id_plan, time, + id_veh=id_veh, + ids_edge=ids_edge_car, + duration=duration_approx_car, + id_parking_from=id_parking_home, + id_parking_to=id_parking_activity, + ) + # walk from car parking to activity facility + ids_edge_walk, dists_walk, durations_walk = self.get_route( + id_edge_parking_activity, id_edge_activity, pos_edge_home, pos_edge_activity, id_mode=MODES['pedestrian']) + + id_stage, time = self.walks.value.append_stage(id_plan, time, duration=sum(durations_walk), + id_edge_from=id_edge_parking_activity, position_edge_from=pos_edge_parking_activity - + 7.0, + id_edge_to=id_edge_activity, position_edge_to=pos_edge_activity, + ) else: print ' no route between parking, better walk.' - - - def export_sumoxml(self, filepath=None, encoding = 'UTF-8'): + + def export_sumoxml(self, filepath=None, encoding='UTF-8'): """ Export trips to SUMO xml file. """ if filepath == None: filepath = self.get_tripfilepath() - print 'export_sumoxml',filepath + print 'export_sumoxml', filepath try: - fd=open(filepath,'w') + fd = open(filepath, 'w') except: - print 'WARNING in write_obj_to_xml: could not open',filepath + print 'WARNING in write_obj_to_xml: could not open', filepath return False #xmltag, xmltag_item, attrname_id = self.xmltag - fd.write('\n'%encoding) + fd.write('\n' % encoding) fd.write(xm.begin('routes')) indent = 2 - + #ids_modes_used = set(self.parent.vtypes.ids_mode[self.ids_vtype.get_value()]) #---------------------- # write vtypes, pedestrian included ids_vtypes = set(self.individualvehicles.value.ids_vtype.get_value()) - #print ' vtypes',vtypes + # print ' vtypes',vtypes #vtypes = vtypes.union(ptlines.get_vtypes()) - #print ' vtypes',vtypes + # print ' vtypes',vtypes ids_vtypes.add(MODES['pedestrian']) - self.parent.vtypes.write_xml( fd, indent=indent, - ids = ids_vtypes, - is_print_begin_end = False) - + self.parent.vtypes.write_xml(fd, indent=indent, + ids=ids_vtypes, + is_print_begin_end=False) + self._export_plans(fd, indent) - + fd.write(xm.end('routes')) fd.close() return filepath - - def _export_plans(self, fd, indent = 0): - if len(self)==0: return - + + def _export_plans(self, fd, indent=0): + if len(self) == 0: + return + scenario = self.parent.get_scenario() edges = scenario.net.edges lanes = scenario.net.lanes landuse = self.get_landuse() - #ptlines=self.get_ptlines() - persons = self# instance holding all arrays for persons - ivehs = self.individualvehicles.value # instance holding all arrays for individual vehicles - parking = landuse.parking # instance holding all arrays for parking + # ptlines=self.get_ptlines() + persons = self # instance holding all arrays for persons + # instance holding all arrays for individual vehicles + ivehs = self.individualvehicles.value + parking = landuse.parking # instance holding all arrays for parking plans = self.plans.value - - + # sort users by initial time - #print ' persons.times_start.value',persons.times_start.value - #print ' persons.get_inds()',persons.get_inds() - times_sorted = np.concatenate((persons.times_start.value.reshape(-1,1), persons.get_inds().reshape(-1,1) ),1).tolist() + # print ' persons.times_start.value',persons.times_start.value + # print ' persons.get_inds()',persons.get_inds() + times_sorted = np.concatenate( + (persons.times_start.value.reshape(-1, 1), persons.get_inds().reshape(-1, 1)), 1).tolist() times_sorted.sort() - #print ' times_sorted',times_sorted - inds_pers = np.array(times_sorted,int)[:,1] - #print ' inds_pers',inds_pers - - time_first,ind_first = times_sorted[0]# used to start first vehcile appearance - - vehindex = self.parent.vtypes.ids_sumo #vehindex.get_index_from_ids() + # print ' times_sorted',times_sorted + inds_pers = np.array(times_sorted, int)[:, 1] + # print ' inds_pers',inds_pers + + # used to start first vehcile appearance + time_first, ind_first = times_sorted[0] + + vehindex = self.parent.vtypes.ids_sumo # vehindex.get_index_from_ids() edgeindex = edges.ids_sumo # pt - #self.parent.get_ptlines().to_routes(fd,2) - + # self.parent.get_ptlines().to_routes(fd,2) + #---------------------- # write vehicles first inds_veh = ivehs.get_inds() - for id_veh, id_vtype, ids_edge, ids_parking in zip( ivehs.get_ids(inds_veh), ivehs.ids_vtype.value[inds_veh], ivehs.routes.value[inds_veh], ivehs.ids_parkings.value[inds_veh] ): - if (ids_edge != None) & (ids_parking!=None): - if len(ids_edge)>0: - #print " vehicle id=", id_veh,ids_edge, ids_parking - - inds_parking = parking.get_inds(ids_parking) - # first depart position equals position of first parking - pos_depart = parking.positions.value[inds_parking][0]# get pos of first parking - - fd.write(xm.start('vehicle id="%s"'%id_veh,indent+2)) - fd.write(xm.num('depart', '%.1f'%time_first)) - fd.write(xm.num('type', vehindex[id_vtype] )) - fd.write(xm.stop()) - - # write route - fd.write(xm.start('route',indent+4)) - fd.write(xm.arr('edges',edgeindex[ids_edge],indent+6)) - fd.write(xm.num('departPos', pos_depart)) - # depart lane is 1 , 0 would be on the side-walk) - fd.write(xm.num('departLane', lanes.indexes[ parking.ids_lane[ids_parking[0] ] ] ) ) + for id_veh, id_vtype, ids_edge, ids_parking in zip(ivehs.get_ids(inds_veh), ivehs.ids_vtype.value[inds_veh], ivehs.routes.value[inds_veh], ivehs.ids_parkings.value[inds_veh]): + if (ids_edge != None) & (ids_parking != None): + if len(ids_edge) > 0: + # print " vehicle id=", id_veh,ids_edge, ids_parking + + inds_parking = parking.get_inds(ids_parking) + # first depart position equals position of first parking + pos_depart = parking.positions.value[ + inds_parking][0] # get pos of first parking + + fd.write(xm.start('vehicle id="%s"' % id_veh, indent + 2)) + fd.write(xm.num('depart', '%.1f' % time_first)) + fd.write(xm.num('type', vehindex[id_vtype])) + fd.write(xm.stop()) + + # write route + fd.write(xm.start('route', indent + 4)) + fd.write(xm.arr('edges', edgeindex[ids_edge], indent + 6)) + fd.write(xm.num('departPos', pos_depart)) + # depart lane is 1 , 0 would be on the side-walk) + fd.write(xm.num('departLane', lanes.indexes[ + parking.ids_lane[ids_parking[0]]])) + fd.write(xm.stopit()) + + # write stops + ids_lane_parking = parking.ids_lane.value[inds_parking] + ids_edge_parking = lanes.ids_edge[ids_lane_parking] + laneindexes_parking = lanes.indexes[ids_lane_parking] + + poss_end_parking = parking.positions[inds_parking] + poss_start_parking = poss_end_parking - \ + parking.lengths[inds_parking] + for id_edge_parking, laneindex_parking, pos_start_parking, pos_end_parking in zip(ids_edge_parking, laneindexes_parking, poss_start_parking, poss_end_parking): + fd.write(xm.start('stop', indent + 4)) + fd.write(xm.num('lane', edges.ids_sumo[ + id_edge_parking] + '_%d' % laneindex_parking)) + fd.write(xm.num('duration', 3000)) + fd.write(xm.num('startPos', pos_start_parking)) + fd.write(xm.num('endPos', pos_end_parking)) + fd.write(xm.num('triggered', "True")) fd.write(xm.stopit()) - - # write stops - ids_lane_parking = parking.ids_lane.value[inds_parking] - ids_edge_parking = lanes.ids_edge[ids_lane_parking] - laneindexes_parking = lanes.indexes[ids_lane_parking] - - - - poss_end_parking = parking.positions[inds_parking] - poss_start_parking = poss_end_parking - parking.lengths[inds_parking] - for id_edge_parking,laneindex_parking,pos_start_parking, pos_end_parking in zip(ids_edge_parking,laneindexes_parking,poss_start_parking,poss_end_parking): - fd.write(xm.start('stop',indent+4)) - fd.write(xm.num('lane', edges.ids_sumo[id_edge_parking]+'_%d'%laneindex_parking )) - fd.write(xm.num('duration', 3000)) - fd.write(xm.num('startPos', pos_start_parking)) - fd.write(xm.num('endPos', pos_end_parking)) - fd.write(xm.num('triggered', "True")) - fd.write(xm.stopit()) - - fd.write(xm.end('vehicle',indent+2)) - + + fd.write(xm.end('vehicle', indent + 2)) + #---------------------- # write plans - - - #print ' inds_pers',inds_pers - #print ' times_start[inds_pers]',persons.times_start.value[inds_pers] - for time_start, id_pers, stages in zip(persons.times_start.value[inds_pers],persons.get_ids(inds_pers),plans.stagelists[persons.ids_plan.value[inds_pers]]): - print ' time_start,id_pers',time_start,id_pers,stages!=None - if stages!=None: + + # print ' inds_pers',inds_pers + # print ' times_start[inds_pers]',persons.times_start.value[inds_pers] + for time_start, id_pers, stages in zip(persons.times_start.value[inds_pers], persons.get_ids(inds_pers), plans.stagelists[persons.ids_plan.value[inds_pers]]): + print ' time_start,id_pers', time_start, id_pers, stages != None + if stages != None: # TODO: self.persons.to_xml()??..pass all attrs? - fd.write(xm.start('person',indent=indent+2)) - fd.write(xm.num('id',id_pers)) - fd.write(xm.num('depart',time_start)) - fd.write(xm.num('type','pedestrian')) + fd.write(xm.start('person', indent=indent + 2)) + fd.write(xm.num('id', id_pers)) + fd.write(xm.num('depart', time_start)) + fd.write(xm.num('type', 'pedestrian')) fd.write(xm.stop()) - + for stage, id_stage in stages: - stage.to_xml(id_stage, fd,indent+4) - - fd.write(xm.end('person',indent=indent+2)) - - - - - \ No newline at end of file + stage.to_xml(id_stage, fd, indent + 4) + + fd.write(xm.end('person', indent=indent + 2)) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/wxgui.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/wxgui.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/wxgui.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/demand/wxgui.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,330 +6,315 @@ from agilepy.lib_wx.ogleditor import * from agilepy.lib_base.processes import Process from agilepy.lib_wx.processdialog import ProcessDialog -import demand,turnflows +import demand +import turnflows import origin_to_destination_wxgui as odgui - - - class TripDrawings(Polygons): + def __init__(self, facilities, parent, **kwargs): - - - Polygons.__init__( self,'facilitydraws', parent, - name = 'Facility drawings', - linewidth = 1, - detectwidth = 3.0, - **kwargs) - - - - - + Polygons.__init__(self, 'facilitydraws', parent, + name='Facility drawings', + linewidth=1, + detectwidth=3.0, + **kwargs) + self.delete('vertices') - - - self.add(cm.AttrConf( 'color_facility_default', np.array([0.921875, 0.78125 , 0.4375 , 1.0], np.float32), - groupnames = ['options'], - perm='wr', - metatype = 'color', - name = 'Default color', - info = 'Default facility color.', - )) - - - + + self.add(cm.AttrConf('color_facility_default', np.array([0.921875, 0.78125, 0.4375, 1.0], np.float32), + groupnames=['options'], + perm='wr', + metatype='color', + name='Default color', + info='Default facility color.', + )) + self.set_facilities(facilities) - - + def get_netelement(self): return self._facilities - + def get_vertices_array(self): return self._facilities.shapes.value[self._inds_map] - + def set_facilities(self, facilities): - #print '\nset_facilities',facilities.get_ids() + # print '\nset_facilities',facilities.get_ids() self._facilities = facilities - if len(self)>0: + if len(self) > 0: self.del_rows(self.get_ids()) - + ids = self._facilities.get_ids() self._inds_map = self._facilities.get_inds(ids) - self.add_rows(ids = ids) + self.add_rows(ids=ids) self.update() - - def update(self, is_update = True): + + def update(self, is_update=True): # assumes that arrsy structure did not change - #print 'FacilityDrawings.update' - n = len(self) - self.colors.value[:] = np.ones((n,4),np.float32)*self.color_facility_default.value + # print 'FacilityDrawings.update' + n = len(self) + self.colors.value[:] = np.ones( + (n, 4), np.float32) * self.color_facility_default.value self.colors_highl.value[:] = self._get_colors_highl(self.colors.value) - + landusetypes = self._facilities.get_landusetypes() ids_landusetype = self._facilities.ids_landusetype.value for id_landusetype in landusetypes.get_ids(): #inds = np.flatnonzero(ids_landusetype == id_landusetype) #color = landusetypes.colors[id_landusetype] #self.colors.value[self._inds_map[inds]] = color - self.colors.value[self._inds_map[np.flatnonzero(ids_landusetype == id_landusetype)]] = landusetypes.colors[id_landusetype] - + self.colors.value[self._inds_map[np.flatnonzero( + ids_landusetype == id_landusetype)]] = landusetypes.colors[id_landusetype] + if is_update: self._update_vertexvbo() self._update_colorvbo() class RouteDrawings(Polygons): + def __init__(self, zones, parent, **kwargs): - - - Polygons.__init__( self,'zonedraws', parent, - name = 'Transport assignment zone drawings', - linewidth = 4, - detectwidth = 5.0, - **kwargs) - - - - - + Polygons.__init__(self, 'zonedraws', parent, + name='Transport assignment zone drawings', + linewidth=4, + detectwidth=5.0, + **kwargs) + self.delete('vertices') - - - self.add(cm.AttrConf( 'color_default', np.array([0.3,0.9,0.5,0.8], dtype=np.float32), - groupnames = ['options'], - perm='wr', - metatype = 'color', - name = 'Default color', - info = 'Default facility color.', - )) - - - + + self.add(cm.AttrConf('color_default', np.array([0.3, 0.9, 0.5, 0.8], dtype=np.float32), + groupnames=['options'], + perm='wr', + metatype='color', + name='Default color', + info='Default facility color.', + )) + self.set_netelement(zones) - - + def get_netelement(self): return self._zones - + def get_vertices_array(self): if self._is_not_synched: self._inds_map = self._zones.get_inds(self._zones.get_ids()) self._is_not_synched = False return self._zones.shapes.value[self._inds_map] - + def set_netelement(self, zones): - #print '\nset_facilities',facilities.get_ids() + # print '\nset_facilities',facilities.get_ids() self._zones = zones - if len(self)>0: + if len(self) > 0: self.del_rows(self.get_ids()) - + ids = self._zones.get_ids() #self._inds_map = self._zones.get_inds(ids) - self.add_rows(ids = ids) - + self.add_rows(ids=ids) + # plugins to keep grapgics syncronized with netelements - zones.shapes.plugin.add_event(cm.EVTADDITEM,self.on_add_element) - zones.plugin.add_event(cm.EVTDELITEM,self.on_del_element) - + zones.shapes.plugin.add_event(cm.EVTADDITEM, self.on_add_element) + zones.plugin.add_event(cm.EVTDELITEM, self.on_del_element) + self._id_target = -1 self.update() - - def update(self, is_update = True): + + def update(self, is_update=True): # assumes that arrsy structure did not change - #print 'FacilityDrawings.update' - n = len(self) - self.colors.value[:] = np.ones((n,4),np.float32)*self.color_default.value + # print 'FacilityDrawings.update' + n = len(self) + self.colors.value[:] = np.ones( + (n, 4), np.float32) * self.color_default.value self.colors_highl.value[:] = self._get_colors_highl(self.colors.value) - + if is_update: self.update_internal() def update_internal(self): - #print 'update_internal' - #print ' len(self),len(self._zones)',len(self),len(self._zones) + # print 'update_internal' + # print ' len(self),len(self._zones)',len(self),len(self._zones) self._is_not_synched = True self._update_vertexvbo() self._update_colorvbo() - - def make_zone(self, shape, color ): - #print 'make_zone shape',shape,type(shape) - return self._zones.make(shape = shape) - - + + def make_zone(self, shape, color): + # print 'make_zone shape',shape,type(shape) + return self._zones.make(shape=shape) + def on_add_element(self, shapes, ids): - #print 'on_add_element',shapes.attrname,ids + # print 'on_add_element',shapes.attrname,ids if shapes == self._zones.shapes: self._id_target = ids[0] - self.add_row( _id = self._id_target, - colors = self.color_default.value, - colors_highl = self._get_colors_highl(self.color_default.value) - ) + self.add_row(_id=self._id_target, + colors=self.color_default.value, + colors_highl=self._get_colors_highl( + self.color_default.value) + ) #self._inds_map = self._zones.get_inds(self._zones.get_ids()) - #self._update_vertexvbo() - #self._update_colorvbo() - - - - + # self._update_vertexvbo() + # self._update_colorvbo() + def begin_animation(self, id_target): - #print 'ZoneDrawings.begin_animation zones.shapes=\n',id_target,self._id_target, self._zones.shapes[id_target] - if self._id_target ==-1: + # print 'ZoneDrawings.begin_animation + # zones.shapes=\n',id_target,self._id_target, + # self._zones.shapes[id_target] + if self._id_target == -1: self._id_target = id_target - self._drawobj_anim = self.parent.get_drawobj_by_ident(self._ident_drawobj_anim) - self.id_anim = self._drawobj_anim.add_drawobj( self._zones.shapes[self._id_target], - self.color_anim.value, - ) - #print 'begin_animation',self.ident,_id,self._drawobj_anim + self._drawobj_anim = self.parent.get_drawobj_by_ident( + self._ident_drawobj_anim) + self.id_anim = self._drawobj_anim.add_drawobj(self._zones.shapes[self._id_target], + self.color_anim.value, + ) + # print 'begin_animation',self.ident,_id,self._drawobj_anim return True - - def end_animation(self, is_del_last_vert = False): - #print 'ZoneDrawings.end_animation',self.ident,self._id_target,self.id_anim - - #print ' verices =',self._drawobj_anim.vertices[self.id_anim] - #print ' self._drawobj_anim.vertices[self.id_anim]=',self._drawobj_anim.vertices[self.id_anim] + def end_animation(self, is_del_last_vert=False): + # print + # 'ZoneDrawings.end_animation',self.ident,self._id_target,self.id_anim + + # print ' verices =',self._drawobj_anim.vertices[self.id_anim] + # print ' + # self._drawobj_anim.vertices[self.id_anim]=',self._drawobj_anim.vertices[self.id_anim] shape = self._drawobj_anim.vertices[self.id_anim] self._zones.shapes[self._id_target] = shape - self._zones.coords[self._id_target] = self._zones.get_coords_from_shape(shape) - + self._zones.coords[ + self._id_target] = self._zones.get_coords_from_shape(shape) + self.del_animation() - #print ' self.get_vertices_array()=\n',self.get_vertices_array() - #self._drawobj_anim.del_drawobj(self.id_anim) + # print ' self.get_vertices_array()=\n',self.get_vertices_array() + # self._drawobj_anim.del_drawobj(self.id_anim) self.update_internal() #self._inds_map = self._zones.get_inds(self._zones.get_ids()) - #self._update_vertexvbo() - #self._update_colorvbo() + # self._update_vertexvbo() + # self._update_colorvbo() return True - + def del_elem(self, id_zone): """ Deletes an element from network and then in on canvas through callback on_del_element """ - #print 'del_elem' - #print ' len(self),len(self._zones)',len(self),len(self._zones) - + # print 'del_elem' + # print ' len(self),len(self._zones)',len(self),len(self._zones) + self._zones.del_element(id_zone) - - def on_del_element(self,shapes,ids): + + def on_del_element(self, shapes, ids): """ callback from netelement """ - #print 'on_del_element',shapes.attrname,ids,self._id_target - #print ' len(self),len(self._zones)',len(self),len(self._zones) - #print ' verices =',self._drawobj_anim.vertices[self.id_anim] + # print 'on_del_element',shapes.attrname,ids,self._id_target + # print ' len(self),len(self._zones)',len(self),len(self._zones) + # print ' verices =',self._drawobj_anim.vertices[self.id_anim] self._is_not_synched = True self.del_drawobj(ids[0]) - #print ' len(self),len(self._zones)',len(self),len(self._zones) - #wx.CallAfter(self.update_internal) - #self.update_internal() - #print ' after CallAfter' - #print ' len(self),len(self._zones)',len(self),len(self._zones) + # print ' len(self),len(self._zones)',len(self),len(self._zones) + # wx.CallAfter(self.update_internal) + # self.update_internal() + # print ' after CallAfter' + # print ' len(self),len(self._zones)',len(self),len(self._zones) return True - - - - def del_animation(self, is_del_main = False): - #print 'end_animation',self.ident,_id,self._drawobj_anim + + def del_animation(self, is_del_main=False): + # print 'end_animation',self.ident,_id,self._drawobj_anim self._drawobj_anim.del_drawobj(self.id_anim) self._drawobj_anim = None - + if is_del_main: - #self.del_drawobj(self._id_target) + # self.del_drawobj(self._id_target) # delete first element from net, which will # call back on_del_netelement where the main drawobj is deleted self.del_elem(self._id_target) - + self._id_target = -1 self.id_anim = -1 return True - + + class AddTripTool(AddPolygonTool): + """ Mixin for Selection tools for OGL canvas. - """ - def __init__(self,parent, mainframe=None): - self.init_common( 'add_zone',parent,'Add zone tool', - info = 'Click on canvas to add a zone. Add a vertex with a single click, double click to finish, right click to aboard.', - is_textbutton = False, - ) + """ + + def __init__(self, parent, mainframe=None): + self.init_common('add_zone', parent, 'Add zone tool', + info='Click on canvas to add a zone. Add a vertex with a single click, double click to finish, right click to aboard.', + is_textbutton=False, + ) self.init_options() - + def init_options(self): pass - #self.add(cm.AttrConf( 'color', np.array([0.3,0.9,0.5,0.8], dtype=np.float32), - # groupnames = ['options'], - # perm='rw', + # self.add(cm.AttrConf( 'color', np.array([0.3,0.9,0.5,0.8], dtype=np.float32), + # groupnames = ['options'], + # perm='rw', # metatype = 'color', # name = 'Zone color', # is_save = True, # info = 'Zone outline color with format [r,g,b,a]', # )) - - #self.add(cm.AttrConf( 'color_fill', np.array([1.0,0.0,0.0,0.8], dtype=np.float32), - # groupnames = ['options'], - # perm='rw', + + # self.add(cm.AttrConf( 'color_fill', np.array([1.0,0.0,0.0,0.8], dtype=np.float32), + # groupnames = ['options'], + # perm='rw', # metatype = 'color', # name = 'Fill color', # is_save = True, # info = 'Object fill color with format [r,g,b,a]', - # )) - - def set_button_info(self,bsize=(32,32)): - #print 'set_button_info select tool' - self._bitmap = wx.Bitmap(os.path.join(IMAGEDIR,'polygon2_24px.png'),wx.BITMAP_TYPE_PNG) - self._bitmap_sel=wx.Bitmap(os.path.join(IMAGEDIR,'polygon2_24px.png'),wx.BITMAP_TYPE_PNG) - - + # )) + def set_button_info(self, bsize=(32, 32)): + # print 'set_button_info select tool' + self._bitmap = wx.Bitmap(os.path.join( + IMAGEDIR, 'polygon2_24px.png'), wx.BITMAP_TYPE_PNG) + self._bitmap_sel = wx.Bitmap(os.path.join( + IMAGEDIR, 'polygon2_24px.png'), wx.BITMAP_TYPE_PNG) def begin_animation(self, event): - #print 'AddLineTool.begin_animation' + # print 'AddLineTool.begin_animation' #self.drawobj_anim, _id, self.ind_vert = self.get_current_vertexselection() - self.drawobj_anim = self._canvas.get_drawing().get_drawobj_by_ident('zonedraws') + self.drawobj_anim = self._canvas.get_drawing().get_drawobj_by_ident( + 'zonedraws') self.coord_last = self._canvas.unproject(event.GetPosition()) #vertices = [list(self.coord_last),list(self.coord_last) ] - vertices = [ 1.0*self.coord_last, 1.0*self.coord_last, ]# attention, we need copies here!! - #print ' vertices ',vertices#,self.width.get_value(),self.color.get_value(), - + # attention, we need copies here!! + vertices = [1.0 * self.coord_last, 1.0 * self.coord_last, ] + # print ' vertices + # ',vertices#,self.width.get_value(),self.color.get_value(), + _id = self.drawobj_anim.make_zone(vertices, - color = self.drawobj_anim.color_default.get_value(), - ) - self.ind_vert = 1 + color=self.drawobj_anim.color_default.get_value(), + ) + self.ind_vert = 1 self.drawobj_anim.begin_animation(_id) - - + # http://www.wxpython.org/docs/api/wx.Cursor-class.html self._canvas.SetCursor(wx.StockCursor(wx.CURSOR_CROSS)) self.is_animated = True - + self.parent.refresh_optionspanel(self) - return True # True for redrawing - - - + return True # True for redrawing + + class WxGui(ModuleGui): + """Contains functions that communicate between the widgets of the main wx gui and the functions of the plugin. """ - def __init__(self, ident): self._demand = None - self._init_common( ident, priority = 1000, - icondirpath = os.path.join(os.path.dirname(__file__), 'images')) - - + self._init_common(ident, priority=1000, + icondirpath=os.path.join(os.path.dirname(__file__), 'images')) + def get_module(self): return self._demand - + def get_scenario(self): return self._mainframe.get_modulegui('coremodules.scenario').get_scenario() - + def get_neteditor(self): return self._mainframe.get_modulegui('coremodules.network').get_neteditor() @@ -339,11 +324,10 @@ """ self._mainframe = mainframe #self._neteditor = mainframe.add_view("Network", Neteditor) - - #mainframe.browse_obj(self._module) + + # mainframe.browse_obj(self._module) self.make_menu() self.make_toolbar() - def refresh_widgets(self): """ @@ -352,271 +336,270 @@ dependent on the availability of data. """ scenario = self.get_scenario() - #print 'demand refresh_widgets',scenario.net + # print 'demand refresh_widgets',scenario.net is_refresh = False if self._demand != scenario.demand: del self._demand self._demand = scenario.demand is_refresh = True - #self.get_neteditor().get_toolbox().add_toolclass(AddZoneTool) - #print ' odintervals',self._demand.odintervals#,self.odintervals.times_start - #print ' ',dir(self._demand.odintervals) - - + # self.get_neteditor().get_toolbox().add_toolclass(AddZoneTool) + # print ' odintervals',self._demand.odintervals#,self.odintervals.times_start + # print ' ',dir(self._demand.odintervals) + elif self._demand.is_modified(): is_refresh = True - - + if is_refresh: neteditor = self.get_neteditor() canvas = self.get_neteditor().get_canvas() drawing = canvas.get_drawing() - #drawing.del_drawobj_by_ident('facilitydraws')# TODO: could be done better - #drawing.del_drawobj_by_ident('zonedraws') + # drawing.del_drawobj_by_ident('facilitydraws')# TODO: could be done better + # drawing.del_drawobj_by_ident('zonedraws') #facilitydrawings = FacilityDrawings(self._landuse.facilities, drawing) #zonedrawings = ZoneDrawings(self._landuse.zones, drawing) #drawing.add_drawobj(facilitydrawings, layer = 5) #drawing.add_drawobj(zonedrawings, layer = 100) - #canvas.draw() - - - + # canvas.draw() def make_menu(self): - #print 'make_menu' + # print 'make_menu' menubar = self._mainframe.menubar menubar.append_menu('demand') -#------------------------------------------------------------------------------- - menubar.append_menu( 'demand/vehicles', - bitmap = self.get_icon("vehicle_24px.png"), - ) - - menubar.append_item( 'demand/vehicles/clear vehicle types', - self.on_clear_vtypes, - info='Remove all vehicle types .', - #bitmap = self.get_icon("route3_24px.png"), - ) - - menubar.append_item( 'demand/vehicles/load defaults', - self.on_load_vtypes_defaults, - info='Load default vehicle types, removing all existing vehicle types.', - #bitmap = self.get_icon("route3_24px.png"), - ) - -#------------------------------------------------------------------------------- - - menubar.append_menu( 'demand/Zone-to-zone demand', - bitmap = self.get_icon("icon_odm.png"), - ) - menubar.append_item( 'demand/Zone-to-zone demand/add zone-to-zone flows...', - self.on_add_odtrips, - info='Add or import trips between origin and destination zones, with a certain mode during a certain time interval.', - bitmap = self.get_icon("Document_Import_24px.png"), - ) - - menubar.append_item( 'demand/Zone-to-zone demand/generate trips from flows', - self.on_generate_odtrips, - info=self.on_generate_odtrips.__doc__.strip(), - #bitmap = wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE_AS,wx.ART_MENU), - ) - - menubar.append_item( 'demand/Zone-to-zone demand/clear zone-to-zone flows', - self.on_clear_odtrips, - info='Clear all zone to zone trips.', - bitmap = wx.ArtProvider.GetBitmap(wx.ART_DELETE,wx.ART_MENU), - ) -#------------------------------------------------------------------------------- - menubar.append_menu( 'demand/turnflows', - bitmap = self.get_icon("icon_turnratio.png"), - ) - menubar.append_item( 'demand/turnflows/import turnflows...', - self.on_import_turnflows, - info='Import turnflows from file.', - bitmap = self.get_icon("Document_Import_24px.png"), - ) - - menubar.append_item( 'demand/turnflows/normalize turn-probabilities', - self.on_normalize_turnprobabilities, - #info='Makes sure that sum of turn probabilities from an edge equals 1.', - #bitmap = self.get_icon("Document_Import_24px.png"), - ) - - menubar.append_item( 'demand/turnflows/turnflows to routes', - self.on_turnflows_to_routes, - #info='Makes sure that sum of turn probabilities from an edge equals 1.', - #bitmap = self.get_icon("Document_Import_24px.png"), - ) - - menubar.append_item( 'demand/turnflows/clear all turnflows', - self.on_clear_turnflows, - info='Clear all turnflows.', - bitmap = wx.ArtProvider.GetBitmap(wx.ART_DELETE,wx.ART_MENU), - ) - - -#------------------------------------------------------------------------------- - - menubar.append_menu( 'demand/trips and routes', - bitmap = self.get_icon("trip3_24px.png"), - ) - - menubar.append_item( 'demand/trips and routes/route', - self.on_route, - info='Route current trips and create SUMO route xml.', - bitmap = self.get_icon("route3_24px.png"), - ) - - - - menubar.append_item( 'demand/trips and routes/export trips to SUMO xml...', - self.on_export_sumotrips, - info='Export all trips to SUMO XML format.', - bitmap = self.get_icon("Document_Export_24px.png"), - ) - - menubar.append_item( 'demand/trips and routes/export routes to SUMO xml...', - self.on_export_sumoroutes, - info='Export all trips to SUMO XML format.', - bitmap = self.get_icon("Document_Export_24px.png"), - ) - - menubar.append_item( 'demand/trips and routes/import trips from SUMO xml...', - self.on_import_trips_xml, - info=self.on_import_trips_xml.__doc__.strip(), - bitmap = self.get_icon("Document_Import_24px.png"), - ) - - menubar.append_item( 'demand/trips and routes/import trips with routes from SUMO xml...', - self.on_import_triproutes_xml, - info=self.on_import_triproutes_xml.__doc__.strip(), - bitmap = self.get_icon("Document_Import_24px.png"), - ) - - menubar.append_item( 'demand/trips and routes/import routes to existing trips from SUMO xml...', - self.on_import_routes_alternative_xml, - info=self.on_import_routes_alternative_xml.__doc__.strip(), - bitmap = self.get_icon("Document_Import_24px.png"), - ) - - - menubar.append_item( 'demand/trips and routes/clear all trips and routes', - self.on_clear_trips, - info='Clear all trips with respective routes.', - bitmap = wx.ArtProvider.GetBitmap(wx.ART_DELETE,wx.ART_MENU), - ) - - menubar.append_item( 'demand/trips and routes/clear all routes', - self.on_clear_routes, - info='Clear all routes, trips will remain.', - bitmap = wx.ArtProvider.GetBitmap(wx.ART_DELETE,wx.ART_MENU), - ) - - - -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------- + menubar.append_menu('demand/vehicles', + bitmap=self.get_icon("vehicle_24px.png"), + ) + + menubar.append_item('demand/vehicles/clear vehicle types', + self.on_clear_vtypes, + info='Remove all vehicle types .', + #bitmap = self.get_icon("route3_24px.png"), + ) + + menubar.append_item('demand/vehicles/load defaults', + self.on_load_vtypes_defaults, + info='Load default vehicle types, removing all existing vehicle types.', + #bitmap = self.get_icon("route3_24px.png"), + ) + +#------------------------------------------------------------------------- + + menubar.append_menu('demand/Zone-to-zone demand', + bitmap=self.get_icon("icon_odm.png"), + ) + menubar.append_item('demand/Zone-to-zone demand/add zone-to-zone flows...', + self.on_add_odtrips, + info='Add or import trips between origin and destination zones, with a certain mode during a certain time interval.', + bitmap=self.get_icon("Document_Import_24px.png"), + ) + + menubar.append_item('demand/Zone-to-zone demand/generate trips from flows', + self.on_generate_odtrips, + info=self.on_generate_odtrips.__doc__.strip(), + #bitmap = wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE_AS,wx.ART_MENU), + ) + + menubar.append_item('demand/Zone-to-zone demand/clear zone-to-zone flows', + self.on_clear_odtrips, + info='Clear all zone to zone trips.', + bitmap=wx.ArtProvider.GetBitmap( + wx.ART_DELETE, wx.ART_MENU), + ) +#------------------------------------------------------------------------- + menubar.append_menu('demand/turnflows', + bitmap=self.get_icon("icon_turnratio.png"), + ) + menubar.append_item('demand/turnflows/import turnflows...', + self.on_import_turnflows, + info='Import turnflows from file.', + bitmap=self.get_icon("Document_Import_24px.png"), + ) + + menubar.append_item('demand/turnflows/normalize turn-probabilities', + self.on_normalize_turnprobabilities, + #info='Makes sure that sum of turn probabilities from an edge equals 1.', + #bitmap = self.get_icon("Document_Import_24px.png"), + ) + + menubar.append_item('demand/turnflows/turnflows to routes', + self.on_turnflows_to_routes, + #info='Makes sure that sum of turn probabilities from an edge equals 1.', + #bitmap = self.get_icon("Document_Import_24px.png"), + ) + + menubar.append_item('demand/turnflows/clear all turnflows', + self.on_clear_turnflows, + info='Clear all turnflows.', + bitmap=wx.ArtProvider.GetBitmap( + wx.ART_DELETE, wx.ART_MENU), + ) + + +#------------------------------------------------------------------------- + + menubar.append_menu('demand/trips and routes', + bitmap=self.get_icon("trip3_24px.png"), + ) + + menubar.append_item('demand/trips and routes/route', + self.on_route, + info='Route current trips and create SUMO route xml.', + bitmap=self.get_icon("route3_24px.png"), + ) + + menubar.append_item('demand/trips and routes/export trips to SUMO xml...', + self.on_export_sumotrips, + info='Export all trips to SUMO XML format.', + bitmap=self.get_icon("Document_Export_24px.png"), + ) + + menubar.append_item('demand/trips and routes/export routes to SUMO xml...', + self.on_export_sumoroutes, + info='Export all trips to SUMO XML format.', + bitmap=self.get_icon("Document_Export_24px.png"), + ) + + menubar.append_item('demand/trips and routes/import trips from SUMO xml...', + self.on_import_trips_xml, + info=self.on_import_trips_xml.__doc__.strip(), + bitmap=self.get_icon("Document_Import_24px.png"), + ) + + menubar.append_item('demand/trips and routes/import trips with routes from SUMO xml...', + self.on_import_triproutes_xml, + info=self.on_import_triproutes_xml.__doc__.strip(), + bitmap=self.get_icon("Document_Import_24px.png"), + ) + + menubar.append_item('demand/trips and routes/import routes to existing trips from SUMO xml...', + self.on_import_routes_alternative_xml, + info=self.on_import_routes_alternative_xml.__doc__.strip(), + bitmap=self.get_icon("Document_Import_24px.png"), + ) + + menubar.append_item('demand/trips and routes/clear all trips and routes', + self.on_clear_trips, + info='Clear all trips with respective routes.', + bitmap=wx.ArtProvider.GetBitmap( + wx.ART_DELETE, wx.ART_MENU), + ) + + menubar.append_item('demand/trips and routes/clear all routes', + self.on_clear_routes, + info='Clear all routes, trips will remain.', + bitmap=wx.ArtProvider.GetBitmap( + wx.ART_DELETE, wx.ART_MENU), + ) + + +#------------------------------------------------------------------------- if 0: - menubar.append_menu( 'demand/virtual population', - bitmap = self.get_icon("icon_virtualpopulation.jpg") - ) - menubar.append_item( 'demand/virtual population/create from O-D matrix', - self.on_create_pop_from_ods, - info='Generates population from O-D matrix data.', - #bitmap = self.get_icon("Document_Import_24px.png"), - ) - menubar.append_item( 'demand/virtual population/create plans for privates', - self.on_make_plans_private, - info='create plans for private transport.', - #bitmap = self.get_icon("Document_Import_24px.png"), - ) - - menubar.append_item( 'demand/virtual population/Export plans to SUMO xml...', - self.on_write_plans_to_sumoxml, - info='Export all plans to SUMO routes XML format.', - #bitmap = self.get_icon("Document_Import_24px.png"), - ) - - -## (self._menuitem_draw_route, id_item,) = menubar.append_item( -## 'plugins/traces/draw selected route in network', -## self.on_renew_objectbrowser, + menubar.append_menu('demand/virtual population', + bitmap=self.get_icon( + "icon_virtualpopulation.jpg") + ) + menubar.append_item('demand/virtual population/create from O-D matrix', + self.on_create_pop_from_ods, + info='Generates population from O-D matrix data.', + #bitmap = self.get_icon("Document_Import_24px.png"), + ) + menubar.append_item('demand/virtual population/create plans for privates', + self.on_make_plans_private, + info='create plans for private transport.', + #bitmap = self.get_icon("Document_Import_24px.png"), + ) + + menubar.append_item('demand/virtual population/Export plans to SUMO xml...', + self.on_write_plans_to_sumoxml, + info='Export all plans to SUMO routes XML format.', + #bitmap = self.get_icon("Document_Import_24px.png"), + ) + + +# (self._menuitem_draw_route, id_item,) = menubar.append_item( +## 'plugins/traces/draw selected route in network', +# self.on_renew_objectbrowser, ## info='Enable visualization of routes in network tab. Double-click on trace in table.', -## check=True) -## self._menuitem_draw_route.Check(False) -## -## (self._menuitem_plot_route, id_item,) = menubar.append_item( -## 'plugins/traces/add plot selected route', -## self.on_renew_objectbrowser, +# check=True) +# self._menuitem_draw_route.Check(False) +## +# (self._menuitem_plot_route, id_item,) = menubar.append_item( +## 'plugins/traces/add plot selected route', +# self.on_renew_objectbrowser, ## info='Enable adding of routes to graphics in trace tab. Double-click on trace in table.', -## check=True) -## self._menuitem_plot_route.Check(False) -## +# check=True) +# self._menuitem_plot_route.Check(False) +## def on_clear_vtypes(self, event=None): self._demand.vtypes.clear_vtypes() self._mainframe.browse_obj(self._demand.vtypes) - if event: event.Skip() - + if event: + event.Skip() + def on_load_vtypes_defaults(self, event=None): self._demand.vtypes.clear_vtypes() self._demand.vtypes.add_vtypes_default() self._mainframe.browse_obj(self._demand.vtypes) - if event: event.Skip() - + if event: + event.Skip() + def on_clear_trips(self, event=None): self._demand.trips.clear_trips() self._mainframe.browse_obj(self._demand.trips) - if event: event.Skip() - + if event: + event.Skip() + def on_clear_routes(self, event=None): self._demand.trips.clear_routes() self._mainframe.browse_obj(self._demand.trips) - if event: event.Skip() - + if event: + event.Skip() + def on_create_pop_from_ods(self, event=None): """ Generates virtual population from ODM matrix. """ self._demand.virtualpop.create_pop_from_ods() self._mainframe.browse_obj(self._demand.virtualpop) - event.Skip() - + event.Skip() + def on_make_plans_private(self, event=None): """ Generates virtual population from ODM matrix. """ self._demand.virtualpop.make_plans_private() self._mainframe.browse_obj(self._demand.virtualpop) - event.Skip() - - def on_write_plans_to_sumoxml(self, event = None): - #print 'on_write_plans_to_sumoxml' + event.Skip() + + def on_write_plans_to_sumoxml(self, event=None): + # print 'on_write_plans_to_sumoxml' dirpath = self.get_scenario().get_workdirpath() - defaultFile = self.get_scenario().get_rootfilename()+'.rou.xml' + defaultFile = self.get_scenario().get_rootfilename() + '.rou.xml' wildcards_all = 'All files (*.*)|*.*|XML files (*.xml)|*.xml' - dlg = wx.FileDialog(None, message='Write plans to SUMO rou.xml', - defaultDir=dirpath, - defaultFile=defaultFile, + dlg = wx.FileDialog(None, message='Write plans to SUMO rou.xml', + defaultDir=dirpath, + defaultFile=defaultFile, wildcard=wildcards_all, style=wx.SAVE | wx.CHANGE_DIR) if dlg.ShowModal() == wx.ID_OK: filepath = dlg.GetPath() else: - return - + return + self._demand.virtualpop.export_trips_xml(filepath) - + event.Skip() - - + def on_add_odtrips(self, event=None): """ Opend odm wizzard """ dlg = odgui.AddOdDialog(self._mainframe, self._demand.odintervals) dlg.Show() - dlg.MakeModal(True) + dlg.MakeModal(True) self._mainframe.browse_obj(self._demand.odintervals) - #self.scenariopanel.refresh_panel(self.scenario) - + # self.scenariopanel.refresh_panel(self.scenario) + def on_generate_odtrips(self, event=None): """ Generates trips from origin to destination zone from current OD matrices. @@ -624,9 +607,7 @@ self._demand.odintervals.generate_trips() self._mainframe.browse_obj(self._demand.trips) event.Skip() - - - + def on_clear_odtrips(self, event=None): """ Generates trips from origin to destination zone from current OD matrices. @@ -634,39 +615,39 @@ self._demand.odintervals.clear_od_trips() self._mainframe.browse_obj(self._demand.odintervals) event.Skip() - + def on_import_turnflows(self, event=None): tfimporter = turnflows.TurnflowImporter(self._demand.turnflows, - logger = self._mainframe.get_logger() + logger=self._mainframe.get_logger() ) dlg = ProcessDialog(self._mainframe, tfimporter) - + dlg.CenterOnScreen() - + # this does not return until the dialog is closed. val = dlg.ShowModal() - #print ' val,val == wx.ID_OK',val,wx.ID_OK,wx.ID_CANCEL,val == wx.ID_CANCEL - #print ' status =',dlg.get_status() - if dlg.get_status() != 'success':#val == wx.ID_CANCEL: - #print ">>>>>>>>>Unsuccessful\n" + # print ' val,val == wx.ID_OK',val,wx.ID_OK,wx.ID_CANCEL,val == wx.ID_CANCEL + # print ' status =',dlg.get_status() + if dlg.get_status() != 'success': # val == wx.ID_CANCEL: + # print ">>>>>>>>>Unsuccessful\n" dlg.Destroy() - + if dlg.get_status() == 'success': - #print ">>>>>>>>>successful\n" + # print ">>>>>>>>>successful\n" # apply current widget values to scenario instance dlg.apply() dlg.Destroy() self._mainframe.browse_obj(self._demand.turnflows) #del self._scenario #self._scenario = scenariocreator.get_scenario() - #self._scenario.import_xml() + # self._scenario.import_xml() # this should update all widgets for the new scenario!! - #print 'call self._mainframe.refresh_moduleguis()' - #self._mainframe.refresh_moduleguis() - + # print 'call self._mainframe.refresh_moduleguis()' + # self._mainframe.refresh_moduleguis() + if event: event.Skip() - + def on_normalize_turnprobabilities(self, event=None): """ Makes sure that sum of turn probabilities from an edge equals 1. @@ -674,8 +655,8 @@ self._demand.turnflows.normalize_turnprobabilities() self._mainframe.browse_obj(self._demand.turnflows) if event: - event.Skip() - + event.Skip() + def on_clear_turnflows(self, event=None): """Generates routes, based on flow information and turnflow probabilities. This function will apply the JTROUTER for each transport mode separately. @@ -684,45 +665,43 @@ self._mainframe.browse_obj(self._demand.turnflows) if event: event.Skip() - - + def on_turnflows_to_routes(self, event=None): """Generates routes, based on flow information and turnflow probabilities. This function will apply the JTROUTER for each transport mode separately. """ - self._demand.turnflows.turnflows_to_routes(is_clear_trips = False) + self._demand.turnflows.turnflows_to_routes(is_clear_trips=False) self._mainframe.browse_obj(self._demand.trips) if event: - event.Skip() - + event.Skip() + def on_route(self, event=None): """Generates routes from current trip info. """ - #self._demand.trips.clear_routes() - self._demand.trips.route(is_export_net = True, is_export_trips = True) + # self._demand.trips.clear_routes() + self._demand.trips.route(is_export_net=True, is_export_trips=True) self._mainframe.browse_obj(self._demand.trips) #filepath = self._demand.trips.get_routefilepath() #defaultFile = os.path.basename(filepath) #dirpath = os.path.dirname(filepath) #wildcards_all = 'XML route files (*rou.xml)|*rou.xml|All files (*.*)|*.*' - #dlg = wx.FileDialog(None, message='Write routes to SUMO xml', - # defaultDir=dirpath, - # defaultFile=defaultFile, + # dlg = wx.FileDialog(None, message='Write routes to SUMO xml', + # defaultDir=dirpath, + # defaultFile=defaultFile, # wildcard=wildcards_all, style=wx.SAVE | wx.CHANGE_DIR) - #if dlg.ShowModal() == wx.ID_OK: + # if dlg.ShowModal() == wx.ID_OK: # filepath = dlg.GetPath() # - #else: - # return + # else: + # return # #filepath = self._demand.trips.route(routefilepath = None,is_export_net = True, is_export_trips = True) - - #if filepath is not None: + + # if filepath is not None: # print 'Successfully routed to %s.'%filepath # self._demand.import_routes_xml( filepath, is_clear_trips = False, is_add = True) - - - def on_import_trips_xml(self, event = None): + + def on_import_trips_xml(self, event=None): """Select xml file and import new trips. New trips with associated routes will generated. """ @@ -730,22 +709,21 @@ defaultFile = os.path.dirname(filepath) dirpath = os.path.dirname(filepath) wildcards_all = 'XML trip files (*.trip.xml)|*.trip.xml|All files (*.*)|*.*' - dlg = wx.FileDialog(None, message='Import trips and routes from SUMO xml', - defaultDir=dirpath, - defaultFile=defaultFile, + dlg = wx.FileDialog(None, message='Import trips and routes from SUMO xml', + defaultDir=dirpath, + defaultFile=defaultFile, wildcard=wildcards_all, style=wx.SAVE | wx.CHANGE_DIR) if dlg.ShowModal() == wx.ID_OK: filepath = dlg.GetPath() else: - return - - self._demand.trips.import_trips_xml( filepath, is_clear_trips = False, - is_generate_ids = True) + return + + self._demand.trips.import_trips_xml(filepath, is_clear_trips=False, + is_generate_ids=True) self._mainframe.browse_obj(self._demand.trips) - - - def on_import_triproutes_xml(self, event = None): + + def on_import_triproutes_xml(self, event=None): """Select xml file and import trips and routes. New trips with associated routes will generated. """ @@ -753,24 +731,22 @@ defaultFile = os.path.dirname(filepath) dirpath = os.path.dirname(filepath) wildcards_all = 'XML route files (*.rou.xml)|*.rou.xml|All files (*.*)|*.*' - dlg = wx.FileDialog(None, message='Import trips and routes from SUMO xml', - defaultDir=dirpath, - defaultFile=defaultFile, + dlg = wx.FileDialog(None, message='Import trips and routes from SUMO xml', + defaultDir=dirpath, + defaultFile=defaultFile, wildcard=wildcards_all, style=wx.SAVE | wx.CHANGE_DIR) if dlg.ShowModal() == wx.ID_OK: filepath = dlg.GetPath() else: - return - - self._demand.trips.import_routes_xml( filepath, is_clear_trips = False, - is_generate_ids = True, - is_add = False) + return + + self._demand.trips.import_routes_xml(filepath, is_clear_trips=False, + is_generate_ids=True, + is_add=False) self._mainframe.browse_obj(self._demand.trips) - - - - def on_import_routes_alternative_xml(self, event = None): + + def on_import_routes_alternative_xml(self, event=None): """Select xml file and import routes. Routes will added as route alternative to existing trips. """ @@ -778,62 +754,55 @@ defaultFile = os.path.dirname(filepath) dirpath = os.path.dirname(filepath) wildcards_all = 'XML route files (*.rou.xml)|*.rou.xml|All files (*.*)|*.*' - dlg = wx.FileDialog(None, message='Import trips and routes from SUMO xml', - defaultDir=dirpath, - defaultFile=defaultFile, + dlg = wx.FileDialog(None, message='Import trips and routes from SUMO xml', + defaultDir=dirpath, + defaultFile=defaultFile, wildcard=wildcards_all, style=wx.OPEN | wx.CHANGE_DIR ) - + if dlg.ShowModal() == wx.ID_OK: filepath = dlg.GetPath() else: - return - - self._demand.trips.import_routes_xml(filepath,is_clear_trips = False, - is_generate_ids = False, - is_add = True) + return + + self._demand.trips.import_routes_xml(filepath, is_clear_trips=False, + is_generate_ids=False, + is_add=True) self._mainframe.browse_obj(self._demand.trips) - - def on_export_sumotrips(self, event = None): - #print 'on_export_sumotrips' + + def on_export_sumotrips(self, event=None): + # print 'on_export_sumotrips' filepath = self._demand.trips.get_tripfilepath() defaultFile = os.path.dirname(filepath) dirpath = os.path.dirname(filepath) wildcards_all = '*.*|XML trip files (*.trip.xml)|*.trip.xml|All files (*.*)' - dlg = wx.FileDialog(None, message='Write trips to SUMO xml', - defaultDir=dirpath, - defaultFile=defaultFile, + dlg = wx.FileDialog(None, message='Write trips to SUMO xml', + defaultDir=dirpath, + defaultFile=defaultFile, wildcard=wildcards_all, style=wx.SAVE | wx.CHANGE_DIR) if dlg.ShowModal() == wx.ID_OK: filepath = dlg.GetPath() else: - return - + return + self._demand.trips.export_trips_xml(filepath) - - - - - def on_export_sumoroutes(self, event = None): - #print 'on_export_sumotrips' + + def on_export_sumoroutes(self, event=None): + # print 'on_export_sumotrips' filepath = self._demand.trips.get_routefilepath() defaultFile = os.path.basename(filepath) dirpath = os.path.dirname(filepath) wildcards_all = 'XML route files (*rou.xml)|*rou.xml|All files (*.*)|*.*' - dlg = wx.FileDialog(None, message='Write routes to SUMO xml', - defaultDir=dirpath, - defaultFile=defaultFile, + dlg = wx.FileDialog(None, message='Write routes to SUMO xml', + defaultDir=dirpath, + defaultFile=defaultFile, wildcard=wildcards_all, style=wx.SAVE | wx.CHANGE_DIR) if dlg.ShowModal() == wx.ID_OK: filepath = dlg.GetPath() else: - return - - self._demand.trips.export_routes_xml(filepath) - - - + return + self._demand.trips.export_routes_xml(filepath) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,2 +1 @@ __version__ = "0.0" - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/landuse/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/landuse/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/landuse/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/landuse/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,15 +1,11 @@ __version__ = "0.0" -print 'init',__name__ +print 'init', __name__ -def get_wxgui(): - #try: - from wxgui import WxGui - return WxGui(__name__) - #except: - # return None - - - - +def get_wxgui(): + # try: + from wxgui import WxGui + return WxGui(__name__) + # except: + # return None diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/landuse/landuse.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/landuse/landuse.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/contributed/sumopy/coremodules/landuse/landuse.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/contributed/sumopy/coremodules/landuse/landuse.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,470 +1,466 @@ -import os, sys, time +import os +import sys +import time from xml.sax import saxutils, parse, handler -if __name__ == '__main__': +if __name__ == '__main__': try: APPDIR = os.path.dirname(os.path.abspath(__file__)) except: APPDIR = os.path.dirname(os.path.abspath(sys.argv[0])) - SUMOPYDIR = os.path.join(APPDIR,'..','..') + SUMOPYDIR = os.path.join(APPDIR, '..', '..') sys.path.append(SUMOPYDIR) - - + + from coremodules.modules_common import * -import numpy as np +import numpy as np import agilepy.lib_base.classman as cm import agilepy.lib_base.arrayman as am import agilepy.lib_base.xmlman as xm -from agilepy.lib_base.geometry import * -from agilepy.lib_base.processes import Process,CmlMixin +from agilepy.lib_base.geometry import * +from agilepy.lib_base.processes import Process, CmlMixin from coremodules.network.network import SumoIdsConf, MODES -import maps - +import maps + def clean_osm(filepath_in, filepath_out): """ Clean osm file from strange characters that compromize importing. """ # - substitutes ={ """:"'","&":"+"} - fd_in=open(filepath_in,'r') - fd_out=open(filepath_out,'w') + substitutes = {""": "'", "&": "+"} + fd_in = open(filepath_in, 'r') + fd_out = open(filepath_out, 'w') for line in fd_in.readlines(): for oldstr, newstr in substitutes.iteritems(): line = line.replace(oldstr, newstr) fd_out.write(line) fd_in.close() fd_out.close() - - + + class LanduseTypes(am.ArrayObjman): - def __init__(self, parent,is_add_default = True, **kwargs): - - self._init_objman( ident='landusetypes', - parent=parent, - name = 'Landuse types', - info = 'Table with information on landuse types', - **kwargs) - + + def __init__(self, parent, is_add_default=True, **kwargs): + + self._init_objman(ident='landusetypes', + parent=parent, + name='Landuse types', + info='Table with information on landuse types', + **kwargs) + self._init_attributes() if is_add_default: self.add_types_default() - - def _init_attributes(self): - # landuse types table - self.add_col(am.ArrayConf( 'typekeys', '', - is_index = True, - dtype = 'object',# actually a string of variable length - perm='r', - name = 'Type', - info = 'Type of facility. Must be unique, because used as key.', - )) - - #self.add_col(am.ArrayConf( 'osmid', '', + + def _init_attributes(self): + # landuse types table + self.add_col(am.ArrayConf('typekeys', '', + is_index=True, + # actually a string of variable length + dtype='object', + perm='r', + name='Type', + info='Type of facility. Must be unique, because used as key.', + )) + + # self.add_col(am.ArrayConf( 'osmid', '', # dtype = 'object',# actually a string of variable length - # perm='rw', + # perm='rw', # name = 'Name', # info = 'Name of facility type used as reference in OSM.', # )) - - self.add_col(am.ListArrayConf( 'osmfilters', - perm='r', - name = 'OSM filter', - info = 'List of openstreetmap filters that allow to identify this facility type.', - )) - - self.add_col(am.ArrayConf( 'colors', np.ones(4,np.float32), - dtype=np.float32, - metatype = 'color', - perm='rw', - name = 'Colors', - info = "Color corrispondig to landuse type as RGBA tuple with values from 0.0 to 1.0", - xmltag = 'color', - )) - - def add_types_default(self): + + self.add_col(am.ListArrayConf('osmfilters', + perm='r', + name='OSM filter', + info='List of openstreetmap filters that allow to identify this facility type.', + )) + + self.add_col(am.ArrayConf('colors', np.ones(4, np.float32), + dtype=np.float32, + metatype='color', + perm='rw', + name='Colors', + info="Color corrispondig to landuse type as RGBA tuple with values from 0.0 to 1.0", + xmltag='color', + )) + + def add_types_default(self): # default types - self.add_row( typekeys='leisure', - osmfilters = ['sport','leisure.park','park'], - colors=( 0.5, 0.8, 0.6 , 1.0) - ) - self.add_row( typekeys='commercial', - osmfilters = ['shop.*','building.commercial'], - colors=( 0.6171875, 0.6171875, 0.875, 1.0), - ) - self.add_row( typekeys= 'industrial', - osmfilters = ['building.industrial'], - colors=(0.89453125, 0.65625 , 0.63671875, 1.0), - ) - self.add_row( typekeys='parking', - osmfilters = ['building.parking','amenity.parking'], - colors=(0.52734375, 0.875 , 0.875, 1.0), - ) - self.add_row( typekeys= 'residential', - osmfilters = ['building.*','building'], - colors= (0.921875, 0.78125 , 0.4375 , 1.0), - ) + self.add_row(typekeys='leisure', + osmfilters=['sport', 'leisure.park', 'park'], + colors=(0.5, 0.8, 0.6, 1.0) + ) + self.add_row(typekeys='commercial', + osmfilters=['shop.*', 'building.commercial'], + colors=(0.6171875, 0.6171875, 0.875, 1.0), + ) + self.add_row(typekeys='industrial', + osmfilters=['building.industrial'], + colors=(0.89453125, 0.65625, 0.63671875, 1.0), + ) + self.add_row(typekeys='parking', + osmfilters=['building.parking', 'amenity.parking'], + colors=(0.52734375, 0.875, 0.875, 1.0), + ) + self.add_row(typekeys='residential', + osmfilters=['building.*', 'building'], + colors=(0.921875, 0.78125, 0.4375, 1.0), + ) class Zones(am.ArrayObjman): + def __init__(self, parent, edges, **kwargs): - self._init_objman( ident='zones', parent=parent, - name = 'Zones', - info = 'Traffic Assignment Zones (TAZ)', - is_plugin = True, - **kwargs) - - self.add_col(SumoIdsConf('Zone', name = 'Name', perm = 'rw')) - self.add_col(am.ArrayConf( 'coords', np.zeros(3, dtype=np.float32), - groupnames = ['state'], - perm='r', - name = 'Coords', - unit = 'm', - info = 'Zone center coordinates.', - is_plugin = True, - )) - - self.add_col(am.ListArrayConf( 'shapes', - groupnames = ['_private'], - perm='rw', - name = 'Shape', - unit = 'm', - info = 'List of 3D Shape coordinates delimiting a zone.', - is_plugin = True, - )) - - self.add_col(am.IdlistsArrayConf( 'ids_edges_orig', edges, - groupnames = ['state'], - name = 'IDs orig edges', - info = 'List with IDs of network edges that can be used as origins for trips in this zone.', - )) - - - - self.add_col(am.IdlistsArrayConf( 'ids_edges_dest', edges, - groupnames = ['state'], - name = 'IDs dest edges', - info = 'List with IDs of network edges that can be used as origins for trips in this zone.', - )) - - self.add_col(am.ListArrayConf( 'probs_edges_orig', - groupnames = ['state'], - #perm='rw', - name = 'edge probs origin', - info = 'Probabilities of edges to be at the origin of a trip departing from this zone.', - )) - self.add_col(am.ListArrayConf( 'probs_edges_dest', - groupnames = ['state'], - #perm='rw', - name = 'edge probs dest', - info = 'Probabilities of edges to be a destination of a trip arriving at this zone.', - )) - - - - - - def make(self, zonename = '', coord = np.zeros(3, dtype=np.float32), shape = []): + self._init_objman(ident='zones', parent=parent, + name='Zones', + info='Traffic Assignment Zones (TAZ)', + is_plugin=True, + **kwargs) + + self.add_col(SumoIdsConf('Zone', name='Name', perm='rw')) + self.add_col(am.ArrayConf('coords', np.zeros(3, dtype=np.float32), + groupnames=['state'], + perm='r', + name='Coords', + unit='m', + info='Zone center coordinates.', + is_plugin=True, + )) + + self.add_col(am.ListArrayConf('shapes', + groupnames=['_private'], + perm='rw', + name='Shape', + unit='m', + info='List of 3D Shape coordinates delimiting a zone.', + is_plugin=True, + )) + + self.add_col(am.IdlistsArrayConf('ids_edges_orig', edges, + groupnames=['state'], + name='IDs orig edges', + info='List with IDs of network edges that can be used as origins for trips in this zone.', + )) + + self.add_col(am.IdlistsArrayConf('ids_edges_dest', edges, + groupnames=['state'], + name='IDs dest edges', + info='List with IDs of network edges that can be used as origins for trips in this zone.', + )) + + self.add_col(am.ListArrayConf('probs_edges_orig', + groupnames=['state'], + # perm='rw', + name='edge probs origin', + info='Probabilities of edges to be at the origin of a trip departing from this zone.', + )) + self.add_col(am.ListArrayConf('probs_edges_dest', + groupnames=['state'], + # perm='rw', + name='edge probs dest', + info='Probabilities of edges to be a destination of a trip arriving at this zone.', + )) + + def make(self, zonename='', coord=np.zeros(3, dtype=np.float32), shape=[]): """ Add a zone """ - #print 'Zone.make',coord - #print ' shape',type(shape),shape - + # print 'Zone.make',coord + # print ' shape',type(shape),shape + self.get_coords_from_shape(shape) - id_zone = self.add_row( coords = self.get_coords_from_shape(shape), - shapes =shape, - ) + id_zone = self.add_row(coords=self.get_coords_from_shape(shape), + shapes=shape, + ) if zonename == '': self.ids_sumo[id_zone] = str(id_zone) else: self.ids_sumo[id_zone] = zonename - + self.identify_zoneedges(id_zone) - #print ' shapes\n',self.shapes.value - #print ' zone.shapes[id_zone]\n',self.shapes[id_zone] + # print ' shapes\n',self.shapes.value + # print ' zone.shapes[id_zone]\n',self.shapes[id_zone] return id_zone - + def get_coords_from_shape(self, shape): - #print 'get_coords_from_shape',np.array(shape),np.mean(np.array(shape),0) - return np.mean(np.array(shape),0) - + # print + # 'get_coords_from_shape',np.array(shape),np.mean(np.array(shape),0) + return np.mean(np.array(shape), 0) + def del_element(self, id_zone): - #print 'del_element',id_zone + # print 'del_element',id_zone self.del_row(id_zone) - + def get_edges(self): return self.ids_edges_dest.get_linktab() - + def refresh_zoneedges(self): for _id in self.get_ids(): self.identify_zoneedges(_id) self.make_egdeprobs(_id) - - + def update_netoffset(self, deltaoffset): """ Called when network offset has changed. Children may need to adjust theur coordinates. """ - #self.zones.update_netoffset(deltaoffset) - self.coords.value[:,:2]= self.coords.value[:,:2] + deltaoffset + # self.zones.update_netoffset(deltaoffset) + self.coords.value[:, :2] = self.coords.value[:, :2] + deltaoffset shapes = self.shapes.value for i in xrange(len(shapes)): s = np.array(shapes[i]) - s[:,:2] = s[:,:2] + deltaoffset + s[:, :2] = s[:, :2] + deltaoffset shapes[i] = list(s) - - def identify_zoneedges(self,id_zone): - #print 'identify_zoneedges',id_zone + + def identify_zoneedges(self, id_zone): + # print 'identify_zoneedges',id_zone inds_within = [] ind = 0 - #print ' self.shapes[id_zone]',self.shapes[id_zone] - - polygon = np.array(self.shapes[id_zone])[:,:2] + # print ' self.shapes[id_zone]',self.shapes[id_zone] + + polygon = np.array(self.shapes[id_zone])[:, :2] for polyline in self.get_edges().shapes.value: - #print ' polygon',polygon,type(polygon) - #print ' np.array(polyline)[:,:2]',np.array(polyline)[:,:2],type(np.array(polyline)[:,:2]) - if is_polyline_in_polygon(np.array(polyline)[:,:2],polygon): + # print ' polygon',polygon,type(polygon) + # print ' + # np.array(polyline)[:,:2]',np.array(polyline)[:,:2],type(np.array(polyline)[:,:2]) + if is_polyline_in_polygon(np.array(polyline)[:, :2], polygon): inds_within.append(ind) - ind +=1 - - #print ' inds_within',inds_within - + ind += 1 + + # print ' inds_within',inds_within + # select and determine weights - self.ids_edges_orig[id_zone] = self.get_edges().get_ids(inds_within) - self.ids_edges_dest[id_zone] = self.get_edges().get_ids(inds_within) - + self.ids_edges_orig[id_zone] = self.get_edges().get_ids(inds_within) + self.ids_edges_dest[id_zone] = self.get_edges().get_ids(inds_within) + def make_egdeprobs(self, id_zone): """ Returns two dictionaries with normalized edge weight distribution one for departures and one for arrivals. - + The dictionaries have id_zone as key and a and an array of edge weights as value. """ #zones = self.zones.value #edgeweights_orig = {} #edgeweights_dest = {} - - #for id_zone in zones.get_ids(): + + # for id_zone in zones.get_ids(): n_edges_orig = len(self.ids_edges_orig[id_zone]) n_edges_dest = len(self.ids_edges_dest[id_zone]) # da fare meglio... - if n_edges_orig>0: - self.probs_edges_orig[id_zone] = 1.0/float(n_edges_orig)*np.ones(n_edges_orig,np.float) + if n_edges_orig > 0: + self.probs_edges_orig[id_zone] = 1.0 / \ + float(n_edges_orig) * np.ones(n_edges_orig, np.float) else: self.probs_edges_orig[id_zone] = 1.0 - - if n_edges_dest>0: - self.probs_edges_dest[id_zone] = 1.0/float(n_edges_dest)*np.ones(n_edges_dest,np.float) + + if n_edges_dest > 0: + self.probs_edges_dest[id_zone] = 1.0 / \ + float(n_edges_dest) * np.ones(n_edges_dest, np.float) else: - self.probs_edges_dest[id_zone] = 1.0 - - - - - + self.probs_edges_dest[id_zone] = 1.0 + + class Facilities(am.ArrayObjman): - def __init__(self, parent, landusetypes, zones, net = None, **kwargs): - #print 'Facilities.__init__',hasattr(self,'lanes') - self._init_objman( ident='facilities', - parent=parent, - name = 'Facilities', - info = 'Information on buildings, their type of usage and access to the transport network.', - xmltag = ('polys','poly','ids_sumo'), - **kwargs) - - self.add_col(SumoIdsConf('Facility',info = 'SUMO facility ID')) - - self.add_col(am.IdsArrayConf( 'ids_landusetype', landusetypes, - groupnames = ['landuse'], - choices = landusetypes.typekeys.get_indexmap(), - name = 'ID landuse', - info = 'ID of landuse.', - )) - - - self.add_col(am.IdsArrayConf( 'ids_zone', zones, - groupnames = ['landuse'], - choices = zones.ids_sumo.get_indexmap(), - name = 'ID zone', - info = 'ID of traffic zone, where this facility is located.', - )) - - - - self.add_col(am.ArrayConf( 'osmkeys', '', - dtype = 'object',# actually a string of variable length - perm='rw', - name = 'OSM key', - info = 'OSM key of facility.', - xmltag = 'type', - )) - - self.add_col(am.ArrayConf( 'areas', 0.0, - dtype=np.float32, - groupnames = ['landuse'], - perm='r', - name = 'Area', - unit = 'm^2', - info = 'Area of this facility.', - )) - - - self.add_col(am.ArrayConf( 'centroids', np.zeros(3, dtype=np.float32), - dtype=np.float32, - groupnames = ['state','_private'], - perm='r', - name = 'Center', - unit = 'm', - info = 'Center coordinates of this facility.', - )) - - self.add_col(am.ListArrayConf( 'shapes', - groupnames = ['_private'], - perm='rw', - name = 'Shape', - unit = 'm', - info = 'List of 3D Shape coordinates of facility.', - xmltag = 'shape', - )) - + + def __init__(self, parent, landusetypes, zones, net=None, **kwargs): + # print 'Facilities.__init__',hasattr(self,'lanes') + self._init_objman(ident='facilities', + parent=parent, + name='Facilities', + info='Information on buildings, their type of usage and access to the transport network.', + xmltag=('polys', 'poly', 'ids_sumo'), + **kwargs) + + self.add_col(SumoIdsConf('Facility', info='SUMO facility ID')) + + self.add_col(am.IdsArrayConf('ids_landusetype', landusetypes, + groupnames=['landuse'], + choices=landusetypes.typekeys.get_indexmap(), + name='ID landuse', + info='ID of landuse.', + )) + + self.add_col(am.IdsArrayConf('ids_zone', zones, + groupnames=['landuse'], + choices=zones.ids_sumo.get_indexmap(), + name='ID zone', + info='ID of traffic zone, where this facility is located.', + )) + + self.add_col(am.ArrayConf('osmkeys', '', + # actually a string of variable length + dtype='object', + perm='rw', + name='OSM key', + info='OSM key of facility.', + xmltag='type', + )) + + self.add_col(am.ArrayConf('areas', 0.0, + dtype=np.float32, + groupnames=['landuse'], + perm='r', + name='Area', + unit='m^2', + info='Area of this facility.', + )) + + self.add_col(am.ArrayConf('centroids', np.zeros(3, dtype=np.float32), + dtype=np.float32, + groupnames=['state', '_private'], + perm='r', + name='Center', + unit='m', + info='Center coordinates of this facility.', + )) + + self.add_col(am.ListArrayConf('shapes', + groupnames=['_private'], + perm='rw', + name='Shape', + unit='m', + info='List of 3D Shape coordinates of facility.', + xmltag='shape', + )) + # configure only if net is initialized if net != None: - self.add_col(am.IdsArrayConf( 'ids_roadedge_closest', net.edges, - groupnames = ['landuse'], - name = 'Road edge ID', - info = 'ID of road edge which is closest to this facility.', - )) - - - self.add_col(am.ArrayConf( 'positions_roadedge_closest', 0.0, - dtype=np.float32, - groupnames = ['landuse'], - perm='r', - name = 'Road edge pos', - unit = 'm', - info = 'Position on road edge which is closest to this facility', - )) - - - - #self.ids_stop_closest = self.facilities.add(cm.ArrayConf( 'ids_stop_closest', None, + self.add_col(am.IdsArrayConf('ids_roadedge_closest', net.edges, + groupnames=['landuse'], + name='Road edge ID', + info='ID of road edge which is closest to this facility.', + )) + + self.add_col(am.ArrayConf('positions_roadedge_closest', 0.0, + dtype=np.float32, + groupnames=['landuse'], + perm='r', + name='Road edge pos', + unit='m', + info='Position on road edge which is closest to this facility', + )) + + # self.ids_stop_closest = self.facilities.add(cm.ArrayConf( 'ids_stop_closest', None, # dtype = 'object', - # name = 'ID stops', + # name = 'ID stops', # perm='rw', # info = 'List of IDs of closest public transport stops.', # )) - - def write_xml(self, fd, indent=0, is_print_begin_end = True): + + def write_xml(self, fd, indent=0, is_print_begin_end=True): xmltag, xmltag_item, attrname_id = self.xmltag layer_default = -1 fill_default = 1 ids_landusetype = self.ids_landusetype landusecolors = self.get_landusetypes().colors - + if is_print_begin_end: fd.write(xm.begin(xmltag, indent)) - + attrsconfigs_write = [self.ids_sumo, self.osmkeys, self.shapes] for _id in self.get_ids(): - fd.write(xm.start(xmltag_item,indent+2)) + fd.write(xm.start(xmltag_item, indent + 2)) for attrsconfig in attrsconfigs_write: - attrsconfig.write_xml(fd,_id) - - landusecolors.write_xml(fd, ids_landusetype[_id]) - fd.write(xm.num('layer',layer_default)) - fd.write(xm.num('fill',fill_default)) - - fd.write(xm.stopit()) - + attrsconfig.write_xml(fd, _id) + + landusecolors.write_xml(fd, ids_landusetype[_id]) + fd.write(xm.num('layer', layer_default)) + fd.write(xm.num('fill', fill_default)) + + fd.write(xm.stopit()) + if is_print_begin_end: fd.write(xm.end(xmltag, indent)) - + def get_landusetypes(self): - return self.ids_landusetype.get_linktab() - + return self.ids_landusetype.get_linktab() + def get_net(self): - #print 'get_net',self.ids_edge_closest_road.get_linktab(),self.ids_edge_closest_road.get_linktab().parent + # print + # 'get_net',self.ids_edge_closest_road.get_linktab(),self.ids_edge_closest_road.get_linktab().parent return self.ids_roadedge_closest.get_linktab().parent - #if self.parent != None: + # if self.parent != None: # return self.parent.get_net() - #else: + # else: # return None - + def update_netoffset(self, deltaoffset): """ Called when network offset has changed. Children may need to adjust theur coordinates. """ - #self.zones.update_netoffset(deltaoffset) - self.centroids.value[:,:2]= self.centroids.value[:,:2] + deltaoffset + # self.zones.update_netoffset(deltaoffset) + self.centroids.value[:, :2] = self.centroids.value[:, :2] + deltaoffset shapes = self.shapes.value for i in xrange(len(shapes)): s = np.array(shapes[i]) - s[:,:2] = s[:,:2] + deltaoffset + s[:, :2] = s[:, :2] + deltaoffset shapes[i] = list(s) - - - + def get_edges(self): return self.ids_roadedge_closest.get_linktab() - + def identify_taz(self): """ Identifies id of traffic assignment zone for each facility. Note that not all facilities are within such a zone. """ - zones = self.ids_zone.get_linktab() - #self.get_demand().get_districts() + zones = self.ids_zone.get_linktab() + # self.get_demand().get_districts() for id_fac in self.get_ids(): for id_zone in zones.get_ids(): - if is_polyline_in_polygon(self.shapes[id_fac],zones.shapes[id_zone]): + if is_polyline_in_polygon(self.shapes[id_fac], zones.shapes[id_zone]): self.ids_zone[id_fac] = id_zone break - + def get_departure_probabilities(self): """ Returns the dictionnary of dictionaries with departure (or arrival) probabilities where probabilities[id_zone][id_landusetype] is a probability distribution vector giving for each facility the probability to depart/arrive in zone id_zone with facility type ftype. - + The ids_fac is an array that contains the facility ids in correspondence to the probability vector. """ print 'get_departure_probabilities' - probabilities={} + probabilities = {} zones = self.ids_zone.get_linktab() - inds_fac = self.get_inds() - for id_zone in zones.get_ids(): - probabilities[id_zone]={} - for id_landusetype in set(self.ids_landusetype.value): - #print ' id_zone,id_landusetype',id_zone,id_landusetype - #print ' ids_landusetype',self.ids_landusetype.value[inds_fac] - #print ' ids_zone',self.ids_zone.value[inds_fac] - #print '' - util = self.areas.value[inds_fac]*((self.ids_landusetype.value[inds_fac]==id_landusetype)&(self.ids_zone.value[inds_fac]==id_zone)) + inds_fac = self.get_inds() + for id_zone in zones.get_ids(): + probabilities[id_zone] = {} + for id_landusetype in set(self.ids_landusetype.value): + # print ' id_zone,id_landusetype',id_zone,id_landusetype + # print ' ids_landusetype',self.ids_landusetype.value[inds_fac] + # print ' ids_zone',self.ids_zone.value[inds_fac] + # print '' + util = self.areas.value[inds_fac] * ((self.ids_landusetype.value[ + inds_fac] == id_landusetype) & (self.ids_zone.value[inds_fac] == id_zone)) util_tot = np.sum(util) - #print '\n\n [id_taz][ftype]',id_taz,ftype,util_tot,np.sum(util/np.sum(util)) - #print ' self.type==ftype',self.type==ftype - #print ' self.id_taz==id_taz',self.id_taz==id_taz - #print ' util',util - if util_tot>0.0: - probabilities[id_zone][id_landusetype] = util/util_tot + # print '\n\n [id_taz][ftype]',id_taz,ftype,util_tot,np.sum(util/np.sum(util)) + # print ' self.type==ftype',self.type==ftype + # print ' self.id_taz==id_taz',self.id_taz==id_taz + # print ' util',util + if util_tot > 0.0: + probabilities[id_zone][id_landusetype] = util / util_tot else: - probabilities[id_zone][id_landusetype] = util # all zero prob - - return probabilities, self.get_ids(inds_fac) - + probabilities[id_zone][ + id_landusetype] = util # all zero prob + + return probabilities, self.get_ids(inds_fac) + def update(self, ids): for _id in ids: - self.centroids[_id] = np.mean(self.shapes[_id],0) - self.areas[_id] = find_area(np.array(self.shapes[_id],float)[:,:2]) - - #self.identify_closest_edge(ids) - - def identify_closest_edge(self, ids = None, priority_max = 5): + self.centroids[_id] = np.mean(self.shapes[_id], 0) + self.areas[_id] = find_area( + np.array(self.shapes[_id], float)[:, :2]) + + # self.identify_closest_edge(ids) + + def identify_closest_edge(self, ids=None, priority_max=5): """ Identifies edge ID and position on this edge that is closest to the centoid of each facility and the satisfies certain @@ -472,461 +468,440 @@ """ print 'identify_closest_edge' edges = self.get_edges() - - # select edges...if (edges.priorities[id_edge]<=priority_max) & edges.has_sidewalk(id_edge): + + # select edges...if (edges.priorities[id_edge]<=priority_max) & + # edges.has_sidewalk(id_edge): edges.make_segment_edge_map() - + if ids == None: - ids =self.get_ids() + ids = self.get_ids() for id_fac in ids: id_edge = edges.get_closest_edge(self.centroids[id_fac]) - - - - + # determin position on edeg where edge is closest to centroid # TODO: solve this faster with precalculated maps!! - xc,yc,zc = self.centroids[id_fac] + xc, yc, zc = self.centroids[id_fac] shape = edges.shapes[id_edge] n_segs = len(shape) - - + d_min = 10.0**8 x_min = 0.0 y_min = 0.0 j_min = 0 p_min = 0.0 pos = 0.0 - x1,y1,z1 = shape[0] + x1, y1, z1 = shape[0] edgelength = edges.lengths[id_edge] - for j in xrange(1,n_segs): - x2,y2,z2 = shape[j] - d, xp, yp = shortest_dist(x1,y1, x2,y2, xc,yc) - #print ' x1,y1=(%d,%d)'%(x1,y1),',x2,y2=(%d,%d)'%(x2,y2),',xc,yc=(%d,%d)'%(xc,yc) - #print ' d,x,y=(%d,%d,%d)'%shortest_dist(x1,y1, x2,y2, xc,yc) - if dedgelength: + p_min = pos + # print ' pos',pos,[x2-x1,y2-y1],'p_min',p_min + pos += np.linalg.norm([x2 - x1, y2 - y1]) + x1, y1 = x2, y2 + + x1, y1, z1 = shape[j_min - 1] + pos_min = p_min + np.linalg.norm([x_min - x1, y_min - y1]) + # print ' k=%d,d_min=%d, x1,y1=(%d,%d),xmin,ymin=(%d,%d),xc,yc=(%d,%d)'%(k,d_min,x1,y1,x_min,y_min,xc,yc) + # print ' pos=%d,p_min=%d,pos_min=%d'%(pos,p_min,pos_min) + + if pos_min > edgelength: pos_min = edgelength - - - #print ' id_fac,id_edge',id_fac,id_edge,pos_min + + # print ' id_fac,id_edge',id_fac,id_edge,pos_min self.ids_roadedge_closest[id_fac] = id_edge self.positions_roadedge_closest[id_fac] = pos_min - - - def add_polys(self, ids_sumo = [], **kwargs): + + def add_polys(self, ids_sumo=[], **kwargs): """ Adds a facilities as used on sumo poly xml info """ # stuff with landusetype must be done later - return self.add_rows(n=len(ids_sumo), ids_sumo = ids_sumo, **kwargs) - - def add_poly(self, id_sumo, id_landusetype =None, osmkey = None, shape = np.array([],np.float32)): + return self.add_rows(n=len(ids_sumo), ids_sumo=ids_sumo, **kwargs) + + def add_poly(self, id_sumo, id_landusetype=None, osmkey=None, shape=np.array([], np.float32)): """ Adds a facility as used on sumo poly xml info """ - #print 'add_poly',id_sumo,id_landusetype,osmkey - - + # print 'add_poly',id_sumo,id_landusetype,osmkey + landusetypes = self.get_landusetypes() - if id_landusetype!=None: + if id_landusetype != None: # this means that landusetype has been previousely identified if osmkey == None: # use filter as key osmkey = landusetypes.osmfilters[id_landusetype][0] - - - return self.add_row( ids_sumo = id_sumo, - ids_landusetype = id_landusetype, - osmkeys = osmkey, - shapes =shape, - areas = find_area(shape[:,:2]), - centroids =np.mean(shape,0) - ) - + + return self.add_row(ids_sumo=id_sumo, + ids_landusetype=id_landusetype, + osmkeys=osmkey, + shapes=shape, + areas=find_area(shape[:, :2]), + centroids=np.mean(shape, 0) + ) + else: # identify ftype from fkeys... keyvec = osmkey.split('.') - len_keyvec=len(keyvec) + len_keyvec = len(keyvec) is_match = False for id_landusetype in landusetypes.get_ids(): - #print ' ',landusetypes.osmfilters[id_landusetype] - #if fkeys==('building.industrial'): print ' check',facilitytype + # print ' ',landusetypes.osmfilters[id_landusetype] + # if fkeys==('building.industrial'): print ' + # check',facilitytype for osmfilter in landusetypes.osmfilters[id_landusetype]: - #print ' ', + # print ' ', osmfiltervec = osmfilter.split('.') - if osmkey==osmfilter: # exact match of filter + if osmkey == osmfilter: # exact match of filter is_match = True - #if fkeys==('building.industrial'):print ' found exact',osmkey - elif (len(osmfiltervec)==2)&(len_keyvec==2): - - if osmfiltervec[0]==keyvec[0]: - - if osmfiltervec[1]=='*': + # if fkeys==('building.industrial'):print ' found + # exact',osmkey + elif (len(osmfiltervec) == 2) & (len_keyvec == 2): + + if osmfiltervec[0] == keyvec[0]: + + if osmfiltervec[1] == '*': is_match = True - #if fkeys==('building.industrial'):print ' found match',osmkeyvec[0] - - #redundent to exact match - #elif osmkeyvec[1]==keyvec[1]: + # if fkeys==('building.industrial'):print ' + # found match',osmkeyvec[0] + + # redundent to exact match + # elif osmkeyvec[1]==keyvec[1]: # is_match = True # if is_match: # print ' found exact',osmkey - - - + if is_match: - #if fkeys==('building.industrial'):print ' *found:',facilitytype,fkeys - #return self.facilities.set_row(ident, type = facilitytype, polygon=polygon, fkeys = fkeys,area=find_area(polygon),centroid=np.mean(polygon,0)) - return self.add_row( ids_sumo = id_sumo, - ids_landusetype = id_landusetype, - osmkeys = osmkey, - shapes = shape, - areas = find_area(shape[:,:2]), - centroids =np.mean(shape,0) - ) - - + # if fkeys==('building.industrial'):print ' *found:',facilitytype,fkeys + # return self.facilities.set_row(ident, type = + # facilitytype, polygon=polygon, fkeys = + # fkeys,area=find_area(polygon),centroid=np.mean(polygon,0)) + return self.add_row(ids_sumo=id_sumo, + ids_landusetype=id_landusetype, + osmkeys=osmkey, + shapes=shape, + areas=find_area(shape[:, :2]), + centroids=np.mean(shape, 0) + ) + def clear(self): self.reset() self.clear_rows() - + def set_shapes(self, ids, vertices): self.shapes[ids] = vertices if not hasattr(ids, '__iter__'): ids = [ids] self.update(ids) - - - - def import_poly(self, polyfilepath,is_remove_xmlfiles=False): - print 'import_poly from %s '%(polyfilepath,) + + def import_poly(self, polyfilepath, is_remove_xmlfiles=False): + print 'import_poly from %s ' % (polyfilepath,) self.clear() - # let's read first the offset information, which are in the + # let's read first the offset information, which are in the # comment area fd = open(polyfilepath, 'r') is_comment = False is_processing = False - offset = self.get_net().get_offset() # default is offset from net - #print ' offset,offset_delta',offset,type(offset) + offset = self.get_net().get_offset() # default is offset from net + # print ' offset,offset_delta',offset,type(offset) #offset = np.array([0,0],float) for line in fd.readlines(): - if line.find('\n' % - (datetime.datetime.now(), os.path.basename(" ".join(sys.argv)))) - f.write( - '\n') + sumolib.writeXMLHeader( + fouttrips, "$Id: pedestrianFlow.py 22767 2017-01-30 11:42:27Z behrisch $", "routes") index = options.index for depart in range(options.begin, options.end): if random.random() < options.prob: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/evacuation/evacuation.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/evacuation/evacuation.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/evacuation/evacuation.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/evacuation/evacuation.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ @author Martin Taraz @author Michael Behrisch @date 2015-09-09 -@version $Id: evacuation.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: evacuation.py 22608 2017-01-17 06:28:54Z behrisch $ Starts the creation of an Evacuation Scenario @@ -15,7 +15,7 @@ Source: https://www.zensus2011.de/SharedDocs/Downloads/DE/Shapefile/VG250_1Jan2011_WGS84.zip?__blob=publicationFile&v=29 SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/evacuation/generateTraffic.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/evacuation/generateTraffic.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/evacuation/generateTraffic.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/evacuation/generateTraffic.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Martin Taraz @author Michael Behrisch @date 2015-09-09 -@version $Id: generateTraffic.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: generateTraffic.py 22608 2017-01-17 06:28:54Z behrisch $ Generates an O/D matrix for the evacuation scenario and runs od2trips SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/CompareVelocitys.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/CompareVelocitys.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/CompareVelocitys.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/CompareVelocitys.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-29 -@version $Id: CompareVelocitys.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: CompareVelocitys.py 22608 2017-01-17 06:28:54Z behrisch $ Creates a file with a comparison of velocities between Taxi-FCD and vtypeprobe. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/FetchData.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/FetchData.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/FetchData.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/FetchData.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,13 +6,13 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-15 -@version $Id: FetchData.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: FetchData.py 22608 2017-01-17 06:28:54Z behrisch $ Fetches Information of the simulated Data and the FCD. For each taxi the time, speed and position of every step will be collected and stored in a file. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,11 +6,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-17 -@version $Id: __init__.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: __init__.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/Taxi.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/Taxi.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/Taxi.py 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/Taxi.py 2017-07-23 16:22:07.000000000 +0000 @@ -6,12 +6,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-17 -@version $Id: Taxi.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: Taxi.py 22608 2017-01-17 06:28:54Z behrisch $ Represents a single Taxi. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/Traveltime_DK.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/Traveltime_DK.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/Traveltime_DK.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/Traveltime_DK.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,11 +6,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-21 -@version $Id: Traveltime_DK.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: Traveltime_DK.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/TraveltimeMulti.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/TraveltimeMulti.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/TraveltimeMulti.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/TraveltimeMulti.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,14 +6,14 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-21 -@version $Id: TraveltimeMulti.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: TraveltimeMulti.py 22608 2017-01-17 06:28:54Z behrisch $ Compares the travel time of vtypeprobe and FCD. (avg=False) Secondly the average travel time will be calculate (avg=True). SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/Traveltime.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/Traveltime.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/Traveltime.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/Traveltime.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,14 +6,14 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-21 -@version $Id: Traveltime.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: Traveltime.py 22608 2017-01-17 06:28:54Z behrisch $ Compares the travel time of vtypeprobe and FCD. (avg=False) Secondly the average travel time will be calculate (avg=True). SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/VelocityCurve.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/VelocityCurve.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/VelocityCurve.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/VelocityCurve.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-05-13 -@version $Id: VelocityCurve.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: VelocityCurve.py 22608 2017-01-17 06:28:54Z behrisch $ Shows a velocity time-variation curve for a given Taxi or for the hole day all average values. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/VelocityOverRoute.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/VelocityOverRoute.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/VelocityOverRoute.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/VelocityOverRoute.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-05-26 -@version $Id: VelocityOverRoute.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: VelocityOverRoute.py 22608 2017-01-17 06:28:54Z behrisch $ Shows the velocity of the chosen taxi over the driven route for all available sources. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/VelocityOverTime.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/VelocityOverTime.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/VelocityOverTime.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/analysis/VelocityOverTime.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-05-29 -@version $Id: VelocityOverTime.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: VelocityOverTime.py 22608 2017-01-17 06:28:54Z behrisch $ Shows the velocityCurve of the chosen taxi for all available sources, thereby the time duration per Edge is apparent. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/backup/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/backup/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/backup/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/backup/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,11 +6,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-23 -@version $Id: __init__.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: __init__.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,11 +6,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-28 -@version $Id: __init__.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: __init__.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/ParamEffectsOLD.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/ParamEffectsOLD.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/ParamEffectsOLD.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/ParamEffectsOLD.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,13 +6,13 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-07-26 -@version $Id: ParamEffectsOLD.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: ParamEffectsOLD.py 22608 2017-01-17 06:28:54Z behrisch $ Creates files with a comparison of speeds for each edge between the taxis and the average speed from the current edge. Dependent of the frequency and the taxi quota. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/ParamEffectsProcessedFCD.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/ParamEffectsProcessedFCD.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/ParamEffectsProcessedFCD.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/ParamEffectsProcessedFCD.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,7 +6,7 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-07-26 -@version $Id: ParamEffectsProcessedFCD.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: ParamEffectsProcessedFCD.py 22608 2017-01-17 06:28:54Z behrisch $ Creates files with a comparison of speeds for each edge between the taxis and the average speed from the current edge. Dependent of the frequency and the taxi quota. @@ -19,7 +19,7 @@ FQvehPickle FQoutput SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/ParamEffects.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/ParamEffects.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/ParamEffects.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/ParamEffects.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,13 +6,13 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-07-26 -@version $Id: ParamEffects.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: ParamEffects.py 22608 2017-01-17 06:28:54Z behrisch $ Creates files with a comparison of speeds for each edge between the taxis and the average speed from the current edge. Dependent of the frequency and the taxi quota. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/readPlotOLD.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/readPlotOLD.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/readPlotOLD.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/readPlotOLD.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,11 +6,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-07-26 -@version $Id: readPlotOLD.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: readPlotOLD.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/readPlot.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/readPlot.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/readPlot.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdQuality/readPlot.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,11 +6,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-07-26 -@version $Id: readPlot.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: readPlot.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/differentDepartRoutes.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/differentDepartRoutes.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/differentDepartRoutes.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/differentDepartRoutes.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-08-30 -@version $Id: differentDepartRoutes.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: differentDepartRoutes.py 22608 2017-01-17 06:28:54Z behrisch $ Reads taxi routes and create several new routeFile with different depart times for each route. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/FCDvsCompleteRoute.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/FCDvsCompleteRoute.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/FCDvsCompleteRoute.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/FCDvsCompleteRoute.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,7 +6,7 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-08 -@version $Id: FCDvsCompleteRoute.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: FCDvsCompleteRoute.py 22608 2017-01-17 06:28:54Z behrisch $ Compares the FCD-route of an taxi with the generated route which is used in the simulation. The output data can be visualized with the script My_mpl_dump_onNet based on mpl_dump_onNet from Daniel. @@ -15,7 +15,7 @@ Secondly the average of added Edges per route will be calculate (avg=True). SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/GenerateTaxiRoutesMain.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/GenerateTaxiRoutesMain.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/GenerateTaxiRoutesMain.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/GenerateTaxiRoutesMain.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-17 -@version $Id: GenerateTaxiRoutesMain.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: GenerateTaxiRoutesMain.py 22608 2017-01-17 06:28:54Z behrisch $ Main of GenerateTaxiRoutes. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,11 +6,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-17 -@version $Id: __init__.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: __init__.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/My_mpl_dump_onNet.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/My_mpl_dump_onNet.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/My_mpl_dump_onNet.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/fcdToRoutes/My_mpl_dump_onNet.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,7 @@ @author Sascha Krieg @author Michael Behrisch @date 2007-10-25 -@version $Id: My_mpl_dump_onNet.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: My_mpl_dump_onNet.py 22608 2017-01-17 06:28:54Z behrisch $ This script reads a network and a dump file and @@ -19,7 +19,7 @@ --values no,no --show --color-map 0:#888888,.4:#ff0000,1:#00ff00 SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/rawFCD/GenerateRawFCD.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/rawFCD/GenerateRawFCD.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/rawFCD/GenerateRawFCD.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/rawFCD/GenerateRawFCD.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-01 -@version $Id: GenerateRawFCD.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: GenerateRawFCD.py 22608 2017-01-17 06:28:54Z behrisch $ Converts the vtypeProbe XML-File to the raw FCD-Format which can afterwards used to process FCD. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/taxiQuantity/QuantityOverDay.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/taxiQuantity/QuantityOverDay.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/taxiQuantity/QuantityOverDay.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/taxiQuantity/QuantityOverDay.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-01 -@version $Id: QuantityOverDay.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: QuantityOverDay.py 22608 2017-01-17 06:28:54Z behrisch $ Counts for an given interval all unique taxis in an FCD file and draws the result as a bar chart. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/taxiQuantity/SeparateVLSArea.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/taxiQuantity/SeparateVLSArea.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/taxiQuantity/SeparateVLSArea.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/taxiQuantity/SeparateVLSArea.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-07 -@version $Id: SeparateVLSArea.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: SeparateVLSArea.py 22608 2017-01-17 06:28:54Z behrisch $ Separates from an FCD-File (from Nuernberg) all routes which belongs to the VLS-Area and saves them in a new file. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/taxiQuantity/TaxisPerEdge.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/taxiQuantity/TaxisPerEdge.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/taxiQuantity/TaxisPerEdge.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/taxiQuantity/TaxisPerEdge.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,14 +6,14 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-08 -@version $Id: TaxisPerEdge.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: TaxisPerEdge.py 22608 2017-01-17 06:28:54Z behrisch $ Counts for every edge in the given FCD-file the number of Taxis which used this edge. After that this information can be visualized with an script called mpl_dump_onNet from Daniel. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/BinarySearch.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/BinarySearch.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/BinarySearch.py 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/BinarySearch.py 2017-07-23 16:22:07.000000000 +0000 @@ -6,12 +6,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-01 -@version $Id: BinarySearch.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: BinarySearch.py 22608 2017-01-17 06:28:54Z behrisch $ binary search helper functions. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/CalcTime.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/CalcTime.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/CalcTime.py 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/CalcTime.py 2017-07-23 16:22:07.000000000 +0000 @@ -6,11 +6,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-17 -@version $Id: CalcTime.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: CalcTime.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,11 +6,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-17 -@version $Id: __init__.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: __init__.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/Path.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/Path.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/Path.py 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/Path.py 2017-07-23 16:22:07.000000000 +0000 @@ -6,12 +6,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-17 -@version $Id: Path.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: Path.py 22608 2017-01-17 06:28:54Z behrisch $ Contains paths which are needed frequently SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/ProgressBar.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/ProgressBar.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/ProgressBar.py 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/ProgressBar.py 2017-07-23 16:22:07.000000000 +0000 @@ -6,12 +6,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-06-19 -@version $Id: ProgressBar.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: ProgressBar.py 22608 2017-01-17 06:28:54Z behrisch $ A simple progress bar for the console SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/Reader.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/Reader.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/Reader.py 2016-11-06 09:15:45.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TaxiFCD_Krieg/src/util/Reader.py 2017-07-23 16:22:07.000000000 +0000 @@ -6,12 +6,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-04-18 -@version $Id: Reader.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: Reader.py 22608 2017-01-17 06:28:54Z behrisch $ Contains reader modules which are needed frequently SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/changeNet.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/changeNet.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/changeNet.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/changeNet.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,11 +5,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2009-06-30 -@version $Id: changeNet.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: changeNet.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/evaluator.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/evaluator.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/evaluator.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/evaluator.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,11 +5,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2009-06-30 -@version $Id: evaluator.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: evaluator.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/main.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/main.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/main.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/main.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,11 +6,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2009-06-30 -@version $Id: main.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: main.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/plotter.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/plotter.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/plotter.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/plotter.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,11 +5,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2009-06-30 -@version $Id: plotter.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: plotter.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/test.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/test.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/test.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/TLS-Evaluationsszenarien/test.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,11 +6,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2009-06-30 -@version $Id: test.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: test.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/commons.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/commons.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/commons.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/commons.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,13 @@ @file commons.py @author Marek Heinrich @date 2014-11-17 -@version $Id: commons.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: commons.py 22608 2017-01-17 06:28:54Z behrisch $ >>>>>>> .r17519 Commons module. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/dijkstra_base.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/dijkstra_base.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/dijkstra_base.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/dijkstra_base.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @file dijkstra_base.py @author Marek Heinrich @date 2014-11-17 -@version $Id: dijkstra_base.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: dijkstra_base.py 22608 2017-01-17 06:28:54Z behrisch $ Dijkstra module. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/main.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/main.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/main.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/main.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @file main.py @author Marek Heinrich @date 2014-11-17 -@version $Id: main.py 20687 2016-05-10 11:27:00Z behrisch $ +@version $Id: main.py 22608 2017-01-17 06:28:54Z behrisch $ Main module. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/test.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/test.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/test.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/test.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @file test.py @author Marek Heinrich @date 2014-11-17 -@version $Id: test.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: test.py 22608 2017-01-17 06:28:54Z behrisch $ Unittests launcher module. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/unittest_ada_star_bugs_on_the_way.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/unittest_ada_star_bugs_on_the_way.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/unittest_ada_star_bugs_on_the_way.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/unittest_ada_star_bugs_on_the_way.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file unittest_ada_star_bugs_on_the_way.py @author Marek Heinrich @date 2015-11-17 -@version $Id: unittest_ada_star_bugs_on_the_way.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: unittest_ada_star_bugs_on_the_way.py 22608 2017-01-17 06:28:54Z behrisch $ Unittests for keeping records of bugs. Not for beauties. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/unittest_ada_star.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/unittest_ada_star.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/unittest_ada_star.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/unittest_ada_star.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file unittest_ada_star.py @author Marek Heinrich @date 2015-02-24 -@version $Id: unittest_ada_star.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: unittest_ada_star.py 22608 2017-01-17 06:28:54Z behrisch $ Test module for the standard path finding module. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/unittest_constants.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/unittest_constants.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/unittest_constants.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/unittest_constants.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file unittest_constants.py @author Marek Heinrich @date 2015-02-24 -@version $Id: unittest_constants.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: unittest_constants.py 22608 2017-01-17 06:28:54Z behrisch $ Test module keeping test related attributes. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/unittest_dijkstra.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/unittest_dijkstra.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/unittest_dijkstra.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/unittest_dijkstra.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file unittest_dijkstra.py @author Marek Heinrich @date 2015-02-24 -@version $Id: unittest_dijkstra.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: unittest_dijkstra.py 22608 2017-01-17 06:28:54Z behrisch $ Unittests for Dijkstra. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/unittest_flaeche.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/unittest_flaeche.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/unittest_flaeche.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/unittest_flaeche.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file unittest_flaeche.py @author Marek Heinrich @date 2015-02-24 -@version $Id: unittest_flaeche.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: unittest_flaeche.py 22608 2017-01-17 06:28:54Z behrisch $ Test module for flaeche functions. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/unittest_utils.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/unittest_utils.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/unittest_utils.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/unittest_utils.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file unittest_utils.py @author Marek Heinrich @date 2015-02-24 -@version $Id: unittest_utils.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: unittest_utils.py 22608 2017-01-17 06:28:54Z behrisch $ Test module for utils functions. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/unittest_vessel.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/unittest_vessel.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/projects/vehicles2d/unittest_vessel.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/projects/vehicles2d/unittest_vessel.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file unittest_vessel.py @author Marek Heinrich @date 2015-02-24 -@version $Id: unittest_vessel.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: unittest_vessel.py 22608 2017-01-17 06:28:54Z behrisch $ Test module for vessels functions. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/purgatory/10to11.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/purgatory/10to11.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/purgatory/10to11.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/purgatory/10to11.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file 10to11.py @author Michael Behrisch @date 2009-06-09 -@version $Id: 10to11.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: 10to11.py 22608 2017-01-17 06:28:54Z behrisch $ Transfers configuration files from character data to attribute style. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/purgatory/generate-ns2.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/purgatory/generate-ns2.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/purgatory/generate-ns2.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/purgatory/generate-ns2.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ @author Axel Wegener @author Michael Behrisch @date 2006-08-07 -@version $Id: generate-ns2.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: generate-ns2.py 22608 2017-01-17 06:28:54Z behrisch $ automating generation of ns2-tracefiles SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/purgatory/generateTripsXml.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/purgatory/generateTripsXml.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/purgatory/generateTripsXml.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/purgatory/generateTripsXml.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Eric Melde @author Michael Behrisch @date 2009-02-09 -@version $Id: generateTripsXml.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: generateTripsXml.py 22608 2017-01-17 06:28:54Z behrisch $ This script generate a trip file as input data in sumo SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -331,7 +331,7 @@ matrixSum = 0. fouttrips = open(options.tripfile, 'w') fouttrips.write('\n') - print(""" + print(""" """ % datetime.datetime.now(), file=fouttrips) fouttrips.write("\n") diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/purgatory/kShortest.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/purgatory/kShortest.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/purgatory/kShortest.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/purgatory/kShortest.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,13 +5,13 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-02-14 -@version $Id: kShortest.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: kShortest.py 22608 2017-01-17 06:28:54Z behrisch $ Calculating k shortest paths in a dijkstra like fashion storing k predecessors SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/purgatory/removeSVN.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/purgatory/removeSVN.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/purgatory/removeSVN.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/purgatory/removeSVN.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,10 +4,10 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 28-08-2008 -@version $Id: removeSVN.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: removeSVN.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/purgatory/routes2OD.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/purgatory/routes2OD.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/purgatory/routes2OD.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/purgatory/routes2OD.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,14 +5,14 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2009-04-15 -@version $Id: routes2OD.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: routes2OD.py 22608 2017-01-17 06:28:54Z behrisch $ Creates an OD-matrix in visum format $O from a route.xml file when starting the programm the name for the inputfile and the outputfile have to de supplied via the command line SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/randomTrips.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/randomTrips.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/randomTrips.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/randomTrips.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ @author Jakob Erdmann @author Michael Behrisch @date 2010-03-06 -@version $Id: randomTrips.py 21557 2016-09-28 10:43:52Z luecken $ +@version $Id: randomTrips.py 23999 2017-04-21 09:04:47Z behrisch $ Generates random trips for the given network. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -36,6 +36,7 @@ sys.path.append(os.path.join(SUMO_HOME, 'tools')) import sumolib import route2trips +from sumolib.miscutils import euclidean DUAROUTER = sumolib.checkBinary('duarouter') @@ -60,6 +61,8 @@ help="generates weights files for visualisation") optParser.add_option("--pedestrians", action="store_true", default=False, help="create a person file with pedestrian trips instead of vehicle trips") + optParser.add_option("--persontrips", action="store_true", + default=False, help="create a person file with person trips instead of vehicle trips") optParser.add_option("--prefix", dest="tripprefix", default="", help="prefix for the trip ids") optParser.add_option("-t", "--trip-attributes", dest="tripattrs", @@ -81,18 +84,23 @@ default=1.0, help="multiply weight of fringe edges by (default 1") optParser.add_option("--fringe-threshold", type="float", dest="fringe_threshold", default=0.0, help="only consider edges with speed above as fringe edges (default 0)") + optParser.add_option("--allow-fringe", dest="allow_fringe", action="store_true", + default=False, help="Allow departing on edges that leave the network and arriving on edges that enter the network (via turnarounds or as 1-edge trips") optParser.add_option("--min-distance", type="float", dest="min_distance", default=0.0, help="require start and end edges for each trip to be at least m appart") optParser.add_option("--max-distance", type="float", dest="max_distance", default=None, help="require start and end edges for each trip to be at most m appart (default 0 which disables any checks)") optParser.add_option("-i", "--intermediate", type="int", default=0, help="generates the given number of intermediate way points") + optParser.add_option("--flows", type="int", + default=0, help="generates INT flows that together output vehicles with the specified period") optParser.add_option("--maxtries", type="int", default=100, help="number of attemps for finding a trip which meets the distance constraints") optParser.add_option("--binomial", type="int", metavar="N", help="If this is set, the number of departures per seconds will be drawn from a binomial distribution with n=N and p=PERIOD/N where PERIOD is the argument given to option --period. Tnumber of attemps for finding a trip which meets the distance constraints") optParser.add_option( - "-c", "--vclass", "--edge-permission", help="only from and to edges which permit the given vehicle class") + "-c", "--vclass", "--edge-permission", default="passenger", + help="only from and to edges which permit the given vehicle class") optParser.add_option( "--vehicle-class", help="The vehicle class assigned to the generated trips (adds a standard vType definition to the output file).") optParser.add_option("--validate", default=False, action="store_true", @@ -102,19 +110,24 @@ (options, args) = optParser.parse_args(args=args) if not options.netfile: optParser.print_help() - sys.exit() + sys.exit(1) + + if options.persontrips: + options.pedestrians = True if options.pedestrians: options.vclass = 'pedestrian' + if options.flows > 0: + print("Error: Person flows are not supported yet", file=sys.stderr) + sys.exit(1) if options.validate and options.routefile is None: options.routefile = "routes.rou.xml" - return options - -# euclidean distance between two coordinates in the plane -def euclidean(a, b): - return math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2) + if options.period <= 0: + print("Error: Period must be positive", file=sys.stderr) + sys.exit(1) + return options class InvalidGenerator(Exception): @@ -224,10 +237,12 @@ def buildTripGenerator(net, options): try: + forbidden_source_fringe = None if options.allow_fringe else "_outgoing" + forbidden_sink_fringe = None if options.allow_fringe else "_incoming" source_generator = RandomEdgeGenerator( - net, get_prob_fun(options, "_incoming", "_outgoing")) + net, get_prob_fun(options, "_incoming", forbidden_source_fringe)) sink_generator = RandomEdgeGenerator( - net, get_prob_fun(options, "_outgoing", "_incoming")) + net, get_prob_fun(options, "_outgoing", forbidden_sink_fringe)) if options.weightsprefix: if os.path.isfile(options.weightsprefix + SOURCE_SUFFIX): source_generator = RandomEdgeGenerator( @@ -236,8 +251,8 @@ sink_generator = RandomEdgeGenerator( net, LoadedProps(options.weightsprefix + SINK_SUFFIX)) except InvalidGenerator: - print( - "Error: no valid edges for generating source or destination", file=sys.stderr) + print("Error: no valid edges for generating source or destination. Try using option --allow-fringe", + file=sys.stderr) return None try: @@ -254,7 +269,8 @@ else: via_generator = None - return RandomTripGenerator(source_generator, sink_generator, via_generator, options.intermediate, options.pedestrians) + return RandomTripGenerator( + source_generator, sink_generator, via_generator, options.intermediate, options.pedestrians) def is_walk_attribute(attr): @@ -264,6 +280,33 @@ return False +def is_persontrip_attribute(attr): + for cand in ['vTypes', 'modes']: + if cand in attr: + return True + return False + + +def split_trip_attributes(tripattrs): + # figure out which of the tripattrs belong to the and which + # belong to the or + personattrs = [] + otherattrs = [] + for a in tripattrs.split(): + if is_walk_attribute(a) or is_persontrip_attribute(a): + otherattrs.append(a) + else: + personattrs.append(a) + return prependSpace(' '.join(personattrs)), prependSpace(' '.join(otherattrs)) + + +def prependSpace(s): + if len(s) == 0 or s[0] == " ": + return s + else: + return " " + s + + def main(options): if options.seed: random.seed(options.seed) @@ -279,12 +322,10 @@ idx = 0 if options.pedestrians: - # figure out which of the tripattrs belong to the and which - # belong to the - walkattrs = ' '.join( - [a for a in options.tripattrs.split() if is_walk_attribute(a)]) - personattrs = ' '.join( - [a for a in options.tripattrs.split() if not is_walk_attribute(a)]) + personattrs, otherattrs = split_trip_attributes(options.tripattrs) + options.tripattrs = prependSpace(options.tripattrs) + + vias = {} def generate_one(idx): label = "%s%s" % (options.tripprefix, idx) @@ -293,16 +334,30 @@ options.min_distance, options.max_distance, options.maxtries) via = "" if len(intermediate) > 0: - via = 'via="%s" ' % ' '.join( + via = ' via="%s" ' % ' '.join( [e.getID() for e in intermediate]) + if options.validate: + vias[label] = via if options.pedestrians: fouttrips.write( - ' \n' % (label, depart, personattrs)) - fouttrips.write( - ' \n' % (source_edge.getID(), sink_edge.getID(), walkattrs)) + ' \n' % (label, depart, personattrs)) + if options.persontrips: + fouttrips.write( + ' \n' % (source_edge.getID(), sink_edge.getID(), otherattrs)) + else: + fouttrips.write( + ' \n' % (source_edge.getID(), sink_edge.getID(), otherattrs)) fouttrips.write(' \n') + elif options.flows > 0: + if options.binomial: + for j in range(options.binomial): + fouttrips.write(' \n' % ( + label, j, options.begin, options.end, 1.0 / options.period / options.binomial, source_edge.getID(), sink_edge.getID(), via, options.tripattrs)) + else: + fouttrips.write(' \n' % ( + label, options.begin, options.end, options.period * options.flows, source_edge.getID(), sink_edge.getID(), via, options.tripattrs)) else: - fouttrips.write(' \n' % ( + fouttrips.write(' \n' % ( label, depart, source_edge.getID(), sink_edge.getID(), via, options.tripattrs)) except Exception as exc: print(exc, file=sys.stderr) @@ -310,28 +365,32 @@ with open(options.tripfile, 'w') as fouttrips: sumolib.writeXMLHeader( - fouttrips, "$Id: randomTrips.py 21557 2016-09-28 10:43:52Z luecken $") - fouttrips.write("\n") + fouttrips, "$Id: randomTrips.py 23999 2017-04-21 09:04:47Z behrisch $", "routes") if options.vehicle_class: fouttrips.write(' \n' % (options.vehicle_class, options.vehicle_class)) options.tripattrs += ' type="%s"' % options.vehicle_class depart = options.begin if trip_generator: - while depart < options.end: - if options.binomial is None: - # generate with constant spacing + if options.flows == 0: + while depart < options.end: + if options.binomial is None: + # generate with constant spacing + idx = generate_one(idx) + depart += options.period + else: + # draw n times from a bernouli distribution + # for an average arrival rate of 1 / period + prob = 1.0 / options.period / options.binomial + for i in range(options.binomial): + if random.random() < prob: + idx = generate_one(idx) + depart += 1 + else: + for i in range(options.flows): idx = generate_one(idx) - depart += options.period - else: - # draw n times from a bernouli distribution - # for an average arrival rate of 1 / period - prob = 1.0 / options.period / options.binomial - for i in range(options.binomial): - if random.random() < prob: - idx = generate_one(idx) - depart += 1 - fouttrips.write("\n") + + fouttrips.write("\n") if options.routefile: args = [DUAROUTER, '-n', options.netfile, '-t', options.tripfile, '-o', options.routefile, '--ignore-errors', @@ -343,7 +402,8 @@ if options.validate: print("calling route2trips") - route2trips.main([options.routefile], outfile=options.tripfile) + route2trips.main([options.routefile], outfile=options.tripfile, + vias=vias, calledBy=" via randomTrips.py") if options.weights_outprefix: trip_generator.source_generator.write_weights( diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/cutRoutes.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/cutRoutes.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/cutRoutes.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/cutRoutes.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,14 +3,15 @@ @file cutRoutes.py @author Jakob Erdmann @author Michael Behrisch -@date 2012-08-15 -@version $Id: cutRoutes.py 20632 2016-05-03 14:17:01Z behrisch $ +@author Leonhard Luecken +@date 2017-04-11 +@version $Id: cutRoutes.py 23999 2017-04-21 09:04:47Z behrisch $ Cut down routes from a large scenario to a sub-scenario optionally using exitTimes Output can be a route file or a tripfile. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -24,6 +25,8 @@ import os import sys import codecs +import copy + from optparse import OptionParser from collections import defaultdict import sort_routes @@ -60,7 +63,7 @@ help="Perform out-of-memory sort using module sort_routes (slower but more memory efficient)") optParser.add_option("-d", "--disconnected-action", type='choice', default='discard', choices=['discard', 'keep'], # XXX 'split', 'longest' - help="How to deal with routes that are disconnected in the subnetwork. If 'keep' is chosen the route file must be processed with DUAROUTER with option --repair") + help="How to deal with routes that are disconnected in the subnetwork. If 'keep' is chosen a disconnected route generates several routes in the subnetwork corresponding to its parts.") #optParser.add_option("--orig-weights", help="weight file for the original network for extrapolating new departure times") options, args = optParser.parse_args() try: @@ -98,62 +101,78 @@ for vehicle in parse(routeFile, 'vehicle'): num_vehicles += 1 edges = vehicle.route[0].edges.split() - fromIndex = getFirstIndex(areaEdges, edges) - if fromIndex is None: + firstIndex = getFirstIndex(areaEdges, edges) + if firstIndex is None: continue # route does not touch the area - toIndex = len(edges) - 1 - \ + lastIndex = len(edges) - 1 - \ getFirstIndex(areaEdges, reversed(edges)) - # check for minimum length - if toIndex - fromIndex + 1 < options.min_length: - too_short += 1 - continue # check for connectivity - if missingEdges(areaEdges, edges[fromIndex:toIndex], missingEdgeOccurences): + route_parts = [(firstIndex + i, firstIndex + j) + for (i, j) in missingEdges(areaEdges, edges[firstIndex:(lastIndex + 1)], missingEdgeOccurences)] +# print("areaEdges: %s"%str(areaEdges)) +# print("routeEdges: %s"%str(edges)) +# print("firstIndex = %d"%firstIndex) +# print("route_parts = %s"%str(route_parts)) + if len(route_parts) > 1: multiAffectedRoutes += 1 if options.disconnected_action == 'discard': continue - # compute new departure - if vehicle.route[0].exitTimes is None: - if orig_net is not None: - # extrapolate new departure using default speed - newDepart = (float(vehicle.depart) + - sum([(orig_net.getEdge(e).getLength() / - (orig_net.getEdge(e).getSpeed() * options.speed_factor)) - for e in edges[:fromIndex]])) + # loop over different route parts + for ix_part, ix_interval in enumerate(route_parts): + fromIndex, toIndex = ix_interval + #print("(fromIndex,toIndex) = (%d,%d)"%(fromIndex,toIndex)) + # check for minimum length + if toIndex - fromIndex + 1 < options.min_length: + too_short += 1 + continue + # compute new departure + if vehicle.route[0].exitTimes is None: + if orig_net is not None: + # extrapolate new departure using default speed + newDepart = (float(vehicle.depart) + + sum([(orig_net.getEdge(e).getLength() / + (orig_net.getEdge(e).getSpeed() * options.speed_factor)) + for e in edges[:fromIndex]])) + else: + print( + "Could not reconstruct new departure time for vehicle '%s'. Using old departure time." % vehicle.id) + newDepart = float(vehicle.depart) else: - print( - "Could not reconstruct new departure time for vehicle '%s'. Using old departure time." % vehicle.id) - newDepart = float(vehicle.depart) - else: - exitTimes = vehicle.route[0].exitTimes.split() - departTimes = [vehicle.depart] + exitTimes[:-1] - teleportFactor = len(departTimes) / float(len(edges)) - teleportFactorSum += teleportFactor - # assume teleports were spread evenly across the vehicles route - newDepart = float(departTimes[int(fromIndex * teleportFactor)]) - del vehicle.route[0].exitTimes - remaining = edges[fromIndex:toIndex + 1] - stops = [] - if vehicle.stop: - for stop in vehicle.stop: - if stop.busStop: - if not busStopEdges: - print( - "No bus stop locations parsed, skipping bus stop '%s'." % stop.busStop) - continue - if stop.busStop not in busStopEdges: - print( - "Skipping bus stop '%s', which could not be located." % stop.busStop) - continue - if busStopEdges[stop.busStop] in remaining: + exitTimes = vehicle.route[0].exitTimes.split() + departTimes = [vehicle.depart] + exitTimes[:-1] + teleportFactor = len(departTimes) / float(len(edges)) + teleportFactorSum += teleportFactor + # assume teleports were spread evenly across the vehicles route + newDepart = float(departTimes[int(fromIndex * teleportFactor)]) + del vehicle.route[0].exitTimes + remaining = edges[fromIndex:toIndex + 1] + stops = [] + if vehicle.stop: + for stop in vehicle.stop: + if stop.busStop: + if not busStopEdges: + print( + "No bus stop locations parsed, skipping bus stop '%s'." % stop.busStop) + continue + if stop.busStop not in busStopEdges: + print( + "Skipping bus stop '%s', which could not be located." % stop.busStop) + continue + if busStopEdges[stop.busStop] in remaining: + stops.append(stop) + elif stop.lane[:-2] in remaining: stops.append(stop) - elif stop.lane[:-2] in remaining: - stops.append(stop) - vehicle.route[0].edges = " ".join(remaining) - vehicle.stop = stops - vehicle.depart = "%.2f" % newDepart - yield newDepart, vehicle - num_returned += 1 + vehicle.route[0].edges = " ".join(remaining) + vehicle.stop = stops + vehicle.depart = "%.2f" % newDepart + if len(route_parts) > 1: + # return copies of the vehicle for each route part + yield_veh = copy.deepcopy(vehicle) + yield_veh.id = vehicle.id + "_part" + str(ix_part) + yield newDepart, yield_veh + else: + yield newDepart, vehicle + num_returned += 1 if teleportFactorSum > 0: teleports = " (avg teleportFactor %s)" % ( @@ -179,12 +198,30 @@ def missingEdges(areaEdges, edges, missingEdgeOccurences): - hasBeenAffectedOnce = False - for edge in edges: + ''' + Returns a list of intervals corresponding to the overlapping parts of the route with the area + ''' + # store present edge-intervals + route_intervals = [] + start = 0 + lastEdgePresent = False # assert: first edge is always in areaEdges + for j, edge in enumerate(edges): if not edge in areaEdges: - hasBeenAffectedOnce = True + if lastEdgePresent: + # this is the end of a present interval + route_intervals.append((start, j - 1)) +# print("edge '%s' not in area."%edge) + lastEdgePresent = False missingEdgeOccurences[edge] += 1 - return hasBeenAffectedOnce + else: + if not lastEdgePresent: + # this is a start of a present interval + start = j + lastEdgePresent = True + if lastEdgePresent: + # print("edges = %s"%str(edges)) + route_intervals.append((start, len(edges) - 1)) + return route_intervals def printTop(missingEdgeOccurences, num=1000): diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/implausibleRoutes.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/implausibleRoutes.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/implausibleRoutes.py 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/implausibleRoutes.py 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,190 @@ +#!/usr/bin/env python +""" +@file implausibleRoutes.py +@author Jakob Erdmann +@date 2017-03-28 +@version $Id: implausibleRoutes.py 23999 2017-04-21 09:04:47Z behrisch $ + +Find routes that are implausible due to: + - being longer than the shortest path between the first and last edge + - being longer than the air-distance between the first and the last edge + +The script computes an implausibility-score from configurable factors and +reports all routes above the specified threshold. + +SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors + +This file is part of SUMO. +SUMO is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. +""" +from __future__ import absolute_import +from __future__ import print_function + +import os +import sys +from optparse import OptionParser +import subprocess + +if 'SUMO_HOME' in os.environ: + tools = os.path.join(os.environ['SUMO_HOME'], 'tools') + sys.path.append(os.path.join(tools)) + import sumolib + from sumolib.output import parse, parse_fast + from sumolib.net import readNet + from sumolib.miscutils import Statistics, euclidean, Colorgen + from route2poly import generate_poly +else: + sys.exit("please declare environment variable 'SUMO_HOME'") + + +def get_options(): + USAGE = """Usage %prog [options] """ + optParser = OptionParser(usage=USAGE) + optParser.add_option("-v", "--verbose", action="store_true", + default=False, help="Give more output") + optParser.add_option("--threshold", type="float", default=2.5, + help="Routes with an implausibility-score above treshold are reported") + optParser.add_option("--airdist-ratio-factor", type="float", default=1, dest="airdist_ratio_factor", + help="Implausibility factor for the ratio of routeDist/airDist ") + optParser.add_option("--detour-ratio-factor", type="float", default=1, dest="detour_ratio_factor", + help="Implausibility factor for the ratio of routeDuration/shortestDuration ") + optParser.add_option("--detour-factor", type="float", default=0.01, dest="detour_factor", + help="Implausibility factor for the absolute detour time in (routeDuration-shortestDuration) in seconds") + optParser.add_option("--standalone", action="store_true", + default=False, help="Parse stand-alone routes that are not define as child-element of a vehicle") + optParser.add_option("--blur", type="float", default=0, + help="maximum random disturbance to output polygon geometry") + optParser.add_option("--ignore-routes", dest="ignore_routes", + help="List of route IDs (one per line) that are filtered when generating polygons and command line output (they will still be added to restrictions-output)") + optParser.add_option("--restriction-output", dest="restrictions_output", + help="Write flow-restriction output suitable for passing to flowrouter.py to FILE") + options, args = optParser.parse_args() + + if len(args) != 2: + sys.exit(USAGE) + options.network = args[0] + options.routeFile = args[1] + return options + + +def getRouteLength(net, edges): + return sum([net.getEdge(e).getLength() for e in edges]) + + +class RouteInfo: + pass + + +def main(): + DUAROUTER = sumolib.checkBinary('duarouter') + options = get_options() + net = readNet(options.network) + + routeInfos = {} # id-> RouteInfo + if options.standalone: + for route in parse(options.routeFile, 'route'): + ri = RouteInfo() + ri.edges = route.edges.split() + routeInfos[route.id] = ri + else: + for vehicle in parse(options.routeFile, 'vehicle'): + ri = RouteInfo() + ri.edges = vehicle.route[0].edges.split() + routeInfos[vehicle.id] = ri + + for rInfo in routeInfos.values(): + rInfo.airDist = euclidean( + net.getEdge(rInfo.edges[0]).getShape()[0], + net.getEdge(rInfo.edges[-1]).getShape()[-1]) + rInfo.length = getRouteLength(net, rInfo.edges) + rInfo.airDistRatio = rInfo.length / rInfo.airDist + + duarouterInput = options.routeFile + if options.standalone: + # generate suitable input file for duarouter + duarouterInput += ".vehRoutes.xml" + with open(duarouterInput, 'w') as outf: + outf.write('\n') + for rID, rInfo in routeInfos.items(): + outf.write(' \n' % rID) + outf.write(' \n' % ' '.join(rInfo.edges)) + outf.write(' \n') + outf.write('\n') + + duarouterOutput = options.routeFile + '.rerouted.rou.xml' + duarouterAltOutput = options.routeFile + '.rerouted.rou.alt.xml' + + subprocess.call([DUAROUTER, + '-n', options.network, + '-r', duarouterInput, + '-o', duarouterOutput, + '--no-step-log']) + + for vehicle in parse(duarouterAltOutput, 'vehicle'): + routeAlts = vehicle.routeDistribution[0].route + if len(routeAlts) == 1: + routeInfos[vehicle.id].detour = 0 + routeInfos[vehicle.id].detourRatio = 1 + else: + oldCosts = float(routeAlts[0].cost) + newCosts = float(routeAlts[1].cost) + assert(routeAlts[0].edges.split() == routeInfos[vehicle.id].edges) + if oldCosts <= newCosts: + routeInfos[vehicle.id].detour = 0 + routeInfos[vehicle.id].detourRatio = 1 + if oldCosts < newCosts: + sys.stderr.write("Warning: fastest route for '%s' is slower than original route (old=%s, new=%s). Check vehicle types\n" % ( + vehicle.id, oldCosts, newCosts)) + else: + routeInfos[vehicle.id].detour = oldCosts - newCosts + routeInfos[vehicle.id].detourRatio = oldCosts / newCosts + + implausible = [] + allRoutesStats = Statistics("overal implausiblity") + implausibleRoutesStats = Statistics("implausiblity above threshold") + for rID in sorted(routeInfos.keys()): + ri = routeInfos[rID] + ri.implausibility = (options.airdist_ratio_factor * ri.airDistRatio + + options.detour_factor * ri.detour + + options.detour_ratio_factor * ri.detourRatio) + allRoutesStats.add(ri.implausibility, rID) + if ri.implausibility > options.threshold: + implausible.append((ri.implausibility, rID, ri)) + implausibleRoutesStats.add(ri.implausibility, rID) + + # generate restrictions + if options.restrictions_output is not None: + with open(options.restrictions_output, 'w') as outf: + for score, rID, ri in sorted(implausible): + outf.write("0 %s\n" % " ".join(ri.edges)) + + if options.ignore_routes is not None: + numImplausible = len(implausible) + ignored = set([r.strip() for r in open(options.ignore_routes)]) + implausible = [r for r in implausible if not r in ignored] + print("Loadeded %s routes to ignore. Reducing implausible from %s to %s" % ( + len(ignored), numImplausible, len(implausible))) + + # generate polygons + polyOutput = options.routeFile + '.implausible.add.xml' + colorgen = Colorgen(("random", 1, 1)) + with open(polyOutput, 'w') as outf: + outf.write('\n') + for score, rID, ri in sorted(implausible): + generate_poly(net, rID, colorgen(), 100, False, ri.edges, options.blur, outf, score) + outf.write('\n') + + for score, rID, ri in sorted(implausible): + # , ' '.join(ri.edges))) + sys.stdout.write('%s\t%s\t%s\n' % (score, rID, (ri.airDistRatio, ri.detourRatio, ri.detour))) + + print(allRoutesStats) + print(implausibleRoutesStats) + + +if __name__ == "__main__": + main() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/route_1htoDay.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/route_1htoDay.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/route_1htoDay.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/route_1htoDay.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,13 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 11.09.2009 -@version $Id: route_1htoDay.py 21851 2016-10-31 12:20:12Z behrisch $ +@version $Id: route_1htoDay.py 22608 2017-01-17 06:28:54Z behrisch $ Uses "route_departOffset.py" for building 24 route files which describe a whole day assuming the given route files describes an hour. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/route2alts.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/route2alts.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/route2alts.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/route2alts.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 11.09.2009 -@version $Id: route2alts.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: route2alts.py 22608 2017-01-17 06:28:54Z behrisch $ Counts possible routes for all depart/arrival edges. Builds route alternatives assigning the so determined probabilities to use a route. @@ -12,7 +12,7 @@ Please note that the cost of the route is not computed! SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/route2poly.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/route2poly.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/route2poly.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/route2poly.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,13 @@ @author Jakob Erdmann @author Michael Behrisch @date 2012-11-15 -@version $Id: route2poly.py 21131 2016-07-08 07:59:22Z behrisch $ +@version $Id: route2poly.py 23999 2017-04-21 09:04:47Z behrisch $ From a sumo network and a route file, this script generates a polygon (polyline) for every route which can be loaded with sumo-gui for visualization SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -46,15 +46,20 @@ default=False, help="write polgyons with geo-coordinates") optParser.add_option("--blur", type="float", default=0, help="maximum random disturbance to route geometry") + optParser.add_option("--standalone", action="store_true", + default=False, help="Parse stand-alone routes that are not define as child-element of a vehicle") options, args = optParser.parse_args(args=args) + if len(args) < 2: + sys.exit(USAGE) try: - options.net, options.routefile = args + options.net = args[0] + options.routefiles = args[1:] options.colorgen = Colorgen( (options.hue, options.saturation, options.brightness)) except: sys.exit(USAGE) if options.outfile is None: - options.outfile = options.routefile + ".poly.xml" + options.outfile = options.routefiles[0] + ".poly.xml" return options @@ -62,7 +67,7 @@ return tuple([val + random.uniform(-blur, blur) for val in pos]) -def generate_poly(net, id, color, layer, geo, edges, blur, outf): +def generate_poly(net, id, color, layer, geo, edges, blur, outf, type="route"): shape = list(itertools.chain(*list(net.getEdge(e).getLane(0).getShape() for e in edges))) if blur > 0: @@ -73,19 +78,41 @@ shape = [net.convertXY2LonLat(*pos) for pos in shape] geoFlag = ' geo="true"' shapeString = ' '.join('%s,%s' % (x, y) for x, y in shape) - outf.write('\n' % ( - id, color, layer, shapeString, geoFlag)) + outf.write('\n' % ( + id, color, layer, type, shapeString, geoFlag)) def main(args): options = parse_args(args) net = readNet(options.net) + known_ids = set() + + def unique_id(cand, index=0): + cand2 = cand + if index > 0: + cand2 = "%s#%s" % (cand, index) + if cand2 in known_ids: + return unique_id(cand, index + 1) + else: + known_ids.add(cand2) + return cand2 + with open(options.outfile, 'w') as outf: outf.write('\n') - for vehicle in parse(options.routefile, 'vehicle'): - generate_poly(net, vehicle.id, options.colorgen(), - options.layer, options.geo, - vehicle.route[0].edges.split(), options.blur, outf) + for routefile in options.routefiles: + print("parsing %s" % routefile) + if options.standalone: + for route in parse(routefile, 'route'): + #print("found veh", vehicle.id) + generate_poly(net, unique_id(route.id), options.colorgen(), + options.layer, options.geo, + route.edges.split(), options.blur, outf) + else: + for vehicle in parse(routefile, 'vehicle'): + #print("found veh", vehicle.id) + generate_poly(net, unique_id(vehicle.id), options.colorgen(), + options.layer, options.geo, + vehicle.route[0].edges.split(), options.blur, outf) outf.write('\n') if __name__ == "__main__": diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/routecheck.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/routecheck.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/routecheck.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/routecheck.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,7 @@ @author Jakob Erdmann @author Yun-Pang Floetteroed @date 2007-03-09 -@version $Id: routecheck.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: routecheck.py 23248 2017-03-07 13:48:57Z behrisch $ This script does simple checks for the routes on a given network. Warnings will be issued if there is an unknown edge in the route, @@ -22,7 +22,7 @@ changes of attributes. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -211,7 +211,7 @@ if len(edgeList) == 0: print("Warning: Route %s is empty" % self._routeID) return False - if net == None: + if net is None: return True doConnectivityTest = True cleanedEdgeList = [] diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/routecompare.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/routecompare.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/routecompare.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/routecompare.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ @author Michael Behrisch @author Daniel Krajzewicz @date 2008-03-25 -@version $Id: routecompare.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: routecompare.py 23019 2017-02-18 19:54:43Z behrisch $ This script compares two route sets by calculating a similarity for any two routes based on the number of common edges @@ -14,7 +14,7 @@ the same origin and destination district are matched. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -101,7 +101,7 @@ for edge in first: if edge in second: commonEdges += SCALE - return commonEdges / max(len(first), len(second)) + return commonEdges // max(len(first), len(second)) def matching(routeIDs1, routeIDs2, similarityMatrix, match): @@ -285,7 +285,7 @@ parser.setContentHandler(DistrictReader(sources, sinks, edges)) parser.parse(options.districts) for routes, routeMatrix in [(routes1, routeMatrix1), (routes2, routeMatrix2)]: - for routeID in routes: + for routeID in sorted(routes): route = routes[routeID] source = sources[route[0]] sink = sinks[route[-1]] @@ -297,7 +297,7 @@ else: for routes, routeMatrix in [(routes1, routeMatrix1), (routes2, routeMatrix2)]: routeMatrix["dummySource"] = {} - routeMatrix["dummySource"]["dummySink"] = list(routes.keys()) + routeMatrix["dummySource"]["dummySink"] = list(sorted(routes.keys())) match = {} totalMatch = 0 diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/route_departOffset.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/route_departOffset.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/route_departOffset.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/route_departOffset.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 11.09.2009 -@version $Id: route_departOffset.py 21851 2016-10-31 12:20:12Z behrisch $ +@version $Id: route_departOffset.py 22608 2017-01-17 06:28:54Z behrisch $ Applies a given offset to the given route's departure time SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -57,6 +57,10 @@ help="only modify departure times of vehicles departing on the given edges") optParser.add_option("--depart-edges.file", dest="depart_edges_file", help="only modify departure times of vehicles departing on edges or lanes in the given selection file") + optParser.add_option("--arrival-edges", dest="arrival_edges", + help="only modify departure times of vehicles arriving on the given edges") + optParser.add_option("--arrival-edges.file", dest="arrival_edges_file", + help="only modify departure times of vehicles arriving on edges or lanes in the given selection file") (options, args) = optParser.parse_args(args=args) if options.infile is None or options.outfile is None: @@ -90,6 +94,21 @@ else: options.depart_edges.append(line) + if options.arrival_edges is not None: + options.arrival_edges = options.arrival_edges.split(',') + + if options.arrival_edges_file is not None: + if options.arrival_edges is None: + options.arrival_edges = [] + for line in open(options.arrival_edges_file): + line = line.strip() + if line.startswith("edge:"): + options.arrival_edges.append(line[5:]) + elif line.startswith("lane:"): + options.arrival_edges.append(line[5:-2]) + else: + options.arrival_edges.append(line) + return options @@ -104,12 +123,14 @@ def main(options): # cache stand-alone routes routesDepart = {} # first edge for each route + routesArrival = {} # last edge for each route with codecs.open(options.outfile, 'w', encoding='utf8') as out: out.write("\n") for route in parse(options.infile, "route"): if route.hasAttribute('id') and route.id is not None: routesDepart[route.id] = route.edges.split()[0] + routesArrival[route.id] = route.edges.split()[-1] out.write(route.toXML(' ')) for obj in parse(options.infile, ['vehicle', 'trip', 'flow', 'vType'], @@ -120,6 +141,8 @@ else: if options.modify_ids: obj.id += options.name_suffix + + # compute depart-edge filter departEdge = None if options.depart_edges is not None: # determine the departEdge of the current vehicle @@ -139,7 +162,31 @@ else: # route child element departEdge = obj.route[0].edges.split()[0] - if departEdge is None or departEdge in options.depart_edges: + + # compute arrival-edge filter + arrivalEdge = None + if options.arrival_edges is not None: + # determine the arrivalEdge of the current vehicle + if obj.name == 'trip': + arrivalEdge = obj.to + elif obj.name == 'vehicle': + if obj.hasAttribute('route') and obj.route is not None: + arrivalEdge = routesArrival[obj.route] + else: + # route child element + arrivalEdge = obj.route[0].edges.split()[-1] + elif obj.name == 'flow': + if obj.hasAttribute('to') and obj.attr_from is not None: + arrivalEdge = obj.to + elif obj.hasAttribute('route') and obj.route is not None: + arrivalEdge = routesArrival[obj.route] + else: + # route child element + arrivalEdge = obj.route[0].edges.split()[-1] + + # modify departure time + if ((departEdge is None or departEdge in options.depart_edges) + and (arrivalEdge is None or arrivalEdge in options.arrival_edges)): if options.offset is not None: # shift by offset if obj.name in ['trip', 'vehicle']: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/routeDiffStats.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/routeDiffStats.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/routeDiffStats.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/routeDiffStats.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ -#!/usr/bin/env python -""" -@file routeStats.py -@author Jakob Erdmann -@date 2014-12-18 -@version $Id: routeDiffStats.py 19649 2015-12-17 21:05:20Z behrisch $ - -compute statistics for two sets of routes (for the same set of vehicles) - -SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2014-2014 DLR (http://www.dlr.de/) and contributors - -This file is part of SUMO. -SUMO is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3 of the License, or -(at your option) any later version. -""" -from __future__ import absolute_import -from __future__ import print_function - -import os -import sys -from optparse import OptionParser - -if 'SUMO_HOME' in os.environ: - tools = os.path.join(os.environ['SUMO_HOME'], 'tools') - sys.path.append(os.path.join(tools)) - from sumolib.output import parse, parse_fast - from sumolib.net import readNet - from sumolib.miscutils import Statistics -else: - sys.exit("please declare environment variable 'SUMO_HOME'") - - -def get_options(): - USAGE = """Usage %prog [options] """ - optParser = OptionParser(usage=USAGE) - optParser.add_option("-v", "--verbose", action="store_true", - default=False, help="Give more output") - optParser.add_option("--binwidth", type="float", - default=100, help="binning width of route length difference histogram") - optParser.add_option("--hist-output", type="string", - default=None, help="output file for histogram (gnuplot compatible)") - optParser.add_option("--full-output", type="string", - default=None, help="output file for full data dump") - options, args = optParser.parse_args() - try: - options.network = args[0] - options.routeFile1 = args[1] - options.routeFile2 = args[2] - except: - sys.exit(USAGE) - return options - - -def getRouteLength(net, vehicle): - return sum([net.getEdge(e).getLength() for e in vehicle.route[0].edges.split()]) - - -def main(): - options = get_options() - net = readNet(options.network) - edges = set([e.getID() for e in net.getEdges()]) - - lengths1 = {} - lengths2 = {} - lengthDiffStats = Statistics( - "route length difference", histogram=True, scale=options.binwidth) - for vehicle in parse(options.routeFile1, 'vehicle'): - lengths1[vehicle.id] = getRouteLength(net, vehicle) - for vehicle in parse(options.routeFile2, 'vehicle'): - lengths2[vehicle.id] = getRouteLength(net, vehicle) - lengthDiffStats.add( - lengths2[vehicle.id] - lengths1[vehicle.id], vehicle.id) - - print(lengthDiffStats) - - if options.hist_output is not None: - with open(options.hist_output, 'w') as f: - for bin, count in lengthDiffStats.histogram(): - f.write("%s %s\n" % (bin, count)) - - if options.full_output is not None: - with open(options.full_output, 'w') as f: - differences = sorted( - [(lengths2[id] - lengths1[id], id) for id in lengths1.keys()]) - for diff, id in differences: - f.write("%s %s\n" % (diff, id)) - -if __name__ == "__main__": - main() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/routes_Join.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/routes_Join.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/routes_Join.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/routes_Join.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,14 +4,14 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 11.09.2009 -@version $Id: routes_Join.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: routes_Join.py 23248 2017-03-07 13:48:57Z behrisch $ Joins routes belonging to two networks. A map file with the following syntax is read first: -> It describes at which edges the networks overlapped and which edge was kept in the resulting one. -Vehicles from both given route files starting at the first of those +Vehicles from both given route files starting at the first of those edges will be at first not regarded, but their routes are kept in memory. All other vehicles are kept, but if they pass one of the mapped edges, the route is continued by choosing a random route from the list of previously @@ -20,7 +20,7 @@ Attention! The routes are not sorted in time! SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/routeStats.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/routeStats.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/routeStats.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/routeStats.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,15 +3,15 @@ @file routeStats.py @author Jakob Erdmann @date 2014-12-18 -@version $Id: routeStats.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: routeStats.py 23999 2017-04-21 09:04:47Z behrisch $ -compute statistics on route lengths for a single route or +compute statistics on route lengths for a single route or for the lenght-difference between two sets of routes. Routes must be children of elements and when comparing two sets of routes, the same vehicle ids must appear. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -41,8 +41,10 @@ optParser = OptionParser(usage=USAGE) optParser.add_option("-v", "--verbose", action="store_true", default=False, help="Give more output") + optParser.add_option("--attribute", type="string", + default="length", help="attribute to analyze [length, depart]") optParser.add_option("--binwidth", type="float", - default=500, help="binning width of route length histogram") + default=500, help="binning width of result histogram") optParser.add_option("--hist-output", type="string", default=None, help="output file for histogram (gnuplot compatible)") optParser.add_option("--full-output", type="string", @@ -62,34 +64,36 @@ return options -def getRouteLength(net, vehicle): - return sum([net.getEdge(e).getLength() for e in vehicle.route[0].edges.split()]) - - def main(): options = get_options() - net = readNet(options.network) - edges = set([e.getID() for e in net.getEdges()]) + net = None + attribute_retriever = None + if options.attribute == "length": + net = readNet(options.network) + attribute_retriever = lambda vehicle: sum([net.getEdge(e).getLength() for e in vehicle.route[0].edges.split()]) + else: + attribute_retriever = lambda vehicle: float(vehicle.depart) lengths = {} lengths2 = {} - for vehicle in parse(options.routeFile, 'vehicle'): - lengths[vehicle.id] = getRouteLength(net, vehicle) - if options.routeFile2 is None: # write statistics on a single route file stats = Statistics( - "route lengths", histogram=True, scale=options.binwidth) - for id, length in lengths.items(): - stats.add(length, id) + "route %ss" % options.attribute, histogram=True, scale=options.binwidth) - else: + for vehicle in parse(options.routeFile, 'vehicle'): + length = attribute_retriever(vehicle) + if options.routeFile2 is None: + stats.add(length, vehicle.id) + lengths[vehicle.id] = length + + if options.routeFile2 is not None: # compare route lengths between two files stats = Statistics( - "route length difference", histogram=True, scale=options.binwidth) + "route %s difference" % options.attribute, histogram=True, scale=options.binwidth) for vehicle in parse(options.routeFile2, 'vehicle'): - lengths2[vehicle.id] = getRouteLength(net, vehicle) + lengths2[vehicle.id] = attribute_retriever(vehicle) stats.add(lengths2[vehicle.id] - lengths[vehicle.id], vehicle.id) print(stats) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/sort_routes.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/sort_routes.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/sort_routes.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/sort_routes.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,11 +5,11 @@ @author Michael Behrisch @author Pieter Loof @date 2011-07-14 -@version $Id: sort_routes.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: sort_routes.py 23248 2017-03-07 13:48:57Z behrisch $ This script sorts the vehicles in the given route file by their depart time SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -144,8 +144,7 @@ options = get_options(args=args) if options.big: line_offsets = create_line_index(options.routefile) - element_lines = get_element_lines(options.routefile) - element_lines.sort() + element_lines = sorted(get_element_lines(options.routefile)) copy_elements( options.routefile, options.outfile, element_lines, line_offsets) else: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/tracegenerator.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/tracegenerator.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/tracegenerator.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/tracegenerator.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file tracemapper.py @author Michael Behrisch @date 2013-10-23 -@version $Id: tracegenerator.py 20687 2016-05-10 11:27:00Z behrisch $ +@version $Id: tracegenerator.py 22608 2017-01-17 06:28:54Z behrisch $ This script tries to generate traces for routes in a sumo network. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/tracemapper.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/tracemapper.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/tracemapper.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/tracemapper.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file tracemapper.py @author Michael Behrisch @date 2013-10-23 -@version $Id: tracemapper.py 20687 2016-05-10 11:27:00Z behrisch $ +@version $Id: tracemapper.py 22608 2017-01-17 06:28:54Z behrisch $ This script tries to match a list of positions to a route in a sumo network. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/vehicle2flow.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/vehicle2flow.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route/vehicle2flow.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route/vehicle2flow.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,14 +3,14 @@ @file vehicle2flow.py @author Michael Behrisch @date 2012-11-15 -@version $Id: vehicle2flow.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: vehicle2flow.py 22608 2017-01-17 06:28:54Z behrisch $ This script replaces all vehicle definitions in a route file by flow definitions, adding an XML ntity for the repeat interval for easy later modification. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route2sel.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route2sel.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route2sel.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route2sel.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file route2trips.py @author Jakob Erdmann @date 2015-08-05 -@version $Id: route2sel.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: route2sel.py 22608 2017-01-17 06:28:54Z behrisch $ This script converts SUMO routes into an edge selection SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route2trips.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route2trips.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/route2trips.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/route2trips.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ @author Michael Behrisch @author Daniel Krajzewicz @date 2008-03-19 -@version $Id: route2trips.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: route2trips.py 23614 2017-03-22 13:02:46Z luecken $ This script converts SUMO routes back into SUMO trips which serve as input to one of the routing applications. @@ -12,7 +12,7 @@ and outputs the trips to stdout. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -22,15 +22,21 @@ """ from __future__ import print_function from __future__ import absolute_import +import os import sys import datetime from xml.sax import parse, handler +SUMO_HOME = os.environ.get('SUMO_HOME', + os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')) +sys.path.append(os.path.join(SUMO_HOME, 'tools')) +import sumolib + class RouteReader(handler.ContentHandler): - def __init__(self, attrList, outfile): + def __init__(self, attrList, outfile, vias, calledBy=""): self._vType = '' self._vID = '' self._vDepart = 0 @@ -40,6 +46,8 @@ self._attrList = attrList self._vehicleAttrs = None self.outfile = outfile + self.vias = vias + self.calledBy = calledBy def startElement(self, name, attrs): if name == 'vehicle': @@ -55,13 +63,16 @@ if 'edges' in attrs: self._routeString = attrs['edges'] elif name == 'vType': - # XXX does not handle child elements - print(' ' % (' '.join(['%s="%s"' % (key, value) for key, value in sorted(dict(attrs).items())])), + # XXX does not handle child elements (for carFollowing, the next case copies the input) + print(' ' % (' '.join(['%s="%s"' % (key, value) for key, value in sorted(dict(attrs).items())])), + file=self.outfile) + elif name[0:12] == 'carFollowing': + print(' <%s %s />' % (name, ' '.join(['%s="%s"' % (key, value) for key, value in sorted(dict(attrs).items())])), file=self.outfile) elif name == 'routes': - print(""" - -""" % datetime.datetime.now(), file=self.outfile) + sumolib.writeXMLHeader( + self.outfile, + "$Id: route2trips.py 23614 2017-03-22 13:02:46Z luecken $%s" % self.calledBy, "routes") def endElement(self, name): if name == 'route': @@ -73,32 +84,36 @@ edges = self._routeString.split() self._vehicleAttrs["from"] = edges[0] self._vehicleAttrs["to"] = edges[-1] + via = self.vias.get(self._vID, "") if self._attrList: - print(' ' % (' '.join(['%s="%s"' % (key, self._vehicleAttrs[key]) for key in self._attrList])), + print(' ' % (' '.join(['%s="%s"' % (key, + self._vehicleAttrs[key]) for key in self._attrList]), via), file=self.outfile) else: del self._vehicleAttrs['id'] items = sorted(['%s="%s"' % (key, val) for key, val in self._vehicleAttrs.items()]) - print(' ' % (self._vID, ' '.join(items)), + print(' ' % (self._vID, ' '.join(items), via), file=self.outfile) self._vID = '' self._routeString = '' elif name == 'routes': - print("", file=self.outfile) + print("", file=self.outfile) + elif name == 'vType': + print(" ", file=self.outfile) def characters(self, content): self._routeString += content -def main(argv, outfile=None): +def main(argv, outfile=None, vias={}, calledBy=""): routefile = argv[0] attrList = argv[1:] if outfile is None: - parse(routefile, RouteReader(attrList, sys.stdout)) + parse(routefile, RouteReader(attrList, sys.stdout, vias, calledBy)) else: with open(outfile, 'w') as outf: - parse(routefile, RouteReader(attrList, outf)) + parse(routefile, RouteReader(attrList, outf, vias, calledBy)) if __name__ == "__main__": diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/shapes/circlePolygon.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/shapes/circlePolygon.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/shapes/circlePolygon.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/shapes/circlePolygon.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2010-02-20 -@version $Id: circlePolygon.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: circlePolygon.py 22608 2017-01-17 06:28:54Z behrisch $ Approximates a list of circles by polygons. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/shapes/CSV2polyconvertXML.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/shapes/CSV2polyconvertXML.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/shapes/CSV2polyconvertXML.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/shapes/CSV2polyconvertXML.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,13 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2008-07-17 -@version $Id: CSV2polyconvertXML.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: CSV2polyconvertXML.py 23253 2017-03-07 13:54:28Z behrisch $ -Converts a given CSV-file that contains a list of pois to +Converts a given CSV-file that contains a list of pois to an XML-file that may be read by POLYCONVERT. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/shapes/poi_alongRoads.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/shapes/poi_alongRoads.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/shapes/poi_alongRoads.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/shapes/poi_alongRoads.py 2017-07-23 16:22:03.000000000 +0000 @@ -20,7 +20,7 @@ Output is written in file 'pois.add.xml' SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -82,7 +82,7 @@ data.append(edge._id) data.append(edge._from._id) data.append(edge._to._id) - data.append(edge._shape) + data.append(edge.getShape()) nodeList.append(data) # find connected edges @@ -134,8 +134,10 @@ dX = x2 - x1 dY = y2 - y1 eucDist = pow(pow(dX, 2) + pow(dY, 2), 0.5) # Euclidean distance - normAscX = dX / eucDist # normalized Euclidean distance in x - normAscY = dY / eucDist # normalized Euclidean distance in y + # normalized Euclidean distance in x + normAscX = 0 if dX == 0 else dX / eucDist + # normalized Euclidean distance in y + normAscY = 0 if dY == 0 else dY / eucDist xCur = x1 # the current POI position yCur = y1 if i == 0: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/shapes/poi_atTLS.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/shapes/poi_atTLS.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/shapes/poi_atTLS.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/shapes/poi_atTLS.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,13 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2010-02-20 -@version $Id: poi_atTLS.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: poi_atTLS.py 22608 2017-01-17 06:28:54Z behrisch $ Generates a PoI-file containing a PoI for each tls controlled intersection from the given net. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/shapes/pois2inductionLoops.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/shapes/pois2inductionLoops.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/shapes/pois2inductionLoops.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/shapes/pois2inductionLoops.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2010-02-18 -@version $Id: pois2inductionLoops.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: pois2inductionLoops.py 22608 2017-01-17 06:28:54Z behrisch $ Converts a given pois located on lanes into induction loop detectors; @@ -14,7 +14,7 @@ Call: pois2inductionLoops.py SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/showDepartsAndArrivalsPerEdge.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/showDepartsAndArrivalsPerEdge.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/showDepartsAndArrivalsPerEdge.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/showDepartsAndArrivalsPerEdge.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,7 +3,7 @@ @file route2trips.py @author Jakob Erdmann @date 2015-08-05 -@version $Id: showDepartsAndArrivalsPerEdge.py 21851 2016-10-31 12:20:12Z behrisch $ +@version $Id: showDepartsAndArrivalsPerEdge.py 23253 2017-03-07 13:54:28Z behrisch $ This script converts SUMO routes into a visualization of depart and arrival counts @@ -73,22 +73,20 @@ if options.subpart is not None: sys.stderr.print("Warning: Ignoring trips when using --subpart") break - departCounts[trip.fromTaz] += 1 arrivalCounts[trip.toTaz] += 1 for walk in parse_fast(options.routefile, 'walk', ['from', 'to']): if options.subpart is not None: sys.stderr.print("Warning: Ignoring trips when using --subpart") break - departCounts[walk.attr_from] += 1 arrivalCounts[walk.to] += 1 departStats = Statistics("departEdges") arrivalStats = Statistics("arrivalEdges") - for e in departCounts.keys(): + for e in sorted(departCounts.keys()): departStats.add(departCounts[e], e) - for e in arrivalCounts.keys(): + for e in sorted(arrivalCounts.keys()): arrivalStats.add(arrivalCounts[e], e) print(departStats) print(arrivalStats) @@ -98,9 +96,9 @@ outf.write(' \n') allEdges = set(departCounts.keys()) allEdges.update(arrivalCounts.keys()) - for e in sorted(list(allEdges)): - outf.write(' \n' % (e, - departCounts[e], arrivalCounts[e], arrivalCounts[e] - departCounts[e])) + for e in sorted(allEdges): + outf.write(' \n' % + (e, departCounts[e], arrivalCounts[e], arrivalCounts[e] - departCounts[e])) outf.write(" \n") outf.write("\n") diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/color.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/color.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/color.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/color.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,7 +3,7 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2012-12-04 -@version $Id: color.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: color.py 23247 2017-03-07 13:46:58Z behrisch $ Library for reading and encoding of colors. @@ -30,7 +30,7 @@ self.a = a def toXML(self): - if self.a != None: + if self.a is not None: return "%s,%s,%s,%s" % (self.r, self.g, self.b, self.a) else: return "%s,%s,%s" % (self.r, self.g, self.b) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/files/additional.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/files/additional.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/files/additional.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/files/additional.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,11 +3,11 @@ @author Jakob Erdmann @author Michael Behrisch @date 2013-05-06 -@version $Id: additional.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: additional.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/files/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/files/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/files/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/files/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Jakob Erdmann @author Michael Behrisch @date 2012-12-04 -@version $Id: __init__.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: __init__.py 22608 2017-01-17 06:28:54Z behrisch $ This file includes all file descriptions. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/files/selection.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/files/selection.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/files/selection.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/files/selection.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,11 +3,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2013-05-06 -@version $Id: selection.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: selection.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/geomhelper.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/geomhelper.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/geomhelper.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/geomhelper.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Jakob Erdmann @author Michael Behrisch @date 2013-02-25 -@version $Id: geomhelper.py 20604 2016-05-02 06:13:40Z behrisch $ +@version $Id: geomhelper.py 22608 2017-01-17 06:28:54Z behrisch $ Some helper functions for geometrical computations. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,7 @@ @author Jakob Erdmann @author Michael Behrisch @date 2011-06-23 -@version $Id: __init__.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: __init__.py 23247 2017-03-07 13:46:58Z behrisch $ Python interface to SUMO especially for parsing xml input and output files. @@ -204,7 +204,7 @@ """flushes all file contents to disc""" for fp in self.files: fp.flush() - if type(fp) is int or hasattr(fp, "fileno"): + if isinstance(fp, int) or hasattr(fp, "fileno"): try: os.fsync(fp) except OSError: @@ -222,10 +222,13 @@ return laneID[:laneID.rfind("_")] -def writeXMLHeader(outf, script): +def writeXMLHeader(outf, script, root=None): outf.write(""" """ % (datetime.datetime.now(), script, (' '.join(sys.argv[1:]).replace('--', '')))) + if root is not None: + outf.write( + '<%s xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/%s_file.xsd">\n' % (root, root)) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/miscutils.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/miscutils.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/miscutils.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/miscutils.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,7 +3,7 @@ @author Jakob Erdmann @author Michael Behrisch @date 2012-05-08 -@version $Id: miscutils.py 21776 2016-10-25 09:10:31Z behrisch $ +@version $Id: miscutils.py 23999 2017-04-21 09:04:47Z behrisch $ Common utility functions @@ -284,3 +284,9 @@ except socket.error: pass return None + +# euclidean distance between two coordinates in the plane + + +def euclidean(a, b): + return math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/net/connection.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/net/connection.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/net/connection.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/net/connection.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Michael Behrisch @author Jakob Erdmann @date 2011-11-28 -@version $Id: connection.py 20687 2016-05-10 11:27:00Z behrisch $ +@version $Id: connection.py 22608 2017-01-17 06:28:54Z behrisch $ This file contains a Python-representation of a single connection. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/net/edge.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/net/edge.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/net/edge.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/net/edge.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Michael Behrisch @author Jakob Erdmann @date 2011-11-28 -@version $Id: edge.py 20687 2016-05-10 11:27:00Z behrisch $ +@version $Id: edge.py 23247 2017-03-07 13:46:58Z behrisch $ This file contains a Python-representation of a single edge. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -20,6 +20,7 @@ (at your option) any later version. """ from .connection import Connection +from .lane import addJunctionPos class Edge: @@ -41,7 +42,11 @@ self._incoming = {} self._outgoing = {} self._shape = None - self._cachedShapeWithJunctions = None + self._shapeWithJunctions = None + self._shape3D = None + self._shapeWithJunctions3D = None + self._rawShape = None + self._rawShape3D = None self._function = function self._tls = None self._name = name @@ -50,6 +55,11 @@ return self._name def isSpecial(self): + """ Check if the edge has a special function. + + Returns False if edge's function is 'normal', else False, e.g. for + internal edges or connector edges """ + return self._function != "" def getFunction(self): @@ -76,9 +86,8 @@ self._incoming[conn._from] = [] self._incoming[conn._from].append(conn) - def setShape(self, shape): - self._shape = shape - self._cachedShapeWithJunctions = None + def setRawShape(self, shape): + self._rawShape3D = shape def getID(self): return self._id @@ -89,24 +98,33 @@ def getOutgoing(self): return self._outgoing + def getRawShape(self): + """Return the shape that was used in netconvert for building this edge (2D).""" + if self._shape is None: + self.rebuildShape() + return self._rawShape + + def getRawShape3D(self): + """Return the shape that was used in netconvert for building this edge (3D).""" + if self._shape is None: + self.rebuildShape() + return self._rawShape3D + def getShape(self, includeJunctions=False): - if not self._shape: - if self._cachedShapeWithJunctions == None: - self._cachedShapeWithJunctions = [ - self._from._coord, self._to._coord] - return self._cachedShapeWithJunctions + """Return the 2D shape that is the average of all lane shapes (segment-wise)""" + if self._shape is None: + self.rebuildShape() if includeJunctions: - if self._cachedShapeWithJunctions == None: - if self._from._coord != self._shape[0]: - self._cachedShapeWithJunctions = [ - self._from._coord] + self._shape - else: - self._cachedShapeWithJunctions = list(self._shape) - if self._to._coord != self._shape[-1]: - self._cachedShapeWithJunctions += [self._to._coord] - return self._cachedShapeWithJunctions + return self._shapeWithJunctions return self._shape + def getShape3D(self, includeJunctions=False): + if self._shape is None: + self.rebuildShape() + if includeJunctions: + return self._shapeWithJunctions3D + return self._shape3D + def getBoundingBox(self, includeJunctions=True): s = self.getShape(includeJunctions) xmin = s[0][0] @@ -146,25 +164,37 @@ return self._lanes def rebuildShape(self): - noShapes = len(self._lanes) - if noShapes % 2 == 1: - self.setShape(self._lanes[int(noShapes / 2)]._shape) + numLanes = len(self._lanes) + if numLanes % 2 == 1: + self._shape3D = self._lanes[int(numLanes / 2)].getShape3D() else: - shape = [] + self._shape3D = [] minLen = -1 for l in self._lanes: if minLen == -1 or minLen > len(l.getShape()): minLen = len(l._shape) - for i in range(0, minLen): + for i in range(minLen): x = 0. y = 0. - for j in range(0, len(self._lanes)): - x = x + self._lanes[j]._shape[i][0] - y = y + self._lanes[j]._shape[i][1] - x = x / float(len(self._lanes)) - y = y / float(len(self._lanes)) - shape.append([x, y]) - self.setShape(shape) + z = 0. + for l in self._lanes: + x += l.getShape3D()[i][0] + y += l.getShape3D()[i][1] + z += l.getShape3D()[i][2] + self._shape3D.append( + (x / float(numLanes), y / float(numLanes), z / float(numLanes))) + + self._shapeWithJunctions3D = addJunctionPos(self._shape3D, + self._from.getCoord3D(), self._to.getCoord3D()) + + if self._rawShape3D == []: + self._rawShape3D = [self._from.getCoord3D(), self._to.getCoord3D()] + + # 2d - versions + self._shape = [(x, y) for x, y, z in self._shape3D] + self._shapeWithJunctions = [(x, y) + for x, y, z in self._shapeWithJunctions3D] + self._rawShape = [(x, y) for x, y, z in self._rawShape3D] def getLength(self): return self._lanes[0].getLength() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/net/generator/demand.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/net/generator/demand.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/net/generator/demand.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/net/generator/demand.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,7 @@ @file demand.py @author Daniel Krajzewicz @date 2013-10-10 -@version $Id: demand.py 19649 2015-12-17 21:05:20Z behrisch $ +@version $Id: demand.py 23247 2017-03-07 13:46:58Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ Copyright (C) 2013 DLR (http://www.dlr.de/) and contributors @@ -38,7 +38,8 @@ self.endTime = endTime def depart(self, t): - return random.random() < (self.beginFlow + (self.endFlow - self.beginFlow) / (self.endTime - self.beginTime) * (t - self.beginTime)) + return random.random() < ( + self.beginFlow + (self.endFlow - self.beginFlow) / (self.endTime - self.beginTime) * (t - self.beginTime)) class WaveComposition: @@ -71,7 +72,8 @@ class Stream: - def __init__(self, sid, validFrom, validUntil, numberModel, departEdgeModel, arrivalEdgeModel, vTypeModel, via=None): + def __init__(self, sid, validFrom, validUntil, numberModel, + departEdgeModel, arrivalEdgeModel, vTypeModel, via=None): self.sid = sid self._numberModel = numberModel self._departEdgeModel = departEdgeModel @@ -82,14 +84,16 @@ self._via = via def getVehicleDepartures(self, b, e, sampleFactor=None, seenRatio=None): - if self._validFrom != None and self._validUntil != None and (e < self._validFrom or b > self._validUntil): + if self._validFrom is not None and self._validUntil is not None and ( + e < self._validFrom or b > self._validUntil): return [] ret = [] for i in range(b, e): - if self._validFrom != None and self._validUntil != None and (i < self._validFrom or i > self._validUntil): + if self._validFrom is not None and self._validUntil is not None and ( + i < self._validFrom or i > self._validUntil): continue depart = i - if sampleFactor != None: + if sampleFactor is not None: off = i % (sampleFactor * 24) if not off < sampleFactor: continue @@ -129,7 +133,7 @@ toEdge = self.getFrom(self._arrivalEdgeModel, i, number) vType = self.getFrom(self._vTypeModel, i, number) sid = self.sid - if sid == None: + if sid is None: sid = fromEdge + "_to_" + toEdge + "_" + str(i) vehicles.append( Vehicle(sid + "#" + str(i + offset), int(d), fromEdge, toEdge, vType, self._via)) @@ -153,7 +157,7 @@ fdo.write("\n") for v in sorted(vehicles, key=lambda veh: veh.depart): via = "" - if v._via != None: + if v._via is not None: via = ' via="%s"' % v._via if v.vType == "pedestrian": fdo.write(' \n' % @@ -168,6 +172,6 @@ print("routesName > %s" % routesName) # aeh, implicitly setting --no-warnings is not nice, is it?; and the # need to dump generated vtypes to a temporary file as well - retCode = subprocess.call([duarouter, "-v", "-n", netName, "-t", fdo.name, "-o", routesName, + retCode = subprocess.call([duarouter, "-v", "-n", netName, "-t", fdo.name, "-o", routesName, "--no-warnings", "--additional-files", "vtypes.add.xml", "--vtype-output", "tmp.add.xml"]) os.remove(fdo.name) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/net/generator/network.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/net/generator/network.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/net/generator/network.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/net/generator/network.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,7 @@ @file network.py @author Daniel Krajzewicz @date 2013-10-10 -@version $Id: network.py 19649 2015-12-17 21:05:20Z behrisch $ +@version $Id: network.py 23979 2017-04-20 05:54:02Z namdre $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ Copyright (C) 2013 DLR (http://www.dlr.de/) and contributors @@ -48,7 +48,7 @@ self.dirs = dirs self.allowed = allowed self.disallowed = disallowed - if self.dirs == None: + if self.dirs is None: self.dirs = [] @@ -68,21 +68,21 @@ self.numLanes = numLanes self.maxSpeed = maxSpeed self.lanes = lanes - if self.lanes == None: + if self.lanes is None: self.lanes = [] for i in range(0, self.numLanes): self.lanes.append(Lane()) self.splits = splits - if self.splits == None: + if self.splits is None: self.splits = [] - if numLanes == None: + if numLanes is None: numLanes = len(self.lanes) def addSplit(self, distance, lanesToRight=None, lanesToLeft=None): if len(self.splits) == 0: - if lanesToRight == None: + if lanesToRight is None: lanesToRight = 0 - if lanesToLeft == None: + if lanesToLeft is None: lanesToLeft = 0 lanes = range(lanesToRight, self.numLanes + lanesToRight) self.splits.append(Split(0, lanes)) @@ -104,7 +104,7 @@ if d not in seen: seen[d] = 0 c = net.dir2connection(d, self, i, seen[d]) - if c != None: + if c is not None: ret.append(c) seen[d] = seen[d] + 1 return ret @@ -140,10 +140,10 @@ self._nodes = {} self._edges = {} self._defaultEdge = defaultEdge - if self._defaultEdge == None: + if self._defaultEdge is None: self._defaultEdge = Edge(None, None, None, 2, 13.89) self._defaultNode = defaultNode - if self._defaultNode == None: + if self._defaultNode is None: self._defaultNode = Node(None, None, None, "traffic_light") self._e1 = {} self.netName = None @@ -220,11 +220,11 @@ else: return self.getDirectionFromNode(edge.toNode, [-1 * edir[1], -1 * edir[0]]) else: - raise "Unrecognized direction '%s'" % direction + raise RuntimeError("Unrecognized direction '%s'" % direction) def dir2connection(self, direction, edge, lane, seen): toEdge = self.getMatchingOutgoing(edge, direction) - if toEdge != None: + if toEdge is not None: if toEdge.lanes[seen].allowed != edge.lanes[lane].allowed: seen = seen + 1 return Connection(edge, lane, toEdge, seen) @@ -268,7 +268,7 @@ hadConstraints = False for i, l in enumerate(e.lanes): - if l.allowed == None and l.disallowed == None: + if l.allowed is None and l.disallowed is None: continue hadConstraints = True if hadConstraints: @@ -280,12 +280,12 @@ for i, l in enumerate(e.lanes): # if i not in s.lanes: # continue - if l.allowed == None and l.disallowed == None: + if l.allowed is None and l.disallowed is None: continue ls = ' ', file=edgesFile) print(' ', file=edgesFile) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/net/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/net/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/net/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/net/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -7,13 +7,13 @@ @author Jakob Erdmann @author Robert Hilbrich @date 2008-03-27 -@version $Id: __init__.py 21646 2016-10-10 12:49:13Z rhilbrich $ +@version $Id: __init__.py 24083 2017-04-27 10:25:54Z namdre $ This file contains a content handler for parsing sumo network xml files. It uses other classes from this module to represent the road network. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -152,17 +152,17 @@ return self._id2node[id] def setAdditionalNodeInfo(self, node, type, coord, incLanes, intLanes=None): - if coord != None and node._coord == None: + if coord is not None and node._coord is None: node._coord = coord self._ranges[0][0] = min(self._ranges[0][0], coord[0]) self._ranges[0][1] = max(self._ranges[0][1], coord[0]) self._ranges[1][0] = min(self._ranges[1][0], coord[1]) self._ranges[1][1] = max(self._ranges[1][1], coord[1]) - if incLanes != None and node._incLanes == None: + if incLanes is not None and node._incLanes is None: node._incLanes = incLanes - if intLanes != None and node._intLanes == None: + if intLanes is not None and node._intLanes is None: node._intLanes = intLanes - if type != None and node._type == None: + if type is not None and node._type is None: node._type = type def addEdge(self, id, fromID, toID, prio, function, name): @@ -278,6 +278,9 @@ self._tlss.append(tls) return tls + def getTrafficLights(self): + return self._tlss + def addTLS(self, tlid, inLane, outLane, linkNo): tls = self.getTLSSecure(tlid) tls.addConnection(inLane, outLane, linkNo) @@ -383,12 +386,13 @@ y -= y_off return self.getGeoProj()(x, y, inverse=True) - def move(self, dx, dy): + def move(self, dx, dy, dz=0): for n in self._nodes: - n._coord = (n._coord[0] + dx, n._coord[1] + dy) + n._coord = (n._coord[0] + dx, n._coord[1] + dy, n._coord[2] + dz) for e in self._edges: for l in e._lanes: - l._shape = [(p[0] + dx, p[1] + dy) for p in l._shape] + l._shape = [(p[0] + dx, p[1] + dy, p[2] + dz) + for p in l.getShape3D()] e.rebuildShape() @@ -401,7 +405,6 @@ self._currentEdge = None self._currentNode = None self._currentLane = None - self._currentShape = "" self._withPhases = others.get('withPrograms', False) self._withConnections = others.get('withConnections', True) self._withFoes = others.get('withFoes', True) @@ -417,36 +420,35 @@ prio = -1 if 'priority' in attrs: prio = int(attrs['priority']) - name = "" - if 'name' in attrs: - name = attrs['name'] self._currentEdge = self._net.addEdge(attrs['id'], - attrs.get('from', None), attrs.get('to', None), prio, function, name) - if 'shape' in attrs: - self.processShape(self._currentEdge, attrs['shape']) + attrs.get('from', None), attrs.get( + 'to', None), + prio, function, attrs.get('name', '')) + self._currentEdge.setRawShape( + convertShape(attrs.get('shape', ''))) else: if function in ['crossing', 'walkingarea']: self._net._crossings_and_walkingAreas.add(attrs['id']) self._currentEdge = None - if name == 'lane' and self._currentEdge != None: + if name == 'lane' and self._currentEdge is not None: self._currentLane = self._net.addLane( self._currentEdge, float(attrs['speed']), float(attrs['length']), attrs.get('allow'), attrs.get('disallow')) - if 'shape' in attrs: - # deprecated: at some time, this is mandatory - self._currentShape = attrs['shape'] - else: - self._currentShape = "" + self._currentLane.setShape(convertShape(attrs.get('shape', ''))) if name == 'junction': if attrs['id'][0] != ':': intLanes = None if self._withInternal: intLanes = attrs["intLanes"].split(" ") - self._currentNode = self._net.addNode(attrs['id'], attrs['type'], (float( - attrs['x']), float(attrs['y'])), attrs['incLanes'].split(" "), intLanes) + self._currentNode = self._net.addNode(attrs['id'], attrs['type'], + tuple( + map(float, [attrs['x'], attrs['y'], attrs['z'] if 'z' in attrs else '0'])), + attrs['incLanes'].split(" "), intLanes) + self._currentNode.setShape( + convertShape(attrs.get('shape', ''))) if name == 'succ' and self._withConnections: # deprecated if attrs['edge'][0] != ':': self._currentEdge = self._net.getEdge(attrs['edge']) @@ -525,22 +527,13 @@ self._net.addRoundabout( attrs['nodes'].split(), attrs['edges'].split()) if name == 'param': - if self._currentLane != None: + if self._currentLane is not None: self._currentLane.setParam(attrs['key'], attrs['value']) - def characters(self, content): - if self._currentLane != None: - self._currentShape = self._currentShape + content - def endElement(self, name): if name == 'lane': - if self._currentLane: - self.processShape(self._currentLane, self._currentShape) - self._currentShape = "" self._currentLane = None if name == 'edge': - if self._currentEdge and self._currentEdge._shape is None: - self._currentEdge.rebuildShape() self._currentEdge = None # 'row-logic' is deprecated!!! if name == 'ROWLogic' or name == 'row-logic': @@ -549,18 +542,31 @@ if self._withPhases and (name == 'tlLogic' or name == 'tl-logic'): self._currentProgram = None - def processShape(self, object, shapeString): - cshape = [] - es = shapeString.rstrip().split(" ") - for e in es: - p = e.split(",") - cshape.append((float(p[0]), float(p[1]))) - object.setShape(cshape) - def getNet(self): return self._net +def convertShape(shapeString): + """ Convert xml shape string into float tuples. + + This method converts the 2d or 3d shape string from SUMO's xml file + into a list containing 3d float-tuples. Non existant z coordinates default + to zero. If shapeString is empty, an empty list will be returned. + """ + + cshape = [] + for pointString in shapeString.split(): + p = [float(e) for e in pointString.split(",")] + if len(p) == 2: + cshape.append((p[0], p[1], 0.)) + elif len(p) == 3: + cshape.append(tuple(p)) + else: + raise ValueError( + 'Invalid shape point "%s", should be either 2d or 3d' % pointString) + return cshape + + def readNet(filename, **others): netreader = NetReader(**others) try: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/net/lane.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/net/lane.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/net/lane.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/net/lane.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Michael Behrisch @author Jakob Erdmann @date 2011-11-28 -@version $Id: lane.py 20604 2016-05-02 06:13:40Z behrisch $ +@version $Id: lane.py 23247 2017-03-07 13:46:58Z behrisch $ This file contains a Python-representation of a single lane. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -72,6 +72,17 @@ return tuple([c for c in SUMO_VEHICLE_CLASSES if not c in disallow]) +def addJunctionPos(shape, fromPos, toPos): + """Extends shape with the given positions in case they differ from the + existing endpoints. assumes that shape and positions have the same dimensionality""" + result = list(shape) + if fromPos != shape[0]: + result = [fromPos] + result + if toPos != shape[-1]: + result.append(toPos) + return result + + class Lane: """ Lanes from a sumo network """ @@ -80,8 +91,10 @@ self._edge = edge self._speed = speed self._length = length - self._shape = [] - self._cachedShapeWithJunctions = None + self._shape = None + self._shape3D = None + self._shapeWithJunctions = None + self._shapeWithJunctions3D = None self._outgoing = [] self._params = {} self._allowed = get_allowed(allow, disallow) @@ -94,22 +107,68 @@ return self._length def setShape(self, shape): - self._shape = shape + """Set the shape of the lane + + shape must be a list containing x,y,z coords as numbers + to represent the shape of the lane + """ + for pp in shape: + if len(pp) != 3: + raise ValueError('shape point must consist of x,y,z') + + self._shape3D = shape + self._shape = [(x, y) for x, y, z in shape] def getShape(self, includeJunctions=False): - if includeJunctions: - if self._cachedShapeWithJunctions == None: - if self._edge.getFromNode()._coord != self._shape[0]: - self._cachedShapeWithJunctions = [ - self._edge.getFromNode()._coord] + self._shape - else: - self._cachedShapeWithJunctions = list(self._shape) - if self._edge.getToNode()._coord != self._shape[-1]: - self._cachedShapeWithJunctions += [ - self._edge.getToNode()._coord] - return self._cachedShapeWithJunctions + """Returns the shape of the lane in 2d. + + This function returns the shape of the lane, as defined in the net.xml + file. The returned shape is a list containing numerical + 2-tuples representing the x,y coordinates of the shape points. + + For includeJunctions=True the returned list will contain + additionally the coords (x,y) of the fromNode of the + corresponding edge as first element and the coords (x,y) + of the toNode as last element. + + For internal lanes, includeJunctions is ignored and the unaltered + shape of the lane is returned. + """ + + if includeJunctions and not self._edge.isSpecial(): + if self._shapeWithJunctions is None: + self._shapeWithJunctions = addJunctionPos(self._shape, + self._edge.getFromNode().getCoord(), + self._edge.getToNode().getCoord()) + return self._shapeWithJunctions return self._shape + def getShape3D(self, includeJunctions=False): + """Returns the shape of the lane in 3d. + + This function returns the shape of the lane, as defined in the net.xml + file. The returned shape is a list containing numerical + 3-tuples representing the x,y,z coordinates of the shape points + where z defaults to zero. + + For includeJunction=True the returned list will contain + additionally the coords (x,y,z) of the fromNode of the + corresponding edge as first element and the coords (x,y,z) + of the toNode as last element. + + For internal lanes, includeJunctions is ignored and the unaltered + shape of the lane is returned. + """ + + if includeJunctions and not self._edge.isSpecial(): + if self._shapeWithJunctions3D is None: + self._shapeWithJunctions3D = addJunctionPos(self._shape3D, + self._edge.getFromNode( + ).getCoord3D(), + self._edge.getToNode().getCoord3D()) + return self._shapeWithJunctions3D + return self._shape3D + def getBoundingBox(self, includeJunctions=True): s = self.getShape(includeJunctions) xmin = s[0][0] diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/net/node.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/net/node.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/net/node.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/net/node.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Michael Behrisch @author Jakob Erdmann @date 2011-11-28 -@version $Id: node.py 20687 2016-05-10 11:27:00Z behrisch $ +@version $Id: node.py 23247 2017-03-07 13:46:58Z behrisch $ This file contains a Python-representation of a single node. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -35,10 +35,48 @@ self._prohibits = {} self._incLanes = incLanes self._intLanes = intLanes + self._shape3D = None + self._shape = None def getID(self): return self._id + def setShape(self, shape): + """Set the shape of the node. + + Shape must be a list containing x,y,z coords as numbers + to represent the shape of the node. + """ + for pp in shape: + if len(pp) != 3: + raise ValueError('shape point must consist of x,y,z') + self._shape3D = shape + self._shape = [(x, y) for x, y, z in shape] + + def getShape(self): + """Returns the shape of the node in 2d. + + This function returns the shape of the node, as defined in the net.xml + file. The returned shape is a list containing numerical + 2-tuples representing the x,y coordinates of the shape points. + + If no shape is defined in the xml, an empty list will be returned. + """ + + return self._shape + + def getShape3D(self): + """Returns the shape of the node in 3d. + + This function returns the shape of the node, as defined in the net.xml + file. The returned shape is a list containing numerical + 3-tuples representing the x,y,z coordinates of the shape points. + + If no shape is defined in the xml, an empty list will be returned. + """ + + return self._shape3D + def addOutgoing(self, edge): self._outgoing.append(edge) @@ -81,6 +119,9 @@ return ps[-(possProhibitorIndex - 1)] == '1' def getCoord(self): + return tuple(self._coord[:2]) + + def getCoord3D(self): return self._coord def getType(self): diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/net/roundabout.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/net/roundabout.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/net/roundabout.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/net/roundabout.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ @author Karol Stosiek @author Michael Behrisch @date 2011-11-28 -@version $Id: roundabout.py 20637 2016-05-04 07:40:50Z luecken $ +@version $Id: roundabout.py 22608 2017-01-17 06:28:54Z behrisch $ This file contains a Python-representation of a single roundabout. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/options.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/options.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/options.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/options.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @author Jakob Erdmann @author Michael Behrisch @date 2012-03-15 -@version $Id: options.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: options.py 22608 2017-01-17 06:28:54Z behrisch $ Provides utility functions for dealing with program options SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/output/convert/gpsdat.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/output/convert/gpsdat.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/output/convert/gpsdat.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/output/convert/gpsdat.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,13 +3,13 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2013-01-15 -@version $Id: gpsdat.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: gpsdat.py 22608 2017-01-17 06:28:54Z behrisch $ This module includes functions for converting SUMO's fcd-output into csv data files used by dlr-fcd processing chain SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/output/convert/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/output/convert/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/output/convert/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/output/convert/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2012-12-04 -@version $Id: __init__.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: __init__.py 22608 2017-01-17 06:28:54Z behrisch $ This file includes all shape structures. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/output/convert/ns2.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/output/convert/ns2.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/output/convert/ns2.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/output/convert/ns2.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,13 @@ @author Jakob Erdmann @author Michael Behrisch @date 2013-01-15 -@version $Id: ns2.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: ns2.py 22608 2017-01-17 06:28:54Z behrisch $ This module includes functions for converting SUMO's fcd-output into data files read by ns2. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/output/convert/omnet.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/output/convert/omnet.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/output/convert/omnet.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/output/convert/omnet.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,13 +3,13 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2013-01-15 -@version $Id: omnet.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: omnet.py 22608 2017-01-17 06:28:54Z behrisch $ This module includes functions for converting SUMO's fcd-output into data files read by OMNET. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/output/convert/phem.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/output/convert/phem.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/output/convert/phem.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/output/convert/phem.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,13 @@ @author Jakob Erdmann @author Michael Behrisch @date 2013-01-15 -@version $Id: phem.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: phem.py 23247 2017-03-07 13:46:58Z behrisch $ This module includes functions for converting SUMO's fcd-output into data files read by PHEM. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -45,7 +45,7 @@ by PHEM. The fcd-output "fcd" must be a valid file name of an fcd-output. The following may be a matter of changes: - - the engine torque is not given + - the engine torque is not given """ #print >> outSTRM, "v1\n,,,\n[s],[km/h],[%],[1/min]\n" print("v1\n,,\n[s],[km/h],[%]", file=outSTRM) @@ -63,16 +63,16 @@ Returns a map from the SUMO-road id to the generated numerical id used by PHEM. The following may be a matter of changes: - - currently, only the positions of the start and the end nodes are written, + - currently, only the positions of the start and the end nodes are written, the geometry of the edge as defined in the SUMO-network is not exported. - A map between the edge id and a segment to a numerical id would be necessary + A map between the edge id and a segment to a numerical id would be necessary """ - if outSTRM != None: + if outSTRM is not None: print("Str-Id,Sp,SegAnX,SegEnX,SegAnY,SegEnY", file=outSTRM) sIDm = sumolib._Running() for e in net._edges: eid = sIDm.g(e._id) - if outSTRM != None: + if outSTRM is not None: c1 = e._from._coord c2 = e._to._coord print("%s,%s,%s,%s,%s,%s" % @@ -85,13 +85,13 @@ Reformats the contents of the given fcd-output file into a .fzp file, readable by PHEM. The fcd-output "fcd" must be a valid file name of an fcd-output. - The "sIDm" parameter must be a map from SUMO-edge ids to their numerical + The "sIDm" parameter must be a map from SUMO-edge ids to their numerical representation as generated by toSTR(inpNET, outSTRM). Returns two maps, the first from vehicle ids to a numerical representation, the second from vehicle type ids to a numerical representation. """ sIDm = further["phemStreetMap"] - if outSTRM != None: + if outSTRM is not None: print( "t,WeltX,WeltY,Veh. No,v,Gradient,veh.Typ-Id,Str-Id", file=outSTRM) vIDm = sumolib._Running(further["orig-ids"], True) @@ -108,7 +108,7 @@ vtid = vtIDm.g(aType) sid = sIDm.g(v.edge) percSlope = math.sin(float(v.slope)) * 100. - if outSTRM != None: + if outSTRM is not None: print("%s,%s,%s,%s,%.3f,%s,%s,%s" % ( sumolib._intTime(q.time), float(v.x), float(v.y), vid, float(v.speed) * 3.6, percSlope, vtid, sid), file=outSTRM) @@ -121,7 +121,7 @@ in the given "vtIDm" map formatted as a .flt file readable by PHEM. The following may be a matter of changes: - - A default map is assigned to all vehicle types with the same probability + - A default map is assigned to all vehicle types with the same probability """ for q in sorted(vtIDm._m): print("%s,%s,%s" % diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/output/convert/shawn.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/output/convert/shawn.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/output/convert/shawn.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/output/convert/shawn.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,13 +3,13 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2013-01-15 -@version $Id: shawn.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: shawn.py 22608 2017-01-17 06:28:54Z behrisch $ This module includes functions for converting SUMO's fcd-output into data files read by Shawn. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/output/dump.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/output/dump.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/output/dump.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/output/dump.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,11 +3,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2011-06-15 -@version $Id: dump.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: dump.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/output/inductionloop.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/output/inductionloop.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/output/inductionloop.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/output/inductionloop.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,11 +3,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2011-06-15 -@version $Id: inductionloop.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: inductionloop.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/output/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/output/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/output/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/output/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Michael Behrisch @author Jakob Erdmann @date 2011-06-23 -@version $Id: __init__.py 21851 2016-10-31 12:20:12Z behrisch $ +@version $Id: __init__.py 23999 2017-04-21 09:04:47Z behrisch $ Python interface to SUMO especially for parsing output files. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -19,205 +19,10 @@ """ from __future__ import print_function from __future__ import absolute_import -import sys -import re -import xml.etree.cElementTree as ET -from collections import namedtuple, defaultdict -from keyword import iskeyword -from functools import reduce from xml.sax import make_parser from xml.sax.handler import ContentHandler from . import dump, inductionloop, convert - - -def _prefix_keyword(name, warn=False): - result = name - # create a legal identifier (xml allows '-', ':' and '.' ...) - result = ''.join([c for c in name if c.isalnum() or c == '_']) - if result != name: - if result == '': - result == 'attr_' - if warn: - print("Warning: Renaming attribute '%s' to '%s' because it contains illegal characters" % ( - name, result), file=sys.stderr) - if iskeyword(name): - result = 'attr_' + name - if warn: - print("Warning: Renaming attribute '%s' to '%s' because it conflicts with a python keyword" % ( - name, result), file=sys.stderr) - return result - - -def compound_object(element_name, attrnames, warn=False): - """return a class which delegates bracket access to an internal dict. - Missing attributes are delegated to the child dict for convenience. - @note: Care must be taken when child nodes and attributes have the same names""" - class CompoundObject(): - original_fields = sorted(attrnames) - _fields = [_prefix_keyword(a, warn) for a in original_fields] - - def __init__(self, values, child_dict): - for name, val in zip(self._fields, values): - self.__dict__[name] = val - self._child_dict = child_dict - self.name = element_name - - def getAttributes(self): - return [(k, getattr(self, k)) for k in self._fields] - - def hasAttribute(self, name): - return name in self._fields - - def setAttribute(self, name, value): - if name not in self._fields: - self._fields.append(name) - self.__dict__[name] = value - - def hasChild(self, name): - return name in self._child_dict - - def getChild(self, name): - return self._child_dict[name] - - def __getattr__(self, name): - if name[:2] != "__": - return self._child_dict.get(name, None) - raise AttributeError - - def __setattr__(self, name, value): - if name != "_child_dict" and name in self._child_dict: - self._child_dict[name] = value - else: - self.__dict__[name] = value - - def __delattr__(self, name): - if name in self._child_dict: - del self._child_dict[name] - else: - if name in self.__dict__: - del self.__dict__[name] - self._fields.remove(name) - - def __getitem__(self, name): - return self._child_dict[name] - - def __str__(self): - return "<%s,child_dict=%s>" % (self.getAttributes(), dict(self._child_dict)) - - def toXML(self, initialIndent="", indent=" "): - fields = ['%s="%s"' % (self.original_fields[i], getattr(self, k)) - for i, k in enumerate(self._fields) if getattr(self, k) is not None] - if not self._child_dict: - return "%s<%s %s/>\n" % (initialIndent, element_name, " ".join(fields)) - else: - s = "%s<%s %s>\n" % ( - initialIndent, element_name, " ".join(fields)) - for l in self._child_dict.values(): - for c in l: - s += c.toXML(initialIndent + indent) - return s + "%s\n" % (initialIndent, element_name) - - def __repr__(self): - return str(self) - - return CompoundObject - - -def parse(xmlfile, element_names, element_attrs={}, attr_conversions={}, - heterogeneous=False, warn=False): - """ - Parses the given element_names from xmlfile and yield compound objects for - their xml subtrees (no extra objects are returned if element_names appear in - the subtree) The compound objects provide all element attributes of - the root of the subtree as attributes unless attr_names are supplied. In this - case attr_names maps element names to a list of attributes which are - supplied. If attr_conversions is not empty it must map attribute names to - callables which will be called upon the attribute value before storing under - the attribute name. - The compound objects gives dictionary style access to list of compound - objects o for any children with the given element name - o['child_element_name'] = [osub0, osub1, ...] - As a shorthand, attribute style access to the list of child elements is - provided unless an attribute with the same name as the child elements - exists (i.e. o.child_element_name = [osub0, osub1, ...]) - @Note: All elements with the same name must have the same type regardless of - the subtree in which they occur (heterogeneous cases may be handled by - setting heterogeneous=False (with reduced parsing speed) - @Note: Attribute names may be modified to avoid name clashes - with python keywords. (set warn=True to receive renaming warnings) - @Note: The element_names may be either a single string or a list of strings. - @Example: parse('plain.edg.xml', ['edge']) - """ - if isinstance(element_names, str): - element_names = [element_names] - elementTypes = {} - for event, parsenode in ET.iterparse(xmlfile): - if parsenode.tag in element_names: - yield _get_compound_object(parsenode, elementTypes, - parsenode.tag, element_attrs, - attr_conversions, heterogeneous, warn) - parsenode.clear() - - -_NO_CHILDREN = defaultdict(lambda: []) -_IDENTITY = lambda x: x - - -def _get_compound_object(node, elementTypes, element_name, element_attrs, attr_conversions, heterogeneous, warn): - if not element_name in elementTypes or heterogeneous: - # initialized the compound_object type from the first encountered # - # element - attrnames = element_attrs.get(element_name, node.keys()) - if len(attrnames) != len(set(attrnames)): - raise Exception( - "non-unique attributes %s for element '%s'" % (attrnames, element_name)) - elementTypes[element_name] = compound_object( - element_name, attrnames, warn) - # prepare children - child_dict = _NO_CHILDREN # conserve space by reusing singleton - if len(node) > 0: - child_dict = defaultdict(lambda: []) - for c in node: - child_dict[c.tag].append(_get_compound_object( - c, elementTypes, c.tag, element_attrs, attr_conversions, - heterogeneous, warn)) - attrnames = elementTypes[element_name].original_fields - return elementTypes[element_name]( - [attr_conversions.get(a, _IDENTITY)(node.get(a)) for a in attrnames], - child_dict) - - -def sum(elements, attrname): - # for the given elements (as returned by method parse) compute the sum for attrname - # attrname must be the name of a numerical attribute - return reduce(lambda x, y: x + y, [float(getattr(e, attrname)) for e in elements]) - - -def average(elements, attrname): - # for the given elements (as returned by method parse) compute the average for attrname - # attrname must be the name of a numerical attribute - if elements: - return sum(elements, attrname) / len(elements) - else: - raise Exception("average of 0 elements is not defined") - - -def parse_fast(xmlfile, element_name, attrnames, warn=False): - """ - Parses the given attrnames from all elements with element_name - @Note: The element must be on its own line and the attributes must appear in - the given order. - @Example: parse_fast('plain.edg.xml', 'edge', ['id', 'speed']) - """ - pattern = '.*'.join(['<%s' % element_name] + - ['%s="([^"]*)"' % attr for attr in attrnames]) - attrnames = [_prefix_keyword(a, warn) for a in attrnames] - Record = namedtuple(element_name, attrnames) - reprog = re.compile(pattern) - for line in open(xmlfile): - m = reprog.search(line) - if m: - yield Record(*m.groups()) +from sumolib.xml import * class AbstractHandler__byID(ContentHandler): @@ -294,9 +99,9 @@ def prune(fv, minV, maxV): - if minV != None: + if minV is not None: for i, v in enumerate(fv): fv[i] = max(v, minV) - if maxV != None: + if maxV is not None: for i, v in enumerate(fv): fv[i] = min(v, maxV) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/route.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/route.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/route.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/route.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file route.py @author Michael Behrisch @date 2013-10-23 -@version $Id: route.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: route.py 22608 2017-01-17 06:28:54Z behrisch $ Route helper functions. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/checkFlows.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/checkFlows.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/checkFlows.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/checkFlows.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,10 @@ @file checkFlows.py @author Daniel Krajzewicz @date 2014-09-11 -@version $Id: checkFlows.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: checkFlows.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,11 +3,11 @@ @file __init__.py @author Daniel Krajzewicz @date 2014-07-01 -@version $Id: __init__.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: __init__.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/pop2.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/pop2.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/pop2.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/pop2.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,9 +3,9 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2014-08-22 -@version $Id: pop2.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: pop2.py 23979 2017-04-20 05:54:02Z namdre $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -81,16 +81,16 @@ self.params = params def getNumRuns(self): - raise "virtual ScenarioSet/getNumRuns" + raise NotImplementedError("virtual ScenarioSet/getNumRuns") def getAverageDuration(self): - raise "virtual ScenarioSet/getAverageDuration" + raise NotImplementedError("virtual ScenarioSet/getAverageDuration") def iterate(self): - raise "virtual ScenarioSet/iterate" + raise NotImplementedError("virtual ScenarioSet/iterate") def getRunsMatrix(self): - raise "virtual ScenarioSet/getRunsMatrix" + raise NotImplementedError("virtual ScenarioSet/getRunsMatrix") def getInt(self, name): return int(self.params[name]) @@ -99,7 +99,7 @@ return float(self.params[name]) def addTLSParameterFromFile(self, tlsProg, paramFile): - if paramFile == None: + if paramFile is None: return fd = open(paramFile) for l in fd.readlines(): @@ -418,7 +418,7 @@ cEW = RWScurves[iEW] cSN = RWScurves[iSN] print("Computing for %s %s %s %s" % (iWE, iNS, iEW, iSN)) - if uID == None: + if uID is None: sID = "RiLSA1LoadCurves(%s-%s-%s-%s)" % (iWE, iNS, iEW, iSN) else: sID = "RiLSA1LoadCurves(%s)" % (uID) @@ -442,7 +442,7 @@ extrapolateDemand(stream, 3600, cWE, 7).streams) else: print(stream._departEdgeModel) - raise "Hmmm, unknown stream??" + raise RuntimeError("Hmmm, unknown stream??") s.demand.streams = nStreams end = 86400 sampleFactor = None @@ -598,7 +598,7 @@ cEW = RWScurves[iEW] cSN = RWScurves[iSN] print("Computing for %s %s %s %s" % (iWE, iNS, iEW, iSN)) - if uID == None: + if uID is None: sID = "RiLSA1LoadCurvesSampled(%s-%s-%s-%s)" % (iWE, iNS, iEW, iSN) else: sID = "RiLSA1LoadCurvesSampled(%s)" % (uID) @@ -622,7 +622,7 @@ extrapolateDemand(stream, 3600, cWE, 7).streams) else: print(stream._departEdgeModel) - raise "Hmmm, unknown stream??" + raise RuntimeError("Hmmm, unknown stream??") s.demand.streams = nStreams end = 86400 sampleFactor = 1 @@ -874,7 +874,7 @@ extrapolateDemand(stream, 3600, cWE, 7).streams) else: print(stream._departEdgeModel) - raise "Hmmm, unknown stream??" + raise RuntimeError("Hmmm, unknown stream??") s.demand.streams = nStreams end = 86400 sampleFactor = 1 @@ -1014,7 +1014,7 @@ extrapolateDemand(stream, 3600, cWE, 7).streams) else: print(stream._departEdgeModel) - raise "Hmmm, unknown stream??" + raise RuntimeError("Hmmm, unknown stream??") s.demand.streams = nStreams s.demand.addStream(demandGenerator.Stream( "p_emp_to_mw", 0, 86400, f1, "emp", "mw", {"pedestrian": 1})) @@ -1149,7 +1149,7 @@ extrapolateDemand(stream, 3600, cWE, 7).streams) else: print(stream._departEdgeModel) - raise "Hmmm, unknown stream??" + raise RuntimeError("Hmmm, unknown stream??") s.demand.streams = nStreams vehicles = [] @@ -1535,7 +1535,8 @@ for f1 in range(self.getInt("f1from"), self.getInt("f1to"), self.getInt("f1step")): for f2begin in range(self.getInt("f2beginFrom"), self.getInt("f2beginTo"), self.getInt("f2beginStep")): for f2end in range(self.getInt("f2endFrom"), self.getInt("f2endTo"), self.getInt("f2endStep")): - for f2duration in range(self.getInt("f2durationFrom"), self.getInt("f2durationTo"), self.getInt("f2durationStep")): + for f2duration in range( + self.getInt("f2durationFrom"), self.getInt("f2durationTo"), self.getInt("f2durationStep")): if f1 == 0 and f2begin == 0 and f2end == 0: continue print("Computing for %s<->%s->%s@%s" % @@ -1614,7 +1615,8 @@ i = i + 1 j = 0 for f2end in range(self.getInt("f2endFrom"), self.getInt("f2endTo"), self.getInt("f2endStep")): - for f2duration in range(self.getInt("f2durationFrom"), self.getInt("f2durationTo"), self.getInt("f2durationStep")): + for f2duration in range( + self.getInt("f2durationFrom"), self.getInt("f2durationTo"), self.getInt("f2durationStep")): ret[-1].append({"f1": str(f1), "f2begin": str(f2begin), "f2end": str( f2end), "f2duration": str(f2duration), "scenario": "DemandStep"}) ranges[-1].append("%s/%s" % (f2end, f2duration)) @@ -2325,7 +2327,7 @@ cEW = RWScurves[iEW] cSN = RWScurves[iSN] print("Computing for %s %s %s %s" % (iWE, iNS, iEW, iSN)) - if uID == None: + if uID is None: sID = "RiLSA1LoadCurvesOutTLS(%s-%s-%s-%s)" % (iWE, iNS, iEW, iSN) else: sID = "RiLSA1LoadCurvesOutTLS(%s)" % (uID) @@ -2348,7 +2350,7 @@ extrapolateDemand(stream, 3600, cWE, 7).streams) else: print(stream._departEdgeModel) - raise "Hmmm, unknown stream??" + raise RuntimeError("Hmmm, unknown stream??") s.demand.streams = nStreams end = 86400 sampleFactor = None @@ -2503,7 +2505,7 @@ cEW = RWScurves[iEW] cSN = RWScurves[iSN] print("Computing for %s %s %s %s" % (iWE, iNS, iEW, iSN)) - if uID == None: + if uID is None: sID = "RiLSA1LoadCurvesOutTLS24(%s-%s-%s-%s)" % ( iWE, iNS, iEW, iSN) else: @@ -2528,7 +2530,7 @@ extrapolateDemand(stream, 3600, cWE, 7).streams) else: print(stream._departEdgeModel) - raise "Hmmm, unknown stream??" + raise RuntimeError("Hmmm, unknown stream??") s.demand.streams = nStreams end = 86400 sampleFactor = None @@ -2683,7 +2685,7 @@ cEW = RWScurves[iEW] cSN = RWScurves[iSN] print("Computing for %s %s %s %s" % (iWE, iNS, iEW, iSN)) - if uID == None: + if uID is None: sID = "RiLSA1LoadCurvesBothTLS(%s-%s-%s-%s)" % (iWE, iNS, iEW, iSN) else: sID = "RiLSA1LoadCurvesBothTLS(%s)" % (uID) @@ -2707,7 +2709,7 @@ extrapolateDemand(stream, 3600, cWE, 7).streams) else: print(stream._departEdgeModel) - raise "Hmmm, unknown stream??" + raise RuntimeError("Hmmm, unknown stream??") s.demand.streams = nStreams end = 86400 sampleFactor = None @@ -2862,7 +2864,7 @@ cEW = RWScurves[iEW] cSN = RWScurves[iSN] print("Computing for %s %s %s %s" % (iWE, iNS, iEW, iSN)) - if uID == None: + if uID is None: sID = "RiLSA1LoadCurvesBothTLS24(%s-%s-%s-%s)" % ( iWE, iNS, iEW, iSN) else: @@ -2887,7 +2889,7 @@ extrapolateDemand(stream, 3600, cWE, 7).streams) else: print(stream._departEdgeModel) - raise "Hmmm, unknown stream??" + raise RuntimeError("Hmmm, unknown stream??") s.demand.streams = nStreams end = 86400 sampleFactor = None @@ -3043,7 +3045,7 @@ cEW = RWScurves[iEW] cSN = RWScurves[iSN] print("Computing for %s %s %s %s" % (iWE, iNS, iEW, iSN)) - if uID == None: + if uID is None: sID = "BasicRiLSANet(%s-%s-%s-%s)" % (iWE, iNS, iEW, iSN) else: sID = "BasicRiLSANet(%s)" % (uID) @@ -3066,7 +3068,7 @@ extrapolateDemand(stream, 3600, cWE, 7).streams) else: print(stream._departEdgeModel) - raise "Hmmm, unknown stream??" + raise RuntimeError("Hmmm, unknown stream??") s.demand.streams = nStreams end = 86400 s.demand.build(0, end, s.netName, s.demandName, None) @@ -3209,7 +3211,7 @@ cEW = RWScurves[iEW] cSN = RWScurves[iSN] print("Computing for %s %s %s %s" % (iWE, iNS, iEW, iSN)) - if uID == None: + if uID is None: sID = "BasicRiLSANet(%s-%s-%s-%s)" % (iWE, iNS, iEW, iSN) else: sID = "BasicRiLSANet(%s)" % (uID) @@ -3232,7 +3234,7 @@ extrapolateDemand(stream, 3600, cWE, 7).streams) else: print(stream._departEdgeModel) - raise "Hmmm, unknown stream??" + raise RuntimeError("Hmmm, unknown stream??") s.demand.streams = nStreams end = 86400 sampleFactor = None @@ -3386,7 +3388,7 @@ cEW = RWScurves[iEW] cSN = RWScurves[iSN] print("Computing for %s %s %s %s" % (iWE, iNS, iEW, iSN)) - if uID == None: + if uID is None: sID = "BasicRiLSACorridor3(%s-%s-%s-%s)" % (iWE, iNS, iEW, iSN) else: sID = "BasicRiLSACorridor3(%s)" % (uID) @@ -3410,7 +3412,7 @@ extrapolateDemand(stream, 3600, cWE, 7).streams) else: print(stream._departEdgeModel) - raise "Hmmm, unknown stream??" + raise RuntimeError("Hmmm, unknown stream??") s.demand.streams = nStreams end = 86400 sampleFactor = None @@ -3584,7 +3586,7 @@ if name == "BasicRiLSACorridor3_24": return ScenarioSet_BasicRiLSACorridor3(params) - raise "unknown scenario '%s'" % name + raise RuntimeError("unknown scenario '%s'" % name) def getAllScenarioSets(): diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/runsdb.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/runsdb.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/runsdb.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/runsdb.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,10 @@ @file runsdb.py @author Daniel Krajzewicz @date 2014-07-21 -@version $Id: runsdb.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: runsdb.py 23979 2017-04-20 05:54:02Z namdre $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -47,14 +47,14 @@ self.cursor = self.conn.cursor() self.cursor.execute("SELECT MAX(id) FROM run") v = self.cursor.fetchall() - if len(v) != 0 and v[0][0] != None: + if len(v) != 0 and v[0][0] is not None: self.run = v[0][0] + 1 else: self.run = 0 def addRun(self, scenario, kvDesc): if self.run < 0: - raise "Database was not initialised" + raise RuntimeError("Database was not initialised") self.run = self.run + 1 cid = self.run - 1 for k in kvDesc: @@ -97,7 +97,7 @@ return self.toList(self.cursor.fetchall()) def getRunsData(self, runs=None): - if runs == None: + if runs is None: runs = self.getRunIDs() ret = {} for r in runs: @@ -125,16 +125,16 @@ """ def fetchResults(self, runs=None, measure=None, denominator=None): - if runs == None: + if runs is None: runs = self.getRunIDs() ret = {} for r in runs: ret[r] = {} - if measure == None: + if measure is None: i = self.cursor.execute( "SELECT * FROM result WHERE runID=?", (r,)) else: - if denominator == None: + if denominator is None: i = self.cursor.execute( "SELECT * FROM result WHERE runID=? AND key=?", (r, measure)) else: @@ -145,7 +145,7 @@ ret[r][row[1]] = {} if row[2] in ret[r][row[1]]: pass - raise "set twice!!" + raise RuntimeError("set twice!!") ret[r][row[1]][row[2]] = row[3] return ret diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_corridor.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_corridor.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_corridor.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_corridor.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,10 @@ @file basic_corridor.py @author Daniel Krajzewicz @date 2014-09-01 -@version $Id: basic_corridor.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: basic_corridor.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_crossl.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_crossl.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_crossl.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_crossl.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,11 +3,11 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2014-09-01 -@version $Id: basic_crossl.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: basic_crossl.py 22608 2017-01-17 06:28:54Z behrisch $ Perform smoothing of edge costs across successive iterations of duaIterate SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_cross.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_cross.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_cross.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_cross.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,10 @@ @file costMemory.py @author Daniel Krajzewicz @date 2014-09-01 -@version $Id: basic_cross.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: basic_cross.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_net.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_net.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_net.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_net.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,10 @@ @file basic_net.py @author Daniel Krajzewicz @date 2014-09-01 -@version $Id: basic_net.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: basic_net.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_rilsacorridor3.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_rilsacorridor3.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_rilsacorridor3.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_rilsacorridor3.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,10 @@ @file basic_rilsacorridor3.py @author Daniel Krajzewicz @date 2014-09-01 -@version $Id: basic_rilsacorridor3.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: basic_rilsacorridor3.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_rilsanet2x2.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_rilsanet2x2.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_rilsanet2x2.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_rilsanet2x2.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,10 @@ @file basic_rilsanet2x2.py @author Daniel Krajzewicz @date 2014-09-01 -@version $Id: basic_rilsanet2x2.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: basic_rilsanet2x2.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_rilsanet.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_rilsanet.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_rilsanet.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/basic_rilsanet.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,10 @@ @file basic_rilsanet.py @author Daniel Krajzewicz @date 2014-09-01 -@version $Id: basic_rilsanet.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: basic_rilsanet.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,7 +2,7 @@ @file __init__.py @author Daniel Krajzewicz @date 2014-07-01 -@version $Id: __init__.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: __init__.py 23979 2017-04-20 05:54:02Z namdre $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors @@ -47,7 +47,7 @@ if l2[i] != 0: i = i + 1 continue - if max_val == None or max_val < l[i]: + if max_val is None or max_val < l[i]: max_idx = i max_val = l[i] i = i + 1 @@ -62,7 +62,7 @@ if l2[i] != 0: i = i + 1 continue - if min_val == None or min_val > l[i]: + if min_val is None or min_val > l[i]: min_idx = i min_val = l[i] i = i + 1 @@ -179,12 +179,12 @@ fdo.close() def getNet(self): - if self.net != None: + if self.net is not None: return self.net - if self.netName != None: + if self.netName is not None: self.net = sumolib.net.readNet(self.netName) return self.net - raise "network is unknown" + raise RuntimeError("network is unknown") def fullPath(self, fileName): print("full >" + os.path.join(self.dataPath, fileName)) @@ -265,7 +265,8 @@ program[i] = MORNING i = i - 1 i = maxIdx + 1 - while i < len(rel) and rel[i] > IREL_THRESHOLD and program[i] == 0 and streamsNS[i] + streamsWE[i] > MORNING_MIN: + while i < len(rel) and rel[i] > IREL_THRESHOLD and program[ + i] == 0 and streamsNS[i] + streamsWE[i] > MORNING_MIN: program[i] = MORNING i = i + 1 else: @@ -281,7 +282,8 @@ i = minIdx + 1 print(" %s %s %s %s" % (i, rel[i], program[i], streamsNS[i] + streamsWE[i])) - while i < len(rel) and rel[i] < REL_THRESHOLD and program[i] == 0 and streamsNS[i] + streamsWE[i] > MORNING_MIN: + while i < len(rel) and rel[i] < REL_THRESHOLD and program[ + i] == 0 and streamsNS[i] + streamsWE[i] > MORNING_MIN: program[i] = MORNING i = i + 1 print(" %s %s %s %s" % @@ -298,20 +300,24 @@ if maxVal > 1 - minVal: i = maxIdx # and rel[i]>.6 - while i > 0 and rel[i] > IREL_THRESHOLD and program[i] == 0 and streamsNS[i] + streamsWE[i] > AFTERNOON_MIN: + while i > 0 and rel[i] > IREL_THRESHOLD and program[ + i] == 0 and streamsNS[i] + streamsWE[i] > AFTERNOON_MIN: program[i] = AFTERNOON i = i - 1 i = maxIdx + 1 - while i < len(rel) and rel[i] > IREL_THRESHOLD and program[i] == 0 and streamsNS[i] + streamsWE[i] > AFTERNOON_MIN: + while i < len(rel) and rel[i] > IREL_THRESHOLD and program[ + i] == 0 and streamsNS[i] + streamsWE[i] > AFTERNOON_MIN: program[i] = AFTERNOON i = i + 1 else: i = minIdx - while i > 0 and rel[i] < REL_THRESHOLD and program[i] == 0 and streamsNS[i] + streamsWE[i] > AFTERNOON_MIN: + while i > 0 and rel[i] < REL_THRESHOLD and program[ + i] == 0 and streamsNS[i] + streamsWE[i] > AFTERNOON_MIN: program[i] = AFTERNOON i = i - 1 i = minIdx + 1 - while i < len(rel) and rel[i] < REL_THRESHOLD and program[i] == 0 and streamsNS[i] + streamsWE[i] > AFTERNOON_MIN: + while i < len(rel) and rel[i] < REL_THRESHOLD and program[ + i] == 0 and streamsNS[i] + streamsWE[i] > AFTERNOON_MIN: program[i] = AFTERNOON i = i + 1 for i, x in enumerate(program): @@ -330,7 +336,7 @@ for j, v in enumerate(rel): if program[j] != i: continue - if maxV == None: + if maxV is None: maxV = rel[j] maxI = j elif maxV < rel[j]: @@ -394,5 +400,4 @@ elif which == "BasicRiLSACorridor3": from . import basic_rilsacorridor3 return basic_rilsacorridor3.Scenario_BasicRiLSACorridor3(useName, params, withDefaultDemand) - print("unknown scenario '%s'" % name) - raise + raise RuntimeError("unknown scenario '%s'" % name) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/RealWorld/RiLSA_example1/makeRoutes.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/RealWorld/RiLSA_example1/makeRoutes.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/RealWorld/RiLSA_example1/makeRoutes.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/RealWorld/RiLSA_example1/makeRoutes.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,10 @@ @file makeRoutes.py @author Daniel Krajzewicz @date 2014-10-06 -@version $Id: makeRoutes.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: makeRoutes.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/RealWorld/RiLSA_example2/makeRoutes.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/RealWorld/RiLSA_example2/makeRoutes.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/RealWorld/RiLSA_example2/makeRoutes.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/RealWorld/RiLSA_example2/makeRoutes.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,10 @@ @file makeRoutes.py @author Daniel Krajzewicz @date 2014-10-06 -@version $Id: makeRoutes.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: makeRoutes.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/RealWorld/RiLSA_example3/makeRoutes.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/RealWorld/RiLSA_example3/makeRoutes.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/RealWorld/RiLSA_example3/makeRoutes.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/RealWorld/RiLSA_example3/makeRoutes.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,10 @@ @file makeRoutes.py @author Daniel Krajzewicz @date 2014-10-06 -@version $Id: makeRoutes.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: makeRoutes.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/RealWorld/RiLSA_example4/makeRoutes.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/RealWorld/RiLSA_example4/makeRoutes.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/RealWorld/RiLSA_example4/makeRoutes.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/RealWorld/RiLSA_example4/makeRoutes.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,10 @@ @file makeRoutes.py @author Daniel Krajzewicz @date 2014-10-06 -@version $Id: makeRoutes.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: makeRoutes.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/real_world.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/real_world.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/real_world.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/real_world.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,10 @@ @file real_world.py @author Daniel Krajzewicz @date 2014-09-01 -@version $Id: real_world.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: real_world.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1_both_tls24.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1_both_tls24.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1_both_tls24.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1_both_tls24.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,10 @@ @file rilsa1_both_tls24.py @author Daniel Krajzewicz @date 2014-09-01 -@version $Id: rilsa1_both_tls24.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: rilsa1_both_tls24.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1_both_tls.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1_both_tls.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1_both_tls.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1_both_tls.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,10 @@ @file rilsa1_both_tls.py @author Daniel Krajzewicz @date 2014-09-01 -@version $Id: rilsa1_both_tls.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: rilsa1_both_tls.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1_out_tls24.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1_out_tls24.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1_out_tls24.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1_out_tls24.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,10 @@ @file rilsa1_out_tls24.py @author Daniel Krajzewicz @date 2014-09-01 -@version $Id: rilsa1_out_tls24.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: rilsa1_out_tls24.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1_out_tls.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1_out_tls.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1_out_tls.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1_out_tls.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,10 @@ @file rilsa1_out_tls.py @author Daniel Krajzewicz @date 2014-09-01 -@version $Id: rilsa1_out_tls.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: rilsa1_out_tls.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/scenario/scenarios/rilsa1.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,10 @@ @file costMemory.py @author Daniel Krajzewicz @date 2014-09-01 -@version $Id: rilsa1.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: rilsa1.py 22608 2017-01-17 06:28:54Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/sensors/inductive_loop.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/sensors/inductive_loop.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/sensors/inductive_loop.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/sensors/inductive_loop.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,13 +4,13 @@ @author Michael Behrisch @author Jakob Erdmann @date 2010-02-18 -@version $Id: inductive_loop.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: inductive_loop.py 23247 2017-03-07 13:46:58Z behrisch $ -Library for reading and storing Inductive Loop detector representations and +Library for reading and storing Inductive Loop detector representations and measurements. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -25,7 +25,7 @@ class InductiveLoop: - def __init__(self, id, lane, pos, frequency, file, friendlyPos=True): + def __init__(self, id, lane, pos, frequency=60, file="NUL", friendlyPos=True): self.id = id self.lane = lane self.pos = pos @@ -34,7 +34,8 @@ self.friendlyPos = friendlyPos def toXML(self): - return '' % (self.id, self.lane, self.pos, self.frequency, self.file, self.friendlyPos) + return '' % ( + self.id, self.lane, self.pos, self.frequency, self.file, self.friendlyPos) class InductiveLoopReader(handler.ContentHandler): @@ -52,7 +53,7 @@ self._id2il[poi.id] = poi self._ils.append(poi) self._lastIL = poi - if name == 'param' and self._lastIL != None: + if name == 'param' and self._lastIL is not None: self._lastIL.attributes[attrs['key']] = attrs['value'] def endElement(self, name): diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/sensors/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/sensors/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/sensors/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/sensors/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Jakob Erdmann @author Michael Behrisch @date 2012-12-04 -@version $Id: __init__.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: __init__.py 22608 2017-01-17 06:28:54Z behrisch $ This file includes all sensor structures. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/shapes/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/shapes/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/shapes/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/shapes/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2012-12-04 -@version $Id: __init__.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: __init__.py 22608 2017-01-17 06:28:54Z behrisch $ This file includes all shape structures. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/shapes/poi.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/shapes/poi.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/shapes/poi.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/shapes/poi.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ @author Jakob Erdmann @author Melanie Knocke @date 2010-02-18 -@version $Id: poi.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: poi.py 23247 2017-03-07 13:46:58Z behrisch $ Library for reading and storing PoIs. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -82,7 +82,7 @@ self._id2poi[poi.id] = poi self._pois.append(poi) self._lastPOI = poi - if name == 'param' and self._lastPOI != None: + if name == 'param' and self._lastPOI is not None: self._lastPOI.attributes[attrs['key']] = attrs['value'] def endElement(self, name): diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/shapes/polygon.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/shapes/polygon.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/sumolib/shapes/polygon.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/sumolib/shapes/polygon.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Melanie Knocke @author Michael Behrisch @date 2012-12-04 -@version $Id: polygon.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: polygon.py 24072 2017-04-26 13:26:58Z behrisch $ Library for reading and storing polygons. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -52,15 +52,15 @@ def toXML(self): ret = '" % (self.getAttributes(), dict(self._child_dict)) + + def toXML(self, initialIndent="", indent=" "): + fields = ['%s="%s"' % (self._original_fields[i], getattr(self, k)) + for i, k in enumerate(self._fields) if getattr(self, k) is not None] + if not self._child_dict: + return "%s<%s %s/>\n" % (initialIndent, element_name, " ".join(fields)) + else: + s = "%s<%s %s>\n" % ( + initialIndent, element_name, " ".join(fields)) + for l in self._child_dict.values(): + for c in l: + s += c.toXML(initialIndent + indent) + return s + "%s\n" % (initialIndent, element_name) + + def __repr__(self): + return str(self) + + return CompoundObject + + +def parse(xmlfile, element_names, element_attrs={}, attr_conversions={}, + heterogeneous=False, warn=False): + """ + Parses the given element_names from xmlfile and yield compound objects for + their xml subtrees (no extra objects are returned if element_names appear in + the subtree) The compound objects provide all element attributes of + the root of the subtree as attributes unless attr_names are supplied. In this + case attr_names maps element names to a list of attributes which are + supplied. If attr_conversions is not empty it must map attribute names to + callables which will be called upon the attribute value before storing under + the attribute name. + The compound objects gives dictionary style access to list of compound + objects o for any children with the given element name + o['child_element_name'] = [osub0, osub1, ...] + As a shorthand, attribute style access to the list of child elements is + provided unless an attribute with the same name as the child elements + exists (i.e. o.child_element_name = [osub0, osub1, ...]) + @Note: All elements with the same name must have the same type regardless of + the subtree in which they occur (heterogeneous cases may be handled by + setting heterogeneous=False (with reduced parsing speed) + @Note: Attribute names may be modified to avoid name clashes + with python keywords. (set warn=True to receive renaming warnings) + @Note: The element_names may be either a single string or a list of strings. + @Example: parse('plain.edg.xml', ['edge']) + """ + if isinstance(element_names, str): + element_names = [element_names] + elementTypes = {} + for event, parsenode in ET.iterparse(xmlfile): + if parsenode.tag in element_names: + yield _get_compound_object(parsenode, elementTypes, + parsenode.tag, element_attrs, + attr_conversions, heterogeneous, warn) + parsenode.clear() + + +_NO_CHILDREN = {} +_IDENTITY = lambda x: x + + +def _get_compound_object(node, elementTypes, element_name, element_attrs, attr_conversions, heterogeneous, warn): + if not element_name in elementTypes or heterogeneous: + # initialized the compound_object type from the first encountered # + # element + attrnames = element_attrs.get(element_name, node.keys()) + if len(attrnames) != len(set(attrnames)): + raise Exception( + "non-unique attributes %s for element '%s'" % (attrnames, element_name)) + elementTypes[element_name] = compound_object( + element_name, attrnames, warn) + # prepare children + child_dict = _NO_CHILDREN # conserve space by reusing singleton + if len(node) > 0: + child_dict = OrderedDict() + for c in node: + child_dict.setdefault(c.tag, []).append(_get_compound_object( + c, elementTypes, c.tag, element_attrs, attr_conversions, + heterogeneous, warn)) + attrnames = elementTypes[element_name]._original_fields + return elementTypes[element_name]( + [attr_conversions.get(a, _IDENTITY)(node.get(a)) for a in attrnames], + child_dict) + + +def create_document(root_element_name, attrs=None, schema=None): + if attrs is None: + attrs = {} + if schema is None: + attrs["xmlns:xsi"] = "http://www.w3.org/2001/XMLSchema-instance" + attrs["xsi:noNamespaceSchemaLocation"] = "http://sumo.dlr.de/xsd/" + root_element_name + "_file.xsd" + clazz = compound_object(root_element_name, sorted(attrs.keys())) + return clazz([attrs.get(a) for a in sorted(attrs.keys())], OrderedDict()) + + +def sum(elements, attrname): + # for the given elements (as returned by method parse) compute the sum for attrname + # attrname must be the name of a numerical attribute + return reduce(lambda x, y: x + y, [float(getattr(e, attrname)) for e in elements]) + + +def average(elements, attrname): + # for the given elements (as returned by method parse) compute the average for attrname + # attrname must be the name of a numerical attribute + if elements: + return sum(elements, attrname) / len(elements) + else: + raise Exception("average of 0 elements is not defined") + + +def parse_fast(xmlfile, element_name, attrnames, warn=False): + """ + Parses the given attrnames from all elements with element_name + @Note: The element must be on its own line and the attributes must appear in + the given order. + @Example: parse_fast('plain.edg.xml', 'edge', ['id', 'speed']) + """ + pattern = '.*'.join(['<%s' % element_name] + + ['%s="([^"]*)"' % attr for attr in attrnames]) + attrnames = [_prefix_keyword(a, warn) for a in attrnames] + Record = namedtuple(element_name, attrnames) + reprog = re.compile(pattern) + for line in open(xmlfile): + m = reprog.search(line) + if m: + yield Record(*m.groups()) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/tls/createTlsCsv.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/tls/createTlsCsv.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/tls/createTlsCsv.py 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/tls/createTlsCsv.py 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,30 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +import argparse +from lxml import etree + +parser = argparse.ArgumentParser( + description='Create tls links from sumo net as needed by tls_csv2SUMO.py. You have to edit the link number field (preset with g). The comment gives the link number shown on demand in SUMO-GUI') +parser.add_argument('net', help='Input file name') + +args = parser.parse_args() + +doc = etree.parse(args.net) + +connections = {} + +for conn in doc.xpath('//connection'): + if 'linkIndex' in conn.attrib: + # use traffic light id and right adjusted number for sorting and as + # comment + numIndex = conn.attrib['linkIndex'] + index = conn.attrib['tl'] + ';' + numIndex.zfill(3) + connections[index] = conn.attrib['from'] + '_' + conn.attrib['fromLane'] + \ + ';' + conn.attrib['to'] + '_' + conn.attrib['toLane'] + # print record + # print conn.attrib['from'], conn.attrib['to'], + # conn.attrib['linkIndex'] + +for conn in sorted(connections): + # print conn, connections[conn] + print "link;g;{};0".format(connections[conn]).ljust(50) + '#' + str(conn).rjust(3) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/tls/tls_check.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/tls/tls_check.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/tls/tls_check.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/tls/tls_check.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,14 +4,14 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2009-08-01 -@version $Id: tls_check.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: tls_check.py 22608 2017-01-17 06:28:54Z behrisch $ Verifies the traffic lights in the given network. Currently verified: - phase length matches controlled link number SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/tls/tls_csv2SUMO.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/tls/tls_csv2SUMO.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/tls/tls_csv2SUMO.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/tls/tls_csv2SUMO.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2009-08-01 -@version $Id: tls_csv2SUMO.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: tls_csv2SUMO.py 24019 2017-04-22 18:49:30Z behrisch $ Converts a csv-tls-description into one SUMO can read as additional file. Format of the csv-file: @@ -22,7 +22,7 @@ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -35,17 +35,68 @@ import sys import os +import argparse sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import sumolib.net +parser = argparse.ArgumentParser(description='Create tls xml def from csv.') +parser.add_argument('TLS_CSV', help='tls definition') +parser.add_argument('NET', help='sumo net file') +parser.add_argument( + '-d', '--debug', action='store_true', help='print additional debug info') + +args = parser.parse_args() + + +def computeLinkPhasesAndTimes(links2sigGrpPhase): + global normTimes + global defs + global links2index + phases = {} + + # compute all boundaries between phases + for myKey in links2sigGrpPhase: + phaseDef = links2sigGrpPhase[myKey] + for i in range(0, len(phaseDef), 2): + phases[int(phaseDef[i])] = True + lastTime = 0 + newTimes = [] + sortPhases = [] + + # sort the boundaries and compute the normTimes (here newTimes)) list + for time in sorted(phases): + if int(time) != 0: + sortPhases.append(time) + if int(time) > lastTime: + newTimes.append(str(int(time) - lastTime)) + lastTime = int(time) + normTimes = newTimes + if args.debug: + print ('normTimes', newTimes, file=sys.stderr) + + # create the phase string + for myKey in links2sigGrpPhase: + phaseDef = links2sigGrpPhase[myKey] + currentPhaseIndex = 0 + newPhases = [] + sigGrpPhaseIndex = 1 + if args.debug: + print ('phaseDef', phaseDef, 'len', len(phaseDef), file=sys.stderr) + for currentPhase in sortPhases: + if args.debug: + print ('SGPIndex', sigGrpPhaseIndex, 'startCurrPhase', currentPhase, + 'endCurrPhase', phaseDef[sigGrpPhaseIndex + 1], file=sys.stderr) + newPhases.append(phaseDef[sigGrpPhaseIndex]) + if int(phaseDef[sigGrpPhaseIndex + 1]) == currentPhase and sigGrpPhaseIndex + 2 < len(phaseDef): + sigGrpPhaseIndex += 2 + if args.debug: + print(myKey, newPhases, file=sys.stderr) + links2index[myKey] = len(defs) + defs.append(newPhases) -if len(sys.argv) < 2: - print("Call: tls_csv2SUMO.py ", file=sys.stderr) - sys.exit() - -allTLS = sys.argv[1].split(",") +allTLS = args.TLS_CSV.split(",") allMinTimes = [] allMaxTimes = [] allNormTimes = [] @@ -61,6 +112,7 @@ for tlsFile in allTLS: fd = open(tlsFile) key = None + hasSigGrpPhase = False for l in fd: l = l.strip() if len(l) > 0 and l[0] == '#': @@ -89,6 +141,7 @@ subkey = "" offset = 0 links2index = {} + links2sigGrpPhase = {} key = v[1] elif v[0] == "subkey": @@ -96,7 +149,8 @@ elif v[0] == "offset": offset = v[1] elif v[0] == "link": - linkNo = int(v[1]) + #linkNo = int(v[1]) + linkNo = v[1] fromDef = v[2] toDef = v[3] minor = v[4] == "1" @@ -109,13 +163,19 @@ maxTimes = v[1:] elif v[0] == "time": normTimes = v[1:] + elif v[0] == "siggrpphase": + links2sigGrpPhase[v[1]] = v[2:] + hasSigGrpPhase = True else: if len(v) > 1: - links2index[int(v[0])] = len(defs) + links2index[v[0]] = len(defs) defs.append(v[1:]) pass + if hasSigGrpPhase: + computeLinkPhasesAndTimes(links2sigGrpPhase) + if len(defs) > 0: links2index[-1] = len(defs) defs.append(['g'] * len(defs[0])) @@ -133,7 +193,7 @@ allLink2Indices.append(links2index) fd.close() -net1 = sumolib.net.readNet(sys.argv[2]) +net1 = sumolib.net.readNet(args.NET) print('\n') for keyIndex, key in enumerate(allKeys): @@ -176,7 +236,7 @@ if valid: linkMap[tl_c[2]] = l[2] laneMap[tl_c[2]] = (li, lo) - if laneMap[tl_c[2]] == None: + if laneMap[tl_c[2]] is None: print("Warning: No link definition for connection (%s, %s)!. Using 'g' by default" % ( li.getID(), lo.getID()), file=sys.stderr) linkMap[tl_c[2]] = -1 @@ -228,7 +288,7 @@ state = state + "o" else: sys.stderr.write( - "missing value at %s (%s); setting to g\n" % (index, linkMap[l])) + "missing value %s at %s (%s); setting to g\n" % (d[i], index, linkMap[l])) state = state + "g" for l1 in range(0, len(state)): if state[l1] == 'g': diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/tlsCoordinator.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/tlsCoordinator.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/tlsCoordinator.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/tlsCoordinator.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Martin Taraz (martin@taraz.de) @author Jakob Erdmann @date 2015-09-07 -@version $Id: tlsCoordinator.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: tlsCoordinator.py 23251 2017-03-07 13:52:08Z behrisch $ Coordinates traffic lights in a sumo net for a given demand SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -83,8 +83,8 @@ def locate(tlsToFind, sets): - """return - - the set in which the given traffic light exists + """return + - the set in which the given traffic light exists - the pair in which it was found - the index within the pair """ @@ -143,19 +143,19 @@ l1, l1Pair, l1Index = locate(TLSP.otl, sets) l2, l2Pair, l2Index = locate(TLSP.tl, sets) # print(l1) - if l1 == None and l2 == None: + if l1 is None and l2 is None: # new set newlist = [] newlist.append(TLSP) sets.append(newlist) c1 += 1 operation = "newSet" - elif l2 == None and not l1 == None: + elif l2 is None and not l1 is None: # add to set 1 - add after existing set TLSP = coordinateAfterSet(TLSP, l1, l1Pair, l1Index) c2 += 1 operation = "addAfterSet" - elif l1 == None and not l2 == None: + elif l1 is None and not l2 is None: # add to set 2 - add before existing set TLSP = coordinateBeforeSet(TLSP, l2, l2Pair, l2Index) c3 += 1 @@ -285,7 +285,7 @@ betweenOffset = travelTime + ogreen - green startOffset = 0 # relevant data for a pair of traffic lights - TLPairs[key] = PairData(otl, oconnection, tl, connection, betweenOffset, startOffset, travelTime, + TLPairs[key] = PairData(otl, oconnection, tl, connection, betweenOffset, startOffset, travelTime, edge.getPriority(), numVehicles + 1, ogreen, green) return TLPairs diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traceExporter.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traceExporter.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traceExporter.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traceExporter.py 2017-07-23 16:22:03.000000000 +0000 @@ -7,10 +7,10 @@ @author Jakob Erdmann @author Michael Behrisch @date 2013-01-15 -@version $Id: traceExporter.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: traceExporter.py 23251 2017-03-07 13:52:08Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -145,7 +145,7 @@ def main(args=None): """The main function; parses options and converts...""" # ---------- build and read options ---------- - USAGE = """Usage %prog -i [options] + USAGE = """Usage %prog -i [options] Converts the given fcd file (generated by sumo --fcd-output) into the selected output format. Optionally the output can be sampled, filtered and distorted. """ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_areal.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_areal.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_areal.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_areal.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,109 +0,0 @@ -# -*- coding: utf-8 -*- -""" -@file areal.py -@author Mario Krumnow -@author Laura Bieker -@date 2011-03-16 -@version $Id: _areal.py 20482 2016-04-18 20:49:42Z behrisch $ - -Python implementation of the TraCI interface. - -SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors - -This file is part of SUMO. -SUMO is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3 of the License, or -(at your option) any later version. -""" -from __future__ import absolute_import -import struct -from . import constants as tc -from .domain import Domain -from .storage import Storage - -_RETURN_VALUE_FUNC = {tc.JAM_LENGTH_METERS: Storage.readDouble, - tc.JAM_LENGTH_VEHICLE: Storage.readInt, - tc.LAST_STEP_MEAN_SPEED: Storage.readDouble, - tc.VAR_POSITION: Storage.readDouble, - tc.VAR_LENGTH: Storage.readDouble, - tc.VAR_LANE_ID: Storage.readString, - tc.LAST_STEP_VEHICLE_ID_LIST: Storage.readStringList, - tc.LAST_STEP_VEHICLE_NUMBER: Storage.readInt, - tc.LAST_STEP_OCCUPANCY: Storage.readDouble} - - -class ArealDomain(Domain): - - def __init__(self): - Domain.__init__(self, "areal", tc.CMD_GET_AREAL_DETECTOR_VARIABLE, None, - tc.CMD_SUBSCRIBE_AREAL_DETECTOR_VARIABLE, tc.RESPONSE_SUBSCRIBE_AREAL_DETECTOR_VARIABLE, - tc.CMD_SUBSCRIBE_AREAL_DETECTOR_CONTEXT, tc.RESPONSE_SUBSCRIBE_AREAL_DETECTOR_CONTEXT, - _RETURN_VALUE_FUNC) - - def getJamLengthVehicle(self, detID): - """getJamLengthVehicle(string) -> integer - - Returns the jam length in vehicles within the last simulation step. - """ - return self._getUniversal(tc.JAM_LENGTH_VEHICLE, detID) - - def getJamLengthMeters(self, detID): - """getJamLengthMeters(string) -> double - - Returns the jam length in meters within the last simulation step. - """ - return self._getUniversal(tc.JAM_LENGTH_METERS, detID) - - def getLastStepMeanSpeed(self, detID): - """getLastStepMeanSpeed(string) -> double - - Returns the current mean speed in m/s of vehicles that were on the named e2. - """ - return self._getUniversal(tc.LAST_STEP_MEAN_SPEED, detID) - - def getLastStepVehicleIDs(self, detID): - """getLastStepVehicleIDs(string) -> list(string) - - Returns the list of ids of vehicles that were on the named induction loop in the last simulation step. - """ - return self._getUniversal(tc.LAST_STEP_VEHICLE_ID_LIST, detID) - - def getLastStepOccupancy(self, detID): - """getLastStepMeanSpeed(string) -> double - - Returns the percentage of space the detector was occupied by a vehicle [%] - """ - return self._getUniversal(tc.LAST_STEP_OCCUPANCY, detID) - - def getPosition(self, detID): - """getPosition(string) -> double - - Returns the starting position of the detector measured from the beginning of the lane in meters. - """ - return self._getUniversal(tc.VAR_POSITION, detID) - - def getLaneID(self, detID): - """getLaneID(string) -> string - - Returns the id of the lane the detector is on. - """ - return self._getUniversal(tc.VAR_LANE_ID, detID) - - def getLength(self, detID): - """getLength(string) -> double - - Returns the length of the detector - """ - return self._getUniversal(tc.VAR_LENGTH, detID) - - def getLastStepVehicleNumber(self, detID): - """getLastStepVehicleNumber(string) -> integer - - Returns the number of vehicles that were on the named induction loop within the last simulation step. - """ - return self._getUniversal(tc.LAST_STEP_VEHICLE_NUMBER, detID) - - -ArealDomain() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/connection.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/connection.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/connection.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/connection.py 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ @author Daniel Krajzewicz @author Jakob Erdmann @date 2008-10-09 -@version $Id: connection.py 21776 2016-10-25 09:10:31Z behrisch $ +@version $Id: connection.py 24028 2017-04-24 05:10:18Z behrisch $ Python implementation of the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -145,6 +145,11 @@ self._string += struct.pack("!BB", tc.TYPE_BYTE, value) self._sendExact() + def _sendUByteCmd(self, cmdID, varID, objID, value): + self._beginMessage(cmdID, varID, objID, 1 + 1) + self._string += struct.pack("!BB", tc.TYPE_UBYTE, value) + self._sendExact() + def _sendStringCmd(self, cmdID, varID, objID, value): self._beginMessage(cmdID, varID, objID, 1 + 4 + len(value)) self._packString(value) @@ -223,10 +228,11 @@ if parameters and v in parameters: self._string += parameters[v] result = self._sendExact() - objectID, response = self._readSubscription(result) - if response - cmdID != 16 or objectID != objID: - raise FatalTraCIError("Received answer %02x,%s for subscription command %02x,%s." % ( - response, objectID, cmdID, objID)) + if varIDs: + objectID, response = self._readSubscription(result) + if response - cmdID != 16 or objectID != objID: + raise FatalTraCIError("Received answer %02x,%s for subscription command %02x,%s." % ( + response, objectID, cmdID, objID)) def _getSubscriptionResults(self, cmdID): return self._subscriptionMapping[cmdID] @@ -244,23 +250,33 @@ for v in varIDs: self._string += struct.pack("!B", v) result = self._sendExact() - objectID, response = self._readSubscription(result) - if response - cmdID != 16 or objectID != objID: - raise FatalTraCIError("Received answer %02x,%s for context subscription command %02x,%s." % ( - response, objectID, cmdID, objID)) + if varIDs: + objectID, response = self._readSubscription(result) + if response - cmdID != 16 or objectID != objID: + raise FatalTraCIError("Received answer %02x,%s for context subscription command %02x,%s." % ( + response, objectID, cmdID, objID)) def isEmbedded(self): return _embedded + def load(self, args): + """ + Load a simulation from the given arguments. + """ + self._queue.append(tc.CMD_LOAD) + self._string += struct.pack("!BB", 1 + 1 + 1 + 4 + sum(map(len, args)) + 4 * len(args), tc.CMD_LOAD) + self._packStringList(args) + self._sendExact() + def simulationStep(self, step=0): """ Make a simulation step and simulate up to the given millisecond in sim time. If the given value is 0 or absent, exactly one step is performed. Values smaller than or equal to the current sim time result in no action. """ - self._queue.append(tc.CMD_SIMSTEP2) + self._queue.append(tc.CMD_SIMSTEP) self._string += struct.pack("!BBi", 1 + - 1 + 4, tc.CMD_SIMSTEP2, step) + 1 + 4, tc.CMD_SIMSTEP, step) result = self._sendExact() for subscriptionResults in self._subscriptionMapping.values(): subscriptionResults.reset() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/constants.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/constants.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/constants.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/constants.py 2017-07-23 16:22:03.000000000 +0000 @@ -1,13 +1,13 @@ """ @file constants.py @author generated by "rebuildConstants.py" -@date 2016-10-26 10:23:38.871741 -@version $Id: constants.py 21851 2016-10-31 12:20:12Z behrisch $ +@date 2017-04-04 13:05:34.756653 +@version $Id: constants.py 24028 2017-04-24 05:10:18Z behrisch $ This script contains TraCI constant definitions from /src/traci-server/TraCIConstants.h. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -20,8 +20,7 @@ # **************************************** # VERSION # **************************************** -TRACI_VERSION = 13 - +TRACI_VERSION = 15 # **************************************** # COMMANDS @@ -29,8 +28,11 @@ # command: get version CMD_GETVERSION = 0x00 +# command: load +CMD_LOAD = 0x01 + # command: simulation step -CMD_SIMSTEP2 = 0x02 +CMD_SIMSTEP = 0x02 # command: stop node CMD_STOP = 0x12 @@ -68,17 +70,17 @@ RESPONSE_SUBSCRIBE_INDUCTIONLOOP_VARIABLE = 0xe0 # command: subscribe multi-entry/multi-exit detector (e3) context -CMD_SUBSCRIBE_MULTI_ENTRY_EXIT_DETECTOR_CONTEXT = 0x81 +CMD_SUBSCRIBE_MULTIENTRYEXIT_CONTEXT = 0x81 # response: subscribe multi-entry/multi-exit detector (e3) context -RESPONSE_SUBSCRIBE_MULTI_ENTRY_EXIT_DETECTOR_CONTEXT = 0x91 +RESPONSE_SUBSCRIBE_MULTIENTRYEXIT_CONTEXT = 0x91 # command: get multi-entry/multi-exit detector (e3) variable -CMD_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE = 0xa1 +CMD_GET_MULTIENTRYEXIT_VARIABLE = 0xa1 # response: get multi-entry/multi-exit detector (e3) variable -RESPONSE_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE = 0xb1 +RESPONSE_GET_MULTIENTRYEXIT_VARIABLE = 0xb1 # command: subscribe multi-entry/multi-exit detector (e3) variable -CMD_SUBSCRIBE_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE = 0xd1 +CMD_SUBSCRIBE_MULTIENTRYEXIT_VARIABLE = 0xd1 # response: subscribe multi-entry/multi-exit detector (e3) variable -RESPONSE_SUBSCRIBE_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE = 0xe1 +RESPONSE_SUBSCRIBE_MULTIENTRYEXIT_VARIABLE = 0xe1 # command: subscribe traffic lights context CMD_SUBSCRIBE_TL_CONTEXT = 0x82 @@ -246,17 +248,17 @@ RESPONSE_SUBSCRIBE_GUI_VARIABLE = 0xec # command: subscribe areal detector (e2) context -CMD_SUBSCRIBE_AREAL_DETECTOR_CONTEXT = 0x8d +CMD_SUBSCRIBE_LANEAREA_CONTEXT = 0x8d # response: subscribe areal detector (e2) context -RESPONSE_SUBSCRIBE_AREAL_DETECTOR_CONTEXT = 0x9d +RESPONSE_SUBSCRIBE_LANEAREA_CONTEXT = 0x9d # command: get areal detector (e2) variable -CMD_GET_AREAL_DETECTOR_VARIABLE = 0xad +CMD_GET_LANEAREA_VARIABLE = 0xad # response: get areal detector (e2) variable -RESPONSE_GET_AREAL_DETECTOR_VARIABLE = 0xbd +RESPONSE_GET_LANEAREA_VARIABLE = 0xbd # command: subscribe areal detector (e2) variable -CMD_SUBSCRIBE_AREAL_DETECTOR_VARIABLE = 0xdd +CMD_SUBSCRIBE_LANEAREA_VARIABLE = 0xdd # response: subscribe areal detector (e2) variable -RESPONSE_SUBSCRIBE_AREAL_DETECTOR_VARIABLE = 0xed +RESPONSE_SUBSCRIBE_LANEAREA_VARIABLE = 0xed # command: subscribe person context CMD_SUBSCRIBE_PERSON_CONTEXT = 0x8e @@ -375,13 +377,42 @@ # **************************************** # PERSON/CONTAINER STAGES # **************************************** +# person / container stopping +STAGE_WAITING_FOR_DEPART = 0x00 +# person / container stopping +STAGE_WAITING = 0x01 # person walking / container transhiping -STAGE_WALKING = 0x00 +STAGE_WALKING = 0x02 # person riding / container being transported -STAGE_DRIVING = 0x01 -# person / container stopping -STAGE_WAITING = 0x02 +STAGE_DRIVING = 0x03 +# **************************************** +# Stop Flags +# **************************************** +STOP_DEFAULT = 0x00 +STOP_PARKING = 0x01 +STOP_TRIGGERED = 0x02 +STOP_CONTAINER_TRIGGERED = 0x04 +STOP_BUS_STOP = 0x08 +STOP_CONTAINER_STOP = 0x10 +STOP_CHARGING_STATION = 0x20 +STOP_PARKING_AREA = 0x40 + +# **************************************** +# Departure Flags +# **************************************** +DEPARTFLAG_TRIGGERED = -0x01 +DEPARTFLAG_CONTAINER_TRIGGERED = -0x02 +DEPARTFLAG_NOW = -0x03 + +DEPARTFLAG_SPEED_RANDOM = -0x02 +DEPARTFLAG_SPEED_MAX = -0x03 + +DEPARTFLAG_LANE_RANDOM = -0x02 +DEPARTFLAG_LANE_FREE = -0x03 +DEPARTFLAG_LANE_ALLOWED_FREE = -0x04 +DEPARTFLAG_LANE_BEST_FREE = -0x05 +DEPARTFLAG_LANE_FIRST_ALLOWED = -0x06 # **************************************** # VARIABLE TYPES (for CMD_GET_*_VARIABLE) @@ -401,23 +432,19 @@ # generic attributes (get/set: all) GENERIC_ATTRIBUTE = 0x03 -# last step vehicle number (get: induction loops, multi-entry/multi-exit -# detector, lanes, edges) +# last step vehicle number (get: induction loops, multi-entry/multi-exit detector, lanes, edges) LAST_STEP_VEHICLE_NUMBER = 0x10 -# last step vehicle number (get: induction loops, multi-entry/multi-exit -# detector, lanes, edges) +# last step vehicle number (get: induction loops, multi-entry/multi-exit detector, lanes, edges) LAST_STEP_MEAN_SPEED = 0x11 -# last step vehicle list (get: induction loops, multi-entry/multi-exit -# detector, lanes, edges) +# last step vehicle list (get: induction loops, multi-entry/multi-exit detector, lanes, edges) LAST_STEP_VEHICLE_ID_LIST = 0x12 # last step occupancy (get: induction loops, lanes, edges) LAST_STEP_OCCUPANCY = 0x13 -# last step vehicle halting number (get: multi-entry/multi-exit detector, -# lanes, edges) +# last step vehicle halting number (get: multi-entry/multi-exit detector, lanes, edges) LAST_STEP_VEHICLE_HALTING_NUMBER = 0x14 # last step mean vehicle length (get: induction loops, lanes, edges) @@ -607,7 +634,7 @@ VAR_SPEEDSETMODE = 0xb3 # move vehicle, VTD version (set: vehicle) -VAR_MOVE_TO_VTD = 0xb4 +MOVE_TO_XY = 0xb4 # is the vehicle stopped, and if so parked and/or triggered? # value = stopped + 2 * parking + 4 * triggered @@ -616,12 +643,10 @@ # how lane changing is performed (set: vehicle) VAR_LANECHANGE_MODE = 0xb6 -# maximum speed regarding max speed on the current lane and speed factor -# (get: vehicle) +# maximum speed regarding max speed on the current lane and speed factor (get: vehicle) VAR_ALLOWED_SPEED = 0xb7 -# position (1D lateral position relative to center of the current lane) -# (get: vehicle) +# position (1D lateral position relative to center of the current lane) (get: vehicle) VAR_LANEPOSITION_LAT = 0xb8 # get/set prefered lateral alignment within the lane (vehicle) @@ -636,6 +661,12 @@ # get/set vehicle height (vehicle, vtypes) VAR_HEIGHT = 0xbc +# get/set vehicle line +VAR_LINE = 0xbd + +# get/set vehicle via +VAR_VIA = 0xbe + # current CO2 emission of a node (get: vehicle, lane, edge) VAR_CO2EMISSION = 0x60 @@ -754,10 +785,10 @@ VAR_PARAMETER = 0x7e -# add an instance (poi, polygon, vehicle, route) +# add an instance (poi, polygon, vehicle, person, route) ADD = 0x80 -# remove an instance (poi, polygon, vehicle) +# remove an instance (poi, polygon, vehicle, person) REMOVE = 0x81 # convert coordinates @@ -784,12 +815,20 @@ # retrieve information regarding the current person/container stage VAR_STAGE = 0xc0 -# retrieve information regarding the next edge including crossings and -# walkingAreas (pedestrians only) +# retrieve information regarding the next edge including crossings and walkingAreas (pedestrians only) VAR_NEXT_EDGE = 0xc1 -# retrieve the number of stages (person, container) -VAR_NUM_STAGES = 0xc2 +# retrieve information regarding the number of remaining stages +VAR_STAGES_REMAINING = 0xc2 + +# retrieve the current vehicle id for the driving stage (person, container) +VAR_VEHICLE = 0xc3 + +# append a person stage (person) +APPEND_STAGE = 0xc4 + +# append a person stage (person) +REMOVE_STAGE = 0xc5 # zoom VAR_VIEW_ZOOM = 0xa0 @@ -808,3 +847,66 @@ # track vehicle VAR_TRACK_VEHICLE = 0xa6 + + +#/ @name currently wanted lane-change action +#/ @{ +#/ @brief No action desired +LCA_NONE = 0 +#/ @brief Needs to stay on the current lane +LCA_STAY = 1 << 0 +#/ @brief Wants go to the left +LCA_LEFT = 1 << 1 +#/ @brief Wants go to the right +LCA_RIGHT = 1 << 2 +#/ @brief The action is needed to follow the route (navigational lc) +LCA_STRATEGIC = 1 << 3 +#/ @brief The action is done to help someone else +LCA_COOPERATIVE = 1 << 4 +#/ @brief The action is due to the wish to be faster (tactical lc) +LCA_SPEEDGAIN = 1 << 5 +#/ @brief The action is due to the default of keeping right "Rechtsfahrgebot" +LCA_KEEPRIGHT = 1 << 6 +#/ @brief The action is due to a TraCI request +LCA_TRACI = 1 << 7 +#/ @brief The action is urgent (to be defined by lc-model) +LCA_URGENT = 1 << 8 +#/ @brief The action has not been determined +LCA_UNKNOWN = 1 << 30 +#/ @} + +#/ @name External state +#/ @{ +#/ @brief The vehicle is blocked by left leader +LCA_BLOCKED_BY_LEFT_LEADER = 1 << 9 +#/ @brief The vehicle is blocked by left follower +LCA_BLOCKED_BY_LEFT_FOLLOWER = 1 << 10 +#/ @brief The vehicle is blocked by right leader +LCA_BLOCKED_BY_RIGHT_LEADER = 1 << 11 +#/ @brief The vehicle is blocked by right follower +LCA_BLOCKED_BY_RIGHT_FOLLOWER = 1 << 12 +#/ @brief The vehicle is blocked being overlapping +LCA_OVERLAPPING = 1 << 13 +#/ @brief The vehicle does not have enough space to complete a continuous lane and change before the next turning movement +LCA_INSUFFICIENT_SPACE = 1 << 14 +#/ @brief used by the sublane model +LCA_SUBLANE = 1 << 15 +#/ @brief lane can change +LCA_WANTS_LANECHANGE = LCA_LEFT | LCA_RIGHT +#/ @brief lane can change or stay +LCA_WANTS_LANECHANGE_OR_STAY = LCA_WANTS_LANECHANGE | LCA_STAY +#/ @brief blocked left +LCA_BLOCKED_LEFT = LCA_BLOCKED_BY_LEFT_LEADER | LCA_BLOCKED_BY_LEFT_FOLLOWER +#/ @brief blocked right +LCA_BLOCKED_RIGHT = LCA_BLOCKED_BY_RIGHT_LEADER | LCA_BLOCKED_BY_RIGHT_FOLLOWER +#/ @brief blocked by leader +LCA_BLOCKED_BY_LEADER = LCA_BLOCKED_BY_LEFT_LEADER | LCA_BLOCKED_BY_RIGHT_LEADER +#/ @brief blocker by follower +LCA_BLOCKED_BY_FOLLOWER = LCA_BLOCKED_BY_LEFT_FOLLOWER | LCA_BLOCKED_BY_RIGHT_FOLLOWER +#/ @brief blocked in all directions +LCA_BLOCKED = LCA_BLOCKED_LEFT | LCA_BLOCKED_RIGHT | LCA_INSUFFICIENT_SPACE +#/ @brief reasons of lane change +LCA_CHANGE_REASONS = (LCA_STRATEGIC | LCA_COOPERATIVE | LCA_SPEEDGAIN | LCA_KEEPRIGHT | LCA_SUBLANE) +# LCA_BLOCKED_BY_CURRENT_LEADER = 1 << 28 +# LCA_BLOCKED_BY_CURRENT_FOLLOWER = 1 << 29 +#/ @} diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/domain.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/domain.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/domain.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/domain.py 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ @author Daniel Krajzewicz @author Jakob Erdmann @date 2008-10-09 -@version $Id: domain.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: domain.py 23504 2017-03-17 11:21:32Z luecken $ Python implementation of the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -24,6 +24,7 @@ from __future__ import absolute_import import copy import struct +import warnings import traci from . import constants as tc @@ -54,7 +55,7 @@ self._results[refID][varID] = self._parse(varID, data) def get(self, refID=None): - if refID == None: + if refID is None: return self._results return self._results.get(refID, None) @@ -63,12 +64,12 @@ self._contextResults[refID] = {} if objID not in self._contextResults[refID]: self._contextResults[refID][objID] = {} - if varID != None and data != None: + if varID is not None and data is not None: self._contextResults[refID][objID][ varID] = domain._parse(varID, data) def getContext(self, refID=None): - if refID == None: + if refID is None: return self._contextResults return self._contextResults.get(refID, None) @@ -81,7 +82,7 @@ def __init__(self, name, cmdGetID, cmdSetID, subscribeID, subscribeResponseID, contextID, contextResponseID, - retValFunc): + retValFunc, deprecatedFor=None): self._name = name self._cmdGetID = cmdGetID self._cmdSetID = cmdSetID @@ -92,6 +93,7 @@ self._retValFunc = {tc.ID_LIST: Storage.readStringList, tc.ID_COUNT: Storage.readInt} self._retValFunc.update(retValFunc) + self._deprecatedFor = deprecatedFor self._connection = None _defaultDomains.append(self) setattr(traci, name, self) @@ -109,6 +111,9 @@ self._connection = connection def _getUniversal(self, varID, objectID=""): + if self._deprecatedFor: + warnings.warn("The domain %s is deprecated, use %s instead." % ( + self._name, self._deprecatedFor)) # , DeprecationWarning) result = self._connection._sendReadOneStringCmd( self._cmdGetID, varID, objectID) return self._retValFunc[varID](result) @@ -140,6 +145,14 @@ self._connection._subscribe( self._subscribeID, begin, end, objectID, varIDs) + def unsubscribe(self, objectID): + """unsubscribe(string) -> None + + Unsubscribe from receiving object values. + """ + self._connection._subscribe( + self._subscribeID, 0, 2**31 - 1, objectID, []) + def getSubscriptionResults(self, objectID=None): """getSubscriptionResults(string) -> dict(integer: ) @@ -153,6 +166,11 @@ return self._connection._getSubscriptionResults(self._subscribeResponseID).get(objectID) def subscribeContext(self, objectID, domain, dist, varIDs=None, begin=0, end=2**31 - 1): + """subscribeContext(string, int, double, list(integer), double, double) -> None + + Subscribe to objects of the given domain (specified as domain=traci.constants.CMD_GET__VARIABLE), + which are closer than dist to the object specified by objectID. + """ if varIDs is None: if tc.LAST_STEP_VEHICLE_NUMBER in self._retValFunc: varIDs = (tc.LAST_STEP_VEHICLE_NUMBER,) @@ -161,6 +179,10 @@ self._connection._subscribeContext( self._contextID, begin, end, objectID, domain, dist, varIDs) + def unsubscribeContext(self, objectID, domain, dist): + self._connection._subscribeContext( + self._contextID, 0, 2**31 - 1, objectID, domain, dist, []) + def getContextSubscriptionResults(self, objectID=None): return self._connection._getSubscriptionResults(self._contextResponseID).getContext(objectID) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_edge.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_edge.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_edge.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_edge.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Michael Behrisch @author Jakob Erdmann @date 2011-03-17 -@version $Id: _edge.py 21851 2016-10-31 12:20:12Z behrisch $ +@version $Id: _edge.py 23179 2017-03-02 08:32:15Z behrisch $ Python implementation of the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -30,22 +30,22 @@ return int(time * 1000) -_RETURN_VALUE_FUNC = {tc.VAR_EDGE_TRAVELTIME: Storage.readDouble, - tc.VAR_WAITING_TIME: Storage.readDouble, - tc.VAR_EDGE_EFFORT: Storage.readDouble, - tc.VAR_CO2EMISSION: Storage.readDouble, - tc.VAR_COEMISSION: Storage.readDouble, - tc.VAR_HCEMISSION: Storage.readDouble, - tc.VAR_PMXEMISSION: Storage.readDouble, - tc.VAR_NOXEMISSION: Storage.readDouble, - tc.VAR_FUELCONSUMPTION: Storage.readDouble, - tc.VAR_NOISEEMISSION: Storage.readDouble, +_RETURN_VALUE_FUNC = {tc.VAR_EDGE_TRAVELTIME: Storage.readDouble, + tc.VAR_WAITING_TIME: Storage.readDouble, + tc.VAR_EDGE_EFFORT: Storage.readDouble, + tc.VAR_CO2EMISSION: Storage.readDouble, + tc.VAR_COEMISSION: Storage.readDouble, + tc.VAR_HCEMISSION: Storage.readDouble, + tc.VAR_PMXEMISSION: Storage.readDouble, + tc.VAR_NOXEMISSION: Storage.readDouble, + tc.VAR_FUELCONSUMPTION: Storage.readDouble, + tc.VAR_NOISEEMISSION: Storage.readDouble, tc.VAR_ELECTRICITYCONSUMPTION: Storage.readDouble, - tc.LAST_STEP_MEAN_SPEED: Storage.readDouble, - tc.LAST_STEP_OCCUPANCY: Storage.readDouble, - tc.LAST_STEP_LENGTH: Storage.readDouble, - tc.VAR_CURRENT_TRAVELTIME: Storage.readDouble, - tc.LAST_STEP_VEHICLE_NUMBER: Storage.readInt, + tc.LAST_STEP_MEAN_SPEED: Storage.readDouble, + tc.LAST_STEP_OCCUPANCY: Storage.readDouble, + tc.LAST_STEP_LENGTH: Storage.readDouble, + tc.VAR_CURRENT_TRAVELTIME: Storage.readDouble, + tc.LAST_STEP_VEHICLE_NUMBER: Storage.readInt, tc.LAST_STEP_VEHICLE_HALTING_NUMBER: Storage.readInt, tc.LAST_STEP_VEHICLE_ID_LIST: Storage.readStringList, tc.LAST_STEP_PERSON_ID_LIST: Storage.readStringList, @@ -63,18 +63,18 @@ def getAdaptedTraveltime(self, edgeID, time): """getAdaptedTraveltime(string, double) -> double - Returns the travel time value (in s) used for (re-)routing + Returns the travel time value (in s) used for (re-)routing which is valid on the edge at the given time. """ self._connection._beginMessage(tc.CMD_GET_EDGE_VARIABLE, tc.VAR_EDGE_TRAVELTIME, edgeID, 1 + 4) self._connection._string += struct.pack( - "!Bi", tc.TYPE_INTEGER, _TIME2STEPS(time)) + "!Bi", tc.TYPE_INTEGER, time) return self._connection._checkResult(tc.CMD_GET_EDGE_VARIABLE, tc.VAR_EDGE_TRAVELTIME, edgeID).readDouble() def getWaitingTime(self, edgeID): - """getWaitingTime() -> double + """getWaitingTime() -> double Returns the sum of the waiting time of all vehicles currently on that edge (see traci.vehicle.getWaitingTime). """ @@ -83,13 +83,13 @@ def getEffort(self, edgeID, time): """getEffort(string, double) -> double - Returns the effort value used for (re-)routing + Returns the effort value used for (re-)routing which is valid on the edge at the given time. """ self._connection._beginMessage(tc.CMD_GET_EDGE_VARIABLE, tc.VAR_EDGE_EFFORT, edgeID, 1 + 4) self._connection._string += struct.pack( - "!Bi", tc.TYPE_INTEGER, _TIME2STEPS(time)) + "!Bi", tc.TYPE_INTEGER, time) return self._connection._checkResult(tc.CMD_GET_EDGE_VARIABLE, tc.VAR_EDGE_EFFORT, edgeID).readDouble() @@ -225,8 +225,8 @@ tc.CMD_SET_EDGE_VARIABLE, tc.VAR_EDGE_TRAVELTIME, edgeID, 1 + 4 + 1 + 4 + 1 + 4 + 1 + 8) self._connection._string += struct.pack("!BiBiBiBd", tc.TYPE_COMPOUND, 3, - tc.TYPE_INTEGER, 1000 * begin, - tc.TYPE_INTEGER, 1000 * end, + tc.TYPE_INTEGER, begin, + tc.TYPE_INTEGER, end, tc.TYPE_DOUBLE, time) self._connection._sendExact() else: @@ -252,8 +252,8 @@ tc.CMD_SET_EDGE_VARIABLE, tc.VAR_EDGE_EFFORT, edgeID, 1 + 4 + 1 + 4 + 1 + 4 + 1 + 8) self._connection._string += struct.pack("!BiBiBiBd", tc.TYPE_COMPOUND, 3, - tc.TYPE_INTEGER, 1000 * begin, - tc.TYPE_INTEGER, 1000 * end, + tc.TYPE_INTEGER, begin, + tc.TYPE_INTEGER, end, tc.TYPE_DOUBLE, effort) self._connection._sendExact() else: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/exceptions.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/exceptions.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/exceptions.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/exceptions.py 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ @author Daniel Krajzewicz @author Jakob Erdmann @date 2008-10-09 -@version $Id: exceptions.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: exceptions.py 22608 2017-01-17 06:28:54Z behrisch $ Python implementation of the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_gui.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_gui.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_gui.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_gui.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Michael Behrisch @author Daniel Krajzewicz @date 2011-03-09 -@version $Id: _gui.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: _gui.py 23179 2017-03-02 08:32:15Z behrisch $ Python implementation of the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -23,9 +23,9 @@ from .storage import Storage from . import constants as tc -_RETURN_VALUE_FUNC = {tc.VAR_VIEW_ZOOM: Storage.readDouble, +_RETURN_VALUE_FUNC = {tc.VAR_VIEW_ZOOM: Storage.readDouble, tc.VAR_VIEW_OFFSET: lambda result: result.read("!dd"), - tc.VAR_VIEW_SCHEMA: Storage.readString, + tc.VAR_VIEW_SCHEMA: Storage.readString, tc.VAR_VIEW_BOUNDARY: lambda result: (result.read("!dd"), result.read("!dd"))} @@ -107,7 +107,7 @@ """screenshot(string, string) -> None Save a screenshot for the given view to the given filename. - The fileformat is guessed from the extension, the available + The fileformat is guessed from the extension, the available formats differ from platform to platform but should at least include ps, svg and pdf, on linux probably gif, png and jpg as well. """ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_inductionloop.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_inductionloop.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_inductionloop.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_inductionloop.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Michael Behrisch @author Daniel Krajzewicz @date 2011-03-16 -@version $Id: _inductionloop.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: _inductionloop.py 23179 2017-03-02 08:32:15Z behrisch $ Python implementation of the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -41,15 +41,15 @@ data.append([vehID, length, entryTime, leaveTime, typeID]) return data -_RETURN_VALUE_FUNC = {tc.VAR_POSITION: Storage.readDouble, - tc.VAR_LANE_ID: Storage.readString, - tc.LAST_STEP_VEHICLE_NUMBER: Storage.readInt, - tc.LAST_STEP_MEAN_SPEED: Storage.readDouble, - tc.LAST_STEP_VEHICLE_ID_LIST: Storage.readStringList, - tc.LAST_STEP_OCCUPANCY: Storage.readDouble, - tc.LAST_STEP_LENGTH: Storage.readDouble, +_RETURN_VALUE_FUNC = {tc.VAR_POSITION: Storage.readDouble, + tc.VAR_LANE_ID: Storage.readString, + tc.LAST_STEP_VEHICLE_NUMBER: Storage.readInt, + tc.LAST_STEP_MEAN_SPEED: Storage.readDouble, + tc.LAST_STEP_VEHICLE_ID_LIST: Storage.readStringList, + tc.LAST_STEP_OCCUPANCY: Storage.readDouble, + tc.LAST_STEP_LENGTH: Storage.readDouble, tc.LAST_STEP_TIME_SINCE_DETECTION: Storage.readDouble, - tc.LAST_STEP_VEHICLE_DATA: readVehicleData} + tc.LAST_STEP_VEHICLE_DATA: readVehicleData} class InductionLoopDomain(Domain): diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ @author Daniel Krajzewicz @author Jakob Erdmann @date 2008-10-09 -@version $Id: __init__.py 21851 2016-10-31 12:20:12Z behrisch $ +@version $Id: __init__.py 23953 2017-04-16 16:19:38Z behrisch $ Python implementation of the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -25,16 +25,19 @@ import socket import time import subprocess +import warnings +import abc import sumolib from .domain import _defaultDomains from .connection import Connection, _embedded from .exceptions import FatalTraCIError, TraCIException -from . import _inductionloop, _multientryexit, _trafficlights -from . import _lane, _vehicle, _vehicletype, _person, _route, _areal +from . import _inductionloop, _lanearea, _multientryexit, _trafficlights +from . import _lane, _vehicle, _vehicletype, _person, _route from . import _poi, _polygon, _junction, _edge, _simulation, _gui _connections = {} +_stepListeners = [] def _STEPS2TIME(step): @@ -89,13 +92,51 @@ return _embedded +def load(args): + """ + Let sumo load a simulation using the given command line like options. + """ + return _connections[""].load(args) + + def simulationStep(step=0): """ Make a simulation step and simulate up to the given millisecond in sim time. If the given value is 0 or absent, exactly one step is performed. Values smaller than or equal to the current sim time result in no action. """ - return _connections[""].simulationStep(step) + global _stepListeners + responses = _connections[""].simulationStep(step) + for listener in _stepListeners: + listener.step(step) + return responses + + +class StepListener(object): + __metaclass__ = abc.ABCMeta + + @abc.abstractmethod + def step(self, s=0): + """step(int) -> None + + After adding a StepListener 'listener' with traci.addStepListener(listener), + TraCI will call listener.step(s) after each call to traci.simulationStep(s) + """ + pass + + +def addStepListener(listener): + """addStepListener(traci.StepListener) -> bool + + Append the step listener (its step function is called at the end of every call to traci.simulationStep()) + Returns True if the listener was added successfully, False otherwise. + """ + if issubclass(type(listener), StepListener): + _stepListeners.append(listener) + return True + warnings.warn( + "Proposed listener's type must inherit from traci.StepListener. Not adding object of type '%s'" % type(listener)) + return False def getVersion(): diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_junction.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_junction.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_junction.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_junction.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,12 +5,12 @@ @author Mario Krumnow @author Jakob Erdmann @date 2011-03-17 -@version $Id: _junction.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: _junction.py 23179 2017-03-02 08:32:15Z behrisch $ Python implementation of the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -24,7 +24,7 @@ from . import constants as tc _RETURN_VALUE_FUNC = {tc.VAR_POSITION: lambda result: result.read("!dd"), - tc.VAR_SHAPE: Storage.readShape} + tc.VAR_SHAPE: Storage.readShape} class JunctionDomain(Domain): diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_lanearea.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_lanearea.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_lanearea.py 1970-01-01 00:00:00.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_lanearea.py 2017-07-23 16:22:03.000000000 +0000 @@ -0,0 +1,118 @@ +# -*- coding: utf-8 -*- +""" +@file _lanearea.py +@author Mario Krumnow +@author Laura Bieker +@date 2011-03-16 +@version $Id: _lanearea.py 24029 2017-04-24 07:15:22Z behrisch $ + +Python implementation of the TraCI interface. + +SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors + +This file is part of SUMO. +SUMO is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. +""" +from __future__ import absolute_import +import struct +from . import constants as tc +from .domain import Domain +from .storage import Storage + +_RETURN_VALUE_FUNC = {tc.JAM_LENGTH_METERS: Storage.readDouble, + tc.JAM_LENGTH_VEHICLE: Storage.readInt, + tc.LAST_STEP_MEAN_SPEED: Storage.readDouble, + tc.VAR_POSITION: Storage.readDouble, + tc.VAR_LENGTH: Storage.readDouble, + tc.VAR_LANE_ID: Storage.readString, + tc.LAST_STEP_VEHICLE_ID_LIST: Storage.readStringList, + tc.LAST_STEP_VEHICLE_NUMBER: Storage.readInt, + tc.LAST_STEP_OCCUPANCY: Storage.readDouble, + tc.LAST_STEP_VEHICLE_HALTING_NUMBER: Storage.readInt} + + +class LaneAreaDomain(Domain): + + def __init__(self, name="lanearea", deprecatedFor=None): + Domain.__init__(self, name, tc.CMD_GET_LANEAREA_VARIABLE, None, + tc.CMD_SUBSCRIBE_LANEAREA_VARIABLE, tc.RESPONSE_SUBSCRIBE_LANEAREA_VARIABLE, + tc.CMD_SUBSCRIBE_LANEAREA_CONTEXT, tc.RESPONSE_SUBSCRIBE_LANEAREA_CONTEXT, + _RETURN_VALUE_FUNC, deprecatedFor) + + def getJamLengthVehicle(self, detID): + """getJamLengthVehicle(string) -> integer + + Returns the jam length in vehicles within the last simulation step. + """ + return self._getUniversal(tc.JAM_LENGTH_VEHICLE, detID) + + def getJamLengthMeters(self, detID): + """getJamLengthMeters(string) -> double + + Returns the jam length in meters within the last simulation step. + """ + return self._getUniversal(tc.JAM_LENGTH_METERS, detID) + + def getLastStepMeanSpeed(self, detID): + """getLastStepMeanSpeed(string) -> double + + Returns the current mean speed in m/s of vehicles that were on the named e2. + """ + return self._getUniversal(tc.LAST_STEP_MEAN_SPEED, detID) + + def getLastStepVehicleIDs(self, detID): + """getLastStepVehicleIDs(string) -> list(string) + + Returns the list of ids of vehicles that were on the named detector in the last simulation step. + """ + return self._getUniversal(tc.LAST_STEP_VEHICLE_ID_LIST, detID) + + def getLastStepOccupancy(self, detID): + """getLastStepMeanSpeed(string) -> double + + Returns the percentage of space the detector was occupied by a vehicle [%] + """ + return self._getUniversal(tc.LAST_STEP_OCCUPANCY, detID) + + def getPosition(self, detID): + """getPosition(string) -> double + + Returns the starting position of the detector measured from the beginning of the lane in meters. + """ + return self._getUniversal(tc.VAR_POSITION, detID) + + def getLaneID(self, detID): + """getLaneID(string) -> string + + Returns the id of the lane the detector is on. + """ + return self._getUniversal(tc.VAR_LANE_ID, detID) + + def getLength(self, detID): + """getLength(string) -> double + + Returns the length of the detector + """ + return self._getUniversal(tc.VAR_LENGTH, detID) + + def getLastStepVehicleNumber(self, detID): + """getLastStepVehicleNumber(string) -> integer + + Returns the number of vehicles that were on the named detector within the last simulation step. + """ + return self._getUniversal(tc.LAST_STEP_VEHICLE_NUMBER, detID) + + def getLastStepHaltingNumber(self, detID): + """getLastStepHaltingNumber(string) -> integer + + Returns the number of vehicles which were halting during the last time step. + """ + return self._getUniversal(tc.LAST_STEP_VEHICLE_HALTING_NUMBER, detID) + + +LaneAreaDomain() +LaneAreaDomain("areal", "lanearea") diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_lane.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_lane.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_lane.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_lane.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Laura Bieker @author Jakob Erdmann @date 2011-03-17 -@version $Id: _lane.py 21105 2016-07-04 12:48:27Z behrisch $ +@version $Id: _lane.py 23179 2017-03-02 08:32:15Z behrisch $ Python implementation of the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -52,29 +52,29 @@ return links -_RETURN_VALUE_FUNC = {tc.VAR_LENGTH: Storage.readDouble, - tc.VAR_MAXSPEED: Storage.readDouble, - tc.VAR_WIDTH: Storage.readDouble, - tc.LANE_ALLOWED: Storage.readStringList, - tc.LANE_DISALLOWED: Storage.readStringList, +_RETURN_VALUE_FUNC = {tc.VAR_LENGTH: Storage.readDouble, + tc.VAR_MAXSPEED: Storage.readDouble, + tc.VAR_WIDTH: Storage.readDouble, + tc.LANE_ALLOWED: Storage.readStringList, + tc.LANE_DISALLOWED: Storage.readStringList, tc.LANE_LINK_NUMBER: lambda result: result.read("!B")[0], - tc.LANE_LINKS: _readLinks, - tc.VAR_SHAPE: Storage.readShape, - tc.LANE_EDGE_ID: Storage.readString, - tc.VAR_CO2EMISSION: Storage.readDouble, - tc.VAR_COEMISSION: Storage.readDouble, - tc.VAR_HCEMISSION: Storage.readDouble, - tc.VAR_PMXEMISSION: Storage.readDouble, - tc.VAR_NOXEMISSION: Storage.readDouble, - tc.VAR_FUELCONSUMPTION: Storage.readDouble, - tc.VAR_NOISEEMISSION: Storage.readDouble, + tc.LANE_LINKS: _readLinks, + tc.VAR_SHAPE: Storage.readShape, + tc.LANE_EDGE_ID: Storage.readString, + tc.VAR_CO2EMISSION: Storage.readDouble, + tc.VAR_COEMISSION: Storage.readDouble, + tc.VAR_HCEMISSION: Storage.readDouble, + tc.VAR_PMXEMISSION: Storage.readDouble, + tc.VAR_NOXEMISSION: Storage.readDouble, + tc.VAR_FUELCONSUMPTION: Storage.readDouble, + tc.VAR_NOISEEMISSION: Storage.readDouble, tc.VAR_ELECTRICITYCONSUMPTION: Storage.readDouble, - tc.LAST_STEP_MEAN_SPEED: Storage.readDouble, - tc.LAST_STEP_OCCUPANCY: Storage.readDouble, - tc.LAST_STEP_LENGTH: Storage.readDouble, - tc.VAR_WAITING_TIME: Storage.readDouble, - tc.VAR_CURRENT_TRAVELTIME: Storage.readDouble, - tc.LAST_STEP_VEHICLE_NUMBER: Storage.readInt, + tc.LAST_STEP_MEAN_SPEED: Storage.readDouble, + tc.LAST_STEP_OCCUPANCY: Storage.readDouble, + tc.LAST_STEP_LENGTH: Storage.readDouble, + tc.VAR_WAITING_TIME: Storage.readDouble, + tc.VAR_CURRENT_TRAVELTIME: Storage.readDouble, + tc.LAST_STEP_VEHICLE_NUMBER: Storage.readInt, tc.LAST_STEP_VEHICLE_HALTING_NUMBER: Storage.readInt, tc.LAST_STEP_VEHICLE_ID_LIST: Storage.readStringList} @@ -134,7 +134,7 @@ A list containing id of successor lane together with priority, open and foe for each link. if extended=True, each result tuple contains - (string approachedLane, bool hasPrio, bool isOpen, bool hasFoe, + (string approachedLane, bool hasPrio, bool isOpen, bool hasFoe, string approachedInternal, string state, string direction, float length) """ complete_data = self._getUniversal(tc.LANE_LINKS, laneID) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_multientryexit.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_multientryexit.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_multientryexit.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_multientryexit.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file multientryexit.py @author Michael Behrisch @date 2011-03-16 -@version $Id: _multientryexit.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: _multientryexit.py 24029 2017-04-24 07:15:22Z behrisch $ Python implementation of the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -21,18 +21,18 @@ from .storage import Storage from . import constants as tc -_RETURN_VALUE_FUNC = {tc.LAST_STEP_VEHICLE_NUMBER: Storage.readInt, - tc.LAST_STEP_MEAN_SPEED: Storage.readDouble, - tc.LAST_STEP_VEHICLE_ID_LIST: Storage.readStringList, +_RETURN_VALUE_FUNC = {tc.LAST_STEP_VEHICLE_NUMBER: Storage.readInt, + tc.LAST_STEP_MEAN_SPEED: Storage.readDouble, + tc.LAST_STEP_VEHICLE_ID_LIST: Storage.readStringList, tc.LAST_STEP_VEHICLE_HALTING_NUMBER: Storage.readInt} class MultiEntryExitDomain(Domain): def __init__(self): - Domain.__init__(self, "multientryexit", tc.CMD_GET_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE, None, - tc.CMD_SUBSCRIBE_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE, tc.RESPONSE_SUBSCRIBE_MULTI_ENTRY_EXIT_DETECTOR_VARIABLE, - tc.CMD_SUBSCRIBE_MULTI_ENTRY_EXIT_DETECTOR_CONTEXT, tc.RESPONSE_SUBSCRIBE_MULTI_ENTRY_EXIT_DETECTOR_CONTEXT, + Domain.__init__(self, "multientryexit", tc.CMD_GET_MULTIENTRYEXIT_VARIABLE, None, + tc.CMD_SUBSCRIBE_MULTIENTRYEXIT_VARIABLE, tc.RESPONSE_SUBSCRIBE_MULTIENTRYEXIT_VARIABLE, + tc.CMD_SUBSCRIBE_MULTIENTRYEXIT_CONTEXT, tc.RESPONSE_SUBSCRIBE_MULTIENTRYEXIT_CONTEXT, _RETURN_VALUE_FUNC) def getLastStepVehicleNumber(self, detID): @@ -45,7 +45,7 @@ def getLastStepMeanSpeed(self, detID): """getLastStepMeanSpeed(string) -> double - Returns the mean speed in m/s of vehicles that have been within the named multi-entry/multi-exit detector within the last simulation step. + Returns the mean speed in m/s of vehicles that have been within the named multi-entry/multi-exit detector within the last simulation step. """ return self._getUniversal(tc.LAST_STEP_MEAN_SPEED, detID) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_person.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_person.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_person.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_person.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file person.py @author Jakob Erdmann @date 2015-02-06 -@version $Id: _person.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: _person.py 23179 2017-03-02 08:32:15Z behrisch $ Python implementation of the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -23,25 +23,30 @@ from . import constants as tc -_RETURN_VALUE_FUNC = {tc.ID_LIST: Storage.readStringList, - tc.ID_COUNT: Storage.readInt, - tc.VAR_SPEED: Storage.readDouble, +_RETURN_VALUE_FUNC = {tc.ID_LIST: Storage.readStringList, + tc.ID_COUNT: Storage.readInt, + tc.VAR_SPEED: Storage.readDouble, tc.VAR_POSITION: lambda result: result.read("!dd"), - tc.VAR_ANGLE: Storage.readDouble, - tc.VAR_ROAD_ID: Storage.readString, - tc.VAR_TYPE: Storage.readString, - tc.VAR_ROUTE_ID: Storage.readString, + tc.VAR_ANGLE: Storage.readDouble, + tc.VAR_ROAD_ID: Storage.readString, + tc.VAR_TYPE: Storage.readString, + tc.VAR_ROUTE_ID: Storage.readString, tc.VAR_COLOR: lambda result: result.read("!BBBB"), - tc.VAR_LANEPOSITION: Storage.readDouble, - tc.VAR_LENGTH: Storage.readDouble, - tc.VAR_WAITING_TIME: Storage.readDouble, - tc.VAR_WIDTH: Storage.readDouble, - tc.VAR_MINGAP: Storage.readDouble, - tc.VAR_NEXT_EDGE: Storage.readString, + tc.VAR_LANEPOSITION: Storage.readDouble, + tc.VAR_LENGTH: Storage.readDouble, + tc.VAR_WAITING_TIME: Storage.readDouble, + tc.VAR_WIDTH: Storage.readDouble, + tc.VAR_MINGAP: Storage.readDouble, + tc.VAR_NEXT_EDGE: Storage.readString, + tc.VAR_STAGE: Storage.readInt, + tc.VAR_STAGES_REMAINING: Storage.readInt, + tc.VAR_VEHICLE: Storage.readString, + tc.VAR_EDGES: Storage.readStringList, } class PersonDomain(Domain): + DEPART_NOW = -3 def __init__(self): Domain.__init__(self, "person", tc.CMD_GET_PERSON_VARIABLE, tc.CMD_SET_PERSON_VARIABLE, @@ -64,7 +69,7 @@ return self._getUniversal(tc.VAR_POSITION, personID) def getPosition3D(self, personID): - """getPosition(string) -> (double, double) + """getPosition(string) -> (double, double, double) Returns the position of the named person within the last step [m,m,m]. """ @@ -73,7 +78,7 @@ def getAngle(self, personID): """getAngle(string) -> double - Returns the angle in degrees of the named person within the last step. + Returns the angle in degrees of the named person within the last step. """ return self._getUniversal(tc.VAR_ANGLE, personID) @@ -116,7 +121,7 @@ """getWaitingTime() -> double The waiting time of a person is defined as the time (in seconds) spent with a speed below 0.1m/s since the last time it was faster than 0.1m/s. - (basically, the waiting time of a person is reset to 0 every time it moves). + (basically, the waiting time of a person is reset to 0 every time it moves). """ return self._getUniversal(tc.VAR_WAITING_TIME, personID) @@ -142,5 +147,224 @@ """ return self._getUniversal(tc.VAR_NEXT_EDGE, personID) + def getEdges(self, personID, nextStageIndex=0): + """getEdges(string, int) -> list(string) + + Returns a list of all edges in the nth next stage. + For waiting stages this is a single edge + For walking stages this is the complete route + For driving stages this is [origin, destination] + + nextStageIndex 0 retrieves value for the current stage. + nextStageIndex must be lower then value of getRemainingStages(personID) + """ + self._connection._beginMessage( + tc.CMD_GET_PERSON_VARIABLE, tc.VAR_EDGES, personID, 1 + 4) + self._connection._string += struct.pack("!Bi", + tc.TYPE_INTEGER, nextStageIndex) + return self._connection._checkResult(tc.CMD_GET_PERSON_VARIABLE, + tc.VAR_EDGES, personID).readStringList() + + def getStage(self, personID, nextStageIndex=0): + """getStage(string, int) -> int + Returns the type of the nth next stage + 0 for not-yet-departed + 1 for waiting + 2 for walking + 3 for driving + nextStageIndex 0 retrieves value for the current stage. + nextStageIndex must be lower then value of getRemainingStages(personID) + """ + self._connection._beginMessage( + tc.CMD_GET_PERSON_VARIABLE, tc.VAR_STAGE, personID, 1 + 4) + self._connection._string += struct.pack("!Bi", + tc.TYPE_INTEGER, nextStageIndex) + return self._connection._checkResult(tc.CMD_GET_PERSON_VARIABLE, + tc.VAR_STAGE, personID).readInt() + + def getRemainingStages(self, personID): + """getStage(string) -> int + Returns the number of remaining stages (at least 1) + """ + return self._getUniversal(tc.VAR_STAGES_REMAINING, personID) + + def getVehicle(self, personID): + """getVehicle(string) -> string + Returns the id of the current vehicle if the person is in stage driving + and has entered a vehicle. + Return the empty string otherwise + """ + return self._getUniversal(tc.VAR_VEHICLE, personID) + + def removeStages(self, personID): + """remove(string) + Removes all stages of the person. If no new phases are appended, + the person will be removed from the simulation in the next simulationStep(). + """ + # remove all stages after the current and then abort the current stage + while self.getRemainingStages(personID) > 1: + self.removeStage(personID, 1) + self.removeStage(personID, 0) + + def add(self, personID, edgeID, pos, depart=DEPART_NOW, typeID="DEFAULT_PEDTYPE"): + """add(string, string, double, int, string) + Inserts a new person to the simulation at the given edge, position and + time (in s). This function should be followed by appending Stages or the person + will immediatly vanish on departure. + """ + if depart > 0: + depart *= 1000 + self._connection._beginMessage(tc.CMD_SET_PERSON_VARIABLE, tc.ADD, personID, + 1 + 4 + 1 + 4 + len(typeID) + 1 + 4 + len(edgeID) + 1 + 4 + 1 + 8) + self._connection._string += struct.pack("!Bi", tc.TYPE_COMPOUND, 4) + self._connection._packString(typeID) + self._connection._packString(edgeID) + self._connection._string += struct.pack("!Bi", tc.TYPE_INTEGER, depart) + self._connection._string += struct.pack("!Bd", tc.TYPE_DOUBLE, pos) + self._connection._sendExact() + + def appendWaitingStage(self, personID, duration, description="waiting", stopID=""): + """appendWaitingStage(string, int, string, string) + Appends a waiting stage with duration in s to the plan of the given person + """ + duration *= 1000 + self._connection._beginMessage(tc.CMD_SET_PERSON_VARIABLE, tc.APPEND_STAGE, personID, + 1 + 4 # compound + + 1 + 4 # stage type + + 1 + 4 # duration + + 1 + 4 + len(description) + + 1 + 4 + len(stopID)) + self._connection._string += struct.pack("!Bi", tc.TYPE_COMPOUND, 4) + self._connection._string += struct.pack( + "!Bi", tc.TYPE_INTEGER, tc.STAGE_WAITING) + self._connection._string += struct.pack("!Bi", + tc.TYPE_INTEGER, duration) + self._connection._packString(description) + self._connection._packString(stopID) + self._connection._sendExact() + + def appendWalkingStage(self, personID, edges, arrivalPos, duration=-1, speed=-1, stopID=""): + """appendWalkingStage(string, stringList, double, int, double, string) + Appends a walking stage to the plan of the given person + The walking speed can either be specified, computed from the duration parameter (in s) or taken from the type of the person + """ + if duration is not None: + duration *= 1000 + + if isinstance(edges, str): + edges = [edgeList] + self._connection._beginMessage(tc.CMD_SET_PERSON_VARIABLE, tc.APPEND_STAGE, personID, + 1 + 4 # compound + + 1 + 4 # stageType + + 1 + 4 + \ + sum(map(len, edges)) + 4 * len(edges) + + 1 + 8 # arrivalPos + + 1 + 4 # duration + + 1 + 8 # speed + + 1 + 4 + len(stopID) + ) + self._connection._string += struct.pack("!Bi", tc.TYPE_COMPOUND, 6) + self._connection._string += struct.pack( + "!Bi", tc.TYPE_INTEGER, tc.STAGE_WALKING) + self._connection._packStringList(edges) + self._connection._string += struct.pack("!Bd", + tc.TYPE_DOUBLE, arrivalPos) + self._connection._string += struct.pack("!Bi", + tc.TYPE_INTEGER, duration) + self._connection._string += struct.pack("!Bd", tc.TYPE_DOUBLE, speed) + self._connection._packString(stopID) + self._connection._sendExact() + + def appendDrivingStage(self, personID, toEdge, lines, stopID=""): + """appendDrivingStage(string, string, string, string) + Appends a driving stage to the plan of the given person + The lines parameter should be a space-separated list of line ids + """ + self._connection._beginMessage(tc.CMD_SET_PERSON_VARIABLE, tc.APPEND_STAGE, personID, + 1 + 4 # compound + + 1 + 4 # stage type + + 1 + 4 + len(toEdge) + + 1 + 4 + len(lines) + + 1 + 4 + len(stopID)) + self._connection._string += struct.pack("!Bi", tc.TYPE_COMPOUND, 4) + self._connection._string += struct.pack( + "!Bi", tc.TYPE_INTEGER, tc.STAGE_DRIVING) + self._connection._packString(toEdge) + self._connection._packString(lines) + self._connection._packString(stopID) + self._connection._sendExact() + + def removeStage(self, personID, nextStageIndex): + """removeStage(string, int) + Removes the nth next stage + nextStageIndex must be lower then value of getRemainingStages(personID) + nextStageIndex 0 immediately aborts the current stage and proceeds to the next stage + """ + self._connection._beginMessage( + tc.CMD_SET_PERSON_VARIABLE, tc.REMOVE_STAGE, personID, 1 + 4) + self._connection._string += struct.pack("!Bi", + tc.TYPE_INTEGER, nextStageIndex) + self._connection._sendExact() + + def setSpeed(self, personID, speed): + """setSpeed(string, double) -> None + + Sets the maximum speed in m/s for the named person for subsequent step. + """ + self._connection._sendDoubleCmd( + tc.CMD_SET_PERSON_VARIABLE, tc.VAR_SPEED, personID, speed) + + def setType(self, personID, typeID): + """setType(string, string) -> None + + Sets the id of the type for the named person. + """ + self._connection._sendStringCmd( + tc.CMD_SET_PERSON_VARIABLE, tc.VAR_TYPE, personID, typeID) + + def setWidth(self, personID, width): + """setWidth(string, double) -> None + + Sets the width in m for this person. + """ + self._connection._sendDoubleCmd( + tc.CMD_SET_PERSON_VARIABLE, tc.VAR_WIDTH, personID, width) + + def setHeight(self, personID, height): + """setHeight(string, double) -> None + + Sets the height in m for this person. + """ + self._connection._sendDoubleCmd( + tc.CMD_SET_PERSON_VARIABLE, tc.VAR_HEIGHT, personID, height) + + def setLength(self, personID, length): + """setLength(string, double) -> None + + Sets the length in m for the given person. + """ + self._connection._sendDoubleCmd( + tc.CMD_SET_PERSON_VARIABLE, tc.VAR_LENGTH, personID, length) + + def setMinGap(self, personID, minGap): + """setMinGap(string, double) -> None + + Sets the offset (gap to front person if halting) for this vehicle. + """ + self._connection._sendDoubleCmd( + tc.CMD_SET_PERSON_VARIABLE, tc.VAR_MINGAP, personID, minGap) + + def setColor(self, personID, color): + """setColor(string, (integer, integer, integer, integer)) + sets color for person with the given ID. + i.e. (255,0,0,0) for the color red. + The fourth integer (alpha) is only used when drawing persons with raster images + """ + self._connection._beginMessage( + tc.CMD_SET_PERSON_VARIABLE, tc.VAR_COLOR, personID, 1 + 1 + 1 + 1 + 1) + self._connection._string += struct.pack("!BBBBB", tc.TYPE_COLOR, int( + color[0]), int(color[1]), int(color[2]), int(color[3])) + self._connection._sendExact() + PersonDomain() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_poi.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_poi.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_poi.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_poi.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Michael Behrisch @author Lena Kalleske @date 2008-10-09 -@version $Id: _poi.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: _poi.py 23179 2017-03-02 08:32:15Z behrisch $ Python implementation of the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -23,9 +23,9 @@ from .storage import Storage from . import constants as tc -_RETURN_VALUE_FUNC = {tc.ID_LIST: Storage.readStringList, - tc.ID_COUNT: Storage.readInt, - tc.VAR_TYPE: Storage.readString, +_RETURN_VALUE_FUNC = {tc.ID_LIST: Storage.readStringList, + tc.ID_COUNT: Storage.readInt, + tc.VAR_TYPE: Storage.readString, tc.VAR_POSITION: lambda result: result.read("!dd"), tc.VAR_COLOR: lambda result: result.read("!BBBB")} @@ -48,7 +48,7 @@ def getPosition(self, poiID): """getPosition(string) -> (double, double) - Returns the position coordinates of the given poi. + Returns the position coordinates of the given poi. """ return self._getUniversal(tc.VAR_POSITION, poiID) @@ -72,7 +72,7 @@ def setPosition(self, poiID, x, y): """setPosition(string, (double, double)) -> None - Sets the position coordinates of the poi. + Sets the position coordinates of the poi. """ self._connection._beginMessage( tc.CMD_SET_POI_VARIABLE, tc.VAR_POSITION, poiID, 1 + 8 + 8) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_polygon.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_polygon.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_polygon.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_polygon.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file polygon.py @author Michael Behrisch @date 2011-03-16 -@version $Id: _polygon.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: _polygon.py 23179 2017-03-02 08:32:15Z behrisch $ Python implementation of the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -22,8 +22,9 @@ from .storage import Storage from . import constants as tc -_RETURN_VALUE_FUNC = {tc.VAR_TYPE: Storage.readString, +_RETURN_VALUE_FUNC = {tc.VAR_TYPE: Storage.readString, tc.VAR_SHAPE: Storage.readShape, + tc.VAR_FILL: lambda result: bool(result.read("!B")[0]), tc.VAR_COLOR: lambda result: result.read("!BBBB")} @@ -56,6 +57,12 @@ """ return self._getUniversal(tc.VAR_COLOR, polygonID) + def getFilled(self, polygonID): + """getFilled(string) -> bool + Returns whether the polygon is filled + """ + return self._getUniversal(tc.VAR_FILL, polygonID) + def setType(self, polygonID, polygonType): """setType(string, string) -> None @@ -90,6 +97,13 @@ color[0]), int(color[1]), int(color[2]), int(color[3])) self._connection._sendExact() + def setFilled(self, polygonID, filled): + """setFilled(string) -> bool + Returns whether the polygon is filled + """ + self._connection._sendUByteCmd( + tc.CMD_SET_POLYGON_VARIABLE, tc.VAR_FILL, polygonID, (1 if filled else 0)) + def add(self, polygonID, shape, color, fill=False, polygonType="", layer=0): self._connection._beginMessage(tc.CMD_SET_POLYGON_VARIABLE, tc.ADD, polygonID, 1 + 4 + 1 + 4 + len(polygonType) + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 4 + 1 + 1 + len(shape) * (8 + 8)) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/rebuildConstants.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/rebuildConstants.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/rebuildConstants.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/rebuildConstants.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,13 +5,13 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2009-07-24 -@version $Id: rebuildConstants.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: rebuildConstants.py 23999 2017-04-21 09:04:47Z behrisch $ This script extracts definitions from /src/traci-server/TraCIConstants.h and builds an according constants definition python file "constants.py". SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -44,12 +44,12 @@ print("""@file %s @author generated by "%s" @date %s -@version $Id: rebuildConstants.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: rebuildConstants.py 23999 2017-04-21 09:04:47Z behrisch $ This script contains TraCI constant definitions from /src/traci-server/TraCIConstants.h. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -62,31 +62,40 @@ else: print('"""\n', file=fdo) -fdi = open( - os.path.join(dirname, "..", "..", "src", "traci-server", "TraCIConstants.h")) -started = False -for line in fdi: - if started: - if line.find("#endif") >= 0: - started = False - if options.java: - fdo.write("}") - continue - if line.find("#define ") >= 0: - vals = line.split(" ") - if options.java: - line = " public static final int " + \ - vals[1] + " = " + vals[2].strip() + ";\n" - else: - line = vals[1] + " = " + vals[2] - if options.java: - line = line.replace("//", " //") - else: - line = line.replace("//", "#") - fdo.write(line) - if line.find("#define TRACICONSTANTS_H") >= 0: - started = True - if options.java: - fdo.write("public class TraCIConstants {") -fdi.close() + +def translateFile(filePath, fdo, start, item, end): + with open(filePath) as fdi: + started = False + for line in fdi: + if started: + if line.find(end) >= 0: + started = False + if options.java: + fdo.write("}") + continue + if options.java: + line = line.replace("//", " //") + else: + line = line.replace("//", "#").lstrip(" ") + if line.find(item) >= 0: + if "=" in line: + fdo.write(line.strip().rstrip(",") + "\n") + continue + vals = line.split(" ") + if options.java: + line = " public static final int " + \ + vals[1] + " = " + vals[2].strip() + ";\n" + else: + line = vals[1] + " = " + vals[2] + fdo.write(line) + if line.find(start) >= 0: + started = True + if options.java: + fdo.write("public class TraCIConstants {") + +srcDir = os.path.join(dirname, "..", "..", "src") +translateFile(os.path.join(srcDir, "traci-server", "TraCIConstants.h"), + fdo, "#define TRACICONSTANTS_H", "#define ", "#endif") +translateFile(os.path.join(srcDir, "utils", "xml", "SUMOXMLDefinitions.h"), + fdo, "enum LaneChangeAction {", "LCA_", "};") fdo.close() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_route.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_route.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_route.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_route.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Michael Behrisch @author Lena Kalleske @date 2008-10-09 -@version $Id: _route.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: _route.py 22608 2017-01-17 06:28:54Z behrisch $ Python implementation of the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_simulation.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_simulation.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_simulation.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_simulation.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,7 @@ @author Jakob Erdmann @author Michael Behrisch @date 2011-03-15 -@version $Id: _simulation.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: _simulation.py 23179 2017-03-02 08:32:15Z behrisch $ Python implementation of the TraCI interface. @@ -24,28 +24,28 @@ import struct from . import constants as tc -_RETURN_VALUE_FUNC = {tc.VAR_TIME_STEP: Storage.readInt, - tc.VAR_LOADED_VEHICLES_NUMBER: Storage.readInt, - tc.VAR_LOADED_VEHICLES_IDS: Storage.readStringList, - tc.VAR_DEPARTED_VEHICLES_NUMBER: Storage.readInt, - tc.VAR_DEPARTED_VEHICLES_IDS: Storage.readStringList, - tc.VAR_ARRIVED_VEHICLES_NUMBER: Storage.readInt, - tc.VAR_ARRIVED_VEHICLES_IDS: Storage.readStringList, - tc.VAR_PARKING_STARTING_VEHICLES_NUMBER: Storage.readInt, - tc.VAR_PARKING_STARTING_VEHICLES_IDS: Storage.readStringList, - tc.VAR_PARKING_ENDING_VEHICLES_NUMBER: Storage.readInt, - tc.VAR_PARKING_ENDING_VEHICLES_IDS: Storage.readStringList, - tc.VAR_STOP_STARTING_VEHICLES_NUMBER: Storage.readInt, - tc.VAR_STOP_STARTING_VEHICLES_IDS: Storage.readStringList, - tc.VAR_STOP_ENDING_VEHICLES_NUMBER: Storage.readInt, - tc.VAR_STOP_ENDING_VEHICLES_IDS: Storage.readStringList, - tc.VAR_MIN_EXPECTED_VEHICLES: Storage.readInt, - tc.VAR_BUS_STOP_WAITING: Storage.readInt, +_RETURN_VALUE_FUNC = {tc.VAR_TIME_STEP: Storage.readInt, + tc.VAR_LOADED_VEHICLES_NUMBER: Storage.readInt, + tc.VAR_LOADED_VEHICLES_IDS: Storage.readStringList, + tc.VAR_DEPARTED_VEHICLES_NUMBER: Storage.readInt, + tc.VAR_DEPARTED_VEHICLES_IDS: Storage.readStringList, + tc.VAR_ARRIVED_VEHICLES_NUMBER: Storage.readInt, + tc.VAR_ARRIVED_VEHICLES_IDS: Storage.readStringList, + tc.VAR_PARKING_STARTING_VEHICLES_NUMBER: Storage.readInt, + tc.VAR_PARKING_STARTING_VEHICLES_IDS: Storage.readStringList, + tc.VAR_PARKING_ENDING_VEHICLES_NUMBER: Storage.readInt, + tc.VAR_PARKING_ENDING_VEHICLES_IDS: Storage.readStringList, + tc.VAR_STOP_STARTING_VEHICLES_NUMBER: Storage.readInt, + tc.VAR_STOP_STARTING_VEHICLES_IDS: Storage.readStringList, + tc.VAR_STOP_ENDING_VEHICLES_NUMBER: Storage.readInt, + tc.VAR_STOP_ENDING_VEHICLES_IDS: Storage.readStringList, + tc.VAR_MIN_EXPECTED_VEHICLES: Storage.readInt, + tc.VAR_BUS_STOP_WAITING: Storage.readInt, tc.VAR_TELEPORT_STARTING_VEHICLES_NUMBER: Storage.readInt, - tc.VAR_TELEPORT_STARTING_VEHICLES_IDS: Storage.readStringList, - tc.VAR_TELEPORT_ENDING_VEHICLES_NUMBER: Storage.readInt, - tc.VAR_TELEPORT_ENDING_VEHICLES_IDS: Storage.readStringList, - tc.VAR_DELTA_T: Storage.readInt, + tc.VAR_TELEPORT_STARTING_VEHICLES_IDS: Storage.readStringList, + tc.VAR_TELEPORT_ENDING_VEHICLES_NUMBER: Storage.readInt, + tc.VAR_TELEPORT_ENDING_VEHICLES_IDS: Storage.readStringList, + tc.VAR_DELTA_T: Storage.readInt, tc.VAR_NET_BOUNDING_BOX: lambda result: (result.read("!dd"), result.read("!dd"))} @@ -74,7 +74,7 @@ def getLoadedIDList(self): """getLoadedIDList() -> list(string) - Returns a list of ids of vehicles which were loaded in this time step. + Returns a list of ids of vehicles which were loaded in this time step. """ return self._getUniversal(tc.VAR_LOADED_VEHICLES_IDS) @@ -88,77 +88,77 @@ def getDepartedIDList(self): """getDepartedIDList() -> list(string) - Returns a list of ids of vehicles which departed (were inserted into the road network) in this time step. + Returns a list of ids of vehicles which departed (were inserted into the road network) in this time step. """ return self._getUniversal(tc.VAR_DEPARTED_VEHICLES_IDS) def getArrivedNumber(self): """getArrivedNumber() -> integer - Returns the number of vehicles which arrived (have reached their destination and are removed from the road network) in this time step. + Returns the number of vehicles which arrived (have reached their destination and are removed from the road network) in this time step. """ return self._getUniversal(tc.VAR_ARRIVED_VEHICLES_NUMBER) def getArrivedIDList(self): """getArrivedIDList() -> list(string) - Returns a list of ids of vehicles which arrived (have reached their destination and are removed from the road network) in this time step. + Returns a list of ids of vehicles which arrived (have reached their destination and are removed from the road network) in this time step. """ return self._getUniversal(tc.VAR_ARRIVED_VEHICLES_IDS) def getParkingStartingVehiclesNumber(self): """getParkingStartingVehiclesNumber() -> integer - . + . """ return self._getUniversal(tc.VAR_PARKING_STARTING_VEHICLES_NUMBER) def getParkingStartingVehiclesIDList(self): """getParkingStartingVehiclesIDList() -> list(string) - . + . """ return self._getUniversal(tc.VAR_PARKING_STARTING_VEHICLES_IDS) def getParkingEndingVehiclesNumber(self): """getParkingEndingVehiclesNumber() -> integer - . + . """ return self._getUniversal(tc.VAR_PARKING_ENDING_VEHICLES_NUMBER) def getParkingEndingVehiclesIDList(self): """getParkingEndingVehiclesIDList() -> list(string) - . + . """ return self._getUniversal(tc.VAR_PARKING_ENDING_VEHICLES_IDS) def getStopStartingVehiclesNumber(self): """getStopStartingVehiclesNumber() -> integer - . + . """ return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_NUMBER) def getStopStartingVehiclesIDList(self): """getStopStartingVehiclesIDList() -> list(string) - . + . """ return self._getUniversal(tc.VAR_STOP_STARTING_VEHICLES_IDS) def getStopEndingVehiclesNumber(self): """getStopEndingVehiclesNumber() -> integer - . + . """ return self._getUniversal(tc.VAR_STOP_ENDING_VEHICLES_NUMBER) def getStopEndingVehiclesIDList(self): """getStopEndingVehiclesIDList() -> list(string) - . + . """ return self._getUniversal(tc.VAR_STOP_ENDING_VEHICLES_IDS) @@ -176,43 +176,41 @@ def getBusStopWaiting(self): """getBusStopWaiting() -> integer - - . + Get the total number of waiting persons at the named bus stop. """ return self._getUniversal(tc.VAR_BUS_STOP_WAITING) def getStartingTeleportNumber(self): """getStartingTeleportNumber() -> integer - Returns the number of vehicles which started to teleport in this time step. + Returns the number of vehicles which started to teleport in this time step. """ return self._getUniversal(tc.VAR_TELEPORT_STARTING_VEHICLES_NUMBER) def getStartingTeleportIDList(self): """getStartingTeleportIDList() -> list(string) - Returns a list of ids of vehicles which started to teleport in this time step. + Returns a list of ids of vehicles which started to teleport in this time step. """ return self._getUniversal(tc.VAR_TELEPORT_STARTING_VEHICLES_IDS) def getEndingTeleportNumber(self): """getEndingTeleportNumber() -> integer - Returns the number of vehicles which ended to be teleported in this time step. + Returns the number of vehicles which ended to be teleported in this time step. """ return self._getUniversal(tc.VAR_TELEPORT_ENDING_VEHICLES_NUMBER) def getEndingTeleportIDList(self): """getEndingTeleportIDList() -> list(string) - Returns a list of ids of vehicles which ended to be teleported in this time step. + Returns a list of ids of vehicles which ended to be teleported in this time step. """ return self._getUniversal(tc.VAR_TELEPORT_ENDING_VEHICLES_IDS) def getDeltaT(self): """getDeltaT() -> integer - - . + Returns the length of one simulation step in milliseconds """ return self._getUniversal(tc.VAR_DELTA_T) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/storage.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/storage.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/storage.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/storage.py 2017-07-23 16:22:03.000000000 +0000 @@ -7,12 +7,12 @@ @author Daniel Krajzewicz @author Jakob Erdmann @date 2008-10-09 -@version $Id: storage.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: storage.py 22608 2017-01-17 06:28:54Z behrisch $ Python implementation of the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/traciToHex.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/traciToHex.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/traciToHex.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/traciToHex.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @file traciToHex.py @author Michael Behrisch @date 2010-09-08 -@version $Id: traciToHex.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: traciToHex.py 22608 2017-01-17 06:28:54Z behrisch $ Converts all testclient.prog inputs to hexadecimal values. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_trafficlights.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_trafficlights.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_trafficlights.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_trafficlights.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file trafficlights.py @author Michael Behrisch @date 2011-03-16 -@version $Id: _trafficlights.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: _trafficlights.py 23179 2017-03-02 08:32:15Z behrisch $ Python implementation of the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -103,14 +103,14 @@ return signals -_RETURN_VALUE_FUNC = {tc.TL_RED_YELLOW_GREEN_STATE: Storage.readString, - tc.TL_COMPLETE_DEFINITION_RYG: _readLogics, - tc.TL_CONTROLLED_LANES: Storage.readStringList, - tc.TL_CONTROLLED_LINKS: _readLinks, - tc.TL_CURRENT_PROGRAM: Storage.readString, - tc.TL_CURRENT_PHASE: Storage.readInt, - tc.TL_NEXT_SWITCH: Storage.readInt, - tc.TL_PHASE_DURATION: Storage.readInt} +_RETURN_VALUE_FUNC = {tc.TL_RED_YELLOW_GREEN_STATE: Storage.readString, + tc.TL_COMPLETE_DEFINITION_RYG: _readLogics, + tc.TL_CONTROLLED_LANES: Storage.readStringList, + tc.TL_CONTROLLED_LINKS: _readLinks, + tc.TL_CURRENT_PROGRAM: Storage.readString, + tc.TL_CURRENT_PHASE: Storage.readInt, + tc.TL_NEXT_SWITCH: Storage.readInt, + tc.TL_PHASE_DURATION: Storage.readInt} class TrafficLightsDomain(Domain): @@ -129,7 +129,7 @@ return self._getUniversal(tc.TL_RED_YELLOW_GREEN_STATE, tlsID) def getCompleteRedYellowGreenDefinition(self, tlsID): - """getCompleteRedYellowGreenDefinition(string) -> + """getCompleteRedYellowGreenDefinition(string) -> . """ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_vehicle.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_vehicle.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_vehicle.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_vehicle.py 2017-07-23 16:22:03.000000000 +0000 @@ -9,12 +9,12 @@ @author Laura Bieker @author Daniel Krajzewicz @date 2011-03-09 -@version $Id: _vehicle.py 21846 2016-10-31 07:42:35Z namdre $ +@version $Id: _vehicle.py 23953 2017-04-16 16:19:38Z behrisch $ Python implementation of the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -69,79 +69,85 @@ return nextTLS -_RETURN_VALUE_FUNC = {tc.VAR_SPEED: Storage.readDouble, +_RETURN_VALUE_FUNC = {tc.VAR_SPEED: Storage.readDouble, tc.VAR_SPEED_WITHOUT_TRACI: Storage.readDouble, tc.VAR_POSITION: lambda result: result.read("!dd"), - tc.VAR_ANGLE: Storage.readDouble, - tc.VAR_ROAD_ID: Storage.readString, - tc.VAR_LANE_ID: Storage.readString, - tc.VAR_LANE_INDEX: Storage.readInt, - tc.VAR_TYPE: Storage.readString, - tc.VAR_ROUTE_ID: Storage.readString, - tc.VAR_ROUTE_INDEX: Storage.readInt, + tc.VAR_POSITION3D: lambda result: result.read("!ddd"), + tc.VAR_ANGLE: Storage.readDouble, + tc.VAR_ROAD_ID: Storage.readString, + tc.VAR_LANE_ID: Storage.readString, + tc.VAR_LANE_INDEX: Storage.readInt, + tc.VAR_TYPE: Storage.readString, + tc.VAR_ROUTE_ID: Storage.readString, + tc.VAR_ROUTE_INDEX: Storage.readInt, tc.VAR_COLOR: lambda result: result.read("!BBBB"), - tc.VAR_LANEPOSITION: Storage.readDouble, - tc.VAR_CO2EMISSION: Storage.readDouble, - tc.VAR_COEMISSION: Storage.readDouble, - tc.VAR_HCEMISSION: Storage.readDouble, - tc.VAR_PMXEMISSION: Storage.readDouble, - tc.VAR_NOXEMISSION: Storage.readDouble, + tc.VAR_LANEPOSITION: Storage.readDouble, + tc.VAR_CO2EMISSION: Storage.readDouble, + tc.VAR_COEMISSION: Storage.readDouble, + tc.VAR_HCEMISSION: Storage.readDouble, + tc.VAR_PMXEMISSION: Storage.readDouble, + tc.VAR_NOXEMISSION: Storage.readDouble, tc.VAR_FUELCONSUMPTION: Storage.readDouble, - tc.VAR_NOISEEMISSION: Storage.readDouble, + tc.VAR_NOISEEMISSION: Storage.readDouble, tc.VAR_ELECTRICITYCONSUMPTION: Storage.readDouble, - tc.VAR_PERSON_NUMBER: Storage.readInt, + tc.VAR_PERSON_NUMBER: Storage.readInt, tc.VAR_EDGE_TRAVELTIME: Storage.readDouble, - tc.VAR_EDGE_EFFORT: Storage.readDouble, + tc.VAR_EDGE_EFFORT: Storage.readDouble, tc.VAR_ROUTE_VALID: lambda result: bool(result.read("!B")[0]), - tc.VAR_EDGES: Storage.readStringList, - tc.VAR_SIGNALS: Storage.readInt, - tc.VAR_LENGTH: Storage.readDouble, - tc.VAR_MAXSPEED: Storage.readDouble, - tc.VAR_ALLOWED_SPEED: Storage.readDouble, - tc.VAR_VEHICLECLASS: Storage.readString, - tc.VAR_SPEED_FACTOR: Storage.readDouble, + tc.VAR_EDGES: Storage.readStringList, + tc.VAR_SIGNALS: Storage.readInt, + tc.VAR_LENGTH: Storage.readDouble, + tc.VAR_MAXSPEED: Storage.readDouble, + tc.VAR_ALLOWED_SPEED: Storage.readDouble, + tc.VAR_VEHICLECLASS: Storage.readString, + tc.VAR_SPEED_FACTOR: Storage.readDouble, tc.VAR_SPEED_DEVIATION: Storage.readDouble, - tc.VAR_EMISSIONCLASS: Storage.readString, - tc.VAR_WAITING_TIME: Storage.readDouble, - tc.VAR_SPEEDSETMODE: Storage.readInt, - tc.VAR_SLOPE: Storage.readDouble, - tc.VAR_WIDTH: Storage.readDouble, - tc.VAR_HEIGHT: Storage.readDouble, - tc.VAR_MINGAP: Storage.readDouble, - tc.VAR_SHAPECLASS: Storage.readString, - tc.VAR_ACCEL: Storage.readDouble, - tc.VAR_DECEL: Storage.readDouble, - tc.VAR_IMPERFECTION: Storage.readDouble, - tc.VAR_TAU: Storage.readDouble, - tc.VAR_BEST_LANES: _readBestLanes, - tc.VAR_LEADER: _readLeader, - tc.VAR_NEXT_TLS: _readNextTLS, - tc.DISTANCE_REQUEST: Storage.readDouble, + tc.VAR_EMISSIONCLASS: Storage.readString, + tc.VAR_WAITING_TIME: Storage.readDouble, + tc.VAR_SPEEDSETMODE: Storage.readInt, + tc.VAR_SLOPE: Storage.readDouble, + tc.VAR_WIDTH: Storage.readDouble, + tc.VAR_HEIGHT: Storage.readDouble, + tc.VAR_LINE: Storage.readString, + tc.VAR_VIA: Storage.readStringList, + tc.VAR_MINGAP: Storage.readDouble, + tc.VAR_SHAPECLASS: Storage.readString, + tc.VAR_ACCEL: Storage.readDouble, + tc.VAR_DECEL: Storage.readDouble, + tc.VAR_IMPERFECTION: Storage.readDouble, + tc.VAR_TAU: Storage.readDouble, + tc.VAR_BEST_LANES: _readBestLanes, + tc.VAR_LEADER: _readLeader, + tc.VAR_NEXT_TLS: _readNextTLS, + tc.VAR_LANEPOSITION_LAT: Storage.readDouble, + tc.VAR_MAXSPEED_LAT: Storage.readDouble, + tc.VAR_MINGAP_LAT: Storage.readDouble, + tc.VAR_LATALIGNMENT: Storage.readString, + tc.DISTANCE_REQUEST: Storage.readDouble, tc.VAR_STOPSTATE: lambda result: result.read("!B")[0], - tc.VAR_DISTANCE: Storage.readDouble} + tc.VAR_DISTANCE: Storage.readDouble} class VehicleDomain(Domain): - - DEPART_TRIGGERED = -1 - DEPART_CONTAINER_TRIGGERED = -2 - DEPART_NOW = -3 - - DEPART_SPEED_RANDOM = -2 - DEPART_SPEED_MAX = -3 - - STOP_DEFAULT = 0 - STOP_PARKING = 1 - STOP_TRIGGERED = 2 - STOP_CONTAINER_TRIGGERED = 4 - STOP_BUS_STOP = 8 - STOP_CONTAINER_STOP = 16 - - DEPART_LANE_RANDOM = -2 - DEPART_LANE_FREE = -3 - DEPART_LANE_ALLOWED_FREE = -4 - DEPART_LANE_BEST_FREE = -5 - DEPART_LANE_FIRST_ALLOWED = -6 + # imported for backwards compatibility + STOP_DEFAULT = tc.STOP_DEFAULT + STOP_PARKING = tc.STOP_PARKING + STOP_TRIGGERED = tc.STOP_TRIGGERED + STOP_CONTAINER_TRIGGERED = tc.STOP_CONTAINER_TRIGGERED + STOP_BUS_STOP = tc.STOP_BUS_STOP + STOP_CONTAINER_STOP = tc.STOP_CONTAINER_STOP + STOP_CHARGING_STATION = tc.STOP_CHARGING_STATION + STOP_PARKING_AREA = tc.STOP_PARKING_AREA + DEPART_TRIGGERED = tc.DEPARTFLAG_TRIGGERED + DEPART_CONTAINER_TRIGGERED = tc.DEPARTFLAG_CONTAINER_TRIGGERED + DEPART_NOW = tc.DEPARTFLAG_NOW + DEPART_SPEED_RANDOM = tc.DEPARTFLAG_SPEED_RANDOM + DEPART_SPEED_MAX = tc.DEPARTFLAG_SPEED_MAX + DEPART_LANE_RANDOM = tc.DEPARTFLAG_LANE_RANDOM + DEPART_LANE_FREE = tc.DEPARTFLAG_LANE_FREE + DEPART_LANE_ALLOWED_FREE = tc.DEPARTFLAG_LANE_ALLOWED_FREE + DEPART_LANE_BEST_FREE = tc.DEPARTFLAG_LANE_BEST_FREE + DEPART_LANE_FIRST_ALLOWED = tc.DEPARTFLAG_LANE_FIRST_ALLOWED def __init__(self): Domain.__init__(self, "vehicle", tc.CMD_GET_VEHICLE_VARIABLE, tc.CMD_SET_VEHICLE_VARIABLE, @@ -158,8 +164,8 @@ def getSpeedWithoutTraCI(self, vehID): """getSpeedWithoutTraCI(string) -> double - - . + Returns the speed that the vehicle would drive if not speed-influencing + command such as setSpeed or slowDown was given. """ return self._getUniversal(tc.VAR_SPEED_WITHOUT_TRACI, vehID) @@ -170,10 +176,17 @@ """ return self._getUniversal(tc.VAR_POSITION, vehID) + def getPosition3D(self, vehID): + """getPosition3D(string) -> (double, double, double) + + Returns the position of the named vehicle within the last step [m,m,m]. + """ + return self._getUniversal(tc.VAR_POSITION3D, vehID) + def getAngle(self, vehID): """getAngle(string) -> double - Returns the angle in degrees of the named vehicle within the last step. + Returns the angle in degrees of the named vehicle within the last step. """ return self._getUniversal(tc.VAR_ANGLE, vehID) @@ -299,8 +312,9 @@ def getPersonNumber(self, vehID): """getPersonNumber(string) -> integer - - . + Returns the total number of persons which includes those defined + using attribute 'personNumber' as well as -objects which are riding in + this vehicle. """ return self._getUniversal(tc.VAR_PERSON_NUMBER, vehID) @@ -329,6 +343,10 @@ return self._connection._checkResult(tc.CMD_GET_VEHICLE_VARIABLE, tc.VAR_EDGE_EFFORT, vehID).readDouble() def isRouteValid(self, vehID): + """isRouteValid(string) -> bool + Returns whether the current vehicle route is connected for the vehicle + class of the given vehicle. + """ return self._getUniversal(tc.VAR_ROUTE_VALID, vehID) def getSignals(self, vehID): @@ -352,6 +370,34 @@ """ return self._getUniversal(tc.VAR_MAXSPEED, vehID) + def getLateralLanePosition(self, vehID): + """getLateralLanePosition(string) -> double + + Returns The lateral position of the vehicle on its current lane measured in m. + """ + return self._getUniversal(tc.VAR_LANEPOSITION_LAT, vehID) + + def getMaxSpeedLat(self, vehID): + """getMaxSpeedLat(string) -> double + + Returns the maximum lateral speed in m/s of this vehicle. + """ + return self._getUniversal(tc.VAR_MAXSPEED_LAT, vehID) + + def getLateralAlignment(self, vehID): + """getLateralAlignment(string) -> string + + Returns The preferred lateral alignment of the vehicle + """ + return self._getUniversal(tc.VAR_LATALIGNMENT, vehID) + + def getMinGapLat(self, vehID): + """getMinGapLat(string) -> double + + Returns The desired lateral gap of this vehicle at 50km/h in m + """ + return self._getUniversal(tc.VAR_MINGAP_LAT, vehID) + def getAllowedSpeed(self, vehID): """getAllowedSpeed(string) -> double @@ -391,13 +437,13 @@ """getWaitingTime() -> double The waiting time of a vehicle is defined as the time (in seconds) spent with a speed below 0.1m/s since the last time it was faster than 0.1m/s. - (basically, the waiting time of a vehicle is reset to 0 every time it moves). + (basically, the waiting time of a vehicle is reset to 0 every time it moves). """ return self._getUniversal(tc.VAR_WAITING_TIME, vehID) def getSpeedMode(self, vehID): """getSpeedMode -> int - The speed mode of a vehicle + The speed mode of a vehicle """ return self._getUniversal(tc.VAR_SPEEDSETMODE, vehID) @@ -421,6 +467,20 @@ """ return self._getUniversal(tc.VAR_HEIGHT, vehID) + def getLine(self, vehID): + """getLine(string) -> string + + Returns the line information of this vehicle. + """ + return self._getUniversal(tc.VAR_LINE, vehID) + + def getVia(self, vehID): + """getVia(string) -> list(string) + + Returns the ids of via edges for this vehicle + """ + return self._getUniversal(tc.VAR_VIA, vehID) + def getMinGap(self, vehID): """getMinGap(string) -> double @@ -464,7 +524,7 @@ return self._getUniversal(tc.VAR_TAU, vehID) def getBestLanes(self, vehID): - """getBestLanes(string) -> + """getBestLanes(string) -> Information about the wish to use subsequent edges' lanes. """ @@ -475,6 +535,7 @@ Return the leading vehicle id together with the distance. The dist parameter defines the maximum lookahead, 0 calculates a lookahead from the brake gap. + Note that the returned leader may be farther away than the given dist. """ self._connection._beginMessage( tc.CMD_GET_VEHICLE_VARIABLE, tc.VAR_LEADER, vehID, 1 + 8) @@ -482,7 +543,7 @@ return _readLeader(self._connection._checkResult(tc.CMD_GET_VEHICLE_VARIABLE, tc.VAR_LEADER, vehID)) def getNextTLS(self, vehID): - """getNextTLS(string) -> + """getNextTLS(string) -> Return list of upcoming traffic lights [(tlsID, tlsIndex, distance, state), ...] """ @@ -500,7 +561,7 @@ def getDrivingDistance(self, vehID, edgeID, pos, laneID=0): """getDrivingDistance(string, string, double, integer) -> double - . + Return the distance to the given edge and position along the vehicles route. """ self._connection._beginMessage(tc.CMD_GET_VEHICLE_VARIABLE, tc.DISTANCE_REQUEST, vehID, 1 + 4 + 1 + 4 + len(edgeID) + 8 + 1 + 1) @@ -513,7 +574,7 @@ def getDrivingDistance2D(self, vehID, x, y): """getDrivingDistance2D(string, double, double) -> integer - . + Return the distance to the given network position along the vehicles route. """ self._connection._beginMessage( tc.CMD_GET_VEHICLE_VARIABLE, tc.DISTANCE_REQUEST, vehID, 1 + 4 + 1 + 8 + 8 + 1) @@ -569,6 +630,35 @@ """ return (self.getStopState(vehID) & 32) == 32 + def getLaneChangeState(self, vehID, direction): + """getLaneChangeState(string, int) -> (int, int) + Return the lane change state for the vehicle + """ + self._connection._beginMessage( + tc.CMD_GET_VEHICLE_VARIABLE, tc.CMD_CHANGELANE, vehID, 1 + 4) + self._connection._string += struct.pack("!Bi", tc.TYPE_INTEGER, direction) + result = self._connection._checkResult(tc.CMD_GET_VEHICLE_VARIABLE, tc.CMD_CHANGELANE, vehID) + return result.read("!iBiBi")[2::2] # ignore num compounds and type int + + def couldChangeLane(self, vehID, direction): + """couldChangeLane(string, int) -> bool + Return whether the vehicle could change lanes in the specified direction + """ + state = self.getLaneChangeState(vehID, direction)[0] + return state != tc.LCA_UNKNOWN and (state & tc.LCA_BLOCKED == 0) + + def wantsAndCouldChangeLane(self, vehID, direction): + """wantsAndCouldChangeLane(string, int) -> bool + Return whether the vehicle wants to and could change lanes in the specified direction + """ + state = self.getLaneChangeState(vehID, direction)[0] + if state & tc.LCA_BLOCKED == 0: + if direction == -1: + return state & tc.LCA_RIGHT != 0 + if direction == 1: + return state & tc.LCA_LEFT != 0 + return False + def setMaxSpeed(self, vehID, speed): """setMaxSpeed(string, double) -> None @@ -577,7 +667,16 @@ self._connection._sendDoubleCmd( tc.CMD_SET_VEHICLE_VARIABLE, tc.VAR_MAXSPEED, vehID, speed) - def setStop(self, vehID, edgeID, pos=1., laneIndex=0, duration=2**31 - 1, flags=STOP_DEFAULT, startPos=tc.INVALID_DOUBLE_VALUE, until=-1): + def setMaxSpeedLat(self, vehID, speed): + """setMaxSpeedLat(string, double) -> None + + Sets the maximum lateral speed in m/s for this vehicle. + """ + self._connection._sendDoubleCmd( + tc.CMD_SET_VEHICLE_VARIABLE, tc.VAR_MAXSPEED_LAT, vehID, speed) + + def setStop(self, vehID, edgeID, pos=1., laneIndex=0, duration=2**31 - 1, + flags=tc.STOP_DEFAULT, startPos=tc.INVALID_DOUBLE_VALUE, until=-1): """setStop(string, string, double, integer, integer, integer, double, integer) -> None Adds or modifies a stop with the given parameters. The duration and the until attribute are @@ -593,23 +692,41 @@ tc.TYPE_DOUBLE, startPos, tc.TYPE_INTEGER, until) self._connection._sendExact() - def setBusStop(self, vehID, stopID, duration=2**31 - 1, until=-1, flags=STOP_DEFAULT): + def setBusStop(self, vehID, stopID, duration=2**31 - 1, until=-1, flags=tc.STOP_DEFAULT): """setBusStop(string, string, integer, integer, integer) -> None Adds or modifies a bus stop with the given parameters. The duration and the until attribute are in milliseconds. """ self.setStop(vehID, stopID, duration=duration, - until=until, flags=flags | self.STOP_BUS_STOP) + until=until, flags=flags | tc.STOP_BUS_STOP) - def setContainerStop(self, vehID, stopID, duration=2**31 - 1, until=-1, flags=STOP_DEFAULT): + def setContainerStop(self, vehID, stopID, duration=2**31 - 1, until=-1, flags=tc.STOP_DEFAULT): """setContainerStop(string, string, integer, integer, integer) -> None Adds or modifies a container stop with the given parameters. The duration and the until attribute are in milliseconds. """ self.setStop(vehID, stopID, duration=duration, until=until, - flags=flags | self.STOP_CONTAINER_STOP) + flags=flags | tc.STOP_CONTAINER_STOP) + + def setChargingStationStop(self, vehID, stopID, duration=2**31 - 1, until=-1, flags=tc.STOP_DEFAULT): + """setChargingStationStop(string, string, integer, integer, integer) -> None + + Adds or modifies a stop at a chargingStation with the given parameters. The duration and the until attribute are + in milliseconds. + """ + self.setStop(vehID, stopID, duration=duration, until=until, + flags=flags | tc.STOP_CHARGING_STATION) + + def setParkingAreaStop(self, vehID, stopID, duration=2**31 - 1, until=-1, flags=tc.STOP_PARKING): + """setParkingAreaStop(string, string, integer, integer, integer) -> None + + Adds or modifies a stop at a parkingArea with the given parameters. The duration and the until attribute are + in milliseconds. + """ + self.setStop(vehID, stopID, duration=duration, until=until, + flags=flags | tc.STOP_PARKING_AREA) def resume(self, vehID): """resume(string) -> None @@ -625,7 +742,7 @@ """changeLane(string, int, int) -> None Forces a lane change to the lane with the given index; if successful, - the lane will be chosen for the given amount of time (in ms). + the lane will be chosen for the given amount of time (in ms). """ self._connection._beginMessage( tc.CMD_SET_VEHICLE_VARIABLE, tc.CMD_CHANGELANE, vehID, 1 + 4 + 1 + 1 + 1 + 4) @@ -633,11 +750,20 @@ "!BiBBBi", tc.TYPE_COMPOUND, 2, tc.TYPE_BYTE, laneIndex, tc.TYPE_INTEGER, duration) self._connection._sendExact() + def changeSublane(self, vehID, latDist): + """changeLane(string, double) -> None + Forces a lateral change by the given amount (negative values indicate changing to the right, positive to the left) + This will override any other lane change motivations but conform to + safety-constraints as configured by laneChangeMode. + """ + self._connection._sendDoubleCmd( + tc.CMD_SET_VEHICLE_VARIABLE, tc.CMD_CHANGESUBLANE, vehID, latDist) + def slowDown(self, vehID, speed, duration): """slowDown(string, double, int) -> None Changes the speed smoothly to the given value over the given amount - of time in ms (can also be used to increase speed). + of time in ms (can also be used to increase speed). """ self._connection._beginMessage( tc.CMD_SET_VEHICLE_VARIABLE, tc.CMD_SLOWDOWN, vehID, 1 + 4 + 1 + 8 + 1 + 4) @@ -648,7 +774,7 @@ def changeTarget(self, vehID, edgeID): """changeTarget(string, string) -> None - The vehicle's destination edge is set to the given edge id. The route is rebuilt. + The vehicle's destination edge is set to the given edge id. The route is rebuilt. """ self._connection._sendStringCmd( tc.CMD_SET_VEHICLE_VARIABLE, tc.CMD_CHANGETARGET, vehID, edgeID) @@ -718,24 +844,26 @@ self._connection._string += struct.pack("!Bd", tc.TYPE_DOUBLE, effort) self._connection._sendExact() + LAST_TRAVEL_TIME_UPDATE = -1 + def rerouteTraveltime(self, vehID, currentTravelTimes=True): """rerouteTraveltime(string, bool) -> None Reroutes a vehicle. If currentTravelTimes is True (default) then the current traveltime of the - edges is loaded and used for rerouting. If currentTravelTimes is False, - travel times loaded from a weight file are used. In the absence of loaded - weights, the minimum travel time is used (speed limit). + edges is loaded and used for rerouting. If currentTravelTimes is False + custom travel times are used. The various functions and options for + customizing travel times are described at http://sumo.dlr.de/wiki/Simulation/Routing When rerouteTravelTime has been called once with option currentTravelTimes=True, all edge weights are set to the current travel - times at the time of that call (even for subsequent simulation steps). - To speed up rerouting of many vehicles with currentTravelTimes=True, - only the first vehicle should set this option to True in each simulation - step (setting the edge weights is expensive for large networks). + times at the time of that call (even for subsequent simulation steps). """ if currentTravelTimes: - for edge in self._connection.edge.getIDList(): - self._connection.edge.adaptTraveltime( - edge, self._connection.edge.getTraveltime(edge)) + time = self._connection.simulation.getCurrentTime() + if time != self.LAST_TRAVEL_TIME_UPDATE: + self.LAST_TRAVEL_TIME_UPDATE = time + for edge in self._connection.edge.getIDList(): + self._connection.edge.adaptTraveltime( + edge, self._connection.edge.getTraveltime(edge)) self._connection._beginMessage( tc.CMD_SET_VEHICLE_VARIABLE, tc.CMD_REROUTE_TRAVELTIME, vehID, 1 + 4) self._connection._string += struct.pack("!Bi", tc.TYPE_COMPOUND, 0) @@ -774,7 +902,7 @@ def setColor(self, vehID, color): """setColor(string, (integer, integer, integer, integer)) sets color for vehicle with the given ID. - i.e. (255,0,0,0) for the color red. + i.e. (255,0,0,0) for the color red. The fourth integer (alpha) is only used when drawing vehicles with raster images """ self._connection._beginMessage( @@ -807,14 +935,6 @@ self._connection._sendDoubleCmd( tc.CMD_SET_VEHICLE_VARIABLE, tc.VAR_SPEED_FACTOR, vehID, factor) - def setSpeedDeviation(self, vehID, deviation): - """setSpeedDeviation(string, double) -> None - - Sets the maximum speed deviation for this vehicle. - """ - self._connection._sendDoubleCmd( - tc.CMD_SET_VEHICLE_VARIABLE, tc.VAR_SPEED_DEVIATION, vehID, deviation) - def setEmissionClass(self, vehID, clazz): """setEmissionClass(string, string) -> None @@ -839,6 +959,30 @@ self._connection._sendDoubleCmd( tc.CMD_SET_VEHICLE_VARIABLE, tc.VAR_HEIGHT, vehID, height) + def setLine(self, vehID, line): + """setHeight(string, string) -> None + + Sets the line information for this vehicle. + """ + self._connection._sendStringCmd( + tc.CMD_SET_VEHICLE_VARIABLE, tc.VAR_LINE, vehID, line) + + def setVia(self, vehID, edgeList): + """ + setVia(string, list) -> None + + changes the via edges to the given edges list (to be used during + subsequent rerouting calls). + + Note: a single edgeId as argument is allowed as shorthand for a list of length 1 + """ + if isinstance(edgeList, str): + edgeList = [edgeList] + self._connection._beginMessage(tc.CMD_SET_VEHICLE_VARIABLE, tc.VAR_VIA, vehID, + 1 + 4 + sum(map(len, edgeList)) + 4 * len(edgeList)) + self._connection._packStringList(edgeList) + self._connection._sendExact() + def setMinGap(self, vehID, minGap): """setMinGap(string, double) -> None @@ -847,6 +991,22 @@ self._connection._sendDoubleCmd( tc.CMD_SET_VEHICLE_VARIABLE, tc.VAR_MINGAP, vehID, minGap) + def setMinGapLat(self, vehID, minGapLat): + """setMinGapLat(string, double) -> None + + Sets the minimum lateral gap of the vehicle at 50km/h in m + """ + self._connection._sendDoubleCmd( + tc.CMD_SET_VEHICLE_VARIABLE, tc.VAR_MINGAP_LAT, vehID, minGapLat) + + def setLateralAlignment(self, vehID, align): + """setLateralAlignment(string, string) -> None + + Sets the preferred lateral alignment for this vehicle. + """ + self._connection._sendStringCmd( + tc.CMD_SET_VEHICLE_VARIABLE, tc.VAR_LATALIGNMENT, vehID, align) + def setShapeClass(self, vehID, clazz): """setShapeClass(string, string) -> None @@ -896,15 +1056,15 @@ tc.CMD_SET_VEHICLE_VARIABLE, tc.VAR_LANECHANGE_MODE, vehID, lcm) def setSpeedMode(self, vehID, sm): - """setLaneChangeMode(string, integer) -> None + """setSpeedMode(string, integer) -> None Sets the vehicle's speed mode as a bitset. """ self._connection._sendIntCmd( tc.CMD_SET_VEHICLE_VARIABLE, tc.VAR_SPEEDSETMODE, vehID, sm) - def add(self, vehID, routeID, depart=DEPART_NOW, pos=0, speed=0, - lane=DEPART_LANE_FIRST_ALLOWED, typeID="DEFAULT_VEHTYPE"): + def add(self, vehID, routeID, depart=tc.DEPARTFLAG_NOW, pos=0, speed=0, + lane=tc.DEPARTFLAG_LANE_FIRST_ALLOWED, typeID="DEFAULT_VEHTYPE"): """ Add a new vehicle (old style) """ @@ -944,20 +1104,23 @@ self._connection._sendExact() def remove(self, vehID, reason=tc.REMOVE_VAPORIZED): - '''Remove vehicle with the given ID for the give reason. + '''Remove vehicle with the given ID for the give reason. Reasons are defined in module constants and start with REMOVE_''' self._connection._sendByteCmd( tc.CMD_SET_VEHICLE_VARIABLE, tc.REMOVE, vehID, reason) - def moveToXY(self, vehID, edgeID, lane, x, y, angle, keepRoute=1): + def moveToXY(self, vehID, edgeID, lane, x, y, angle=tc.INVALID_DOUBLE_VALUE, keepRoute=1): '''Place vehicle at the given x,y coordinates and force it's angle to - the given value (for drawing). If keepRoute is set to 1, the closest position + the given value (for drawing). + If the angle is set to INVALID_DOUBLE_VALUE, the vehicle assumes the + natural angle of the edge on which it is driving. + If keepRoute is set to 1, the closest position within the existing route is taken. If keepRoute is set to 0, the vehicle may move to any edge in the network but it's route then only consists of that edge. - If keepRoute is set to 2 the vehicle has all the freedom of keepRoute=1 + If keepRoute is set to 2 the vehicle has all the freedom of keepRoute=0 but in addition to that may even move outside the road network. edgeID and lane are optional placement hints to resovle ambiguities''' - self._connection._beginMessage(tc.CMD_SET_VEHICLE_VARIABLE, tc.VAR_MOVE_TO_VTD, + self._connection._beginMessage(tc.CMD_SET_VEHICLE_VARIABLE, tc.MOVE_TO_XY, vehID, 1 + 4 + 1 + 4 + len(edgeID) + 1 + 4 + 1 + 8 + 1 + 8 + 1 + 8 + 1 + 1) self._connection._string += struct.pack("!Bi", tc.TYPE_COMPOUND, 6) self._connection._packString(edgeID) @@ -977,7 +1140,8 @@ """ Domain.subscribe(self, objectID, varIDs, begin, end) - def subscribeContext(self, objectID, domain, dist, varIDs=(tc.VAR_ROAD_ID, tc.VAR_LANEPOSITION), begin=0, end=2**31 - 1): + def subscribeContext(self, objectID, domain, dist, varIDs=( + tc.VAR_ROAD_ID, tc.VAR_LANEPOSITION), begin=0, end=2**31 - 1): """subscribe(string, int, double, list(integer), int, int) -> None Subscribe to one or more object values of the given domain around the diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_vehicletype.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_vehicletype.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/traci/_vehicletype.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/traci/_vehicletype.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Michael Behrisch @author Lena Kalleske @date 2008-10-09 -@version $Id: _vehicletype.py 21657 2016-10-10 14:50:05Z namdre $ +@version $Id: _vehicletype.py 23999 2017-04-21 09:04:47Z behrisch $ Python implementation of the TraCI interface. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -23,20 +23,23 @@ import struct from . import constants as tc -_RETURN_VALUE_FUNC = {tc.VAR_LENGTH: Storage.readDouble, - tc.VAR_MAXSPEED: Storage.readDouble, - tc.VAR_SPEED_FACTOR: Storage.readDouble, +_RETURN_VALUE_FUNC = {tc.VAR_LENGTH: Storage.readDouble, + tc.VAR_MAXSPEED: Storage.readDouble, + tc.VAR_SPEED_FACTOR: Storage.readDouble, tc.VAR_SPEED_DEVIATION: Storage.readDouble, - tc.VAR_ACCEL: Storage.readDouble, - tc.VAR_DECEL: Storage.readDouble, - tc.VAR_IMPERFECTION: Storage.readDouble, - tc.VAR_TAU: Storage.readDouble, - tc.VAR_VEHICLECLASS: Storage.readString, - tc.VAR_EMISSIONCLASS: Storage.readString, - tc.VAR_SHAPECLASS: Storage.readString, - tc.VAR_MINGAP: Storage.readDouble, - tc.VAR_WIDTH: Storage.readDouble, - tc.VAR_HEIGHT: Storage.readDouble, + tc.VAR_ACCEL: Storage.readDouble, + tc.VAR_DECEL: Storage.readDouble, + tc.VAR_IMPERFECTION: Storage.readDouble, + tc.VAR_TAU: Storage.readDouble, + tc.VAR_VEHICLECLASS: Storage.readString, + tc.VAR_EMISSIONCLASS: Storage.readString, + tc.VAR_SHAPECLASS: Storage.readString, + tc.VAR_MINGAP: Storage.readDouble, + tc.VAR_WIDTH: Storage.readDouble, + tc.VAR_HEIGHT: Storage.readDouble, + tc.VAR_MAXSPEED_LAT: Storage.readDouble, + tc.VAR_MINGAP_LAT: Storage.readDouble, + tc.VAR_LATALIGNMENT: Storage.readString, tc.VAR_COLOR: lambda result: result.read("!BBBB")} @@ -121,7 +124,7 @@ def getShapeClass(self, typeID): """getShapeClass(string) -> string - Returns the shape class of vehicles of this type. + Returns the shape class of vehicles of this type. """ return self._getUniversal(tc.VAR_SHAPECLASS, typeID) @@ -153,6 +156,27 @@ """ return self._getUniversal(tc.VAR_COLOR, typeID) + def getMaxSpeedLat(self, vehID): + """getMaxSpeedLat(string) -> double + + Returns the maximum lateral speed in m/s of this type. + """ + return self._getUniversal(tc.VAR_MAXSPEED_LAT, vehID) + + def getLateralAlignment(self, vehID): + """getLateralAlignment(string) -> string + + Returns The preferred lateral alignment of the type + """ + return self._getUniversal(tc.VAR_LATALIGNMENT, vehID) + + def getMinGapLat(self, vehID): + """getMinGapLat(string) -> double + + Returns The desired lateral gap of this type at 50km/h in m + """ + return self._getUniversal(tc.VAR_MINGAP_LAT, vehID) + def setLength(self, typeID, length): """setLength(string, double) -> None @@ -225,10 +249,34 @@ self._connection._sendDoubleCmd( tc.CMD_SET_VEHICLETYPE_VARIABLE, tc.VAR_MINGAP, typeID, minGap) + def setMinGapLat(self, typeID, minGapLat): + """setMinGapLat(string, double) -> None + + Sets the minimum lateral gap at 50km/h of this type. + """ + self._connection._sendDoubleCmd( + tc.CMD_SET_VEHICLETYPE_VARIABLE, tc.VAR_MINGAP_LAT, typeID, minGapLat) + + def setMaxSpeedLat(self, typeID, speed): + """setMaxSpeedLat(string, double) -> None + + Sets the maximum lateral speed of this type. + """ + self._connection._sendDoubleCmd( + tc.CMD_SET_VEHICLETYPE_VARIABLE, tc.VAR_MAXSPEED_LAT, typeID, speed) + + def setLateralAlignment(self, typeID, latAlignment): + """setLateralAlignment(string, string) -> None + + Sets the preferred lateral alignment of this type. + """ + self._connection._sendStringCmd( + tc.CMD_SET_VEHICLETYPE_VARIABLE, tc.VAR_LATALIGNMENT, typeID, clazz) + def setShapeClass(self, typeID, clazz): """setShapeClass(string, string) -> None - Sets the shape class of vehicles of this type. + Sets the shape class of vehicles of this type. """ self._connection._sendStringCmd( tc.CMD_SET_VEHICLETYPE_VARIABLE, tc.VAR_SHAPECLASS, typeID, clazz) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/trigger/csv2vss.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/trigger/csv2vss.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/trigger/csv2vss.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/trigger/csv2vss.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file csv2vss.py @author Michael Behrisch @date 2013-06-04 -@version $Id: csv2vss.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: csv2vss.py 22608 2017-01-17 06:28:54Z behrisch $ Create variable speed signs from comma separated detector data. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/turn-defs/collectinghandler.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/turn-defs/collectinghandler.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/turn-defs/collectinghandler.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/turn-defs/collectinghandler.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file collectinghandler.py @author Karol Stosiek @date 2011-10-26 -@version $Id: collectinghandler.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: collectinghandler.py 22608 2017-01-17 06:28:54Z behrisch $ Handler for loggers from logging module. Collects all log messages. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/turn-defs/connections.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/turn-defs/connections.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/turn-defs/connections.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/turn-defs/connections.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Karol Stosiek @author Michael Behrisch @date 2011-10-26 -@version $Id: connections.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: connections.py 23885 2017-04-08 08:13:37Z behrisch $ Operations and classes necessary to operate on SUMO connections. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -20,10 +20,11 @@ from __future__ import absolute_import import logging -import xml.dom.minidom -import collectinghandler import unittest +import sumolib +import collectinghandler + LOGGER = logging.getLogger(__name__) @@ -90,7 +91,7 @@ source_lane_no, source_total_lanes, destination_total_lanes): - """ Calculates the weight assigned to a single destination + """ Calculates the weight assigned to a single destination from given lane in an uniform way. See class docs for explanation. """ @@ -124,7 +125,7 @@ source, source_lane, destination): - """ Adds a connection. If a connection is readded, + """ Adds a connection. If a connection is readded, a warning is issued. """ self.logger.debug("Adding connection %s (%s) -> %s" % @@ -151,8 +152,7 @@ contains. Incoming edges are sorted alphabetically in ascending order. """ - sources = list(self.connections_map.keys()) - sources.sort() + sources = sorted(self.connections_map.keys()) return sources def get_lanes(self, source): @@ -189,66 +189,6 @@ return weight -class ConnectionXML(): - - """ Represents a raw, xml-defined connection. """ - - def __init__(self, connection_xml): - """ Constructor. The connection_xml argument must be a well-formed - connection XML entity string. See SUMO docs for information on - connection XML format. """ - - self.connection_xml = connection_xml - - def get_source(self): - """ Returns the connection's incoming edge. Raises AttributeError - if the incoming edge is missing. """ - - source = self.connection_xml.getAttribute("from") - if source is '': - raise AttributeError - return source - - def get_source_lane(self): - """ Returns the connection's incoming edge's lane. - Raises AttributeError if the incoming edge's lane is missing. """ - - source_lane = self.connection_xml.getAttribute("fromLane") - if source_lane is '': - raise AttributeError - return source_lane - - def get_destination(self): - """ Returns the connection's outgoing edge. Raises AttributeError - if the outgoing edge is missing. """ - - destination = self.connection_xml.getAttribute("to") - if destination is '': - raise AttributeError - return destination - - -class ConnectionsXMLReader(): - - """ Reads the XML connection definitions. """ - # pylint: disable=R0903 - - logger = logging.getLogger("ConnectionsXMLReader") - - def __init__(self, connections_xml_stream): - """ Constructor. The connections_xml_stream argument may be - a filename or an opened file. """ - - self.connections_xml = xml.dom.minidom.parse(connections_xml_stream) - - def get_connections(self): - """ Returns connections defined in the XML stream provided in - the constructor. """ - - return [ConnectionXML(connection_xml) for connection_xml in - self.connections_xml.getElementsByTagName("connection")] - - def from_stream(input_connections): """ Constructs Connections object from connections defined in the given stream. The input_connections argument may be a filename or an opened @@ -257,11 +197,10 @@ LOGGER.info("Reading connections from input stream") connections = Connections() - connections_xml_reader = ConnectionsXMLReader(input_connections) - for xml_connection in connections_xml_reader.get_connections(): - connections.add(xml_connection.get_source(), - xml_connection.get_source_lane(), - xml_connection.get_destination()) + for xml_connection in sumolib.xml.parse(input_connections, "connection"): + connections.add(xml_connection.attr_from, + xml_connection.fromLane, + xml_connection.to) return connections diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/turn-defs/generateTurnDefs.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/turn-defs/generateTurnDefs.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/turn-defs/generateTurnDefs.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/turn-defs/generateTurnDefs.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @file generateTurnDefs.py @author Karol Stosiek @date 2011-10-26 -@version $Id: generateTurnDefs.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: generateTurnDefs.py 23885 2017-04-08 08:13:37Z behrisch $ Generates turn definitions XML file based on connections XML file. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -19,10 +19,13 @@ """ from __future__ import absolute_import -import connections -import turndefinitions +import os +import sys import logging import optparse +sys.path.append(os.path.join(os.environ["SUMO_HOME"], "tools")) +import connections +import turndefinitions LOGGER = logging.getLogger(__name__) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/turn-defs/turndefinitions.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/turn-defs/turndefinitions.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/turn-defs/turndefinitions.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/turn-defs/turndefinitions.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Karol Stosiek @author Michael Behrisch @date 2011-10-26 -@version $Id: turndefinitions.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: turndefinitions.py 23885 2017-04-08 08:13:37Z behrisch $ Operations and classes necessary to work on SUMO turn definitions. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -19,12 +19,13 @@ """ from __future__ import absolute_import -import connections import logging -import xml.dom.minidom -import collectinghandler import unittest +import sumolib +import connections +import collectinghandler + LOGGER = logging.getLogger(__name__) @@ -63,8 +64,7 @@ """ Returns all of the turn definitions incoming edges. The result will be sorted in alphabetical. """ - sources = list(self.turn_definitions.keys()) - sources.sort() + sources = sorted(self.turn_definitions.keys()) return sources def get_destinations(self, source): @@ -73,8 +73,7 @@ have been added before. The result will be sorted in alphabetical order.""" - destinations = self.turn_definitions[source].keys() - destinations.sort() + destinations = sorted(self.turn_definitions[source].keys()) return destinations def get_turning_probability(self, @@ -128,12 +127,11 @@ LOGGER.debug("Turn definitions sources number: %i" % (len(turn_definitions.get_sources()))) - turn_definitions_xml = xml.dom.minidom.Element("turn-defs") + turn_definitions_xml = sumolib.xml.create_document("turns") for source in turn_definitions.get_sources(): LOGGER.debug("Converting turn definition with source %s" % (source)) - from_edge_element = xml.dom.minidom.Element("fromEdge") - from_edge_element.setAttribute("id", source) + from_edge_element = turn_definitions_xml.addChild("fromEdge", {"id": source}) for destination in turn_definitions.get_destinations(source): probability = turn_definitions.get_turning_probability(source, @@ -142,14 +140,11 @@ LOGGER.debug("Converting turn definition destination %s " "with probability %f" % (destination, probability)) - to_edge_element = xml.dom.minidom.Element("toEdge") + to_edge_element = from_edge_element.addChild("toEdge") to_edge_element.setAttribute("id", destination) - to_edge_element.setAttribute("probability", str(probability)) - from_edge_element.appendChild(to_edge_element) - - turn_definitions_xml.appendChild(from_edge_element) + to_edge_element.setAttribute("probability", "%.10g" % probability) - return turn_definitions_xml.toprettyxml() + return turn_definitions_xml.toXML() class TurnDefinitionsTestCase(unittest.TestCase): diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/mpl_dump_onNet.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/mpl_dump_onNet.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/mpl_dump_onNet.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/mpl_dump_onNet.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,7 +5,7 @@ @author Michael Behrisch @author Jakob Erdmann @date 2007-10-25 -@version $Id: mpl_dump_onNet.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: mpl_dump_onNet.py 23178 2017-03-02 08:27:45Z behrisch $ This script reads a network and a dump file and @@ -15,7 +15,7 @@ matplotlib has to be installed for this purpose SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2007-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -425,11 +425,11 @@ # axes/legend optParser.add_option("--xticks", dest="xticks", type="string", default="", help="defines ticks on x-axis") -optParser.add_option("--yticks", dest="yticks", type="string", default="", +optParser.add_option("--yticks", dest="yticks", type="string", default="", help="defines ticks on y-axis") -optParser.add_option("--xlim", dest="xlim", type="string", default="", +optParser.add_option("--xlim", dest="xlim", type="string", default="", help="defines x-axis range") -optParser.add_option("--ylim", dest="ylim", type="string", default="", +optParser.add_option("--ylim", dest="ylim", type="string", default="", help="defines y-axis range") # output optParser.add_option("--size", dest="size", type="string", default="", diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/mpl_dump_timeline.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/mpl_dump_timeline.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/mpl_dump_timeline.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/mpl_dump_timeline.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2007-10-25 -@version $Id: mpl_dump_timeline.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: mpl_dump_timeline.py 23178 2017-03-02 08:27:45Z behrisch $ This script reads the value of designated edges from @@ -13,7 +13,7 @@ matplotlib has to be installed for this purpose SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -36,9 +36,9 @@ def updateMinMax(min, max, value): - if min == None or min > value: + if min is None or min > value: min = value - if max == None or max < value: + if max is None or max < value: max = value return (min, max) @@ -86,11 +86,11 @@ # axes/legend optParser.add_option("--xticks", dest="xticks", type="string", default="", help="defines ticks on x-axis") -optParser.add_option("--yticks", dest="yticks", type="string", default="", +optParser.add_option("--yticks", dest="yticks", type="string", default="", help="defines ticks on y-axis") -optParser.add_option("--xlim", dest="xlim", type="string", default="", +optParser.add_option("--xlim", dest="xlim", type="string", default="", help="defines x-axis range") -optParser.add_option("--ylim", dest="ylim", type="string", default="", +optParser.add_option("--ylim", dest="ylim", type="string", default="", help="defines y-axis range") # parse options (options, args) = optParser.parse_args() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/mpl_dump_twoAgainst.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/mpl_dump_twoAgainst.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/mpl_dump_twoAgainst.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/mpl_dump_twoAgainst.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2007-10-25 -@version $Id: mpl_dump_twoAgainst.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: mpl_dump_twoAgainst.py 23178 2017-03-02 08:27:45Z behrisch $ This script reads two dump files and plots one of the values @@ -13,7 +13,7 @@ matplotlib has to be installed for this purpose SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -48,9 +48,9 @@ def updateMinMax(min, max, value): - if min == None or min > value: + if min is None or min > value: min = value - if max == None or max < value: + if max is None or max < value: max = value return (min, max) @@ -101,11 +101,11 @@ # axes/legend optParser.add_option("--xticks", dest="xticks", type="string", default="", help="defines ticks on x-axis") -optParser.add_option("--yticks", dest="yticks", type="string", default="", +optParser.add_option("--yticks", dest="yticks", type="string", default="", help="defines ticks on y-axis") -optParser.add_option("--xlim", dest="xlim", type="string", default="", +optParser.add_option("--xlim", dest="xlim", type="string", default="", help="defines x-axis range") -optParser.add_option("--ylim", dest="ylim", type="string", default="", +optParser.add_option("--ylim", dest="ylim", type="string", default="", help="defines y-axis range") # parse options (options, args) = optParser.parse_args() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/mpl_tripinfos_twoAgainst.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/mpl_tripinfos_twoAgainst.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/mpl_tripinfos_twoAgainst.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/mpl_tripinfos_twoAgainst.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2007-10-25 -@version $Id: mpl_tripinfos_twoAgainst.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: mpl_tripinfos_twoAgainst.py 23178 2017-03-02 08:27:45Z behrisch $ This script reads two tripinfos files and plots one of the values @@ -13,7 +13,7 @@ matplotlib has to be installed for this purpose SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -48,9 +48,9 @@ def updateMinMax(min, max, value): - if min == None or min > value: + if min is None or min > value: min = value - if max == None or max < value: + if max is None or max < value: max = value return (min, max) @@ -101,11 +101,11 @@ # axes/legend optParser.add_option("--xticks", dest="xticks", type="string", default="", help="defines ticks on x-axis") -optParser.add_option("--yticks", dest="yticks", type="string", default="", +optParser.add_option("--yticks", dest="yticks", type="string", default="", help="defines ticks on y-axis") -optParser.add_option("--xlim", dest="xlim", type="string", default="", +optParser.add_option("--xlim", dest="xlim", type="string", default="", help="defines x-axis range") -optParser.add_option("--ylim", dest="ylim", type="string", default="", +optParser.add_option("--ylim", dest="ylim", type="string", default="", help="defines y-axis range") # parse options (options, args) = optParser.parse_args() diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/plot_csv_bars.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/plot_csv_bars.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/plot_csv_bars.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/plot_csv_bars.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,7 +3,7 @@ @file plot_csv_bars.py @author Daniel Krajzewicz @date 2014-01-27 -@version $Id: plot_csv_bars.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: plot_csv_bars.py 23178 2017-03-02 08:27:45Z behrisch $ This script plots name / value pairs from a given .csv file (';'-separated). @@ -66,7 +66,7 @@ # parse options, remaining_args = optParser.parse_args(args=args) - if options.input == None: + if options.input is None: print("Error: at least one csv file must be given") sys.exit(1) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/plot_csv_pie.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/plot_csv_pie.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/plot_csv_pie.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/plot_csv_pie.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ @author Daniel Krajzewicz @author Laura Bieker @date 2014-01-15 -@version $Id: plot_csv_pie.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: plot_csv_pie.py 23178 2017-03-02 08:27:45Z behrisch $ This script plots name / value pairs from a given .csv file (';'-separated). @@ -13,7 +13,7 @@ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -61,7 +61,7 @@ # parse options, remaining_args = optParser.parse_args(args=args) - if options.input == None: + if options.input is None: print("Error: at least one csv file must be given") sys.exit(1) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/plot_csv_timeline.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/plot_csv_timeline.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/plot_csv_timeline.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/plot_csv_timeline.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ @author Daniel Krajzewicz @author Laura Bieker @date 2014-01-14 -@version $Id: plot_csv_timeline.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: plot_csv_timeline.py 23178 2017-03-02 08:27:45Z behrisch $ This script plots selected columns from a given .csv file (';'-separated). @@ -13,7 +13,7 @@ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -44,7 +44,7 @@ with open(file, 'rb') as f: reader = csv.reader(f, delimiter=';') for row in reader: - if columns == None: + if columns is None: columns = range(0, len(row)) for i in columns: if i not in ret: @@ -70,13 +70,13 @@ # parse options, remaining_args = optParser.parse_args(args=args) - if options.input == None: + if options.input is None: print("Error: an input file must be given") sys.exit(1) minV = 0 maxV = 0 - if options.columns != None: + if options.columns is not None: options.columns = [int(i) for i in options.columns.split(",")] nums = readValues(options.input, options.verbose, options.columns) for f in nums: @@ -87,7 +87,7 @@ for i in nums: v = nums[i] ci = i - if options.columns != None: + if options.columns is not None: ci = options.columns.index(i) c = helpers.getColor(options, ci, len(nums)) l = helpers.getLabel(str(i), ci, options) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/plot_net_dump.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/plot_net_dump.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/plot_net_dump.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/plot_net_dump.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,10 +5,10 @@ @author Laura Bieker @author Robert Hilbrich @date 2016-08-05 -@version $Id: plot_net_dump.py 21291 2016-08-09 09:07:53Z rhilbrich $ +@version $Id: plot_net_dump.py 23178 2017-03-02 08:27:45Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -110,14 +110,14 @@ # parse options, remaining_args = optParser.parse_args(args=args) - if options.net == None: + if options.net is None: print("Error: a network to load must be given.") return 1 if options.verbose: print("Reading network from '%s'" % options.net) net = sumolib.net.readNet(options.net) - if options.measures == None: + if options.measures is None: print("Error: a dump file must be given.") return 1 @@ -172,18 +172,18 @@ minColorValue = None for e in net._id2edge: if hc and t in hc._edge2value and e in hc._edge2value[t]: - if options.colorMax != None and hc._edge2value[t][e] > options.colorMax: + if options.colorMax is not None and hc._edge2value[t][e] > options.colorMax: hc._edge2value[t][e] = options.colorMax - if options.colorMin != None and hc._edge2value[t][e] < options.colorMin: + if options.colorMin is not None and hc._edge2value[t][e] < options.colorMin: hc._edge2value[t][e] = options.colorMin - if maxColorValue == None or maxColorValue < hc._edge2value[t][e]: + if maxColorValue is None or maxColorValue < hc._edge2value[t][e]: maxColorValue = hc._edge2value[t][e] - if minColorValue == None or minColorValue > hc._edge2value[t][e]: + if minColorValue is None or minColorValue > hc._edge2value[t][e]: minColorValue = hc._edge2value[t][e] colors[e] = hc._edge2value[t][e] - if options.colorMax != None: + if options.colorMax is not None: maxColorValue = options.colorMax - if options.colorMin != None: + if options.colorMin is not None: minColorValue = options.colorMin if options.logColors: helpers.logNormalise(colors, maxColorValue) @@ -201,18 +201,18 @@ for e in net._id2edge: if hw and t in hw._edge2value and e in hw._edge2value[t]: v = abs(hw._edge2value[t][e]) - if options.widthMax != None and v > options.widthMax: + if options.widthMax is not None and v > options.widthMax: v = options.widthMax - if options.widthMin != None and v < options.widthMin: + if options.widthMin is not None and v < options.widthMin: v = options.widthMin if not maxWidthValue or maxWidthValue < v: maxWidthValue = v if not minWidthValue or minWidthValue > v: minWidthValue = v widths[e] = v - if options.widthMax != None: + if options.widthMax is not None: maxWidthValue = options.widthMax - if options.widthMin != None: + if options.widthMin is not None: minWidthValue = options.widthMin if options.logWidths: helpers.logNormalise(widths, options.colorMax) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/plot_net_selection.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/plot_net_selection.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/plot_net_selection.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/plot_net_selection.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,10 +4,10 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2014-02-19 -@version $Id: plot_net_selection.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: plot_net_selection.py 23178 2017-03-02 08:27:45Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -56,10 +56,10 @@ # parse options, remaining_args = optParser.parse_args(args=args) - if options.net == None: + if options.net is None: print("Error: a network to load must be given.") return 1 - if options.selection == None: + if options.selection is None: print("Error: a selection to load must be given.") return 1 if options.verbose: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/plot_net_speeds.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/plot_net_speeds.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/plot_net_speeds.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/plot_net_speeds.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,10 +4,10 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2014-02-19 -@version $Id: plot_net_speeds.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: plot_net_speeds.py 23178 2017-03-02 08:27:45Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -54,7 +54,7 @@ # parse options, remaining_args = optParser.parse_args(args=args) - if options.net == None: + if options.net is None: print("Error: a network to load must be given.") return 1 if options.verbose: @@ -66,14 +66,14 @@ maxV = None for e in net._id2edge: v = net._id2edge[e]._speed - if minV == None or minV > v: + if minV is None or minV > v: minV = v - if maxV == None or maxV < v: + if maxV is None or maxV < v: maxV = v speeds[e] = v - if options.minV != None: + if options.minV is not None: minV = options.minV - if options.maxV != None: + if options.maxV is not None: maxV = options.maxV # if options.logColors: # helpers.logNormalise(colors, maxColorValue) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/plot_net_trafficLights.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/plot_net_trafficLights.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/plot_net_trafficLights.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/plot_net_trafficLights.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,10 +4,10 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2013-10-28 -@version $Id: plot_net_trafficLights.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: plot_net_trafficLights.py 23178 2017-03-02 08:27:45Z behrisch $ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2008-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -54,7 +54,7 @@ # parse options, remaining_args = optParser.parse_args(args=args) - if options.net == None: + if options.net is None: print("Error: a network to load must be given.") return 1 if options.verbose: diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/plot_summary.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/plot_summary.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/plot_summary.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/plot_summary.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,7 +4,7 @@ @author Daniel Krajzewicz @author Laura Bieker @date 2013-11-11 -@version $Id: plot_summary.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: plot_summary.py 23178 2017-03-02 08:27:45Z behrisch $ This script plots a selected measure from a summary-output. @@ -12,7 +12,7 @@ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -61,7 +61,7 @@ # parse options, remaining_args = optParser.parse_args(args=args) - if options.summary == None: + if options.summary is None: print("Error: at least one summary file must be given") sys.exit(1) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/plot_tripinfo_distributions.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/plot_tripinfo_distributions.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/visualization/plot_tripinfo_distributions.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/visualization/plot_tripinfo_distributions.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,14 +4,14 @@ @author Daniel Krajzewicz @author Laura Bieker @date 2013-11-11 -@version $Id: plot_tripinfo_distributions.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: plot_tripinfo_distributions.py 23178 2017-03-02 08:27:45Z behrisch $ This script plots measures from the tripinfo output, classified into bins matplotlib (http://matplotlib.org/) has to be installed for this purpose - + SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -59,7 +59,7 @@ # parse options, remaining_args = optParser.parse_args(args=args) - if options.tripinfos == None: + if options.tripinfos is None: print("Error: at least one tripinfo file must be given") sys.exit(1) @@ -77,7 +77,7 @@ sumolib.output.prune(fv, options.minV, options.maxV) values[f] = fv - if minV == None: + if minV is None: minV = fv[0] maxV = fv[0] minV = min(minV, min(fv)) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/webWizard/__init__.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/webWizard/__init__.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/webWizard/__init__.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/webWizard/__init__.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ @file __init__.py @author Michael Behrisch @date 2015-12-02 -@version $Id: __init__.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: __init__.py 22608 2017-01-17 06:28:54Z behrisch $ This file imports all webWizard dependencies. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/webWizard/SimpleWebSocketServer.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/webWizard/SimpleWebSocketServer.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/webWizard/SimpleWebSocketServer.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/webWizard/SimpleWebSocketServer.py 2017-07-23 16:22:03.000000000 +0000 @@ -2,14 +2,14 @@ @file SimpleWebSocketServer.py @author Dave Pallot @date 2013 -@version $Id: SimpleWebSocketServer.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: SimpleWebSocketServer.py 23819 2017-04-04 20:56:28Z behrisch $ A web socket server implementation to be used by the osm server.py Originally distributed under the MIT license at https://github.com/dpallot/simple-websocket-server/tree/master/SimpleWebSocketServer. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2015-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2015-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -17,39 +17,52 @@ the Free Software Foundation; either version 3 of the License, or (at your option) any later version. """ -from __future__ import absolute_import -try: +import sys +VER = sys.version_info[0] +if VER >= 3: + import socketserver + from http.server import BaseHTTPRequestHandler + from io import StringIO, BytesIO +else: import SocketServer from BaseHTTPServer import BaseHTTPRequestHandler from StringIO import StringIO -except ImportError: - import socketserver - from http.server import BaseHTTPRequestHandler - from io import StringIO + import hashlib import base64 import socket import struct import ssl -import sys import errno import codecs from collections import deque from select import select -__all__ = ['WebSocket', 'SimpleWebSocketServer', 'SimpleSSLWebSocketServer'] +__all__ = ['WebSocket', + 'SimpleWebSocketServer', + 'SimpleSSLWebSocketServer'] + + +def _check_unicode(val): + if VER >= 3: + return isinstance(val, str) + else: + return isinstance(val, unicode) class HTTPRequest(BaseHTTPRequestHandler): def __init__(self, request_text): - self.rfile = StringIO(request_text) + if VER >= 3: + self.rfile = BytesIO(request_text) + else: + self.rfile = StringIO(request_text) self.raw_requestline = self.rfile.readline() self.error_code = self.error_message = None self.parse_request() -_VALID_STATUS_CODES = [ - 1000, 1001, 1002, 1003, 1007, 1008, 1009, 1010, 1011, 3000, 3999, 4000, 4999] +_VALID_STATUS_CODES = [1000, 1001, 1002, 1003, 1007, 1008, + 1009, 1010, 1011, 3000, 3999, 4000, 4999] HANDSHAKE_STR = ( "HTTP/1.1 101 Switching Protocols\r\n" @@ -86,7 +99,7 @@ self.address = address self.handshaked = False - self.headerbuffer = '' + self.headerbuffer = bytearray() self.headertoread = 2048 self.fin = 0 @@ -137,7 +150,6 @@ pass def _handlePacket(self): - if self.opcode == CLOSE: pass elif self.opcode == STREAM: @@ -169,7 +181,7 @@ if len(reason) > 0: try: - reason = reason.decode('utf-8', errors='strict') + reason = reason.decode('utf8', errors='strict') except: status = 1002 else: @@ -239,7 +251,7 @@ if self.opcode == TEXT: try: - self.data = self.data.decode('utf-8', errors='strict') + self.data = self.data.decode('utf8', errors='strict') except Exception as exp: raise Exception('invalid utf-8 payload') @@ -251,40 +263,44 @@ data = self.client.recv(self.headertoread) if not data: - raise Exception("remote socket closed") + raise Exception('remote socket closed') else: # accumulate - self.headerbuffer += data + self.headerbuffer.extend(data) if len(self.headerbuffer) >= self.maxheader: raise Exception('header exceeded allowable size') # indicates end of HTTP header - if '\r\n\r\n' in self.headerbuffer: + if b'\r\n\r\n' in self.headerbuffer: self.request = HTTPRequest(self.headerbuffer) # handshake rfc 6455 - if 'Sec-WebSocket-Key'.lower() in self.request.headers: - key = self.request.headers['Sec-WebSocket-Key'.lower()] - hStr = HANDSHAKE_STR % { - 'acceptstr': base64.b64encode(hashlib.sha1(key + GUID_STR).digest())} - self.sendq.append((BINARY, hStr)) + try: + key = self.request.headers['Sec-WebSocket-Key'] + k = key.encode('ascii') + GUID_STR.encode('ascii') + k_s = base64.b64encode( + hashlib.sha1(k).digest()).decode('ascii') + hStr = HANDSHAKE_STR % {'acceptstr': k_s} + self.sendq.append((BINARY, hStr.encode('ascii'))) self.handshaked = True - self.headerbuffer = '' self.handleConnected() - - else: - raise Exception('Sec-WebSocket-Key does not exist') + except Exception as e: + raise Exception('handshake failed: %s', str(e)) # else do normal data else: - data = self.client.recv(8192) + data = self.client.recv(16384) if not data: raise Exception("remote socket closed") - for d in data: - self._parseMessage(ord(d)) + if VER >= 3: + for d in data: + self._parseMessage(d) + else: + for d in data: + self._parseMessage(ord(d)) def close(self, status=1000, reason=u''): """ @@ -298,17 +314,17 @@ if self.closed is False: close_msg = bytearray() close_msg.extend(struct.pack("!H", status)) - if isinstance(reason, unicode): + if _check_unicode(reason): close_msg.extend(reason.encode('utf-8')) else: close_msg.extend(reason) - self._sendMessage(False, CLOSE, str(close_msg)) + self._sendMessage(False, CLOSE, close_msg) finally: self.closed = True - def _sendBuffer(self, buff): + def _sendBuffer(self, buff, send_all=False): size = len(buff) tosend = size already_sent = 0 @@ -318,7 +334,7 @@ # i should be able to send a bytearray sent = self.client.send(buff[already_sent:]) if sent == 0: - raise RuntimeError("socket connection broken") + raise RuntimeError('socket connection broken') already_sent += sent tosend -= sent @@ -327,6 +343,8 @@ # if we have full buffers then wait for them to drain and try # again if e.errno in [errno.EAGAIN, errno.EWOULDBLOCK]: + if send_all: + continue return buff[already_sent:] else: raise e @@ -343,7 +361,7 @@ If the data is a bytearray object then the frame is sent as Binary. """ opcode = BINARY - if isinstance(data, unicode): + if _check_unicode(data): opcode = TEXT self._sendMessage(True, opcode, data) @@ -373,43 +391,42 @@ If the data is a bytearray object then the frame is sent as Binary. """ opcode = BINARY - if isinstance(data, unicode): + if _check_unicode(data): opcode = TEXT self._sendMessage(False, opcode, data) def _sendMessage(self, fin, opcode, data): - header = bytearray() + + payload = bytearray() + b1 = 0 b2 = 0 if fin is False: b1 |= 0x80 b1 |= opcode - if isinstance(data, unicode): + if _check_unicode(data): data = data.encode('utf-8') length = len(data) - header.append(b1) + payload.append(b1) if length <= 125: b2 |= length - header.append(b2) + payload.append(b2) elif length >= 126 and length <= 65535: b2 |= 126 - header.append(b2) - header.extend(struct.pack("!H", length)) + payload.append(b2) + payload.extend(struct.pack("!H", length)) else: b2 |= 127 - header.append(b2) - header.extend(struct.pack("!Q", length)) + payload.append(b2) + payload.extend(struct.pack("!Q", length)) - payload = None if length > 0: - payload = str(header) + str(data) - else: - payload = str(header) + payload.extend(data) self.sendq.append((opcode, payload)) @@ -479,8 +496,7 @@ raise Exception('short length exceeded allowable size') if len(self.lengtharray) == 2: - self.length = struct.unpack_from( - '!H', str(self.lengtharray))[0] + self.length = struct.unpack_from('!H', self.lengtharray)[0] if self.hasmask is True: self.maskarray = bytearray() @@ -508,8 +524,7 @@ raise Exception('long length exceeded allowable size') if len(self.lengtharray) == 8: - self.length = struct.unpack_from( - '!Q', str(self.lengtharray))[0] + self.length = struct.unpack_from('!Q', self.lengtharray)[0] if self.hasmask is True: self.maskarray = bytearray() @@ -577,12 +592,13 @@ class SimpleWebSocketServer(object): - def __init__(self, host, port, websocketclass): + def __init__(self, host, port, websocketclass, selectInterval=0.1): self.websocketclass = websocketclass self.serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.serversocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.serversocket.bind((host, port)) self.serversocket.listen(5) + self.selectInterval = selectInterval self.connections = {} self.listeners = [self.serversocket] @@ -595,31 +611,30 @@ def close(self): self.serversocket.close() - for conn in self.connections.itervalues(): + for desc, conn in self.connections.items(): conn.close() - try: - conn.handleClose() - except: - pass + conn.handleClose() def serveforever(self): while True: writers = [] for fileno in self.listeners: - try: - client = self.connections[fileno] - if client.sendq: - writers.append(fileno) - except Exception as n: - pass - - rList, wList, xList = select( - self.listeners, writers, self.listeners, 0.1) + if fileno == self.serversocket: + continue + client = self.connections[fileno] + if client.sendq: + writers.append(fileno) + + if self.selectInterval: + rList, wList, xList = select( + self.listeners, writers, self.listeners, self.selectInterval) + else: + rList, wList, xList = select( + self.listeners, writers, self.listeners) for ready in wList: - client = None + client = self.connections[ready] try: - client = self.connections[ready] while client.sendq: opcode, payload = client.sendq.popleft() remaining = client._sendBuffer(payload) @@ -628,28 +643,13 @@ break else: if opcode == CLOSE: - raise Exception("received client close") + raise Exception('received client close') except Exception as n: - - if client: - client.client.close() - - try: - if client: - client.handleClose() - except: - pass - - try: - del self.connections[ready] - except: - pass - - try: - self.listeners.remove(ready) - except: - pass + client.client.close() + client.handleClose() + del self.connections[ready] + self.listeners.remove(ready) for ready in rList: if ready == self.serversocket: @@ -658,85 +658,54 @@ newsock = self._decorateSocket(sock) newsock.setblocking(0) fileno = newsock.fileno() - self.listeners.append(fileno) self.connections[fileno] = self._constructWebSocket( newsock, address) + self.listeners.append(fileno) except Exception as n: if sock is not None: sock.close() else: - client = None + if ready not in self.connections: + continue + client = self.connections[ready] try: - client = self.connections[ready] client._handleData() except Exception as n: - - if client: - client.client.close() - - try: - if client: - client.handleClose() - except: - pass - - try: - del self.connections[ready] - except: - pass - - try: - self.listeners.remove(ready) - except: - pass + client.client.close() + client.handleClose() + del self.connections[ready] + self.listeners.remove(ready) for failed in xList: if failed == self.serversocket: self.close() - raise Exception("server socket failed") + raise Exception('server socket failed') else: - client = None - try: - client = self.connections[failed] - client.client.close() - - try: - client.handleClose() - except: - pass - - try: - self.listeners.remove(failed) - except: - pass - - except: - pass - - finally: - if client: - del self.connections[failed] + if failed not in self.connections: + continue + client = self.connections[failed] + client.client.close() + client.handleClose() + del self.connections[failed] + self.listeners.remove(failed) class SimpleSSLWebSocketServer(SimpleWebSocketServer): - def __init__(self, host, port, websocketclass, certfile, keyfile, version=ssl.PROTOCOL_TLSv1): + def __init__(self, host, port, websocketclass, certfile, + keyfile, version=ssl.PROTOCOL_TLSv1, selectInterval=0.1): - SimpleWebSocketServer.__init__(self, host, port, websocketclass) + SimpleWebSocketServer.__init__(self, host, port, + websocketclass, selectInterval) - self.cerfile = certfile - self.keyfile = keyfile - self.version = version + self.context = ssl.SSLContext(version) + self.context.load_cert_chain(certfile, keyfile) def close(self): super(SimpleSSLWebSocketServer, self).close() def _decorateSocket(self, sock): - sslsock = ssl.wrap_socket(sock, - server_side=True, - certfile=self.cerfile, - keyfile=self.keyfile, - ssl_version=self.version) + sslsock = self.context.wrap_socket(sock, server_side=True) return sslsock def _constructWebSocket(self, sock, address): diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/xml/addSchema.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/xml/addSchema.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/xml/addSchema.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/xml/addSchema.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Daniel Krajzewicz @author Michael Behrisch @date 2010 -@version $Id: addSchema.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: addSchema.py 22608 2017-01-17 06:28:54Z behrisch $ Inserts XML schema references. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/xml/binary2plain.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/xml/binary2plain.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/xml/binary2plain.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/xml/binary2plain.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file binary2plain.py @author Michael Behrisch @date 2012-03-11 -@version $Id: binary2plain.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: binary2plain.py 22623 2017-01-18 09:53:08Z behrisch $ Converter between SUMO's binary XML and plain XML SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -160,7 +160,7 @@ out = sys.stdout content = open(sys.argv[1], 'rb') -read(content, "BBB") # type, sbx version, type +_, version, _ = read(content, "BBB") # type, sbx version, type readString(content) # sumo version read(content, "B") # type elements = readStringList(content) @@ -182,8 +182,11 @@ if startOpen: out.write(">\n") out.write(" " * len(stack)) - stack.append(readByte(content)) - out.write("<" + elements[stack[-1]]) + tag = readByte(content) + if version > 1: + tag += 256 * readByte(content) + stack.append(tag) + out.write("<" + elements[tag]) startOpen = True elif typ == XML_TAG_END: if startOpen: @@ -193,11 +196,15 @@ else: out.write(" " * (len(stack) - 1)) out.write("\n" % elements[stack.pop()]) - readByte(content) + if version == 1: + readByte(content) if len(stack) == 0: break elif typ == XML_ATTRIBUTE: + attr = readByte(content) + if version > 1: + attr += 256 * readByte(content) out.write(' %s="%s"' % - (attributes[readByte(content)], typedValueStr(content))) + (attributes[attr], typedValueStr(content))) else: print("Unknown type %s" % typ, file=sys.stderr) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/xml/csv2xml.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/xml/csv2xml.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/xml/csv2xml.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/xml/csv2xml.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Michael Behrisch @author Laura Bieker @date 2013-12-08 -@version $Id: csv2xml.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: csv2xml.py 23948 2017-04-14 17:50:54Z namdre $ Convert csv files to selected xml input files for SUMO SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -172,6 +172,8 @@ if not fields: fields = raw for f in fields: + if not '_' in f: + continue enum = struct.getEnumerationByAttr(*f.split('_', 1)) if enum: enums[f] = enum diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/xml/protobuf2xml.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/xml/protobuf2xml.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/xml/protobuf2xml.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/xml/protobuf2xml.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Laura Bieker @author Jakob Erdmann @date 2014-01-23 -@version $Id: protobuf2xml.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: protobuf2xml.py 22608 2017-01-17 06:28:54Z behrisch $ Convert protobuf files to selected xml input files for SUMO SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/xml/rebuildSchemata.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/xml/rebuildSchemata.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/xml/rebuildSchemata.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/xml/rebuildSchemata.py 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ @file rebuildSchemata.py @author Michael Behrisch @date 2011-07-11 -@version $Id: rebuildSchemata.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: rebuildSchemata.py 22608 2017-01-17 06:28:54Z behrisch $ Let all SUMO binaries write the schema for their config SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2011-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2011-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/xml/schemaCheck.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/xml/schemaCheck.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/xml/schemaCheck.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/xml/schemaCheck.py 2017-07-23 16:22:03.000000000 +0000 @@ -5,13 +5,13 @@ @author Michael Behrisch @author Jakob Erdmann @date 03.12.2009 -@version $Id: schemaCheck.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: schemaCheck.py 23885 2017-04-08 08:13:37Z behrisch $ Checks schema for files matching certain file names using either lxml or SAX2Count.exe depending on availability. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify @@ -27,7 +27,10 @@ import subprocess import glob import traceback -import urllib +try: + from urllib.request import unquote +except ImportError: + from urllib import unquote try: from lxml import etree haveLxml = True @@ -56,7 +59,7 @@ schemes[schemaLoc] = etree.XMLSchema(etree.parse(schemaLoc)) schemes[schemaLoc].validate(doc) for entry in schemes[schemaLoc].error_log: - s = urllib.unquote(str(entry)) + s = unquote(str(entry)) # remove everything before (and including) the filename s = s[s.find(f.replace('\\', '/')) + len(f):] print(os.path.abspath( diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/xml/xml2csv.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/xml/xml2csv.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/xml/xml2csv.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/xml/xml2csv.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Michael Behrisch @author Laura Bieker @date 2013-12-08 -@version $Id: xml2csv.py 20482 2016-04-18 20:49:42Z behrisch $ +@version $Id: xml2csv.py 22608 2017-01-17 06:28:54Z behrisch $ Convert hierarchical xml files to csv. This only makes sense if the hierarchy has low depth. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2013-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2013-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/xml/xml2protobuf.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/xml/xml2protobuf.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/xml/xml2protobuf.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/xml/xml2protobuf.py 2017-07-23 16:22:03.000000000 +0000 @@ -6,12 +6,12 @@ @author Laura Bieker @author Jakob Erdmann @date 2014-01-22 -@version $Id: xml2protobuf.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: xml2protobuf.py 22608 2017-01-17 06:28:54Z behrisch $ Convert hierarchical xml files to binary protobuf. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/xml/xsd.py sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/xml/xsd.py --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools/xml/xsd.py 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools/xml/xsd.py 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ @author Marek Heinrich @author Michael Behrisch @date 2014-01-20 -@version $Id: xsd.py 20433 2016-04-13 08:00:14Z behrisch $ +@version $Id: xsd.py 22608 2017-01-17 06:28:54Z behrisch $ Helper classes for parsing xsd schemata. SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -Copyright (C) 2014-2016 DLR (http://www.dlr.de/) and contributors +Copyright (C) 2014-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify Binary files /tmp/tmpad6sPJ/z_BuatUg81/sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/tools_filelist and /tmp/tmpad6sPJ/MZtm3qTfO_/sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/tools_filelist differ diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/Makefile.am sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/Makefile.am --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/Makefile.am 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/Makefile.am 2017-07-23 16:22:03.000000000 +0000 @@ -2,10 +2,6 @@ MESO_LIBS = ../../src/mesosim/libmesosim.a -if CHECK_MEMORY_LEAKS -MEM_LIBS = ../../src/foreign/nvwa/libnvwa.a -endif - if WITH_GUI GUI_TESTS = ./utils/foxtools/FXWorkerThreadTest.o endif @@ -34,8 +30,12 @@ ./microsim/MSEventControlTest.o \ $(GUI_TESTS) \ ../../src/netbuild/libnetbuild.a \ -../../src/traci-server/libtraciserver.a \ ../../src/microsim/libmicrosim.a \ +../../src/netload/libnetload.a \ +../../src/microsim/MSJunctionLogic.o \ +../../src/microsim/MSNoLogicJunction.o \ +../../src/traci-server/libtraciserver.a \ +../../src/traci-server/lib/libtraci.a \ ../../src/traci-server/TraCIServer.o \ ../../src/microsim/devices/libmicrosimdevs.a \ ../../src/microsim/trigger/libmicrosimtrigger.a \ @@ -44,7 +44,6 @@ ../../src/microsim/pedestrians/libmicrosimpeds.a \ ../../src/microsim/output/libmicrosimoutput.a \ ../../src/microsim/MSMoveReminder.o \ -../../src/microsim/MSRouteHandler.o \ ../../src/microsim/actions/libmsactions.a \ ../../src/microsim/traffic_lights/libmicrosimtls.a \ $(MESO_LIBS) \ @@ -52,6 +51,7 @@ ../../src/utils/shapes/libshapes.a \ ../../src/utils/emissions/libemissions.a \ ../../src/utils/xml/libxml.a \ +../../src/utils/distribution/libdistribution.a \ ../../src/utils/vehicle/libvehicle.a \ ../../src/utils/common/libcommon.a \ ../../src/utils/options/liboptions.a \ @@ -59,7 +59,6 @@ ../../src/utils/common/FileHelpers.o \ ../../src/foreign/PHEMlight/cpp/libphemlight.a \ ../../src/foreign/tcpip/libtcpip.a \ -$(MEM_LIBS) \ $(PYTHON_LIBS) \ $(XERCES_LIBS) \ $(FOX_LDFLAGS) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/Makefile.in sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/Makefile.in --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/Makefile.in 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/Makefile.in 2017-07-23 16:22:03.000000000 +0000 @@ -112,8 +112,12 @@ @WITH_GTEST_TRUE@ ./microsim/MSCFModelTest.o \ @WITH_GTEST_TRUE@ ./microsim/MSEventControlTest.o $(GUI_TESTS) \ @WITH_GTEST_TRUE@ ../../src/netbuild/libnetbuild.a \ -@WITH_GTEST_TRUE@ ../../src/traci-server/libtraciserver.a \ @WITH_GTEST_TRUE@ ../../src/microsim/libmicrosim.a \ +@WITH_GTEST_TRUE@ ../../src/netload/libnetload.a \ +@WITH_GTEST_TRUE@ ../../src/microsim/MSJunctionLogic.o \ +@WITH_GTEST_TRUE@ ../../src/microsim/MSNoLogicJunction.o \ +@WITH_GTEST_TRUE@ ../../src/traci-server/libtraciserver.a \ +@WITH_GTEST_TRUE@ ../../src/traci-server/lib/libtraci.a \ @WITH_GTEST_TRUE@ ../../src/traci-server/TraCIServer.o \ @WITH_GTEST_TRUE@ ../../src/microsim/devices/libmicrosimdevs.a \ @WITH_GTEST_TRUE@ ../../src/microsim/trigger/libmicrosimtrigger.a \ @@ -122,13 +126,13 @@ @WITH_GTEST_TRUE@ ../../src/microsim/pedestrians/libmicrosimpeds.a \ @WITH_GTEST_TRUE@ ../../src/microsim/output/libmicrosimoutput.a \ @WITH_GTEST_TRUE@ ../../src/microsim/MSMoveReminder.o \ -@WITH_GTEST_TRUE@ ../../src/microsim/MSRouteHandler.o \ @WITH_GTEST_TRUE@ ../../src/microsim/actions/libmsactions.a \ @WITH_GTEST_TRUE@ ../../src/microsim/traffic_lights/libmicrosimtls.a \ @WITH_GTEST_TRUE@ $(MESO_LIBS) ../../src/utils/geom/libgeom.a \ @WITH_GTEST_TRUE@ ../../src/utils/shapes/libshapes.a \ @WITH_GTEST_TRUE@ ../../src/utils/emissions/libemissions.a \ @WITH_GTEST_TRUE@ ../../src/utils/xml/libxml.a \ +@WITH_GTEST_TRUE@ ../../src/utils/distribution/libdistribution.a \ @WITH_GTEST_TRUE@ ../../src/utils/vehicle/libvehicle.a \ @WITH_GTEST_TRUE@ ../../src/utils/common/libcommon.a \ @WITH_GTEST_TRUE@ ../../src/utils/options/liboptions.a \ @@ -136,8 +140,8 @@ @WITH_GTEST_TRUE@ ../../src/utils/common/FileHelpers.o \ @WITH_GTEST_TRUE@ ../../src/foreign/PHEMlight/cpp/libphemlight.a \ @WITH_GTEST_TRUE@ ../../src/foreign/tcpip/libtcpip.a \ -@WITH_GTEST_TRUE@ $(MEM_LIBS) $(am__DEPENDENCIES_1) \ -@WITH_GTEST_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +@WITH_GTEST_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ +@WITH_GTEST_TRUE@ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -393,7 +397,6 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MESO_LIBS = ../../src/mesosim/libmesosim.a -@CHECK_MEMORY_LEAKS_TRUE@MEM_LIBS = ../../src/foreign/nvwa/libnvwa.a @WITH_GUI_TRUE@GUI_TESTS = ./utils/foxtools/FXWorkerThreadTest.o @WITH_GTEST_TRUE@sumo_unittest_SOURCES = unittest_main.cpp @WITH_GTEST_TRUE@sumo_unittest_LDFLAGS = $(GTEST_LDFLAGS) $(GDAL_LDFLAGS) $(PROJ_LDFLAGS) @@ -413,8 +416,12 @@ @WITH_GTEST_TRUE@./microsim/MSEventControlTest.o \ @WITH_GTEST_TRUE@$(GUI_TESTS) \ @WITH_GTEST_TRUE@../../src/netbuild/libnetbuild.a \ -@WITH_GTEST_TRUE@../../src/traci-server/libtraciserver.a \ @WITH_GTEST_TRUE@../../src/microsim/libmicrosim.a \ +@WITH_GTEST_TRUE@../../src/netload/libnetload.a \ +@WITH_GTEST_TRUE@../../src/microsim/MSJunctionLogic.o \ +@WITH_GTEST_TRUE@../../src/microsim/MSNoLogicJunction.o \ +@WITH_GTEST_TRUE@../../src/traci-server/libtraciserver.a \ +@WITH_GTEST_TRUE@../../src/traci-server/lib/libtraci.a \ @WITH_GTEST_TRUE@../../src/traci-server/TraCIServer.o \ @WITH_GTEST_TRUE@../../src/microsim/devices/libmicrosimdevs.a \ @WITH_GTEST_TRUE@../../src/microsim/trigger/libmicrosimtrigger.a \ @@ -423,7 +430,6 @@ @WITH_GTEST_TRUE@../../src/microsim/pedestrians/libmicrosimpeds.a \ @WITH_GTEST_TRUE@../../src/microsim/output/libmicrosimoutput.a \ @WITH_GTEST_TRUE@../../src/microsim/MSMoveReminder.o \ -@WITH_GTEST_TRUE@../../src/microsim/MSRouteHandler.o \ @WITH_GTEST_TRUE@../../src/microsim/actions/libmsactions.a \ @WITH_GTEST_TRUE@../../src/microsim/traffic_lights/libmicrosimtls.a \ @WITH_GTEST_TRUE@$(MESO_LIBS) \ @@ -431,6 +437,7 @@ @WITH_GTEST_TRUE@../../src/utils/shapes/libshapes.a \ @WITH_GTEST_TRUE@../../src/utils/emissions/libemissions.a \ @WITH_GTEST_TRUE@../../src/utils/xml/libxml.a \ +@WITH_GTEST_TRUE@../../src/utils/distribution/libdistribution.a \ @WITH_GTEST_TRUE@../../src/utils/vehicle/libvehicle.a \ @WITH_GTEST_TRUE@../../src/utils/common/libcommon.a \ @WITH_GTEST_TRUE@../../src/utils/options/liboptions.a \ @@ -438,7 +445,6 @@ @WITH_GTEST_TRUE@../../src/utils/common/FileHelpers.o \ @WITH_GTEST_TRUE@../../src/foreign/PHEMlight/cpp/libphemlight.a \ @WITH_GTEST_TRUE@../../src/foreign/tcpip/libtcpip.a \ -@WITH_GTEST_TRUE@$(MEM_LIBS) \ @WITH_GTEST_TRUE@$(PYTHON_LIBS) \ @WITH_GTEST_TRUE@$(XERCES_LIBS) \ @WITH_GTEST_TRUE@$(FOX_LDFLAGS) diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/microsim/MSCFModelTest.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/microsim/MSCFModelTest.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/microsim/MSCFModelTest.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/microsim/MSCFModelTest.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Jakob Erdmann /// @author Michael Behrisch /// @date 2013-06-05 -/// @version $Id: MSCFModelTest.cpp 21662 2016-10-12 07:30:29Z namdre $ +/// @version $Id: MSCFModelTest.cpp 23699 2017-03-29 07:16:27Z namdre $ /// // Tests the cfmodel functions /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -40,10 +40,10 @@ protected : MSVehicleType* type; MSCFModel* m; - SUMOReal accel; - SUMOReal decel; - SUMOReal dawdle; - SUMOReal tau; // headway time + double accel; + double decel; + double dawdle; + double tau; // headway time virtual void SetUp(){ accel = 2; @@ -52,7 +52,7 @@ tau = 1; type = new MSVehicleType(SUMOVTypeParameter("0")); m = new MSCFModel_Krauss(type, - accel, decel, dawdle, tau); + accel, decel, decel, decel, dawdle, tau); MSGlobals::gSemiImplicitEulerUpdate = true; } @@ -66,14 +66,14 @@ TEST_F(MSCFModelTest, test_method_brakeGap) { // discrete braking model. keep driving for 1 s - const SUMOReal v = 3; + const double v = 3; EXPECT_DOUBLE_EQ(tau * v, m->brakeGap(v)); } TEST_F(MSCFModelTest, test_method_static_brakeGap) { - const SUMOReal v = 3; - const SUMOReal b = 4; - const SUMOReal tau = 1; + const double v = 3; + const double b = 4; + const double tau = 1; EXPECT_DOUBLE_EQ(3, MSCFModel::brakeGap(v, b, tau)); EXPECT_DOUBLE_EQ(0, MSCFModel::brakeGap(v, b, 0)); EXPECT_DOUBLE_EQ(3, MSCFModel::brakeGap(7, b, 0)); @@ -83,10 +83,10 @@ } TEST_F(MSCFModelTest, test_method_static_freeSpeed) { - const SUMOReal vCur = 10; - const SUMOReal b = 4; - const SUMOReal v = 0; - const SUMOReal g = 4; + const double vCur = 10; + const double b = 4; + const double v = 0; + const double g = 4; EXPECT_DOUBLE_EQ(4, MSCFModel::freeSpeed(vCur, b, g, v, false)); EXPECT_DOUBLE_EQ(8, MSCFModel::freeSpeed(vCur, b, g, v, true)); EXPECT_DOUBLE_EQ(17.5, MSCFModel::freeSpeed(vCur, 5, 30, 10, false)); @@ -99,9 +99,9 @@ #ifdef HAVE_SUBSECOND_TIMESTEPS TEST_F(MSCFModelTest, test_method_static_freeSpeed_half) { DELTA_T = 500; - const SUMOReal b = 4; - const SUMOReal v = 0; - const SUMOReal g = 4; + const double b = 4; + const double v = 0; + const double g = 4; EXPECT_DOUBLE_EQ(14./3., MSCFModel::freeSpeed(b, g, v, false)); EXPECT_DOUBLE_EQ(6., MSCFModel::freeSpeed(b, 6, v, false)); EXPECT_DOUBLE_EQ(18.75, MSCFModel::freeSpeed(5, 30, 10, false)); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/microsim/MSEventControlTest.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/microsim/MSEventControlTest.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/microsim/MSEventControlTest.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/microsim/MSEventControlTest.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 2009-11-23 -/// @version $Id: MSEventControlTest.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: MSEventControlTest.cpp 24012 2017-04-22 09:02:16Z behrisch $ /// // Tests the class MSEventControl /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -32,12 +32,9 @@ MSEventControl eventControl; CommandMock *mock = new CommandMock(); eventControl.setCurrentTimeStep(4); - eventControl.addEvent(mock,1,MSEventControl::ADAPT_AFTER_EXECUTION); + eventControl.addEvent(mock); EXPECT_FALSE(mock->isExecuteCalled()); eventControl.execute(5); EXPECT_TRUE(mock->isExecuteCalled()); } - - - diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/netbuild/NBHeightMapperTest.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/netbuild/NBHeightMapperTest.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/netbuild/NBHeightMapperTest.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/netbuild/NBHeightMapperTest.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date 2014-09-09 -/// @version $Id: NBHeightMapperTest.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NBHeightMapperTest.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // Tests the class NBHeightMapper /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/netbuild/NBTrafficLightLogicTest.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/netbuild/NBTrafficLightLogicTest.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/netbuild/NBTrafficLightLogicTest.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/netbuild/NBTrafficLightLogicTest.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 2009-10-24 -/// @version $Id: NBTrafficLightLogicTest.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: NBTrafficLightLogicTest.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // Tests the class NBTrafficLightLogic /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/unittest_main.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/unittest_main.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/unittest_main.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/unittest_main.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Matthias Heppner /// @author Michael Behrisch /// @date Sept 2009 -/// @version $Id: unittest_main.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: unittest_main.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // main for the unit tests /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/common/CommandMock.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/common/CommandMock.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/common/CommandMock.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/common/CommandMock.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Matthias Heppner /// @author Michael Behrisch /// @date 2009-11-30 -/// @version $Id: CommandMock.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: CommandMock.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/common/RGBColorTest.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/common/RGBColorTest.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/common/RGBColorTest.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/common/RGBColorTest.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2009 -/// @version $Id: RGBColorTest.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: RGBColorTest.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // Tests the class RGBColor /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2009-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2009-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/common/StringUtilsTest.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/common/StringUtilsTest.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/common/StringUtilsTest.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/common/StringUtilsTest.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Matthias Heppner /// @author Michael Behrisch /// @date 2009 -/// @version $Id: StringUtilsTest.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: StringUtilsTest.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // Tests StringUtils class from /src/utils/common /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/common/TplConvertTest.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/common/TplConvertTest.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/common/TplConvertTest.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/common/TplConvertTest.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Oct 2010 -/// @version $Id: TplConvertTest.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: TplConvertTest.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // Tests the class TplConvert /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2010-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2010-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -58,22 +58,22 @@ } -/* Test the method '_2SUMOReal'.*/ -TEST(TplConvert, test_2SUMOReal) { - EXPECT_EQ(0, TplConvert::_2SUMOReal("0")); - EXPECT_EQ(1, TplConvert::_2SUMOReal("+1")); - EXPECT_EQ(-1, TplConvert::_2SUMOReal("-1")); - EXPECT_EQ(1, TplConvert::_2SUMOReal("1e0")); - EXPECT_EQ(10, TplConvert::_2SUMOReal("1e1")); - EXPECT_EQ(1, TplConvert::_2SUMOReal("1.")); - EXPECT_EQ(1.1, TplConvert::_2SUMOReal("1.1")); - EXPECT_EQ(.1, TplConvert::_2SUMOReal(".1")); - EXPECT_EQ(1.1, TplConvert::_2SUMOReal("1,1")); - EXPECT_EQ(.1, TplConvert::_2SUMOReal(",1")); - EXPECT_EQ(100000000000, TplConvert::_2SUMOReal("100000000000")); - EXPECT_THROW(TplConvert::_2SUMOReal(""), EmptyData); - EXPECT_THROW(TplConvert::_2SUMOReal("1e0x"), NumberFormatException); - EXPECT_THROW(TplConvert::_2SUMOReal("1x"), NumberFormatException); +/* Test the method '_2double'.*/ +TEST(TplConvert, test_2double) { + EXPECT_EQ(0, TplConvert::_2double("0")); + EXPECT_EQ(1, TplConvert::_2double("+1")); + EXPECT_EQ(-1, TplConvert::_2double("-1")); + EXPECT_EQ(1, TplConvert::_2double("1e0")); + EXPECT_EQ(10, TplConvert::_2double("1e1")); + EXPECT_EQ(1, TplConvert::_2double("1.")); + EXPECT_EQ(1.1, TplConvert::_2double("1.1")); + EXPECT_EQ(.1, TplConvert::_2double(".1")); + EXPECT_EQ(1.1, TplConvert::_2double("1,1")); + EXPECT_EQ(.1, TplConvert::_2double(",1")); + EXPECT_EQ(100000000000, TplConvert::_2double("100000000000")); + EXPECT_THROW(TplConvert::_2double(""), EmptyData); + EXPECT_THROW(TplConvert::_2double("1e0x"), NumberFormatException); + EXPECT_THROW(TplConvert::_2double("1x"), NumberFormatException); } diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/common/ValueTimeLineTest.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/common/ValueTimeLineTest.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/common/ValueTimeLineTest.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/common/ValueTimeLineTest.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Matthias Heppner /// @author Michael Behrisch /// @date Sept 2009 -/// @version $Id: ValueTimeLineTest.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: ValueTimeLineTest.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // Tests ValueTimeLine class from /src/utils/common /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/foxtools/FXWorkerThreadTest.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/foxtools/FXWorkerThreadTest.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/foxtools/FXWorkerThreadTest.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/foxtools/FXWorkerThreadTest.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -2,12 +2,12 @@ /// @file FXWorkerThreadTest.cpp /// @author Michael Behrisch /// @date Oct 2010 -/// @version $Id: FXWorkerThreadTest.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: FXWorkerThreadTest.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // Tests the class FXWorkerThread /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/geom/BoundaryTest.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/geom/BoundaryTest.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/geom/BoundaryTest.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/geom/BoundaryTest.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Matthias Heppner /// @author Michael Behrisch /// @date 2009-05-27 -/// @version $Id: BoundaryTest.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: BoundaryTest.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // Tests the class Boundary /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/geom/GeoConvHelperTest.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/geom/GeoConvHelperTest.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/geom/GeoConvHelperTest.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/geom/GeoConvHelperTest.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Jakob Erdmann /// @author Laura Bieker /// @date 2011-09-23 -/// @version $Id: GeoConvHelperTest.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GeoConvHelperTest.cpp 22608 2017-01-17 06:28:54Z behrisch $ /// // Tests the class RandHelper /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/geom/GeomHelperTest.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/geom/GeomHelperTest.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/geom/GeomHelperTest.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/geom/GeomHelperTest.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Laura Bieker /// @author Michael Behrisch /// @date 2011-12-12 -/// @version $Id: GeomHelperTest.cpp 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: GeomHelperTest.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // Tests the class GeomHelper /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -86,12 +86,12 @@ TEST(GeomHelper, test_method_closestDistancePointLine_basic) { Position expected(1,0); - SUMOReal expectedDistance = 1; + double expectedDistance = 1; Position point(1,1); Position start(0,0); Position end(2,0); Position closestPoint; - SUMOReal result = GeomHelper::closestDistancePointLine2D(point, start, end, closestPoint); + double result = GeomHelper::closestDistancePointLine2D(point, start, end, closestPoint); EXPECT_FLOAT_EQ(expected.x(), closestPoint.x()); EXPECT_FLOAT_EQ(expected.y(), closestPoint.y()); EXPECT_FLOAT_EQ(expected.z(), closestPoint.z()); @@ -99,12 +99,12 @@ } TEST(GeomHelper, test_method_closestDistancePointLine_onLine) { Position expected(1,0); - SUMOReal expectedDistance = 0; + double expectedDistance = 0; Position point(1,0); Position start(0,0); Position end(2,0); Position closestPoint; - SUMOReal result = GeomHelper::closestDistancePointLine2D(point, start, end, closestPoint); + double result = GeomHelper::closestDistancePointLine2D(point, start, end, closestPoint); EXPECT_FLOAT_EQ(expected.x(), closestPoint.x()); EXPECT_FLOAT_EQ(expected.y(), closestPoint.y()); EXPECT_FLOAT_EQ(expected.z(), closestPoint.z()); @@ -112,12 +112,12 @@ } TEST(GeomHelper, test_method_closestDistancePointLine_outside_after) { Position expected(2,0); - SUMOReal expectedDistance = 5; + double expectedDistance = 5; Position point(5,4); Position start(0,0); Position end(2,0); Position closestPoint; - SUMOReal result = GeomHelper::closestDistancePointLine2D(point, start, end, closestPoint); + double result = GeomHelper::closestDistancePointLine2D(point, start, end, closestPoint); EXPECT_FLOAT_EQ(expected.x(), closestPoint.x()); EXPECT_FLOAT_EQ(expected.y(), closestPoint.y()); EXPECT_FLOAT_EQ(expected.z(), closestPoint.z()); @@ -125,12 +125,12 @@ } TEST(GeomHelper, test_method_closestDistancePointLine_outside_before) { Position expected(0,0); - SUMOReal expectedDistance = 5; + double expectedDistance = 5; Position point(-3,4); Position start(0,0); Position end(2,0); Position closestPoint; - SUMOReal result = GeomHelper::closestDistancePointLine2D(point, start, end, closestPoint); + double result = GeomHelper::closestDistancePointLine2D(point, start, end, closestPoint); EXPECT_FLOAT_EQ(expected.x(), closestPoint.x()); EXPECT_FLOAT_EQ(expected.y(), closestPoint.y()); EXPECT_FLOAT_EQ(expected.z(), closestPoint.z()); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/geom/PositionVectorTest.cpp sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/geom/PositionVectorTest.cpp --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/geom/PositionVectorTest.cpp 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/geom/PositionVectorTest.cpp 2017-07-23 16:22:03.000000000 +0000 @@ -4,12 +4,12 @@ /// @author Michael Behrisch /// @author Jakob Erdmann /// @date 2009-10-24 -/// @version $Id: PositionVectorTest.cpp 20859 2016-06-03 08:45:01Z namdre $ +/// @version $Id: PositionVectorTest.cpp 23150 2017-02-27 12:08:30Z behrisch $ /// // Tests the class PositionVector /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. @@ -164,7 +164,7 @@ vec.push_back(Position(0,0)); vec.push_back(Position(2,0)); vec.push_back(Position(5,0)); - SUMOReal smallDiff = POSITION_EPS / 2; + double smallDiff = POSITION_EPS / 2; std::pair result; // split in first segment result = vec.splitAt(1); @@ -500,7 +500,7 @@ PositionVector vec3; - std::vector res1; + std::vector res1; res1.push_back(1); res1.push_back(0); res1.push_back(0); @@ -510,7 +510,7 @@ EXPECT_DOUBLEVEC_EQUAL(res1, vec1.distances(vec2)); - std::vector res2; + std::vector res2; //invalid: res1.push_back(1); res2.push_back(0); res2.push_back(0); @@ -520,7 +520,7 @@ EXPECT_DOUBLEVEC_EQUAL(res2, vec1.distances(vec2, true)); - std::vector res3; + std::vector res3; res3.push_back(std::numeric_limits::max()); res3.push_back(std::numeric_limits::max()); EXPECT_DOUBLEVEC_EQUAL(res3, vec1.distances(vec3)); diff -Nru sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/iodevices/OutputDeviceMock.h sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/iodevices/OutputDeviceMock.h --- sumo-0.28.0+dfsg1+7+20~ubuntu15.04.1/unittest/src/utils/iodevices/OutputDeviceMock.h 2016-11-06 09:15:41.000000000 +0000 +++ sumo-0.30.0+dfsg1+8+21~ubuntu15.04.1/unittest/src/utils/iodevices/OutputDeviceMock.h 2017-07-23 16:22:03.000000000 +0000 @@ -3,12 +3,12 @@ /// @author Matthias Heppner /// @author Michael Behrisch /// @date 2009-11-23 -/// @version $Id: OutputDeviceMock.h 20433 2016-04-13 08:00:14Z behrisch $ +/// @version $Id: OutputDeviceMock.h 22608 2017-01-17 06:28:54Z behrisch $ /// // /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ -// Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors +// Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO.